import { ContractInput, ContractOutput, ContractSchema } from "../contracts/contract.mjs";
import { AuditEntryInput } from "../../components/foundation/client.mjs";
import { DomainOperationContract, ExactOperationKeys } from "../contracts/domain.mjs";
import { CallbackError, CallbackRequirements, CheckedEffectDefinition, CheckedEffectOperation, EffectPreparation, OperationDefinition, effectOperationFactory } from "./operation.mjs";
import { DeclaredSchemas } from "../contracts/binding.mjs";
import { Effect } from "effect";
//#region src/modules/effect/domain.d.ts
type Supported = A | PromiseLike | Effect.Effect;
type Audit = Omit | null;
declare const domainKey: unique symbol;
type BoundKey = {
readonly [domainKey]: Key;
};
type Schemas = Pick & Omit;
type Forbidden = {
input?: never;
result?: never;
classification?: never;
replayResult?: never;
wire?: never;
};
type AuditCallback = (resolution: {
command: ContractOutput;
result: ContractOutput;
}, context: Context) => Value;
export type SelectedAudit = Definition extends {
audit: infer Override;
} ? Override : 'audit' extends keyof Definition ? Exclude | Default : Default;
export type AuditedOperations = { [Key in keyof Operations]: Omit & {
audit: SelectedAudit;
}; };
export type ExactDomainOperations = ExactOperationKeys & { [Key in keyof Operations]: Operations[Key] extends BoundKey ? Operations[Key] : never; };
type Helper = >, Guard extends Supported = never, Preparation extends Supported, unknown, unknown>> = never, const Aggregates extends readonly string[] = readonly string[], AuditReturned extends Supported = never, Middleware extends Supported> = never, const Metadata extends object = Record, const Definition extends object = object>(implementation: Definition & Forbidden & Omit, Aggregates, Handler, Guard, Preparation, AuditReturned, Middleware, Metadata, BaseError, BaseRequirements, ContractSchema, never>, 'input' | 'result' | 'classification' | 'replayResult' | 'wire'> & (Command extends true ? [Default] extends [never] ? {
audit: AuditCallback;
} : {} : {
audit?: never;
prepare?: never;
aggregates?: never;
})) => DeclaredSchemas & CheckedEffectDefinition & Definition & BoundKey, BaseError, BaseRequirements>;
type HandlerArguments = Command extends true ? [Default] extends [never] ? [options: Options & RequiredAudit] : [options?: Options] : [options?: Options];
type HandlerHelper>, Command extends boolean, Default, BaseError, BaseRequirements> = >, Guard extends Supported = never, Preparation extends Supported, unknown, unknown>> = never, const Aggregates extends readonly string[] = readonly string[], AuditReturned extends Supported = never, Middleware extends Supported> = never, const Metadata extends object = Record, const Definition extends object = object>(handler: (input: ContractOutput, context: Context) => Handler, ...options: HandlerArguments, Aggregates, Handler, Guard, Preparation, AuditReturned, Middleware, Metadata, BaseError, BaseRequirements, ContractSchema, never>, 'handler' | 'input' | 'result' | 'classification' | 'replayResult' | 'wire'> & (Command extends true ? {} : {
audit?: never;
prepare?: never;
aggregates?: never;
}), Command, Default, {
audit: AuditCallback;
}>) => DeclaredSchemas<{
input: Input;
result: Result;
}> & {
handler: (input: ContractOutput, context: Context) => NoInfer;
} & NoInfer & BoundKey & CheckedEffectDefinition & {
handler: (input: ContractOutput, context: Context) => Handler;
} & BoundKey, BaseError, BaseRequirements>;
export type DomainEffectFactory>, Command extends boolean, Default = never, BaseError = never, BaseRequirements = never> = { [Kind in Command extends true ? 'command' : 'query']: { readonly [Key in keyof Entries]: Helper; } & {
handler: HandlerHelper;
}; };
export type DomainEffectImplementations>, Required extends boolean = false> = { [Key in keyof Entries]: DeclaredSchemas> & BoundKey & CheckedEffectOperation & {
handler: (input: ContractOutput, context: Context) => Supported>;
} & (Required extends true ? {
audit: AuditCallback>;
} : {}); };
export declare function domainEffectFactory>, Command extends boolean, Default, Guard>(entries: Entries, command: Command): DomainEffectFactory, CallbackRequirements>;
export type SharedEffectFactory = ReturnType, NoInfer>, NoInfer>, false>>;
export type AuditValue = Supported;
//#endregion
//# sourceMappingURL=domain.d.mts.map