cfn-stack-event-stream
Advanced tools
Comparing version 0.0.2 to 0.0.3
19
index.js
@@ -7,3 +7,2 @@ var Readable = require('stream').Readable; | ||
var stream = new Readable({objectMode: true}), | ||
since = options.since || new Date(), | ||
pollInterval = options.pollInterval || 1000, | ||
@@ -16,2 +15,6 @@ describing = false, | ||
if (options.lastEventId) { | ||
seen[options.lastEventId] = true; | ||
} | ||
stream._read = function() { | ||
@@ -33,5 +36,5 @@ if (describing || complete) return; | ||
// Assuming StackEvents are in strictly reverse chronological order. | ||
// If we get to what we've seen already, or to old events, we don't | ||
// need to go on to the next page. | ||
if (event.Timestamp < since || seen[event.EventId]) | ||
// If we get to what we've seen already we don't need to go on to the | ||
// next page. | ||
if (seen[event.EventId]) | ||
break; | ||
@@ -55,2 +58,6 @@ | ||
} | ||
}).on('retry', function(res) { | ||
// Force a minimum 5s retry delay. | ||
res.error.retryDelay = Math.max(5000, res.error.retryDelay||5000); | ||
stream.emit('retry', res.error); | ||
}); | ||
@@ -72,2 +79,6 @@ } | ||
} | ||
}).on('retry', function(res) { | ||
// Force a minimum 5s retry delay. | ||
res.error.retryDelay = Math.max(5000, res.error.retryDelay||5000); | ||
stream.emit('retry', res.error); | ||
}); | ||
@@ -74,0 +85,0 @@ } |
{ | ||
"name": "cfn-stack-event-stream", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A readable stream of CloudFormation stack events", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "tap test.js" | ||
"test": "tape test/*.test.js" | ||
}, | ||
@@ -12,7 +12,7 @@ "author": "John Firebaugh <john@mapbox.com>", | ||
"dependencies": { | ||
"aws-sdk": "^2.0.0-rc13" | ||
"aws-sdk": "^2.2.0" | ||
}, | ||
"devDependencies": { | ||
"tap": "^0.4.8" | ||
"tape": "~4.4.0" | ||
} | ||
} |
@@ -28,1 +28,19 @@ A readable stream of CloudFormation stack events. | ||
``` | ||
## API | ||
### `EventStream(cfn, stackName, options)` | ||
Returns an object-mode [readable stream](http://nodejs.org/api/stream.html#stream_class_stream_readable) | ||
which emits `StackEvent` objects as returned by [`describeStackEvents`](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudFormation.html#describeStackEvents-property) | ||
Required parameters: | ||
* `cfn`: An [`AWS::CloudFormation`](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudFormation.html) instance. | ||
* `stackName`: The name or ARN of the stack. Note that if you are reading events for a stack that is deleted or in the | ||
process of being deleted, you need to pass the full ARN rather than the stackName. | ||
Options: | ||
* `lastEventId`: The `EventId` of a `StackEvent`. StackEvents emitted by the resulting stream | ||
are guaranteed not to include this event or any preceding events. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9370
5
202
46
2
Updatedaws-sdk@^2.2.0