@overmap-ai/core 1.0.63 → 1.0.65-bulk-form-submit.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -642,6 +642,11 @@ var __publicField = (obj, key, value) => {
642
642
  return bounds[0][0] > coordinates[0] && bounds[1][0] < coordinates[0] && bounds[0][1] > coordinates[1] && bounds[1][1] < coordinates[1];
643
643
  }
644
644
  const emailRegex = /^.+@.+\..+$/;
645
+ const fullAssetMarkerSize = 45;
646
+ const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
647
+ const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
648
+ const OUTBOX_RETRY_DELAY = 5e3;
649
+ const EMPTY_ARRAY = Object.freeze([]);
645
650
  let debug = false;
646
651
  const REACT_APP_DEBUG_MEMOIZATION = {}.REACT_APP_DEBUG_MEMOIZATION || "";
647
652
  if (["true", "1"].includes(REACT_APP_DEBUG_MEMOIZATION.toLowerCase())) {
@@ -704,6 +709,9 @@ var __publicField = (obj, key, value) => {
704
709
  return true;
705
710
  }
706
711
  const genericMemo = React.memo;
712
+ const fallbackToEmptyArray = (array) => {
713
+ return array.length === 0 ? EMPTY_ARRAY : array;
714
+ };
707
715
  const primaryColor = "#2D55E2";
708
716
  const successColor = "#349C55";
709
717
  const warningColor = "#FFA620";
@@ -878,7 +886,7 @@ var __publicField = (obj, key, value) => {
878
886
  console.warn("selectCategoryByIds: No category exists with the id", categoryId);
879
887
  }
880
888
  }
881
- return categories;
889
+ return fallbackToEmptyArray(categories);
882
890
  }
883
891
  )
884
892
  );
@@ -892,51 +900,12 @@ var __publicField = (obj, key, value) => {
892
900
  return Object.values(state.issueReducer.instances).filter((issue) => issue.category === categoryId).length;
893
901
  };
894
902
  const categoryReducer = categorySlice.reducer;
895
- const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
896
- const initialState$z = assetTypeAdapter.getInitialState({});
897
- const assetTypeSlice = toolkit.createSlice({
898
- name: "assetTypes",
899
- initialState: initialState$z,
900
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
901
- reducers: {
902
- initializeAssetTypes: assetTypeAdapter.initialize,
903
- addAssetType: assetTypeAdapter.addOne,
904
- deleteAssetType: assetTypeAdapter.deleteOne
905
- }
906
- });
907
- const { addAssetType, initializeAssetTypes, deleteAssetType } = assetTypeSlice.actions;
908
- const selectAssetTypesMapping = (state) => state.assetTypeReducer.instances;
909
- const selectAssetTypes = toolkit.createSelector(
910
- [selectAssetTypesMapping],
911
- (mapping) => Object.values(mapping)
912
- );
913
- const selectAssetTypeById = (id) => (state) => {
914
- return state.assetTypeReducer.instances[id];
915
- };
916
- const selectAssetTypesByIds = restructureCreateSelectorWithArgs(
917
- toolkit.createSelector(
918
- [selectAssetTypesMapping, (_state, assetTypeIds) => assetTypeIds],
919
- (assetTypeMapping, assetTypeIds) => {
920
- const assetTypes = [];
921
- for (const assetTypeId of assetTypeIds) {
922
- const assetType = assetTypeMapping[assetTypeId];
923
- if (assetType) {
924
- assetTypes.push(assetType);
925
- } else {
926
- console.warn("selectAssetTypesByIds: No assetType exists with the id", assetTypeId);
927
- }
928
- }
929
- return assetTypes;
930
- }
931
- )
932
- );
933
- const assetTypeReducer = assetTypeSlice.reducer;
934
903
  const assetAdapter = createModelAdapter((asset) => asset.offline_id);
