@scayle/storefront-core 7.42.1 → 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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 7.43.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add `createAndPurifyHeaders` sanitization helper
8
+
3
9
  ## 7.42.1
4
10
 
5
11
  ### Patch 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
+ };
@@ -76,6 +76,7 @@ export type RpcContext = {
76
76
  };
77
77
  runtimeConfiguration: RuntimeConfiguration;
78
78
  idp?: IDPConfig;
79
+ headers: Headers;
79
80
  } & (ContextNoSession | ContextWithSession);
80
81
  export type RpcContextWithSession = RpcContext & {
81
82
  sessionId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "7.42.1",
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": "11.0.0",
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.19",
74
+ "@types/node": "20.11.20",
75
75
  "@types/webpack-env": "1.18.4",
76
- "@vitest/coverage-v8": "1.3.0",
76
+ "@vitest/coverage-v8": "1.3.1",
77
77
  "dprint": "0.45.0",
78
- "eslint": "8.56.0",
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.0"
86
+ "vitest": "1.3.1"
87
87
  },
88
88
  "optionalDependencies": {
89
89
  "redis": "4"