@scayle/storefront-core 8.61.2 → 8.61.3

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,11 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 8.61.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix `updateTokens` and `updateUser` return type from `void` to `Promise<void>` in `ContextWithSession`. The underlying implementations were already async (`await session.save()`), but the incorrect `void` type prevented call sites from knowing they needed to await the result. All call sites in the RPC methods and customer API now correctly await these calls, ensuring session state is persisted before execution continues.
8
+
3
9
  ## 8.61.2
4
10
 
5
11
  No changes in this release.
@@ -58,7 +58,7 @@ export class CustomerAPIClient {
58
58
  grant_type: "refresh_token",
59
59
  refresh_token: this.context.refreshToken
60
60
  });
61
- this.context.updateTokens({
61
+ await this.context.updateTokens({
62
62
  accessToken: tokens?.access_token,
63
63
  refreshToken: tokens?.refresh_token
64
64
  });
@@ -41,7 +41,7 @@ export const getCheckoutToken = defineRpcHandler(
41
41
  ...customData,
42
42
  ...orderCustomData
43
43
  }
44
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.61.2"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
44
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.61.3"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
45
45
  return {
46
46
  accessToken: refreshedAccessToken,
47
47
  checkoutJwt
@@ -36,11 +36,11 @@ export async function postLogin(context, tokens) {
36
36
  return fetchUserResponse;
37
37
  }
38
38
  const user = await unwrap(fetchUserResponse);
39
- context.updateTokens({
39
+ await context.updateTokens({
40
40
  accessToken: tokens.access_token,
41
41
  refreshToken: tokens.refresh_token
42
42
  });
43
- context.updateUser(user);
43
+ await context.updateUser(user);
44
44
  const { customerId } = decodeJwt(tokens.access_token);
45
45
  await Promise.all([
46
46
  mergeBaskets(
@@ -201,7 +201,7 @@ export const refreshAccessToken = defineRpcHandler(
201
201
  grant_type: "refresh_token",
202
202
  refresh_token: refreshToken
203
203
  });
204
- context.updateTokens({
204
+ await context.updateTokens({
205
205
  accessToken: tokens?.access_token,
206
206
  refreshToken: tokens?.refresh_token
207
207
  });
@@ -337,7 +337,7 @@ export const updatePasswordByHash = defineRpcHandler(
337
337
  ...passwordHash,
338
338
  shop_id: shopId
339
339
  });
340
- context.updateTokens({
340
+ await context.updateTokens({
341
341
  accessToken: tokens.access_token,
342
342
  refreshToken: tokens.refresh_token
343
343
  });
@@ -98,7 +98,7 @@ const getAccessToken = defineRpcHandler(
98
98
  grant_type: "refresh_token",
99
99
  refresh_token: context.refreshToken
100
100
  });
101
- context.updateTokens({
101
+ await context.updateTokens({
102
102
  accessToken: tokens.access_token,
103
103
  refreshToken: tokens.refresh_token
104
104
  });
@@ -72,8 +72,8 @@ export interface ContextWithSession {
72
72
  destroySession: () => Promise<void>;
73
73
  createUserBoundSession: () => Promise<void>;
74
74
  updateSessionCustomData: (updatedCustomData: SessionCustomData) => Promise<void>;
75
- updateUser: (user: ShopUser) => void;
76
- updateTokens: (tokens: OAuthTokens) => void;
75
+ updateUser: (user: ShopUser) => Promise<void>;
76
+ updateTokens: (tokens: OAuthTokens) => Promise<void>;
77
77
  }
78
78
  /**
79
79
  * Context interface without session information.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "8.61.2",
3
+ "version": "8.61.3",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -56,20 +56,19 @@
56
56
  "@types/crypto-js": "4.2.2",
57
57
  "@types/node": "24.12.2",
58
58
  "@types/webpack-env": "1.18.8",
59
- "@vitest/coverage-v8": "4.1.5",
59
+ "@vitest/coverage-v8": "4.1.7",
60
60
  "eslint-formatter-gitlab": "7.1.0",
61
- "eslint": "10.3.0",
61
+ "eslint": "10.4.0",
62
62
  "fishery": "2.4.0",
63
- "publint": "0.3.18",
64
- "rimraf": "6.1.3",
63
+ "publint": "0.3.21",
65
64
  "typescript": "6.0.3",
66
65
  "unbuild": "3.6.1",
67
66
  "unstorage": "1.17.5",
68
- "vitest": "4.1.5",
67
+ "vitest": "4.1.7",
69
68
  "@scayle/vitest-config-storefront": "1.0.0"
70
69
  },
71
70
  "scripts": {
72
- "clean": "rimraf ./dist",
71
+ "clean": "node -e \"require('fs').rmSync('./dist',{recursive:true,force:true})\"",
73
72
  "build": "unbuild",
74
73
  "typecheck": "tsc --noEmit -p tsconfig.json",
75
74
  "lint": "eslint .",