@shivaedev/server 0.20.2 → 0.22.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 +25 -0
- package/README.md +15 -5
- package/dist/UnixSocketRequest.d.ts +3 -0
- package/dist/UnixSocketRequest.d.ts.map +1 -0
- package/dist/UnixSocketRequest.js +3 -0
- package/dist/UnixSocketRequest.js.map +1 -0
- package/dist/adapters/hostHttpServices.d.ts +3 -0
- package/dist/adapters/hostHttpServices.d.ts.map +1 -0
- package/dist/adapters/hostHttpServices.js +6 -0
- package/dist/adapters/hostHttpServices.js.map +1 -0
- package/dist/adapters/nodeHttpServer.d.ts +3 -1
- package/dist/adapters/nodeHttpServer.d.ts.map +1 -1
- package/dist/adapters/nodeHttpServer.js +36 -7
- package/dist/adapters/nodeHttpServer.js.map +1 -1
- package/dist/adapters/socketState.d.ts +3 -0
- package/dist/adapters/socketState.d.ts.map +1 -0
- package/dist/adapters/socketState.js +24 -0
- package/dist/adapters/socketState.js.map +1 -0
- package/dist/adapters/unixHttpServer.d.ts +11 -0
- package/dist/adapters/unixHttpServer.d.ts.map +1 -0
- package/dist/adapters/unixHttpServer.js +56 -0
- package/dist/adapters/unixHttpServer.js.map +1 -0
- package/dist/appDatabase.js +1 -1
- package/dist/appDatabase.js.map +1 -1
- package/dist/appHostHttp.d.ts +225 -45
- package/dist/appHostHttp.d.ts.map +1 -1
- package/dist/appHostHttp.js +2 -2
- package/dist/appHostHttp.js.map +1 -1
- package/dist/hostOptions.d.ts +1 -0
- package/dist/hostOptions.d.ts.map +1 -1
- package/dist/hostRpc.d.ts +21 -1
- package/dist/hostRpc.d.ts.map +1 -1
- package/dist/hostRpc.js +2 -1
- package/dist/hostRpc.js.map +1 -1
- package/dist/hostRpcRoutes.d.ts +25 -5
- package/dist/hostRpcRoutes.d.ts.map +1 -1
- package/dist/hostRpcRoutes.js +5 -3
- package/dist/hostRpcRoutes.js.map +1 -1
- package/dist/hostTransport.d.ts +2 -0
- package/dist/hostTransport.d.ts.map +1 -1
- package/dist/hostTransport.js +2 -1
- package/dist/hostTransport.js.map +1 -1
- package/dist/socketRpc.d.ts.map +1 -1
- package/dist/socketRpc.js +2 -1
- package/dist/socketRpc.js.map +1 -1
- package/dist/testing/adapters/hostProcess.d.ts +1 -0
- package/dist/testing/adapters/hostProcess.d.ts.map +1 -1
- package/dist/testing/adapters/hostProcess.js +27 -0
- package/dist/testing/adapters/hostProcess.js.map +1 -1
- package/dist/testing/hostProcess.d.ts +4 -2
- package/dist/testing/hostProcess.d.ts.map +1 -1
- package/dist/testing/hostProcess.js +9 -2
- package/dist/testing/hostProcess.js.map +1 -1
- package/dist/testing/hostProcessChild.d.ts +1 -0
- package/dist/testing/hostProcessChild.d.ts.map +1 -1
- package/dist/testing/hostProcessChild.js +5 -1
- package/dist/testing/hostProcessChild.js.map +1 -1
- package/dist/testing/hostProcessProtocol.d.ts +3 -0
- package/dist/testing/hostProcessProtocol.d.ts.map +1 -1
- package/dist/testing/hostProcessProtocol.js +1 -0
- package/dist/testing/hostProcessProtocol.js.map +1 -1
- package/dist/testing/hostTime.d.ts +9 -0
- package/dist/testing/hostTime.d.ts.map +1 -0
- package/dist/testing/hostTime.js +27 -0
- package/dist/testing/hostTime.js.map +1 -0
- package/package.json +15 -15
- package/src/UnixSocketRequest.ts +3 -0
- package/src/adapters/hostHttpServices.ts +10 -0
- package/src/adapters/nodeHttpServer.ts +40 -7
- package/src/adapters/socketState.ts +22 -0
- package/src/adapters/unixHttpServer.ts +74 -0
- package/src/appDatabase.ts +1 -1
- package/src/appHostHttp.ts +2 -2
- package/src/hostOptions.ts +1 -0
- package/src/hostRpc.ts +6 -1
- package/src/hostRpcRoutes.ts +7 -3
- package/src/hostTransport.ts +9 -2
- package/src/socketRpc.ts +2 -1
- package/src/testing/adapters/hostProcess.ts +27 -0
- package/src/testing/hostProcess.ts +12 -3
- package/src/testing/hostProcessChild.ts +6 -1
- package/src/testing/hostProcessProtocol.ts +1 -0
- package/src/testing/hostTime.ts +33 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.22.0 - 2026-11-04
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
- Host process test fixtures can load a replacement before stopping the current host, using `beforeStart` with the child's `awaitHostStart` handshake.
|
|
9
|
+
|
|
10
|
+
### Breaking
|
|
11
|
+
|
|
12
|
+
- `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.
|
|
13
|
+
|
|
14
|
+
## 0.21.0 - 2026-11-03
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- The `hostTime` testing layer advances worker lease time and waits for heartbeat and release checks.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- Worker-release heartbeat and polling timers use the live lifecycle clock by default, so passing an application day does not replay every heartbeat.
|
|
23
|
+
|
|
24
|
+
### Breaking
|
|
25
|
+
|
|
26
|
+
- 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.
|
|
27
|
+
|
|
3
28
|
## 0.20.2 - 2026-11-03
|
|
4
29
|
|
|
5
30
|
### Changed
|
package/README.md
CHANGED
|
@@ -83,6 +83,8 @@ NodeRuntime.runMain(Layer.launch(Server));
|
|
|
83
83
|
|
|
84
84
|
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
85
|
|
|
86
|
+
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.
|
|
87
|
+
|
|
86
88
|
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
89
|
|
|
88
90
|
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 +128,15 @@ Static layers mounted manually through `routes` keep Effect's native behavior. T
|
|
|
126
128
|
|
|
127
129
|
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
130
|
|
|
131
|
+
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.
|
|
132
|
+
|
|
133
|
+
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`.
|
|
134
|
+
|
|
129
135
|
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
136
|
|
|
131
137
|
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
138
|
|
|
133
|
-
|
|
139
|
+
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
140
|
|
|
135
141
|
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
142
|
|
|
@@ -138,7 +144,7 @@ Invalid, expired, malformed, oversized or missing first-frame credentials close
|
|
|
138
144
|
|
|
139
145
|
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
146
|
|
|
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.
|
|
147
|
+
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
148
|
|
|
143
149
|
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
150
|
|
|
@@ -227,7 +233,9 @@ Set `config.maxConnections` on `appDatabase` or a migrated `appHost` to bound th
|
|
|
227
233
|
|
|
228
234
|
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
235
|
|
|
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.
|
|
236
|
+
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.
|
|
237
|
+
|
|
238
|
+
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
239
|
|
|
232
240
|
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
241
|
|
|
@@ -316,7 +324,7 @@ Diagnostic failure, defect and interruption reasons are rebuilt with sanitized a
|
|
|
316
324
|
|
|
317
325
|
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
326
|
|
|
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.
|
|
327
|
+
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
328
|
|
|
321
329
|
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
330
|
|
|
@@ -384,6 +392,8 @@ The signal aborts on an additional signal, socket close, incomplete request clos
|
|
|
384
392
|
|
|
385
393
|
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
394
|
|
|
395
|
+
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.
|
|
396
|
+
|
|
387
397
|
Wrap the kit in the application's story vocabulary:
|
|
388
398
|
|
|
389
399
|
```ts
|
|
@@ -393,7 +403,7 @@ import { hostProcess } from "@shivaedev/server/testing/hostProcess.ts";
|
|
|
393
403
|
|
|
394
404
|
const host = storyKit({
|
|
395
405
|
name: "application host",
|
|
396
|
-
clock: "
|
|
406
|
+
clock: "test",
|
|
397
407
|
stages: [],
|
|
398
408
|
create: () => hostProcess({ module: new URL("./host.ts", import.meta.url) }),
|
|
399
409
|
verbs: (process) => ({
|
|
@@ -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 @@
|
|
|
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 |
|
|
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,
|
|
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.
|
|
6
|
-
const
|
|
7
|
-
|
|
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;
|
|
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,KAAK,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,UAAU,EA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,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 @@
|
|
|
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,OA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CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YACtF,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAC/B,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;gBAChB,MAAM,QAAQ,GAAG,UAAU,CAC1B,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAChC,QAAQ,CAAC,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"}
|
package/dist/appDatabase.js
CHANGED
|
@@ -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;
|
package/dist/appDatabase.js.map
CHANGED
|
@@ -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,E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