@shivaedev/server 0.13.0 → 0.14.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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.0 - 2026-10-31
4
+
5
+ ### Added
6
+
7
+ - Configure per-path static cache policy and HTML frame headers through `appHost` assets options.
8
+
9
+ ### Fixed
10
+
11
+ - Derive encoded sensitive names separately for each RPC schema, keeping private fields in one method from changing public state and native failure decoding in another method.
12
+ - Keep the child key names of a fully masked field public elsewhere, including through native `OptionFromNullOr` encoding.
13
+
14
+ ### Breaking
15
+
16
+ - Default fingerprinted assets to immutable caching, HTML documents and SPA fallbacks to `no-store`, and unversioned files to `no-cache`. HTML defaults to `frame-ancestors 'none'` and `X-Frame-Options: DENY`, including HEAD, partial and conditional responses. Consumers that need their previous caching or embedding behavior must set `assets.cacheControl` to their cache policy and `assets.documentHeaders` to configure or disable framing restrictions. Manually mounted native static layers retain their behavior.
17
+ - Refuse RPC registration when a schema-sensitive field name also names a public field within that method's schemas, including nested fields, encoded names and middleware errors. Diagnostics cannot distinguish those plain values. Rename one field or mark both sensitive; fields in separate RPC methods may keep different sensitivity.
18
+ - `schemaSensitiveKeys` now returns an Effect. Native consumers must use `yield* schemaSensitiveKeys(group, extraKeys)` to obtain the predicate and handle `SensitiveFieldConflict` from `@shivaedev/errors/schemaFieldScope.ts`. `appHost` and Work Board's `boardLayer` include that failure in their Layer error channels.
19
+
3
20
  ## 0.13.0 - 2026-10-31
4
21
 
5
22
  ### Added
