@scayle/storefront-core 7.56.0 → 7.57.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
+ ## 7.57.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Expose `properties` with option for each category RPC method payload
8
+
3
9
  ## 7.56.0
4
10
 
5
11
  ### Minor Changes
@@ -7,7 +7,8 @@ exports.getRootCategories = exports.getCategoryByPath = exports.getCategoryById
7
7
  var _helpers = require("../../helpers/index.cjs");
8
8
  const getRootCategories = exports.getRootCategories = async function getRootCategories2({
9
9
  children = 1,
10
- includeHidden
10
+ includeHidden,
11
+ properties
11
12
  }, {
12
13
  cached,
13
14
  bapiClient
@@ -16,7 +17,8 @@ const getRootCategories = exports.getRootCategories = async function getRootCate
16
17
  cacheKeyPrefix: "root-categories"
17
18
  })({
18
19
  with: {
19
- children
20
+ children,
21
+ properties
20
22
  },
21
23
  includeHidden
22
24
  });
@@ -28,7 +30,8 @@ const getRootCategories = exports.getRootCategories = async function getRootCate
28
30
  const getCategoryByPath = exports.getCategoryByPath = async function getCategoryByPath2({
29
31
  path,
30
32
  children = 1,
31
- includeHidden
33
+ includeHidden,
34
+ properties
32
35
  }, context) {
33
36
  const {
34
37
  cached,
@@ -39,7 +42,8 @@ const getCategoryByPath = exports.getCategoryByPath = async function getCategory
39
42
  cacheKeyPrefix: `getByPath-category-${sanitizedPath}`
40
43
  })(sanitizedPath, {
41
44
  with: {
42
- children
45
+ children,
46
+ properties
43
47
  },
44
48
  includeHidden
45
49
  });
@@ -47,7 +51,8 @@ const getCategoryByPath = exports.getCategoryByPath = async function getCategory
47
51
  const getCategoriesByPath = exports.getCategoriesByPath = async function getCategoriesByPath2({
48
52
  path,
49
53
  children = 1,
50
- includeHidden
54
+ includeHidden,
55
+ properties
51
56
  }, context) {
52
57
  const {
53
58
  cached,
@@ -56,7 +61,8 @@ const getCategoriesByPath = exports.getCategoriesByPath = async function getCate
56
61
  if (path === "/") {
57
62
  return getRootCategories({
58
63
  children,
59
- includeHidden
64
+ includeHidden,
65
+ properties
60
66
  }, context);
61
67
  }
62
68
  const sanitizedPath = (0, _helpers.splitAndRemoveEmpty)(path);
@@ -64,7 +70,8 @@ const getCategoriesByPath = exports.getCategoriesByPath = async function getCate
64
70
  cacheKeyPrefix: `getByPath-categories-${sanitizedPath}`
65
71
  })(sanitizedPath, {
66
72
  with: {
67
- children
73
+ children,
74
+ properties
68
75
  },
69
76
  includeHidden
70
77
  });
@@ -74,7 +81,8 @@ const getCategoriesByPath = exports.getCategoriesByPath = async function getCate
74
81
  })(id, {
75
82
  with: {
76
83
  children,
77
- parents: "all"
84
+ parents: "all",
85
+ properties
78
86
  },
79
87
  includeHidden
80
88
  });
@@ -100,7 +108,8 @@ const getCategoriesByPath = exports.getCategoriesByPath = async function getCate
100
108
  const getCategoryById = exports.getCategoryById = async function getCategoryById2({
101
109
  id,
102
110
  children = 1,
103
- includeHidden
111
+ includeHidden,
112
+ properties
104
113
  }, context) {
105
114
  const {
106
115
  cached,
@@ -111,7 +120,8 @@ const getCategoryById = exports.getCategoryById = async function getCategoryById
111
120
  })(id, {
112
121
  with: {
113
122
  children,
114
- parents: "all"
123
+ parents: "all",
124
+ properties
115
125
  },
116
126
  includeHidden
117
127
  });
