diff --git a/package.json b/package.json index 8a38ecab5..f6b9fece7 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "dependencies": { "@google-cloud/projectify": "^1.0.0", "@google-cloud/promisify": "^1.0.0", + "@grpc/grpc-js": "^0.4.0", "@types/duplexify": "^3.6.0", "@types/long": "^4.0.0", "arrify": "^2.0.0", diff --git a/src/index.ts b/src/index.ts index 8b618a08e..a15083338 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,7 +27,7 @@ import arrify = require('arrify'); import {GoogleAuth, GoogleAuthOptions} from 'google-auth-library'; import {GrpcClient} from 'google-gax'; -import {ChannelCredentials} from 'grpc'; +import {ChannelCredentials} from '@grpc/grpc-js'; import * as is from 'is'; import {entity} from './entity'; diff --git a/test/index.ts b/test/index.ts index afab2a323..1c96a061d 100644 --- a/test/index.ts +++ b/test/index.ts @@ -77,7 +77,7 @@ const fakeGoogleGax = { constructor(opts: gax.GrpcClientOptions) { // super constructor must be called first! super(opts); - this.grpc = { + this.grpc = ({ credentials: { createInsecure() { return (createInsecureOverride || (() => {})).apply( @@ -86,7 +86,7 @@ const fakeGoogleGax = { ); }, }, - } as gax.GrpcModule; + } as {}) as gax.GrpcModule; } }, }; diff --git a/test/request.ts b/test/request.ts index ee69e5c88..246c40921 100644 --- a/test/request.ts +++ b/test/request.ts @@ -18,7 +18,7 @@ import * as pjy from '@google-cloud/projectify'; import * as pfy from '@google-cloud/promisify'; import * as assert from 'assert'; import * as extend from 'extend'; -import {CallOptions} from 'grpc'; +import {CallOptions} from '@grpc/grpc-js'; import * as is from 'is'; import * as proxyquire from 'proxyquire'; import * as sinon from 'sinon'; @@ -1649,7 +1649,8 @@ describe('Request', () => { it('should send gaxOpts', done => { request.datastore.clients_ = new Map(); request.datastore.clients_.set(CONFIG.client, { - [CONFIG.method](_: object, gaxO: CallOptions) { + // tslint:disable-next-line no-any + [CONFIG.method](_: object, gaxO: any) { delete gaxO.headers; assert.deepStrictEqual(gaxO, CONFIG.gaxOpts); done(); @@ -1662,7 +1663,8 @@ describe('Request', () => { it('should send google-cloud-resource-prefix', done => { request.datastore.clients_ = new Map(); request.datastore.clients_.set(CONFIG.client, { - [CONFIG.method](_: object, gaxO: CallOptions) { + // tslint:disable-next-line no-any + [CONFIG.method](_: object, gaxO: any) { assert.deepStrictEqual(gaxO.headers, { 'google-cloud-resource-prefix': 'projects/' + PROJECT_ID, });