From 9d84a13e723971a7ec8ab80d156f4643b5f7abc3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2020 10:05:25 +0000 Subject: [PATCH 1/5] Bump acorn from 5.7.3 to 5.7.4 Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](https://github.com/acornjs/acorn/compare/5.7.3...5.7.4) Signed-off-by: dependabot[bot] --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index bc9e5760..4c03e10d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -704,9 +704,9 @@ } }, "acorn": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", - "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "version": "5.7.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", + "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==", "dev": true }, "acorn-globals": { @@ -720,9 +720,9 @@ }, "dependencies": { "acorn": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz", - "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==", + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", "dev": true } } From d1fbc50f39eab2c5a8423d69aa46d5e58dfbdaf9 Mon Sep 17 00:00:00 2001 From: Mark Polak Date: Mon, 18 May 2020 18:10:16 +0300 Subject: [PATCH 2/5] add support for configuring rawMessageDelivery --- .gitignore | 1 + .idea/.gitignore | 5 +++++ README.md | 1 + lib/serverless-sns-sqs-lambda.js | 15 +++++++++------ package-lock.json | 14 +++++++------- package.json | 2 +- 6 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 .idea/.gitignore diff --git a/.gitignore b/.gitignore index 0519f910..dd76b340 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ jspm_packages # Serverless directories **/.serverless node_modules +/.idea diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..b58b603f --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/README.md b/README.md index 769c1702..f0f5d3c4 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ functions: topicArn: !Ref Topic # Required - SNS topic to subscribe to batchSize: 2 # Optional - default value is 10 maxRetryCount: 2 # Optional - default value is 5 + rawMessageDelivery: true # Optional - default value is true filterPolicy: # Optional - filter messages that are handled pets: - dog diff --git a/lib/serverless-sns-sqs-lambda.js b/lib/serverless-sns-sqs-lambda.js index ad1d417f..84d49e24 100644 --- a/lib/serverless-sns-sqs-lambda.js +++ b/lib/serverless-sns-sqs-lambda.js @@ -144,10 +144,11 @@ Usage handler: handler.handler events: - snsSqs: - name: Event # required - topicArn: !Ref TopicArn # required - maxRetryCount: 2 # optional - default is 5 - batchSize: 1 # optional - default is 10 + name: Event # required + topicArn: !Ref TopicArn # required + maxRetryCount: 2 # optional - default is 5 + batchSize: 1 # optional - default is 10 + rawMessageDelivery: false # optional - default is true filterPolicy: pet: - dog @@ -164,7 +165,8 @@ Usage prefix: config.prefix || `${this.serviceName}-${stage}-${funcNamePascalCase}`, batchSize: parseIntOr(config.batchSize, 10), - maxRetryCount: parseIntOr(config.maxRetryCount, 5) + maxRetryCount: parseIntOr(config.maxRetryCount, 5), + rawMessageDelivery: config.rawMessageDelivery !== undefined ? config.rawMessageDelivery : true }; } @@ -264,13 +266,14 @@ Usage * @param {{name, topicArn, filterPolicy}} config including name of the queue, * the arn of the topic and the filter policy for the subscription */ - addTopicSubscription(template, { name, topicArn, filterPolicy }) { + addTopicSubscription(template, { name, topicArn, filterPolicy, rawMessageDelivery}) { template.Resources[`Subscribe${name}Topic`] = { Type: "AWS::SNS::Subscription", Properties: { Endpoint: { "Fn::GetAtt": [`${name}Queue`, "Arn"] }, Protocol: "sqs", TopicArn: topicArn, + RawMessageDelivery: rawMessageDelivery, ...(filterPolicy ? { FilterPolicy: filterPolicy } : {}) } }; diff --git a/package-lock.json b/package-lock.json index 4c03e10d..927228b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "serverless-sns-sqs-lambda", + "name": "@venncity/serverless-sns-sqs-lambda", "version": "0.1.8", "lockfileVersion": 1, "requires": true, @@ -704,9 +704,9 @@ } }, "acorn": { - "version": "5.7.4", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", - "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==", + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", "dev": true }, "acorn-globals": { @@ -720,9 +720,9 @@ }, "dependencies": { "acorn": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", - "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz", + "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==", "dev": true } } diff --git a/package.json b/package.json index a3f04d85..0f7bf822 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@agiledigital/serverless-sns-sqs-lambda", + "name": "@venncity/serverless-sns-sqs-lambda", "version": "0.1.8", "description": "serverless plugin to make serverless-sns-sqs-lambda events", "main": "lib/serverless-sns-sqs-lambda.js", From f0d29ac3dc4fbd667c971f01dba98fcd5776869d Mon Sep 17 00:00:00 2001 From: Mark Polak Date: Mon, 18 May 2020 18:11:02 +0300 Subject: [PATCH 3/5] delete github workflows --- .github/workflows/greetings.yml | 13 ------------- .github/workflows/label.yml | 12 ------------ .github/workflows/publish.yml | 27 --------------------------- .github/workflows/stale.yml | 19 ------------------- .github/workflows/test.yml | 20 -------------------- 5 files changed, 91 deletions(-) delete mode 100644 .github/workflows/greetings.yml delete mode 100644 .github/workflows/label.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/stale.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml deleted file mode 100644 index 28ee6b2f..00000000 --- a/.github/workflows/greetings.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Greetings - -on: [pull_request, issues] - -jobs: - greeting: - runs-on: ubuntu-latest - steps: - - uses: actions/first-interaction@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: 'Message that will be displayed on users'' first issue' - pr-message: 'Message that will be displayed on users'' first pr' diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml deleted file mode 100644 index c01c3569..00000000 --- a/.github/workflows/label.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Labeler -on: [pull_request] - -jobs: - label: - - runs-on: ubuntu-latest - - steps: - - uses: actions/labeler@v2 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index adfc16f1..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Publish -# This workflow is triggered on pushes to the repository. -on: release - -jobs: - build: - name: Publish - runs-on: ubuntu-latest - steps: - - name: Tag - uses: actions/bin/filter@master - with: - args: tag - - uses: actions/checkout@v1 - - name: Use Node.js 10.x - uses: actions/setup-node@v1 - with: - version: 10.x - - run: git config --global user.email "git@agiledigital.com.au" - - run: git config --global user.name "Git Ci" - - run: npm version from-git - - name: Publish - uses: actions/npm@master - env: - NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - with: - args: publish diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 688fb4de..00000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Mark stale issues and pull requests - -on: - schedule: - - cron: "0 0 * * *" - -jobs: - stale: - - runs-on: ubuntu-latest - - steps: - - uses: actions/stale@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Stale issue message' - stale-pr-message: 'Stale pull request message' - stale-issue-label: 'no-issue-activity' - stale-pr-label: 'no-pr-activity' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 1444c85e..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Test -# This workflow is triggered on pushes to the repository. -on: [push] - -jobs: - build: - strategy: - matrix: - # Limit the tests of the module to the versions that we want to support - node: ["10", "11"] - name: Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node }} - - run: npm install - - run: CI=true npm test From 3dbfea3f86a1a3a6712797402665b5cec3811ed9 Mon Sep 17 00:00:00 2001 From: Ilya Vinokurov Date: Sun, 1 Nov 2020 08:09:48 +0200 Subject: [PATCH 4/5] Adding VisibilityTimeout property to SQS queue --- lib/serverless-sns-sqs-lambda.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/serverless-sns-sqs-lambda.js b/lib/serverless-sns-sqs-lambda.js index 84d49e24..009f2119 100644 --- a/lib/serverless-sns-sqs-lambda.js +++ b/lib/serverless-sns-sqs-lambda.js @@ -214,7 +214,7 @@ Usage * @param {{name, prefix, maxRetryCount}} config including name of the queue, * the resource prefix and the max retry count for message handler failures. */ - addEventQueue(template, { name, prefix, maxRetryCount }) { + addEventQueue(template, { name, prefix, maxRetryCount, visibilityTimeout }) { template.Resources[`${name}Queue`] = { Type: "AWS::SQS::Queue", Properties: { @@ -224,7 +224,8 @@ Usage "Fn::GetAtt": [`${name}DeadLetterQueue`, "Arn"] }, maxReceiveCount: maxRetryCount - } + }, + VisibilityTimeout: visibilityTimeout } }; } @@ -266,7 +267,7 @@ Usage * @param {{name, topicArn, filterPolicy}} config including name of the queue, * the arn of the topic and the filter policy for the subscription */ - addTopicSubscription(template, { name, topicArn, filterPolicy, rawMessageDelivery}) { + addTopicSubscription(template, { name, topicArn, filterPolicy, rawMessageDelivery }) { template.Resources[`Subscribe${name}Topic`] = { Type: "AWS::SNS::Subscription", Properties: { From 9814a69cde503c8385b7dd8686288cebaf640c8b Mon Sep 17 00:00:00 2001 From: Ilya Vinokurov Date: Sun, 1 Nov 2020 12:57:32 +0200 Subject: [PATCH 5/5] Adding VisibilityTimeout property to SQS queue --- lib/serverless-sns-sqs-lambda.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/serverless-sns-sqs-lambda.js b/lib/serverless-sns-sqs-lambda.js index 009f2119..0c5a7d5f 100644 --- a/lib/serverless-sns-sqs-lambda.js +++ b/lib/serverless-sns-sqs-lambda.js @@ -211,7 +211,7 @@ Usage * from SNS as they arrive, holding them for processing. * * @param {object} template the template which gets mutated - * @param {{name, prefix, maxRetryCount}} config including name of the queue, + * @param {{name, prefix, maxRetryCount, visibilityTimeout}} config including name of the queue, * the resource prefix and the max retry count for message handler failures. */ addEventQueue(template, { name, prefix, maxRetryCount, visibilityTimeout }) {