package/README.md CHANGED
@@ -81,7 +81,22 @@ const Server = appHost({ group: Api, handlers: Handlers, services: Services, rou
81
81
 
82
82
  `AppMetadata` is an app service supplied by `Services`. Register `OPTIONS` or `"*"` for a route whose native `HttpMiddleware.cors` must answer preflight. The host restricts foreign-origin preflights only on `rpcPath` (default `/rpc`) and `/api/auth/*`, including `/api/auth` itself. Application endpoints own their CORS policy. `nativeOrigins` lists exact native-client origins admitted by the host’s RPC and auth CORS policy; other foreign origins receive 403 on those paths.
83
83
 
84
- `assets` accepts a directory string or native `HttpStaticServer.layer` options. For a browser app whose routes must also work on direct navigation or reload, use `{ root: "dist", spa: true }` or merge `HttpStaticServer.layer({ root: "dist", spa: true })` from `effect/http` into `routes`. The [starter](https://github.com/ShivaeDev/platform/tree/main/examples/starter) uses `routes` for static assets and Better Auth at `/api/auth/*`, with provider-owned cookies and the host's RPC session middleware.
84
+ `assets` accepts a directory string or an `AssetOptions` object, extending native static-server options. For direct navigation to browser routes, use `{ root: "dist", spa: true }`. HTML files, including SPA fallbacks, default to `Cache-Control: no-store`, `Content-Security-Policy: frame-ancestors 'none'` and `X-Frame-Options: DENY`. Fingerprinted assets default to `public, max-age=31536000, immutable`; other files use `no-cache`. A fingerprint is a dot- or hyphen-separated filename suffix before the extension with at least eight hexadecimal characters, or at least eight letters, digits, underscores or hyphens containing a digit or uppercase letter. HTML policy takes precedence over fingerprint detection, including custom HTML MIME types. HEAD, partial and conditional responses retain the selected file's policy.
85
+
86
+ Set `assets.cacheControl` to a string for every file, or a callback receiving the public URL pathname, including any mount prefix and excluding the query string. Returning `undefined` uses the default for the selected file. Set `assets.documentHeaders.frameAncestors` to a CSP source list and `assets.documentHeaders.xFrameOptions` to `"DENY"` or `"SAMEORIGIN"`; either accepts `false` to omit that header.
87
+
88
+ ```ts
89
+ import type { AssetOptions } from "@shivaedev/server/AssetOptions.ts";
90
+
91
+ const assets: AssetOptions = {
92
+ root: "dist",
93
+ spa: true,
94
+ cacheControl: (pathname) => (pathname === "/service-worker.js" ? "no-store" : undefined),
95
+ documentHeaders: { frameAncestors: "'self'", xFrameOptions: "SAMEORIGIN" },
96
+ };
97
+ ```
98
+
99
+ Static layers mounted manually through `routes` keep Effect's native behavior. The [starter](https://github.com/ShivaeDev/platform/tree/main/examples/starter) uses `routes` for static assets and Better Auth at `/api/auth/*`, with provider-owned cookies and the host's RPC session middleware.
85
100
 
86
101
  The listener uses `HOST` or `127.0.0.1`, uses `PORT` or 3000, and reads `DATABASE_URL`. Set overrides in the one `config` object: `host`, `port` (0 selects an ephemeral port), `trustedProxy`, `maxBodySize`, `databaseUrl` and `listenDatabaseUrl` (Effect `Redacted<string>` values), `applicationName`, and optional `changes`. Migration options accept `table` and `lockTimeout` (default `effect_sql_migrations` and five seconds). Native Layer failures remain in the build error channel; missing application dependencies remain in the requirement type.
87
102
 
@@ -236,7 +251,9 @@ const Server = appHost({
236
251
  });
237
252
  ```
238
253
 
239
- Use `Contact` in `Api`'s RPC schemas. A `sensitive: true` annotation also applies to a checked schema, such as `Schema.String.check(Schema.isMinLength(1)).annotate({ sensitive: true })`, and to checks or groups nested inside other check groups. Values under the declared names become `<redacted>` in host log messages and annotations, failure and defect payloads sent to RPC clients, causes passed to installed error reporters, and exported trace attributes, events, links and resource attributes. Nested structured values follow the same policy before trace serialization. A field containing sensitive array items or record values is masked as a whole. `Schema.encodeKeys` and other schema encoders carry sensitivity to their declared output names, including chains of renamed fields. The host collects all sensitive declarations before propagating encoded names and enclosing-field protection until the key set stops growing, so schema and RPC order do not change the policy. Sensitivity is checked throughout each transformation's source subtree, including fields named in `config.sensitiveKeys`. Policy derivation does not execute encoder callbacks: their field provenance is unknown, so every declared output field of a sensitive source is treated as sensitive, including every union branch, otherwise public fields and error discriminators. When a sensitive source encodes to a scalar, its enclosing field is masked as a whole. Sensitive error tags are masked before tracing copies them into the `rpc.failure` log annotation. Native RPC protocol tags remain intact. An `Error` retains its message, stack and cause in redacted form. If `message` or `name` is sensitive, its stack is masked too, including stack headers encoded by `Schema.Defect({ includeStack: true })`. Successful RPC responses retain their application data. Error schemas consumed by native clients must accept the redaction marker for sensitive fields; a constrained string, numeric or collection field may otherwise fail client decoding after masking.
254
+ Different methods can use `state` privately and publicly in the same group. Within one method, logs and traces do not retain schema identity, so startup refuses a sensitive field name that also appears as public data in that method's payload, success, error, defect or middleware error schemas. The error names both schema paths, including nested fields and encoded names. Rename one field or give both fields the same sensitivity before starting the host. This prevents redaction of a public literal-union failure field from breaking native client decoding.
255
+
256
+ Use `Contact` in `Api`'s RPC schemas. A `sensitive: true` annotation also applies to a checked schema, such as `Schema.String.check(Schema.isMinLength(1)).annotate({ sensitive: true })`, and to checks or groups nested inside other check groups. Values under the declared names become `<redacted>` in host log messages and annotations, failure and defect payloads sent to RPC clients, causes passed to installed error reporters, and exported trace attributes, events, links and resource attributes. Nested structured values follow the same policy before trace serialization. A field containing sensitive array items or record values is masked as a whole. `Schema.encodeKeys` and other schema encoders carry sensitivity to their declared output names, including chains of renamed fields. The host propagates encoded names and enclosing-field protection within each schema until its key set stops growing, then combines the policies for that method. Sensitivity is checked throughout each transformation's source subtree, including fields named in `config.sensitiveKeys`. Policy derivation does not execute encoder callbacks: their field provenance is unknown, so every declared output field of a sensitive source is treated as sensitive, including every union branch, otherwise public fields and error discriminators. When a sensitive source encodes to a scalar, its enclosing field is masked as a whole. Sensitive error tags are masked before tracing copies them into the `rpc.failure` log annotation. Native RPC protocol tags remain intact. An `Error` retains its message, stack and cause in redacted form. If `message` or `name` is sensitive, its stack is masked too, including stack headers encoded by `Schema.Defect({ includeStack: true })`. Successful RPC responses retain their application data. Error schemas consumed by native clients must accept the redaction marker for sensitive fields; a constrained string, numeric or collection field may otherwise fail client decoding after masking.
240
257
 
241
258
  A sensitive error encoded to a top-level scalar or record has no fixed output field name to mask. The host replaces that entire failure value with `<redacted>`. This decision follows each RPC schema, so other methods' failures and successful results retain their application data. Client wire-error schemas must accept the string marker in place of that error. Wire masking preserves public collection entries, deeply nested values and long text; diagnostic collection, depth and string limits apply to logs and diagnostic copies, not client failure data.
242
259
 
@@ -244,7 +261,7 @@ Diagnostic failure, defect and interruption reasons are rebuilt with sanitized a
244
261
 
245
262
  The shared errors policy also masks `db.user`, `db.user.name` and `db.connection_string` in logs, error reports and exported traces. It matches field names, not arbitrary occurrences of their values in prose. Free text uses credential-shaped string, key-assignment and URL rules; it does not scan for personal data. Keep sensitive values out of ordinary prose and span names.
246
263
 
247
- For native RPC serialization, `schemaSensitiveKeys(group, extraKeys?)` from `@shivaedev/errors/schemaSensitiveKeys.ts` returns a key predicate with `forRpc(tag)` and `maskFailure(tag: string | undefined, reason: "Fail" | "Die")`. Pass them to `redactingRpcSerialization(wire, sensitive, sensitive.maskFailure, sensitive.forRpc)`. The serializer correlates request tags and response IDs, including batches, before masking a whole error or defect root. Unassociated defects use the conservative policy across the host's defect schemas.
264
+ For native RPC serialization, `yield* schemaSensitiveKeys(group, extraKeys)` from `@shivaedev/errors/schemaSensitiveKeys.ts` obtains a key predicate with `forRpc(tag)` and `maskFailure(tag: string | undefined, reason: "Fail" | "Die")`. The Effect can fail with `SensitiveFieldConflict` from `@shivaedev/errors/schemaFieldScope.ts`; `appHost` reports this typed failure during Layer startup. Pass the predicate and its methods to `redactingRpcSerialization(wire, sensitive, sensitive.maskFailure, sensitive.forRpc)`. The serializer correlates request tags and response IDs, including batches, before masking a whole error or defect root. Unassociated defects use the conservative policy across the host's defect schemas.
248
265
 
249
266
  The masking primitives, `redact`, `redactWire`, `redactRecord`, `redactText`, `redactUrl`, `redactCause`, `schemaSensitiveKeys` and `isSensitiveKey`, live in [`@shivaedev/errors`](https://github.com/ShivaeDev/platform/tree/main/packages/errors#readme).
250
267
 
@@ -0,0 +1,9 @@
1
+ import type { HttpStaticServer } from "effect/http";
2
+ export type AssetOptions = Omit<Parameters<typeof HttpStaticServer.layer>[0], "cacheControl"> & {
3
+ readonly cacheControl?: string | ((pathname: string) => string | undefined) | undefined;
4
+ readonly documentHeaders?: {
5
+ readonly frameAncestors?: string | false;
6
+ readonly xFrameOptions?: "DENY" | "SAMEORIGIN" | false;
7
+ };
8
+ };
9
+ //# sourceMappingURL=AssetOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetOptions.d.ts","sourceRoot":"","sources":["../src/AssetOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG;IAC/F,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IACxF,QAAQ,CAAC,eAAe,CAAC,EAAE;QAC1B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;QACzC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,KAAK,CAAC;KACvD,CAAC;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AssetOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetOptions.js","sourceRoot":"","sources":["../src/AssetOptions.ts"],"names":[],"mappings":""}
@@ -6,7 +6,7 @@ import type { appDatabase } from "#appDatabase.ts";
6
6
  import type { AppHttpHostOptions } from "#appHost.ts";
7
7
  import type { HostOptions, HostPolicy, HostRouteRequirements } from "#hostOptions.ts";
8
8
  import type { MigrationOptions } from "#MigrationOptions.ts";
9
- export declare function appHostHttp<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession extends SessionShape, TRouteError = never, TRouteRequirements = HostRouteRequirements>(options: HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TRouteError, TRouteRequirements> & HostPolicy<TSession>): Layer.Layer<TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices, TServiceError | import("effect/Config").ConfigError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies | import("effect/PlatformError").PlatformError | import("effect/http/HttpServerError").ServeError | import("./TrustedProxyRequired.ts").TrustedProxyRequired | HttpRouter.Request.Without<THandlerError> | HttpRouter.Request.Without<TRouteError>, Exclude<Exclude<Exclude<Exclude<TServiceRequirements, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/FileSystem").FileSystem, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/Path").Path, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<THandlerRequirements, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<TRouteRequirements, never>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
9
+ export declare function appHostHttp<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession extends SessionShape, TRouteError = never, TRouteRequirements = HostRouteRequirements>(options: HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TRouteError, TRouteRequirements> & HostPolicy<TSession>): Layer.Layer<TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices, TServiceError | import("effect/Config").ConfigError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict | import("effect/http/HttpServerError").ServeError | import("./TrustedProxyRequired.ts").TrustedProxyRequired | HttpRouter.Request.Without<THandlerError> | HttpRouter.Request.Without<TRouteError>, Exclude<Exclude<Exclude<Exclude<TServiceRequirements, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<THandlerRequirements, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<TRouteRequirements, never>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
10
10
  readonly _tag: `${string}.$changes`;
11
11
  }>>>, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<import("effect/rpc/RpcSerialization").RpcSerialization, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
12
12
  readonly _tag: `${string}.$changes`;
@@ -33,7 +33,7 @@ export declare function appHostHttp<TRpcs extends Rpc.Any, THandlers, THandlerEr
33
33
  }>>>, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, HttpRouter.HttpRouter>, import("effect/Scope").Scope>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>>;
34
34
  export declare function migratedHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession extends SessionShape, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never>(options: HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TRouteError, TRouteRequirements> & HostPolicy<TSession> & {
35
35
  readonly migrations: MigrationOptions<TMigrations, TMigrationError>;
36
- }, database: ReturnType<typeof appDatabase<TMigrations, TMigrationError>>): Layer.Layer<"@shivaedev/contract/LiveServer" | TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | import("@effect/platform-node/NodeServices").NodeServices, TMigrationError | TServiceError | import("effect/Config").ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies | import("effect/PlatformError").PlatformError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | import("./TrustedProxyRequired.ts").TrustedProxyRequired | HttpRouter.Request.Without<THandlerError> | HttpRouter.Request.Without<TRouteError>, Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/FileSystem").FileSystem, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/Path").Path, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<THandlerRequirements, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<TRouteRequirements, never>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
36
+ }, database: ReturnType<typeof appDatabase<TMigrations, TMigrationError>>): Layer.Layer<"@shivaedev/contract/LiveServer" | TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | import("@effect/platform-node/NodeServices").NodeServices, TMigrationError | TServiceError | import("effect/Config").ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | import("./TrustedProxyRequired.ts").TrustedProxyRequired | HttpRouter.Request.Without<THandlerError> | HttpRouter.Request.Without<TRouteError>, Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<THandlerRequirements, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<TRouteRequirements, never>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
37
37
  readonly _tag: `${string}.$changes`;
38
38
  }>>>, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<import("effect/rpc/RpcSerialization").RpcSerialization, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
39
39
  readonly _tag: `${string}.$changes`;
@@ -58,7 +58,7 @@ export declare function migratedHost<TRpcs extends Rpc.Any, THandlers, THandlerE
58
58
  }>>>, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, HttpRouter.HttpRouter>, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<Rpc.AddMiddleware<TRpcs, typeof import("./hostRpc.ts").HostedReadPolicy>, typeof import("@shivaedev/identity/middleware.ts").RequestTracing>>, import("./hostRpc.ts").HostedReadPolicy>, import("effect/rpc/RpcSerialization").RpcSerialization>, import("effect/Scope").Scope>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
59
59
  readonly _tag: `${string}.$changes`;
60
60
  }>>>, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, HttpRouter.HttpRouter>, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>>;
61
- export declare function deferredHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession extends SessionShape, TApplicationError, TApplicationRequirements, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never>(application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession, never, never, never, TRouteError, TRouteRequirements>, TApplicationError, TApplicationRequirements>, database: ReturnType<typeof appDatabase<TMigrations, TMigrationError>>): Layer.Layer<"@shivaedev/contract/LiveServer" | TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | import("@effect/platform-node/NodeServices").NodeServices, TApplicationError | TMigrationError | TServiceError | import("effect/Config").ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies | import("effect/PlatformError").PlatformError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | import("./TrustedProxyRequired.ts").TrustedProxyRequired | HttpRouter.Request.Without<THandlerError> | HttpRouter.Request.Without<TRouteError>, Exclude<Exclude<TApplicationRequirements, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | 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-pg/PgPool").PgPool | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/FileSystem").FileSystem, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/Path").Path, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<THandlerRequirements, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<TRouteRequirements, never>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
61
+ export declare function deferredHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession extends SessionShape, TApplicationError, TApplicationRequirements, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never>(application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession, never, never, never, TRouteError, TRouteRequirements>, TApplicationError, TApplicationRequirements>, database: ReturnType<typeof appDatabase<TMigrations, TMigrationError>>): Layer.Layer<"@shivaedev/contract/LiveServer" | TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | import("@effect/platform-node/NodeServices").NodeServices, TApplicationError | TMigrationError | TServiceError | import("effect/Config").ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | import("./TrustedProxyRequired.ts").TrustedProxyRequired | HttpRouter.Request.Without<THandlerError> | HttpRouter.Request.Without<TRouteError>, Exclude<Exclude<TApplicationRequirements, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | 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-pg/PgPool").PgPool | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<THandlerRequirements, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<TRouteRequirements, never>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
62
62
  readonly _tag: `${string}.$changes`;
63
63
  }>>>, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<import("effect/rpc/RpcSerialization").RpcSerialization, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
64
64
  readonly _tag: `${string}.$changes`;
@@ -1 +1 @@
1
- {"version":3,"file":"appHostHttp.d.ts","sourceRoot":"","sources":["../src/appHostHttp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,UAAU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C3B,KAAK,SAAS,GAAG,CAAC,GAAG,EACrB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,QAAQ,SAAS,YAAY,EAC7B,iBAAiB,EACjB,wBAAwB,EACxB,WAAW,GAAG,KAAK,EACnB,kBAAkB,GAAG,qBAAqB,EAC1C,eAAe,GAAG,KAAK,EAEvB,WAAW,EAAE,MAAM,CAAC,MAAM,CACzB,kBAAkB,CACjB,KAAK,EACL,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACR,KAAK,EACL,KAAK,EACL,KAAK,EACL,WAAW,EACX,kBAAkB,CAClB,EACD,iBAAiB,EACjB,wBAAwB,CACxB,EACD,QAAQ,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;whBAGtE"}
@@ -1,9 +1,10 @@
1
1
  import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
2
2
  import { Effect, Layer } from "effect";
3
- import { HttpRouter, HttpServer, HttpStaticServer } from "effect/http";
3
+ import { HttpRouter, HttpServer } from "effect/http";
4
4
  import { schemaSensitiveKeys } from "@shivaedev/errors/schemaSensitiveKeys.ts";
5
5
  import { healthRoute } from "#healthRoute.ts";
6
6
  import { hostApplicationRoutes } from "#hostApplicationRoutes.ts";
7
+ import { hostAssets } from "#hostAssets.ts";
7
8
  import { hostRpcRoutes } from "#hostRpcRoutes.ts";
8
9
  import { hostTransport } from "#hostTransport.ts";
9
10
  import { nativeClientOrigins } from "#nativeClientOrigins.ts";
@@ -12,20 +13,17 @@ import { otlpTracing } from "#otlpTracing.ts";
12
13
  import { RedactionPolicy } from "#RedactionPolicy.ts";
13
14
  import { redactingDiagnostics } from "#redactingDiagnostics.ts";
14
15
  export function appHostHttp(options) {
15
- const sensitive = schemaSensitiveKeys(options.group, options.config?.sensitiveKeys);
16
- return Layer.unwrap(Effect.gen(function* () {
16
+ return Layer.unwrap(Effect.map(schemaSensitiveKeys(options.group, options.config?.sensitiveKeys), (sensitive) => Layer.unwrap(Effect.gen(function* () {
17
17
  const transport = yield* hostTransport(options);
18
18
  const { bodySize, host, trustedProxy, nativeOrigins } = transport;
19
19
  const routes = hostRpcRoutes(options, transport, sensitive);
20
- const assets = options.assets === undefined
21
- ? Layer.empty
22
- : HttpStaticServer.layer(typeof options.assets === "string" ? { root: options.assets } : options.assets);
20
+ const assets = options.assets === undefined ? Layer.empty : hostAssets(options.assets);
23
21
  const application = Layer.mergeAll(options.services ?? Layer.empty);
24
22
  const server = nodeHttpServer(host, options.config);
25
23
  const applicationRoutes = hostApplicationRoutes(options.routes, bodySize);
26
24
  const httpRoutes = Layer.mergeAll(routes, healthRoute, assets, applicationRoutes).pipe(Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy, false, options.rpcPath)), Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy, options.nativeOrigins === undefined ? "preflight" : true)));
27
25
  return Layer.unwrap(HttpRouter.toHttpEffect(httpRoutes).pipe(Effect.map((handler) => HttpServer.serve(handler).pipe(HttpServer.withLogAddress, Layer.provideMerge(server))))).pipe(Layer.provideMerge(application), Layer.provideMerge(NodeHttpServer.layerHttpServices));
28
- })).pipe(Layer.provide(redactingDiagnostics(sensitive)), Layer.provide(otlpTracing), Layer.provide(Layer.succeed(RedactionPolicy, sensitive)));
26
+ })).pipe(Layer.provide(redactingDiagnostics(sensitive)), Layer.provide(otlpTracing), Layer.provide(Layer.succeed(RedactionPolicy, sensitive)))));
29
27
  }
30
28
  export function migratedHost(options, database) {
31
29
  const services = Layer.mergeAll(options.services ?? Layer.empty);
@@ -1 +1 @@
1
- {"version":3,"file":"appHostHttp.js","sourceRoot":"","sources":["../src/appHostHttp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,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,QAAQ,CAAC,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IACjE,OAAO,WAAW,CAAC,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;AAC3F,CAAC;AAED,MAAM,UAAU,YAAY,CAgB3B,WAkBC,EACD,QAAsE;IAEtE,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;AACpH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Effect, Path } from "effect";
2
+ import type { AssetOptions } from "#AssetOptions.ts";
3
+ export declare const assetHeaders: (options: AssetOptions, file: string, pathname: string) => Effect.Effect<{
4
+ "cache-control": string;
5
+ }, never, Path.Path>;
6
+ //# sourceMappingURL=assetHeaders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assetHeaders.d.ts","sourceRoot":"","sources":["../src/assetHeaders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAerD,eAAO,MAAM,YAAY;;oBAUvB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { Effect, Path } from "effect";
2
+ function documentHeaders(options) {
3
+ const headers = {};
4
+ const ancestors = options.documentHeaders?.frameAncestors ?? "'none'";
5
+ const frames = options.documentHeaders?.xFrameOptions ?? "DENY";
6
+ if (ancestors !== false) {
7
+ headers["content-security-policy"] = `frame-ancestors ${ancestors}`;
8
+ }
9
+ if (frames !== false) {
10
+ headers["x-frame-options"] = frames;
11
+ }
12
+ return headers;
13
+ }
14
+ export const assetHeaders = Effect.fnUntraced(function* (options, file, pathname) {
15
+ const path = yield* Path.Path;
16
+ const extension = path.extname(file).slice(1).toLowerCase();
17
+ const contentType = options.mimeTypes?.[extension] ?? (extension === "html" || extension === "htm" ? "text/html" : "");
18
+ const document = contentType.split(";")[0]?.trim().toLowerCase() === "text/html";
19
+ const fingerprinted = /[.-](?:[a-f0-9]{8,}|(?=[A-Za-z0-9_-]*[A-Z0-9])[A-Za-z0-9_-]{8,})\.[^.]+$/u.test(path.basename(file));
20
+ const assetCache = fingerprinted ? "public, max-age=31536000, immutable" : "no-cache";
21
+ const defaultCache = document ? "no-store" : assetCache;
22
+ const override = typeof options.cacheControl === "function" ? options.cacheControl(pathname) : options.cacheControl;
23
+ return { ...(document ? documentHeaders(options) : {}), "cache-control": override ?? defaultCache };
24
+ });
25
+ //# sourceMappingURL=assetHeaders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assetHeaders.js","sourceRoot":"","sources":["../src/assetHeaders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAGtC,SAAS,eAAe,CAAC,OAAqB;IAC7C,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,MAAM,SAAS,GAAG,OAAO,CAAC,eAAe,EAAE,cAAc,IAAI,QAAQ,CAAC;IACtE,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,aAAa,IAAI,MAAM,CAAC;IAChE,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,yBAAyB,CAAC,GAAG,mBAAmB,SAAS,EAAE,CAAC;IACrE,CAAC;IACD,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACtB,OAAO,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC;IACrC,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CA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Platform, HttpRouter } from "effect/http";
3
+ import type { AssetOptions } from "#AssetOptions.ts";
4
+ export declare function hostAssets(input: string | AssetOptions): Layer.Layer<never, never, HttpPlatform.HttpPlatform | HttpRouter.HttpRouter | HttpRouter.Request<"Requires", import("effect/FileSystem").FileSystem> | HttpRouter.Request<"Requires", import("effect/Path").Path>>;
5
+ //# sourceMappingURL=hostAssets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostAssets.d.ts","sourceRoot":"","sources":["../src/hostAssets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EACN,YAAY,EACZ,UAAU,EAMV,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,sNA8BtD"}
@@ -0,0 +1,29 @@
1
+ import { Effect, Layer } from "effect";
2
+ import { HttpPlatform, HttpRouter, HttpServerError, HttpServerRequest, HttpServerRespondable, HttpServerResponse, HttpStaticServer, } from "effect/http";
3
+ import { assetHeaders } from "#assetHeaders.ts";
4
+ export function hostAssets(input) {
5
+ const options = typeof input === "string" ? { root: input } : input;
6
+ return Layer.effectDiscard(Effect.gen(function* () {
7
+ const router = yield* HttpRouter.HttpRouter;
8
+ const platform = yield* HttpPlatform.HttpPlatform;
9
+ const handler = Effect.gen(function* () {
10
+ const request = yield* HttpServerRequest.HttpServerRequest;
11
+ let file;
12
+ const response = yield* HttpStaticServer.make({ ...options, cacheControl: undefined }).pipe(Effect.mapError((cause) => new HttpServerError.HttpServerError({ reason: new HttpServerError.InternalError({ cause, request }) })), Effect.flatten, Effect.provideService(HttpPlatform.HttpPlatform, {
13
+ ...platform,
14
+ fileResponse: (name, settings) => {
15
+ file = name;
16
+ return platform.fileResponse(name, settings);
17
+ },
18
+ }));
19
+ if (file === undefined) {
20
+ return response;
21
+ }
22
+ // Observe the selected file so SPA fallbacks and conditional responses share its policy.
23
+ const pathname = new URL(request.originalUrl, "http://localhost").pathname;
24
+ return HttpServerResponse.setHeaders(response, yield* assetHeaders(options, file, pathname));
25
+ }).pipe(Effect.catch(HttpServerRespondable.toResponse));
26
+ yield* (options.prefix === undefined ? router : router.prefixed(options.prefix)).add("GET", "/*", handler);
27
+ }));
28
+ }
29
+ //# sourceMappingURL=hostAssets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostAssets.js","sourceRoot":"","sources":["../src/hostAssets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EACN,YAAY,EACZ,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,GAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,UAAU,UAAU,CAAC,KAA4B;IACtD,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IACpE,OAAO,KAAK,CAAC,aAAa,CACzB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACnB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;QAC5C,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC;QAClD,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YACnC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,iBAAiB,CAAC,iBAAiB,CAAC;YAC3D,IAAI,IAAwB,CAAC;YAC7B,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE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Duration, Layer } from "effect";
2
- import type { HttpRouter, HttpStaticServer } from "effect/http";
2
+ import type { HttpRouter } from "effect/http";
3
3
  import type { Rpc, RpcGroup } from "effect/rpc";
4
4
  import type { SessionPolicy, SessionShape } from "@shivaedev/identity/server/session.ts";
5
- import type { AppDatabaseOptions } from "./appHost.ts";
5
+ import type { AssetOptions } from "#AssetOptions.ts";
6
+ import type { AppDatabaseOptions } from "#appHost.ts";
6
7
  export type HostRouteRequirements = HttpRouter.HttpRouter | HttpRouter.Request<"Error", unknown>;
7
8
  export type HostCoreOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> = {
8
- readonly assets?: string | Parameters<typeof HttpStaticServer.layer>[0];
9
+ readonly assets?: string | AssetOptions;
9
10
  readonly config?: AppDatabaseOptions["config"] & {
10
11
  readonly port?: number;
11
12
  readonly host?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"hostOptions.d.ts","sourceRoot":"","sources":["../src/hostOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC9C,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,uCAAuC,CAAC;AACzF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAEjG,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,IAAI;IACp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G,oBAAoB,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG,KAAK,CAAC,CAC9G,CAAC;AAEF,MAAM,WAAW,UAAU,CAAC,WAAW,GAAG,KAAK,EAAE,kBAAkB,GAAG,qBAAqB;IAC1F,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,kBAAkB,CAAC,CAAC;CACtE;AAED,MAAM,MAAM,WAAW,CACtB,KAAK,SAAS,GAAG,CAAC,GAAG,EACrB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,WAAW,GAAG,KAAK,EACnB,kBAAkB,GAAG,qBAAqB,IACvC,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,CAAC,GACzH,UAAU,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;AAE7C,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,YAAY,IACjD;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;CAAE,GAC3E;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC"}
@@ -10,7 +10,7 @@ export declare function hostRpcRoutes<TRpcs extends Rpc.Any, THandlers, TError,
10
10
  readonly group: RpcGroup.RpcGroup<TRpcs>;
11
11
  readonly handlers: Layer.Layer<THandlers, TError, TRequirements>;
12
12
  readonly rpcPath?: HttpRouter.PathInput;
13
- } & HostPolicy<TSession>, { bodySize, trustedProxy, nativeOrigins }: Effect.Success<ReturnType<typeof hostTransport>>, sensitive: ReturnType<typeof schemaSensitiveKeys>): Layer.Layer<never, TError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies, Exclude<TRequirements, RpcSerialization.RpcSerialization> | Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
13
+ } & HostPolicy<TSession>, { bodySize, trustedProxy, nativeOrigins }: Effect.Success<ReturnType<typeof hostTransport>>, sensitive: Effect.Success<ReturnType<typeof schemaSensitiveKeys>>): Layer.Layer<never, TError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies, Exclude<TRequirements, RpcSerialization.RpcSerialization> | Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
14
14
  readonly _tag: `${string}.$changes`;
15
15
  }>>>, RpcSerialization.RpcSerialization> | Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
16
16
  readonly _tag: `${string}.$changes`;
@@ -1 +1 @@
1
- {"version":3,"file":"hostRpcRoutes.d.ts","sourceRoot":"","sources":["../src/hostRpcRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAmC,UAAU,EAAyC,MAAM,aAAa,CAAC;AAEjH,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,QAAQ,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,KAAK,EAAqC,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAE3G,OAAO,EAA+C,KAAK,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAGvH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKvD,wBAAgB,aAAa,CAA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AC,OAAO,IAAI,MAAM,EACzB,SAAS,CAAC,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAC/H,CAAC;QACF,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,IAAI,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAChE,OAAO,CAAC,IAAI,CACX,MAAM,CAAC,cAAc,CAAC,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAChF,MAAM,CAAC,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,EACtF,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAC9D,UAAU,CAAC,sBAAsB,CAAC,eAAe,CAAC,CAClD,CACD,CAAC;IACH,CAAC,CAAC,CACF,CAAC,IAAI,CACL,KAAK,CAAC,OAAO,CACZ,KAAK,CAAC,KAAK,CACV,UAAU,EACV,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CACnI,CACD,EACD,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAC3C,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/server",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "The Effect application host: HTTP and RPC serving, health, OTLP export, database and migrations, and development mode",
5
5
  "keywords": [
6
6
  "effect"
@@ -46,10 +46,10 @@
46
46
  ],
47
47
  "dependencies": {
48
48
  "@shivaedev/changes": "0.6.0",
49
- "@shivaedev/contract": "0.29.0",
50
- "@shivaedev/errors": "0.3.0",
49
+ "@shivaedev/contract": "0.30.0",
50
+ "@shivaedev/errors": "0.4.0",
51
51
  "@shivaedev/http": "0.3.1",
52
- "@shivaedev/identity": "0.12.0",
52
+ "@shivaedev/identity": "0.13.0",
53
53
  "@shivaedev/local-postgres": "0.8.0",
54
54
  "@shivaedev/sql": "0.28.0"
55
55
  },
@@ -57,13 +57,13 @@
57
57
  "@effect/platform-node": "4.0.6",
58
58
  "@effect/sql-pg": "4.0.6",
59
59
  "@effect/vitest": "4.0.6",
60
- "@shivaedev/access": "0.3.3",
61
- "@shivaedev/admin": "0.15.0",
62
- "@shivaedev/jobs": "0.28.0",
63
- "@shivaedev/quality": "0.51.0",
60
+ "@shivaedev/access": "0.3.4",
61
+ "@shivaedev/admin": "0.16.0",
62
+ "@shivaedev/jobs": "0.28.1",
63
+ "@shivaedev/quality": "0.52.0",
64
64
  "@shivaedev/test": "0.12.0",
65
65
  "@shivaedev/test-sql": "0.15.1",
66
- "@shivaedev/test-story": "0.31.0",
66
+ "@shivaedev/test-story": "0.31.1",
67
67
  "@types/node": "24.19.2",
68
68
  "better-auth": "1.7.12",
69
69
  "effect": "4.0.6",
@@ -0,0 +1,9 @@
1
+ import type { HttpStaticServer } from "effect/http";
2
+
3
+ export type AssetOptions = Omit<Parameters<typeof HttpStaticServer.layer>[0], "cacheControl"> & {
4
+ readonly cacheControl?: string | ((pathname: string) => string | undefined) | undefined;
5
+ readonly documentHeaders?: {
6
+ readonly frameAncestors?: string | false;
7
+ readonly xFrameOptions?: "DENY" | "SAMEORIGIN" | false;
8
+ };
9
+ };
@@ -1,6 +1,6 @@
1
1
  import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
2
2
  import { Effect, Layer } from "effect";
3
- import { HttpRouter, HttpServer, HttpStaticServer } from "effect/http";
3
+ import { HttpRouter, HttpServer } from "effect/http";
4
4
  import type { Rpc } from "effect/rpc";
5
5
  import { schemaSensitiveKeys } from "@shivaedev/errors/schemaSensitiveKeys.ts";
6
6
  import type { SessionShape } from "@shivaedev/identity/server/session.ts";
@@ -8,6 +8,7 @@ import type { appDatabase } from "#appDatabase.ts";
8
8
  import type { AppHttpHostOptions } from "#appHost.ts";
9
9
  import { healthRoute } from "#healthRoute.ts";
10
10
  import { hostApplicationRoutes } from "#hostApplicationRoutes.ts";
11
+ import { hostAssets } from "#hostAssets.ts";
11
12
  import type { HostOptions, HostPolicy, HostRouteRequirements } from "#hostOptions.ts";
12
13
  import { hostRpcRoutes } from "#hostRpcRoutes.ts";
13
14
  import { hostTransport } from "#hostTransport.ts";
@@ -43,30 +44,30 @@ export function appHostHttp<
43
44
  > &
44
45
  HostPolicy<TSession>,
45
46
  ) {
46
- const sensitive = schemaSensitiveKeys(options.group, options.config?.sensitiveKeys);
47
47
  return Layer.unwrap(
48
- Effect.gen(function* () {
49
- const transport = yield* hostTransport(options);
50
- const { bodySize, host, trustedProxy, nativeOrigins } = transport;
51
- const routes = hostRpcRoutes(options, transport, sensitive);
52
- const assets =
53
- options.assets === undefined
54
- ? Layer.empty
55
- : HttpStaticServer.layer(typeof options.assets === "string" ? { root: options.assets } : options.assets);
56
- const application = Layer.mergeAll(options.services ?? Layer.empty);
57
- const server = nodeHttpServer(host, options.config);
58
- const applicationRoutes = hostApplicationRoutes(options.routes, bodySize);
59
- const httpRoutes = Layer.mergeAll(routes, healthRoute, assets, applicationRoutes).pipe(
60
- Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy, false, options.rpcPath)),
61
- Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy, options.nativeOrigins === undefined ? "preflight" : true)),
62
- );
63
- return Layer.unwrap(
64
- HttpRouter.toHttpEffect(httpRoutes).pipe(
65
- Effect.map((handler) => HttpServer.serve(handler).pipe(HttpServer.withLogAddress, Layer.provideMerge(server))),
66
- ),
67
- ).pipe(Layer.provideMerge(application), Layer.provideMerge(NodeHttpServer.layerHttpServices));
68
- }),
69
- ).pipe(Layer.provide(redactingDiagnostics(sensitive)), Layer.provide(otlpTracing), Layer.provide(Layer.succeed(RedactionPolicy, sensitive)));
48
+ Effect.map(schemaSensitiveKeys(options.group, options.config?.sensitiveKeys), (sensitive) =>
49
+ Layer.unwrap(
50
+ Effect.gen(function* () {
51
+ const transport = yield* hostTransport(options);
52
+ const { bodySize, host, trustedProxy, nativeOrigins } = transport;
53
+ const routes = hostRpcRoutes(options, transport, sensitive);
54
+ const assets = options.assets === undefined ? Layer.empty : hostAssets(options.assets);
55
+ const application = Layer.mergeAll(options.services ?? Layer.empty);
56
+ const server = nodeHttpServer(host, options.config);
57
+ const applicationRoutes = hostApplicationRoutes(options.routes, bodySize);
58
+ const httpRoutes = Layer.mergeAll(routes, healthRoute, assets, applicationRoutes).pipe(
59
+ Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy, false, options.rpcPath)),
60
+ Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy, options.nativeOrigins === undefined ? "preflight" : true)),
61
+ );
62
+ return Layer.unwrap(
63
+ HttpRouter.toHttpEffect(httpRoutes).pipe(
64
+ Effect.map((handler) => HttpServer.serve(handler).pipe(HttpServer.withLogAddress, Layer.provideMerge(server))),
65
+ ),
66
+ ).pipe(Layer.provideMerge(application), Layer.provideMerge(NodeHttpServer.layerHttpServices));
67
+ }),
68
+ ).pipe(Layer.provide(redactingDiagnostics(sensitive)), Layer.provide(otlpTracing), Layer.provide(Layer.succeed(RedactionPolicy, sensitive))),
69
+ ),
70
+ );
70
71
  }
71
72
 
72
73
  export function migratedHost<
@@ -0,0 +1,27 @@
1
+ import { Effect, Path } from "effect";
2
+ import type { AssetOptions } from "#AssetOptions.ts";
3
+
4
+ function documentHeaders(options: AssetOptions): Record<string, string> {
5
+ const headers: Record<string, string> = {};
6
+ const ancestors = options.documentHeaders?.frameAncestors ?? "'none'";
7
+ const frames = options.documentHeaders?.xFrameOptions ?? "DENY";
8
+ if (ancestors !== false) {
9
+ headers["content-security-policy"] = `frame-ancestors ${ancestors}`;
10
+ }
11
+ if (frames !== false) {
12
+ headers["x-frame-options"] = frames;
13
+ }
14
+ return headers;
15
+ }
16
+
17
+ export const assetHeaders = Effect.fnUntraced(function* (options: AssetOptions, file: string, pathname: string) {
18
+ const path = yield* Path.Path;
19
+ const extension = path.extname(file).slice(1).toLowerCase();
20
+ const contentType = options.mimeTypes?.[extension] ?? (extension === "html" || extension === "htm" ? "text/html" : "");
21
+ const document = contentType.split(";")[0]?.trim().toLowerCase() === "text/html";
22
+ const fingerprinted = /[.-](?:[a-f0-9]{8,}|(?=[A-Za-z0-9_-]*[A-Z0-9])[A-Za-z0-9_-]{8,})\.[^.]+$/u.test(path.basename(file));
23
+ const assetCache = fingerprinted ? "public, max-age=31536000, immutable" : "no-cache";
24
+ const defaultCache = document ? "no-store" : assetCache;
25
+ const override = typeof options.cacheControl === "function" ? options.cacheControl(pathname) : options.cacheControl;
26
+ return { ...(document ? documentHeaders(options) : {}), "cache-control": override ?? defaultCache };
27
+ });
@@ -0,0 +1,44 @@
1
+ import { Effect, Layer } from "effect";
2
+ import {
3
+ HttpPlatform,
4
+ HttpRouter,
5
+ HttpServerError,
6
+ HttpServerRequest,
7
+ HttpServerRespondable,
8
+ HttpServerResponse,
9
+ HttpStaticServer,
10
+ } from "effect/http";
11
+ import type { AssetOptions } from "#AssetOptions.ts";
12
+ import { assetHeaders } from "#assetHeaders.ts";
13
+
14
+ export function hostAssets(input: string | AssetOptions) {
15
+ const options = typeof input === "string" ? { root: input } : input;
16
+ return Layer.effectDiscard(
17
+ Effect.gen(function* () {
18
+ const router = yield* HttpRouter.HttpRouter;
19
+ const platform = yield* HttpPlatform.HttpPlatform;
20
+ const handler = Effect.gen(function* () {
21
+ const request = yield* HttpServerRequest.HttpServerRequest;
22
+ let file: string | undefined;
23
+ const response = yield* HttpStaticServer.make({ ...options, cacheControl: undefined }).pipe(
24
+ Effect.mapError((cause) => new HttpServerError.HttpServerError({ reason: new HttpServerError.InternalError({ cause, request }) })),
25
+ Effect.flatten,
26
+ Effect.provideService(HttpPlatform.HttpPlatform, {
27
+ ...platform,
28
+ fileResponse: (name, settings) => {
29
+ file = name;
30
+ return platform.fileResponse(name, settings);
31
+ },
32
+ }),
33
+ );
34
+ if (file === undefined) {
35
+ return response;
36
+ }
37
+ // Observe the selected file so SPA fallbacks and conditional responses share its policy.
38
+ const pathname = new URL(request.originalUrl, "http://localhost").pathname;
39
+ return HttpServerResponse.setHeaders(response, yield* assetHeaders(options, file, pathname));
40
+ }).pipe(Effect.catch(HttpServerRespondable.toResponse));
41
+ yield* (options.prefix === undefined ? router : router.prefixed(options.prefix)).add("GET", "/*", handler);
42
+ }),
43
+ );
44
+ }
@@ -1,13 +1,14 @@
1
1
  import type { Duration, Layer } from "effect";
2
- import type { HttpRouter, HttpStaticServer } from "effect/http";
2
+ import type { HttpRouter } from "effect/http";
3
3
  import type { Rpc, RpcGroup } from "effect/rpc";
4
4
  import type { SessionPolicy, SessionShape } from "@shivaedev/identity/server/session.ts";
5
- import type { AppDatabaseOptions } from "./appHost.ts";
5
+ import type { AssetOptions } from "#AssetOptions.ts";
6
+ import type { AppDatabaseOptions } from "#appHost.ts";
6
7
 
7
8
  export type HostRouteRequirements = HttpRouter.HttpRouter | HttpRouter.Request<"Error", unknown>;
8
9
 
9
10
  export type HostCoreOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> = {
10
- readonly assets?: string | Parameters<typeof HttpStaticServer.layer>[0];
11
+ readonly assets?: string | AssetOptions;
11
12
  readonly config?: AppDatabaseOptions["config"] & {
12
13
  readonly port?: number;
13
14
  readonly host?: string;
@@ -23,7 +23,7 @@ export function hostRpcRoutes<TRpcs extends Rpc.Any, THandlers, TError, TRequire
23
23
  readonly rpcPath?: HttpRouter.PathInput;
24
24
  } & HostPolicy<TSession>,
25
25
  { bodySize, trustedProxy, nativeOrigins }: Effect.Success<ReturnType<typeof hostTransport>>,
26
- sensitive: ReturnType<typeof schemaSensitiveKeys>,
26
+ sensitive: Effect.Success<ReturnType<typeof schemaSensitiveKeys>>,
27
27
  ) {
28
28
  const middleware: Layer.Layer<RequestTracing> | Layer.Layer<Authenticated | MaybeAuthenticated | RequestTracing> =
29
29
  options.policy === "loopback"