/** * Copyright (c) 2026, Salesforce, Inc., * All rights reserved. * For full license text, see the LICENSE.txt file */ import { type GraphQLSchema, type GraphQLNamedType, type GraphQLOutputType } from "graphql"; import { type OperationType } from "./session.js"; export declare class MutationContextError extends Error { constructor(message: string); } export declare function getSchema(instanceUrl: string): GraphQLSchema; export declare function clearSchemaCache(instanceUrl?: string): void; /** * Evict the parsed schema for an instance URL AND its derived on-disk SDL * side-file (`.graphql`). Extends {@link clearSchemaCache} (in-memory * only) with the SDL removal the refresh path needs: after a forced refresh * rewrites the introspection JSON, `buildSchemaWithSdlCache` would otherwise * prefer a stale SDL whenever `sdlMtime >= introspMtime` — true on a * same-mtime-tick edge — resurrecting the old schema on the next cold read and * defeating the refresh's coherence guarantee. SDL removal is best-effort. */ export declare function clearSchemaCacheByUrl(instanceUrl: string): void; export declare function primeSchemaCache(alias: string, schema: GraphQLSchema): void; export interface FieldInfo { name: string; typeName: string; typeKind: TypeInfo["kind"]; isNonNull: boolean; isList: boolean; description: string | null; args: ArgInfo[]; } export interface ArgInfo { name: string; typeName: string; typeKind: string; isNonNull: boolean; description: string | null; defaultValue: string | undefined; enumValues?: string[]; } export interface TypeInfo { name: string; kind: "OBJECT" | "INPUT_OBJECT" | "ENUM" | "UNION" | "INTERFACE" | "SCALAR"; description: string | null; fields: FieldInfo[]; inputFields: InputFieldInfo[]; enumValues: EnumValueInfo[]; possibleTypes: string[]; interfaces: string[]; } export interface InputFieldInfo { name: string; typeName: string; typeKind: string; isNonNull: boolean; description: string | null; defaultValue: string | undefined; enumValues?: string[]; } export interface EnumValueInfo { name: string; description: string | null; } /** * Returns true for Salesforce Data Cloud (Data Lake Model) objects. * These have names ending in `__dlm` (e.g. `ssot__Account__dlm`). */ export declare function isDataCloudField(field: FieldInfo): boolean; export declare function filterDataCloudFields(fields: FieldInfo[], includeDataCloud: boolean): FieldInfo[]; export declare function getTypeKind(type: GraphQLNamedType): TypeInfo["kind"]; export interface WalkerResult { type: GraphQLNamedType; typeName: string; kind: TypeInfo["kind"]; fields: FieldInfo[]; args: ArgInfo[]; possibleTypes: string[]; isLeaf: boolean; /** True when inside a mutation result record type where only scalar/value fields are selectable. */ inMutationRecord: boolean; /** Relationship fields hidden from selection in mutation results (shown as [query-only] in ls -l). */ mutationHiddenFields: FieldInfo[]; } export declare function getRootType(schema: GraphQLSchema, operation: OperationType): GraphQLNamedType; export declare function getRootFields(schema: GraphQLSchema, operation: OperationType): FieldInfo[]; /** * Walks the schema graph along a path and returns what's available at the end. * Handles regular fields, inline fragment segments [TypeName], and resolves * through NonNull/List wrappers. * * Returns the args of the *last* field in the path (not the terminal type's fields' args). */ export declare function resolvePath(schema: GraphQLSchema, operation: OperationType, pathSegments: string[]): WalkerResult; /** * Given a parent path + field name, resolves the field's schema info. * Used to determine whether a field returns an object type (needs sub-selections) * or is a leaf. */ export declare function resolveFieldOnPath(schema: GraphQLSchema, operation: OperationType, parentPath: string[], fieldName: string): WalkerResult; export declare function getFragmentTargets(schema: GraphQLSchema, type: GraphQLNamedType): string[]; export declare function inspectType(schema: GraphQLSchema, typeName: string): TypeInfo; export interface InputWalkerResult { type: GraphQLNamedType; typeName: string; kind: TypeInfo["kind"]; inputFields: InputFieldInfo[]; enumValues: EnumValueInfo[]; isLeaf: boolean; isList: boolean; isNonNull: boolean; } /** * Walks an INPUT_OBJECT type structure along a path. * Numeric segments index into list types (unwrapping [T] → T). * Returns info about the terminal type: its input fields if navigable, * or isLeaf:true for SCALAR/ENUM. */ export declare function resolveInputPath(schema: GraphQLSchema, inputTypeName: string, pathSegments: string[]): InputWalkerResult; /** * Resolves a single argument by name from a WalkerResult and returns * its type info for navigation into @args/. */ export declare function resolveArgByName(schema: GraphQLSchema, walkerResult: WalkerResult, argName: string): { typeName: string; isNonNull: boolean; isList: boolean; typeKind: string; }; export declare function getRawFieldType(schema: GraphQLSchema, operation: OperationType, parentPath: string[], fieldName: string): GraphQLOutputType | null; export declare function getFieldDescription(schema: GraphQLSchema, operation: OperationType, parentPath: string[], fieldName: string): string | null; export interface SearchResult { typeName: string; kind: string; fieldName?: string; fieldType?: string; description?: string | null; } export interface SearchMatcher { test(input: string): boolean; } /** * Builds a SearchMatcher from a plain-text search string. * * The pattern is split by whitespace into terms. Each term is * prefix-matched (case-insensitive) against CamelCase word segments * of the field name. "Id" matches "AccountId" but not "Hide". */ export declare function parseSearchTerms(pattern: string): SearchMatcher; /** * Builds a SearchMatcher from a regex pattern string. * * Supports `/pattern/flags` syntax for explicit flags. * Without delimiters, defaults to case-insensitive matching. */ export declare function parseSearchRegex(pattern: string): SearchMatcher; export declare function searchSchema(schema: GraphQLSchema, pattern: string, maxResults?: number): SearchResult[];