import type { paths } from "../lib/openapi.js"; export type Configuration = { baseUrl: string; apiKey: string; username?: string; directory: string; }; export type OperationResult = { updated: number; created: number; deleted: number; failed: number; errors: string[]; }; export declare const emptyResult: () => OperationResult; export type SetHooks = { /** Called after a successful create with the server-assigned id. */ onCreated?: (item: unknown, id: string) => Promise; }; export type Resource = { get(configuration: Configuration): Promise; set(value: Model, configuration: Configuration, hooks?: SetHooks): Promise; serialize: (r: Model) => SerializedModel; deserialize: (s: SerializedModel) => Model; }; export declare const constructClient: (configuration: Configuration) => import("../lib/openapi-core.js").Client; export type ResourceGroup = { remote: Resource; local: Resource; name: string; }; export declare const PAGE_SIZE = 100; /** * Drops read-only response fields before sending an object back as a * request body. The API's update schemas don't accept them, and the typed * client rejects unexpected body fields at compile time. */ export declare function omit(obj: T, keys: readonly K[]): Omit; /** * The typed client returns `{ error }` on a non-2xx response instead of * throwing, so both read and write paths must opt in to surfacing failures. * Throws a descriptive error including the serialized API response (e.g. the * 422 validation details) when the call did not succeed. */ export declare function throwIfError(result: T, context: string): asserts result is T & { error?: undefined; }; /** * Walks a paginated endpoint and returns every result. `fetchPage` should * return the full typed-client result so HTTP errors (401s, 500s, rate * limits) fail the sync loudly instead of masquerading as an empty or * truncated list. */ export declare function paginatedList(context: string, fetchPage: (page: number, pageSize: number) => Promise<{ data?: { results?: T[]; }; error?: unknown; }>): Promise; /** * Walks a list of items, calling `update` for each item with an id and * `create` for each item without one. A failing item is counted and * reported rather than aborting the remaining operations, so one deleted * remote resource or validation error can't wedge the whole push. */ export declare function bulkSet(items: T[], spec: { update: (item: T & { id: string; }) => Promise; /** Returns the server-assigned id of the created resource, if any. */ create: (item: T) => Promise; label?: (item: T) => string; }, hooks?: SetHooks): Promise;