Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pbkit/runtime

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pbkit/runtime - npm Package Compare versions

Comparing version 0.0.33 to 0.0.34

1

async/async-generator.d.ts
export declare function fromSingle<T>(value: T): AsyncGenerator<T>;
export declare function first<T>(generator: AsyncGenerator<T>): Promise<T>;
export declare function map<T>(asyncGenerator: AsyncGenerator<T>, fn: (value: T) => T | Promise<T>): AsyncGenerator<T>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.map = exports.first = exports.fromSingle = void 0;
exports.first = exports.fromSingle = void 0;
async function* fromSingle(value) {

@@ -15,6 +15,1 @@ yield value;

exports.first = first;
async function* map(asyncGenerator, fn) {
for await (const value of asyncGenerator)
yield await fn(value);
}
exports.map = map;

10

client-devtools.d.ts

@@ -30,2 +30,7 @@ import type { RpcClientImpl } from "./rpc";

};
"request-error": {
configId: string;
requestId: number;
errorMessage: string;
};
"response": {

@@ -42,2 +47,7 @@ configId: string;

};
"response-error": {
configId: string;
requestId: number;
errorMessage: string;
};
"response-trailer": {

@@ -44,0 +54,0 @@ configId: string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapRpcClientImpl = exports.getDevtoolsConfig = exports.devtoolsKey = void 0;
const async_generator_1 = require("./async/async-generator");
const event_emitter_1 = require("./async/event-emitter");

@@ -43,4 +42,4 @@ exports.devtoolsKey = "@pbkit/devtools";

devtoolsConfig.emit("request", {
configId,
requestId,
configId,
servicePath: methodDescriptor.service.serviceName,

@@ -51,24 +50,36 @@ rpcName: methodDescriptor.methodName,

});
const rpcMethodResult = rpcMethodImpl((0, async_generator_1.map)(req, (payload) => {
const rpcMethodResult = rpcMethodImpl(mapAsyncGenerator(req, (payload) => {
devtoolsConfig.emit("request-payload", {
configId,
requestId,
configId,
payloadJson: toJson(payload),
payloadJson: methodDescriptor.requestType.serializeJson(payload),
payloadProto: methodDescriptor.requestType.serializeBinary(payload),
});
return payload;
}, (error) => {
devtoolsConfig.emit("request-error", {
configId,
requestId,
errorMessage: getErrorMessage(error),
});
}), metadata);
const resAsyncGenerator = (0, async_generator_1.map)(rpcMethodResult[0], (payload) => {
const resAsyncGenerator = mapAsyncGenerator(rpcMethodResult[0], (payload) => {
devtoolsConfig.emit("response-payload", {
configId,
requestId,
configId,
payloadJson: toJson(payload),
payloadJson: methodDescriptor.responseType.serializeJson(payload),
payloadProto: methodDescriptor.responseType.serializeBinary(payload),
});
return payload;
}, (error) => {
devtoolsConfig.emit("response-error", {
configId,
requestId,
errorMessage: getErrorMessage(error),
});
});
const headerPromise = rpcMethodResult[1].then((header) => {
devtoolsConfig.emit("response", {
configId,
requestId,
configId,
headerJson: toJson(header),

@@ -80,4 +91,4 @@ });

devtoolsConfig.emit("response-trailer", {
configId,
requestId,
configId,
trailerJson: toJson(trailer),

@@ -97,1 +108,17 @@ });

}
async function* mapAsyncGenerator(asyncGenerator, fn, catchFn) {
try {
for await (const value of asyncGenerator) {
yield await fn(value);
}
}
catch (error) {
catchFn(error);
throw error;
}
}
function getErrorMessage(error) {
if (error instanceof Error)
return error.stack || error.message;
return String(error);
}
{
"name": "@pbkit/runtime",
"version": "0.0.33",
"version": "0.0.34",
"author": "JongChan Choi <jong@chan.moe>",

@@ -5,0 +5,0 @@ "license": "(MIT OR Apache-2.0)",

@@ -16,2 +16,3 @@ export declare type Method<TMetadata = any, THeader = any, TTrailer = any, TServiceName extends string = string, TMethodName extends string = string, TRequestStream extends boolean = boolean, TResponseStream extends boolean = boolean, TReq = any, TRes = any> = [

deserializeBinary: (value: Uint8Array) => TReq;
serializeJson: (value: TReq) => string;
};

@@ -21,2 +22,3 @@ responseType: {

deserializeBinary: (value: Uint8Array) => TRes;
serializeJson: (value: TRes) => string;
};

@@ -23,0 +25,0 @@ }

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