Skip to content
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 packages/grpc-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "1.8.17",
"version": "1.8.18",
"description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
Expand Down
12 changes: 2 additions & 10 deletions packages/grpc-js/src/channel-credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ export type CheckServerIdentityCallback = (
cert: PeerCertificate
) => Error | undefined;

function bufferOrNullEqual(buf1: Buffer | null, buf2: Buffer | null) {
if (buf1 === null && buf2 === null) {
return true;
} else {
return buf1 !== null && buf2 !== null && buf1.equals(buf2);
}
}

/**
* Additional peer verification options that can be set when creating
* SSL credentials.
Expand Down Expand Up @@ -196,7 +188,7 @@ class SecureChannelCredentialsImpl extends ChannelCredentials {
private verifyOptions: VerifyOptions
) {
super();
this.connectionOptions = {
this.connectionOptions = {
secureContext
};
// Node asserts that this option is a function, so we cannot pass undefined
Expand Down Expand Up @@ -225,7 +217,7 @@ class SecureChannelCredentialsImpl extends ChannelCredentials {
}
if (other instanceof SecureChannelCredentialsImpl) {
return (
this.secureContext === other.secureContext &&
this.secureContext === other.secureContext &&
this.verifyOptions.checkServerIdentity === other.verifyOptions.checkServerIdentity
);
} else {
Expand Down
1 change: 0 additions & 1 deletion packages/grpc-js/src/client-interceptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
import { Status } from './constants';
import { Channel } from './channel';
import { CallOptions } from './client';
import { CallCredentials } from './call-credentials';
import { ClientMethodDefinition } from './make-client';
import { getErrorMessage } from './error';

Expand Down
4 changes: 2 additions & 2 deletions packages/grpc-js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,13 @@ export class Client {
code: Status.INTERNAL,
details: 'No message received',
metadata: status.metadata
}, /*callerStack*/''));
}, callerStack));
} else {
callProperties.callback!(null, responseMessage);
}
} else {
const callerStack = getErrorStackString(callerStackError!);
callProperties.callback!(callErrorFromStatus(status, /*callerStack*/''));
callProperties.callback!(callErrorFromStatus(status, callerStack));
}
/* Avoid retaining the callerStackError object in the call context of
* the status event handler. */
Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-js/src/compression-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export class CompressionFilter extends BaseFilter implements Filter {
export class CompressionFilterFactory
implements FilterFactory<CompressionFilter> {
private sharedFilterConfig: SharedCompressionFilterConfig = {};
constructor(private readonly channel: Channel, private readonly options: ChannelOptions) {}
constructor(channel: Channel, private readonly options: ChannelOptions) {}
createFilter(): CompressionFilter {
return new CompressionFilter(this.options, this.sharedFilterConfig);
}
Expand Down
2 changes: 0 additions & 2 deletions packages/grpc-js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ import {
loadPackageDefinition,
makeClientConstructor,
MethodDefinition,
ProtobufTypeDefinition,
Serialize,
ServiceClientConstructor,
ServiceDefinition,
} from './make-client';
import { Metadata, MetadataOptions, MetadataValue } from './metadata';
Expand Down
19 changes: 8 additions & 11 deletions packages/grpc-js/src/internal-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ChannelOptions } from './channel-options';
import { ResolvingLoadBalancer } from './resolving-load-balancer';
import { SubchannelPool, getSubchannelPool } from './subchannel-pool';
import { ChannelControlHelper } from './load-balancer';
import { UnavailablePicker, Picker, PickResultType } from './picker';
import { UnavailablePicker, Picker } from './picker';
import { Metadata } from './metadata';
import { Status, LogVerbosity, Propagate } from './constants';
import { FilterStackFactory } from './filter-stack';
Expand All @@ -31,22 +31,19 @@ import {
getDefaultAuthority,
mapUriDefaultScheme,
} from './resolver';
import { trace, log } from './logging';
import { trace } from './logging';
import { SubchannelAddress } from './subchannel-address';
import { MaxMessageSizeFilterFactory } from './max-message-size-filter';
import { mapProxyName } from './http_proxy';
import { GrpcUri, parseUri, splitHostPort, uriToString } from './uri-parser';
import { GrpcUri, parseUri, uriToString } from './uri-parser';
import { ServerSurfaceCall } from './server-call';
import { Filter } from './filter';

import { ConnectivityState } from './connectivity-state';
import { ChannelInfo, ChannelRef, ChannelzCallTracker, ChannelzChildrenTracker, ChannelzTrace, registerChannelzChannel, SubchannelRef, unregisterChannelzRef } from './channelz';
import { Subchannel } from './subchannel';
import { LoadBalancingCall } from './load-balancing-call';
import { CallCredentials } from './call-credentials';
import { Call, CallStreamOptions, InterceptingListener, MessageContext, StatusObject } from './call-interface';
import { SubchannelCall } from './subchannel-call';
import { Deadline, deadlineToString, getDeadlineTimeoutString } from './deadline';
import { Call, CallStreamOptions, StatusObject } from './call-interface';
import { Deadline, deadlineToString } from './deadline';
import { ResolvingCall } from './resolving-call';
import { getNextCallNumber } from './call-number';
import { restrictControlPlaneStatusCode } from './control-plane-status';
Expand Down Expand Up @@ -112,7 +109,7 @@ class ChannelSubchannelWrapper extends BaseSubchannelWrapper implements Subchann
}

