@adobe/spacecat-shared-content-client 1.1.10 → 1.1.12
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 +14 -0
- package/package.json +2 -2
- package/src/clients/content-client.js +10 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-content-client-v1.1.12](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-content-client-v1.1.11...@adobe/spacecat-shared-content-client-v1.1.12) (2024-10-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update dependency @adobe/spacecat-helix-content-sdk to v1.2.1 ([#403](https://github.com/adobe/spacecat-shared/issues/403)) ([898e988](https://github.com/adobe/spacecat-shared/commit/898e9884216103884106e734a9c8a7b0aefebf38))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-content-client-v1.1.11](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-content-client-v1.1.10...@adobe/spacecat-shared-content-client-v1.1.11) (2024-10-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* latest helix sdk ([1b7f29e](https://github.com/adobe/spacecat-shared/commit/1b7f29e07de02d15791a986761056febf8006b86))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-content-client-v1.1.10](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-content-client-v1.1.9...@adobe/spacecat-shared-content-client-v1.1.10) (2024-10-12)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-content-client",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - Content Client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@adobe/helix-universal": "5.0.6",
|
|
38
|
-
"@adobe/spacecat-helix-content-sdk": "1.2.
|
|
38
|
+
"@adobe/spacecat-helix-content-sdk": "1.2.1",
|
|
39
39
|
"@adobe/spacecat-shared-utils": "1.19.6",
|
|
40
40
|
"graph-data-structure": "4.0.0"
|
|
41
41
|
},
|
|
@@ -236,7 +236,8 @@ export default class ContentClient {
|
|
|
236
236
|
this.log.info(`Getting page metadata for ${this.site.getId()} and path ${path}`);
|
|
237
237
|
|
|
238
238
|
const docPath = this.#resolveDocPath(path);
|
|
239
|
-
const
|
|
239
|
+
const document = await this.rawClient.read(docPath);
|
|
240
|
+
const metadata = document.getMetadata();
|
|
240
241
|
|
|
241
242
|
this.#logDuration('getPageMetadata', startTime);
|
|
242
243
|
|
|
@@ -255,7 +256,8 @@ export default class ContentClient {
|
|
|
255
256
|
this.log.info(`Updating page metadata for ${this.site.getId()} and path ${path}`);
|
|
256
257
|
|
|
257
258
|
const docPath = this.#resolveDocPath(path);
|
|
258
|
-
const
|
|
259
|
+
const document = await this.rawClient.read(docPath);
|
|
260
|
+
const originalMetadata = document.getMetadata();
|
|
259
261
|
|
|
260
262
|
let mergedMetadata;
|
|
261
263
|
if (overwrite) {
|
|
@@ -264,9 +266,12 @@ export default class ContentClient {
|
|
|
264
266
|
mergedMetadata = new Map([...metadata, ...originalMetadata]);
|
|
265
267
|
}
|
|
266
268
|
|
|
267
|
-
const response = await
|
|
268
|
-
if (response
|
|
269
|
-
|
|
269
|
+
const response = await document.updateMetadata(mergedMetadata);
|
|
270
|
+
if (response?.status !== 200) {
|
|
271
|
+
const saveResponse = await this.rawClient.save(document);
|
|
272
|
+
if (saveResponse.status !== 200) {
|
|
273
|
+
throw new Error(`Failed to update metadata for path ${path}`);
|
|
274
|
+
}
|
|
270
275
|
}
|
|
271
276
|
|
|
272
277
|
this.#logDuration('updatePageMetadata', startTime);
|