import type { ScaiClient } from "../connect.js"; /** * Subtree utilities — composable helpers for relocating parts of the * Sitecore content tree. * * `move` wraps the Authoring `moveItem` mutation, which preserves the * item's `itemId`, name, and every inbound reference. The alternative * (delete + recreate) assigns a fresh itemId and breaks every link * pointing at the old one — which is why relocating a subtree used to be * a sharp edge rather than a routine edit. * * `scai content move` is the CLI surface over the same mutation. These * helpers exist for the cases the CLI doesn't fit: moving many items in * one pass, deciding the destination from a query, or composing a move * with other surgery in a single script. * * Safe-by-default, matching `multilist`: every mutator takes * `allowWrite: boolean`. When false (the default), the helper resolves * both ends and reports what *would* happen without making the wire * call. Callers wire their own consent — script authors decide when to * flip the flag. */ export interface MoveArgs { /** Source item — pass exactly one of `itemId` / `path`. */ itemId?: string; path?: string; /** Destination parent — pass exactly one of `toItemId` / `toPath`. */ toItemId?: string; toPath?: string; /** When false (default), no mutation is made — resolves and reports only. */ allowWrite?: boolean; } export interface MoveResult { /** Resolved itemId of the source. Unchanged by the move. */ itemId: string; /** Source path as it was BEFORE the move. */ from?: string; /** Resolved destination parent. */ toParent: { itemId: string; path?: string; }; /** * False when the item is already a child of the destination parent — * the move would be a no-op and no wire call is made even with * `allowWrite: true`. */ changed: boolean; /** True only when the mutation actually reached the Authoring API. */ applied: boolean; } /** * Relocate a single item to a new parent, preserving its `itemId` and * every inbound reference. * * Both ends are resolved before anything is written, so a mistyped path * fails with a typed `INPUT_INVALID` naming the side that didn't * resolve, rather than a generic GraphQL error from the server. * * Returns `changed: false` when the item already sits under the * destination parent. `applied: true` only when the mutation reached the * Authoring API — that is, `changed` was true AND `allowWrite` was set. */ export declare const move: (client: ScaiClient, args: MoveArgs) => Promise;