@shivaedev/server 0.43.0 → 0.44.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +2 -2
  3. package/dist/HostModels.d.ts +9 -0
  4. package/dist/HostModels.d.ts.map +1 -0
  5. package/dist/HostModels.js +27 -0
  6. package/dist/HostModels.js.map +1 -0
  7. package/dist/appDatabase.d.ts +1 -2
  8. package/dist/appDatabase.d.ts.map +1 -1
  9. package/dist/appDatabase.js +6 -9
  10. package/dist/appDatabase.js.map +1 -1
  11. package/dist/appDatabaseHttp.d.ts +68 -68
  12. package/dist/appDatabaseHttp.d.ts.map +1 -1
  13. package/dist/appHost.d.ts +34 -34
  14. package/dist/appHost.d.ts.map +1 -1
  15. package/dist/appHost.js +2 -1
  16. package/dist/appHost.js.map +1 -1
  17. package/dist/appHostHttp.d.ts +34 -34
  18. package/dist/appHostHttp.d.ts.map +1 -1
  19. package/dist/defaultChangesChannel.d.ts +4 -0
  20. package/dist/defaultChangesChannel.d.ts.map +1 -0
  21. package/dist/defaultChangesChannel.js +8 -0
  22. package/dist/defaultChangesChannel.js.map +1 -0
  23. package/dist/hostPreflight.d.ts +3 -2
  24. package/dist/hostPreflight.d.ts.map +1 -1
  25. package/dist/hostPreflight.js.map +1 -1
  26. package/dist/hostSensitiveKeys.d.ts +2 -7
  27. package/dist/hostSensitiveKeys.d.ts.map +1 -1
  28. package/dist/hostSensitiveKeys.js +5 -12
  29. package/dist/hostSensitiveKeys.js.map +1 -1
  30. package/dist/nativeClientOrigins.d.ts.map +1 -1
  31. package/dist/nativeClientOrigins.js +3 -1
  32. package/dist/nativeClientOrigins.js.map +1 -1
  33. package/dist/redactedHost.d.ts +1 -1
  34. package/dist/redactedHost.d.ts.map +1 -1
  35. package/dist/redactedHost.js +3 -14
  36. package/dist/redactedHost.js.map +1 -1
  37. package/dist/workerHost.d.ts +1 -1
  38. package/dist/workerHost.d.ts.map +1 -1
  39. package/dist/workerHost.js +2 -1
  40. package/dist/workerHost.js.map +1 -1
  41. package/package.json +6 -6
  42. package/src/HostModels.ts +30 -0
  43. package/src/appDatabase.ts +6 -10
  44. package/src/appHost.ts +6 -1
  45. package/src/defaultChangesChannel.ts +8 -0
  46. package/src/hostPreflight.ts +4 -3
  47. package/src/hostSensitiveKeys.ts +5 -13
  48. package/src/nativeClientOrigins.ts +4 -1
  49. package/src/redactedHost.ts +2 -18
  50. package/src/workerHost.ts +2 -1
@@ -1,7 +1,7 @@
1
1
  import { Effect, MutableRef } from "effect";
2
2
  import { RpcGroup } from "effect/rpc";
3
- import { schemaFieldKeys } from "@shivaedev/errors/schemaFieldScope.ts";
4
3
  import { schemaSensitiveKeys } from "@shivaedev/errors/schemaSensitiveKeys.ts";
4
+ import { HostModels } from "#HostModels.ts";
5
5
  export const hostSensitiveKeys = Effect.fnUntraced(function* (options) {
6
6
  const configured = options.config?.sensitiveKeys ?? [];
7
7
  function policy(extra) {
@@ -9,25 +9,18 @@ export const hostSensitiveKeys = Effect.fnUntraced(function* (options) {
9
9
  }
10
10
  // Model names only widen masking, so the configured policy already holds the startup's conflict verdict.
11
11
  const current = MutableRef.make(yield* policy(configured));
12
- const models = new Set();
12
+ const { fieldNames } = yield* HostModels;
13
13
  function sensitive(key) {
14
- return models.has(key) || MutableRef.get(current)(key);
14
+ return fieldNames.has(key) || MutableRef.get(current)(key);
15
15
  }
16
16
  return Object.assign(sensitive, {
17
17
  // Repositories declare their models while the host builds them; complete recompiles every RPC's policy with their names, as config.sensitiveKeys.
18
- complete: Effect.suspend(() => policy([...configured, ...models])).pipe(Effect.map((completed) => MutableRef.set(current, completed)), Effect.asVoid),
18
+ complete: Effect.suspend(() => policy([...configured, ...fieldNames])).pipe(Effect.map((completed) => MutableRef.set(current, completed)), Effect.asVoid),
19
19
  forRpc: (tag) => {
20
20
  const forTag = MutableRef.get(current).forRpc(tag);
21
- return (key) => models.has(key) || forTag(key);
21
+ return (key) => fieldNames.has(key) || forTag(key);
22
22
  },
23
23
  maskFailure: (tag, reason) => MutableRef.get(current).maskFailure(tag, reason),
24
- models: {
25
- declare: (model) => Effect.sync(() => {
26
- for (const key of schemaFieldKeys(model.ast, [])) {
27
- models.add(key);
28
- }
29
- }),
30
- },
31
24
  redactFailure: (tag, reason, value) => MutableRef.get(current).redactFailure(tag, reason, value),
32
25
  });
33
26
  });
@@ -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,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAyB,OAGpF;IACA,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,aAAa,IAAI,EAAE,CAAC;IACvD,SAAS,MAAM,CAAC,KAAwB;QACvC,OAAO,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9H,CAAC;IACD,yGAAyG;IACzG,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,SAAS,SAAS,CAAC,GAAW;QAC7B,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,UAAU,CA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E,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAC1E,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,EAC7D,MAAM,CAAC,MAAM,CACb;QACD,MAAM,EAAE,CAAC,GAAuB,EAAE,EAAE;YACnC,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACnD,OAAO,CAAC,GAAW,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,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;KAC7I,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"nativeClientOrigins.d.ts","sourceRoot":"","sources":["../src/nativeClientOrigins.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,UAAU,EAAyC,MAAM,aAAa,CAAC;AAKzG,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,GAAE,UAAU,CAAC,SAAkB,qDAsBlI"}
1
+ {"version":3,"file":"nativeClientOrigins.d.ts","sourceRoot":"","sources":["../src/nativeClientOrigins.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,UAAU,EAAyC,MAAM,aAAa,CAAC;AAMzG,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,GAAE,UAAU,CAAC,SAAkB,qDAsBlI"}
@@ -1,6 +1,7 @@
1
1
  import { Effect, Option } from "effect";
2
2
  import { Headers, HttpMiddleware, HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
3
3
  import * as HttpStatus from "effect/http/HttpStatus";
4
+ import { accountPreferenceHeaders } from "@shivaedev/identity/accountPreferenceHeaders.ts";
4
5
  import { localTransport } from "@shivaedev/identity/server/adapters/local.ts";
5
6
  import { SessionPolicy } from "@shivaedev/identity/server/SessionPolicy.ts";
6
7
  export function nativeClientOrigins(trustedProxy, route, rpcPath = "/rpc") {
@@ -24,6 +25,7 @@ export function nativeClientOrigins(trustedProxy, route, rpcPath = "/rpc") {
24
25
  return yield* withClientCors(effect, native, declared, auth);
25
26
  })).layer;
26
27
  }
28
+ const CLIENT_HEADERS = ["Authorization", "Content-Type"];
27
29
  const withClientCors = Effect.fnUntraced(function* (effect, nativeOrigins, declared, auth) {
28
30
  const request = yield* HttpServerRequest.HttpServerRequest;
29
31
  const origin = request.headers.origin ?? "";
@@ -34,7 +36,7 @@ const withClientCors = Effect.fnUntraced(function* (effect, nativeOrigins, decla
34
36
  }
35
37
  const transport = native ? request.modify({ headers: Headers.remove(request.headers, "cookie") }) : request;
36
38
  return yield* HttpMiddleware.cors({
37
- allowedHeaders: ["Authorization", "Content-Type"],
39
+ allowedHeaders: auth ? [...CLIENT_HEADERS, ...Object.values(accountPreferenceHeaders)] : CLIENT_HEADERS,
38
40
  allowedMethods: auth ? ["GET", "POST"] : ["POST"],
39
41
  allowedOrigins: [origin],
40
42
  credentials: credentialed,
@@ -1 +1 @@
1
- {"version":3,"file":"nativeClientOrigins.js","sourceRoot":"","sources":["../src/nativeClientOrigins.ts"],"names":[],"mappings":"A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C,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACjD,cAAc,EAAE,CAAC,MAAM,CAAC;QACxB,WAAW,EAAE,YAAY;QACzB,cAAc,EAAE,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE;KACxD,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC;AACxF,CAAC,CAAC,CAAC"}
@@ -7,5 +7,5 @@ export declare function redactedHost<TRpcs extends Rpc.Any, A, E, R>(options: {
7
7
  readonly config?: {
8
8
  readonly sensitiveKeys?: readonly string[];
9
9
  };
10
- }, host: (sensitive: HostSensitivePolicy) => Layer.Layer<A, E, R>): Layer.Layer<A, E | import("effect/Config").ConfigError | import("@shivaedev/errors/wireMask.ts").InvalidRedactionMask | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict, Exclude<Exclude<Exclude<Exclude<R, never>, never>, never>, never>>;
10
+ }, host: (sensitive: HostSensitivePolicy) => Layer.Layer<A, E, R>): Layer.Layer<A, E | import("effect/Config").ConfigError | import("@shivaedev/errors/wireMask.ts").InvalidRedactionMask | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict, import("./HostModels.ts").HostModels | Exclude<Exclude<Exclude<R, never>, never>, never>>;
11
11
  //# sourceMappingURL=redactedHost.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"redactedHost.d.ts","sourceRoot":"","sources":["../src/redactedHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,QAAQ,CAAC;AAC/C,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;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SAAS,EAAE,mBAAmB,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,6RAW9D"}
@@ -1,21 +1,10 @@
1
- import { Effect, Layer, Schema } from "effect";
2
- import { collectRepositoryModels, RepositoryModels } from "@shivaedev/sql/RepositoryModels.ts";
1
+ import { Effect, Layer } from "effect";
3
2
  import { redactingDiagnostics } from "#adapters/redactingDiagnostics.ts";
4
3
  import { hostSensitiveKeys } from "#hostSensitiveKeys.ts";
5
4
  import { otlpTracing } from "#otlpTracing.ts";
6
5
  import { RedactionPolicy } from "#RedactionPolicy.ts";
7
- // Sql's collector keeps the owned models; the host also hands each model to the policy that masks its sensitive fields.
8
- function maskedModels(sensitive) {
9
- return Layer.effect(RepositoryModels, Effect.gen(function* () {
10
- const collected = yield* RepositoryModels;
11
- return RepositoryModels.of({
12
- declare: (declared) => Effect.andThen(sensitive.models.declare(Schema.Struct(declared.model.fields)), collected.declare(declared)),
13
- owned: collected.owned,
14
- });
15
- })).pipe(Layer.provide(collectRepositoryModels));
16
- }
17
- // Both hosts build their process inside one policy, so repositories declare their models to the same policy that masks every log, error report and exported span.
6
+ // Both hosts build their process inside one policy, so every log, error report and exported span masks the same names, including the fields their repositories' models declare.
18
7
  export function redactedHost(options, host) {
19
- return Layer.unwrap(Effect.map(hostSensitiveKeys(options), (sensitive) => host(sensitive).pipe(Layer.provide(redactingDiagnostics(sensitive)), Layer.provide(otlpTracing), Layer.provide(Layer.succeed(RedactionPolicy, sensitive)), Layer.provide(maskedModels(sensitive)))));
8
+ return Layer.unwrap(Effect.map(hostSensitiveKeys(options), (sensitive) => host(sensitive).pipe(Layer.provide(redactingDiagnostics(sensitive)), Layer.provide(otlpTracing), Layer.provide(Layer.succeed(RedactionPolicy, sensitive)))));
20
9
  }
21
10
  //# sourceMappingURL=redactedHost.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"redactedHost.js","sourceRoot":"","sources":["../src/redactedHost.ts"],"names":[],"mappings":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CAAC,SAAS,CAAC,CAAC,EAC9C,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAC1B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,EACxD,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CACtC,CACD,CACD,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"redactedHost.js","sourceRoot":"","sources":["../src/redactedHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAItD,gLAAgL;AAChL,MAAM,UAAU,YAAY,CAC3B,OAAwH,EACxH,IAA8D;IAE9D,OAAO,KAAK,CAAC,MAAM,CAClB,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,CACpD,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CACnB,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,EAC9C,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAC1B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,CACxD,CACD,CACD,CAAC;AACH,CAAC"}
@@ -7,5 +7,5 @@ export declare function workerHost<R, E, TRequirements, TServices, TServiceError
7
7
  readonly config?: WorkerHostConfig;
8
8
  readonly workers: Layer.Layer<R, E, TRequirements>;
9
9
  readonly services: Layer.Layer<TServices, TServiceError, TServiceRequirements>;
10
- }): Layer.Layer<"@shivaedev/contract/LiveServer" | R | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient, E | TMigrationError | TServiceError | import("effect/Config").ConfigError | import("@shivaedev/errors/wireMask.ts").InvalidRedactionMask | import("effect/sql/Migrator").MigrationError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict | import("effect/sql/SqlError").SqlError, Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, never>, never>, never>, never>, import("effect/crypto/Aead").Aead | import("effect/crypto/Cipher").Cipher | import("@shivaedev/sql/ColumnKey.ts").ColumnKey | import("effect/crypto/Digest").Digest | import("effect/crypto/Kdf").Kdf | import("effect/crypto/KeyAgreement").KeyAgreement | import("effect/crypto/KeyWrap").KeyWrap | import("effect/crypto/Mac").Mac | import("effect/crypto/SecureRandom").SecureRandom | import("effect/crypto/Signature").Signature> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, never>, never>, never>, never>, import("effect/crypto/Aead").Aead | import("effect/crypto/Cipher").Cipher | import("@shivaedev/sql/ColumnKey.ts").ColumnKey | import("effect/crypto/Digest").Digest | import("effect/crypto/Kdf").Kdf | import("effect/crypto/KeyAgreement").KeyAgreement | import("effect/crypto/KeyWrap").KeyWrap | import("effect/crypto/Mac").Mac | import("effect/crypto/SecureRandom").SecureRandom | import("effect/crypto/Signature").Signature> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TRequirements, TServices>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, never>, never>, never>, never>, import("effect/crypto/Aead").Aead | import("effect/crypto/Cipher").Cipher | import("@shivaedev/sql/ColumnKey.ts").ColumnKey | import("effect/crypto/Digest").Digest | import("effect/crypto/Kdf").Kdf | import("effect/crypto/KeyAgreement").KeyAgreement | import("effect/crypto/KeyWrap").KeyWrap | import("effect/crypto/Mac").Mac | import("effect/crypto/SecureRandom").SecureRandom | import("effect/crypto/Signature").Signature>>;
10
+ }): Layer.Layer<"@shivaedev/contract/LiveServer" | R | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient, E | TMigrationError | TServiceError | import("effect/Config").ConfigError | import("@shivaedev/errors/wireMask.ts").InvalidRedactionMask | import("effect/sql/Migrator").MigrationError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict | import("effect/sql/SqlError").SqlError, Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, never>, never>, never>, import("effect/crypto/Aead").Aead | import("effect/crypto/Cipher").Cipher | import("@shivaedev/sql/ColumnKey.ts").ColumnKey | import("effect/crypto/Digest").Digest | import("effect/crypto/Kdf").Kdf | import("effect/crypto/KeyAgreement").KeyAgreement | import("effect/crypto/KeyWrap").KeyWrap | import("effect/crypto/Mac").Mac | import("effect/crypto/SecureRandom").SecureRandom | import("effect/crypto/Signature").Signature>, import("#HostModels.ts").HostModels> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, never>, never>, never>, import("effect/crypto/Aead").Aead | import("effect/crypto/Cipher").Cipher | import("@shivaedev/sql/ColumnKey.ts").ColumnKey | import("effect/crypto/Digest").Digest | import("effect/crypto/Kdf").Kdf | import("effect/crypto/KeyAgreement").KeyAgreement | import("effect/crypto/KeyWrap").KeyWrap | import("effect/crypto/Mac").Mac | import("effect/crypto/SecureRandom").SecureRandom | import("effect/crypto/Signature").Signature>, import("#HostModels.ts").HostModels> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TRequirements, TServices>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, never>, never>, never>, import("effect/crypto/Aead").Aead | import("effect/crypto/Cipher").Cipher | import("@shivaedev/sql/ColumnKey.ts").ColumnKey | import("effect/crypto/Digest").Digest | import("effect/crypto/Kdf").Kdf | import("effect/crypto/KeyAgreement").KeyAgreement | import("effect/crypto/KeyWrap").KeyWrap | import("effect/crypto/Mac").Mac | import("effect/crypto/SecureRandom").SecureRandom | import("effect/crypto/Signature").Signature>, import("#HostModels.ts").HostModels>>;
11
11
  //# sourceMappingURL=workerHost.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workerHost.d.ts","sourceRoot":"","sources":["../src/workerHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,KAAK,kBAAkB,EAAe,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAI5F,MAA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CAAC;IACnD,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,aAAa,EAAE,oBAAoB,CAAC,CAAC;CAC/E,g9FAWD"}
@@ -1,10 +1,11 @@
1
1
  import { Effect, Layer } from "effect";
2
2
  import { appDatabase } from "#appDatabase.ts";
3
+ import { hostModels } from "#HostModels.ts";
3
4
  import { hostCrypto } from "#hostCrypto.ts";
4
5
  import { redactedHost } from "#redactedHost.ts";
5
6
  export function workerHost(options) {
6
7
  // A worker serves no RPC group, so its policy holds the built-in rules, config.sensitiveKeys and the models its repositories declare as they are built.
7
8
  // The host announces readiness itself: an effect composed around the returned Layer runs outside its policy and exporter.
8
- return redactedHost(options, () => Layer.effectDiscard(Effect.logInfo("Worker ready to take jobs")).pipe(Layer.provideMerge(options.workers), Layer.provideMerge(options.services), Layer.provideMerge(appDatabase(options)))).pipe(Layer.provide(hostCrypto));
9
+ return redactedHost(options, () => Layer.effectDiscard(Effect.logInfo("Worker ready to take jobs")).pipe(Layer.provideMerge(options.workers), Layer.provideMerge(options.services), Layer.provideMerge(appDatabase(options)))).pipe(Layer.provide(hostCrypto), Layer.provide(hostModels()));
9
10
  }
10
11
  //# sourceMappingURL=workerHost.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workerHost.js","sourceRoot":"","sources":["../src/workerHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAA2B,WAAW,EAAuB,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAMhD,MAAM,UAAU,UAAU,CACzB,OAIC;IAED,wJAAwJ;IACxJ,0HAA0H;IAC1H,OAAO,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,CACjC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAI,CACpE,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,EACnC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,EACpC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CACxC,CACD,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AACnC,CAAC"}
1
+ {"version":3,"file":"workerHost.js","sourceRoot":"","sources":["../src/workerHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAA2B,WAAW,EAAuB,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAMhD,MAAM,UAAU,UAAU,CACzB,OAIC;IAED,wJAAwJ;IACxJ,0HAA0H;IAC1H,OAAO,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,CACjC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAI,CACpE,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,EACnC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,EACpC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CACxC,CACD,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;AAChE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/server",
3
- "version": "0.43.0",
3
+ "version": "0.44.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.40.0",
53
+ "@shivaedev/identity": "0.41.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.2",
62
+ "@shivaedev/admin": "0.29.3",
63
63
  "@shivaedev/jobs": "0.44.1",
64
- "@shivaedev/quality": "0.83.4",
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.5",
67
+ "@shivaedev/test-kits": "0.16.6",
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.2",
81
+ "@shivaedev/admin": "0.29.3",
82
82
  "better-auth": "1.7.23",
83
83
  "effect": "4.1.4"
84
84
  },
@@ -0,0 +1,30 @@
1
+ import { Context, Effect, Layer, Schema } from "effect";
2
+ import { schemaFieldKeys } from "@shivaedev/errors/schemaFieldScope.ts";
3
+ import { collectRepositoryModels, type RepositoryModel, RepositoryModels } from "@shivaedev/sql/RepositoryModels.ts";
4
+
5
+ // The field names of every model the host's repositories declare, which its redaction policy masks.
6
+ export class HostModels extends Context.Service<HostModels, { readonly fieldNames: ReadonlySet<string> }>()("@shivaedev/server/HostModels") {}
7
+
8
+ function recordFields(fieldNames: Set<string>, { model }: RepositoryModel) {
9
+ return Effect.sync(() => {
10
+ for (const key of schemaFieldKeys(Schema.Struct(model.fields).ast, [])) {
11
+ fieldNames.add(key);
12
+ }
13
+ });
14
+ }
15
+
16
+ // Each host provides its own collector around everything it builds, including a deferred application Effect, so a
17
+ // repository built there reports its owned models and sensitive fields to the same host that serves and masks them.
18
+ export function hostModels() {
19
+ return Layer.effectContext(
20
+ Effect.gen(function* () {
21
+ const collected = yield* RepositoryModels;
22
+ const fieldNames = new Set<string>();
23
+ const models = RepositoryModels.of({
24
+ declare: (declared) => Effect.andThen(recordFields(fieldNames, declared), collected.declare(declared)),
25
+ owned: collected.owned,
26
+ });
27
+ return Context.make(HostModels, { fieldNames }).pipe(Context.add(RepositoryModels, models));
28
+ }),
29
+ ).pipe(Layer.provide(Layer.fresh(collectRepositoryModels)));
30
+ }
@@ -1,6 +1,5 @@
1
1
  import * as PgClient from "@effect/sql-pg/PgClient";
2
2
  import { Clock, Config, Context, Effect, Layer, Option, Redacted } from "effect";
3
- import { Digest } from "effect/crypto";
4
3
  import * as Reactivity from "effect/reactivity/Reactivity";
5
4
  import type { Rpc } from "effect/rpc";
6
5
  import { liveServerLayer } from "@shivaedev/contract/live-server/layer.ts";
@@ -15,6 +14,8 @@ import type { AppHostFactory } from "#AppHostFactory.ts";
15
14
  import type { AppHostInput } from "#AppHostInput.ts";
16
15
  import { deferredHost, migratedHost } from "#appDatabaseHttp.ts";
17
16
  import { appHostHttp } from "#appHostHttp.ts";
17
+ import { defaultChangesChannel } from "#defaultChangesChannel.ts";
18
+ import { hostModels } from "#HostModels.ts";
18
19
  import { hostCrypto } from "#hostCrypto.ts";
19
20
  import type { HostRouteRequirements } from "#hostOptions.ts";
20
21
  import { hostPreflight } from "#hostPreflight.ts";
@@ -90,12 +91,6 @@ export function appDatabase<R, E = never>(options: AppDatabaseOptions<R, E>) {
90
91
  return worker.pipe(Layer.provideMerge(prepared));
91
92
  }
92
93
 
93
- const defaultChangesChannel = Effect.fnUntraced(function* (name: string) {
94
- const digest = yield* Digest.Digest;
95
- const hash = yield* digest.digestHex(Digest.sha256, new TextEncoder().encode(name));
96
- return `changes_${hash.slice(0, 32)}`;
97
- });
98
-
99
94
  export const appHost: AppHostFactory = <
100
95
  TRpcs extends Rpc.Any = never,
101
96
  THandlers = never,
@@ -138,13 +133,14 @@ export const appHost: AppHostFactory = <
138
133
  >,
139
134
  ) => {
140
135
  const preflight = hostPreflight(options.preflight, "application" in options ? Effect.succeed(isSensitiveKey) : hostSensitiveKeys(options));
136
+ const hosted = Layer.merge(hostCrypto, hostModels());
141
137
  if ("application" in options) {
142
- return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(preflight), Layer.provide(hostCrypto));
138
+ return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(preflight), Layer.provide(hosted));
143
139
  }
144
140
  return options.migrations === undefined
145
- ? appHostHttp(options).pipe(Layer.provideMerge(preflight), Layer.provide(hostCrypto))
141
+ ? appHostHttp(options).pipe(Layer.provideMerge(preflight), Layer.provide(hosted))
146
142
  : migratedHost({ ...options, migrations: options.migrations }, appDatabase({ ...options, migrations: options.migrations })).pipe(
147
143
  Layer.provideMerge(preflight),
148
- Layer.provide(hostCrypto),
144
+ Layer.provide(hosted),
149
145
  );
150
146
  };
package/src/appHost.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Layer } from "effect";
2
2
  import type { Rpc } from "effect/rpc";
3
3
  import { appHostHttp } from "#appHostHttp.ts";
4
+ import { hostModels } from "#HostModels.ts";
4
5
  import { hostCrypto } from "#hostCrypto.ts";
5
6
  import type { HostCoreOptions, HostPolicy, HostRouteRequirements, HostRoutes } from "#hostOptions.ts";
6
7
  import type { HostPreflight } from "#hostPreflight.ts";
@@ -69,7 +70,11 @@ function buildHttpHost<
69
70
  TRequestRequirements
70
71
  >,
71
72
  ) {
72
- return appHostHttp(options).pipe(Layer.provideMerge(hostPreflight(options.preflight, hostSensitiveKeys(options))), Layer.provide(hostCrypto));
73
+ return appHostHttp(options).pipe(
74
+ Layer.provideMerge(hostPreflight(options.preflight, hostSensitiveKeys(options))),
75
+ Layer.provide(hostCrypto),
76
+ Layer.provide(hostModels()),
77
+ );
73
78
  }
