@shivaedev/server 0.26.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +8 -4
- package/dist/AppHostFactory.d.ts +3 -3
- package/dist/AppHostFactory.d.ts.map +1 -1
- package/dist/AppHostInput.d.ts +7 -5
- package/dist/AppHostInput.d.ts.map +1 -1
- package/dist/AppModule.d.ts +1 -0
- package/dist/AppModule.d.ts.map +1 -1
- package/dist/appDatabase.d.ts +3 -2
- package/dist/appDatabase.d.ts.map +1 -1
- package/dist/appDatabase.js +9 -8
- package/dist/appDatabase.js.map +1 -1
- package/dist/appDatabaseHttp.d.ts +123 -87
- package/dist/appDatabaseHttp.d.ts.map +1 -1
- package/dist/appDatabaseHttp.js.map +1 -1
- package/dist/appHost.d.ts +63 -45
- package/dist/appHost.d.ts.map +1 -1
- package/dist/appHost.js.map +1 -1
- package/dist/appHostHttp.d.ts +61 -43
- package/dist/appHostHttp.d.ts.map +1 -1
- package/dist/appHostHttp.js.map +1 -1
- package/dist/appModules.d.ts +8 -2
- package/dist/appModules.d.ts.map +1 -1
- package/dist/appModules.js +1 -0
- package/dist/appModules.js.map +1 -1
- package/dist/hostChanges.d.ts.map +1 -1
- package/dist/hostChanges.js +4 -3
- package/dist/hostChanges.js.map +1 -1
- package/dist/hostOptions.d.ts +3 -2
- package/dist/hostOptions.d.ts.map +1 -1
- package/dist/hostPreflight.d.ts +5 -2
- package/dist/hostPreflight.d.ts.map +1 -1
- package/dist/hostPreflight.js.map +1 -1
- package/dist/hostRpc.d.ts +17 -8
- package/dist/hostRpc.d.ts.map +1 -1
- package/dist/hostRpc.js +11 -5
- package/dist/hostRpc.js.map +1 -1
- package/dist/hostRpcRoutes.d.ts +24 -16
- package/dist/hostRpcRoutes.d.ts.map +1 -1
- package/dist/hostRpcRoutes.js +3 -4
- package/dist/hostRpcRoutes.js.map +1 -1
- package/dist/prepareMigrations.js +2 -2
- package/dist/prepareMigrations.js.map +1 -1
- package/dist/requestServices.d.ts +18 -0
- package/dist/requestServices.d.ts.map +1 -0
- package/dist/requestServices.js +2 -0
- package/dist/requestServices.js.map +1 -0
- package/dist/workerHost.d.ts +1 -1
- package/dist/workerHost.d.ts.map +1 -1
- package/package.json +26 -25
- package/src/AppHostFactory.ts +16 -4
- package/src/AppHostInput.ts +38 -42
- package/src/AppModule.ts +1 -0
- package/src/appDatabase.ts +14 -9
- package/src/appDatabaseHttp.ts +10 -2
- package/src/appHost.ts +26 -4
- package/src/appHostHttp.ts +5 -1
- package/src/appModules.ts +12 -2
- package/src/hostChanges.ts +8 -3
- package/src/hostOptions.ts +25 -2
- package/src/hostPreflight.ts +5 -2
- package/src/hostRpc.ts +18 -4
- package/src/hostRpcRoutes.ts +34 -20
- package/src/prepareMigrations.ts +2 -2
- package/src/requestServices.ts +21 -0
package/dist/hostOptions.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { SessionPolicy } from "@shivaedev/identity/server/SessionPolicy.ts"
|
|
|
5
5
|
import type { AssetOptions } from "#AssetOptions.ts";
|
|
6
6
|
import type { BrowserErrorOptions } from "#browserErrorRoute.ts";
|
|
7
7
|
export type HostRouteRequirements = HttpRouter.HttpRouter | HttpRouter.Request<"Error", unknown>;
|
|
8
|
-
export type HostCoreOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> = {
|
|
8
|
+
export type HostCoreOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TRequestServices = never, TRequestRequirements = never> = {
|
|
9
9
|
readonly assets?: string | AssetOptions;
|
|
10
10
|
readonly browserErrors?: BrowserErrorOptions;
|
|
11
11
|
readonly config?: {
|
|
@@ -19,6 +19,7 @@ export type HostCoreOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THa
|
|
|
19
19
|
readonly disablePreemptiveShutdown?: boolean;
|
|
20
20
|
readonly gracefulShutdownTimeout?: Duration.Input;
|
|
21
21
|
};
|
|
22
|
+
readonly requestServices?: Layer.Layer<TRequestServices, never, TRequestRequirements>;
|
|
22
23
|
readonly nativeOrigins?: readonly string[];
|
|
23
24
|
readonly rpcPath?: HttpRouter.PathInput;
|
|
24
25
|
} & ({
|
|
@@ -35,7 +36,7 @@ export type HostCoreOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THa
|
|
|
35
36
|
export interface HostRoutes<TRouteError = never, TRouteRequirements = HostRouteRequirements> {
|
|
36
37
|
readonly routes?: Layer.Layer<never, TRouteError, TRouteRequirements>;
|
|
37
38
|
}
|
|
38
|
-
export type HostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TRouteError = never, TRouteRequirements = HostRouteRequirements> = HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> & HostRoutes<TRouteError, TRouteRequirements>;
|
|
39
|
+
export type HostOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TRouteError = never, TRouteRequirements = HostRouteRequirements, TRequestServices = never, TRequestRequirements = never> = HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TRequestServices, TRequestRequirements> & HostRoutes<TRouteError, TRouteRequirements>;
|
|
39
40
|
export type HostPolicy = {
|
|
40
41
|
readonly policy?: undefined;
|
|
41
42
|
readonly sessions: Layer.Layer<SessionPolicy>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostOptions.d.ts","sourceRoot":"","sources":["../src/hostOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ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|
+
import type * as NodeCrypto from "@effect/platform-node/NodeCrypto";
|
|
2
|
+
import { Effect, Layer } from "effect";
|
|
2
3
|
export type HostPreflight<TServices = never, TError = never, TRequirements = never> = {
|
|
3
4
|
readonly preflight: Layer.Layer<TServices, TError, TRequirements>;
|
|
4
5
|
} | ([TServices | TError | TRequirements] extends [never] ? {
|
|
5
6
|
readonly preflight?: never;
|
|
6
7
|
} : never);
|
|
7
|
-
|
|
8
|
+
type HostCrypto = Layer.Success<typeof NodeCrypto.layer>;
|
|
9
|
+
export type PreflightHost<THost extends Layer.Any, TServices, TError, TRequirements> = Layer.Layer<Layer.Success<THost> | TServices, Layer.Error<THost> | TError, Exclude<Layer.Services<THost>, TServices | HostCrypto> | Exclude<TRequirements, HostCrypto>>;
|
|
8
10
|
export declare function hostPreflight<TServices, TError, TRequirements, TSensitiveError>(startup: Layer.Layer<TServices, TError, TRequirements> | undefined, sensitive: Effect.Effect<(key: string) => boolean, TSensitiveError>): Layer.Layer<TServices, TError | TSensitiveError, Exclude<TRequirements, never>>;
|
|
11
|
+
export {};
|
|
9
12
|
//# sourceMappingURL=hostPreflight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostPreflight.d.ts","sourceRoot":"","sources":["../src/hostPreflight.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"hostPreflight.d.ts","sourceRoot":"","sources":["../src/hostPreflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,UAAU,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAGvC,MAAM,MAAM,aAAa,CAAC,SAAS,GAAG,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,aAAa,GAAG,KAAK,IAC/E;IAAE,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,CAAA;CAAE,GACrE,CAAC,CAAC,SAAS,GAAG,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG,KAAK,CAAC,CAAC;AAEnG,KAAK,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAEzD,MAAM,MAAM,aAAa,CAAC,KAAK,SAAS,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,IAAI,KAAK,CAAC,KAAK,CACjG,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,SAAS,GAAG,UAAU,CAAC,GAAG,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,CAC3F,CAAC;AAEF,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,eAAe,EAC9E,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,SAAS,EAClE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,EAAE,eAAe,CAAC,mFAMnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostPreflight.js","sourceRoot":"","sources":["../src/hostPreflight.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hostPreflight.js","sourceRoot":"","sources":["../src/hostPreflight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAchE,MAAM,UAAU,aAAa,CAC5B,OAAkE,EAClE,SAAmE;IAEnE,OAAO,KAAK,CAAC,QAAQ,CACpB,KAAK,CAAC,KAAK,EACX,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC9I,CAAC;AACH,CAAC"}
|
package/dist/hostRpc.d.ts
CHANGED
|
@@ -1,27 +1,36 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
1
|
+
import { Effect, Layer } from "effect";
|
|
2
2
|
import { type HttpEffect, HttpServerResponse } from "effect/http";
|
|
3
|
-
import { type Rpc, type RpcGroup } from "effect/rpc";
|
|
3
|
+
import { type Rpc, type RpcGroup, RpcMiddleware } from "effect/rpc";
|
|
4
4
|
import { CommandGuard } from "@shivaedev/contract/CommandGuard.ts";
|
|
5
|
+
import type { RequestServices } from "#requestServices.ts";
|
|
5
6
|
export declare const rpcCacheControl: HttpEffect.PreResponseHandler;
|
|
6
|
-
export declare const hostRpc: <R extends Rpc.Any>(group: RpcGroup.RpcGroup<R>, websocket?: boolean | undefined) => Effect.Effect<Effect.Effect<HttpServerResponse.HttpServerResponse, never, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, never, Exclude<
|
|
7
|
+
export declare const hostRpc: <R extends Rpc.Any, TServices = never, TRequirements = never>(group: RpcGroup.RpcGroup<R>, websocket?: boolean | undefined, services?: Layer.Layer<TServices, never, TRequirements> | undefined) => Effect.Effect<Effect.Effect<HttpServerResponse.HttpServerResponse, never, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, never, Exclude<Exclude<Rpc.Handler<"platform.hostVersion.watch">, import("effect/Context").Service.Identifier<R extends {
|
|
7
8
|
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
8
9
|
} ? Extract<TMiddleware, {
|
|
9
10
|
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
10
|
-
}> : never>> | Exclude<import("
|
|
11
|
+
}> : never>>, RequestServices<TServices, TRequirements>> | Exclude<Exclude<import("@shivaedev/identity/middleware.ts").RequestTracing, import("effect/Context").Service.Identifier<R extends {
|
|
11
12
|
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
12
13
|
} ? Extract<TMiddleware, {
|
|
13
14
|
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
14
|
-
}> : never>> | Exclude<Exclude<
|
|
15
|
+
}> : never>>, RequestServices<TServices, TRequirements>> | Exclude<Exclude<import("effect/rpc/RpcSerialization").RpcSerialization, import("effect/Context").Service.Identifier<R extends {
|
|
15
16
|
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
16
17
|
} ? Extract<TMiddleware, {
|
|
17
18
|
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
18
|
-
}> : never>> | Exclude<Exclude<
|
|
19
|
+
}> : never>>, RequestServices<TServices, TRequirements>> | Exclude<Exclude<import("effect/Scope").Scope, import("effect/Context").Service.Identifier<R extends {
|
|
19
20
|
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
20
21
|
} ? Extract<TMiddleware, {
|
|
21
22
|
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
22
|
-
}> : never>> |
|
|
23
|
+
}> : never>>, RequestServices<TServices, TRequirements>> | Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<Rpc.AddMiddleware<Rpc.AddMiddleware<R, RpcMiddleware.ServiceClass<RequestServices<TServices, TRequirements>, "@shivaedev/server/RequestServices", TServices, import("effect/Schema").Never, never, TRequirements, false>>, typeof CommandGuard>, typeof import("@shivaedev/identity/middleware.ts").RequestTracing>>, never>, CommandGuard>, import("effect/Context").Service.Identifier<R extends {
|
|
23
24
|
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
24
25
|
} ? Extract<TMiddleware, {
|
|
25
26
|
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
26
|
-
}> : never
|
|
27
|
+
}> : never>>, RequestServices<TServices, TRequirements>> | Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<Rpc.AddMiddleware<Rpc.AddMiddleware<R, RpcMiddleware.ServiceClass<RequestServices<TServices, TRequirements>, "@shivaedev/server/RequestServices", TServices, import("effect/Schema").Never, never, TRequirements, false>>, typeof CommandGuard>, typeof import("@shivaedev/identity/middleware.ts").RequestTracing>>, never>, CommandGuard>, import("effect/Context").Service.Identifier<R extends {
|
|
28
|
+
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
29
|
+
} ? Extract<TMiddleware, {
|
|
30
|
+
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
31
|
+
}> : never>>, RequestServices<TServices, TRequirements>> | Exclude<Effect.Services<(R extends {
|
|
32
|
+
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
33
|
+
} ? Extract<TMiddleware, {
|
|
34
|
+
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
35
|
+
}> : never)["@shivaedev/contract/SubjectDeclaration"]["middleware"]>, RequestServices<TServices, TRequirements>>>;
|
|
27
36
|
//# sourceMappingURL=hostRpc.d.ts.map
|
package/dist/hostRpc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostRpc.d.ts","sourceRoot":"","sources":["../src/hostRpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"hostRpc.d.ts","sourceRoot":"","sources":["../src/hostRpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,KAAK,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,QAAQ,EAAE,aAAa,EAAa,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAoC,MAAM,qCAAqC,CAAC;AAMrG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG3D,eAAO,MAAM,eAAe,EAAE,UAAU,CAAC,kBACoD,CAAC;AAE9F,eAAO,MAAM,OAAO,GAAgC,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,SAAS,UAAU,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;iHAsBrG,CAAC"}
|
package/dist/hostRpc.js
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
1
|
+
import { Effect, Layer } from "effect";
|
|
2
2
|
import { HttpServerResponse } from "effect/http";
|
|
3
|
-
import { RpcServer } from "effect/rpc";
|
|
3
|
+
import { RpcMiddleware, RpcServer } from "effect/rpc";
|
|
4
4
|
import { CommandGuard, commandGuardLayer, guardCommands } from "@shivaedev/contract/CommandGuard.ts";
|
|
5
|
+
import { HostVersion } from "@shivaedev/contract/HostVersion.ts";
|
|
6
|
+
import { prependMiddleware } from "@shivaedev/contract/prependMiddleware.ts";
|
|
5
7
|
import { ReadPolicyGuard, readPolicyGuardLayer } from "@shivaedev/contract/ReadPolicyGuard.ts";
|
|
6
8
|
import { subjectLayers } from "@shivaedev/contract/subjectLayers.ts";
|
|
7
9
|
import { publishCommand } from "#publishCommand.ts";
|
|
8
10
|
import { tracedGroup } from "#tracedGroup.ts";
|
|
9
11
|
export const rpcCacheControl = (_, response) => Effect.succeed(HttpServerResponse.setHeader(response, "cache-control", "private, no-store"));
|
|
10
|
-
export const hostRpc = Effect.fnUntraced(function* (group, websocket = false) {
|
|
11
|
-
const
|
|
12
|
+
export const hostRpc = Effect.fnUntraced(function* (group, websocket = false, services) {
|
|
13
|
+
const requestsMiddleware = RpcMiddleware.Service()("@shivaedev/server/RequestServices");
|
|
14
|
+
const requestLayer = Layer.mergeAll(services ?? Layer.empty);
|
|
15
|
+
const requested = yield* prependMiddleware(group.middleware(requestsMiddleware), requestsMiddleware.key);
|
|
16
|
+
const requests = yield* prependMiddleware(requested, ReadPolicyGuard.key);
|
|
17
|
+
const guarded = yield* guardCommands(requests.merge(HostVersion.application));
|
|
12
18
|
const traced = tracedGroup(guarded);
|
|
13
19
|
const readPolicy = yield* ReadPolicyGuard.pipe(Effect.provide(readPolicyGuardLayer({ websocket })));
|
|
14
20
|
const publication = yield* CommandGuard.pipe(Effect.provide(commandGuardLayer(publishCommand)));
|
|
15
21
|
const handler = websocket ? RpcServer.toHttpEffectWebsocket(traced) : RpcServer.toHttpEffect(traced);
|
|
16
|
-
return yield* handler.pipe(Effect.provideService(ReadPolicyGuard, readPolicy), Effect.provideService(CommandGuard, publication), Effect.provide(subjectLayers(group)));
|
|
22
|
+
return yield* handler.pipe(Effect.provideService(ReadPolicyGuard, readPolicy), Effect.provideService(CommandGuard, publication), Effect.provide(subjectLayers(group)), Effect.provide(Layer.succeed(requestsMiddleware, (effect) => Effect.provide(effect, requestLayer))));
|
|
17
23
|
});
|
|
18
24
|
//# sourceMappingURL=hostRpc.js.map
|
package/dist/hostRpc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostRpc.js","sourceRoot":"","sources":["../src/hostRpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"hostRpc.js","sourceRoot":"","sources":["../src/hostRp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ivaedev/identity/server/SessionPolicy.ts";
|
|
6
6
|
import type { HostPolicy } from "#hostOptions.ts";
|
|
7
7
|
import type { hostTransport } from "#hostTransport.ts";
|
|
8
|
-
type
|
|
9
|
-
type
|
|
8
|
+
import type { RequestRequirements } from "#requestServices.ts";
|
|
9
|
+
type BuiltRoutes<TRpcs extends Rpc.Any, THandlers, TError, TRequirements, TRequestServices = never, TRequestRequirements = never> = ReturnType<typeof buildRpcRoutes<TRpcs, THandlers, TError, TRequirements, TRequestServices, TRequestRequirements>>;
|
|
10
|
+
type RouteOptions<TRpcs extends Rpc.Any, THandlers, TError, TRequirements, TRequestServices = never, TRequestRequirements = never> = {
|
|
10
11
|
readonly config?: {
|
|
11
12
|
readonly buildVersion?: string;
|
|
12
13
|
};
|
|
13
14
|
readonly group: RpcGroup.RpcGroup<TRpcs>;
|
|
14
15
|
readonly handlers: Layer.Layer<THandlers, TError, TRequirements>;
|
|
16
|
+
readonly requestServices?: Layer.Layer<TRequestServices, never, TRequestRequirements>;
|
|
15
17
|
readonly rpcPath?: HttpRouter.PathInput;
|
|
16
18
|
} & HostPolicy;
|
|
17
|
-
export declare function hostRpcRoutes<TRpcs extends Rpc.Any, THandlers, TError, TRequirements>(options: RouteOptions<TRpcs, THandlers, TError, TRequirements> & {
|
|
19
|
+
export declare function hostRpcRoutes<TRpcs extends Rpc.Any, THandlers, TError, TRequirements, TRequestServices = never, TRequestRequirements = never>(options: RouteOptions<TRpcs, THandlers, TError, TRequirements, TRequestServices, TRequestRequirements> & {
|
|
18
20
|
readonly policy: "loopback";
|
|
19
|
-
}, transport: Effect.Success<ReturnType<typeof hostTransport>>, sensitive: Effect.Success<ReturnType<typeof schemaSensitiveKeys>>): Layer.Layer<Layer.Success<BuiltRoutes<TRpcs, THandlers, TError, TRequirements>>, Layer.Error<BuiltRoutes<TRpcs, THandlers, TError, TRequirements>>, TRequirements | Exclude<Rpc.ServicesServer<TRpcs>, THandlers> | Exclude<Layer.Services<BuiltRoutes<TRpcs, THandlers, TError, TRequirements>>, SessionPolicy | HttpRouter.Request<"Requires", SessionPolicy
|
|
20
|
-
export declare function hostRpcRoutes<TRpcs extends Rpc.Any, THandlers, TError, TRequirements>(...args: Parameters<typeof buildRpcRoutes<TRpcs, THandlers, TError, TRequirements>>): BuiltRoutes<TRpcs, THandlers, TError, TRequirements
|
|
21
|
-
declare function buildRpcRoutes<TRpcs extends Rpc.Any, THandlers, TError, TRequirements>(options: RouteOptions<TRpcs, THandlers, TError, TRequirements>, { bodySize, trustedProxy, nativeOrigins }: Effect.Success<ReturnType<typeof hostTransport>>, sensitive: Effect.Success<ReturnType<typeof schemaSensitiveKeys>>): Layer.Layer<never, TError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies, SessionPolicy | Exclude<Exclude<TRequirements, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
21
|
+
}, transport: Effect.Success<ReturnType<typeof hostTransport>>, sensitive: Effect.Success<ReturnType<typeof schemaSensitiveKeys>>): Layer.Layer<Layer.Success<BuiltRoutes<TRpcs, THandlers, TError, TRequirements, TRequestServices, TRequestRequirements>>, Layer.Error<BuiltRoutes<TRpcs, THandlers, TError, TRequirements, TRequestServices, TRequestRequirements>>, Exclude<TRequirements, TRequestServices> | RequestRequirements<TRpcs, TRequestRequirements> | Exclude<Rpc.ServicesServer<TRpcs>, THandlers> | Exclude<Layer.Services<BuiltRoutes<TRpcs, THandlers, TError, TRequirements, TRequestServices, TRequestRequirements>>, SessionPolicy | HttpRouter.Request<"Requires", SessionPolicy> | TRequestServices | TRequestRequirements>>;
|
|
22
|
+
export declare function hostRpcRoutes<TRpcs extends Rpc.Any, THandlers, TError, TRequirements, TRequestServices = never, TRequestRequirements = never>(...args: Parameters<typeof buildRpcRoutes<TRpcs, THandlers, TError, TRequirements, TRequestServices, TRequestRequirements>>): Layer.Layer<Layer.Success<BuiltRoutes<TRpcs, THandlers, TError, TRequirements, TRequestServices, TRequestRequirements>>, Layer.Error<BuiltRoutes<TRpcs, THandlers, TError, TRequirements, TRequestServices, TRequestRequirements>>, Exclude<Layer.Services<BuiltRoutes<TRpcs, THandlers, TError, TRequirements, TRequestServices, TRequestRequirements>>, TRequestServices | TRequestRequirements> | Exclude<TRequirements, TRequestServices> | RequestRequirements<TRpcs, TRequestRequirements>>;
|
|
23
|
+
declare function buildRpcRoutes<TRpcs extends Rpc.Any, THandlers, TError, TRequirements, TRequestServices = never, TRequestRequirements = never>(options: RouteOptions<TRpcs, THandlers, TError, TRequirements, TRequestServices, TRequestRequirements>, { bodySize, trustedProxy, nativeOrigins }: Effect.Success<ReturnType<typeof hostTransport>>, sensitive: Effect.Success<ReturnType<typeof schemaSensitiveKeys>>): Layer.Layer<never, TError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies, SessionPolicy | Exclude<Exclude<TRequirements, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
22
24
|
readonly _tag: `${string}.$changes`;
|
|
23
25
|
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<HttpRouter.Request<"Requires", SessionPolicy>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
24
26
|
readonly _tag: `${string}.$changes`;
|
|
25
27
|
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<RpcSerialization.RpcSerialization, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
26
28
|
readonly _tag: `${string}.$changes`;
|
|
27
|
-
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.Handler<"platform.hostVersion.watch">, import("effect/Context").Service.Identifier<TRpcs extends {
|
|
29
|
+
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.Handler<"platform.hostVersion.watch">, import("effect/Context").Service.Identifier<TRpcs extends {
|
|
28
30
|
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
29
31
|
} ? Extract<TMiddleware, {
|
|
30
32
|
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
31
|
-
}> : never>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
33
|
+
}> : never>>, import("#requestServices.ts").RequestServices<TRequestServices, TRequestRequirements>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
32
34
|
readonly _tag: `${string}.$changes`;
|
|
33
|
-
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("
|
|
35
|
+
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("@shivaedev/identity/middleware.ts").RequestTracing, import("effect/Context").Service.Identifier<TRpcs extends {
|
|
34
36
|
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
35
37
|
} ? Extract<TMiddleware, {
|
|
36
38
|
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
37
|
-
}> : never>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
39
|
+
}> : never>>, import("#requestServices.ts").RequestServices<TRequestServices, TRequestRequirements>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
38
40
|
readonly _tag: `${string}.$changes`;
|
|
39
|
-
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<
|
|
41
|
+
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/Scope").Scope, import("effect/Context").Service.Identifier<TRpcs extends {
|
|
40
42
|
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
41
43
|
} ? Extract<TMiddleware, {
|
|
42
44
|
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
43
|
-
}> : never>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
45
|
+
}> : never>>, import("#requestServices.ts").RequestServices<TRequestServices, TRequestRequirements>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
44
46
|
readonly _tag: `${string}.$changes`;
|
|
45
|
-
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.
|
|
47
|
+
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ServicesServer<Rpc.AddMiddleware<Rpc.AddMiddleware<Rpc.AddMiddleware<TRpcs, import("effect/rpc/RpcMiddleware").ServiceClass<import("#requestServices.ts").RequestServices<TRequestServices, TRequestRequirements>, "@shivaedev/server/RequestServices", TRequestServices, import("effect/Schema").Never, never, TRequestRequirements, false>>, typeof import("@shivaedev/contract/CommandGuard.ts").CommandGuard>, typeof import("@shivaedev/identity/middleware.ts").RequestTracing>>, never>, import("@shivaedev/contract/CommandGuard.ts").CommandGuard>, import("effect/Context").Service.Identifier<TRpcs extends {
|
|
46
48
|
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
47
49
|
} ? Extract<TMiddleware, {
|
|
48
50
|
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
49
|
-
}> : never>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
51
|
+
}> : never>>, import("#requestServices.ts").RequestServices<TRequestServices, TRequestRequirements>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
50
52
|
readonly _tag: `${string}.$changes`;
|
|
51
|
-
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<Exclude<Exclude<
|
|
53
|
+
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<Rpc.AddMiddleware<Rpc.AddMiddleware<TRpcs, import("effect/rpc/RpcMiddleware").ServiceClass<import("#requestServices.ts").RequestServices<TRequestServices, TRequestRequirements>, "@shivaedev/server/RequestServices", TRequestServices, import("effect/Schema").Never, never, TRequestRequirements, false>>, typeof import("@shivaedev/contract/CommandGuard.ts").CommandGuard>, typeof import("@shivaedev/identity/middleware.ts").RequestTracing>>, never>, import("@shivaedev/contract/CommandGuard.ts").CommandGuard>, import("effect/Context").Service.Identifier<TRpcs extends {
|
|
52
54
|
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
53
55
|
} ? Extract<TMiddleware, {
|
|
54
56
|
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
55
|
-
}> : never
|
|
57
|
+
}> : never>>, import("#requestServices.ts").RequestServices<TRequestServices, TRequestRequirements>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
58
|
+
readonly _tag: `${string}.$changes`;
|
|
59
|
+
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Effect.Services<(TRpcs extends {
|
|
60
|
+
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
61
|
+
} ? Extract<TMiddleware, {
|
|
62
|
+
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
63
|
+
}> : never)["@shivaedev/contract/SubjectDeclaration"]["middleware"]>, import("#requestServices.ts").RequestServices<TRequestServices, TRequestRequirements>>, RpcSerialization.RpcSerialization>, import("effect/Scope").Scope>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | import("@shivaedev/identity/subject.ts").SubjectResolver | Rpc.ToHandler<Extract<TRpcs, {
|
|
56
64
|
readonly _tag: `${string}.$changes`;
|
|
57
65
|
}>>>, Rpc.Handler<"platform.hostVersion.watch">>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<Rpc.ExtractRequires<Extract<TRpcs, {
|
|
58
66
|
readonly _tag: `${string}.$changes`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostRpcRoutes.d.ts","sourceRoot":"","sources":["../src/hostRpcRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAmC,UAAU,EAAyC,MAAM,aAAa,CAAC;AAEjH,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,QAAQ,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"hostRpcRoutes.d.ts","sourceRoot":"","sources":["../src/hostRpcRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAmC,UAAU,EAAyC,MAAM,aAAa,CAAC;AAEjH,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,QAAQ,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAEpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAMjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC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KAAK,CACb,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CAAC,EAC3G,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CAAC,EACvG,OAAO,CACP,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CAAC,EAC5G,gBAAgB,GAAG,oBAAoB,CACtC,GACD,OAAO,CAAC,aAAa,EAAE,gBAAgB,CAAC,GACxC,mBAAmB,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAClD,CAAC;AAOF,iBAAS,cAAc,CAAC,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,GAAG,KAAK,EAAE,oBAAoB,GAAG,KAAK,EACtI,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,EACtG,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,EAC3F,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uHAmDjE"}
|
package/dist/hostRpcRoutes.js
CHANGED
|
@@ -2,7 +2,6 @@ import { ByteSize, Effect, Layer } from "effect";
|
|
|
2
2
|
import { HttpEffect, HttpIncomingMessage, HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
3
3
|
import * as HttpStatus from "effect/http/HttpStatus";
|
|
4
4
|
import { RpcSerialization } from "effect/rpc";
|
|
5
|
-
import { HostVersion } from "@shivaedev/contract/HostVersion.ts";
|
|
6
5
|
import { validateReadPolicies } from "@shivaedev/contract/validateReadPolicies.ts";
|
|
7
6
|
import { localRpcGuard } from "@shivaedev/identity/server/adapters/local.ts";
|
|
8
7
|
import { authenticatedLayer, maybeAuthenticatedLayer } from "@shivaedev/identity/server/session.ts";
|
|
@@ -26,10 +25,10 @@ function buildRpcRoutes(options, { bodySize, trustedProxy, nativeOrigins }, sens
|
|
|
26
25
|
return HttpRouter.use((router) => Effect.gen(function* () {
|
|
27
26
|
yield* validateReadPolicies(options.group);
|
|
28
27
|
const wire = redactingRpcSerialization(yield* RpcSerialization.RpcSerialization, sensitive);
|
|
29
|
-
const group = options.group
|
|
30
|
-
const handler = yield* hostRpc(group).pipe(Effect.provideService(RpcSerialization.RpcSerialization, wire));
|
|
28
|
+
const group = options.group;
|
|
29
|
+
const handler = yield* hostRpc(group, false, options.requestServices).pipe(Effect.provideService(RpcSerialization.RpcSerialization, wire));
|
|
31
30
|
const guarded = Effect.flatMap(UnixSocketRequest, (unix) => (unix ? handler : localRpcGuard(handler, trustedProxy, nativeOrigins)));
|
|
32
|
-
const websocket = yield* hostRpc(group, true).pipe(Effect.provideService(RpcSerialization.RpcSerialization, wire));
|
|
31
|
+
const websocket = yield* hostRpc(group, true, options.requestServices).pipe(Effect.provideService(RpcSerialization.RpcSerialization, wire));
|
|
33
32
|
yield* router.add("OPTIONS", options.rpcPath ?? "/rpc", HttpServerResponse.text("Local same-origin requests only", {
|
|
34
33
|
status: HttpStatus.fromLiteral("Forbidden"),
|
|
35
34
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostRpcRoutes.js","sourceRoot":"","sources":["../src/hostRpcRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACjD,O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ChF,MAAM,CAAC,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,OAAO,CAAC,EACnE,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAC9D,UAAU,CAAC,sBAAsB,CAAC,eAAe,CAAC,CAClD,CACD,CACD,CACD,CAAC;IACH,CAAC,CAAC,CACF,CAAC,IAAI,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC7G,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,EAC7D,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAC3C,CAAC;AACH,CAAC"}
|
|
@@ -4,14 +4,14 @@ import { assertPostgresMigrations, postgresMigrationError } from "@shivaedev/sql
|
|
|
4
4
|
import { migratePostgres } from "@shivaedev/sql/migrations.ts";
|
|
5
5
|
import { pendingPostgresMigrations } from "@shivaedev/sql/pendingPostgresMigrations.ts";
|
|
6
6
|
export function prepareMigrations(migrations) {
|
|
7
|
-
switch (migrations.mode) {
|
|
7
|
+
switch (migrations.mode ?? "migrate") {
|
|
8
8
|
case "check": {
|
|
9
9
|
const { release: _release, ...schema } = migrations;
|
|
10
10
|
return assertPostgresMigrations(schema);
|
|
11
11
|
}
|
|
12
12
|
case "wait":
|
|
13
13
|
return waitForMigrations(migrations);
|
|
14
|
-
|
|
14
|
+
case "migrate":
|
|
15
15
|
return migratePostgres({ ...migrations, lockTimeout: migrations.lockTimeout ?? "5 seconds" }).pipe(Effect.asVoid);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareMigrations.js","sourceRoot":"","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CAAC,CAAC,CAAC,IAAI,CACvI,MAAM,CAAC,UAAU,CACjB,CAAC;YACH,CAAC;YACD,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC,IAAI,CACN,MAAM,CAAC,KAAK,CAAC;YACZ,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,IAAI,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,IAAI,WAAW,CAAC,CAAC,CAAC;YACxI,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,YAAY,QAAQ,CAAC,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;SACvF,CAAC,EACF,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACzB,KAAK,YAAY,QAAQ,CAAC,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CACtI,CACD,CAAC;QACF,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,KAAK,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YACjC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;QACtD,CAAC;IACF,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Schema } from "effect";
|
|
2
|
+
import type { Rpc, RpcMiddleware } from "effect/rpc";
|
|
3
|
+
import type { Identity, OptionalIdentity, SessionUser, SessionUserWithProviderAccounts } from "@shivaedev/identity/identity.ts";
|
|
4
|
+
import type { Subject } from "@shivaedev/identity/subject.ts";
|
|
5
|
+
export type RequestContext = Identity | OptionalIdentity | SessionUser | SessionUserWithProviderAccounts | Subject;
|
|
6
|
+
export type RequestRequirements<TRpcs extends Rpc.Any, TRequirements> = TRpcs extends unknown ? Exclude<TRequirements, Rpc.ExtractProvides<TRpcs, TRpcs["_tag"]>> : never;
|
|
7
|
+
export type GlobalServices<TRequirements, TRequestServices = never> = [Extract<TRequirements, RequestContext | TRequestServices>] extends [never] ? unknown : {
|
|
8
|
+
readonly "Register caller-dependent services in requestServices": never;
|
|
9
|
+
};
|
|
10
|
+
export interface RequestServices<TServices, TRequirements> extends RpcMiddleware.AnyId {
|
|
11
|
+
readonly [RpcMiddleware.TypeId]: {
|
|
12
|
+
readonly provides: TServices;
|
|
13
|
+
readonly requires: TRequirements;
|
|
14
|
+
readonly error: typeof Schema.Never;
|
|
15
|
+
readonly clientError: never;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=requestServices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestServices.d.ts","sourceRoot":"","sources":["../src/requestServices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AAChI,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAE9D,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,gBAAgB,GAAG,WAAW,GAAG,+BAA+B,GAAG,OAAO,CAAC;AACnH,MAAM,MAAM,mBAAmB,CAAC,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,aAAa,IAAI,KAAK,SAAS,OAAO,GAC1F,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GACjE,KAAK,CAAC;AACT,MAAM,MAAM,cAAc,CAAC,aAAa,EAAE,gBAAgB,GAAG,KAAK,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAC9I,OAAO,GACP;IAAE,QAAQ,CAAC,uDAAuD,EAAE,KAAK,CAAA;CAAE,CAAC;AAE/E,MAAM,WAAW,eAAe,CAAC,SAAS,EAAE,aAAa,CAAE,SAAQ,aAAa,CAAC,KAAK;IACrF,QAAQ,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;QAChC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;QAC7B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;QACjC,QAAQ,CAAC,KAAK,EAAE,OAAO,MAAM,CAAC,KAAK,CAAC;QACpC,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC;KAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestServices.js","sourceRoot":"","sources":["../src/requestServices.ts"],"names":[],"mappings":""}
|
package/dist/workerHost.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import { type AppDatabaseOptions } from "#appDatabase.ts";
|
|
|
3
3
|
export declare function workerHost<R, E, TRequirements, TServices, TServiceError, TServiceRequirements, TMigrations = never, TMigrationError = never>(options: AppDatabaseOptions<TMigrations, TMigrationError> & {
|
|
4
4
|
readonly workers: Layer.Layer<R, E, TRequirements>;
|
|
5
5
|
readonly services: Layer.Layer<TServices, TServiceError, TServiceRequirements>;
|
|
6
|
-
}): Layer.Layer<"@shivaedev/contract/LiveServer" | R | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient, E | TMigrationError | TServiceError | import("effect/Config").ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("effect/sql/SqlError").SqlError, Exclude<Exclude<TServiceRequirements, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/
|
|
6
|
+
}): Layer.Layer<"@shivaedev/contract/LiveServer" | R | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient, E | TMigrationError | TServiceError | import("effect/Config").ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("effect/sql/SqlError").SqlError, Exclude<Exclude<TServiceRequirements, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/crypto/Aead").Aead | import("effect/crypto/Cipher").Cipher | import("effect/crypto/Digest").Digest | import("effect/crypto/Kdf").Kdf | import("effect/crypto/KeyAgreement").KeyAgreement | import("effect/crypto/KeyWrap").KeyWrap | import("effect/crypto/Mac").Mac | import("effect/crypto/SecureRandom").SecureRandom | import("effect/crypto/Signature").Signature> | Exclude<Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/crypto/Aead").Aead | import("effect/crypto/Cipher").Cipher | import("effect/crypto/Digest").Digest | import("effect/crypto/Kdf").Kdf | import("effect/crypto/KeyAgreement").KeyAgreement | import("effect/crypto/KeyWrap").KeyWrap | import("effect/crypto/Mac").Mac | import("effect/crypto/SecureRandom").SecureRandom | import("effect/crypto/Signature").Signature> | Exclude<Exclude<Exclude<TRequirements, TServices>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("effect/crypto/Aead").Aead | import("effect/crypto/Cipher").Cipher | import("effect/crypto/Digest").Digest | import("effect/crypto/Kdf").Kdf | import("effect/crypto/KeyAgreement").KeyAgreement | import("effect/crypto/KeyWrap").KeyWrap | import("effect/crypto/Mac").Mac | import("effect/crypto/SecureRandom").SecureRandom | import("effect/crypto/Signature").Signature>>;
|
|
7
7
|
//# sourceMappingURL=workerHost.d.ts.map
|
package/dist/workerHost.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workerHost.d.ts","sourceRoot":"","sources":["../src/workerHost.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,KAAK,kBAAkB,EAAe,MAAM,iBAAiB,CAAC;AAEvE,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,EAAE,WAAW,GAAG,KAAK,EAAE,eAAe,GAAG,KAAK,EAC3I,OAAO,EAAE,kBAAkB,CAAC,WAAW,EAAE,eAAe,CAAC,GAAG;IAC3D,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;IACnD,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,aAAa,EAAE,oBAAoB,CAAC,CAAC;CAC/E,
|
|
1
|
+
{"version":3,"file":"workerHost.d.ts","sourceRoot":"","sources":["../src/workerHost.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,KAAK,kBAAkB,EAAe,MAAM,iBAAiB,CAAC;AAEvE,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,oBAAoB,EAAE,WAAW,GAAG,KAAK,EAAE,eAAe,GAAG,KAAK,EAC3I,OAAO,EAAE,kBAAkB,CAAC,WAAW,EAAE,eAAe,CAAC,GAAG;IAC3D,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;IACnD,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,aAAa,EAAE,oBAAoB,CAAC,CAAC;CAC/E,w5EAGD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "The Effect application host: HTTP and RPC serving, health, OTLP export, database and migrations, and development mode",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect"
|
|
@@ -45,40 +45,41 @@
|
|
|
45
45
|
"README.md"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@shivaedev/changes": "0.
|
|
49
|
-
"@shivaedev/contract": "0.
|
|
50
|
-
"@shivaedev/errors": "0.
|
|
51
|
-
"@shivaedev/http": "0.
|
|
52
|
-
"@shivaedev/identity": "0.
|
|
53
|
-
"@shivaedev/local-postgres": "0.
|
|
54
|
-
"@shivaedev/sql": "0.
|
|
48
|
+
"@shivaedev/changes": "0.11.0",
|
|
49
|
+
"@shivaedev/contract": "0.40.0",
|
|
50
|
+
"@shivaedev/errors": "0.10.0",
|
|
51
|
+
"@shivaedev/http": "0.8.0",
|
|
52
|
+
"@shivaedev/identity": "0.28.0",
|
|
53
|
+
"@shivaedev/local-postgres": "0.15.0",
|
|
54
|
+
"@shivaedev/sql": "0.43.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@effect/platform-node": "4.0
|
|
58
|
-
"@effect/sql-pg": "4.0
|
|
59
|
-
"@effect/vitest": "4.0
|
|
60
|
-
"@shivaedev/access": "0.
|
|
61
|
-
"@shivaedev/admin": "0.
|
|
62
|
-
"@shivaedev/jobs": "0.
|
|
63
|
-
"@shivaedev/quality": "0.
|
|
64
|
-
"@shivaedev/rate-limit": "0.
|
|
65
|
-
"@shivaedev/
|
|
66
|
-
"@shivaedev/test-
|
|
67
|
-
"@shivaedev/test-
|
|
57
|
+
"@effect/platform-node": "4.1.0",
|
|
58
|
+
"@effect/sql-pg": "4.1.0",
|
|
59
|
+
"@effect/vitest": "4.1.0",
|
|
60
|
+
"@shivaedev/access": "0.6.0",
|
|
61
|
+
"@shivaedev/admin": "0.21.1",
|
|
62
|
+
"@shivaedev/jobs": "0.40.0",
|
|
63
|
+
"@shivaedev/quality": "0.66.0",
|
|
64
|
+
"@shivaedev/rate-limit": "0.6.1",
|
|
65
|
+
"@shivaedev/service": "0.8.0",
|
|
66
|
+
"@shivaedev/test-kits": "0.8.1",
|
|
67
|
+
"@shivaedev/test-sql": "0.24.1",
|
|
68
|
+
"@shivaedev/test-story": "0.42.1",
|
|
68
69
|
"@types/node": "24.19.2",
|
|
69
70
|
"better-auth": "1.7.14",
|
|
70
|
-
"effect": "4.0
|
|
71
|
+
"effect": "4.1.0",
|
|
71
72
|
"pg-boss": "12.38.0",
|
|
72
73
|
"typescript": "7.0.2",
|
|
73
74
|
"vitest": "5.0.5"
|
|
74
75
|
},
|
|
75
76
|
"peerDependencies": {
|
|
76
|
-
"@effect/platform-node": "4.0
|
|
77
|
-
"@effect/sql-pg": "4.0
|
|
78
|
-
"@effect/vitest": "4.0
|
|
79
|
-
"@shivaedev/admin": "0.
|
|
77
|
+
"@effect/platform-node": "4.1.0",
|
|
78
|
+
"@effect/sql-pg": "4.1.0",
|
|
79
|
+
"@effect/vitest": "4.1.0",
|
|
80
|
+
"@shivaedev/admin": "0.21.1",
|
|
80
81
|
"better-auth": "1.7.14",
|
|
81
|
-
"effect": "4.0
|
|
82
|
+
"effect": "4.1.0"
|
|
82
83
|
},
|
|
83
84
|
"peerDependenciesMeta": {
|
|
84
85
|
"@effect/platform-node": {
|
package/src/AppHostFactory.ts
CHANGED
|
@@ -25,6 +25,8 @@ export interface AppHostFactory {
|
|
|
25
25
|
TRouteError = never,
|
|
26
26
|
TRouteRequirements = HostRouteRequirements,
|
|
27
27
|
TMigrationError = never,
|
|
28
|
+
TRequestServices = never,
|
|
29
|
+
TRequestRequirements = never,
|
|
28
30
|
>(
|
|
29
31
|
options: AppHostInput<
|
|
30
32
|
TRpcs,
|
|
@@ -42,7 +44,9 @@ export interface AppHostFactory {
|
|
|
42
44
|
TPreflightRequirements,
|
|
43
45
|
TRouteError,
|
|
44
46
|
TRouteRequirements,
|
|
45
|
-
TMigrationError
|
|
47
|
+
TMigrationError,
|
|
48
|
+
TRequestServices,
|
|
49
|
+
TRequestRequirements
|
|
46
50
|
> & { readonly migrations: AppDatabaseOptions<TMigrations, TMigrationError>["migrations"] },
|
|
47
51
|
): PreflightHost<
|
|
48
52
|
ReturnType<
|
|
@@ -59,7 +63,9 @@ export interface AppHostFactory {
|
|
|
59
63
|
TApplicationRequirements,
|
|
60
64
|
TRouteError,
|
|
61
65
|
TRouteRequirements,
|
|
62
|
-
TMigrationError
|
|
66
|
+
TMigrationError,
|
|
67
|
+
TRequestServices,
|
|
68
|
+
TRequestRequirements
|
|
63
69
|
>
|
|
64
70
|
>,
|
|
65
71
|
NoInfer<TPreflight>,
|
|
@@ -80,6 +86,8 @@ export interface AppHostFactory {
|
|
|
80
86
|
TPreflightRequirements = never,
|
|
81
87
|
TRouteError = never,
|
|
82
88
|
TRouteRequirements = HostRouteRequirements,
|
|
89
|
+
TRequestServices = never,
|
|
90
|
+
TRequestRequirements = never,
|
|
83
91
|
>(
|
|
84
92
|
options: AppHttpHostOptions<
|
|
85
93
|
TRpcs,
|
|
@@ -93,7 +101,9 @@ export interface AppHostFactory {
|
|
|
93
101
|
TPreflightError,
|
|
94
102
|
TPreflightRequirements,
|
|
95
103
|
TRouteError,
|
|
96
|
-
TRouteRequirements
|
|
104
|
+
TRouteRequirements,
|
|
105
|
+
TRequestServices,
|
|
106
|
+
TRequestRequirements
|
|
97
107
|
>,
|
|
98
108
|
): PreflightHost<
|
|
99
109
|
ReturnType<
|
|
@@ -106,7 +116,9 @@ export interface AppHostFactory {
|
|
|
106
116
|
TServiceError,
|
|
107
117
|
TServiceRequirements,
|
|
108
118
|
TRouteError,
|
|
109
|
-
TRouteRequirements
|
|
119
|
+
TRouteRequirements,
|
|
120
|
+
TRequestServices,
|
|
121
|
+
TRequestRequirements
|
|
110
122
|
>
|
|
111
123
|
>,
|
|
112
124
|
NoInfer<TPreflight>,
|