@shivaedev/server 0.16.1 → 0.17.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 +24 -0
- package/README.md +31 -2
- package/dist/AppHostFactory.d.ts +3 -4
- package/dist/AppHostFactory.d.ts.map +1 -1
- package/dist/AppHostInput.d.ts +3 -4
- package/dist/AppHostInput.d.ts.map +1 -1
- package/dist/appHost.d.ts +5 -4
- package/dist/appHost.d.ts.map +1 -1
- package/dist/appHost.js.map +1 -1
- package/dist/appHostHttp.d.ts +58 -41
- package/dist/appHostHttp.d.ts.map +1 -1
- package/dist/appHostHttp.js +2 -1
- package/dist/appHostHttp.js.map +1 -1
- package/dist/bearerSocketRpc.d.ts +2 -2
- package/dist/bearerSocketRpc.d.ts.map +1 -1
- package/dist/bearerSocketRpc.js +5 -4
- package/dist/bearerSocketRpc.js.map +1 -1
- package/dist/hostChanges.d.ts +1 -2
- package/dist/hostChanges.d.ts.map +1 -1
- package/dist/hostChanges.js +14 -9
- package/dist/hostChanges.js.map +1 -1
- package/dist/hostOptions.d.ts +3 -3
- package/dist/hostOptions.d.ts.map +1 -1
- package/dist/hostRpcRoutes.d.ts +15 -7
- package/dist/hostRpcRoutes.d.ts.map +1 -1
- package/dist/hostRpcRoutes.js +6 -3
- package/dist/hostRpcRoutes.js.map +1 -1
- package/dist/otlpHttpClient.d.ts.map +1 -1
- package/dist/otlpHttpClient.js +12 -8
- package/dist/otlpHttpClient.js.map +1 -1
- package/dist/socketRpc.d.ts +5 -2
- package/dist/socketRpc.d.ts.map +1 -1
- package/dist/socketRpc.js +4 -3
- package/dist/socketRpc.js.map +1 -1
- package/dist/trimPostgresPageCache.d.ts +10 -0
- package/dist/trimPostgresPageCache.d.ts.map +1 -0
- package/dist/trimPostgresPageCache.js +25 -0
- package/dist/trimPostgresPageCache.js.map +1 -0
- package/package.json +8 -8
- package/src/AppHostFactory.ts +0 -7
- package/src/AppHostInput.ts +0 -5
- package/src/appHost.ts +3 -7
- package/src/appHostHttp.ts +4 -8
- package/src/bearerSocketRpc.ts +6 -6
- package/src/hostChanges.ts +15 -21
- package/src/hostOptions.ts +3 -3
- package/src/hostRpcRoutes.ts +36 -16
- package/src/otlpHttpClient.ts +17 -14
- package/src/socketRpc.ts +19 -6
- package/src/trimPostgresPageCache.ts +31 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.17.0 - 2026-11-01
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Apply an opt-in low-memory PostgreSQL preset with an explicit per-app point-in-time recovery choice.
|
|
8
|
+
- Trim PostgreSQL's clean filesystem cache without privileges through the server's Effect process boundary.
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Identity operation spans use the `Identity` prefix, including `Identity.resolveSession` and `Identity.betterAuthSession`. Adjust trace queries that used `Platform` or `PlatformRpc` names.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Quality reports HTTP error branches written with `HttpStatus.fromLiteral` outside configured HTTP edges, including comparisons, switch cases and status-list membership.
|
|
17
|
+
- GitHub App requests and artifact storage downloads use the shared HTTP status filter while retaining their GitHub error tags and reasons.
|
|
18
|
+
- Server OTLP exports use the shared HTTP status filter to reset warning suppression after success and report redacted collector failures.
|
|
19
|
+
|
|
20
|
+
### Breaking
|
|
21
|
+
|
|
22
|
+
- Identity reads `SessionPolicy` from the Effect environment. Import the service from `@shivaedev/identity/server/SessionPolicy.ts` and construct one `Layer.succeed(SessionPolicy, { origin, provider, roles, streamRevalidationInterval })`, omitting optional fields as needed. Replace `SessionPolicy<TSession>` annotations with `SessionPolicy["Service"]`; provider-specific types remain on `SessionProvider<TSession>`. Remove policy arguments from session middleware constructors, `resolveSession`, `withSessionUser`, `permissionLayer`, `permissionRoute`, session lookup, rechecks and stream revalidation; provide the policy Layer to the composed readers. Profiles and provider accounts are decoded at their middleware boundaries from the shared provider.
|
|
23
|
+
- Server's `appHost` `sessions` option accepts that Layer and supplies it to middleware, application routes, sockets and change subscriptions. Wrap the previous policy object in `Layer.succeed(SessionPolicy, policy)`. Remove the session-shape generic from host option and factory types, and remove the policy argument from `hostChanges` and `bearerSocketRpc`.
|
|
24
|
+
- Admin uses identity's `SessionPolicy` directly. Replace `AdminSessions` imports and Layers with the identity service, and provide the policy once through the host instead of separately to admin handlers and documents.
|
|
25
|
+
- MCP's `mcpRoutes` reads `SessionPolicy` from the environment. Remove its `sessions` option and the session-shape generic from `McpOptions`; `betterAuthMcp` now returns `sessions` as a policy Layer, which can be passed to the host or supplied to MCP routes with `HttpRouter.provideRequest(oauth.sessions)` when the host also serves cookie-authenticated RPC.
|
|
26
|
+
|
|
3
27
|
## 0.16.1 - 2026-11-01
|
|
4
28
|
|
|
5
29
|
### Changed
|
package/README.md
CHANGED
|
@@ -55,7 +55,9 @@ const Server = appHost({
|
|
|
55
55
|
NodeRuntime.runMain(Layer.launch(Server));
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
`app.ts` exports the application's contracts, native Layers, numbered `Migrator.Loader` and `SessionPolicy`. 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.
|
|
58
|
+
`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.
|
|
59
|
+
|
|
60
|
+
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.
|
|
59
61
|
|
|
60
62
|
Omit `services` when the app has no service Layer of its own. The host uses `Layer.empty`; handler requirements remain explicit, and a migrated host still provides its database services to handlers. Annotated options that declare service outputs, errors or requirements must supply a `services` Layer.
|
|
61
63
|
|
|
@@ -104,7 +106,7 @@ RPC request bodies are limited to 1 MiB by default. Set `MAX_BODY_SIZE` to a byt
|
|
|
104
106
|
|
|
105
107
|
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.
|
|
106
108
|
|
|
107
|
-
Ordinary POST RPC uses `localRpcGuard` from `@shivaedev/identity/server/local.ts`: it requires a loopback peer and Host, same-origin or absent Origin, and the NDJSON content type. The WebSocket upgrade uses the same loopback, origin and trusted-proxy checks without an HTTP body content type. Session lookup uses the upgrade's transport headers; RPC message headers cannot replace its cookie or Origin. Session middleware revalidates authenticated streams at `streamRevalidationInterval` and ends revoked subscriptions with typed `Unauthorized`. Cookie-authenticated sockets remain open; later protected calls use the same session checks. Automatic live subscriptions also recheck the session and query policy before each hint. POST RPC refuses `$changes` subscriptions with the contract’s typed `WebSocketRequired` error and a message saying they need the WebSocket protocol. The host applies `RequestTracing` last to every served RPC, including loopback RPC, so it wraps authentication and handlers without a per-contract tracing declaration. Existing tracing declarations run once at that outermost boundary. With a session policy, contracts declare `Authenticated` and `MaybeAuthenticated` as needed; the host supplies their implementations. For `AuthenticatedUser`, merge `authenticatedUserLayer(
|
|
109
|
+
Ordinary POST RPC uses `localRpcGuard` from `@shivaedev/identity/server/local.ts`: it requires a loopback peer and Host, same-origin or absent Origin, and the NDJSON content type. The WebSocket upgrade uses the same loopback, origin and trusted-proxy checks without an HTTP body content type. Session lookup uses the upgrade's transport headers; RPC message headers cannot replace its cookie or Origin. Session middleware revalidates authenticated streams at `streamRevalidationInterval` and ends revoked subscriptions with typed `Unauthorized`. Cookie-authenticated sockets remain open; later protected calls use the same session checks. Automatic live subscriptions also recheck the session and query policy before each hint. POST RPC refuses `$changes` subscriptions with the contract’s typed `WebSocketRequired` error and a message saying they need the WebSocket protocol. The host applies `RequestTracing` last to every served RPC, including loopback RPC, so it wraps authentication and handlers without a per-contract tracing declaration. Existing tracing declarations run once at that outermost boundary. With a session policy, contracts declare `Authenticated` and `MaybeAuthenticated` as needed; the host supplies their implementations. For `AuthenticatedUser`, merge `authenticatedUserLayer()` from `@shivaedev/identity/server/session.ts` beside the handlers. Declared errors retain their Schema types. Applications still own resource authorization and use `rpcBoundary` when they need to map unexpected failures.
|
|
108
110
|
|
|
109
111
|
Native clients that cannot set upgrade headers use `makeClient`'s `bearerToken` option from `@shivaedev/contract/bind.ts`. On session hosts, `GET /rpc?auth=frame` requires a first text frame shaped as `{"_tag":"Authenticate","token":"<credential>"}` within five seconds, with at most 8192 characters. The host consumes that frame before starting native RPC and supplies its bearer as the socket's transport Authorization header. The existing session provider, identity middleware, Origin policy and query read policies apply to every call and live read. RPC message headers cannot replace the authenticated credential. Configure bearer admission on the session provider and the WebView Origin through `nativeOrigins`. A long-lived bearer is never placed in a URL.
|
|
110
112
|
|
|
@@ -347,6 +349,33 @@ export async function consumeSubscription(
|
|
|
347
349
|
|
|
348
350
|
The signal aborts on an additional signal, socket close, incomplete request close or an already destroyed connection. Normal completion of a request does not abort a continuing response. Without an explicit `nodeRequest`, the helper can read one from an srvx Web request's `runtime.node.req`. `dispose()` removes Node listeners and can be called repeatedly.
|
|
349
351
|
|
|
352
|
+
### Low-memory PostgreSQL hosts
|
|
353
|
+
|
|
354
|
+
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.
|
|
355
|
+
|
|
356
|
+
`trimPostgresPageCache(dataDirectory)` from `@shivaedev/server/trimPostgresPageCache.ts` runs `find` and GNU `dd` through Effect's `ChildProcessSpawner`. Run it inside the PostgreSQL container, or in a process that can read its mounted PGDATA, as the PGDATA owner. Provide `NodeServices.layer` at the entry point. It needs Linux, GNU coreutils (`dd iflag=nocache`) and `find`; Alpine's BusyBox `dd` does not support this flag. Spawn failures remain typed `PlatformError`s; a nonzero trim exit fails with `PostgresPageCacheTrimError`.
|
|
357
|
+
|
|
358
|
+
```ts
|
|
359
|
+
import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
360
|
+
import { Config, Effect, Schedule } from "effect";
|
|
361
|
+
import { trimPostgresPageCache } from "@shivaedev/server/trimPostgresPageCache.ts";
|
|
362
|
+
|
|
363
|
+
const trim = Effect.gen(function* () {
|
|
364
|
+
const dataDirectory = yield* Config.String("PGDATA");
|
|
365
|
+
yield* trimPostgresPageCache(dataDirectory).pipe(Effect.repeat(Schedule.spaced("5 minutes")));
|
|
366
|
+
}).pipe(Effect.provide(NodeServices.layer));
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
The cadence starts with one trim, then waits five minutes between completed runs. Scope or interrupt the Effect with its owning process. For a PostgreSQL image without Node, schedule the equivalent command every five minutes using that image's scheduler, as its database OS user:
|
|
370
|
+
|
|
371
|
+
```sh
|
|
372
|
+
find "$PGDATA" -type f -exec sh -c 'for path do dd if="$path" iflag=nocache count=0 status=none || exit; done' sh {} +
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
The command reads no file contents and writes no data. It asks the kernel to discard only clean pages; dirty pages stay until ordinary PostgreSQL and kernel writeback makes them eligible. It requires no root privileges, global `drop_caches`, forced checkpoint or `sync`. It does not follow symlinks, including tablespace links. The next read can incur disk I/O, so begin with five minutes and lengthen the interval if cache misses affect latency. Files removed during a run can fail that run. The repeating Effect then fails; a cron scheduler launches a fresh run at its next tick. The reported Railway trim took 88 ms and left a 1 GB container at 68–191 MiB; duration and retained pages depend on the workload and filesystem.
|
|
376
|
+
|
|
377
|
+
Enable the preset and trim per app in a throwaway environment first. Record `memory.current` and `memory.stat` inside the PostgreSQL cgroup before applying the preset, after restart, after a representative request/backup peak, and at five and ten minutes idle with trimming and the normal pool lifetime enabled. Check that LISTEN delivery and application reads still work. `docker stats` can subtract cache and is not the billed cgroup total. Keep PITR and non-PITR trials separate. Roll out to production only after that consumer trial; starter deployments must also keep these operations opt-in until the trial succeeds. The starter does not apply instance settings or schedule a trim during application startup.
|
|
378
|
+
|
|
350
379
|
### API
|
|
351
380
|
|
|
352
381
|
Import the module that defines the name; there is no package-root entry. Paths below follow `@shivaedev/server/`.
|
package/dist/AppHostFactory.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { Crypto, Layer } from "effect";
|
|
2
2
|
import type { Rpc } from "effect/rpc";
|
|
3
|
-
import type { SessionShape } from "@shivaedev/identity/server/session.ts";
|
|
4
3
|
import type { AppHostInput } from "#AppHostInput.ts";
|
|
5
4
|
import type { AppDatabaseOptions, AppHttpHostOptions } from "#appHost.ts";
|
|
6
5
|
import type { appHostHttp, deferredHost } from "#appHostHttp.ts";
|
|
7
6
|
import type { HostRouteRequirements } from "#hostOptions.ts";
|
|
8
7
|
type PreflightHost<THost extends Layer.Any, TServices, TError, TRequirements> = Layer.Layer<Layer.Success<THost> | TServices, Layer.Error<THost> | TError, Exclude<Layer.Services<THost>, TServices | Crypto.Crypto> | Exclude<TRequirements, Crypto.Crypto>>;
|
|
9
8
|
export interface AppHostFactory {
|
|
10
|
-
<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never,
|
|
9
|
+
<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TApplicationError = never, TApplicationRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never>(options: AppHostInput<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TApplicationError, TApplicationRequirements, TPreflight, TPreflightError, TPreflightRequirements, TRouteError, TRouteRequirements, TMigrationError> & {
|
|
11
10
|
readonly migrations: AppDatabaseOptions<TMigrations, TMigrationError>["migrations"];
|
|
12
|
-
}): PreflightHost<ReturnType<typeof deferredHost<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations,
|
|
13
|
-
<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never,
|
|
11
|
+
}): PreflightHost<ReturnType<typeof deferredHost<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TApplicationError, TApplicationRequirements, TRouteError, TRouteRequirements, TMigrationError>>, NoInfer<TPreflight>, NoInfer<TPreflightError>, NoInfer<TPreflightRequirements>>;
|
|
12
|
+
<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements>(options: AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TPreflight, TPreflightError, TPreflightRequirements, TRouteError, TRouteRequirements>): PreflightHost<ReturnType<typeof appHostHttp<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TRouteError, TRouteRequirements>>, NoInfer<TPreflight>, NoInfer<TPreflightError>, NoInfer<TPreflightRequirements>>;
|
|
14
13
|
}
|
|
15
14
|
export {};
|
|
16
15
|
//# sourceMappingURL=AppHostFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppHostFactory.d.ts","sourceRoot":"","sources":["../src/AppHostFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,GAAG,E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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,6 +1,5 @@
|
|
|
1
1
|
import type { Effect, Layer } from "effect";
|
|
2
2
|
import type { Rpc } from "effect/rpc";
|
|
3
|
-
import type { SessionShape } from "@shivaedev/identity/server/session.ts";
|
|
4
3
|
import type { AppDatabaseOptions, AppHostOptions, AppHttpHostOptions, AppLocalHostOptions } from "#appHost.ts";
|
|
5
4
|
import type { HostRouteRequirements } from "#hostOptions.ts";
|
|
6
5
|
export type HostPreflight<TServices = never, TError = never, TRequirements = never> = {
|
|
@@ -8,7 +7,7 @@ export type HostPreflight<TServices = never, TError = never, TRequirements = nev
|
|
|
8
7
|
} | ([TServices | TError | TRequirements] extends [never] ? {
|
|
9
8
|
readonly preflight?: never;
|
|
10
9
|
} : never);
|
|
11
|
-
export type AppHostInput<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never,
|
|
12
|
-
readonly application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements,
|
|
13
|
-
}) | AppHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations,
|
|
10
|
+
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
|
+
readonly application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, never, never, never, TRouteError, TRouteRequirements>, TApplicationError, TApplicationRequirements>;
|
|
12
|
+
}) | 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>);
|
|
14
13
|
//# 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,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"AppHostInput.d.ts","sourceRoot":"","sources":["../src/AppHostInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC/G,OAAO,KAAK,EAAE,qBAAq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oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EAClB,eAAe,CACd,GACD,mBAAmB,CACnB,KAAK,EACL,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EAClB,eAAe,CACd,GACD,kBAAkB,CAClB,KAAK,EACL,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,WAAW,EACX,kBAAkB,CACjB,CACH,CAAC"}
|
package/dist/appHost.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Layer } from "effect";
|
|
1
2
|
import type { Rpc } from "effect/rpc";
|
|
2
|
-
import type { SessionPolicy
|
|
3
|
+
import type { SessionPolicy } from "@shivaedev/identity/server/SessionPolicy.ts";
|
|
3
4
|
import type { AppHostFactory } from "#AppHostFactory.ts";
|
|
4
5
|
import type { HostPreflight } from "#AppHostInput.ts";
|
|
5
6
|
import { type DatabaseConfig } from "#appDatabase.ts";
|
|
@@ -9,17 +10,17 @@ export interface AppDatabaseOptions<R = never, E = never> {
|
|
|
9
10
|
readonly config?: DatabaseConfig;
|
|
10
11
|
readonly migrations: MigrationOptions<R, E>;
|
|
11
12
|
}
|
|
12
|
-
export type AppHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never,
|
|
13
|
+
export type AppHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostRoutes<TRouteError, TRouteRequirements> & {
|
|
13
14
|
readonly migrations: AppDatabaseOptions<TMigrations, TMigrationError>["migrations"];
|
|
14
15
|
readonly policy?: undefined;
|
|
15
|
-
readonly sessions: SessionPolicy
|
|
16
|
+
readonly sessions: Layer.Layer<SessionPolicy>;
|
|
16
17
|
};
|
|
17
18
|
export type AppLocalHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostRoutes<TRouteError, TRouteRequirements> & {
|
|
18
19
|
readonly migrations: AppDatabaseOptions<TMigrations, TMigrationError>["migrations"];
|
|
19
20
|
readonly policy: "loopback";
|
|
20
21
|
readonly sessions?: never;
|
|
21
22
|
};
|
|
22
|
-
export type AppHttpHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never,
|
|
23
|
+
export type AppHttpHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostRoutes<TRouteError, TRouteRequirements> & HostPolicy & {
|
|
23
24
|
readonly migrations?: undefined;
|
|
24
25
|
};
|
|
25
26
|
export declare const appHost: AppHostFactory;
|
package/dist/appHost.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appHost.d.ts","sourceRoot":"","sources":["../src/appHost.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"appHost.d.ts","sourceRoot":"","sources":["../src/appHost.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,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,MAAM,cAAc,CACzB,KAAK,SAAS,GAAG,CAAC,GAAG,EACrB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,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,q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CAAC;CAC1B,CAAC;AAEH,MAAM,MAAM,kBAAkB,CAC7B,KAAK,SAAS,GAAG,CAAC,GAAG,EACrB,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,cAiDrB,CAAC"}
|
package/dist/appHost.js.map
CHANGED
|
@@ -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;
|
|
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,OAA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