//#region src/modules/contracts/contract.d.ts /** Structural contracts keep the optional Effect peer out of this module. */ export interface StandardSchema { readonly '~standard': { readonly version: 1; readonly vendor: string; readonly types?: { readonly input: Input; readonly output: Output; }; readonly validate: (value: unknown) => ValidationResult | Promise>; }; } export interface ValidationIssue { readonly message: string; readonly path?: readonly (PropertyKey | { readonly key: PropertyKey; })[]; } export type ValidationResult = { readonly value: Output; readonly issues?: undefined; } | { readonly issues: readonly ValidationIssue[]; }; export interface LegacyParser { readonly parse: (value: unknown) => Output; readonly parseAsync?: (value: unknown) => Promise; } /** Decode execution is an opaque channel here; optional adapters give it concrete semantics. */ export interface Decoder { readonly kind: 'contract' | 'effect-contract'; readonly types?: { readonly input: Input; readonly output: Output; }; readonly decode: (value: unknown) => Execution; } export type ContractSchema = LegacyParser | StandardSchema | Decoder; export type NeutralSchema = LegacyParser | StandardSchema | (Decoder | Promise>> & { readonly kind: 'contract'; }); export type ContractInput = S extends Decoder ? Input : S extends StandardSchema ? Input : S extends { readonly _input: infer Input; } ? Input : S extends LegacyParser ? Awaited : never; export type ContractOutput = S extends Decoder ? Output : S extends StandardSchema ? Output : S extends LegacyParser ? Awaited : never; export type ContractExecution = S extends Decoder ? Execution : never; /** Validation failures are values. Throws/rejections are deliberately left as defects. */ export declare function decodeContract(schema: S, value: unknown): Promise>>; /** Independent final and wire contracts never reuse the fresh-result transform. */ export declare function operationContract(definition: Definition & { input: Input; result: Result; replayResult: Replay & (ContractOutput extends ContractOutput ? unknown : never); wire: { project: (value: ContractOutput) => ContractInput; schema: Wire; }; }): Definition & { input: Input; result: Result; replayResult: Replay & (ContractOutput extends ContractOutput ? unknown : never); wire: { project: (value: ContractOutput) => ContractInput; schema: Wire; }; }; //#endregion //# sourceMappingURL=contract.d.mts.map