@adobe/spacecat-shared-utils 1.51.0 → 1.52.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 +14 -0
- package/package.json +1 -1
- package/src/index.d.ts +3 -0
- package/src/llmo-config.js +4 -4
- package/src/metrics-store.js +2 -2
- package/src/sqs.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-utils-v1.52.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.51.1...@adobe/spacecat-shared-utils-v1.52.0) (2025-09-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* llmo config types and version ([#990](https://github.com/adobe/spacecat-shared/issues/990)) ([2dfe331](https://github.com/adobe/spacecat-shared/commit/2dfe33156754f044b6e9ff18d32e13baabaa47f1))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-utils-v1.51.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.51.0...@adobe/spacecat-shared-utils-v1.51.1) (2025-09-25)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* remove unnecessary logs to reduce Coralogix usage ([#947](https://github.com/adobe/spacecat-shared/issues/947)) ([c93fa4f](https://github.com/adobe/spacecat-shared/commit/c93fa4f69238106caa0f8150df029e4535c99e39))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-utils-v1.51.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.50.8...@adobe/spacecat-shared-utils-v1.51.0) (2025-09-25)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -262,3 +262,6 @@ export function tracingFetch(url: string | Request, options?: RequestOptions): P
|
|
|
262
262
|
export const SPACECAT_USER_AGENT: string;
|
|
263
263
|
|
|
264
264
|
export function retrievePageAuthentication(site: object, context: object): Promise<string>;
|
|
265
|
+
|
|
266
|
+
export * as llmoConfig from './llmo-config.js';
|
|
267
|
+
export * as schemas from './schemas.js';
|
package/src/llmo-config.js
CHANGED
|
@@ -60,8 +60,8 @@ export function defaultConfig() {
|
|
|
60
60
|
* @param {string} [options.version] Optional version ID of the configuration to read.
|
|
61
61
|
* Defaults to the latest version.
|
|
62
62
|
* @param {string} [options.s3Bucket] Optional S3 bucket name.
|
|
63
|
-
* @returns {Promise<{config: LLMOConfig, exists: boolean}>} The configuration
|
|
64
|
-
* a flag indicating if it existed.
|
|
63
|
+
* @returns {Promise<{config: LLMOConfig, exists: boolean, version?: string}>} The configuration,
|
|
64
|
+
* a flag indicating if it existed, and the version ID if it exists.
|
|
65
65
|
* @throws {Error} If reading the configuration fails for reasons other than it not existing.
|
|
66
66
|
*/
|
|
67
67
|
export async function readConfig(sideId, s3Client, options) {
|
|
@@ -79,7 +79,7 @@ export async function readConfig(sideId, s3Client, options) {
|
|
|
79
79
|
} catch (e) {
|
|
80
80
|
if (e.name === 'NoSuchKey' || e.name === 'NotFound') {
|
|
81
81
|
// Config does not exist yet. Return empty config.
|
|
82
|
-
return { config: defaultConfig(), exists: false };
|
|
82
|
+
return { config: defaultConfig(), exists: false, version: undefined };
|
|
83
83
|
}
|
|
84
84
|
throw e;
|
|
85
85
|
}
|
|
@@ -90,7 +90,7 @@ export async function readConfig(sideId, s3Client, options) {
|
|
|
90
90
|
}
|
|
91
91
|
const text = await body.transformToString();
|
|
92
92
|
const config = llmoConfig.parse(JSON.parse(text));
|
|
93
|
-
return { config, exists: true };
|
|
93
|
+
return { config, exists: true, version: res.VersionId || undefined };
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
/**
|
package/src/metrics-store.js
CHANGED
|
@@ -45,7 +45,7 @@ export async function getStoredMetrics(config, context) {
|
|
|
45
45
|
const response = await s3.s3Client.send(command);
|
|
46
46
|
const content = await response.Body?.transformToString();
|
|
47
47
|
const metrics = JSON.parse(content);
|
|
48
|
-
log.
|
|
48
|
+
log.debug(`Successfully retrieved ${metrics.length} metrics from ${filePath}`);
|
|
49
49
|
|
|
50
50
|
return metrics;
|
|
51
51
|
} catch (e) {
|
|
@@ -72,7 +72,7 @@ export async function storeMetrics(content, config, context) {
|
|
|
72
72
|
|
|
73
73
|
try {
|
|
74
74
|
const response = await s3.s3Client.send(command);
|
|
75
|
-
log.
|
|
75
|
+
log.debug(`Successfully uploaded metrics to ${filePath}, response: ${JSON.stringify(response)}`);
|
|
76
76
|
|
|
77
77
|
return filePath;
|
|
78
78
|
} catch (e) {
|
package/src/sqs.js
CHANGED
|
@@ -71,7 +71,7 @@ class SQS {
|
|
|
71
71
|
|
|
72
72
|
try {
|
|
73
73
|
const data = await this.sqsClient.send(msgCommand);
|
|
74
|
-
this.log.
|
|
74
|
+
this.log.debug(`Success, message sent. MessageID: ${data.MessageId}`);
|
|
75
75
|
} catch (e) {
|
|
76
76
|
const { type, code, message: msg } = e;
|
|
77
77
|
this.log.error(`Message sent failed. Type: ${type}, Code: ${code}, Message: ${msg}`);
|
|
@@ -120,7 +120,7 @@ export function sqsEventAdapter(fn) {
|
|
|
120
120
|
|
|
121
121
|
const record = records[0];
|
|
122
122
|
|
|
123
|
-
log.
|
|
123
|
+
log.debug(`Received ${records.length} records. ID of the first message in the batch: ${record.messageId}`);
|
|
124
124
|
|
|
125
125
|
try {
|
|
126
126
|
message = JSON.parse(record.body);
|