Skip to content

Commit

Permalink
fix(receive-one): add missing options
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierCuyp committed Oct 10, 2024
1 parent 4c356af commit c003d16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/Sagacify/sqs-handler.git"
"url": "git+https://github.com/Sagacify/sqs-handler.git"
},
"bugs": {
"url": "https://github.com/Sagacify/sqs-handler/issues"
Expand Down
4 changes: 3 additions & 1 deletion src/SQSHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type ReceiveOptions = Omit<
ReceiveMessageCommandInput,
'QueueUrl' | 'VisibilityTimeout' | 'WaitTimeSeconds'
>;
export type ReceiveOneOptions = Omit<ReceiveOptions, 'MaxNumberOfMessages'>;
export type SendOptions = Omit<
SendMessageCommandInput,
'QueueUrl' | 'MessageAttributes' | 'MessageBody'
Expand Down Expand Up @@ -226,8 +227,9 @@ export class SQSHandler<ParsedBody> {
return parsedMessages;
}

async receiveOne(): Promise<ParsedMessage<ParsedBody> | null> {
async receiveOne(options: ReceiveOneOptions = {}): Promise<ParsedMessage<ParsedBody> | null> {
const command = new ReceiveMessageCommand({
...options,
QueueUrl: this.queueUrl,
MaxNumberOfMessages: 1,
VisibilityTimeout: this.visibilityTimeout,
Expand Down

0 comments on commit c003d16

Please sign in to comment.