diff --git a/packages/parser/package.json b/packages/parser/package.json index cd0d856527..dbac14ffb3 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -17,8 +17,8 @@ "build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", "build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", - "lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .", - "lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .", + "lint": "biome lint .", + "lint:fix": "biome check --write .", "prepack": "node ../../.github/scripts/release_patch_package_json.js ." }, "homepage": "https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/packages/parser#readme", @@ -62,10 +62,7 @@ }, "typesVersions": { "*": { - "types": [ - "./lib/cjs/types/index.d.ts", - "./lib/esm/types/index.d.ts" - ], + "types": ["./lib/cjs/types/index.d.ts", "./lib/esm/types/index.d.ts"], "middleware": [ "./lib/cjs/middleware/parser.d.ts", "./lib/esm/middleware/parser.d.ts" @@ -90,9 +87,7 @@ }, "main": "./lib/cjs/index.js", "types": "./lib/cjs/index.d.ts", - "files": [ - "lib" - ], + "files": ["lib"], "repository": { "type": "git", "url": "git+https://github.com/aws-powertools/powertools-lambda-typescript.git" diff --git a/packages/parser/src/envelopes/apigw.ts b/packages/parser/src/envelopes/apigw.ts index 89145c567a..e2eb6a1ff1 100644 --- a/packages/parser/src/envelopes/apigw.ts +++ b/packages/parser/src/envelopes/apigw.ts @@ -1,21 +1,18 @@ -import { Envelope } from './envelope.js'; -import { z, type ZodSchema } from 'zod'; +import type { ZodSchema, z } from 'zod'; +import { ParseError } from '../errors.js'; import { APIGatewayProxyEventSchema } from '../schemas/apigw.js'; import type { ParsedResult } from '../types/parser.js'; -import { ParseError } from '../errors.js'; +import { Envelope } from './envelope'; /** * API Gateway envelope to extract data within body key */ -export class ApiGatewayEnvelope extends Envelope { - public static parse( - data: unknown, - schema: T - ): z.infer { - return super.parse(APIGatewayProxyEventSchema.parse(data).body, schema); - } +export const ApiGatewayEnvelope = { + parse(data: unknown, schema: T): z.infer { + return Envelope.parse(APIGatewayProxyEventSchema.parse(data).body, schema); + }, - public static safeParse( + safeParse( data: unknown, schema: T ): ParsedResult> { @@ -30,7 +27,7 @@ export class ApiGatewayEnvelope extends Envelope { }; } - const parsedBody = super.safeParse(parsedEnvelope.data.body, schema); + const parsedBody = Envelope.safeParse(parsedEnvelope.data.body, schema); if (!parsedBody.success) { return { @@ -43,5 +40,5 @@ export class ApiGatewayEnvelope extends Envelope { } return parsedBody; - } -} + }, +}; diff --git a/packages/parser/src/envelopes/apigwv2.ts b/packages/parser/src/envelopes/apigwv2.ts index 3b66fd8588..10a461687f 100644 --- a/packages/parser/src/envelopes/apigwv2.ts +++ b/packages/parser/src/envelopes/apigwv2.ts @@ -1,24 +1,21 @@ -import { z, type ZodSchema } from 'zod'; +import type { ZodSchema, z } from 'zod'; +import { ParseError } from '../errors.js'; import { APIGatewayProxyEventV2Schema } from '../schemas/apigwv2.js'; -import { Envelope } from './envelope.js'; import type { ParsedResult } from '../types/index.js'; -import { ParseError } from '../errors.js'; +import { Envelope } from './envelope.js'; /** * API Gateway V2 envelope to extract data within body key */ -export class ApiGatewayV2Envelope extends Envelope { - public static parse( - data: unknown, - schema: T - ): z.infer { - return super.parse(APIGatewayProxyEventV2Schema.parse(data).body, schema); - } +export const ApiGatewayV2Envelope = { + parse(data: unknown, schema: T): z.infer { + return Envelope.parse( + APIGatewayProxyEventV2Schema.parse(data).body, + schema + ); + }, - public static safeParse( - data: unknown, - schema: T - ): ParsedResult { + safeParse(data: unknown, schema: T): ParsedResult { const parsedEnvelope = APIGatewayProxyEventV2Schema.safeParse(data); if (!parsedEnvelope.success) { return { @@ -30,7 +27,7 @@ export class ApiGatewayV2Envelope extends Envelope { }; } - const parsedBody = super.safeParse(parsedEnvelope.data.body, schema); + const parsedBody = Envelope.safeParse(parsedEnvelope.data.body, schema); if (!parsedBody.success) { return { @@ -43,5 +40,5 @@ export class ApiGatewayV2Envelope extends Envelope { } return parsedBody; - } -} + }, +}; diff --git a/packages/parser/src/envelopes/cloudwatch.ts b/packages/parser/src/envelopes/cloudwatch.ts index 321a115ed7..cb3112f4ff 100644 --- a/packages/parser/src/envelopes/cloudwatch.ts +++ b/packages/parser/src/envelopes/cloudwatch.ts @@ -1,8 +1,8 @@ -import { z, type ZodSchema } from 'zod'; -import { Envelope } from './envelope.js'; +import type { ZodSchema, z } from 'zod'; +import { ParseError } from '../errors.js'; import { CloudWatchLogsSchema } from '../schemas/index.js'; import type { ParsedResult } from '../types/index.js'; -import { ParseError } from '../errors.js'; +import { Envelope } from './envelope.js'; /** * CloudWatch Envelope to extract a List of log records. @@ -13,22 +13,16 @@ import { ParseError } from '../errors.js'; * * Note: The record will be parsed the same way so if model is str */ -export class CloudWatchEnvelope extends Envelope { - public static parse( - data: unknown, - schema: T - ): z.infer[] { +export const CloudWatchEnvelope = { + parse(data: unknown, schema: T): z.infer[] { const parsedEnvelope = CloudWatchLogsSchema.parse(data); return parsedEnvelope.awslogs.data.logEvents.map((record) => { - return super.parse(record.message, schema); + return Envelope.parse(record.message, schema); }); - } + }, - public static safeParse( - data: unknown, - schema: T - ): ParsedResult { + safeParse(data: unknown, schema: T): ParsedResult { const parsedEnvelope = CloudWatchLogsSchema.safeParse(data); if (!parsedEnvelope.success) { @@ -43,7 +37,7 @@ export class CloudWatchEnvelope extends Envelope { const parsedLogEvents: z.infer[] = []; for (const record of parsedEnvelope.data.awslogs.data.logEvents) { - const parsedMessage = super.safeParse(record.message, schema); + const parsedMessage = Envelope.safeParse(record.message, schema); if (!parsedMessage.success) { return { success: false, @@ -52,14 +46,13 @@ export class CloudWatchEnvelope extends Envelope { }), originalEvent: data, }; - } else { - parsedLogEvents.push(parsedMessage.data); } + parsedLogEvents.push(parsedMessage.data); } return { success: true, data: parsedLogEvents, }; - } -} + }, +}; diff --git a/packages/parser/src/envelopes/dynamodb.ts b/packages/parser/src/envelopes/dynamodb.ts index 5b27dac486..ab9cc18c8c 100644 --- a/packages/parser/src/envelopes/dynamodb.ts +++ b/packages/parser/src/envelopes/dynamodb.ts @@ -1,9 +1,9 @@ -import { z, type ZodSchema } from 'zod'; +import type { ZodSchema, z } from 'zod'; +import { ParseError } from '../errors.js'; import { DynamoDBStreamSchema } from '../schemas/index.js'; +import type { DynamoDBStreamEnvelopeResponse } from '../types/envelope.js'; import type { ParsedResult, ParsedResultError } from '../types/index.js'; import { Envelope } from './envelope.js'; -import { ParseError } from '../errors.js'; -import type { DynamoDBStreamEnvelopeResponse } from '../types/envelope.js'; /** * DynamoDB Stream Envelope to extract data within NewImage/OldImage @@ -11,8 +11,8 @@ import type { DynamoDBStreamEnvelopeResponse } from '../types/envelope.js'; * Note: Values are the parsed models. Images' values can also be None, and * length of the list is the record's amount in the original event. */ -export class DynamoDBStreamEnvelope extends Envelope { - public static parse( +export const DynamoDBStreamEnvelope = { + parse( data: unknown, schema: T ): DynamoDBStreamEnvelopeResponse>[] { @@ -20,16 +20,13 @@ export class DynamoDBStreamEnvelope extends Envelope { return parsedEnvelope.Records.map((record) => { return { - NewImage: super.parse(record.dynamodb.NewImage, schema), - OldImage: super.parse(record.dynamodb.OldImage, schema), + NewImage: Envelope.parse(record.dynamodb.NewImage, schema), + OldImage: Envelope.parse(record.dynamodb.OldImage, schema), }; }); - } + }, - public static safeParse( - data: unknown, - schema: T - ): ParsedResult { + safeParse(data: unknown, schema: T): ParsedResult { const parsedEnvelope = DynamoDBStreamSchema.safeParse(data); if (!parsedEnvelope.success) { @@ -44,8 +41,14 @@ export class DynamoDBStreamEnvelope extends Envelope { const parsedLogEvents: DynamoDBStreamEnvelopeResponse>[] = []; for (const record of parsedEnvelope.data.Records) { - const parsedNewImage = super.safeParse(record.dynamodb.NewImage, schema); - const parsedOldImage = super.safeParse(record.dynamodb.OldImage, schema); + const parsedNewImage = Envelope.safeParse( + record.dynamodb.NewImage, + schema + ); + const parsedOldImage = Envelope.safeParse( + record.dynamodb.OldImage, + schema + ); if (!parsedNewImage.success || !parsedOldImage.success) { return { success: false, @@ -58,17 +61,16 @@ export class DynamoDBStreamEnvelope extends Envelope { }), originalEvent: data, }; - } else { - parsedLogEvents.push({ - NewImage: parsedNewImage.data, - OldImage: parsedOldImage.data, - }); } + parsedLogEvents.push({ + NewImage: parsedNewImage.data, + OldImage: parsedOldImage.data, + }); } return { success: true, data: parsedLogEvents, }; - } -} + }, +}; diff --git a/packages/parser/src/envelopes/envelope.ts b/packages/parser/src/envelopes/envelope.ts index caf977c49c..2291412174 100644 --- a/packages/parser/src/envelopes/envelope.ts +++ b/packages/parser/src/envelopes/envelope.ts @@ -1,8 +1,8 @@ -import { z, type ZodSchema } from 'zod'; -import type { ParsedResult } from '../types/parser.js'; +import type { ZodSchema, z } from 'zod'; import { ParseError } from '../errors.js'; +import type { ParsedResult } from '../types/parser.js'; -export class Envelope { +export const Envelope = { /** * Abstract function to parse the content of the envelope using provided schema. * Both inputs are provided as unknown by the user. @@ -11,10 +11,7 @@ export class Envelope { * @param data data to parse * @param schema schema */ - public static readonly parse = ( - data: unknown, - schema: T - ): z.infer => { + parse(data: unknown, schema: T): z.infer { if (typeof data !== 'object' && typeof data !== 'string') { throw new ParseError( `Invalid data type for envelope. Expected string or object, got ${typeof data}` @@ -23,13 +20,14 @@ export class Envelope { try { if (typeof data === 'string') { return schema.parse(JSON.parse(data)); - } else if (typeof data === 'object') { + } + if (typeof data === 'object') { return schema.parse(data); } } catch (e) { - throw new ParseError(`Failed to parse envelope`, { cause: e as Error }); + throw new ParseError('Failed to parse envelope', { cause: e as Error }); } - }; + }, /** * Abstract function to safely parse the content of the envelope using provided schema. @@ -37,10 +35,10 @@ export class Envelope { * @param input * @param schema */ - public static readonly safeParse = ( + safeParse( input: unknown, schema: T - ): ParsedResult> => { + ): ParsedResult> { try { if (typeof input !== 'object' && typeof input !== 'string') { return { @@ -63,7 +61,7 @@ export class Envelope { } : { success: false, - error: new ParseError(`Failed to parse envelope`, { + error: new ParseError('Failed to parse envelope', { cause: parsed.error, }), originalEvent: input, @@ -71,11 +69,11 @@ export class Envelope { } catch (e) { return { success: false, - error: new ParseError(`Failed to parse envelope`, { + error: new ParseError('Failed to parse envelope', { cause: e as Error, }), originalEvent: input, }; } - }; -} + }, +}; diff --git a/packages/parser/src/envelopes/event-bridge.ts b/packages/parser/src/envelopes/event-bridge.ts index b6e53a4897..7c44bb9a56 100644 --- a/packages/parser/src/envelopes/event-bridge.ts +++ b/packages/parser/src/envelopes/event-bridge.ts @@ -1,24 +1,18 @@ -import { Envelope } from './envelope.js'; -import { z, type ZodSchema } from 'zod'; +import type { ZodSchema, z } from 'zod'; +import { ParseError } from '../errors.js'; import { EventBridgeSchema } from '../schemas/index.js'; import type { ParsedResult } from '../types/index.js'; -import { ParseError } from '../errors.js'; +import { Envelope } from './envelope.js'; /** * Envelope for EventBridge schema that extracts and parses data from the `detail` key. */ -export class EventBridgeEnvelope extends Envelope { - public static parse( - data: unknown, - schema: T - ): z.infer { - return super.parse(EventBridgeSchema.parse(data).detail, schema); - } +export const EventBridgeEnvelope = { + parse(data: unknown, schema: T): z.infer { + return Envelope.parse(EventBridgeSchema.parse(data).detail, schema); + }, - public static safeParse( - data: unknown, - schema: T - ): ParsedResult { + safeParse(data: unknown, schema: T): ParsedResult { const parsedEnvelope = EventBridgeSchema.safeParse(data); if (!parsedEnvelope.success) { @@ -31,7 +25,7 @@ export class EventBridgeEnvelope extends Envelope { }; } - const parsedDetail = super.safeParse(parsedEnvelope.data.detail, schema); + const parsedDetail = Envelope.safeParse(parsedEnvelope.data.detail, schema); if (!parsedDetail.success) { return { @@ -44,5 +38,5 @@ export class EventBridgeEnvelope extends Envelope { } return parsedDetail; - } -} + }, +}; diff --git a/packages/parser/src/envelopes/kafka.ts b/packages/parser/src/envelopes/kafka.ts index c64bb13355..252ff3ea55 100644 --- a/packages/parser/src/envelopes/kafka.ts +++ b/packages/parser/src/envelopes/kafka.ts @@ -1,11 +1,11 @@ -import { z, type ZodSchema } from 'zod'; -import { Envelope } from './envelope.js'; +import type { ZodSchema, z } from 'zod'; +import { ParseError } from '../errors.js'; import { KafkaMskEventSchema, KafkaSelfManagedEventSchema, } from '../schemas/kafka.js'; -import { ParsedResult, KafkaMskEvent } from '../types/index.js'; -import { ParseError } from '../errors.js'; +import type { KafkaMskEvent, ParsedResult } from '../types/index.js'; +import { Envelope } from './envelope.js'; /** * Kafka event envelope to extract data within body key @@ -16,13 +16,10 @@ import { ParseError } from '../errors.js'; * all items in the list will be parsed as str and not as JSON (and vice versa) */ -export class KafkaEnvelope extends Envelope { - public static parse( - data: unknown, - schema: T - ): z.infer[] { +export const KafkaEnvelope = { + parse(data: unknown, schema: T): z.infer[] { // manually fetch event source to deside between Msk or SelfManaged - const eventSource = (data as KafkaMskEvent)['eventSource']; + const eventSource = (data as KafkaMskEvent).eventSource; const parsedEnvelope: | z.infer @@ -33,17 +30,14 @@ export class KafkaEnvelope extends Envelope { return Object.values(parsedEnvelope.records).map((topicRecord) => { return topicRecord.map((record) => { - return super.parse(record.value, schema); + return Envelope.parse(record.value, schema); }); }); - } + }, - public static safeParse( - data: unknown, - schema: T - ): ParsedResult { + safeParse(data: unknown, schema: T): ParsedResult { // manually fetch event source to deside between Msk or SelfManaged - const eventSource = (data as KafkaMskEvent)['eventSource']; + const eventSource = (data as KafkaMskEvent).eventSource; const parsedEnvelope = eventSource === 'aws:kafka' @@ -63,7 +57,7 @@ export class KafkaEnvelope extends Envelope { for (const topicRecord of Object.values(parsedEnvelope.data.records)) { for (const record of topicRecord) { - const parsedRecord = super.safeParse(record.value, schema); + const parsedRecord = Envelope.safeParse(record.value, schema); if (!parsedRecord.success) { return { success: false, @@ -81,5 +75,5 @@ export class KafkaEnvelope extends Envelope { success: true, data: parsedRecords, }; - } -} + }, +}; diff --git a/packages/parser/src/envelopes/kinesis-firehose.ts b/packages/parser/src/envelopes/kinesis-firehose.ts index 3517e3846f..dd543f82b3 100644 --- a/packages/parser/src/envelopes/kinesis-firehose.ts +++ b/packages/parser/src/envelopes/kinesis-firehose.ts @@ -1,8 +1,8 @@ -import { z, type ZodSchema } from 'zod'; -import { Envelope } from './envelope.js'; +import type { ZodSchema, z } from 'zod'; +import { ParseError } from '../errors.js'; import { KinesisFirehoseSchema } from '../schemas/index.js'; import type { ParsedResult } from '../types/index.js'; -import { ParseError } from '../errors.js'; +import { Envelope } from './envelope.js'; /** * Kinesis Firehose Envelope to extract array of Records @@ -16,22 +16,16 @@ import { ParseError } from '../errors.js'; * * https://docs.aws.amazon.com/lambda/latest/dg/services-kinesisfirehose.html */ -export class KinesisFirehoseEnvelope extends Envelope { - public static parse( - data: unknown, - schema: T - ): z.infer[] { +export const KinesisFirehoseEnvelope = { + parse(data: unknown, schema: T): z.infer[] { const parsedEnvelope = KinesisFirehoseSchema.parse(data); return parsedEnvelope.records.map((record) => { - return super.parse(record.data, schema); + return Envelope.parse(record.data, schema); }); - } + }, - public static safeParse( - data: unknown, - schema: T - ): ParsedResult { + safeParse(data: unknown, schema: T): ParsedResult { const parsedEnvelope = KinesisFirehoseSchema.safeParse(data); if (!parsedEnvelope.success) { @@ -46,7 +40,7 @@ export class KinesisFirehoseEnvelope extends Envelope { const parsedRecords: z.infer[] = []; for (const record of parsedEnvelope.data.records) { - const parsedData = super.safeParse(record.data, schema); + const parsedData = Envelope.safeParse(record.data, schema); if (!parsedData.success) { return { success: false, @@ -63,5 +57,5 @@ export class KinesisFirehoseEnvelope extends Envelope { success: true, data: parsedRecords, }; - } -} + }, +}; diff --git a/packages/parser/src/envelopes/kinesis.ts b/packages/parser/src/envelopes/kinesis.ts index 9b1f1a14b1..480addb756 100644 --- a/packages/parser/src/envelopes/kinesis.ts +++ b/packages/parser/src/envelopes/kinesis.ts @@ -1,8 +1,8 @@ -import { Envelope } from './envelope.js'; -import { z, type ZodSchema } from 'zod'; +import type { ZodSchema, z } from 'zod'; +import { ParseError } from '../errors.js'; import { KinesisDataStreamSchema } from '../schemas/kinesis.js'; import type { ParsedResult } from '../types/index.js'; -import { ParseError } from '../errors.js'; +import { Envelope } from './envelope.js'; /** * Kinesis Data Stream Envelope to extract array of Records @@ -14,22 +14,16 @@ import { ParseError } from '../errors.js'; * Note: Records will be parsed the same way so if model is str, * all items in the list will be parsed as str and not as JSON (and vice versa) */ -export class KinesisEnvelope extends Envelope { - public static parse( - data: unknown, - schema: T - ): z.infer[] { +export const KinesisEnvelope = { + parse(data: unknown, schema: T): z.infer[] { const parsedEnvelope = KinesisDataStreamSchema.parse(data); return parsedEnvelope.Records.map((record) => { - return super.parse(record.kinesis.data, schema); + return Envelope.parse(record.kinesis.data, schema); }); - } + }, - public static safeParse( - data: unknown, - schema: T - ): ParsedResult { + safeParse(data: unknown, schema: T): ParsedResult { const parsedEnvelope = KinesisDataStreamSchema.safeParse(data); if (!parsedEnvelope.success) { return { @@ -44,7 +38,7 @@ export class KinesisEnvelope extends Envelope { const parsedRecords: z.infer[] = []; for (const record of parsedEnvelope.data.Records) { - const parsedRecord = super.safeParse(record.kinesis.data, schema); + const parsedRecord = Envelope.safeParse(record.kinesis.data, schema); if (!parsedRecord.success) { return { success: false, @@ -61,5 +55,5 @@ export class KinesisEnvelope extends Envelope { success: true, data: parsedRecords, }; - } -} + }, +}; diff --git a/packages/parser/src/envelopes/lambda.ts b/packages/parser/src/envelopes/lambda.ts index a86a2871fd..69bf1447c5 100644 --- a/packages/parser/src/envelopes/lambda.ts +++ b/packages/parser/src/envelopes/lambda.ts @@ -1,30 +1,24 @@ -import { Envelope } from './envelope.js'; -import { z, type ZodSchema } from 'zod'; +import type { ZodSchema, z } from 'zod'; +import { ParseError } from '../errors.js'; import { LambdaFunctionUrlSchema } from '../schemas/index.js'; import type { ParsedResult } from '../types/index.js'; -import { ParseError } from '../errors.js'; +import { Envelope } from './envelope.js'; /** * Lambda function URL envelope to extract data within body key */ -export class LambdaFunctionUrlEnvelope extends Envelope { - public static parse( - data: unknown, - schema: T - ): z.infer { +export const LambdaFunctionUrlEnvelope = { + parse(data: unknown, schema: T): z.infer { const parsedEnvelope = LambdaFunctionUrlSchema.parse(data); if (!parsedEnvelope.body) { throw new Error('Body field of Lambda function URL event is undefined'); } - return super.parse(parsedEnvelope.body, schema); - } + return Envelope.parse(parsedEnvelope.body, schema); + }, - public static safeParse( - data: unknown, - schema: T - ): ParsedResult { + safeParse(data: unknown, schema: T): ParsedResult { const parsedEnvelope = LambdaFunctionUrlSchema.safeParse(data); if (!parsedEnvelope.success) { @@ -35,7 +29,7 @@ export class LambdaFunctionUrlEnvelope extends Envelope { }; } - const parsedBody = super.safeParse(parsedEnvelope.data.body, schema); + const parsedBody = Envelope.safeParse(parsedEnvelope.data.body, schema); if (!parsedBody.success) { return { success: false, @@ -47,5 +41,5 @@ export class LambdaFunctionUrlEnvelope extends Envelope { } return parsedBody; - } -} + }, +}; diff --git a/packages/parser/src/envelopes/sns.ts b/packages/parser/src/envelopes/sns.ts index 39ea83fdc4..bf3f7aedf0 100644 --- a/packages/parser/src/envelopes/sns.ts +++ b/packages/parser/src/envelopes/sns.ts @@ -1,9 +1,9 @@ -import { z, type ZodSchema } from 'zod'; -import { Envelope } from './envelope.js'; +import type { ZodSchema, z } from 'zod'; +import { ParseError } from '../errors.js'; import { SnsSchema, SnsSqsNotificationSchema } from '../schemas/sns.js'; import { SqsSchema } from '../schemas/sqs.js'; import type { ParsedResult } from '../types/index.js'; -import { ParseError } from '../errors.js'; +import { Envelope } from './envelope.js'; /** * SNS Envelope to extract array of Records @@ -14,28 +14,22 @@ import { ParseError } from '../errors.js'; * Note: Records will be parsed the same way so if model is str, * all items in the list will be parsed as str and npt as JSON (and vice versa) */ -export class SnsEnvelope extends Envelope { - public static parse( - data: unknown, - schema: T - ): z.infer[] { +export const SnsEnvelope = { + parse(data: unknown, schema: T): z.infer[] { const parsedEnvelope = SnsSchema.parse(data); return parsedEnvelope.Records.map((record) => { - return super.parse(record.Sns.Message, schema); + return Envelope.parse(record.Sns.Message, schema); }); - } + }, - public static safeParse( - data: unknown, - schema: T - ): ParsedResult { + safeParse(data: unknown, schema: T): ParsedResult { const parsedEnvelope = SnsSchema.safeParse(data); if (!parsedEnvelope.success) { return { success: false, - error: new ParseError(`Failed to parse SNS envelope`, { + error: new ParseError('Failed to parse SNS envelope', { cause: parsedEnvelope.error, }), originalEvent: data, @@ -44,11 +38,11 @@ export class SnsEnvelope extends Envelope { const parsedMessages: z.infer[] = []; for (const record of parsedEnvelope.data.Records) { - const parsedMessage = super.safeParse(record.Sns.Message, schema); + const parsedMessage = Envelope.safeParse(record.Sns.Message, schema); if (!parsedMessage.success) { return { success: false, - error: new ParseError(`Failed to parse SNS message`, { + error: new ParseError('Failed to parse SNS message', { cause: parsedMessage.error, }), originalEvent: data, @@ -61,8 +55,8 @@ export class SnsEnvelope extends Envelope { success: true, data: parsedMessages, }; - } -} + }, +}; /** * SNS plus SQS Envelope to extract array of Records @@ -75,11 +69,8 @@ export class SnsEnvelope extends Envelope { * 3. Finally, parse provided model against payload extracted * */ -export class SnsSqsEnvelope extends Envelope { - public static parse( - data: unknown, - schema: T - ): z.infer { +export const SnsSqsEnvelope = { + parse(data: unknown, schema: T): z.infer { const parsedEnvelope = SqsSchema.parse(data); return parsedEnvelope.Records.map((record) => { @@ -87,19 +78,16 @@ export class SnsSqsEnvelope extends Envelope { JSON.parse(record.body) ); - return super.parse(snsNotification.Message, schema); + return Envelope.parse(snsNotification.Message, schema); }); - } + }, - public static safeParse( - data: unknown, - schema: T - ): ParsedResult { + safeParse(data: unknown, schema: T): ParsedResult { const parsedEnvelope = SqsSchema.safeParse(data); if (!parsedEnvelope.success) { return { success: false, - error: new ParseError(`Failed to parse SQS envelope`, { + error: new ParseError('Failed to parse SQS envelope', { cause: parsedEnvelope.error, }), originalEvent: data, @@ -117,20 +105,20 @@ export class SnsSqsEnvelope extends Envelope { if (!snsNotification.success) { return { success: false, - error: new ParseError(`Failed to parse SNS notification`, { + error: new ParseError('Failed to parse SNS notification', { cause: snsNotification.error, }), originalEvent: data, }; } - const parsedMessage = super.safeParse( + const parsedMessage = Envelope.safeParse( snsNotification.data.Message, schema ); if (!parsedMessage.success) { return { success: false, - error: new ParseError(`Failed to parse SNS message`, { + error: new ParseError('Failed to parse SNS message', { cause: parsedMessage.error, }), originalEvent: data, @@ -147,5 +135,5 @@ export class SnsSqsEnvelope extends Envelope { } return { success: true, data: parsedMessages }; - } -} + }, +}; diff --git a/packages/parser/src/envelopes/sqs.ts b/packages/parser/src/envelopes/sqs.ts index 93434d823b..95de353b46 100644 --- a/packages/parser/src/envelopes/sqs.ts +++ b/packages/parser/src/envelopes/sqs.ts @@ -1,8 +1,8 @@ -import { z, type ZodSchema } from 'zod'; +import type { ZodSchema, z } from 'zod'; +import { ParseError } from '../errors.js'; import { SqsSchema } from '../schemas/sqs.js'; -import { Envelope } from './envelope.js'; import type { ParsedResult } from '../types/index.js'; -import { ParseError } from '../errors.js'; +import { Envelope } from './envelope.js'; /** * SQS Envelope to extract array of Records @@ -13,22 +13,16 @@ import { ParseError } from '../errors.js'; * Note: Records will be parsed the same way so if model is str, * all items in the list will be parsed as str and npt as JSON (and vice versa) */ -export class SqsEnvelope extends Envelope { - public static parse( - data: unknown, - schema: T - ): z.infer[] { +export const SqsEnvelope = { + parse(data: unknown, schema: T): z.infer[] { const parsedEnvelope = SqsSchema.parse(data); return parsedEnvelope.Records.map((record) => { - return super.parse(record.body, schema); + return Envelope.parse(record.body, schema); }); - } + }, - public static safeParse( - data: unknown, - schema: T - ): ParsedResult { + safeParse(data: unknown, schema: T): ParsedResult { const parsedEnvelope = SqsSchema.safeParse(data); if (!parsedEnvelope.success) { return { @@ -42,7 +36,7 @@ export class SqsEnvelope extends Envelope { const parsedRecords: z.infer[] = []; for (const record of parsedEnvelope.data.Records) { - const parsedRecord = super.safeParse(record.body, schema); + const parsedRecord = Envelope.safeParse(record.body, schema); if (!parsedRecord.success) { return { success: false, @@ -56,5 +50,5 @@ export class SqsEnvelope extends Envelope { } return { success: true, data: parsedRecords }; - } -} + }, +}; diff --git a/packages/parser/src/envelopes/vpc-lattice.ts b/packages/parser/src/envelopes/vpc-lattice.ts index 2bdb69bac3..8c2124281b 100644 --- a/packages/parser/src/envelopes/vpc-lattice.ts +++ b/packages/parser/src/envelopes/vpc-lattice.ts @@ -1,27 +1,21 @@ -import { z, type ZodSchema } from 'zod'; -import { Envelope } from './envelope.js'; +import type { ZodSchema, z } from 'zod'; +import { ParseError } from '../errors.js'; import { VpcLatticeSchema } from '../schemas/index.js'; import type { ParsedResult } from '../types/index.js'; -import { ParseError } from '../errors.js'; +import { Envelope } from './envelope.js'; /** * Amazon VPC Lattice envelope to extract data within body key */ -export class VpcLatticeEnvelope extends Envelope { - public static parse( - data: unknown, - schema: T - ): z.infer { +export const VpcLatticeEnvelope = { + parse(data: unknown, schema: T): z.infer { const parsedEnvelope = VpcLatticeSchema.parse(data); - return super.parse(parsedEnvelope.body, schema); - } + return Envelope.parse(parsedEnvelope.body, schema); + }, - public static safeParse( - data: unknown, - schema: T - ): ParsedResult { + safeParse(data: unknown, schema: T): ParsedResult { const parsedEnvelope = VpcLatticeSchema.safeParse(data); if (!parsedEnvelope.success) { return { @@ -33,7 +27,7 @@ export class VpcLatticeEnvelope extends Envelope { }; } - const parsedBody = super.safeParse(parsedEnvelope.data.body, schema); + const parsedBody = Envelope.safeParse(parsedEnvelope.data.body, schema); if (!parsedBody.success) { return { @@ -46,5 +40,5 @@ export class VpcLatticeEnvelope extends Envelope { } return parsedBody; - } -} + }, +}; diff --git a/packages/parser/src/envelopes/vpc-latticev2.ts b/packages/parser/src/envelopes/vpc-latticev2.ts index e9fd0c3c2a..a184b1c6fa 100644 --- a/packages/parser/src/envelopes/vpc-latticev2.ts +++ b/packages/parser/src/envelopes/vpc-latticev2.ts @@ -1,26 +1,20 @@ -import { Envelope } from './envelope.js'; -import { z, type ZodSchema } from 'zod'; +import type { ZodSchema, z } from 'zod'; +import { ParseError } from '../errors.js'; import { VpcLatticeV2Schema } from '../schemas/index.js'; import type { ParsedResult } from '../types/index.js'; -import { ParseError } from '../errors.js'; +import { Envelope } from './envelope.js'; /** * Amazon VPC Lattice envelope to extract data within body key */ -export class VpcLatticeV2Envelope extends Envelope { - public static parse( - data: unknown, - schema: T - ): z.infer { +export const VpcLatticeV2Envelope = { + parse(data: unknown, schema: T): z.infer { const parsedEnvelope = VpcLatticeV2Schema.parse(data); - return super.parse(parsedEnvelope.body, schema); - } + return Envelope.parse(parsedEnvelope.body, schema); + }, - public static safeParse( - data: unknown, - schema: T - ): ParsedResult { + safeParse(data: unknown, schema: T): ParsedResult { const parsedEnvelope = VpcLatticeV2Schema.safeParse(data); if (!parsedEnvelope.success) { return { @@ -32,7 +26,7 @@ export class VpcLatticeV2Envelope extends Envelope { }; } - const parsedBody = super.safeParse(parsedEnvelope.data.body, schema); + const parsedBody = Envelope.safeParse(parsedEnvelope.data.body, schema); if (!parsedBody.success) { return { @@ -45,5 +39,5 @@ export class VpcLatticeV2Envelope extends Envelope { } return parsedBody; - } -} + }, +}; diff --git a/packages/parser/src/middleware/parser.ts b/packages/parser/src/middleware/parser.ts index dcaa2b5c26..f411bc119b 100644 --- a/packages/parser/src/middleware/parser.ts +++ b/packages/parser/src/middleware/parser.ts @@ -1,9 +1,9 @@ -import { type MiddyLikeRequest } from '@aws-lambda-powertools/commons/types'; -import { type MiddlewareObj } from '@middy/core'; -import { ZodType } from 'zod'; -import type { ParserOptions, ParserOutput } from '../types/parser.js'; +import type { MiddyLikeRequest } from '@aws-lambda-powertools/commons/types'; +import type { MiddlewareObj } from '@middy/core'; +import type { ZodType } from 'zod'; import { parse } from '../parser.js'; import type { Envelope } from '../types/envelope.js'; +import type { ParserOptions, ParserOutput } from '../types/parser.js'; /** * A middiy middleware to parse your event. diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index 9a307dc1f5..43c8ad09c8 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -1,6 +1,6 @@ -import type { ParsedResult, Envelope } from './types/index.js'; -import { z, type ZodSchema } from 'zod'; +import type { ZodSchema, z } from 'zod'; import { ParseError } from './errors.js'; +import type { Envelope, ParsedResult } from './types/index.js'; /** * Parse the data using the provided schema, envelope and safeParse flag diff --git a/packages/parser/src/parserDecorator.ts b/packages/parser/src/parserDecorator.ts index dabe8ff611..0e9ee7ed87 100644 --- a/packages/parser/src/parserDecorator.ts +++ b/packages/parser/src/parserDecorator.ts @@ -1,8 +1,8 @@ import type { HandlerMethodDecorator } from '@aws-lambda-powertools/commons/types'; import type { Context, Handler } from 'aws-lambda'; -import { type ZodSchema } from 'zod'; +import type { ZodSchema } from 'zod'; import { parse } from './parser.js'; -import type { ParserOptions, Envelope } from './types/index.js'; +import type { Envelope, ParserOptions } from './types/index.js'; import type { ParserOutput } from './types/parser.js'; /** @@ -76,6 +76,7 @@ export const parser = < options: ParserOptions ): HandlerMethodDecorator => { return (_target, _propertyKey, descriptor) => { + // biome-ignore lint/style/noNonNullAssertion: The descriptor.value is the method this decorator decorates, it cannot be undefined. const original = descriptor.value!; const { schema, envelope, safeParse } = options; diff --git a/packages/parser/src/schemas/apigw.ts b/packages/parser/src/schemas/apigw.ts index 53558736f2..8e7e3d1d7c 100644 --- a/packages/parser/src/schemas/apigw.ts +++ b/packages/parser/src/schemas/apigw.ts @@ -1,9 +1,9 @@ import { z } from 'zod'; import { APIGatewayCert, + APIGatewayHttpMethod, APIGatewayRecord, APIGatewayStringArray, - APIGatewayHttpMethod, } from './apigw-proxy.js'; /** diff --git a/packages/parser/src/schemas/cloudwatch.ts b/packages/parser/src/schemas/cloudwatch.ts index 941ea6330e..d6bfd77078 100644 --- a/packages/parser/src/schemas/cloudwatch.ts +++ b/packages/parser/src/schemas/cloudwatch.ts @@ -1,5 +1,5 @@ -import { z } from 'zod'; import { gunzipSync } from 'node:zlib'; +import { z } from 'zod'; const CloudWatchLogEventSchema = z.object({ id: z.string(), diff --git a/packages/parser/src/schemas/kinesis.ts b/packages/parser/src/schemas/kinesis.ts index 041b378f6a..558edd9925 100644 --- a/packages/parser/src/schemas/kinesis.ts +++ b/packages/parser/src/schemas/kinesis.ts @@ -1,5 +1,5 @@ -import { z } from 'zod'; import { gunzipSync } from 'node:zlib'; +import { z } from 'zod'; const KinesisDataStreamRecordPayload = z.object({ kinesisSchemaVersion: z.string(), diff --git a/packages/parser/src/schemas/s3.ts b/packages/parser/src/schemas/s3.ts index 38729824b2..68c77a9755 100644 --- a/packages/parser/src/schemas/s3.ts +++ b/packages/parser/src/schemas/s3.ts @@ -40,30 +40,18 @@ const S3EventRecordGlacierEventData = z.object({ }), }); -const S3RecordSchema = z - .object({ - eventVersion: z.string(), - eventSource: z.literal('aws:s3'), - awsRegion: z.string(), - eventTime: z.string().datetime(), - eventName: z.string(), - userIdentity: S3Identity, - requestParameters: S3RequestParameters, - responseElements: S3ResponseElements, - s3: S3Message, - glacierEventData: z.optional(S3EventRecordGlacierEventData), - }) - .refine((value) => { - return ( - (!value.eventName.includes('ObjectRemoved') && - value.s3.object.size === undefined) || - value.s3.object.eTag === undefined, - { - message: - 'S3 event notification with ObjectRemoved event name must have size or eTag defined', - } - ); - }); +const S3RecordSchema = z.object({ + eventVersion: z.string(), + eventSource: z.literal('aws:s3'), + awsRegion: z.string(), + eventTime: z.string().datetime(), + eventName: z.string(), + userIdentity: S3Identity, + requestParameters: S3RequestParameters, + responseElements: S3ResponseElements, + s3: S3Message, + glacierEventData: z.optional(S3EventRecordGlacierEventData), +}); const S3EventNotificationEventBridgeDetailSchema = z.object({ version: z.string(), diff --git a/packages/parser/src/types/envelope.ts b/packages/parser/src/types/envelope.ts index b41f6e2bf4..8be125d144 100644 --- a/packages/parser/src/types/envelope.ts +++ b/packages/parser/src/types/envelope.ts @@ -1,12 +1,13 @@ +import type { ZodSchema, z } from 'zod'; import type { ApiGatewayEnvelope, - KinesisFirehoseEnvelope, - KinesisEnvelope, - KafkaEnvelope, - CloudWatchEnvelope, - EventBridgeEnvelope, ApiGatewayV2Envelope, + CloudWatchEnvelope, DynamoDBStreamEnvelope, + EventBridgeEnvelope, + KafkaEnvelope, + KinesisEnvelope, + KinesisFirehoseEnvelope, LambdaFunctionUrlEnvelope, SnsEnvelope, SnsSqsEnvelope, @@ -14,7 +15,6 @@ import type { VpcLatticeEnvelope, VpcLatticeV2Envelope, } from '../envelopes/index.js'; -import { z, type ZodSchema } from 'zod'; type DynamoDBStreamEnvelopeResponse = { NewImage: z.infer; diff --git a/packages/parser/src/types/parser.ts b/packages/parser/src/types/parser.ts index b82a1b145a..b0e4f79018 100644 --- a/packages/parser/src/types/parser.ts +++ b/packages/parser/src/types/parser.ts @@ -1,4 +1,4 @@ -import { type ZodSchema, type ZodError, z } from 'zod'; +import type { ZodError, ZodSchema, z } from 'zod'; import type { Envelope, EnvelopeArrayReturnType } from './envelope.js'; /** diff --git a/packages/parser/src/types/schema.ts b/packages/parser/src/types/schema.ts index 91574fe37b..4d658c8513 100644 --- a/packages/parser/src/types/schema.ts +++ b/packages/parser/src/types/schema.ts @@ -1,30 +1,30 @@ -import { z } from 'zod'; -import { - AlbSchema, - AlbMultiValueHeadersSchema, +import type { z } from 'zod'; +import type { APIGatewayProxyEventSchema, APIGatewayProxyEventV2Schema, + AlbMultiValueHeadersSchema, + AlbSchema, CloudFormationCustomResourceCreateSchema, CloudFormationCustomResourceDeleteSchema, CloudFormationCustomResourceUpdateSchema, CloudWatchLogsSchema, DynamoDBStreamSchema, EventBridgeSchema, - KafkaSelfManagedEventSchema, KafkaMskEventSchema, + KafkaSelfManagedEventSchema, KinesisDataStreamSchema, KinesisFirehoseSchema, KinesisFirehoseSqsSchema, LambdaFunctionUrlSchema, - S3Schema, S3EventNotificationEventBridgeSchema, + S3ObjectLambdaEventSchema, + S3Schema, S3SqsEventNotificationSchema, SesSchema, SnsSchema, SqsSchema, VpcLatticeSchema, VpcLatticeV2Schema, - S3ObjectLambdaEventSchema, } from '../schemas/index.js'; type ALBEvent = z.infer; diff --git a/packages/parser/tests/events/activeMQEvent.json b/packages/parser/tests/events/activeMQEvent.json index 57417cfd22..555ed78e1f 100644 --- a/packages/parser/tests/events/activeMQEvent.json +++ b/packages/parser/tests/events/activeMQEvent.json @@ -33,7 +33,6 @@ "properties": { "testKey": "testValue" } - }, { "messageID": "ID:b-9bcfa592-423a-4942-879d-eb284b418fc8-1.mq.us-west-2.amazonaws.com-37557-1234520418293-4:1:1:1:1", diff --git a/packages/parser/tests/events/albEventPathTrailingSlash.json b/packages/parser/tests/events/albEventPathTrailingSlash.json index c517a3f6b0..d365fa84b2 100644 --- a/packages/parser/tests/events/albEventPathTrailingSlash.json +++ b/packages/parser/tests/events/albEventPathTrailingSlash.json @@ -1,28 +1,28 @@ { - "requestContext": { - "elb": { - "targetGroupArn": "arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/lambda-279XGJDqGZ5rsrHC2Fjr/49e9d65c45c6791a" - } - }, - "httpMethod": "GET", - "path": "/lambda/", - "queryStringParameters": { - "query": "1234ABCD" - }, - "headers": { - "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "accept-encoding": "gzip", - "accept-language": "en-US,en;q=0.9", - "connection": "keep-alive", - "host": "lambda-alb-123578498.us-east-2.elb.amazonaws.com", - "upgrade-insecure-requests": "1", - "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36", - "x-amzn-trace-id": "Root=1-5c536348-3d683b8b04734faae651f476", - "x-forwarded-for": "72.12.164.125", - "x-forwarded-port": "80", - "x-forwarded-proto": "http", - "x-imforwards": "20" - }, - "body": "Test", - "isBase64Encoded": false - } \ No newline at end of file + "requestContext": { + "elb": { + "targetGroupArn": "arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/lambda-279XGJDqGZ5rsrHC2Fjr/49e9d65c45c6791a" + } + }, + "httpMethod": "GET", + "path": "/lambda/", + "queryStringParameters": { + "query": "1234ABCD" + }, + "headers": { + "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "accept-encoding": "gzip", + "accept-language": "en-US,en;q=0.9", + "connection": "keep-alive", + "host": "lambda-alb-123578498.us-east-2.elb.amazonaws.com", + "upgrade-insecure-requests": "1", + "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36", + "x-amzn-trace-id": "Root=1-5c536348-3d683b8b04734faae651f476", + "x-forwarded-for": "72.12.164.125", + "x-forwarded-port": "80", + "x-forwarded-proto": "http", + "x-imforwards": "20" + }, + "body": "Test", + "isBase64Encoded": false +} diff --git a/packages/parser/tests/events/albMultiValueHeadersEvent.json b/packages/parser/tests/events/albMultiValueHeadersEvent.json index 6b34709605..67421f5130 100644 --- a/packages/parser/tests/events/albMultiValueHeadersEvent.json +++ b/packages/parser/tests/events/albMultiValueHeadersEvent.json @@ -8,27 +8,15 @@ "path": "/todos", "multiValueQueryStringParameters": {}, "multiValueHeaders": { - "accept": [ - "*/*" - ], + "accept": ["*/*"], "host": [ "alb-c-LoadB-14POFKYCLBNSF-1815800096.eu-central-1.elb.amazonaws.com" ], - "user-agent": [ - "curl/7.79.1" - ], - "x-amzn-trace-id": [ - "Root=1-62fa9327-21cdd4da4c6db451490a5fb7" - ], - "x-forwarded-for": [ - "123.123.123.123" - ], - "x-forwarded-port": [ - "80" - ], - "x-forwarded-proto": [ - "http" - ] + "user-agent": ["curl/7.79.1"], + "x-amzn-trace-id": ["Root=1-62fa9327-21cdd4da4c6db451490a5fb7"], + "x-forwarded-for": ["123.123.123.123"], + "x-forwarded-port": ["80"], + "x-forwarded-proto": ["http"] }, "body": "", "isBase64Encoded": false diff --git a/packages/parser/tests/events/apiGatewayProxyEvent.json b/packages/parser/tests/events/apiGatewayProxyEvent.json index 4d2fb62399..5a40bf2f42 100644 --- a/packages/parser/tests/events/apiGatewayProxyEvent.json +++ b/packages/parser/tests/events/apiGatewayProxyEvent.json @@ -9,26 +9,16 @@ "Origin": "https://aws.amazon.com" }, "multiValueHeaders": { - "Header1": [ - "value1" - ], - "Header2": [ - "value1", - "value2" - ] + "Header1": ["value1"], + "Header2": ["value1", "value2"] }, "queryStringParameters": { "parameter1": "value1", "parameter2": "value" }, "multiValueQueryStringParameters": { - "parameter1": [ - "value1", - "value2" - ], - "parameter2": [ - "value" - ] + "parameter1": ["value1", "value2"], + "parameter2": ["value"] }, "requestContext": { "accountId": "123456789012", @@ -78,4 +68,4 @@ "stageVariables": null, "body": "Hello from Lambda!", "isBase64Encoded": false -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apiGatewayProxyEventAnotherPath.json b/packages/parser/tests/events/apiGatewayProxyEventAnotherPath.json index 660118a2f9..cc8b236234 100644 --- a/packages/parser/tests/events/apiGatewayProxyEventAnotherPath.json +++ b/packages/parser/tests/events/apiGatewayProxyEventAnotherPath.json @@ -8,26 +8,16 @@ "Header2": "value2" }, "multiValueHeaders": { - "Header1": [ - "value1" - ], - "Header2": [ - "value1", - "value2" - ] + "Header1": ["value1"], + "Header2": ["value1", "value2"] }, "queryStringParameters": { "parameter1": "value1", "parameter2": "value" }, "multiValueQueryStringParameters": { - "parameter1": [ - "value1", - "value2" - ], - "parameter2": [ - "value" - ] + "parameter1": ["value1", "value2"], + "parameter2": ["value"] }, "requestContext": { "accountId": "123456789012", @@ -77,4 +67,4 @@ "stageVariables": null, "body": "Hello from Lambda!", "isBase64Encoded": true -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apiGatewayProxyEventPathTrailingSlash.json b/packages/parser/tests/events/apiGatewayProxyEventPathTrailingSlash.json index ced73da8c9..2de7ae409b 100644 --- a/packages/parser/tests/events/apiGatewayProxyEventPathTrailingSlash.json +++ b/packages/parser/tests/events/apiGatewayProxyEventPathTrailingSlash.json @@ -1,80 +1,70 @@ { - "version": "1.0", - "resource": "/my/path", - "path": "/my/path/", - "httpMethod": "GET", - "headers": { - "Header1": "value1", - "Header2": "value2" - }, - "multiValueHeaders": { - "Header1": [ - "value1" - ], - "Header2": [ - "value1", - "value2" - ] - }, - "queryStringParameters": { - "parameter1": "value1", - "parameter2": "value" + "version": "1.0", + "resource": "/my/path", + "path": "/my/path/", + "httpMethod": "GET", + "headers": { + "Header1": "value1", + "Header2": "value2" + }, + "multiValueHeaders": { + "Header1": ["value1"], + "Header2": ["value1", "value2"] + }, + "queryStringParameters": { + "parameter1": "value1", + "parameter2": "value" + }, + "multiValueQueryStringParameters": { + "parameter1": ["value1", "value2"], + "parameter2": ["value"] + }, + "requestContext": { + "accountId": "123456789012", + "apiId": "id", + "authorizer": { + "claims": null, + "scopes": null }, - "multiValueQueryStringParameters": { - "parameter1": [ - "value1", - "value2" - ], - "parameter2": [ - "value" - ] - }, - "requestContext": { - "accountId": "123456789012", - "apiId": "id", - "authorizer": { - "claims": null, - "scopes": null - }, - "domainName": "id.execute-api.us-east-1.amazonaws.com", - "domainPrefix": "id", - "extendedRequestId": "request-id", - "httpMethod": "GET", - "identity": { - "accessKey": null, - "accountId": null, - "caller": null, - "cognitoAuthenticationProvider": null, - "cognitoAuthenticationType": null, - "cognitoIdentityId": null, - "cognitoIdentityPoolId": null, - "principalOrgId": null, - "sourceIp": "192.168.0.1", - "user": null, - "userAgent": "user-agent", - "userArn": null, - "clientCert": { - "clientCertPem": "CERT_CONTENT", - "subjectDN": "www.example.com", - "issuerDN": "Example issuer", - "serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1", - "validity": { - "notBefore": "May 28 12:30:02 2019 GMT", - "notAfter": "Aug 5 09:36:04 2021 GMT" - } + "domainName": "id.execute-api.us-east-1.amazonaws.com", + "domainPrefix": "id", + "extendedRequestId": "request-id", + "httpMethod": "GET", + "identity": { + "accessKey": null, + "accountId": null, + "caller": null, + "cognitoAuthenticationProvider": null, + "cognitoAuthenticationType": null, + "cognitoIdentityId": null, + "cognitoIdentityPoolId": null, + "principalOrgId": null, + "sourceIp": "192.168.0.1", + "user": null, + "userAgent": "user-agent", + "userArn": null, + "clientCert": { + "clientCertPem": "CERT_CONTENT", + "subjectDN": "www.example.com", + "issuerDN": "Example issuer", + "serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1", + "validity": { + "notBefore": "May 28 12:30:02 2019 GMT", + "notAfter": "Aug 5 09:36:04 2021 GMT" } - }, - "path": "/my/path", - "protocol": "HTTP/1.1", - "requestId": "id=", - "requestTime": "04/Mar/2020:19:15:17 +0000", - "requestTimeEpoch": 1583349317135, - "resourceId": null, - "resourcePath": "/my/path", - "stage": "$default" + } }, - "pathParameters": null, - "stageVariables": null, - "body": "Hello from Lambda!", - "isBase64Encoded": true - } \ No newline at end of file + "path": "/my/path", + "protocol": "HTTP/1.1", + "requestId": "id=", + "requestTime": "04/Mar/2020:19:15:17 +0000", + "requestTimeEpoch": 1583349317135, + "resourceId": null, + "resourcePath": "/my/path", + "stage": "$default" + }, + "pathParameters": null, + "stageVariables": null, + "body": "Hello from Lambda!", + "isBase64Encoded": true +} diff --git a/packages/parser/tests/events/apiGatewayProxyEventTestUI.json b/packages/parser/tests/events/apiGatewayProxyEventTestUI.json index 0b8cbe1e51..4c4b53557f 100644 --- a/packages/parser/tests/events/apiGatewayProxyEventTestUI.json +++ b/packages/parser/tests/events/apiGatewayProxyEventTestUI.json @@ -9,26 +9,16 @@ "Origin": "https://aws.amazon.com" }, "multiValueHeaders": { - "Header1": [ - "value1" - ], - "Header2": [ - "value1", - "value2" - ] + "Header1": ["value1"], + "Header2": ["value1", "value2"] }, "queryStringParameters": { "parameter1": "value1", "parameter2": "value" }, "multiValueQueryStringParameters": { - "parameter1": [ - "value1", - "value2" - ], - "parameter2": [ - "value" - ] + "parameter1": ["value1", "value2"], + "parameter2": ["value"] }, "requestContext": { "accountId": "123456789012", @@ -78,4 +68,4 @@ "stageVariables": null, "body": "Hello from Lambda!", "isBase64Encoded": false -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apiGatewayProxyEvent_noVersionAuth.json b/packages/parser/tests/events/apiGatewayProxyEvent_noVersionAuth.json index 3a4af1ae9a..aa90582aa5 100644 --- a/packages/parser/tests/events/apiGatewayProxyEvent_noVersionAuth.json +++ b/packages/parser/tests/events/apiGatewayProxyEvent_noVersionAuth.json @@ -7,26 +7,16 @@ "Header2": "value2" }, "multiValueHeaders": { - "Header1": [ - "value1" - ], - "Header2": [ - "value1", - "value2" - ] + "Header1": ["value1"], + "Header2": ["value1", "value2"] }, "queryStringParameters": { "parameter1": "value1", "parameter2": "value" }, "multiValueQueryStringParameters": { - "parameter1": [ - "value1", - "value2" - ], - "parameter2": [ - "value" - ] + "parameter1": ["value1", "value2"], + "parameter2": ["value"] }, "requestContext": { "accountId": "123456789012", diff --git a/packages/parser/tests/events/apiGatewayProxyOtherEvent.json b/packages/parser/tests/events/apiGatewayProxyOtherEvent.json index 7d5f0ef753..b5f484fde7 100644 --- a/packages/parser/tests/events/apiGatewayProxyOtherEvent.json +++ b/packages/parser/tests/events/apiGatewayProxyOtherEvent.json @@ -9,26 +9,16 @@ "Origin": "https://aws.amazon.com" }, "multiValueHeaders": { - "Header1": [ - "value1" - ], - "Header2": [ - "value1", - "value2" - ] + "Header1": ["value1"], + "Header2": ["value1", "value2"] }, "queryStringParameters": { "parameter1": "value1", "parameter2": "value" }, "multiValueQueryStringParameters": { - "parameter1": [ - "value1", - "value2" - ], - "parameter2": [ - "value" - ] + "parameter1": ["value1", "value2"], + "parameter2": ["value"] }, "requestContext": { "accountId": "123456789012", diff --git a/packages/parser/tests/events/apiGatewayProxyV2Event.json b/packages/parser/tests/events/apiGatewayProxyV2Event.json index ac287d560a..c01ff40d82 100644 --- a/packages/parser/tests/events/apiGatewayProxyV2Event.json +++ b/packages/parser/tests/events/apiGatewayProxyV2Event.json @@ -3,10 +3,7 @@ "routeKey": "$default", "rawPath": "/my/path", "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", - "cookies": [ - "cookie1", - "cookie2" - ], + "cookies": ["cookie1", "cookie2"], "headers": { "Header1": "value1", "Header2": "value1,value2" @@ -36,10 +33,7 @@ "claim1": "value1", "claim2": "value2" }, - "scopes": [ - "scope1", - "scope2" - ] + "scopes": ["scope1", "scope2"] } }, "domainName": "id.execute-api.us-east-1.amazonaws.com", diff --git a/packages/parser/tests/events/apiGatewayProxyV2EventPathTrailingSlash.json b/packages/parser/tests/events/apiGatewayProxyV2EventPathTrailingSlash.json index 6a745937ca..b61beaa0e6 100644 --- a/packages/parser/tests/events/apiGatewayProxyV2EventPathTrailingSlash.json +++ b/packages/parser/tests/events/apiGatewayProxyV2EventPathTrailingSlash.json @@ -1,69 +1,63 @@ { - "version": "2.0", - "routeKey": "$default", - "rawPath": "/my/path/", - "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", - "cookies": [ - "cookie1", - "cookie2" - ], - "headers": { - "Header1": "value1", - "Header2": "value1,value2" - }, - "queryStringParameters": { - "parameter1": "value1,value2", - "parameter2": "value" - }, - "requestContext": { - "accountId": "123456789012", - "apiId": "api-id", - "authentication": { - "clientCert": { - "clientCertPem": "CERT_CONTENT", - "subjectDN": "www.example.com", - "issuerDN": "Example issuer", - "serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1", - "validity": { - "notBefore": "May 28 12:30:02 2019 GMT", - "notAfter": "Aug 5 09:36:04 2021 GMT" - } + "version": "2.0", + "routeKey": "$default", + "rawPath": "/my/path/", + "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", + "cookies": ["cookie1", "cookie2"], + "headers": { + "Header1": "value1", + "Header2": "value1,value2" + }, + "queryStringParameters": { + "parameter1": "value1,value2", + "parameter2": "value" + }, + "requestContext": { + "accountId": "123456789012", + "apiId": "api-id", + "authentication": { + "clientCert": { + "clientCertPem": "CERT_CONTENT", + "subjectDN": "www.example.com", + "issuerDN": "Example issuer", + "serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1", + "validity": { + "notBefore": "May 28 12:30:02 2019 GMT", + "notAfter": "Aug 5 09:36:04 2021 GMT" } - }, - "authorizer": { - "jwt": { - "claims": { - "claim1": "value1", - "claim2": "value2" - }, - "scopes": [ - "scope1", - "scope2" - ] - } - }, - "domainName": "id.execute-api.us-east-1.amazonaws.com", - "domainPrefix": "id", - "http": { - "method": "POST", - "path": "/my/path", - "protocol": "HTTP/1.1", - "sourceIp": "192.168.0.1", - "userAgent": "agent" - }, - "requestId": "id", - "routeKey": "$default", - "stage": "$default", - "time": "12/Mar/2020:19:03:58 +0000", - "timeEpoch": 1583348638390 + } + }, + "authorizer": { + "jwt": { + "claims": { + "claim1": "value1", + "claim2": "value2" + }, + "scopes": ["scope1", "scope2"] + } }, - "body": "{\"message\": \"hello world\", \"username\": \"tom\"}", - "pathParameters": { - "parameter1": "value1" + "domainName": "id.execute-api.us-east-1.amazonaws.com", + "domainPrefix": "id", + "http": { + "method": "POST", + "path": "/my/path", + "protocol": "HTTP/1.1", + "sourceIp": "192.168.0.1", + "userAgent": "agent" }, - "isBase64Encoded": false, - "stageVariables": { - "stageVariable1": "value1", - "stageVariable2": "value2" - } - } \ No newline at end of file + "requestId": "id", + "routeKey": "$default", + "stage": "$default", + "time": "12/Mar/2020:19:03:58 +0000", + "timeEpoch": 1583348638390 + }, + "body": "{\"message\": \"hello world\", \"username\": \"tom\"}", + "pathParameters": { + "parameter1": "value1" + }, + "isBase64Encoded": false, + "stageVariables": { + "stageVariable1": "value1", + "stageVariable2": "value2" + } +} diff --git a/packages/parser/tests/events/apiGatewayProxyV2Event_GET.json b/packages/parser/tests/events/apiGatewayProxyV2Event_GET.json index 34b9b04628..df84c046d4 100644 --- a/packages/parser/tests/events/apiGatewayProxyV2Event_GET.json +++ b/packages/parser/tests/events/apiGatewayProxyV2Event_GET.json @@ -3,10 +3,7 @@ "routeKey": "$default", "rawPath": "/my/path", "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", - "cookies": [ - "cookie1", - "cookie2" - ], + "cookies": ["cookie1", "cookie2"], "headers": { "Header1": "value1", "Header2": "value1,value2" @@ -36,10 +33,7 @@ "claim1": "value1", "claim2": "value2" }, - "scopes": [ - "scope1", - "scope2" - ] + "scopes": ["scope1", "scope2"] } }, "domainName": "id.execute-api.us-east-1.amazonaws.com", diff --git a/packages/parser/tests/events/apiGatewayProxyV2IamEvent.json b/packages/parser/tests/events/apiGatewayProxyV2IamEvent.json index 99f10ef989..3bc003d656 100644 --- a/packages/parser/tests/events/apiGatewayProxyV2IamEvent.json +++ b/packages/parser/tests/events/apiGatewayProxyV2IamEvent.json @@ -1,62 +1,57 @@ { - "version": "2.0", + "version": "2.0", + "routeKey": "$default", + "rawPath": "/my/path", + "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", + "cookies": ["cookie1", "cookie2"], + "headers": { + "Header1": "value1", + "Header2": "value2" + }, + "queryStringParameters": { + "parameter1": "value1,value2", + "parameter2": "value" + }, + "pathParameters": { + "proxy": "hello/world" + }, + "requestContext": { "routeKey": "$default", - "rawPath": "/my/path", - "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", - "cookies": [ - "cookie1", - "cookie2" - ], - "headers": { - "Header1": "value1", - "Header2": "value2" - }, - "queryStringParameters": { - "parameter1": "value1,value2", - "parameter2": "value" - }, - "pathParameters": { - "proxy": "hello/world" - }, - "requestContext": { - "routeKey": "$default", - "accountId": "123456789012", - "stage": "$default", - "requestId": "id", - "authorizer": { - "iam": { - "accessKey": "ARIA2ZJZYVUEREEIHAKY", - "accountId": "1234567890", - "callerId": "AROA7ZJZYVRE7C3DUXHH6:CognitoIdentityCredentials", - "cognitoIdentity": { - "amr": [ - "foo" - ], - "identityId": "us-east-1:3f291106-8703-466b-8f2b-3ecee1ca56ce", - "identityPoolId": "us-east-1:4f291106-8703-466b-8f2b-3ecee1ca56ce" - }, - "principalOrgId": "AwsOrgId", - "userArn": "arn:aws:iam::1234567890:user/Admin", - "userId": "AROA2ZJZYVRE7Y3TUXHH6" - } + "accountId": "123456789012", + "stage": "$default", + "requestId": "id", + "authorizer": { + "iam": { + "accessKey": "ARIA2ZJZYVUEREEIHAKY", + "accountId": "1234567890", + "callerId": "AROA7ZJZYVRE7C3DUXHH6:CognitoIdentityCredentials", + "cognitoIdentity": { + "amr": ["foo"], + "identityId": "us-east-1:3f291106-8703-466b-8f2b-3ecee1ca56ce", + "identityPoolId": "us-east-1:4f291106-8703-466b-8f2b-3ecee1ca56ce" }, - "apiId": "api-id", - "domainName": "id.execute-api.us-east-1.amazonaws.com", - "domainPrefix": "id", - "time": "12/Mar/2020:19:03:58+0000", - "timeEpoch": 1583348638390, - "http": { - "method": "GET", - "path": "/my/path", - "protocol": "HTTP/1.1", - "sourceIp": "192.168.0.1", - "userAgent": "agent" - } - }, - "stageVariables": { - "stageVariable1": "value1", - "stageVariable2": "value2" + "principalOrgId": "AwsOrgId", + "userArn": "arn:aws:iam::1234567890:user/Admin", + "userId": "AROA2ZJZYVRE7Y3TUXHH6" + } }, - "body": "{\r\n\t\"a\": 1\r\n}", - "isBase64Encoded": false -} \ No newline at end of file + "apiId": "api-id", + "domainName": "id.execute-api.us-east-1.amazonaws.com", + "domainPrefix": "id", + "time": "12/Mar/2020:19:03:58+0000", + "timeEpoch": 1583348638390, + "http": { + "method": "GET", + "path": "/my/path", + "protocol": "HTTP/1.1", + "sourceIp": "192.168.0.1", + "userAgent": "agent" + } + }, + "stageVariables": { + "stageVariable1": "value1", + "stageVariable2": "value2" + }, + "body": "{\r\n\t\"a\": 1\r\n}", + "isBase64Encoded": false +} diff --git a/packages/parser/tests/events/apiGatewayProxyV2LambdaAuthorizerEvent.json b/packages/parser/tests/events/apiGatewayProxyV2LambdaAuthorizerEvent.json index e7e6aeb2ca..58ba0489e0 100644 --- a/packages/parser/tests/events/apiGatewayProxyV2LambdaAuthorizerEvent.json +++ b/packages/parser/tests/events/apiGatewayProxyV2LambdaAuthorizerEvent.json @@ -1,50 +1,47 @@ { - "version": "2.0", + "version": "2.0", + "routeKey": "$default", + "rawPath": "/my/path", + "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", + "cookies": ["cookie1", "cookie2"], + "headers": { + "Header1": "value1", + "Header2": "value2" + }, + "queryStringParameters": { + "parameter1": "value1,value2", + "parameter2": "value" + }, + "pathParameters": { + "proxy": "hello/world" + }, + "requestContext": { "routeKey": "$default", - "rawPath": "/my/path", - "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", - "cookies": [ - "cookie1", - "cookie2" - ], - "headers": { - "Header1": "value1", - "Header2": "value2" + "accountId": "123456789012", + "stage": "$default", + "requestId": "id", + "authorizer": { + "lambda": { + "key": "value" + } }, - "queryStringParameters": { - "parameter1": "value1,value2", - "parameter2": "value" - }, - "pathParameters": { - "proxy": "hello/world" - }, - "requestContext": { - "routeKey": "$default", - "accountId": "123456789012", - "stage": "$default", - "requestId": "id", - "authorizer": { - "lambda": { - "key": "value" - } - }, - "apiId": "api-id", - "domainName": "id.execute-api.us-east-1.amazonaws.com", - "domainPrefix": "id", - "time": "12/Mar/2020:19:03:58+0000", - "timeEpoch": 1583348638390, - "http": { - "method": "GET", - "path": "/my/path", - "protocol": "HTTP/1.1", - "sourceIp": "192.168.0.1", - "userAgent": "agent" - } - }, - "stageVariables": { - "stageVariable1": "value1", - "stageVariable2": "value2" - }, - "body": "{\r\n\t\"a\": 1\r\n}", - "isBase64Encoded": false -} \ No newline at end of file + "apiId": "api-id", + "domainName": "id.execute-api.us-east-1.amazonaws.com", + "domainPrefix": "id", + "time": "12/Mar/2020:19:03:58+0000", + "timeEpoch": 1583348638390, + "http": { + "method": "GET", + "path": "/my/path", + "protocol": "HTTP/1.1", + "sourceIp": "192.168.0.1", + "userAgent": "agent" + } + }, + "stageVariables": { + "stageVariable1": "value1", + "stageVariable2": "value2" + }, + "body": "{\r\n\t\"a\": 1\r\n}", + "isBase64Encoded": false +} diff --git a/packages/parser/tests/events/apiGatewayProxyV2OtherGetEvent.json b/packages/parser/tests/events/apiGatewayProxyV2OtherGetEvent.json index c5499c46b4..b600aa35c3 100644 --- a/packages/parser/tests/events/apiGatewayProxyV2OtherGetEvent.json +++ b/packages/parser/tests/events/apiGatewayProxyV2OtherGetEvent.json @@ -3,10 +3,7 @@ "routeKey": "$default", "rawPath": "/other/path", "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", - "cookies": [ - "cookie1", - "cookie2" - ], + "cookies": ["cookie1", "cookie2"], "headers": { "Header1": "value1", "Header2": "value1,value2" @@ -36,10 +33,7 @@ "claim1": "value1", "claim2": "value2" }, - "scopes": [ - "scope1", - "scope2" - ] + "scopes": ["scope1", "scope2"] } }, "domainName": "id.execute-api.us-east-1.amazonaws.com", diff --git a/packages/parser/tests/events/apiGatewayProxyV2SchemaMiddlewareInvalidEvent.json b/packages/parser/tests/events/apiGatewayProxyV2SchemaMiddlewareInvalidEvent.json index 5b663ec40a..9ecf730d4b 100644 --- a/packages/parser/tests/events/apiGatewayProxyV2SchemaMiddlewareInvalidEvent.json +++ b/packages/parser/tests/events/apiGatewayProxyV2SchemaMiddlewareInvalidEvent.json @@ -3,10 +3,7 @@ "routeKey": "$default", "rawPath": "/my/path", "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", - "cookies": [ - "cookie1", - "cookie2" - ], + "cookies": ["cookie1", "cookie2"], "headers": { "Header1": "value1", "Header2": "value1,value2" @@ -36,10 +33,7 @@ "claim1": "value1", "claim2": "value2" }, - "scopes": [ - "scope1", - "scope2" - ] + "scopes": ["scope1", "scope2"] } }, "domainName": "id.execute-api.us-east-1.amazonaws.com", diff --git a/packages/parser/tests/events/apiGatewayProxyV2SchemaMiddlewareValidEvent.json b/packages/parser/tests/events/apiGatewayProxyV2SchemaMiddlewareValidEvent.json index f59a6ef318..1e5802a685 100644 --- a/packages/parser/tests/events/apiGatewayProxyV2SchemaMiddlewareValidEvent.json +++ b/packages/parser/tests/events/apiGatewayProxyV2SchemaMiddlewareValidEvent.json @@ -3,10 +3,7 @@ "routeKey": "$default", "rawPath": "/my/path", "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", - "cookies": [ - "cookie1", - "cookie2" - ], + "cookies": ["cookie1", "cookie2"], "headers": { "Header1": "value1", "Header2": "value1,value2" @@ -36,10 +33,7 @@ "claim1": "value1", "claim2": "value2" }, - "scopes": [ - "scope1", - "scope2" - ] + "scopes": ["scope1", "scope2"] } }, "domainName": "id.execute-api.us-east-1.amazonaws.com", diff --git a/packages/parser/tests/events/apiGatewaySchemaMiddlewareInvalidEvent.json b/packages/parser/tests/events/apiGatewaySchemaMiddlewareInvalidEvent.json index f601583a76..bc5d7ae252 100644 --- a/packages/parser/tests/events/apiGatewaySchemaMiddlewareInvalidEvent.json +++ b/packages/parser/tests/events/apiGatewaySchemaMiddlewareInvalidEvent.json @@ -9,26 +9,16 @@ "Origin": "https://aws.amazon.com" }, "multiValueHeaders": { - "Header1": [ - "value1" - ], - "Header2": [ - "value1", - "value2" - ] + "Header1": ["value1"], + "Header2": ["value1", "value2"] }, "queryStringParameters": { "parameter1": "value1", "parameter2": "value" }, "multiValueQueryStringParameters": { - "parameter1": [ - "value1", - "value2" - ], - "parameter2": [ - "value" - ] + "parameter1": ["value1", "value2"], + "parameter2": ["value"] }, "requestContext": { "accountId": "123456789012", diff --git a/packages/parser/tests/events/apiGatewaySchemaMiddlewareValidEvent.json b/packages/parser/tests/events/apiGatewaySchemaMiddlewareValidEvent.json index 7437eba9e0..e3d5236ce5 100644 --- a/packages/parser/tests/events/apiGatewaySchemaMiddlewareValidEvent.json +++ b/packages/parser/tests/events/apiGatewaySchemaMiddlewareValidEvent.json @@ -9,26 +9,16 @@ "Origin": "https://aws.amazon.com" }, "multiValueHeaders": { - "Header1": [ - "value1" - ], - "Header2": [ - "value1", - "value2" - ] + "Header1": ["value1"], + "Header2": ["value1", "value2"] }, "queryStringParameters": { "parameter1": "value1", "parameter2": "value" }, "multiValueQueryStringParameters": { - "parameter1": [ - "value1", - "value2" - ], - "parameter2": [ - "value" - ] + "parameter1": ["value1", "value2"], + "parameter2": ["value"] }, "requestContext": { "accountId": "123456789012", diff --git a/packages/parser/tests/events/apigw-http/authorizer-request.json b/packages/parser/tests/events/apigw-http/authorizer-request.json index 28529efbbb..0f21d20b60 100644 --- a/packages/parser/tests/events/apigw-http/authorizer-request.json +++ b/packages/parser/tests/events/apigw-http/authorizer-request.json @@ -2,9 +2,7 @@ "version": "2.0", "type": "REQUEST", "routeArn": "arn:aws:execute-api:eu-west-1:123456789012:lsw1ro4ipb/$default/POST/lambda", - "identitySource": [ - "Bearer foo" - ], + "identitySource": ["Bearer foo"], "routeKey": "POST /lambda", "rawPath": "/lambda", "rawQueryString": "", @@ -38,4 +36,4 @@ "time": "17/Jun/2024:15:52:39 +0000", "timeEpoch": 1718639559080 } -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-http/iam-auth.json b/packages/parser/tests/events/apigw-http/iam-auth.json index b3b5276f26..33162ea02a 100644 --- a/packages/parser/tests/events/apigw-http/iam-auth.json +++ b/packages/parser/tests/events/apigw-http/iam-auth.json @@ -48,4 +48,4 @@ "timeEpoch": 1718638781472 }, "isBase64Encoded": false -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-http/invalid.json b/packages/parser/tests/events/apigw-http/invalid.json index 37a8fcecf9..49b19388d6 100644 --- a/packages/parser/tests/events/apigw-http/invalid.json +++ b/packages/parser/tests/events/apigw-http/invalid.json @@ -19,4 +19,4 @@ "requestTime": "2018-09-07T16: 20: 46Z", "requestTimeEpoch": 1536992496000 } -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-http/jwt-authorizer-auth.json b/packages/parser/tests/events/apigw-http/jwt-authorizer-auth.json index 73ba0c0f34..d616bdb11d 100644 --- a/packages/parser/tests/events/apigw-http/jwt-authorizer-auth.json +++ b/packages/parser/tests/events/apigw-http/jwt-authorizer-auth.json @@ -52,4 +52,4 @@ "timeEpoch": 1718639369348 }, "isBase64Encoded": false -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-http/lambda-authorizer-auth.json b/packages/parser/tests/events/apigw-http/lambda-authorizer-auth.json index 0b6441284e..f0865679e7 100644 --- a/packages/parser/tests/events/apigw-http/lambda-authorizer-auth.json +++ b/packages/parser/tests/events/apigw-http/lambda-authorizer-auth.json @@ -37,4 +37,4 @@ "timeEpoch": 1718639559080 }, "isBase64Encoded": false -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-http/no-auth.json b/packages/parser/tests/events/apigw-http/no-auth.json index 0b6441284e..f0865679e7 100644 --- a/packages/parser/tests/events/apigw-http/no-auth.json +++ b/packages/parser/tests/events/apigw-http/no-auth.json @@ -37,4 +37,4 @@ "timeEpoch": 1718639559080 }, "isBase64Encoded": false -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-rest/authorizer-request.json b/packages/parser/tests/events/apigw-rest/authorizer-request.json index 31d3d46966..2e01d05f99 100644 --- a/packages/parser/tests/events/apigw-rest/authorizer-request.json +++ b/packages/parser/tests/events/apigw-rest/authorizer-request.json @@ -26,63 +26,25 @@ "X-Forwarded-Proto": "https" }, "multiValueHeaders": { - "Accept": [ - "*/*" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "Authorization": [ - "Bearer foo" - ], - "CloudFront-Forwarded-Proto": [ - "https" - ], - "CloudFront-Is-Desktop-Viewer": [ - "true" - ], - "CloudFront-Is-Mobile-Viewer": [ - "false" - ], - "CloudFront-Is-SmartTV-Viewer": [ - "false" - ], - "CloudFront-Is-Tablet-Viewer": [ - "false" - ], - "CloudFront-Viewer-ASN": [ - "7224" - ], - "CloudFront-Viewer-Country": [ - "GB" - ], - "Content-Length": [ - "0" - ], - "Host": [ - "puhdx84jy9.execute-api.eu-west-1.amazonaws.com" - ], - "User-Agent": [ - "HTTPie/3.2.2" - ], - "Via": [ - "1.1 e20527248be1eebaced63108ab7e73d6.cloudfront.net (CloudFront)" - ], - "X-Amz-Cf-Id": [ - "sIEfafSQxwenKloeWOp-4eyo_-grMyVNzwnkBmx5q7OcvBJV7knerQ==" - ], - "X-Amzn-Trace-Id": [ - "Root=1-66704feb-118151122b2ad2d3488844e7" - ], - "X-Forwarded-For": [ - "15.248.3.126, 130.176.209.37" - ], - "X-Forwarded-Port": [ - "443" - ], - "X-Forwarded-Proto": [ - "https" - ] + "Accept": ["*/*"], + "Accept-Encoding": ["gzip, deflate"], + "Authorization": ["Bearer foo"], + "CloudFront-Forwarded-Proto": ["https"], + "CloudFront-Is-Desktop-Viewer": ["true"], + "CloudFront-Is-Mobile-Viewer": ["false"], + "CloudFront-Is-SmartTV-Viewer": ["false"], + "CloudFront-Is-Tablet-Viewer": ["false"], + "CloudFront-Viewer-ASN": ["7224"], + "CloudFront-Viewer-Country": ["GB"], + "Content-Length": ["0"], + "Host": ["puhdx84jy9.execute-api.eu-west-1.amazonaws.com"], + "User-Agent": ["HTTPie/3.2.2"], + "Via": ["1.1 e20527248be1eebaced63108ab7e73d6.cloudfront.net (CloudFront)"], + "X-Amz-Cf-Id": ["sIEfafSQxwenKloeWOp-4eyo_-grMyVNzwnkBmx5q7OcvBJV7knerQ=="], + "X-Amzn-Trace-Id": ["Root=1-66704feb-118151122b2ad2d3488844e7"], + "X-Forwarded-For": ["15.248.3.126, 130.176.209.37"], + "X-Forwarded-Port": ["443"], + "X-Forwarded-Proto": ["https"] }, "queryStringParameters": {}, "multiValueQueryStringParameters": {}, @@ -119,4 +81,4 @@ "deploymentId": "v99qix", "apiId": "puhdx84jy9" } -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-rest/authorizer-token.json b/packages/parser/tests/events/apigw-rest/authorizer-token.json index b4fa5a844d..c5005df4fc 100644 --- a/packages/parser/tests/events/apigw-rest/authorizer-token.json +++ b/packages/parser/tests/events/apigw-rest/authorizer-token.json @@ -2,4 +2,4 @@ "type": "TOKEN", "methodArn": "arn:aws:execute-api:eu-west-1:123456789012:puhdx84jy9/prod/POST/lambda-token", "authorizationToken": "Bearer foo" -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-rest/console-test-ui.json b/packages/parser/tests/events/apigw-rest/console-test-ui.json index 10ab457088..a104a90107 100644 --- a/packages/parser/tests/events/apigw-rest/console-test-ui.json +++ b/packages/parser/tests/events/apigw-rest/console-test-ui.json @@ -42,4 +42,4 @@ }, "body": null, "isBase64Encoded": false -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-rest/iam-auth.json b/packages/parser/tests/events/apigw-rest/iam-auth.json index 180ed4e10a..7bdf5bae30 100644 --- a/packages/parser/tests/events/apigw-rest/iam-auth.json +++ b/packages/parser/tests/events/apigw-rest/iam-auth.json @@ -25,66 +25,28 @@ "X-Forwarded-Proto": "https" }, "multiValueHeaders": { - "Accept": [ - "*/*" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "CloudFront-Forwarded-Proto": [ - "https" - ], - "CloudFront-Is-Desktop-Viewer": [ - "true" - ], - "CloudFront-Is-Mobile-Viewer": [ - "false" - ], - "CloudFront-Is-SmartTV-Viewer": [ - "false" - ], - "CloudFront-Is-Tablet-Viewer": [ - "false" - ], - "CloudFront-Viewer-ASN": [ - "7224" - ], - "CloudFront-Viewer-Country": [ - "GB" - ], - "Host": [ - "puhdx84jy9.execute-api.eu-west-1.amazonaws.com" - ], - "User-Agent": [ - "HTTPie/3.2.2" - ], - "Via": [ - "1.1 d3e65123eab254da0d61a912409e06b4.cloudfront.net (CloudFront)" - ], - "X-Amz-Cf-Id": [ - "tP3wYavwGbIRVlinJVTXtHLSXkXwPi6WYz7EarjB1QnsqC0giphxmA==" - ], + "Accept": ["*/*"], + "Accept-Encoding": ["gzip, deflate"], + "CloudFront-Forwarded-Proto": ["https"], + "CloudFront-Is-Desktop-Viewer": ["true"], + "CloudFront-Is-Mobile-Viewer": ["false"], + "CloudFront-Is-SmartTV-Viewer": ["false"], + "CloudFront-Is-Tablet-Viewer": ["false"], + "CloudFront-Viewer-ASN": ["7224"], + "CloudFront-Viewer-Country": ["GB"], + "Host": ["puhdx84jy9.execute-api.eu-west-1.amazonaws.com"], + "User-Agent": ["HTTPie/3.2.2"], + "Via": ["1.1 d3e65123eab254da0d61a912409e06b4.cloudfront.net (CloudFront)"], + "X-Amz-Cf-Id": ["tP3wYavwGbIRVlinJVTXtHLSXkXwPi6WYz7EarjB1QnsqC0giphxmA=="], "x-amz-content-sha256": [ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" ], - "x-amz-date": [ - "20240617T145824Z" - ], - "X-Amz-Security-Token": [ - "IQoJb3JpZ[...]==" - ], - "X-Amzn-Trace-Id": [ - "Root=1-66704f11-56b0f1d611b392cb68ad2b83" - ], - "X-Forwarded-For": [ - "15.248.3.126, 130.176.209.38" - ], - "X-Forwarded-Port": [ - "443" - ], - "X-Forwarded-Proto": [ - "https" - ] + "x-amz-date": ["20240617T145824Z"], + "X-Amz-Security-Token": ["IQoJb3JpZ[...]=="], + "X-Amzn-Trace-Id": ["Root=1-66704f11-56b0f1d611b392cb68ad2b83"], + "X-Forwarded-For": ["15.248.3.126, 130.176.209.38"], + "X-Forwarded-Port": ["443"], + "X-Forwarded-Proto": ["https"] }, "queryStringParameters": null, "multiValueQueryStringParameters": null, @@ -123,4 +85,4 @@ }, "body": null, "isBase64Encoded": false -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-rest/invalid.json b/packages/parser/tests/events/apigw-rest/invalid.json index 9c2e70fe75..f467627753 100644 --- a/packages/parser/tests/events/apigw-rest/invalid.json +++ b/packages/parser/tests/events/apigw-rest/invalid.json @@ -19,4 +19,4 @@ "requestTime": "2018-09-07T16: 20: 46Z", "requestTimeEpoch": 1536992496000 } -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-rest/jwt-authorizer-auth.json b/packages/parser/tests/events/apigw-rest/jwt-authorizer-auth.json index a4ec248d17..411bfd918b 100644 --- a/packages/parser/tests/events/apigw-rest/jwt-authorizer-auth.json +++ b/packages/parser/tests/events/apigw-rest/jwt-authorizer-auth.json @@ -23,60 +23,26 @@ "X-Forwarded-Proto": "https" }, "multiValueHeaders": { - "Accept": [ - "*/*" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], + "Accept": ["*/*"], + "Accept-Encoding": ["gzip, deflate"], "Authorization": [ "Bearer eyJraWQiOiJadVlaXC9KdmtST2hpN1hBT3FIekx0TVwvdUpKXC9kWUtPMUs1QkVZSjVUM2xZPSIsImFsZyI6IlJTMjU2In0.eyJvcmlnaW5fanRpIjoiMzdjYzAyY2YtNWMxNC00NjM2LWJlYjMtNGY4Y2E4ODc5MzViIiwic3ViIjoiZDJmNTA0NDQtMDA0MS03MDM2LWFlYTItYTk1NWZjYTMzZDM3IiwiYXVkIjoiM25rb2VwNDE1MWI3dW1lZ2dub3R0YzMwdTkiLCJldmVudF9pZCI6ImM3ZjZjYzYyLWM0NzYtNGM2YS1iYTViLTc0NTI0NGRmZTVlZSIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNzE4NjM2NDA0LCJpc3MiOiJodHRwczpcL1wvY29nbml0by1pZHAuZXUtd2VzdC0xLmFtYXpvbmF3cy5jb21cL2V1LXdlc3QtMV95MGJMRzRpMjciLCJjb2duaXRvOnVzZXJuYW1lIjoiYWFtb3Jvc2kiLCJleHAiOjE3MTg3MjI4MDQsImlhdCI6MTcxODYzNjQwNCwianRpIjoiMTM3MjdhYmEtODllNi00ODk2LWJkOWUtOGNiYzBmNDc4ZjljIn0.k9GKFY028MbL8hyLpsq2aCsMYt0P_im93qSyDF5awnhePlnfpNVXGXGGIcoBPyj-wlsZPdJAS_3Y324VhYlRzX76xTlew1lAtM665RAe4tncLl6MFlicTgHqsFXeOyXroSAe_X9wlP1jfMGiqW6oOkxrl_dajz7GJFFTEX8ztnTLD7FZvE5KophYihxq6RFZlOQFLWmx6w378ZQ49kHg-H5FF6JluI1G9sQ3P77rrhfL7MGv5xi1YiDeWa7T27PhHcgqll9fuLFA-_8LrdN-G5XMEt0Zlfb-WxF8YaStJ4e519GfnVWUuNWJo9BnFj0ChCiyhlK7cAWDjm1mz-Y4FA" ], - "CloudFront-Forwarded-Proto": [ - "https" - ], - "CloudFront-Is-Desktop-Viewer": [ - "true" - ], - "CloudFront-Is-Mobile-Viewer": [ - "false" - ], - "CloudFront-Is-SmartTV-Viewer": [ - "false" - ], - "CloudFront-Is-Tablet-Viewer": [ - "false" - ], - "CloudFront-Viewer-ASN": [ - "7224" - ], - "CloudFront-Viewer-Country": [ - "GB" - ], - "Host": [ - "puhdx84jy9.execute-api.eu-west-1.amazonaws.com" - ], - "User-Agent": [ - "HTTPie/3.2.2" - ], - "Via": [ - "1.1 ff7cafeac35b91a7af23c56e3b9691e8.cloudfront.net (CloudFront)" - ], - "X-Amz-Cf-Id": [ - "zTKRjCprnRv8GXztLX3l3gQVmT0MLysk_-FcFmxxBfz0qSPCBQsGIg==" - ], - "X-Amzn-Trace-Id": [ - "Root=1-66704f8a-626bb89a0b2bf33b547f581c" - ], - "X-Forwarded-For": [ - "15.248.3.126, 130.176.209.4" - ], - "X-Forwarded-Port": [ - "443" - ], - "X-Forwarded-Proto": [ - "https" - ] + "CloudFront-Forwarded-Proto": ["https"], + "CloudFront-Is-Desktop-Viewer": ["true"], + "CloudFront-Is-Mobile-Viewer": ["false"], + "CloudFront-Is-SmartTV-Viewer": ["false"], + "CloudFront-Is-Tablet-Viewer": ["false"], + "CloudFront-Viewer-ASN": ["7224"], + "CloudFront-Viewer-Country": ["GB"], + "Host": ["puhdx84jy9.execute-api.eu-west-1.amazonaws.com"], + "User-Agent": ["HTTPie/3.2.2"], + "Via": ["1.1 ff7cafeac35b91a7af23c56e3b9691e8.cloudfront.net (CloudFront)"], + "X-Amz-Cf-Id": ["zTKRjCprnRv8GXztLX3l3gQVmT0MLysk_-FcFmxxBfz0qSPCBQsGIg=="], + "X-Amzn-Trace-Id": ["Root=1-66704f8a-626bb89a0b2bf33b547f581c"], + "X-Forwarded-For": ["15.248.3.126, 130.176.209.4"], + "X-Forwarded-Port": ["443"], + "X-Forwarded-Proto": ["https"] }, "queryStringParameters": null, "multiValueQueryStringParameters": null, @@ -130,4 +96,4 @@ }, "body": null, "isBase64Encoded": false -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-rest/lambda-authorizer-auth.json b/packages/parser/tests/events/apigw-rest/lambda-authorizer-auth.json index 51465ba840..8ac048d567 100644 --- a/packages/parser/tests/events/apigw-rest/lambda-authorizer-auth.json +++ b/packages/parser/tests/events/apigw-rest/lambda-authorizer-auth.json @@ -23,60 +23,24 @@ "X-Forwarded-Proto": "https" }, "multiValueHeaders": { - "Accept": [ - "*/*" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "Authorization": [ - "Bearer foo" - ], - "CloudFront-Forwarded-Proto": [ - "https" - ], - "CloudFront-Is-Desktop-Viewer": [ - "true" - ], - "CloudFront-Is-Mobile-Viewer": [ - "false" - ], - "CloudFront-Is-SmartTV-Viewer": [ - "false" - ], - "CloudFront-Is-Tablet-Viewer": [ - "false" - ], - "CloudFront-Viewer-ASN": [ - "7224" - ], - "CloudFront-Viewer-Country": [ - "GB" - ], - "Host": [ - "puhdx84jy9.execute-api.eu-west-1.amazonaws.com" - ], - "User-Agent": [ - "HTTPie/3.2.2" - ], - "Via": [ - "1.1 8313bbb5b34d1ea0742b64ffbb83b692.cloudfront.net (CloudFront)" - ], - "X-Amz-Cf-Id": [ - "lrbUQoVv2blphI3jBSXQNqA3oq4s8VCCimuaSxMrX4YbEZjVKWaLWg==" - ], - "X-Amzn-Trace-Id": [ - "Root=1-66704db9-6136092d02f4e3424fe2ce95" - ], - "X-Forwarded-For": [ - "15.248.3.126, 130.176.209.10" - ], - "X-Forwarded-Port": [ - "443" - ], - "X-Forwarded-Proto": [ - "https" - ] + "Accept": ["*/*"], + "Accept-Encoding": ["gzip, deflate"], + "Authorization": ["Bearer foo"], + "CloudFront-Forwarded-Proto": ["https"], + "CloudFront-Is-Desktop-Viewer": ["true"], + "CloudFront-Is-Mobile-Viewer": ["false"], + "CloudFront-Is-SmartTV-Viewer": ["false"], + "CloudFront-Is-Tablet-Viewer": ["false"], + "CloudFront-Viewer-ASN": ["7224"], + "CloudFront-Viewer-Country": ["GB"], + "Host": ["puhdx84jy9.execute-api.eu-west-1.amazonaws.com"], + "User-Agent": ["HTTPie/3.2.2"], + "Via": ["1.1 8313bbb5b34d1ea0742b64ffbb83b692.cloudfront.net (CloudFront)"], + "X-Amz-Cf-Id": ["lrbUQoVv2blphI3jBSXQNqA3oq4s8VCCimuaSxMrX4YbEZjVKWaLWg=="], + "X-Amzn-Trace-Id": ["Root=1-66704db9-6136092d02f4e3424fe2ce95"], + "X-Forwarded-For": ["15.248.3.126, 130.176.209.10"], + "X-Forwarded-Port": ["443"], + "X-Forwarded-Proto": ["https"] }, "queryStringParameters": null, "multiValueQueryStringParameters": null, @@ -119,4 +83,4 @@ }, "body": null, "isBase64Encoded": false -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-rest/no-auth.json b/packages/parser/tests/events/apigw-rest/no-auth.json index 5168cfbf2f..914596fbb3 100644 --- a/packages/parser/tests/events/apigw-rest/no-auth.json +++ b/packages/parser/tests/events/apigw-rest/no-auth.json @@ -22,57 +22,23 @@ "X-Forwarded-Proto": "https" }, "multiValueHeaders": { - "Accept": [ - "*/*" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "CloudFront-Forwarded-Proto": [ - "https" - ], - "CloudFront-Is-Desktop-Viewer": [ - "true" - ], - "CloudFront-Is-Mobile-Viewer": [ - "false" - ], - "CloudFront-Is-SmartTV-Viewer": [ - "false" - ], - "CloudFront-Is-Tablet-Viewer": [ - "false" - ], - "CloudFront-Viewer-ASN": [ - "7224" - ], - "CloudFront-Viewer-Country": [ - "GB" - ], - "Host": [ - "puhdx84jy9.execute-api.eu-west-1.amazonaws.com" - ], - "User-Agent": [ - "HTTPie/3.2.2" - ], - "Via": [ - "1.1 49c0c4776e390b983c9f9f5365e3140c.cloudfront.net (CloudFront)" - ], - "X-Amz-Cf-Id": [ - "x9VncJ8IMo4X5UQEL8-Xg94vWwwuokofx236RgW1CrFCTh9DnPrgJA==" - ], - "X-Amzn-Trace-Id": [ - "Root=1-66704cad-0fbaf1491365339d168b2a7d" - ], - "X-Forwarded-For": [ - "15.248.3.126, 130.176.209.21" - ], - "X-Forwarded-Port": [ - "443" - ], - "X-Forwarded-Proto": [ - "https" - ] + "Accept": ["*/*"], + "Accept-Encoding": ["gzip, deflate"], + "CloudFront-Forwarded-Proto": ["https"], + "CloudFront-Is-Desktop-Viewer": ["true"], + "CloudFront-Is-Mobile-Viewer": ["false"], + "CloudFront-Is-SmartTV-Viewer": ["false"], + "CloudFront-Is-Tablet-Viewer": ["false"], + "CloudFront-Viewer-ASN": ["7224"], + "CloudFront-Viewer-Country": ["GB"], + "Host": ["puhdx84jy9.execute-api.eu-west-1.amazonaws.com"], + "User-Agent": ["HTTPie/3.2.2"], + "Via": ["1.1 49c0c4776e390b983c9f9f5365e3140c.cloudfront.net (CloudFront)"], + "X-Amz-Cf-Id": ["x9VncJ8IMo4X5UQEL8-Xg94vWwwuokofx236RgW1CrFCTh9DnPrgJA=="], + "X-Amzn-Trace-Id": ["Root=1-66704cad-0fbaf1491365339d168b2a7d"], + "X-Forwarded-For": ["15.248.3.126, 130.176.209.21"], + "X-Forwarded-Port": ["443"], + "X-Forwarded-Proto": ["https"] }, "queryStringParameters": null, "multiValueQueryStringParameters": null, @@ -111,4 +77,4 @@ }, "body": null, "isBase64Encoded": false -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/apigw-rest/websocket.json b/packages/parser/tests/events/apigw-rest/websocket.json index df32840f31..4589e44f93 100644 --- a/packages/parser/tests/events/apigw-rest/websocket.json +++ b/packages/parser/tests/events/apigw-rest/websocket.json @@ -22,57 +22,23 @@ "X-Forwarded-Proto": "https" }, "multiValueHeaders": { - "Accept": [ - "*/*" - ], - "Accept-Encoding": [ - "gzip, deflate" - ], - "CloudFront-Forwarded-Proto": [ - "https" - ], - "CloudFront-Is-Desktop-Viewer": [ - "true" - ], - "CloudFront-Is-Mobile-Viewer": [ - "false" - ], - "CloudFront-Is-SmartTV-Viewer": [ - "false" - ], - "CloudFront-Is-Tablet-Viewer": [ - "false" - ], - "CloudFront-Viewer-ASN": [ - "7224" - ], - "CloudFront-Viewer-Country": [ - "GB" - ], - "Host": [ - "puhdx84jy9.execute-api.eu-west-1.amazonaws.com" - ], - "User-Agent": [ - "HTTPie/3.2.2" - ], - "Via": [ - "1.1 49c0c4776e390b983c9f9f5365e3140c.cloudfront.net (CloudFront)" - ], - "X-Amz-Cf-Id": [ - "x9VncJ8IMo4X5UQEL8-Xg94vWwwuokofx236RgW1CrFCTh9DnPrgJA==" - ], - "X-Amzn-Trace-Id": [ - "Root=1-66704cad-0fbaf1491365339d168b2a7d" - ], - "X-Forwarded-For": [ - "15.248.3.126, 130.176.209.21" - ], - "X-Forwarded-Port": [ - "443" - ], - "X-Forwarded-Proto": [ - "https" - ] + "Accept": ["*/*"], + "Accept-Encoding": ["gzip, deflate"], + "CloudFront-Forwarded-Proto": ["https"], + "CloudFront-Is-Desktop-Viewer": ["true"], + "CloudFront-Is-Mobile-Viewer": ["false"], + "CloudFront-Is-SmartTV-Viewer": ["false"], + "CloudFront-Is-Tablet-Viewer": ["false"], + "CloudFront-Viewer-ASN": ["7224"], + "CloudFront-Viewer-Country": ["GB"], + "Host": ["puhdx84jy9.execute-api.eu-west-1.amazonaws.com"], + "User-Agent": ["HTTPie/3.2.2"], + "Via": ["1.1 49c0c4776e390b983c9f9f5365e3140c.cloudfront.net (CloudFront)"], + "X-Amz-Cf-Id": ["x9VncJ8IMo4X5UQEL8-Xg94vWwwuokofx236RgW1CrFCTh9DnPrgJA=="], + "X-Amzn-Trace-Id": ["Root=1-66704cad-0fbaf1491365339d168b2a7d"], + "X-Forwarded-For": ["15.248.3.126, 130.176.209.21"], + "X-Forwarded-Port": ["443"], + "X-Forwarded-Proto": ["https"] }, "queryStringParameters": null, "multiValueQueryStringParameters": null, @@ -115,4 +81,4 @@ }, "body": null, "isBase64Encoded": false -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/appSyncAuthorizerEvent.json b/packages/parser/tests/events/appSyncAuthorizerEvent.json index a8264569bf..5b58de9dd4 100644 --- a/packages/parser/tests/events/appSyncAuthorizerEvent.json +++ b/packages/parser/tests/events/appSyncAuthorizerEvent.json @@ -1,13 +1,13 @@ { - "authorizationToken": "BE9DC5E3-D410-4733-AF76-70178092E681", - "requestContext": { - "apiId": "giy7kumfmvcqvbedntjwjvagii", - "accountId": "254688921111", - "requestId": "b80ed838-14c6-4500-b4c3-b694c7bef086", - "queryString": "mutation MyNewTask($desc: String!) {\n createTask(description: $desc, owner: \"ccc\", taskStatus: \"cc\", title: \"ccc\") {\n id\n }\n}\n", - "operationName": "MyNewTask", - "variables": { - "desc": "Foo" - } + "authorizationToken": "BE9DC5E3-D410-4733-AF76-70178092E681", + "requestContext": { + "apiId": "giy7kumfmvcqvbedntjwjvagii", + "accountId": "254688921111", + "requestId": "b80ed838-14c6-4500-b4c3-b694c7bef086", + "queryString": "mutation MyNewTask($desc: String!) {\n createTask(description: $desc, owner: \"ccc\", taskStatus: \"cc\", title: \"ccc\") {\n id\n }\n}\n", + "operationName": "MyNewTask", + "variables": { + "desc": "Foo" } + } } diff --git a/packages/parser/tests/events/appSyncAuthorizerResponse.json b/packages/parser/tests/events/appSyncAuthorizerResponse.json index 7dd8234d2e..dfd52d9498 100644 --- a/packages/parser/tests/events/appSyncAuthorizerResponse.json +++ b/packages/parser/tests/events/appSyncAuthorizerResponse.json @@ -1,9 +1,9 @@ { - "isAuthorized": true, - "resolverContext": { - "name": "Foo Man", - "balance": 100 - }, - "deniedFields": ["Mutation.createEvent"], - "ttlOverride": 15 + "isAuthorized": true, + "resolverContext": { + "name": "Foo Man", + "balance": 100 + }, + "deniedFields": ["Mutation.createEvent"], + "ttlOverride": 15 } diff --git a/packages/parser/tests/events/appSyncDirectResolver.json b/packages/parser/tests/events/appSyncDirectResolver.json index 08c3d00b20..64054c9acb 100644 --- a/packages/parser/tests/events/appSyncDirectResolver.json +++ b/packages/parser/tests/events/appSyncDirectResolver.json @@ -21,9 +21,7 @@ "defaultAuthStrategy": "ALLOW", "groups": null, "issuer": "https://cognito-idp.us-west-2.amazonaws.com/us-west-xxxxxxxxxxx", - "sourceIp": [ - "1.1.1.1" - ], + "sourceIp": ["1.1.1.1"], "sub": "192879fc-a240-4bf1-ab5a-d6a00f3063f9", "username": "jdoe" }, @@ -60,11 +58,7 @@ }, "prev": null, "info": { - "selectionSetList": [ - "id", - "field1", - "field2" - ], + "selectionSetList": ["id", "field1", "field2"], "selectionSetGraphQL": "{\n id\n field1\n field2\n}", "parentTypeName": "Mutation", "fieldName": "createSomething", diff --git a/packages/parser/tests/events/appSyncResolverEvent.json b/packages/parser/tests/events/appSyncResolverEvent.json index 84ac71951c..6a5d72195c 100644 --- a/packages/parser/tests/events/appSyncResolverEvent.json +++ b/packages/parser/tests/events/appSyncResolverEvent.json @@ -21,9 +21,7 @@ "defaultAuthStrategy": "ALLOW", "groups": null, "issuer": "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_POOL_ID", - "sourceIp": [ - "11.215.2.22" - ], + "sourceIp": ["11.215.2.22"], "sub": "07920713-4526-4642-9c88-2953512de441", "username": "mike" }, diff --git a/packages/parser/tests/events/awsConfigRuleConfigurationChanged.json b/packages/parser/tests/events/awsConfigRuleConfigurationChanged.json index cbf7abf67a..e0f8929ddd 100644 --- a/packages/parser/tests/events/awsConfigRuleConfigurationChanged.json +++ b/packages/parser/tests/events/awsConfigRuleConfigurationChanged.json @@ -1,13 +1,13 @@ { - "version":"1.0", - "invokingEvent":"{\"configurationItemDiff\":{\"changedProperties\":{\"Configuration.InstanceType\":{\"previousValue\":\"t2.micro\",\"updatedValue\":\"t2.medium\",\"changeType\":\"UPDATE\"},\"Configuration.State.Name\":{\"previousValue\":\"running\",\"updatedValue\":\"stopped\",\"changeType\":\"UPDATE\"},\"Configuration.StateTransitionReason\":{\"previousValue\":\"\",\"updatedValue\":\"User initiated (2023-04-27 15:01:07 GMT)\",\"changeType\":\"UPDATE\"},\"Configuration.StateReason\":{\"previousValue\":null,\"updatedValue\":{\"code\":\"Client.UserInitiatedShutdown\",\"message\":\"Client.UserInitiatedShutdown: User initiated shutdown\"},\"changeType\":\"CREATE\"},\"Configuration.CpuOptions.CoreCount\":{\"previousValue\":1,\"updatedValue\":2,\"changeType\":\"UPDATE\"}},\"changeType\":\"UPDATE\"},\"configurationItem\":{\"relatedEvents\":[],\"relationships\":[{\"resourceId\":\"eipalloc-0ebb4367662263cc1\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::EIP\",\"name\":\"Is attached to ElasticIp\"},{\"resourceId\":\"eni-034dd31c4b17ada8c\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::NetworkInterface\",\"name\":\"Contains NetworkInterface\"},{\"resourceId\":\"eni-09a604c0ec356b06f\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::NetworkInterface\",\"name\":\"Contains NetworkInterface\"},{\"resourceId\":\"sg-0fb295a327d9b4835\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::SecurityGroup\",\"name\":\"Is associated with SecurityGroup\"},{\"resourceId\":\"subnet-cad1f2f4\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::Subnet\",\"name\":\"Is contained in Subnet\"},{\"resourceId\":\"vol-0a288b5eb9fea4b30\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::Volume\",\"name\":\"Is attached to Volume\"},{\"resourceId\":\"vpc-2d96be57\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::VPC\",\"name\":\"Is contained in Vpc\"}],\"configuration\":{\"amiLaunchIndex\":0,\"imageId\":\"ami-09d95fab7fff3776c\",\"instanceId\":\"i-042dd005362091826\",\"instanceType\":\"t2.medium\",\"kernelId\":null,\"keyName\":\"mihaec2\",\"launchTime\":\"2023-04-27T14:57:16.000Z\",\"monitoring\":{\"state\":\"disabled\"},\"placement\":{\"availabilityZone\":\"us-east-1e\",\"affinity\":null,\"groupName\":\"\",\"partitionNumber\":null,\"hostId\":null,\"tenancy\":\"default\",\"spreadDomain\":null,\"hostResourceGroupArn\":null},\"platform\":null,\"privateDnsName\":\"ip-172-31-78-41.ec2.internal\",\"privateIpAddress\":\"172.31.78.41\",\"productCodes\":[],\"publicDnsName\":\"ec2-3-232-229-57.compute-1.amazonaws.com\",\"publicIpAddress\":\"3.232.229.57\",\"ramdiskId\":null,\"state\":{\"code\":80,\"name\":\"stopped\"},\"stateTransitionReason\":\"User initiated (2023-04-27 15:01:07 GMT)\",\"subnetId\":\"subnet-cad1f2f4\",\"vpcId\":\"vpc-2d96be57\",\"architecture\":\"x86_64\",\"blockDeviceMappings\":[{\"deviceName\":\"/dev/xvda\",\"ebs\":{\"attachTime\":\"2020-05-30T15:21:58.000Z\",\"deleteOnTermination\":true,\"status\":\"attached\",\"volumeId\":\"vol-0a288b5eb9fea4b30\"}}],\"clientToken\":\"\",\"ebsOptimized\":false,\"enaSupport\":true,\"hypervisor\":\"xen\",\"iamInstanceProfile\":{\"arn\":\"arn:aws:iam::0123456789012:instance-profile/AmazonSSMRoleForInstancesQuickSetup\",\"id\":\"AIPAS5S4WFUBL72S3QXW5\"},\"instanceLifecycle\":null,\"elasticGpuAssociations\":[],\"elasticInferenceAcceleratorAssociations\":[],\"networkInterfaces\":[{\"association\":{\"carrierIp\":null,\"ipOwnerId\":\"0123456789012\",\"publicDnsName\":\"ec2-3-232-229-57.compute-1.amazonaws.com\",\"publicIp\":\"3.232.229.57\"},\"attachment\":{\"attachTime\":\"2020-05-30T15:21:57.000Z\",\"attachmentId\":\"eni-attach-0a7e75dc9c1c291a0\",\"deleteOnTermination\":true,\"deviceIndex\":0,\"status\":\"attached\",\"networkCardIndex\":0},\"description\":\"\",\"groups\":[{\"groupName\":\"minhaec2\",\"groupId\":\"sg-0fb295a327d9b4835\"}],\"ipv6Addresses\":[],\"macAddress\":\"06:cf:00:c2:17:db\",\"networkInterfaceId\":\"eni-034dd31c4b17ada8c\",\"ownerId\":\"0123456789012\",\"privateDnsName\":\"ip-172-31-78-41.ec2.internal\",\"privateIpAddress\":\"172.31.78.41\",\"privateIpAddresses\":[{\"association\":{\"carrierIp\":null,\"ipOwnerId\":\"0123456789012\",\"publicDnsName\":\"ec2-3-232-229-57.compute-1.amazonaws.com\",\"publicIp\":\"3.232.229.57\"},\"primary\":true,\"privateDnsName\":\"ip-172-31-78-41.ec2.internal\",\"privateIpAddress\":\"172.31.78.41\"}],\"sourceDestCheck\":true,\"status\":\"in-use\",\"subnetId\":\"subnet-cad1f2f4\",\"vpcId\":\"vpc-2d96be57\",\"interfaceType\":\"interface\"},{\"association\":null,\"attachment\":{\"attachTime\":\"2020-11-26T23:46:04.000Z\",\"attachmentId\":\"eni-attach-0e6d150ebbd19966e\",\"deleteOnTermination\":false,\"deviceIndex\":1,\"status\":\"attached\",\"networkCardIndex\":0},\"description\":\"MINHAEC2AAAAAA\",\"groups\":[{\"groupName\":\"minhaec2\",\"groupId\":\"sg-0fb295a327d9b4835\"},{\"groupName\":\"default\",\"groupId\":\"sg-88105fa0\"}],\"ipv6Addresses\":[],\"macAddress\":\"06:0a:62:00:64:5f\",\"networkInterfaceId\":\"eni-09a604c0ec356b06f\",\"ownerId\":\"0123456789012\",\"privateDnsName\":\"ip-172-31-70-9.ec2.internal\",\"privateIpAddress\":\"172.31.70.9\",\"privateIpAddresses\":[{\"association\":null,\"primary\":true,\"privateDnsName\":\"ip-172-31-70-9.ec2.internal\",\"privateIpAddress\":\"172.31.70.9\"}],\"sourceDestCheck\":true,\"status\":\"in-use\",\"subnetId\":\"subnet-cad1f2f4\",\"vpcId\":\"vpc-2d96be57\",\"interfaceType\":\"interface\"}],\"outpostArn\":null,\"rootDeviceName\":\"/dev/xvda\",\"rootDeviceType\":\"ebs\",\"securityGroups\":[{\"groupName\":\"minhaec2\",\"groupId\":\"sg-0fb295a327d9b4835\"}],\"sourceDestCheck\":true,\"spotInstanceRequestId\":null,\"sriovNetSupport\":null,\"stateReason\":{\"code\":\"Client.UserInitiatedShutdown\",\"message\":\"Client.UserInitiatedShutdown: User initiated shutdown\"},\"tags\":[{\"key\":\"projeto\",\"value\":\"meetup\"},{\"key\":\"Name\",\"value\":\"Minha\"},{\"key\":\"CentroCusto\",\"value\":\"TI\"},{\"key\":\"Setor\",\"value\":\"Desenvolvimento\"}],\"virtualizationType\":\"hvm\",\"cpuOptions\":{\"coreCount\":2,\"threadsPerCore\":1},\"capacityReservationId\":null,\"capacityReservationSpecification\":{\"capacityReservationPreference\":\"open\",\"capacityReservationTarget\":null},\"hibernationOptions\":{\"configured\":false},\"licenses\":[],\"metadataOptions\":{\"state\":\"applied\",\"httpTokens\":\"optional\",\"httpPutResponseHopLimit\":1,\"httpEndpoint\":\"enabled\"},\"enclaveOptions\":{\"enabled\":false},\"bootMode\":null},\"supplementaryConfiguration\":{},\"tags\":{\"projeto\":\"meetup\",\"Setor\":\"Desenvolvimento\",\"CentroCusto\":\"TI\",\"Name\":\"Minha\"},\"configurationItemVersion\":\"1.3\",\"configurationItemCaptureTime\":\"2023-04-27T15:03:11.636Z\",\"configurationStateId\":1682607791636,\"awsAccountId\":\"0123456789012\",\"configurationItemStatus\":\"OK\",\"resourceType\":\"AWS::EC2::Instance\",\"resourceId\":\"i-042dd005362091826\",\"resourceName\":null,\"ARN\":\"arn:aws:ec2:us-east-1:0123456789012:instance/i-042dd005362091826\",\"awsRegion\":\"us-east-1\",\"availabilityZone\":\"us-east-1e\",\"configurationStateMd5Hash\":\"\",\"resourceCreationTime\":\"2023-04-27T14:57:16.000Z\"},\"notificationCreationTime\":\"2023-04-27T15:03:13.332Z\",\"messageType\":\"ConfigurationItemChangeNotification\",\"recordVersion\":\"1.3\"}", - "ruleParameters":"{\"desiredInstanceType\": \"t2.micro\"}", - "resultToken":"eyJlbmNyeXB0ZWREYXRhIjpbLTQxLDEsLTU3LC0zMCwtMTIxLDUzLDUyLDQ1LC01NywtOCw3MywtODEsLTExNiwtMTAyLC01MiwxMTIsLTQ3LDU4LDY1LC0xMjcsMTAyLDUsLTY5LDQ0LC0xNSwxMTQsNDEsLTksMTExLC0zMCw2NSwtNzUsLTM1LDU0LDEwNSwtODksODYsNDAsLTEwNSw5OCw2NSwtMTE5LC02OSwyNCw2NiwtMjAsODAsLTExMiwtNzgsLTgwLDQzLC01NywzMCwtMjUsODIsLTEwLDMsLTQsLTg1LC01MywtMzcsLTkwLC04OCwtOTgsLTk4LC00MSwxOSwxMTYsNjIsLTIzLC0xMjEsLTEwOCw1NywtNTgsLTUyLDI5LDEwMSwxMjIsLTU2LC03MSwtODEsLTQ3LDc3LC0yMiwtMTI0LC0zLC04NiwtMTIyLC00MCwtODksLTEwMSw1NywtMTI3LC0zNywtMzcsLTMxLC05OCwtMzEsMTEsLTEyNSwwLDEwOCwtMzIsNjQsNjIsLTIyLDAsNDcsLTEwNiwtMTAwLDEwNCwxNCw1OCwxMjIsLTEwLC01MCwtOTAsLTgwLC01MCwtNSw2NSwwLC0yNSw4NSw4Miw3LDkzLDEyMiwtODIsLTExNiwtNzksLTQ0LDcyLC03MywtNjksMTQsLTU2LDk0LDkwLDExNCwtMjksLTExOSwtNzEsODgsMTA3LDEwNywxMTAsLTcsMTI3LC0xMjUsLTU3LC0xMjYsLTEyMCw2OSwtMTI3LC03NiwtMTE5LDcxLDEsLTY4LDEwNywxMTMsLTU2LDg3LC0xMDIsLTE2LDEwOCwtMTA3LC00MywtOTQsLTEwNiwzLDkwLDE0LDcyLC0xMiwtMTE2LC03Myw4MCwtMTIyLDQ0LC0xMDQsMTIsNzQsNTcsLTEwLC0xMDUsLTExMiwtMzYsMjgsLTQ1LDk3LDExLC00OSwtMTEsNjEsMzYsLTE3LC03NCw1MCw0LC0yNiwxMDQsLTI4LC0xMjUsMjQsNzAsLTg1LC00Niw5MiwtMTAzLC00MSwtMTA2LDY5LDEyMiwyMSwtMjUsODAsOTksLTkzLC01NiwtMjUsLTQ3LC0xMjMsLTU5LC0xMjQsLTUyLC0xNiwxMjcsLTM4LC0xNiwxMDEsMTE5LDEwNywyNywxMCwtNDYsLTg3LC0xMiwtMzksMTQsNDUsMiw3MCwxMDcsMTA0LC00LC02OSwtMTIsNTksLTEyNiwtOTEsMTI3LDU0LDEwNiwtMTI2LC0xMTYsLTEwMiw3Miw4MSw1MCw3NSwtNTEsMTA4LDQxLC0zLC02LC00NSwxMDMsLTg2LDM3LC00NiwtMzIsLTExMSwxMjQsMTExLDg3LDU0LC03NiwxMjIsLTUsLTM2LC04OCw5LC0xMTMsMTE2LC01OSw4Myw3NywyOCwxMiwtNjUsLTExMywtNzksLTEyOCw4MiwtMTE4LC04MywtMTI0LDMxLDk5LC05MCwtOTksMTYsLTEyMywyMSwtMTE0LC05OCwtMTE2LC0xMTksMiwtNzMsNDYsODIsLTEzLDU0LDcxLC00MiwyNSw3NCw3MywtODYsOTQsNDYsOTksOTMsLTgyLDU1LDY1LC05OCw0OSwtNjAsMTEyLDEwMSwyMiw2OSwtMTYsNzcsLTk0LC01OSwtNDYsMTE1LDMwLC00Myw5Myw4OCwtMjgsMzgsNiw4NCwzMSwtMTAxLDMyLC0yMiwtNjMsLTk1LDExNCwtNzUsMTE0LDM2LC04NCw0MCwtNDQsLTEzLDU5LDcyLC0xLC0xMDMsMzEsMTA1LDY5LDY5LDc3LC02NCwtNTYsMTE4LDEzLC0xMTQsODAsOTksLTUzLDI1LDQyLDk0LDczLC04MCwyNSwzOCwyNCwtMTcsNjYsLTExOCwtMjMsMTE5LDkwLDEyMSwxMTgsLTUxLDUxLC0xMiwtNzYsLTUxLDksLTIxLDExNCwtMzcsLTY0LC0yLC0xMjYsLTk1LDYzLDczLC00MSwtMzQsLTkwLC0yMiw1OSwtNzksMzAsLTQsLTEsLTUsMTIsMzksLTk5LC0xMDUsLTEwNCwtNjEsNjUsLTc0LDE5LC0xMywtNjAsLTI4LC04LDQsLTgsMTIxLC0xMTgsMTIyLC02NSwtMjEsMjMsMTcsLTg0LDQwLC05MiwxNCwtMTI2LC02MCwtNzksLTUzLDM3LC04Myw2NSwxMDQsLTM2LC02MCwtMTEwLC0zMywtMTE3LDYsMTA3LDEsLTMsOTMsNzgsLTk1LC0xMjIsNTMsMTA4LC00OSwtNDksMjQsLTY1LDgzLDEyNSwtNzcsLTE5LC04MSwzNCwtNjcsLTQzLC03MCwtMjYsMTgsMTA0LDY1LDQsLTEyNiw0NCwtMTE5LDUyLC00NiwyMiw2NywxMTMsMTE4LC0zMywzNCwtOTYsMTIxLDE5LC0yLC0zNSwwLC04MiwxNyw2NiwtMjcsNjksLTM2LC0xNCw1NiwtOTcsLTE2LDEyMywyOCwtOTUsLTMyLC02MywtNjksNzAsNjQsLTMzLC0xMDAsNDMsLTExMywxMDUsMTAwLDEwOCwtNjAsNDAsLTIsLTk2LC0xMjQsMzcsLTQ1LC0xMjQsLTY4LC02OSwtMTIzLDE3LC02LDg2LC01OSwtOTQsMTEwLDczLDU3LC0xMTYsMTA3LC00MSwtOTQsLTExOCwtMTI2LDEwLC04MCwtNzAsMTAyLDg4LC0xMjYsODcsLTI3LC0xMDEsLTk0LC0zNSwtMTA2LC02LC03MiwtODYsNTAsMTE2LC0yOCw5MCwxMywtMTIwLDYsMjcsOTIsNTYsLTkwLDM5LDQ5LC0xMywtODYsLTI1LC04NiwxMTMsLTEzLDQxLC0xMTksOTQsLTk0LC0xMDMsLTgzLC02MCwxMjcsLTE1LC0zOSwxMTksLTk1LDI3LDQ0LDExNiwxMDksNywtMTAyLC0xNyw0OCwtODIsLTMxLC04LC02OSwzNSw5NCw1NCwtNTUsMSwtMTE5LDU3LC0xMDgsLTMsLTkxLC0xMjIsLTUzLC04OCw0LC05NywtMzUsMTI2LDExOSw1OSwtMSw4NSw3MywtNTgsLTEyMCwtNjQsMTE5LC0xMTIsOTIsMTksOSwtNjYsLTkyLDEwOCwtMTEsLTQyLDExMSwtMTA0LC0xMjAsMjcsLTEwMywtNjksMTksMTExLDEyLDIzLDEwNyw1NCw0MSwtMjYsNjAsLTMxLC01XSwibWF0ZXJpYWxTZXRTZXJpYWxOdW1iZXIiOjEsIml2UGFyYW1ldGVyU3BlYyI6eyJpdiI6Wy05NSwzMiwxMDgsOTEsMzUsLTgyLC0zNywyNCwtNDQsLTExNSwtODIsLTEyOCwtMTIyLDMsNTMsLTI0XX19", - "eventLeftScope":false, - "executionRoleArn":"arn:aws:iam::0123456789012:role/aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig", - "configRuleArn":"arn:aws:config:us-east-1:0123456789012:config-rule/config-rule-i9y8j9", - "configRuleName":"MyRule", - "configRuleId":"config-rule-i9y8j9", - "accountId":"0123456789012", - "evaluationMode":"DETECTIVE" - } + "version": "1.0", + "invokingEvent": "{\"configurationItemDiff\":{\"changedProperties\":{\"Configuration.InstanceType\":{\"previousValue\":\"t2.micro\",\"updatedValue\":\"t2.medium\",\"changeType\":\"UPDATE\"},\"Configuration.State.Name\":{\"previousValue\":\"running\",\"updatedValue\":\"stopped\",\"changeType\":\"UPDATE\"},\"Configuration.StateTransitionReason\":{\"previousValue\":\"\",\"updatedValue\":\"User initiated (2023-04-27 15:01:07 GMT)\",\"changeType\":\"UPDATE\"},\"Configuration.StateReason\":{\"previousValue\":null,\"updatedValue\":{\"code\":\"Client.UserInitiatedShutdown\",\"message\":\"Client.UserInitiatedShutdown: User initiated shutdown\"},\"changeType\":\"CREATE\"},\"Configuration.CpuOptions.CoreCount\":{\"previousValue\":1,\"updatedValue\":2,\"changeType\":\"UPDATE\"}},\"changeType\":\"UPDATE\"},\"configurationItem\":{\"relatedEvents\":[],\"relationships\":[{\"resourceId\":\"eipalloc-0ebb4367662263cc1\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::EIP\",\"name\":\"Is attached to ElasticIp\"},{\"resourceId\":\"eni-034dd31c4b17ada8c\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::NetworkInterface\",\"name\":\"Contains NetworkInterface\"},{\"resourceId\":\"eni-09a604c0ec356b06f\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::NetworkInterface\",\"name\":\"Contains NetworkInterface\"},{\"resourceId\":\"sg-0fb295a327d9b4835\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::SecurityGroup\",\"name\":\"Is associated with SecurityGroup\"},{\"resourceId\":\"subnet-cad1f2f4\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::Subnet\",\"name\":\"Is contained in Subnet\"},{\"resourceId\":\"vol-0a288b5eb9fea4b30\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::Volume\",\"name\":\"Is attached to Volume\"},{\"resourceId\":\"vpc-2d96be57\",\"resourceName\":null,\"resourceType\":\"AWS::EC2::VPC\",\"name\":\"Is contained in Vpc\"}],\"configuration\":{\"amiLaunchIndex\":0,\"imageId\":\"ami-09d95fab7fff3776c\",\"instanceId\":\"i-042dd005362091826\",\"instanceType\":\"t2.medium\",\"kernelId\":null,\"keyName\":\"mihaec2\",\"launchTime\":\"2023-04-27T14:57:16.000Z\",\"monitoring\":{\"state\":\"disabled\"},\"placement\":{\"availabilityZone\":\"us-east-1e\",\"affinity\":null,\"groupName\":\"\",\"partitionNumber\":null,\"hostId\":null,\"tenancy\":\"default\",\"spreadDomain\":null,\"hostResourceGroupArn\":null},\"platform\":null,\"privateDnsName\":\"ip-172-31-78-41.ec2.internal\",\"privateIpAddress\":\"172.31.78.41\",\"productCodes\":[],\"publicDnsName\":\"ec2-3-232-229-57.compute-1.amazonaws.com\",\"publicIpAddress\":\"3.232.229.57\",\"ramdiskId\":null,\"state\":{\"code\":80,\"name\":\"stopped\"},\"stateTransitionReason\":\"User initiated (2023-04-27 15:01:07 GMT)\",\"subnetId\":\"subnet-cad1f2f4\",\"vpcId\":\"vpc-2d96be57\",\"architecture\":\"x86_64\",\"blockDeviceMappings\":[{\"deviceName\":\"/dev/xvda\",\"ebs\":{\"attachTime\":\"2020-05-30T15:21:58.000Z\",\"deleteOnTermination\":true,\"status\":\"attached\",\"volumeId\":\"vol-0a288b5eb9fea4b30\"}}],\"clientToken\":\"\",\"ebsOptimized\":false,\"enaSupport\":true,\"hypervisor\":\"xen\",\"iamInstanceProfile\":{\"arn\":\"arn:aws:iam::0123456789012:instance-profile/AmazonSSMRoleForInstancesQuickSetup\",\"id\":\"AIPAS5S4WFUBL72S3QXW5\"},\"instanceLifecycle\":null,\"elasticGpuAssociations\":[],\"elasticInferenceAcceleratorAssociations\":[],\"networkInterfaces\":[{\"association\":{\"carrierIp\":null,\"ipOwnerId\":\"0123456789012\",\"publicDnsName\":\"ec2-3-232-229-57.compute-1.amazonaws.com\",\"publicIp\":\"3.232.229.57\"},\"attachment\":{\"attachTime\":\"2020-05-30T15:21:57.000Z\",\"attachmentId\":\"eni-attach-0a7e75dc9c1c291a0\",\"deleteOnTermination\":true,\"deviceIndex\":0,\"status\":\"attached\",\"networkCardIndex\":0},\"description\":\"\",\"groups\":[{\"groupName\":\"minhaec2\",\"groupId\":\"sg-0fb295a327d9b4835\"}],\"ipv6Addresses\":[],\"macAddress\":\"06:cf:00:c2:17:db\",\"networkInterfaceId\":\"eni-034dd31c4b17ada8c\",\"ownerId\":\"0123456789012\",\"privateDnsName\":\"ip-172-31-78-41.ec2.internal\",\"privateIpAddress\":\"172.31.78.41\",\"privateIpAddresses\":[{\"association\":{\"carrierIp\":null,\"ipOwnerId\":\"0123456789012\",\"publicDnsName\":\"ec2-3-232-229-57.compute-1.amazonaws.com\",\"publicIp\":\"3.232.229.57\"},\"primary\":true,\"privateDnsName\":\"ip-172-31-78-41.ec2.internal\",\"privateIpAddress\":\"172.31.78.41\"}],\"sourceDestCheck\":true,\"status\":\"in-use\",\"subnetId\":\"subnet-cad1f2f4\",\"vpcId\":\"vpc-2d96be57\",\"interfaceType\":\"interface\"},{\"association\":null,\"attachment\":{\"attachTime\":\"2020-11-26T23:46:04.000Z\",\"attachmentId\":\"eni-attach-0e6d150ebbd19966e\",\"deleteOnTermination\":false,\"deviceIndex\":1,\"status\":\"attached\",\"networkCardIndex\":0},\"description\":\"MINHAEC2AAAAAA\",\"groups\":[{\"groupName\":\"minhaec2\",\"groupId\":\"sg-0fb295a327d9b4835\"},{\"groupName\":\"default\",\"groupId\":\"sg-88105fa0\"}],\"ipv6Addresses\":[],\"macAddress\":\"06:0a:62:00:64:5f\",\"networkInterfaceId\":\"eni-09a604c0ec356b06f\",\"ownerId\":\"0123456789012\",\"privateDnsName\":\"ip-172-31-70-9.ec2.internal\",\"privateIpAddress\":\"172.31.70.9\",\"privateIpAddresses\":[{\"association\":null,\"primary\":true,\"privateDnsName\":\"ip-172-31-70-9.ec2.internal\",\"privateIpAddress\":\"172.31.70.9\"}],\"sourceDestCheck\":true,\"status\":\"in-use\",\"subnetId\":\"subnet-cad1f2f4\",\"vpcId\":\"vpc-2d96be57\",\"interfaceType\":\"interface\"}],\"outpostArn\":null,\"rootDeviceName\":\"/dev/xvda\",\"rootDeviceType\":\"ebs\",\"securityGroups\":[{\"groupName\":\"minhaec2\",\"groupId\":\"sg-0fb295a327d9b4835\"}],\"sourceDestCheck\":true,\"spotInstanceRequestId\":null,\"sriovNetSupport\":null,\"stateReason\":{\"code\":\"Client.UserInitiatedShutdown\",\"message\":\"Client.UserInitiatedShutdown: User initiated shutdown\"},\"tags\":[{\"key\":\"projeto\",\"value\":\"meetup\"},{\"key\":\"Name\",\"value\":\"Minha\"},{\"key\":\"CentroCusto\",\"value\":\"TI\"},{\"key\":\"Setor\",\"value\":\"Desenvolvimento\"}],\"virtualizationType\":\"hvm\",\"cpuOptions\":{\"coreCount\":2,\"threadsPerCore\":1},\"capacityReservationId\":null,\"capacityReservationSpecification\":{\"capacityReservationPreference\":\"open\",\"capacityReservationTarget\":null},\"hibernationOptions\":{\"configured\":false},\"licenses\":[],\"metadataOptions\":{\"state\":\"applied\",\"httpTokens\":\"optional\",\"httpPutResponseHopLimit\":1,\"httpEndpoint\":\"enabled\"},\"enclaveOptions\":{\"enabled\":false},\"bootMode\":null},\"supplementaryConfiguration\":{},\"tags\":{\"projeto\":\"meetup\",\"Setor\":\"Desenvolvimento\",\"CentroCusto\":\"TI\",\"Name\":\"Minha\"},\"configurationItemVersion\":\"1.3\",\"configurationItemCaptureTime\":\"2023-04-27T15:03:11.636Z\",\"configurationStateId\":1682607791636,\"awsAccountId\":\"0123456789012\",\"configurationItemStatus\":\"OK\",\"resourceType\":\"AWS::EC2::Instance\",\"resourceId\":\"i-042dd005362091826\",\"resourceName\":null,\"ARN\":\"arn:aws:ec2:us-east-1:0123456789012:instance/i-042dd005362091826\",\"awsRegion\":\"us-east-1\",\"availabilityZone\":\"us-east-1e\",\"configurationStateMd5Hash\":\"\",\"resourceCreationTime\":\"2023-04-27T14:57:16.000Z\"},\"notificationCreationTime\":\"2023-04-27T15:03:13.332Z\",\"messageType\":\"ConfigurationItemChangeNotification\",\"recordVersion\":\"1.3\"}", + "ruleParameters": "{\"desiredInstanceType\": \"t2.micro\"}", + "resultToken": "eyJlbmNyeXB0ZWREYXRhIjpbLTQxLDEsLTU3LC0zMCwtMTIxLDUzLDUyLDQ1LC01NywtOCw3MywtODEsLTExNiwtMTAyLC01MiwxMTIsLTQ3LDU4LDY1LC0xMjcsMTAyLDUsLTY5LDQ0LC0xNSwxMTQsNDEsLTksMTExLC0zMCw2NSwtNzUsLTM1LDU0LDEwNSwtODksODYsNDAsLTEwNSw5OCw2NSwtMTE5LC02OSwyNCw2NiwtMjAsODAsLTExMiwtNzgsLTgwLDQzLC01NywzMCwtMjUsODIsLTEwLDMsLTQsLTg1LC01MywtMzcsLTkwLC04OCwtOTgsLTk4LC00MSwxOSwxMTYsNjIsLTIzLC0xMjEsLTEwOCw1NywtNTgsLTUyLDI5LDEwMSwxMjIsLTU2LC03MSwtODEsLTQ3LDc3LC0yMiwtMTI0LC0zLC04NiwtMTIyLC00MCwtODksLTEwMSw1NywtMTI3LC0zNywtMzcsLTMxLC05OCwtMzEsMTEsLTEyNSwwLDEwOCwtMzIsNjQsNjIsLTIyLDAsNDcsLTEwNiwtMTAwLDEwNCwxNCw1OCwxMjIsLTEwLC01MCwtOTAsLTgwLC01MCwtNSw2NSwwLC0yNSw4NSw4Miw3LDkzLDEyMiwtODIsLTExNiwtNzksLTQ0LDcyLC03MywtNjksMTQsLTU2LDk0LDkwLDExNCwtMjksLTExOSwtNzEsODgsMTA3LDEwNywxMTAsLTcsMTI3LC0xMjUsLTU3LC0xMjYsLTEyMCw2OSwtMTI3LC03NiwtMTE5LDcxLDEsLTY4LDEwNywxMTMsLTU2LDg3LC0xMDIsLTE2LDEwOCwtMTA3LC00MywtOTQsLTEwNiwzLDkwLDE0LDcyLC0xMiwtMTE2LC03Myw4MCwtMTIyLDQ0LC0xMDQsMTIsNzQsNTcsLTEwLC0xMDUsLTExMiwtMzYsMjgsLTQ1LDk3LDExLC00OSwtMTEsNjEsMzYsLTE3LC03NCw1MCw0LC0yNiwxMDQsLTI4LC0xMjUsMjQsNzAsLTg1LC00Niw5MiwtMTAzLC00MSwtMTA2LDY5LDEyMiwyMSwtMjUsODAsOTksLTkzLC01NiwtMjUsLTQ3LC0xMjMsLTU5LC0xMjQsLTUyLC0xNiwxMjcsLTM4LC0xNiwxMDEsMTE5LDEwNywyNywxMCwtNDYsLTg3LC0xMiwtMzksMTQsNDUsMiw3MCwxMDcsMTA0LC00LC02OSwtMTIsNTksLTEyNiwtOTEsMTI3LDU0LDEwNiwtMTI2LC0xMTYsLTEwMiw3Miw4MSw1MCw3NSwtNTEsMTA4LDQxLC0zLC02LC00NSwxMDMsLTg2LDM3LC00NiwtMzIsLTExMSwxMjQsMTExLDg3LDU0LC03NiwxMjIsLTUsLTM2LC04OCw5LC0xMTMsMTE2LC01OSw4Myw3NywyOCwxMiwtNjUsLTExMywtNzksLTEyOCw4MiwtMTE4LC04MywtMTI0LDMxLDk5LC05MCwtOTksMTYsLTEyMywyMSwtMTE0LC05OCwtMTE2LC0xMTksMiwtNzMsNDYsODIsLTEzLDU0LDcxLC00MiwyNSw3NCw3MywtODYsOTQsNDYsOTksOTMsLTgyLDU1LDY1LC05OCw0OSwtNjAsMTEyLDEwMSwyMiw2OSwtMTYsNzcsLTk0LC01OSwtNDYsMTE1LDMwLC00Myw5Myw4OCwtMjgsMzgsNiw4NCwzMSwtMTAxLDMyLC0yMiwtNjMsLTk1LDExNCwtNzUsMTE0LDM2LC04NCw0MCwtNDQsLTEzLDU5LDcyLC0xLC0xMDMsMzEsMTA1LDY5LDY5LDc3LC02NCwtNTYsMTE4LDEzLC0xMTQsODAsOTksLTUzLDI1LDQyLDk0LDczLC04MCwyNSwzOCwyNCwtMTcsNjYsLTExOCwtMjMsMTE5LDkwLDEyMSwxMTgsLTUxLDUxLC0xMiwtNzYsLTUxLDksLTIxLDExNCwtMzcsLTY0LC0yLC0xMjYsLTk1LDYzLDczLC00MSwtMzQsLTkwLC0yMiw1OSwtNzksMzAsLTQsLTEsLTUsMTIsMzksLTk5LC0xMDUsLTEwNCwtNjEsNjUsLTc0LDE5LC0xMywtNjAsLTI4LC04LDQsLTgsMTIxLC0xMTgsMTIyLC02NSwtMjEsMjMsMTcsLTg0LDQwLC05MiwxNCwtMTI2LC02MCwtNzksLTUzLDM3LC04Myw2NSwxMDQsLTM2LC02MCwtMTEwLC0zMywtMTE3LDYsMTA3LDEsLTMsOTMsNzgsLTk1LC0xMjIsNTMsMTA4LC00OSwtNDksMjQsLTY1LDgzLDEyNSwtNzcsLTE5LC04MSwzNCwtNjcsLTQzLC03MCwtMjYsMTgsMTA0LDY1LDQsLTEyNiw0NCwtMTE5LDUyLC00NiwyMiw2NywxMTMsMTE4LC0zMywzNCwtOTYsMTIxLDE5LC0yLC0zNSwwLC04MiwxNyw2NiwtMjcsNjksLTM2LC0xNCw1NiwtOTcsLTE2LDEyMywyOCwtOTUsLTMyLC02MywtNjksNzAsNjQsLTMzLC0xMDAsNDMsLTExMywxMDUsMTAwLDEwOCwtNjAsNDAsLTIsLTk2LC0xMjQsMzcsLTQ1LC0xMjQsLTY4LC02OSwtMTIzLDE3LC02LDg2LC01OSwtOTQsMTEwLDczLDU3LC0xMTYsMTA3LC00MSwtOTQsLTExOCwtMTI2LDEwLC04MCwtNzAsMTAyLDg4LC0xMjYsODcsLTI3LC0xMDEsLTk0LC0zNSwtMTA2LC02LC03MiwtODYsNTAsMTE2LC0yOCw5MCwxMywtMTIwLDYsMjcsOTIsNTYsLTkwLDM5LDQ5LC0xMywtODYsLTI1LC04NiwxMTMsLTEzLDQxLC0xMTksOTQsLTk0LC0xMDMsLTgzLC02MCwxMjcsLTE1LC0zOSwxMTksLTk1LDI3LDQ0LDExNiwxMDksNywtMTAyLC0xNyw0OCwtODIsLTMxLC04LC02OSwzNSw5NCw1NCwtNTUsMSwtMTE5LDU3LC0xMDgsLTMsLTkxLC0xMjIsLTUzLC04OCw0LC05NywtMzUsMTI2LDExOSw1OSwtMSw4NSw3MywtNTgsLTEyMCwtNjQsMTE5LC0xMTIsOTIsMTksOSwtNjYsLTkyLDEwOCwtMTEsLTQyLDExMSwtMTA0LC0xMjAsMjcsLTEwMywtNjksMTksMTExLDEyLDIzLDEwNyw1NCw0MSwtMjYsNjAsLTMxLC01XSwibWF0ZXJpYWxTZXRTZXJpYWxOdW1iZXIiOjEsIml2UGFyYW1ldGVyU3BlYyI6eyJpdiI6Wy05NSwzMiwxMDgsOTEsMzUsLTgyLC0zNywyNCwtNDQsLTExNSwtODIsLTEyOCwtMTIyLDMsNTMsLTI0XX19", + "eventLeftScope": false, + "executionRoleArn": "arn:aws:iam::0123456789012:role/aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig", + "configRuleArn": "arn:aws:config:us-east-1:0123456789012:config-rule/config-rule-i9y8j9", + "configRuleName": "MyRule", + "configRuleId": "config-rule-i9y8j9", + "accountId": "0123456789012", + "evaluationMode": "DETECTIVE" +} diff --git a/packages/parser/tests/events/awsConfigRuleOversizedConfiguration.json b/packages/parser/tests/events/awsConfigRuleOversizedConfiguration.json index 5eaef4e001..c731919c6a 100644 --- a/packages/parser/tests/events/awsConfigRuleOversizedConfiguration.json +++ b/packages/parser/tests/events/awsConfigRuleOversizedConfiguration.json @@ -1,12 +1,12 @@ { - "invokingEvent": "{\"configurationItemSummary\": {\"changeType\": \"UPDATE\",\"configurationItemVersion\": \"1.2\",\"configurationItemCaptureTime\":\"2016-10-06T16:46:16.261Z\",\"configurationStateId\": 0,\"awsAccountId\":\"123456789012\",\"configurationItemStatus\": \"OK\",\"resourceType\": \"AWS::EC2::Instance\",\"resourceId\":\"i-00000000\",\"resourceName\":null,\"ARN\":\"arn:aws:ec2:us-west-2:123456789012:instance/i-00000000\",\"awsRegion\": \"us-west-2\",\"availabilityZone\":\"us-west-2a\",\"configurationStateMd5Hash\":\"8f1ee69b287895a0f8bc5753eca68e96\",\"resourceCreationTime\":\"2016-10-06T16:46:10.489Z\"},\"messageType\":\"OversizedConfigurationItemChangeNotification\", \"notificationCreationTime\": \"2016-10-06T16:46:16.261Z\", \"recordVersion\": \"1.0\"}", - "ruleParameters": "{\"myParameterKey\":\"myParameterValue\"}", - "resultToken": "myResultToken", - "eventLeftScope": false, - "executionRoleArn": "arn:aws:iam::123456789012:role/config-role", - "configRuleArn": "arn:aws:config:us-east-2:123456789012:config-rule/config-rule-ec2-managed-instance-inventory", - "configRuleName": "change-triggered-config-rule", - "configRuleId": "config-rule-0123456", - "accountId": "123456789012", - "version": "1.0" + "invokingEvent": "{\"configurationItemSummary\": {\"changeType\": \"UPDATE\",\"configurationItemVersion\": \"1.2\",\"configurationItemCaptureTime\":\"2016-10-06T16:46:16.261Z\",\"configurationStateId\": 0,\"awsAccountId\":\"123456789012\",\"configurationItemStatus\": \"OK\",\"resourceType\": \"AWS::EC2::Instance\",\"resourceId\":\"i-00000000\",\"resourceName\":null,\"ARN\":\"arn:aws:ec2:us-west-2:123456789012:instance/i-00000000\",\"awsRegion\": \"us-west-2\",\"availabilityZone\":\"us-west-2a\",\"configurationStateMd5Hash\":\"8f1ee69b287895a0f8bc5753eca68e96\",\"resourceCreationTime\":\"2016-10-06T16:46:10.489Z\"},\"messageType\":\"OversizedConfigurationItemChangeNotification\", \"notificationCreationTime\": \"2016-10-06T16:46:16.261Z\", \"recordVersion\": \"1.0\"}", + "ruleParameters": "{\"myParameterKey\":\"myParameterValue\"}", + "resultToken": "myResultToken", + "eventLeftScope": false, + "executionRoleArn": "arn:aws:iam::123456789012:role/config-role", + "configRuleArn": "arn:aws:config:us-east-2:123456789012:config-rule/config-rule-ec2-managed-instance-inventory", + "configRuleName": "change-triggered-config-rule", + "configRuleId": "config-rule-0123456", + "accountId": "123456789012", + "version": "1.0" } diff --git a/packages/parser/tests/events/awsConfigRuleScheduled.json b/packages/parser/tests/events/awsConfigRuleScheduled.json index 02ce2a0700..491855621a 100644 --- a/packages/parser/tests/events/awsConfigRuleScheduled.json +++ b/packages/parser/tests/events/awsConfigRuleScheduled.json @@ -1,13 +1,13 @@ { - "version":"1.0", - "invokingEvent":"{\"awsAccountId\":\"0123456789012\",\"notificationCreationTime\":\"2023-04-27T13:26:17.741Z\",\"messageType\":\"ScheduledNotification\",\"recordVersion\":\"1.0\"}", - "ruleParameters":"{\"test\":\"x\"}", - "resultToken":"eyJlbmNyeXB0ZWREYXRhIjpbLTQyLDEyNiw1MiwtMzcsLTI5LDExNCwxMjYsLTk3LDcxLDIyLC0xMTAsMTEyLC0zMSwtOTMsLTQ5LC0xMDEsODIsMyw1NCw0OSwzLC02OSwtNzEsLTcyLDYyLDgxLC03MiwtODEsNTAsMzUsLTUwLC03NSwtMTE4LC0xMTgsNzcsMTIsLTEsMTQsMTIwLC03MCwxMTAsLTMsNTAsLTYwLDEwNSwtNTcsNDUsMTAyLC0xMDksLTYxLC0xMDEsLTYxLDQsNDcsLTg0LC0yNSwxMTIsNTQsLTcxLC0xMDksNDUsMTksMTIzLC0yNiwxMiwtOTYsLTczLDU0LC0xMDksOTIsNDgsLTU5LC04MywtMzIsODIsLTM2LC05MCwxOSw5OCw3Nyw3OCw0MCw4MCw3OCwtMTA1LDg3LC0xMTMsLTExNiwtNzIsMzAsLTY4LC00MCwtODksMTA5LC0xMDgsLTEyOCwyMiw3Miw3NywtMjEsNzYsODksOTQsLTU5LDgxLC0xMjEsLTEwNywtNjcsNjMsLTcsODIsLTg5LC00NiwtMzQsLTkyLDEyMiwtOTAsMTcsLTEyMywyMCwtODUsLTU5LC03MCw4MSwyNyw2Miw3NCwtODAsODAsMzcsNDAsMTE2LDkxLC0yNCw1MSwtNDEsLTc5LDI4LDEyMCw1MywtMTIyLC04MywxMjYsLTc4LDI1LC05OCwtMzYsMTMsMzIsODYsLTI1LDQ4LDMsLTEwMiwtMTYsMjQsLTMsODUsNDQsLTI4LDE0LDIyLDI3LC0xMjIsMTE4LDEwMSw3Myw1LDE4LDU4LC02NCwyMywtODYsLTExNCwyNCwwLDEwMCwyLDExNywtNjIsLTExOSwtMTI4LDE4LDY1LDkwLDE0LC0xMDIsMjEsODUsMTAwLDExNyw1NSwyOSwxMjcsNTQsNzcsNzIsNzQsMzIsNzgsMywtMTExLDExOCwtNzAsLTg2LDEyNywtNzQsNjAsMjIsNDgsMzcsODcsMTMsMCwtMTA1LDUsLTEyMiwtNzEsLTEwMCwxMDQsLTEyNiwtMTYsNzksLTMwLDEyMCw3NywtNzYsLTQxLC0xMDksMiw5NywtMTAxLC0xLDE1LDEyMywxMTksMTA4LDkxLC0yMCwtMTI1LC05NiwyLC05MiwtMTUsLTY3LC03NiwxMjEsMTA0LDEwNSw2NCwtNjIsMTAyLDgsNCwxMjEsLTQ1LC04MCwtODEsLTgsMTE4LDQ0LC04MiwtNDEsLTg0LDczLC0zNiwxMTcsODAsLTY5LC03MywxNCwtMTgsNzIsMzEsLTUsLTExMSwtMTI3LC00MywzNCwtOCw1NywxMDMsLTQyLDE4LC0zMywxMTcsLTI2LC0xMjQsLTEyNCwxNSw4OCwyMywxNiwtNTcsNTQsLTYsLTEwMiwxMTYsLTk5LC00NSwxMDAsLTM1LDg3LDM3LDYsOTgsMiwxMTIsNjAsLTMzLDE3LDI2LDk5LC0xMDUsNDgsLTEwNCwtMTE5LDc4LDYsLTU4LDk1LDksNDEsLTE2LDk2LDQxLC0yMiw5Niw3MiwxMTYsLTk1LC0xMDUsLTM2LC0xMjMsLTU1LDkxLC00NiwtNywtOTIsMzksNDUsODQsMTYsLTEyNCwtMTIyLC02OCwxLC0yOCwxMjIsLTYwLDgyLDEwMywtNTQsLTkyLDI3LC05OSwtMTI4LDY1LDcsLTcyLC0xMjcsNjIsLTIyLDIsLTExLDE4LC04OSwtMTA2LC03NCw3MSw4NiwtMTE2LC0yNSwtMTE1LC05Niw1NywtMzQsMjIsLTEyNCwtMTI1LC00LC00MSw0MiwtNTcsLTEwMyw0NSw3OCwxNCwtMTA2LDExMSw5OCwtOTQsLTcxLDUsNzUsMTksLTEyNCwtMzAsMzQsLTUwLDc1LC04NCwtNTAsLTU2LDUxLC0xNSwtMzYsNjEsLTk0LC03OSwtNDUsMTI2LC03NywtMTA1LC0yLC05MywtNiw4LC0zLDYsLTQyLDQ2LDEyNSw1LC05OCwxMyw2NywtMTAsLTEzLC05NCwtNzgsLTEyNywxMjEsLTI2LC04LC0xMDEsLTkxLDEyMSwtNDAsLTEyNCwtNjQsODQsLTcyLDYzLDE5LC04NF0sIm1hdGVyaWFsU2V0U2VyaWFsTnVtYmVyIjoxLCJpdlBhcmFtZXRlclNwZWMiOnsiaXYiOlszLC0xMCwtODUsMTE0LC05MCwxMTUsNzcsNTUsNTQsMTUsMzgsODQsLTExNiwxNCwtNDAsMjhdfX0=", - "eventLeftScope":false, - "executionRoleArn":"arn:aws:iam::0123456789012:role/aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig", - "configRuleArn":"arn:aws:config:us-east-1:0123456789012:config-rule/config-rule-pdmyw1", - "configRuleName":"rule-ec2-test", - "configRuleId":"config-rule-pdmyw1", - "accountId":"0123456789012", - "evaluationMode":"DETECTIVE" - } + "version": "1.0", + "invokingEvent": "{\"awsAccountId\":\"0123456789012\",\"notificationCreationTime\":\"2023-04-27T13:26:17.741Z\",\"messageType\":\"ScheduledNotification\",\"recordVersion\":\"1.0\"}", + "ruleParameters": "{\"test\":\"x\"}", + "resultToken": "eyJlbmNyeXB0ZWREYXRhIjpbLTQyLDEyNiw1MiwtMzcsLTI5LDExNCwxMjYsLTk3LDcxLDIyLC0xMTAsMTEyLC0zMSwtOTMsLTQ5LC0xMDEsODIsMyw1NCw0OSwzLC02OSwtNzEsLTcyLDYyLDgxLC03MiwtODEsNTAsMzUsLTUwLC03NSwtMTE4LC0xMTgsNzcsMTIsLTEsMTQsMTIwLC03MCwxMTAsLTMsNTAsLTYwLDEwNSwtNTcsNDUsMTAyLC0xMDksLTYxLC0xMDEsLTYxLDQsNDcsLTg0LC0yNSwxMTIsNTQsLTcxLC0xMDksNDUsMTksMTIzLC0yNiwxMiwtOTYsLTczLDU0LC0xMDksOTIsNDgsLTU5LC04MywtMzIsODIsLTM2LC05MCwxOSw5OCw3Nyw3OCw0MCw4MCw3OCwtMTA1LDg3LC0xMTMsLTExNiwtNzIsMzAsLTY4LC00MCwtODksMTA5LC0xMDgsLTEyOCwyMiw3Miw3NywtMjEsNzYsODksOTQsLTU5LDgxLC0xMjEsLTEwNywtNjcsNjMsLTcsODIsLTg5LC00NiwtMzQsLTkyLDEyMiwtOTAsMTcsLTEyMywyMCwtODUsLTU5LC03MCw4MSwyNyw2Miw3NCwtODAsODAsMzcsNDAsMTE2LDkxLC0yNCw1MSwtNDEsLTc5LDI4LDEyMCw1MywtMTIyLC04MywxMjYsLTc4LDI1LC05OCwtMzYsMTMsMzIsODYsLTI1LDQ4LDMsLTEwMiwtMTYsMjQsLTMsODUsNDQsLTI4LDE0LDIyLDI3LC0xMjIsMTE4LDEwMSw3Myw1LDE4LDU4LC02NCwyMywtODYsLTExNCwyNCwwLDEwMCwyLDExNywtNjIsLTExOSwtMTI4LDE4LDY1LDkwLDE0LC0xMDIsMjEsODUsMTAwLDExNyw1NSwyOSwxMjcsNTQsNzcsNzIsNzQsMzIsNzgsMywtMTExLDExOCwtNzAsLTg2LDEyNywtNzQsNjAsMjIsNDgsMzcsODcsMTMsMCwtMTA1LDUsLTEyMiwtNzEsLTEwMCwxMDQsLTEyNiwtMTYsNzksLTMwLDEyMCw3NywtNzYsLTQxLC0xMDksMiw5NywtMTAxLC0xLDE1LDEyMywxMTksMTA4LDkxLC0yMCwtMTI1LC05NiwyLC05MiwtMTUsLTY3LC03NiwxMjEsMTA0LDEwNSw2NCwtNjIsMTAyLDgsNCwxMjEsLTQ1LC04MCwtODEsLTgsMTE4LDQ0LC04MiwtNDEsLTg0LDczLC0zNiwxMTcsODAsLTY5LC03MywxNCwtMTgsNzIsMzEsLTUsLTExMSwtMTI3LC00MywzNCwtOCw1NywxMDMsLTQyLDE4LC0zMywxMTcsLTI2LC0xMjQsLTEyNCwxNSw4OCwyMywxNiwtNTcsNTQsLTYsLTEwMiwxMTYsLTk5LC00NSwxMDAsLTM1LDg3LDM3LDYsOTgsMiwxMTIsNjAsLTMzLDE3LDI2LDk5LC0xMDUsNDgsLTEwNCwtMTE5LDc4LDYsLTU4LDk1LDksNDEsLTE2LDk2LDQxLC0yMiw5Niw3MiwxMTYsLTk1LC0xMDUsLTM2LC0xMjMsLTU1LDkxLC00NiwtNywtOTIsMzksNDUsODQsMTYsLTEyNCwtMTIyLC02OCwxLC0yOCwxMjIsLTYwLDgyLDEwMywtNTQsLTkyLDI3LC05OSwtMTI4LDY1LDcsLTcyLC0xMjcsNjIsLTIyLDIsLTExLDE4LC04OSwtMTA2LC03NCw3MSw4NiwtMTE2LC0yNSwtMTE1LC05Niw1NywtMzQsMjIsLTEyNCwtMTI1LC00LC00MSw0MiwtNTcsLTEwMyw0NSw3OCwxNCwtMTA2LDExMSw5OCwtOTQsLTcxLDUsNzUsMTksLTEyNCwtMzAsMzQsLTUwLDc1LC04NCwtNTAsLTU2LDUxLC0xNSwtMzYsNjEsLTk0LC03OSwtNDUsMTI2LC03NywtMTA1LC0yLC05MywtNiw4LC0zLDYsLTQyLDQ2LDEyNSw1LC05OCwxMyw2NywtMTAsLTEzLC05NCwtNzgsLTEyNywxMjEsLTI2LC04LC0xMDEsLTkxLDEyMSwtNDAsLTEyNCwtNjQsODQsLTcyLDYzLDE5LC04NF0sIm1hdGVyaWFsU2V0U2VyaWFsTnVtYmVyIjoxLCJpdlBhcmFtZXRlclNwZWMiOnsiaXYiOlszLC0xMCwtODUsMTE0LC05MCwxMTUsNzcsNTUsNTQsMTUsMzgsODQsLTExNiwxNCwtNDAsMjhdfX0=", + "eventLeftScope": false, + "executionRoleArn": "arn:aws:iam::0123456789012:role/aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig", + "configRuleArn": "arn:aws:config:us-east-1:0123456789012:config-rule/config-rule-pdmyw1", + "configRuleName": "rule-ec2-test", + "configRuleId": "config-rule-pdmyw1", + "accountId": "0123456789012", + "evaluationMode": "DETECTIVE" +} diff --git a/packages/parser/tests/events/cloudFormationCustomResourceCreateEvent.json b/packages/parser/tests/events/cloudFormationCustomResourceCreateEvent.json index 5c32d8c7aa..3550cac191 100644 --- a/packages/parser/tests/events/cloudFormationCustomResourceCreateEvent.json +++ b/packages/parser/tests/events/cloudFormationCustomResourceCreateEvent.json @@ -10,4 +10,4 @@ "ServiceToken": "arn:aws:lambda:us-east-1:xxxxx:function:xxxxx", "MyProps": "ss" } -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/cloudFormationCustomResourceDeleteEvent.json b/packages/parser/tests/events/cloudFormationCustomResourceDeleteEvent.json index f26738133d..a90b4251b9 100644 --- a/packages/parser/tests/events/cloudFormationCustomResourceDeleteEvent.json +++ b/packages/parser/tests/events/cloudFormationCustomResourceDeleteEvent.json @@ -10,4 +10,4 @@ "ServiceToken": "arn:aws:lambda:us-east-1:xxxxx:function:xxxxx", "MyProps": "ss" } -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/cloudFormationCustomResourceUpdateEvent.json b/packages/parser/tests/events/cloudFormationCustomResourceUpdateEvent.json index 5225746345..d8b2eb2e0a 100644 --- a/packages/parser/tests/events/cloudFormationCustomResourceUpdateEvent.json +++ b/packages/parser/tests/events/cloudFormationCustomResourceUpdateEvent.json @@ -14,4 +14,4 @@ "ServiceToken": "arn:aws:lambda:us-east-1:xxxxx:function:xxxxx-xxxx-xxx", "MyProps": "old" } -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/codePipelineEvent.json b/packages/parser/tests/events/codePipelineEvent.json index d7abe51346..4c46b0172b 100644 --- a/packages/parser/tests/events/codePipelineEvent.json +++ b/packages/parser/tests/events/codePipelineEvent.json @@ -1,34 +1,34 @@ { - "CodePipeline.job": { - "id": "11111111-abcd-1111-abcd-111111abcdef", - "accountId": "111111111111", - "data": { - "actionConfiguration": { - "configuration": { - "FunctionName": "MyLambdaFunctionForAWSCodePipeline", - "UserParameters": "some-input-such-as-a-URL" - } - }, - "inputArtifacts": [ - { - "name": "ArtifactName", - "revision": null, - "location": { - "type": "S3", - "s3Location": { - "bucketName": "the name of the bucket configured as the pipeline artifact store in Amazon S3, for example codepipeline-us-east-2-1234567890", - "objectKey": "the name of the application, for example CodePipelineDemoApplication.zip" - } - } - } - ], - "outputArtifacts": [], - "artifactCredentials": { - "accessKeyId": "AKIAIOSFODNN7EXAMPLE", - "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", - "sessionToken": "MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wHhcNMTEwNDI1MjA0NTIxWhcNMTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMaK0dn+a4GmWIWJ21uUSfwfEvySWtC2XADZ4nB+BLYgVIk60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9TrDHudUZg3qX4waLG5M43q7Wgc/MbQITxOUSQv7c7ugFFDzQGBzZswY6786m86gpEIbb3OhjZnzcvQAaRHhdlQWIMm2nrAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4nUhVVxYUntneD9+h8Mg9q6q+auNKyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0FkbFFBjvSfpJIlJ00zbhNYS5f6GuoEDmFJl0ZxBHjJnyp378OD8uTs7fLvjx79LjSTbNYiytVbZPQUQ5Yaxu2jXnimvw3rrszlaEXAMPLE=" - }, - "continuationToken": "A continuation token if continuing job" + "CodePipeline.job": { + "id": "11111111-abcd-1111-abcd-111111abcdef", + "accountId": "111111111111", + "data": { + "actionConfiguration": { + "configuration": { + "FunctionName": "MyLambdaFunctionForAWSCodePipeline", + "UserParameters": "some-input-such-as-a-URL" } + }, + "inputArtifacts": [ + { + "name": "ArtifactName", + "revision": null, + "location": { + "type": "S3", + "s3Location": { + "bucketName": "the name of the bucket configured as the pipeline artifact store in Amazon S3, for example codepipeline-us-east-2-1234567890", + "objectKey": "the name of the application, for example CodePipelineDemoApplication.zip" + } + } + } + ], + "outputArtifacts": [], + "artifactCredentials": { + "accessKeyId": "AKIAIOSFODNN7EXAMPLE", + "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "sessionToken": "MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wHhcNMTEwNDI1MjA0NTIxWhcNMTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMaK0dn+a4GmWIWJ21uUSfwfEvySWtC2XADZ4nB+BLYgVIk60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9TrDHudUZg3qX4waLG5M43q7Wgc/MbQITxOUSQv7c7ugFFDzQGBzZswY6786m86gpEIbb3OhjZnzcvQAaRHhdlQWIMm2nrAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4nUhVVxYUntneD9+h8Mg9q6q+auNKyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0FkbFFBjvSfpJIlJ00zbhNYS5f6GuoEDmFJl0ZxBHjJnyp378OD8uTs7fLvjx79LjSTbNYiytVbZPQUQ5Yaxu2jXnimvw3rrszlaEXAMPLE=" + }, + "continuationToken": "A continuation token if continuing job" } + } } diff --git a/packages/parser/tests/events/codePipelineEventData.json b/packages/parser/tests/events/codePipelineEventData.json index 7552f19ca9..dbbc18ea7b 100644 --- a/packages/parser/tests/events/codePipelineEventData.json +++ b/packages/parser/tests/events/codePipelineEventData.json @@ -1,46 +1,46 @@ { - "CodePipeline.job": { - "id": "c0d76431-b0e7-xmpl-97e3-e8ee786eb6f6", - "accountId": "123456789012", - "data": { - "actionConfiguration": { - "configuration": { - "FunctionName": "my-function", - "UserParameters": "{\"KEY\": \"VALUE\"}" - } - }, - "inputArtifacts": [ - { - "name": "my-pipeline-SourceArtifact", - "revision": "e0c7xmpl2308ca3071aa7bab414de234ab52eea", - "location": { - "type": "S3", - "s3Location": { - "bucketName": "us-west-2-123456789012-my-pipeline", - "objectKey": "my-pipeline/test-api-2/TdOSFRV" - } - } - } - ], - "outputArtifacts": [ - { - "name": "invokeOutput", - "revision": null, - "location": { - "type": "S3", - "s3Location": { - "bucketName": "us-west-2-123456789012-my-pipeline", - "objectKey": "my-pipeline/invokeOutp/D0YHsJn" - } - } - } - ], - "artifactCredentials": { - "accessKeyId": "AKIAIOSFODNN7EXAMPLE", - "secretAccessKey": "6CGtmAa3lzWtV7a...", - "sessionToken": "IQoJb3JpZ2luX2VjEA...", - "expirationTime": 1575493418000 + "CodePipeline.job": { + "id": "c0d76431-b0e7-xmpl-97e3-e8ee786eb6f6", + "accountId": "123456789012", + "data": { + "actionConfiguration": { + "configuration": { + "FunctionName": "my-function", + "UserParameters": "{\"KEY\": \"VALUE\"}" + } + }, + "inputArtifacts": [ + { + "name": "my-pipeline-SourceArtifact", + "revision": "e0c7xmpl2308ca3071aa7bab414de234ab52eea", + "location": { + "type": "S3", + "s3Location": { + "bucketName": "us-west-2-123456789012-my-pipeline", + "objectKey": "my-pipeline/test-api-2/TdOSFRV" + } + } + } + ], + "outputArtifacts": [ + { + "name": "invokeOutput", + "revision": null, + "location": { + "type": "S3", + "s3Location": { + "bucketName": "us-west-2-123456789012-my-pipeline", + "objectKey": "my-pipeline/invokeOutp/D0YHsJn" } + } } + ], + "artifactCredentials": { + "accessKeyId": "AKIAIOSFODNN7EXAMPLE", + "secretAccessKey": "6CGtmAa3lzWtV7a...", + "sessionToken": "IQoJb3JpZ2luX2VjEA...", + "expirationTime": 1575493418000 + } } + } } diff --git a/packages/parser/tests/events/codePipelineEventEmptyUserParameters.json b/packages/parser/tests/events/codePipelineEventEmptyUserParameters.json index 1a0dec6a15..cf395efc19 100644 --- a/packages/parser/tests/events/codePipelineEventEmptyUserParameters.json +++ b/packages/parser/tests/events/codePipelineEventEmptyUserParameters.json @@ -1,32 +1,32 @@ { - "CodePipeline.job": { - "id": "11111111-abcd-1111-abcd-111111abcdef", - "accountId": "111111111111", - "data": { - "actionConfiguration": { - "configuration": { - "FunctionName": "MyLambdaFunctionForAWSCodePipeline" - } - }, - "inputArtifacts": [ - { - "name": "ArtifactName", - "revision": null, - "location": { - "type": "S3", - "s3Location": { - "bucketName": "the name of the bucket configured as the pipeline artifact store in Amazon S3, for example codepipeline-us-east-2-1234567890", - "objectKey": "the name of the application, for example CodePipelineDemoApplication.zip" - } - } - } - ], - "outputArtifacts": [], - "artifactCredentials": { - "accessKeyId": "AKIAIOSFODNN7EXAMPLE", - "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", - "sessionToken": "MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wHhcNMTEwNDI1MjA0NTIxWhcNMTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMaK0dn+a4GmWIWJ21uUSfwfEvySWtC2XADZ4nB+BLYgVIk60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9TrDHudUZg3qX4waLG5M43q7Wgc/MbQITxOUSQv7c7ugFFDzQGBzZswY6786m86gpEIbb3OhjZnzcvQAaRHhdlQWIMm2nrAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4nUhVVxYUntneD9+h8Mg9q6q+auNKyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0FkbFFBjvSfpJIlJ00zbhNYS5f6GuoEDmFJl0ZxBHjJnyp378OD8uTs7fLvjx79LjSTbNYiytVbZPQUQ5Yaxu2jXnimvw3rrszlaEXAMPLE=" + "CodePipeline.job": { + "id": "11111111-abcd-1111-abcd-111111abcdef", + "accountId": "111111111111", + "data": { + "actionConfiguration": { + "configuration": { + "FunctionName": "MyLambdaFunctionForAWSCodePipeline" + } + }, + "inputArtifacts": [ + { + "name": "ArtifactName", + "revision": null, + "location": { + "type": "S3", + "s3Location": { + "bucketName": "the name of the bucket configured as the pipeline artifact store in Amazon S3, for example codepipeline-us-east-2-1234567890", + "objectKey": "the name of the application, for example CodePipelineDemoApplication.zip" } + } } + ], + "outputArtifacts": [], + "artifactCredentials": { + "accessKeyId": "AKIAIOSFODNN7EXAMPLE", + "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "sessionToken": "MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wHhcNMTEwNDI1MjA0NTIxWhcNMTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMaK0dn+a4GmWIWJ21uUSfwfEvySWtC2XADZ4nB+BLYgVIk60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9TrDHudUZg3qX4waLG5M43q7Wgc/MbQITxOUSQv7c7ugFFDzQGBzZswY6786m86gpEIbb3OhjZnzcvQAaRHhdlQWIMm2nrAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4nUhVVxYUntneD9+h8Mg9q6q+auNKyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0FkbFFBjvSfpJIlJ00zbhNYS5f6GuoEDmFJl0ZxBHjJnyp378OD8uTs7fLvjx79LjSTbNYiytVbZPQUQ5Yaxu2jXnimvw3rrszlaEXAMPLE=" + } } + } } diff --git a/packages/parser/tests/events/codePipelineEventWithEncryptionKey.json b/packages/parser/tests/events/codePipelineEventWithEncryptionKey.json index e4a8528e14..1e81b70b71 100644 --- a/packages/parser/tests/events/codePipelineEventWithEncryptionKey.json +++ b/packages/parser/tests/events/codePipelineEventWithEncryptionKey.json @@ -1,38 +1,38 @@ { - "CodePipeline.job": { - "id": "11111111-abcd-1111-abcd-111111abcdef", - "accountId": "111111111111", - "data": { - "actionConfiguration": { - "configuration": { - "FunctionName": "MyLambdaFunctionForAWSCodePipeline", - "UserParameters": "some-input-such-as-a-URL" - } - }, - "inputArtifacts": [ - { - "name": "ArtifactName", - "revision": null, - "location": { - "type": "S3", - "s3Location": { - "bucketName": "the name of the bucket configured as the pipeline artifact store in Amazon S3, for example codepipeline-us-east-2-1234567890", - "objectKey": "the name of the application, for example CodePipelineDemoApplication.zip" - } - } - } - ], - "outputArtifacts": [], - "artifactCredentials": { - "accessKeyId": "AKIAIOSFODNN7EXAMPLE", - "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", - "sessionToken": "MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wHhcNMTEwNDI1MjA0NTIxWhcNMTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMaK0dn+a4GmWIWJ21uUSfwfEvySWtC2XADZ4nB+BLYgVIk60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9TrDHudUZg3qX4waLG5M43q7Wgc/MbQITxOUSQv7c7ugFFDzQGBzZswY6786m86gpEIbb3OhjZnzcvQAaRHhdlQWIMm2nrAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4nUhVVxYUntneD9+h8Mg9q6q+auNKyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0FkbFFBjvSfpJIlJ00zbhNYS5f6GuoEDmFJl0ZxBHjJnyp378OD8uTs7fLvjx79LjSTbNYiytVbZPQUQ5Yaxu2jXnimvw3rrszlaEXAMPLE=" - }, - "continuationToken": "A continuation token if continuing job", - "encryptionKey": { - "id": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", - "type": "KMS" - } + "CodePipeline.job": { + "id": "11111111-abcd-1111-abcd-111111abcdef", + "accountId": "111111111111", + "data": { + "actionConfiguration": { + "configuration": { + "FunctionName": "MyLambdaFunctionForAWSCodePipeline", + "UserParameters": "some-input-such-as-a-URL" } + }, + "inputArtifacts": [ + { + "name": "ArtifactName", + "revision": null, + "location": { + "type": "S3", + "s3Location": { + "bucketName": "the name of the bucket configured as the pipeline artifact store in Amazon S3, for example codepipeline-us-east-2-1234567890", + "objectKey": "the name of the application, for example CodePipelineDemoApplication.zip" + } + } + } + ], + "outputArtifacts": [], + "artifactCredentials": { + "accessKeyId": "AKIAIOSFODNN7EXAMPLE", + "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "sessionToken": "MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wHhcNMTEwNDI1MjA0NTIxWhcNMTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMaK0dn+a4GmWIWJ21uUSfwfEvySWtC2XADZ4nB+BLYgVIk60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9TrDHudUZg3qX4waLG5M43q7Wgc/MbQITxOUSQv7c7ugFFDzQGBzZswY6786m86gpEIbb3OhjZnzcvQAaRHhdlQWIMm2nrAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4nUhVVxYUntneD9+h8Mg9q6q+auNKyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0FkbFFBjvSfpJIlJ00zbhNYS5f6GuoEDmFJl0ZxBHjJnyp378OD8uTs7fLvjx79LjSTbNYiytVbZPQUQ5Yaxu2jXnimvw3rrszlaEXAMPLE=" + }, + "continuationToken": "A continuation token if continuing job", + "encryptionKey": { + "id": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab", + "type": "KMS" + } } + } } diff --git a/packages/parser/tests/events/cognitoCreateAuthChallengeEvent.json b/packages/parser/tests/events/cognitoCreateAuthChallengeEvent.json index ad018ae082..ac2e593684 100644 --- a/packages/parser/tests/events/cognitoCreateAuthChallengeEvent.json +++ b/packages/parser/tests/events/cognitoCreateAuthChallengeEvent.json @@ -16,7 +16,7 @@ "email": "create-auth@mail.com" }, "challengeName": "PASSWORD_VERIFIER", - "session" : [ + "session": [ { "challengeName": "CUSTOM_CHALLENGE", "challengeResult": true, diff --git a/packages/parser/tests/events/cognitoDefineAuthChallengeEvent.json b/packages/parser/tests/events/cognitoDefineAuthChallengeEvent.json index 80ea5ac2d9..5ab2b02038 100644 --- a/packages/parser/tests/events/cognitoDefineAuthChallengeEvent.json +++ b/packages/parser/tests/events/cognitoDefineAuthChallengeEvent.json @@ -15,7 +15,7 @@ "name": "First Last", "email": "define-auth@mail.com" }, - "session" : [ + "session": [ { "challengeName": "PASSWORD_VERIFIER", "challengeResult": true diff --git a/packages/parser/tests/events/cognitoVerifyAuthChallengeResponseEvent.json b/packages/parser/tests/events/cognitoVerifyAuthChallengeResponseEvent.json index 2ebcdb5c27..286da2c1d7 100644 --- a/packages/parser/tests/events/cognitoVerifyAuthChallengeResponseEvent.json +++ b/packages/parser/tests/events/cognitoVerifyAuthChallengeResponseEvent.json @@ -18,7 +18,7 @@ "privateChallengeParameters": { "answer": "challengeAnswer" }, - "clientMetadata" : { + "clientMetadata": { "foo": "value" }, "challengeAnswer": "challengeAnswer", diff --git a/packages/parser/tests/events/connectContactFlowEventAll.json b/packages/parser/tests/events/connectContactFlowEventAll.json index 5850649b6e..0685b85b8b 100644 --- a/packages/parser/tests/events/connectContactFlowEventAll.json +++ b/packages/parser/tests/events/connectContactFlowEventAll.json @@ -1,41 +1,41 @@ { - "Name": "ContactFlowEvent", - "Details": { - "ContactData": { - "Attributes": { - "Language": "en-US" - }, - "Channel": "VOICE", - "ContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", - "CustomerEndpoint": { - "Address": "+11234567890", - "Type": "TELEPHONE_NUMBER" - }, - "InitialContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", - "InitiationMethod": "API", - "InstanceARN": "arn:aws:connect:eu-central-1:123456789012:instance/9308c2a1-9bc6-4cea-8290-6c0b4a6d38fa", - "MediaStreams": { - "Customer": { - "Audio": { - "StartFragmentNumber": "91343852333181432392682062622220590765191907586", - "StartTimestamp": "1565781909613", - "StreamARN": "arn:aws:kinesisvideo:eu-central-1:123456789012:stream/connect-contact-a3d73b84-ce0e-479a-a9dc-5637c9d30ac9/1565272947806" - } - } - }, - "PreviousContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", - "Queue": { - "ARN": "arn:aws:connect:eu-central-1:123456789012:instance/9308c2a1-9bc6-4cea-8290-6c0b4a6d38fa/queue/5cba7cbf-1ecb-4b6d-b8bd-fe91079b3fc8", - "Name": "QueueOne" - }, - "SystemEndpoint": { - "Address": "+11234567890", - "Type": "TELEPHONE_NUMBER" - } - }, - "Parameters": { - "ParameterOne": "One", - "ParameterTwo": "Two" + "Name": "ContactFlowEvent", + "Details": { + "ContactData": { + "Attributes": { + "Language": "en-US" + }, + "Channel": "VOICE", + "ContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", + "CustomerEndpoint": { + "Address": "+11234567890", + "Type": "TELEPHONE_NUMBER" + }, + "InitialContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", + "InitiationMethod": "API", + "InstanceARN": "arn:aws:connect:eu-central-1:123456789012:instance/9308c2a1-9bc6-4cea-8290-6c0b4a6d38fa", + "MediaStreams": { + "Customer": { + "Audio": { + "StartFragmentNumber": "91343852333181432392682062622220590765191907586", + "StartTimestamp": "1565781909613", + "StreamARN": "arn:aws:kinesisvideo:eu-central-1:123456789012:stream/connect-contact-a3d73b84-ce0e-479a-a9dc-5637c9d30ac9/1565272947806" + } } + }, + "PreviousContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", + "Queue": { + "ARN": "arn:aws:connect:eu-central-1:123456789012:instance/9308c2a1-9bc6-4cea-8290-6c0b4a6d38fa/queue/5cba7cbf-1ecb-4b6d-b8bd-fe91079b3fc8", + "Name": "QueueOne" + }, + "SystemEndpoint": { + "Address": "+11234567890", + "Type": "TELEPHONE_NUMBER" + } + }, + "Parameters": { + "ParameterOne": "One", + "ParameterTwo": "Two" } -} \ No newline at end of file + } +} diff --git a/packages/parser/tests/events/connectContactFlowEventMin.json b/packages/parser/tests/events/connectContactFlowEventMin.json index 9cc22d59c3..5c69558ae8 100644 --- a/packages/parser/tests/events/connectContactFlowEventMin.json +++ b/packages/parser/tests/events/connectContactFlowEventMin.json @@ -1,27 +1,27 @@ { - "Name": "ContactFlowEvent", - "Details": { - "ContactData": { - "Attributes": {}, - "Channel": "VOICE", - "ContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", - "CustomerEndpoint": null, - "InitialContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", - "InitiationMethod": "API", - "InstanceARN": "arn:aws:connect:eu-central-1:123456789012:instance/9308c2a1-9bc6-4cea-8290-6c0b4a6d38fa", - "MediaStreams": { - "Customer": { - "Audio": { - "StartFragmentNumber": null, - "StartTimestamp": null, - "StreamARN": null - } - } - }, - "PreviousContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", - "Queue": null, - "SystemEndpoint": null - }, - "Parameters": {} - } -} \ No newline at end of file + "Name": "ContactFlowEvent", + "Details": { + "ContactData": { + "Attributes": {}, + "Channel": "VOICE", + "ContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", + "CustomerEndpoint": null, + "InitialContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", + "InitiationMethod": "API", + "InstanceARN": "arn:aws:connect:eu-central-1:123456789012:instance/9308c2a1-9bc6-4cea-8290-6c0b4a6d38fa", + "MediaStreams": { + "Customer": { + "Audio": { + "StartFragmentNumber": null, + "StartTimestamp": null, + "StreamARN": null + } + } + }, + "PreviousContactId": "5ca32fbd-8f92-46af-92a5-6b0f970f0efe", + "Queue": null, + "SystemEndpoint": null + }, + "Parameters": {} + } +} diff --git a/packages/parser/tests/events/kafkaEventMsk.json b/packages/parser/tests/events/kafkaEventMsk.json index 5a35b89680..4c17ea2490 100644 --- a/packages/parser/tests/events/kafkaEventMsk.json +++ b/packages/parser/tests/events/kafkaEventMsk.json @@ -1,35 +1,23 @@ { - "eventSource":"aws:kafka", - "eventSourceArn":"arn:aws:kafka:us-east-1:0123456789019:cluster/SalesCluster/abcd1234-abcd-cafe-abab-9876543210ab-4", - "bootstrapServers":"b-2.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092,b-1.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092", - "records":{ - "mytopic-0":[ - { - "topic":"mytopic", - "partition":0, - "offset":15, - "timestamp":1545084650987, - "timestampType":"CREATE_TIME", - "key":"cmVjb3JkS2V5", - "value":"eyJrZXkiOiJ2YWx1ZSJ9", - "headers":[ - { - "headerKey":[ - 104, - 101, - 97, - 100, - 101, - 114, - 86, - 97, - 108, - 117, - 101 - ] - } - ] - } - ] + "eventSource": "aws:kafka", + "eventSourceArn": "arn:aws:kafka:us-east-1:0123456789019:cluster/SalesCluster/abcd1234-abcd-cafe-abab-9876543210ab-4", + "bootstrapServers": "b-2.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092,b-1.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092", + "records": { + "mytopic-0": [ + { + "topic": "mytopic", + "partition": 0, + "offset": 15, + "timestamp": 1545084650987, + "timestampType": "CREATE_TIME", + "key": "cmVjb3JkS2V5", + "value": "eyJrZXkiOiJ2YWx1ZSJ9", + "headers": [ + { + "headerKey": [104, 101, 97, 100, 101, 114, 86, 97, 108, 117, 101] + } + ] + } + ] } } diff --git a/packages/parser/tests/events/kafkaEventSelfManaged.json b/packages/parser/tests/events/kafkaEventSelfManaged.json index 22985dd11d..4dcd8c73c5 100644 --- a/packages/parser/tests/events/kafkaEventSelfManaged.json +++ b/packages/parser/tests/events/kafkaEventSelfManaged.json @@ -1,34 +1,22 @@ { - "eventSource":"aws:SelfManagedKafka", - "bootstrapServers":"b-2.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092,b-1.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092", - "records":{ - "mytopic-0":[ - { - "topic":"mytopic", - "partition":0, - "offset":15, - "timestamp":1545084650987, - "timestampType":"CREATE_TIME", - "key":"cmVjb3JkS2V5", - "value":"eyJrZXkiOiJ2YWx1ZSJ9", - "headers":[ - { - "headerKey":[ - 104, - 101, - 97, - 100, - 101, - 114, - 86, - 97, - 108, - 117, - 101 - ] - } - ] - } - ] + "eventSource": "aws:SelfManagedKafka", + "bootstrapServers": "b-2.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092,b-1.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092", + "records": { + "mytopic-0": [ + { + "topic": "mytopic", + "partition": 0, + "offset": 15, + "timestamp": 1545084650987, + "timestampType": "CREATE_TIME", + "key": "cmVjb3JkS2V5", + "value": "eyJrZXkiOiJ2YWx1ZSJ9", + "headers": [ + { + "headerKey": [104, 101, 97, 100, 101, 114, 86, 97, 108, 117, 101] + } + ] + } + ] } } diff --git a/packages/parser/tests/events/kinesisFirehosePutEvent.json b/packages/parser/tests/events/kinesisFirehosePutEvent.json index f3e0719071..9b91f163ab 100644 --- a/packages/parser/tests/events/kinesisFirehosePutEvent.json +++ b/packages/parser/tests/events/kinesisFirehosePutEvent.json @@ -1,17 +1,17 @@ { - "invocationId": "2b4d1ad9-2f48-94bd-a088-767c317e994a", - "deliveryStreamArn": "arn:aws:firehose:us-east-2:123456789012:deliverystream/delivery-stream-name", - "region": "us-east-2", - "records": [ - { - "recordId": "record1", - "approximateArrivalTimestamp": 1664029185290, - "data": "SGVsbG8gV29ybGQ=" - }, - { - "recordId": "record2", - "approximateArrivalTimestamp": 1664029186945, - "data": "eyJIZWxsbyI6ICJXb3JsZCJ9" - } - ] - } + "invocationId": "2b4d1ad9-2f48-94bd-a088-767c317e994a", + "deliveryStreamArn": "arn:aws:firehose:us-east-2:123456789012:deliverystream/delivery-stream-name", + "region": "us-east-2", + "records": [ + { + "recordId": "record1", + "approximateArrivalTimestamp": 1664029185290, + "data": "SGVsbG8gV29ybGQ=" + }, + { + "recordId": "record2", + "approximateArrivalTimestamp": 1664029186945, + "data": "eyJIZWxsbyI6ICJXb3JsZCJ9" + } + ] +} diff --git a/packages/parser/tests/events/kinesisStreamCloudWatchLogsEvent.json b/packages/parser/tests/events/kinesisStreamCloudWatchLogsEvent.json index a9a6959f90..6879763215 100644 --- a/packages/parser/tests/events/kinesisStreamCloudWatchLogsEvent.json +++ b/packages/parser/tests/events/kinesisStreamCloudWatchLogsEvent.json @@ -1,36 +1,36 @@ { - "Records": [ - { - "kinesis": { - "kinesisSchemaVersion": "1.0", - "partitionKey": "da10bf66b1f54bff5d96eae99149ad1f", - "sequenceNumber": "49635052289529725553291405521504870233219489715332317186", - "data": "H4sIAAAAAAAAAK2Sa2vbMBSG/4ox+xg3Oror39IlvaztVmJv7WjCUGwl8+ZLZstts5L/vuOsZYUyWGEgJHiP9J7nvOghLF3b2rVLthsXjsLJOBl/uZjG8fh4Gg7C+q5yDcqUAWcSONHEoFzU6+Om7jZYGdq7dljYcpnZ4cZHwLWOJl1Zbs/r9cR6e9RVqc/rKlpXV9eXt+fy27vt8W+L2DfOlr07oXQIMAQyvHlzPk6mcbKgciktF5lQfMU5dZZqzrShLF2uFC60aLtlmzb5prc/ygvvmjYc3YRPFG+LusuurE+/Ikqb1Gd55dq8jV+8isT6+317Rk42J5PTcLFnm966yvd2D2GeISJTYIwCJSQ1BE9OtWZCABWaKMIJAMdDMyU5MYZLhmkxBhQxfY4Re1tiWiAlBsgIVQTE4Cl6tI+T8SwJZu5Hh1dPs1FApOMSDI9WVKmIC+4irTMWQZYpx7QkztrgE06MU4yCx9DmVbgbvABmQJTGtkYAB0NwEwyYQUBpqEFuSbkGrThTRKi/AlP+HHj6fvJa3P9Ap/+Rbja9/PD6POd+0jXW7xM1B8CDsp37w7woXBb8qQDZ6xeurJttEOc/HWpUBxeHKNr74LHwsXXYlsm9flrl/rmFIQeS7m3m1fVs/DlIGpu6nhMiyWQGXNKIMbcCIgkhElKbaZnZpYJUz33s1iV+z/6+StMlR3yphHNcCyxiNEXf2zed6xuEu8XuF2wb6krnAwAA", - "approximateArrivalTimestamp": 1668093033.744 - }, - "eventSource": "aws:kinesis", - "eventVersion": "1.0", - "eventID": "shardId-000000000000:49635052289529725553291405521504870233219489715332317186", - "eventName": "aws:kinesis:record", - "invokeIdentityArn": "arn:aws:iam::231436140809:role/pt-1488-CloudWatchKinesisLogsFunctionRole-1M4G2TIWIE49", - "awsRegion": "eu-west-1", - "eventSourceARN": "arn:aws:kinesis:eu-west-1:231436140809:stream/pt-1488-KinesisStreamCloudWatchLogs-D8tHs0im0aJG" - }, - { - "kinesis": { - "kinesisSchemaVersion": "1.0", - "partitionKey": "cf4c4c2c9a49bdfaf58d7dbbc2b06081", - "sequenceNumber": "49635052289529725553291405520881064510298312199003701250", - "data": "H4sIAAAAAAAAAK2SW2/TQBCF/4pl8ViTvc7u5i0laVraQhUbWtREaG1PgsGXYK/bhqr/nXVoBRIgUYnXc2bPfHO092GFXWc3mOy2GI7D6SSZfDyfxfFkPgsPwua2xtbLjFPBgQqiifFy2WzmbdNvvTOyt92otFWa29HWRVRoHU37qtqdNZupdfaorzNXNHW0qS+vLm7O4PPr3fxHROxatNWQThgbUTqiZHT94mySzOJkBUqYLOWY8ZQLbaTRkEvDciUYzWzKfETXp13WFtsh/qgoHbZdOL4OnyhelU2fX1qXffIoXdKcFjV2RRf/9iqSmy933Sk53h5PT8LVnm12g7Ub4u7DIveIXFFjFNGUKUlAaMY0EUJKLjkQbxhKGCWeknMKoAGUkYoJ7TFd4St2tvJtDRYxDAg3VB08Ve/j42SySIIFfu396Ek+DkS+xkwAiYhM00isgUV6jXmEMrM5EmMsh+C9v9hfMQ4eS1vW4cPBH4CZVpoTJkEIAp5RUMo8vGFae3JNCCdUccMVgPw7sP4VePZm+lzc/0AH/0i3mF28fX6fSzftW+v2jZKXRgVVt3SHRVliHvx06F4+x6ppd0FcfEMvMR2cH3rR3gWPxrsO/Vau9vqyvlpMPgRJazMcYGgEHHLKBhLGJaBA0JLxNc0JppoS9Cwxbir/B4d5QDBAQSnfFFGp8aa/vxw2uLbHYUH4sHr4Dj5RJxfMAwAA", - "approximateArrivalTimestamp": 1668092612.992 - }, - "eventSource": "aws:kinesis", - "eventVersion": "1.0", - "eventID": "shardId-000000000000:49635052289529725553291405520881064510298312199003701250", - "eventName": "aws:kinesis:record", - "invokeIdentityArn": "arn:aws:iam::231436140809:role/pt-1488-CloudWatchKinesisLogsFunctionRole-1M4G2TIWIE49", - "awsRegion": "eu-west-1", - "eventSourceARN": "arn:aws:kinesis:eu-west-1:231436140809:stream/pt-1488-KinesisStreamCloudWatchLogs-D8tHs0im0aJG" - } - ] -} \ No newline at end of file + "Records": [ + { + "kinesis": { + "kinesisSchemaVersion": "1.0", + "partitionKey": "da10bf66b1f54bff5d96eae99149ad1f", + "sequenceNumber": "49635052289529725553291405521504870233219489715332317186", + "data": "H4sIAAAAAAAAAK2Sa2vbMBSG/4ox+xg3Oror39IlvaztVmJv7WjCUGwl8+ZLZstts5L/vuOsZYUyWGEgJHiP9J7nvOghLF3b2rVLthsXjsLJOBl/uZjG8fh4Gg7C+q5yDcqUAWcSONHEoFzU6+Om7jZYGdq7dljYcpnZ4cZHwLWOJl1Zbs/r9cR6e9RVqc/rKlpXV9eXt+fy27vt8W+L2DfOlr07oXQIMAQyvHlzPk6mcbKgciktF5lQfMU5dZZqzrShLF2uFC60aLtlmzb5prc/ygvvmjYc3YRPFG+LusuurE+/Ikqb1Gd55dq8jV+8isT6+317Rk42J5PTcLFnm966yvd2D2GeISJTYIwCJSQ1BE9OtWZCABWaKMIJAMdDMyU5MYZLhmkxBhQxfY4Re1tiWiAlBsgIVQTE4Cl6tI+T8SwJZu5Hh1dPs1FApOMSDI9WVKmIC+4irTMWQZYpx7QkztrgE06MU4yCx9DmVbgbvABmQJTGtkYAB0NwEwyYQUBpqEFuSbkGrThTRKi/AlP+HHj6fvJa3P9Ap/+Rbja9/PD6POd+0jXW7xM1B8CDsp37w7woXBb8qQDZ6xeurJttEOc/HWpUBxeHKNr74LHwsXXYlsm9flrl/rmFIQeS7m3m1fVs/DlIGpu6nhMiyWQGXNKIMbcCIgkhElKbaZnZpYJUz33s1iV+z/6+StMlR3yphHNcCyxiNEXf2zed6xuEu8XuF2wb6krnAwAA", + "approximateArrivalTimestamp": 1668093033.744 + }, + "eventSource": "aws:kinesis", + "eventVersion": "1.0", + "eventID": "shardId-000000000000:49635052289529725553291405521504870233219489715332317186", + "eventName": "aws:kinesis:record", + "invokeIdentityArn": "arn:aws:iam::231436140809:role/pt-1488-CloudWatchKinesisLogsFunctionRole-1M4G2TIWIE49", + "awsRegion": "eu-west-1", + "eventSourceARN": "arn:aws:kinesis:eu-west-1:231436140809:stream/pt-1488-KinesisStreamCloudWatchLogs-D8tHs0im0aJG" + }, + { + "kinesis": { + "kinesisSchemaVersion": "1.0", + "partitionKey": "cf4c4c2c9a49bdfaf58d7dbbc2b06081", + "sequenceNumber": "49635052289529725553291405520881064510298312199003701250", + "data": "H4sIAAAAAAAAAK2SW2/TQBCF/4pl8ViTvc7u5i0laVraQhUbWtREaG1PgsGXYK/bhqr/nXVoBRIgUYnXc2bPfHO092GFXWc3mOy2GI7D6SSZfDyfxfFkPgsPwua2xtbLjFPBgQqiifFy2WzmbdNvvTOyt92otFWa29HWRVRoHU37qtqdNZupdfaorzNXNHW0qS+vLm7O4PPr3fxHROxatNWQThgbUTqiZHT94mySzOJkBUqYLOWY8ZQLbaTRkEvDciUYzWzKfETXp13WFtsh/qgoHbZdOL4OnyhelU2fX1qXffIoXdKcFjV2RRf/9iqSmy933Sk53h5PT8LVnm12g7Ub4u7DIveIXFFjFNGUKUlAaMY0EUJKLjkQbxhKGCWeknMKoAGUkYoJ7TFd4St2tvJtDRYxDAg3VB08Ve/j42SySIIFfu396Ek+DkS+xkwAiYhM00isgUV6jXmEMrM5EmMsh+C9v9hfMQ4eS1vW4cPBH4CZVpoTJkEIAp5RUMo8vGFae3JNCCdUccMVgPw7sP4VePZm+lzc/0AH/0i3mF28fX6fSzftW+v2jZKXRgVVt3SHRVliHvx06F4+x6ppd0FcfEMvMR2cH3rR3gWPxrsO/Vau9vqyvlpMPgRJazMcYGgEHHLKBhLGJaBA0JLxNc0JppoS9Cwxbir/B4d5QDBAQSnfFFGp8aa/vxw2uLbHYUH4sHr4Dj5RJxfMAwAA", + "approximateArrivalTimestamp": 1668092612.992 + }, + "eventSource": "aws:kinesis", + "eventVersion": "1.0", + "eventID": "shardId-000000000000:49635052289529725553291405520881064510298312199003701250", + "eventName": "aws:kinesis:record", + "invokeIdentityArn": "arn:aws:iam::231436140809:role/pt-1488-CloudWatchKinesisLogsFunctionRole-1M4G2TIWIE49", + "awsRegion": "eu-west-1", + "eventSourceARN": "arn:aws:kinesis:eu-west-1:231436140809:stream/pt-1488-KinesisStreamCloudWatchLogs-D8tHs0im0aJG" + } + ] +} diff --git a/packages/parser/tests/events/kinesisStreamEventOneRecord.json b/packages/parser/tests/events/kinesisStreamEventOneRecord.json index 05fe2d297a..1c65b949dd 100644 --- a/packages/parser/tests/events/kinesisStreamEventOneRecord.json +++ b/packages/parser/tests/events/kinesisStreamEventOneRecord.json @@ -1,20 +1,20 @@ { - "Records": [ - { - "kinesis": { - "kinesisSchemaVersion": "1.0", - "partitionKey": "1", - "sequenceNumber": "49590338271490256608559692538361571095921575989136588898", - "data": "eyJtZXNzYWdlIjogInRlc3QgbWVzc2FnZSIsICJ1c2VybmFtZSI6ICJ0ZXN0In0=", - "approximateArrivalTimestamp": 1545084650.987 - }, - "eventSource": "aws:kinesis", - "eventVersion": "1.0", - "eventID": "shardId-000000000006:49590338271490256608559692538361571095921575989136588898", - "eventName": "aws:kinesis:record", - "invokeIdentityArn": "arn:aws:iam::123456789012:role/lambda-role", - "awsRegion": "us-east-2", - "eventSourceARN": "arn:aws:kinesis:us-east-2:123456789012:stream/lambda-stream" - } - ] + "Records": [ + { + "kinesis": { + "kinesisSchemaVersion": "1.0", + "partitionKey": "1", + "sequenceNumber": "49590338271490256608559692538361571095921575989136588898", + "data": "eyJtZXNzYWdlIjogInRlc3QgbWVzc2FnZSIsICJ1c2VybmFtZSI6ICJ0ZXN0In0=", + "approximateArrivalTimestamp": 1545084650.987 + }, + "eventSource": "aws:kinesis", + "eventVersion": "1.0", + "eventID": "shardId-000000000006:49590338271490256608559692538361571095921575989136588898", + "eventName": "aws:kinesis:record", + "invokeIdentityArn": "arn:aws:iam::123456789012:role/lambda-role", + "awsRegion": "us-east-2", + "eventSourceARN": "arn:aws:kinesis:us-east-2:123456789012:stream/lambda-stream" + } + ] } diff --git a/packages/parser/tests/events/lambdaFunctionUrlEventPathTrailingSlash.json b/packages/parser/tests/events/lambdaFunctionUrlEventPathTrailingSlash.json index b1f8226518..54f6560655 100644 --- a/packages/parser/tests/events/lambdaFunctionUrlEventPathTrailingSlash.json +++ b/packages/parser/tests/events/lambdaFunctionUrlEventPathTrailingSlash.json @@ -1,52 +1,49 @@ { - "version": "2.0", - "routeKey": "$default", - "rawPath": "/my/path/", - "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", - "cookies": [ - "cookie1", - "cookie2" - ], - "headers": { - "header1": "value1", - "header2": "value1,value2" - }, - "queryStringParameters": { - "parameter1": "value1,value2", - "parameter2": "value" + "version": "2.0", + "routeKey": "$default", + "rawPath": "/my/path/", + "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", + "cookies": ["cookie1", "cookie2"], + "headers": { + "header1": "value1", + "header2": "value1,value2" + }, + "queryStringParameters": { + "parameter1": "value1,value2", + "parameter2": "value" + }, + "requestContext": { + "accountId": "123456789012", + "apiId": "", + "authentication": null, + "authorizer": { + "iam": { + "accessKey": "AKIA...", + "accountId": "111122223333", + "callerId": "AIDA...", + "cognitoIdentity": null, + "principalOrgId": null, + "userArn": "arn:aws:iam::111122223333:user/example-user", + "userId": "AIDA..." + } }, - "requestContext": { - "accountId": "123456789012", - "apiId": "", - "authentication": null, - "authorizer": { - "iam": { - "accessKey": "AKIA...", - "accountId": "111122223333", - "callerId": "AIDA...", - "cognitoIdentity": null, - "principalOrgId": null, - "userArn": "arn:aws:iam::111122223333:user/example-user", - "userId": "AIDA..." - } - }, - "domainName": ".lambda-url.us-west-2.on.aws", - "domainPrefix": "", - "http": { - "method": "POST", - "path": "/my/path", - "protocol": "HTTP/1.1", - "sourceIp": "123.123.123.123", - "userAgent": "agent" - }, - "requestId": "id", - "routeKey": "$default", - "stage": "$default", - "time": "12/Mar/2020:19:03:58 +0000", - "timeEpoch": 1583348638390 + "domainName": ".lambda-url.us-west-2.on.aws", + "domainPrefix": "", + "http": { + "method": "POST", + "path": "/my/path", + "protocol": "HTTP/1.1", + "sourceIp": "123.123.123.123", + "userAgent": "agent" }, - "body": "Hello from client!", - "pathParameters": null, - "isBase64Encoded": false, - "stageVariables": null - } \ No newline at end of file + "requestId": "id", + "routeKey": "$default", + "stage": "$default", + "time": "12/Mar/2020:19:03:58 +0000", + "timeEpoch": 1583348638390 + }, + "body": "Hello from client!", + "pathParameters": null, + "isBase64Encoded": false, + "stageVariables": null +} diff --git a/packages/parser/tests/events/lambdaFunctionUrlIAMEvent.json b/packages/parser/tests/events/lambdaFunctionUrlIAMEvent.json index bf52342b66..5af79f2492 100644 --- a/packages/parser/tests/events/lambdaFunctionUrlIAMEvent.json +++ b/packages/parser/tests/events/lambdaFunctionUrlIAMEvent.json @@ -3,10 +3,7 @@ "routeKey": "$default", "rawPath": "/my/path", "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", - "cookies": [ - "cookie1", - "cookie2" - ], + "cookies": ["cookie1", "cookie2"], "headers": { "header1": "value1", "header2": "value1,value2" @@ -20,15 +17,15 @@ "apiId": "", "authentication": null, "authorizer": { - "iam": { - "accessKey": "AKIA...", - "accountId": "111122223333", - "callerId": "AIDA...", - "cognitoIdentity": null, - "principalOrgId": null, - "userArn": "arn:aws:iam::111122223333:user/example-user", - "userId": "AIDA..." - } + "iam": { + "accessKey": "AKIA...", + "accountId": "111122223333", + "callerId": "AIDA...", + "cognitoIdentity": null, + "principalOrgId": null, + "userArn": "arn:aws:iam::111122223333:user/example-user", + "userId": "AIDA..." + } }, "domainName": ".lambda-url.us-west-2.on.aws", "domainPrefix": "", diff --git a/packages/parser/tests/events/rabbitMQEvent.json b/packages/parser/tests/events/rabbitMQEvent.json index e4259555a8..5196b45327 100644 --- a/packages/parser/tests/events/rabbitMQEvent.json +++ b/packages/parser/tests/events/rabbitMQEvent.json @@ -9,24 +9,10 @@ "contentEncoding": null, "headers": { "header1": { - "bytes": [ - 118, - 97, - 108, - 117, - 101, - 49 - ] + "bytes": [118, 97, 108, 117, 101, 49] }, "header2": { - "bytes": [ - 118, - 97, - 108, - 117, - 101, - 50 - ] + "bytes": [118, 97, 108, 117, 101, 50] }, "numberInHeader": 10 }, diff --git a/packages/parser/tests/events/s3EventBridgeNotificationObjectCreatedEvent.json b/packages/parser/tests/events/s3EventBridgeNotificationObjectCreatedEvent.json index 6096ea8d77..75c50c12c7 100644 --- a/packages/parser/tests/events/s3EventBridgeNotificationObjectCreatedEvent.json +++ b/packages/parser/tests/events/s3EventBridgeNotificationObjectCreatedEvent.json @@ -6,9 +6,7 @@ "account": "123456789012", "time": "2023-03-08T17:50:14Z", "region": "eu-west-1", - "resources": [ - "arn:aws:s3:::example-bucket" - ], + "resources": ["arn:aws:s3:::example-bucket"], "detail": { "version": "0", "bucket": { @@ -25,4 +23,4 @@ "source-ip-address": "34.252.34.74", "reason": "PutObject" } -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/s3EventBridgeNotificationObjectDeletedEvent.json b/packages/parser/tests/events/s3EventBridgeNotificationObjectDeletedEvent.json index 8006b93e40..e58ff3da0c 100644 --- a/packages/parser/tests/events/s3EventBridgeNotificationObjectDeletedEvent.json +++ b/packages/parser/tests/events/s3EventBridgeNotificationObjectDeletedEvent.json @@ -6,17 +6,15 @@ "account": "111122223333", "time": "2021-11-12T00:00:00Z", "region": "ca-central-1", - "resources": [ - "arn:aws:s3:::example-bucket" - ], + "resources": ["arn:aws:s3:::example-bucket"], "detail": { "version": "0", "bucket": { "name": "example-bucket" }, "object": { - "key": "IMG_m7fzo3.jpg", - "sequencer": "006408CAD69598B05E" + "key": "IMG_m7fzo3.jpg", + "sequencer": "006408CAD69598B05E" }, "request-id": "0BH729840619AG5K", "requester": "123456789012", @@ -24,4 +22,4 @@ "reason": "DeleteObject", "deletion-type": "Delete Marker Created" } -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/s3EventBridgeNotificationObjectExpiredEvent.json b/packages/parser/tests/events/s3EventBridgeNotificationObjectExpiredEvent.json index ef506cc355..c147fe7389 100644 --- a/packages/parser/tests/events/s3EventBridgeNotificationObjectExpiredEvent.json +++ b/packages/parser/tests/events/s3EventBridgeNotificationObjectExpiredEvent.json @@ -6,23 +6,21 @@ "account": "111122223333", "time": "2021-11-12T00:00:00Z", "region": "ca-central-1", - "resources": [ - "arn:aws:s3:::example-bucket" - ], + "resources": ["arn:aws:s3:::example-bucket"], "detail": { "version": "0", "bucket": { "name": "example-bucket" }, "object": { - "key": "IMG_m7fzo3.jpg", - "size": 184662, - "etag": "4e68adba0abe2dc8653dc3354e14c01d", - "sequencer": "006408CAD69598B05E" + "key": "IMG_m7fzo3.jpg", + "size": 184662, + "etag": "4e68adba0abe2dc8653dc3354e14c01d", + "sequencer": "006408CAD69598B05E" }, "request-id": "20EB74C14654DC47", "requester": "s3.amazonaws.com", "reason": "Lifecycle Expiration", "deletion-type": "Delete Marker Created" } -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/s3EventBridgeNotificationObjectRestoreCompletedEvent.json b/packages/parser/tests/events/s3EventBridgeNotificationObjectRestoreCompletedEvent.json index 5a2e6a4f9e..1f24338283 100644 --- a/packages/parser/tests/events/s3EventBridgeNotificationObjectRestoreCompletedEvent.json +++ b/packages/parser/tests/events/s3EventBridgeNotificationObjectRestoreCompletedEvent.json @@ -6,23 +6,21 @@ "account": "111122223333", "time": "2021-11-12T00:00:00Z", "region": "ca-central-1", - "resources": [ - "arn:aws:s3:::example-bucket" - ], + "resources": ["arn:aws:s3:::example-bucket"], "detail": { "version": "0", "bucket": { "name": "example-bucket" }, "object": { - "key": "IMG_m7fzo3.jpg", - "size": 184662, - "etag": "4e68adba0abe2dc8653dc3354e14c01d", - "sequencer": "006408CAD69598B05E" + "key": "IMG_m7fzo3.jpg", + "size": 184662, + "etag": "4e68adba0abe2dc8653dc3354e14c01d", + "sequencer": "006408CAD69598B05E" }, "request-id": "189F19CB7FB1B6A4", "requester": "s3.amazonaws.com", "restore-expiry-time": "2021-11-13T00:00:00Z", "source-storage-class": "GLACIER" } -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/s3EventDeleteObject.json b/packages/parser/tests/events/s3EventDeleteObject.json index 3a607242f0..e512c0bbf9 100644 --- a/packages/parser/tests/events/s3EventDeleteObject.json +++ b/packages/parser/tests/events/s3EventDeleteObject.json @@ -33,4 +33,4 @@ } } ] -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/s3EventGlacier.json b/packages/parser/tests/events/s3EventGlacier.json index 2fbc447b30..9dbced9637 100644 --- a/packages/parser/tests/events/s3EventGlacier.json +++ b/packages/parser/tests/events/s3EventGlacier.json @@ -1,44 +1,44 @@ { - "Records": [ - { - "eventVersion": "2.1", - "eventSource": "aws:s3", - "awsRegion": "us-east-2", - "eventTime": "2019-09-03T19:37:27.192Z", - "eventName": "ObjectCreated:Put", - "userIdentity": { - "principalId": "AWS:AIDAINPONIXQXHT3IKHL2" - }, - "requestParameters": { - "sourceIPAddress": "205.255.255.255" - }, - "responseElements": { - "x-amz-request-id": "D82B88E5F771F645", - "x-amz-id-2": "vlR7PnpV2Ce81l0PRw6jlUpck7Jo5ZsQjryTjKlc5aLWGVHPZLj5NeC6qMa0emYBDXOo6QBU0Wo=" - }, - "s3": { - "s3SchemaVersion": "1.0", - "configurationId": "828aa6fc-f7b5-4305-8584-487c791949c1", - "bucket": { - "name": "lambda-artifacts-deafc19498e3f2df", - "ownerIdentity": { - "principalId": "A3I5XTEXAMAI3E" - }, - "arn": "arn:aws:s3:::lambda-artifacts-deafc19498e3f2df" - }, - "object": { - "key": "b21b84d653bb07b05b1e6b33684dc11b", - "size": 1305107, - "eTag": "b21b84d653bb07b05b1e6b33684dc11b", - "sequencer": "0C0F6F405D6ED209E1" - } - }, - "glacierEventData": { - "restoreEventData": { - "lifecycleRestorationExpiryTime": "1970-01-01T00:01:00.000Z", - "lifecycleRestoreStorageClass": "standard" - } - } + "Records": [ + { + "eventVersion": "2.1", + "eventSource": "aws:s3", + "awsRegion": "us-east-2", + "eventTime": "2019-09-03T19:37:27.192Z", + "eventName": "ObjectCreated:Put", + "userIdentity": { + "principalId": "AWS:AIDAINPONIXQXHT3IKHL2" + }, + "requestParameters": { + "sourceIPAddress": "205.255.255.255" + }, + "responseElements": { + "x-amz-request-id": "D82B88E5F771F645", + "x-amz-id-2": "vlR7PnpV2Ce81l0PRw6jlUpck7Jo5ZsQjryTjKlc5aLWGVHPZLj5NeC6qMa0emYBDXOo6QBU0Wo=" + }, + "s3": { + "s3SchemaVersion": "1.0", + "configurationId": "828aa6fc-f7b5-4305-8584-487c791949c1", + "bucket": { + "name": "lambda-artifacts-deafc19498e3f2df", + "ownerIdentity": { + "principalId": "A3I5XTEXAMAI3E" + }, + "arn": "arn:aws:s3:::lambda-artifacts-deafc19498e3f2df" + }, + "object": { + "key": "b21b84d653bb07b05b1e6b33684dc11b", + "size": 1305107, + "eTag": "b21b84d653bb07b05b1e6b33684dc11b", + "sequencer": "0C0F6F405D6ED209E1" } - ] -} \ No newline at end of file + }, + "glacierEventData": { + "restoreEventData": { + "lifecycleRestorationExpiryTime": "1970-01-01T00:01:00.000Z", + "lifecycleRestoreStorageClass": "standard" + } + } + } + ] +} diff --git a/packages/parser/tests/events/s3ObjectEventIAMUser.json b/packages/parser/tests/events/s3ObjectEventIAMUser.json index 6be41c4352..d942dd13a8 100644 --- a/packages/parser/tests/events/s3ObjectEventIAMUser.json +++ b/packages/parser/tests/events/s3ObjectEventIAMUser.json @@ -1,30 +1,30 @@ { - "xAmzRequestId": "1a5ed718-5f53-471d-b6fe-5cf62d88d02a", - "getObjectContext": { - "inputS3Url": "https://myap-123412341234.s3-accesspoint.us-east-1.amazonaws.com/s3.txt?X-Amz-Security-Token=...", - "outputRoute": "io-iad-cell001", - "outputToken": "..." - }, - "configuration": { - "accessPointArn": "arn:aws:s3-object-lambda:us-east-1:123412341234:accesspoint/myolap", - "supportingAccessPointArn": "arn:aws:s3:us-east-1:123412341234:accesspoint/myap", - "payload": "test" - }, - "userRequest": { - "url": "/s3.txt", - "headers": { - "Host": "myolap-123412341234.s3-object-lambda.us-east-1.amazonaws.com", - "Accept-Encoding": "identity", - "X-Amz-Content-SHA256": "e3b0c44297fc1c149afbf4c8995fb92427ae41e4649b934ca495991b7852b855" - } - }, - "userIdentity": { - "type": "IAMUser", - "principalId": "...", - "arn": "arn:aws:iam::123412341234:user/myuser", - "accountId": "123412341234", - "accessKeyId": "...", - "userName": "Alice" - }, - "protocolVersion": "1.00" + "xAmzRequestId": "1a5ed718-5f53-471d-b6fe-5cf62d88d02a", + "getObjectContext": { + "inputS3Url": "https://myap-123412341234.s3-accesspoint.us-east-1.amazonaws.com/s3.txt?X-Amz-Security-Token=...", + "outputRoute": "io-iad-cell001", + "outputToken": "..." + }, + "configuration": { + "accessPointArn": "arn:aws:s3-object-lambda:us-east-1:123412341234:accesspoint/myolap", + "supportingAccessPointArn": "arn:aws:s3:us-east-1:123412341234:accesspoint/myap", + "payload": "test" + }, + "userRequest": { + "url": "/s3.txt", + "headers": { + "Host": "myolap-123412341234.s3-object-lambda.us-east-1.amazonaws.com", + "Accept-Encoding": "identity", + "X-Amz-Content-SHA256": "e3b0c44297fc1c149afbf4c8995fb92427ae41e4649b934ca495991b7852b855" + } + }, + "userIdentity": { + "type": "IAMUser", + "principalId": "...", + "arn": "arn:aws:iam::123412341234:user/myuser", + "accountId": "123412341234", + "accessKeyId": "...", + "userName": "Alice" + }, + "protocolVersion": "1.00" } diff --git a/packages/parser/tests/events/s3ObjectEventTempCredentials.json b/packages/parser/tests/events/s3ObjectEventTempCredentials.json index 30c70fe6df..35f4772ad2 100644 --- a/packages/parser/tests/events/s3ObjectEventTempCredentials.json +++ b/packages/parser/tests/events/s3ObjectEventTempCredentials.json @@ -1,42 +1,42 @@ { - "xAmzRequestId": "requestId", - "getObjectContext": { - "inputS3Url": "https://my-s3-ap-111122223333.s3-accesspoint.us-east-1.amazonaws.com/example?X-Amz-Security-Token=", - "outputRoute": "io-use1-001", - "outputToken": "OutputToken" - }, - "configuration": { - "accessPointArn": "arn:aws:s3-object-lambda:us-east-1:111122223333:accesspoint/example-object-lambda-ap", - "supportingAccessPointArn": "arn:aws:s3:us-east-1:111122223333:accesspoint/example-ap", - "payload": "{}" - }, - "userRequest": { - "url": "https://object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com/example", - "headers": { - "Host": "object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com", - "Accept-Encoding": "identity", - "X-Amz-Content-SHA256": "e3b0c44298fc1example" - } - }, - "userIdentity": { - "type": "AssumedRole", + "xAmzRequestId": "requestId", + "getObjectContext": { + "inputS3Url": "https://my-s3-ap-111122223333.s3-accesspoint.us-east-1.amazonaws.com/example?X-Amz-Security-Token=", + "outputRoute": "io-use1-001", + "outputToken": "OutputToken" + }, + "configuration": { + "accessPointArn": "arn:aws:s3-object-lambda:us-east-1:111122223333:accesspoint/example-object-lambda-ap", + "supportingAccessPointArn": "arn:aws:s3:us-east-1:111122223333:accesspoint/example-ap", + "payload": "{}" + }, + "userRequest": { + "url": "https://object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com/example", + "headers": { + "Host": "object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com", + "Accept-Encoding": "identity", + "X-Amz-Content-SHA256": "e3b0c44298fc1example" + } + }, + "userIdentity": { + "type": "AssumedRole", + "principalId": "principalId", + "arn": "arn:aws:sts::111122223333:assumed-role/Admin/example", + "accountId": "111122223333", + "accessKeyId": "accessKeyId", + "sessionContext": { + "attributes": { + "mfaAuthenticated": "false", + "creationDate": "Wed Mar 10 23:41:52 UTC 2021" + }, + "sessionIssuer": { + "type": "Role", "principalId": "principalId", - "arn": "arn:aws:sts::111122223333:assumed-role/Admin/example", + "arn": "arn:aws:iam::111122223333:role/Admin", "accountId": "111122223333", - "accessKeyId": "accessKeyId", - "sessionContext": { - "attributes": { - "mfaAuthenticated": "false", - "creationDate": "Wed Mar 10 23:41:52 UTC 2021" - }, - "sessionIssuer": { - "type": "Role", - "principalId": "principalId", - "arn": "arn:aws:iam::111122223333:role/Admin", - "accountId": "111122223333", - "userName": "Admin" - } - } - }, - "protocolVersion": "1.00" + "userName": "Admin" + } + } + }, + "protocolVersion": "1.00" } diff --git a/packages/parser/tests/events/s3SqsEvent.json b/packages/parser/tests/events/s3SqsEvent.json index 418bd050b2..9ced0dbc2f 100644 --- a/packages/parser/tests/events/s3SqsEvent.json +++ b/packages/parser/tests/events/s3SqsEvent.json @@ -10,8 +10,7 @@ "SenderId": "AIDAJHIPRHEMV73VRJEBU", "ApproximateFirstReceiveTimestamp": "1681332239270" }, - "messageAttributes": { - }, + "messageAttributes": {}, "md5OfBody": "16f4460f4477d8d693a5abe94fdbbd73", "eventSource": "aws:sqs", "eventSourceARN": "arn:aws:sqs:us-east-1:123456789012:SQS", diff --git a/packages/parser/tests/events/secretsManagerEvent.json b/packages/parser/tests/events/secretsManagerEvent.json index f07ea1e0b0..d0cd2c1291 100644 --- a/packages/parser/tests/events/secretsManagerEvent.json +++ b/packages/parser/tests/events/secretsManagerEvent.json @@ -1,5 +1,5 @@ { - "SecretId":"arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3", - "ClientRequestToken":"550e8400-e29b-41d4-a716-446655440000", - "Step":"createSecret" -} \ No newline at end of file + "SecretId": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3", + "ClientRequestToken": "550e8400-e29b-41d4-a716-446655440000", + "Step": "createSecret" +} diff --git a/packages/parser/tests/events/sesEvent.json b/packages/parser/tests/events/sesEvent.json index 636ecad687..90486666b1 100644 --- a/packages/parser/tests/events/sesEvent.json +++ b/packages/parser/tests/events/sesEvent.json @@ -5,12 +5,8 @@ "ses": { "mail": { "commonHeaders": { - "from": [ - "Jane Doe " - ], - "to": [ - "johndoe@example.com" - ], + "from": ["Jane Doe "], + "to": ["johndoe@example.com"], "returnPath": "janedoe@example.com", "messageId": "<0123456789example.com>", "date": "Wed, 7 Oct 2015 12:34:56 -0700", @@ -18,9 +14,7 @@ }, "source": "janedoe@example.com", "timestamp": "1970-01-01T00:00:00.000Z", - "destination": [ - "johndoe@example.com" - ], + "destination": ["johndoe@example.com"], "headers": [ { "name": "Return-Path", @@ -67,9 +61,7 @@ "messageId": "o3vrnil0e2ic28tr" }, "receipt": { - "recipients": [ - "johndoe@example.com" - ], + "recipients": ["johndoe@example.com"], "timestamp": "1970-01-01T00:00:00.000Z", "spamVerdict": { "status": "PASS" diff --git a/packages/parser/tests/events/snsEvent.json b/packages/parser/tests/events/snsEvent.json index 3d8a8ed443..e135d8d7c9 100644 --- a/packages/parser/tests/events/snsEvent.json +++ b/packages/parser/tests/events/snsEvent.json @@ -28,4 +28,4 @@ } } ] -} \ No newline at end of file +} diff --git a/packages/parser/tests/events/snsSqsFifoEvent.json b/packages/parser/tests/events/snsSqsFifoEvent.json index 6c23ef6294..52e45ce24e 100644 --- a/packages/parser/tests/events/snsSqsFifoEvent.json +++ b/packages/parser/tests/events/snsSqsFifoEvent.json @@ -1,23 +1,23 @@ { - "Records": [ - { - "messageId": "69bc4bbd-ed69-4325-a434-85c3b428ceab", - "receiptHandle": "AQEBbfAqjhrgIdW3HGWYPz57mdDatG/dT9LZhRPAsNQ1pJmw495w4esDc8ZSbOwMZuPBol7wtiNWug8U25GpSQDDLY1qv//8/lfmdzXOiprG6xRVeiXSHj0j731rJQ3xo+GPdGjOzjIxI09CrE3HtZ4lpXY9NjjHzP8hdxkCLlbttumc8hDBUR365/Tk+GfV2nNP9qvZtLGEbKCdTm/GYdTSoAr+ML9HnnGrS9T25Md71ASiZMI4DZqptN6g7CYYojFPs1LVM9o1258ferA72zbNoQ==", - "body": "{\n \"Type\" : \"Notification\",\n \"MessageId\" : \"a7c9d2fa-77fa-5184-9de9-89391027cc7d\",\n \"SequenceNumber\" : \"10000000000000004000\",\n \"TopicArn\" : \"arn:aws:sns:eu-west-1:231436140809:Test.fifo\",\n \"Message\" : \"{\\\"message\\\": \\\"hello world\\\", \\\"username\\\": \\\"lessa\\\"}\",\n \"Timestamp\" : \"2022-10-14T13:35:25.419Z\",\n \"UnsubscribeURL\" : \"https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-west-1:231436140809:Test.fifo:bb81d3de-a0f9-46e4-b619-d3152a4d545f\"\n}", - "attributes": { - "ApproximateReceiveCount": "1", - "SentTimestamp": "1665754525442", - "SequenceNumber": "18873177232222703872", - "MessageGroupId": "powertools-test", - "SenderId": "AIDAWYJAWPFU7SUQGUJC6", - "MessageDeduplicationId": "4e0a0f61eed277a4b9e4c01d5722b07b0725e42fe782102abee5711adfac701f", - "ApproximateFirstReceiveTimestamp": "1665754525442" - }, - "messageAttributes": {}, - "md5OfBody": "f3c788e623445e3feb263e80c1bffc0b", - "eventSource": "aws:sqs", - "eventSourceARN": "arn:aws:sqs:eu-west-1:231436140809:Test.fifo", - "awsRegion": "eu-west-1" - } - ] -} \ No newline at end of file + "Records": [ + { + "messageId": "69bc4bbd-ed69-4325-a434-85c3b428ceab", + "receiptHandle": "AQEBbfAqjhrgIdW3HGWYPz57mdDatG/dT9LZhRPAsNQ1pJmw495w4esDc8ZSbOwMZuPBol7wtiNWug8U25GpSQDDLY1qv//8/lfmdzXOiprG6xRVeiXSHj0j731rJQ3xo+GPdGjOzjIxI09CrE3HtZ4lpXY9NjjHzP8hdxkCLlbttumc8hDBUR365/Tk+GfV2nNP9qvZtLGEbKCdTm/GYdTSoAr+ML9HnnGrS9T25Md71ASiZMI4DZqptN6g7CYYojFPs1LVM9o1258ferA72zbNoQ==", + "body": "{\n \"Type\" : \"Notification\",\n \"MessageId\" : \"a7c9d2fa-77fa-5184-9de9-89391027cc7d\",\n \"SequenceNumber\" : \"10000000000000004000\",\n \"TopicArn\" : \"arn:aws:sns:eu-west-1:231436140809:Test.fifo\",\n \"Message\" : \"{\\\"message\\\": \\\"hello world\\\", \\\"username\\\": \\\"lessa\\\"}\",\n \"Timestamp\" : \"2022-10-14T13:35:25.419Z\",\n \"UnsubscribeURL\" : \"https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-west-1:231436140809:Test.fifo:bb81d3de-a0f9-46e4-b619-d3152a4d545f\"\n}", + "attributes": { + "ApproximateReceiveCount": "1", + "SentTimestamp": "1665754525442", + "SequenceNumber": "18873177232222703872", + "MessageGroupId": "powertools-test", + "SenderId": "AIDAWYJAWPFU7SUQGUJC6", + "MessageDeduplicationId": "4e0a0f61eed277a4b9e4c01d5722b07b0725e42fe782102abee5711adfac701f", + "ApproximateFirstReceiveTimestamp": "1665754525442" + }, + "messageAttributes": {}, + "md5OfBody": "f3c788e623445e3feb263e80c1bffc0b", + "eventSource": "aws:sqs", + "eventSourceARN": "arn:aws:sqs:eu-west-1:231436140809:Test.fifo", + "awsRegion": "eu-west-1" + } + ] +} diff --git a/packages/parser/tests/events/vpcLatticeEventV2PathTrailingSlash.json b/packages/parser/tests/events/vpcLatticeEventV2PathTrailingSlash.json index a9f0188852..9c0005f99b 100644 --- a/packages/parser/tests/events/vpcLatticeEventV2PathTrailingSlash.json +++ b/packages/parser/tests/events/vpcLatticeEventV2PathTrailingSlash.json @@ -1,30 +1,30 @@ { - "version": "2.0", - "path": "/newpath/", - "method": "GET", - "headers": { - "user_agent": "curl/7.64.1", - "x-forwarded-for": "10.213.229.10", - "host": "test-lambda-service-3908sdf9u3u.dkfjd93.vpc-lattice-svcs.us-east-2.on.aws", - "accept": "*/*" + "version": "2.0", + "path": "/newpath/", + "method": "GET", + "headers": { + "user_agent": "curl/7.64.1", + "x-forwarded-for": "10.213.229.10", + "host": "test-lambda-service-3908sdf9u3u.dkfjd93.vpc-lattice-svcs.us-east-2.on.aws", + "accept": "*/*" + }, + "queryStringParameters": { + "order-id": "1" + }, + "body": "{\"message\": \"Hello from Lambda!\"}", + "isBase64Encoded": false, + "requestContext": { + "serviceNetworkArn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-0bf3f2882e9cc805a", + "serviceArn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0a40eebed65f8d69c", + "targetGroupArn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-6d0ecf831eec9f09", + "identity": { + "sourceVpcArn": "arn:aws:ec2:region:123456789012:vpc/vpc-0b8276c84697e7339", + "type": "AWS_IAM", + "principal": "arn:aws:sts::123456789012:assumed-role/example-role/057d00f8b51257ba3c853a0f248943cf", + "sessionName": "057d00f8b51257ba3c853a0f248943cf", + "x509SanDns": "example.com" }, - "queryStringParameters": { - "order-id": "1" - }, - "body": "{\"message\": \"Hello from Lambda!\"}", - "isBase64Encoded": false, - "requestContext": { - "serviceNetworkArn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-0bf3f2882e9cc805a", - "serviceArn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0a40eebed65f8d69c", - "targetGroupArn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-6d0ecf831eec9f09", - "identity": { - "sourceVpcArn": "arn:aws:ec2:region:123456789012:vpc/vpc-0b8276c84697e7339", - "type" : "AWS_IAM", - "principal": "arn:aws:sts::123456789012:assumed-role/example-role/057d00f8b51257ba3c853a0f248943cf", - "sessionName": "057d00f8b51257ba3c853a0f248943cf", - "x509SanDns": "example.com" - }, - "region": "us-east-2", - "timeEpoch": "1696331543569073" - } + "region": "us-east-2", + "timeEpoch": "1696331543569073" + } } diff --git a/packages/parser/tests/tsconfig.json b/packages/parser/tests/tsconfig.json index 5654b3e15f..45ba862a85 100644 --- a/packages/parser/tests/tsconfig.json +++ b/packages/parser/tests/tsconfig.json @@ -1,11 +1,8 @@ { - "extends": "../tsconfig.json", - "compilerOptions": { - "rootDir": "../", - "noEmit": true - }, - "include": [ - "../src/**/*", - "./**/*", - ] -} \ No newline at end of file + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "../", + "noEmit": true + }, + "include": ["../src/**/*", "./**/*"] +} diff --git a/packages/parser/tests/unit/envelope.test.ts b/packages/parser/tests/unit/envelope.test.ts index 96450ddddc..3b314bb6de 100644 --- a/packages/parser/tests/unit/envelope.test.ts +++ b/packages/parser/tests/unit/envelope.test.ts @@ -4,7 +4,7 @@ * @group unit/parser */ -import { z, ZodError } from 'zod'; +import { ZodError, z } from 'zod'; import { Envelope } from '../../src/envelopes/envelope.js'; import { ParseError } from '../../src/errors.js'; diff --git a/packages/parser/tests/unit/envelopes/apigw.test.ts b/packages/parser/tests/unit/envelopes/apigw.test.ts index e4c0a6cb78..43ceda3a91 100644 --- a/packages/parser/tests/unit/envelopes/apigw.test.ts +++ b/packages/parser/tests/unit/envelopes/apigw.test.ts @@ -3,10 +3,11 @@ * * @group unit/parser/envelopes/apigw */ -import { TestSchema, getTestEvent } from '../schema/utils.js'; -import { APIGatewayProxyEvent } from '../../../src/types/schema.js'; + import { ApiGatewayEnvelope } from '../../../src/envelopes/index.js'; import { ParseError } from '../../../src/errors.js'; +import type { APIGatewayProxyEvent } from '../../../src/types/schema.js'; +import { TestSchema, getTestEvent } from '../schema/utils.js'; describe('API Gateway REST Envelope', () => { const eventsPath = 'apigw-rest'; diff --git a/packages/parser/tests/unit/envelopes/apigwv2.test.ts b/packages/parser/tests/unit/envelopes/apigwv2.test.ts index d7bdefe92a..0d4907380b 100644 --- a/packages/parser/tests/unit/envelopes/apigwv2.test.ts +++ b/packages/parser/tests/unit/envelopes/apigwv2.test.ts @@ -3,10 +3,11 @@ * * @group unit/parser/envelopes/apigwv2 */ -import { TestSchema, getTestEvent } from '../schema/utils.js'; -import { APIGatewayProxyEventV2 } from '../../../src/types/schema.js'; + import { ApiGatewayV2Envelope } from '../../../src/envelopes/index.js'; import { ParseError } from '../../../src/errors.js'; +import type { APIGatewayProxyEventV2 } from '../../../src/types/schema.js'; +import { TestSchema, getTestEvent } from '../schema/utils.js'; describe('API Gateway HTTP Envelope', () => { const eventsPath = 'apigw-http'; diff --git a/packages/parser/tests/unit/envelopes/cloudwatch.test.ts b/packages/parser/tests/unit/envelopes/cloudwatch.test.ts index 6eec52fd9a..bc562ef13f 100644 --- a/packages/parser/tests/unit/envelopes/cloudwatch.test.ts +++ b/packages/parser/tests/unit/envelopes/cloudwatch.test.ts @@ -4,15 +4,15 @@ * @group unit/parser/envelopes */ -import { generateMock } from '@anatine/zod-mock'; import { gzipSync } from 'node:zlib'; +import { generateMock } from '@anatine/zod-mock'; +import { ParseError } from '../../../src'; +import { CloudWatchEnvelope } from '../../../src/envelopes/index.js'; import { CloudWatchLogEventSchema, CloudWatchLogsDecodeSchema, } from '../../../src/schemas/'; import { TestSchema } from '../schema/utils.js'; -import { CloudWatchEnvelope } from '../../../src/envelopes/index.js'; -import { ParseError } from '../../../src'; describe('CloudWatch', () => { describe('parse', () => { diff --git a/packages/parser/tests/unit/envelopes/dynamodb.test.ts b/packages/parser/tests/unit/envelopes/dynamodb.test.ts index 80385eca45..df3720ae69 100644 --- a/packages/parser/tests/unit/envelopes/dynamodb.test.ts +++ b/packages/parser/tests/unit/envelopes/dynamodb.test.ts @@ -5,11 +5,11 @@ */ import { generateMock } from '@anatine/zod-mock'; -import { TestEvents } from '../schema/utils.js'; -import { DynamoDBStreamEvent } from 'aws-lambda'; +import type { AttributeValue, DynamoDBStreamEvent } from 'aws-lambda'; import { z } from 'zod'; import { DynamoDBStreamEnvelope } from '../../../src/envelopes/index.js'; import { ParseError } from '../../../src/errors.js'; +import { TestEvents } from '../schema/utils.js'; describe('DynamoDB', () => { const schema = z.object({ @@ -19,12 +19,16 @@ describe('DynamoDB', () => { const mockOldImage = generateMock(schema); const mockNewImage = generateMock(schema); const dynamodbEvent = TestEvents.dynamoStreamEvent as DynamoDBStreamEvent; + // biome-ignore lint/style/noNonNullAssertion: it is ensured that this event has these properties (dynamodbEvent.Records[0].dynamodb!.NewImage as typeof mockNewImage) = mockNewImage; + // biome-ignore lint/style/noNonNullAssertion: it is ensured that this event has these properties (dynamodbEvent.Records[1].dynamodb!.NewImage as typeof mockNewImage) = mockNewImage; + // biome-ignore lint/style/noNonNullAssertion: it is ensured that this event has these properties (dynamodbEvent.Records[0].dynamodb!.OldImage as typeof mockOldImage) = mockOldImage; + // biome-ignore lint/style/noNonNullAssertion: it is ensured that this event has these properties (dynamodbEvent.Records[1].dynamodb!.OldImage as typeof mockOldImage) = mockOldImage; describe('parse', () => { @@ -46,9 +50,8 @@ describe('DynamoDB', () => { }); it('parse should throw error if new or old image is invalid', () => { const ddbEvent = TestEvents.dynamoStreamEvent as DynamoDBStreamEvent; - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - ddbEvent.Records[0].dynamodb!.NewImage.Id = 'foo'; + // biome-ignore lint/style/noNonNullAssertion: it is ensured that this event has these properties + ddbEvent.Records[0].dynamodb!.NewImage!.Id = 'foo' as AttributeValue; expect(() => DynamoDBStreamEnvelope.parse(ddbEvent, schema)).toThrow(); }); }); @@ -75,14 +78,18 @@ describe('DynamoDB', () => { const invalidDDBEvent = TestEvents.dynamoStreamEvent as DynamoDBStreamEvent; + // biome-ignore lint/style/noNonNullAssertion: it is ensured that this event has these properties (invalidDDBEvent.Records[0].dynamodb!.NewImage as typeof mockNewImage) = { Id: { N: 101 }, Message: { S: 'foo' }, }; + // biome-ignore lint/style/noNonNullAssertion: it is ensured that this event has these properties (invalidDDBEvent.Records[1].dynamodb!.NewImage as typeof mockNewImage) = mockNewImage; + // biome-ignore lint/style/noNonNullAssertion: it is ensured that this event has these properties (invalidDDBEvent.Records[0].dynamodb!.OldImage as typeof mockOldImage) = mockOldImage; + // biome-ignore lint/style/noNonNullAssertion: it is ensured that this event has these properties (invalidDDBEvent.Records[1].dynamodb!.OldImage as typeof mockOldImage) = mockOldImage; @@ -98,14 +105,18 @@ describe('DynamoDB', () => { const invalidDDBEvent = TestEvents.dynamoStreamEvent as DynamoDBStreamEvent; + // biome-ignore lint/style/noNonNullAssertion: it is ensured that this event has these properties (invalidDDBEvent.Records[0].dynamodb!.OldImage as typeof mockNewImage) = { Id: { N: 101 }, Message: { S: 'foo' }, }; + // biome-ignore lint/style/noNonNullAssertion: it is ensured that this event has these properties (invalidDDBEvent.Records[1].dynamodb!.NewImage as typeof mockNewImage) = mockNewImage; + // biome-ignore lint/style/noNonNullAssertion: it is ensured that this event has these properties (invalidDDBEvent.Records[0].dynamodb!.OldImage as typeof mockOldImage) = mockOldImage; + // biome-ignore lint/style/noNonNullAssertion: it is ensured that this event has these properties (invalidDDBEvent.Records[0].dynamodb!.NewImage as typeof mockNewImage) = mockNewImage; diff --git a/packages/parser/tests/unit/envelopes/eventbridge.test.ts b/packages/parser/tests/unit/envelopes/eventbridge.test.ts index 1c57549818..d713273544 100644 --- a/packages/parser/tests/unit/envelopes/eventbridge.test.ts +++ b/packages/parser/tests/unit/envelopes/eventbridge.test.ts @@ -4,11 +4,11 @@ * @group unit/parser/envelopes */ -import { TestEvents, TestSchema } from '../schema/utils.js'; import { generateMock } from '@anatine/zod-mock'; -import { EventBridgeEvent } from 'aws-lambda'; +import type { EventBridgeEvent } from 'aws-lambda'; import { EventBridgeEnvelope } from '../../../src/envelopes/index.js'; import { ParseError } from '../../../src/errors.js'; +import { TestEvents, TestSchema } from '../schema/utils.js'; describe('EventBridgeEnvelope ', () => { describe('parse', () => { diff --git a/packages/parser/tests/unit/envelopes/kafka.test.ts b/packages/parser/tests/unit/envelopes/kafka.test.ts index 5c55013244..e47712b911 100644 --- a/packages/parser/tests/unit/envelopes/kafka.test.ts +++ b/packages/parser/tests/unit/envelopes/kafka.test.ts @@ -5,9 +5,9 @@ */ import { generateMock } from '@anatine/zod-mock'; -import { TestEvents, TestSchema } from '../schema/utils.js'; -import { MSKEvent, SelfManagedKafkaEvent } from 'aws-lambda'; +import type { MSKEvent, SelfManagedKafkaEvent } from 'aws-lambda'; import { KafkaEnvelope } from '../../../src/envelopes/index.js'; +import { TestEvents, TestSchema } from '../schema/utils.js'; describe('Kafka', () => { describe('parse', () => { diff --git a/packages/parser/tests/unit/envelopes/kinesis-firehose.test.ts b/packages/parser/tests/unit/envelopes/kinesis-firehose.test.ts index 50951d7c0c..0137fa92e5 100644 --- a/packages/parser/tests/unit/envelopes/kinesis-firehose.test.ts +++ b/packages/parser/tests/unit/envelopes/kinesis-firehose.test.ts @@ -4,11 +4,11 @@ * @group unit/parser/envelopes */ -import { TestEvents, TestSchema } from '../schema/utils.js'; import { generateMock } from '@anatine/zod-mock'; -import { KinesisFirehoseSchema } from '../../../src/schemas/'; -import { z } from 'zod'; +import type { z } from 'zod'; import { KinesisFirehoseEnvelope } from '../../../src/envelopes/index.js'; +import type { KinesisFirehoseSchema } from '../../../src/schemas/'; +import { TestEvents, TestSchema } from '../schema/utils.js'; describe('Kinesis Firehose Envelope', () => { describe('parse', () => { diff --git a/packages/parser/tests/unit/envelopes/kinesis.test.ts b/packages/parser/tests/unit/envelopes/kinesis.test.ts index b30c0f1e75..e84e74f528 100644 --- a/packages/parser/tests/unit/envelopes/kinesis.test.ts +++ b/packages/parser/tests/unit/envelopes/kinesis.test.ts @@ -5,10 +5,10 @@ */ import { generateMock } from '@anatine/zod-mock'; -import { KinesisStreamEvent } from 'aws-lambda'; -import { TestEvents, TestSchema } from '../schema/utils.js'; +import type { KinesisStreamEvent } from 'aws-lambda'; import { KinesisEnvelope } from '../../../src/envelopes/index.js'; import { ParseError } from '../../../src/errors.js'; +import { TestEvents, TestSchema } from '../schema/utils.js'; describe('KinesisEnvelope', () => { describe('parse', () => { diff --git a/packages/parser/tests/unit/envelopes/lambda.test.ts b/packages/parser/tests/unit/envelopes/lambda.test.ts index 56b0551cfd..e9d0301969 100644 --- a/packages/parser/tests/unit/envelopes/lambda.test.ts +++ b/packages/parser/tests/unit/envelopes/lambda.test.ts @@ -1,14 +1,14 @@ -import { LambdaFunctionUrlEnvelope } from '../../../src/envelopes/index.js'; -import { TestEvents, TestSchema } from '../schema/utils.js'; -import { generateMock } from '@anatine/zod-mock'; -import { APIGatewayProxyEventV2 } from 'aws-lambda'; - /** * Test built in schema envelopes for Lambda Functions URL * * @group unit/parser/envelopes */ +import { generateMock } from '@anatine/zod-mock'; +import type { APIGatewayProxyEventV2 } from 'aws-lambda'; +import { LambdaFunctionUrlEnvelope } from '../../../src/envelopes/index.js'; +import { TestEvents, TestSchema } from '../schema/utils.js'; + describe('Lambda Functions Url ', () => { describe('parse', () => { it('should parse custom schema in envelope', () => { diff --git a/packages/parser/tests/unit/envelopes/sns.test.ts b/packages/parser/tests/unit/envelopes/sns.test.ts index 5a6389c9fe..0e26511238 100644 --- a/packages/parser/tests/unit/envelopes/sns.test.ts +++ b/packages/parser/tests/unit/envelopes/sns.test.ts @@ -4,12 +4,12 @@ * @group unit/parser/envelopes */ -import { z } from 'zod'; import { generateMock } from '@anatine/zod-mock'; -import { SNSEvent, SQSEvent } from 'aws-lambda'; -import { TestEvents, TestSchema } from '../schema/utils.js'; +import type { SNSEvent, SQSEvent } from 'aws-lambda'; +import type { z } from 'zod'; import { SnsEnvelope, SnsSqsEnvelope } from '../../../src/envelopes/index.js'; import { ParseError } from '../../../src/errors.js'; +import { TestEvents, TestSchema } from '../schema/utils.js'; describe('Sns and SQS Envelope', () => { describe('SnsSqsEnvelope parse', () => { diff --git a/packages/parser/tests/unit/envelopes/sqs.test.ts b/packages/parser/tests/unit/envelopes/sqs.test.ts index 778e0baee1..4979bccfcf 100644 --- a/packages/parser/tests/unit/envelopes/sqs.test.ts +++ b/packages/parser/tests/unit/envelopes/sqs.test.ts @@ -5,10 +5,10 @@ */ import { generateMock } from '@anatine/zod-mock'; -import { TestEvents, TestSchema } from '../schema/utils.js'; -import { SQSEvent } from 'aws-lambda'; +import type { SQSEvent } from 'aws-lambda'; import { SqsEnvelope } from '../../../src/envelopes/sqs.js'; import { ParseError } from '../../../src/errors.js'; +import { TestEvents, TestSchema } from '../schema/utils.js'; describe('SqsEnvelope ', () => { describe('parse', () => { diff --git a/packages/parser/tests/unit/envelopes/vpc-lattice.test.ts b/packages/parser/tests/unit/envelopes/vpc-lattice.test.ts index a4282064d2..a3eec5be00 100644 --- a/packages/parser/tests/unit/envelopes/vpc-lattice.test.ts +++ b/packages/parser/tests/unit/envelopes/vpc-lattice.test.ts @@ -5,9 +5,9 @@ */ import { generateMock } from '@anatine/zod-mock'; -import { TestEvents, TestSchema } from '../schema/utils.js'; import { VpcLatticeEnvelope } from '../../../src/envelopes/index.js'; -import { VpcLatticeEvent } from '../../../src/types/index.js'; +import type { VpcLatticeEvent } from '../../../src/types/index.js'; +import { TestEvents, TestSchema } from '../schema/utils.js'; describe('VpcLatticeEnvelope', () => { describe('parse', () => { diff --git a/packages/parser/tests/unit/envelopes/vpc-latticev2.test.ts b/packages/parser/tests/unit/envelopes/vpc-latticev2.test.ts index 6f615178ec..a3412d8fe4 100644 --- a/packages/parser/tests/unit/envelopes/vpc-latticev2.test.ts +++ b/packages/parser/tests/unit/envelopes/vpc-latticev2.test.ts @@ -5,9 +5,9 @@ */ import { generateMock } from '@anatine/zod-mock'; -import { TestEvents, TestSchema } from '../schema/utils.js'; import { VpcLatticeV2Envelope } from '../../../src/envelopes/index.js'; -import { VpcLatticeEventV2 } from '../../../src/types/index.js'; +import type { VpcLatticeEventV2 } from '../../../src/types/index.js'; +import { TestEvents, TestSchema } from '../schema/utils.js'; describe('VpcLatticeV2Envelope2', () => { describe('parse', () => { diff --git a/packages/parser/tests/unit/parser.decorator.test.ts b/packages/parser/tests/unit/parser.decorator.test.ts index ab0f7fa352..ef87d96765 100644 --- a/packages/parser/tests/unit/parser.decorator.test.ts +++ b/packages/parser/tests/unit/parser.decorator.test.ts @@ -4,16 +4,16 @@ * @group unit/parser */ -import type { LambdaInterface } from '@aws-lambda-powertools/commons/lib/esm/types'; -import { Context } from 'aws-lambda'; -import { parser } from '../../src/index.js'; -import { TestSchema, TestEvents } from './schema/utils'; import { generateMock } from '@anatine/zod-mock'; -import { EventBridgeSchema } from '../../src/schemas/index.js'; -import { z } from 'zod'; -import { ParsedResult, EventBridgeEvent } from '../../src/types'; +import type { LambdaInterface } from '@aws-lambda-powertools/commons/lib/esm/types'; +import type { Context } from 'aws-lambda'; +import type { z } from 'zod'; import { EventBridgeEnvelope } from '../../src/envelopes/index.js'; import { ParseError } from '../../src/errors.js'; +import { parser } from '../../src/index.js'; +import { EventBridgeSchema } from '../../src/schemas/index.js'; +import type { EventBridgeEvent, ParsedResult } from '../../src/types'; +import { TestEvents, TestSchema } from './schema/utils'; describe('Parser Decorator', () => { const customEventBridgeSchema = EventBridgeSchema.extend({ diff --git a/packages/parser/tests/unit/parser.middy.test.ts b/packages/parser/tests/unit/parser.middy.test.ts index 6d3eaee734..686566b38c 100644 --- a/packages/parser/tests/unit/parser.middy.test.ts +++ b/packages/parser/tests/unit/parser.middy.test.ts @@ -4,15 +4,15 @@ * @group unit/parser */ +import { generateMock } from '@anatine/zod-mock'; import middy from '@middy/core'; -import { Context } from 'aws-lambda'; +import type { Context } from 'aws-lambda'; +import type { ZodSchema, z } from 'zod'; +import { EventBridgeEnvelope, SqsEnvelope } from '../../src/envelopes'; import { parser } from '../../src/middleware/parser.js'; -import { generateMock } from '@anatine/zod-mock'; import { SqsSchema } from '../../src/schemas'; -import { z, type ZodSchema } from 'zod'; -import { SqsEnvelope, EventBridgeEnvelope } from '../../src/envelopes'; -import { TestSchema, TestEvents } from './schema/utils'; import type { EventBridgeEvent, ParsedResult, SqsEvent } from '../../src/types'; +import { TestEvents, TestSchema } from './schema/utils'; describe('Middleware: parser', () => { type TestEvent = z.infer; @@ -42,9 +42,9 @@ describe('Middleware: parser', () => { event as unknown as TestEvent[], {} as Context )) as TestEvent[]; - result.forEach((item) => { + for (const item of result) { expect(item).toEqual(bodyMock); - }); + } }); it('should throw when envelope does not match', async () => { diff --git a/packages/parser/tests/unit/schema/alb.test.ts b/packages/parser/tests/unit/schema/alb.test.ts index 6984f56f6d..1d9a21c67e 100644 --- a/packages/parser/tests/unit/schema/alb.test.ts +++ b/packages/parser/tests/unit/schema/alb.test.ts @@ -3,7 +3,7 @@ * * @group unit/parser/schema/ */ -import { AlbSchema, AlbMultiValueHeadersSchema } from '../../../src/schemas/'; +import { AlbMultiValueHeadersSchema, AlbSchema } from '../../../src/schemas/'; import { TestEvents } from './utils.js'; describe('ALB ', () => { diff --git a/packages/parser/tests/unit/schema/cloudformation-custom-resource.test.ts b/packages/parser/tests/unit/schema/cloudformation-custom-resource.test.ts index 7b4df56201..e00530f3bc 100644 --- a/packages/parser/tests/unit/schema/cloudformation-custom-resource.test.ts +++ b/packages/parser/tests/unit/schema/cloudformation-custom-resource.test.ts @@ -6,8 +6,8 @@ import { CloudFormationCustomResourceCreateSchema, - CloudFormationCustomResourceUpdateSchema, CloudFormationCustomResourceDeleteSchema, + CloudFormationCustomResourceUpdateSchema, } from '../../../src/schemas/'; import { TestEvents } from './utils.js'; diff --git a/packages/parser/tests/unit/schema/kinesis.test.ts b/packages/parser/tests/unit/schema/kinesis.test.ts index 7d66b99469..31c4400757 100644 --- a/packages/parser/tests/unit/schema/kinesis.test.ts +++ b/packages/parser/tests/unit/schema/kinesis.test.ts @@ -5,9 +5,9 @@ */ import { + KinesisDataStreamSchema, KinesisFirehoseSchema, KinesisFirehoseSqsSchema, - KinesisDataStreamSchema, } from '../../../src/schemas/'; import { TestEvents } from './utils.js'; diff --git a/packages/parser/tests/unit/schema/s3.test.ts b/packages/parser/tests/unit/schema/s3.test.ts index 72e3ba74dc..8798155472 100644 --- a/packages/parser/tests/unit/schema/s3.test.ts +++ b/packages/parser/tests/unit/schema/s3.test.ts @@ -6,9 +6,9 @@ import { S3EventNotificationEventBridgeSchema, - S3SqsEventNotificationSchema, - S3Schema, S3ObjectLambdaEventSchema, + S3Schema, + S3SqsEventNotificationSchema, } from '../../../src/schemas/'; import { TestEvents } from './utils.js'; @@ -81,7 +81,8 @@ describe('S3 ', () => { it('should parse s3 object event temp credentials', () => { // ignore any because we don't want typed json const s3ObjectEventTempCredentials = - TestEvents.s3ObjectEventTempCredentials as any; // eslint-disable-line @typescript-eslint/no-explicit-any + // biome-ignore lint/suspicious/noExplicitAny: no specific typing needed + TestEvents.s3ObjectEventTempCredentials as any; const parsed = S3ObjectLambdaEventSchema.parse( s3ObjectEventTempCredentials ); diff --git a/packages/parser/tests/unit/schema/utils.ts b/packages/parser/tests/unit/schema/utils.ts index 3e1ad00133..cb0647aed7 100644 --- a/packages/parser/tests/unit/schema/utils.ts +++ b/packages/parser/tests/unit/schema/utils.ts @@ -83,6 +83,7 @@ const filenames = [ 's3EventBridgeNotificationObjectRestoreCompletedEvent', 's3EventDecodedKey', 's3EventDeleteObject', + 's3EventDeleteObjectWithoutEtagSize', 's3EventGlacier', 's3ObjectEventIAMUser', 's3ObjectEventTempCredentials', @@ -106,11 +107,11 @@ const loadFileContent = (filename: string): string => const createTestEvents = (fileList: readonly string[]): TestEvents => { const testEvents: Partial = {}; - fileList.forEach((filename) => { + for (const filename of fileList) { Object.defineProperty(testEvents, filename, { get: () => JSON.parse(loadFileContent(filename)), }); - }); + } return testEvents as TestEvents; }; diff --git a/packages/parser/tsconfig.esm.json b/packages/parser/tsconfig.esm.json index 123291b0cf..82486b64fa 100644 --- a/packages/parser/tsconfig.esm.json +++ b/packages/parser/tsconfig.esm.json @@ -6,7 +6,5 @@ "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json" }, - "include": [ - "./src/**/*" - ] -} \ No newline at end of file + "include": ["./src/**/*"] +} diff --git a/packages/parser/tsconfig.json b/packages/parser/tsconfig.json index 92aecd7c98..4923c4f6f4 100644 --- a/packages/parser/tsconfig.json +++ b/packages/parser/tsconfig.json @@ -5,7 +5,5 @@ "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/cjs.json" }, - "include": [ - "./src/**/*" - ], -} \ No newline at end of file + "include": ["./src/**/*"] +} diff --git a/packages/parser/typedoc.json b/packages/parser/typedoc.json index 51ddecfe5f..5a14ab2b5f 100644 --- a/packages/parser/typedoc.json +++ b/packages/parser/typedoc.json @@ -1,7 +1,5 @@ { - "extends": [ - "../../typedoc.base.json" - ], + "extends": ["../../typedoc.base.json"], "entryPoints": [ "./src/index.ts", "./src/middleware/parser.ts", @@ -10,4 +8,4 @@ "./src/schemas/index.ts" ], "readme": "README.md" -} \ No newline at end of file +}