@scayle/storefront-core 8.55.0 → 8.56.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,5 +1,22 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 8.56.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added support for custom session data in the RPC context type definitions.
8
+
9
+ The `ContextWithSession` interface now includes a `sessionCustomData` property (which may be `undefined`) to read custom session data and an `updateSessionCustomData` method to update it.
10
+ The `ContextWithoutSession` interface has been updated accordingly to maintain type consistency.
11
+ The `SessionCustomData` interface can be augmented using TypeScript module augmentation to provide type safety for custom session properties.
12
+
13
+ ### Patch Changes
14
+
15
+ **Dependencies**
16
+
17
+ - Updated dependency to @scayle/storefront-api@18.19.0
18
+ - Updated dependency to @scayle/unstorage-scayle-kv-driver@2.0.9
19
+
3
20
  ## 8.55.0
4
21
 
5
22
  ### Minor Changes
@@ -40,7 +40,7 @@ export const getCheckoutToken = defineRpcHandler(async (jwtPayload = {}, context
40
40
  ...customData,
41
41
  ...orderCustomData
42
42
  }
43
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.55.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
43
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.56.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
44
44
  return {
45
45
  accessToken: refreshedAccessToken,
46
46
  checkoutJwt
@@ -27,7 +27,7 @@ export interface RuntimeConfiguration {
27
27
  }
28
28
  /**
29
29
  * Additional context information for RPC calls.
30
- * AThis interface can be augmented to extend the `RpcContext` type and
30
+ * This interface can be augmented to extend the `RpcContext` type and
31
31
  * allows to adding custom properties to the RPC context.
32
32
  *
33
33
  * @example
@@ -42,6 +42,22 @@ export interface RuntimeConfiguration {
42
42
  */
43
43
  export interface AdditionalRpcContext {
44
44
  }
45
+ /**
46
+ * Interface for custom session data.
47
+ * This interface can be augmented to extend the `RpcContextWithSession` type and
48
+ * allows to adding custom data properties to the session on the RPC context.
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * declare module '@scayle/storefront-core' {
53
+ * interface SessionCustomData {
54
+ * myCustomData: string
55
+ * }
56
+ * }
57
+ * ```
58
+ */
59
+ export interface SessionCustomData {
60
+ }
45
61
  /**
46
62
  * Context interface with session information.
47
63
  */
@@ -52,8 +68,10 @@ export interface ContextWithSession {
52
68
  user: ShopUser | undefined;
53
69
  accessToken: string | undefined;
54
70
  refreshToken: string | undefined;
71
+ sessionCustomData: SessionCustomData | undefined;
55
72
  destroySession: () => Promise<void>;
56
73
  createUserBoundSession: () => Promise<void>;
74
+ updateSessionCustomData: (updatedCustomData: SessionCustomData) => Promise<void>;
57
75
  updateUser: (user: ShopUser) => void;
58
76
  updateTokens: (tokens: OAuthTokens) => void;
59
77
  }
@@ -67,9 +85,11 @@ export interface ContextWithoutSession {
67
85
  user: undefined;
68
86
  accessToken: undefined;
69
87
  refreshToken: undefined;
88
+ sessionCustomData: undefined;
70
89
  destroySession: undefined;
71
90
  createUserBoundSession: undefined;
72
91
  updateUser: undefined;
92
+ updateSessionCustomData: undefined;
73
93
  updateTokens: undefined;
74
94
  }
75
95
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "8.55.0",
3
+ "version": "8.56.0",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -55,7 +55,7 @@
55
55
  "@types/crypto-js": "4.2.2",
56
56
  "@types/node": "22.19.1",
57
57
  "@types/webpack-env": "1.18.8",
58
- "@vitest/coverage-v8": "4.0.14",
58
+ "@vitest/coverage-v8": "4.0.15",
59
59
  "dprint": "0.50.2",
60
60
  "eslint-formatter-gitlab": "7.0.0",
61
61
  "eslint": "9.39.1",
@@ -65,9 +65,9 @@
65
65
  "typescript": "5.9.3",
66
66
  "unbuild": "3.6.1",
67
67
  "unstorage": "1.17.3",
68
- "vitest": "4.0.14",
69
- "@scayle/vitest-config-storefront": "1.0.0",
70
- "@scayle/eslint-config-storefront": "4.7.15"
68
+ "vitest": "4.0.15",
69
+ "@scayle/eslint-config-storefront": "4.7.16",
70
+ "@scayle/vitest-config-storefront": "1.0.0"
71
71
  },
72
72
  "volta": {
73
73
  "node": "22.21.1"