cdk-drizzle-migrate 0.0.9

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 (76) hide show
  1. package/.jsii +4136 -0
  2. package/.jsiiignore +0 -0
  3. package/API.md +249 -0
  4. package/LICENSE +202 -0
  5. package/README.md +115 -0
  6. package/lib/drizzle-migrate-provider.d.ts +58 -0
  7. package/lib/drizzle-migrate-provider.js +95 -0
  8. package/lib/handler/handler.js +49302 -0
  9. package/lib/handler/index.d.ts +8 -0
  10. package/lib/handler/index.js +8 -0
  11. package/lib/index.d.ts +1 -0
  12. package/lib/index.js +18 -0
  13. package/node_modules/@types/aws-lambda/LICENSE +21 -0
  14. package/node_modules/@types/aws-lambda/README.md +15 -0
  15. package/node_modules/@types/aws-lambda/common/api-gateway.d.ts +83 -0
  16. package/node_modules/@types/aws-lambda/common/cloudfront.d.ts +245 -0
  17. package/node_modules/@types/aws-lambda/handler.d.ts +172 -0
  18. package/node_modules/@types/aws-lambda/index.d.ts +54 -0
  19. package/node_modules/@types/aws-lambda/package.json +226 -0
  20. package/node_modules/@types/aws-lambda/trigger/alb.d.ts +48 -0
  21. package/node_modules/@types/aws-lambda/trigger/amplify-resolver.d.ts +38 -0
  22. package/node_modules/@types/aws-lambda/trigger/api-gateway-authorizer.d.ts +246 -0
  23. package/node_modules/@types/aws-lambda/trigger/api-gateway-proxy.d.ts +336 -0
  24. package/node_modules/@types/aws-lambda/trigger/appsync-resolver.d.ts +121 -0
  25. package/node_modules/@types/aws-lambda/trigger/autoscaling.d.ts +41 -0
  26. package/node_modules/@types/aws-lambda/trigger/cdk-custom-resource.d.ts +158 -0
  27. package/node_modules/@types/aws-lambda/trigger/cloudformation-custom-resource.d.ts +236 -0
  28. package/node_modules/@types/aws-lambda/trigger/cloudfront-request.d.ts +22 -0
  29. package/node_modules/@types/aws-lambda/trigger/cloudfront-response.d.ts +21 -0
  30. package/node_modules/@types/aws-lambda/trigger/cloudwatch-alarm.d.ts +69 -0
  31. package/node_modules/@types/aws-lambda/trigger/cloudwatch-events.d.ts +8 -0
  32. package/node_modules/@types/aws-lambda/trigger/cloudwatch-logs.d.ts +37 -0
  33. package/node_modules/@types/aws-lambda/trigger/codebuild-cloudwatch-state.d.ts +104 -0
  34. package/node_modules/@types/aws-lambda/trigger/codecommit.d.ts +35 -0
  35. package/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-action.d.ts +31 -0
  36. package/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-pipeline.d.ts +32 -0
  37. package/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-stage.d.ts +23 -0
  38. package/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch.d.ts +11 -0
  39. package/node_modules/@types/aws-lambda/trigger/codepipeline.d.ts +55 -0
  40. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/_common.d.ts +41 -0
  41. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/create-auth-challenge.d.ts +22 -0
  42. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-email-sender.d.ts +76 -0
  43. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-message.d.ts +52 -0
  44. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-sms-sender.d.ts +51 -0
  45. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/define-auth-challenge.d.ts +21 -0
  46. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/index.d.ts +128 -0
  47. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/post-authentication.d.ts +15 -0
  48. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/post-confirmation.d.ts +26 -0
  49. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-authentication.d.ts +16 -0
  50. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-signup.d.ts +31 -0
  51. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-token-generation-v2.d.ts +73 -0
  52. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-token-generation.d.ts +53 -0
  53. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/user-migration.d.ts +40 -0
  54. package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/verify-auth-challenge-response.d.ts +22 -0
  55. package/node_modules/@types/aws-lambda/trigger/connect-contact-flow.d.ts +64 -0
  56. package/node_modules/@types/aws-lambda/trigger/dynamodb-stream.d.ts +55 -0
  57. package/node_modules/@types/aws-lambda/trigger/eventbridge.d.ts +19 -0
  58. package/node_modules/@types/aws-lambda/trigger/guard-duty-event-notification.d.ts +36 -0
  59. package/node_modules/@types/aws-lambda/trigger/iot-authorizer.d.ts +48 -0
  60. package/node_modules/@types/aws-lambda/trigger/iot.d.ts +28 -0
  61. package/node_modules/@types/aws-lambda/trigger/kinesis-firehose-transformation.d.ts +51 -0
  62. package/node_modules/@types/aws-lambda/trigger/kinesis-stream.d.ts +56 -0
  63. package/node_modules/@types/aws-lambda/trigger/lambda-function-url.d.ts +45 -0
  64. package/node_modules/@types/aws-lambda/trigger/lex-v2.d.ts +164 -0
  65. package/node_modules/@types/aws-lambda/trigger/lex.d.ts +120 -0
  66. package/node_modules/@types/aws-lambda/trigger/msk.d.ts +28 -0
  67. package/node_modules/@types/aws-lambda/trigger/s3-batch.d.ts +41 -0
  68. package/node_modules/@types/aws-lambda/trigger/s3-event-notification.d.ts +290 -0
  69. package/node_modules/@types/aws-lambda/trigger/s3.d.ts +60 -0
  70. package/node_modules/@types/aws-lambda/trigger/secretsmanager.d.ts +15 -0
  71. package/node_modules/@types/aws-lambda/trigger/self-managed-kafka.d.ts +27 -0
  72. package/node_modules/@types/aws-lambda/trigger/ses.d.ts +109 -0
  73. package/node_modules/@types/aws-lambda/trigger/sns.d.ts +39 -0
  74. package/node_modules/@types/aws-lambda/trigger/sqs.d.ts +58 -0
  75. package/node_modules/@types/aws-lambda/trigger/transfer-family-authorizer.d.ts +110 -0
  76. package/package.json +165 -0
