@overmap-ai/core 1.0.44-tiptap.1 → 1.0.44-tiptap.3

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.
@@ -1679,6 +1679,17 @@ const selectAttachmentsOfComponent = restructureCreateSelectorWithArgs(
1679
1679
  }
1680
1680
  )
1681
1681
  );
1682
+ const selectAttachmentsOfComponentByType = restructureCreateSelectorWithArgs(
1683
+ createSelector(
1684
+ [selectAllComponentAttachments, (_state, componentId) => componentId],
1685
+ (attachments, componentId) => {
1686
+ const attachmentsOfComponent = attachments.filter(({ component_id }) => componentId === component_id);
1687
+ const fileAttachments = attachmentsOfComponent.filter(({ file_type }) => !file_type.startsWith("image/"));
1688
+ const imageAttachments = attachmentsOfComponent.filter(({ file_type }) => file_type.startsWith("image/"));
1689
+ return { fileAttachments, imageAttachments };
1690
+ }
1691
+ )
1692
+ );
1682
1693
  const {
1683
1694
  addComponent,
1684
1695
  updateComponent,
@@ -1932,6 +1943,19 @@ const selectAttachmentsOfComponentType = restructureCreateSelectorWithArgs(
1932
1943
  }
1933
1944
  )
1934
1945
  );
1946
+ const selectAttachmentsOfComponentTypeByType = restructureCreateSelectorWithArgs(
1947
+ createSelector(
1948
+ [selectAllComponentTypeAttachments, (_state, componentTypeId) => componentTypeId],
1949
+ (attachments, componentTypeId) => {
1950
+ const attachmentsOfComponent = attachments.filter(
1951
+ ({ component_type_id }) => component_type_id === componentTypeId
1952
+ );
1953
+ const fileAttachments = attachmentsOfComponent.filter(({ file_type }) => !file_type.startsWith("image/"));
1954
+ const imageAttachments = attachmentsOfComponent.filter(({ file_type }) => file_type.startsWith("image/"));
1955
+ return { fileAttachments, imageAttachments };
1956
+ }
1957
+ )
1958
+ );
1935
1959
  const {
1936
1960
  addComponentType,
1937
1961
  setComponentTypes,
@@ -2214,6 +2238,25 @@ const selectCommentsOfIssue = restructureCreateSelectorWithArgs(
2214
2238
  return Object.values(commentMapping).filter((comment) => comment.issue === issueId);
2215
2239
  })
2216
2240
  );
2241
+ const selectAttachmentsOfIssue = restructureCreateSelectorWithArgs(
2242
+ createSelector(
2243
+ [selectIssueAttachments, (_state, issueId) => issueId],
2244
+ (attachments, issueId) => {
2245
+ return attachments.filter(({ issue_id }) => issueId === issue_id);
2246
+ }
2247
+ )
2248
+ );
2249
+ const selectAttachmentsOfIssueByType = restructureCreateSelectorWithArgs(
2250
+ createSelector(
2251
+ [selectIssueAttachments, (_state, issueId) => issueId],
2252
+ (attachments, issueId) => {
2253
+ const attachmentsOfComponent = attachments.filter(({ issue_id }) => issue_id === issueId);
2254
+ const fileAttachments = attachmentsOfComponent.filter(({ file_type }) => !file_type.startsWith("image/"));
2255
+ const imageAttachments = attachmentsOfComponent.filter(({ file_type }) => file_type.startsWith("image/"));
2256
+ return { fileAttachments, imageAttachments };
2257
+ }
2258
+ )
2259
+ );
2217
2260
  const selectFileAttachmentsOfIssue = restructureCreateSelectorWithArgs(
2218
2261
  createSelector(
2219
2262
  [selectIssueAttachmentMapping, (_state, issueId) => issueId],
@@ -4381,7 +4424,7 @@ class AttachmentService extends BaseApiService {
4381
4424
  if (!attachment) {
4382
4425
  throw new Error(`Attachment ${componentAttachmentId} not found`);
4383
4426
  }
4384
- store.dispatch(removeIssueAttachment(componentAttachmentId));
4427
+ store.dispatch(removeComponentAttachment(componentAttachmentId));
4385
4428
  void this.client.files.removeCache(attachment.file_sha1);
4386
4429
  return this.enqueueRequest({
4387
4430
  description: "Delete attachment",
@@ -4397,7 +4440,7 @@ class AttachmentService extends BaseApiService {
4397
4440
  if (!attachment) {
4398
4441
  throw new Error(`Attachment ${componentTypeAttachmentId} not found`);
4399
4442
  }
4400
- store.dispatch(removeIssueAttachment(componentTypeAttachmentId));
4443
+ store.dispatch(removeComponentTypeAttachment(componentTypeAttachmentId));
4401
4444
  void this.client.files.removeCache(attachment.file_sha1);
4402
4445
  return this.enqueueRequest({
4403
4446
  description: "Delete attachment",
@@ -5323,9 +5366,9 @@ class IssueService extends BaseApiService {
5323
5366
  throw new Error(`No issue with id ${id} found in the store`);
5324
5367
  }
5325
5368
  const attachments = Object.values(state.issueReducer.attachments).filter((a) => a.issue_id === id);
5326
- const attachmentsOfIssue = selectPhotoAttachmentsOfIssue(id)(state);
5369
+ const attachmentsOfIssue = selectAttachmentsOfIssue(id)(state);
5327
5370
  this.client.store.dispatch(removeIssue(id));
5328
- if (attachmentsOfIssue) {
5371
+ if (attachmentsOfIssue.length > 0) {
5329
5372
  this.client.store.dispatch(removeAttachmentsOfIssue(id));
5330
5373
  }
5331
5374
  try {
@@ -14947,7 +14990,11 @@ export {
14947
14990
  selectAllComponentTypeAttachments,
14948
14991
  selectAppearance,
14949
14992
  selectAttachmentsOfComponent,
14993
+ selectAttachmentsOfComponentByType,
14950
14994
  selectAttachmentsOfComponentType,
14995
+ selectAttachmentsOfComponentTypeByType,
14996
+ selectAttachmentsOfIssue,
14997
+ selectAttachmentsOfIssueByType,
14951
14998
  selectCategories,
14952
14999
  selectCategoriesOfWorkspace,
14953
15000
  selectCategory,