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

r19

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

r19 - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

5

dist/createRPCMiddleware.d.ts

@@ -1,5 +0,6 @@

import { Request, Response, NextFunction } from "express";
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "node:http";
import { Procedures } from "./types";
export type RPCMiddleware<TProcedures extends Procedures> = {
(req: Request, res: Response, next: NextFunction): void;
(req: IncomingMessage, res: ServerResponse, next: (err?: Error) => any): void;
_procedures: TProcedures;

@@ -6,0 +7,0 @@ };

import { Buffer } from "node:buffer";
import { handleRPCRequest } from "./handleRPCRequest.js";
const createRPCMiddleware = (args) => {
const fn = (req, res) => {
const fn = (req, res, next) => {
if (req.method !== "POST") {
res.statusCode = 405;
res.end();
return;
return next();
}

@@ -26,2 +26,3 @@ const requestBodyChunks = [];

res.end(Buffer.from(body), "binary");
next();
});

@@ -28,0 +29,0 @@ };

{
"name": "r19",
"version": "0.1.5",
"version": "0.1.6",
"description": "Simple remote procedure calls in TypeScript",

@@ -65,2 +65,3 @@ "keywords": [

"devDependencies": {
"@fastify/middie": "^8.1.0",
"@size-limit/preset-small-lib": "^8.1.1",

@@ -76,2 +77,4 @@ "@types/express": "^4.17.15",

"express": "^4.18.2",
"fastify": "^4.11.0",
"h3": "^1.0.2",
"msw": "^0.49.2",

@@ -78,0 +81,0 @@ "node-fetch": "^3.3.0",

11

src/createRPCMiddleware.ts
import { Buffer } from "node:buffer";
import { Request, Response, NextFunction } from "express";
import { IncomingMessage, ServerResponse } from "node:http";

@@ -8,3 +8,4 @@ import { Procedures } from "./types";

export type RPCMiddleware<TProcedures extends Procedures> = {
(req: Request, res: Response, next: NextFunction): void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(req: IncomingMessage, res: ServerResponse, next: (err?: Error) => any): void;
_procedures: TProcedures;

@@ -20,3 +21,3 @@ };

): RPCMiddleware<TProcedures> => {
const fn: RPCMiddleware<TProcedures> = (req, res) => {
const fn: RPCMiddleware<TProcedures> = (req, res, next) => {
if (req.method !== "POST") {

@@ -27,3 +28,3 @@ res.statusCode = 405;

return;
return next();
}

@@ -52,2 +53,4 @@

res.end(Buffer.from(body), "binary");
next();
});

@@ -54,0 +57,0 @@ };

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc