Socket
Socket
Sign inDemoInstall

@google-cloud/text-to-speech

Package Overview
Dependencies
118
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.2.0 to 2.3.0

2

build/src/index.d.ts

@@ -11,1 +11,3 @@ import * as v1beta1 from './v1beta1';

export default _default;
import * as protos from '../protos/protos';
export { protos };

@@ -29,2 +29,4 @@ "use strict";

exports.default = { v1, v1beta1, TextToSpeechClient };
const protos = require("../protos/protos");
exports.protos = protos;
//# sourceMappingURL=index.js.map

@@ -13,4 +13,9 @@ import * as gax from 'google-gax';

private _terminated;
private _opts;
private _gaxModule;
private _gaxGrpc;
private _protos;
private _defaults;
auth: gax.GoogleAuth;
textToSpeechStub: Promise<{
textToSpeechStub?: Promise<{
[name: string]: Function;

@@ -40,4 +45,2 @@ }>;

* your project ID will be detected automatically.
* @param {function} [options.promise] - Custom promise module to use instead
* of native Promises.
* @param {string} [options.apiEndpoint] - The domain name of the

@@ -48,2 +51,16 @@ * API remote host.

/**
* Initialize the client.
* Performs asynchronous operations (such as authentication) and prepares the client.
* This function will be called automatically when any class method is called for the
* first time, but if you need to initialize it before calling an actual method,
* feel free to call initialize() directly.
*
* You can await on this method if you want to make sure the client is initialized.
*
* @returns {Promise} A promise that resolves to an authenticated service stub.
*/
initialize(): Promise<{
[name: string]: Function;
}>;
/**
* The DNS address for this API service.

@@ -50,0 +67,0 @@ */

49

build/src/v1/text_to_speech_client.js

@@ -52,4 +52,2 @@ "use strict";

* your project ID will be detected automatically.
* @param {function} [options.promise] - Custom promise module to use instead
* of native Promises.
* @param {string} [options.apiEndpoint] - The domain name of the

@@ -82,11 +80,13 @@ * API remote host.

// But if we were explicitly requested to use fallback, let's do it now.
const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax;
this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax;
// Create a `gaxGrpc` object, with any grpc-specific options
// sent to the client.
opts.scopes = this.constructor.scopes;
const gaxGrpc = new gaxModule.GrpcClient(opts);
this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
// Save options to use in initialize() method.
this._opts = opts;
// Save the auth object to the client, for use by other methods.
this.auth = gaxGrpc.auth;
this.auth = this._gaxGrpc.auth;
// Determine the client header string.
const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`];
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
if (typeof process !== 'undefined' && 'versions' in process) {

@@ -96,6 +96,6 @@ clientHeader.push(`gl-node/${process.versions.node}`);

else {
clientHeader.push(`gl-web/${gaxModule.version}`);
clientHeader.push(`gl-web/${this._gaxModule.version}`);
}
if (!opts.fallback) {
clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`);
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
}

