@shivaedev/platform 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +7 -3
- package/dist/server/appHostHttp.d.ts +39 -39
- package/dist/server/appHostHttp.d.ts.map +1 -1
- package/dist/server/appHostHttp.js +11 -13
- package/dist/server/appHostHttp.js.map +1 -1
- package/dist/server/hostOptions.d.ts +1 -0
- package/dist/server/hostOptions.d.ts.map +1 -1
- package/dist/server/hostTransport.d.ts +16 -0
- package/dist/server/hostTransport.d.ts.map +1 -0
- package/dist/server/hostTransport.js +16 -0
- package/dist/server/hostTransport.js.map +1 -0
- package/dist/server/nativeClientOrigins.d.ts +4 -0
- package/dist/server/nativeClientOrigins.d.ts.map +1 -0
- package/dist/server/nativeClientOrigins.js +38 -0
- package/dist/server/nativeClientOrigins.js.map +1 -0
- package/dist/server/rpc-server/local.d.ts +2 -1
- package/dist/server/rpc-server/local.d.ts.map +1 -1
- package/dist/server/rpc-server/local.js +12 -5
- package/dist/server/rpc-server/local.js.map +1 -1
- package/package.json +3 -3
- package/src/server/appHostHttp.ts +13 -15
- package/src/server/hostOptions.ts +1 -0
- package/src/server/hostTransport.ts +26 -0
- package/src/server/nativeClientOrigins.ts +44 -0
- package/src/server/rpc-server/local.ts +16 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.32.0 - 2026-10-25
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Allow explicitly listed native origins through appHost RPC and auth routes with exact CORS responses and bearer-only cross-origin sessions. Native WebView fetch keeps incremental NDJSON delivery and cancellation while existing transport protections remain in place.
|
|
8
|
+
|
|
3
9
|
## 0.31.0 - 2026-10-25
|
|
4
10
|
|
|
5
11
|
### Added
|
package/README.md
CHANGED
|
@@ -724,16 +724,20 @@ const sessions = {
|
|
|
724
724
|
origin: trustedOrigins({ allow: [publicOrigin, ...nativeOrigins], missing: "allow" }),
|
|
725
725
|
provider: betterAuthSessions(mounted.admittedSessions((headers) => mounted.auth.api.getSession({ headers }))),
|
|
726
726
|
};
|
|
727
|
-
const host = appHost({ group, handlers, routes: mounted.routes, sessions });
|
|
727
|
+
const host = appHost({ group, handlers, routes: mounted.routes, sessions, nativeOrigins });
|
|
728
728
|
```
|
|
729
729
|
|
|
730
|
-
Always wrap the session lookup in `admittedSessions`, even without a sign-in policy: it applies the mount's credential selection to the same request-local identity, profile and role middleware used by cookies. A request carrying the session cookie uses only that cookie, even if invalid or revoked; its bearer header cannot switch accounts or rescue it. Otherwise the signed bearer is resolved by Better Auth. Missing, unsigned, tampered, expired and revoked bearer sessions produce `Unauthorized` at protected RPCs.
|
|
730
|
+
Always wrap the session lookup in `admittedSessions`, even without a sign-in policy: it applies the mount's credential selection to the same request-local identity, profile and role middleware used by cookies. A same-origin request or a request without an Origin carrying the session cookie uses only that cookie, even if invalid or revoked; its bearer header cannot switch accounts or rescue it. Otherwise the signed bearer is resolved by Better Auth. Missing, unsigned, tampered, expired and revoked bearer sessions produce `Unauthorized` at protected RPCs.
|
|
731
731
|
|
|
732
732
|
A native client signs in through `/api/auth/sign-in/email` with `credentials: "omit"` and its bundled Origin, reads the signed credential from the `set-auth-token` response header, and sends that exact value as `Authorization: Bearer <credential>` with `credentials: "omit"` on later auth and RPC requests. Persist it only in OS-backed secure storage, such as iOS Keychain or Android Keystore-backed storage; never use localStorage, sessionStorage or IndexedDB. Browser responses keep HttpOnly cookies and omit the plugin's token header and JSON token fields. Clients without a bundled Origin receive cookie responses.
|
|
733
733
|
|
|
734
734
|
Native sign-out revokes the stored session. Signing in again while sending the current bearer replaces it and revokes the old session after successful sign-in. Streams keep their original request headers, so the old session ends with `Unauthorized` on the next revalidation; it never adopts the replacement. Keep cookie caching disabled for database-backed revocation and choose `streamRevalidationInterval` for the required delivery window.
|
|
735
735
|
|
|
736
|
-
|
|
736
|
+
`appHost`'s `nativeOrigins` option admits those exact origins through the RPC transport guard and the auth routes. Wildcards, patterns and URLs with paths are rejected at startup. Keep the list aligned with `bearerSessions.origins`, Better Auth's `trustedOrigins` and the RPC session origin policy: the later origin policies alone cannot open the transport guard. Omit the option to keep the existing same-origin transport policy.
|
|
737
|
+
|
|
738
|
+
The host answers native preflights with POST for RPC, GET and POST for auth, and only `Authorization` and `Content-Type` headers. Native responses echo the allowed origin exactly with `Vary: Origin`; auth responses expose `set-auth-token`. The host never enables CORS credentials. It strips cookies from admitted native requests before auth or RPC session resolution, so only the signed bearer session can authenticate them. This prevents native access from opening a cookie CSRF path, even if a caller sends a cookie. Resource authorization remains app-owned.
|
|
739
|
+
|
|
740
|
+
Use the WebView's own fetch with `credentials: "omit"` for incremental NDJSON change streams and abort its request to release server work. A buffering native HTTP bridge cannot deliver that streaming behavior. The host still validates trusted proxy peers and forwarded authority, enforces NDJSON and body limits, uses only transport credentials, redacts diagnostics and authorizes sessions. Native HTTP callers without an Origin can exercise bearer RPC with an origin policy that explicitly permits missing Origins.
|
|
737
741
|
|
|
738
742
|
### Decide who may sign in
|
|
739
743
|
|
|
@@ -8,81 +8,81 @@ import type { databaseLayer } from "#server/databaseLayer.ts";
|
|
|
8
8
|
import type { HostOptions, HostPolicy } from "#server/hostOptions.ts";
|
|
9
9
|
import type { MigrationOptions } from "#server/MigrationOptions.ts";
|
|
10
10
|
import { type SessionShape } from "#server/rpc-server/session.ts";
|
|
11
|
-
export declare function appHostHttp<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession extends SessionShape>(options: HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostPolicy<TSession>, changesService: typeof AppChanges): Layer.Layer<TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices, TServiceError | Config.ConfigError | import("effect/PlatformError").PlatformError | import("effect/http/HttpServerError").ServeError | HttpRouter.Request.Without<THandlerError>, Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/FileSystem").FileSystem, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpServer").HttpServer, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/Path").Path, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
11
|
+
export declare function appHostHttp<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession extends SessionShape>(options: HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostPolicy<TSession>, changesService: typeof AppChanges): Layer.Layer<TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices, TServiceError | Config.ConfigError | import("effect/PlatformError").PlatformError | import("effect/http/HttpServerError").ServeError | HttpRouter.Request.Without<THandlerError>, Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/FileSystem").FileSystem, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpServer").HttpServer, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/Path").Path, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
12
12
|
readonly _tag: `${string}.$changes`;
|
|
13
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
13
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
14
14
|
readonly _tag: `${string}.$changes`;
|
|
15
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
15
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
16
16
|
readonly _tag: `${string}.$changes`;
|
|
17
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
17
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
18
18
|
readonly _tag: `${string}.$changes`;
|
|
19
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
19
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
20
20
|
readonly _tag: `${string}.$changes`;
|
|
21
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
21
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
22
22
|
readonly _tag: `${string}.$changes`;
|
|
23
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
23
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
24
24
|
readonly _tag: `${string}.$changes`;
|
|
25
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
25
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
26
26
|
readonly _tag: `${string}.$changes`;
|
|
27
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
27
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
28
28
|
readonly _tag: `${string}.$changes`;
|
|
29
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
29
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
30
30
|
readonly _tag: `${string}.$changes`;
|
|
31
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
31
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
32
32
|
readonly _tag: `${string}.$changes`;
|
|
33
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
33
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
34
34
|
readonly _tag: `${string}.$changes`;
|
|
35
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>>;
|
|
35
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>>;
|
|
36
36
|
export declare function migratedHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession extends SessionShape>(options: HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostPolicy<TSession> & {
|
|
37
37
|
readonly migrations: MigrationOptions<TMigrations>;
|
|
38
|
-
}, database: ReturnType<typeof databaseLayer<TMigrations>>, changesService: typeof AppChanges): Layer.Layer<TServices | AppChanges | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | NodeServices.NodeServices, TServiceError | Config.ConfigError | import("effect/sql/Migrator").MigrationError | import("effect/PlatformError").PlatformError | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | HttpRouter.Request.Without<THandlerError>, Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/FileSystem").FileSystem, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpServer").HttpServer, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/Path").Path, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, import("@effect/sql-pg/PgClient").PgClient | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
38
|
+
}, database: ReturnType<typeof databaseLayer<TMigrations>>, changesService: typeof AppChanges): Layer.Layer<TServices | AppChanges | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | NodeServices.NodeServices, TServiceError | Config.ConfigError | import("effect/sql/Migrator").MigrationError | import("effect/PlatformError").PlatformError | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | HttpRouter.Request.Without<THandlerError>, Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/FileSystem").FileSystem, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpServer").HttpServer, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/Path").Path, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, import("@effect/sql-pg/PgClient").PgClient | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
39
39
|
readonly _tag: `${string}.$changes`;
|
|
40
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
40
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
41
41
|
readonly _tag: `${string}.$changes`;
|
|
42
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
42
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
43
43
|
readonly _tag: `${string}.$changes`;
|
|
44
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
44
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
45
45
|
readonly _tag: `${string}.$changes`;
|
|
46
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
46
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
47
47
|
readonly _tag: `${string}.$changes`;
|
|
48
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
48
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
49
49
|
readonly _tag: `${string}.$changes`;
|
|
50
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
50
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
51
51
|
readonly _tag: `${string}.$changes`;
|
|
52
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
52
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
53
53
|
readonly _tag: `${string}.$changes`;
|
|
54
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
54
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
55
55
|
readonly _tag: `${string}.$changes`;
|
|
56
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
56
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
57
57
|
readonly _tag: `${string}.$changes`;
|
|
58
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
58
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
59
59
|
readonly _tag: `${string}.$changes`;
|
|
60
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
60
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
61
61
|
readonly _tag: `${string}.$changes`;
|
|
62
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>>;
|
|
63
|
-
export declare function deferredHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession extends SessionShape, TApplicationError, TApplicationRequirements>(application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>, TApplicationError, TApplicationRequirements>, database: ReturnType<typeof databaseLayer<TMigrations>>, changesService: typeof AppChanges): Layer.Layer<TServices | AppChanges | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | NodeServices.NodeServices, TApplicationError | TServiceError | Config.ConfigError | import("effect/sql/Migrator").MigrationError | import("effect/PlatformError").PlatformError | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | HttpRouter.Request.Without<THandlerError>, Exclude<Exclude<TApplicationRequirements, import("effect/Scope").Scope>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, import("@effect/sql-pg/PgClient").PgClient | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/FileSystem").FileSystem, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpServer").HttpServer, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/Path").Path, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
62
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices | AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>>;
|
|
63
|
+
export declare function deferredHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession extends SessionShape, TApplicationError, TApplicationRequirements>(application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>, TApplicationError, TApplicationRequirements>, database: ReturnType<typeof databaseLayer<TMigrations>>, changesService: typeof AppChanges): Layer.Layer<TServices | AppChanges | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | NodeServices.NodeServices, TApplicationError | TServiceError | Config.ConfigError | import("effect/sql/Migrator").MigrationError | import("effect/PlatformError").PlatformError | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | HttpRouter.Request.Without<THandlerError>, Exclude<Exclude<TApplicationRequirements, import("effect/Scope").Scope>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, import("@effect/sql-pg/PgClient").PgClient | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/FileSystem").FileSystem, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpServer").HttpServer, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/Path").Path, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
64
64
|
readonly _tag: `${string}.$changes`;
|
|
65
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
65
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
66
66
|
readonly _tag: `${string}.$changes`;
|
|
67
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
67
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
68
68
|
readonly _tag: `${string}.$changes`;
|
|
69
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
69
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
70
70
|
readonly _tag: `${string}.$changes`;
|
|
71
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
71
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
72
72
|
readonly _tag: `${string}.$changes`;
|
|
73
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
73
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
74
74
|
readonly _tag: `${string}.$changes`;
|
|
75
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
75
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
76
76
|
readonly _tag: `${string}.$changes`;
|
|
77
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
77
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
78
78
|
readonly _tag: `${string}.$changes`;
|
|
79
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
79
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
80
80
|
readonly _tag: `${string}.$changes`;
|
|
81
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
81
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
82
82
|
readonly _tag: `${string}.$changes`;
|
|
83
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
83
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
84
84
|
readonly _tag: `${string}.$changes`;
|
|
85
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
85
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
86
86
|
readonly _tag: `${string}.$changes`;
|
|
87
|
-
}>>>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>>;
|
|
87
|
+
}>>>, RpcSerialization.RpcSerialization>, never>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, never>, never>, AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>>;
|
|
88
88
|
//# sourceMappingURL=appHostHttp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appHostHttp.d.ts","sourceRoot":"","sources":["../../src/server/appHostHttp.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAY,MAAM,EAAE,MAAM,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"appHostHttp.d.ts","sourceRoot":"","sources":["../../src/server/appHostHttp.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAY,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAmC,UAAU,EAA2D,MAAM,aAAa,CAAC;AACnI,OAAO,EAAE,KAAK,GAAG,EAAE,gBAAgB,EAAa,MAAM,YAAY,CAAC;AACnE,OAAO,KAAK,EAAqC,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAOpE,OA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AAa,EAAE,oBAAoB,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,EAAE,QAAQ,CAAC,EACnI,iBAAiB,EACjB,wBAAwB,CACxB,EACD,QAAQ,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,WAAW,CAAC,CAAC,EACvD,cAAc,EAAE,OAAO,UAAU;;;;;;;;;;;;;;;;;;;;;;;;ucAGjC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { createServer } from "node:http";
|
|
2
2
|
import { NodeHttpServer, NodeServices } from "@effect/platform-node";
|
|
3
|
-
import { ByteSize, Config, Effect, Layer
|
|
3
|
+
import { ByteSize, Config, Effect, Layer } from "effect";
|
|
4
4
|
import { HttpEffect, HttpIncomingMessage, HttpRouter, HttpServerRequest, HttpServerResponse, HttpStaticServer } from "effect/http";
|
|
5
5
|
import { RpcSerialization, RpcServer } from "effect/rpc";
|
|
6
6
|
import { boundedRpcRequest } from "#server/boundedRpcRequest.ts";
|
|
7
7
|
import { healthRoute } from "#server/healthRoute.ts";
|
|
8
8
|
import { hostChanges } from "#server/hostChanges.ts";
|
|
9
|
+
import { hostTransport } from "#server/hostTransport.ts";
|
|
10
|
+
import { nativeClientOrigins } from "#server/nativeClientOrigins.ts";
|
|
9
11
|
import { otlpTracing } from "#server/otlpTracing.ts";
|
|
10
12
|
import { RedactionPolicy } from "#server/RedactionPolicy.ts";
|
|
11
13
|
import { redactingDiagnostics } from "#server/redactingDiagnostics.ts";
|
|
@@ -13,33 +15,28 @@ import { redactingRpcSerialization } from "#server/redactingRpcSerialization.ts"
|
|
|
13
15
|
import { localRpcGuard } from "#server/rpc-server/local.ts";
|
|
14
16
|
import { authenticatedLayer, maybeAuthenticatedLayer } from "#server/rpc-server/session.ts";
|
|
15
17
|
import { requestTracingLayer } from "#server/rpc-server/tracing.ts";
|
|
16
|
-
import { TrustedProxy } from "#server/rpc-server/trustedProxy.ts";
|
|
17
18
|
import { schemaSensitiveKeys } from "#server/schemaSensitiveKeys.ts";
|
|
18
19
|
import { tracedGroup } from "#server/tracedGroup.ts";
|
|
19
20
|
const rpcCacheControl = (_, response) => Effect.succeed(HttpServerResponse.setHeader(response, "cache-control", "private, no-store"));
|
|
20
21
|
export function appHostHttp(options, changesService) {
|
|
21
22
|
const sensitive = schemaSensitiveKeys(options.group, options.config?.sensitiveKeys);
|
|
22
23
|
return Layer.unwrap(Effect.gen(function* () {
|
|
23
|
-
const
|
|
24
|
-
const bodySize = yield* Schema.decodeUnknownEffect(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))(maxBodySize).pipe(Effect.mapError((cause) => new Config.ConfigError(cause)));
|
|
25
|
-
const trustedProxy = options.policy === "loopback"
|
|
26
|
-
? undefined
|
|
27
|
-
: (options.config?.trustedProxy ?? Option.getOrUndefined(yield* Config.String("TRUSTED_PROXY").pipe(Config.option)));
|
|
28
|
-
if (trustedProxy !== undefined) {
|
|
29
|
-
yield* Schema.decodeUnknownEffect(TrustedProxy)(trustedProxy).pipe(Effect.mapError((cause) => new Config.ConfigError(cause)));
|
|
30
|
-
}
|
|
24
|
+
const { bodySize, trustedProxy, nativeOrigins } = yield* hostTransport(options);
|
|
31
25
|
const middleware = options.policy === "loopback"
|
|
32
26
|
? requestTracingLayer({ sensitive })
|
|
33
27
|
: Layer.mergeAll(authenticatedLayer(options.sessions), maybeAuthenticatedLayer(options.sessions), requestTracingLayer({ sensitive }));
|
|
34
28
|
const routes = HttpRouter.use((router) => Effect.gen(function* () {
|
|
35
29
|
const wire = redactingRpcSerialization(yield* RpcSerialization.RpcSerialization, sensitive, sensitive.maskFailure);
|
|
36
30
|
const handler = yield* RpcServer.toHttpEffect(tracedGroup(options.group)).pipe(Effect.provideService(RpcSerialization.RpcSerialization, wire));
|
|
37
|
-
const guarded = localRpcGuard(handler, trustedProxy);
|
|
31
|
+
const guarded = localRpcGuard(handler, trustedProxy, nativeOrigins);
|
|
32
|
+
if (nativeOrigins.length > 0) {
|
|
33
|
+
yield* router.add("OPTIONS", options.rpcPath ?? "/rpc", HttpServerResponse.text("Local same-origin requests only", { status: 403 }));
|
|
34
|
+
}
|
|
38
35
|
yield* router.add("POST", options.rpcPath ?? "/rpc", (request) => {
|
|
39
36
|
HttpEffect.appendPreResponseHandlerUnsafe(request, rpcCacheControl);
|
|
40
37
|
return guarded.pipe(Effect.provideService(HttpIncomingMessage.MaxBodySize, ByteSize.bytes(bodySize)), Effect.provideService(HttpServerRequest.HttpServerRequest, boundedRpcRequest(request)), Effect.provideService(RpcSerialization.RpcSerialization, wire));
|
|
41
38
|
});
|
|
42
|
-
})).pipe(Layer.provide(Layer.merge(middleware, hostChanges(options.group, changesService).pipe(Layer.provideMerge(options.handlers)))), Layer.provide(RpcSerialization.layerNdjson));
|
|
39
|
+
})).pipe(Layer.provide(Layer.merge(middleware, hostChanges(options.group, changesService).pipe(Layer.provideMerge(options.handlers)))), Layer.provide(RpcSerialization.layerNdjson), Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy)));
|
|
43
40
|
const assets = options.assets === undefined
|
|
44
41
|
? Layer.empty
|
|
45
42
|
: HttpStaticServer.layer(typeof options.assets === "string" ? { root: options.assets } : options.assets);
|
|
@@ -55,7 +52,8 @@ export function appHostHttp(options, changesService) {
|
|
|
55
52
|
: { disablePreemptiveShutdown: options.config.disablePreemptiveShutdown }),
|
|
56
53
|
});
|
|
57
54
|
}));
|
|
58
|
-
|
|
55
|
+
const applicationRoutes = (options.routes ?? Layer.empty).pipe(Layer.provide(options.nativeOrigins === undefined ? Layer.empty : nativeClientOrigins(nativeOrigins, trustedProxy, true)));
|
|
56
|
+
return HttpRouter.serve(Layer.mergeAll(routes, healthRoute, assets, applicationRoutes), { disableLogger: true }).pipe(Layer.provideMerge(application), Layer.provideMerge(server), Layer.provide(NodeServices.layer));
|
|
59
57
|
})).pipe(Layer.provide(redactingDiagnostics(sensitive)), Layer.provide(otlpTracing), Layer.provide(Layer.succeed(RedactionPolicy, sensitive)));
|
|
60
58
|
}
|
|
61
59
|
export function migratedHost(options, database, changesService) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appHostHttp.js","sourceRoot":"","sources":["../../src/server/appHostHttp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"appHostHttp.js","sourceRoot":"","sources":["../../src/server/appHostHttp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACnI,OAAO,EAAY,gBAAgB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCA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CAAC,CAAC;IACjE,OAAO,WAAW,CAAC,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;AAC3G,CAAC;AAED,MAAM,UAAU,YAAY,CAa3B,WAIC,EACD,QAAuD,EACvD,cAAiC;IAEjC,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;AACpI,CAAC"}
|
|
@@ -15,6 +15,7 @@ export type HostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandle
|
|
|
15
15
|
};
|
|
16
16
|
readonly group: RpcGroup.RpcGroup<TRpcs>;
|
|
17
17
|
readonly handlers: Layer.Layer<THandlers, THandlerError, THandlerRequirements>;
|
|
18
|
+
readonly nativeOrigins?: readonly string[];
|
|
18
19
|
readonly routes?: Layer.Layer<never, never, HttpRouter.HttpRouter | HttpRouter.Request<"Error", unknown>>;
|
|
19
20
|
readonly rpcPath?: HttpRouter.PathInput;
|
|
20
21
|
} & ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostOptions.d.ts","sourceRoot":"","sources":["../../src/server/hostOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,kBA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GAC3E;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Config, Effect } from "effect";
|
|
2
|
+
interface Options {
|
|
3
|
+
readonly config?: {
|
|
4
|
+
readonly maxBodySize?: number;
|
|
5
|
+
readonly trustedProxy?: string;
|
|
6
|
+
};
|
|
7
|
+
readonly nativeOrigins?: readonly string[];
|
|
8
|
+
readonly policy?: "loopback" | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare const hostTransport: (options: Options) => Effect.Effect<{
|
|
11
|
+
bodySize: number;
|
|
12
|
+
nativeOrigins: readonly string[];
|
|
13
|
+
trustedProxy: string | undefined;
|
|
14
|
+
}, Config.ConfigError, never>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=hostTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostTransport.d.ts","sourceRoot":"","sources":["../../src/server/hostTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAIxD,UAAU,OAAO;IAChB,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpF,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACzC;AACD,eAAO,MAAM,aAAa;;;;6BAgBxB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Config, Effect, Option, Schema } from "effect";
|
|
2
|
+
import { NativeOrigins } from "#server/nativeClientOrigins.ts";
|
|
3
|
+
import { TrustedProxy } from "#server/rpc-server/trustedProxy.ts";
|
|
4
|
+
export const hostTransport = Effect.fn("Platform.hostTransport")(function* (options) {
|
|
5
|
+
const maxBodySize = options.config?.maxBodySize ?? (yield* Config.Int("MAX_BODY_SIZE").pipe(Config.withDefault(1024 * 1024)));
|
|
6
|
+
const bodySize = yield* Schema.decodeUnknownEffect(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))(maxBodySize).pipe(Effect.mapError((cause) => new Config.ConfigError(cause)));
|
|
7
|
+
const trustedProxy = options.policy === "loopback"
|
|
8
|
+
? undefined
|
|
9
|
+
: (options.config?.trustedProxy ?? Option.getOrUndefined(yield* Config.String("TRUSTED_PROXY").pipe(Config.option)));
|
|
10
|
+
if (trustedProxy !== undefined) {
|
|
11
|
+
yield* Schema.decodeUnknownEffect(TrustedProxy)(trustedProxy).pipe(Effect.mapError((cause) => new Config.ConfigError(cause)));
|
|
12
|
+
}
|
|
13
|
+
const nativeOrigins = yield* Schema.decodeUnknownEffect(NativeOrigins)(options.nativeOrigins ?? []).pipe(Effect.mapError((cause) => new Config.ConfigError(cause)));
|
|
14
|
+
return { bodySize, nativeOrigins, trustedProxy };
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=hostTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostTransport.js","sourceRoot":"","sources":["../../src/server/hostTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAOlE,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,EAAE,CAAC,wBAAwB,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAgB;IAC3F,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,WAAW,IAAI,CA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,CAAC,CACzD,CAAC;IACF,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;AAClD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const NativeOrigins: Schema.$Array<Schema.String>;
|
|
3
|
+
export declare function nativeClientOrigins(origins: readonly string[], trustedProxy: string | undefined, auth?: boolean): import("effect/Layer").Layer<never, never, never>;
|
|
4
|
+
//# sourceMappingURL=nativeClientOrigins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeClientOrigins.d.ts","sourceRoot":"","sources":["../../src/server/nativeClientOrigins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIxC,eAAO,MAAM,aAAa,8BAYzB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,UAAQ,qDAyB7G"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { Headers, HttpMiddleware, HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
3
|
+
import { localTransport } from "#server/rpc-server/local.ts";
|
|
4
|
+
export const NativeOrigins = Schema.Array(Schema.String.check(Schema.makeFilter((origin) => {
|
|
5
|
+
try {
|
|
6
|
+
const url = new URL(origin);
|
|
7
|
+
const authority = url.origin === "null" ? `${url.protocol}//${url.host}` : url.origin;
|
|
8
|
+
return url.host !== "" && !origin.includes("*") && authority === origin;
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
})));
|
|
14
|
+
export function nativeClientOrigins(origins, trustedProxy, auth = false) {
|
|
15
|
+
const allowed = localTransport(trustedProxy, origins);
|
|
16
|
+
const cors = HttpMiddleware.cors({
|
|
17
|
+
allowedHeaders: ["Authorization", "Content-Type"],
|
|
18
|
+
allowedMethods: auth ? ["GET", "POST"] : ["POST"],
|
|
19
|
+
allowedOrigins: (origin) => origins.includes(origin),
|
|
20
|
+
credentials: false,
|
|
21
|
+
exposedHeaders: auth ? ["set-auth-token"] : [],
|
|
22
|
+
});
|
|
23
|
+
return HttpRouter.middleware((effect) => Effect.gen(function* () {
|
|
24
|
+
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
25
|
+
if (auth && !request.url.split("?")[0]?.startsWith("/api/auth/")) {
|
|
26
|
+
return yield* effect;
|
|
27
|
+
}
|
|
28
|
+
if ((auth || request.method === "OPTIONS") && !allowed(request)) {
|
|
29
|
+
return HttpServerResponse.text("Local same-origin requests only", { status: 403 });
|
|
30
|
+
}
|
|
31
|
+
if (!origins.includes(request.headers.origin ?? "")) {
|
|
32
|
+
return yield* effect;
|
|
33
|
+
}
|
|
34
|
+
const native = request.modify({ headers: Headers.remove(request.headers, "cookie") });
|
|
35
|
+
return yield* cors(effect).pipe(Effect.provideService(HttpServerRequest.HttpServerRequest, native));
|
|
36
|
+
})).layer;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=nativeClientOrigins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeClientOrigins.js","sourceRoot":"","sources":["../../src/server/nativeClientOrigins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACzG,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CACxC,MAAM,CAAC,MAAM,CAAC,KAAK,CAClB,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE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IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAClE,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACjE,OAAO,kBAAkB,CAAC,IAAI,CAAC,iCAAiC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,CAAC;YACrD,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC;QACtB,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;QACtF,OAAO,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;IACrG,CAAC,CAAC,CACF,CAAC,KAAK,CAAC;AACT,CAAC"}
|
|
@@ -5,5 +5,6 @@ export declare function sameOrigin(request: HttpServerRequest.HttpServerRequest)
|
|
|
5
5
|
export declare function loopbackOnly<E, R>(handler: (request: HttpServerRequest.HttpServerRequest) => Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>): (request: HttpServerRequest.HttpServerRequest) => Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>;
|
|
6
6
|
export declare function trustedProxyPeer(trustedProxy?: string): (address: string) => boolean;
|
|
7
7
|
export declare function trustedProxyRanges(trustedProxy?: string): string[];
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function localTransport(trustedProxy?: string, nativeOrigins?: readonly string[]): (request: HttpServerRequest.HttpServerRequest) => boolean;
|
|
9
|
+
export declare function localRpcGuard<E, R>(effect: Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>, trustedProxy?: string, nativeOrigins?: readonly string[]): Effect.Effect<HttpServerResponse.HttpServerResponse, E, R | HttpServerRequest.HttpServerRequest | RpcSerialization.RpcSerialization>;
|
|
9
10
|
//# sourceMappingURL=local.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/server/rpc-server/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAoB,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAsB9C,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,OAAO,CAWhF;AACD,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAChC,OAAO,EAAE,CAAC,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,KAAK,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,CAAC,EAAE,CAAC,CAAC,aAEpG,iBAAiB,CAAC,iBAAiB,gEAIpD;AACD,wBAAgB,gBAAgB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAGpF;AACD,wBAAgB,kBAAkB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAElE;AAkBD,wBAAgB,
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/server/rpc-server/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAoB,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAsB9C,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,OAAO,CAWhF;AACD,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAChC,OAAO,EAAE,CAAC,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,KAAK,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,CAAC,EAAE,CAAC,CAAC,aAEpG,iBAAiB,CAAC,iBAAiB,gEAIpD;AACD,wBAAgB,gBAAgB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAGpF;AACD,wBAAgB,kBAAkB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAElE;AAkBD,wBAAgB,cAAc,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,aAAa,GAAE,SAAS,MAAM,EAAO,aAEzE,iBAAiB,CAAC,iBAAiB,KAAG,OAAO,CAK9D;AACD,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EACjC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,CAAC,EAAE,CAAC,CAAC,EAClE,YAAY,CAAC,EAAE,MAAM,EACrB,aAAa,GAAE,SAAS,MAAM,EAAO,wIAWrC"}
|
|
@@ -46,7 +46,7 @@ export function trustedProxyPeer(trustedProxy) {
|
|
|
46
46
|
export function trustedProxyRanges(trustedProxy) {
|
|
47
47
|
return normalizedRanges(trustedProxy);
|
|
48
48
|
}
|
|
49
|
-
function proxyOrigin(request, isTrustedProxy) {
|
|
49
|
+
function proxyOrigin(request, isTrustedProxy, native) {
|
|
50
50
|
if (!Option.exists(request.remoteAddress, isTrustedProxy)) {
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
@@ -57,20 +57,27 @@ function proxyOrigin(request, isTrustedProxy) {
|
|
|
57
57
|
}
|
|
58
58
|
try {
|
|
59
59
|
const url = new URL(`${protocol}://${host}`);
|
|
60
|
-
return request.headers.origin === undefined || request.headers.origin === url.origin;
|
|
60
|
+
return native || request.headers.origin === undefined || request.headers.origin === url.origin;
|
|
61
61
|
}
|
|
62
62
|
catch {
|
|
63
63
|
return false;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
export function
|
|
66
|
+
export function localTransport(trustedProxy, nativeOrigins = []) {
|
|
67
67
|
const isTrustedProxy = trustedProxyPeer(trustedProxy);
|
|
68
|
+
return (request) => {
|
|
69
|
+
const native = nativeOrigins.includes(request.headers.origin ?? "");
|
|
70
|
+
const local = loopbackHost(request.headers.host) && Option.exists(request.remoteAddress, loopbackAddress);
|
|
71
|
+
return (local && (native || sameOrigin(request))) || proxyOrigin(request, isTrustedProxy, native);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export function localRpcGuard(effect, trustedProxy, nativeOrigins = []) {
|
|
75
|
+
const allowed = localTransport(trustedProxy, nativeOrigins);
|
|
68
76
|
return Effect.gen(function* () {
|
|
69
77
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
70
78
|
const serialization = yield* RpcSerialization.RpcSerialization;
|
|
71
|
-
const local = loopbackHost(request.headers.host) && Option.exists(request.remoteAddress, loopbackAddress);
|
|
72
79
|
const contentType = request.headers["content-type"]?.split(";")[0]?.trim().toLowerCase();
|
|
73
|
-
return (
|
|
80
|
+
return allowed(request) && contentType === serialization.contentType
|
|
74
81
|
? yield* continueHttpTrace(effect, request)
|
|
75
82
|
: HttpServerResponse.text("Local same-origin requests only", { status: 403 });
|
|
76
83
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../../src/server/rpc-server/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,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,kBAAkB,CAAC,IAAI,CAAC,iCAAiC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAW,MAA8B,EAAE,OAA4C;IAC3I,MAAM,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC;IACtB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtG,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/platform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Opinionated Effect application infrastructure for ShivaeDev services",
|
|
5
5
|
"homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/platform#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
"@prisma-next/sql-contract": "0.16.0",
|
|
56
56
|
"@prisma-next/sql-orm-client": "0.16.0",
|
|
57
57
|
"@prisma-next/target-postgres": "0.16.0",
|
|
58
|
-
"@shivaedev/effect-pg-boss": "0.
|
|
58
|
+
"@shivaedev/effect-pg-boss": "0.19.0",
|
|
59
59
|
"@shivaedev/effect-prisma": "0.10.6",
|
|
60
60
|
"@shivaedev/effect-test": "0.9.0",
|
|
61
61
|
"@shivaedev/effect-test-sql": "0.9.3",
|
|
62
62
|
"@shivaedev/effect-trpc": "0.8.6",
|
|
63
|
-
"@shivaedev/quality": "0.
|
|
63
|
+
"@shivaedev/quality": "0.40.0",
|
|
64
64
|
"@shivaedev/test-story": "0.20.0",
|
|
65
65
|
"@trpc/client": "11.19.0",
|
|
66
66
|
"@trpc/server": "11.19.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createServer } from "node:http";
|
|
2
2
|
import { NodeHttpServer, NodeServices } from "@effect/platform-node";
|
|
3
|
-
import { ByteSize, Config, Effect, Layer
|
|
3
|
+
import { ByteSize, Config, Effect, Layer } from "effect";
|
|
4
4
|
import { HttpEffect, HttpIncomingMessage, HttpRouter, HttpServerRequest, HttpServerResponse, HttpStaticServer } from "effect/http";
|
|
5
5
|
import { type Rpc, RpcSerialization, RpcServer } from "effect/rpc";
|
|
6
6
|
import type { Authenticated, MaybeAuthenticated, RequestTracing } from "#rpc/middleware.ts";
|
|
@@ -10,7 +10,9 @@ import type { databaseLayer } from "#server/databaseLayer.ts";
|
|
|
10
10
|
import { healthRoute } from "#server/healthRoute.ts";
|
|
11
11
|
import { hostChanges } from "#server/hostChanges.ts";
|
|
12
12
|
import type { HostOptions, HostPolicy } from "#server/hostOptions.ts";
|
|
13
|
+
import { hostTransport } from "#server/hostTransport.ts";
|
|
13
14
|
import type { MigrationOptions } from "#server/MigrationOptions.ts";
|
|
15
|
+
import { nativeClientOrigins } from "#server/nativeClientOrigins.ts";
|
|
14
16
|
import { otlpTracing } from "#server/otlpTracing.ts";
|
|
15
17
|
import { RedactionPolicy } from "#server/RedactionPolicy.ts";
|
|
16
18
|
import { redactingDiagnostics } from "#server/redactingDiagnostics.ts";
|
|
@@ -18,7 +20,6 @@ import { redactingRpcSerialization } from "#server/redactingRpcSerialization.ts"
|
|
|
18
20
|
import { localRpcGuard } from "#server/rpc-server/local.ts";
|
|
19
21
|
import { authenticatedLayer, maybeAuthenticatedLayer, type SessionShape } from "#server/rpc-server/session.ts";
|
|
20
22
|
import { requestTracingLayer } from "#server/rpc-server/tracing.ts";
|
|
21
|
-
import { TrustedProxy } from "#server/rpc-server/trustedProxy.ts";
|
|
22
23
|
import { schemaSensitiveKeys } from "#server/schemaSensitiveKeys.ts";
|
|
23
24
|
import { tracedGroup } from "#server/tracedGroup.ts";
|
|
24
25
|
|
|
@@ -41,17 +42,7 @@ export function appHostHttp<
|
|
|
41
42
|
const sensitive = schemaSensitiveKeys(options.group, options.config?.sensitiveKeys);
|
|
42
43
|
return Layer.unwrap(
|
|
43
44
|
Effect.gen(function* () {
|
|
44
|
-
const
|
|
45
|
-
const bodySize = yield* Schema.decodeUnknownEffect(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))(maxBodySize).pipe(
|
|
46
|
-
Effect.mapError((cause) => new Config.ConfigError(cause)),
|
|
47
|
-
);
|
|
48
|
-
const trustedProxy =
|
|
49
|
-
options.policy === "loopback"
|
|
50
|
-
? undefined
|
|
51
|
-
: (options.config?.trustedProxy ?? Option.getOrUndefined(yield* Config.String("TRUSTED_PROXY").pipe(Config.option)));
|
|
52
|
-
if (trustedProxy !== undefined) {
|
|
53
|
-
yield* Schema.decodeUnknownEffect(TrustedProxy)(trustedProxy).pipe(Effect.mapError((cause) => new Config.ConfigError(cause)));
|
|
54
|
-
}
|
|
45
|
+
const { bodySize, trustedProxy, nativeOrigins } = yield* hostTransport(options);
|
|
55
46
|
const middleware: Layer.Layer<RequestTracing> | Layer.Layer<Authenticated | MaybeAuthenticated | RequestTracing> =
|
|
56
47
|
options.policy === "loopback"
|
|
57
48
|
? requestTracingLayer({ sensitive })
|
|
@@ -62,7 +53,10 @@ export function appHostHttp<
|
|
|
62
53
|
const handler = yield* RpcServer.toHttpEffect(tracedGroup(options.group)).pipe(
|
|
63
54
|
Effect.provideService(RpcSerialization.RpcSerialization, wire),
|
|
64
55
|
);
|
|
65
|
-
const guarded = localRpcGuard(handler, trustedProxy);
|
|
56
|
+
const guarded = localRpcGuard(handler, trustedProxy, nativeOrigins);
|
|
57
|
+
if (nativeOrigins.length > 0) {
|
|
58
|
+
yield* router.add("OPTIONS", options.rpcPath ?? "/rpc", HttpServerResponse.text("Local same-origin requests only", { status: 403 }));
|
|
59
|
+
}
|
|
66
60
|
yield* router.add("POST", options.rpcPath ?? "/rpc", (request) => {
|
|
67
61
|
HttpEffect.appendPreResponseHandlerUnsafe(request, rpcCacheControl);
|
|
68
62
|
return guarded.pipe(
|
|
@@ -75,6 +69,7 @@ export function appHostHttp<
|
|
|
75
69
|
).pipe(
|
|
76
70
|
Layer.provide(Layer.merge(middleware, hostChanges(options.group, changesService).pipe(Layer.provideMerge(options.handlers)))),
|
|
77
71
|
Layer.provide(RpcSerialization.layerNdjson),
|
|
72
|
+
Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy)),
|
|
78
73
|
);
|
|
79
74
|
const assets =
|
|
80
75
|
options.assets === undefined
|
|
@@ -94,7 +89,10 @@ export function appHostHttp<
|
|
|
94
89
|
});
|
|
95
90
|
}),
|
|
96
91
|
);
|
|
97
|
-
|
|
92
|
+
const applicationRoutes = (options.routes ?? Layer.empty).pipe(
|
|
93
|
+
Layer.provide(options.nativeOrigins === undefined ? Layer.empty : nativeClientOrigins(nativeOrigins, trustedProxy, true)),
|
|
94
|
+
);
|
|
95
|
+
return HttpRouter.serve(Layer.mergeAll(routes, healthRoute, assets, applicationRoutes), { disableLogger: true }).pipe(
|
|
98
96
|
Layer.provideMerge(application),
|
|
99
97
|
Layer.provideMerge(server),
|
|
100
98
|
Layer.provide(NodeServices.layer),
|
|
@@ -16,6 +16,7 @@ export type HostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandle
|
|
|
16
16
|
};
|
|
17
17
|
readonly group: RpcGroup.RpcGroup<TRpcs>;
|
|
18
18
|
readonly handlers: Layer.Layer<THandlers, THandlerError, THandlerRequirements>;
|
|
19
|
+
readonly nativeOrigins?: readonly string[];
|
|
19
20
|
readonly routes?: Layer.Layer<never, never, HttpRouter.HttpRouter | HttpRouter.Request<"Error", unknown>>;
|
|
20
21
|
readonly rpcPath?: HttpRouter.PathInput;
|
|
21
22
|
} & (
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Config, Effect, Option, Schema } from "effect";
|
|
2
|
+
import { NativeOrigins } from "#server/nativeClientOrigins.ts";
|
|
3
|
+
import { TrustedProxy } from "#server/rpc-server/trustedProxy.ts";
|
|
4
|
+
|
|
5
|
+
interface Options {
|
|
6
|
+
readonly config?: { readonly maxBodySize?: number; readonly trustedProxy?: string };
|
|
7
|
+
readonly nativeOrigins?: readonly string[];
|
|
8
|
+
readonly policy?: "loopback" | undefined;
|
|
9
|
+
}
|
|
10
|
+
export const hostTransport = Effect.fn("Platform.hostTransport")(function* (options: Options) {
|
|
11
|
+
const maxBodySize = options.config?.maxBodySize ?? (yield* Config.Int("MAX_BODY_SIZE").pipe(Config.withDefault(1024 * 1024)));
|
|
12
|
+
const bodySize = yield* Schema.decodeUnknownEffect(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))(maxBodySize).pipe(
|
|
13
|
+
Effect.mapError((cause) => new Config.ConfigError(cause)),
|
|
14
|
+
);
|
|
15
|
+
const trustedProxy =
|
|
16
|
+
options.policy === "loopback"
|
|
17
|
+
? undefined
|
|
18
|
+
: (options.config?.trustedProxy ?? Option.getOrUndefined(yield* Config.String("TRUSTED_PROXY").pipe(Config.option)));
|
|
19
|
+
if (trustedProxy !== undefined) {
|
|
20
|
+
yield* Schema.decodeUnknownEffect(TrustedProxy)(trustedProxy).pipe(Effect.mapError((cause) => new Config.ConfigError(cause)));
|
|
21
|
+
}
|
|
22
|
+
const nativeOrigins = yield* Schema.decodeUnknownEffect(NativeOrigins)(options.nativeOrigins ?? []).pipe(
|
|
23
|
+
Effect.mapError((cause) => new Config.ConfigError(cause)),
|
|
24
|
+
);
|
|
25
|
+
return { bodySize, nativeOrigins, trustedProxy };
|
|
26
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { Headers, HttpMiddleware, HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
3
|
+
import { localTransport } from "#server/rpc-server/local.ts";
|
|
4
|
+
|
|
5
|
+
export const NativeOrigins = Schema.Array(
|
|
6
|
+
Schema.String.check(
|
|
7
|
+
Schema.makeFilter((origin) => {
|
|
8
|
+
try {
|
|
9
|
+
const url = new URL(origin);
|
|
10
|
+
const authority = url.origin === "null" ? `${url.protocol}//${url.host}` : url.origin;
|
|
11
|
+
return url.host !== "" && !origin.includes("*") && authority === origin;
|
|
12
|
+
} catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}),
|
|
16
|
+
),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export function nativeClientOrigins(origins: readonly string[], trustedProxy: string | undefined, auth = false) {
|
|
20
|
+
const allowed = localTransport(trustedProxy, origins);
|
|
21
|
+
const cors = HttpMiddleware.cors({
|
|
22
|
+
allowedHeaders: ["Authorization", "Content-Type"],
|
|
23
|
+
allowedMethods: auth ? ["GET", "POST"] : ["POST"],
|
|
24
|
+
allowedOrigins: (origin) => origins.includes(origin),
|
|
25
|
+
credentials: false,
|
|
26
|
+
exposedHeaders: auth ? ["set-auth-token"] : [],
|
|
27
|
+
});
|
|
28
|
+
return HttpRouter.middleware((effect) =>
|
|
29
|
+
Effect.gen(function* () {
|
|
30
|
+
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
31
|
+
if (auth && !request.url.split("?")[0]?.startsWith("/api/auth/")) {
|
|
32
|
+
return yield* effect;
|
|
33
|
+
}
|
|
34
|
+
if ((auth || request.method === "OPTIONS") && !allowed(request)) {
|
|
35
|
+
return HttpServerResponse.text("Local same-origin requests only", { status: 403 });
|
|
36
|
+
}
|
|
37
|
+
if (!origins.includes(request.headers.origin ?? "")) {
|
|
38
|
+
return yield* effect;
|
|
39
|
+
}
|
|
40
|
+
const native = request.modify({ headers: Headers.remove(request.headers, "cookie") });
|
|
41
|
+
return yield* cors(effect).pipe(Effect.provideService(HttpServerRequest.HttpServerRequest, native));
|
|
42
|
+
}),
|
|
43
|
+
).layer;
|
|
44
|
+
}
|
|
@@ -50,7 +50,7 @@ export function trustedProxyRanges(trustedProxy?: string): string[] {
|
|
|
50
50
|
return normalizedRanges(trustedProxy);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
function proxyOrigin(request: HttpServerRequest.HttpServerRequest, isTrustedProxy: (address: string) => boolean): boolean {
|
|
53
|
+
function proxyOrigin(request: HttpServerRequest.HttpServerRequest, isTrustedProxy: (address: string) => boolean, native: boolean): boolean {
|
|
54
54
|
if (!Option.exists(request.remoteAddress, isTrustedProxy)) {
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
@@ -61,19 +61,30 @@ function proxyOrigin(request: HttpServerRequest.HttpServerRequest, isTrustedProx
|
|
|
61
61
|
}
|
|
62
62
|
try {
|
|
63
63
|
const url = new URL(`${protocol}://${host}`);
|
|
64
|
-
return request.headers.origin === undefined || request.headers.origin === url.origin;
|
|
64
|
+
return native || request.headers.origin === undefined || request.headers.origin === url.origin;
|
|
65
65
|
} catch {
|
|
66
66
|
return false;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
export function
|
|
69
|
+
export function localTransport(trustedProxy?: string, nativeOrigins: readonly string[] = []) {
|
|
70
70
|
const isTrustedProxy = trustedProxyPeer(trustedProxy);
|
|
71
|
+
return (request: HttpServerRequest.HttpServerRequest): boolean => {
|
|
72
|
+
const native = nativeOrigins.includes(request.headers.origin ?? "");
|
|
73
|
+
const local = loopbackHost(request.headers.host) && Option.exists(request.remoteAddress, loopbackAddress);
|
|
74
|
+
return (local && (native || sameOrigin(request))) || proxyOrigin(request, isTrustedProxy, native);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export function localRpcGuard<E, R>(
|
|
78
|
+
effect: Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>,
|
|
79
|
+
trustedProxy?: string,
|
|
80
|
+
nativeOrigins: readonly string[] = [],
|
|
81
|
+
) {
|
|
82
|
+
const allowed = localTransport(trustedProxy, nativeOrigins);
|
|
71
83
|
return Effect.gen(function* () {
|
|
72
84
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
73
85
|
const serialization = yield* RpcSerialization.RpcSerialization;
|
|
74
|
-
const local = loopbackHost(request.headers.host) && Option.exists(request.remoteAddress, loopbackAddress);
|
|
75
86
|
const contentType = request.headers["content-type"]?.split(";")[0]?.trim().toLowerCase();
|
|
76
|
-
return (
|
|
87
|
+
return allowed(request) && contentType === serialization.contentType
|
|
77
88
|
? yield* continueHttpTrace(effect, request)
|
|
78
89
|
: HttpServerResponse.text("Local same-origin requests only", { status: 403 });
|
|
79
90
|
});
|