@cumulusds/aws-apig-bypass 1.1.0 → 2.0.0-mflambda.1.g6c2a1d9

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.
@@ -1,6 +1,6 @@
1
- import { APIGatewayEvent } from "aws-lambda";
2
- import type { Response } from "./response";
1
+ import type { APIGatewayEvent } from "aws-lambda";
3
2
  import type { LambdaInvoke } from "./lambda-invoke";
3
+ import type { Response } from "./response";
4
4
  /**
5
5
  * Client that directly invokes an API Gateway handler, bypassing the gateway. The client handles packing and unpacking messages for invoking the handler.
6
6
  */
@@ -5,9 +5,9 @@
5
5
  * @flow
6
6
  */
7
7
 
8
- import { APIGatewayEvent } from "aws-lambda";
9
- import type { Response } from "./response";
8
+ import type { APIGatewayEvent } from "aws-lambda";
10
9
  import type { LambdaInvoke } from "./lambda-invoke";
10
+ import type { Response } from "./response";
11
11
 
12
12
  /**
13
13
  * Client that directly invokes an API Gateway handler, bypassing the gateway. The client handles packing and unpacking messages for invoking the handler.
@@ -1,4 +1,4 @@
1
- import { Lambda } from "aws-sdk";
1
+ import type { InvocationResponse } from "@aws-sdk/client-lambda";
2
2
  import type { LambdaInvoke } from "./lambda-invoke";
3
3
  type _Blob = Buffer | Uint8Array | Blob | string;
4
4
  type LambdaClientType = (event: _Blob) => Promise<string>;
@@ -30,7 +30,7 @@ export type Lambda$InvocationResponse = {
30
30
  };
31
31
  export declare class LambdaInvokeError extends Error {
32
32
  code: string;
33
- constructor(response: Lambda.InvocationResponse);
33
+ constructor(response: InvocationResponse);
34
34
  }
35
35
  /**
36
36
  * AWS Lambda SDK adapter for createClient.
@@ -27,13 +27,14 @@ function createLambdaClient({ Lambda: LambdaShadow, FunctionName, }) {
27
27
  const invocationResponse = await LambdaShadow.invoke({
28
28
  FunctionName,
29
29
  Payload,
30
- }).promise();
30
+ });
31
31
  if (invocationResponse.StatusCode !== 200 || invocationResponse.FunctionError != null) {
32
32
  throw new LambdaInvokeError(invocationResponse);
33
33
  }
34
- if (typeof invocationResponse.Payload !== "string") {
34
+ const payload = invocationResponse.Payload?.toString();
35
+ if (typeof payload !== "string") {
35
36
  throw new Error(`AWS Lambda invocation API returned the wrong payload type '${typeof invocationResponse.Payload}'; expected 'string'`);
36
37
  }
37
- return invocationResponse.Payload;
38
+ return payload;
38
39
  };
39
40
  }
@@ -5,7 +5,7 @@
5
5
  * @flow
6
6
  */
7
7
 
8
- import { Lambda } from "aws-sdk";
8
+ import type { InvocationResponse } from "@aws-sdk/client-lambda";
9
9
  import type { LambdaInvoke } from "./lambda-invoke";
10
10
  declare type _Blob = Buffer | Uint8Array | Blob | string;
11
11
  declare type LambdaClientType = (event: _Blob) => Promise<string>;
@@ -43,7 +43,7 @@ export type Lambda$InvocationResponse = {
43
43
  };
44
44
  declare export class LambdaInvokeError mixins Error {
45
45
  code: string;
46
- constructor(response: Lambda.InvocationResponse): this;
46
+ constructor(response: InvocationResponse): this;
47
47
  }
