@shivaedev/server 0.42.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 (58) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +4 -4
  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 +7 -10
  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 +3 -2
  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/hostCrypto.d.ts +4 -0
  24. package/dist/hostCrypto.d.ts.map +1 -0
  25. package/dist/hostCrypto.js +6 -0
  26. package/dist/hostCrypto.js.map +1 -0
  27. package/dist/hostPreflight.d.ts +5 -4
  28. package/dist/hostPreflight.d.ts.map +1 -1
  29. package/dist/hostPreflight.js.map +1 -1
  30. package/dist/hostSensitiveKeys.d.ts +2 -7
  31. package/dist/hostSensitiveKeys.d.ts.map +1 -1
  32. package/dist/hostSensitiveKeys.js +5 -12
  33. package/dist/hostSensitiveKeys.js.map +1 -1
  34. package/dist/nativeClientOrigins.d.ts.map +1 -1
  35. package/dist/nativeClientOrigins.js +3 -1
  36. package/dist/nativeClientOrigins.js.map +1 -1
  37. package/dist/providedModules.d.ts +2 -1
  38. package/dist/providedModules.d.ts.map +1 -1
  39. package/dist/redactedHost.d.ts +1 -1
  40. package/dist/redactedHost.d.ts.map +1 -1
  41. package/dist/redactedHost.js +3 -14
  42. package/dist/redactedHost.js.map +1 -1
  43. package/dist/workerHost.d.ts +1 -1
  44. package/dist/workerHost.d.ts.map +1 -1
  45. package/dist/workerHost.js +3 -2
  46. package/dist/workerHost.js.map +1 -1
  47. package/package.json +11 -11
  48. package/src/HostModels.ts +30 -0
  49. package/src/appDatabase.ts +7 -11
  50. package/src/appHost.ts +7 -2
  51. package/src/defaultChangesChannel.ts +8 -0
  52. package/src/hostCrypto.ts +6 -0
  53. package/src/hostPreflight.ts +6 -5
  54. package/src/hostSensitiveKeys.ts +5 -13
  55. package/src/nativeClientOrigins.ts +4 -1
  56. package/src/providedModules.ts +5 -1
  57. package/src/redactedHost.ts +2 -18
  58. package/src/workerHost.ts +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.44.0 - 2026-11-21
4
+
5
+ ### Fixed
6
+
7
+ - A host built with a deferred `application` Effect that builds its services itself with `Layer.build`, as the starter and every generated app do, now collects the models of those repositories: an operation it serves finds their owned models through `(yield* RepositoryModels).owned`, so identity's account export, erase and coverage check see them, and the fields those models mark sensitive or server-only are now masked in the host's logs, including logged defects, and its exported traces. From server 0.36.0 until this release, such a host left those fields unmasked, so logs and traces it wrote in that time hold their values in clear.
8
+ - CORS on the auth routes allows the `x-platform-account-timezone` and `x-platform-account-locale` headers next to `Authorization` and `Content-Type`, so a bundled native shell with the preferences plugin installed passes the preflight and signs in; a declared sibling browser origin's preflight allows them too. The RPC path still allows only `Authorization` and `Content-Type`.
9
+
10
+ ### Breaking
11
+
12
+ - Code that composes the host below `appHost` must provide the host's model collector: `hostSensitiveKeys`, `redactedHost`, `appHostHttp`, `migratedHost` and `deferredHost` now require `HostModels` from `@shivaedev/server/HostModels.ts`. Provide `hostModels()` from the same module once around everything the host builds, including a deferred `application` Effect, for example `host.pipe(Layer.provide(hostModels()))`. `hostPreflight` takes a fifth type parameter for the requirements of its policy Effect, so a call that passes its type arguments explicitly adds that one. `appHost` and `workerHost` provide the collector themselves, so their users change nothing.
13
+
14
+ ## 0.43.0 - 2026-11-21
15
+
16
+ ### Added
17
+
18
+ - `appHost` and `workerHost` provide `ColumnKey.fromConfig` beside the `effect/crypto` services, so a repository with encrypted fields works under either host once `COLUMN_ENCRYPTION_KEY` is set. A host whose models declare an encrypted field refuses to start with `ColumnKeyError` when the key is missing or malformed; a host without encrypted fields needs no key.
19
+ - `appModules` accepts a defined module whose operations yield the host's crypto services, the `effect/crypto` services of `NodeCrypto.layer` (`SecureRandom`, `Digest`, `Mac`, `Kdf`, `Aead`, `Cipher`, `Signature`, `KeyAgreement` and `KeyWrap`) and sql's `ColumnKey`, with no registration providing them. An application deletes a crypto port or Layer it registered only to satisfy the module's service check.
20
+
3
21
  ## 0.42.0 - 2026-11-21
