import type * as GroupSpec from "@confect/core/GroupSpec"; import type * as MiddlewareSpec from "@confect/core/MiddlewareSpec"; import * as Context from "effect/Context"; import * as Layer from "effect/Layer"; import type * as DatabaseSchema from "./DatabaseSchema"; import type * as FunctionImpl from "./FunctionImpl"; import type * as MiddlewareImpl from "./MiddlewareImpl"; export declare const TypeId = "~@confect/server/GroupImpl"; export type TypeId = typeof TypeId; export type FinalizationStatus = "Unfinalized" | "Finalized"; export interface GroupImpl { readonly [TypeId]: TypeId; readonly finalizationStatus: FinalizationStatus_; /** * Names of every function registered into this group's layer scope by * `FunctionImpl.make`. Authoritative only when `finalizationStatus` is * `"Finalized"`; the `"Unfinalized"` value is set to `[]` at `make`-time * since the list is only known once `finalize` snapshots the registry. */ readonly registeredFunctionNames: ReadonlyArray; /** * Keys of every middleware whose implementation registered into this group's * layer scope via `MiddlewareImpl.make` (and friends). Same authoritativeness * caveat as `registeredFunctionNames`. Lets consumers (the CLI's * `validateImpl`) verify middleware-impl completeness against a `GroupSpec`'s * attached middleware without inspecting the `Registry`. */ readonly registeredMiddlewareKeys: ReadonlyArray; } export interface Any extends GroupImpl { } export declare const isGroupImpl: (u: unknown) => u is Any; export interface AnyFinalized extends GroupImpl<"Finalized"> { } export interface AnyUnfinalized extends GroupImpl<"Unfinalized"> { } export declare const isFinalizedGroupImpl: (u: unknown) => u is AnyFinalized; export declare const isUnfinalizedGroupImpl: (u: unknown) => u is AnyUnfinalized; /** * Build the runtime tag for a `GroupImpl` service. The finalization status is * embedded in the tag string so that `Unfinalized` and `Finalized` are distinct * services at runtime; consumers of a finalized layer (the server's * `RegisteredFunctions.buildForGroup` and the CLI's `validateImpl`) retrieve * the typed `Finalized` service directly rather than scanning the context. * * The tag is keyed only by finalization status—no group path—because each * group's impl layer is built in its own isolated scope * (`buildForGroup`/`validateImpl` each provide a fresh `Registry`), so at most * one `GroupImpl` service of each status exists per build. */ export declare const GroupImpl: ({ finalizationStatus, }: { finalizationStatus: FinalizationStatus_; }) => Context.Service, GroupImpl>; /** * Begin a group's impl layer. `databaseSchema` and `group` are retained only as * type-level carriers (`group` drives the required `FunctionImpl` services via * `FromGroupSpec`; `databaseSchema` keeps the impl's dependency on * `_generated/schema` symmetric with `FunctionImpl.make`). Neither is read at * runtime. */ export declare const make: (_databaseSchema: DatabaseSchema_, _group: Group & MiddlewareSpec.ValidateImplRequires, GroupSpec.MiddlewareSpecs>) => Layer.Layer, never, FunctionImpl.FromGroupSpec | MiddlewareImpl.FromGroupSpec>; /** * Mark a `GroupImpl` layer as fully implemented. The parameter type defaults * `RIn = never`, so passing a layer that still requires any `FunctionImpl` * service produces a type error at the impl author's site. The codegen boundary * requires the resulting `"Finalized"` brand, so omitting this call is also * rejected downstream. * * As a side effect of finalization, the names of every `FunctionImpl` that * registered into this group's scope are snapshotted onto the produced service * value's `registeredFunctionNames` field, so consumers can verify impl * completeness against a `GroupSpec`'s expected functions without having to * inspect the `Registry` themselves. */ export declare const finalize: (group: Layer.Layer>) => Layer.Layer>; export type FromGroupSpec = FunctionImpl.FromGroupSpec | MiddlewareImpl.FromGroupSpec; //# sourceMappingURL=GroupImpl.d.ts.map