@shivaedev/server 0.44.2 → 0.46.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 +22 -0
- package/README.md +12 -9
- package/dist/AppHostInput.d.ts +10 -3
- package/dist/AppHostInput.d.ts.map +1 -1
- package/dist/AppModule.d.ts +6 -1
- package/dist/AppModule.d.ts.map +1 -1
- package/dist/DuplicateModuleQueue.d.ts +4 -2
- package/dist/DuplicateModuleQueue.d.ts.map +1 -1
- package/dist/DuplicateModuleQueue.js +17 -3
- package/dist/DuplicateModuleQueue.js.map +1 -1
- package/dist/appDatabase.d.ts.map +1 -1
- package/dist/appDatabase.js +2 -3
- package/dist/appDatabase.js.map +1 -1
- package/dist/appDatabaseHttp.d.ts +5 -1
- package/dist/appDatabaseHttp.d.ts.map +1 -1
- package/dist/appDatabaseHttp.js +4 -3
- package/dist/appDatabaseHttp.js.map +1 -1
- package/dist/appModules.d.ts +1 -1
- package/dist/appModules.d.ts.map +1 -1
- package/dist/appModules.js +17 -20
- package/dist/appModules.js.map +1 -1
- package/dist/hostSensitiveKeys.d.ts +4 -2
- package/dist/hostSensitiveKeys.d.ts.map +1 -1
- package/dist/hostSensitiveKeys.js +16 -21
- package/dist/hostSensitiveKeys.js.map +1 -1
- package/dist/moduleQueues.d.ts +7 -0
- package/dist/moduleQueues.d.ts.map +1 -0
- package/dist/moduleQueues.js +27 -0
- package/dist/moduleQueues.js.map +1 -0
- package/package.json +5 -5
- package/src/AppHostInput.ts +5 -3
- package/src/AppModule.ts +5 -3
- package/src/DuplicateModuleQueue.ts +18 -3
- package/src/appDatabase.ts +2 -3
- package/src/appDatabaseHttp.ts +5 -3
- package/src/appModules.ts +19 -25
- package/src/hostSensitiveKeys.ts +18 -26
- package/src/moduleQueues.ts +34 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.46.0 - 2026-11-21
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `AppModule` takes a third form for a registration that serves no RPCs, with no `group`, `handlers` or `module`. It carries any of `admin`, `ports`, `queues`, `workers`, `migrations`, `requestServices` and `services` and an optional `name`, so a registration with only admin pages, queues or workers writes `{ admin } satisfies AppModule` instead of `group: RpcGroup.make(), handlers: Layer.empty, name: "…"`.
|
|
8
|
+
- `services` is optional in every form of `AppModule`, and a registration without it composes as `Layer.empty`. `appModules` still refuses a defined module whose operations yield a service no registration provides.
|
|
9
|
+
|
|
10
|
+
### Breaking
|
|
11
|
+
|
|
12
|
+
- `DuplicateModuleQueue`'s `firstModule` and `secondModule` are `undefined` for a registration without a name, and the new `firstAdminPage` and `secondAdminPage` hold such a registration's first admin page id; they stay `undefined` for a named registration. Its message names that registration by the page, or says it has no name and to give it one. Code that reads `firstModule` or `secondModule` as a `string` handles `undefined`, or reads the message.
|
|
13
|
+
|
|
14
|
+
## 0.45.0 - 2026-11-21
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- In the deferred `application` form, the names an application lists in `config.sensitiveKeys` are masked from the first line the `application` Effect logs, and in the host's preflight logs, so a service that logs such a value while it is built no longer writes it in clear.
|
|
19
|
+
|
|
20
|
+
### Breaking
|
|
21
|
+
|
|
22
|
+
- In the deferred `application` form, move `sensitiveKeys` from the `config` the `application` Effect returns to `appHost`'s own `config`, beside `databaseUrl`: `appHost({ config: { databaseUrl, sensitiveKeys: ["customerReference"] }, application })`. The options the Effect returns no longer accept `config.sensitiveKeys`.
|
|
23
|
+
- Code that composes the host below `appHost` passes the configured names to `deferredHost` as a third argument, `deferredHost(application, database, { config: { sensitiveKeys } })`. The policy `hostSensitiveKeys` returns replaces `configure` with `serve`, which takes only the RPC group: the configured names stay those `hostSensitiveKeys` received.
|
|
24
|
+
|
|
3
25
|
## 0.44.2 - 2026-11-21
|
|
4
26
|
|
|
5
27
|
### Changed
|
package/README.md
CHANGED
|
@@ -84,7 +84,7 @@ Host option types include this HTTP-only shape. A wrapper that reads native RPC
|
|
|
84
84
|
|
|
85
85
|
`appHost` is the server entry point for an Effect app. For a PostgreSQL app, supply the native RPC group, handler and service Layers, migration loader, session policy and static asset directory. The host completes migrations before acquiring application services, starts Node HTTP with native Effect RPC over a WebSocket upgrade at `/rpc`, and provides SQL, Reactivity and `LiveServer` from `@shivaedev/contract/live-server/service.ts` to those Layers.
|
|
86
86
|
|
|
87
|
-
For feature modules, install the optional peer `@shivaedev/admin` and declare each registration with `satisfies AppModule` from `@shivaedev/server/AppModule.ts`.
|
|
87
|
+
For feature modules, install the optional peer `@shivaedev/admin` and declare each registration with `satisfies AppModule` from `@shivaedev/server/AppModule.ts`. A registration takes one of three forms. A defined module registers as `module:` and takes its name from the module itself, so its registration gives none that could disagree. An RPC group served by hand-written handlers registers as `group` plus `handlers` plus a `name`, because nothing else names it. A registration that serves no RPCs, such as an application's foundation or a registration with only admin pages, ports, queues or workers, names neither and may give a `name`. Every form lists only what it contributes: `services` when it has a service Layer of its own, and `migrations: { loader, components? }` when it owns tables; a registration without either leaves the field out. `migrationsIn(directory)` from `@shivaedev/server/migrationsIn.ts` takes the folder that contains `migrations`, the same argument as `loadMigrationsIn` from `@shivaedev/sql/loadMigrationsIn.ts`, and returns `{ loader }` for the `migrations` folder in it, found by `loadMigrationsIn` under Node's `NodeServices.layer`, so a registration beside its `migrations` folder writes `migrations: migrationsIn(import.meta.dirname)` and needs the optional peer `@effect/platform-node`. Register caller-dependent Layers in the optional `requestServices` slot beside global `services`. Keep default adapters in its optional `ports` Layer, put an optional `registerAdmin` result in `admin`, and declare owned `queues` and a `workers` Layer on the module. `jobModule` from `@shivaedev/jobs/server/jobModule.ts` supplies those two fields from a jobs registration list.
|
|
88
88
|
|
|
89
89
|
```ts
|
|
90
90
|
import { Effect } from "effect";
|
|
@@ -104,27 +104,30 @@ const hosts = Effect.gen(function* () {
|
|
|
104
104
|
|
|
105
105
|
An application built with [`@shivaedev/build`](https://github.com/ShivaeDev/platform/tree/main/packages/build#the-servers-module-list) writes no such list: its generator finds every exported registration written `satisfies AppModule` and writes them to `src/generated/server/modules.ts` in the order of their files' paths, and the application passes that list to `appModules` beside the registrations that are not module folders, such as its foundation, so a module is registered by creating its folder. Admin navigation and the order in which `appModules` composes Layers follow the list. What the merged Layers provide and the migrations do not depend on it, because migrations run by their number. An application that needs another order renames a module's folder, or composes that registration beside its foundation where the generator does not find it, such as a function that returns it.
|
|
106
106
|
|
|
107
|
-
A module defined with `defineModule` from `@shivaedev/contract/defineModule.ts` registers as `module:`, and the host builds its group and its handlers with `moduleHandlers`. Its handlers need the services its operations' `run` and read policies yield, less what its middleware and subject provide per call; the registration's `services` and `ports` provide them, except the SQL client and the other services the host provides. An RPC group that is not a defined module, such as a contract served by hand-written handlers, registers as `group` plus `handlers` instead
|
|
107
|
+
A module defined with `defineModule` from `@shivaedev/contract/defineModule.ts` registers as `module:`, and the host builds its group and its handlers with `moduleHandlers`. Its handlers need the services its operations' `run` and read policies yield, less what its middleware and subject provide per call; the registration's `services` and `ports` provide them, except the SQL client and the other services the host provides. An RPC group that is not a defined module, such as a contract served by hand-written handlers, registers as `group` plus `handlers` instead. A registration that only brings an admin page writes just `admin`, and all three sit in one application's module list:
|
|
108
108
|
|
|
109
109
|
```ts
|
|
110
|
-
import {
|
|
110
|
+
import { adminRegistry } from "@shivaedev/admin/registry.ts";
|
|
111
|
+
import { registerAdmin } from "@shivaedev/admin/server/registerAdmin.ts";
|
|
111
112
|
import { defineModule } from "@shivaedev/contract/defineModule.ts";
|
|
112
113
|
import { migrationsIn } from "@shivaedev/server/migrationsIn.ts";
|
|
113
114
|
import type { AppModule } from "@shivaedev/server/AppModule.ts";
|
|
114
115
|
import { notesWire } from "#generated/modules/notes/Notes.ts";
|
|
115
116
|
import { Create, Get } from "./notes/operations.ts";
|
|
116
117
|
import { Drafts, readDraft } from "./drafts.ts";
|
|
118
|
+
import { Usage, UsagePage } from "./usage.ts";
|
|
117
119
|
|
|
118
120
|
export const Notes = defineModule({ name: "notes", operations: [Create, Get], wire: notesWire });
|
|
119
121
|
|
|
120
|
-
export const notes = { migrations: migrationsIn(import.meta.dirname), module: Notes
|
|
122
|
+
export const notes = { migrations: migrationsIn(import.meta.dirname), module: Notes } satisfies AppModule;
|
|
121
123
|
|
|
122
124
|
export const drafts = {
|
|
123
125
|
group: Drafts,
|
|
124
126
|
handlers: Drafts.application.toLayer({ "drafts.read": readDraft }),
|
|
125
127
|
name: "drafts",
|
|
126
|
-
services: Layer.empty,
|
|
127
128
|
} satisfies AppModule;
|
|
129
|
+
|
|
130
|
+
export const usage = { admin: registerAdmin(adminRegistry(UsagePage), { usage: Usage }) } satisfies AppModule;
|
|
128
131
|
```
|
|
129
132
|
|
|
130
133
|
A defined module's generated handlers check each query's read policy with the module's services. Hand-written handlers would move that check to the host's read-policy guard, in the handlers' own context, so a defined module would have two paths. `AppModule` refuses a defined module as `group` at compile time, and the host refuses to start when any query of a defined module is served by another handler: it fails with `HandWrittenModuleHandlers` from `@shivaedev/server/HandWrittenModuleHandlers.ts`, whose `module`, `queries` and `message` name the module, each affected query and the `module:` registration to use instead. Fakes in this repository's own stories opt out through `replacedModuleHandlers` in the package's test support, which is not published.
|
|
@@ -138,7 +141,7 @@ src/test-support/compiler-fixtures/unprovidedService.ts(26,12): error TS2345: Ar
|
|
|
138
141
|
|
|
139
142
|
A service may come from another registration in the same list. The `replacements` Layer only overrides default ports, so a service that only the replacements provide is refused too: give it a default in a registration's `ports`. A service the application provides around the host instead belongs in a registration. The check reads each module's services from its registration's own type, so it refuses a registration typed as `AppModule`, returned by a helper typed that way, or whose `module` is typed as `RegisteredModule`: that type has lost the services the module's handlers need. A `group` plus `handlers` registration typed as `AppModule` is refused too, because its type is the same. Declare the registration with `satisfies AppModule` instead.
|
|
140
143
|
|
|
141
|
-
`appModules` returns an Effect that rejects duplicate queue names before building any host. `DuplicateModuleQueue` from `@shivaedev/server/DuplicateModuleQueue.ts` identifies `queue`, `firstModule` and `secondModule`, naming a defined module by its own name
|
|
144
|
+
`appModules` returns an Effect that rejects duplicate queue names before building any host. `DuplicateModuleQueue` from `@shivaedev/server/DuplicateModuleQueue.ts` identifies `queue`, `firstModule` and `secondModule`, naming a defined module by its own name, and `firstAdminPage` and `secondAdminPage`, the first admin page id of a registration without a name. Its message names a registration without a name by that page, or else says it has no name and to give it one. Repeating a name within one registration also fails. It combines the native RPC groups, handler Layers, the migration loaders and schema components of the modules that declare `migrations`, skipping the rest. It includes each admin registration's group and handlers and exposes their merged registry as `modules.admin`. Migration numbers belong to one application-wide sequence. Existing hosts can continue to supply their groups, handlers, services and migrations directly.
|
|
142
145
|
|
|
143
146
|
The host builds `services` once for its lifetime and builds `requestServices` once per RPC call, including each call on a persistent WebSocket connection. Native RPC middleware supplies the request services after the identity middleware of the module or contract resolves the caller. Declare `selfSubject` or `accountSubject` on contracts whose request services require `Subject`, `SessionUser` and `Identity`. Request services yield global dependencies from the enclosing environment; leave those global Layers out of the request Layer so they are reused. `appModules` rejects global services that require caller context or a service registered in the request slot.
|
|
144
147
|
|
|
@@ -284,13 +287,13 @@ The host provides the `effect/crypto` services of `NodeCrypto.layer` from `@effe
|
|
|
284
287
|
|
|
285
288
|
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 other than `Crypto` 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.
|
|
286
289
|
|
|
287
|
-
Preflight logs pass through the host's redaction, including logged failure causes and annotations. The original typed failure remains available to callers. Direct hosts derive the policy from their RPC schemas and `config.sensitiveKeys`; deferred hosts use the
|
|
290
|
+
Preflight logs pass through the host's redaction, including logged failure causes and annotations. The original typed failure remains available to callers. Direct hosts derive the policy from their RPC schemas and `config.sensitiveKeys`; deferred hosts use the built-in credential-shaped name rules and their `config.sensitiveKeys` during preflight, before their application's schemas are available. Ordinary startup messages and annotations remain intact.
|
|
288
291
|
|
|
289
|
-
When construction itself touches the schema, use `appHost({ migrations, config, postgresSettings, 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, `LiveServer` from `@shivaedev/contract/live-server/service.ts` and the host's repository model collector available, so services the Effect builds itself with `Layer.build`, as the starter does, report their owned models and sensitive fields to the host that serves and masks them. The Effect and its database run inside the host's redaction policy, so the logs it writes are masked, and so are the logs of a fiber it forks or of a service that keeps the context it captured there, for the life of the process.
|
|
292
|
+
When construction itself touches the schema, use `appHost({ migrations, config, postgresSettings, application })`. `application` is a native Effect that returns the HTTP host options (`group`, handler and service Layers, session policy, and optional HTTP config other than `sensitiveKeys`). List extra sensitive names once in `appHost`'s own `config.sensitiveKeys`, beside the database settings; the options the Effect returns cannot list them. The host first builds `appDatabase`, then evaluates this Effect in the host scope with SQL, Reactivity, `LiveServer` from `@shivaedev/contract/live-server/service.ts` and the host's repository model collector available, so services the Effect builds itself with `Layer.build`, as the starter does, report their owned models and sensitive fields to the host that serves and masks them. The Effect and its database run inside the host's redaction policy, so the logs it writes are masked, and so are the logs of a fiber it forks or of a service that keeps the context it captured there, for the life of the process. From its first line the policy holds the built-in credential-shaped name rules and `config.sensitiveKeys`, and it adds the field names of each model as its repositories declare it; the RPC group's schema names apply once the Effect returns the group. 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.
|
|
290
293
|
|
|
291
294
|
```ts
|
|
292
295
|
const host = appHost({
|
|
293
|
-
config: { databaseUrl },
|
|
296
|
+
config: { databaseUrl, sensitiveKeys: ["customerReference"] },
|
|
294
297
|
postgresSettings: {},
|
|
295
298
|
migrations: { loader: migrations, mode: "check" },
|
|
296
299
|
preflight: AppConfigLive,
|
package/dist/AppHostInput.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { Effect } from "effect";
|
|
2
2
|
import type { Rpc } from "effect/rpc";
|
|
3
|
-
import type { AppDatabaseOptions } from "#appDatabase.ts";
|
|
3
|
+
import type { AppDatabaseOptions, DatabaseConfig } from "#appDatabase.ts";
|
|
4
4
|
import type { AppHttpHostOptions } from "#appHost.ts";
|
|
5
5
|
import type { HostCoreOptions, HostPolicy, HostRouteRequirements, HostRoutes } from "#hostOptions.ts";
|
|
6
6
|
import type { HostPreflight } from "#hostPreflight.ts";
|
|
7
|
-
export type AppHostInput<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TApplicationError = never, TApplicationRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never, TRequestServices = never, TRequestRequirements = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & ((AppDatabaseOptions<TMigrations, TMigrationError> & {
|
|
8
|
-
readonly
|
|
7
|
+
export type AppHostInput<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices = never, TServiceError = never, TServiceRequirements = never, TMigrations = never, TApplicationError = never, TApplicationRequirements = never, TPreflight = never, TPreflightError = never, TPreflightRequirements = never, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never, TRequestServices = never, TRequestRequirements = never> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> & ((Omit<AppDatabaseOptions<TMigrations, TMigrationError>, "config"> & {
|
|
8
|
+
readonly config?: DatabaseConfig & {
|
|
9
|
+
readonly sensitiveKeys?: readonly string[];
|
|
10
|
+
};
|
|
11
|
+
readonly application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, never, never, never, TRouteError, TRouteRequirements, TRequestServices, TRequestRequirements> & {
|
|
12
|
+
readonly config?: {
|
|
13
|
+
readonly sensitiveKeys?: never;
|
|
14
|
+
};
|
|
15
|
+
}, TApplicationError, TApplicationRequirements>;
|
|
9
16
|
}) | (HostCoreOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TRequestServices, TRequestRequirements> & HostRoutes<TRouteError, TRouteRequirements> & HostPolicy & (AppDatabaseOptions<TMigrations, TMigrationError> | {
|
|
10
17
|
readonly migrations?: undefined;
|
|
11
18
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppHostInput.d.ts","sourceRoot":"","sources":["../src/AppHostInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"AppHostInput.d.ts","sourceRoot":"","sources":["../src/AppHostInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,MAAM,YAAY,CACvB,KAAK,SAAS,GAAG,CAAC,GAAG,EACrB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,KAAK,EACrB,oBAAoB,GAAG,KAAK,EAC5B,WAAW,GAAG,KAAK,EACnB,iBA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AAoB,GAAG,KAAK,EAC5B,WAAW,GAAG,KAAK,EACnB,UAAU,GAAG,KAAK,EAClB,eAAe,GAAG,KAAK,EACvB,sBAAsB,GAAG,KAAK,EAC9B,WAAW,GAAG,KAAK,EACnB,kBAAkB,GAAG,qBAAqB,EAC1C,eAAe,GAAG,KAAK,EACvB,gBAAgB,GAAG,KAAK,EACxB,oBAAoB,GAAG,KAAK,IACzB,aAAa,CAAC,UAAU,EAAE,eAAe,EAAE,sBAAsB,CAAC,GACrE,eAAe,CACd,KAAK,EACL,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,CACpB,GACD,UAAU,CAAC,WAAW,EAAE,kBAAkB,CAAC,GAAG;IAC7C,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,YAAY,CAAC,CAAC;IACpF,QAAQ,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IAClE,QAAQ,CAAC,MAAM,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC/C,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;CAC1B,CAAC"}
|
package/dist/AppModule.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ interface ModuleParts {
|
|
|
16
16
|
readonly name: string;
|
|
17
17
|
}[];
|
|
18
18
|
readonly requestServices?: Layer.Layer<never, never, unknown>;
|
|
19
|
-
readonly services
|
|
19
|
+
readonly services?: ModuleLayer;
|
|
20
20
|
readonly workers?: ModuleLayer;
|
|
21
21
|
}
|
|
22
22
|
export type AppModule = (ModuleParts & {
|
|
@@ -31,6 +31,11 @@ export type AppModule = (ModuleParts & {
|
|
|
31
31
|
readonly handlers?: never;
|
|
32
32
|
readonly module: RegisteredModule;
|
|
33
33
|
readonly name?: never;
|
|
34
|
+
}) | (ModuleParts & {
|
|
35
|
+
readonly group?: never;
|
|
36
|
+
readonly handlers?: never;
|
|
37
|
+
readonly module?: never;
|
|
38
|
+
readonly name?: string;
|
|
34
39
|
});
|
|
35
40
|
export type RegisteredModule = RpcGroup.Any & Pick<AnyModule, "application" | "declaration"> & {
|
|
36
41
|
readonly "~requires": unknown;
|
package/dist/AppModule.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppModule.d.ts","sourceRoot":"","sources":["../src/AppModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC;AACxD,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAA;CAAE,CAAC;AAE9G,UAAU,WAAW;IACpB,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC,CAAC;IACxF,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,E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
|
+
readonly firstAdminPage: Schema.optional<Schema.String>;
|
|
4
|
+
readonly firstModule: Schema.optional<Schema.String>;
|
|
4
5
|
readonly queue: Schema.String;
|
|
5
|
-
readonly
|
|
6
|
+
readonly secondAdminPage: Schema.optional<Schema.String>;
|
|
7
|
+
readonly secondModule: Schema.optional<Schema.String>;
|
|
6
8
|
}>, import("effect/Cause").YieldableError>;
|
|
7
9
|
export declare class DuplicateModuleQueue extends DuplicateModuleQueue_base {
|
|
8
10
|
get message(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DuplicateModuleQueue.d.ts","sourceRoot":"","sources":["../src/DuplicateModuleQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC
|
|
1
|
+
{"version":3,"file":"DuplicateModuleQueue.d.ts","sourceRoot":"","sources":["../src/DuplicateModuleQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;;;;;AAUhC,qBAAa,oBAAqB,SAAQ,yBAMxC;IACD,IAAa,OAAO,WAOnB;CACD"}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
+
function owner(name, adminPage) {
|
|
3
|
+
if (name !== undefined) {
|
|
4
|
+
return `"${name}"`;
|
|
5
|
+
}
|
|
6
|
+
return adminPage === undefined ? "a registration with no name" : `the registration of admin page "${adminPage}"`;
|
|
7
|
+
}
|
|
8
|
+
// A registration without a name is found by its first admin page, and one with neither is only described.
|
|
2
9
|
export class DuplicateModuleQueue extends Schema.TaggedError()("DuplicateModuleQueue", {
|
|
3
|
-
|
|
10
|
+
firstAdminPage: Schema.optional(Schema.String),
|
|
11
|
+
firstModule: Schema.optional(Schema.String),
|
|
4
12
|
queue: Schema.String,
|
|
5
|
-
|
|
13
|
+
secondAdminPage: Schema.optional(Schema.String),
|
|
14
|
+
secondModule: Schema.optional(Schema.String),
|
|
6
15
|
}) {
|
|
7
16
|
get message() {
|
|
8
|
-
|
|
17
|
+
const first = owner(this.firstModule, this.firstAdminPage);
|
|
18
|
+
const second = owner(this.secondModule, this.secondAdminPage);
|
|
19
|
+
const unfound = [first, second].includes("a registration with no name")
|
|
20
|
+
? " Give the registration with no name a `name` so this message can name it."
|
|
21
|
+
: "";
|
|
22
|
+
return `Queue "${this.queue}" is declared by both ${first} and ${second}.${unfound}`;
|
|
9
23
|
}
|
|
10
24
|
}
|
|
11
25
|
//# sourceMappingURL=DuplicateModuleQueue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DuplicateModuleQueue.js","sourceRoot":"","sources":["../src/DuplicateModuleQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,OAAO,oBAAqB,SAAQ,MAAM,CAAC,WAAW,EAAwB,CAAC,sBAAsB,EAAE;IAC5G,WAAW,EAAE,MAAM,CAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"DuplicateModuleQueue.js","sourceRoot":"","sources":["../src/DuplicateModuleQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,SAAS,KAAK,CAAC,IAAwB,EAAE,SAA6B;IACrE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,IAAI,IAAI,GAAG,CAAC;IACpB,CAAC;IACD,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,mCAAmC,SAAS,GAAG,CAAC;AAClH,CAAC;AAED,0GAA0G;AAC1G,MAAM,OAAO,oBAAqB,SAAQ,MAAM,CAAC,WAAW,EAAwB,CAAC,sBAAsB,EAAE;IAC5G,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,eAAe,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IAC/C,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;CAC5C,CAAC;IACD,IAAa,OAAO;QACnB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;YACtE,CAAC,CAAC,2EAA2E;YAC7E,CAAC,CAAC,EAAE,CAAC;QACN,OAAO,UAAU,IAAI,CAAC,KAAK,yBAAyB,KAAK,QAAQ,MAAM,IAAI,OAAO,EAAE,CAAC;IACtF,CAAC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appDatabase.d.ts","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAmB,KAAK,EAAU,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACjF,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"appDatabase.d.ts","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAmB,KAAK,EAAU,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACjF,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAK3D,OAAO,EAAE,KAAK,sBAAsB,EAAmB,MA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activity";
|
|
4
4
|
import { liveServerLayer } from "@shivaedev/contract/live-server/layer.ts";
|
|
5
5
|
import { LiveServer } from "@shivaedev/contract/live-server/service.ts";
|
|
6
|
-
import { isSensitiveKey } from "@shivaedev/errors/sensitive.ts";
|
|
7
6
|
import { coordinateWorkerRelease } from "@shivaedev/sql/coordinateWorkerRelease.ts";
|
|
8
7
|
import { postgresChanges } from "@shivaedev/sql/postgresChanges.ts";
|
|
9
8
|
import { postgresLayer } from "@shivaedev/sql/postgresLayer.ts";
|
|
@@ -61,10 +60,10 @@ export function appDatabase(options) {
|
|
|
61
60
|
return worker.pipe(Layer.provideMerge(prepared));
|
|
62
61
|
}
|
|
63
62
|
export const appHost = (options) => {
|
|
64
|
-
const preflight = hostPreflight(options.preflight,
|
|
63
|
+
const preflight = hostPreflight(options.preflight, hostSensitiveKeys(options));
|
|
65
64
|
const hosted = Layer.merge(hostCrypto, hostModels());
|
|
66
65
|
if ("application" in options) {
|
|
67
|
-
return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(preflight), Layer.provide(hosted));
|
|
66
|
+
return deferredHost(options.application, appDatabase(options), options).pipe(Layer.provideMerge(preflight), Layer.provide(hosted));
|
|
68
67
|
}
|
|
69
68
|
return options.migrations === undefined
|
|
70
69
|
? appHostHttp(options).pipe(Layer.provideMerge(preflight), Layer.provide(hosted))
|
package/dist/appDatabase.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appDatabase.js","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACjF,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC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E,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/E,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC;IACrD,IAAI,aAAa,IAAI,OAAO,EAAE,CAAC;QAC9B,OAAO,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACpI,CAAC;IACD,OAAO,OAAO,CAAC,UAAU,KAAK,SAAS;QACtC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,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,SAAS,CAAC,EAC7B,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CACrB,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -149,7 +149,11 @@ export declare function migratedHost<TRpcs extends Rpc.Any, THandlers, THandlerE
|
|
|
149
149
|
}>, `${string}.$changes`>, THandlers>, import("effect/rpc/RpcSerialization").RpcSerialization>, TRequestRequirements | TRequestServices>, never>, never>>, import("effect/http/HttpRouter").HttpRouter>, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpRouter").Request.Without<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Exclude<TRpcs, {
|
|
150
150
|
readonly _tag: `${string}.$changes`;
|
|
151
151
|
}>>, THandlers>, import("effect/rpc/RpcSerialization").RpcSerialization>, TRequestRequirements | TRequestServices>, never>, never>>, import("effect/http/HttpRouter").HttpRouter>, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpRouter").Request.Without<Exclude<Exclude<import("./requestServices.ts").RequestRequirements<TRpcs, TRequestRequirements>, never>, never>>, import("effect/http/HttpRouter").HttpRouter>, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>>;
|
|
152
|
-
export declare function deferredHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TApplicationError, TApplicationRequirements, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never, TRequestServices = never, TRequestRequirements = never>(application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, never, never, never, TRouteError, TRouteRequirements, TRequestServices, TRequestRequirements>, TApplicationError, TApplicationRequirements>, database: ReturnType<typeof appDatabase<TMigrations, TMigrationError
|
|
152
|
+
export declare function deferredHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TApplicationError, TApplicationRequirements, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never, TRequestServices = never, TRequestRequirements = never>(application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, never, never, never, TRouteError, TRouteRequirements, TRequestServices, TRequestRequirements>, TApplicationError, TApplicationRequirements>, database: ReturnType<typeof appDatabase<TMigrations, TMigrationError>>, configured: {
|
|
153
|
+
readonly config?: {
|
|
154
|
+
readonly sensitiveKeys?: readonly string[];
|
|
155
|
+
};
|
|
156
|
+
}): Layer.Layer<"@shivaedev/contract/LiveServer" | TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/http/HttpServer").HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | import("@effect/platform-node/NodeServices").NodeServices, TApplicationError | TMigrationError | TServiceError | import("effect/Config").ConfigError | Error | import("./HandWrittenModuleHandlers.ts").HandWrittenModuleHandlers | import("@shivaedev/errors/wireMask.ts").InvalidRedactionMask | import("effect/sql/Migrator").MigrationError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies | import("effect/PlatformError").PlatformError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict | import("effect/sql/SqlError").SqlError | import("./TrustedProxyRequired.ts").TrustedProxyRequired | import("effect/http/HttpRouter").Request.Without<THandlerError> | import("effect/http/HttpRouter").Request.Without<TRouteError> | import("effect/http/HttpRouter").Request.Without<Effect.Error<(TRpcs extends {
|
|
153
157
|
readonly middlewares: ReadonlySet<infer TMiddleware>;
|
|
154
158
|
} ? Extract<TMiddleware, {
|
|
155
159
|
readonly "@shivaedev/contract/SubjectDeclaration": import("@shivaedev/contract/subject.ts").SubjectDeclaration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appDatabaseHttp.d.ts","sourceRoot":"","sources":["../src/appDatabaseHttp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,wBAAgB,YAAY,CAC3B,KAAK,SAAS,GAAG,CAAC,GAAG,EACrB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,WAAW,GAAG,KAAK,EACnB,kBAAkB,GAAG,qBAAqB,EAC1C,eAAe,GAAG,KAAK,EACvB,gBAAgB,GAAG,KAAK,EACxB,oBAAoB,GAAG,KAAK,EAE5B,OAAO,EAAE,WAAW,CACnB,KAAK,EACL,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,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CAC3B,KAAK,SAAS,GAAG,CAAC,GAAG,EACrB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,wBAAwB,EACxB,WAAW,GAAG,KAAK,EACnB,kBAAkB,GAAG,qBAAqB,EAC1C,eAAe,GAAG,KAAK,EACvB,gBAAgB,GAAG,KAAK,EACxB,oBAAoB,GAAG,KAAK,EAE5B,WAAW,EAAE,MAAM,CAAC,MAAM,CACzB,kBAAkB,CACjB,KAAK,EACL,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,KAAK,EACL,KAAK,EACL,KAAK,EACL,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,CACpB,EACD,iBAAiB,EACjB,wBAAwB,CACxB,EACD,QAAQ,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,EACtE,UAAU,EAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;y7CAShF"}
|
package/dist/appDatabaseHttp.js
CHANGED
|
@@ -5,8 +5,9 @@ export function migratedHost(options, database) {
|
|
|
5
5
|
const services = Layer.mergeAll(options.services ?? Layer.empty);
|
|
6
6
|
return appHostHttp({ ...options, services: services.pipe(Layer.provideMerge(database)) });
|
|
7
7
|
}
|
|
8
|
-
export function deferredHost(application, database) {
|
|
9
|
-
// The application and the database it runs on build inside the host's one policy,
|
|
10
|
-
|
|
8
|
+
export function deferredHost(application, database, configured) {
|
|
9
|
+
// The application and the database it runs on build inside the host's one policy, which holds the configured names from the start,
|
|
10
|
+
// so whatever they log, fork or capture is masked too.
|
|
11
|
+
return redactedHost(configured, (sensitive) => Layer.unwrap(Effect.flatMap(application, (options) => Effect.as(sensitive.serve(options), servedHost(options, sensitive)))).pipe(Layer.provideMerge(database)));
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=appDatabaseHttp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appDatabaseHttp.js","sourceRoot":"","sources":["../src/appDatabaseHttp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAIvC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,UAAU,YAAY,CAe3B,OAeE,EACF,QAAsE;IAEtE,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IACjE,OAAO,WAAW,CAAC,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;AAC3F,CAAC;AAED,MAAM,UAAU,YAAY,CAiB3B,WAmBC,EACD,QAAsE;
|
|
1
|
+
{"version":3,"file":"appDatabaseHttp.js","sourceRoot":"","sources":["../src/appDatabaseHttp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAIvC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,UAAU,YAAY,CAe3B,OAeE,EACF,QAAsE;IAEtE,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IACjE,OAAO,WAAW,CAAC,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;AAC3F,CAAC;AAED,MAAM,UAAU,YAAY,CAiB3B,WAmBC,EACD,QAAsE,EACtE,UAAgF;IAEhF,mIAAmI;IACnI,uDAAuD;IACvD,OAAO,YAAY,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE,CAC7C,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAC/H,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAC5B,CACD,CAAC;AACH,CAAC"}
|
package/dist/appModules.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { AdminRegistry } from "@shivaedev/admin/registry.ts";
|
|
|
6
6
|
import { type AnyModule, type ModuleHandlers } from "@shivaedev/contract/moduleHandlers.ts";
|
|
7
7
|
import type { SchemaComponent } from "@shivaedev/sql/SchemaComponent.ts";
|
|
8
8
|
import type { AppModule, ModuleAdmin } from "#AppModule.ts";
|
|
9
|
-
import { DuplicateModuleQueue } from "#DuplicateModuleQueue.ts";
|
|
9
|
+
import type { DuplicateModuleQueue } from "#DuplicateModuleQueue.ts";
|
|
10
10
|
import type { ProvidedModules } from "#providedModules.ts";
|
|
11
11
|
import type { GlobalServices } from "#requestServices.ts";
|
|
12
12
|
type ModuleField<TModules, TKey extends PropertyKey> = TModules extends unknown ? (TKey extends keyof TModules ? TModules[TKey] : never) : never;
|
package/dist/appModules.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appModules.d.ts","sourceRoot":"","sources":["../src/appModules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAoB,MAAM,8BAA8B,CAAC;AAEpF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAkB,MAAM,uCAAuC,CAAC;AAC5G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAe,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"appModules.d.ts","sourceRoot":"","sources":["../src/appModules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAoB,MAAM,8BAA8B,CAAC;AAEpF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAkB,MAAM,uCAAuC,CAAC;AAC5G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAe,MAAM,eA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,eAAe,EAAE,KAAK,CAAC,KAAK,CACpC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,EAClD,KAAK,EACL,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CACnD,CAAC;IACF,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAC7B,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,EACvD,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,EACrD,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,aAAa,CACjI,CAAC;IACF,QAAQ,CAAC,UAAU,EAAE;QACpB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAClE,QAAQ,CAAC,UAAU,EAAE,SAAS,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;KAC3D,CAAC;CACF,EACD,oBAAoB,CACpB,CAAC"}
|
package/dist/appModules.js
CHANGED
|
@@ -2,44 +2,41 @@ import { Effect, Layer } from "effect";
|
|
|
2
2
|
import { RpcGroup } from "effect/rpc";
|
|
3
3
|
import { mergeAdminRegistrations } from "@shivaedev/admin/server/mergeAdminRegistrations.ts";
|
|
4
4
|
import { moduleHandlers } from "@shivaedev/contract/moduleHandlers.ts";
|
|
5
|
-
import {
|
|
5
|
+
import { moduleQueues } from "#moduleQueues.ts";
|
|
6
6
|
export function appModules(modules, options) {
|
|
7
7
|
return composeModules(modules, options);
|
|
8
8
|
}
|
|
9
9
|
const composeModules = Effect.fnUntraced(function* (modules, options) {
|
|
10
|
-
const
|
|
11
|
-
for (const module of modules) {
|
|
12
|
-
for (const queue of module.queues ?? []) {
|
|
13
|
-
const firstModule = owners.get(queue.name);
|
|
14
|
-
if (firstModule !== undefined) {
|
|
15
|
-
return yield* new DuplicateModuleQueue({ firstModule, queue: queue.name, secondModule: moduleName(module) });
|
|
16
|
-
}
|
|
17
|
-
owners.set(queue.name, moduleName(module));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const queues = modules.flatMap((module) => module.queues ?? []);
|
|
10
|
+
const queues = yield* moduleQueues(modules);
|
|
21
11
|
const registrations = modules.flatMap((module) => (module.admin === undefined ? [] : [module.admin]));
|
|
22
12
|
const admin = mergeAdminRegistrations(...registrations);
|
|
23
13
|
const defaults = Layer.mergeAll(Layer.empty, ...modules.map((module) => module.ports ?? Layer.empty));
|
|
24
14
|
const ports = Layer.merge(defaults, options?.replacements ?? Layer.empty);
|
|
25
15
|
return {
|
|
26
16
|
admin,
|
|
27
|
-
group: RpcGroup.make().merge(...modules.
|
|
28
|
-
|
|
29
|
-
handlers: Layer.mergeAll(admin.handlers, ...modules.map((module) => module.module === undefined
|
|
30
|
-
? module.handlers
|
|
31
|
-
: moduleHandlers({ "~requires": {}, application: module.module.application, declaration: module.module.declaration }))),
|
|
17
|
+
group: RpcGroup.make().merge(...modules.flatMap(servedGroup), admin.group),
|
|
18
|
+
handlers: Layer.mergeAll(admin.handlers, ...modules.flatMap(servedHandlers)),
|
|
32
19
|
migrations: {
|
|
33
20
|
components: modules.flatMap((module) => module.migrations?.components ?? []),
|
|
34
21
|
loader: Effect.all(modules.flatMap((module) => (module.migrations === undefined ? [] : [module.migrations.loader]))).pipe(Effect.map((entries) => entries.flat())),
|
|
35
22
|
},
|
|
36
23
|
queues,
|
|
37
24
|
requestServices: Layer.mergeAll(Layer.empty, ...modules.map((module) => module.requestServices ?? Layer.empty)),
|
|
38
|
-
services: Layer.mergeAll(Layer.empty, ...modules.map((module) => module.services)).pipe(Layer.provideMerge(ports)),
|
|
25
|
+
services: Layer.mergeAll(Layer.empty, ...modules.map((module) => module.services ?? Layer.empty)).pipe(Layer.provideMerge(ports)),
|
|
39
26
|
workers: Layer.mergeAll(Layer.empty, ...modules.map((module) => module.workers ?? Layer.empty)),
|
|
40
27
|
};
|
|
41
28
|
});
|
|
42
|
-
function
|
|
43
|
-
|
|
29
|
+
function servedGroup(module) {
|
|
30
|
+
if (module.module !== undefined) {
|
|
31
|
+
return [module.module];
|
|
32
|
+
}
|
|
33
|
+
return module.group === undefined ? [] : [module.group];
|
|
34
|
+
}
|
|
35
|
+
// The overload types each module's handlers from its operations' services; at run time moduleHandlers reads only its operations.
|
|
36
|
+
function servedHandlers(module) {
|
|
37
|
+
if (module.module !== undefined) {
|
|
38
|
+
return [moduleHandlers({ "~requires": {}, application: module.module.application, declaration: module.module.declaration })];
|
|
39
|
+
}
|
|
40
|
+
return module.handlers === undefined ? [] : [module.handlers];
|
|
44
41
|
}
|
|
45
42
|
//# sourceMappingURL=appModules.js.map
|
package/dist/appModules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appModules.js","sourceRoot":"","sources":["../src/appModules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,EAAuC,cAAc,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"appModules.js","sourceRoot":"","sources":["../src/appModules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,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;AAEH,SAAS,WAAW,CAAC,MAAiB;IACrC,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC;AAED,iIAAiI;AACjI,SAAS,cAAc,CAAC,MAAiB;IACxC,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,CAAC,cAAc,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAC9H,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -7,12 +7,14 @@ interface SensitiveSources<TRpcs extends Rpc.Any> {
|
|
|
7
7
|
};
|
|
8
8
|
readonly group?: RpcGroup.RpcGroup<TRpcs>;
|
|
9
9
|
}
|
|
10
|
-
export declare const hostSensitiveKeys: <TRpcs extends Rpc.Any>(
|
|
10
|
+
export declare const hostSensitiveKeys: <TRpcs extends Rpc.Any>(args_0: SensitiveSources<TRpcs>) => Effect.Effect<((key: string) => boolean) & {
|
|
11
11
|
complete: Effect.Effect<void, import("@shivaedev/errors/wireMask.ts").InvalidRedactionMask | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict, never>;
|
|
12
|
-
configure: <TConfigured extends Rpc.Any>(sources: SensitiveSources<TConfigured>) => Effect.Effect<void, import("@shivaedev/errors/wireMask.ts").InvalidRedactionMask | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict, never>;
|
|
13
12
|
forRpc: (tag: string | undefined) => (key: string) => boolean;
|
|
14
13
|
maskFailure: (tag: string | undefined, reason: "Fail" | "Die") => boolean;
|
|
15
14
|
redactFailure: (tag: string | undefined, reason: "Fail" | "Die", value: unknown) => unknown;
|
|
15
|
+
serve: <TServed extends Rpc.Any>(served: {
|
|
16
|
+
readonly group?: RpcGroup.RpcGroup<TServed>;
|
|
17
|
+
}) => Effect.Effect<void, import("@shivaedev/errors/wireMask.ts").InvalidRedactionMask | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict, never>;
|
|
16
18
|
}, import("@shivaedev/errors/wireMask.ts").InvalidRedactionMask | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict, HostModels>;
|
|
17
19
|
export {};
|
|
18
20
|
//# sourceMappingURL=hostSensitiveKeys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostSensitiveKeys.d.ts","sourceRoot":"","sources":["../src/hostSensitiveKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,KAAK,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,UAAU,gBAAgB,CAAC,KAAK,SAAS,GAAG,CAAC,GAAG;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;IACjE,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;CAC1C;
|
|
1
|
+
{"version":3,"file":"hostSensitiveKeys.d.ts","sourceRoot":"","sources":["../src/hostSensitiveKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,KAAK,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,UAAU,gBAAgB,CAAC,KAAK,SAAS,GAAG,CAAC,GAAG;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;IACjE,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;CAC1C;AAQD,eAAO,MAAM,iBAAiB,GAAgC,KAAK,SAAS,GAAG,CAAC,GAAG,2DAM1D,MAAM;;kBAUf,MAAM,GAAG,SAAS,WAElB,MAAM;uBAED,MAAM,GAAG,SAAS,UAAU,MAAM,GAAG,KAAK;yBACxC,MAAM,GAAG,SAAS,UAAU,MAAM,GAAG,KAAK,SAAS,OAAO;YACvE,OAAO,SAAS,GAAG,CAAC,GAAG,UAAU;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;KAAE;qJASxF,CAAC"}
|
|
@@ -2,40 +2,35 @@ import { Effect, MutableRef } from "effect";
|
|
|
2
2
|
import { RpcGroup } from "effect/rpc";
|
|
3
3
|
import { schemaSensitiveKeys } from "@shivaedev/errors/schemaSensitiveKeys.ts";
|
|
4
4
|
import { HostModels } from "#HostModels.ts";
|
|
5
|
-
function
|
|
6
|
-
return
|
|
7
|
-
compile: (extra) => (group === undefined ? schemaSensitiveKeys(RpcGroup.make(), extra) : schemaSensitiveKeys(group, extra)),
|
|
8
|
-
configured: config?.sensitiveKeys ?? [],
|
|
9
|
-
};
|
|
5
|
+
function compiler(group) {
|
|
6
|
+
return (extra) => (group === undefined ? schemaSensitiveKeys(RpcGroup.make(), extra) : schemaSensitiveKeys(group, extra));
|
|
10
7
|
}
|
|
11
|
-
export const hostSensitiveKeys = Effect.fnUntraced(function* (
|
|
12
|
-
const
|
|
8
|
+
export const hostSensitiveKeys = Effect.fnUntraced(function* ({ config, group }) {
|
|
9
|
+
const configured = config?.sensitiveKeys ?? [];
|
|
10
|
+
const compile = MutableRef.make(compiler(group));
|
|
13
11
|
// Model names only widen masking, so the configured policy already holds the startup's conflict verdict.
|
|
14
|
-
const current = MutableRef.make(yield* MutableRef.get(
|
|
12
|
+
const current = MutableRef.make(yield* MutableRef.get(compile)(configured));
|
|
15
13
|
const { fieldNames } = yield* HostModels;
|
|
16
14
|
function sensitive(key) {
|
|
17
15
|
return fieldNames.has(key) || MutableRef.get(current)(key);
|
|
18
16
|
}
|
|
19
17
|
return Object.assign(sensitive, {
|
|
20
|
-
// Repositories declare their models while the host builds them, and a deferred application names its RPC group
|
|
21
|
-
//
|
|
22
|
-
complete: Effect.suspend(() =>
|
|
23
|
-
const { compile, configured } = MutableRef.get(source);
|
|
24
|
-
return compile([...configured, ...fieldNames]);
|
|
25
|
-
}).pipe(Effect.map((completed) => MutableRef.set(current, completed)), Effect.asVoid),
|
|
26
|
-
configure: (sources) => Effect.suspend(() => {
|
|
27
|
-
const next = policySource(sources);
|
|
28
|
-
return Effect.map(next.compile(next.configured), (compiled) => {
|
|
29
|
-
MutableRef.set(source, next);
|
|
30
|
-
MutableRef.set(current, compiled);
|
|
31
|
-
});
|
|
32
|
-
}),
|
|
18
|
+
// Repositories declare their models while the host builds them, and a deferred application names its RPC group only when it returns,
|
|
19
|
+
// after running inside this policy: complete and serve recompile every RPC's policy from what is known then.
|
|
20
|
+
complete: Effect.suspend(() => MutableRef.get(compile)([...configured, ...fieldNames])).pipe(Effect.map((completed) => MutableRef.set(current, completed)), Effect.asVoid),
|
|
33
21
|
forRpc: (tag) => {
|
|
34
22
|
const forTag = MutableRef.get(current).forRpc(tag);
|
|
35
23
|
return (key) => fieldNames.has(key) || forTag(key);
|
|
36
24
|
},
|
|
37
25
|
maskFailure: (tag, reason) => MutableRef.get(current).maskFailure(tag, reason),
|
|
38
26
|
redactFailure: (tag, reason, value) => MutableRef.get(current).redactFailure(tag, reason, value),
|
|
27
|
+
serve: (served) => Effect.suspend(() => {
|
|
28
|
+
const next = compiler(served.group);
|
|
29
|
+
return Effect.map(next(configured), (compiled) => {
|
|
30
|
+
MutableRef.set(compile, next);
|
|
31
|
+
MutableRef.set(current, compiled);
|
|
32
|
+
});
|
|
33
|
+
}),
|
|
39
34
|
});
|
|
40
35
|
});
|
|
41
36
|
//# sourceMappingURL=hostSensitiveKeys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostSensitiveKeys.js","sourceRoot":"","sources":["../src/hostSensitiveKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAY,QAAQ,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"hostSensitiveKeys.js","sourceRoot":"","sources":["../src/hostSensitiveKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAY,QAAQ,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAS5C,SAAS,QAAQ,CAAwB,KAA2C;IACnF,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3H,CA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AC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5D,CAAC;QACD,WAAW,EAAE,CAAC,GAAuB,EAAE,MAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC;QAClH,aAAa,EAAE,CAAC,GAAuB,EAAE,MAAsB,EAAE,KAAc,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC;QAC7I,KAAK,EAAE,CAA0B,MAAuD,EAAE,EAAE,CAC3F,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE;YACnB,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACpC,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAChD,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAC9B,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC;KACH,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { AppModule } from "#AppModule.ts";
|
|
3
|
+
import { DuplicateModuleQueue } from "#DuplicateModuleQueue.ts";
|
|
4
|
+
export declare const moduleQueues: (modules: readonly AppModule[]) => Effect.Effect<{
|
|
5
|
+
readonly name: string;
|
|
6
|
+
}[], DuplicateModuleQueue, never>;
|
|
7
|
+
//# sourceMappingURL=moduleQueues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moduleQueues.d.ts","sourceRoot":"","sources":["../src/moduleQueues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAYhE,eAAO,MAAM,YAAY;;iCAmBvB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { DuplicateModuleQueue } from "#DuplicateModuleQueue.ts";
|
|
3
|
+
function queueOwner(module) {
|
|
4
|
+
const name = module.module === undefined ? module.name : module.module.declaration.name;
|
|
5
|
+
return { adminPage: name === undefined ? module.admin?.pages[0]?.id : undefined, name };
|
|
6
|
+
}
|
|
7
|
+
export const moduleQueues = Effect.fnUntraced(function* (modules) {
|
|
8
|
+
const owners = new Map();
|
|
9
|
+
for (const module of modules) {
|
|
10
|
+
for (const queue of module.queues ?? []) {
|
|
11
|
+
const first = owners.get(queue.name);
|
|
12
|
+
const second = queueOwner(module);
|
|
13
|
+
if (first !== undefined) {
|
|
14
|
+
return yield* new DuplicateModuleQueue({
|
|
15
|
+
firstAdminPage: first.adminPage,
|
|
16
|
+
firstModule: first.name,
|
|
17
|
+
queue: queue.name,
|
|
18
|
+
secondAdminPage: second.adminPage,
|
|
19
|
+
secondModule: second.name,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
owners.set(queue.name, second);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return modules.flatMap((module) => module.queues ?? []);
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=moduleQueues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moduleQueues.js","sourceRoot":"","sources":["../src/moduleQueues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAOhE,SAAS,UAAU,CAAC,MAA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EAAE,CAAC,CAAC;AACzD,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.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"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@shivaedev/contract": "0.58.0",
|
|
51
51
|
"@shivaedev/errors": "0.14.1",
|
|
52
52
|
"@shivaedev/http": "0.9.2",
|
|
53
|
-
"@shivaedev/identity": "0.
|
|
53
|
+
"@shivaedev/identity": "0.43.0",
|
|
54
54
|
"@shivaedev/local-postgres": "0.17.0",
|
|
55
55
|
"@shivaedev/sql": "0.55.0"
|
|
56
56
|
},
|
|
@@ -59,12 +59,12 @@
|
|
|
59
59
|
"@effect/sql-pg": "4.1.4",
|
|
60
60
|
"@effect/vitest": "4.1.4",
|
|
61
61
|
"@shivaedev/access": "0.7.0",
|
|
62
|
-
"@shivaedev/admin": "0.29.
|
|
62
|
+
"@shivaedev/admin": "0.29.6",
|
|
63
63
|
"@shivaedev/jobs": "0.44.1",
|
|
64
64
|
"@shivaedev/quality": "0.84.0",
|
|
65
65
|
"@shivaedev/rate-limit": "0.8.1",
|
|
66
66
|
"@shivaedev/service": "0.9.2",
|
|
67
|
-
"@shivaedev/test-kits": "0.16.
|
|
67
|
+
"@shivaedev/test-kits": "0.16.10",
|
|
68
68
|
"@shivaedev/test-sql": "0.26.1",
|
|
69
69
|
"@shivaedev/test-story": "0.52.5",
|
|
70
70
|
"@types/node": "24.19.2",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@effect/platform-node": "4.1.4",
|
|
79
79
|
"@effect/sql-pg": "4.1.4",
|
|
80
80
|
"@effect/vitest": "4.1.4",
|
|
81
|
-
"@shivaedev/admin": "0.29.
|
|
81
|
+
"@shivaedev/admin": "0.29.6",
|
|
82
82
|
"better-auth": "1.7.23",
|
|
83
83
|
"effect": "4.1.4"
|
|
84
84
|
},
|
package/src/AppHostInput.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Effect } from "effect";
|
|
2
2
|
import type { Rpc } from "effect/rpc";
|
|
3
|
-
import type { AppDatabaseOptions } from "#appDatabase.ts";
|
|
3
|
+
import type { AppDatabaseOptions, DatabaseConfig } from "#appDatabase.ts";
|
|
4
4
|
import type { AppHttpHostOptions } from "#appHost.ts";
|
|
5
5
|
import type { HostCoreOptions, HostPolicy, HostRouteRequirements, HostRoutes } from "#hostOptions.ts";
|
|
6
6
|
import type { HostPreflight } from "#hostPreflight.ts";
|
|
@@ -26,7 +26,9 @@ export type AppHostInput<
|
|
|
26
26
|
TRequestRequirements = never,
|
|
27
27
|
> = HostPreflight<TPreflight, TPreflightError, TPreflightRequirements> &
|
|
28
28
|
(
|
|
29
|
-
| (AppDatabaseOptions<TMigrations, TMigrationError> & {
|
|
29
|
+
| (Omit<AppDatabaseOptions<TMigrations, TMigrationError>, "config"> & {
|
|
30
|
+
// The host masks these names from the application Effect's first line, so the options it returns cannot list them again.
|
|
31
|
+
readonly config?: DatabaseConfig & { readonly sensitiveKeys?: readonly string[] };
|
|
30
32
|
readonly application: Effect.Effect<
|
|
31
33
|
AppHttpHostOptions<
|
|
32
34
|
TRpcs,
|
|
@@ -43,7 +45,7 @@ export type AppHostInput<
|
|
|
43
45
|
TRouteRequirements,
|
|
44
46
|
TRequestServices,
|
|
45
47
|
TRequestRequirements
|
|
46
|
-
|
|
48
|
+
> & { readonly config?: { readonly sensitiveKeys?: never } },
|
|
47
49
|
TApplicationError,
|
|
48
50
|
TApplicationRequirements
|
|
49
51
|
>;
|
package/src/AppModule.ts
CHANGED
|
@@ -13,12 +13,13 @@ interface ModuleParts {
|
|
|
13
13
|
readonly ports?: ModuleLayer;
|
|
14
14
|
readonly queues?: readonly { readonly name: string }[];
|
|
15
15
|
readonly requestServices?: Layer.Layer<never, never, unknown>;
|
|
16
|
-
readonly services
|
|
16
|
+
readonly services?: ModuleLayer;
|
|
17
17
|
readonly workers?: ModuleLayer;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
// "~requires" exists only on a defined module, so
|
|
20
|
+
// "~requires" exists only on a defined module, so the group form refuses one and it registers as `module:` instead.
|
|
21
21
|
// A defined module already carries its name, so its registration takes none that could disagree with it.
|
|
22
|
+
// A registration that serves no RPCs, such as one with only admin pages, queues or workers, names neither a group nor a module.
|
|
22
23
|
export type AppModule =
|
|
23
24
|
| (ModuleParts & {
|
|
24
25
|
readonly group: RpcGroup.Any & { readonly "~requires"?: never };
|
|
@@ -26,7 +27,8 @@ export type AppModule =
|
|
|
26
27
|
readonly module?: never;
|
|
27
28
|
readonly name: string;
|
|
28
29
|
})
|
|
29
|
-
| (ModuleParts & { readonly group?: never; readonly handlers?: never; readonly module: RegisteredModule; readonly name?: never })
|
|
30
|
+
| (ModuleParts & { readonly group?: never; readonly handlers?: never; readonly module: RegisteredModule; readonly name?: never })
|
|
31
|
+
| (ModuleParts & { readonly group?: never; readonly handlers?: never; readonly module?: never; readonly name?: string });
|
|
30
32
|
|
|
31
33
|
// A module's services exist only in its type, and appModules reads them from the registration's own type.
|
|
32
34
|
export type RegisteredModule = RpcGroup.Any & Pick<AnyModule, "application" | "declaration"> & { readonly "~requires": unknown };
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
|
+
function owner(name: string | undefined, adminPage: string | undefined) {
|
|
4
|
+
if (name !== undefined) {
|
|
5
|
+
return `"${name}"`;
|
|
6
|
+
}
|
|
7
|
+
return adminPage === undefined ? "a registration with no name" : `the registration of admin page "${adminPage}"`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// A registration without a name is found by its first admin page, and one with neither is only described.
|
|
3
11
|
export class DuplicateModuleQueue extends Schema.TaggedError<DuplicateModuleQueue>()("DuplicateModuleQueue", {
|
|
4
|
-
|
|
12
|
+
firstAdminPage: Schema.optional(Schema.String),
|
|
13
|
+
firstModule: Schema.optional(Schema.String),
|
|
5
14
|
queue: Schema.String,
|
|
6
|
-
|
|
15
|
+
secondAdminPage: Schema.optional(Schema.String),
|
|
16
|
+
secondModule: Schema.optional(Schema.String),
|
|
7
17
|
}) {
|
|
8
18
|
override get message() {
|
|
9
|
-
|
|
19
|
+
const first = owner(this.firstModule, this.firstAdminPage);
|
|
20
|
+
const second = owner(this.secondModule, this.secondAdminPage);
|
|
21
|
+
const unfound = [first, second].includes("a registration with no name")
|
|
22
|
+
? " Give the registration with no name a `name` so this message can name it."
|
|
23
|
+
: "";
|
|
24
|
+
return `Queue "${this.queue}" is declared by both ${first} and ${second}.${unfound}`;
|
|
10
25
|
}
|
|
11
26
|
}
|
package/src/appDatabase.ts
CHANGED
|
@@ -4,7 +4,6 @@ import * as Reactivity from "effect/reactivity/Reactivity";
|
|
|
4
4
|
import type { Rpc } from "effect/rpc";
|
|
5
5
|
import { liveServerLayer } from "@shivaedev/contract/live-server/layer.ts";
|
|
6
6
|
import { LiveServer } from "@shivaedev/contract/live-server/service.ts";
|
|
7
|
-
import { isSensitiveKey } from "@shivaedev/errors/sensitive.ts";
|
|
8
7
|
import { coordinateWorkerRelease } from "@shivaedev/sql/coordinateWorkerRelease.ts";
|
|
9
8
|
import { type PostgresChangesOptions, postgresChanges } from "@shivaedev/sql/postgresChanges.ts";
|
|
10
9
|
import { type PostgresOptions, postgresLayer } from "@shivaedev/sql/postgresLayer.ts";
|
|
@@ -132,10 +131,10 @@ export const appHost: AppHostFactory = <
|
|
|
132
131
|
TRequestRequirements
|
|
133
132
|
>,
|
|
134
133
|
) => {
|
|
135
|
-
const preflight = hostPreflight(options.preflight,
|
|
134
|
+
const preflight = hostPreflight(options.preflight, hostSensitiveKeys(options));
|
|
136
135
|
const hosted = Layer.merge(hostCrypto, hostModels());
|
|
137
136
|
if ("application" in options) {
|
|
138
|
-
return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(preflight), Layer.provide(hosted));
|
|
137
|
+
return deferredHost(options.application, appDatabase(options), options).pipe(Layer.provideMerge(preflight), Layer.provide(hosted));
|
|
139
138
|
}
|
|
140
139
|
return options.migrations === undefined
|
|
141
140
|
? appHostHttp(options).pipe(Layer.provideMerge(preflight), Layer.provide(hosted))
|
package/src/appDatabaseHttp.ts
CHANGED
|
@@ -82,10 +82,12 @@ export function deferredHost<
|
|
|
82
82
|
TApplicationRequirements
|
|
83
83
|
>,
|
|
84
84
|
database: ReturnType<typeof appDatabase<TMigrations, TMigrationError>>,
|
|
85
|
+
configured: { readonly config?: { readonly sensitiveKeys?: readonly string[] } },
|
|
85
86
|
) {
|
|
86
|
-
// The application and the database it runs on build inside the host's one policy,
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
// The application and the database it runs on build inside the host's one policy, which holds the configured names from the start,
|
|
88
|
+
// so whatever they log, fork or capture is masked too.
|
|
89
|
+
return redactedHost(configured, (sensitive) =>
|
|
90
|
+
Layer.unwrap(Effect.flatMap(application, (options) => Effect.as(sensitive.serve(options), servedHost(options, sensitive)))).pipe(
|
|
89
91
|
Layer.provideMerge(database),
|
|
90
92
|
),
|
|
91
93
|
);
|
package/src/appModules.ts
CHANGED
|
@@ -7,8 +7,9 @@ import { mergeAdminRegistrations } from "@shivaedev/admin/server/mergeAdminRegis
|
|
|
7
7
|
import { type AnyModule, type ModuleHandlers, moduleHandlers } from "@shivaedev/contract/moduleHandlers.ts";
|
|
8
8
|
import type { SchemaComponent } from "@shivaedev/sql/SchemaComponent.ts";
|
|
9
9
|
import type { AppModule, ModuleAdmin, ModuleLayer } from "#AppModule.ts";
|
|
10
|
-
import { DuplicateModuleQueue } from "#DuplicateModuleQueue.ts";
|
|
10
|
+
import type { DuplicateModuleQueue } from "#DuplicateModuleQueue.ts";
|
|
11
11
|
import type { MigrationOptions } from "#MigrationOptions.ts";
|
|
12
|
+
import { moduleQueues } from "#moduleQueues.ts";
|
|
12
13
|
import type { ProvidedModules } from "#providedModules.ts";
|
|
13
14
|
import type { GlobalServices } from "#requestServices.ts";
|
|
14
15
|
|
|
@@ -102,33 +103,15 @@ export function appModules(
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
const composeModules = Effect.fnUntraced(function* (modules: readonly AppModule[], options?: { readonly replacements?: ModuleLayer }) {
|
|
105
|
-
const
|
|
106
|
-
for (const module of modules) {
|
|
107
|
-
for (const queue of module.queues ?? []) {
|
|
108
|
-
const firstModule = owners.get(queue.name);
|
|
109
|
-
if (firstModule !== undefined) {
|
|
110
|
-
return yield* new DuplicateModuleQueue({ firstModule, queue: queue.name, secondModule: moduleName(module) });
|
|
111
|
-
}
|
|
112
|
-
owners.set(queue.name, moduleName(module));
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
const queues = modules.flatMap((module) => module.queues ?? []);
|
|
106
|
+
const queues = yield* moduleQueues(modules);
|
|
116
107
|
const registrations = modules.flatMap((module) => (module.admin === undefined ? [] : [module.admin]));
|
|
117
108
|
const admin = mergeAdminRegistrations(...registrations);
|
|
118
109
|
const defaults = Layer.mergeAll(Layer.empty, ...modules.map((module) => module.ports ?? Layer.empty));
|
|
119
110
|
const ports = Layer.merge(defaults, options?.replacements ?? Layer.empty);
|
|
120
111
|
return {
|
|
121
112
|
admin,
|
|
122
|
-
group: RpcGroup.make().merge(...modules.
|
|
123
|
-
|
|
124
|
-
handlers: Layer.mergeAll(
|
|
125
|
-
admin.handlers,
|
|
126
|
-
...modules.map((module) =>
|
|
127
|
-
module.module === undefined
|
|
128
|
-
? module.handlers
|
|
129
|
-
: moduleHandlers({ "~requires": {}, application: module.module.application, declaration: module.module.declaration }),
|
|
130
|
-
),
|
|
131
|
-
),
|
|
113
|
+
group: RpcGroup.make().merge(...modules.flatMap(servedGroup), admin.group),
|
|
114
|
+
handlers: Layer.mergeAll(admin.handlers, ...modules.flatMap(servedHandlers)),
|
|
132
115
|
migrations: {
|
|
133
116
|
components: modules.flatMap((module) => module.migrations?.components ?? []),
|
|
134
117
|
loader: Effect.all(modules.flatMap((module) => (module.migrations === undefined ? [] : [module.migrations.loader]))).pipe(
|
|
@@ -137,11 +120,22 @@ const composeModules = Effect.fnUntraced(function* (modules: readonly AppModule[
|
|
|
137
120
|
},
|
|
138
121
|
queues,
|
|
139
122
|
requestServices: Layer.mergeAll(Layer.empty, ...modules.map((module) => module.requestServices ?? Layer.empty)),
|
|
140
|
-
services: Layer.mergeAll(Layer.empty, ...modules.map((module) => module.services)).pipe(Layer.provideMerge(ports)),
|
|
123
|
+
services: Layer.mergeAll(Layer.empty, ...modules.map((module) => module.services ?? Layer.empty)).pipe(Layer.provideMerge(ports)),
|
|
141
124
|
workers: Layer.mergeAll(Layer.empty, ...modules.map((module) => module.workers ?? Layer.empty)),
|
|
142
125
|
};
|
|
143
126
|
});
|
|
144
127
|
|
|
145
|
-
function
|
|
146
|
-
|
|
128
|
+
function servedGroup(module: AppModule): readonly RpcGroup.Any[] {
|
|
129
|
+
if (module.module !== undefined) {
|
|
130
|
+
return [module.module];
|
|
131
|
+
}
|
|
132
|
+
return module.group === undefined ? [] : [module.group];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// The overload types each module's handlers from its operations' services; at run time moduleHandlers reads only its operations.
|
|
136
|
+
function servedHandlers(module: AppModule): readonly ModuleLayer[] {
|
|
137
|
+
if (module.module !== undefined) {
|
|
138
|
+
return [moduleHandlers({ "~requires": {}, application: module.module.application, declaration: module.module.declaration })];
|
|
139
|
+
}
|
|
140
|
+
return module.handlers === undefined ? [] : [module.handlers];
|
|
147
141
|
}
|
package/src/hostSensitiveKeys.ts
CHANGED
|
@@ -8,49 +8,41 @@ interface SensitiveSources<TRpcs extends Rpc.Any> {
|
|
|
8
8
|
readonly group?: RpcGroup.RpcGroup<TRpcs>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
readonly compile: (extra: readonly string[]) => ReturnType<typeof schemaSensitiveKeys>;
|
|
13
|
-
readonly configured: readonly string[];
|
|
14
|
-
}
|
|
11
|
+
type Compile = (extra: readonly string[]) => ReturnType<typeof schemaSensitiveKeys>;
|
|
15
12
|
|
|
16
|
-
function
|
|
17
|
-
return
|
|
18
|
-
compile: (extra) => (group === undefined ? schemaSensitiveKeys(RpcGroup.make(), extra) : schemaSensitiveKeys(group, extra)),
|
|
19
|
-
configured: config?.sensitiveKeys ?? [],
|
|
20
|
-
};
|
|
13
|
+
function compiler<TRpcs extends Rpc.Any>(group: RpcGroup.RpcGroup<TRpcs> | undefined): Compile {
|
|
14
|
+
return (extra) => (group === undefined ? schemaSensitiveKeys(RpcGroup.make(), extra) : schemaSensitiveKeys(group, extra));
|
|
21
15
|
}
|
|
22
16
|
|
|
23
|
-
export const hostSensitiveKeys = Effect.fnUntraced(function* <TRpcs extends Rpc.Any>(
|
|
24
|
-
const
|
|
17
|
+
export const hostSensitiveKeys = Effect.fnUntraced(function* <TRpcs extends Rpc.Any>({ config, group }: SensitiveSources<TRpcs>) {
|
|
18
|
+
const configured = config?.sensitiveKeys ?? [];
|
|
19
|
+
const compile = MutableRef.make(compiler(group));
|
|
25
20
|
// Model names only widen masking, so the configured policy already holds the startup's conflict verdict.
|
|
26
|
-
const current = MutableRef.make(yield* MutableRef.get(
|
|
21
|
+
const current = MutableRef.make(yield* MutableRef.get(compile)(configured));
|
|
27
22
|
const { fieldNames } = yield* HostModels;
|
|
28
23
|
function sensitive(key: string) {
|
|
29
24
|
return fieldNames.has(key) || MutableRef.get(current)(key);
|
|
30
25
|
}
|
|
31
26
|
return Object.assign(sensitive, {
|
|
32
|
-
// Repositories declare their models while the host builds them, and a deferred application names its RPC group
|
|
33
|
-
//
|
|
34
|
-
complete: Effect.suspend(() =>
|
|
35
|
-
const { compile, configured } = MutableRef.get(source);
|
|
36
|
-
return compile([...configured, ...fieldNames]);
|
|
37
|
-
}).pipe(
|
|
27
|
+
// Repositories declare their models while the host builds them, and a deferred application names its RPC group only when it returns,
|
|
28
|
+
// after running inside this policy: complete and serve recompile every RPC's policy from what is known then.
|
|
29
|
+
complete: Effect.suspend(() => MutableRef.get(compile)([...configured, ...fieldNames])).pipe(
|
|
38
30
|
Effect.map((completed) => MutableRef.set(current, completed)),
|
|
39
31
|
Effect.asVoid,
|
|
40
32
|
),
|
|
41
|
-
configure: <TConfigured extends Rpc.Any>(sources: SensitiveSources<TConfigured>) =>
|
|
42
|
-
Effect.suspend(() => {
|
|
43
|
-
const next = policySource(sources);
|
|
44
|
-
return Effect.map(next.compile(next.configured), (compiled) => {
|
|
45
|
-
MutableRef.set(source, next);
|
|
46
|
-
MutableRef.set(current, compiled);
|
|
47
|
-
});
|
|
48
|
-
}),
|
|
49
33
|
forRpc: (tag: string | undefined) => {
|
|
50
34
|
const forTag = MutableRef.get(current).forRpc(tag);
|
|
51
35
|
return (key: string) => fieldNames.has(key) || forTag(key);
|
|
52
36
|
},
|
|
53
37
|
maskFailure: (tag: string | undefined, reason: "Fail" | "Die") => MutableRef.get(current).maskFailure(tag, reason),
|
|
54
38
|
redactFailure: (tag: string | undefined, reason: "Fail" | "Die", value: unknown) => MutableRef.get(current).redactFailure(tag, reason, value),
|
|
39
|
+
serve: <TServed extends Rpc.Any>(served: { readonly group?: RpcGroup.RpcGroup<TServed> }) =>
|
|
40
|
+
Effect.suspend(() => {
|
|
41
|
+
const next = compiler(served.group);
|
|
42
|
+
return Effect.map(next(configured), (compiled) => {
|
|
43
|
+
MutableRef.set(compile, next);
|
|
44
|
+
MutableRef.set(current, compiled);
|
|
45
|
+
});
|
|
46
|
+
}),
|
|
55
47
|
});
|
|
56
48
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { AppModule } from "#AppModule.ts";
|
|
3
|
+
import { DuplicateModuleQueue } from "#DuplicateModuleQueue.ts";
|
|
4
|
+
|
|
5
|
+
interface QueueOwner {
|
|
6
|
+
readonly adminPage: string | undefined;
|
|
7
|
+
readonly name: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function queueOwner(module: AppModule): QueueOwner {
|
|
11
|
+
const name = module.module === undefined ? module.name : module.module.declaration.name;
|
|
12
|
+
return { adminPage: name === undefined ? module.admin?.pages[0]?.id : undefined, name };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const moduleQueues = Effect.fnUntraced(function* (modules: readonly AppModule[]) {
|
|
16
|
+
const owners = new Map<string, QueueOwner>();
|
|
17
|
+
for (const module of modules) {
|
|
18
|
+
for (const queue of module.queues ?? []) {
|
|
19
|
+
const first = owners.get(queue.name);
|
|
20
|
+
const second = queueOwner(module);
|
|
21
|
+
if (first !== undefined) {
|
|
22
|
+
return yield* new DuplicateModuleQueue({
|
|
23
|
+
firstAdminPage: first.adminPage,
|
|
24
|
+
firstModule: first.name,
|
|
25
|
+
queue: queue.name,
|
|
26
|
+
secondAdminPage: second.adminPage,
|
|
27
|
+
secondModule: second.name,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
owners.set(queue.name, second);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return modules.flatMap((module) => module.queues ?? []);
|
|
34
|
+
});
|