@scayle/storefront-core 7.41.3 → 7.42.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,17 @@
|
|
|
1
1
|
# @scayle/storefront-core
|
|
2
2
|
|
|
3
|
+
## 7.42.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix usage of the same cache key prefix for `getCategoryByPath`
|
|
8
|
+
|
|
9
|
+
## 7.42.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Add `getCategoryByPath` RPC method
|
|
14
|
+
|
|
3
15
|
## 7.41.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getRootCategories = exports.getCategoryById = exports.getCategoriesByPath = void 0;
|
|
6
|
+
exports.getRootCategories = exports.getCategoryByPath = exports.getCategoryById = exports.getCategoriesByPath = void 0;
|
|
7
7
|
var _helpers = require("../../helpers/index.cjs");
|
|
8
8
|
const getRootCategories = exports.getRootCategories = async function getRootCategories2({
|
|
9
9
|
children = 1,
|
|
@@ -25,6 +25,25 @@ const getRootCategories = exports.getRootCategories = async function getRootCate
|
|
|
25
25
|
activeNode: void 0
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
+
const getCategoryByPath = exports.getCategoryByPath = async function getCategoryByPath2({
|
|
29
|
+
path,
|
|
30
|
+
children = 1,
|
|
31
|
+
includeHidden
|
|
32
|
+
}, context) {
|
|
33
|
+
const {
|
|
34
|
+
cached,
|
|
35
|
+
bapiClient
|
|
36
|
+
} = context;
|
|
37
|
+
const sanitizedPath = (0, _helpers.splitAndRemoveEmpty)(path);
|
|
38
|
+
return await cached(bapiClient.categories.getByPath, {
|
|
39
|
+
cacheKeyPrefix: `getByPath-category-${sanitizedPath}`
|
|
40
|
+
})(sanitizedPath, {
|
|
41
|
+
with: {
|
|
42
|
+
children
|
|
43
|
+
},
|
|
44
|
+
includeHidden
|
|
45
|
+
});
|
|
46
|
+
};
|
|
28
47
|
const getCategoriesByPath = exports.getCategoriesByPath = async function getCategoriesByPath2({
|
|
29
48
|
path,
|
|
30
49
|
children = 1,
|
|
@@ -6,6 +6,11 @@ export declare const getRootCategories: RpcHandler<{
|
|
|
6
6
|
categories: Category[];
|
|
7
7
|
activeNode: undefined;
|
|
8
8
|
}>;
|
|
9
|
+
export declare const getCategoryByPath: RpcHandler<{
|
|
10
|
+
path: string;
|
|
11
|
+
children?: number;
|
|
12
|
+
includeHidden?: true;
|
|
13
|
+
}, Category | undefined>;
|
|
9
14
|
export declare const getCategoriesByPath: RpcHandler<{
|
|
10
15
|
path: string;
|
|
11
16
|
children?: number;
|
|
@@ -11,6 +11,13 @@ 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) {
|
|
15
|
+
const { cached, bapiClient } = context;
|
|
16
|
+
const sanitizedPath = splitAndRemoveEmpty(path);
|
|
17
|
+
return await cached(bapiClient.categories.getByPath, {
|
|
18
|
+
cacheKeyPrefix: `getByPath-category-${sanitizedPath}`
|
|
19
|
+
})(sanitizedPath, { with: { children }, includeHidden });
|
|
20
|
+
};
|
|
14
21
|
export const getCategoriesByPath = async function getCategoriesByPath2({ path, children = 1, includeHidden }, context) {
|
|
15
22
|
const { cached, bapiClient } = context;
|
|
16
23
|
if (path === "/") {
|