@shivaedev/server 0.20.2 → 0.23.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.
Files changed (101) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +50 -5
  3. package/dist/AppHostFactory.d.ts +2 -2
  4. package/dist/AppHostFactory.d.ts.map +1 -1
  5. package/dist/UnixSocketRequest.d.ts +3 -0
  6. package/dist/UnixSocketRequest.d.ts.map +1 -0
  7. package/dist/UnixSocketRequest.js +3 -0
  8. package/dist/UnixSocketRequest.js.map +1 -0
  9. package/dist/adapters/hostHttpServices.d.ts +3 -0
  10. package/dist/adapters/hostHttpServices.d.ts.map +1 -0
  11. package/dist/adapters/hostHttpServices.js +6 -0
  12. package/dist/adapters/hostHttpServices.js.map +1 -0
  13. package/dist/adapters/nodeHttpServer.d.ts +3 -1
  14. package/dist/adapters/nodeHttpServer.d.ts.map +1 -1
  15. package/dist/adapters/nodeHttpServer.js +36 -7
  16. package/dist/adapters/nodeHttpServer.js.map +1 -1
  17. package/dist/adapters/socketState.d.ts +3 -0
  18. package/dist/adapters/socketState.d.ts.map +1 -0
  19. package/dist/adapters/socketState.js +24 -0
  20. package/dist/adapters/socketState.js.map +1 -0
  21. package/dist/adapters/unixHttpServer.d.ts +11 -0
  22. package/dist/adapters/unixHttpServer.d.ts.map +1 -0
  23. package/dist/adapters/unixHttpServer.js +56 -0
  24. package/dist/adapters/unixHttpServer.js.map +1 -0
  25. package/dist/appDatabase.js +1 -1
  26. package/dist/appDatabase.js.map +1 -1
  27. package/dist/appHost.d.ts +3 -6
  28. package/dist/appHost.d.ts.map +1 -1
  29. package/dist/appHost.js +2 -2
  30. package/dist/appHost.js.map +1 -1
  31. package/dist/appHostHttp.d.ts +345 -111
  32. package/dist/appHostHttp.d.ts.map +1 -1
  33. package/dist/appHostHttp.js +7 -7
  34. package/dist/appHostHttp.js.map +1 -1
  35. package/dist/hostOptions.d.ts +12 -2
  36. package/dist/hostOptions.d.ts.map +1 -1
  37. package/dist/hostRpc.d.ts +21 -1
  38. package/dist/hostRpc.d.ts.map +1 -1
  39. package/dist/hostRpc.js +2 -1
  40. package/dist/hostRpc.js.map +1 -1
  41. package/dist/hostRpcRoutes.d.ts +36 -7
  42. package/dist/hostRpcRoutes.d.ts.map +1 -1
  43. package/dist/hostRpcRoutes.js +11 -6
  44. package/dist/hostRpcRoutes.js.map +1 -1
  45. package/dist/hostSensitiveKeys.d.ts +12 -0
  46. package/dist/hostSensitiveKeys.d.ts.map +1 -0
  47. package/dist/hostSensitiveKeys.js +8 -0
  48. package/dist/hostSensitiveKeys.js.map +1 -0
  49. package/dist/hostTransport.d.ts +2 -0
  50. package/dist/hostTransport.d.ts.map +1 -1
  51. package/dist/hostTransport.js +2 -1
  52. package/dist/hostTransport.js.map +1 -1
  53. package/dist/hostVersionLayer.d.ts +2 -0
  54. package/dist/hostVersionLayer.d.ts.map +1 -0
  55. package/dist/hostVersionLayer.js +8 -0
  56. package/dist/hostVersionLayer.js.map +1 -0
  57. package/dist/socketRpc.d.ts.map +1 -1
  58. package/dist/socketRpc.js +2 -1
  59. package/dist/socketRpc.js.map +1 -1
  60. package/dist/testing/adapters/hostProcess.d.ts +1 -0
  61. package/dist/testing/adapters/hostProcess.d.ts.map +1 -1
  62. package/dist/testing/adapters/hostProcess.js +27 -0
  63. package/dist/testing/adapters/hostProcess.js.map +1 -1
  64. package/dist/testing/hostProcess.d.ts +4 -2
  65. package/dist/testing/hostProcess.d.ts.map +1 -1
  66. package/dist/testing/hostProcess.js +9 -2
  67. package/dist/testing/hostProcess.js.map +1 -1
  68. package/dist/testing/hostProcessChild.d.ts +1 -0
  69. package/dist/testing/hostProcessChild.d.ts.map +1 -1
  70. package/dist/testing/hostProcessChild.js +5 -1
  71. package/dist/testing/hostProcessChild.js.map +1 -1
  72. package/dist/testing/hostProcessProtocol.d.ts +3 -0
  73. package/dist/testing/hostProcessProtocol.d.ts.map +1 -1
  74. package/dist/testing/hostProcessProtocol.js +1 -0
  75. package/dist/testing/hostProcessProtocol.js.map +1 -1
  76. package/dist/testing/hostTime.d.ts +9 -0
  77. package/dist/testing/hostTime.d.ts.map +1 -0
  78. package/dist/testing/hostTime.js +27 -0
  79. package/dist/testing/hostTime.js.map +1 -0
  80. package/package.json +15 -15
  81. package/src/AppHostFactory.ts +8 -8
  82. package/src/UnixSocketRequest.ts +3 -0
  83. package/src/adapters/hostHttpServices.ts +10 -0
  84. package/src/adapters/nodeHttpServer.ts +40 -7
  85. package/src/adapters/socketState.ts +22 -0
  86. package/src/adapters/unixHttpServer.ts +74 -0
  87. package/src/appDatabase.ts +1 -1
  88. package/src/appHost.ts +21 -23
  89. package/src/appHostHttp.ts +7 -7
  90. package/src/hostOptions.ts +11 -6
  91. package/src/hostRpc.ts +6 -1
  92. package/src/hostRpcRoutes.ts +14 -5
  93. package/src/hostSensitiveKeys.ts +11 -0
  94. package/src/hostTransport.ts +9 -2
  95. package/src/hostVersionLayer.ts +8 -0
  96. package/src/socketRpc.ts +2 -1
  97. package/src/testing/adapters/hostProcess.ts +27 -0
  98. package/src/testing/hostProcess.ts +12 -3
  99. package/src/testing/hostProcessChild.ts +6 -1
  100. package/src/testing/hostProcessProtocol.ts +1 -0
  101. package/src/testing/hostTime.ts +33 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.23.0 - 2026-11-04
