@viewrium/sdk 0.1.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/errors.ts","../src/resources/models.ts","../src/resources/apiKeys.ts","../src/resources/usage.ts","../src/resources/tags.ts","../src/client.ts","../src/index.ts"],"names":["BASE"],"mappings":";;;;;AAQO,IAAM,aAAA,GAAN,cAA4B,KAAA,CAAM;AAAA,EAIvC,WAAA,CACE,OAAA,EACA,OAAA,GAA2D,EAAC,EAC5D;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AACZ,IAAA,IAAA,CAAK,aAAa,OAAA,CAAQ,UAAA;AAC1B,IAAA,IAAA,CAAK,eAAe,OAAA,CAAQ,YAAA;AAAA,EAC9B;AACF;AAEO,IAAM,SAAA,GAAN,cAAwB,aAAA,CAAc;AAAA,EAC3C,WAAA,CACE,OAAA,EACA,OAAA,GAA2D,EAAC,EAC5D;AACA,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AACtB,IAAA,IAAA,CAAK,IAAA,GAAO,WAAA;AAAA,EACd;AACF;AAEO,IAAM,aAAA,GAAN,cAA4B,aAAA,CAAc;AAAA,EAC/C,WAAA,CACE,OAAA,EACA,OAAA,GAA2D,EAAC,EAC5D;AACA,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AACtB,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AAAA,EACd;AACF;AAEO,IAAM,eAAA,GAAN,cAA8B,aAAA,CAAc;AAAA,EACjD,WAAA,CACE,OAAA,EACA,OAAA,GAA2D,EAAC,EAC5D;AACA,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AACtB,IAAA,IAAA,CAAK,IAAA,GAAO,iBAAA;AAAA,EACd;AACF;AAEO,IAAM,cAAA,GAAN,cAA6B,aAAA,CAAc;AAAA,EAGhD,WAAA,CACE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ACZ,IAAA,MAAM,MAAA,GAAS,gBAAgB,QAAQ,CAAA;AACvC,IAAA,IAAI,MAAA,KAAW,MAAA,EAAW,OAAO,MAAA,GAAS,GAAA;AAAA,EAC5C;AACA,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,GAAA,CAAI,CAAA,IAAK,SAAS,EAAE,CAAA;AACtC,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,MAAA,EAAO,GAAI,IAAA;AAC/B,EAAA,OAAA,CAAQ,OAAO,MAAA,IAAU,GAAA;AAC3B;AAEA,SAAS,MAAM,EAAA,EAA2B;AACxC,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,YAAY,UAAA,CAAW,OAAA,EAAS,EAAE,CAAC,CAAA;AACzD;;;ACrMA,IAAO,aAAA,GAAQ","file":"index.cjs","sourcesContent":["/**\n * Typed error hierarchy for the Viewrium SDK.\n *\n * All API-originated failures inherit from `ViewriumError`. Network-level\n * failures (connection reset, DNS) bubble up as the underlying fetch error\n * unchanged.\n */\n\nexport class ViewriumError extends Error {\n readonly statusCode: number | undefined;\n readonly responseBody: unknown;\n\n constructor(\n message: string,\n options: { statusCode?: number; responseBody?: unknown } = {},\n ) {\n super(message);\n this.name = \"ViewriumError\";\n this.statusCode = options.statusCode;\n this.responseBody = options.responseBody;\n }\n}\n\nexport class AuthError extends ViewriumError {\n constructor(\n message: string,\n options: { statusCode?: number; responseBody?: unknown } = {},\n ) {\n super(message, options);\n this.name = \"AuthError\";\n }\n}\n\nexport class NotFoundError extends ViewriumError {\n constructor(\n message: string,\n options: { statusCode?: number; responseBody?: unknown } = {},\n ) {\n super(message, options);\n this.name = \"NotFoundError\";\n }\n}\n\nexport class ValidationError extends ViewriumError {\n constructor(\n message: string,\n options: { statusCode?: number; responseBody?: unknown } = {},\n ) {\n super(message, options);\n this.name = \"ValidationError\";\n }\n}\n\nexport class RateLimitError extends ViewriumError {\n readonly retryAfter: number | undefined;\n\n constructor(\n message: string,\n options: {\n statusCode?: number;\n responseBody?: unknown;\n retryAfter?: number;\n } = {},\n ) {\n super(message, options);\n this.name = \"RateLimitError\";\n this.retryAfter = options.retryAfter;\n }\n}\n\nexport class APIError extends ViewriumError {\n constructor(\n message: string,\n options: { statusCode?: number; responseBody?: unknown } = {},\n ) {\n super(message, options);\n this.name = \"APIError\";\n }\n}\n","/**\n * Models resource - 3D models (backed by the `scans` table).\n *\n * Mirrors the 8 `/v1/models*` endpoints. camelCase param names are mapped\n * to the snake_case wire contract on the way out; response shapes pass\n * through as-is.\n */\n\nimport type { Viewrium } from \"../client.js\";\nimport type {\n DeletedResponse,\n FileInput,\n Model,\n ModelCreateFromImagesParams,\n ModelCreateFromVideoParams,\n ModelCreateParams,\n ModelEventListResponse,\n ModelListEventsParams,\n ModelListParams,\n ModelListResponse,\n ModelUpdateParams,\n} from \"../types.js\";\n\nconst BASE = \"/v1/models\";\n\nexport class ModelsResource {\n constructor(private readonly client: Viewrium) {}\n\n async create(params: ModelCreateParams): Promise<Model> {\n const hasImages = Array.isArray(params.images) && params.images.length > 0;\n const hasSource = typeof params.sourceUrl === \"string\" && params.sourceUrl.length > 0;\n if (hasImages === hasSource) {\n throw new Error(\n \"Provide exactly one of `images` (URL list) or `sourceUrl` to models.create().\",\n );\n }\n const body = stripUndefined({\n custom_id: params.customId,\n title: params.title,\n description: params.description,\n image_urls: params.images,\n source_url: params.sourceUrl,\n height: params.height,\n size_unit: params.sizeUnit,\n tags: params.tags,\n price: params.price,\n currency: params.currency,\n metadata: params.metadata,\n display_enabled: params.displayEnabled,\n });\n return this.client.request<Model>({ method: \"POST\", path: BASE, json: body });\n }\n\n async createFromImages(\n images: FileInput[],\n params: ModelCreateFromImagesParams = {},\n ): Promise<Model> {\n if (!Array.isArray(images) || images.length < 1) {\n throw new Error(\"At least 1 image is required.\");\n }\n const form = new FormData();\n for (const image of images) {\n const { blob, filename } = await toBlob(image, \"image\");\n form.append(\"images\", blob, filename);\n }\n appendMultipartCommon(form, params);\n return this.client.request<Model>({\n method: \"POST\",\n path: `${BASE}/from-images`,\n body: form,\n });\n }\n\n async createFromVideo(\n video: FileInput,\n params: ModelCreateFromVideoParams = {},\n ): Promise<Model> {\n const { blob, filename } = await toBlob(video, \"video\");\n const form = new FormData();\n form.append(\"video\", blob, filename);\n appendMultipartCommon(form, params);\n return this.client.request<Model>({\n method: \"POST\",\n path: `${BASE}/from-video`,\n body: form,\n });\n }\n\n async retrieve(modelId: string): Promise<Model> {\n return this.client.request<Model>({ method: \"GET\", path: `${BASE}/${encodeURIComponent(modelId)}` });\n }\n\n async list(params: ModelListParams = {}): Promise<ModelListResponse> {\n const query: Record<string, unknown> = {};\n if (params.tag !== undefined) query.tag = params.tag;\n if (params.tags !== undefined) {\n query.tags = Array.isArray(params.tags) ? params.tags.join(\",\") : params.tags;\n }\n if (params.customId !== undefined) query.custom_id = params.customId;\n if (params.status !== undefined) query.status = params.status;\n if (params.limit !== undefined) query.limit = params.limit;\n if (params.offset !== undefined) query.offset = params.offset;\n return this.client.request<ModelListResponse>({\n method: \"GET\",\n path: BASE,\n query,\n });\n }\n\n async modify(modelId: string, params: ModelUpdateParams): Promise<Model> {\n const body = stripUndefined({\n custom_id: params.customId,\n title: params.title,\n description: params.description,\n price: params.price,\n currency: params.currency,\n height: params.height,\n size_unit: params.sizeUnit,\n tags: params.tags,\n metadata: params.metadata,\n display_enabled: params.displayEnabled,\n });\n return this.client.request<Model>({\n method: \"PATCH\",\n path: `${BASE}/${encodeURIComponent(modelId)}`,\n json: body,\n });\n }\n\n async delete(modelId: string): Promise<DeletedResponse> {\n return this.client.request<DeletedResponse>({\n method: \"DELETE\",\n path: `${BASE}/${encodeURIComponent(modelId)}`,\n });\n }\n\n async listEvents(\n modelId: string,\n params: ModelListEventsParams = {},\n ): Promise<ModelEventListResponse> {\n const query: Record<string, unknown> = {};\n if (params.limit !== undefined) query.limit = params.limit;\n if (params.offset !== undefined) query.offset = params.offset;\n return this.client.request<ModelEventListResponse>({\n method: \"GET\",\n path: `${BASE}/${encodeURIComponent(modelId)}/events`,\n query,\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction stripUndefined<T extends Record<string, unknown>>(obj: T): Partial<T> {\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value !== undefined) out[key] = value;\n }\n return out as Partial<T>;\n}\n\nfunction appendMultipartCommon(\n form: FormData,\n params: ModelCreateFromImagesParams | ModelCreateFromVideoParams,\n): void {\n if (params.title !== undefined) form.append(\"title\", params.title);\n if (params.customId !== undefined) form.append(\"custom_id\", params.customId);\n if (params.description !== undefined) form.append(\"description\", params.description);\n if (params.height !== undefined) form.append(\"height\", String(params.height));\n if (params.sizeUnit !== undefined) form.append(\"size_unit\", params.sizeUnit);\n if (params.tags !== undefined) form.append(\"tags\", JSON.stringify(params.tags));\n if (params.displayEnabled !== undefined) {\n form.append(\"display_enabled\", params.displayEnabled ? \"true\" : \"false\");\n }\n}\n\n/**\n * Normalize a `FileInput` to a Blob + filename suitable for `FormData.append`.\n *\n * - string → treated as a filesystem path (Node-only; dynamic-imports `node:fs`).\n * - Blob/File → used directly; filename inferred from `File.name` if present.\n * - {data, filename?, contentType?} → wrapped in a Blob.\n */\nasync function toBlob(\n input: FileInput,\n fallbackKind: \"image\" | \"video\",\n): Promise<{ blob: Blob; filename: string }> {\n if (typeof input === \"string\") {\n const { readFile } = await import(\"node:fs/promises\");\n const { basename } = await import(\"node:path\");\n const data = await readFile(input);\n const blob = new Blob([data as unknown as BlobPart]);\n return { blob, filename: basename(input) };\n }\n if (input instanceof Blob) {\n const filename =\n (input as File).name && typeof (input as File).name === \"string\"\n ? (input as File).name\n : defaultFilename(fallbackKind);\n return { blob: input, filename };\n }\n if (input && typeof input === \"object\" && \"data\" in input) {\n const { data, filename, contentType } = input;\n const part: BlobPart =\n data instanceof Blob\n ? data\n : data instanceof ArrayBuffer\n ? data\n : (data as unknown as BlobPart);\n const blob = new Blob([part], contentType ? { type: contentType } : undefined);\n return { blob, filename: filename ?? defaultFilename(fallbackKind) };\n }\n throw new Error(\"Unsupported file input: expected string path, Blob, File, or {data, filename}.\");\n}\n\nfunction defaultFilename(kind: \"image\" | \"video\"): string {\n return kind === \"image\" ? \"image.bin\" : \"video.bin\";\n}\n","/**\n * Api keys resource.\n *\n * Creates secret (`sk_*`) or publishable (`pk_*`) keys. pk keys inherit\n * origin restrictions from their project's `allowed_domains`. The plaintext\n * key is returned ONCE from `create()`; store it securely on your side.\n */\n\nimport type { Viewrium } from \"../client.js\";\nimport type {\n ApiKeyCreateParams,\n ApiKeyListResponse,\n ApiKeyWithSecret,\n RevokedResponse,\n} from \"../types.js\";\n\nconst BASE = \"/v1/api_keys\";\n\nexport class ApiKeysResource {\n constructor(private readonly client: Viewrium) {}\n\n async create(params: ApiKeyCreateParams = {}): Promise<ApiKeyWithSecret> {\n const body: Record<string, unknown> = {};\n if (params.name !== undefined) body.name = params.name;\n if (params.keyType !== undefined) body.key_type = params.keyType;\n return this.client.request<ApiKeyWithSecret>({\n method: \"POST\",\n path: BASE,\n json: body,\n });\n }\n\n async list(): Promise<ApiKeyListResponse> {\n return this.client.request<ApiKeyListResponse>({ method: \"GET\", path: BASE });\n }\n\n async delete(keyId: string): Promise<RevokedResponse> {\n return this.client.request<RevokedResponse>({\n method: \"DELETE\",\n path: `${BASE}/${encodeURIComponent(keyId)}`,\n });\n }\n}\n","/**\n * Usage resource.\n *\n * Returns aggregated event counts for the caller's organization. Internal\n * service events (rodin / gemini / scrape / convert / store) are never\n * exposed here.\n */\n\nimport type { Viewrium } from \"../client.js\";\nimport type { UsageRetrieveParams, UsageSummary } from \"../types.js\";\n\nconst BASE = \"/v1/usage\";\n\nexport class UsageResource {\n constructor(private readonly client: Viewrium) {}\n\n async retrieve(params: UsageRetrieveParams = {}): Promise<UsageSummary> {\n const query: Record<string, unknown> = {};\n if (params.since !== undefined) query.since = params.since;\n if (params.until !== undefined) query.until = params.until;\n return this.client.request<UsageSummary>({\n method: \"GET\",\n path: BASE,\n query,\n });\n }\n}\n","/**\n * Tags resource.\n *\n * Lists unique tags across the caller's organization with per-tag model\n * counts. Tags are created implicitly when assigned to a model; there is\n * no POST /v1/tags endpoint.\n */\n\nimport type { Viewrium } from \"../client.js\";\nimport type { TagListResponse } from \"../types.js\";\n\nconst BASE = \"/v1/tags\";\n\nexport class TagsResource {\n constructor(private readonly client: Viewrium) {}\n\n async list(): Promise<TagListResponse> {\n return this.client.request<TagListResponse>({ method: \"GET\", path: BASE });\n }\n}\n","/**\n * Viewrium client.\n *\n * Instantiate once per api key:\n *\n * const viewrium = new Viewrium(process.env.VIEWRIUM_API_KEY!);\n * const model = await viewrium.models.create({ images: [...] });\n *\n * The client uses `globalThis.fetch` by default (Node 18+, browsers, edge\n * runtimes all provide it). Pass `fetch` in options for custom transports\n * or testing.\n */\n\nimport {\n APIError,\n AuthError,\n NotFoundError,\n RateLimitError,\n ValidationError,\n ViewriumError,\n} from \"./errors.js\";\nimport type { ViewriumOptions } from \"./types.js\";\nimport { ModelsResource } from \"./resources/models.js\";\nimport { ApiKeysResource } from \"./resources/apiKeys.js\";\nimport { UsageResource } from \"./resources/usage.js\";\nimport { TagsResource } from \"./resources/tags.js\";\n\nconst DEFAULT_API_BASE = \"https://api.viewrium.com\";\nconst DEFAULT_TIMEOUT_MS = 60_000;\nconst DEFAULT_MAX_RETRIES = 3;\nconst RETRYABLE_STATUSES = new Set([429, 500, 502, 503, 504]);\nconst VERSION = \"0.1.0\";\n\nexport interface RequestOptions {\n method: string;\n path: string;\n query?: Record<string, unknown>;\n json?: unknown;\n body?: BodyInit;\n headers?: Record<string, string>;\n /** Override per-request timeout in ms. */\n timeoutMs?: number;\n}\n\nexport class Viewrium {\n readonly models: ModelsResource;\n readonly apiKeys: ApiKeysResource;\n readonly usage: UsageResource;\n readonly tags: TagsResource;\n\n private readonly apiKey: string;\n private readonly apiBase: string;\n private readonly timeoutMs: number;\n private readonly maxRetries: number;\n private readonly fetchImpl: typeof fetch;\n\n constructor(apiKey?: string, options: ViewriumOptions = {}) {\n const envKey =\n typeof process !== \"undefined\" ? process.env?.VIEWRIUM_API_KEY : undefined;\n const resolvedKey = options.apiKey ?? apiKey ?? envKey;\n if (!resolvedKey) {\n throw new AuthError(\n \"No API key configured. Pass `new Viewrium('sk_live_...')` or set VIEWRIUM_API_KEY.\",\n );\n }\n this.apiKey = resolvedKey;\n\n const envBase =\n typeof process !== \"undefined\" ? process.env?.VIEWRIUM_API_BASE : undefined;\n this.apiBase = (options.apiBase ?? envBase ?? DEFAULT_API_BASE).replace(/\\/+$/, \"\");\n\n this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;\n\n const providedFetch = options.fetch;\n if (providedFetch) {\n this.fetchImpl = providedFetch;\n } else if (typeof globalThis.fetch === \"function\") {\n this.fetchImpl = globalThis.fetch.bind(globalThis);\n } else {\n throw new Error(\n \"No `fetch` implementation available. Use Node 18+ or pass `fetch` in options.\",\n );\n }\n\n this.models = new ModelsResource(this);\n this.apiKeys = new ApiKeysResource(this);\n this.usage = new UsageResource(this);\n this.tags = new TagsResource(this);\n }\n\n /** Low-level request. Resources delegate here. */\n async request<T = unknown>(options: RequestOptions): Promise<T> {\n const url = this.buildUrl(options.path, options.query);\n const headers = this.buildHeaders(options);\n const body = this.buildBody(options);\n\n let attempt = 0;\n let lastResponse: Response | undefined;\n while (true) {\n lastResponse = undefined;\n const controller = new AbortController();\n const timeoutMs = options.timeoutMs ?? this.timeoutMs;\n const timer = setTimeout(() => controller.abort(), timeoutMs);\n try {\n lastResponse = await this.fetchImpl(url, {\n method: options.method,\n headers,\n body,\n signal: controller.signal,\n });\n } catch (err) {\n clearTimeout(timer);\n if (attempt >= this.maxRetries) throw err;\n await sleep(backoffMs(undefined, attempt));\n attempt += 1;\n continue;\n }\n clearTimeout(timer);\n\n if (\n RETRYABLE_STATUSES.has(lastResponse.status) &&\n attempt < this.maxRetries\n ) {\n await sleep(backoffMs(lastResponse, attempt));\n attempt += 1;\n continue;\n }\n break;\n }\n\n if (!lastResponse.ok) {\n await raiseForStatus(lastResponse);\n }\n return (await parseResponse(lastResponse)) as T;\n }\n\n private buildUrl(path: string, query?: Record<string, unknown>): string {\n const full =\n path.startsWith(\"http://\") || path.startsWith(\"https://\")\n ? path\n : `${this.apiBase}${path.startsWith(\"/\") ? path : `/${path}`}`;\n if (!query) return full;\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined || value === null) continue;\n if (Array.isArray(value)) {\n for (const v of value) {\n if (v !== undefined && v !== null) params.append(key, String(v));\n }\n } else {\n params.append(key, String(value));\n }\n }\n const qs = params.toString();\n return qs ? `${full}?${qs}` : full;\n }\n\n private buildHeaders(options: RequestOptions): Headers {\n const headers = new Headers(options.headers);\n headers.set(\"Authorization\", `Bearer ${this.apiKey}`);\n headers.set(\"Accept\", \"application/json\");\n if (!headers.has(\"User-Agent\") && typeof process !== \"undefined\") {\n // `fetch` in browsers forbids setting User-Agent; it's harmless in Node.\n try {\n headers.set(\"User-Agent\", `viewrium-js/${VERSION}`);\n } catch {\n /* ignore */\n }\n }\n if (options.json !== undefined && !headers.has(\"Content-Type\")) {\n headers.set(\"Content-Type\", \"application/json\");\n }\n return headers;\n }\n\n private buildBody(options: RequestOptions): BodyInit | undefined {\n if (options.body !== undefined) return options.body;\n if (options.json !== undefined) return JSON.stringify(options.json);\n return undefined;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nasync function parseResponse(response: Response): Promise<unknown> {\n if (response.status === 204) return {};\n const text = await response.text();\n if (!text) return {};\n try {\n return JSON.parse(text);\n } catch (e) {\n throw new APIError(`Failed to parse JSON response: ${(e as Error).message}`, {\n statusCode: response.status,\n responseBody: text,\n });\n }\n}\n\nasync function raiseForStatus(response: Response): Promise<never> {\n const body = await parseBodyForError(response);\n const detail = extractDetail(body, response);\n const status = response.status;\n const opts = { statusCode: status, responseBody: body };\n if (status === 401) throw new AuthError(detail, opts);\n if (status === 404) throw new NotFoundError(detail, opts);\n if (status === 400 || status === 409 || status === 422) {\n throw new ValidationError(detail, opts);\n }\n if (status === 429) {\n throw new RateLimitError(detail, {\n ...opts,\n retryAfter: parseRetryAfter(response),\n });\n }\n throw new APIError(detail, opts);\n}\n\nasync function parseBodyForError(response: Response): Promise<unknown> {\n const text = await response.text();\n if (!text) return undefined;\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n}\n\nfunction extractDetail(body: unknown, response: Response): string {\n if (body && typeof body === \"object\" && !Array.isArray(body)) {\n const obj = body as Record<string, unknown>;\n const candidate = obj.detail ?? obj.error ?? obj.message;\n if (typeof candidate === \"string\" && candidate) return candidate;\n if (candidate !== undefined) return String(candidate);\n }\n if (typeof body === \"string\" && body) return body;\n return `HTTP ${response.status}`;\n}\n\nfunction parseRetryAfter(response: Response): number | undefined {\n const raw = response.headers.get(\"Retry-After\");\n if (!raw) return undefined;\n const n = Number(raw);\n return Number.isFinite(n) ? n : undefined;\n}\n\nfunction backoffMs(response: Response | undefined, attempt: number): number {\n if (response) {\n const hinted = parseRetryAfter(response);\n if (hinted !== undefined) return hinted * 1000;\n }\n const base = Math.min(2 ** attempt, 30);\n const jitter = Math.random() * 0.25;\n return (base + jitter) * 1000;\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/** Re-export for resources to reuse without a circular dep loop. */\nexport { ViewriumError };\n","/**\n * Official JavaScript / TypeScript SDK for the Viewrium API.\n *\n * import Viewrium from \"@viewrium/sdk\";\n *\n * const viewrium = new Viewrium(process.env.VIEWRIUM_API_KEY!);\n *\n * const model = await viewrium.models.create({\n * customId: \"sku-1\",\n * images: [\"https://example.com/img1.jpg\"],\n * height: 90,\n * tags: [\"chair\", \"summer-2026\"],\n * });\n */\n\nexport { Viewrium } from \"./client.js\";\nexport type { RequestOptions } from \"./client.js\";\n\nexport {\n APIError,\n AuthError,\n NotFoundError,\n RateLimitError,\n ValidationError,\n ViewriumError,\n} from \"./errors.js\";\n\nexport type {\n ApiKey,\n ApiKeyCreateParams,\n ApiKeyListResponse,\n ApiKeyWithSecret,\n DeletedResponse,\n FileInput,\n Model,\n ModelCreateFromImagesParams,\n ModelCreateFromVideoParams,\n ModelCreateParams,\n ModelEvent,\n ModelEventListResponse,\n ModelListEventsParams,\n ModelListParams,\n ModelListResponse,\n ModelStatus,\n ModelUpdateParams,\n RevokedResponse,\n SizeUnit,\n SourceType,\n TagListResponse,\n TagSummary,\n UsageEventType,\n UsageRetrieveParams,\n UsageSummary,\n ViewriumOptions,\n} from \"./types.js\";\n\nexport type { ModelsResource } from \"./resources/models.js\";\nexport type { ApiKeysResource } from \"./resources/apiKeys.js\";\nexport type { UsageResource } from \"./resources/usage.js\";\nexport type { TagsResource } from \"./resources/tags.js\";\n\n// Default export for convenience: `import Viewrium from \"@viewrium/sdk\"`.\nimport { Viewrium } from \"./client.js\";\nexport default Viewrium;\n"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/errors.ts"],"sourcesContent":["/**\n * @viewrium/sdk - the official Viewrium JavaScript/TypeScript SDK.\n *\n * An ergonomic wrapper over the `/v1` REST API. Request/response types are derived from\n * `src/generated/schema.ts` - openapi-typescript output committed from the API's authoritative\n * `apps/api/openapi.json` (the same generator `@repo/api-client` uses; regenerate with\n * `pnpm run generate`). Owning the committed schema keeps the published `dist/index.d.ts`\n * self-contained: it cannot reference the unpublished, source-only `@repo/api-client`.\n *\n * Auth: pass an `sk_` secret key (server) or a `pk_` publishable key (browser). The key is sent\n * as `Authorization: Bearer <key>`; the API enforces what each key type may call.\n *\n * E4 (2026-09-09): the scan-era `models` resource is GONE with its routes; `products` is the\n * resource. Resource and method names match `@repo/api-client` so every client reads the same.\n */\nimport { ConnectionError, ViewriumError, createApiError } from \"./errors\";\nimport type { paths } from \"./generated/schema\";\n\nexport * from \"./errors\";\n\n// --- Derived request/response types (source of truth = apps/api/openapi.json) ----------------\n\ntype JsonContent<T> = T extends { content: { \"application/json\": infer B } } ? B : never;\n\n/** GET /v1/products/{id} resolves to one of two shapes by principal: the full product for a\n * session or `sk_` key, the allow-listed public projection for a `pk_` key. */\ntype ProductGetResult = JsonContent<paths[\"/v1/products/{id}\"][\"get\"][\"responses\"][200]>;\n/** A product with its assets (`sk_` view). */\nexport type Product = Extract<ProductGetResult, { org_id: string }>;\n/** The `pk_` view of a published product: id, title, thumbnail_url, model_status, wall_mounted. The model\n * file itself is reached through `products.createTicket`. */\nexport type PublicProduct = Exclude<ProductGetResult, { org_id: string }>;\nexport type ProductList = JsonContent<paths[\"/v1/products\"][\"get\"][\"responses\"][200]>;\n/** A catalog row - the product plus what its card needs, with no nested assets. */\nexport type ProductSummary = ProductList[\"data\"][number];\nexport type ProductListParams = NonNullable<paths[\"/v1/products\"][\"get\"][\"parameters\"][\"query\"]>;\nexport type ProductCreateParams = JsonContent<paths[\"/v1/products\"][\"post\"][\"requestBody\"]>;\n/** POST /v1/products 200 - the gate parked; resume by POSTing `resume_token`. */\nexport type ProductParked = JsonContent<paths[\"/v1/products\"][\"post\"][\"responses\"][200]>;\n/** One page position of a parked plan. Both park shapes carry the same row type. */\nexport type PlannedView = NonNullable<ProductParked[\"plan\"]>[number];\n/** describe's structured read of the product (D25), with its verbatim reasons. */\nexport type GateFlags = ProductParked[\"flags\"];\n/** The models layer's verdict: whether a model is allowed, what blocks it, and the views it\n * would be built from - including `unseen_views`, the invented ones. */\nexport type ModelPlan = ProductParked[\"model\"];\n/** The priced bundle, in credits (1 credit = $0.50): 1 per deliverable image, a flat 10 for a model. */\nexport type ProductCost = ProductParked[\"cost\"];\n/** POST /v1/products 202 - a committed product whose run has started. */\nexport type ProductCreated = JsonContent<paths[\"/v1/products\"][\"post\"][\"responses\"][202]>;\n/** POST /v1/products resolves to one of the two (discriminate on `status === \"parked\"`). */\nexport type ProductCreateResult = ProductParked | ProductCreated;\nexport type ProductUpdateParams = JsonContent<\n NonNullable<paths[\"/v1/products/{id}\"][\"patch\"][\"requestBody\"]>\n>;\nexport type ProductBatchResult = JsonContent<paths[\"/v1/products\"][\"delete\"][\"responses\"][200]>;\nexport type ProductPublishParams = JsonContent<\n paths[\"/v1/products/publish\"][\"post\"][\"requestBody\"]\n>;\nexport type Tags = JsonContent<paths[\"/v1/products/tags\"][\"get\"][\"responses\"][200]>;\nexport type TagsParams = NonNullable<paths[\"/v1/products/tags\"][\"get\"][\"parameters\"][\"query\"]>;\n/** POST /v1/products/{id}/review - the write-behind flush (image + model decisions, the\n * product's user-set status). It records decisions only. */\nexport type ProductReviewParams = JsonContent<\n paths[\"/v1/products/{id}/review\"][\"post\"][\"requestBody\"]\n>;\nexport type ProductReviewResult = JsonContent<\n paths[\"/v1/products/{id}/review\"][\"post\"][\"responses\"][200]\n>;\nexport type ProductImagePatchParams = JsonContent<\n NonNullable<paths[\"/v1/products/{id}/images/{image_id}\"][\"patch\"][\"requestBody\"]>\n>;\nexport type ProductImage = JsonContent<\n paths[\"/v1/products/{id}/images/{image_id}\"][\"patch\"][\"responses\"][200]\n>;\nexport type ProductModelPatchParams = JsonContent<\n NonNullable<paths[\"/v1/products/{id}/model\"][\"patch\"][\"requestBody\"]>\n>;\nexport type ProductModel = JsonContent<paths[\"/v1/products/{id}/model\"][\"patch\"][\"responses\"][200]>;\nexport type ProductRescaleParams = JsonContent<\n paths[\"/v1/products/{id}/model/rescale\"][\"post\"][\"requestBody\"]\n>;\n/** POST /v1/products/{id}/tickets - `{ kind: \"view\" | \"ar\", origin? }`. */\nexport type TicketParams = JsonContent<paths[\"/v1/products/{id}/tickets\"][\"post\"][\"requestBody\"]>;\n/** A single-use model URL: `{ url, kind, expires_at }`. */\nexport type Ticket = JsonContent<paths[\"/v1/products/{id}/tickets\"][\"post\"][\"responses\"][200]>;\n/** POST /v1/products/{id}/order - the missing half; parks like a create, commits through\n * `products.create({ resume_token })`. */\nexport type ProductOrderParams = JsonContent<\n paths[\"/v1/products/{id}/order\"][\"post\"][\"requestBody\"]\n>;\nexport type ProductOrderParked = JsonContent<\n paths[\"/v1/products/{id}/order\"][\"post\"][\"responses\"][200]\n>;\nexport type ProductExportParams = NonNullable<\n paths[\"/v1/products/export\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** 202 from the export: the images are being finished in the background and a download link\n * is emailed; the same request streams the ZIP once they are done. */\nexport type ProductExportQueued = JsonContent<\n paths[\"/v1/products/export\"][\"get\"][\"responses\"][202]\n>;\n\nexport type ApiKeyList = JsonContent<paths[\"/v1/api_keys\"][\"get\"][\"responses\"][200]>;\nexport type ApiKeyCreateParams = JsonContent<paths[\"/v1/api_keys\"][\"post\"][\"requestBody\"]>;\nexport type ApiKeyCreated = JsonContent<paths[\"/v1/api_keys\"][\"post\"][\"responses\"][201]>;\n\nexport type Usage = JsonContent<paths[\"/v1/usage\"][\"get\"][\"responses\"][200]>;\nexport type UsageParams = NonNullable<paths[\"/v1/usage\"][\"get\"][\"parameters\"][\"query\"]>;\n/** One `group_by: \"product\"` row: a product's counts over the window, with its title. */\nexport type UsageProductTotals = NonNullable<Usage[\"by_product\"]>[number];\n\nexport type WebhookEndpoint = JsonContent<paths[\"/v1/webhooks/{id}\"][\"get\"][\"responses\"][200]>;\nexport type WebhookEndpointList = JsonContent<paths[\"/v1/webhooks\"][\"get\"][\"responses\"][200]>;\nexport type WebhookEndpointCreateParams = JsonContent<paths[\"/v1/webhooks\"][\"post\"][\"requestBody\"]>;\nexport type WebhookEndpointCreated = JsonContent<\n paths[\"/v1/webhooks\"][\"post\"][\"responses\"][201]\n>;\nexport type WebhookEndpointUpdateParams = JsonContent<\n NonNullable<paths[\"/v1/webhooks/{id}\"][\"patch\"][\"requestBody\"]>\n>;\nexport type WebhookDeliveryList = JsonContent<\n paths[\"/v1/webhooks/{id}/deliveries\"][\"get\"][\"responses\"][200]\n>;\nexport type WebhookDeliveriesParams = NonNullable<\n paths[\"/v1/webhooks/{id}/deliveries\"][\"get\"][\"parameters\"][\"query\"]\n>;\n\nexport type Project = JsonContent<paths[\"/v1/projects/{id}\"][\"get\"][\"responses\"][200]>;\nexport type ProjectList = JsonContent<paths[\"/v1/projects\"][\"get\"][\"responses\"][200]>;\n\nexport type BeaconParams = JsonContent<paths[\"/v1/beacon\"][\"post\"][\"requestBody\"]>;\n\nexport type Health = JsonContent<paths[\"/v1/health\"][\"get\"][\"responses\"][200]>;\n\n// --- Client options + transport --------------------------------------------------------------\n\nexport type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;\n\nexport interface ViewriumOptions {\n /** `sk_` secret key (server) or `pk_` publishable key (browser). */\n apiKey: string;\n /** API origin; defaults to `https://api.viewrium.com`. Trailing slash is stripped. */\n baseUrl?: string;\n /** Injectable fetch (tests, custom agents). Defaults to `globalThis.fetch`. */\n fetch?: FetchLike;\n}\n\nconst DEFAULT_BASE_URL = \"https://api.viewrium.com\";\n\ntype QueryValue = string | number | boolean | readonly string[] | null | undefined;\ntype QueryParams = Record<string, QueryValue>;\n\ninterface RequestOptions {\n query?: QueryParams;\n body?: unknown;\n}\n\ntype RequestFn = <T>(method: string, path: string, options?: RequestOptions) => Promise<T>;\n/** The escape hatch for the one route that answers bytes rather than JSON (the export ZIP) -\n * or, on a 202, JSON after all. */\ntype BlobRequestFn = (\n method: string,\n path: string,\n options?: RequestOptions,\n) => Promise<Blob | ProductExportQueued>;\n\ninterface Transport {\n baseUrl: string;\n apiKey: string;\n fetch: FetchLike;\n}\n\nfunction buildUrl(baseUrl: string, path: string, query?: QueryParams): string {\n const url = new URL(baseUrl + path);\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined || value === null) continue;\n if (Array.isArray(value)) {\n for (const item of value as readonly string[]) url.searchParams.append(key, String(item));\n } else {\n url.searchParams.append(key, String(value));\n }\n }\n }\n return url.toString();\n}\n\nasync function parseError(res: Response): Promise<ViewriumError> {\n let code = \"error\";\n let message = res.statusText || `HTTP ${res.status}`;\n let details: unknown;\n try {\n const data: unknown = await res.json();\n if (data && typeof data === \"object\" && \"error\" in data) {\n const envelope = (data as { error: unknown }).error;\n if (envelope && typeof envelope === \"object\") {\n const e = envelope as Record<string, unknown>;\n if (typeof e.code === \"string\") code = e.code;\n if (typeof e.message === \"string\") message = e.message;\n details = e.details;\n }\n }\n } catch {\n // Non-JSON error body; fall back to status text.\n }\n return createApiError(res.status, { code, message, details });\n}\n\nasync function send(\n transport: Transport,\n method: string,\n path: string,\n options?: RequestOptions,\n): Promise<Response> {\n const headers: Record<string, string> = {\n accept: \"application/json\",\n authorization: `Bearer ${transport.apiKey}`,\n };\n const init: RequestInit = { method, headers };\n if (options?.body !== undefined) {\n headers[\"content-type\"] = \"application/json\";\n init.body = JSON.stringify(options.body);\n }\n\n let res: Response;\n try {\n res = await transport.fetch(buildUrl(transport.baseUrl, path, options?.query), init);\n } catch (cause) {\n throw new ConnectionError(\"The request to the Viewrium API could not be sent.\", { cause });\n }\n\n if (!res.ok) {\n throw await parseError(res);\n }\n return res;\n}\n\nasync function doRequest<T>(\n transport: Transport,\n method: string,\n path: string,\n options?: RequestOptions,\n): Promise<T> {\n const res = await send(transport, method, path, options);\n if (res.status === 204) {\n return undefined as T;\n }\n const text = await res.text();\n return (text ? JSON.parse(text) : undefined) as T;\n}\n\nasync function doBlobRequest(\n transport: Transport,\n method: string,\n path: string,\n options?: RequestOptions,\n): Promise<Blob | ProductExportQueued> {\n const res = await send(transport, method, path, options);\n if (res.status === 202) return (await res.json()) as ProductExportQueued;\n return res.blob();\n}\n\nconst encode = encodeURIComponent;\n\n// --- Resource namespaces ---------------------------------------------------------------------\n\nfunction createProducts(request: RequestFn, requestBlob: BlobRequestFn) {\n return {\n /**\n * POST /v1/products - the single generation entrypoint. Supply exactly one source\n * (`image_paths` | `image_urls` | `video_url` | `source_url` | `model_url` |\n * `resume_token`). A fresh request ALWAYS parks (200, `status === \"parked\"`, nothing\n * written): the plan, the model verdict and the price come back inside `resume_token`,\n * which you POST back to commit (202, `ProductCreated`). A `model_url` commits at once.\n */\n create: (params: ProductCreateParams) =>\n request<ProductCreateResult>(\"POST\", \"/v1/products\", { body: params }),\n /**\n * GET /v1/products - the catalog: one org (`org_id`, or the caller's only org), or\n * `scope: \"all\"` for every org an agency member or staff reaches. Filters AND together.\n */\n list: (params?: ProductListParams) =>\n request<ProductList>(\"GET\", \"/v1/products\", { query: params as QueryParams | undefined }),\n /** GET /v1/products/{id} - the product with its assets (a `pk_` key gets `PublicProduct`). */\n retrieve: (id: string) => request<Product>(\"GET\", `/v1/products/${encode(id)}`),\n /**\n * PATCH /v1/products/{id} - the customer's fields, the user-set status and the publish\n * toggle. 409 on a `custom_id` another product in the org already holds.\n */\n update: (id: string, params: ProductUpdateParams) =>\n request<Product>(\"PATCH\", `/v1/products/${encode(id)}`, { body: params }),\n /** DELETE /v1/products/{id} */\n delete: (id: string) => request<void>(\"DELETE\", `/v1/products/${encode(id)}`),\n /** DELETE /v1/products?ids=... - per-id affected/not_found/forbidden buckets. */\n batchDelete: (ids: readonly string[]) =>\n request<ProductBatchResult>(\"DELETE\", \"/v1/products\", { query: { ids } }),\n /** POST /v1/products/publish - the bulk publish toggle; one product toggles through `update`. */\n publish: (params: ProductPublishParams) =>\n request<ProductBatchResult>(\"POST\", \"/v1/products/publish\", { body: params }),\n /** GET /v1/products/tags - distinct tags across the same scope the list takes. */\n tags: (params?: TagsParams) =>\n request<Tags>(\"GET\", \"/v1/products/tags\", { query: params as QueryParams | undefined }),\n /** POST /v1/products/{id}/review - the review flush: image and model decisions plus the\n * product's user-set status, validated together and applied in order. */\n review: (id: string, params: ProductReviewParams) =>\n request<ProductReviewResult>(\"POST\", `/v1/products/${encode(id)}/review`, { body: params }),\n /** PATCH /v1/products/{id}/images/{image_id} - one image's decision and overrides. */\n updateImage: (id: string, imageId: string, params: ProductImagePatchParams) =>\n request<ProductImage>(\"PATCH\", `/v1/products/${encode(id)}/images/${encode(imageId)}`, {\n body: params,\n }),\n /** PATCH /v1/products/{id}/model - the model's review decision. */\n updateModel: (id: string, params: ProductModelPatchParams) =>\n request<ProductModel>(\"PATCH\", `/v1/products/${encode(id)}/model`, { body: params }),\n /**\n * POST /v1/products/{id}/model/rescale - re-apply real-world scale to the GLB in place.\n * Every supplied axis is applied to the geometry; `unit` covers them (omitted = cm) and is\n * remembered as the product's `display_unit`. The result carries the ACHIEVED dimensions.\n */\n rescale: (id: string, params: ProductRescaleParams) =>\n request<Product>(\"POST\", `/v1/products/${encode(id)}/model/rescale`, { body: params }),\n /**\n * POST /v1/products/{id}/tickets - a single-use URL for the product's 3D file, the ONLY way\n * to its bytes (no response carries a model file URL). It works once, until `expires_at`\n * (60 s for `view`, 30 s for `ar`); a `view` ticket only from its bound origin. With a `pk_`\n * key the product must be published and the ticket is bound to the page's Origin; with an\n * `sk_` key pass `origin` (the page that will load the model, one of your allowed domains).\n */\n createTicket: (id: string, params: TicketParams) =>\n request<Ticket>(\"POST\", `/v1/products/${encode(id)}/tickets`, { body: params }),\n /** POST /v1/products/{id}/order - park the missing half (images or a model); commit the\n * returned `resume_token` with `create`. */\n order: (id: string, params: ProductOrderParams) =>\n request<ProductOrderParked>(\"POST\", `/v1/products/${encode(id)}/order`, { body: params }),\n /** GET /v1/products/export - a ZIP of finished images (never the 3D model), resolved as a\n * `Blob`; or `ProductExportQueued` (202) when the images are being finished in the\n * background and a download link is emailed - repeat the request later to stream it. */\n export: (params?: ProductExportParams) =>\n requestBlob(\"GET\", \"/v1/products/export\", { query: params as QueryParams | undefined }),\n };\n}\n\nfunction createApiKeys(request: RequestFn) {\n return {\n /** GET /v1/api_keys */\n list: () => request<ApiKeyList>(\"GET\", \"/v1/api_keys\"),\n /** POST /v1/api_keys - the full key is returned exactly once. */\n create: (params: ApiKeyCreateParams) =>\n request<ApiKeyCreated>(\"POST\", \"/v1/api_keys\", { body: params }),\n /** DELETE /v1/api_keys/{id} - soft revoke. */\n revoke: (id: string) => request<void>(\"DELETE\", `/v1/api_keys/${encode(id)}`),\n };\n}\n\nfunction createUsage(request: RequestFn) {\n return {\n /** GET /v1/usage - buckets and totals over the window; `group_by: \"product\"` adds the\n * window's best-performing products in `by_product`. */\n get: (params?: UsageParams) =>\n request<Usage>(\"GET\", \"/v1/usage\", { query: params as QueryParams | undefined }),\n };\n}\n\nfunction createWebhooks(request: RequestFn) {\n return {\n /** GET /v1/webhooks */\n list: () => request<WebhookEndpointList>(\"GET\", \"/v1/webhooks\"),\n /** POST /v1/webhooks - includes the signing secret. */\n create: (params: WebhookEndpointCreateParams) =>\n request<WebhookEndpointCreated>(\"POST\", \"/v1/webhooks\", { body: params }),\n /** GET /v1/webhooks/{id} */\n retrieve: (id: string) => request<WebhookEndpoint>(\"GET\", `/v1/webhooks/${encode(id)}`),\n /** PATCH /v1/webhooks/{id} */\n update: (id: string, params: WebhookEndpointUpdateParams) =>\n request<WebhookEndpoint>(\"PATCH\", `/v1/webhooks/${encode(id)}`, { body: params }),\n /** DELETE /v1/webhooks/{id} */\n delete: (id: string) => request<void>(\"DELETE\", `/v1/webhooks/${encode(id)}`),\n /** GET /v1/webhooks/{id}/deliveries */\n listDeliveries: (id: string, params?: WebhookDeliveriesParams) =>\n request<WebhookDeliveryList>(\"GET\", `/v1/webhooks/${encode(id)}/deliveries`, {\n query: params as QueryParams | undefined,\n }),\n };\n}\n\nfunction createProjects(request: RequestFn) {\n return {\n /** GET /v1/projects */\n list: () => request<ProjectList>(\"GET\", \"/v1/projects\"),\n /** GET /v1/projects/{id} */\n retrieve: (id: string) => request<Project>(\"GET\", `/v1/projects/${encode(id)}`),\n };\n}\n\nfunction createBeacon(request: RequestFn) {\n return {\n /** POST /v1/beacon - ingest a view/AR analytics event (204). */\n send: (params: BeaconParams) => request<void>(\"POST\", \"/v1/beacon\", { body: params }),\n };\n}\n\n// --- Client ----------------------------------------------------------------------------------\n\nexport class Viewrium {\n readonly baseUrl: string;\n readonly products: ReturnType<typeof createProducts>;\n readonly apiKeys: ReturnType<typeof createApiKeys>;\n readonly usage: ReturnType<typeof createUsage>;\n readonly webhooks: ReturnType<typeof createWebhooks>;\n readonly projects: ReturnType<typeof createProjects>;\n readonly beacon: ReturnType<typeof createBeacon>;\n\n readonly #request: RequestFn;\n\n constructor(options: ViewriumOptions) {\n if (!options || !options.apiKey) {\n throw new ViewriumError(\"A Viewrium client requires an `apiKey` (sk_ or pk_).\");\n }\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n\n const provided = options.fetch;\n const globalFetch = typeof globalThis.fetch === \"function\" ? globalThis.fetch.bind(globalThis) : undefined;\n const fetchImpl = provided ?? globalFetch;\n if (!fetchImpl) {\n throw new ViewriumError(\"No fetch implementation available; pass `options.fetch`.\");\n }\n\n const transport: Transport = { baseUrl: this.baseUrl, apiKey: options.apiKey, fetch: fetchImpl };\n const request: RequestFn = <T>(method: string, path: string, opts?: RequestOptions) =>\n doRequest<T>(transport, method, path, opts);\n const requestBlob: BlobRequestFn = (method, path, opts) =>\n doBlobRequest(transport, method, path, opts);\n this.#request = request;\n\n this.products = createProducts(request, requestBlob);\n this.apiKeys = createApiKeys(request);\n this.usage = createUsage(request);\n this.webhooks = createWebhooks(request);\n this.projects = createProjects(request);\n this.beacon = createBeacon(request);\n }\n\n /** GET /v1/health */\n health(): Promise<Health> {\n return this.#request<Health>(\"GET\", \"/v1/health\");\n }\n}\n\n/** Convenience factory: `createViewrium({ apiKey })` is `new Viewrium({ apiKey })`. */\nexport function createViewrium(options: ViewriumOptions): Viewrium {\n return new Viewrium(options);\n}\n","/**\n * Typed errors for the Viewrium SDK.\n *\n * The API returns one error envelope: `{ \"error\": { code, message, details } }`.\n * Non-2xx responses are parsed into a `ViewriumError` subclass keyed by HTTP status;\n * consumers branch with `instanceof`.\n */\n\nexport interface ViewriumErrorOptions {\n status?: number | null;\n code?: string;\n details?: unknown;\n cause?: unknown;\n}\n\nexport class ViewriumError extends Error {\n /** HTTP status, or `null` for transport/connection failures. */\n readonly status: number | null;\n /** Machine-readable code from the error envelope. */\n readonly code: string;\n /** Optional structured details from the error envelope. */\n readonly details: unknown;\n\n constructor(message: string, options: ViewriumErrorOptions = {}) {\n super(message, options.cause !== undefined ? { cause: options.cause } : undefined);\n this.name = new.target.name;\n this.status = options.status ?? null;\n this.code = options.code ?? \"error\";\n this.details = options.details;\n }\n}\n\n/** 400 - malformed request. */\nexport class BadRequestError extends ViewriumError {}\n/** 401 - missing or invalid API key. */\nexport class AuthenticationError extends ViewriumError {}\n/**\n * 402 - the organization's plan does not allow this: no plan, a used free trial, a failed payment,\n * or past the plan's active-product cap. `details.reason` says which.\n */\nexport class PaymentRequiredError extends ViewriumError {}\n/** 403 - the key is valid but not allowed (scope, origin, or role). */\nexport class PermissionError extends ViewriumError {}\n/** 404 - no such resource. */\nexport class NotFoundError extends ViewriumError {}\n/** 409 - conflict (e.g. duplicate `custom_id`, model not in a rescalable state). */\nexport class ConflictError extends ViewriumError {}\n/** 422 - request failed validation. */\nexport class UnprocessableEntityError extends ViewriumError {}\n/** 429 - rate limited, or not enough credits (`code: \"quota_exceeded\"`, `details.shortfall_credits`). */\nexport class RateLimitError extends ViewriumError {}\n/** 5xx - the API failed to handle the request. */\nexport class ServerError extends ViewriumError {}\n/** The request never reached the API (DNS/TLS/offline/abort). */\nexport class ConnectionError extends ViewriumError {}\n\nexport interface ApiErrorPayload {\n code: string;\n message: string;\n details?: unknown;\n}\n\nconst BY_STATUS: Record<number, new (message: string, options: ViewriumErrorOptions) => ViewriumError> = {\n 400: BadRequestError,\n 401: AuthenticationError,\n 402: PaymentRequiredError,\n 403: PermissionError,\n 404: NotFoundError,\n 409: ConflictError,\n 422: UnprocessableEntityError,\n 429: RateLimitError,\n};\n\n/** Build the right `ViewriumError` subclass for an HTTP status + parsed envelope. */\nexport function createApiError(status: number, payload: ApiErrorPayload): ViewriumError {\n const options: ViewriumErrorOptions = { status, code: payload.code, details: payload.details };\n const Specific = BY_STATUS[status];\n if (Specific) {\n return new Specific(payload.message, options);\n }\n if (status >= 500) {\n return new ServerError(payload.message,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