Skip to content

Commit 56e2534

Browse files
fix(deps): drop dependency on through2 (#388)
1 parent 5421d08 commit 56e2534

4 files changed

Lines changed: 23 additions & 20 deletions

File tree

packages/google-cloud-dialogflow/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
"nyc": "^14.0.0",
6161
"power-assert": "^1.4.4",
6262
"prettier": "^1.7.4",
63-
"through2": "^3.0.0",
6463
"linkinator": "^1.5.0"
6564
}
6665
}

packages/google-cloud-dialogflow/samples/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@
99
"resources"
1010
],
1111
"engines": {
12-
"node": ">=8.0.0"
12+
"node": ">=10.0.0"
1313
},
1414
"scripts": {
1515
"test": "mocha system-test --timeout=600000"
1616
},
1717
"dependencies": {
1818
"dialogflow": "^0.10.2",
1919
"pb-util": "^0.1.0",
20-
"pump": "^3.0.0",
21-
"through2": "^3.0.0",
2220
"uuid": "^3.3.2",
2321
"yargs": "^13.0.0"
2422
},

packages/google-cloud-dialogflow/test/gapic-v2.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
'use strict';
1616

1717
const assert = require('assert');
18-
const through2 = require('through2');
18+
const {PassThrough} = require('stream');
1919

2020
const dialogflowModule = require('../src');
2121

@@ -2818,13 +2818,16 @@ function mockSimpleGrpcMethod(expectedRequest, response, error) {
28182818

28192819
function mockBidiStreamingGrpcMethod(expectedRequest, response, error) {
28202820
return () => {
2821-
const mockStream = through2.obj((chunk, enc, callback) => {
2822-
assert.deepStrictEqual(chunk, expectedRequest);
2823-
if (error) {
2824-
callback(error);
2825-
} else {
2826-
callback(null, response);
2827-
}
2821+
const mockStream = new PassThrough({
2822+
objectMode: true,
2823+
transform: (chunk, enc, callback) => {
2824+
assert.deepStrictEqual(chunk, expectedRequest);
2825+
if (error) {
2826+
callback(error);
2827+
} else {
2828+
callback(null, response);
2829+
}
2830+
},
28282831
});
28292832
return mockStream;
28302833
};

packages/google-cloud-dialogflow/test/gapic-v2beta1.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
'use strict';
1616

1717
const assert = require('assert');
18-
const through2 = require('through2');
18+
const {PassThrough} = require('stream');
1919

2020
const dialogflowModule = require('../src');
2121

@@ -3697,13 +3697,16 @@ function mockSimpleGrpcMethod(expectedRequest, response, error) {
36973697

36983698
function mockBidiStreamingGrpcMethod(expectedRequest, response, error) {
36993699
return () => {
3700-
const mockStream = through2.obj((chunk, enc, callback) => {
3701-
assert.deepStrictEqual(chunk, expectedRequest);
3702-
if (error) {
3703-
callback(error);
3704-
} else {
3705-
callback(null, response);
3706-
}
3700+
const mockStream = new PassThrough({
3701+
objectMode: true,
3702+
transform: (chunk, enc, callback) => {
3703+
assert.deepStrictEqual(chunk, expectedRequest);
3704+
if (error) {
3705+
callback(error);
3706+
} else {
3707+
callback(null, response);
3708+
}
3709+
},
37073710
});
37083711
return mockStream;
37093712
};

0 commit comments

Comments
 (0)