@scayle/storefront-core 7.65.3 → 7.65.4

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.65.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Restore filtered list of error status codes in `oauthLogin` (400, 404) `oauthRegister` (400, 409, 422) and `oauthGuestLogin` (400, 409)
8
+
3
9
  ## 7.65.3
4
10
 
5
11
  ### Patch Changes
@@ -200,7 +200,7 @@ const HttpStatusCode = exports.HttpStatusCode = {
200
200
  /**
201
201
  * The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
202
202
  */
203
- PAYLOAD_TOO_LARGE: 413,
203
+ CONTENT_TOO_LARGE: 413,
204
204
  /**
205
205
  * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,
206
206
  * in which case it should be converted to a POST request.
@@ -235,7 +235,7 @@ const HttpStatusCode = exports.HttpStatusCode = {
235
235
  /**
236
236
  * The request was well-formed but was unable to be followed due to semantic errors.
237
237
  */
238
- UNPROCESSABLE_ENTITY: 422,
238
+ UNPROCESSABLE_CONTENT: 422,
239
239
  /**
240
240
  * The resource that is being accessed is locked.
241
241
  */
@@ -514,7 +514,7 @@ const HttpStatusMessage = exports.HttpStatusMessage = {
514
514
  /**
515
515
  * The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
516
516
  */
517
- PAYLOAD_TOO_LARGE: "PAYLOAD TOO LARGE",
517
+ CONTENT_TOO_LARGE: "CONTENT TOO LARGE",
518
518
  /**
519
519
  * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,
520
520
  * in which case it should be converted to a POST request.
@@ -549,7 +549,7 @@ const HttpStatusMessage = exports.HttpStatusMessage = {
549
549
  /**
550
550
  * The request was well-formed but was unable to be followed due to semantic errors.
551
551
  */
552
- UNPROCESSABLE_ENTITY: "UNPROCESSABLE ENTITY",
552
+ UNPROCESSABLE_CONTENT: "UNPROCESSABLE CONTENT",
553
553
  /**
554
554
  * The resource that is being accessed is locked.
555
555
  */
@@ -195,7 +195,7 @@ declare const HttpStatusCode: {
195
195
  /**
196
196
  * The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
197
197
  */
198
- readonly PAYLOAD_TOO_LARGE: 413;
198
+ readonly CONTENT_TOO_LARGE: 413;
199
199
  /**
200
200
  * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,
201
201
  * in which case it should be converted to a POST request.
@@ -230,7 +230,7 @@ declare const HttpStatusCode: {
230
230
  /**
231
231
  * The request was well-formed but was unable to be followed due to semantic errors.
232
232
  */
233
- readonly UNPROCESSABLE_ENTITY: 422;
233
+ readonly UNPROCESSABLE_CONTENT: 422;
234
234
  /**
235
235
  * The resource that is being accessed is locked.
236
236
  */
@@ -509,7 +509,7 @@ declare const HttpStatusMessage: {
509
509
  /**
510
510
  * The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
511
511
  */
512
- readonly PAYLOAD_TOO_LARGE: "PAYLOAD TOO LARGE";
512
+ readonly CONTENT_TOO_LARGE: "CONTENT TOO LARGE";
513
513
  /**
514
514
  * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,
515
515
  * in which case it should be converted to a POST request.
@@ -544,7 +544,7 @@ declare const HttpStatusMessage: {
544
544
  /**
545
545
  * The request was well-formed but was unable to be followed due to semantic errors.
546
546
  */
547
- readonly UNPROCESSABLE_ENTITY: "UNPROCESSABLE ENTITY";
547
+ readonly UNPROCESSABLE_CONTENT: "UNPROCESSABLE CONTENT";
548
548
  /**
549
549
  * The resource that is being accessed is locked.
550
550
  */
@@ -194,7 +194,7 @@ const HttpStatusCode = {
194
194
  /**
195
195
  * The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
196
196
  */
197
- PAYLOAD_TOO_LARGE: 413,
197
+ CONTENT_TOO_LARGE: 413,
198
198
  /**
199
199
  * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,
200
200
  * in which case it should be converted to a POST request.
@@ -229,7 +229,7 @@ const HttpStatusCode = {
229
229
  /**
230
230
  * The request was well-formed but was unable to be followed due to semantic errors.
231
231
  */
232
- UNPROCESSABLE_ENTITY: 422,
232
+ UNPROCESSABLE_CONTENT: 422,
233
233
  /**
234
234
  * The resource that is being accessed is locked.
235
235
  */
@@ -508,7 +508,7 @@ const HttpStatusMessage = {
508
508
  /**
509
509
  * The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
510
510
  */
511
- PAYLOAD_TOO_LARGE: "PAYLOAD TOO LARGE",
511
+ CONTENT_TOO_LARGE: "CONTENT TOO LARGE",
512
512
  /**
513
513
  * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,
514
514
  * in which case it should be converted to a POST request.
@@ -543,7 +543,7 @@ const HttpStatusMessage = {
543
543
  /**
544
544
  * The request was well-formed but was unable to be followed due to semantic errors.
545
545
  */
546
- UNPROCESSABLE_ENTITY: "UNPROCESSABLE ENTITY",
546
+ UNPROCESSABLE_CONTENT: "UNPROCESSABLE CONTENT",
547
547
  /**
548
548
  * The resource that is being accessed is locked.
549
549
  */
@@ -37,7 +37,7 @@ const getCheckoutToken = exports.getCheckoutToken = async function getCheckoutTo
37
37
  carrier,
38
38
  basketId: context.basketKey,
39
39
  campaignKey: context.campaignKey
40
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.65.3"}`).setProtectedHeader({
40
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.65.4"}`).setProtectedHeader({
41
41
  alg: "HS256",
42
42
  typ: "JWT"
43
43
  }).sign(secret);
@@ -35,7 +35,7 @@ export const getCheckoutToken = async function getCheckoutToken2(jwtPayload = {}
35
35
  carrier,
36
36
  basketId: context.basketKey,
37
37
  campaignKey: context.campaignKey
38
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.65.3"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
38
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.65.4"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
39
39
  return {
40
40
  accessToken: refreshedAccessToken,
41
41
  checkoutJwt
@@ -68,7 +68,7 @@ const oauthLogin = async (login, context) => {
68
68
  });
69
69
  } catch (error) {
70
70
  context.log.error("OAuthClient.login failed", error);
71
- return new _errors.ErrorResponse(_constants.HttpStatusCode.INTERNAL_SERVER_ERROR, _constants.HttpStatusMessage.INTERNAL_SERVER_ERROR, "Login failed");
71
+ return convertErrorForRpcCall(error, [_constants.HttpStatusCode.BAD_REQUEST, _constants.HttpStatusCode.NOT_FOUND]) ?? new _errors.ErrorResponse(_constants.HttpStatusCode.INTERNAL_SERVER_ERROR, _constants.HttpStatusMessage.INTERNAL_SERVER_ERROR, "Login failed");
72
72
  }
73
73
  };
74
74
  exports.oauthLogin = oauthLogin;
@@ -92,7 +92,7 @@ const oauthRegister = async (register, context) => {
92
92
  });
93
93
  } catch (error) {
94
94
  context.log.error("OAuthClient.register failed", error);
95
- return new _errors.ErrorResponse(_constants.HttpStatusCode.INTERNAL_SERVER_ERROR, _constants.HttpStatusMessage.INTERNAL_SERVER_ERROR, "Register failed");
95
+ return convertErrorForRpcCall(error, [_constants.HttpStatusCode.BAD_REQUEST, _constants.HttpStatusCode.CONFLICT, _constants.HttpStatusCode.UNPROCESSABLE_CONTENT]) ?? new _errors.ErrorResponse(_constants.HttpStatusCode.INTERNAL_SERVER_ERROR, _constants.HttpStatusMessage.INTERNAL_SERVER_ERROR, "Register failed");
96
96
  }
97
97
  };
98
98
  exports.oauthRegister = oauthRegister;
@@ -116,7 +116,7 @@ const oauthGuestLogin = async (guest, context) => {
116
116
  });
117
117
  } catch (error) {
118
118
  context.log.error("OAuthClient.guestLogin failed", error);
119
- return new _errors.ErrorResponse(_constants.HttpStatusCode.INTERNAL_SERVER_ERROR, _constants.HttpStatusMessage.INTERNAL_SERVER_ERROR, "Guest login failed");
119
+ return convertErrorForRpcCall(error, [_constants.HttpStatusCode.BAD_REQUEST, _constants.HttpStatusCode.CONFLICT]) ?? new _errors.ErrorResponse(_constants.HttpStatusCode.INTERNAL_SERVER_ERROR, _constants.HttpStatusMessage.INTERNAL_SERVER_ERROR, "Guest login failed");
120
120
  }
121
121
  };
122
122
  exports.oauthGuestLogin = oauthGuestLogin;
@@ -83,7 +83,10 @@ export const oauthLogin = async (login, context) => {
83
83
  return new Response(null, { status: HttpStatusCode.NO_CONTENT });
84
84
  } catch (error) {
85
85
  context.log.error("OAuthClient.login failed", error);
86
- return new ErrorResponse(
86
+ return convertErrorForRpcCall(error, [
87
+ HttpStatusCode.BAD_REQUEST,
88
+ HttpStatusCode.NOT_FOUND
89
+ ]) ?? new ErrorResponse(
87
90
  HttpStatusCode.INTERNAL_SERVER_ERROR,
88
91
  HttpStatusMessage.INTERNAL_SERVER_ERROR,
89
92
  "Login failed"
@@ -112,7 +115,11 @@ export const oauthRegister = async (register, context) => {
112
115
  return new Response(null, { status: HttpStatusCode.NO_CONTENT });
113
116
  } catch (error) {
114
117
  context.log.error("OAuthClient.register failed", error);
115
- return new ErrorResponse(
118
+ return convertErrorForRpcCall(error, [
119
+ HttpStatusCode.BAD_REQUEST,
120
+ HttpStatusCode.CONFLICT,
121
+ HttpStatusCode.UNPROCESSABLE_CONTENT
122
+ ]) ?? new ErrorResponse(
116
123
  HttpStatusCode.INTERNAL_SERVER_ERROR,
117
124
  HttpStatusMessage.INTERNAL_SERVER_ERROR,
118
125
  "Register failed"
@@ -141,7 +148,10 @@ export const oauthGuestLogin = async (guest, context) => {
141
148
  return new Response(null, { status: HttpStatusCode.NO_CONTENT });
142
149
  } catch (error) {
143
150
  context.log.error("OAuthClient.guestLogin failed", error);
144
- return new ErrorResponse(
151
+ return convertErrorForRpcCall(error, [
152
+ HttpStatusCode.BAD_REQUEST,
153
+ HttpStatusCode.CONFLICT
154
+ ]) ?? new ErrorResponse(
145
155
  HttpStatusCode.INTERNAL_SERVER_ERROR,
146
156
  HttpStatusMessage.INTERNAL_SERVER_ERROR,
147
157
  "Guest login failed"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "7.65.3",
3
+ "version": "7.65.4",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -71,11 +71,11 @@
71
71
  "devDependencies": {
72
72
  "@scayle/eslint-config-storefront": "4.3.0",
73
73
  "@types/crypto-js": "4.2.2",
74
- "@types/node": "20.16.5",
74
+ "@types/node": "20.16.6",
75
75
  "@types/webpack-env": "1.18.5",
76
76
  "@vitest/coverage-v8": "2.1.1",
77
77
  "dprint": "0.47.2",
78
- "eslint": "9.10.0",
78
+ "eslint": "9.11.1",
79
79
  "eslint-formatter-gitlab": "5.1.0",
80
80
  "publint": "0.2.11",
81
81
  "rimraf": "6.0.1",