Skip to content

Commit 8e61c8a

Browse files
chore(deps): use @google-cloud/promisify (#172)
1 parent 60e2cc8 commit 8e61c8a

38 files changed

+115
-88
lines changed

packages/google-cloud-compute/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@
6060
"system-test": "mocha system-test/*.js --timeout 600000",
6161
"test-no-cover": "mocha test/*.js",
6262
"test": "npm run cover",
63-
"fix": "eslint --fix '**/*.js' && npm run prettier"
63+
"fix": "eslint --fix '**/*.js'"
6464
},
6565
"dependencies": {
6666
"@google-cloud/common": "^0.17.0",
67+
"@google-cloud/promisify": "^0.3.1",
6768
"arrify": "^1.0.1",
6869
"async": "^2.6.1",
6970
"create-error-class": "^3.0.2",

packages/google-cloud-compute/src/address.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
'use strict';
1818

1919
const common = require('@google-cloud/common');
20+
const {promisifyAll} = require('@google-cloud/promisify');
2021
const util = require('util');
2122

2223
/**
@@ -242,6 +243,6 @@ Address.prototype.delete = function(callback) {
242243
* All async methods (except for streams) will return a Promise in the event
243244
* that a callback is omitted.
244245
*/
245-
common.util.promisifyAll(Address);
246+
promisifyAll(Address);
246247

247248
module.exports = Address;

packages/google-cloud-compute/src/autoscaler.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
'use strict';
1818

1919
const common = require('@google-cloud/common');
20+
const {promisifyAll} = require('@google-cloud/promisify');
2021
const util = require('util');
2122

2223
/*! Developer Documentation
@@ -319,6 +320,6 @@ Autoscaler.prototype.setMetadata = function(metadata, callback) {
319320
* All async methods (except for streams) will return a Promise in the event
320321
* that a callback is omitted.
321322
*/
322-
common.util.promisifyAll(Autoscaler);
323+
promisifyAll(Autoscaler);
323324

324325
module.exports = Autoscaler;

packages/google-cloud-compute/src/disk.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const extend = require('extend');
2121
const format = require('string-format-obj');
2222
const is = require('is');
2323
const util = require('util');
24+
const {promisifyAll} = require('@google-cloud/promisify');
2425

2526
const Snapshot = require('./snapshot.js');
2627

@@ -365,7 +366,7 @@ Disk.prototype.snapshot = function(name) {
365366
* All async methods (except for streams) will return a Promise in the event
366367
* that a callback is omitted.
367368
*/
368-
common.util.promisifyAll(Disk, {
369+
promisifyAll(Disk, {
369370
exclude: ['snapshot'],
370371
});
371372

packages/google-cloud-compute/src/firewall.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
const common = require('@google-cloud/common');
2020
const util = require('util');
21+
const {promisifyAll} = require('@google-cloud/promisify');
2122

2223
/**
2324
* A Firewall object allows you to interact with a Google Compute Engine
@@ -308,7 +309,7 @@ Firewall.prototype.setMetadata = function(metadata, callback) {
308309
* All async methods (except for streams) will return a Promise in the event
309310
* that a callback is omitted.
310311
*/
311-
common.util.promisifyAll(Firewall);
312+
promisifyAll(Firewall);
312313

313314
/**
314315
* Reference to the {@link Firewall} class.

packages/google-cloud-compute/src/health-check.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const common = require('@google-cloud/common');
2020
const extend = require('extend');
2121
const is = require('is');
2222
const util = require('util');
23+
const {promisifyAll} = require('@google-cloud/promisify');
2324

2425
/**
2526
* Health checks ensure that Compute Engine forwards new connections only to
@@ -310,7 +311,7 @@ HealthCheck.prototype.setMetadata = function(metadata, callback) {
310311
* All async methods (except for streams) will return a Promise in the event
311312
* that a callback is omitted.
312313
*/
313-
common.util.promisifyAll(HealthCheck);
314+
promisifyAll(HealthCheck);
314315

315316
/**
316317
* Reference to the {@link HealthCheck} class.

packages/google-cloud-compute/src/image.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
const common = require('@google-cloud/common');
2020
const util = require('util');
21+
const {promisifyAll} = require('@google-cloud/promisify');
2122

2223
/**
2324
* An Image object allows you to interact with a Google Compute Engine image.
@@ -216,7 +217,7 @@ Image.prototype.delete = function(callback) {
216217
* All async methods (except for streams) will return a Promise in the event
217218
* that a callback is omitted.
218219
*/
219-
common.util.promisifyAll(Image);
220+
promisifyAll(Image);
220221

221222
/**
222223
* Reference to the {@link Image} class.

packages/google-cloud-compute/src/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const extend = require('extend');
2222
const format = require('string-format-obj');
2323
const is = require('is');
2424
const util = require('util');
25+
const {promisifyAll} = require('@google-cloud/promisify');
2526

2627
const Firewall = require('./firewall.js');
2728
const HealthCheck = require('./health-check.js');
@@ -3059,7 +3060,7 @@ common.paginator.extend(Compute, [
30593060
* All async methods (except for streams) will return a Promise in the event
30603061
* that a callback is omitted.
30613062
*/
3062-
common.util.promisifyAll(Compute, {
3063+
promisifyAll(Compute, {
30633064
exclude: [
30643065
'address',
30653066
'autoscaler',

packages/google-cloud-compute/src/instance-group.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const common = require('@google-cloud/common');
2121
const extend = require('extend');
2222
const is = require('is');
2323
const util = require('util');
24+
const {promisifyAll} = require('@google-cloud/promisify');
2425

2526
/**
2627
* You can create and manage groups of virtual machine instances so that you
@@ -608,6 +609,6 @@ common.paginator.extend(InstanceGroup, ['getVMs']);
608609
* All async methods (except for streams) will return a Promise in the event
609610
* that a callback is omitted.
610611
*/
611-
common.util.promisifyAll(InstanceGroup);
612+
promisifyAll(InstanceGroup);
612613

613614
module.exports = InstanceGroup;

packages/google-cloud-compute/src/network.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const extend = require('extend');
2121
const format = require('string-format-obj');
2222
const is = require('is');
2323
const util = require('util');
24+
const {promisifyAll} = require('@google-cloud/promisify');
2425

2526
/**
2627
* A Network object allows you to interact with a Google Compute Engine network.
@@ -628,7 +629,7 @@ Network.prototype.getFirewallsStream = function(options) {
628629
* All async methods (except for streams) will return a Promise in the event
629630
* that a callback is omitted.
630631
*/
631-
common.util.promisifyAll(Network, {
632+
promisifyAll(Network, {
632633
exclude: ['firewall'],
633634
});
634635

packages/google-cloud-compute/src/operation.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
const common = require('@google-cloud/common');
2020
const util = require('util');
21+
const {promisifyAll} = require('@google-cloud/promisify');
2122

2223
/**
2324
* An Operation object allows you to interact with a Google Compute Engine
@@ -288,7 +289,7 @@ Operation.prototype.poll_ = function(callback) {
288289
* All async methods (except for streams) will return a Promise in the event
289290
* that a callback is omitted.
290291
*/
291-
common.util.promisifyAll(Operation);
292+
promisifyAll(Operation);
292293

293294
/**
294295
* Reference to the {@link Operation} class.

packages/google-cloud-compute/src/project.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
const common = require('@google-cloud/common');
2020
const util = require('util');
21+
const {promisifyAll} = require('@google-cloud/promisify');
2122

2223
/**
2324
* A Project object allows you to interact with your Google Compute Engine
@@ -112,7 +113,7 @@ util.inherits(Project, common.ServiceObject);
112113
* All async methods (except for streams) will return a Promise in the event
113114
* that a callback is omitted.
114115
*/
115-
common.util.promisifyAll(Project);
116+
promisifyAll(Project);
116117

117118
/**
118119
* Reference to the {@link Project} class.

packages/google-cloud-compute/src/region.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const common = require('@google-cloud/common');
2020
const extend = require('extend');
2121
const is = require('is');
2222
const util = require('util');
23+
const {promisifyAll} = require('@google-cloud/promisify');
2324

2425
const Address = require('./address.js');
2526
const Network = require('./network.js');
@@ -996,7 +997,7 @@ common.paginator.extend(Region, [
996997
* All async methods (except for streams) will return a Promise in the event
997998
* that a callback is omitted.
998999
*/
999-
common.util.promisifyAll(Region, {
1000+
promisifyAll(Region, {
10001001
exclude: ['address', 'operation', 'rule', 'subnetwork'],
10011002
});
10021003

packages/google-cloud-compute/src/rule.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
const common = require('@google-cloud/common');
2020
const util = require('util');
21+
const {promisifyAll} = require('@google-cloud/promisify');
2122

2223
/**
2324
* Forwarding rules work in conjunction with target pools and target instances
@@ -314,7 +315,7 @@ Rule.prototype.setTarget = function(target, callback) {
314315
* All async methods (except for streams) will return a Promise in the event
315316
* that a callback is omitted.
316317
*/
317-
common.util.promisifyAll(Rule);
318+
promisifyAll(Rule);
318319

319320
/**
320321
* Reference to the {@link Rule} class.

packages/google-cloud-compute/src/service.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const common = require('@google-cloud/common');
2121
const format = require('string-format-obj');
2222
const is = require('is');
2323
const util = require('util');
24+
const {promisifyAll} = require('@google-cloud/promisify');
2425

2526
/**
2627
* An HTTP(S) load balancing backend service is a centralized service for
@@ -389,7 +390,7 @@ Service.prototype.setMetadata = function(metadata, callback) {
389390
* All async methods (except for streams) will return a Promise in the event
390391
* that a callback is omitted.
391392
*/
392-
common.util.promisifyAll(Service);
393+
promisifyAll(Service);
393394

394395
/**
395396
* Reference to the {@link Service} class.

packages/google-cloud-compute/src/snapshot.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
const common = require('@google-cloud/common');
2020
const util = require('util');
21+
const {promisifyAll} = require('@google-cloud/promisify');
2122

2223
/**
2324
* A Snapshot object allows you to interact with a Google Compute Engine
@@ -243,7 +244,7 @@ Snapshot.prototype.delete = function(callback) {
243244
* All async methods (except for streams) will return a Promise in the event
244245
* that a callback is omitted.
245246
*/
246-
common.util.promisifyAll(Snapshot);
247+
promisifyAll(Snapshot);
247248

248249
/**
249250
* Reference to the {@link Snapshot} class.

packages/google-cloud-compute/src/subnetwork.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
const common = require('@google-cloud/common');
2020
const util = require('util');
21+
const {promisifyAll} = require('@google-cloud/promisify');
2122

2223
/**
2324
* An Subnetwork object allows you to interact with a Google Compute Engine
@@ -247,6 +248,6 @@ Subnetwork.prototype.delete = function(callback) {
247248
* All async methods (except for streams) will return a Promise in the event
248249
* that a callback is omitted.
249250
*/
250-
common.util.promisifyAll(Subnetwork);
251+
promisifyAll(Subnetwork);
251252

252253
module.exports = Subnetwork;

packages/google-cloud-compute/src/vm.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const extend = require('extend');
2222
const format = require('string-format-obj');
2323
const is = require('is');
2424
const util = require('util');
25+
const {promisifyAll} = require('@google-cloud/promisify');
2526

2627
const Disk = require('./disk.js');
2728

@@ -1116,6 +1117,6 @@ VM.prototype.request = function(reqOpts, callback) {
11161117
* All async methods (except for streams) will return a Promise in the event
11171118
* that a callback is omitted.
11181119
*/
1119-
common.util.promisifyAll(VM);
1120+
promisifyAll(VM);
11201121

11211122
module.exports = VM;

packages/google-cloud-compute/src/zone.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const format = require('string-format-obj');
2424
const gceImages = require('gce-images');
2525
const is = require('is');
2626
const util = require('util');
27+
const {promisifyAll} = require('@google-cloud/promisify');
2728

2829
const Autoscaler = require('./autoscaler.js');
2930
const Disk = require('./disk.js');
@@ -1660,7 +1661,7 @@ common.paginator.extend(Zone, [
16601661
* All async methods (except for streams) will return a Promise in the event
16611662
* that a callback is omitted.
16621663
*/
1663-
common.util.promisifyAll(Zone, {
1664+
promisifyAll(Zone, {
16641665
exclude: [
16651666
'autoscaler',
16661667
'disk',

packages/google-cloud-compute/test/address.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ const assert = require('assert');
2020
const extend = require('extend');
2121
const nodeutil = require('util');
2222
const proxyquire = require('proxyquire');
23-
const ServiceObject = require('@google-cloud/common').ServiceObject;
24-
const util = require('@google-cloud/common').util;
23+
const {ServiceObject, util} = require('@google-cloud/common');
24+
const promisify = require('@google-cloud/promisify');
2525

2626
let promisified = false;
27-
const fakeUtil = extend({}, util, {
27+
const fakePromisify = extend({}, promisify, {
2828
promisifyAll: function(Class) {
2929
if (Class.name === 'Address') {
3030
promisified = true;
@@ -52,8 +52,8 @@ describe('Address', function() {
5252
Address = proxyquire('../src/address.js', {
5353
'@google-cloud/common': {
5454
ServiceObject: FakeServiceObject,
55-
util: fakeUtil,
5655
},
56+
'@google-cloud/promisify': fakePromisify,
5757
});
5858
});
5959

packages/google-cloud-compute/test/autoscaler.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ const assert = require('assert');
2020
const extend = require('extend');
2121
const nodeutil = require('util');
2222
const proxyquire = require('proxyquire');
23-
const ServiceObject = require('@google-cloud/common').ServiceObject;
24-
const util = require('@google-cloud/common').util;
23+
const {ServiceObject, util} = require('@google-cloud/common');
24+
const promisify = require('@google-cloud/promisify');
2525

2626
let promisified = false;
27-
const fakeUtil = extend({}, util, {
27+
const fakePromisify = extend({}, promisify, {
2828
promisifyAll: function(Class) {
2929
if (Class.name === 'Autoscaler') {
3030
promisified = true;
@@ -56,8 +56,8 @@ describe('Autoscaler', function() {
5656
Autoscaler = proxyquire('../src/autoscaler.js', {
5757
'@google-cloud/common': {
5858
ServiceObject: FakeServiceObject,
59-
util: fakeUtil,
6059
},
60+
'@google-cloud/promisify': fakePromisify,
6161
});
6262
});
6363

packages/google-cloud-compute/test/disk.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ const extend = require('extend');
2121
const format = require('string-format-obj');
2222
const nodeutil = require('util');
2323
const proxyquire = require('proxyquire');
24-
const ServiceObject = require('@google-cloud/common').ServiceObject;
25-
const util = require('@google-cloud/common').util;
24+
const {ServiceObject, util} = require('@google-cloud/common');
25+
const promisify = require('@google-cloud/promisify');
2626

2727
let promisified = false;
28-
const fakeUtil = extend({}, util, {
28+
const fakePromisify = extend({}, promisify, {
2929
promisifyAll: function(Class, options) {
3030
if (Class.name !== 'Disk') {
3131
return;
@@ -72,8 +72,8 @@ describe('Disk', function() {
7272
Disk = proxyquire('../src/disk.js', {
7373
'@google-cloud/common': {
7474
ServiceObject: FakeServiceObject,
75-
util: fakeUtil,
7675
},
76+
'@google-cloud/promisify': fakePromisify,
7777
'./snapshot.js': FakeSnapshot,
7878
});
7979
});

0 commit comments

Comments
 (0)