@google-cloud/functions
Advanced tools
Comparing version 2.2.0 to 2.2.1
/// <reference types="node" /> | ||
import * as gax from 'google-gax'; | ||
import { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback } from 'google-gax'; | ||
import type * as gax from 'google-gax'; | ||
import type { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback } from 'google-gax'; | ||
import { Transform } from 'stream'; | ||
@@ -64,4 +64,11 @@ import * as protos from '../../protos/protos'; | ||
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. | ||
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you | ||
* need to avoid loading the default gRPC version and want to use the fallback | ||
* HTTP implementation. Load only fallback version and pass it to the constructor: | ||
* ``` | ||
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC | ||
* const client = new CloudFunctionsServiceClient({fallback: 'rest'}, gax); | ||
* ``` | ||
*/ | ||
constructor(opts?: ClientOptions); | ||
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback); | ||
/** | ||
@@ -68,0 +75,0 @@ * Initialize the client. |
@@ -21,4 +21,2 @@ "use strict"; | ||
exports.CloudFunctionsServiceClient = void 0; | ||
/* global window */ | ||
const gax = require("google-gax"); | ||
const jsonProtos = require("../../protos/protos.json"); | ||
@@ -31,3 +29,2 @@ /** | ||
const gapicConfig = require("./cloud_functions_service_client_config.json"); | ||
const google_gax_1 = require("google-gax"); | ||
const version = require('../../../package.json').version; | ||
@@ -72,4 +69,11 @@ /** | ||
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. | ||
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you | ||
* need to avoid loading the default gRPC version and want to use the fallback | ||
* HTTP implementation. Load only fallback version and pass it to the constructor: | ||
* ``` | ||
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC | ||
* const client = new CloudFunctionsServiceClient({fallback: 'rest'}, gax); | ||
* ``` | ||
*/ | ||
constructor(opts) { | ||
constructor(opts, gaxInstance) { | ||
var _a, _b; | ||
@@ -96,4 +100,8 @@ this._terminated = false; | ||
} | ||
// Load google-gax module synchronously if needed | ||
if (!gaxInstance) { | ||
gaxInstance = require('google-gax'); | ||
} | ||
// Choose either gRPC or proto-over-HTTP implementation of google-gax. | ||
this._gaxModule = opts.fallback ? gax.fallback : gax; | ||
this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; | ||
// Create a `gaxGrpc` object, with any grpc-specific options sent to the client. | ||
@@ -193,3 +201,3 @@ this._gaxGrpc = new this._gaxModule.GrpcClient(opts); | ||
// Add a warn function to the client constructor so it can be easily tested. | ||
this.warn = gax.warn; | ||
this.warn = this._gaxModule.warn; | ||
} | ||
@@ -246,3 +254,3 @@ /** | ||
undefined; | ||
const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor); | ||
const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback); | ||
this.innerApiCalls[methodName] = apiCall; | ||
@@ -307,3 +315,3 @@ } | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: request.name || '', | ||
@@ -328,3 +336,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: request.name || '', | ||
@@ -349,3 +357,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: request.parent || '', | ||
@@ -370,3 +378,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: request.name || '', | ||
@@ -391,3 +399,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
resource: request.resource || '', | ||
@@ -412,3 +420,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
resource: request.resource || '', | ||
@@ -433,3 +441,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
resource: request.resource || '', | ||
@@ -454,3 +462,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
location: request.location || '', | ||
@@ -474,5 +482,5 @@ }); | ||
async checkCreateFunctionProgress(name) { | ||
const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
const [operation] = await this.operationsClient.getOperation(request); | ||
const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createFunction, gax.createDefaultBackoffSettings()); | ||
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFunction, this._gaxModule.createDefaultBackoffSettings()); | ||
return decodeOperation; | ||
@@ -494,3 +502,3 @@ } | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
'function.name': request.function.name || '', | ||
@@ -514,5 +522,5 @@ }); | ||
async checkUpdateFunctionProgress(name) { | ||
const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
const [operation] = await this.operationsClient.getOperation(request); | ||
const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateFunction, gax.createDefaultBackoffSettings()); | ||
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFunction, this._gaxModule.createDefaultBackoffSettings()); | ||
return decodeOperation; | ||
@@ -534,3 +542,3 @@ } | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
name: request.name || '', | ||
@@ -554,5 +562,5 @@ }); | ||
async checkDeleteFunctionProgress(name) { | ||
const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); | ||
const [operation] = await this.operationsClient.getOperation(request); | ||
const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteFunction, gax.createDefaultBackoffSettings()); | ||
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFunction, this._gaxModule.createDefaultBackoffSettings()); | ||
return decodeOperation; | ||
@@ -574,3 +582,3 @@ } | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: request.parent || '', | ||
@@ -617,3 +625,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: request.parent || '', | ||
@@ -665,3 +673,3 @@ }); | ||
options.otherArgs.headers['x-goog-request-params'] = | ||
gax.routingHeader.fromParams({ | ||
this._gaxModule.routingHeader.fromParams({ | ||
parent: request.parent || '', | ||
@@ -668,0 +676,0 @@ }); |
/// <reference types="node" /> | ||
import * as gax from 'google-gax'; | ||
import { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, IamClient, IamProtos, LocationsClient, LocationProtos } from 'google-gax'; | ||
import type * as gax from 'google-gax'; | ||
import type { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, IamClient, IamProtos, LocationsClient, LocationProtos } from 'google-gax'; | ||
import { Transform } from 'stream'; | ||
@@ -71,4 +71,11 @@ import * as protos from '../../protos/protos'; | ||
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. | ||
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you | ||
* need to avoid loading the default gRPC version and want to use the fallback | ||
* HTTP implementation. Load only fallback version and pass it to the constructor: | ||
* ``` | ||
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC | ||
* const client = new FunctionServiceClient({fallback: 'rest'}, gax); | ||
* ``` | ||
*/ | ||
constructor(opts?: ClientOptions); | ||
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback); | ||
/** | ||
@@ -75,0 +82,0 @@ * Initialize the client. |
/// <reference types="node" /> | ||
import * as gax from 'google-gax'; | ||
import { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, IamClient, IamProtos, LocationsClient, LocationProtos } from 'google-gax'; | ||
import type * as gax from 'google-gax'; | ||
import type { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, IamClient, IamProtos, LocationsClient, LocationProtos } from 'google-gax'; | ||
import { Transform } from 'stream'; | ||
@@ -71,4 +71,11 @@ import * as protos from '../../protos/protos'; | ||
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. | ||
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you | ||
* need to avoid loading the default gRPC version and want to use the fallback | ||
* HTTP implementation. Load only fallback version and pass it to the constructor: | ||
* ``` | ||
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC | ||
* const client = new FunctionServiceClient({fallback: 'rest'}, gax); | ||
* ``` | ||
*/ | ||
constructor(opts?: ClientOptions); | ||
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback); | ||
/** | ||
@@ -75,0 +82,0 @@ * Initialize the client. |
/// <reference types="node" /> | ||
import * as gax from 'google-gax'; | ||
import { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, IamClient, IamProtos, LocationsClient, LocationProtos } from 'google-gax'; | ||
import type * as gax from 'google-gax'; | ||
import type { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, IamClient, IamProtos, LocationsClient, LocationProtos } from 'google-gax'; | ||
import { Transform } from 'stream'; | ||
@@ -71,4 +71,11 @@ import * as protos from '../../protos/protos'; | ||
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. | ||
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you | ||
* need to avoid loading the default gRPC version and want to use the fallback | ||
* HTTP implementation. Load only fallback version and pass it to the constructor: | ||
* ``` | ||
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC | ||
* const client = new FunctionServiceClient({fallback: 'rest'}, gax); | ||
* ``` | ||
*/ | ||
constructor(opts?: ClientOptions); | ||
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback); | ||
/** | ||
@@ -75,0 +82,0 @@ * Initialize the client. |
# Changelog | ||
## [2.2.1](https://github.com/googleapis/nodejs-functions/compare/v2.2.0...v2.2.1) (2022-09-01) | ||
### Bug Fixes | ||
* Allow passing gax instance to client constructor ([#186](https://github.com/googleapis/nodejs-functions/issues/186)) ([2ab984e](https://github.com/googleapis/nodejs-functions/commit/2ab984e032f5062862f0ce0fbe65d18bbbc421f1)) | ||
* Better support for fallback mode ([#181](https://github.com/googleapis/nodejs-functions/issues/181)) ([aeaefd4](https://github.com/googleapis/nodejs-functions/commit/aeaefd4debab32e91a0078a342acc15c501281f8)) | ||
* Change import long to require ([#182](https://github.com/googleapis/nodejs-functions/issues/182)) ([1c02a68](https://github.com/googleapis/nodejs-functions/commit/1c02a6842e99c5a0db5eff94b46ca3551f0b13a0)) | ||
* Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-functions/issues/1553)) ([#185](https://github.com/googleapis/nodejs-functions/issues/185)) ([b5748ed](https://github.com/googleapis/nodejs-functions/commit/b5748ed5154722907fd407c8bc6fd300a8fdaf21)) | ||
* Remove pip install statements ([#1546](https://github.com/googleapis/nodejs-functions/issues/1546)) ([#184](https://github.com/googleapis/nodejs-functions/issues/184)) ([a8ffbb1](https://github.com/googleapis/nodejs-functions/commit/a8ffbb17e77a95ea23a1f4043c50a17faaa66b7e)) | ||
## [2.2.0](https://github.com/googleapis/nodejs-functions/compare/v2.1.0...v2.2.0) (2022-07-14) | ||
@@ -4,0 +15,0 @@ |
{ | ||
"name": "@google-cloud/functions", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Functions client for Node.js", | ||
@@ -42,3 +42,3 @@ "repository": "googleapis/nodejs-functions", | ||
"dependencies": { | ||
"google-gax": "^3.0.1" | ||
"google-gax": "^3.3.0" | ||
}, | ||
@@ -45,0 +45,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5096574
80922
Updatedgoogle-gax@^3.3.0