@shivaedev/server 0.19.0 → 0.20.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 (123) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +26 -16
  3. package/dist/{runtime/makePlatform.d.ts → adapters/makePlatformRuntime.d.ts} +2 -2
  4. package/dist/adapters/makePlatformRuntime.d.ts.map +1 -0
  5. package/dist/{runtime/makePlatform.js → adapters/makePlatformRuntime.js} +1 -1
  6. package/dist/adapters/makePlatformRuntime.js.map +1 -0
  7. package/dist/{nodeHttpServer.d.ts → adapters/nodeHttpServer.d.ts} +1 -0
  8. package/dist/adapters/nodeHttpServer.d.ts.map +1 -0
  9. package/dist/{nodeHttpServer.js → adapters/nodeHttpServer.js} +5 -0
  10. package/dist/adapters/nodeHttpServer.js.map +1 -0
  11. package/dist/adapters/subscriptionSignal.d.ts.map +1 -0
  12. package/dist/adapters/subscriptionSignal.js.map +1 -0
  13. package/dist/appDatabase.d.ts +2 -2
  14. package/dist/appDatabase.d.ts.map +1 -1
  15. package/dist/appDatabase.js +8 -3
  16. package/dist/appDatabase.js.map +1 -1
  17. package/dist/appHost.d.ts.map +1 -1
  18. package/dist/appHost.js +11 -4
  19. package/dist/appHost.js.map +1 -1
  20. package/dist/appHostHttp.d.ts +48 -30
  21. package/dist/appHostHttp.d.ts.map +1 -1
  22. package/dist/appHostHttp.js +2 -2
  23. package/dist/appHostHttp.js.map +1 -1
  24. package/dist/boundedRpcRequest.d.ts +3 -2
  25. package/dist/boundedRpcRequest.d.ts.map +1 -1
  26. package/dist/boundedRpcRequest.js +6 -5
  27. package/dist/boundedRpcRequest.js.map +1 -1
  28. package/dist/boundedRpcSocket.d.ts +4 -0
  29. package/dist/boundedRpcSocket.d.ts.map +1 -0
  30. package/dist/boundedRpcSocket.js +29 -0
  31. package/dist/boundedRpcSocket.js.map +1 -0
  32. package/dist/hostChanges.d.ts +4 -2
  33. package/dist/hostChanges.d.ts.map +1 -1
  34. package/dist/hostChanges.js +31 -33
  35. package/dist/hostChanges.js.map +1 -1
  36. package/dist/hostRpc.d.ts +4 -9
  37. package/dist/hostRpc.d.ts.map +1 -1
  38. package/dist/hostRpc.js +9 -17
  39. package/dist/hostRpc.js.map +1 -1
  40. package/dist/hostRpcRoutes.d.ts +5 -3
  41. package/dist/hostRpcRoutes.d.ts.map +1 -1
  42. package/dist/hostRpcRoutes.js +4 -3
  43. package/dist/hostRpcRoutes.js.map +1 -1
  44. package/dist/otlpHttpClient.js +2 -2
  45. package/dist/otlpHttpClient.js.map +1 -1
  46. package/dist/otlpTracing.d.ts.map +1 -1
  47. package/dist/otlpTracing.js +4 -4
  48. package/dist/otlpTracing.js.map +1 -1
  49. package/dist/publishCommand.d.ts +3 -0
  50. package/dist/publishCommand.d.ts.map +1 -0
  51. package/dist/publishCommand.js +36 -0
  52. package/dist/publishCommand.js.map +1 -0
  53. package/dist/redactingRpcSerialization.d.ts +3 -2
  54. package/dist/redactingRpcSerialization.d.ts.map +1 -1
  55. package/dist/redactingRpcSerialization.js +8 -8
  56. package/dist/redactingRpcSerialization.js.map +1 -1
  57. package/dist/rerunQuery.d.ts +7 -3
  58. package/dist/rerunQuery.d.ts.map +1 -1
  59. package/dist/rerunQuery.js +3 -4
  60. package/dist/rerunQuery.js.map +1 -1
  61. package/dist/setupDatabases.d.ts +1 -1
  62. package/dist/setupDatabases.d.ts.map +1 -1
  63. package/dist/setupDatabases.js +3 -3
  64. package/dist/setupDatabases.js.map +1 -1
  65. package/dist/testing/HostProcessError.d.ts +1 -1
  66. package/dist/testing/HostProcessError.d.ts.map +1 -1
  67. package/dist/testing/adapters/hostProcess.d.ts +4 -2
  68. package/dist/testing/adapters/hostProcess.d.ts.map +1 -1
  69. package/dist/testing/adapters/hostProcess.js +5 -2
  70. package/dist/testing/adapters/hostProcess.js.map +1 -1
  71. package/dist/testing/adapters/hostProcessReadouts.d.ts +10 -0
  72. package/dist/testing/adapters/hostProcessReadouts.d.ts.map +1 -0
  73. package/dist/testing/adapters/hostProcessReadouts.js +26 -0
  74. package/dist/testing/adapters/hostProcessReadouts.js.map +1 -0
  75. package/dist/testing/hostProcess.d.ts +4 -0
  76. package/dist/testing/hostProcess.d.ts.map +1 -1
  77. package/dist/testing/hostProcess.js +20 -2
  78. package/dist/testing/hostProcess.js.map +1 -1
  79. package/dist/testing/hostProcessChild.d.ts +1 -1
  80. package/dist/testing/hostProcessChild.d.ts.map +1 -1
  81. package/dist/testing/hostProcessChild.js +3 -4
  82. package/dist/testing/hostProcessChild.js.map +1 -1
  83. package/dist/testing/hostProcessProtocol.d.ts +6 -0
  84. package/dist/testing/hostProcessProtocol.d.ts.map +1 -1
  85. package/dist/testing/hostProcessProtocol.js +6 -0
  86. package/dist/testing/hostProcessProtocol.js.map +1 -1
  87. package/dist/testing/hostProcessReadouts.d.ts +7 -0
  88. package/dist/testing/hostProcessReadouts.d.ts.map +1 -0
  89. package/dist/testing/hostProcessReadouts.js +37 -0
  90. package/dist/testing/hostProcessReadouts.js.map +1 -0
  91. package/package.json +22 -19
  92. package/src/{runtime/makePlatform.ts → adapters/makePlatformRuntime.ts} +1 -1
  93. package/src/{nodeHttpServer.ts → adapters/nodeHttpServer.ts} +7 -0
  94. package/src/appDatabase.ts +9 -3
  95. package/src/appHost.ts +17 -7
  96. package/src/appHostHttp.ts +2 -2
  97. package/src/boundedRpcRequest.ts +6 -5
  98. package/src/boundedRpcSocket.ts +32 -0
  99. package/src/hostChanges.ts +60 -41
  100. package/src/hostRpc.ts +9 -23
  101. package/src/hostRpcRoutes.ts +21 -11
  102. package/src/otlpHttpClient.ts +2 -2
  103. package/src/otlpTracing.ts +8 -6
  104. package/src/publishCommand.ts +47 -0
  105. package/src/redactingRpcSerialization.ts +11 -12
  106. package/src/rerunQuery.ts +18 -6
  107. package/src/setupDatabases.ts +3 -3
  108. package/src/testing/HostProcessError.ts +1 -1
  109. package/src/testing/adapters/hostProcess.ts +8 -3
  110. package/src/testing/adapters/hostProcessReadouts.ts +29 -0
  111. package/src/testing/hostProcess.ts +26 -2
  112. package/src/testing/hostProcessChild.ts +3 -4
  113. package/src/testing/hostProcessProtocol.ts +6 -0
  114. package/src/testing/hostProcessReadouts.ts +46 -0
  115. package/dist/node-http/subscriptionSignal.d.ts.map +0 -1
  116. package/dist/node-http/subscriptionSignal.js.map +0 -1
  117. package/dist/nodeHttpServer.d.ts.map +0 -1
  118. package/dist/nodeHttpServer.js.map +0 -1
  119. package/dist/runtime/makePlatform.d.ts.map +0 -1
  120. package/dist/runtime/makePlatform.js.map +0 -1
  121. /package/dist/{node-http → adapters}/subscriptionSignal.d.ts +0 -0
  122. /package/dist/{node-http → adapters}/subscriptionSignal.js +0 -0
  123. /package/src/{node-http → adapters}/subscriptionSignal.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.20.0 - 2026-11-03
4
+
5
+ ### Added
6
+
7
+ - Compose command publication through the changes publication port, preserving post-commit retries, deduplication and recovery across required, optional and custom authentication.
8
+ - Read a child host's active work, completed finalizers and shutdown duration through the process kit, including after a reported shutdown. Instrument child Effects with `hostProcessReadouts`.
9
+ - Launch a host with a proxied `databaseUrl` and cut its idle PostgreSQL connections with `disconnectIdlePostgres` to exercise recovery.
10
+ - Modules carry their queue declarations and worker Layers. `workerHost` runs workers with the same composed services and ports used by `appHost` after database preparation.
11
+ - Provide `sendHostReady` in the server's host-process testing adapter to report the current process ID and listening URL over IPC.
12
+
13
+ ### Changed
14
+
15
+ - Database setup shares local-postgres's Docker settings reader.
16
+
17
+ ### Fixed
18
+
19
+ - Apply the host's `maxBodySize` and `MAX_BODY_SIZE` limit to WebSocket RPC messages, including binary and fragmented messages. Oversized messages close the connection with WebSocket code 1009, surfaced as Effect's typed `SocketError` with a `SocketCloseError` reason.
20
+ - Hash the server's default PostgreSQL changes channel through Effect Crypto while retaining its channel name and explicit channel override.
21
+ - Hosted live queries receive writes to newly discovered relations and stop refreshing for relations they no longer read, for both invalidation hints and pushed results.
22
+ - Redact preflight log messages, failure causes and annotations before host startup. Preserve typed preflight failures and ordinary startup logs. Direct hosts also apply schema-sensitive fields and configured sensitive keys; deferred hosts use the default redaction policy before their application is constructed.
23
+ - Hosts using the pg-boss schema component wait for missing deferral artifacts to be installed before starting the application, and check mode names those artifacts.
24
+ - Masked failures retain scalar, array and object wire shapes so native RPC clients decode the declared failure without a schema error.
25
+ - The application host uses the contract's attached guard and retains its HTTP refusal of WebSocket-only subscriptions.
26
+ - Query reruns retain their native RPC handler service requirements and declared failures through read authorization and live subscriptions.
27
+ - Authenticated hosts subscribe to plain repository keys and publish unscoped command dependencies.
28
+ - The application host installs the contract guard, avoiding duplicate policy evaluations after session resolution for required and optional authentication.
29
+ - Build hosted changes handlers through the contract Layer and validate pushed results as decoded values, including transformed schemas such as bigint.
30
+
31
+ ### Breaking
32
+
33
+ - App-host rerun-and-compare subscriptions emit `Unchanged` updates for equal results. Upgrade raw `$changes` consumers to handle this update and deploy compatible clients and servers together.
34
+ - Direct users of `appDatabase` must provide `Crypto.Crypto` for the default changes channel, for example with `Layer.provide(NodeCrypto.layer)` from `@effect/platform-node/NodeCrypto`. `appHost` and `workerHost` already supply it.
35
+ - `redactingRpcSerialization` now takes the validated policy returned by `yield* schemaSensitiveKeys(group, extraKeys)` as its second argument. Replace the separate key predicate and masking callbacks with that policy.
36
+ - Modules now require a `name`, and `appModules` returns an Effect. Add a name to each module and use `yield* appModules(...)` inside an Effect before passing its result to either host. Duplicate queue names fail composition with `DuplicateModuleQueue`, identifying the queue and both owners.
37
+ - in `boundedRpcRequest.ts`, replace `boundedRpcRequest(request)` with `yield* boundedRpcRequest()` inside an Effect. Provide the native request through `HttpServerRequest.HttpServerRequest`; the returned request keeps its cached text and array-buffer reads.
38
+ - Move Node bridges under adapters. Replace imports from `@shivaedev/server/runtime/makePlatform.ts`, `@shivaedev/server/node-http/subscriptionSignal.ts` and `@shivaedev/server/nodeHttpServer.ts` with `@shivaedev/server/adapters/makePlatformRuntime.ts`, `@shivaedev/server/adapters/subscriptionSignal.ts` and `@shivaedev/server/adapters/nodeHttpServer.ts` respectively. Runtime types remain in `@shivaedev/server/runtime/types.ts`.
39
+ - `rerunQuery` exposes the queried group's handler services and read-policy services in its Effect requirements. Provide the application handler layer and the read-policy services before running a rerun.
40
+ - Replace the `HostedReadPolicy` type from `@shivaedev/server/hostRpc.ts` with `ReadPolicyGuard` from `@shivaedev/contract/ReadPolicyGuard.ts`. Custom hosts install `readPolicyGuardLayer()` and serve the group returned by `yield* guardReads(group)`, which places the guard inside identity middleware. Pass `{ websocket: true }` to the Layer constructor for WebSocket hosts; its default refuses `$changes` over HTTP.
41
+
3
42
  ## 0.19.0 - 2026-11-02
4
43
 
5
44
  ### Added
package/README.md CHANGED
@@ -25,6 +25,8 @@ The process migrates the database, serves `Api` at `/rpc` and the built client f
25
25
 
26
26
  The host composes pieces that live in their own packages. Request identity, sessions, Origin policy, permissions and Better Auth come from [`@shivaedev/identity`](https://github.com/ShivaeDev/platform/tree/main/packages/identity#readme); shared failures and redaction from [`@shivaedev/errors`](https://github.com/ShivaeDev/platform/tree/main/packages/errors#readme); outside HTTP calls from [`@shivaedev/http`](https://github.com/ShivaeDev/platform/tree/main/packages/http#readme). This package hosts them: `appHost` serves the RPC group with the application's session policy, database and migrations.
27
27
 
28
+ The RPC host composes contract's `CommandGuard` with `publishCommand` and the `CommandPublication` port from `@shivaedev/changes/commandPublication.ts`. Session middleware supplies the viewer. Successful commands publish declared changes after their handlers finish committing, deduplicating changes already announced by the handler. Publication retries do not repeat the write; exhausted retries request a live resync while preserving the committed result. Failed commands publish no declared changes.
29
+
28
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.
29
31
 
30
32
  ### Prepare local development
@@ -124,7 +126,7 @@ Static layers mounted manually through `routes` keep Effect's native behavior. T
124
126
 
125
127
  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.
126
128
 
127
- 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. This limit applies to the host's RPC route.
129
+ 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.
128
130
 
129
131
  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.
130
132
 
@@ -150,6 +152,8 @@ The host provides Effect's native `Crypto` service (`effect/Crypto`) to prefligh
150
152
 
151
153
  Supply `preflight: AppConfigLive` to `appHost` to build a native Layer before checking or applying migrations, or constructing the application. Use it to validate configuration such as app IDs, keys and invite lists. Its errors stay in the returned Layer's typed error channel, its requirements other than `Crypto` remain external requirements, and its services are available to migrations, application construction, services and RPC handlers as well as callers of the host Layer. Preflight resources close with the host scope. The option also works without migrations.
152
154
 
155
+ Preflight logs pass through the host's redaction, including logged failure causes and annotations. The original typed failure remains available to callers. Direct hosts derive the policy from their RPC schemas and `config.sensitiveKeys`; deferred hosts use the default credential policy during preflight, before their application's schemas are available. Ordinary startup messages and annotations remain intact.
156
+
153
157
  When construction itself touches the schema, use `appHost({ migrations, config, application })`. `application` is a native Effect that returns the HTTP host options (`group`, handler and service Layers, session policy, and optional HTTP config). The host first builds `appDatabase`, then evaluates this Effect in the host scope with SQL, Reactivity and `LiveServer` from `@shivaedev/contract/LiveServer.ts` available. A failed migration or schema-current check prevents construction. Initialization requirements and errors stay in the returned Layer's types, and acquired resources close with the host scope.
154
158
 
155
159
  ```ts
@@ -312,7 +316,7 @@ Diagnostic failure, defect and interruption reasons are rebuilt with sanitized a
312
316
 
313
317
  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.
314
318
 
315
- For native RPC serialization, `yield* schemaSensitiveKeys(group, extraKeys)` from `@shivaedev/errors/schemaSensitiveKeys.ts` obtains a key predicate with `forRpc(tag)` and `maskFailure(tag: string | undefined, reason: "Fail" | "Die")`. The Effect can fail with `SensitiveFieldConflict` from `@shivaedev/errors/schemaFieldScope.ts`; `appHost` reports this typed failure during Layer startup. Pass the predicate and its methods to `redactingRpcSerialization(wire, sensitive, sensitive.maskFailure, sensitive.forRpc)`. The serializer correlates request tags and response IDs, including batches, before masking a whole error or defect root. Unassociated defects use the conservative policy across the host's defect schemas.
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.
316
320
 
317
321
  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).
318
322
 
@@ -328,7 +332,7 @@ Build the application Layer once. `runWithServices` supplies an invocation's ove
328
332
 
329
333
  ```ts
330
334
  import { Context, Layer } from "effect";
331
- import { makePlatformRuntime } from "@shivaedev/server/runtime/makePlatform.ts";
335
+ import { makePlatformRuntime } from "@shivaedev/server/adapters/makePlatformRuntime.ts";
332
336
 
333
337
  class Greeting extends Context.Service<Greeting, string>()("app/Greeting") {}
334
338
 
@@ -351,7 +355,7 @@ A long-lived response can receive cancellation from a Web request, a procedure a
351
355
 
352
356
  ```ts
353
357
  import type { IncomingMessage } from "node:http";
354
- import { nodeSubscriptionSignal } from "@shivaedev/server/node-http/subscriptionSignal.ts";
358
+ import { nodeSubscriptionSignal } from "@shivaedev/server/adapters/subscriptionSignal.ts";
355
359
 
356
360
  export async function consumeSubscription(
357
361
  request: Request,
@@ -406,6 +410,12 @@ host.it("the running application answers health checks", [], function* ({ health
406
410
 
407
411
  `health()` requests `/health` and returns `{ status, body, headers }`. `headers(path)` returns the named path's response headers as a lowercase-keyed record. Both use real HTTP and leave redirects visible. The host's normal health semantics apply: reachable PostgreSQL produces 200; a host without a database produces 503. `url` and `pid` identify the ready child. Launch, signal and HTTP failures use the typed `HostProcessError` from `@shivaedev/server/testing/HostProcessError.ts`, with `operation` and the original `cause`. A child exit before readiness or signal acknowledgement fails the waiting action. A live child that never reports the expected message stays pending until its owning story is interrupted or times out.
408
412
 
413
+ For lifecycle observations, acquire `hostProcessReadouts` from `@shivaedev/server/testing/hostProcessReadouts.ts` in the child before reporting readiness. Keep its scope open until shutdown reporting finishes. Wrap a running Effect with `readouts.work(name, effect)` and a finalizer's Effect with `readouts.finalizer(name, effect)`. These wrappers observe the Effects the application runs; they do not discover uninstrumented work or finalizers. The parent's `activeWork()` returns names in start order, removing each item when it ends, including interrupted work and overlapping items with the same name. `finalizers()` returns names in completion order.
414
+
415
+ Wrap disposal of the host scope or runtime with `readouts.shutdown(dispose)`, then acknowledge the application's shutdown signal. `shutdownDuration()` returns `null` before shutdown completes and elapsed milliseconds afterwards, including finalizer time. The parent retains the completed shutdown's readouts after the child process and its owning scope close; `activeWork()` then returns the work that was active when shutdown began. Forced termination without a completed shutdown report cannot provide these observations.
416
+
417
+ To exercise PostgreSQL recovery, install the optional `@shivaedev/test-sql` peer and pass a redacted `databaseUrl` to `hostProcess`. The kit opens a `disconnectProxy` in its owning scope and gives the child its URL through `DATABASE_URL`; the child must use that setting. This mode uses the explicit `env` record plus the proxy's `DATABASE_URL` as the child's environment. Call `disconnectIdlePostgres()` once the host's database connections are idle. It cuts the proxy's existing connections while allowing new ones, so a following HTTP health request can exercise the host's PostgreSQL pool recovery.
418
+
409
419
  ### Low-memory PostgreSQL hosts
410
420
 
411
421
  Use sql's [opt-in preset](https://github.com/ShivaeDev/platform/tree/main/packages/sql#low-memory-postgresql-hosts) with the host's ten-minute connection lifetime and one-minute idle timeout. The preset bounds PostgreSQL shared memory and per-operation work; connection recycling releases backend memory, and a page-cache trim releases clean file pages charged to the container. A busy workload still needs memory for its working set.
@@ -437,18 +447,18 @@ Enable the preset and trim per app in a throwaway environment first. Record `mem
437
447
 
438
448
  Import the module that defines the name; there is no package-root entry. Paths below follow `@shivaedev/server/`.
439
449
 
440
- | Module | Names and purpose |
441
- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
442
- | `appHost.ts` | `appHost`: scoped HTTP and PostgreSQL composition with loopback defaults and optional proxy trust. |
443
- | `appDatabase.ts` | `appDatabase`, `DatabaseConfig`: PostgreSQL composition with migrations, Reactivity and contract's `LiveServer`. |
444
- | `setupDatabases.ts` | `setupDatabases()`: prepare the local development and test databases. |
445
- | `development.ts` | `development({ server, worker, conditions? })`, `runDevelopment(options)`: run the server, worker and Vite in watch mode. |
446
- | `rpc-server/publicConfigLayer.ts` | `publicConfigLayer(declaration, path?)`: serve a `publicConfig` declaration from native Config. |
447
- | `otlpTracing.ts` | `otlpTracing`: redacting Railway OTLP export for worker spans, logs and error reports. |
448
- | `RedactionPolicy.ts` | `RedactionPolicy`: provide the app's diagnostic key predicate derived by errors. |
449
- | `redactingDiagnostics.ts`, `redactingTracer.ts`, `redactingRpcSerialization.ts` | `redactingDiagnostics(sensitive)`, `redactingTracer(sensitive)`, `redactingRpcSerialization(wire, sensitive, maskFailure?)`: compose native diagnostic and NDJSON boundaries. |
450
- | `runtime/makePlatform.ts` | `makePlatformRuntime(layer, { developmentCacheKey? })`. |
451
- | `node-http/subscriptionSignal.ts` | `nodeSubscriptionSignal({ nodeRequest?, request?, signals? })`, returning `{ signal, dispose }`. |
450
+ | Module | Names and purpose |
451
+ | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
452
+ | `appHost.ts` | `appHost`: scoped HTTP and PostgreSQL composition with loopback defaults and optional proxy trust. |
453
+ | `appDatabase.ts` | `appDatabase`, `DatabaseConfig`: PostgreSQL composition with migrations, Reactivity and contract's `LiveServer`. |
454
+ | `setupDatabases.ts` | `setupDatabases()`: prepare the local development and test databases. |
455
+ | `development.ts` | `development({ server, worker, conditions? })`, `runDevelopment(options)`: run the server, worker and Vite in watch mode. |
456
+ | `rpc-server/publicConfigLayer.ts` | `publicConfigLayer(declaration, path?)`: serve a `publicConfig` declaration from native Config. |
457
+ | `otlpTracing.ts` | `otlpTracing`: redacting Railway OTLP export for worker spans, logs and error reports. |
458
+ | `RedactionPolicy.ts` | `RedactionPolicy`: provide the app's diagnostic key predicate derived by errors. |
459
+ | `redactingDiagnostics.ts`, `redactingTracer.ts`, `redactingRpcSerialization.ts` | `redactingDiagnostics(sensitive)`, `redactingTracer(sensitive)`, `redactingRpcSerialization(wire, sensitive)`: compose native diagnostic and NDJSON boundaries. |
460
+ | `adapters/makePlatformRuntime.ts` | `makePlatformRuntime(layer, { developmentCacheKey? })`. |
461
+ | `adapters/subscriptionSignal.ts` | `nodeSubscriptionSignal({ nodeRequest?, request?, signals? })`, returning `{ signal, dispose }`. |
452
462
 
453
463
  ### Install, setup and limits
454
464
 
@@ -1,4 +1,4 @@
1
1
  import type { Layer } from "effect";
2
- import type { PlatformRuntime, PlatformRuntimeOptions } from "./types.ts";
2
+ import type { PlatformRuntime, PlatformRuntimeOptions } from "#runtime/types.ts";
3
3
  export declare function makePlatformRuntime<TServices, TBuildError>(layer: Layer.Layer<TServices, TBuildError>, options?: PlatformRuntimeOptions): PlatformRuntime<TServices, TBuildError>;
4
- //# sourceMappingURL=makePlatform.d.ts.map
4
+ //# sourceMappingURL=makePlatformRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makePlatformRuntime.d.ts","sourceRoot":"","sources":["../../src/adapters/makePlatformRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AA+CjF,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,WAAW,EACzD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,EAC1C,OAAO,GAAE,sBAA2B,GAClC,eAAe,CAAC,SAAS,EAAE,WAAW,CAAC,CAqBzC"}
@@ -62,4 +62,4 @@ export function makePlatformRuntime(layer, options = {}) {
62
62
  runtimeCache.set(key, cachedRuntime);
63
63
  return cachedRuntime;
64
64
  }
65
- //# sourceMappingURL=makePlatform.js.map
65
+ //# sourceMappingURL=makePlatformRuntime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makePlatformRuntime.js","sourceRoot":"","sources":["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2B,EAAE;IAEpC,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC;IACjF,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IACD,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,WAAW,CAAyB,MAAM,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,MAAM,aAAa,GAA4C;QAC9D,GAAG,OAAO;QACV,OAAO,EAAE,KAAK,IAAI,EAAE;YACnB,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,aAAa,EAAE,CAAC;gBAC7C,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;YACD,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;KACD,CAAC;IACF,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;IACrC,OAAO,aAAa,CAAC;AACtB,CAAC"}
@@ -3,5 +3,6 @@ export declare function nodeHttpServer(host: string, config?: {
3
3
  readonly port?: number;
4
4
  readonly gracefulShutdownTimeout?: Duration.Input;
5
5
  readonly disablePreemptiveShutdown?: boolean;
6
+ readonly maxBodySize?: number;
6
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>;
7
8
  //# sourceMappingURL=nodeHttpServer.d.ts.map
@@ -0,0 +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"}
@@ -8,8 +8,13 @@ export function nodeHttpServer(host, config) {
8
8
  gracefulShutdownTimeout: config?.gracefulShutdownTimeout,
9
9
  host,
10
10
  port,
11
+ websocket: config?.maxBodySize === undefined ? undefined : { maxPayload: socketPayloadLimit(config.maxBodySize) },
11
12
  ...(config?.disablePreemptiveShutdown === undefined ? {} : { disablePreemptiveShutdown: config.disablePreemptiveShutdown }),
12
13
  });
13
14
  }));
14
15
  }
16
+ function socketPayloadLimit(bytes) {
17
+ // ws truncates maxPayload to a signed 32-bit integer; the RPC reader covers zero and larger limits.
18
+ return bytes > 0x7f_ff_ff_ff ? 0 : Math.max(1, bytes);
19
+ }
15
20
  //# sourceMappingURL=nodeHttpServer.js.map
@@ -0,0 +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,CA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AAI,CAAC;YAChB,WAAW,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;YACpD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAC/C,CAAC;QACD,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC;KAChC,CAAC;AACH,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import * as PgClient from "@effect/sql-pg/PgClient";
2
- import { Clock, Config, Layer, Redacted } from "effect";
2
+ import { Clock, Config, Crypto, Layer, Redacted } from "effect";
3
3
  import * as Reactivity from "effect/reactivity/Reactivity";
4
4
  import { Migrator } from "effect/sql";
5
5
  import { type PostgresChangesOptions } from "@shivaedev/sql/postgresChanges.ts";
@@ -11,5 +11,5 @@ export interface DatabaseConfig extends PostgresOptions {
11
11
  readonly databaseUrl?: Redacted.Redacted<string>;
12
12
  readonly listenDatabaseUrl?: Redacted.Redacted<string>;
13
13
  }
14
- export declare function appDatabase<R, E = never>(options: AppDatabaseOptions<R, E>): Layer.Layer<"@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient, E | Config.ConfigError | Migrator.MigrationError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("effect/sql/SqlError").SqlError, Exclude<Exclude<R, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient>>;
14
+ export declare function appDatabase<R, E = never>(options: AppDatabaseOptions<R, E>): Layer.Layer<"@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient, E | Config.ConfigError | Migrator.MigrationError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("effect/sql/SqlError").SqlError, Crypto.Crypto | Exclude<Exclude<R, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient>>;
15
15
  //# sourceMappingURL=appDatabase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appDatabase.d.ts","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAoC,KAAK,EAAU,QAAQ,EAAY,MAAM,QAAQ,CAAC;AAC5G,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMtC,OAAO,EAAE,KAAK,sBAAsB,EAAmB,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,iCAAiC,CAAC;AAEtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,cAAe,SAAQ,eAAe;IACtD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,QAAQ,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,eAAe,GAAG,QAAQ,CAAC,CAAC,CAAC;IACzI,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CACvD;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,ilBAoD1E"}
1
+ {"version":3,"file":"appDatabase.d.ts","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAW,MAAM,EAA2B,KAAK,EAAU,QAAQ,EAAY,MAAM,QAAQ,CAAC;AAEpH,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMtC,OAAO,EAAE,KAAK,sBAAsB,EAAmB,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,iCAAiC,CAAC;AAEtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,cAAe,SAAQ,eAAe;IACtD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,QAAQ,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,eAAe,GAAG,QAAQ,CAAC,CAAC,CAAC;IACzI,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CACvD;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,imBAoD1E"}
@@ -1,6 +1,6 @@
1
- import { createHash } from "node:crypto";
2
1
  import * as PgClient from "@effect/sql-pg/PgClient";
3
- import { Clock, Config, Context, Duration, Effect, Fiber, Layer, Option, Redacted, Schedule } from "effect";
2
+ import { Clock, Config, Context, Crypto, Duration, Effect, Fiber, Layer, Option, Redacted, Schedule } from "effect";
3
+ import * as Hex from "effect/encoding/Hex";
4
4
  import * as Reactivity from "effect/reactivity/Reactivity";
5
5
  import { Migrator } from "effect/sql";
6
6
  import { LiveServer } from "@shivaedev/contract/LiveServer.ts";
@@ -31,7 +31,7 @@ export function appDatabase(options) {
31
31
  const hints = yield* LiveServer;
32
32
  const url = options.config?.databaseUrl ?? (yield* Config.Redacted("DATABASE_URL"));
33
33
  const name = yield* Config.String("APP_NAME").pipe(Config.withDefault(new URL(Redacted.value(url)).pathname));
34
- const channel = changes?.channel ?? `changes_${createHash("sha256").update(name).digest("hex").slice(0, 32)}`;
34
+ const channel = changes?.channel ?? (yield* defaultChangesChannel(name));
35
35
  const listenUrl = options.config?.listenDatabaseUrl ?? Option.getOrUndefined(yield* Config.Redacted("LISTEN_DATABASE_URL").pipe(Config.option));
36
36
  const listenerClient = listenUrl === undefined
37
37
  ? client
@@ -53,6 +53,11 @@ export function appDatabase(options) {
53
53
  const prepared = Layer.effectDiscard(prepareMigrations(migrations)).pipe(Layer.provideMerge(connected));
54
54
  return worker.pipe(Layer.provideMerge(prepared));
55
55
  }
56
+ const defaultChangesChannel = Effect.fnUntraced(function* (name) {
57
+ const crypto = yield* Crypto.Crypto;
58
+ const digest = yield* crypto.digest("SHA-256", new TextEncoder().encode(name)).pipe(Effect.orDie);
59
+ return `changes_${Hex.encode(digest).slice(0, 32)}`;
60
+ });
56
61
  function prepareMigrations(migrations) {
57
62
  switch (migrations.mode) {
58
63
  case "check": {
@@ -1 +1 @@
1
- {"version":3,"file":"appDatabase.js","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EA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ACrB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,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,cAwDrB,CAAC"}
package/dist/appHost.js CHANGED
@@ -1,13 +1,20 @@
1
1
  import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
2
- import { Layer } from "effect";
2
+ import { Effect, Layer } from "effect";
3
+ import { schemaSensitiveKeys } from "@shivaedev/errors/schemaSensitiveKeys.ts";
4
+ import { isSensitiveKey } from "@shivaedev/errors/sensitive.ts";
3
5
  import { appDatabase } from "#appDatabase.ts";
4
6
  import { appHostHttp, deferredHost, migratedHost } from "#appHostHttp.ts";
7
+ import { redactingDiagnostics } from "#redactingDiagnostics.ts";
5
8
  export const appHost = (options) => {
9
+ const startup = options.preflight;
10
+ const preflight = startup === undefined
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)))));
6
13
  if ("application" in options) {
7
- return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(options.preflight ?? Layer.empty), Layer.provide(NodeCrypto.layer));
14
+ return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(preflight), Layer.provide(NodeCrypto.layer));
8
15
  }
9
16
  return options.migrations === undefined
10
- ? appHostHttp(options).pipe(Layer.provideMerge(options.preflight ?? Layer.empty), Layer.provide(NodeCrypto.layer))
11
- : migratedHost({ ...options, migrations: options.migrations }, appDatabase({ ...options, migrations: options.migrations })).pipe(Layer.provideMerge(options.preflight ?? Layer.empty), Layer.provide(NodeCrypto.layer));
17
+ ? appHostHttp(options).pipe(Layer.provideMerge(preflight), Layer.provide(NodeCrypto.layer))
18
+ : migratedHost({ ...options, migrations: options.migrations }, appDatabase({ ...options, migrations: options.migrations })).pipe(Layer.provideMerge(preflight), Layer.provide(NodeCrypto.layer));
12
19
  };
13
20
  //# sourceMappingURL=appHost.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"appHost.js","sourceRoot":"","sources":["../src/appHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAK/B,OAAO,EAAE,WAAW,EAAuB,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAwE1E,MAAM,CAAC,MAAM,OAAO,GAAmB,CAkBtC,OAiBC,EACA,EAAE;IACH,IAAI,aAAa,IAAI,OAAO,EAAE,CAAC;QAC9B,OAAO,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAClE,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC,EACpD,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAC/B,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,UAAU,KAAK,SAAS;QACtC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,C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