935
- const initialState$y = assetAdapter.getInitialState({});
904
+ const initialState$z = assetAdapter.getInitialState({});
936
905
  const assetSlice = toolkit.createSlice({
937
906
  name: "assets",
938
- initialState: initialState$y,
939
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
907
+ initialState: initialState$z,
908
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
940
909
  reducers: {
941
910
  initializeAssets: assetAdapter.initialize,
942
911
  addAsset: assetAdapter.addOne,
@@ -965,8 +934,8 @@ var __publicField = (obj, key, value) => {
965
934
  return Object.values(assetsMapping);
966
935
  });
967
936
  const selectAssetsOfAssetType = restructureCreateSelectorWithArgs(
968
- toolkit.createSelector([selectAssets, (_state, assetTypeId) => assetTypeId], (components, assetTypeId) => {
969
- return components.filter((asset) => asset.asset_type === assetTypeId);
937
+ toolkit.createSelector([selectAssets, (_state, assetTypeId) => assetTypeId], (assets, assetTypeId) => {
938
+ return fallbackToEmptyArray(assets.filter((asset) => asset.asset_type === assetTypeId));
970
939
  })
971
940
  );
972
941
  const selectAssetById = (assetId) => (state) => {
@@ -980,38 +949,19 @@ var __publicField = (obj, key, value) => {
980
949
  if (asset)
981
950
  assets.push(asset);
982
951
  }
983
- return assets;
952
+ return fallbackToEmptyArray(assets);
984
953
  })
985
954
  );
986
- const selectAssetToAssetTypeMapping = toolkit.createSelector(
987
- [selectAssets, selectAssetTypesMapping],
988
- (assets, assetTypeMapping) => {
989
- const ret = {};
990
- for (const asset of assets) {
991
- const assetType = assetTypeMapping[asset.asset_type];
992
- if (!assetType) {
993
- console.error(
994
- `Asset type with ID ${asset.asset_type} not found.
995
- Expected all referenced asset types to be populated.
996
- Returning empty object to avoid fatal errors.`
997
- );
998
- return {};
999
- }
1000
- ret[asset.offline_id] = assetType;
1001
- }
1002
- return ret;
1003
- }
1004
- );
1005
955
  const selectNumberOfAssetsOfAssetType = (assetTypeId) => (state) => {
1006
956
  return selectAssetsOfAssetType(assetTypeId)(state).length;
1007
957
  };
1008
958
  const assetReducer = assetSlice.reducer;
1009
959
  const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
1010
- const initialState$x = assetAttachmentAdapter.getInitialState({});
960
+ const initialState$y = assetAttachmentAdapter.getInitialState({});
1011
961
  const assetAttachmentSlice = toolkit.createSlice({
1012
962
  name: "assetAttachments",
1013
- initialState: initialState$x,
1014
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
963
+ initialState: initialState$y,
964
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
1015
965
  reducers: {
1016
966
  initializeAssetAttachments: assetAttachmentAdapter.initialize,
1017
967
  addAssetAttachment: assetAttachmentAdapter.addOne,
@@ -1047,7 +997,7 @@ var __publicField = (obj, key, value) => {
1047
997
  toolkit.createSelector(
1048
998
  [selectAssetAttachments, (_state, assetId) => assetId],
1049
999
  (attachments, assetId) => {
1050
- return attachments.filter(({ asset }) => assetId === asset);
1000
+ return fallbackToEmptyArray(attachments.filter(({ asset }) => assetId === asset));
1051
1001
  }
1052
1002
  )
1053
1003
  );
@@ -1069,13 +1019,13 @@ var __publicField = (obj, key, value) => {
1069
1019
  )
1070
1020
  );
1071
1021
  const assetAttachmentReducer = assetAttachmentSlice.reducer;
1072
- const initialState$w = {
1022
+ const initialState$x = {
1073
1023
  completionsByAssetId: {}
1074
1024
  };
1075
1025
  const assetStageCompletionSlice = toolkit.createSlice({
1076
1026
  name: "assetStageCompletions",
1077
- initialState: initialState$w,
1078
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1027
+ initialState: initialState$x,
1028
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1079
1029
  reducers: {
1080
1030
  addStageCompletion: (state, action) => {
1081
1031
  let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
@@ -1127,11 +1077,11 @@ var __publicField = (obj, key, value) => {
1127
1077
  );
1128
1078
  const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
1129
1079
  const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
1130
- const initialState$v = assetStageAdapter.getInitialState({});
1080
+ const initialState$w = assetStageAdapter.getInitialState({});
1131
1081
  const assetStageSlice = toolkit.createSlice({
1132
1082
  name: "assetStages",
1133
- initialState: initialState$v,
1134
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1083
+ initialState: initialState$w,
1084
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1135
1085
  reducers: {
1136
1086
  initializeStages: assetStageAdapter.initialize,
1137
1087
  setStage: assetStageAdapter.setOne,
@@ -1142,11 +1092,9 @@ var __publicField = (obj, key, value) => {
1142
1092
  }
1143
1093
  });
1144
1094
  const selectStageMapping = (state) => state.assetStageReducer.instances;
1145
- const selectAssetStageById = restructureCreateSelectorWithArgs(
1146
- toolkit.createSelector([selectStageMapping, (_state, stageId) => stageId], (stageMapping, stageId) => {
1147
- return stageMapping[stageId];
1148
- })
1149
- );
1095
+ const selectAssetStageById = (id) => (state) => {
1096
+ return state.assetStageReducer.instances[id];
1097
+ };
1150
1098
  const selectAssetStages = toolkit.createSelector([selectStageMapping], (stageMapping) => {
1151
1099
  return Object.values(stageMapping);
1152
1100
  });
@@ -1181,7 +1129,9 @@ var __publicField = (obj, key, value) => {
1181
1129
  );
1182
1130
  const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
1183
1131
  toolkit.createSelector([selectAssetStages, (_state, assetTypeId) => assetTypeId], (stages, assetTypeId) => {
1184
- return stages.filter((stage) => stage.asset_type === assetTypeId).sort((a, b) => a.priority - b.priority);
1132
+ return fallbackToEmptyArray(
1133
+ stages.filter((stage) => stage.asset_type === assetTypeId).sort((a, b) => a.priority - b.priority)
1134
+ );
1185
1135
  })
1186
1136
  );
1187
1137
  const selectAssetStagesByIds = restructureCreateSelectorWithArgs(
@@ -1195,7 +1145,7 @@ var __publicField = (obj, key, value) => {
1195
1145
  console.warn("selectStagesFromStageIds: No stage exists with the id", stageId);
1196
1146
  }
1197
1147
  }
1198
- return assetStages;
1148
+ return fallbackToEmptyArray(assetStages);
1199
1149
  })
1200
1150
  );
1201
1151
  const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
@@ -1215,6 +1165,45 @@ var __publicField = (obj, key, value) => {
1215
1165
  );
1216
1166
  const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
1217
1167
  const assetStageReducer = assetStageSlice.reducer;
1168
+ const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
1169
+ const initialState$v = assetTypeAdapter.getInitialState({});
1170
+ const assetTypeSlice = toolkit.createSlice({
1171
+ name: "assetTypes",
1172
+ initialState: initialState$v,
1173
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1174
+ reducers: {
1175
+ initializeAssetTypes: assetTypeAdapter.initialize,
1176
+ addAssetType: assetTypeAdapter.addOne,
1177
+ deleteAssetType: assetTypeAdapter.deleteOne
1178
+ }
1179
+ });
1180
+ const { addAssetType, initializeAssetTypes, deleteAssetType } = assetTypeSlice.actions;
1181
+ const selectAssetTypesMapping = (state) => state.assetTypeReducer.instances;
1182
+ const selectAssetTypes = toolkit.createSelector(
1183
+ [selectAssetTypesMapping],
1184
+ (mapping) => Object.values(mapping)
1185
+ );
1186
+ const selectAssetTypeById = (id) => (state) => {
1187
+ return state.assetTypeReducer.instances[id];
1188
+ };
1189
+ const selectAssetTypesByIds = restructureCreateSelectorWithArgs(
1190
+ toolkit.createSelector(
1191
+ [selectAssetTypesMapping, (_state, assetTypeIds) => assetTypeIds],
1192
+ (assetTypeMapping, assetTypeIds) => {
1193
+ const assetTypes = [];
1194
+ for (const assetTypeId of assetTypeIds) {
1195
+ const assetType = assetTypeMapping[assetTypeId];
1196
+ if (assetType) {
1197
+ assetTypes.push(assetType);
1198
+ } else {
1199
+ console.warn("selectAssetTypesByIds: No assetType exists with the id", assetTypeId);
1200
+ }
1201
+ }
1202
+ return fallbackToEmptyArray(assetTypes);
1203
+ }
1204
+ )
1205
+ );
1206
+ const assetTypeReducer = assetTypeSlice.reducer;
1218
1207
  const assetTypeAttachmentAdapter = createModelAdapter(
1219
1208
  (attachment) => attachment.offline_id
1220
1209
  );
@@ -1258,7 +1247,7 @@ var __publicField = (obj, key, value) => {
1258
1247
  toolkit.createSelector(
1259
1248
  [selectAssetTypeAttachments, (_state, assetTypeId) => assetTypeId],
1260
1249
  (attachments, assetTypeId) => {
1261
- return attachments.filter(({ asset_type }) => assetTypeId === asset_type);
1250
+ return fallbackToEmptyArray(attachments.filter(({ asset_type }) => assetTypeId === asset_type));
1262
1251
  }
1263
1252
  )
1264
1253
  );
@@ -1440,7 +1429,7 @@ var __publicField = (obj, key, value) => {
1440
1429
  console.warn("selectIssuesByIds: No issue exists with the id", issueId);
1441
1430
  }
1442
1431
  }
1443
- return issues;
1432
+ return fallbackToEmptyArray(issues);
1444
1433
  })
1445
1434
  );
1446
1435
  const selectRecentIssuesAsSearchResults = toolkit.createSelector(
@@ -1523,7 +1512,7 @@ var __publicField = (obj, key, value) => {
1523
1512
  toolkit.createSelector(
1524
1513
  [selectIssueTypes, (_, organizationId) => organizationId],
1525
1514
  (issueTypes, organizationId) => {
1526
- return issueTypes.filter((issueType) => issueType.organization === organizationId);
1515
+ return fallbackToEmptyArray(issueTypes.filter((issueType) => issueType.organization === organizationId));
1527
1516
  }
1528
1517
  )
1529
1518
  );
@@ -1531,7 +1520,9 @@ var __publicField = (obj, key, value) => {
1531
1520
  toolkit.createSelector(
1532
1521
  [(state) => state.issueReducer.instances, (_, issueTypeId) => issueTypeId],
1533
1522
  (issuesMapping, issueTypeId) => {
1534
- return Object.values(issuesMapping).filter((issue) => issue.issue_type === issueTypeId);
1523
+ return fallbackToEmptyArray(
1524
+ Object.values(issuesMapping).filter((issue) => issue.issue_type === issueTypeId)
1525
+ );
1535
1526
  }
1536
1527
  )
1537
1528
  );
@@ -1710,7 +1701,7 @@ var __publicField = (obj, key, value) => {
1710
1701
  console.warn("selectUsersByIds: No user exists with the id", userId);
1711
1702
  }
1712
1703
  }
1713
- return users;
1704
+ return fallbackToEmptyArray(users);
1714
1705
  })
