@scayle/storefront-core 8.19.0 → 8.19.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,5 +1,11 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 8.19.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix `getCategoriesByPath` RPC to return 404 for non-existing categories.
8
+
3
9
  ## 8.19.0
4
10
 
5
11
  ## 8.18.0
@@ -29,12 +29,18 @@ export const getCategoriesByPath = async function getCategoriesByPath2({ path, c
29
29
  return getRootCategories({ children, includeHidden, properties }, context);
30
30
  }
31
31
  const sanitizedPath = splitAndRemoveEmpty(path);
32
- const result = await cached(sapiClient.categories.getByPath, {
33
- cacheKeyPrefix: `getByPath-categories-${sanitizedPath}`
34
- })(sanitizedPath, {
32
+ const result = await cached(
33
+ mapSAPIFetchErrorToResponse(sapiClient.categories.getByPath),
34
+ {
35
+ cacheKeyPrefix: `getByPath-categories-${sanitizedPath}`
36
+ }
37
+ )(sanitizedPath, {
35
38
  with: { children, properties },
36
39
  includeHidden
37
40
  });
41
+ if (result instanceof Response) {
42
+ return result;
43
+ }
38
44
  const rootPath = await Promise.all(
39
45
  (result.rootlineIds || []).map((id) => {
40
46
  return cached(sapiClient.categories.getById, {
@@ -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.19.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
39
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.19.1"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
40
40
  return {
41
41
  accessToken: refreshedAccessToken,
42
42
  checkoutJwt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "8.19.0",
3
+ "version": "8.19.1",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",