@cumulusds/aws-apig-bypass 2.0.2 → 2.0.3

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.
Files changed (49) hide show
  1. package/lib/esm/create-api-gateway-event.d.ts +54 -0
  2. package/lib/esm/create-api-gateway-event.js +42 -0
  3. package/lib/esm/create-api-gateway-event.js.flow +65 -0
  4. package/lib/esm/create-client.d.ts +19 -0
  5. package/lib/esm/create-client.js +19 -0
  6. package/lib/esm/create-client.js.flow +31 -0
  7. package/lib/esm/create-lambda-client.d.ts +17 -0
  8. package/lib/esm/create-lambda-client.js +39 -0
  9. package/lib/esm/create-lambda-client.js.flow +26 -0
  10. package/lib/esm/index.d.ts +5 -0
  11. package/lib/esm/index.js +27 -0
  12. package/lib/esm/index.js.flow +12 -0
  13. package/lib/esm/json-stringify.d.ts +7 -0
  14. package/lib/esm/json-stringify.js +16 -0
  15. package/lib/esm/json-stringify.js.flow +13 -0
  16. package/lib/esm/lambda-invoke.d.ts +7 -0
  17. package/lib/esm/lambda-invoke.js +2 -0
  18. package/lib/esm/lambda-invoke.js.flow +16 -0
  19. package/lib/esm/parse-payload.d.ts +9 -0
  20. package/lib/esm/parse-payload.js +23 -0
  21. package/lib/esm/parse-payload.js.flow +25 -0
  22. package/lib/esm/response.d.ts +10 -0
  23. package/lib/esm/response.js +2 -0
  24. package/lib/esm/response.js.flow +18 -0
  25. package/package.json +43 -28
  26. /package/lib/{create-api-gateway-event.d.ts → cjs/create-api-gateway-event.d.ts} +0 -0
  27. /package/lib/{create-api-gateway-event.js → cjs/create-api-gateway-event.js} +0 -0
  28. /package/lib/{create-api-gateway-event.js.flow → cjs/create-api-gateway-event.js.flow} +0 -0
  29. /package/lib/{create-client.d.ts → cjs/create-client.d.ts} +0 -0
  30. /package/lib/{create-client.js → cjs/create-client.js} +0 -0
  31. /package/lib/{create-client.js.flow → cjs/create-client.js.flow} +0 -0
  32. /package/lib/{create-lambda-client.d.ts → cjs/create-lambda-client.d.ts} +0 -0
  33. /package/lib/{create-lambda-client.js → cjs/create-lambda-client.js} +0 -0
  34. /package/lib/{create-lambda-client.js.flow → cjs/create-lambda-client.js.flow} +0 -0
  35. /package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
  36. /package/lib/{index.js → cjs/index.js} +0 -0
  37. /package/lib/{index.js.flow → cjs/index.js.flow} +0 -0
  38. /package/lib/{json-stringify.d.ts → cjs/json-stringify.d.ts} +0 -0
  39. /package/lib/{json-stringify.js → cjs/json-stringify.js} +0 -0
  40. /package/lib/{json-stringify.js.flow → cjs/json-stringify.js.flow} +0 -0
  41. /package/lib/{lambda-invoke.d.ts → cjs/lambda-invoke.d.ts} +0 -0
  42. /package/lib/{lambda-invoke.js → cjs/lambda-invoke.js} +0 -0
  43. /package/lib/{lambda-invoke.js.flow → cjs/lambda-invoke.js.flow} +0 -0
  44. /package/lib/{parse-payload.d.ts → cjs/parse-payload.d.ts} +0 -0
  45. /package/lib/{parse-payload.js → cjs/parse-payload.js} +0 -0
  46. /package/lib/{parse-payload.js.flow → cjs/parse-payload.js.flow} +0 -0
  47. /package/lib/{response.d.ts → cjs/response.d.ts} +0 -0
  48. /package/lib/{response.js → cjs/response.js} +0 -0
  49. /package/lib/{response.js.flow → cjs/response.js.flow} +0 -0
@@ -0,0 +1,54 @@
1
+ import type { APIGatewayEvent } from "aws-lambda";
2
+ export type PathParameters = {
3
+ [name: string]: string;
4
+ } | null;
5
+ export type QueryStringParameters = {
6
+ [name: string]: string;
7
+ } | null;
8
+ declare const defaultRequestContext: {
9
+ accountId: string;
10
+ apiId: string;
11
+ httpMethod: string;
12
+ identity: {
13
+ accessKey: null;
14
+ accountId: null;
15
+ apiKey: null;
16
+ caller: null;
17
+ cognitoAuthenticationProvider: null;
18
+ cognitoAuthenticationType: null;
19
+ cognitoIdentityId: null;
20
+ cognitoIdentityPoolId: null;
21
+ sourceIp: string;
22
+ user: null;
23
+ userAgent: null;
24
+ userArn: null;
25
+ };
26
+ stage: string;
27
+ requestId: string;
28
+ resourceId: string;
29
+ resourcePath: string;
30
+ };
31
+ export type CreateAPIGatewayEventOptions = {
32
+ body?: string | null;
33
+ headers?: {
34
+ [name: string]: string;
35
+ };
36
+ multiValueHeaders?: {
37
+ [name: string]: string[];
38
+ };
39
+ httpMethod?: string;
40
+ isBase64Encoded?: boolean;
41
+ path?: string;
42
+ pathParameters?: PathParameters;
43
+ queryStringParameters?: QueryStringParameters;
44
+ multiValueQueryStringParameters?: {
45
+ [name: string]: string[];
46
+ };
47
+ stageVariables?: {
48
+ [name: string]: string;
49
+ };
50
+ requestContext?: typeof defaultRequestContext;
51
+ resource?: string;
52
+ };
53
+ export default function createAPIGatewayEvent({ body, headers, multiValueHeaders, httpMethod, isBase64Encoded, pathParameters, path, queryStringParameters, multiValueQueryStringParameters, stageVariables, requestContext, resource, }?: CreateAPIGatewayEventOptions): APIGatewayEvent;
54
+ export {};
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = createAPIGatewayEvent;
4
+ const defaultRequestContext = {
5
+ accountId: "",
6
+ apiId: "",
7
+ httpMethod: "",
8
+ identity: {
9
+ accessKey: null,
10
+ accountId: null,
11
+ apiKey: null,
12
+ caller: null,
13
+ cognitoAuthenticationProvider: null,
14
+ cognitoAuthenticationType: null,
15
+ cognitoIdentityId: null,
16
+ cognitoIdentityPoolId: null,
17
+ sourceIp: "",
18
+ user: null,
19
+ userAgent: null,
20
+ userArn: null,
21
+ },
22
+ stage: "",
23
+ requestId: "",
24
+ resourceId: "",
25
+ resourcePath: "",
26
+ };
27
+ function createAPIGatewayEvent({ body = null, headers = {}, multiValueHeaders = {}, httpMethod = "", isBase64Encoded = false, pathParameters = null, path = "", queryStringParameters = null, multiValueQueryStringParameters = {}, stageVariables = {}, requestContext = defaultRequestContext, resource = "", } = {}) {
28
+ return {
29
+ body,
30
+ headers,
31
+ multiValueHeaders,
32
+ httpMethod,
33
+ isBase64Encoded,
34
+ path,
35
+ pathParameters,
36
+ queryStringParameters,
37
+ multiValueQueryStringParameters,
38
+ stageVariables,
39
+ requestContext,
40
+ resource,
41
+ };
42
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Flowtype definitions for create-api-gateway-event
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+
8
+ import type { APIGatewayEvent } from "aws-lambda";
9
+ export type PathParameters = {
10
+ [name: string]: string,
11
+ } | null;
12
+ export type QueryStringParameters = {
13
+ [name: string]: string,
14
+ } | null;
15
+ declare var defaultRequestContext: {
16
+ accountId: string,
17
+ apiId: string,
18
+ httpMethod: string,
19
+ identity: {
20
+ accessKey: null,
21
+ accountId: null,
22
+ apiKey: null,
23
+ caller: null,
24
+ cognitoAuthenticationProvider: null,
25
+ cognitoAuthenticationType: null,
26
+ cognitoIdentityId: null,
27
+ cognitoIdentityPoolId: null,
28
+ sourceIp: string,
29
+ user: null,
30
+ userAgent: null,
31
+ userArn: null,
32
+ ...
33
+ },
34
+ stage: string,
35
+ requestId: string,
36
+ resourceId: string,
37
+ resourcePath: string,
38
+ ...
39
+ };
40
+ export type CreateAPIGatewayEventOptions = {
41
+ body?: string | null,
42
+ headers?: {
43
+ [name: string]: string,
44
+ },
45
+ multiValueHeaders?: {
46
+ [name: string]: string[],
47
+ },
48
+ httpMethod?: string,
49
+ isBase64Encoded?: boolean,
50
+ path?: string,
51
+ pathParameters?: PathParameters,
52
+ queryStringParameters?: QueryStringParameters,
53
+ multiValueQueryStringParameters?: {
54
+ [name: string]: string[],
55
+ },
56
+ stageVariables?: {
57
+ [name: string]: string,
58
+ },
59
+ requestContext?: typeof defaultRequestContext,
60
+ resource?: string,
61
+ ...
62
+ };
63
+ declare export default function createAPIGatewayEvent(
64
+ x?: CreateAPIGatewayEventOptions
65
+ ): APIGatewayEvent;
@@ -0,0 +1,19 @@
1
+ import type { APIGatewayEvent } from "aws-lambda";
2
+ import type { LambdaInvoke } from "./lambda-invoke";
3
+ import type { Response } from "./response";
4
+ /**
5
+ * Client that directly invokes an API Gateway handler, bypassing the gateway. The client handles packing and unpacking messages for invoking the handler.
6
+ */
7
+ export type APIGatewayHandlerClient<T> = (event: APIGatewayEvent) => Promise<Response<T>>;
8
+ export type CreateClientOptions<T> = {
9
+ Lambda: LambdaInvoke;
10
+ FunctionName: string;
11
+ Validate?: (arg1: T) => void;
12
+ };
13
+ /**
14
+ * Create an APIGatewayHandlerClient. The client invokes an API Gateway handler, bypassing the gateway. It adapts the AWS SDK by packing and unpacking messages for invoking the handler.
15
+ *
16
+ * @param options
17
+ * @returns {APIGatewayHandlerClient<T>}
18
+ */
19
+ export default function createClient<T>(options: CreateClientOptions<T>): APIGatewayHandlerClient<T>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = createClient;
7
+ const create_lambda_client_1 = __importDefault(require("./create-lambda-client"));
8
+ const json_stringify_1 = __importDefault(require("./json-stringify"));
9
+ const parse_payload_1 = __importDefault(require("./parse-payload"));
10
+ /**
11
+ * Create an APIGatewayHandlerClient. The client invokes an API Gateway handler, bypassing the gateway. It adapts the AWS SDK by packing and unpacking messages for invoking the handler.
12
+ *
13
+ * @param options
14
+ * @returns {APIGatewayHandlerClient<T>}
15
+ */
16
+ function createClient(options) {
17
+ const client = (0, create_lambda_client_1.default)(options);
18
+ return async (event) => (0, parse_payload_1.default)(await client((0, json_stringify_1.default)(event)));
19
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Flowtype definitions for create-client
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+
8
+ import type { APIGatewayEvent } from "aws-lambda";
9
+ import type { LambdaInvoke } from "./lambda-invoke";
10
+ import type { Response } from "./response";
11
+
12
+ /**
13
+ * Client that directly invokes an API Gateway handler, bypassing the gateway. The client handles packing and unpacking messages for invoking the handler.
14
+ */
15
+ export type APIGatewayHandlerClient<T> = (
16
+ event: APIGatewayEvent
17
+ ) => Promise<Response<T>>;
18
+ export type CreateClientOptions<T> = {
19
+ Lambda: LambdaInvoke,
20
+ FunctionName: string,
21
+ Validate?: (arg1: T) => void,
22
+ ...
23
+ };
24
+ /**
25
+ * Create an APIGatewayHandlerClient. The client invokes an API Gateway handler, bypassing the gateway. It adapts the AWS SDK by packing and unpacking messages for invoking the handler.
26
+ * @param options
27
+ * @returns {APIGatewayHandlerClient<T>}
28
+ */
29
+ declare export default function createClient<T>(
30
+ options: CreateClientOptions<T>
31
+ ): APIGatewayHandlerClient<T>;
@@ -0,0 +1,17 @@
1
+ import type { InvocationResponse } from "@aws-sdk/client-lambda";
2
+ import type { LambdaInvoke } from "./lambda-invoke";
3
+ type _Blob = Buffer | Uint8Array | Blob | string;
4
+ type LambdaClientType = (event: _Blob) => Promise<string>;
5
+ export type CreateLambdaClientOptions = {
6
+ Lambda: LambdaInvoke;
7
+ FunctionName: string;
8
+ };
9
+ export declare class LambdaInvokeError extends Error {
10
+ code: string;
11
+ constructor(response: InvocationResponse);
12
+ }
13
+ /**
14
+ * AWS Lambda SDK adapter for createClient.
15
+ */
16
+ export default function createLambdaClient({ Lambda: LambdaShadow, FunctionName, }: CreateLambdaClientOptions): LambdaClientType;
17
+ export {};
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LambdaInvokeError = void 0;
4
+ exports.default = createLambdaClient;
5
+ class LambdaInvokeError extends Error {
6
+ code;
7
+ constructor(response) {
8
+ super([
9
+ "Invocation Failed",
10
+ response.ExecutedVersion,
11
+ response.StatusCode,
12
+ response.FunctionError,
13
+ response.Payload,
14
+ response.LogResult != null ? Buffer.from(response.LogResult, "base64").toString("utf-8") : null,
15
+ ]
16
+ .filter((x) => x != null)
17
+ .join(": "));
18
+ this.code = response.FunctionError ?? "";
19
+ }
20
+ }
21
+ exports.LambdaInvokeError = LambdaInvokeError;
22
+ /**
23
+ * AWS Lambda SDK adapter for createClient.
24
+ */
25
+ function createLambdaClient({ Lambda: LambdaShadow, FunctionName, }) {
26
+ return async (Payload) => {
27
+ const invocationResponse = await LambdaShadow.invoke({
28
+ FunctionName,
29
+ Payload,
30
+ });
31
+ if (invocationResponse.StatusCode !== 200 || invocationResponse.FunctionError != null) {
32
+ throw new LambdaInvokeError(invocationResponse);
33
+ }
34
+ if (!invocationResponse.Payload) {
35
+ throw new Error(`AWS Lambda invocation API returned the wrong payload type '${typeof invocationResponse.Payload}';`);
36
+ }
37
+ return Buffer.from(invocationResponse.Payload).toString();
38
+ };
39
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Flowtype definitions for create-lambda-client
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+
8
+ import type { InvocationResponse } from "@aws-sdk/client-lambda";
9
+ import type { LambdaInvoke } from "./lambda-invoke";
10
+ declare type _Blob = Buffer | Uint8Array | Blob | string;
11
+ declare type LambdaClientType = (event: _Blob) => Promise<string>;
12
+ export type CreateLambdaClientOptions = {
13
+ Lambda: LambdaInvoke,
14
+ FunctionName: string,
15
+ ...
16
+ };
17
+ declare export class LambdaInvokeError mixins Error {
18
+ code: string;
19
+ constructor(response: InvocationResponse): this;
20
+ }
21
+ /**
22
+ * AWS Lambda SDK adapter for createClient.
23
+ */
24
+ declare export default function createLambdaClient(
25
+ x: CreateLambdaClientOptions
26
+ ): LambdaClientType;
@@ -0,0 +1,5 @@
1
+ export { default as createClient } from "./create-client";
2
+ export type { APIGatewayHandlerClient } from "./create-client";
3
+ export { default as createAPIGatewayEvent } from "./create-api-gateway-event";
4
+ export * from "./response";
5
+ export { default as parsePayload } from "./parse-payload";
@@ -0,0 +1,27 @@
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
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.parsePayload = exports.createAPIGatewayEvent = exports.createClient = void 0;
21
+ var create_client_1 = require("./create-client");
22
+ Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return __importDefault(create_client_1).default; } });
23
+ var create_api_gateway_event_1 = require("./create-api-gateway-event");
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; } });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Flowtype definitions for index
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+
8
+ declare export { default as createClient } from "./create-client";
9
+ export type { APIGatewayHandlerClient } from "./create-client";
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";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Stringify to JSON, returning a string or else throwing an exception because of unserializable input.
3
+ *
4
+ * @param value
5
+ * @returns {string}
6
+ */
7
+ export default function jsonStringify(value: unknown): string;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = jsonStringify;
4
+ /**
5
+ * Stringify to JSON, returning a string or else throwing an exception because of unserializable input.
6
+ *
7
+ * @param value
8
+ * @returns {string}
9
+ */
10
+ function jsonStringify(value) {
11
+ const result = JSON.stringify(value);
12
+ if (result == null) {
13
+ throw new Error("Cannot stringify value");
14
+ }
15
+ return result;
16
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Flowtype definitions for json-stringify
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+
8
+ /**
9
+ * Stringify to JSON, returning a string or else throwing an exception because of unserializable input.
10
+ * @param value
11
+ * @returns {string}
12
+ */
13
+ declare export default function jsonStringify(value: mixed): string;
@@ -0,0 +1,7 @@
1
+ import type { Lambda } from "@aws-sdk/client-lambda";
2
+ /**
3
+ * This library only needs the invoke method from aws-sdk Lambda client.
4
+ */
5
+ export type LambdaInvoke = {
6
+ readonly invoke: Lambda["invoke"];
7
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Flowtype definitions for lambda-invoke
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+
8
+ import type { Lambda } from "@aws-sdk/client-lambda";
9
+
10
+ /**
11
+ * This library only needs the invoke method from aws-sdk Lambda client.
12
+ */
13
+ export type LambdaInvoke = {
14
+ +invoke: $PropertyType<Lambda, "invoke">,
15
+ ...
16
+ };
@@ -0,0 +1,9 @@
1
+ import type { Response } from "./response";
2
+ /**
3
+ * Decode the handler response
4
+ *
5
+ * @param payload
6
+ * @param validate if given, the validate function is called on the parsed response body. The function should throw an exception if the response is invalid.
7
+ * @returns {{headers: {[p: string]: boolean|number|string}, data: *, status: number}}
8
+ */
9
+ export default function parsePayload<T>(payload: string, validate?: (arg1: T) => void): Response<T>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = parsePayload;
4
+ /**
5
+ * Decode the handler response
6
+ *
7
+ * @param payload
8
+ * @param validate if given, the validate function is called on the parsed response body. The function should throw an exception if the response is invalid.
9
+ * @returns {{headers: {[p: string]: boolean|number|string}, data: *, status: number}}
10
+ */
11
+ function parsePayload(payload, validate) {
12
+ const proxyResult = JSON.parse(payload);
13
+ if (proxyResult.isBase64Encoded === true) {
14
+ throw new Error("A base64 encoded response from API Gateway handler was received, but is not supported.");
15
+ }
16
+ const data = JSON.parse(proxyResult.body);
17
+ validate?.(data);
18
+ return {
19
+ data,
20
+ status: proxyResult.statusCode,
21
+ headers: proxyResult.headers ?? {},
22
+ };
23
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Flowtype definitions for parse-payload
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+
8
+ import type { Response } from "./response";
9
+
10
+ /**
11
+ * Decode the handler response
12
+ * @param payload
13
+ * @param validate if given, the validate function is called on the parsed response body. The function should throw an exception if the response is invalid.
14
+ * @returns {{
15
+ headers: {
16
+ [p: string]: boolean | number | string,
17
+ },
18
+ data: *,
19
+ status: number,...
20
+ }}
21
+ */
22
+ declare export default function parsePayload<T>(
23
+ payload: string,
24
+ validate?: (arg1: T) => void
25
+ ): Response<T>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Decoded handler response
3
+ */
4
+ export type Response<T> = {
5
+ data: T;
6
+ status: number;
7
+ headers: {
8
+ [header: string]: boolean | number | string;
9
+ };
10
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Flowtype definitions for response
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+
8
+ /**
9
+ * Decoded handler response
10
+ */
11
+ export type Response<T> = {
12
+ data: T,
13
+ status: number,
14
+ headers: {
15
+ [header: string]: boolean | number | string,
16
+ },
17
+ ...
18
+ };
package/package.json CHANGED
@@ -1,21 +1,33 @@
1
1
  {
2
2
  "name": "@cumulusds/aws-apig-bypass",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
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",
7
7
  "license": "MIT",
8
8
  "engines": {
9
- "node": "^18.0.0 || ^20.0.0 || >=21.0.0"
9
+ "node": ">=24.0.0"
10
10
  },
11
- "main": "lib/index.js",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./lib/esm/index.js",
14
+ "require": "./lib/cjs/index.js"
15
+ }
16
+ },
17
+ "main": "lib/cjs/index.js",
18
+ "module": "lib/esm/index.js",
12
19
  "files": [
13
20
  "README.md",
14
21
  "lib/*",
22
+ "lib/cjs/*",
23
+ "lib/esm/*",
15
24
  "package.json"
16
25
  ],
17
26
  "scripts": {
18
- "build": "yarn run build:license-checker && tsc",
27
+ "build": "yarn run build:license-checker && yarn build:all",
28
+ "build:all": "yarn build:cjs && yarn build:esm",
29
+ "build:cjs": "tsc -p tsconfig.json",
30
+ "build:esm": "tsc -p tsconfig.esm.json",
19
31
  "build:flowtypes": "find lib -type f -name '*.d.ts' -exec sh -c 'yarn flowgen --add-flow-header $1 -o ${1%.*.*}.js.flow' _ '{}' \\;",
20
32
  "build:license-checker": "license-checker --csv --out var/licenses.csv",
21
33
  "clean": "shx rm -rf lib",
@@ -34,7 +46,7 @@
34
46
  "publish:prepatch": "yarn run version:prepatch && yarn run git:push",
35
47
  "publish:prerelease": "yarn npm publish",
36
48
  "publish:sync": "yarn run git:commit && yarn run git:tag && yarn git:push",
37
- "test": "yarn run test:jest && yarn run test:lint && yarn run test:prettier",
49
+ "test": "yarn typecheck && yarn run test:jest && yarn run test:lint && yarn run test:prettier",
38
50
  "test:jest": "jest --color",
39
51
  "test:lint": "eslint src/**/*.ts test/**/*.ts",
40
52
  "test:prettier": "prettier --list-different \"{src,test}/**/*.ts\"",
@@ -43,7 +55,10 @@
43
55
  "version:major": "yarn version --new-version major",
44
56
  "version:feature": "yarn version ${npm_package_version}-$0.$(git describe | rev | cut -d '-' -f 2 | rev).g$(git rev-parse --short HEAD)",
45
57
  "version:prepatch": "yarn version --new-version prepatch",
46
- "version:prerelease": "yarn version ${npm_package_version}"
58
+ "version:prerelease": "yarn version ${npm_package_version}",
59
+ "typecheck": "yarn typecheck:cjs && yarn typecheck:esm",
60
+ "typecheck:cjs": "tsc -p tsconfig.json --noEmit",
61
+ "typecheck:esm": "tsc -p tsconfig.esm.json --noEmit"
47
62
  },
48
63
  "jest": {
49
64
  "verbose": true,
@@ -63,35 +78,35 @@
63
78
  }
64
79
  },
65
80
  "dependencies": {
66
- "@aws-sdk/client-lambda": "^3.806.0"
81
+ "@aws-sdk/client-lambda": "^3.994.0"
67
82
  },
68
83
  "devDependencies": {
69
- "@babel/cli": "^7.24.7",
70
- "@babel/core": "^7.7.4",
71
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4",
72
- "@babel/plugin-proposal-optional-chaining": "^7.12.7",
73
- "@babel/preset-env": "^7.0.0",
74
- "@babel/preset-typescript": "^7.24.7",
75
- "@types/aws-lambda": "^8.10.145",
76
- "@types/jest": "^29.5.13",
77
- "@typescript-eslint/eslint-plugin": "^8.34.0",
78
- "@typescript-eslint/parser": "^8.34.0",
84
+ "@babel/cli": "^7.28.6",
85
+ "@babel/core": "^7.29.0",
86
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
87
+ "@babel/plugin-proposal-optional-chaining": "^7.21.0",
88
+ "@babel/preset-env": "^7.29.0",
89
+ "@babel/preset-typescript": "^7.28.5",
90
+ "@types/aws-lambda": "^8.10.160",
91
+ "@types/jest": "^30.0.0",
92
+ "@typescript-eslint/eslint-plugin": "^8.56.0",
93
+ "@typescript-eslint/parser": "^8.56.0",
79
94
  "aws-lambda": "^1.0.7",
80
95
  "babel-eslint": "^10.1.0",
81
- "babel-jest": "^29.7.0",
96
+ "babel-jest": "^30.2.0",
82
97
  "eslint": "^8.57.1",
83
- "eslint-config-airbnb-base": "14.0.0",
84
- "eslint-config-prettier": "^8.10.0",
85
- "eslint-plugin-import": "^2.18.2",
86
- "eslint-plugin-jest": "^28.8.3",
87
- "eslint-plugin-prettier": "^5.2.1",
98
+ "eslint-config-airbnb-base": "14.2.1",
99
+ "eslint-config-prettier": "^8.10.2",
100
+ "eslint-plugin-import": "^2.32.0",
101
+ "eslint-plugin-jest": "^28.14.0",
102
+ "eslint-plugin-prettier": "^5.5.5",
88
103
  "flowgen": "^1.21.0",
89
- "git-describe": "^4.0.4",
90
- "jest": "^29.7.0",
104
+ "git-describe": "^4.1.1",
105
+ "jest": "^30.2.0",
91
106
  "license-checker": "^25.0.1",
92
- "prettier": "^3.3.3",
93
- "shx": "^0.3.2",
94
- "typescript": "^5.6.2"
107
+ "prettier": "^3.8.1",
108
+ "shx": "^0.4.0",
109
+ "typescript": "^5.9.3"
95
110
  },
96
111
  "packageManager": "yarn@3.5.0"
97
112
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes