@effect/platform-node
Advanced tools
Comparing version 0.13.9 to 0.13.10
@@ -23,3 +23,2 @@ "use strict"; | ||
var ServerRequest = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Http/ServerRequest")); | ||
var ServerResponse = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Http/ServerResponse")); | ||
var Stream = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/stream/Stream")); | ||
@@ -78,14 +77,11 @@ var _nodeStream = /*#__PURE__*/require("node:stream"); | ||
exports.make = make; | ||
const respond = /*#__PURE__*/Middleware.make(httpApp => { | ||
const nonEffectApp = Effect.flatMap(httpApp, ServerResponse.toNonEffectBody); | ||
return Effect.flatMap(ServerRequest.ServerRequest, request => Effect.tapErrorCause(Effect.tap(nonEffectApp, response => handleResponse(request, response)), _cause => Effect.sync(() => { | ||
const nodeResponse = request.response; | ||
if (!nodeResponse.headersSent) { | ||
nodeResponse.writeHead(500); | ||
} | ||
if (!nodeResponse.writableEnded) { | ||
nodeResponse.end(); | ||
} | ||
}))); | ||
}); | ||
const respond = /*#__PURE__*/Middleware.make(httpApp => Effect.flatMap(ServerRequest.ServerRequest, request => Effect.tapErrorCause(Effect.tap(httpApp, response => handleResponse(request, response)), _cause => Effect.sync(() => { | ||
const nodeResponse = request.response; | ||
if (!nodeResponse.headersSent) { | ||
nodeResponse.writeHead(500); | ||
} | ||
if (!nodeResponse.writableEnded) { | ||
nodeResponse.end(); | ||
} | ||
})))); | ||
class ServerRequestImpl extends _incomingMessage.IncomingMessageImpl { | ||
@@ -92,0 +88,0 @@ constructor(source, response, url = source.url, headersOverride) { |
{ | ||
"name": "@effect/platform-node", | ||
"version": "0.13.9", | ||
"version": "0.13.10", | ||
"description": "Unified interfaces for common platform-specific services", | ||
@@ -34,4 +34,4 @@ "license": "MIT", | ||
"@effect/stream": "^0.34.0", | ||
"@effect/platform": "^0.13.9" | ||
"@effect/platform": "^0.13.10" | ||
} | ||
} |
@@ -95,3 +95,3 @@ import * as Context from "@effect/data/Context" | ||
request: ClientRequest.ClientRequest, | ||
body: Body.NonEffect | ||
body: Body.Body | ||
): Effect.Effect<never, Error.RequestError, void> => | ||
@@ -98,0 +98,0 @@ Effect.suspend((): Effect.Effect<never, Error.RequestError, void> => { |
@@ -22,3 +22,3 @@ import type { LazyArg } from "@effect/data/Function" | ||
import * as ServerRequest from "@effect/platform/Http/ServerRequest" | ||
import * as ServerResponse from "@effect/platform/Http/ServerResponse" | ||
import type * as ServerResponse from "@effect/platform/Http/ServerResponse" | ||
import type * as Path from "@effect/platform/Path" | ||
@@ -110,7 +110,6 @@ import * as Stream from "@effect/stream/Stream" | ||
const respond = Middleware.make((httpApp) => { | ||
const nonEffectApp = Effect.flatMap(httpApp, ServerResponse.toNonEffectBody) | ||
return Effect.flatMap(ServerRequest.ServerRequest, (request) => | ||
const respond = Middleware.make((httpApp) => | ||
Effect.flatMap(ServerRequest.ServerRequest, (request) => | ||
Effect.tapErrorCause( | ||
Effect.tap(nonEffectApp, (response) => handleResponse(request, response)), | ||
Effect.tap(httpApp, (response) => handleResponse(request, response)), | ||
(_cause) => | ||
@@ -127,3 +126,3 @@ Effect.sync(() => { | ||
)) | ||
}) | ||
) | ||
@@ -245,6 +244,3 @@ class ServerRequestImpl extends IncomingMessageImpl<Error.RequestError> implements ServerRequest.ServerRequest { | ||
const handleResponse = ( | ||
request: ServerRequest.ServerRequest, | ||
response: ServerResponse.ServerResponse.NonEffectBody | ||
) => | ||
const handleResponse = (request: ServerRequest.ServerRequest, response: ServerResponse.ServerResponse) => | ||
Effect.suspend((): Effect.Effect<never, Error.ResponseError, void> => { | ||
@@ -251,0 +247,0 @@ const nodeResponse = (request as ServerRequestImpl).response |
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
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
424648
6810