@cumulusds/aws-apig-bypass 2.0.1 → 2.0.2-master.4.g85ce2fc

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.
@@ -6,28 +6,6 @@ export type CreateLambdaClientOptions = {
6
6
  Lambda: LambdaInvoke;
7
7
  FunctionName: string;
8
8
  };
9
- export type Lambda$InvocationResponse = {
10
- /**
11
- * The HTTP status code is in the 200 range for a successful request. For the RequestResponse invocation type, this status code is 200. For the Event invocation type, this status code is 202. For the DryRun invocation type, the status code is 204.
12
- */
13
- StatusCode?: number;
14
- /**
15
- * If present, indicates that an error occurred during function execution. Details about the error are included in the response payload.
16
- */
17
- FunctionError?: string;
18
- /**
19
- * The last 4 KB of the execution log, which is base64 encoded.
20
- */
21
- LogResult?: string;
22
- /**
23
- * The response from the function, or an error object.
24
- */
25
- Payload?: Buffer | Uint8Array | Blob | string;
26
- /**
27
- * The version of the function that executed. When you invoke a function with an alias, this indicates which version the alias resolved to.
28
- */
29
- ExecutedVersion?: string;
30
- };
31
9
  export declare class LambdaInvokeError extends Error {
32
10
  code: string;
33
11
  constructor(response: InvocationResponse);
@@ -31,10 +31,9 @@ function createLambdaClient({ Lambda: LambdaShadow, FunctionName, }) {
31
31
  if (invocationResponse.StatusCode !== 200 || invocationResponse.FunctionError != null) {
32
32
  throw new LambdaInvokeError(invocationResponse);
33
33
  }
34
- const payload = invocationResponse.Payload?.toString();
35
- if (typeof payload !== "string") {
36
- throw new Error(`AWS Lambda invocation API returned the wrong payload type '${typeof invocationResponse.Payload}'; expected 'string'`);
34
+ if (!invocationResponse.Payload) {
35
+ throw new Error(`AWS Lambda invocation API returned the wrong payload type '${typeof invocationResponse.Payload}';`);
37
36
  }
38
- return payload;
37
+ return Buffer.from(invocationResponse.Payload).toString();
39
38
  };
40
39
  }
@@ -14,33 +14,6 @@ export type CreateLambdaClientOptions = {
14
14
  FunctionName: string,
15
15
  ...
16
16
  };
17
- export type Lambda$InvocationResponse = {
18
- /**
19
- * The HTTP status code is in the 200 range for a successful request. For the RequestResponse invocation type, this status code is 200. For the Event invocation type, this status code is 202. For the DryRun invocation type, the status code is 204.
20
- */
21
- StatusCode?: number,
22
-
23
- /**
24
- * If present, indicates that an error occurred during function execution. Details about the error are included in the response payload.
25
- */
26
- FunctionError?: string,
27
-
28
- /**
29
- * The last 4 KB of the execution log, which is base64 encoded.
30
- */
31
- LogResult?: string,
32
-
33
- /**
34
- * The response from the function, or an error object.
35
- */
36
- Payload?: Buffer | Uint8Array | Blob | string,
37
-
38
- /**
39
- * The version of the function that executed. When you invoke a function with an alias, this indicates which version the alias resolved to.
40
- */
41
- ExecutedVersion?: string,
42
- ...
43
- };
44
17
  declare export class LambdaInvokeError mixins Error {
45
18
  code: string;
46
19
  constructor(response: InvocationResponse): this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cumulusds/aws-apig-bypass",
3
- "version": "2.0.1",
3
+ "version": "2.0.2-master.4.g85ce2fc",
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",
@@ -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.2"
97
98
  }