@@ -109,5 +109,5 @@ if (opts.libName && opts.libVersion) {

const nodejsProtoPath = path.join(__dirname, '..', '..', 'protos', 'protos.json');
const protos = gaxGrpc.loadProto(opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath);
this._protos = this._gaxGrpc.loadProto(opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath);
// Put together the default options sent with requests.
const defaults = gaxGrpc.constructSettings('google.cloud.texttospeech.v1.TextToSpeech', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
this._defaults = this._gaxGrpc.constructSettings('google.cloud.texttospeech.v1.TextToSpeech', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
// Set up a dictionary of "inner API calls"; the core implementation

@@ -117,8 +117,25 @@ // of calling the API is handled in `google-gax`, with this code

this._innerApiCalls = {};
}
/**
* Initialize the client.
* Performs asynchronous operations (such as authentication) and prepares the client.
* This function will be called automatically when any class method is called for the
* first time, but if you need to initialize it before calling an actual method,
* feel free to call initialize() directly.
*
* You can await on this method if you want to make sure the client is initialized.
*
* @returns {Promise} A promise that resolves to an authenticated service stub.
*/
initialize() {
// If the client stub promise is already initialized, return immediately.
if (this.textToSpeechStub) {
return this.textToSpeechStub;
}
// Put together the "service stub" for
// google.cloud.texttospeech.v1.TextToSpeech.
this.textToSpeechStub = gaxGrpc.createStub(opts.fallback
? protos.lookupService('google.cloud.texttospeech.v1.TextToSpeech')
this.textToSpeechStub = this._gaxGrpc.createStub(this._opts.fallback
? this._protos.lookupService('google.cloud.texttospeech.v1.TextToSpeech')
: // tslint:disable-next-line no-any
protos.google.cloud.texttospeech.v1.TextToSpeech, opts);
this._protos.google.cloud.texttospeech.v1.TextToSpeech, this._opts);
// Iterate over each of the methods that the service provides

@@ -136,3 +153,3 @@ // and create an API call method for each.

});
const apiCall = gaxModule.createApiCall(innerCallPromise, defaults[methodName], this._descriptors.page[methodName] ||
const apiCall = this._gaxModule.createApiCall(innerCallPromise, this._defaults[methodName], this._descriptors.page[methodName] ||
this._descriptors.stream[methodName] ||

@@ -144,2 +161,3 @@ this._descriptors.longrunning[methodName]);

}
return this.textToSpeechStub;
}

@@ -215,2 +233,3 @@ /**

options = options || {};
this.initialize();
return this._innerApiCalls.listVoices(request, options, callback);

@@ -247,2 +266,3 @@ }

options = options || {};
this.initialize();
return this._innerApiCalls.synthesizeSpeech(request, options, callback);

@@ -256,2 +276,3 @@ }

close() {
this.initialize();
if (!this._terminated) {

@@ -258,0 +279,0 @@ return this.textToSpeechStub.then(stub => {

@@ -13,4 +13,9 @@ import * as gax from 'google-gax';

private _terminated;
private _opts;
private _gaxModule;
private _gaxGrpc;
private _protos;
private _defaults;
auth: gax.GoogleAuth;
textToSpeechStub: Promise<{
textToSpeechStub?: Promise<{
[name: string]: Function;

@@ -40,4 +45,2 @@ }>;

* your project ID will be detected automatically.
* @param {function} [options.promise] - Custom promise module to use instead
* of native Promises.
* @param {string} [options.apiEndpoint] - The domain name of the

@@ -48,2 +51,16 @@ * API remote host.

/**
* Initialize the client.
* Performs asynchronous operations (such as authentication) and prepares the client.
* This function will be called automatically when any class method is called for the
* first time, but if you need to initialize it before calling an actual method,
* feel free to call initialize() directly.
*
* You can await on this method if you want to make sure the client is initialized.
*
* @returns {Promise} A promise that resolves to an authenticated service stub.
*/
initialize(): Promise<{
[name: string]: Function;
}>;
/**
* The DNS address for this API service.

@@ -50,0 +67,0 @@ */

@@ -52,4 +52,2 @@ "use strict";

* your project ID will be detected automatically.
* @param {function} [options.promise] - Custom promise module to use instead
* of native Promises.
* @param {string} [options.apiEndpoint] - The domain name of the

@@ -82,11 +80,13 @@ * API remote host.

// But if we were explicitly requested to use fallback, let's do it now.
const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax;
this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax;
// Create a `gaxGrpc` object, with any grpc-specific options
// sent to the client.
opts.scopes = this.constructor.scopes;
const gaxGrpc = new gaxModule.GrpcClient(opts);
this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
// Save options to use in initialize() method.
this._opts = opts;
// Save the auth object to the client, for use by other methods.
this.auth = gaxGrpc.auth;
this.auth = this._gaxGrpc.auth;
// Determine the client header string.
const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`];
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
if (typeof process !== 'undefined' && 'versions' in process) {

@@ -96,6 +96,6 @@ clientHeader.push(`gl-node/${process.versions.node}`);

else {
clientHeader.push(`gl-web/${gaxModule.version}`);
clientHeader.push(`gl-web/${this._gaxModule.version}`);
}
if (!opts.fallback) {
clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`);
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
}

