gprc-js: Merge remote-tracking branch 'upstream/master' into patch/grpc-js-linting

This commit is contained in:
Patrick Remy 2020-04-10 11:32:51 +02:00
commit 873e6d411c
No known key found for this signature in database
GPG Key ID: FE25C0B14C0500CD
4 changed files with 17 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "0.7.7",
"version": "0.7.8",
"description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

View File

@ -58,7 +58,7 @@ function getProxyInfo(): ProxyInfo {
try {
proxyUrl = new URL(proxyEnv);
} catch (e) {
log(LogVerbosity.INFO, `cannot parse value of "${envVar}" env var`);
log(LogVerbosity.ERROR, `cannot parse value of "${envVar}" env var`);
return {};
}
if (proxyUrl.protocol !== 'http:') {
@ -167,7 +167,7 @@ export function getProxiedConnection(
request.once('connect', (res, socket, head) => {
request.removeAllListeners();
socket.removeAllListeners();
if (res.statusCode === http.STATUS_CODES.OK) {
if (res.statusCode === 200) {
trace(
'Successfully connected to ' +
subchannelAddress +
@ -176,7 +176,8 @@ export function getProxiedConnection(
);
resolve(socket);
} else {
trace(
log(
LogVerbosity.ERROR,
'Failed to connect to ' +
subchannelAddress +
' through proxy ' +
@ -187,7 +188,10 @@ export function getProxiedConnection(
});
request.once('error', (err) => {
request.removeAllListeners();
trace('Failed to connect to proxy ' + PROXY_INFO.address);
log(
LogVerbosity.ERROR,
'Failed to connect to proxy ' + PROXY_INFO.address
);
reject();
});
});

View File

@ -40,6 +40,7 @@ import {
Deserialize,
loadPackageDefinition,
makeClientConstructor,
MethodDefinition,
Serialize,
ServiceDefinition,
} from './make-client';
@ -235,6 +236,7 @@ export {
ClientWritableStream,
ClientDuplexStream,
CallOptions,
MethodDefinition,
StatusObject,
ServiceError,
ServerUnaryCall,

View File

@ -18,6 +18,7 @@
import { ChannelCredentials } from './channel-credentials';
import { ChannelOptions } from './channel-options';
import { Client } from './client';
import { UntypedServiceImplementation } from './server';
export interface Serialize<T> {
(value: T): Buffer;
@ -49,10 +50,12 @@ export interface MethodDefinition<RequestType, ResponseType>
extends ClientMethodDefinition<RequestType, ResponseType>,
ServerMethodDefinition<RequestType, ResponseType> {}
export interface ServiceDefinition {
export type ServiceDefinition<
ImplementationType = UntypedServiceImplementation
> = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[index: string]: MethodDefinition<any, any>;
}
readonly [index in keyof ImplementationType]: MethodDefinition<any, any>;
};
export interface ProtobufTypeDefinition {
format: string;