@krovacloud/sdk 0.4.4 → 0.4.5

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.
package/dist/index.cjs CHANGED
@@ -474,6 +474,11 @@ var KrovaClient = class {
474
474
  * **Omitting the allow-list leaves the port open to the internet.** That is
475
475
  * the documented behaviour, not an oversight — but it means a typo in the
476
476
  * field name fails OPEN, which is exactly how the original defect survived.
477
+ *
478
+ * `udpEnabled` optionally forwards UDP traffic on the same host port
479
+ * alongside TCP. It is optional and the server defaults it to `true` when
480
+ * omitted — so leave it unset to get UDP forwarding, and pass `false`
481
+ * only to explicitly disable it.
477
482
  */
478
483
  create: async (spaceId, cubeId, body) => {
479
484
  const { data, error, response } = await this.raw.POST("/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["createClient"],"sources":["../src/error.ts","../src/client.ts"],"sourcesContent":["/**\n * The error body shape returned by the Krova Cloud API.\n *\n * Per the OpenAPI spec (`components.schemas.Error`), every non-2xx response\n * body is `{ \"error\": string }`.\n */\nexport interface KrovaErrorBody {\n error?: string;\n}\n\n/**\n * Error thrown by the ergonomic {@link KrovaClient} helpers when the API\n * responds with a non-2xx status.\n *\n * The raw openapi-fetch client (`client.raw`) never throws — it returns\n * `{ data, error, response }`. The helpers wrap that and throw `KrovaError`\n * so callers can `try/catch`.\n */\nexport class KrovaError extends Error {\n /** HTTP status code of the failing response. */\n readonly status: number;\n\n /**\n * A machine-readable error code, when the API surfaces one via the\n * `X-Error-Code` response header. The documented error body only carries a\n * human-readable `error` string, so this is best-effort.\n */\n readonly code?: string;\n\n /**\n * The request id from the `X-Request-Id` response header, when present.\n * Useful when contacting Krova Cloud support about a specific failure.\n */\n readonly requestId?: string;\n\n /** The parsed JSON error body, when the response had one. */\n readonly body?: KrovaErrorBody;\n\n /** The raw `Response` object, for callers that need headers/url/etc. */\n readonly response?: Response;\n\n constructor(\n message: string,\n init: {\n status: number;\n code?: string;\n requestId?: string;\n body?: KrovaErrorBody;\n response?: Response;\n },\n ) {\n super(message);\n this.name = \"KrovaError\";\n this.status = init.status;\n this.code = init.code;\n this.requestId = init.requestId;\n this.body = init.body;\n this.response = init.response;\n // Restore prototype chain for instanceof across compilation targets.\n Object.setPrototypeOf(this, KrovaError.prototype);\n }\n}\n\n/**\n * Build a {@link KrovaError} from a failing response + parsed error body.\n */\nexport function krovaErrorFrom(\n response: Response,\n body: KrovaErrorBody | undefined,\n): KrovaError {\n const message =\n (typeof body?.error === \"string\" && body.error) ||\n response.statusText ||\n `Request failed with status ${response.status}`;\n return new KrovaError(message, {\n status: response.status,\n code: response.headers.get(\"x-error-code\") ?? undefined,\n requestId: response.headers.get(\"x-request-id\") ?? undefined,\n body,\n response,\n });\n}\n","import createClient, { type Client, type Middleware } from \"openapi-fetch\";\nimport { krovaErrorFrom } from \"./error.js\";\nimport type { components, paths } from \"./generated/types.js\";\n\n/** The Cube resource, as defined in the Krova Cloud OpenAPI spec. */\nexport type Cube = components[\"schemas\"][\"Cube\"];\n\n/** A region with available capacity (from the catalog). */\nexport type Region = components[\"schemas\"][\"Region\"];\n\n/** A selectable OS image (from the catalog). */\nexport type Image = components[\"schemas\"][\"Image\"];\n\n/** A volume-pricing tier (from the catalog). */\nexport type PricingTier = components[\"schemas\"][\"PricingTier\"];\n\n/** Pagination envelope returned alongside a Cube list. */\nexport type Pagination = components[\"schemas\"][\"Pagination\"];\n\n/** A Space — the tenancy an API key is scoped to. */\nexport type Space = components[\"schemas\"][\"Space\"];\n\n/** A Cube's SSH connection info (host, port, user, and pinned host keys). */\nexport type CubeSshInfo = components[\"schemas\"][\"CubeSshInfo\"];\n\n/** A custom domain attached to a Cube. */\nexport type Domain = components[\"schemas\"][\"Domain\"];\n\n/**\n * One DNS record you must publish for a domain to work.\n *\n * An ordinary subdomain needs one CNAME. A wildcard needs three: an ownership\n * TXT, the routing CNAME, and an `_acme-challenge` CNAME that lets Krova issue\n * and renew its certificate.\n *\n * ⛔ `mustBeGrey` and `proxyOk` are deliberate OPPOSITES, and automation needs\n * both. The routing record may sit behind Cloudflare's proxy (orange); the\n * `_acme-challenge` record must not, because a proxied one answers with\n * Cloudflare's addresses and the certificate authority finds nothing there.\n */\nexport type DnsRecord = components[\"schemas\"][\"DnsRecord\"];\n\n/**\n * A {@link DnsRecord} plus what Krova can currently see in public DNS.\n *\n * ⛔ `state: \"missing\"` means NOT PUBLISHED YET — the expected state before you\n * create the record, never an error. `state: \"unknown\"` means Krova could not\n * complete the lookup, which is never a statement about your DNS. Surfacing\n * either to your own users as a failure would be wrong.\n */\nexport type DnsRecordStatus = components[\"schemas\"][\"DnsRecordStatus\"];\n\n/** A snapshot of a Cube's disk. */\nexport type Snapshot = components[\"schemas\"][\"Snapshot\"];\n\n/** A TCP port mapping exposing a Cube port on the host. */\nexport type TcpMapping = components[\"schemas\"][\"TcpMapping\"];\n\n/** Request body for attaching a custom domain to a Cube. */\nexport type CreateDomainInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/domains\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/** Request body for updating a custom domain's proxy settings. */\nexport type UpdateDomainInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/** Request body for creating a TCP port mapping. */\nexport type CreateTcpMappingInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/** Default API base URL — the single `servers[0].url` from the OpenAPI spec. */\nexport const DEFAULT_BASE_URL = \"https://krova.cloud/api/v1\";\n\n/**\n * How the API key is presented to the server.\n *\n * - `\"x-api-key\"` (default) — `X-API-KEY: <key>`, matching the spec's\n * `components.securitySchemes.ApiKeyAuth` (an `apiKey` header named\n * `X-API-KEY`).\n * - `\"bearer\"` — `Authorization: Bearer <key>`, for gateways that expect it.\n */\nexport type AuthScheme = \"x-api-key\" | \"bearer\";\n\nexport interface KrovaClientOptions {\n /**\n * Your Krova Cloud API key (a `kro_...` token). Keys are scoped per Space\n * and inherit the permissions of the membership that created them.\n */\n apiKey: string;\n /** Override the API base URL. Defaults to {@link DEFAULT_BASE_URL}. */\n baseUrl?: string;\n /**\n * Auth header scheme. Defaults to `\"x-api-key\"` (the spec's scheme).\n */\n authScheme?: AuthScheme;\n /**\n * Max automatic retries on retryable statuses (429, 503).\n * Defaults to 2. Set to 0 to disable retries.\n */\n maxRetries?: number;\n /**\n * A custom `fetch` implementation (e.g. for tests or a proxy). Defaults to\n * the global `fetch`.\n */\n fetch?: typeof fetch;\n}\n\n/** Statuses the retry middleware treats as transient. */\nconst RETRYABLE_STATUSES = new Set([429, 503]);\n/** Fallback backoff (ms) when the server sends no `Retry-After` header. */\nconst BASE_BACKOFF_MS = 500;\n/** Cap on any single backoff wait (ms), to keep retries \"small but real\". */\nconst MAX_BACKOFF_MS = 10_000;\n\nconst sleep = (ms: number): Promise<void> =>\n new Promise((resolve) => setTimeout(resolve, ms));\n\n/**\n * Parse a `Retry-After` header (RFC 7231): either delta-seconds or an\n * HTTP-date. Returns milliseconds to wait, or `null` if absent/unparseable.\n */\nfunction parseRetryAfterMs(headerValue: string | null): number | null {\n if (!headerValue) return null;\n const seconds = Number(headerValue);\n if (Number.isFinite(seconds)) return Math.max(0, seconds * 1000);\n const dateMs = Date.parse(headerValue);\n if (Number.isFinite(dateMs)) return Math.max(0, dateMs - Date.now());\n return null;\n}\n\nfunction authMiddleware(apiKey: string, scheme: AuthScheme): Middleware {\n return {\n onRequest({ request }) {\n if (scheme === \"bearer\") {\n request.headers.set(\"Authorization\", `Bearer ${apiKey}`);\n } else {\n request.headers.set(\"X-API-KEY\", apiKey);\n }\n return request;\n },\n };\n}\n\n/**\n * Retry middleware: on a retryable status, wait (honoring `Retry-After` when\n * present, else exponential backoff) and re-issue the request.\n *\n * A retried request may have a body (POST/PUT/DELETE — exactly the mutating,\n * rate-limited endpoints). By the time `onResponse` runs, the request that was\n * handed to `fetch` has had its body stream consumed, so `request.clone()` here\n * throws `TypeError: unusable`. To re-issue it we stash a *pristine* clone in\n * `onRequest` — captured before the body is read — keyed by openapi-fetch's\n * per-request `id`, and clone from that pristine copy on each attempt.\n */\nfunction retryMiddleware(maxRetries: number, doFetch: typeof fetch): Middleware {\n const pristine = new Map<string, Request>();\n return {\n onRequest({ request, id }) {\n pristine.set(id, request.clone());\n return request;\n },\n onError({ id }) {\n // fetch rejected (network error) — no onResponse will fire; don't leak.\n pristine.delete(id);\n },\n async onResponse({ request, response, id }) {\n const original = pristine.get(id) ?? request;\n pristine.delete(id);\n if (maxRetries <= 0 || !RETRYABLE_STATUSES.has(response.status)) {\n return response;\n }\n let current = response;\n for (let attempt = 1; attempt <= maxRetries; attempt++) {\n if (!RETRYABLE_STATUSES.has(current.status)) break;\n const retryAfterMs = parseRetryAfterMs(current.headers.get(\"retry-after\"));\n const backoff = Math.min(BASE_BACKOFF_MS * 2 ** (attempt - 1), MAX_BACKOFF_MS);\n // Cap the wait — including a server-supplied `Retry-After` — so a hostile\n // or misconfigured server can't park the client for minutes/hours.\n await sleep(Math.min(retryAfterMs ?? backoff, MAX_BACKOFF_MS));\n // Re-issue from the pristine clone; `.clone()` keeps it reusable across\n // multiple attempts.\n current = await doFetch(original.clone());\n }\n return current;\n },\n };\n}\n\n/**\n * A typed client for the Krova Cloud API.\n *\n * @example\n * ```ts\n * const krova = new KrovaClient({ apiKey: \"kro_...\" });\n * const cubes = await krova.cubes.list(\"space_123\");\n * ```\n */\nexport class KrovaClient {\n /**\n * The underlying openapi-fetch client — a fully typed escape hatch to every\n * path in the spec. Returns `{ data, error, response }` and never throws.\n *\n * @example\n * ```ts\n * const { data, error } = await krova.raw.GET(\n * \"/spaces/{spaceId}/cubes/{cubeId}\",\n * { params: { path: { spaceId, cubeId } } },\n * );\n * ```\n */\n readonly raw: Client<paths>;\n\n /** The resolved base URL in use. */\n readonly baseUrl: string;\n\n constructor(options: KrovaClientOptions) {\n if (!options?.apiKey) {\n throw new Error(\"KrovaClient: `apiKey` is required.\");\n }\n this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n const doFetch = options.fetch ?? globalThis.fetch;\n const maxRetries = options.maxRetries ?? 2;\n\n this.raw = createClient<paths>({\n baseUrl: this.baseUrl,\n // SECURITY: never auto-follow redirects. The Krova Cloud API is a plain\n // JSON API and never legitimately 3xx's a data call. Following a redirect\n // would resend the `X-API-KEY` header to the redirect target — and unlike\n // `Authorization`, `Cookie`, and `Proxy-Authorization`, the Fetch spec does\n // NOT strip a custom header like `X-API-KEY` on a cross-origin redirect\n // (verified against undici/Node fetch). A compromised/misconfigured proxy,\n // an open-redirect on the API, or a MITM could otherwise exfiltrate the key\n // to an attacker's host. With `\"manual\"`, a redirect comes back as a\n // non-ok response and the helpers throw `KrovaError` instead of leaking.\n redirect: \"manual\",\n ...(options.fetch ? { fetch: options.fetch } : {}),\n });\n this.raw.use(authMiddleware(options.apiKey, options.authScheme ?? \"x-api-key\"));\n if (maxRetries > 0) {\n this.raw.use(retryMiddleware(maxRetries, doFetch));\n }\n }\n\n // ---------------------------------------------------------------------------\n // Cubes\n // ---------------------------------------------------------------------------\n\n readonly cubes = {\n /** List Cubes in a Space, with pagination metadata. */\n list: async (spaceId: string) => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/cubes\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"List Cubes response was empty.\" });\n return data;\n },\n\n /**\n * Create a Cube. Returns the created {@link Cube}.\n *\n * @param spaceId Target Space id.\n * @param body Cube spec — `{ name, image, resources, sshPublicKey, ... }`.\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n create: async (\n spaceId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes\"][\"post\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n opts?: { idempotencyKey?: string },\n ): Promise<Cube> => {\n const { data, error, response } = await this.raw.POST(\"/spaces/{spaceId}/cubes\", {\n params: {\n path: { spaceId },\n ...(opts?.idempotencyKey\n ? { header: { \"Idempotency-Key\": opts.idempotencyKey } }\n : {}),\n },\n body,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = data?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, { error: \"Create Cube response had no `cube`.\" });\n }\n return cube;\n },\n\n /** Get a single Cube. Returns the {@link Cube}. */\n get: async (spaceId: string, cubeId: string): Promise<Cube> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = data?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, { error: \"Get Cube response had no `cube`.\" });\n }\n return cube;\n },\n\n /**\n * Update the IN-CUBE port that SSH is forwarded to.\n *\n * `cubePort` is the port **inside** the Cube that sshd listens on — NOT the\n * host port you connect to. The host port is allocated by Krova and is not\n * changed by this call. Pointing this at a port nothing is listening on\n * inside the Cube will silently make SSH unreachable; the default is 22.\n *\n * The Krova Cloud API exposes no general Cube-mutation endpoint; the only\n * mutable Cube field over the API is this port, via\n * `PUT /spaces/{spaceId}/cubes/{cubeId}/ssh-port`. This helper maps to that\n * endpoint. (Compute resize / rename are not part of the public API.)\n */\n update: async (\n spaceId: string,\n cubeId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/ssh-port\"][\"put\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ): Promise<unknown> => {\n const { data, error, response } = await this.raw.PUT(\n \"/spaces/{spaceId}/cubes/{cubeId}/ssh-port\",\n { params: { path: { spaceId, cubeId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Delete a Cube (asynchronous — deletion is enqueued). */\n delete: async (spaceId: string, cubeId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Delete Cube response was empty.\" });\n return data;\n },\n\n /** Power off a running Cube (asynchronous — power-off is enqueued). The Cube\n * becomes `stopped` (its host RAM is freed); start it again with `wake`. */\n powerOff: async (spaceId: string, cubeId: string): Promise<unknown> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/power-off\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Start a stopped Cube (asynchronous — start is enqueued). */\n /**\n * Restart a Cube (COLD restart).\n *\n * The hypervisor process is stopped and relaunched, so the Cube boots\n * against the host's current kernel. This is the only way a Cube picks up a\n * refreshed guest kernel after a platform image update — a `reboot` issued\n * INSIDE the Cube cannot do it, because Firecracker treats a guest reboot as\n * a shutdown and the kernel is supplied externally by the host.\n *\n * Disk state is preserved; only the kernel changes. The Cube must be\n * `running`. Concurrent restarts of the same Cube are rejected (409) rather\n * than queued twice.\n */\n restart: async (spaceId: string, cubeId: string): Promise<unknown> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/restart\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n wake: async (spaceId: string, cubeId: string): Promise<unknown> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/wake\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /**\n * Get a Cube's SSH connection info — host, port, login user, and (when\n * available) the pinned host public keys for strict host-key verification.\n */\n ssh: async (spaceId: string, cubeId: string): Promise<CubeSshInfo> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/ssh\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Cube SSH-info response was empty.\" });\n return data;\n },\n\n /**\n * Restore a Cube's disk from one of its {@link Snapshot}s (asynchronous —\n * the restore is enqueued). The Cube's current disk is replaced.\n */\n restore: async (spaceId: string, cubeId: string, snapshotId: string) => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/restore\",\n { params: { path: { spaceId, cubeId } }, body: { snapshotId } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n /**\n * Resolve the {@link Space} this API key is scoped to — so you don't have to\n * hardcode a `spaceId`. Handy right after constructing the client:\n *\n * @example\n * ```ts\n * const space = await krova.getSpace();\n * const cubes = await krova.cubes.list(space.id);\n * ```\n */\n async getSpace(): Promise<Space> {\n const { data, error, response } = await this.raw.GET(\"/space\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Space response was empty.\" });\n return data;\n }\n\n // ---------------------------------------------------------------------------\n // Custom domains\n // ---------------------------------------------------------------------------\n\n readonly domains = {\n /** List the custom domains attached to a Cube. */\n list: async (spaceId: string, cubeId: string): Promise<Domain[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.domains ?? [];\n },\n\n /**\n * Attach a custom domain to a Cube. `domain` + `port` are required.\n *\n * Returns the domain AND the DNS records you must publish for it to work —\n * so you can create them in the same run, without a second call and without\n * hard-coding record shapes. A wildcard needs three; an exact host needs one.\n *\n * ⛔ BREAKING in 0.4.0: this used to resolve to `Domain`. It now resolves to\n * `{ domain, records }`, because for a wildcard two of the three records\n * (the ownership TXT and the `_acme-challenge` delegation) were not\n * derivable from anything the SDK returned — an integration had to read\n * them out of the docs and hope they still matched the server.\n */\n create: async (\n spaceId: string,\n cubeId: string,\n body: CreateDomainInput,\n ): Promise<{ domain: Domain; records: DnsRecord[] }> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains\",\n { params: { path: { spaceId, cubeId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.domain)\n throw krovaErrorFrom(response, { error: \"Create domain response had no `domain`.\" });\n return { domain: data.domain, records: data.records ?? [] };\n },\n\n /**\n * The DNS records a domain needs, each checked against live DNS.\n *\n * Poll this after publishing them: `summary.complete` turns true only once\n * every record is `found`. Each call performs real DNS lookups and is rate\n * limited, so poll on an interval rather than in a tight loop.\n */\n records: async (\n spaceId: string,\n cubeId: string,\n mappingId: string,\n ): Promise<{\n domain: string;\n isWildcard: boolean;\n records: DnsRecordStatus[];\n summary: { found: number; total: number; complete: boolean };\n checkedAt: string;\n }> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}/records\",\n { params: { path: { spaceId, cubeId, mappingId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data)\n throw krovaErrorFrom(response, { error: \"Domain records response was empty.\" });\n return data;\n },\n\n /** Update a domain's per-domain proxy settings. */\n update: async (\n spaceId: string,\n cubeId: string,\n mappingId: string,\n body: UpdateDomainInput,\n ): Promise<Domain> => {\n const { data, error, response } = await this.raw.PATCH(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}\",\n { params: { path: { spaceId, cubeId, mappingId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.domain)\n throw krovaErrorFrom(response, { error: \"Update domain response had no `domain`.\" });\n return data.domain;\n },\n\n /** Detach a custom domain from a Cube. */\n delete: async (spaceId: string, cubeId: string, mappingId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}\",\n { params: { path: { spaceId, cubeId, mappingId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Snapshots\n // ---------------------------------------------------------------------------\n\n readonly snapshots = {\n /** List a Cube's snapshots. */\n list: async (spaceId: string, cubeId: string): Promise<Snapshot[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/snapshots\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.snapshots ?? [];\n },\n\n /** Create a snapshot of a Cube's disk (asynchronous — enqueued). */\n create: async (\n spaceId: string,\n cubeId: string,\n body?: { name?: string },\n ): Promise<Snapshot> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/snapshots\",\n { params: { path: { spaceId, cubeId } }, body: body ?? {} },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.snapshot)\n throw krovaErrorFrom(response, { error: \"Create snapshot response had no `snapshot`.\" });\n return data.snapshot;\n },\n\n /** Delete a snapshot. */\n delete: async (spaceId: string, cubeId: string, snapshotId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}/snapshots/{snapshotId}\",\n { params: { path: { spaceId, cubeId, snapshotId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // TCP port mappings\n // ---------------------------------------------------------------------------\n\n readonly tcpMappings = {\n /** List a Cube's TCP port mappings. */\n list: async (spaceId: string, cubeId: string): Promise<TcpMapping[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.tcpMappings ?? [];\n },\n\n /**\n * Create a TCP port mapping exposing a Cube port on the host. `cubePort` is\n * required; `whitelistedIps` optionally restricts who can reach it.\n *\n * ⛔ Send `whitelistedIps`, not `whitelistIps`. The published spec named\n * the field `whitelistIps` while the server has always read\n * `whitelistedIps`, so every allow-listed mapping created through this SDK\n * was silently published WORLD-OPEN, with a 201 and no error (reproduced\n * on production 2026-09-02). The server now accepts both, so an older\n * client keeps working, but `whitelistIps` is deprecated.\n *\n * **Omitting the allow-list leaves the port open to the internet.** That is\n * the documented behaviour, not an oversight — but it means a typo in the\n * field name fails OPEN, which is exactly how the original defect survived.\n */\n create: async (\n spaceId: string,\n cubeId: string,\n body: CreateTcpMappingInput,\n ): Promise<TcpMapping> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings\",\n { params: { path: { spaceId, cubeId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.tcpMapping)\n throw krovaErrorFrom(response, { error: \"Create TCP mapping response had no `tcpMapping`.\" });\n return data.tcpMapping;\n },\n\n /** Delete a TCP port mapping. */\n delete: async (spaceId: string, cubeId: string, mappingId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings/{mappingId}\",\n { params: { path: { spaceId, cubeId, mappingId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Imports & backups (.cube archive import / export)\n // ---------------------------------------------------------------------------\n\n readonly imports = {\n /**\n * Start importing a `.cube` archive into a new Cube. Returns the multipart\n * upload target (`importId`, `uploadId`, presigned `parts`, …). Upload the\n * archive to those URLs, then call {@link imports.complete}.\n */\n create: async (\n spaceId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes/imports\"][\"post\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) => {\n const { data, error, response } = await this.raw.POST(\"/spaces/{spaceId}/cubes/imports\", {\n params: { path: { spaceId } },\n body,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Get an in-progress or completed import by id. */\n get: async (spaceId: string, importId: string) => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/imports/{importId}\",\n { params: { path: { spaceId, importId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /**\n * Finish an import after the archive has been uploaded — provisions the\n * Cube. Pass the uploaded `parts` (partNumber + etag) and the resolved\n * `config`.\n */\n complete: async (\n spaceId: string,\n importId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes/imports/{importId}/complete\"][\"post\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/imports/{importId}/complete\",\n { params: { path: { spaceId, importId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Cancel an in-progress import. */\n cancel: async (spaceId: string, importId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/imports/{importId}\",\n { params: { path: { spaceId, importId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n readonly backups = {\n /** Get a time-limited download URL for a backup `.cube` archive. */\n download: async (spaceId: string, backupId: string) => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/backups/{backupId}/download\",\n { params: { path: { spaceId, backupId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Public catalog (no auth required by the API, but the key is harmless)\n // ---------------------------------------------------------------------------\n\n readonly catalog = {\n /** List regions with available capacity. */\n regions: async () => {\n const { data, error, response } = await this.raw.GET(\"/regions\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Regions response was empty.\" });\n return data;\n },\n\n /** List available OS images. */\n images: async () => {\n const { data, error, response } = await this.raw.GET(\"/images\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Images response was empty.\" });\n return data;\n },\n\n /** Per-resource hourly rates and volume pricing tiers. */\n pricing: async () => {\n const { data, error, response } = await this.raw.GET(\"/pricing\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Pricing response was empty.\" });\n return data;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAa,aAAb,MAAa,mBAAmB,MAAM;;CAEpC;;;;;;CAOA;;;;;CAMA;;CAGA;;CAGA;CAEA,YACE,SACA,MAOA;EACA,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,SAAS,KAAK;EACnB,KAAK,OAAO,KAAK;EACjB,KAAK,YAAY,KAAK;EACtB,KAAK,OAAO,KAAK;EACjB,KAAK,WAAW,KAAK;EAErB,OAAO,eAAe,MAAM,WAAW,SAAS;CAClD;AACF;;;;AAKA,SAAgB,eACd,UACA,MACY;CAKZ,OAAO,IAAI,WAHR,OAAO,MAAM,UAAU,YAAY,KAAK,SACzC,SAAS,cACT,8BAA8B,SAAS,UACV;EAC7B,QAAQ,SAAS;EACjB,MAAM,SAAS,QAAQ,IAAI,cAAc,KAAK,KAAA;EAC9C,WAAW,SAAS,QAAQ,IAAI,cAAc,KAAK,KAAA;EACnD;EACA;CACF,CAAC;AACH;;;;ACPA,MAAa,mBAAmB;;AAqChC,MAAM,qCAAqB,I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C7E,OAAO;EACT;CACF;CAEA,UAAmB;;AAEjB,UAAU,OAAO,SAAiB,aAAqB;EACrD,MAAM,EAAE,MAAM,OAAO,aAAa,MAAM,KAAK,IAAI,IAC/C,iDACA,EAAE,QAAQ,EAAE,MAAM;GAAE;GAAS;EAAS,EAAE,EAAE,CAC5C;EACA,IAAI,UAAU,KAAA,KAAa,CAAC,SAAS,IAAI,MAAM,eAAe,UAAU,KAAK;EAC7E,OAAO;CACT,EACF;CAMA,UAAmB;;EAEjB,SAAS,YAAY;GACnB,MAAM,EAAE,MAAM,OAAO,aAAa,MAAM,KAAK,IAAI,IAAI,UAAU;GAC/D,IAAI,UAAU,KAAA,KAAa,CAAC,SAAS,IAAI,MAAM,eAAe,UAAU,KAAK;GAC7E,IAAI,SAAS,KAAA,GACX,MAAM,eAAe,UAAU,EAAE,OAAO,8BAA8B,CAAC;GACzE,OAAO;EACT;;EAGA,QAAQ,YAAY;GAClB,MAAM,EAAE,MAAM,OAAO,aAAa,MAAM,KAAK,IAAI,IAAI,SAAS;GAC9D,IAAI,UAAU,KAAA,KAAa,CAAC,SAAS,IAAI,MAAM,eAAe,UAAU,KAAK;GAC7E,IAAI,SAAS,KAAA,GACX,MAAM,eAAe,UAAU,EAAE,OAAO,6BAA6B,CAAC;GACxE,OAAO;EACT;;EAGA,SAAS,YAAY;GACnB,MAAM,EAAE,MAAM,OAAO,aAAa,MAAM,KAAK,IAAI,IAAI,UAAU;GAC/D,IAAI,UAAU,KAAA,KAAa,CAAC,SAAS,IAAI,MAAM,eAAe,UAAU,KAAK;GAC7E,IAAI,SAAS,KAAA,GACX,MAAM,eAAe,UAAU,EAAE,OAAO,8BAA8B,CAAC;GACzE,OAAO;EACT;CACF;AACF"}
1
+ {"version":3,"file":"index.cjs","names":["createClient"],"sources":["../src/error.ts","../src/client.ts"],"sourcesContent":["/**\n * The error body shape returned by the Krova Cloud API.\n *\n * Per the OpenAPI spec (`components.schemas.Error`), every non-2xx response\n * body is `{ \"error\": string }`.\n */\nexport interface KrovaErrorBody {\n error?: string;\n}\n\n/**\n * Error thrown by the ergonomic {@link KrovaClient} helpers when the API\n * responds with a non-2xx status.\n *\n * The raw openapi-fetch client (`client.raw`) never throws — it returns\n * `{ data, error, response }`. The helpers wrap that and throw `KrovaError`\n * so callers can `try/catch`.\n */\nexport class KrovaError extends Error {\n /** HTTP status code of the failing response. */\n readonly status: number;\n\n /**\n * A machine-readable error code, when the API surfaces one via the\n * `X-Error-Code` response header. The documented error body only carries a\n * human-readable `error` string, so this is best-effort.\n */\n readonly code?: string;\n\n /**\n * The request id from the `X-Request-Id` response header, when present.\n * Useful when contacting Krova Cloud support about a specific failure.\n */\n readonly requestId?: string;\n\n /** The parsed JSON error body, when the response had one. */\n readonly body?: KrovaErrorBody;\n\n /** The raw `Response` object, for callers that need headers/url/etc. */\n readonly response?: Response;\n\n constructor(\n message: string,\n init: {\n status: number;\n code?: string;\n requestId?: string;\n body?: KrovaErrorBody;\n response?: Response;\n },\n ) {\n super(message);\n this.name = \"KrovaError\";\n this.status = init.status;\n this.code = init.code;\n this.requestId = init.requestId;\n this.body = init.body;\n this.response = init.response;\n // Restore prototype chain for instanceof across compilation targets.\n Object.setPrototypeOf(this, KrovaError.prototype);\n }\n}\n\n/**\n * Build a {@link KrovaError} from a failing response + parsed error body.\n */\nexport function krovaErrorFrom(\n response: Response,\n body: KrovaErrorBody | undefined,\n): KrovaError {\n const message =\n (typeof body?.error === \"string\" && body.error) ||\n response.statusText ||\n `Request failed with status ${response.status}`;\n return new KrovaError(message, {\n status: response.status,\n code: response.headers.get(\"x-error-code\") ?? undefined,\n requestId: response.headers.get(\"x-request-id\") ?? undefined,\n body,\n response,\n });\n}\n","import createClient, { type Client, type Middleware } from \"openapi-fetch\";\nimport { krovaErrorFrom } from \"./error.js\";\nimport type { components, paths } from \"./generated/types.js\";\n\n/** The Cube resource, as defined in the Krova Cloud OpenAPI spec. */\nexport type Cube = components[\"schemas\"][\"Cube\"];\n\n/** A region with available capacity (from the catalog). */\nexport type Region = components[\"schemas\"][\"Region\"];\n\n/** A selectable OS image (from the catalog). */\nexport type Image = components[\"schemas\"][\"Image\"];\n\n/** A volume-pricing tier (from the catalog). */\nexport type PricingTier = components[\"schemas\"][\"PricingTier\"];\n\n/** Pagination envelope returned alongside a Cube list. */\nexport type Pagination = components[\"schemas\"][\"Pagination\"];\n\n/** A Space — the tenancy an API key is scoped to. */\nexport type Space = components[\"schemas\"][\"Space\"];\n\n/** A Cube's SSH connection info (host, port, user, and pinned host keys). */\nexport type CubeSshInfo = components[\"schemas\"][\"CubeSshInfo\"];\n\n/** A custom domain attached to a Cube. */\nexport type Domain = components[\"schemas\"][\"Domain\"];\n\n/**\n * One DNS record you must publish for a domain to work.\n *\n * An ordinary subdomain needs one CNAME. A wildcard needs three: an ownership\n * TXT, the routing CNAME, and an `_acme-challenge` CNAME that lets Krova issue\n * and renew its certificate.\n *\n * ⛔ `mustBeGrey` and `proxyOk` are deliberate OPPOSITES, and automation needs\n * both. The routing record may sit behind Cloudflare's proxy (orange); the\n * `_acme-challenge` record must not, because a proxied one answers with\n * Cloudflare's addresses and the certificate authority finds nothing there.\n */\nexport type DnsRecord = components[\"schemas\"][\"DnsRecord\"];\n\n/**\n * A {@link DnsRecord} plus what Krova can currently see in public DNS.\n *\n * ⛔ `state: \"missing\"` means NOT PUBLISHED YET — the expected state before you\n * create the record, never an error. `state: \"unknown\"` means Krova could not\n * complete the lookup, which is never a statement about your DNS. Surfacing\n * either to your own users as a failure would be wrong.\n */\nexport type DnsRecordStatus = components[\"schemas\"][\"DnsRecordStatus\"];\n\n/** A snapshot of a Cube's disk. */\nexport type Snapshot = components[\"schemas\"][\"Snapshot\"];\n\n/** A TCP port mapping exposing a Cube port on the host. */\nexport type TcpMapping = components[\"schemas\"][\"TcpMapping\"];\n\n/** Request body for attaching a custom domain to a Cube. */\nexport type CreateDomainInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/domains\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/** Request body for updating a custom domain's proxy settings. */\nexport type UpdateDomainInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/** Request body for creating a TCP port mapping. */\nexport type CreateTcpMappingInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/** Default API base URL — the single `servers[0].url` from the OpenAPI spec. */\nexport const DEFAULT_BASE_URL = \"https://krova.cloud/api/v1\";\n\n/**\n * How the API key is presented to the server.\n *\n * - `\"x-api-key\"` (default) — `X-API-KEY: <key>`, matching the spec's\n * `components.securitySchemes.ApiKeyAuth` (an `apiKey` header named\n * `X-API-KEY`).\n * - `\"bearer\"` — `Authorization: Bearer <key>`, for gateways that expect it.\n */\nexport type AuthScheme = \"x-api-key\" | \"bearer\";\n\nexport interface KrovaClientOptions {\n /**\n * Your Krova Cloud API key (a `kro_...` token). Keys are scoped per Space\n * and inherit the permissions of the membership that created them.\n */\n apiKey: string;\n /** Override the API base URL. Defaults to {@link DEFAULT_BASE_URL}. */\n baseUrl?: string;\n /**\n * Auth header scheme. Defaults to `\"x-api-key\"` (the spec's scheme).\n */\n authScheme?: AuthScheme;\n /**\n * Max automatic retries on retryable statuses (429, 503).\n * Defaults to 2. Set to 0 to disable retries.\n */\n maxRetries?: number;\n /**\n * A custom `fetch` implementation (e.g. for tests or a proxy). Defaults to\n * the global `fetch`.\n */\n fetch?: typeof fetch;\n}\n\n/** Statuses the retry middleware treats as transient. */\nconst RETRYABLE_STATUSES = new Set([429, 503]);\n/** Fallback backoff (ms) when the server sends no `Retry-After` header. */\nconst BASE_BACKOFF_MS = 500;\n/** Cap on any single backoff wait (ms), to keep retries \"small but real\". */\nconst MAX_BACKOFF_MS = 10_000;\n\nconst sleep = (ms: number): Promise<void> =>\n new Promise((resolve) => setTimeout(resolve, ms));\n\n/**\n * Parse a `Retry-After` header (RFC 7231): either delta-seconds or an\n * HTTP-date. Returns milliseconds to wait, or `null` if absent/unparseable.\n */\nfunction parseRetryAfterMs(headerValue: string | null): number | null {\n if (!headerValue) return null;\n const seconds = Number(headerValue);\n if (Number.isFinite(seconds)) return Math.max(0, seconds * 1000);\n const dateMs = Date.parse(headerValue);\n if (Number.isFinite(dateMs)) return Math.max(0, dateMs - Date.now());\n return null;\n}\n\nfunction authMiddleware(apiKey: string, scheme: AuthScheme): Middleware {\n return {\n onRequest({ request }) {\n if (scheme === \"bearer\") {\n request.headers.set(\"Authorization\", `Bearer ${apiKey}`);\n } else {\n request.headers.set(\"X-API-KEY\", apiKey);\n }\n return request;\n },\n };\n}\n\n/**\n * Retry middleware: on a retryable status, wait (honoring `Retry-After` when\n * present, else exponential backoff) and re-issue the request.\n *\n * A retried request may have a body (POST/PUT/DELETE — exactly the mutating,\n * rate-limited endpoints). By the time `onResponse` runs, the request that was\n * handed to `fetch` has had its body stream consumed, so `request.clone()` here\n * throws `TypeError: unusable`. To re-issue it we stash a *pristine* clone in\n * `onRequest` — captured before the body is read — keyed by openapi-fetch's\n * per-request `id`, and clone from that pristine copy on each attempt.\n */\nfunction retryMiddleware(maxRetries: number, doFetch: typeof fetch): Middleware {\n const pristine = new Map<string, Request>();\n return {\n onRequest({ request, id }) {\n pristine.set(id, request.clone());\n return request;\n },\n onError({ id }) {\n // fetch rejected (network error) — no onResponse will fire; don't leak.\n pristine.delete(id);\n },\n async onResponse({ request, response, id }) {\n const original = pristine.get(id) ?? request;\n pristine.delete(id);\n if (maxRetries <= 0 || !RETRYABLE_STATUSES.has(response.status)) {\n return response;\n }\n let current = response;\n for (let attempt = 1; attempt <= maxRetries; attempt++) {\n if (!RETRYABLE_STATUSES.has(current.status)) break;\n const retryAfterMs = parseRetryAfterMs(current.headers.get(\"retry-after\"));\n const backoff = Math.min(BASE_BACKOFF_MS * 2 ** (attempt - 1), MAX_BACKOFF_MS);\n // Cap the wait — including a server-supplied `Retry-After` — so a hostile\n // or misconfigured server can't park the client for minutes/hours.\n await sleep(Math.min(retryAfterMs ?? backoff, MAX_BACKOFF_MS));\n // Re-issue from the pristine clone; `.clone()` keeps it reusable across\n // multiple attempts.\n current = await doFetch(original.clone());\n }\n return current;\n },\n };\n}\n\n/**\n * A typed client for the Krova Cloud API.\n *\n * @example\n * ```ts\n * const krova = new KrovaClient({ apiKey: \"kro_...\" });\n * const cubes = await krova.cubes.list(\"space_123\");\n * ```\n */\nexport class KrovaClient {\n /**\n * The underlying openapi-fetch client — a fully typed escape hatch to every\n * path in the spec. Returns `{ data, error, response }` and never throws.\n *\n * @example\n * ```ts\n * const { data, error } = await krova.raw.GET(\n * \"/spaces/{spaceId}/cubes/{cubeId}\",\n * { params: { path: { spaceId, cubeId } } },\n * );\n * ```\n */\n readonly raw: Client<paths>;\n\n /** The resolved base URL in use. */\n readonly baseUrl: string;\n\n constructor(options: KrovaClientOptions) {\n if (!options?.apiKey) {\n throw new Error(\"KrovaClient: `apiKey` is required.\");\n }\n this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n const doFetch = options.fetch ?? globalThis.fetch;\n const maxRetries = options.maxRetries ?? 2;\n\n this.raw = createClient<paths>({\n baseUrl: this.baseUrl,\n // SECURITY: never auto-follow redirects. The Krova Cloud API is a plain\n // JSON API and never legitimately 3xx's a data call. Following a redirect\n // would resend the `X-API-KEY` header to the redirect target — and unlike\n // `Authorization`, `Cookie`, and `Proxy-Authorization`, the Fetch spec does\n // NOT strip a custom header like `X-API-KEY` on a cross-origin redirect\n // (verified against undici/Node fetch). A compromised/misconfigured proxy,\n // an open-redirect on the API, or a MITM could otherwise exfiltrate the key\n // to an attacker's host. With `\"manual\"`, a redirect comes back as a\n // non-ok response and the helpers throw `KrovaError` instead of leaking.\n redirect: \"manual\",\n ...(options.fetch ? { fetch: options.fetch } : {}),\n });\n this.raw.use(authMiddleware(options.apiKey, options.authScheme ?? \"x-api-key\"));\n if (maxRetries > 0) {\n this.raw.use(retryMiddleware(maxRetries, doFetch));\n }\n }\n\n // ---------------------------------------------------------------------------\n // Cubes\n // ---------------------------------------------------------------------------\n\n readonly cubes = {\n /** List Cubes in a Space, with pagination metadata. */\n list: async (spaceId: string) => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/cubes\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"List Cubes response was empty.\" });\n return data;\n },\n\n /**\n * Create a Cube. Returns the created {@link Cube}.\n *\n * @param spaceId Target Space id.\n * @param body Cube spec — `{ name, image, resources, sshPublicKey, ... }`.\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n create: async (\n spaceId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes\"][\"post\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n opts?: { idempotencyKey?: string },\n ): Promise<Cube> => {\n const { data, error, response } = await this.raw.POST(\"/spaces/{spaceId}/cubes\", {\n params: {\n path: { spaceId },\n ...(opts?.idempotencyKey\n ? { header: { \"Idempotency-Key\": opts.idempotencyKey } }\n : {}),\n },\n body,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = data?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, { error: \"Create Cube response had no `cube`.\" });\n }\n return cube;\n },\n\n /** Get a single Cube. Returns the {@link Cube}. */\n get: async (spaceId: string, cubeId: string): Promise<Cube> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = data?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, { error: \"Get Cube response had no `cube`.\" });\n }\n return cube;\n },\n\n /**\n * Update the IN-CUBE port that SSH is forwarded to.\n *\n * `cubePort` is the port **inside** the Cube that sshd listens on — NOT the\n * host port you connect to. The host port is allocated by Krova and is not\n * changed by this call. Pointing this at a port nothing is listening on\n * inside the Cube will silently make SSH unreachable; the default is 22.\n *\n * The Krova Cloud API exposes no general Cube-mutation endpoint; the only\n * mutable Cube field over the API is this port, via\n * `PUT /spaces/{spaceId}/cubes/{cubeId}/ssh-port`. This helper maps to that\n * endpoint. (Compute resize / rename are not part of the public API.)\n */\n update: async (\n spaceId: string,\n cubeId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/ssh-port\"][\"put\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ): Promise<unknown> => {\n const { data, error, response } = await this.raw.PUT(\n \"/spaces/{spaceId}/cubes/{cubeId}/ssh-port\",\n { params: { path: { spaceId, cubeId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Delete a Cube (asynchronous — deletion is enqueued). */\n delete: async (spaceId: string, cubeId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Delete Cube response was empty.\" });\n return data;\n },\n\n /** Power off a running Cube (asynchronous — power-off is enqueued). The Cube\n * becomes `stopped` (its host RAM is freed); start it again with `wake`. */\n powerOff: async (spaceId: string, cubeId: string): Promise<unknown> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/power-off\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Start a stopped Cube (asynchronous — start is enqueued). */\n /**\n * Restart a Cube (COLD restart).\n *\n * The hypervisor process is stopped and relaunched, so the Cube boots\n * against the host's current kernel. This is the only way a Cube picks up a\n * refreshed guest kernel after a platform image update — a `reboot` issued\n * INSIDE the Cube cannot do it, because Firecracker treats a guest reboot as\n * a shutdown and the kernel is supplied externally by the host.\n *\n * Disk state is preserved; only the kernel changes. The Cube must be\n * `running`. Concurrent restarts of the same Cube are rejected (409) rather\n * than queued twice.\n */\n restart: async (spaceId: string, cubeId: string): Promise<unknown> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/restart\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n wake: async (spaceId: string, cubeId: string): Promise<unknown> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/wake\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /**\n * Get a Cube's SSH connection info — host, port, login user, and (when\n * available) the pinned host public keys for strict host-key verification.\n */\n ssh: async (spaceId: string, cubeId: string): Promise<CubeSshInfo> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/ssh\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Cube SSH-info response was empty.\" });\n return data;\n },\n\n /**\n * Restore a Cube's disk from one of its {@link Snapshot}s (asynchronous —\n * the restore is enqueued). The Cube's current disk is replaced.\n */\n restore: async (spaceId: string, cubeId: string, snapshotId: string) => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/restore\",\n { params: { path: { spaceId, cubeId } }, body: { snapshotId } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n /**\n * Resolve the {@link Space} this API key is scoped to — so you don't have to\n * hardcode a `spaceId`. Handy right after constructing the client:\n *\n * @example\n * ```ts\n * const space = await krova.getSpace();\n * const cubes = await krova.cubes.list(space.id);\n * ```\n */\n async getSpace(): Promise<Space> {\n const { data, error, response } = await this.raw.GET(\"/space\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Space response was empty.\" });\n return data;\n }\n\n // ---------------------------------------------------------------------------\n // Custom domains\n // ---------------------------------------------------------------------------\n\n readonly domains = {\n /** List the custom domains attached to a Cube. */\n list: async (spaceId: string, cubeId: string): Promise<Domain[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.domains ?? [];\n },\n\n /**\n * Attach a custom domain to a Cube. `domain` + `port` are required.\n *\n * Returns the domain AND the DNS records you must publish for it to work —\n * so you can create them in the same run, without a second call and without\n * hard-coding record shapes. A wildcard needs three; an exact host needs one.\n *\n * ⛔ BREAKING in 0.4.0: this used to resolve to `Domain`. It now resolves to\n * `{ domain, records }`, because for a wildcard two of the three records\n * (the ownership TXT and the `_acme-challenge` delegation) were not\n * derivable from anything the SDK returned — an integration had to read\n * them out of the docs and hope they still matched the server.\n */\n create: async (\n spaceId: string,\n cubeId: string,\n body: CreateDomainInput,\n ): Promise<{ domain: Domain; records: DnsRecord[] }> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains\",\n { params: { path: { spaceId, cubeId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.domain)\n throw krovaErrorFrom(response, { error: \"Create domain response had no `domain`.\" });\n return { domain: data.domain, records: data.records ?? [] };\n },\n\n /**\n * The DNS records a domain needs, each checked against live DNS.\n *\n * Poll this after publishing them: `summary.complete` turns true only once\n * every record is `found`. Each call performs real DNS lookups and is rate\n * limited, so poll on an interval rather than in a tight loop.\n */\n records: async (\n spaceId: string,\n cubeId: string,\n mappingId: string,\n ): Promise<{\n domain: string;\n isWildcard: boolean;\n records: DnsRecordStatus[];\n summary: { found: number; total: number; complete: boolean };\n checkedAt: string;\n }> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}/records\",\n { params: { path: { spaceId, cubeId, mappingId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data)\n throw krovaErrorFrom(response, { error: \"Domain records response was empty.\" });\n return data;\n },\n\n /** Update a domain's per-domain proxy settings. */\n update: async (\n spaceId: string,\n cubeId: string,\n mappingId: string,\n body: UpdateDomainInput,\n ): Promise<Domain> => {\n const { data, error, response } = await this.raw.PATCH(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}\",\n { params: { path: { spaceId, cubeId, mappingId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.domain)\n throw krovaErrorFrom(response, { error: \"Update domain response had no `domain`.\" });\n return data.domain;\n },\n\n /** Detach a custom domain from a Cube. */\n delete: async (spaceId: string, cubeId: string, mappingId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}\",\n { params: { path: { spaceId, cubeId, mappingId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Snapshots\n // ---------------------------------------------------------------------------\n\n readonly snapshots = {\n /** List a Cube's snapshots. */\n list: async (spaceId: string, cubeId: string): Promise<Snapshot[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/snapshots\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.snapshots ?? [];\n },\n\n /** Create a snapshot of a Cube's disk (asynchronous — enqueued). */\n create: async (\n spaceId: string,\n cubeId: string,\n body?: { name?: string },\n ): Promise<Snapshot> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/snapshots\",\n { params: { path: { spaceId, cubeId } }, body: body ?? {} },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.snapshot)\n throw krovaErrorFrom(response, { error: \"Create snapshot response had no `snapshot`.\" });\n return data.snapshot;\n },\n\n /** Delete a snapshot. */\n delete: async (spaceId: string, cubeId: string, snapshotId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}/snapshots/{snapshotId}\",\n { params: { path: { spaceId, cubeId, snapshotId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // TCP port mappings\n // ---------------------------------------------------------------------------\n\n readonly tcpMappings = {\n /** List a Cube's TCP port mappings. */\n list: async (spaceId: string, cubeId: string): Promise<TcpMapping[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.tcpMappings ?? [];\n },\n\n /**\n * Create a TCP port mapping exposing a Cube port on the host. `cubePort` is\n * required; `whitelistedIps` optionally restricts who can reach it.\n *\n * ⛔ Send `whitelistedIps`, not `whitelistIps`. The published spec named\n * the field `whitelistIps` while the server has always read\n * `whitelistedIps`, so every allow-listed mapping created through this SDK\n * was silently published WORLD-OPEN, with a 201 and no error (reproduced\n * on production 2026-09-02). The server now accepts both, so an older\n * client keeps working, but `whitelistIps` is deprecated.\n *\n * **Omitting the allow-list leaves the port open to the internet.** That is\n * the documented behaviour, not an oversight — but it means a typo in the\n * field name fails OPEN, which is exactly how the original defect survived.\n *\n * `udpEnabled` optionally forwards UDP traffic on the same host port\n * alongside TCP. It is optional and the server defaults it to `true` when\n * omitted — so leave it unset to get UDP forwarding, and pass `false`\n * only to explicitly disable it.\n */\n create: async (\n spaceId: string,\n cubeId: string,\n body: CreateTcpMappingInput,\n ): Promise<TcpMapping> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings\",\n { params: { path: { spaceId, cubeId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.tcpMapping)\n throw krovaErrorFrom(response, { error: \"Create TCP mapping response had no `tcpMapping`.\" });\n return data.tcpMapping;\n },\n\n /** Delete a TCP port mapping. */\n delete: async (spaceId: string, cubeId: string, mappingId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings/{mappingId}\",\n { params: { path: { spaceId, cubeId, mappingId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Imports & backups (.cube archive import / export)\n // ---------------------------------------------------------------------------\n\n readonly imports = {\n /**\n * Start importing a `.cube` archive into a new Cube. Returns the multipart\n * upload target (`importId`, `uploadId`, presigned `parts`, …). Upload the\n * archive to those URLs, then call {@link imports.complete}.\n */\n create: async (\n spaceId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes/imports\"][\"post\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) => {\n const { data, error, response } = await this.raw.POST(\"/spaces/{spaceId}/cubes/imports\", {\n params: { path: { spaceId } },\n body,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Get an in-progress or completed import by id. */\n get: async (spaceId: string, importId: string) => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/imports/{importId}\",\n { params: { path: { spaceId, importId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /**\n * Finish an import after the archive has been uploaded — provisions the\n * Cube. Pass the uploaded `parts` (partNumber + etag) and the resolved\n * `config`.\n */\n complete: async (\n spaceId: string,\n importId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes/imports/{importId}/complete\"][\"post\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/imports/{importId}/complete\",\n { params: { path: { spaceId, importId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Cancel an in-progress import. */\n cancel: async (spaceId: string, importId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/imports/{importId}\",\n { params: { path: { spaceId, importId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n readonly backups = {\n /** Get a time-limited download URL for a backup `.cube` archive. */\n download: async (spaceId: string, backupId: string) => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/backups/{backupId}/download\",\n { params: { path: { spaceId, backupId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Public catalog (no auth required by the API, but the key is harmless)\n // ---------------------------------------------------------------------------\n\n readonly catalog = {\n /** List regions with available capacity. */\n regions: async () => {\n const { data, error, response } = await this.raw.GET(\"/regions\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Regions response was empty.\" });\n return data;\n },\n\n /** List available OS images. */\n images: async () => {\n const { data, error, response } = await this.raw.GET(\"/images\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Images response was empty.\" });\n return data;\n },\n\n /** Per-resource hourly rates and volume pricing tiers. */\n pricing: async () => {\n const { data, error, response } = await this.raw.GET(\"/pricing\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Pricing response was empty.\" });\n return data;\n },\n };\n}\n"],"mappings":";;;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,QAAQ,YAAY;GAClB,MAAM,EAAE,MAAM,OAAO,aAAa,MAAM,KAAK,IAAI,IAAI,SAAS;GAC9D,IAAI,UAAU,KAAA,KAAa,CAAC,SAAS,IAAI,MAAM,eAAe,UAAU,KAAK;GAC7E,IAAI,SAAS,KAAA,GACX,MAAM,eAAe,UAAU,EAAE,OAAO,6BAA6B,CAAC;GACxE,OAAO;EACT;;EAGA,SAAS,YAAY;GACnB,MAAM,EAAE,MAAM,OAAO,aAAa,MAAM,KAAK,IAAI,IAAI,UAAU;GAC/D,IAAI,UAAU,KAAA,KAAa,CAAC,SAAS,IAAI,MAAM,eAAe,UAAU,KAAK;GAC7E,IAAI,SAAS,KAAA,GACX,MAAM,eAAe,UAAU,EAAE,OAAO,8BAA8B,CAAC;GACzE,OAAO;EACT;CACF;AACF"}
package/dist/index.d.cts CHANGED
@@ -1072,6 +1072,9 @@ interface paths {
1072
1072
  cubePort: number;
1073
1073
  /** @description Optional human label for the mapping. */
1074
1074
  label?: string;
1075
+ /** @description Whether the mapping also forwards UDP traffic on the same host port, in addition to TCP. Optional; defaults to true when omitted.
1076
+ * @default true */
1077
+ udpEnabled?: boolean;
1075
1078
  /** @description IPs/CIDRs allowed to reach the published port. Omit or send an empty array to leave the port open to the internet. */
1076
1079
  whitelistedIps?: string[];
1077
1080
  /** @deprecated
@@ -1942,6 +1945,8 @@ interface components {
1942
1945
  label: string | null;
1943
1946
  status: string;
1944
1947
  isSsh: boolean;
1948
+ /** @description Whether the mapping also forwards UDP traffic on the same host port, in addition to TCP. */
1949
+ udpEnabled: boolean;
1945
1950
  /** Format: date-time */
1946
1951
  createdAt: string;
1947
1952
  /** Format: date-time */
@@ -2323,6 +2328,11 @@ declare class KrovaClient {
2323
2328
  * **Omitting the allow-list leaves the port open to the internet.** That is
2324
2329
  * the documented behaviour, not an oversight — but it means a typo in the
2325
2330
  * field name fails OPEN, which is exactly how the original defect survived.
2331
+ *
2332
+ * `udpEnabled` optionally forwards UDP traffic on the same host port
2333
+ * alongside TCP. It is optional and the server defaults it to `true` when
2334
+ * omitted — so leave it unset to get UDP forwarding, and pass `false`
2335
+ * only to explicitly disable it.
2326
2336
  */
2327
2337
  create: (spaceId: string, cubeId: string, body: CreateTcpMappingInput) => Promise<TcpMapping>;
2328
2338
  /** Delete a TCP port mapping. */
package/dist/index.d.ts CHANGED
@@ -1072,6 +1072,9 @@ interface paths {
1072
1072
  cubePort: number;
1073
1073
  /** @description Optional human label for the mapping. */
1074
1074
  label?: string;
1075
+ /** @description Whether the mapping also forwards UDP traffic on the same host port, in addition to TCP. Optional; defaults to true when omitted.
1076
+ * @default true */
1077
+ udpEnabled?: boolean;
1075
1078
  /** @description IPs/CIDRs allowed to reach the published port. Omit or send an empty array to leave the port open to the internet. */
1076
1079
  whitelistedIps?: string[];
1077
1080
  /** @deprecated
@@ -1942,6 +1945,8 @@ interface components {
1942
1945
  label: string | null;
1943
1946
  status: string;
1944
1947
  isSsh: boolean;
1948
+ /** @description Whether the mapping also forwards UDP traffic on the same host port, in addition to TCP. */
1949
+ udpEnabled: boolean;
1945
1950
  /** Format: date-time */
1946
1951
  createdAt: string;
1947
1952
  /** Format: date-time */
@@ -2323,6 +2328,11 @@ declare class KrovaClient {
2323
2328
  * **Omitting the allow-list leaves the port open to the internet.** That is
2324
2329
  * the documented behaviour, not an oversight — but it means a typo in the
2325
2330
  * field name fails OPEN, which is exactly how the original defect survived.
2331
+ *
2332
+ * `udpEnabled` optionally forwards UDP traffic on the same host port
2333
+ * alongside TCP. It is optional and the server defaults it to `true` when
2334
+ * omitted — so leave it unset to get UDP forwarding, and pass `false`
2335
+ * only to explicitly disable it.
2326
2336
  */
2327
2337
  create: (spaceId: string, cubeId: string, body: CreateTcpMappingInput) => Promise<TcpMapping>;
2328
2338
  /** Delete a TCP port mapping. */
package/dist/index.js CHANGED
@@ -450,6 +450,11 @@ var KrovaClient = class {
450
450
  * **Omitting the allow-list leaves the port open to the internet.** That is
451
451
  * the documented behaviour, not an oversight — but it means a typo in the
452
452
  * field name fails OPEN, which is exactly how the original defect survived.
453
+ *
454
+ * `udpEnabled` optionally forwards UDP traffic on the same host port
455
+ * alongside TCP. It is optional and the server defaults it to `true` when
456
+ * omitted — so leave it unset to get UDP forwarding, and pass `false`
457
+ * only to explicitly disable it.
453
458
  */
454
459
  create: async (spaceId, cubeId, body) => {
455
460
  const { data, error, response } = await this.raw.POST("/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings", {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/error.ts","../src/client.ts"],"sourcesContent":["/**\n * The error body shape returned by the Krova Cloud API.\n *\n * Per the OpenAPI spec (`components.schemas.Error`), every non-2xx response\n * body is `{ \"error\": string }`.\n */\nexport interface KrovaErrorBody {\n error?: string;\n}\n\n/**\n * Error thrown by the ergonomic {@link KrovaClient} helpers when the API\n * responds with a non-2xx status.\n *\n * The raw openapi-fetch client (`client.raw`) never throws — it returns\n * `{ data, error, response }`. The helpers wrap that and throw `KrovaError`\n * so callers can `try/catch`.\n */\nexport class KrovaError extends Error {\n /** HTTP status code of the failing response. */\n readonly status: number;\n\n /**\n * A machine-readable error code, when the API surfaces one via the\n * `X-Error-Code` response header. The documented error body only carries a\n * human-readable `error` string, so this is best-effort.\n */\n readonly code?: string;\n\n /**\n * The request id from the `X-Request-Id` response header, when present.\n * Useful when contacting Krova Cloud support about a specific failure.\n */\n readonly requestId?: string;\n\n /** The parsed JSON error body, when the response had one. */\n readonly body?: KrovaErrorBody;\n\n /** The raw `Response` object, for callers that need headers/url/etc. */\n readonly response?: Response;\n\n constructor(\n message: string,\n init: {\n status: number;\n code?: string;\n requestId?: string;\n body?: KrovaErrorBody;\n response?: Response;\n },\n ) {\n super(message);\n this.name = \"KrovaError\";\n this.status = init.status;\n this.code = init.code;\n this.requestId = init.requestId;\n this.body = init.body;\n this.response = init.response;\n // Restore prototype chain for instanceof across compilation targets.\n Object.setPrototypeOf(this, KrovaError.prototype);\n }\n}\n\n/**\n * Build a {@link KrovaError} from a failing response + parsed error body.\n */\nexport function krovaErrorFrom(\n response: Response,\n body: KrovaErrorBody | undefined,\n): KrovaError {\n const message =\n (typeof body?.error === \"string\" && body.error) ||\n response.statusText ||\n `Request failed with status ${response.status}`;\n return new KrovaError(message, {\n status: response.status,\n code: response.headers.get(\"x-error-code\") ?? undefined,\n requestId: response.headers.get(\"x-request-id\") ?? undefined,\n body,\n response,\n });\n}\n","import createClient, { type Client, type Middleware } from \"openapi-fetch\";\nimport { krovaErrorFrom } from \"./error.js\";\nimport type { components, paths } from \"./generated/types.js\";\n\n/** The Cube resource, as defined in the Krova Cloud OpenAPI spec. */\nexport type Cube = components[\"schemas\"][\"Cube\"];\n\n/** A region with available capacity (from the catalog). */\nexport type Region = components[\"schemas\"][\"Region\"];\n\n/** A selectable OS image (from the catalog). */\nexport type Image = components[\"schemas\"][\"Image\"];\n\n/** A volume-pricing tier (from the catalog). */\nexport type PricingTier = components[\"schemas\"][\"PricingTier\"];\n\n/** Pagination envelope returned alongside a Cube list. */\nexport type Pagination = components[\"schemas\"][\"Pagination\"];\n\n/** A Space — the tenancy an API key is scoped to. */\nexport type Space = components[\"schemas\"][\"Space\"];\n\n/** A Cube's SSH connection info (host, port, user, and pinned host keys). */\nexport type CubeSshInfo = components[\"schemas\"][\"CubeSshInfo\"];\n\n/** A custom domain attached to a Cube. */\nexport type Domain = components[\"schemas\"][\"Domain\"];\n\n/**\n * One DNS record you must publish for a domain to work.\n *\n * An ordinary subdomain needs one CNAME. A wildcard needs three: an ownership\n * TXT, the routing CNAME, and an `_acme-challenge` CNAME that lets Krova issue\n * and renew its certificate.\n *\n * ⛔ `mustBeGrey` and `proxyOk` are deliberate OPPOSITES, and automation needs\n * both. The routing record may sit behind Cloudflare's proxy (orange); the\n * `_acme-challenge` record must not, because a proxied one answers with\n * Cloudflare's addresses and the certificate authority finds nothing there.\n */\nexport type DnsRecord = components[\"schemas\"][\"DnsRecord\"];\n\n/**\n * A {@link DnsRecord} plus what Krova can currently see in public DNS.\n *\n * ⛔ `state: \"missing\"` means NOT PUBLISHED YET — the expected state before you\n * create the record, never an error. `state: \"unknown\"` means Krova could not\n * complete the lookup, which is never a statement about your DNS. Surfacing\n * either to your own users as a failure would be wrong.\n */\nexport type DnsRecordStatus = components[\"schemas\"][\"DnsRecordStatus\"];\n\n/** A snapshot of a Cube's disk. */\nexport type Snapshot = components[\"schemas\"][\"Snapshot\"];\n\n/** A TCP port mapping exposing a Cube port on the host. */\nexport type TcpMapping = components[\"schemas\"][\"TcpMapping\"];\n\n/** Request body for attaching a custom domain to a Cube. */\nexport type CreateDomainInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/domains\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/** Request body for updating a custom domain's proxy settings. */\nexport type UpdateDomainInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/** Request body for creating a TCP port mapping. */\nexport type CreateTcpMappingInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/** Default API base URL — the single `servers[0].url` from the OpenAPI spec. */\nexport const DEFAULT_BASE_URL = \"https://krova.cloud/api/v1\";\n\n/**\n * How the API key is presented to the server.\n *\n * - `\"x-api-key\"` (default) — `X-API-KEY: <key>`, matching the spec's\n * `components.securitySchemes.ApiKeyAuth` (an `apiKey` header named\n * `X-API-KEY`).\n * - `\"bearer\"` — `Authorization: Bearer <key>`, for gateways that expect it.\n */\nexport type AuthScheme = \"x-api-key\" | \"bearer\";\n\nexport interface KrovaClientOptions {\n /**\n * Your Krova Cloud API key (a `kro_...` token). Keys are scoped per Space\n * and inherit the permissions of the membership that created them.\n */\n apiKey: string;\n /** Override the API base URL. Defaults to {@link DEFAULT_BASE_URL}. */\n baseUrl?: string;\n /**\n * Auth header scheme. Defaults to `\"x-api-key\"` (the spec's scheme).\n */\n authScheme?: AuthScheme;\n /**\n * Max automatic retries on retryable statuses (429, 503).\n * Defaults to 2. Set to 0 to disable retries.\n */\n maxRetries?: number;\n /**\n * A custom `fetch` implementation (e.g. for tests or a proxy). Defaults to\n * the global `fetch`.\n */\n fetch?: typeof fetch;\n}\n\n/** Statuses the retry middleware treats as transient. */\nconst RETRYABLE_STATUSES = new Set([429, 503]);\n/** Fallback backoff (ms) when the server sends no `Retry-After` header. */\nconst BASE_BACKOFF_MS = 500;\n/** Cap on any single backoff wait (ms), to keep retries \"small but real\". */\nconst MAX_BACKOFF_MS = 10_000;\n\nconst sleep = (ms: number): Promise<void> =>\n new Promise((resolve) => setTimeout(resolve, ms));\n\n/**\n * Parse a `Retry-After` header (RFC 7231): either delta-seconds or an\n * HTTP-date. Returns milliseconds to wait, or `null` if absent/unparseable.\n */\nfunction parseRetryAfterMs(headerValue: string | null): number | null {\n if (!headerValue) return null;\n const seconds = Number(headerValue);\n if (Number.isFinite(seconds)) return Math.max(0, seconds * 1000);\n const dateMs = Date.parse(headerValue);\n if (Number.isFinite(dateMs)) return Math.max(0, dateMs - Date.now());\n return null;\n}\n\nfunction authMiddleware(apiKey: string, scheme: AuthScheme): Middleware {\n return {\n onRequest({ request }) {\n if (scheme === \"bearer\") {\n request.headers.set(\"Authorization\", `Bearer ${apiKey}`);\n } else {\n request.headers.set(\"X-API-KEY\", apiKey);\n }\n return request;\n },\n };\n}\n\n/**\n * Retry middleware: on a retryable status, wait (honoring `Retry-After` when\n * present, else exponential backoff) and re-issue the request.\n *\n * A retried request may have a body (POST/PUT/DELETE — exactly the mutating,\n * rate-limited endpoints). By the time `onResponse` runs, the request that was\n * handed to `fetch` has had its body stream consumed, so `request.clone()` here\n * throws `TypeError: unusable`. To re-issue it we stash a *pristine* clone in\n * `onRequest` — captured before the body is read — keyed by openapi-fetch's\n * per-request `id`, and clone from that pristine copy on each attempt.\n */\nfunction retryMiddleware(maxRetries: number, doFetch: typeof fetch): Middleware {\n const pristine = new Map<string, Request>();\n return {\n onRequest({ request, id }) {\n pristine.set(id, request.clone());\n return request;\n },\n onError({ id }) {\n // fetch rejected (network error) — no onResponse will fire; don't leak.\n pristine.delete(id);\n },\n async onResponse({ request, response, id }) {\n const original = pristine.get(id) ?? request;\n pristine.delete(id);\n if (maxRetries <= 0 || !RETRYABLE_STATUSES.has(response.status)) {\n return response;\n }\n let current = response;\n for (let attempt = 1; attempt <= maxRetries; attempt++) {\n if (!RETRYABLE_STATUSES.has(current.status)) break;\n const retryAfterMs = parseRetryAfterMs(current.headers.get(\"retry-after\"));\n const backoff = Math.min(BASE_BACKOFF_MS * 2 ** (attempt - 1), MAX_BACKOFF_MS);\n // Cap the wait — including a server-supplied `Retry-After` — so a hostile\n // or misconfigured server can't park the client for minutes/hours.\n await sleep(Math.min(retryAfterMs ?? backoff, MAX_BACKOFF_MS));\n // Re-issue from the pristine clone; `.clone()` keeps it reusable across\n // multiple attempts.\n current = await doFetch(original.clone());\n }\n return current;\n },\n };\n}\n\n/**\n * A typed client for the Krova Cloud API.\n *\n * @example\n * ```ts\n * const krova = new KrovaClient({ apiKey: \"kro_...\" });\n * const cubes = await krova.cubes.list(\"space_123\");\n * ```\n */\nexport class KrovaClient {\n /**\n * The underlying openapi-fetch client — a fully typed escape hatch to every\n * path in the spec. Returns `{ data, error, response }` and never throws.\n *\n * @example\n * ```ts\n * const { data, error } = await krova.raw.GET(\n * \"/spaces/{spaceId}/cubes/{cubeId}\",\n * { params: { path: { spaceId, cubeId } } },\n * );\n * ```\n */\n readonly raw: Client<paths>;\n\n /** The resolved base URL in use. */\n readonly baseUrl: string;\n\n constructor(options: KrovaClientOptions) {\n if (!options?.apiKey) {\n throw new Error(\"KrovaClient: `apiKey` is required.\");\n }\n this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n const doFetch = options.fetch ?? globalThis.fetch;\n const maxRetries = options.maxRetries ?? 2;\n\n this.raw = createClient<paths>({\n baseUrl: this.baseUrl,\n // SECURITY: never auto-follow redirects. The Krova Cloud API is a plain\n // JSON API and never legitimately 3xx's a data call. Following a redirect\n // would resend the `X-API-KEY` header to the redirect target — and unlike\n // `Authorization`, `Cookie`, and `Proxy-Authorization`, the Fetch spec does\n // NOT strip a custom header like `X-API-KEY` on a cross-origin redirect\n // (verified against undici/Node fetch). A compromised/misconfigured proxy,\n // an open-redirect on the API, or a MITM could otherwise exfiltrate the key\n // to an attacker's host. With `\"manual\"`, a redirect comes back as a\n // non-ok response and the helpers throw `KrovaError` instead of leaking.\n redirect: \"manual\",\n ...(options.fetch ? { fetch: options.fetch } : {}),\n });\n this.raw.use(authMiddleware(options.apiKey, options.authScheme ?? \"x-api-key\"));\n if (maxRetries > 0) {\n this.raw.use(retryMiddleware(maxRetries, doFetch));\n }\n }\n\n // ---------------------------------------------------------------------------\n // Cubes\n // ---------------------------------------------------------------------------\n\n readonly cubes = {\n /** List Cubes in a Space, with pagination metadata. */\n list: async (spaceId: string) => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/cubes\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"List Cubes response was empty.\" });\n return data;\n },\n\n /**\n * Create a Cube. Returns the created {@link Cube}.\n *\n * @param spaceId Target Space id.\n * @param body Cube spec — `{ name, image, resources, sshPublicKey, ... }`.\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n create: async (\n spaceId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes\"][\"post\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n opts?: { idempotencyKey?: string },\n ): Promise<Cube> => {\n const { data, error, response } = await this.raw.POST(\"/spaces/{spaceId}/cubes\", {\n params: {\n path: { spaceId },\n ...(opts?.idempotencyKey\n ? { header: { \"Idempotency-Key\": opts.idempotencyKey } }\n : {}),\n },\n body,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = data?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, { error: \"Create Cube response had no `cube`.\" });\n }\n return cube;\n },\n\n /** Get a single Cube. Returns the {@link Cube}. */\n get: async (spaceId: string, cubeId: string): Promise<Cube> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = data?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, { error: \"Get Cube response had no `cube`.\" });\n }\n return cube;\n },\n\n /**\n * Update the IN-CUBE port that SSH is forwarded to.\n *\n * `cubePort` is the port **inside** the Cube that sshd listens on — NOT the\n * host port you connect to. The host port is allocated by Krova and is not\n * changed by this call. Pointing this at a port nothing is listening on\n * inside the Cube will silently make SSH unreachable; the default is 22.\n *\n * The Krova Cloud API exposes no general Cube-mutation endpoint; the only\n * mutable Cube field over the API is this port, via\n * `PUT /spaces/{spaceId}/cubes/{cubeId}/ssh-port`. This helper maps to that\n * endpoint. (Compute resize / rename are not part of the public API.)\n */\n update: async (\n spaceId: string,\n cubeId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/ssh-port\"][\"put\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ): Promise<unknown> => {\n const { data, error, response } = await this.raw.PUT(\n \"/spaces/{spaceId}/cubes/{cubeId}/ssh-port\",\n { params: { path: { spaceId, cubeId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Delete a Cube (asynchronous — deletion is enqueued). */\n delete: async (spaceId: string, cubeId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Delete Cube response was empty.\" });\n return data;\n },\n\n /** Power off a running Cube (asynchronous — power-off is enqueued). The Cube\n * becomes `stopped` (its host RAM is freed); start it again with `wake`. */\n powerOff: async (spaceId: string, cubeId: string): Promise<unknown> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/power-off\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Start a stopped Cube (asynchronous — start is enqueued). */\n /**\n * Restart a Cube (COLD restart).\n *\n * The hypervisor process is stopped and relaunched, so the Cube boots\n * against the host's current kernel. This is the only way a Cube picks up a\n * refreshed guest kernel after a platform image update — a `reboot` issued\n * INSIDE the Cube cannot do it, because Firecracker treats a guest reboot as\n * a shutdown and the kernel is supplied externally by the host.\n *\n * Disk state is preserved; only the kernel changes. The Cube must be\n * `running`. Concurrent restarts of the same Cube are rejected (409) rather\n * than queued twice.\n */\n restart: async (spaceId: string, cubeId: string): Promise<unknown> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/restart\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n wake: async (spaceId: string, cubeId: string): Promise<unknown> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/wake\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /**\n * Get a Cube's SSH connection info — host, port, login user, and (when\n * available) the pinned host public keys for strict host-key verification.\n */\n ssh: async (spaceId: string, cubeId: string): Promise<CubeSshInfo> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/ssh\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Cube SSH-info response was empty.\" });\n return data;\n },\n\n /**\n * Restore a Cube's disk from one of its {@link Snapshot}s (asynchronous —\n * the restore is enqueued). The Cube's current disk is replaced.\n */\n restore: async (spaceId: string, cubeId: string, snapshotId: string) => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/restore\",\n { params: { path: { spaceId, cubeId } }, body: { snapshotId } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n /**\n * Resolve the {@link Space} this API key is scoped to — so you don't have to\n * hardcode a `spaceId`. Handy right after constructing the client:\n *\n * @example\n * ```ts\n * const space = await krova.getSpace();\n * const cubes = await krova.cubes.list(space.id);\n * ```\n */\n async getSpace(): Promise<Space> {\n const { data, error, response } = await this.raw.GET(\"/space\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Space response was empty.\" });\n return data;\n }\n\n // ---------------------------------------------------------------------------\n // Custom domains\n // ---------------------------------------------------------------------------\n\n readonly domains = {\n /** List the custom domains attached to a Cube. */\n list: async (spaceId: string, cubeId: string): Promise<Domain[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.domains ?? [];\n },\n\n /**\n * Attach a custom domain to a Cube. `domain` + `port` are required.\n *\n * Returns the domain AND the DNS records you must publish for it to work —\n * so you can create them in the same run, without a second call and without\n * hard-coding record shapes. A wildcard needs three; an exact host needs one.\n *\n * ⛔ BREAKING in 0.4.0: this used to resolve to `Domain`. It now resolves to\n * `{ domain, records }`, because for a wildcard two of the three records\n * (the ownership TXT and the `_acme-challenge` delegation) were not\n * derivable from anything the SDK returned — an integration had to read\n * them out of the docs and hope they still matched the server.\n */\n create: async (\n spaceId: string,\n cubeId: string,\n body: CreateDomainInput,\n ): Promise<{ domain: Domain; records: DnsRecord[] }> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains\",\n { params: { path: { spaceId, cubeId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.domain)\n throw krovaErrorFrom(response, { error: \"Create domain response had no `domain`.\" });\n return { domain: data.domain, records: data.records ?? [] };\n },\n\n /**\n * The DNS records a domain needs, each checked against live DNS.\n *\n * Poll this after publishing them: `summary.complete` turns true only once\n * every record is `found`. Each call performs real DNS lookups and is rate\n * limited, so poll on an interval rather than in a tight loop.\n */\n records: async (\n spaceId: string,\n cubeId: string,\n mappingId: string,\n ): Promise<{\n domain: string;\n isWildcard: boolean;\n records: DnsRecordStatus[];\n summary: { found: number; total: number; complete: boolean };\n checkedAt: string;\n }> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}/records\",\n { params: { path: { spaceId, cubeId, mappingId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data)\n throw krovaErrorFrom(response, { error: \"Domain records response was empty.\" });\n return data;\n },\n\n /** Update a domain's per-domain proxy settings. */\n update: async (\n spaceId: string,\n cubeId: string,\n mappingId: string,\n body: UpdateDomainInput,\n ): Promise<Domain> => {\n const { data, error, response } = await this.raw.PATCH(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}\",\n { params: { path: { spaceId, cubeId, mappingId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.domain)\n throw krovaErrorFrom(response, { error: \"Update domain response had no `domain`.\" });\n return data.domain;\n },\n\n /** Detach a custom domain from a Cube. */\n delete: async (spaceId: string, cubeId: string, mappingId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}\",\n { params: { path: { spaceId, cubeId, mappingId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Snapshots\n // ---------------------------------------------------------------------------\n\n readonly snapshots = {\n /** List a Cube's snapshots. */\n list: async (spaceId: string, cubeId: string): Promise<Snapshot[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/snapshots\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.snapshots ?? [];\n },\n\n /** Create a snapshot of a Cube's disk (asynchronous — enqueued). */\n create: async (\n spaceId: string,\n cubeId: string,\n body?: { name?: string },\n ): Promise<Snapshot> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/snapshots\",\n { params: { path: { spaceId, cubeId } }, body: body ?? {} },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.snapshot)\n throw krovaErrorFrom(response, { error: \"Create snapshot response had no `snapshot`.\" });\n return data.snapshot;\n },\n\n /** Delete a snapshot. */\n delete: async (spaceId: string, cubeId: string, snapshotId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}/snapshots/{snapshotId}\",\n { params: { path: { spaceId, cubeId, snapshotId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // TCP port mappings\n // ---------------------------------------------------------------------------\n\n readonly tcpMappings = {\n /** List a Cube's TCP port mappings. */\n list: async (spaceId: string, cubeId: string): Promise<TcpMapping[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.tcpMappings ?? [];\n },\n\n /**\n * Create a TCP port mapping exposing a Cube port on the host. `cubePort` is\n * required; `whitelistedIps` optionally restricts who can reach it.\n *\n * ⛔ Send `whitelistedIps`, not `whitelistIps`. The published spec named\n * the field `whitelistIps` while the server has always read\n * `whitelistedIps`, so every allow-listed mapping created through this SDK\n * was silently published WORLD-OPEN, with a 201 and no error (reproduced\n * on production 2026-09-02). The server now accepts both, so an older\n * client keeps working, but `whitelistIps` is deprecated.\n *\n * **Omitting the allow-list leaves the port open to the internet.** That is\n * the documented behaviour, not an oversight — but it means a typo in the\n * field name fails OPEN, which is exactly how the original defect survived.\n */\n create: async (\n spaceId: string,\n cubeId: string,\n body: CreateTcpMappingInput,\n ): Promise<TcpMapping> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings\",\n { params: { path: { spaceId, cubeId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.tcpMapping)\n throw krovaErrorFrom(response, { error: \"Create TCP mapping response had no `tcpMapping`.\" });\n return data.tcpMapping;\n },\n\n /** Delete a TCP port mapping. */\n delete: async (spaceId: string, cubeId: string, mappingId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings/{mappingId}\",\n { params: { path: { spaceId, cubeId, mappingId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Imports & backups (.cube archive import / export)\n // ---------------------------------------------------------------------------\n\n readonly imports = {\n /**\n * Start importing a `.cube` archive into a new Cube. Returns the multipart\n * upload target (`importId`, `uploadId`, presigned `parts`, …). Upload the\n * archive to those URLs, then call {@link imports.complete}.\n */\n create: async (\n spaceId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes/imports\"][\"post\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) => {\n const { data, error, response } = await this.raw.POST(\"/spaces/{spaceId}/cubes/imports\", {\n params: { path: { spaceId } },\n body,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Get an in-progress or completed import by id. */\n get: async (spaceId: string, importId: string) => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/imports/{importId}\",\n { params: { path: { spaceId, importId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /**\n * Finish an import after the archive has been uploaded — provisions the\n * Cube. Pass the uploaded `parts` (partNumber + etag) and the resolved\n * `config`.\n */\n complete: async (\n spaceId: string,\n importId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes/imports/{importId}/complete\"][\"post\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/imports/{importId}/complete\",\n { params: { path: { spaceId, importId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Cancel an in-progress import. */\n cancel: async (spaceId: string, importId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/imports/{importId}\",\n { params: { path: { spaceId, importId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n readonly backups = {\n /** Get a time-limited download URL for a backup `.cube` archive. */\n download: async (spaceId: string, backupId: string) => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/backups/{backupId}/download\",\n { params: { path: { spaceId, backupId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Public catalog (no auth required by the API, but the key is harmless)\n // ---------------------------------------------------------------------------\n\n readonly catalog = {\n /** List regions with available capacity. */\n regions: async () => {\n const { data, error, response } = await this.raw.GET(\"/regions\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Regions response was empty.\" });\n return data;\n },\n\n /** List available OS images. */\n images: async () => {\n const { data, error, response } = await this.raw.GET(\"/images\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Images response was empty.\" });\n return data;\n },\n\n /** Per-resource hourly rates and volume pricing tiers. */\n pricing: async () => {\n const { data, error, response } = await this.raw.GET(\"/pricing\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Pricing response was empty.\" });\n return data;\n },\n };\n}\n"],"mappings":";;;;;;;;;;AAkBA,IAAa,aAAb,MAAa,mBAAmB,MAAM;;CAEpC;;;;;;CAOA;;;;;CAMA;;CAGA;;CAGA;CAEA,YACE,SACA,MAOA;EACA,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,SAAS,KAAK;EACnB,KAAK,OAAO,KAAK;EACjB,KAAK,YAAY,KAAK;EACtB,KAAK,OAAO,KAAK;EACjB,KAAK,WAAW,KAAK;EAErB,OAAO,eAAe,MAAM,WAAW,SAAS;CAClD;AACF;;;;AAKA,SAAgB,eACd,UACA,MACY;CAKZ,OAAO,IAAI,WAHR,OAAO,MAAM,UAAU,YAAY,KAAK,SACzC,SAAS,cACT,8BAA8B,SAAS,UACV;EAC7B,QAAQ,SAAS;EACjB,MAAM,SAAS,QAAQ,IAAI,cAAc,KAAK,KAAA;EAC9C,WAAW,SAAS,QAAQ,IAAI,cAAc,KAAK,KAAA;EACnD;EACA;CACF,CAAC;AACH;;;;ACPA,MAAa,mBAAmB;;AAqChC,MAAM,qCAAqB,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC;;AAE7C,MAAM,kBAAkB;;AAExB,MAAM,iBAAiB;AAEvB,MAAM,SAAS,OACb,IAAI,SAAS,YAAY,WAAW,SAAS,EAAE,CAAC;;;;;AAMlD,SAAS,kBAAkB,aAA2C;CACpE,IAAI,CAAC,aAAa,OAAO;CACzB,MAAM,UAAU,OAAO,WAAW;CAClC,IA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EAC7E,OAAO;CACT,EACF;CAMA,UAAmB;;EAEjB,SAAS,YAAY;GACnB,MAAM,EAAE,MAAM,OAAO,aAAa,MAAM,KAAK,IAAI,IAAI,UAAU;GAC/D,IAAI,UAAU,KAAA,KAAa,CAAC,SAAS,IAAI,MAAM,eAAe,UAAU,KAAK;GAC7E,IAAI,SAAS,KAAA,GACX,MAAM,eAAe,UAAU,EAAE,OAAO,8BAA8B,CAAC;GACzE,OAAO;EACT;;EAGA,QAAQ,YAAY;GAClB,MAAM,EAAE,MAAM,OAAO,aAAa,MAAM,KAAK,IAAI,IAAI,SAAS;GAC9D,IAAI,UAAU,KAAA,KAAa,CAAC,SAAS,IAAI,MAAM,eAAe,UAAU,KAAK;GAC7E,IAAI,SAAS,KAAA,GACX,MAAM,eAAe,UAAU,EAAE,OAAO,6BAA6B,CAAC;GACxE,OAAO;EACT;;EAGA,SAAS,YAAY;GACnB,MAAM,EAAE,MAAM,OAAO,aAAa,MAAM,KAAK,IAAI,IAAI,UAAU;GAC/D,IAAI,UAAU,KAAA,KAAa,CAAC,SAAS,IAAI,MAAM,eAAe,UAAU,KAAK;GAC7E,IAAI,SAAS,KAAA,GACX,MAAM,eAAe,UAAU,EAAE,OAAO,8BAA8B,CAAC;GACzE,OAAO;EACT;CACF;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/error.ts","../src/client.ts"],"sourcesContent":["/**\n * The error body shape returned by the Krova Cloud API.\n *\n * Per the OpenAPI spec (`components.schemas.Error`), every non-2xx response\n * body is `{ \"error\": string }`.\n */\nexport interface KrovaErrorBody {\n error?: string;\n}\n\n/**\n * Error thrown by the ergonomic {@link KrovaClient} helpers when the API\n * responds with a non-2xx status.\n *\n * The raw openapi-fetch client (`client.raw`) never throws — it returns\n * `{ data, error, response }`. The helpers wrap that and throw `KrovaError`\n * so callers can `try/catch`.\n */\nexport class KrovaError extends Error {\n /** HTTP status code of the failing response. */\n readonly status: number;\n\n /**\n * A machine-readable error code, when the API surfaces one via the\n * `X-Error-Code` response header. The documented error body only carries a\n * human-readable `error` string, so this is best-effort.\n */\n readonly code?: string;\n\n /**\n * The request id from the `X-Request-Id` response header, when present.\n * Useful when contacting Krova Cloud support about a specific failure.\n */\n readonly requestId?: string;\n\n /** The parsed JSON error body, when the response had one. */\n readonly body?: KrovaErrorBody;\n\n /** The raw `Response` object, for callers that need headers/url/etc. */\n readonly response?: Response;\n\n constructor(\n message: string,\n init: {\n status: number;\n code?: string;\n requestId?: string;\n body?: KrovaErrorBody;\n response?: Response;\n },\n ) {\n super(message);\n this.name = \"KrovaError\";\n this.status = init.status;\n this.code = init.code;\n this.requestId = init.requestId;\n this.body = init.body;\n this.response = init.response;\n // Restore prototype chain for instanceof across compilation targets.\n Object.setPrototypeOf(this, KrovaError.prototype);\n }\n}\n\n/**\n * Build a {@link KrovaError} from a failing response + parsed error body.\n */\nexport function krovaErrorFrom(\n response: Response,\n body: KrovaErrorBody | undefined,\n): KrovaError {\n const message =\n (typeof body?.error === \"string\" && body.error) ||\n response.statusText ||\n `Request failed with status ${response.status}`;\n return new KrovaError(message, {\n status: response.status,\n code: response.headers.get(\"x-error-code\") ?? undefined,\n requestId: response.headers.get(\"x-request-id\") ?? undefined,\n body,\n response,\n });\n}\n","import createClient, { type Client, type Middleware } from \"openapi-fetch\";\nimport { krovaErrorFrom } from \"./error.js\";\nimport type { components, paths } from \"./generated/types.js\";\n\n/** The Cube resource, as defined in the Krova Cloud OpenAPI spec. */\nexport type Cube = components[\"schemas\"][\"Cube\"];\n\n/** A region with available capacity (from the catalog). */\nexport type Region = components[\"schemas\"][\"Region\"];\n\n/** A selectable OS image (from the catalog). */\nexport type Image = components[\"schemas\"][\"Image\"];\n\n/** A volume-pricing tier (from the catalog). */\nexport type PricingTier = components[\"schemas\"][\"PricingTier\"];\n\n/** Pagination envelope returned alongside a Cube list. */\nexport type Pagination = components[\"schemas\"][\"Pagination\"];\n\n/** A Space — the tenancy an API key is scoped to. */\nexport type Space = components[\"schemas\"][\"Space\"];\n\n/** A Cube's SSH connection info (host, port, user, and pinned host keys). */\nexport type CubeSshInfo = components[\"schemas\"][\"CubeSshInfo\"];\n\n/** A custom domain attached to a Cube. */\nexport type Domain = components[\"schemas\"][\"Domain\"];\n\n/**\n * One DNS record you must publish for a domain to work.\n *\n * An ordinary subdomain needs one CNAME. A wildcard needs three: an ownership\n * TXT, the routing CNAME, and an `_acme-challenge` CNAME that lets Krova issue\n * and renew its certificate.\n *\n * ⛔ `mustBeGrey` and `proxyOk` are deliberate OPPOSITES, and automation needs\n * both. The routing record may sit behind Cloudflare's proxy (orange); the\n * `_acme-challenge` record must not, because a proxied one answers with\n * Cloudflare's addresses and the certificate authority finds nothing there.\n */\nexport type DnsRecord = components[\"schemas\"][\"DnsRecord\"];\n\n/**\n * A {@link DnsRecord} plus what Krova can currently see in public DNS.\n *\n * ⛔ `state: \"missing\"` means NOT PUBLISHED YET — the expected state before you\n * create the record, never an error. `state: \"unknown\"` means Krova could not\n * complete the lookup, which is never a statement about your DNS. Surfacing\n * either to your own users as a failure would be wrong.\n */\nexport type DnsRecordStatus = components[\"schemas\"][\"DnsRecordStatus\"];\n\n/** A snapshot of a Cube's disk. */\nexport type Snapshot = components[\"schemas\"][\"Snapshot\"];\n\n/** A TCP port mapping exposing a Cube port on the host. */\nexport type TcpMapping = components[\"schemas\"][\"TcpMapping\"];\n\n/** Request body for attaching a custom domain to a Cube. */\nexport type CreateDomainInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/domains\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/** Request body for updating a custom domain's proxy settings. */\nexport type UpdateDomainInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/** Request body for creating a TCP port mapping. */\nexport type CreateTcpMappingInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/** Default API base URL — the single `servers[0].url` from the OpenAPI spec. */\nexport const DEFAULT_BASE_URL = \"https://krova.cloud/api/v1\";\n\n/**\n * How the API key is presented to the server.\n *\n * - `\"x-api-key\"` (default) — `X-API-KEY: <key>`, matching the spec's\n * `components.securitySchemes.ApiKeyAuth` (an `apiKey` header named\n * `X-API-KEY`).\n * - `\"bearer\"` — `Authorization: Bearer <key>`, for gateways that expect it.\n */\nexport type AuthScheme = \"x-api-key\" | \"bearer\";\n\nexport interface KrovaClientOptions {\n /**\n * Your Krova Cloud API key (a `kro_...` token). Keys are scoped per Space\n * and inherit the permissions of the membership that created them.\n */\n apiKey: string;\n /** Override the API base URL. Defaults to {@link DEFAULT_BASE_URL}. */\n baseUrl?: string;\n /**\n * Auth header scheme. Defaults to `\"x-api-key\"` (the spec's scheme).\n */\n authScheme?: AuthScheme;\n /**\n * Max automatic retries on retryable statuses (429, 503).\n * Defaults to 2. Set to 0 to disable retries.\n */\n maxRetries?: number;\n /**\n * A custom `fetch` implementation (e.g. for tests or a proxy). Defaults to\n * the global `fetch`.\n */\n fetch?: typeof fetch;\n}\n\n/** Statuses the retry middleware treats as transient. */\nconst RETRYABLE_STATUSES = new Set([429, 503]);\n/** Fallback backoff (ms) when the server sends no `Retry-After` header. */\nconst BASE_BACKOFF_MS = 500;\n/** Cap on any single backoff wait (ms), to keep retries \"small but real\". */\nconst MAX_BACKOFF_MS = 10_000;\n\nconst sleep = (ms: number): Promise<void> =>\n new Promise((resolve) => setTimeout(resolve, ms));\n\n/**\n * Parse a `Retry-After` header (RFC 7231): either delta-seconds or an\n * HTTP-date. Returns milliseconds to wait, or `null` if absent/unparseable.\n */\nfunction parseRetryAfterMs(headerValue: string | null): number | null {\n if (!headerValue) return null;\n const seconds = Number(headerValue);\n if (Number.isFinite(seconds)) return Math.max(0, seconds * 1000);\n const dateMs = Date.parse(headerValue);\n if (Number.isFinite(dateMs)) return Math.max(0, dateMs - Date.now());\n return null;\n}\n\nfunction authMiddleware(apiKey: string, scheme: AuthScheme): Middleware {\n return {\n onRequest({ request }) {\n if (scheme === \"bearer\") {\n request.headers.set(\"Authorization\", `Bearer ${apiKey}`);\n } else {\n request.headers.set(\"X-API-KEY\", apiKey);\n }\n return request;\n },\n };\n}\n\n/**\n * Retry middleware: on a retryable status, wait (honoring `Retry-After` when\n * present, else exponential backoff) and re-issue the request.\n *\n * A retried request may have a body (POST/PUT/DELETE — exactly the mutating,\n * rate-limited endpoints). By the time `onResponse` runs, the request that was\n * handed to `fetch` has had its body stream consumed, so `request.clone()` here\n * throws `TypeError: unusable`. To re-issue it we stash a *pristine* clone in\n * `onRequest` — captured before the body is read — keyed by openapi-fetch's\n * per-request `id`, and clone from that pristine copy on each attempt.\n */\nfunction retryMiddleware(maxRetries: number, doFetch: typeof fetch): Middleware {\n const pristine = new Map<string, Request>();\n return {\n onRequest({ request, id }) {\n pristine.set(id, request.clone());\n return request;\n },\n onError({ id }) {\n // fetch rejected (network error) — no onResponse will fire; don't leak.\n pristine.delete(id);\n },\n async onResponse({ request, response, id }) {\n const original = pristine.get(id) ?? request;\n pristine.delete(id);\n if (maxRetries <= 0 || !RETRYABLE_STATUSES.has(response.status)) {\n return response;\n }\n let current = response;\n for (let attempt = 1; attempt <= maxRetries; attempt++) {\n if (!RETRYABLE_STATUSES.has(current.status)) break;\n const retryAfterMs = parseRetryAfterMs(current.headers.get(\"retry-after\"));\n const backoff = Math.min(BASE_BACKOFF_MS * 2 ** (attempt - 1), MAX_BACKOFF_MS);\n // Cap the wait — including a server-supplied `Retry-After` — so a hostile\n // or misconfigured server can't park the client for minutes/hours.\n await sleep(Math.min(retryAfterMs ?? backoff, MAX_BACKOFF_MS));\n // Re-issue from the pristine clone; `.clone()` keeps it reusable across\n // multiple attempts.\n current = await doFetch(original.clone());\n }\n return current;\n },\n };\n}\n\n/**\n * A typed client for the Krova Cloud API.\n *\n * @example\n * ```ts\n * const krova = new KrovaClient({ apiKey: \"kro_...\" });\n * const cubes = await krova.cubes.list(\"space_123\");\n * ```\n */\nexport class KrovaClient {\n /**\n * The underlying openapi-fetch client — a fully typed escape hatch to every\n * path in the spec. Returns `{ data, error, response }` and never throws.\n *\n * @example\n * ```ts\n * const { data, error } = await krova.raw.GET(\n * \"/spaces/{spaceId}/cubes/{cubeId}\",\n * { params: { path: { spaceId, cubeId } } },\n * );\n * ```\n */\n readonly raw: Client<paths>;\n\n /** The resolved base URL in use. */\n readonly baseUrl: string;\n\n constructor(options: KrovaClientOptions) {\n if (!options?.apiKey) {\n throw new Error(\"KrovaClient: `apiKey` is required.\");\n }\n this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n const doFetch = options.fetch ?? globalThis.fetch;\n const maxRetries = options.maxRetries ?? 2;\n\n this.raw = createClient<paths>({\n baseUrl: this.baseUrl,\n // SECURITY: never auto-follow redirects. The Krova Cloud API is a plain\n // JSON API and never legitimately 3xx's a data call. Following a redirect\n // would resend the `X-API-KEY` header to the redirect target — and unlike\n // `Authorization`, `Cookie`, and `Proxy-Authorization`, the Fetch spec does\n // NOT strip a custom header like `X-API-KEY` on a cross-origin redirect\n // (verified against undici/Node fetch). A compromised/misconfigured proxy,\n // an open-redirect on the API, or a MITM could otherwise exfiltrate the key\n // to an attacker's host. With `\"manual\"`, a redirect comes back as a\n // non-ok response and the helpers throw `KrovaError` instead of leaking.\n redirect: \"manual\",\n ...(options.fetch ? { fetch: options.fetch } : {}),\n });\n this.raw.use(authMiddleware(options.apiKey, options.authScheme ?? \"x-api-key\"));\n if (maxRetries > 0) {\n this.raw.use(retryMiddleware(maxRetries, doFetch));\n }\n }\n\n // ---------------------------------------------------------------------------\n // Cubes\n // ---------------------------------------------------------------------------\n\n readonly cubes = {\n /** List Cubes in a Space, with pagination metadata. */\n list: async (spaceId: string) => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/cubes\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"List Cubes response was empty.\" });\n return data;\n },\n\n /**\n * Create a Cube. Returns the created {@link Cube}.\n *\n * @param spaceId Target Space id.\n * @param body Cube spec — `{ name, image, resources, sshPublicKey, ... }`.\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n create: async (\n spaceId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes\"][\"post\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n opts?: { idempotencyKey?: string },\n ): Promise<Cube> => {\n const { data, error, response } = await this.raw.POST(\"/spaces/{spaceId}/cubes\", {\n params: {\n path: { spaceId },\n ...(opts?.idempotencyKey\n ? { header: { \"Idempotency-Key\": opts.idempotencyKey } }\n : {}),\n },\n body,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = data?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, { error: \"Create Cube response had no `cube`.\" });\n }\n return cube;\n },\n\n /** Get a single Cube. Returns the {@link Cube}. */\n get: async (spaceId: string, cubeId: string): Promise<Cube> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = data?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, { error: \"Get Cube response had no `cube`.\" });\n }\n return cube;\n },\n\n /**\n * Update the IN-CUBE port that SSH is forwarded to.\n *\n * `cubePort` is the port **inside** the Cube that sshd listens on — NOT the\n * host port you connect to. The host port is allocated by Krova and is not\n * changed by this call. Pointing this at a port nothing is listening on\n * inside the Cube will silently make SSH unreachable; the default is 22.\n *\n * The Krova Cloud API exposes no general Cube-mutation endpoint; the only\n * mutable Cube field over the API is this port, via\n * `PUT /spaces/{spaceId}/cubes/{cubeId}/ssh-port`. This helper maps to that\n * endpoint. (Compute resize / rename are not part of the public API.)\n */\n update: async (\n spaceId: string,\n cubeId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/ssh-port\"][\"put\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ): Promise<unknown> => {\n const { data, error, response } = await this.raw.PUT(\n \"/spaces/{spaceId}/cubes/{cubeId}/ssh-port\",\n { params: { path: { spaceId, cubeId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Delete a Cube (asynchronous — deletion is enqueued). */\n delete: async (spaceId: string, cubeId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Delete Cube response was empty.\" });\n return data;\n },\n\n /** Power off a running Cube (asynchronous — power-off is enqueued). The Cube\n * becomes `stopped` (its host RAM is freed); start it again with `wake`. */\n powerOff: async (spaceId: string, cubeId: string): Promise<unknown> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/power-off\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Start a stopped Cube (asynchronous — start is enqueued). */\n /**\n * Restart a Cube (COLD restart).\n *\n * The hypervisor process is stopped and relaunched, so the Cube boots\n * against the host's current kernel. This is the only way a Cube picks up a\n * refreshed guest kernel after a platform image update — a `reboot` issued\n * INSIDE the Cube cannot do it, because Firecracker treats a guest reboot as\n * a shutdown and the kernel is supplied externally by the host.\n *\n * Disk state is preserved; only the kernel changes. The Cube must be\n * `running`. Concurrent restarts of the same Cube are rejected (409) rather\n * than queued twice.\n */\n restart: async (spaceId: string, cubeId: string): Promise<unknown> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/restart\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n wake: async (spaceId: string, cubeId: string): Promise<unknown> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/wake\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /**\n * Get a Cube's SSH connection info — host, port, login user, and (when\n * available) the pinned host public keys for strict host-key verification.\n */\n ssh: async (spaceId: string, cubeId: string): Promise<CubeSshInfo> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/ssh\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Cube SSH-info response was empty.\" });\n return data;\n },\n\n /**\n * Restore a Cube's disk from one of its {@link Snapshot}s (asynchronous —\n * the restore is enqueued). The Cube's current disk is replaced.\n */\n restore: async (spaceId: string, cubeId: string, snapshotId: string) => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/restore\",\n { params: { path: { spaceId, cubeId } }, body: { snapshotId } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n /**\n * Resolve the {@link Space} this API key is scoped to — so you don't have to\n * hardcode a `spaceId`. Handy right after constructing the client:\n *\n * @example\n * ```ts\n * const space = await krova.getSpace();\n * const cubes = await krova.cubes.list(space.id);\n * ```\n */\n async getSpace(): Promise<Space> {\n const { data, error, response } = await this.raw.GET(\"/space\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Space response was empty.\" });\n return data;\n }\n\n // ---------------------------------------------------------------------------\n // Custom domains\n // ---------------------------------------------------------------------------\n\n readonly domains = {\n /** List the custom domains attached to a Cube. */\n list: async (spaceId: string, cubeId: string): Promise<Domain[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.domains ?? [];\n },\n\n /**\n * Attach a custom domain to a Cube. `domain` + `port` are required.\n *\n * Returns the domain AND the DNS records you must publish for it to work —\n * so you can create them in the same run, without a second call and without\n * hard-coding record shapes. A wildcard needs three; an exact host needs one.\n *\n * ⛔ BREAKING in 0.4.0: this used to resolve to `Domain`. It now resolves to\n * `{ domain, records }`, because for a wildcard two of the three records\n * (the ownership TXT and the `_acme-challenge` delegation) were not\n * derivable from anything the SDK returned — an integration had to read\n * them out of the docs and hope they still matched the server.\n */\n create: async (\n spaceId: string,\n cubeId: string,\n body: CreateDomainInput,\n ): Promise<{ domain: Domain; records: DnsRecord[] }> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains\",\n { params: { path: { spaceId, cubeId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.domain)\n throw krovaErrorFrom(response, { error: \"Create domain response had no `domain`.\" });\n return { domain: data.domain, records: data.records ?? [] };\n },\n\n /**\n * The DNS records a domain needs, each checked against live DNS.\n *\n * Poll this after publishing them: `summary.complete` turns true only once\n * every record is `found`. Each call performs real DNS lookups and is rate\n * limited, so poll on an interval rather than in a tight loop.\n */\n records: async (\n spaceId: string,\n cubeId: string,\n mappingId: string,\n ): Promise<{\n domain: string;\n isWildcard: boolean;\n records: DnsRecordStatus[];\n summary: { found: number; total: number; complete: boolean };\n checkedAt: string;\n }> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}/records\",\n { params: { path: { spaceId, cubeId, mappingId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data)\n throw krovaErrorFrom(response, { error: \"Domain records response was empty.\" });\n return data;\n },\n\n /** Update a domain's per-domain proxy settings. */\n update: async (\n spaceId: string,\n cubeId: string,\n mappingId: string,\n body: UpdateDomainInput,\n ): Promise<Domain> => {\n const { data, error, response } = await this.raw.PATCH(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}\",\n { params: { path: { spaceId, cubeId, mappingId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.domain)\n throw krovaErrorFrom(response, { error: \"Update domain response had no `domain`.\" });\n return data.domain;\n },\n\n /** Detach a custom domain from a Cube. */\n delete: async (spaceId: string, cubeId: string, mappingId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}\",\n { params: { path: { spaceId, cubeId, mappingId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Snapshots\n // ---------------------------------------------------------------------------\n\n readonly snapshots = {\n /** List a Cube's snapshots. */\n list: async (spaceId: string, cubeId: string): Promise<Snapshot[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/snapshots\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.snapshots ?? [];\n },\n\n /** Create a snapshot of a Cube's disk (asynchronous — enqueued). */\n create: async (\n spaceId: string,\n cubeId: string,\n body?: { name?: string },\n ): Promise<Snapshot> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/snapshots\",\n { params: { path: { spaceId, cubeId } }, body: body ?? {} },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.snapshot)\n throw krovaErrorFrom(response, { error: \"Create snapshot response had no `snapshot`.\" });\n return data.snapshot;\n },\n\n /** Delete a snapshot. */\n delete: async (spaceId: string, cubeId: string, snapshotId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}/snapshots/{snapshotId}\",\n { params: { path: { spaceId, cubeId, snapshotId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // TCP port mappings\n // ---------------------------------------------------------------------------\n\n readonly tcpMappings = {\n /** List a Cube's TCP port mappings. */\n list: async (spaceId: string, cubeId: string): Promise<TcpMapping[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings\",\n { params: { path: { spaceId, cubeId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.tcpMappings ?? [];\n },\n\n /**\n * Create a TCP port mapping exposing a Cube port on the host. `cubePort` is\n * required; `whitelistedIps` optionally restricts who can reach it.\n *\n * ⛔ Send `whitelistedIps`, not `whitelistIps`. The published spec named\n * the field `whitelistIps` while the server has always read\n * `whitelistedIps`, so every allow-listed mapping created through this SDK\n * was silently published WORLD-OPEN, with a 201 and no error (reproduced\n * on production 2026-09-02). The server now accepts both, so an older\n * client keeps working, but `whitelistIps` is deprecated.\n *\n * **Omitting the allow-list leaves the port open to the internet.** That is\n * the documented behaviour, not an oversight — but it means a typo in the\n * field name fails OPEN, which is exactly how the original defect survived.\n *\n * `udpEnabled` optionally forwards UDP traffic on the same host port\n * alongside TCP. It is optional and the server defaults it to `true` when\n * omitted — so leave it unset to get UDP forwarding, and pass `false`\n * only to explicitly disable it.\n */\n create: async (\n spaceId: string,\n cubeId: string,\n body: CreateTcpMappingInput,\n ): Promise<TcpMapping> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings\",\n { params: { path: { spaceId, cubeId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.tcpMapping)\n throw krovaErrorFrom(response, { error: \"Create TCP mapping response had no `tcpMapping`.\" });\n return data.tcpMapping;\n },\n\n /** Delete a TCP port mapping. */\n delete: async (spaceId: string, cubeId: string, mappingId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings/{mappingId}\",\n { params: { path: { spaceId, cubeId, mappingId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Imports & backups (.cube archive import / export)\n // ---------------------------------------------------------------------------\n\n readonly imports = {\n /**\n * Start importing a `.cube` archive into a new Cube. Returns the multipart\n * upload target (`importId`, `uploadId`, presigned `parts`, …). Upload the\n * archive to those URLs, then call {@link imports.complete}.\n */\n create: async (\n spaceId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes/imports\"][\"post\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) => {\n const { data, error, response } = await this.raw.POST(\"/spaces/{spaceId}/cubes/imports\", {\n params: { path: { spaceId } },\n body,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Get an in-progress or completed import by id. */\n get: async (spaceId: string, importId: string) => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/cubes/imports/{importId}\",\n { params: { path: { spaceId, importId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /**\n * Finish an import after the archive has been uploaded — provisions the\n * Cube. Pass the uploaded `parts` (partNumber + etag) and the resolved\n * `config`.\n */\n complete: async (\n spaceId: string,\n importId: string,\n body: NonNullable<\n paths[\"/spaces/{spaceId}/cubes/imports/{importId}/complete\"][\"post\"][\"requestBody\"]\n >[\"content\"][\"application/json\"],\n ) => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/imports/{importId}/complete\",\n { params: { path: { spaceId, importId } }, body },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n\n /** Cancel an in-progress import. */\n cancel: async (spaceId: string, importId: string) => {\n const { data, error, response } = await this.raw.DELETE(\n \"/spaces/{spaceId}/cubes/imports/{importId}\",\n { params: { path: { spaceId, importId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n readonly backups = {\n /** Get a time-limited download URL for a backup `.cube` archive. */\n download: async (spaceId: string, backupId: string) => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/backups/{backupId}/download\",\n { params: { path: { spaceId, backupId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Public catalog (no auth required by the API, but the key is harmless)\n // ---------------------------------------------------------------------------\n\n readonly catalog = {\n /** List regions with available capacity. */\n regions: async () => {\n const { data, error, response } = await this.raw.GET(\"/regions\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Regions response was empty.\" });\n return data;\n },\n\n /** List available OS images. */\n images: async () => {\n const { data, error, response } = await this.raw.GET(\"/images\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Images response was empty.\" });\n return data;\n },\n\n /** Per-resource hourly rates and volume pricing tiers. */\n pricing: async () => {\n const { data, error, response } = await this.raw.GET(\"/pricing\");\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Pricing response was empty.\" });\n return data;\n },\n };\n}\n"],"mappings":";;;;;;;;;;AAkBA,IAAa,aAAb,MAAa,mBAAmB,MAAM;;CAEpC;;;;;;CAOA;;;;;CAMA;;CAGA;;CAGA;CAEA,YACE,SACA,MAOA;EACA,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,SAAS,KAAK;EACnB,KAAK,OAAO,KAAK;EACjB,KAAK,YAAY,KAAK;EACtB,KAAK,OAAO,KAAK;EACjB,KAAK,WAAW,KAAK;EAErB,O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AU;GAC/D,IAAI,UAAU,KAAA,KAAa,CAAC,SAAS,IAAI,MAAM,eAAe,UAAU,KAAK;GAC7E,IAAI,SAAS,KAAA,GACX,MAAM,eAAe,UAAU,EAAE,OAAO,8BAA8B,CAAC;GACzE,OAAO;EACT;CACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krovacloud/sdk",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Official TypeScript SDK for Krova Cloud — a typed client for provisioning and managing Cubes (Firecracker microVMs) with dedicated resources.",
5
5
  "license": "MIT",
6
6
  "type": "module",