import { A as EmptyMeta, C as CUSTOM_INSTRUCTION_META, F as Simplify, I as StripEmpty, N as NormalizeMeta, O as Blocking, o as RunContext, t as Op, w as CustomInstruction } from "../index-BeplSvsa.mjs"; //#region src/di/types.d.ts /** Binding failure when an injected dependency was not provided for the run. */ declare class MissingDependencyError extends Error { readonly name = "MissingDependencyError"; readonly _tag = "MissingDependencyError"; readonly key: string; constructor(key: string); static is(value: unknown): value is MissingDependencyError; } /** Binding failure when the same dependency token is provided more than once. */ declare class DuplicateDependencyError extends Error { readonly name = "DuplicateDependencyError"; readonly _tag = "DuplicateDependencyError"; readonly key: string; constructor(key: string); static is(value: unknown): value is DuplicateDependencyError; } declare const DI_TOKEN: unique symbol; declare const DI_TAG = "DI"; declare const DI_SINGLETON_BINDING: unique symbol; declare const DI_LAZY_BINDING: unique symbol; type AnyDependency = Dependency; interface DependencyCtor { readonly _tag: typeof DI_TAG; readonly key: Name; readonly [DI_TOKEN]: never; new (): Dependency; } type DependencyValue = C extends (abstract new (...args: never[]) => Dependency) ? T & V : C extends Dependency ? T & V : never; type SingletonBinding = { readonly [DI_SINGLETON_BINDING]: true; readonly dependency: C; readonly value: DependencyValue; }; type AnySingletonBinding = SingletonBinding; type LazyResolveFn = (signal: AbortSignal) => DependencyValue | PromiseLike>; type LazyBinding = { readonly [DI_LAZY_BINDING]: true; readonly dependency: C; readonly resolve: LazyResolveFn; }; type AnyLazyBinding = LazyBinding; type WithDIMeta = [R] extends [never] ? NormalizeMeta, "deps">> : Simplify, "deps"> & { deps: Blocking; }>; type RequiredDepsOfMeta = M extends { deps: Blocking; } ? Required : never; /** Unsatisfied dependency tokens blocking `.run()` on an op. */ type RequiredDeps = C extends Op ? RequiredDepsOfMeta : never; type Deps = C extends (abstract new (...args: never[]) => infer I) ? I : C; type AnyBinding = AnySingletonBinding | AnyLazyBinding; type DepsOf

= P extends SingletonBinding ? Deps : P extends LazyBinding ? Deps : never; type RemainingRequiredDeps = Exclude>; type ExcessProvidedDeps = Exclude, R>; type ValidProvideBindings = [ExcessProvidedDeps] extends [never] ? Bindings : never; type UpdateProvidedMeta = [R] extends [never] ? NormalizeMeta, "deps">> : Simplify, "deps"> & { deps: Blocking; }>; type ProvidedMeta = UpdateProvidedMeta>>; //#endregion //#region src/di/plan.d.ts declare class InjectInstruction implements CustomInstruction> { readonly _tag = "InjectInstruction"; readonly [CUSTOM_INSTRUCTION_META]: WithDIMeta; readonly dependency: AnyDependency; constructor(dependency: AnyDependency); resolve(context: RunContext): T | PromiseLike; [Symbol.iterator](): Generator; } //#endregion //#region src/di/index.d.ts /** * Phantom-typed dependency token created with {@link Dependency}. * Runtime slot identity is the token **class** passed to {@link inject} and bindings, not the * `key` string (see ADR 0010). */ interface Dependency { readonly _tag: typeof DI_TAG; readonly key: Name; readonly [DI_TOKEN]: T; } /** * Creates a dependency token class for {@link inject} and bindings. * `key` is used in binding failure messages; two classes may share a `key` and remain distinct * slots. */ declare const Dependency: (key: Name) => DependencyCtor; /** Yields a bound dependency value from the current run context. */ declare const inject: (dependency: C) => Generator, Deps>, DependencyValue, unknown>; /** Eager singleton binding for {@link provide}. */ declare const singleton: (dependency: C, value: DependencyValue) => SingletonBinding; /** Per-run lazy binding resolved when first injected. */ declare const scoped: (dependency: C, resolve: LazyResolveFn) => LazyBinding; /** * Satisfies dependency requirements on an op before `.run()`. * Pass a readonly tuple of `DI.singleton` / `DI.scoped` bindings */ declare const provide: (op: Op, bindings: ValidProvideBindings>) => Op>; /** Namespace object for dependency injection helpers. */ declare const DI: { readonly Dependency: (key: Name) => DependencyCtor; readonly inject: (dependency: C) => Generator, Deps>, DependencyValue, unknown>; readonly singleton: (dependency: C, value: DependencyValue) => SingletonBinding; readonly scoped: (dependency: C, resolve: LazyResolveFn) => LazyBinding; readonly provide: (op: Op, bindings: ValidProvideBindings>) => Op>; /** Error type for a missing binding on `error.cause` after `.run()`. */ readonly MissingDependencyError: typeof MissingDependencyError; /** Error type for a duplicate binding on `error.cause` after `.run()`. */ readonly DuplicateDependencyError: typeof DuplicateDependencyError; }; //#endregion export { DI, Dependency, type RequiredDeps, inject, provide, scoped, singleton }; //# sourceMappingURL=index.d.mts.map