-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
V5 - drop old node versions and move to new AWS sdk (#129)
\
- Loading branch information
Showing
30 changed files
with
2,553 additions
and
1,527 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require: | ||
- 'ts-node/register' | ||
- 'source-map-support/register' | ||
- 'src/test/setup.ts' | ||
recursive: true | ||
reporter: 'spec' | ||
exit: true | ||
spec: | ||
- 'src/test/**/*.ts' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: '3' | ||
services: | ||
queue: | ||
image: softwaremill/elasticmq | ||
ports: | ||
- "9324:9324" | ||
- "9325:9325" | ||
|
||
s3: | ||
image: scireum/s3-ninja | ||
ports: | ||
- "9000:9000" | ||
environment: | ||
root: elasticmq | ||
initialBuckets: test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import {Squiss, Message} from '../src'; | ||
import {SQSClientConfig} from '@aws-sdk/client-sqs'; | ||
import {S3} from '@aws-sdk/client-s3'; | ||
|
||
const awsConfig: SQSClientConfig = { | ||
region: 'elasticmq', | ||
endpoint: 'http://localhost:9324', | ||
credentials: { | ||
accessKeyId: 'dummy', | ||
secretAccessKey: 'dummy', | ||
}, | ||
}; | ||
|
||
const s3 = new S3({ | ||
endpoint: 'http://localhost:9000/s3', | ||
credentials: { | ||
accessKeyId: 'AKIAIOSFODNN7EXAMPLE', | ||
secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY', | ||
}, | ||
}) | ||
|
||
const squiss = new Squiss({ | ||
awsConfig, | ||
queueName: 'my-sqs-queue', | ||
bodyFormat: 'json', | ||
maxInFlight: 15, | ||
S3: s3, | ||
gzip: true, | ||
minGzipSize: 1, | ||
s3Fallback: true, | ||
s3Bucket: 'test', | ||
minS3Size: 1, | ||
correctQueueUrl: true, | ||
}); | ||
|
||
(async () => { | ||
await await s3.createBucket({ | ||
Bucket: 'test', | ||
}); | ||
await squiss.createQueue(); | ||
squiss.on('message', async (message: Message) => { | ||
console.log(`${message.body.name} says: ${JSON.stringify(message.body.message)} and has attripute p1 with value ${message.attributes.p1}`); | ||
await message.del(); | ||
}); | ||
squiss.on('error', (error: Error) => { | ||
console.log(`squiss error`, error); | ||
}); | ||
await squiss.start(); | ||
|
||
const messageToSend = { | ||
name: 'messageName', | ||
message: { | ||
a: 1, | ||
b: 2, | ||
}, | ||
}; | ||
|
||
const propsToSend = { | ||
p1: 1, | ||
p2: 2, | ||
}; | ||
|
||
await squiss.sendMessage(messageToSend, 0, propsToSend); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
{ | ||
"name": "squiss-ts", | ||
"version": "4.4.1", | ||
"version": "5.0.0", | ||
"description": "High-volume SQS poller", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"engines": { | ||
"node": "^6 || ^8 || ^10 || ^12 || ^14 || ^16 || ^18" | ||
"node": "^16 || ^18|| ^19" | ||
}, | ||
"scripts": { | ||
"postinstall": " node -e \"const semver = require('semver');const relevant = semver.lt(process.version, '10.16.0');if (relevant == false) {process.exit(0);}try {require('iltorb'); process.exit(0);} catch (err){process.exit(1);}\" || yarn add --pure-lockfile --ignore-engines [email protected]", | ||
"clean": "rm -rf node_modules build coverage dist", | ||
"clean": "rm -rf .nyc_output coverage dist", | ||
"build": "yarn lint && yarn compile", | ||
"compile": "tsc", | ||
"test": "yarn lint && yarn mocha", | ||
"mocha": "_mocha --opts src/test/mocha.opts", | ||
"cover": "nyc --reporter=lcov --reporter=text-summary npm run mocha", | ||
"cover": "yarn clean && yarn nyc yarn mocha", | ||
"lint": "tslint -c tslint.json \"src/**/*.ts\" \"test/**/*.ts\"", | ||
"benchmark": "tsc --extendedDiagnostics --incremental false" | ||
"benchmark": "tsc --extendedDiagnostics --incremental false", | ||
"e2e:start": "docker compose -f e2e/docker-compose.yml up &", | ||
"e2e:stop": "docker compose -f e2e/docker-compose.yml down &" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|
@@ -48,34 +48,51 @@ | |
}, | ||
"homepage": "https://github.com/PruvoNet/squiss-ts#readme", | ||
"dependencies": { | ||
"aws-sdk": "2.814.0", | ||
"@aws-sdk/client-s3": "^3.310.0", | ||
"@aws-sdk/client-sqs": "^3.310.0", | ||
"@aws-sdk/types": "^3.310.0", | ||
"linked-list": "^2.1.0", | ||
"semver": "6.3.0", | ||
"semver": "7.4.0", | ||
"ts-type-guards": "^0.7.0", | ||
"uuid": "^8.3.2" | ||
"uuid": "^9.0.0" | ||
}, | ||
"devDependencies": { | ||
"@istanbuljs/nyc-config-typescript": "0.1.3", | ||
"@types/chai": "^4.2.12", | ||
"@types/chai-as-promised": "^7.1.3", | ||
"@types/iltorb": "^2.3.2", | ||
"@types/mocha": "^8.0.0", | ||
"@types/node": "^14.0.26", | ||
"@istanbuljs/nyc-config-typescript": "1.0.2", | ||
"@types/chai": "^4.3.4", | ||
"@types/chai-as-promised": "^7.1.5", | ||
"@types/mocha": "^10.0.1", | ||
"@types/node": "^14.18.42", | ||
"@types/proxyquire": "^1.3.28", | ||
"@types/semver": "7.3.1", | ||
"@types/uuid": "^8.0.0", | ||
"chai": "^4.2.0", | ||
"@types/semver": "^7.3.13", | ||
"@types/uuid": "^9.0.1", | ||
"chai": "^4.3.7", | ||
"chai-as-promised": "^7.1.1", | ||
"delay": "^4.4.0", | ||
"delay": "^5.0.0", | ||
"dirty-chai": "^2.0.1", | ||
"mocha": "6.2.2", | ||
"nyc": "14.1.1", | ||
"mocha": "^10.2.0", | ||
"nyc": "^15.1.0", | ||
"proxyquire": "^2.1.3", | ||
"sinon": "^7.5.0", | ||
"sinon-chai": "^3.5.0", | ||
"source-map-support": "^0.5.19", | ||
"ts-node": "^8.10.2", | ||
"sinon": "^15.0.3", | ||
"sinon-chai": "^3.7.0", | ||
"source-map-support": "^0.5.21", | ||
"ts-node": "^10.9.1", | ||
"tslint": "^6.1.3", | ||
"typescript": "4.6.4" | ||
"typescript": "^5.0.4" | ||
}, | ||
"nyc": { | ||
"extends": "@istanbuljs/nyc-config-typescript", | ||
"check-coverage": true, | ||
"all": true, | ||
"exclude": [ | ||
"src/test/**", | ||
"e2e**" | ||
], | ||
"reporter": [ | ||
"html", | ||
"lcov", | ||
"text", | ||
"text-summary" | ||
], | ||
"report-dir": "coverage" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.