@shivaedev/server 0.24.2 → 0.25.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 +12 -0
- package/README.md +15 -9
- package/dist/AppHostFactory.d.ts +5 -5
- package/dist/AppHostFactory.d.ts.map +1 -1
- package/dist/AppHostInput.d.ts +16 -8
- package/dist/AppHostInput.d.ts.map +1 -1
- package/dist/appDatabase.d.ts +8 -3
- package/dist/appDatabase.d.ts.map +1 -1
- package/dist/appDatabase.js +16 -44
- package/dist/appDatabase.js.map +1 -1
- package/dist/appDatabaseHttp.d.ts +239 -0
- package/dist/appDatabaseHttp.d.ts.map +1 -0
- package/dist/appDatabaseHttp.js +10 -0
- package/dist/appDatabaseHttp.js.map +1 -0
- package/dist/appHost.d.ts +120 -18
- package/dist/appHost.d.ts.map +1 -1
- package/dist/appHost.js +7 -17
- package/dist/appHost.js.map +1 -1
- package/dist/appHostHttp.d.ts +0 -235
- package/dist/appHostHttp.d.ts.map +1 -1
- package/dist/appHostHttp.js +0 -7
- package/dist/appHostHttp.js.map +1 -1
- package/dist/hostOptions.d.ts +1 -2
- package/dist/hostOptions.d.ts.map +1 -1
- package/dist/hostPreflight.d.ts +9 -0
- package/dist/hostPreflight.d.ts.map +1 -0
- package/dist/hostPreflight.js +6 -0
- package/dist/hostPreflight.js.map +1 -0
- package/dist/prepareMigrations.d.ts +5 -0
- package/dist/prepareMigrations.d.ts.map +1 -0
- package/dist/prepareMigrations.js +46 -0
- package/dist/prepareMigrations.js.map +1 -0
- package/dist/workerHost.d.ts +1 -1
- package/dist/workerHost.d.ts.map +1 -1
- package/dist/workerHost.js.map +1 -1
- package/package.json +12 -12
- package/src/AppHostFactory.ts +5 -9
- package/src/AppHostInput.ts +53 -7
- package/src/appDatabase.ts +64 -54
- package/src/appDatabaseHttp.ts +78 -0
- package/src/appHost.ts +46 -79
- package/src/appHostHttp.ts +0 -74
- package/src/hostOptions.ts +1 -2
- package/src/hostPreflight.ts +22 -0
- package/src/prepareMigrations.ts +57 -0
- package/src/workerHost.ts +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.25.0 - 2026-11-04
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Import and start HTTP-only or native RPC application hosts without installing `@effect/sql-pg`.
|
|
8
|
+
|
|
9
|
+
### Breaking
|
|
10
|
+
|
|
11
|
+
- Import database-backed `appHost` and `AppDatabaseOptions` from `@shivaedev/server/appDatabase.ts`. Import `AppHostOptions` and `AppLocalHostOptions` from `@shivaedev/server/AppHostInput.ts`. Keep the existing migration and deferred application options. Hosts without database wiring continue to import `appHost` and `AppHttpHostOptions` from `@shivaedev/server/appHost.ts` and need only `@effect/platform-node` alongside Effect.
|
|
12
|
+
- Import `migratedHost` and `deferredHost` from `@shivaedev/server/appDatabaseHttp.ts` when composing the host at that level.
|
|
13
|
+
- Import `HostPreflight` from `@shivaedev/server/hostPreflight.ts` when annotating preflight options.
|
|
14
|
+
|
|
3
15
|
## 0.24.2 - 2026-11-04
|
|
4
16
|
|
|
5
17
|
### Changed
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Every Effect application needs the same server shell: wait for migrations, open
|
|
|
9
9
|
```ts
|
|
10
10
|
import { NodeRuntime } from "@effect/platform-node";
|
|
11
11
|
import { Layer } from "effect";
|
|
12
|
-
import { appHost } from "@shivaedev/server/
|
|
12
|
+
import { appHost } from "@shivaedev/server/appDatabase.ts";
|
|
13
13
|
import { Api, Handlers, Services, migrations, sessions } from "./app.ts";
|
|
14
14
|
|
|
15
15
|
NodeRuntime.runMain(
|
|
@@ -17,7 +17,7 @@ NodeRuntime.runMain(
|
|
|
17
17
|
);
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
The process migrates the database, serves `Api` at `/rpc` and the built client from
|
|
20
|
+
The process migrates the database, serves `Api` at `/rpc` and the built client from the example app’s `public` folder, and stops in order on a signal.
|
|
21
21
|
|
|
22
22
|
## Using it
|
|
23
23
|
|
|
@@ -58,7 +58,7 @@ const Server = appHost({
|
|
|
58
58
|
|
|
59
59
|
`handleRequest` is the app's existing `(request: Request) => Promise<Response>`. Use `readBoundedBody` when forwarding bodies; `routes` receives the host's `MAX_BODY_SIZE` or `config.maxBodySize`, and that reader returns 413 on overflow. Merely converting a request to a Web request does not bound its body. Configure the actual proxy peer in `trustedProxy`; the host still requires trust when binding publicly and applies it at its own transport boundaries, including browser error reports. This setting does not install authentication or an Origin guard around application routes.
|
|
60
60
|
|
|
61
|
-
The
|
|
61
|
+
The host provides scoped `services`, `/health`, HTTP tracing with incoming W3C trace context, and diagnostic redaction. This entry needs `@effect/platform-node` and runs without `@effect/sql-pg`. Health returns 503 without SQL and 200 with reachable PostgreSQL. For migrations or deferred `application` construction, import `appHost` from `@shivaedev/server/appDatabase.ts` with the same HTTP route options. Add the native `group`, `handlers` and session policy as the app adopts native RPC, alongside any remaining HTTP routes.
|
|
62
62
|
|
|
63
63
|
Host option types include this HTTP-only shape. A wrapper that reads native RPC options first narrows with `options.group !== undefined` before reading `group` or `handlers`. Existing native `appHost` calls keep their options.
|
|
64
64
|
|
|
@@ -76,7 +76,7 @@ For feature modules, install the optional peer `@shivaedev/admin` and declare ea
|
|
|
76
76
|
|
|
77
77
|
```ts
|
|
78
78
|
import { Effect } from "effect";
|
|
79
|
-
import { appHost } from "@shivaedev/server/
|
|
79
|
+
import { appHost } from "@shivaedev/server/appDatabase.ts";
|
|
80
80
|
import { workerHost } from "@shivaedev/server/workerHost.ts";
|
|
81
81
|
import { appModules } from "@shivaedev/server/appModules.ts";
|
|
82
82
|
import { notes, tasks, sessions } from "./app.ts";
|
|
@@ -97,7 +97,7 @@ Pass `{ replacements: Layer.succeed(MyPort, implementation) }` as the second arg
|
|
|
97
97
|
```ts
|
|
98
98
|
import { NodeRuntime } from "@effect/platform-node";
|
|
99
99
|
import { Layer } from "effect";
|
|
100
|
-
import { appHost } from "@shivaedev/server/
|
|
100
|
+
import { appHost } from "@shivaedev/server/appDatabase.ts";
|
|
101
101
|
import { Api, Handlers, Services, migrations, sessions } from "./app.ts";
|
|
102
102
|
|
|
103
103
|
const Server = appHost({
|
|
@@ -112,7 +112,7 @@ const Server = appHost({
|
|
|
112
112
|
NodeRuntime.runMain(Layer.launch(Server));
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
`app.ts` exports the application's contracts, native Layers, numbered `Migrator.Loader` and a `Layer.Layer<SessionPolicy>` from `@shivaedev/identity/server/SessionPolicy.ts`. The host needs the optional peers `@effect/platform-node` and `@effect/sql-pg` at the workspace's Effect version; install both for this entry point. The `node-http/`, `rpc-server/` and `runtime/` entries still work without them.
|
|
115
|
+
`app.ts` exports the application's contracts, native Layers, numbered `Migrator.Loader` and a `Layer.Layer<SessionPolicy>` from `@shivaedev/identity/server/SessionPolicy.ts`. The database host entry needs the optional peers `@effect/platform-node` and `@effect/sql-pg` at the workspace's Effect version; install both for this entry point. Hosts without database wiring import `appHost` from `@shivaedev/server/appHost.ts` and need only the Node peer. The `node-http/`, `rpc-server/` and `runtime/` entries still work without them.
|
|
116
116
|
|
|
117
117
|
The `sessions` Layer provides one identity `SessionPolicy` to handler middleware, sockets, change subscriptions and application routes. Construct it with `Layer.succeed(SessionPolicy, { origin, provider, roles })`; policy readers take no policy argument.
|
|
118
118
|
|
|
@@ -163,7 +163,7 @@ The listener uses `HOST` or `127.0.0.1`, uses `PORT` or 3000, and reads `DATABAS
|
|
|
163
163
|
|
|
164
164
|
Set `config.socketPath` to serve the application over a Unix socket instead of the default TCP listener. Also set `config.port` to serve the same routes on both listeners; `HttpServer.address` then reports the TCP address. With only `socketPath`, `PORT` does not enable TCP and `HttpServer.address` reports the public socket path. The parent directory must exist. The host publishes the socket with mode `0600`, replaces an unanswered stale socket at startup, refuses an already running listener, and removes its socket on shutdown. Startup uses a private staging directory and a sibling `.<socket-name>.starting` lock. If a process is forcibly killed during startup, remove that lock before restarting, after confirming no startup is still running.
|
|
165
165
|
|
|
166
|
-
Unix clients can call HTTP RPC and subscribe through WebSocket RPC over the same socket path. Unix requests use filesystem access for transport admission; session middleware and query read policies still apply. TCP keeps its loopback, origin and proxy checks.
|
|
166
|
+
Unix clients can call HTTP RPC and subscribe through WebSocket RPC over the same socket path. Unix requests use filesystem access for transport admission; session middleware and query read policies still apply. TCP keeps its loopback, origin and proxy checks.
|
|
167
167
|
|
|
168
168
|
RPC request bodies are limited to 1 MiB by default. Set `MAX_BODY_SIZE` to a byte count or override it with `config.maxBodySize`, a nonnegative safe integer. An oversized NDJSON body, fixed-length or chunked, returns a 4xx before any RPC handler runs. The same byte limit applies to each WebSocket RPC message, including binary messages and the combined payload of continuation frames. An oversized message closes the connection with code 1009 before any RPC in that message runs; native Effect socket clients receive a typed `SocketError` with a `SocketCloseError` reason. The limit includes bearer authentication frames, and zero refuses every nonempty message. This limit applies to the host's RPC route.
|
|
169
169
|
|
|
@@ -179,7 +179,13 @@ Every response from the host's native RPC endpoint carries `Cache-Control: priva
|
|
|
179
179
|
|
|
180
180
|
For local tools, use `policy: "loopback"` with contracts that do not use session middleware to serve RPC without a session provider. The same TCP guard applies. This policy does not use `TRUSTED_PROXY` or `config.trustedProxy`. Set `rpcPath` to choose another native RPC route; `/rpc` remains the default.
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
Import `appHost` from `@shivaedev/server/appHost.ts` 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:
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
import type { AppHostOptions } from "@shivaedev/server/AppHostInput.ts";
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
A service that needs SQL still requires a SQL Layer. Provide `appDatabase` to the application’s service Layer when it owns database composition.
|
|
183
189
|
|
|
184
190
|
Set `config.buildVersion` to the deployed build ID to announce it over the host's native RPC socket. `platform.hostVersion.watch` sends that opaque string when subscribed and stays open; a reconnected subscriber receives the replacement host's ID. Omitting the option leaves the stream silent. Embed the same ID in the browser bundle and use React's `deployUpdate` controller to expose a superseded bundle without polling health. The application supplies staged-update activation, blockers, reload wording and confirmation.
|
|
185
191
|
|
|
@@ -289,7 +295,7 @@ On the server, merge the declaration into the application's group and its genera
|
|
|
289
295
|
|
|
290
296
|
```ts
|
|
291
297
|
import { Layer } from "effect";
|
|
292
|
-
import { appHost } from "@shivaedev/server/
|
|
298
|
+
import { appHost } from "@shivaedev/server/appDatabase.ts";
|
|
293
299
|
import { publicConfigLayer } from "@shivaedev/server/rpc-server/publicConfigLayer.ts";
|
|
294
300
|
import { Api, Handlers, sessions } from "./app.ts";
|
|
295
301
|
import { PublicConfig } from "./public-config.ts";
|
package/dist/AppHostFactory.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { Crypto, Layer } from "effect";
|
|
2
1
|
import type { Rpc } from "effect/rpc";
|
|
3
2
|
import type { AppHostInput } from "#AppHostInput.ts";
|
|
4
|
-
import type { AppDatabaseOptions
|
|
5
|
-
import type {
|
|
3
|
+
import type { AppDatabaseOptions } from "#appDatabase.ts";
|
|
4
|
+
import type { deferredHost } from "#appDatabaseHttp.ts";
|
|
5
|
+
import type { AppHttpHostOptions } from "#appHost.ts";
|
|
6
|
+
import type { appHostHttp } from "#appHostHttp.ts";
|
|
6
7
|
import type { HostRouteRequirements } from "#hostOptions.ts";
|
|
7
|
-
type PreflightHost
|
|
8
|
+
import type { PreflightHost } from "#hostPreflight.ts";
|
|
8
9
|
export interface AppHostFactory {
|
|
9
10
|
<TRpcs extends Rpc.Any = never, THandlers = never, THandlerError = never, THandlerRequirements = never, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TApplicationError = never, TApplicationRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never>(options: AppHostInput<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TApplicationError, TApplicationRequirements, TPreflight, TPreflightError, TPreflightRequirements, TRouteError, TRouteRequirements, TMigrationError> & {
|
|
10
11
|
readonly migrations: AppDatabaseOptions<TMigrations, TMigrationError>["migrations"];
|
|
11
12
|
}): PreflightHost<ReturnType<typeof deferredHost<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TApplicationError, TApplicationRequirements, TRouteError, TRouteRequirements, TMigrationError>>, NoInfer<TPreflight>, NoInfer<TPreflightError>, NoInfer<TPreflightRequirements>>;
|
|
12
13
|
<TRpcs extends Rpc.Any = never, THandlers = never, THandlerError = never, THandlerRequirements = never, TServices = never, TServiceError = never, TServiceRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements>(options: AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TPreflight, TPreflightError, TPreflightRequirements, TRouteError, TRouteRequirements>): PreflightHost<ReturnType<typeof appHostHttp<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TRouteError, TRouteRequirements>>, NoInfer<TPreflight>, NoInfer<TPreflightError>, NoInfer<TPreflightRequirements>>;
|
|
13
14
|
}
|
|
14
|
-
export {};
|
|
15
15
|
//# sourceMappingURL=AppHostFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppHostFactory.d.ts","sourceRoot":"","sources":["../src/AppHostFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"AppHostFactory.d.ts","sourceRoot":"","sources":["../src/AppHostFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBA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BAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,wBAAwB,EACxB,WAAW,EACX,kBAAkB,EAClB,eAAe,CACf,CACD,EACD,OAAO,CAAC,UAAU,CAAC,EACnB,OAAO,CAAC,eAAe,CAAC,EACxB,OAAO,CAAC,sBAAsB,CAAC,CAC/B,CAAC;IAEF,CACC,KAAK,SAAS,GAAG,CAAC,GAAG,GAAG,KAAK,EAC7B,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,KAAK,EACrB,oBAAoB,GAAG,KAAK,EAC5B,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,KAAK,EACrB,oBAAoB,GAAG,KAAK,EAC5B,UAAU,GAAG,KAAK,EAClB,eAAe,GAAG,KAAK,EACvB,sBAAsB,GAAG,KAAK,EAC9B,WAAW,GAAG,KAAK,EACnB,kBAAkB,GAAG,qBAAqB,EAE1C,OAAO,EAAE,kBAAkB,CAC1B,KAAK,EACL,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,WAAW,EACX,kBAAkB,CAClB,GACC,aAAa,CACf,UAAU,CACT,OAAO,WAAW,CACjB,KAAK,EACL,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,kBAAkB,CAClB,CACD,EACD,OAAO,CAAC,UAAU,CAAC,EACnB,OAAO,CAAC,eAAe,CAAC,EACxB,OAAO,CAAC,sBAAsB,CAAC,CAC/B,CAAC;CACF"}
|
package/dist/AppHostInput.d.ts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import type { Effect
|
|
1
|
+
import type { Effect } from "effect";
|
|
2
2
|
import type { Rpc } from "effect/rpc";
|
|
3
|
-
import type { AppDatabaseOptions
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} | ([TServices | TError | TRequirements] extends [never] ? {
|
|
8
|
-
readonly preflight?: never;
|
|
9
|
-
} : never);
|
|
3
|
+
import type { AppDatabaseOptions } from "#appDatabase.ts";
|
|
4
|
+
import type { AppHttpHostOptions } from "#appHost.ts";
|
|
5
|
+
import type { HostCoreOptions, HostPolicy, HostRouteRequirements, HostRoutes } from "#hostOptions.ts";
|
|
6
|
+
import type { HostPreflight } from "#hostPreflight.ts";
|
|
10
7
|
export type AppHostInput<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TApplicationError = never, TApplicationRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & ((AppDatabaseOptions<TMigrations, TMigrationError> & {
|
|
11
8
|
readonly application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, never, never, never, TRouteError, TRouteRequirements>, TApplicationError, TApplicationRequirements>;
|
|
12
9
|
}) | AppHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TPreflight, TPreflightError, TPreflightRequirements, TRouteError, TRouteRequirements, TMigrationError> | AppLocalHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TPreflight, TPreflightError, TPreflightRequirements, TRouteError, TRouteRequirements, TMigrationError> | AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TPreflight, TPreflightError, TPreflightRequirements, TRouteError, TRouteRequirements>);
|
|
10
|
+
export type AppHostOptions<TRpcs extends Rpc.Any = never, THandlers = never, THandlerError = never, THandlerRequirements = never, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostRoutes<TRouteError, TRouteRequirements> & HostPolicy & {
|
|
11
|
+
readonly migrations: AppDatabaseOptions<TMigrations, TMigrationError>["migrations"];
|
|
12
|
+
readonly config?: AppDatabaseOptions["config"];
|
|
13
|
+
readonly policy?: undefined;
|
|
14
|
+
};
|
|
15
|
+
export type AppLocalHostOptions<TRpcs extends Rpc.Any = never, THandlers = never, THandlerError = never, THandlerRequirements = never, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostRoutes<TRouteError, TRouteRequirements> & {
|
|
16
|
+
readonly migrations: AppDatabaseOptions<TMigrations, TMigrationError>["migrations"];
|
|
17
|
+
readonly config?: AppDatabaseOptions["config"];
|
|
18
|
+
readonly policy: "loopback";
|
|
19
|
+
readonly sessions?: never;
|
|
20
|
+
};
|
|
13
21
|
//# sourceMappingURL=AppHostInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppHostInput.d.ts","sourceRoot":"","sources":["../src/AppHostInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"AppHostInput.d.ts","sourceRoot":"","sources":["../src/AppHostInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,kBAA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AAS,GAAG,CAAC,GAAG,GAAG,KAAK,EAC7B,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,KAAK,EACrB,oBAAoB,GAAG,KAAK,EAC5B,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,KAAK,EACrB,oBAAoB,GAAG,KAAK,EAC5B,WAAW,GAAG,KAAK,EACnB,UAAU,GAAG,KAAK,EAClB,eAAe,GAAG,KAAK,EACvB,sBAAsB,GAAG,KAAK,EAC9B,WAAW,GAAG,KAAK,EACnB,kBAAkB,GAAG,qBAAqB,EAC1C,eAAe,GAAG,KAAK,IACpB,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,GAAG;IAC7C,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,YAAY,CAAC,CAAC;IACpF,QAAQ,CAAC,MAAM,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC/C,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;CAC1B,CAAC"}
|
package/dist/appDatabase.d.ts
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import * as PgClient from "@effect/sql-pg/PgClient";
|
|
2
2
|
import { Clock, Config, Crypto, Layer, Redacted } from "effect";
|
|
3
3
|
import * as Reactivity from "effect/reactivity/Reactivity";
|
|
4
|
-
import { Migrator } from "effect/sql";
|
|
5
4
|
import { type PostgresChangesOptions } from "@shivaedev/sql/postgresChanges.ts";
|
|
6
5
|
import { type PostgresOptions } from "@shivaedev/sql/postgresLayer.ts";
|
|
7
|
-
import type {
|
|
6
|
+
import type { AppHostFactory } from "#AppHostFactory.ts";
|
|
7
|
+
import type { MigrationOptions } from "#MigrationOptions.ts";
|
|
8
|
+
export interface AppDatabaseOptions<R = never, E = never> {
|
|
9
|
+
readonly config?: DatabaseConfig;
|
|
10
|
+
readonly migrations: MigrationOptions<R, E>;
|
|
11
|
+
}
|
|
8
12
|
export interface DatabaseConfig extends PostgresOptions {
|
|
9
13
|
readonly changes?: Partial<Omit<PostgresChangesOptions, "client" | "listenerClient" | "connectionSetting" | "connectionTTL" | "resync">>;
|
|
10
14
|
readonly clock?: Clock.Clock;
|
|
11
15
|
readonly databaseUrl?: Redacted.Redacted<string>;
|
|
12
16
|
readonly listenDatabaseUrl?: Redacted.Redacted<string>;
|
|
13
17
|
}
|
|
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>>;
|
|
18
|
+
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 | import("effect/sql/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>>;
|
|
19
|
+
export declare const appHost: AppHostFactory;
|
|
15
20
|
//# sourceMappingURL=appDatabase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appDatabase.d.ts","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"
|
|
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,EAAW,MAAM,EAAU,KAAK,EAAU,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEzF,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAK3D,OAAO,EAAE,KAAK,sBAAsB,EAAmB,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,iCAAiC,CAAC;AAEtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAOzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK;IACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAC5C;AAED,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,snBAoD1E;AAQD,eAAO,MAAM,OAAO,EAAE,cA+CrB,CAAC"}
|
package/dist/appDatabase.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
|
|
1
2
|
import * as PgClient from "@effect/sql-pg/PgClient";
|
|
2
|
-
import { Clock, Config, Context, Crypto,
|
|
3
|
+
import { Clock, Config, Context, Crypto, Effect, Layer, Option, Redacted } from "effect";
|
|
3
4
|
import * as Hex from "effect/encoding/Hex";
|
|
4
5
|
import * as Reactivity from "effect/reactivity/Reactivity";
|
|
5
|
-
import { Migrator } from "effect/sql";
|
|
6
6
|
import { LiveServer } from "@shivaedev/contract/LiveServer.ts";
|
|
7
|
-
import {
|
|
7
|
+
import { isSensitiveKey } from "@shivaedev/errors/sensitive.ts";
|
|
8
8
|
import { coordinateWorkerRelease } from "@shivaedev/sql/coordinateWorkerRelease.ts";
|
|
9
|
-
import { migratePostgres } from "@shivaedev/sql/migrations.ts";
|
|
10
|
-
import { pendingPostgresMigrations } from "@shivaedev/sql/pendingPostgresMigrations.ts";
|
|
11
9
|
import { postgresChanges } from "@shivaedev/sql/postgresChanges.ts";
|
|
12
10
|
import { postgresLayer } from "@shivaedev/sql/postgresLayer.ts";
|
|
13
11
|
import { WorkerRelease } from "@shivaedev/sql/WorkerRelease.ts";
|
|
12
|
+
import { deferredHost, migratedHost } from "#appDatabaseHttp.ts";
|
|
13
|
+
import { appHostHttp } from "#appHostHttp.ts";
|
|
14
|
+
import { hostPreflight } from "#hostPreflight.ts";
|
|
15
|
+
import { hostSensitiveKeys } from "#hostSensitiveKeys.ts";
|
|
16
|
+
import { prepareMigrations } from "#prepareMigrations.ts";
|
|
14
17
|
export function appDatabase(options) {
|
|
15
18
|
const config = {
|
|
16
19
|
...options.config,
|
|
@@ -58,44 +61,13 @@ const defaultChangesChannel = Effect.fnUntraced(function* (name) {
|
|
|
58
61
|
const digest = yield* crypto.digest("SHA-256", new TextEncoder().encode(name)).pipe(Effect.orDie);
|
|
59
62
|
return `changes_${Hex.encode(digest).slice(0, 32)}`;
|
|
60
63
|
});
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return assertPostgresMigrations(schema);
|
|
66
|
-
}
|
|
67
|
-
case "wait":
|
|
68
|
-
return waitForMigrations(migrations);
|
|
69
|
-
default:
|
|
70
|
-
return migratePostgres({ ...migrations, lockTimeout: migrations.lockTimeout ?? "5 seconds" }).pipe(Effect.asVoid);
|
|
64
|
+
export const appHost = (options) => {
|
|
65
|
+
const preflight = hostPreflight(options.preflight, "application" in options ? Effect.succeed(isSensitiveKey) : hostSensitiveKeys(options));
|
|
66
|
+
if ("application" in options) {
|
|
67
|
+
return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(preflight), Layer.provide(NodeCrypto.layer));
|
|
71
68
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
let pending = { components: [], migrations: [] };
|
|
77
|
-
let progress;
|
|
78
|
-
function log(message) {
|
|
79
|
-
return Effect.suspend(() => Effect.logInfo(message).pipe(Effect.annotateLogs({ pendingComponents: pending.components, pendingMigrations: pending.migrations })));
|
|
80
|
-
}
|
|
81
|
-
yield* Effect.gen(function* () {
|
|
82
|
-
pending = yield* pendingPostgresMigrations(migrations);
|
|
83
|
-
if (pending.migrations.length === 0 && pending.components.length === 0) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (progress === undefined) {
|
|
87
|
-
yield* log("Waiting for database migrations");
|
|
88
|
-
progress = yield* Effect.forever(Effect.sleep(progressInterval).pipe(Effect.andThen(log("Still waiting for database migrations")))).pipe(Effect.forkScoped);
|
|
89
|
-
}
|
|
90
|
-
return yield* Effect.fail(postgresMigrationError(pending));
|
|
91
|
-
}).pipe(Effect.retry({
|
|
92
|
-
schedule: Schedule.max([Schedule.spaced(migrations.pollInterval ?? "1 second"), Schedule.during(migrations.waitTimeout ?? "5 minutes")]),
|
|
93
|
-
while: (error) => error instanceof Migrator.MigrationError && error.kind === "BadState",
|
|
94
|
-
}), Effect.tapError((error) => error instanceof Migrator.MigrationError && error.kind === "BadState" ? log("Timed out waiting for database migrations") : Effect.void));
|
|
95
|
-
if (progress !== undefined) {
|
|
96
|
-
yield* Fiber.interrupt(progress);
|
|
97
|
-
yield* Effect.logInfo("Database migrations current");
|
|
98
|
-
}
|
|
99
|
-
}).pipe(Effect.scoped);
|
|
100
|
-
}
|
|
69
|
+
return options.migrations === undefined
|
|
70
|
+
? appHostHttp(options).pipe(Layer.provideMerge(preflight), Layer.provide(NodeCrypto.layer))
|
|
71
|
+
: migratedHost({ ...options, migrations: options.migrations }, appDatabase({ ...options, migrations: options.migrations })).pipe(Layer.provideMerge(preflight), Layer.provide(NodeCrypto.layer));
|
|
72
|
+
};
|
|
101
73
|
//# sourceMappingURL=appDatabase.js.map
|
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,
|
|
1
|
+
{"version":3,"file":"appDatabase.js","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EA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