mirror of https://github.com/grpc/grpc-node.git
Merge pull request #787 from murgatroid99/grpc-js_missing_types
Export missing types, fix a couple of incorrect types
This commit is contained in:
commit
3ae5fdd258
|
|
@ -35,7 +35,8 @@ export interface UnaryCallback<ResponseType> {
|
||||||
export interface CallOptions {
|
export interface CallOptions {
|
||||||
deadline?: Deadline;
|
deadline?: Deadline;
|
||||||
host?: string;
|
host?: string;
|
||||||
parent?: Call;
|
/* There should be a parent option here that will accept a server call,
|
||||||
|
* but the server is not yet implemented so it makes no sense to have it */
|
||||||
propagate_flags?: number;
|
propagate_flags?: number;
|
||||||
credentials?: CallCredentials;
|
credentials?: CallCredentials;
|
||||||
}
|
}
|
||||||
|
|
@ -188,8 +189,7 @@ export class Client {
|
||||||
this.checkOptionalUnaryResponseArguments<ResponseType>(
|
this.checkOptionalUnaryResponseArguments<ResponseType>(
|
||||||
metadata, options, callback));
|
metadata, options, callback));
|
||||||
const call: Call = this[kChannel].createCall(
|
const call: Call = this[kChannel].createCall(
|
||||||
method, options.deadline, options.host, options.parent,
|
method, options.deadline, options.host, null, options.propagate_flags);
|
||||||
options.propagate_flags);
|
|
||||||
if (options.credentials) {
|
if (options.credentials) {
|
||||||
call.setCredentials(options.credentials);
|
call.setCredentials(options.credentials);
|
||||||
}
|
}
|
||||||
|
|
@ -230,8 +230,7 @@ export class Client {
|
||||||
this.checkOptionalUnaryResponseArguments<ResponseType>(
|
this.checkOptionalUnaryResponseArguments<ResponseType>(
|
||||||
metadata, options, callback));
|
metadata, options, callback));
|
||||||
const call: Call = this[kChannel].createCall(
|
const call: Call = this[kChannel].createCall(
|
||||||
method, options.deadline, options.host, options.parent,
|
method, options.deadline, options.host, null, options.propagate_flags);
|
||||||
options.propagate_flags);
|
|
||||||
if (options.credentials) {
|
if (options.credentials) {
|
||||||
call.setCredentials(options.credentials);
|
call.setCredentials(options.credentials);
|
||||||
}
|
}
|
||||||
|
|
@ -279,8 +278,7 @@ export class Client {
|
||||||
options?: CallOptions): ClientReadableStream<ResponseType> {
|
options?: CallOptions): ClientReadableStream<ResponseType> {
|
||||||
({metadata, options} = this.checkMetadataAndOptions(metadata, options));
|
({metadata, options} = this.checkMetadataAndOptions(metadata, options));
|
||||||
const call: Call = this[kChannel].createCall(
|
const call: Call = this[kChannel].createCall(
|
||||||
method, options.deadline, options.host, options.parent,
|
method, options.deadline, options.host, null, options.propagate_flags);
|
||||||
options.propagate_flags);
|
|
||||||
if (options.credentials) {
|
if (options.credentials) {
|
||||||
call.setCredentials(options.credentials);
|
call.setCredentials(options.credentials);
|
||||||
}
|
}
|
||||||
|
|
@ -307,8 +305,7 @@ export class Client {
|
||||||
options?: CallOptions): ClientDuplexStream<RequestType, ResponseType> {
|
options?: CallOptions): ClientDuplexStream<RequestType, ResponseType> {
|
||||||
({metadata, options} = this.checkMetadataAndOptions(metadata, options));
|
({metadata, options} = this.checkMetadataAndOptions(metadata, options));
|
||||||
const call: Call = this[kChannel].createCall(
|
const call: Call = this[kChannel].createCall(
|
||||||
method, options.deadline, options.host, options.parent,
|
method, options.deadline, options.host, null, options.propagate_flags);
|
||||||
options.propagate_flags);
|
|
||||||
if (options.credentials) {
|
if (options.credentials) {
|
||||||
call.setCredentials(options.credentials);
|
call.setCredentials(options.credentials);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,15 @@
|
||||||
|
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
|
|
||||||
|
import {ClientDuplexStream, ClientReadableStream, ClientUnaryCall, ClientWritableStream} from './call';
|
||||||
import {CallCredentials} from './call-credentials';
|
import {CallCredentials} from './call-credentials';
|
||||||
import {Channel} from './channel';
|
import {Deadline, StatusObject} from './call-stream';
|
||||||
|
import {Channel, ConnectivityState, Http2Channel} from './channel';
|
||||||
import {ChannelCredentials} from './channel-credentials';
|
import {ChannelCredentials} from './channel-credentials';
|
||||||
import {Client} from './client';
|
import {CallOptions, Client} from './client';
|
||||||
import {LogVerbosity, Status} from './constants';
|
import {LogVerbosity, Status} from './constants';
|
||||||
import * as logging from './logging';
|
import * as logging from './logging';
|
||||||
import {loadPackageDefinition, makeClientConstructor} from './make-client';
|
import {Deserialize, loadPackageDefinition, makeClientConstructor, Serialize} from './make-client';
|
||||||
import {Metadata} from './metadata';
|
import {Metadata} from './metadata';
|
||||||
import {StatusBuilder} from './status-builder';
|
import {StatusBuilder} from './status-builder';
|
||||||
|
|
||||||
|
|
@ -138,7 +140,8 @@ export {Metadata};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
LogVerbosity as logVerbosity,
|
LogVerbosity as logVerbosity,
|
||||||
Status as status
|
Status as status,
|
||||||
|
ConnectivityState as connectivityState
|
||||||
// TODO: Other constants as well
|
// TODO: Other constants as well
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -149,7 +152,7 @@ export {
|
||||||
loadPackageDefinition,
|
loadPackageDefinition,
|
||||||
makeClientConstructor,
|
makeClientConstructor,
|
||||||
makeClientConstructor as makeGenericClientConstructor,
|
makeClientConstructor as makeGenericClientConstructor,
|
||||||
Channel
|
Http2Channel as Channel
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -163,6 +166,40 @@ export const waitForClientReady =
|
||||||
callback: (error?: Error) => void) =>
|
callback: (error?: Error) => void) =>
|
||||||
client.waitForReady(deadline, callback);
|
client.waitForReady(deadline, callback);
|
||||||
|
|
||||||
|
/* Interfaces */
|
||||||
|
|
||||||
|
export {
|
||||||
|
ChannelCredentials,
|
||||||
|
CallCredentials,
|
||||||
|
Deadline,
|
||||||
|
Serialize as serialize,
|
||||||
|
Deserialize as deserialize,
|
||||||
|
ClientUnaryCall,
|
||||||
|
ClientReadableStream,
|
||||||
|
ClientWritableStream,
|
||||||
|
ClientDuplexStream,
|
||||||
|
CallOptions,
|
||||||
|
StatusObject
|
||||||
|
};
|
||||||
|
|
||||||
|
/* tslint:disable:no-any */
|
||||||
|
export type Call = ClientUnaryCall|ClientReadableStream<any>|
|
||||||
|
ClientWritableStream<any>|ClientDuplexStream<any, any>;
|
||||||
|
/* tslint:enable:no-any */
|
||||||
|
|
||||||
|
export type MetadataListener = (metadata: Metadata, next: Function) => void;
|
||||||
|
|
||||||
|
// tslint:disable-next-line:no-any
|
||||||
|
export type MessageListener = (message: any, next: Function) => void;
|
||||||
|
|
||||||
|
export type StatusListener = (status: StatusObject, next: Function) => void;
|
||||||
|
|
||||||
|
export interface Listener {
|
||||||
|
onReceiveMetadata?: MetadataListener;
|
||||||
|
onReceiveMessage?: MessageListener;
|
||||||
|
onReceiveStatus?: StatusListener;
|
||||||
|
}
|
||||||
|
|
||||||
/**** Unimplemented function stubs ****/
|
/**** Unimplemented function stubs ****/
|
||||||
|
|
||||||
/* tslint:disable:no-any variable-name */
|
/* tslint:disable:no-any variable-name */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue