@cumulusds/aws-apig-bypass 0.0.1 → 0.2.0

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.
@@ -49,7 +49,7 @@ jobs:
49
49
  SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
50
50
  if: always()
51
51
  - name: Upload artifacts
52
- uses: actions/upload-artifact@v2.2.1
52
+ uses: actions/upload-artifact@v2.2.2
53
53
  with:
54
54
  name: var
55
55
  path: var
@@ -4,47 +4,56 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = createAPIGatewayEvent;
7
+ const defaultRequestContext = {
8
+ accountId: "",
9
+ apiId: "",
10
+ httpMethod: "",
11
+ identity: {
12
+ accessKey: null,
13
+ accountId: null,
14
+ apiKey: null,
15
+ caller: null,
16
+ cognitoAuthenticationProvider: null,
17
+ cognitoAuthenticationType: null,
18
+ cognitoIdentityId: null,
19
+ cognitoIdentityPoolId: null,
20
+ sourceIp: "",
21
+ user: null,
22
+ userAgent: null,
23
+ userArn: null
24
+ },
25
+ stage: "",
26
+ requestId: "",
27
+ resourceId: "",
28
+ resourcePath: ""
29
+ };
7
30
 
8
31
  function createAPIGatewayEvent({
32
+ body = null,
33
+ headers = {},
34
+ multiValueHeaders = {},
35
+ httpMethod = "",
36
+ isBase64Encoded = false,
9
37
  pathParameters = null,
10
38
  path = "",
11
- body = null,
12
- queryStringParameters = null
39
+ queryStringParameters = null,
40
+ multiValueQueryStringParameters = null,
41
+ stageVariables = null,
42
+ requestContext = defaultRequestContext,
43
+ resource = ""
13
44
  } = {}) {
14
45
  return {
15
46
  body,
16
- headers: {},
17
- multiValueHeaders: {},
18
- httpMethod: "",
19
- isBase64Encoded: false,
47
+ headers,
48
+ multiValueHeaders,
49
+ httpMethod,
50
+ isBase64Encoded,
20
51
  path,
21
52
  pathParameters,
22
53
  queryStringParameters,
23
- multiValueQueryStringParameters: null,
24
- stageVariables: null,
25
- requestContext: {
26
- accountId: "",
27
- apiId: "",
28
- httpMethod: "",
29
- identity: {
30
- accessKey: null,
31
- accountId: null,
32
- apiKey: null,
33
- caller: null,
34
- cognitoAuthenticationProvider: null,
35
- cognitoAuthenticationType: null,
36
- cognitoIdentityId: null,
37
- cognitoIdentityPoolId: null,
38
- sourceIp: "",
39
- user: null,
40
- userAgent: null,
41
- userArn: null
42
- },
43
- stage: "",
44
- requestId: "",
45
- resourceId: "",
46
- resourcePath: ""
47
- },
48
- resource: ""
54
+ multiValueQueryStringParameters,
55
+ stageVariables,
56
+ requestContext,
57
+ resource
49
58
  };
50
59
  }
@@ -5,53 +5,71 @@ import type { APIGatewayEvent } from "flow-aws-lambda";
5
5
  export type PathParameters = { [name: string]: string } | null;
6
6
  export type QueryStringParameters = { [name: string]: string } | null;
7
7
 
8
+ const defaultRequestContext = {
9
+ accountId: "",
10
+ apiId: "",
11
+ httpMethod: "",
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: "",
22
+ user: null,
23
+ userAgent: null,
24
+ userArn: null
25
+ },
26
+ stage: "",
27
+ requestId: "",
28
+ resourceId: "",
29
+ resourcePath: ""
30
+ };
31
+
8
32
  export type CreateAPIGatewayEventOptions = {
9
33
  body?: string,
34
+ headers?: { [name: string]: string },
35
+ multiValueHeaders?: { [name: string]: string[] },
36
+ httpMethod?: string,
37
+ isBase64Encoded?: boolean,
10
38
  path?: string,
11
39
  pathParameters?: PathParameters,
12
- queryStringParameters?: QueryStringParameters
40
+ queryStringParameters?: QueryStringParameters,
41
+ multiValueQueryStringParameters?: { [name: string]: string[] },
42
+ stageVariables?: { [name: string]: string },
43
+ requestContext?: typeof defaultRequestContext,
44
+ resource?: string
13
45
  };
14
46
 
