Socket
Socket
Sign inDemoInstall

@effect/rpc-http-node

Package Overview
Dependencies
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/rpc-http-node - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

9

package.json
{
"name": "@effect/rpc-http-node",
"version": "0.7.0",
"version": "0.8.0",
"description": "",

@@ -28,9 +28,8 @@ "license": "MIT",

"dependencies": {
"@effect/rpc": "^0.7.0",
"@effect/rpc-http": "^0.7.0"
"@effect/rpc": "^0.8.0",
"@effect/rpc-http": "^0.8.0"
},
"peerDependencies": {
"@effect/data": "^0.18.6",
"@effect/io": "^0.41.0"
"effect": "2.0.0-next.37"
}
}
/// <reference types="node" />
import * as Effect from "@effect/io/Effect";
import type { Span } from "@effect/io/Tracer";
/**
* @since 1.0.0
*/
import type { HttpRequest } from "@effect/rpc-http/Server";
import type { RpcHandlers, RpcRouter } from "@effect/rpc/Router";
import * as Effect from "effect/Effect";
import type { Span } from "effect/Tracer";
import type { IncomingMessage, ServerResponse } from "node:http";

@@ -7,0 +10,0 @@ export {

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

exports.make = make;
var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Effect"));
var Server = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/rpc-http/Server"));
var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Effect"));
var _Function = /*#__PURE__*/require("effect/Function");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
/**
* @since 1.0.0
*/
/**
* @category constructors

@@ -29,6 +26,7 @@ * @since 1.0.0

return function handleRequestResponse(request, response) {
return Effect.catchAllCause(cause => Effect.flatMap(Effect.logError(cause), () => Effect.sync(() => {
response.writeHead(500);
response.end();
})))(Effect.tap(responses => Effect.sync(() => {
return (0, _Function.pipe)(bodyToString(request), Effect.flatMap(parseJson), Effect.flatMap(body => handler({
url: request.url,
headers: new Headers(request.headers),
body
})), Effect.tap(responses => Effect.sync(() => {
response.writeHead(200, {

@@ -38,7 +36,6 @@ "Content-Type": "application/json; charset=utf-8"

response.end(JSON.stringify(responses));
}))(Effect.flatMap(body => handler({
url: request.url,
headers: new Headers(request.headers),
body
}))(Effect.flatMap(parseJson)(bodyToString(request)))));
})), Effect.catchAllCause(cause => Effect.flatMap(Effect.logError(cause), () => Effect.sync(() => {
response.writeHead(500);
response.end();
}))));
};

@@ -45,0 +42,0 @@ }

/**
* @since 1.0.0
*/
import { pipe } from "@effect/data/Function"
import * as Effect from "@effect/io/Effect"
import type { Span } from "@effect/io/Tracer"
import type { HttpRequest } from "@effect/rpc-http/Server"

@@ -11,2 +8,5 @@ import * as Server from "@effect/rpc-http/Server"

import type { RpcServer } from "@effect/rpc/Server"
import * as Effect from "effect/Effect"
import { pipe } from "effect/Function"
import type { Span } from "effect/Tracer"
import type { IncomingMessage, ServerResponse } from "node:http"

@@ -13,0 +13,0 @@ import type { Readable } from "node:stream"

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc