@adobe/spacecat-shared-content-client 1.4.9 → 1.5.0

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-content-client-v1.5.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-content-client-v1.4.9...@adobe/spacecat-shared-content-client-v1.5.0) (2025-04-04)
2
+
3
+
4
+ ### Features
5
+
6
+ * support external domain onedrive ([#666](https://github.com/adobe/spacecat-shared/issues/666)) ([7d21704](https://github.com/adobe/spacecat-shared/commit/7d21704d871393e70213e3c91a8b5cb164a4462c))
7
+
1
8
  # [@adobe/spacecat-shared-content-client-v1.4.9](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-content-client-v1.4.8...@adobe/spacecat-shared-content-client-v1.4.9) (2025-04-01)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-content-client",
3
- "version": "1.4.9",
3
+ "version": "1.5.0",
4
4
  "description": "Shared modules of the Spacecat Services - Content Client",
5
5
  "type": "module",
6
6
  "engines": {
@@ -35,9 +35,11 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@adobe/helix-universal": "5.1.1",
38
- "@adobe/spacecat-shared-data-access": "2.0.2",
39
38
  "@adobe/spacecat-helix-content-sdk": "1.3.61",
39
+ "@adobe/spacecat-shared-data-access": "2.0.2",
40
40
  "@adobe/spacecat-shared-utils": "1.26.4",
41
+ "@aws-sdk/client-secrets-manager": "3.726.1",
42
+ "aws-xray-sdk": "3.10.2",
41
43
  "graph-data-structure": "4.5.0"
42
44
  },
43
45
  "devDependencies": {
@@ -9,11 +9,13 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
+ import AWSXray from 'aws-xray-sdk';
12
13
  import { createFrom as createContentSDKClient } from '@adobe/spacecat-helix-content-sdk';
13
14
  import {
14
- composeBaseURL, hasText, isObject, tracingFetch,
15
+ composeBaseURL, hasText, isObject, resolveCustomerSecretsName, tracingFetch,
15
16
  } from '@adobe/spacecat-shared-utils';
16
17
  import { Graph, hasCycle } from 'graph-data-structure';
18
+ import { GetSecretValueCommand, SecretsManagerClient } from '@aws-sdk/client-secrets-manager';
17
19
 
18
20
  const CONTENT_SOURCE_TYPE_DRIVE_GOOGLE = 'drive.google';
19
21
  const CONTENT_SOURCE_TYPE_ONEDRIVE = 'onedrive';
@@ -184,7 +186,7 @@ const removeRedirectLoops = (currentRedirects, newRedirects, log) => {
184
186
  };
185
187
 
186
188
  export default class ContentClient {
187
- static createFrom(context, site) {
189
+ static async createFrom(context, site) {
188
190
  const { log = console, env } = context;
189
191
 
190
192
  const config = {};
@@ -197,6 +199,16 @@ export default class ContentClient {
197
199
  }
198
200
  }
199
201
 
202
+ try {
203
+ const customerSecret = resolveCustomerSecretsName(site.getBaseURL(), context);
204
+ const client = AWSXray.captureAWSv3Client(new SecretsManagerClient({}));
205
+ const command = new GetSecretValueCommand({ SecretId: customerSecret });
206
+ const response = await client.send(command);
207
+ const secrets = JSON.parse(response.SecretString);
208
+ config.domainId = secrets.onedrive_domain_id;
209
+ } catch (e) {
210
+ log.debug(`Customer ${site.getBaseURL()} secrets containing onedrive domain id not configured: ${e.message}`);
211
+ }
200
212
  return new ContentClient(config, site, log);
201
213
  }
202
214
 
@@ -220,6 +232,7 @@ export default class ContentClient {
220
232
  const siteDto = {
221
233
  getId: () => site.siteId,
222
234
  getHlxConfig: () => site.hlxConfig,
235
+ getBaseURL: () => site.baseURL,
223
236
  };
224
237
  return ContentClient.createFrom({ log, env }, siteDto);
225
238
  } catch (e) {