@scayle/storefront-core 7.62.0 → 7.63.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,18 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 7.63.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @scayle/storefront-api@17.4.3
9
+
10
+ ## 7.63.0
11
+
12
+ ### Minor Changes
13
+
14
+ - Deprecate `RpcContext.storeCampaignKeyword`
15
+
3
16
  ## 7.62.0
4
17
 
5
18
  ### Minor Changes
@@ -166,6 +166,7 @@ class OAuthClient {
166
166
  }
167
167
  /**
168
168
  * Revoke an access token
169
+ * @param shopId
169
170
  * @param accessToken
170
171
  */
171
172
  async revokeToken(shopId, accessToken) {
@@ -181,8 +182,8 @@ class OAuthClient {
181
182
  }).then(emptyOAuthResponseHandler);
182
183
  }
183
184
  /**
184
- * Revoke all tokens for a user
185
- * @param userId
185
+ * Generate a new token based on authorization code
186
+ * @param code
186
187
  */
187
188
  async generateToken(code) {
188
189
  return await fetch(`${this.baseURL}/oauth/token`, {
@@ -60,12 +60,13 @@ export declare class OAuthClient {
60
60
  validateToken(accessToken: string): Promise<void>;
61
61
  /**
62
62
  * Revoke an access token
63
+ * @param shopId
63
64
  * @param accessToken
64
65
  */
65
66
  revokeToken(shopId: number, accessToken: string): Promise<void>;
66
67
  /**
67
- * Revoke all tokens for a user
68
- * @param userId
68
+ * Generate a new token based on authorization code
69
+ * @param code
69
70
  */
70
71
  generateToken(code: string): Promise<Oauth>;
71
72
  }
@@ -151,6 +151,7 @@ export class OAuthClient {
151
151
  }
152
152
  /**
153
153
  * Revoke an access token
154
+ * @param shopId
154
155
  * @param accessToken
155
156
  */
156
157
  async revokeToken(shopId, accessToken) {
@@ -166,8 +167,8 @@ export class OAuthClient {
166
167
  }).then(emptyOAuthResponseHandler);
167
168
  }
168
169
  /**
169
- * Revoke all tokens for a user
170
- * @param userId
170
+ * Generate a new token based on authorization code
171
+ * @param code
171
172
  */
172
173
  async generateToken(code) {
173
174
  return await fetch(`${this.baseURL}/oauth/token`, {
@@ -80,6 +80,6 @@ export declare const serializeFilters: (filter: Filter) => SerializedFilter | un
80
80
  /**
81
81
  * Converts filter values back into their original data type.
82
82
  *
83
- * @param filters
83
+ * @param serializedFilter
84
84
  */
85
85
  export declare const deserializeFilters: (serializedFilter: SerializedFilter) => Filter;
@@ -33,7 +33,7 @@ const getCheckoutToken = exports.getCheckoutToken = async function getCheckoutTo
33
33
  carrier,
34
34
  basketId: context.basketKey,
35
35
  campaignKey: context.campaignKey
36
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.62.0"}`).setProtectedHeader({
36
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.63.1"}`).setProtectedHeader({
37
37
  alg: "HS256",
38
38
  typ: "JWT"
39
39
  }).sign(secret);
@@ -27,7 +27,7 @@ export const getCheckoutToken = async function getCheckoutToken2(jwtPayload = {}
27
27
  carrier,
28
28
  basketId: context.basketKey,
29
29
  campaignKey: context.campaignKey
30
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.62.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
30
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.63.1"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
31
31
  return {
32
32
  accessToken: refreshedAccessToken,
33
33
  checkoutJwt
@@ -89,6 +89,9 @@ export type RpcContext = {
89
89
  destroySessionsForUserId: (userId: number, sessionsToKeep?: string[]) => Promise<void>;
90
90
  generateBasketKeyForUserId: (userId: string) => Promise<string>;
91
91
  generateWishlistKeyForUserId: (userId: string) => Promise<string>;
92
+ /**
93
+ * @deprecated storeCampaignKeyword will be removed in a future release.
94
+ */
92
95
  storeCampaignKeyword?: string;
93
96
  routerBasePath?: string;
94
97
  ip?: string | undefined;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.decompress = exports.compress = void 0;
7
7
  var _util = require("util");
8
8
  var _zlib = require("zlib");
9
+ var _nodeBuffer = require("node:buffer");
9
10
  const asyncDeflate = (0, _util.promisify)(_zlib.gzip);
10
11
  const asyncUnzip = (0, _util.promisify)(_zlib.gunzip);
11
12
  const compress = async data => {
@@ -15,9 +16,9 @@ const compress = async data => {
15
16
  exports.compress = compress;
16
17
  const decompress = async data => {
17
18
  try {
18
- const buffer = Buffer.from(data, "base64");
19
+ const buffer = _nodeBuffer.Buffer.from(data, "base64");
19
20
  return (await asyncUnzip(buffer)).toString();
20
- } catch (e) {
21
+ } catch {
21
22
  return data;
22
23
  }
23
24
  };
@@ -1,5 +1,6 @@
1
1
  import { promisify } from "util";
2
2
  import { gunzip, gzip } from "zlib";
3
+ import { Buffer } from "node:buffer";
3
4
  const asyncDeflate = promisify(gzip);
4
5
  const asyncUnzip = promisify(gunzip);
5
6
  export const compress = async (data) => {
@@ -10,7 +11,7 @@ export const decompress = async (data) => {
10
11
  try {
11
12
  const buffer = Buffer.from(data, "base64");
12
13
  return (await asyncUnzip(buffer)).toString();
13
- } catch (e) {
14
+ } catch {
14
15
  return data;
15
16
  }
16
17
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Unwrap a possible response into its body
3
3
  * @param res
4
- * @returns
4
+ * @returns unwrapped response
5
5
  */
6
6
  export declare function unwrap<T>(res: Promise<Response | T> | Response | T): Promise<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "7.62.0",
3
+ "version": "7.63.1",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -59,7 +59,7 @@
59
59
  "test:ci": "vitest --run --passWithNoTests --coverage --reporter=default --reporter=junit"
60
60
  },
61
61
  "dependencies": {
62
- "@scayle/storefront-api": "17.4.2",
62
+ "@scayle/storefront-api": "17.4.3",
63
63
  "crypto-js": "^4.2.0",
64
64
  "hookable": "^5.5.3",
65
65
  "jose": "^5.6.3",
@@ -70,13 +70,13 @@
70
70
  "utility-types": "^3.11.0"
71
71
  },
72
72
  "devDependencies": {
73
- "@scayle/eslint-config-storefront": "4.2.0",
73
+ "@scayle/eslint-config-storefront": "4.3.0",
74
74
  "@types/crypto-js": "4.2.2",
75
- "@types/node": "20.14.11",
75
+ "@types/node": "20.14.14",
76
76
  "@types/webpack-env": "1.18.5",
77
- "@vitest/coverage-v8": "2.0.4",
77
+ "@vitest/coverage-v8": "2.0.5",
78
78
  "dprint": "0.47.2",
79
- "eslint": "9.7.0",
79
+ "eslint": "9.8.0",
80
80
  "eslint-formatter-gitlab": "5.1.0",
81
81
  "publint": "0.2.9",
82
82
  "rimraf": "6.0.1",
@@ -84,7 +84,7 @@
84
84
  "typescript": "5.5.4",
85
85
  "unbuild": "2.0.0",
86
86
  "unstorage": "1.10.2",
87
- "vitest": "2.0.4"
87
+ "vitest": "2.0.5"
88
88
  },
89
89
  "optionalDependencies": {
90
90
  "redis": "4"