Socket
Socket
Sign inDemoInstall

nice-grpc-web

Package Overview
Dependencies
7
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 2.0.0

8

lib/client/createBidiStreamingMethod.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -10,3 +7,2 @@ exports.createBidiStreamingMethod = void 0;

const abort_controller_x_1 = require("abort-controller-x");
const node_abort_controller_1 = __importDefault(require("node-abort-controller"));
const AsyncSink_1 = require("../utils/AsyncSink");

@@ -29,4 +25,4 @@ const service_definitions_1 = require("../service-definitions");

}
const { metadata = (0, nice_grpc_common_1.Metadata)(), signal = new node_abort_controller_1.default().signal, onHeader, onTrailer, } = options;
const pipeAbortController = new node_abort_controller_1.default();
const { metadata = (0, nice_grpc_common_1.Metadata)(), signal = new AbortController().signal, onHeader, onTrailer, } = options;
const pipeAbortController = new AbortController();
const sink = new AsyncSink_1.AsyncSink();

@@ -33,0 +29,0 @@ const client = grpc_web_1.grpc.client(grpcMethodDefinition, {

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -10,3 +7,2 @@ exports.createClientStreamingMethod = void 0;

const abort_controller_x_1 = require("abort-controller-x");
const node_abort_controller_1 = __importDefault(require("node-abort-controller"));
const service_definitions_1 = require("../service-definitions");

@@ -28,5 +24,5 @@ const isAsyncIterable_1 = require("../utils/isAsyncIterable");

}
const { metadata = (0, nice_grpc_common_1.Metadata)(), signal = new node_abort_controller_1.default().signal, onHeader, onTrailer, } = options;
const { metadata = (0, nice_grpc_common_1.Metadata)(), signal = new AbortController().signal, onHeader, onTrailer, } = options;
return await (0, abort_controller_x_1.execute)(signal, (resolve, reject) => {
const pipeAbortController = new node_abort_controller_1.default();
const pipeAbortController = new AbortController();
let response;

@@ -33,0 +29,0 @@ const client = grpc_web_1.grpc.client(grpcMethodDefinition, {

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -11,3 +8,2 @@ exports.createServerStreamingMethod = void 0;

const nice_grpc_common_1 = require("nice-grpc-common");
const node_abort_controller_1 = __importDefault(require("node-abort-controller"));
const service_definitions_1 = require("../service-definitions");

@@ -29,3 +25,3 @@ const convertMetadata_1 = require("../utils/convertMetadata");

}
const { metadata = (0, nice_grpc_common_1.Metadata)(), signal = new node_abort_controller_1.default().signal, onHeader, onTrailer, } = options;
const { metadata = (0, nice_grpc_common_1.Metadata)(), signal = new AbortController().signal, onHeader, onTrailer, } = options;
const sink = new AsyncSink_1.AsyncSink();

@@ -32,0 +28,0 @@ const client = grpc_web_1.grpc.client(grpcMethodDefinition, {

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -10,3 +7,2 @@ exports.createUnaryMethod = void 0;

const abort_controller_x_1 = require("abort-controller-x");
const node_abort_controller_1 = __importDefault(require("node-abort-controller"));
const service_definitions_1 = require("../service-definitions");

@@ -28,3 +24,3 @@ const isAsyncIterable_1 = require("../utils/isAsyncIterable");

}
const { metadata = (0, nice_grpc_common_1.Metadata)(), signal = new node_abort_controller_1.default().signal, onHeader, onTrailer, } = options;
const { metadata = (0, nice_grpc_common_1.Metadata)(), signal = new AbortController().signal, onHeader, onTrailer, } = options;
return await (0, abort_controller_x_1.execute)(signal, (resolve, reject) => {

@@ -31,0 +27,0 @@ let response;

@@ -5,8 +5,8 @@ The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

@@ -17,7 +17,6 @@ The above copyright notice and this permission notice shall be included in all

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{
"name": "nice-grpc-web",
"version": "1.1.0",
"version": "2.0.0",
"description": "A Browser gRPC library that is nice to you",

@@ -55,8 +55,7 @@ "keywords": [

"@improbable-eng/grpc-web": "^0.15.0",
"abort-controller-x": "^0.2.6",
"abort-controller-x": "^0.4.0",
"js-base64": "^3.7.2",
"nice-grpc-common": "^1.1.0",
"node-abort-controller": "^2.0.0"
"nice-grpc-common": "^2.0.0"
},
"gitHead": "77acb86429dbf13439b3335812c9b01daef94641"
"gitHead": "0174f605350065a6d9f89df38c6694ba75b891ac"
}

@@ -32,2 +32,9 @@ # nice-grpc-web [![npm version][npm-image]][npm-url] <!-- omit in toc -->

## Prerequisites
Global
[`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController)
is required. A [polyfill](https://www.npmjs.com/package/abort-controller) is
available for older browsers.
## Installation

@@ -277,3 +284,2 @@

```ts
import AbortController from 'node-abort-controller';
import {isAbortError} from 'abort-controller-x';

@@ -280,0 +286,0 @@

@@ -12,3 +12,3 @@ import {CallOptions} from 'nice-grpc-common';

Service extends CompatServiceDefinition,
CallOptionsExt = {}
CallOptionsExt = {},
> = RawClient<NormalizedServiceDefinition<Service>, CallOptionsExt>;

@@ -18,3 +18,3 @@

Service extends ServiceDefinition,
CallOptionsExt = {}
CallOptionsExt = {},
> = {

@@ -26,3 +26,3 @@ [Method in keyof Service]: ClientMethod<Service[Method], CallOptionsExt>;

Definition extends MethodDefinition<any, any, any, any>,
CallOptionsExt = {}
CallOptionsExt = {},
> = Definition['requestStream'] extends false

@@ -66,3 +66,3 @@ ? Definition['responseStream'] extends false

ResponseOut,
CallOptionsExt = {}
CallOptionsExt = {},
> = (

@@ -76,3 +76,3 @@ request: RequestIn,

ResponseOut,
CallOptionsExt = {}
CallOptionsExt = {},
> = (

@@ -86,3 +86,3 @@ request: AsyncIterable<RequestIn>,

ResponseOut,
CallOptionsExt = {}
CallOptionsExt = {},
> = (

@@ -89,0 +89,0 @@ request: AsyncIterable<RequestIn>,

@@ -11,3 +11,2 @@ import {

import {AbortError, isAbortError, throwIfAborted} from 'abort-controller-x';
import AbortController from 'node-abort-controller';
import {AsyncSink} from '../utils/AsyncSink';

@@ -14,0 +13,0 @@ import {

@@ -11,3 +11,2 @@ import {

import {execute, isAbortError, throwIfAborted} from 'abort-controller-x';
import AbortController from 'node-abort-controller';
import {

@@ -98,3 +97,3 @@ AnyMethodDefinition,

reject(err);
client.close();
client.close();
}

@@ -101,0 +100,0 @@ },

@@ -12,3 +12,2 @@ import {grpc} from '@improbable-eng/grpc-web';

} from 'nice-grpc-common';
import AbortController from 'node-abort-controller';
import {

@@ -15,0 +14,0 @@ MethodDefinition,

@@ -11,3 +11,2 @@ import {

import {execute} from 'abort-controller-x';
import AbortController from 'node-abort-controller';
import {

@@ -63,3 +62,3 @@ MethodDefinition,

host: channel.address,
transport: channel.transport,
transport: channel.transport,
});

@@ -66,0 +65,0 @@

@@ -24,3 +24,3 @@ import {grpc} from '@improbable-eng/grpc-web';

RequestStream extends boolean = boolean,
ResponseStream extends boolean = boolean
ResponseStream extends boolean = boolean,
> = {

@@ -47,3 +47,3 @@ path: string;

export type NormalizedServiceDefinition<
Service extends CompatServiceDefinition
Service extends CompatServiceDefinition,
> = Service extends ServiceDefinition

@@ -50,0 +50,0 @@ ? Service

@@ -32,12 +32,11 @@ import {CompatServiceDefinition, MethodDefinition, ServiceDefinition} from '.';

export type TsProtoMessageIn<
Type extends TsProtoMessageType<any>
> = Type['fromPartial'] extends Function
? Parameters<Type['fromPartial']>[0]
: Type extends TsProtoMessageType<infer Message>
? Message
: never;
export type TsProtoMessageIn<Type extends TsProtoMessageType<any>> =
Type['fromPartial'] extends Function
? Parameters<Type['fromPartial']>[0]
: Type extends TsProtoMessageType<infer Message>
? Message
: never;
export type FromTsProtoServiceDefinition<
Service extends TsProtoServiceDefinition
Service extends TsProtoServiceDefinition,
> = {

@@ -49,14 +48,13 @@ [M in keyof Service['methods']]: FromTsProtoMethodDefinition<

export type FromTsProtoMethodDefinition<
Method
> = Method extends TsProtoMethodDefinition<infer Request, infer Response>
? MethodDefinition<
TsProtoMessageIn<Method['requestType']>,
Request,
TsProtoMessageIn<Method['responseType']>,
Response,
Method['requestStream'],
Method['responseStream']
>
: never;
export type FromTsProtoMethodDefinition<Method> =
Method extends TsProtoMethodDefinition<infer Request, infer Response>
? MethodDefinition<
TsProtoMessageIn<Method['requestType']>,
Request,
TsProtoMessageIn<Method['responseType']>,
Response,
Method['requestStream'],
Method['responseStream']
>
: never;

@@ -63,0 +61,0 @@ export function fromTsProtoServiceDefinition(

@@ -25,3 +25,3 @@ import {grpc} from '@improbable-eng/grpc-web';

for (const [key, values] of Object.entries(grpcMetadata.headersMap)) {
for (const [key, values] of Object.entries(grpcMetadata.headersMap)) {
metadata.set(

@@ -28,0 +28,0 @@ key,

import {MethodDefinition} from '../service-definitions';
export type MethodRequestIn<
Definition extends MethodDefinition<any, any, any, any>
Definition extends MethodDefinition<any, any, any, any>,
> = Definition extends MethodDefinition<infer T, any, any, any> ? T : never;
export type MethodRequestOut<
Definition extends MethodDefinition<any, any, any, any>
Definition extends MethodDefinition<any, any, any, any>,
> = Definition extends MethodDefinition<any, infer T, any, any> ? T : never;
export type MethodResponseIn<
Definition extends MethodDefinition<any, any, any, any>
Definition extends MethodDefinition<any, any, any, any>,
> = Definition extends MethodDefinition<any, any, infer T, any> ? T : never;
export type MethodResponseOut<
Definition extends MethodDefinition<any, any, any, any>
Definition extends MethodDefinition<any, any, any, any>,
> = Definition extends MethodDefinition<any, any, any, infer T> ? T : never;

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

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