/** * Copyright (c) 2026, Salesforce, Inc., * All rights reserved. * For full license text, see the LICENSE.txt file */ /** * Library API for translating dotted parent-field paths into projection * nodes. Encapsulates two UIAPI conventions that every caller would * otherwise re-implement: * * 1. **Value-wrapper unwrapping.** UIAPI scalar fields are exposed as * object types with a single `value` field (e.g. `Name { value }`). * A caller asking for "Name" gets `Name { value }` — except for * `Id`, which is a real scalar. The structural test for "is this * a wrapper?" lives in `lib/uiapi.ts:isValueWrapperType` so every * caller agrees on the rule. * * 2. **Polymorphic union expansion.** Relationship fields like `Owner` * resolve to a union (`User | Group`). A path like "Owner.Name" * cannot be selected directly; it must be expanded to inline * fragments per union member that has the field. Members lacking * the field are skipped silently — a partial selection is more * useful than a hard failure. * * The MCP intent layer used to carry this logic locally, but it's a * pure function of (schema, path) and other graphiti consumers (CLI * helpers, future surfaces) need the same behavior. */ import { type GraphQLSchema } from "graphql"; import { type QuerySession } from "./session.js"; /** * Selects a dotted field path (e.g. "Owner.Name") rooted at `basePath`, * automatically expanding any segment that resolves to a polymorphic * union into inline fragments on each member that has the field. * * Behavior contract: * - "Name" (single segment) → calls `selectScalarOrValue`. * - "Account.Name" (no union segments) → walks the dotted path, then * selects the leaf with value-wrapper unwrapping. * - "Owner.Name" where Owner is a union → emits * `Owner { ... on User { Name { value } } ... on Group { Name { value } } }`. * Members that don't have `Name` are skipped silently. * - "Owner.BadField" where no union member has `BadField` → throws. * A silent no-op would render an empty selection; failing loudly * lets the caller correct the field name. * - If the union segment is followed by more path components (e.g. * `Owner.Account.Name`), the remaining path is appended to each * member's inline fragment. */ export declare function selectDottedFieldPath(session: QuerySession, schema: GraphQLSchema, basePath: string[], dotField: string): void;