15
47
  export default function createAPIGatewayEvent({
48
+ body = null,
49
+ headers = {},
50
+ multiValueHeaders = {},
51
+ httpMethod = "",
52
+ isBase64Encoded = false,
16
53
  pathParameters = null,
17
54
  path = "",
18
- body = null,
19
- queryStringParameters = null
55
+ queryStringParameters = null,
56
+ multiValueQueryStringParameters = null,
57
+ stageVariables = null,
58
+ requestContext = defaultRequestContext,
59
+ resource = ""
20
60
  }: CreateAPIGatewayEventOptions = {}): APIGatewayEvent<string> {
21
61
  return {
22
62
  body,
23
- headers: {},
24
- multiValueHeaders: {},
25
- httpMethod: "",
26
- isBase64Encoded: false,
63
+ headers,
64
+ multiValueHeaders,
65
+ httpMethod,
66
+ isBase64Encoded,
27
67
  path,
28
68
  pathParameters,
29
69
  queryStringParameters,
30
- multiValueQueryStringParameters: null,
31
- stageVariables: null,
32
- requestContext: {
33
- accountId: "",
34
- apiId: "",
35
- httpMethod: "",
36
- identity: {
37
- accessKey: null,
38
- accountId: null,
39
- apiKey: null,
40
- caller: null,
41
- cognitoAuthenticationProvider: null,
42
- cognitoAuthenticationType: null,
43
- cognitoIdentityId: null,
44
- cognitoIdentityPoolId: null,
45
- sourceIp: "",
46
- user: null,
47
- userAgent: null,
48
- userArn: null
49
- },
50
- stage: "",
51
- requestId: "",
52
- resourceId: "",
53
- resourcePath: ""
54
- },
55
- resource: ""
70
+ multiValueQueryStringParameters,
71
+ stageVariables,
72
+ requestContext,
73
+ resource
56
74
  };
57
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cumulusds/aws-apig-bypass",
3
- "version": "0.0.1",
3
+ "version": "0.2.0",
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",
@@ -5,53 +5,71 @@ import type { APIGatewayEvent } from "flow-aws-lambda";
5
5
  export type PathParameters = { [name: string]: string } | null;
6
6
  export type QueryStringParameters = { [name: string]: string } | null;
7
7
 
8
+ const defaultRequestContext = {
9
+ accountId: "",
10
+ apiId: "",
11
+ httpMethod: "",
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: "",
22
+ user: null,
23
+ userAgent: null,
24
+ userArn: null
25
+ },
26
+ stage: "",
27
+ requestId: "",
28
+ resourceId: "",
29
+ resourcePath: ""
30
+ };
31
+
8
32
  export type CreateAPIGatewayEventOptions = {
9
33
  body?: string,
34
+ headers?: { [name: string]: string },
35
+ multiValueHeaders?: { [name: string]: string[] },
36
+ httpMethod?: string,
37
+ isBase64Encoded?: boolean,
10
38
  path?: string,
11
39
  pathParameters?: PathParameters,
12
- queryStringParameters?: QueryStringParameters
40
+ queryStringParameters?: QueryStringParameters,
41
+ multiValueQueryStringParameters?: { [name: string]: string[] },
42
+ stageVariables?: { [name: string]: string },
43
+ requestContext?: typeof defaultRequestContext,
44
+ resource?: string
13
45
  };
14
46
 
15
47
  export default function createAPIGatewayEvent({
48
+ body = null,
49
+ headers = {},
50
+ multiValueHeaders = {},
51
+ httpMethod = "",
52
+ isBase64Encoded = false,
16
53
  pathParameters = null,
17
54
  path = "",
18
- body = null,
19
- queryStringParameters = null
55
+ queryStringParameters = null,
56
+ multiValueQueryStringParameters = null,
57
+ stageVariables = null,
58
+ requestContext = defaultRequestContext,
59
+ resource = ""
20
60
  }: CreateAPIGatewayEventOptions = {}): APIGatewayEvent<string> {
21
61
  return {
22
62
  body,
23
- headers: {},
24
- multiValueHeaders: {},
25
- httpMethod: "",
26
- isBase64Encoded: false,
63
+ headers,
64
+ multiValueHeaders,
65
+ httpMethod,
66
+ isBase64Encoded,
27
67
  path,
28
68
  pathParameters,
29
69
  queryStringParameters,
30
- multiValueQueryStringParameters: null,
31
- stageVariables: null,
32
- requestContext: {
33
- accountId: "",
34
- apiId: "",
35
- httpMethod: "",
36
- identity: {
37
- accessKey: null,
38
- accountId: null,
39
- apiKey: null,
40
- caller: null,
41
- cognitoAuthenticationProvider: null,
42
- cognitoAuthenticationType: null,
43
- cognitoIdentityId: null,
44
- cognitoIdentityPoolId: null,
45
- sourceIp: "",
46
- user: null,
47
- userAgent: null,
48
- userArn: null
49
- },
50
- stage: "",
51
- requestId: "",
52
- resourceId: "",
53
- resourcePath: ""
54
- },
55
- resource: ""
70
+ multiValueQueryStringParameters,
71
+ stageVariables,
72
+ requestContext,
73
+ resource
56
74
  };
57
75
  }