import * as z from "zod"; import type { DocumentSemantics } from "./object-semantics-schema.js"; export * from "./object-semantics-schema.js"; export { projectDocumentSemantics, presentationLabel, isTerminalState, } from "./object-semantics.js"; import { type UdlDocument, type UdlObjectField, type UdlObjectKind, type UdlSubjectRequirement, type UdlInstrument } from "./schema.js"; export type JsonSchemaDocument = z.core.JSONSchema.BaseSchema; export interface ObjectKindDiscovery { attachments: readonly { name: string; title: string; instrument: string; parentAttachment: string | null; block: { key: string; recordPath: string; digest: string; } | { key: string; recordPath: string; headerDigest: string; } | null; }[]; productBuildId: string; digest: string; creation: true; kind: string; title: string; fields: readonly UdlObjectField[]; authoredFields: readonly string[]; columns: readonly string[]; filters: readonly { field: string; type: "text" | "enum" | "date" | "boolean" | "integer"; }[]; createSchema: JsonSchemaDocument; actions: readonly ObjectActionDiscovery[]; } export declare function objectKindFilters(kind: UdlObjectKind): ObjectKindDiscovery["filters"]; export type ObjectActionTarget = { kind: "attachment"; attachment: string; } | { kind: "instance"; attachment: string; instanceId: string; }; export interface ObjectActionContext { productBuildId: string; digest: string; target: ObjectActionTarget; } export interface ObjectActionDiscovery extends ObjectActionContext { summary: string; name: string; title: string; instrument: string; action: string; requirements: readonly UdlObjectField[]; requirementConditions?: Record>; creationRequirements?: readonly UdlObjectField[]; creationOnlyNames?: readonly string[]; inputSchema: JsonSchemaDocument; fieldsSchema: JsonSchemaDocument; availability: ObjectActionAvailability; } export declare const objectActionBlockerCodes: readonly ["permission_required", "state_changed", "not_due", "deadline_passed", "clock_pending", "condition_not_met", "already_used", "evidence_required", "account_unavailable", "insufficient_balance", "setup_required", "invalid_input", "operation_pending"]; export type ObjectActionBlockerCode = (typeof objectActionBlockerCodes)[number]; export type ObjectActionAvailability = { status: "available"; } | { status: "requires_input"; subjectFields: readonly string[]; actionInputs: readonly string[]; parties: readonly string[]; reason: string; } | { status: "unavailable"; blockers: readonly { code: ObjectActionBlockerCode; reason: string; recheckAt?: string; /** * For insufficient_balance: the paying account and the amounts in minor * units, the same details execute's refusal carries. */ details?: { accountId: string; currency: string; available: string; required: string; shortfall: string; }; /** The party a refused actor needed, and how the attachment binds it. */ belongsTo?: { party: string; binding?: "owner" | "actor" | "operator"; /** The customer who owns the record, when the action belongs to the owner. */ customerId?: string; }; }[]; } | { status: "unknown"; reason: string; }; export type EvidenceState = "missing" | "pending" | "satisfied" | "refused" | "stale"; export interface ObjectEvidenceSummary { requirementId: string; subjectId: string; protectedInputDigest: string; adapter: string; declarationDigest: string; productBuildId: string; state: EvidenceState; reference?: string; observedAt?: string; reasonCode?: string; } export interface ObjectActionState extends ObjectActionDiscovery { requiredNow: readonly string[]; evidence?: readonly ObjectEvidenceSummary[]; } /** GET /v1/products/{productId}/objects. Core supplies the frozen Build identity. */ export type RetainedObjectKind = Pick & { attachments: ObjectKindDiscovery["attachments"]; productBuildId: string; digest: string; creation: false; }; export interface ObjectDiscovery { semantics: DocumentSemantics; navigation: readonly { kind: string; title: string; creation: boolean; }[]; retainedKinds: readonly RetainedObjectKind[]; productBuildId: string; digest: string; kinds: readonly ObjectKindDiscovery[]; } /** Creation accepts the full metadata union, with every value optional. */ export declare function objectCreateSchema(kind: UdlObjectKind): z.ZodObject; /** Canonical UDL supplies meaning; core adds authority, instance state and readiness. */ export declare function projectObjectDiscovery(document: UdlDocument, build: Pick): ObjectDiscovery; /** Values overwritten before invocation cannot decide a guard during discovery. */ export declare function objectActionSelf(instrument: UdlInstrument, actionName: string, fields?: Readonly>): Record; export interface ObjectActionStateOptions { attached?: boolean; self?: Readonly>; input?: Readonly>; } /** Object-specific values determine missing fields; global discovery cannot. */ export declare function objectActionState(action: ObjectActionDiscovery, fields: Readonly>, options?: ObjectActionStateOptions): ObjectActionState; export interface SubjectRequirementIssue { code: "subject_requirement_missing" | "subject_field_unknown" | "subject_adapter_unbound"; action: string; field?: string; origin: string; message: string; } /** Check merged metadata before dispatch. Runtime guards add their active child requirements. */ export declare function validateObjectActionSubject(action: ObjectActionDiscovery, storedFields: Readonly>, submittedFields: Readonly>, options?: ObjectActionStateOptions): readonly SubjectRequirementIssue[]; //# sourceMappingURL=object-contract.d.ts.map