@spytecgps/lambda-utils 0.9.9 → 0.9.10

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/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { APIGatewayProxyWithLambdaAuthorizerEvent, SQSEvent, SQSRecord } from 'aws-lambda';
1
+ import { APIGatewayProxyEvent, APIGatewayProxyWithLambdaAuthorizerEvent, SQSEvent, SQSRecord } from 'aws-lambda';
2
2
  import { ObjectSchema } from 'joi';
3
3
  import { APIGatewayProxyEventBase } from 'aws-lambda/trigger/api-gateway-proxy';
4
4
  import * as Joi from 'joi';
@@ -16,7 +16,7 @@ export interface SpytecAuthContext {
16
16
  }
17
17
  export declare type BaseAPIGatewayEvent = Omit<APIGatewayProxyEventBase<SpytecAuthContext>, 'pathParameters' | 'queryStringParameters' | 'body'>;
18
18
  export interface WrapperArgs<E, R> {
19
- event: APIGatewayProxyWithLambdaAuthorizerEvent<SpytecAuthContext>;
19
+ event: APIGatewayProxyWithLambdaAuthorizerEvent<SpytecAuthContext> | APIGatewayProxyEvent;
20
20
  schema?: ObjectSchema<E>;
21
21
  handler: Handler<E, R>;
22
22
  }
@@ -38,6 +38,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  var validation_1 = require("../validation");
40
40
  var response_1 = require("./response");
41
+ var logEvent = function (e) { return ({
42
+ resource: e.resource,
43
+ httpMethod: e.httpMethod,
44
+ queryStringParameters: e.queryStringParameters,
45
+ pathParameters: e.pathParameters,
46
+ body: e.body,
47
+ }); };
41
48
  var apiGatewayEventWrapper = function (_a) {
42
49
  var event = _a.event, schema = _a.schema, handler = _a.handler;
43
50
  return __awaiter(void 0, void 0, void 0, function () {
@@ -45,7 +52,7 @@ var apiGatewayEventWrapper = function (_a) {
45
52
  return __generator(this, function (_b) {
46
53
  switch (_b.label) {
47
54
  case 0:
48
- console.log("apiGatewayWrapper - got event", event);
55
+ console.log("apiGatewayWrapper - got event", logEvent(event));
49
56
  _b.label = 1;
50
57
  case 1:
51
58
  _b.trys.push([1, 3, , 4]);
@@ -53,7 +60,7 @@ var apiGatewayEventWrapper = function (_a) {
53
60
  return [4 /*yield*/, handler(validatedEvent)];
54
61
  case 2:
55
62
  result = _b.sent();
56
- console.log("apiGwWrapper - finished", result);
63
+ console.log("apiGatewayWrapper - finished", result);
57
64
  return [2 /*return*/, response_1.buildProxyResult(result)];
58
65
  case 3:
59
66
  err_1 = _b.sent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/lambda-utils",
3
- "version": "0.9.9",
3
+ "version": "0.9.10",
4
4
  "description": "Lambda Utils",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",