@@ -0,0 +1,8 @@
1
+ import { CloudFormationCustomResourceEvent } from "aws-lambda";
2
+ interface CustomResourceResponse {
3
+ PhysicalResourceId?: string;
4
+ Data?: any;
5
+ NoEcho?: boolean;
6
+ }
7
+ export declare function handler(event: CloudFormationCustomResourceEvent): Promise<CustomResourceResponse>;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handler = handler;
4
+ const handler_js_1 = require("./handler.js");
5
+ async function handler(event) {
6
+ return (0, handler_js_1.onEvent)(event);
7
+ }
8
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaGFuZGxlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQVNBLDBCQUlDO0FBWkQsNkNBQXNDO0FBUS9CLEtBQUssVUFBVSxPQUFPLENBQzNCLEtBQXdDO0lBRXhDLE9BQU8sSUFBQSxvQkFBTyxFQUFDLEtBQUssQ0FBQyxDQUFBO0FBQ3ZCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBDbG91ZEZvcm1hdGlvbkN1c3RvbVJlc291cmNlRXZlbnQgfSBmcm9tIFwiYXdzLWxhbWJkYVwiXG5pbXBvcnQgeyBvbkV2ZW50IH0gZnJvbSBcIi4vaGFuZGxlci5qc1wiXG5cbmludGVyZmFjZSBDdXN0b21SZXNvdXJjZVJlc3BvbnNlIHtcbiAgUGh5c2ljYWxSZXNvdXJjZUlkPzogc3RyaW5nXG4gIERhdGE/OiBhbnlcbiAgTm9FY2hvPzogYm9vbGVhblxufVxuXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gaGFuZGxlcihcbiAgZXZlbnQ6IENsb3VkRm9ybWF0aW9uQ3VzdG9tUmVzb3VyY2VFdmVudFxuKTogUHJvbWlzZTxDdXN0b21SZXNvdXJjZVJlc3BvbnNlPiB7XG4gIHJldHVybiBvbkV2ZW50KGV2ZW50KVxufVxuIl19
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./drizzle-migrate-provider";
package/lib/index.js ADDED
@@ -0,0 +1,18 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./drizzle-migrate-provider"), exports);
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLDZEQUEwQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gXCIuL2RyaXp6bGUtbWlncmF0ZS1wcm92aWRlclwiXG4iXX0=
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
@@ -0,0 +1,15 @@
1
+ # Installation
2
+ > `npm install --save @types/aws-lambda`
3
+
4
+ # Summary
5
+ This package contains type definitions for aws-lambda (http://docs.aws.amazon.com/lambda).
6
+
7
+ # Details
8
+ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/aws-lambda.
9
+
10
+ ### Additional Details
11
+ * Last updated: Fri, 03 Jan 2025 00:04:09 GMT
12
+ * Dependencies: none
13
+
14
+ # Credits
15
+ These definitions were written by [James Darbyshire](https://github.com/darbio), [Michael Skarum](https://github.com/skarum), [Stef Heyenrath](https://github.com/StefH), [Rich Buggy](https://github.com/buggy), [wwwy3y3](https://github.com/wwwy3y3), [Ishaan Malhi](https://github.com/OrthoDex), [Michael Marner](https://github.com/MichaelMarner), [Daniel Cottone](https://github.com/daniel-cottone), [Kostya Misura](https://github.com/kostya-misura), [Markus Tacker](https://github.com/coderbyheart), [Palmi Valgeirsson](https://github.com/palmithor), [Danilo Raisi](https://github.com/daniloraisi), [Simon Buchan](https://github.com/simonbuchan), [David Hayden](https://github.com/Haydabase), [Chris Redekop](https://github.com/repl-chris), [Aneil Mallavarapu](https://github.com/aneilbaboo), [Jeremy Nagel](https://github.com/jeznag), [Louis Larry](https://github.com/louislarry), [Daniel Papukchiev](https://github.com/dpapukchiev), [Oliver Hookins](https://github.com/ohookins), [Trevor Leach](https://github.com/trevor-leach), [James Gregory](https://github.com/jagregory), [Erik Dalén](https://github.com/dalen), [Loïk Gaonac'h](https://github.com/loikg), [Roberto Zen](https://github.com/skyzenr), [Grzegorz Redlicki](https://github.com/redlickigrzegorz), [Juan Carbonel](https://github.com/juancarbonel), [Peter McIntyre](https://github.com/pwmcintyre), [Alex Bolenok](https://github.com/alex-bolenok-centralreach), [Marian Zange](https://github.com/marianzange), [Alessandro Palumbo](https://github.com/apalumbo), [Sachin Shekhar](https://github.com/SachinShekhar), [Ivan Martos](https://github.com/ivanmartos), [Zach Anthony](https://github.com/zach-anthony), [Peter Savnik](https://github.com/savnik), [Benoit Boure](https://github.com/bboure), [James Lakin](https://github.com/jamesorlakin), [Ross Gerbasi](https://github.com/aphex), [Joey Kilpatrick](https://github.com/joeykilpatrick), [Luciano Manerich Junior](https://github.com/lmanerich), and [Luciano M. Taranto](https://github.com/LucianoTaranto).
@@ -0,0 +1,83 @@
1
+ // Types shared between trigger/api-gateway-authorizer.d.ts and api-gateway-proxy.d.ts
2
+
3
+ // Poorly documented, but API Gateway will just fail internally if
4
+ // the context type does not match this.
5
+ // Note that although non-string types will be accepted, they will be
6
+ // coerced to strings on the other side.
7
+ export interface APIGatewayAuthorizerResultContext {
8
+ [name: string]: string | number | boolean | null | undefined;
9
+ }
10
+
11
+ // Default authorizer type, prefer using a specific type with the "...WithAuthorizer..." variant types.
12
+ // Note that this doesn't have to be a context from a custom lambda outhorizer, AWS also has a cognito
13
+ // authorizer type and could add more, so the property won't always be a string.
14
+ export type APIGatewayEventDefaultAuthorizerContext =
15
+ | undefined
16
+ | null
17
+ | {
18
+ [name: string]: any;
19
+ };
20
+
21
+ export type APIGatewayEventRequestContext = APIGatewayEventRequestContextWithAuthorizer<
22
+ APIGatewayEventDefaultAuthorizerContext
23
+ >;
24
+
25
+ // The requestContext property of both request authorizer and proxy integration events.
26
+ export interface APIGatewayEventRequestContextWithAuthorizer<TAuthorizerContext> {
27
+ accountId: string;
28
+ apiId: string;
29
+ // This one is a bit confusing: it is not actually present in authorizer calls
30
+ // and proxy calls without an authorizer. We model this by allowing undefined in the type,
31
+ // since it ends up the same and avoids breaking users that are testing the property.
32
+ // This lets us allow parameterizing the authorizer for proxy events that know what authorizer
33
+ // context values they have.
34
+ authorizer: TAuthorizerContext;
35
+ connectedAt?: number | undefined;
36
+ connectionId?: string | undefined;
37
+ domainName?: string | undefined;
38
+ domainPrefix?: string | undefined;
39
+ eventType?: string | undefined;
40
+ extendedRequestId?: string | undefined;
41
+ protocol: string;
42
+ httpMethod: string;
43
+ identity: APIGatewayEventIdentity;
44
+ messageDirection?: string | undefined;
45
+ messageId?: string | null | undefined;
46
+ path: string;
47
+ stage: string;
48
+ requestId: string;
49
+ requestTime?: string | undefined;
50
+ requestTimeEpoch: number;
51
+ resourceId: string;
52
+ resourcePath: string;
53
+ routeKey?: string | undefined;
54
+ }
55
+
56
+ export interface APIGatewayEventClientCertificate {
57
+ clientCertPem: string;
58
+ serialNumber: string;
59
+ subjectDN: string;
60
+ issuerDN: string;
61
+ validity: {
62
+ notAfter: string;
63
+ notBefore: string;
64
+ };
65
+ }
66
+
67
+ export interface APIGatewayEventIdentity {
68
+ accessKey: string | null;
69
+ accountId: string | null;
70
+ apiKey: string | null;
71
+ apiKeyId: string | null;
72
+ caller: string | null;
73
+ clientCert: APIGatewayEventClientCertificate | null;
74
+ cognitoAuthenticationProvider: string | null;
75
+ cognitoAuthenticationType: string | null;
76
+ cognitoIdentityId: string | null;
77
+ cognitoIdentityPoolId: string | null;
78
+ principalOrgId: string | null;
79
+ sourceIp: string;
80
+ user: string | null;
81
+ userAgent: string | null;
82
+ userArn: string | null;
83
+ }
@@ -0,0 +1,245 @@
1
+ /**
2
+ * CloudFront events
3
+ * http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html
4
+ * Bear in mind that the "example" event structure in the page above includes
5
+ * both an S3 and a Custom origin, which is not strictly allowed. Only one
6
+ * of these per event may be present.
7
+ */
8
+ export interface CloudFrontHeaders {
9
+ [name: string]: Array<{
10
+ key?: string | undefined;
11
+ value: string;
12
+ }>;
13
+ }
14
+
15
+ export type CloudFrontOrigin =
16
+ | { s3: CloudFrontS3Origin; custom?: never | undefined }
17
+ | { custom: CloudFrontCustomOrigin; s3?: never | undefined };
18
+
19
+ export interface CloudFrontCustomOrigin {
20
+ customHeaders: CloudFrontHeaders;
21
+ domainName: string;
22
+ keepaliveTimeout: number;
23
+ path: string;
24
+ port: number;
25
+ protocol: "http" | "https";
26
+ readTimeout: number;
27
+ sslProtocols: string[];
28
+ }
29
+
30
+ export type CloudFrontS3Origin =
31
+ | CloudFrontS3OriginAuthMethodNone
32
+ | CloudFrontS3OriginAuthMethodOriginAccessIdentity;
33
+
34
+ export interface CloudFrontS3OriginBase {
35
+ authMethod: "origin-access-identity" | "none";
36
+ customHeaders: CloudFrontHeaders;
37
+ domainName: string;
38
+ path: string;
39
+ }
40
+
41
+ export interface CloudFrontS3OriginAuthMethodNone extends CloudFrontS3OriginBase {
42
+ authMethod: "none";
43
+ region?: never;
44
+ }
45
+
46
+ export interface CloudFrontS3OriginAuthMethodOriginAccessIdentity extends CloudFrontS3OriginBase {
47
+ authMethod: "origin-access-identity";
48
+ region: string;
49
+ }
50
+
51
+ export interface CloudFrontResponse {
52
+ status: string;
53
+ statusDescription: string;
54
+ headers: CloudFrontHeaders;
55
+ }
56
+
57
+ export interface CloudFrontRequest {
58
+ body?:
59
+ | {
60
+ action: "read-only" | "replace";
61
+ data: string;
62
+ encoding: "base64" | "text";
63
+ readonly inputTruncated: boolean;
64
+ }
65
+ | undefined;
66
+ readonly clientIp: string;
67
+ readonly method: string;
68
+ uri: string;
69
+ querystring: string;
70
+ headers: CloudFrontHeaders;
71
+ origin?: CloudFrontOrigin | undefined;
72
+ }
73
+
74
+ export interface CloudFrontEvent {
75
+ config: {
76
+ readonly distributionDomainName: string;
77
+ readonly distributionId: string;
78
+ readonly eventType: "origin-request" | "origin-response" | "viewer-request" | "viewer-response";
79
+ readonly requestId: string;
80
+ };
81
+ }
82
+
83
+ /**
84
+ * Generated HTTP response in viewer request event or origin request event
85
+ *
86
+ * https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-generating-http-responses-in-requests.html#lambda-generating-http-responses-object
87
+ */
88
+ export interface CloudFrontResultResponse {
89
+ status: string;
90
+ statusDescription?: string | undefined;
91
+ headers?: CloudFrontHeaders | undefined;
92
+ bodyEncoding?: "text" | "base64" | undefined;
93
+ body?: string | undefined;
94
+ }
95
+
96
+ /** @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-event-structure.html#functions-event-structure-query-header-cookie */
97
+ export interface CloudFrontFunctionsCookies {
98
+ [key: string]: {
99
+ value: string;
100
+ attributes?: string;
101
+ multiValue?: Array<{ value: string; attributes?: string }>;
102
+ };
103
+ }
104
+
105
+ /** @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-event-structure.html#functions-event-structure-query-header-cookie */
106
+ export interface CloudFrontFunctionsQuerystring {
107
+ [key: string]: { value: string; multiValue?: Array<{ value: string }> };
108
+ }
109
+
110
+ /** @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-event-structure.html#functions-event-structure-query-header-cookie */
111
+ export interface CloudFrontFunctionsHeaders {
112
+ [key: string]: { value: string; multiValue?: Array<{ value: string }> };
113
+ }
114
+
115
+ /**
116
+ * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-event-structure.html
117
+ *
118
+ * @usage
119
+ * ```ts
120
+ * export const handler = async (event: CloudFrontFunctionsEvent) => {
121
+ * var response = event.response;
122
+ * var headers = response.headers;
123
+ * // Set the cache-control header
124
+ * headers["cache-control"] = { value: "public,max-age=31536000,immutable" };
125
+ * // Return response to viewers
126
+ * return response
127
+ * };
128
+ * ```
129
+ */
130
+ export interface CloudFrontFunctionsEvent {
131
+ /**
132
+ * ## Version field
133
+ * The version field contains a string that specifies the version of the
134
+ * CloudFront Functions event object. The current version is 1.0.
135
+ */
136
+ version: string;
137
+ /**
138
+ * ## Context object
139
+ * The `context` object contains contextual information about the event. It includes the following fields:
140
+ * - `distributionDomainName`
141
+ * - `distributionId`
142
+ * - `eventType`
143
+ * - `requestId`
144
+ */
145
+ context: {
146
+ /** The CloudFront domain name (for example, d111111abcdef8.cloudfront.net) of the distribution that’s associated with the event. */
147
+ distributionDomainName: string;
148
+ /** The ID of the distribution (for example, EDFDVBD6EXAMPLE) that’s associated with the event. */
149
+ distributionId: string;
150
+ /** The event type, either `viewer-request` or `viewer-response`. */
151
+ eventType: "viewer-request" | "viewer-response";
152
+ /** A string that uniquely identifies a CloudFront request (and its associated response). */
153
+ requestId: string;
154
+ };
155
+ /**
156
+ * ## Viewer object
157
+ * The `viewer` object contains an `ip` field whose value is the IP address of the viewer (client) that sent the request.
158
+ * If the viewer request came through an HTTP proxy or a load balancer, the value is the IP address of the proxy or load balancer.
159
+ */
160
+ viewer: {
161
+ ip: string;
162
+ };
163
+ /**
164
+ * ## Request object
165
+ * The `request` object contains a representation of a viewer-to-CloudFront HTTP request.
166
+ * In the `event` object that’s passed to your function, the `request` object represents the
167
+ * actual request that CloudFront received from the viewer.
168
+ *
169
+ * If your function code returns a `request` object to CloudFront, it must use this same structure.
170
+ *
171
+ * The `request` object contains the following fields:
172
+ * - `method`
173
+ * - `uri`
174
+ * - `querystring`
175
+ * - `headers`
176
+ * - `cookies`
177
+ */
178
+ request: {
179
+ /** The HTTP method of the request. If your function code returns a `request`, it cannot modify this field. This is the only read-only field in the `request` object. */
180
+ method: string;
181
+ /**
182
+ * The relative path of the requested object. If your function modifies the `uri value, note the following:
183
+ * - The new `uri` value must begin with a forward slash (`/`)`.
184
+ * - When a function changes the `uri` value, it changes the object that the viewer is requesting.
185
+ * - When a function changes the `uri` value, it doesn’t change the cache behavior for the request or the origin that an origin request is sent to.
186
+ */
187
+ uri: string;
188
+ /**
189
+ * An object that represents the query string in the request. If the request doesn’t include a query string,
190
+ * the `request` object still includes an empty `querystring` object.
191
+ *
192
+ * The `querystring` object contains one field for each query string parameter in the request.
193
+ * Query string parameter names are converted to lowercase.
194
+ */
195
+ querystring: CloudFrontFunctionsQuerystring;
196
+ /**
197
+ * An object that represents the HTTP headers in the request. If the request contains any `Cookie` headers,
198
+ * those headers are not part of the `headers` object. Cookies are represented separately in the `cookies` object.
199
+ *
200
+ * The `headers` object contains one field for each header in the request. Header names are converted to lowercase.
201
+ */
202
+ headers: CloudFrontFunctionsHeaders;
203
+ /**
204
+ * An object that represents the cookies in the request (`Cookie` headers).
205
+ *
206
+ * The `cookies` object contains one field for each cookie in the request. Cookie names are converted to lowercase.
207
+ */
208
+ cookies: CloudFrontFunctionsCookies;
209
+ };
210
+ /**
211
+ * ## Response object
212
+ *
213
+ * The `response` object contains a representation of a CloudFront-to-viewer HTTP response.
214
+ * In the `event` object that’s passed to your function, the `response` object represents CloudFront’s actual response to a viewer request.
215
+ *
216
+ * If your function code returns a `response` object, it must use this same structure.
217
+ *
218
+ * The `response` object contains the following fields:
219
+ */
220
+ response: {
221
+ /**
222
+ * The HTTP status code of the response. This value is an integer, not a string.
223
+ *
224
+ * If the function is associated with a _viewer response_ event type, your function code cannot change
225
+ * the `statusCode` that it received. If the function is associated with a _viewer request_ event type
226
+ * and [generates an HTTP response](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/writing-function-code.html#function-code-generate-response),
227
+ * your function code can set the `statusCode`.
228
+ */
229
+ statusCode: number;
230
+ /** The HTTP status description of the response. If your function code generates a response, this field is optional. */
231
+ statusDescription?: string;
232
+ /**
233
+ * An object that represents the HTTP headers in the response. If the response contains any `Set-Cookie` headers,
234
+ * those `headers` are not part of the headers object. Cookies are represented separately in the `cookies` object.
235
+ *
236
+ * The `headers` object contains one field for each header in the response. Header names are converted to lowercase.
237
+ */
238
+ headers: CloudFrontFunctionsHeaders;
239
+ /**
240
+ * An object that represents the cookies in the response (`Set-Cookie` headers).
241
+ * The `cookies` object contains one field for each cookie in the response. Cookie names are converted to lowercase.
242
+ */
243
+ cookies: CloudFrontFunctionsCookies;
244
+ };
245
+ }
@@ -0,0 +1,172 @@
1
+ /**
2
+ * The interface that AWS Lambda will invoke your handler with.
3
+ * There are more specialized types for many cases where AWS services
4
+ * invoke your lambda, but you can directly use this type for when you are invoking
5
+ * your lambda directly.
6
+ *
7
+ * See the {@link http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html AWS documentation}
8
+ * for more information about the runtime behavior, and the
9
+ * {@link https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/ AWS Blog post}
10
+ * introducing the async handler behavior in the 8.10 runtime.
11
+ *
12
+ * @example <caption>Defining a custom handler type</caption>
13
+ * import { Handler } from 'aws-lambda'
14
+ *
15
+ * interface NameEvent {
16
+ * fullName: string
17
+ * }
18
+ * interface NameResult {
19
+ * firstName: string
20
+ * middleNames: string
21
+ * lastName: string
22
+ * }
23
+ * type PersonHandler = Handler<NameEvent, NameResult>
24
+ *
25
+ * export const handler: PersonHandler = async (event) => {
26
+ * const names = event.fullName.split(' ')
27
+ * const firstName = names.shift()
28
+ * const lastName = names.pop()
29
+ * return { firstName, middleNames: names, lastName }
30
+ * }
31
+ *
32
+ * @example <caption>Logs the contents of the event object and returns the location of the logs</caption>
33
+ * import { Handler } from 'aws-lambda'
34
+ *
35
+ * export const handler: Handler = async (event, context) => {
36
+ * console.log("EVENT: \n" + JSON.stringify(event, null, 2))
37
+ * return context.logStreamName
38
+ * }
39
+ *
40
+ * @example <caption>AWS SDK with Async Function and Promises</caption>
41
+ * import { Handler } from 'aws-lambda'
42
+ * import AWS from 'aws-sdk'
43
+ *
44
+ * const s3 = new AWS.S3()
45
+ *
46
+ * export const handler: Handler = async (event) => {
47
+ * const response = await s3.listBuckets().promise()
48
+ * return response?.Buckets.map((bucket) => bucket.Name)
49
+ * }
50
+ *
51
+ * @example <caption>HTTP Request with Callback</caption>
52
+ * import { Handler } from 'aws-lambda'
53
+ * import https from 'https'
54
+ *
55
+ * let url = "https://docs.aws.amazon.com/lambda/latest/dg/welcome.html"
56
+ *
57
+ * export const handler: Handler<void, number> = (event, context, callback) => {
58
+ * https.get(url, (res) => {
59
+ * callback(null, res.statusCode)
60
+ * }).on('error', (e) => {
61
+ * callback(Error(e))
62
+ * })
63
+ * }
64
+ *
65
+ * @param event
66
+ * Parsed JSON data in the lambda request payload. For an AWS service triggered
67
+ * lambda this should be in the format of a type ending in Event, for example the
68
+ * S3Handler receives an event of type S3Event.
69
+ * @param context
70
+ * Runtime contextual information of the current invocation, for example the caller
71
+ * identity, available memory and time remaining, legacy completion callbacks, and
72
+ * a mutable property controlling when the lambda execution completes.
73
+ * @param callback
74
+ * NodeJS-style completion callback that the AWS Lambda runtime will provide that can
75
+ * be used to provide the lambda result payload value, or any execution error. Can
76
+ * instead return a promise that resolves with the result payload value or rejects
77
+ * with the execution error.
78
+ * @return
79
+ * A promise that resolves with the lambda result payload value, or rejects with the
80
+ * execution error. Note that if you implement your handler as an async function,
81
+ * you will automatically return a promise that will resolve with a returned value,
82
+ * or reject with a thrown value.
83
+ */
84
+ export type Handler<TEvent = any, TResult = any> = (
85
+ event: TEvent,
86
+ context: Context,
87
+ callback: Callback<TResult>,
88
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
89
+ ) => void | Promise<TResult>;
90
+
91
+ /**
92
+ * {@link Handler} context parameter.
93
+ * See {@link https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html AWS documentation}.
94
+ */
95
+ export interface Context {
96
+ callbackWaitsForEmptyEventLoop: boolean;
97
+ functionName: string;
98
+ functionVersion: string;
99
+ invokedFunctionArn: string;
100
+ memoryLimitInMB: string;
101
+ awsRequestId: string;
102
+ logGroupName: string;
103
+ logStreamName: string;
104
+ identity?: CognitoIdentity | undefined;
105
+ clientContext?: ClientContext | undefined;
106
+
107
+ getRemainingTimeInMillis(): number;
108
+
109
+ // Functions for compatibility with earlier Node.js Runtime v0.10.42
110
+ // No longer documented, so they are deprecated, but they still work
111
+ // as of the 12.x runtime, so they are not removed from the types.
112
+
113
+ /** @deprecated Use handler callback or promise result */
114
+ done(error?: Error, result?: any): void;
115
+ /** @deprecated Use handler callback with first argument or reject a promise result */
116
+ fail(error: Error | string): void;
117
+ /** @deprecated Use handler callback with second argument or resolve a promise result */
118
+ succeed(messageOrObject: any): void;
119
+ // Unclear what behavior this is supposed to have, I couldn't find any still extant reference,
120
+ // and it behaves like the above, ignoring the object parameter.
121
+ /** @deprecated Use handler callback or promise result */
122
+ succeed(message: string, object: any): void;
123
+ }
124
+
125
+ export interface CognitoIdentity {
126
+ cognitoIdentityId: string;
127
+ cognitoIdentityPoolId: string;
128
+ }
129
+
130
+ export interface ClientContext {
131
+ client: ClientContextClient;
132
+ Custom?: any;
133
+ env: ClientContextEnv;
134
+ }
135
+
136
+ export interface ClientContextClient {
137
+ installationId: string;
138
+ appTitle: string;
139
+ appVersionName: string;
140
+ appVersionCode: string;
141
+ appPackageName: string;
142
+ }
143
+
144
+ export interface ClientContextEnv {
145
+ platformVersion: string;
146
+ platform: string;
147
+ make: string;
148
+ model: string;
149
+ locale: string;
150
+ }
151
+
152
+ /**
153
+ * NodeJS-style callback parameter for the {@link Handler} type.
154
+ * Can be used instead of returning a promise, see the
155
+ * {@link https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html AWS documentation}
156
+ * for the handler programming model.
157
+ *
158
+ * @param error
159
+ * Parameter to use to provide the error payload for a failed lambda execution.
160
+ * See {@link https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-mode-exceptions.html AWS documentation}
161
+ * for error handling.
162
+ * If an Error instance is passed, the error payload uses the `name` property as the `errorType`,
163
+ * the `message` property as the `errorMessage`, and parses the `stack` property string into
164
+ * the `trace` array.
165
+ * For other values, the `errorType` is `typeof value`, the `errorMessage` is `String(value)`, and
166
+ * `trace` is an empty array.
167
+ *
168
+ * @param result
169
+ * Parameter to use to provide the result payload for a successful lambda execution.
170
+ * Pass `null` or `undefined` for the `error` parameter to use this parameter.
171
+ */
172
+ export type Callback<TResult = any> = (error?: Error | string | null, result?: TResult) => void;
@@ -0,0 +1,54 @@
1
+ export * from "./common/api-gateway";
2
+ export * from "./common/cloudfront";
3
+ export * from "./handler";
4
+ export * from "./trigger/alb";
5
+ // TODO: export * from "./trigger/alexa";
6
+ export * from "./trigger/api-gateway-authorizer";
7
+ export * from "./trigger/api-gateway-proxy";
8
+ export * from "./trigger/appsync-resolver";
9
+ export * from "./trigger/autoscaling";
10
+ // CloudTrail section just describes using S3 to trigger on cloudtrail changes.
11
+ export * from "./trigger/cdk-custom-resource";
12
+ export * from "./trigger/cloudformation-custom-resource";
13
+ export * from "./trigger/cloudfront-request";
14
+ export * from "./trigger/cloudfront-response";
15
+ export * from "./trigger/cloudwatch-alarm";
16
+ export * from "./trigger/cloudwatch-events";
17
+ export * from "./trigger/cloudwatch-logs";
18
+ export * from "./trigger/codebuild-cloudwatch-state";
19
+ export * from "./trigger/codecommit";
20
+ export * from "./trigger/codepipeline";
21
+ export * from "./trigger/codepipeline-cloudwatch";
22
+ export * from "./trigger/codepipeline-cloudwatch-action";
23
+ export * from "./trigger/codepipeline-cloudwatch-pipeline";
24
+ export * from "./trigger/codepipeline-cloudwatch-stage";
25
+ // TODO: export * from "./trigger/cognito-sync";
26
+ export * from "./trigger/cognito-user-pool-trigger/";
27
+ export * from "./trigger/connect-contact-flow";
28
+ // TODO: export * from "./trigger/config";
29
+ export * from "./trigger/dynamodb-stream";
30
+ export * from "./trigger/eventbridge";
31
+ // ElastiCache section just describes using lambdas in an ElastiCache context (VPC issues, etc.)
32
+ // EC2 events are delivered using cloudwatch events...
33
+ export * from "./trigger/guard-duty-event-notification";
34
+ export * from "./trigger/iot";
35
+ export * from "./trigger/iot-authorizer";
36
+ export * from "./trigger/kinesis-firehose-transformation";
37
+ export * from "./trigger/kinesis-stream";
38
+ export * from "./trigger/lambda-function-url";
39
+ export * from "./trigger/lex";
40
+ export * from "./trigger/lex-v2";
41
+ // RDS events are delivered using SNS events...
42
+ export * from "./trigger/amplify-resolver";
43
+ export * from "./trigger/msk";
44
+ export * from "./trigger/s3";
45
+ export * from "./trigger/s3-batch";
46
+ export * from "./trigger/s3-event-notification";
47
+ export * from "./trigger/secretsmanager";
48
+ export * from "./trigger/self-managed-kafka";
49
+ export * from "./trigger/ses";
50
+ export * from "./trigger/sns";
51
+ export * from "./trigger/sqs";
52
+ export * from "./trigger/transfer-family-authorizer";
53
+
54
+ export as namespace AWSLambda;