@adobe/spacecat-shared-content-client 1.2.0 → 1.2.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,17 @@
1
+ # [@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)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **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))
7
+
8
+ # [@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)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update external fixes ([#444](https://github.com/adobe/spacecat-shared/issues/444)) ([5e86c98](https://github.com/adobe/spacecat-shared/commit/5e86c98f274e514e8ec3032b52a128b7b394f5bc))
14
+
1
15
  # [@adobe/spacecat-shared-content-client-v1.2.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-content-client-v1.1.22...@adobe/spacecat-shared-content-client-v1.2.0) (2024-11-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.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Shared modules of the Spacecat Services - Content Client",
5
5
  "type": "module",
6
6
  "engines": {
@@ -36,9 +36,9 @@
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.2.7",
39
+ "@adobe/spacecat-helix-content-sdk": "1.3.5",
40
40
  "@adobe/spacecat-shared-utils": "1.22.4",
41
- "graph-data-structure": "4.1.0"
41
+ "graph-data-structure": "4.2.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "chai": "5.1.2",
@@ -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 = await this.rawClient.read(docPath);
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 = await this.rawClient.read(docPath);
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
- const saveResponse = await this.rawClient.save(document);
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 redirects = await this.rawClient.getRedirects();
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 currentRedirects = await this.getRedirects();
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 this.rawClient.appendRedirects(noCycleRedirects);
343
+ const response = await redirectsFile.append(noCycleRedirects);
346
344
  if (response.status !== 200) {
347
345
  throw new Error('Failed to update redirects');
348
346
  }