@scayle/storefront-core 7.42.0 → 7.43.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 +12 -0
- package/dist/helpers/sanitizationHelpers.cjs +7 -2
- package/dist/helpers/sanitizationHelpers.d.ts +1 -0
- package/dist/helpers/sanitizationHelpers.mjs +5 -1
- package/dist/rpc/methods/categories.cjs +1 -1
- package/dist/rpc/methods/categories.mjs +1 -1
- package/dist/types/api/context.d.ts +1 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @scayle/storefront-core
|
|
2
2
|
|
|
3
|
+
## 7.43.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add `createAndPurifyHeaders` sanitization helper
|
|
8
|
+
|
|
9
|
+
## 7.42.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Fix usage of the same cache key prefix for `getCategoryByPath`
|
|
14
|
+
|
|
3
15
|
## 7.42.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.stripShopLocaleFromPath = exports.purifySensitiveData = void 0;
|
|
6
|
+
exports.stripShopLocaleFromPath = exports.purifySensitiveData = exports.createAndPurifyHeaders = void 0;
|
|
7
7
|
var _radash = require("radash");
|
|
8
8
|
const SANITIZATION_MASK = "********";
|
|
9
9
|
const stripShopLocaleFromPath = (locale, path, splitter = "/") => path.split(splitter).filter(segment => segment.toLowerCase() !== locale.toLowerCase()).join("/");
|
|
@@ -19,4 +19,9 @@ const purifySensitiveData = (data = {}, blacklistedKeys = ["password"]) => {
|
|
|
19
19
|
return purifiedPayload;
|
|
20
20
|
}, {});
|
|
21
21
|
};
|
|
22
|
-
exports.purifySensitiveData = purifySensitiveData;
|
|
22
|
+
exports.purifySensitiveData = purifySensitiveData;
|
|
23
|
+
const createAndPurifyHeaders = headers => {
|
|
24
|
+
const sanitizedHeaders = (0, _radash.shake)(headers);
|
|
25
|
+
return new Headers(sanitizedHeaders);
|
|
26
|
+
};
|
|
27
|
+
exports.createAndPurifyHeaders = createAndPurifyHeaders;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const stripShopLocaleFromPath: (locale: string, path: string, splitter?: string) => string;
|
|
2
2
|
export declare const purifySensitiveData: (data?: Record<string, any>, blacklistedKeys?: string[]) => Record<string, any>;
|
|
3
|
+
export declare const createAndPurifyHeaders: (headers: Partial<Record<string, string | undefined>>) => Headers;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isObject } from "radash";
|
|
1
|
+
import { isObject, shake } from "radash";
|
|
2
2
|
const SANITIZATION_MASK = "********";
|
|
3
3
|
export const stripShopLocaleFromPath = (locale, path, splitter = "/") => path.split(splitter).filter((segment) => segment.toLowerCase() !== locale.toLowerCase()).join("/");
|
|
4
4
|
export const purifySensitiveData = (data = {}, blacklistedKeys = ["password"]) => {
|
|
@@ -17,3 +17,7 @@ export const purifySensitiveData = (data = {}, blacklistedKeys = ["password"]) =
|
|
|
17
17
|
{}
|
|
18
18
|
);
|
|
19
19
|
};
|
|
20
|
+
export const createAndPurifyHeaders = (headers) => {
|
|
21
|
+
const sanitizedHeaders = shake(headers);
|
|
22
|
+
return new Headers(sanitizedHeaders);
|
|
23
|
+
};
|
|
@@ -36,7 +36,7 @@ const getCategoryByPath = exports.getCategoryByPath = async function getCategory
|
|
|
36
36
|
} = context;
|
|
37
37
|
const sanitizedPath = (0, _helpers.splitAndRemoveEmpty)(path);
|
|
38
38
|
return await cached(bapiClient.categories.getByPath, {
|
|
39
|
-
cacheKeyPrefix: `getByPath-
|
|
39
|
+
cacheKeyPrefix: `getByPath-category-${sanitizedPath}`
|
|
40
40
|
})(sanitizedPath, {
|
|
41
41
|
with: {
|
|
42
42
|
children
|
|
@@ -15,7 +15,7 @@ export const getCategoryByPath = async function getCategoryByPath2({ path, child
|
|
|
15
15
|
const { cached, bapiClient } = context;
|
|
16
16
|
const sanitizedPath = splitAndRemoveEmpty(path);
|
|
17
17
|
return await cached(bapiClient.categories.getByPath, {
|
|
18
|
-
cacheKeyPrefix: `getByPath-
|
|
18
|
+
cacheKeyPrefix: `getByPath-category-${sanitizedPath}`
|
|
19
19
|
})(sanitizedPath, { with: { children }, includeHidden });
|
|
20
20
|
};
|
|
21
21
|
export const getCategoriesByPath = async function getCategoriesByPath2({ path, children = 1, includeHidden }, context) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.43.0",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@aboutyou/backbone": "16.1.2",
|
|
63
63
|
"crypto-js": "4.2.0",
|
|
64
64
|
"jose": "5.2.2",
|
|
65
|
-
"radash": "
|
|
65
|
+
"radash": "12.0.0",
|
|
66
66
|
"slugify": "1.6.6",
|
|
67
67
|
"ufo": "1.4.0",
|
|
68
68
|
"uncrypto": "0.1.3",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@scayle/eslint-config-storefront": "3.2.6",
|
|
73
73
|
"@types/crypto-js": "4.2.2",
|
|
74
|
-
"@types/node": "20.11.
|
|
74
|
+
"@types/node": "20.11.20",
|
|
75
75
|
"@types/webpack-env": "1.18.4",
|
|
76
|
-
"@vitest/coverage-v8": "1.3.
|
|
76
|
+
"@vitest/coverage-v8": "1.3.1",
|
|
77
77
|
"dprint": "0.45.0",
|
|
78
|
-
"eslint": "8.
|
|
78
|
+
"eslint": "8.57.0",
|
|
79
79
|
"eslint-formatter-gitlab": "5.1.0",
|
|
80
80
|
"publint": "0.2.7",
|
|
81
81
|
"rimraf": "5.0.5",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"typescript": "5.3.3",
|
|
84
84
|
"unbuild": "2.0.0",
|
|
85
85
|
"unstorage": "1.10.1",
|
|
86
|
-
"vitest": "1.3.
|
|
86
|
+
"vitest": "1.3.1"
|
|
87
87
|
},
|
|
88
88
|
"optionalDependencies": {
|
|
89
89
|
"redis": "4"
|