1715
1706
  );
1716
1707
  const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
@@ -1777,7 +1768,9 @@ var __publicField = (obj, key, value) => {
1777
1768
  const selectLicenseForProject = (projectId) => (state) => Object.values(state.licenseReducer.instances).find((license) => license.project === projectId);
1778
1769
  const selectActiveStatusLicenses = toolkit.createSelector(
1779
1770
  [selectLicenses],
1780
- (licenses) => Object.values(licenses).filter((license) => license.is_active)
1771
+ (licenses) => {
1772
+ return fallbackToEmptyArray(Object.values(licenses).filter((license) => license.is_active));
1773
+ }
1781
1774
  );
1782
1775
  const selectLicensesForProjectsMapping = toolkit.createSelector(
1783
1776
  [selectLicenses],
@@ -1923,10 +1916,6 @@ var __publicField = (obj, key, value) => {
1923
1916
  [selectProjectUsersIds, selectUsersMapping],
1924
1917
  (projectUserIds, users) => projectUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
1925
1918
  );
1926
- const selectProjectsWithAccess = toolkit.createSelector(
1927
- [selectProjectMapping],
1928
- (projects) => Object.values(projects).filter((project) => !project.invited)
1929
- );
1930
1919
  const selectSortedProjectUsers = toolkit.createSelector(
1931
1920
  [selectCurrentUser, selectProjectUsersAsMapping, selectProjectAccessUserMapping],
1932
1921
  (currentUser, userMapping, projectAccessMapping) => {
@@ -1975,7 +1964,11 @@ var __publicField = (obj, key, value) => {
1975
1964
  };
1976
1965
  const selectOrganizationsWithAccess = toolkit.createSelector(
1977
1966
  [selectOrganizations],
1978
- (organizations) => Object.values(organizations).filter((organization) => organization.has_access)
1967
+ (organizations) => {
1968
+ return fallbackToEmptyArray(
1969
+ Object.values(organizations).filter((organization) => organization.has_access)
1970
+ );
1971
+ }
1979
1972
  );
1980
1973
  const selectOrganizationUsersIds = toolkit.createSelector(
1981
1974
  [selectOrganizationAccesses],
@@ -1985,13 +1978,17 @@ var __publicField = (obj, key, value) => {
1985
1978
  toolkit.createSelector(
1986
1979
  [selectProjectMapping, (_, organizationId) => organizationId],
1987
1980
  (projects, organizationId) => {
1988
- return Object.values(projects).filter((project) => project.organization_owner === organizationId);
1981
+ return fallbackToEmptyArray(
1982
+ Object.values(projects).filter((project) => project.organization_owner === organizationId)
1983
+ );
1989
1984
  }
1990
1985
  )
1991
1986
  );
1992
1987
  const selectLicensesOfOrganization = restructureCreateSelectorWithArgs(
1993
1988
  toolkit.createSelector([selectLicenses, (_, organizationId) => organizationId], (licenses, organizationId) => {
1994
- return Object.values(licenses).filter((license) => license.organization_owner === organizationId);
1989
+ return fallbackToEmptyArray(
1990
+ Object.values(licenses).filter((license) => license.organization_owner === organizationId)
1991
+ );
1995
1992
  })
1996
1993
  );
1997
1994
  const selectOrganizationUsersAsMapping = toolkit.createSelector(
@@ -2159,7 +2156,9 @@ var __publicField = (obj, key, value) => {
2159
2156
  const selectProjectFiles = toolkit.createSelector(
2160
2157
  [selectProjectFileMapping, selectActiveProjectId],
2161
2158
  (mapping, activeProjectId) => {
2162
- return Object.values(mapping).filter((file) => file.project === activeProjectId).sort((a, b) => a.z_index - b.z_index);
2159
+ return fallbackToEmptyArray(
2160
+ Object.values(mapping).filter((file) => file.project === activeProjectId).sort((a, b) => a.z_index - b.z_index)
2161
+ );
2163
2162
  }
2164
2163
  );
2165
2164
  const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
@@ -2207,7 +2206,7 @@ var __publicField = (obj, key, value) => {
2207
2206
  };
2208
2207
  const selectAttachmentsOfProject = restructureCreateSelectorWithArgs(
2209
2208
  toolkit.createSelector([selectAllProjectAttachments, (_, projectId) => projectId], (attachments, projectId) => {
2210
- return attachments.filter(({ project }) => projectId === project);
2209
+ return fallbackToEmptyArray(attachments.filter(({ project }) => projectId === project));
2211
2210
  })
2212
2211
  );
2213
2212
  const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
@@ -2317,9 +2316,7 @@ var __publicField = (obj, key, value) => {
2317
2316
  toolkit.createSelector(
2318
2317
  [selectFormRevisions, (_state, formId) => formId],
2319
2318
  (revisions, formId) => {
2320
- return revisions.filter((revision) => {
2321
- return revision.form === formId;
2322
- });
2319
+ return fallbackToEmptyArray(revisions.filter((revision) => revision.form === formId));
2323
2320
  }
2324
2321
  )
2325
2322
  );
@@ -2467,12 +2464,16 @@ var __publicField = (obj, key, value) => {
2467
2464
  selectFormRevisionMapping,
2468
2465
  (_state, formId) => formId
2469
2466
  ],
2470
- (submissions, revisionMapping, formId) => {
2471
- const revisionsOfForm = Object.values(revisionMapping).filter((revision) => revision.form === formId);
2472
- const revisionIds = new Set(revisionsOfForm.map((revision) => revision.offline_id));
2473
- return Object.values(submissions).filter((submission) => {
2474
- return revisionIds.has(submission.form_revision);
2475
- });
2467
+ (submissionsMapping, revisionMapping, formId) => {
2468
+ const revisionIds = /* @__PURE__ */ new Set();
2469
+ for (const revision of Object.values(revisionMapping)) {
2470
+ if (revision.form !== formId)
2471
+ continue;
2472
+ revisionIds.add(revision.offline_id);
2473
+ }
2474
+ return Object.values(submissionsMapping).filter(
2475
+ (submission) => revisionIds.has(submission.form_revision)
2476
+ );
2476
2477
  }
2477
2478
  )
2478
2479
  );
@@ -2668,7 +2669,9 @@ var __publicField = (obj, key, value) => {
2668
2669
  [selectFormSubmissionAttachmentsMapping, (_, attachmentIds) => attachmentIds],
2669
2670
  (mapping, attachmentIds) => {
2670
2671
  const attachmentIdsSet = new Set(attachmentIds);
2671
- return Object.values(mapping).filter((attachment) => attachmentIdsSet.has(attachment.offline_id));
2672
+ return fallbackToEmptyArray(
2673
+ Object.values(mapping).filter((attachment) => attachmentIdsSet.has(attachment.offline_id))
2674
+ );
2672
2675
  }
2673
2676
  )
2674
2677
  );
@@ -2676,7 +2679,9 @@ var __publicField = (obj, key, value) => {
2676
2679
  toolkit.createSelector(
2677
2680
  [selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
2678
2681
  (attachmentsMapping, submissionId) => {
2679
- return Object.values(attachmentsMapping).filter((attachment) => attachment.submission === submissionId);
2682
+ return fallbackToEmptyArray(
2683
+ Object.values(attachmentsMapping).filter((attachment) => attachment.submission === submissionId)
2684
+ );
2680
2685
  }
2681
2686
  )
2682
2687
  );
@@ -2719,7 +2724,9 @@ var __publicField = (obj, key, value) => {
2719
2724
  toolkit.createSelector(
2720
2725
  [selectFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
2721
2726
  (attachments, revisionId) => {
2722
- return Object.values(attachments).filter((attachment) => attachment.revision === revisionId);
2727
+ return fallbackToEmptyArray(
2728
+ Object.values(attachments).filter((attachment) => attachment.revision === revisionId)
2729
+ );
2723
2730
  }
2724
2731
  )
2725
2732
  );
@@ -2742,7 +2749,9 @@ var __publicField = (obj, key, value) => {
2742
2749
  toolkit.createSelector(
2743
2750
  [selectEmailDomains, (_, organizationId) => organizationId],
2744
2751
  (emailDomains, organizationId) => {
2745
- return emailDomains.filter((emailDomain) => emailDomain.organization === organizationId);
2752
+ return fallbackToEmptyArray(
2753
+ emailDomains.filter((emailDomain) => emailDomain.organization === organizationId)
2754
+ );
2746
2755
  }
2747
2756
  )
2748
2757
  );
@@ -2919,7 +2928,7 @@ var __publicField = (obj, key, value) => {
2919
2928
  console.warn("selectDocumentByIds: No document exists with the id", documentId);
2920
2929
  }
2921
2930
  }
2922
- return documents;
2931
+ return fallbackToEmptyArray(documents);
2923
2932
  }
2924
2933
  )
2925
2934
  );
@@ -2934,12 +2943,12 @@ var __publicField = (obj, key, value) => {
2934
2943
  listOfAncestors.push(currentAncestor.offline_id);
2935
2944
  currentAncestor = mapping[currentAncestor.parent_document ?? ""];
2936
2945
  }
2937
- return listOfAncestors;
2946
+ return fallbackToEmptyArray(listOfAncestors);
2938
2947
  })
2939
2948
  );
