@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
|
@@ -747,15 +747,15 @@ var __publicField = (obj, key, value) => {
|
|
|
747
747
|
};
|
|
748
748
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
749
749
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
750
|
-
const initialState$
|
|
750
|
+
const initialState$B = {
|
|
751
751
|
accessToken: "",
|
|
752
752
|
refreshToken: "",
|
|
753
753
|
isLoggedIn: false
|
|
754
754
|
};
|
|
755
755
|
const authSlice = toolkit.createSlice({
|
|
756
756
|
name: "auth",
|
|
757
|
-
initialState: initialState$
|
|
758
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
757
|
+
initialState: initialState$B,
|
|
758
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
|
|
759
759
|
reducers: {
|
|
760
760
|
setTokens: (state, action) => {
|
|
761
761
|
state.accessToken = action.payload.accessToken;
|
|
@@ -843,11 +843,11 @@ var __publicField = (obj, key, value) => {
|
|
|
843
843
|
};
|
|
844
844
|
}
|
|
845
845
|
const categoryAdapter = createModelAdapter((category) => category.offline_id);
|
|
846
|
-
const initialState$
|
|
846
|
+
const initialState$A = categoryAdapter.getInitialState({});
|
|
847
847
|
const categorySlice = toolkit.createSlice({
|
|
848
848
|
name: "categories",
|
|
849
|
-
initialState: initialState$
|
|
850
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
849
|
+
initialState: initialState$A,
|
|
850
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$A)),
|
|
851
851
|
reducers: {
|
|
852
852
|
initializeCategories: categoryAdapter.initialize,
|
|
853
853
|
addCategory: categoryAdapter.addOne,
|
|
@@ -891,11 +891,11 @@ var __publicField = (obj, key, value) => {
|
|
|
891
891
|
};
|
|
892
892
|
const categoryReducer = categorySlice.reducer;
|
|
893
893
|
const assetAdapter = createModelAdapter((asset) => asset.offline_id);
|
|
894
|
-
const initialState$
|
|
894
|
+
const initialState$z = assetAdapter.getInitialState({});
|
|
895
895
|
const assetSlice = toolkit.createSlice({
|
|
896
896
|
name: "assets",
|
|
897
|
-
initialState: initialState$
|
|
898
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
897
|
+
initialState: initialState$z,
|
|
898
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
|
|
899
899
|
reducers: {
|
|
900
900
|
initializeAssets: assetAdapter.initialize,
|
|
901
901
|
addAsset: assetAdapter.addOne,
|
|
@@ -947,11 +947,11 @@ var __publicField = (obj, key, value) => {
|
|
|
947
947
|
};
|
|
948
948
|
const assetReducer = assetSlice.reducer;
|
|
949
949
|
const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
950
|
-
const initialState$
|
|
950
|
+
const initialState$y = assetAttachmentAdapter.getInitialState({});
|
|
951
951
|
const assetAttachmentSlice = toolkit.createSlice({
|
|
952
952
|
name: "assetAttachments",
|
|
953
|
-
initialState: initialState$
|
|
954
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
953
|
+
initialState: initialState$y,
|
|
954
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
|
|
955
955
|
reducers: {
|
|
956
956
|
initializeAssetAttachments: assetAttachmentAdapter.initialize,
|
|
957
957
|
addAssetAttachment: assetAttachmentAdapter.addOne,
|
|
@@ -1012,11 +1012,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1012
1012
|
const assetStageCompletionAdapter = createModelAdapter(
|
|
1013
1013
|
(stageCompletion) => stageCompletion.offline_id
|
|
1014
1014
|
);
|
|
1015
|
-
const initialState$
|
|
1015
|
+
const initialState$x = assetStageCompletionAdapter.getInitialState({});
|
|
1016
1016
|
const assetStageCompletionSlice = toolkit.createSlice({
|
|
1017
1017
|
name: "assetStageCompletions",
|
|
1018
|
-
initialState: initialState$
|
|
1019
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1018
|
+
initialState: initialState$x,
|
|
1019
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
|
|
1020
1020
|
reducers: {
|
|
1021
1021
|
initializeAssetStageCompletions: assetStageCompletionAdapter.initialize,
|
|
1022
1022
|
addAssetStageCompletion: assetStageCompletionAdapter.addOne,
|
|
@@ -1078,11 +1078,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1078
1078
|
);
|
|
1079
1079
|
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1080
1080
|
const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
|
|
1081
|
-
const initialState$
|
|
1081
|
+
const initialState$w = assetStageAdapter.getInitialState({});
|
|
1082
1082
|
const assetStageSlice = toolkit.createSlice({
|
|
1083
1083
|
name: "assetStages",
|
|
1084
|
-
initialState: initialState$
|
|
1085
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1084
|
+
initialState: initialState$w,
|
|
1085
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
|
|
1086
1086
|
reducers: {
|
|
1087
1087
|
initializeAssetStages: assetStageAdapter.initialize,
|
|
1088
1088
|
setAssetStage: assetStageAdapter.setOne,
|
|
@@ -1162,11 +1162,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1162
1162
|
})
|
|
1163
1163
|
);
|
|
1164
1164
|
const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
|
|
1165
|
-
const initialState$
|
|
1165
|
+
const initialState$v = assetTypeAdapter.getInitialState({});
|
|
1166
1166
|
const assetTypeSlice = toolkit.createSlice({
|
|
1167
1167
|
name: "assetTypes",
|
|
1168
|
-
initialState: initialState$
|
|
1169
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1168
|
+
initialState: initialState$v,
|
|
1169
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
|
|
1170
1170
|
reducers: {
|
|
1171
1171
|
initializeAssetTypes: assetTypeAdapter.initialize,
|
|
1172
1172
|
setAssetType: assetTypeAdapter.setOne,
|
|
@@ -1219,11 +1219,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1219
1219
|
const assetTypeAttachmentAdapter = createModelAdapter(
|
|
1220
1220
|
(attachment) => attachment.offline_id
|
|
1221
1221
|
);
|
|
1222
|
-
const initialState$
|
|
1222
|
+
const initialState$u = assetTypeAttachmentAdapter.getInitialState({});
|
|
1223
1223
|
const assetTypeAttachmentSlice = toolkit.createSlice({
|
|
1224
1224
|
name: "assetTypeAttachments",
|
|
1225
|
-
initialState: initialState$
|
|
1226
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1225
|
+
initialState: initialState$u,
|
|
1226
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
|
|
1227
1227
|
reducers: {
|
|
1228
1228
|
initializeAssetTypeAttachments: assetTypeAttachmentAdapter.initialize,
|
|
1229
1229
|
addAssetTypeAttachment: assetTypeAttachmentAdapter.addOne,
|
|
@@ -1282,12 +1282,12 @@ var __publicField = (obj, key, value) => {
|
|
|
1282
1282
|
);
|
|
1283
1283
|
const assetTypeAttachmentReducer = assetTypeAttachmentSlice.reducer;
|
|
1284
1284
|
const issueAdapter = createModelAdapter((issue) => issue.offline_id);
|
|
1285
|
-
const initialState$
|
|
1285
|
+
const initialState$t = issueAdapter.getInitialState({});
|
|
1286
1286
|
const issueSlice = toolkit.createSlice({
|
|
1287
1287
|
name: "issues",
|
|
1288
|
-
initialState: initialState$
|
|
1288
|
+
initialState: initialState$t,
|
|
1289
1289
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1290
|
-
Object.assign(state, initialState$
|
|
1290
|
+
Object.assign(state, initialState$t);
|
|
1291
1291
|
}),
|
|
1292
1292
|
reducers: {
|
|
1293
1293
|
initializeIssues: issueAdapter.initialize,
|
|
@@ -1319,12 +1319,12 @@ var __publicField = (obj, key, value) => {
|
|
|
1319
1319
|
);
|
|
1320
1320
|
const issueReducer = issueSlice.reducer;
|
|
1321
1321
|
const issueTypeAdapter = createModelAdapter((issueType) => issueType.offline_id);
|
|
1322
|
-
const initialState$
|
|
1322
|
+
const initialState$s = issueTypeAdapter.getInitialState({});
|
|
1323
1323
|
const issueTypeSlice = toolkit.createSlice({
|
|
1324
1324
|
name: "issueTypes",
|
|
1325
|
-
initialState: initialState$
|
|
1325
|
+
initialState: initialState$s,
|
|
1326
1326
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1327
|
-
Object.assign(state, initialState$
|
|
1327
|
+
Object.assign(state, initialState$s);
|
|
1328
1328
|
}),
|
|
1329
1329
|
reducers: {
|
|
1330
1330
|
initializeIssueTypes: issueTypeAdapter.initialize,
|
|
@@ -1381,15 +1381,15 @@ var __publicField = (obj, key, value) => {
|
|
|
1381
1381
|
return selectIssuesOfIssueType(issueTypeId)(state).length;
|
|
1382
1382
|
};
|
|
1383
1383
|
const issueTypeReducer = issueTypeSlice.reducer;
|
|
1384
|
-
const initialState$
|
|
1384
|
+
const initialState$r = {
|
|
1385
1385
|
s3Urls: {}
|
|
1386
1386
|
};
|
|
1387
1387
|
const msPerHour = 1e3 * 60 * 60;
|
|
1388
1388
|
const msPerWeek = msPerHour * 24 * 7;
|
|
1389
1389
|
const fileSlice = toolkit.createSlice({
|
|
1390
1390
|
name: "file",
|
|
1391
|
-
initialState: initialState$
|
|
1392
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1391
|
+
initialState: initialState$r,
|
|
1392
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
|
|
1393
1393
|
reducers: {
|
|
1394
1394
|
setUploadUrl: (state, action) => {
|
|
1395
1395
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -1416,14 +1416,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1416
1416
|
return url;
|
|
1417
1417
|
};
|
|
1418
1418
|
const fileReducer = fileSlice.reducer;
|
|
1419
|
-
const initialState$
|
|
1419
|
+
const initialState$q = {
|
|
1420
1420
|
users: {},
|
|
1421
1421
|
currentUser: null
|
|
1422
1422
|
};
|
|
1423
1423
|
const userSlice = toolkit.createSlice({
|
|
1424
1424
|
name: "users",
|
|
1425
|
-
initialState: initialState$
|
|
1426
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1425
|
+
initialState: initialState$q,
|
|
1426
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1427
1427
|
reducers: {
|
|
1428
1428
|
setUsers: (state, action) => {
|
|
1429
1429
|
const usersMapping = {};
|
|
@@ -1481,11 +1481,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1481
1481
|
const organizationAccessAdapter = createModelAdapter(
|
|
1482
1482
|
(organizationAccess) => organizationAccess.offline_id
|
|
1483
1483
|
);
|
|
1484
|
-
const initialState$
|
|
1484
|
+
const initialState$p = organizationAccessAdapter.getInitialState({});
|
|
1485
1485
|
const organizationAccessSlice = toolkit.createSlice({
|
|
1486
1486
|
name: "organizationAccess",
|
|
1487
|
-
initialState: initialState$
|
|
1488
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1487
|
+
initialState: initialState$p,
|
|
1488
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
1489
1489
|
reducers: {
|
|
1490
1490
|
initializeOrganizationAccesses: organizationAccessAdapter.initialize,
|
|
1491
1491
|
updateOrganizationAccess: organizationAccessAdapter.updateOne,
|
|
@@ -1522,11 +1522,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1522
1522
|
};
|
|
1523
1523
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
1524
1524
|
const licenseAdapter = createModelAdapter((license) => license.offline_id);
|
|
1525
|
-
const initialState$
|
|
1525
|
+
const initialState$o = licenseAdapter.getInitialState({});
|
|
1526
1526
|
const licenseSlice = toolkit.createSlice({
|
|
1527
1527
|
name: "license",
|
|
1528
|
-
initialState: initialState$
|
|
1529
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1528
|
+
initialState: initialState$o,
|
|
1529
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1530
1530
|
reducers: {
|
|
1531
1531
|
initializeLicences: licenseAdapter.initialize,
|
|
1532
1532
|
addLicenses: licenseAdapter.addMany,
|
|
@@ -1551,11 +1551,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1551
1551
|
);
|
|
1552
1552
|
const licenseReducer = licenseSlice.reducer;
|
|
1553
1553
|
const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
|
|
1554
|
-
const initialState$
|
|
1554
|
+
const initialState$n = projectAccessAdapter.getInitialState({});
|
|
1555
1555
|
const projectAccessSlice = toolkit.createSlice({
|
|
1556
1556
|
name: "projectAccess",
|
|
1557
|
-
initialState: initialState$
|
|
1558
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1557
|
+
initialState: initialState$n,
|
|
1558
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
1559
1559
|
reducers: {
|
|
1560
1560
|
initializeProjectAccesses: projectAccessAdapter.initialize,
|
|
1561
1561
|
updateProjectAccess: projectAccessAdapter.updateOne,
|
|
@@ -1596,14 +1596,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1596
1596
|
return projectAccesses;
|
|
1597
1597
|
};
|
|
1598
1598
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
1599
|
-
const initialState$
|
|
1599
|
+
const initialState$m = {
|
|
1600
1600
|
projects: {},
|
|
1601
1601
|
activeProjectId: null
|
|
1602
1602
|
};
|
|
1603
1603
|
const projectSlice = toolkit.createSlice({
|
|
1604
1604
|
name: "projects",
|
|
1605
|
-
initialState: initialState$
|
|
1606
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1605
|
+
initialState: initialState$m,
|
|
1606
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
1607
1607
|
reducers: {
|
|
1608
1608
|
setProjects: (state, action) => {
|
|
1609
1609
|
const projectsMap = {};
|
|
@@ -1710,13 +1710,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1710
1710
|
});
|
|
1711
1711
|
}
|
|
1712
1712
|
);
|
|
1713
|
-
const initialState$
|
|
1713
|
+
const initialState$l = {
|
|
1714
1714
|
organizations: {}
|
|
1715
1715
|
};
|
|
1716
1716
|
const organizationSlice = toolkit.createSlice({
|
|
1717
1717
|
name: "organizations",
|
|
1718
|
-
initialState: initialState$
|
|
1719
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1718
|
+
initialState: initialState$l,
|
|
1719
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
|
|
1720
1720
|
reducers: {
|
|
1721
1721
|
setOrganizations: (state, action) => {
|
|
1722
1722
|
for (const org of action.payload) {
|
|
@@ -1807,14 +1807,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1807
1807
|
}
|
|
1808
1808
|
};
|
|
1809
1809
|
};
|
|
1810
|
-
const initialState$
|
|
1810
|
+
const initialState$k = {
|
|
1811
1811
|
deletedRequests: [],
|
|
1812
1812
|
latestRetryTime: 0
|
|
1813
1813
|
};
|
|
1814
1814
|
const outboxSlice = toolkit.createSlice({
|
|
1815
1815
|
name: "outbox",
|
|
1816
|
-
initialState: initialState$
|
|
1817
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1816
|
+
initialState: initialState$k,
|
|
1817
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
|
|
1818
1818
|
reducers: {
|
|
1819
1819
|
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
1820
1820
|
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
@@ -1846,15 +1846,15 @@ var __publicField = (obj, key, value) => {
|
|
|
1846
1846
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
1847
1847
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
1848
1848
|
const outboxReducer = outboxSlice.reducer;
|
|
1849
|
-
const initialState$
|
|
1849
|
+
const initialState$j = {
|
|
1850
1850
|
projectFiles: {},
|
|
1851
1851
|
activeProjectFileId: null,
|
|
1852
1852
|
isImportingProjectFile: false
|
|
1853
1853
|
};
|
|
1854
1854
|
const projectFileSlice = toolkit.createSlice({
|
|
1855
1855
|
name: "projectFiles",
|
|
1856
|
-
initialState: initialState$
|
|
1857
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1856
|
+
initialState: initialState$j,
|
|
1857
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
|
|
1858
1858
|
reducers: {
|
|
1859
1859
|
addOrReplaceProjectFiles: (state, action) => {
|
|
1860
1860
|
for (let fileObj of action.payload) {
|
|
@@ -1941,11 +1941,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1941
1941
|
};
|
|
1942
1942
|
const projectFileReducer = projectFileSlice.reducer;
|
|
1943
1943
|
const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
1944
|
-
const initialState$
|
|
1944
|
+
const initialState$i = projectAttachmentAdapter.getInitialState({});
|
|
1945
1945
|
const projectAttachmentSlice = toolkit.createSlice({
|
|
1946
1946
|
name: "projectAttachments",
|
|
1947
|
-
initialState: initialState$
|
|
1948
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1947
|
+
initialState: initialState$i,
|
|
1948
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
|
|
1949
1949
|
reducers: {
|
|
1950
1950
|
initializeProjectAttachments: projectAttachmentAdapter.initialize,
|
|
1951
1951
|
addProjectAttachment: projectAttachmentAdapter.addOne,
|
|
@@ -2000,12 +2000,12 @@ var __publicField = (obj, key, value) => {
|
|
|
2000
2000
|
)
|
|
2001
2001
|
);
|
|
2002
2002
|
const projectAttachmentReducer = projectAttachmentSlice.reducer;
|
|
2003
|
-
const initialState$
|
|
2003
|
+
const initialState$h = {
|
|
2004
2004
|
isRehydrated: false
|
|
2005
2005
|
};
|
|
2006
2006
|
const rehydratedSlice = toolkit.createSlice({
|
|
2007
2007
|
name: "rehydrated",
|
|
2008
|
-
initialState: initialState$
|
|
2008
|
+
initialState: initialState$h,
|
|
2009
2009
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
2010
2010
|
reducers: {
|
|
2011
2011
|
setRehydrated: (state, action) => {
|
|
@@ -2030,11 +2030,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2030
2030
|
}
|
|
2031
2031
|
};
|
|
2032
2032
|
const formRevisionAdapter = createModelAdapter((revision) => revision.offline_id);
|
|
2033
|
-
const initialState$
|
|
2033
|
+
const initialState$g = formRevisionAdapter.getInitialState({});
|
|
2034
2034
|
const formRevisionsSlice = toolkit.createSlice({
|
|
2035
2035
|
name: "formRevisions",
|
|
2036
|
-
initialState: initialState$
|
|
2037
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2036
|
+
initialState: initialState$g,
|
|
2037
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
2038
2038
|
reducers: {
|
|
2039
2039
|
initializeFormRevisions: formRevisionAdapter.initialize,
|
|
2040
2040
|
setFormRevision: formRevisionAdapter.setOne,
|
|
@@ -2093,13 +2093,24 @@ var __publicField = (obj, key, value) => {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
)
|
|
2095
2095
|
);
|
|
2096
|
+
const selectLatestFormRevisionByForm = toolkit.createSelector([selectFormRevisionMapping], (revisions) => {
|
|
2097
|
+
const latestRevisions = {};
|
|
2098
|
+
for (const revision of Object.values(revisions)) {
|
|
2099
|
+
const formId = revision.form;
|
|
2100
|
+
const currentLatestRevision = latestRevisions[formId];
|
|
2101
|
+
if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
|
|
2102
|
+
latestRevisions[formId] = revision;
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
return latestRevisions;
|
|
2106
|
+
});
|
|
2096
2107
|
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
2097
2108
|
const formAdapter = createModelAdapter((form) => form.offline_id);
|
|
2098
|
-
const initialState$
|
|
2109
|
+
const initialState$f = formAdapter.getInitialState({});
|
|
2099
2110
|
const formSlice = toolkit.createSlice({
|
|
2100
2111
|
name: "forms",
|
|
2101
|
-
initialState: initialState$
|
|
2102
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2112
|
+
initialState: initialState$f,
|
|
2113
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
|
|
2103
2114
|
reducers: {
|
|
2104
2115
|
initializeForms: formAdapter.initialize,
|
|
2105
2116
|
setForm: formAdapter.setOne,
|
|
@@ -2117,9 +2128,6 @@ var __publicField = (obj, key, value) => {
|
|
|
2117
2128
|
const selectForms = toolkit.createSelector([selectFormMapping], (formsMapping) => {
|
|
2118
2129
|
return Object.values(formsMapping);
|
|
2119
2130
|
});
|
|
2120
|
-
const selectFormById = (formId) => (state) => {
|
|
2121
|
-
return state.formReducer.instances[formId];
|
|
2122
|
-
};
|
|
2123
2131
|
const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
2124
2132
|
toolkit.createSelector(
|
|
2125
2133
|
[
|
|
@@ -2145,12 +2153,37 @@ var __publicField = (obj, key, value) => {
|
|
|
2145
2153
|
{ memoizeOptions: { equalityCheck: shallowEqual } }
|
|
2146
2154
|
)
|
|
2147
2155
|
);
|
|
2156
|
+
const selectFormById = (formId) => (state) => {
|
|
2157
|
+
return state.formReducer.instances[formId];
|
|
2158
|
+
};
|
|
2159
|
+
const selectFormOfAssetType = restructureCreateSelectorWithArgs(
|
|
2160
|
+
toolkit.createSelector(
|
|
2161
|
+
[selectFormMapping, (_state, assetTypeId) => assetTypeId],
|
|
2162
|
+
(formsMapping, assetTypeId) => {
|
|
2163
|
+
return Object.values(formsMapping).find((form) => form.asset_type === assetTypeId);
|
|
2164
|
+
}
|
|
2165
|
+
)
|
|
2166
|
+
);
|
|
2167
|
+
const selectFormOfIssueType = restructureCreateSelectorWithArgs(
|
|
2168
|
+
toolkit.createSelector(
|
|
2169
|
+
[selectFormMapping, (_state, issueTypeId) => issueTypeId],
|
|
2170
|
+
(formsMapping, issueTypeId) => {
|
|
2171
|
+
return Object.values(formsMapping).find((form) => form.issue_type === issueTypeId);
|
|
2172
|
+
}
|
|
2173
|
+
)
|
|
2174
|
+
);
|
|
2175
|
+
const selectFormsCount = toolkit.createSelector([selectFormMapping], (formsMapping) => {
|
|
2176
|
+
return Object.keys(formsMapping).length;
|
|
2177
|
+
});
|
|
2178
|
+
const selectGeneralFormCount = toolkit.createSelector([selectFormMapping], (formsMapping) => {
|
|
2179
|
+
return Object.values(formsMapping).filter((form) => !form.asset_type).length;
|
|
2180
|
+
});
|
|
2148
2181
|
const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
|
|
2149
|
-
const initialState$
|
|
2182
|
+
const initialState$e = submissionAdapter.getInitialState({});
|
|
2150
2183
|
const formSubmissionSlice = toolkit.createSlice({
|
|
2151
2184
|
name: "formSubmissions",
|
|
2152
|
-
initialState: initialState$
|
|
2153
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2185
|
+
initialState: initialState$e,
|
|
2186
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
|
|
2154
2187
|
reducers: {
|
|
2155
2188
|
initializeFormSubmissions: submissionAdapter.initialize,
|
|
2156
2189
|
setFormSubmission: submissionAdapter.setOne,
|
|
@@ -2206,6 +2239,43 @@ var __publicField = (obj, key, value) => {
|
|
|
2206
2239
|
}
|
|
2207
2240
|
)
|
|
2208
2241
|
);
|
|
2242
|
+
const selectFormSubmissionsByFormRevisions = toolkit.createSelector([selectFormRevisionMapping, selectFormSubmissions], (revisions, submissions) => {
|
|
2243
|
+
var _a2;
|
|
2244
|
+
const submissionMapping = {};
|
|
2245
|
+
for (const revisionId in revisions) {
|
|
2246
|
+
submissionMapping[revisionId] = [];
|
|
2247
|
+
}
|
|
2248
|
+
for (const submission of submissions) {
|
|
2249
|
+
(_a2 = submissionMapping[submission.form_revision]) == null ? void 0 : _a2.push(submission);
|
|
2250
|
+
}
|
|
2251
|
+
return submissionMapping;
|
|
2252
|
+
});
|
|
2253
|
+
const selectSortedFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
2254
|
+
toolkit.createSelector(
|
|
2255
|
+
[
|
|
2256
|
+
selectFormRevisionMapping,
|
|
2257
|
+
selectFormSubmissionsByFormRevisions,
|
|
2258
|
+
(_state, formId) => formId
|
|
2259
|
+
],
|
|
2260
|
+
(revisionsMapping, submissionsByRevision, formId) => {
|
|
2261
|
+
const submissionsByFormRevisions = {};
|
|
2262
|
+
for (const revisionId in revisionsMapping) {
|
|
2263
|
+
const revision = revisionsMapping[revisionId];
|
|
2264
|
+
const submissionsOfRevision = submissionsByRevision[revisionId];
|
|
2265
|
+
if (revision && submissionsOfRevision && revision.form === formId) {
|
|
2266
|
+
submissionsByFormRevisions[revisionId] = submissionsOfRevision.sort(
|
|
2267
|
+
(a, b) => a.submitted_at < b.submitted_at ? -1 : 1
|
|
2268
|
+
);
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
return Object.entries(submissionsByFormRevisions).sort((a, b) => {
|
|
2272
|
+
const aRevision = revisionsMapping[a[0]];
|
|
2273
|
+
const bRevision = revisionsMapping[b[0]];
|
|
2274
|
+
return formRevisionSortFn(aRevision, bRevision);
|
|
2275
|
+
}).map(([_revisionId, submissions]) => submissions).flat();
|
|
2276
|
+
}
|
|
2277
|
+
)
|
|
2278
|
+
);
|
|
2209
2279
|
const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2210
2280
|
toolkit.createSelector(
|
|
2211
2281
|
[selectFormSubmissions, (_state, issueId) => issueId],
|
|
@@ -2216,6 +2286,54 @@ var __publicField = (obj, key, value) => {
|
|
|
2216
2286
|
}
|
|
2217
2287
|
)
|
|
2218
2288
|
);
|
|
2289
|
+
const selectAttachedFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2290
|
+
toolkit.createSelector(
|
|
2291
|
+
[
|
|
2292
|
+
(state) => state.issueReducer.instances,
|
|
2293
|
+
(state) => state.formReducer.instances,
|
|
2294
|
+
(state) => state.formRevisionReducer.instances,
|
|
2295
|
+
(state) => state.formSubmissionReducer.instances,
|
|
2296
|
+
(_state, issueId) => issueId
|
|
2297
|
+
],
|
|
2298
|
+
(issues, forms, formRevisions, submissions, issueId) => {
|
|
2299
|
+
const issue = issues[issueId];
|
|
2300
|
+
if (!issue)
|
|
2301
|
+
return [];
|
|
2302
|
+
if (!issue.issue_type) {
|
|
2303
|
+
return Object.values(submissions).filter((submission) => submission.issue === issueId);
|
|
2304
|
+
}
|
|
2305
|
+
const issueTypeForms = new Set(
|
|
2306
|
+
Object.keys(forms).filter((formId) => forms[formId].issue_type === issue.issue_type)
|
|
2307
|
+
);
|
|
2308
|
+
const issueTypeFormRevisions = new Set(
|
|
2309
|
+
Object.keys(formRevisions).filter(
|
|
2310
|
+
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2311
|
+
)
|
|
2312
|
+
);
|
|
2313
|
+
return Object.values(submissions).filter(
|
|
2314
|
+
(submission) => submission.issue === issueId && !issueTypeFormRevisions.has(submission.form_revision)
|
|
2315
|
+
);
|
|
2316
|
+
}
|
|
2317
|
+
)
|
|
2318
|
+
);
|
|
2319
|
+
const selectFormSubmissionsByIssues = restructureCreateSelectorWithArgs(
|
|
2320
|
+
toolkit.createSelector(
|
|
2321
|
+
[selectFormSubmissions, (_state, issueIds) => issueIds],
|
|
2322
|
+
(submissions, issueIds) => {
|
|
2323
|
+
var _a2;
|
|
2324
|
+
const issueSubmissions = {};
|
|
2325
|
+
for (const issueId of issueIds) {
|
|
2326
|
+
issueSubmissions[issueId] = [];
|
|
2327
|
+
}
|
|
2328
|
+
for (const submission of submissions) {
|
|
2329
|
+
if (submission.issue && issueIds.includes(submission.issue)) {
|
|
2330
|
+
(_a2 = issueSubmissions[submission.issue]) == null ? void 0 : _a2.push(submission);
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
return issueSubmissions;
|
|
2334
|
+
}
|
|
2335
|
+
)
|
|
2336
|
+
);
|
|
2219
2337
|
const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
2220
2338
|
toolkit.createSelector(
|
|
2221
2339
|
[selectFormSubmissions, (_state, assetId) => assetId],
|
|
@@ -2226,15 +2344,62 @@ var __publicField = (obj, key, value) => {
|
|
|
2226
2344
|
}
|
|
2227
2345
|
)
|
|
2228
2346
|
);
|
|
2347
|
+
const selectAttachedFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
2348
|
+
toolkit.createSelector(
|
|
2349
|
+
[
|
|
2350
|
+
(state) => state.assetReducer.instances,
|
|
2351
|
+
(state) => state.formReducer.instances,
|
|
2352
|
+
(state) => state.formRevisionReducer.instances,
|
|
2353
|
+
(state) => state.formSubmissionReducer.instances,
|
|
2354
|
+
(_state, assetId) => assetId
|
|
2355
|
+
],
|
|
2356
|
+
(assets, forms, formRevisions, submissions, assetId) => {
|
|
2357
|
+
const asset = assets[assetId];
|
|
2358
|
+
if (!asset)
|
|
2359
|
+
return [];
|
|
2360
|
+
if (!asset.asset_type) {
|
|
2361
|
+
return Object.values(submissions).filter((submission) => submission.asset === assetId);
|
|
2362
|
+
}
|
|
2363
|
+
const issueTypeForms = new Set(
|
|
2364
|
+
Object.keys(forms).filter((formId) => forms[formId].asset_type === asset.asset_type)
|
|
2365
|
+
);
|
|
2366
|
+
const issueTypeFormRevisions = new Set(
|
|
2367
|
+
Object.keys(formRevisions).filter(
|
|
2368
|
+
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2369
|
+
)
|
|
2370
|
+
);
|
|
2371
|
+
return Object.values(submissions).filter(
|
|
2372
|
+
(submission) => submission.asset === assetId && !issueTypeFormRevisions.has(submission.form_revision)
|
|
2373
|
+
);
|
|
2374
|
+
}
|
|
2375
|
+
)
|
|
2376
|
+
);
|
|
2377
|
+
const selectFormSubmissionsByAssets = toolkit.createSelector(
|
|
2378
|
+
[selectFormSubmissionsMapping, selectAssetsMapping],
|
|
2379
|
+
(submissions, assets) => {
|
|
2380
|
+
var _a2;
|
|
2381
|
+
const assetSubmissionMapping = {};
|
|
2382
|
+
for (const assetId in assets) {
|
|
2383
|
+
assetSubmissionMapping[assetId] = [];
|
|
2384
|
+
}
|
|
2385
|
+
for (const submissionId in submissions) {
|
|
2386
|
+
const submission = submissions[submissionId];
|
|
2387
|
+
if (submission.asset) {
|
|
2388
|
+
(_a2 = assetSubmissionMapping[submission.asset]) == null ? void 0 : _a2.push(submission);
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
return assetSubmissionMapping;
|
|
2392
|
+
}
|
|
2393
|
+
);
|
|
2229
2394
|
const formSubmissionReducer = formSubmissionSlice.reducer;
|
|
2230
2395
|
const formSubmissionAttachmentAdapter = createModelAdapter(
|
|
2231
2396
|
(attachment) => attachment.offline_id
|
|
2232
2397
|
);
|
|
2233
|
-
const initialState$
|
|
2398
|
+
const initialState$d = formSubmissionAttachmentAdapter.getInitialState({});
|
|
2234
2399
|
const formSubmissionAttachmentSlice = toolkit.createSlice({
|
|
2235
2400
|
name: "formSubmissionAttachments",
|
|
2236
|
-
initialState: initialState$
|
|
2237
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2401
|
+
initialState: initialState$d,
|
|
2402
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
|
|
2238
2403
|
reducers: {
|
|
2239
2404
|
initializeFormSubmissionAttachments: formSubmissionAttachmentAdapter.initialize,
|
|
2240
2405
|
addFormSubmissionAttachment: formSubmissionAttachmentAdapter.addOne,
|
|
@@ -2277,9 +2442,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2277
2442
|
[selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
|
|
2278
2443
|
(attachmentsMapping, submissionId) => {
|
|
2279
2444
|
return fallbackToEmptyArray(
|
|
2280
|
-
Object.values(attachmentsMapping).filter(
|
|
2281
|
-
(attachment) => attachment.form_submission === submissionId
|
|
2282
|
-
)
|
|
2445
|
+
Object.values(attachmentsMapping).filter((attachment) => attachment.submission === submissionId)
|
|
2283
2446
|
);
|
|
2284
2447
|
}
|
|
2285
2448
|
)
|
|
@@ -2288,11 +2451,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2288
2451
|
const formRevisionAttachmentAdapter = createModelAdapter(
|
|
2289
2452
|
(attachment) => attachment.offline_id
|
|
2290
2453
|
);
|
|
2291
|
-
const initialState$
|
|
2454
|
+
const initialState$c = formRevisionAttachmentAdapter.getInitialState({});
|
|
2292
2455
|
const formRevisionAttachmentSlice = toolkit.createSlice({
|
|
2293
2456
|
name: "formRevisionAttachments",
|
|
2294
|
-
initialState: initialState$
|
|
2295
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2457
|
+
initialState: initialState$c,
|
|
2458
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
2296
2459
|
reducers: {
|
|
2297
2460
|
initializeFormRevisionAttachments: formRevisionAttachmentAdapter.initialize,
|
|
2298
2461
|
addFormRevisionAttachment: formRevisionAttachmentAdapter.addOne,
|
|
@@ -2324,17 +2487,17 @@ var __publicField = (obj, key, value) => {
|
|
|
2324
2487
|
[selectFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
|
|
2325
2488
|
(attachments, revisionId) => {
|
|
2326
2489
|
return fallbackToEmptyArray(
|
|
2327
|
-
Object.values(attachments).filter((attachment) => attachment.
|
|
2490
|
+
Object.values(attachments).filter((attachment) => attachment.revision === revisionId)
|
|
2328
2491
|
);
|
|
2329
2492
|
}
|
|
2330
2493
|
)
|
|
2331
2494
|
);
|
|
2332
2495
|
const formRevisionAttachmentReducer = formRevisionAttachmentSlice.reducer;
|
|
2333
2496
|
const workspaceAdapter = createModelAdapter((workspace) => workspace.offline_id);
|
|
2334
|
-
const initialState$
|
|
2497
|
+
const initialState$b = workspaceAdapter.getInitialState({});
|
|
2335
2498
|
const workspaceSlice = toolkit.createSlice({
|
|
2336
2499
|
name: "workspace",
|
|
2337
|
-
initialState: initialState$
|
|
2500
|
+
initialState: initialState$b,
|
|
2338
2501
|
reducers: {
|
|
2339
2502
|
initializeWorkspaces: workspaceAdapter.initialize,
|
|
2340
2503
|
setWorkspaces: workspaceAdapter.setMany,
|
|
@@ -2365,10 +2528,10 @@ var __publicField = (obj, key, value) => {
|
|
|
2365
2528
|
);
|
|
2366
2529
|
const workspaceReducer = workspaceSlice.reducer;
|
|
2367
2530
|
const emailDomainAdapter = createModelAdapter((emailDomain) => emailDomain.offline_id);
|
|
2368
|
-
const initialState$
|
|
2531
|
+
const initialState$a = emailDomainAdapter.getInitialState({});
|
|
2369
2532
|
const emailDomainsSlice = toolkit.createSlice({
|
|
2370
2533
|
name: "emailDomains",
|
|
2371
|
-
initialState: initialState$
|
|
2534
|
+
initialState: initialState$a,
|
|
2372
2535
|
reducers: {
|
|
2373
2536
|
initializeEmailDomains: emailDomainAdapter.initialize,
|
|
2374
2537
|
addEmailDomain: emailDomainAdapter.addOne,
|
|
@@ -2389,14 +2552,14 @@ var __publicField = (obj, key, value) => {
|
|
|
2389
2552
|
)
|
|
2390
2553
|
);
|
|
2391
2554
|
const emailDomainsReducer = emailDomainsSlice.reducer;
|
|
2392
|
-
const initialState$
|
|
2555
|
+
const initialState$9 = {
|
|
2393
2556
|
documents: {}
|
|
2394
2557
|
};
|
|
2395
2558
|
const documentSlice = toolkit.createSlice({
|
|
2396
2559
|
name: "documents",
|
|
2397
|
-
initialState: initialState$
|
|
2560
|
+
initialState: initialState$9,
|
|
2398
2561
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2399
|
-
Object.assign(state, initialState$
|
|
2562
|
+
Object.assign(state, initialState$9);
|
|
2400
2563
|
}),
|
|
2401
2564
|
reducers: {
|
|
2402
2565
|
setDocuments: (state, action) => {
|
|
@@ -2585,11 +2748,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2585
2748
|
);
|
|
2586
2749
|
const documentsReducer = documentSlice.reducer;
|
|
2587
2750
|
const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2588
|
-
const initialState$
|
|
2751
|
+
const initialState$8 = documentAttachmentAdapter.getInitialState({});
|
|
2589
2752
|
const documentAttachmentSlice = toolkit.createSlice({
|
|
2590
2753
|
name: "documentAttachments",
|
|
2591
|
-
initialState: initialState$
|
|
2592
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2754
|
+
initialState: initialState$8,
|
|
2755
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
2593
2756
|
reducers: {
|
|
2594
2757
|
initializeDocumentAttachments: documentAttachmentAdapter.initialize,
|
|
2595
2758
|
addDocumentAttachment: documentAttachmentAdapter.addOne,
|
|
@@ -2648,11 +2811,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2648
2811
|
);
|
|
2649
2812
|
const documentAttachmentReducer = documentAttachmentSlice.reducer;
|
|
2650
2813
|
const teamAdapter = createModelAdapter((team) => team.offline_id);
|
|
2651
|
-
const initialState$
|
|
2814
|
+
const initialState$7 = teamAdapter.getInitialState({});
|
|
2652
2815
|
const teamSlice = toolkit.createSlice({
|
|
2653
2816
|
name: "teams",
|
|
2654
|
-
initialState: initialState$
|
|
2655
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2817
|
+
initialState: initialState$7,
|
|
2818
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
2656
2819
|
reducers: {
|
|
2657
2820
|
setTeam: teamAdapter.setOne,
|
|
2658
2821
|
initializeTeams: teamAdapter.initialize,
|
|
@@ -2703,11 +2866,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2703
2866
|
const agentUserConversationAdapter = createModelAdapter(
|
|
2704
2867
|
(conversation) => conversation.offline_id
|
|
2705
2868
|
);
|
|
2706
|
-
const initialState$
|
|
2869
|
+
const initialState$6 = agentUserConversationAdapter.getInitialState({});
|
|
2707
2870
|
const agentsSlice = toolkit.createSlice({
|
|
2708
2871
|
name: "agents",
|
|
2709
|
-
initialState: initialState$
|
|
2710
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2872
|
+
initialState: initialState$6,
|
|
2873
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
2711
2874
|
reducers: {
|
|
2712
2875
|
initializeConversations: agentUserConversationAdapter.initialize,
|
|
2713
2876
|
addConversation: agentUserConversationAdapter.addOne,
|
|
@@ -2729,11 +2892,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2729
2892
|
);
|
|
2730
2893
|
const agentsReducer = agentsSlice.reducer;
|
|
2731
2894
|
const issueCommentAdapter = createModelAdapter((comment) => comment.offline_id);
|
|
2732
|
-
const initialState$
|
|
2895
|
+
const initialState$5 = issueCommentAdapter.getInitialState({});
|
|
2733
2896
|
const issueCommentSlice = toolkit.createSlice({
|
|
2734
2897
|
name: "issueComments",
|
|
2735
|
-
initialState: initialState$
|
|
2736
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2898
|
+
initialState: initialState$5,
|
|
2899
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
2737
2900
|
reducers: {
|
|
2738
2901
|
addIssueComment: issueCommentAdapter.addOne,
|
|
2739
2902
|
addIssueComments: issueCommentAdapter.addMany,
|
|
@@ -2762,11 +2925,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2762
2925
|
);
|
|
2763
2926
|
const issueCommentReducer = issueCommentSlice.reducer;
|
|
2764
2927
|
const issueUpdateAdapter = createModelAdapter((issueUpdate) => issueUpdate.offline_id);
|
|
2765
|
-
const initialState$
|
|
2928
|
+
const initialState$4 = issueUpdateAdapter.getInitialState({});
|
|
2766
2929
|
const issueUpdateSlice = toolkit.createSlice({
|
|
2767
2930
|
name: "issueUpdates",
|
|
2768
|
-
initialState: initialState$
|
|
2769
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2931
|
+
initialState: initialState$4,
|
|
2932
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
|
|
2770
2933
|
reducers: {
|
|
2771
2934
|
initializeIssueUpdates: issueUpdateAdapter.setMany,
|
|
2772
2935
|
setIssueUpdate: issueUpdateAdapter.setOne,
|
|
@@ -2795,11 +2958,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2795
2958
|
);
|
|
2796
2959
|
const issueUpdateReducer = issueUpdateSlice.reducer;
|
|
2797
2960
|
const issueAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2798
|
-
const initialState$
|
|
2961
|
+
const initialState$3 = issueAttachmentAdapter.getInitialState({});
|
|
2799
2962
|
const issueAttachmentSlice = toolkit.createSlice({
|
|
2800
2963
|
name: "issueAttachments",
|
|
2801
|
-
initialState: initialState$
|
|
2802
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2964
|
+
initialState: initialState$3,
|
|
2965
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
2803
2966
|
reducers: {
|
|
2804
2967
|
initializeIssueAttachments: issueAttachmentAdapter.initialize,
|
|
2805
2968
|
addIssueAttachment: issueAttachmentAdapter.addOne,
|
|
@@ -2857,23 +3020,23 @@ var __publicField = (obj, key, value) => {
|
|
|
2857
3020
|
)
|
|
2858
3021
|
);
|
|
2859
3022
|
const issueAttachmentReducer = issueAttachmentSlice.reducer;
|
|
2860
|
-
const initialState$
|
|
3023
|
+
const initialState$2 = {
|
|
2861
3024
|
version: 0
|
|
2862
3025
|
};
|
|
2863
3026
|
const versioningSlice = toolkit.createSlice({
|
|
2864
3027
|
name: "versioning",
|
|
2865
|
-
initialState: initialState$
|
|
3028
|
+
initialState: initialState$2,
|
|
2866
3029
|
reducers: {}
|
|
2867
3030
|
});
|
|
2868
3031
|
const versioningReducer = versioningSlice.reducer;
|
|
2869
3032
|
const geoImageAdapter = createModelAdapter((model) => model.offline_id);
|
|
2870
|
-
const initialState$
|
|
3033
|
+
const initialState$1 = geoImageAdapter.getInitialState({});
|
|
2871
3034
|
const geoImageSlice = toolkit.createSlice({
|
|
2872
3035
|
name: "geoImages",
|
|
2873
|
-
initialState: initialState$
|
|
3036
|
+
initialState: initialState$1,
|
|
2874
3037
|
extraReducers: (builder) => {
|
|
2875
3038
|
builder.addCase("RESET", (state) => {
|
|
2876
|
-
Object.assign(state, initialState$
|
|
3039
|
+
Object.assign(state, initialState$1);
|
|
2877
3040
|
});
|
|
2878
3041
|
},
|
|
2879
3042
|
reducers: {
|
|
@@ -2911,11 +3074,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2911
3074
|
);
|
|
2912
3075
|
const geoImageReducer = geoImageSlice.reducer;
|
|
2913
3076
|
const issueAssociationAdapter = createModelAdapter((assoc) => assoc.offline_id);
|
|
2914
|
-
const initialState
|
|
3077
|
+
const initialState = issueAssociationAdapter.getInitialState({});
|
|
2915
3078
|
const issueAssociationSlice = toolkit.createSlice({
|
|
2916
3079
|
name: "issueAssociations",
|
|
2917
|
-
initialState
|
|
2918
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState
|
|
3080
|
+
initialState,
|
|
3081
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
|
|
2919
3082
|
reducers: {
|
|
2920
3083
|
initializeIssueAssociations: issueAssociationAdapter.initialize,
|
|
2921
3084
|
addIssueAssociation: issueAssociationAdapter.addOne,
|
|
@@ -2973,432 +3136,32 @@ var __publicField = (obj, key, value) => {
|
|
|
2973
3136
|
)
|
|
2974
3137
|
);
|
|
2975
3138
|
const issueAssociationReducer = issueAssociationSlice.reducer;
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
const {
|
|
2997
|
-
initializeIssueTypeFieldValues,
|
|
2998
|
-
addIssueTypeFieldValues,
|
|
2999
|
-
addIssueTypeFieldValuesMany,
|
|
3000
|
-
setIssueTypeFieldValues,
|
|
3001
|
-
setIssueTypeFieldValuesMany,
|
|
3002
|
-
updateIssueTypeFieldValues,
|
|
3003
|
-
updateIssueTypeFieldValuesMany,
|
|
3004
|
-
deleteIssueTypeFieldValues,
|
|
3005
|
-
deleteIssueTypeFieldValuesMany
|
|
3006
|
-
} = issueTypeFieldValuesSlice.actions;
|
|
3007
|
-
const selectIssueTypeFieldValuesMapping = (state) => state.issueTypeFieldValuesReducer.instances;
|
|
3008
|
-
const selectIssueTypeFieldValues = toolkit.createSelector([selectIssueTypeFieldValuesMapping], (fieldValuesMapping) => {
|
|
3009
|
-
return Object.values(fieldValuesMapping);
|
|
3010
|
-
});
|
|
3011
|
-
const selectIssueTypeFieldValuesOfIssue = restructureCreateSelectorWithArgs(
|
|
3012
|
-
toolkit.createSelector([selectIssueTypeFieldValues, (_state, issueId) => issueId], (fieldValues, issueId) => {
|
|
3013
|
-
return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.issue === issueId));
|
|
3014
|
-
})
|
|
3015
|
-
);
|
|
3016
|
-
const selectIssueTypeFieldValuesById = (fieldValuesId) => (state) => {
|
|
3017
|
-
return state.issueTypeFieldValuesReducer.instances[fieldValuesId];
|
|
3018
|
-
};
|
|
3019
|
-
const issueTypeFieldValuesReducer = issueTypeFieldValuesSlice.reducer;
|
|
3020
|
-
const issueTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
|
|
3021
|
-
const initialState$6 = issueTypeFieldsAdapter.getInitialState({});
|
|
3022
|
-
const issueTypeFieldsSlice = toolkit.createSlice({
|
|
3023
|
-
name: "issueTypeFields",
|
|
3024
|
-
initialState: initialState$6,
|
|
3025
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
3026
|
-
reducers: {
|
|
3027
|
-
initializeIssueTypeFields: issueTypeFieldsAdapter.initialize,
|
|
3028
|
-
addIssueTypeFields: issueTypeFieldsAdapter.addOne,
|
|
3029
|
-
addIssueTypeFieldsMany: issueTypeFieldsAdapter.addMany,
|
|
3030
|
-
setIssueTypeFields: issueTypeFieldsAdapter.setOne,
|
|
3031
|
-
setIssueTypeFieldsMany: issueTypeFieldsAdapter.setMany,
|
|
3032
|
-
updateIssueTypeFields: issueTypeFieldsAdapter.updateOne,
|
|
3033
|
-
updateIssueTypeFieldsMany: issueTypeFieldsAdapter.updateMany,
|
|
3034
|
-
deleteIssueTypeFields: issueTypeFieldsAdapter.deleteOne,
|
|
3035
|
-
deleteIssueTypeFieldsMany: issueTypeFieldsAdapter.deleteMany
|
|
3139
|
+
let clientStore;
|
|
3140
|
+
function setClientStore(store) {
|
|
3141
|
+
clientStore = store;
|
|
3142
|
+
}
|
|
3143
|
+
function getClientStore() {
|
|
3144
|
+
return clientStore;
|
|
3145
|
+
}
|
|
3146
|
+
let clientSDK;
|
|
3147
|
+
function setClientSDK(sdkCtor) {
|
|
3148
|
+
clientSDK = sdkCtor;
|
|
3149
|
+
}
|
|
3150
|
+
function getClientSDK() {
|
|
3151
|
+
return clientSDK;
|
|
3152
|
+
}
|
|
3153
|
+
const CLASS_NAME_TO_SERVICE = {};
|
|
3154
|
+
class BaseService {
|
|
3155
|
+
constructor(sdk) {
|
|
3156
|
+
__publicField(this, "client");
|
|
3157
|
+
CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
|
|
3158
|
+
this.client = sdk;
|
|
3036
3159
|
}
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
initializeIssueTypeFields,
|
|
3040
|
-
addIssueTypeFields,
|
|
3041
|
-
addIssueTypeFieldsMany,
|
|
3042
|
-
setIssueTypeFields,
|
|
3043
|
-
setIssueTypeFieldsMany,
|
|
3044
|
-
updateIssueTypeFields,
|
|
3045
|
-
updateIssueTypeFieldsMany,
|
|
3046
|
-
deleteIssueTypeFields,
|
|
3047
|
-
deleteIssueTypeFieldsMany
|
|
3048
|
-
} = issueTypeFieldsSlice.actions;
|
|
3049
|
-
const selectIssueTypeFieldsMapping = (state) => state.issueTypeFieldsReducer.instances;
|
|
3050
|
-
const selectIssueTypeFields = toolkit.createSelector([selectIssueTypeFieldsMapping], (fieldsMapping) => {
|
|
3051
|
-
return Object.values(fieldsMapping);
|
|
3052
|
-
});
|
|
3053
|
-
const selectIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
|
|
3054
|
-
toolkit.createSelector([selectIssueTypeFields, (_state, issueTypeId) => issueTypeId], (fields, issueTypeId) => {
|
|
3055
|
-
return fallbackToEmptyArray(fields.filter((field) => field.issue_type === issueTypeId));
|
|
3056
|
-
})
|
|
3057
|
-
);
|
|
3058
|
-
const selectLatestIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
|
|
3059
|
-
toolkit.createSelector([selectIssueTypeFields, (_state, id) => id], (fields, id) => {
|
|
3060
|
-
return fields.filter((field) => field.issue_type === id).sort((a, b) => a.submitted_at > b.submitted_at ? -1 : 1)[0];
|
|
3061
|
-
})
|
|
3062
|
-
);
|
|
3063
|
-
const selectIssueTypeValuesOfIssueType = restructureCreateSelectorWithArgs(
|
|
3064
|
-
toolkit.createSelector(
|
|
3065
|
-
[selectIssueTypeFields, selectIssueTypeFieldValues, (_state, id) => id],
|
|
3066
|
-
(fields, fieldValues, id) => {
|
|
3067
|
-
const fieldsIds = new Set(
|
|
3068
|
-
fields.filter((field) => field.issue_type === id).map((field) => field.offline_id)
|
|
3069
|
-
);
|
|
3070
|
-
return fallbackToEmptyArray(fieldValues.filter((values) => fieldsIds.has(values.fields_revision)));
|
|
3071
|
-
}
|
|
3072
|
-
)
|
|
3073
|
-
);
|
|
3074
|
-
const selectIssueTypeFieldsById = (fieldsId) => (state) => {
|
|
3075
|
-
return state.issueTypeFieldsReducer.instances[fieldsId];
|
|
3076
|
-
};
|
|
3077
|
-
const issueTypeFieldsReducer = issueTypeFieldsSlice.reducer;
|
|
3078
|
-
const issueTypeFieldsAttachmentAdapter = createModelAdapter(
|
|
3079
|
-
(attachment) => attachment.offline_id
|
|
3080
|
-
);
|
|
3081
|
-
const initialState$5 = issueTypeFieldsAttachmentAdapter.getInitialState({});
|
|
3082
|
-
const issueTypeFieldsAttachmentSlice = toolkit.createSlice({
|
|
3083
|
-
name: "issueTypeFieldsAttachments",
|
|
3084
|
-
initialState: initialState$5,
|
|
3085
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
3086
|
-
reducers: {
|
|
3087
|
-
initializeIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.initialize,
|
|
3088
|
-
addIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.addOne,
|
|
3089
|
-
addIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.addMany,
|
|
3090
|
-
setIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.setOne,
|
|
3091
|
-
setIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.setMany,
|
|
3092
|
-
updateIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.updateOne,
|
|
3093
|
-
updateIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.updateMany,
|
|
3094
|
-
deleteIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.deleteOne,
|
|
3095
|
-
deleteIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.deleteMany
|
|
3160
|
+
async enqueueRequest(requestDetails) {
|
|
3161
|
+
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3096
3162
|
}
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
initializeIssueTypeFieldsAttachments,
|
|
3100
|
-
addIssueTypeFieldsAttachment,
|
|
3101
|
-
addIssueTypeFieldsAttachments,
|
|
3102
|
-
setIssueTypeFieldsAttachment,
|
|
3103
|
-
setIssueTypeFieldsAttachments,
|
|
3104
|
-
updateIssueTypeFieldsAttachment,
|
|
3105
|
-
updateIssueTypeFieldsAttachments,
|
|
3106
|
-
deleteIssueTypeFieldsAttachment,
|
|
3107
|
-
deleteIssueTypeFieldsAttachments
|
|
3108
|
-
} = issueTypeFieldsAttachmentSlice.actions;
|
|
3109
|
-
const selectIssueTypeFieldsAttachmentsMapping = (state) => state.issueTypeFieldsAttachmentReducer.instances;
|
|
3110
|
-
const selectIssueTypeFieldsAttachments = toolkit.createSelector(
|
|
3111
|
-
[selectIssueTypeFieldsAttachmentsMapping],
|
|
3112
|
-
(attachmentsMapping) => {
|
|
3113
|
-
return Object.values(attachmentsMapping);
|
|
3114
|
-
}
|
|
3115
|
-
);
|
|
3116
|
-
const selectAttachmentsOfIssueTypeFields = restructureCreateSelectorWithArgs(
|
|
3117
|
-
toolkit.createSelector(
|
|
3118
|
-
[selectIssueTypeFieldsAttachments, (_state, fieldsRevision) => fieldsRevision],
|
|
3119
|
-
(attachments, fieldsRevision) => {
|
|
3120
|
-
return fallbackToEmptyArray(
|
|
3121
|
-
attachments.filter((attachment) => attachment.fields_revision === fieldsRevision)
|
|
3122
|
-
);
|
|
3123
|
-
}
|
|
3124
|
-
)
|
|
3125
|
-
);
|
|
3126
|
-
const selectIssueTypeFieldsAttachmentById = (attachmentId) => (state) => {
|
|
3127
|
-
return state.issueTypeFieldsAttachmentReducer.instances[attachmentId];
|
|
3128
|
-
};
|
|
3129
|
-
const issueTypeFieldsAttachmentReducer = issueTypeFieldsAttachmentSlice.reducer;
|
|
3130
|
-
const issueTypeFieldValuesAttachmentAdapter = createModelAdapter(
|
|
3131
|
-
(attachment) => attachment.offline_id
|
|
3132
|
-
);
|
|
3133
|
-
const initialState$4 = issueTypeFieldValuesAttachmentAdapter.getInitialState({});
|
|
3134
|
-
const issueTypeFieldValuesAttachmentSlice = toolkit.createSlice({
|
|
3135
|
-
name: "issueTypeFieldValuesAttachments",
|
|
3136
|
-
initialState: initialState$4,
|
|
3137
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
|
|
3138
|
-
reducers: {
|
|
3139
|
-
initializeIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.initialize,
|
|
3140
|
-
addIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.addOne,
|
|
3141
|
-
addIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.addMany,
|
|
3142
|
-
setIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.setOne,
|
|
3143
|
-
setIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.setMany,
|
|
3144
|
-
updateIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.updateOne,
|
|
3145
|
-
updateIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.updateMany,
|
|
3146
|
-
deleteIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.deleteOne,
|
|
3147
|
-
deleteIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.deleteMany
|
|
3148
|
-
}
|
|
3149
|
-
});
|
|
3150
|
-
const {
|
|
3151
|
-
initializeIssueTypeFieldValuesAttachments,
|
|
3152
|
-
addIssueTypeFieldValuesAttachment,
|
|
3153
|
-
addIssueTypeFieldValuesAttachments,
|
|
3154
|
-
setIssueTypeFieldValuesAttachment,
|
|
3155
|
-
setIssueTypeFieldValuesAttachments,
|
|
3156
|
-
updateIssueTypeFieldValuesAttachment,
|
|
3157
|
-
updateIssueTypeFieldValuesAttachments,
|
|
3158
|
-
deleteIssueTypeFieldValuesAttachment,
|
|
3159
|
-
deleteIssueTypeFieldValuesAttachments
|
|
3160
|
-
} = issueTypeFieldValuesAttachmentSlice.actions;
|
|
3161
|
-
const selectIssueTypeFieldValuesAttachmentsMapping = (state) => state.issueTypeFieldValuesAttachmentReducer.instances;
|
|
3162
|
-
const selectIssueTypeFieldValuesAttachments = toolkit.createSelector(
|
|
3163
|
-
[selectIssueTypeFieldValuesAttachmentsMapping],
|
|
3164
|
-
(attachmentsMapping) => {
|
|
3165
|
-
return Object.values(attachmentsMapping);
|
|
3166
|
-
}
|
|
3167
|
-
);
|
|
3168
|
-
const selectAttachmentsOfIssueTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3169
|
-
toolkit.createSelector(
|
|
3170
|
-
[selectIssueTypeFieldValuesAttachments, (_state, fieldValuesId) => fieldValuesId],
|
|
3171
|
-
(attachments, fieldValuesId) => {
|
|
3172
|
-
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === fieldValuesId));
|
|
3173
|
-
}
|
|
3174
|
-
)
|
|
3175
|
-
);
|
|
3176
|
-
const selectIssueTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3177
|
-
return state.issueTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3178
|
-
};
|
|
3179
|
-
const issueTypeFieldValuesAttachmentReducer = issueTypeFieldValuesAttachmentSlice.reducer;
|
|
3180
|
-
const assetTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
|
|
3181
|
-
const initialState$3 = assetTypeFieldsAdapter.getInitialState({});
|
|
3182
|
-
const assetTypeFieldsSlice = toolkit.createSlice({
|
|
3183
|
-
name: "assetTypeFields",
|
|
3184
|
-
initialState: initialState$3,
|
|
3185
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
3186
|
-
reducers: {
|
|
3187
|
-
initializeAssetTypeFields: assetTypeFieldsAdapter.initialize,
|
|
3188
|
-
addAssetTypeFields: assetTypeFieldsAdapter.addOne,
|
|
3189
|
-
addAssetTypeFieldsMany: assetTypeFieldsAdapter.addMany,
|
|
3190
|
-
setAssetTypeFields: assetTypeFieldsAdapter.setOne,
|
|
3191
|
-
setAssetTypeFieldsMany: assetTypeFieldsAdapter.setMany,
|
|
3192
|
-
updateAssetTypeFields: assetTypeFieldsAdapter.updateOne,
|
|
3193
|
-
updateAssetTypeFieldsMany: assetTypeFieldsAdapter.updateMany,
|
|
3194
|
-
deleteAssetTypeFields: assetTypeFieldsAdapter.deleteOne,
|
|
3195
|
-
deleteAssetTypeFieldsMany: assetTypeFieldsAdapter.deleteMany
|
|
3196
|
-
}
|
|
3197
|
-
});
|
|
3198
|
-
const {
|
|
3199
|
-
initializeAssetTypeFields,
|
|
3200
|
-
addAssetTypeFields,
|
|
3201
|
-
addAssetTypeFieldsMany,
|
|
3202
|
-
setAssetTypeFields,
|
|
3203
|
-
setAssetTypeFieldsMany,
|
|
3204
|
-
updateAssetTypeFields,
|
|
3205
|
-
updateAssetTypeFieldsMany,
|
|
3206
|
-
deleteAssetTypeFields,
|
|
3207
|
-
deleteAssetTypeFieldsMany
|
|
3208
|
-
} = assetTypeFieldsSlice.actions;
|
|
3209
|
-
const selectAssetTypeFieldsMapping = (state) => state.assetTypeFieldsReducer.instances;
|
|
3210
|
-
const selectAssetTypeFields = toolkit.createSelector([selectAssetTypeFieldsMapping], (fieldsMapping) => {
|
|
3211
|
-
return Object.values(fieldsMapping);
|
|
3212
|
-
});
|
|
3213
|
-
const selectAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
|
|
3214
|
-
toolkit.createSelector([selectAssetTypeFields, (_state, assetTypeId) => assetTypeId], (fields, assetTypeId) => {
|
|
3215
|
-
return fallbackToEmptyArray(fields.filter((field) => field.asset_type === assetTypeId));
|
|
3216
|
-
})
|
|
3217
|
-
);
|
|
3218
|
-
const selectLatestAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
|
|
3219
|
-
toolkit.createSelector([selectAssetTypeFields, (_state, id) => id], (fields, id) => {
|
|
3220
|
-
return fields.filter((field) => field.asset_type === id).sort((a, b) => a.submitted_at > b.submitted_at ? -1 : 1)[0];
|
|
3221
|
-
})
|
|
3222
|
-
);
|
|
3223
|
-
const selectAssetTypeFieldsById = (fieldsId) => (state) => {
|
|
3224
|
-
return state.assetTypeFieldsReducer.instances[fieldsId];
|
|
3225
|
-
};
|
|
3226
|
-
const assetTypeFieldsReducer = assetTypeFieldsSlice.reducer;
|
|
3227
|
-
const assetTypeFieldValuesAdapter = createModelAdapter(
|
|
3228
|
-
(fieldValues) => fieldValues.offline_id
|
|
3229
|
-
);
|
|
3230
|
-
const initialState$2 = assetTypeFieldValuesAdapter.getInitialState({});
|
|
3231
|
-
const assetTypeFieldValuesSlice = toolkit.createSlice({
|
|
3232
|
-
name: "assetTypeFieldValues",
|
|
3233
|
-
initialState: initialState$2,
|
|
3234
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
|
|
3235
|
-
reducers: {
|
|
3236
|
-
initializeAssetTypeFieldValues: assetTypeFieldValuesAdapter.initialize,
|
|
3237
|
-
addAssetTypeFieldValues: assetTypeFieldValuesAdapter.addOne,
|
|
3238
|
-
addAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.addMany,
|
|
3239
|
-
setAssetTypeFieldValues: assetTypeFieldValuesAdapter.setOne,
|
|
3240
|
-
setAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.setMany,
|
|
3241
|
-
updateAssetTypeFieldValues: assetTypeFieldValuesAdapter.updateOne,
|
|
3242
|
-
updateAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.updateMany,
|
|
3243
|
-
deleteAssetTypeFieldValues: assetTypeFieldValuesAdapter.deleteOne,
|
|
3244
|
-
deleteAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.deleteMany
|
|
3245
|
-
}
|
|
3246
|
-
});
|
|
3247
|
-
const {
|
|
3248
|
-
initializeAssetTypeFieldValues,
|
|
3249
|
-
addAssetTypeFieldValues,
|
|
3250
|
-
addAssetTypeFieldValuesMany,
|
|
3251
|
-
setAssetTypeFieldValues,
|
|
3252
|
-
setAssetTypeFieldValuesMany,
|
|
3253
|
-
updateAssetTypeFieldValues,
|
|
3254
|
-
updateAssetTypeFieldValuesMany,
|
|
3255
|
-
deleteAssetTypeFieldValues,
|
|
3256
|
-
deleteAssetTypeFieldValuesMany
|
|
3257
|
-
} = assetTypeFieldValuesSlice.actions;
|
|
3258
|
-
const selectAssetTypeFieldValuesMapping = (state) => state.assetTypeFieldValuesReducer.instances;
|
|
3259
|
-
const selectAssetTypeFieldValues = toolkit.createSelector([selectAssetTypeFieldValuesMapping], (fieldValuesMapping) => {
|
|
3260
|
-
return Object.values(fieldValuesMapping);
|
|
3261
|
-
});
|
|
3262
|
-
const selectAssetTypeFieldValuesOfAsset = restructureCreateSelectorWithArgs(
|
|
3263
|
-
toolkit.createSelector([selectAssetTypeFieldValues, (_state, assetId) => assetId], (fieldValues, assetId) => {
|
|
3264
|
-
return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.asset === assetId));
|
|
3265
|
-
})
|
|
3266
|
-
);
|
|
3267
|
-
const selectAssetTypeValuesOfAssetType = restructureCreateSelectorWithArgs(
|
|
3268
|
-
toolkit.createSelector(
|
|
3269
|
-
[selectAssetTypeFields, selectAssetTypeFieldValues, (_state, id) => id],
|
|
3270
|
-
(fields, fieldValues, id) => {
|
|
3271
|
-
const fieldsIds = new Set(
|
|
3272
|
-
fields.filter((field) => field.asset_type === id).map((field) => field.offline_id)
|
|
3273
|
-
);
|
|
3274
|
-
return fallbackToEmptyArray(fieldValues.filter((values) => fieldsIds.has(values.fields_revision)));
|
|
3275
|
-
}
|
|
3276
|
-
)
|
|
3277
|
-
);
|
|
3278
|
-
const selectAssetTypeFieldValuesById = (fieldValuesId) => (state) => {
|
|
3279
|
-
return state.assetTypeFieldValuesReducer.instances[fieldValuesId];
|
|
3280
|
-
};
|
|
3281
|
-
const assetTypeFieldValuesReducer = assetTypeFieldValuesSlice.reducer;
|
|
3282
|
-
const assetTypeFieldsAttachmentAdapter = createModelAdapter(
|
|
3283
|
-
(attachment) => attachment.offline_id
|
|
3284
|
-
);
|
|
3285
|
-
const initialState$1 = assetTypeFieldsAttachmentAdapter.getInitialState({});
|
|
3286
|
-
const assetTypeFieldsAttachmentSlice = toolkit.createSlice({
|
|
3287
|
-
name: "assetTypeFieldsAttachments",
|
|
3288
|
-
initialState: initialState$1,
|
|
3289
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
|
|
3290
|
-
reducers: {
|
|
3291
|
-
initializeAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.initialize,
|
|
3292
|
-
addAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.addOne,
|
|
3293
|
-
addAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.addMany,
|
|
3294
|
-
setAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.setOne,
|
|
3295
|
-
setAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.setMany,
|
|
3296
|
-
updateAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.updateOne,
|
|
3297
|
-
updateAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.updateMany,
|
|
3298
|
-
deleteAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.deleteOne,
|
|
3299
|
-
deleteAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.deleteMany
|
|
3300
|
-
}
|
|
3301
|
-
});
|
|
3302
|
-
const {
|
|
3303
|
-
initializeAssetTypeFieldsAttachments,
|
|
3304
|
-
addAssetTypeFieldsAttachment,
|
|
3305
|
-
addAssetTypeFieldsAttachments,
|
|
3306
|
-
setAssetTypeFieldsAttachment,
|
|
3307
|
-
setAssetTypeFieldsAttachments,
|
|
3308
|
-
updateAssetTypeFieldsAttachment,
|
|
3309
|
-
updateAssetTypeFieldsAttachments,
|
|
3310
|
-
deleteAssetTypeFieldsAttachment,
|
|
3311
|
-
deleteAssetTypeFieldsAttachments
|
|
3312
|
-
} = assetTypeFieldsAttachmentSlice.actions;
|
|
3313
|
-
const selectAssetTypeFieldsAttachmentsMapping = (state) => state.assetTypeFieldsAttachmentReducer.instances;
|
|
3314
|
-
const selectAssetTypeFieldsAttachments = toolkit.createSelector(
|
|
3315
|
-
[selectAssetTypeFieldsAttachmentsMapping],
|
|
3316
|
-
(attachmentsMapping) => {
|
|
3317
|
-
return Object.values(attachmentsMapping);
|
|
3318
|
-
}
|
|
3319
|
-
);
|
|
3320
|
-
const selectAttachmentsOfAssetTypeFields = restructureCreateSelectorWithArgs(
|
|
3321
|
-
toolkit.createSelector([selectAssetTypeFieldsAttachments, (_state, id) => id], (attachments, id) => {
|
|
3322
|
-
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.fields_revision === id));
|
|
3323
|
-
})
|
|
3324
|
-
);
|
|
3325
|
-
const selectAssetTypeFieldsAttachmentById = (attachmentId) => (state) => {
|
|
3326
|
-
return state.assetTypeFieldsAttachmentReducer.instances[attachmentId];
|
|
3327
|
-
};
|
|
3328
|
-
const assetTypeFieldsAttachmentReducer = assetTypeFieldsAttachmentSlice.reducer;
|
|
3329
|
-
const assetTypeFieldValuesAttachmentAdapter = createModelAdapter(
|
|
3330
|
-
(attachment) => attachment.offline_id
|
|
3331
|
-
);
|
|
3332
|
-
const initialState = assetTypeFieldValuesAttachmentAdapter.getInitialState({});
|
|
3333
|
-
const assetTypeFieldValuesAttachmentSlice = toolkit.createSlice({
|
|
3334
|
-
name: "assetTypeFieldValuesAttachments",
|
|
3335
|
-
initialState,
|
|
3336
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
|
|
3337
|
-
reducers: {
|
|
3338
|
-
initializeAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.initialize,
|
|
3339
|
-
addAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.addOne,
|
|
3340
|
-
addAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.addMany,
|
|
3341
|
-
setAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.setOne,
|
|
3342
|
-
setAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.setMany,
|
|
3343
|
-
updateAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.updateOne,
|
|
3344
|
-
updateAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.updateMany,
|
|
3345
|
-
deleteAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.deleteOne,
|
|
3346
|
-
deleteAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.deleteMany
|
|
3347
|
-
}
|
|
3348
|
-
});
|
|
3349
|
-
const {
|
|
3350
|
-
initializeAssetTypeFieldValuesAttachments,
|
|
3351
|
-
addAssetTypeFieldValuesAttachment,
|
|
3352
|
-
addAssetTypeFieldValuesAttachments,
|
|
3353
|
-
setAssetTypeFieldValuesAttachment,
|
|
3354
|
-
setAssetTypeFieldValuesAttachments,
|
|
3355
|
-
updateAssetTypeFieldValuesAttachment,
|
|
3356
|
-
updateAssetTypeFieldValuesAttachments,
|
|
3357
|
-
deleteAssetTypeFieldValuesAttachment,
|
|
3358
|
-
deleteAssetTypeFieldValuesAttachments
|
|
3359
|
-
} = assetTypeFieldValuesAttachmentSlice.actions;
|
|
3360
|
-
const selectAssetTypeFieldValuesAttachmentsMapping = (state) => state.assetTypeFieldValuesAttachmentReducer.instances;
|
|
3361
|
-
const selectAssetTypeFieldValuesAttachments = toolkit.createSelector(
|
|
3362
|
-
[selectAssetTypeFieldValuesAttachmentsMapping],
|
|
3363
|
-
(attachmentsMapping) => {
|
|
3364
|
-
return Object.values(attachmentsMapping);
|
|
3365
|
-
}
|
|
3366
|
-
);
|
|
3367
|
-
const selectAttachmentsOfAssetTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3368
|
-
toolkit.createSelector([selectAssetTypeFieldValuesAttachments, (_state, id) => id], (attachments, id) => {
|
|
3369
|
-
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === id));
|
|
3370
|
-
})
|
|
3371
|
-
);
|
|
3372
|
-
const selectAssetTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3373
|
-
return state.assetTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3374
|
-
};
|
|
3375
|
-
const assetTypeFieldValuesAttachmentReducer = assetTypeFieldValuesAttachmentSlice.reducer;
|
|
3376
|
-
let clientStore;
|
|
3377
|
-
function setClientStore(store) {
|
|
3378
|
-
clientStore = store;
|
|
3379
|
-
}
|
|
3380
|
-
function getClientStore() {
|
|
3381
|
-
return clientStore;
|
|
3382
|
-
}
|
|
3383
|
-
let clientSDK;
|
|
3384
|
-
function setClientSDK(sdkCtor) {
|
|
3385
|
-
clientSDK = sdkCtor;
|
|
3386
|
-
}
|
|
3387
|
-
function getClientSDK() {
|
|
3388
|
-
return clientSDK;
|
|
3389
|
-
}
|
|
3390
|
-
const CLASS_NAME_TO_SERVICE = {};
|
|
3391
|
-
class BaseService {
|
|
3392
|
-
constructor(sdk) {
|
|
3393
|
-
__publicField(this, "client");
|
|
3394
|
-
CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
|
|
3395
|
-
this.client = sdk;
|
|
3396
|
-
}
|
|
3397
|
-
async enqueueRequest(requestDetails) {
|
|
3398
|
-
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3399
|
-
}
|
|
3400
|
-
dispatch(action) {
|
|
3401
|
-
this.client.store.dispatch(action);
|
|
3163
|
+
dispatch(action) {
|
|
3164
|
+
this.client.store.dispatch(action);
|
|
3402
3165
|
}
|
|
3403
3166
|
}
|
|
3404
3167
|
const VERSION_REDUCER_KEY = "versioning";
|
|
@@ -3441,15 +3204,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3441
3204
|
issueCommentReducer,
|
|
3442
3205
|
issueUpdateReducer,
|
|
3443
3206
|
geoImageReducer,
|
|
3444
|
-
issueAssociationReducer
|
|
3445
|
-
issueTypeFieldsReducer,
|
|
3446
|
-
issueTypeFieldValuesReducer,
|
|
3447
|
-
issueTypeFieldsAttachmentReducer,
|
|
3448
|
-
issueTypeFieldValuesAttachmentReducer,
|
|
3449
|
-
assetTypeFieldsReducer,
|
|
3450
|
-
assetTypeFieldValuesReducer,
|
|
3451
|
-
assetTypeFieldsAttachmentReducer,
|
|
3452
|
-
assetTypeFieldValuesAttachmentReducer
|
|
3207
|
+
issueAssociationReducer
|
|
3453
3208
|
};
|
|
3454
3209
|
const overmapReducer = toolkit.combineReducers(overmapReducers);
|
|
3455
3210
|
const resetStore = "RESET";
|
|
@@ -4091,6 +3846,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4091
3846
|
description: "Create Category",
|
|
4092
3847
|
method: HttpMethod.POST,
|
|
4093
3848
|
url: "/categories/",
|
|
3849
|
+
queryParams: {
|
|
3850
|
+
workspace_id: payload.workspace.toString()
|
|
3851
|
+
},
|
|
4094
3852
|
payload: offlineCategory,
|
|
4095
3853
|
blockers: [payload.workspace],
|
|
4096
3854
|
blocks: [offlineCategory.offline_id]
|
|
@@ -4303,10 +4061,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4303
4061
|
const result = await this.enqueueRequest({
|
|
4304
4062
|
description: "Get assets",
|
|
4305
4063
|
method: HttpMethod.GET,
|
|
4306
|
-
url:
|
|
4307
|
-
queryParams: {
|
|
4308
|
-
project: projectId.toString()
|
|
4309
|
-
},
|
|
4064
|
+
url: `/projects/${projectId}/assets/`,
|
|
4310
4065
|
blockers: [],
|
|
4311
4066
|
blocks: []
|
|
4312
4067
|
});
|
|
@@ -4327,7 +4082,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4327
4082
|
const promise = this.enqueueRequest({
|
|
4328
4083
|
description: "Add asset stage completion",
|
|
4329
4084
|
method: HttpMethod.POST,
|
|
4330
|
-
url: "/
|
|
4085
|
+
url: "/assets/completions/",
|
|
4331
4086
|
payload: {
|
|
4332
4087
|
offline_id: offlineStageCompletion.offline_id,
|
|
4333
4088
|
submitted_at: submittedAt,
|
|
@@ -4354,7 +4109,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4354
4109
|
const promise = this.enqueueRequest({
|
|
4355
4110
|
description: "Delete asset stage completion",
|
|
4356
4111
|
method: HttpMethod.DELETE,
|
|
4357
|
-
url: `/
|
|
4112
|
+
url: `/assets/completions/${id}/`,
|
|
4358
4113
|
blockers: [id],
|
|
4359
4114
|
blocks: []
|
|
4360
4115
|
});
|
|
@@ -4380,7 +4135,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4380
4135
|
const promise = this.enqueueRequest({
|
|
4381
4136
|
description: "Bulk create asset stage completions",
|
|
4382
4137
|
method: HttpMethod.POST,
|
|
4383
|
-
url: "/
|
|
4138
|
+
url: "/assets/completions/bulk/",
|
|
4384
4139
|
payload: {
|
|
4385
4140
|
submitted_at: submittedAt,
|
|
4386
4141
|
completions: payload
|
|
@@ -4402,7 +4157,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4402
4157
|
const promise = this.enqueueRequest({
|
|
4403
4158
|
description: "Deleting asset stage completions",
|
|
4404
4159
|
method: HttpMethod.DELETE,
|
|
4405
|
-
url: "/
|
|
4160
|
+
url: "/assets/completions/bulk/",
|
|
4406
4161
|
payload: {
|
|
4407
4162
|
completion_ids: ids
|
|
4408
4163
|
},
|
|
@@ -4418,10 +4173,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4418
4173
|
const result = await this.enqueueRequest({
|
|
4419
4174
|
description: "Get asset stage completions",
|
|
4420
4175
|
method: HttpMethod.GET,
|
|
4421
|
-
url:
|
|
4422
|
-
queryParams: {
|
|
4423
|
-
project: projectId.toString()
|
|
4424
|
-
},
|
|
4176
|
+
url: `/projects/${projectId}/asset-stage-completions/`,
|
|
4425
4177
|
blockers: [],
|
|
4426
4178
|
blocks: []
|
|
4427
4179
|
});
|
|
@@ -4442,7 +4194,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4442
4194
|
const promise = this.enqueueRequest({
|
|
4443
4195
|
description: "Add asset stages",
|
|
4444
4196
|
method: HttpMethod.POST,
|
|
4445
|
-
url: "/
|
|
4197
|
+
url: "/assets/stages/bulk/",
|
|
4446
4198
|
payload: {
|
|
4447
4199
|
submitted_at: submittedAt,
|
|
4448
4200
|
asset_type: assetTypeId,
|
|
@@ -4466,7 +4218,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4466
4218
|
return this.enqueueRequest({
|
|
4467
4219
|
description: "Edit asset stages",
|
|
4468
4220
|
method: HttpMethod.PATCH,
|
|
4469
|
-
url: `/
|
|
4221
|
+
url: `/assets/types/${assetTypeId}/bulk-update-stages/`,
|
|
4470
4222
|
payload: {
|
|
4471
4223
|
stages: stagesToUpdate
|
|
4472
4224
|
},
|
|
@@ -4484,7 +4236,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4484
4236
|
const promise = this.enqueueRequest({
|
|
4485
4237
|
description: "Delete asset stages",
|
|
4486
4238
|
method: HttpMethod.DELETE,
|
|
4487
|
-
url: "/
|
|
4239
|
+
url: "/assets/stages/bulk/",
|
|
4488
4240
|
payload: {
|
|
4489
4241
|
stage_ids: idsToDelete
|
|
4490
4242
|
},
|
|
@@ -4509,7 +4261,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4509
4261
|
const promise = this.enqueueRequest({
|
|
4510
4262
|
description: "Update asset stage",
|
|
4511
4263
|
method: HttpMethod.PATCH,
|
|
4512
|
-
url: `/
|
|
4264
|
+
url: `/assets/stages/${assetStage.offline_id}/`,
|
|
4513
4265
|
payload: {
|
|
4514
4266
|
name: payload.name,
|
|
4515
4267
|
description: payload.description,
|
|
@@ -4537,7 +4289,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4537
4289
|
await this.enqueueRequest({
|
|
4538
4290
|
description: "Link asset stage to form",
|
|
4539
4291
|
method: HttpMethod.POST,
|
|
4540
|
-
url: `/
|
|
4292
|
+
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
4541
4293
|
payload: { form: formId },
|
|
4542
4294
|
blockers: [stageId, formId],
|
|
4543
4295
|
blocks: [stageId]
|
|
@@ -4558,7 +4310,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4558
4310
|
await this.enqueueRequest({
|
|
4559
4311
|
description: "Unlink asset stage from form",
|
|
4560
4312
|
method: HttpMethod.DELETE,
|
|
4561
|
-
url: `/
|
|
4313
|
+
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
4562
4314
|
blockers: [stageId, formId],
|
|
4563
4315
|
blocks: [stageId]
|
|
4564
4316
|
});
|
|
@@ -4571,10 +4323,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4571
4323
|
const result = await this.enqueueRequest({
|
|
4572
4324
|
description: "Get asset stages",
|
|
4573
4325
|
method: HttpMethod.GET,
|
|
4574
|
-
url:
|
|
4575
|
-
queryParams: {
|
|
4576
|
-
project: projectId.toString()
|
|
4577
|
-
},
|
|
4326
|
+
url: `/projects/${projectId}/asset-stages/`,
|
|
4578
4327
|
blockers: [],
|
|
4579
4328
|
blocks: []
|
|
4580
4329
|
});
|
|
@@ -4591,12 +4340,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4591
4340
|
projectAttachmentReducer: projectAttachmentReducer2,
|
|
4592
4341
|
formRevisionAttachmentReducer: formRevisionAttachmentReducer2,
|
|
4593
4342
|
formSubmissionAttachmentReducer: formSubmissionAttachmentReducer2,
|
|
4594
|
-
geoImageReducer: geoImageReducer2
|
|
4595
|
-
// fields
|
|
4596
|
-
assetTypeFieldsAttachmentReducer: assetTypeFieldsAttachmentReducer2,
|
|
4597
|
-
assetTypeFieldValuesAttachmentReducer: assetTypeFieldValuesAttachmentReducer2,
|
|
4598
|
-
issueTypeFieldsAttachmentReducer: issueTypeFieldsAttachmentReducer2,
|
|
4599
|
-
issueTypeFieldValuesAttachmentReducer: issueTypeFieldValuesAttachmentReducer2
|
|
4343
|
+
geoImageReducer: geoImageReducer2
|
|
4600
4344
|
} = this.client.store.getState();
|
|
4601
4345
|
const objectsWithSha1 = [].concat(
|
|
4602
4346
|
Object.values(issueAttachmentReducer2.instances),
|
|
@@ -4606,11 +4350,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4606
4350
|
Object.values(projectAttachmentReducer2.instances),
|
|
4607
4351
|
Object.values(formRevisionAttachmentReducer2.instances),
|
|
4608
4352
|
Object.values(formSubmissionAttachmentReducer2.instances),
|
|
4609
|
-
Object.values(geoImageReducer2.instances)
|
|
4610
|
-
Object.values(assetTypeFieldsAttachmentReducer2.instances),
|
|
4611
|
-
Object.values(assetTypeFieldValuesAttachmentReducer2.instances),
|
|
4612
|
-
Object.values(issueTypeFieldsAttachmentReducer2.instances),
|
|
4613
|
-
Object.values(issueTypeFieldValuesAttachmentReducer2.instances)
|
|
4353
|
+
Object.values(geoImageReducer2.instances)
|
|
4614
4354
|
);
|
|
4615
4355
|
return objectsWithSha1.filter((object) => object.file_sha1 === sha1).length;
|
|
4616
4356
|
}
|
|
@@ -4632,20 +4372,41 @@ var __publicField = (obj, key, value) => {
|
|
|
4632
4372
|
}
|
|
4633
4373
|
return promisesBySha1;
|
|
4634
4374
|
}
|
|
4635
|
-
async getFilePayload(file) {
|
|
4636
|
-
const sha1 = await hashFile(file);
|
|
4637
|
-
const filePayload = {
|
|
4638
|
-
sha1,
|
|
4639
|
-
file_type: file.type,
|
|
4640
|
-
extension: file.name.split(".").pop(),
|
|
4641
|
-
size: file.size
|
|
4642
|
-
};
|
|
4643
|
-
await this.client.files.addCache(file, sha1);
|
|
4644
|
-
return filePayload;
|
|
4645
|
-
}
|
|
4646
4375
|
}
|
|
4376
|
+
const AttachmentModelMeta = {
|
|
4377
|
+
[AttachmentModel.Issue]: {
|
|
4378
|
+
name: "issue",
|
|
4379
|
+
attachUrlPrefix: "/issues",
|
|
4380
|
+
deleteUrlPrefix: "/issues",
|
|
4381
|
+
fetchUrlPostfix: "/issue-attachments"
|
|
4382
|
+
},
|
|
4383
|
+
[AttachmentModel.Asset]: {
|
|
4384
|
+
name: "asset",
|
|
4385
|
+
attachUrlPrefix: "/assets",
|
|
4386
|
+
deleteUrlPrefix: "/assets",
|
|
4387
|
+
fetchUrlPostfix: "/asset-attachments"
|
|
4388
|
+
},
|
|
4389
|
+
[AttachmentModel.AssetType]: {
|
|
4390
|
+
name: "asset type",
|
|
4391
|
+
attachUrlPrefix: "/assets/types",
|
|
4392
|
+
deleteUrlPrefix: "/assets/types",
|
|
4393
|
+
fetchUrlPostfix: "/asset-type-attachments"
|
|
4394
|
+
},
|
|
4395
|
+
[AttachmentModel.Project]: {
|
|
4396
|
+
name: "project",
|
|
4397
|
+
attachUrlPrefix: "/projects",
|
|
4398
|
+
deleteUrlPrefix: "/projects",
|
|
4399
|
+
fetchUrlPostfix: "/attachments"
|
|
4400
|
+
},
|
|
4401
|
+
[AttachmentModel.Document]: {
|
|
4402
|
+
name: "document",
|
|
4403
|
+
attachUrlPrefix: "/documents",
|
|
4404
|
+
deleteUrlPrefix: "/documents",
|
|
4405
|
+
fetchUrlPostfix: "/document-attachments"
|
|
4406
|
+
}
|
|
4407
|
+
};
|
|
4647
4408
|
class BaseAttachmentService extends BaseUploadService {
|
|
4648
|
-
async
|
|
4409
|
+
async attachFiles(files, modelId, buildOfflineAttachment) {
|
|
4649
4410
|
var _a2;
|
|
4650
4411
|
const { store } = this.client;
|
|
4651
4412
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
@@ -4653,36 +4414,39 @@ var __publicField = (obj, key, value) => {
|
|
|
4653
4414
|
const offlineAttachments = [];
|
|
4654
4415
|
const attachmentPayloads = [];
|
|
4655
4416
|
const filePayloads = {};
|
|
4656
|
-
for (const
|
|
4657
|
-
const
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4417
|
+
for (const file of files) {
|
|
4418
|
+
const sha1 = await hashFile(file);
|
|
4419
|
+
if (!(sha1 in filePayloads)) {
|
|
4420
|
+
filePayloads[sha1] = {
|
|
4421
|
+
sha1,
|
|
4422
|
+
file_type: file.type,
|
|
4423
|
+
extension: file.name.split(".").pop(),
|
|
4424
|
+
size: file.size
|
|
4425
|
+
};
|
|
4426
|
+
await this.client.files.addCache(file, sha1);
|
|
4427
|
+
}
|
|
4428
|
+
const offlineAttachment = buildOfflineAttachment({
|
|
4662
4429
|
file,
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4430
|
+
sha1,
|
|
4431
|
+
submittedAt,
|
|
4432
|
+
createdBy,
|
|
4666
4433
|
description: "",
|
|
4667
4434
|
modelId
|
|
4668
4435
|
});
|
|
4669
4436
|
offlineAttachments.push(offlineAttachment);
|
|
4670
|
-
attachmentPayloads.push(
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
description: offlineAttachment.description,
|
|
4677
|
-
modelId
|
|
4678
|
-
})
|
|
4679
|
-
);
|
|
4437
|
+
attachmentPayloads.push({
|
|
4438
|
+
offline_id: offlineAttachment.offline_id,
|
|
4439
|
+
name: offlineAttachment.file_name,
|
|
4440
|
+
sha1: offlineAttachment.file_sha1,
|
|
4441
|
+
description: offlineAttachment.description
|
|
4442
|
+
});
|
|
4680
4443
|
}
|
|
4681
4444
|
this.dispatch(this.addAttachments(offlineAttachments));
|
|
4445
|
+
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4682
4446
|
const promise = this.enqueueRequest({
|
|
4683
|
-
description: `
|
|
4447
|
+
description: `Attach files to ${meta.name}`,
|
|
4684
4448
|
method: HttpMethod.POST,
|
|
4685
|
-
url: `${
|
|
4449
|
+
url: `${meta.attachUrlPrefix}/${modelId}/attach/`,
|
|
4686
4450
|
payload: {
|
|
4687
4451
|
submitted_at: submittedAt,
|
|
4688
4452
|
attachments: attachmentPayloads,
|
|
@@ -4699,7 +4463,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4699
4463
|
});
|
|
4700
4464
|
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
4701
4465
|
}
|
|
4702
|
-
async
|
|
4466
|
+
async deleteAttachment(attachmendId) {
|
|
4703
4467
|
const { store } = this.client;
|
|
4704
4468
|
const attachment = this.selectAttachment(attachmendId)(store.getState());
|
|
4705
4469
|
if (!attachment) {
|
|
@@ -4708,10 +4472,11 @@ var __publicField = (obj, key, value) => {
|
|
|
4708
4472
|
);
|
|
4709
4473
|
}
|
|
4710
4474
|
this.dispatch(this.removeAttachment(attachment.offline_id));
|
|
4475
|
+
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4711
4476
|
const promise = this.enqueueRequest({
|
|
4712
|
-
description:
|
|
4477
|
+
description: "Delete attachment",
|
|
4713
4478
|
method: HttpMethod.DELETE,
|
|
4714
|
-
url: `${
|
|
4479
|
+
url: `${meta.deleteUrlPrefix}/attachments/${attachmendId}/`,
|
|
4715
4480
|
blockers: [attachmendId],
|
|
4716
4481
|
blocks: []
|
|
4717
4482
|
});
|
|
@@ -4724,12 +4489,24 @@ var __publicField = (obj, key, value) => {
|
|
|
4724
4489
|
});
|
|
4725
4490
|
return promise;
|
|
4726
4491
|
}
|
|
4492
|
+
// Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
|
|
4493
|
+
// so for some attachment model services, this method will have to be overridden.
|
|
4494
|
+
async refreshStore(projectId, _organizationId) {
|
|
4495
|
+
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4496
|
+
const result = await this.enqueueRequest({
|
|
4497
|
+
description: `Get ${meta.name} attachments`,
|
|
4498
|
+
method: HttpMethod.GET,
|
|
4499
|
+
url: `/projects/${projectId}${meta.fetchUrlPostfix}/`,
|
|
4500
|
+
blocks: [],
|
|
4501
|
+
blockers: []
|
|
4502
|
+
});
|
|
4503
|
+
this.dispatch(this.initializeAttachments(result));
|
|
4504
|
+
}
|
|
4727
4505
|
}
|
|
4728
4506
|
class AssetAttachmentService extends BaseAttachmentService {
|
|
4729
4507
|
constructor() {
|
|
4730
4508
|
super(...arguments);
|
|
4731
|
-
__publicField(this, "
|
|
4732
|
-
__publicField(this, "url", "/asset-attachments");
|
|
4509
|
+
__publicField(this, "attachmentModel", AttachmentModel.Asset);
|
|
4733
4510
|
__publicField(this, "initializeAttachments", initializeAssetAttachments);
|
|
4734
4511
|
__publicField(this, "addAttachments", addAssetAttachments);
|
|
4735
4512
|
__publicField(this, "updateAttachments", updateAssetAttachments);
|
|
@@ -4741,39 +4518,20 @@ var __publicField = (obj, key, value) => {
|
|
|
4741
4518
|
buildOfflineAttachment(data) {
|
|
4742
4519
|
return offline({
|
|
4743
4520
|
file: URL.createObjectURL(data.file),
|
|
4744
|
-
file_sha1: data.
|
|
4745
|
-
created_by: data.
|
|
4521
|
+
file_sha1: data.sha1,
|
|
4522
|
+
created_by: data.createdBy,
|
|
4746
4523
|
file_name: data.file.name,
|
|
4747
4524
|
file_type: data.file.type,
|
|
4748
|
-
submitted_at: data.
|
|
4525
|
+
submitted_at: data.submittedAt,
|
|
4749
4526
|
description: data.description,
|
|
4750
4527
|
asset: data.modelId
|
|
4751
4528
|
});
|
|
4752
4529
|
}
|
|
4753
|
-
|
|
4754
|
-
return
|
|
4755
|
-
...data,
|
|
4756
|
-
asset: data.modelId
|
|
4757
|
-
};
|
|
4758
|
-
}
|
|
4759
|
-
async bulkAdd(payloads) {
|
|
4760
|
-
return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetId, file: p.file })));
|
|
4761
|
-
}
|
|
4762
|
-
async delete(id) {
|
|
4763
|
-
return this._delete(id);
|
|
4530
|
+
async attachFilesToAsset(files, assetId) {
|
|
4531
|
+
return this.attachFiles(files, assetId, this.buildOfflineAttachment.bind(this));
|
|
4764
4532
|
}
|
|
4765
|
-
async
|
|
4766
|
-
|
|
4767
|
-
description: "Get asset attachments",
|
|
4768
|
-
method: HttpMethod.GET,
|
|
4769
|
-
url: `${this.url}/`,
|
|
4770
|
-
queryParams: {
|
|
4771
|
-
project: projectId.toString()
|
|
4772
|
-
},
|
|
4773
|
-
blocks: [],
|
|
4774
|
-
blockers: []
|
|
4775
|
-
});
|
|
4776
|
-
this.dispatch(initializeAssetAttachments(result));
|
|
4533
|
+
async deleteAssetAttachment(attachmentId) {
|
|
4534
|
+
return this.deleteAttachment(attachmentId);
|
|
4777
4535
|
}
|
|
4778
4536
|
}
|
|
4779
4537
|
class AssetTypeService extends BaseApiService {
|
|
@@ -4790,7 +4548,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4790
4548
|
const promise = this.enqueueRequest({
|
|
4791
4549
|
description: "Create asset type",
|
|
4792
4550
|
method: HttpMethod.POST,
|
|
4793
|
-
url:
|
|
4551
|
+
url: `/projects/${payload.project}/asset-types/`,
|
|
4794
4552
|
payload: { ...offlineAssetType },
|
|
4795
4553
|
blockers: [],
|
|
4796
4554
|
blocks: [offlineAssetType.offline_id]
|
|
@@ -4816,7 +4574,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4816
4574
|
const promise = this.enqueueRequest({
|
|
4817
4575
|
description: "Update asset type",
|
|
4818
4576
|
method: HttpMethod.PATCH,
|
|
4819
|
-
url: `/
|
|
4577
|
+
url: `/assets/types/${payload.offline_id}/`,
|
|
4820
4578
|
payload: {
|
|
4821
4579
|
icon: payload.icon,
|
|
4822
4580
|
color: payload.color,
|
|
@@ -4850,7 +4608,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4850
4608
|
return this.enqueueRequest({
|
|
4851
4609
|
description: "Delete asset type",
|
|
4852
4610
|
method: HttpMethod.DELETE,
|
|
4853
|
-
url: `/
|
|
4611
|
+
url: `/assets/types/${assetTypeId}/`,
|
|
4854
4612
|
blockers: [assetTypeId],
|
|
4855
4613
|
blocks: []
|
|
4856
4614
|
}).catch((e) => {
|
|
@@ -4865,10 +4623,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4865
4623
|
const result = await this.enqueueRequest({
|
|
4866
4624
|
description: "Get asset types",
|
|
4867
4625
|
method: HttpMethod.GET,
|
|
4868
|
-
url:
|
|
4869
|
-
queryParams: {
|
|
4870
|
-
project: projectId.toString()
|
|
4871
|
-
},
|
|
4626
|
+
url: `/projects/${projectId}/asset-types/`,
|
|
4872
4627
|
blockers: [],
|
|
4873
4628
|
blocks: []
|
|
4874
4629
|
});
|
|
@@ -4878,8 +4633,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4878
4633
|
class AssetTypeAttachmentService extends BaseAttachmentService {
|
|
4879
4634
|
constructor() {
|
|
4880
4635
|
super(...arguments);
|
|
4881
|
-
__publicField(this, "
|
|
4882
|
-
__publicField(this, "
|
|
4636
|
+
__publicField(this, "attachmentModel", AttachmentModel.AssetType);
|
|
4637
|
+
__publicField(this, "initializeAttachments", initializeAssetTypeAttachments);
|
|
4883
4638
|
__publicField(this, "addAttachments", addAssetTypeAttachments);
|
|
4884
4639
|
__publicField(this, "updateAttachments", updateAssetTypeAttachments);
|
|
4885
4640
|
__publicField(this, "removeAttachments", deleteAssetTypeAttachments);
|
|
@@ -4890,39 +4645,20 @@ var __publicField = (obj, key, value) => {
|
|
|
4890
4645
|
buildOfflineAttachment(data) {
|
|
4891
4646
|
return offline({
|
|
4892
4647
|
file: URL.createObjectURL(data.file),
|
|
4893
|
-
file_sha1: data.
|
|
4894
|
-
created_by: data.
|
|
4648
|
+
file_sha1: data.sha1,
|
|
4649
|
+
created_by: data.createdBy,
|
|
4895
4650
|
file_name: data.file.name,
|
|
4896
4651
|
file_type: data.file.type,
|
|
4897
|
-
submitted_at: data.
|
|
4652
|
+
submitted_at: data.submittedAt,
|
|
4898
4653
|
description: data.description,
|
|
4899
4654
|
asset_type: data.modelId
|
|
4900
4655
|
});
|
|
4901
4656
|
}
|
|
4902
|
-
|
|
4903
|
-
return
|
|
4904
|
-
...data,
|
|
4905
|
-
asset_type: data.modelId
|
|
4906
|
-
};
|
|
4907
|
-
}
|
|
4908
|
-
async bulkAdd(payloads) {
|
|
4909
|
-
return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetTypeId, file: p.file })));
|
|
4657
|
+
async attachFilesToAssetType(files, assetTypeId) {
|
|
4658
|
+
return this.attachFiles(files, assetTypeId, this.buildOfflineAttachment.bind(this));
|
|
4910
4659
|
}
|
|
4911
|
-
async
|
|
4912
|
-
return this.
|
|
4913
|
-
}
|
|
4914
|
-
async refreshStore(projectId) {
|
|
4915
|
-
const result = await this.enqueueRequest({
|
|
4916
|
-
description: "Get asset type attachments",
|
|
4917
|
-
method: HttpMethod.GET,
|
|
4918
|
-
url: `${this.url}/`,
|
|
4919
|
-
queryParams: {
|
|
4920
|
-
project: projectId.toString()
|
|
4921
|
-
},
|
|
4922
|
-
blocks: [],
|
|
4923
|
-
blockers: []
|
|
4924
|
-
});
|
|
4925
|
-
this.dispatch(initializeAssetTypeAttachments(result));
|
|
4660
|
+
async deleteAssetTypeAttachment(attachmentId) {
|
|
4661
|
+
return this.deleteAttachment(attachmentId);
|
|
4926
4662
|
}
|
|
4927
4663
|
}
|
|
4928
4664
|
class IssueCommentService extends BaseApiService {
|
|
@@ -4938,7 +4674,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4938
4674
|
const promise = this.enqueueRequest({
|
|
4939
4675
|
description: "Add issue comment",
|
|
4940
4676
|
method: HttpMethod.POST,
|
|
4941
|
-
url:
|
|
4677
|
+
url: `/issues/${payload.issue}/comment/`,
|
|
4942
4678
|
payload: offlineComment,
|
|
4943
4679
|
blockers: [payload.issue],
|
|
4944
4680
|
blocks: [offlineComment.offline_id]
|
|
@@ -4962,7 +4698,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4962
4698
|
const promise = this.enqueueRequest({
|
|
4963
4699
|
description: "Edit issue comment",
|
|
4964
4700
|
method: HttpMethod.PATCH,
|
|
4965
|
-
url: `/
|
|
4701
|
+
url: `/issues/comments/${payload.offline_id}/`,
|
|
4966
4702
|
payload,
|
|
4967
4703
|
blockers: [payload.offline_id],
|
|
4968
4704
|
blocks: [payload.offline_id]
|
|
@@ -4981,7 +4717,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4981
4717
|
const promise = this.enqueueRequest({
|
|
4982
4718
|
description: "Delete comment",
|
|
4983
4719
|
method: HttpMethod.DELETE,
|
|
4984
|
-
url: `/
|
|
4720
|
+
url: `/issues/comments/${id}/`,
|
|
4985
4721
|
blockers: [id],
|
|
4986
4722
|
blocks: []
|
|
4987
4723
|
});
|
|
@@ -4994,10 +4730,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4994
4730
|
const result = await this.enqueueRequest({
|
|
4995
4731
|
description: "Get comments",
|
|
4996
4732
|
method: HttpMethod.GET,
|
|
4997
|
-
url:
|
|
4998
|
-
queryParams: {
|
|
4999
|
-
project: projectId.toString()
|
|
5000
|
-
},
|
|
4733
|
+
url: `/projects/${projectId}/comments/`,
|
|
5001
4734
|
blockers: [],
|
|
5002
4735
|
blocks: []
|
|
5003
4736
|
});
|
|
@@ -5009,21 +4742,27 @@ var __publicField = (obj, key, value) => {
|
|
|
5009
4742
|
const result = await this.enqueueRequest({
|
|
5010
4743
|
description: "Get issue updates",
|
|
5011
4744
|
method: HttpMethod.GET,
|
|
5012
|
-
url:
|
|
5013
|
-
queryParams: {
|
|
5014
|
-
project: projectId.toString()
|
|
5015
|
-
},
|
|
4745
|
+
url: `/projects/${projectId}/issues/updates/`,
|
|
5016
4746
|
blockers: [],
|
|
5017
4747
|
blocks: []
|
|
5018
4748
|
});
|
|
5019
|
-
|
|
4749
|
+
let filteredResult = result.filter(onlyUniqueOfflineIds);
|
|
4750
|
+
filteredResult = filteredResult.map((comment) => {
|
|
4751
|
+
return { ...comment };
|
|
4752
|
+
});
|
|
4753
|
+
if (result.length !== filteredResult.length) {
|
|
4754
|
+
console.error(
|
|
4755
|
+
`Received duplicate comments from the API (new length ${filteredResult.length}); filtered in browser.`
|
|
4756
|
+
);
|
|
4757
|
+
}
|
|
4758
|
+
this.dispatch(initializeIssueUpdates(filteredResult));
|
|
5020
4759
|
}
|
|
5021
4760
|
}
|
|
5022
4761
|
class IssueAttachmentService extends BaseAttachmentService {
|
|
5023
4762
|
constructor() {
|
|
5024
4763
|
super(...arguments);
|
|
5025
|
-
__publicField(this, "
|
|
5026
|
-
__publicField(this, "
|
|
4764
|
+
__publicField(this, "attachmentModel", AttachmentModel.Issue);
|
|
4765
|
+
__publicField(this, "initializeAttachments", initializeIssueAttachments);
|
|
5027
4766
|
__publicField(this, "addAttachments", addIssueAttachments);
|
|
5028
4767
|
__publicField(this, "updateAttachments", updateIssueAttachments);
|
|
5029
4768
|
__publicField(this, "removeAttachments", deleteIssueAttachments);
|
|
@@ -5034,42 +4773,24 @@ var __publicField = (obj, key, value) => {
|
|
|
5034
4773
|
buildOfflineAttachment(data) {
|
|
5035
4774
|
return offline({
|
|
5036
4775
|
file: URL.createObjectURL(data.file),
|
|
5037
|
-
file_sha1: data.
|
|
5038
|
-
created_by: data.
|
|
4776
|
+
file_sha1: data.sha1,
|
|
4777
|
+
created_by: data.createdBy,
|
|
5039
4778
|
file_name: data.file.name,
|
|
5040
4779
|
file_type: data.file.type,
|
|
5041
|
-
submitted_at: data.
|
|
4780
|
+
submitted_at: data.submittedAt,
|
|
5042
4781
|
description: data.description,
|
|
5043
4782
|
issue: data.modelId
|
|
5044
4783
|
});
|
|
5045
4784
|
}
|
|
5046
|
-
|
|
5047
|
-
return
|
|
5048
|
-
...data,
|
|
5049
|
-
issue: data.modelId
|
|
5050
|
-
};
|
|
5051
|
-
}
|
|
5052
|
-
async bulkAdd(payloads) {
|
|
5053
|
-
return this._bulkAdd(payloads.map((p) => ({ modelId: p.issueId, file: p.file })));
|
|
5054
|
-
}
|
|
5055
|
-
async delete(id) {
|
|
5056
|
-
return this._delete(id);
|
|
4785
|
+
async attachFilesToIssue(files, issueId) {
|
|
4786
|
+
return this.attachFiles(files, issueId, this.buildOfflineAttachment.bind(this));
|
|
5057
4787
|
}
|
|
5058
|
-
async
|
|
5059
|
-
|
|
5060
|
-
description: "Get issue attachments",
|
|
5061
|
-
method: HttpMethod.GET,
|
|
5062
|
-
url: `${this.url}/`,
|
|
5063
|
-
queryParams: {
|
|
5064
|
-
project: projectId.toString()
|
|
5065
|
-
},
|
|
5066
|
-
blocks: [],
|
|
5067
|
-
blockers: []
|
|
5068
|
-
});
|
|
5069
|
-
this.dispatch(initializeIssueAttachments(result));
|
|
4788
|
+
async deleteIssueAttachment(attachmentId) {
|
|
4789
|
+
return this.deleteAttachment(attachmentId);
|
|
5070
4790
|
}
|
|
5071
4791
|
}
|
|
5072
4792
|
class IssueService extends BaseApiService {
|
|
4793
|
+
// Basic CRUD functions
|
|
5073
4794
|
add(payload) {
|
|
5074
4795
|
var _a2;
|
|
5075
4796
|
const { store } = this.client;
|
|
@@ -5087,6 +4808,10 @@ var __publicField = (obj, key, value) => {
|
|
|
5087
4808
|
description: "Create issue",
|
|
5088
4809
|
method: HttpMethod.POST,
|
|
5089
4810
|
url: "/issues/",
|
|
4811
|
+
queryParams: {
|
|
4812
|
+
workspace_id: payload.index_workspace,
|
|
4813
|
+
...payload.issue_type ? { issue_type: payload.issue_type } : {}
|
|
4814
|
+
},
|
|
5090
4815
|
payload: offlineIssue,
|
|
5091
4816
|
blockers: ["add-issue", ...offlineIssue.index_workspace ? [offlineIssue.index_workspace] : []],
|
|
5092
4817
|
blocks: [offlineIssue.offline_id]
|
|
@@ -5242,10 +4967,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5242
4967
|
const result = await this.enqueueRequest({
|
|
5243
4968
|
description: "Get issues",
|
|
5244
4969
|
method: HttpMethod.GET,
|
|
5245
|
-
url:
|
|
5246
|
-
queryParams: {
|
|
5247
|
-
project: projectId.toString()
|
|
5248
|
-
},
|
|
4970
|
+
url: `/projects/${projectId}/issues/`,
|
|
5249
4971
|
blockers: [],
|
|
5250
4972
|
blocks: []
|
|
5251
4973
|
});
|
|
@@ -5265,7 +4987,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5265
4987
|
this.dispatch(addIssueType(offlineIssueType));
|
|
5266
4988
|
const promise = this.enqueueRequest({
|
|
5267
4989
|
method: HttpMethod.POST,
|
|
5268
|
-
url:
|
|
4990
|
+
url: `/organizations/${payload.organization}/issue-types/`,
|
|
5269
4991
|
// Sending only whats needed here
|
|
5270
4992
|
payload: {
|
|
5271
4993
|
offline_id: offlineIssueType.offline_id,
|
|
@@ -5299,7 +5021,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5299
5021
|
this.dispatch(updateIssueType(offlineUpdatedIssueType));
|
|
5300
5022
|
const promise = this.enqueueRequest({
|
|
5301
5023
|
method: HttpMethod.PATCH,
|
|
5302
|
-
url: `/
|
|
5024
|
+
url: `/issues/types/${payload.offline_id}/`,
|
|
5303
5025
|
payload,
|
|
5304
5026
|
blockers: [payload.offline_id],
|
|
5305
5027
|
blocks: [payload.offline_id]
|
|
@@ -5323,7 +5045,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5323
5045
|
this.dispatch(deleteIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
|
|
5324
5046
|
const promise = this.enqueueRequest({
|
|
5325
5047
|
method: HttpMethod.DELETE,
|
|
5326
|
-
url: `/
|
|
5048
|
+
url: `/issues/types/${id}/`,
|
|
5327
5049
|
blockers: [id],
|
|
5328
5050
|
blocks: []
|
|
5329
5051
|
});
|
|
@@ -5336,10 +5058,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5336
5058
|
async refreshStore(organizationId) {
|
|
5337
5059
|
const result = await this.enqueueRequest({
|
|
5338
5060
|
method: HttpMethod.GET,
|
|
5339
|
-
url:
|
|
5340
|
-
queryParams: {
|
|
5341
|
-
organization: organizationId.toString()
|
|
5342
|
-
},
|
|
5061
|
+
url: `/organizations/${organizationId}/issue-types/`,
|
|
5343
5062
|
blockers: [],
|
|
5344
5063
|
blocks: []
|
|
5345
5064
|
});
|
|
@@ -5483,8 +5202,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5483
5202
|
class ProjectAttachmentService extends BaseAttachmentService {
|
|
5484
5203
|
constructor() {
|
|
5485
5204
|
super(...arguments);
|
|
5486
|
-
__publicField(this, "
|
|
5487
|
-
__publicField(this, "
|
|
5205
|
+
__publicField(this, "attachmentModel", AttachmentModel.Project);
|
|
5206
|
+
__publicField(this, "initializeAttachments", initializeProjectAttachments);
|
|
5488
5207
|
__publicField(this, "addAttachments", addProjectAttachments);
|
|
5489
5208
|
__publicField(this, "updateAttachments", updateProjectAttachments);
|
|
5490
5209
|
__publicField(this, "removeAttachments", deleteProjectAttachments);
|
|
@@ -5495,39 +5214,20 @@ var __publicField = (obj, key, value) => {
|
|
|
5495
5214
|
buildOfflineAttachment(data) {
|
|
5496
5215
|
return offline({
|
|
5497
5216
|
file: URL.createObjectURL(data.file),
|
|
5498
|
-
file_sha1: data.
|
|
5499
|
-
created_by: data.
|
|
5217
|
+
file_sha1: data.sha1,
|
|
5218
|
+
created_by: data.createdBy,
|
|
5500
5219
|
file_name: data.file.name,
|
|
5501
5220
|
file_type: data.file.type,
|
|
5502
|
-
submitted_at: data.
|
|
5221
|
+
submitted_at: data.submittedAt,
|
|
5503
5222
|
description: data.description,
|
|
5504
5223
|
project: data.modelId
|
|
5505
5224
|
});
|
|
5506
5225
|
}
|
|
5507
|
-
|
|
5508
|
-
return
|
|
5509
|
-
...data,
|
|
5510
|
-
project: data.modelId
|
|
5511
|
-
};
|
|
5512
|
-
}
|
|
5513
|
-
async bulkAdd(payloads) {
|
|
5514
|
-
return this._bulkAdd(payloads.map((p) => ({ modelId: p.projectId, file: p.file })));
|
|
5226
|
+
async attachFilesToProject(files, projectId) {
|
|
5227
|
+
return this.attachFiles(files, projectId, this.buildOfflineAttachment.bind(this));
|
|
5515
5228
|
}
|
|
5516
|
-
async
|
|
5517
|
-
return this.
|
|
5518
|
-
}
|
|
5519
|
-
async refreshStore(projectId) {
|
|
5520
|
-
const result = await this.enqueueRequest({
|
|
5521
|
-
description: "Get project attachments",
|
|
5522
|
-
method: HttpMethod.GET,
|
|
5523
|
-
url: `${this.url}/`,
|
|
5524
|
-
queryParams: {
|
|
5525
|
-
project: projectId.toString()
|
|
5526
|
-
},
|
|
5527
|
-
blockers: [],
|
|
5528
|
-
blocks: []
|
|
5529
|
-
});
|
|
5530
|
-
this.dispatch(initializeProjectAttachments(result));
|
|
5229
|
+
async deleteProjectAttachment(attachmentId) {
|
|
5230
|
+
return this.deleteAttachment(attachmentId);
|
|
5531
5231
|
}
|
|
5532
5232
|
}
|
|
5533
5233
|
class ProjectService extends BaseApiService {
|
|
@@ -5670,33 +5370,88 @@ var __publicField = (obj, key, value) => {
|
|
|
5670
5370
|
return { fields: newFields, images };
|
|
5671
5371
|
};
|
|
5672
5372
|
class FormService extends BaseUploadService {
|
|
5673
|
-
|
|
5373
|
+
async bulkAddRevisionAttachments(revisionId, files) {
|
|
5674
5374
|
var _a2;
|
|
5675
|
-
const { store } = this.client;
|
|
5676
5375
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5677
|
-
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5678
|
-
const
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5376
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5377
|
+
const filePayloads = {};
|
|
5378
|
+
const offlineFormRevisionAttachments = [];
|
|
5379
|
+
const attachmentPayloads = [];
|
|
5380
|
+
for (const [fieldIdentifier, file] of Object.entries(files)) {
|
|
5381
|
+
const sha1 = await hashFile(file);
|
|
5382
|
+
if (!(sha1 in filePayloads)) {
|
|
5383
|
+
filePayloads[sha1] = {
|
|
5384
|
+
sha1,
|
|
5385
|
+
file_type: file.type,
|
|
5386
|
+
extension: file.name.split(".").pop(),
|
|
5387
|
+
size: file.size
|
|
5388
|
+
};
|
|
5389
|
+
await this.client.files.addCache(file, sha1);
|
|
5390
|
+
}
|
|
5391
|
+
const offlineFormRevisionAttachment = offline({
|
|
5392
|
+
file: URL.createObjectURL(file),
|
|
5393
|
+
file_type: file.type,
|
|
5394
|
+
file_name: file.name,
|
|
5395
|
+
file_sha1: sha1,
|
|
5396
|
+
created_by: createdBy,
|
|
5397
|
+
revision: revisionId,
|
|
5398
|
+
submitted_at: submittedAt,
|
|
5399
|
+
field_identifier: fieldIdentifier
|
|
5400
|
+
});
|
|
5401
|
+
offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
|
|
5402
|
+
const attachmentPayload = {
|
|
5403
|
+
offline_id: offlineFormRevisionAttachment.offline_id,
|
|
5404
|
+
name: file.name,
|
|
5405
|
+
field_identifier: fieldIdentifier,
|
|
5406
|
+
sha1
|
|
5407
|
+
};
|
|
5408
|
+
attachmentPayloads.push(attachmentPayload);
|
|
5409
|
+
}
|
|
5410
|
+
this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
|
|
5411
|
+
const promise = this.enqueueRequest({
|
|
5412
|
+
description: "Attach files to form revision",
|
|
5413
|
+
method: HttpMethod.POST,
|
|
5414
|
+
url: `/forms/revisions/${revisionId}/attachments/bulk/`,
|
|
5415
|
+
payload: {
|
|
5416
|
+
submitted_at: submittedAt,
|
|
5417
|
+
attachments: attachmentPayloads,
|
|
5418
|
+
files: Object.values(filePayloads)
|
|
5419
|
+
},
|
|
5420
|
+
blockers: [revisionId],
|
|
5421
|
+
blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5422
|
+
});
|
|
5423
|
+
promise.then((result) => {
|
|
5424
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
5425
|
+
this.dispatch(updateFormRevisionAttachments(result.attachments));
|
|
5426
|
+
}).catch(() => {
|
|
5427
|
+
this.dispatch(
|
|
5428
|
+
deleteFormRevisionAttachments(
|
|
5429
|
+
offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5430
|
+
)
|
|
5431
|
+
);
|
|
5682
5432
|
});
|
|
5433
|
+
return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5434
|
+
}
|
|
5435
|
+
async add(ownerId, form, initialRevision, urlPrefix) {
|
|
5436
|
+
const { fields, images } = await separateImageFromFields(initialRevision.fields);
|
|
5683
5437
|
const offlineFormRevision = offline({
|
|
5684
5438
|
...initialRevision,
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5439
|
+
fields,
|
|
5440
|
+
created_by: form.created_by,
|
|
5441
|
+
form: form.offline_id,
|
|
5442
|
+
submitted_at: form.submitted_at,
|
|
5443
|
+
revision: "Pending"
|
|
5689
5444
|
});
|
|
5690
|
-
this.dispatch(addForm(
|
|
5445
|
+
this.dispatch(addForm(form));
|
|
5691
5446
|
this.dispatch(addFormRevision(offlineFormRevision));
|
|
5692
5447
|
const formPromise = this.enqueueRequest({
|
|
5693
5448
|
description: "Create form",
|
|
5694
5449
|
method: HttpMethod.POST,
|
|
5695
|
-
url:
|
|
5450
|
+
url: urlPrefix,
|
|
5696
5451
|
payload: {
|
|
5697
5452
|
// Sending exactly what is currently needed for the endpoint
|
|
5698
|
-
offline_id:
|
|
5699
|
-
submitted_at:
|
|
5453
|
+
offline_id: form.offline_id,
|
|
5454
|
+
submitted_at: form.submitted_at,
|
|
5700
5455
|
initial_revision: {
|
|
5701
5456
|
offline_id: offlineFormRevision.offline_id,
|
|
5702
5457
|
submitted_at: offlineFormRevision.submitted_at,
|
|
@@ -5705,41 +5460,134 @@ var __publicField = (obj, key, value) => {
|
|
|
5705
5460
|
fields: offlineFormRevision.fields
|
|
5706
5461
|
}
|
|
5707
5462
|
},
|
|
5708
|
-
blockers: [
|
|
5709
|
-
|
|
5710
|
-
...payload.organization ? [payload.organization.toString()] : []
|
|
5711
|
-
],
|
|
5712
|
-
blocks: [offlineForm.offline_id, offlineFormRevision.offline_id]
|
|
5463
|
+
blockers: [ownerId],
|
|
5464
|
+
blocks: [form.offline_id, offlineFormRevision.offline_id]
|
|
5713
5465
|
});
|
|
5466
|
+
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5467
|
+
offlineFormRevision.offline_id,
|
|
5468
|
+
images
|
|
5469
|
+
);
|
|
5714
5470
|
void formPromise.catch((e) => {
|
|
5715
|
-
this.dispatch(deleteForm(
|
|
5471
|
+
this.dispatch(deleteForm(form.offline_id));
|
|
5716
5472
|
this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
|
|
5717
5473
|
throw e;
|
|
5718
5474
|
});
|
|
5719
|
-
return [
|
|
5475
|
+
return [form, offlineFormRevision, offlineFormRevisionAttachments, formPromise, attachmentsPromise];
|
|
5720
5476
|
}
|
|
5721
|
-
|
|
5477
|
+
addForOrganization(organizationId, initialRevision) {
|
|
5478
|
+
var _a2;
|
|
5479
|
+
const state = this.client.store.getState();
|
|
5480
|
+
const offlineForm = offline({
|
|
5481
|
+
favorite: false,
|
|
5482
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5483
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5484
|
+
organization: organizationId
|
|
5485
|
+
});
|
|
5486
|
+
return this.add(
|
|
5487
|
+
organizationId.toString(),
|
|
5488
|
+
offlineForm,
|
|
5489
|
+
initialRevision,
|
|
5490
|
+
`/organizations/${organizationId}/create-form/`
|
|
5491
|
+
);
|
|
5492
|
+
}
|
|
5493
|
+
addForProject(projectId, initialRevision) {
|
|
5494
|
+
var _a2;
|
|
5495
|
+
const state = this.client.store.getState();
|
|
5496
|
+
const offlineForm = offline({
|
|
5497
|
+
favorite: false,
|
|
5498
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5499
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5500
|
+
project: projectId
|
|
5501
|
+
});
|
|
5502
|
+
return this.add(projectId.toString(), offlineForm, initialRevision, `/projects/${projectId}/create-form/`);
|
|
5503
|
+
}
|
|
5504
|
+
addForIssueType(issueTypeId, 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
|
+
issue_type: issueTypeId
|
|
5512
|
+
});
|
|
5513
|
+
return this.add(issueTypeId, offlineForm, initialRevision, `/issues/types/${issueTypeId}/create-form/`);
|
|
5514
|
+
}
|
|
5515
|
+
addForAssetType(assetTypeId, 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
|
+
asset_type: assetTypeId
|
|
5523
|
+
});
|
|
5524
|
+
return this.add(assetTypeId, offlineForm, initialRevision, `/assets/types/${assetTypeId}/create-form/`);
|
|
5525
|
+
}
|
|
5526
|
+
async createRevision(formId, revision) {
|
|
5527
|
+
var _a2;
|
|
5528
|
+
const offlineRevision = offline(revision);
|
|
5529
|
+
const { store } = this.client;
|
|
5530
|
+
const state = store.getState();
|
|
5531
|
+
const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5532
|
+
const { fields, images } = await separateImageFromFields(offlineRevision.fields);
|
|
5533
|
+
const fullRevision = {
|
|
5534
|
+
...offlineRevision,
|
|
5535
|
+
fields,
|
|
5536
|
+
created_by: createdBy,
|
|
5537
|
+
revision: "Pending",
|
|
5538
|
+
form: formId,
|
|
5539
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5540
|
+
};
|
|
5541
|
+
this.dispatch(addFormRevision(fullRevision));
|
|
5542
|
+
const promise = this.enqueueRequest({
|
|
5543
|
+
description: "Create form revision",
|
|
5544
|
+
method: HttpMethod.PATCH,
|
|
5545
|
+
url: `/forms/${formId}/`,
|
|
5546
|
+
payload: {
|
|
5547
|
+
initial_revision: {
|
|
5548
|
+
offline_id: fullRevision.offline_id,
|
|
5549
|
+
submitted_at: fullRevision.submitted_at,
|
|
5550
|
+
title: fullRevision.title,
|
|
5551
|
+
description: fullRevision.description,
|
|
5552
|
+
fields: fullRevision.fields
|
|
5553
|
+
}
|
|
5554
|
+
},
|
|
5555
|
+
blockers: [formId],
|
|
5556
|
+
blocks: [offlineRevision.offline_id]
|
|
5557
|
+
});
|
|
5558
|
+
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5559
|
+
fullRevision.offline_id,
|
|
5560
|
+
images
|
|
5561
|
+
);
|
|
5562
|
+
void promise.then((result) => {
|
|
5563
|
+
this.dispatch(setFormRevision(result));
|
|
5564
|
+
}).catch(() => {
|
|
5565
|
+
this.dispatch(deleteFormRevision(fullRevision.offline_id));
|
|
5566
|
+
});
|
|
5567
|
+
return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
|
|
5568
|
+
}
|
|
5569
|
+
async delete(formId) {
|
|
5722
5570
|
const { store } = this.client;
|
|
5723
5571
|
const state = store.getState();
|
|
5724
|
-
const form = selectFormById(
|
|
5572
|
+
const form = selectFormById(formId)(state);
|
|
5725
5573
|
if (!form) {
|
|
5726
5574
|
throw new Error("Expected form to exist");
|
|
5727
5575
|
}
|
|
5728
|
-
const formSubmissions = selectFormSubmissionsOfForm(
|
|
5576
|
+
const formSubmissions = selectFormSubmissionsOfForm(formId)(state);
|
|
5729
5577
|
if (formSubmissions.length > 0) {
|
|
5730
5578
|
this.dispatch(deleteFormSubmissions(formSubmissions.map(({ offline_id }) => offline_id)));
|
|
5731
5579
|
}
|
|
5732
|
-
const formRevisions = selectFormRevisionsOfForm(
|
|
5580
|
+
const formRevisions = selectFormRevisionsOfForm(formId)(state);
|
|
5733
5581
|
if (formRevisions.length > 0) {
|
|
5734
5582
|
this.dispatch(deleteFormRevisions(formRevisions.map(({ offline_id }) => offline_id)));
|
|
5735
5583
|
}
|
|
5736
|
-
this.dispatch(deleteForm(
|
|
5584
|
+
this.dispatch(deleteForm(formId));
|
|
5737
5585
|
try {
|
|
5738
5586
|
return await this.enqueueRequest({
|
|
5739
5587
|
description: "Delete form",
|
|
5740
5588
|
method: HttpMethod.DELETE,
|
|
5741
|
-
url: `/forms/${
|
|
5742
|
-
blockers: [
|
|
5589
|
+
url: `/forms/${formId}/`,
|
|
5590
|
+
blockers: [formId],
|
|
5743
5591
|
blocks: []
|
|
5744
5592
|
});
|
|
5745
5593
|
} catch (e) {
|
|
@@ -5753,31 +5601,65 @@ var __publicField = (obj, key, value) => {
|
|
|
5753
5601
|
throw e;
|
|
5754
5602
|
}
|
|
5755
5603
|
}
|
|
5756
|
-
async refreshStore(projectId
|
|
5757
|
-
|
|
5758
|
-
const
|
|
5604
|
+
async refreshStore(projectId) {
|
|
5605
|
+
const forms = [];
|
|
5606
|
+
const revisions = [];
|
|
5607
|
+
const attachments = [];
|
|
5608
|
+
const projectFormsResult = await this.enqueueRequest({
|
|
5759
5609
|
description: "Fetch project forms",
|
|
5760
5610
|
method: HttpMethod.GET,
|
|
5761
|
-
url:
|
|
5762
|
-
queryParams: {
|
|
5763
|
-
project: projectId.toString()
|
|
5764
|
-
},
|
|
5611
|
+
url: `/projects/${projectId}/forms/`,
|
|
5765
5612
|
blockers: [projectId.toString()],
|
|
5766
5613
|
blocks: []
|
|
5767
5614
|
});
|
|
5768
|
-
|
|
5769
|
-
|
|
5615
|
+
for (const form of projectFormsResult.forms)
|
|
5616
|
+
forms.push(form);
|
|
5617
|
+
for (const revision of projectFormsResult.revisions)
|
|
5618
|
+
revisions.push(revision);
|
|
5619
|
+
for (const attachment of projectFormsResult.attachments)
|
|
5620
|
+
attachments.push(attachment);
|
|
5621
|
+
const organizationFormsResult = await this.enqueueRequest({
|
|
5770
5622
|
description: "Fetch organization forms",
|
|
5771
5623
|
method: HttpMethod.GET,
|
|
5772
|
-
url:
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5624
|
+
url: `/projects/${projectId}/organizations/forms/`,
|
|
5625
|
+
blockers: [projectId.toString()],
|
|
5626
|
+
blocks: []
|
|
5627
|
+
});
|
|
5628
|
+
for (const form of organizationFormsResult.forms)
|
|
5629
|
+
forms.push(form);
|
|
5630
|
+
for (const revision of organizationFormsResult.revisions)
|
|
5631
|
+
revisions.push(revision);
|
|
5632
|
+
for (const attachment of organizationFormsResult.attachments)
|
|
5633
|
+
attachments.push(attachment);
|
|
5634
|
+
const assetTypeFormsResult = await this.enqueueRequest({
|
|
5635
|
+
description: "Fetch asset type forms",
|
|
5636
|
+
method: HttpMethod.GET,
|
|
5637
|
+
url: `/projects/${projectId}/asset-types/forms/`,
|
|
5638
|
+
blockers: [projectId.toString()],
|
|
5639
|
+
blocks: []
|
|
5640
|
+
});
|
|
5641
|
+
for (const form of assetTypeFormsResult.forms)
|
|
5642
|
+
forms.push(form);
|
|
5643
|
+
for (const revision of assetTypeFormsResult.revisions)
|
|
5644
|
+
revisions.push(revision);
|
|
5645
|
+
for (const attachment of assetTypeFormsResult.attachments)
|
|
5646
|
+
attachments.push(attachment);
|
|
5647
|
+
const issueTypeFormsResult = await this.enqueueRequest({
|
|
5648
|
+
description: "Fetch issue type forms",
|
|
5649
|
+
method: HttpMethod.GET,
|
|
5650
|
+
url: `/projects/${projectId}/issue-types/forms/`,
|
|
5651
|
+
blockers: [projectId.toString()],
|
|
5777
5652
|
blocks: []
|
|
5778
5653
|
});
|
|
5779
|
-
|
|
5654
|
+
for (const form of issueTypeFormsResult.forms)
|
|
5655
|
+
forms.push(form);
|
|
5656
|
+
for (const revision of issueTypeFormsResult.revisions)
|
|
5657
|
+
revisions.push(revision);
|
|
5658
|
+
for (const attachment of issueTypeFormsResult.attachments)
|
|
5659
|
+
attachments.push(attachment);
|
|
5780
5660
|
this.dispatch(initializeForms(forms));
|
|
5661
|
+
this.dispatch(initializeFormRevisions(revisions));
|
|
5662
|
+
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
5781
5663
|
}
|
|
5782
5664
|
}
|
|
5783
5665
|
const isArrayOfFiles = (value) => {
|
|
@@ -5799,11 +5681,95 @@ var __publicField = (obj, key, value) => {
|
|
|
5799
5681
|
return { values: newValues, files };
|
|
5800
5682
|
};
|
|
5801
5683
|
class FormSubmissionService extends BaseUploadService {
|
|
5802
|
-
|
|
5684
|
+
async bulkAddSubmissionAttachments(submissionId, files) {
|
|
5685
|
+
var _a2;
|
|
5686
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5687
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5688
|
+
const filePayloads = {};
|
|
5689
|
+
const offlineFormSubmissionAttachments = [];
|
|
5690
|
+
const attachmentPayloads = [];
|
|
5691
|
+
for (const [fieldIdentifier, filesArray] of Object.entries(files)) {
|
|
5692
|
+
for (const file of filesArray) {
|
|
5693
|
+
const sha1 = await hashFile(file);
|
|
5694
|
+
if (!(sha1 in filePayloads)) {
|
|
5695
|
+
filePayloads[sha1] = {
|
|
5696
|
+
sha1,
|
|
5697
|
+
file_type: file.type,
|
|
5698
|
+
extension: file.name.split(".").pop(),
|
|
5699
|
+
size: file.size
|
|
5700
|
+
};
|
|
5701
|
+
await this.client.files.addCache(file, sha1);
|
|
5702
|
+
}
|
|
5703
|
+
const offlineFormSubmissionAttachment = offline({
|
|
5704
|
+
file: URL.createObjectURL(file),
|
|
5705
|
+
file_type: file.type,
|
|
5706
|
+
file_name: file.name,
|
|
5707
|
+
file_sha1: sha1,
|
|
5708
|
+
created_by: createdBy,
|
|
5709
|
+
submission: submissionId,
|
|
5710
|
+
submitted_at: submittedAt,
|
|
5711
|
+
field_identifier: fieldIdentifier
|
|
5712
|
+
});
|
|
5713
|
+
offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
|
|
5714
|
+
const attachmentPayload = {
|
|
5715
|
+
offline_id: offlineFormSubmissionAttachment.offline_id,
|
|
5716
|
+
name: file.name,
|
|
5717
|
+
sha1,
|
|
5718
|
+
field_identifier: fieldIdentifier
|
|
5719
|
+
};
|
|
5720
|
+
attachmentPayloads.push(attachmentPayload);
|
|
5721
|
+
}
|
|
5722
|
+
}
|
|
5723
|
+
this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
|
|
5724
|
+
const promise = this.enqueueRequest({
|
|
5725
|
+
description: "Attach files to form submission",
|
|
5726
|
+
method: HttpMethod.POST,
|
|
5727
|
+
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
5728
|
+
payload: {
|
|
5729
|
+
submitted_at: submittedAt,
|
|
5730
|
+
attachments: attachmentPayloads,
|
|
5731
|
+
files: Object.values(filePayloads)
|
|
5732
|
+
},
|
|
5733
|
+
blockers: [submissionId],
|
|
5734
|
+
blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5735
|
+
});
|
|
5736
|
+
promise.then((result) => {
|
|
5737
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
5738
|
+
this.dispatch(updateFormSubmissionAttachments(result.attachments));
|
|
5739
|
+
}).catch(() => {
|
|
5740
|
+
this.dispatch(
|
|
5741
|
+
deleteFormSubmissionAttachments(
|
|
5742
|
+
offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5743
|
+
)
|
|
5744
|
+
);
|
|
5745
|
+
});
|
|
5746
|
+
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5747
|
+
}
|
|
5748
|
+
async bulkDeleteSubmissionAttachments(submissionId, attachmentsIds) {
|
|
5749
|
+
const { store } = this.client;
|
|
5750
|
+
const state = store.getState();
|
|
5751
|
+
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
5752
|
+
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
5753
|
+
try {
|
|
5754
|
+
await this.enqueueRequest({
|
|
5755
|
+
description: "Delete form submission attachments",
|
|
5756
|
+
method: HttpMethod.DELETE,
|
|
5757
|
+
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
5758
|
+
payload: { attachments: attachmentsIds },
|
|
5759
|
+
blockers: [submissionId, ...attachmentsIds],
|
|
5760
|
+
blocks: []
|
|
5761
|
+
});
|
|
5762
|
+
} catch (e) {
|
|
5763
|
+
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
5764
|
+
throw e;
|
|
5765
|
+
}
|
|
5766
|
+
}
|
|
5767
|
+
// Outer promise is for hashing and caching files for submission attachments
|
|
5768
|
+
async add(payload) {
|
|
5803
5769
|
var _a2;
|
|
5804
5770
|
const { store } = this.client;
|
|
5805
5771
|
const state = store.getState();
|
|
5806
|
-
const { values } = separateFilesFromValues(payload.values);
|
|
5772
|
+
const { values, files } = separateFilesFromValues(payload.values);
|
|
5807
5773
|
const offlineSubmission = offline({
|
|
5808
5774
|
...payload,
|
|
5809
5775
|
values,
|
|
@@ -5813,7 +5779,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5813
5779
|
const promise = this.enqueueRequest({
|
|
5814
5780
|
description: "Respond to form",
|
|
5815
5781
|
method: HttpMethod.POST,
|
|
5816
|
-
url:
|
|
5782
|
+
url: `/forms/revisions/${payload.form_revision}/respond/`,
|
|
5817
5783
|
payload: offlineSubmission,
|
|
5818
5784
|
blockers: [payload.issue, payload.asset, payload.asset_stage, "add-form-entry"].filter(
|
|
5819
5785
|
(x) => x !== void 0
|
|
@@ -5821,6 +5787,10 @@ var __publicField = (obj, key, value) => {
|
|
|
5821
5787
|
blocks: [offlineSubmission.offline_id]
|
|
5822
5788
|
});
|
|
5823
5789
|
this.dispatch(addFormSubmission(offlineSubmission));
|
|
5790
|
+
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
5791
|
+
offlineSubmission.offline_id,
|
|
5792
|
+
files
|
|
5793
|
+
);
|
|
5824
5794
|
promise.then((result) => {
|
|
5825
5795
|
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5826
5796
|
this.dispatch(setFormSubmission(result));
|
|
@@ -5829,16 +5799,115 @@ var __publicField = (obj, key, value) => {
|
|
|
5829
5799
|
this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
|
|
5830
5800
|
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5831
5801
|
});
|
|
5832
|
-
return [offlineSubmission, promise];
|
|
5802
|
+
return [offlineSubmission, offlineFormSubmissionAttachments, promise, attachmentsPromise];
|
|
5833
5803
|
}
|
|
5834
|
-
|
|
5804
|
+
// Note currently the bulkAdd method is specific to form submissions for assets
|
|
5805
|
+
// TODO: adapt the support bulk adding to any model type
|
|
5806
|
+
async bulkAdd(args, batchSize) {
|
|
5807
|
+
const { formRevision, commonFieldValues, fieldValuesByAsset } = args;
|
|
5808
|
+
const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
|
|
5809
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5810
|
+
const transactionId = uuid.v4();
|
|
5811
|
+
const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), batchSize);
|
|
5812
|
+
const bulkAddBatches = await Promise.all(
|
|
5813
|
+
assetIdBatches.map(async (assetIdBatch) => {
|
|
5814
|
+
const batchId = uuid.v4();
|
|
5815
|
+
const submissionPayloads = [];
|
|
5816
|
+
const attachmentPayloads = [];
|
|
5817
|
+
const files = { ...commonFiles };
|
|
5818
|
+
for (const assetId of assetIdBatch) {
|
|
5819
|
+
const { values: fileSeperatedSubmissionSpecificValues, files: submissionSpecificFiles } = separateFilesFromValues(fieldValuesByAsset[assetId] ?? {});
|
|
5820
|
+
Object.assign(files, submissionSpecificFiles);
|
|
5821
|
+
const submissionPayload = offline({
|
|
5822
|
+
asset_id: assetId,
|
|
5823
|
+
form_data: fileSeperatedSubmissionSpecificValues
|
|
5824
|
+
});
|
|
5825
|
+
submissionPayloads.push(submissionPayload);
|
|
5826
|
+
for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
|
|
5827
|
+
for (const file of fileArray) {
|
|
5828
|
+
const sha1 = await hashFile(file);
|
|
5829
|
+
await this.client.files.addCache(file, sha1);
|
|
5830
|
+
const attachmentPayload = offline({
|
|
5831
|
+
submission_id: submissionPayload.offline_id,
|
|
5832
|
+
sha1,
|
|
5833
|
+
name: file.name,
|
|
5834
|
+
field_identifier: fieldIdentifier
|
|
5835
|
+
});
|
|
5836
|
+
attachmentPayloads.push(attachmentPayload);
|
|
5837
|
+
}
|
|
5838
|
+
}
|
|
5839
|
+
}
|
|
5840
|
+
const filePaylods = [];
|
|
5841
|
+
for (const file of Object.values(files).flat()) {
|
|
5842
|
+
const sha1 = await hashFile(file);
|
|
5843
|
+
const filePayload = {
|
|
5844
|
+
sha1,
|
|
5845
|
+
extension: file.name.split(".").pop() || "",
|
|
5846
|
+
file_type: file.type,
|
|
5847
|
+
size: file.size
|
|
5848
|
+
};
|
|
5849
|
+
filePaylods.push(filePayload);
|
|
5850
|
+
}
|
|
5851
|
+
return {
|
|
5852
|
+
batchId,
|
|
5853
|
+
payload: {
|
|
5854
|
+
transaction_id: transactionId,
|
|
5855
|
+
form_data: fileSeperatedCommonFieldValues,
|
|
5856
|
+
submitted_at: submittedAt,
|
|
5857
|
+
submissions: submissionPayloads,
|
|
5858
|
+
attachments: attachmentPayloads,
|
|
5859
|
+
files: filePaylods
|
|
5860
|
+
}
|
|
5861
|
+
};
|
|
5862
|
+
})
|
|
5863
|
+
);
|
|
5864
|
+
const batchPromises = [];
|
|
5865
|
+
let prevBatchId = null;
|
|
5866
|
+
for (const batch of bulkAddBatches) {
|
|
5867
|
+
const { payload, batchId } = batch;
|
|
5868
|
+
const batchAssetIds = payload.submissions.map((x) => x.asset_id);
|
|
5869
|
+
const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
|
|
5870
|
+
const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
|
|
5871
|
+
const blockers = batchAssetIds;
|
|
5872
|
+
if (prevBatchId)
|
|
5873
|
+
blockers.push(prevBatchId);
|
|
5874
|
+
const blocks2 = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5875
|
+
const promise = this.enqueueRequest({
|
|
5876
|
+
description: "Bulk add form submissions",
|
|
5877
|
+
method: HttpMethod.POST,
|
|
5878
|
+
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
5879
|
+
payload,
|
|
5880
|
+
blockers,
|
|
5881
|
+
blocks: blocks2
|
|
5882
|
+
});
|
|
5883
|
+
void promise.then(({ presigned_urls }) => {
|
|
5884
|
+
this.processPresignedUrls(presigned_urls);
|
|
5885
|
+
});
|
|
5886
|
+
prevBatchId = batchId;
|
|
5887
|
+
batchPromises.push(promise);
|
|
5888
|
+
}
|
|
5889
|
+
void Promise.all(batchPromises).then((results) => {
|
|
5890
|
+
const createdSubmissions = [];
|
|
5891
|
+
const createdAttachments = [];
|
|
5892
|
+
for (const result of results) {
|
|
5893
|
+
for (const createdSubmission of result.submissions)
|
|
5894
|
+
createdSubmissions.push(createdSubmission);
|
|
5895
|
+
for (const createdAttachment of result.attachments)
|
|
5896
|
+
createdAttachments.push(createdAttachment);
|
|
5897
|
+
}
|
|
5898
|
+
this.dispatch(addFormSubmissions(createdSubmissions));
|
|
5899
|
+
this.dispatch(addFormSubmissionAttachments(createdAttachments));
|
|
5900
|
+
});
|
|
5901
|
+
return batchPromises;
|
|
5902
|
+
}
|
|
5903
|
+
async update(payload) {
|
|
5835
5904
|
const { store } = this.client;
|
|
5836
5905
|
const state = store.getState();
|
|
5837
5906
|
const submissionToBeUpdated = selectFormSubmissionById(payload.offline_id)(state);
|
|
5838
5907
|
if (!submissionToBeUpdated) {
|
|
5839
5908
|
throw new Error(`Expected submission with offline_id ${payload.offline_id} to exist`);
|
|
5840
5909
|
}
|
|
5841
|
-
const { values } = separateFilesFromValues(payload.values ?? {});
|
|
5910
|
+
const { values, files } = separateFilesFromValues(payload.values ?? {});
|
|
5842
5911
|
const updatedSubmission = {
|
|
5843
5912
|
...submissionToBeUpdated,
|
|
5844
5913
|
...payload,
|
|
@@ -5852,36 +5921,57 @@ var __publicField = (obj, key, value) => {
|
|
|
5852
5921
|
const promise = this.enqueueRequest({
|
|
5853
5922
|
description: "Delete user form submissions",
|
|
5854
5923
|
method: HttpMethod.PATCH,
|
|
5855
|
-
url: `/
|
|
5924
|
+
url: `/forms/submissions/${updatedSubmission.offline_id}/`,
|
|
5856
5925
|
// TODO: send just payload when FormSubmissionDeserializer is updated to handle partial updates
|
|
5857
5926
|
payload: updatedSubmission,
|
|
5858
5927
|
blockers: [updatedSubmission.offline_id],
|
|
5859
5928
|
blocks: [updatedSubmission.offline_id]
|
|
5860
5929
|
});
|
|
5930
|
+
const formSubmissionAttachments = selectAttachmentsOfFormSubmission(payload.offline_id)(state);
|
|
5931
|
+
const formSubmissionAttachmentIdsToBeDeleted = [];
|
|
5932
|
+
for (const attachment of formSubmissionAttachments) {
|
|
5933
|
+
if (attachment.field_identifier in files) {
|
|
5934
|
+
formSubmissionAttachmentIdsToBeDeleted.push(attachment.offline_id);
|
|
5935
|
+
}
|
|
5936
|
+
}
|
|
5937
|
+
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
5938
|
+
payload.offline_id,
|
|
5939
|
+
files
|
|
5940
|
+
);
|
|
5941
|
+
const deleteAttachmentsPromise = this.bulkDeleteSubmissionAttachments(
|
|
5942
|
+
payload.offline_id,
|
|
5943
|
+
formSubmissionAttachmentIdsToBeDeleted
|
|
5944
|
+
);
|
|
5861
5945
|
promise.then((result) => {
|
|
5862
5946
|
this.dispatch(setFormSubmission(result));
|
|
5863
5947
|
}).catch(() => {
|
|
5864
5948
|
this.dispatch(setFormSubmission(submissionToBeUpdated));
|
|
5865
5949
|
});
|
|
5866
|
-
return [
|
|
5950
|
+
return [
|
|
5951
|
+
updatedSubmission,
|
|
5952
|
+
offlineFormSubmissionAttachments,
|
|
5953
|
+
promise,
|
|
5954
|
+
attachmentsPromise,
|
|
5955
|
+
deleteAttachmentsPromise
|
|
5956
|
+
];
|
|
5867
5957
|
}
|
|
5868
|
-
async delete(
|
|
5958
|
+
async delete(submissionId) {
|
|
5869
5959
|
const { store } = this.client;
|
|
5870
5960
|
const state = store.getState();
|
|
5871
|
-
const submissionToBeDeleted = selectFormSubmissionById(
|
|
5961
|
+
const submissionToBeDeleted = selectFormSubmissionById(submissionId)(state);
|
|
5872
5962
|
if (!submissionToBeDeleted) {
|
|
5873
|
-
throw new Error(`Expected submission with offline_id ${
|
|
5963
|
+
throw new Error(`Expected submission with offline_id ${submissionId} to exist`);
|
|
5874
5964
|
}
|
|
5875
|
-
const submissionAttachments = selectAttachmentsOfFormSubmission(
|
|
5876
|
-
this.dispatch(deleteFormSubmission(
|
|
5965
|
+
const submissionAttachments = selectAttachmentsOfFormSubmission(submissionId)(state);
|
|
5966
|
+
this.dispatch(deleteFormSubmission(submissionId));
|
|
5877
5967
|
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5878
5968
|
this.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
|
|
5879
5969
|
try {
|
|
5880
5970
|
return await this.enqueueRequest({
|
|
5881
5971
|
description: "Delete user form submissions",
|
|
5882
5972
|
method: HttpMethod.DELETE,
|
|
5883
|
-
url: `/
|
|
5884
|
-
blockers: [
|
|
5973
|
+
url: `/forms/submissions/${submissionId}/`,
|
|
5974
|
+
blockers: [submissionId],
|
|
5885
5975
|
blocks: []
|
|
5886
5976
|
});
|
|
5887
5977
|
} catch (e) {
|
|
@@ -5892,17 +5982,50 @@ var __publicField = (obj, key, value) => {
|
|
|
5892
5982
|
}
|
|
5893
5983
|
}
|
|
5894
5984
|
async refreshStore(projectId) {
|
|
5895
|
-
const
|
|
5896
|
-
|
|
5985
|
+
const formSubmissions = {};
|
|
5986
|
+
const modelSubmissions = await this.enqueueRequest({
|
|
5987
|
+
description: "Fetch model submissions",
|
|
5897
5988
|
method: HttpMethod.GET,
|
|
5898
|
-
url:
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5989
|
+
url: `/forms/in-project/${projectId}/submissions/model/latest/`,
|
|
5990
|
+
blockers: [],
|
|
5991
|
+
blocks: []
|
|
5992
|
+
});
|
|
5993
|
+
for (const modelSubmission of modelSubmissions) {
|
|
5994
|
+
formSubmissions[modelSubmission.offline_id] = modelSubmission;
|
|
5995
|
+
}
|
|
5996
|
+
const standaloneSubmissions = await this.enqueueRequest({
|
|
5997
|
+
description: "Fetch standalone submissions",
|
|
5998
|
+
method: HttpMethod.GET,
|
|
5999
|
+
url: `/forms/in-project/${projectId}/submissions/standalone/`,
|
|
6000
|
+
blockers: [],
|
|
6001
|
+
blocks: []
|
|
6002
|
+
});
|
|
6003
|
+
for (const standaloneSubmission of standaloneSubmissions) {
|
|
6004
|
+
formSubmissions[standaloneSubmission.offline_id] = standaloneSubmission;
|
|
6005
|
+
}
|
|
6006
|
+
this.dispatch(initializeFormSubmissions(Object.values(formSubmissions)));
|
|
6007
|
+
const attachments = {};
|
|
6008
|
+
const modelAttachments = await this.enqueueRequest({
|
|
6009
|
+
description: "Fetch model submission attachments",
|
|
6010
|
+
method: HttpMethod.GET,
|
|
6011
|
+
url: `/forms/in-project/${projectId}/attachments/model/latest/`,
|
|
6012
|
+
blockers: [],
|
|
6013
|
+
blocks: []
|
|
6014
|
+
});
|
|
6015
|
+
for (const modelAttachment of modelAttachments) {
|
|
6016
|
+
attachments[modelAttachment.offline_id] = modelAttachment;
|
|
6017
|
+
}
|
|
6018
|
+
const standaloneAttachments = await this.enqueueRequest({
|
|
6019
|
+
description: "Fetch standalone submission attachments",
|
|
6020
|
+
method: HttpMethod.GET,
|
|
6021
|
+
url: `/forms/in-project/${projectId}/attachments/standalone/`,
|
|
5902
6022
|
blockers: [],
|
|
5903
6023
|
blocks: []
|
|
5904
6024
|
});
|
|
5905
|
-
|
|
6025
|
+
for (const standaloneAttachent of standaloneAttachments) {
|
|
6026
|
+
attachments[standaloneAttachent.offline_id] = standaloneAttachent;
|
|
6027
|
+
}
|
|
6028
|
+
this.dispatch(initializeFormSubmissionAttachments(Object.values(attachments)));
|
|
5906
6029
|
}
|
|
5907
6030
|
}
|
|
5908
6031
|
class WorkspaceService extends BaseApiService {
|
|
@@ -5954,22 +6077,22 @@ var __publicField = (obj, key, value) => {
|
|
|
5954
6077
|
});
|
|
5955
6078
|
return [workspace, promise];
|
|
5956
6079
|
}
|
|
5957
|
-
delete(
|
|
6080
|
+
delete(workspaceId) {
|
|
5958
6081
|
const { store } = this.client;
|
|
5959
|
-
const originalWorkspace = selectWorkspaceById(
|
|
5960
|
-
|
|
5961
|
-
throw new Error(`Expected an existing workspace with id ${id}`);
|
|
5962
|
-
}
|
|
5963
|
-
this.dispatch(deleteWorkspace(id));
|
|
6082
|
+
const originalWorkspace = selectWorkspaceById(workspaceId)(store.getState());
|
|
6083
|
+
this.dispatch(deleteWorkspace(workspaceId));
|
|
5964
6084
|
const promise = this.enqueueRequest({
|
|
5965
6085
|
description: "Delete Workspace",
|
|
5966
6086
|
method: HttpMethod.DELETE,
|
|
5967
|
-
url: `/workspaces/${
|
|
5968
|
-
blockers: [
|
|
6087
|
+
url: `/workspaces/${workspaceId}/`,
|
|
6088
|
+
blockers: [workspaceId],
|
|
5969
6089
|
blocks: []
|
|
5970
6090
|
});
|
|
5971
|
-
void promise.
|
|
5972
|
-
|
|
6091
|
+
void promise.then(() => {
|
|
6092
|
+
}).catch((reason) => {
|
|
6093
|
+
if (originalWorkspace) {
|
|
6094
|
+
this.dispatch(addWorkspace(originalWorkspace));
|
|
6095
|
+
}
|
|
5973
6096
|
throw reason;
|
|
5974
6097
|
});
|
|
5975
6098
|
return promise;
|
|
@@ -6604,8 +6727,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6604
6727
|
class DocumentAttachmentService extends BaseAttachmentService {
|
|
6605
6728
|
constructor() {
|
|
6606
6729
|
super(...arguments);
|
|
6607
|
-
__publicField(this, "
|
|
6608
|
-
__publicField(this, "
|
|
6730
|
+
__publicField(this, "attachmentModel", AttachmentModel.Document);
|
|
6731
|
+
__publicField(this, "initializeAttachments", initializeDocumentAttachments);
|
|
6609
6732
|
__publicField(this, "addAttachments", addDocumentAttachments);
|
|
6610
6733
|
__publicField(this, "updateAttachments", updateDocumentAttachments);
|
|
6611
6734
|
__publicField(this, "removeAttachments", deleteDocumentAttachments);
|
|
@@ -6616,23 +6739,17 @@ var __publicField = (obj, key, value) => {
|
|
|
6616
6739
|
buildOfflineAttachment(data) {
|
|
6617
6740
|
return offline({
|
|
6618
6741
|
file: URL.createObjectURL(data.file),
|
|
6619
|
-
file_sha1: data.
|
|
6620
|
-
created_by: data.
|
|
6742
|
+
file_sha1: data.sha1,
|
|
6743
|
+
created_by: data.createdBy,
|
|
6621
6744
|
file_name: data.file.name,
|
|
6622
6745
|
file_type: data.file.type,
|
|
6623
|
-
submitted_at: data.
|
|
6746
|
+
submitted_at: data.submittedAt,
|
|
6624
6747
|
description: data.description,
|
|
6625
6748
|
document: data.modelId
|
|
6626
6749
|
});
|
|
6627
6750
|
}
|
|
6628
|
-
buildAttachmentPayload(data) {
|
|
6629
|
-
return {
|
|
6630
|
-
...data,
|
|
6631
|
-
document: data.modelId
|
|
6632
|
-
};
|
|
6633
|
-
}
|
|
6634
6751
|
// NOTE: overriding the method from BaseAttachmentService since document attachments get vectorized
|
|
6635
|
-
async
|
|
6752
|
+
async attachFilesToDocument(files, documentId) {
|
|
6636
6753
|
var _a2;
|
|
6637
6754
|
const { store } = this.client;
|
|
6638
6755
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
@@ -6641,36 +6758,40 @@ var __publicField = (obj, key, value) => {
|
|
|
6641
6758
|
const attachmentPayloads = [];
|
|
6642
6759
|
const filePayloads = {};
|
|
6643
6760
|
const sha1ToAttachmentIds = {};
|
|
6644
|
-
for (const
|
|
6645
|
-
const
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6761
|
+
for (const file of files) {
|
|
6762
|
+
const sha1 = await hashFile(file);
|
|
6763
|
+
if (!(sha1 in filePayloads)) {
|
|
6764
|
+
filePayloads[sha1] = {
|
|
6765
|
+
sha1,
|
|
6766
|
+
file_type: file.type,
|
|
6767
|
+
extension: file.name.split(".").pop(),
|
|
6768
|
+
size: file.size
|
|
6769
|
+
};
|
|
6770
|
+
sha1ToAttachmentIds[sha1] = [];
|
|
6771
|
+
await this.client.files.addCache(file, sha1);
|
|
6650
6772
|
}
|
|
6651
6773
|
const offlineAttachment = this.buildOfflineAttachment({
|
|
6652
6774
|
file,
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6775
|
+
sha1,
|
|
6776
|
+
submittedAt,
|
|
6777
|
+
createdBy,
|
|
6656
6778
|
description: "",
|
|
6657
6779
|
modelId: documentId
|
|
6658
6780
|
});
|
|
6659
6781
|
offlineAttachments.push(offlineAttachment);
|
|
6660
6782
|
attachmentPayloads.push({
|
|
6661
6783
|
offline_id: offlineAttachment.offline_id,
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
file_extension: filePayload.extension,
|
|
6784
|
+
name: offlineAttachment.file_name,
|
|
6785
|
+
sha1: offlineAttachment.file_sha1,
|
|
6665
6786
|
description: offlineAttachment.description
|
|
6666
6787
|
});
|
|
6667
|
-
sha1ToAttachmentIds[
|
|
6788
|
+
sha1ToAttachmentIds[sha1].push(offlineAttachment.offline_id);
|
|
6668
6789
|
}
|
|
6669
6790
|
this.dispatch(this.addAttachments(offlineAttachments));
|
|
6670
6791
|
const promise = this.enqueueRequest({
|
|
6671
6792
|
description: "Attach files to document",
|
|
6672
6793
|
method: HttpMethod.POST,
|
|
6673
|
-
url:
|
|
6794
|
+
url: `/documents/${documentId}/attach/`,
|
|
6674
6795
|
payload: {
|
|
6675
6796
|
submitted_at: submittedAt,
|
|
6676
6797
|
attachments: attachmentPayloads,
|
|
@@ -6695,14 +6816,14 @@ var __publicField = (obj, key, value) => {
|
|
|
6695
6816
|
});
|
|
6696
6817
|
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
6697
6818
|
}
|
|
6698
|
-
async
|
|
6699
|
-
return this.
|
|
6819
|
+
async deleteDocumentAttachment(attachmentId) {
|
|
6820
|
+
return this.deleteAttachment(attachmentId);
|
|
6700
6821
|
}
|
|
6701
6822
|
makeReadable(attachmnentId) {
|
|
6702
6823
|
void this.enqueueRequest({
|
|
6703
6824
|
description: "Add attachment to AI assistant",
|
|
6704
6825
|
method: HttpMethod.PATCH,
|
|
6705
|
-
url: `/
|
|
6826
|
+
url: `/documents/attachments/${attachmnentId}/`,
|
|
6706
6827
|
payload: {
|
|
6707
6828
|
readable_to_assistant: true
|
|
6708
6829
|
},
|
|
@@ -6719,7 +6840,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6719
6840
|
blocks: [],
|
|
6720
6841
|
blockers: []
|
|
6721
6842
|
});
|
|
6722
|
-
this.dispatch(
|
|
6843
|
+
this.dispatch(this.initializeAttachments(projectDocumentAttachments));
|
|
6723
6844
|
const organizationDocumentAttachments = await this.enqueueRequest({
|
|
6724
6845
|
description: "Get document attachments",
|
|
6725
6846
|
method: HttpMethod.GET,
|
|
@@ -6854,21 +6975,21 @@ var __publicField = (obj, key, value) => {
|
|
|
6854
6975
|
});
|
|
6855
6976
|
return [offlineUpdatedTeam, promise];
|
|
6856
6977
|
}
|
|
6857
|
-
async delete(
|
|
6978
|
+
async delete(teamId) {
|
|
6858
6979
|
const { store } = this.client;
|
|
6859
6980
|
const state = store.getState();
|
|
6860
|
-
const team = selectTeamById(
|
|
6981
|
+
const team = selectTeamById(teamId)(state);
|
|
6861
6982
|
if (!team) {
|
|
6862
|
-
throw new Error(`Expected team with id ${
|
|
6983
|
+
throw new Error(`Expected team with id ${teamId} to exist`);
|
|
6863
6984
|
}
|
|
6864
|
-
this.dispatch(deleteTeam(
|
|
6985
|
+
this.dispatch(deleteTeam(teamId));
|
|
6865
6986
|
try {
|
|
6866
6987
|
return await this.enqueueRequest({
|
|
6867
6988
|
description: "Delete team",
|
|
6868
6989
|
method: HttpMethod.DELETE,
|
|
6869
|
-
url: `/organizations/teams/${
|
|
6870
|
-
blockers: [
|
|
6871
|
-
blocks: [
|
|
6990
|
+
url: `/organizations/teams/${teamId}/`,
|
|
6991
|
+
blockers: [teamId],
|
|
6992
|
+
blocks: [teamId]
|
|
6872
6993
|
});
|
|
6873
6994
|
} catch (e) {
|
|
6874
6995
|
this.dispatch(setTeam(team));
|
|
@@ -6963,11 +7084,17 @@ var __publicField = (obj, key, value) => {
|
|
|
6963
7084
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6964
7085
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
6965
7086
|
const projectId = payloadWithoutFile.project;
|
|
6966
|
-
const
|
|
7087
|
+
const sha1 = await hashFile(file);
|
|
7088
|
+
const filePayload = {
|
|
7089
|
+
sha1,
|
|
7090
|
+
file_type: file.type,
|
|
7091
|
+
extension: file.name.split(".").pop(),
|
|
7092
|
+
size: file.size
|
|
7093
|
+
};
|
|
6967
7094
|
const offlineMapImage = offline({
|
|
6968
7095
|
...payloadWithoutFile,
|
|
6969
7096
|
file_name: file.name,
|
|
6970
|
-
file_sha1:
|
|
7097
|
+
file_sha1: sha1,
|
|
6971
7098
|
file: URL.createObjectURL(file),
|
|
6972
7099
|
submitted_at: submittedAt,
|
|
6973
7100
|
created_by: createdBy
|
|
@@ -7010,16 +7137,23 @@ var __publicField = (obj, key, value) => {
|
|
|
7010
7137
|
const offlineGeoImages = [];
|
|
7011
7138
|
const offlineIds = [];
|
|
7012
7139
|
const geoImagePayloads = [];
|
|
7013
|
-
const
|
|
7140
|
+
const filePayloadRecord = {};
|
|
7014
7141
|
for (const payloadAndFile of payloads) {
|
|
7015
7142
|
const { file, ...payload } = payloadAndFile;
|
|
7016
|
-
const
|
|
7017
|
-
if (!(
|
|
7018
|
-
|
|
7143
|
+
const sha1 = await hashFile(file);
|
|
7144
|
+
if (!(sha1 in filePayloadRecord)) {
|
|
7145
|
+
filePayloadRecord[sha1] = {
|
|
7146
|
+
sha1,
|
|
7147
|
+
file_type: file.type,
|
|
7148
|
+
extension: file.name.split(".").pop(),
|
|
7149
|
+
size: file.size
|
|
7150
|
+
};
|
|
7151
|
+
await this.client.files.addCache(file, sha1);
|
|
7152
|
+
}
|
|
7019
7153
|
const offlineMapImage = offline({
|
|
7020
7154
|
...payload,
|
|
7021
7155
|
file_name: file.name,
|
|
7022
|
-
file_sha1:
|
|
7156
|
+
file_sha1: sha1,
|
|
7023
7157
|
file: URL.createObjectURL(file),
|
|
7024
7158
|
submitted_at: submittedAt,
|
|
7025
7159
|
created_by: createdBy,
|
|
@@ -7048,7 +7182,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7048
7182
|
submitted_at: submittedAt,
|
|
7049
7183
|
project: projectId,
|
|
7050
7184
|
geo_images: geoImagePayloads,
|
|
7051
|
-
files: Object.values(
|
|
7185
|
+
files: Object.values(filePayloadRecord)
|
|
7052
7186
|
},
|
|
7053
7187
|
blocks: [projectId.toString()],
|
|
7054
7188
|
blockers: offlineIds
|
|
@@ -7085,20 +7219,20 @@ var __publicField = (obj, key, value) => {
|
|
|
7085
7219
|
});
|
|
7086
7220
|
return [updatedGeoImage, promise];
|
|
7087
7221
|
}
|
|
7088
|
-
async delete(
|
|
7222
|
+
async delete(geoImageId) {
|
|
7089
7223
|
const { store } = this.client;
|
|
7090
7224
|
const state = store.getState();
|
|
7091
|
-
const geoImageToDelete = selectGeoImageById(
|
|
7225
|
+
const geoImageToDelete = selectGeoImageById(geoImageId)(state);
|
|
7092
7226
|
if (!geoImageToDelete) {
|
|
7093
|
-
throw new Error(`Map image with offline_id ${
|
|
7227
|
+
throw new Error(`Map image with offline_id ${geoImageId} does not exist in the store`);
|
|
7094
7228
|
}
|
|
7095
|
-
this.dispatch(deleteGeoImage(
|
|
7229
|
+
this.dispatch(deleteGeoImage(geoImageId));
|
|
7096
7230
|
const promise = this.enqueueRequest({
|
|
7097
7231
|
description: "Delete geo image",
|
|
7098
7232
|
method: HttpMethod.DELETE,
|
|
7099
|
-
url: `/geo-images/${
|
|
7100
|
-
blocks: [
|
|
7101
|
-
blockers: [
|
|
7233
|
+
url: `/geo-images/${geoImageId}/`,
|
|
7234
|
+
blocks: [geoImageId],
|
|
7235
|
+
blockers: [geoImageId]
|
|
7102
7236
|
});
|
|
7103
7237
|
promise.catch(() => {
|
|
7104
7238
|
this.dispatch(setGeoImage(geoImageToDelete));
|
|
@@ -7116,7 +7250,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7116
7250
|
this.dispatch(initializeGeoImages(result));
|
|
7117
7251
|
}
|
|
7118
7252
|
}
|
|
7119
|
-
class IssueAssociationService extends
|
|
7253
|
+
class IssueAssociationService extends BaseUploadService {
|
|
7120
7254
|
add(payload) {
|
|
7121
7255
|
var _a2;
|
|
7122
7256
|
const { store } = this.client;
|
|
@@ -7131,7 +7265,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7131
7265
|
const promise = this.enqueueRequest({
|
|
7132
7266
|
description: "Add issue association",
|
|
7133
7267
|
method: HttpMethod.POST,
|
|
7134
|
-
url: "/
|
|
7268
|
+
url: "/issues/associations/",
|
|
7135
7269
|
payload: {
|
|
7136
7270
|
offline_id: offlineIssueAssociation.offline_id,
|
|
7137
7271
|
submitted_at: submittedAt,
|
|
@@ -7161,7 +7295,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7161
7295
|
const promise = this.enqueueRequest({
|
|
7162
7296
|
description: "Delete issue association",
|
|
7163
7297
|
method: HttpMethod.DELETE,
|
|
7164
|
-
url: `/
|
|
7298
|
+
url: `/issues/associations/${id}/`,
|
|
7165
7299
|
blockers: [id],
|
|
7166
7300
|
blocks: []
|
|
7167
7301
|
});
|
|
@@ -7174,938 +7308,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7174
7308
|
const issueAssociations = await this.enqueueRequest({
|
|
7175
7309
|
description: "Fetch issue associations",
|
|
7176
7310
|
method: HttpMethod.GET,
|
|
7177
|
-
url: "/
|
|
7178
|
-
queryParams: {
|
|
7311
|
+
url: "/issues/associations/",
|
|
7312
|
+
queryParams: { project_id: projectId.toString() },
|
|
7179
7313
|
blockers: [],
|
|
7180
7314
|
blocks: []
|
|
7181
7315
|
});
|
|
7182
7316
|
this.dispatch(initializeIssueAssociations(issueAssociations));
|
|
7183
7317
|
}
|
|
7184
7318
|
}
|
|
7185
|
-
class FormRevisionAttachmentService extends BaseUploadService {
|
|
7186
|
-
async bulkAdd(payloads) {
|
|
7187
|
-
var _a2;
|
|
7188
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7189
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7190
|
-
const filePayloads = {};
|
|
7191
|
-
const offlineFormRevisionAttachments = [];
|
|
7192
|
-
const attachmentPayloads = [];
|
|
7193
|
-
for (const payload of payloads) {
|
|
7194
|
-
const { revisionId, fieldIdentifier, file } = payload;
|
|
7195
|
-
const filePayload = await this.getFilePayload(file);
|
|
7196
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7197
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7198
|
-
const offlineFormRevisionAttachment = offline({
|
|
7199
|
-
file: URL.createObjectURL(file),
|
|
7200
|
-
file_type: file.type,
|
|
7201
|
-
file_name: file.name,
|
|
7202
|
-
file_sha1: filePayload.sha1,
|
|
7203
|
-
created_by: createdBy,
|
|
7204
|
-
form_revision: revisionId,
|
|
7205
|
-
submitted_at: submittedAt,
|
|
7206
|
-
field_identifier: fieldIdentifier
|
|
7207
|
-
});
|
|
7208
|
-
offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
|
|
7209
|
-
const attachmentPayload = {
|
|
7210
|
-
offline_id: offlineFormRevisionAttachment.offline_id,
|
|
7211
|
-
file_name: file.name,
|
|
7212
|
-
field_identifier: fieldIdentifier,
|
|
7213
|
-
file_extension: filePayload.extension,
|
|
7214
|
-
file_sha1: filePayload.sha1,
|
|
7215
|
-
form_revision: revisionId
|
|
7216
|
-
};
|
|
7217
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7218
|
-
}
|
|
7219
|
-
this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
|
|
7220
|
-
const promise = this.enqueueRequest({
|
|
7221
|
-
description: "Attach files to form revision",
|
|
7222
|
-
method: HttpMethod.POST,
|
|
7223
|
-
url: "/form-revision-attachments/bulk/",
|
|
7224
|
-
payload: {
|
|
7225
|
-
submitted_at: submittedAt,
|
|
7226
|
-
attachments: attachmentPayloads,
|
|
7227
|
-
files: Object.values(filePayloads)
|
|
7228
|
-
},
|
|
7229
|
-
blockers: offlineFormRevisionAttachments.map((attachment) => attachment.form_revision),
|
|
7230
|
-
blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
7231
|
-
});
|
|
7232
|
-
promise.then((result) => {
|
|
7233
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
7234
|
-
this.dispatch(updateFormRevisionAttachments(result.attachments));
|
|
7235
|
-
}).catch(() => {
|
|
7236
|
-
this.dispatch(
|
|
7237
|
-
deleteFormRevisionAttachments(
|
|
7238
|
-
offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
7239
|
-
)
|
|
7240
|
-
);
|
|
7241
|
-
});
|
|
7242
|
-
return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
|
|
7243
|
-
}
|
|
7244
|
-
async refreshStore(projectId, organizationId) {
|
|
7245
|
-
let attachments = [];
|
|
7246
|
-
const projectFormRevisions = await this.enqueueRequest({
|
|
7247
|
-
description: "Fetch project form revision attachments",
|
|
7248
|
-
method: HttpMethod.GET,
|
|
7249
|
-
url: "/form-revision-attachments/",
|
|
7250
|
-
queryParams: {
|
|
7251
|
-
project: projectId.toString()
|
|
7252
|
-
},
|
|
7253
|
-
blockers: [projectId.toString()],
|
|
7254
|
-
blocks: []
|
|
7255
|
-
});
|
|
7256
|
-
attachments = attachments.concat(projectFormRevisions);
|
|
7257
|
-
const organizationFormRevisions = await this.enqueueRequest({
|
|
7258
|
-
description: "Fetch organization form revision attachments",
|
|
7259
|
-
method: HttpMethod.GET,
|
|
7260
|
-
url: "/form-revision-attachments/",
|
|
7261
|
-
queryParams: {
|
|
7262
|
-
organization: organizationId.toString()
|
|
7263
|
-
},
|
|
7264
|
-
blockers: [organizationId.toString()],
|
|
7265
|
-
blocks: []
|
|
7266
|
-
});
|
|
7267
|
-
attachments = attachments.concat(organizationFormRevisions);
|
|
7268
|
-
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
7269
|
-
}
|
|
7270
|
-
}
|
|
7271
|
-
class FormSubmissionAttachmentService extends BaseUploadService {
|
|
7272
|
-
async bulkAdd(payloads) {
|
|
7273
|
-
var _a2;
|
|
7274
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7275
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7276
|
-
const filePayloads = {};
|
|
7277
|
-
const offlineFormSubmissionAttachments = [];
|
|
7278
|
-
const attachmentPayloads = [];
|
|
7279
|
-
for (const payload of payloads) {
|
|
7280
|
-
const { submissionId, fieldIdentifier, file } = payload;
|
|
7281
|
-
const filePayload = await this.getFilePayload(file);
|
|
7282
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7283
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7284
|
-
const offlineFormSubmissionAttachment = offline({
|
|
7285
|
-
file: URL.createObjectURL(file),
|
|
7286
|
-
file_type: file.type,
|
|
7287
|
-
file_name: file.name,
|
|
7288
|
-
file_sha1: filePayload.sha1,
|
|
7289
|
-
created_by: createdBy,
|
|
7290
|
-
form_submission: submissionId,
|
|
7291
|
-
submitted_at: submittedAt,
|
|
7292
|
-
field_identifier: fieldIdentifier
|
|
7293
|
-
});
|
|
7294
|
-
offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
|
|
7295
|
-
const attachmentPayload = {
|
|
7296
|
-
offline_id: offlineFormSubmissionAttachment.offline_id,
|
|
7297
|
-
file_name: file.name,
|
|
7298
|
-
file_sha1: filePayload.sha1,
|
|
7299
|
-
file_extension: filePayload.extension,
|
|
7300
|
-
field_identifier: fieldIdentifier,
|
|
7301
|
-
form_submission: submissionId
|
|
7302
|
-
};
|
|
7303
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7304
|
-
}
|
|
7305
|
-
this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
|
|
7306
|
-
const promise = this.enqueueRequest({
|
|
7307
|
-
description: "Attach files to form submission",
|
|
7308
|
-
method: HttpMethod.POST,
|
|
7309
|
-
url: "/form-submission-attachments/bulk/",
|
|
7310
|
-
payload: {
|
|
7311
|
-
submitted_at: submittedAt,
|
|
7312
|
-
attachments: attachmentPayloads,
|
|
7313
|
-
files: Object.values(filePayloads)
|
|
7314
|
-
},
|
|
7315
|
-
blockers: offlineFormSubmissionAttachments.map((attachment) => attachment.form_submission),
|
|
7316
|
-
blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
7317
|
-
});
|
|
7318
|
-
promise.then((result) => {
|
|
7319
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
7320
|
-
this.dispatch(updateFormSubmissionAttachments(result.attachments));
|
|
7321
|
-
}).catch((error) => {
|
|
7322
|
-
this.dispatch(
|
|
7323
|
-
deleteFormSubmissionAttachments(
|
|
7324
|
-
offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
7325
|
-
)
|
|
7326
|
-
);
|
|
7327
|
-
throw error;
|
|
7328
|
-
});
|
|
7329
|
-
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
7330
|
-
}
|
|
7331
|
-
async bulkDelete(attachmentsIds) {
|
|
7332
|
-
const { store } = this.client;
|
|
7333
|
-
const state = store.getState();
|
|
7334
|
-
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
7335
|
-
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
7336
|
-
try {
|
|
7337
|
-
await this.enqueueRequest({
|
|
7338
|
-
description: "Delete form submission attachments",
|
|
7339
|
-
method: HttpMethod.DELETE,
|
|
7340
|
-
url: "/form-submission-attachments/bulk/",
|
|
7341
|
-
payload: { attachment_ids: attachmentsIds },
|
|
7342
|
-
blockers: attachmentsIds,
|
|
7343
|
-
blocks: []
|
|
7344
|
-
});
|
|
7345
|
-
} catch (e) {
|
|
7346
|
-
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7347
|
-
throw e;
|
|
7348
|
-
}
|
|
7349
|
-
}
|
|
7350
|
-
async refreshStore(projectId) {
|
|
7351
|
-
const result = await this.enqueueRequest({
|
|
7352
|
-
description: "Get form submission attachments",
|
|
7353
|
-
method: HttpMethod.GET,
|
|
7354
|
-
url: "/form-submission-attachments/",
|
|
7355
|
-
queryParams: {
|
|
7356
|
-
project: projectId.toString()
|
|
7357
|
-
},
|
|
7358
|
-
blockers: [],
|
|
7359
|
-
blocks: []
|
|
7360
|
-
});
|
|
7361
|
-
this.dispatch(initializeFormSubmissionAttachments(result));
|
|
7362
|
-
}
|
|
7363
|
-
}
|
|
7364
|
-
class FormRevisionService extends BaseUploadService {
|
|
7365
|
-
add(payload) {
|
|
7366
|
-
var _a2;
|
|
7367
|
-
const { store } = this.client;
|
|
7368
|
-
const state = store.getState();
|
|
7369
|
-
const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7370
|
-
const offlineFormRevision = offline({
|
|
7371
|
-
...payload,
|
|
7372
|
-
created_by: createdBy,
|
|
7373
|
-
revision: "Pending",
|
|
7374
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7375
|
-
});
|
|
7376
|
-
this.dispatch(addFormRevision(offlineFormRevision));
|
|
7377
|
-
const promise = this.enqueueRequest({
|
|
7378
|
-
description: "Create form revision",
|
|
7379
|
-
method: HttpMethod.POST,
|
|
7380
|
-
url: "/form-revisions/",
|
|
7381
|
-
payload: offlineFormRevision,
|
|
7382
|
-
blockers: [payload.form],
|
|
7383
|
-
blocks: [offlineFormRevision.offline_id]
|
|
7384
|
-
});
|
|
7385
|
-
void promise.then((result) => {
|
|
7386
|
-
this.dispatch(setFormRevision(result));
|
|
7387
|
-
}).catch(() => {
|
|
7388
|
-
this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
|
|
7389
|
-
});
|
|
7390
|
-
return [offlineFormRevision, promise];
|
|
7391
|
-
}
|
|
7392
|
-
async refreshStore(projectId, organizationId) {
|
|
7393
|
-
let formRevisions = [];
|
|
7394
|
-
const projectFormRevisions = await this.enqueueRequest({
|
|
7395
|
-
description: "Fetch project form revisions",
|
|
7396
|
-
method: HttpMethod.GET,
|
|
7397
|
-
url: "/form-revisions/",
|
|
7398
|
-
queryParams: {
|
|
7399
|
-
project: projectId.toString()
|
|
7400
|
-
},
|
|
7401
|
-
blockers: [projectId.toString()],
|
|
7402
|
-
blocks: []
|
|
7403
|
-
});
|
|
7404
|
-
formRevisions = formRevisions.concat(projectFormRevisions);
|
|
7405
|
-
const organizationFormRevisions = await this.enqueueRequest({
|
|
7406
|
-
description: "Fetch organization form revisions",
|
|
7407
|
-
method: HttpMethod.GET,
|
|
7408
|
-
url: "/form-revisions/",
|
|
7409
|
-
queryParams: {
|
|
7410
|
-
organization: organizationId.toString()
|
|
7411
|
-
},
|
|
7412
|
-
blockers: [organizationId.toString()],
|
|
7413
|
-
blocks: []
|
|
7414
|
-
});
|
|
7415
|
-
formRevisions = formRevisions.concat(organizationFormRevisions);
|
|
7416
|
-
this.dispatch(initializeFormRevisions(formRevisions));
|
|
7417
|
-
}
|
|
7418
|
-
}
|
|
7419
|
-
class AssetTypeFieldsAttachmentService extends BaseUploadService {
|
|
7420
|
-
async bulkAdd(payloads) {
|
|
7421
|
-
var _a2;
|
|
7422
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7423
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7424
|
-
const filePayloads = {};
|
|
7425
|
-
const offlineAssetTypeFieldsAttachments = [];
|
|
7426
|
-
const attachmentPayloads = [];
|
|
7427
|
-
for (const payload of payloads) {
|
|
7428
|
-
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7429
|
-
const filePayload = await this.getFilePayload(file);
|
|
7430
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7431
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7432
|
-
const offlineAssetTypeFieldsAttachment = offline({
|
|
7433
|
-
file: URL.createObjectURL(file),
|
|
7434
|
-
file_type: file.type,
|
|
7435
|
-
file_name: file.name,
|
|
7436
|
-
file_sha1: filePayload.sha1,
|
|
7437
|
-
created_by: createdBy,
|
|
7438
|
-
fields_revision: fieldsRevisionId,
|
|
7439
|
-
submitted_at: submittedAt,
|
|
7440
|
-
field_identifier: fieldIdentifier
|
|
7441
|
-
});
|
|
7442
|
-
offlineAssetTypeFieldsAttachments.push(offlineAssetTypeFieldsAttachment);
|
|
7443
|
-
const attachmentPayload = {
|
|
7444
|
-
offline_id: offlineAssetTypeFieldsAttachment.offline_id,
|
|
7445
|
-
file_name: file.name,
|
|
7446
|
-
field_identifier: fieldIdentifier,
|
|
7447
|
-
file_extension: filePayload.extension,
|
|
7448
|
-
file_sha1: filePayload.sha1,
|
|
7449
|
-
fields_revision: fieldsRevisionId
|
|
7450
|
-
};
|
|
7451
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7452
|
-
}
|
|
7453
|
-
this.dispatch(addAssetTypeFieldsAttachments(offlineAssetTypeFieldsAttachments));
|
|
7454
|
-
const promise = this.enqueueRequest({
|
|
7455
|
-
description: "Add asset type fields attachments",
|
|
7456
|
-
method: HttpMethod.POST,
|
|
7457
|
-
url: "/asset-type-fields-attachments/bulk/",
|
|
7458
|
-
payload: {
|
|
7459
|
-
submitted_at: submittedAt,
|
|
7460
|
-
attachments: attachmentPayloads,
|
|
7461
|
-
files: Object.values(filePayloads)
|
|
7462
|
-
},
|
|
7463
|
-
blockers: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
|
|
7464
|
-
blocks: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7465
|
-
});
|
|
7466
|
-
promise.then((result) => {
|
|
7467
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
7468
|
-
this.dispatch(updateAssetTypeFieldsAttachments(result.attachments));
|
|
7469
|
-
}).catch(() => {
|
|
7470
|
-
this.dispatch(
|
|
7471
|
-
deleteAssetTypeFieldsAttachments(
|
|
7472
|
-
offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7473
|
-
)
|
|
7474
|
-
);
|
|
7475
|
-
});
|
|
7476
|
-
return [offlineAssetTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
|
|
7477
|
-
}
|
|
7478
|
-
async refreshStore(projectId) {
|
|
7479
|
-
const result = await this.enqueueRequest({
|
|
7480
|
-
description: "get asset type fields attachments",
|
|
7481
|
-
method: HttpMethod.GET,
|
|
7482
|
-
url: "/asset-type-fields-attachments/",
|
|
7483
|
-
queryParams: {
|
|
7484
|
-
project: projectId.toString()
|
|
7485
|
-
},
|
|
7486
|
-
blockers: [projectId.toString()],
|
|
7487
|
-
blocks: []
|
|
7488
|
-
});
|
|
7489
|
-
this.dispatch(initializeAssetTypeFieldsAttachments(result));
|
|
7490
|
-
}
|
|
7491
|
-
}
|
|
7492
|
-
class AssetTypeFieldsService extends BaseApiService {
|
|
7493
|
-
add(payload) {
|
|
7494
|
-
var _a2;
|
|
7495
|
-
const { store } = this.client;
|
|
7496
|
-
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7497
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7498
|
-
const offlineAssetTypeFields = offline({
|
|
7499
|
-
...payload,
|
|
7500
|
-
created_by: createdBy,
|
|
7501
|
-
submitted_at: submittedAt
|
|
7502
|
-
});
|
|
7503
|
-
this.dispatch(addAssetTypeFields(offlineAssetTypeFields));
|
|
7504
|
-
const promise = this.enqueueRequest({
|
|
7505
|
-
description: "Add Asset Type Fields",
|
|
7506
|
-
method: HttpMethod.POST,
|
|
7507
|
-
url: "/asset-type-fields/",
|
|
7508
|
-
payload: offlineAssetTypeFields,
|
|
7509
|
-
blockers: [offlineAssetTypeFields.asset_type],
|
|
7510
|
-
blocks: [offlineAssetTypeFields.offline_id]
|
|
7511
|
-
});
|
|
7512
|
-
promise.then((response) => {
|
|
7513
|
-
this.dispatch(updateAssetTypeFields(response));
|
|
7514
|
-
}).catch((error) => {
|
|
7515
|
-
this.dispatch(deleteAssetTypeFields(offlineAssetTypeFields.offline_id));
|
|
7516
|
-
throw error;
|
|
7517
|
-
});
|
|
7518
|
-
return [offlineAssetTypeFields, promise];
|
|
7519
|
-
}
|
|
7520
|
-
async refreshStore(projectId) {
|
|
7521
|
-
const result = await this.enqueueRequest({
|
|
7522
|
-
description: "Get Asset Type Fields",
|
|
7523
|
-
method: HttpMethod.GET,
|
|
7524
|
-
url: "/asset-type-fields/",
|
|
7525
|
-
queryParams: {
|
|
7526
|
-
project: projectId.toString()
|
|
7527
|
-
},
|
|
7528
|
-
blockers: [],
|
|
7529
|
-
blocks: []
|
|
7530
|
-
});
|
|
7531
|
-
this.dispatch(initializeAssetTypeFields(result));
|
|
7532
|
-
}
|
|
7533
|
-
}
|
|
7534
|
-
class AssetTypeFieldValuesService extends BaseApiService {
|
|
7535
|
-
add(payload) {
|
|
7536
|
-
var _a2;
|
|
7537
|
-
const { store } = this.client;
|
|
7538
|
-
const state = store.getState();
|
|
7539
|
-
const { values } = separateFilesFromValues(payload.values);
|
|
7540
|
-
const offlineAssetTypeFieldValues = offline({
|
|
7541
|
-
...payload,
|
|
7542
|
-
values,
|
|
7543
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7544
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7545
|
-
});
|
|
7546
|
-
const promise = this.enqueueRequest({
|
|
7547
|
-
description: "Add asset type field values",
|
|
7548
|
-
method: HttpMethod.POST,
|
|
7549
|
-
url: "/asset-type-field-values/",
|
|
7550
|
-
payload: offlineAssetTypeFieldValues,
|
|
7551
|
-
blockers: [payload.asset, payload.fields_revision],
|
|
7552
|
-
blocks: [offlineAssetTypeFieldValues.offline_id]
|
|
7553
|
-
});
|
|
7554
|
-
this.dispatch(addAssetTypeFieldValues(offlineAssetTypeFieldValues));
|
|
7555
|
-
promise.then((result) => {
|
|
7556
|
-
this.dispatch(updateAssetTypeFieldValues(result));
|
|
7557
|
-
return result;
|
|
7558
|
-
}).catch(() => {
|
|
7559
|
-
this.dispatch(deleteAssetTypeFieldValues(offlineAssetTypeFieldValues.offline_id));
|
|
7560
|
-
});
|
|
7561
|
-
return [offlineAssetTypeFieldValues, promise];
|
|
7562
|
-
}
|
|
7563
|
-
bulkAdd(payload, batchSize) {
|
|
7564
|
-
var _a2;
|
|
7565
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7566
|
-
const { values } = separateFilesFromValues(payload.values);
|
|
7567
|
-
const offlineAssetTypeFieldValuesMany = [];
|
|
7568
|
-
const batches = chunkArray(payload.payloads, batchSize ?? payload.payloads.length);
|
|
7569
|
-
const batchPayloads = [];
|
|
7570
|
-
for (const batch of batches) {
|
|
7571
|
-
const assetTypeFieldValuesPayloads = [];
|
|
7572
|
-
for (const payload2 of batch) {
|
|
7573
|
-
const offlineAssetTypeFieldValues = offline({
|
|
7574
|
-
...payload2,
|
|
7575
|
-
values: separateFilesFromValues(payload2.values).values,
|
|
7576
|
-
created_by: (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7577
|
-
submitted_at: submittedAt
|
|
7578
|
-
});
|
|
7579
|
-
offlineAssetTypeFieldValuesMany.push(offlineAssetTypeFieldValues);
|
|
7580
|
-
assetTypeFieldValuesPayloads.push({
|
|
7581
|
-
offline_id: offlineAssetTypeFieldValues.offline_id,
|
|
7582
|
-
asset: payload2.asset,
|
|
7583
|
-
fields_revision: payload2.fields_revision,
|
|
7584
|
-
published_at: payload2.published_at,
|
|
7585
|
-
values: offlineAssetTypeFieldValues.values
|
|
7586
|
-
});
|
|
7587
|
-
}
|
|
7588
|
-
batchPayloads.push({
|
|
7589
|
-
submitted_at: submittedAt,
|
|
7590
|
-
values,
|
|
7591
|
-
field_values: assetTypeFieldValuesPayloads
|
|
7592
|
-
});
|
|
7593
|
-
}
|
|
7594
|
-
this.dispatch(addAssetTypeFieldValuesMany(offlineAssetTypeFieldValuesMany));
|
|
7595
|
-
const promises = [];
|
|
7596
|
-
for (const payload2 of batchPayloads) {
|
|
7597
|
-
const assetIds = payload2.field_values.map((x) => x.asset);
|
|
7598
|
-
const assetTypeFieldsIds = payload2.field_values.map((x) => x.fields_revision);
|
|
7599
|
-
const assetTypeFieldValuesIds = payload2.field_values.map((x) => x.offline_id);
|
|
7600
|
-
const promise = this.enqueueRequest({
|
|
7601
|
-
description: "Bulk add asset type field values",
|
|
7602
|
-
method: HttpMethod.POST,
|
|
7603
|
-
url: "/asset-type-field-values/bulk/",
|
|
7604
|
-
payload: payload2,
|
|
7605
|
-
blockers: [...assetIds, ...assetTypeFieldsIds],
|
|
7606
|
-
blocks: assetTypeFieldValuesIds
|
|
7607
|
-
});
|
|
7608
|
-
promises.push(promise);
|
|
7609
|
-
}
|
|
7610
|
-
void Promise.all(promises).then((results) => {
|
|
7611
|
-
this.dispatch(updateAssetTypeFieldValuesMany(results.flat()));
|
|
7612
|
-
}).catch(() => {
|
|
7613
|
-
this.dispatch(deleteAssetTypeFieldValuesMany(offlineAssetTypeFieldValuesMany.map((x) => x.offline_id)));
|
|
7614
|
-
});
|
|
7615
|
-
return [offlineAssetTypeFieldValuesMany, promises];
|
|
7616
|
-
}
|
|
7617
|
-
update(payload) {
|
|
7618
|
-
const { store } = this.client;
|
|
7619
|
-
const state = store.getState();
|
|
7620
|
-
const assetTypeFieldValues = selectAssetTypeFieldValuesById(payload.offline_id)(state);
|
|
7621
|
-
if (!assetTypeFieldValues) {
|
|
7622
|
-
throw new Error(`Expected AssetTypeFieldValues with offline_id ${payload.offline_id} to exist`);
|
|
7623
|
-
}
|
|
7624
|
-
const { values } = separateFilesFromValues(payload.values ?? {});
|
|
7625
|
-
const updatedAssetTypeFieldValues = {
|
|
7626
|
-
...assetTypeFieldValues,
|
|
7627
|
-
...payload,
|
|
7628
|
-
// values could also have a partial update
|
|
7629
|
-
values: {
|
|
7630
|
-
...assetTypeFieldValues.values,
|
|
7631
|
-
...values
|
|
7632
|
-
}
|
|
7633
|
-
};
|
|
7634
|
-
this.dispatch(updateAssetTypeFieldValues(updatedAssetTypeFieldValues));
|
|
7635
|
-
const promise = this.enqueueRequest({
|
|
7636
|
-
description: "Delete asset type field values",
|
|
7637
|
-
method: HttpMethod.PATCH,
|
|
7638
|
-
url: `/asset-type-field-values/${payload.offline_id}/`,
|
|
7639
|
-
payload,
|
|
7640
|
-
blockers: [
|
|
7641
|
-
updatedAssetTypeFieldValues.offline_id,
|
|
7642
|
-
updatedAssetTypeFieldValues.fields_revision,
|
|
7643
|
-
updatedAssetTypeFieldValues.asset
|
|
7644
|
-
],
|
|
7645
|
-
blocks: [updatedAssetTypeFieldValues.offline_id]
|
|
7646
|
-
});
|
|
7647
|
-
promise.then((result) => {
|
|
7648
|
-
this.dispatch(updateAssetTypeFieldValues(result));
|
|
7649
|
-
}).catch(() => {
|
|
7650
|
-
this.dispatch(updateAssetTypeFieldValues(assetTypeFieldValues));
|
|
7651
|
-
});
|
|
7652
|
-
return [updatedAssetTypeFieldValues, promise];
|
|
7653
|
-
}
|
|
7654
|
-
async delete(id) {
|
|
7655
|
-
const { store } = this.client;
|
|
7656
|
-
const state = store.getState();
|
|
7657
|
-
const assetTypeFieldValues = selectAssetTypeFieldValuesById(id)(state);
|
|
7658
|
-
if (!assetTypeFieldValues) {
|
|
7659
|
-
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
7660
|
-
}
|
|
7661
|
-
const assetTypeFieldValuesAttachments = selectAttachmentsOfAssetTypeFieldValues(id)(state);
|
|
7662
|
-
this.dispatch(deleteAssetTypeFieldValues(id));
|
|
7663
|
-
this.dispatch(deleteAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments.map((x) => x.offline_id)));
|
|
7664
|
-
try {
|
|
7665
|
-
await this.enqueueRequest({
|
|
7666
|
-
description: "Delete asset type field values",
|
|
7667
|
-
method: HttpMethod.DELETE,
|
|
7668
|
-
url: `/asset-type-field-values/${id}/`,
|
|
7669
|
-
blockers: [id],
|
|
7670
|
-
blocks: []
|
|
7671
|
-
});
|
|
7672
|
-
} catch (e) {
|
|
7673
|
-
this.dispatch(addAssetTypeFieldValues(assetTypeFieldValues));
|
|
7674
|
-
this.dispatch(addAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments));
|
|
7675
|
-
throw e;
|
|
7676
|
-
}
|
|
7677
|
-
}
|
|
7678
|
-
async refreshStore(projectId) {
|
|
7679
|
-
const result = await this.enqueueRequest({
|
|
7680
|
-
description: "Get asset type field values",
|
|
7681
|
-
method: HttpMethod.GET,
|
|
7682
|
-
url: "/asset-type-field-values/",
|
|
7683
|
-
queryParams: {
|
|
7684
|
-
project: projectId.toString()
|
|
7685
|
-
},
|
|
7686
|
-
blockers: [],
|
|
7687
|
-
blocks: []
|
|
7688
|
-
});
|
|
7689
|
-
this.dispatch(initializeAssetTypeFieldValues(result));
|
|
7690
|
-
}
|
|
7691
|
-
}
|
|
7692
|
-
class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7693
|
-
async bulkAdd(payloads, batchSize) {
|
|
7694
|
-
var _a2;
|
|
7695
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7696
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7697
|
-
const batches = chunkArray(payloads, batchSize ?? payloads.length);
|
|
7698
|
-
const offlineAssetTypeFieldValuesAttachments = [];
|
|
7699
|
-
const batchPayloads = [];
|
|
7700
|
-
for (const batch of batches) {
|
|
7701
|
-
const filePayloads = {};
|
|
7702
|
-
const attachmentPayloads = [];
|
|
7703
|
-
for (const payload of batch) {
|
|
7704
|
-
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7705
|
-
const filePayload = await this.getFilePayload(file);
|
|
7706
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7707
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7708
|
-
const offlineAssetTypeFieldValuesAttachment = offline({
|
|
7709
|
-
file: URL.createObjectURL(file),
|
|
7710
|
-
file_type: file.type,
|
|
7711
|
-
file_name: file.name,
|
|
7712
|
-
file_sha1: filePayload.sha1,
|
|
7713
|
-
created_by: createdBy,
|
|
7714
|
-
field_values: fieldValuesId,
|
|
7715
|
-
submitted_at: submittedAt,
|
|
7716
|
-
field_identifier: fieldIdentifier
|
|
7717
|
-
});
|
|
7718
|
-
offlineAssetTypeFieldValuesAttachments.push(offlineAssetTypeFieldValuesAttachment);
|
|
7719
|
-
const attachmentPayload = {
|
|
7720
|
-
offline_id: offlineAssetTypeFieldValuesAttachment.offline_id,
|
|
7721
|
-
file_name: file.name,
|
|
7722
|
-
file_sha1: filePayload.sha1,
|
|
7723
|
-
file_extension: filePayload.extension,
|
|
7724
|
-
field_identifier: fieldIdentifier,
|
|
7725
|
-
field_values: fieldValuesId
|
|
7726
|
-
};
|
|
7727
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7728
|
-
}
|
|
7729
|
-
batchPayloads.push({
|
|
7730
|
-
submitted_at: submittedAt,
|
|
7731
|
-
attachments: attachmentPayloads,
|
|
7732
|
-
files: Object.values(filePayloads)
|
|
7733
|
-
});
|
|
7734
|
-
}
|
|
7735
|
-
this.dispatch(addAssetTypeFieldValuesAttachments(offlineAssetTypeFieldValuesAttachments));
|
|
7736
|
-
const promises = batchPayloads.map((payload) => {
|
|
7737
|
-
return this.enqueueRequest({
|
|
7738
|
-
description: "Add asset type field values attachments",
|
|
7739
|
-
method: HttpMethod.POST,
|
|
7740
|
-
url: "/asset-type-field-values-attachments/bulk/",
|
|
7741
|
-
payload,
|
|
7742
|
-
blockers: payload.attachments.map((payload2) => payload2.field_values),
|
|
7743
|
-
blocks: payload.attachments.map((payload2) => payload2.offline_id)
|
|
7744
|
-
});
|
|
7745
|
-
});
|
|
7746
|
-
Promise.all(promises).then((result) => {
|
|
7747
|
-
for (const res of result)
|
|
7748
|
-
this.processPresignedUrls(res.presigned_urls);
|
|
7749
|
-
const attachments = result.flatMap((res) => res.attachments);
|
|
7750
|
-
this.dispatch(updateAssetTypeFieldValuesAttachments(attachments));
|
|
7751
|
-
}).catch((error) => {
|
|
7752
|
-
this.dispatch(
|
|
7753
|
-
deleteAssetTypeFieldValuesAttachments(
|
|
7754
|
-
offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7755
|
-
)
|
|
7756
|
-
);
|
|
7757
|
-
throw error;
|
|
7758
|
-
});
|
|
7759
|
-
return [
|
|
7760
|
-
offlineAssetTypeFieldValuesAttachments,
|
|
7761
|
-
promises.map((promise) => promise.then(({ attachments }) => attachments))
|
|
7762
|
-
];
|
|
7763
|
-
}
|
|
7764
|
-
async bulkDelete(ids) {
|
|
7765
|
-
const { store } = this.client;
|
|
7766
|
-
const state = store.getState();
|
|
7767
|
-
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(ids)(state);
|
|
7768
|
-
this.dispatch(deleteFormSubmissionAttachments(ids));
|
|
7769
|
-
try {
|
|
7770
|
-
await this.enqueueRequest({
|
|
7771
|
-
description: "Delete asset type field values attachments",
|
|
7772
|
-
method: HttpMethod.DELETE,
|
|
7773
|
-
url: "/asset-type-field-values-attachments/bulk/",
|
|
7774
|
-
payload: { attachment_ids: ids },
|
|
7775
|
-
blockers: ids,
|
|
7776
|
-
blocks: []
|
|
7777
|
-
});
|
|
7778
|
-
} catch (e) {
|
|
7779
|
-
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7780
|
-
throw e;
|
|
7781
|
-
}
|
|
7782
|
-
}
|
|
7783
|
-
async refreshStore(projectId) {
|
|
7784
|
-
const result = await this.enqueueRequest({
|
|
7785
|
-
description: "Get asset type field values attachments",
|
|
7786
|
-
method: HttpMethod.GET,
|
|
7787
|
-
url: "/asset-type-field-values-attachments/",
|
|
7788
|
-
queryParams: {
|
|
7789
|
-
project: projectId.toString()
|
|
7790
|
-
},
|
|
7791
|
-
blockers: [],
|
|
7792
|
-
blocks: []
|
|
7793
|
-
});
|
|
7794
|
-
this.dispatch(initializeAssetTypeFieldValuesAttachments(result));
|
|
7795
|
-
}
|
|
7796
|
-
}
|
|
7797
|
-
class IssueTypeFieldsAttachmentService extends BaseUploadService {
|
|
7798
|
-
async bulkAdd(payloads) {
|
|
7799
|
-
var _a2;
|
|
7800
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7801
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7802
|
-
const filePayloads = {};
|
|
7803
|
-
const offlineIssueTypeFieldsAttachments = [];
|
|
7804
|
-
const attachmentPayloads = [];
|
|
7805
|
-
for (const payload of payloads) {
|
|
7806
|
-
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7807
|
-
const filePayload = await this.getFilePayload(file);
|
|
7808
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7809
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7810
|
-
const offlineIssueTypeFieldsAttachment = offline({
|
|
7811
|
-
file: URL.createObjectURL(file),
|
|
7812
|
-
file_type: file.type,
|
|
7813
|
-
file_name: file.name,
|
|
7814
|
-
file_sha1: filePayload.sha1,
|
|
7815
|
-
created_by: createdBy,
|
|
7816
|
-
fields_revision: fieldsRevisionId,
|
|
7817
|
-
submitted_at: submittedAt,
|
|
7818
|
-
field_identifier: fieldIdentifier
|
|
7819
|
-
});
|
|
7820
|
-
offlineIssueTypeFieldsAttachments.push(offlineIssueTypeFieldsAttachment);
|
|
7821
|
-
const attachmentPayload = {
|
|
7822
|
-
offline_id: offlineIssueTypeFieldsAttachment.offline_id,
|
|
7823
|
-
file_name: file.name,
|
|
7824
|
-
file_extension: filePayload.extension,
|
|
7825
|
-
field_identifier: fieldIdentifier,
|
|
7826
|
-
file_sha1: filePayload.sha1,
|
|
7827
|
-
fields_revision: fieldsRevisionId
|
|
7828
|
-
};
|
|
7829
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7830
|
-
}
|
|
7831
|
-
this.dispatch(addIssueTypeFieldsAttachments(offlineIssueTypeFieldsAttachments));
|
|
7832
|
-
const promise = this.enqueueRequest({
|
|
7833
|
-
description: "Add issue type fields attachments",
|
|
7834
|
-
method: HttpMethod.POST,
|
|
7835
|
-
url: "/issue-type-fields-attachments/bulk/",
|
|
7836
|
-
payload: {
|
|
7837
|
-
submitted_at: submittedAt,
|
|
7838
|
-
attachments: attachmentPayloads,
|
|
7839
|
-
files: Object.values(filePayloads)
|
|
7840
|
-
},
|
|
7841
|
-
blockers: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
|
|
7842
|
-
blocks: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7843
|
-
});
|
|
7844
|
-
promise.then((result) => {
|
|
7845
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
7846
|
-
this.dispatch(updateIssueTypeFieldsAttachments(result.attachments));
|
|
7847
|
-
}).catch(() => {
|
|
7848
|
-
this.dispatch(
|
|
7849
|
-
deleteIssueTypeFieldsAttachments(
|
|
7850
|
-
offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7851
|
-
)
|
|
7852
|
-
);
|
|
7853
|
-
});
|
|
7854
|
-
return [offlineIssueTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
|
|
7855
|
-
}
|
|
7856
|
-
async refreshStore(organizationId) {
|
|
7857
|
-
const result = await this.enqueueRequest({
|
|
7858
|
-
description: "get issue type fields attachments",
|
|
7859
|
-
method: HttpMethod.GET,
|
|
7860
|
-
url: "/issue-type-fields-attachments/",
|
|
7861
|
-
queryParams: {
|
|
7862
|
-
organization: organizationId.toString()
|
|
7863
|
-
},
|
|
7864
|
-
blockers: [organizationId.toString()],
|
|
7865
|
-
blocks: []
|
|
7866
|
-
});
|
|
7867
|
-
this.dispatch(initializeIssueTypeFieldsAttachments(result));
|
|
7868
|
-
}
|
|
7869
|
-
}
|
|
7870
|
-
class IssueTypeFieldsService extends BaseApiService {
|
|
7871
|
-
add(payload) {
|
|
7872
|
-
var _a2;
|
|
7873
|
-
const { store } = this.client;
|
|
7874
|
-
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7875
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7876
|
-
const offlineIssueTypeFields = offline({
|
|
7877
|
-
...payload,
|
|
7878
|
-
created_by: createdBy,
|
|
7879
|
-
submitted_at: submittedAt
|
|
7880
|
-
});
|
|
7881
|
-
this.dispatch(addIssueTypeFields(offlineIssueTypeFields));
|
|
7882
|
-
const promise = this.enqueueRequest({
|
|
7883
|
-
description: "Add Issue Type Fields",
|
|
7884
|
-
method: HttpMethod.POST,
|
|
7885
|
-
url: "/issue-type-fields/",
|
|
7886
|
-
payload: offlineIssueTypeFields,
|
|
7887
|
-
blockers: [offlineIssueTypeFields.issue_type],
|
|
7888
|
-
blocks: [offlineIssueTypeFields.offline_id]
|
|
7889
|
-
});
|
|
7890
|
-
promise.then((response) => {
|
|
7891
|
-
this.dispatch(updateIssueTypeFields(response));
|
|
7892
|
-
}).catch((error) => {
|
|
7893
|
-
this.dispatch(deleteIssueTypeFields(offlineIssueTypeFields.offline_id));
|
|
7894
|
-
throw error;
|
|
7895
|
-
});
|
|
7896
|
-
return [offlineIssueTypeFields, promise];
|
|
7897
|
-
}
|
|
7898
|
-
async refreshStore(organizationId) {
|
|
7899
|
-
const result = await this.enqueueRequest({
|
|
7900
|
-
description: "Get Issue Type Fields",
|
|
7901
|
-
method: HttpMethod.GET,
|
|
7902
|
-
url: "/issue-type-fields/",
|
|
7903
|
-
queryParams: {
|
|
7904
|
-
organization: organizationId.toString()
|
|
7905
|
-
},
|
|
7906
|
-
blockers: [],
|
|
7907
|
-
blocks: []
|
|
7908
|
-
});
|
|
7909
|
-
this.dispatch(initializeIssueTypeFields(result));
|
|
7910
|
-
}
|
|
7911
|
-
}
|
|
7912
|
-
class IssueTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7913
|
-
async bulkAdd(payloads) {
|
|
7914
|
-
var _a2;
|
|
7915
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7916
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7917
|
-
const filePayloads = {};
|
|
7918
|
-
const offlineIssueTypeFieldValuesAttachments = [];
|
|
7919
|
-
const attachmentPayloads = [];
|
|
7920
|
-
for (const payload of payloads) {
|
|
7921
|
-
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7922
|
-
const filePayload = await this.getFilePayload(file);
|
|
7923
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7924
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7925
|
-
const offlineIssueTypeFieldValuesAttachment = offline({
|
|
7926
|
-
file: URL.createObjectURL(file),
|
|
7927
|
-
file_type: file.type,
|
|
7928
|
-
file_name: file.name,
|
|
7929
|
-
file_sha1: filePayload.sha1,
|
|
7930
|
-
created_by: createdBy,
|
|
7931
|
-
field_values: fieldValuesId,
|
|
7932
|
-
submitted_at: submittedAt,
|
|
7933
|
-
field_identifier: fieldIdentifier
|
|
7934
|
-
});
|
|
7935
|
-
offlineIssueTypeFieldValuesAttachments.push(offlineIssueTypeFieldValuesAttachment);
|
|
7936
|
-
const attachmentPayload = {
|
|
7937
|
-
offline_id: offlineIssueTypeFieldValuesAttachment.offline_id,
|
|
7938
|
-
file_name: file.name,
|
|
7939
|
-
file_sha1: filePayload.sha1,
|
|
7940
|
-
file_extension: filePayload.extension,
|
|
7941
|
-
field_identifier: fieldIdentifier,
|
|
7942
|
-
field_values: fieldValuesId
|
|
7943
|
-
};
|
|
7944
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7945
|
-
}
|
|
7946
|
-
this.dispatch(addIssueTypeFieldValuesAttachments(offlineIssueTypeFieldValuesAttachments));
|
|
7947
|
-
const promise = this.enqueueRequest({
|
|
7948
|
-
description: "Add issue type field values attachments",
|
|
7949
|
-
method: HttpMethod.POST,
|
|
7950
|
-
url: "/issue-type-field-values-attachments/bulk/",
|
|
7951
|
-
payload: {
|
|
7952
|
-
submitted_at: submittedAt,
|
|
7953
|
-
attachments: attachmentPayloads,
|
|
7954
|
-
files: Object.values(filePayloads)
|
|
7955
|
-
},
|
|
7956
|
-
blockers: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.field_values),
|
|
7957
|
-
blocks: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7958
|
-
});
|
|
7959
|
-
promise.then(({ presigned_urls, attachments }) => {
|
|
7960
|
-
this.processPresignedUrls(presigned_urls);
|
|
7961
|
-
this.dispatch(updateIssueTypeFieldValuesAttachments(attachments));
|
|
7962
|
-
}).catch((error) => {
|
|
7963
|
-
this.dispatch(
|
|
7964
|
-
deleteIssueTypeFieldValuesAttachments(
|
|
7965
|
-
offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7966
|
-
)
|
|
7967
|
-
);
|
|
7968
|
-
throw error;
|
|
7969
|
-
});
|
|
7970
|
-
return [offlineIssueTypeFieldValuesAttachments, promise.then(({ attachments }) => attachments)];
|
|
7971
|
-
}
|
|
7972
|
-
async bulkDelete(attachmentsIds) {
|
|
7973
|
-
const { store } = this.client;
|
|
7974
|
-
const state = store.getState();
|
|
7975
|
-
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
7976
|
-
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
7977
|
-
try {
|
|
7978
|
-
await this.enqueueRequest({
|
|
7979
|
-
description: "Delete issue type field values attachments",
|
|
7980
|
-
method: HttpMethod.DELETE,
|
|
7981
|
-
url: "/issue-type-field-values-attachments/bulk/",
|
|
7982
|
-
payload: { attachment_ids: attachmentsIds },
|
|
7983
|
-
blockers: attachmentsIds,
|
|
7984
|
-
blocks: []
|
|
7985
|
-
});
|
|
7986
|
-
} catch (e) {
|
|
7987
|
-
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7988
|
-
throw e;
|
|
7989
|
-
}
|
|
7990
|
-
}
|
|
7991
|
-
async refreshStore(projectId) {
|
|
7992
|
-
const result = await this.enqueueRequest({
|
|
7993
|
-
description: "Get issue type field values attachments",
|
|
7994
|
-
method: HttpMethod.GET,
|
|
7995
|
-
url: "/issue-type-field-values-attachments/",
|
|
7996
|
-
queryParams: {
|
|
7997
|
-
project: projectId.toString()
|
|
7998
|
-
},
|
|
7999
|
-
blockers: [],
|
|
8000
|
-
blocks: []
|
|
8001
|
-
});
|
|
8002
|
-
this.dispatch(initializeIssueTypeFieldValuesAttachments(result));
|
|
8003
|
-
}
|
|
8004
|
-
}
|
|
8005
|
-
class IssueTypeFieldValuesService extends BaseApiService {
|
|
8006
|
-
add(payload) {
|
|
8007
|
-
var _a2;
|
|
8008
|
-
const { store } = this.client;
|
|
8009
|
-
const state = store.getState();
|
|
8010
|
-
const { values } = separateFilesFromValues(payload.values);
|
|
8011
|
-
const offlineIssueTypeFieldValues = offline({
|
|
8012
|
-
...payload,
|
|
8013
|
-
values,
|
|
8014
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
8015
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
8016
|
-
});
|
|
8017
|
-
const promise = this.enqueueRequest({
|
|
8018
|
-
description: "Add issue type field values",
|
|
8019
|
-
method: HttpMethod.POST,
|
|
8020
|
-
url: "/issue-type-field-values/",
|
|
8021
|
-
payload: offlineIssueTypeFieldValues,
|
|
8022
|
-
blockers: [payload.issue, payload.fields_revision],
|
|
8023
|
-
blocks: [offlineIssueTypeFieldValues.offline_id]
|
|
8024
|
-
});
|
|
8025
|
-
this.dispatch(addIssueTypeFieldValues(offlineIssueTypeFieldValues));
|
|
8026
|
-
promise.then((result) => {
|
|
8027
|
-
this.dispatch(updateIssueTypeFieldValues(result));
|
|
8028
|
-
return result;
|
|
8029
|
-
}).catch(() => {
|
|
8030
|
-
this.dispatch(deleteIssueTypeFieldValues(offlineIssueTypeFieldValues.offline_id));
|
|
8031
|
-
});
|
|
8032
|
-
return [offlineIssueTypeFieldValues, promise];
|
|
8033
|
-
}
|
|
8034
|
-
update(payload) {
|
|
8035
|
-
const { store } = this.client;
|
|
8036
|
-
const state = store.getState();
|
|
8037
|
-
const issueTypeFieldValues = selectIssueTypeFieldValuesById(payload.offline_id)(state);
|
|
8038
|
-
if (!issueTypeFieldValues) {
|
|
8039
|
-
throw new Error(`Expected IssueTypeFieldValues with offline_id ${payload.offline_id} to exist`);
|
|
8040
|
-
}
|
|
8041
|
-
const { values } = separateFilesFromValues(payload.values ?? {});
|
|
8042
|
-
const updatedIssueTypeFieldValues = {
|
|
8043
|
-
...issueTypeFieldValues,
|
|
8044
|
-
...payload,
|
|
8045
|
-
// values could also have a partial update
|
|
8046
|
-
values: {
|
|
8047
|
-
...issueTypeFieldValues.values,
|
|
8048
|
-
...values
|
|
8049
|
-
}
|
|
8050
|
-
};
|
|
8051
|
-
this.dispatch(updateIssueTypeFieldValues(updatedIssueTypeFieldValues));
|
|
8052
|
-
const promise = this.enqueueRequest({
|
|
8053
|
-
description: "Update issue type field values",
|
|
8054
|
-
method: HttpMethod.PATCH,
|
|
8055
|
-
url: `/issue-type-field-values/${payload.offline_id}/`,
|
|
8056
|
-
payload,
|
|
8057
|
-
blockers: [
|
|
8058
|
-
updatedIssueTypeFieldValues.offline_id,
|
|
8059
|
-
updatedIssueTypeFieldValues.fields_revision,
|
|
8060
|
-
updatedIssueTypeFieldValues.issue
|
|
8061
|
-
],
|
|
8062
|
-
blocks: [updatedIssueTypeFieldValues.offline_id]
|
|
8063
|
-
});
|
|
8064
|
-
promise.then((result) => {
|
|
8065
|
-
this.dispatch(updateIssueTypeFieldValues(result));
|
|
8066
|
-
}).catch(() => {
|
|
8067
|
-
this.dispatch(updateIssueTypeFieldValues(issueTypeFieldValues));
|
|
8068
|
-
});
|
|
8069
|
-
return [updatedIssueTypeFieldValues, promise];
|
|
8070
|
-
}
|
|
8071
|
-
async delete(id) {
|
|
8072
|
-
const { store } = this.client;
|
|
8073
|
-
const state = store.getState();
|
|
8074
|
-
const issueTypeFieldValues = selectIssueTypeFieldValuesById(id)(state);
|
|
8075
|
-
if (!issueTypeFieldValues) {
|
|
8076
|
-
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
8077
|
-
}
|
|
8078
|
-
const issueTypeFieldValuesAttachments = selectAttachmentsOfIssueTypeFieldValues(id)(state);
|
|
8079
|
-
this.dispatch(deleteIssueTypeFieldValues(id));
|
|
8080
|
-
this.dispatch(deleteIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments.map((x) => x.offline_id)));
|
|
8081
|
-
try {
|
|
8082
|
-
await this.enqueueRequest({
|
|
8083
|
-
description: "Delete issue type field values",
|
|
8084
|
-
method: HttpMethod.DELETE,
|
|
8085
|
-
url: `/issue-type-field-values/${id}/`,
|
|
8086
|
-
blockers: [id],
|
|
8087
|
-
blocks: []
|
|
8088
|
-
});
|
|
8089
|
-
} catch (e) {
|
|
8090
|
-
this.dispatch(addIssueTypeFieldValues(issueTypeFieldValues));
|
|
8091
|
-
this.dispatch(addIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments));
|
|
8092
|
-
throw e;
|
|
8093
|
-
}
|
|
8094
|
-
}
|
|
8095
|
-
async refreshStore(projectId) {
|
|
8096
|
-
const result = await this.enqueueRequest({
|
|
8097
|
-
description: "Get issue type field values",
|
|
8098
|
-
method: HttpMethod.GET,
|
|
8099
|
-
url: "/issue-type-field-values/",
|
|
8100
|
-
queryParams: {
|
|
8101
|
-
project: projectId.toString()
|
|
8102
|
-
},
|
|
8103
|
-
blockers: [],
|
|
8104
|
-
blocks: []
|
|
8105
|
-
});
|
|
8106
|
-
this.dispatch(initializeIssueTypeFieldValues(result));
|
|
8107
|
-
}
|
|
8108
|
-
}
|
|
8109
7319
|
var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
8110
7320
|
VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
|
|
8111
7321
|
VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
|
|
@@ -8122,10 +7332,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8122
7332
|
exports2.AssetStageCompletionService = AssetStageCompletionService;
|
|
8123
7333
|
exports2.AssetStageService = AssetStageService;
|
|
8124
7334
|
exports2.AssetTypeAttachmentService = AssetTypeAttachmentService;
|
|
8125
|
-
exports2.AssetTypeFieldValuesAttachmentService = AssetTypeFieldValuesAttachmentService;
|
|
8126
|
-
exports2.AssetTypeFieldValuesService = AssetTypeFieldValuesService;
|
|
8127
|
-
exports2.AssetTypeFieldsAttachmentService = AssetTypeFieldsAttachmentService;
|
|
8128
|
-
exports2.AssetTypeFieldsService = AssetTypeFieldsService;
|
|
8129
7335
|
exports2.AssetTypeService = AssetTypeService;
|
|
8130
7336
|
exports2.AttachmentModel = AttachmentModel;
|
|
8131
7337
|
exports2.BaseApiService = BaseApiService;
|
|
@@ -8141,10 +7347,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8141
7347
|
exports2.EmailDomainsService = EmailDomainsService;
|
|
8142
7348
|
exports2.EmailVerificationService = EmailVerificationService;
|
|
8143
7349
|
exports2.FileService = FileService;
|
|
8144
|
-
exports2.FormRevisionAttachmentService = FormRevisionAttachmentService;
|
|
8145
|
-
exports2.FormRevisionService = FormRevisionService;
|
|
8146
7350
|
exports2.FormService = FormService;
|
|
8147
|
-
exports2.FormSubmissionAttachmentService = FormSubmissionAttachmentService;
|
|
8148
7351
|
exports2.FormSubmissionService = FormSubmissionService;
|
|
8149
7352
|
exports2.GREEN = GREEN;
|
|
8150
7353
|
exports2.GeoImageService = GeoImageService;
|
|
@@ -8155,10 +7358,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8155
7358
|
exports2.IssuePriority = IssuePriority;
|
|
8156
7359
|
exports2.IssueService = IssueService;
|
|
8157
7360
|
exports2.IssueStatus = IssueStatus;
|
|
8158
|
-
exports2.IssueTypeFieldValuesAttachmentService = IssueTypeFieldValuesAttachmentService;
|
|
8159
|
-
exports2.IssueTypeFieldValuesService = IssueTypeFieldValuesService;
|
|
8160
|
-
exports2.IssueTypeFieldsAttachmentService = IssueTypeFieldsAttachmentService;
|
|
8161
|
-
exports2.IssueTypeFieldsService = IssueTypeFieldsService;
|
|
8162
7361
|
exports2.IssueTypeService = IssueTypeService;
|
|
8163
7362
|
exports2.IssueUpdateChange = IssueUpdateChange;
|
|
8164
7363
|
exports2.IssueUpdateService = IssueUpdateService;
|
|
@@ -8198,14 +7397,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8198
7397
|
exports2.addAssetType = addAssetType;
|
|
8199
7398
|
exports2.addAssetTypeAttachment = addAssetTypeAttachment;
|
|
8200
7399
|
exports2.addAssetTypeAttachments = addAssetTypeAttachments;
|
|
8201
|
-
exports2.addAssetTypeFieldValues = addAssetTypeFieldValues;
|
|
8202
|
-
exports2.addAssetTypeFieldValuesAttachment = addAssetTypeFieldValuesAttachment;
|
|
8203
|
-
exports2.addAssetTypeFieldValuesAttachments = addAssetTypeFieldValuesAttachments;
|
|
8204
|
-
exports2.addAssetTypeFieldValuesMany = addAssetTypeFieldValuesMany;
|
|
8205
|
-
exports2.addAssetTypeFields = addAssetTypeFields;
|
|
8206
|
-
exports2.addAssetTypeFieldsAttachment = addAssetTypeFieldsAttachment;
|
|
8207
|
-
exports2.addAssetTypeFieldsAttachments = addAssetTypeFieldsAttachments;
|
|
8208
|
-
exports2.addAssetTypeFieldsMany = addAssetTypeFieldsMany;
|
|
8209
7400
|
exports2.addAssetTypes = addAssetTypes;
|
|
8210
7401
|
exports2.addAssets = addAssets;
|
|
8211
7402
|
exports2.addCategory = addCategory;
|
|
@@ -8234,14 +7425,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8234
7425
|
exports2.addIssueComment = addIssueComment;
|
|
8235
7426
|
exports2.addIssueComments = addIssueComments;
|
|
8236
7427
|
exports2.addIssueType = addIssueType;
|
|
8237
|
-
exports2.addIssueTypeFieldValues = addIssueTypeFieldValues;
|
|
8238
|
-
exports2.addIssueTypeFieldValuesAttachment = addIssueTypeFieldValuesAttachment;
|
|
8239
|
-
exports2.addIssueTypeFieldValuesAttachments = addIssueTypeFieldValuesAttachments;
|
|
8240
|
-
exports2.addIssueTypeFieldValuesMany = addIssueTypeFieldValuesMany;
|
|
8241
|
-
exports2.addIssueTypeFields = addIssueTypeFields;
|
|
8242
|
-
exports2.addIssueTypeFieldsAttachment = addIssueTypeFieldsAttachment;
|
|
8243
|
-
exports2.addIssueTypeFieldsAttachments = addIssueTypeFieldsAttachments;
|
|
8244
|
-
exports2.addIssueTypeFieldsMany = addIssueTypeFieldsMany;
|
|
8245
7428
|
exports2.addIssueUpdate = addIssueUpdate;
|
|
8246
7429
|
exports2.addIssueUpdates = addIssueUpdates;
|
|
8247
7430
|
exports2.addIssues = addIssues;
|
|
@@ -8267,14 +7450,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8267
7450
|
exports2.assetStageSlice = assetStageSlice;
|
|
8268
7451
|
exports2.assetTypeAttachmentReducer = assetTypeAttachmentReducer;
|
|
8269
7452
|
exports2.assetTypeAttachmentSlice = assetTypeAttachmentSlice;
|
|
8270
|
-
exports2.assetTypeFieldValuesAttachmentReducer = assetTypeFieldValuesAttachmentReducer;
|
|
8271
|
-
exports2.assetTypeFieldValuesAttachmentSlice = assetTypeFieldValuesAttachmentSlice;
|
|
8272
|
-
exports2.assetTypeFieldValuesReducer = assetTypeFieldValuesReducer;
|
|
8273
|
-
exports2.assetTypeFieldValuesSlice = assetTypeFieldValuesSlice;
|
|
8274
|
-
exports2.assetTypeFieldsAttachmentReducer = assetTypeFieldsAttachmentReducer;
|
|
8275
|
-
exports2.assetTypeFieldsAttachmentSlice = assetTypeFieldsAttachmentSlice;
|
|
8276
|
-
exports2.assetTypeFieldsReducer = assetTypeFieldsReducer;
|
|
8277
|
-
exports2.assetTypeFieldsSlice = assetTypeFieldsSlice;
|
|
8278
7453
|
exports2.assetTypeReducer = assetTypeReducer;
|
|
8279
7454
|
exports2.assetTypeSlice = assetTypeSlice;
|
|
8280
7455
|
exports2.authReducer = authReducer;
|
|
@@ -8303,14 +7478,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8303
7478
|
exports2.deleteAssetType = deleteAssetType;
|
|
8304
7479
|
exports2.deleteAssetTypeAttachment = deleteAssetTypeAttachment;
|
|
8305
7480
|
exports2.deleteAssetTypeAttachments = deleteAssetTypeAttachments;
|
|
8306
|
-
exports2.deleteAssetTypeFieldValues = deleteAssetTypeFieldValues;
|
|
8307
|
-
exports2.deleteAssetTypeFieldValuesAttachment = deleteAssetTypeFieldValuesAttachment;
|
|
8308
|
-
exports2.deleteAssetTypeFieldValuesAttachments = deleteAssetTypeFieldValuesAttachments;
|
|
8309
|
-
exports2.deleteAssetTypeFieldValuesMany = deleteAssetTypeFieldValuesMany;
|
|
8310
|
-
exports2.deleteAssetTypeFields = deleteAssetTypeFields;
|
|
8311
|
-
exports2.deleteAssetTypeFieldsAttachment = deleteAssetTypeFieldsAttachment;
|
|
8312
|
-
exports2.deleteAssetTypeFieldsAttachments = deleteAssetTypeFieldsAttachments;
|
|
8313
|
-
exports2.deleteAssetTypeFieldsMany = deleteAssetTypeFieldsMany;
|
|
8314
7481
|
exports2.deleteAssetTypes = deleteAssetTypes;
|
|
8315
7482
|
exports2.deleteAssets = deleteAssets;
|
|
8316
7483
|
exports2.deleteCategory = deleteCategory;
|
|
@@ -8335,14 +7502,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8335
7502
|
exports2.deleteIssueAttachments = deleteIssueAttachments;
|
|
8336
7503
|
exports2.deleteIssueComment = deleteIssueComment;
|
|
8337
7504
|
exports2.deleteIssueComments = deleteIssueComments;
|
|
8338
|
-
exports2.deleteIssueTypeFieldValues = deleteIssueTypeFieldValues;
|
|
8339
|
-
exports2.deleteIssueTypeFieldValuesAttachment = deleteIssueTypeFieldValuesAttachment;
|
|
8340
|
-
exports2.deleteIssueTypeFieldValuesAttachments = deleteIssueTypeFieldValuesAttachments;
|
|
8341
|
-
exports2.deleteIssueTypeFieldValuesMany = deleteIssueTypeFieldValuesMany;
|
|
8342
|
-
exports2.deleteIssueTypeFields = deleteIssueTypeFields;
|
|
8343
|
-
exports2.deleteIssueTypeFieldsAttachment = deleteIssueTypeFieldsAttachment;
|
|
8344
|
-
exports2.deleteIssueTypeFieldsAttachments = deleteIssueTypeFieldsAttachments;
|
|
8345
|
-
exports2.deleteIssueTypeFieldsMany = deleteIssueTypeFieldsMany;
|
|
8346
7505
|
exports2.deleteIssueUpdate = deleteIssueUpdate;
|
|
8347
7506
|
exports2.deleteIssueUpdates = deleteIssueUpdates;
|
|
8348
7507
|
exports2.deleteIssues = deleteIssues;
|
|
@@ -8399,10 +7558,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8399
7558
|
exports2.initializeAssetStageCompletions = initializeAssetStageCompletions;
|
|
8400
7559
|
exports2.initializeAssetStages = initializeAssetStages;
|
|
8401
7560
|
exports2.initializeAssetTypeAttachments = initializeAssetTypeAttachments;
|
|
8402
|
-
exports2.initializeAssetTypeFieldValues = initializeAssetTypeFieldValues;
|
|
8403
|
-
exports2.initializeAssetTypeFieldValuesAttachments = initializeAssetTypeFieldValuesAttachments;
|
|
8404
|
-
exports2.initializeAssetTypeFields = initializeAssetTypeFields;
|
|
8405
|
-
exports2.initializeAssetTypeFieldsAttachments = initializeAssetTypeFieldsAttachments;
|
|
8406
7561
|
exports2.initializeAssetTypes = initializeAssetTypes;
|
|
8407
7562
|
exports2.initializeAssets = initializeAssets;
|
|
8408
7563
|
exports2.initializeCategories = initializeCategories;
|
|
@@ -8417,10 +7572,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8417
7572
|
exports2.initializeGeoImages = initializeGeoImages;
|
|
8418
7573
|
exports2.initializeIssueAssociations = initializeIssueAssociations;
|
|
8419
7574
|
exports2.initializeIssueAttachments = initializeIssueAttachments;
|
|
8420
|
-
exports2.initializeIssueTypeFieldValues = initializeIssueTypeFieldValues;
|
|
8421
|
-
exports2.initializeIssueTypeFieldValuesAttachments = initializeIssueTypeFieldValuesAttachments;
|
|
8422
|
-
exports2.initializeIssueTypeFields = initializeIssueTypeFields;
|
|
8423
|
-
exports2.initializeIssueTypeFieldsAttachments = initializeIssueTypeFieldsAttachments;
|
|
8424
7575
|
exports2.initializeIssueTypes = initializeIssueTypes;
|
|
8425
7576
|
exports2.initializeIssueUpdates = initializeIssueUpdates;
|
|
8426
7577
|
exports2.initializeIssues = initializeIssues;
|
|
@@ -8439,14 +7590,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8439
7590
|
exports2.issueCommentSlice = issueCommentSlice;
|
|
8440
7591
|
exports2.issueReducer = issueReducer;
|
|
8441
7592
|
exports2.issueSlice = issueSlice;
|
|
8442
|
-
exports2.issueTypeFieldValuesAttachmentReducer = issueTypeFieldValuesAttachmentReducer;
|
|
8443
|
-
exports2.issueTypeFieldValuesAttachmentSlice = issueTypeFieldValuesAttachmentSlice;
|
|
8444
|
-
exports2.issueTypeFieldValuesReducer = issueTypeFieldValuesReducer;
|
|
8445
|
-
exports2.issueTypeFieldValuesSlice = issueTypeFieldValuesSlice;
|
|
8446
|
-
exports2.issueTypeFieldsAttachmentReducer = issueTypeFieldsAttachmentReducer;
|
|
8447
|
-
exports2.issueTypeFieldsAttachmentSlice = issueTypeFieldsAttachmentSlice;
|
|
8448
|
-
exports2.issueTypeFieldsReducer = issueTypeFieldsReducer;
|
|
8449
|
-
exports2.issueTypeFieldsSlice = issueTypeFieldsSlice;
|
|
8450
7593
|
exports2.issueTypeReducer = issueTypeReducer;
|
|
8451
7594
|
exports2.issueTypeSlice = issueTypeSlice;
|
|
8452
7595
|
exports2.issueUpdateReducer = issueUpdateReducer;
|
|
@@ -8519,22 +7662,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8519
7662
|
exports2.selectAssetTypeAttachmentMapping = selectAssetTypeAttachmentMapping;
|
|
8520
7663
|
exports2.selectAssetTypeAttachments = selectAssetTypeAttachments;
|
|
8521
7664
|
exports2.selectAssetTypeById = selectAssetTypeById;
|
|
8522
|
-
exports2.selectAssetTypeFieldValues = selectAssetTypeFieldValues;
|
|
8523
|
-
exports2.selectAssetTypeFieldValuesAttachmentById = selectAssetTypeFieldValuesAttachmentById;
|
|
8524
|
-
exports2.selectAssetTypeFieldValuesAttachments = selectAssetTypeFieldValuesAttachments;
|
|
8525
|
-
exports2.selectAssetTypeFieldValuesAttachmentsMapping = selectAssetTypeFieldValuesAttachmentsMapping;
|
|
8526
|
-
exports2.selectAssetTypeFieldValuesById = selectAssetTypeFieldValuesById;
|
|
8527
|
-
exports2.selectAssetTypeFieldValuesMapping = selectAssetTypeFieldValuesMapping;
|
|
8528
|
-
exports2.selectAssetTypeFieldValuesOfAsset = selectAssetTypeFieldValuesOfAsset;
|
|
8529
|
-
exports2.selectAssetTypeFields = selectAssetTypeFields;
|
|
8530
|
-
exports2.selectAssetTypeFieldsAttachmentById = selectAssetTypeFieldsAttachmentById;
|
|
8531
|
-
exports2.selectAssetTypeFieldsAttachments = selectAssetTypeFieldsAttachments;
|
|
8532
|
-
exports2.selectAssetTypeFieldsAttachmentsMapping = selectAssetTypeFieldsAttachmentsMapping;
|
|
8533
|
-
exports2.selectAssetTypeFieldsById = selectAssetTypeFieldsById;
|
|
8534
|
-
exports2.selectAssetTypeFieldsMapping = selectAssetTypeFieldsMapping;
|
|
8535
|
-
exports2.selectAssetTypeFieldsOfAssetType = selectAssetTypeFieldsOfAssetType;
|
|
8536
7665
|
exports2.selectAssetTypeStagesMapping = selectAssetTypeStagesMapping;
|
|
8537
|
-
exports2.selectAssetTypeValuesOfAssetType = selectAssetTypeValuesOfAssetType;
|
|
8538
7666
|
exports2.selectAssetTypes = selectAssetTypes;
|
|
8539
7667
|
exports2.selectAssetTypesByIds = selectAssetTypesByIds;
|
|
8540
7668
|
exports2.selectAssetTypesMapping = selectAssetTypesMapping;
|
|
@@ -8542,20 +7670,18 @@ var __publicField = (obj, key, value) => {
|
|
|
8542
7670
|
exports2.selectAssetsByIds = selectAssetsByIds;
|
|
8543
7671
|
exports2.selectAssetsMapping = selectAssetsMapping;
|
|
8544
7672
|
exports2.selectAssetsOfAssetType = selectAssetsOfAssetType;
|
|
7673
|
+
exports2.selectAttachedFormSubmissionsOfAsset = selectAttachedFormSubmissionsOfAsset;
|
|
7674
|
+
exports2.selectAttachedFormSubmissionsOfIssue = selectAttachedFormSubmissionsOfIssue;
|
|
8545
7675
|
exports2.selectAttachmentsOfAsset = selectAttachmentsOfAsset;
|
|
8546
7676
|
exports2.selectAttachmentsOfAssetByType = selectAttachmentsOfAssetByType;
|
|
8547
7677
|
exports2.selectAttachmentsOfAssetType = selectAttachmentsOfAssetType;
|
|
8548
7678
|
exports2.selectAttachmentsOfAssetTypeByType = selectAttachmentsOfAssetTypeByType;
|
|
8549
|
-
exports2.selectAttachmentsOfAssetTypeFieldValues = selectAttachmentsOfAssetTypeFieldValues;
|
|
8550
|
-
exports2.selectAttachmentsOfAssetTypeFields = selectAttachmentsOfAssetTypeFields;
|
|
8551
7679
|
exports2.selectAttachmentsOfDocument = selectAttachmentsOfDocument;
|
|
8552
7680
|
exports2.selectAttachmentsOfDocumentByType = selectAttachmentsOfDocumentByType;
|
|
8553
7681
|
exports2.selectAttachmentsOfFormRevision = selectAttachmentsOfFormRevision;
|
|
8554
7682
|
exports2.selectAttachmentsOfFormSubmission = selectAttachmentsOfFormSubmission;
|
|
8555
7683
|
exports2.selectAttachmentsOfIssue = selectAttachmentsOfIssue;
|
|
8556
7684
|
exports2.selectAttachmentsOfIssueByType = selectAttachmentsOfIssueByType;
|
|
8557
|
-
exports2.selectAttachmentsOfIssueTypeFieldValues = selectAttachmentsOfIssueTypeFieldValues;
|
|
8558
|
-
exports2.selectAttachmentsOfIssueTypeFields = selectAttachmentsOfIssueTypeFields;
|
|
8559
7685
|
exports2.selectAttachmentsOfProject = selectAttachmentsOfProject;
|
|
8560
7686
|
exports2.selectAttachmentsOfProjectByType = selectAttachmentsOfProjectByType;
|
|
8561
7687
|
exports2.selectCategories = selectCategories;
|
|
@@ -8583,6 +7709,8 @@ var __publicField = (obj, key, value) => {
|
|
|
8583
7709
|
exports2.selectFilteredForms = selectFilteredForms;
|
|
8584
7710
|
exports2.selectFormById = selectFormById;
|
|
8585
7711
|
exports2.selectFormMapping = selectFormMapping;
|
|
7712
|
+
exports2.selectFormOfAssetType = selectFormOfAssetType;
|
|
7713
|
+
exports2.selectFormOfIssueType = selectFormOfIssueType;
|
|
8586
7714
|
exports2.selectFormRevisionAttachmentsMapping = selectFormRevisionAttachmentsMapping;
|
|
8587
7715
|
exports2.selectFormRevisionById = selectFormRevisionById;
|
|
8588
7716
|
exports2.selectFormRevisionMapping = selectFormRevisionMapping;
|
|
@@ -8592,11 +7720,16 @@ var __publicField = (obj, key, value) => {
|
|
|
8592
7720
|
exports2.selectFormSubmissionAttachmentsMapping = selectFormSubmissionAttachmentsMapping;
|
|
8593
7721
|
exports2.selectFormSubmissionById = selectFormSubmissionById;
|
|
8594
7722
|
exports2.selectFormSubmissions = selectFormSubmissions;
|
|
7723
|
+
exports2.selectFormSubmissionsByAssets = selectFormSubmissionsByAssets;
|
|
7724
|
+
exports2.selectFormSubmissionsByFormRevisions = selectFormSubmissionsByFormRevisions;
|
|
7725
|
+
exports2.selectFormSubmissionsByIssues = selectFormSubmissionsByIssues;
|
|
8595
7726
|
exports2.selectFormSubmissionsMapping = selectFormSubmissionsMapping;
|
|
8596
7727
|
exports2.selectFormSubmissionsOfAsset = selectFormSubmissionsOfAsset;
|
|
8597
7728
|
exports2.selectFormSubmissionsOfForm = selectFormSubmissionsOfForm;
|
|
8598
7729
|
exports2.selectFormSubmissionsOfIssue = selectFormSubmissionsOfIssue;
|
|
8599
7730
|
exports2.selectForms = selectForms;
|
|
7731
|
+
exports2.selectFormsCount = selectFormsCount;
|
|
7732
|
+
exports2.selectGeneralFormCount = selectGeneralFormCount;
|
|
8600
7733
|
exports2.selectGeoImageById = selectGeoImageById;
|
|
8601
7734
|
exports2.selectGeoImageMapping = selectGeoImageMapping;
|
|
8602
7735
|
exports2.selectGeoImages = selectGeoImages;
|
|
@@ -8618,22 +7751,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8618
7751
|
exports2.selectIssueCountOfCategory = selectIssueCountOfCategory;
|
|
8619
7752
|
exports2.selectIssueMapping = selectIssueMapping;
|
|
8620
7753
|
exports2.selectIssueTypeById = selectIssueTypeById;
|
|
8621
|
-
exports2.selectIssueTypeFieldValues = selectIssueTypeFieldValues;
|
|
8622
|
-
exports2.selectIssueTypeFieldValuesAttachmentById = selectIssueTypeFieldValuesAttachmentById;
|
|
8623
|
-
exports2.selectIssueTypeFieldValuesAttachments = selectIssueTypeFieldValuesAttachments;
|
|
8624
|
-
exports2.selectIssueTypeFieldValuesAttachmentsMapping = selectIssueTypeFieldValuesAttachmentsMapping;
|
|
8625
|
-
exports2.selectIssueTypeFieldValuesById = selectIssueTypeFieldValuesById;
|
|
8626
|
-
exports2.selectIssueTypeFieldValuesMapping = selectIssueTypeFieldValuesMapping;
|
|
8627
|
-
exports2.selectIssueTypeFieldValuesOfIssue = selectIssueTypeFieldValuesOfIssue;
|
|
8628
|
-
exports2.selectIssueTypeFields = selectIssueTypeFields;
|
|
8629
|
-
exports2.selectIssueTypeFieldsAttachmentById = selectIssueTypeFieldsAttachmentById;
|
|
8630
|
-
exports2.selectIssueTypeFieldsAttachments = selectIssueTypeFieldsAttachments;
|
|
8631
|
-
exports2.selectIssueTypeFieldsAttachmentsMapping = selectIssueTypeFieldsAttachmentsMapping;
|
|
8632
|
-
exports2.selectIssueTypeFieldsById = selectIssueTypeFieldsById;
|
|
8633
|
-
exports2.selectIssueTypeFieldsMapping = selectIssueTypeFieldsMapping;
|
|
8634
|
-
exports2.selectIssueTypeFieldsOfIssueType = selectIssueTypeFieldsOfIssueType;
|
|
8635
7754
|
exports2.selectIssueTypeMapping = selectIssueTypeMapping;
|
|
8636
|
-
exports2.selectIssueTypeValuesOfIssueType = selectIssueTypeValuesOfIssueType;
|
|
8637
7755
|
exports2.selectIssueTypes = selectIssueTypes;
|
|
8638
7756
|
exports2.selectIssueTypesByIds = selectIssueTypesByIds;
|
|
8639
7757
|
exports2.selectIssueTypesOfOrganization = selectIssueTypesOfOrganization;
|
|
@@ -8642,9 +7760,8 @@ var __publicField = (obj, key, value) => {
|
|
|
8642
7760
|
exports2.selectIssuesByIds = selectIssuesByIds;
|
|
8643
7761
|
exports2.selectIssuesOfIssueType = selectIssuesOfIssueType;
|
|
8644
7762
|
exports2.selectIssuesOfIssueTypeCount = selectIssuesOfIssueTypeCount;
|
|
8645
|
-
exports2.
|
|
7763
|
+
exports2.selectLatestFormRevisionByForm = selectLatestFormRevisionByForm;
|
|
8646
7764
|
exports2.selectLatestFormRevisionOfForm = selectLatestFormRevisionOfForm;
|
|
8647
|
-
exports2.selectLatestIssueTypeFieldsOfIssueType = selectLatestIssueTypeFieldsOfIssueType;
|
|
8648
7765
|
exports2.selectLatestRetryTime = selectLatestRetryTime;
|
|
8649
7766
|
exports2.selectLicense = selectLicense;
|
|
8650
7767
|
exports2.selectLicenseForProject = selectLicenseForProject;
|
|
@@ -8681,6 +7798,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8681
7798
|
exports2.selectProjectsOfOrganization = selectProjectsOfOrganization;
|
|
8682
7799
|
exports2.selectRehydrated = selectRehydrated;
|
|
8683
7800
|
exports2.selectRootDocuments = selectRootDocuments;
|
|
7801
|
+
exports2.selectSortedFormSubmissionsOfForm = selectSortedFormSubmissionsOfForm;
|
|
8684
7802
|
exports2.selectSortedOrganizationUsers = selectSortedOrganizationUsers;
|
|
8685
7803
|
exports2.selectSortedProjectUsers = selectSortedProjectUsers;
|
|
8686
7804
|
exports2.selectStageFormIdsFromStageIds = selectStageFormIdsFromStageIds;
|
|
@@ -8699,8 +7817,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8699
7817
|
exports2.selectWorkspaceById = selectWorkspaceById;
|
|
8700
7818
|
exports2.selectWorkspaceMapping = selectWorkspaceMapping;
|
|
8701
7819
|
exports2.selectWorkspaces = selectWorkspaces;
|
|
8702
|
-
exports2.separateFilesFromValues = separateFilesFromValues;
|
|
8703
|
-
exports2.separateImageFromFields = separateImageFromFields;
|
|
8704
7820
|
exports2.setActiveProjectFileId = setActiveProjectFileId;
|
|
8705
7821
|
exports2.setActiveProjectId = setActiveProjectId;
|
|
8706
7822
|
exports2.setAsset = setAsset;
|
|
@@ -8711,14 +7827,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8711
7827
|
exports2.setAssetType = setAssetType;
|
|
8712
7828
|
exports2.setAssetTypeAttachment = setAssetTypeAttachment;
|
|
8713
7829
|
exports2.setAssetTypeAttachments = setAssetTypeAttachments;
|
|
8714
|
-
exports2.setAssetTypeFieldValues = setAssetTypeFieldValues;
|
|
8715
|
-
exports2.setAssetTypeFieldValuesAttachment = setAssetTypeFieldValuesAttachment;
|
|
8716
|
-
exports2.setAssetTypeFieldValuesAttachments = setAssetTypeFieldValuesAttachments;
|
|
8717
|
-
exports2.setAssetTypeFieldValuesMany = setAssetTypeFieldValuesMany;
|
|
8718
|
-
exports2.setAssetTypeFields = setAssetTypeFields;
|
|
8719
|
-
exports2.setAssetTypeFieldsAttachment = setAssetTypeFieldsAttachment;
|
|
8720
|
-
exports2.setAssetTypeFieldsAttachments = setAssetTypeFieldsAttachments;
|
|
8721
|
-
exports2.setAssetTypeFieldsMany = setAssetTypeFieldsMany;
|
|
8722
7830
|
exports2.setAssetTypes = setAssetTypes;
|
|
8723
7831
|
exports2.setAssets = setAssets;
|
|
8724
7832
|
exports2.setConversation = setConversation;
|
|
@@ -8744,14 +7852,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8744
7852
|
exports2.setIssueComment = setIssueComment;
|
|
8745
7853
|
exports2.setIssueComments = setIssueComments;
|
|
8746
7854
|
exports2.setIssueType = setIssueType;
|
|
8747
|
-
exports2.setIssueTypeFieldValues = setIssueTypeFieldValues;
|
|
8748
|
-
exports2.setIssueTypeFieldValuesAttachment = setIssueTypeFieldValuesAttachment;
|
|
8749
|
-
exports2.setIssueTypeFieldValuesAttachments = setIssueTypeFieldValuesAttachments;
|
|
8750
|
-
exports2.setIssueTypeFieldValuesMany = setIssueTypeFieldValuesMany;
|
|
8751
|
-
exports2.setIssueTypeFields = setIssueTypeFields;
|
|
8752
|
-
exports2.setIssueTypeFieldsAttachment = setIssueTypeFieldsAttachment;
|
|
8753
|
-
exports2.setIssueTypeFieldsAttachments = setIssueTypeFieldsAttachments;
|
|
8754
|
-
exports2.setIssueTypeFieldsMany = setIssueTypeFieldsMany;
|
|
8755
7855
|
exports2.setIssueUpdate = setIssueUpdate;
|
|
8756
7856
|
exports2.setLoggedIn = setLoggedIn;
|
|
8757
7857
|
exports2.setOrganizations = setOrganizations;
|
|
@@ -8784,14 +7884,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8784
7884
|
exports2.updateAssetType = updateAssetType;
|
|
8785
7885
|
exports2.updateAssetTypeAttachment = updateAssetTypeAttachment;
|
|
8786
7886
|
exports2.updateAssetTypeAttachments = updateAssetTypeAttachments;
|
|
8787
|
-
exports2.updateAssetTypeFieldValues = updateAssetTypeFieldValues;
|
|
8788
|
-
exports2.updateAssetTypeFieldValuesAttachment = updateAssetTypeFieldValuesAttachment;
|
|
8789
|
-
exports2.updateAssetTypeFieldValuesAttachments = updateAssetTypeFieldValuesAttachments;
|
|
8790
|
-
exports2.updateAssetTypeFieldValuesMany = updateAssetTypeFieldValuesMany;
|
|
8791
|
-
exports2.updateAssetTypeFields = updateAssetTypeFields;
|
|
8792
|
-
exports2.updateAssetTypeFieldsAttachment = updateAssetTypeFieldsAttachment;
|
|
8793
|
-
exports2.updateAssetTypeFieldsAttachments = updateAssetTypeFieldsAttachments;
|
|
8794
|
-
exports2.updateAssetTypeFieldsMany = updateAssetTypeFieldsMany;
|
|
8795
7887
|
exports2.updateAssetTypes = updateAssetTypes;
|
|
8796
7888
|
exports2.updateAssets = updateAssets;
|
|
8797
7889
|
exports2.updateCategory = updateCategory;
|
|
@@ -8814,14 +7906,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8814
7906
|
exports2.updateIssueAttachment = updateIssueAttachment;
|
|
8815
7907
|
exports2.updateIssueAttachments = updateIssueAttachments;
|
|
8816
7908
|
exports2.updateIssueType = updateIssueType;
|
|
8817
|
-
exports2.updateIssueTypeFieldValues = updateIssueTypeFieldValues;
|
|
8818
|
-
exports2.updateIssueTypeFieldValuesAttachment = updateIssueTypeFieldValuesAttachment;
|
|
8819
|
-
exports2.updateIssueTypeFieldValuesAttachments = updateIssueTypeFieldValuesAttachments;
|
|
8820
|
-
exports2.updateIssueTypeFieldValuesMany = updateIssueTypeFieldValuesMany;
|
|
8821
|
-
exports2.updateIssueTypeFields = updateIssueTypeFields;
|
|
8822
|
-
exports2.updateIssueTypeFieldsAttachment = updateIssueTypeFieldsAttachment;
|
|
8823
|
-
exports2.updateIssueTypeFieldsAttachments = updateIssueTypeFieldsAttachments;
|
|
8824
|
-
exports2.updateIssueTypeFieldsMany = updateIssueTypeFieldsMany;
|
|
8825
7909
|
exports2.updateLicense = updateLicense;
|
|
8826
7910
|
exports2.updateOrCreateProject = updateOrCreateProject;
|
|
8827
7911
|
exports2.updateOrganizationAccess = updateOrganizationAccess;
|