4
22
 
5
23
  ### Added
package/README.md CHANGED
@@ -129,7 +129,7 @@ export const drafts = {
129
129
 
130
130
  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.
131
131
 
132
- `appModules` refuses a registration list in which a defined module's operation yields a service that no registration's `services`, `ports` or `requestServices` provide and the host does not provide, as it provides the SQL client and `Reactivity`. The second line of the compiler's message names the module, the operation and each missing service:
132
+ `appModules` refuses a registration list in which a defined module's operation yields a service that no registration's `services`, `ports` or `requestServices` provide and the host does not provide, as it provides the SQL client, `Reactivity`, the `effect/crypto` services and `ColumnKey`. The second line of the compiler's message names the module, the operation and each missing service:
133
133
 
134
134
  ```
135
135
  src/test-support/compiler-fixtures/unprovidedService.ts(26,12): error TS2345: Argument of type '[{ module: Module<"imports", readonly [ServedCommand<"importTitle", Struct<{ id: Number; }>, String, Flat<Automatic>, Effect<string, never, NoteSource>>] & readonly ModuleOperation[], ModuleRequirements<...>, never, undefined, undefined>; services: Layer<...>; }]' is not assignable to parameter of type 'readonly [{ module: Module<"imports", readonly [ServedCommand<"importTitle", Struct<{ id: Number; }>, String, Flat<Automatic>, Effect<string, never, NoteSource>>] & readonly ModuleOperation[], ModuleRequirements<...>, never, undefined, undefined>; services: Layer<...>; }] & { ...; } & OperationServicesNotProvided<...>'.
@@ -280,13 +280,13 @@ Set `migrations.mode: "check"` on `appDatabase` or a database-backed `appHost` w
280
280
 
281
281
  Pass `migrations.components` beside `loader` for storage managed by another engine. For pg-boss, register `pgBossSchema({ schema: "app_jobs" })` from `@shivaedev/jobs/server/schema.ts`, then start every jobs Layer with `migrate: false`. `check` and `wait` use the same `MigrationError` readout for pending ledger IDs and component names and details, including pg-boss’s installed and required versions.
282
282
 
283
- The host provides the `effect/crypto` services of `NodeCrypto.layer` from `@effect/platform-node`, such as `SecureRandom` and `Digest`, to preflight, deferred application construction, application services and handlers. Generate invite codes and tokens through `SecureRandom`; see the [secure invite code example](https://github.com/ShivaeDev/platform/blob/main/docs/framework/README.md#secure-invite-codes-and-tokens). Use `Random` for non-secure choices.
283
+ The host provides the `effect/crypto` services of `NodeCrypto.layer` from `@effect/platform-node`, such as `SecureRandom` and `Digest`, to preflight, deferred application construction, application services and handlers. It also provides `ColumnKey` from `@shivaedev/sql/ColumnKey.ts`, which reads `COLUMN_ENCRYPTION_KEY` when the host builds a repository whose model has a field marked `encrypted`: such a host refuses to start with `ColumnKeyError` when the key is missing or malformed, and a host without encrypted fields needs no key. `workerHost` provides the same services and refuses to start the same way. See [Fields encrypted at rest](https://github.com/ShivaeDev/platform/tree/main/packages/sql#fields-encrypted-at-rest). Generate invite codes and tokens through `SecureRandom`; see the [secure invite code example](https://github.com/ShivaeDev/platform/blob/main/docs/framework/README.md#secure-invite-codes-and-tokens). Use `Random` for non-secure choices.
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
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 default credential policy 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 and `LiveServer` from `@shivaedev/contract/live-server/service.ts` available. A failed migration or schema-current check prevents construction. Initialization requirements and errors stay in the returned Layer's types, and acquired resources close with the host scope.
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. 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({
@@ -414,7 +414,7 @@ Render inside the application's native registry provider. The query's `data` is
414
414
 
415
415
  Tracing logs declared failures with `RPC failure` and their tag, and defects with `RPC defect`. Interrupt-only causes emit `RPC interrupted` at debug instead, with `rpc.method`, `requestId`, the `rpc.duration` log span and the same redacted payload. The RPC trace span carries `rpc.interrupted: true`; Effect exports interruption with an unset span status. Completed and failed RPCs receive no interruption marker. The diagnostic payload masks nested credential-shaped keys and Effect `Redacted` values. Credential-shaped strings, such as bearer tokens, URL passwords and sensitive `key=value` text, are masked too. Strings retain at most 2,048 characters before a truncation marker; collections retain at most 50 entries with a marker for the remainder, and binary values become size summaries.
416
416
 
417
- `appHost` derives sensitive field names from the served RPC group's payload, success, error, defect and middleware error schemas, including nested schemas. Use `Schema.Redacted(...)`, `Schema.RedactedFromValue(...)`, or annotate a field with `sensitive: true`. The host applies each RPC's schema-derived names to that RPC's diagnostics and failures, even when a diagnostic contains an unwrapped value. A defined module's success comes from its generated wire, which carries no annotation, so it takes no part: mark the field on the model instead. Every repository the host builds while it starts, through `makeRepository` or `makeOrderedChildren`, declares its model, and the names of the model's sensitive fields apply to every RPC and every diagnostic like `config.sensitiveKeys`, before the host serves its first request. A repository made inside a handler declares its model only when it runs, after the RPC failure masks are compiled; build repositories in Layers. The host also collects each model whose field is marked with `owner` from `@shivaedev/sql/owner.ts`, through sql's `collectRepositoryModels`, and an operation it serves reads them with their tables and owner columns through `(yield* RepositoryModels).owned`. Values no repository model describes, such as computed or third-party data, are covered only by the built-in name rules and `config.sensitiveKeys`. Application-wide keys configured below apply to every RPC. Add other exact, case-sensitive names once in `config.sensitiveKeys`:
417
+ `appHost` derives sensitive field names from the served RPC group's payload, success, error, defect and middleware error schemas, including nested schemas. Use `Schema.Redacted(...)`, `Schema.RedactedFromValue(...)`, or annotate a field with `sensitive: true`. The host applies each RPC's schema-derived names to that RPC's diagnostics and failures, even when a diagnostic contains an unwrapped value. A defined module's success comes from its generated wire, which carries no annotation, so it takes no part: mark the field on the model instead. Every repository built while the host starts, through `makeRepository` or `makeOrderedChildren`, declares its model to that host, including one that a deferred `application` Effect builds itself with `Layer.build`, and the names of the model's sensitive fields apply to every RPC and every diagnostic like `config.sensitiveKeys`, before the host serves its first request. A repository made inside a handler declares its model only when it runs, after the RPC failure masks are compiled; build repositories in Layers. The host also collects each model whose field is marked with `owner` from `@shivaedev/sql/owner.ts`, through sql's `collectRepositoryModels`, from the same repositories, and an operation it serves reads them with their tables and owner columns through `(yield* RepositoryModels).owned`. Values no repository model describes, such as computed or third-party data, are covered only by the built-in name rules and `config.sensitiveKeys`. Application-wide keys configured below apply to every RPC. Add other exact, case-sensitive names once in `config.sensitiveKeys`:
418
418
 
419
419
  ```ts
420
420
  import { Schema } from "effect";
@@ -0,0 +1,9 @@
1
+ import { Context, Layer } from "effect";
2
+ declare const HostModels_base: Context.ServiceClass<HostModels, "@shivaedev/server/HostModels", {
3
+ readonly fieldNames: ReadonlySet<string>;
4
+ }>;
5
+ export declare class HostModels extends HostModels_base {
6
+ }
7
+ export declare function hostModels(): Layer.Layer<HostModels, never, never>;
8
+ export {};
9
+ //# sourceMappingURL=HostModels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HostModels.d.ts","sourceRoot":"","sources":["../src/HostModels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,KAAK,EAAU,MAAM,QAAQ,CAAC;;yBAK2B,WAAW,CAAC,MAAM,CAAC;;AAAtG,qBAAa,UAAW,SAAQ,eAA2G;CAAG;AAY9I,wBAAgB,UAAU,0CAYzB"}
@@ -0,0 +1,27 @@
1
+ import { Context, Effect, Layer, Schema } from "effect";
2
+ import { schemaFieldKeys } from "@shivaedev/errors/schemaFieldScope.ts";
3
+ import { collectRepositoryModels, RepositoryModels } from "@shivaedev/sql/RepositoryModels.ts";
4
+ // The field names of every model the host's repositories declare, which its redaction policy masks.
5
+ export class HostModels extends Context.Service()("@shivaedev/server/HostModels") {
6
+ }
7
+ function recordFields(fieldNames, { model }) {
8
+ return Effect.sync(() => {
9
+ for (const key of schemaFieldKeys(Schema.Struct(model.fields).ast, [])) {
10
+ fieldNames.add(key);
11
+ }
12
+ });
13
+ }
14
+ // Each host provides its own collector around everything it builds, including a deferred application Effect, so a
15
+ // repository built there reports its owned models and sensitive fields to the same host that serves and masks them.
16
+ export function hostModels() {
17
+ return Layer.effectContext(Effect.gen(function* () {
18
+ const collected = yield* RepositoryModels;
19
+ const fieldNames = new Set();
20
+ const models = RepositoryModels.of({
21
+ declare: (declared) => Effect.andThen(recordFields(fieldNames, declared), collected.declare(declared)),
22
+ owned: collected.owned,
23
+ });
24
+ return Context.make(HostModels, { fieldNames }).pipe(Context.add(RepositoryModels, models));
25
+ })).pipe(Layer.provide(Layer.fresh(collectRepositoryModels)));
26
+ }
27
+ //# sourceMappingURL=HostModels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HostModels.js","sourceRoot":"","sources":["../src/HostModels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAwB,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAErH,oGAAoG;AACpG,MAAM,OAAO,UAAW,SAAQ,OAAO,CAAC,OAAO,EAA4D,CAAC,8BAA8B,CAAC;CAAG;AAE9I,SAAS,YAAY,CAAC,UAAuB,EAAE,EAAE,KAAK,EAAmB;IACxE,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;QACvB,KAAK,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC;YACxE,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,kHAAkH;AAClH,oHAAoH;AACpH,MAAM,UAAU,UAAU;IACzB,OAAO,KAAK,CAAC,aAAa,CACzB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACnB,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC;QAC1C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;QACrC,MAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,CAAC;YAClC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACtG,KAAK,EAAE,SAAS,CAAC,KAAK;SACtB,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7F,CAAC,CAAC,CACF,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import * as PgClient from "@effect/sql-pg/PgClient";
2
2
  import { Clock, Config, Layer, Redacted } from "effect";
3
- import { Digest } from "effect/crypto";
4
3
  import * as Reactivity from "effect/reactivity/Reactivity";
5
4
  import { type PostgresChangesOptions } from "@shivaedev/sql/postgresChanges.ts";
6
5
  import { type PostgresOptions } from "@shivaedev/sql/postgresLayer.ts";
@@ -18,6 +17,6 @@ export interface DatabaseConfig extends PostgresOptions {
18
17
  readonly databaseUrl?: Redacted.Redacted<string>;
19
18
  readonly listenDatabaseUrl?: Redacted.Redacted<string>;
20
19
  }
21
- export declare function appDatabase<R, E = never>(options: AppDatabaseOptions<R, E>): Layer.Layer<"@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient, E | Config.ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("effect/sql/SqlError").SqlError, Digest.Digest | Exclude<Exclude<R, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient>>;
20
+ export declare function appDatabase<R, E = never>(options: AppDatabaseOptions<R, E>): Layer.Layer<"@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient, E | Config.ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("effect/sql/SqlError").SqlError, import("effect/crypto/Digest").Digest | Exclude<Exclude<R, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient>>;
22
21
  export declare const appHost: AppHostFactory;
23
22
  //# sourceMappingURL=appDatabase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appDatabase.d.ts","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAmB,KAAK,EAAU,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAM3D,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;AAOzD,OAAO,KAAK,EAAE,g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AAiB,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"}
@@ -1,7 +1,5 @@
1
- import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
2
1
  import * as PgClient from "@effect/sql-pg/PgClient";
3
2
  import { Clock, Config, Context, Effect, Layer, Option, Redacted } from "effect";
4
- import { Digest } from "effect/crypto";
5
3
  import * as Reactivity from "effect/reactivity/Reactivity";
6
4
  import { liveServerLayer } from "@shivaedev/contract/live-server/layer.ts";
7
5
  import { LiveServer } from "@shivaedev/contract/live-server/service.ts";
@@ -13,6 +11,9 @@ import { applyPostgresSettings } from "@shivaedev/sql/postgresSettings.ts";
13
11
  import { WorkerRelease } from "@shivaedev/sql/worker-release/service.ts";
14
12
  import { deferredHost, migratedHost } from "#appDatabaseHttp.ts";
15
13
  import { appHostHttp } from "#appHostHttp.ts";
14
+ import { defaultChangesChannel } from "#defaultChangesChannel.ts";
15
+ import { hostModels } from "#HostModels.ts";
16
+ import { hostCrypto } from "#hostCrypto.ts";
16
17
  import { hostPreflight } from "#hostPreflight.ts";
17
18
  import { hostSensitiveKeys } from "#hostSensitiveKeys.ts";
18
19
  import { prepareMigrations } from "#prepareMigrations.ts";
@@ -59,18 +60,14 @@ export function appDatabase(options) {
59
60
  const prepared = Layer.effectDiscard(prepareMigrations(migrations)).pipe(Layer.provideMerge(connected));
60
61
  return worker.pipe(Layer.provideMerge(prepared));
61
62
  }
62
- const defaultChangesChannel = Effect.fnUntraced(function* (name) {
63
- const digest = yield* Digest.Digest;
64
- const hash = yield* digest.digestHex(Digest.sha256, new TextEncoder().encode(name));
65
- return `changes_${hash.slice(0, 32)}`;
66
- });
67
63
  export const appHost = (options) => {
68
64
  const preflight = hostPreflight(options.preflight, "application" in options ? Effect.succeed(isSensitiveKey) : hostSensitiveKeys(options));
65
+ const hosted = Layer.merge(hostCrypto, hostModels());
69
66
  if ("application" in options) {
70
- return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(preflight), Layer.provide(NodeCrypto.layer));
67
+ return deferredHost(options.application, appDatabase(options)).pipe(Layer.provideMerge(preflight), Layer.provide(hosted));
71
68
  }
72
69
  return options.migrations === undefined
73
- ? appHostHttp(options).pipe(Layer.provideMerge(preflight), Layer.provide(NodeCrypto.layer))
74
- : migratedHost({ ...options, migrations: options.migrations }, appDatabase({ ...options, migrations: options.migrations })).pipe(Layer.provideMerge(preflight), Layer.provide(NodeCrypto.layer));
70
+ ? appHostHttp(options).pipe(Layer.provideMerge(preflight), Layer.provide(hosted))
71
+ : migratedHost({ ...options, migrations: options.migrations }, appDatabase({ ...options, migrations: options.migrations })).pipe(Layer.provideMerge(preflight), Layer.provide(hosted));
75
72
  };
76
73
  //# sourceMappingURL=appDatabase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"appDatabase.js","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAC;AAC/D,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,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,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,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAA+B,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAwB,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAyB,MAAM,oCAAoC,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAGzE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,M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