@adobe/spacecat-shared-data-access 3.74.1 → 3.74.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [@adobe/spacecat-shared-data-access-v3.74.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.74.1...@adobe/spacecat-shared-data-access-v3.74.2) (2026-06-11)
2
+
3
+ ### Bug Fixes
4
+
5
+ * reset linked issue status to NEW on FixEntity removal ([#1668](https://github.com/adobe/spacecat-shared/issues/1668)) ([46c54b8](https://github.com/adobe/spacecat-shared/commit/46c54b8829ea3b00029a4afa0cb835f3e7983dc9))
6
+
1
7
  ## [@adobe/spacecat-shared-data-access-v3.74.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.74.0...@adobe/spacecat-shared-data-access-v3.74.1) (2026-06-09)
2
8
 
3
9
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "3.74.1",
3
+ "version": "3.74.2",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -44,6 +44,50 @@ class FixEntity extends BaseModel {
44
44
  return fixEntityCollection
45
45
  .getSuggestionsByFixEntityId(this.getId());
46
46
  }
47
+
48
+ /**
49
+ * Removes this FixEntity. When the fix is bound to a specific issue (granular CWV
50
+ * model — `changeDetails.issueId` is set), also rewinds every linked Suggestion so
51
+ * the issue is reopenable: clears `data.issues[issueId].fixEntityId` and resets
52
+ * that issue's status to NEW. The fix row and its junction rows are deleted by the
53
+ * inherited remove flow.
54
+ *
55
+ * Skipped when the fix has no issueId (legacy / non-CWV fixes) — same behavior as
56
+ * before. Also skipped when this method is reached as a dependent cascade (parent
57
+ * removal goes through `_remove()` directly), since the parent teardown moots the
58
+ * per-issue rewind.
59
+ */
60
+ async remove() {
61
+ const issueId = this.record?.changeDetails?.issueId;
62
+ if (issueId) {
63
+ await this.#resetLinkedIssues(issueId);
64
+ }
65
+ return super.remove();
66
+ }
67
+
68
+ async #resetLinkedIssues(issueId) {
69
+ const suggestions = await this.getSuggestions();
70
+
71
+ await Promise.all(suggestions.map(async (suggestion) => {
72
+ const data = suggestion.getData();
73
+ if (!data || !Array.isArray(data.issues)) {
74
+ return;
75
+ }
76
+ let mutated = false;
77
+ const nextIssues = data.issues.map((issue) => {
78
+ if (issue && issue.id === issueId) {
79
+ mutated = true;
80
+ return { ...issue, status: 'NEW', fixEntityId: null };
81
+ }
82
+ return issue;
83
+ });
84
+ if (!mutated) {
85
+ return;
86
+ }
87
+ suggestion.setData({ ...data, issues: nextIssues });
88
+ await suggestion.save();
89
+ }));
90
+ }
47
91
  }
48
92
 
49
93
  export default FixEntity;