@scayle/storefront-core 8.41.0 → 8.41.2

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,5 +1,19 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 8.41.2
4
+
5
+ ### Patch Changes
6
+
7
+ **Dependencies**
8
+
9
+ - Updated dependency to @scayle/storefront-api@18.13.1
10
+
11
+ ## 8.41.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Improved logging around cache errors to provide more details.
16
+
3
17
  ## 8.41.0
4
18
 
5
19
  ### Minor Changes
@@ -106,6 +106,7 @@ export declare class Cached {
106
106
  * Handles errors during cache operations.
107
107
  *
108
108
  * @param error The error that occurred.
109
+ * @param operation The operation which caused the error
109
110
  *
110
111
  * @private
111
112
  */
@@ -24,7 +24,7 @@ export class Cached {
24
24
  throw new Error(CACHE_NOT_INITIALIZED_MSG);
25
25
  }
26
26
  this.cache = cache;
27
- this.log = log.space("cached.init");
27
+ this.log = log.space("cached");
28
28
  this.prefix = prefix;
29
29
  this.enabled = enabled;
30
30
  }
@@ -57,7 +57,7 @@ export class Cached {
57
57
  }
58
58
  } catch (e) {
59
59
  if (e instanceof Error) {
60
- this.handleError(e);
60
+ this.handleError(e, "getting");
61
61
  }
62
62
  }
63
63
  const response = await fn(...args);
@@ -71,7 +71,7 @@ export class Cached {
71
71
  await this.setCacheValue(cacheKey, response, options);
72
72
  } catch (e) {
73
73
  if (e instanceof Error) {
74
- this.handleError(e);
74
+ this.handleError(e, "setting");
75
75
  }
76
76
  }
77
77
  return response;
@@ -136,13 +136,17 @@ export class Cached {
136
136
  * Handles errors during cache operations.
137
137
  *
138
138
  * @param error The error that occurred.
139
+ * @param operation The operation which caused the error
139
140
  *
140
141
  * @private
141
142
  */
142
- handleError(error) {
143
+ handleError(error, operation) {
143
144
  if (error.message === "timeout") {
144
- return this.log.error("Cache timeout");
145
+ return this.log.error(
146
+ `Cache timeout while ${operation} cache value`,
147
+ error
148
+ );
145
149
  }
146
- this.log.error(error);
150
+ this.log.error(`Error while ${operation} cache value`, error);
147
151
  }
148
152
  }
@@ -33,7 +33,7 @@ export const getCheckoutToken = defineRpcHandler(async (jwtPayload = {}, context
33
33
  carrier,
34
34
  basketId: context.basketKey,
35
35
  campaignKey
36
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.41.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
36
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.41.2"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
37
37
  return {
38
38
  accessToken: refreshedAccessToken,
39
39
  checkoutJwt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "8.41.0",
3
+ "version": "8.41.2",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -56,7 +56,7 @@
56
56
  "ufo": "^1.5.3",
57
57
  "uncrypto": "^0.1.3",
58
58
  "utility-types": "^3.11.0",
59
- "@scayle/storefront-api": "18.13.0",
59
+ "@scayle/storefront-api": "18.13.1",
60
60
  "@scayle/unstorage-scayle-kv-driver": "1.0.3"
61
61
  },
62
62
  "devDependencies": {