4
+
5
+ ### Added
6
+
7
+ - Allow `appHost` to omit both the native RPC `group` and `handlers` while serving an existing HTTP API through `routes`, as a migration step towards native RPC. Host services, migrations, body-limit configuration, proxy trust, health and tracing retain their existing behavior; the existing API owns authentication and CORS. No native RPC endpoint or RPC preflight policy is installed without a group.
8
+ - `appHost` accepts `config.socketPath` for Unix HTTP and WebSocket RPC, alone or beside an explicit TCP `port`. Socket files are published with mode `0600`, stale sockets are reclaimed at startup, and shutdown removes the socket.
9
+
10
+ ### Breaking
11
+
12
+ - Host option types include the HTTP-only shape. Consumers that inspect native RPC options must narrow with `options.group !== undefined` before reading the group or handlers. Existing native `appHost` calls retain their options.
13
+
14
+ ## 0.22.0 - 2026-11-04
15
+
16
+ ### Added
17
+
18
+ - Session hosts resolve and authorize declared subjects before handlers run. Self commands take no account id; delegated requests select an account with the `x-platform-subject` transport header and receive the contract's typed refusal when unauthorized.
19
+ - Host process test fixtures can load a replacement before stopping the current host, using `beforeStart` with the child's `awaitHostStart` handshake.
20
+
21
+ ### Breaking
22
+
23
+ - `appHost` startup failures carry every conflicting field in `SensitiveFieldConflict.conflicts`. Iterate over these entries instead of reading the top-level `field`, `publicSchema` and `sensitiveSchema`; the message lists all entries.
24
+
25
+ ## 0.21.0 - 2026-11-03
26
+
27
+ ### Added
28
+
29
+ - The `hostTime` testing layer advances worker lease time and waits for heartbeat and release checks.
30
+
31
+ ### Fixed
32
+
33
+ - Worker-release heartbeat and polling timers use the live lifecycle clock by default, so passing an application day does not replay every heartbeat.
34
+
35
+ ### Breaking
36
+
37
+ - Stories that drive worker-release polling through their application TestClock must now pass that clock as `config.clock` to `appDatabase`, `appHost` or `workerHost`. Use the `hostTime` testing layer and its `timePasses` verb to advance lease timestamps and await release checks.
38
+
3
39
  ## 0.20.2 - 2026-11-03
4
40
 
5
41
  ### Changed
package/README.md CHANGED
@@ -29,6 +29,39 @@ The RPC host composes contract's `CommandGuard` with `publishCommand` and the `C
29
29
 
30
30
  The optional modules solve different boundaries. `runtime/` carries Effect services into Promise callers, and `node-http/` combines subscription cancellation sources. Choose the modules that match the application rather than adopting every integration.
31
31
 
32
+ ### Adopt the host before replacing an existing API
33
+
34
+ For an app migrating from tRPC or another HTTP API, omit both `group` and `handlers` and mount the existing API through `routes`. This is a supported migration step towards native RPC; new apps use native contracts and handlers. Without a group the host installs no native RPC endpoint or RPC preflight policy, so an existing API can keep `/rpc`. The existing API continues to own its authentication and CORS policy. Supply `sessions` only if application routes or browser error reporting need the host's session policy.
35
+
36
+ ```ts
37
+ import { Effect } from "effect";
38
+ import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
39
+ import { readBoundedBody } from "@shivaedev/http/server/boundedBody.ts";
40
+ import { appHost } from "@shivaedev/server/appHost.ts";
41
+ import { handleRequest } from "./existing-api.ts";
42
+
43
+ const Routes = HttpRouter.add("POST", "/api/trpc/*", () =>
44
+ Effect.gen(function* () {
45
+ const body = yield* readBoundedBody();
46
+ const request = yield* HttpServerRequest.HttpServerRequest;
47
+ const web = yield* HttpServerRequest.toWeb(request);
48
+ const response = yield* Effect.promise(() => handleRequest(new Request(web, { body })));
49
+ return HttpServerResponse.fromWeb(response);
50
+ }),
51
+ );
52
+
53
+ const Server = appHost({
54
+ routes: Routes,
55
+ config: { host: "0.0.0.0", trustedProxy: "127.0.0.1", maxBodySize: 1024 * 1024 },
56
+ });
57
+ ```
58
+
59
+ `handleRequest` is the app's existing `(request: Request) => Promise<Response>`. Use `readBoundedBody` when forwarding bodies; `routes` receives the host's `MAX_BODY_SIZE` or `config.maxBodySize`, and that reader returns 413 on overflow. Merely converting a request to a Web request does not bound its body. Configure the actual proxy peer in `trustedProxy`; the host still requires trust when binding publicly and applies it at its own transport boundaries, including browser error reports. This setting does not install authentication or an Origin guard around application routes.
60
+
61
+ The same host composition provides scoped `services`, migration ordering (including deferred `application` construction), `/health`, HTTP tracing with incoming W3C trace context, and diagnostic redaction. Health still returns 503 without SQL and 200 with reachable PostgreSQL. Add the native `group`, `handlers` and session policy as the app adopts native RPC, alongside any remaining HTTP routes.
62
+
63
+ Host option types include this HTTP-only shape. A wrapper that reads native RPC options first narrows with `options.group !== undefined` before reading `group` or `handlers`. Existing native `appHost` calls keep their options.
64
+
32
65
  ### Prepare local development
33
66
 
34
67
  `setupDatabases()` from `@shivaedev/server/setupDatabases.ts` reads `DATABASE_URL` and `TEST_DATABASE_URL` through Effect Config and prepares both local databases with `@shivaedev/local-postgres`. Database names come from those URLs. `DOCKER_HOST` and `DOCKER_CONTEXT` are optional. Missing database URLs fail with a typed Config error; setup command failures retain their local-postgres error tags. Provide `ChildProcessSpawner` at the setup entry point, for example with `Effect.provide(NodeServices.layer)` before `NodeRuntime.runMain`. Migrations remain the application's responsibility.
@@ -83,6 +116,8 @@ NodeRuntime.runMain(Layer.launch(Server));
83
116
 
84
117
  The `sessions` Layer provides one identity `SessionPolicy` to handler middleware, sockets, change subscriptions and application routes. Construct it with `Layer.succeed(SessionPolicy, { origin, provider, roles })`; policy readers take no policy argument.
85
118
 