@@ -1,20 +1,23 @@
1
- import type { Category } from '../../types';
2
- export declare const getRootCategories: ({ children, includeHidden }: {
1
+ import type { Category, ProductCategoryPropertyWith } from '../../types';
2
+ export declare const getRootCategories: ({ children, includeHidden, properties }: {
3
3
  children?: number | undefined;
4
4
  includeHidden?: true | undefined;
5
+ properties?: ProductCategoryPropertyWith | undefined;
5
6
  }, { cached, bapiClient }: import("../../types").RpcContext) => Promise<{
6
7
  categories: Category[];
7
8
  activeNode: undefined;
8
9
  }>;
9
- export declare const getCategoryByPath: ({ path, children, includeHidden }: {
10
+ export declare const getCategoryByPath: ({ path, children, includeHidden, properties }: {
10
11
  path: string;
11
12
  children?: number | undefined;
12
13
  includeHidden?: true | undefined;
14
+ properties?: ProductCategoryPropertyWith | undefined;
13
15
  }, context: import("../../types").RpcContext) => Promise<Category>;
14
- export declare const getCategoriesByPath: ({ path, children, includeHidden }: {
16
+ export declare const getCategoriesByPath: ({ path, children, includeHidden, properties }: {
15
17
  path: string;
16
18
  children?: number | undefined;
17
19
  includeHidden?: true | undefined;
20
+ properties?: ProductCategoryPropertyWith | undefined;
18
21
  }, context: import("../../types").RpcContext) => Promise<{
19
22
  categories: Category[];
20
23
  activeNode: undefined;
@@ -22,8 +25,9 @@ export declare const getCategoriesByPath: ({ path, children, includeHidden }: {
22
25
  categories: Category;
23
26
  activeNode: Category;
24
27
  }>;
25
- export declare const getCategoryById: ({ id, children, includeHidden }: {
28
+ export declare const getCategoryById: ({ id, children, includeHidden, properties }: {
26
29
  id: number;
27
30
  children?: number | undefined;
28
31
  includeHidden?: true | undefined;
32
+ properties?: ProductCategoryPropertyWith | undefined;
29
33
  }, context: import("../../types").RpcContext) => Promise<Category>;
@@ -1,9 +1,9 @@
1
1
  import { splitAndRemoveEmpty } from "../../helpers/index.mjs";
2
- export const getRootCategories = async function getRootCategories2({ children = 1, includeHidden }, { cached, bapiClient }) {
2
+ export const getRootCategories = async function getRootCategories2({ children = 1, includeHidden, properties }, { cached, bapiClient }) {
3
3
  const result = await cached(bapiClient.categories.getRoots, {
4
4
  cacheKeyPrefix: "root-categories"
5
5
  })({
6
- with: { children },
6
+ with: { children, properties },
7
7
  includeHidden
8
8
  });
9
9
  return {
@@ -11,22 +11,25 @@ export const getRootCategories = async function getRootCategories2({ children =
11
11
  activeNode: void 0
12
12
  };
13
13
  };
14
- export const getCategoryByPath = async function getCategoryByPath2({ path, children = 1, includeHidden }, context) {
14
+ export const getCategoryByPath = async function getCategoryByPath2({ path, children = 1, includeHidden, properties }, context) {
15
15
  const { cached, bapiClient } = context;
16
16
  const sanitizedPath = splitAndRemoveEmpty(path);
17
17
  return await cached(bapiClient.categories.getByPath, {
18
18
  cacheKeyPrefix: `getByPath-category-${sanitizedPath}`
19
- })(sanitizedPath, { with: { children }, includeHidden });
19
+ })(sanitizedPath, { with: { children, properties }, includeHidden });
20
20
  };
21
- export const getCategoriesByPath = async function getCategoriesByPath2({ path, children = 1, includeHidden }, context) {
21
+ export const getCategoriesByPath = async function getCategoriesByPath2({ path, children = 1, includeHidden, properties }, context) {
22
22
  const { cached, bapiClient } = context;
23
23
  if (path === "/") {
24
- return getRootCategories({ children, includeHidden }, context);
24
+ return getRootCategories({ children, includeHidden, properties }, context);
25
25
  }
26
26
  const sanitizedPath = splitAndRemoveEmpty(path);
27
27
  const result = await cached(bapiClient.categories.getByPath, {
28
28
  cacheKeyPrefix: `getByPath-categories-${sanitizedPath}`
29
- })(sanitizedPath, { with: { children }, includeHidden });
29
+ })(sanitizedPath, {
30
+ with: { children, properties },
31
+ includeHidden
32
+ });
30
33
  const rootPath = await Promise.all(
31
34
  (result.rootlineIds || []).map((id) => {
32
35
  return cached(bapiClient.categories.getById, {
@@ -34,7 +37,8 @@ export const getCategoriesByPath = async function getCategoriesByPath2({ path, c
34
37
  })(id, {
35
38
  with: {
36
39
  children,
37
- parents: "all"
40
+ parents: "all",
41
+ properties
38
42
  },
39
43
  includeHidden
40
44
  });
@@ -57,14 +61,15 @@ export const getCategoriesByPath = async function getCategoriesByPath2({ path, c
57
61
  }
58
62
  return { categories: tree, activeNode: result };
59
63
  };
60
- export const getCategoryById = async function getCategoryById2({ id, children = 1, includeHidden }, context) {
64
+ export const getCategoryById = async function getCategoryById2({ id, children = 1, includeHidden, properties }, context) {
61
65
  const { cached, bapiClient } = context;
62
66
  return await cached(bapiClient.categories.getById, {
63
67
  cacheKeyPrefix: `getById-categories-${id}`
64
68
  })(id, {
65
69
  with: {
66
70
  children,
67
- parents: "all"
71
+ parents: "all",
72
+ properties
68
73
  },
69
74
  includeHidden
70
75
  });
@@ -24,7 +24,7 @@ const getCheckoutToken = exports.getCheckoutToken = async function getCheckoutTo
24
24
  carrier,
25
25
  basketId: context.basketKey,
26
26
  campaignKey: context.campaignKey
27
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.55.0"}`).setProtectedHeader({
27
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.56.0"}`).setProtectedHeader({
28
28
  alg: "HS256",
29
29
  typ: "JWT"
30
30
  }).sign(secret);
@@ -13,7 +13,7 @@ export const getCheckoutToken = async function getCheckoutToken2(jwtPayload, con
13
13
  carrier,
14
14
  basketId: context.basketKey,
15
15
  campaignKey: context.campaignKey
16
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.55.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
16
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.56.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
17
17
  return {
18
18
  accessToken: context.accessToken,
19
19
  checkoutJwt
@@ -1,2 +1,2 @@
1
- import type { Category, ProductCategory, ProductCategoryWith } from '@scayle/storefront-api';
2
- export type { ProductCategoryWith, ProductCategory, Category };
1
+ import type { Category, ProductCategory, ProductCategoryPropertyWith, ProductCategoryWith } from '@scayle/storefront-api';
2
+ export type { ProductCategoryWith, ProductCategory, ProductCategoryPropertyWith, Category, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "7.56.0",
3
+ "version": "7.57.0",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -75,7 +75,7 @@
75
75
  "@types/webpack-env": "1.18.5",
76
76
  "@vitest/coverage-v8": "1.6.0",
77
77
  "dprint": "0.46.2",
78
- "eslint": "9.4.0",
78
+ "eslint": "9.5.0",
79
79
  "eslint-formatter-gitlab": "5.1.0",
80
80
  "publint": "0.2.8",
81
81
  "rimraf": "5.0.7",