@adobe/spacecat-shared-data-access 1.61.17 → 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,17 @@
|
|
|
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
|
+
|
|
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)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* import top pages ([c68b563](https://github.com/adobe/spacecat-shared/commit/c68b563e45b3af5810a569ab52f317751b2df847))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v1.61.17](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.61.16...@adobe/spacecat-shared-data-access-v1.61.17) (2025-01-07)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -252,14 +252,27 @@ class BaseModel {
|
|
|
252
252
|
async _remove() {
|
|
253
253
|
try {
|
|
254
254
|
const dependents = await this.#fetchDependents();
|
|
255
|
-
|
|
256
|
-
const removePromises = dependents.map((dependent) =>
|
|
257
|
-
|
|
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;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { hasText } from '@adobe/spacecat-shared-utils';
|
|
13
|
+
import { hasText, isNonEmptyArray } from '@adobe/spacecat-shared-utils';
|
|
14
14
|
|
|
15
15
|
import BaseCollection from '../base/base.collection.js';
|
|
16
16
|
|
|
@@ -37,7 +37,9 @@ class SiteTopPageCollection extends BaseCollection {
|
|
|
37
37
|
|
|
38
38
|
const topPageIdsToRemove = topPagesToRemove.map((topPage) => topPage.getId());
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
if (isNonEmptyArray(topPageIdsToRemove)) {
|
|
41
|
+
await this.removeByIds(topPageIdsToRemove);
|
|
42
|
+
}
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
|