@@ -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/artifact_registry_client_config.json`.
@@ -159,22 +160,7 @@ export class ArtifactRegistryClient {
159
160
clientHeader . push ( `${ opts . libName } /${ opts . libVersion } ` ) ;
160
161
}
161
162
// Load the applicable protos.
162
- // For Node.js, pass the path to JSON proto file.
163
- // For browsers, pass the JSON content.
164
-
165
- const nodejsProtoPath = path . join (
166
- __dirname ,
167
- '..' ,
168
- '..' ,
169
- 'protos' ,
170
- 'protos.json'
171
- ) ;
172
- this . _protos = this . _gaxGrpc . loadProto (
173
- opts . fallback
174
- ? // eslint-disable-next-line @typescript-eslint/no-var-requires
175
- require ( '../../protos/protos.json' )
176
- : nodejsProtoPath
177
- ) ;
163
+ this . _protos = this . _gaxGrpc . loadProtoJSON ( jsonProtos ) ;
178
164
179
165
// This API contains "path templates"; forward-slash-separated
180
166
// identifiers to uniquely identify resources within the API.
@@ -219,15 +205,11 @@ export class ArtifactRegistryClient {
219
205
) ,
220
206
} ;
221
207
208
+ const protoFilesRoot = this . _gaxModule . protobuf . Root . fromJSON ( jsonProtos ) ;
209
+
222
210
// This API contains "long-running operations", which return a
223
211
// an Operation object that allows for tracking of the operation,
224
212
// rather than holding a request open.
225
- const protoFilesRoot = opts . fallback
226
- ? this . _gaxModule . protobuf . Root . fromJSON (
227
- // eslint-disable-next-line @typescript-eslint/no-var-requires
228
- require ( '../../protos/protos.json' )
229
- )
230
- : this . _gaxModule . protobuf . loadSync ( nodejsProtoPath ) ;
231
213
232
214
this . operationsClient = this . _gaxModule
233
215
. lro ( {
0 commit comments