/** * The published Zod schema for a patch instruction. * * This is the single source of truth for the *shape and validity* of an * instruction as a caller supplies it, from which downstream projects derive * their own surfaces: obsidian-local-rest-api builds its MCP `vault_patch` tool * input from {@link InstructionInputObjectSchema}'s field shape and its OpenAPI * `PatchInstruction` component by running the same schema through * `zod-to-json-schema`. Keeping it here means those three representations * cannot drift. * * The schema is deliberately a *flat* object rather than a discriminated union: * that is the only shape an MCP tool input accepts (a tool takes a flat * `ZodRawShape`, never a top-level union), and it matches how both the REST and * MCP layers already model an instruction. The cross-field rules that a * discriminated union would encode in its structure — which carrier a cell * requires, which `operation × scope` pairs are valid for a target — are instead * enforced by {@link instructionAlgebra} in a `superRefine`. * * The hand-written {@link InstructionInput} union in `instructions.ts` remains * the exported *type*; this schema is checked against it (see `schema.test.ts`) * so the two stay in agreement. {@link patch} validates its input against * {@link InstructionInputSchema} at the boundary, so a malformed instruction is * rejected with a typed {@link InvalidInstructionError} before any handler runs. */ import { z } from "zod"; /** * The instruction as a flat object, before cross-field validation. Exposed so * consumers can read its `.shape` (e.g. to build an MCP tool input, one Zod * field per parameter). Use {@link InstructionInputSchema} to actually * validate an instruction — it adds the {@link instructionAlgebra} refinement. */ export declare const InstructionInputObjectSchema: z.ZodObject<{ targetType: z.ZodEnum<["heading", "block", "frontmatter"]>; target: z.ZodUnion<[z.ZodArray, z.ZodString, z.ZodNull]>; within: z.ZodOptional; operation: z.ZodEnum<["replace", "prepend", "append", "delete"]>; scope: z.ZodDefault>; content: z.ZodOptional; value: z.ZodOptional; destination: z.ZodOptional, z.ZodNull]>; place: z.ZodUnion<[z.ZodEnum<["first", "last"]>, z.ZodObject<{ before: z.ZodUnion<[z.ZodArray, z.ZodNull]>; }, "strict", z.ZodTypeAny, { before: string[] | null; }, { before: string[] | null; }>, z.ZodObject<{ after: z.ZodUnion<[z.ZodArray, z.ZodNull]>; }, "strict", z.ZodTypeAny, { after: string[] | null; }, { after: string[] | null; }>]>; }, "strict", z.ZodTypeAny, { parent: string[] | null; place: "first" | "last" | { before: string[] | null; } | { after: string[] | null; }; }, { parent: string[] | null; place: "first" | "last" | { before: string[] | null; } | { after: string[] | null; }; }>>; ifMatch: z.ZodOptional; createTargetIfMissing: z.ZodDefault; rejectIfContentPreexists: z.ZodDefault; }, "strip", z.ZodTypeAny, { targetType: "heading" | "block" | "frontmatter"; target: string | string[] | null; scope: "content" | "marker" | "markerAndContent" | "parent"; operation: "replace" | "prepend" | "append" | "delete"; createTargetIfMissing: boolean; rejectIfContentPreexists: boolean; content?: string | undefined; ifMatch?: string | undefined; within?: number | undefined; value?: unknown; destination?: { parent: string[] | null; place: "first" | "last" | { before: string[] | null; } | { after: string[] | null; }; } | undefined; }, { targetType: "heading" | "block" | "frontmatter"; target: string | string[] | null; operation: "replace" | "prepend" | "append" | "delete"; content?: string | undefined; scope?: "content" | "marker" | "markerAndContent" | "parent" | undefined; ifMatch?: string | undefined; createTargetIfMissing?: boolean | undefined; rejectIfContentPreexists?: boolean | undefined; within?: number | undefined; value?: unknown; destination?: { parent: string[] | null; place: "first" | "last" | { before: string[] | null; } | { after: string[] | null; }; } | undefined; }>; /** * The full instruction schema: the flat object plus the {@link instructionAlgebra} * cross-field refinement. {@link patch} parses input through this at the * boundary. It is a `ZodEffects`, so read `.shape` from * {@link InstructionInputObjectSchema} rather than from this. */ export declare const InstructionInputSchema: z.ZodEffects; target: z.ZodUnion<[z.ZodArray, z.ZodString, z.ZodNull]>; within: z.ZodOptional; operation: z.ZodEnum<["replace", "prepend", "append", "delete"]>; scope: z.ZodDefault>; content: z.ZodOptional; value: z.ZodOptional; destination: z.ZodOptional, z.ZodNull]>; place: z.ZodUnion<[z.ZodEnum<["first", "last"]>, z.ZodObject<{ before: z.ZodUnion<[z.ZodArray, z.ZodNull]>; }, "strict", z.ZodTypeAny, { before: string[] | null; }, { before: string[] | null; }>, z.ZodObject<{ after: z.ZodUnion<[z.ZodArray, z.ZodNull]>; }, "strict", z.ZodTypeAny, { after: string[] | null; }, { after: string[] | null; }>]>; }, "strict", z.ZodTypeAny, { parent: string[] | null; place: "first" | "last" | { before: string[] | null; } | { after: string[] | null; }; }, { parent: string[] | null; place: "first" | "last" | { before: string[] | null; } | { after: string[] | null; }; }>>; ifMatch: z.ZodOptional; createTargetIfMissing: z.ZodDefault; rejectIfContentPreexists: z.ZodDefault; }, "strip", z.ZodTypeAny, { targetType: "heading" | "block" | "frontmatter"; target: string | string[] | null; scope: "content" | "marker" | "markerAndContent" | "parent"; operation: "replace" | "prepend" | "append" | "delete"; createTargetIfMissing: boolean; rejectIfContentPreexists: boolean; content?: string | undefined; ifMatch?: string | undefined; within?: number | undefined; value?: unknown; destination?: { parent: string[] | null; place: "first" | "last" | { before: string[] | null; } | { after: string[] | null; }; } | undefined; }, { targetType: "heading" | "block" | "frontmatter"; target: string | string[] | null; operation: "replace" | "prepend" | "append" | "delete"; content?: string | undefined; scope?: "content" | "marker" | "markerAndContent" | "parent" | undefined; ifMatch?: string | undefined; createTargetIfMissing?: boolean | undefined; rejectIfContentPreexists?: boolean | undefined; within?: number | undefined; value?: unknown; destination?: { parent: string[] | null; place: "first" | "last" | { before: string[] | null; } | { after: string[] | null; }; } | undefined; }>, { targetType: "heading" | "block" | "frontmatter"; target: string | string[] | null; scope: "content" | "marker" | "markerAndContent" | "parent"; operation: "replace" | "prepend" | "append" | "delete"; createTargetIfMissing: boolean; rejectIfContentPreexists: boolean; content?: string | undefined; ifMatch?: string | undefined; within?: number | undefined; value?: unknown; destination?: { parent: string[] | null; place: "first" | "last" | { before: string[] | null; } | { after: string[] | null; }; } | undefined; }, { targetType: "heading" | "block" | "frontmatter"; target: string | string[] | null; operation: "replace" | "prepend" | "append" | "delete"; content?: string | undefined; scope?: "content" | "marker" | "markerAndContent" | "parent" | undefined; ifMatch?: string | undefined; createTargetIfMissing?: boolean | undefined; rejectIfContentPreexists?: boolean | undefined; within?: number | undefined; value?: unknown; destination?: { parent: string[] | null; place: "first" | "last" | { before: string[] | null; } | { after: string[] | null; }; } | undefined; }>; //# sourceMappingURL=schema.d.ts.map