Skip to content

Commit 4768032

Browse files
fix: use require() to load JSON protos (#291)
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 098e382 commit 4768032

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

packages/google-cloud-phishingprotection/src/v1beta1/phishing_protection_service_v1_beta1_client.ts

+2-16
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax';
2222
import * as path from 'path';
2323

2424
import * as protos from '../../protos/protos';
25+
import jsonProtos = require('../../protos/protos.json');
2526
/**
2627
* Client JSON configuration object, loaded from
2728
* `src/v1beta1/phishing_protection_service_v1_beta1_client_config.json`.
@@ -137,22 +138,7 @@ export class PhishingProtectionServiceV1Beta1Client {
137138
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
138139
}
139140
// Load the applicable protos.
140-
// For Node.js, pass the path to JSON proto file.
141-
// For browsers, pass the JSON content.
142-
143-
const nodejsProtoPath = path.join(
144-
__dirname,
145-
'..',
146-
'..',
147-
'protos',
148-
'protos.json'
149-
);
150-
this._protos = this._gaxGrpc.loadProto(
151-
opts.fallback
152-
? // eslint-disable-next-line @typescript-eslint/no-var-requires
153-
require('../../protos/protos.json')
154-
: nodejsProtoPath
155-
);
141+
this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
156142

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

0 commit comments

Comments
 (0)