@overmap-ai/core 1.0.71-fields.8 → 1.0.71-mapbox.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/overmap-core.js +1031 -2010
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +1031 -2010
- 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 +14 -11
- package/dist/sdk/services/FormSubmissionService.d.ts +28 -8
- 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/index.d.ts +0 -11
- package/dist/store/slices/formRevisionSlice.d.ts +2 -1
- 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 +27 -12
- package/dist/typings/models/geo.d.ts +3 -3
- 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/coordinates.d.ts +4 -18
- package/dist/utils/file.d.ts +2 -2
- package/dist/utils/utils.d.ts +1 -7
- package/package.json +2 -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
|
@@ -318,70 +318,21 @@ var __publicField = (obj, key, value) => {
|
|
|
318
318
|
this.options = options;
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
const
|
|
322
|
-
return { lng: coordinates[0], lat: coordinates[1] };
|
|
323
|
-
};
|
|
324
|
-
const literalToCoordinates = (literal) => {
|
|
325
|
-
return [literal.lng, literal.lat];
|
|
326
|
-
};
|
|
327
|
-
const flipCoordinates = (coordinates) => {
|
|
328
|
-
return [coordinates[1], coordinates[0]];
|
|
329
|
-
};
|
|
330
|
-
const flipBounds = (bounds) => {
|
|
331
|
-
return [flipCoordinates(bounds[0]), flipCoordinates(bounds[1])];
|
|
332
|
-
};
|
|
333
|
-
function offsetPositionByMeters(originalPosition, latMeters, lngMeters) {
|
|
334
|
-
const { lat, lng } = originalPosition;
|
|
335
|
-
const earthRadius = 6378137;
|
|
336
|
-
const metersPerDegree = 2 * Math.PI * earthRadius / 360;
|
|
337
|
-
const newLng = lng + lngMeters / metersPerDegree / Math.cos(lat * Math.PI / 180);
|
|
338
|
-
const newLat = lat - latMeters / metersPerDegree;
|
|
339
|
-
return { lat: newLat, lng: newLng };
|
|
340
|
-
}
|
|
341
|
-
const createPointGeometry = (coordinates) => {
|
|
321
|
+
const createPointGeometry = (position) => {
|
|
342
322
|
return {
|
|
343
323
|
type: "Point",
|
|
344
|
-
coordinates
|
|
324
|
+
coordinates: position
|
|
345
325
|
};
|
|
346
326
|
};
|
|
347
|
-
const coordinatesAreEqual = (a, b) => {
|
|
348
|
-
return a[0] === b[0] && a[1] === b[1];
|
|
349
|
-
};
|
|
350
|
-
const coordinatesToText = (coordinates, decimalPlaces) => {
|
|
351
|
-
if (!coordinates)
|
|
352
|
-
return "(No Location)";
|
|
353
|
-
const { lat, lng } = coordinatesToLiteral(coordinates);
|
|
354
|
-
if (decimalPlaces)
|
|
355
|
-
return `${lat.toFixed(decimalPlaces)}, ${lng.toFixed(decimalPlaces)}`;
|
|
356
|
-
return `${lat}, ${lng}`;
|
|
357
|
-
};
|
|
358
|
-
const coordinatesToUrlText = (coordinates) => {
|
|
359
|
-
const { lat, lng } = coordinatesToLiteral(coordinates);
|
|
360
|
-
return `${lat}%2C${lng}`;
|
|
361
|
-
};
|
|
362
|
-
const openCoordsInGoogleMaps = (coordinates) => {
|
|
363
|
-
const url = `https://www.google.com/maps/search/?api=1&query=${coordinatesToUrlText(coordinates)}`;
|
|
364
|
-
window.open(url);
|
|
365
|
-
};
|
|
366
|
-
const openDirectionsInGoogleMaps = (startingPoint, destination) => {
|
|
367
|
-
const startingPointUrl = coordinatesToUrlText(startingPoint);
|
|
368
|
-
const destinationUrl = coordinatesToUrlText(destination);
|
|
369
|
-
const url = `https://www.google.com/maps/dir/?api=1&origin=${startingPointUrl}&destination=${destinationUrl}`;
|
|
370
|
-
window.open(url);
|
|
371
|
-
};
|
|
372
|
-
const worldBounds = {
|
|
373
|
-
type: "MultiPoint",
|
|
374
|
-
coordinates: [
|
|
375
|
-
[90, -180],
|
|
376
|
-
[-90, 180]
|
|
377
|
-
]
|
|
378
|
-
};
|
|
379
327
|
const createMultiPointGeometry = (coordinates) => {
|
|
380
328
|
return {
|
|
381
329
|
type: "MultiPoint",
|
|
382
330
|
coordinates
|
|
383
331
|
};
|
|
384
332
|
};
|
|
333
|
+
const coordinatesAreEqual = (a, b) => {
|
|
334
|
+
return a[0] === b[0] && a[1] === b[1];
|
|
335
|
+
};
|
|
385
336
|
function hex(buffer) {
|
|
386
337
|
const hashArray = new Uint8Array(buffer);
|
|
387
338
|
return hashArray.reduce((data, byte) => data + byte.toString(16).padStart(2, "0"), "");
|
|
@@ -533,9 +484,6 @@ var __publicField = (obj, key, value) => {
|
|
|
533
484
|
return v.file_sha1 === value.file_sha1;
|
|
534
485
|
}) === index;
|
|
535
486
|
}
|
|
536
|
-
function boundsContainPoint(bounds, coordinates) {
|
|
537
|
-
return bounds[0][0] > coordinates[0] && bounds[1][0] < coordinates[0] && bounds[0][1] > coordinates[1] && bounds[1][1] < coordinates[1];
|
|
538
|
-
}
|
|
539
487
|
const emailRegex = /^.+@.+\..+$/;
|
|
540
488
|
const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
|
|
541
489
|
const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
|
|
@@ -747,15 +695,15 @@ var __publicField = (obj, key, value) => {
|
|
|
747
695
|
};
|
|
748
696
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
749
697
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
750
|
-
const initialState$
|
|
698
|
+
const initialState$B = {
|
|
751
699
|
accessToken: "",
|
|
752
700
|
refreshToken: "",
|
|
753
701
|
isLoggedIn: false
|
|
754
702
|
};
|
|
755
703
|
const authSlice = toolkit.createSlice({
|
|
756
704
|
name: "auth",
|
|
757
|
-
initialState: initialState$
|
|
758
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
705
|
+
initialState: initialState$B,
|
|
706
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
|
|
759
707
|
reducers: {
|
|
760
708
|
setTokens: (state, action) => {
|
|
761
709
|
state.accessToken = action.payload.accessToken;
|
|
@@ -843,11 +791,11 @@ var __publicField = (obj, key, value) => {
|
|
|
843
791
|
};
|
|
844
792
|
}
|
|
845
793
|
const categoryAdapter = createModelAdapter((category) => category.offline_id);
|
|
846
|
-
const initialState$
|
|
794
|
+
const initialState$A = categoryAdapter.getInitialState({});
|
|
847
795
|
const categorySlice = toolkit.createSlice({
|
|
848
796
|
name: "categories",
|
|
849
|
-
initialState: initialState$
|
|
850
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
797
|
+
initialState: initialState$A,
|
|
798
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$A)),
|
|
851
799
|
reducers: {
|
|
852
800
|
initializeCategories: categoryAdapter.initialize,
|
|
853
801
|
addCategory: categoryAdapter.addOne,
|
|
@@ -891,11 +839,11 @@ var __publicField = (obj, key, value) => {
|
|
|
891
839
|
};
|
|
892
840
|
const categoryReducer = categorySlice.reducer;
|
|
893
841
|
const assetAdapter = createModelAdapter((asset) => asset.offline_id);
|
|
894
|
-
const initialState$
|
|
842
|
+
const initialState$z = assetAdapter.getInitialState({});
|
|
895
843
|
const assetSlice = toolkit.createSlice({
|
|
896
844
|
name: "assets",
|
|
897
|
-
initialState: initialState$
|
|
898
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
845
|
+
initialState: initialState$z,
|
|
846
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
|
|
899
847
|
reducers: {
|
|
900
848
|
initializeAssets: assetAdapter.initialize,
|
|
901
849
|
addAsset: assetAdapter.addOne,
|
|
@@ -947,11 +895,11 @@ var __publicField = (obj, key, value) => {
|
|
|
947
895
|
};
|
|
948
896
|
const assetReducer = assetSlice.reducer;
|
|
949
897
|
const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
950
|
-
const initialState$
|
|
898
|
+
const initialState$y = assetAttachmentAdapter.getInitialState({});
|
|
951
899
|
const assetAttachmentSlice = toolkit.createSlice({
|
|
952
900
|
name: "assetAttachments",
|
|
953
|
-
initialState: initialState$
|
|
954
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
901
|
+
initialState: initialState$y,
|
|
902
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
|
|
955
903
|
reducers: {
|
|
956
904
|
initializeAssetAttachments: assetAttachmentAdapter.initialize,
|
|
957
905
|
addAssetAttachment: assetAttachmentAdapter.addOne,
|
|
@@ -1012,11 +960,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1012
960
|
const assetStageCompletionAdapter = createModelAdapter(
|
|
1013
961
|
(stageCompletion) => stageCompletion.offline_id
|
|
1014
962
|
);
|
|
1015
|
-
const initialState$
|
|
963
|
+
const initialState$x = assetStageCompletionAdapter.getInitialState({});
|
|
1016
964
|
const assetStageCompletionSlice = toolkit.createSlice({
|
|
1017
965
|
name: "assetStageCompletions",
|
|
1018
|
-
initialState: initialState$
|
|
1019
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
966
|
+
initialState: initialState$x,
|
|
967
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
|
|
1020
968
|
reducers: {
|
|
1021
969
|
initializeAssetStageCompletions: assetStageCompletionAdapter.initialize,
|
|
1022
970
|
addAssetStageCompletion: assetStageCompletionAdapter.addOne,
|
|
@@ -1078,11 +1026,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1078
1026
|
);
|
|
1079
1027
|
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1080
1028
|
const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
|
|
1081
|
-
const initialState$
|
|
1029
|
+
const initialState$w = assetStageAdapter.getInitialState({});
|
|
1082
1030
|
const assetStageSlice = toolkit.createSlice({
|
|
1083
1031
|
name: "assetStages",
|
|
1084
|
-
initialState: initialState$
|
|
1085
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1032
|
+
initialState: initialState$w,
|
|
1033
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
|
|
1086
1034
|
reducers: {
|
|
1087
1035
|
initializeAssetStages: assetStageAdapter.initialize,
|
|
1088
1036
|
setAssetStage: assetStageAdapter.setOne,
|
|
@@ -1162,11 +1110,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1162
1110
|
})
|
|
1163
1111
|
);
|
|
1164
1112
|
const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
|
|
1165
|
-
const initialState$
|
|
1113
|
+
const initialState$v = assetTypeAdapter.getInitialState({});
|
|
1166
1114
|
const assetTypeSlice = toolkit.createSlice({
|
|
1167
1115
|
name: "assetTypes",
|
|
1168
|
-
initialState: initialState$
|
|
1169
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1116
|
+
initialState: initialState$v,
|
|
1117
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
|
|
1170
1118
|
reducers: {
|
|
1171
1119
|
initializeAssetTypes: assetTypeAdapter.initialize,
|
|
1172
1120
|
setAssetType: assetTypeAdapter.setOne,
|
|
@@ -1219,11 +1167,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1219
1167
|
const assetTypeAttachmentAdapter = createModelAdapter(
|
|
1220
1168
|
(attachment) => attachment.offline_id
|
|
1221
1169
|
);
|
|
1222
|
-
const initialState$
|
|
1170
|
+
const initialState$u = assetTypeAttachmentAdapter.getInitialState({});
|
|
1223
1171
|
const assetTypeAttachmentSlice = toolkit.createSlice({
|
|
1224
1172
|
name: "assetTypeAttachments",
|
|
1225
|
-
initialState: initialState$
|
|
1226
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1173
|
+
initialState: initialState$u,
|
|
1174
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
|
|
1227
1175
|
reducers: {
|
|
1228
1176
|
initializeAssetTypeAttachments: assetTypeAttachmentAdapter.initialize,
|
|
1229
1177
|
addAssetTypeAttachment: assetTypeAttachmentAdapter.addOne,
|
|
@@ -1282,12 +1230,12 @@ var __publicField = (obj, key, value) => {
|
|
|
1282
1230
|
);
|
|
1283
1231
|
const assetTypeAttachmentReducer = assetTypeAttachmentSlice.reducer;
|
|
1284
1232
|
const issueAdapter = createModelAdapter((issue) => issue.offline_id);
|
|
1285
|
-
const initialState$
|
|
1233
|
+
const initialState$t = issueAdapter.getInitialState({});
|
|
1286
1234
|
const issueSlice = toolkit.createSlice({
|
|
1287
1235
|
name: "issues",
|
|
1288
|
-
initialState: initialState$
|
|
1236
|
+
initialState: initialState$t,
|
|
1289
1237
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1290
|
-
Object.assign(state, initialState$
|
|
1238
|
+
Object.assign(state, initialState$t);
|
|
1291
1239
|
}),
|
|
1292
1240
|
reducers: {
|
|
1293
1241
|
initializeIssues: issueAdapter.initialize,
|
|
@@ -1319,12 +1267,12 @@ var __publicField = (obj, key, value) => {
|
|
|
1319
1267
|
);
|
|
1320
1268
|
const issueReducer = issueSlice.reducer;
|
|
1321
1269
|
const issueTypeAdapter = createModelAdapter((issueType) => issueType.offline_id);
|
|
1322
|
-
const initialState$
|
|
1270
|
+
const initialState$s = issueTypeAdapter.getInitialState({});
|
|
1323
1271
|
const issueTypeSlice = toolkit.createSlice({
|
|
1324
1272
|
name: "issueTypes",
|
|
1325
|
-
initialState: initialState$
|
|
1273
|
+
initialState: initialState$s,
|
|
1326
1274
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1327
|
-
Object.assign(state, initialState$
|
|
1275
|
+
Object.assign(state, initialState$s);
|
|
1328
1276
|
}),
|
|
1329
1277
|
reducers: {
|
|
1330
1278
|
initializeIssueTypes: issueTypeAdapter.initialize,
|
|
@@ -1381,15 +1329,15 @@ var __publicField = (obj, key, value) => {
|
|
|
1381
1329
|
return selectIssuesOfIssueType(issueTypeId)(state).length;
|
|
1382
1330
|
};
|
|
1383
1331
|
const issueTypeReducer = issueTypeSlice.reducer;
|
|
1384
|
-
const initialState$
|
|
1332
|
+
const initialState$r = {
|
|
1385
1333
|
s3Urls: {}
|
|
1386
1334
|
};
|
|
1387
1335
|
const msPerHour = 1e3 * 60 * 60;
|
|
1388
1336
|
const msPerWeek = msPerHour * 24 * 7;
|
|
1389
1337
|
const fileSlice = toolkit.createSlice({
|
|
1390
1338
|
name: "file",
|
|
1391
|
-
initialState: initialState$
|
|
1392
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1339
|
+
initialState: initialState$r,
|
|
1340
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
|
|
1393
1341
|
reducers: {
|
|
1394
1342
|
setUploadUrl: (state, action) => {
|
|
1395
1343
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -1416,14 +1364,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1416
1364
|
return url;
|
|
1417
1365
|
};
|
|
1418
1366
|
const fileReducer = fileSlice.reducer;
|
|
1419
|
-
const initialState$
|
|
1367
|
+
const initialState$q = {
|
|
1420
1368
|
users: {},
|
|
1421
1369
|
currentUser: null
|
|
1422
1370
|
};
|
|
1423
1371
|
const userSlice = toolkit.createSlice({
|
|
1424
1372
|
name: "users",
|
|
1425
|
-
initialState: initialState$
|
|
1426
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1373
|
+
initialState: initialState$q,
|
|
1374
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1427
1375
|
reducers: {
|
|
1428
1376
|
setUsers: (state, action) => {
|
|
1429
1377
|
const usersMapping = {};
|
|
@@ -1481,11 +1429,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1481
1429
|
const organizationAccessAdapter = createModelAdapter(
|
|
1482
1430
|
(organizationAccess) => organizationAccess.offline_id
|
|
1483
1431
|
);
|
|
1484
|
-
const initialState$
|
|
1432
|
+
const initialState$p = organizationAccessAdapter.getInitialState({});
|
|
1485
1433
|
const organizationAccessSlice = toolkit.createSlice({
|
|
1486
1434
|
name: "organizationAccess",
|
|
1487
|
-
initialState: initialState$
|
|
1488
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1435
|
+
initialState: initialState$p,
|
|
1436
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
1489
1437
|
reducers: {
|
|
1490
1438
|
initializeOrganizationAccesses: organizationAccessAdapter.initialize,
|
|
1491
1439
|
updateOrganizationAccess: organizationAccessAdapter.updateOne,
|
|
@@ -1522,11 +1470,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1522
1470
|
};
|
|
1523
1471
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
1524
1472
|
const licenseAdapter = createModelAdapter((license) => license.offline_id);
|
|
1525
|
-
const initialState$
|
|
1473
|
+
const initialState$o = licenseAdapter.getInitialState({});
|
|
1526
1474
|
const licenseSlice = toolkit.createSlice({
|
|
1527
1475
|
name: "license",
|
|
1528
|
-
initialState: initialState$
|
|
1529
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1476
|
+
initialState: initialState$o,
|
|
1477
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1530
1478
|
reducers: {
|
|
1531
1479
|
initializeLicences: licenseAdapter.initialize,
|
|
1532
1480
|
addLicenses: licenseAdapter.addMany,
|
|
@@ -1551,11 +1499,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1551
1499
|
);
|
|
1552
1500
|
const licenseReducer = licenseSlice.reducer;
|
|
1553
1501
|
const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
|
|
1554
|
-
const initialState$
|
|
1502
|
+
const initialState$n = projectAccessAdapter.getInitialState({});
|
|
1555
1503
|
const projectAccessSlice = toolkit.createSlice({
|
|
1556
1504
|
name: "projectAccess",
|
|
1557
|
-
initialState: initialState$
|
|
1558
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1505
|
+
initialState: initialState$n,
|
|
1506
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
1559
1507
|
reducers: {
|
|
1560
1508
|
initializeProjectAccesses: projectAccessAdapter.initialize,
|
|
1561
1509
|
updateProjectAccess: projectAccessAdapter.updateOne,
|
|
@@ -1596,14 +1544,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1596
1544
|
return projectAccesses;
|
|
1597
1545
|
};
|
|
1598
1546
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
1599
|
-
const initialState$
|
|
1547
|
+
const initialState$m = {
|
|
1600
1548
|
projects: {},
|
|
1601
1549
|
activeProjectId: null
|
|
1602
1550
|
};
|
|
1603
1551
|
const projectSlice = toolkit.createSlice({
|
|
1604
1552
|
name: "projects",
|
|
1605
|
-
initialState: initialState$
|
|
1606
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1553
|
+
initialState: initialState$m,
|
|
1554
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
1607
1555
|
reducers: {
|
|
1608
1556
|
setProjects: (state, action) => {
|
|
1609
1557
|
const projectsMap = {};
|
|
@@ -1710,13 +1658,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1710
1658
|
});
|
|
1711
1659
|
}
|
|
1712
1660
|
);
|
|
1713
|
-
const initialState$
|
|
1661
|
+
const initialState$l = {
|
|
1714
1662
|
organizations: {}
|
|
1715
1663
|
};
|
|
1716
1664
|
const organizationSlice = toolkit.createSlice({
|
|
1717
1665
|
name: "organizations",
|
|
1718
|
-
initialState: initialState$
|
|
1719
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1666
|
+
initialState: initialState$l,
|
|
1667
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
|
|
1720
1668
|
reducers: {
|
|
1721
1669
|
setOrganizations: (state, action) => {
|
|
1722
1670
|
for (const org of action.payload) {
|
|
@@ -1807,14 +1755,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1807
1755
|
}
|
|
1808
1756
|
};
|
|
1809
1757
|
};
|
|
1810
|
-
const initialState$
|
|
1758
|
+
const initialState$k = {
|
|
1811
1759
|
deletedRequests: [],
|
|
1812
1760
|
latestRetryTime: 0
|
|
1813
1761
|
};
|
|
1814
1762
|
const outboxSlice = toolkit.createSlice({
|
|
1815
1763
|
name: "outbox",
|
|
1816
|
-
initialState: initialState$
|
|
1817
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1764
|
+
initialState: initialState$k,
|
|
1765
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
|
|
1818
1766
|
reducers: {
|
|
1819
1767
|
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
1820
1768
|
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
@@ -1846,15 +1794,15 @@ var __publicField = (obj, key, value) => {
|
|
|
1846
1794
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
1847
1795
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
1848
1796
|
const outboxReducer = outboxSlice.reducer;
|
|
1849
|
-
const initialState$
|
|
1797
|
+
const initialState$j = {
|
|
1850
1798
|
projectFiles: {},
|
|
1851
1799
|
activeProjectFileId: null,
|
|
1852
1800
|
isImportingProjectFile: false
|
|
1853
1801
|
};
|
|
1854
1802
|
const projectFileSlice = toolkit.createSlice({
|
|
1855
1803
|
name: "projectFiles",
|
|
1856
|
-
initialState: initialState$
|
|
1857
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1804
|
+
initialState: initialState$j,
|
|
1805
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
|
|
1858
1806
|
reducers: {
|
|
1859
1807
|
addOrReplaceProjectFiles: (state, action) => {
|
|
1860
1808
|
for (let fileObj of action.payload) {
|
|
@@ -1941,11 +1889,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1941
1889
|
};
|
|
1942
1890
|
const projectFileReducer = projectFileSlice.reducer;
|
|
1943
1891
|
const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
1944
|
-
const initialState$
|
|
1892
|
+
const initialState$i = projectAttachmentAdapter.getInitialState({});
|
|
1945
1893
|
const projectAttachmentSlice = toolkit.createSlice({
|
|
1946
1894
|
name: "projectAttachments",
|
|
1947
|
-
initialState: initialState$
|
|
1948
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1895
|
+
initialState: initialState$i,
|
|
1896
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
|
|
1949
1897
|
reducers: {
|
|
1950
1898
|
initializeProjectAttachments: projectAttachmentAdapter.initialize,
|
|
1951
1899
|
addProjectAttachment: projectAttachmentAdapter.addOne,
|
|
@@ -2000,12 +1948,12 @@ var __publicField = (obj, key, value) => {
|
|
|
2000
1948
|
)
|
|
2001
1949
|
);
|
|
2002
1950
|
const projectAttachmentReducer = projectAttachmentSlice.reducer;
|
|
2003
|
-
const initialState$
|
|
1951
|
+
const initialState$h = {
|
|
2004
1952
|
isRehydrated: false
|
|
2005
1953
|
};
|
|
2006
1954
|
const rehydratedSlice = toolkit.createSlice({
|
|
2007
1955
|
name: "rehydrated",
|
|
2008
|
-
initialState: initialState$
|
|
1956
|
+
initialState: initialState$h,
|
|
2009
1957
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
2010
1958
|
reducers: {
|
|
2011
1959
|
setRehydrated: (state, action) => {
|
|
@@ -2030,11 +1978,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2030
1978
|
}
|
|
2031
1979
|
};
|
|
2032
1980
|
const formRevisionAdapter = createModelAdapter((revision) => revision.offline_id);
|
|
2033
|
-
const initialState$
|
|
1981
|
+
const initialState$g = formRevisionAdapter.getInitialState({});
|
|
2034
1982
|
const formRevisionsSlice = toolkit.createSlice({
|
|
2035
1983
|
name: "formRevisions",
|
|
2036
|
-
initialState: initialState$
|
|
2037
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1984
|
+
initialState: initialState$g,
|
|
1985
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
2038
1986
|
reducers: {
|
|
2039
1987
|
initializeFormRevisions: formRevisionAdapter.initialize,
|
|
2040
1988
|
setFormRevision: formRevisionAdapter.setOne,
|
|
@@ -2093,13 +2041,24 @@ var __publicField = (obj, key, value) => {
|
|
|
2093
2041
|
}
|
|
2094
2042
|
)
|
|
2095
2043
|
);
|
|
2044
|
+
const selectLatestFormRevisionByForm = toolkit.createSelector([selectFormRevisionMapping], (revisions) => {
|
|
2045
|
+
const latestRevisions = {};
|
|
2046
|
+
for (const revision of Object.values(revisions)) {
|
|
2047
|
+
const formId = revision.form;
|
|
2048
|
+
const currentLatestRevision = latestRevisions[formId];
|
|
2049
|
+
if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
|
|
2050
|
+
latestRevisions[formId] = revision;
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
return latestRevisions;
|
|
2054
|
+
});
|
|
2096
2055
|
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
2097
2056
|
const formAdapter = createModelAdapter((form) => form.offline_id);
|
|
2098
|
-
const initialState$
|
|
2057
|
+
const initialState$f = formAdapter.getInitialState({});
|
|
2099
2058
|
const formSlice = toolkit.createSlice({
|
|
2100
2059
|
name: "forms",
|
|
2101
|
-
initialState: initialState$
|
|
2102
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2060
|
+
initialState: initialState$f,
|
|
2061
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
|
|
2103
2062
|
reducers: {
|
|
2104
2063
|
initializeForms: formAdapter.initialize,
|
|
2105
2064
|
setForm: formAdapter.setOne,
|
|
@@ -2117,9 +2076,6 @@ var __publicField = (obj, key, value) => {
|
|
|
2117
2076
|
const selectForms = toolkit.createSelector([selectFormMapping], (formsMapping) => {
|
|
2118
2077
|
return Object.values(formsMapping);
|
|
2119
2078
|
});
|
|
2120
|
-
const selectFormById = (formId) => (state) => {
|
|
2121
|
-
return state.formReducer.instances[formId];
|
|
2122
|
-
};
|
|
2123
2079
|
const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
2124
2080
|
toolkit.createSelector(
|
|
2125
2081
|
[
|
|
@@ -2145,12 +2101,37 @@ var __publicField = (obj, key, value) => {
|
|
|
2145
2101
|
{ memoizeOptions: { equalityCheck: shallowEqual } }
|
|
2146
2102
|
)
|
|
2147
2103
|
);
|
|
2104
|
+
const selectFormById = (formId) => (state) => {
|
|
2105
|
+
return state.formReducer.instances[formId];
|
|
2106
|
+
};
|
|
2107
|
+
const selectFormOfAssetType = restructureCreateSelectorWithArgs(
|
|
2108
|
+
toolkit.createSelector(
|
|
2109
|
+
[selectFormMapping, (_state, assetTypeId) => assetTypeId],
|
|
2110
|
+
(formsMapping, assetTypeId) => {
|
|
2111
|
+
return Object.values(formsMapping).find((form) => form.asset_type === assetTypeId);
|
|
2112
|
+
}
|
|
2113
|
+
)
|
|
2114
|
+
);
|
|
2115
|
+
const selectFormOfIssueType = restructureCreateSelectorWithArgs(
|
|
2116
|
+
toolkit.createSelector(
|
|
2117
|
+
[selectFormMapping, (_state, issueTypeId) => issueTypeId],
|
|
2118
|
+
(formsMapping, issueTypeId) => {
|
|
2119
|
+
return Object.values(formsMapping).find((form) => form.issue_type === issueTypeId);
|
|
2120
|
+
}
|
|
2121
|
+
)
|
|
2122
|
+
);
|
|
2123
|
+
const selectFormsCount = toolkit.createSelector([selectFormMapping], (formsMapping) => {
|
|
2124
|
+
return Object.keys(formsMapping).length;
|
|
2125
|
+
});
|
|
2126
|
+
const selectGeneralFormCount = toolkit.createSelector([selectFormMapping], (formsMapping) => {
|
|
2127
|
+
return Object.values(formsMapping).filter((form) => !form.asset_type).length;
|
|
2128
|
+
});
|
|
2148
2129
|
const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
|
|
2149
|
-
const initialState$
|
|
2130
|
+
const initialState$e = submissionAdapter.getInitialState({});
|
|
2150
2131
|
const formSubmissionSlice = toolkit.createSlice({
|
|
2151
2132
|
name: "formSubmissions",
|
|
2152
|
-
initialState: initialState$
|
|
2153
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2133
|
+
initialState: initialState$e,
|
|
2134
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
|
|
2154
2135
|
reducers: {
|
|
2155
2136
|
initializeFormSubmissions: submissionAdapter.initialize,
|
|
2156
2137
|
setFormSubmission: submissionAdapter.setOne,
|
|
@@ -2206,6 +2187,43 @@ var __publicField = (obj, key, value) => {
|
|
|
2206
2187
|
}
|
|
2207
2188
|
)
|
|
2208
2189
|
);
|
|
2190
|
+
const selectFormSubmissionsByFormRevisions = toolkit.createSelector([selectFormRevisionMapping, selectFormSubmissions], (revisions, submissions) => {
|
|
2191
|
+
var _a2;
|
|
2192
|
+
const submissionMapping = {};
|
|
2193
|
+
for (const revisionId in revisions) {
|
|
2194
|
+
submissionMapping[revisionId] = [];
|
|
2195
|
+
}
|
|
2196
|
+
for (const submission of submissions) {
|
|
2197
|
+
(_a2 = submissionMapping[submission.form_revision]) == null ? void 0 : _a2.push(submission);
|
|
2198
|
+
}
|
|
2199
|
+
return submissionMapping;
|
|
2200
|
+
});
|
|
2201
|
+
const selectSortedFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
2202
|
+
toolkit.createSelector(
|
|
2203
|
+
[
|
|
2204
|
+
selectFormRevisionMapping,
|
|
2205
|
+
selectFormSubmissionsByFormRevisions,
|
|
2206
|
+
(_state, formId) => formId
|
|
2207
|
+
],
|
|
2208
|
+
(revisionsMapping, submissionsByRevision, formId) => {
|
|
2209
|
+
const submissionsByFormRevisions = {};
|
|
2210
|
+
for (const revisionId in revisionsMapping) {
|
|
2211
|
+
const revision = revisionsMapping[revisionId];
|
|
2212
|
+
const submissionsOfRevision = submissionsByRevision[revisionId];
|
|
2213
|
+
if (revision && submissionsOfRevision && revision.form === formId) {
|
|
2214
|
+
submissionsByFormRevisions[revisionId] = submissionsOfRevision.sort(
|
|
2215
|
+
(a, b) => a.submitted_at < b.submitted_at ? -1 : 1
|
|
2216
|
+
);
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
return Object.entries(submissionsByFormRevisions).sort((a, b) => {
|
|
2220
|
+
const aRevision = revisionsMapping[a[0]];
|
|
2221
|
+
const bRevision = revisionsMapping[b[0]];
|
|
2222
|
+
return formRevisionSortFn(aRevision, bRevision);
|
|
2223
|
+
}).map(([_revisionId, submissions]) => submissions).flat();
|
|
2224
|
+
}
|
|
2225
|
+
)
|
|
2226
|
+
);
|
|
2209
2227
|
const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2210
2228
|
toolkit.createSelector(
|
|
2211
2229
|
[selectFormSubmissions, (_state, issueId) => issueId],
|
|
@@ -2216,6 +2234,54 @@ var __publicField = (obj, key, value) => {
|
|
|
2216
2234
|
}
|
|
2217
2235
|
)
|
|
2218
2236
|
);
|
|
2237
|
+
const selectAttachedFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2238
|
+
toolkit.createSelector(
|
|
2239
|
+
[
|
|
2240
|
+
(state) => state.issueReducer.instances,
|
|
2241
|
+
(state) => state.formReducer.instances,
|
|
2242
|
+
(state) => state.formRevisionReducer.instances,
|
|
2243
|
+
(state) => state.formSubmissionReducer.instances,
|
|
2244
|
+
(_state, issueId) => issueId
|
|
2245
|
+
],
|
|
2246
|
+
(issues, forms, formRevisions, submissions, issueId) => {
|
|
2247
|
+
const issue = issues[issueId];
|
|
2248
|
+
if (!issue)
|
|
2249
|
+
return [];
|
|
2250
|
+
if (!issue.issue_type) {
|
|
2251
|
+
return Object.values(submissions).filter((submission) => submission.issue === issueId);
|
|
2252
|
+
}
|
|
2253
|
+
const issueTypeForms = new Set(
|
|
2254
|
+
Object.keys(forms).filter((formId) => forms[formId].issue_type === issue.issue_type)
|
|
2255
|
+
);
|
|
2256
|
+
const issueTypeFormRevisions = new Set(
|
|
2257
|
+
Object.keys(formRevisions).filter(
|
|
2258
|
+
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2259
|
+
)
|
|
2260
|
+
);
|
|
2261
|
+
return Object.values(submissions).filter(
|
|
2262
|
+
(submission) => submission.issue === issueId && !issueTypeFormRevisions.has(submission.form_revision)
|
|
2263
|
+
);
|
|
2264
|
+
}
|
|
2265
|
+
)
|
|
2266
|
+
);
|
|
2267
|
+
const selectFormSubmissionsByIssues = restructureCreateSelectorWithArgs(
|
|
2268
|
+
toolkit.createSelector(
|
|
2269
|
+
[selectFormSubmissions, (_state, issueIds) => issueIds],
|
|
2270
|
+
(submissions, issueIds) => {
|
|
2271
|
+
var _a2;
|
|
2272
|
+
const issueSubmissions = {};
|
|
2273
|
+
for (const issueId of issueIds) {
|
|
2274
|
+
issueSubmissions[issueId] = [];
|
|
2275
|
+
}
|
|
2276
|
+
for (const submission of submissions) {
|
|
2277
|
+
if (submission.issue && issueIds.includes(submission.issue)) {
|
|
2278
|
+
(_a2 = issueSubmissions[submission.issue]) == null ? void 0 : _a2.push(submission);
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
return issueSubmissions;
|
|
2282
|
+
}
|
|
2283
|
+
)
|
|
2284
|
+
);
|
|
2219
2285
|
const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
2220
2286
|
toolkit.createSelector(
|
|
2221
2287
|
[selectFormSubmissions, (_state, assetId) => assetId],
|
|
@@ -2226,15 +2292,62 @@ var __publicField = (obj, key, value) => {
|
|
|
2226
2292
|
}
|
|
2227
2293
|
)
|
|
2228
2294
|
);
|
|
2295
|
+
const selectAttachedFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
2296
|
+
toolkit.createSelector(
|
|
2297
|
+
[
|
|
2298
|
+
(state) => state.assetReducer.instances,
|
|
2299
|
+
(state) => state.formReducer.instances,
|
|
2300
|
+
(state) => state.formRevisionReducer.instances,
|
|
2301
|
+
(state) => state.formSubmissionReducer.instances,
|
|
2302
|
+
(_state, assetId) => assetId
|
|
2303
|
+
],
|
|
2304
|
+
(assets, forms, formRevisions, submissions, assetId) => {
|
|
2305
|
+
const asset = assets[assetId];
|
|
2306
|
+
if (!asset)
|
|
2307
|
+
return [];
|
|
2308
|
+
if (!asset.asset_type) {
|
|
2309
|
+
return Object.values(submissions).filter((submission) => submission.asset === assetId);
|
|
2310
|
+
}
|
|
2311
|
+
const issueTypeForms = new Set(
|
|
2312
|
+
Object.keys(forms).filter((formId) => forms[formId].asset_type === asset.asset_type)
|
|
2313
|
+
);
|
|
2314
|
+
const issueTypeFormRevisions = new Set(
|
|
2315
|
+
Object.keys(formRevisions).filter(
|
|
2316
|
+
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2317
|
+
)
|
|
2318
|
+
);
|
|
2319
|
+
return Object.values(submissions).filter(
|
|
2320
|
+
(submission) => submission.asset === assetId && !issueTypeFormRevisions.has(submission.form_revision)
|
|
2321
|
+
);
|
|
2322
|
+
}
|
|
2323
|
+
)
|
|
2324
|
+
);
|
|
2325
|
+
const selectFormSubmissionsByAssets = toolkit.createSelector(
|
|
2326
|
+
[selectFormSubmissionsMapping, selectAssetsMapping],
|
|
2327
|
+
(submissions, assets) => {
|
|
2328
|
+
var _a2;
|
|
2329
|
+
const assetSubmissionMapping = {};
|
|
2330
|
+
for (const assetId in assets) {
|
|
2331
|
+
assetSubmissionMapping[assetId] = [];
|
|
2332
|
+
}
|
|
2333
|
+
for (const submissionId in submissions) {
|
|
2334
|
+
const submission = submissions[submissionId];
|
|
2335
|
+
if (submission.asset) {
|
|
2336
|
+
(_a2 = assetSubmissionMapping[submission.asset]) == null ? void 0 : _a2.push(submission);
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
return assetSubmissionMapping;
|
|
2340
|
+
}
|
|
2341
|
+
);
|
|
2229
2342
|
const formSubmissionReducer = formSubmissionSlice.reducer;
|
|
2230
2343
|
const formSubmissionAttachmentAdapter = createModelAdapter(
|
|
2231
2344
|
(attachment) => attachment.offline_id
|
|
2232
2345
|
);
|
|
2233
|
-
const initialState$
|
|
2346
|
+
const initialState$d = formSubmissionAttachmentAdapter.getInitialState({});
|
|
2234
2347
|
const formSubmissionAttachmentSlice = toolkit.createSlice({
|
|
2235
2348
|
name: "formSubmissionAttachments",
|
|
2236
|
-
initialState: initialState$
|
|
2237
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2349
|
+
initialState: initialState$d,
|
|
2350
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
|
|
2238
2351
|
reducers: {
|
|
2239
2352
|
initializeFormSubmissionAttachments: formSubmissionAttachmentAdapter.initialize,
|
|
2240
2353
|
addFormSubmissionAttachment: formSubmissionAttachmentAdapter.addOne,
|
|
@@ -2277,9 +2390,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2277
2390
|
[selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
|
|
2278
2391
|
(attachmentsMapping, submissionId) => {
|
|
2279
2392
|
return fallbackToEmptyArray(
|
|
2280
|
-
Object.values(attachmentsMapping).filter(
|
|
2281
|
-
(attachment) => attachment.form_submission === submissionId
|
|
2282
|
-
)
|
|
2393
|
+
Object.values(attachmentsMapping).filter((attachment) => attachment.submission === submissionId)
|
|
2283
2394
|
);
|
|
2284
2395
|
}
|
|
2285
2396
|
)
|
|
@@ -2288,11 +2399,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2288
2399
|
const formRevisionAttachmentAdapter = createModelAdapter(
|
|
2289
2400
|
(attachment) => attachment.offline_id
|
|
2290
2401
|
);
|
|
2291
|
-
const initialState$
|
|
2402
|
+
const initialState$c = formRevisionAttachmentAdapter.getInitialState({});
|
|
2292
2403
|
const formRevisionAttachmentSlice = toolkit.createSlice({
|
|
2293
2404
|
name: "formRevisionAttachments",
|
|
2294
|
-
initialState: initialState$
|
|
2295
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2405
|
+
initialState: initialState$c,
|
|
2406
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
2296
2407
|
reducers: {
|
|
2297
2408
|
initializeFormRevisionAttachments: formRevisionAttachmentAdapter.initialize,
|
|
2298
2409
|
addFormRevisionAttachment: formRevisionAttachmentAdapter.addOne,
|
|
@@ -2324,17 +2435,17 @@ var __publicField = (obj, key, value) => {
|
|
|
2324
2435
|
[selectFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
|
|
2325
2436
|
(attachments, revisionId) => {
|
|
2326
2437
|
return fallbackToEmptyArray(
|
|
2327
|
-
Object.values(attachments).filter((attachment) => attachment.
|
|
2438
|
+
Object.values(attachments).filter((attachment) => attachment.revision === revisionId)
|
|
2328
2439
|
);
|
|
2329
2440
|
}
|
|
2330
2441
|
)
|
|
2331
2442
|
);
|
|
2332
2443
|
const formRevisionAttachmentReducer = formRevisionAttachmentSlice.reducer;
|
|
2333
2444
|
const workspaceAdapter = createModelAdapter((workspace) => workspace.offline_id);
|
|
2334
|
-
const initialState$
|
|
2445
|
+
const initialState$b = workspaceAdapter.getInitialState({});
|
|
2335
2446
|
const workspaceSlice = toolkit.createSlice({
|
|
2336
2447
|
name: "workspace",
|
|
2337
|
-
initialState: initialState$
|
|
2448
|
+
initialState: initialState$b,
|
|
2338
2449
|
reducers: {
|
|
2339
2450
|
initializeWorkspaces: workspaceAdapter.initialize,
|
|
2340
2451
|
setWorkspaces: workspaceAdapter.setMany,
|
|
@@ -2365,10 +2476,10 @@ var __publicField = (obj, key, value) => {
|
|
|
2365
2476
|
);
|
|
2366
2477
|
const workspaceReducer = workspaceSlice.reducer;
|
|
2367
2478
|
const emailDomainAdapter = createModelAdapter((emailDomain) => emailDomain.offline_id);
|
|
2368
|
-
const initialState$
|
|
2479
|
+
const initialState$a = emailDomainAdapter.getInitialState({});
|
|
2369
2480
|
const emailDomainsSlice = toolkit.createSlice({
|
|
2370
2481
|
name: "emailDomains",
|
|
2371
|
-
initialState: initialState$
|
|
2482
|
+
initialState: initialState$a,
|
|
2372
2483
|
reducers: {
|
|
2373
2484
|
initializeEmailDomains: emailDomainAdapter.initialize,
|
|
2374
2485
|
addEmailDomain: emailDomainAdapter.addOne,
|
|
@@ -2389,14 +2500,14 @@ var __publicField = (obj, key, value) => {
|
|
|
2389
2500
|
)
|
|
2390
2501
|
);
|
|
2391
2502
|
const emailDomainsReducer = emailDomainsSlice.reducer;
|
|
2392
|
-
const initialState$
|
|
2503
|
+
const initialState$9 = {
|
|
2393
2504
|
documents: {}
|
|
2394
2505
|
};
|
|
2395
2506
|
const documentSlice = toolkit.createSlice({
|
|
2396
2507
|
name: "documents",
|
|
2397
|
-
initialState: initialState$
|
|
2508
|
+
initialState: initialState$9,
|
|
2398
2509
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2399
|
-
Object.assign(state, initialState$
|
|
2510
|
+
Object.assign(state, initialState$9);
|
|
2400
2511
|
}),
|
|
2401
2512
|
reducers: {
|
|
2402
2513
|
setDocuments: (state, action) => {
|
|
@@ -2585,11 +2696,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2585
2696
|
);
|
|
2586
2697
|
const documentsReducer = documentSlice.reducer;
|
|
2587
2698
|
const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2588
|
-
const initialState$
|
|
2699
|
+
const initialState$8 = documentAttachmentAdapter.getInitialState({});
|
|
2589
2700
|
const documentAttachmentSlice = toolkit.createSlice({
|
|
2590
2701
|
name: "documentAttachments",
|
|
2591
|
-
initialState: initialState$
|
|
2592
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2702
|
+
initialState: initialState$8,
|
|
2703
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
2593
2704
|
reducers: {
|
|
2594
2705
|
initializeDocumentAttachments: documentAttachmentAdapter.initialize,
|
|
2595
2706
|
addDocumentAttachment: documentAttachmentAdapter.addOne,
|
|
@@ -2648,11 +2759,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2648
2759
|
);
|
|
2649
2760
|
const documentAttachmentReducer = documentAttachmentSlice.reducer;
|
|
2650
2761
|
const teamAdapter = createModelAdapter((team) => team.offline_id);
|
|
2651
|
-
const initialState$
|
|
2762
|
+
const initialState$7 = teamAdapter.getInitialState({});
|
|
2652
2763
|
const teamSlice = toolkit.createSlice({
|
|
2653
2764
|
name: "teams",
|
|
2654
|
-
initialState: initialState$
|
|
2655
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2765
|
+
initialState: initialState$7,
|
|
2766
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
2656
2767
|
reducers: {
|
|
2657
2768
|
setTeam: teamAdapter.setOne,
|
|
2658
2769
|
initializeTeams: teamAdapter.initialize,
|
|
@@ -2703,11 +2814,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2703
2814
|
const agentUserConversationAdapter = createModelAdapter(
|
|
2704
2815
|
(conversation) => conversation.offline_id
|
|
2705
2816
|
);
|
|
2706
|
-
const initialState$
|
|
2817
|
+
const initialState$6 = agentUserConversationAdapter.getInitialState({});
|
|
2707
2818
|
const agentsSlice = toolkit.createSlice({
|
|
2708
2819
|
name: "agents",
|
|
2709
|
-
initialState: initialState$
|
|
2710
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2820
|
+
initialState: initialState$6,
|
|
2821
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
2711
2822
|
reducers: {
|
|
2712
2823
|
initializeConversations: agentUserConversationAdapter.initialize,
|
|
2713
2824
|
addConversation: agentUserConversationAdapter.addOne,
|
|
@@ -2729,11 +2840,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2729
2840
|
);
|
|
2730
2841
|
const agentsReducer = agentsSlice.reducer;
|
|
2731
2842
|
const issueCommentAdapter = createModelAdapter((comment) => comment.offline_id);
|
|
2732
|
-
const initialState$
|
|
2843
|
+
const initialState$5 = issueCommentAdapter.getInitialState({});
|
|
2733
2844
|
const issueCommentSlice = toolkit.createSlice({
|
|
2734
2845
|
name: "issueComments",
|
|
2735
|
-
initialState: initialState$
|
|
2736
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2846
|
+
initialState: initialState$5,
|
|
2847
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
2737
2848
|
reducers: {
|
|
2738
2849
|
addIssueComment: issueCommentAdapter.addOne,
|
|
2739
2850
|
addIssueComments: issueCommentAdapter.addMany,
|
|
@@ -2762,11 +2873,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2762
2873
|
);
|
|
2763
2874
|
const issueCommentReducer = issueCommentSlice.reducer;
|
|
2764
2875
|
const issueUpdateAdapter = createModelAdapter((issueUpdate) => issueUpdate.offline_id);
|
|
2765
|
-
const initialState$
|
|
2876
|
+
const initialState$4 = issueUpdateAdapter.getInitialState({});
|
|
2766
2877
|
const issueUpdateSlice = toolkit.createSlice({
|
|
2767
2878
|
name: "issueUpdates",
|
|
2768
|
-
initialState: initialState$
|
|
2769
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2879
|
+
initialState: initialState$4,
|
|
2880
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
|
|
2770
2881
|
reducers: {
|
|
2771
2882
|
initializeIssueUpdates: issueUpdateAdapter.setMany,
|
|
2772
2883
|
setIssueUpdate: issueUpdateAdapter.setOne,
|
|
@@ -2795,11 +2906,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2795
2906
|
);
|
|
2796
2907
|
const issueUpdateReducer = issueUpdateSlice.reducer;
|
|
2797
2908
|
const issueAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2798
|
-
const initialState$
|
|
2909
|
+
const initialState$3 = issueAttachmentAdapter.getInitialState({});
|
|
2799
2910
|
const issueAttachmentSlice = toolkit.createSlice({
|
|
2800
2911
|
name: "issueAttachments",
|
|
2801
|
-
initialState: initialState$
|
|
2802
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2912
|
+
initialState: initialState$3,
|
|
2913
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
2803
2914
|
reducers: {
|
|
2804
2915
|
initializeIssueAttachments: issueAttachmentAdapter.initialize,
|
|
2805
2916
|
addIssueAttachment: issueAttachmentAdapter.addOne,
|
|
@@ -2857,23 +2968,23 @@ var __publicField = (obj, key, value) => {
|
|
|
2857
2968
|
)
|
|
2858
2969
|
);
|
|
2859
2970
|
const issueAttachmentReducer = issueAttachmentSlice.reducer;
|
|
2860
|
-
const initialState$
|
|
2971
|
+
const initialState$2 = {
|
|
2861
2972
|
version: 0
|
|
2862
2973
|
};
|
|
2863
2974
|
const versioningSlice = toolkit.createSlice({
|
|
2864
2975
|
name: "versioning",
|
|
2865
|
-
initialState: initialState$
|
|
2976
|
+
initialState: initialState$2,
|
|
2866
2977
|
reducers: {}
|
|
2867
2978
|
});
|
|
2868
2979
|
const versioningReducer = versioningSlice.reducer;
|
|
2869
2980
|
const geoImageAdapter = createModelAdapter((model) => model.offline_id);
|
|
2870
|
-
const initialState$
|
|
2981
|
+
const initialState$1 = geoImageAdapter.getInitialState({});
|
|
2871
2982
|
const geoImageSlice = toolkit.createSlice({
|
|
2872
2983
|
name: "geoImages",
|
|
2873
|
-
initialState: initialState$
|
|
2984
|
+
initialState: initialState$1,
|
|
2874
2985
|
extraReducers: (builder) => {
|
|
2875
2986
|
builder.addCase("RESET", (state) => {
|
|
2876
|
-
Object.assign(state, initialState$
|
|
2987
|
+
Object.assign(state, initialState$1);
|
|
2877
2988
|
});
|
|
2878
2989
|
},
|
|
2879
2990
|
reducers: {
|
|
@@ -2911,11 +3022,11 @@ var __publicField = (obj, key, value) => {
|
|
|
2911
3022
|
);
|
|
2912
3023
|
const geoImageReducer = geoImageSlice.reducer;
|
|
2913
3024
|
const issueAssociationAdapter = createModelAdapter((assoc) => assoc.offline_id);
|
|
2914
|
-
const initialState
|
|
3025
|
+
const initialState = issueAssociationAdapter.getInitialState({});
|
|
2915
3026
|
const issueAssociationSlice = toolkit.createSlice({
|
|
2916
3027
|
name: "issueAssociations",
|
|
2917
|
-
initialState
|
|
2918
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState
|
|
3028
|
+
initialState,
|
|
3029
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
|
|
2919
3030
|
reducers: {
|
|
2920
3031
|
initializeIssueAssociations: issueAssociationAdapter.initialize,
|
|
2921
3032
|
addIssueAssociation: issueAssociationAdapter.addOne,
|
|
@@ -2973,429 +3084,29 @@ var __publicField = (obj, key, value) => {
|
|
|
2973
3084
|
)
|
|
2974
3085
|
);
|
|
2975
3086
|
const issueAssociationReducer = issueAssociationSlice.reducer;
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
3087
|
+
let clientStore;
|
|
3088
|
+
function setClientStore(store) {
|
|
3089
|
+
clientStore = store;
|
|
3090
|
+
}
|
|
3091
|
+
function getClientStore() {
|
|
3092
|
+
return clientStore;
|
|
3093
|
+
}
|
|
3094
|
+
let clientSDK;
|
|
3095
|
+
function setClientSDK(sdkCtor) {
|
|
3096
|
+
clientSDK = sdkCtor;
|
|
3097
|
+
}
|
|
3098
|
+
function getClientSDK() {
|
|
3099
|
+
return clientSDK;
|
|
3100
|
+
}
|
|
3101
|
+
const CLASS_NAME_TO_SERVICE = {};
|
|
3102
|
+
class BaseService {
|
|
3103
|
+
constructor(sdk) {
|
|
3104
|
+
__publicField(this, "client");
|
|
3105
|
+
CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
|
|
3106
|
+
this.client = sdk;
|
|
2994
3107
|
}
|
|
2995
|
-
|
|
2996
|
-
|
|
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
|
|
3036
|
-
}
|
|
3037
|
-
});
|
|
3038
|
-
const {
|
|
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
|
|
3096
|
-
}
|
|
3097
|
-
});
|
|
3098
|
-
const {
|
|
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);
|
|
3108
|
+
async enqueueRequest(requestDetails) {
|
|
3109
|
+
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3399
3110
|
}
|
|
3400
3111
|
dispatch(action) {
|
|
3401
3112
|
this.client.store.dispatch(action);
|
|
@@ -3441,15 +3152,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3441
3152
|
issueCommentReducer,
|
|
3442
3153
|
issueUpdateReducer,
|
|
3443
3154
|
geoImageReducer,
|
|
3444
|
-
issueAssociationReducer
|
|
3445
|
-
issueTypeFieldsReducer,
|
|
3446
|
-
issueTypeFieldValuesReducer,
|
|
3447
|
-
issueTypeFieldsAttachmentReducer,
|
|
3448
|
-
issueTypeFieldValuesAttachmentReducer,
|
|
3449
|
-
assetTypeFieldsReducer,
|
|
3450
|
-
assetTypeFieldValuesReducer,
|
|
3451
|
-
assetTypeFieldsAttachmentReducer,
|
|
3452
|
-
assetTypeFieldValuesAttachmentReducer
|
|
3155
|
+
issueAssociationReducer
|
|
3453
3156
|
};
|
|
3454
3157
|
const overmapReducer = toolkit.combineReducers(overmapReducers);
|
|
3455
3158
|
const resetStore = "RESET";
|
|
@@ -4091,6 +3794,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4091
3794
|
description: "Create Category",
|
|
4092
3795
|
method: HttpMethod.POST,
|
|
4093
3796
|
url: "/categories/",
|
|
3797
|
+
queryParams: {
|
|
3798
|
+
workspace_id: payload.workspace.toString()
|
|
3799
|
+
},
|
|
4094
3800
|
payload: offlineCategory,
|
|
4095
3801
|
blockers: [payload.workspace],
|
|
4096
3802
|
blocks: [offlineCategory.offline_id]
|
|
@@ -4303,10 +4009,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4303
4009
|
const result = await this.enqueueRequest({
|
|
4304
4010
|
description: "Get assets",
|
|
4305
4011
|
method: HttpMethod.GET,
|
|
4306
|
-
url:
|
|
4307
|
-
queryParams: {
|
|
4308
|
-
project: projectId.toString()
|
|
4309
|
-
},
|
|
4012
|
+
url: `/projects/${projectId}/assets/`,
|
|
4310
4013
|
blockers: [],
|
|
4311
4014
|
blocks: []
|
|
4312
4015
|
});
|
|
@@ -4327,7 +4030,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4327
4030
|
const promise = this.enqueueRequest({
|
|
4328
4031
|
description: "Add asset stage completion",
|
|
4329
4032
|
method: HttpMethod.POST,
|
|
4330
|
-
url: "/
|
|
4033
|
+
url: "/assets/completions/",
|
|
4331
4034
|
payload: {
|
|
4332
4035
|
offline_id: offlineStageCompletion.offline_id,
|
|
4333
4036
|
submitted_at: submittedAt,
|
|
@@ -4354,7 +4057,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4354
4057
|
const promise = this.enqueueRequest({
|
|
4355
4058
|
description: "Delete asset stage completion",
|
|
4356
4059
|
method: HttpMethod.DELETE,
|
|
4357
|
-
url: `/
|
|
4060
|
+
url: `/assets/completions/${id}/`,
|
|
4358
4061
|
blockers: [id],
|
|
4359
4062
|
blocks: []
|
|
4360
4063
|
});
|
|
@@ -4380,7 +4083,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4380
4083
|
const promise = this.enqueueRequest({
|
|
4381
4084
|
description: "Bulk create asset stage completions",
|
|
4382
4085
|
method: HttpMethod.POST,
|
|
4383
|
-
url: "/
|
|
4086
|
+
url: "/assets/completions/bulk/",
|
|
4384
4087
|
payload: {
|
|
4385
4088
|
submitted_at: submittedAt,
|
|
4386
4089
|
completions: payload
|
|
@@ -4402,7 +4105,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4402
4105
|
const promise = this.enqueueRequest({
|
|
4403
4106
|
description: "Deleting asset stage completions",
|
|
4404
4107
|
method: HttpMethod.DELETE,
|
|
4405
|
-
url: "/
|
|
4108
|
+
url: "/assets/completions/bulk/",
|
|
4406
4109
|
payload: {
|
|
4407
4110
|
completion_ids: ids
|
|
4408
4111
|
},
|
|
@@ -4418,10 +4121,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4418
4121
|
const result = await this.enqueueRequest({
|
|
4419
4122
|
description: "Get asset stage completions",
|
|
4420
4123
|
method: HttpMethod.GET,
|
|
4421
|
-
url:
|
|
4422
|
-
queryParams: {
|
|
4423
|
-
project: projectId.toString()
|
|
4424
|
-
},
|
|
4124
|
+
url: `/projects/${projectId}/asset-stage-completions/`,
|
|
4425
4125
|
blockers: [],
|
|
4426
4126
|
blocks: []
|
|
4427
4127
|
});
|
|
@@ -4442,7 +4142,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4442
4142
|
const promise = this.enqueueRequest({
|
|
4443
4143
|
description: "Add asset stages",
|
|
4444
4144
|
method: HttpMethod.POST,
|
|
4445
|
-
url: "/
|
|
4145
|
+
url: "/assets/stages/bulk/",
|
|
4446
4146
|
payload: {
|
|
4447
4147
|
submitted_at: submittedAt,
|
|
4448
4148
|
asset_type: assetTypeId,
|
|
@@ -4466,7 +4166,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4466
4166
|
return this.enqueueRequest({
|
|
4467
4167
|
description: "Edit asset stages",
|
|
4468
4168
|
method: HttpMethod.PATCH,
|
|
4469
|
-
url: `/
|
|
4169
|
+
url: `/assets/types/${assetTypeId}/bulk-update-stages/`,
|
|
4470
4170
|
payload: {
|
|
4471
4171
|
stages: stagesToUpdate
|
|
4472
4172
|
},
|
|
@@ -4484,7 +4184,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4484
4184
|
const promise = this.enqueueRequest({
|
|
4485
4185
|
description: "Delete asset stages",
|
|
4486
4186
|
method: HttpMethod.DELETE,
|
|
4487
|
-
url: "/
|
|
4187
|
+
url: "/assets/stages/bulk/",
|
|
4488
4188
|
payload: {
|
|
4489
4189
|
stage_ids: idsToDelete
|
|
4490
4190
|
},
|
|
@@ -4509,7 +4209,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4509
4209
|
const promise = this.enqueueRequest({
|
|
4510
4210
|
description: "Update asset stage",
|
|
4511
4211
|
method: HttpMethod.PATCH,
|
|
4512
|
-
url: `/
|
|
4212
|
+
url: `/assets/stages/${assetStage.offline_id}/`,
|
|
4513
4213
|
payload: {
|
|
4514
4214
|
name: payload.name,
|
|
4515
4215
|
description: payload.description,
|
|
@@ -4537,7 +4237,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4537
4237
|
await this.enqueueRequest({
|
|
4538
4238
|
description: "Link asset stage to form",
|
|
4539
4239
|
method: HttpMethod.POST,
|
|
4540
|
-
url: `/
|
|
4240
|
+
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
4541
4241
|
payload: { form: formId },
|
|
4542
4242
|
blockers: [stageId, formId],
|
|
4543
4243
|
blocks: [stageId]
|
|
@@ -4558,7 +4258,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4558
4258
|
await this.enqueueRequest({
|
|
4559
4259
|
description: "Unlink asset stage from form",
|
|
4560
4260
|
method: HttpMethod.DELETE,
|
|
4561
|
-
url: `/
|
|
4261
|
+
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
4562
4262
|
blockers: [stageId, formId],
|
|
4563
4263
|
blocks: [stageId]
|
|
4564
4264
|
});
|
|
@@ -4571,10 +4271,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4571
4271
|
const result = await this.enqueueRequest({
|
|
4572
4272
|
description: "Get asset stages",
|
|
4573
4273
|
method: HttpMethod.GET,
|
|
4574
|
-
url:
|
|
4575
|
-
queryParams: {
|
|
4576
|
-
project: projectId.toString()
|
|
4577
|
-
},
|
|
4274
|
+
url: `/projects/${projectId}/asset-stages/`,
|
|
4578
4275
|
blockers: [],
|
|
4579
4276
|
blocks: []
|
|
4580
4277
|
});
|
|
@@ -4591,12 +4288,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4591
4288
|
projectAttachmentReducer: projectAttachmentReducer2,
|
|
4592
4289
|
formRevisionAttachmentReducer: formRevisionAttachmentReducer2,
|
|
4593
4290
|
formSubmissionAttachmentReducer: formSubmissionAttachmentReducer2,
|
|
4594
|
-
geoImageReducer: geoImageReducer2
|
|
4595
|
-
// fields
|
|
4596
|
-
assetTypeFieldsAttachmentReducer: assetTypeFieldsAttachmentReducer2,
|
|
4597
|
-
assetTypeFieldValuesAttachmentReducer: assetTypeFieldValuesAttachmentReducer2,
|
|
4598
|
-
issueTypeFieldsAttachmentReducer: issueTypeFieldsAttachmentReducer2,
|
|
4599
|
-
issueTypeFieldValuesAttachmentReducer: issueTypeFieldValuesAttachmentReducer2
|
|
4291
|
+
geoImageReducer: geoImageReducer2
|
|
4600
4292
|
} = this.client.store.getState();
|
|
4601
4293
|
const objectsWithSha1 = [].concat(
|
|
4602
4294
|
Object.values(issueAttachmentReducer2.instances),
|
|
@@ -4606,11 +4298,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4606
4298
|
Object.values(projectAttachmentReducer2.instances),
|
|
4607
4299
|
Object.values(formRevisionAttachmentReducer2.instances),
|
|
4608
4300
|
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)
|
|
4301
|
+
Object.values(geoImageReducer2.instances)
|
|
4614
4302
|
);
|
|
4615
4303
|
return objectsWithSha1.filter((object) => object.file_sha1 === sha1).length;
|
|
4616
4304
|
}
|
|
@@ -4632,20 +4320,41 @@ var __publicField = (obj, key, value) => {
|
|
|
4632
4320
|
}
|
|
4633
4321
|
return promisesBySha1;
|
|
4634
4322
|
}
|
|
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
4323
|
}
|
|
4324
|
+
const AttachmentModelMeta = {
|
|
4325
|
+
[AttachmentModel.Issue]: {
|
|
4326
|
+
name: "issue",
|
|
4327
|
+
attachUrlPrefix: "/issues",
|
|
4328
|
+
deleteUrlPrefix: "/issues",
|
|
4329
|
+
fetchUrlPostfix: "/issue-attachments"
|
|
4330
|
+
},
|
|
4331
|
+
[AttachmentModel.Asset]: {
|
|
4332
|
+
name: "asset",
|
|
4333
|
+
attachUrlPrefix: "/assets",
|
|
4334
|
+
deleteUrlPrefix: "/assets",
|
|
4335
|
+
fetchUrlPostfix: "/asset-attachments"
|
|
4336
|
+
},
|
|
4337
|
+
[AttachmentModel.AssetType]: {
|
|
4338
|
+
name: "asset type",
|
|
4339
|
+
attachUrlPrefix: "/assets/types",
|
|
4340
|
+
deleteUrlPrefix: "/assets/types",
|
|
4341
|
+
fetchUrlPostfix: "/asset-type-attachments"
|
|
4342
|
+
},
|
|
4343
|
+
[AttachmentModel.Project]: {
|
|
4344
|
+
name: "project",
|
|
4345
|
+
attachUrlPrefix: "/projects",
|
|
4346
|
+
deleteUrlPrefix: "/projects",
|
|
4347
|
+
fetchUrlPostfix: "/attachments"
|
|
4348
|
+
},
|
|
4349
|
+
[AttachmentModel.Document]: {
|
|
4350
|
+
name: "document",
|
|
4351
|
+
attachUrlPrefix: "/documents",
|
|
4352
|
+
deleteUrlPrefix: "/documents",
|
|
4353
|
+
fetchUrlPostfix: "/document-attachments"
|
|
4354
|
+
}
|
|
4355
|
+
};
|
|
4647
4356
|
class BaseAttachmentService extends BaseUploadService {
|
|
4648
|
-
async
|
|
4357
|
+
async attachFiles(files, modelId, buildOfflineAttachment) {
|
|
4649
4358
|
var _a2;
|
|
4650
4359
|
const { store } = this.client;
|
|
4651
4360
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
@@ -4653,36 +4362,39 @@ var __publicField = (obj, key, value) => {
|
|
|
4653
4362
|
const offlineAttachments = [];
|
|
4654
4363
|
const attachmentPayloads = [];
|
|
4655
4364
|
const filePayloads = {};
|
|
4656
|
-
for (const
|
|
4657
|
-
const
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4365
|
+
for (const file of files) {
|
|
4366
|
+
const sha1 = await hashFile(file);
|
|
4367
|
+
if (!(sha1 in filePayloads)) {
|
|
4368
|
+
filePayloads[sha1] = {
|
|
4369
|
+
sha1,
|
|
4370
|
+
file_type: file.type,
|
|
4371
|
+
extension: file.name.split(".").pop(),
|
|
4372
|
+
size: file.size
|
|
4373
|
+
};
|
|
4374
|
+
await this.client.files.addCache(file, sha1);
|
|
4375
|
+
}
|
|
4376
|
+
const offlineAttachment = buildOfflineAttachment({
|
|
4662
4377
|
file,
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4378
|
+
sha1,
|
|
4379
|
+
submittedAt,
|
|
4380
|
+
createdBy,
|
|
4666
4381
|
description: "",
|
|
4667
4382
|
modelId
|
|
4668
4383
|
});
|
|
4669
4384
|
offlineAttachments.push(offlineAttachment);
|
|
4670
|
-
attachmentPayloads.push(
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
description: offlineAttachment.description,
|
|
4677
|
-
modelId
|
|
4678
|
-
})
|
|
4679
|
-
);
|
|
4385
|
+
attachmentPayloads.push({
|
|
4386
|
+
offline_id: offlineAttachment.offline_id,
|
|
4387
|
+
name: offlineAttachment.file_name,
|
|
4388
|
+
sha1: offlineAttachment.file_sha1,
|
|
4389
|
+
description: offlineAttachment.description
|
|
4390
|
+
});
|
|
4680
4391
|
}
|
|
4681
4392
|
this.dispatch(this.addAttachments(offlineAttachments));
|
|
4393
|
+
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4682
4394
|
const promise = this.enqueueRequest({
|
|
4683
|
-
description: `
|
|
4395
|
+
description: `Attach files to ${meta.name}`,
|
|
4684
4396
|
method: HttpMethod.POST,
|
|
4685
|
-
url: `${
|
|
4397
|
+
url: `${meta.attachUrlPrefix}/${modelId}/attach/`,
|
|
4686
4398
|
payload: {
|
|
4687
4399
|
submitted_at: submittedAt,
|
|
4688
4400
|
attachments: attachmentPayloads,
|
|
@@ -4699,7 +4411,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4699
4411
|
});
|
|
4700
4412
|
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
4701
4413
|
}
|
|
4702
|
-
async
|
|
4414
|
+
async deleteAttachment(attachmendId) {
|
|
4703
4415
|
const { store } = this.client;
|
|
4704
4416
|
const attachment = this.selectAttachment(attachmendId)(store.getState());
|
|
4705
4417
|
if (!attachment) {
|
|
@@ -4708,10 +4420,11 @@ var __publicField = (obj, key, value) => {
|
|
|
4708
4420
|
);
|
|
4709
4421
|
}
|
|
4710
4422
|
this.dispatch(this.removeAttachment(attachment.offline_id));
|
|
4423
|
+
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4711
4424
|
const promise = this.enqueueRequest({
|
|
4712
|
-
description:
|
|
4425
|
+
description: "Delete attachment",
|
|
4713
4426
|
method: HttpMethod.DELETE,
|
|
4714
|
-
url: `${
|
|
4427
|
+
url: `${meta.deleteUrlPrefix}/attachments/${attachmendId}/`,
|
|
4715
4428
|
blockers: [attachmendId],
|
|
4716
4429
|
blocks: []
|
|
4717
4430
|
});
|
|
@@ -4724,12 +4437,24 @@ var __publicField = (obj, key, value) => {
|
|
|
4724
4437
|
});
|
|
4725
4438
|
return promise;
|
|
4726
4439
|
}
|
|
4440
|
+
// Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
|
|
4441
|
+
// so for some attachment model services, this method will have to be overridden.
|
|
4442
|
+
async refreshStore(projectId, _organizationId) {
|
|
4443
|
+
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4444
|
+
const result = await this.enqueueRequest({
|
|
4445
|
+
description: `Get ${meta.name} attachments`,
|
|
4446
|
+
method: HttpMethod.GET,
|
|
4447
|
+
url: `/projects/${projectId}${meta.fetchUrlPostfix}/`,
|
|
4448
|
+
blocks: [],
|
|
4449
|
+
blockers: []
|
|
4450
|
+
});
|
|
4451
|
+
this.dispatch(this.initializeAttachments(result));
|
|
4452
|
+
}
|
|
4727
4453
|
}
|
|
4728
4454
|
class AssetAttachmentService extends BaseAttachmentService {
|
|
4729
4455
|
constructor() {
|
|
4730
4456
|
super(...arguments);
|
|
4731
|
-
__publicField(this, "
|
|
4732
|
-
__publicField(this, "url", "/asset-attachments");
|
|
4457
|
+
__publicField(this, "attachmentModel", AttachmentModel.Asset);
|
|
4733
4458
|
__publicField(this, "initializeAttachments", initializeAssetAttachments);
|
|
4734
4459
|
__publicField(this, "addAttachments", addAssetAttachments);
|
|
4735
4460
|
__publicField(this, "updateAttachments", updateAssetAttachments);
|
|
@@ -4741,39 +4466,20 @@ var __publicField = (obj, key, value) => {
|
|
|
4741
4466
|
buildOfflineAttachment(data) {
|
|
4742
4467
|
return offline({
|
|
4743
4468
|
file: URL.createObjectURL(data.file),
|
|
4744
|
-
file_sha1: data.
|
|
4745
|
-
created_by: data.
|
|
4469
|
+
file_sha1: data.sha1,
|
|
4470
|
+
created_by: data.createdBy,
|
|
4746
4471
|
file_name: data.file.name,
|
|
4747
4472
|
file_type: data.file.type,
|
|
4748
|
-
submitted_at: data.
|
|
4473
|
+
submitted_at: data.submittedAt,
|
|
4749
4474
|
description: data.description,
|
|
4750
4475
|
asset: data.modelId
|
|
4751
4476
|
});
|
|
4752
4477
|
}
|
|
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 })));
|
|
4478
|
+
async attachFilesToAsset(files, assetId) {
|
|
4479
|
+
return this.attachFiles(files, assetId, this.buildOfflineAttachment.bind(this));
|
|
4761
4480
|
}
|
|
4762
|
-
async
|
|
4763
|
-
return this.
|
|
4764
|
-
}
|
|
4765
|
-
async refreshStore(projectId) {
|
|
4766
|
-
const result = await this.enqueueRequest({
|
|
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));
|
|
4481
|
+
async deleteAssetAttachment(attachmentId) {
|
|
4482
|
+
return this.deleteAttachment(attachmentId);
|
|
4777
4483
|
}
|
|
4778
4484
|
}
|
|
4779
4485
|
class AssetTypeService extends BaseApiService {
|
|
@@ -4790,7 +4496,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4790
4496
|
const promise = this.enqueueRequest({
|
|
4791
4497
|
description: "Create asset type",
|
|
4792
4498
|
method: HttpMethod.POST,
|
|
4793
|
-
url:
|
|
4499
|
+
url: `/projects/${payload.project}/asset-types/`,
|
|
4794
4500
|
payload: { ...offlineAssetType },
|
|
4795
4501
|
blockers: [],
|
|
4796
4502
|
blocks: [offlineAssetType.offline_id]
|
|
@@ -4816,7 +4522,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4816
4522
|
const promise = this.enqueueRequest({
|
|
4817
4523
|
description: "Update asset type",
|
|
4818
4524
|
method: HttpMethod.PATCH,
|
|
4819
|
-
url: `/
|
|
4525
|
+
url: `/assets/types/${payload.offline_id}/`,
|
|
4820
4526
|
payload: {
|
|
4821
4527
|
icon: payload.icon,
|
|
4822
4528
|
color: payload.color,
|
|
@@ -4850,7 +4556,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4850
4556
|
return this.enqueueRequest({
|
|
4851
4557
|
description: "Delete asset type",
|
|
4852
4558
|
method: HttpMethod.DELETE,
|
|
4853
|
-
url: `/
|
|
4559
|
+
url: `/assets/types/${assetTypeId}/`,
|
|
4854
4560
|
blockers: [assetTypeId],
|
|
4855
4561
|
blocks: []
|
|
4856
4562
|
}).catch((e) => {
|
|
@@ -4865,10 +4571,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4865
4571
|
const result = await this.enqueueRequest({
|
|
4866
4572
|
description: "Get asset types",
|
|
4867
4573
|
method: HttpMethod.GET,
|
|
4868
|
-
url:
|
|
4869
|
-
queryParams: {
|
|
4870
|
-
project: projectId.toString()
|
|
4871
|
-
},
|
|
4574
|
+
url: `/projects/${projectId}/asset-types/`,
|
|
4872
4575
|
blockers: [],
|
|
4873
4576
|
blocks: []
|
|
4874
4577
|
});
|
|
@@ -4878,8 +4581,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4878
4581
|
class AssetTypeAttachmentService extends BaseAttachmentService {
|
|
4879
4582
|
constructor() {
|
|
4880
4583
|
super(...arguments);
|
|
4881
|
-
__publicField(this, "
|
|
4882
|
-
__publicField(this, "
|
|
4584
|
+
__publicField(this, "attachmentModel", AttachmentModel.AssetType);
|
|
4585
|
+
__publicField(this, "initializeAttachments", initializeAssetTypeAttachments);
|
|
4883
4586
|
__publicField(this, "addAttachments", addAssetTypeAttachments);
|
|
4884
4587
|
__publicField(this, "updateAttachments", updateAssetTypeAttachments);
|
|
4885
4588
|
__publicField(this, "removeAttachments", deleteAssetTypeAttachments);
|
|
@@ -4890,39 +4593,20 @@ var __publicField = (obj, key, value) => {
|
|
|
4890
4593
|
buildOfflineAttachment(data) {
|
|
4891
4594
|
return offline({
|
|
4892
4595
|
file: URL.createObjectURL(data.file),
|
|
4893
|
-
file_sha1: data.
|
|
4894
|
-
created_by: data.
|
|
4596
|
+
file_sha1: data.sha1,
|
|
4597
|
+
created_by: data.createdBy,
|
|
4895
4598
|
file_name: data.file.name,
|
|
4896
4599
|
file_type: data.file.type,
|
|
4897
|
-
submitted_at: data.
|
|
4600
|
+
submitted_at: data.submittedAt,
|
|
4898
4601
|
description: data.description,
|
|
4899
4602
|
asset_type: data.modelId
|
|
4900
4603
|
});
|
|
4901
4604
|
}
|
|
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 })));
|
|
4605
|
+
async attachFilesToAssetType(files, assetTypeId) {
|
|
4606
|
+
return this.attachFiles(files, assetTypeId, this.buildOfflineAttachment.bind(this));
|
|
4910
4607
|
}
|
|
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));
|
|
4608
|
+
async deleteAssetTypeAttachment(attachmentId) {
|
|
4609
|
+
return this.deleteAttachment(attachmentId);
|
|
4926
4610
|
}
|
|
4927
4611
|
}
|
|
4928
4612
|
class IssueCommentService extends BaseApiService {
|
|
@@ -4938,7 +4622,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4938
4622
|
const promise = this.enqueueRequest({
|
|
4939
4623
|
description: "Add issue comment",
|
|
4940
4624
|
method: HttpMethod.POST,
|
|
4941
|
-
url:
|
|
4625
|
+
url: `/issues/${payload.issue}/comment/`,
|
|
4942
4626
|
payload: offlineComment,
|
|
4943
4627
|
blockers: [payload.issue],
|
|
4944
4628
|
blocks: [offlineComment.offline_id]
|
|
@@ -4962,7 +4646,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4962
4646
|
const promise = this.enqueueRequest({
|
|
4963
4647
|
description: "Edit issue comment",
|
|
4964
4648
|
method: HttpMethod.PATCH,
|
|
4965
|
-
url: `/
|
|
4649
|
+
url: `/issues/comments/${payload.offline_id}/`,
|
|
4966
4650
|
payload,
|
|
4967
4651
|
blockers: [payload.offline_id],
|
|
4968
4652
|
blocks: [payload.offline_id]
|
|
@@ -4981,7 +4665,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4981
4665
|
const promise = this.enqueueRequest({
|
|
4982
4666
|
description: "Delete comment",
|
|
4983
4667
|
method: HttpMethod.DELETE,
|
|
4984
|
-
url: `/
|
|
4668
|
+
url: `/issues/comments/${id}/`,
|
|
4985
4669
|
blockers: [id],
|
|
4986
4670
|
blocks: []
|
|
4987
4671
|
});
|
|
@@ -4994,10 +4678,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4994
4678
|
const result = await this.enqueueRequest({
|
|
4995
4679
|
description: "Get comments",
|
|
4996
4680
|
method: HttpMethod.GET,
|
|
4997
|
-
url:
|
|
4998
|
-
queryParams: {
|
|
4999
|
-
project: projectId.toString()
|
|
5000
|
-
},
|
|
4681
|
+
url: `/projects/${projectId}/comments/`,
|
|
5001
4682
|
blockers: [],
|
|
5002
4683
|
blocks: []
|
|
5003
4684
|
});
|
|
@@ -5009,21 +4690,27 @@ var __publicField = (obj, key, value) => {
|
|
|
5009
4690
|
const result = await this.enqueueRequest({
|
|
5010
4691
|
description: "Get issue updates",
|
|
5011
4692
|
method: HttpMethod.GET,
|
|
5012
|
-
url:
|
|
5013
|
-
queryParams: {
|
|
5014
|
-
project: projectId.toString()
|
|
5015
|
-
},
|
|
4693
|
+
url: `/projects/${projectId}/issues/updates/`,
|
|
5016
4694
|
blockers: [],
|
|
5017
4695
|
blocks: []
|
|
5018
4696
|
});
|
|
5019
|
-
|
|
4697
|
+
let filteredResult = result.filter(onlyUniqueOfflineIds);
|
|
4698
|
+
filteredResult = filteredResult.map((comment) => {
|
|
4699
|
+
return { ...comment };
|
|
4700
|
+
});
|
|
4701
|
+
if (result.length !== filteredResult.length) {
|
|
4702
|
+
console.error(
|
|
4703
|
+
`Received duplicate comments from the API (new length ${filteredResult.length}); filtered in browser.`
|
|
4704
|
+
);
|
|
4705
|
+
}
|
|
4706
|
+
this.dispatch(initializeIssueUpdates(filteredResult));
|
|
5020
4707
|
}
|
|
5021
4708
|
}
|
|
5022
4709
|
class IssueAttachmentService extends BaseAttachmentService {
|
|
5023
4710
|
constructor() {
|
|
5024
4711
|
super(...arguments);
|
|
5025
|
-
__publicField(this, "
|
|
5026
|
-
__publicField(this, "
|
|
4712
|
+
__publicField(this, "attachmentModel", AttachmentModel.Issue);
|
|
4713
|
+
__publicField(this, "initializeAttachments", initializeIssueAttachments);
|
|
5027
4714
|
__publicField(this, "addAttachments", addIssueAttachments);
|
|
5028
4715
|
__publicField(this, "updateAttachments", updateIssueAttachments);
|
|
5029
4716
|
__publicField(this, "removeAttachments", deleteIssueAttachments);
|
|
@@ -5034,42 +4721,24 @@ var __publicField = (obj, key, value) => {
|
|
|
5034
4721
|
buildOfflineAttachment(data) {
|
|
5035
4722
|
return offline({
|
|
5036
4723
|
file: URL.createObjectURL(data.file),
|
|
5037
|
-
file_sha1: data.
|
|
5038
|
-
created_by: data.
|
|
4724
|
+
file_sha1: data.sha1,
|
|
4725
|
+
created_by: data.createdBy,
|
|
5039
4726
|
file_name: data.file.name,
|
|
5040
4727
|
file_type: data.file.type,
|
|
5041
|
-
submitted_at: data.
|
|
4728
|
+
submitted_at: data.submittedAt,
|
|
5042
4729
|
description: data.description,
|
|
5043
4730
|
issue: data.modelId
|
|
5044
4731
|
});
|
|
5045
4732
|
}
|
|
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 })));
|
|
4733
|
+
async attachFilesToIssue(files, issueId) {
|
|
4734
|
+
return this.attachFiles(files, issueId, this.buildOfflineAttachment.bind(this));
|
|
5054
4735
|
}
|
|
5055
|
-
async
|
|
5056
|
-
return this.
|
|
5057
|
-
}
|
|
5058
|
-
async refreshStore(projectId) {
|
|
5059
|
-
const result = await this.enqueueRequest({
|
|
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));
|
|
4736
|
+
async deleteIssueAttachment(attachmentId) {
|
|
4737
|
+
return this.deleteAttachment(attachmentId);
|
|
5070
4738
|
}
|
|
5071
4739
|
}
|
|
5072
4740
|
class IssueService extends BaseApiService {
|
|
4741
|
+
// Basic CRUD functions
|
|
5073
4742
|
add(payload) {
|
|
5074
4743
|
var _a2;
|
|
5075
4744
|
const { store } = this.client;
|
|
@@ -5087,6 +4756,10 @@ var __publicField = (obj, key, value) => {
|
|
|
5087
4756
|
description: "Create issue",
|
|
5088
4757
|
method: HttpMethod.POST,
|
|
5089
4758
|
url: "/issues/",
|
|
4759
|
+
queryParams: {
|
|
4760
|
+
workspace_id: payload.index_workspace,
|
|
4761
|
+
...payload.issue_type ? { issue_type: payload.issue_type } : {}
|
|
4762
|
+
},
|
|
5090
4763
|
payload: offlineIssue,
|
|
5091
4764
|
blockers: ["add-issue", ...offlineIssue.index_workspace ? [offlineIssue.index_workspace] : []],
|
|
5092
4765
|
blocks: [offlineIssue.offline_id]
|
|
@@ -5242,10 +4915,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5242
4915
|
const result = await this.enqueueRequest({
|
|
5243
4916
|
description: "Get issues",
|
|
5244
4917
|
method: HttpMethod.GET,
|
|
5245
|
-
url:
|
|
5246
|
-
queryParams: {
|
|
5247
|
-
project: projectId.toString()
|
|
5248
|
-
},
|
|
4918
|
+
url: `/projects/${projectId}/issues/`,
|
|
5249
4919
|
blockers: [],
|
|
5250
4920
|
blocks: []
|
|
5251
4921
|
});
|
|
@@ -5265,7 +4935,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5265
4935
|
this.dispatch(addIssueType(offlineIssueType));
|
|
5266
4936
|
const promise = this.enqueueRequest({
|
|
5267
4937
|
method: HttpMethod.POST,
|
|
5268
|
-
url:
|
|
4938
|
+
url: `/organizations/${payload.organization}/issue-types/`,
|
|
5269
4939
|
// Sending only whats needed here
|
|
5270
4940
|
payload: {
|
|
5271
4941
|
offline_id: offlineIssueType.offline_id,
|
|
@@ -5299,7 +4969,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5299
4969
|
this.dispatch(updateIssueType(offlineUpdatedIssueType));
|
|
5300
4970
|
const promise = this.enqueueRequest({
|
|
5301
4971
|
method: HttpMethod.PATCH,
|
|
5302
|
-
url: `/
|
|
4972
|
+
url: `/issues/types/${payload.offline_id}/`,
|
|
5303
4973
|
payload,
|
|
5304
4974
|
blockers: [payload.offline_id],
|
|
5305
4975
|
blocks: [payload.offline_id]
|
|
@@ -5323,7 +4993,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5323
4993
|
this.dispatch(deleteIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
|
|
5324
4994
|
const promise = this.enqueueRequest({
|
|
5325
4995
|
method: HttpMethod.DELETE,
|
|
5326
|
-
url: `/
|
|
4996
|
+
url: `/issues/types/${id}/`,
|
|
5327
4997
|
blockers: [id],
|
|
5328
4998
|
blocks: []
|
|
5329
4999
|
});
|
|
@@ -5336,10 +5006,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5336
5006
|
async refreshStore(organizationId) {
|
|
5337
5007
|
const result = await this.enqueueRequest({
|
|
5338
5008
|
method: HttpMethod.GET,
|
|
5339
|
-
url:
|
|
5340
|
-
queryParams: {
|
|
5341
|
-
organization: organizationId.toString()
|
|
5342
|
-
},
|
|
5009
|
+
url: `/organizations/${organizationId}/issue-types/`,
|
|
5343
5010
|
blockers: [],
|
|
5344
5011
|
blocks: []
|
|
5345
5012
|
});
|
|
@@ -5483,8 +5150,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5483
5150
|
class ProjectAttachmentService extends BaseAttachmentService {
|
|
5484
5151
|
constructor() {
|
|
5485
5152
|
super(...arguments);
|
|
5486
|
-
__publicField(this, "
|
|
5487
|
-
__publicField(this, "
|
|
5153
|
+
__publicField(this, "attachmentModel", AttachmentModel.Project);
|
|
5154
|
+
__publicField(this, "initializeAttachments", initializeProjectAttachments);
|
|
5488
5155
|
__publicField(this, "addAttachments", addProjectAttachments);
|
|
5489
5156
|
__publicField(this, "updateAttachments", updateProjectAttachments);
|
|
5490
5157
|
__publicField(this, "removeAttachments", deleteProjectAttachments);
|
|
@@ -5495,39 +5162,20 @@ var __publicField = (obj, key, value) => {
|
|
|
5495
5162
|
buildOfflineAttachment(data) {
|
|
5496
5163
|
return offline({
|
|
5497
5164
|
file: URL.createObjectURL(data.file),
|
|
5498
|
-
file_sha1: data.
|
|
5499
|
-
created_by: data.
|
|
5165
|
+
file_sha1: data.sha1,
|
|
5166
|
+
created_by: data.createdBy,
|
|
5500
5167
|
file_name: data.file.name,
|
|
5501
5168
|
file_type: data.file.type,
|
|
5502
|
-
submitted_at: data.
|
|
5169
|
+
submitted_at: data.submittedAt,
|
|
5503
5170
|
description: data.description,
|
|
5504
5171
|
project: data.modelId
|
|
5505
5172
|
});
|
|
5506
5173
|
}
|
|
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 })));
|
|
5174
|
+
async attachFilesToProject(files, projectId) {
|
|
5175
|
+
return this.attachFiles(files, projectId, this.buildOfflineAttachment.bind(this));
|
|
5515
5176
|
}
|
|
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));
|
|
5177
|
+
async deleteProjectAttachment(attachmentId) {
|
|
5178
|
+
return this.deleteAttachment(attachmentId);
|
|
5531
5179
|
}
|
|
5532
5180
|
}
|
|
5533
5181
|
class ProjectService extends BaseApiService {
|
|
@@ -5670,56 +5318,204 @@ var __publicField = (obj, key, value) => {
|
|
|
5670
5318
|
return { fields: newFields, images };
|
|
5671
5319
|
};
|
|
5672
5320
|
class FormService extends BaseUploadService {
|
|
5673
|
-
|
|
5321
|
+
async bulkAddRevisionAttachments(revisionId, files) {
|
|
5674
5322
|
var _a2;
|
|
5675
|
-
const { store } = this.client;
|
|
5676
5323
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5677
|
-
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5678
|
-
const
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
submitted_at:
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5324
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5325
|
+
const filePayloads = {};
|
|
5326
|
+
const offlineFormRevisionAttachments = [];
|
|
5327
|
+
const attachmentPayloads = [];
|
|
5328
|
+
for (const [fieldIdentifier, file] of Object.entries(files)) {
|
|
5329
|
+
const sha1 = await hashFile(file);
|
|
5330
|
+
if (!(sha1 in filePayloads)) {
|
|
5331
|
+
filePayloads[sha1] = {
|
|
5332
|
+
sha1,
|
|
5333
|
+
file_type: file.type,
|
|
5334
|
+
extension: file.name.split(".").pop(),
|
|
5335
|
+
size: file.size
|
|
5336
|
+
};
|
|
5337
|
+
await this.client.files.addCache(file, sha1);
|
|
5338
|
+
}
|
|
5339
|
+
const offlineFormRevisionAttachment = offline({
|
|
5340
|
+
file: URL.createObjectURL(file),
|
|
5341
|
+
file_type: file.type,
|
|
5342
|
+
file_name: file.name,
|
|
5343
|
+
file_sha1: sha1,
|
|
5344
|
+
created_by: createdBy,
|
|
5345
|
+
revision: revisionId,
|
|
5346
|
+
submitted_at: submittedAt,
|
|
5347
|
+
field_identifier: fieldIdentifier
|
|
5348
|
+
});
|
|
5349
|
+
offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
|
|
5350
|
+
const attachmentPayload = {
|
|
5351
|
+
offline_id: offlineFormRevisionAttachment.offline_id,
|
|
5352
|
+
name: file.name,
|
|
5353
|
+
field_identifier: fieldIdentifier,
|
|
5354
|
+
sha1
|
|
5355
|
+
};
|
|
5356
|
+
attachmentPayloads.push(attachmentPayload);
|
|
5357
|
+
}
|
|
5358
|
+
this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
|
|
5359
|
+
const promise = this.enqueueRequest({
|
|
5360
|
+
description: "Attach files to form revision",
|
|
5361
|
+
method: HttpMethod.POST,
|
|
5362
|
+
url: `/forms/revisions/${revisionId}/attachments/bulk/`,
|
|
5363
|
+
payload: {
|
|
5364
|
+
submitted_at: submittedAt,
|
|
5365
|
+
attachments: attachmentPayloads,
|
|
5366
|
+
files: Object.values(filePayloads)
|
|
5367
|
+
},
|
|
5368
|
+
blockers: [revisionId],
|
|
5369
|
+
blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5370
|
+
});
|
|
5371
|
+
promise.then((result) => {
|
|
5372
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
5373
|
+
this.dispatch(updateFormRevisionAttachments(result.attachments));
|
|
5374
|
+
}).catch(() => {
|
|
5375
|
+
this.dispatch(
|
|
5376
|
+
deleteFormRevisionAttachments(
|
|
5377
|
+
offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5378
|
+
)
|
|
5379
|
+
);
|
|
5380
|
+
});
|
|
5381
|
+
return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5382
|
+
}
|
|
5383
|
+
async add(ownerId, form, initialRevision, urlPrefix) {
|
|
5384
|
+
const { fields, images } = await separateImageFromFields(initialRevision.fields);
|
|
5385
|
+
const offlineFormRevision = offline({
|
|
5386
|
+
...initialRevision,
|
|
5387
|
+
fields,
|
|
5388
|
+
created_by: form.created_by,
|
|
5389
|
+
form: form.offline_id,
|
|
5390
|
+
submitted_at: form.submitted_at,
|
|
5391
|
+
revision: "Pending"
|
|
5392
|
+
});
|
|
5393
|
+
this.dispatch(addForm(form));
|
|
5394
|
+
this.dispatch(addFormRevision(offlineFormRevision));
|
|
5395
|
+
const formPromise = this.enqueueRequest({
|
|
5396
|
+
description: "Create form",
|
|
5397
|
+
method: HttpMethod.POST,
|
|
5398
|
+
url: urlPrefix,
|
|
5399
|
+
payload: {
|
|
5400
|
+
// Sending exactly what is currently needed for the endpoint
|
|
5401
|
+
offline_id: form.offline_id,
|
|
5402
|
+
submitted_at: form.submitted_at,
|
|
5403
|
+
initial_revision: {
|
|
5404
|
+
offline_id: offlineFormRevision.offline_id,
|
|
5405
|
+
submitted_at: offlineFormRevision.submitted_at,
|
|
5406
|
+
title: offlineFormRevision.title,
|
|
5407
|
+
description: offlineFormRevision.description,
|
|
5408
|
+
fields: offlineFormRevision.fields
|
|
5409
|
+
}
|
|
5410
|
+
},
|
|
5411
|
+
blockers: [ownerId],
|
|
5412
|
+
blocks: [form.offline_id, offlineFormRevision.offline_id]
|
|
5413
|
+
});
|
|
5414
|
+
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5415
|
+
offlineFormRevision.offline_id,
|
|
5416
|
+
images
|
|
5417
|
+
);
|
|
5418
|
+
void formPromise.catch((e) => {
|
|
5419
|
+
this.dispatch(deleteForm(form.offline_id));
|
|
5420
|
+
this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
|
|
5421
|
+
throw e;
|
|
5422
|
+
});
|
|
5423
|
+
return [form, offlineFormRevision, offlineFormRevisionAttachments, formPromise, attachmentsPromise];
|
|
5424
|
+
}
|
|
5425
|
+
addForOrganization(organizationId, initialRevision) {
|
|
5426
|
+
var _a2;
|
|
5427
|
+
const state = this.client.store.getState();
|
|
5428
|
+
const offlineForm = offline({
|
|
5429
|
+
favorite: false,
|
|
5430
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5431
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5432
|
+
organization: organizationId
|
|
5433
|
+
});
|
|
5434
|
+
return this.add(
|
|
5435
|
+
organizationId.toString(),
|
|
5436
|
+
offlineForm,
|
|
5437
|
+
initialRevision,
|
|
5438
|
+
`/organizations/${organizationId}/create-form/`
|
|
5439
|
+
);
|
|
5440
|
+
}
|
|
5441
|
+
addForProject(projectId, initialRevision) {
|
|
5442
|
+
var _a2;
|
|
5443
|
+
const state = this.client.store.getState();
|
|
5444
|
+
const offlineForm = offline({
|
|
5445
|
+
favorite: false,
|
|
5446
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5447
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5448
|
+
project: projectId
|
|
5449
|
+
});
|
|
5450
|
+
return this.add(projectId.toString(), offlineForm, initialRevision, `/projects/${projectId}/create-form/`);
|
|
5451
|
+
}
|
|
5452
|
+
addForIssueType(issueTypeId, initialRevision) {
|
|
5453
|
+
var _a2;
|
|
5454
|
+
const state = this.client.store.getState();
|
|
5455
|
+
const offlineForm = offline({
|
|
5456
|
+
favorite: false,
|
|
5457
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5458
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5459
|
+
issue_type: issueTypeId
|
|
5460
|
+
});
|
|
5461
|
+
return this.add(issueTypeId, offlineForm, initialRevision, `/issues/types/${issueTypeId}/create-form/`);
|
|
5462
|
+
}
|
|
5463
|
+
addForAssetType(assetTypeId, initialRevision) {
|
|
5464
|
+
var _a2;
|
|
5465
|
+
const state = this.client.store.getState();
|
|
5466
|
+
const offlineForm = offline({
|
|
5467
|
+
favorite: false,
|
|
5468
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5469
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5470
|
+
asset_type: assetTypeId
|
|
5471
|
+
});
|
|
5472
|
+
return this.add(assetTypeId, offlineForm, initialRevision, `/assets/types/${assetTypeId}/create-form/`);
|
|
5473
|
+
}
|
|
5474
|
+
async createRevision(formId, revision) {
|
|
5475
|
+
var _a2;
|
|
5476
|
+
const offlineRevision = offline(revision);
|
|
5477
|
+
const { store } = this.client;
|
|
5478
|
+
const state = store.getState();
|
|
5479
|
+
const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5480
|
+
const { fields, images } = await separateImageFromFields(offlineRevision.fields);
|
|
5481
|
+
const fullRevision = {
|
|
5482
|
+
...offlineRevision,
|
|
5483
|
+
fields,
|
|
5484
|
+
created_by: createdBy,
|
|
5485
|
+
revision: "Pending",
|
|
5486
|
+
form: formId,
|
|
5487
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5488
|
+
};
|
|
5489
|
+
this.dispatch(addFormRevision(fullRevision));
|
|
5490
|
+
const promise = this.enqueueRequest({
|
|
5491
|
+
description: "Create form revision",
|
|
5492
|
+
method: HttpMethod.PATCH,
|
|
5493
|
+
url: `/forms/${formId}/`,
|
|
5494
|
+
payload: {
|
|
5495
|
+
initial_revision: {
|
|
5496
|
+
offline_id: fullRevision.offline_id,
|
|
5497
|
+
submitted_at: fullRevision.submitted_at,
|
|
5498
|
+
title: fullRevision.title,
|
|
5499
|
+
description: fullRevision.description,
|
|
5500
|
+
fields: fullRevision.fields
|
|
5501
|
+
}
|
|
5502
|
+
},
|
|
5503
|
+
blockers: [formId],
|
|
5504
|
+
blocks: [offlineRevision.offline_id]
|
|
5505
|
+
});
|
|
5506
|
+
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5507
|
+
fullRevision.offline_id,
|
|
5508
|
+
images
|
|
5509
|
+
);
|
|
5510
|
+
void promise.then((result) => {
|
|
5511
|
+
this.dispatch(setFormRevision(result));
|
|
5512
|
+
}).catch(() => {
|
|
5513
|
+
this.dispatch(deleteFormRevision(fullRevision.offline_id));
|
|
5514
|
+
});
|
|
5515
|
+
return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
|
|
5516
|
+
}
|
|
5517
|
+
async delete(id) {
|
|
5518
|
+
const { store } = this.client;
|
|
5723
5519
|
const state = store.getState();
|
|
5724
5520
|
const form = selectFormById(id)(state);
|
|
5725
5521
|
if (!form) {
|
|
@@ -5753,31 +5549,65 @@ var __publicField = (obj, key, value) => {
|
|
|
5753
5549
|
throw e;
|
|
5754
5550
|
}
|
|
5755
5551
|
}
|
|
5756
|
-
async refreshStore(projectId
|
|
5757
|
-
|
|
5758
|
-
const
|
|
5552
|
+
async refreshStore(projectId) {
|
|
5553
|
+
const forms = [];
|
|
5554
|
+
const revisions = [];
|
|
5555
|
+
const attachments = [];
|
|
5556
|
+
const projectFormsResult = await this.enqueueRequest({
|
|
5759
5557
|
description: "Fetch project forms",
|
|
5760
5558
|
method: HttpMethod.GET,
|
|
5761
|
-
url:
|
|
5762
|
-
queryParams: {
|
|
5763
|
-
project: projectId.toString()
|
|
5764
|
-
},
|
|
5559
|
+
url: `/projects/${projectId}/forms/`,
|
|
5765
5560
|
blockers: [projectId.toString()],
|
|
5766
5561
|
blocks: []
|
|
5767
5562
|
});
|
|
5768
|
-
|
|
5769
|
-
|
|
5563
|
+
for (const form of projectFormsResult.forms)
|
|
5564
|
+
forms.push(form);
|
|
5565
|
+
for (const revision of projectFormsResult.revisions)
|
|
5566
|
+
revisions.push(revision);
|
|
5567
|
+
for (const attachment of projectFormsResult.attachments)
|
|
5568
|
+
attachments.push(attachment);
|
|
5569
|
+
const organizationFormsResult = await this.enqueueRequest({
|
|
5770
5570
|
description: "Fetch organization forms",
|
|
5771
5571
|
method: HttpMethod.GET,
|
|
5772
|
-
url:
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5572
|
+
url: `/projects/${projectId}/organizations/forms/`,
|
|
5573
|
+
blockers: [projectId.toString()],
|
|
5574
|
+
blocks: []
|
|
5575
|
+
});
|
|
5576
|
+
for (const form of organizationFormsResult.forms)
|
|
5577
|
+
forms.push(form);
|
|
5578
|
+
for (const revision of organizationFormsResult.revisions)
|
|
5579
|
+
revisions.push(revision);
|
|
5580
|
+
for (const attachment of organizationFormsResult.attachments)
|
|
5581
|
+
attachments.push(attachment);
|
|
5582
|
+
const assetTypeFormsResult = await this.enqueueRequest({
|
|
5583
|
+
description: "Fetch asset type forms",
|
|
5584
|
+
method: HttpMethod.GET,
|
|
5585
|
+
url: `/projects/${projectId}/asset-types/forms/`,
|
|
5586
|
+
blockers: [projectId.toString()],
|
|
5587
|
+
blocks: []
|
|
5588
|
+
});
|
|
5589
|
+
for (const form of assetTypeFormsResult.forms)
|
|
5590
|
+
forms.push(form);
|
|
5591
|
+
for (const revision of assetTypeFormsResult.revisions)
|
|
5592
|
+
revisions.push(revision);
|
|
5593
|
+
for (const attachment of assetTypeFormsResult.attachments)
|
|
5594
|
+
attachments.push(attachment);
|
|
5595
|
+
const issueTypeFormsResult = await this.enqueueRequest({
|
|
5596
|
+
description: "Fetch issue type forms",
|
|
5597
|
+
method: HttpMethod.GET,
|
|
5598
|
+
url: `/projects/${projectId}/issue-types/forms/`,
|
|
5599
|
+
blockers: [projectId.toString()],
|
|
5777
5600
|
blocks: []
|
|
5778
5601
|
});
|
|
5779
|
-
|
|
5602
|
+
for (const form of issueTypeFormsResult.forms)
|
|
5603
|
+
forms.push(form);
|
|
5604
|
+
for (const revision of issueTypeFormsResult.revisions)
|
|
5605
|
+
revisions.push(revision);
|
|
5606
|
+
for (const attachment of issueTypeFormsResult.attachments)
|
|
5607
|
+
attachments.push(attachment);
|
|
5780
5608
|
this.dispatch(initializeForms(forms));
|
|
5609
|
+
this.dispatch(initializeFormRevisions(revisions));
|
|
5610
|
+
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
5781
5611
|
}
|
|
5782
5612
|
}
|
|
5783
5613
|
const isArrayOfFiles = (value) => {
|
|
@@ -5799,11 +5629,95 @@ var __publicField = (obj, key, value) => {
|
|
|
5799
5629
|
return { values: newValues, files };
|
|
5800
5630
|
};
|
|
5801
5631
|
class FormSubmissionService extends BaseUploadService {
|
|
5802
|
-
|
|
5632
|
+
async bulkAddSubmissionAttachments(submissionId, files) {
|
|
5633
|
+
var _a2;
|
|
5634
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5635
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5636
|
+
const filePayloads = {};
|
|
5637
|
+
const offlineFormSubmissionAttachments = [];
|
|
5638
|
+
const attachmentPayloads = [];
|
|
5639
|
+
for (const [fieldIdentifier, filesArray] of Object.entries(files)) {
|
|
5640
|
+
for (const file of filesArray) {
|
|
5641
|
+
const sha1 = await hashFile(file);
|
|
5642
|
+
if (!(sha1 in filePayloads)) {
|
|
5643
|
+
filePayloads[sha1] = {
|
|
5644
|
+
sha1,
|
|
5645
|
+
file_type: file.type,
|
|
5646
|
+
extension: file.name.split(".").pop(),
|
|
5647
|
+
size: file.size
|
|
5648
|
+
};
|
|
5649
|
+
await this.client.files.addCache(file, sha1);
|
|
5650
|
+
}
|
|
5651
|
+
const offlineFormSubmissionAttachment = offline({
|
|
5652
|
+
file: URL.createObjectURL(file),
|
|
5653
|
+
file_type: file.type,
|
|
5654
|
+
file_name: file.name,
|
|
5655
|
+
file_sha1: sha1,
|
|
5656
|
+
created_by: createdBy,
|
|
5657
|
+
submission: submissionId,
|
|
5658
|
+
submitted_at: submittedAt,
|
|
5659
|
+
field_identifier: fieldIdentifier
|
|
5660
|
+
});
|
|
5661
|
+
offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
|
|
5662
|
+
const attachmentPayload = {
|
|
5663
|
+
offline_id: offlineFormSubmissionAttachment.offline_id,
|
|
5664
|
+
name: file.name,
|
|
5665
|
+
sha1,
|
|
5666
|
+
field_identifier: fieldIdentifier
|
|
5667
|
+
};
|
|
5668
|
+
attachmentPayloads.push(attachmentPayload);
|
|
5669
|
+
}
|
|
5670
|
+
}
|
|
5671
|
+
this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
|
|
5672
|
+
const promise = this.enqueueRequest({
|
|
5673
|
+
description: "Attach files to form submission",
|
|
5674
|
+
method: HttpMethod.POST,
|
|
5675
|
+
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
5676
|
+
payload: {
|
|
5677
|
+
submitted_at: submittedAt,
|
|
5678
|
+
attachments: attachmentPayloads,
|
|
5679
|
+
files: Object.values(filePayloads)
|
|
5680
|
+
},
|
|
5681
|
+
blockers: [submissionId],
|
|
5682
|
+
blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5683
|
+
});
|
|
5684
|
+
promise.then((result) => {
|
|
5685
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
5686
|
+
this.dispatch(updateFormSubmissionAttachments(result.attachments));
|
|
5687
|
+
}).catch(() => {
|
|
5688
|
+
this.dispatch(
|
|
5689
|
+
deleteFormSubmissionAttachments(
|
|
5690
|
+
offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5691
|
+
)
|
|
5692
|
+
);
|
|
5693
|
+
});
|
|
5694
|
+
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5695
|
+
}
|
|
5696
|
+
async bulkDeleteSubmissionAttachments(submissionId, attachmentsIds) {
|
|
5697
|
+
const { store } = this.client;
|
|
5698
|
+
const state = store.getState();
|
|
5699
|
+
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
5700
|
+
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
5701
|
+
try {
|
|
5702
|
+
await this.enqueueRequest({
|
|
5703
|
+
description: "Delete form submission attachments",
|
|
5704
|
+
method: HttpMethod.DELETE,
|
|
5705
|
+
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
5706
|
+
payload: { attachments: attachmentsIds },
|
|
5707
|
+
blockers: [submissionId, ...attachmentsIds],
|
|
5708
|
+
blocks: []
|
|
5709
|
+
});
|
|
5710
|
+
} catch (e) {
|
|
5711
|
+
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
5712
|
+
throw e;
|
|
5713
|
+
}
|
|
5714
|
+
}
|
|
5715
|
+
// Outer promise is for hashing and caching files for submission attachments
|
|
5716
|
+
async add(payload) {
|
|
5803
5717
|
var _a2;
|
|
5804
5718
|
const { store } = this.client;
|
|
5805
5719
|
const state = store.getState();
|
|
5806
|
-
const { values } = separateFilesFromValues(payload.values);
|
|
5720
|
+
const { values, files } = separateFilesFromValues(payload.values);
|
|
5807
5721
|
const offlineSubmission = offline({
|
|
5808
5722
|
...payload,
|
|
5809
5723
|
values,
|
|
@@ -5813,7 +5727,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5813
5727
|
const promise = this.enqueueRequest({
|
|
5814
5728
|
description: "Respond to form",
|
|
5815
5729
|
method: HttpMethod.POST,
|
|
5816
|
-
url:
|
|
5730
|
+
url: `/forms/revisions/${payload.form_revision}/respond/`,
|
|
5817
5731
|
payload: offlineSubmission,
|
|
5818
5732
|
blockers: [payload.issue, payload.asset, payload.asset_stage, "add-form-entry"].filter(
|
|
5819
5733
|
(x) => x !== void 0
|
|
@@ -5821,6 +5735,10 @@ var __publicField = (obj, key, value) => {
|
|
|
5821
5735
|
blocks: [offlineSubmission.offline_id]
|
|
5822
5736
|
});
|
|
5823
5737
|
this.dispatch(addFormSubmission(offlineSubmission));
|
|
5738
|
+
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
5739
|
+
offlineSubmission.offline_id,
|
|
5740
|
+
files
|
|
5741
|
+
);
|
|
5824
5742
|
promise.then((result) => {
|
|
5825
5743
|
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5826
5744
|
this.dispatch(setFormSubmission(result));
|
|
@@ -5829,16 +5747,115 @@ var __publicField = (obj, key, value) => {
|
|
|
5829
5747
|
this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
|
|
5830
5748
|
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5831
5749
|
});
|
|
5832
|
-
return [offlineSubmission, promise];
|
|
5750
|
+
return [offlineSubmission, offlineFormSubmissionAttachments, promise, attachmentsPromise];
|
|
5833
5751
|
}
|
|
5834
|
-
|
|
5752
|
+
// Note currently the bulkAdd method is specific to form submissions for assets
|
|
5753
|
+
// TODO: adapt the support bulk adding to any model type
|
|
5754
|
+
async bulkAdd(args, batchSize) {
|
|
5755
|
+
const { formRevision, commonFieldValues, fieldValuesByAsset } = args;
|
|
5756
|
+
const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
|
|
5757
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5758
|
+
const transactionId = uuid.v4();
|
|
5759
|
+
const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), batchSize);
|
|
5760
|
+
const bulkAddBatches = await Promise.all(
|
|
5761
|
+
assetIdBatches.map(async (assetIdBatch) => {
|
|
5762
|
+
const batchId = uuid.v4();
|
|
5763
|
+
const submissionPayloads = [];
|
|
5764
|
+
const attachmentPayloads = [];
|
|
5765
|
+
const files = { ...commonFiles };
|
|
5766
|
+
for (const assetId of assetIdBatch) {
|
|
5767
|
+
const { values: fileSeperatedSubmissionSpecificValues, files: submissionSpecificFiles } = separateFilesFromValues(fieldValuesByAsset[assetId] ?? {});
|
|
5768
|
+
Object.assign(files, submissionSpecificFiles);
|
|
5769
|
+
const submissionPayload = offline({
|
|
5770
|
+
asset_id: assetId,
|
|
5771
|
+
form_data: fileSeperatedSubmissionSpecificValues
|
|
5772
|
+
});
|
|
5773
|
+
submissionPayloads.push(submissionPayload);
|
|
5774
|
+
for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
|
|
5775
|
+
for (const file of fileArray) {
|
|
5776
|
+
const sha1 = await hashFile(file);
|
|
5777
|
+
await this.client.files.addCache(file, sha1);
|
|
5778
|
+
const attachmentPayload = offline({
|
|
5779
|
+
submission_id: submissionPayload.offline_id,
|
|
5780
|
+
sha1,
|
|
5781
|
+
name: file.name,
|
|
5782
|
+
field_identifier: fieldIdentifier
|
|
5783
|
+
});
|
|
5784
|
+
attachmentPayloads.push(attachmentPayload);
|
|
5785
|
+
}
|
|
5786
|
+
}
|
|
5787
|
+
}
|
|
5788
|
+
const filePaylods = [];
|
|
5789
|
+
for (const file of Object.values(files).flat()) {
|
|
5790
|
+
const sha1 = await hashFile(file);
|
|
5791
|
+
const filePayload = {
|
|
5792
|
+
sha1,
|
|
5793
|
+
extension: file.name.split(".").pop() || "",
|
|
5794
|
+
file_type: file.type,
|
|
5795
|
+
size: file.size
|
|
5796
|
+
};
|
|
5797
|
+
filePaylods.push(filePayload);
|
|
5798
|
+
}
|
|
5799
|
+
return {
|
|
5800
|
+
batchId,
|
|
5801
|
+
payload: {
|
|
5802
|
+
transaction_id: transactionId,
|
|
5803
|
+
form_data: fileSeperatedCommonFieldValues,
|
|
5804
|
+
submitted_at: submittedAt,
|
|
5805
|
+
submissions: submissionPayloads,
|
|
5806
|
+
attachments: attachmentPayloads,
|
|
5807
|
+
files: filePaylods
|
|
5808
|
+
}
|
|
5809
|
+
};
|
|
5810
|
+
})
|
|
5811
|
+
);
|
|
5812
|
+
const batchPromises = [];
|
|
5813
|
+
let prevBatchId = null;
|
|
5814
|
+
for (const batch of bulkAddBatches) {
|
|
5815
|
+
const { payload, batchId } = batch;
|
|
5816
|
+
const batchAssetIds = payload.submissions.map((x) => x.asset_id);
|
|
5817
|
+
const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
|
|
5818
|
+
const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
|
|
5819
|
+
const blockers = batchAssetIds;
|
|
5820
|
+
if (prevBatchId)
|
|
5821
|
+
blockers.push(prevBatchId);
|
|
5822
|
+
const blocks2 = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5823
|
+
const promise = this.enqueueRequest({
|
|
5824
|
+
description: "Bulk add form submissions",
|
|
5825
|
+
method: HttpMethod.POST,
|
|
5826
|
+
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
5827
|
+
payload,
|
|
5828
|
+
blockers,
|
|
5829
|
+
blocks: blocks2
|
|
5830
|
+
});
|
|
5831
|
+
void promise.then(({ presigned_urls }) => {
|
|
5832
|
+
this.processPresignedUrls(presigned_urls);
|
|
5833
|
+
});
|
|
5834
|
+
prevBatchId = batchId;
|
|
5835
|
+
batchPromises.push(promise);
|
|
5836
|
+
}
|
|
5837
|
+
void Promise.all(batchPromises).then((results) => {
|
|
5838
|
+
const createdSubmissions = [];
|
|
5839
|
+
const createdAttachments = [];
|
|
5840
|
+
for (const result of results) {
|
|
5841
|
+
for (const createdSubmission of result.submissions)
|
|
5842
|
+
createdSubmissions.push(createdSubmission);
|
|
5843
|
+
for (const createdAttachment of result.attachments)
|
|
5844
|
+
createdAttachments.push(createdAttachment);
|
|
5845
|
+
}
|
|
5846
|
+
this.dispatch(addFormSubmissions(createdSubmissions));
|
|
5847
|
+
this.dispatch(addFormSubmissionAttachments(createdAttachments));
|
|
5848
|
+
});
|
|
5849
|
+
return batchPromises;
|
|
5850
|
+
}
|
|
5851
|
+
async update(payload) {
|
|
5835
5852
|
const { store } = this.client;
|
|
5836
5853
|
const state = store.getState();
|
|
5837
5854
|
const submissionToBeUpdated = selectFormSubmissionById(payload.offline_id)(state);
|
|
5838
5855
|
if (!submissionToBeUpdated) {
|
|
5839
5856
|
throw new Error(`Expected submission with offline_id ${payload.offline_id} to exist`);
|
|
5840
5857
|
}
|
|
5841
|
-
const { values } = separateFilesFromValues(payload.values ?? {});
|
|
5858
|
+
const { values, files } = separateFilesFromValues(payload.values ?? {});
|
|
5842
5859
|
const updatedSubmission = {
|
|
5843
5860
|
...submissionToBeUpdated,
|
|
5844
5861
|
...payload,
|
|
@@ -5852,18 +5869,39 @@ var __publicField = (obj, key, value) => {
|
|
|
5852
5869
|
const promise = this.enqueueRequest({
|
|
5853
5870
|
description: "Delete user form submissions",
|
|
5854
5871
|
method: HttpMethod.PATCH,
|
|
5855
|
-
url: `/
|
|
5872
|
+
url: `/forms/submissions/${updatedSubmission.offline_id}/`,
|
|
5856
5873
|
// TODO: send just payload when FormSubmissionDeserializer is updated to handle partial updates
|
|
5857
5874
|
payload: updatedSubmission,
|
|
5858
5875
|
blockers: [updatedSubmission.offline_id],
|
|
5859
5876
|
blocks: [updatedSubmission.offline_id]
|
|
5860
5877
|
});
|
|
5878
|
+
const formSubmissionAttachments = selectAttachmentsOfFormSubmission(payload.offline_id)(state);
|
|
5879
|
+
const formSubmissionAttachmentIdsToBeDeleted = [];
|
|
5880
|
+
for (const attachment of formSubmissionAttachments) {
|
|
5881
|
+
if (attachment.field_identifier in files) {
|
|
5882
|
+
formSubmissionAttachmentIdsToBeDeleted.push(attachment.offline_id);
|
|
5883
|
+
}
|
|
5884
|
+
}
|
|
5885
|
+
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
5886
|
+
payload.offline_id,
|
|
5887
|
+
files
|
|
5888
|
+
);
|
|
5889
|
+
const deleteAttachmentsPromise = this.bulkDeleteSubmissionAttachments(
|
|
5890
|
+
payload.offline_id,
|
|
5891
|
+
formSubmissionAttachmentIdsToBeDeleted
|
|
5892
|
+
);
|
|
5861
5893
|
promise.then((result) => {
|
|
5862
5894
|
this.dispatch(setFormSubmission(result));
|
|
5863
5895
|
}).catch(() => {
|
|
5864
5896
|
this.dispatch(setFormSubmission(submissionToBeUpdated));
|
|
5865
5897
|
});
|
|
5866
|
-
return [
|
|
5898
|
+
return [
|
|
5899
|
+
updatedSubmission,
|
|
5900
|
+
offlineFormSubmissionAttachments,
|
|
5901
|
+
promise,
|
|
5902
|
+
attachmentsPromise,
|
|
5903
|
+
deleteAttachmentsPromise
|
|
5904
|
+
];
|
|
5867
5905
|
}
|
|
5868
5906
|
async delete(id) {
|
|
5869
5907
|
const { store } = this.client;
|
|
@@ -5880,7 +5918,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5880
5918
|
return await this.enqueueRequest({
|
|
5881
5919
|
description: "Delete user form submissions",
|
|
5882
5920
|
method: HttpMethod.DELETE,
|
|
5883
|
-
url: `/
|
|
5921
|
+
url: `/forms/submissions/${id}/`,
|
|
5884
5922
|
blockers: [id],
|
|
5885
5923
|
blocks: []
|
|
5886
5924
|
});
|
|
@@ -5892,17 +5930,50 @@ var __publicField = (obj, key, value) => {
|
|
|
5892
5930
|
}
|
|
5893
5931
|
}
|
|
5894
5932
|
async refreshStore(projectId) {
|
|
5895
|
-
const
|
|
5896
|
-
|
|
5933
|
+
const formSubmissions = {};
|
|
5934
|
+
const modelSubmissions = await this.enqueueRequest({
|
|
5935
|
+
description: "Fetch model submissions",
|
|
5897
5936
|
method: HttpMethod.GET,
|
|
5898
|
-
url:
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5937
|
+
url: `/forms/in-project/${projectId}/submissions/model/latest/`,
|
|
5938
|
+
blockers: [],
|
|
5939
|
+
blocks: []
|
|
5940
|
+
});
|
|
5941
|
+
for (const modelSubmission of modelSubmissions) {
|
|
5942
|
+
formSubmissions[modelSubmission.offline_id] = modelSubmission;
|
|
5943
|
+
}
|
|
5944
|
+
const standaloneSubmissions = await this.enqueueRequest({
|
|
5945
|
+
description: "Fetch standalone submissions",
|
|
5946
|
+
method: HttpMethod.GET,
|
|
5947
|
+
url: `/forms/in-project/${projectId}/submissions/standalone/`,
|
|
5948
|
+
blockers: [],
|
|
5949
|
+
blocks: []
|
|
5950
|
+
});
|
|
5951
|
+
for (const standaloneSubmission of standaloneSubmissions) {
|
|
5952
|
+
formSubmissions[standaloneSubmission.offline_id] = standaloneSubmission;
|
|
5953
|
+
}
|
|
5954
|
+
this.dispatch(initializeFormSubmissions(Object.values(formSubmissions)));
|
|
5955
|
+
const attachments = {};
|
|
5956
|
+
const modelAttachments = await this.enqueueRequest({
|
|
5957
|
+
description: "Fetch model submission attachments",
|
|
5958
|
+
method: HttpMethod.GET,
|
|
5959
|
+
url: `/forms/in-project/${projectId}/attachments/model/latest/`,
|
|
5960
|
+
blockers: [],
|
|
5961
|
+
blocks: []
|
|
5962
|
+
});
|
|
5963
|
+
for (const modelAttachment of modelAttachments) {
|
|
5964
|
+
attachments[modelAttachment.offline_id] = modelAttachment;
|
|
5965
|
+
}
|
|
5966
|
+
const standaloneAttachments = await this.enqueueRequest({
|
|
5967
|
+
description: "Fetch standalone submission attachments",
|
|
5968
|
+
method: HttpMethod.GET,
|
|
5969
|
+
url: `/forms/in-project/${projectId}/attachments/standalone/`,
|
|
5902
5970
|
blockers: [],
|
|
5903
5971
|
blocks: []
|
|
5904
5972
|
});
|
|
5905
|
-
|
|
5973
|
+
for (const standaloneAttachent of standaloneAttachments) {
|
|
5974
|
+
attachments[standaloneAttachent.offline_id] = standaloneAttachent;
|
|
5975
|
+
}
|
|
5976
|
+
this.dispatch(initializeFormSubmissionAttachments(Object.values(attachments)));
|
|
5906
5977
|
}
|
|
5907
5978
|
}
|
|
5908
5979
|
class WorkspaceService extends BaseApiService {
|
|
@@ -6604,8 +6675,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6604
6675
|
class DocumentAttachmentService extends BaseAttachmentService {
|
|
6605
6676
|
constructor() {
|
|
6606
6677
|
super(...arguments);
|
|
6607
|
-
__publicField(this, "
|
|
6608
|
-
__publicField(this, "
|
|
6678
|
+
__publicField(this, "attachmentModel", AttachmentModel.Document);
|
|
6679
|
+
__publicField(this, "initializeAttachments", initializeDocumentAttachments);
|
|
6609
6680
|
__publicField(this, "addAttachments", addDocumentAttachments);
|
|
6610
6681
|
__publicField(this, "updateAttachments", updateDocumentAttachments);
|
|
6611
6682
|
__publicField(this, "removeAttachments", deleteDocumentAttachments);
|
|
@@ -6616,23 +6687,17 @@ var __publicField = (obj, key, value) => {
|
|
|
6616
6687
|
buildOfflineAttachment(data) {
|
|
6617
6688
|
return offline({
|
|
6618
6689
|
file: URL.createObjectURL(data.file),
|
|
6619
|
-
file_sha1: data.
|
|
6620
|
-
created_by: data.
|
|
6690
|
+
file_sha1: data.sha1,
|
|
6691
|
+
created_by: data.createdBy,
|
|
6621
6692
|
file_name: data.file.name,
|
|
6622
6693
|
file_type: data.file.type,
|
|
6623
|
-
submitted_at: data.
|
|
6694
|
+
submitted_at: data.submittedAt,
|
|
6624
6695
|
description: data.description,
|
|
6625
6696
|
document: data.modelId
|
|
6626
6697
|
});
|
|
6627
6698
|
}
|
|
6628
|
-
buildAttachmentPayload(data) {
|
|
6629
|
-
return {
|
|
6630
|
-
...data,
|
|
6631
|
-
document: data.modelId
|
|
6632
|
-
};
|
|
6633
|
-
}
|
|
6634
6699
|
// NOTE: overriding the method from BaseAttachmentService since document attachments get vectorized
|
|
6635
|
-
async
|
|
6700
|
+
async attachFilesToDocument(files, documentId) {
|
|
6636
6701
|
var _a2;
|
|
6637
6702
|
const { store } = this.client;
|
|
6638
6703
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
@@ -6641,36 +6706,40 @@ var __publicField = (obj, key, value) => {
|
|
|
6641
6706
|
const attachmentPayloads = [];
|
|
6642
6707
|
const filePayloads = {};
|
|
6643
6708
|
const sha1ToAttachmentIds = {};
|
|
6644
|
-
for (const
|
|
6645
|
-
const
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6709
|
+
for (const file of files) {
|
|
6710
|
+
const sha1 = await hashFile(file);
|
|
6711
|
+
if (!(sha1 in filePayloads)) {
|
|
6712
|
+
filePayloads[sha1] = {
|
|
6713
|
+
sha1,
|
|
6714
|
+
file_type: file.type,
|
|
6715
|
+
extension: file.name.split(".").pop(),
|
|
6716
|
+
size: file.size
|
|
6717
|
+
};
|
|
6718
|
+
sha1ToAttachmentIds[sha1] = [];
|
|
6719
|
+
await this.client.files.addCache(file, sha1);
|
|
6650
6720
|
}
|
|
6651
6721
|
const offlineAttachment = this.buildOfflineAttachment({
|
|
6652
6722
|
file,
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6723
|
+
sha1,
|
|
6724
|
+
submittedAt,
|
|
6725
|
+
createdBy,
|
|
6656
6726
|
description: "",
|
|
6657
6727
|
modelId: documentId
|
|
6658
6728
|
});
|
|
6659
6729
|
offlineAttachments.push(offlineAttachment);
|
|
6660
6730
|
attachmentPayloads.push({
|
|
6661
6731
|
offline_id: offlineAttachment.offline_id,
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
file_extension: filePayload.extension,
|
|
6732
|
+
name: offlineAttachment.file_name,
|
|
6733
|
+
sha1: offlineAttachment.file_sha1,
|
|
6665
6734
|
description: offlineAttachment.description
|
|
6666
6735
|
});
|
|
6667
|
-
sha1ToAttachmentIds[
|
|
6736
|
+
sha1ToAttachmentIds[sha1].push(offlineAttachment.offline_id);
|
|
6668
6737
|
}
|
|
6669
6738
|
this.dispatch(this.addAttachments(offlineAttachments));
|
|
6670
6739
|
const promise = this.enqueueRequest({
|
|
6671
6740
|
description: "Attach files to document",
|
|
6672
6741
|
method: HttpMethod.POST,
|
|
6673
|
-
url:
|
|
6742
|
+
url: `/documents/${documentId}/attach/`,
|
|
6674
6743
|
payload: {
|
|
6675
6744
|
submitted_at: submittedAt,
|
|
6676
6745
|
attachments: attachmentPayloads,
|
|
@@ -6695,14 +6764,14 @@ var __publicField = (obj, key, value) => {
|
|
|
6695
6764
|
});
|
|
6696
6765
|
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
6697
6766
|
}
|
|
6698
|
-
async
|
|
6699
|
-
return this.
|
|
6767
|
+
async deleteDocumentAttachment(attachmentId) {
|
|
6768
|
+
return this.deleteAttachment(attachmentId);
|
|
6700
6769
|
}
|
|
6701
6770
|
makeReadable(attachmnentId) {
|
|
6702
6771
|
void this.enqueueRequest({
|
|
6703
6772
|
description: "Add attachment to AI assistant",
|
|
6704
6773
|
method: HttpMethod.PATCH,
|
|
6705
|
-
url: `/
|
|
6774
|
+
url: `/documents/attachments/${attachmnentId}/`,
|
|
6706
6775
|
payload: {
|
|
6707
6776
|
readable_to_assistant: true
|
|
6708
6777
|
},
|
|
@@ -6719,7 +6788,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6719
6788
|
blocks: [],
|
|
6720
6789
|
blockers: []
|
|
6721
6790
|
});
|
|
6722
|
-
this.dispatch(
|
|
6791
|
+
this.dispatch(this.initializeAttachments(projectDocumentAttachments));
|
|
6723
6792
|
const organizationDocumentAttachments = await this.enqueueRequest({
|
|
6724
6793
|
description: "Get document attachments",
|
|
6725
6794
|
method: HttpMethod.GET,
|
|
@@ -6963,11 +7032,17 @@ var __publicField = (obj, key, value) => {
|
|
|
6963
7032
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6964
7033
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
6965
7034
|
const projectId = payloadWithoutFile.project;
|
|
6966
|
-
const
|
|
7035
|
+
const sha1 = await hashFile(file);
|
|
7036
|
+
const filePayload = {
|
|
7037
|
+
sha1,
|
|
7038
|
+
file_type: file.type,
|
|
7039
|
+
extension: file.name.split(".").pop(),
|
|
7040
|
+
size: file.size
|
|
7041
|
+
};
|
|
6967
7042
|
const offlineMapImage = offline({
|
|
6968
7043
|
...payloadWithoutFile,
|
|
6969
7044
|
file_name: file.name,
|
|
6970
|
-
file_sha1:
|
|
7045
|
+
file_sha1: sha1,
|
|
6971
7046
|
file: URL.createObjectURL(file),
|
|
6972
7047
|
submitted_at: submittedAt,
|
|
6973
7048
|
created_by: createdBy
|
|
@@ -7010,16 +7085,23 @@ var __publicField = (obj, key, value) => {
|
|
|
7010
7085
|
const offlineGeoImages = [];
|
|
7011
7086
|
const offlineIds = [];
|
|
7012
7087
|
const geoImagePayloads = [];
|
|
7013
|
-
const
|
|
7088
|
+
const filePayloadRecord = {};
|
|
7014
7089
|
for (const payloadAndFile of payloads) {
|
|
7015
7090
|
const { file, ...payload } = payloadAndFile;
|
|
7016
|
-
const
|
|
7017
|
-
if (!(
|
|
7018
|
-
|
|
7091
|
+
const sha1 = await hashFile(file);
|
|
7092
|
+
if (!(sha1 in filePayloadRecord)) {
|
|
7093
|
+
filePayloadRecord[sha1] = {
|
|
7094
|
+
sha1,
|
|
7095
|
+
file_type: file.type,
|
|
7096
|
+
extension: file.name.split(".").pop(),
|
|
7097
|
+
size: file.size
|
|
7098
|
+
};
|
|
7099
|
+
await this.client.files.addCache(file, sha1);
|
|
7100
|
+
}
|
|
7019
7101
|
const offlineMapImage = offline({
|
|
7020
7102
|
...payload,
|
|
7021
7103
|
file_name: file.name,
|
|
7022
|
-
file_sha1:
|
|
7104
|
+
file_sha1: sha1,
|
|
7023
7105
|
file: URL.createObjectURL(file),
|
|
7024
7106
|
submitted_at: submittedAt,
|
|
7025
7107
|
created_by: createdBy,
|
|
@@ -7048,7 +7130,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7048
7130
|
submitted_at: submittedAt,
|
|
7049
7131
|
project: projectId,
|
|
7050
7132
|
geo_images: geoImagePayloads,
|
|
7051
|
-
files: Object.values(
|
|
7133
|
+
files: Object.values(filePayloadRecord)
|
|
7052
7134
|
},
|
|
7053
7135
|
blocks: [projectId.toString()],
|
|
7054
7136
|
blockers: offlineIds
|
|
@@ -7116,7 +7198,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7116
7198
|
this.dispatch(initializeGeoImages(result));
|
|
7117
7199
|
}
|
|
7118
7200
|
}
|
|
7119
|
-
class IssueAssociationService extends
|
|
7201
|
+
class IssueAssociationService extends BaseUploadService {
|
|
7120
7202
|
add(payload) {
|
|
7121
7203
|
var _a2;
|
|
7122
7204
|
const { store } = this.client;
|
|
@@ -7131,7 +7213,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7131
7213
|
const promise = this.enqueueRequest({
|
|
7132
7214
|
description: "Add issue association",
|
|
7133
7215
|
method: HttpMethod.POST,
|
|
7134
|
-
url: "/
|
|
7216
|
+
url: "/issues/associations/",
|
|
7135
7217
|
payload: {
|
|
7136
7218
|
offline_id: offlineIssueAssociation.offline_id,
|
|
7137
7219
|
submitted_at: submittedAt,
|
|
@@ -7161,7 +7243,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7161
7243
|
const promise = this.enqueueRequest({
|
|
7162
7244
|
description: "Delete issue association",
|
|
7163
7245
|
method: HttpMethod.DELETE,
|
|
7164
|
-
url: `/
|
|
7246
|
+
url: `/issues/associations/${id}/`,
|
|
7165
7247
|
blockers: [id],
|
|
7166
7248
|
blocks: []
|
|
7167
7249
|
});
|
|
@@ -7174,938 +7256,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7174
7256
|
const issueAssociations = await this.enqueueRequest({
|
|
7175
7257
|
description: "Fetch issue associations",
|
|
7176
7258
|
method: HttpMethod.GET,
|
|
7177
|
-
url: "/
|
|
7178
|
-
queryParams: {
|
|
7259
|
+
url: "/issues/associations/",
|
|
7260
|
+
queryParams: { project_id: projectId.toString() },
|
|
7179
7261
|
blockers: [],
|
|
7180
7262
|
blocks: []
|
|
7181
7263
|
});
|
|
7182
7264
|
this.dispatch(initializeIssueAssociations(issueAssociations));
|
|
7183
7265
|
}
|
|
7184
7266
|
}
|
|
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
7267
|
var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
8110
7268
|
VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
|
|
8111
7269
|
VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
|
|
@@ -8122,10 +7280,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8122
7280
|
exports2.AssetStageCompletionService = AssetStageCompletionService;
|
|
8123
7281
|
exports2.AssetStageService = AssetStageService;
|
|
8124
7282
|
exports2.AssetTypeAttachmentService = AssetTypeAttachmentService;
|
|
8125
|
-
exports2.AssetTypeFieldValuesAttachmentService = AssetTypeFieldValuesAttachmentService;
|
|
8126
|
-
exports2.AssetTypeFieldValuesService = AssetTypeFieldValuesService;
|
|
8127
|
-
exports2.AssetTypeFieldsAttachmentService = AssetTypeFieldsAttachmentService;
|
|
8128
|
-
exports2.AssetTypeFieldsService = AssetTypeFieldsService;
|
|
8129
7283
|
exports2.AssetTypeService = AssetTypeService;
|
|
8130
7284
|
exports2.AttachmentModel = AttachmentModel;
|
|
8131
7285
|
exports2.BaseApiService = BaseApiService;
|
|
@@ -8141,10 +7295,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8141
7295
|
exports2.EmailDomainsService = EmailDomainsService;
|
|
8142
7296
|
exports2.EmailVerificationService = EmailVerificationService;
|
|
8143
7297
|
exports2.FileService = FileService;
|
|
8144
|
-
exports2.FormRevisionAttachmentService = FormRevisionAttachmentService;
|
|
8145
|
-
exports2.FormRevisionService = FormRevisionService;
|
|
8146
7298
|
exports2.FormService = FormService;
|
|
8147
|
-
exports2.FormSubmissionAttachmentService = FormSubmissionAttachmentService;
|
|
8148
7299
|
exports2.FormSubmissionService = FormSubmissionService;
|
|
8149
7300
|
exports2.GREEN = GREEN;
|
|
8150
7301
|
exports2.GeoImageService = GeoImageService;
|
|
@@ -8155,10 +7306,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8155
7306
|
exports2.IssuePriority = IssuePriority;
|
|
8156
7307
|
exports2.IssueService = IssueService;
|
|
8157
7308
|
exports2.IssueStatus = IssueStatus;
|
|
8158
|
-
exports2.IssueTypeFieldValuesAttachmentService = IssueTypeFieldValuesAttachmentService;
|
|
8159
|
-
exports2.IssueTypeFieldValuesService = IssueTypeFieldValuesService;
|
|
8160
|
-
exports2.IssueTypeFieldsAttachmentService = IssueTypeFieldsAttachmentService;
|
|
8161
|
-
exports2.IssueTypeFieldsService = IssueTypeFieldsService;
|
|
8162
7309
|
exports2.IssueTypeService = IssueTypeService;
|
|
8163
7310
|
exports2.IssueUpdateChange = IssueUpdateChange;
|
|
8164
7311
|
exports2.IssueUpdateService = IssueUpdateService;
|
|
@@ -8198,14 +7345,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8198
7345
|
exports2.addAssetType = addAssetType;
|
|
8199
7346
|
exports2.addAssetTypeAttachment = addAssetTypeAttachment;
|
|
8200
7347
|
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
7348
|
exports2.addAssetTypes = addAssetTypes;
|
|
8210
7349
|
exports2.addAssets = addAssets;
|
|
8211
7350
|
exports2.addCategory = addCategory;
|
|
@@ -8234,14 +7373,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8234
7373
|
exports2.addIssueComment = addIssueComment;
|
|
8235
7374
|
exports2.addIssueComments = addIssueComments;
|
|
8236
7375
|
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
7376
|
exports2.addIssueUpdate = addIssueUpdate;
|
|
8246
7377
|
exports2.addIssueUpdates = addIssueUpdates;
|
|
8247
7378
|
exports2.addIssues = addIssues;
|
|
@@ -8267,28 +7398,16 @@ var __publicField = (obj, key, value) => {
|
|
|
8267
7398
|
exports2.assetStageSlice = assetStageSlice;
|
|
8268
7399
|
exports2.assetTypeAttachmentReducer = assetTypeAttachmentReducer;
|
|
8269
7400
|
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
7401
|
exports2.assetTypeReducer = assetTypeReducer;
|
|
8279
7402
|
exports2.assetTypeSlice = assetTypeSlice;
|
|
8280
7403
|
exports2.authReducer = authReducer;
|
|
8281
7404
|
exports2.authSlice = authSlice;
|
|
8282
7405
|
exports2.blobToBase64 = blobToBase64;
|
|
8283
|
-
exports2.boundsContainPoint = boundsContainPoint;
|
|
8284
7406
|
exports2.categoryReducer = categoryReducer;
|
|
8285
7407
|
exports2.categorySlice = categorySlice;
|
|
8286
7408
|
exports2.clearTokens = clearTokens;
|
|
8287
7409
|
exports2.constructUploadedFilePayloads = constructUploadedFilePayloads;
|
|
8288
7410
|
exports2.coordinatesAreEqual = coordinatesAreEqual;
|
|
8289
|
-
exports2.coordinatesToLiteral = coordinatesToLiteral;
|
|
8290
|
-
exports2.coordinatesToText = coordinatesToText;
|
|
8291
|
-
exports2.coordinatesToUrlText = coordinatesToUrlText;
|
|
8292
7411
|
exports2.createMultiPointGeometry = createMultiPointGeometry;
|
|
8293
7412
|
exports2.createOfflineAction = createOfflineAction;
|
|
8294
7413
|
exports2.createPointGeometry = createPointGeometry;
|
|
@@ -8303,14 +7422,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8303
7422
|
exports2.deleteAssetType = deleteAssetType;
|
|
8304
7423
|
exports2.deleteAssetTypeAttachment = deleteAssetTypeAttachment;
|
|
8305
7424
|
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
7425
|
exports2.deleteAssetTypes = deleteAssetTypes;
|
|
8315
7426
|
exports2.deleteAssets = deleteAssets;
|
|
8316
7427
|
exports2.deleteCategory = deleteCategory;
|
|
@@ -8335,14 +7446,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8335
7446
|
exports2.deleteIssueAttachments = deleteIssueAttachments;
|
|
8336
7447
|
exports2.deleteIssueComment = deleteIssueComment;
|
|
8337
7448
|
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
7449
|
exports2.deleteIssueUpdate = deleteIssueUpdate;
|
|
8347
7450
|
exports2.deleteIssueUpdates = deleteIssueUpdates;
|
|
8348
7451
|
exports2.deleteIssues = deleteIssues;
|
|
@@ -8372,8 +7475,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8372
7475
|
exports2.fileReducer = fileReducer;
|
|
8373
7476
|
exports2.fileSlice = fileSlice;
|
|
8374
7477
|
exports2.fileToBlob = fileToBlob;
|
|
8375
|
-
exports2.flipBounds = flipBounds;
|
|
8376
|
-
exports2.flipCoordinates = flipCoordinates;
|
|
8377
7478
|
exports2.formReducer = formReducer;
|
|
8378
7479
|
exports2.formRevisionAttachmentReducer = formRevisionAttachmentReducer;
|
|
8379
7480
|
exports2.formRevisionAttachmentSlice = formRevisionAttachmentSlice;
|
|
@@ -8399,10 +7500,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8399
7500
|
exports2.initializeAssetStageCompletions = initializeAssetStageCompletions;
|
|
8400
7501
|
exports2.initializeAssetStages = initializeAssetStages;
|
|
8401
7502
|
exports2.initializeAssetTypeAttachments = initializeAssetTypeAttachments;
|
|
8402
|
-
exports2.initializeAssetTypeFieldValues = initializeAssetTypeFieldValues;
|
|
8403
|
-
exports2.initializeAssetTypeFieldValuesAttachments = initializeAssetTypeFieldValuesAttachments;
|
|
8404
|
-
exports2.initializeAssetTypeFields = initializeAssetTypeFields;
|
|
8405
|
-
exports2.initializeAssetTypeFieldsAttachments = initializeAssetTypeFieldsAttachments;
|
|
8406
7503
|
exports2.initializeAssetTypes = initializeAssetTypes;
|
|
8407
7504
|
exports2.initializeAssets = initializeAssets;
|
|
8408
7505
|
exports2.initializeCategories = initializeCategories;
|
|
@@ -8417,10 +7514,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8417
7514
|
exports2.initializeGeoImages = initializeGeoImages;
|
|
8418
7515
|
exports2.initializeIssueAssociations = initializeIssueAssociations;
|
|
8419
7516
|
exports2.initializeIssueAttachments = initializeIssueAttachments;
|
|
8420
|
-
exports2.initializeIssueTypeFieldValues = initializeIssueTypeFieldValues;
|
|
8421
|
-
exports2.initializeIssueTypeFieldValuesAttachments = initializeIssueTypeFieldValuesAttachments;
|
|
8422
|
-
exports2.initializeIssueTypeFields = initializeIssueTypeFields;
|
|
8423
|
-
exports2.initializeIssueTypeFieldsAttachments = initializeIssueTypeFieldsAttachments;
|
|
8424
7517
|
exports2.initializeIssueTypes = initializeIssueTypes;
|
|
8425
7518
|
exports2.initializeIssueUpdates = initializeIssueUpdates;
|
|
8426
7519
|
exports2.initializeIssues = initializeIssues;
|
|
@@ -8439,32 +7532,20 @@ var __publicField = (obj, key, value) => {
|
|
|
8439
7532
|
exports2.issueCommentSlice = issueCommentSlice;
|
|
8440
7533
|
exports2.issueReducer = issueReducer;
|
|
8441
7534
|
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
7535
|
exports2.issueTypeReducer = issueTypeReducer;
|
|
8451
7536
|
exports2.issueTypeSlice = issueTypeSlice;
|
|
8452
7537
|
exports2.issueUpdateReducer = issueUpdateReducer;
|
|
8453
7538
|
exports2.issueUpdateSlice = issueUpdateSlice;
|
|
8454
7539
|
exports2.licenseReducer = licenseReducer;
|
|
8455
7540
|
exports2.licenseSlice = licenseSlice;
|
|
8456
|
-
exports2.literalToCoordinates = literalToCoordinates;
|
|
8457
7541
|
exports2.logOnlyOnce = logOnlyOnce;
|
|
8458
7542
|
exports2.markAsDeleted = markAsDeleted;
|
|
8459
7543
|
exports2.markForDeletion = markForDeletion;
|
|
8460
7544
|
exports2.memoize = memoize;
|
|
8461
7545
|
exports2.moveDocument = moveDocument;
|
|
8462
7546
|
exports2.offline = offline;
|
|
8463
|
-
exports2.offsetPositionByMeters = offsetPositionByMeters;
|
|
8464
7547
|
exports2.onlyUniqueHashes = onlyUniqueHashes;
|
|
8465
7548
|
exports2.onlyUniqueOfflineIds = onlyUniqueOfflineIds;
|
|
8466
|
-
exports2.openCoordsInGoogleMaps = openCoordsInGoogleMaps;
|
|
8467
|
-
exports2.openDirectionsInGoogleMaps = openDirectionsInGoogleMaps;
|
|
8468
7549
|
exports2.organizationAccessReducer = organizationAccessReducer;
|
|
8469
7550
|
exports2.organizationAccessSlice = organizationAccessSlice;
|
|
8470
7551
|
exports2.organizationReducer = organizationReducer;
|
|
@@ -8519,22 +7600,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8519
7600
|
exports2.selectAssetTypeAttachmentMapping = selectAssetTypeAttachmentMapping;
|
|
8520
7601
|
exports2.selectAssetTypeAttachments = selectAssetTypeAttachments;
|
|
8521
7602
|
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
7603
|
exports2.selectAssetTypeStagesMapping = selectAssetTypeStagesMapping;
|
|
8537
|
-
exports2.selectAssetTypeValuesOfAssetType = selectAssetTypeValuesOfAssetType;
|
|
8538
7604
|
exports2.selectAssetTypes = selectAssetTypes;
|
|
8539
7605
|
exports2.selectAssetTypesByIds = selectAssetTypesByIds;
|
|
8540
7606
|
exports2.selectAssetTypesMapping = selectAssetTypesMapping;
|
|
@@ -8542,20 +7608,18 @@ var __publicField = (obj, key, value) => {
|
|
|
8542
7608
|
exports2.selectAssetsByIds = selectAssetsByIds;
|
|
8543
7609
|
exports2.selectAssetsMapping = selectAssetsMapping;
|
|
8544
7610
|
exports2.selectAssetsOfAssetType = selectAssetsOfAssetType;
|
|
7611
|
+
exports2.selectAttachedFormSubmissionsOfAsset = selectAttachedFormSubmissionsOfAsset;
|
|
7612
|
+
exports2.selectAttachedFormSubmissionsOfIssue = selectAttachedFormSubmissionsOfIssue;
|
|
8545
7613
|
exports2.selectAttachmentsOfAsset = selectAttachmentsOfAsset;
|
|
8546
7614
|
exports2.selectAttachmentsOfAssetByType = selectAttachmentsOfAssetByType;
|
|
8547
7615
|
exports2.selectAttachmentsOfAssetType = selectAttachmentsOfAssetType;
|
|
8548
7616
|
exports2.selectAttachmentsOfAssetTypeByType = selectAttachmentsOfAssetTypeByType;
|
|
8549
|
-
exports2.selectAttachmentsOfAssetTypeFieldValues = selectAttachmentsOfAssetTypeFieldValues;
|
|
8550
|
-
exports2.selectAttachmentsOfAssetTypeFields = selectAttachmentsOfAssetTypeFields;
|
|
8551
7617
|
exports2.selectAttachmentsOfDocument = selectAttachmentsOfDocument;
|
|
8552
7618
|
exports2.selectAttachmentsOfDocumentByType = selectAttachmentsOfDocumentByType;
|
|
8553
7619
|
exports2.selectAttachmentsOfFormRevision = selectAttachmentsOfFormRevision;
|
|
8554
7620
|
exports2.selectAttachmentsOfFormSubmission = selectAttachmentsOfFormSubmission;
|
|
8555
7621
|
exports2.selectAttachmentsOfIssue = selectAttachmentsOfIssue;
|
|
8556
7622
|
exports2.selectAttachmentsOfIssueByType = selectAttachmentsOfIssueByType;
|
|
8557
|
-
exports2.selectAttachmentsOfIssueTypeFieldValues = selectAttachmentsOfIssueTypeFieldValues;
|
|
8558
|
-
exports2.selectAttachmentsOfIssueTypeFields = selectAttachmentsOfIssueTypeFields;
|
|
8559
7623
|
exports2.selectAttachmentsOfProject = selectAttachmentsOfProject;
|
|
8560
7624
|
exports2.selectAttachmentsOfProjectByType = selectAttachmentsOfProjectByType;
|
|
8561
7625
|
exports2.selectCategories = selectCategories;
|
|
@@ -8583,6 +7647,8 @@ var __publicField = (obj, key, value) => {
|
|
|
8583
7647
|
exports2.selectFilteredForms = selectFilteredForms;
|
|
8584
7648
|
exports2.selectFormById = selectFormById;
|
|
8585
7649
|
exports2.selectFormMapping = selectFormMapping;
|
|
7650
|
+
exports2.selectFormOfAssetType = selectFormOfAssetType;
|
|
7651
|
+
exports2.selectFormOfIssueType = selectFormOfIssueType;
|
|
8586
7652
|
exports2.selectFormRevisionAttachmentsMapping = selectFormRevisionAttachmentsMapping;
|
|
8587
7653
|
exports2.selectFormRevisionById = selectFormRevisionById;
|
|
8588
7654
|
exports2.selectFormRevisionMapping = selectFormRevisionMapping;
|
|
@@ -8592,11 +7658,16 @@ var __publicField = (obj, key, value) => {
|
|
|
8592
7658
|
exports2.selectFormSubmissionAttachmentsMapping = selectFormSubmissionAttachmentsMapping;
|
|
8593
7659
|
exports2.selectFormSubmissionById = selectFormSubmissionById;
|
|
8594
7660
|
exports2.selectFormSubmissions = selectFormSubmissions;
|
|
7661
|
+
exports2.selectFormSubmissionsByAssets = selectFormSubmissionsByAssets;
|
|
7662
|
+
exports2.selectFormSubmissionsByFormRevisions = selectFormSubmissionsByFormRevisions;
|
|
7663
|
+
exports2.selectFormSubmissionsByIssues = selectFormSubmissionsByIssues;
|
|
8595
7664
|
exports2.selectFormSubmissionsMapping = selectFormSubmissionsMapping;
|
|
8596
7665
|
exports2.selectFormSubmissionsOfAsset = selectFormSubmissionsOfAsset;
|
|
8597
7666
|
exports2.selectFormSubmissionsOfForm = selectFormSubmissionsOfForm;
|
|
8598
7667
|
exports2.selectFormSubmissionsOfIssue = selectFormSubmissionsOfIssue;
|
|
8599
7668
|
exports2.selectForms = selectForms;
|
|
7669
|
+
exports2.selectFormsCount = selectFormsCount;
|
|
7670
|
+
exports2.selectGeneralFormCount = selectGeneralFormCount;
|
|
8600
7671
|
exports2.selectGeoImageById = selectGeoImageById;
|
|
8601
7672
|
exports2.selectGeoImageMapping = selectGeoImageMapping;
|
|
8602
7673
|
exports2.selectGeoImages = selectGeoImages;
|
|
@@ -8618,22 +7689,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8618
7689
|
exports2.selectIssueCountOfCategory = selectIssueCountOfCategory;
|
|
8619
7690
|
exports2.selectIssueMapping = selectIssueMapping;
|
|
8620
7691
|
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
7692
|
exports2.selectIssueTypeMapping = selectIssueTypeMapping;
|
|
8636
|
-
exports2.selectIssueTypeValuesOfIssueType = selectIssueTypeValuesOfIssueType;
|
|
8637
7693
|
exports2.selectIssueTypes = selectIssueTypes;
|
|
8638
7694
|
exports2.selectIssueTypesByIds = selectIssueTypesByIds;
|
|
8639
7695
|
exports2.selectIssueTypesOfOrganization = selectIssueTypesOfOrganization;
|
|
@@ -8642,9 +7698,8 @@ var __publicField = (obj, key, value) => {
|
|
|
8642
7698
|
exports2.selectIssuesByIds = selectIssuesByIds;
|
|
8643
7699
|
exports2.selectIssuesOfIssueType = selectIssuesOfIssueType;
|
|
8644
7700
|
exports2.selectIssuesOfIssueTypeCount = selectIssuesOfIssueTypeCount;
|
|
8645
|
-
exports2.
|
|
7701
|
+
exports2.selectLatestFormRevisionByForm = selectLatestFormRevisionByForm;
|
|
8646
7702
|
exports2.selectLatestFormRevisionOfForm = selectLatestFormRevisionOfForm;
|
|
8647
|
-
exports2.selectLatestIssueTypeFieldsOfIssueType = selectLatestIssueTypeFieldsOfIssueType;
|
|
8648
7703
|
exports2.selectLatestRetryTime = selectLatestRetryTime;
|
|
8649
7704
|
exports2.selectLicense = selectLicense;
|
|
8650
7705
|
exports2.selectLicenseForProject = selectLicenseForProject;
|
|
@@ -8681,6 +7736,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8681
7736
|
exports2.selectProjectsOfOrganization = selectProjectsOfOrganization;
|
|
8682
7737
|
exports2.selectRehydrated = selectRehydrated;
|
|
8683
7738
|
exports2.selectRootDocuments = selectRootDocuments;
|
|
7739
|
+
exports2.selectSortedFormSubmissionsOfForm = selectSortedFormSubmissionsOfForm;
|
|
8684
7740
|
exports2.selectSortedOrganizationUsers = selectSortedOrganizationUsers;
|
|
8685
7741
|
exports2.selectSortedProjectUsers = selectSortedProjectUsers;
|
|
8686
7742
|
exports2.selectStageFormIdsFromStageIds = selectStageFormIdsFromStageIds;
|
|
@@ -8699,8 +7755,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8699
7755
|
exports2.selectWorkspaceById = selectWorkspaceById;
|
|
8700
7756
|
exports2.selectWorkspaceMapping = selectWorkspaceMapping;
|
|
8701
7757
|
exports2.selectWorkspaces = selectWorkspaces;
|
|
8702
|
-
exports2.separateFilesFromValues = separateFilesFromValues;
|
|
8703
|
-
exports2.separateImageFromFields = separateImageFromFields;
|
|
8704
7758
|
exports2.setActiveProjectFileId = setActiveProjectFileId;
|
|
8705
7759
|
exports2.setActiveProjectId = setActiveProjectId;
|
|
8706
7760
|
exports2.setAsset = setAsset;
|
|
@@ -8711,14 +7765,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8711
7765
|
exports2.setAssetType = setAssetType;
|
|
8712
7766
|
exports2.setAssetTypeAttachment = setAssetTypeAttachment;
|
|
8713
7767
|
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
7768
|
exports2.setAssetTypes = setAssetTypes;
|
|
8723
7769
|
exports2.setAssets = setAssets;
|
|
8724
7770
|
exports2.setConversation = setConversation;
|
|
@@ -8744,14 +7790,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8744
7790
|
exports2.setIssueComment = setIssueComment;
|
|
8745
7791
|
exports2.setIssueComments = setIssueComments;
|
|
8746
7792
|
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
7793
|
exports2.setIssueUpdate = setIssueUpdate;
|
|
8756
7794
|
exports2.setLoggedIn = setLoggedIn;
|
|
8757
7795
|
exports2.setOrganizations = setOrganizations;
|
|
@@ -8784,14 +7822,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8784
7822
|
exports2.updateAssetType = updateAssetType;
|
|
8785
7823
|
exports2.updateAssetTypeAttachment = updateAssetTypeAttachment;
|
|
8786
7824
|
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
7825
|
exports2.updateAssetTypes = updateAssetTypes;
|
|
8796
7826
|
exports2.updateAssets = updateAssets;
|
|
8797
7827
|
exports2.updateCategory = updateCategory;
|
|
@@ -8814,14 +7844,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8814
7844
|
exports2.updateIssueAttachment = updateIssueAttachment;
|
|
8815
7845
|
exports2.updateIssueAttachments = updateIssueAttachments;
|
|
8816
7846
|
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
7847
|
exports2.updateLicense = updateLicense;
|
|
8826
7848
|
exports2.updateOrCreateProject = updateOrCreateProject;
|
|
8827
7849
|
exports2.updateOrganizationAccess = updateOrganizationAccess;
|
|
@@ -8837,7 +7859,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8837
7859
|
exports2.warningColor = warningColor;
|
|
8838
7860
|
exports2.workspaceReducer = workspaceReducer;
|
|
8839
7861
|
exports2.workspaceSlice = workspaceSlice;
|
|
8840
|
-
exports2.worldBounds = worldBounds;
|
|
8841
7862
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
8842
7863
|
});
|
|
8843
7864
|
//# sourceMappingURL=overmap-core.umd.cjs.map
|