@scayle/storefront-core 7.62.0 → 7.63.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 +6 -0
- package/dist/api/oauth.cjs +3 -2
- package/dist/api/oauth.d.ts +3 -2
- package/dist/api/oauth.mjs +3 -2
- package/dist/helpers/filterHelper.d.ts +1 -1
- package/dist/rpc/methods/checkout/checkout.cjs +1 -1
- package/dist/rpc/methods/checkout/checkout.mjs +1 -1
- package/dist/types/api/context.d.ts +3 -0
- package/dist/utils/compression.cjs +3 -2
- package/dist/utils/compression.mjs +2 -1
- package/dist/utils/response.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/dist/api/oauth.cjs
CHANGED
|
@@ -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
|
-
*
|
|
185
|
-
* @param
|
|
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`, {
|
package/dist/api/oauth.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
68
|
-
* @param
|
|
68
|
+
* Generate a new token based on authorization code
|
|
69
|
+
* @param code
|
|
69
70
|
*/
|
|
70
71
|
generateToken(code: string): Promise<Oauth>;
|
|
71
72
|
}
|
package/dist/api/oauth.mjs
CHANGED
|
@@ -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
|
-
*
|
|
170
|
-
* @param
|
|
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
|
|
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.
|
|
36
|
+
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.63.0"}`).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.
|
|
30
|
+
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.63.0"}`).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
|
|
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
|
|
14
|
+
} catch {
|
|
14
15
|
return data;
|
|
15
16
|
}
|
|
16
17
|
};
|
package/dist/utils/response.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.63.0",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
"utility-types": "^3.11.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@scayle/eslint-config-storefront": "4.
|
|
73
|
+
"@scayle/eslint-config-storefront": "4.3.0",
|
|
74
74
|
"@types/crypto-js": "4.2.2",
|
|
75
|
-
"@types/node": "20.14.
|
|
75
|
+
"@types/node": "20.14.12",
|
|
76
76
|
"@types/webpack-env": "1.18.5",
|
|
77
77
|
"@vitest/coverage-v8": "2.0.4",
|
|
78
78
|
"dprint": "0.47.2",
|
|
79
|
-
"eslint": "9.
|
|
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",
|