@@ -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/v1beta2/cloud_memcache_client_config.json`.
@@ -161,22 +162,7 @@ export class CloudMemcacheClient {
161
162
clientHeader . push ( `${ opts . libName } /${ opts . libVersion } ` ) ;
162
163
}
163
164
// Load the applicable protos.
164
- // For Node.js, pass the path to JSON proto file.
165
- // For browsers, pass the JSON content.
166
-
167
- const nodejsProtoPath = path . join (
168
- __dirname ,
169
- '..' ,
170
- '..' ,
171
- 'protos' ,
172
- 'protos.json'
173
- ) ;
174
- this . _protos = this . _gaxGrpc . loadProto (
175
- opts . fallback
176
- ? // eslint-disable-next-line @typescript-eslint/no-var-requires
177
- require ( '../../protos/protos.json' )
178
- : nodejsProtoPath
179
- ) ;
165
+ this . _protos = this . _gaxGrpc . loadProtoJSON ( jsonProtos ) ;
180
166
181
167
// This API contains "path templates"; forward-slash-separated
182
168
// identifiers to uniquely identify resources within the API.
@@ -201,15 +187,11 @@ export class CloudMemcacheClient {
201
187
) ,
202
188
} ;
203
189
190
+ const protoFilesRoot = this . _gaxModule . protobuf . Root . fromJSON ( jsonProtos ) ;
191
+
204
192
// This API contains "long-running operations", which return a
205
193
// an Operation object that allows for tracking of the operation,
206
194
// rather than holding a request open.
207
- const protoFilesRoot = opts . fallback
208
- ? this . _gaxModule . protobuf . Root . fromJSON (
209
- // eslint-disable-next-line @typescript-eslint/no-var-requires
210
- require ( '../../protos/protos.json' )
211
- )
212
- : this . _gaxModule . protobuf . loadSync ( nodejsProtoPath ) ;
213
195
214
196
this . operationsClient = this . _gaxModule
215
197
. lro ( {
0 commit comments