import { type Kind } from "../../common"; export declare const dependenceHandlerKind: import("../../common").KindHandler>; export interface DependenceHandlerKind extends Kind { } export type DependenceHandler = (DependenceHandlerKind & ((implementation: GenericType) => GenericType)); export type DependenceHandlerDefinition = (DependenceHandlerKind & ((implementation: GenericType) => GenericType)); /** * Creates a typed dependency handler for the flow system. * * **Supported call styles:** * - Classic: `createDependence(name)` -> returns a typed dependence handler definition * * `createDependence` creates a dependency descriptor identified by a string name. * The returned handler is used with `inject(...)` and lets `run(...)` or `exec(...)` map a dependency bag to strongly typed values. * At runtime, the handler also behaves like an identity function for the injected implementation. * * ```ts * const database = F.createDependence("database"); * * F.run( * function *() { * const connection = yield *F.inject(database); * return connection; * }, * { dependencies: { database: database("main-db") } }, * ); // "main-db" * * const apiClient = F.createDependence("apiClient")<{ baseUrl: string }>; * * F.run( * function *() { * const client = yield *F.inject(apiClient); * return client.baseUrl; * }, * { dependencies: { apiClient: apiClient({ baseUrl: "/api" }) } }, * ); // "/api" * * database("replica-db"); // "replica-db" * ``` * * @remarks * - Use the returned dependence handler together with `inject(...)` * * @see [`F.inject`](https://utils.duplojs.dev/en/v1/api/flow/inject) To request the dependency inside a flow * @see https://utils.duplojs.dev/en/v1/api/flow/createDependence * * @namespace F * */ export declare function createDependence(name: GenericName): DependenceHandlerDefinition;