119
+ A session host also installs identity's subject resolver for contracts with `subject: selfSubject` or `subject: accountSubject(...)`. It resolves the session account or authorizes the delegated `x-platform-subject` transport header before the handler runs, supplies the branded `Subject` plus the actor's `Identity` and `SessionUser` to the request, and returns the declared typed refusal when delegation is denied. Business payloads do not carry an owner id. See [declared request subjects](https://github.com/ShivaeDev/platform/tree/main/packages/identity#declared-request-subjects) for declarations and session profile requirements.
120
+
86
121
  Omit `services` when the app has no service Layer of its own. The host uses `Layer.empty`; handler requirements remain explicit, and a migrated host still provides its database services to handlers. Annotated options that declare service outputs, errors or requirements must supply a `services` Layer.
87
122
 
88
123
  Pass application HTTP endpoints through `routes`, including routes that read app services. Use `handlers` for RPC implementations and their middleware Layers. `routes` accepts native HTTP router Layers; the host supplies `services` during route construction and request handling, preserves route Layer build errors and leaves missing services in the host’s requirement type.
@@ -126,11 +161,15 @@ Static layers mounted manually through `routes` keep Effect's native behavior. T
126
161
 
127
162
  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.
128
163
 
164
+ Set `config.socketPath` to serve the application over a Unix socket instead of the default TCP listener. Also set `config.port` to serve the same routes on both listeners; `HttpServer.address` then reports the TCP address. With only `socketPath`, `PORT` does not enable TCP and `HttpServer.address` reports the public socket path. The parent directory must exist. The host publishes the socket with mode `0600`, replaces an unanswered stale socket at startup, refuses an already running listener, and removes its socket on shutdown. Startup uses a private staging directory and a sibling `.<socket-name>.starting` lock. If a process is forcibly killed during startup, remove that lock before restarting, after confirming no startup is still running.
165
+
166
+ Unix clients can call HTTP RPC and subscribe through WebSocket RPC over the same socket path. Unix requests use filesystem access for transport admission; session middleware and query read policies still apply. TCP keeps its loopback, origin and proxy checks. Work Board uses this listener at its existing `board.sock` path for the Board plugin and `work-board mcp`.
167
+
129
168
  RPC request bodies are limited to 1 MiB by default. Set `MAX_BODY_SIZE` to a byte count or override it with `config.maxBodySize`, a nonnegative safe integer. An oversized NDJSON body, fixed-length or chunked, returns a 4xx before any RPC handler runs. The same byte limit applies to each WebSocket RPC message, including binary messages and the combined payload of continuation frames. An oversized message closes the connection with code 1009 before any RPC in that message runs; native Effect socket clients receive a typed `SocketError` with a `SocketCloseError` reason. The limit includes bearer authentication frames, and zero refuses every nonempty message. This limit applies to the host's RPC route.
130
169
 
131
170
  For a native Node HTTP route outside RPC, read the request body with `readBoundedBody` from [`@shivaedev/http`](https://github.com/ShivaeDev/platform/tree/main/packages/http#readme), which rejects oversized bodies with a typed 413 failure.
132
171
 
133
- Ordinary POST RPC uses `localRpcGuard` from `@shivaedev/identity/server/adapters/local.ts`: it requires a loopback peer and Host, same-origin or absent Origin, and the NDJSON content type. The WebSocket upgrade uses the same loopback, origin and trusted-proxy checks without an HTTP body content type. Session lookup uses the upgrade's transport headers; RPC message headers cannot replace its cookie or Origin. Session middleware revalidates authenticated streams at `streamRevalidationInterval` and ends revoked subscriptions with typed `Unauthorized`. Cookie-authenticated sockets remain open; later protected calls use the same session checks. Automatic live subscriptions reload the session before each hint and use its current roles and grants for the query policy and any pushed query result. A policy denial keeps an established subscription open; delivery resumes on the next authorized hint. POST RPC refuses `$changes` subscriptions with the contract’s typed `WebSocketRequired` error and a message saying they need the WebSocket protocol. The host applies `RequestTracing` last to every served RPC, including loopback RPC, so it wraps authentication and handlers without a per-contract tracing declaration. Existing tracing declarations run once at that outermost boundary. With a session policy, contracts declare `Authenticated` and `MaybeAuthenticated` as needed; the host supplies their implementations. For `AuthenticatedUser`, merge `authenticatedUserLayer()` from `@shivaedev/identity/server/session.ts` beside the handlers. Declared errors retain their Schema types. Applications still own resource authorization and use `rpcBoundary` when they need to map unexpected failures.
172
+ On TCP, ordinary POST RPC uses `localRpcGuard` from `@shivaedev/identity/server/adapters/local.ts`: it requires a loopback peer and Host, same-origin or absent Origin, and the NDJSON content type. The WebSocket upgrade uses the same loopback, origin and trusted-proxy checks without an HTTP body content type. Session lookup uses the upgrade's transport headers; RPC message headers cannot replace its cookie or Origin. Session middleware revalidates authenticated streams at `streamRevalidationInterval` and ends revoked subscriptions with typed `Unauthorized`. Cookie-authenticated sockets remain open; later protected calls use the same session checks. Automatic live subscriptions reload the session before each hint and use its current roles and grants for the query policy and any pushed query result. A policy denial keeps an established subscription open; delivery resumes on the next authorized hint. POST RPC refuses `$changes` subscriptions with the contract’s typed `WebSocketRequired` error and a message saying they need the WebSocket protocol. The host applies `RequestTracing` last to every served RPC, including loopback RPC, so it wraps authentication and handlers without a per-contract tracing declaration. Existing tracing declarations run once at that outermost boundary. With a session policy, contracts declare `Authenticated` and `MaybeAuthenticated` as needed; the host supplies their implementations. For `AuthenticatedUser`, merge `authenticatedUserLayer()` from `@shivaedev/identity/server/session.ts` beside the handlers. Declared errors retain their Schema types. Applications still own resource authorization and use `rpcBoundary` when they need to map unexpected failures.
134
173
 
135
174
  Native clients that cannot set upgrade headers use `makeClient`'s `bearerToken` option from `@shivaedev/contract/bind.ts`. On session hosts, `GET /rpc?auth=frame` requires a first text frame shaped as `{"_tag":"Authenticate","token":"<credential>"}` within five seconds, with at most 8192 characters. The host consumes that frame before starting native RPC and supplies its bearer as the socket's transport Authorization header. The existing session provider, identity middleware, Origin policy and query read policies apply to every call and live read. RPC message headers cannot replace the authenticated credential. Configure bearer admission on the session provider and the WebView Origin through `nativeOrigins`. A long-lived bearer is never placed in a URL.
136
175
 
@@ -138,10 +177,12 @@ Invalid, expired, malformed, oversized or missing first-frame credentials close
138
177
 
139
178
  Every response from the host's native RPC endpoint carries `Cache-Control: private, no-store`, including mixed public and authenticated batches, typed failures, transport rejections, body-read failures and streams. The host sets this at the outer response boundary without inspecting batch contents.
140
179
 
141
- For local tools, use `policy: "loopback"` with contracts that do not use session middleware to serve RPC without a session provider. The same guard applies. This policy does not use `TRUSTED_PROXY` or `config.trustedProxy`. Set `rpcPath` to choose another native RPC route; `/rpc` remains the default.
180
+ For local tools, use `policy: "loopback"` with contracts that do not use session middleware to serve RPC without a session provider. The same TCP guard applies. This policy does not use `TRUSTED_PROXY` or `config.trustedProxy`. Set `rpcPath` to choose another native RPC route; `/rpc` remains the default.
142
181
 
143
182
  Omit `migrations` to host an app without a database. This form creates no SQL pool and reads no `DATABASE_URL`; `AppHttpHostOptions` describes it. `AppHostOptions` requires migrations for database-backed hosts. A service that needs SQL still requires a SQL Layer. Provide `appDatabase` to the application’s service Layer when it owns database composition.
144
183
 
184
+ Set `config.buildVersion` to the deployed build ID to announce it over the host's native RPC socket. `platform.hostVersion.watch` sends that opaque string when subscribed and stays open; a reconnected subscriber receives the replacement host's ID. Omitting the option leaves the stream silent. Embed the same ID in the browser bundle and use React's `deployUpdate` controller to expose a superseded bundle without polling health. The application supplies staged-update activation, blockers, reload wording and confirmation.
185
+
145
186
  `appHost` serves unauthenticated `GET /health`. It queries its SQL client on each request and returns `200` only when the query succeeds within two seconds; a missing SQL client, query failure or timeout returns `503`. Both responses have an empty body and `Cache-Control: no-store`. This route also works when the SQL client comes from the application’s `services` Layer. Use it for database readiness checks.
146
187
 
147
188
  Set `migrations.mode: "check"` on `appDatabase` or a database-backed `appHost` when a separate pre-deploy command owns migrations. Startup reads the ledger and fails with native `MigrationError` (`kind: "BadState"`) if any required migration ID or name is missing or a schema component is pending; it does not run migrations or create a ledger. Later ledger entries are allowed for rolling deployments. Use `migrations.mode: "wait"` for services that can start before that pre-deploy command finishes. It re-reads the ledger and every registered component every second until all are current, then starts the application. Set `migrations.pollInterval` and `migrations.waitTimeout` with Effect duration inputs to change the interval and five-minute timeout. If the first check finds pending work, Effect’s logger emits `Waiting for database migrations` at info, then `Still waiting for database migrations` every 30 seconds independently of polling. Set `migrations.progressInterval` with an Effect duration input to change that progress interval. These lines carry `pendingMigrations` (ID and name) and `pendingComponents` (name and detail) annotations. A later successful check logs `Database migrations current` once; timeout logs `Timed out waiting for database migrations` with the pending annotations before failing. An initially current schema emits none of these lines. The host adds no connection details or secrets to these diagnostics. Timeout fails with the same `MigrationError` as `"check"`; interruption stops polling and closes the pool. SQL failures fail immediately. With `mode` omitted or `"migrate"`, startup applies pending ledger migrations with a five-second lock timeout unless `migrations.lockTimeout` overrides it, then applies schema components outside the ledger transaction.
@@ -227,7 +268,9 @@ Set `config.maxConnections` on `appDatabase` or a migrated `appHost` to bound th
227
268
 
228
269
  The host defaults to `config.connectionTTL: "10 minutes"` and `config.idleTimeout: "1 minute"`. Both accept native Effect durations; `config.minConnections` controls the idle floor. Lifetime expiry replaces a query connection on its next checkout, allowing active queries and transactions to finish. The reserved change listener renews on the same lifetime, resynchronizes live subscribers across renewal and resumes committed hints, including with a separate listener URL. No PostgreSQL `idle_session_timeout` is set: an idle LISTEN session must stay alive until its owner renews it.
229
270
 
230
- Database pool maintenance and change-listener heartbeats, deadlines, retries and renewal use the live clock. A story can advance its application clock by days while the host and job worker keep running; handlers and jobs still see the advanced application time. For stories about database lifecycle timers, pass the story's native `Clock.Clock` service as `config.clock` on `appDatabase` or `appHost`. This option applies to both application and separate listener pools; it does not change the application clock or migration wait timers.
271
+ Database pool maintenance, worker-release coordination and change-listener heartbeats, deadlines, retries and renewal use the live clock. A story can advance its application clock by days while the host and job worker keep running; handlers and jobs still see the advanced application time. For stories about database lifecycle timers, pass the story's native `Clock.Clock` service as `config.clock` on `appDatabase` or `appHost`. This option applies to worker-release timers and both application and separate listener pools; it does not change the application clock or migration wait timers.
272
+
273
+ To pass worker-release time in a story, build `hostTime()` from `@shivaedev/server/testing/hostTime.ts` under a native `TestClock`, then provide its `layer` to the worker host. `timePasses(duration)` advances that clock, writes the worker's lease heartbeat at the new time and waits for its release check. Production leases retain PostgreSQL's wall clock. Give separate worker processes the same starting timestamp. When an old worker drains a deliberately held job, advance it with `{ poll: false }` to write its heartbeat without waiting for the drain, then advance the replacement normally. After killing a worker, advance only the replacement; the crashed lease then expires on story time.
231
274
 
232
275
  For a deployment behind a proxy, set `HOST=0.0.0.0` and `TRUSTED_PROXY` to a comma-separated list of proxy peer IPs or CIDR ranges (IPv4 or IPv6), or use `config.host` and `config.trustedProxy`. Only matching peers may supply `X-Forwarded-Host` and `X-Forwarded-Proto` (`http` or `https`) for the guard's same-origin check; the proxy must overwrite both headers and preserve Origin. A single authority is required, and comma-separated forwarding chains are refused. IPv4-mapped IPv6 peers match their IPv4 address. A session host bound to a non-loopback address refuses to boot without `TRUSTED_PROXY` or `config.trustedProxy`, with a typed `TrustedProxyRequired` error from `@shivaedev/server/TrustedProxyRequired.ts` naming both settings and how to supply proxy peer addresses or CIDR ranges. Local loopback hosts keep working without proxy trust; `policy: "loopback"` does not use proxy trust. Malformed addresses or ranges fail `appHost` startup with a typed `ConfigError`. The starter's Railway deployment works out of the box: its web configuration supplies `TRUSTED_PROXY=100.64.0.0/10` and `AUTH_CLIENT_IP_HEADER=x-real-ip`, so matching peers supply forwarded client IPs for auth and the HTTPS authority for RPC origin checks. Set `PUBLIC_URL` to the app's HTTPS URL for secure session cookies. NDJSON and the application's session Origin policy still apply. See the [deployment quickstart](https://github.com/ShivaeDev/platform/blob/main/docs/framework/quickstart.md#deploy).
233
276
 
@@ -316,7 +359,7 @@ Diagnostic failure, defect and interruption reasons are rebuilt with sanitized a
316
359
 
317
360
  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.
318
361
 
319
- 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)`. The serializer correlates request tags and response IDs, including batches, and uses the validated schema policy to mask failures within their declared wire shapes. Incompatible masks fail policy definition with `InvalidRedactionMask` from `@shivaedev/errors/wireMask.ts`, before the host listens; supply a constant `redactionMask` annotation on a constrained sensitive schema when its generic mask cannot decode. Unassociated defects use the conservative policy across the host's defect schemas.
362
+ 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, with every conflicting field in the group in its `conflicts` array and message. Each entry contains `field`, `publicSchema` and `sensitiveSchema`. Pass the predicate and its methods to `redactingRpcSerialization(wire, sensitive)`. The serializer correlates request tags and response IDs, including batches, and uses the validated schema policy to mask failures within their declared wire shapes. Incompatible masks fail policy definition with `InvalidRedactionMask` from `@shivaedev/errors/wireMask.ts`, before the host listens; supply a constant `redactionMask` annotation on a constrained sensitive schema when its generic mask cannot decode. Unassociated defects use the conservative policy across the host's defect schemas.
320
363
 
321
364
  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).
322
365
 
@@ -384,6 +427,8 @@ The signal aborts on an additional signal, socket close, incomplete request clos
384
427
 
385
428
  In the child entry point, build the app host Layer, then run `reportHostReady` from `@shivaedev/server/testing/hostProcessChild.ts` with that Layer's context. It reads `HttpServer`, reports the listening URL and process ID over IPC, and fails if there is no parent IPC channel. The child must install its signal handlers before reporting readiness. After a handler finishes its work, run `acknowledgeHostSignal(signal)` from the same module. `signal(signal)` in the parent sends the OS signal and waits for that signal's IPC acknowledgement. Deliver signals sequentially, using signals the child handles; signals that kill or suspend a process cannot be acknowledged.
386
429
 
430
+ For a restart story, pass the current host's `stop()` Effect as the replacement's `beforeStart` option. In the replacement child, run `awaitHostStart` from `@shivaedev/server/testing/hostProcessChild.ts` before building the app host Layer. This handshake lets the replacement finish loading its modules while the current host still serves requests. The parent runs `beforeStart` after the child reports preparation, then releases the child with `SIGUSR2` and waits for normal readiness. Reserve that signal until `awaitHostStart` completes.
431
+
387
432
  Wrap the kit in the application's story vocabulary:
388
433
 
389
434
  ```ts
@@ -393,7 +438,7 @@ import { hostProcess } from "@shivaedev/server/testing/hostProcess.ts";
393
438
 
394
439
  const host = storyKit({
395
440
  name: "application host",
396
- clock: "live",
441
+ clock: "test",
397
442
  stages: [],
398
443
  create: () => hostProcess({ module: new URL("./host.ts", import.meta.url) }),
399
444
  verbs: (process) => ({
@@ -6,10 +6,10 @@ import type { appHostHttp, deferredHost } from "#appHostHttp.ts";
6
6
  import type { HostRouteRequirements } from "#hostOptions.ts";
7
7
  type PreflightHost<THost extends Layer.Any, TServices, TError, TRequirements> = Layer.Layer<Layer.Success<THost> | TServices, Layer.Error<THost> | TError, Exclude<Layer.Services<THost>, TServices | Crypto.Crypto> | Exclude<TRequirements, Crypto.Crypto>>;
8
8
  export interface AppHostFactory {
9
- <TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TApplicationError = never, TApplicationRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never>(options: AppHostInput<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TApplicationError, TApplicationRequirements, TPreflight, TPreflightError, TPreflightRequirements, TRouteError, TRouteRequirements, TMigrationError> & {
9
+ <TRpcs extends Rpc.Any = never, THandlers = never, THandlerError = never, THandlerRequirements = never, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TApplicationError = never, TApplicationRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never>(options: AppHostInput<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TApplicationError, TApplicationRequirements, TPreflight, TPreflightError, TPreflightRequirements, TRouteError, TRouteRequirements, TMigrationError> & {
10
10
  readonly migrations: AppDatabaseOptions<TMigrations, TMigrationError>["migrations"];
11
11
  }): PreflightHost<ReturnType<typeof deferredHost<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TApplicationError, TApplicationRequirements, TRouteError, TRouteRequirements, TMigrationError>>, NoInfer<TPreflight>, NoInfer<TPreflightError>, NoInfer<TPreflightRequirements>>;
12
- <TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements>(options: AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TPreflight, TPreflightError, TPreflightRequirements, TRouteError, TRouteRequirements>): PreflightHost<ReturnType<typeof appHostHttp<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TRouteError, TRouteRequirements>>, NoInfer<TPreflight>, NoInfer<TPreflightError>, NoInfer<TPreflightRequirements>>;
12
+ <TRpcs extends Rpc.Any = never, THandlers = never, THandlerError = never, THandlerRequirements = never, TServices = never, TServiceError = never, TServiceRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements>(options: AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TPreflight, TPreflightError, TPreflightRequirements, TRouteError, TRouteRequirements>): PreflightHost<ReturnType<typeof appHostHttp<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TRouteError, TRouteRequirements>>, NoInfer<TPreflight>, NoInfer<TPreflightError>, NoInfer<TPreflightRequirements>>;
13
13
  }
14
14
  export {};
15
15
  //# sourceMappingURL=AppHostFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppHostFactory.d.ts","sourceRoot":"","sources":["../src/AppHostFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,KAAK,aAAa,CAAC,KAAK,SAAS,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,IAAI,KAAK,CAAC,KAAK,CAC1F,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,SAAS,EAChC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,MAAM,EAC3B,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CA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,EAClB,eAAe,CACf,CACD,EACD,OAAO,CAAC,UAAU,CAAC,EACnB,OAAO,CAAC,eAAe,CAAC,EACxB,OAAO,CAAC,sBAAsB,CAAC,CAC/B,CAAC;IAEF,CACC,KAAK,SAAS,GAAG,CAAC,GAAG,GAAG,KAAK,EAC7B,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,KAAK,EACrB,oBAAoB,GAAG,KAAK,EAC5B,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,KAAK,EACrB,oBAAoB,GAAG,KAAK,EAC5B,UAAU,GAAG,KAAK,EAClB,eAAe,GAAG,KAAK,EACvB,sBAAsB,GAAG,KAAK,EAC9B,WAAW,GAAG,KAAK,EACnB,kBAAkB,GAAG,qBAAqB,EAE1C,OAAO,EAAE,kBAAkB,CAC1B,KAAK,EACL,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,WAAW,EACX,kBAAkB,CAClB,GACC,aAAa,CACf,UAAU,CACT,OAAO,WAAW,CACjB,KAAK,EACL,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,kBAAkB,CAClB,CACD,EACD,OAAO,CAAC,UAAU,CAAC,EACnB,OAAO,CAAC,eAAe,CAAC,EACxB,OAAO,CAAC,sBAAsB,CAAC,CAC/B,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ import { Context } from "effect";
2
+ export declare const UnixSocketRequest: Context.Reference<boolean>;
3
+ //# sourceMappingURL=UnixSocketRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnixSocketRequest.d.ts","sourceRoot":"","sources":["../src/UnixSocketRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,eAAO,MAAM,iBAAiB,4BAAmG,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Context } from "effect";
2
+ export const UnixSocketRequest = Context.Reference("@shivaedev/server/UnixSocketRequest", { defaultValue: () => false });
3
+ //# sourceMappingURL=UnixSocketRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnixSocketRequest.js","sourceRoot":"","sources":["../src/UnixSocketRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAU,qCAAqC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Layer } from "effect";
2
+ export declare const hostHttpServices: Layer.Layer<import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices, never, never>;
3
+ //# sourceMappingURL=hostHttpServices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostHttpServices.d.ts","sourceRoot":"","sources":["../../src/adapters/hostHttpServices.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,EAAU,MAAM,QAAQ,CAAC;AAE3D,eAAO,MAAM,gBAAgB,+KAM5B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
2
+ import { Effect, FileSystem, Layer, Option } from "effect";
3
+ export const hostHttpServices = Layer.unwrap(Effect.map(Effect.serviceOption(FileSystem.FileSystem), (fileSystem) => Option.isSome(fileSystem)
4
+ ? Layer.merge(NodeHttpServer.layerHttpServices, Layer.succeed(FileSystem.FileSystem, fileSystem.value))
5
+ : NodeHttpServer.layerHttpServices));
6
+ //# sourceMappingURL=hostHttpServices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostHttpServices.js","sourceRoot":"","sources":["../../src/adapters/hostHttpServices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAC3C,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CACtE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;IACxB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IACvG,CAAC,CAAC,cAAc,CAAC,iBAAiB,CACnC,CACD,CAAC"}
@@ -1,8 +1,10 @@
1
1
  import { Config, type Duration, Layer } from "effect";
2
+ import { HttpServer } from "effect/http";
2
3
  export declare function nodeHttpServer(host: string, config?: {
3
4
  readonly port?: number;
5
+ readonly socketPath?: string;
4
6
  readonly gracefulShutdownTimeout?: Duration.Input;
5
7
  readonly disablePreemptiveShutdown?: boolean;
6
8
  readonly maxBodySize?: number;
7
- }): Layer.Layer<import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | import("@effect/platform-node/NodeServices").NodeServices, Config.ConfigError | import("effect/http/HttpServerError").ServeError, never>;
9
+ }): Layer.Layer<import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices, Config.ConfigError | Error | import("effect/PlatformError").PlatformError, never>;
8
10
  //# sourceMappingURL=nodeHttpServer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodeHttpServer.d.ts","sourceRoot":"","sources":["../../src/adapters/nodeHttpServer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,KAAK,QAAQ,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE9D,wBAAgB,cAAc,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE;IACR,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,uBAAuB,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;IAClD,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAC7C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B,+RAcD"}
1
+ {"version":3,"file":"nodeHttpServer.d.ts","sourceRoot":"","sources":["../../src/adapters/nodeHttpServer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,KAAK,QAAQ,EAAU,KAAK,EAAS,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,wBAAgB,cAAc,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE;IACR,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,uBAAuB,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;IAClD,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAC7C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B,6QA2CD"}
@@ -1,17 +1,46 @@
1
1
  import { createServer } from "node:http";
2
2
  import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
3
- import { Config, Effect, Layer } from "effect";
3
+ import { Config, Effect, Layer, Scope } from "effect";
4
+ import { HttpServer } from "effect/http";
5
+ import { hostHttpServices } from "#adapters/hostHttpServices.ts";
6
+ import { unixHttpServer } from "#adapters/unixHttpServer.ts";
4
7
  export function nodeHttpServer(host, config) {
5
- return Layer.unwrap(Effect.gen(function* () {
6
- const port = config?.port ?? (yield* Config.Int("PORT").pipe(Config.withDefault(3000)));
7
- return NodeHttpServer.layer(createServer, {
8
+ return Layer.effect(HttpServer.HttpServer, Effect.gen(function* () {
9
+ const socketPath = config?.socketPath;
10
+ const options = {
8
11
  gracefulShutdownTimeout: config?.gracefulShutdownTimeout,
9
- host,
10
- port,
11
12
  websocket: config?.maxBodySize === undefined ? undefined : { maxPayload: socketPayloadLimit(config.maxBodySize) },
12
13
  ...(config?.disablePreemptiveShutdown === undefined ? {} : { disablePreemptiveShutdown: config.disablePreemptiveShutdown }),
14
+ };
15
+ if (socketPath === undefined) {
16
+ const port = config?.port ?? (yield* Config.Int("PORT").pipe(Config.withDefault(3000)));
17
+ return yield* NodeHttpServer.make(createServer, { ...options, host, port });
18
+ }
19
+ const listeners = yield* Scope.fork(yield* Scope.Scope, "parallel");
20
+ const socketScope = yield* Scope.fork(listeners, "sequential");
21
+ const unix = yield* unixHttpServer(socketPath, options).pipe(Scope.provide(socketScope));
22
+ // Socket preparation emits filesystem events; keep TCP closed until it finishes.
23
+ const tcpScope = yield* Scope.fork(listeners, "sequential");
24
+ const tcp = config?.port === undefined
25
+ ? undefined
26
+ : yield* NodeHttpServer.make(createServer, {
27
+ ...options,
28
+ host,
29
+ port: config.port,
30
+ }).pipe(Scope.provide(tcpScope));
31
+ return HttpServer.make({
32
+ address: tcp?.address ?? unix.address,
33
+ serve: (handler, middleware) => Effect.gen(function* () {
34
+ const servingListeners = yield* Scope.fork(yield* Scope.Scope, "parallel");
35
+ const unixServing = yield* Scope.fork(servingListeners, "sequential");
36
+ yield* (middleware === undefined ? unix.serve(handler) : unix.serve(handler, middleware)).pipe(Scope.provide(unixServing));
37
+ if (tcp !== undefined) {
38
+ const serving = yield* Scope.fork(servingListeners, "sequential");
39
+ yield* (middleware === undefined ? tcp.serve(handler) : tcp.serve(handler, middleware)).pipe(Scope.provide(serving));
40
+ }
41
+ }),
13
42
  });
14
- }));
43
+ })).pipe(Layer.provideMerge(hostHttpServices));
15
44
  }
16
45
  function socketPayloadLimit(bytes) {
17
46
  // ws truncates maxPayload to a signed 32-bit integer; the RPC reader covers zero and larger limits.
@@ -1 +1 @@
1
- {"version":3,"file":"nodeHttpServer.js","sourceRoot":"","sources":["../../src/adapters/nodeHttpServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,cAAc,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAiB,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE9D,MAAM,UAAU,cAAc,CAC7B,IAAY,EACZ,MAKC;IAED,OAAO,KAAK,CAAC,MAAM,CAClB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACnB,MAAM,IAAI,GAAG,MAAM,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACxF,OAAO,cAAc,CAAC,KAAK,CAAC,YAAY,EAAE;YACzC,uBAAuB,EAAE,MAAM,EAAE,uBAAuB;YACxD,IAAI;YACJ,IAAI;YACJ,SAAS,EAAE,MAAM,EAAE,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;YACjH,GAAG,CAAC,MAAM,EAAE,yBAAyB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,yBAAyB,EAAE,MAAM,CAAC,yBAAyB,EAAE,CAAC;SAC3H,CAAC,CAAC;IACJ,CAAC,CAAC,CACF,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa;IACxC,oGAAoG;IACpG,OAAO,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CA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K,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;gBAC3E,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;gBACtE,KAAK,CAAC,CAAC,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;gBAC3H,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;oBACvB,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;oBAClE,KAAK,CAAC,CAAC,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;gBACtH,CAAC;YACF,CAAC,CAAC;SACH,CAAC,CAAC;IACJ,CAAC,CAAC,CACF,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa;IACxC,oGAAoG;IACpG,OAAO,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Effect } from "effect";
2
+ export declare function socketState(path: string): Effect.Effect<"live" | "missing" | "stale", Error, never>;
3
+ //# sourceMappingURL=socketState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socketState.d.ts","sourceRoot":"","sources":["../../src/adapters/socketState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,6DAkBvC"}
@@ -0,0 +1,24 @@
1
+ import { createConnection } from "node:net";
2
+ import { Effect } from "effect";
3
+ export function socketState(path) {
4
+ return Effect.callback((resume) => {
5
+ const socket = createConnection(path);
6
+ socket.once("connect", () => {
7
+ socket.destroy();
8
+ resume(Effect.succeed("live"));
9
+ });
10
+ socket.once("error", (cause) => {
11
+ if (cause.code === "ENOENT") {
12
+ resume(Effect.succeed("missing"));
13
+ }
14
+ else if (cause.code === "ECONNREFUSED") {
15
+ resume(Effect.succeed("stale"));
16
+ }
17
+ else {
18
+ resume(Effect.fail(cause));
19
+ }
20
+ });
21
+ return Effect.sync(() => socket.destroy());
22
+ });
23
+ }
24
+ //# sourceMappingURL=socketState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socketState.js","sourceRoot":"","sources":["../../src/adapters/socketState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,UAAU,WAAW,CAAC,IAAY;IACvC,OAAO,MAAM,CAAC,QAAQ,CAAsC,CAAC,MAAM,EAAE,EAAE;QACtE,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;YAC3B,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAA4B,EAAE,EAAE;YACrD,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7B,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;YACnC,CAAC;iBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBAC1C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YACjC,CAAC;iBAAM,CAAC;gBACP,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAC5B,CAAC;QACF,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
2
+ import { Effect, FileSystem, Path, Scope } from "effect";
3
+ import * as NetAddress from "effect/net/NetAddress";
4
+ export declare const unixHttpServer: (path: string, options: NodeHttpServer.Options) => Effect.Effect<{
5
+ readonly serve: {
6
+ <E, R>(effect: Effect.Effect<import("effect/http/HttpServerResponse").HttpServerResponse, E, R>): Effect.Effect<void, never, Exclude<R, import("effect/http/HttpServerRequest").HttpServerRequest> | Scope.Scope>;
7
+ <E, R, App extends Effect.Effect<import("effect/http/HttpServerResponse").HttpServerResponse, any, any>>(effect: Effect.Effect<import("effect/http/HttpServerResponse").HttpServerResponse, E, R>, middleware: import("effect/http/HttpMiddleware").HttpMiddleware.Applied<App, E, R>): Effect.Effect<void, never, Exclude<Effect.Services<App>, import("effect/http/HttpServerRequest").HttpServerRequest> | Scope.Scope>;
8
+ };
9
+ readonly address: NetAddress.SocketAddress;
10
+ }, Error | import("effect/PlatformError").PlatformError, FileSystem.FileSystem | Path.Path | Scope.Scope>;
11
+ //# sourceMappingURL=unixHttpServer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unixHttpServer.d.ts","sourceRoot":"","sources":["../../src/adapters/unixHttpServer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAY,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEnE,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AAIpD,eAAO,MAAM,cAAc;;;;;;yGA6CzB,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { createServer } from "node:http";
2
+ import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
3
+ import { Duration, Effect, FileSystem, Path, Scope } from "effect";
4
+ import { HttpServer } from "effect/http";
5
+ import * as NetAddress from "effect/net/NetAddress";
6
+ import { socketState } from "#adapters/socketState.ts";
7
+ import { UnixSocketRequest } from "#UnixSocketRequest.ts";
8
+ export const unixHttpServer = Effect.fn("Server.unixHttpServer")(function* (path, options) {
9
+ const fs = yield* FileSystem.FileSystem;
10
+ const paths = yield* Path.Path;
11
+ const root = paths.dirname(path);
12
+ const scope = yield* Scope.Scope;
13
+ function occupied() {
14
+ return new Error(`A listener is already running at ${path}. Stop it before starting another.`);
15
+ }
16
+ return yield* Effect.scoped(Effect.gen(function* () {
17
+ const lock = paths.join(root, `.${paths.basename(path)}.starting`);
18
+ yield* Effect.acquireRelease(fs.makeDirectory(lock, { mode: 0o700 }).pipe(Effect.catchIf((error) => error.reason._tag === "AlreadyExists", () => Effect.fail(new Error(`${occupied().message} A startup lock exists at ${lock}; remove it only if its startup was forcibly killed.`)))), () => fs.remove(lock, { recursive: true }).pipe(Effect.orDie));
19
+ const state = yield* socketState(path);
20
+ if (state === "live") {
21
+ return yield* Effect.fail(occupied());
22
+ }
23
+ if (state === "stale") {
24
+ if ((yield* fs.stat(path)).type !== "Socket") {
25
+ return yield* Effect.fail(new Error(`The Unix socket path is not a socket: ${path}`));
26
+ }
27
+ yield* fs.remove(path, { force: true });
28
+ }
29
+ // Short private names preserve owner-only access within the public pathname budget.
30
+ const staging = yield* fs.makeTempDirectoryScoped({ directory: root, prefix: ".s" });
31
+ const pending = paths.join(staging, "s");
32
+ const node = createServer();
33
+ const server = yield* NodeHttpServer.make(() => node, {
34
+ ...options,
35
+ path: pending,
36
+ }).pipe(Scope.provide(scope));
37
+ yield* fs.chmod(pending, 0o600);
38
+ // Unpublish before Node closes its private bind path.
39
+ yield* Effect.acquireRelease(fs.rename(pending, path), () => fs.remove(path, { force: true }).pipe(Effect.orDie)).pipe(Scope.provide(scope));
40
+ return withUnixRequests({ ...server, address: NetAddress.unixPathAddress(path) }, node, options);
41
+ }));
42
+ });
43
+ function withUnixRequests(server, node, options) {
44
+ return HttpServer.make({
45
+ address: server.address,
46
+ serve: (handler, middleware) => Effect.gen(function* () {
47
+ const unix = handler.pipe(Effect.provideService(UnixSocketRequest, true));
48
+ yield* middleware === undefined ? server.serve(unix) : server.serve(unix, middleware);
49
+ yield* Effect.addFinalizer(() => Effect.sync(() => {
50
+ const deadline = setTimeout(() => node.closeAllConnections(), Duration.toMillis(Duration.fromInputUnsafe(options.gracefulShutdownTimeout ?? "20 seconds")));
51
+ node.once("close", () => clearTimeout(deadline));
52
+ }));
53
+ }),
54
+ });
55
+ }
56
+ //# sourceMappingURL=unixHttpServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unixHttpServer.js","sourceRoot":"","sources":["../../src/adapters/unixHttpServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,cAAc,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW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AAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,uBAAuB,IAAI,YAAY,CAAC,CAAC,CAC5F,CAAC;gBACF,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;YAClD,CAAC,CAAC,CACF,CAAC;QACH,CAAC,CAAC;KACH,CAAC,CAAC;AACJ,CAAC"}
@@ -22,7 +22,7 @@ export function appDatabase(options) {
22
22
  const live = LiveServer.layer.pipe(Layer.provideMerge(Reactivity.layer));
23
23
  const migrations = options.migrations;
24
24
  const worker = migrations.mode === "wait" && migrations.release !== undefined
25
- ? Layer.effect(WorkerRelease, coordinateWorkerRelease(migrations.release, migrations.pollInterval, migrations.table))
25
+ ? Layer.effect(WorkerRelease, coordinateWorkerRelease(migrations.release, migrations.pollInterval, migrations.table)).pipe(Layer.provide(clock))
26
26
  : Layer.empty;
27
27
  const base = Layer.merge(pool, live);
28
28
  const changes = options.config?.changes;
@@ -1 +1 @@
1
- {"version":3,"file":"appDatabase.js","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACpH,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAC9G,OAAO,EAAE,uBAAuB,EAAE,MA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AsB,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC,IAAI,CACN,MAAM,CAAC,KAAK,CAAC;YACZ,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,IAAI,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,IAAI,WAAW,CAAC,CAAC,CAAC;YACxI,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,YAAY,QAAQ,CAAC,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;SACvF,CAAC,EACF,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACzB,KAAK,YAAY,QAAQ,CAAC,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CACtI,CACD,CAAC;QACF,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,KAAK,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YACjC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;QACtD,CAAC;IACF,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC"}
package/dist/appHost.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- import { Layer } from "effect";
2
1
  import type { Rpc } from "effect/rpc";
3
- import type { SessionPolicy } from "@shivaedev/identity/server/SessionPolicy.ts";
4
2
  import type { AppHostFactory } from "#AppHostFactory.ts";
5
3
  import type { HostPreflight } from "#AppHostInput.ts";
6
4
  import { type DatabaseConfig } from "#appDatabase.ts";
@@ -10,17 +8,16 @@ export interface AppDatabaseOptions<R = never, E = never> {
10
8
  readonly config?: DatabaseConfig;
11
9
  readonly migrations: MigrationOptions<R, E>;
12
10
  }
13
- export type AppHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostRoutes<TRouteError, TRouteRequirements> & {
11
+ export type AppHostOptions<TRpcs extends Rpc.Any = never, THandlers = never, THandlerError = never, THandlerRequirements = never, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostRoutes<TRouteError, TRouteRequirements> & HostPolicy & {
14
12
  readonly migrations: AppDatabaseOptions<TMigrations, TMigrationError>["migrations"];
15
13
  readonly policy?: undefined;
16
- readonly sessions: Layer.Layer<SessionPolicy>;
17
14
  };
18
- export type AppLocalHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostRoutes<TRouteError, TRouteRequirements> & {
15
+ export type AppLocalHostOptions<TRpcs extends Rpc.Any = never, THandlers = never, THandlerError = never, THandlerRequirements = never, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostRoutes<TRouteError, TRouteRequirements> & {
19
16
  readonly migrations: AppDatabaseOptions<TMigrations, TMigrationError>["migrations"];
20
17
  readonly policy: "loopback";
21
18
  readonly sessions?: never;
22
19
  };
23
- export type AppHttpHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostRoutes<TRouteError, TRouteRequirements> & HostPolicy & {
20
+ export type AppHttpHostOptions<TRpcs extends Rpc.Any = never, THandlers = never, THandlerError = never, THandlerRequirements = never, TServices = never, TServiceError = never, TServiceRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostRoutes<TRouteError, TRouteRequirements> & HostPolicy & {
24
21
  readonly migrations?: undefined;
25
22
  };
26
23
  export declare const appHost: AppHostFactory;
@@ -1 +1 @@
1
- {"version":3,"file":"appHost.d.ts","sourceRoot":"","sources":["../src/appHost.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAA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C5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;CAC1B,CAAC;AAEH,MAAM,MAAM,kBAAkB,CAC7B,KAAK,SAAS,GAAG,CAAC,GAAG,GAAG,KAAK,EAC7B,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,KAAK,EACrB,oBAAoB,GAAG,KAAK,EAC5B,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,KAAK,EACrB,oBAAoB,GAAG,KAAK,EAC5B,UAAU,GAAG,KAAK,EAClB,eAAe,GAAG,KAAK,EACvB,sBAAsB,GAAG,KAAK,EAC9B,WAAW,GAAG,KAAK,EACnB,kBAAkB,GAAG,qBAAqB,IACvC,aAAa,CAAC,UAAU,EAAE,eAAe,EAAE,sBAAsB,CAAC,GACrE,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,CAAC,GACtH,UAAU,CAAC,WAAW,EAAE,kBAAkB,CAAC,GAC3C,UAAU,GAAG;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAClD,eAAO,MAAM,OAAO,EAAE,cAuDrB,CAAC"}
package/dist/appHost.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
2
2
  import { Effect, Layer } from "effect";
3
- import { schemaSensitiveKeys } from "@shivaedev/errors/schemaSensitiveKeys.ts";
4
3
  import { isSensitiveKey } from "@shivaedev/errors/sensitive.ts";
5
4
  import { appDatabase } from "#appDatabase.ts";
6
5
  import { appHostHttp, deferredHost, migratedHost } from "#appHostHttp.ts";
6
+ import { hostSensitiveKeys } from "#hostSensitiveKeys.ts";
7
7
  import { redactingDiagnostics } from "#redactingDiagnostics.ts";
8
8
  export const appHost = (options) => {
9
9
  const startup = options.preflight;
10
10
  const preflight = startup === undefined
11
11
  ? Layer.empty
12
- : Layer.unwrap(Effect.map("application" in options ? Effect.succeed(isSensitiveKey) : schemaSensitiveKeys(options.group, options.config?.sensitiveKeys), (sensitive) => startup.pipe(Layer.provide(redactingDiagnostics(sensitive)))));
12
+ : Layer.unwrap(Effect.map("application" in options ? Effect.succeed(isSensitiveKey) : hostSensitiveKeys(options), (sensitive) => startup.pipe(Layer.provide(redactingDiagnostics(sensitive)))));
13
13
  if ("application" in options) {
14
14
  return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(preflight), Layer.provide(NodeCrypto.layer));
15
15
  }