@adobe/spacecat-shared-content-client 1.2.1 → 1.2.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.
- package/CHANGELOG.md +14 -0
- package/package.json +3 -3
- package/src/clients/content-client.js +10 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-content-client-v1.2.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-content-client-v1.2.2...@adobe/spacecat-shared-content-client-v1.2.3) (2024-11-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update external fixes ([#454](https://github.com/adobe/spacecat-shared/issues/454)) ([325cf8d](https://github.com/adobe/spacecat-shared/commit/325cf8dded5fcabadaf7d8fdd510d33aeafd08a7))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-content-client-v1.2.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-content-client-v1.2.1...@adobe/spacecat-shared-content-client-v1.2.2) (2024-11-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @adobe/spacecat-helix-content-sdk to v1.3.5 ([#445](https://github.com/adobe/spacecat-shared/issues/445)) ([a4a1027](https://github.com/adobe/spacecat-shared/commit/a4a1027c5ac7b2c2d342a37eca15d7a85a4582cc))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-content-client-v1.2.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-content-client-v1.2.0...@adobe/spacecat-shared-content-client-v1.2.1) (2024-11-16)
|
|
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.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - Content Client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@adobe/helix-universal": "5.0.6",
|
|
38
38
|
"@adobe/spacecat-shared-data-access": "1.50.0",
|
|
39
|
-
"@adobe/spacecat-helix-content-sdk": "1.
|
|
39
|
+
"@adobe/spacecat-helix-content-sdk": "1.3.5",
|
|
40
40
|
"@adobe/spacecat-shared-utils": "1.22.4",
|
|
41
41
|
"graph-data-structure": "4.2.0"
|
|
42
42
|
},
|
|
@@ -47,6 +47,6 @@
|
|
|
47
47
|
"nock": "13.5.6",
|
|
48
48
|
"sinon": "19.0.2",
|
|
49
49
|
"sinon-chai": "4.0.0",
|
|
50
|
-
"typescript": "5.
|
|
50
|
+
"typescript": "5.7.2"
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -264,8 +264,8 @@ export default class ContentClient {
|
|
|
264
264
|
this.log.info(`Getting page metadata for ${this.site.getId()} and path ${path}`);
|
|
265
265
|
|
|
266
266
|
const docPath = this.#resolveDocPath(path);
|
|
267
|
-
const document =
|
|
268
|
-
const metadata = document.getMetadata();
|
|
267
|
+
const document = this.rawClient.getDocument(docPath);
|
|
268
|
+
const metadata = await document.getMetadata();
|
|
269
269
|
|
|
270
270
|
this.#logDuration('getPageMetadata', startTime);
|
|
271
271
|
|
|
@@ -284,8 +284,8 @@ export default class ContentClient {
|
|
|
284
284
|
this.log.info(`Updating page metadata for ${this.site.getId()} and path ${path}`);
|
|
285
285
|
|
|
286
286
|
const docPath = this.#resolveDocPath(path);
|
|
287
|
-
const document =
|
|
288
|
-
const originalMetadata = document.getMetadata();
|
|
287
|
+
const document = this.rawClient.getDocument(docPath);
|
|
288
|
+
const originalMetadata = await document.getMetadata();
|
|
289
289
|
|
|
290
290
|
let mergedMetadata;
|
|
291
291
|
if (overwrite) {
|
|
@@ -296,10 +296,7 @@ export default class ContentClient {
|
|
|
296
296
|
|
|
297
297
|
const response = await document.updateMetadata(mergedMetadata);
|
|
298
298
|
if (response?.status !== 200) {
|
|
299
|
-
|
|
300
|
-
if (saveResponse.status !== 200) {
|
|
301
|
-
throw new Error(`Failed to update metadata for path ${path}`);
|
|
302
|
-
}
|
|
299
|
+
throw new Error(`Failed to update metadata for path ${path}`);
|
|
303
300
|
}
|
|
304
301
|
|
|
305
302
|
this.#logDuration('updatePageMetadata', startTime);
|
|
@@ -313,7 +310,8 @@ export default class ContentClient {
|
|
|
313
310
|
|
|
314
311
|
this.log.info(`Getting redirects for ${this.site.getId()}`);
|
|
315
312
|
|
|
316
|
-
const
|
|
313
|
+
const redirectsFile = this.rawClient.getRedirects();
|
|
314
|
+
const redirects = await redirectsFile.get();
|
|
317
315
|
this.#logDuration('getRedirects', startTime);
|
|
318
316
|
|
|
319
317
|
return redirects;
|
|
@@ -328,8 +326,8 @@ export default class ContentClient {
|
|
|
328
326
|
|
|
329
327
|
this.log.info(`Updating redirects for ${this.site.getId()}`);
|
|
330
328
|
|
|
331
|
-
const
|
|
332
|
-
|
|
329
|
+
const redirectsFile = this.rawClient.getRedirects();
|
|
330
|
+
const currentRedirects = await redirectsFile.get();
|
|
333
331
|
// validate combination of existing and new redirects
|
|
334
332
|
const cleanNewRedirects = removeDuplicatedRedirects(currentRedirects, redirects, this.log);
|
|
335
333
|
if (cleanNewRedirects.length === 0) {
|
|
@@ -342,7 +340,7 @@ export default class ContentClient {
|
|
|
342
340
|
return;
|
|
343
341
|
}
|
|
344
342
|
|
|
345
|
-
const response = await
|
|
343
|
+
const response = await redirectsFile.append(noCycleRedirects);
|
|
346
344
|
if (response.status !== 200) {
|
|
347
345
|
throw new Error('Failed to update redirects');
|
|
348
346
|
}
|