@alpha-lambda/aws-drivers
Advanced tools
Comparing version 1.0.1 to 1.1.0
'use strict'; | ||
const S3 = require('./lib/s3'); | ||
const SQS = require('./lib/sqs'); | ||
module.exports = { | ||
S3 | ||
S3, | ||
SQS | ||
}; |
'use strict'; | ||
const assert = require('assert'); | ||
const AWS = require('aws-sdk'); | ||
const logMeGently = require('@alpha-lambda/log-me-gently'); | ||
@@ -18,3 +17,3 @@ | ||
this._client = new AWS[service](clientOptions); | ||
this._client = new service(clientOptions); // eslint-disable-line new-cap | ||
} | ||
@@ -21,0 +20,0 @@ |
'use strict'; | ||
const assert = require('assert'); | ||
const AWS = require('aws-sdk'); | ||
const uuid = require('uuid'); | ||
@@ -15,6 +16,7 @@ | ||
}; | ||
super('S3', clientOpts, options); | ||
super(AWS.S3, clientOpts, options); | ||
} | ||
getSignedUrl(context, { operation, parameters, urlTTL }) { | ||
assert(context, 'missing context'); | ||
assert(operation, 'missing operation'); | ||
@@ -54,2 +56,3 @@ assert(urlTTL !== undefined, 'missing urlTTL'); | ||
putObject(context, { bucket, data, key }) { | ||
assert(context, 'missing context'); | ||
assert(bucket, 'missing bucket'); | ||
@@ -56,0 +59,0 @@ assert(data, 'missing data'); |
{ | ||
"name": "@alpha-lambda/aws-drivers", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Wrappers for AWS SDK services that make life easier (sometimes)", | ||
@@ -51,4 +51,7 @@ "repository": { | ||
"@alpha-lambda/log-me-gently": "^1.0.0", | ||
"ajv": "^6.10.0", | ||
"lodash.chunk": "^4.2.0", | ||
"throat": "^5.0.0", | ||
"uuid": "^3.3.2" | ||
} | ||
} |
@@ -36,2 +36,43 @@ # aws-drivers | ||
### SQS | ||
Additional config properties: | ||
- **[maxConcurrency]** - { Number } - max number of concurrent AWS API calls [defaults to `Infinity`] | ||
#### parse(context, input) | ||
Validates and parses input, where input can be SQS message or SQS event. Sample output: | ||
```json | ||
[ | ||
{ | ||
"body": { | ||
"foo": "foo", | ||
"bar": "bar" | ||
}, | ||
"messageAttributes": { | ||
"baz": 12345 | ||
}, | ||
"messageId": 1234567890 | ||
} | ||
] | ||
``` | ||
#### send(context, queueUrl, messages) | ||
Sends messages to the specified queue using batch API to reduce number of calls. | ||
- **queueUrl** - { String } - the URL of the SQS queue to which batched messages are sent | ||
- **messages** - { Any | Any[] } - messages to be sent | ||
#### sendToDLQ(context, dlqUrl, items) | ||
Formats and sends messages to the specified deadletter queue. | ||
- **dlqUrl** - { String } - the deadletter queue URL to which messages are sent | ||
- **items** - { Object | Object[] } - items to send to the deadletter queue, where: | ||
- **event** - { Any } - original payload that can't be processed | ||
- **error** - { Object } - error that occured during processing | ||
These message attributes are added to each message: | ||
- **err.message** - error message | ||
- **err.stack** - error stack trace | ||
- **context.awsRequestId** - requestId for the current request, provided by Amazon | ||
- **origin.messageId** - original messageId (if payload is SQS message) | ||
## License | ||
@@ -38,0 +79,0 @@ |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
135091
11
3511
99
0
6
+ Addedajv@^6.10.0
+ Addedlodash.chunk@^4.2.0
+ Addedthroat@^5.0.0
+ Addedajv@6.12.6(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedlodash.chunk@4.2.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedthroat@5.0.0(transitive)
+ Addeduri-js@4.4.1(transitive)