quidproquo-actionprocessor-awslambda 0.0.196 → 0.0.197

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.
@@ -40,8 +40,7 @@ const getProcessTransformEventParams = (serviceName) => {
40
40
  isBase64Encoded: apiGatewayEvent.isBase64Encoded,
41
41
  };
42
42
  // Transform the body if its a multipart/form-data
43
- if ((quidproquo_webserver_1.qpqWebServerUtils.getHeaderValue('Content-Type', apiGatewayEvent.headers) || '').startsWith('multipart/form-data') &&
44
- apiGatewayEvent.body) {
43
+ if ((quidproquo_webserver_1.qpqWebServerUtils.getHeaderValue('Content-Type', apiGatewayEvent.headers) || '').startsWith('multipart/form-data') && apiGatewayEvent.body) {
45
44
  transformedEventParams.files = yield (0, parseMultipartFormData_1.parseMultipartFormData)(apiGatewayEvent);
46
45
  }
47
46
  console.log(JSON.stringify(transformedEventParams, null, 2));
@@ -55,7 +54,7 @@ const getProcessTransformResponseResult = (qpqConfig) => {
55
54
  const headers = Object.assign(Object.assign({}, quidproquo_webserver_1.qpqWebServerUtils.getCorsHeaders(qpqConfig, {}, payload.transformedEventParams.headers)), (((_a = payload === null || payload === void 0 ? void 0 : payload.response) === null || _a === void 0 ? void 0 : _a.headers) || {}));
56
55
  return (0, quidproquo_core_1.actionResult)({
57
56
  statusCode: payload.response.status,
58
- body: payload.response.body || '',
57
+ body: payload.transformedEventParams.method === 'HEAD' || !payload.response.body ? '' : payload.response.body,
59
58
  isBase64Encoded: payload.response.isBase64Encoded,
60
59
  headers: transformHttpEventHeadersToAPIGatewayProxyResultHeaders(headers),
61
60
  });
@@ -94,7 +93,8 @@ const getProcessMatchStory = (qpqConfig) => {
94
93
  // Sort the routes by string length
95
94
  // Note: We may need to filter variable routes out {} as the variables are length independent
96
95
  const routesWithNoOptions = routes.filter((r) => r.method === payload.transformedEventParams.method ||
97
- payload.transformedEventParams.method === 'OPTIONS');
96
+ payload.transformedEventParams.method === 'OPTIONS' ||
97
+ (payload.transformedEventParams.method === 'HEAD' && r.method === 'GET'));
98
98
  const sortedRoutes = quidproquo_webserver_1.qpqWebServerUtils.sortPathMatchConfigs(routesWithNoOptions);
99
99
  // Find the most relevant match
100
100
  const matchedRoute = sortedRoutes
@@ -22,11 +22,10 @@ const getUserDirectoryAuthenticateUserActionProcessor = (qpqConfig) => {
22
22
  const authResponse = yield (0, authenticateUser_1.authenticateUser)(userPoolId, userPoolClientId, quidproquo_core_1.qpqCoreUtils.getApplicationModuleDeployRegion(qpqConfig), payload.authenticateUserRequest.email, payload.authenticateUserRequest.password);
23
23
  return (0, quidproquo_core_1.actionResult)(authResponse);
24
24
  }
25
- catch (e) {
26
- if (e instanceof Error) {
27
- return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.Unauthorized, e.message);
28
- }
29
- return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, 'An unknown error has occurred.');
25
+ catch (error) {
26
+ return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
27
+ UserNotFoundException: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.UserDirectoryAuthenticateUserErrorTypeEnum.UserNotFound, 'Incorrect username or password'),
28
+ });
30
29
  }
31
30
  });
32
31
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-actionprocessor-awslambda",
3
- "version": "0.0.196",
3
+ "version": "0.0.197",
4
4
  "description": "",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "types": "./lib/commonjs/index.d.ts",
@@ -47,9 +47,9 @@
47
47
  "lodash": "^4.17.21",
48
48
  "node-cache": "^5.1.2",
49
49
  "node-match-path": "^0.6.3",
50
- "quidproquo-config-aws": "0.0.196",
51
- "quidproquo-core": "0.0.196",
52
- "quidproquo-webserver": "0.0.196"
50
+ "quidproquo-config-aws": "0.0.197",
51
+ "quidproquo-core": "0.0.197",
52
+ "quidproquo-webserver": "0.0.197"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/aws-lambda": "^8.10.109",
@@ -57,7 +57,7 @@
57
57
  "@types/jsonwebtoken": "^9.0.2",
58
58
  "@types/lodash": "^4.14.194",
59
59
  "@types/node": "^18.11.9",
60
- "quidproquo-tsconfig": "0.0.196",
60
+ "quidproquo-tsconfig": "0.0.197",
61
61
  "typescript": "^4.9.3"
62
62
  }
63
63
  }