Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: transitioning to ESM #476

Merged
merged 9 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage
examples
test
public
.nyc_output
.nyc_output
scripts
8 changes: 5 additions & 3 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module.exports = {
/** @type {import("prettier").Config} */

export const config = {
singleQuote: true,
arrowParens: 'always',
trailingComma: 'none'
arrowParens: "always",
trailingComma: "none",
};
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ Visit [https://bbc.github.io/sqs-consumer/](https://bbc.github.io/sqs-consumer/)
## Usage

```js
import { Consumer } from 'sqs-consumer';
import { Consumer } from "sqs-consumer";

const app = Consumer.create({
queueUrl: 'https://sqs.eu-west-1.amazonaws.com/account-id/queue-name',
queueUrl: "https://sqs.eu-west-1.amazonaws.com/account-id/queue-name",
handleMessage: async (message) => {
// do some work with `message`
}
},
});

app.on('error', (err) => {
app.on("error", (err) => {
console.error(err.message);
});

app.on('processing_error', (err) => {
app.on("processing_error", (err) => {
console.error(err.message);
});

Expand Down Expand Up @@ -75,32 +75,32 @@ export AWS_ACCESS_KEY_ID=...
If you need to specify your credentials manually, you can use a pre-configured instance of the [SQS Client](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-sqs/classes/sqsclient.html) client.

```js
import { Consumer } from 'sqs-consumer';
import { SQSClient } from '@aws-sdk/client-sqs';
import { Consumer } from "sqs-consumer";
import { SQSClient } from "@aws-sdk/client-sqs";

const app = Consumer.create({
queueUrl: 'https://sqs.eu-west-1.amazonaws.com/account-id/queue-name',
queueUrl: "https://sqs.eu-west-1.amazonaws.com/account-id/queue-name",
handleMessage: async (message) => {
// ...
},
sqs: new SQSClient({
region: 'my-region',
region: "my-region",
credentials: {
accessKeyId: 'yourAccessKey',
secretAccessKey: 'yourSecret'
}
})
accessKeyId: "yourAccessKey",
secretAccessKey: "yourSecret",
},
}),
});

app.on('error', (err) => {
app.on("error", (err) => {
console.error(err.message);
});

app.on('processing_error', (err) => {
app.on("processing_error", (err) => {
console.error(err.message);
});

app.on('timeout_error', (err) => {
app.on("timeout_error", (err) => {
console.error(err.message);
});

Expand Down
115 changes: 49 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading