Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
fix: use require() to load JSON protos (#508)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gcf-owl-bot[bot] committed May 11, 2021
1 parent a7435a5 commit 5046bb9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 32 deletions.
18 changes: 2 additions & 16 deletions src/v1/text_to_speech_client.ts
Expand Up @@ -22,6 +22,7 @@ import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax';
import * as path from 'path';

import * as protos from '../../protos/protos';
import jsonProtos = require('../../protos/protos.json');
/**
* Client JSON configuration object, loaded from
* `src/v1/text_to_speech_client_config.json`.
Expand Down Expand Up @@ -135,22 +136,7 @@ export class TextToSpeechClient {
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
}
// Load the applicable protos.
// For Node.js, pass the path to JSON proto file.
// For browsers, pass the JSON content.

const nodejsProtoPath = path.join(
__dirname,
'..',
'..',
'protos',
'protos.json'
);
this._protos = this._gaxGrpc.loadProto(
opts.fallback
? // eslint-disable-next-line @typescript-eslint/no-var-requires
require('../../protos/protos.json')
: nodejsProtoPath
);
this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);

// Put together the default options sent with requests.
this._defaults = this._gaxGrpc.constructSettings(
Expand Down
18 changes: 2 additions & 16 deletions src/v1beta1/text_to_speech_client.ts
Expand Up @@ -22,6 +22,7 @@ import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax';
import * as path from 'path';

import * as protos from '../../protos/protos';
import jsonProtos = require('../../protos/protos.json');
/**
* Client JSON configuration object, loaded from
* `src/v1beta1/text_to_speech_client_config.json`.
Expand Down Expand Up @@ -135,22 +136,7 @@ export class TextToSpeechClient {
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
}
// Load the applicable protos.
// For Node.js, pass the path to JSON proto file.
// For browsers, pass the JSON content.

const nodejsProtoPath = path.join(
__dirname,
'..',
'..',
'protos',
'protos.json'
);
this._protos = this._gaxGrpc.loadProto(
opts.fallback
? // eslint-disable-next-line @typescript-eslint/no-var-requires
require('../../protos/protos.json')
: nodejsProtoPath
);
this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);

// Put together the default options sent with requests.
this._defaults = this._gaxGrpc.constructSettings(
Expand Down

0 comments on commit 5046bb9

Please sign in to comment.