@adobe/spacecat-shared-rum-api-client 2.17.2 → 2.18.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [@adobe/spacecat-shared-rum-api-client-v2.18.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.18.0...@adobe/spacecat-shared-rum-api-client-v2.18.1) (2025-01-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update dependency @adobe/rum-distiller to v1.15.0 ([#536](https://github.com/adobe/spacecat-shared/issues/536)) ([ff70837](https://github.com/adobe/spacecat-shared/commit/ff70837e4cfb5fda6b7ba4b1369bbfaeb4c30b49)), closes [#8203](https://github.com/adobe/spacecat-shared/issues/8203)
7
+
8
+ # [@adobe/spacecat-shared-rum-api-client-v2.18.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.17.2...@adobe/spacecat-shared-rum-api-client-v2.18.0) (2025-01-08)
9
+
10
+
11
+ ### Features
12
+
13
+ * **rum-api-client:** log fetches bundles length ([#530](https://github.com/adobe/spacecat-shared/issues/530)) ([b7011d9](https://github.com/adobe/spacecat-shared/commit/b7011d99da894fe340d4abcd26aec64c0faeb1c5))
14
+
1
15
  # [@adobe/spacecat-shared-rum-api-client-v2.17.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.17.1...@adobe/spacecat-shared-rum-api-client-v2.17.2) (2024-12-31)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-rum-api-client",
3
- "version": "2.17.2",
3
+ "version": "2.18.1",
4
4
  "description": "Shared modules of the Spacecat Services - Rum API client",
5
5
  "type": "module",
6
6
  "engines": {
@@ -39,7 +39,7 @@
39
39
  "@adobe/helix-shared-wrap": "2.0.2",
40
40
  "@adobe/helix-universal": "5.0.8",
41
41
  "@adobe/spacecat-shared-utils": "1.25.2",
42
- "@adobe/rum-distiller": "1.14.0",
42
+ "@adobe/rum-distiller": "1.15.0",
43
43
  "aws4": "1.13.2",
44
44
  "urijs": "1.19.11"
45
45
  },
package/src/index.js CHANGED
@@ -38,13 +38,19 @@ const HANDLERS = {
38
38
 
39
39
  export default class RUMAPIClient {
40
40
  static createFrom(context) {
41
+ const { log = console } = context;
42
+
41
43
  if (context.rumApiClient) return context.rumApiClient;
42
44
 
43
- const client = new RUMAPIClient();
45
+ const client = new RUMAPIClient(log);
44
46
  context.rumApiClient = client;
45
47
  return client;
46
48
  }
47
49
 
50
+ constructor(log) {
51
+ this.log = log;
52
+ }
53
+
48
54
  // eslint-disable-next-line class-methods-use-this
49
55
  async query(query, opts) {
50
56
  const { handler, checkpoints } = HANDLERS[query] || {};
@@ -56,6 +62,8 @@ export default class RUMAPIClient {
56
62
  checkpoints,
57
63
  });
58
64
 
65
+ this.log.info(`Query "${query}" fetched ${bundles.length} bundles`);
66
+
59
67
  return handler(bundles, opts);
60
68
  } catch (e) {
61
69
  throw new Error(`Query '${query}' failed. Opts: ${JSON.stringify(opts)}. Reason: ${e.message}`);
@@ -87,6 +95,8 @@ export default class RUMAPIClient {
87
95
 
88
96
  const results = {};
89
97
 
98
+ this.log.info(`Multi query ${JSON.stringify(queries.join(', '))} fetched ${bundles.length} bundles`);
99
+
90
100
  // Execute each query handler sequentially
91
101
  for (const { query, handler } of queryHandlers) {
92
102
  // eslint-disable-next-line no-await-in-loop