Skip to content

Commit a9cad8d

Browse files
gcf-owl-bot[bot]sofisl
authored andcommitted
fix: use require() to load JSON protos (#453)
The library is regenerated with gapic-generator-typescript v1.3.1. Committer: @alexander-fenster PiperOrigin-RevId: 372468161 Source-Link: googleapis/googleapis@75880c3 Source-Link: googleapis/googleapis-gen@77b1804
1 parent 7db0495 commit a9cad8d

1 file changed

Lines changed: 2 additions & 16 deletions

File tree

packages/google-cloud-bigquery-datatransfer/src/v1/data_transfer_service_client.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import * as path from 'path';
3131
import {Transform} from 'stream';
3232
import {RequestType} from 'google-gax/build/src/apitypes';
3333
import * as protos from '../../protos/protos';
34+
import jsonProtos = require('../../protos/protos.json');
3435
/**
3536
* Client JSON configuration object, loaded from
3637
* `src/v1/data_transfer_service_client_config.json`.
@@ -148,22 +149,7 @@ export class DataTransferServiceClient {
148149
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
149150
}
150151
// Load the applicable protos.
151-
// For Node.js, pass the path to JSON proto file.
152-
// For browsers, pass the JSON content.
153-
154-
const nodejsProtoPath = path.join(
155-
__dirname,
156-
'..',
157-
'..',
158-
'protos',
159-
'protos.json'
160-
);
161-
this._protos = this._gaxGrpc.loadProto(
162-
opts.fallback
163-
? // eslint-disable-next-line @typescript-eslint/no-var-requires
164-
require('../../protos/protos.json')
165-
: nodejsProtoPath
166-
);
152+
this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
167153

168154
// This API contains "path templates"; forward-slash-separated
169155
// identifiers to uniquely identify resources within the API.

0 commit comments

Comments
 (0)