@@ -32,6 +32,7 @@ import * as path from 'path';
32
32
import { Transform } from 'stream' ;
33
33
import { RequestType } from 'google-gax/build/src/apitypes' ;
34
34
import * as protos from '../../protos/protos' ;
35
+ import jsonProtos = require( '../../protos/protos.json' ) ;
35
36
/**
36
37
* Client JSON configuration object, loaded from
37
38
* `src/v1alpha1/hub_service_client_config.json`.
@@ -150,22 +151,7 @@ export class HubServiceClient {
150
151
clientHeader . push ( `${ opts . libName } /${ opts . libVersion } ` ) ;
151
152
}
152
153
// Load the applicable protos.
153
- // For Node.js, pass the path to JSON proto file.
154
- // For browsers, pass the JSON content.
155
-
156
- const nodejsProtoPath = path . join (
157
- __dirname ,
158
- '..' ,
159
- '..' ,
160
- 'protos' ,
161
- 'protos.json'
162
- ) ;
163
- this . _protos = this . _gaxGrpc . loadProto (
164
- opts . fallback
165
- ? // eslint-disable-next-line @typescript-eslint/no-var-requires
166
- require ( '../../protos/protos.json' )
167
- : nodejsProtoPath
168
- ) ;
154
+ this . _protos = this . _gaxGrpc . loadProtoJSON ( jsonProtos ) ;
169
155
170
156
// This API contains "path templates"; forward-slash-separated
171
157
// identifiers to uniquely identify resources within the API.
@@ -207,15 +193,11 @@ export class HubServiceClient {
207
193
) ,
208
194
} ;
209
195
196
+ const protoFilesRoot = this . _gaxModule . protobuf . Root . fromJSON ( jsonProtos ) ;
197
+
210
198
// This API contains "long-running operations", which return a
211
199
// an Operation object that allows for tracking of the operation,
212
200
// rather than holding a request open.
213
- const protoFilesRoot = opts . fallback
214
- ? this . _gaxModule . protobuf . Root . fromJSON (
215
- // eslint-disable-next-line @typescript-eslint/no-var-requires
216
- require ( '../../protos/protos.json' )
217
- )
218
- : this . _gaxModule . protobuf . loadSync ( nodejsProtoPath ) ;
219
201
220
202
this . operationsClient = this . _gaxModule
221
203
. lro ( {
0 commit comments