74
79
 
75
80
  type HttpHostFactory = <
@@ -0,0 +1,8 @@
1
+ import { Effect } from "effect";
2
+ import { Digest } from "effect/crypto";
3
+
4
+ export const defaultChangesChannel = Effect.fnUntraced(function* (name: string) {
5
+ const digest = yield* Digest.Digest;
6
+ const hash = yield* digest.digestHex(Digest.sha256, new TextEncoder().encode(name));
7
+ return `changes_${hash.slice(0, 32)}`;
8
+ });
@@ -1,5 +1,6 @@
1
1
  import { Effect, Layer } from "effect";
2
2
  import { redactingDiagnostics } from "#adapters/redactingDiagnostics.ts";
3
+ import type { HostModels } from "#HostModels.ts";
3
4
  import type { hostCrypto } from "#hostCrypto.ts";
4
5
 
5
6
  export type HostPreflight<TServices = never, TError = never, TRequirements = never> =
@@ -11,12 +12,12 @@ type HostCrypto = Layer.Success<typeof hostCrypto>;
11
12
  export type PreflightHost<THost extends Layer.Any, TServices, TError, TRequirements> = Layer.Layer<
12
13
  Layer.Success<THost> | TServices,
13
14
  Layer.Error<THost> | TError,
14
- Exclude<Layer.Services<THost>, TServices | HostCrypto> | Exclude<TRequirements, HostCrypto>
15
+ Exclude<Layer.Services<THost>, TServices | HostCrypto | HostModels> | Exclude<TRequirements, HostCrypto>
15
16
  >;