@@ -109,5 +109,5 @@ if (opts.libName && opts.libVersion) {

const nodejsProtoPath = path.join(__dirname, '..', '..', 'protos', 'protos.json');
const protos = gaxGrpc.loadProto(opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath);
this._protos = this._gaxGrpc.loadProto(opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath);
// Put together the default options sent with requests.
const defaults = gaxGrpc.constructSettings('google.cloud.texttospeech.v1beta1.TextToSpeech', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
this._defaults = this._gaxGrpc.constructSettings('google.cloud.texttospeech.v1beta1.TextToSpeech', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
// Set up a dictionary of "inner API calls"; the core implementation

@@ -117,8 +117,25 @@ // of calling the API is handled in `google-gax`, with this code

this._innerApiCalls = {};
}
/**
* Initialize the client.
* Performs asynchronous operations (such as authentication) and prepares the client.
* This function will be called automatically when any class method is called for the
* first time, but if you need to initialize it before calling an actual method,
* feel free to call initialize() directly.
*
* You can await on this method if you want to make sure the client is initialized.
*
* @returns {Promise} A promise that resolves to an authenticated service stub.
*/
initialize() {
// If the client stub promise is already initialized, return immediately.
if (this.textToSpeechStub) {
return this.textToSpeechStub;
}
// Put together the "service stub" for
// google.cloud.texttospeech.v1beta1.TextToSpeech.
this.textToSpeechStub = gaxGrpc.createStub(opts.fallback
? protos.lookupService('google.cloud.texttospeech.v1beta1.TextToSpeech')
this.textToSpeechStub = this._gaxGrpc.createStub(this._opts.fallback
? this._protos.lookupService('google.cloud.texttospeech.v1beta1.TextToSpeech')
: // tslint:disable-next-line no-any
protos.google.cloud.texttospeech.v1beta1.TextToSpeech, opts);
this._protos.google.cloud.texttospeech.v1beta1.TextToSpeech, this._opts);
// Iterate over each of the methods that the service provides

@@ -136,3 +153,3 @@ // and create an API call method for each.

});
const apiCall = gaxModule.createApiCall(innerCallPromise, defaults[methodName], this._descriptors.page[methodName] ||
const apiCall = this._gaxModule.createApiCall(innerCallPromise, this._defaults[methodName], this._descriptors.page[methodName] ||
this._descriptors.stream[methodName] ||

@@ -144,2 +161,3 @@ this._descriptors.longrunning[methodName]);

}
return this.textToSpeechStub;
}

@@ -215,2 +233,3 @@ /**

options = options || {};
this.initialize();
return this._innerApiCalls.listVoices(request, options, callback);

@@ -247,2 +266,3 @@ }

options = options || {};
this.initialize();
return this._innerApiCalls.synthesizeSpeech(request, options, callback);

@@ -256,2 +276,3 @@ }

close() {
this.initialize();
if (!this._terminated) {

@@ -258,0 +279,0 @@ return this.textToSpeechStub.then(stub => {

@@ -7,2 +7,10 @@ # Changelog

## [2.3.0](https://www.github.com/googleapis/nodejs-text-to-speech/compare/v2.2.0...v2.3.0) (2020-03-06)
### Features
* deferred client initialization ([#359](https://www.github.com/googleapis/nodejs-text-to-speech/issues/359)) ([547fb77](https://www.github.com/googleapis/nodejs-text-to-speech/commit/547fb77d625a6c25ef288e8bdad19d448113271e))
* export protos in src/index.ts ([b6ca82f](https://www.github.com/googleapis/nodejs-text-to-speech/commit/b6ca82f901d4791d3d4994a5782c7f19d449becf))
## [2.2.0](https://www.github.com/googleapis/nodejs-text-to-speech/compare/v2.1.3...v2.2.0) (2020-02-12)

@@ -9,0 +17,0 @@

{
"name": "@google-cloud/text-to-speech",
"description": "Cloud Text-to-Speech API client for Node.js",
"version": "2.2.0",
"version": "2.3.0",
"license": "Apache-2.0",

@@ -6,0 +6,0 @@ "author": "Google LLC",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc