@scayle/storefront-core 7.58.1 → 7.58.2
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 +2 -1
- package/dist/api/oauth.d.ts +1 -1
- package/dist/api/oauth.mjs +2 -1
- package/dist/rpc/methods/checkout/checkout.cjs +1 -1
- package/dist/rpc/methods/checkout/checkout.mjs +1 -1
- package/dist/rpc/methods/session.cjs +1 -1
- package/dist/rpc/methods/session.mjs +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/api/oauth.cjs
CHANGED
|
@@ -168,13 +168,14 @@ class OAuthClient {
|
|
|
168
168
|
* Revoke an access token
|
|
169
169
|
* @param accessToken
|
|
170
170
|
*/
|
|
171
|
-
async revokeToken(accessToken) {
|
|
171
|
+
async revokeToken(shopId, accessToken) {
|
|
172
172
|
this.logger?.debug("Revoking access token");
|
|
173
173
|
const decodedAccessToken = (0, _jose.decodeJwt)(accessToken);
|
|
174
174
|
await fetch(`${this.baseURL}/oauth/tokens/${decodedAccessToken.jti}`, {
|
|
175
175
|
method: "DELETE",
|
|
176
176
|
headers: {
|
|
177
177
|
...this.headers,
|
|
178
|
+
"X-Shop-Id": `${shopId}`,
|
|
178
179
|
Authorization: `Bearer ${accessToken}`
|
|
179
180
|
}
|
|
180
181
|
}).then(emptyOAuthResponseHandler);
|
package/dist/api/oauth.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare class OAuthClient {
|
|
|
62
62
|
* Revoke an access token
|
|
63
63
|
* @param accessToken
|
|
64
64
|
*/
|
|
65
|
-
revokeToken(accessToken: string): Promise<void>;
|
|
65
|
+
revokeToken(shopId: number, accessToken: string): Promise<void>;
|
|
66
66
|
/**
|
|
67
67
|
* Revoke all tokens for a user
|
|
68
68
|
* @param userId
|
package/dist/api/oauth.mjs
CHANGED
|
@@ -153,13 +153,14 @@ export class OAuthClient {
|
|
|
153
153
|
* Revoke an access token
|
|
154
154
|
* @param accessToken
|
|
155
155
|
*/
|
|
156
|
-
async revokeToken(accessToken) {
|
|
156
|
+
async revokeToken(shopId, accessToken) {
|
|
157
157
|
this.logger?.debug("Revoking access token");
|
|
158
158
|
const decodedAccessToken = decodeJwt(accessToken);
|
|
159
159
|
await fetch(`${this.baseURL}/oauth/tokens/${decodedAccessToken.jti}`, {
|
|
160
160
|
method: "DELETE",
|
|
161
161
|
headers: {
|
|
162
162
|
...this.headers,
|
|
163
|
+
"X-Shop-Id": `${shopId}`,
|
|
163
164
|
Authorization: `Bearer ${accessToken}`
|
|
164
165
|
}
|
|
165
166
|
}).then(emptyOAuthResponseHandler);
|
|
@@ -31,7 +31,7 @@ const getCheckoutToken = exports.getCheckoutToken = async function getCheckoutTo
|
|
|
31
31
|
carrier,
|
|
32
32
|
basketId: context.basketKey,
|
|
33
33
|
campaignKey: context.campaignKey
|
|
34
|
-
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.58.
|
|
34
|
+
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.58.1"}`).setProtectedHeader({
|
|
35
35
|
alg: "HS256",
|
|
36
36
|
typ: "JWT"
|
|
37
37
|
}).sign(secret);
|
|
@@ -21,7 +21,7 @@ export const getCheckoutToken = async function getCheckoutToken2(jwtPayload = {}
|
|
|
21
21
|
carrier,
|
|
22
22
|
basketId: context.basketKey,
|
|
23
23
|
campaignKey: context.campaignKey
|
|
24
|
-
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.58.
|
|
24
|
+
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.58.1"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
|
|
25
25
|
return {
|
|
26
26
|
accessToken: refreshedAccessToken,
|
|
27
27
|
checkoutJwt
|
|
@@ -144,7 +144,7 @@ const oauthRevokeToken = async context => {
|
|
|
144
144
|
const client = (0, _oauth.getOAuthClient)(context);
|
|
145
145
|
await context.destroySession();
|
|
146
146
|
try {
|
|
147
|
-
await client.revokeToken(accessToken);
|
|
147
|
+
await client.revokeToken(context.shopId, accessToken);
|
|
148
148
|
return {
|
|
149
149
|
result: true
|
|
150
150
|
};
|
|
@@ -149,7 +149,7 @@ export const oauthRevokeToken = async (context) => {
|
|
|
149
149
|
const client = getOAuthClient(context);
|
|
150
150
|
await context.destroySession();
|
|
151
151
|
try {
|
|
152
|
-
await client.revokeToken(accessToken);
|
|
152
|
+
await client.revokeToken(context.shopId, accessToken);
|
|
153
153
|
return { result: true };
|
|
154
154
|
} catch (error) {
|
|
155
155
|
const res = convertErrorForRpcCall(error, [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "7.58.
|
|
3
|
+
"version": "7.58.2",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@scayle/storefront-api": "17.2.0",
|
|
63
63
|
"crypto-js": "4.2.0",
|
|
64
|
-
"jose": "5.4.
|
|
64
|
+
"jose": "5.4.1",
|
|
65
65
|
"radash": "12.1.0",
|
|
66
66
|
"slugify": "1.6.6",
|
|
67
67
|
"ufo": "1.5.3",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@scayle/eslint-config-storefront": "4.2.0",
|
|
73
73
|
"@types/crypto-js": "4.2.2",
|
|
74
|
-
"@types/node": "20.14.
|
|
74
|
+
"@types/node": "20.14.7",
|
|
75
75
|
"@types/webpack-env": "1.18.5",
|
|
76
76
|
"@vitest/coverage-v8": "1.6.0",
|
|
77
77
|
"dprint": "0.46.3",
|