@adobe/spacecat-shared-utils 1.100.1 → 1.102.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,15 @@
1
+ ## [@adobe/spacecat-shared-utils-v1.102.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.101.0...@adobe/spacecat-shared-utils-v1.102.0) (2026-03-12)
2
+
3
+ ### Features
4
+
5
+ * LLMO-3473 byocdn-fastly supports switching to role-based access ([#1430](https://github.com/adobe/spacecat-shared/issues/1430)) ([743daab](https://github.com/adobe/spacecat-shared/commit/743daabaab9c8002cc64ef605e3415f9fa025acb))
6
+
7
+ ## [@adobe/spacecat-shared-utils-v1.101.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.100.1...@adobe/spacecat-shared-utils-v1.101.0) (2026-03-10)
8
+
9
+ ### Features
10
+
11
+ * **utils:** export resetFetchContext and clearFetchCache ([#1421](https://github.com/adobe/spacecat-shared/issues/1421)) ([0e05bd8](https://github.com/adobe/spacecat-shared/commit/0e05bd865c92fe4f4bbfffb29575faa15e8d93b3))
12
+
1
13
  ## [@adobe/spacecat-shared-utils-v1.100.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.100.0...@adobe/spacecat-shared-utils-v1.100.1) (2026-03-07)
2
14
 
3
15
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-utils",
3
- "version": "1.100.1",
3
+ "version": "1.102.0",
4
4
  "description": "Shared modules of the Spacecat Services - utils",
5
5
  "type": "module",
6
6
  "exports": {
@@ -11,4 +11,7 @@
11
11
  */
12
12
  import { context as h2, h1 } from '@adobe/fetch';
13
13
 
14
- export const { fetch } = process.env.HELIX_FETCH_FORCE_HTTP1 ? h1() : h2();
14
+ const fetchContext = process.env.HELIX_FETCH_FORCE_HTTP1 ? h1() : h2();
15
+ export const {
16
+ fetch, reset: resetFetchContext, clearCache: clearFetchCache,
17
+ } = fetchContext;
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  /**
14
- * Transforms credential fields object with backwards compatibility
14
+ * Transforms credential fields object
15
15
  * @param {Object} payload - The payload containing credential information
16
16
  * @returns {Object} - Object with credential fields
17
17
  */
@@ -20,14 +20,10 @@ const transformCredentialFields = (payload) => {
20
20
 
21
21
  if (payload.currentAccessKey) {
22
22
  fields['Access Key (current)'] = payload.currentAccessKey;
23
- } else if (payload.accessKey) {
24
- fields['Access Key'] = payload.accessKey;
25
23
  }
26
24
 
27
25
  if (payload.currentSecretKey) {
28
26
  fields['Secret Key (current)'] = payload.currentSecretKey;
29
- } else if (payload.secretKey) {
30
- fields['Secret Key'] = payload.secretKey;
31
27
  }
32
28
 
33
29
  if (payload.oldAccessKey) {
@@ -64,9 +60,21 @@ const FASTLY_LOG_FORMAT = `{
64
60
  const CDN_TRANSFORMATIONS = {
65
61
  'byocdn-fastly': (payload) => {
66
62
  const authMethodLabel = payload.authMethod === 'iam_role' ? 'IAM Role' : 'User credentials';
67
- const authFields = payload.authMethod === 'iam_role'
68
- ? { 'Role ARN': payload.roleArn }
69
- : transformCredentialFields(payload);
63
+ const authFields = {};
64
+ const hasCredentialData = [
65
+ payload.currentAccessKey,
66
+ payload.currentSecretKey,
67
+ payload.oldAccessKey,
68
+ payload.oldSecretKey,
69
+ ].some((value) => value);
70
+
71
+ if (payload.authMethod === 'iam_role' && payload.roleArn) {
72
+ authFields['Role ARN'] = payload.roleArn;
73
+ }
74
+
75
+ if (hasCredentialData) {
76
+ Object.assign(authFields, transformCredentialFields(payload));
77
+ }
70
78
 
71
79
  return {
72
80
  'Bucket Name': payload.bucketName,
@@ -247,11 +255,11 @@ const prettifyLogForwardingConfig = (payload) => {
247
255
 
248
256
  if (payload.logSource === 'byocdn-fastly') {
249
257
  if (payload.authMethod === 'user_credentials') {
250
- if (!payload.accessKey && !payload.currentAccessKey) {
251
- throw new Error('accessKey or currentAccessKey is required in payload');
258
+ if (!payload.currentAccessKey) {
259
+ throw new Error('currentAccessKey is required in payload');
252
260
  }
253
- if (!payload.secretKey && !payload.currentSecretKey) {
254
- throw new Error('secretKey or currentSecretKey is required in payload');
261
+ if (!payload.currentSecretKey) {
262
+ throw new Error('currentSecretKey is required in payload');
255
263
  }
256
264
  } else if (payload.authMethod === 'iam_role') {
257
265
  if (!payload.roleArn) {
@@ -261,11 +269,11 @@ const prettifyLogForwardingConfig = (payload) => {
261
269
  }
262
270
 
263
271
  if (payload.logSource === 'byocdn-akamai' || payload.logSource === 'byocdn-other') {
264
- if (!payload.accessKey && !payload.currentAccessKey) {
265
- throw new Error('accessKey or currentAccessKey is required in payload');
272
+ if (!payload.currentAccessKey) {
273
+ throw new Error('currentAccessKey is required in payload');
266
274
  }
267
- if (!payload.secretKey && !payload.currentSecretKey) {
268
- throw new Error('secretKey or currentSecretKey is required in payload');
275
+ if (!payload.currentSecretKey) {
276
+ throw new Error('currentSecretKey is required in payload');
269
277
  }
270
278
  }
271
279
 
package/src/index.js CHANGED
@@ -83,7 +83,7 @@ export { s3Wrapper, getObjectFromKey } from './s3.js';
83
83
 
84
84
  export { OPPORTUNITY_TYPES, DEFAULT_CPC_VALUE } from './constants.js';
85
85
 
86
- export { fetch } from './adobe-fetch.js';
86
+ export { fetch, resetFetchContext, clearFetchCache } from './adobe-fetch.js';
87
87
  export { tracingFetch, SPACECAT_USER_AGENT } from './tracing-fetch.js';
88
88
  export {
89
89
  getHighFormViewsLowConversionMetrics,