Wrappers for AWS SDK services that make life easier (sometimes).
Each driver has a constructor of the following form:
- [client] - { Object } - config field that is used to construct client (ignored when pre-configured client is passed)
- [useClient] - { Object } - pre-configured client
- [level] - { String } - log level
- [...other] - { Any } - driver-specific config options
Additional config properties:
- [attempts] - { Number } - max number of attempts to
batchGet
items
Returns the attributes of one or more items from one or more tables (parameters reference). Automatically retries when API call returns UnprocessedKeys
Deletes a single item in a table by primary key (parameters reference).
Returns a set of attributes for the item with the given key (parameters reference).
Creates a new item, or replaces an old item (parameters reference).
Finds items based on key values (parameters reference).
The same as query
but keeps calling DynamoDB until all items are returned (parameters reference). If callback is provided, it's called each time DynamoDB returns items.
Returns one or more items and item attributes by accessing every item in a table or a secondary index (parameters reference).
The same as scan
but keeps calling DynamoDB until all items are returned (parameters reference). If callback is provided, it's called each time DynamoDB returns items. To perform parallel scan, set concurrency
to a value greater than 1
.
Edits an existing item's attributes, or adds a new item to the table if it does not already exist (parameters reference).
Get a pre-signed URL for a given operation name.
- operation - { String } - the name of the operation to call
- parameters - { Object } - parameters to pass to the operation
- urlTTL - { Number } - URL expiration time in seconds
Adds an object to a bucket.
- bucket - { String } - name of the bucket
- body - { Buffer | Typed Array | Blob | String | ReadableStream } - object data
- [key] - { String } - object key [random UUID by default]
- [params] - { Object } - any additional input parameters that S3.putObject allows
Uploads an arbitrarily sized buffer, blob, or stream, using intelligent concurrent handling of parts if the payload is large enough. - bucket - { String } - name of the bucket - body - { Buffer | Typed Array | Blob | String | ReadableStream } - object data - [key] - { String } - object key [random UUID by default] - [options] - { Object } - upload operation options such as part and/or queue size - [params] - { Object } - any additional input parameters that S3.upload allows
Additional config properties:
- [maxConcurrency] - { Number } - max number of concurrent AWS API calls [defaults to
Infinity
]
Validates and parses input, where input can be SQS message or SQS event. Sample output:
[
{
"body": {
"foo": "foo",
"bar": "bar"
},
"messageAttributes": {
"baz": 12345
},
"messageId": 1234567890
}
]
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 - { Object | Object[] } - messages to be sent, where each message has the following properties:
- body - { Any } - the body of the message
- [delaySeconds] - { Number } - the length of time, in seconds, for which a specific message is delayed
- [messageAttributes] - { Object } - key-value pairs of attributes to be added to the message
- [dedupId] - { String } - required for and only used in FIFO queues: (docs)
- [groupId] - { String } - required for and only used in FIFO queues: (docs)
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)
The MIT License (MIT)
Copyright (c) 2019-2023 Anton Bazhal
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.