16
17
 
17
- export function hostPreflight<TServices, TError, TRequirements, TSensitiveError>(
18
+ export function hostPreflight<TServices, TError, TRequirements, TSensitiveError, TSensitiveRequirements>(
18
19
  startup: Layer.Layer<TServices, TError, TRequirements> | undefined,
19
- sensitive: Effect.Effect<(key: string) => boolean, TSensitiveError>,
20
+ sensitive: Effect.Effect<(key: string) => boolean, TSensitiveError, TSensitiveRequirements>,
20
21
  ) {
21
22
  return Layer.mergeAll(
22
23
  Layer.empty,
@@ -1,7 +1,7 @@
1
1
  import { Effect, MutableRef } from "effect";
2
2
  import { type Rpc, RpcGroup } from "effect/rpc";
3
- import { schemaFieldKeys } from "@shivaedev/errors/schemaFieldScope.ts";
4
3
  import { schemaSensitiveKeys } from "@shivaedev/errors/schemaSensitiveKeys.ts";
4
+ import { HostModels } from "#HostModels.ts";
5
5
 
6
6
  export const hostSensitiveKeys = Effect.fnUntraced(function* <TRpcs extends Rpc.Any>(options: {
7
7
  readonly group?: RpcGroup.RpcGroup<TRpcs>;
@@ -13,29 +13,21 @@ export const hostSensitiveKeys = Effect.fnUntraced(function* <TRpcs extends Rpc.
13
13
  }
14
14
  // Model names only widen masking, so the configured policy already holds the startup's conflict verdict.
15
15
  const current = MutableRef.make(yield* policy(configured));
16
- const models = new Set<string>();
16
+ const { fieldNames } = yield* HostModels;
17
17
  function sensitive(key: string) {
18
- return models.has(key) || MutableRef.get(current)(key);
18
+ return fieldNames.has(key) || MutableRef.get(current)(key);
19
19
  }
20
20
  return Object.assign(sensitive, {
21
21
  // Repositories declare their models while the host builds them; complete recompiles every RPC's policy with their names, as config.sensitiveKeys.
22
- complete: Effect.suspend(() => policy([...configured, ...models])).pipe(
22
+ complete: Effect.suspend(() => policy([...configured, ...fieldNames])).pipe(
23
23
  Effect.map((completed) => MutableRef.set(current, completed)),
24
24
  Effect.asVoid,
25
25
  ),
26
26
  forRpc: (tag: string | undefined) => {
27
27
  const forTag = MutableRef.get(current).forRpc(tag);
28
- return (key: string) => models.has(key) || forTag(key);
28
+ return (key: string) => fieldNames.has(key) || forTag(key);
29
29
  },
30
30
  maskFailure: (tag: string | undefined, reason: "Fail" | "Die") => MutableRef.get(current).maskFailure(tag, reason),
31
- models: {
32
- declare: (model: { readonly ast: Parameters<typeof schemaFieldKeys>[0] }) =>
33
- Effect.sync(() => {
34
- for (const key of schemaFieldKeys(model.ast, [])) {
35
- models.add(key);
36
- }
37
- }),
38
- },
39
31
  redactFailure: (tag: string | undefined, reason: "Fail" | "Die", value: unknown) => MutableRef.get(current).redactFailure(tag, reason, value),
40
32
  });
41
33
  });
@@ -1,6 +1,7 @@
1
1
  import { Effect, Option } from "effect";
2
2
  import { Headers, HttpMiddleware, HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
3
3
  import * as HttpStatus from "effect/http/HttpStatus";
4
+ import { accountPreferenceHeaders } from "@shivaedev/identity/accountPreferenceHeaders.ts";
4
5
  import { localTransport } from "@shivaedev/identity/server/adapters/local.ts";
5
6
  import { SessionPolicy } from "@shivaedev/identity/server/SessionPolicy.ts";
6
7
 
@@ -28,6 +29,8 @@ export function nativeClientOrigins(trustedProxy: string | undefined, route: "au
28
29
  ).layer;
29
30
  }
30
31
 
32
+ const CLIENT_HEADERS = ["Authorization", "Content-Type"];
33
+
31
34
  const withClientCors = Effect.fnUntraced(function* <E, R>(
32
35
  effect: Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>,
33
36
  nativeOrigins: readonly string[],
@@ -43,7 +46,7 @@ const withClientCors = Effect.fnUntraced(function* <E, R>(
43
46
  }
44
47
  const transport = native ? request.modify({ headers: Headers.remove(request.headers, "cookie") }) : request;
45
48
  return yield* HttpMiddleware.cors({
46
- allowedHeaders: ["Authorization", "Content-Type"],
49
+ allowedHeaders: auth ? [...CLIENT_HEADERS, ...Object.values(accountPreferenceHeaders)] : CLIENT_HEADERS,
47
50
  allowedMethods: auth ? ["GET", "POST"] : ["POST"],
48
51
  allowedOrigins: [origin],
49
52
  credentials: credentialed,
@@ -1,6 +1,5 @@
1
- import { Effect, Layer, Schema } from "effect";
1
+ import { Effect, Layer } from "effect";
2
2
  import type { Rpc, RpcGroup } from "effect/rpc";
3
- import { collectRepositoryModels, RepositoryModels } from "@shivaedev/sql/RepositoryModels.ts";
4
3
  import { redactingDiagnostics } from "#adapters/redactingDiagnostics.ts";
5
4
  import { hostSensitiveKeys } from "#hostSensitiveKeys.ts";
6
5
  import { otlpTracing } from "#otlpTracing.ts";
@@ -8,21 +7,7 @@ import { RedactionPolicy } from "#RedactionPolicy.ts";
8
7
 
9
8
  export type HostSensitivePolicy = Effect.Success<ReturnType<typeof hostSensitiveKeys>>;
10
9
 
11
- // Sql's collector keeps the owned models; the host also hands each model to the policy that masks its sensitive fields.
12
- function maskedModels(sensitive: HostSensitivePolicy) {
13
- return Layer.effect(
14
- RepositoryModels,
15
- Effect.gen(function* () {
16
- const collected = yield* RepositoryModels;
17
- return RepositoryModels.of({
18
- declare: (declared) => Effect.andThen(sensitive.models.declare(Schema.Struct(declared.model.fields)), collected.declare(declared)),
19
- owned: collected.owned,
20
- });
21
- }),
22
- ).pipe(Layer.provide(collectRepositoryModels));
23
- }
24
-
25
- // Both hosts build their process inside one policy, so repositories declare their models to the same policy that masks every log, error report and exported span.
10
+ // Both hosts build their process inside one policy, so every log, error report and exported span masks the same names, including the fields their repositories' models declare.
26
11
  export function redactedHost<TRpcs extends Rpc.Any, A, E, R>(
27
12
  options: { readonly group?: RpcGroup.RpcGroup<TRpcs>; readonly config?: { readonly sensitiveKeys?: readonly string[] } },
28
13
  host: (sensitive: HostSensitivePolicy) => Layer.Layer<A, E, R>,
@@ -33,7 +18,6 @@ export function redactedHost<TRpcs extends Rpc.Any, A, E, R>(
33
18
  Layer.provide(redactingDiagnostics(sensitive)),
34
19
  Layer.provide(otlpTracing),
35
20
  Layer.provide(Layer.succeed(RedactionPolicy, sensitive)),
36
- Layer.provide(maskedModels(sensitive)),
37
21
  ),
38
22
  ),
39
23
  );
package/src/workerHost.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Effect, Layer } from "effect";
2
2
  import { type AppDatabaseOptions, appDatabase, type DatabaseConfig } from "#appDatabase.ts";
3
+ import { hostModels } from "#HostModels.ts";
3
4
  import { hostCrypto } from "#hostCrypto.ts";
4
5
  import { redactedHost } from "#redactedHost.ts";
5
6
 
@@ -22,5 +23,5 @@ export function workerHost<R, E, TRequirements, TServices, TServiceError, TServi
22
23
  Layer.provideMerge(options.services),
23
24
  Layer.provideMerge(appDatabase(options)),
24
25
  ),
25
- ).pipe(Layer.provide(hostCrypto));
26
+ ).pipe(Layer.provide(hostCrypto), Layer.provide(hostModels()));
26
27
  }