Socket
Socket
Sign inDemoInstall

@grpc/grpc-js

Package Overview
Dependencies
Maintainers
3
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grpc/grpc-js - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

10

build/src/call-credentials-filter.d.ts

@@ -1,2 +0,1 @@

import { CallCredentials } from './call-credentials';
import { Call } from './call-stream';

@@ -7,13 +6,12 @@ import { Http2Channel } from './channel';

export declare class CallCredentialsFilter extends BaseFilter implements Filter {
private readonly credentials;
private readonly host;
private readonly path;
private readonly channel;
private readonly stream;
private serviceUrl;
constructor(credentials: CallCredentials, host: string, path: string);
constructor(channel: Http2Channel, stream: Call);
sendMetadata(metadata: Promise<Metadata>): Promise<Metadata>;
}
export declare class CallCredentialsFilterFactory implements FilterFactory<CallCredentialsFilter> {
private readonly credentials;
private readonly channel;
constructor(channel: Http2Channel);
createFilter(callStream: Call): CallCredentialsFilter;
}

22

build/src/call-credentials-filter.js

@@ -13,8 +13,9 @@ "use strict";

class CallCredentialsFilter extends filter_1.BaseFilter {
constructor(credentials, host, path) {
constructor(channel, stream) {
super();
this.credentials = credentials;
this.host = host;
this.path = path;
const splitPath = path.split('/');
this.channel = channel;
this.stream = stream;
this.channel = channel;
this.stream = stream;
const splitPath = stream.getMethod().split('/');
let serviceName = '';

@@ -29,7 +30,10 @@ /* The standard path format is "/{serviceName}/{methodName}", so if we split

* can assume that the scheme is "https" */
this.serviceUrl = `https://${host}/${serviceName}`;
this.serviceUrl = `https://${stream.getHost()}/${serviceName}`;
}
sendMetadata(metadata) {
return __awaiter(this, void 0, void 0, function* () {
const credsMetadata = this.credentials.generateMetadata({ service_url: this.serviceUrl });
const channelCredentials = this.channel.credentials._getCallCredentials();
const streamCredentials = this.stream.getCredentials();
const credentials = channelCredentials.compose(streamCredentials);
const credsMetadata = credentials.generateMetadata({ service_url: this.serviceUrl });
const resultMetadata = yield metadata;

@@ -44,6 +48,6 @@ resultMetadata.merge(yield credsMetadata);

constructor(channel) {
this.credentials = channel.credentials._getCallCredentials();
this.channel = channel;
}
createFilter(callStream) {
return new CallCredentialsFilter(this.credentials.compose(callStream.getCredentials()), callStream.getHost(), callStream.getMethod());
return new CallCredentialsFilter(this.channel, callStream);
}

@@ -50,0 +54,0 @@ }

@@ -178,4 +178,2 @@ "use strict";

}
delete headers[HTTP2_HEADER_STATUS];
delete headers[HTTP2_HEADER_CONTENT_TYPE];
if (flags & http2.constants.NGHTTP2_FLAG_END_STREAM) {

@@ -182,0 +180,0 @@ this.handleTrailers(headers);

@@ -183,2 +183,6 @@ "use strict";

lodash_1.forOwn(headers, (values, key) => {
// Reserved headers (beginning with `:`) are not valid keys.
if (key.charAt(0) === ':') {
return;
}
if (isBinaryKey(key)) {

@@ -185,0 +189,0 @@ if (Array.isArray(values)) {

{
"name": "@grpc/grpc-js",
"version": "0.3.0",
"version": "0.3.1",
"description": "gRPC Library for Node - pure JS implementation",

@@ -5,0 +5,0 @@ "homepage": "https://grpc.io/",

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