@shivaedev/server 0.44.1 → 0.45.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 +18 -0
- package/README.md +3 -3
- package/dist/AppHostInput.d.ts +10 -3
- package/dist/AppHostInput.d.ts.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/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/package.json +5 -5
- package/src/AppHostInput.ts +5 -3
- package/src/appDatabase.ts +2 -3
- package/src/appDatabaseHttp.ts +5 -3
- package/src/hostSensitiveKeys.ts +18 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.45.0 - 2026-11-21
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
### Breaking
|
|
10
|
+
|
|
11
|
+
- 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`.
|
|
12
|
+
- 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.
|
|
13
|
+
|
|
14
|
+
## 0.44.2 - 2026-11-21
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Update `@shivaedev/admin` from 0.29.3 to 0.29.4.
|
|
19
|
+
- Update `@shivaedev/identity` from 0.41.0 to 0.42.0.
|
|
20
|
+
|
|
3
21
|
## 0.44.1 - 2026-11-21
|
|
4
22
|
|
|
5
23
|
### Changed
|
package/README.md
CHANGED
|
@@ -284,13 +284,13 @@ The host provides the `effect/crypto` services of `NodeCrypto.layer` from `@effe
|
|
|
284
284
|
|
|
285
285
|
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
286
|
|
|
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
|
|
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 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
288
|
|
|
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.
|
|
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 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
290
|
|
|
291
291
|
```ts
|
|
292
292
|
const host = appHost({
|
|
293
|
-
config: { databaseUrl },
|
|
293
|
+
config: { databaseUrl, sensitiveKeys: ["customerReference"] },
|
|
294
294
|
postgresSettings: {},
|
|
295
295
|
migrations: { loader: migrations, mode: "check" },
|
|
296
296
|
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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ACpB,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"}
|
|
@@ -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,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAElG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK;IACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;CAC5C;AAED,MAAM,WAAW,cAAe,SAAQ,eAAe;IACtD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,QAAQ,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC;IAClI,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CACvD;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,8oBAqD1E;AAED,eAAO,MAAM,OAAO,EAAE,cAoDrB,CAAC"}
|
package/dist/appDatabase.js
CHANGED
|
@@ -3,7 +3,6 @@ import { Clock, Config, Context, Effect, Layer, Option, Redacted } from "effect"
|
|
|
3
3
|
import * as Reactivity from "effect/reactivity/Reactivity";
|
|
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;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"appDatabase.js","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,yBA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,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,EAChB,oBAAoB,CACpB,GACA,UAAU,GAAG;IACZ,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;CACpE,EACF,QAAQ,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,WAAW,EAAE,e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BAAkB,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"}
|
|
@@ -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,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAyB,EAAE,MAAM,EAAE,KAAK,EAA2B;IAC9H,MAAM,UAAU,GAAG,MAAM,EAAE,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O,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.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.42.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.5",
|
|
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.9",
|
|
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.5",
|
|
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/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/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
|
});
|