Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency typescript to ~3.2.0 #364

Merged
merged 3 commits into from
Dec 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"source-map-support": "^0.5.6",
"stream-events": "^1.0.4",
"through2": "^3.0.0",
"typescript": "~3.1.5"
"typescript": "~3.2.0"
},
"scripts": {
"codecov": "nyc mocha build/test --reporter spec --slow 500 && codecov",
Expand Down
13 changes: 7 additions & 6 deletions src/api_callable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,9 @@ export class Canceller {
// tslint:disable-next-line no-any
const canceller = aFunc(argument, (...args: any[]) => {
this.completed = true;
args.unshift(this.callback);
setImmediate.apply(null, args);
setImmediate(this.callback!, ...args);
});
this.cancelFunc = () => {
canceller.cancel();
};
this.cancelFunc = () => canceller.cancel();
}
}

Expand Down Expand Up @@ -318,14 +315,18 @@ function retryable(
};
}

export interface NormalApiCallerSettings {
promise: PromiseConstructor;
}

/**
* Creates an API caller for normal methods.
*
* @private
* @constructor
*/
export class NormalApiCaller {
init(settings: {promise: PromiseConstructor}, callback: APICallback):
init(settings: NormalApiCallerSettings, callback: APICallback):
PromiseCanceller|Canceller {
if (callback) {
return new Canceller(callback);
Expand Down
10 changes: 5 additions & 5 deletions src/gax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ export interface BackoffSettings {
initialRetryDelayMillis: number;
retryDelayMultiplier: number;
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;
}

/**
Expand Down Expand Up @@ -395,7 +395,7 @@ export function createMaxRetriesBackoffSettings(
initialRetryDelayMillis: number, retryDelayMultiplier: number,
maxRetryDelayMillis: number, initialRpcTimeoutMillis: number,
rpcTimeoutMultiplier: number, maxRpcTimeoutMillis: number,
maxRetries: number) {
maxRetries: number): BackoffSettings {
return {
initialRetryDelayMillis,
retryDelayMultiplier,
Expand Down
5 changes: 3 additions & 2 deletions src/longrunning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,9 @@ export class Operation extends EventEmitter {
previousMetadataBytes = this.latestResponse.metadata.value;
}

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

function retry() {
Expand Down
6 changes: 3 additions & 3 deletions src/paged_iteration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import * as ended from 'is-stream-ended';
import {PassThrough, Transform} from 'stream';

import {APICall, APICallback, NormalApiCaller} from './api_callable';
import {APICall, APICallback, NormalApiCaller, NormalApiCallerSettings} from './api_callable';

export class PagedIteration extends NormalApiCaller {
pageDescriptor: PageDescriptor;
Expand Down Expand Up @@ -77,8 +77,8 @@ export class PagedIteration extends NormalApiCaller {
};
}

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

call(apiCall: APICall, argument: {[index: string]: {}}, settings, canceller) {
Expand Down
2 changes: 1 addition & 1 deletion src/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export enum StreamType {
}

export class StreamProxy extends Duplexify {
type: {};
type: StreamType;
private _callback?: Function;
private _isCancelCalled: boolean;
stream?: Duplex&{cancel: () => void};
Expand Down
15 changes: 11 additions & 4 deletions test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,16 @@ export function createApiCall(func, opts?) {
settings, descriptor);
}

export function createRetryOptions(backoff, ...args: Array<{}>) {
if (args.length > 0) {
backoff = gax.createBackoffSettings.apply(null, arguments);
}
export function createRetryOptions(
backoffSettingsOrInitialRetryDelayMillis: number|gax.BackoffSettings,
retryDelayMultiplier?: number, maxRetryDelayMillis?: number,
initialRpcTimeoutMillis?: number, rpcTimeoutMultiplier?: number,
maxRpcTimeoutMillis?: number, totalTimeoutMillis?: number) {
const backoff = typeof backoffSettingsOrInitialRetryDelayMillis === 'number' ?
gax.createBackoffSettings(
backoffSettingsOrInitialRetryDelayMillis, retryDelayMultiplier!,
maxRetryDelayMillis!, initialRpcTimeoutMillis!, rpcTimeoutMultiplier!,
maxRpcTimeoutMillis!, totalTimeoutMillis!) :
backoffSettingsOrInitialRetryDelayMillis;
return gax.createRetryOptions([FAKE_STATUS_CODE_1], backoff);
}