48
48
  /**
49
49
  * AWS Lambda SDK adapter for createClient.
package/lib/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export { default as createClient } from "./create-client";
2
2
  export type { APIGatewayHandlerClient } from "./create-client";
3
3
  export { default as createAPIGatewayEvent } from "./create-api-gateway-event";
4
+ export * from "./response";
5
+ export { default as parsePayload } from "./parse-payload";
package/lib/index.js CHANGED
@@ -1,10 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
18
  };
5
19
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createAPIGatewayEvent = exports.createClient = void 0;
20
+ exports.parsePayload = exports.createAPIGatewayEvent = exports.createClient = void 0;
7
21
  var create_client_1 = require("./create-client");
8
22
  Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return __importDefault(create_client_1).default; } });
9
23
  var create_api_gateway_event_1 = require("./create-api-gateway-event");
10
24
  Object.defineProperty(exports, "createAPIGatewayEvent", { enumerable: true, get: function () { return __importDefault(create_api_gateway_event_1).default; } });
25
+ __exportStar(require("./response"), exports);
26
+ var parse_payload_1 = require("./parse-payload");
27
+ Object.defineProperty(exports, "parsePayload", { enumerable: true, get: function () { return __importDefault(parse_payload_1).default; } });
package/lib/index.js.flow CHANGED
@@ -8,3 +8,5 @@
8
8
  declare export { default as createClient } from "./create-client";
9
9
  export type { APIGatewayHandlerClient } from "./create-client";
10
10
  declare export { default as createAPIGatewayEvent } from "./create-api-gateway-event";
11
+ declare export * from "./response";
12
+ declare export { default as parsePayload } from "./parse-payload";
@@ -1,4 +1,4 @@
1
- import type { Lambda } from "aws-sdk";
1
+ import type { Lambda } from "@aws-sdk/client-lambda";
2
2
  /**
3
3
  * This library only needs the invoke method from aws-sdk Lambda client.
4
4
  */
@@ -5,7 +5,7 @@
5
5
  * @flow
6
6
  */
7
7
 
8
- import type { Lambda } from "aws-sdk";
8
+ import type { Lambda } from "@aws-sdk/client-lambda";
9
9
 
10
10
  /**
11
11
  * This library only needs the invoke method from aws-sdk Lambda client.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cumulusds/aws-apig-bypass",
3
- "version": "1.1.0",
3
+ "version": "2.0.0-mflambda.1.g6c2a1d9",
4
4
  "description": "Client for API Gateway handlers, bypassing API Gateway by directly invoking the Lambda",
5
5
  "repository": "https://github.com/CumulusDS/aws-apig-bypass",
6
6
  "author": "Cumulus Digital Systems",
@@ -63,8 +63,7 @@
63
63
  }
64
64
  },
65
65
  "dependencies": {
66
- "aws-lambda": "^1.0.7",
67
- "aws-sdk": "^2.1460.0"
66
+ "@aws-sdk/client-lambda": "^3.806.0"
68
67
  },
69
68
  "devDependencies": {
70
69
  "@babel/cli": "^7.24.7",
@@ -75,8 +74,9 @@
75
74
  "@babel/preset-typescript": "^7.24.7",
76
75
  "@types/aws-lambda": "^8.10.145",
77
76
  "@types/jest": "^29.5.13",
78
- "@typescript-eslint/eslint-plugin": "^8.7.0",
79
- "@typescript-eslint/parser": "^8.7.0",
77
+ "@typescript-eslint/eslint-plugin": "^8.34.0",
78
+ "@typescript-eslint/parser": "^8.34.0",
79
+ "aws-lambda": "^1.0.7",
80
80
  "babel-eslint": "^10.1.0",
81
81
  "babel-jest": "^29.7.0",
82
82
  "eslint": "^8.57.1",
@@ -93,5 +93,6 @@
93
93
  "shx": "^0.3.2",
94
94
  "typescript": "^5.6.2"
95
95
  },
96
- "packageManager": "yarn@3.5.0"
96
+ "packageManager": "yarn@3.5.0",
97
+ "stableVersion": "2.0.0"
97
98
  }