Socket
Socket
Sign inDemoInstall

grpc-base-client

Package Overview
Dependencies
152
Maintainers
8
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.2 to 2.2.0

3

dist/types.d.ts

@@ -0,3 +1,4 @@

import { FluentAsyncIterable } from '@codibre/fluent-iterable';
import { CallOptions, Metadata, ClientReadableStream, ClientWritableStream, Client } from '@grpc/grpc-js';
export interface GrpcAsyncIterable<T> extends AsyncIterable<T> {
export interface GrpcAsyncIterable<T> extends FluentAsyncIterable<T> {
onMetadata(callback: (metadata: Metadata) => any): void;

@@ -4,0 +5,0 @@ }

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

const grpc_js_1 = require("@grpc/grpc-js");
const fluent_iterable_1 = require("@codibre/fluent-iterable");
function treatMiddlewareResult(result, onEnds, onItems) {

@@ -61,12 +62,15 @@ if (result) {

}
function procOnItem(onItems, result) {
for (const onItem of onItems) {
result = onItem(result);
}
return result;
function procOnItemFactory(onItems) {
return (result) => {
for (const onItem of onItems) {
result = onItem(result);
}
return result;
};
}
async function wrapPromise(promise, onEnds, onItems) {
const procOnItem = procOnItemFactory(onItems);
let ended = false;
try {
return procOnItem(onItems, await promise);
return procOnItem(await promise);
}

@@ -81,21 +85,11 @@ catch (err) {

}
async function* wrapIterable(iterable, onEnds, onItems) {
function wrapIterable(iterable, onEnds, onItems) {
let ended = false;
try {
if (onItems.length) {
for await (const item of iterable) {
yield procOnItem(onItems, item);
}
}
else {
yield* iterable;
}
}
catch (err) {
return (0, fluent_iterable_1.fluentAsync)(iterable)
.map(procOnItemFactory(onItems))
.catch((err) => {
ended = true;
endingWithError(onEnds, err);
}
finally {
endingWithoutError(ended, onEnds);
}
return endingWithError(onEnds, err);
})
.finally(() => endingWithoutError(ended, onEnds));
}

@@ -102,0 +96,0 @@ function runWrapped(rawCall, client, newArgs, onEnds, onItems) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.overloadServices = exports.handlePanic = void 0;
const fluent_iterable_1 = require("@codibre/fluent-iterable");
const types_1 = require("./../types");

@@ -33,7 +34,4 @@ const constants_1 = require("@grpc/grpc-js/build/src/constants");

}
async function* getGrpcAsyncIterable(stream, client, config) {
try {
yield* stream;
}
catch (error) {
function getGrpcAsyncIterable(stream, client, config) {
return (0, fluent_iterable_1.fluentAsync)(stream).catch((error) => {
if (panicStatuses.has(error === null || error === void 0 ? void 0 : error.code)) {

@@ -43,3 +41,3 @@ handlePanic(client, config);

throw error;
}
});
}

@@ -46,0 +44,0 @@ function applyPanicHandling(client, serviceName, action, config) {

{
"name": "grpc-base-client",
"description": "This project is a Library base for construct gRPC clients",
"version": "2.1.2",
"version": "2.2.0",
"private": false,

@@ -80,5 +80,5 @@ "author": {

"peerDependencies": {
"grpc": "*",
"@grpc/grpc-js": "*",
"@grpc/proto-loader": "*"
"@grpc/proto-loader": "*",
"grpc": "*"
},

@@ -113,2 +113,3 @@ "peerDependenciesMeta": {

"dependencies": {
"@codibre/fluent-iterable": "*",
"@grpc/grpc-js": "^1.3.1",

@@ -115,0 +116,0 @@ "@grpc/proto-loader": "^0.6.2",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc