@shivaedev/server 0.38.3 → 0.40.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 (93) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +18 -15
  3. package/dist/adapters/development.d.ts.map +1 -0
  4. package/dist/adapters/development.js.map +1 -0
  5. package/dist/adapters/makePlatformRuntime.d.ts +1 -1
  6. package/dist/adapters/makePlatformRuntime.d.ts.map +1 -1
  7. package/dist/adapters/nodeHttpServer.js +1 -1
  8. package/dist/adapters/nodeHttpServer.js.map +1 -1
  9. package/dist/appDatabaseHttp.d.ts +104 -104
  10. package/dist/appDatabaseHttp.d.ts.map +1 -1
  11. package/dist/appHost.d.ts +52 -52
  12. package/dist/appHost.d.ts.map +1 -1
  13. package/dist/appHostHttp.d.ts +52 -52
  14. package/dist/appHostHttp.d.ts.map +1 -1
  15. package/dist/appHostHttp.js +1 -1
  16. package/dist/appHostHttp.js.map +1 -1
  17. package/dist/boundedOtlpResponse.d.ts.map +1 -0
  18. package/dist/boundedOtlpResponse.js.map +1 -0
  19. package/dist/hostChanges.js +1 -1
  20. package/dist/hostChanges.js.map +1 -1
  21. package/dist/hostHttpServices.d.ts.map +1 -0
  22. package/dist/hostHttpServices.js.map +1 -0
  23. package/dist/hostRpc.d.ts +2 -3
  24. package/dist/hostRpc.d.ts.map +1 -1
  25. package/dist/hostRpc.js +4 -11
  26. package/dist/hostRpc.js.map +1 -1
  27. package/dist/hostRpcRoutes.d.ts +18 -18
  28. package/dist/hostRpcRoutes.d.ts.map +1 -1
  29. package/dist/hostRpcRoutes.js +2 -4
  30. package/dist/hostRpcRoutes.js.map +1 -1
  31. package/dist/migrationsIn.d.ts.map +1 -0
  32. package/dist/migrationsIn.js.map +1 -0
  33. package/dist/otlpHttpClient.js +1 -1
  34. package/dist/otlpHttpClient.js.map +1 -1
  35. package/dist/platformRuntime.d.ts.map +1 -0
  36. package/dist/platformRuntime.js.map +1 -0
  37. package/dist/providedModules.d.ts +1 -1
  38. package/dist/providedModules.d.ts.map +1 -1
  39. package/dist/redactedHost.d.ts.map +1 -1
  40. package/dist/redactedHost.js +13 -3
  41. package/dist/redactedHost.js.map +1 -1
  42. package/dist/servedGroup.d.ts +7 -0
  43. package/dist/servedGroup.d.ts.map +1 -0
  44. package/dist/servedGroup.js +15 -0
  45. package/dist/servedGroup.js.map +1 -0
  46. package/dist/servedHandlers.d.ts +10 -0
  47. package/dist/servedHandlers.d.ts.map +1 -0
  48. package/dist/servedHandlers.js +8 -0
  49. package/dist/servedHandlers.js.map +1 -0
  50. package/dist/subscriptionSignal.d.ts.map +1 -0
  51. package/dist/subscriptionSignal.js.map +1 -0
  52. package/package.json +13 -13
  53. package/src/adapters/makePlatformRuntime.ts +1 -1
  54. package/src/adapters/nodeHttpServer.ts +1 -1
  55. package/src/appHostHttp.ts +1 -1
  56. package/src/hostChanges.ts +1 -1
  57. package/src/hostRpc.ts +4 -12
  58. package/src/hostRpcRoutes.ts +2 -6
  59. package/src/otlpHttpClient.ts +1 -1
  60. package/src/providedModules.ts +1 -1
  61. package/src/redactedHost.ts +17 -3
  62. package/src/servedGroup.ts +16 -0
  63. package/src/servedHandlers.ts +13 -0
  64. package/dist/adapters/boundedOtlpResponse.d.ts.map +0 -1
  65. package/dist/adapters/boundedOtlpResponse.js.map +0 -1
  66. package/dist/adapters/hostHttpServices.d.ts.map +0 -1
  67. package/dist/adapters/hostHttpServices.js.map +0 -1
  68. package/dist/adapters/migrationsIn.d.ts.map +0 -1
  69. package/dist/adapters/migrationsIn.js.map +0 -1
  70. package/dist/adapters/platformRuntime.d.ts.map +0 -1
  71. package/dist/adapters/platformRuntime.js.map +0 -1
  72. package/dist/adapters/subscriptionSignal.d.ts.map +0 -1
  73. package/dist/adapters/subscriptionSignal.js.map +0 -1
  74. package/dist/development.d.ts.map +0 -1
  75. package/dist/development.js.map +0 -1
  76. /package/dist/{development.d.ts → adapters/development.d.ts} +0 -0
  77. /package/dist/{development.js → adapters/development.js} +0 -0
  78. /package/dist/{adapters/boundedOtlpResponse.d.ts → boundedOtlpResponse.d.ts} +0 -0
  79. /package/dist/{adapters/boundedOtlpResponse.js → boundedOtlpResponse.js} +0 -0
  80. /package/dist/{adapters/hostHttpServices.d.ts → hostHttpServices.d.ts} +0 -0
  81. /package/dist/{adapters/hostHttpServices.js → hostHttpServices.js} +0 -0
  82. /package/dist/{adapters/migrationsIn.d.ts → migrationsIn.d.ts} +0 -0
  83. /package/dist/{adapters/migrationsIn.js → migrationsIn.js} +0 -0
  84. /package/dist/{adapters/platformRuntime.d.ts → platformRuntime.d.ts} +0 -0
  85. /package/dist/{adapters/platformRuntime.js → platformRuntime.js} +0 -0
  86. /package/dist/{adapters/subscriptionSignal.d.ts → subscriptionSignal.d.ts} +0 -0
  87. /package/dist/{adapters/subscriptionSignal.js → subscriptionSignal.js} +0 -0
  88. /package/src/{development.ts → adapters/development.ts} +0 -0
  89. /package/src/{adapters/boundedOtlpResponse.ts → boundedOtlpResponse.ts} +0 -0
  90. /package/src/{adapters/hostHttpServices.ts → hostHttpServices.ts} +0 -0
  91. /package/src/{adapters/migrationsIn.ts → migrationsIn.ts} +0 -0
  92. /package/src/{adapters/platformRuntime.ts → platformRuntime.ts} +0 -0
  93. /package/src/{adapters/subscriptionSignal.ts → subscriptionSignal.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.40.0 - 2026-11-21
4
+
5
+ ### Added
6
+
7
+ - `servedGroup(group, websocket)` from `@shivaedev/server/servedGroup.ts` and `servedHandlers(group, handlers, buildVersion?)` from `@shivaedev/server/servedHandlers.ts` are the composition `appHost` serves its RPC group with: the read policy guard, which refuses `$changes` over HTTP, the command guard, the change stream, the host version and live sync. A native RPC host uses them to serve as `appHost` does.
8
+
9
+ ## 0.39.0 - 2026-11-21
10
+
11
+ ### Added
12
+
13
+ - `appHost` and `workerHost` collect the owned models their repositories report, so an operation they serve reads them through `(yield* RepositoryModels).owned`.
14
+
15
+ ### Breaking
16
+
17
+ - import from `@shivaedev/server/boundedOtlpResponse.ts` instead of `@shivaedev/server/adapters/boundedOtlpResponse.ts`, which moved out of `adapters/`.
18
+ - import from `@shivaedev/server/hostHttpServices.ts` instead of `@shivaedev/server/adapters/hostHttpServices.ts`, which moved out of `adapters/`.
19
+ - import from `@shivaedev/server/migrationsIn.ts` instead of `@shivaedev/server/adapters/migrationsIn.ts`, which moved out of `adapters/`.
20
+ - import from `@shivaedev/server/platformRuntime.ts` instead of `@shivaedev/server/adapters/platformRuntime.ts`, which moved out of `adapters/`.
21
+ - import from `@shivaedev/server/subscriptionSignal.ts` instead of `@shivaedev/server/adapters/subscriptionSignal.ts`, which moved out of `adapters/`.
22
+ - import `development` and `runDevelopment` from `@shivaedev/server/adapters/development.ts` instead of `@shivaedev/server/development.ts`; it starts processes with the host's Node binary and runs `runMain` inside an exported function, so it moved into `adapters/`.
23
+
3
24
  ## 0.38.3 - 2026-11-20
4
25
 
5
26
  ### Changed
package/README.md CHANGED
@@ -78,13 +78,13 @@ Host option types include this HTTP-only shape. A wrapper that reads native RPC
78
78
 
79
79
  `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.
80
80
 
81
- `development({ server, worker, conditions? })` from `@shivaedev/server/development.ts` starts the two application entry points with Node's watch mode and runs `pnpm exec vite`. Supply paths relative to the application directory and any export conditions its code needs. Provide `NodeServices.layer` to run it. When a process exits, the other processes stop and the Effect returns the first exit code, which the entry point can assign to `process.exitCode`. Use `runDevelopment(options)` from the same module for the Node entry point with that runtime wiring included.
81
+ `development({ server, worker, conditions? })` from `@shivaedev/server/adapters/development.ts` starts the two application entry points with Node's watch mode and runs `pnpm exec vite`. Supply paths relative to the application directory and any export conditions its code needs. Provide `NodeServices.layer` to run it. When a process exits, the other processes stop and the Effect returns the first exit code, which the entry point can assign to `process.exitCode`. Use `runDevelopment(options)` from the same module for the Node entry point with that runtime wiring included.
82
82
 
83
83
  ### Host the application
84
84
 
85
85
  `appHost` is the server entry point for an Effect app. For a PostgreSQL app, supply the native RPC group, handler and service Layers, migration loader, session policy and static asset directory. The host completes migrations before acquiring application services, starts Node HTTP with native Effect RPC over a WebSocket upgrade at `/rpc`, and provides SQL, Reactivity and `LiveServer` from `@shivaedev/contract/live-server/service.ts` to those Layers.
86
86
 
87
- For feature modules, install the optional peer `@shivaedev/admin` and declare each registration with `satisfies AppModule` from `@shivaedev/server/AppModule.ts`. Each module supplies its operations, `services` and, when it owns tables, `migrations: { loader, components? }`; a module without migrations leaves the field out. A defined module takes its name from the module itself and its registration gives none, so the two cannot disagree; a `group` plus `handlers` registration supplies a `name`, because nothing else names it. `migrationsIn(directory)` from `@shivaedev/server/adapters/migrationsIn.ts` takes the folder that contains `migrations`, the same argument as `loadMigrationsIn` from `@shivaedev/sql/loadMigrationsIn.ts`, and returns `{ loader }` for the `migrations` folder in it, found by `loadMigrationsIn` under Node's `NodeServices.layer`, so a registration beside its `migrations` folder writes `migrations: migrationsIn(import.meta.dirname)` and needs the optional peer `@effect/platform-node`. Register caller-dependent Layers in the optional `requestServices` slot beside global `services`. Keep default adapters in its optional `ports` Layer, put an optional `registerAdmin` result in `admin`, and declare owned `queues` and a `workers` Layer on the module. `jobModule` from `@shivaedev/jobs/server/jobModule.ts` supplies those two fields from a jobs registration list.
87
+ For feature modules, install the optional peer `@shivaedev/admin` and declare each registration with `satisfies AppModule` from `@shivaedev/server/AppModule.ts`. Each module supplies its operations, `services` and, when it owns tables, `migrations: { loader, components? }`; a module without migrations leaves the field out. A defined module takes its name from the module itself and its registration gives none, so the two cannot disagree; a `group` plus `handlers` registration supplies a `name`, because nothing else names it. `migrationsIn(directory)` from `@shivaedev/server/migrationsIn.ts` takes the folder that contains `migrations`, the same argument as `loadMigrationsIn` from `@shivaedev/sql/loadMigrationsIn.ts`, and returns `{ loader }` for the `migrations` folder in it, found by `loadMigrationsIn` under Node's `NodeServices.layer`, so a registration beside its `migrations` folder writes `migrations: migrationsIn(import.meta.dirname)` and needs the optional peer `@effect/platform-node`. Register caller-dependent Layers in the optional `requestServices` slot beside global `services`. Keep default adapters in its optional `ports` Layer, put an optional `registerAdmin` result in `admin`, and declare owned `queues` and a `workers` Layer on the module. `jobModule` from `@shivaedev/jobs/server/jobModule.ts` supplies those two fields from a jobs registration list.
88
88
 
89
89
  ```ts
90
90
  import { Effect } from "effect";
@@ -102,12 +102,14 @@ const hosts = Effect.gen(function* () {
102
102
  });
103
103
  ```
104
104
 
105
+ An application built with [`@shivaedev/build`](https://github.com/ShivaeDev/platform/tree/main/packages/build#the-servers-module-list) writes no such list: its generator finds every exported registration written `satisfies AppModule` and writes them to `src/generated/server/modules.ts` in the order of their files' paths, and the application passes that list to `appModules` beside the registrations that are not module folders, such as its foundation, so a module is registered by creating its folder. Admin navigation and the order in which `appModules` composes Layers follow the list. What the merged Layers provide and the migrations do not depend on it, because migrations run by their number. An application that needs another order renames a module's folder, or composes that registration beside its foundation where the generator does not find it, such as a function that returns it.
106
+
105
107
  A module defined with `defineModule` from `@shivaedev/contract/defineModule.ts` registers as `module:`, and the host builds its group and its handlers with `moduleHandlers`. Its handlers need the services its operations' `run` and read policies yield, less what its middleware and subject provide per call; the registration's `services` and `ports` provide them, except the SQL client and the other services the host provides. An RPC group that is not a defined module, such as a contract served by hand-written handlers, registers as `group` plus `handlers` instead, and both kinds sit in one application's module list:
106
108
 
107
109
  ```ts
108
110
  import { Layer } from "effect";
109
111
  import { defineModule } from "@shivaedev/contract/defineModule.ts";
110
- import { migrationsIn } from "@shivaedev/server/adapters/migrationsIn.ts";
112
+ import { migrationsIn } from "@shivaedev/server/migrationsIn.ts";
111
113
  import type { AppModule } from "@shivaedev/server/AppModule.ts";
112
114
  import { notesWire } from "#generated/modules/notes/Notes.ts";
113
115
  import { Create, Get } from "./notes/operations.ts";
@@ -210,7 +212,7 @@ To let a separate frontend call HTTP RPC with the user's session cookie, declare
210
212
 
211
213
  ```ts
212
214
  import { Layer } from "effect";
213
- import { trustedOrigins } from "@shivaedev/identity/server/adapters/trustedOrigins.ts";
215
+ import { trustedOrigins } from "@shivaedev/identity/server/trustedOrigins.ts";
214
216
  import { SessionPolicy } from "@shivaedev/identity/server/SessionPolicy.ts";
215
217
 
216
218
  const browserOrigins = ["https://app.example.com", "https://www.example.com"];
@@ -355,7 +357,7 @@ To pass worker-release time in a story, build `hostTime()` from `@shivaedev/test
355
357
 
356
358
  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).
357
359
 
358
- When mounting Better Auth routes yourself on Railway, use `betterAuthMount(authOptions, { clientIp: "railway" })` from `@shivaedev/identity/server/better-auth/adapters/mount.ts` with `TRUSTED_PROXY=100.64.0.0/10`. The `clientIp` preset selects `X-Real-IP` for auth and ignores spoofed `X-Forwarded-For`, overriding `AUTH_CLIENT_IP_HEADER`. Untrusted peers and requests without `X-Real-IP` use the connection address.
360
+ When mounting Better Auth routes yourself on Railway, use `betterAuthMount(AppAuth, { clientIp: "railway" })` from `@shivaedev/identity/server/better-auth/mount.ts` with `TRUSTED_PROXY=100.64.0.0/10`. The `clientIp` preset selects `X-Real-IP` for auth and ignores spoofed `X-Forwarded-For`, overriding `AUTH_CLIENT_IP_HEADER`. Untrusted peers and requests without `X-Real-IP` use the connection address.
359
361
 
360
362
  A host given an RPC group directly, rather than the `appModules` result, takes handlers for that group: build them with `Api.application.toLayer(...)` (and `Api.application.of(...)` for an Effect-built handler map), then pass the full `Api` to the host and client. `Api.application` is the native RPC group without the reserved `$changes` stream; the host supplies that handler. The explicit `Api.omit("<namespace>.$changes")` form also works.
361
363
 
@@ -414,7 +416,7 @@ Render inside the application's native registry provider. The query's `data` is
414
416
 
415
417
  Tracing logs declared failures with `RPC failure` and their tag, and defects with `RPC defect`. Interrupt-only causes emit `RPC interrupted` at debug instead, with `rpc.method`, `requestId`, the `rpc.duration` log span and the same redacted payload. The RPC trace span carries `rpc.interrupted: true`; Effect exports interruption with an unset span status. Completed and failed RPCs receive no interruption marker. The diagnostic payload masks nested credential-shaped keys and Effect `Redacted` values. Credential-shaped strings, such as bearer tokens, URL passwords and sensitive `key=value` text, are masked too. Strings retain at most 2,048 characters before a truncation marker; collections retain at most 50 entries with a marker for the remainder, and binary values become size summaries.
416
418
 
417
- `appHost` derives sensitive field names from the served RPC group's payload, success, error, defect and middleware error schemas, including nested schemas. Use `Schema.Redacted(...)`, `Schema.RedactedFromValue(...)`, or annotate a field with `sensitive: true`. The host applies each RPC's schema-derived names to that RPC's diagnostics and failures, even when a diagnostic contains an unwrapped value. A defined module's success comes from its generated wire, which carries no annotation, so it takes no part: mark the field on the model instead. Every repository the host builds while it starts, through `makeRepository` or `makeOrderedChildren`, declares its model, and the names of the model's sensitive fields apply to every RPC and every diagnostic like `config.sensitiveKeys`, before the host serves its first request. A repository made inside a handler declares its model only when it runs, after the RPC failure masks are compiled; build repositories in Layers. Values no repository model describes, such as computed or third-party data, are covered only by the built-in name rules and `config.sensitiveKeys`. Application-wide keys configured below apply to every RPC. Add other exact, case-sensitive names once in `config.sensitiveKeys`:
419
+ `appHost` derives sensitive field names from the served RPC group's payload, success, error, defect and middleware error schemas, including nested schemas. Use `Schema.Redacted(...)`, `Schema.RedactedFromValue(...)`, or annotate a field with `sensitive: true`. The host applies each RPC's schema-derived names to that RPC's diagnostics and failures, even when a diagnostic contains an unwrapped value. A defined module's success comes from its generated wire, which carries no annotation, so it takes no part: mark the field on the model instead. Every repository the host builds while it starts, through `makeRepository` or `makeOrderedChildren`, declares its model, and the names of the model's sensitive fields apply to every RPC and every diagnostic like `config.sensitiveKeys`, before the host serves its first request. A repository made inside a handler declares its model only when it runs, after the RPC failure masks are compiled; build repositories in Layers. The host also collects each model whose field is marked with `owner` from `@shivaedev/sql/owner.ts`, through sql's `collectRepositoryModels`, and an operation it serves reads them with their tables and owner columns through `(yield* RepositoryModels).owned`. Values no repository model describes, such as computed or third-party data, are covered only by the built-in name rules and `config.sensitiveKeys`. Application-wide keys configured below apply to every RPC. Add other exact, case-sensitive names once in `config.sensitiveKeys`:
418
420
 
419
421
  ```ts
420
422
  import { Schema } from "effect";
@@ -477,13 +479,13 @@ A nested `runWithServices` call replaces the outer invocation's overrides for it
477
479
 
478
480
  ### Node subscriptions: combine cancellation and clean up
479
481
 
480
- A native host that builds `hostChanges(group)` supplies its ordinary RPC handlers with `hostChanges(group).pipe(Layer.provideMerge(handlers))`. These are Layer dependencies because the subscription executes the authorized query handlers to produce its first result. `appHost` supplies them automatically.
482
+ A native RPC host serves what `appHost` serves through two pieces. `yield* servedGroup(group, websocket)` from `@shivaedev/server/servedGroup.ts` returns the `group` to serve, with the read policy guard and the command guard in place, and the `guards` Layer to provide: a host with `websocket: false` refuses `$changes` calls with `WebSocketRequired`, as `appHost`'s HTTP route does. `servedHandlers(group, handlers, buildVersion?)` from `@shivaedev/server/servedHandlers.ts` adds the group's change stream, the host version and live sync to the application's handlers; the change stream depends on the ordinary handlers because a subscription runs the authorized query to produce its first result. `appHost` composes both itself.
481
483
 
482
484
  A long-lived response can receive cancellation from a Web request, a procedure and its underlying Node connection:
483
485
 
484
486
  ```ts
485
487
  import type { IncomingMessage } from "node:http";
486
- import { nodeSubscriptionSignal } from "@shivaedev/server/adapters/subscriptionSignal.ts";
488
+ import { nodeSubscriptionSignal } from "@shivaedev/server/subscriptionSignal.ts";
487
489
 
488
490
  export async function consumeSubscription(
489
491
  request: Request,
@@ -580,15 +582,16 @@ Import the module that defines the name; there is no package-root entry. Paths b
580
582
  | `appDatabase.ts` | `appDatabase`, `DatabaseConfig`: PostgreSQL composition with migrations, Reactivity and contract's `LiveServer`. |
581
583
  | `workerHost.ts` | `workerHost`, `WorkerHostConfig`: scoped PostgreSQL, services and job workers with the host's redaction and OTLP export. |
582
584
  | `setupDatabases.ts` | `setupDatabases()`: prepare the local development and test databases. |
583
- | `development.ts` | `development({ server, worker, conditions? })`, `runDevelopment(options)`: run the server, worker and Vite in watch mode. |
585
+ | `adapters/development.ts` | `development({ server, worker, conditions? })`, `runDevelopment(options)`: run the server, worker and Vite in watch mode. |
584
586
  | `rpc-server/publicConfigLayer.ts` | `publicConfigLayer(declaration, path?)`: serve a `publicConfig` declaration from native Config. |
585
587
  | `localTracing.ts` | `localTracing(options?)`: scoped local SQLite spans and correlated logs with configurable attribute indexes and run retention. |
586
588
  | `otlpTracing.ts` | `otlpTracing`: redacting Railway OTLP export of spans, logs and error reports for a process composed without `appHost` or `workerHost`. |
587
589
  | `RedactionPolicy.ts` | `RedactionPolicy`: provide the app's diagnostic key predicate derived by errors. |
588
590
  | `adapters/redactingDiagnostics.ts`, `redactingTracer.ts`, `redactingRpcSerialization.ts` | `redactingDiagnostics(sensitive)`, `redactingTracer(sensitive)`, `redactingRpcSerialization(sensitive)`: compose native diagnostic and NDJSON boundaries. `redactingRpcSerialization` reads `RpcSerialization` from the Effect environment. |
589
- | `adapters/migrationsIn.ts` | `migrationsIn(directory)`: an `AppModule` `migrations` value that loads the `migrations` folder in `directory` under Node. |
591
+ | `migrationsIn.ts` | `migrationsIn(directory)`: an `AppModule` `migrations` value that loads the `migrations` folder in `directory` under Node. |
590
592
  | `adapters/makePlatformRuntime.ts` | `makePlatformRuntime(layer, { developmentCacheKey? })`. |
591
- | `adapters/subscriptionSignal.ts` | `nodeSubscriptionSignal({ nodeRequest?, request?, signals? })`, returning `{ signal, dispose }`. |
593
+ | `subscriptionSignal.ts` | `nodeSubscriptionSignal({ nodeRequest?, request?, signals? })`, returning `{ signal, dispose }`. |
594
+ | `servedGroup.ts`, `servedHandlers.ts` | `servedGroup(group, websocket)`, `servedHandlers(group, handlers, buildVersion?)`: the served group, guards and handlers `appHost` composes, for a native RPC host. |
592
595
 
593
596
  ### Install, setup and limits
594
597
 
@@ -600,10 +603,10 @@ Effect is the only required peer. The `node-http/`, `rpc-server/` and `runtime/`
600
603
 
601
604
  Install the optional peers for the selected integration:
602
605
 
603
- | Integration | Additional peers |
604
- | ---------------- | ----------------------------------------- |
605
- | `appHost.ts` | `@effect/platform-node`, `@effect/sql-pg` |
606
- | `development.ts` | `@effect/platform-node` |
606
+ | Integration | Additional peers |
607
+ | ------------------------- | ----------------------------------------- |
608
+ | `appHost.ts` | `@effect/platform-node`, `@effect/sql-pg` |
609
+ | `adapters/development.ts` | `@effect/platform-node` |
607
610
  - The package needs Node 24 or newer.
608
611
  - `appHost` adds tracing last on its server-side copy of the group. When composing a native RPC server directly, add `RequestTracing` last on the group so it wraps authentication too; see the [native-server example](https://github.com/ShivaeDev/platform/blob/main/docs/framework/request-context.md#request-id-identity-and-logging). Middleware outside that tracing boundary is responsible for its own diagnostics.
609
612
  - Redaction recognizes declared field names and common credential shapes. Mark sensitive fields in RPC schemas and configure extra names once with `config.sensitiveKeys`. Keep sensitive values out of ordinary prose.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development.d.ts","sourceRoot":"","sources":["../../src/adapters/development.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAgB,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,WAAW,oKAStB,CAAC;AAEH,wBAAgB,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAWhE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development.js","sourceRoot":"","sources":["../../src/adapters/development.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,WAAW,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,YAAY,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAQnE,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,EAAE,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,EAAE,EAAsB;IAC9H,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,mBAAmB,CAAC,mBAAmB,CAAC;IAC/D,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAW,CAAC;IACvH,MAAM,IAAI,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,SAAS,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;IACxF,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;QAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QACjF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QACjF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;KACtE,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,cAAc,CAAC,OAA2B;IACzD,WAAW,CAAC,OAAO,CAClB,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,CACxB,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACnB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;QAChB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IACzB,CAAC,CAAC,CACF,EACD,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAClC,CACD,CAAC;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import type { Layer } from "effect";
2
- import type { PlatformRuntime, PlatformRuntimeOptions } from "#adapters/platformRuntime.ts";
2
+ import type { PlatformRuntime, PlatformRuntimeOptions } from "#platformRuntime.ts";
3
3
  export declare function makePlatformRuntime<TServices, TBuildError>(layer: Layer.Layer<TServices, TBuildError>, options?: PlatformRuntimeOptions): PlatformRuntime<TServices, TBuildError>;
4
4
  //# sourceMappingURL=makePlatformRuntime.d.ts.map
@@ -1 +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,8BAA8B,CAAC;AA+C5F,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"}
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,qBAAqB,CAAC;AA+CnF,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"}
@@ -2,8 +2,8 @@ import { createServer } from "node:http";
2
2
  import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
3
3
  import { Config, Effect, Layer, Scope } from "effect";
4
4
  import { HttpServer } from "effect/http";
5
- import { hostHttpServices } from "#adapters/hostHttpServices.ts";
6
5
  import { unixHttpServer } from "#adapters/unixHttpServer.ts";
6
+ import { hostHttpServices } from "#hostHttpServices.ts";
7
7
  export function nodeHttpServer(host, config) {
8
8
  return Layer.effect(HttpServer.HttpServer, Effect.gen(function* () {
9
9
  const socketPath = config?.socketPath;
@@ -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,KAAK,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,MAAM,UAAU,cAAc,CAC7B,IAAY,EACZ,MAMC;IAED,OAAO,KAAK,CAAC,MAAM,CAClB,UAAU,CAAC,UAAU,EACrB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACnB,MAAM,UAAU,GAAG,MAAM,EAAE,UAAU,CAAC;QACtC,MAAM,OAAO,GAAG;YACf,uBAAuB,EAAE,MAAM,EAAE,uBAAuB;YACxD,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;QACF,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,GAAG,MAAM,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC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