@adobe/spacecat-shared-data-access 1.61.18 → 1.61.19

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,10 @@
1
+ # [@adobe/spacecat-shared-data-access-v1.61.19](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.61.18...@adobe/spacecat-shared-data-access-v1.61.19) (2025-01-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * dependent remove errors, more tests ([#532](https://github.com/adobe/spacecat-shared/issues/532)) ([cdec563](https://github.com/adobe/spacecat-shared/commit/cdec563c881d088feeb5ed24514f528173eec59d))
7
+
1
8
  # [@adobe/spacecat-shared-data-access-v1.61.18](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.61.17...@adobe/spacecat-shared-data-access-v1.61.18) (2025-01-08)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "1.61.18",
3
+ "version": "1.61.19",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -252,14 +252,27 @@ class BaseModel {
252
252
  async _remove() {
253
253
  try {
254
254
  const dependents = await this.#fetchDependents();
255
- // eslint-disable-next-line no-underscore-dangle
256
- const removePromises = dependents.map((dependent) => dependent._remove());
257
- removePromises.push(this.entity.remove({ [this.idName]: this.getId() }).go());
255
+
256
+ const removePromises = dependents.map(async (dependent) => {
257
+ try {
258
+ // eslint-disable-next-line no-underscore-dangle
259
+ await dependent._remove();
260
+ } catch (e) {
261
+ this.log.error(`Failed to remove dependent entity ${dependent.entityName} with ID ${dependent.getId()}`, e);
262
+ throw new DataAccessError(
263
+ `Failed to remove dependent entity ${dependent.entityName} with ID ${dependent.getId()}`,
264
+ dependent,
265
+ e,
266
+ );
267
+ }
268
+ });
258
269
 
259
270
  this.log.info(`Removing entity ${this.entityName} with ID ${this.getId()} and ${dependents.length} dependents`);
260
271
 
261
272
  await Promise.all(removePromises);
262
273
 
274
+ await this.entity.remove({ [this.idName]: this.getId() }).go();
275
+
263
276
  this.#invalidateCache();
264
277
 
265
278
  return this;