Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
fix(sqs): use correct argument order for SQSPayload
Browse files Browse the repository at this point in the history
  • Loading branch information
MickVanDuijn committed Jan 2, 2024
1 parent 8c9f9f6 commit 5df8c63
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/event-horizon/sqs/sqs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { arbitrary } from '@skyleague/therefore'

export function sqsEvent<Configuration, Service, Profile, Payload, MessageGrouping extends { by?: 'message-group-id' }>(
definition: SQSHandler<Configuration, Service, Profile, Payload, MessageGrouping>
): Dependent<SQSPayload<Payload, MessageGrouping>> {
): Dependent<SQSPayload<MessageGrouping, Payload>> {
const { sqs } = definition
if (sqs.messageGrouping !== undefined) {
return object({
messageGroupId: alphaNumeric({ minLength: 1 }),
payload: sqs.schema.payload !== undefined ? arbitrary(sqs.schema.payload) : unknown(),
raw: arbitrary(SQSRecord),
item: integer({ min: 0, max: 10 }),
} satisfies { [k in keyof SQSEvent]: unknown }) as Dependent<SQSPayload<Payload, MessageGrouping>>
} satisfies { [k in keyof SQSEvent]: unknown }) as Dependent<SQSPayload<MessageGrouping, Payload>>
} else {
return tuple(
array(
Expand All @@ -40,6 +40,6 @@ export function sqsEvent<Configuration, Service, Profile, Payload, MessageGroupi
}) satisfies { [k in keyof SQSEvent]: unknown }
),
messageGroupId,
})) as Dependent<SQSPayload<Payload, MessageGrouping>>
})) as Dependent<SQSPayload<MessageGrouping, Payload>>
}
}

0 comments on commit 5df8c63

Please sign in to comment.