forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(aws-custom-resource): switch off
installLatestAwsSdk
by default (…
…aws#23591) The `AwsCustomResource` reaches out to the internet to install the latest AWS SDK by default. This will make it fail if it is being bound to a VPC that doesn't have internet connectivity, or in regions/partitions that are not able to freely connect to `npmjs.com`. This was a poorly chosen default from the time we didn't know any better, but we do know right now. Switch the behavior off by default (under feature flag), and explicitly disable it for all `AwsCustomResource`s the L2 library uses. Lambda advertises 2.1055.0 of the SDK everywhere, and I checked to make sure that all APIs we use are part of that SDK version, so we don't need any newer version. That version is a year old (!) so this is not the end of the story, but it's at least an improvement over what we currently have. Fixes aws#23113. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
229 changed files
with
43,256 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...a10ec493a5725527d98b889a19ef0e98ae732d3812967d9bd31b3d1f062577b260945d9363c34c5c0ffa4a61d
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,34 @@ | ||
var defer = require('./defer.js'); | ||
|
||
// API | ||
module.exports = async; | ||
|
||
/** | ||
* Runs provided callback asynchronously | ||
* even if callback itself is not | ||
* | ||
* @param {function} callback - callback to invoke | ||
* @returns {function} - augmented callback | ||
*/ | ||
function async(callback) | ||
{ | ||
var isAsync = false; | ||
|
||
// check if async happened | ||
defer(function() { isAsync = true; }); | ||
|
||
return function async_callback(err, result) | ||
{ | ||
if (isAsync) | ||
{ | ||
callback(err, result); | ||
} | ||
else | ||
{ | ||
defer(function nextTick_callback() | ||
{ | ||
callback(err, result); | ||
}); | ||
} | ||
}; | ||
} |
138 changes: 138 additions & 0 deletions
138
...d0a559919f5ecdc0d4fb1060e75e9bd469f9c2ec29d9c479d9764af82ff04a779baa849feb75a0fb2b6cd81ea
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,138 @@ | ||
# combined-stream | ||
|
||
A stream that emits multiple other streams one after another. | ||
|
||
**NB** Currently `combined-stream` works with streams version 1 only. There is ongoing effort to switch this library to streams version 2. Any help is welcome. :) Meanwhile you can explore other libraries that provide streams2 support with more or less compatibility with `combined-stream`. | ||
|
||
- [combined-stream2](https://www.npmjs.com/package/combined-stream2): A drop-in streams2-compatible replacement for the combined-stream module. | ||
|
||
- [multistream](https://www.npmjs.com/package/multistream): A stream that emits multiple other streams one after another. | ||
|
||
## Installation | ||
|
||
``` bash | ||
npm install combined-stream | ||
``` | ||
|
||
## Usage | ||
|
||
Here is a simple example that shows how you can use combined-stream to combine | ||
two files into one: | ||
|
||
``` javascript | ||
var CombinedStream = require('combined-stream'); | ||
var fs = require('fs'); | ||
|
||
var combinedStream = CombinedStream.create(); | ||
combinedStream.append(fs.createReadStream('file1.txt')); | ||
combinedStream.append(fs.createReadStream('file2.txt')); | ||
|
||
combinedStream.pipe(fs.createWriteStream('combined.txt')); | ||
``` | ||
|
||
While the example above works great, it will pause all source streams until | ||
they are needed. If you don't want that to happen, you can set `pauseStreams` | ||
to `false`: | ||
|
||
``` javascript | ||
var CombinedStream = require('combined-stream'); | ||
var fs = require('fs'); | ||
|
||
var combinedStream = CombinedStream.create({pauseStreams: false}); | ||
combinedStream.append(fs.createReadStream('file1.txt')); | ||
combinedStream.append(fs.createReadStream('file2.txt')); | ||
|
||
combinedStream.pipe(fs.createWriteStream('combined.txt')); | ||
``` | ||
|
||
However, what if you don't have all the source streams yet, or you don't want | ||
to allocate the resources (file descriptors, memory, etc.) for them right away? | ||
Well, in that case you can simply provide a callback that supplies the stream | ||
by calling a `next()` function: | ||
|
||
``` javascript | ||
var CombinedStream = require('combined-stream'); | ||
var fs = require('fs'); | ||
|
||
var combinedStream = CombinedStream.create(); | ||
combinedStream.append(function(next) { | ||
next(fs.createReadStream('file1.txt')); | ||
}); | ||
combinedStream.append(function(next) { | ||
next(fs.createReadStream('file2.txt')); | ||
}); | ||
|
||
combinedStream.pipe(fs.createWriteStream('combined.txt')); | ||
``` | ||
|
||
## API | ||
|
||
### CombinedStream.create([options]) | ||
|
||
Returns a new combined stream object. Available options are: | ||
|
||
* `maxDataSize` | ||
* `pauseStreams` | ||
|
||
The effect of those options is described below. | ||
|
||
### combinedStream.pauseStreams = `true` | ||
|
||
Whether to apply back pressure to the underlaying streams. If set to `false`, | ||
the underlaying streams will never be paused. If set to `true`, the | ||
underlaying streams will be paused right after being appended, as well as when | ||
`delayedStream.pipe()` wants to throttle. | ||
|
||
### combinedStream.maxDataSize = `2 * 1024 * 1024` | ||
|
||
The maximum amount of bytes (or characters) to buffer for all source streams. | ||
If this value is exceeded, `combinedStream` emits an `'error'` event. | ||
|
||
### combinedStream.dataSize = `0` | ||
|
||
The amount of bytes (or characters) currently buffered by `combinedStream`. | ||
|
||
### combinedStream.append(stream) | ||
|
||
Appends the given `stream` to the combinedStream object. If `pauseStreams` is | ||
set to `true, this stream will also be paused right away. | ||
|
||
`streams` can also be a function that takes one parameter called `next`. `next` | ||
is a function that must be invoked in order to provide the `next` stream, see | ||
example above. | ||
|
||
Regardless of how the `stream` is appended, combined-stream always attaches an | ||
`'error'` listener to it, so you don't have to do that manually. | ||
|
||
Special case: `stream` can also be a String or Buffer. | ||
|
||
### combinedStream.write(data) | ||
|
||
You should not call this, `combinedStream` takes care of piping the appended | ||
streams into itself for you. | ||
|
||
### combinedStream.resume() | ||
|
||
Causes `combinedStream` to start drain the streams it manages. The function is | ||
idempotent, and also emits a `'resume'` event each time which usually goes to | ||
the stream that is currently being drained. | ||
|
||
### combinedStream.pause(); | ||
|
||
If `combinedStream.pauseStreams` is set to `false`, this does nothing. | ||
Otherwise a `'pause'` event is emitted, this goes to the stream that is | ||
currently being drained, so you can use it to apply back pressure. | ||
|
||
### combinedStream.end(); | ||
|
||
Sets `combinedStream.writable` to false, emits an `'end'` event, and removes | ||
all streams from the queue. | ||
|
||
### combinedStream.destroy(); | ||
|
||
Same as `combinedStream.end()`, except it emits a `'close'` event instead of | ||
`'end'`. | ||
|
||
## License | ||
|
||
combined-stream is licensed under the MIT license. |
29 changes: 29 additions & 0 deletions
29
...9b1dab4929c1730b220ba423cc3288cbcfbc2d5883b74b757eef67861f90cb64e27a91a2bf650fa72c42b70ef
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,29 @@ | ||
var serialOrdered = require('../serialOrdered.js'); | ||
|
||
// API | ||
module.exports = ReadableSerialOrdered; | ||
// expose sort helpers | ||
module.exports.ascending = serialOrdered.ascending; | ||
module.exports.descending = serialOrdered.descending; | ||
|
||
/** | ||
* Streaming wrapper to `asynckit.serialOrdered` | ||
* | ||
* @param {array|object} list - array or object (named list) to iterate over | ||
* @param {function} iterator - iterator to run | ||
* @param {function} sortMethod - custom sort function | ||
* @param {function} callback - invoked when all elements processed | ||
* @returns {stream.Readable#} | ||
*/ | ||
function ReadableSerialOrdered(list, iterator, sortMethod, callback) | ||
{ | ||
if (!(this instanceof ReadableSerialOrdered)) | ||
{ | ||
return new ReadableSerialOrdered(list, iterator, sortMethod, callback); | ||
} | ||
|
||
// turn on object mode | ||
ReadableSerialOrdered.super_.call(this, {objectMode: true}); | ||
|
||
this._start(serialOrdered, list, iterator, sortMethod, callback); | ||
} |
3 changes: 3 additions & 0 deletions
3
...cf265b4f59797a021ce3be1e84ef647a9a3bda2745149b06d135a704ff3642158953ad207b33ec869601e6df4
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,3 @@ | ||
module.exports = { | ||
"version": "0.27.2" | ||
}; |
Oops, something went wrong.