/** * Inventory upload HTTP client (SMI-5392, umbrella SMI-5382). * * Authenticates with the stored device-login session (JWT + refresh) and POSTs a * full inventory snapshot to the gateway-verified `inventory-upload` edge * function. Maps the edge function's status codes onto typed errors so callers * (CLI command, MCP tool) can render precise, actionable messages. * * @module @skillsmith/core/sync/inventory-client */ import type { InventoryUploadPayload, InventoryUploadResult } from './inventory-types.js'; /** * No usable session (no stored credentials, or a refresh that failed). The * message hints at the recovery action so the CLI/MCP surface can relay it. * * @see SMI-5392 */ export declare class InventoryAuthError extends Error { constructor(message?: string); } /** * The `device_id` is already owned by another user (HTTP 409). The user must * forget the local device and re-register before retrying. * * @see SMI-5392 */ export declare class InventoryConflictError extends Error { constructor(message?: string); } /** * The server rejected the payload as malformed (HTTP 400) — e.g. * `device_id_required`, `too_many_skills`, or an invalid field. * * @see SMI-5392 */ export declare class InventoryValidationError extends Error { constructor(message?: string); } /** * Catch-all for transport failures and unexpected server responses (HTTP 5xx, * network errors, unparseable bodies). * * @see SMI-5392 */ export declare class InventoryUploadError extends Error { constructor(message: string); } /** * Upload a full inventory snapshot for this device. * * A `200` response is returned verbatim — this INCLUDES the consent-off no-op * `{ ok: true, applied: false, reason: 'consent_disabled' }`, which is a success, * not an error. * * @param payload - The device + skills snapshot to upload. * @returns The edge function's {@link InventoryUploadResult}. * @throws {InventoryAuthError} HTTP 401, or no/expired session. * @throws {InventoryConflictError} HTTP 409 (device owned by another user). * @throws {InventoryValidationError} HTTP 400 (malformed / oversized payload). * @throws {InventoryUploadError} HTTP 5xx, network failure, or unparseable 200 body. * @see SMI-5392 */ export declare function uploadInventory(payload: InventoryUploadPayload): Promise; /** * Permanently delete this user's entire stored cross-machine inventory. * * POSTs to the gateway-verified `purge-inventory` edge function, which removes * the user's device rows (and their skill rows via cascade) server-side. This is * irreversible; callers (CLI command, website) confirm before invoking. Reuses * the same base-URL resolution, auth header/token handling, and typed errors as * {@link uploadInventory} — a purge accepts no payload, so there is no 400/409 * mapping; only 401 (auth) and the catch-all (5xx / network) apply. * * @returns The number of device rows the server deleted. * @throws {InventoryAuthError} HTTP 401, or no/expired session. * @throws {InventoryUploadError} HTTP 5xx, network failure, or unexpected 200 body. * @see SMI-5510 */ export declare function purgeInventory(): Promise; //# sourceMappingURL=inventory-client.d.ts.map