@overmap-ai/core 1.0.71-depend-on-forms.0 → 1.0.71-fields.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/overmap-core.js +1848 -994
  2. package/dist/overmap-core.js.map +1 -1
  3. package/dist/overmap-core.umd.cjs +1846 -992
  4. package/dist/overmap-core.umd.cjs.map +1 -1
  5. package/dist/sdk/services/AssetAttachmentService.d.ts +32 -8
  6. package/dist/sdk/services/AssetTypeAttachmentService.d.ts +32 -9
  7. package/dist/sdk/services/AssetTypeFieldValuesAttachmentService.d.ts +13 -0
  8. package/dist/sdk/services/AssetTypeFieldValuesService.d.ts +20 -0
  9. package/dist/sdk/services/AssetTypeFieldsAttachmentService.d.ts +12 -0
  10. package/dist/sdk/services/AssetTypeFieldsService.d.ts +8 -0
  11. package/dist/sdk/services/BaseAttachmentService.d.ts +18 -20
  12. package/dist/sdk/services/BaseUploadService.d.ts +2 -1
  13. package/dist/sdk/services/DocumentAttachmentService.d.ts +30 -8
  14. package/dist/sdk/services/FormRevisionAttachmentService.d.ts +12 -0
  15. package/dist/sdk/services/FormRevisionService.d.ts +8 -0
  16. package/dist/sdk/services/FormService.d.ts +11 -14
  17. package/dist/sdk/services/FormSubmissionAttachmentService.d.ts +13 -0
  18. package/dist/sdk/services/FormSubmissionService.d.ts +8 -28
  19. package/dist/sdk/services/IssueAssociationService.d.ts +2 -2
  20. package/dist/sdk/services/IssueAttachmentService.d.ts +31 -8
  21. package/dist/sdk/services/IssueService.d.ts +0 -3
  22. package/dist/sdk/services/IssueTypeFieldValuesAttachmentService.d.ts +13 -0
  23. package/dist/sdk/services/IssueTypeFieldValuesService.d.ts +10 -0
  24. package/dist/sdk/services/IssueTypeFieldsAttachmentService.d.ts +12 -0
  25. package/dist/sdk/services/IssueTypeFieldsService.d.ts +8 -0
  26. package/dist/sdk/services/ProjectAttachmentService.d.ts +31 -8
  27. package/dist/sdk/services/index.d.ts +10 -0
  28. package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +52 -0
  29. package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +52 -0
  30. package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +52 -0
  31. package/dist/store/slices/assetTypeFieldsSlice.d.ts +52 -0
  32. package/dist/store/slices/formSlice.d.ts +0 -2
  33. package/dist/store/slices/formSubmissionSlice.d.ts +0 -4
  34. package/dist/store/slices/index.d.ts +8 -0
  35. package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +52 -0
  36. package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +52 -0
  37. package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +52 -0
  38. package/dist/store/slices/issueTypeFieldsSlice.d.ts +52 -0
  39. package/dist/store/store.d.ts +9 -1
  40. package/dist/typings/files.d.ts +8 -4
  41. package/dist/typings/models/assets.d.ts +15 -0
  42. package/dist/typings/models/attachments.d.ts +1 -6
  43. package/dist/typings/models/fields.d.ts +16 -0
  44. package/dist/typings/models/forms.d.ts +12 -27
  45. package/dist/typings/models/index.d.ts +1 -0
  46. package/dist/typings/models/issues.d.ts +15 -0
  47. package/dist/typings/models/store.d.ts +9 -1
  48. package/dist/utils/file.d.ts +2 -2
  49. package/package.json +1 -1
@@ -747,15 +747,15 @@ var __publicField = (obj, key, value) => {
747
747
  };
748
748
  const migrations = [initialVersioning, signOut, signOut, createOutboxState];
749
749
  const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
750
- const initialState$B = {
750
+ const initialState$J = {
751
751
  accessToken: "",
752
752
  refreshToken: "",
753
753
  isLoggedIn: false
754
754
  };
755
755
  const authSlice = toolkit.createSlice({
756
756
  name: "auth",
757
- initialState: initialState$B,
758
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
757
+ initialState: initialState$J,
758
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$J)),
759
759
  reducers: {
760
760
  setTokens: (state, action) => {
761
761
  state.accessToken = action.payload.accessToken;
@@ -843,11 +843,11 @@ var __publicField = (obj, key, value) => {
843
843
  };
844
844
  }
845
845
  const categoryAdapter = createModelAdapter((category) => category.offline_id);
846
- const initialState$A = categoryAdapter.getInitialState({});
846
+ const initialState$I = categoryAdapter.getInitialState({});
847
847
  const categorySlice = toolkit.createSlice({
848
848
  name: "categories",
849
- initialState: initialState$A,
850
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$A)),
849
+ initialState: initialState$I,
850
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$I)),
851
851
  reducers: {
852
852
  initializeCategories: categoryAdapter.initialize,
853
853
  addCategory: categoryAdapter.addOne,
@@ -891,11 +891,11 @@ var __publicField = (obj, key, value) => {
891
891
  };
892
892
  const categoryReducer = categorySlice.reducer;
893
893
  const assetAdapter = createModelAdapter((asset) => asset.offline_id);
894
- const initialState$z = assetAdapter.getInitialState({});
894
+ const initialState$H = assetAdapter.getInitialState({});
895
895
  const assetSlice = toolkit.createSlice({
896
896
  name: "assets",
897
- initialState: initialState$z,
898
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
897
+ initialState: initialState$H,
898
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$H)),
899
899
  reducers: {
900
900
  initializeAssets: assetAdapter.initialize,
901
901
  addAsset: assetAdapter.addOne,
@@ -947,11 +947,11 @@ var __publicField = (obj, key, value) => {
947
947
  };
948
948
  const assetReducer = assetSlice.reducer;
949
949
  const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
950
- const initialState$y = assetAttachmentAdapter.getInitialState({});
950
+ const initialState$G = assetAttachmentAdapter.getInitialState({});
951
951
  const assetAttachmentSlice = toolkit.createSlice({
952
952
  name: "assetAttachments",
953
- initialState: initialState$y,
954
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
953
+ initialState: initialState$G,
954
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$G)),
955
955
  reducers: {
956
956
  initializeAssetAttachments: assetAttachmentAdapter.initialize,
957
957
  addAssetAttachment: assetAttachmentAdapter.addOne,
@@ -1012,11 +1012,11 @@ var __publicField = (obj, key, value) => {
1012
1012
  const assetStageCompletionAdapter = createModelAdapter(
1013
1013
  (stageCompletion) => stageCompletion.offline_id
1014
1014
  );
1015
- const initialState$x = assetStageCompletionAdapter.getInitialState({});
1015
+ const initialState$F = assetStageCompletionAdapter.getInitialState({});
1016
1016
  const assetStageCompletionSlice = toolkit.createSlice({
1017
1017
  name: "assetStageCompletions",
1018
- initialState: initialState$x,
1019
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1018
+ initialState: initialState$F,
1019
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$F)),
1020
1020
  reducers: {
1021
1021
  initializeAssetStageCompletions: assetStageCompletionAdapter.initialize,
1022
1022
  addAssetStageCompletion: assetStageCompletionAdapter.addOne,
@@ -1078,11 +1078,11 @@ var __publicField = (obj, key, value) => {
1078
1078
  );
1079
1079
  const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
1080
1080
  const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
1081
- const initialState$w = assetStageAdapter.getInitialState({});
1081
+ const initialState$E = assetStageAdapter.getInitialState({});
1082
1082
  const assetStageSlice = toolkit.createSlice({
1083
1083
  name: "assetStages",
1084
- initialState: initialState$w,
1085
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1084
+ initialState: initialState$E,
1085
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$E)),
1086
1086
  reducers: {
1087
1087
  initializeAssetStages: assetStageAdapter.initialize,
1088
1088
  setAssetStage: assetStageAdapter.setOne,
@@ -1162,11 +1162,11 @@ var __publicField = (obj, key, value) => {
1162
1162
  })
1163
1163
  );
1164
1164
  const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
1165
- const initialState$v = assetTypeAdapter.getInitialState({});
1165
+ const initialState$D = assetTypeAdapter.getInitialState({});
1166
1166
  const assetTypeSlice = toolkit.createSlice({
1167
1167
  name: "assetTypes",
1168
- initialState: initialState$v,
1169
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1168
+ initialState: initialState$D,
1169
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$D)),
1170
1170
  reducers: {
1171
1171
  initializeAssetTypes: assetTypeAdapter.initialize,
1172
1172
  setAssetType: assetTypeAdapter.setOne,
@@ -1219,11 +1219,11 @@ var __publicField = (obj, key, value) => {
1219
1219
  const assetTypeAttachmentAdapter = createModelAdapter(
1220
1220
  (attachment) => attachment.offline_id
1221
1221
  );
1222
- const initialState$u = assetTypeAttachmentAdapter.getInitialState({});
1222
+ const initialState$C = assetTypeAttachmentAdapter.getInitialState({});
1223
1223
  const assetTypeAttachmentSlice = toolkit.createSlice({
1224
1224
  name: "assetTypeAttachments",
1225
- initialState: initialState$u,
1226
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
1225
+ initialState: initialState$C,
1226
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$C)),
1227
1227
  reducers: {
1228
1228
  initializeAssetTypeAttachments: assetTypeAttachmentAdapter.initialize,
1229
1229
  addAssetTypeAttachment: assetTypeAttachmentAdapter.addOne,
@@ -1282,12 +1282,12 @@ var __publicField = (obj, key, value) => {
1282
1282
  );
1283
1283
  const assetTypeAttachmentReducer = assetTypeAttachmentSlice.reducer;
1284
1284
  const issueAdapter = createModelAdapter((issue) => issue.offline_id);
1285
- const initialState$t = issueAdapter.getInitialState({});
1285
+ const initialState$B = issueAdapter.getInitialState({});
1286
1286
  const issueSlice = toolkit.createSlice({
1287
1287
  name: "issues",
1288
- initialState: initialState$t,
1288
+ initialState: initialState$B,
1289
1289
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
1290
- Object.assign(state, initialState$t);
1290
+ Object.assign(state, initialState$B);
1291
1291
  }),
1292
1292
  reducers: {
1293
1293
  initializeIssues: issueAdapter.initialize,
@@ -1319,12 +1319,12 @@ var __publicField = (obj, key, value) => {
1319
1319
  );
1320
1320
  const issueReducer = issueSlice.reducer;
1321
1321
  const issueTypeAdapter = createModelAdapter((issueType) => issueType.offline_id);
1322
- const initialState$s = issueTypeAdapter.getInitialState({});
1322
+ const initialState$A = issueTypeAdapter.getInitialState({});
1323
1323
  const issueTypeSlice = toolkit.createSlice({
1324
1324
  name: "issueTypes",
1325
- initialState: initialState$s,
1325
+ initialState: initialState$A,
1326
1326
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
1327
- Object.assign(state, initialState$s);
1327
+ Object.assign(state, initialState$A);
1328
1328
  }),
1329
1329
  reducers: {
1330
1330
  initializeIssueTypes: issueTypeAdapter.initialize,
@@ -1381,15 +1381,15 @@ var __publicField = (obj, key, value) => {
1381
1381
  return selectIssuesOfIssueType(issueTypeId)(state).length;
1382
1382
  };
1383
1383
  const issueTypeReducer = issueTypeSlice.reducer;
1384
- const initialState$r = {
1384
+ const initialState$z = {
1385
1385
  s3Urls: {}
1386
1386
  };
1387
1387
  const msPerHour = 1e3 * 60 * 60;
1388
1388
  const msPerWeek = msPerHour * 24 * 7;
1389
1389
  const fileSlice = toolkit.createSlice({
1390
1390
  name: "file",
1391
- initialState: initialState$r,
1392
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
1391
+ initialState: initialState$z,
1392
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
1393
1393
  reducers: {
1394
1394
  setUploadUrl: (state, action) => {
1395
1395
  const { url, fields, sha1 } = action.payload;
@@ -1416,14 +1416,14 @@ var __publicField = (obj, key, value) => {
1416
1416
  return url;
1417
1417
  };
1418
1418
  const fileReducer = fileSlice.reducer;
1419
- const initialState$q = {
1419
+ const initialState$y = {
1420
1420
  users: {},
1421
1421
  currentUser: null
1422
1422
  };
1423
1423
  const userSlice = toolkit.createSlice({
1424
1424
  name: "users",
1425
- initialState: initialState$q,
1426
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1425
+ initialState: initialState$y,
1426
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
1427
1427
  reducers: {
1428
1428
  setUsers: (state, action) => {
1429
1429
  const usersMapping = {};
@@ -1481,11 +1481,11 @@ var __publicField = (obj, key, value) => {
1481
1481
  const organizationAccessAdapter = createModelAdapter(
1482
1482
  (organizationAccess) => organizationAccess.offline_id
1483
1483
  );
1484
- const initialState$p = organizationAccessAdapter.getInitialState({});
1484
+ const initialState$x = organizationAccessAdapter.getInitialState({});
1485
1485
  const organizationAccessSlice = toolkit.createSlice({
1486
1486
  name: "organizationAccess",
1487
- initialState: initialState$p,
1488
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
1487
+ initialState: initialState$x,
1488
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1489
1489
  reducers: {
1490
1490
  initializeOrganizationAccesses: organizationAccessAdapter.initialize,
1491
1491
  updateOrganizationAccess: organizationAccessAdapter.updateOne,
@@ -1522,11 +1522,11 @@ var __publicField = (obj, key, value) => {
1522
1522
  };
1523
1523
  const organizationAccessReducer = organizationAccessSlice.reducer;
1524
1524
  const licenseAdapter = createModelAdapter((license) => license.offline_id);
1525
- const initialState$o = licenseAdapter.getInitialState({});
1525
+ const initialState$w = licenseAdapter.getInitialState({});
1526
1526
  const licenseSlice = toolkit.createSlice({
1527
1527
  name: "license",
1528
- initialState: initialState$o,
1529
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1528
+ initialState: initialState$w,
1529
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1530
1530
  reducers: {
1531
1531
  initializeLicences: licenseAdapter.initialize,
1532
1532
  addLicenses: licenseAdapter.addMany,
@@ -1551,11 +1551,11 @@ var __publicField = (obj, key, value) => {
1551
1551
  );
1552
1552
  const licenseReducer = licenseSlice.reducer;
1553
1553
  const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
1554
- const initialState$n = projectAccessAdapter.getInitialState({});
1554
+ const initialState$v = projectAccessAdapter.getInitialState({});
1555
1555
  const projectAccessSlice = toolkit.createSlice({
1556
1556
  name: "projectAccess",
1557
- initialState: initialState$n,
1558
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
1557
+ initialState: initialState$v,
1558
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1559
1559
  reducers: {
1560
1560
  initializeProjectAccesses: projectAccessAdapter.initialize,
1561
1561
  updateProjectAccess: projectAccessAdapter.updateOne,
@@ -1596,14 +1596,14 @@ var __publicField = (obj, key, value) => {
1596
1596
  return projectAccesses;
1597
1597
  };
1598
1598
  const projectAccessReducer = projectAccessSlice.reducer;
1599
- const initialState$m = {
1599
+ const initialState$u = {
1600
1600
  projects: {},
1601
1601
  activeProjectId: null
1602
1602
  };
1603
1603
  const projectSlice = toolkit.createSlice({
1604
1604
  name: "projects",
1605
- initialState: initialState$m,
1606
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
1605
+ initialState: initialState$u,
1606
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
1607
1607
  reducers: {
1608
1608
  setProjects: (state, action) => {
1609
1609
  const projectsMap = {};
@@ -1710,13 +1710,13 @@ var __publicField = (obj, key, value) => {
1710
1710
  });
1711
1711
  }
1712
1712
  );
1713
- const initialState$l = {
1713
+ const initialState$t = {
1714
1714
  organizations: {}
1715
1715
  };
1716
1716
  const organizationSlice = toolkit.createSlice({
1717
1717
  name: "organizations",
1718
- initialState: initialState$l,
1719
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1718
+ initialState: initialState$t,
1719
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$t)),
1720
1720
  reducers: {
1721
1721
  setOrganizations: (state, action) => {
1722
1722
  for (const org of action.payload) {
@@ -1807,14 +1807,14 @@ var __publicField = (obj, key, value) => {
1807
1807
  }
1808
1808
  };
1809
1809
  };
1810
- const initialState$k = {
1810
+ const initialState$s = {
1811
1811
  deletedRequests: [],
1812
1812
  latestRetryTime: 0
1813
1813
  };
1814
1814
  const outboxSlice = toolkit.createSlice({
1815
1815
  name: "outbox",
1816
- initialState: initialState$k,
1817
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1816
+ initialState: initialState$s,
1817
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
1818
1818
  reducers: {
1819
1819
  // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
1820
1820
  // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
@@ -1846,15 +1846,15 @@ var __publicField = (obj, key, value) => {
1846
1846
  const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
1847
1847
  const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
1848
1848
  const outboxReducer = outboxSlice.reducer;
1849
- const initialState$j = {
1849
+ const initialState$r = {
1850
1850
  projectFiles: {},
1851
1851
  activeProjectFileId: null,
1852
1852
  isImportingProjectFile: false
1853
1853
  };
1854
1854
  const projectFileSlice = toolkit.createSlice({
1855
1855
  name: "projectFiles",
1856
- initialState: initialState$j,
1857
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
1856
+ initialState: initialState$r,
1857
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
1858
1858
  reducers: {
1859
1859
  addOrReplaceProjectFiles: (state, action) => {
1860
1860
  for (let fileObj of action.payload) {
@@ -1941,11 +1941,11 @@ var __publicField = (obj, key, value) => {
1941
1941
  };
1942
1942
  const projectFileReducer = projectFileSlice.reducer;
1943
1943
  const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
1944
- const initialState$i = projectAttachmentAdapter.getInitialState({});
1944
+ const initialState$q = projectAttachmentAdapter.getInitialState({});
1945
1945
  const projectAttachmentSlice = toolkit.createSlice({
1946
1946
  name: "projectAttachments",
1947
- initialState: initialState$i,
1948
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
1947
+ initialState: initialState$q,
1948
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1949
1949
  reducers: {
1950
1950
  initializeProjectAttachments: projectAttachmentAdapter.initialize,
1951
1951
  addProjectAttachment: projectAttachmentAdapter.addOne,
@@ -2000,12 +2000,12 @@ var __publicField = (obj, key, value) => {
2000
2000
  )
2001
2001
  );
2002
2002
  const projectAttachmentReducer = projectAttachmentSlice.reducer;
2003
- const initialState$h = {
2003
+ const initialState$p = {
2004
2004
  isRehydrated: false
2005
2005
  };
2006
2006
  const rehydratedSlice = toolkit.createSlice({
2007
2007
  name: "rehydrated",
2008
- initialState: initialState$h,
2008
+ initialState: initialState$p,
2009
2009
  // The `reducers` field lets us define reducers and generate associated actions
2010
2010
  reducers: {
2011
2011
  setRehydrated: (state, action) => {
@@ -2030,11 +2030,11 @@ var __publicField = (obj, key, value) => {
2030
2030
  }
2031
2031
  };
2032
2032
  const formRevisionAdapter = createModelAdapter((revision) => revision.offline_id);
2033
- const initialState$g = formRevisionAdapter.getInitialState({});
2033
+ const initialState$o = formRevisionAdapter.getInitialState({});
2034
2034
  const formRevisionsSlice = toolkit.createSlice({
2035
2035
  name: "formRevisions",
2036
- initialState: initialState$g,
2037
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2036
+ initialState: initialState$o,
2037
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
2038
2038
  reducers: {
2039
2039
  initializeFormRevisions: formRevisionAdapter.initialize,
2040
2040
  setFormRevision: formRevisionAdapter.setOne,
@@ -2106,11 +2106,11 @@ var __publicField = (obj, key, value) => {
2106
2106
  });
2107
2107
  const formRevisionReducer = formRevisionsSlice.reducer;
2108
2108
  const formAdapter = createModelAdapter((form) => form.offline_id);
2109
- const initialState$f = formAdapter.getInitialState({});
2109
+ const initialState$n = formAdapter.getInitialState({});
2110
2110
  const formSlice = toolkit.createSlice({
2111
2111
  name: "forms",
2112
- initialState: initialState$f,
2113
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2112
+ initialState: initialState$n,
2113
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
2114
2114
  reducers: {
2115
2115
  initializeForms: formAdapter.initialize,
2116
2116
  setForm: formAdapter.setOne,
@@ -2156,34 +2156,18 @@ var __publicField = (obj, key, value) => {
2156
2156
  const selectFormById = (formId) => (state) => {
2157
2157
  return state.formReducer.instances[formId];
2158
2158
  };
2159
- const selectFormOfAssetType = restructureCreateSelectorWithArgs(
2160
- toolkit.createSelector(
2161
- [selectFormMapping, (_state, assetTypeId) => assetTypeId],
2162
- (formsMapping, assetTypeId) => {
2163
- return Object.values(formsMapping).find((form) => form.asset_type === assetTypeId);
2164
- }
2165
- )
2166
- );
2167
- const selectFormOfIssueType = restructureCreateSelectorWithArgs(
2168
- toolkit.createSelector(
2169
- [selectFormMapping, (_state, issueTypeId) => issueTypeId],
2170
- (formsMapping, issueTypeId) => {
2171
- return Object.values(formsMapping).find((form) => form.issue_type === issueTypeId);
2172
- }
2173
- )
2174
- );
2175
2159
  const selectFormsCount = toolkit.createSelector([selectFormMapping], (formsMapping) => {
2176
2160
  return Object.keys(formsMapping).length;
2177
2161
  });
2178
2162
  const selectGeneralFormCount = toolkit.createSelector([selectFormMapping], (formsMapping) => {
2179
- return Object.values(formsMapping).filter((form) => !form.asset_type).length;
2163
+ return Object.values(formsMapping).length;
2180
2164
  });
2181
2165
  const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
2182
- const initialState$e = submissionAdapter.getInitialState({});
2166
+ const initialState$m = submissionAdapter.getInitialState({});
2183
2167
  const formSubmissionSlice = toolkit.createSlice({
2184
2168
  name: "formSubmissions",
2185
- initialState: initialState$e,
2186
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2169
+ initialState: initialState$m,
2170
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
2187
2171
  reducers: {
2188
2172
  initializeFormSubmissions: submissionAdapter.initialize,
2189
2173
  setFormSubmission: submissionAdapter.setOne,
@@ -2286,54 +2270,6 @@ var __publicField = (obj, key, value) => {
2286
2270
  }
2287
2271
  )
2288
2272
  );
2289
- const selectAttachedFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
2290
- toolkit.createSelector(
2291
- [
2292
- (state) => state.issueReducer.instances,
2293
- (state) => state.formReducer.instances,
2294
- (state) => state.formRevisionReducer.instances,
2295
- (state) => state.formSubmissionReducer.instances,
2296
- (_state, issueId) => issueId
2297
- ],
2298
- (issues, forms, formRevisions, submissions, issueId) => {
2299
- const issue = issues[issueId];
2300
- if (!issue)
2301
- return [];
2302
- if (!issue.issue_type) {
2303
- return Object.values(submissions).filter((submission) => submission.issue === issueId);
2304
- }
2305
- const issueTypeForms = new Set(
2306
- Object.keys(forms).filter((formId) => forms[formId].issue_type === issue.issue_type)
2307
- );
2308
- const issueTypeFormRevisions = new Set(
2309
- Object.keys(formRevisions).filter(
2310
- (formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
2311
- )
2312
- );
2313
- return Object.values(submissions).filter(
2314
- (submission) => submission.issue === issueId && !issueTypeFormRevisions.has(submission.form_revision)
2315
- );
2316
- }
2317
- )
2318
- );
2319
- const selectFormSubmissionsByIssues = restructureCreateSelectorWithArgs(
2320
- toolkit.createSelector(
2321
- [selectFormSubmissions, (_state, issueIds) => issueIds],
2322
- (submissions, issueIds) => {
2323
- var _a2;
2324
- const issueSubmissions = {};
2325
- for (const issueId of issueIds) {
2326
- issueSubmissions[issueId] = [];
2327
- }
2328
- for (const submission of submissions) {
2329
- if (submission.issue && issueIds.includes(submission.issue)) {
2330
- (_a2 = issueSubmissions[submission.issue]) == null ? void 0 : _a2.push(submission);
2331
- }
2332
- }
2333
- return issueSubmissions;
2334
- }
2335
- )
2336
- );
2337
2273
  const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
2338
2274
  toolkit.createSelector(
2339
2275
  [selectFormSubmissions, (_state, assetId) => assetId],
@@ -2344,62 +2280,15 @@ var __publicField = (obj, key, value) => {
2344
2280
  }
2345
2281
  )
2346
2282
  );
2347
- const selectAttachedFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
2348
- toolkit.createSelector(
2349
- [
2350
- (state) => state.assetReducer.instances,
2351
- (state) => state.formReducer.instances,
2352
- (state) => state.formRevisionReducer.instances,
2353
- (state) => state.formSubmissionReducer.instances,
2354
- (_state, assetId) => assetId
2355
- ],
2356
- (assets, forms, formRevisions, submissions, assetId) => {
2357
- const asset = assets[assetId];
2358
- if (!asset)
2359
- return [];
2360
- if (!asset.asset_type) {
2361
- return Object.values(submissions).filter((submission) => submission.asset === assetId);
2362
- }
2363
- const issueTypeForms = new Set(
2364
- Object.keys(forms).filter((formId) => forms[formId].asset_type === asset.asset_type)
2365
- );
2366
- const issueTypeFormRevisions = new Set(
2367
- Object.keys(formRevisions).filter(
2368
- (formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
2369
- )
2370
- );
2371
- return Object.values(submissions).filter(
2372
- (submission) => submission.asset === assetId && !issueTypeFormRevisions.has(submission.form_revision)
2373
- );
2374
- }
2375
- )
2376
- );
2377
- const selectFormSubmissionsByAssets = toolkit.createSelector(
2378
- [selectFormSubmissionsMapping, selectAssetsMapping],
2379
- (submissions, assets) => {
2380
- var _a2;
2381
- const assetSubmissionMapping = {};
2382
- for (const assetId in assets) {
2383
- assetSubmissionMapping[assetId] = [];
2384
- }
2385
- for (const submissionId in submissions) {
2386
- const submission = submissions[submissionId];
2387
- if (submission.asset) {
2388
- (_a2 = assetSubmissionMapping[submission.asset]) == null ? void 0 : _a2.push(submission);
2389
- }
2390
- }
2391
- return assetSubmissionMapping;
2392
- }
2393
- );
2394
2283
  const formSubmissionReducer = formSubmissionSlice.reducer;
2395
2284
  const formSubmissionAttachmentAdapter = createModelAdapter(
2396
2285
  (attachment) => attachment.offline_id
2397
2286
  );
2398
- const initialState$d = formSubmissionAttachmentAdapter.getInitialState({});
2287
+ const initialState$l = formSubmissionAttachmentAdapter.getInitialState({});
2399
2288
  const formSubmissionAttachmentSlice = toolkit.createSlice({
2400
2289
  name: "formSubmissionAttachments",
2401
- initialState: initialState$d,
2402
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2290
+ initialState: initialState$l,
2291
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
2403
2292
  reducers: {
2404
2293
  initializeFormSubmissionAttachments: formSubmissionAttachmentAdapter.initialize,
2405
2294
  addFormSubmissionAttachment: formSubmissionAttachmentAdapter.addOne,
@@ -2442,7 +2331,9 @@ var __publicField = (obj, key, value) => {
2442
2331
  [selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
2443
2332
  (attachmentsMapping, submissionId) => {
2444
2333
  return fallbackToEmptyArray(
2445
- Object.values(attachmentsMapping).filter((attachment) => attachment.submission === submissionId)
2334
+ Object.values(attachmentsMapping).filter(
2335
+ (attachment) => attachment.form_submission === submissionId
2336
+ )
2446
2337
  );
2447
2338
  }
2448
2339
  )
@@ -2451,11 +2342,11 @@ var __publicField = (obj, key, value) => {
2451
2342
  const formRevisionAttachmentAdapter = createModelAdapter(
2452
2343
  (attachment) => attachment.offline_id
2453
2344
  );
2454
- const initialState$c = formRevisionAttachmentAdapter.getInitialState({});
2345
+ const initialState$k = formRevisionAttachmentAdapter.getInitialState({});
2455
2346
  const formRevisionAttachmentSlice = toolkit.createSlice({
2456
2347
  name: "formRevisionAttachments",
2457
- initialState: initialState$c,
2458
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2348
+ initialState: initialState$k,
2349
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
2459
2350
  reducers: {
2460
2351
  initializeFormRevisionAttachments: formRevisionAttachmentAdapter.initialize,
2461
2352
  addFormRevisionAttachment: formRevisionAttachmentAdapter.addOne,
@@ -2487,17 +2378,17 @@ var __publicField = (obj, key, value) => {
2487
2378
  [selectFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
2488
2379
  (attachments, revisionId) => {
2489
2380
  return fallbackToEmptyArray(
2490
- Object.values(attachments).filter((attachment) => attachment.revision === revisionId)
2381
+ Object.values(attachments).filter((attachment) => attachment.form_revision === revisionId)
2491
2382
  );
2492
2383
  }
2493
2384
  )
2494
2385
  );
2495
2386
  const formRevisionAttachmentReducer = formRevisionAttachmentSlice.reducer;
2496
2387
  const workspaceAdapter = createModelAdapter((workspace) => workspace.offline_id);
2497
- const initialState$b = workspaceAdapter.getInitialState({});
2388
+ const initialState$j = workspaceAdapter.getInitialState({});
2498
2389
  const workspaceSlice = toolkit.createSlice({
2499
2390
  name: "workspace",
2500
- initialState: initialState$b,
2391
+ initialState: initialState$j,
2501
2392
  reducers: {
2502
2393
  initializeWorkspaces: workspaceAdapter.initialize,
2503
2394
  setWorkspaces: workspaceAdapter.setMany,
@@ -2528,10 +2419,10 @@ var __publicField = (obj, key, value) => {
2528
2419
  );
2529
2420
  const workspaceReducer = workspaceSlice.reducer;
2530
2421
  const emailDomainAdapter = createModelAdapter((emailDomain) => emailDomain.offline_id);
2531
- const initialState$a = emailDomainAdapter.getInitialState({});
2422
+ const initialState$i = emailDomainAdapter.getInitialState({});
2532
2423
  const emailDomainsSlice = toolkit.createSlice({
2533
2424
  name: "emailDomains",
2534
- initialState: initialState$a,
2425
+ initialState: initialState$i,
2535
2426
  reducers: {
2536
2427
  initializeEmailDomains: emailDomainAdapter.initialize,
2537
2428
  addEmailDomain: emailDomainAdapter.addOne,
@@ -2552,14 +2443,14 @@ var __publicField = (obj, key, value) => {
2552
2443
  )
2553
2444
  );
2554
2445
  const emailDomainsReducer = emailDomainsSlice.reducer;
2555
- const initialState$9 = {
2446
+ const initialState$h = {
2556
2447
  documents: {}
2557
2448
  };
2558
2449
  const documentSlice = toolkit.createSlice({
2559
2450
  name: "documents",
2560
- initialState: initialState$9,
2451
+ initialState: initialState$h,
2561
2452
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
2562
- Object.assign(state, initialState$9);
2453
+ Object.assign(state, initialState$h);
2563
2454
  }),
2564
2455
  reducers: {
2565
2456
  setDocuments: (state, action) => {
@@ -2748,11 +2639,11 @@ var __publicField = (obj, key, value) => {
2748
2639
  );
2749
2640
  const documentsReducer = documentSlice.reducer;
2750
2641
  const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
2751
- const initialState$8 = documentAttachmentAdapter.getInitialState({});
2642
+ const initialState$g = documentAttachmentAdapter.getInitialState({});
2752
2643
  const documentAttachmentSlice = toolkit.createSlice({
2753
2644
  name: "documentAttachments",
2754
- initialState: initialState$8,
2755
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
2645
+ initialState: initialState$g,
2646
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2756
2647
  reducers: {
2757
2648
  initializeDocumentAttachments: documentAttachmentAdapter.initialize,
2758
2649
  addDocumentAttachment: documentAttachmentAdapter.addOne,
@@ -2811,11 +2702,11 @@ var __publicField = (obj, key, value) => {
2811
2702
  );
2812
2703
  const documentAttachmentReducer = documentAttachmentSlice.reducer;
2813
2704
  const teamAdapter = createModelAdapter((team) => team.offline_id);
2814
- const initialState$7 = teamAdapter.getInitialState({});
2705
+ const initialState$f = teamAdapter.getInitialState({});
2815
2706
  const teamSlice = toolkit.createSlice({
2816
2707
  name: "teams",
2817
- initialState: initialState$7,
2818
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
2708
+ initialState: initialState$f,
2709
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2819
2710
  reducers: {
2820
2711
  setTeam: teamAdapter.setOne,
2821
2712
  initializeTeams: teamAdapter.initialize,
@@ -2866,11 +2757,11 @@ var __publicField = (obj, key, value) => {
2866
2757
  const agentUserConversationAdapter = createModelAdapter(
2867
2758
  (conversation) => conversation.offline_id
2868
2759
  );
2869
- const initialState$6 = agentUserConversationAdapter.getInitialState({});
2760
+ const initialState$e = agentUserConversationAdapter.getInitialState({});
2870
2761
  const agentsSlice = toolkit.createSlice({
2871
2762
  name: "agents",
2872
- initialState: initialState$6,
2873
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
2763
+ initialState: initialState$e,
2764
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2874
2765
  reducers: {
2875
2766
  initializeConversations: agentUserConversationAdapter.initialize,
2876
2767
  addConversation: agentUserConversationAdapter.addOne,
@@ -2892,11 +2783,11 @@ var __publicField = (obj, key, value) => {
2892
2783
  );
2893
2784
  const agentsReducer = agentsSlice.reducer;
2894
2785
  const issueCommentAdapter = createModelAdapter((comment) => comment.offline_id);
2895
- const initialState$5 = issueCommentAdapter.getInitialState({});
2786
+ const initialState$d = issueCommentAdapter.getInitialState({});
2896
2787
  const issueCommentSlice = toolkit.createSlice({
2897
2788
  name: "issueComments",
2898
- initialState: initialState$5,
2899
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
2789
+ initialState: initialState$d,
2790
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2900
2791
  reducers: {
2901
2792
  addIssueComment: issueCommentAdapter.addOne,
2902
2793
  addIssueComments: issueCommentAdapter.addMany,
@@ -2925,11 +2816,11 @@ var __publicField = (obj, key, value) => {
2925
2816
  );
2926
2817
  const issueCommentReducer = issueCommentSlice.reducer;
2927
2818
  const issueUpdateAdapter = createModelAdapter((issueUpdate) => issueUpdate.offline_id);
2928
- const initialState$4 = issueUpdateAdapter.getInitialState({});
2819
+ const initialState$c = issueUpdateAdapter.getInitialState({});
2929
2820
  const issueUpdateSlice = toolkit.createSlice({
2930
2821
  name: "issueUpdates",
2931
- initialState: initialState$4,
2932
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
2822
+ initialState: initialState$c,
2823
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2933
2824
  reducers: {
2934
2825
  initializeIssueUpdates: issueUpdateAdapter.setMany,
2935
2826
  setIssueUpdate: issueUpdateAdapter.setOne,
@@ -2958,11 +2849,11 @@ var __publicField = (obj, key, value) => {
2958
2849
  );
2959
2850
  const issueUpdateReducer = issueUpdateSlice.reducer;
2960
2851
  const issueAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
2961
- const initialState$3 = issueAttachmentAdapter.getInitialState({});
2852
+ const initialState$b = issueAttachmentAdapter.getInitialState({});
2962
2853
  const issueAttachmentSlice = toolkit.createSlice({
2963
2854
  name: "issueAttachments",
2964
- initialState: initialState$3,
2965
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
2855
+ initialState: initialState$b,
2856
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2966
2857
  reducers: {
2967
2858
  initializeIssueAttachments: issueAttachmentAdapter.initialize,
2968
2859
  addIssueAttachment: issueAttachmentAdapter.addOne,
@@ -3020,23 +2911,23 @@ var __publicField = (obj, key, value) => {
3020
2911
  )
3021
2912
  );
3022
2913
  const issueAttachmentReducer = issueAttachmentSlice.reducer;
3023
- const initialState$2 = {
2914
+ const initialState$a = {
3024
2915
  version: 0
3025
2916
  };
3026
2917
  const versioningSlice = toolkit.createSlice({
3027
2918
  name: "versioning",
3028
- initialState: initialState$2,
2919
+ initialState: initialState$a,
3029
2920
  reducers: {}
3030
2921
  });
3031
2922
  const versioningReducer = versioningSlice.reducer;
3032
2923
  const geoImageAdapter = createModelAdapter((model) => model.offline_id);
3033
- const initialState$1 = geoImageAdapter.getInitialState({});
2924
+ const initialState$9 = geoImageAdapter.getInitialState({});
3034
2925
  const geoImageSlice = toolkit.createSlice({
3035
2926
  name: "geoImages",
3036
- initialState: initialState$1,
2927
+ initialState: initialState$9,
3037
2928
  extraReducers: (builder) => {
3038
2929
  builder.addCase("RESET", (state) => {
3039
- Object.assign(state, initialState$1);
2930
+ Object.assign(state, initialState$9);
3040
2931
  });
3041
2932
  },
3042
2933
  reducers: {
@@ -3074,11 +2965,11 @@ var __publicField = (obj, key, value) => {
3074
2965
  );
3075
2966
  const geoImageReducer = geoImageSlice.reducer;
3076
2967
  const issueAssociationAdapter = createModelAdapter((assoc) => assoc.offline_id);
3077
- const initialState = issueAssociationAdapter.getInitialState({});
2968
+ const initialState$8 = issueAssociationAdapter.getInitialState({});
3078
2969
  const issueAssociationSlice = toolkit.createSlice({
3079
2970
  name: "issueAssociations",
3080
- initialState,
3081
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
2971
+ initialState: initialState$8,
2972
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
3082
2973
  reducers: {
3083
2974
  initializeIssueAssociations: issueAssociationAdapter.initialize,
3084
2975
  addIssueAssociation: issueAssociationAdapter.addOne,
@@ -3136,86 +3027,462 @@ var __publicField = (obj, key, value) => {
3136
3027
  )
3137
3028
  );
3138
3029
  const issueAssociationReducer = issueAssociationSlice.reducer;
3139
- let clientStore;
3140
- function setClientStore(store) {
3141
- clientStore = store;
3142
- }
3143
- function getClientStore() {
3144
- return clientStore;
3145
- }
3146
- let clientSDK;
3147
- function setClientSDK(sdkCtor) {
3148
- clientSDK = sdkCtor;
3149
- }
3150
- function getClientSDK() {
3151
- return clientSDK;
3152
- }
3153
- const CLASS_NAME_TO_SERVICE = {};
3154
- class BaseService {
3155
- constructor(sdk) {
3156
- __publicField(this, "client");
3157
- CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
3158
- this.client = sdk;
3159
- }
3160
- async enqueueRequest(requestDetails) {
3161
- return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
3162
- }
3163
- dispatch(action) {
3164
- this.client.store.dispatch(action);
3030
+ const issueTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
3031
+ const initialState$7 = issueTypeFieldsAdapter.getInitialState({});
3032
+ const issueTypeFieldsSlice = toolkit.createSlice({
3033
+ name: "issueTypeFields",
3034
+ initialState: initialState$7,
3035
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3036
+ reducers: {
3037
+ initializeIssueTypeFields: issueTypeFieldsAdapter.initialize,
3038
+ addIssueTypeFields: issueTypeFieldsAdapter.addOne,
3039
+ addIssueTypeFieldsMany: issueTypeFieldsAdapter.addMany,
3040
+ setIssueTypeFields: issueTypeFieldsAdapter.setOne,
3041
+ setIssueTypeFieldsMany: issueTypeFieldsAdapter.setMany,
3042
+ updateIssueTypeFields: issueTypeFieldsAdapter.updateOne,
3043
+ updateIssueTypeFieldsMany: issueTypeFieldsAdapter.updateMany,
3044
+ deleteIssueTypeFields: issueTypeFieldsAdapter.deleteOne,
3045
+ deleteIssueTypeFieldsMany: issueTypeFieldsAdapter.deleteMany
3165
3046
  }
3166
- }
3167
- const VERSION_REDUCER_KEY = "versioning";
3168
- const overmapReducers = {
3169
- // TODO: attachmentReducer,
3170
- [VERSION_REDUCER_KEY]: versioningReducer,
3171
- fileReducer,
3172
- authReducer,
3173
- categoryReducer,
3174
- assetReducer,
3175
- assetAttachmentReducer,
3176
- assetStageCompletionReducer,
3177
- assetStageReducer,
3178
- assetTypeReducer,
3179
- assetTypeAttachmentReducer,
3180
- issueReducer,
3181
- issueAttachmentReducer,
3182
- issueTypeReducer,
3183
- organizationReducer,
3184
- outboxReducer,
3185
- projectReducer,
3186
- projectAttachmentReducer,
3187
- projectAccessReducer,
3188
- organizationAccessReducer,
3189
- projectFileReducer,
3190
- rehydratedReducer,
3191
- formReducer,
3192
- formRevisionReducer,
3193
- formRevisionAttachmentReducer,
3194
- formSubmissionAttachmentReducer,
3195
- formSubmissionReducer,
3196
- userReducer,
3197
- workspaceReducer,
3198
- emailDomainsReducer,
3199
- licenseReducer,
3200
- documentsReducer,
3201
- documentAttachmentReducer,
3202
- teamReducer,
3203
- agentsReducer,
3204
- issueCommentReducer,
3205
- issueUpdateReducer,
3206
- geoImageReducer,
3207
- issueAssociationReducer
3047
+ });
3048
+ const {
3049
+ initializeIssueTypeFields,
3050
+ addIssueTypeFields,
3051
+ addIssueTypeFieldsMany,
3052
+ setIssueTypeFields,
3053
+ setIssueTypeFieldsMany,
3054
+ updateIssueTypeFields,
3055
+ updateIssueTypeFieldsMany,
3056
+ deleteIssueTypeFields,
3057
+ deleteIssueTypeFieldsMany
3058
+ } = issueTypeFieldsSlice.actions;
3059
+ const selectIssueTypeFieldsMapping = (state) => state.issueTypeFieldsReducer.instances;
3060
+ const selectIssueTypeFields = toolkit.createSelector([selectIssueTypeFieldsMapping], (fieldsMapping) => {
3061
+ return Object.values(fieldsMapping);
3062
+ });
3063
+ const selectIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
3064
+ toolkit.createSelector([selectIssueTypeFields, (_state, issueTypeId) => issueTypeId], (fields, issueTypeId) => {
3065
+ return fallbackToEmptyArray(fields.filter((field) => field.issue_type === issueTypeId));
3066
+ })
3067
+ );
3068
+ const selectIssueTypeFieldsById = (fieldsId) => (state) => {
3069
+ return state.issueTypeFieldsReducer.instances[fieldsId];
3208
3070
  };
3209
- const overmapReducer = toolkit.combineReducers(overmapReducers);
3210
- const resetStore = "RESET";
3211
- const overmapRootReducer = (state, action) => {
3212
- if (action.type === "auth/setLoggedIn" && !action.payload) {
3213
- return overmapReducer(void 0, action);
3071
+ const issueTypeFieldsReducer = issueTypeFieldsSlice.reducer;
3072
+ const issueTypeFieldValuesAdapter = createModelAdapter(
3073
+ (fieldValues) => fieldValues.offline_id
3074
+ );
3075
+ const initialState$6 = issueTypeFieldValuesAdapter.getInitialState({});
3076
+ const issueTypeFieldValuesSlice = toolkit.createSlice({
3077
+ name: "issueTypeFieldValues",
3078
+ initialState: initialState$6,
3079
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3080
+ reducers: {
3081
+ initializeIssueTypeFieldValues: issueTypeFieldValuesAdapter.initialize,
3082
+ addIssueTypeFieldValues: issueTypeFieldValuesAdapter.addOne,
3083
+ addIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.addMany,
3084
+ setIssueTypeFieldValues: issueTypeFieldValuesAdapter.setOne,
3085
+ setIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.setMany,
3086
+ updateIssueTypeFieldValues: issueTypeFieldValuesAdapter.updateOne,
3087
+ updateIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.updateMany,
3088
+ deleteIssueTypeFieldValues: issueTypeFieldValuesAdapter.deleteOne,
3089
+ deleteIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.deleteMany
3214
3090
  }
3215
- return overmapReducer(state, action);
3091
+ });
3092
+ const {
3093
+ initializeIssueTypeFieldValues,
3094
+ addIssueTypeFieldValues,
3095
+ addIssueTypeFieldValuesMany,
3096
+ setIssueTypeFieldValues,
3097
+ setIssueTypeFieldValuesMany,
3098
+ updateIssueTypeFieldValues,
3099
+ updateIssueTypeFieldValuesMany,
3100
+ deleteIssueTypeFieldValues,
3101
+ deleteIssueTypeFieldValuesMany
3102
+ } = issueTypeFieldValuesSlice.actions;
3103
+ const selectIssueTypeFieldValuesMapping = (state) => state.issueTypeFieldValuesReducer.instances;
3104
+ const selectIssueTypeFieldValues = toolkit.createSelector([selectIssueTypeFieldValuesMapping], (fieldValuesMapping) => {
3105
+ return Object.values(fieldValuesMapping);
3106
+ });
3107
+ const selectIssueTypeFieldValuesOfIssue = restructureCreateSelectorWithArgs(
3108
+ toolkit.createSelector([selectIssueTypeFieldValues, (_state, issueId) => issueId], (fieldValues, issueId) => {
3109
+ return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.issue === issueId));
3110
+ })
3111
+ );
3112
+ const selectIssueTypeFieldValuesById = (fieldValuesId) => (state) => {
3113
+ return state.issueTypeFieldValuesReducer.instances[fieldValuesId];
3216
3114
  };
3217
- let __OUTBOX_COORDINATOR = null;
3218
- function getOutboxCoordinator() {
3115
+ const issueTypeFieldValuesReducer = issueTypeFieldValuesSlice.reducer;
3116
+ const issueTypeFieldsAttachmentAdapter = createModelAdapter(
3117
+ (attachment) => attachment.offline_id
3118
+ );
3119
+ const initialState$5 = issueTypeFieldsAttachmentAdapter.getInitialState({});
3120
+ const issueTypeFieldsAttachmentSlice = toolkit.createSlice({
3121
+ name: "issueTypeFieldsAttachments",
3122
+ initialState: initialState$5,
3123
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
3124
+ reducers: {
3125
+ initializeIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.initialize,
3126
+ addIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.addOne,
3127
+ addIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.addMany,
3128
+ setIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.setOne,
3129
+ setIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.setMany,
3130
+ updateIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.updateOne,
3131
+ updateIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.updateMany,
3132
+ deleteIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.deleteOne,
3133
+ deleteIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.deleteMany
3134
+ }
3135
+ });
3136
+ const {
3137
+ initializeIssueTypeFieldsAttachments,
3138
+ addIssueTypeFieldsAttachment,
3139
+ addIssueTypeFieldsAttachments,
3140
+ setIssueTypeFieldsAttachment,
3141
+ setIssueTypeFieldsAttachments,
3142
+ updateIssueTypeFieldsAttachment,
3143
+ updateIssueTypeFieldsAttachments,
3144
+ deleteIssueTypeFieldsAttachment,
3145
+ deleteIssueTypeFieldsAttachments
3146
+ } = issueTypeFieldsAttachmentSlice.actions;
3147
+ const selectIssueTypeFieldsAttachmentsMapping = (state) => state.issueTypeFieldsAttachmentReducer.instances;
3148
+ const selectIssueTypeFieldsAttachments = toolkit.createSelector(
3149
+ [selectIssueTypeFieldsAttachmentsMapping],
3150
+ (attachmentsMapping) => {
3151
+ return Object.values(attachmentsMapping);
3152
+ }
3153
+ );
3154
+ const selectAttachmentsOfIssueTypeFields = restructureCreateSelectorWithArgs(
3155
+ toolkit.createSelector(
3156
+ [selectIssueTypeFieldsAttachments, (_state, fieldsRevision) => fieldsRevision],
3157
+ (attachments, fieldsRevision) => {
3158
+ return fallbackToEmptyArray(
3159
+ attachments.filter((attachment) => attachment.fields_revision === fieldsRevision)
3160
+ );
3161
+ }
3162
+ )
3163
+ );
3164
+ const selectIssueTypeFieldsAttachmentById = (attachmentId) => (state) => {
3165
+ return state.issueTypeFieldsAttachmentReducer.instances[attachmentId];
3166
+ };
3167
+ const issueTypeFieldsAttachmentReducer = issueTypeFieldsAttachmentSlice.reducer;
3168
+ const issueTypeFieldValuesAttachmentAdapter = createModelAdapter(
3169
+ (attachment) => attachment.offline_id
3170
+ );
3171
+ const initialState$4 = issueTypeFieldValuesAttachmentAdapter.getInitialState({});
3172
+ const issueTypeFieldValuesAttachmentSlice = toolkit.createSlice({
3173
+ name: "issueTypeFieldValuesAttachments",
3174
+ initialState: initialState$4,
3175
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
3176
+ reducers: {
3177
+ initializeIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.initialize,
3178
+ addIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.addOne,
3179
+ addIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.addMany,
3180
+ setIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.setOne,
3181
+ setIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.setMany,
3182
+ updateIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.updateOne,
3183
+ updateIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.updateMany,
3184
+ deleteIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.deleteOne,
3185
+ deleteIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.deleteMany
3186
+ }
3187
+ });
3188
+ const {
3189
+ initializeIssueTypeFieldValuesAttachments,
3190
+ addIssueTypeFieldValuesAttachment,
3191
+ addIssueTypeFieldValuesAttachments,
3192
+ setIssueTypeFieldValuesAttachment,
3193
+ setIssueTypeFieldValuesAttachments,
3194
+ updateIssueTypeFieldValuesAttachment,
3195
+ updateIssueTypeFieldValuesAttachments,
3196
+ deleteIssueTypeFieldValuesAttachment,
3197
+ deleteIssueTypeFieldValuesAttachments
3198
+ } = issueTypeFieldValuesAttachmentSlice.actions;
3199
+ const selectIssueTypeFieldValuesAttachmentsMapping = (state) => state.issueTypeFieldValuesAttachmentReducer.instances;
3200
+ const selectIssueTypeFieldValuesAttachments = toolkit.createSelector(
3201
+ [selectIssueTypeFieldValuesAttachmentsMapping],
3202
+ (attachmentsMapping) => {
3203
+ return Object.values(attachmentsMapping);
3204
+ }
3205
+ );
3206
+ const selectAttachmentsOfIssueTypeFieldValues = restructureCreateSelectorWithArgs(
3207
+ toolkit.createSelector(
3208
+ [selectIssueTypeFieldValuesAttachments, (_state, fieldValuesId) => fieldValuesId],
3209
+ (attachments, fieldValuesId) => {
3210
+ return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === fieldValuesId));
3211
+ }
3212
+ )
3213
+ );
3214
+ const selectIssueTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
3215
+ return state.issueTypeFieldValuesAttachmentReducer.instances[attachmentId];
3216
+ };
3217
+ const issueTypeFieldValuesAttachmentReducer = issueTypeFieldValuesAttachmentSlice.reducer;
3218
+ const assetTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
3219
+ const initialState$3 = assetTypeFieldsAdapter.getInitialState({});
3220
+ const assetTypeFieldsSlice = toolkit.createSlice({
3221
+ name: "assetTypeFields",
3222
+ initialState: initialState$3,
3223
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
3224
+ reducers: {
3225
+ initializeAssetTypeFields: assetTypeFieldsAdapter.initialize,
3226
+ addAssetTypeFields: assetTypeFieldsAdapter.addOne,
3227
+ addAssetTypeFieldsMany: assetTypeFieldsAdapter.addMany,
3228
+ setAssetTypeFields: assetTypeFieldsAdapter.setOne,
3229
+ setAssetTypeFieldsMany: assetTypeFieldsAdapter.setMany,
3230
+ updateAssetTypeFields: assetTypeFieldsAdapter.updateOne,
3231
+ updateAssetTypeFieldsMany: assetTypeFieldsAdapter.updateMany,
3232
+ deleteAssetTypeFields: assetTypeFieldsAdapter.deleteOne,
3233
+ deleteAssetTypeFieldsMany: assetTypeFieldsAdapter.deleteMany
3234
+ }
3235
+ });
3236
+ const {
3237
+ initializeAssetTypeFields,
3238
+ addAssetTypeFields,
3239
+ addAssetTypeFieldsMany,
3240
+ setAssetTypeFields,
3241
+ setAssetTypeFieldsMany,
3242
+ updateAssetTypeFields,
3243
+ updateAssetTypeFieldsMany,
3244
+ deleteAssetTypeFields,
3245
+ deleteAssetTypeFieldsMany
3246
+ } = assetTypeFieldsSlice.actions;
3247
+ const selectAssetTypeFieldsMapping = (state) => state.assetTypeFieldsReducer.instances;
3248
+ const selectAssetTypeFields = toolkit.createSelector([selectAssetTypeFieldsMapping], (fieldsMapping) => {
3249
+ return Object.values(fieldsMapping);
3250
+ });
3251
+ const selectAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
3252
+ toolkit.createSelector([selectAssetTypeFields, (_state, assetTypeId) => assetTypeId], (fields, assetTypeId) => {
3253
+ return fallbackToEmptyArray(fields.filter((field) => field.asset_type === assetTypeId));
3254
+ })
3255
+ );
3256
+ const selectAssetTypeFieldsById = (fieldsId) => (state) => {
3257
+ return state.assetTypeFieldsReducer.instances[fieldsId];
3258
+ };
3259
+ const assetTypeFieldsReducer = assetTypeFieldsSlice.reducer;
3260
+ const assetTypeFieldValuesAdapter = createModelAdapter(
3261
+ (fieldValues) => fieldValues.offline_id
3262
+ );
3263
+ const initialState$2 = assetTypeFieldValuesAdapter.getInitialState({});
3264
+ const assetTypeFieldValuesSlice = toolkit.createSlice({
3265
+ name: "assetTypeFieldValues",
3266
+ initialState: initialState$2,
3267
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
3268
+ reducers: {
3269
+ initializeAssetTypeFieldValues: assetTypeFieldValuesAdapter.initialize,
3270
+ addAssetTypeFieldValues: assetTypeFieldValuesAdapter.addOne,
3271
+ addAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.addMany,
3272
+ setAssetTypeFieldValues: assetTypeFieldValuesAdapter.setOne,
3273
+ setAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.setMany,
3274
+ updateAssetTypeFieldValues: assetTypeFieldValuesAdapter.updateOne,
3275
+ updateAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.updateMany,
3276
+ deleteAssetTypeFieldValues: assetTypeFieldValuesAdapter.deleteOne,
3277
+ deleteAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.deleteMany
3278
+ }
3279
+ });
3280
+ const {
3281
+ initializeAssetTypeFieldValues,
3282
+ addAssetTypeFieldValues,
3283
+ addAssetTypeFieldValuesMany,
3284
+ setAssetTypeFieldValues,
3285
+ setAssetTypeFieldValuesMany,
3286
+ updateAssetTypeFieldValues,
3287
+ updateAssetTypeFieldValuesMany,
3288
+ deleteAssetTypeFieldValues,
3289
+ deleteAssetTypeFieldValuesMany
3290
+ } = assetTypeFieldValuesSlice.actions;
3291
+ const selectAssetTypeFieldValuesMapping = (state) => state.assetTypeFieldValuesReducer.instances;
3292
+ const selectAssetTypeFieldValues = toolkit.createSelector([selectAssetTypeFieldValuesMapping], (fieldValuesMapping) => {
3293
+ return Object.values(fieldValuesMapping);
3294
+ });
3295
+ const selectAssetTypeFieldValuesOfAsset = restructureCreateSelectorWithArgs(
3296
+ toolkit.createSelector([selectAssetTypeFieldValues, (_state, assetId) => assetId], (fieldValues, assetId) => {
3297
+ return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.asset === assetId));
3298
+ })
3299
+ );
3300
+ const selectAssetTypeFieldValuesById = (fieldValuesId) => (state) => {
3301
+ return state.assetTypeFieldValuesReducer.instances[fieldValuesId];
3302
+ };
3303
+ const assetTypeFieldValuesReducer = assetTypeFieldValuesSlice.reducer;
3304
+ const assetTypeFieldsAttachmentAdapter = createModelAdapter(
3305
+ (attachment) => attachment.offline_id
3306
+ );
3307
+ const initialState$1 = assetTypeFieldsAttachmentAdapter.getInitialState({});
3308
+ const assetTypeFieldsAttachmentSlice = toolkit.createSlice({
3309
+ name: "assetTypeFieldsAttachments",
3310
+ initialState: initialState$1,
3311
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
3312
+ reducers: {
3313
+ initializeAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.initialize,
3314
+ addAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.addOne,
3315
+ addAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.addMany,
3316
+ setAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.setOne,
3317
+ setAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.setMany,
3318
+ updateAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.updateOne,
3319
+ updateAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.updateMany,
3320
+ deleteAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.deleteOne,
3321
+ deleteAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.deleteMany
3322
+ }
3323
+ });
3324
+ const {
3325
+ initializeAssetTypeFieldsAttachments,
3326
+ addAssetTypeFieldsAttachment,
3327
+ addAssetTypeFieldsAttachments,
3328
+ setAssetTypeFieldsAttachment,
3329
+ setAssetTypeFieldsAttachments,
3330
+ updateAssetTypeFieldsAttachment,
3331
+ updateAssetTypeFieldsAttachments,
3332
+ deleteAssetTypeFieldsAttachment,
3333
+ deleteAssetTypeFieldsAttachments
3334
+ } = assetTypeFieldsAttachmentSlice.actions;
3335
+ const selectAssetTypeFieldsAttachmentsMapping = (state) => state.assetTypeFieldsAttachmentReducer.instances;
3336
+ const selectAssetTypeFieldsAttachments = toolkit.createSelector(
3337
+ [selectAssetTypeFieldsAttachmentsMapping],
3338
+ (attachmentsMapping) => {
3339
+ return Object.values(attachmentsMapping);
3340
+ }
3341
+ );
3342
+ const selectAttachmentsOfAssetTypeFields = restructureCreateSelectorWithArgs(
3343
+ toolkit.createSelector([selectAssetTypeFieldsAttachments, (_state, id) => id], (attachments, id) => {
3344
+ return fallbackToEmptyArray(attachments.filter((attachment) => attachment.fields_revision === id));
3345
+ })
3346
+ );
3347
+ const selectAssetTypeFieldsAttachmentById = (attachmentId) => (state) => {
3348
+ return state.assetTypeFieldsAttachmentReducer.instances[attachmentId];
3349
+ };
3350
+ const assetTypeFieldsAttachmentReducer = assetTypeFieldsAttachmentSlice.reducer;
3351
+ const assetTypeFieldValuesAttachmentAdapter = createModelAdapter(
3352
+ (attachment) => attachment.offline_id
3353
+ );
3354
+ const initialState = assetTypeFieldValuesAttachmentAdapter.getInitialState({});
3355
+ const assetTypeFieldValuesAttachmentSlice = toolkit.createSlice({
3356
+ name: "assetTypeFieldValuesAttachments",
3357
+ initialState,
3358
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
3359
+ reducers: {
3360
+ initializeAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.initialize,
3361
+ addAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.addOne,
3362
+ addAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.addMany,
3363
+ setAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.setOne,
3364
+ setAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.setMany,
3365
+ updateAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.updateOne,
3366
+ updateAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.updateMany,
3367
+ deleteAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.deleteOne,
3368
+ deleteAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.deleteMany
3369
+ }
3370
+ });
3371
+ const {
3372
+ initializeAssetTypeFieldValuesAttachments,
3373
+ addAssetTypeFieldValuesAttachment,
3374
+ addAssetTypeFieldValuesAttachments,
3375
+ setAssetTypeFieldValuesAttachment,
3376
+ setAssetTypeFieldValuesAttachments,
3377
+ updateAssetTypeFieldValuesAttachment,
3378
+ updateAssetTypeFieldValuesAttachments,
3379
+ deleteAssetTypeFieldValuesAttachment,
3380
+ deleteAssetTypeFieldValuesAttachments
3381
+ } = assetTypeFieldValuesAttachmentSlice.actions;
3382
+ const selectAssetTypeFieldValuesAttachmentsMapping = (state) => state.assetTypeFieldValuesAttachmentReducer.instances;
3383
+ const selectAssetTypeFieldValuesAttachments = toolkit.createSelector(
3384
+ [selectAssetTypeFieldValuesAttachmentsMapping],
3385
+ (attachmentsMapping) => {
3386
+ return Object.values(attachmentsMapping);
3387
+ }
3388
+ );
3389
+ const selectAttachmentsOfAssetTypeFieldValues = restructureCreateSelectorWithArgs(
3390
+ toolkit.createSelector([selectAssetTypeFieldValuesAttachments, (_state, id) => id], (attachments, id) => {
3391
+ return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === id));
3392
+ })
3393
+ );
3394
+ const selectAssetTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
3395
+ return state.assetTypeFieldValuesAttachmentReducer.instances[attachmentId];
3396
+ };
3397
+ const assetTypeFieldValuesAttachmentReducer = assetTypeFieldValuesAttachmentSlice.reducer;
3398
+ let clientStore;
3399
+ function setClientStore(store) {
3400
+ clientStore = store;
3401
+ }
3402
+ function getClientStore() {
3403
+ return clientStore;
3404
+ }
3405
+ let clientSDK;
3406
+ function setClientSDK(sdkCtor) {
3407
+ clientSDK = sdkCtor;
3408
+ }
3409
+ function getClientSDK() {
3410
+ return clientSDK;
3411
+ }
3412
+ const CLASS_NAME_TO_SERVICE = {};
3413
+ class BaseService {
3414
+ constructor(sdk) {
3415
+ __publicField(this, "client");
3416
+ CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
3417
+ this.client = sdk;
3418
+ }
3419
+ async enqueueRequest(requestDetails) {
3420
+ return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
3421
+ }
3422
+ dispatch(action) {
3423
+ this.client.store.dispatch(action);
3424
+ }
3425
+ }
3426
+ const VERSION_REDUCER_KEY = "versioning";
3427
+ const overmapReducers = {
3428
+ // TODO: attachmentReducer,
3429
+ [VERSION_REDUCER_KEY]: versioningReducer,
3430
+ fileReducer,
3431
+ authReducer,
3432
+ categoryReducer,
3433
+ assetReducer,
3434
+ assetAttachmentReducer,
3435
+ assetStageCompletionReducer,
3436
+ assetStageReducer,
3437
+ assetTypeReducer,
3438
+ assetTypeAttachmentReducer,
3439
+ issueReducer,
3440
+ issueAttachmentReducer,
3441
+ issueTypeReducer,
3442
+ organizationReducer,
3443
+ outboxReducer,
3444
+ projectReducer,
3445
+ projectAttachmentReducer,
3446
+ projectAccessReducer,
3447
+ organizationAccessReducer,
3448
+ projectFileReducer,
3449
+ rehydratedReducer,
3450
+ formReducer,
3451
+ formRevisionReducer,
3452
+ formRevisionAttachmentReducer,
3453
+ formSubmissionAttachmentReducer,
3454
+ formSubmissionReducer,
3455
+ userReducer,
3456
+ workspaceReducer,
3457
+ emailDomainsReducer,
3458
+ licenseReducer,
3459
+ documentsReducer,
3460
+ documentAttachmentReducer,
3461
+ teamReducer,
3462
+ agentsReducer,
3463
+ issueCommentReducer,
3464
+ issueUpdateReducer,
3465
+ geoImageReducer,
3466
+ issueAssociationReducer,
3467
+ issueTypeFieldsReducer,
3468
+ issueTypeFieldValuesReducer,
3469
+ issueTypeFieldsAttachmentReducer,
3470
+ issueTypeFieldValuesAttachmentReducer,
3471
+ assetTypeFieldsReducer,
3472
+ assetTypeFieldValuesReducer,
3473
+ assetTypeFieldsAttachmentReducer,
3474
+ assetTypeFieldValuesAttachmentReducer
3475
+ };
3476
+ const overmapReducer = toolkit.combineReducers(overmapReducers);
3477
+ const resetStore = "RESET";
3478
+ const overmapRootReducer = (state, action) => {
3479
+ if (action.type === "auth/setLoggedIn" && !action.payload) {
3480
+ return overmapReducer(void 0, action);
3481
+ }
3482
+ return overmapReducer(state, action);
3483
+ };
3484
+ let __OUTBOX_COORDINATOR = null;
3485
+ function getOutboxCoordinator() {
3219
3486
  const clientStore2 = getClientStore();
3220
3487
  if (!clientStore2) {
3221
3488
  console.warn("Client store not set; cannot get outbox coordinator yet.");
@@ -3846,9 +4113,6 @@ var __publicField = (obj, key, value) => {
3846
4113
  description: "Create Category",
3847
4114
  method: HttpMethod.POST,
3848
4115
  url: "/categories/",
3849
- queryParams: {
3850
- workspace_id: payload.workspace.toString()
3851
- },
3852
4116
  payload: offlineCategory,
3853
4117
  blockers: [payload.workspace],
3854
4118
  blocks: [offlineCategory.offline_id]
@@ -4061,7 +4325,10 @@ var __publicField = (obj, key, value) => {
4061
4325
  const result = await this.enqueueRequest({
4062
4326
  description: "Get assets",
4063
4327
  method: HttpMethod.GET,
4064
- url: `/projects/${projectId}/assets/`,
4328
+ url: "/assets/",
4329
+ queryParams: {
4330
+ project: projectId.toString()
4331
+ },
4065
4332
  blockers: [],
4066
4333
  blocks: []
4067
4334
  });
@@ -4082,7 +4349,7 @@ var __publicField = (obj, key, value) => {
4082
4349
  const promise = this.enqueueRequest({
4083
4350
  description: "Add asset stage completion",
4084
4351
  method: HttpMethod.POST,
4085
- url: "/assets/completions/",
4352
+ url: "/asset-stage-completions/",
4086
4353
  payload: {
4087
4354
  offline_id: offlineStageCompletion.offline_id,
4088
4355
  submitted_at: submittedAt,
@@ -4109,7 +4376,7 @@ var __publicField = (obj, key, value) => {
4109
4376
  const promise = this.enqueueRequest({
4110
4377
  description: "Delete asset stage completion",
4111
4378
  method: HttpMethod.DELETE,
4112
- url: `/assets/completions/${id}/`,
4379
+ url: `/asset-stage-completions/${id}/`,
4113
4380
  blockers: [id],
4114
4381
  blocks: []
4115
4382
  });
@@ -4135,7 +4402,7 @@ var __publicField = (obj, key, value) => {
4135
4402
  const promise = this.enqueueRequest({
4136
4403
  description: "Bulk create asset stage completions",
4137
4404
  method: HttpMethod.POST,
4138
- url: "/assets/completions/bulk/",
4405
+ url: "/asset-stage-completions/bulk/",
4139
4406
  payload: {
4140
4407
  submitted_at: submittedAt,
4141
4408
  completions: payload
@@ -4157,7 +4424,7 @@ var __publicField = (obj, key, value) => {
4157
4424
  const promise = this.enqueueRequest({
4158
4425
  description: "Deleting asset stage completions",
4159
4426
  method: HttpMethod.DELETE,
4160
- url: "/assets/completions/bulk/",
4427
+ url: "/asset-stage-completions/bulk/",
4161
4428
  payload: {
4162
4429
  completion_ids: ids
4163
4430
  },
@@ -4173,7 +4440,10 @@ var __publicField = (obj, key, value) => {
4173
4440
  const result = await this.enqueueRequest({
4174
4441
  description: "Get asset stage completions",
4175
4442
  method: HttpMethod.GET,
4176
- url: `/projects/${projectId}/asset-stage-completions/`,
4443
+ url: "/asset-stage-completions/",
4444
+ queryParams: {
4445
+ project: projectId.toString()
4446
+ },
4177
4447
  blockers: [],
4178
4448
  blocks: []
4179
4449
  });
@@ -4194,7 +4464,7 @@ var __publicField = (obj, key, value) => {
4194
4464
  const promise = this.enqueueRequest({
4195
4465
  description: "Add asset stages",
4196
4466
  method: HttpMethod.POST,
4197
- url: "/assets/stages/bulk/",
4467
+ url: "/asset-stages/bulk/",
4198
4468
  payload: {
4199
4469
  submitted_at: submittedAt,
4200
4470
  asset_type: assetTypeId,
@@ -4218,7 +4488,7 @@ var __publicField = (obj, key, value) => {
4218
4488
  return this.enqueueRequest({
4219
4489
  description: "Edit asset stages",
4220
4490
  method: HttpMethod.PATCH,
4221
- url: `/assets/types/${assetTypeId}/bulk-update-stages/`,
4491
+ url: `/asset-types/${assetTypeId}/bulk-update-stages/`,
4222
4492
  payload: {
4223
4493
  stages: stagesToUpdate
4224
4494
  },
@@ -4236,7 +4506,7 @@ var __publicField = (obj, key, value) => {
4236
4506
  const promise = this.enqueueRequest({
4237
4507
  description: "Delete asset stages",
4238
4508
  method: HttpMethod.DELETE,
4239
- url: "/assets/stages/bulk/",
4509
+ url: "/asset-stages/bulk/",
4240
4510
  payload: {
4241
4511
  stage_ids: idsToDelete
4242
4512
  },
@@ -4261,7 +4531,7 @@ var __publicField = (obj, key, value) => {
4261
4531
  const promise = this.enqueueRequest({
4262
4532
  description: "Update asset stage",
4263
4533
  method: HttpMethod.PATCH,
4264
- url: `/assets/stages/${assetStage.offline_id}/`,
4534
+ url: `/asset-stages/${assetStage.offline_id}/`,
4265
4535
  payload: {
4266
4536
  name: payload.name,
4267
4537
  description: payload.description,
@@ -4289,7 +4559,7 @@ var __publicField = (obj, key, value) => {
4289
4559
  await this.enqueueRequest({
4290
4560
  description: "Link asset stage to form",
4291
4561
  method: HttpMethod.POST,
4292
- url: `/assets/stages/${stageId}/associate-with-form/`,
4562
+ url: `/asset-stages/${stageId}/associate-with-form/`,
4293
4563
  payload: { form: formId },
4294
4564
  blockers: [stageId, formId],
4295
4565
  blocks: [stageId]
@@ -4310,7 +4580,7 @@ var __publicField = (obj, key, value) => {
4310
4580
  await this.enqueueRequest({
4311
4581
  description: "Unlink asset stage from form",
4312
4582
  method: HttpMethod.DELETE,
4313
- url: `/assets/stages/${stageId}/associate-with-form/`,
4583
+ url: `/asset-stages/${stageId}/associate-with-form/`,
4314
4584
  blockers: [stageId, formId],
4315
4585
  blocks: [stageId]
4316
4586
  });
@@ -4323,7 +4593,10 @@ var __publicField = (obj, key, value) => {
4323
4593
  const result = await this.enqueueRequest({
4324
4594
  description: "Get asset stages",
4325
4595
  method: HttpMethod.GET,
4326
- url: `/projects/${projectId}/asset-stages/`,
4596
+ url: "/asset-stages/",
4597
+ queryParams: {
4598
+ project: projectId.toString()
4599
+ },
4327
4600
  blockers: [],
4328
4601
  blocks: []
4329
4602
  });
@@ -4340,7 +4613,12 @@ var __publicField = (obj, key, value) => {
4340
4613
  projectAttachmentReducer: projectAttachmentReducer2,
4341
4614
  formRevisionAttachmentReducer: formRevisionAttachmentReducer2,
4342
4615
  formSubmissionAttachmentReducer: formSubmissionAttachmentReducer2,
4343
- geoImageReducer: geoImageReducer2
4616
+ geoImageReducer: geoImageReducer2,
4617
+ // fields
4618
+ assetTypeFieldsAttachmentReducer: assetTypeFieldsAttachmentReducer2,
4619
+ assetTypeFieldValuesAttachmentReducer: assetTypeFieldValuesAttachmentReducer2,
4620
+ issueTypeFieldsAttachmentReducer: issueTypeFieldsAttachmentReducer2,
4621
+ issueTypeFieldValuesAttachmentReducer: issueTypeFieldValuesAttachmentReducer2
4344
4622
  } = this.client.store.getState();
4345
4623
  const objectsWithSha1 = [].concat(
4346
4624
  Object.values(issueAttachmentReducer2.instances),
@@ -4350,7 +4628,11 @@ var __publicField = (obj, key, value) => {
4350
4628
  Object.values(projectAttachmentReducer2.instances),
4351
4629
  Object.values(formRevisionAttachmentReducer2.instances),
4352
4630
  Object.values(formSubmissionAttachmentReducer2.instances),
4353
- Object.values(geoImageReducer2.instances)
4631
+ Object.values(geoImageReducer2.instances),
4632
+ Object.values(assetTypeFieldsAttachmentReducer2.instances),
4633
+ Object.values(assetTypeFieldValuesAttachmentReducer2.instances),
4634
+ Object.values(issueTypeFieldsAttachmentReducer2.instances),
4635
+ Object.values(issueTypeFieldValuesAttachmentReducer2.instances)
4354
4636
  );
4355
4637
  return objectsWithSha1.filter((object) => object.file_sha1 === sha1).length;
4356
4638
  }
@@ -4372,41 +4654,20 @@ var __publicField = (obj, key, value) => {
4372
4654
  }
4373
4655
  return promisesBySha1;
4374
4656
  }
4375
- }
4376
- const AttachmentModelMeta = {
4377
- [AttachmentModel.Issue]: {
4378
- name: "issue",
4379
- attachUrlPrefix: "/issues",
4380
- deleteUrlPrefix: "/issues",
4381
- fetchUrlPostfix: "/issue-attachments"
4382
- },
4383
- [AttachmentModel.Asset]: {
4384
- name: "asset",
4385
- attachUrlPrefix: "/assets",
4386
- deleteUrlPrefix: "/assets",
4387
- fetchUrlPostfix: "/asset-attachments"
4388
- },
4389
- [AttachmentModel.AssetType]: {
4390
- name: "asset type",
4391
- attachUrlPrefix: "/assets/types",
4392
- deleteUrlPrefix: "/assets/types",
4393
- fetchUrlPostfix: "/asset-type-attachments"
4394
- },
4395
- [AttachmentModel.Project]: {
4396
- name: "project",
4397
- attachUrlPrefix: "/projects",
4398
- deleteUrlPrefix: "/projects",
4399
- fetchUrlPostfix: "/attachments"
4400
- },
4401
- [AttachmentModel.Document]: {
4402
- name: "document",
4403
- attachUrlPrefix: "/documents",
4404
- deleteUrlPrefix: "/documents",
4405
- fetchUrlPostfix: "/document-attachments"
4657
+ async getFilePayload(file) {
4658
+ const sha1 = await hashFile(file);
4659
+ const filePayload = {
4660
+ sha1,
4661
+ file_type: file.type,
4662
+ extension: file.name.split(".").pop(),
4663
+ size: file.size
4664
+ };
4665
+ await this.client.files.addCache(file, sha1);
4666
+ return filePayload;
4406
4667
  }
4407
- };
4668
+ }
4408
4669
  class BaseAttachmentService extends BaseUploadService {
4409
- async attachFiles(files, modelId, buildOfflineAttachment) {
4670
+ async _bulkAdd(payloads) {
4410
4671
  var _a2;
4411
4672
  const { store } = this.client;
4412
4673
  const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
@@ -4414,39 +4675,36 @@ var __publicField = (obj, key, value) => {
4414
4675
  const offlineAttachments = [];
4415
4676
  const attachmentPayloads = [];
4416
4677
  const filePayloads = {};
4417
- for (const file of files) {
4418
- const sha1 = await hashFile(file);
4419
- if (!(sha1 in filePayloads)) {
4420
- filePayloads[sha1] = {
4421
- sha1,
4422
- file_type: file.type,
4423
- extension: file.name.split(".").pop(),
4424
- size: file.size
4425
- };
4426
- await this.client.files.addCache(file, sha1);
4427
- }
4428
- const offlineAttachment = buildOfflineAttachment({
4678
+ for (const payload of payloads) {
4679
+ const { modelId, file } = payload;
4680
+ const filePayload = await this.getFilePayload(file);
4681
+ if (!(filePayload.sha1 in filePayloads))
4682
+ filePayloads[filePayload.sha1] = filePayload;
4683
+ const offlineAttachment = this.buildOfflineAttachment({
4429
4684
  file,
4430
- sha1,
4431
- submittedAt,
4432
- createdBy,
4685
+ file_sha1: filePayload.sha1,
4686
+ submitted_at: submittedAt,
4687
+ created_by: createdBy,
4433
4688
  description: "",
4434
4689
  modelId
4435
4690
  });
4436
4691
  offlineAttachments.push(offlineAttachment);
4437
- attachmentPayloads.push({
4438
- offline_id: offlineAttachment.offline_id,
4439
- name: offlineAttachment.file_name,
4440
- sha1: offlineAttachment.file_sha1,
4441
- description: offlineAttachment.description
4442
- });
4692
+ attachmentPayloads.push(
4693
+ this.buildAttachmentPayload({
4694
+ offline_id: offlineAttachment.offline_id,
4695
+ file_name: offlineAttachment.file_name,
4696
+ file_sha1: offlineAttachment.file_sha1,
4697
+ file_extension: filePayload.extension,
4698
+ description: offlineAttachment.description,
4699
+ modelId
4700
+ })
4701
+ );
4443
4702
  }
4444
4703
  this.dispatch(this.addAttachments(offlineAttachments));
4445
- const meta = AttachmentModelMeta[this.attachmentModel];
4446
4704
  const promise = this.enqueueRequest({
4447
- description: `Attach files to ${meta.name}`,
4705
+ description: `Add ${this.name}`,
4448
4706
  method: HttpMethod.POST,
4449
- url: `${meta.attachUrlPrefix}/${modelId}/attach/`,
4707
+ url: `${this.url}/bulk/`,
4450
4708
  payload: {
4451
4709
  submitted_at: submittedAt,
4452
4710
  attachments: attachmentPayloads,
@@ -4463,7 +4721,7 @@ var __publicField = (obj, key, value) => {
4463
4721
  });
4464
4722
  return [offlineAttachments, promise.then(({ attachments }) => attachments)];
4465
4723
  }
4466
- async deleteAttachment(attachmendId) {
4724
+ async _delete(attachmendId) {
4467
4725
  const { store } = this.client;
4468
4726
  const attachment = this.selectAttachment(attachmendId)(store.getState());
4469
4727
  if (!attachment) {
@@ -4472,11 +4730,10 @@ var __publicField = (obj, key, value) => {
4472
4730
  );
4473
4731
  }
4474
4732
  this.dispatch(this.removeAttachment(attachment.offline_id));
4475
- const meta = AttachmentModelMeta[this.attachmentModel];
4476
4733
  const promise = this.enqueueRequest({
4477
- description: "Delete attachment",
4734
+ description: `Delete ${this.name}`,
4478
4735
  method: HttpMethod.DELETE,
4479
- url: `${meta.deleteUrlPrefix}/attachments/${attachmendId}/`,
4736
+ url: `${this.url}/${attachmendId}/`,
4480
4737
  blockers: [attachmendId],
4481
4738
  blocks: []
4482
4739
  });
@@ -4489,24 +4746,12 @@ var __publicField = (obj, key, value) => {
4489
4746
  });
4490
4747
  return promise;
4491
4748
  }
4492
- // Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
4493
- // so for some attachment model services, this method will have to be overridden.
4494
- async refreshStore(projectId, _organizationId) {
4495
- const meta = AttachmentModelMeta[this.attachmentModel];
4496
- const result = await this.enqueueRequest({
4497
- description: `Get ${meta.name} attachments`,
4498
- method: HttpMethod.GET,
4499
- url: `/projects/${projectId}${meta.fetchUrlPostfix}/`,
4500
- blocks: [],
4501
- blockers: []
4502
- });
4503
- this.dispatch(this.initializeAttachments(result));
4504
- }
4505
4749
  }
4506
4750
  class AssetAttachmentService extends BaseAttachmentService {
4507
4751
  constructor() {
4508
4752
  super(...arguments);
4509
- __publicField(this, "attachmentModel", AttachmentModel.Asset);
4753
+ __publicField(this, "name", "Asset Attachment");
4754
+ __publicField(this, "url", "/asset-attachments");
4510
4755
  __publicField(this, "initializeAttachments", initializeAssetAttachments);
4511
4756
  __publicField(this, "addAttachments", addAssetAttachments);
4512
4757
  __publicField(this, "updateAttachments", updateAssetAttachments);
@@ -4518,20 +4763,39 @@ var __publicField = (obj, key, value) => {
4518
4763
  buildOfflineAttachment(data) {
4519
4764
  return offline({
4520
4765
  file: URL.createObjectURL(data.file),
4521
- file_sha1: data.sha1,
4522
- created_by: data.createdBy,
4766
+ file_sha1: data.file_sha1,
4767
+ created_by: data.created_by,
4523
4768
  file_name: data.file.name,
4524
4769
  file_type: data.file.type,
4525
- submitted_at: data.submittedAt,
4770
+ submitted_at: data.submitted_at,
4526
4771
  description: data.description,
4527
4772
  asset: data.modelId
4528
4773
  });
4529
4774
  }
4530
- async attachFilesToAsset(files, assetId) {
4531
- return this.attachFiles(files, assetId, this.buildOfflineAttachment.bind(this));
4775
+ buildAttachmentPayload(data) {
4776
+ return {
4777
+ ...data,
4778
+ asset: data.modelId
4779
+ };
4780
+ }
4781
+ async bulkAdd(payloads) {
4782
+ return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetId, file: p.file })));
4783
+ }
4784
+ async delete(id) {
4785
+ return this._delete(id);
4532
4786
  }
4533
- async deleteAssetAttachment(attachmentId) {
4534
- return this.deleteAttachment(attachmentId);
4787
+ async refreshStore(projectId) {
4788
+ const result = await this.enqueueRequest({
4789
+ description: "Get asset attachments",
4790
+ method: HttpMethod.GET,
4791
+ url: `${this.url}/`,
4792
+ queryParams: {
4793
+ project: projectId.toString()
4794
+ },
4795
+ blocks: [],
4796
+ blockers: []
4797
+ });
4798
+ this.dispatch(initializeAssetAttachments(result));
4535
4799
  }
4536
4800
  }
4537
4801
  class AssetTypeService extends BaseApiService {
@@ -4548,7 +4812,7 @@ var __publicField = (obj, key, value) => {
4548
4812
  const promise = this.enqueueRequest({
4549
4813
  description: "Create asset type",
4550
4814
  method: HttpMethod.POST,
4551
- url: `/projects/${payload.project}/asset-types/`,
4815
+ url: "/asset-types/",
4552
4816
  payload: { ...offlineAssetType },
4553
4817
  blockers: [],
4554
4818
  blocks: [offlineAssetType.offline_id]
@@ -4574,7 +4838,7 @@ var __publicField = (obj, key, value) => {
4574
4838
  const promise = this.enqueueRequest({
4575
4839
  description: "Update asset type",
4576
4840
  method: HttpMethod.PATCH,
4577
- url: `/assets/types/${payload.offline_id}/`,
4841
+ url: `/asset-types/${payload.offline_id}/`,
4578
4842
  payload: {
4579
4843
  icon: payload.icon,
4580
4844
  color: payload.color,
@@ -4608,7 +4872,7 @@ var __publicField = (obj, key, value) => {
4608
4872
  return this.enqueueRequest({
4609
4873
  description: "Delete asset type",
4610
4874
  method: HttpMethod.DELETE,
4611
- url: `/assets/types/${assetTypeId}/`,
4875
+ url: `/asset-types/${assetTypeId}/`,
4612
4876
  blockers: [assetTypeId],
4613
4877
  blocks: []
4614
4878
  }).catch((e) => {
@@ -4623,7 +4887,10 @@ var __publicField = (obj, key, value) => {
4623
4887
  const result = await this.enqueueRequest({
4624
4888
  description: "Get asset types",
4625
4889
  method: HttpMethod.GET,
4626
- url: `/projects/${projectId}/asset-types/`,
4890
+ url: "/asset-types/",
4891
+ queryParams: {
4892
+ project: projectId.toString()
4893
+ },
4627
4894
  blockers: [],
4628
4895
  blocks: []
4629
4896
  });
@@ -4633,8 +4900,8 @@ var __publicField = (obj, key, value) => {
4633
4900
  class AssetTypeAttachmentService extends BaseAttachmentService {
4634
4901
  constructor() {
4635
4902
  super(...arguments);
4636
- __publicField(this, "attachmentModel", AttachmentModel.AssetType);
4637
- __publicField(this, "initializeAttachments", initializeAssetTypeAttachments);
4903
+ __publicField(this, "name", "Asset Type Attachment");
4904
+ __publicField(this, "url", "/asset-type-attachments");
4638
4905
  __publicField(this, "addAttachments", addAssetTypeAttachments);
4639
4906
  __publicField(this, "updateAttachments", updateAssetTypeAttachments);
4640
4907
  __publicField(this, "removeAttachments", deleteAssetTypeAttachments);
@@ -4645,20 +4912,39 @@ var __publicField = (obj, key, value) => {
4645
4912
  buildOfflineAttachment(data) {
4646
4913
  return offline({
4647
4914
  file: URL.createObjectURL(data.file),
4648
- file_sha1: data.sha1,
4649
- created_by: data.createdBy,
4915
+ file_sha1: data.file_sha1,
4916
+ created_by: data.created_by,
4650
4917
  file_name: data.file.name,
4651
4918
  file_type: data.file.type,
4652
- submitted_at: data.submittedAt,
4919
+ submitted_at: data.submitted_at,
4653
4920
  description: data.description,
4654
4921
  asset_type: data.modelId
4655
4922
  });
4656
4923
  }
4657
- async attachFilesToAssetType(files, assetTypeId) {
4658
- return this.attachFiles(files, assetTypeId, this.buildOfflineAttachment.bind(this));
4924
+ buildAttachmentPayload(data) {
4925
+ return {
4926
+ ...data,
4927
+ asset_type: data.modelId
4928
+ };
4929
+ }
4930
+ async bulkAdd(payloads) {
4931
+ return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetTypeId, file: p.file })));
4932
+ }
4933
+ async delete(attachmentId) {
4934
+ return this._delete(attachmentId);
4659
4935
  }
4660
- async deleteAssetTypeAttachment(attachmentId) {
4661
- return this.deleteAttachment(attachmentId);
4936
+ async refreshStore(projectId) {
4937
+ const result = await this.enqueueRequest({
4938
+ description: "Get asset type attachments",
4939
+ method: HttpMethod.GET,
4940
+ url: `${this.url}/`,
4941
+ queryParams: {
4942
+ project: projectId.toString()
4943
+ },
4944
+ blocks: [],
4945
+ blockers: []
4946
+ });
4947
+ this.dispatch(initializeAssetTypeAttachments(result));
4662
4948
  }
4663
4949
  }
4664
4950
  class IssueCommentService extends BaseApiService {
@@ -4674,7 +4960,7 @@ var __publicField = (obj, key, value) => {
4674
4960
  const promise = this.enqueueRequest({
4675
4961
  description: "Add issue comment",
4676
4962
  method: HttpMethod.POST,
4677
- url: `/issues/${payload.issue}/comment/`,
4963
+ url: "/issue-comments/",
4678
4964
  payload: offlineComment,
4679
4965
  blockers: [payload.issue],
4680
4966
  blocks: [offlineComment.offline_id]
@@ -4698,7 +4984,7 @@ var __publicField = (obj, key, value) => {
4698
4984
  const promise = this.enqueueRequest({
4699
4985
  description: "Edit issue comment",
4700
4986
  method: HttpMethod.PATCH,
4701
- url: `/issues/comments/${payload.offline_id}/`,
4987
+ url: `/issue-comments/${payload.offline_id}/`,
4702
4988
  payload,
4703
4989
  blockers: [payload.offline_id],
4704
4990
  blocks: [payload.offline_id]
@@ -4717,7 +5003,7 @@ var __publicField = (obj, key, value) => {
4717
5003
  const promise = this.enqueueRequest({
4718
5004
  description: "Delete comment",
4719
5005
  method: HttpMethod.DELETE,
4720
- url: `/issues/comments/${id}/`,
5006
+ url: `/issue-comments/${id}/`,
4721
5007
  blockers: [id],
4722
5008
  blocks: []
4723
5009
  });
@@ -4730,7 +5016,10 @@ var __publicField = (obj, key, value) => {
4730
5016
  const result = await this.enqueueRequest({
4731
5017
  description: "Get comments",
4732
5018
  method: HttpMethod.GET,
4733
- url: `/projects/${projectId}/comments/`,
5019
+ url: "/issue-comments/",
5020
+ queryParams: {
5021
+ project: projectId.toString()
5022
+ },
4734
5023
  blockers: [],
4735
5024
  blocks: []
4736
5025
  });
@@ -4742,27 +5031,21 @@ var __publicField = (obj, key, value) => {
4742
5031
  const result = await this.enqueueRequest({
4743
5032
  description: "Get issue updates",
4744
5033
  method: HttpMethod.GET,
4745
- url: `/projects/${projectId}/issues/updates/`,
5034
+ url: "/issue-updates/",
5035
+ queryParams: {
5036
+ project: projectId.toString()
5037
+ },
4746
5038
  blockers: [],
4747
5039
  blocks: []
4748
5040
  });
4749
- let filteredResult = result.filter(onlyUniqueOfflineIds);
4750
- filteredResult = filteredResult.map((comment) => {
4751
- return { ...comment };
4752
- });
4753
- if (result.length !== filteredResult.length) {
4754
- console.error(
4755
- `Received duplicate comments from the API (new length ${filteredResult.length}); filtered in browser.`
4756
- );
4757
- }
4758
- this.dispatch(initializeIssueUpdates(filteredResult));
5041
+ this.dispatch(initializeIssueUpdates(result));
4759
5042
  }
4760
5043
  }
4761
5044
  class IssueAttachmentService extends BaseAttachmentService {
4762
5045
  constructor() {
4763
5046
  super(...arguments);
4764
- __publicField(this, "attachmentModel", AttachmentModel.Issue);
4765
- __publicField(this, "initializeAttachments", initializeIssueAttachments);
5047
+ __publicField(this, "name", "Issue Attachment");
5048
+ __publicField(this, "url", "/issue-attachments");
4766
5049
  __publicField(this, "addAttachments", addIssueAttachments);
4767
5050
  __publicField(this, "updateAttachments", updateIssueAttachments);
4768
5051
  __publicField(this, "removeAttachments", deleteIssueAttachments);
@@ -4773,24 +5056,42 @@ var __publicField = (obj, key, value) => {
4773
5056
  buildOfflineAttachment(data) {
4774
5057
  return offline({
4775
5058
  file: URL.createObjectURL(data.file),
4776
- file_sha1: data.sha1,
4777
- created_by: data.createdBy,
5059
+ file_sha1: data.file_sha1,
5060
+ created_by: data.created_by,
4778
5061
  file_name: data.file.name,
4779
5062
  file_type: data.file.type,
4780
- submitted_at: data.submittedAt,
5063
+ submitted_at: data.submitted_at,
4781
5064
  description: data.description,
4782
5065
  issue: data.modelId
4783
5066
  });
4784
5067
  }
4785
- async attachFilesToIssue(files, issueId) {
4786
- return this.attachFiles(files, issueId, this.buildOfflineAttachment.bind(this));
5068
+ buildAttachmentPayload(data) {
5069
+ return {
5070
+ ...data,
5071
+ issue: data.modelId
5072
+ };
5073
+ }
5074
+ async bulkAdd(payloads) {
5075
+ return this._bulkAdd(payloads.map((p) => ({ modelId: p.issueId, file: p.file })));
5076
+ }
5077
+ async delete(id) {
5078
+ return this._delete(id);
4787
5079
  }
4788
- async deleteIssueAttachment(attachmentId) {
4789
- return this.deleteAttachment(attachmentId);
5080
+ async refreshStore(projectId) {
5081
+ const result = await this.enqueueRequest({
5082
+ description: "Get issue attachments",
5083
+ method: HttpMethod.GET,
5084
+ url: `${this.url}/`,
5085
+ queryParams: {
5086
+ project: projectId.toString()
5087
+ },
5088
+ blocks: [],
5089
+ blockers: []
5090
+ });
5091
+ this.dispatch(initializeIssueAttachments(result));
4790
5092
  }
4791
5093
  }
4792
5094
  class IssueService extends BaseApiService {
4793
- // Basic CRUD functions
4794
5095
  add(payload) {
4795
5096
  var _a2;
4796
5097
  const { store } = this.client;
@@ -4808,10 +5109,6 @@ var __publicField = (obj, key, value) => {
4808
5109
  description: "Create issue",
4809
5110
  method: HttpMethod.POST,
4810
5111
  url: "/issues/",
4811
- queryParams: {
4812
- workspace_id: payload.index_workspace,
4813
- ...payload.issue_type ? { issue_type: payload.issue_type } : {}
4814
- },
4815
5112
  payload: offlineIssue,
4816
5113
  blockers: ["add-issue", ...offlineIssue.index_workspace ? [offlineIssue.index_workspace] : []],
4817
5114
  blocks: [offlineIssue.offline_id]
@@ -4967,7 +5264,10 @@ var __publicField = (obj, key, value) => {
4967
5264
  const result = await this.enqueueRequest({
4968
5265
  description: "Get issues",
4969
5266
  method: HttpMethod.GET,
4970
- url: `/projects/${projectId}/issues/`,
5267
+ url: "/issues/",
5268
+ queryParams: {
5269
+ project: projectId.toString()
5270
+ },
4971
5271
  blockers: [],
4972
5272
  blocks: []
4973
5273
  });
@@ -4987,7 +5287,7 @@ var __publicField = (obj, key, value) => {
4987
5287
  this.dispatch(addIssueType(offlineIssueType));
4988
5288
  const promise = this.enqueueRequest({
4989
5289
  method: HttpMethod.POST,
4990
- url: `/organizations/${payload.organization}/issue-types/`,
5290
+ url: "/issue-types/",
4991
5291
  // Sending only whats needed here
4992
5292
  payload: {
4993
5293
  offline_id: offlineIssueType.offline_id,
@@ -5021,7 +5321,7 @@ var __publicField = (obj, key, value) => {
5021
5321
  this.dispatch(updateIssueType(offlineUpdatedIssueType));
5022
5322
  const promise = this.enqueueRequest({
5023
5323
  method: HttpMethod.PATCH,
5024
- url: `/issues/types/${payload.offline_id}/`,
5324
+ url: `/issue-types/${payload.offline_id}/`,
5025
5325
  payload,
5026
5326
  blockers: [payload.offline_id],
5027
5327
  blocks: [payload.offline_id]
@@ -5045,7 +5345,7 @@ var __publicField = (obj, key, value) => {
5045
5345
  this.dispatch(deleteIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
5046
5346
  const promise = this.enqueueRequest({
5047
5347
  method: HttpMethod.DELETE,
5048
- url: `/issues/types/${id}/`,
5348
+ url: `/issue-types/${id}/`,
5049
5349
  blockers: [id],
5050
5350
  blocks: []
5051
5351
  });
@@ -5058,7 +5358,10 @@ var __publicField = (obj, key, value) => {
5058
5358
  async refreshStore(organizationId) {
5059
5359
  const result = await this.enqueueRequest({
5060
5360
  method: HttpMethod.GET,
5061
- url: `/organizations/${organizationId}/issue-types/`,
5361
+ url: "/issue-types/",
5362
+ queryParams: {
5363
+ organization: organizationId.toString()
5364
+ },
5062
5365
  blockers: [],
5063
5366
  blocks: []
5064
5367
  });
@@ -5202,8 +5505,8 @@ var __publicField = (obj, key, value) => {
5202
5505
  class ProjectAttachmentService extends BaseAttachmentService {
5203
5506
  constructor() {
5204
5507
  super(...arguments);
5205
- __publicField(this, "attachmentModel", AttachmentModel.Project);
5206
- __publicField(this, "initializeAttachments", initializeProjectAttachments);
5508
+ __publicField(this, "name", "Project Attachment");
5509
+ __publicField(this, "url", "/project-attachments");
5207
5510
  __publicField(this, "addAttachments", addProjectAttachments);
5208
5511
  __publicField(this, "updateAttachments", updateProjectAttachments);
5209
5512
  __publicField(this, "removeAttachments", deleteProjectAttachments);
@@ -5214,20 +5517,39 @@ var __publicField = (obj, key, value) => {
5214
5517
  buildOfflineAttachment(data) {
5215
5518
  return offline({
5216
5519
  file: URL.createObjectURL(data.file),
5217
- file_sha1: data.sha1,
5218
- created_by: data.createdBy,
5520
+ file_sha1: data.file_sha1,
5521
+ created_by: data.created_by,
5219
5522
  file_name: data.file.name,
5220
5523
  file_type: data.file.type,
5221
- submitted_at: data.submittedAt,
5524
+ submitted_at: data.submitted_at,
5222
5525
  description: data.description,
5223
5526
  project: data.modelId
5224
5527
  });
5225
5528
  }
5226
- async attachFilesToProject(files, projectId) {
5227
- return this.attachFiles(files, projectId, this.buildOfflineAttachment.bind(this));
5529
+ buildAttachmentPayload(data) {
5530
+ return {
5531
+ ...data,
5532
+ project: data.modelId
5533
+ };
5228
5534
  }
5229
- async deleteProjectAttachment(attachmentId) {
5230
- return this.deleteAttachment(attachmentId);
5535
+ async bulkAdd(payloads) {
5536
+ return this._bulkAdd(payloads.map((p) => ({ modelId: p.projectId, file: p.file })));
5537
+ }
5538
+ async delete(attachmentId) {
5539
+ return this._delete(attachmentId);
5540
+ }
5541
+ async refreshStore(projectId) {
5542
+ const result = await this.enqueueRequest({
5543
+ description: "Get project attachments",
5544
+ method: HttpMethod.GET,
5545
+ url: `${this.url}/`,
5546
+ queryParams: {
5547
+ project: projectId.toString()
5548
+ },
5549
+ blockers: [],
5550
+ blocks: []
5551
+ });
5552
+ this.dispatch(initializeProjectAttachments(result));
5231
5553
  }
5232
5554
  }
5233
5555
  class ProjectService extends BaseApiService {
@@ -5370,88 +5692,33 @@ var __publicField = (obj, key, value) => {
5370
5692
  return { fields: newFields, images };
5371
5693
  };
5372
5694
  class FormService extends BaseUploadService {
5373
- async bulkAddRevisionAttachments(revisionId, files) {
5695
+ add(payload, initialRevision) {
5374
5696
  var _a2;
5697
+ const { store } = this.client;
5375
5698
  const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
5376
- const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
5377
- const filePayloads = {};
5378
- const offlineFormRevisionAttachments = [];
5379
- const attachmentPayloads = [];
5380
- for (const [fieldIdentifier, file] of Object.entries(files)) {
5381
- const sha1 = await hashFile(file);
5382
- if (!(sha1 in filePayloads)) {
5383
- filePayloads[sha1] = {
5384
- sha1,
5385
- file_type: file.type,
5386
- extension: file.name.split(".").pop(),
5387
- size: file.size
5388
- };
5389
- await this.client.files.addCache(file, sha1);
5390
- }
5391
- const offlineFormRevisionAttachment = offline({
5392
- file: URL.createObjectURL(file),
5393
- file_type: file.type,
5394
- file_name: file.name,
5395
- file_sha1: sha1,
5396
- created_by: createdBy,
5397
- revision: revisionId,
5398
- submitted_at: submittedAt,
5399
- field_identifier: fieldIdentifier
5400
- });
5401
- offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
5402
- const attachmentPayload = {
5403
- offline_id: offlineFormRevisionAttachment.offline_id,
5404
- name: file.name,
5405
- field_identifier: fieldIdentifier,
5406
- sha1
5407
- };
5408
- attachmentPayloads.push(attachmentPayload);
5409
- }
5410
- this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
5411
- const promise = this.enqueueRequest({
5412
- description: "Attach files to form revision",
5413
- method: HttpMethod.POST,
5414
- url: `/forms/revisions/${revisionId}/attachments/bulk/`,
5415
- payload: {
5416
- submitted_at: submittedAt,
5417
- attachments: attachmentPayloads,
5418
- files: Object.values(filePayloads)
5419
- },
5420
- blockers: [revisionId],
5421
- blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
5422
- });
5423
- promise.then((result) => {
5424
- this.processPresignedUrls(result.presigned_urls);
5425
- this.dispatch(updateFormRevisionAttachments(result.attachments));
5426
- }).catch(() => {
5427
- this.dispatch(
5428
- deleteFormRevisionAttachments(
5429
- offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
5430
- )
5431
- );
5699
+ const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
5700
+ const offlineForm = offline({
5701
+ ...payload,
5702
+ submitted_at: submittedAt,
5703
+ created_by: createdBy
5432
5704
  });
5433
- return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
5434
- }
5435
- async add(ownerId, form, initialRevision, urlPrefix) {
5436
- const { fields, images } = await separateImageFromFields(initialRevision.fields);
5437
5705
  const offlineFormRevision = offline({
5438
5706
  ...initialRevision,
5439
- fields,
5440
- created_by: form.created_by,
5441
- form: form.offline_id,
5442
- submitted_at: form.submitted_at,
5443
- revision: "Pending"
5707
+ form: offlineForm.offline_id,
5708
+ revision: "Pending",
5709
+ submitted_at: submittedAt,
5710
+ created_by: createdBy
5444
5711
  });
5445
- this.dispatch(addForm(form));
5712
+ this.dispatch(addForm(offlineForm));
5446
5713
  this.dispatch(addFormRevision(offlineFormRevision));
5447
5714
  const formPromise = this.enqueueRequest({
5448
5715
  description: "Create form",
5449
5716
  method: HttpMethod.POST,
5450
- url: urlPrefix,
5717
+ url: "/forms/",
5451
5718
  payload: {
5452
5719
  // Sending exactly what is currently needed for the endpoint
5453
- offline_id: form.offline_id,
5454
- submitted_at: form.submitted_at,
5720
+ offline_id: offlineForm.offline_id,
5721
+ submitted_at: offlineForm.submitted_at,
5455
5722
  initial_revision: {
5456
5723
  offline_id: offlineFormRevision.offline_id,
5457
5724
  submitted_at: offlineFormRevision.submitted_at,
@@ -5460,111 +5727,18 @@ var __publicField = (obj, key, value) => {
5460
5727
  fields: offlineFormRevision.fields
5461
5728
  }
5462
5729
  },
5463
- blockers: [ownerId],
5464
- blocks: [form.offline_id, offlineFormRevision.offline_id]
5730
+ blockers: [
5731
+ ...payload.project ? [payload.project.toString()] : [],
5732
+ ...payload.organization ? [payload.organization.toString()] : []
5733
+ ],
5734
+ blocks: [offlineForm.offline_id, offlineFormRevision.offline_id]
5465
5735
  });
5466
- const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
5467
- offlineFormRevision.offline_id,
5468
- images
5469
- );
5470
5736
  void formPromise.catch((e) => {
5471
- this.dispatch(deleteForm(form.offline_id));
5737
+ this.dispatch(deleteForm(offlineForm.offline_id));
5472
5738
  this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
5473
5739
  throw e;
5474
5740
  });
5475
- return [form, offlineFormRevision, offlineFormRevisionAttachments, formPromise, attachmentsPromise];
5476
- }
5477
- addForOrganization(organizationId, initialRevision) {
5478
- var _a2;
5479
- const state = this.client.store.getState();
5480
- const offlineForm = offline({
5481
- favorite: false,
5482
- created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
5483
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5484
- organization: organizationId
5485
- });
5486
- return this.add(
5487
- organizationId.toString(),
5488
- offlineForm,
5489
- initialRevision,
5490
- `/organizations/${organizationId}/create-form/`
5491
- );
5492
- }
5493
- addForProject(projectId, initialRevision) {
5494
- var _a2;
5495
- const state = this.client.store.getState();
5496
- const offlineForm = offline({
5497
- favorite: false,
5498
- created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
5499
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5500
- project: projectId
5501
- });
5502
- return this.add(projectId.toString(), offlineForm, initialRevision, `/projects/${projectId}/create-form/`);
5503
- }
5504
- addForIssueType(issueTypeId, initialRevision) {
5505
- var _a2;
5506
- const state = this.client.store.getState();
5507
- const offlineForm = offline({
5508
- favorite: false,
5509
- created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
5510
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5511
- issue_type: issueTypeId
5512
- });
5513
- return this.add(issueTypeId, offlineForm, initialRevision, `/issues/types/${issueTypeId}/create-form/`);
5514
- }
5515
- addForAssetType(assetTypeId, initialRevision) {
5516
- var _a2;
5517
- const state = this.client.store.getState();
5518
- const offlineForm = offline({
5519
- favorite: false,
5520
- created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
5521
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5522
- asset_type: assetTypeId
5523
- });
5524
- return this.add(assetTypeId, offlineForm, initialRevision, `/assets/types/${assetTypeId}/create-form/`);
5525
- }
5526
- async createRevision(formId, revision) {
5527
- var _a2;
5528
- const offlineRevision = offline(revision);
5529
- const { store } = this.client;
5530
- const state = store.getState();
5531
- const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
5532
- const { fields, images } = await separateImageFromFields(offlineRevision.fields);
5533
- const fullRevision = {
5534
- ...offlineRevision,
5535
- fields,
5536
- created_by: createdBy,
5537
- revision: "Pending",
5538
- form: formId,
5539
- submitted_at: (/* @__PURE__ */ new Date()).toISOString()
5540
- };
5541
- this.dispatch(addFormRevision(fullRevision));
5542
- const promise = this.enqueueRequest({
5543
- description: "Create form revision",
5544
- method: HttpMethod.PATCH,
5545
- url: `/forms/${formId}/`,
5546
- payload: {
5547
- initial_revision: {
5548
- offline_id: fullRevision.offline_id,
5549
- submitted_at: fullRevision.submitted_at,
5550
- title: fullRevision.title,
5551
- description: fullRevision.description,
5552
- fields: fullRevision.fields
5553
- }
5554
- },
5555
- blockers: [formId],
5556
- blocks: [offlineRevision.offline_id]
5557
- });
5558
- const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
5559
- fullRevision.offline_id,
5560
- images
5561
- );
5562
- void promise.then((result) => {
5563
- this.dispatch(setFormRevision(result));
5564
- }).catch(() => {
5565
- this.dispatch(deleteFormRevision(fullRevision.offline_id));
5566
- });
5567
- return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
5741
+ return [offlineForm, offlineFormRevision, formPromise];
5568
5742
  }
5569
5743
  async delete(id) {
5570
5744
  const { store } = this.client;
@@ -5601,65 +5775,31 @@ var __publicField = (obj, key, value) => {
5601
5775
  throw e;
5602
5776
  }
5603
5777
  }
5604
- async refreshStore(projectId) {
5605
- const forms = [];
5606
- const revisions = [];
5607
- const attachments = [];
5608
- const projectFormsResult = await this.enqueueRequest({
5778
+ async refreshStore(projectId, organizationId) {
5779
+ let forms = [];
5780
+ const projectForms = await this.enqueueRequest({
5609
5781
  description: "Fetch project forms",
5610
5782
  method: HttpMethod.GET,
5611
- url: `/projects/${projectId}/forms/`,
5783
+ url: "/forms/",
5784
+ queryParams: {
5785
+ project: projectId.toString()
5786
+ },
5612
5787
  blockers: [projectId.toString()],
5613
5788
  blocks: []
5614
5789
  });
5615
- for (const form of projectFormsResult.forms)
5616
- forms.push(form);
5617
- for (const revision of projectFormsResult.revisions)
5618
- revisions.push(revision);
5619
- for (const attachment of projectFormsResult.attachments)
5620
- attachments.push(attachment);
5621
- const organizationFormsResult = await this.enqueueRequest({
5790
+ forms = forms.concat(projectForms);
5791
+ const organizationForms = await this.enqueueRequest({
5622
5792
  description: "Fetch organization forms",
5623
5793
  method: HttpMethod.GET,
5624
- url: `/projects/${projectId}/organizations/forms/`,
5625
- blockers: [projectId.toString()],
5626
- blocks: []
5627
- });
5628
- for (const form of organizationFormsResult.forms)
5629
- forms.push(form);
5630
- for (const revision of organizationFormsResult.revisions)
5631
- revisions.push(revision);
5632
- for (const attachment of organizationFormsResult.attachments)
5633
- attachments.push(attachment);
5634
- const assetTypeFormsResult = await this.enqueueRequest({
5635
- description: "Fetch asset type forms",
5636
- method: HttpMethod.GET,
5637
- url: `/projects/${projectId}/asset-types/forms/`,
5638
- blockers: [projectId.toString()],
5639
- blocks: []
5640
- });
5641
- for (const form of assetTypeFormsResult.forms)
5642
- forms.push(form);
5643
- for (const revision of assetTypeFormsResult.revisions)
5644
- revisions.push(revision);
5645
- for (const attachment of assetTypeFormsResult.attachments)
5646
- attachments.push(attachment);
5647
- const issueTypeFormsResult = await this.enqueueRequest({
5648
- description: "Fetch issue type forms",
5649
- method: HttpMethod.GET,
5650
- url: `/projects/${projectId}/issue-types/forms/`,
5651
- blockers: [projectId.toString()],
5794
+ url: "/forms/",
5795
+ queryParams: {
5796
+ organization: organizationId.toString()
5797
+ },
5798
+ blockers: [organizationId.toString()],
5652
5799
  blocks: []
5653
5800
  });
5654
- for (const form of issueTypeFormsResult.forms)
5655
- forms.push(form);
5656
- for (const revision of issueTypeFormsResult.revisions)
5657
- revisions.push(revision);
5658
- for (const attachment of issueTypeFormsResult.attachments)
5659
- attachments.push(attachment);
5801
+ forms = forms.concat(organizationForms);
5660
5802
  this.dispatch(initializeForms(forms));
5661
- this.dispatch(initializeFormRevisions(revisions));
5662
- this.dispatch(initializeFormRevisionAttachments(attachments));
5663
5803
  }
5664
5804
  }
5665
5805
  const isArrayOfFiles = (value) => {
@@ -5681,95 +5821,11 @@ var __publicField = (obj, key, value) => {
5681
5821
  return { values: newValues, files };
5682
5822
  };
5683
5823
  class FormSubmissionService extends BaseUploadService {
5684
- async bulkAddSubmissionAttachments(submissionId, files) {
5685
- var _a2;
5686
- const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
5687
- const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
5688
- const filePayloads = {};
5689
- const offlineFormSubmissionAttachments = [];
5690
- const attachmentPayloads = [];
5691
- for (const [fieldIdentifier, filesArray] of Object.entries(files)) {
5692
- for (const file of filesArray) {
5693
- const sha1 = await hashFile(file);
5694
- if (!(sha1 in filePayloads)) {
5695
- filePayloads[sha1] = {
5696
- sha1,
5697
- file_type: file.type,
5698
- extension: file.name.split(".").pop(),
5699
- size: file.size
5700
- };
5701
- await this.client.files.addCache(file, sha1);
5702
- }
5703
- const offlineFormSubmissionAttachment = offline({
5704
- file: URL.createObjectURL(file),
5705
- file_type: file.type,
5706
- file_name: file.name,
5707
- file_sha1: sha1,
5708
- created_by: createdBy,
5709
- submission: submissionId,
5710
- submitted_at: submittedAt,
5711
- field_identifier: fieldIdentifier
5712
- });
5713
- offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
5714
- const attachmentPayload = {
5715
- offline_id: offlineFormSubmissionAttachment.offline_id,
5716
- name: file.name,
5717
- sha1,
5718
- field_identifier: fieldIdentifier
5719
- };
5720
- attachmentPayloads.push(attachmentPayload);
5721
- }
5722
- }
5723
- this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
5724
- const promise = this.enqueueRequest({
5725
- description: "Attach files to form submission",
5726
- method: HttpMethod.POST,
5727
- url: `/forms/submissions/${submissionId}/attachments/bulk/`,
5728
- payload: {
5729
- submitted_at: submittedAt,
5730
- attachments: attachmentPayloads,
5731
- files: Object.values(filePayloads)
5732
- },
5733
- blockers: [submissionId],
5734
- blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
5735
- });
5736
- promise.then((result) => {
5737
- this.processPresignedUrls(result.presigned_urls);
5738
- this.dispatch(updateFormSubmissionAttachments(result.attachments));
5739
- }).catch(() => {
5740
- this.dispatch(
5741
- deleteFormSubmissionAttachments(
5742
- offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
5743
- )
5744
- );
5745
- });
5746
- return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
5747
- }
5748
- async bulkDeleteSubmissionAttachments(submissionId, attachmentsIds) {
5749
- const { store } = this.client;
5750
- const state = store.getState();
5751
- const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
5752
- this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
5753
- try {
5754
- await this.enqueueRequest({
5755
- description: "Delete form submission attachments",
5756
- method: HttpMethod.DELETE,
5757
- url: `/forms/submissions/${submissionId}/attachments/bulk/`,
5758
- payload: { attachments: attachmentsIds },
5759
- blockers: [submissionId, ...attachmentsIds],
5760
- blocks: []
5761
- });
5762
- } catch (e) {
5763
- this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
5764
- throw e;
5765
- }
5766
- }
5767
- // Outer promise is for hashing and caching files for submission attachments
5768
- async add(payload) {
5824
+ add(payload) {
5769
5825
  var _a2;
5770
5826
  const { store } = this.client;
5771
5827
  const state = store.getState();
5772
- const { values, files } = separateFilesFromValues(payload.values);
5828
+ const { values } = separateFilesFromValues(payload.values);
5773
5829
  const offlineSubmission = offline({
5774
5830
  ...payload,
5775
5831
  values,
@@ -5779,7 +5835,7 @@ var __publicField = (obj, key, value) => {
5779
5835
  const promise = this.enqueueRequest({
5780
5836
  description: "Respond to form",
5781
5837
  method: HttpMethod.POST,
5782
- url: `/forms/revisions/${payload.form_revision}/respond/`,
5838
+ url: "/form-submissions/",
5783
5839
  payload: offlineSubmission,
5784
5840
  blockers: [payload.issue, payload.asset, payload.asset_stage, "add-form-entry"].filter(
5785
5841
  (x) => x !== void 0
@@ -5787,10 +5843,6 @@ var __publicField = (obj, key, value) => {
5787
5843
  blocks: [offlineSubmission.offline_id]
5788
5844
  });
5789
5845
  this.dispatch(addFormSubmission(offlineSubmission));
5790
- const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
5791
- offlineSubmission.offline_id,
5792
- files
5793
- );
5794
5846
  promise.then((result) => {
5795
5847
  this.dispatch(addActiveProjectFormSubmissionsCount(1));
5796
5848
  this.dispatch(setFormSubmission(result));
@@ -5799,115 +5851,16 @@ var __publicField = (obj, key, value) => {
5799
5851
  this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
5800
5852
  this.dispatch(addActiveProjectFormSubmissionsCount(-1));
5801
5853
  });
5802
- return [offlineSubmission, offlineFormSubmissionAttachments, promise, attachmentsPromise];
5803
- }
5804
- // Note currently the bulkAdd method is specific to form submissions for assets
5805
- // TODO: adapt the support bulk adding to any model type
5806
- async bulkAdd(args, batchSize) {
5807
- const { formRevision, commonFieldValues, fieldValuesByAsset } = args;
5808
- const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
5809
- const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
5810
- const transactionId = uuid.v4();
5811
- const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), batchSize);
5812
- const bulkAddBatches = await Promise.all(
5813
- assetIdBatches.map(async (assetIdBatch) => {
5814
- const batchId = uuid.v4();
5815
- const submissionPayloads = [];
5816
- const attachmentPayloads = [];
5817
- const files = { ...commonFiles };
5818
- for (const assetId of assetIdBatch) {
5819
- const { values: fileSeperatedSubmissionSpecificValues, files: submissionSpecificFiles } = separateFilesFromValues(fieldValuesByAsset[assetId] ?? {});
5820
- Object.assign(files, submissionSpecificFiles);
5821
- const submissionPayload = offline({
5822
- asset_id: assetId,
5823
- form_data: fileSeperatedSubmissionSpecificValues
5824
- });
5825
- submissionPayloads.push(submissionPayload);
5826
- for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
5827
- for (const file of fileArray) {
5828
- const sha1 = await hashFile(file);
5829
- await this.client.files.addCache(file, sha1);
5830
- const attachmentPayload = offline({
5831
- submission_id: submissionPayload.offline_id,
5832
- sha1,
5833
- name: file.name,
5834
- field_identifier: fieldIdentifier
5835
- });
5836
- attachmentPayloads.push(attachmentPayload);
5837
- }
5838
- }
5839
- }
5840
- const filePaylods = [];
5841
- for (const file of Object.values(files).flat()) {
5842
- const sha1 = await hashFile(file);
5843
- const filePayload = {
5844
- sha1,
5845
- extension: file.name.split(".").pop() || "",
5846
- file_type: file.type,
5847
- size: file.size
5848
- };
5849
- filePaylods.push(filePayload);
5850
- }
5851
- return {
5852
- batchId,
5853
- payload: {
5854
- transaction_id: transactionId,
5855
- form_data: fileSeperatedCommonFieldValues,
5856
- submitted_at: submittedAt,
5857
- submissions: submissionPayloads,
5858
- attachments: attachmentPayloads,
5859
- files: filePaylods
5860
- }
5861
- };
5862
- })
5863
- );
5864
- const batchPromises = [];
5865
- let prevBatchId = null;
5866
- for (const batch of bulkAddBatches) {
5867
- const { payload, batchId } = batch;
5868
- const batchAssetIds = payload.submissions.map((x) => x.asset_id);
5869
- const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
5870
- const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
5871
- const blockers = batchAssetIds;
5872
- if (prevBatchId)
5873
- blockers.push(prevBatchId);
5874
- const blocks2 = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
5875
- const promise = this.enqueueRequest({
5876
- description: "Bulk add form submissions",
5877
- method: HttpMethod.POST,
5878
- url: `/forms/revisions/${formRevision}/bulk-respond/`,
5879
- payload,
5880
- blockers,
5881
- blocks: blocks2
5882
- });
5883
- void promise.then(({ presigned_urls }) => {
5884
- this.processPresignedUrls(presigned_urls);
5885
- });
5886
- prevBatchId = batchId;
5887
- batchPromises.push(promise);
5888
- }
5889
- void Promise.all(batchPromises).then((results) => {
5890
- const createdSubmissions = [];
5891
- const createdAttachments = [];
5892
- for (const result of results) {
5893
- for (const createdSubmission of result.submissions)
5894
- createdSubmissions.push(createdSubmission);
5895
- for (const createdAttachment of result.attachments)
5896
- createdAttachments.push(createdAttachment);
5897
- }
5898
- this.dispatch(addFormSubmissions(createdSubmissions));
5899
- this.dispatch(addFormSubmissionAttachments(createdAttachments));
5900
- });
5901
- return batchPromises;
5854
+ return [offlineSubmission, promise];
5902
5855
  }
5903
- async update(payload) {
5856
+ update(payload) {
5904
5857
  const { store } = this.client;
5905
5858
  const state = store.getState();
5906
5859
  const submissionToBeUpdated = selectFormSubmissionById(payload.offline_id)(state);
5907
5860
  if (!submissionToBeUpdated) {
5908
5861
  throw new Error(`Expected submission with offline_id ${payload.offline_id} to exist`);
5909
5862
  }
5910
- const { values, files } = separateFilesFromValues(payload.values ?? {});
5863
+ const { values } = separateFilesFromValues(payload.values ?? {});
5911
5864
  const updatedSubmission = {
5912
5865
  ...submissionToBeUpdated,
5913
5866
  ...payload,
@@ -5921,39 +5874,18 @@ var __publicField = (obj, key, value) => {
5921
5874
  const promise = this.enqueueRequest({
5922
5875
  description: "Delete user form submissions",
5923
5876
  method: HttpMethod.PATCH,
5924
- url: `/forms/submissions/${updatedSubmission.offline_id}/`,
5877
+ url: `/form-submissions/${updatedSubmission.offline_id}/`,
5925
5878
  // TODO: send just payload when FormSubmissionDeserializer is updated to handle partial updates
5926
5879
  payload: updatedSubmission,
5927
5880
  blockers: [updatedSubmission.offline_id],
5928
5881
  blocks: [updatedSubmission.offline_id]
5929
5882
  });
5930
- const formSubmissionAttachments = selectAttachmentsOfFormSubmission(payload.offline_id)(state);
5931
- const formSubmissionAttachmentIdsToBeDeleted = [];
5932
- for (const attachment of formSubmissionAttachments) {
5933
- if (attachment.field_identifier in files) {
5934
- formSubmissionAttachmentIdsToBeDeleted.push(attachment.offline_id);
5935
- }
5936
- }
5937
- const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
5938
- payload.offline_id,
5939
- files
5940
- );
5941
- const deleteAttachmentsPromise = this.bulkDeleteSubmissionAttachments(
5942
- payload.offline_id,
5943
- formSubmissionAttachmentIdsToBeDeleted
5944
- );
5945
5883
  promise.then((result) => {
5946
5884
  this.dispatch(setFormSubmission(result));
5947
5885
  }).catch(() => {
5948
5886
  this.dispatch(setFormSubmission(submissionToBeUpdated));
5949
5887
  });
5950
- return [
5951
- updatedSubmission,
5952
- offlineFormSubmissionAttachments,
5953
- promise,
5954
- attachmentsPromise,
5955
- deleteAttachmentsPromise
5956
- ];
5888
+ return [updatedSubmission, promise];
5957
5889
  }
5958
5890
  async delete(id) {
5959
5891
  const { store } = this.client;
@@ -5970,7 +5902,7 @@ var __publicField = (obj, key, value) => {
5970
5902
  return await this.enqueueRequest({
5971
5903
  description: "Delete user form submissions",
5972
5904
  method: HttpMethod.DELETE,
5973
- url: `/forms/submissions/${id}/`,
5905
+ url: `/form-submissions/${id}/`,
5974
5906
  blockers: [id],
5975
5907
  blocks: []
5976
5908
  });
@@ -5982,50 +5914,17 @@ var __publicField = (obj, key, value) => {
5982
5914
  }
5983
5915
  }
5984
5916
  async refreshStore(projectId) {
5985
- const formSubmissions = {};
5986
- const modelSubmissions = await this.enqueueRequest({
5987
- description: "Fetch model submissions",
5988
- method: HttpMethod.GET,
5989
- url: `/forms/in-project/${projectId}/submissions/model/latest/`,
5990
- blockers: [],
5991
- blocks: []
5992
- });
5993
- for (const modelSubmission of modelSubmissions) {
5994
- formSubmissions[modelSubmission.offline_id] = modelSubmission;
5995
- }
5996
- const standaloneSubmissions = await this.enqueueRequest({
5997
- description: "Fetch standalone submissions",
5998
- method: HttpMethod.GET,
5999
- url: `/forms/in-project/${projectId}/submissions/standalone/`,
6000
- blockers: [],
6001
- blocks: []
6002
- });
6003
- for (const standaloneSubmission of standaloneSubmissions) {
6004
- formSubmissions[standaloneSubmission.offline_id] = standaloneSubmission;
6005
- }
6006
- this.dispatch(initializeFormSubmissions(Object.values(formSubmissions)));
6007
- const attachments = {};
6008
- const modelAttachments = await this.enqueueRequest({
6009
- description: "Fetch model submission attachments",
6010
- method: HttpMethod.GET,
6011
- url: `/forms/in-project/${projectId}/attachments/model/latest/`,
6012
- blockers: [],
6013
- blocks: []
6014
- });
6015
- for (const modelAttachment of modelAttachments) {
6016
- attachments[modelAttachment.offline_id] = modelAttachment;
6017
- }
6018
- const standaloneAttachments = await this.enqueueRequest({
6019
- description: "Fetch standalone submission attachments",
5917
+ const result = await this.enqueueRequest({
5918
+ description: "Fetch form submissions",
6020
5919
  method: HttpMethod.GET,
6021
- url: `/forms/in-project/${projectId}/attachments/standalone/`,
5920
+ url: "/form-submissions/",
5921
+ queryParams: {
5922
+ project: projectId.toString()
5923
+ },
6022
5924
  blockers: [],
6023
5925
  blocks: []
6024
5926
  });
6025
- for (const standaloneAttachent of standaloneAttachments) {
6026
- attachments[standaloneAttachent.offline_id] = standaloneAttachent;
6027
- }
6028
- this.dispatch(initializeFormSubmissionAttachments(Object.values(attachments)));
5927
+ this.dispatch(initializeFormSubmissions(result));
6029
5928
  }
6030
5929
  }
6031
5930
  class WorkspaceService extends BaseApiService {
@@ -6727,8 +6626,8 @@ var __publicField = (obj, key, value) => {
6727
6626
  class DocumentAttachmentService extends BaseAttachmentService {
6728
6627
  constructor() {
6729
6628
  super(...arguments);
6730
- __publicField(this, "attachmentModel", AttachmentModel.Document);
6731
- __publicField(this, "initializeAttachments", initializeDocumentAttachments);
6629
+ __publicField(this, "name", "Document Attachment");
6630
+ __publicField(this, "url", "/document-attachments");
6732
6631
  __publicField(this, "addAttachments", addDocumentAttachments);
6733
6632
  __publicField(this, "updateAttachments", updateDocumentAttachments);
6734
6633
  __publicField(this, "removeAttachments", deleteDocumentAttachments);
@@ -6739,17 +6638,23 @@ var __publicField = (obj, key, value) => {
6739
6638
  buildOfflineAttachment(data) {
6740
6639
  return offline({
6741
6640
  file: URL.createObjectURL(data.file),
6742
- file_sha1: data.sha1,
6743
- created_by: data.createdBy,
6641
+ file_sha1: data.file_sha1,
6642
+ created_by: data.created_by,
6744
6643
  file_name: data.file.name,
6745
6644
  file_type: data.file.type,
6746
- submitted_at: data.submittedAt,
6645
+ submitted_at: data.submitted_at,
6747
6646
  description: data.description,
6748
6647
  document: data.modelId
6749
6648
  });
6750
6649
  }
6650
+ buildAttachmentPayload(data) {
6651
+ return {
6652
+ ...data,
6653
+ document: data.modelId
6654
+ };
6655
+ }
6751
6656
  // NOTE: overriding the method from BaseAttachmentService since document attachments get vectorized
6752
- async attachFilesToDocument(files, documentId) {
6657
+ async bulkAdd(payloads) {
6753
6658
  var _a2;
6754
6659
  const { store } = this.client;
6755
6660
  const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
@@ -6758,40 +6663,36 @@ var __publicField = (obj, key, value) => {
6758
6663
  const attachmentPayloads = [];
6759
6664
  const filePayloads = {};
6760
6665
  const sha1ToAttachmentIds = {};
6761
- for (const file of files) {
6762
- const sha1 = await hashFile(file);
6763
- if (!(sha1 in filePayloads)) {
6764
- filePayloads[sha1] = {
6765
- sha1,
6766
- file_type: file.type,
6767
- extension: file.name.split(".").pop(),
6768
- size: file.size
6769
- };
6770
- sha1ToAttachmentIds[sha1] = [];
6771
- await this.client.files.addCache(file, sha1);
6666
+ for (const payload of payloads) {
6667
+ const { documentId, file } = payload;
6668
+ const filePayload = await this.getFilePayload(file);
6669
+ if (!(filePayload.sha1 in filePayloads)) {
6670
+ filePayloads[filePayload.sha1] = filePayload;
6671
+ sha1ToAttachmentIds[filePayload.sha1] = [];
6772
6672
  }
6773
6673
  const offlineAttachment = this.buildOfflineAttachment({
6774
6674
  file,
6775
- sha1,
6776
- submittedAt,
6777
- createdBy,
6675
+ file_sha1: filePayload.sha1,
6676
+ submitted_at: submittedAt,
6677
+ created_by: createdBy,
6778
6678
  description: "",
6779
6679
  modelId: documentId
6780
6680
  });
6781
6681
  offlineAttachments.push(offlineAttachment);
6782
6682
  attachmentPayloads.push({
6783
6683
  offline_id: offlineAttachment.offline_id,
6784
- name: offlineAttachment.file_name,
6785
- sha1: offlineAttachment.file_sha1,
6684
+ file_name: offlineAttachment.file_name,
6685
+ file_sha1: offlineAttachment.file_sha1,
6686
+ file_extension: filePayload.extension,
6786
6687
  description: offlineAttachment.description
6787
6688
  });
6788
- sha1ToAttachmentIds[sha1].push(offlineAttachment.offline_id);
6689
+ sha1ToAttachmentIds[filePayload.sha1].push(offlineAttachment.offline_id);
6789
6690
  }
6790
6691
  this.dispatch(this.addAttachments(offlineAttachments));
6791
6692
  const promise = this.enqueueRequest({
6792
6693
  description: "Attach files to document",
6793
6694
  method: HttpMethod.POST,
6794
- url: `/documents/${documentId}/attach/`,
6695
+ url: "/document-attachments/bulk/",
6795
6696
  payload: {
6796
6697
  submitted_at: submittedAt,
6797
6698
  attachments: attachmentPayloads,
@@ -6816,14 +6717,14 @@ var __publicField = (obj, key, value) => {
6816
6717
  });
6817
6718
  return [offlineAttachments, promise.then(({ attachments }) => attachments)];
6818
6719
  }
6819
- async deleteDocumentAttachment(attachmentId) {
6820
- return this.deleteAttachment(attachmentId);
6720
+ async delete(id) {
6721
+ return this._delete(id);
6821
6722
  }
6822
6723
  makeReadable(attachmnentId) {
6823
6724
  void this.enqueueRequest({
6824
6725
  description: "Add attachment to AI assistant",
6825
6726
  method: HttpMethod.PATCH,
6826
- url: `/documents/attachments/${attachmnentId}/`,
6727
+ url: `/document-attachments/${attachmnentId}/`,
6827
6728
  payload: {
6828
6729
  readable_to_assistant: true
6829
6730
  },
@@ -6840,7 +6741,7 @@ var __publicField = (obj, key, value) => {
6840
6741
  blocks: [],
6841
6742
  blockers: []
6842
6743
  });
6843
- this.dispatch(this.initializeAttachments(projectDocumentAttachments));
6744
+ this.dispatch(initializeDocumentAttachments(projectDocumentAttachments));
6844
6745
  const organizationDocumentAttachments = await this.enqueueRequest({
6845
6746
  description: "Get document attachments",
6846
6747
  method: HttpMethod.GET,
@@ -7084,17 +6985,11 @@ var __publicField = (obj, key, value) => {
7084
6985
  const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7085
6986
  const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7086
6987
  const projectId = payloadWithoutFile.project;
7087
- const sha1 = await hashFile(file);
7088
- const filePayload = {
7089
- sha1,
7090
- file_type: file.type,
7091
- extension: file.name.split(".").pop(),
7092
- size: file.size
7093
- };
6988
+ const filePayload = await this.getFilePayload(file);
7094
6989
  const offlineMapImage = offline({
7095
6990
  ...payloadWithoutFile,
7096
6991
  file_name: file.name,
7097
- file_sha1: sha1,
6992
+ file_sha1: filePayload.sha1,
7098
6993
  file: URL.createObjectURL(file),
7099
6994
  submitted_at: submittedAt,
7100
6995
  created_by: createdBy
@@ -7137,23 +7032,16 @@ var __publicField = (obj, key, value) => {
7137
7032
  const offlineGeoImages = [];
7138
7033
  const offlineIds = [];
7139
7034
  const geoImagePayloads = [];
7140
- const filePayloadRecord = {};
7035
+ const filePayloads = {};
7141
7036
  for (const payloadAndFile of payloads) {
7142
7037
  const { file, ...payload } = payloadAndFile;
7143
- const sha1 = await hashFile(file);
7144
- if (!(sha1 in filePayloadRecord)) {
7145
- filePayloadRecord[sha1] = {
7146
- sha1,
7147
- file_type: file.type,
7148
- extension: file.name.split(".").pop(),
7149
- size: file.size
7150
- };
7151
- await this.client.files.addCache(file, sha1);
7152
- }
7038
+ const filePayload = await this.getFilePayload(file);
7039
+ if (!(filePayload.sha1 in filePayloads))
7040
+ filePayloads[filePayload.sha1] = filePayload;
7153
7041
  const offlineMapImage = offline({
7154
7042
  ...payload,
7155
7043
  file_name: file.name,
7156
- file_sha1: sha1,
7044
+ file_sha1: filePayload.sha1,
7157
7045
  file: URL.createObjectURL(file),
7158
7046
  submitted_at: submittedAt,
7159
7047
  created_by: createdBy,
@@ -7182,7 +7070,7 @@ var __publicField = (obj, key, value) => {
7182
7070
  submitted_at: submittedAt,
7183
7071
  project: projectId,
7184
7072
  geo_images: geoImagePayloads,
7185
- files: Object.values(filePayloadRecord)
7073
+ files: Object.values(filePayloads)
7186
7074
  },
7187
7075
  blocks: [projectId.toString()],
7188
7076
  blockers: offlineIds
@@ -7250,7 +7138,7 @@ var __publicField = (obj, key, value) => {
7250
7138
  this.dispatch(initializeGeoImages(result));
7251
7139
  }
7252
7140
  }
7253
- class IssueAssociationService extends BaseUploadService {
7141
+ class IssueAssociationService extends BaseApiService {
7254
7142
  add(payload) {
7255
7143
  var _a2;
7256
7144
  const { store } = this.client;
@@ -7265,7 +7153,7 @@ var __publicField = (obj, key, value) => {
7265
7153
  const promise = this.enqueueRequest({
7266
7154
  description: "Add issue association",
7267
7155
  method: HttpMethod.POST,
7268
- url: "/issues/associations/",
7156
+ url: "/issue-associations/",
7269
7157
  payload: {
7270
7158
  offline_id: offlineIssueAssociation.offline_id,
7271
7159
  submitted_at: submittedAt,
@@ -7295,7 +7183,7 @@ var __publicField = (obj, key, value) => {
7295
7183
  const promise = this.enqueueRequest({
7296
7184
  description: "Delete issue association",
7297
7185
  method: HttpMethod.DELETE,
7298
- url: `/issues/associations/${id}/`,
7186
+ url: `/issue-associations/${id}/`,
7299
7187
  blockers: [id],
7300
7188
  blocks: []
7301
7189
  });
@@ -7308,14 +7196,854 @@ var __publicField = (obj, key, value) => {
7308
7196
  const issueAssociations = await this.enqueueRequest({
7309
7197
  description: "Fetch issue associations",
7310
7198
  method: HttpMethod.GET,
7311
- url: "/issues/associations/",
7312
- queryParams: { project_id: projectId.toString() },
7199
+ url: "/issue-associations/",
7200
+ queryParams: { project: projectId.toString() },
7313
7201
  blockers: [],
7314
7202
  blocks: []
7315
7203
  });
7316
7204
  this.dispatch(initializeIssueAssociations(issueAssociations));
7317
7205
  }
7318
7206
  }
7207
+ class FormRevisionAttachmentService extends BaseUploadService {
7208
+ async bulkAdd(payloads) {
7209
+ var _a2;
7210
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7211
+ const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7212
+ const filePayloads = {};
7213
+ const offlineFormRevisionAttachments = [];
7214
+ const attachmentPayloads = [];
7215
+ for (const payload of payloads) {
7216
+ const { revisionId, fieldIdentifier, file } = payload;
7217
+ const filePayload = await this.getFilePayload(file);
7218
+ if (!(filePayload.sha1 in filePayloads))
7219
+ filePayloads[filePayload.sha1] = filePayload;
7220
+ const offlineFormRevisionAttachment = offline({
7221
+ file: URL.createObjectURL(file),
7222
+ file_type: file.type,
7223
+ file_name: file.name,
7224
+ file_sha1: filePayload.sha1,
7225
+ created_by: createdBy,
7226
+ form_revision: revisionId,
7227
+ submitted_at: submittedAt,
7228
+ field_identifier: fieldIdentifier
7229
+ });
7230
+ offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
7231
+ const attachmentPayload = {
7232
+ offline_id: offlineFormRevisionAttachment.offline_id,
7233
+ file_name: file.name,
7234
+ field_identifier: fieldIdentifier,
7235
+ file_extension: filePayload.extension,
7236
+ file_sha1: filePayload.sha1,
7237
+ form_revision: revisionId
7238
+ };
7239
+ attachmentPayloads.push(attachmentPayload);
7240
+ }
7241
+ this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
7242
+ const promise = this.enqueueRequest({
7243
+ description: "Attach files to form revision",
7244
+ method: HttpMethod.POST,
7245
+ url: "/form-revision-attachments/bulk/",
7246
+ payload: {
7247
+ submitted_at: submittedAt,
7248
+ attachments: attachmentPayloads,
7249
+ files: Object.values(filePayloads)
7250
+ },
7251
+ blockers: offlineFormRevisionAttachments.map((attachment) => attachment.form_revision),
7252
+ blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
7253
+ });
7254
+ promise.then((result) => {
7255
+ this.processPresignedUrls(result.presigned_urls);
7256
+ this.dispatch(updateFormRevisionAttachments(result.attachments));
7257
+ }).catch(() => {
7258
+ this.dispatch(
7259
+ deleteFormRevisionAttachments(
7260
+ offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
7261
+ )
7262
+ );
7263
+ });
7264
+ return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
7265
+ }
7266
+ async refreshStore(projectId, organizationId) {
7267
+ let attachments = [];
7268
+ const projectFormRevisions = await this.enqueueRequest({
7269
+ description: "Fetch project form revision attachments",
7270
+ method: HttpMethod.GET,
7271
+ url: "/form-revision-attachments/",
7272
+ queryParams: {
7273
+ project: projectId.toString()
7274
+ },
7275
+ blockers: [projectId.toString()],
7276
+ blocks: []
7277
+ });
7278
+ attachments = attachments.concat(projectFormRevisions);
7279
+ const organizationFormRevisions = await this.enqueueRequest({
7280
+ description: "Fetch organization form revision attachments",
7281
+ method: HttpMethod.GET,
7282
+ url: "/form-revision-attachments/",
7283
+ queryParams: {
7284
+ organization: organizationId.toString()
7285
+ },
7286
+ blockers: [organizationId.toString()],
7287
+ blocks: []
7288
+ });
7289
+ attachments = attachments.concat(organizationFormRevisions);
7290
+ this.dispatch(initializeFormRevisionAttachments(attachments));
7291
+ }
7292
+ }
7293
+ class FormSubmissionAttachmentService extends BaseUploadService {
7294
+ async bulkAdd(payloads) {
7295
+ var _a2;
7296
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7297
+ const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7298
+ const filePayloads = {};
7299
+ const offlineFormSubmissionAttachments = [];
7300
+ const attachmentPayloads = [];
7301
+ for (const payload of payloads) {
7302
+ const { submissionId, fieldIdentifier, file } = payload;
7303
+ const filePayload = await this.getFilePayload(file);
7304
+ if (!(filePayload.sha1 in filePayloads))
7305
+ filePayloads[filePayload.sha1] = filePayload;
7306
+ const offlineFormSubmissionAttachment = offline({
7307
+ file: URL.createObjectURL(file),
7308
+ file_type: file.type,
7309
+ file_name: file.name,
7310
+ file_sha1: filePayload.sha1,
7311
+ created_by: createdBy,
7312
+ form_submission: submissionId,
7313
+ submitted_at: submittedAt,
7314
+ field_identifier: fieldIdentifier
7315
+ });
7316
+ offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
7317
+ const attachmentPayload = {
7318
+ offline_id: offlineFormSubmissionAttachment.offline_id,
7319
+ file_name: file.name,
7320
+ file_sha1: filePayload.sha1,
7321
+ file_extension: filePayload.extension,
7322
+ field_identifier: fieldIdentifier,
7323
+ form_submission: submissionId
7324
+ };
7325
+ attachmentPayloads.push(attachmentPayload);
7326
+ }
7327
+ this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
7328
+ const promise = this.enqueueRequest({
7329
+ description: "Attach files to form submission",
7330
+ method: HttpMethod.POST,
7331
+ url: "/form-submission-attachments/bulk/",
7332
+ payload: {
7333
+ submitted_at: submittedAt,
7334
+ attachments: attachmentPayloads,
7335
+ files: Object.values(filePayloads)
7336
+ },
7337
+ blockers: offlineFormSubmissionAttachments.map((attachment) => attachment.form_submission),
7338
+ blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
7339
+ });
7340
+ promise.then((result) => {
7341
+ this.processPresignedUrls(result.presigned_urls);
7342
+ this.dispatch(updateFormSubmissionAttachments(result.attachments));
7343
+ }).catch((error) => {
7344
+ this.dispatch(
7345
+ deleteFormSubmissionAttachments(
7346
+ offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
7347
+ )
7348
+ );
7349
+ throw error;
7350
+ });
7351
+ return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
7352
+ }
7353
+ async bulkDelete(attachmentsIds) {
7354
+ const { store } = this.client;
7355
+ const state = store.getState();
7356
+ const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
7357
+ this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
7358
+ try {
7359
+ await this.enqueueRequest({
7360
+ description: "Delete form submission attachments",
7361
+ method: HttpMethod.DELETE,
7362
+ url: "/form-submission-attachments/bulk/",
7363
+ payload: { attachment_ids: attachmentsIds },
7364
+ blockers: attachmentsIds,
7365
+ blocks: []
7366
+ });
7367
+ } catch (e) {
7368
+ this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
7369
+ throw e;
7370
+ }
7371
+ }
7372
+ async refreshStore(projectId) {
7373
+ const result = await this.enqueueRequest({
7374
+ description: "Get form submission attachments",
7375
+ method: HttpMethod.GET,
7376
+ url: "/form-submission-attachments/",
7377
+ queryParams: {
7378
+ project: projectId.toString()
7379
+ },
7380
+ blockers: [],
7381
+ blocks: []
7382
+ });
7383
+ this.dispatch(initializeFormSubmissionAttachments(result));
7384
+ }
7385
+ }
7386
+ class AssetTypeFieldsAttachmentService extends BaseUploadService {
7387
+ async bulkAdd(payloads) {
7388
+ var _a2;
7389
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7390
+ const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7391
+ const filePayloads = {};
7392
+ const offlineAssetTypeFieldsAttachments = [];
7393
+ const attachmentPayloads = [];
7394
+ for (const payload of payloads) {
7395
+ const { fieldsRevisionId, fieldIdentifier, file } = payload;
7396
+ const filePayload = await this.getFilePayload(file);
7397
+ if (!(filePayload.sha1 in filePayloads))
7398
+ filePayloads[filePayload.sha1] = filePayload;
7399
+ const offlineAssetTypeFieldsAttachment = offline({
7400
+ file: URL.createObjectURL(file),
7401
+ file_type: file.type,
7402
+ file_name: file.name,
7403
+ file_sha1: filePayload.sha1,
7404
+ created_by: createdBy,
7405
+ fields_revision: fieldsRevisionId,
7406
+ submitted_at: submittedAt,
7407
+ field_identifier: fieldIdentifier
7408
+ });
7409
+ offlineAssetTypeFieldsAttachments.push(offlineAssetTypeFieldsAttachment);
7410
+ const attachmentPayload = {
7411
+ offline_id: offlineAssetTypeFieldsAttachment.offline_id,
7412
+ file_name: file.name,
7413
+ field_identifier: fieldIdentifier,
7414
+ file_extension: filePayload.extension,
7415
+ file_sha1: filePayload.sha1,
7416
+ fields_revision: fieldsRevisionId
7417
+ };
7418
+ attachmentPayloads.push(attachmentPayload);
7419
+ }
7420
+ this.dispatch(addAssetTypeFieldsAttachments(offlineAssetTypeFieldsAttachments));
7421
+ const promise = this.enqueueRequest({
7422
+ description: "Add asset type fields attachments",
7423
+ method: HttpMethod.POST,
7424
+ url: "/asset-type-fields-attachments/bulk/",
7425
+ payload: {
7426
+ submitted_at: submittedAt,
7427
+ attachments: attachmentPayloads,
7428
+ files: Object.values(filePayloads)
7429
+ },
7430
+ blockers: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
7431
+ blocks: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
7432
+ });
7433
+ promise.then((result) => {
7434
+ this.processPresignedUrls(result.presigned_urls);
7435
+ this.dispatch(updateAssetTypeFieldsAttachments(result.attachments));
7436
+ }).catch(() => {
7437
+ this.dispatch(
7438
+ deleteAssetTypeFieldsAttachments(
7439
+ offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
7440
+ )
7441
+ );
7442
+ });
7443
+ return [offlineAssetTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
7444
+ }
7445
+ async refreshStore(projectId) {
7446
+ const result = await this.enqueueRequest({
7447
+ description: "get asset type fields attachments",
7448
+ method: HttpMethod.GET,
7449
+ url: "/asset-type-fields-attachments/",
7450
+ queryParams: {
7451
+ project: projectId.toString()
7452
+ },
7453
+ blockers: [projectId.toString()],
7454
+ blocks: []
7455
+ });
7456
+ this.dispatch(initializeAssetTypeFieldsAttachments(result));
7457
+ }
7458
+ }
7459
+ class AssetTypeFieldsService extends BaseApiService {
7460
+ add(payload) {
7461
+ var _a2;
7462
+ const { store } = this.client;
7463
+ const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7464
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7465
+ const offlineAssetTypeFields = offline({
7466
+ ...payload,
7467
+ created_by: createdBy,
7468
+ submitted_at: submittedAt
7469
+ });
7470
+ this.dispatch(addAssetTypeFields(offlineAssetTypeFields));
7471
+ const promise = this.enqueueRequest({
7472
+ description: "Add Asset Type Fields",
7473
+ method: HttpMethod.POST,
7474
+ url: "/asset-type-fields/",
7475
+ payload: offlineAssetTypeFields,
7476
+ blockers: [offlineAssetTypeFields.asset_type],
7477
+ blocks: [offlineAssetTypeFields.offline_id]
7478
+ });
7479
+ promise.then((response) => {
7480
+ this.dispatch(updateAssetTypeFields(response));
7481
+ }).catch((error) => {
7482
+ this.dispatch(deleteAssetTypeFields(offlineAssetTypeFields.offline_id));
7483
+ throw error;
7484
+ });
7485
+ return [offlineAssetTypeFields, promise];
7486
+ }
7487
+ async refreshStore(projectId) {
7488
+ const result = await this.enqueueRequest({
7489
+ description: "Get Asset Type Fields",
7490
+ method: HttpMethod.GET,
7491
+ url: "/asset-type-fields/",
7492
+ queryParams: {
7493
+ project: projectId.toString()
7494
+ },
7495
+ blockers: [],
7496
+ blocks: []
7497
+ });
7498
+ this.dispatch(initializeAssetTypeFields(result));
7499
+ }
7500
+ }
7501
+ class AssetTypeFieldValuesService extends BaseApiService {
7502
+ add(payload) {
7503
+ var _a2;
7504
+ const { store } = this.client;
7505
+ const state = store.getState();
7506
+ const { values } = separateFilesFromValues(payload.values);
7507
+ const offlineAssetTypeFieldValues = offline({
7508
+ ...payload,
7509
+ values,
7510
+ created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
7511
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
7512
+ });
7513
+ const promise = this.enqueueRequest({
7514
+ description: "Add asset type field values",
7515
+ method: HttpMethod.POST,
7516
+ url: "/asset-type-field-values/",
7517
+ payload: offlineAssetTypeFieldValues,
7518
+ blockers: [payload.asset, payload.fields_revision],
7519
+ blocks: [offlineAssetTypeFieldValues.offline_id]
7520
+ });
7521
+ this.dispatch(addAssetTypeFieldValues(offlineAssetTypeFieldValues));
7522
+ promise.then((result) => {
7523
+ this.dispatch(updateAssetTypeFieldValues(result));
7524
+ return result;
7525
+ }).catch(() => {
7526
+ this.dispatch(deleteAssetTypeFieldValues(offlineAssetTypeFieldValues.offline_id));
7527
+ });
7528
+ return [offlineAssetTypeFieldValues, promise];
7529
+ }
7530
+ bulkAdd(payload, batchSize) {
7531
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7532
+ const { values } = separateFilesFromValues(payload.values);
7533
+ const payloadsBatches = chunkArray(payload.payloads, batchSize);
7534
+ const bulkAddPayloads = payloadsBatches.map((batch) => {
7535
+ return {
7536
+ submitted_at: submittedAt,
7537
+ values,
7538
+ field_values: batch.map((payload2) => {
7539
+ const { values: values2 } = separateFilesFromValues(payload2.values);
7540
+ return offline({
7541
+ ...payload2,
7542
+ values: values2
7543
+ });
7544
+ })
7545
+ };
7546
+ });
7547
+ const promises = [];
7548
+ for (const payload2 of bulkAddPayloads) {
7549
+ const assetIds = payload2.field_values.map((x) => x.asset);
7550
+ const assetTypeFieldsIds = payload2.field_values.map((x) => x.fields_revision);
7551
+ const assetTypeFieldValuesIds = payload2.field_values.map((x) => x.offline_id);
7552
+ const promise = this.enqueueRequest({
7553
+ description: "Bulk add asset type field values",
7554
+ method: HttpMethod.POST,
7555
+ url: "/asset-type-field-values/bulk/",
7556
+ payload: payload2,
7557
+ blockers: [...assetIds, ...assetTypeFieldsIds],
7558
+ blocks: assetTypeFieldValuesIds
7559
+ });
7560
+ promises.push(promise);
7561
+ }
7562
+ void Promise.all(promises).then((results) => {
7563
+ this.dispatch(addAssetTypeFieldValuesMany(results.flat()));
7564
+ });
7565
+ return promises;
7566
+ }
7567
+ update(payload) {
7568
+ const { store } = this.client;
7569
+ const state = store.getState();
7570
+ const assetTypeFieldValues = selectAssetTypeFieldValuesById(payload.offline_id)(state);
7571
+ if (!assetTypeFieldValues) {
7572
+ throw new Error(`Expected AssetTypeFieldValues with offline_id ${payload.offline_id} to exist`);
7573
+ }
7574
+ const { values } = separateFilesFromValues(payload.values ?? {});
7575
+ const updatedAssetTypeFieldValues = {
7576
+ ...assetTypeFieldValues,
7577
+ ...payload,
7578
+ // values could also have a partial update
7579
+ values: {
7580
+ ...assetTypeFieldValues.values,
7581
+ ...values
7582
+ }
7583
+ };
7584
+ this.dispatch(updateAssetTypeFieldValues(updatedAssetTypeFieldValues));
7585
+ const promise = this.enqueueRequest({
7586
+ description: "Delete asset type field values",
7587
+ method: HttpMethod.PATCH,
7588
+ url: `/asset-type-field-values/${payload.offline_id}/`,
7589
+ payload,
7590
+ blockers: [
7591
+ updatedAssetTypeFieldValues.offline_id,
7592
+ updatedAssetTypeFieldValues.fields_revision,
7593
+ updatedAssetTypeFieldValues.asset
7594
+ ],
7595
+ blocks: [updatedAssetTypeFieldValues.offline_id]
7596
+ });
7597
+ promise.then((result) => {
7598
+ this.dispatch(updateAssetTypeFieldValues(result));
7599
+ }).catch(() => {
7600
+ this.dispatch(updateAssetTypeFieldValues(assetTypeFieldValues));
7601
+ });
7602
+ return [updatedAssetTypeFieldValues, promise];
7603
+ }
7604
+ async delete(id) {
7605
+ const { store } = this.client;
7606
+ const state = store.getState();
7607
+ const assetTypeFieldValues = selectAssetTypeFieldValuesById(id)(state);
7608
+ if (!assetTypeFieldValues) {
7609
+ throw new Error(`Expected submission with offline_id ${id} to exist`);
7610
+ }
7611
+ const assetTypeFieldValuesAttachments = selectAttachmentsOfAssetTypeFieldValues(id)(state);
7612
+ this.dispatch(deleteAssetTypeFieldValues(id));
7613
+ this.dispatch(deleteAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments.map((x) => x.offline_id)));
7614
+ try {
7615
+ await this.enqueueRequest({
7616
+ description: "Delete asset type field values",
7617
+ method: HttpMethod.DELETE,
7618
+ url: `/asset-type-field-values/${id}/`,
7619
+ blockers: [id],
7620
+ blocks: []
7621
+ });
7622
+ } catch (e) {
7623
+ this.dispatch(addAssetTypeFieldValues(assetTypeFieldValues));
7624
+ this.dispatch(addAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments));
7625
+ throw e;
7626
+ }
7627
+ }
7628
+ async refreshStore(projectId) {
7629
+ const result = await this.enqueueRequest({
7630
+ description: "Get asset type field values",
7631
+ method: HttpMethod.GET,
7632
+ url: "/asset-type-field-values/",
7633
+ queryParams: {
7634
+ project: projectId.toString()
7635
+ },
7636
+ blockers: [],
7637
+ blocks: []
7638
+ });
7639
+ this.dispatch(initializeAssetTypeFieldValues(result));
7640
+ }
7641
+ }
7642
+ class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
7643
+ async bulkAdd(payloads) {
7644
+ var _a2;
7645
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7646
+ const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7647
+ const filePayloads = {};
7648
+ const offlineAssetTypeFieldValuesAttachments = [];
7649
+ const attachmentPayloads = [];
7650
+ for (const payload of payloads) {
7651
+ const { fieldValuesId, fieldIdentifier, file } = payload;
7652
+ const filePayload = await this.getFilePayload(file);
7653
+ if (!(filePayload.sha1 in filePayloads))
7654
+ filePayloads[filePayload.sha1] = filePayload;
7655
+ const offlineAssetTypeFieldValuesAttachment = offline({
7656
+ file: URL.createObjectURL(file),
7657
+ file_type: file.type,
7658
+ file_name: file.name,
7659
+ file_sha1: filePayload.sha1,
7660
+ created_by: createdBy,
7661
+ field_values: fieldValuesId,
7662
+ submitted_at: submittedAt,
7663
+ field_identifier: fieldIdentifier
7664
+ });
7665
+ offlineAssetTypeFieldValuesAttachments.push(offlineAssetTypeFieldValuesAttachment);
7666
+ const attachmentPayload = {
7667
+ offline_id: offlineAssetTypeFieldValuesAttachment.offline_id,
7668
+ file_name: file.name,
7669
+ file_sha1: filePayload.sha1,
7670
+ file_extension: filePayload.extension,
7671
+ field_identifier: fieldIdentifier,
7672
+ field_values: fieldValuesId
7673
+ };
7674
+ attachmentPayloads.push(attachmentPayload);
7675
+ }
7676
+ this.dispatch(addAssetTypeFieldValuesAttachments(offlineAssetTypeFieldValuesAttachments));
7677
+ const promise = this.enqueueRequest({
7678
+ description: "Add asset type field values attachments",
7679
+ method: HttpMethod.POST,
7680
+ url: "/asset-type-field-values-attachments/bulk/",
7681
+ payload: {
7682
+ submitted_at: submittedAt,
7683
+ attachments: attachmentPayloads,
7684
+ files: Object.values(filePayloads)
7685
+ },
7686
+ blockers: offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.field_values),
7687
+ blocks: offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
7688
+ });
7689
+ promise.then(({ presigned_urls, attachments }) => {
7690
+ this.processPresignedUrls(presigned_urls);
7691
+ this.dispatch(updateAssetTypeFieldValuesAttachments(attachments));
7692
+ }).catch((error) => {
7693
+ this.dispatch(
7694
+ deleteAssetTypeFieldValuesAttachments(
7695
+ offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
7696
+ )
7697
+ );
7698
+ throw error;
7699
+ });
7700
+ return [offlineAssetTypeFieldValuesAttachments, promise.then(({ attachments }) => attachments)];
7701
+ }
7702
+ async bulkDelete(ids) {
7703
+ const { store } = this.client;
7704
+ const state = store.getState();
7705
+ const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(ids)(state);
7706
+ this.dispatch(deleteFormSubmissionAttachments(ids));
7707
+ try {
7708
+ await this.enqueueRequest({
7709
+ description: "Delete asset type field values attachments",
7710
+ method: HttpMethod.DELETE,
7711
+ url: "/asset-type-field-values-attachments/bulk/",
7712
+ payload: { attachment_ids: ids },
7713
+ blockers: ids,
7714
+ blocks: []
7715
+ });
7716
+ } catch (e) {
7717
+ this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
7718
+ throw e;
7719
+ }
7720
+ }
7721
+ async refreshStore(projectId) {
7722
+ const result = await this.enqueueRequest({
7723
+ description: "Gfet asset type field values attachments",
7724
+ method: HttpMethod.GET,
7725
+ url: "/asset-type-field-values-attachments/",
7726
+ queryParams: {
7727
+ project: projectId.toString()
7728
+ },
7729
+ blockers: [],
7730
+ blocks: []
7731
+ });
7732
+ this.dispatch(initializeAssetTypeFieldValuesAttachments(result));
7733
+ }
7734
+ }
7735
+ class IssueTypeFieldsAttachmentService extends BaseUploadService {
7736
+ async bulkAdd(payloads) {
7737
+ var _a2;
7738
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7739
+ const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7740
+ const filePayloads = {};
7741
+ const offlineIssueTypeFieldsAttachments = [];
7742
+ const attachmentPayloads = [];
7743
+ for (const payload of payloads) {
7744
+ const { fieldsRevisionId, fieldIdentifier, file } = payload;
7745
+ const filePayload = await this.getFilePayload(file);
7746
+ if (!(filePayload.sha1 in filePayloads))
7747
+ filePayloads[filePayload.sha1] = filePayload;
7748
+ const offlineIssueTypeFieldsAttachment = offline({
7749
+ file: URL.createObjectURL(file),
7750
+ file_type: file.type,
7751
+ file_name: file.name,
7752
+ file_sha1: filePayload.sha1,
7753
+ created_by: createdBy,
7754
+ fields_revision: fieldsRevisionId,
7755
+ submitted_at: submittedAt,
7756
+ field_identifier: fieldIdentifier
7757
+ });
7758
+ offlineIssueTypeFieldsAttachments.push(offlineIssueTypeFieldsAttachment);
7759
+ const attachmentPayload = {
7760
+ offline_id: offlineIssueTypeFieldsAttachment.offline_id,
7761
+ file_name: file.name,
7762
+ file_extension: filePayload.extension,
7763
+ field_identifier: fieldIdentifier,
7764
+ file_sha1: filePayload.sha1,
7765
+ fields_revision: fieldsRevisionId
7766
+ };
7767
+ attachmentPayloads.push(attachmentPayload);
7768
+ }
7769
+ this.dispatch(addIssueTypeFieldsAttachments(offlineIssueTypeFieldsAttachments));
7770
+ const promise = this.enqueueRequest({
7771
+ description: "Add issue type fields attachments",
7772
+ method: HttpMethod.POST,
7773
+ url: "/issue-type-fields-attachments/bulk/",
7774
+ payload: {
7775
+ submitted_at: submittedAt,
7776
+ attachments: attachmentPayloads,
7777
+ files: Object.values(filePayloads)
7778
+ },
7779
+ blockers: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
7780
+ blocks: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
7781
+ });
7782
+ promise.then((result) => {
7783
+ this.processPresignedUrls(result.presigned_urls);
7784
+ this.dispatch(updateIssueTypeFieldsAttachments(result.attachments));
7785
+ }).catch(() => {
7786
+ this.dispatch(
7787
+ deleteIssueTypeFieldsAttachments(
7788
+ offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
7789
+ )
7790
+ );
7791
+ });
7792
+ return [offlineIssueTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
7793
+ }
7794
+ async refreshStore(organizationId) {
7795
+ const result = await this.enqueueRequest({
7796
+ description: "get issue type fields attachments",
7797
+ method: HttpMethod.GET,
7798
+ url: "/issue-type-fields-attachments/",
7799
+ queryParams: {
7800
+ organization: organizationId.toString()
7801
+ },
7802
+ blockers: [organizationId.toString()],
7803
+ blocks: []
7804
+ });
7805
+ this.dispatch(initializeIssueTypeFieldsAttachments(result));
7806
+ }
7807
+ }
7808
+ class IssueTypeFieldsService extends BaseApiService {
7809
+ add(payload) {
7810
+ var _a2;
7811
+ const { store } = this.client;
7812
+ const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7813
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7814
+ const offlineIssueTypeFields = offline({
7815
+ ...payload,
7816
+ created_by: createdBy,
7817
+ submitted_at: submittedAt
7818
+ });
7819
+ this.dispatch(addIssueTypeFields(offlineIssueTypeFields));
7820
+ const promise = this.enqueueRequest({
7821
+ description: "Add Issue Type Fields",
7822
+ method: HttpMethod.POST,
7823
+ url: "/issue-type-fields/",
7824
+ payload: offlineIssueTypeFields,
7825
+ blockers: [offlineIssueTypeFields.issue_type],
7826
+ blocks: [offlineIssueTypeFields.offline_id]
7827
+ });
7828
+ promise.then((response) => {
7829
+ this.dispatch(updateIssueTypeFields(response));
7830
+ }).catch((error) => {
7831
+ this.dispatch(deleteIssueTypeFields(offlineIssueTypeFields.offline_id));
7832
+ throw error;
7833
+ });
7834
+ return [offlineIssueTypeFields, promise];
7835
+ }
7836
+ async refreshStore(organizationId) {
7837
+ const result = await this.enqueueRequest({
7838
+ description: "Get Issue Type Fields",
7839
+ method: HttpMethod.GET,
7840
+ url: "/issue-type-fields/",
7841
+ queryParams: {
7842
+ organization: organizationId.toString()
7843
+ },
7844
+ blockers: [],
7845
+ blocks: []
7846
+ });
7847
+ this.dispatch(initializeIssueTypeFields(result));
7848
+ }
7849
+ }
7850
+ class IssueTypeFieldValuesAttachmentService extends BaseUploadService {
7851
+ async bulkAdd(payloads) {
7852
+ var _a2;
7853
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7854
+ const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7855
+ const filePayloads = {};
7856
+ const offlineIssueTypeFieldValuesAttachments = [];
7857
+ const attachmentPayloads = [];
7858
+ for (const payload of payloads) {
7859
+ const { fieldValuesId, fieldIdentifier, file } = payload;
7860
+ const filePayload = await this.getFilePayload(file);
7861
+ if (!(filePayload.sha1 in filePayloads))
7862
+ filePayloads[filePayload.sha1] = filePayload;
7863
+ const offlineIssueTypeFieldValuesAttachment = offline({
7864
+ file: URL.createObjectURL(file),
7865
+ file_type: file.type,
7866
+ file_name: file.name,
7867
+ file_sha1: filePayload.sha1,
7868
+ created_by: createdBy,
7869
+ field_values: fieldValuesId,
7870
+ submitted_at: submittedAt,
7871
+ field_identifier: fieldIdentifier
7872
+ });
7873
+ offlineIssueTypeFieldValuesAttachments.push(offlineIssueTypeFieldValuesAttachment);
7874
+ const attachmentPayload = {
7875
+ offline_id: offlineIssueTypeFieldValuesAttachment.offline_id,
7876
+ file_name: file.name,
7877
+ file_sha1: filePayload.sha1,
7878
+ file_extension: filePayload.extension,
7879
+ field_identifier: fieldIdentifier,
7880
+ field_values: fieldValuesId
7881
+ };
7882
+ attachmentPayloads.push(attachmentPayload);
7883
+ }
7884
+ this.dispatch(addIssueTypeFieldValuesAttachments(offlineIssueTypeFieldValuesAttachments));
7885
+ const promise = this.enqueueRequest({
7886
+ description: "Add issue type field values attachments",
7887
+ method: HttpMethod.POST,
7888
+ url: "/issue-type-field-values-attachments/bulk/",
7889
+ payload: {
7890
+ submitted_at: submittedAt,
7891
+ attachments: attachmentPayloads,
7892
+ files: Object.values(filePayloads)
7893
+ },
7894
+ blockers: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.field_values),
7895
+ blocks: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
7896
+ });
7897
+ promise.then(({ presigned_urls, attachments }) => {
7898
+ this.processPresignedUrls(presigned_urls);
7899
+ this.dispatch(updateIssueTypeFieldValuesAttachments(attachments));
7900
+ }).catch((error) => {
7901
+ this.dispatch(
7902
+ deleteIssueTypeFieldValuesAttachments(
7903
+ offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
7904
+ )
7905
+ );
7906
+ throw error;
7907
+ });
7908
+ return [offlineIssueTypeFieldValuesAttachments, promise.then(({ attachments }) => attachments)];
7909
+ }
7910
+ async bulkDelete(attachmentsIds) {
7911
+ const { store } = this.client;
7912
+ const state = store.getState();
7913
+ const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
7914
+ this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
7915
+ try {
7916
+ await this.enqueueRequest({
7917
+ description: "Delete issue type field values attachments",
7918
+ method: HttpMethod.DELETE,
7919
+ url: "/issue-type-field-values-attachments/bulk/",
7920
+ payload: { attachment_ids: attachmentsIds },
7921
+ blockers: attachmentsIds,
7922
+ blocks: []
7923
+ });
7924
+ } catch (e) {
7925
+ this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
7926
+ throw e;
7927
+ }
7928
+ }
7929
+ async refreshStore(projectId) {
7930
+ const result = await this.enqueueRequest({
7931
+ description: "Get issue type field values attachments",
7932
+ method: HttpMethod.GET,
7933
+ url: "/issue-type-field-values-attachments/",
7934
+ queryParams: {
7935
+ project: projectId.toString()
7936
+ },
7937
+ blockers: [],
7938
+ blocks: []
7939
+ });
7940
+ this.dispatch(initializeIssueTypeFieldValuesAttachments(result));
7941
+ }
7942
+ }
7943
+ class IssueTypeFieldValuesService extends BaseApiService {
7944
+ add(payload) {
7945
+ var _a2;
7946
+ const { store } = this.client;
7947
+ const state = store.getState();
7948
+ const { values } = separateFilesFromValues(payload.values);
7949
+ const offlineIssueTypeFieldValues = offline({
7950
+ ...payload,
7951
+ values,
7952
+ created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
7953
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
7954
+ });
7955
+ const promise = this.enqueueRequest({
7956
+ description: "Add issue type field values",
7957
+ method: HttpMethod.POST,
7958
+ url: "/issue-type-field-values/",
7959
+ payload: offlineIssueTypeFieldValues,
7960
+ blockers: [payload.issue, payload.fields_revision],
7961
+ blocks: [offlineIssueTypeFieldValues.offline_id]
7962
+ });
7963
+ this.dispatch(addIssueTypeFieldValues(offlineIssueTypeFieldValues));
7964
+ promise.then((result) => {
7965
+ this.dispatch(updateIssueTypeFieldValues(result));
7966
+ return result;
7967
+ }).catch(() => {
7968
+ this.dispatch(deleteIssueTypeFieldValues(offlineIssueTypeFieldValues.offline_id));
7969
+ });
7970
+ return [offlineIssueTypeFieldValues, promise];
7971
+ }
7972
+ update(payload) {
7973
+ const { store } = this.client;
7974
+ const state = store.getState();
7975
+ const issueTypeFieldValues = selectIssueTypeFieldValuesById(payload.offline_id)(state);
7976
+ if (!issueTypeFieldValues) {
7977
+ throw new Error(`Expected IssueTypeFieldValues with offline_id ${payload.offline_id} to exist`);
7978
+ }
7979
+ const { values } = separateFilesFromValues(payload.values ?? {});
7980
+ const updatedIssueTypeFieldValues = {
7981
+ ...issueTypeFieldValues,
7982
+ ...payload,
7983
+ // values could also have a partial update
7984
+ values: {
7985
+ ...issueTypeFieldValues.values,
7986
+ ...values
7987
+ }
7988
+ };
7989
+ this.dispatch(updateIssueTypeFieldValues(updatedIssueTypeFieldValues));
7990
+ const promise = this.enqueueRequest({
7991
+ description: "Update issue type field values",
7992
+ method: HttpMethod.PATCH,
7993
+ url: `/issue-type-field-values/${payload.offline_id}/`,
7994
+ payload,
7995
+ blockers: [
7996
+ updatedIssueTypeFieldValues.offline_id,
7997
+ updatedIssueTypeFieldValues.fields_revision,
7998
+ updatedIssueTypeFieldValues.issue
7999
+ ],
8000
+ blocks: [updatedIssueTypeFieldValues.offline_id]
8001
+ });
8002
+ promise.then((result) => {
8003
+ this.dispatch(updateIssueTypeFieldValues(result));
8004
+ }).catch(() => {
8005
+ this.dispatch(updateIssueTypeFieldValues(issueTypeFieldValues));
8006
+ });
8007
+ return [updatedIssueTypeFieldValues, promise];
8008
+ }
8009
+ async delete(id) {
8010
+ const { store } = this.client;
8011
+ const state = store.getState();
8012
+ const issueTypeFieldValues = selectIssueTypeFieldValuesById(id)(state);
8013
+ if (!issueTypeFieldValues) {
8014
+ throw new Error(`Expected submission with offline_id ${id} to exist`);
8015
+ }
8016
+ const issueTypeFieldValuesAttachments = selectAttachmentsOfIssueTypeFieldValues(id)(state);
8017
+ this.dispatch(deleteIssueTypeFieldValues(id));
8018
+ this.dispatch(deleteIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments.map((x) => x.offline_id)));
8019
+ try {
8020
+ await this.enqueueRequest({
8021
+ description: "Delete issue type field values",
8022
+ method: HttpMethod.DELETE,
8023
+ url: `/issue-type-field-values/${id}/`,
8024
+ blockers: [id],
8025
+ blocks: []
8026
+ });
8027
+ } catch (e) {
8028
+ this.dispatch(addIssueTypeFieldValues(issueTypeFieldValues));
8029
+ this.dispatch(addIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments));
8030
+ throw e;
8031
+ }
8032
+ }
8033
+ async refreshStore(projectId) {
8034
+ const result = await this.enqueueRequest({
8035
+ description: "Get issue type field values",
8036
+ method: HttpMethod.GET,
8037
+ url: "/issue-type-field-values/",
8038
+ queryParams: {
8039
+ project: projectId.toString()
8040
+ },
8041
+ blockers: [],
8042
+ blocks: []
8043
+ });
8044
+ this.dispatch(initializeIssueTypeFieldValues(result));
8045
+ }
8046
+ }
7319
8047
  var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
7320
8048
  VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
7321
8049
  VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
@@ -7332,6 +8060,10 @@ var __publicField = (obj, key, value) => {
7332
8060
  exports2.AssetStageCompletionService = AssetStageCompletionService;
7333
8061
  exports2.AssetStageService = AssetStageService;
7334
8062
  exports2.AssetTypeAttachmentService = AssetTypeAttachmentService;
8063
+ exports2.AssetTypeFieldValuesAttachmentService = AssetTypeFieldValuesAttachmentService;
8064
+ exports2.AssetTypeFieldValuesService = AssetTypeFieldValuesService;
8065
+ exports2.AssetTypeFieldsAttachmentService = AssetTypeFieldsAttachmentService;
8066
+ exports2.AssetTypeFieldsService = AssetTypeFieldsService;
7335
8067
  exports2.AssetTypeService = AssetTypeService;
7336
8068
  exports2.AttachmentModel = AttachmentModel;
7337
8069
  exports2.BaseApiService = BaseApiService;
@@ -7347,7 +8079,9 @@ var __publicField = (obj, key, value) => {
7347
8079
  exports2.EmailDomainsService = EmailDomainsService;
7348
8080
  exports2.EmailVerificationService = EmailVerificationService;
7349
8081
  exports2.FileService = FileService;
8082
+ exports2.FormRevisionAttachmentService = FormRevisionAttachmentService;
7350
8083
  exports2.FormService = FormService;
8084
+ exports2.FormSubmissionAttachmentService = FormSubmissionAttachmentService;
7351
8085
  exports2.FormSubmissionService = FormSubmissionService;
7352
8086
  exports2.GREEN = GREEN;
7353
8087
  exports2.GeoImageService = GeoImageService;
@@ -7358,6 +8092,10 @@ var __publicField = (obj, key, value) => {
7358
8092
  exports2.IssuePriority = IssuePriority;
7359
8093
  exports2.IssueService = IssueService;
7360
8094
  exports2.IssueStatus = IssueStatus;
8095
+ exports2.IssueTypeFieldValuesAttachmentService = IssueTypeFieldValuesAttachmentService;
8096
+ exports2.IssueTypeFieldValuesService = IssueTypeFieldValuesService;
8097
+ exports2.IssueTypeFieldsAttachmentService = IssueTypeFieldsAttachmentService;
8098
+ exports2.IssueTypeFieldsService = IssueTypeFieldsService;
7361
8099
  exports2.IssueTypeService = IssueTypeService;
7362
8100
  exports2.IssueUpdateChange = IssueUpdateChange;
7363
8101
  exports2.IssueUpdateService = IssueUpdateService;
@@ -7397,6 +8135,14 @@ var __publicField = (obj, key, value) => {
7397
8135
  exports2.addAssetType = addAssetType;
7398
8136
  exports2.addAssetTypeAttachment = addAssetTypeAttachment;
7399
8137
  exports2.addAssetTypeAttachments = addAssetTypeAttachments;
8138
+ exports2.addAssetTypeFieldValues = addAssetTypeFieldValues;
8139
+ exports2.addAssetTypeFieldValuesAttachment = addAssetTypeFieldValuesAttachment;
8140
+ exports2.addAssetTypeFieldValuesAttachments = addAssetTypeFieldValuesAttachments;
8141
+ exports2.addAssetTypeFieldValuesMany = addAssetTypeFieldValuesMany;
8142
+ exports2.addAssetTypeFields = addAssetTypeFields;
8143
+ exports2.addAssetTypeFieldsAttachment = addAssetTypeFieldsAttachment;
8144
+ exports2.addAssetTypeFieldsAttachments = addAssetTypeFieldsAttachments;
8145
+ exports2.addAssetTypeFieldsMany = addAssetTypeFieldsMany;
7400
8146
  exports2.addAssetTypes = addAssetTypes;
7401
8147
  exports2.addAssets = addAssets;
7402
8148
  exports2.addCategory = addCategory;
@@ -7425,6 +8171,14 @@ var __publicField = (obj, key, value) => {
7425
8171
  exports2.addIssueComment = addIssueComment;
7426
8172
  exports2.addIssueComments = addIssueComments;
7427
8173
  exports2.addIssueType = addIssueType;
8174
+ exports2.addIssueTypeFieldValues = addIssueTypeFieldValues;
8175
+ exports2.addIssueTypeFieldValuesAttachment = addIssueTypeFieldValuesAttachment;
8176
+ exports2.addIssueTypeFieldValuesAttachments = addIssueTypeFieldValuesAttachments;
8177
+ exports2.addIssueTypeFieldValuesMany = addIssueTypeFieldValuesMany;
8178
+ exports2.addIssueTypeFields = addIssueTypeFields;
8179
+ exports2.addIssueTypeFieldsAttachment = addIssueTypeFieldsAttachment;
8180
+ exports2.addIssueTypeFieldsAttachments = addIssueTypeFieldsAttachments;
8181
+ exports2.addIssueTypeFieldsMany = addIssueTypeFieldsMany;
7428
8182
  exports2.addIssueUpdate = addIssueUpdate;
7429
8183
  exports2.addIssueUpdates = addIssueUpdates;
7430
8184
  exports2.addIssues = addIssues;
@@ -7450,6 +8204,14 @@ var __publicField = (obj, key, value) => {
7450
8204
  exports2.assetStageSlice = assetStageSlice;
7451
8205
  exports2.assetTypeAttachmentReducer = assetTypeAttachmentReducer;
7452
8206
  exports2.assetTypeAttachmentSlice = assetTypeAttachmentSlice;
8207
+ exports2.assetTypeFieldValuesAttachmentReducer = assetTypeFieldValuesAttachmentReducer;
8208
+ exports2.assetTypeFieldValuesAttachmentSlice = assetTypeFieldValuesAttachmentSlice;
8209
+ exports2.assetTypeFieldValuesReducer = assetTypeFieldValuesReducer;
8210
+ exports2.assetTypeFieldValuesSlice = assetTypeFieldValuesSlice;
8211
+ exports2.assetTypeFieldsAttachmentReducer = assetTypeFieldsAttachmentReducer;
8212
+ exports2.assetTypeFieldsAttachmentSlice = assetTypeFieldsAttachmentSlice;
8213
+ exports2.assetTypeFieldsReducer = assetTypeFieldsReducer;
8214
+ exports2.assetTypeFieldsSlice = assetTypeFieldsSlice;
7453
8215
  exports2.assetTypeReducer = assetTypeReducer;
7454
8216
  exports2.assetTypeSlice = assetTypeSlice;
7455
8217
  exports2.authReducer = authReducer;
@@ -7478,6 +8240,14 @@ var __publicField = (obj, key, value) => {
7478
8240
  exports2.deleteAssetType = deleteAssetType;
7479
8241
  exports2.deleteAssetTypeAttachment = deleteAssetTypeAttachment;
7480
8242
  exports2.deleteAssetTypeAttachments = deleteAssetTypeAttachments;
8243
+ exports2.deleteAssetTypeFieldValues = deleteAssetTypeFieldValues;
8244
+ exports2.deleteAssetTypeFieldValuesAttachment = deleteAssetTypeFieldValuesAttachment;
8245
+ exports2.deleteAssetTypeFieldValuesAttachments = deleteAssetTypeFieldValuesAttachments;
8246
+ exports2.deleteAssetTypeFieldValuesMany = deleteAssetTypeFieldValuesMany;
8247
+ exports2.deleteAssetTypeFields = deleteAssetTypeFields;
8248
+ exports2.deleteAssetTypeFieldsAttachment = deleteAssetTypeFieldsAttachment;
8249
+ exports2.deleteAssetTypeFieldsAttachments = deleteAssetTypeFieldsAttachments;
8250
+ exports2.deleteAssetTypeFieldsMany = deleteAssetTypeFieldsMany;
7481
8251
  exports2.deleteAssetTypes = deleteAssetTypes;
7482
8252
  exports2.deleteAssets = deleteAssets;
7483
8253
  exports2.deleteCategory = deleteCategory;
@@ -7502,6 +8272,14 @@ var __publicField = (obj, key, value) => {
7502
8272
  exports2.deleteIssueAttachments = deleteIssueAttachments;
7503
8273
  exports2.deleteIssueComment = deleteIssueComment;
7504
8274
  exports2.deleteIssueComments = deleteIssueComments;
8275
+ exports2.deleteIssueTypeFieldValues = deleteIssueTypeFieldValues;
8276
+ exports2.deleteIssueTypeFieldValuesAttachment = deleteIssueTypeFieldValuesAttachment;
8277
+ exports2.deleteIssueTypeFieldValuesAttachments = deleteIssueTypeFieldValuesAttachments;
8278
+ exports2.deleteIssueTypeFieldValuesMany = deleteIssueTypeFieldValuesMany;
8279
+ exports2.deleteIssueTypeFields = deleteIssueTypeFields;
8280
+ exports2.deleteIssueTypeFieldsAttachment = deleteIssueTypeFieldsAttachment;
8281
+ exports2.deleteIssueTypeFieldsAttachments = deleteIssueTypeFieldsAttachments;
8282
+ exports2.deleteIssueTypeFieldsMany = deleteIssueTypeFieldsMany;
7505
8283
  exports2.deleteIssueUpdate = deleteIssueUpdate;
7506
8284
  exports2.deleteIssueUpdates = deleteIssueUpdates;
7507
8285
  exports2.deleteIssues = deleteIssues;
@@ -7558,6 +8336,10 @@ var __publicField = (obj, key, value) => {
7558
8336
  exports2.initializeAssetStageCompletions = initializeAssetStageCompletions;
7559
8337
  exports2.initializeAssetStages = initializeAssetStages;
7560
8338
  exports2.initializeAssetTypeAttachments = initializeAssetTypeAttachments;
8339
+ exports2.initializeAssetTypeFieldValues = initializeAssetTypeFieldValues;
8340
+ exports2.initializeAssetTypeFieldValuesAttachments = initializeAssetTypeFieldValuesAttachments;
8341
+ exports2.initializeAssetTypeFields = initializeAssetTypeFields;
8342
+ exports2.initializeAssetTypeFieldsAttachments = initializeAssetTypeFieldsAttachments;
7561
8343
  exports2.initializeAssetTypes = initializeAssetTypes;
7562
8344
  exports2.initializeAssets = initializeAssets;
7563
8345
  exports2.initializeCategories = initializeCategories;
@@ -7572,6 +8354,10 @@ var __publicField = (obj, key, value) => {
7572
8354
  exports2.initializeGeoImages = initializeGeoImages;
7573
8355
  exports2.initializeIssueAssociations = initializeIssueAssociations;
7574
8356
  exports2.initializeIssueAttachments = initializeIssueAttachments;
8357
+ exports2.initializeIssueTypeFieldValues = initializeIssueTypeFieldValues;
8358
+ exports2.initializeIssueTypeFieldValuesAttachments = initializeIssueTypeFieldValuesAttachments;
8359
+ exports2.initializeIssueTypeFields = initializeIssueTypeFields;
8360
+ exports2.initializeIssueTypeFieldsAttachments = initializeIssueTypeFieldsAttachments;
7575
8361
  exports2.initializeIssueTypes = initializeIssueTypes;
7576
8362
  exports2.initializeIssueUpdates = initializeIssueUpdates;
7577
8363
  exports2.initializeIssues = initializeIssues;
@@ -7590,6 +8376,14 @@ var __publicField = (obj, key, value) => {
7590
8376
  exports2.issueCommentSlice = issueCommentSlice;
7591
8377
  exports2.issueReducer = issueReducer;
7592
8378
  exports2.issueSlice = issueSlice;
8379
+ exports2.issueTypeFieldValuesAttachmentReducer = issueTypeFieldValuesAttachmentReducer;
8380
+ exports2.issueTypeFieldValuesAttachmentSlice = issueTypeFieldValuesAttachmentSlice;
8381
+ exports2.issueTypeFieldValuesReducer = issueTypeFieldValuesReducer;
8382
+ exports2.issueTypeFieldValuesSlice = issueTypeFieldValuesSlice;
8383
+ exports2.issueTypeFieldsAttachmentReducer = issueTypeFieldsAttachmentReducer;
8384
+ exports2.issueTypeFieldsAttachmentSlice = issueTypeFieldsAttachmentSlice;
8385
+ exports2.issueTypeFieldsReducer = issueTypeFieldsReducer;
8386
+ exports2.issueTypeFieldsSlice = issueTypeFieldsSlice;
7593
8387
  exports2.issueTypeReducer = issueTypeReducer;
7594
8388
  exports2.issueTypeSlice = issueTypeSlice;
7595
8389
  exports2.issueUpdateReducer = issueUpdateReducer;
@@ -7662,6 +8456,20 @@ var __publicField = (obj, key, value) => {
7662
8456
  exports2.selectAssetTypeAttachmentMapping = selectAssetTypeAttachmentMapping;
7663
8457
  exports2.selectAssetTypeAttachments = selectAssetTypeAttachments;
7664
8458
  exports2.selectAssetTypeById = selectAssetTypeById;
8459
+ exports2.selectAssetTypeFieldValues = selectAssetTypeFieldValues;
8460
+ exports2.selectAssetTypeFieldValuesAttachmentById = selectAssetTypeFieldValuesAttachmentById;
8461
+ exports2.selectAssetTypeFieldValuesAttachments = selectAssetTypeFieldValuesAttachments;
8462
+ exports2.selectAssetTypeFieldValuesAttachmentsMapping = selectAssetTypeFieldValuesAttachmentsMapping;
8463
+ exports2.selectAssetTypeFieldValuesById = selectAssetTypeFieldValuesById;
8464
+ exports2.selectAssetTypeFieldValuesMapping = selectAssetTypeFieldValuesMapping;
8465
+ exports2.selectAssetTypeFieldValuesOfAsset = selectAssetTypeFieldValuesOfAsset;
8466
+ exports2.selectAssetTypeFields = selectAssetTypeFields;
8467
+ exports2.selectAssetTypeFieldsAttachmentById = selectAssetTypeFieldsAttachmentById;
8468
+ exports2.selectAssetTypeFieldsAttachments = selectAssetTypeFieldsAttachments;
8469
+ exports2.selectAssetTypeFieldsAttachmentsMapping = selectAssetTypeFieldsAttachmentsMapping;
8470
+ exports2.selectAssetTypeFieldsById = selectAssetTypeFieldsById;
8471
+ exports2.selectAssetTypeFieldsMapping = selectAssetTypeFieldsMapping;
8472
+ exports2.selectAssetTypeFieldsOfAssetType = selectAssetTypeFieldsOfAssetType;
7665
8473
  exports2.selectAssetTypeStagesMapping = selectAssetTypeStagesMapping;
7666
8474
  exports2.selectAssetTypes = selectAssetTypes;
7667
8475
  exports2.selectAssetTypesByIds = selectAssetTypesByIds;
@@ -7670,18 +8478,20 @@ var __publicField = (obj, key, value) => {
7670
8478
  exports2.selectAssetsByIds = selectAssetsByIds;
7671
8479
  exports2.selectAssetsMapping = selectAssetsMapping;
7672
8480
  exports2.selectAssetsOfAssetType = selectAssetsOfAssetType;
7673
- exports2.selectAttachedFormSubmissionsOfAsset = selectAttachedFormSubmissionsOfAsset;
7674
- exports2.selectAttachedFormSubmissionsOfIssue = selectAttachedFormSubmissionsOfIssue;
7675
8481
  exports2.selectAttachmentsOfAsset = selectAttachmentsOfAsset;
7676
8482
  exports2.selectAttachmentsOfAssetByType = selectAttachmentsOfAssetByType;
7677
8483
  exports2.selectAttachmentsOfAssetType = selectAttachmentsOfAssetType;
7678
8484
  exports2.selectAttachmentsOfAssetTypeByType = selectAttachmentsOfAssetTypeByType;
8485
+ exports2.selectAttachmentsOfAssetTypeFieldValues = selectAttachmentsOfAssetTypeFieldValues;
8486
+ exports2.selectAttachmentsOfAssetTypeFields = selectAttachmentsOfAssetTypeFields;
7679
8487
  exports2.selectAttachmentsOfDocument = selectAttachmentsOfDocument;
7680
8488
  exports2.selectAttachmentsOfDocumentByType = selectAttachmentsOfDocumentByType;
7681
8489
  exports2.selectAttachmentsOfFormRevision = selectAttachmentsOfFormRevision;
7682
8490
  exports2.selectAttachmentsOfFormSubmission = selectAttachmentsOfFormSubmission;
7683
8491
  exports2.selectAttachmentsOfIssue = selectAttachmentsOfIssue;
7684
8492
  exports2.selectAttachmentsOfIssueByType = selectAttachmentsOfIssueByType;
8493
+ exports2.selectAttachmentsOfIssueTypeFieldValues = selectAttachmentsOfIssueTypeFieldValues;
8494
+ exports2.selectAttachmentsOfIssueTypeFields = selectAttachmentsOfIssueTypeFields;
7685
8495
  exports2.selectAttachmentsOfProject = selectAttachmentsOfProject;
7686
8496
  exports2.selectAttachmentsOfProjectByType = selectAttachmentsOfProjectByType;
7687
8497
  exports2.selectCategories = selectCategories;
@@ -7709,8 +8519,6 @@ var __publicField = (obj, key, value) => {
7709
8519
  exports2.selectFilteredForms = selectFilteredForms;
7710
8520
  exports2.selectFormById = selectFormById;
7711
8521
  exports2.selectFormMapping = selectFormMapping;
7712
- exports2.selectFormOfAssetType = selectFormOfAssetType;
7713
- exports2.selectFormOfIssueType = selectFormOfIssueType;
7714
8522
  exports2.selectFormRevisionAttachmentsMapping = selectFormRevisionAttachmentsMapping;
7715
8523
  exports2.selectFormRevisionById = selectFormRevisionById;
7716
8524
  exports2.selectFormRevisionMapping = selectFormRevisionMapping;
@@ -7720,9 +8528,7 @@ var __publicField = (obj, key, value) => {
7720
8528
  exports2.selectFormSubmissionAttachmentsMapping = selectFormSubmissionAttachmentsMapping;
7721
8529
  exports2.selectFormSubmissionById = selectFormSubmissionById;
7722
8530
  exports2.selectFormSubmissions = selectFormSubmissions;
7723
- exports2.selectFormSubmissionsByAssets = selectFormSubmissionsByAssets;
7724
8531
  exports2.selectFormSubmissionsByFormRevisions = selectFormSubmissionsByFormRevisions;
7725
- exports2.selectFormSubmissionsByIssues = selectFormSubmissionsByIssues;
7726
8532
  exports2.selectFormSubmissionsMapping = selectFormSubmissionsMapping;
7727
8533
  exports2.selectFormSubmissionsOfAsset = selectFormSubmissionsOfAsset;
7728
8534
  exports2.selectFormSubmissionsOfForm = selectFormSubmissionsOfForm;
@@ -7751,6 +8557,20 @@ var __publicField = (obj, key, value) => {
7751
8557
  exports2.selectIssueCountOfCategory = selectIssueCountOfCategory;
7752
8558
  exports2.selectIssueMapping = selectIssueMapping;
7753
8559
  exports2.selectIssueTypeById = selectIssueTypeById;
8560
+ exports2.selectIssueTypeFieldValues = selectIssueTypeFieldValues;
8561
+ exports2.selectIssueTypeFieldValuesAttachmentById = selectIssueTypeFieldValuesAttachmentById;
8562
+ exports2.selectIssueTypeFieldValuesAttachments = selectIssueTypeFieldValuesAttachments;
8563
+ exports2.selectIssueTypeFieldValuesAttachmentsMapping = selectIssueTypeFieldValuesAttachmentsMapping;
8564
+ exports2.selectIssueTypeFieldValuesById = selectIssueTypeFieldValuesById;
8565
+ exports2.selectIssueTypeFieldValuesMapping = selectIssueTypeFieldValuesMapping;
8566
+ exports2.selectIssueTypeFieldValuesOfIssue = selectIssueTypeFieldValuesOfIssue;
8567
+ exports2.selectIssueTypeFields = selectIssueTypeFields;
8568
+ exports2.selectIssueTypeFieldsAttachmentById = selectIssueTypeFieldsAttachmentById;
8569
+ exports2.selectIssueTypeFieldsAttachments = selectIssueTypeFieldsAttachments;
8570
+ exports2.selectIssueTypeFieldsAttachmentsMapping = selectIssueTypeFieldsAttachmentsMapping;
8571
+ exports2.selectIssueTypeFieldsById = selectIssueTypeFieldsById;
8572
+ exports2.selectIssueTypeFieldsMapping = selectIssueTypeFieldsMapping;
8573
+ exports2.selectIssueTypeFieldsOfIssueType = selectIssueTypeFieldsOfIssueType;
7754
8574
  exports2.selectIssueTypeMapping = selectIssueTypeMapping;
7755
8575
  exports2.selectIssueTypes = selectIssueTypes;
7756
8576
  exports2.selectIssueTypesByIds = selectIssueTypesByIds;
@@ -7817,6 +8637,8 @@ var __publicField = (obj, key, value) => {
7817
8637
  exports2.selectWorkspaceById = selectWorkspaceById;
7818
8638
  exports2.selectWorkspaceMapping = selectWorkspaceMapping;
7819
8639
  exports2.selectWorkspaces = selectWorkspaces;
8640
+ exports2.separateFilesFromValues = separateFilesFromValues;
8641
+ exports2.separateImageFromFields = separateImageFromFields;
7820
8642
  exports2.setActiveProjectFileId = setActiveProjectFileId;
7821
8643
  exports2.setActiveProjectId = setActiveProjectId;
7822
8644
  exports2.setAsset = setAsset;
@@ -7827,6 +8649,14 @@ var __publicField = (obj, key, value) => {
7827
8649
  exports2.setAssetType = setAssetType;
7828
8650
  exports2.setAssetTypeAttachment = setAssetTypeAttachment;
7829
8651
  exports2.setAssetTypeAttachments = setAssetTypeAttachments;
8652
+ exports2.setAssetTypeFieldValues = setAssetTypeFieldValues;
8653
+ exports2.setAssetTypeFieldValuesAttachment = setAssetTypeFieldValuesAttachment;
8654
+ exports2.setAssetTypeFieldValuesAttachments = setAssetTypeFieldValuesAttachments;
8655
+ exports2.setAssetTypeFieldValuesMany = setAssetTypeFieldValuesMany;
8656
+ exports2.setAssetTypeFields = setAssetTypeFields;
8657
+ exports2.setAssetTypeFieldsAttachment = setAssetTypeFieldsAttachment;
8658
+ exports2.setAssetTypeFieldsAttachments = setAssetTypeFieldsAttachments;
8659
+ exports2.setAssetTypeFieldsMany = setAssetTypeFieldsMany;
7830
8660
  exports2.setAssetTypes = setAssetTypes;
7831
8661
  exports2.setAssets = setAssets;
7832
8662
  exports2.setConversation = setConversation;
@@ -7852,6 +8682,14 @@ var __publicField = (obj, key, value) => {
7852
8682
  exports2.setIssueComment = setIssueComment;
7853
8683
  exports2.setIssueComments = setIssueComments;
7854
8684
  exports2.setIssueType = setIssueType;
8685
+ exports2.setIssueTypeFieldValues = setIssueTypeFieldValues;
8686
+ exports2.setIssueTypeFieldValuesAttachment = setIssueTypeFieldValuesAttachment;
8687
+ exports2.setIssueTypeFieldValuesAttachments = setIssueTypeFieldValuesAttachments;
8688
+ exports2.setIssueTypeFieldValuesMany = setIssueTypeFieldValuesMany;
8689
+ exports2.setIssueTypeFields = setIssueTypeFields;
8690
+ exports2.setIssueTypeFieldsAttachment = setIssueTypeFieldsAttachment;
8691
+ exports2.setIssueTypeFieldsAttachments = setIssueTypeFieldsAttachments;
8692
+ exports2.setIssueTypeFieldsMany = setIssueTypeFieldsMany;
7855
8693
  exports2.setIssueUpdate = setIssueUpdate;
7856
8694
  exports2.setLoggedIn = setLoggedIn;
7857
8695
  exports2.setOrganizations = setOrganizations;
@@ -7884,6 +8722,14 @@ var __publicField = (obj, key, value) => {
7884
8722
  exports2.updateAssetType = updateAssetType;
7885
8723
  exports2.updateAssetTypeAttachment = updateAssetTypeAttachment;
7886
8724
  exports2.updateAssetTypeAttachments = updateAssetTypeAttachments;
8725
+ exports2.updateAssetTypeFieldValues = updateAssetTypeFieldValues;
8726
+ exports2.updateAssetTypeFieldValuesAttachment = updateAssetTypeFieldValuesAttachment;
8727
+ exports2.updateAssetTypeFieldValuesAttachments = updateAssetTypeFieldValuesAttachments;
8728
+ exports2.updateAssetTypeFieldValuesMany = updateAssetTypeFieldValuesMany;
8729
+ exports2.updateAssetTypeFields = updateAssetTypeFields;
8730
+ exports2.updateAssetTypeFieldsAttachment = updateAssetTypeFieldsAttachment;
8731
+ exports2.updateAssetTypeFieldsAttachments = updateAssetTypeFieldsAttachments;
8732
+ exports2.updateAssetTypeFieldsMany = updateAssetTypeFieldsMany;
7887
8733
  exports2.updateAssetTypes = updateAssetTypes;
7888
8734
  exports2.updateAssets = updateAssets;
7889
8735
  exports2.updateCategory = updateCategory;
@@ -7906,6 +8752,14 @@ var __publicField = (obj, key, value) => {
7906
8752
  exports2.updateIssueAttachment = updateIssueAttachment;
7907
8753
  exports2.updateIssueAttachments = updateIssueAttachments;
7908
8754
  exports2.updateIssueType = updateIssueType;
8755
+ exports2.updateIssueTypeFieldValues = updateIssueTypeFieldValues;
8756
+ exports2.updateIssueTypeFieldValuesAttachment = updateIssueTypeFieldValuesAttachment;
8757
+ exports2.updateIssueTypeFieldValuesAttachments = updateIssueTypeFieldValuesAttachments;
8758
+ exports2.updateIssueTypeFieldValuesMany = updateIssueTypeFieldValuesMany;
8759
+ exports2.updateIssueTypeFields = updateIssueTypeFields;
8760
+ exports2.updateIssueTypeFieldsAttachment = updateIssueTypeFieldsAttachment;
8761
+ exports2.updateIssueTypeFieldsAttachments = updateIssueTypeFieldsAttachments;
8762
+ exports2.updateIssueTypeFieldsMany = updateIssueTypeFieldsMany;
7909
8763
  exports2.updateLicense = updateLicense;
7910
8764
  exports2.updateOrCreateProject = updateOrCreateProject;
7911
8765
  exports2.updateOrganizationAccess = updateOrganizationAccess;