export class InternalChannel {

private resolvingLoadBalancer: ResolvingLoadBalancer;
private subchannelPool: SubchannelPool;
private connectivityState: ConnectivityState = ConnectivityState.IDLE;
Expand Down Expand Up @@ -376,7 +373,7 @@ export class InternalChannel {
trace(
LogVerbosity.DEBUG,
'connectivity_state',
'(' + this.channelzRef.id + ') ' +
'(' + this.channelzRef.id + ') ' +
uriToString(this.target) +
' ' +
ConnectivityState[this.connectivityState] +
Expand Down Expand Up @@ -601,7 +598,7 @@ export class InternalChannel {
/**
* Get the channelz reference object for this channel. The returned value is
* garbage if channelz is disabled for this channel.
* @returns
* @returns
*/
getChannelzRef() {
return this.channelzRef;
Expand Down
4 changes: 1 addition & 3 deletions packages/grpc-js/src/load-balancer-outlier-detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ import { ConnectivityState } from "./connectivity-state";
import { LogVerbosity, Status } from "./constants";
import { durationToMs, isDuration, msToDuration } from "./duration";
import { ChannelControlHelper, createChildChannelControlHelper, registerLoadBalancerType } from "./experimental";
import { BaseFilter, Filter, FilterFactory } from "./filter";
import { getFirstUsableConfig, LoadBalancer, LoadBalancingConfig, validateLoadBalancingConfig } from "./load-balancer";
import { ChildLoadBalancerHandler } from "./load-balancer-child-handler";
import { PickArgs, Picker, PickResult, PickResultType, QueuePicker, UnavailablePicker } from "./picker";
import { Subchannel } from "./subchannel";
import { PickArgs, Picker, PickResult, PickResultType } from "./picker";
import { SubchannelAddress, subchannelAddressToString } from "./subchannel-address";
import { BaseSubchannelWrapper, ConnectivityStateListener, SubchannelInterface } from "./subchannel-interface";
import * as logging from './logging';
Expand Down
5 changes: 2 additions & 3 deletions packages/grpc-js/src/load-balancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/

import { ChannelOptions } from './channel-options';
import { Subchannel } from './subchannel';
import { SubchannelAddress } from './subchannel-address';
import { ConnectivityState } from './connectivity-state';
import { Picker } from './picker';
Expand Down Expand Up @@ -58,8 +57,8 @@ export interface ChannelControlHelper {
* parent while letting others pass through to the parent unmodified. This
* allows other code to create these children without needing to know about
* all of the methods to be passed through.
* @param parent
* @param overrides
* @param parent
* @param overrides
*/
export function createChildChannelControlHelper(parent: ChannelControlHelper, overrides: Partial<ChannelControlHelper>): ChannelControlHelper {
return {
Expand Down
10 changes: 4 additions & 6 deletions packages/grpc-js/src/load-balancing-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { SubchannelCall } from "./subchannel-call";
import { ConnectivityState } from "./connectivity-state";
import { LogVerbosity, Status } from "./constants";
import { Deadline, getDeadlineTimeoutString } from "./deadline";
import { FilterStack, FilterStackFactory } from "./filter-stack";
import { InternalChannel } from "./internal-channel";
import { Metadata } from "./metadata";
import { PickResultType } from "./picker";
Expand All @@ -48,7 +47,6 @@ export class LoadBalancingCall implements Call {
private readPending = false;
private pendingMessage: {context: MessageContext, message: Buffer} | null = null;
private pendingHalfClose = false;
private pendingChildStatus: StatusObject | null = null;
private ended = false;
private serviceUrl: string;
private metadata: Metadata | null = null;
Expand Down Expand Up @@ -104,9 +102,9 @@ export class LoadBalancingCall implements Call {
}
this.trace('Pick called')
const pickResult = this.channel.doPick(this.metadata, this.callConfig.pickInformation);
const subchannelString = pickResult.subchannel ?
'(' + pickResult.subchannel.getChannelzRef().id + ') ' + pickResult.subchannel.getAddress() :
'' + pickResult.subchannel;
const subchannelString = pickResult.subchannel ?
'(' + pickResult.subchannel.getChannelzRef().id + ') ' + pickResult.subchannel.getAddress() :
'' + pickResult.subchannel;
this.trace(
'Pick result: ' +
PickResultType[pickResult.pickResultType] +
Expand Down Expand Up @@ -280,4 +278,4 @@ export class LoadBalancingCall implements Call {
getCallNumber(): number {
return this.callNumber;
}
}
}
2 changes: 1 addition & 1 deletion packages/grpc-js/src/max-message-size-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class MaxMessageSizeFilter extends BaseFilter implements Filter {
private maxSendMessageSize: number = DEFAULT_MAX_SEND_MESSAGE_LENGTH;
private maxReceiveMessageSize: number = DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;
constructor(
private readonly options: ChannelOptions
options: ChannelOptions
) {
super();
if ('grpc.max_send_message_length' in options) {
Expand Down
5 changes: 0 additions & 5 deletions packages/grpc-js/src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,6 @@ export class Metadata {
return result;
}

// For compatibility with the other Metadata implementation
private _getCoreRepresentation() {
return this.internalRepr;
}

/**
* This modifies the behavior of JSON.stringify to show an object
* representation of the metadata map.
Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-js/src/object-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

import { Duplex, Readable, Writable } from 'stream';
import { Readable, Writable } from 'stream';
import { EmitterAugmentation1 } from './events';

/* eslint-disable @typescript-eslint/no-explicit-any */
Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-js/src/resolver-ip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class IpResolver implements Resolver {
private addresses: SubchannelAddress[] = [];
private error: StatusObject | null = null;
constructor(
private target: GrpcUri,
target: GrpcUri,
private listener: ResolverListener,
channelOptions: ChannelOptions
) {
Expand Down
4 changes: 2 additions & 2 deletions packages/grpc-js/src/resolving-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { CallCredentials } from "./call-credentials";
import { Call, CallStreamOptions, InterceptingListener, MessageContext, StatusObject } from "./call-interface";
import { LogVerbosity, Propagate, Status } from "./constants";
import { Deadline, deadlineToString, getDeadlineTimeoutString, getRelativeTimeout, minDeadline } from "./deadline";
import { Deadline, deadlineToString, getRelativeTimeout, minDeadline } from "./deadline";
import { FilterStack, FilterStackFactory } from "./filter-stack";
import { InternalChannel } from "./internal-channel";
import { Metadata } from "./metadata";
Expand Down Expand Up @@ -276,4 +276,4 @@ export class ResolvingCall implements Call {
getCallNumber(): number {
return this.callNumber;
}
}
}
5 changes: 1 addition & 4 deletions packages/grpc-js/src/resolving-load-balancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,13 @@ import { SubchannelAddress } from './subchannel-address';
import { GrpcUri, uriToString } from './uri-parser';
import { ChildLoadBalancerHandler } from './load-balancer-child-handler';
import { ChannelOptions } from './channel-options';
import { PickFirstLoadBalancingConfig } from './load-balancer-pick-first';

const TRACER_NAME = 'resolving_load_balancer';

function trace(text: string): void {
logging.trace(LogVerbosity.DEBUG, TRACER_NAME, text);
}

const DEFAULT_LOAD_BALANCER_NAME = 'pick_first';

function getDefaultConfigSelector(
serviceConfig: ServiceConfig | null
): ConfigSelector {
Expand Down Expand Up @@ -137,7 +134,7 @@ export class ResolvingLoadBalancer implements LoadBalancer {
constructor(
private readonly target: GrpcUri,
private readonly channelControlHelper: ChannelControlHelper,
private readonly channelOptions: ChannelOptions,
channelOptions: ChannelOptions,
private readonly onSuccessfulResolution: ResolutionCallback,
private readonly onFailedResolution: ResolutionFailureCallback
) {
Expand Down
7 changes: 5 additions & 2 deletions packages/grpc-js/src/server-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ export class ServerDuplexStreamImpl<RequestType, ResponseType>
implements ServerDuplexStream<RequestType, ResponseType>
{
cancelled: boolean;
/* This field appears to be unsued, but it is actually used in _final, which is assiged from
* ServerWritableStreamImpl.prototype._final below. */
// @ts-ignore noUnusedLocals
private trailingMetadata: Metadata;

constructor(
Expand Down Expand Up @@ -419,7 +422,7 @@ export class Http2ServerCallStream<
constructor(
private stream: http2.ServerHttp2Stream,
private handler: Handler<RequestType, ResponseType>,
private options: ChannelOptions
options: ChannelOptions
) {
super();

Expand Down Expand Up @@ -720,7 +723,7 @@ export class Http2ServerCallStream<
[GRPC_MESSAGE_HEADER]: encodeURI(statusObj.details),
...statusObj.metadata?.toHttp2Headers(),
};

this.stream.sendTrailers(trailersToSend);
this.statusSent = true;
});
Expand Down
Loading