@adobe/spacecat-shared-utils 1.89.1 → 1.90.1
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 +1 -1
- package/src/cdn-helpers.js +43 -11
- package/src/metrics-store.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-utils-v1.90.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.90.0...@adobe/spacecat-shared-utils-v1.90.1) (2026-01-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* log warn instead of error if metrics missing ([#1286](https://github.com/adobe/spacecat-shared/issues/1286)) ([e823a7d](https://github.com/adobe/spacecat-shared/commit/e823a7da4ce76c60f3256517f91532d71830f49d))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-utils-v1.90.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.89.1...@adobe/spacecat-shared-utils-v1.90.0) (2026-01-29)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* LLMO-1534 Pretty format old and new log forwarding credentials ([#1290](https://github.com/adobe/spacecat-shared/issues/1290)) ([df84629](https://github.com/adobe/spacecat-shared/commit/df84629c1a49e81b43e352eb4b8b542b9eb3085e))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-utils-v1.89.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.89.0...@adobe/spacecat-shared-utils-v1.89.1) (2026-01-26)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/cdn-helpers.js
CHANGED
|
@@ -11,9 +11,44 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Transforms credential fields object with backwards compatibility
|
|
15
|
+
* @param {Object} payload - The payload containing credential information
|
|
16
|
+
* @returns {Object} - Object with credential fields
|
|
15
17
|
*/
|
|
18
|
+
const transformCredentialFields = (payload) => {
|
|
19
|
+
const fields = {};
|
|
20
|
+
|
|
21
|
+
if (payload.currentAccessKey) {
|
|
22
|
+
fields['Access Key (current)'] = payload.currentAccessKey;
|
|
23
|
+
} else if (payload.accessKey) {
|
|
24
|
+
fields['Access Key'] = payload.accessKey;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (payload.currentSecretKey) {
|
|
28
|
+
fields['Secret Key (current)'] = payload.currentSecretKey;
|
|
29
|
+
} else if (payload.secretKey) {
|
|
30
|
+
fields['Secret Key'] = payload.secretKey;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (payload.oldAccessKey) {
|
|
34
|
+
fields['Access Key (to be retired)'] = payload.oldAccessKey;
|
|
35
|
+
}
|
|
16
36
|
|
|
37
|
+
if (payload.oldSecretKey) {
|
|
38
|
+
fields['Secret Key (to be retired)'] = payload.oldSecretKey;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
fields.currentCredentialsCreatedAt = payload.currentCredentialsCreatedAt;
|
|
42
|
+
fields.currentCredentialsLastUsed = payload.currentCredentialsLastUsed;
|
|
43
|
+
fields.oldCredentialsCreatedAt = payload.oldCredentialsCreatedAt;
|
|
44
|
+
fields.oldCredentialsLastUsed = payload.oldCredentialsLastUsed;
|
|
45
|
+
|
|
46
|
+
return fields;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* CDN-specific transformations for log forwarding configuration preparation
|
|
51
|
+
*/
|
|
17
52
|
const FASTLY_LOG_FORMAT = `{
|
|
18
53
|
"timestamp": "%{strftime(\\{"%Y-%m-%dT%H:%M:%S%z"\\}, time.start)}V",
|
|
19
54
|
"host": "%{if(req.http.Fastly-Orig-Host, req.http.Fastly-Orig-Host, req.http.Host)}V",
|
|
@@ -35,8 +70,7 @@ const CDN_TRANSFORMATIONS = {
|
|
|
35
70
|
Placement: 'Format Version Default',
|
|
36
71
|
'Log format': FASTLY_LOG_FORMAT,
|
|
37
72
|
'Access method': 'User credentials',
|
|
38
|
-
|
|
39
|
-
'Secret key': payload.secretKey,
|
|
73
|
+
...transformCredentialFields(payload),
|
|
40
74
|
Period: 300,
|
|
41
75
|
'Log line format': 'Blank',
|
|
42
76
|
Compression: 'Gzip',
|
|
@@ -67,8 +101,7 @@ const CDN_TRANSFORMATIONS = {
|
|
|
67
101
|
'Log file prefix': '{%Y}-{%m}-{%d}T{%H}:{%M}:{%S}.000',
|
|
68
102
|
'Log file suffix': '.log',
|
|
69
103
|
'Log interval': '60 seconds',
|
|
70
|
-
|
|
71
|
-
'Secret key': payload.secretKey,
|
|
104
|
+
...transformCredentialFields(payload),
|
|
72
105
|
HelpUrl: 'https://techdocs.akamai.com/datastream2/docs/stream-amazon-s3',
|
|
73
106
|
}),
|
|
74
107
|
'byocdn-cloudflare': (payload) => ({
|
|
@@ -156,8 +189,7 @@ const CDN_TRANSFORMATIONS = {
|
|
|
156
189
|
'Bucket name': payload.bucketName,
|
|
157
190
|
Region: payload.region,
|
|
158
191
|
Path: `${payload.allowedPaths?.[0] || ''}<year>/<month>/<day>`,
|
|
159
|
-
|
|
160
|
-
'Secret Key': payload.secretKey,
|
|
192
|
+
...transformCredentialFields(payload),
|
|
161
193
|
'Timestamp format': 'RFC3339',
|
|
162
194
|
'Log format': 'JSON lines (one log per line)',
|
|
163
195
|
Compression: 'Optional, but prefered. Please use Gzip compression if you decide to compress the log files.',
|
|
@@ -206,11 +238,11 @@ const prettifyLogForwardingConfig = (payload) => {
|
|
|
206
238
|
}
|
|
207
239
|
|
|
208
240
|
if (payload.logSource === 'byocdn-fastly' || payload.logSource === 'byocdn-akamai' || payload.logSource === 'byocdn-other') {
|
|
209
|
-
if (!payload.accessKey) {
|
|
210
|
-
throw new Error('accessKey is required in payload');
|
|
241
|
+
if (!payload.accessKey && !payload.currentAccessKey) {
|
|
242
|
+
throw new Error('accessKey or currentAccessKey is required in payload');
|
|
211
243
|
}
|
|
212
|
-
if (!payload.secretKey) {
|
|
213
|
-
throw new Error('secretKey is required in payload');
|
|
244
|
+
if (!payload.secretKey && !payload.currentSecretKey) {
|
|
245
|
+
throw new Error('secretKey or currentSecretKey is required in payload');
|
|
214
246
|
}
|
|
215
247
|
}
|
|
216
248
|
|
package/src/metrics-store.js
CHANGED
|
@@ -51,7 +51,7 @@ export async function getStoredMetrics(config, context) {
|
|
|
51
51
|
|
|
52
52
|
return metrics;
|
|
53
53
|
} catch (e) {
|
|
54
|
-
log.
|
|
54
|
+
log.warn(`Failed to retrieve metrics from ${filePath}, error: ${e.message}`);
|
|
55
55
|
return [];
|
|
56
56
|
}
|
|
57
57
|
}
|