Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
chore(deps): use @google-cloud/promisify (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Oct 3, 2018
1 parent 9a67aa3 commit 586c657
Show file tree
Hide file tree
Showing 38 changed files with 115 additions and 88 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@
"system-test": "mocha system-test/*.js --timeout 600000",
"test-no-cover": "mocha test/*.js",
"test": "npm run cover",
"fix": "eslint --fix '**/*.js' && npm run prettier"
"fix": "eslint --fix '**/*.js'"
},
"dependencies": {
"@google-cloud/common": "^0.17.0",
"@google-cloud/promisify": "^0.3.1",
"arrify": "^1.0.1",
"async": "^2.6.1",
"create-error-class": "^3.0.2",
Expand Down
3 changes: 2 additions & 1 deletion src/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'use strict';

const common = require('@google-cloud/common');
const {promisifyAll} = require('@google-cloud/promisify');
const util = require('util');

/**
Expand Down Expand Up @@ -242,6 +243,6 @@ Address.prototype.delete = function(callback) {
* All async methods (except for streams) will return a Promise in the event
* that a callback is omitted.
*/
common.util.promisifyAll(Address);
promisifyAll(Address);

module.exports = Address;
3 changes: 2 additions & 1 deletion src/autoscaler.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'use strict';

const common = require('@google-cloud/common');
const {promisifyAll} = require('@google-cloud/promisify');
const util = require('util');

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

module.exports = Autoscaler;
3 changes: 2 additions & 1 deletion src/disk.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const extend = require('extend');
const format = require('string-format-obj');
const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

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

Expand Down
3 changes: 2 additions & 1 deletion src/firewall.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

/**
* Reference to the {@link Firewall} class.
Expand Down
3 changes: 2 additions & 1 deletion src/health-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const common = require('@google-cloud/common');
const extend = require('extend');
const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

/**
* Reference to the {@link HealthCheck} class.
Expand Down
3 changes: 2 additions & 1 deletion src/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

/**
* Reference to the {@link Image} class.
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const extend = require('extend');
const format = require('string-format-obj');
const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

const Firewall = require('./firewall.js');
const HealthCheck = require('./health-check.js');
Expand Down Expand Up @@ -3059,7 +3060,7 @@ common.paginator.extend(Compute, [
* All async methods (except for streams) will return a Promise in the event
* that a callback is omitted.
*/
common.util.promisifyAll(Compute, {
promisifyAll(Compute, {
exclude: [
'address',
'autoscaler',
Expand Down
3 changes: 2 additions & 1 deletion src/instance-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const common = require('@google-cloud/common');
const extend = require('extend');
const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

module.exports = InstanceGroup;
3 changes: 2 additions & 1 deletion src/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const extend = require('extend');
const format = require('string-format-obj');
const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

Expand Down
3 changes: 2 additions & 1 deletion src/operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

/**
* Reference to the {@link Operation} class.
Expand Down
3 changes: 2 additions & 1 deletion src/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

/**
* Reference to the {@link Project} class.
Expand Down
3 changes: 2 additions & 1 deletion src/region.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const common = require('@google-cloud/common');
const extend = require('extend');
const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

Expand Down
3 changes: 2 additions & 1 deletion src/rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

/**
* Reference to the {@link Rule} class.
Expand Down
3 changes: 2 additions & 1 deletion src/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const common = require('@google-cloud/common');
const format = require('string-format-obj');
const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

/**
* Reference to the {@link Service} class.
Expand Down
3 changes: 2 additions & 1 deletion src/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

/**
* Reference to the {@link Snapshot} class.
Expand Down
3 changes: 2 additions & 1 deletion src/subnetwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

const common = require('@google-cloud/common');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

module.exports = Subnetwork;
3 changes: 2 additions & 1 deletion src/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const extend = require('extend');
const format = require('string-format-obj');
const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

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

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

module.exports = VM;
3 changes: 2 additions & 1 deletion src/zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const format = require('string-format-obj');
const gceImages = require('gce-images');
const is = require('is');
const util = require('util');
const {promisifyAll} = require('@google-cloud/promisify');

const Autoscaler = require('./autoscaler.js');
const Disk = require('./disk.js');
Expand Down Expand Up @@ -1660,7 +1661,7 @@ common.paginator.extend(Zone, [
* All async methods (except for streams) will return a Promise in the event
* that a callback is omitted.
*/
common.util.promisifyAll(Zone, {
promisifyAll(Zone, {
exclude: [
'autoscaler',
'disk',
Expand Down
8 changes: 4 additions & 4 deletions test/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const assert = require('assert');
const extend = require('extend');
const nodeutil = require('util');
const proxyquire = require('proxyquire');
const ServiceObject = require('@google-cloud/common').ServiceObject;
const util = require('@google-cloud/common').util;
const {ServiceObject, util} = require('@google-cloud/common');
const promisify = require('@google-cloud/promisify');

let promisified = false;
const fakeUtil = extend({}, util, {
const fakePromisify = extend({}, promisify, {
promisifyAll: function(Class) {
if (Class.name === 'Address') {
promisified = true;
Expand Down Expand Up @@ -52,8 +52,8 @@ describe('Address', function() {
Address = proxyquire('../src/address.js', {
'@google-cloud/common': {
ServiceObject: FakeServiceObject,
util: fakeUtil,
},
'@google-cloud/promisify': fakePromisify,
});
});

Expand Down
8 changes: 4 additions & 4 deletions test/autoscaler.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const assert = require('assert');
const extend = require('extend');
const nodeutil = require('util');
const proxyquire = require('proxyquire');
const ServiceObject = require('@google-cloud/common').ServiceObject;
const util = require('@google-cloud/common').util;
const {ServiceObject, util} = require('@google-cloud/common');
const promisify = require('@google-cloud/promisify');

let promisified = false;
const fakeUtil = extend({}, util, {
const fakePromisify = extend({}, promisify, {
promisifyAll: function(Class) {
if (Class.name === 'Autoscaler') {
promisified = true;
Expand Down Expand Up @@ -56,8 +56,8 @@ describe('Autoscaler', function() {
Autoscaler = proxyquire('../src/autoscaler.js', {
'@google-cloud/common': {
ServiceObject: FakeServiceObject,
util: fakeUtil,
},
'@google-cloud/promisify': fakePromisify,
});
});

Expand Down
8 changes: 4 additions & 4 deletions test/disk.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ const extend = require('extend');
const format = require('string-format-obj');
const nodeutil = require('util');
const proxyquire = require('proxyquire');
const ServiceObject = require('@google-cloud/common').ServiceObject;
const util = require('@google-cloud/common').util;
const {ServiceObject, util} = require('@google-cloud/common');
const promisify = require('@google-cloud/promisify');

let promisified = false;
const fakeUtil = extend({}, util, {
const fakePromisify = extend({}, promisify, {
promisifyAll: function(Class, options) {
if (Class.name !== 'Disk') {
return;
Expand Down Expand Up @@ -72,8 +72,8 @@ describe('Disk', function() {
Disk = proxyquire('../src/disk.js', {
'@google-cloud/common': {
ServiceObject: FakeServiceObject,
util: fakeUtil,
},
'@google-cloud/promisify': fakePromisify,
'./snapshot.js': FakeSnapshot,
});
});
Expand Down
Loading

0 comments on commit 586c657

Please sign in to comment.