import { ContractOutput, ContractSchema } from "../contracts/contract.mjs"; import { OperationPublicResult, SelectedOperation } from "../contracts/exposure.mjs"; import { Observability } from "../../components/foundation/modules/observability/observability.mjs"; import { AuditEntryInput } from "../../components/foundation/client.mjs"; import { DomainAuditInput, DomainCommandContract, DomainContract } from "../contracts/domain.mjs"; import { CallbackError, CallbackRequirements, CheckedEffectOperation, EffectOperationArgument, EffectOperationError, EffectOperationRequirements, EffectOperationResult, EffectValue, UnwrappedDefaultError, UnwrappedDefaultRequirements, ValidatedEffectOperations, effectOperationFactory } from "./operation.mjs"; import { BoundOperations } from "../contracts/binding.mjs"; import { AuditValue, AuditedOperations, DomainEffectFactory, DomainEffectImplementations, ExactDomainOperations, SharedEffectFactory } from "./domain.mjs"; import { Effect } from "effect"; //#region src/modules/effect/command.d.ts type Supported = Value | PromiseLike | Effect.Effect; type Callback = (...arguments_: never[]) => Supported; type Resolver = (host: never) => Supported; type HostOf = Parameters[0]; type DomainOf = EffectValue>; type Operation = { input: ContractSchema; result: ContractSchema; classification: string; handler: Callback; audit: Callback; guard?: Callback; prepare?: Callback; middleware?: Callback; permission?: string; aggregates?: readonly string[]; replayResult?: ContractSchema; }; type Registry = Readonly & CheckedEffectOperation>>; export type EffectCommandDependencies = { observability: Observability; checkPermission?: (host: never, input: { permission: string; operation: string; }) => Supported; writeAudit: (host: never, entry: AuditEntryInput) => Supported; }; type HostParameter = [Exclude] extends [never] ? unknown : Exclude extends ((...arguments_: infer Arguments) => Supported) ? Arguments extends [] ? unknown : Arguments[0] : unknown; type PolicyHost = HostParameter & HostParameter; type HostCompatible = [HostOf] extends [PolicyHost] ? unknown : { context: never; }; type Factory = ReturnType, Record, NoInfer>, NoInfer>>>; export type EffectCommandConfiguration>, Guard> = { context: Resolve; operations: (define: Factory) => Operations & NoInfer>; defaults?: { guard?: (context: DomainOf) => Guard; }; }; type ErrorOf = EffectOperationError | CallbackError | UnwrappedDefaultError; type RequirementsOf = EffectOperationRequirements | CallbackRequirements | UnwrappedDefaultRequirements; /** Internal registry constructor: the public Foundation binds host policies once. */ export declare function createEffectCommand>, const Dependencies extends EffectCommandDependencies, Guard = never>(configuration: EffectCommandConfiguration & Dependencies & HostCompatible): { /** Bind invocation context without resolving it or running an operation. */ withContext(context: HostOf): { exec: >(operation: Key, input: EffectOperationArgument) => Effect.Effect, ErrorOf, RequirementsOf>; }; expose>(owner: Owner, operation: Key): SelectedOperation>; exec: >(operation: Key, input: EffectOperationArgument, host: HostOf) => Effect.Effect, ErrorOf, RequirementsOf>; }; /** Bind trusted application policies without exposing a loose public command kernel. */ export declare function bindEffectCommand(dependencies: Dependencies): { >; }, const Operations extends DomainEffectImplementations, Contract['commands'], true>, Mode extends true, Guard = never>(configuration: { contract: Contract & NoInfer & ValidatedEffectOperations ? unknown : never>; context: Resolve; audit?: never; operations: (define: DomainEffectFactory, Contract['commands'], Mode, never, NoInfer>, NoInfer>>) => Operations; defaults?: { guard?: (context: DomainOf) => Guard; }; } & HostCompatible): ReturnType & { [Key in keyof Contract['commands']]: { classification: Contract['commands'][Key]['classification']; audit: Operations[Key]['audit']; }; }, Dependencies, Guard>>; >; }, const Operations extends DomainEffectImplementations, Contract['commands']>, Returned extends AuditValue, Guard = never>(configuration: { contract: Contract & NoInfer & ValidatedEffectOperations ? unknown : never>; context: Resolve; audit: (resolution: DomainAuditInput, context: DomainOf) => Returned; operations: (define: DomainEffectFactory, Contract['commands'], true, [Returned] extends [never] ? never : (resolution: never, context: never) => Returned, NoInfer>, NoInfer>>) => Operations; defaults?: { guard?: (context: DomainOf) => Guard; }; } & HostCompatible): ReturnType, (resolution: never, context: never) => Returned>, Dependencies, Guard>>; & CheckedEffectOperation>>>>, Returned extends AuditValue, Guard>(configuration: { context: Resolve; audit: (resolution: DomainAuditInput, context: DomainOf) => Returned; operations: (define: SharedEffectFactory, Guard>) => Operations & NoInfer>; defaults?: { guard?: (context: DomainOf) => Guard; }; } & HostCompatible): ReturnType Returned>, Dependencies, Guard>>; >, Guard = never>(configuration: EffectCommandConfiguration & HostCompatible): ReturnType>; }; //#endregion //# sourceMappingURL=command.d.mts.map