Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.

Commit 0783962

Browse files
fix: use require() to load JSON protos (#48)
The library is regenerated with gapic-generator-typescript v1.3.1. Committer: @alexander-fenster PiperOrigin-RevId: 372468161 Source-Link: googleapis/googleapis@75880c3 Source-Link: https://github.com/googleapis/googleapis-gen/commit/77b18044813d4c8c415ff9ea68e76e307eb8e904
1 parent f403b3e commit 0783962

1 file changed

Lines changed: 2 additions & 16 deletions

File tree

src/v1beta1/binauthz_management_service_v1_beta1_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/v1beta1/binauthz_management_service_v1_beta1_client_config.json`.
@@ -152,22 +153,7 @@ export class BinauthzManagementServiceV1Beta1Client {
152153
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
153154
}
154155
// Load the applicable protos.
155-
// For Node.js, pass the path to JSON proto file.
156-
// For browsers, pass the JSON content.
157-
158-
const nodejsProtoPath = path.join(
159-
__dirname,
160-
'..',
161-
'..',
162-
'protos',
163-
'protos.json'
164-
);
165-
this._protos = this._gaxGrpc.loadProto(
166-
opts.fallback
167-
? // eslint-disable-next-line @typescript-eslint/no-var-requires
168-
require('../../protos/protos.json')
169-
: nodejsProtoPath
170-
);
156+
this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
171157

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

0 commit comments

Comments
 (0)