@overmap-ai/core 1.0.71-fields.9 → 1.0.71-mapbox.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/overmap-core.js +1038 -2009
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +1038 -2009
- 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 -8
- 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,8 +4935,16 @@ var __publicField = (obj, key, value) => {
|
|
|
5265
4935
|
this.dispatch(addIssueType(offlineIssueType));
|
|
5266
4936
|
const promise = this.enqueueRequest({
|
|
5267
4937
|
method: HttpMethod.POST,
|
|
5268
|
-
url:
|
|
5269
|
-
|
|
4938
|
+
url: `/organizations/${payload.organization}/issue-types/`,
|
|
4939
|
+
// Sending only whats needed here
|
|
4940
|
+
payload: {
|
|
4941
|
+
offline_id: offlineIssueType.offline_id,
|
|
4942
|
+
submitted_at: offlineIssueType.submitted_at,
|
|
4943
|
+
icon: offlineIssueType.icon,
|
|
4944
|
+
color: offlineIssueType.color,
|
|
4945
|
+
name: offlineIssueType.name,
|
|
4946
|
+
description: offlineIssueType.description
|
|
4947
|
+
},
|
|
5270
4948
|
blockers: [],
|
|
5271
4949
|
blocks: [offlineIssueType.offline_id]
|
|
5272
4950
|
});
|
|
@@ -5291,7 +4969,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5291
4969
|
this.dispatch(updateIssueType(offlineUpdatedIssueType));
|
|
5292
4970
|
const promise = this.enqueueRequest({
|
|
5293
4971
|
method: HttpMethod.PATCH,
|
|
5294
|
-
url: `/
|
|
4972
|
+
url: `/issues/types/${payload.offline_id}/`,
|
|
5295
4973
|
payload,
|
|
5296
4974
|
blockers: [payload.offline_id],
|
|
5297
4975
|
blocks: [payload.offline_id]
|
|
@@ -5315,7 +4993,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5315
4993
|
this.dispatch(deleteIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
|
|
5316
4994
|
const promise = this.enqueueRequest({
|
|
5317
4995
|
method: HttpMethod.DELETE,
|
|
5318
|
-
url: `/
|
|
4996
|
+
url: `/issues/types/${id}/`,
|
|
5319
4997
|
blockers: [id],
|
|
5320
4998
|
blocks: []
|
|
5321
4999
|
});
|
|
@@ -5328,10 +5006,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5328
5006
|
async refreshStore(organizationId) {
|
|
5329
5007
|
const result = await this.enqueueRequest({
|
|
5330
5008
|
method: HttpMethod.GET,
|
|
5331
|
-
url:
|
|
5332
|
-
queryParams: {
|
|
5333
|
-
organization: organizationId.toString()
|
|
5334
|
-
},
|
|
5009
|
+
url: `/organizations/${organizationId}/issue-types/`,
|
|
5335
5010
|
blockers: [],
|
|
5336
5011
|
blocks: []
|
|
5337
5012
|
});
|
|
@@ -5475,8 +5150,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5475
5150
|
class ProjectAttachmentService extends BaseAttachmentService {
|
|
5476
5151
|
constructor() {
|
|
5477
5152
|
super(...arguments);
|
|
5478
|
-
__publicField(this, "
|
|
5479
|
-
__publicField(this, "
|
|
5153
|
+
__publicField(this, "attachmentModel", AttachmentModel.Project);
|
|
5154
|
+
__publicField(this, "initializeAttachments", initializeProjectAttachments);
|
|
5480
5155
|
__publicField(this, "addAttachments", addProjectAttachments);
|
|
5481
5156
|
__publicField(this, "updateAttachments", updateProjectAttachments);
|
|
5482
5157
|
__publicField(this, "removeAttachments", deleteProjectAttachments);
|
|
@@ -5487,39 +5162,20 @@ var __publicField = (obj, key, value) => {
|
|
|
5487
5162
|
buildOfflineAttachment(data) {
|
|
5488
5163
|
return offline({
|
|
5489
5164
|
file: URL.createObjectURL(data.file),
|
|
5490
|
-
file_sha1: data.
|
|
5491
|
-
created_by: data.
|
|
5165
|
+
file_sha1: data.sha1,
|
|
5166
|
+
created_by: data.createdBy,
|
|
5492
5167
|
file_name: data.file.name,
|
|
5493
5168
|
file_type: data.file.type,
|
|
5494
|
-
submitted_at: data.
|
|
5169
|
+
submitted_at: data.submittedAt,
|
|
5495
5170
|
description: data.description,
|
|
5496
5171
|
project: data.modelId
|
|
5497
5172
|
});
|
|
5498
5173
|
}
|
|
5499
|
-
|
|
5500
|
-
return
|
|
5501
|
-
...data,
|
|
5502
|
-
project: data.modelId
|
|
5503
|
-
};
|
|
5504
|
-
}
|
|
5505
|
-
async bulkAdd(payloads) {
|
|
5506
|
-
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));
|
|
5507
5176
|
}
|
|
5508
|
-
async
|
|
5509
|
-
return this.
|
|
5510
|
-
}
|
|
5511
|
-
async refreshStore(projectId) {
|
|
5512
|
-
const result = await this.enqueueRequest({
|
|
5513
|
-
description: "Get project attachments",
|
|
5514
|
-
method: HttpMethod.GET,
|
|
5515
|
-
url: `${this.url}/`,
|
|
5516
|
-
queryParams: {
|
|
5517
|
-
project: projectId.toString()
|
|
5518
|
-
},
|
|
5519
|
-
blockers: [],
|
|
5520
|
-
blocks: []
|
|
5521
|
-
});
|
|
5522
|
-
this.dispatch(initializeProjectAttachments(result));
|
|
5177
|
+
async deleteProjectAttachment(attachmentId) {
|
|
5178
|
+
return this.deleteAttachment(attachmentId);
|
|
5523
5179
|
}
|
|
5524
5180
|
}
|
|
5525
5181
|
class ProjectService extends BaseApiService {
|
|
@@ -5662,54 +5318,202 @@ var __publicField = (obj, key, value) => {
|
|
|
5662
5318
|
return { fields: newFields, images };
|
|
5663
5319
|
};
|
|
5664
5320
|
class FormService extends BaseUploadService {
|
|
5665
|
-
|
|
5321
|
+
async bulkAddRevisionAttachments(revisionId, files) {
|
|
5666
5322
|
var _a2;
|
|
5667
|
-
const { store } = this.client;
|
|
5668
5323
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5669
|
-
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5670
|
-
const
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
submitted_at:
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
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
|
+
}
|
|
5713
5517
|
async delete(id) {
|
|
5714
5518
|
const { store } = this.client;
|
|
5715
5519
|
const state = store.getState();
|
|
@@ -5745,31 +5549,65 @@ var __publicField = (obj, key, value) => {
|
|
|
5745
5549
|
throw e;
|
|
5746
5550
|
}
|
|
5747
5551
|
}
|
|
5748
|
-
async refreshStore(projectId
|
|
5749
|
-
|
|
5750
|
-
const
|
|
5552
|
+
async refreshStore(projectId) {
|
|
5553
|
+
const forms = [];
|
|
5554
|
+
const revisions = [];
|
|
5555
|
+
const attachments = [];
|
|
5556
|
+
const projectFormsResult = await this.enqueueRequest({
|
|
5751
5557
|
description: "Fetch project forms",
|
|
5752
5558
|
method: HttpMethod.GET,
|
|
5753
|
-
url:
|
|
5754
|
-
queryParams: {
|
|
5755
|
-
project: projectId.toString()
|
|
5756
|
-
},
|
|
5559
|
+
url: `/projects/${projectId}/forms/`,
|
|
5757
5560
|
blockers: [projectId.toString()],
|
|
5758
5561
|
blocks: []
|
|
5759
5562
|
});
|
|
5760
|
-
|
|
5761
|
-
|
|
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({
|
|
5762
5570
|
description: "Fetch organization forms",
|
|
5763
5571
|
method: HttpMethod.GET,
|
|
5764
|
-
url:
|
|
5765
|
-
|
|
5766
|
-
organization: organizationId.toString()
|
|
5767
|
-
},
|
|
5768
|
-
blockers: [organizationId.toString()],
|
|
5572
|
+
url: `/projects/${projectId}/organizations/forms/`,
|
|
5573
|
+
blockers: [projectId.toString()],
|
|
5769
5574
|
blocks: []
|
|
5770
5575
|
});
|
|
5771
|
-
|
|
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()],
|
|
5600
|
+
blocks: []
|
|
5601
|
+
});
|
|
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);
|
|
5772
5608
|
this.dispatch(initializeForms(forms));
|
|
5609
|
+
this.dispatch(initializeFormRevisions(revisions));
|
|
5610
|
+
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
5773
5611
|
}
|
|
5774
5612
|
}
|
|
5775
5613
|
const isArrayOfFiles = (value) => {
|
|
@@ -5791,11 +5629,95 @@ var __publicField = (obj, key, value) => {
|
|
|
5791
5629
|
return { values: newValues, files };
|
|
5792
5630
|
};
|
|
5793
5631
|
class FormSubmissionService extends BaseUploadService {
|
|
5794
|
-
|
|
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) {
|
|
5795
5717
|
var _a2;
|
|
5796
5718
|
const { store } = this.client;
|
|
5797
5719
|
const state = store.getState();
|
|
5798
|
-
const { values } = separateFilesFromValues(payload.values);
|
|
5720
|
+
const { values, files } = separateFilesFromValues(payload.values);
|
|
5799
5721
|
const offlineSubmission = offline({
|
|
5800
5722
|
...payload,
|
|
5801
5723
|
values,
|
|
@@ -5805,7 +5727,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5805
5727
|
const promise = this.enqueueRequest({
|
|
5806
5728
|
description: "Respond to form",
|
|
5807
5729
|
method: HttpMethod.POST,
|
|
5808
|
-
url:
|
|
5730
|
+
url: `/forms/revisions/${payload.form_revision}/respond/`,
|
|
5809
5731
|
payload: offlineSubmission,
|
|
5810
5732
|
blockers: [payload.issue, payload.asset, payload.asset_stage, "add-form-entry"].filter(
|
|
5811
5733
|
(x) => x !== void 0
|
|
@@ -5813,6 +5735,10 @@ var __publicField = (obj, key, value) => {
|
|
|
5813
5735
|
blocks: [offlineSubmission.offline_id]
|
|
5814
5736
|
});
|
|
5815
5737
|
this.dispatch(addFormSubmission(offlineSubmission));
|
|
5738
|
+
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
5739
|
+
offlineSubmission.offline_id,
|
|
5740
|
+
files
|
|
5741
|
+
);
|
|
5816
5742
|
promise.then((result) => {
|
|
5817
5743
|
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5818
5744
|
this.dispatch(setFormSubmission(result));
|
|
@@ -5821,16 +5747,115 @@ var __publicField = (obj, key, value) => {
|
|
|
5821
5747
|
this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
|
|
5822
5748
|
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5823
5749
|
});
|
|
5824
|
-
return [offlineSubmission, promise];
|
|
5750
|
+
return [offlineSubmission, offlineFormSubmissionAttachments, promise, attachmentsPromise];
|
|
5825
5751
|
}
|
|
5826
|
-
|
|
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) {
|
|
5827
5852
|
const { store } = this.client;
|
|
5828
5853
|
const state = store.getState();
|
|
5829
5854
|
const submissionToBeUpdated = selectFormSubmissionById(payload.offline_id)(state);
|
|
5830
5855
|
if (!submissionToBeUpdated) {
|
|
5831
5856
|
throw new Error(`Expected submission with offline_id ${payload.offline_id} to exist`);
|
|
5832
5857
|
}
|
|
5833
|
-
const { values } = separateFilesFromValues(payload.values ?? {});
|
|
5858
|
+
const { values, files } = separateFilesFromValues(payload.values ?? {});
|
|
5834
5859
|
const updatedSubmission = {
|
|
5835
5860
|
...submissionToBeUpdated,
|
|
5836
5861
|
...payload,
|
|
@@ -5844,18 +5869,39 @@ var __publicField = (obj, key, value) => {
|
|
|
5844
5869
|
const promise = this.enqueueRequest({
|
|
5845
5870
|
description: "Delete user form submissions",
|
|
5846
5871
|
method: HttpMethod.PATCH,
|
|
5847
|
-
url: `/
|
|
5872
|
+
url: `/forms/submissions/${updatedSubmission.offline_id}/`,
|
|
5848
5873
|
// TODO: send just payload when FormSubmissionDeserializer is updated to handle partial updates
|
|
5849
5874
|
payload: updatedSubmission,
|
|
5850
5875
|
blockers: [updatedSubmission.offline_id],
|
|
5851
5876
|
blocks: [updatedSubmission.offline_id]
|
|
5852
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
|
+
);
|
|
5853
5893
|
promise.then((result) => {
|
|
5854
5894
|
this.dispatch(setFormSubmission(result));
|
|
5855
5895
|
}).catch(() => {
|
|
5856
5896
|
this.dispatch(setFormSubmission(submissionToBeUpdated));
|
|
5857
5897
|
});
|
|
5858
|
-
return [
|
|
5898
|
+
return [
|
|
5899
|
+
updatedSubmission,
|
|
5900
|
+
offlineFormSubmissionAttachments,
|
|
5901
|
+
promise,
|
|
5902
|
+
attachmentsPromise,
|
|
5903
|
+
deleteAttachmentsPromise
|
|
5904
|
+
];
|
|
5859
5905
|
}
|
|
5860
5906
|
async delete(id) {
|
|
5861
5907
|
const { store } = this.client;
|
|
@@ -5872,7 +5918,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5872
5918
|
return await this.enqueueRequest({
|
|
5873
5919
|
description: "Delete user form submissions",
|
|
5874
5920
|
method: HttpMethod.DELETE,
|
|
5875
|
-
url: `/
|
|
5921
|
+
url: `/forms/submissions/${id}/`,
|
|
5876
5922
|
blockers: [id],
|
|
5877
5923
|
blocks: []
|
|
5878
5924
|
});
|
|
@@ -5884,17 +5930,50 @@ var __publicField = (obj, key, value) => {
|
|
|
5884
5930
|
}
|
|
5885
5931
|
}
|
|
5886
5932
|
async refreshStore(projectId) {
|
|
5887
|
-
const
|
|
5888
|
-
|
|
5933
|
+
const formSubmissions = {};
|
|
5934
|
+
const modelSubmissions = await this.enqueueRequest({
|
|
5935
|
+
description: "Fetch model submissions",
|
|
5889
5936
|
method: HttpMethod.GET,
|
|
5890
|
-
url:
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
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/`,
|
|
5894
5970
|
blockers: [],
|
|
5895
5971
|
blocks: []
|
|
5896
5972
|
});
|
|
5897
|
-
|
|
5973
|
+
for (const standaloneAttachent of standaloneAttachments) {
|
|
5974
|
+
attachments[standaloneAttachent.offline_id] = standaloneAttachent;
|
|
5975
|
+
}
|
|
5976
|
+
this.dispatch(initializeFormSubmissionAttachments(Object.values(attachments)));
|
|
5898
5977
|
}
|
|
5899
5978
|
}
|
|
5900
5979
|
class WorkspaceService extends BaseApiService {
|
|
@@ -6596,8 +6675,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6596
6675
|
class DocumentAttachmentService extends BaseAttachmentService {
|
|
6597
6676
|
constructor() {
|
|
6598
6677
|
super(...arguments);
|
|
6599
|
-
__publicField(this, "
|
|
6600
|
-
__publicField(this, "
|
|
6678
|
+
__publicField(this, "attachmentModel", AttachmentModel.Document);
|
|
6679
|
+
__publicField(this, "initializeAttachments", initializeDocumentAttachments);
|
|
6601
6680
|
__publicField(this, "addAttachments", addDocumentAttachments);
|
|
6602
6681
|
__publicField(this, "updateAttachments", updateDocumentAttachments);
|
|
6603
6682
|
__publicField(this, "removeAttachments", deleteDocumentAttachments);
|
|
@@ -6608,23 +6687,17 @@ var __publicField = (obj, key, value) => {
|
|
|
6608
6687
|
buildOfflineAttachment(data) {
|
|
6609
6688
|
return offline({
|
|
6610
6689
|
file: URL.createObjectURL(data.file),
|
|
6611
|
-
file_sha1: data.
|
|
6612
|
-
created_by: data.
|
|
6690
|
+
file_sha1: data.sha1,
|
|
6691
|
+
created_by: data.createdBy,
|
|
6613
6692
|
file_name: data.file.name,
|
|
6614
6693
|
file_type: data.file.type,
|
|
6615
|
-
submitted_at: data.
|
|
6694
|
+
submitted_at: data.submittedAt,
|
|
6616
6695
|
description: data.description,
|
|
6617
6696
|
document: data.modelId
|
|
6618
6697
|
});
|
|
6619
6698
|
}
|
|
6620
|
-
buildAttachmentPayload(data) {
|
|
6621
|
-
return {
|
|
6622
|
-
...data,
|
|
6623
|
-
document: data.modelId
|
|
6624
|
-
};
|
|
6625
|
-
}
|
|
6626
6699
|
// NOTE: overriding the method from BaseAttachmentService since document attachments get vectorized
|
|
6627
|
-
async
|
|
6700
|
+
async attachFilesToDocument(files, documentId) {
|
|
6628
6701
|
var _a2;
|
|
6629
6702
|
const { store } = this.client;
|
|
6630
6703
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
@@ -6633,36 +6706,40 @@ var __publicField = (obj, key, value) => {
|
|
|
6633
6706
|
const attachmentPayloads = [];
|
|
6634
6707
|
const filePayloads = {};
|
|
6635
6708
|
const sha1ToAttachmentIds = {};
|
|
6636
|
-
for (const
|
|
6637
|
-
const
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
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);
|
|
6642
6720
|
}
|
|
6643
6721
|
const offlineAttachment = this.buildOfflineAttachment({
|
|
6644
6722
|
file,
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6723
|
+
sha1,
|
|
6724
|
+
submittedAt,
|
|
6725
|
+
createdBy,
|
|
6648
6726
|
description: "",
|
|
6649
6727
|
modelId: documentId
|
|
6650
6728
|
});
|
|
6651
6729
|
offlineAttachments.push(offlineAttachment);
|
|
6652
6730
|
attachmentPayloads.push({
|
|
6653
6731
|
offline_id: offlineAttachment.offline_id,
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
file_extension: filePayload.extension,
|
|
6732
|
+
name: offlineAttachment.file_name,
|
|
6733
|
+
sha1: offlineAttachment.file_sha1,
|
|
6657
6734
|
description: offlineAttachment.description
|
|
6658
6735
|
});
|
|
6659
|
-
sha1ToAttachmentIds[
|
|
6736
|
+
sha1ToAttachmentIds[sha1].push(offlineAttachment.offline_id);
|
|
6660
6737
|
}
|
|
6661
6738
|
this.dispatch(this.addAttachments(offlineAttachments));
|
|
6662
6739
|
const promise = this.enqueueRequest({
|
|
6663
6740
|
description: "Attach files to document",
|
|
6664
6741
|
method: HttpMethod.POST,
|
|
6665
|
-
url:
|
|
6742
|
+
url: `/documents/${documentId}/attach/`,
|
|
6666
6743
|
payload: {
|
|
6667
6744
|
submitted_at: submittedAt,
|
|
6668
6745
|
attachments: attachmentPayloads,
|
|
@@ -6687,14 +6764,14 @@ var __publicField = (obj, key, value) => {
|
|
|
6687
6764
|
});
|
|
6688
6765
|
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
6689
6766
|
}
|
|
6690
|
-
async
|
|
6691
|
-
return this.
|
|
6767
|
+
async deleteDocumentAttachment(attachmentId) {
|
|
6768
|
+
return this.deleteAttachment(attachmentId);
|
|
6692
6769
|
}
|
|
6693
6770
|
makeReadable(attachmnentId) {
|
|
6694
6771
|
void this.enqueueRequest({
|
|
6695
6772
|
description: "Add attachment to AI assistant",
|
|
6696
6773
|
method: HttpMethod.PATCH,
|
|
6697
|
-
url: `/
|
|
6774
|
+
url: `/documents/attachments/${attachmnentId}/`,
|
|
6698
6775
|
payload: {
|
|
6699
6776
|
readable_to_assistant: true
|
|
6700
6777
|
},
|
|
@@ -6711,7 +6788,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6711
6788
|
blocks: [],
|
|
6712
6789
|
blockers: []
|
|
6713
6790
|
});
|
|
6714
|
-
this.dispatch(
|
|
6791
|
+
this.dispatch(this.initializeAttachments(projectDocumentAttachments));
|
|
6715
6792
|
const organizationDocumentAttachments = await this.enqueueRequest({
|
|
6716
6793
|
description: "Get document attachments",
|
|
6717
6794
|
method: HttpMethod.GET,
|
|
@@ -6955,11 +7032,17 @@ var __publicField = (obj, key, value) => {
|
|
|
6955
7032
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6956
7033
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
6957
7034
|
const projectId = payloadWithoutFile.project;
|
|
6958
|
-
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
|
+
};
|
|
6959
7042
|
const offlineMapImage = offline({
|
|
6960
7043
|
...payloadWithoutFile,
|
|
6961
7044
|
file_name: file.name,
|
|
6962
|
-
file_sha1:
|
|
7045
|
+
file_sha1: sha1,
|
|
6963
7046
|
file: URL.createObjectURL(file),
|
|
6964
7047
|
submitted_at: submittedAt,
|
|
6965
7048
|
created_by: createdBy
|
|
@@ -7002,16 +7085,23 @@ var __publicField = (obj, key, value) => {
|
|
|
7002
7085
|
const offlineGeoImages = [];
|
|
7003
7086
|
const offlineIds = [];
|
|
7004
7087
|
const geoImagePayloads = [];
|
|
7005
|
-
const
|
|
7088
|
+
const filePayloadRecord = {};
|
|
7006
7089
|
for (const payloadAndFile of payloads) {
|
|
7007
7090
|
const { file, ...payload } = payloadAndFile;
|
|
7008
|
-
const
|
|
7009
|
-
if (!(
|
|
7010
|
-
|
|
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
|
+
}
|
|
7011
7101
|
const offlineMapImage = offline({
|
|
7012
7102
|
...payload,
|
|
7013
7103
|
file_name: file.name,
|
|
7014
|
-
file_sha1:
|
|
7104
|
+
file_sha1: sha1,
|
|
7015
7105
|
file: URL.createObjectURL(file),
|
|
7016
7106
|
submitted_at: submittedAt,
|
|
7017
7107
|
created_by: createdBy,
|
|
@@ -7040,7 +7130,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7040
7130
|
submitted_at: submittedAt,
|
|
7041
7131
|
project: projectId,
|
|
7042
7132
|
geo_images: geoImagePayloads,
|
|
7043
|
-
files: Object.values(
|
|
7133
|
+
files: Object.values(filePayloadRecord)
|
|
7044
7134
|
},
|
|
7045
7135
|
blocks: [projectId.toString()],
|
|
7046
7136
|
blockers: offlineIds
|
|
@@ -7108,7 +7198,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7108
7198
|
this.dispatch(initializeGeoImages(result));
|
|
7109
7199
|
}
|
|
7110
7200
|
}
|
|
7111
|
-
class IssueAssociationService extends
|
|
7201
|
+
class IssueAssociationService extends BaseUploadService {
|
|
7112
7202
|
add(payload) {
|
|
7113
7203
|
var _a2;
|
|
7114
7204
|
const { store } = this.client;
|
|
@@ -7123,7 +7213,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7123
7213
|
const promise = this.enqueueRequest({
|
|
7124
7214
|
description: "Add issue association",
|
|
7125
7215
|
method: HttpMethod.POST,
|
|
7126
|
-
url: "/
|
|
7216
|
+
url: "/issues/associations/",
|
|
7127
7217
|
payload: {
|
|
7128
7218
|
offline_id: offlineIssueAssociation.offline_id,
|
|
7129
7219
|
submitted_at: submittedAt,
|
|
@@ -7153,7 +7243,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7153
7243
|
const promise = this.enqueueRequest({
|
|
7154
7244
|
description: "Delete issue association",
|
|
7155
7245
|
method: HttpMethod.DELETE,
|
|
7156
|
-
url: `/
|
|
7246
|
+
url: `/issues/associations/${id}/`,
|
|
7157
7247
|
blockers: [id],
|
|
7158
7248
|
blocks: []
|
|
7159
7249
|
});
|
|
@@ -7166,938 +7256,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7166
7256
|
const issueAssociations = await this.enqueueRequest({
|
|
7167
7257
|
description: "Fetch issue associations",
|
|
7168
7258
|
method: HttpMethod.GET,
|
|
7169
|
-
url: "/
|
|
7170
|
-
queryParams: {
|
|
7259
|
+
url: "/issues/associations/",
|
|
7260
|
+
queryParams: { project_id: projectId.toString() },
|
|
7171
7261
|
blockers: [],
|
|
7172
7262
|
blocks: []
|
|
7173
7263
|
});
|
|
7174
7264
|
this.dispatch(initializeIssueAssociations(issueAssociations));
|
|
7175
7265
|
}
|
|
7176
7266
|
}
|
|
7177
|
-
class FormRevisionAttachmentService extends BaseUploadService {
|
|
7178
|
-
async bulkAdd(payloads) {
|
|
7179
|
-
var _a2;
|
|
7180
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7181
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7182
|
-
const filePayloads = {};
|
|
7183
|
-
const offlineFormRevisionAttachments = [];
|
|
7184
|
-
const attachmentPayloads = [];
|
|
7185
|
-
for (const payload of payloads) {
|
|
7186
|
-
const { revisionId, fieldIdentifier, file } = payload;
|
|
7187
|
-
const filePayload = await this.getFilePayload(file);
|
|
7188
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7189
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7190
|
-
const offlineFormRevisionAttachment = offline({
|
|
7191
|
-
file: URL.createObjectURL(file),
|
|
7192
|
-
file_type: file.type,
|
|
7193
|
-
file_name: file.name,
|
|
7194
|
-
file_sha1: filePayload.sha1,
|
|
7195
|
-
created_by: createdBy,
|
|
7196
|
-
form_revision: revisionId,
|
|
7197
|
-
submitted_at: submittedAt,
|
|
7198
|
-
field_identifier: fieldIdentifier
|
|
7199
|
-
});
|
|
7200
|
-
offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
|
|
7201
|
-
const attachmentPayload = {
|
|
7202
|
-
offline_id: offlineFormRevisionAttachment.offline_id,
|
|
7203
|
-
file_name: file.name,
|
|
7204
|
-
field_identifier: fieldIdentifier,
|
|
7205
|
-
file_extension: filePayload.extension,
|
|
7206
|
-
file_sha1: filePayload.sha1,
|
|
7207
|
-
form_revision: revisionId
|
|
7208
|
-
};
|
|
7209
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7210
|
-
}
|
|
7211
|
-
this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
|
|
7212
|
-
const promise = this.enqueueRequest({
|
|
7213
|
-
description: "Attach files to form revision",
|
|
7214
|
-
method: HttpMethod.POST,
|
|
7215
|
-
url: "/form-revision-attachments/bulk/",
|
|
7216
|
-
payload: {
|
|
7217
|
-
submitted_at: submittedAt,
|
|
7218
|
-
attachments: attachmentPayloads,
|
|
7219
|
-
files: Object.values(filePayloads)
|
|
7220
|
-
},
|
|
7221
|
-
blockers: offlineFormRevisionAttachments.map((attachment) => attachment.form_revision),
|
|
7222
|
-
blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
7223
|
-
});
|
|
7224
|
-
promise.then((result) => {
|
|
7225
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
7226
|
-
this.dispatch(updateFormRevisionAttachments(result.attachments));
|
|
7227
|
-
}).catch(() => {
|
|
7228
|
-
this.dispatch(
|
|
7229
|
-
deleteFormRevisionAttachments(
|
|
7230
|
-
offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
7231
|
-
)
|
|
7232
|
-
);
|
|
7233
|
-
});
|
|
7234
|
-
return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
|
|
7235
|
-
}
|
|
7236
|
-
async refreshStore(projectId, organizationId) {
|
|
7237
|
-
let attachments = [];
|
|
7238
|
-
const projectFormRevisions = await this.enqueueRequest({
|
|
7239
|
-
description: "Fetch project form revision attachments",
|
|
7240
|
-
method: HttpMethod.GET,
|
|
7241
|
-
url: "/form-revision-attachments/",
|
|
7242
|
-
queryParams: {
|
|
7243
|
-
project: projectId.toString()
|
|
7244
|
-
},
|
|
7245
|
-
blockers: [projectId.toString()],
|
|
7246
|
-
blocks: []
|
|
7247
|
-
});
|
|
7248
|
-
attachments = attachments.concat(projectFormRevisions);
|
|
7249
|
-
const organizationFormRevisions = await this.enqueueRequest({
|
|
7250
|
-
description: "Fetch organization form revision attachments",
|
|
7251
|
-
method: HttpMethod.GET,
|
|
7252
|
-
url: "/form-revision-attachments/",
|
|
7253
|
-
queryParams: {
|
|
7254
|
-
organization: organizationId.toString()
|
|
7255
|
-
},
|
|
7256
|
-
blockers: [organizationId.toString()],
|
|
7257
|
-
blocks: []
|
|
7258
|
-
});
|
|
7259
|
-
attachments = attachments.concat(organizationFormRevisions);
|
|
7260
|
-
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
7261
|
-
}
|
|
7262
|
-
}
|
|
7263
|
-
class FormSubmissionAttachmentService extends BaseUploadService {
|
|
7264
|
-
async bulkAdd(payloads) {
|
|
7265
|
-
var _a2;
|
|
7266
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7267
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7268
|
-
const filePayloads = {};
|
|
7269
|
-
const offlineFormSubmissionAttachments = [];
|
|
7270
|
-
const attachmentPayloads = [];
|
|
7271
|
-
for (const payload of payloads) {
|
|
7272
|
-
const { submissionId, fieldIdentifier, file } = payload;
|
|
7273
|
-
const filePayload = await this.getFilePayload(file);
|
|
7274
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7275
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7276
|
-
const offlineFormSubmissionAttachment = offline({
|
|
7277
|
-
file: URL.createObjectURL(file),
|
|
7278
|
-
file_type: file.type,
|
|
7279
|
-
file_name: file.name,
|
|
7280
|
-
file_sha1: filePayload.sha1,
|
|
7281
|
-
created_by: createdBy,
|
|
7282
|
-
form_submission: submissionId,
|
|
7283
|
-
submitted_at: submittedAt,
|
|
7284
|
-
field_identifier: fieldIdentifier
|
|
7285
|
-
});
|
|
7286
|
-
offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
|
|
7287
|
-
const attachmentPayload = {
|
|
7288
|
-
offline_id: offlineFormSubmissionAttachment.offline_id,
|
|
7289
|
-
file_name: file.name,
|
|
7290
|
-
file_sha1: filePayload.sha1,
|
|
7291
|
-
file_extension: filePayload.extension,
|
|
7292
|
-
field_identifier: fieldIdentifier,
|
|
7293
|
-
form_submission: submissionId
|
|
7294
|
-
};
|
|
7295
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7296
|
-
}
|
|
7297
|
-
this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
|
|
7298
|
-
const promise = this.enqueueRequest({
|
|
7299
|
-
description: "Attach files to form submission",
|
|
7300
|
-
method: HttpMethod.POST,
|
|
7301
|
-
url: "/form-submission-attachments/bulk/",
|
|
7302
|
-
payload: {
|
|
7303
|
-
submitted_at: submittedAt,
|
|
7304
|
-
attachments: attachmentPayloads,
|
|
7305
|
-
files: Object.values(filePayloads)
|
|
7306
|
-
},
|
|
7307
|
-
blockers: offlineFormSubmissionAttachments.map((attachment) => attachment.form_submission),
|
|
7308
|
-
blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
7309
|
-
});
|
|
7310
|
-
promise.then((result) => {
|
|
7311
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
7312
|
-
this.dispatch(updateFormSubmissionAttachments(result.attachments));
|
|
7313
|
-
}).catch((error) => {
|
|
7314
|
-
this.dispatch(
|
|
7315
|
-
deleteFormSubmissionAttachments(
|
|
7316
|
-
offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
7317
|
-
)
|
|
7318
|
-
);
|
|
7319
|
-
throw error;
|
|
7320
|
-
});
|
|
7321
|
-
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
7322
|
-
}
|
|
7323
|
-
async bulkDelete(attachmentsIds) {
|
|
7324
|
-
const { store } = this.client;
|
|
7325
|
-
const state = store.getState();
|
|
7326
|
-
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
7327
|
-
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
7328
|
-
try {
|
|
7329
|
-
await this.enqueueRequest({
|
|
7330
|
-
description: "Delete form submission attachments",
|
|
7331
|
-
method: HttpMethod.DELETE,
|
|
7332
|
-
url: "/form-submission-attachments/bulk/",
|
|
7333
|
-
payload: { attachment_ids: attachmentsIds },
|
|
7334
|
-
blockers: attachmentsIds,
|
|
7335
|
-
blocks: []
|
|
7336
|
-
});
|
|
7337
|
-
} catch (e) {
|
|
7338
|
-
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7339
|
-
throw e;
|
|
7340
|
-
}
|
|
7341
|
-
}
|
|
7342
|
-
async refreshStore(projectId) {
|
|
7343
|
-
const result = await this.enqueueRequest({
|
|
7344
|
-
description: "Get form submission attachments",
|
|
7345
|
-
method: HttpMethod.GET,
|
|
7346
|
-
url: "/form-submission-attachments/",
|
|
7347
|
-
queryParams: {
|
|
7348
|
-
project: projectId.toString()
|
|
7349
|
-
},
|
|
7350
|
-
blockers: [],
|
|
7351
|
-
blocks: []
|
|
7352
|
-
});
|
|
7353
|
-
this.dispatch(initializeFormSubmissionAttachments(result));
|
|
7354
|
-
}
|
|
7355
|
-
}
|
|
7356
|
-
class FormRevisionService extends BaseUploadService {
|
|
7357
|
-
add(payload) {
|
|
7358
|
-
var _a2;
|
|
7359
|
-
const { store } = this.client;
|
|
7360
|
-
const state = store.getState();
|
|
7361
|
-
const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7362
|
-
const offlineFormRevision = offline({
|
|
7363
|
-
...payload,
|
|
7364
|
-
created_by: createdBy,
|
|
7365
|
-
revision: "Pending",
|
|
7366
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7367
|
-
});
|
|
7368
|
-
this.dispatch(addFormRevision(offlineFormRevision));
|
|
7369
|
-
const promise = this.enqueueRequest({
|
|
7370
|
-
description: "Create form revision",
|
|
7371
|
-
method: HttpMethod.POST,
|
|
7372
|
-
url: "/form-revisions/",
|
|
7373
|
-
payload: offlineFormRevision,
|
|
7374
|
-
blockers: [payload.form],
|
|
7375
|
-
blocks: [offlineFormRevision.offline_id]
|
|
7376
|
-
});
|
|
7377
|
-
void promise.then((result) => {
|
|
7378
|
-
this.dispatch(setFormRevision(result));
|
|
7379
|
-
}).catch(() => {
|
|
7380
|
-
this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
|
|
7381
|
-
});
|
|
7382
|
-
return [offlineFormRevision, promise];
|
|
7383
|
-
}
|
|
7384
|
-
async refreshStore(projectId, organizationId) {
|
|
7385
|
-
let formRevisions = [];
|
|
7386
|
-
const projectFormRevisions = await this.enqueueRequest({
|
|
7387
|
-
description: "Fetch project form revisions",
|
|
7388
|
-
method: HttpMethod.GET,
|
|
7389
|
-
url: "/form-revisions/",
|
|
7390
|
-
queryParams: {
|
|
7391
|
-
project: projectId.toString()
|
|
7392
|
-
},
|
|
7393
|
-
blockers: [projectId.toString()],
|
|
7394
|
-
blocks: []
|
|
7395
|
-
});
|
|
7396
|
-
formRevisions = formRevisions.concat(projectFormRevisions);
|
|
7397
|
-
const organizationFormRevisions = await this.enqueueRequest({
|
|
7398
|
-
description: "Fetch organization form revisions",
|
|
7399
|
-
method: HttpMethod.GET,
|
|
7400
|
-
url: "/form-revisions/",
|
|
7401
|
-
queryParams: {
|
|
7402
|
-
organization: organizationId.toString()
|
|
7403
|
-
},
|
|
7404
|
-
blockers: [organizationId.toString()],
|
|
7405
|
-
blocks: []
|
|
7406
|
-
});
|
|
7407
|
-
formRevisions = formRevisions.concat(organizationFormRevisions);
|
|
7408
|
-
this.dispatch(initializeFormRevisions(formRevisions));
|
|
7409
|
-
}
|
|
7410
|
-
}
|
|
7411
|
-
class AssetTypeFieldsAttachmentService extends BaseUploadService {
|
|
7412
|
-
async bulkAdd(payloads) {
|
|
7413
|
-
var _a2;
|
|
7414
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7415
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7416
|
-
const filePayloads = {};
|
|
7417
|
-
const offlineAssetTypeFieldsAttachments = [];
|
|
7418
|
-
const attachmentPayloads = [];
|
|
7419
|
-
for (const payload of payloads) {
|
|
7420
|
-
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7421
|
-
const filePayload = await this.getFilePayload(file);
|
|
7422
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7423
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7424
|
-
const offlineAssetTypeFieldsAttachment = offline({
|
|
7425
|
-
file: URL.createObjectURL(file),
|
|
7426
|
-
file_type: file.type,
|
|
7427
|
-
file_name: file.name,
|
|
7428
|
-
file_sha1: filePayload.sha1,
|
|
7429
|
-
created_by: createdBy,
|
|
7430
|
-
fields_revision: fieldsRevisionId,
|
|
7431
|
-
submitted_at: submittedAt,
|
|
7432
|
-
field_identifier: fieldIdentifier
|
|
7433
|
-
});
|
|
7434
|
-
offlineAssetTypeFieldsAttachments.push(offlineAssetTypeFieldsAttachment);
|
|
7435
|
-
const attachmentPayload = {
|
|
7436
|
-
offline_id: offlineAssetTypeFieldsAttachment.offline_id,
|
|
7437
|
-
file_name: file.name,
|
|
7438
|
-
field_identifier: fieldIdentifier,
|
|
7439
|
-
file_extension: filePayload.extension,
|
|
7440
|
-
file_sha1: filePayload.sha1,
|
|
7441
|
-
fields_revision: fieldsRevisionId
|
|
7442
|
-
};
|
|
7443
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7444
|
-
}
|
|
7445
|
-
this.dispatch(addAssetTypeFieldsAttachments(offlineAssetTypeFieldsAttachments));
|
|
7446
|
-
const promise = this.enqueueRequest({
|
|
7447
|
-
description: "Add asset type fields attachments",
|
|
7448
|
-
method: HttpMethod.POST,
|
|
7449
|
-
url: "/asset-type-fields-attachments/bulk/",
|
|
7450
|
-
payload: {
|
|
7451
|
-
submitted_at: submittedAt,
|
|
7452
|
-
attachments: attachmentPayloads,
|
|
7453
|
-
files: Object.values(filePayloads)
|
|
7454
|
-
},
|
|
7455
|
-
blockers: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
|
|
7456
|
-
blocks: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7457
|
-
});
|
|
7458
|
-
promise.then((result) => {
|
|
7459
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
7460
|
-
this.dispatch(updateAssetTypeFieldsAttachments(result.attachments));
|
|
7461
|
-
}).catch(() => {
|
|
7462
|
-
this.dispatch(
|
|
7463
|
-
deleteAssetTypeFieldsAttachments(
|
|
7464
|
-
offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7465
|
-
)
|
|
7466
|
-
);
|
|
7467
|
-
});
|
|
7468
|
-
return [offlineAssetTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
|
|
7469
|
-
}
|
|
7470
|
-
async refreshStore(projectId) {
|
|
7471
|
-
const result = await this.enqueueRequest({
|
|
7472
|
-
description: "get asset type fields attachments",
|
|
7473
|
-
method: HttpMethod.GET,
|
|
7474
|
-
url: "/asset-type-fields-attachments/",
|
|
7475
|
-
queryParams: {
|
|
7476
|
-
project: projectId.toString()
|
|
7477
|
-
},
|
|
7478
|
-
blockers: [projectId.toString()],
|
|
7479
|
-
blocks: []
|
|
7480
|
-
});
|
|
7481
|
-
this.dispatch(initializeAssetTypeFieldsAttachments(result));
|
|
7482
|
-
}
|
|
7483
|
-
}
|
|
7484
|
-
class AssetTypeFieldsService extends BaseApiService {
|
|
7485
|
-
add(payload) {
|
|
7486
|
-
var _a2;
|
|
7487
|
-
const { store } = this.client;
|
|
7488
|
-
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7489
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7490
|
-
const offlineAssetTypeFields = offline({
|
|
7491
|
-
...payload,
|
|
7492
|
-
created_by: createdBy,
|
|
7493
|
-
submitted_at: submittedAt
|
|
7494
|
-
});
|
|
7495
|
-
this.dispatch(addAssetTypeFields(offlineAssetTypeFields));
|
|
7496
|
-
const promise = this.enqueueRequest({
|
|
7497
|
-
description: "Add Asset Type Fields",
|
|
7498
|
-
method: HttpMethod.POST,
|
|
7499
|
-
url: "/asset-type-fields/",
|
|
7500
|
-
payload: offlineAssetTypeFields,
|
|
7501
|
-
blockers: [offlineAssetTypeFields.asset_type],
|
|
7502
|
-
blocks: [offlineAssetTypeFields.offline_id]
|
|
7503
|
-
});
|
|
7504
|
-
promise.then((response) => {
|
|
7505
|
-
this.dispatch(updateAssetTypeFields(response));
|
|
7506
|
-
}).catch((error) => {
|
|
7507
|
-
this.dispatch(deleteAssetTypeFields(offlineAssetTypeFields.offline_id));
|
|
7508
|
-
throw error;
|
|
7509
|
-
});
|
|
7510
|
-
return [offlineAssetTypeFields, promise];
|
|
7511
|
-
}
|
|
7512
|
-
async refreshStore(projectId) {
|
|
7513
|
-
const result = await this.enqueueRequest({
|
|
7514
|
-
description: "Get Asset Type Fields",
|
|
7515
|
-
method: HttpMethod.GET,
|
|
7516
|
-
url: "/asset-type-fields/",
|
|
7517
|
-
queryParams: {
|
|
7518
|
-
project: projectId.toString()
|
|
7519
|
-
},
|
|
7520
|
-
blockers: [],
|
|
7521
|
-
blocks: []
|
|
7522
|
-
});
|
|
7523
|
-
this.dispatch(initializeAssetTypeFields(result));
|
|
7524
|
-
}
|
|
7525
|
-
}
|
|
7526
|
-
class AssetTypeFieldValuesService extends BaseApiService {
|
|
7527
|
-
add(payload) {
|
|
7528
|
-
var _a2;
|
|
7529
|
-
const { store } = this.client;
|
|
7530
|
-
const state = store.getState();
|
|
7531
|
-
const { values } = separateFilesFromValues(payload.values);
|
|
7532
|
-
const offlineAssetTypeFieldValues = offline({
|
|
7533
|
-
...payload,
|
|
7534
|
-
values,
|
|
7535
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7536
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7537
|
-
});
|
|
7538
|
-
const promise = this.enqueueRequest({
|
|
7539
|
-
description: "Add asset type field values",
|
|
7540
|
-
method: HttpMethod.POST,
|
|
7541
|
-
url: "/asset-type-field-values/",
|
|
7542
|
-
payload: offlineAssetTypeFieldValues,
|
|
7543
|
-
blockers: [payload.asset, payload.fields_revision],
|
|
7544
|
-
blocks: [offlineAssetTypeFieldValues.offline_id]
|
|
7545
|
-
});
|
|
7546
|
-
this.dispatch(addAssetTypeFieldValues(offlineAssetTypeFieldValues));
|
|
7547
|
-
promise.then((result) => {
|
|
7548
|
-
this.dispatch(updateAssetTypeFieldValues(result));
|
|
7549
|
-
return result;
|
|
7550
|
-
}).catch(() => {
|
|
7551
|
-
this.dispatch(deleteAssetTypeFieldValues(offlineAssetTypeFieldValues.offline_id));
|
|
7552
|
-
});
|
|
7553
|
-
return [offlineAssetTypeFieldValues, promise];
|
|
7554
|
-
}
|
|
7555
|
-
bulkAdd(payload, batchSize) {
|
|
7556
|
-
var _a2;
|
|
7557
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7558
|
-
const { values } = separateFilesFromValues(payload.values);
|
|
7559
|
-
const offlineAssetTypeFieldValuesMany = [];
|
|
7560
|
-
const batches = chunkArray(payload.payloads, batchSize ?? payload.payloads.length);
|
|
7561
|
-
const batchPayloads = [];
|
|
7562
|
-
for (const batch of batches) {
|
|
7563
|
-
const assetTypeFieldValuesPayloads = [];
|
|
7564
|
-
for (const payload2 of batch) {
|
|
7565
|
-
const offlineAssetTypeFieldValues = offline({
|
|
7566
|
-
...payload2,
|
|
7567
|
-
values: separateFilesFromValues(payload2.values).values,
|
|
7568
|
-
created_by: (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7569
|
-
submitted_at: submittedAt
|
|
7570
|
-
});
|
|
7571
|
-
offlineAssetTypeFieldValuesMany.push(offlineAssetTypeFieldValues);
|
|
7572
|
-
assetTypeFieldValuesPayloads.push({
|
|
7573
|
-
offline_id: offlineAssetTypeFieldValues.offline_id,
|
|
7574
|
-
asset: payload2.asset,
|
|
7575
|
-
fields_revision: payload2.fields_revision,
|
|
7576
|
-
published_at: payload2.published_at,
|
|
7577
|
-
values: offlineAssetTypeFieldValues.values
|
|
7578
|
-
});
|
|
7579
|
-
}
|
|
7580
|
-
batchPayloads.push({
|
|
7581
|
-
submitted_at: submittedAt,
|
|
7582
|
-
values,
|
|
7583
|
-
field_values: assetTypeFieldValuesPayloads
|
|
7584
|
-
});
|
|
7585
|
-
}
|
|
7586
|
-
this.dispatch(addAssetTypeFieldValuesMany(offlineAssetTypeFieldValuesMany));
|
|
7587
|
-
const promises = [];
|
|
7588
|
-
for (const payload2 of batchPayloads) {
|
|
7589
|
-
const assetIds = payload2.field_values.map((x) => x.asset);
|
|
7590
|
-
const assetTypeFieldsIds = payload2.field_values.map((x) => x.fields_revision);
|
|
7591
|
-
const assetTypeFieldValuesIds = payload2.field_values.map((x) => x.offline_id);
|
|
7592
|
-
const promise = this.enqueueRequest({
|
|
7593
|
-
description: "Bulk add asset type field values",
|
|
7594
|
-
method: HttpMethod.POST,
|
|
7595
|
-
url: "/asset-type-field-values/bulk/",
|
|
7596
|
-
payload: payload2,
|
|
7597
|
-
blockers: [...assetIds, ...assetTypeFieldsIds],
|
|
7598
|
-
blocks: assetTypeFieldValuesIds
|
|
7599
|
-
});
|
|
7600
|
-
promises.push(promise);
|
|
7601
|
-
}
|
|
7602
|
-
void Promise.all(promises).then((results) => {
|
|
7603
|
-
this.dispatch(updateAssetTypeFieldValuesMany(results.flat()));
|
|
7604
|
-
}).catch(() => {
|
|
7605
|
-
this.dispatch(deleteAssetTypeFieldValuesMany(offlineAssetTypeFieldValuesMany.map((x) => x.offline_id)));
|
|
7606
|
-
});
|
|
7607
|
-
return [offlineAssetTypeFieldValuesMany, promises];
|
|
7608
|
-
}
|
|
7609
|
-
update(payload) {
|
|
7610
|
-
const { store } = this.client;
|
|
7611
|
-
const state = store.getState();
|
|
7612
|
-
const assetTypeFieldValues = selectAssetTypeFieldValuesById(payload.offline_id)(state);
|
|
7613
|
-
if (!assetTypeFieldValues) {
|
|
7614
|
-
throw new Error(`Expected AssetTypeFieldValues with offline_id ${payload.offline_id} to exist`);
|
|
7615
|
-
}
|
|
7616
|
-
const { values } = separateFilesFromValues(payload.values ?? {});
|
|
7617
|
-
const updatedAssetTypeFieldValues = {
|
|
7618
|
-
...assetTypeFieldValues,
|
|
7619
|
-
...payload,
|
|
7620
|
-
// values could also have a partial update
|
|
7621
|
-
values: {
|
|
7622
|
-
...assetTypeFieldValues.values,
|
|
7623
|
-
...values
|
|
7624
|
-
}
|
|
7625
|
-
};
|
|
7626
|
-
this.dispatch(updateAssetTypeFieldValues(updatedAssetTypeFieldValues));
|
|
7627
|
-
const promise = this.enqueueRequest({
|
|
7628
|
-
description: "Delete asset type field values",
|
|
7629
|
-
method: HttpMethod.PATCH,
|
|
7630
|
-
url: `/asset-type-field-values/${payload.offline_id}/`,
|
|
7631
|
-
payload,
|
|
7632
|
-
blockers: [
|
|
7633
|
-
updatedAssetTypeFieldValues.offline_id,
|
|
7634
|
-
updatedAssetTypeFieldValues.fields_revision,
|
|
7635
|
-
updatedAssetTypeFieldValues.asset
|
|
7636
|
-
],
|
|
7637
|
-
blocks: [updatedAssetTypeFieldValues.offline_id]
|
|
7638
|
-
});
|
|
7639
|
-
promise.then((result) => {
|
|
7640
|
-
this.dispatch(updateAssetTypeFieldValues(result));
|
|
7641
|
-
}).catch(() => {
|
|
7642
|
-
this.dispatch(updateAssetTypeFieldValues(assetTypeFieldValues));
|
|
7643
|
-
});
|
|
7644
|
-
return [updatedAssetTypeFieldValues, promise];
|
|
7645
|
-
}
|
|
7646
|
-
async delete(id) {
|
|
7647
|
-
const { store } = this.client;
|
|
7648
|
-
const state = store.getState();
|
|
7649
|
-
const assetTypeFieldValues = selectAssetTypeFieldValuesById(id)(state);
|
|
7650
|
-
if (!assetTypeFieldValues) {
|
|
7651
|
-
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
7652
|
-
}
|
|
7653
|
-
const assetTypeFieldValuesAttachments = selectAttachmentsOfAssetTypeFieldValues(id)(state);
|
|
7654
|
-
this.dispatch(deleteAssetTypeFieldValues(id));
|
|
7655
|
-
this.dispatch(deleteAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments.map((x) => x.offline_id)));
|
|
7656
|
-
try {
|
|
7657
|
-
await this.enqueueRequest({
|
|
7658
|
-
description: "Delete asset type field values",
|
|
7659
|
-
method: HttpMethod.DELETE,
|
|
7660
|
-
url: `/asset-type-field-values/${id}/`,
|
|
7661
|
-
blockers: [id],
|
|
7662
|
-
blocks: []
|
|
7663
|
-
});
|
|
7664
|
-
} catch (e) {
|
|
7665
|
-
this.dispatch(addAssetTypeFieldValues(assetTypeFieldValues));
|
|
7666
|
-
this.dispatch(addAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments));
|
|
7667
|
-
throw e;
|
|
7668
|
-
}
|
|
7669
|
-
}
|
|
7670
|
-
async refreshStore(projectId) {
|
|
7671
|
-
const result = await this.enqueueRequest({
|
|
7672
|
-
description: "Get asset type field values",
|
|
7673
|
-
method: HttpMethod.GET,
|
|
7674
|
-
url: "/asset-type-field-values/",
|
|
7675
|
-
queryParams: {
|
|
7676
|
-
project: projectId.toString()
|
|
7677
|
-
},
|
|
7678
|
-
blockers: [],
|
|
7679
|
-
blocks: []
|
|
7680
|
-
});
|
|
7681
|
-
this.dispatch(initializeAssetTypeFieldValues(result));
|
|
7682
|
-
}
|
|
7683
|
-
}
|
|
7684
|
-
class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7685
|
-
async bulkAdd(payloads, batchSize) {
|
|
7686
|
-
var _a2;
|
|
7687
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7688
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7689
|
-
const batches = chunkArray(payloads, batchSize ?? payloads.length);
|
|
7690
|
-
const offlineAssetTypeFieldValuesAttachments = [];
|
|
7691
|
-
const batchPayloads = [];
|
|
7692
|
-
for (const batch of batches) {
|
|
7693
|
-
const filePayloads = {};
|
|
7694
|
-
const attachmentPayloads = [];
|
|
7695
|
-
for (const payload of batch) {
|
|
7696
|
-
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7697
|
-
const filePayload = await this.getFilePayload(file);
|
|
7698
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7699
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7700
|
-
const offlineAssetTypeFieldValuesAttachment = offline({
|
|
7701
|
-
file: URL.createObjectURL(file),
|
|
7702
|
-
file_type: file.type,
|
|
7703
|
-
file_name: file.name,
|
|
7704
|
-
file_sha1: filePayload.sha1,
|
|
7705
|
-
created_by: createdBy,
|
|
7706
|
-
field_values: fieldValuesId,
|
|
7707
|
-
submitted_at: submittedAt,
|
|
7708
|
-
field_identifier: fieldIdentifier
|
|
7709
|
-
});
|
|
7710
|
-
offlineAssetTypeFieldValuesAttachments.push(offlineAssetTypeFieldValuesAttachment);
|
|
7711
|
-
const attachmentPayload = {
|
|
7712
|
-
offline_id: offlineAssetTypeFieldValuesAttachment.offline_id,
|
|
7713
|
-
file_name: file.name,
|
|
7714
|
-
file_sha1: filePayload.sha1,
|
|
7715
|
-
file_extension: filePayload.extension,
|
|
7716
|
-
field_identifier: fieldIdentifier,
|
|
7717
|
-
field_values: fieldValuesId
|
|
7718
|
-
};
|
|
7719
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7720
|
-
}
|
|
7721
|
-
batchPayloads.push({
|
|
7722
|
-
submitted_at: submittedAt,
|
|
7723
|
-
attachments: attachmentPayloads,
|
|
7724
|
-
files: Object.values(filePayloads)
|
|
7725
|
-
});
|
|
7726
|
-
}
|
|
7727
|
-
this.dispatch(addAssetTypeFieldValuesAttachments(offlineAssetTypeFieldValuesAttachments));
|
|
7728
|
-
const promises = batchPayloads.map((payload) => {
|
|
7729
|
-
return this.enqueueRequest({
|
|
7730
|
-
description: "Add asset type field values attachments",
|
|
7731
|
-
method: HttpMethod.POST,
|
|
7732
|
-
url: "/asset-type-field-values-attachments/bulk/",
|
|
7733
|
-
payload,
|
|
7734
|
-
blockers: payload.attachments.map((payload2) => payload2.field_values),
|
|
7735
|
-
blocks: payload.attachments.map((payload2) => payload2.offline_id)
|
|
7736
|
-
});
|
|
7737
|
-
});
|
|
7738
|
-
Promise.all(promises).then((result) => {
|
|
7739
|
-
for (const res of result)
|
|
7740
|
-
this.processPresignedUrls(res.presigned_urls);
|
|
7741
|
-
const attachments = result.flatMap((res) => res.attachments);
|
|
7742
|
-
this.dispatch(updateAssetTypeFieldValuesAttachments(attachments));
|
|
7743
|
-
}).catch((error) => {
|
|
7744
|
-
this.dispatch(
|
|
7745
|
-
deleteAssetTypeFieldValuesAttachments(
|
|
7746
|
-
offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7747
|
-
)
|
|
7748
|
-
);
|
|
7749
|
-
throw error;
|
|
7750
|
-
});
|
|
7751
|
-
return [
|
|
7752
|
-
offlineAssetTypeFieldValuesAttachments,
|
|
7753
|
-
promises.map((promise) => promise.then(({ attachments }) => attachments))
|
|
7754
|
-
];
|
|
7755
|
-
}
|
|
7756
|
-
async bulkDelete(ids) {
|
|
7757
|
-
const { store } = this.client;
|
|
7758
|
-
const state = store.getState();
|
|
7759
|
-
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(ids)(state);
|
|
7760
|
-
this.dispatch(deleteFormSubmissionAttachments(ids));
|
|
7761
|
-
try {
|
|
7762
|
-
await this.enqueueRequest({
|
|
7763
|
-
description: "Delete asset type field values attachments",
|
|
7764
|
-
method: HttpMethod.DELETE,
|
|
7765
|
-
url: "/asset-type-field-values-attachments/bulk/",
|
|
7766
|
-
payload: { attachment_ids: ids },
|
|
7767
|
-
blockers: ids,
|
|
7768
|
-
blocks: []
|
|
7769
|
-
});
|
|
7770
|
-
} catch (e) {
|
|
7771
|
-
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7772
|
-
throw e;
|
|
7773
|
-
}
|
|
7774
|
-
}
|
|
7775
|
-
async refreshStore(projectId) {
|
|
7776
|
-
const result = await this.enqueueRequest({
|
|
7777
|
-
description: "Get asset type field values attachments",
|
|
7778
|
-
method: HttpMethod.GET,
|
|
7779
|
-
url: "/asset-type-field-values-attachments/",
|
|
7780
|
-
queryParams: {
|
|
7781
|
-
project: projectId.toString()
|
|
7782
|
-
},
|
|
7783
|
-
blockers: [],
|
|
7784
|
-
blocks: []
|
|
7785
|
-
});
|
|
7786
|
-
this.dispatch(initializeAssetTypeFieldValuesAttachments(result));
|
|
7787
|
-
}
|
|
7788
|
-
}
|
|
7789
|
-
class IssueTypeFieldsAttachmentService extends BaseUploadService {
|
|
7790
|
-
async bulkAdd(payloads) {
|
|
7791
|
-
var _a2;
|
|
7792
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7793
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7794
|
-
const filePayloads = {};
|
|
7795
|
-
const offlineIssueTypeFieldsAttachments = [];
|
|
7796
|
-
const attachmentPayloads = [];
|
|
7797
|
-
for (const payload of payloads) {
|
|
7798
|
-
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7799
|
-
const filePayload = await this.getFilePayload(file);
|
|
7800
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7801
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7802
|
-
const offlineIssueTypeFieldsAttachment = offline({
|
|
7803
|
-
file: URL.createObjectURL(file),
|
|
7804
|
-
file_type: file.type,
|
|
7805
|
-
file_name: file.name,
|
|
7806
|
-
file_sha1: filePayload.sha1,
|
|
7807
|
-
created_by: createdBy,
|
|
7808
|
-
fields_revision: fieldsRevisionId,
|
|
7809
|
-
submitted_at: submittedAt,
|
|
7810
|
-
field_identifier: fieldIdentifier
|
|
7811
|
-
});
|
|
7812
|
-
offlineIssueTypeFieldsAttachments.push(offlineIssueTypeFieldsAttachment);
|
|
7813
|
-
const attachmentPayload = {
|
|
7814
|
-
offline_id: offlineIssueTypeFieldsAttachment.offline_id,
|
|
7815
|
-
file_name: file.name,
|
|
7816
|
-
file_extension: filePayload.extension,
|
|
7817
|
-
field_identifier: fieldIdentifier,
|
|
7818
|
-
file_sha1: filePayload.sha1,
|
|
7819
|
-
fields_revision: fieldsRevisionId
|
|
7820
|
-
};
|
|
7821
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7822
|
-
}
|
|
7823
|
-
this.dispatch(addIssueTypeFieldsAttachments(offlineIssueTypeFieldsAttachments));
|
|
7824
|
-
const promise = this.enqueueRequest({
|
|
7825
|
-
description: "Add issue type fields attachments",
|
|
7826
|
-
method: HttpMethod.POST,
|
|
7827
|
-
url: "/issue-type-fields-attachments/bulk/",
|
|
7828
|
-
payload: {
|
|
7829
|
-
submitted_at: submittedAt,
|
|
7830
|
-
attachments: attachmentPayloads,
|
|
7831
|
-
files: Object.values(filePayloads)
|
|
7832
|
-
},
|
|
7833
|
-
blockers: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
|
|
7834
|
-
blocks: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7835
|
-
});
|
|
7836
|
-
promise.then((result) => {
|
|
7837
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
7838
|
-
this.dispatch(updateIssueTypeFieldsAttachments(result.attachments));
|
|
7839
|
-
}).catch(() => {
|
|
7840
|
-
this.dispatch(
|
|
7841
|
-
deleteIssueTypeFieldsAttachments(
|
|
7842
|
-
offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7843
|
-
)
|
|
7844
|
-
);
|
|
7845
|
-
});
|
|
7846
|
-
return [offlineIssueTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
|
|
7847
|
-
}
|
|
7848
|
-
async refreshStore(organizationId) {
|
|
7849
|
-
const result = await this.enqueueRequest({
|
|
7850
|
-
description: "get issue type fields attachments",
|
|
7851
|
-
method: HttpMethod.GET,
|
|
7852
|
-
url: "/issue-type-fields-attachments/",
|
|
7853
|
-
queryParams: {
|
|
7854
|
-
organization: organizationId.toString()
|
|
7855
|
-
},
|
|
7856
|
-
blockers: [organizationId.toString()],
|
|
7857
|
-
blocks: []
|
|
7858
|
-
});
|
|
7859
|
-
this.dispatch(initializeIssueTypeFieldsAttachments(result));
|
|
7860
|
-
}
|
|
7861
|
-
}
|
|
7862
|
-
class IssueTypeFieldsService extends BaseApiService {
|
|
7863
|
-
add(payload) {
|
|
7864
|
-
var _a2;
|
|
7865
|
-
const { store } = this.client;
|
|
7866
|
-
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7867
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7868
|
-
const offlineIssueTypeFields = offline({
|
|
7869
|
-
...payload,
|
|
7870
|
-
created_by: createdBy,
|
|
7871
|
-
submitted_at: submittedAt
|
|
7872
|
-
});
|
|
7873
|
-
this.dispatch(addIssueTypeFields(offlineIssueTypeFields));
|
|
7874
|
-
const promise = this.enqueueRequest({
|
|
7875
|
-
description: "Add Issue Type Fields",
|
|
7876
|
-
method: HttpMethod.POST,
|
|
7877
|
-
url: "/issue-type-fields/",
|
|
7878
|
-
payload: offlineIssueTypeFields,
|
|
7879
|
-
blockers: [offlineIssueTypeFields.issue_type],
|
|
7880
|
-
blocks: [offlineIssueTypeFields.offline_id]
|
|
7881
|
-
});
|
|
7882
|
-
promise.then((response) => {
|
|
7883
|
-
this.dispatch(updateIssueTypeFields(response));
|
|
7884
|
-
}).catch((error) => {
|
|
7885
|
-
this.dispatch(deleteIssueTypeFields(offlineIssueTypeFields.offline_id));
|
|
7886
|
-
throw error;
|
|
7887
|
-
});
|
|
7888
|
-
return [offlineIssueTypeFields, promise];
|
|
7889
|
-
}
|
|
7890
|
-
async refreshStore(organizationId) {
|
|
7891
|
-
const result = await this.enqueueRequest({
|
|
7892
|
-
description: "Get Issue Type Fields",
|
|
7893
|
-
method: HttpMethod.GET,
|
|
7894
|
-
url: "/issue-type-fields/",
|
|
7895
|
-
queryParams: {
|
|
7896
|
-
organization: organizationId.toString()
|
|
7897
|
-
},
|
|
7898
|
-
blockers: [],
|
|
7899
|
-
blocks: []
|
|
7900
|
-
});
|
|
7901
|
-
this.dispatch(initializeIssueTypeFields(result));
|
|
7902
|
-
}
|
|
7903
|
-
}
|
|
7904
|
-
class IssueTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7905
|
-
async bulkAdd(payloads) {
|
|
7906
|
-
var _a2;
|
|
7907
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7908
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7909
|
-
const filePayloads = {};
|
|
7910
|
-
const offlineIssueTypeFieldValuesAttachments = [];
|
|
7911
|
-
const attachmentPayloads = [];
|
|
7912
|
-
for (const payload of payloads) {
|
|
7913
|
-
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7914
|
-
const filePayload = await this.getFilePayload(file);
|
|
7915
|
-
if (!(filePayload.sha1 in filePayloads))
|
|
7916
|
-
filePayloads[filePayload.sha1] = filePayload;
|
|
7917
|
-
const offlineIssueTypeFieldValuesAttachment = offline({
|
|
7918
|
-
file: URL.createObjectURL(file),
|
|
7919
|
-
file_type: file.type,
|
|
7920
|
-
file_name: file.name,
|
|
7921
|
-
file_sha1: filePayload.sha1,
|
|
7922
|
-
created_by: createdBy,
|
|
7923
|
-
field_values: fieldValuesId,
|
|
7924
|
-
submitted_at: submittedAt,
|
|
7925
|
-
field_identifier: fieldIdentifier
|
|
7926
|
-
});
|
|
7927
|
-
offlineIssueTypeFieldValuesAttachments.push(offlineIssueTypeFieldValuesAttachment);
|
|
7928
|
-
const attachmentPayload = {
|
|
7929
|
-
offline_id: offlineIssueTypeFieldValuesAttachment.offline_id,
|
|
7930
|
-
file_name: file.name,
|
|
7931
|
-
file_sha1: filePayload.sha1,
|
|
7932
|
-
file_extension: filePayload.extension,
|
|
7933
|
-
field_identifier: fieldIdentifier,
|
|
7934
|
-
field_values: fieldValuesId
|
|
7935
|
-
};
|
|
7936
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7937
|
-
}
|
|
7938
|
-
this.dispatch(addIssueTypeFieldValuesAttachments(offlineIssueTypeFieldValuesAttachments));
|
|
7939
|
-
const promise = this.enqueueRequest({
|
|
7940
|
-
description: "Add issue type field values attachments",
|
|
7941
|
-
method: HttpMethod.POST,
|
|
7942
|
-
url: "/issue-type-field-values-attachments/bulk/",
|
|
7943
|
-
payload: {
|
|
7944
|
-
submitted_at: submittedAt,
|
|
7945
|
-
attachments: attachmentPayloads,
|
|
7946
|
-
files: Object.values(filePayloads)
|
|
7947
|
-
},
|
|
7948
|
-
blockers: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.field_values),
|
|
7949
|
-
blocks: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7950
|
-
});
|
|
7951
|
-
promise.then(({ presigned_urls, attachments }) => {
|
|
7952
|
-
this.processPresignedUrls(presigned_urls);
|
|
7953
|
-
this.dispatch(updateIssueTypeFieldValuesAttachments(attachments));
|
|
7954
|
-
}).catch((error) => {
|
|
7955
|
-
this.dispatch(
|
|
7956
|
-
deleteIssueTypeFieldValuesAttachments(
|
|
7957
|
-
offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7958
|
-
)
|
|
7959
|
-
);
|
|
7960
|
-
throw error;
|
|
7961
|
-
});
|
|
7962
|
-
return [offlineIssueTypeFieldValuesAttachments, promise.then(({ attachments }) => attachments)];
|
|
7963
|
-
}
|
|
7964
|
-
async bulkDelete(attachmentsIds) {
|
|
7965
|
-
const { store } = this.client;
|
|
7966
|
-
const state = store.getState();
|
|
7967
|
-
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
7968
|
-
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
7969
|
-
try {
|
|
7970
|
-
await this.enqueueRequest({
|
|
7971
|
-
description: "Delete issue type field values attachments",
|
|
7972
|
-
method: HttpMethod.DELETE,
|
|
7973
|
-
url: "/issue-type-field-values-attachments/bulk/",
|
|
7974
|
-
payload: { attachment_ids: attachmentsIds },
|
|
7975
|
-
blockers: attachmentsIds,
|
|
7976
|
-
blocks: []
|
|
7977
|
-
});
|
|
7978
|
-
} catch (e) {
|
|
7979
|
-
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7980
|
-
throw e;
|
|
7981
|
-
}
|
|
7982
|
-
}
|
|
7983
|
-
async refreshStore(projectId) {
|
|
7984
|
-
const result = await this.enqueueRequest({
|
|
7985
|
-
description: "Get issue type field values attachments",
|
|
7986
|
-
method: HttpMethod.GET,
|
|
7987
|
-
url: "/issue-type-field-values-attachments/",
|
|
7988
|
-
queryParams: {
|
|
7989
|
-
project: projectId.toString()
|
|
7990
|
-
},
|
|
7991
|
-
blockers: [],
|
|
7992
|
-
blocks: []
|
|
7993
|
-
});
|
|
7994
|
-
this.dispatch(initializeIssueTypeFieldValuesAttachments(result));
|
|
7995
|
-
}
|
|
7996
|
-
}
|
|
7997
|
-
class IssueTypeFieldValuesService extends BaseApiService {
|
|
7998
|
-
add(payload) {
|
|
7999
|
-
var _a2;
|
|
8000
|
-
const { store } = this.client;
|
|
8001
|
-
const state = store.getState();
|
|
8002
|
-
const { values } = separateFilesFromValues(payload.values);
|
|
8003
|
-
const offlineIssueTypeFieldValues = offline({
|
|
8004
|
-
...payload,
|
|
8005
|
-
values,
|
|
8006
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
8007
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
8008
|
-
});
|
|
8009
|
-
const promise = this.enqueueRequest({
|
|
8010
|
-
description: "Add issue type field values",
|
|
8011
|
-
method: HttpMethod.POST,
|
|
8012
|
-
url: "/issue-type-field-values/",
|
|
8013
|
-
payload: offlineIssueTypeFieldValues,
|
|
8014
|
-
blockers: [payload.issue, payload.fields_revision],
|
|
8015
|
-
blocks: [offlineIssueTypeFieldValues.offline_id]
|
|
8016
|
-
});
|
|
8017
|
-
this.dispatch(addIssueTypeFieldValues(offlineIssueTypeFieldValues));
|
|
8018
|
-
promise.then((result) => {
|
|
8019
|
-
this.dispatch(updateIssueTypeFieldValues(result));
|
|
8020
|
-
return result;
|
|
8021
|
-
}).catch(() => {
|
|
8022
|
-
this.dispatch(deleteIssueTypeFieldValues(offlineIssueTypeFieldValues.offline_id));
|
|
8023
|
-
});
|
|
8024
|
-
return [offlineIssueTypeFieldValues, promise];
|
|
8025
|
-
}
|
|
8026
|
-
update(payload) {
|
|
8027
|
-
const { store } = this.client;
|
|
8028
|
-
const state = store.getState();
|
|
8029
|
-
const issueTypeFieldValues = selectIssueTypeFieldValuesById(payload.offline_id)(state);
|
|
8030
|
-
if (!issueTypeFieldValues) {
|
|
8031
|
-
throw new Error(`Expected IssueTypeFieldValues with offline_id ${payload.offline_id} to exist`);
|
|
8032
|
-
}
|
|
8033
|
-
const { values } = separateFilesFromValues(payload.values ?? {});
|
|
8034
|
-
const updatedIssueTypeFieldValues = {
|
|
8035
|
-
...issueTypeFieldValues,
|
|
8036
|
-
...payload,
|
|
8037
|
-
// values could also have a partial update
|
|
8038
|
-
values: {
|
|
8039
|
-
...issueTypeFieldValues.values,
|
|
8040
|
-
...values
|
|
8041
|
-
}
|
|
8042
|
-
};
|
|
8043
|
-
this.dispatch(updateIssueTypeFieldValues(updatedIssueTypeFieldValues));
|
|
8044
|
-
const promise = this.enqueueRequest({
|
|
8045
|
-
description: "Update issue type field values",
|
|
8046
|
-
method: HttpMethod.PATCH,
|
|
8047
|
-
url: `/issue-type-field-values/${payload.offline_id}/`,
|
|
8048
|
-
payload,
|
|
8049
|
-
blockers: [
|
|
8050
|
-
updatedIssueTypeFieldValues.offline_id,
|
|
8051
|
-
updatedIssueTypeFieldValues.fields_revision,
|
|
8052
|
-
updatedIssueTypeFieldValues.issue
|
|
8053
|
-
],
|
|
8054
|
-
blocks: [updatedIssueTypeFieldValues.offline_id]
|
|
8055
|
-
});
|
|
8056
|
-
promise.then((result) => {
|
|
8057
|
-
this.dispatch(updateIssueTypeFieldValues(result));
|
|
8058
|
-
}).catch(() => {
|
|
8059
|
-
this.dispatch(updateIssueTypeFieldValues(issueTypeFieldValues));
|
|
8060
|
-
});
|
|
8061
|
-
return [updatedIssueTypeFieldValues, promise];
|
|
8062
|
-
}
|
|
8063
|
-
async delete(id) {
|
|
8064
|
-
const { store } = this.client;
|
|
8065
|
-
const state = store.getState();
|
|
8066
|
-
const issueTypeFieldValues = selectIssueTypeFieldValuesById(id)(state);
|
|
8067
|
-
if (!issueTypeFieldValues) {
|
|
8068
|
-
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
8069
|
-
}
|
|
8070
|
-
const issueTypeFieldValuesAttachments = selectAttachmentsOfIssueTypeFieldValues(id)(state);
|
|
8071
|
-
this.dispatch(deleteIssueTypeFieldValues(id));
|
|
8072
|
-
this.dispatch(deleteIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments.map((x) => x.offline_id)));
|
|
8073
|
-
try {
|
|
8074
|
-
await this.enqueueRequest({
|
|
8075
|
-
description: "Delete issue type field values",
|
|
8076
|
-
method: HttpMethod.DELETE,
|
|
8077
|
-
url: `/issue-type-field-values/${id}/`,
|
|
8078
|
-
blockers: [id],
|
|
8079
|
-
blocks: []
|
|
8080
|
-
});
|
|
8081
|
-
} catch (e) {
|
|
8082
|
-
this.dispatch(addIssueTypeFieldValues(issueTypeFieldValues));
|
|
8083
|
-
this.dispatch(addIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments));
|
|
8084
|
-
throw e;
|
|
8085
|
-
}
|
|
8086
|
-
}
|
|
8087
|
-
async refreshStore(projectId) {
|
|
8088
|
-
const result = await this.enqueueRequest({
|
|
8089
|
-
description: "Get issue type field values",
|
|
8090
|
-
method: HttpMethod.GET,
|
|
8091
|
-
url: "/issue-type-field-values/",
|
|
8092
|
-
queryParams: {
|
|
8093
|
-
project: projectId.toString()
|
|
8094
|
-
},
|
|
8095
|
-
blockers: [],
|
|
8096
|
-
blocks: []
|
|
8097
|
-
});
|
|
8098
|
-
this.dispatch(initializeIssueTypeFieldValues(result));
|
|
8099
|
-
}
|
|
8100
|
-
}
|
|
8101
7267
|
var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
8102
7268
|
VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
|
|
8103
7269
|
VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
|
|
@@ -8114,10 +7280,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8114
7280
|
exports2.AssetStageCompletionService = AssetStageCompletionService;
|
|
8115
7281
|
exports2.AssetStageService = AssetStageService;
|
|
8116
7282
|
exports2.AssetTypeAttachmentService = AssetTypeAttachmentService;
|
|
8117
|
-
exports2.AssetTypeFieldValuesAttachmentService = AssetTypeFieldValuesAttachmentService;
|
|
8118
|
-
exports2.AssetTypeFieldValuesService = AssetTypeFieldValuesService;
|
|
8119
|
-
exports2.AssetTypeFieldsAttachmentService = AssetTypeFieldsAttachmentService;
|
|
8120
|
-
exports2.AssetTypeFieldsService = AssetTypeFieldsService;
|
|
8121
7283
|
exports2.AssetTypeService = AssetTypeService;
|
|
8122
7284
|
exports2.AttachmentModel = AttachmentModel;
|
|
8123
7285
|
exports2.BaseApiService = BaseApiService;
|
|
@@ -8133,10 +7295,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8133
7295
|
exports2.EmailDomainsService = EmailDomainsService;
|
|
8134
7296
|
exports2.EmailVerificationService = EmailVerificationService;
|
|
8135
7297
|
exports2.FileService = FileService;
|
|
8136
|
-
exports2.FormRevisionAttachmentService = FormRevisionAttachmentService;
|
|
8137
|
-
exports2.FormRevisionService = FormRevisionService;
|
|
8138
7298
|
exports2.FormService = FormService;
|
|
8139
|
-
exports2.FormSubmissionAttachmentService = FormSubmissionAttachmentService;
|
|
8140
7299
|
exports2.FormSubmissionService = FormSubmissionService;
|
|
8141
7300
|
exports2.GREEN = GREEN;
|
|
8142
7301
|
exports2.GeoImageService = GeoImageService;
|
|
@@ -8147,10 +7306,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8147
7306
|
exports2.IssuePriority = IssuePriority;
|
|
8148
7307
|
exports2.IssueService = IssueService;
|
|
8149
7308
|
exports2.IssueStatus = IssueStatus;
|
|
8150
|
-
exports2.IssueTypeFieldValuesAttachmentService = IssueTypeFieldValuesAttachmentService;
|
|
8151
|
-
exports2.IssueTypeFieldValuesService = IssueTypeFieldValuesService;
|
|
8152
|
-
exports2.IssueTypeFieldsAttachmentService = IssueTypeFieldsAttachmentService;
|
|
8153
|
-
exports2.IssueTypeFieldsService = IssueTypeFieldsService;
|
|
8154
7309
|
exports2.IssueTypeService = IssueTypeService;
|
|
8155
7310
|
exports2.IssueUpdateChange = IssueUpdateChange;
|
|
8156
7311
|
exports2.IssueUpdateService = IssueUpdateService;
|
|
@@ -8190,14 +7345,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8190
7345
|
exports2.addAssetType = addAssetType;
|
|
8191
7346
|
exports2.addAssetTypeAttachment = addAssetTypeAttachment;
|
|
8192
7347
|
exports2.addAssetTypeAttachments = addAssetTypeAttachments;
|
|
8193
|
-
exports2.addAssetTypeFieldValues = addAssetTypeFieldValues;
|
|
8194
|
-
exports2.addAssetTypeFieldValuesAttachment = addAssetTypeFieldValuesAttachment;
|
|
8195
|
-
exports2.addAssetTypeFieldValuesAttachments = addAssetTypeFieldValuesAttachments;
|
|
8196
|
-
exports2.addAssetTypeFieldValuesMany = addAssetTypeFieldValuesMany;
|
|
8197
|
-
exports2.addAssetTypeFields = addAssetTypeFields;
|
|
8198
|
-
exports2.addAssetTypeFieldsAttachment = addAssetTypeFieldsAttachment;
|
|
8199
|
-
exports2.addAssetTypeFieldsAttachments = addAssetTypeFieldsAttachments;
|
|
8200
|
-
exports2.addAssetTypeFieldsMany = addAssetTypeFieldsMany;
|
|
8201
7348
|
exports2.addAssetTypes = addAssetTypes;
|
|
8202
7349
|
exports2.addAssets = addAssets;
|
|
8203
7350
|
exports2.addCategory = addCategory;
|
|
@@ -8226,14 +7373,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8226
7373
|
exports2.addIssueComment = addIssueComment;
|
|
8227
7374
|
exports2.addIssueComments = addIssueComments;
|
|
8228
7375
|
exports2.addIssueType = addIssueType;
|
|
8229
|
-
exports2.addIssueTypeFieldValues = addIssueTypeFieldValues;
|
|
8230
|
-
exports2.addIssueTypeFieldValuesAttachment = addIssueTypeFieldValuesAttachment;
|
|
8231
|
-
exports2.addIssueTypeFieldValuesAttachments = addIssueTypeFieldValuesAttachments;
|
|
8232
|
-
exports2.addIssueTypeFieldValuesMany = addIssueTypeFieldValuesMany;
|
|
8233
|
-
exports2.addIssueTypeFields = addIssueTypeFields;
|
|
8234
|
-
exports2.addIssueTypeFieldsAttachment = addIssueTypeFieldsAttachment;
|
|
8235
|
-
exports2.addIssueTypeFieldsAttachments = addIssueTypeFieldsAttachments;
|
|
8236
|
-
exports2.addIssueTypeFieldsMany = addIssueTypeFieldsMany;
|
|
8237
7376
|
exports2.addIssueUpdate = addIssueUpdate;
|
|
8238
7377
|
exports2.addIssueUpdates = addIssueUpdates;
|
|
8239
7378
|
exports2.addIssues = addIssues;
|
|
@@ -8259,28 +7398,16 @@ var __publicField = (obj, key, value) => {
|
|
|
8259
7398
|
exports2.assetStageSlice = assetStageSlice;
|
|
8260
7399
|
exports2.assetTypeAttachmentReducer = assetTypeAttachmentReducer;
|
|
8261
7400
|
exports2.assetTypeAttachmentSlice = assetTypeAttachmentSlice;
|
|
8262
|
-
exports2.assetTypeFieldValuesAttachmentReducer = assetTypeFieldValuesAttachmentReducer;
|
|
8263
|
-
exports2.assetTypeFieldValuesAttachmentSlice = assetTypeFieldValuesAttachmentSlice;
|
|
8264
|
-
exports2.assetTypeFieldValuesReducer = assetTypeFieldValuesReducer;
|
|
8265
|
-
exports2.assetTypeFieldValuesSlice = assetTypeFieldValuesSlice;
|
|
8266
|
-
exports2.assetTypeFieldsAttachmentReducer = assetTypeFieldsAttachmentReducer;
|
|
8267
|
-
exports2.assetTypeFieldsAttachmentSlice = assetTypeFieldsAttachmentSlice;
|
|
8268
|
-
exports2.assetTypeFieldsReducer = assetTypeFieldsReducer;
|
|
8269
|
-
exports2.assetTypeFieldsSlice = assetTypeFieldsSlice;
|
|
8270
7401
|
exports2.assetTypeReducer = assetTypeReducer;
|
|
8271
7402
|
exports2.assetTypeSlice = assetTypeSlice;
|
|
8272
7403
|
exports2.authReducer = authReducer;
|
|
8273
7404
|
exports2.authSlice = authSlice;
|
|
8274
7405
|
exports2.blobToBase64 = blobToBase64;
|
|
8275
|
-
exports2.boundsContainPoint = boundsContainPoint;
|
|
8276
7406
|
exports2.categoryReducer = categoryReducer;
|
|
8277
7407
|
exports2.categorySlice = categorySlice;
|
|
8278
7408
|
exports2.clearTokens = clearTokens;
|
|
8279
7409
|
exports2.constructUploadedFilePayloads = constructUploadedFilePayloads;
|
|
8280
7410
|
exports2.coordinatesAreEqual = coordinatesAreEqual;
|
|
8281
|
-
exports2.coordinatesToLiteral = coordinatesToLiteral;
|
|
8282
|
-
exports2.coordinatesToText = coordinatesToText;
|
|
8283
|
-
exports2.coordinatesToUrlText = coordinatesToUrlText;
|
|
8284
7411
|
exports2.createMultiPointGeometry = createMultiPointGeometry;
|
|
8285
7412
|
exports2.createOfflineAction = createOfflineAction;
|
|
8286
7413
|
exports2.createPointGeometry = createPointGeometry;
|
|
@@ -8295,14 +7422,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8295
7422
|
exports2.deleteAssetType = deleteAssetType;
|
|
8296
7423
|
exports2.deleteAssetTypeAttachment = deleteAssetTypeAttachment;
|
|
8297
7424
|
exports2.deleteAssetTypeAttachments = deleteAssetTypeAttachments;
|
|
8298
|
-
exports2.deleteAssetTypeFieldValues = deleteAssetTypeFieldValues;
|
|
8299
|
-
exports2.deleteAssetTypeFieldValuesAttachment = deleteAssetTypeFieldValuesAttachment;
|
|
8300
|
-
exports2.deleteAssetTypeFieldValuesAttachments = deleteAssetTypeFieldValuesAttachments;
|
|
8301
|
-
exports2.deleteAssetTypeFieldValuesMany = deleteAssetTypeFieldValuesMany;
|
|
8302
|
-
exports2.deleteAssetTypeFields = deleteAssetTypeFields;
|
|
8303
|
-
exports2.deleteAssetTypeFieldsAttachment = deleteAssetTypeFieldsAttachment;
|
|
8304
|
-
exports2.deleteAssetTypeFieldsAttachments = deleteAssetTypeFieldsAttachments;
|
|
8305
|
-
exports2.deleteAssetTypeFieldsMany = deleteAssetTypeFieldsMany;
|
|
8306
7425
|
exports2.deleteAssetTypes = deleteAssetTypes;
|
|
8307
7426
|
exports2.deleteAssets = deleteAssets;
|
|
8308
7427
|
exports2.deleteCategory = deleteCategory;
|
|
@@ -8327,14 +7446,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8327
7446
|
exports2.deleteIssueAttachments = deleteIssueAttachments;
|
|
8328
7447
|
exports2.deleteIssueComment = deleteIssueComment;
|
|
8329
7448
|
exports2.deleteIssueComments = deleteIssueComments;
|
|
8330
|
-
exports2.deleteIssueTypeFieldValues = deleteIssueTypeFieldValues;
|
|
8331
|
-
exports2.deleteIssueTypeFieldValuesAttachment = deleteIssueTypeFieldValuesAttachment;
|
|
8332
|
-
exports2.deleteIssueTypeFieldValuesAttachments = deleteIssueTypeFieldValuesAttachments;
|
|
8333
|
-
exports2.deleteIssueTypeFieldValuesMany = deleteIssueTypeFieldValuesMany;
|
|
8334
|
-
exports2.deleteIssueTypeFields = deleteIssueTypeFields;
|
|
8335
|
-
exports2.deleteIssueTypeFieldsAttachment = deleteIssueTypeFieldsAttachment;
|
|
8336
|
-
exports2.deleteIssueTypeFieldsAttachments = deleteIssueTypeFieldsAttachments;
|
|
8337
|
-
exports2.deleteIssueTypeFieldsMany = deleteIssueTypeFieldsMany;
|
|
8338
7449
|
exports2.deleteIssueUpdate = deleteIssueUpdate;
|
|
8339
7450
|
exports2.deleteIssueUpdates = deleteIssueUpdates;
|
|
8340
7451
|
exports2.deleteIssues = deleteIssues;
|
|
@@ -8364,8 +7475,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8364
7475
|
exports2.fileReducer = fileReducer;
|
|
8365
7476
|
exports2.fileSlice = fileSlice;
|
|
8366
7477
|
exports2.fileToBlob = fileToBlob;
|
|
8367
|
-
exports2.flipBounds = flipBounds;
|
|
8368
|
-
exports2.flipCoordinates = flipCoordinates;
|
|
8369
7478
|
exports2.formReducer = formReducer;
|
|
8370
7479
|
exports2.formRevisionAttachmentReducer = formRevisionAttachmentReducer;
|
|
8371
7480
|
exports2.formRevisionAttachmentSlice = formRevisionAttachmentSlice;
|
|
@@ -8391,10 +7500,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8391
7500
|
exports2.initializeAssetStageCompletions = initializeAssetStageCompletions;
|
|
8392
7501
|
exports2.initializeAssetStages = initializeAssetStages;
|
|
8393
7502
|
exports2.initializeAssetTypeAttachments = initializeAssetTypeAttachments;
|
|
8394
|
-
exports2.initializeAssetTypeFieldValues = initializeAssetTypeFieldValues;
|
|
8395
|
-
exports2.initializeAssetTypeFieldValuesAttachments = initializeAssetTypeFieldValuesAttachments;
|
|
8396
|
-
exports2.initializeAssetTypeFields = initializeAssetTypeFields;
|
|
8397
|
-
exports2.initializeAssetTypeFieldsAttachments = initializeAssetTypeFieldsAttachments;
|
|
8398
7503
|
exports2.initializeAssetTypes = initializeAssetTypes;
|
|
8399
7504
|
exports2.initializeAssets = initializeAssets;
|
|
8400
7505
|
exports2.initializeCategories = initializeCategories;
|
|
@@ -8409,10 +7514,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8409
7514
|
exports2.initializeGeoImages = initializeGeoImages;
|
|
8410
7515
|
exports2.initializeIssueAssociations = initializeIssueAssociations;
|
|
8411
7516
|
exports2.initializeIssueAttachments = initializeIssueAttachments;
|
|
8412
|
-
exports2.initializeIssueTypeFieldValues = initializeIssueTypeFieldValues;
|
|
8413
|
-
exports2.initializeIssueTypeFieldValuesAttachments = initializeIssueTypeFieldValuesAttachments;
|
|
8414
|
-
exports2.initializeIssueTypeFields = initializeIssueTypeFields;
|
|
8415
|
-
exports2.initializeIssueTypeFieldsAttachments = initializeIssueTypeFieldsAttachments;
|
|
8416
7517
|
exports2.initializeIssueTypes = initializeIssueTypes;
|
|
8417
7518
|
exports2.initializeIssueUpdates = initializeIssueUpdates;
|
|
8418
7519
|
exports2.initializeIssues = initializeIssues;
|
|
@@ -8431,32 +7532,20 @@ var __publicField = (obj, key, value) => {
|
|
|
8431
7532
|
exports2.issueCommentSlice = issueCommentSlice;
|
|
8432
7533
|
exports2.issueReducer = issueReducer;
|
|
8433
7534
|
exports2.issueSlice = issueSlice;
|
|
8434
|
-
exports2.issueTypeFieldValuesAttachmentReducer = issueTypeFieldValuesAttachmentReducer;
|
|
8435
|
-
exports2.issueTypeFieldValuesAttachmentSlice = issueTypeFieldValuesAttachmentSlice;
|
|
8436
|
-
exports2.issueTypeFieldValuesReducer = issueTypeFieldValuesReducer;
|
|
8437
|
-
exports2.issueTypeFieldValuesSlice = issueTypeFieldValuesSlice;
|
|
8438
|
-
exports2.issueTypeFieldsAttachmentReducer = issueTypeFieldsAttachmentReducer;
|
|
8439
|
-
exports2.issueTypeFieldsAttachmentSlice = issueTypeFieldsAttachmentSlice;
|
|
8440
|
-
exports2.issueTypeFieldsReducer = issueTypeFieldsReducer;
|
|
8441
|
-
exports2.issueTypeFieldsSlice = issueTypeFieldsSlice;
|
|
8442
7535
|
exports2.issueTypeReducer = issueTypeReducer;
|
|
8443
7536
|
exports2.issueTypeSlice = issueTypeSlice;
|
|
8444
7537
|
exports2.issueUpdateReducer = issueUpdateReducer;
|
|
8445
7538
|
exports2.issueUpdateSlice = issueUpdateSlice;
|
|
8446
7539
|
exports2.licenseReducer = licenseReducer;
|
|
8447
7540
|
exports2.licenseSlice = licenseSlice;
|
|
8448
|
-
exports2.literalToCoordinates = literalToCoordinates;
|
|
8449
7541
|
exports2.logOnlyOnce = logOnlyOnce;
|
|
8450
7542
|
exports2.markAsDeleted = markAsDeleted;
|
|
8451
7543
|
exports2.markForDeletion = markForDeletion;
|
|
8452
7544
|
exports2.memoize = memoize;
|
|
8453
7545
|
exports2.moveDocument = moveDocument;
|
|
8454
7546
|
exports2.offline = offline;
|
|
8455
|
-
exports2.offsetPositionByMeters = offsetPositionByMeters;
|
|
8456
7547
|
exports2.onlyUniqueHashes = onlyUniqueHashes;
|
|
8457
7548
|
exports2.onlyUniqueOfflineIds = onlyUniqueOfflineIds;
|
|
8458
|
-
exports2.openCoordsInGoogleMaps = openCoordsInGoogleMaps;
|
|
8459
|
-
exports2.openDirectionsInGoogleMaps = openDirectionsInGoogleMaps;
|
|
8460
7549
|
exports2.organizationAccessReducer = organizationAccessReducer;
|
|
8461
7550
|
exports2.organizationAccessSlice = organizationAccessSlice;
|
|
8462
7551
|
exports2.organizationReducer = organizationReducer;
|
|
@@ -8511,22 +7600,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8511
7600
|
exports2.selectAssetTypeAttachmentMapping = selectAssetTypeAttachmentMapping;
|
|
8512
7601
|
exports2.selectAssetTypeAttachments = selectAssetTypeAttachments;
|
|
8513
7602
|
exports2.selectAssetTypeById = selectAssetTypeById;
|
|
8514
|
-
exports2.selectAssetTypeFieldValues = selectAssetTypeFieldValues;
|
|
8515
|
-
exports2.selectAssetTypeFieldValuesAttachmentById = selectAssetTypeFieldValuesAttachmentById;
|
|
8516
|
-
exports2.selectAssetTypeFieldValuesAttachments = selectAssetTypeFieldValuesAttachments;
|
|
8517
|
-
exports2.selectAssetTypeFieldValuesAttachmentsMapping = selectAssetTypeFieldValuesAttachmentsMapping;
|
|
8518
|
-
exports2.selectAssetTypeFieldValuesById = selectAssetTypeFieldValuesById;
|
|
8519
|
-
exports2.selectAssetTypeFieldValuesMapping = selectAssetTypeFieldValuesMapping;
|
|
8520
|
-
exports2.selectAssetTypeFieldValuesOfAsset = selectAssetTypeFieldValuesOfAsset;
|
|
8521
|
-
exports2.selectAssetTypeFields = selectAssetTypeFields;
|
|
8522
|
-
exports2.selectAssetTypeFieldsAttachmentById = selectAssetTypeFieldsAttachmentById;
|
|
8523
|
-
exports2.selectAssetTypeFieldsAttachments = selectAssetTypeFieldsAttachments;
|
|
8524
|
-
exports2.selectAssetTypeFieldsAttachmentsMapping = selectAssetTypeFieldsAttachmentsMapping;
|
|
8525
|
-
exports2.selectAssetTypeFieldsById = selectAssetTypeFieldsById;
|
|
8526
|
-
exports2.selectAssetTypeFieldsMapping = selectAssetTypeFieldsMapping;
|
|
8527
|
-
exports2.selectAssetTypeFieldsOfAssetType = selectAssetTypeFieldsOfAssetType;
|
|
8528
7603
|
exports2.selectAssetTypeStagesMapping = selectAssetTypeStagesMapping;
|
|
8529
|
-
exports2.selectAssetTypeValuesOfAssetType = selectAssetTypeValuesOfAssetType;
|
|
8530
7604
|
exports2.selectAssetTypes = selectAssetTypes;
|
|
8531
7605
|
exports2.selectAssetTypesByIds = selectAssetTypesByIds;
|
|
8532
7606
|
exports2.selectAssetTypesMapping = selectAssetTypesMapping;
|
|
@@ -8534,20 +7608,18 @@ var __publicField = (obj, key, value) => {
|
|
|
8534
7608
|
exports2.selectAssetsByIds = selectAssetsByIds;
|
|
8535
7609
|
exports2.selectAssetsMapping = selectAssetsMapping;
|
|
8536
7610
|
exports2.selectAssetsOfAssetType = selectAssetsOfAssetType;
|
|
7611
|
+
exports2.selectAttachedFormSubmissionsOfAsset = selectAttachedFormSubmissionsOfAsset;
|
|
7612
|
+
exports2.selectAttachedFormSubmissionsOfIssue = selectAttachedFormSubmissionsOfIssue;
|
|
8537
7613
|
exports2.selectAttachmentsOfAsset = selectAttachmentsOfAsset;
|
|
8538
7614
|
exports2.selectAttachmentsOfAssetByType = selectAttachmentsOfAssetByType;
|
|
8539
7615
|
exports2.selectAttachmentsOfAssetType = selectAttachmentsOfAssetType;
|
|
8540
7616
|
exports2.selectAttachmentsOfAssetTypeByType = selectAttachmentsOfAssetTypeByType;
|
|
8541
|
-
exports2.selectAttachmentsOfAssetTypeFieldValues = selectAttachmentsOfAssetTypeFieldValues;
|
|
8542
|
-
exports2.selectAttachmentsOfAssetTypeFields = selectAttachmentsOfAssetTypeFields;
|
|
8543
7617
|
exports2.selectAttachmentsOfDocument = selectAttachmentsOfDocument;
|
|
8544
7618
|
exports2.selectAttachmentsOfDocumentByType = selectAttachmentsOfDocumentByType;
|
|
8545
7619
|
exports2.selectAttachmentsOfFormRevision = selectAttachmentsOfFormRevision;
|
|
8546
7620
|
exports2.selectAttachmentsOfFormSubmission = selectAttachmentsOfFormSubmission;
|
|
8547
7621
|
exports2.selectAttachmentsOfIssue = selectAttachmentsOfIssue;
|
|
8548
7622
|
exports2.selectAttachmentsOfIssueByType = selectAttachmentsOfIssueByType;
|
|
8549
|
-
exports2.selectAttachmentsOfIssueTypeFieldValues = selectAttachmentsOfIssueTypeFieldValues;
|
|
8550
|
-
exports2.selectAttachmentsOfIssueTypeFields = selectAttachmentsOfIssueTypeFields;
|
|
8551
7623
|
exports2.selectAttachmentsOfProject = selectAttachmentsOfProject;
|
|
8552
7624
|
exports2.selectAttachmentsOfProjectByType = selectAttachmentsOfProjectByType;
|
|
8553
7625
|
exports2.selectCategories = selectCategories;
|
|
@@ -8575,6 +7647,8 @@ var __publicField = (obj, key, value) => {
|
|
|
8575
7647
|
exports2.selectFilteredForms = selectFilteredForms;
|
|
8576
7648
|
exports2.selectFormById = selectFormById;
|
|
8577
7649
|
exports2.selectFormMapping = selectFormMapping;
|
|
7650
|
+
exports2.selectFormOfAssetType = selectFormOfAssetType;
|
|
7651
|
+
exports2.selectFormOfIssueType = selectFormOfIssueType;
|
|
8578
7652
|
exports2.selectFormRevisionAttachmentsMapping = selectFormRevisionAttachmentsMapping;
|
|
8579
7653
|
exports2.selectFormRevisionById = selectFormRevisionById;
|
|
8580
7654
|
exports2.selectFormRevisionMapping = selectFormRevisionMapping;
|
|
@@ -8584,11 +7658,16 @@ var __publicField = (obj, key, value) => {
|
|
|
8584
7658
|
exports2.selectFormSubmissionAttachmentsMapping = selectFormSubmissionAttachmentsMapping;
|
|
8585
7659
|
exports2.selectFormSubmissionById = selectFormSubmissionById;
|
|
8586
7660
|
exports2.selectFormSubmissions = selectFormSubmissions;
|
|
7661
|
+
exports2.selectFormSubmissionsByAssets = selectFormSubmissionsByAssets;
|
|
7662
|
+
exports2.selectFormSubmissionsByFormRevisions = selectFormSubmissionsByFormRevisions;
|
|
7663
|
+
exports2.selectFormSubmissionsByIssues = selectFormSubmissionsByIssues;
|
|
8587
7664
|
exports2.selectFormSubmissionsMapping = selectFormSubmissionsMapping;
|
|
8588
7665
|
exports2.selectFormSubmissionsOfAsset = selectFormSubmissionsOfAsset;
|
|
8589
7666
|
exports2.selectFormSubmissionsOfForm = selectFormSubmissionsOfForm;
|
|
8590
7667
|
exports2.selectFormSubmissionsOfIssue = selectFormSubmissionsOfIssue;
|
|
8591
7668
|
exports2.selectForms = selectForms;
|
|
7669
|
+
exports2.selectFormsCount = selectFormsCount;
|
|
7670
|
+
exports2.selectGeneralFormCount = selectGeneralFormCount;
|
|
8592
7671
|
exports2.selectGeoImageById = selectGeoImageById;
|
|
8593
7672
|
exports2.selectGeoImageMapping = selectGeoImageMapping;
|
|
8594
7673
|
exports2.selectGeoImages = selectGeoImages;
|
|
@@ -8610,22 +7689,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8610
7689
|
exports2.selectIssueCountOfCategory = selectIssueCountOfCategory;
|
|
8611
7690
|
exports2.selectIssueMapping = selectIssueMapping;
|
|
8612
7691
|
exports2.selectIssueTypeById = selectIssueTypeById;
|
|
8613
|
-
exports2.selectIssueTypeFieldValues = selectIssueTypeFieldValues;
|
|
8614
|
-
exports2.selectIssueTypeFieldValuesAttachmentById = selectIssueTypeFieldValuesAttachmentById;
|
|
8615
|
-
exports2.selectIssueTypeFieldValuesAttachments = selectIssueTypeFieldValuesAttachments;
|
|
8616
|
-
exports2.selectIssueTypeFieldValuesAttachmentsMapping = selectIssueTypeFieldValuesAttachmentsMapping;
|
|
8617
|
-
exports2.selectIssueTypeFieldValuesById = selectIssueTypeFieldValuesById;
|
|
8618
|
-
exports2.selectIssueTypeFieldValuesMapping = selectIssueTypeFieldValuesMapping;
|
|
8619
|
-
exports2.selectIssueTypeFieldValuesOfIssue = selectIssueTypeFieldValuesOfIssue;
|
|
8620
|
-
exports2.selectIssueTypeFields = selectIssueTypeFields;
|
|
8621
|
-
exports2.selectIssueTypeFieldsAttachmentById = selectIssueTypeFieldsAttachmentById;
|
|
8622
|
-
exports2.selectIssueTypeFieldsAttachments = selectIssueTypeFieldsAttachments;
|
|
8623
|
-
exports2.selectIssueTypeFieldsAttachmentsMapping = selectIssueTypeFieldsAttachmentsMapping;
|
|
8624
|
-
exports2.selectIssueTypeFieldsById = selectIssueTypeFieldsById;
|
|
8625
|
-
exports2.selectIssueTypeFieldsMapping = selectIssueTypeFieldsMapping;
|
|
8626
|
-
exports2.selectIssueTypeFieldsOfIssueType = selectIssueTypeFieldsOfIssueType;
|
|
8627
7692
|
exports2.selectIssueTypeMapping = selectIssueTypeMapping;
|
|
8628
|
-
exports2.selectIssueTypeValuesOfIssueType = selectIssueTypeValuesOfIssueType;
|
|
8629
7693
|
exports2.selectIssueTypes = selectIssueTypes;
|
|
8630
7694
|
exports2.selectIssueTypesByIds = selectIssueTypesByIds;
|
|
8631
7695
|
exports2.selectIssueTypesOfOrganization = selectIssueTypesOfOrganization;
|
|
@@ -8634,9 +7698,8 @@ var __publicField = (obj, key, value) => {
|
|
|
8634
7698
|
exports2.selectIssuesByIds = selectIssuesByIds;
|
|
8635
7699
|
exports2.selectIssuesOfIssueType = selectIssuesOfIssueType;
|
|
8636
7700
|
exports2.selectIssuesOfIssueTypeCount = selectIssuesOfIssueTypeCount;
|
|
8637
|
-
exports2.
|
|
7701
|
+
exports2.selectLatestFormRevisionByForm = selectLatestFormRevisionByForm;
|
|
8638
7702
|
exports2.selectLatestFormRevisionOfForm = selectLatestFormRevisionOfForm;
|
|
8639
|
-
exports2.selectLatestIssueTypeFieldsOfIssueType = selectLatestIssueTypeFieldsOfIssueType;
|
|
8640
7703
|
exports2.selectLatestRetryTime = selectLatestRetryTime;
|
|
8641
7704
|
exports2.selectLicense = selectLicense;
|
|
8642
7705
|
exports2.selectLicenseForProject = selectLicenseForProject;
|
|
@@ -8673,6 +7736,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8673
7736
|
exports2.selectProjectsOfOrganization = selectProjectsOfOrganization;
|
|
8674
7737
|
exports2.selectRehydrated = selectRehydrated;
|
|
8675
7738
|
exports2.selectRootDocuments = selectRootDocuments;
|
|
7739
|
+
exports2.selectSortedFormSubmissionsOfForm = selectSortedFormSubmissionsOfForm;
|
|
8676
7740
|
exports2.selectSortedOrganizationUsers = selectSortedOrganizationUsers;
|
|
8677
7741
|
exports2.selectSortedProjectUsers = selectSortedProjectUsers;
|
|
8678
7742
|
exports2.selectStageFormIdsFromStageIds = selectStageFormIdsFromStageIds;
|
|
@@ -8691,8 +7755,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8691
7755
|
exports2.selectWorkspaceById = selectWorkspaceById;
|
|
8692
7756
|
exports2.selectWorkspaceMapping = selectWorkspaceMapping;
|
|
8693
7757
|
exports2.selectWorkspaces = selectWorkspaces;
|
|
8694
|
-
exports2.separateFilesFromValues = separateFilesFromValues;
|
|
8695
|
-
exports2.separateImageFromFields = separateImageFromFields;
|
|
8696
7758
|
exports2.setActiveProjectFileId = setActiveProjectFileId;
|
|
8697
7759
|
exports2.setActiveProjectId = setActiveProjectId;
|
|
8698
7760
|
exports2.setAsset = setAsset;
|
|
@@ -8703,14 +7765,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8703
7765
|
exports2.setAssetType = setAssetType;
|
|
8704
7766
|
exports2.setAssetTypeAttachment = setAssetTypeAttachment;
|
|
8705
7767
|
exports2.setAssetTypeAttachments = setAssetTypeAttachments;
|
|
8706
|
-
exports2.setAssetTypeFieldValues = setAssetTypeFieldValues;
|
|
8707
|
-
exports2.setAssetTypeFieldValuesAttachment = setAssetTypeFieldValuesAttachment;
|
|
8708
|
-
exports2.setAssetTypeFieldValuesAttachments = setAssetTypeFieldValuesAttachments;
|
|
8709
|
-
exports2.setAssetTypeFieldValuesMany = setAssetTypeFieldValuesMany;
|
|
8710
|
-
exports2.setAssetTypeFields = setAssetTypeFields;
|
|
8711
|
-
exports2.setAssetTypeFieldsAttachment = setAssetTypeFieldsAttachment;
|
|
8712
|
-
exports2.setAssetTypeFieldsAttachments = setAssetTypeFieldsAttachments;
|
|
8713
|
-
exports2.setAssetTypeFieldsMany = setAssetTypeFieldsMany;
|
|
8714
7768
|
exports2.setAssetTypes = setAssetTypes;
|
|
8715
7769
|
exports2.setAssets = setAssets;
|
|
8716
7770
|
exports2.setConversation = setConversation;
|
|
@@ -8736,14 +7790,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8736
7790
|
exports2.setIssueComment = setIssueComment;
|
|
8737
7791
|
exports2.setIssueComments = setIssueComments;
|
|
8738
7792
|
exports2.setIssueType = setIssueType;
|
|
8739
|
-
exports2.setIssueTypeFieldValues = setIssueTypeFieldValues;
|
|
8740
|
-
exports2.setIssueTypeFieldValuesAttachment = setIssueTypeFieldValuesAttachment;
|
|
8741
|
-
exports2.setIssueTypeFieldValuesAttachments = setIssueTypeFieldValuesAttachments;
|
|
8742
|
-
exports2.setIssueTypeFieldValuesMany = setIssueTypeFieldValuesMany;
|
|
8743
|
-
exports2.setIssueTypeFields = setIssueTypeFields;
|
|
8744
|
-
exports2.setIssueTypeFieldsAttachment = setIssueTypeFieldsAttachment;
|
|
8745
|
-
exports2.setIssueTypeFieldsAttachments = setIssueTypeFieldsAttachments;
|
|
8746
|
-
exports2.setIssueTypeFieldsMany = setIssueTypeFieldsMany;
|
|
8747
7793
|
exports2.setIssueUpdate = setIssueUpdate;
|
|
8748
7794
|
exports2.setLoggedIn = setLoggedIn;
|
|
8749
7795
|
exports2.setOrganizations = setOrganizations;
|
|
@@ -8776,14 +7822,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8776
7822
|
exports2.updateAssetType = updateAssetType;
|
|
8777
7823
|
exports2.updateAssetTypeAttachment = updateAssetTypeAttachment;
|
|
8778
7824
|
exports2.updateAssetTypeAttachments = updateAssetTypeAttachments;
|
|
8779
|
-
exports2.updateAssetTypeFieldValues = updateAssetTypeFieldValues;
|
|
8780
|
-
exports2.updateAssetTypeFieldValuesAttachment = updateAssetTypeFieldValuesAttachment;
|
|
8781
|
-
exports2.updateAssetTypeFieldValuesAttachments = updateAssetTypeFieldValuesAttachments;
|
|
8782
|
-
exports2.updateAssetTypeFieldValuesMany = updateAssetTypeFieldValuesMany;
|
|
8783
|
-
exports2.updateAssetTypeFields = updateAssetTypeFields;
|
|
8784
|
-
exports2.updateAssetTypeFieldsAttachment = updateAssetTypeFieldsAttachment;
|
|
8785
|
-
exports2.updateAssetTypeFieldsAttachments = updateAssetTypeFieldsAttachments;
|
|
8786
|
-
exports2.updateAssetTypeFieldsMany = updateAssetTypeFieldsMany;
|
|
8787
7825
|
exports2.updateAssetTypes = updateAssetTypes;
|
|
8788
7826
|
exports2.updateAssets = updateAssets;
|
|
8789
7827
|
exports2.updateCategory = updateCategory;
|
|
@@ -8806,14 +7844,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8806
7844
|
exports2.updateIssueAttachment = updateIssueAttachment;
|
|
8807
7845
|
exports2.updateIssueAttachments = updateIssueAttachments;
|
|
8808
7846
|
exports2.updateIssueType = updateIssueType;
|
|
8809
|
-
exports2.updateIssueTypeFieldValues = updateIssueTypeFieldValues;
|
|
8810
|
-
exports2.updateIssueTypeFieldValuesAttachment = updateIssueTypeFieldValuesAttachment;
|
|
8811
|
-
exports2.updateIssueTypeFieldValuesAttachments = updateIssueTypeFieldValuesAttachments;
|
|
8812
|
-
exports2.updateIssueTypeFieldValuesMany = updateIssueTypeFieldValuesMany;
|
|
8813
|
-
exports2.updateIssueTypeFields = updateIssueTypeFields;
|
|
8814
|
-
exports2.updateIssueTypeFieldsAttachment = updateIssueTypeFieldsAttachment;
|
|
8815
|
-
exports2.updateIssueTypeFieldsAttachments = updateIssueTypeFieldsAttachments;
|
|
8816
|
-
exports2.updateIssueTypeFieldsMany = updateIssueTypeFieldsMany;
|
|
8817
7847
|
exports2.updateLicense = updateLicense;
|
|
8818
7848
|
exports2.updateOrCreateProject = updateOrCreateProject;
|
|
8819
7849
|
exports2.updateOrganizationAccess = updateOrganizationAccess;
|
|
@@ -8829,7 +7859,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8829
7859
|
exports2.warningColor = warningColor;
|
|
8830
7860
|
exports2.workspaceReducer = workspaceReducer;
|
|
8831
7861
|
exports2.workspaceSlice = workspaceSlice;
|
|
8832
|
-
exports2.worldBounds = worldBounds;
|
|
8833
7862
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
8834
7863
|
});
|
|
8835
7864
|
//# sourceMappingURL=overmap-core.umd.cjs.map
|