import type { ActionDispatchResult } from '@stonecrop/schema'; import type { DataClient } from '@stonecrop/schema'; import type { DoctypeContext } from '@stonecrop/schema'; import { DoctypeMeta } from '@stonecrop/schema'; import type { DoctypeRef } from '@stonecrop/schema'; import type { GetRecordOptions } from '@stonecrop/schema'; import type { GetRecordResult as GetRecordResult_2 } from '@stonecrop/schema'; import type { GetRecordsOptions } from '@stonecrop/schema'; import type { GetRecordsResult } from '@stonecrop/schema'; export { DoctypeContext } export { DoctypeMeta } /** * Result from getRecord - includes the record data and any unknown links requested * @public */ export declare interface GetRecordResult extends GetRecordResult_2 { /** Link names that were requested but don't exist in the doctype schema */ unknownLinks?: string[]; } /** * Client for interacting with Stonecrop GraphQL API. * * Acts as a transport layer for stonecropRecord/stonecropRecords/stonecropAction. * * @public */ export declare class StonecropClient implements DataClient { private endpoint; private headers; private metaCache; constructor(options: StonecropClientOptions); /** * Execute a GraphQL query against the configured endpoint. * * @param query - GraphQL query string * @param variables - Query variables * @throws Error if the GraphQL response contains errors */ query(query: string, variables?: Record): Promise; /** * Execute a GraphQL mutation. Delegates to query() since both use POST. * * @param mutation - GraphQL mutation string * @param variables - Mutation variables */ mutate(mutation: string, variables?: Record): Promise; /** * Get doctype metadata * @param context - Doctype context containing doctype name */ getMeta(context: DoctypeContext): Promise; /** * Get all doctype metadata */ getAllMeta(): Promise; /** * Get a single record by ID. * * Routes through the stonecropRecord resolver which handles nested data * fetching based on the includeNested option. * * @param doctype - Doctype reference (name and optional slug) * @param recordId - Record ID to fetch * @param options - Query options (includeNested, maxDepth) */ getRecord(doctype: DoctypeRef, recordId: string, options?: GetRecordOptions): Promise; /** * Get multiple records with optional filtering and pagination. * * Returns flat arrays — the middleware merges connection format (\{ nodes: [...] \}) * into plain arrays before returning. * * @param doctype - Doctype reference (name and optional slug) * @param options - Query options (filters, orderBy, limit, offset) */ getRecords(doctype: DoctypeRef, options?: GetRecordsOptions): Promise; /** * Execute a doctype action * @param doctype - Doctype reference (name and optional slug) * @param action - Action name to execute * @param args - Action arguments */ runAction(doctype: DoctypeRef, action: string, args?: unknown[]): Promise; /** * Clear the cached doctype metadata. * * Call this if the server-side doctype schema has changed and you need * to fetch fresh metadata (e.g., after adding a new field). */ clearMetaCache(): void; } /** * Options for creating a Stonecrop client * @public */ export declare interface StonecropClientOptions { /** GraphQL endpoint URL */ endpoint: string; /** Additional HTTP headers to include in requests */ headers?: Record; } export { }