@shivaedev/platform 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 +11 -0
- package/README.md +3 -0
- package/dist/rpc/requireAdmin.d.ts +3 -3
- package/dist/rpc/requireAdmin.d.ts.map +1 -1
- package/dist/rpc/requireAdmin.js +5 -8
- package/dist/rpc/requireAdmin.js.map +1 -1
- package/dist/server/AppHostFactory.d.ts +15 -0
- package/dist/server/AppHostFactory.d.ts.map +1 -0
- package/dist/server/AppHostFactory.js +2 -0
- package/dist/server/AppHostFactory.js.map +1 -0
- package/dist/server/AppHostInput.d.ts +13 -0
- package/dist/server/AppHostInput.d.ts.map +1 -0
- package/dist/server/AppHostInput.js +2 -0
- package/dist/server/AppHostInput.js.map +1 -0
- package/dist/server/appHost.d.ts +8 -10
- package/dist/server/appHost.d.ts.map +1 -1
- package/dist/server/appHost.js +6 -6
- package/dist/server/appHost.js.map +1 -1
- package/dist/server/appHostHttp.d.ts +5 -2
- package/dist/server/appHostHttp.d.ts.map +1 -1
- package/dist/server/appHostHttp.js.map +1 -1
- package/package.json +3 -3
- package/src/rpc/requireAdmin.ts +6 -9
- package/src/server/AppHostFactory.ts +121 -0
- package/src/server/AppHostInput.ts +74 -0
- package/src/server/appHost.ts +43 -71
- package/src/server/appHostHttp.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.17.0 - 2026-10-18
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `appHost` accepts a native `preflight` Layer that builds before migration checks or execution and application startup. Typed failures stop startup; its services remain available to migrations, application construction, application services, RPC handlers and host callers, and its resources close with the host scope. The host option types accept preflight service, error and requirement parameters and require the Layer whenever any of those types are declared.
|
|
8
|
+
- Export `AppHostFactory`, `AppHostInput` and `HostPreflight` types for annotated host factories, inputs and preflight options.
|
|
9
|
+
|
|
10
|
+
### Breaking
|
|
11
|
+
|
|
12
|
+
- `requireAdmin` now requires `SessionUser` and fails with `Forbidden` for non-admin users. Put RPC handlers behind `AuthenticatedUser`, and wrap HTTP handlers with `withSessionUser`, so authentication supplies the profile and rejects signed-out requests with `Unauthorized`.
|
|
13
|
+
|
|
3
14
|
## 0.16.1 - 2026-10-18
|
|
4
15
|
|
|
5
16
|
### Fixed
|
package/README.md
CHANGED
|
@@ -92,12 +92,15 @@ Omit `migrations` to host an app without a database. This form creates no SQL po
|
|
|
92
92
|
|
|
93
93
|
Set `migrations.mode: "check"` on `appDatabase` or a database-backed `appHost` when a separate pre-deploy command owns migrations. Startup reads the ledger and fails with native `MigrationError` (`kind: "BadState"`) if any required migration ID or name is missing; it does not run migrations or create a ledger. Later ledger entries are allowed for rolling deployments. Use `migrations.mode: "wait"` for services that can start before that pre-deploy command finishes. It re-reads the ledger every second until current, then starts the application. Set `migrations.pollInterval` and `migrations.waitTimeout` with Effect duration inputs to change the interval and five-minute timeout. Timeout fails with the same `MigrationError` as `"check"`; interruption stops polling and closes the pool. SQL failures fail immediately. With `mode` omitted or `"migrate"`, startup applies pending migrations with a five-second lock timeout unless `migrations.lockTimeout` overrides it.
|
|
94
94
|
|
|
95
|
+
Supply `preflight: AppConfigLive` to `appHost` to build a native Layer before checking or applying migrations, or constructing the application. Use it to validate configuration such as app IDs, keys and invite lists. Its errors stay in the returned Layer's typed error channel, its requirements remain external requirements, and its services are available to migrations, application construction, services and RPC handlers as well as callers of the host Layer. Preflight resources close with the host scope. The option also works without migrations.
|
|
96
|
+
|
|
95
97
|
When construction itself touches the schema, use `appHost({ migrations, config, application })`. `application` is a native Effect that returns the HTTP host options (`group`, handler and service Layers, session policy, and optional HTTP config). The host first builds `appDatabase`, then evaluates this Effect in the host scope with SQL, Reactivity and `AppChanges` available. A failed migration or schema-current check prevents construction. Initialization requirements and errors stay in the returned Layer's types, and acquired resources close with the host scope.
|
|
96
98
|
|
|
97
99
|
```ts
|
|
98
100
|
const host = appHost({
|
|
99
101
|
config: { databaseUrl },
|
|
100
102
|
migrations: { loader: migrations, mode: "check" },
|
|
103
|
+
preflight: AppConfigLive,
|
|
101
104
|
application: Effect.gen(function* () {
|
|
102
105
|
const { routes, sessions } = yield* makeAuth();
|
|
103
106
|
return { group: Api, handlers: Handlers, services: Services, routes, sessions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { Forbidden
|
|
3
|
-
import { type SessionUserValue } from "./identity.ts";
|
|
4
|
-
export declare const requireAdmin: Effect.Effect<SessionUserValue,
|
|
2
|
+
import { Forbidden } from "#errors/taxonomy.ts";
|
|
3
|
+
import { SessionUser, type SessionUserValue } from "./identity.ts";
|
|
4
|
+
export declare const requireAdmin: Effect.Effect<SessionUserValue, Forbidden, SessionUser>;
|
|
5
5
|
//# sourceMappingURL=requireAdmin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requireAdmin.d.ts","sourceRoot":"","sources":["../../src/rpc/requireAdmin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"requireAdmin.d.ts","sourceRoot":"","sources":["../../src/rpc/requireAdmin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEnE,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,SAAS,EAAE,WAAW,CAM/E,CAAC"}
|
package/dist/rpc/requireAdmin.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { Effect
|
|
2
|
-
import { Forbidden
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { Forbidden } from "#errors/taxonomy.ts";
|
|
3
3
|
import { SessionUser } from "./identity.js";
|
|
4
4
|
export const requireAdmin = Effect.gen(function* () {
|
|
5
|
-
const user = yield*
|
|
6
|
-
if (
|
|
7
|
-
return yield* new Unauthorized({ message: "Authentication required" });
|
|
8
|
-
}
|
|
9
|
-
if (!user.value.role?.split(",").includes("admin")) {
|
|
5
|
+
const user = yield* SessionUser;
|
|
6
|
+
if (!user.role?.split(",").includes("admin")) {
|
|
10
7
|
return yield* new Forbidden({ message: "Administrator role required" });
|
|
11
8
|
}
|
|
12
|
-
return user
|
|
9
|
+
return user;
|
|
13
10
|
});
|
|
14
11
|
//# sourceMappingURL=requireAdmin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requireAdmin.js","sourceRoot":"","sources":["../../src/rpc/requireAdmin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"requireAdmin.js","sourceRoot":"","sources":["../../src/rpc/requireAdmin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAyB,MAAM,eAAe,CAAC;AAEnE,MAAM,CAAC,MAAM,YAAY,GAA4D,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACxG,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,WAAW,CAAC;IAChC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAC,CAAC,IAAI,SAAS,CAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Effect, Layer } from "effect";
|
|
2
|
+
import type { Rpc } from "effect/rpc";
|
|
3
|
+
import type { HostPreflight } from "#server/AppHostInput.ts";
|
|
4
|
+
import type { AppDatabaseOptions, AppHostOptions, AppHttpHostOptions, AppLocalHostOptions } from "#server/appHost.ts";
|
|
5
|
+
import type { appHostHttp, deferredHost } from "#server/appHostHttp.ts";
|
|
6
|
+
import type { SessionShape } from "#server/rpc-server/session.ts";
|
|
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> | TRequirements>;
|
|
8
|
+
export interface AppHostFactory {
|
|
9
|
+
<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TSession extends SessionShape = SessionShape, TApplicationError = never, TApplicationRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never>(options: HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & ((AppDatabaseOptions<TMigrations> & {
|
|
10
|
+
readonly application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>, TApplicationError, TApplicationRequirements>;
|
|
11
|
+
}) | AppHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession, TPreflight, TPreflightError, TPreflightRequirements> | AppLocalHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TPreflight, TPreflightError, TPreflightRequirements>)): PreflightHost<ReturnType<typeof deferredHost<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession, TApplicationError, TApplicationRequirements>>, NoInfer<TPreflight>, NoInfer<TPreflightError>, NoInfer<TPreflightRequirements>>;
|
|
12
|
+
<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TSession extends SessionShape = SessionShape, TPreflight = never, TPreflightError = never, TPreflightRequirements = never>(options: AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession, TPreflight, TPreflightError, TPreflightRequirements>): PreflightHost<ReturnType<typeof appHostHttp<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>>, NoInfer<TPreflight>, NoInfer<TPreflightError>, NoInfer<TPreflightRequirements>>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=AppHostFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppHostFactory.d.ts","sourceRoot":"","sources":["../../src/server/AppHostFactory.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,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACtH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,KAAK,aAAa,CAAC,KAAK,SAAS,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,IAAI,KAAK,CAAC,KAAK,CAC1F,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,SAAS,EAChC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,MAAM,EAC3B,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,S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CACxB,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,EACrB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,KAAK,EACrB,oBAAoB,GAAG,KAAK,EAC5B,QAAQ,SAAS,YAAY,GAAG,YAAY,EAC5C,UAAU,GAAG,KAAK,EAClB,eAAe,GAAG,KAAK,EACvB,sBAAsB,GAAG,KAAK,EAE9B,OAAO,EAAE,kBAAkB,CAC1B,KAAK,EACL,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,eAAe,EACf,sBAAsB,CACtB,GACC,aAAa,CACf,UAAU,CAAC,OAAO,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,EAAE,QAAQ,CAAC,CAAC,EAC/I,OAAO,CAAC,UAAU,CAAC,EACnB,OAAO,CAAC,eAAe,CAAC,EACxB,OAAO,CAAC,sBAAsB,CAAC,CAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppHostFactory.js","sourceRoot":"","sources":["../../src/server/AppHostFactory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Effect, Layer } from "effect";
|
|
2
|
+
import type { Rpc } from "effect/rpc";
|
|
3
|
+
import type { AppDatabaseOptions, AppHostOptions, AppHttpHostOptions, AppLocalHostOptions } from "#server/appHost.ts";
|
|
4
|
+
import type { SessionShape } from "#server/rpc-server/session.ts";
|
|
5
|
+
export type HostPreflight<TServices = never, TError = never, TRequirements = never> = {
|
|
6
|
+
readonly preflight: Layer.Layer<TServices, TError, TRequirements>;
|
|
7
|
+
} | ([TServices | TError | TRequirements] extends [never] ? {
|
|
8
|
+
readonly preflight?: never;
|
|
9
|
+
} : never);
|
|
10
|
+
export type AppHostInput<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TSession extends SessionShape = SessionShape, TApplicationError = never, TApplicationRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & ((AppDatabaseOptions<TMigrations> & {
|
|
11
|
+
readonly application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>, TApplicationError, TApplicationRequirements>;
|
|
12
|
+
}) | AppHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession, TPreflight, TPreflightError, TPreflightRequirements> | AppLocalHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TPreflight, TPreflightError, TPreflightRequirements> | AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession, TPreflight, TPreflightError, TPreflightRequirements>);
|
|
13
|
+
//# sourceMappingURL=AppHostInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppHostInput.d.ts","sourceRoot":"","sources":["../../src/server/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,oBAAoB,CAAC;AACtH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;A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B,CACnB,KAAK,EACL,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,UAAU,EACV,eAAe,EACf,sBAAsB,CACrB,GACD,kBAAkB,CAClB,KAAK,EACL,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,eAAe,EACf,sBAAsB,CACrB,CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppHostInput.js","sourceRoot":"","sources":["../../src/server/AppHostInput.ts"],"names":[],"mappings":""}
|
package/dist/server/appHost.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Context, type Effect } from "effect";
|
|
1
|
+
import { Context, type Effect, Layer } from "effect";
|
|
2
2
|
import type { Rpc } from "effect/rpc";
|
|
3
|
-
import {
|
|
3
|
+
import type { AppHostFactory } from "#server/AppHostFactory.ts";
|
|
4
|
+
import type { HostPreflight } from "#server/AppHostInput.ts";
|
|
4
5
|
import { type DatabaseConfig } from "#server/databaseLayer.ts";
|
|
5
6
|
import type { HostOptions, HostPolicy } from "#server/hostOptions.ts";
|
|
6
7
|
import type { MigrationOptions } from "#server/MigrationOptions.ts";
|
|
@@ -27,23 +28,20 @@ export interface AppDatabaseOptions<R = never> {
|
|
|
27
28
|
readonly config?: DatabaseConfig;
|
|
28
29
|
readonly migrations: MigrationOptions<R>;
|
|
29
30
|
}
|
|
30
|
-
export declare function appDatabase<R>(options: AppDatabaseOptions<R>):
|
|
31
|
-
export type AppHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TSession extends SessionShape = SessionShape> = HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & {
|
|
31
|
+
export declare function appDatabase<R>(options: AppDatabaseOptions<R>): Layer.Layer<AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient, import("effect/Config").ConfigError | import("effect/sql/Migrator").MigrationError | import("effect/sql/SqlError").SqlError, Exclude<Exclude<R, import("effect/Scope").Scope>, import("@effect/sql-pg/PgClient").PgClient | import("effect/sql/SqlClient").SqlClient>>;
|
|
32
|
+
export type AppHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TSession extends SessionShape = SessionShape, TPreflight = never, TPreflightError = never, TPreflightRequirements = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & {
|
|
32
33
|
readonly migrations: AppDatabaseOptions<TMigrations>["migrations"];
|
|
33
34
|
readonly policy?: undefined;
|
|
34
35
|
readonly sessions: SessionPolicy<TSession>;
|
|
35
36
|
};
|
|
36
|
-
export type AppLocalHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never> = HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & {
|
|
37
|
+
export type AppLocalHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & {
|
|
37
38
|
readonly migrations: AppDatabaseOptions<TMigrations>["migrations"];
|
|
38
39
|
readonly policy: "loopback";
|
|
39
40
|
readonly sessions?: never;
|
|
40
41
|
};
|
|
41
|
-
export type AppHttpHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TSession extends SessionShape = SessionShape> = HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostPolicy<TSession> & {
|
|
42
|
+
export type AppHttpHostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TSession extends SessionShape = SessionShape, TPreflight = never, TPreflightError = never, TPreflightRequirements = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostPolicy<TSession> & {
|
|
42
43
|
readonly migrations?: undefined;
|
|
43
44
|
};
|
|
44
|
-
export declare
|
|
45
|
-
readonly application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>, TApplicationError, TApplicationRequirements>;
|
|
46
|
-
}) | AppHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession> | AppLocalHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations>): ReturnType<typeof deferredHost<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession, TApplicationError, TApplicationRequirements>>;
|
|
47
|
-
export declare function appHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TSession extends SessionShape = SessionShape>(options: AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>): ReturnType<typeof appHostHttp<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>>;
|
|
45
|
+
export declare const appHost: AppHostFactory;
|
|
48
46
|
export {};
|
|
49
47
|
//# sourceMappingURL=appHost.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appHost.d.ts","sourceRoot":"","sources":["../../src/server/appHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"appHost.d.ts","sourceRoot":"","sources":["../../src/server/appHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,KAAK,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;;;;;;;;;;;;;;;;;AAEjF,qBAAa,UAAW,SAAQ,eAAsG;CAAG;AACzI,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,KAAK;IAC5C,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;CACzC;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,8aAE5D;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,G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B,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,KAAK,EACrB,oBAAoB,GAAG,KAAK,EAC5B,QAAQ,SAAS,YAAY,GAAG,YAAY,EAC5C,UAAU,GAAG,KAAK,EAClB,eAAe,GAAG,KAAK,EACvB,sBAAsB,GAAG,KAAK,IAC3B,aAAa,CAAC,UAAU,EAAE,eAAe,EAAE,sBAAsB,CAAC,GACrE,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,CAAC,GAClH,UAAU,CAAC,QAAQ,CAAC,GAAG;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAC5D,eAAO,MAAM,OAAO,EAAE,cAyCrB,CAAC"}
|
package/dist/server/appHost.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
1
|
+
import { Context, Layer } from "effect";
|
|
2
2
|
import { appHostHttp, deferredHost, migratedHost } from "#server/appHostHttp.ts";
|
|
3
3
|
import { databaseLayer } from "#server/databaseLayer.ts";
|
|
4
4
|
export class AppChanges extends Context.Service()("@shivaedev/platform/AppChanges") {
|
|
@@ -6,12 +6,12 @@ export class AppChanges extends Context.Service()("@shivaedev/platform/AppChange
|
|
|
6
6
|
export function appDatabase(options) {
|
|
7
7
|
return databaseLayer(options, AppChanges);
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export const appHost = (options) => {
|
|
10
10
|
if ("application" in options) {
|
|
11
|
-
return deferredHost(options.application, appDatabase(options));
|
|
11
|
+
return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(options.preflight ?? Layer.empty));
|
|
12
12
|
}
|
|
13
13
|
return options.migrations === undefined
|
|
14
|
-
? appHostHttp(options)
|
|
15
|
-
: migratedHost({ ...options, migrations: options.migrations }, appDatabase({ ...options, migrations: options.migrations }));
|
|
16
|
-
}
|
|
14
|
+
? appHostHttp(options).pipe(Layer.provideMerge(options.preflight ?? Layer.empty))
|
|
15
|
+
: migratedHost({ ...options, migrations: options.migrations }, appDatabase({ ...options, migrations: options.migrations })).pipe(Layer.provideMerge(options.preflight ?? Layer.empty));
|
|
16
|
+
};
|
|
17
17
|
//# sourceMappingURL=appHost.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appHost.js","sourceRoot":"","sources":["../../src/server/appHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"appHost.js","sourceRoot":"","sources":["../../src/server/appHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,KAAK,EAAE,MAAM,QAAQ,CAAC;AAKrD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAuB,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9E,MAAM,OAAO,UAAW,SAAQ,OAAO,CAAC,OAAO,EAAqD,CAAC,gCAAgC,CAAC;CAAG;AAMzI,MAAM,UAAU,WAAW,CAAI,OAA8B;IAC5D,OAAO,aAAa,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AAC3C,CAAC;AAwDD,MAAM,CAAC,MAAM,OAAO,GAAmB,CAgBtC,OAeC,EACA,EAAE;IACH,IAAI,aAAa,IAAI,OAAO,EAAE,CAAC;QAC9B,OAAO,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3H,CAAC;IACD,OAAO,OAAO,CAAC,UAAU,KAAK,SAAS;QACtC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;QACjF,CAAC,CAAC,YAAY,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,WAAW,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAC9H,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC,CACpD,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -3,11 +3,14 @@ import { Config, Effect, Layer } from "effect";
|
|
|
3
3
|
import { HttpRouter } from "effect/http";
|
|
4
4
|
import { type Rpc, RpcSerialization } from "effect/rpc";
|
|
5
5
|
import type { RequestTracing } from "#rpc/middleware.ts";
|
|
6
|
-
import type {
|
|
6
|
+
import type { AppHttpHostOptions } from "#server/appHost.ts";
|
|
7
7
|
import type { databaseLayer } from "#server/databaseLayer.ts";
|
|
8
8
|
import type { HostOptions, HostPolicy } from "#server/hostOptions.ts";
|
|
9
|
+
import type { MigrationOptions } from "#server/MigrationOptions.ts";
|
|
9
10
|
import { type SessionShape } from "#server/rpc-server/session.ts";
|
|
10
11
|
export declare function appHostHttp<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession extends SessionShape>(options: HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostPolicy<TSession>): Layer.Layer<TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices, TServiceError | Config.ConfigError | import("effect/PlatformError").PlatformError | import("effect/http/HttpServerError").ServeError | HttpRouter.Request.Without<THandlerError>, Exclude<Exclude<Exclude<TServiceRequirements, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<import("effect/FileSystem").FileSystem, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpServer").HttpServer, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<import("effect/Path").Path, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>>;
|
|
11
|
-
export declare function migratedHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession extends SessionShape>(options: AppHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession> | AppLocalHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations>, database: ReturnType<typeof databaseLayer<TMigrations>>): Layer.Layer<TServices | import("#server/appHost.ts").AppChanges | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | NodeServices.NodeServices, TServiceError | Config.ConfigError | import("effect/sql/Migrator").MigrationError | import("effect/PlatformError").PlatformError | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | HttpRouter.Request.Without<THandlerError>, Exclude<Exclude<Exclude<Exclude<TServiceRequirements, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<import("effect/FileSystem").FileSystem, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpServer").HttpServer, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<import("effect/Path").Path, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, import("@effect/sql-pg/PgClient").PgClient | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>>;
|
|
12
|
+
export declare function migratedHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession extends SessionShape>(options: HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostPolicy<TSession> & {
|
|
13
|
+
readonly migrations: MigrationOptions<TMigrations>;
|
|
14
|
+
}, database: ReturnType<typeof databaseLayer<TMigrations>>): Layer.Layer<TServices | import("#server/appHost.ts").AppChanges | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | NodeServices.NodeServices, TServiceError | Config.ConfigError | import("effect/sql/Migrator").MigrationError | import("effect/PlatformError").PlatformError | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | HttpRouter.Request.Without<THandlerError>, Exclude<Exclude<Exclude<Exclude<TServiceRequirements, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<import("effect/FileSystem").FileSystem, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpServer").HttpServer, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<import("effect/Path").Path, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, import("@effect/sql-pg/PgClient").PgClient | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices | import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>>;
|
|
12
15
|
export declare function deferredHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession extends SessionShape, TApplicationError, TApplicationRequirements>(application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>, TApplicationError, TApplicationRequirements>, database: ReturnType<typeof databaseLayer<TMigrations>>): Layer.Layer<TServices | import("#server/appHost.ts").AppChanges | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | NodeServices.NodeServices, TApplicationError | TServiceError | Config.ConfigError | import("effect/sql/Migrator").MigrationError | import("effect/PlatformError").PlatformError | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | HttpRouter.Request.Without<THandlerError>, Exclude<Exclude<TApplicationRequirements, import("effect/Scope").Scope>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, import("@effect/sql-pg/PgClient").PgClient | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<TServiceRequirements, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/FileSystem").FileSystem, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpServer").HttpServer, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/Path").Path, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.GlobalProvided>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<THandlerRequirements, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<TRpcs, typeof RequestTracing>>, import("effect/Scope").Scope>, THandlers | RequestTracing>, RpcSerialization.RpcSerialization>>, HttpRouter.HttpRouter>, TServices>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | NodeServices.NodeServices>, NodeServices.NodeServices>, never>, import("#server/appHost.ts").AppChanges | import("@effect/sql-pg/PgClient").PgClient | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>>;
|
|
13
16
|
//# sourceMappingURL=appHostHttp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appHostHttp.d.ts","sourceRoot":"","sources":["../../src/server/appHostHttp.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAY,MAAM,EAAE,MAAM,EAAE,KAAK,EAAkB,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAuB,UAAU,EAAuC,MAAM,aAAa,CAAC;AACnG,OAAO,EAAE,KAAK,GAAG,EAAE,gBAAgB,EAAa,MAAM,YAAY,CAAC;AACnE,OAAO,KAAK,EAAqC,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"appHostHttp.d.ts","sourceRoot":"","sources":["../../src/server/appHostHttp.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAY,MAAM,EAAE,MAAM,EAAE,KAAK,EAAkB,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAuB,UAAU,EAAuC,MAAM,aAAa,CAAC;AACnG,OAAO,EAAE,KAAK,GAAG,EAAE,gBAAgB,EAAa,MAAM,YAAY,CAAC;AACnE,OAAO,KAAK,EAAqC,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAGpE,OAAO,EAA+C,KAAK,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAI/G,wBAAgB,WAAW,CAC1B,KAAK,SAAS,GAAG,CAAC,GAAG,EACrB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aA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ect application infrastructure for ShivaeDev services",
|
|
5
5
|
"homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/platform#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"@shivaedev/effect-prisma": "0.10.0",
|
|
58
58
|
"@shivaedev/effect-test-sql": "0.5.5",
|
|
59
59
|
"@shivaedev/effect-trpc": "0.8.0",
|
|
60
|
-
"@shivaedev/quality": "0.
|
|
61
|
-
"@shivaedev/test-story": "0.
|
|
60
|
+
"@shivaedev/quality": "0.27.0",
|
|
61
|
+
"@shivaedev/test-story": "0.9.0",
|
|
62
62
|
"@trpc/client": "11.19.0",
|
|
63
63
|
"@trpc/server": "11.19.0",
|
|
64
64
|
"@types/node": "24.19.2",
|
package/src/rpc/requireAdmin.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { Effect
|
|
2
|
-
import { Forbidden
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { Forbidden } from "#errors/taxonomy.ts";
|
|
3
3
|
import { SessionUser, type SessionUserValue } from "./identity.ts";
|
|
4
4
|
|
|
5
|
-
export const requireAdmin: Effect.Effect<SessionUserValue,
|
|
6
|
-
const user = yield*
|
|
7
|
-
if (
|
|
8
|
-
return yield* new Unauthorized({ message: "Authentication required" });
|
|
9
|
-
}
|
|
10
|
-
if (!user.value.role?.split(",").includes("admin")) {
|
|
5
|
+
export const requireAdmin: Effect.Effect<SessionUserValue, Forbidden, SessionUser> = Effect.gen(function* () {
|
|
6
|
+
const user = yield* SessionUser;
|
|
7
|
+
if (!user.role?.split(",").includes("admin")) {
|
|
11
8
|
return yield* new Forbidden({ message: "Administrator role required" });
|
|
12
9
|
}
|
|
13
|
-
return user
|
|
10
|
+
return user;
|
|
14
11
|
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { Effect, Layer } from "effect";
|
|
2
|
+
import type { Rpc } from "effect/rpc";
|
|
3
|
+
import type { HostPreflight } from "#server/AppHostInput.ts";
|
|
4
|
+
import type { AppDatabaseOptions, AppHostOptions, AppHttpHostOptions, AppLocalHostOptions } from "#server/appHost.ts";
|
|
5
|
+
import type { appHostHttp, deferredHost } from "#server/appHostHttp.ts";
|
|
6
|
+
import type { SessionShape } from "#server/rpc-server/session.ts";
|
|
7
|
+
|
|
8
|
+
type PreflightHost<THost extends Layer.Any, TServices, TError, TRequirements> = Layer.Layer<
|
|
9
|
+
Layer.Success<THost> | TServices,
|
|
10
|
+
Layer.Error<THost> | TError,
|
|
11
|
+
Exclude<Layer.Services<THost>, TServices> | TRequirements
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
export interface AppHostFactory {
|
|
15
|
+
<
|
|
16
|
+
TRpcs extends Rpc.Any,
|
|
17
|
+
THandlers,
|
|
18
|
+
THandlerError,
|
|
19
|
+
THandlerRequirements,
|
|
20
|
+
TServices = never,
|
|
21
|
+
TServiceError = never,
|
|
22
|
+
TServiceRequirements = never,
|
|
23
|
+
TMigrations = never,
|
|
24
|
+
TSession extends SessionShape = SessionShape,
|
|
25
|
+
TApplicationError = never,
|
|
26
|
+
TApplicationRequirements = never,
|
|
27
|
+
TPreflight = never,
|
|
28
|
+
TPreflightError = never,
|
|
29
|
+
TPreflightRequirements = never,
|
|
30
|
+
>(
|
|
31
|
+
options: HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> &
|
|
32
|
+
(
|
|
33
|
+
| (AppDatabaseOptions<TMigrations> & {
|
|
34
|
+
readonly application: Effect.Effect<
|
|
35
|
+
AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>,
|
|
36
|
+
TApplicationError,
|
|
37
|
+
TApplicationRequirements
|
|
38
|
+
>;
|
|
39
|
+
})
|
|
40
|
+
| AppHostOptions<
|
|
41
|
+
TRpcs,
|
|
42
|
+
THandlers,
|
|
43
|
+
THandlerError,
|
|
44
|
+
THandlerRequirements,
|
|
45
|
+
TServices,
|
|
46
|
+
TServiceError,
|
|
47
|
+
TServiceRequirements,
|
|
48
|
+
TMigrations,
|
|
49
|
+
TSession,
|
|
50
|
+
TPreflight,
|
|
51
|
+
TPreflightError,
|
|
52
|
+
TPreflightRequirements
|
|
53
|
+
>
|
|
54
|
+
| AppLocalHostOptions<
|
|
55
|
+
TRpcs,
|
|
56
|
+
THandlers,
|
|
57
|
+
THandlerError,
|
|
58
|
+
THandlerRequirements,
|
|
59
|
+
TServices,
|
|
60
|
+
TServiceError,
|
|
61
|
+
TServiceRequirements,
|
|
62
|
+
TMigrations,
|
|
63
|
+
TPreflight,
|
|
64
|
+
TPreflightError,
|
|
65
|
+
TPreflightRequirements
|
|
66
|
+
>
|
|
67
|
+
),
|
|
68
|
+
): PreflightHost<
|
|
69
|
+
ReturnType<
|
|
70
|
+
typeof deferredHost<
|
|
71
|
+
TRpcs,
|
|
72
|
+
THandlers,
|
|
73
|
+
THandlerError,
|
|
74
|
+
THandlerRequirements,
|
|
75
|
+
TServices,
|
|
76
|
+
TServiceError,
|
|
77
|
+
TServiceRequirements,
|
|
78
|
+
TMigrations,
|
|
79
|
+
TSession,
|
|
80
|
+
TApplicationError,
|
|
81
|
+
TApplicationRequirements
|
|
82
|
+
>
|
|
83
|
+
>,
|
|
84
|
+
NoInfer<TPreflight>,
|
|
85
|
+
NoInfer<TPreflightError>,
|
|
86
|
+
NoInfer<TPreflightRequirements>
|
|
87
|
+
>;
|
|
88
|
+
|
|
89
|
+
<
|
|
90
|
+
TRpcs extends Rpc.Any,
|
|
91
|
+
THandlers,
|
|
92
|
+
THandlerError,
|
|
93
|
+
THandlerRequirements,
|
|
94
|
+
TServices = never,
|
|
95
|
+
TServiceError = never,
|
|
96
|
+
TServiceRequirements = never,
|
|
97
|
+
TSession extends SessionShape = SessionShape,
|
|
98
|
+
TPreflight = never,
|
|
99
|
+
TPreflightError = never,
|
|
100
|
+
TPreflightRequirements = never,
|
|
101
|
+
>(
|
|
102
|
+
options: AppHttpHostOptions<
|
|
103
|
+
TRpcs,
|
|
104
|
+
THandlers,
|
|
105
|
+
THandlerError,
|
|
106
|
+
THandlerRequirements,
|
|
107
|
+
TServices,
|
|
108
|
+
TServiceError,
|
|
109
|
+
TServiceRequirements,
|
|
110
|
+
TSession,
|
|
111
|
+
TPreflight,
|
|
112
|
+
TPreflightError,
|
|
113
|
+
TPreflightRequirements
|
|
114
|
+
>,
|
|
115
|
+
): PreflightHost<
|
|
116
|
+
ReturnType<typeof appHostHttp<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>>,
|
|
117
|
+
NoInfer<TPreflight>,
|
|
118
|
+
NoInfer<TPreflightError>,
|
|
119
|
+
NoInfer<TPreflightRequirements>
|
|
120
|
+
>;
|
|
121
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Effect, Layer } from "effect";
|
|
2
|
+
import type { Rpc } from "effect/rpc";
|
|
3
|
+
import type { AppDatabaseOptions, AppHostOptions, AppHttpHostOptions, AppLocalHostOptions } from "#server/appHost.ts";
|
|
4
|
+
import type { SessionShape } from "#server/rpc-server/session.ts";
|
|
5
|
+
|
|
6
|
+
export type HostPreflight<TServices = never, TError = never, TRequirements = never> =
|
|
7
|
+
| { readonly preflight: Layer.Layer<TServices, TError, TRequirements> }
|
|
8
|
+
| ([TServices | TError | TRequirements] extends [never] ? { readonly preflight?: never } : never);
|
|
9
|
+
|
|
10
|
+
export type AppHostInput<
|
|
11
|
+
TRpcs extends Rpc.Any,
|
|
12
|
+
THandlers,
|
|
13
|
+
THandlerError,
|
|
14
|
+
THandlerRequirements,
|
|
15
|
+
TServices = never,
|
|
16
|
+
TServiceError = never,
|
|
17
|
+
TServiceRequirements = never,
|
|
18
|
+
TMigrations = never,
|
|
19
|
+
TSession extends SessionShape = SessionShape,
|
|
20
|
+
TApplicationError = never,
|
|
21
|
+
TApplicationRequirements = never,
|
|
22
|
+
TPreflight = never,
|
|
23
|
+
TPreflightError = never,
|
|
24
|
+
TPreflightRequirements = never,
|
|
25
|
+
> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> &
|
|
26
|
+
(
|
|
27
|
+
| (AppDatabaseOptions<TMigrations> & {
|
|
28
|
+
readonly application: Effect.Effect<
|
|
29
|
+
AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>,
|
|
30
|
+
TApplicationError,
|
|
31
|
+
TApplicationRequirements
|
|
32
|
+
>;
|
|
33
|
+
})
|
|
34
|
+
| AppHostOptions<
|
|
35
|
+
TRpcs,
|
|
36
|
+
THandlers,
|
|
37
|
+
THandlerError,
|
|
38
|
+
THandlerRequirements,
|
|
39
|
+
TServices,
|
|
40
|
+
TServiceError,
|
|
41
|
+
TServiceRequirements,
|
|
42
|
+
TMigrations,
|
|
43
|
+
TSession,
|
|
44
|
+
TPreflight,
|
|
45
|
+
TPreflightError,
|
|
46
|
+
TPreflightRequirements
|
|
47
|
+
>
|
|
48
|
+
| AppLocalHostOptions<
|
|
49
|
+
TRpcs,
|
|
50
|
+
THandlers,
|
|
51
|
+
THandlerError,
|
|
52
|
+
THandlerRequirements,
|
|
53
|
+
TServices,
|
|
54
|
+
TServiceError,
|
|
55
|
+
TServiceRequirements,
|
|
56
|
+
TMigrations,
|
|
57
|
+
TPreflight,
|
|
58
|
+
TPreflightError,
|
|
59
|
+
TPreflightRequirements
|
|
60
|
+
>
|
|
61
|
+
| AppHttpHostOptions<
|
|
62
|
+
TRpcs,
|
|
63
|
+
THandlers,
|
|
64
|
+
THandlerError,
|
|
65
|
+
THandlerRequirements,
|
|
66
|
+
TServices,
|
|
67
|
+
TServiceError,
|
|
68
|
+
TServiceRequirements,
|
|
69
|
+
TSession,
|
|
70
|
+
TPreflight,
|
|
71
|
+
TPreflightError,
|
|
72
|
+
TPreflightRequirements
|
|
73
|
+
>
|
|
74
|
+
);
|
package/src/server/appHost.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Context, type Effect } from "effect";
|
|
1
|
+
import { Context, type Effect, Layer } from "effect";
|
|
2
2
|
import type { Rpc } from "effect/rpc";
|
|
3
3
|
import type { makeLiveServer } from "@shivaedev/effect-contract/makeLiveServer.ts";
|
|
4
|
+
import type { AppHostFactory } from "#server/AppHostFactory.ts";
|
|
5
|
+
import type { AppHostInput, HostPreflight } from "#server/AppHostInput.ts";
|
|
4
6
|
import { appHostHttp, deferredHost, migratedHost } from "#server/appHostHttp.ts";
|
|
5
7
|
import { type DatabaseConfig, databaseLayer } from "#server/databaseLayer.ts";
|
|
6
8
|
import type { HostOptions, HostPolicy } from "#server/hostOptions.ts";
|
|
@@ -27,11 +29,15 @@ export type AppHostOptions<
|
|
|
27
29
|
TServiceRequirements = never,
|
|
28
30
|
TMigrations = never,
|
|
29
31
|
TSession extends SessionShape = SessionShape,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
TPreflight = never,
|
|
33
|
+
TPreflightError = never,
|
|
34
|
+
TPreflightRequirements = never,
|
|
35
|
+
> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> &
|
|
36
|
+
HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & {
|
|
37
|
+
readonly migrations: AppDatabaseOptions<TMigrations>["migrations"];
|
|
38
|
+
readonly policy?: undefined;
|
|
39
|
+
readonly sessions: SessionPolicy<TSession>;
|
|
40
|
+
};
|
|
35
41
|
|
|
36
42
|
export type AppLocalHostOptions<
|
|
37
43
|
TRpcs extends Rpc.Any,
|
|
@@ -42,11 +48,15 @@ export type AppLocalHostOptions<
|
|
|
42
48
|
TServiceError = never,
|
|
43
49
|
TServiceRequirements = never,
|
|
44
50
|
TMigrations = never,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
TPreflight = never,
|
|
52
|
+
TPreflightError = never,
|
|
53
|
+
TPreflightRequirements = never,
|
|
54
|
+
> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> &
|
|
55
|
+
HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & {
|
|
56
|
+
readonly migrations: AppDatabaseOptions<TMigrations>["migrations"];
|
|
57
|
+
readonly policy: "loopback";
|
|
58
|
+
readonly sessions?: never;
|
|
59
|
+
};
|
|
50
60
|
|
|
51
61
|
export type AppHttpHostOptions<
|
|
52
62
|
TRpcs extends Rpc.Any,
|
|
@@ -57,10 +67,13 @@ export type AppHttpHostOptions<
|
|
|
57
67
|
TServiceError = never,
|
|
58
68
|
TServiceRequirements = never,
|
|
59
69
|
TSession extends SessionShape = SessionShape,
|
|
60
|
-
|
|
70
|
+
TPreflight = never,
|
|
71
|
+
TPreflightError = never,
|
|
72
|
+
TPreflightRequirements = never,
|
|
73
|
+
> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> &
|
|
74
|
+
HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> &
|
|
61
75
|
HostPolicy<TSession> & { readonly migrations?: undefined };
|
|
62
|
-
|
|
63
|
-
export function appHost<
|
|
76
|
+
export const appHost: AppHostFactory = <
|
|
64
77
|
TRpcs extends Rpc.Any,
|
|
65
78
|
THandlers,
|
|
66
79
|
THandlerError,
|
|
@@ -72,19 +85,11 @@ export function appHost<
|
|
|
72
85
|
TSession extends SessionShape = SessionShape,
|
|
73
86
|
TApplicationError = never,
|
|
74
87
|
TApplicationRequirements = never,
|
|
88
|
+
TPreflight = never,
|
|
89
|
+
TPreflightError = never,
|
|
90
|
+
TPreflightRequirements = never,
|
|
75
91
|
>(
|
|
76
|
-
options:
|
|
77
|
-
| (AppDatabaseOptions<TMigrations> & {
|
|
78
|
-
readonly application: Effect.Effect<
|
|
79
|
-
AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>,
|
|
80
|
-
TApplicationError,
|
|
81
|
-
TApplicationRequirements
|
|
82
|
-
>;
|
|
83
|
-
})
|
|
84
|
-
| AppHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession>
|
|
85
|
-
| AppLocalHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations>,
|
|
86
|
-
): ReturnType<
|
|
87
|
-
typeof deferredHost<
|
|
92
|
+
options: AppHostInput<
|
|
88
93
|
TRpcs,
|
|
89
94
|
THandlers,
|
|
90
95
|
THandlerError,
|
|
@@ -95,51 +100,18 @@ export function appHost<
|
|
|
95
100
|
TMigrations,
|
|
96
101
|
TSession,
|
|
97
102
|
TApplicationError,
|
|
98
|
-
TApplicationRequirements
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
THandlers,
|
|
105
|
-
THandlerError,
|
|
106
|
-
THandlerRequirements,
|
|
107
|
-
TServices = never,
|
|
108
|
-
TServiceError = never,
|
|
109
|
-
TServiceRequirements = never,
|
|
110
|
-
TSession extends SessionShape = SessionShape,
|
|
111
|
-
>(
|
|
112
|
-
options: AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>,
|
|
113
|
-
): ReturnType<typeof appHostHttp<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>>;
|
|
114
|
-
export function appHost<
|
|
115
|
-
TRpcs extends Rpc.Any,
|
|
116
|
-
THandlers,
|
|
117
|
-
THandlerError,
|
|
118
|
-
THandlerRequirements,
|
|
119
|
-
TServices = never,
|
|
120
|
-
TServiceError = never,
|
|
121
|
-
TServiceRequirements = never,
|
|
122
|
-
TMigrations = never,
|
|
123
|
-
TSession extends SessionShape = SessionShape,
|
|
124
|
-
TApplicationError = never,
|
|
125
|
-
TApplicationRequirements = never,
|
|
126
|
-
>(
|
|
127
|
-
options:
|
|
128
|
-
| (AppDatabaseOptions<TMigrations> & {
|
|
129
|
-
readonly application: Effect.Effect<
|
|
130
|
-
AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>,
|
|
131
|
-
TApplicationError,
|
|
132
|
-
TApplicationRequirements
|
|
133
|
-
>;
|
|
134
|
-
})
|
|
135
|
-
| AppHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TSession>
|
|
136
|
-
| AppLocalHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations>
|
|
137
|
-
| AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TSession>,
|
|
138
|
-
) {
|
|
103
|
+
TApplicationRequirements,
|
|
104
|
+
TPreflight,
|
|
105
|
+
TPreflightError,
|
|
106
|
+
TPreflightRequirements
|
|
107
|
+
>,
|
|
108
|
+
) => {
|
|
139
109
|
if ("application" in options) {
|
|
140
|
-
return deferredHost(options.application, appDatabase(options));
|
|
110
|
+
return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(options.preflight ?? Layer.empty));
|
|
141
111
|
}
|
|
142
112
|
return options.migrations === undefined
|
|
143
|
-
? appHostHttp(options)
|
|
144
|
-
: migratedHost({ ...options, migrations: options.migrations }, appDatabase({ ...options, migrations: options.migrations }))
|
|
145
|
-
|
|
113
|
+
? appHostHttp(options).pipe(Layer.provideMerge(options.preflight ?? Layer.empty))
|
|
114
|
+
: migratedHost({ ...options, migrations: options.migrations }, appDatabase({ ...options, migrations: options.migrations })).pipe(
|
|
115
|
+
Layer.provideMerge(options.preflight ?? Layer.empty),
|
|
116
|
+
);
|
|
117
|
+
};
|
|
@@ -4,11 +4,12 @@ import { ByteSize, Config, Effect, Layer, Option, Schema } from "effect";
|
|
|
4
4
|
import { HttpIncomingMessage, HttpRouter, HttpServerRequest, HttpStaticServer } from "effect/http";
|
|
5
5
|
import { type Rpc, RpcSerialization, RpcServer } from "effect/rpc";
|
|
6
6
|
import type { Authenticated, MaybeAuthenticated, RequestTracing } from "#rpc/middleware.ts";
|
|
7
|
-
import type {
|
|
7
|
+
import type { AppHttpHostOptions } from "#server/appHost.ts";
|
|
8
8
|
import { boundedRpcRequest } from "#server/boundedRpcRequest.ts";
|
|
9
9
|
import type { databaseLayer } from "#server/databaseLayer.ts";
|
|
10
10
|
import { healthRoute } from "#server/healthRoute.ts";
|
|
11
11
|
import type { HostOptions, HostPolicy } from "#server/hostOptions.ts";
|
|
12
|
+
import type { MigrationOptions } from "#server/MigrationOptions.ts";
|
|
12
13
|
import { otlpTracing } from "#server/otlpTracing.ts";
|
|
13
14
|
import { localRpcGuard } from "#server/rpc-server/local.ts";
|
|
14
15
|
import { authenticatedLayer, maybeAuthenticatedLayer, type SessionShape } from "#server/rpc-server/session.ts";
|
|
@@ -96,9 +97,8 @@ export function migratedHost<
|
|
|
96
97
|
TMigrations,
|
|
97
98
|
TSession extends SessionShape,
|
|
98
99
|
>(
|
|
99
|
-
options:
|
|
100
|
-
|
|
101
|
-
| AppLocalHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations>,
|
|
100
|
+
options: HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> &
|
|
101
|
+
HostPolicy<TSession> & { readonly migrations: MigrationOptions<TMigrations> },
|
|
102
102
|
database: ReturnType<typeof databaseLayer<TMigrations>>,
|
|
103
103
|
) {
|
|
104
104
|
const services = Layer.mergeAll(options.services ?? Layer.empty);
|