presidium 1.4.8 → 1.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/DynamoDBStream.js CHANGED
@@ -51,8 +51,12 @@ const SymbolUpdateShards = Symbol('UpdateShards')
51
51
  * * `region` - the AWS region.
52
52
  * * `autoReady` - whether to automatically create the DynamoDB Stream if it doesn't exist. Defaults to `true`.
53
53
  * * `StreamViewType` - determines what information is written to the DynamoDB Stream.
54
- * * `ShardIteratorType` - determines how the shard iterator is used to start reading stream records from a shard of the stream. A shard is a replica of a stream for enhanced throughput purposes.
55
- * * `JSON` - replaces `NewImage` in DynamoDB JSON format with `NewImageJSON` in JSON format and `OldImage` in DynamoDB JSON format with `OldImageJSON` in JSON format for all stream records.
54
+ * * `ShardIteratorType` - determines how the shard iterator is used to start reading stream records from a shard of the stream. A shard is a replica of a stream for enhanced throughput purposes. Defaults to `'LATEST'`.
55
+ * * `GetRecordsLimit` - number of records to fetch per DynamoDB Streams GetRecords operation. Defaults to `1000`.
56
+ * * `GetRecordsInterval` - number of milliseconds to wait between DynamoDB Streams GetRecords calls. Defaults to `1000`.
57
+ * * `ShardUpdatePeriod` - number of milliseconds to wait between shard updates. Defaults to `15000`.
58
+ * * `ListStreamsLimit` - number of streams to list per DynamoDB Streams ListStreams calls. Defaults to `100`.
59
+ * * `JSON` - replaces `NewImage` in DynamoDB JSON format with `NewImageJSON` in JSON format and `OldImage` in DynamoDB JSON format with `OldImageJSON` in JSON format for all stream records. Defaults to `false`.
56
60
  *
57
61
  * `StreamViewType` values:
58
62
  * * `KEYS_ONLY` - only the key attributes of the modified item are written to the DynamoDB Stream.
package/Readable.js CHANGED
@@ -35,8 +35,12 @@ const Readable = {}
35
35
  Readable.Buffer = function Readable(readable) {
36
36
  return new Promise((resolve, reject) => {
37
37
  const chunks = []
38
- readable.on('data', chunk => {
39
- chunks.push(chunk)
38
+ readable.on('data', (chunk, encoding) => {
39
+ if (typeof chunk == 'string') {
40
+ chunks.push(Buffer.from(chunk, encoding))
41
+ } else {
42
+ chunks.push(chunk)
43
+ }
40
44
  })
41
45
  readable.on('end', () => {
42
46
  resolve(Buffer.concat(chunks))
package/S3Bucket.js CHANGED
@@ -870,6 +870,9 @@ class S3Bucket {
870
870
  headers['Content-Length'] = options.ContentLength
871
871
  }
872
872
 
873
+ if (body.readable) {
874
+ body = await Readable.Buffer(body)
875
+ }
873
876
  if (options.ContentMD5) {
874
877
  headers['Content-MD5'] = options.ContentMD5
875
878
  } else {
@@ -8,7 +8,7 @@
8
8
  */
9
9
  function handleDynamoDBStreamGetRecordsError(error) {
10
10
  if (error.message.includes('Shard iterator has expired')) {
11
- return []
11
+ return { Records: [] }
12
12
  }
13
13
  throw error
14
14
  }
@@ -4,7 +4,7 @@ const handleDynamoDBStreamGetRecordsError =
4
4
 
5
5
  const test = new Test('handleDynamoDBStreamGetRecordsError', handleDynamoDBStreamGetRecordsError)
6
6
 
7
- test.case(new Error('Shard iterator has expired'), [])
7
+ test.case(new Error('Shard iterator has expired'), { Records: [] })
8
8
  test.throws(new Error('other'), new Error('other'))
9
9
 
10
10
  if (process.argv[1] == __filename) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "presidium",
3
- "version": "1.4.8",
3
+ "version": "1.4.10",
4
4
  "description": "A library for creating web services",
5
5
  "author": "Richard Tong",
6
6
  "license": "MIT",