lambda-essentials-ts 5.3.0 → 5.3.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 CHANGED
@@ -4,6 +4,31 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
6
 
7
+ ## [5.3.2] - 2024-02-08
8
+
9
+ ### Fixed
10
+
11
+ Error details of external HTTP error resposes are propagated correctly
12
+
13
+ ## [5.3.1] - 2023-10-25
14
+
15
+ ### Fixed
16
+
17
+ The `getUserToken()` and `getUserPrincipal()` order was wrongly set in version `5.3.0`. The new fixed
18
+ priority order:
19
+
20
+ `getUserToken()`
21
+
22
+ 1. `request.authorizerContext.jwt`
23
+ 2. `request.authorizerContext.accessToken` (new)
24
+ 3. `request.headers.Authorization`
25
+
26
+ `getUserPrincipal()`
27
+
28
+ 1. `authorizerContext.canonicalId` (**prefer canonicalId**)
29
+ 2. `authorizerContext.principalId` (new)
30
+ 3. `request.headers.Authorization`
31
+
7
32
  ## [5.3.0] - 2023-09-07
8
33
 
9
34
  ### Changed
@@ -148,8 +148,8 @@ class OpenApiWrapper {
148
148
  var _a, _b, _c;
149
149
  if (authorizerContext) {
150
150
  return {
151
- userPrincipal: (_a = authorizerContext.principalId) !== null && _a !== void 0 ? _a : authorizerContext.canonicalId,
152
- userToken: (_b = authorizerContext.accessToken) !== null && _b !== void 0 ? _b : authorizerContext.jwt,
151
+ userPrincipal: (_a = authorizerContext.canonicalId) !== null && _a !== void 0 ? _a : authorizerContext.principalId,
152
+ userToken: (_b = authorizerContext.jwt) !== null && _b !== void 0 ? _b : authorizerContext.accessToken,
153
153
  };
154
154
  }
155
155
  if (headers.Authorization) {
package/lib/util.js CHANGED
@@ -53,7 +53,7 @@ function serializeAxiosError(error) {
53
53
  const { status, data } = error.response;
54
54
  return {
55
55
  status: (_a = data.originalStatusCode) !== null && _a !== void 0 ? _a : status,
56
- details: data.details ? data.details : data, // Prevent wrapping of Exception
56
+ details: data.details && Object.keys(data.details).length > 0 ? data.details : data, // Prevent wrapping of Exception
57
57
  };
58
58
  }
59
59
  exports.serializeAxiosError = serializeAxiosError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambda-essentials-ts",
3
- "version": "5.3.0",
3
+ "version": "5.3.2",
4
4
  "description": "A selection of the finest modules supporting authorization, API routing, error handling, logging and sending HTTP requests.",
5
5
  "main": "lib/index.js",
6
6
  "private": false,