2940
2949
  const selectRootDocuments = toolkit.createSelector(
2941
2950
  [selectDocuments],
2942
- (documents) => documents.filter((document2) => !document2.parent_document)
2951
+ (documents) => fallbackToEmptyArray(documents.filter((document2) => !document2.parent_document))
2943
2952
  );
2944
2953
  const documentsReducer = documentSlice.reducer;
2945
2954
  const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
@@ -2983,7 +2992,7 @@ var __publicField = (obj, key, value) => {
2983
2992
  toolkit.createSelector(
2984
2993
  [selectAllDocumentAttachments, (_state, documentId) => documentId],
2985
2994
  (attachments, documentId) => {
2986
- return attachments.filter(({ document: document2 }) => documentId === document2);
2995
+ return fallbackToEmptyArray(attachments.filter(({ document: document2 }) => documentId === document2));
2987
2996
  }
2988
2997
  )
2989
2998
  );
@@ -3027,17 +3036,34 @@ var __publicField = (obj, key, value) => {
3027
3036
  const selectTeamById = (id) => (state) => {
3028
3037
  return state.teamReducer.instances[id];
3029
3038
  };
3039
+ const selectTeamsByIds = restructureCreateSelectorWithArgs(
3040
+ toolkit.createSelector(
3041
+ [selectTeamsMapping, (_state, teamIds) => teamIds],
3042
+ (mapping, teamIds) => {
3043
+ const teams = [];
3044
+ for (const teamId of teamIds) {
3045
+ const team = mapping[teamId];
3046
+ if (team) {
3047
+ teams.push(team);
3048
+ } else {
3049
+ console.warn("selectTeamsByIds: No team exists with the id", teamId);
3050
+ }
3051
+ }
3052
+ return fallbackToEmptyArray(teams);
3053
+ }
3054
+ )
3055
+ );
3030
3056
  const selectTeamsOfOrganization = restructureCreateSelectorWithArgs(
3031
3057
  toolkit.createSelector(
3032
3058
  [selectTeams, (_state, organizationId) => organizationId],
3033
3059
  (teams, organizationId) => {
3034
- return teams.filter((team) => team.organization === organizationId);
3060
+ return fallbackToEmptyArray(teams.filter((team) => team.organization === organizationId));
3035
3061
  }
3036
3062
  )
3037
3063
  );
3038
3064
  const selectTeamsOfUser = restructureCreateSelectorWithArgs(
3039
3065
  toolkit.createSelector([selectTeams, (_state, userId) => userId], (teams, userId) => {
3040
- return teams.filter((team) => team.members.includes(userId));
3066
+ return fallbackToEmptyArray(teams.filter((team) => team.members.includes(userId)));
3041
3067
  })
3042
3068
  );
3043
3069
  const teamReducer = teamSlice.reducer;
@@ -3097,7 +3123,7 @@ var __publicField = (obj, key, value) => {
3097
3123
  toolkit.createSelector(
3098
3124
  [selectIssueCommentMapping, (_state, issueId) => issueId],
3099
3125
  (commentMapping, issueId) => {
3100
- return Object.values(commentMapping).filter((comment) => comment.issue === issueId);
3126
+ return fallbackToEmptyArray(Object.values(commentMapping).filter((comment) => comment.issue === issueId));
3101
3127
  }
3102
3128
  )
3103
3129
  );
@@ -3130,7 +3156,7 @@ var __publicField = (obj, key, value) => {
3130
3156
  toolkit.createSelector(
3131
3157
  [selectIssueUpdateMapping, (_state, issueId) => issueId],
3132
3158
  (updates, issueId) => {
3133
- return Object.values(updates).filter((update) => update.issue === issueId);
3159
+ return fallbackToEmptyArray(Object.values(updates).filter((update) => update.issue === issueId));
3134
3160
  }
3135
3161
  )
3136
3162
  );
@@ -3173,7 +3199,7 @@ var __publicField = (obj, key, value) => {
3173
3199
  toolkit.createSelector(
3174
3200
  [selectIssueAttachments, (_state, issueId) => issueId],
3175
3201
  (attachments, issueId) => {
3176
- return attachments.filter(({ issue }) => issueId === issue);
3202
+ return fallbackToEmptyArray(attachments.filter(({ issue }) => issueId === issue));
3177
3203
  }
3178
3204
  )
3179
3205
  );
@@ -3247,7 +3273,7 @@ var __publicField = (obj, key, value) => {
3247
3273
  };
3248
3274
  const selectGeoImagesOfProject = restructureCreateSelectorWithArgs(
3249
3275
  toolkit.createSelector([selectGeoImages, (_, projectId) => projectId], (mapImages, projectId) => {
3250
- return mapImages.filter((mapImage) => mapImage.project === projectId);
3276
+ return fallbackToEmptyArray(mapImages.filter((mapImage) => mapImage.project === projectId));
3251
3277
  })
3252
3278
  );
3253
3279
  const geoImageReducer = geoImageSlice.reducer;
@@ -3291,7 +3317,9 @@ var __publicField = (obj, key, value) => {
3291
3317
  toolkit.createSelector(
3292
3318
  [selectIssueAssociationMapping, (_state, issueId) => issueId],
3293
3319
  (associationMapping, issueId) => {
3294
- return Object.values(associationMapping).filter((assoc) => assoc.associated_issue === issueId);
3320
+ return fallbackToEmptyArray(
3321
+ Object.values(associationMapping).filter((assoc) => assoc.associated_issue === issueId)
3322
+ );
3295
3323
  }
3296
3324
  )
3297
3325
  );
@@ -3299,7 +3327,7 @@ var __publicField = (obj, key, value) => {
3299
3327
  toolkit.createSelector(
3300
3328
  [selectIssueAssociationMapping, (_state, issueId) => issueId],
3301
3329
  (associationMapping, issueId) => {
3302
- return Object.values(associationMapping).filter((assoc) => assoc.issue === issueId);
3330
+ return fallbackToEmptyArray(Object.values(associationMapping).filter((assoc) => assoc.issue === issueId));
3303
3331
  }
3304
3332
  )
3305
3333
  );
@@ -3307,15 +3335,11 @@ var __publicField = (obj, key, value) => {
3307
3335
  toolkit.createSelector(
3308
3336
  [selectIssueAssociationMapping, (_state, assetId) => assetId],
3309
3337
  (associationMapping, assetId) => {
3310
- return Object.values(associationMapping).filter((assoc) => assoc.asset === assetId);
3338
+ return fallbackToEmptyArray(Object.values(associationMapping).filter((assoc) => assoc.asset === assetId));
3311
3339
  }
3312
3340
  )
3313
3341
  );
3314
3342
  const issueAssociationReducer = issueAssociationSlice.reducer;
3315
- const fullAssetMarkerSize = 45;
3316
- const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
3317
- const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
3318
- const OUTBOX_RETRY_DELAY = 5e3;
3319
3343
  let clientStore;
3320
3344
  function setClientStore(store) {
3321
3345
  clientStore = store;
@@ -5878,13 +5902,11 @@ var __publicField = (obj, key, value) => {
5878
5902
  const newValues = {};
5879
5903
  for (const key in values) {
5880
5904
  const value = values[key];
5881
- if (value === void 0)
5882
- throw new Error("Expected value to be defined");
5883
5905
  if (value instanceof File) {
5884
5906
  files[key] = [value];
5885
5907
  } else if (isArrayOfFiles(value)) {
5886
5908
  files[key] = value;
5887
- } else {
5909
+ } else if (value !== void 0) {
5888
5910
  newValues[key] = value;
5889
5911
  }
5890
5912
  }
@@ -6989,7 +7011,7 @@ var __publicField = (obj, key, value) => {
6989
7011
  void this.enqueueRequest({
6990
7012
  description: "Add attachment to AI assistant",
6991
7013
  method: HttpMethod.PATCH,
6992
- url: `/document-attachments/${attachmnentId}/`,
7014
+ url: `/documents/attachments/${attachmnentId}/`,
6993
7015
  payload: {
6994
7016
  readable_to_assistant: true
6995
7017
  },
@@ -7514,6 +7536,7 @@ var __publicField = (obj, key, value) => {
7514
7536
  exports2.DeferredPromise = DeferredPromise;
7515
7537
  exports2.DocumentAttachmentService = DocumentAttachmentService;
7516
7538
  exports2.DocumentService = DocumentService;
7539
+ exports2.EMPTY_ARRAY = EMPTY_ARRAY;
7517
7540
  exports2.EmailDomainsService = EmailDomainsService;
7518
7541
  exports2.EmailVerificationService = EmailVerificationService;
7519
7542
  exports2.FileService = FileService;
@@ -7694,6 +7717,7 @@ var __publicField = (obj, key, value) => {
7694
7717
  exports2.enqueue = enqueue;
7695
7718
  exports2.enqueueRequest = enqueueRequest;
7696
7719
  exports2.errorColor = errorColor;
7720
+ exports2.fallbackToEmptyArray = fallbackToEmptyArray;
7697
7721
  exports2.fileReducer = fileReducer;
7698
7722
  exports2.fileSlice = fileSlice;
7699
7723
  exports2.fileToBlob = fileToBlob;
@@ -7830,7 +7854,6 @@ var __publicField = (obj, key, value) => {
7830
7854
  exports2.selectAssetStageById = selectAssetStageById;
7831
7855
  exports2.selectAssetStages = selectAssetStages;
7832
7856
  exports2.selectAssetStagesByIds = selectAssetStagesByIds;
7833
- exports2.selectAssetToAssetTypeMapping = selectAssetToAssetTypeMapping;
7834
7857
  exports2.selectAssetTypeAttachmentById = selectAssetTypeAttachmentById;
7835
7858
  exports2.selectAssetTypeAttachmentMapping = selectAssetTypeAttachmentMapping;
7836
7859
  exports2.selectAssetTypeAttachments = selectAssetTypeAttachments;
@@ -7969,7 +7992,6 @@ var __publicField = (obj, key, value) => {
7969
7992
  exports2.selectProjectUsersAsMapping = selectProjectUsersAsMapping;
7970
7993
  exports2.selectProjectUsersIds = selectProjectUsersIds;
7971
7994
  exports2.selectProjectsOfOrganization = selectProjectsOfOrganization;
7972
- exports2.selectProjectsWithAccess = selectProjectsWithAccess;
7973
7995
  exports2.selectRecentIssueIds = selectRecentIssueIds;
7974
7996
  exports2.selectRecentIssuesAsSearchResults = selectRecentIssuesAsSearchResults;
7975
7997
  exports2.selectRehydrated = selectRehydrated;
@@ -7983,6 +8005,7 @@ var __publicField = (obj, key, value) => {
7983
8005
  exports2.selectStagesOfAssetType = selectStagesOfAssetType;
7984
8006
  exports2.selectTeamById = selectTeamById;
7985
8007
  exports2.selectTeams = selectTeams;
8008
+ exports2.selectTeamsByIds = selectTeamsByIds;
7986
8009
  exports2.selectTeamsMapping = selectTeamsMapping;
7987
8010
  exports2.selectTeamsOfOrganization = selectTeamsOfOrganization;
7988
8011
  exports2.selectTeamsOfUser = selectTeamsOfUser;