/** * TORUK Core's two response shapes, reconciled in one place. * * Core is not uniform on the deployment runtime plane: * - predictions and `GET /config` return a **bare** body — `{ chatId, text, … }` * - feedback, leads and attachments return an **envelope** — * `{ success, message, data }` * * The SDK's transport wraps whatever arrived as `TorukApiResponse.data`, so a * caller reading `response.data.id` on an enveloped route reads the envelope, * not the record. That single mismatch is the root cause of four shipped bugs: * a feedback id that was always `undefined`, the follow-up `PUT …/feedback/` * sent with an empty id, "Unable to upload documents" from iterating an object, * and the same non-unwrapping in `employees.attach()`. * * These helpers are deliberately shape-sniffing rather than route-configured: * a bare body passes through untouched, so applying them to a route that is * already flat — or that Core later flattens — is a no-op rather than a * regression. */ import type { TorukApiResponse } from '../types/api-response'; /** * Reduce a parsed Core body to its payload. * * Only a *successful* envelope carrying `data` is unwrapped. A `success: false` * body is returned as-is so the caller's existing error handling still sees the * message and code it expects, and a Blob or string passes through unchanged. */ export declare function unwrapCoreBody(body: unknown): T; /** * The same reduction, applied inside the SDK's own response wrapper. * * A transport-level failure is passed straight through — there is no payload * to unwrap and the error envelope is the caller's contract. */ export declare function unwrapCoreEnvelope(response: TorukApiResponse): TorukApiResponse;