@effect/platform
Advanced tools
Comparing version 0.35.0 to 0.36.0
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.serve = exports.make = exports.TypeId = exports.Server = void 0; | ||
exports.serveEffect = exports.serve = exports.make = exports.TypeId = exports.Server = void 0; | ||
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("../internal/http/server.js")); | ||
@@ -54,2 +54,7 @@ function _getRequireWildcardCache(e) { | ||
const serve = exports.serve = internal.serve; | ||
/** | ||
* @since 1.0.0 | ||
* @category accessors | ||
*/ | ||
const serveEffect = exports.serveEffect = internal.serveEffect; | ||
//# sourceMappingURL=Server.js.map |
@@ -6,6 +6,7 @@ "use strict"; | ||
}); | ||
exports.serverTag = exports.serve = exports.make = exports.isServer = exports.TypeId = void 0; | ||
exports.serverTag = exports.serveEffect = exports.serve = exports.make = exports.isServer = exports.TypeId = void 0; | ||
var Context = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Context")); | ||
var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Effect")); | ||
var _Function = /*#__PURE__*/require("effect/Function"); | ||
var Layer = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Layer")); | ||
function _getRequireWildcardCache(e) { | ||
@@ -50,3 +51,5 @@ if ("function" != typeof WeakMap) return null; | ||
exports.make = make; | ||
const serve = exports.serve = /*#__PURE__*/(0, _Function.dual)(args => Effect.isEffect(args[0]), (httpApp, middleware) => Effect.flatMap(serverTag, server => server.serve(httpApp, middleware))); | ||
const serve = exports.serve = /*#__PURE__*/(0, _Function.dual)(args => Effect.isEffect(args[0]), (httpApp, middleware) => Layer.scopedDiscard(Effect.flatMap(serverTag, server => server.serve(httpApp, middleware)))); | ||
/** @internal */ | ||
const serveEffect = exports.serveEffect = /*#__PURE__*/(0, _Function.dual)(args => Effect.isEffect(args[0]), (httpApp, middleware) => Effect.flatMap(serverTag, server => server.serve(httpApp, middleware))); | ||
//# sourceMappingURL=server.js.map |
@@ -6,6 +6,6 @@ /** | ||
import type * as Effect from "effect/Effect"; | ||
import type * as Layer from "effect/Layer"; | ||
import type * as Scope from "effect/Scope"; | ||
import type * as App from "./App.js"; | ||
import type * as Middleware from "./Middleware.js"; | ||
import type * as Error from "./ServerError.js"; | ||
import type * as ServerRequest from "./ServerRequest.js"; | ||
@@ -29,4 +29,4 @@ /** | ||
readonly serve: { | ||
<R, E>(httpApp: App.Default<R, E>): Effect.Effect<Exclude<R, ServerRequest.ServerRequest> | Scope.Scope, Error.ServeError, never>; | ||
<R, E, App extends App.Default<any, any>>(httpApp: App.Default<R, E>, middleware: Middleware.Middleware.Applied<R, E, App>): Effect.Effect<Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest> | Scope.Scope, Error.ServeError, never>; | ||
<R, E>(httpApp: App.Default<R, E>): Effect.Effect<Exclude<R, ServerRequest.ServerRequest> | Scope.Scope, never, void>; | ||
<R, E, App extends App.Default<any, any>>(httpApp: App.Default<R, E>, middleware: Middleware.Middleware.Applied<R, E, App>): Effect.Effect<Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest> | Scope.Scope, never, void>; | ||
}; | ||
@@ -74,3 +74,3 @@ readonly address: Address; | ||
export declare const make: (options: { | ||
readonly serve: (httpApp: App.Default<never, unknown>, middleware?: Middleware.Middleware) => Effect.Effect<Scope.Scope, Error.ServeError, never>; | ||
readonly serve: (httpApp: App.Default<never, unknown>, middleware?: Middleware.Middleware) => Effect.Effect<Scope.Scope, never, void>; | ||
readonly address: Address; | ||
@@ -83,7 +83,17 @@ }) => Server; | ||
export declare const serve: { | ||
(): <R, E>(httpApp: App.Default<R, E>) => Effect.Effect<Server | Scope.Scope | Exclude<R, ServerRequest.ServerRequest>, Error.ServeError, never>; | ||
<R, E, App extends App.Default<any, any>>(middleware: Middleware.Middleware.Applied<R, E, App>): (httpApp: App.Default<R, E>) => Effect.Effect<Server | Scope.Scope | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, Error.ServeError, never>; | ||
<R, E>(httpApp: App.Default<R, E>): Effect.Effect<Server | Scope.Scope | Exclude<R, ServerRequest.ServerRequest>, Error.ServeError, never>; | ||
<R, E, App extends App.Default<any, any>>(httpApp: App.Default<R, E>, middleware: Middleware.Middleware.Applied<R, E, App>): Effect.Effect<Server | Scope.Scope | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, Error.ServeError, never>; | ||
(): <R, E>(httpApp: App.Default<R, E>) => Layer.Layer<Server | Exclude<R, ServerRequest.ServerRequest>, never, never>; | ||
<R, E, App extends App.Default<any, any>>(middleware: Middleware.Middleware.Applied<R, E, App>): (httpApp: App.Default<R, E>) => Layer.Layer<Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, never, never>; | ||
<R, E>(httpApp: App.Default<R, E>): Layer.Layer<Server | Exclude<R, ServerRequest.ServerRequest>, never, never>; | ||
<R, E, App extends App.Default<any, any>>(httpApp: App.Default<R, E>, middleware: Middleware.Middleware.Applied<R, E, App>): Layer.Layer<Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, never, never>; | ||
}; | ||
/** | ||
* @since 1.0.0 | ||
* @category accessors | ||
*/ | ||
export declare const serveEffect: { | ||
(): <R, E>(httpApp: App.Default<R, E>) => Effect.Effect<Scope.Scope | Server | Exclude<R, ServerRequest.ServerRequest>, never, void>; | ||
<R, E, App extends App.Default<any, any>>(middleware: Middleware.Middleware.Applied<R, E, App>): (httpApp: App.Default<R, E>) => Effect.Effect<Scope.Scope | Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, never, void>; | ||
<R, E>(httpApp: App.Default<R, E>): Effect.Effect<Scope.Scope | Server | Exclude<R, ServerRequest.ServerRequest>, never, void>; | ||
<R, E, App extends App.Default<any, any>>(httpApp: App.Default<R, E>, middleware: Middleware.Middleware.Applied<R, E, App>): Effect.Effect<Scope.Scope | Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, never, void>; | ||
}; | ||
//# sourceMappingURL=Server.d.ts.map |
@@ -22,2 +22,7 @@ import * as internal from "../internal/http/server.js"; | ||
export const serve = internal.serve; | ||
/** | ||
* @since 1.0.0 | ||
* @category accessors | ||
*/ | ||
export const serveEffect = internal.serveEffect; | ||
//# sourceMappingURL=Server.js.map |
import * as Context from "effect/Context"; | ||
import * as Effect from "effect/Effect"; | ||
import { dual } from "effect/Function"; | ||
import * as Layer from "effect/Layer"; | ||
/** @internal */ | ||
@@ -16,3 +17,5 @@ export const TypeId = /*#__PURE__*/Symbol.for("@effect/platform/Http/Server"); | ||
/** @internal */ | ||
export const serve = /*#__PURE__*/dual(args => Effect.isEffect(args[0]), (httpApp, middleware) => Effect.flatMap(serverTag, server => server.serve(httpApp, middleware))); | ||
export const serve = /*#__PURE__*/dual(args => Effect.isEffect(args[0]), (httpApp, middleware) => Layer.scopedDiscard(Effect.flatMap(serverTag, server => server.serve(httpApp, middleware)))); | ||
/** @internal */ | ||
export const serveEffect = /*#__PURE__*/dual(args => Effect.isEffect(args[0]), (httpApp, middleware) => Effect.flatMap(serverTag, server => server.serve(httpApp, middleware))); | ||
//# sourceMappingURL=server.js.map |
{ | ||
"name": "@effect/platform", | ||
"version": "0.35.0", | ||
"version": "0.36.0", | ||
"description": "Unified interfaces for common platform-specific services", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -6,2 +6,3 @@ /** | ||
import type * as Effect from "effect/Effect" | ||
import type * as Layer from "effect/Layer" | ||
import type * as Scope from "effect/Scope" | ||
@@ -11,3 +12,2 @@ import * as internal from "../internal/http/server.js" | ||
import type * as Middleware from "./Middleware.js" | ||
import type * as Error from "./ServerError.js" | ||
import type * as ServerRequest from "./ServerRequest.js" | ||
@@ -36,4 +36,4 @@ | ||
Exclude<R, ServerRequest.ServerRequest> | Scope.Scope, | ||
Error.ServeError, | ||
never | ||
never, | ||
void | ||
> | ||
@@ -45,4 +45,4 @@ <R, E, App extends App.Default<any, any>>( | ||
Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest> | Scope.Scope, | ||
Error.ServeError, | ||
never | ||
never, | ||
void | ||
> | ||
@@ -101,3 +101,3 @@ } | ||
middleware?: Middleware.Middleware | ||
) => Effect.Effect<Scope.Scope, Error.ServeError, never> | ||
) => Effect.Effect<Scope.Scope, never, void> | ||
readonly address: Address | ||
@@ -112,9 +112,23 @@ } | ||
export const serve: { | ||
(): <R, E>(httpApp: App.Default<R, E>) => Layer.Layer<Server | Exclude<R, ServerRequest.ServerRequest>, never, never> | ||
<R, E, App extends App.Default<any, any>>( | ||
middleware: Middleware.Middleware.Applied<R, E, App> | ||
): ( | ||
httpApp: App.Default<R, E> | ||
) => Layer.Layer<Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, never, never> | ||
<R, E>(httpApp: App.Default<R, E>): Layer.Layer<Server | Exclude<R, ServerRequest.ServerRequest>, never, never> | ||
<R, E, App extends App.Default<any, any>>( | ||
httpApp: App.Default<R, E>, | ||
middleware: Middleware.Middleware.Applied<R, E, App> | ||
): Layer.Layer<Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, never, never> | ||
} = internal.serve | ||
/** | ||
* @since 1.0.0 | ||
* @category accessors | ||
*/ | ||
export const serveEffect: { | ||
(): <R, E>( | ||
httpApp: App.Default<R, E> | ||
) => Effect.Effect< | ||
Server | Scope.Scope | Exclude<R, ServerRequest.ServerRequest>, | ||
Error.ServeError, | ||
never | ||
> | ||
) => Effect.Effect<Scope.Scope | Server | Exclude<R, ServerRequest.ServerRequest>, never, void> | ||
<R, E, App extends App.Default<any, any>>( | ||
@@ -125,17 +139,13 @@ middleware: Middleware.Middleware.Applied<R, E, App> | ||
) => Effect.Effect< | ||
Server | Scope.Scope | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, | ||
Error.ServeError, | ||
never | ||
Scope.Scope | Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, | ||
never, | ||
void | ||
> | ||
<R, E>( | ||
httpApp: App.Default<R, E> | ||
): Effect.Effect<Server | Scope.Scope | Exclude<R, ServerRequest.ServerRequest>, Error.ServeError, never> | ||
): Effect.Effect<Scope.Scope | Server | Exclude<R, ServerRequest.ServerRequest>, never, void> | ||
<R, E, App extends App.Default<any, any>>( | ||
httpApp: App.Default<R, E>, | ||
middleware: Middleware.Middleware.Applied<R, E, App> | ||
): Effect.Effect< | ||
Server | Scope.Scope | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, | ||
Error.ServeError, | ||
never | ||
> | ||
} = internal.serve | ||
): Effect.Effect<Scope.Scope | Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, never, void> | ||
} = internal.serveEffect |
import * as Context from "effect/Context" | ||
import * as Effect from "effect/Effect" | ||
import { dual } from "effect/Function" | ||
import * as Layer from "effect/Layer" | ||
import type * as Scope from "effect/Scope" | ||
@@ -8,3 +9,2 @@ import type * as App from "../../Http/App.js" | ||
import type * as Server from "../../Http/Server.js" | ||
import type * as Error from "../../Http/ServerError.js" | ||
import type * as ServerRequest from "../../Http/ServerRequest.js" | ||
@@ -31,3 +31,3 @@ | ||
middleware?: Middleware.Middleware | ||
) => Effect.Effect<Scope.Scope, Error.ServeError, never> | ||
) => Effect.Effect<Scope.Scope, never, void> | ||
readonly address: Server.Address | ||
@@ -42,6 +42,55 @@ } | ||
httpApp: App.Default<R, E> | ||
) => Layer.Layer< | ||
Server.Server | Exclude<R, ServerRequest.ServerRequest>, | ||
never, | ||
never | ||
> | ||
<R, E, App extends App.Default<any, any>>(middleware: Middleware.Middleware.Applied<R, E, App>): ( | ||
httpApp: App.Default<R, E> | ||
) => Layer.Layer< | ||
Server.Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, | ||
never, | ||
never | ||
> | ||
}, | ||
{ | ||
<R, E>( | ||
httpApp: App.Default<R, E> | ||
): Layer.Layer<Server.Server | Exclude<R, ServerRequest.ServerRequest>, never, never> | ||
<R, E, App extends App.Default<any, any>>( | ||
httpApp: App.Default<R, E>, | ||
middleware: Middleware.Middleware.Applied<R, E, App> | ||
): Layer.Layer< | ||
Server.Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, | ||
never, | ||
never | ||
> | ||
} | ||
>( | ||
(args) => Effect.isEffect(args[0]), | ||
<R, E, App extends App.Default<any, any>>( | ||
httpApp: App.Default<R, E>, | ||
middleware?: Middleware.Middleware.Applied<R, E, App> | ||
): Layer.Layer< | ||
Server.Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, | ||
never, | ||
never | ||
> => | ||
Layer.scopedDiscard( | ||
Effect.flatMap( | ||
serverTag, | ||
(server) => server.serve(httpApp, middleware!) | ||
) | ||
) as any | ||
) | ||
/** @internal */ | ||
export const serveEffect = dual< | ||
{ | ||
(): <R, E>( | ||
httpApp: App.Default<R, E> | ||
) => Effect.Effect< | ||
Server.Server | Scope.Scope | Exclude<R, ServerRequest.ServerRequest>, | ||
Error.ServeError, | ||
never | ||
never, | ||
void | ||
> | ||
@@ -52,4 +101,4 @@ <R, E, App extends App.Default<any, any>>(middleware: Middleware.Middleware.Applied<R, E, App>): ( | ||
Server.Server | Scope.Scope | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, | ||
Error.ServeError, | ||
never | ||
never, | ||
void | ||
> | ||
@@ -60,3 +109,3 @@ }, | ||
httpApp: App.Default<R, E> | ||
): Effect.Effect<Server.Server | Scope.Scope | Exclude<R, ServerRequest.ServerRequest>, Error.ServeError, never> | ||
): Effect.Effect<Server.Server | Scope.Scope | Exclude<R, ServerRequest.ServerRequest>, never, void> | ||
<R, E, App extends App.Default<any, any>>( | ||
@@ -67,4 +116,4 @@ httpApp: App.Default<R, E>, | ||
Server.Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest> | Scope.Scope, | ||
Error.ServeError, | ||
never | ||
never, | ||
void | ||
> | ||
@@ -79,4 +128,4 @@ } | ||
Server.Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest> | Scope.Scope, | ||
Error.ServeError, | ||
never | ||
never, | ||
void | ||
> => | ||
@@ -83,0 +132,0 @@ Effect.flatMap( |
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
1347970
23802