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,40 @@
1
+ import { Handler } from "../../handler";
2
+ import { BaseTriggerEvent, StringMap } from "./_common";
3
+
4
+ export type UserStatus =
5
+ | "UNCONFIRMED"
6
+ | "CONFIRMED"
7
+ | "ARCHIVED"
8
+ | "COMPROMISED"
9
+ | "UNKNOWN"
10
+ | "RESET_REQUIRED"
11
+ | "FORCE_CHANGE_PASSWORD";
12
+
13
+ export interface BaseUserMigrationTriggerEvent<T extends string> extends BaseTriggerEvent<T> {
14
+ request: {
15
+ password: string;
16
+ validationData?: StringMap | undefined;
17
+ clientMetadata?: StringMap | undefined;
18
+ };
19
+ response: {
20
+ userAttributes: StringMap;
21
+ finalUserStatus?: UserStatus | undefined;
22
+ messageAction?: "RESEND" | "SUPPRESS" | undefined;
23
+ desiredDeliveryMediums: Array<"SMS" | "EMAIL">;
24
+ forceAliasCreation?: boolean | undefined;
25
+ enableSMSMFA?: boolean | undefined;
26
+ };
27
+ }
28
+
29
+ export type UserMigrationAuthenticationTriggerEvent = BaseUserMigrationTriggerEvent<"UserMigration_Authentication">;
30
+
31
+ export type UserMigrationForgotPasswordTriggerEvent = BaseUserMigrationTriggerEvent<"UserMigration_ForgotPassword">;
32
+
33
+ /**
34
+ * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-migrate-user.html
35
+ */
36
+ export type UserMigrationTriggerEvent =
37
+ | UserMigrationAuthenticationTriggerEvent
38
+ | UserMigrationForgotPasswordTriggerEvent;
39
+
40
+ export type UserMigrationTriggerHandler = Handler<UserMigrationTriggerEvent>;
@@ -0,0 +1,22 @@
1
+ import { Handler } from "../../handler";
2
+ import { BaseTriggerEvent, StringMap } from "./_common";
3
+
4
+ /**
5
+ * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-verify-auth-challenge-response.html
6
+ */
7
+ export interface VerifyAuthChallengeResponseTriggerEvent
8
+ extends BaseTriggerEvent<"VerifyAuthChallengeResponse_Authentication">
9
+ {
10
+ request: {
11
+ userAttributes: StringMap;
12
+ privateChallengeParameters: StringMap;
13
+ challengeAnswer: string;
14
+ userNotFound?: boolean | undefined;
15
+ clientMetadata?: StringMap | undefined;
16
+ };
17
+ response: {
18
+ answerCorrect: boolean;
19
+ };
20
+ }
21
+
22
+ export type VerifyAuthChallengeResponseTriggerHandler = Handler<VerifyAuthChallengeResponseTriggerEvent>;
@@ -0,0 +1,64 @@
1
+ import { Callback, Handler } from "../handler";
2
+
3
+ export type ConnectContactFlowHandler = Handler<ConnectContactFlowEvent, ConnectContactFlowResult>;
4
+ export type ConnectContactFlowCallback = Callback<ConnectContactFlowResult>;
5
+
6
+ // Connect
7
+ // https://docs.aws.amazon.com/connect/latest/adminguide/connect-lambda-functions.html
8
+ export interface ConnectContactFlowEvent {
9
+ Details: {
10
+ ContactData: {
11
+ Attributes: { [key: string]: string };
12
+ Channel: ConnectContactFlowChannel;
13
+ ContactId: string;
14
+ CustomerEndpoint: ConnectContactFlowEndpoint | null;
15
+ InitialContactId: string;
16
+ InitiationMethod: ConnectContactFlowInitiationMethod;
17
+ InstanceARN: string;
18
+ PreviousContactId: string;
19
+ Queue: ConnectContactFlowQueue | null;
20
+ SystemEndpoint: ConnectContactFlowEndpoint | null;
21
+ MediaStreams: {
22
+ Customer: {
23
+ Audio: CustomerAudio;
24
+ };
25
+ };
26
+ };
27
+ Parameters: { [key: string]: string };
28
+ };
29
+ Name: "ContactFlowEvent";
30
+ }
31
+
32
+ export type ConnectContactFlowChannel = "VOICE" | "CHAT";
33
+
34
+ export type ConnectContactFlowInitiationMethod = "INBOUND" | "OUTBOUND" | "TRANSFER" | "CALLBACK" | "API";
35
+
36
+ export interface ConnectContactFlowEndpoint {
37
+ Address: string;
38
+ Type: "TELEPHONE_NUMBER";
39
+ }
40
+
41
+ export interface ConnectContactFlowQueue {
42
+ ARN: string;
43
+ Name: string;
44
+ }
45
+
46
+ export interface ConnectContactFlowResult {
47
+ [key: string]: string | null;
48
+ }
49
+
50
+ export type CustomerAudio =
51
+ | null // If Media Streaming has never been started.
52
+ | StartedCustomerAudio // If Media Streaming has been started, but not stopped.
53
+ | (StartedCustomerAudio & StoppedCustomerAudio); // If Media Streaming has been started and stopped.
54
+
55
+ export interface StartedCustomerAudio {
56
+ StartFragmentNumber: string;
57
+ StartTimestamp: string;
58
+ StreamARN: string;
59
+ }
60
+
61
+ export interface StoppedCustomerAudio {
62
+ StopFragmentNumber: string;
63
+ StopTimestamp: string;
64
+ }
@@ -0,0 +1,55 @@
1
+ import { Handler } from "../handler";
2
+
3
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
4
+ export type DynamoDBStreamHandler = Handler<DynamoDBStreamEvent, DynamoDBBatchResponse | void>;
5
+
6
+ // http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_AttributeValue.html
7
+ export interface AttributeValue {
8
+ B?: string | undefined;
9
+ BS?: string[] | undefined;
10
+ BOOL?: boolean | undefined;
11
+ L?: AttributeValue[] | undefined;
12
+ M?: { [id: string]: AttributeValue } | undefined;
13
+ N?: string | undefined;
14
+ NS?: string[] | undefined;
15
+ NULL?: boolean | undefined;
16
+ S?: string | undefined;
17
+ SS?: string[] | undefined;
18
+ }
19
+
20
+ // http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_StreamRecord.html
21
+ export interface StreamRecord {
22
+ ApproximateCreationDateTime?: number | undefined;
23
+ Keys?: { [key: string]: AttributeValue } | undefined;
24
+ NewImage?: { [key: string]: AttributeValue } | undefined;
25
+ OldImage?: { [key: string]: AttributeValue } | undefined;
26
+ SequenceNumber?: string | undefined;
27
+ SizeBytes?: number | undefined;
28
+ StreamViewType?: "KEYS_ONLY" | "NEW_IMAGE" | "OLD_IMAGE" | "NEW_AND_OLD_IMAGES" | undefined;
29
+ }
30
+
31
+ // http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_Record.html
32
+ export interface DynamoDBRecord {
33
+ awsRegion?: string | undefined;
34
+ dynamodb?: StreamRecord | undefined;
35
+ eventID?: string | undefined;
36
+ eventName?: "INSERT" | "MODIFY" | "REMOVE" | undefined;
37
+ eventSource?: string | undefined;
38
+ eventSourceARN?: string | undefined;
39
+ eventVersion?: string | undefined;
40
+ userIdentity?: any;
41
+ }
42
+
43
+ // http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-ddb-update
44
+ export interface DynamoDBStreamEvent {
45
+ Records: DynamoDBRecord[];
46
+ }
47
+
48
+ // https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-ddb-batchfailurereporting
49
+ export interface DynamoDBBatchResponse {
50
+ batchItemFailures: DynamoDBBatchItemFailure[];
51
+ }
52
+
53
+ export interface DynamoDBBatchItemFailure {
54
+ itemIdentifier: string;
55
+ }
@@ -0,0 +1,19 @@
1
+ import { Handler } from "../handler";
2
+
3
+ export type EventBridgeHandler<TDetailType extends string, TDetail, TResult> = Handler<
4
+ EventBridgeEvent<TDetailType, TDetail>,
5
+ TResult
6
+ >;
7
+
8
+ export interface EventBridgeEvent<TDetailType extends string, TDetail> {
9
+ id: string;
10
+ version: string;
11
+ account: string;
12
+ time: string;
13
+ region: string;
14
+ resources: string[];
15
+ source: string;
16
+ "detail-type": TDetailType;
17
+ detail: TDetail;
18
+ "replay-name"?: string;
19
+ }
@@ -0,0 +1,36 @@
1
+ import { EventBridgeEvent } from "./eventbridge";
2
+
3
+ /**
4
+ * Guard Duty events
5
+ * https://docs.aws.amazon.com/guardduty/latest/ug/monitor-with-eventbridge-s3-malware-protection.html
6
+ */
7
+
8
+ export interface GuardDutyScanResultNotificationEvent
9
+ extends
10
+ EventBridgeEvent<"GuardDuty Malware Protection Object Scan Result", GuardDutyScanResultNotificationEventDetail>
11
+ {
12
+ source: "aws.guardduty";
13
+ }
14
+
15
+ export interface GuardDutyScanResultNotificationEventDetail {
16
+ schemaVersion: "1.0";
17
+ scanStatus: "COMPLETED" | "SKIPPED" | "FAILED";
18
+ resourceType: "S3_OBJECT";
19
+ s3ObjectDetails: {
20
+ bucketName: string;
21
+ objectKey: string;
22
+ eTag: string;
23
+ versionId: string;
24
+ s3Throttled: boolean;
25
+ };
26
+ scanResultDetails: {
27
+ scanResultStatus: "NO_THREATS_FOUND" | "THREAT_FOUND" | "UNSUPPORTED" | "ACCESS_DENIED" | "FAILED";
28
+ threats: GuardDutyThreatDetail[] | null;
29
+ };
30
+ }
31
+
32
+ export interface GuardDutyThreatDetail {
33
+ name: string;
34
+ }
35
+
36
+ export type GuardDutyNotificationEvent = GuardDutyScanResultNotificationEvent;
@@ -0,0 +1,48 @@
1
+ import { Handler } from "../handler";
2
+ import { PolicyDocument } from "./api-gateway-authorizer";
3
+
4
+ export type IoTProtocolType = "http" | "mqtt" | "tls";
5
+
6
+ export type IoTCustomAuthorizerHandler = Handler<IoTCustomAuthorizerEvent, IoTCustomAuthorizerResult>;
7
+
8
+ export interface IoTProtocolDataTLS {
9
+ serverName: string; // The server name indication (SNI) host_name string.
10
+ }
11
+
12
+ export interface IoTProtocolDataHTTP {
13
+ headers: Record<string, string>;
14
+ queryString: string;
15
+ }
16
+
17
+ export interface IoTProtocolDataMQTT {
18
+ username?: string;
19
+ password?: string; // A base64-encoded string.
20
+ clientId: string; // Included in the event only when the device sends the value.
21
+ }
22
+
23
+ export interface IoTCustomAuthorizerEvent {
24
+ token?: string;
25
+ signatureVerified: boolean; // Indicates whether the device gateway has validated the signature.
26
+ protocols: IoTProtocolType[]; // Indicates which protocols to expect for the request.
27
+ protocolData: {
28
+ tls?: IoTProtocolDataTLS;
29
+ http?: IoTProtocolDataHTTP;
30
+ mqtt?: IoTProtocolDataMQTT;
31
+ };
32
+ connectionMetadata: {
33
+ id: string; // The connection ID. You can use this for logging.
34
+ };
35
+ }
36
+
37
+ /**
38
+ * IoT CustomAuthorizer AuthResponse.PolicyDocument.
39
+ * https://docs.aws.amazon.com/iot/latest/developerguide/config-custom-auth.html#custom-auth-lambda
40
+ * https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html#Condition
41
+ */
42
+ export interface IoTCustomAuthorizerResult {
43
+ isAuthenticated: boolean; // A Boolean that determines whether client can connect.
44
+ principalId: string; // A string that identifies the connection in logs.
45
+ disconnectAfterInSeconds: number;
46
+ refreshAfterInSeconds: number;
47
+ policyDocuments: PolicyDocument[];
48
+ }
@@ -0,0 +1,28 @@
1
+ import { Handler } from "../handler";
2
+
3
+ export type IoTHandler = Handler<IoTEvent, void>;
4
+
5
+ // IoT
6
+ // https://docs.aws.amazon.com/lambda/latest/dg/services-iot.html
7
+ // IoT payload is not restriced to JSON, but JSON is highly recommended. Types as string, number or array are possible to use.
8
+
9
+ export type IoTEvent<T = never> = string | number | T;
10
+
11
+ // PreProvisioningHook
12
+ // https://docs.aws.amazon.com/iot/latest/developerguide/pre-provisioning-hook.html
13
+ // When using AWS IoT fleet provisioning, you can set up a Lambda function to validate parameters passed from the device before allowing the device to be provisioned.
14
+ export type IoTPreProvisioningHookHandler = Handler<IoTPreProvisioningHookEvent, IoTPreProvisioningHookResult>;
15
+
16
+ export interface IoTPreProvisioningHookEvent {
17
+ claimCertificateId: string;
18
+ certificateId: string;
19
+ certificatePem: string;
20
+ templateArn: string;
21
+ clientId: string;
22
+ parameters: Record<string, string>;
23
+ }
24
+
25
+ export interface IoTPreProvisioningHookResult {
26
+ allowProvisioning: boolean;
27
+ parameterOverrides: Record<string, string>;
28
+ }
@@ -0,0 +1,51 @@
1
+ import { Callback, Handler } from "../handler";
2
+
3
+ export type FirehoseTransformationHandler = Handler<FirehoseTransformationEvent, FirehoseTransformationResult>;
4
+ export type FirehoseTransformationCallback = Callback<FirehoseTransformationResult>;
5
+
6
+ // Kinesis Data Firehose Event
7
+ // https://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-kinesis-firehose
8
+ // https://docs.aws.amazon.com/firehose/latest/dev/data-transformation.html
9
+ // https://aws.amazon.com/blogs/compute/amazon-kinesis-firehose-data-transformation-with-aws-lambda/
10
+ // Examples in the lambda blueprints
11
+ export interface FirehoseTransformationEvent {
12
+ invocationId: string;
13
+ deliveryStreamArn: string;
14
+ sourceKinesisStreamArn?: string | undefined;
15
+ region: string;
16
+ records: FirehoseTransformationEventRecord[];
17
+ }
18
+
19
+ export interface FirehoseTransformationEventRecord {
20
+ recordId: string;
21
+ approximateArrivalTimestamp: number;
22
+ /** Base64 encoded */
23
+ data: string;
24
+ kinesisRecordMetadata?: FirehoseRecordMetadata | undefined;
25
+ }
26
+
27
+ export interface FirehoseRecordMetadata {
28
+ shardId: string;
29
+ partitionKey: string;
30
+ approximateArrivalTimestamp: number;
31
+ sequenceNumber: string;
32
+ subsequenceNumber: string;
33
+ }
34
+
35
+ export type FirehoseRecordTransformationStatus = "Ok" | "Dropped" | "ProcessingFailed";
36
+
37
+ export interface FirehoseTransformationMetadata {
38
+ partitionKeys: { [name: string]: string };
39
+ }
40
+
41
+ export interface FirehoseTransformationResultRecord {
42
+ recordId: string;
43
+ result: FirehoseRecordTransformationStatus;
44
+ /** Encode in Base64 */
45
+ data?: string;
46
+ metadata?: FirehoseTransformationMetadata;
47
+ }
48
+
49
+ export interface FirehoseTransformationResult {
50
+ records: FirehoseTransformationResultRecord[];
51
+ }
@@ -0,0 +1,56 @@
1
+ import { Handler } from "../handler";
2
+
3
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
4
+ export type KinesisStreamHandler = Handler<KinesisStreamEvent, KinesisStreamBatchResponse | void>;
5
+
6
+ export type KinesisStreamTumblingWindowHandler = Handler<
7
+ KinesisStreamTumblingWindowEvent,
8
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
9
+ KinesisStreamStateResponse | void
10
+ >;
11
+
12
+ // Kinesis Streams
13
+ // https://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-kinesis-streams
14
+ export interface KinesisStreamRecordPayload {
15
+ approximateArrivalTimestamp: number;
16
+ data: string;
17
+ kinesisSchemaVersion: string;
18
+ partitionKey: string;
19
+ sequenceNumber: string;
20
+ }
21
+
22
+ export interface KinesisStreamRecord {
23
+ awsRegion: string;
24
+ eventID: string;
25
+ eventName: string;
26
+ eventSource: string;
27
+ eventSourceARN: string;
28
+ eventVersion: string;
29
+ invokeIdentityArn: string;
30
+ kinesis: KinesisStreamRecordPayload;
31
+ }
32
+
33
+ export interface KinesisStreamEvent {
34
+ Records: KinesisStreamRecord[];
35
+ }
36
+
37
+ // https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-windows
38
+ export interface KinesisStreamTumblingWindowEvent extends KinesisStreamEvent {
39
+ window: { start: string; end: string };
40
+ state?: { [key: string]: any };
41
+ isFinalInvokeForWindow: boolean;
42
+ isWindowTerminatedEarly: boolean;
43
+ }
44
+
45
+ export interface KinesisStreamStateResponse extends Partial<KinesisStreamBatchResponse> {
46
+ state: { [key: string]: any };
47
+ }
48
+
49
+ // https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-batchfailurereporting
50
+ export interface KinesisStreamBatchResponse {
51
+ batchItemFailures: KinesisStreamBatchItemFailure[];
52
+ }
53
+
54
+ export interface KinesisStreamBatchItemFailure {
55
+ itemIdentifier: string;
56
+ }
@@ -0,0 +1,45 @@
1
+ import { Handler } from "../handler";
2
+ import {
3
+ APIGatewayEventRequestContextIAMAuthorizer,
4
+ APIGatewayEventRequestContextV2WithAuthorizer,
5
+ APIGatewayProxyCallbackV2,
6
+ APIGatewayProxyEventV2,
7
+ APIGatewayProxyEventV2WithRequestContext,
8
+ APIGatewayProxyResultV2,
9
+ } from "./api-gateway-proxy";
10
+
11
+ /**
12
+ * Default Lambda Function URL event with no Authorizer
13
+ */
14
+ export type LambdaFunctionURLEvent = APIGatewayProxyEventV2;
15
+
16
+ /**
17
+ * Works with Lambda Function URL format which is currently the same as HTTP API integration Payload Format version 2.0
18
+ * @see - https://docs.aws.amazon.com/lambda/latest/dg/urls-invocation.html#urls-payloads
19
+ */
20
+ export type LambdaFunctionURLResult<T = never> = APIGatewayProxyResultV2<T>;
21
+
22
+ /**
23
+ * Works with Lambda Function URL format which is currently the same as HTTP API integration Payload Format version 2.0
24
+ * @see - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
25
+ */
26
+ export type LambdaFunctionURLCallback = APIGatewayProxyCallbackV2;
27
+
28
+ /**
29
+ * Works with Lambda Function URL format which is currently the same as HTTP API integration Payload Format version 2.0
30
+ * @see - https://docs.aws.amazon.com/lambda/latest/dg/urls-invocation.html#urls-payloads
31
+ */
32
+ export type LambdaFunctionURLHandler<T = never> = Handler<LambdaFunctionURLEvent, LambdaFunctionURLResult<T>>;
33
+
34
+ export type LambdaFunctionURLEventWithIAMAuthorizer = APIGatewayProxyEventV2WithRequestContext<
35
+ APIGatewayEventRequestContextV2WithAuthorizer<APIGatewayEventRequestContextIAMAuthorizer>
36
+ >;
37
+
38
+ /**
39
+ * Works with Lambda Function URL format which is currently the same as HTTP API integration Payload Format version 2.0
40
+ * @see - https://docs.aws.amazon.com/lambda/latest/dg/urls-invocation.html#urls-payloads
41
+ */
42
+ export type LambdaFunctionURLHandlerWithIAMAuthorizer<T = never> = Handler<
43
+ LambdaFunctionURLEventWithIAMAuthorizer,
44
+ LambdaFunctionURLResult<T>
45
+ >;
@@ -0,0 +1,164 @@
1
+ import { Callback, Handler } from "../handler";
2
+
3
+ export type LexV2Handler = Handler<LexV2Event, LexV2Result>;
4
+ export type LexV2Callback = Callback<LexV2Result>;
5
+
6
+ // Lex V2
7
+ // https://docs.aws.amazon.com/lexv2/latest/dg/lambda.html
8
+ export interface LexV2Event {
9
+ messageVersion: string;
10
+ invocationSource: "DialogCodeHook" | "FulfillmentCodeHook";
11
+ inputMode: "DTMF" | "Speech" | "Text";
12
+ responseContentType: string;
13
+ sessionId: string;
14
+ inputTranscript: string;
15
+ bot: LexV2Bot;
16
+ interpretations: LexV2Interpretation[];
17
+ proposedNextState: {
18
+ dialogAction: LexV2DialogAction;
19
+ intent: LexV2Intent;
20
+ };
21
+ requestAttributes?: Record<string, string>;
22
+ sessionState: LexV2SessionState;
23
+ transcriptions: LexV2Transcription[];
24
+ }
25
+
26
+ export interface LexV2Bot {
27
+ id: string;
28
+ name: string;
29
+ aliasId: string;
30
+ aliasName: string;
31
+ localeId: string;
32
+ version: string; // 'DRAFT' | `${number}`
33
+ }
34
+
35
+ export interface LexV2Interpretation {
36
+ intent: LexV2Intent;
37
+ nluConfidence?: number;
38
+ sentimentResponse?: LexV2SentimentResponse;
39
+ }
40
+
41
+ export interface LexV2Intent {
42
+ confirmationState: "Confirmed" | "Denied" | "None";
43
+ name: string;
44
+ slots: LexV2Slots;
45
+ state: LexV2IntentState;
46
+ kendraResponse?: any;
47
+ }
48
+
49
+ export type LexV2IntentState =
50
+ | "Failed"
51
+ | "Fulfilled"
52
+ | "FulfillmentInProgress"
53
+ | "InProgress"
54
+ | "ReadyForFulfillment"
55
+ | "Waiting";
56
+
57
+ export interface LexV2SentimentResponse {
58
+ sentiment: string;
59
+ sentimentScore: LexV2SentimentScore;
60
+ }
61
+
62
+ export interface LexV2SentimentScore {
63
+ mixed: number;
64
+ negative: number;
65
+ neutral: number;
66
+ positive: number;
67
+ }
68
+
69
+ export interface LexV2SessionState {
70
+ activeContexts?: LexV2ActiveContext[];
71
+ sessionAttributes?: Record<string, string>;
72
+ dialogAction?: LexV2DialogAction;
73
+ intent: LexV2Intent;
74
+ originatingRequestId: string;
75
+ }
76
+
77
+ export interface LexV2ActiveContext {
78
+ name: string;
79
+ contextAttributes: Record<string, string>;
80
+ timeToLive: {
81
+ timeToLiveInSeconds: number;
82
+ turnsToLive: number;
83
+ };
84
+ }
85
+
86
+ export type LevV2DialogActionWithoutSlot =
87
+ | { type: "Close" }
88
+ | { type: "ConfirmIntent" }
89
+ | { type: "Delegate" }
90
+ | { type: "ElicitIntent" };
91
+
92
+ export type LexV2DialogAction =
93
+ | (LevV2DialogActionWithoutSlot & { slotToElicit?: never })
94
+ | { type: "ElicitSlot"; slotToElicit: string };
95
+
96
+ export type LexV2ResultDialogAction =
97
+ | (LevV2DialogActionWithoutSlot & { slotToElicit?: never })
98
+ | { type: "ElicitSlot"; slotToElicit: string; slotElicitationStyle?: "Default" | "SpellByLetter" | "SpellByWord" };
99
+
100
+ export interface LexV2Result {
101
+ sessionState: {
102
+ sessionAttributes?: Record<string, string>;
103
+ dialogAction: LexV2ResultDialogAction;
104
+ intent?: {
105
+ name?: string;
106
+ state: LexV2IntentState;
107
+ slots?: LexV2Slots;
108
+ };
109
+ };
110
+ messages?: LexV2Message[];
111
+ }
112
+
113
+ export type LexV2Message = LexV2ContentMessage | LexV2ImageResponseCardMessage;
114
+
115
+ export interface LexV2ContentMessage {
116
+ contentType: "CustomPayload" | "PlainText" | "SSML";
117
+ content: string;
118
+ }
119
+
120
+ export interface LexV2ImageResponseCardMessage {
121
+ contentType: "ImageResponseCard";
122
+ imageResponseCard: LexV2ImageResponseCard;
123
+ }
124
+
125
+ export interface LexV2ImageResponseCard {
126
+ title: string;
127
+ subtitle?: string;
128
+ imageUrl?: string;
129
+ buttons?: LexV2ImageResponseCardButton[];
130
+ }
131
+
132
+ export interface LexV2ImageResponseCardButton {
133
+ text: string;
134
+ value: string;
135
+ }
136
+
137
+ export type LexV2Slot = LexV2ScalarSlotValue | LexV2ListSlotValue;
138
+ export type LexV2Slots = Record<string, LexV2Slot | null>;
139
+
140
+ export interface LexV2ScalarSlotValue {
141
+ shape: "Scalar";
142
+ value: LexV2SlotValue;
143
+ }
144
+
145
+ export interface LexV2ListSlotValue {
146
+ shape: "List";
147
+ value: LexV2SlotValue;
148
+ values: LexV2ScalarSlotValue[];
149
+ }
150
+
151
+ export interface LexV2SlotValue {
152
+ interpretedValue?: string;
153
+ originalValue: string;
154
+ resolvedValues: string[];
155
+ }
156
+
157
+ export interface LexV2Transcription {
158
+ transcription: string;
159
+ transcriptionConfidence: number;
160
+ resolvedContext: {
161
+ intent: string;
162
+ };
163
+ resolvedSlots: LexV2Slots;
164
+ }