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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/overmap-core.js +1904 -994
  2. package/dist/overmap-core.js.map +1 -1
  3. package/dist/overmap-core.umd.cjs +1902 -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 +11 -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
@@ -758,15 +758,15 @@ const wrapMigration = (migrator) => (state) => {
758
758
  };
759
759
  const migrations = [initialVersioning, signOut, signOut, createOutboxState];
760
760
  const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
761
- const initialState$B = {
761
+ const initialState$J = {
762
762
  accessToken: "",
763
763
  refreshToken: "",
764
764
  isLoggedIn: false
765
765
  };
766
766
  const authSlice = createSlice({
767
767
  name: "auth",
768
- initialState: initialState$B,
769
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
768
+ initialState: initialState$J,
769
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$J)),
770
770
  reducers: {
771
771
  setTokens: (state, action) => {
772
772
  state.accessToken = action.payload.accessToken;
@@ -854,11 +854,11 @@ function createModelAdapter(computeModelId) {
854
854
  };
855
855
  }
856
856
  const categoryAdapter = createModelAdapter((category) => category.offline_id);
857
- const initialState$A = categoryAdapter.getInitialState({});
857
+ const initialState$I = categoryAdapter.getInitialState({});
858
858
  const categorySlice = createSlice({
859
859
  name: "categories",
860
- initialState: initialState$A,
861
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$A)),
860
+ initialState: initialState$I,
861
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$I)),
862
862
  reducers: {
863
863
  initializeCategories: categoryAdapter.initialize,
864
864
  addCategory: categoryAdapter.addOne,
@@ -902,11 +902,11 @@ const selectIssueCountOfCategory = (categoryId) => (state) => {
902
902
  };
903
903
  const categoryReducer = categorySlice.reducer;
904
904
  const assetAdapter = createModelAdapter((asset) => asset.offline_id);
905
- const initialState$z = assetAdapter.getInitialState({});
905
+ const initialState$H = assetAdapter.getInitialState({});
906
906
  const assetSlice = createSlice({
907
907
  name: "assets",
908
- initialState: initialState$z,
909
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
908
+ initialState: initialState$H,
909
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$H)),
910
910
  reducers: {
911
911
  initializeAssets: assetAdapter.initialize,
912
912
  addAsset: assetAdapter.addOne,
@@ -958,11 +958,11 @@ const selectNumberOfAssetsOfAssetType = (assetTypeId) => (state) => {
958
958
  };
959
959
  const assetReducer = assetSlice.reducer;
960
960
  const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
961
- const initialState$y = assetAttachmentAdapter.getInitialState({});
961
+ const initialState$G = assetAttachmentAdapter.getInitialState({});
962
962
  const assetAttachmentSlice = createSlice({
963
963
  name: "assetAttachments",
964
- initialState: initialState$y,
965
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
964
+ initialState: initialState$G,
965
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$G)),
966
966
  reducers: {
967
967
  initializeAssetAttachments: assetAttachmentAdapter.initialize,
968
968
  addAssetAttachment: assetAttachmentAdapter.addOne,
@@ -1023,11 +1023,11 @@ const assetAttachmentReducer = assetAttachmentSlice.reducer;
1023
1023
  const assetStageCompletionAdapter = createModelAdapter(
1024
1024
  (stageCompletion) => stageCompletion.offline_id
1025
1025
  );
1026
- const initialState$x = assetStageCompletionAdapter.getInitialState({});
1026
+ const initialState$F = assetStageCompletionAdapter.getInitialState({});
1027
1027
  const assetStageCompletionSlice = createSlice({
1028
1028
  name: "assetStageCompletions",
1029
- initialState: initialState$x,
1030
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1029
+ initialState: initialState$F,
1030
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$F)),
1031
1031
  reducers: {
1032
1032
  initializeAssetStageCompletions: assetStageCompletionAdapter.initialize,
1033
1033
  addAssetStageCompletion: assetStageCompletionAdapter.addOne,
@@ -1089,11 +1089,11 @@ const selectAssetStageCompletionsByIds = restructureCreateSelectorWithArgs(
1089
1089
  );
1090
1090
  const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
1091
1091
  const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
1092
- const initialState$w = assetStageAdapter.getInitialState({});
1092
+ const initialState$E = assetStageAdapter.getInitialState({});
1093
1093
  const assetStageSlice = createSlice({
1094
1094
  name: "assetStages",
1095
- initialState: initialState$w,
1096
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1095
+ initialState: initialState$E,
1096
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$E)),
1097
1097
  reducers: {
1098
1098
  initializeAssetStages: assetStageAdapter.initialize,
1099
1099
  setAssetStage: assetStageAdapter.setOne,
@@ -1173,11 +1173,11 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
1173
1173
  })
1174
1174
  );
1175
1175
  const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
1176
- const initialState$v = assetTypeAdapter.getInitialState({});
1176
+ const initialState$D = assetTypeAdapter.getInitialState({});
1177
1177
  const assetTypeSlice = createSlice({
1178
1178
  name: "assetTypes",
1179
- initialState: initialState$v,
1180
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1179
+ initialState: initialState$D,
1180
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$D)),
1181
1181
  reducers: {
1182
1182
  initializeAssetTypes: assetTypeAdapter.initialize,
1183
1183
  setAssetType: assetTypeAdapter.setOne,
@@ -1230,11 +1230,11 @@ const assetTypeReducer = assetTypeSlice.reducer;
1230
1230
  const assetTypeAttachmentAdapter = createModelAdapter(
1231
1231
  (attachment) => attachment.offline_id
1232
1232
  );
1233
- const initialState$u = assetTypeAttachmentAdapter.getInitialState({});
1233
+ const initialState$C = assetTypeAttachmentAdapter.getInitialState({});
1234
1234
  const assetTypeAttachmentSlice = createSlice({
1235
1235
  name: "assetTypeAttachments",
1236
- initialState: initialState$u,
1237
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
1236
+ initialState: initialState$C,
1237
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$C)),
1238
1238
  reducers: {
1239
1239
  initializeAssetTypeAttachments: assetTypeAttachmentAdapter.initialize,
1240
1240
  addAssetTypeAttachment: assetTypeAttachmentAdapter.addOne,
@@ -1293,12 +1293,12 @@ const selectAttachmentsOfAssetTypeByType = restructureCreateSelectorWithArgs(
1293
1293
  );
1294
1294
  const assetTypeAttachmentReducer = assetTypeAttachmentSlice.reducer;
1295
1295
  const issueAdapter = createModelAdapter((issue) => issue.offline_id);
1296
- const initialState$t = issueAdapter.getInitialState({});
1296
+ const initialState$B = issueAdapter.getInitialState({});
1297
1297
  const issueSlice = createSlice({
1298
1298
  name: "issues",
1299
- initialState: initialState$t,
1299
+ initialState: initialState$B,
1300
1300
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
1301
- Object.assign(state, initialState$t);
1301
+ Object.assign(state, initialState$B);
1302
1302
  }),
1303
1303
  reducers: {
1304
1304
  initializeIssues: issueAdapter.initialize,
@@ -1330,12 +1330,12 @@ const selectIssuesByIds = restructureCreateSelectorWithArgs(
1330
1330
  );
1331
1331
  const issueReducer = issueSlice.reducer;
1332
1332
  const issueTypeAdapter = createModelAdapter((issueType) => issueType.offline_id);
1333
- const initialState$s = issueTypeAdapter.getInitialState({});
1333
+ const initialState$A = issueTypeAdapter.getInitialState({});
1334
1334
  const issueTypeSlice = createSlice({
1335
1335
  name: "issueTypes",
1336
- initialState: initialState$s,
1336
+ initialState: initialState$A,
1337
1337
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
1338
- Object.assign(state, initialState$s);
1338
+ Object.assign(state, initialState$A);
1339
1339
  }),
1340
1340
  reducers: {
1341
1341
  initializeIssueTypes: issueTypeAdapter.initialize,
@@ -1392,15 +1392,15 @@ const selectIssuesOfIssueTypeCount = (issueTypeId) => (state) => {
1392
1392
  return selectIssuesOfIssueType(issueTypeId)(state).length;
1393
1393
  };
1394
1394
  const issueTypeReducer = issueTypeSlice.reducer;
1395
- const initialState$r = {
1395
+ const initialState$z = {
1396
1396
  s3Urls: {}
1397
1397
  };
1398
1398
  const msPerHour = 1e3 * 60 * 60;
1399
1399
  const msPerWeek = msPerHour * 24 * 7;
1400
1400
  const fileSlice = createSlice({
1401
1401
  name: "file",
1402
- initialState: initialState$r,
1403
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
1402
+ initialState: initialState$z,
1403
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
1404
1404
  reducers: {
1405
1405
  setUploadUrl: (state, action) => {
1406
1406
  const { url, fields, sha1 } = action.payload;
@@ -1427,14 +1427,14 @@ const selectUploadUrl = (sha1) => (state) => {
1427
1427
  return url;
1428
1428
  };
1429
1429
  const fileReducer = fileSlice.reducer;
1430
- const initialState$q = {
1430
+ const initialState$y = {
1431
1431
  users: {},
1432
1432
  currentUser: null
1433
1433
  };
1434
1434
  const userSlice = createSlice({
1435
1435
  name: "users",
1436
- initialState: initialState$q,
1437
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1436
+ initialState: initialState$y,
1437
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
1438
1438
  reducers: {
1439
1439
  setUsers: (state, action) => {
1440
1440
  const usersMapping = {};
@@ -1492,11 +1492,11 @@ const selectUsersByIds = restructureCreateSelectorWithArgs(
1492
1492
  const organizationAccessAdapter = createModelAdapter(
1493
1493
  (organizationAccess) => organizationAccess.offline_id
1494
1494
  );
1495
- const initialState$p = organizationAccessAdapter.getInitialState({});
1495
+ const initialState$x = organizationAccessAdapter.getInitialState({});
1496
1496
  const organizationAccessSlice = createSlice({
1497
1497
  name: "organizationAccess",
1498
- initialState: initialState$p,
1499
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
1498
+ initialState: initialState$x,
1499
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1500
1500
  reducers: {
1501
1501
  initializeOrganizationAccesses: organizationAccessAdapter.initialize,
1502
1502
  updateOrganizationAccess: organizationAccessAdapter.updateOne,
@@ -1533,11 +1533,11 @@ const selectOrganizationAccessUserMapping = (state) => {
1533
1533
  };
1534
1534
  const organizationAccessReducer = organizationAccessSlice.reducer;
1535
1535
  const licenseAdapter = createModelAdapter((license) => license.offline_id);
1536
- const initialState$o = licenseAdapter.getInitialState({});
1536
+ const initialState$w = licenseAdapter.getInitialState({});
1537
1537
  const licenseSlice = createSlice({
1538
1538
  name: "license",
1539
- initialState: initialState$o,
1540
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1539
+ initialState: initialState$w,
1540
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1541
1541
  reducers: {
1542
1542
  initializeLicences: licenseAdapter.initialize,
1543
1543
  addLicenses: licenseAdapter.addMany,
@@ -1562,11 +1562,11 @@ const selectLicensesForProjectsMapping = createSelector(
1562
1562
  );
1563
1563
  const licenseReducer = licenseSlice.reducer;
1564
1564
  const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
1565
- const initialState$n = projectAccessAdapter.getInitialState({});
1565
+ const initialState$v = projectAccessAdapter.getInitialState({});
1566
1566
  const projectAccessSlice = createSlice({
1567
1567
  name: "projectAccess",
1568
- initialState: initialState$n,
1569
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
1568
+ initialState: initialState$v,
1569
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1570
1570
  reducers: {
1571
1571
  initializeProjectAccesses: projectAccessAdapter.initialize,
1572
1572
  updateProjectAccess: projectAccessAdapter.updateOne,
@@ -1607,14 +1607,14 @@ const selectProjectAccessUserMapping = (state) => {
1607
1607
  return projectAccesses;
1608
1608
  };
1609
1609
  const projectAccessReducer = projectAccessSlice.reducer;
1610
- const initialState$m = {
1610
+ const initialState$u = {
1611
1611
  projects: {},
1612
1612
  activeProjectId: null
1613
1613
  };
1614
1614
  const projectSlice = createSlice({
1615
1615
  name: "projects",
1616
- initialState: initialState$m,
1617
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
1616
+ initialState: initialState$u,
1617
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
1618
1618
  reducers: {
1619
1619
  setProjects: (state, action) => {
1620
1620
  const projectsMap = {};
@@ -1721,13 +1721,13 @@ const selectSortedProjectUsers = createSelector(
1721
1721
  });
1722
1722
  }
1723
1723
  );
1724
- const initialState$l = {
1724
+ const initialState$t = {
1725
1725
  organizations: {}
1726
1726
  };
1727
1727
  const organizationSlice = createSlice({
1728
1728
  name: "organizations",
1729
- initialState: initialState$l,
1730
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1729
+ initialState: initialState$t,
1730
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$t)),
1731
1731
  reducers: {
1732
1732
  setOrganizations: (state, action) => {
1733
1733
  for (const org of action.payload) {
@@ -1818,14 +1818,14 @@ const createOfflineAction = (request2, baseUrl, serviceName) => {
1818
1818
  }
1819
1819
  };
1820
1820
  };
1821
- const initialState$k = {
1821
+ const initialState$s = {
1822
1822
  deletedRequests: [],
1823
1823
  latestRetryTime: 0
1824
1824
  };
1825
1825
  const outboxSlice = createSlice({
1826
1826
  name: "outbox",
1827
- initialState: initialState$k,
1828
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1827
+ initialState: initialState$s,
1828
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
1829
1829
  reducers: {
1830
1830
  // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
1831
1831
  // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
@@ -1857,15 +1857,15 @@ const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
1857
1857
  const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
1858
1858
  const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
1859
1859
  const outboxReducer = outboxSlice.reducer;
1860
- const initialState$j = {
1860
+ const initialState$r = {
1861
1861
  projectFiles: {},
1862
1862
  activeProjectFileId: null,
1863
1863
  isImportingProjectFile: false
1864
1864
  };
1865
1865
  const projectFileSlice = createSlice({
1866
1866
  name: "projectFiles",
1867
- initialState: initialState$j,
1868
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
1867
+ initialState: initialState$r,
1868
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
1869
1869
  reducers: {
1870
1870
  addOrReplaceProjectFiles: (state, action) => {
1871
1871
  for (let fileObj of action.payload) {
@@ -1952,11 +1952,11 @@ const selectProjectFileById = (id) => (state) => {
1952
1952
  };
1953
1953
  const projectFileReducer = projectFileSlice.reducer;
1954
1954
  const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
1955
- const initialState$i = projectAttachmentAdapter.getInitialState({});
1955
+ const initialState$q = projectAttachmentAdapter.getInitialState({});
1956
1956
  const projectAttachmentSlice = createSlice({
1957
1957
  name: "projectAttachments",
1958
- initialState: initialState$i,
1959
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
1958
+ initialState: initialState$q,
1959
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1960
1960
  reducers: {
1961
1961
  initializeProjectAttachments: projectAttachmentAdapter.initialize,
1962
1962
  addProjectAttachment: projectAttachmentAdapter.addOne,
@@ -2011,12 +2011,12 @@ const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
2011
2011
  )
2012
2012
  );
2013
2013
  const projectAttachmentReducer = projectAttachmentSlice.reducer;
2014
- const initialState$h = {
2014
+ const initialState$p = {
2015
2015
  isRehydrated: false
2016
2016
  };
2017
2017
  const rehydratedSlice = createSlice({
2018
2018
  name: "rehydrated",
2019
- initialState: initialState$h,
2019
+ initialState: initialState$p,
2020
2020
  // The `reducers` field lets us define reducers and generate associated actions
2021
2021
  reducers: {
2022
2022
  setRehydrated: (state, action) => {
@@ -2041,11 +2041,11 @@ const formRevisionSortFn = (formRevisionA, formRevisionB) => {
2041
2041
  }
2042
2042
  };
2043
2043
  const formRevisionAdapter = createModelAdapter((revision) => revision.offline_id);
2044
- const initialState$g = formRevisionAdapter.getInitialState({});
2044
+ const initialState$o = formRevisionAdapter.getInitialState({});
2045
2045
  const formRevisionsSlice = createSlice({
2046
2046
  name: "formRevisions",
2047
- initialState: initialState$g,
2048
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2047
+ initialState: initialState$o,
2048
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
2049
2049
  reducers: {
2050
2050
  initializeFormRevisions: formRevisionAdapter.initialize,
2051
2051
  setFormRevision: formRevisionAdapter.setOne,
@@ -2117,11 +2117,11 @@ const selectLatestFormRevisionByForm = createSelector([selectFormRevisionMapping
2117
2117
  });
2118
2118
  const formRevisionReducer = formRevisionsSlice.reducer;
2119
2119
  const formAdapter = createModelAdapter((form) => form.offline_id);
2120
- const initialState$f = formAdapter.getInitialState({});
2120
+ const initialState$n = formAdapter.getInitialState({});
2121
2121
  const formSlice = createSlice({
2122
2122
  name: "forms",
2123
- initialState: initialState$f,
2124
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2123
+ initialState: initialState$n,
2124
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
2125
2125
  reducers: {
2126
2126
  initializeForms: formAdapter.initialize,
2127
2127
  setForm: formAdapter.setOne,
@@ -2167,34 +2167,18 @@ const selectFilteredForms = restructureCreateSelectorWithArgs(
2167
2167
  const selectFormById = (formId) => (state) => {
2168
2168
  return state.formReducer.instances[formId];
2169
2169
  };
2170
- const selectFormOfAssetType = restructureCreateSelectorWithArgs(
2171
- createSelector(
2172
- [selectFormMapping, (_state, assetTypeId) => assetTypeId],
2173
- (formsMapping, assetTypeId) => {
2174
- return Object.values(formsMapping).find((form) => form.asset_type === assetTypeId);
2175
- }
2176
- )
2177
- );
2178
- const selectFormOfIssueType = restructureCreateSelectorWithArgs(
2179
- createSelector(
2180
- [selectFormMapping, (_state, issueTypeId) => issueTypeId],
2181
- (formsMapping, issueTypeId) => {
2182
- return Object.values(formsMapping).find((form) => form.issue_type === issueTypeId);
2183
- }
2184
- )
2185
- );
2186
2170
  const selectFormsCount = createSelector([selectFormMapping], (formsMapping) => {
2187
2171
  return Object.keys(formsMapping).length;
2188
2172
  });
2189
2173
  const selectGeneralFormCount = createSelector([selectFormMapping], (formsMapping) => {
2190
- return Object.values(formsMapping).filter((form) => !form.asset_type).length;
2174
+ return Object.values(formsMapping).length;
2191
2175
  });
2192
2176
  const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
2193
- const initialState$e = submissionAdapter.getInitialState({});
2177
+ const initialState$m = submissionAdapter.getInitialState({});
2194
2178
  const formSubmissionSlice = createSlice({
2195
2179
  name: "formSubmissions",
2196
- initialState: initialState$e,
2197
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2180
+ initialState: initialState$m,
2181
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
2198
2182
  reducers: {
2199
2183
  initializeFormSubmissions: submissionAdapter.initialize,
2200
2184
  setFormSubmission: submissionAdapter.setOne,
@@ -2297,54 +2281,6 @@ const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
2297
2281
  }
2298
2282
  )
2299
2283
  );
2300
- const selectAttachedFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
2301
- createSelector(
2302
- [
2303
- (state) => state.issueReducer.instances,
2304
- (state) => state.formReducer.instances,
2305
- (state) => state.formRevisionReducer.instances,
2306
- (state) => state.formSubmissionReducer.instances,
2307
- (_state, issueId) => issueId
2308
- ],
2309
- (issues, forms, formRevisions, submissions, issueId) => {
2310
- const issue = issues[issueId];
2311
- if (!issue)
2312
- return [];
2313
- if (!issue.issue_type) {
2314
- return Object.values(submissions).filter((submission) => submission.issue === issueId);
2315
- }
2316
- const issueTypeForms = new Set(
2317
- Object.keys(forms).filter((formId) => forms[formId].issue_type === issue.issue_type)
2318
- );
2319
- const issueTypeFormRevisions = new Set(
2320
- Object.keys(formRevisions).filter(
2321
- (formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
2322
- )
2323
- );
2324
- return Object.values(submissions).filter(
2325
- (submission) => submission.issue === issueId && !issueTypeFormRevisions.has(submission.form_revision)
2326
- );
2327
- }
2328
- )
2329
- );
2330
- const selectFormSubmissionsByIssues = restructureCreateSelectorWithArgs(
2331
- createSelector(
2332
- [selectFormSubmissions, (_state, issueIds) => issueIds],
2333
- (submissions, issueIds) => {
2334
- var _a2;
2335
- const issueSubmissions = {};
2336
- for (const issueId of issueIds) {
2337
- issueSubmissions[issueId] = [];
2338
- }
2339
- for (const submission of submissions) {
2340
- if (submission.issue && issueIds.includes(submission.issue)) {
2341
- (_a2 = issueSubmissions[submission.issue]) == null ? void 0 : _a2.push(submission);
2342
- }
2343
- }
2344
- return issueSubmissions;
2345
- }
2346
- )
2347
- );
2348
2284
  const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
2349
2285
  createSelector(
2350
2286
  [selectFormSubmissions, (_state, assetId) => assetId],
@@ -2355,62 +2291,15 @@ const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
2355
2291
  }
2356
2292
  )
2357
2293
  );
2358
- const selectAttachedFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
2359
- createSelector(
2360
- [
2361
- (state) => state.assetReducer.instances,
2362
- (state) => state.formReducer.instances,
2363
- (state) => state.formRevisionReducer.instances,
2364
- (state) => state.formSubmissionReducer.instances,
2365
- (_state, assetId) => assetId
2366
- ],
2367
- (assets, forms, formRevisions, submissions, assetId) => {
2368
- const asset = assets[assetId];
2369
- if (!asset)
2370
- return [];
2371
- if (!asset.asset_type) {
2372
- return Object.values(submissions).filter((submission) => submission.asset === assetId);
2373
- }
2374
- const issueTypeForms = new Set(
2375
- Object.keys(forms).filter((formId) => forms[formId].asset_type === asset.asset_type)
2376
- );
2377
- const issueTypeFormRevisions = new Set(
2378
- Object.keys(formRevisions).filter(
2379
- (formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
2380
- )
2381
- );
2382
- return Object.values(submissions).filter(
2383
- (submission) => submission.asset === assetId && !issueTypeFormRevisions.has(submission.form_revision)
2384
- );
2385
- }
2386
- )
2387
- );
2388
- const selectFormSubmissionsByAssets = createSelector(
2389
- [selectFormSubmissionsMapping, selectAssetsMapping],
2390
- (submissions, assets) => {
2391
- var _a2;
2392
- const assetSubmissionMapping = {};
2393
- for (const assetId in assets) {
2394
- assetSubmissionMapping[assetId] = [];
2395
- }
2396
- for (const submissionId in submissions) {
2397
- const submission = submissions[submissionId];
2398
- if (submission.asset) {
2399
- (_a2 = assetSubmissionMapping[submission.asset]) == null ? void 0 : _a2.push(submission);
2400
- }
2401
- }
2402
- return assetSubmissionMapping;
2403
- }
2404
- );
2405
2294
  const formSubmissionReducer = formSubmissionSlice.reducer;
2406
2295
  const formSubmissionAttachmentAdapter = createModelAdapter(
2407
2296
  (attachment) => attachment.offline_id
2408
2297
  );
2409
- const initialState$d = formSubmissionAttachmentAdapter.getInitialState({});
2298
+ const initialState$l = formSubmissionAttachmentAdapter.getInitialState({});
2410
2299
  const formSubmissionAttachmentSlice = createSlice({
2411
2300
  name: "formSubmissionAttachments",
2412
- initialState: initialState$d,
2413
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2301
+ initialState: initialState$l,
2302
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
2414
2303
  reducers: {
2415
2304
  initializeFormSubmissionAttachments: formSubmissionAttachmentAdapter.initialize,
2416
2305
  addFormSubmissionAttachment: formSubmissionAttachmentAdapter.addOne,
@@ -2453,7 +2342,9 @@ const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
2453
2342
  [selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
2454
2343
  (attachmentsMapping, submissionId) => {
2455
2344
  return fallbackToEmptyArray(
2456
- Object.values(attachmentsMapping).filter((attachment) => attachment.submission === submissionId)
2345
+ Object.values(attachmentsMapping).filter(
2346
+ (attachment) => attachment.form_submission === submissionId
2347
+ )
2457
2348
  );
2458
2349
  }
2459
2350
  )
@@ -2462,11 +2353,11 @@ const formSubmissionAttachmentReducer = formSubmissionAttachmentSlice.reducer;
2462
2353
  const formRevisionAttachmentAdapter = createModelAdapter(
2463
2354
  (attachment) => attachment.offline_id
2464
2355
  );
2465
- const initialState$c = formRevisionAttachmentAdapter.getInitialState({});
2356
+ const initialState$k = formRevisionAttachmentAdapter.getInitialState({});
2466
2357
  const formRevisionAttachmentSlice = createSlice({
2467
2358
  name: "formRevisionAttachments",
2468
- initialState: initialState$c,
2469
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2359
+ initialState: initialState$k,
2360
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
2470
2361
  reducers: {
2471
2362
  initializeFormRevisionAttachments: formRevisionAttachmentAdapter.initialize,
2472
2363
  addFormRevisionAttachment: formRevisionAttachmentAdapter.addOne,
@@ -2498,17 +2389,17 @@ const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
2498
2389
  [selectFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
2499
2390
  (attachments, revisionId) => {
2500
2391
  return fallbackToEmptyArray(
2501
- Object.values(attachments).filter((attachment) => attachment.revision === revisionId)
2392
+ Object.values(attachments).filter((attachment) => attachment.form_revision === revisionId)
2502
2393
  );
2503
2394
  }
2504
2395
  )
2505
2396
  );
2506
2397
  const formRevisionAttachmentReducer = formRevisionAttachmentSlice.reducer;
2507
2398
  const workspaceAdapter = createModelAdapter((workspace) => workspace.offline_id);
2508
- const initialState$b = workspaceAdapter.getInitialState({});
2399
+ const initialState$j = workspaceAdapter.getInitialState({});
2509
2400
  const workspaceSlice = createSlice({
2510
2401
  name: "workspace",
2511
- initialState: initialState$b,
2402
+ initialState: initialState$j,
2512
2403
  reducers: {
2513
2404
  initializeWorkspaces: workspaceAdapter.initialize,
2514
2405
  setWorkspaces: workspaceAdapter.setMany,
@@ -2539,10 +2430,10 @@ const selectPermittedWorkspaceIds = createSelector(
2539
2430
  );
2540
2431
  const workspaceReducer = workspaceSlice.reducer;
2541
2432
  const emailDomainAdapter = createModelAdapter((emailDomain) => emailDomain.offline_id);
2542
- const initialState$a = emailDomainAdapter.getInitialState({});
2433
+ const initialState$i = emailDomainAdapter.getInitialState({});
2543
2434
  const emailDomainsSlice = createSlice({
2544
2435
  name: "emailDomains",
2545
- initialState: initialState$a,
2436
+ initialState: initialState$i,
2546
2437
  reducers: {
2547
2438
  initializeEmailDomains: emailDomainAdapter.initialize,
2548
2439
  addEmailDomain: emailDomainAdapter.addOne,
@@ -2563,14 +2454,14 @@ const selectEmailDomainsOfOrganization = restructureCreateSelectorWithArgs(
2563
2454
  )
2564
2455
  );
2565
2456
  const emailDomainsReducer = emailDomainsSlice.reducer;
2566
- const initialState$9 = {
2457
+ const initialState$h = {
2567
2458
  documents: {}
2568
2459
  };
2569
2460
  const documentSlice = createSlice({
2570
2461
  name: "documents",
2571
- initialState: initialState$9,
2462
+ initialState: initialState$h,
2572
2463
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
2573
- Object.assign(state, initialState$9);
2464
+ Object.assign(state, initialState$h);
2574
2465
  }),
2575
2466
  reducers: {
2576
2467
  setDocuments: (state, action) => {
@@ -2759,11 +2650,11 @@ const selectRootDocuments = createSelector(
2759
2650
  );
2760
2651
  const documentsReducer = documentSlice.reducer;
2761
2652
  const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
2762
- const initialState$8 = documentAttachmentAdapter.getInitialState({});
2653
+ const initialState$g = documentAttachmentAdapter.getInitialState({});
2763
2654
  const documentAttachmentSlice = createSlice({
2764
2655
  name: "documentAttachments",
2765
- initialState: initialState$8,
2766
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
2656
+ initialState: initialState$g,
2657
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2767
2658
  reducers: {
2768
2659
  initializeDocumentAttachments: documentAttachmentAdapter.initialize,
2769
2660
  addDocumentAttachment: documentAttachmentAdapter.addOne,
@@ -2822,11 +2713,11 @@ const selectAttachmentsOfDocumentByType = restructureCreateSelectorWithArgs(
2822
2713
  );
2823
2714
  const documentAttachmentReducer = documentAttachmentSlice.reducer;
2824
2715
  const teamAdapter = createModelAdapter((team) => team.offline_id);
2825
- const initialState$7 = teamAdapter.getInitialState({});
2716
+ const initialState$f = teamAdapter.getInitialState({});
2826
2717
  const teamSlice = createSlice({
2827
2718
  name: "teams",
2828
- initialState: initialState$7,
2829
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
2719
+ initialState: initialState$f,
2720
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2830
2721
  reducers: {
2831
2722
  setTeam: teamAdapter.setOne,
2832
2723
  initializeTeams: teamAdapter.initialize,
@@ -2877,11 +2768,11 @@ const teamReducer = teamSlice.reducer;
2877
2768
  const agentUserConversationAdapter = createModelAdapter(
2878
2769
  (conversation) => conversation.offline_id
2879
2770
  );
2880
- const initialState$6 = agentUserConversationAdapter.getInitialState({});
2771
+ const initialState$e = agentUserConversationAdapter.getInitialState({});
2881
2772
  const agentsSlice = createSlice({
2882
2773
  name: "agents",
2883
- initialState: initialState$6,
2884
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
2774
+ initialState: initialState$e,
2775
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2885
2776
  reducers: {
2886
2777
  initializeConversations: agentUserConversationAdapter.initialize,
2887
2778
  addConversation: agentUserConversationAdapter.addOne,
@@ -2903,11 +2794,11 @@ const selectConversation = restructureCreateSelectorWithArgs(
2903
2794
  );
2904
2795
  const agentsReducer = agentsSlice.reducer;
2905
2796
  const issueCommentAdapter = createModelAdapter((comment) => comment.offline_id);
2906
- const initialState$5 = issueCommentAdapter.getInitialState({});
2797
+ const initialState$d = issueCommentAdapter.getInitialState({});
2907
2798
  const issueCommentSlice = createSlice({
2908
2799
  name: "issueComments",
2909
- initialState: initialState$5,
2910
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
2800
+ initialState: initialState$d,
2801
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2911
2802
  reducers: {
2912
2803
  addIssueComment: issueCommentAdapter.addOne,
2913
2804
  addIssueComments: issueCommentAdapter.addMany,
@@ -2936,11 +2827,11 @@ const selectCommentsOfIssue = restructureCreateSelectorWithArgs(
2936
2827
  );
2937
2828
  const issueCommentReducer = issueCommentSlice.reducer;
2938
2829
  const issueUpdateAdapter = createModelAdapter((issueUpdate) => issueUpdate.offline_id);
2939
- const initialState$4 = issueUpdateAdapter.getInitialState({});
2830
+ const initialState$c = issueUpdateAdapter.getInitialState({});
2940
2831
  const issueUpdateSlice = createSlice({
2941
2832
  name: "issueUpdates",
2942
- initialState: initialState$4,
2943
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
2833
+ initialState: initialState$c,
2834
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2944
2835
  reducers: {
2945
2836
  initializeIssueUpdates: issueUpdateAdapter.setMany,
2946
2837
  setIssueUpdate: issueUpdateAdapter.setOne,
@@ -2969,11 +2860,11 @@ const selectIssueUpdatesOfIssue = restructureCreateSelectorWithArgs(
2969
2860
  );
2970
2861
  const issueUpdateReducer = issueUpdateSlice.reducer;
2971
2862
  const issueAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
2972
- const initialState$3 = issueAttachmentAdapter.getInitialState({});
2863
+ const initialState$b = issueAttachmentAdapter.getInitialState({});
2973
2864
  const issueAttachmentSlice = createSlice({
2974
2865
  name: "issueAttachments",
2975
- initialState: initialState$3,
2976
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
2866
+ initialState: initialState$b,
2867
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2977
2868
  reducers: {
2978
2869
  initializeIssueAttachments: issueAttachmentAdapter.initialize,
2979
2870
  addIssueAttachment: issueAttachmentAdapter.addOne,
@@ -3031,23 +2922,23 @@ const selectAttachmentsOfIssueByType = restructureCreateSelectorWithArgs(
3031
2922
  )
3032
2923
  );
3033
2924
  const issueAttachmentReducer = issueAttachmentSlice.reducer;
3034
- const initialState$2 = {
2925
+ const initialState$a = {
3035
2926
  version: 0
3036
2927
  };
3037
2928
  const versioningSlice = createSlice({
3038
2929
  name: "versioning",
3039
- initialState: initialState$2,
2930
+ initialState: initialState$a,
3040
2931
  reducers: {}
3041
2932
  });
3042
2933
  const versioningReducer = versioningSlice.reducer;
3043
2934
  const geoImageAdapter = createModelAdapter((model) => model.offline_id);
3044
- const initialState$1 = geoImageAdapter.getInitialState({});
2935
+ const initialState$9 = geoImageAdapter.getInitialState({});
3045
2936
  const geoImageSlice = createSlice({
3046
2937
  name: "geoImages",
3047
- initialState: initialState$1,
2938
+ initialState: initialState$9,
3048
2939
  extraReducers: (builder) => {
3049
2940
  builder.addCase("RESET", (state) => {
3050
- Object.assign(state, initialState$1);
2941
+ Object.assign(state, initialState$9);
3051
2942
  });
3052
2943
  },
3053
2944
  reducers: {
@@ -3085,11 +2976,11 @@ const selectGeoImagesOfProject = restructureCreateSelectorWithArgs(
3085
2976
  );
3086
2977
  const geoImageReducer = geoImageSlice.reducer;
3087
2978
  const issueAssociationAdapter = createModelAdapter((assoc) => assoc.offline_id);
3088
- const initialState = issueAssociationAdapter.getInitialState({});
2979
+ const initialState$8 = issueAssociationAdapter.getInitialState({});
3089
2980
  const issueAssociationSlice = createSlice({
3090
2981
  name: "issueAssociations",
3091
- initialState,
3092
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
2982
+ initialState: initialState$8,
2983
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
3093
2984
  reducers: {
3094
2985
  initializeIssueAssociations: issueAssociationAdapter.initialize,
3095
2986
  addIssueAssociation: issueAssociationAdapter.addOne,
@@ -3147,86 +3038,462 @@ const selectIssueAssociationsOfAsset = restructureCreateSelectorWithArgs(
3147
3038
  )
3148
3039
  );
3149
3040
  const issueAssociationReducer = issueAssociationSlice.reducer;
3150
- let clientStore;
3151
- function setClientStore(store) {
3152
- clientStore = store;
3153
- }
3154
- function getClientStore() {
3155
- return clientStore;
3156
- }
3157
- let clientSDK;
3158
- function setClientSDK(sdkCtor) {
3159
- clientSDK = sdkCtor;
3160
- }
3161
- function getClientSDK() {
3162
- return clientSDK;
3163
- }
3164
- const CLASS_NAME_TO_SERVICE = {};
3165
- class BaseService {
3166
- constructor(sdk) {
3167
- __publicField(this, "client");
3168
- CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
3169
- this.client = sdk;
3170
- }
3171
- async enqueueRequest(requestDetails) {
3172
- return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
3173
- }
3174
- dispatch(action) {
3175
- this.client.store.dispatch(action);
3041
+ const issueTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
3042
+ const initialState$7 = issueTypeFieldsAdapter.getInitialState({});
3043
+ const issueTypeFieldsSlice = createSlice({
3044
+ name: "issueTypeFields",
3045
+ initialState: initialState$7,
3046
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3047
+ reducers: {
3048
+ initializeIssueTypeFields: issueTypeFieldsAdapter.initialize,
3049
+ addIssueTypeFields: issueTypeFieldsAdapter.addOne,
3050
+ addIssueTypeFieldsMany: issueTypeFieldsAdapter.addMany,
3051
+ setIssueTypeFields: issueTypeFieldsAdapter.setOne,
3052
+ setIssueTypeFieldsMany: issueTypeFieldsAdapter.setMany,
3053
+ updateIssueTypeFields: issueTypeFieldsAdapter.updateOne,
3054
+ updateIssueTypeFieldsMany: issueTypeFieldsAdapter.updateMany,
3055
+ deleteIssueTypeFields: issueTypeFieldsAdapter.deleteOne,
3056
+ deleteIssueTypeFieldsMany: issueTypeFieldsAdapter.deleteMany
3176
3057
  }
3177
- }
3178
- const VERSION_REDUCER_KEY = "versioning";
3179
- const overmapReducers = {
3180
- // TODO: attachmentReducer,
3181
- [VERSION_REDUCER_KEY]: versioningReducer,
3182
- fileReducer,
3183
- authReducer,
3184
- categoryReducer,
3185
- assetReducer,
3186
- assetAttachmentReducer,
3187
- assetStageCompletionReducer,
3188
- assetStageReducer,
3189
- assetTypeReducer,
3190
- assetTypeAttachmentReducer,
3191
- issueReducer,
3192
- issueAttachmentReducer,
3193
- issueTypeReducer,
3194
- organizationReducer,
3195
- outboxReducer,
3196
- projectReducer,
3197
- projectAttachmentReducer,
3198
- projectAccessReducer,
3199
- organizationAccessReducer,
3200
- projectFileReducer,
3201
- rehydratedReducer,
3202
- formReducer,
3203
- formRevisionReducer,
3204
- formRevisionAttachmentReducer,
3205
- formSubmissionAttachmentReducer,
3206
- formSubmissionReducer,
3207
- userReducer,
3208
- workspaceReducer,
3209
- emailDomainsReducer,
3210
- licenseReducer,
3211
- documentsReducer,
3212
- documentAttachmentReducer,
3213
- teamReducer,
3214
- agentsReducer,
3215
- issueCommentReducer,
3216
- issueUpdateReducer,
3217
- geoImageReducer,
3218
- issueAssociationReducer
3058
+ });
3059
+ const {
3060
+ initializeIssueTypeFields,
3061
+ addIssueTypeFields,
3062
+ addIssueTypeFieldsMany,
3063
+ setIssueTypeFields,
3064
+ setIssueTypeFieldsMany,
3065
+ updateIssueTypeFields,
3066
+ updateIssueTypeFieldsMany,
3067
+ deleteIssueTypeFields,
3068
+ deleteIssueTypeFieldsMany
3069
+ } = issueTypeFieldsSlice.actions;
3070
+ const selectIssueTypeFieldsMapping = (state) => state.issueTypeFieldsReducer.instances;
3071
+ const selectIssueTypeFields = createSelector([selectIssueTypeFieldsMapping], (fieldsMapping) => {
3072
+ return Object.values(fieldsMapping);
3073
+ });
3074
+ const selectIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
3075
+ createSelector([selectIssueTypeFields, (_state, issueTypeId) => issueTypeId], (fields, issueTypeId) => {
3076
+ return fallbackToEmptyArray(fields.filter((field) => field.issue_type === issueTypeId));
3077
+ })
3078
+ );
3079
+ const selectIssueTypeFieldsById = (fieldsId) => (state) => {
3080
+ return state.issueTypeFieldsReducer.instances[fieldsId];
3219
3081
  };
3220
- const overmapReducer = combineReducers(overmapReducers);
3221
- const resetStore = "RESET";
3222
- const overmapRootReducer = (state, action) => {
3223
- if (action.type === "auth/setLoggedIn" && !action.payload) {
3224
- return overmapReducer(void 0, action);
3082
+ const issueTypeFieldsReducer = issueTypeFieldsSlice.reducer;
3083
+ const issueTypeFieldValuesAdapter = createModelAdapter(
3084
+ (fieldValues) => fieldValues.offline_id
3085
+ );
3086
+ const initialState$6 = issueTypeFieldValuesAdapter.getInitialState({});
3087
+ const issueTypeFieldValuesSlice = createSlice({
3088
+ name: "issueTypeFieldValues",
3089
+ initialState: initialState$6,
3090
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3091
+ reducers: {
3092
+ initializeIssueTypeFieldValues: issueTypeFieldValuesAdapter.initialize,
3093
+ addIssueTypeFieldValues: issueTypeFieldValuesAdapter.addOne,
3094
+ addIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.addMany,
3095
+ setIssueTypeFieldValues: issueTypeFieldValuesAdapter.setOne,
3096
+ setIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.setMany,
3097
+ updateIssueTypeFieldValues: issueTypeFieldValuesAdapter.updateOne,
3098
+ updateIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.updateMany,
3099
+ deleteIssueTypeFieldValues: issueTypeFieldValuesAdapter.deleteOne,
3100
+ deleteIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.deleteMany
3225
3101
  }
3226
- return overmapReducer(state, action);
3102
+ });
3103
+ const {
3104
+ initializeIssueTypeFieldValues,
3105
+ addIssueTypeFieldValues,
3106
+ addIssueTypeFieldValuesMany,
3107
+ setIssueTypeFieldValues,
3108
+ setIssueTypeFieldValuesMany,
3109
+ updateIssueTypeFieldValues,
3110
+ updateIssueTypeFieldValuesMany,
3111
+ deleteIssueTypeFieldValues,
3112
+ deleteIssueTypeFieldValuesMany
3113
+ } = issueTypeFieldValuesSlice.actions;
3114
+ const selectIssueTypeFieldValuesMapping = (state) => state.issueTypeFieldValuesReducer.instances;
3115
+ const selectIssueTypeFieldValues = createSelector([selectIssueTypeFieldValuesMapping], (fieldValuesMapping) => {
3116
+ return Object.values(fieldValuesMapping);
3117
+ });
3118
+ const selectIssueTypeFieldValuesOfIssue = restructureCreateSelectorWithArgs(
3119
+ createSelector([selectIssueTypeFieldValues, (_state, issueId) => issueId], (fieldValues, issueId) => {
3120
+ return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.issue === issueId));
3121
+ })
3122
+ );
3123
+ const selectIssueTypeFieldValuesById = (fieldValuesId) => (state) => {
3124
+ return state.issueTypeFieldValuesReducer.instances[fieldValuesId];
3227
3125
  };
3228
- let __OUTBOX_COORDINATOR = null;
3229
- function getOutboxCoordinator() {
3126
+ const issueTypeFieldValuesReducer = issueTypeFieldValuesSlice.reducer;
3127
+ const issueTypeFieldsAttachmentAdapter = createModelAdapter(
3128
+ (attachment) => attachment.offline_id
3129
+ );
3130
+ const initialState$5 = issueTypeFieldsAttachmentAdapter.getInitialState({});
3131
+ const issueTypeFieldsAttachmentSlice = createSlice({
3132
+ name: "issueTypeFieldsAttachments",
3133
+ initialState: initialState$5,
3134
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
3135
+ reducers: {
3136
+ initializeIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.initialize,
3137
+ addIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.addOne,
3138
+ addIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.addMany,
3139
+ setIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.setOne,
3140
+ setIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.setMany,
3141
+ updateIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.updateOne,
3142
+ updateIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.updateMany,
3143
+ deleteIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.deleteOne,
3144
+ deleteIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.deleteMany
3145
+ }
3146
+ });
3147
+ const {
3148
+ initializeIssueTypeFieldsAttachments,
3149
+ addIssueTypeFieldsAttachment,
3150
+ addIssueTypeFieldsAttachments,
3151
+ setIssueTypeFieldsAttachment,
3152
+ setIssueTypeFieldsAttachments,
3153
+ updateIssueTypeFieldsAttachment,
3154
+ updateIssueTypeFieldsAttachments,
3155
+ deleteIssueTypeFieldsAttachment,
3156
+ deleteIssueTypeFieldsAttachments
3157
+ } = issueTypeFieldsAttachmentSlice.actions;
3158
+ const selectIssueTypeFieldsAttachmentsMapping = (state) => state.issueTypeFieldsAttachmentReducer.instances;
3159
+ const selectIssueTypeFieldsAttachments = createSelector(
3160
+ [selectIssueTypeFieldsAttachmentsMapping],
3161
+ (attachmentsMapping) => {
3162
+ return Object.values(attachmentsMapping);
3163
+ }
3164
+ );
3165
+ const selectAttachmentsOfIssueTypeFields = restructureCreateSelectorWithArgs(
3166
+ createSelector(
3167
+ [selectIssueTypeFieldsAttachments, (_state, fieldsRevision) => fieldsRevision],
3168
+ (attachments, fieldsRevision) => {
3169
+ return fallbackToEmptyArray(
3170
+ attachments.filter((attachment) => attachment.fields_revision === fieldsRevision)
3171
+ );
3172
+ }
3173
+ )
3174
+ );
3175
+ const selectIssueTypeFieldsAttachmentById = (attachmentId) => (state) => {
3176
+ return state.issueTypeFieldsAttachmentReducer.instances[attachmentId];
3177
+ };
3178
+ const issueTypeFieldsAttachmentReducer = issueTypeFieldsAttachmentSlice.reducer;
3179
+ const issueTypeFieldValuesAttachmentAdapter = createModelAdapter(
3180
+ (attachment) => attachment.offline_id
3181
+ );
3182
+ const initialState$4 = issueTypeFieldValuesAttachmentAdapter.getInitialState({});
3183
+ const issueTypeFieldValuesAttachmentSlice = createSlice({
3184
+ name: "issueTypeFieldValuesAttachments",
3185
+ initialState: initialState$4,
3186
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
3187
+ reducers: {
3188
+ initializeIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.initialize,
3189
+ addIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.addOne,
3190
+ addIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.addMany,
3191
+ setIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.setOne,
3192
+ setIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.setMany,
3193
+ updateIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.updateOne,
3194
+ updateIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.updateMany,
3195
+ deleteIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.deleteOne,
3196
+ deleteIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.deleteMany
3197
+ }
3198
+ });
3199
+ const {
3200
+ initializeIssueTypeFieldValuesAttachments,
3201
+ addIssueTypeFieldValuesAttachment,
3202
+ addIssueTypeFieldValuesAttachments,
3203
+ setIssueTypeFieldValuesAttachment,
3204
+ setIssueTypeFieldValuesAttachments,
3205
+ updateIssueTypeFieldValuesAttachment,
3206
+ updateIssueTypeFieldValuesAttachments,
3207
+ deleteIssueTypeFieldValuesAttachment,
3208
+ deleteIssueTypeFieldValuesAttachments
3209
+ } = issueTypeFieldValuesAttachmentSlice.actions;
3210
+ const selectIssueTypeFieldValuesAttachmentsMapping = (state) => state.issueTypeFieldValuesAttachmentReducer.instances;
3211
+ const selectIssueTypeFieldValuesAttachments = createSelector(
3212
+ [selectIssueTypeFieldValuesAttachmentsMapping],
3213
+ (attachmentsMapping) => {
3214
+ return Object.values(attachmentsMapping);
3215
+ }
3216
+ );
3217
+ const selectAttachmentsOfIssueTypeFieldValues = restructureCreateSelectorWithArgs(
3218
+ createSelector(
3219
+ [selectIssueTypeFieldValuesAttachments, (_state, fieldValuesId) => fieldValuesId],
3220
+ (attachments, fieldValuesId) => {
3221
+ return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === fieldValuesId));
3222
+ }
3223
+ )
3224
+ );
3225
+ const selectIssueTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
3226
+ return state.issueTypeFieldValuesAttachmentReducer.instances[attachmentId];
3227
+ };
3228
+ const issueTypeFieldValuesAttachmentReducer = issueTypeFieldValuesAttachmentSlice.reducer;
3229
+ const assetTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
3230
+ const initialState$3 = assetTypeFieldsAdapter.getInitialState({});
3231
+ const assetTypeFieldsSlice = createSlice({
3232
+ name: "assetTypeFields",
3233
+ initialState: initialState$3,
3234
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
3235
+ reducers: {
3236
+ initializeAssetTypeFields: assetTypeFieldsAdapter.initialize,
3237
+ addAssetTypeFields: assetTypeFieldsAdapter.addOne,
3238
+ addAssetTypeFieldsMany: assetTypeFieldsAdapter.addMany,
3239
+ setAssetTypeFields: assetTypeFieldsAdapter.setOne,
3240
+ setAssetTypeFieldsMany: assetTypeFieldsAdapter.setMany,
3241
+ updateAssetTypeFields: assetTypeFieldsAdapter.updateOne,
3242
+ updateAssetTypeFieldsMany: assetTypeFieldsAdapter.updateMany,
3243
+ deleteAssetTypeFields: assetTypeFieldsAdapter.deleteOne,
3244
+ deleteAssetTypeFieldsMany: assetTypeFieldsAdapter.deleteMany
3245
+ }
3246
+ });
3247
+ const {
3248
+ initializeAssetTypeFields,
3249
+ addAssetTypeFields,
3250
+ addAssetTypeFieldsMany,
3251
+ setAssetTypeFields,
3252
+ setAssetTypeFieldsMany,
3253
+ updateAssetTypeFields,
3254
+ updateAssetTypeFieldsMany,
3255
+ deleteAssetTypeFields,
3256
+ deleteAssetTypeFieldsMany
3257
+ } = assetTypeFieldsSlice.actions;
3258
+ const selectAssetTypeFieldsMapping = (state) => state.assetTypeFieldsReducer.instances;
3259
+ const selectAssetTypeFields = createSelector([selectAssetTypeFieldsMapping], (fieldsMapping) => {
3260
+ return Object.values(fieldsMapping);
3261
+ });
3262
+ const selectAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
3263
+ createSelector([selectAssetTypeFields, (_state, assetTypeId) => assetTypeId], (fields, assetTypeId) => {
3264
+ return fallbackToEmptyArray(fields.filter((field) => field.asset_type === assetTypeId));
3265
+ })
3266
+ );
3267
+ const selectAssetTypeFieldsById = (fieldsId) => (state) => {
3268
+ return state.assetTypeFieldsReducer.instances[fieldsId];
3269
+ };
3270
+ const assetTypeFieldsReducer = assetTypeFieldsSlice.reducer;
3271
+ const assetTypeFieldValuesAdapter = createModelAdapter(
3272
+ (fieldValues) => fieldValues.offline_id
3273
+ );
3274
+ const initialState$2 = assetTypeFieldValuesAdapter.getInitialState({});
3275
+ const assetTypeFieldValuesSlice = createSlice({
3276
+ name: "assetTypeFieldValues",
3277
+ initialState: initialState$2,
3278
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
3279
+ reducers: {
3280
+ initializeAssetTypeFieldValues: assetTypeFieldValuesAdapter.initialize,
3281
+ addAssetTypeFieldValues: assetTypeFieldValuesAdapter.addOne,
3282
+ addAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.addMany,
3283
+ setAssetTypeFieldValues: assetTypeFieldValuesAdapter.setOne,
3284
+ setAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.setMany,
3285
+ updateAssetTypeFieldValues: assetTypeFieldValuesAdapter.updateOne,
3286
+ updateAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.updateMany,
3287
+ deleteAssetTypeFieldValues: assetTypeFieldValuesAdapter.deleteOne,
3288
+ deleteAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.deleteMany
3289
+ }
3290
+ });
3291
+ const {
3292
+ initializeAssetTypeFieldValues,
3293
+ addAssetTypeFieldValues,
3294
+ addAssetTypeFieldValuesMany,
3295
+ setAssetTypeFieldValues,
3296
+ setAssetTypeFieldValuesMany,
3297
+ updateAssetTypeFieldValues,
3298
+ updateAssetTypeFieldValuesMany,
3299
+ deleteAssetTypeFieldValues,
3300
+ deleteAssetTypeFieldValuesMany
3301
+ } = assetTypeFieldValuesSlice.actions;
3302
+ const selectAssetTypeFieldValuesMapping = (state) => state.assetTypeFieldValuesReducer.instances;
3303
+ const selectAssetTypeFieldValues = createSelector([selectAssetTypeFieldValuesMapping], (fieldValuesMapping) => {
3304
+ return Object.values(fieldValuesMapping);
3305
+ });
3306
+ const selectAssetTypeFieldValuesOfAsset = restructureCreateSelectorWithArgs(
3307
+ createSelector([selectAssetTypeFieldValues, (_state, assetId) => assetId], (fieldValues, assetId) => {
3308
+ return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.asset === assetId));
3309
+ })
3310
+ );
3311
+ const selectAssetTypeFieldValuesById = (fieldValuesId) => (state) => {
3312
+ return state.assetTypeFieldValuesReducer.instances[fieldValuesId];
3313
+ };
3314
+ const assetTypeFieldValuesReducer = assetTypeFieldValuesSlice.reducer;
3315
+ const assetTypeFieldsAttachmentAdapter = createModelAdapter(
3316
+ (attachment) => attachment.offline_id
3317
+ );
3318
+ const initialState$1 = assetTypeFieldsAttachmentAdapter.getInitialState({});
3319
+ const assetTypeFieldsAttachmentSlice = createSlice({
3320
+ name: "assetTypeFieldsAttachments",
3321
+ initialState: initialState$1,
3322
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
3323
+ reducers: {
3324
+ initializeAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.initialize,
3325
+ addAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.addOne,
3326
+ addAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.addMany,
3327
+ setAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.setOne,
3328
+ setAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.setMany,
3329
+ updateAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.updateOne,
3330
+ updateAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.updateMany,
3331
+ deleteAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.deleteOne,
3332
+ deleteAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.deleteMany
3333
+ }
3334
+ });
3335
+ const {
3336
+ initializeAssetTypeFieldsAttachments,
3337
+ addAssetTypeFieldsAttachment,
3338
+ addAssetTypeFieldsAttachments,
3339
+ setAssetTypeFieldsAttachment,
3340
+ setAssetTypeFieldsAttachments,
3341
+ updateAssetTypeFieldsAttachment,
3342
+ updateAssetTypeFieldsAttachments,
3343
+ deleteAssetTypeFieldsAttachment,
3344
+ deleteAssetTypeFieldsAttachments
3345
+ } = assetTypeFieldsAttachmentSlice.actions;
3346
+ const selectAssetTypeFieldsAttachmentsMapping = (state) => state.assetTypeFieldsAttachmentReducer.instances;
3347
+ const selectAssetTypeFieldsAttachments = createSelector(
3348
+ [selectAssetTypeFieldsAttachmentsMapping],
3349
+ (attachmentsMapping) => {
3350
+ return Object.values(attachmentsMapping);
3351
+ }
3352
+ );
3353
+ const selectAttachmentsOfAssetTypeFields = restructureCreateSelectorWithArgs(
3354
+ createSelector([selectAssetTypeFieldsAttachments, (_state, id) => id], (attachments, id) => {
3355
+ return fallbackToEmptyArray(attachments.filter((attachment) => attachment.fields_revision === id));
3356
+ })
3357
+ );
3358
+ const selectAssetTypeFieldsAttachmentById = (attachmentId) => (state) => {
3359
+ return state.assetTypeFieldsAttachmentReducer.instances[attachmentId];
3360
+ };
3361
+ const assetTypeFieldsAttachmentReducer = assetTypeFieldsAttachmentSlice.reducer;
3362
+ const assetTypeFieldValuesAttachmentAdapter = createModelAdapter(
3363
+ (attachment) => attachment.offline_id
3364
+ );
3365
+ const initialState = assetTypeFieldValuesAttachmentAdapter.getInitialState({});
3366
+ const assetTypeFieldValuesAttachmentSlice = createSlice({
3367
+ name: "assetTypeFieldValuesAttachments",
3368
+ initialState,
3369
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
3370
+ reducers: {
3371
+ initializeAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.initialize,
3372
+ addAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.addOne,
3373
+ addAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.addMany,
3374
+ setAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.setOne,
3375
+ setAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.setMany,
3376
+ updateAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.updateOne,
3377
+ updateAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.updateMany,
3378
+ deleteAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.deleteOne,
3379
+ deleteAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.deleteMany
3380
+ }
3381
+ });
3382
+ const {
3383
+ initializeAssetTypeFieldValuesAttachments,
3384
+ addAssetTypeFieldValuesAttachment,
3385
+ addAssetTypeFieldValuesAttachments,
3386
+ setAssetTypeFieldValuesAttachment,
3387
+ setAssetTypeFieldValuesAttachments,
3388
+ updateAssetTypeFieldValuesAttachment,
3389
+ updateAssetTypeFieldValuesAttachments,
3390
+ deleteAssetTypeFieldValuesAttachment,
3391
+ deleteAssetTypeFieldValuesAttachments
3392
+ } = assetTypeFieldValuesAttachmentSlice.actions;
3393
+ const selectAssetTypeFieldValuesAttachmentsMapping = (state) => state.assetTypeFieldValuesAttachmentReducer.instances;
3394
+ const selectAssetTypeFieldValuesAttachments = createSelector(
3395
+ [selectAssetTypeFieldValuesAttachmentsMapping],
3396
+ (attachmentsMapping) => {
3397
+ return Object.values(attachmentsMapping);
3398
+ }
3399
+ );
3400
+ const selectAttachmentsOfAssetTypeFieldValues = restructureCreateSelectorWithArgs(
3401
+ createSelector([selectAssetTypeFieldValuesAttachments, (_state, id) => id], (attachments, id) => {
3402
+ return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === id));
3403
+ })
3404
+ );
3405
+ const selectAssetTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
3406
+ return state.assetTypeFieldValuesAttachmentReducer.instances[attachmentId];
3407
+ };
3408
+ const assetTypeFieldValuesAttachmentReducer = assetTypeFieldValuesAttachmentSlice.reducer;
3409
+ let clientStore;
3410
+ function setClientStore(store) {
3411
+ clientStore = store;
3412
+ }
3413
+ function getClientStore() {
3414
+ return clientStore;
3415
+ }
3416
+ let clientSDK;
3417
+ function setClientSDK(sdkCtor) {
3418
+ clientSDK = sdkCtor;
3419
+ }
3420
+ function getClientSDK() {
3421
+ return clientSDK;
3422
+ }
3423
+ const CLASS_NAME_TO_SERVICE = {};
3424
+ class BaseService {
3425
+ constructor(sdk) {
3426
+ __publicField(this, "client");
3427
+ CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
3428
+ this.client = sdk;
3429
+ }
3430
+ async enqueueRequest(requestDetails) {
3431
+ return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
3432
+ }
3433
+ dispatch(action) {
3434
+ this.client.store.dispatch(action);
3435
+ }
3436
+ }
3437
+ const VERSION_REDUCER_KEY = "versioning";
3438
+ const overmapReducers = {
3439
+ // TODO: attachmentReducer,
3440
+ [VERSION_REDUCER_KEY]: versioningReducer,
3441
+ fileReducer,
3442
+ authReducer,
3443
+ categoryReducer,
3444
+ assetReducer,
3445
+ assetAttachmentReducer,
3446
+ assetStageCompletionReducer,
3447
+ assetStageReducer,
3448
+ assetTypeReducer,
3449
+ assetTypeAttachmentReducer,
3450
+ issueReducer,
3451
+ issueAttachmentReducer,
3452
+ issueTypeReducer,
3453
+ organizationReducer,
3454
+ outboxReducer,
3455
+ projectReducer,
3456
+ projectAttachmentReducer,
3457
+ projectAccessReducer,
3458
+ organizationAccessReducer,
3459
+ projectFileReducer,
3460
+ rehydratedReducer,
3461
+ formReducer,
3462
+ formRevisionReducer,
3463
+ formRevisionAttachmentReducer,
3464
+ formSubmissionAttachmentReducer,
3465
+ formSubmissionReducer,
3466
+ userReducer,
3467
+ workspaceReducer,
3468
+ emailDomainsReducer,
3469
+ licenseReducer,
3470
+ documentsReducer,
3471
+ documentAttachmentReducer,
3472
+ teamReducer,
3473
+ agentsReducer,
3474
+ issueCommentReducer,
3475
+ issueUpdateReducer,
3476
+ geoImageReducer,
3477
+ issueAssociationReducer,
3478
+ issueTypeFieldsReducer,
3479
+ issueTypeFieldValuesReducer,
3480
+ issueTypeFieldsAttachmentReducer,
3481
+ issueTypeFieldValuesAttachmentReducer,
3482
+ assetTypeFieldsReducer,
3483
+ assetTypeFieldValuesReducer,
3484
+ assetTypeFieldsAttachmentReducer,
3485
+ assetTypeFieldValuesAttachmentReducer
3486
+ };
3487
+ const overmapReducer = combineReducers(overmapReducers);
3488
+ const resetStore = "RESET";
3489
+ const overmapRootReducer = (state, action) => {
3490
+ if (action.type === "auth/setLoggedIn" && !action.payload) {
3491
+ return overmapReducer(void 0, action);
3492
+ }
3493
+ return overmapReducer(state, action);
3494
+ };
3495
+ let __OUTBOX_COORDINATOR = null;
3496
+ function getOutboxCoordinator() {
3230
3497
  const clientStore2 = getClientStore();
3231
3498
  if (!clientStore2) {
3232
3499
  console.warn("Client store not set; cannot get outbox coordinator yet.");
@@ -3857,9 +4124,6 @@ class CategoryService extends BaseApiService {
3857
4124
  description: "Create Category",
3858
4125
  method: HttpMethod.POST,
3859
4126
  url: "/categories/",
3860
- queryParams: {
3861
- workspace_id: payload.workspace.toString()
3862
- },
3863
4127
  payload: offlineCategory,
3864
4128
  blockers: [payload.workspace],
3865
4129
  blocks: [offlineCategory.offline_id]
@@ -4072,7 +4336,10 @@ class AssetService extends BaseApiService {
4072
4336
  const result = await this.enqueueRequest({
4073
4337
  description: "Get assets",
4074
4338
  method: HttpMethod.GET,
4075
- url: `/projects/${projectId}/assets/`,
4339
+ url: "/assets/",
4340
+ queryParams: {
4341
+ project: projectId.toString()
4342
+ },
4076
4343
  blockers: [],
4077
4344
  blocks: []
4078
4345
  });
@@ -4093,7 +4360,7 @@ class AssetStageCompletionService extends BaseApiService {
4093
4360
  const promise = this.enqueueRequest({
4094
4361
  description: "Add asset stage completion",
4095
4362
  method: HttpMethod.POST,
4096
- url: "/assets/completions/",
4363
+ url: "/asset-stage-completions/",
4097
4364
  payload: {
4098
4365
  offline_id: offlineStageCompletion.offline_id,
4099
4366
  submitted_at: submittedAt,
@@ -4120,7 +4387,7 @@ class AssetStageCompletionService extends BaseApiService {
4120
4387
  const promise = this.enqueueRequest({
4121
4388
  description: "Delete asset stage completion",
4122
4389
  method: HttpMethod.DELETE,
4123
- url: `/assets/completions/${id}/`,
4390
+ url: `/asset-stage-completions/${id}/`,
4124
4391
  blockers: [id],
4125
4392
  blocks: []
4126
4393
  });
@@ -4146,7 +4413,7 @@ class AssetStageCompletionService extends BaseApiService {
4146
4413
  const promise = this.enqueueRequest({
4147
4414
  description: "Bulk create asset stage completions",
4148
4415
  method: HttpMethod.POST,
4149
- url: "/assets/completions/bulk/",
4416
+ url: "/asset-stage-completions/bulk/",
4150
4417
  payload: {
4151
4418
  submitted_at: submittedAt,
4152
4419
  completions: payload
@@ -4168,7 +4435,7 @@ class AssetStageCompletionService extends BaseApiService {
4168
4435
  const promise = this.enqueueRequest({
4169
4436
  description: "Deleting asset stage completions",
4170
4437
  method: HttpMethod.DELETE,
4171
- url: "/assets/completions/bulk/",
4438
+ url: "/asset-stage-completions/bulk/",
4172
4439
  payload: {
4173
4440
  completion_ids: ids
4174
4441
  },
@@ -4184,7 +4451,10 @@ class AssetStageCompletionService extends BaseApiService {
4184
4451
  const result = await this.enqueueRequest({
4185
4452
  description: "Get asset stage completions",
4186
4453
  method: HttpMethod.GET,
4187
- url: `/projects/${projectId}/asset-stage-completions/`,
4454
+ url: "/asset-stage-completions/",
4455
+ queryParams: {
4456
+ project: projectId.toString()
4457
+ },
4188
4458
  blockers: [],
4189
4459
  blocks: []
4190
4460
  });
@@ -4205,7 +4475,7 @@ class AssetStageService extends BaseApiService {
4205
4475
  const promise = this.enqueueRequest({
4206
4476
  description: "Add asset stages",
4207
4477
  method: HttpMethod.POST,
4208
- url: "/assets/stages/bulk/",
4478
+ url: "/asset-stages/bulk/",
4209
4479
  payload: {
4210
4480
  submitted_at: submittedAt,
4211
4481
  asset_type: assetTypeId,
@@ -4229,7 +4499,7 @@ class AssetStageService extends BaseApiService {
4229
4499
  return this.enqueueRequest({
4230
4500
  description: "Edit asset stages",
4231
4501
  method: HttpMethod.PATCH,
4232
- url: `/assets/types/${assetTypeId}/bulk-update-stages/`,
4502
+ url: `/asset-types/${assetTypeId}/bulk-update-stages/`,
4233
4503
  payload: {
4234
4504
  stages: stagesToUpdate
4235
4505
  },
@@ -4247,7 +4517,7 @@ class AssetStageService extends BaseApiService {
4247
4517
  const promise = this.enqueueRequest({
4248
4518
  description: "Delete asset stages",
4249
4519
  method: HttpMethod.DELETE,
4250
- url: "/assets/stages/bulk/",
4520
+ url: "/asset-stages/bulk/",
4251
4521
  payload: {
4252
4522
  stage_ids: idsToDelete
4253
4523
  },
@@ -4272,7 +4542,7 @@ class AssetStageService extends BaseApiService {
4272
4542
  const promise = this.enqueueRequest({
4273
4543
  description: "Update asset stage",
4274
4544
  method: HttpMethod.PATCH,
4275
- url: `/assets/stages/${assetStage.offline_id}/`,
4545
+ url: `/asset-stages/${assetStage.offline_id}/`,
4276
4546
  payload: {
4277
4547
  name: payload.name,
4278
4548
  description: payload.description,
@@ -4300,7 +4570,7 @@ class AssetStageService extends BaseApiService {
4300
4570
  await this.enqueueRequest({
4301
4571
  description: "Link asset stage to form",
4302
4572
  method: HttpMethod.POST,
4303
- url: `/assets/stages/${stageId}/associate-with-form/`,
4573
+ url: `/asset-stages/${stageId}/associate-with-form/`,
4304
4574
  payload: { form: formId },
4305
4575
  blockers: [stageId, formId],
4306
4576
  blocks: [stageId]
@@ -4321,7 +4591,7 @@ class AssetStageService extends BaseApiService {
4321
4591
  await this.enqueueRequest({
4322
4592
  description: "Unlink asset stage from form",
4323
4593
  method: HttpMethod.DELETE,
4324
- url: `/assets/stages/${stageId}/associate-with-form/`,
4594
+ url: `/asset-stages/${stageId}/associate-with-form/`,
4325
4595
  blockers: [stageId, formId],
4326
4596
  blocks: [stageId]
4327
4597
  });
@@ -4334,7 +4604,10 @@ class AssetStageService extends BaseApiService {
4334
4604
  const result = await this.enqueueRequest({
4335
4605
  description: "Get asset stages",
4336
4606
  method: HttpMethod.GET,
4337
- url: `/projects/${projectId}/asset-stages/`,
4607
+ url: "/asset-stages/",
4608
+ queryParams: {
4609
+ project: projectId.toString()
4610
+ },
4338
4611
  blockers: [],
4339
4612
  blocks: []
4340
4613
  });
@@ -4351,7 +4624,12 @@ class BaseUploadService extends BaseApiService {
4351
4624
  projectAttachmentReducer: projectAttachmentReducer2,
4352
4625
  formRevisionAttachmentReducer: formRevisionAttachmentReducer2,
4353
4626
  formSubmissionAttachmentReducer: formSubmissionAttachmentReducer2,
4354
- geoImageReducer: geoImageReducer2
4627
+ geoImageReducer: geoImageReducer2,
4628
+ // fields
4629
+ assetTypeFieldsAttachmentReducer: assetTypeFieldsAttachmentReducer2,
4630
+ assetTypeFieldValuesAttachmentReducer: assetTypeFieldValuesAttachmentReducer2,
4631
+ issueTypeFieldsAttachmentReducer: issueTypeFieldsAttachmentReducer2,
4632
+ issueTypeFieldValuesAttachmentReducer: issueTypeFieldValuesAttachmentReducer2
4355
4633
  } = this.client.store.getState();
4356
4634
  const objectsWithSha1 = [].concat(
4357
4635
  Object.values(issueAttachmentReducer2.instances),
@@ -4361,7 +4639,11 @@ class BaseUploadService extends BaseApiService {
4361
4639
  Object.values(projectAttachmentReducer2.instances),
4362
4640
  Object.values(formRevisionAttachmentReducer2.instances),
4363
4641
  Object.values(formSubmissionAttachmentReducer2.instances),
4364
- Object.values(geoImageReducer2.instances)
4642
+ Object.values(geoImageReducer2.instances),
4643
+ Object.values(assetTypeFieldsAttachmentReducer2.instances),
4644
+ Object.values(assetTypeFieldValuesAttachmentReducer2.instances),
4645
+ Object.values(issueTypeFieldsAttachmentReducer2.instances),
4646
+ Object.values(issueTypeFieldValuesAttachmentReducer2.instances)
4365
4647
  );
4366
4648
  return objectsWithSha1.filter((object) => object.file_sha1 === sha1).length;
4367
4649
  }
@@ -4383,41 +4665,20 @@ class BaseUploadService extends BaseApiService {
4383
4665
  }
4384
4666
  return promisesBySha1;
4385
4667
  }
4386
- }
4387
- const AttachmentModelMeta = {
4388
- [AttachmentModel.Issue]: {
4389
- name: "issue",
4390
- attachUrlPrefix: "/issues",
4391
- deleteUrlPrefix: "/issues",
4392
- fetchUrlPostfix: "/issue-attachments"
4393
- },
4394
- [AttachmentModel.Asset]: {
4395
- name: "asset",
4396
- attachUrlPrefix: "/assets",
4397
- deleteUrlPrefix: "/assets",
4398
- fetchUrlPostfix: "/asset-attachments"
4399
- },
4400
- [AttachmentModel.AssetType]: {
4401
- name: "asset type",
4402
- attachUrlPrefix: "/assets/types",
4403
- deleteUrlPrefix: "/assets/types",
4404
- fetchUrlPostfix: "/asset-type-attachments"
4405
- },
4406
- [AttachmentModel.Project]: {
4407
- name: "project",
4408
- attachUrlPrefix: "/projects",
4409
- deleteUrlPrefix: "/projects",
4410
- fetchUrlPostfix: "/attachments"
4411
- },
4412
- [AttachmentModel.Document]: {
4413
- name: "document",
4414
- attachUrlPrefix: "/documents",
4415
- deleteUrlPrefix: "/documents",
4416
- fetchUrlPostfix: "/document-attachments"
4668
+ async getFilePayload(file) {
4669
+ const sha1 = await hashFile(file);
4670
+ const filePayload = {
4671
+ sha1,
4672
+ file_type: file.type,
4673
+ extension: file.name.split(".").pop(),
4674
+ size: file.size
4675
+ };
4676
+ await this.client.files.addCache(file, sha1);
4677
+ return filePayload;
4417
4678
  }
4418
- };
4679
+ }
4419
4680
  class BaseAttachmentService extends BaseUploadService {
4420
- async attachFiles(files, modelId, buildOfflineAttachment) {
4681
+ async _bulkAdd(payloads) {
4421
4682
  var _a2;
4422
4683
  const { store } = this.client;
4423
4684
  const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
@@ -4425,39 +4686,36 @@ class BaseAttachmentService extends BaseUploadService {
4425
4686
  const offlineAttachments = [];
4426
4687
  const attachmentPayloads = [];
4427
4688
  const filePayloads = {};
4428
- for (const file of files) {
4429
- const sha1 = await hashFile(file);
4430
- if (!(sha1 in filePayloads)) {
4431
- filePayloads[sha1] = {
4432
- sha1,
4433
- file_type: file.type,
4434
- extension: file.name.split(".").pop(),
4435
- size: file.size
4436
- };
4437
- await this.client.files.addCache(file, sha1);
4438
- }
4439
- const offlineAttachment = buildOfflineAttachment({
4689
+ for (const payload of payloads) {
4690
+ const { modelId, file } = payload;
4691
+ const filePayload = await this.getFilePayload(file);
4692
+ if (!(filePayload.sha1 in filePayloads))
4693
+ filePayloads[filePayload.sha1] = filePayload;
4694
+ const offlineAttachment = this.buildOfflineAttachment({
4440
4695
  file,
4441
- sha1,
4442
- submittedAt,
4443
- createdBy,
4696
+ file_sha1: filePayload.sha1,
4697
+ submitted_at: submittedAt,
4698
+ created_by: createdBy,
4444
4699
  description: "",
4445
4700
  modelId
4446
4701
  });
4447
4702
  offlineAttachments.push(offlineAttachment);
4448
- attachmentPayloads.push({
4449
- offline_id: offlineAttachment.offline_id,
4450
- name: offlineAttachment.file_name,
4451
- sha1: offlineAttachment.file_sha1,
4452
- description: offlineAttachment.description
4453
- });
4703
+ attachmentPayloads.push(
4704
+ this.buildAttachmentPayload({
4705
+ offline_id: offlineAttachment.offline_id,
4706
+ file_name: offlineAttachment.file_name,
4707
+ file_sha1: offlineAttachment.file_sha1,
4708
+ file_extension: filePayload.extension,
4709
+ description: offlineAttachment.description,
4710
+ modelId
4711
+ })
4712
+ );
4454
4713
  }
4455
4714
  this.dispatch(this.addAttachments(offlineAttachments));
4456
- const meta = AttachmentModelMeta[this.attachmentModel];
4457
4715
  const promise = this.enqueueRequest({
4458
- description: `Attach files to ${meta.name}`,
4716
+ description: `Add ${this.name}`,
4459
4717
  method: HttpMethod.POST,
4460
- url: `${meta.attachUrlPrefix}/${modelId}/attach/`,
4718
+ url: `${this.url}/bulk/`,
4461
4719
  payload: {
4462
4720
  submitted_at: submittedAt,
4463
4721
  attachments: attachmentPayloads,
@@ -4474,7 +4732,7 @@ class BaseAttachmentService extends BaseUploadService {
4474
4732
  });
4475
4733
  return [offlineAttachments, promise.then(({ attachments }) => attachments)];
4476
4734
  }
4477
- async deleteAttachment(attachmendId) {
4735
+ async _delete(attachmendId) {
4478
4736
  const { store } = this.client;
4479
4737
  const attachment = this.selectAttachment(attachmendId)(store.getState());
4480
4738
  if (!attachment) {
@@ -4483,11 +4741,10 @@ class BaseAttachmentService extends BaseUploadService {
4483
4741
  );
4484
4742
  }
4485
4743
  this.dispatch(this.removeAttachment(attachment.offline_id));
4486
- const meta = AttachmentModelMeta[this.attachmentModel];
4487
4744
  const promise = this.enqueueRequest({
4488
- description: "Delete attachment",
4745
+ description: `Delete ${this.name}`,
4489
4746
  method: HttpMethod.DELETE,
4490
- url: `${meta.deleteUrlPrefix}/attachments/${attachmendId}/`,
4747
+ url: `${this.url}/${attachmendId}/`,
4491
4748
  blockers: [attachmendId],
4492
4749
  blocks: []
4493
4750
  });
@@ -4500,24 +4757,12 @@ class BaseAttachmentService extends BaseUploadService {
4500
4757
  });
4501
4758
  return promise;
4502
4759
  }
4503
- // Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
4504
- // so for some attachment model services, this method will have to be overridden.
4505
- async refreshStore(projectId, _organizationId) {
4506
- const meta = AttachmentModelMeta[this.attachmentModel];
4507
- const result = await this.enqueueRequest({
4508
- description: `Get ${meta.name} attachments`,
4509
- method: HttpMethod.GET,
4510
- url: `/projects/${projectId}${meta.fetchUrlPostfix}/`,
4511
- blocks: [],
4512
- blockers: []
4513
- });
4514
- this.dispatch(this.initializeAttachments(result));
4515
- }
4516
4760
  }
4517
4761
  class AssetAttachmentService extends BaseAttachmentService {
4518
4762
  constructor() {
4519
4763
  super(...arguments);
4520
- __publicField(this, "attachmentModel", AttachmentModel.Asset);
4764
+ __publicField(this, "name", "Asset Attachment");
4765
+ __publicField(this, "url", "/asset-attachments");
4521
4766
  __publicField(this, "initializeAttachments", initializeAssetAttachments);
4522
4767
  __publicField(this, "addAttachments", addAssetAttachments);
4523
4768
  __publicField(this, "updateAttachments", updateAssetAttachments);
@@ -4529,20 +4774,39 @@ class AssetAttachmentService extends BaseAttachmentService {
4529
4774
  buildOfflineAttachment(data) {
4530
4775
  return offline({
4531
4776
  file: URL.createObjectURL(data.file),
4532
- file_sha1: data.sha1,
4533
- created_by: data.createdBy,
4777
+ file_sha1: data.file_sha1,
4778
+ created_by: data.created_by,
4534
4779
  file_name: data.file.name,
4535
4780
  file_type: data.file.type,
4536
- submitted_at: data.submittedAt,
4781
+ submitted_at: data.submitted_at,
4537
4782
  description: data.description,
4538
4783
  asset: data.modelId
4539
4784
  });
4540
4785
  }
4541
- async attachFilesToAsset(files, assetId) {
4542
- return this.attachFiles(files, assetId, this.buildOfflineAttachment.bind(this));
4786
+ buildAttachmentPayload(data) {
4787
+ return {
4788
+ ...data,
4789
+ asset: data.modelId
4790
+ };
4791
+ }
4792
+ async bulkAdd(payloads) {
4793
+ return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetId, file: p.file })));
4543
4794
  }
4544
- async deleteAssetAttachment(attachmentId) {
4545
- return this.deleteAttachment(attachmentId);
4795
+ async delete(id) {
4796
+ return this._delete(id);
4797
+ }
4798
+ async refreshStore(projectId) {
4799
+ const result = await this.enqueueRequest({
4800
+ description: "Get asset attachments",
4801
+ method: HttpMethod.GET,
4802
+ url: `${this.url}/`,
4803
+ queryParams: {
4804
+ project: projectId.toString()
4805
+ },
4806
+ blocks: [],
4807
+ blockers: []
4808
+ });
4809
+ this.dispatch(initializeAssetAttachments(result));
4546
4810
  }
4547
4811
  }
4548
4812
  class AssetTypeService extends BaseApiService {
@@ -4559,7 +4823,7 @@ class AssetTypeService extends BaseApiService {
4559
4823
  const promise = this.enqueueRequest({
4560
4824
  description: "Create asset type",
4561
4825
  method: HttpMethod.POST,
4562
- url: `/projects/${payload.project}/asset-types/`,
4826
+ url: "/asset-types/",
4563
4827
  payload: { ...offlineAssetType },
4564
4828
  blockers: [],
4565
4829
  blocks: [offlineAssetType.offline_id]
@@ -4585,7 +4849,7 @@ class AssetTypeService extends BaseApiService {
4585
4849
  const promise = this.enqueueRequest({
4586
4850
  description: "Update asset type",
4587
4851
  method: HttpMethod.PATCH,
4588
- url: `/assets/types/${payload.offline_id}/`,
4852
+ url: `/asset-types/${payload.offline_id}/`,
4589
4853
  payload: {
4590
4854
  icon: payload.icon,
4591
4855
  color: payload.color,
@@ -4619,7 +4883,7 @@ class AssetTypeService extends BaseApiService {
4619
4883
  return this.enqueueRequest({
4620
4884
  description: "Delete asset type",
4621
4885
  method: HttpMethod.DELETE,
4622
- url: `/assets/types/${assetTypeId}/`,
4886
+ url: `/asset-types/${assetTypeId}/`,
4623
4887
  blockers: [assetTypeId],
4624
4888
  blocks: []
4625
4889
  }).catch((e) => {
@@ -4634,7 +4898,10 @@ class AssetTypeService extends BaseApiService {
4634
4898
  const result = await this.enqueueRequest({
4635
4899
  description: "Get asset types",
4636
4900
  method: HttpMethod.GET,
4637
- url: `/projects/${projectId}/asset-types/`,
4901
+ url: "/asset-types/",
4902
+ queryParams: {
4903
+ project: projectId.toString()
4904
+ },
4638
4905
  blockers: [],
4639
4906
  blocks: []
4640
4907
  });
@@ -4644,8 +4911,8 @@ class AssetTypeService extends BaseApiService {
4644
4911
  class AssetTypeAttachmentService extends BaseAttachmentService {
4645
4912
  constructor() {
4646
4913
  super(...arguments);
4647
- __publicField(this, "attachmentModel", AttachmentModel.AssetType);
4648
- __publicField(this, "initializeAttachments", initializeAssetTypeAttachments);
4914
+ __publicField(this, "name", "Asset Type Attachment");
4915
+ __publicField(this, "url", "/asset-type-attachments");
4649
4916
  __publicField(this, "addAttachments", addAssetTypeAttachments);
4650
4917
  __publicField(this, "updateAttachments", updateAssetTypeAttachments);
4651
4918
  __publicField(this, "removeAttachments", deleteAssetTypeAttachments);
@@ -4656,20 +4923,39 @@ class AssetTypeAttachmentService extends BaseAttachmentService {
4656
4923
  buildOfflineAttachment(data) {
4657
4924
  return offline({
4658
4925
  file: URL.createObjectURL(data.file),
4659
- file_sha1: data.sha1,
4660
- created_by: data.createdBy,
4926
+ file_sha1: data.file_sha1,
4927
+ created_by: data.created_by,
4661
4928
  file_name: data.file.name,
4662
4929
  file_type: data.file.type,
4663
- submitted_at: data.submittedAt,
4930
+ submitted_at: data.submitted_at,
4664
4931
  description: data.description,
4665
4932
  asset_type: data.modelId
4666
4933
  });
4667
4934
  }
4668
- async attachFilesToAssetType(files, assetTypeId) {
4669
- return this.attachFiles(files, assetTypeId, this.buildOfflineAttachment.bind(this));
4935
+ buildAttachmentPayload(data) {
4936
+ return {
4937
+ ...data,
4938
+ asset_type: data.modelId
4939
+ };
4940
+ }
4941
+ async bulkAdd(payloads) {
4942
+ return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetTypeId, file: p.file })));
4670
4943
  }
4671
- async deleteAssetTypeAttachment(attachmentId) {
4672
- return this.deleteAttachment(attachmentId);
4944
+ async delete(attachmentId) {
4945
+ return this._delete(attachmentId);
4946
+ }
4947
+ async refreshStore(projectId) {
4948
+ const result = await this.enqueueRequest({
4949
+ description: "Get asset type attachments",
4950
+ method: HttpMethod.GET,
4951
+ url: `${this.url}/`,
4952
+ queryParams: {
4953
+ project: projectId.toString()
4954
+ },
4955
+ blocks: [],
4956
+ blockers: []
4957
+ });
4958
+ this.dispatch(initializeAssetTypeAttachments(result));
4673
4959
  }
4674
4960
  }
4675
4961
  class IssueCommentService extends BaseApiService {
@@ -4685,7 +4971,7 @@ class IssueCommentService extends BaseApiService {
4685
4971
  const promise = this.enqueueRequest({
4686
4972
  description: "Add issue comment",
4687
4973
  method: HttpMethod.POST,
4688
- url: `/issues/${payload.issue}/comment/`,
4974
+ url: "/issue-comments/",
4689
4975
  payload: offlineComment,
4690
4976
  blockers: [payload.issue],
4691
4977
  blocks: [offlineComment.offline_id]
@@ -4709,7 +4995,7 @@ class IssueCommentService extends BaseApiService {
4709
4995
  const promise = this.enqueueRequest({
4710
4996
  description: "Edit issue comment",
4711
4997
  method: HttpMethod.PATCH,
4712
- url: `/issues/comments/${payload.offline_id}/`,
4998
+ url: `/issue-comments/${payload.offline_id}/`,
4713
4999
  payload,
4714
5000
  blockers: [payload.offline_id],
4715
5001
  blocks: [payload.offline_id]
@@ -4728,7 +5014,7 @@ class IssueCommentService extends BaseApiService {
4728
5014
  const promise = this.enqueueRequest({
4729
5015
  description: "Delete comment",
4730
5016
  method: HttpMethod.DELETE,
4731
- url: `/issues/comments/${id}/`,
5017
+ url: `/issue-comments/${id}/`,
4732
5018
  blockers: [id],
4733
5019
  blocks: []
4734
5020
  });
@@ -4741,7 +5027,10 @@ class IssueCommentService extends BaseApiService {
4741
5027
  const result = await this.enqueueRequest({
4742
5028
  description: "Get comments",
4743
5029
  method: HttpMethod.GET,
4744
- url: `/projects/${projectId}/comments/`,
5030
+ url: "/issue-comments/",
5031
+ queryParams: {
5032
+ project: projectId.toString()
5033
+ },
4745
5034
  blockers: [],
4746
5035
  blocks: []
4747
5036
  });
@@ -4753,27 +5042,21 @@ class IssueUpdateService extends BaseApiService {
4753
5042
  const result = await this.enqueueRequest({
4754
5043
  description: "Get issue updates",
4755
5044
  method: HttpMethod.GET,
4756
- url: `/projects/${projectId}/issues/updates/`,
5045
+ url: "/issue-updates/",
5046
+ queryParams: {
5047
+ project: projectId.toString()
5048
+ },
4757
5049
  blockers: [],
4758
5050
  blocks: []
4759
5051
  });
4760
- let filteredResult = result.filter(onlyUniqueOfflineIds);
4761
- filteredResult = filteredResult.map((comment) => {
4762
- return { ...comment };
4763
- });
4764
- if (result.length !== filteredResult.length) {
4765
- console.error(
4766
- `Received duplicate comments from the API (new length ${filteredResult.length}); filtered in browser.`
4767
- );
4768
- }
4769
- this.dispatch(initializeIssueUpdates(filteredResult));
5052
+ this.dispatch(initializeIssueUpdates(result));
4770
5053
  }
4771
5054
  }
4772
5055
  class IssueAttachmentService extends BaseAttachmentService {
4773
5056
  constructor() {
4774
5057
  super(...arguments);
4775
- __publicField(this, "attachmentModel", AttachmentModel.Issue);
4776
- __publicField(this, "initializeAttachments", initializeIssueAttachments);
5058
+ __publicField(this, "name", "Issue Attachment");
5059
+ __publicField(this, "url", "/issue-attachments");
4777
5060
  __publicField(this, "addAttachments", addIssueAttachments);
4778
5061
  __publicField(this, "updateAttachments", updateIssueAttachments);
4779
5062
  __publicField(this, "removeAttachments", deleteIssueAttachments);
@@ -4784,24 +5067,42 @@ class IssueAttachmentService extends BaseAttachmentService {
4784
5067
  buildOfflineAttachment(data) {
4785
5068
  return offline({
4786
5069
  file: URL.createObjectURL(data.file),
4787
- file_sha1: data.sha1,
4788
- created_by: data.createdBy,
5070
+ file_sha1: data.file_sha1,
5071
+ created_by: data.created_by,
4789
5072
  file_name: data.file.name,
4790
5073
  file_type: data.file.type,
4791
- submitted_at: data.submittedAt,
5074
+ submitted_at: data.submitted_at,
4792
5075
  description: data.description,
4793
5076
  issue: data.modelId
4794
5077
  });
4795
5078
  }
4796
- async attachFilesToIssue(files, issueId) {
4797
- return this.attachFiles(files, issueId, this.buildOfflineAttachment.bind(this));
5079
+ buildAttachmentPayload(data) {
5080
+ return {
5081
+ ...data,
5082
+ issue: data.modelId
5083
+ };
5084
+ }
5085
+ async bulkAdd(payloads) {
5086
+ return this._bulkAdd(payloads.map((p) => ({ modelId: p.issueId, file: p.file })));
4798
5087
  }
4799
- async deleteIssueAttachment(attachmentId) {
4800
- return this.deleteAttachment(attachmentId);
5088
+ async delete(id) {
5089
+ return this._delete(id);
5090
+ }
5091
+ async refreshStore(projectId) {
5092
+ const result = await this.enqueueRequest({
5093
+ description: "Get issue attachments",
5094
+ method: HttpMethod.GET,
5095
+ url: `${this.url}/`,
5096
+ queryParams: {
5097
+ project: projectId.toString()
5098
+ },
5099
+ blocks: [],
5100
+ blockers: []
5101
+ });
5102
+ this.dispatch(initializeIssueAttachments(result));
4801
5103
  }
4802
5104
  }
4803
5105
  class IssueService extends BaseApiService {
4804
- // Basic CRUD functions
4805
5106
  add(payload) {
4806
5107
  var _a2;
4807
5108
  const { store } = this.client;
@@ -4819,10 +5120,6 @@ class IssueService extends BaseApiService {
4819
5120
  description: "Create issue",
4820
5121
  method: HttpMethod.POST,
4821
5122
  url: "/issues/",
4822
- queryParams: {
4823
- workspace_id: payload.index_workspace,
4824
- ...payload.issue_type ? { issue_type: payload.issue_type } : {}
4825
- },
4826
5123
  payload: offlineIssue,
4827
5124
  blockers: ["add-issue", ...offlineIssue.index_workspace ? [offlineIssue.index_workspace] : []],
4828
5125
  blocks: [offlineIssue.offline_id]
@@ -4978,7 +5275,10 @@ class IssueService extends BaseApiService {
4978
5275
  const result = await this.enqueueRequest({
4979
5276
  description: "Get issues",
4980
5277
  method: HttpMethod.GET,
4981
- url: `/projects/${projectId}/issues/`,
5278
+ url: "/issues/",
5279
+ queryParams: {
5280
+ project: projectId.toString()
5281
+ },
4982
5282
  blockers: [],
4983
5283
  blocks: []
4984
5284
  });
@@ -4998,7 +5298,7 @@ class IssueTypeService extends BaseApiService {
4998
5298
  this.dispatch(addIssueType(offlineIssueType));
4999
5299
  const promise = this.enqueueRequest({
5000
5300
  method: HttpMethod.POST,
5001
- url: `/organizations/${payload.organization}/issue-types/`,
5301
+ url: "/issue-types/",
5002
5302
  // Sending only whats needed here
5003
5303
  payload: {
5004
5304
  offline_id: offlineIssueType.offline_id,
@@ -5032,7 +5332,7 @@ class IssueTypeService extends BaseApiService {
5032
5332
  this.dispatch(updateIssueType(offlineUpdatedIssueType));
5033
5333
  const promise = this.enqueueRequest({
5034
5334
  method: HttpMethod.PATCH,
5035
- url: `/issues/types/${payload.offline_id}/`,
5335
+ url: `/issue-types/${payload.offline_id}/`,
5036
5336
  payload,
5037
5337
  blockers: [payload.offline_id],
5038
5338
  blocks: [payload.offline_id]
@@ -5056,7 +5356,7 @@ class IssueTypeService extends BaseApiService {
5056
5356
  this.dispatch(deleteIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
5057
5357
  const promise = this.enqueueRequest({
5058
5358
  method: HttpMethod.DELETE,
5059
- url: `/issues/types/${id}/`,
5359
+ url: `/issue-types/${id}/`,
5060
5360
  blockers: [id],
5061
5361
  blocks: []
5062
5362
  });
@@ -5069,7 +5369,10 @@ class IssueTypeService extends BaseApiService {
5069
5369
  async refreshStore(organizationId) {
5070
5370
  const result = await this.enqueueRequest({
5071
5371
  method: HttpMethod.GET,
5072
- url: `/organizations/${organizationId}/issue-types/`,
5372
+ url: "/issue-types/",
5373
+ queryParams: {
5374
+ organization: organizationId.toString()
5375
+ },
5073
5376
  blockers: [],
5074
5377
  blocks: []
5075
5378
  });
@@ -5213,8 +5516,8 @@ class ProjectFileService extends BaseApiService {
5213
5516
  class ProjectAttachmentService extends BaseAttachmentService {
5214
5517
  constructor() {
5215
5518
  super(...arguments);
5216
- __publicField(this, "attachmentModel", AttachmentModel.Project);
5217
- __publicField(this, "initializeAttachments", initializeProjectAttachments);
5519
+ __publicField(this, "name", "Project Attachment");
5520
+ __publicField(this, "url", "/project-attachments");
5218
5521
  __publicField(this, "addAttachments", addProjectAttachments);
5219
5522
  __publicField(this, "updateAttachments", updateProjectAttachments);
5220
5523
  __publicField(this, "removeAttachments", deleteProjectAttachments);
@@ -5225,21 +5528,40 @@ class ProjectAttachmentService extends BaseAttachmentService {
5225
5528
  buildOfflineAttachment(data) {
5226
5529
  return offline({
5227
5530
  file: URL.createObjectURL(data.file),
5228
- file_sha1: data.sha1,
5229
- created_by: data.createdBy,
5531
+ file_sha1: data.file_sha1,
5532
+ created_by: data.created_by,
5230
5533
  file_name: data.file.name,
5231
5534
  file_type: data.file.type,
5232
- submitted_at: data.submittedAt,
5535
+ submitted_at: data.submitted_at,
5233
5536
  description: data.description,
5234
5537
  project: data.modelId
5235
5538
  });
5236
5539
  }
5237
- async attachFilesToProject(files, projectId) {
5238
- return this.attachFiles(files, projectId, this.buildOfflineAttachment.bind(this));
5239
- }
5240
- async deleteProjectAttachment(attachmentId) {
5241
- return this.deleteAttachment(attachmentId);
5242
- }
5540
+ buildAttachmentPayload(data) {
5541
+ return {
5542
+ ...data,
5543
+ project: data.modelId
5544
+ };
5545
+ }
5546
+ async bulkAdd(payloads) {
5547
+ return this._bulkAdd(payloads.map((p) => ({ modelId: p.projectId, file: p.file })));
5548
+ }
5549
+ async delete(attachmentId) {
5550
+ return this._delete(attachmentId);
5551
+ }
5552
+ async refreshStore(projectId) {
5553
+ const result = await this.enqueueRequest({
5554
+ description: "Get project attachments",
5555
+ method: HttpMethod.GET,
5556
+ url: `${this.url}/`,
5557
+ queryParams: {
5558
+ project: projectId.toString()
5559
+ },
5560
+ blockers: [],
5561
+ blocks: []
5562
+ });
5563
+ this.dispatch(initializeProjectAttachments(result));
5564
+ }
5243
5565
  }
5244
5566
  class ProjectService extends BaseApiService {
5245
5567
  async add(payload) {
@@ -5381,88 +5703,33 @@ const separateImageFromFields = async (fields) => {
5381
5703
  return { fields: newFields, images };
5382
5704
  };
5383
5705
  class FormService extends BaseUploadService {
5384
- async bulkAddRevisionAttachments(revisionId, files) {
5706
+ add(payload, initialRevision) {
5385
5707
  var _a2;
5708
+ const { store } = this.client;
5386
5709
  const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
5387
- const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
5388
- const filePayloads = {};
5389
- const offlineFormRevisionAttachments = [];
5390
- const attachmentPayloads = [];
5391
- for (const [fieldIdentifier, file] of Object.entries(files)) {
5392
- const sha1 = await hashFile(file);
5393
- if (!(sha1 in filePayloads)) {
5394
- filePayloads[sha1] = {
5395
- sha1,
5396
- file_type: file.type,
5397
- extension: file.name.split(".").pop(),
5398
- size: file.size
5399
- };
5400
- await this.client.files.addCache(file, sha1);
5401
- }
5402
- const offlineFormRevisionAttachment = offline({
5403
- file: URL.createObjectURL(file),
5404
- file_type: file.type,
5405
- file_name: file.name,
5406
- file_sha1: sha1,
5407
- created_by: createdBy,
5408
- revision: revisionId,
5409
- submitted_at: submittedAt,
5410
- field_identifier: fieldIdentifier
5411
- });
5412
- offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
5413
- const attachmentPayload = {
5414
- offline_id: offlineFormRevisionAttachment.offline_id,
5415
- name: file.name,
5416
- field_identifier: fieldIdentifier,
5417
- sha1
5418
- };
5419
- attachmentPayloads.push(attachmentPayload);
5420
- }
5421
- this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
5422
- const promise = this.enqueueRequest({
5423
- description: "Attach files to form revision",
5424
- method: HttpMethod.POST,
5425
- url: `/forms/revisions/${revisionId}/attachments/bulk/`,
5426
- payload: {
5427
- submitted_at: submittedAt,
5428
- attachments: attachmentPayloads,
5429
- files: Object.values(filePayloads)
5430
- },
5431
- blockers: [revisionId],
5432
- blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
5433
- });
5434
- promise.then((result) => {
5435
- this.processPresignedUrls(result.presigned_urls);
5436
- this.dispatch(updateFormRevisionAttachments(result.attachments));
5437
- }).catch(() => {
5438
- this.dispatch(
5439
- deleteFormRevisionAttachments(
5440
- offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
5441
- )
5442
- );
5710
+ const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
5711
+ const offlineForm = offline({
5712
+ ...payload,
5713
+ submitted_at: submittedAt,
5714
+ created_by: createdBy
5443
5715
  });
5444
- return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
5445
- }
5446
- async add(ownerId, form, initialRevision, urlPrefix) {
5447
- const { fields, images } = await separateImageFromFields(initialRevision.fields);
5448
5716
  const offlineFormRevision = offline({
5449
5717
  ...initialRevision,
5450
- fields,
5451
- created_by: form.created_by,
5452
- form: form.offline_id,
5453
- submitted_at: form.submitted_at,
5454
- revision: "Pending"
5718
+ form: offlineForm.offline_id,
5719
+ revision: "Pending",
5720
+ submitted_at: submittedAt,
5721
+ created_by: createdBy
5455
5722
  });
5456
- this.dispatch(addForm(form));
5723
+ this.dispatch(addForm(offlineForm));
5457
5724
  this.dispatch(addFormRevision(offlineFormRevision));
5458
5725
  const formPromise = this.enqueueRequest({
5459
5726
  description: "Create form",
5460
5727
  method: HttpMethod.POST,
5461
- url: urlPrefix,
5728
+ url: "/forms/",
5462
5729
  payload: {
5463
5730
  // Sending exactly what is currently needed for the endpoint
5464
- offline_id: form.offline_id,
5465
- submitted_at: form.submitted_at,
5731
+ offline_id: offlineForm.offline_id,
5732
+ submitted_at: offlineForm.submitted_at,
5466
5733
  initial_revision: {
5467
5734
  offline_id: offlineFormRevision.offline_id,
5468
5735
  submitted_at: offlineFormRevision.submitted_at,
@@ -5471,111 +5738,18 @@ class FormService extends BaseUploadService {
5471
5738
  fields: offlineFormRevision.fields
5472
5739
  }
5473
5740
  },
5474
- blockers: [ownerId],
5475
- blocks: [form.offline_id, offlineFormRevision.offline_id]
5741
+ blockers: [
5742
+ ...payload.project ? [payload.project.toString()] : [],
5743
+ ...payload.organization ? [payload.organization.toString()] : []
5744
+ ],
5745
+ blocks: [offlineForm.offline_id, offlineFormRevision.offline_id]
5476
5746
  });
5477
- const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
5478
- offlineFormRevision.offline_id,
5479
- images
5480
- );
5481
5747
  void formPromise.catch((e) => {
5482
- this.dispatch(deleteForm(form.offline_id));
5748
+ this.dispatch(deleteForm(offlineForm.offline_id));
5483
5749
  this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
5484
5750
  throw e;
5485
5751
  });
5486
- return [form, offlineFormRevision, offlineFormRevisionAttachments, formPromise, attachmentsPromise];
5487
- }
5488
- addForOrganization(organizationId, initialRevision) {
5489
- var _a2;
5490
- const state = this.client.store.getState();
5491
- const offlineForm = offline({
5492
- favorite: false,
5493
- created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
5494
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5495
- organization: organizationId
5496
- });
5497
- return this.add(
5498
- organizationId.toString(),
5499
- offlineForm,
5500
- initialRevision,
5501
- `/organizations/${organizationId}/create-form/`
5502
- );
5503
- }
5504
- addForProject(projectId, initialRevision) {
5505
- var _a2;
5506
- const state = this.client.store.getState();
5507
- const offlineForm = offline({
5508
- favorite: false,
5509
- created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
5510
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5511
- project: projectId
5512
- });
5513
- return this.add(projectId.toString(), offlineForm, initialRevision, `/projects/${projectId}/create-form/`);
5514
- }
5515
- addForIssueType(issueTypeId, initialRevision) {
5516
- var _a2;
5517
- const state = this.client.store.getState();
5518
- const offlineForm = offline({
5519
- favorite: false,
5520
- created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
5521
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5522
- issue_type: issueTypeId
5523
- });
5524
- return this.add(issueTypeId, offlineForm, initialRevision, `/issues/types/${issueTypeId}/create-form/`);
5525
- }
5526
- addForAssetType(assetTypeId, initialRevision) {
5527
- var _a2;
5528
- const state = this.client.store.getState();
5529
- const offlineForm = offline({
5530
- favorite: false,
5531
- created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
5532
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5533
- asset_type: assetTypeId
5534
- });
5535
- return this.add(assetTypeId, offlineForm, initialRevision, `/assets/types/${assetTypeId}/create-form/`);
5536
- }
5537
- async createRevision(formId, revision) {
5538
- var _a2;
5539
- const offlineRevision = offline(revision);
5540
- const { store } = this.client;
5541
- const state = store.getState();
5542
- const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
5543
- const { fields, images } = await separateImageFromFields(offlineRevision.fields);
5544
- const fullRevision = {
5545
- ...offlineRevision,
5546
- fields,
5547
- created_by: createdBy,
5548
- revision: "Pending",
5549
- form: formId,
5550
- submitted_at: (/* @__PURE__ */ new Date()).toISOString()
5551
- };
5552
- this.dispatch(addFormRevision(fullRevision));
5553
- const promise = this.enqueueRequest({
5554
- description: "Create form revision",
5555
- method: HttpMethod.PATCH,
5556
- url: `/forms/${formId}/`,
5557
- payload: {
5558
- initial_revision: {
5559
- offline_id: fullRevision.offline_id,
5560
- submitted_at: fullRevision.submitted_at,
5561
- title: fullRevision.title,
5562
- description: fullRevision.description,
5563
- fields: fullRevision.fields
5564
- }
5565
- },
5566
- blockers: [formId],
5567
- blocks: [offlineRevision.offline_id]
5568
- });
5569
- const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
5570
- fullRevision.offline_id,
5571
- images
5572
- );
5573
- void promise.then((result) => {
5574
- this.dispatch(setFormRevision(result));
5575
- }).catch(() => {
5576
- this.dispatch(deleteFormRevision(fullRevision.offline_id));
5577
- });
5578
- return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
5752
+ return [offlineForm, offlineFormRevision, formPromise];
5579
5753
  }
5580
5754
  async delete(id) {
5581
5755
  const { store } = this.client;
@@ -5612,65 +5786,31 @@ class FormService extends BaseUploadService {
5612
5786
  throw e;
5613
5787
  }
5614
5788
  }
5615
- async refreshStore(projectId) {
5616
- const forms = [];
5617
- const revisions = [];
5618
- const attachments = [];
5619
- const projectFormsResult = await this.enqueueRequest({
5789
+ async refreshStore(projectId, organizationId) {
5790
+ let forms = [];
5791
+ const projectForms = await this.enqueueRequest({
5620
5792
  description: "Fetch project forms",
5621
5793
  method: HttpMethod.GET,
5622
- url: `/projects/${projectId}/forms/`,
5794
+ url: "/forms/",
5795
+ queryParams: {
5796
+ project: projectId.toString()
5797
+ },
5623
5798
  blockers: [projectId.toString()],
5624
5799
  blocks: []
5625
5800
  });
5626
- for (const form of projectFormsResult.forms)
5627
- forms.push(form);
5628
- for (const revision of projectFormsResult.revisions)
5629
- revisions.push(revision);
5630
- for (const attachment of projectFormsResult.attachments)
5631
- attachments.push(attachment);
5632
- const organizationFormsResult = await this.enqueueRequest({
5801
+ forms = forms.concat(projectForms);
5802
+ const organizationForms = await this.enqueueRequest({
5633
5803
  description: "Fetch organization forms",
5634
5804
  method: HttpMethod.GET,
5635
- url: `/projects/${projectId}/organizations/forms/`,
5636
- blockers: [projectId.toString()],
5637
- blocks: []
5638
- });
5639
- for (const form of organizationFormsResult.forms)
5640
- forms.push(form);
5641
- for (const revision of organizationFormsResult.revisions)
5642
- revisions.push(revision);
5643
- for (const attachment of organizationFormsResult.attachments)
5644
- attachments.push(attachment);
5645
- const assetTypeFormsResult = await this.enqueueRequest({
5646
- description: "Fetch asset type forms",
5647
- method: HttpMethod.GET,
5648
- url: `/projects/${projectId}/asset-types/forms/`,
5649
- blockers: [projectId.toString()],
5650
- blocks: []
5651
- });
5652
- for (const form of assetTypeFormsResult.forms)
5653
- forms.push(form);
5654
- for (const revision of assetTypeFormsResult.revisions)
5655
- revisions.push(revision);
5656
- for (const attachment of assetTypeFormsResult.attachments)
5657
- attachments.push(attachment);
5658
- const issueTypeFormsResult = await this.enqueueRequest({
5659
- description: "Fetch issue type forms",
5660
- method: HttpMethod.GET,
5661
- url: `/projects/${projectId}/issue-types/forms/`,
5662
- blockers: [projectId.toString()],
5805
+ url: "/forms/",
5806
+ queryParams: {
5807
+ organization: organizationId.toString()
5808
+ },
5809
+ blockers: [organizationId.toString()],
5663
5810
  blocks: []
5664
5811
  });
5665
- for (const form of issueTypeFormsResult.forms)
5666
- forms.push(form);
5667
- for (const revision of issueTypeFormsResult.revisions)
5668
- revisions.push(revision);
5669
- for (const attachment of issueTypeFormsResult.attachments)
5670
- attachments.push(attachment);
5812
+ forms = forms.concat(organizationForms);
5671
5813
  this.dispatch(initializeForms(forms));
5672
- this.dispatch(initializeFormRevisions(revisions));
5673
- this.dispatch(initializeFormRevisionAttachments(attachments));
5674
5814
  }
5675
5815
  }
5676
5816
  const isArrayOfFiles = (value) => {
@@ -5692,95 +5832,11 @@ const separateFilesFromValues = (values) => {
5692
5832
  return { values: newValues, files };
5693
5833
  };
5694
5834
  class FormSubmissionService extends BaseUploadService {
5695
- async bulkAddSubmissionAttachments(submissionId, files) {
5696
- var _a2;
5697
- const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
5698
- const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
5699
- const filePayloads = {};
5700
- const offlineFormSubmissionAttachments = [];
5701
- const attachmentPayloads = [];
5702
- for (const [fieldIdentifier, filesArray] of Object.entries(files)) {
5703
- for (const file of filesArray) {
5704
- const sha1 = await hashFile(file);
5705
- if (!(sha1 in filePayloads)) {
5706
- filePayloads[sha1] = {
5707
- sha1,
5708
- file_type: file.type,
5709
- extension: file.name.split(".").pop(),
5710
- size: file.size
5711
- };
5712
- await this.client.files.addCache(file, sha1);
5713
- }
5714
- const offlineFormSubmissionAttachment = offline({
5715
- file: URL.createObjectURL(file),
5716
- file_type: file.type,
5717
- file_name: file.name,
5718
- file_sha1: sha1,
5719
- created_by: createdBy,
5720
- submission: submissionId,
5721
- submitted_at: submittedAt,
5722
- field_identifier: fieldIdentifier
5723
- });
5724
- offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
5725
- const attachmentPayload = {
5726
- offline_id: offlineFormSubmissionAttachment.offline_id,
5727
- name: file.name,
5728
- sha1,
5729
- field_identifier: fieldIdentifier
5730
- };
5731
- attachmentPayloads.push(attachmentPayload);
5732
- }
5733
- }
5734
- this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
5735
- const promise = this.enqueueRequest({
5736
- description: "Attach files to form submission",
5737
- method: HttpMethod.POST,
5738
- url: `/forms/submissions/${submissionId}/attachments/bulk/`,
5739
- payload: {
5740
- submitted_at: submittedAt,
5741
- attachments: attachmentPayloads,
5742
- files: Object.values(filePayloads)
5743
- },
5744
- blockers: [submissionId],
5745
- blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
5746
- });
5747
- promise.then((result) => {
5748
- this.processPresignedUrls(result.presigned_urls);
5749
- this.dispatch(updateFormSubmissionAttachments(result.attachments));
5750
- }).catch(() => {
5751
- this.dispatch(
5752
- deleteFormSubmissionAttachments(
5753
- offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
5754
- )
5755
- );
5756
- });
5757
- return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
5758
- }
5759
- async bulkDeleteSubmissionAttachments(submissionId, attachmentsIds) {
5760
- const { store } = this.client;
5761
- const state = store.getState();
5762
- const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
5763
- this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
5764
- try {
5765
- await this.enqueueRequest({
5766
- description: "Delete form submission attachments",
5767
- method: HttpMethod.DELETE,
5768
- url: `/forms/submissions/${submissionId}/attachments/bulk/`,
5769
- payload: { attachments: attachmentsIds },
5770
- blockers: [submissionId, ...attachmentsIds],
5771
- blocks: []
5772
- });
5773
- } catch (e) {
5774
- this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
5775
- throw e;
5776
- }
5777
- }
5778
- // Outer promise is for hashing and caching files for submission attachments
5779
- async add(payload) {
5835
+ add(payload) {
5780
5836
  var _a2;
5781
5837
  const { store } = this.client;
5782
5838
  const state = store.getState();
5783
- const { values, files } = separateFilesFromValues(payload.values);
5839
+ const { values } = separateFilesFromValues(payload.values);
5784
5840
  const offlineSubmission = offline({
5785
5841
  ...payload,
5786
5842
  values,
@@ -5790,7 +5846,7 @@ class FormSubmissionService extends BaseUploadService {
5790
5846
  const promise = this.enqueueRequest({
5791
5847
  description: "Respond to form",
5792
5848
  method: HttpMethod.POST,
5793
- url: `/forms/revisions/${payload.form_revision}/respond/`,
5849
+ url: "/form-submissions/",
5794
5850
  payload: offlineSubmission,
5795
5851
  blockers: [payload.issue, payload.asset, payload.asset_stage, "add-form-entry"].filter(
5796
5852
  (x) => x !== void 0
@@ -5798,10 +5854,6 @@ class FormSubmissionService extends BaseUploadService {
5798
5854
  blocks: [offlineSubmission.offline_id]
5799
5855
  });
5800
5856
  this.dispatch(addFormSubmission(offlineSubmission));
5801
- const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
5802
- offlineSubmission.offline_id,
5803
- files
5804
- );
5805
5857
  promise.then((result) => {
5806
5858
  this.dispatch(addActiveProjectFormSubmissionsCount(1));
5807
5859
  this.dispatch(setFormSubmission(result));
@@ -5810,115 +5862,16 @@ class FormSubmissionService extends BaseUploadService {
5810
5862
  this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
5811
5863
  this.dispatch(addActiveProjectFormSubmissionsCount(-1));
5812
5864
  });
5813
- return [offlineSubmission, offlineFormSubmissionAttachments, promise, attachmentsPromise];
5865
+ return [offlineSubmission, promise];
5814
5866
  }
5815
- // Note currently the bulkAdd method is specific to form submissions for assets
5816
- // TODO: adapt the support bulk adding to any model type
5817
- async bulkAdd(args, batchSize) {
5818
- const { formRevision, commonFieldValues, fieldValuesByAsset } = args;
5819
- const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
5820
- const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
5821
- const transactionId = v4();
5822
- const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), batchSize);
5823
- const bulkAddBatches = await Promise.all(
5824
- assetIdBatches.map(async (assetIdBatch) => {
5825
- const batchId = v4();
5826
- const submissionPayloads = [];
5827
- const attachmentPayloads = [];
5828
- const files = { ...commonFiles };
5829
- for (const assetId of assetIdBatch) {
5830
- const { values: fileSeperatedSubmissionSpecificValues, files: submissionSpecificFiles } = separateFilesFromValues(fieldValuesByAsset[assetId] ?? {});
5831
- Object.assign(files, submissionSpecificFiles);
5832
- const submissionPayload = offline({
5833
- asset_id: assetId,
5834
- form_data: fileSeperatedSubmissionSpecificValues
5835
- });
5836
- submissionPayloads.push(submissionPayload);
5837
- for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
5838
- for (const file of fileArray) {
5839
- const sha1 = await hashFile(file);
5840
- await this.client.files.addCache(file, sha1);
5841
- const attachmentPayload = offline({
5842
- submission_id: submissionPayload.offline_id,
5843
- sha1,
5844
- name: file.name,
5845
- field_identifier: fieldIdentifier
5846
- });
5847
- attachmentPayloads.push(attachmentPayload);
5848
- }
5849
- }
5850
- }
5851
- const filePaylods = [];
5852
- for (const file of Object.values(files).flat()) {
5853
- const sha1 = await hashFile(file);
5854
- const filePayload = {
5855
- sha1,
5856
- extension: file.name.split(".").pop() || "",
5857
- file_type: file.type,
5858
- size: file.size
5859
- };
5860
- filePaylods.push(filePayload);
5861
- }
5862
- return {
5863
- batchId,
5864
- payload: {
5865
- transaction_id: transactionId,
5866
- form_data: fileSeperatedCommonFieldValues,
5867
- submitted_at: submittedAt,
5868
- submissions: submissionPayloads,
5869
- attachments: attachmentPayloads,
5870
- files: filePaylods
5871
- }
5872
- };
5873
- })
5874
- );
5875
- const batchPromises = [];
5876
- let prevBatchId = null;
5877
- for (const batch of bulkAddBatches) {
5878
- const { payload, batchId } = batch;
5879
- const batchAssetIds = payload.submissions.map((x) => x.asset_id);
5880
- const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
5881
- const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
5882
- const blockers = batchAssetIds;
5883
- if (prevBatchId)
5884
- blockers.push(prevBatchId);
5885
- const blocks = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
5886
- const promise = this.enqueueRequest({
5887
- description: "Bulk add form submissions",
5888
- method: HttpMethod.POST,
5889
- url: `/forms/revisions/${formRevision}/bulk-respond/`,
5890
- payload,
5891
- blockers,
5892
- blocks
5893
- });
5894
- void promise.then(({ presigned_urls }) => {
5895
- this.processPresignedUrls(presigned_urls);
5896
- });
5897
- prevBatchId = batchId;
5898
- batchPromises.push(promise);
5899
- }
5900
- void Promise.all(batchPromises).then((results) => {
5901
- const createdSubmissions = [];
5902
- const createdAttachments = [];
5903
- for (const result of results) {
5904
- for (const createdSubmission of result.submissions)
5905
- createdSubmissions.push(createdSubmission);
5906
- for (const createdAttachment of result.attachments)
5907
- createdAttachments.push(createdAttachment);
5908
- }
5909
- this.dispatch(addFormSubmissions(createdSubmissions));
5910
- this.dispatch(addFormSubmissionAttachments(createdAttachments));
5911
- });
5912
- return batchPromises;
5913
- }
5914
- async update(payload) {
5867
+ update(payload) {
5915
5868
  const { store } = this.client;
5916
5869
  const state = store.getState();
5917
5870
  const submissionToBeUpdated = selectFormSubmissionById(payload.offline_id)(state);
5918
5871
  if (!submissionToBeUpdated) {
5919
5872
  throw new Error(`Expected submission with offline_id ${payload.offline_id} to exist`);
5920
5873
  }
5921
- const { values, files } = separateFilesFromValues(payload.values ?? {});
5874
+ const { values } = separateFilesFromValues(payload.values ?? {});
5922
5875
  const updatedSubmission = {
5923
5876
  ...submissionToBeUpdated,
5924
5877
  ...payload,
@@ -5932,39 +5885,18 @@ class FormSubmissionService extends BaseUploadService {
5932
5885
  const promise = this.enqueueRequest({
5933
5886
  description: "Delete user form submissions",
5934
5887
  method: HttpMethod.PATCH,
5935
- url: `/forms/submissions/${updatedSubmission.offline_id}/`,
5888
+ url: `/form-submissions/${updatedSubmission.offline_id}/`,
5936
5889
  // TODO: send just payload when FormSubmissionDeserializer is updated to handle partial updates
5937
5890
  payload: updatedSubmission,
5938
5891
  blockers: [updatedSubmission.offline_id],
5939
5892
  blocks: [updatedSubmission.offline_id]
5940
5893
  });
5941
- const formSubmissionAttachments = selectAttachmentsOfFormSubmission(payload.offline_id)(state);
5942
- const formSubmissionAttachmentIdsToBeDeleted = [];
5943
- for (const attachment of formSubmissionAttachments) {
5944
- if (attachment.field_identifier in files) {
5945
- formSubmissionAttachmentIdsToBeDeleted.push(attachment.offline_id);
5946
- }
5947
- }
5948
- const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
5949
- payload.offline_id,
5950
- files
5951
- );
5952
- const deleteAttachmentsPromise = this.bulkDeleteSubmissionAttachments(
5953
- payload.offline_id,
5954
- formSubmissionAttachmentIdsToBeDeleted
5955
- );
5956
5894
  promise.then((result) => {
5957
5895
  this.dispatch(setFormSubmission(result));
5958
5896
  }).catch(() => {
5959
5897
  this.dispatch(setFormSubmission(submissionToBeUpdated));
5960
5898
  });
5961
- return [
5962
- updatedSubmission,
5963
- offlineFormSubmissionAttachments,
5964
- promise,
5965
- attachmentsPromise,
5966
- deleteAttachmentsPromise
5967
- ];
5899
+ return [updatedSubmission, promise];
5968
5900
  }
5969
5901
  async delete(id) {
5970
5902
  const { store } = this.client;
@@ -5981,7 +5913,7 @@ class FormSubmissionService extends BaseUploadService {
5981
5913
  return await this.enqueueRequest({
5982
5914
  description: "Delete user form submissions",
5983
5915
  method: HttpMethod.DELETE,
5984
- url: `/forms/submissions/${id}/`,
5916
+ url: `/form-submissions/${id}/`,
5985
5917
  blockers: [id],
5986
5918
  blocks: []
5987
5919
  });
@@ -5993,50 +5925,17 @@ class FormSubmissionService extends BaseUploadService {
5993
5925
  }
5994
5926
  }
5995
5927
  async refreshStore(projectId) {
5996
- const formSubmissions = {};
5997
- const modelSubmissions = await this.enqueueRequest({
5998
- description: "Fetch model submissions",
5999
- method: HttpMethod.GET,
6000
- url: `/forms/in-project/${projectId}/submissions/model/latest/`,
6001
- blockers: [],
6002
- blocks: []
6003
- });
6004
- for (const modelSubmission of modelSubmissions) {
6005
- formSubmissions[modelSubmission.offline_id] = modelSubmission;
6006
- }
6007
- const standaloneSubmissions = await this.enqueueRequest({
6008
- description: "Fetch standalone submissions",
6009
- method: HttpMethod.GET,
6010
- url: `/forms/in-project/${projectId}/submissions/standalone/`,
6011
- blockers: [],
6012
- blocks: []
6013
- });
6014
- for (const standaloneSubmission of standaloneSubmissions) {
6015
- formSubmissions[standaloneSubmission.offline_id] = standaloneSubmission;
6016
- }
6017
- this.dispatch(initializeFormSubmissions(Object.values(formSubmissions)));
6018
- const attachments = {};
6019
- const modelAttachments = await this.enqueueRequest({
6020
- description: "Fetch model submission attachments",
6021
- method: HttpMethod.GET,
6022
- url: `/forms/in-project/${projectId}/attachments/model/latest/`,
6023
- blockers: [],
6024
- blocks: []
6025
- });
6026
- for (const modelAttachment of modelAttachments) {
6027
- attachments[modelAttachment.offline_id] = modelAttachment;
6028
- }
6029
- const standaloneAttachments = await this.enqueueRequest({
6030
- description: "Fetch standalone submission attachments",
5928
+ const result = await this.enqueueRequest({
5929
+ description: "Fetch form submissions",
6031
5930
  method: HttpMethod.GET,
6032
- url: `/forms/in-project/${projectId}/attachments/standalone/`,
5931
+ url: "/form-submissions/",
5932
+ queryParams: {
5933
+ project: projectId.toString()
5934
+ },
6033
5935
  blockers: [],
6034
5936
  blocks: []
6035
5937
  });
6036
- for (const standaloneAttachent of standaloneAttachments) {
6037
- attachments[standaloneAttachent.offline_id] = standaloneAttachent;
6038
- }
6039
- this.dispatch(initializeFormSubmissionAttachments(Object.values(attachments)));
5938
+ this.dispatch(initializeFormSubmissions(result));
6040
5939
  }
6041
5940
  }
6042
5941
  class WorkspaceService extends BaseApiService {
@@ -6738,8 +6637,8 @@ class DocumentService extends BaseApiService {
6738
6637
  class DocumentAttachmentService extends BaseAttachmentService {
6739
6638
  constructor() {
6740
6639
  super(...arguments);
6741
- __publicField(this, "attachmentModel", AttachmentModel.Document);
6742
- __publicField(this, "initializeAttachments", initializeDocumentAttachments);
6640
+ __publicField(this, "name", "Document Attachment");
6641
+ __publicField(this, "url", "/document-attachments");
6743
6642
  __publicField(this, "addAttachments", addDocumentAttachments);
6744
6643
  __publicField(this, "updateAttachments", updateDocumentAttachments);
6745
6644
  __publicField(this, "removeAttachments", deleteDocumentAttachments);
@@ -6750,17 +6649,23 @@ class DocumentAttachmentService extends BaseAttachmentService {
6750
6649
  buildOfflineAttachment(data) {
6751
6650
  return offline({
6752
6651
  file: URL.createObjectURL(data.file),
6753
- file_sha1: data.sha1,
6754
- created_by: data.createdBy,
6652
+ file_sha1: data.file_sha1,
6653
+ created_by: data.created_by,
6755
6654
  file_name: data.file.name,
6756
6655
  file_type: data.file.type,
6757
- submitted_at: data.submittedAt,
6656
+ submitted_at: data.submitted_at,
6758
6657
  description: data.description,
6759
6658
  document: data.modelId
6760
6659
  });
6761
6660
  }
6661
+ buildAttachmentPayload(data) {
6662
+ return {
6663
+ ...data,
6664
+ document: data.modelId
6665
+ };
6666
+ }
6762
6667
  // NOTE: overriding the method from BaseAttachmentService since document attachments get vectorized
6763
- async attachFilesToDocument(files, documentId) {
6668
+ async bulkAdd(payloads) {
6764
6669
  var _a2;
6765
6670
  const { store } = this.client;
6766
6671
  const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
@@ -6769,40 +6674,36 @@ class DocumentAttachmentService extends BaseAttachmentService {
6769
6674
  const attachmentPayloads = [];
6770
6675
  const filePayloads = {};
6771
6676
  const sha1ToAttachmentIds = {};
6772
- for (const file of files) {
6773
- const sha1 = await hashFile(file);
6774
- if (!(sha1 in filePayloads)) {
6775
- filePayloads[sha1] = {
6776
- sha1,
6777
- file_type: file.type,
6778
- extension: file.name.split(".").pop(),
6779
- size: file.size
6780
- };
6781
- sha1ToAttachmentIds[sha1] = [];
6782
- await this.client.files.addCache(file, sha1);
6677
+ for (const payload of payloads) {
6678
+ const { documentId, file } = payload;
6679
+ const filePayload = await this.getFilePayload(file);
6680
+ if (!(filePayload.sha1 in filePayloads)) {
6681
+ filePayloads[filePayload.sha1] = filePayload;
6682
+ sha1ToAttachmentIds[filePayload.sha1] = [];
6783
6683
  }
6784
6684
  const offlineAttachment = this.buildOfflineAttachment({
6785
6685
  file,
6786
- sha1,
6787
- submittedAt,
6788
- createdBy,
6686
+ file_sha1: filePayload.sha1,
6687
+ submitted_at: submittedAt,
6688
+ created_by: createdBy,
6789
6689
  description: "",
6790
6690
  modelId: documentId
6791
6691
  });
6792
6692
  offlineAttachments.push(offlineAttachment);
6793
6693
  attachmentPayloads.push({
6794
6694
  offline_id: offlineAttachment.offline_id,
6795
- name: offlineAttachment.file_name,
6796
- sha1: offlineAttachment.file_sha1,
6695
+ file_name: offlineAttachment.file_name,
6696
+ file_sha1: offlineAttachment.file_sha1,
6697
+ file_extension: filePayload.extension,
6797
6698
  description: offlineAttachment.description
6798
6699
  });
6799
- sha1ToAttachmentIds[sha1].push(offlineAttachment.offline_id);
6700
+ sha1ToAttachmentIds[filePayload.sha1].push(offlineAttachment.offline_id);
6800
6701
  }
6801
6702
  this.dispatch(this.addAttachments(offlineAttachments));
6802
6703
  const promise = this.enqueueRequest({
6803
6704
  description: "Attach files to document",
6804
6705
  method: HttpMethod.POST,
6805
- url: `/documents/${documentId}/attach/`,
6706
+ url: "/document-attachments/bulk/",
6806
6707
  payload: {
6807
6708
  submitted_at: submittedAt,
6808
6709
  attachments: attachmentPayloads,
@@ -6827,14 +6728,14 @@ class DocumentAttachmentService extends BaseAttachmentService {
6827
6728
  });
6828
6729
  return [offlineAttachments, promise.then(({ attachments }) => attachments)];
6829
6730
  }
6830
- async deleteDocumentAttachment(attachmentId) {
6831
- return this.deleteAttachment(attachmentId);
6731
+ async delete(id) {
6732
+ return this._delete(id);
6832
6733
  }
6833
6734
  makeReadable(attachmnentId) {
6834
6735
  void this.enqueueRequest({
6835
6736
  description: "Add attachment to AI assistant",
6836
6737
  method: HttpMethod.PATCH,
6837
- url: `/documents/attachments/${attachmnentId}/`,
6738
+ url: `/document-attachments/${attachmnentId}/`,
6838
6739
  payload: {
6839
6740
  readable_to_assistant: true
6840
6741
  },
@@ -6851,7 +6752,7 @@ class DocumentAttachmentService extends BaseAttachmentService {
6851
6752
  blocks: [],
6852
6753
  blockers: []
6853
6754
  });
6854
- this.dispatch(this.initializeAttachments(projectDocumentAttachments));
6755
+ this.dispatch(initializeDocumentAttachments(projectDocumentAttachments));
6855
6756
  const organizationDocumentAttachments = await this.enqueueRequest({
6856
6757
  description: "Get document attachments",
6857
6758
  method: HttpMethod.GET,
@@ -7095,17 +6996,11 @@ class GeoImageService extends BaseUploadService {
7095
6996
  const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7096
6997
  const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7097
6998
  const projectId = payloadWithoutFile.project;
7098
- const sha1 = await hashFile(file);
7099
- const filePayload = {
7100
- sha1,
7101
- file_type: file.type,
7102
- extension: file.name.split(".").pop(),
7103
- size: file.size
7104
- };
6999
+ const filePayload = await this.getFilePayload(file);
7105
7000
  const offlineMapImage = offline({
7106
7001
  ...payloadWithoutFile,
7107
7002
  file_name: file.name,
7108
- file_sha1: sha1,
7003
+ file_sha1: filePayload.sha1,
7109
7004
  file: URL.createObjectURL(file),
7110
7005
  submitted_at: submittedAt,
7111
7006
  created_by: createdBy
@@ -7148,23 +7043,16 @@ class GeoImageService extends BaseUploadService {
7148
7043
  const offlineGeoImages = [];
7149
7044
  const offlineIds = [];
7150
7045
  const geoImagePayloads = [];
7151
- const filePayloadRecord = {};
7046
+ const filePayloads = {};
7152
7047
  for (const payloadAndFile of payloads) {
7153
7048
  const { file, ...payload } = payloadAndFile;
7154
- const sha1 = await hashFile(file);
7155
- if (!(sha1 in filePayloadRecord)) {
7156
- filePayloadRecord[sha1] = {
7157
- sha1,
7158
- file_type: file.type,
7159
- extension: file.name.split(".").pop(),
7160
- size: file.size
7161
- };
7162
- await this.client.files.addCache(file, sha1);
7163
- }
7049
+ const filePayload = await this.getFilePayload(file);
7050
+ if (!(filePayload.sha1 in filePayloads))
7051
+ filePayloads[filePayload.sha1] = filePayload;
7164
7052
  const offlineMapImage = offline({
7165
7053
  ...payload,
7166
7054
  file_name: file.name,
7167
- file_sha1: sha1,
7055
+ file_sha1: filePayload.sha1,
7168
7056
  file: URL.createObjectURL(file),
7169
7057
  submitted_at: submittedAt,
7170
7058
  created_by: createdBy,
@@ -7193,7 +7081,7 @@ class GeoImageService extends BaseUploadService {
7193
7081
  submitted_at: submittedAt,
7194
7082
  project: projectId,
7195
7083
  geo_images: geoImagePayloads,
7196
- files: Object.values(filePayloadRecord)
7084
+ files: Object.values(filePayloads)
7197
7085
  },
7198
7086
  blocks: [projectId.toString()],
7199
7087
  blockers: offlineIds
@@ -7261,7 +7149,7 @@ class GeoImageService extends BaseUploadService {
7261
7149
  this.dispatch(initializeGeoImages(result));
7262
7150
  }
7263
7151
  }
7264
- class IssueAssociationService extends BaseUploadService {
7152
+ class IssueAssociationService extends BaseApiService {
7265
7153
  add(payload) {
7266
7154
  var _a2;
7267
7155
  const { store } = this.client;
@@ -7276,7 +7164,7 @@ class IssueAssociationService extends BaseUploadService {
7276
7164
  const promise = this.enqueueRequest({
7277
7165
  description: "Add issue association",
7278
7166
  method: HttpMethod.POST,
7279
- url: "/issues/associations/",
7167
+ url: "/issue-associations/",
7280
7168
  payload: {
7281
7169
  offline_id: offlineIssueAssociation.offline_id,
7282
7170
  submitted_at: submittedAt,
@@ -7306,7 +7194,7 @@ class IssueAssociationService extends BaseUploadService {
7306
7194
  const promise = this.enqueueRequest({
7307
7195
  description: "Delete issue association",
7308
7196
  method: HttpMethod.DELETE,
7309
- url: `/issues/associations/${id}/`,
7197
+ url: `/issue-associations/${id}/`,
7310
7198
  blockers: [id],
7311
7199
  blocks: []
7312
7200
  });
@@ -7319,14 +7207,909 @@ class IssueAssociationService extends BaseUploadService {
7319
7207
  const issueAssociations = await this.enqueueRequest({
7320
7208
  description: "Fetch issue associations",
7321
7209
  method: HttpMethod.GET,
7322
- url: "/issues/associations/",
7323
- queryParams: { project_id: projectId.toString() },
7210
+ url: "/issue-associations/",
7211
+ queryParams: { project: projectId.toString() },
7324
7212
  blockers: [],
7325
7213
  blocks: []
7326
7214
  });
7327
7215
  this.dispatch(initializeIssueAssociations(issueAssociations));
7328
7216
  }
7329
7217
  }
7218
+ class FormRevisionAttachmentService extends BaseUploadService {
7219
+ async bulkAdd(payloads) {
7220
+ var _a2;
7221
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7222
+ const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7223
+ const filePayloads = {};
7224
+ const offlineFormRevisionAttachments = [];
7225
+ const attachmentPayloads = [];
7226
+ for (const payload of payloads) {
7227
+ const { revisionId, fieldIdentifier, file } = payload;
7228
+ const filePayload = await this.getFilePayload(file);
7229
+ if (!(filePayload.sha1 in filePayloads))
7230
+ filePayloads[filePayload.sha1] = filePayload;
7231
+ const offlineFormRevisionAttachment = offline({
7232
+ file: URL.createObjectURL(file),
7233
+ file_type: file.type,
7234
+ file_name: file.name,
7235
+ file_sha1: filePayload.sha1,
7236
+ created_by: createdBy,
7237
+ form_revision: revisionId,
7238
+ submitted_at: submittedAt,
7239
+ field_identifier: fieldIdentifier
7240
+ });
7241
+ offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
7242
+ const attachmentPayload = {
7243
+ offline_id: offlineFormRevisionAttachment.offline_id,
7244
+ file_name: file.name,
7245
+ field_identifier: fieldIdentifier,
7246
+ file_extension: filePayload.extension,
7247
+ file_sha1: filePayload.sha1,
7248
+ form_revision: revisionId
7249
+ };
7250
+ attachmentPayloads.push(attachmentPayload);
7251
+ }
7252
+ this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
7253
+ const promise = this.enqueueRequest({
7254
+ description: "Attach files to form revision",
7255
+ method: HttpMethod.POST,
7256
+ url: "/form-revision-attachments/bulk/",
7257
+ payload: {
7258
+ submitted_at: submittedAt,
7259
+ attachments: attachmentPayloads,
7260
+ files: Object.values(filePayloads)
7261
+ },
7262
+ blockers: offlineFormRevisionAttachments.map((attachment) => attachment.form_revision),
7263
+ blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
7264
+ });
7265
+ promise.then((result) => {
7266
+ this.processPresignedUrls(result.presigned_urls);
7267
+ this.dispatch(updateFormRevisionAttachments(result.attachments));
7268
+ }).catch(() => {
7269
+ this.dispatch(
7270
+ deleteFormRevisionAttachments(
7271
+ offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
7272
+ )
7273
+ );
7274
+ });
7275
+ return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
7276
+ }
7277
+ async refreshStore(projectId, organizationId) {
7278
+ let attachments = [];
7279
+ const projectFormRevisions = await this.enqueueRequest({
7280
+ description: "Fetch project form revision attachments",
7281
+ method: HttpMethod.GET,
7282
+ url: "/form-revision-attachments/",
7283
+ queryParams: {
7284
+ project: projectId.toString()
7285
+ },
7286
+ blockers: [projectId.toString()],
7287
+ blocks: []
7288
+ });
7289
+ attachments = attachments.concat(projectFormRevisions);
7290
+ const organizationFormRevisions = await this.enqueueRequest({
7291
+ description: "Fetch organization form revision attachments",
7292
+ method: HttpMethod.GET,
7293
+ url: "/form-revision-attachments/",
7294
+ queryParams: {
7295
+ organization: organizationId.toString()
7296
+ },
7297
+ blockers: [organizationId.toString()],
7298
+ blocks: []
7299
+ });
7300
+ attachments = attachments.concat(organizationFormRevisions);
7301
+ this.dispatch(initializeFormRevisionAttachments(attachments));
7302
+ }
7303
+ }
7304
+ class FormSubmissionAttachmentService extends BaseUploadService {
7305
+ async bulkAdd(payloads) {
7306
+ var _a2;
7307
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7308
+ const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7309
+ const filePayloads = {};
7310
+ const offlineFormSubmissionAttachments = [];
7311
+ const attachmentPayloads = [];
7312
+ for (const payload of payloads) {
7313
+ const { submissionId, fieldIdentifier, file } = payload;
7314
+ const filePayload = await this.getFilePayload(file);
7315
+ if (!(filePayload.sha1 in filePayloads))
7316
+ filePayloads[filePayload.sha1] = filePayload;
7317
+ const offlineFormSubmissionAttachment = offline({
7318
+ file: URL.createObjectURL(file),
7319
+ file_type: file.type,
7320
+ file_name: file.name,
7321
+ file_sha1: filePayload.sha1,
7322
+ created_by: createdBy,
7323
+ form_submission: submissionId,
7324
+ submitted_at: submittedAt,
7325
+ field_identifier: fieldIdentifier
7326
+ });
7327
+ offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
7328
+ const attachmentPayload = {
7329
+ offline_id: offlineFormSubmissionAttachment.offline_id,
7330
+ file_name: file.name,
7331
+ file_sha1: filePayload.sha1,
7332
+ file_extension: filePayload.extension,
7333
+ field_identifier: fieldIdentifier,
7334
+ form_submission: submissionId
7335
+ };
7336
+ attachmentPayloads.push(attachmentPayload);
7337
+ }
7338
+ this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
7339
+ const promise = this.enqueueRequest({
7340
+ description: "Attach files to form submission",
7341
+ method: HttpMethod.POST,
7342
+ url: "/form-submission-attachments/bulk/",
7343
+ payload: {
7344
+ submitted_at: submittedAt,
7345
+ attachments: attachmentPayloads,
7346
+ files: Object.values(filePayloads)
7347
+ },
7348
+ blockers: offlineFormSubmissionAttachments.map((attachment) => attachment.form_submission),
7349
+ blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
7350
+ });
7351
+ promise.then((result) => {
7352
+ this.processPresignedUrls(result.presigned_urls);
7353
+ this.dispatch(updateFormSubmissionAttachments(result.attachments));
7354
+ }).catch((error) => {
7355
+ this.dispatch(
7356
+ deleteFormSubmissionAttachments(
7357
+ offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
7358
+ )
7359
+ );
7360
+ throw error;
7361
+ });
7362
+ return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
7363
+ }
7364
+ async bulkDelete(attachmentsIds) {
7365
+ const { store } = this.client;
7366
+ const state = store.getState();
7367
+ const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
7368
+ this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
7369
+ try {
7370
+ await this.enqueueRequest({
7371
+ description: "Delete form submission attachments",
7372
+ method: HttpMethod.DELETE,
7373
+ url: "/form-submission-attachments/bulk/",
7374
+ payload: { attachment_ids: attachmentsIds },
7375
+ blockers: attachmentsIds,
7376
+ blocks: []
7377
+ });
7378
+ } catch (e) {
7379
+ this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
7380
+ throw e;
7381
+ }
7382
+ }
7383
+ async refreshStore(projectId) {
7384
+ const result = await this.enqueueRequest({
7385
+ description: "Get form submission attachments",
7386
+ method: HttpMethod.GET,
7387
+ url: "/form-submission-attachments/",
7388
+ queryParams: {
7389
+ project: projectId.toString()
7390
+ },
7391
+ blockers: [],
7392
+ blocks: []
7393
+ });
7394
+ this.dispatch(initializeFormSubmissionAttachments(result));
7395
+ }
7396
+ }
7397
+ class FormRevisionService extends BaseUploadService {
7398
+ add(payload) {
7399
+ var _a2;
7400
+ const { store } = this.client;
7401
+ const state = store.getState();
7402
+ const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
7403
+ const offlineFormRevision = offline({
7404
+ ...payload,
7405
+ created_by: createdBy,
7406
+ revision: "Pending",
7407
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
7408
+ });
7409
+ this.dispatch(addFormRevision(offlineFormRevision));
7410
+ const promise = this.enqueueRequest({
7411
+ description: "Create form revision",
7412
+ method: HttpMethod.POST,
7413
+ url: "/form-revisions/",
7414
+ payload: offlineFormRevision,
7415
+ blockers: [payload.form],
7416
+ blocks: [offlineFormRevision.offline_id]
7417
+ });
7418
+ void promise.then((result) => {
7419
+ this.dispatch(setFormRevision(result));
7420
+ }).catch(() => {
7421
+ this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
7422
+ });
7423
+ return [offlineFormRevision, promise];
7424
+ }
7425
+ async refreshStore(projectId, organizationId) {
7426
+ let formRevisions = [];
7427
+ const projectFormRevisions = await this.enqueueRequest({
7428
+ description: "Fetch project form revisions",
7429
+ method: HttpMethod.GET,
7430
+ url: "/form-revisions/",
7431
+ queryParams: {
7432
+ project: projectId.toString()
7433
+ },
7434
+ blockers: [projectId.toString()],
7435
+ blocks: []
7436
+ });
7437
+ formRevisions = formRevisions.concat(projectFormRevisions);
7438
+ const organizationFormRevisions = await this.enqueueRequest({
7439
+ description: "Fetch organization form revisions",
7440
+ method: HttpMethod.GET,
7441
+ url: "/form-revisions/",
7442
+ queryParams: {
7443
+ organization: organizationId.toString()
7444
+ },
7445
+ blockers: [organizationId.toString()],
7446
+ blocks: []
7447
+ });
7448
+ formRevisions = formRevisions.concat(organizationFormRevisions);
7449
+ this.dispatch(initializeFormRevisions(formRevisions));
7450
+ }
7451
+ }
7452
+ class AssetTypeFieldsAttachmentService extends BaseUploadService {
7453
+ async bulkAdd(payloads) {
7454
+ var _a2;
7455
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7456
+ const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7457
+ const filePayloads = {};
7458
+ const offlineAssetTypeFieldsAttachments = [];
7459
+ const attachmentPayloads = [];
7460
+ for (const payload of payloads) {
7461
+ const { fieldsRevisionId, fieldIdentifier, file } = payload;
7462
+ const filePayload = await this.getFilePayload(file);
7463
+ if (!(filePayload.sha1 in filePayloads))
7464
+ filePayloads[filePayload.sha1] = filePayload;
7465
+ const offlineAssetTypeFieldsAttachment = offline({
7466
+ file: URL.createObjectURL(file),
7467
+ file_type: file.type,
7468
+ file_name: file.name,
7469
+ file_sha1: filePayload.sha1,
7470
+ created_by: createdBy,
7471
+ fields_revision: fieldsRevisionId,
7472
+ submitted_at: submittedAt,
7473
+ field_identifier: fieldIdentifier
7474
+ });
7475
+ offlineAssetTypeFieldsAttachments.push(offlineAssetTypeFieldsAttachment);
7476
+ const attachmentPayload = {
7477
+ offline_id: offlineAssetTypeFieldsAttachment.offline_id,
7478
+ file_name: file.name,
7479
+ field_identifier: fieldIdentifier,
7480
+ file_extension: filePayload.extension,
7481
+ file_sha1: filePayload.sha1,
7482
+ fields_revision: fieldsRevisionId
7483
+ };
7484
+ attachmentPayloads.push(attachmentPayload);
7485
+ }
7486
+ this.dispatch(addAssetTypeFieldsAttachments(offlineAssetTypeFieldsAttachments));
7487
+ const promise = this.enqueueRequest({
7488
+ description: "Add asset type fields attachments",
7489
+ method: HttpMethod.POST,
7490
+ url: "/asset-type-fields-attachments/bulk/",
7491
+ payload: {
7492
+ submitted_at: submittedAt,
7493
+ attachments: attachmentPayloads,
7494
+ files: Object.values(filePayloads)
7495
+ },
7496
+ blockers: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
7497
+ blocks: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
7498
+ });
7499
+ promise.then((result) => {
7500
+ this.processPresignedUrls(result.presigned_urls);
7501
+ this.dispatch(updateAssetTypeFieldsAttachments(result.attachments));
7502
+ }).catch(() => {
7503
+ this.dispatch(
7504
+ deleteAssetTypeFieldsAttachments(
7505
+ offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
7506
+ )
7507
+ );
7508
+ });
7509
+ return [offlineAssetTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
7510
+ }
7511
+ async refreshStore(projectId) {
7512
+ const result = await this.enqueueRequest({
7513
+ description: "get asset type fields attachments",
7514
+ method: HttpMethod.GET,
7515
+ url: "/asset-type-fields-attachments/",
7516
+ queryParams: {
7517
+ project: projectId.toString()
7518
+ },
7519
+ blockers: [projectId.toString()],
7520
+ blocks: []
7521
+ });
7522
+ this.dispatch(initializeAssetTypeFieldsAttachments(result));
7523
+ }
7524
+ }
7525
+ class AssetTypeFieldsService extends BaseApiService {
7526
+ add(payload) {
7527
+ var _a2;
7528
+ const { store } = this.client;
7529
+ const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7530
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7531
+ const offlineAssetTypeFields = offline({
7532
+ ...payload,
7533
+ created_by: createdBy,
7534
+ submitted_at: submittedAt
7535
+ });
7536
+ this.dispatch(addAssetTypeFields(offlineAssetTypeFields));
7537
+ const promise = this.enqueueRequest({
7538
+ description: "Add Asset Type Fields",
7539
+ method: HttpMethod.POST,
7540
+ url: "/asset-type-fields/",
7541
+ payload: offlineAssetTypeFields,
7542
+ blockers: [offlineAssetTypeFields.asset_type],
7543
+ blocks: [offlineAssetTypeFields.offline_id]
7544
+ });
7545
+ promise.then((response) => {
7546
+ this.dispatch(updateAssetTypeFields(response));
7547
+ }).catch((error) => {
7548
+ this.dispatch(deleteAssetTypeFields(offlineAssetTypeFields.offline_id));
7549
+ throw error;
7550
+ });
7551
+ return [offlineAssetTypeFields, promise];
7552
+ }
7553
+ async refreshStore(projectId) {
7554
+ const result = await this.enqueueRequest({
7555
+ description: "Get Asset Type Fields",
7556
+ method: HttpMethod.GET,
7557
+ url: "/asset-type-fields/",
7558
+ queryParams: {
7559
+ project: projectId.toString()
7560
+ },
7561
+ blockers: [],
7562
+ blocks: []
7563
+ });
7564
+ this.dispatch(initializeAssetTypeFields(result));
7565
+ }
7566
+ }
7567
+ class AssetTypeFieldValuesService extends BaseApiService {
7568
+ add(payload) {
7569
+ var _a2;
7570
+ const { store } = this.client;
7571
+ const state = store.getState();
7572
+ const { values } = separateFilesFromValues(payload.values);
7573
+ const offlineAssetTypeFieldValues = offline({
7574
+ ...payload,
7575
+ values,
7576
+ created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
7577
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
7578
+ });
7579
+ const promise = this.enqueueRequest({
7580
+ description: "Add asset type field values",
7581
+ method: HttpMethod.POST,
7582
+ url: "/asset-type-field-values/",
7583
+ payload: offlineAssetTypeFieldValues,
7584
+ blockers: [payload.asset, payload.fields_revision],
7585
+ blocks: [offlineAssetTypeFieldValues.offline_id]
7586
+ });
7587
+ this.dispatch(addAssetTypeFieldValues(offlineAssetTypeFieldValues));
7588
+ promise.then((result) => {
7589
+ this.dispatch(updateAssetTypeFieldValues(result));
7590
+ return result;
7591
+ }).catch(() => {
7592
+ this.dispatch(deleteAssetTypeFieldValues(offlineAssetTypeFieldValues.offline_id));
7593
+ });
7594
+ return [offlineAssetTypeFieldValues, promise];
7595
+ }
7596
+ bulkAdd(payload, batchSize) {
7597
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7598
+ const { values } = separateFilesFromValues(payload.values);
7599
+ const payloadsBatches = chunkArray(payload.payloads, batchSize);
7600
+ const bulkAddPayloads = payloadsBatches.map((batch) => {
7601
+ return {
7602
+ submitted_at: submittedAt,
7603
+ values,
7604
+ field_values: batch.map((payload2) => {
7605
+ const { values: values2 } = separateFilesFromValues(payload2.values);
7606
+ return offline({
7607
+ ...payload2,
7608
+ values: values2
7609
+ });
7610
+ })
7611
+ };
7612
+ });
7613
+ const promises = [];
7614
+ for (const payload2 of bulkAddPayloads) {
7615
+ const assetIds = payload2.field_values.map((x) => x.asset);
7616
+ const assetTypeFieldsIds = payload2.field_values.map((x) => x.fields_revision);
7617
+ const assetTypeFieldValuesIds = payload2.field_values.map((x) => x.offline_id);
7618
+ const promise = this.enqueueRequest({
7619
+ description: "Bulk add asset type field values",
7620
+ method: HttpMethod.POST,
7621
+ url: "/asset-type-field-values/bulk/",
7622
+ payload: payload2,
7623
+ blockers: [...assetIds, ...assetTypeFieldsIds],
7624
+ blocks: assetTypeFieldValuesIds
7625
+ });
7626
+ promises.push(promise);
7627
+ }
7628
+ void Promise.all(promises).then((results) => {
7629
+ this.dispatch(addAssetTypeFieldValuesMany(results.flat()));
7630
+ });
7631
+ return promises;
7632
+ }
7633
+ update(payload) {
7634
+ const { store } = this.client;
7635
+ const state = store.getState();
7636
+ const assetTypeFieldValues = selectAssetTypeFieldValuesById(payload.offline_id)(state);
7637
+ if (!assetTypeFieldValues) {
7638
+ throw new Error(`Expected AssetTypeFieldValues with offline_id ${payload.offline_id} to exist`);
7639
+ }
7640
+ const { values } = separateFilesFromValues(payload.values ?? {});
7641
+ const updatedAssetTypeFieldValues = {
7642
+ ...assetTypeFieldValues,
7643
+ ...payload,
7644
+ // values could also have a partial update
7645
+ values: {
7646
+ ...assetTypeFieldValues.values,
7647
+ ...values
7648
+ }
7649
+ };
7650
+ this.dispatch(updateAssetTypeFieldValues(updatedAssetTypeFieldValues));
7651
+ const promise = this.enqueueRequest({
7652
+ description: "Delete asset type field values",
7653
+ method: HttpMethod.PATCH,
7654
+ url: `/asset-type-field-values/${payload.offline_id}/`,
7655
+ payload,
7656
+ blockers: [
7657
+ updatedAssetTypeFieldValues.offline_id,
7658
+ updatedAssetTypeFieldValues.fields_revision,
7659
+ updatedAssetTypeFieldValues.asset
7660
+ ],
7661
+ blocks: [updatedAssetTypeFieldValues.offline_id]
7662
+ });
7663
+ promise.then((result) => {
7664
+ this.dispatch(updateAssetTypeFieldValues(result));
7665
+ }).catch(() => {
7666
+ this.dispatch(updateAssetTypeFieldValues(assetTypeFieldValues));
7667
+ });
7668
+ return [updatedAssetTypeFieldValues, promise];
7669
+ }
7670
+ async delete(id) {
7671
+ const { store } = this.client;
7672
+ const state = store.getState();
7673
+ const assetTypeFieldValues = selectAssetTypeFieldValuesById(id)(state);
7674
+ if (!assetTypeFieldValues) {
7675
+ throw new Error(`Expected submission with offline_id ${id} to exist`);
7676
+ }
7677
+ const assetTypeFieldValuesAttachments = selectAttachmentsOfAssetTypeFieldValues(id)(state);
7678
+ this.dispatch(deleteAssetTypeFieldValues(id));
7679
+ this.dispatch(deleteAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments.map((x) => x.offline_id)));
7680
+ try {
7681
+ await this.enqueueRequest({
7682
+ description: "Delete asset type field values",
7683
+ method: HttpMethod.DELETE,
7684
+ url: `/asset-type-field-values/${id}/`,
7685
+ blockers: [id],
7686
+ blocks: []
7687
+ });
7688
+ } catch (e) {
7689
+ this.dispatch(addAssetTypeFieldValues(assetTypeFieldValues));
7690
+ this.dispatch(addAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments));
7691
+ throw e;
7692
+ }
7693
+ }
7694
+ async refreshStore(projectId) {
7695
+ const result = await this.enqueueRequest({
7696
+ description: "Get asset type field values",
7697
+ method: HttpMethod.GET,
7698
+ url: "/asset-type-field-values/",
7699
+ queryParams: {
7700
+ project: projectId.toString()
7701
+ },
7702
+ blockers: [],
7703
+ blocks: []
7704
+ });
7705
+ this.dispatch(initializeAssetTypeFieldValues(result));
7706
+ }
7707
+ }
7708
+ class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
7709
+ async bulkAdd(payloads) {
7710
+ var _a2;
7711
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7712
+ const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7713
+ const filePayloads = {};
7714
+ const offlineAssetTypeFieldValuesAttachments = [];
7715
+ const attachmentPayloads = [];
7716
+ for (const payload of payloads) {
7717
+ const { fieldValuesId, fieldIdentifier, file } = payload;
7718
+ const filePayload = await this.getFilePayload(file);
7719
+ if (!(filePayload.sha1 in filePayloads))
7720
+ filePayloads[filePayload.sha1] = filePayload;
7721
+ const offlineAssetTypeFieldValuesAttachment = offline({
7722
+ file: URL.createObjectURL(file),
7723
+ file_type: file.type,
7724
+ file_name: file.name,
7725
+ file_sha1: filePayload.sha1,
7726
+ created_by: createdBy,
7727
+ field_values: fieldValuesId,
7728
+ submitted_at: submittedAt,
7729
+ field_identifier: fieldIdentifier
7730
+ });
7731
+ offlineAssetTypeFieldValuesAttachments.push(offlineAssetTypeFieldValuesAttachment);
7732
+ const attachmentPayload = {
7733
+ offline_id: offlineAssetTypeFieldValuesAttachment.offline_id,
7734
+ file_name: file.name,
7735
+ file_sha1: filePayload.sha1,
7736
+ file_extension: filePayload.extension,
7737
+ field_identifier: fieldIdentifier,
7738
+ field_values: fieldValuesId
7739
+ };
7740
+ attachmentPayloads.push(attachmentPayload);
7741
+ }
7742
+ this.dispatch(addAssetTypeFieldValuesAttachments(offlineAssetTypeFieldValuesAttachments));
7743
+ const promise = this.enqueueRequest({
7744
+ description: "Add asset type field values attachments",
7745
+ method: HttpMethod.POST,
7746
+ url: "/asset-type-field-values-attachments/bulk/",
7747
+ payload: {
7748
+ submitted_at: submittedAt,
7749
+ attachments: attachmentPayloads,
7750
+ files: Object.values(filePayloads)
7751
+ },
7752
+ blockers: offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.field_values),
7753
+ blocks: offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
7754
+ });
7755
+ promise.then(({ presigned_urls, attachments }) => {
7756
+ this.processPresignedUrls(presigned_urls);
7757
+ this.dispatch(updateAssetTypeFieldValuesAttachments(attachments));
7758
+ }).catch((error) => {
7759
+ this.dispatch(
7760
+ deleteAssetTypeFieldValuesAttachments(
7761
+ offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
7762
+ )
7763
+ );
7764
+ throw error;
7765
+ });
7766
+ return [offlineAssetTypeFieldValuesAttachments, promise.then(({ attachments }) => attachments)];
7767
+ }
7768
+ async bulkDelete(ids) {
7769
+ const { store } = this.client;
7770
+ const state = store.getState();
7771
+ const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(ids)(state);
7772
+ this.dispatch(deleteFormSubmissionAttachments(ids));
7773
+ try {
7774
+ await this.enqueueRequest({
7775
+ description: "Delete asset type field values attachments",
7776
+ method: HttpMethod.DELETE,
7777
+ url: "/asset-type-field-values-attachments/bulk/",
7778
+ payload: { attachment_ids: ids },
7779
+ blockers: ids,
7780
+ blocks: []
7781
+ });
7782
+ } catch (e) {
7783
+ this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
7784
+ throw e;
7785
+ }
7786
+ }
7787
+ async refreshStore(projectId) {
7788
+ const result = await this.enqueueRequest({
7789
+ description: "Gfet asset type field values attachments",
7790
+ method: HttpMethod.GET,
7791
+ url: "/asset-type-field-values-attachments/",
7792
+ queryParams: {
7793
+ project: projectId.toString()
7794
+ },
7795
+ blockers: [],
7796
+ blocks: []
7797
+ });
7798
+ this.dispatch(initializeAssetTypeFieldValuesAttachments(result));
7799
+ }
7800
+ }
7801
+ class IssueTypeFieldsAttachmentService extends BaseUploadService {
7802
+ async bulkAdd(payloads) {
7803
+ var _a2;
7804
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7805
+ const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7806
+ const filePayloads = {};
7807
+ const offlineIssueTypeFieldsAttachments = [];
7808
+ const attachmentPayloads = [];
7809
+ for (const payload of payloads) {
7810
+ const { fieldsRevisionId, fieldIdentifier, file } = payload;
7811
+ const filePayload = await this.getFilePayload(file);
7812
+ if (!(filePayload.sha1 in filePayloads))
7813
+ filePayloads[filePayload.sha1] = filePayload;
7814
+ const offlineIssueTypeFieldsAttachment = offline({
7815
+ file: URL.createObjectURL(file),
7816
+ file_type: file.type,
7817
+ file_name: file.name,
7818
+ file_sha1: filePayload.sha1,
7819
+ created_by: createdBy,
7820
+ fields_revision: fieldsRevisionId,
7821
+ submitted_at: submittedAt,
7822
+ field_identifier: fieldIdentifier
7823
+ });
7824
+ offlineIssueTypeFieldsAttachments.push(offlineIssueTypeFieldsAttachment);
7825
+ const attachmentPayload = {
7826
+ offline_id: offlineIssueTypeFieldsAttachment.offline_id,
7827
+ file_name: file.name,
7828
+ file_extension: filePayload.extension,
7829
+ field_identifier: fieldIdentifier,
7830
+ file_sha1: filePayload.sha1,
7831
+ fields_revision: fieldsRevisionId
7832
+ };
7833
+ attachmentPayloads.push(attachmentPayload);
7834
+ }
7835
+ this.dispatch(addIssueTypeFieldsAttachments(offlineIssueTypeFieldsAttachments));
7836
+ const promise = this.enqueueRequest({
7837
+ description: "Add issue type fields attachments",
7838
+ method: HttpMethod.POST,
7839
+ url: "/issue-type-fields-attachments/bulk/",
7840
+ payload: {
7841
+ submitted_at: submittedAt,
7842
+ attachments: attachmentPayloads,
7843
+ files: Object.values(filePayloads)
7844
+ },
7845
+ blockers: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
7846
+ blocks: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
7847
+ });
7848
+ promise.then((result) => {
7849
+ this.processPresignedUrls(result.presigned_urls);
7850
+ this.dispatch(updateIssueTypeFieldsAttachments(result.attachments));
7851
+ }).catch(() => {
7852
+ this.dispatch(
7853
+ deleteIssueTypeFieldsAttachments(
7854
+ offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
7855
+ )
7856
+ );
7857
+ });
7858
+ return [offlineIssueTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
7859
+ }
7860
+ async refreshStore(organizationId) {
7861
+ const result = await this.enqueueRequest({
7862
+ description: "get issue type fields attachments",
7863
+ method: HttpMethod.GET,
7864
+ url: "/issue-type-fields-attachments/",
7865
+ queryParams: {
7866
+ organization: organizationId.toString()
7867
+ },
7868
+ blockers: [organizationId.toString()],
7869
+ blocks: []
7870
+ });
7871
+ this.dispatch(initializeIssueTypeFieldsAttachments(result));
7872
+ }
7873
+ }
7874
+ class IssueTypeFieldsService extends BaseApiService {
7875
+ add(payload) {
7876
+ var _a2;
7877
+ const { store } = this.client;
7878
+ const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7879
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7880
+ const offlineIssueTypeFields = offline({
7881
+ ...payload,
7882
+ created_by: createdBy,
7883
+ submitted_at: submittedAt
7884
+ });
7885
+ this.dispatch(addIssueTypeFields(offlineIssueTypeFields));
7886
+ const promise = this.enqueueRequest({
7887
+ description: "Add Issue Type Fields",
7888
+ method: HttpMethod.POST,
7889
+ url: "/issue-type-fields/",
7890
+ payload: offlineIssueTypeFields,
7891
+ blockers: [offlineIssueTypeFields.issue_type],
7892
+ blocks: [offlineIssueTypeFields.offline_id]
7893
+ });
7894
+ promise.then((response) => {
7895
+ this.dispatch(updateIssueTypeFields(response));
7896
+ }).catch((error) => {
7897
+ this.dispatch(deleteIssueTypeFields(offlineIssueTypeFields.offline_id));
7898
+ throw error;
7899
+ });
7900
+ return [offlineIssueTypeFields, promise];
7901
+ }
7902
+ async refreshStore(organizationId) {
7903
+ const result = await this.enqueueRequest({
7904
+ description: "Get Issue Type Fields",
7905
+ method: HttpMethod.GET,
7906
+ url: "/issue-type-fields/",
7907
+ queryParams: {
7908
+ organization: organizationId.toString()
7909
+ },
7910
+ blockers: [],
7911
+ blocks: []
7912
+ });
7913
+ this.dispatch(initializeIssueTypeFields(result));
7914
+ }
7915
+ }
7916
+ class IssueTypeFieldValuesAttachmentService extends BaseUploadService {
7917
+ async bulkAdd(payloads) {
7918
+ var _a2;
7919
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7920
+ const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
7921
+ const filePayloads = {};
7922
+ const offlineIssueTypeFieldValuesAttachments = [];
7923
+ const attachmentPayloads = [];
7924
+ for (const payload of payloads) {
7925
+ const { fieldValuesId, fieldIdentifier, file } = payload;
7926
+ const filePayload = await this.getFilePayload(file);
7927
+ if (!(filePayload.sha1 in filePayloads))
7928
+ filePayloads[filePayload.sha1] = filePayload;
7929
+ const offlineIssueTypeFieldValuesAttachment = offline({
7930
+ file: URL.createObjectURL(file),
7931
+ file_type: file.type,
7932
+ file_name: file.name,
7933
+ file_sha1: filePayload.sha1,
7934
+ created_by: createdBy,
7935
+ field_values: fieldValuesId,
7936
+ submitted_at: submittedAt,
7937
+ field_identifier: fieldIdentifier
7938
+ });
7939
+ offlineIssueTypeFieldValuesAttachments.push(offlineIssueTypeFieldValuesAttachment);
7940
+ const attachmentPayload = {
7941
+ offline_id: offlineIssueTypeFieldValuesAttachment.offline_id,
7942
+ file_name: file.name,
7943
+ file_sha1: filePayload.sha1,
7944
+ file_extension: filePayload.extension,
7945
+ field_identifier: fieldIdentifier,
7946
+ field_values: fieldValuesId
7947
+ };
7948
+ attachmentPayloads.push(attachmentPayload);
7949
+ }
7950
+ this.dispatch(addIssueTypeFieldValuesAttachments(offlineIssueTypeFieldValuesAttachments));
7951
+ const promise = this.enqueueRequest({
7952
+ description: "Add issue type field values attachments",
7953
+ method: HttpMethod.POST,
7954
+ url: "/issue-type-field-values-attachments/bulk/",
7955
+ payload: {
7956
+ submitted_at: submittedAt,
7957
+ attachments: attachmentPayloads,
7958
+ files: Object.values(filePayloads)
7959
+ },
7960
+ blockers: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.field_values),
7961
+ blocks: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
7962
+ });
7963
+ promise.then(({ presigned_urls, attachments }) => {
7964
+ this.processPresignedUrls(presigned_urls);
7965
+ this.dispatch(updateIssueTypeFieldValuesAttachments(attachments));
7966
+ }).catch((error) => {
7967
+ this.dispatch(
7968
+ deleteIssueTypeFieldValuesAttachments(
7969
+ offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
7970
+ )
7971
+ );
7972
+ throw error;
7973
+ });
7974
+ return [offlineIssueTypeFieldValuesAttachments, promise.then(({ attachments }) => attachments)];
7975
+ }
7976
+ async bulkDelete(attachmentsIds) {
7977
+ const { store } = this.client;
7978
+ const state = store.getState();
7979
+ const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
7980
+ this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
7981
+ try {
7982
+ await this.enqueueRequest({
7983
+ description: "Delete issue type field values attachments",
7984
+ method: HttpMethod.DELETE,
7985
+ url: "/issue-type-field-values-attachments/bulk/",
7986
+ payload: { attachment_ids: attachmentsIds },
7987
+ blockers: attachmentsIds,
7988
+ blocks: []
7989
+ });
7990
+ } catch (e) {
7991
+ this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
7992
+ throw e;
7993
+ }
7994
+ }
7995
+ async refreshStore(projectId) {
7996
+ const result = await this.enqueueRequest({
7997
+ description: "Get issue type field values attachments",
7998
+ method: HttpMethod.GET,
7999
+ url: "/issue-type-field-values-attachments/",
8000
+ queryParams: {
8001
+ project: projectId.toString()
8002
+ },
8003
+ blockers: [],
8004
+ blocks: []
8005
+ });
8006
+ this.dispatch(initializeIssueTypeFieldValuesAttachments(result));
8007
+ }
8008
+ }
8009
+ class IssueTypeFieldValuesService extends BaseApiService {
8010
+ add(payload) {
8011
+ var _a2;
8012
+ const { store } = this.client;
8013
+ const state = store.getState();
8014
+ const { values } = separateFilesFromValues(payload.values);
8015
+ const offlineIssueTypeFieldValues = offline({
8016
+ ...payload,
8017
+ values,
8018
+ created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
8019
+ submitted_at: (/* @__PURE__ */ new Date()).toISOString()
8020
+ });
8021
+ const promise = this.enqueueRequest({
8022
+ description: "Add issue type field values",
8023
+ method: HttpMethod.POST,
8024
+ url: "/issue-type-field-values/",
8025
+ payload: offlineIssueTypeFieldValues,
8026
+ blockers: [payload.issue, payload.fields_revision],
8027
+ blocks: [offlineIssueTypeFieldValues.offline_id]
8028
+ });
8029
+ this.dispatch(addIssueTypeFieldValues(offlineIssueTypeFieldValues));
8030
+ promise.then((result) => {
8031
+ this.dispatch(updateIssueTypeFieldValues(result));
8032
+ return result;
8033
+ }).catch(() => {
8034
+ this.dispatch(deleteIssueTypeFieldValues(offlineIssueTypeFieldValues.offline_id));
8035
+ });
8036
+ return [offlineIssueTypeFieldValues, promise];
8037
+ }
8038
+ update(payload) {
8039
+ const { store } = this.client;
8040
+ const state = store.getState();
8041
+ const issueTypeFieldValues = selectIssueTypeFieldValuesById(payload.offline_id)(state);
8042
+ if (!issueTypeFieldValues) {
8043
+ throw new Error(`Expected IssueTypeFieldValues with offline_id ${payload.offline_id} to exist`);
8044
+ }
8045
+ const { values } = separateFilesFromValues(payload.values ?? {});
8046
+ const updatedIssueTypeFieldValues = {
8047
+ ...issueTypeFieldValues,
8048
+ ...payload,
8049
+ // values could also have a partial update
8050
+ values: {
8051
+ ...issueTypeFieldValues.values,
8052
+ ...values
8053
+ }
8054
+ };
8055
+ this.dispatch(updateIssueTypeFieldValues(updatedIssueTypeFieldValues));
8056
+ const promise = this.enqueueRequest({
8057
+ description: "Update issue type field values",
8058
+ method: HttpMethod.PATCH,
8059
+ url: `/issue-type-field-values/${payload.offline_id}/`,
8060
+ payload,
8061
+ blockers: [
8062
+ updatedIssueTypeFieldValues.offline_id,
8063
+ updatedIssueTypeFieldValues.fields_revision,
8064
+ updatedIssueTypeFieldValues.issue
8065
+ ],
8066
+ blocks: [updatedIssueTypeFieldValues.offline_id]
8067
+ });
8068
+ promise.then((result) => {
8069
+ this.dispatch(updateIssueTypeFieldValues(result));
8070
+ }).catch(() => {
8071
+ this.dispatch(updateIssueTypeFieldValues(issueTypeFieldValues));
8072
+ });
8073
+ return [updatedIssueTypeFieldValues, promise];
8074
+ }
8075
+ async delete(id) {
8076
+ const { store } = this.client;
8077
+ const state = store.getState();
8078
+ const issueTypeFieldValues = selectIssueTypeFieldValuesById(id)(state);
8079
+ if (!issueTypeFieldValues) {
8080
+ throw new Error(`Expected submission with offline_id ${id} to exist`);
8081
+ }
8082
+ const issueTypeFieldValuesAttachments = selectAttachmentsOfIssueTypeFieldValues(id)(state);
8083
+ this.dispatch(deleteIssueTypeFieldValues(id));
8084
+ this.dispatch(deleteIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments.map((x) => x.offline_id)));
8085
+ try {
8086
+ await this.enqueueRequest({
8087
+ description: "Delete issue type field values",
8088
+ method: HttpMethod.DELETE,
8089
+ url: `/issue-type-field-values/${id}/`,
8090
+ blockers: [id],
8091
+ blocks: []
8092
+ });
8093
+ } catch (e) {
8094
+ this.dispatch(addIssueTypeFieldValues(issueTypeFieldValues));
8095
+ this.dispatch(addIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments));
8096
+ throw e;
8097
+ }
8098
+ }
8099
+ async refreshStore(projectId) {
8100
+ const result = await this.enqueueRequest({
8101
+ description: "Get issue type field values",
8102
+ method: HttpMethod.GET,
8103
+ url: "/issue-type-field-values/",
8104
+ queryParams: {
8105
+ project: projectId.toString()
8106
+ },
8107
+ blockers: [],
8108
+ blocks: []
8109
+ });
8110
+ this.dispatch(initializeIssueTypeFieldValues(result));
8111
+ }
8112
+ }
7330
8113
  var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
7331
8114
  VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
7332
8115
  VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
@@ -7344,6 +8127,10 @@ export {
7344
8127
  AssetStageCompletionService,
7345
8128
  AssetStageService,
7346
8129
  AssetTypeAttachmentService,
8130
+ AssetTypeFieldValuesAttachmentService,
8131
+ AssetTypeFieldValuesService,
8132
+ AssetTypeFieldsAttachmentService,
8133
+ AssetTypeFieldsService,
7347
8134
  AssetTypeService,
7348
8135
  AttachmentModel,
7349
8136
  BaseApiService,
@@ -7359,7 +8146,10 @@ export {
7359
8146
  EmailDomainsService,
7360
8147
  EmailVerificationService,
7361
8148
  FileService,
8149
+ FormRevisionAttachmentService,
8150
+ FormRevisionService,
7362
8151
  FormService,
8152
+ FormSubmissionAttachmentService,
7363
8153
  FormSubmissionService,
7364
8154
  GREEN,
7365
8155
  GeoImageService,
@@ -7370,6 +8160,10 @@ export {
7370
8160
  IssuePriority,
7371
8161
  IssueService,
7372
8162
  IssueStatus,
8163
+ IssueTypeFieldValuesAttachmentService,
8164
+ IssueTypeFieldValuesService,
8165
+ IssueTypeFieldsAttachmentService,
8166
+ IssueTypeFieldsService,
7373
8167
  IssueTypeService,
7374
8168
  IssueUpdateChange,
7375
8169
  IssueUpdateService,
@@ -7409,6 +8203,14 @@ export {
7409
8203
  addAssetType,
7410
8204
  addAssetTypeAttachment,
7411
8205
  addAssetTypeAttachments,
8206
+ addAssetTypeFieldValues,
8207
+ addAssetTypeFieldValuesAttachment,
8208
+ addAssetTypeFieldValuesAttachments,
8209
+ addAssetTypeFieldValuesMany,
8210
+ addAssetTypeFields,
8211
+ addAssetTypeFieldsAttachment,
8212
+ addAssetTypeFieldsAttachments,
8213
+ addAssetTypeFieldsMany,
7412
8214
  addAssetTypes,
7413
8215
  addAssets,
7414
8216
  addCategory,
@@ -7437,6 +8239,14 @@ export {
7437
8239
  addIssueComment,
7438
8240
  addIssueComments,
7439
8241
  addIssueType,
8242
+ addIssueTypeFieldValues,
8243
+ addIssueTypeFieldValuesAttachment,
8244
+ addIssueTypeFieldValuesAttachments,
8245
+ addIssueTypeFieldValuesMany,
8246
+ addIssueTypeFields,
8247
+ addIssueTypeFieldsAttachment,
8248
+ addIssueTypeFieldsAttachments,
8249
+ addIssueTypeFieldsMany,
7440
8250
  addIssueUpdate,
7441
8251
  addIssueUpdates,
7442
8252
  addIssues,
@@ -7462,6 +8272,14 @@ export {
7462
8272
  assetStageSlice,
7463
8273
  assetTypeAttachmentReducer,
7464
8274
  assetTypeAttachmentSlice,
8275
+ assetTypeFieldValuesAttachmentReducer,
8276
+ assetTypeFieldValuesAttachmentSlice,
8277
+ assetTypeFieldValuesReducer,
8278
+ assetTypeFieldValuesSlice,
8279
+ assetTypeFieldsAttachmentReducer,
8280
+ assetTypeFieldsAttachmentSlice,
8281
+ assetTypeFieldsReducer,
8282
+ assetTypeFieldsSlice,
7465
8283
  assetTypeReducer,
7466
8284
  assetTypeSlice,
7467
8285
  authReducer,
@@ -7490,6 +8308,14 @@ export {
7490
8308
  deleteAssetType,
7491
8309
  deleteAssetTypeAttachment,
7492
8310
  deleteAssetTypeAttachments,
8311
+ deleteAssetTypeFieldValues,
8312
+ deleteAssetTypeFieldValuesAttachment,
8313
+ deleteAssetTypeFieldValuesAttachments,
8314
+ deleteAssetTypeFieldValuesMany,
8315
+ deleteAssetTypeFields,
8316
+ deleteAssetTypeFieldsAttachment,
8317
+ deleteAssetTypeFieldsAttachments,
8318
+ deleteAssetTypeFieldsMany,
7493
8319
  deleteAssetTypes,
7494
8320
  deleteAssets,
7495
8321
  deleteCategory,
@@ -7514,6 +8340,14 @@ export {
7514
8340
  deleteIssueAttachments,
7515
8341
  deleteIssueComment,
7516
8342
  deleteIssueComments,
8343
+ deleteIssueTypeFieldValues,
8344
+ deleteIssueTypeFieldValuesAttachment,
8345
+ deleteIssueTypeFieldValuesAttachments,
8346
+ deleteIssueTypeFieldValuesMany,
8347
+ deleteIssueTypeFields,
8348
+ deleteIssueTypeFieldsAttachment,
8349
+ deleteIssueTypeFieldsAttachments,
8350
+ deleteIssueTypeFieldsMany,
7517
8351
  deleteIssueUpdate,
7518
8352
  deleteIssueUpdates,
7519
8353
  deleteIssues,
@@ -7570,6 +8404,10 @@ export {
7570
8404
  initializeAssetStageCompletions,
7571
8405
  initializeAssetStages,
7572
8406
  initializeAssetTypeAttachments,
8407
+ initializeAssetTypeFieldValues,
8408
+ initializeAssetTypeFieldValuesAttachments,
8409
+ initializeAssetTypeFields,
8410
+ initializeAssetTypeFieldsAttachments,
7573
8411
  initializeAssetTypes,
7574
8412
  initializeAssets,
7575
8413
  initializeCategories,
@@ -7584,6 +8422,10 @@ export {
7584
8422
  initializeGeoImages,
7585
8423
  initializeIssueAssociations,
7586
8424
  initializeIssueAttachments,
8425
+ initializeIssueTypeFieldValues,
8426
+ initializeIssueTypeFieldValuesAttachments,
8427
+ initializeIssueTypeFields,
8428
+ initializeIssueTypeFieldsAttachments,
7587
8429
  initializeIssueTypes,
7588
8430
  initializeIssueUpdates,
7589
8431
  initializeIssues,
@@ -7602,6 +8444,14 @@ export {
7602
8444
  issueCommentSlice,
7603
8445
  issueReducer,
7604
8446
  issueSlice,
8447
+ issueTypeFieldValuesAttachmentReducer,
8448
+ issueTypeFieldValuesAttachmentSlice,
8449
+ issueTypeFieldValuesReducer,
8450
+ issueTypeFieldValuesSlice,
8451
+ issueTypeFieldsAttachmentReducer,
8452
+ issueTypeFieldsAttachmentSlice,
8453
+ issueTypeFieldsReducer,
8454
+ issueTypeFieldsSlice,
7605
8455
  issueTypeReducer,
7606
8456
  issueTypeSlice,
7607
8457
  issueUpdateReducer,
@@ -7674,6 +8524,20 @@ export {
7674
8524
  selectAssetTypeAttachmentMapping,
7675
8525
  selectAssetTypeAttachments,
7676
8526
  selectAssetTypeById,
8527
+ selectAssetTypeFieldValues,
8528
+ selectAssetTypeFieldValuesAttachmentById,
8529
+ selectAssetTypeFieldValuesAttachments,
8530
+ selectAssetTypeFieldValuesAttachmentsMapping,
8531
+ selectAssetTypeFieldValuesById,
8532
+ selectAssetTypeFieldValuesMapping,
8533
+ selectAssetTypeFieldValuesOfAsset,
8534
+ selectAssetTypeFields,
8535
+ selectAssetTypeFieldsAttachmentById,
8536
+ selectAssetTypeFieldsAttachments,
8537
+ selectAssetTypeFieldsAttachmentsMapping,
8538
+ selectAssetTypeFieldsById,
8539
+ selectAssetTypeFieldsMapping,
8540
+ selectAssetTypeFieldsOfAssetType,
7677
8541
  selectAssetTypeStagesMapping,
7678
8542
  selectAssetTypes,
7679
8543
  selectAssetTypesByIds,
@@ -7682,18 +8546,20 @@ export {
7682
8546
  selectAssetsByIds,
7683
8547
  selectAssetsMapping,
7684
8548
  selectAssetsOfAssetType,
7685
- selectAttachedFormSubmissionsOfAsset,
7686
- selectAttachedFormSubmissionsOfIssue,
7687
8549
  selectAttachmentsOfAsset,
7688
8550
  selectAttachmentsOfAssetByType,
7689
8551
  selectAttachmentsOfAssetType,
7690
8552
  selectAttachmentsOfAssetTypeByType,
8553
+ selectAttachmentsOfAssetTypeFieldValues,
8554
+ selectAttachmentsOfAssetTypeFields,
7691
8555
  selectAttachmentsOfDocument,
7692
8556
  selectAttachmentsOfDocumentByType,
7693
8557
  selectAttachmentsOfFormRevision,
7694
8558
  selectAttachmentsOfFormSubmission,
7695
8559
  selectAttachmentsOfIssue,
7696
8560
  selectAttachmentsOfIssueByType,
8561
+ selectAttachmentsOfIssueTypeFieldValues,
8562
+ selectAttachmentsOfIssueTypeFields,
7697
8563
  selectAttachmentsOfProject,
7698
8564
  selectAttachmentsOfProjectByType,
7699
8565
  selectCategories,
@@ -7721,8 +8587,6 @@ export {
7721
8587
  selectFilteredForms,
7722
8588
  selectFormById,
7723
8589
  selectFormMapping,
7724
- selectFormOfAssetType,
7725
- selectFormOfIssueType,
7726
8590
  selectFormRevisionAttachmentsMapping,
7727
8591
  selectFormRevisionById,
7728
8592
  selectFormRevisionMapping,
@@ -7732,9 +8596,7 @@ export {
7732
8596
  selectFormSubmissionAttachmentsMapping,
7733
8597
  selectFormSubmissionById,
7734
8598
  selectFormSubmissions,
7735
- selectFormSubmissionsByAssets,
7736
8599
  selectFormSubmissionsByFormRevisions,
7737
- selectFormSubmissionsByIssues,
7738
8600
  selectFormSubmissionsMapping,
7739
8601
  selectFormSubmissionsOfAsset,
7740
8602
  selectFormSubmissionsOfForm,
@@ -7763,6 +8625,20 @@ export {
7763
8625
  selectIssueCountOfCategory,
7764
8626
  selectIssueMapping,
7765
8627
  selectIssueTypeById,
8628
+ selectIssueTypeFieldValues,
8629
+ selectIssueTypeFieldValuesAttachmentById,
8630
+ selectIssueTypeFieldValuesAttachments,
8631
+ selectIssueTypeFieldValuesAttachmentsMapping,
8632
+ selectIssueTypeFieldValuesById,
8633
+ selectIssueTypeFieldValuesMapping,
8634
+ selectIssueTypeFieldValuesOfIssue,
8635
+ selectIssueTypeFields,
8636
+ selectIssueTypeFieldsAttachmentById,
8637
+ selectIssueTypeFieldsAttachments,
8638
+ selectIssueTypeFieldsAttachmentsMapping,
8639
+ selectIssueTypeFieldsById,
8640
+ selectIssueTypeFieldsMapping,
8641
+ selectIssueTypeFieldsOfIssueType,
7766
8642
  selectIssueTypeMapping,
7767
8643
  selectIssueTypes,
7768
8644
  selectIssueTypesByIds,
@@ -7829,6 +8705,8 @@ export {
7829
8705
  selectWorkspaceById,
7830
8706
  selectWorkspaceMapping,
7831
8707
  selectWorkspaces,
8708
+ separateFilesFromValues,
8709
+ separateImageFromFields,
7832
8710
  setActiveProjectFileId,
7833
8711
  setActiveProjectId,
7834
8712
  setAsset,
@@ -7839,6 +8717,14 @@ export {
7839
8717
  setAssetType,
7840
8718
  setAssetTypeAttachment,
7841
8719
  setAssetTypeAttachments,
8720
+ setAssetTypeFieldValues,
8721
+ setAssetTypeFieldValuesAttachment,
8722
+ setAssetTypeFieldValuesAttachments,
8723
+ setAssetTypeFieldValuesMany,
8724
+ setAssetTypeFields,
8725
+ setAssetTypeFieldsAttachment,
8726
+ setAssetTypeFieldsAttachments,
8727
+ setAssetTypeFieldsMany,
7842
8728
  setAssetTypes,
7843
8729
  setAssets,
7844
8730
  setConversation,
@@ -7864,6 +8750,14 @@ export {
7864
8750
  setIssueComment,
7865
8751
  setIssueComments,
7866
8752
  setIssueType,
8753
+ setIssueTypeFieldValues,
8754
+ setIssueTypeFieldValuesAttachment,
8755
+ setIssueTypeFieldValuesAttachments,
8756
+ setIssueTypeFieldValuesMany,
8757
+ setIssueTypeFields,
8758
+ setIssueTypeFieldsAttachment,
8759
+ setIssueTypeFieldsAttachments,
8760
+ setIssueTypeFieldsMany,
7867
8761
  setIssueUpdate,
7868
8762
  setLoggedIn,
7869
8763
  setOrganizations,
@@ -7896,6 +8790,14 @@ export {
7896
8790
  updateAssetType,
7897
8791
  updateAssetTypeAttachment,
7898
8792
  updateAssetTypeAttachments,
8793
+ updateAssetTypeFieldValues,
8794
+ updateAssetTypeFieldValuesAttachment,
8795
+ updateAssetTypeFieldValuesAttachments,
8796
+ updateAssetTypeFieldValuesMany,
8797
+ updateAssetTypeFields,
8798
+ updateAssetTypeFieldsAttachment,
8799
+ updateAssetTypeFieldsAttachments,
8800
+ updateAssetTypeFieldsMany,
7899
8801
  updateAssetTypes,
7900
8802
  updateAssets,
7901
8803
  updateCategory,
@@ -7918,6 +8820,14 @@ export {
7918
8820
  updateIssueAttachment,
7919
8821
  updateIssueAttachments,
7920
8822
  updateIssueType,
8823
+ updateIssueTypeFieldValues,
8824
+ updateIssueTypeFieldValuesAttachment,
8825
+ updateIssueTypeFieldValuesAttachments,
8826
+ updateIssueTypeFieldValuesMany,
8827
+ updateIssueTypeFields,
8828
+ updateIssueTypeFieldsAttachment,
8829
+ updateIssueTypeFieldsAttachments,
8830
+ updateIssueTypeFieldsMany,
7921
8831
  updateLicense,
7922
8832
  updateOrCreateProject,
7923
8833
  updateOrganizationAccess,