Socket
Socket
Sign inDemoInstall

google-gax

Package Overview
Dependencies
Maintainers
2
Versions
362
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-gax - npm Package Compare versions

Comparing version 0.22.1 to 0.23.0

10

build/src/api_callable.d.ts

@@ -1,4 +0,1 @@

/**
* Provides function wrappers that implement page streaming and retrying.
*/
import { CallSettings } from './gax';

@@ -86,2 +83,5 @@ import { GoogleError } from './GoogleError';

}
export interface NormalApiCallerSettings {
promise: PromiseConstructor;
}
/**

@@ -94,5 +94,3 @@ * Creates an API caller for normal methods.

export declare class NormalApiCaller {
init(settings: {
promise: PromiseConstructor;
}, callback: APICallback): PromiseCanceller | Canceller;
init(settings: NormalApiCallerSettings, callback: APICallback): PromiseCanceller | Canceller;
wrap(func: Function): Function;

@@ -99,0 +97,0 @@ call(apiCall: APICall, argument: {}, settings: {}, canceller: PromiseCanceller): void;

37

build/src/api_callable.js

@@ -33,2 +33,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/**
* Provides function wrappers that implement page streaming and retrying.
*/
const grpc_1 = require("grpc");
const GoogleError_1 = require("./GoogleError");
class Canceller {

@@ -62,3 +67,5 @@ /**

else {
this.callback(new Error('cancelled'));
const error = new GoogleError_1.GoogleError('cancelled');
error.code = grpc_1.status.CANCELLED;
this.callback(error);
}

@@ -82,8 +89,5 @@ }

this.completed = true;
args.unshift(this.callback);
setImmediate.apply(null, args);
setImmediate(this.callback, ...args);
});
this.cancelFunc = () => {
canceller.cancel();
};
this.cancelFunc = () => canceller.cancel();
}

@@ -193,9 +197,12 @@ }

if (deadline && now.getTime() >= deadline) {
callback(new Error('Retry total timeout exceeded before any ' +
'response was received'));
const error = new GoogleError_1.GoogleError('Retry total timeout exceeded before any response was received');
error.code = grpc_1.status.DEADLINE_EXCEEDED;
callback(error);
return;
}
if (retries && retries >= maxRetries) {
callback(new Error('Exceeded maximum number of retries before any ' +
'response was received'));
const error = new GoogleError_1.GoogleError('Exceeded maximum number of retries before any ' +
'response was received');
error.code = grpc_1.status.DEADLINE_EXCEEDED;
callback(error);
return;

@@ -228,4 +235,6 @@ }

if (maxRetries && deadline) {
callback(new Error('Cannot set both totalTimeoutMillis and maxRetries ' +
'in backoffSettings.'));
const error = new GoogleError_1.GoogleError('Cannot set both totalTimeoutMillis and maxRetries ' +
'in backoffSettings.');
error.code = grpc_1.status.INVALID_ARGUMENT;
callback(error);
}

@@ -244,3 +253,5 @@ else {

else {
callback(new Error('cancelled'));
const error = new GoogleError_1.GoogleError('cancelled');
error.code = grpc_1.status.CANCELLED;
callback(error);
}

@@ -247,0 +258,0 @@ },

@@ -37,3 +37,5 @@ "use strict";

const at = require("lodash.at");
const grpc_1 = require("grpc");
const api_callable_1 = require("./api_callable");
const GoogleError_1 = require("./GoogleError");
/**

@@ -224,3 +226,5 @@ * A function which does nothing. Used for an empty cancellation funciton.

if (self._data[i].cancelled) {
self._data[i].callback(new Error('cancelled'));
const error = new GoogleError_1.GoogleError('cancelled');
error.code = grpc_1.status.CANCELLED;
self._data[i].callback(error);
}

@@ -270,3 +274,5 @@ else {

if (this._data[i].callback.id === id) {
this._data[i].callback(new Error('cancelled'));
const error = new GoogleError_1.GoogleError('cancelled');
error.code = grpc_1.status.CANCELLED;
this._data[i].callback(error);
this._data.splice(i, 1);

@@ -330,6 +336,6 @@ break;

const byteLimit = this._options.requestByteLimit || 0;
if ((countLimit > 0 && elementCount >= countLimit) ||
if ((countLimit > 0 && elementCount > countLimit) ||
(byteLimit > 0 && requestBytes >= byteLimit)) {
let message;
if (countLimit > 0 && elementCount >= countLimit) {
if (countLimit > 0 && elementCount > countLimit) {
message = 'The number of elements ' + elementCount +

@@ -342,3 +348,5 @@ ' exceeds the limit ' + this._options.elementCountLimit;

}
callback(new Error(message));
const error = new GoogleError_1.GoogleError(message);
error.code = grpc_1.status.INVALID_ARGUMENT;
callback(error);
return {

@@ -345,0 +353,0 @@ cancel: noop,

@@ -118,6 +118,6 @@ /**

maxRetryDelayMillis: number;
initialRpcTimeoutMillis: number | null;
maxRpcTimeoutMillis: number | null;
totalTimeoutMillis: number | null;
rpcTimeoutMultiplier: number | null;
initialRpcTimeoutMillis?: number | null;
maxRpcTimeoutMillis?: number | null;
totalTimeoutMillis?: number | null;
rpcTimeoutMultiplier?: number | null;
}

@@ -274,11 +274,3 @@ /**

*/
export declare function createMaxRetriesBackoffSettings(initialRetryDelayMillis: number, retryDelayMultiplier: number, maxRetryDelayMillis: number, initialRpcTimeoutMillis: number, rpcTimeoutMultiplier: number, maxRpcTimeoutMillis: number, maxRetries: number): {
initialRetryDelayMillis: number;
retryDelayMultiplier: number;
maxRetryDelayMillis: number;
initialRpcTimeoutMillis: number;
rpcTimeoutMultiplier: number;
maxRpcTimeoutMillis: number;
maxRetries: number;
};
export declare function createMaxRetriesBackoffSettings(initialRetryDelayMillis: number, retryDelayMultiplier: number, maxRetryDelayMillis: number, initialRpcTimeoutMillis: number, rpcTimeoutMultiplier: number, maxRpcTimeoutMillis: number, maxRetries: number): BackoffSettings;
/**

@@ -285,0 +277,0 @@ * Creates a new {@link BundleOptions}.

@@ -0,4 +1,5 @@

import { status } from 'grpc';
export declare class GoogleError extends Error {
code?: number;
code?: status;
note?: string;
}

@@ -37,3 +37,3 @@ /**

export { BundleDescriptor, BundleExecutor } from './bundling';
export { CallOptions, ClientConfig, constructSettings } from './gax';
export { CallOptions, CallSettings, ClientConfig, constructSettings, RetryOptions } from './gax';
export { GoogleError } from './GoogleError';

@@ -40,0 +40,0 @@ export { ClientStub, ClientStubOptions, GoogleProtoFilesRoot, GrpcClient, GrpcClientOptions, GrpcModule, GrpcObject, Metadata, MetadataValue } from './grpc';

@@ -45,3 +45,5 @@ "use strict";

var gax_1 = require("./gax");
exports.CallSettings = gax_1.CallSettings;
exports.constructSettings = gax_1.constructSettings;
exports.RetryOptions = gax_1.RetryOptions;
var GoogleError_1 = require("./GoogleError");

@@ -48,0 +50,0 @@ exports.GoogleError = GoogleError_1.GoogleError;

@@ -34,2 +34,3 @@ "use strict";

const events_1 = require("events");
const grpc_1 = require("grpc");
const api_callable_1 = require("./api_callable");

@@ -254,4 +255,5 @@ const gax_1 = require("./gax");

}
function emit() {
self.emit.apply(self, Array.prototype.slice.call(arguments, 0));
// tslint:disable-next-line no-any
function emit(event, ...args) {
self.emit(event, ...args);
}

@@ -263,4 +265,5 @@ function retry() {

if (now.getTime() >= deadline) {
setImmediate(emit, 'error', new Error('Total timeout exceeded before ' +
'any response was received'));
const error = new GoogleError_1.GoogleError('Total timeout exceeded before any response was received');
error.code = grpc_1.status.DEADLINE_EXCEEDED;
setImmediate(emit, 'error', error);
return;

@@ -267,0 +270,0 @@ }

"use strict";
/*
* Copyright 2016 Google Inc. All rights reserved.
* Copyright 2018 Google LLC. All rights reserved.
*

@@ -16,12 +16,2 @@ * Licensed under the Apache License, Version 2.0 (the "License");

* limitations under the License.
*
* EDITING INSTRUCTIONS
* This file was generated from the file
* https://github.com/googleapis/googleapis/blob/master/google/longrunning/operations.proto,
* and updates to that file get reflected here through a refresh process.
* For the short term, the refresh process will only be runnable by Google
* engineers.
*
* The only allowed edits are to method and file documentation. A 3-way
* merge preserves those additions if the generated source changes.
*/

@@ -28,0 +18,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

@@ -33,3 +33,3 @@ /**

import { Transform } from 'stream';
import { APICall, APICallback, NormalApiCaller } from './api_callable';
import { APICall, APICallback, NormalApiCaller, NormalApiCallerSettings } from './api_callable';
export declare class PagedIteration extends NormalApiCaller {

@@ -52,3 +52,3 @@ pageDescriptor: PageDescriptor;

wrap(func: Function): (argument: any, metadata: any, options: any, callback: any) => any;
init(settings: {}, callback: APICallback): any;
init(settings: NormalApiCallerSettings, callback: APICallback): import("./api_callable").PromiseCanceller<any> | import("./api_callable").Canceller;
call(apiCall: APICall, argument: {

@@ -55,0 +55,0 @@ [index: string]: {};

@@ -74,3 +74,3 @@ "use strict";

init(settings, callback) {
return api_callable_1.NormalApiCaller.prototype.init.call(this, settings, callback);
return super.init(settings, callback);
}

@@ -77,0 +77,0 @@ call(apiCall, argument, settings, canceller) {

@@ -38,3 +38,3 @@ module.exports = (() => {

const peg$c1 = {type: 'literal', value: '/', description: '"/"'};
const peg$c2 = (segments) => {
const peg$c2 = segments => {
return segments;

@@ -55,8 +55,7 @@ };

const peg$c11 = (l, segments) => {
return ([
{kind: extras.BINDING, literal: l},
segments,
{kind: extras.END_BINDING, literal: ''},
])
.reduce((a, b) => a.concat(b), []);
return [
{kind: extras.BINDING, literal: l},
segments,
{kind: extras.END_BINDING, literal: ''},
].reduce((a, b) => a.concat(b), []);
};

@@ -109,3 +108,4 @@ const peg$c12 = l => {

throw new Error(
'Can\'t start parsing from rule "' + options.startRule + '".');
'Can\'t start parsing from rule "' + options.startRule + '".'
);
}

@@ -126,5 +126,7 @@

throw peg$buildException(
null, [{type: 'other', description}],
input.substring(peg$savedPos, peg$currPos),
peg$computeLocation(peg$savedPos, peg$currPos));
null,
[{type: 'other', description}],
input.substring(peg$savedPos, peg$currPos),
peg$computeLocation(peg$savedPos, peg$currPos)
);
}

@@ -134,8 +136,13 @@

throw peg$buildException(
message, null, input.substring(peg$savedPos, peg$currPos),
peg$computeLocation(peg$savedPos, peg$currPos));
message,
null,
input.substring(peg$savedPos, peg$currPos),
peg$computeLocation(peg$savedPos, peg$currPos)
);
}
function peg$computePosDetails(pos) {
let details = peg$posDetailsCache[pos], p, ch;
let details = peg$posDetailsCache[pos],
p,
ch;

@@ -184,3 +191,3 @@ if (details) {

const startPosDetails = peg$computePosDetails(startPos),
endPosDetails = peg$computePosDetails(endPos);
endPosDetails = peg$computePosDetails(endPos);

@@ -240,30 +247,28 @@ return {

function hex(ch) {
return ch.charCodeAt(0).toString(16).toUpperCase();
return ch
.charCodeAt(0)
.toString(16)
.toUpperCase();
}
return s.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\x08/g, '\\b')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\f/g, '\\f')
.replace(/\r/g, '\\r')
.replace(
/[\x00-\x07\x0B\x0E\x0F]/g,
ch => {
return '\\x0' + hex(ch);
})
.replace(
/[\x10-\x1F\x80-\xFF]/g,
ch => {
return '\\x' + hex(ch);
})
.replace(
/[\u0100-\u0FFF]/g,
ch => {
return '\\u0' + hex(ch);
})
.replace(/[\u1000-\uFFFF]/g, ch => {
return '\\u' + hex(ch);
});
return s
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\x08/g, '\\b')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\f/g, '\\f')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x07\x0B\x0E\x0F]/g, ch => {
return '\\x0' + hex(ch);
})
.replace(/[\x10-\x1F\x80-\xFF]/g, ch => {
return '\\x' + hex(ch);
})
.replace(/[\u0100-\u0FFF]/g, ch => {
return '\\u0' + hex(ch);
})
.replace(/[\u1000-\uFFFF]/g, ch => {
return '\\u' + hex(ch);
});
}

@@ -278,6 +283,8 @@

expectedDesc = expected.length > 1 ?
expectedDescs.slice(0, -1).join(', ') + ' or ' +
expectedDescs[expected.length - 1] :
expectedDescs[0];
expectedDesc =
expected.length > 1
? expectedDescs.slice(0, -1).join(', ') +
' or ' +
expectedDescs[expected.length - 1]
: expectedDescs[0];

@@ -294,4 +301,7 @@ foundDesc = found ? '"' + stringEscape(found) + '"' : 'end of input';

return new peg$SyntaxError(
message !== null ? message : buildMessage(expected, found), expected,
found, location);
message !== null ? message : buildMessage(expected, found),
expected,
found,
location
);
}

@@ -642,7 +652,9 @@

throw peg$buildException(
null, peg$maxFailExpected,
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
peg$maxFailPos < input.length ?
peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) :
peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
null,
peg$maxFailExpected,
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
peg$maxFailPos < input.length
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
);
}

@@ -649,0 +661,0 @@ }

@@ -48,3 +48,3 @@ /**

export declare class StreamProxy extends Duplexify {
type: {};
type: StreamType;
private _callback?;

@@ -51,0 +51,0 @@ private _isCancelCalled;

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

## v0.23.0
01-11-2019 13:32 PST
### Implementation Changes
- fix: include status code on errors ([#390](https://github.com/googleapis/gax-nodejs/pull/390))
- fix: Change to "greater than" for limit on number of elements ([#386](https://github.com/googleapis/gax-nodejs/pull/386))
- fix(ts): export CallSettings and RetryOptions ([#360](https://github.com/googleapis/gax-nodejs/pull/360))
### Dependencies
- chore(deps): update dependency @types/sinon to v7 ([#385](https://github.com/googleapis/gax-nodejs/pull/385))
- chore(deps): update dependency typescript to ~3.2.0 ([#364](https://github.com/googleapis/gax-nodejs/pull/364))
- chore(deps): update dependency gts to ^0.9.0 ([#355](https://github.com/googleapis/gax-nodejs/pull/355))
### Documentation
- build: check broken links in generated docs ([#387](https://github.com/googleapis/gax-nodejs/pull/387))
### Internal / Testing Changes
- chore(build): inject yoshi automation key ([#384](https://github.com/googleapis/gax-nodejs/pull/384))
- chore: update nyc and eslint configs ([#383](https://github.com/googleapis/gax-nodejs/pull/383))
- chore: npm-install-retry is not a thing anymore ([#381](https://github.com/googleapis/gax-nodejs/pull/381))
- chore: fix publish.sh permission +x ([#380](https://github.com/googleapis/gax-nodejs/pull/380))
- fix(build): fix Kokoro release script ([#379](https://github.com/googleapis/gax-nodejs/pull/379))
- build: add Kokoro configs for autorelease ([#378](https://github.com/googleapis/gax-nodejs/pull/378))
- chore: always nyc report before calling codecov ([#375](https://github.com/googleapis/gax-nodejs/pull/375))
- chore: nyc ignore build/test by default ([#374](https://github.com/googleapis/gax-nodejs/pull/374))
- chore: update synth metadata ([#372](https://github.com/googleapis/gax-nodejs/pull/372))
- chore: fix openssl decrypt ([#367](https://github.com/googleapis/gax-nodejs/pull/367))
- test: enable pub/sub system tests ([#366](https://github.com/googleapis/gax-nodejs/pull/366))
- chore: don't say operations_client.ts is autogen'd ([#361](https://github.com/googleapis/gax-nodejs/pull/361))
- test: don't run Pub/Sub system tests ([#362](https://github.com/googleapis/gax-nodejs/pull/362))
- chore: include format and lint tools for samples ([#359](https://github.com/googleapis/gax-nodejs/pull/359))
- chore: add a synth.metadata
## v0.22.1

@@ -9,0 +44,0 @@

{
"name": "google-gax",
"version": "0.22.1",
"version": "0.23.0",
"description": "Google API Extensions",

@@ -26,2 +26,3 @@ "main": "build/src/index.js",

"devDependencies": {
"@compodoc/compodoc": "^1.1.7",
"@types/chai": "^4.1.3",

@@ -37,3 +38,3 @@ "@types/duplexify": "^3.5.0",

"@types/semver": "^5.5.0",
"@types/sinon": "^5.0.1",
"@types/sinon": "^7.0.0",
"@types/source-map-support": "^0.4.1",

@@ -43,10 +44,13 @@ "@types/through2": "^2.0.33",

"codecov": "^3.1.0",
"gts": "^0.8.0",
"ink-docstrap": "^1.3.2",
"eslint": "^5.9.0",
"eslint-config-prettier": "^3.3.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-prettier": "^3.0.0",
"gts": "^0.9.0",
"intelli-espower-loader": "^1.0.1",
"istanbul": "~0.4.5",
"jsdoc": "^3.5.5",
"mocha": "~5.2.0",
"nyc": "^13.1.0",
"pegjs": "~0.10.0",
"prettier": "^1.15.2",
"proxyquire": "^2.0.1",

@@ -59,17 +63,15 @@ "pumpify": "^1.5.1",

"through2": "^3.0.0",
"typescript": "~3.1.5"
"typescript": "~3.2.0"
},
"scripts": {
"codecov": "nyc mocha build/test --reporter spec --slow 500 && codecov",
"docs": "echo no docs 📗",
"docs": "compodoc src/",
"gen-parser": "pegjs lib/path_template_parser.pegjs",
"test": "npm run test-only",
"test-only": "nyc mocha build/test --reporter spec --slow 500",
"publish-gh-pages": "bash ./publish-gh-pages.sh",
"lint": "gts check",
"pretest": "npm run compile",
"test": "nyc mocha build/test",
"lint": "gts check && eslint samples/*.js samples/**/*.js",
"clean": "gts clean",
"compile": "tsc -p . && cp src/*.json build/src && cp src/*.js build/src",
"fix": "gts fix",
"fix": "gts fix && eslint --fix samples/*.js samples/**/*.js",
"prepare": "npm run compile",
"pretest-only": "npm run compile",
"posttest": "npm run lint",

@@ -95,5 +97,5 @@ "system-test": "nyc mocha --timeout 1200000 build/system-test",

"build/system-test/**",
"system-test-run/**"
".system-test-run/**"
]
}
}

@@ -7,3 +7,2 @@ <img src="https://avatars0.githubusercontent.com/u/1342004?v=3&s=96" alt="Google Inc. logo" title="Google" align="right" height="96" width="96"/>

[![npm version][npmimg]][npm]
[![CircleCI][circleimg]][circle]
[![Code Coverage][codecovimg]][codecov]

@@ -29,4 +28,2 @@

[circle]: https://circleci.com/gh/googleapis/gax-nodejs
[circleimg]: https://circleci.com/gh/googleapis/gax-nodejs.svg?style=shield
[codecovimg]: https://codecov.io/github/googleapis/gax-nodejs/coverage.svg?branch=master

@@ -33,0 +30,0 @@ [codecov]: https://codecov.io/github/googleapis/gax-nodejs?branch=master

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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc