@scayle/storefront-core 8.24.1 → 8.25.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,11 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 8.25.0
4
+
5
+ ### Patch Changes
6
+
7
+ - **\[Code Style\]** Refactored brands and navigation tree RPCs to avoid destructuring the RPC context within function signatures
8
+
3
9
  ## 8.24.1
4
10
 
5
11
  No changes in this release.
@@ -1,6 +1,7 @@
1
1
  import { mapSAPIFetchErrorToResponse } from "../../utils/sapi.mjs";
2
2
  const MAX_PER_PAGE = 100;
3
- export const getBrands = async function getBrands2({ pagination }, { sapiClient, cached }) {
3
+ export const getBrands = async function getBrands2({ pagination }, context) {
4
+ const { sapiClient, cached } = context;
4
5
  return await cached(mapSAPIFetchErrorToResponse(sapiClient.brands.get), {
5
6
  cacheKeyPrefix: "getBrands"
6
7
  })({
@@ -10,7 +11,8 @@ export const getBrands = async function getBrands2({ pagination }, { sapiClient,
10
11
  }
11
12
  });
12
13
  };
13
- export const getBrandById = async function getBrandById2({ brandId }, { sapiClient, cached }) {
14
+ export const getBrandById = async function getBrandById2({ brandId }, context) {
15
+ const { sapiClient, cached } = context;
14
16
  return await cached(
15
17
  mapSAPIFetchErrorToResponse(sapiClient.brands.getById),
16
18
  {
@@ -36,7 +36,7 @@ export const getCheckoutToken = async function getCheckoutToken2(jwtPayload = {}
36
36
  carrier,
37
37
  basketId: context.basketKey,
38
38
  campaignKey
39
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.24.1"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
39
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.25.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
40
40
  return {
41
41
  accessToken: refreshedAccessToken,
42
42
  checkoutJwt
@@ -1,16 +1,19 @@
1
1
  import { ErrorResponse } from "../../errors/index.mjs";
2
2
  import { HttpStatusCode, HttpStatusMessage } from "../../constants/index.mjs";
3
- export const fetchAllNavigationTrees = async function fetchAllNavigationTrees2({ params }, { sapiClient: { navigation }, cached }) {
3
+ export const fetchAllNavigationTrees = async function fetchAllNavigationTrees2({ params }, context) {
4
+ const { sapiClient: { navigation }, cached } = context;
4
5
  return await cached(navigation.getAll, {
5
6
  cacheKeyPrefix: "getAll-navigation-trees"
6
7
  })(params);
7
8
  };
8
- export const fetchNavigationTreeById = async function fetchNavigationTreeById2({ treeId, params }, { sapiClient: { navigation }, cached }) {
9
+ export const fetchNavigationTreeById = async function fetchNavigationTreeById2({ treeId, params }, context) {
10
+ const { sapiClient: { navigation }, cached } = context;
9
11
  return await cached(navigation.getById, {
10
12
  cacheKeyPrefix: `getById-navigation-trees-${treeId}`
11
13
  })(treeId, params);
12
14
  };
13
- export const fetchNavigationTreeByName = async function fetchNavigationTreeByName2({ treeName, params }, { sapiClient: { navigation }, cached }) {
15
+ export const fetchNavigationTreeByName = async function fetchNavigationTreeByName2({ treeName, params }, context) {
16
+ const { sapiClient: { navigation }, cached } = context;
14
17
  return await cached(
15
18
  async (name, params2) => {
16
19
  const navigationTree = (await navigation.getAll(params2)).find(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "8.24.1",
3
+ "version": "8.25.0",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -77,19 +77,19 @@
77
77
  "devDependencies": {
78
78
  "@scayle/eslint-config-storefront": "4.5.0",
79
79
  "@types/crypto-js": "4.2.2",
80
- "@types/node": "22.14.1",
80
+ "@types/node": "22.15.2",
81
81
  "@types/webpack-env": "1.18.8",
82
- "@vitest/coverage-v8": "3.1.1",
82
+ "@vitest/coverage-v8": "3.1.2",
83
83
  "dprint": "0.49.1",
84
- "eslint": "9.24.0",
85
- "eslint-formatter-gitlab": "5.1.0",
84
+ "eslint": "9.25.1",
85
+ "eslint-formatter-gitlab": "6.0.0",
86
86
  "fishery": "2.2.3",
87
87
  "publint": "0.2.12",
88
88
  "rimraf": "6.0.1",
89
89
  "typescript": "5.8.3",
90
90
  "unbuild": "3.5.0",
91
91
  "unstorage": "1.15.0",
92
- "vitest": "3.1.1"
92
+ "vitest": "3.1.2"
93
93
  },
94
94
  "volta": {
95
95
  "node": "22.14.0"