@effect/rpc-http-node
Advanced tools
Comparing version 0.7.0 to 0.8.0
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26466
3
402
+ Added@effect/rpc@0.8.1(transitive)
+ Added@effect/rpc-http@0.8.1(transitive)
+ Added@effect/schema@0.39.2(transitive)
+ Addedeffect@2.0.0-next.372.4.19(transitive)
- Removed@effect/data@0.18.7(transitive)
- Removed@effect/io@0.40.30.41.2(transitive)
- Removed@effect/rpc@0.7.0(transitive)
- Removed@effect/rpc-http@0.7.0(transitive)
- Removed@effect/schema@0.35.1(transitive)
Updated@effect/rpc@^0.8.0
Updated@effect/rpc-http@^0.8.0