@krovacloud/sdk 0.5.3 → 0.5.4
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/CHANGELOG.md +4 -0
- package/README.md +3 -1
- package/dist/{client-DWShmqpe.d.cts → client-dhEm38P2.d.cts} +9 -5
- package/dist/{client-DWShmqpe.d.ts → client-dhEm38P2.d.ts} +9 -5
- package/dist/index.cjs +29 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +29 -1
- package/dist/index.js.map +1 -1
- package/dist/ssh.d.cts +1 -1
- package/dist/ssh.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,8 @@ All notable changes to `@krovacloud/sdk` are documented here. This project adher
|
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
+
- `baseUrl` on `new KrovaClient()` is optional and now falls back to the `KROVA_BASE_URL` environment variable (where `process.env` exists; browsers and edge runtimes just use the default), then to `https://krova.cloud/api/v1`. An empty or whitespace value counts as unset, trailing slashes are removed, and a bare origin such as `https://krova.cloud` gets `/api/v1` appended; any other path is kept as given. `client.baseUrl` shows the resolved value.
|
|
13
|
+
|
|
12
14
|
- `cubes.setIdleTimeout(spaceId, cubeId, minutes | null)`, `idleTimeoutMinutes?: number | null` on the `cubes.create()` body, and `idleTimeoutMinutes` and `lastActiveAt` on `Cube`: Krova powers a Cube off after that many minutes without activity (10 to 10080, or `null` for off). These need a server with the idle-timeout feature, which krova-cloud has not deployed yet: `setIdleTimeout` gets a `400` from an older server, `create` is silently ignored there, and both `Cube` fields are absent. The OpenAPI snapshot and generated types include them, and `packages/sdk/openapi-pending.json` lists them so the drift check stays green until the deploy.
|
|
13
15
|
|
|
14
16
|
- `cubes.rename(spaceId, cubeId, name)` and `cubes.resize(spaceId, cubeId, { vcpu?, ramGb?, diskGb? }, opts?)`, with the exported types `ResizeCubeInput` and `ResizeCubeResult`. `resize` resolves to `{ success, state: "queued", jobId, isLive, requiresRestart, previous, requested }`; the Cube keeps its size until the worker applies the change. `getSpace()` now returns `apiKey: { name, expiresAt } | null` (`expiresAt` is `null` for a key that never expires; `apiKey` is `null` for an OAuth token and absent on an older server). The OpenAPI snapshot and generated types include these API changes, which krova-cloud has not deployed yet: until it does, `packages/sdk/openapi-pending.json` lists them so the drift check stays green.
|
|
@@ -25,6 +27,8 @@ All notable changes to `@krovacloud/sdk` are documented here. This project adher
|
|
|
25
27
|
|
|
26
28
|
### Changed
|
|
27
29
|
|
|
30
|
+
- `Cube.idleTimeoutMinutes` and `Cube.lastActiveAt` are now always present (`number | null` and `string | null`), because krova-cloud has deployed the idle-timeout feature. The OpenAPI snapshot and generated types match the live API again.
|
|
31
|
+
|
|
28
32
|
- The README no longer says HTTPS to the Cube is verified before it applies: the
|
|
29
33
|
API now applies it as saved.
|
|
30
34
|
|
package/README.md
CHANGED
|
@@ -91,7 +91,7 @@ Every public export, with its real signature and a short example.
|
|
|
91
91
|
```ts
|
|
92
92
|
new KrovaClient({
|
|
93
93
|
apiKey: string, // required — your "kro_..." token
|
|
94
|
-
baseUrl?: string, // default: "https://krova.cloud/api/v1"
|
|
94
|
+
baseUrl?: string, // optional; default: $KROVA_BASE_URL, else "https://krova.cloud/api/v1"
|
|
95
95
|
authScheme?: "x-api-key" | "bearer", // default: "x-api-key"
|
|
96
96
|
maxRetries?: number, // default: 2 — retries 429/503 (honors Retry-After); 0 disables
|
|
97
97
|
fetch?: typeof fetch, // optional fetch override (proxy, tests)
|
|
@@ -416,6 +416,8 @@ try {
|
|
|
416
416
|
|
|
417
417
|
## Configuration
|
|
418
418
|
|
|
419
|
+
`baseUrl` is optional. Without it the client uses the `KROVA_BASE_URL` environment variable when set, then `https://krova.cloud/api/v1`. An empty value counts as unset, trailing slashes are removed, and a bare origin such as `https://krova.cloud` gets `/api/v1` added.
|
|
420
|
+
|
|
419
421
|
Point the client at a different base URL (self-hosted gateway, staging, a proxy):
|
|
420
422
|
|
|
421
423
|
```ts
|
|
@@ -2455,13 +2455,13 @@ interface components {
|
|
|
2455
2455
|
createdAt: string;
|
|
2456
2456
|
id: string;
|
|
2457
2457
|
/** @description Minutes without activity after which Krova powers the Cube off. Null (the default) turns this off. A Cube counts as idle when no web terminal or SSH session is open and its CPU stays under 5% busy with a 5-minute load average under 0.1. Termination protection does not stop this power-off. */
|
|
2458
|
-
idleTimeoutMinutes
|
|
2458
|
+
idleTimeoutMinutes: number | null;
|
|
2459
2459
|
image: string;
|
|
2460
2460
|
/**
|
|
2461
2461
|
* Format: date-time
|
|
2462
2462
|
* @description ISO8601 timestamp of the last time Krova saw the Cube active (a web terminal or SSH session open, or CPU at or above 5% busy, or a 5-minute load average at or above 0.1). Null until the idle check has recorded one.
|
|
2463
2463
|
*/
|
|
2464
|
-
lastActiveAt
|
|
2464
|
+
lastActiveAt: string | null;
|
|
2465
2465
|
name: string;
|
|
2466
2466
|
publicIpv4: string | null;
|
|
2467
2467
|
resources: {
|
|
@@ -2861,7 +2861,11 @@ interface KrovaClientOptions {
|
|
|
2861
2861
|
* and inherit the permissions of the membership that created them.
|
|
2862
2862
|
*/
|
|
2863
2863
|
apiKey: string;
|
|
2864
|
-
/**
|
|
2864
|
+
/**
|
|
2865
|
+
* Override the API base URL. Optional. When omitted, the `KROVA_BASE_URL`
|
|
2866
|
+
* environment variable is used if set, else {@link DEFAULT_BASE_URL}. Accepts a
|
|
2867
|
+
* full API URL (`https://krova.cloud/api/v1`) or a bare origin (`/api/v1` is added).
|
|
2868
|
+
*/
|
|
2865
2869
|
baseUrl?: string;
|
|
2866
2870
|
/**
|
|
2867
2871
|
* Auth header scheme. Defaults to `"x-api-key"` (the spec's scheme).
|
|
@@ -2911,9 +2915,9 @@ declare class KrovaClient {
|
|
|
2911
2915
|
costPerHour: number;
|
|
2912
2916
|
createdAt: string;
|
|
2913
2917
|
id: string;
|
|
2914
|
-
idleTimeoutMinutes
|
|
2918
|
+
idleTimeoutMinutes: number | null;
|
|
2915
2919
|
image: string;
|
|
2916
|
-
lastActiveAt
|
|
2920
|
+
lastActiveAt: string | null;
|
|
2917
2921
|
name: string;
|
|
2918
2922
|
publicIpv4: string | null;
|
|
2919
2923
|
resources: {
|
|
@@ -2455,13 +2455,13 @@ interface components {
|
|
|
2455
2455
|
createdAt: string;
|
|
2456
2456
|
id: string;
|
|
2457
2457
|
/** @description Minutes without activity after which Krova powers the Cube off. Null (the default) turns this off. A Cube counts as idle when no web terminal or SSH session is open and its CPU stays under 5% busy with a 5-minute load average under 0.1. Termination protection does not stop this power-off. */
|
|
2458
|
-
idleTimeoutMinutes
|
|
2458
|
+
idleTimeoutMinutes: number | null;
|
|
2459
2459
|
image: string;
|
|
2460
2460
|
/**
|
|
2461
2461
|
* Format: date-time
|
|
2462
2462
|
* @description ISO8601 timestamp of the last time Krova saw the Cube active (a web terminal or SSH session open, or CPU at or above 5% busy, or a 5-minute load average at or above 0.1). Null until the idle check has recorded one.
|
|
2463
2463
|
*/
|
|
2464
|
-
lastActiveAt
|
|
2464
|
+
lastActiveAt: string | null;
|
|
2465
2465
|
name: string;
|
|
2466
2466
|
publicIpv4: string | null;
|
|
2467
2467
|
resources: {
|
|
@@ -2861,7 +2861,11 @@ interface KrovaClientOptions {
|
|
|
2861
2861
|
* and inherit the permissions of the membership that created them.
|
|
2862
2862
|
*/
|
|
2863
2863
|
apiKey: string;
|
|
2864
|
-
/**
|
|
2864
|
+
/**
|
|
2865
|
+
* Override the API base URL. Optional. When omitted, the `KROVA_BASE_URL`
|
|
2866
|
+
* environment variable is used if set, else {@link DEFAULT_BASE_URL}. Accepts a
|
|
2867
|
+
* full API URL (`https://krova.cloud/api/v1`) or a bare origin (`/api/v1` is added).
|
|
2868
|
+
*/
|
|
2865
2869
|
baseUrl?: string;
|
|
2866
2870
|
/**
|
|
2867
2871
|
* Auth header scheme. Defaults to `"x-api-key"` (the spec's scheme).
|
|
@@ -2911,9 +2915,9 @@ declare class KrovaClient {
|
|
|
2911
2915
|
costPerHour: number;
|
|
2912
2916
|
createdAt: string;
|
|
2913
2917
|
id: string;
|
|
2914
|
-
idleTimeoutMinutes
|
|
2918
|
+
idleTimeoutMinutes: number | null;
|
|
2915
2919
|
image: string;
|
|
2916
|
-
lastActiveAt
|
|
2920
|
+
lastActiveAt: string | null;
|
|
2917
2921
|
name: string;
|
|
2918
2922
|
publicIpv4: string | null;
|
|
2919
2923
|
resources: {
|
package/dist/index.cjs
CHANGED
|
@@ -137,6 +137,34 @@ function terminationProtectedFrom(response, cubeId, body) {
|
|
|
137
137
|
// src/client.ts
|
|
138
138
|
/** Default API base URL — the single `servers[0].url` from the OpenAPI spec. */
|
|
139
139
|
const DEFAULT_BASE_URL = "https://krova.cloud/api/v1";
|
|
140
|
+
/** Path appended to a bare origin such as `https://krova.cloud`. */
|
|
141
|
+
const API_PATH = "/api/v1";
|
|
142
|
+
/** `KROVA_BASE_URL` when this runtime has `process.env`; never throws (browsers, edge runtimes, Deno without env access). */
|
|
143
|
+
function readEnvBaseUrl() {
|
|
144
|
+
try {
|
|
145
|
+
if (typeof process !== "undefined" && process.env) return process.env.KROVA_BASE_URL;
|
|
146
|
+
} catch {}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Work out the API base URL. Order: the `baseUrl` option, then the
|
|
150
|
+
* `KROVA_BASE_URL` environment variable (where `process.env` exists), then
|
|
151
|
+
* {@link DEFAULT_BASE_URL}. An empty or whitespace-only value counts as unset.
|
|
152
|
+
* Trailing slashes are removed. A bare origin (`https://krova.cloud`) gets
|
|
153
|
+
* `/api/v1` appended; any other path is kept as given.
|
|
154
|
+
*/
|
|
155
|
+
function resolveBaseUrl(explicit) {
|
|
156
|
+
const raw = [explicit, readEnvBaseUrl()].find((v) => typeof v === "string" && v.trim() !== "");
|
|
157
|
+
if (raw === void 0) return DEFAULT_BASE_URL;
|
|
158
|
+
const trimmed = raw.trim().replace(/\/+$/, "");
|
|
159
|
+
let url;
|
|
160
|
+
try {
|
|
161
|
+
url = new URL(trimmed);
|
|
162
|
+
} catch {
|
|
163
|
+
return trimmed;
|
|
164
|
+
}
|
|
165
|
+
if (url.pathname === "/" && !url.search && !url.hash) return `${trimmed}${API_PATH}`;
|
|
166
|
+
return trimmed;
|
|
167
|
+
}
|
|
140
168
|
/** Statuses the retry middleware treats as transient. */
|
|
141
169
|
const RETRYABLE_STATUSES = /* @__PURE__ */ new Set([429, 503]);
|
|
142
170
|
/** Fallback backoff (ms) when the server sends no `Retry-After` header. */
|
|
@@ -227,7 +255,7 @@ var KrovaClient = class {
|
|
|
227
255
|
baseUrl;
|
|
228
256
|
constructor(options) {
|
|
229
257
|
if (!options?.apiKey) throw new Error("KrovaClient: `apiKey` is required.");
|
|
230
|
-
this.baseUrl = options.baseUrl
|
|
258
|
+
this.baseUrl = resolveBaseUrl(options.baseUrl);
|
|
231
259
|
const doFetch = options.fetch ?? globalThis.fetch;
|
|
232
260
|
const maxRetries = options.maxRetries ?? 2;
|
|
233
261
|
this.raw = (0, openapi_fetch.default)({
|
package/dist/index.cjs.map
CHANGED
|
@@ -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 * The richer 409 body shape the v1 API returns for a termination-protected\n * Cube. The base {@link KrovaErrorBody} only carries `error: string` because\n * the documented `Error` schema is flat; the DELETE handler returns this\n * nested form for `error.code = \"termination_protected\"`. The {@link KrovaError}\n * `body` slot stays a `KrovaErrorBody` for backwards compatibility — the\n * dedicated error class below carries the parsed cube fields instead.\n */\nexport interface TerminationProtectedErrorBody {\n error?: {\n code?: string;\n message?: string;\n cube?: {\n id?: string;\n terminationProtectionChangedAt?: string | null;\n terminationProtectionChangedBy?: string | null;\n };\n };\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 *\n * `body` is `unknown` rather than {@link KrovaErrorBody} because not every\n * documented error response is the flat `{ error: string }` shape — DELETE\n * /cubes/{cubeId} publishes a 409 whose `error` is an object. This function\n * already coped with that at runtime; typing the parameter narrowly only meant\n * the call sites had to lie. Widening accepts strictly more, so no caller\n * breaks.\n *\n * `body` is carried onto the error only when it really is the flat shape, so\n * {@link KrovaError.body} never advertises a `string` that is not there. A\n * caller that needs the raw payload of some other shape has `response`.\n */\nexport function krovaErrorFrom(response: Response, body: unknown): KrovaError {\n const flat =\n typeof body === \"object\" && body !== null && typeof (body as KrovaErrorBody).error === \"string\"\n ? (body as KrovaErrorBody)\n : undefined;\n const message =\n flat?.error || response.statusText || `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: flat,\n response,\n });\n}\n\n/**\n * Thrown by `client.cubes.delete` when the server rejects a delete with\n * `409` and `error.code = \"termination_protected\"`.\n *\n * The customer-facing contract is: a Cube with `terminationProtection = true`\n * cannot be deleted until the flag is turned off. The CLI and MCP surface the\n * server's message verbatim, so callers can switch on `code` rather than\n * parsing prose. `cubeId` / `changedAt` / `changedBy` are best-effort — a\n * defensive server (or an older control plane) may omit the `cube` block, in\n * which case the SDK falls back to the id the call was made with and leaves\n * the two timestamps `null`.\n */\nexport class TerminationProtectedError extends KrovaError {\n /** The id of the Cube the customer tried to delete. */\n readonly cubeId: string;\n\n /**\n * When the flag was last changed (`terminationProtectionChangedAt` on the\n * Cube row). `null` when the server's 409 body omitted it.\n */\n readonly changedAt: string | null;\n\n /**\n * Who last changed the flag (`terminationProtectionChangedBy` on the Cube\n * row — typically `\"user:<id>\"`). `null` when the server's 409 body omitted\n * it.\n */\n readonly changedBy: string | null;\n\n constructor(\n message: string,\n init: {\n status: number;\n code: string;\n requestId?: string;\n body?: KrovaErrorBody;\n response?: Response;\n cubeId: string;\n changedAt: string | null;\n changedBy: string | null;\n },\n ) {\n super(message, {\n status: init.status,\n code: init.code,\n ...(init.requestId ? { requestId: init.requestId } : {}),\n ...(init.body ? { body: init.body } : {}),\n ...(init.response ? { response: init.response } : {}),\n });\n this.name = \"TerminationProtectedError\";\n this.cubeId = init.cubeId;\n this.changedAt = init.changedAt;\n this.changedBy = init.changedBy;\n Object.setPrototypeOf(this, TerminationProtectedError.prototype);\n }\n}\n\n/**\n * Try to interpret a failing DELETE response as the v1 API's\n * termination-protected 409. Returns a {@link TerminationProtectedError} when\n * the body shape matches, `null` otherwise (the caller then falls back to a\n * plain {@link KrovaError}).\n *\n * The 409 body is published as `{ error: { code, message, cube: { … } } }`,\n * but the bundled OpenAPI spec only declares `{ error: string }` for the\n * generic `Error` schema — so the cast is best-effort and we tolerate\n * missing optional fields.\n */\nexport function terminationProtectedFrom(\n response: Response,\n cubeId: string,\n body: unknown,\n): TerminationProtectedError | null {\n if (response.status !== 409 || body === null || typeof body !== \"object\") return null;\n const errBlock = (body as TerminationProtectedErrorBody).error;\n if (!errBlock || typeof errBlock !== \"object\") return null;\n if (errBlock.code !== \"termination_protected\") return null;\n const cubeBlock = errBlock.cube;\n const message =\n (typeof errBlock.message === \"string\" && errBlock.message) ||\n `Cube ${cubeId} has termination protection on. Turn it off before deleting.`;\n return new TerminationProtectedError(message, {\n status: 409,\n code: \"termination_protected\",\n requestId: response.headers.get(\"x-request-id\") ?? undefined,\n body: { error: message },\n response,\n cubeId: typeof cubeBlock?.id === \"string\" ? cubeBlock.id : cubeId,\n changedAt:\n typeof cubeBlock?.terminationProtectionChangedAt === \"string\"\n ? cubeBlock.terminationProtectionChangedAt\n : null,\n changedBy:\n typeof cubeBlock?.terminationProtectionChangedBy === \"string\"\n ? cubeBlock.terminationProtectionChangedBy\n : null,\n });\n}\n","import createClient, { type Client, type Middleware } from \"openapi-fetch\";\nimport { krovaErrorFrom, terminationProtectedFrom } 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/**\n * A backup: a Cube's disk and configuration, kept after the Cube is gone and\n * redeployable as a new Cube. `sharedFromBackupId` is set on a copy another\n * space shared with this one.\n */\nexport type Backup = components[\"schemas\"][\"Backup\"];\n\n/**\n * A request to give another space its own copy of a backup.\n *\n * `counterpartySpaceName` is the other side: the destination on an outgoing\n * share, the source on an incoming one. `copyBackupId` is set once accepted.\n */\nexport type BackupShare = components[\"schemas\"][\"BackupShare\"];\n\n/** Pending, unexpired backup shares into and out of a space. */\nexport interface BackupShareList {\n incoming: BackupShare[];\n outgoing: BackupShare[];\n}\n\n/** An accepted share, and the destination space's new copy. */\nexport interface AcceptedBackupShare {\n share: BackupShare;\n backup: Backup;\n}\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/**\n * Request body for `POST /spaces/{spaceId}/cubes` as defined in the OpenAPI\n * spec, with `terminationProtection` intersected on because the bundled spec\n * does not declare the field but the v1 API accepts it. A boolean `false` (or\n * omission) leaves the Cube in the documented default-unprotected state; `true`\n * opts the Cube out of customer-initiated deletion until the flag is toggled\n * back via `cubes.setTerminationProtection`.\n */\nexport type CreateCubeInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"] & {\n /** Opt this Cube out of customer-initiated deletion (default `false`). */\n terminationProtection?: boolean;\n};\n\n/**\n * Request body for `PATCH /spaces/{spaceId}/cubes/{cubeId}` — the v1 API\n * endpoint the SDK uses to toggle termination protection on an existing Cube.\n * The bundled OpenAPI spec does not declare a PATCH on this path yet, so the\n * type is structurally derived from the {@link Cube} fields the API echoes\n * back. Only `terminationProtection` is exposed by `setTerminationProtection`;\n * future toggles can extend this without breaking the public signature.\n */\nexport type SetTerminationProtectionInput = {\n terminationProtection: boolean;\n};\n\n/**\n * The dimensions to change in a Cube resize, in the units `POST /cubes` takes:\n * `vcpu` and `diskGb` are integers, `ramGb` may be fractional (`0.5`). Send only\n * what changes; omitted dimensions keep their current value. Disk can only grow.\n */\nexport type ResizeCubeInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/resize\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"][\"resources\"];\n\n/**\n * The 200 response of `POST /spaces/{spaceId}/cubes/{cubeId}/resize`.\n *\n * `state` is always `\"queued\"`: the Cube keeps its size until the worker\n * applies the change, so read the {@link Cube} again to see the new one.\n * `isLive` means no restart is needed; `requiresRestart` is its inverse, and the\n * worker power-cycles the Cube.\n */\nexport type ResizeCubeResult =\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/resize\"][\"post\"][\"responses\"][200][\"content\"][\"application/json\"];\n\n/**\n * A webhook endpoint subscribed to Space events.\n *\n * ⛔ Runtime discrepancy: the bundled OpenAPI spec does not declare\n * `description`, but `GET /spaces/{spaceId}/webhooks/{endpointId}` includes\n * it as `string | null`. The schema-derived type is extended here so callers\n * reading a single webhook see the field; it is optional so list responses\n * (which omit it) still typecheck.\n */\nexport type Webhook = components[\"schemas\"][\"Webhook\"] & {\n description?: string | null;\n};\n\n/** A recorded webhook delivery attempt (last 30 days of history). */\nexport type WebhookDelivery = components[\"schemas\"][\"WebhookDelivery\"];\n\n/**\n * Request body for creating a webhook endpoint.\n *\n * Derived from `paths[\"/spaces/{spaceId}/webhooks\"][\"post\"]` exactly like\n * {@link CreateDomainInput}; `description` is intersected on because the\n * bundled spec omits it but the runtime accepts it.\n */\nexport type CreateWebhookInput = NonNullable<\n paths[\"/spaces/{spaceId}/webhooks\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"] & {\n /** Optional human-readable label shown on the endpoint. */\n description?: string;\n};\n\n/** A webhook plus its signing secret. Returned ONLY by {@link KrovaClient.webhooks}.create. */\nexport type WebhookWithSecret = Webhook & { secret: string };\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> => 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 * Set `terminationProtection: true` to opt the Cube out of\n * customer-initiated deletion. The flag is per-Cube; power-off, wake,\n * restart, snapshot, and restore remain allowed regardless.\n *\n * @param spaceId Target Space id.\n * @param body Cube spec — `{ name, image, resources, sshPublicKey, terminationProtection?, ... }`.\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n create: async (\n spaceId: string,\n body: CreateCubeInput,\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 ? { header: { \"Idempotency-Key\": opts.idempotencyKey } } : {}),\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(\"/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. (Rename and resize have their own helpers: `cubes.rename` and `cubes.resize`.)\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 /**\n * Toggle a Cube's termination-protection flag.\n *\n * The v1 API exposes `PATCH /spaces/{spaceId}/cubes/{cubeId}` with body\n * `{ terminationProtection: boolean }`. The call is idempotent: passing the\n * current value is a no-op server-side (no audit row is written).\n *\n * Returns the updated {@link Cube}, including `terminationProtection`,\n * `terminationProtectionChangedAt`, and `terminationProtectionChangedBy`.\n */\n setTerminationProtection: async (\n spaceId: string,\n cubeId: string,\n enabled: boolean,\n ): Promise<Cube> => {\n const { data, error, response } = await this.raw.PATCH(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n body: { terminationProtection: enabled } as SetTerminationProtectionInput,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = (data as { cube?: Cube } | undefined)?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, {\n error: \"Set termination-protection response had no `cube`.\",\n });\n }\n return cube;\n },\n\n /**\n * Set a Cube's idle auto-stop timeout. Returns the updated {@link Cube}.\n *\n * `PATCH /spaces/{spaceId}/cubes/{cubeId}` with `{ idleTimeoutMinutes }`: an\n * integer from 10 to 10080 (7 days), or `null` to turn it off. Krova powers\n * the Cube off after that many minutes without activity. Needs the\n * `cube.manage` permission. Passing the current value is a no-op. A server\n * without the idle-timeout feature answers `400`.\n */\n setIdleTimeout: async (\n spaceId: string,\n cubeId: string,\n minutes: number | null,\n ): Promise<Cube> => {\n const { data, error, response } = await this.raw.PATCH(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n body: { idleTimeoutMinutes: minutes },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = (data as { cube?: Cube } | undefined)?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, { error: \"Set idle-timeout response had no `cube`.\" });\n }\n return cube;\n },\n\n /**\n * Rename a Cube. Returns the updated {@link Cube}.\n *\n * `PATCH /spaces/{spaceId}/cubes/{cubeId}` with `{ name }`. The name is\n * trimmed and must be 1 to 64 printable characters; it does not have to be\n * unique in the Space. Renaming to the current name is a no-op. Needs the\n * `cube.manage` permission. The hostname inside a running Cube changes on\n * its next cold restart.\n */\n rename: async (spaceId: string, cubeId: string, name: string): Promise<Cube> => {\n const { data, error, response } = await this.raw.PATCH(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n body: { name },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = (data as { cube?: Cube } | undefined)?.cube;\n if (!cube) throw krovaErrorFrom(response, { error: \"Rename Cube response had no `cube`.\" });\n return cube;\n },\n\n /**\n * Resize a Cube's vCPU, RAM and/or disk (asynchronous: the resize is\n * enqueued). Send only the dimensions to change.\n *\n * Resolves to a {@link ResizeCubeResult} that says whether the change is\n * applied live (`isLive`) or power-cycles the Cube (`requiresRestart`), and\n * echoes the `previous` and `requested` sizes. The Cube keeps its current\n * size until the worker applies the change. Disk can only grow. Throws a\n * {@link KrovaError} with status `400` for a value out of range, above the\n * plan limit, a disk shrink, no change, a Cube that is not `running` or\n * `stopped`, or a host without room, and `409` while a resize is already\n * queued or a transfer is in flight. Needs the `cube.manage` permission.\n *\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n resize: async (\n spaceId: string,\n cubeId: string,\n resources: ResizeCubeInput,\n opts?: { idempotencyKey?: string },\n ): Promise<ResizeCubeResult> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/resize\",\n {\n params: {\n path: { spaceId, cubeId },\n ...(opts?.idempotencyKey ? { header: { \"Idempotency-Key\": opts.idempotencyKey } } : {}),\n },\n body: { resources },\n },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Resize Cube response was empty.\" });\n return data;\n },\n\n /**\n * Delete a Cube (asynchronous — deletion is enqueued).\n *\n * Throws {@link TerminationProtectedError} when the server returns `409`\n * with `error.code = \"termination_protected\"` — the Cube had its\n * termination-protection flag set and must be unprotected first. Any other\n * non-2xx response surfaces as a plain {@link KrovaError}.\n */\n delete: async (spaceId: string, cubeId: string) => {\n const { data, error, response } = await this.raw.DELETE(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n });\n if (error !== undefined || !response.ok) {\n // Most errors are the flat `{ error: string }` schema; the\n // termination-protected 409 is published as `{ error: { code, message,\n // cube } }`. Try the richer shape first; fall through to a plain\n // KrovaError on anything else so callers see a typed error for every\n // failure mode.\n const tpe = terminationProtectedFrom(response, cubeId, error);\n if (tpe) throw tpe;\n throw krovaErrorFrom(response, error);\n }\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(\"/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) 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) 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, {\n error: \"Create TCP mapping response had no `tcpMapping`.\",\n });\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 // ⛔ Every backup call reads the Backups permissions (`backup.view` to\n // read, `backup.manage` for everything else), not the Cube ones. A key whose\n // member holds only Cube permissions gets a 403 here.\n\n readonly backups = {\n /** List the space's backups, newest first, including copies shared into it. */\n list: async (spaceId: string): Promise<Backup[]> => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/backups\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.backups ?? [];\n },\n\n /** Get one backup. */\n get: async (spaceId: string, backupId: string): Promise<Backup> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/backups/{backupId}\",\n { params: { path: { spaceId, backupId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.backup)\n throw krovaErrorFrom(response, { error: \"Get backup response had no `backup`.\" });\n return data.backup;\n },\n\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 * Offer a copy of a backup to another space. Returns the pending\n * {@link BackupShare}.\n *\n * Nothing is copied until the destination accepts: its owner, or a member\n * there with `backup.manage`, within 48 hours. The accepted copy is the\n * destination's own and is billed to it; this space's backup and bill are\n * unchanged. Through the API a share is always a request, even when your\n * user owns both spaces.\n *\n * A refusal at this step never says anything about the destination's\n * billing or verification; those are checked when it accepts.\n *\n * @param spaceId The space that holds the backup.\n * @param backupId The backup to share.\n * @param body `{ destinationSpaceId }`.\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n share: async (\n spaceId: string,\n backupId: string,\n body: { destinationSpaceId: string },\n opts?: { idempotencyKey?: string },\n ): Promise<BackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backups/{backupId}/shares\",\n {\n params: {\n path: { spaceId, backupId },\n ...(opts?.idempotencyKey ? { header: { \"Idempotency-Key\": opts.idempotencyKey } } : {}),\n },\n body,\n },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share)\n throw krovaErrorFrom(response, { error: \"Share backup response had no `share`.\" });\n return data.share;\n },\n };\n\n readonly backupShares = {\n /** Pending, unexpired shares into (`incoming`) and out of (`outgoing`) a space. */\n list: async (spaceId: string): Promise<BackupShareList> => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/backup-shares\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return { incoming: data?.incoming ?? [], outgoing: data?.outgoing ?? [] };\n },\n\n /**\n * Accept a share offered to this space. Returns the share and the space's\n * new copy of the backup.\n *\n * The copy is billed to this space from now, so only a key of the space's\n * owner, or of a member holding `backup.manage`, may accept. A space that\n * cannot take the copy (no card or credit, owner not verified, an open abuse\n * notice, or no backup allowance left on its plan) is refused with a 422.\n */\n accept: async (spaceId: string, shareId: string): Promise<AcceptedBackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backup-shares/{shareId}/accept\",\n { params: { path: { spaceId, shareId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share || !data.backup)\n throw krovaErrorFrom(response, {\n error: \"Accept backup share response had no `share` or `backup`.\",\n });\n return { share: data.share, backup: data.backup };\n },\n\n /** Decline a share offered to this space. Same permission as {@link accept}. */\n decline: async (spaceId: string, shareId: string): Promise<BackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backup-shares/{shareId}/decline\",\n { params: { path: { spaceId, shareId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share)\n throw krovaErrorFrom(response, { error: \"Decline backup share response had no `share`.\" });\n return data.share;\n },\n\n /**\n * Withdraw a pending share this space offered. Allowed for a key of the\n * space's owner, of a member holding `backup.manage`, or of the member who\n * raised the request.\n */\n cancel: async (spaceId: string, shareId: string): Promise<BackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backup-shares/{shareId}/cancel\",\n { params: { path: { spaceId, shareId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share)\n throw krovaErrorFrom(response, { error: \"Cancel backup share response had no `share`.\" });\n return data.share;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Webhooks\n //\n // ⛔ The Krova Cloud API exposes no PATCH endpoint for webhooks, so this\n // group deliberately has no `update` or `rotateSecret` helper. To change a\n // webhook's URL, events, or signing secret, delete it and create a new\n // endpoint. The signing secret is returned ONCE — losing it means every\n // subsequent delivery will fail signature verification.\n // ---------------------------------------------------------------------------\n\n readonly webhooks = {\n /** List webhook endpoints in a Space. */\n list: async (spaceId: string): Promise<Webhook[]> => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/webhooks\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n return (data as { webhooks?: Webhook[] } | undefined)?.webhooks ?? [];\n },\n\n /** Get a single webhook endpoint by id. Does NOT include the signing secret. */\n get: async (spaceId: string, endpointId: string): Promise<Webhook> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/webhooks/{endpointId}\",\n { params: { path: { spaceId, endpointId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n const body = data as { webhook?: Webhook } | undefined;\n if (!body?.webhook)\n throw krovaErrorFrom(response, { error: \"Get webhook response had no `webhook`.\" });\n return body.webhook;\n },\n\n /**\n * Create a webhook endpoint. Returns the endpoint AND its signing secret.\n *\n * ⛔ The signing secret is shown ONLY at creation. Persist it immediately;\n * you cannot retrieve it later — `webhooks.get` deliberately omits it.\n * Losing the secret means every subsequent delivery will fail signature\n * verification, and you will have to delete the endpoint and create a new\n * one. An automation that swallows this helper's return value will lose\n * the secret on the next request, so the response is checked here and\n * throws if the server omits either the webhook or the secret.\n *\n * @param spaceId Target Space id.\n * @param body Webhook spec — `{ url, events, description? }`.\n */\n create: async (spaceId: string, body: CreateWebhookInput): Promise<WebhookWithSecret> => {\n const { data, error, response } = await this.raw.POST(\"/spaces/{spaceId}/webhooks\", {\n params: { path: { spaceId } },\n body,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n const payload = data as { webhook?: WebhookWithSecret } | undefined;\n if (!payload?.webhook)\n throw krovaErrorFrom(response, { error: \"Create webhook response had no `webhook`.\" });\n if (!payload.webhook.secret)\n throw krovaErrorFrom(response, {\n error:\n \"Create webhook response had no `secret` — capture it NOW; it is never returned again.\",\n });\n return payload.webhook;\n },\n\n /**\n * Delete a webhook endpoint (cascades delivery history).\n *\n * Resolves on any 2xx; the response body is intentionally not parsed\n * because the server returns `{ success: true }` but the caller does not\n * need it.\n */\n delete: async (spaceId: string, endpointId: string): Promise<void> => {\n const { error, response } = await this.raw.DELETE(\"/spaces/{spaceId}/webhooks/{endpointId}\", {\n params: { path: { spaceId, endpointId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n },\n\n /**\n * List recent deliveries for a webhook endpoint (last 30 days, max 100).\n *\n * @param spaceId Target Space id.\n * @param endpointId Webhook endpoint id.\n * @param opts Optional `limit` (1..100). Omit to let the server default to 50.\n */\n deliveries: async (\n spaceId: string,\n endpointId: string,\n opts?: { limit?: number },\n ): Promise<WebhookDelivery[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/webhooks/{endpointId}/deliveries\",\n {\n params: {\n path: { spaceId, endpointId },\n ...(opts?.limit !== undefined ? { query: { limit: opts.limit } } : {}),\n },\n },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n return (data as { deliveries?: WebhookDelivery[] } | undefined)?.deliveries ?? [];\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":";;;;;;;;;;;;;AAsCA,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;;;;;;;;;;;;;;;AAgBA,SAAgB,eAAe,UA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E,QAAQ;IACN,MAAM;KAAE;KAAS;IAAW;IAC5B,GAAI,MAAM,UAAU,KAAA,IAAY,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM,EAAE,IAAI,CAAC;GACtE,EACF,CACF;GACA,IAAI,UAAU,KAAA,KAAa,CAAC,SAAS,IAAI,MAAM,eAAe,UAAU,KAAK;GAG7E,OAAQ,MAAyD,cAAc,CAAC;EAClF;CACF;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 * The richer 409 body shape the v1 API returns for a termination-protected\n * Cube. The base {@link KrovaErrorBody} only carries `error: string` because\n * the documented `Error` schema is flat; the DELETE handler returns this\n * nested form for `error.code = \"termination_protected\"`. The {@link KrovaError}\n * `body` slot stays a `KrovaErrorBody` for backwards compatibility — the\n * dedicated error class below carries the parsed cube fields instead.\n */\nexport interface TerminationProtectedErrorBody {\n error?: {\n code?: string;\n message?: string;\n cube?: {\n id?: string;\n terminationProtectionChangedAt?: string | null;\n terminationProtectionChangedBy?: string | null;\n };\n };\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 *\n * `body` is `unknown` rather than {@link KrovaErrorBody} because not every\n * documented error response is the flat `{ error: string }` shape — DELETE\n * /cubes/{cubeId} publishes a 409 whose `error` is an object. This function\n * already coped with that at runtime; typing the parameter narrowly only meant\n * the call sites had to lie. Widening accepts strictly more, so no caller\n * breaks.\n *\n * `body` is carried onto the error only when it really is the flat shape, so\n * {@link KrovaError.body} never advertises a `string` that is not there. A\n * caller that needs the raw payload of some other shape has `response`.\n */\nexport function krovaErrorFrom(response: Response, body: unknown): KrovaError {\n const flat =\n typeof body === \"object\" && body !== null && typeof (body as KrovaErrorBody).error === \"string\"\n ? (body as KrovaErrorBody)\n : undefined;\n const message =\n flat?.error || response.statusText || `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: flat,\n response,\n });\n}\n\n/**\n * Thrown by `client.cubes.delete` when the server rejects a delete with\n * `409` and `error.code = \"termination_protected\"`.\n *\n * The customer-facing contract is: a Cube with `terminationProtection = true`\n * cannot be deleted until the flag is turned off. The CLI and MCP surface the\n * server's message verbatim, so callers can switch on `code` rather than\n * parsing prose. `cubeId` / `changedAt` / `changedBy` are best-effort — a\n * defensive server (or an older control plane) may omit the `cube` block, in\n * which case the SDK falls back to the id the call was made with and leaves\n * the two timestamps `null`.\n */\nexport class TerminationProtectedError extends KrovaError {\n /** The id of the Cube the customer tried to delete. */\n readonly cubeId: string;\n\n /**\n * When the flag was last changed (`terminationProtectionChangedAt` on the\n * Cube row). `null` when the server's 409 body omitted it.\n */\n readonly changedAt: string | null;\n\n /**\n * Who last changed the flag (`terminationProtectionChangedBy` on the Cube\n * row — typically `\"user:<id>\"`). `null` when the server's 409 body omitted\n * it.\n */\n readonly changedBy: string | null;\n\n constructor(\n message: string,\n init: {\n status: number;\n code: string;\n requestId?: string;\n body?: KrovaErrorBody;\n response?: Response;\n cubeId: string;\n changedAt: string | null;\n changedBy: string | null;\n },\n ) {\n super(message, {\n status: init.status,\n code: init.code,\n ...(init.requestId ? { requestId: init.requestId } : {}),\n ...(init.body ? { body: init.body } : {}),\n ...(init.response ? { response: init.response } : {}),\n });\n this.name = \"TerminationProtectedError\";\n this.cubeId = init.cubeId;\n this.changedAt = init.changedAt;\n this.changedBy = init.changedBy;\n Object.setPrototypeOf(this, TerminationProtectedError.prototype);\n }\n}\n\n/**\n * Try to interpret a failing DELETE response as the v1 API's\n * termination-protected 409. Returns a {@link TerminationProtectedError} when\n * the body shape matches, `null` otherwise (the caller then falls back to a\n * plain {@link KrovaError}).\n *\n * The 409 body is published as `{ error: { code, message, cube: { … } } }`,\n * but the bundled OpenAPI spec only declares `{ error: string }` for the\n * generic `Error` schema — so the cast is best-effort and we tolerate\n * missing optional fields.\n */\nexport function terminationProtectedFrom(\n response: Response,\n cubeId: string,\n body: unknown,\n): TerminationProtectedError | null {\n if (response.status !== 409 || body === null || typeof body !== \"object\") return null;\n const errBlock = (body as TerminationProtectedErrorBody).error;\n if (!errBlock || typeof errBlock !== \"object\") return null;\n if (errBlock.code !== \"termination_protected\") return null;\n const cubeBlock = errBlock.cube;\n const message =\n (typeof errBlock.message === \"string\" && errBlock.message) ||\n `Cube ${cubeId} has termination protection on. Turn it off before deleting.`;\n return new TerminationProtectedError(message, {\n status: 409,\n code: \"termination_protected\",\n requestId: response.headers.get(\"x-request-id\") ?? undefined,\n body: { error: message },\n response,\n cubeId: typeof cubeBlock?.id === \"string\" ? cubeBlock.id : cubeId,\n changedAt:\n typeof cubeBlock?.terminationProtectionChangedAt === \"string\"\n ? cubeBlock.terminationProtectionChangedAt\n : null,\n changedBy:\n typeof cubeBlock?.terminationProtectionChangedBy === \"string\"\n ? cubeBlock.terminationProtectionChangedBy\n : null,\n });\n}\n","import createClient, { type Client, type Middleware } from \"openapi-fetch\";\nimport { krovaErrorFrom, terminationProtectedFrom } 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/**\n * A backup: a Cube's disk and configuration, kept after the Cube is gone and\n * redeployable as a new Cube. `sharedFromBackupId` is set on a copy another\n * space shared with this one.\n */\nexport type Backup = components[\"schemas\"][\"Backup\"];\n\n/**\n * A request to give another space its own copy of a backup.\n *\n * `counterpartySpaceName` is the other side: the destination on an outgoing\n * share, the source on an incoming one. `copyBackupId` is set once accepted.\n */\nexport type BackupShare = components[\"schemas\"][\"BackupShare\"];\n\n/** Pending, unexpired backup shares into and out of a space. */\nexport interface BackupShareList {\n incoming: BackupShare[];\n outgoing: BackupShare[];\n}\n\n/** An accepted share, and the destination space's new copy. */\nexport interface AcceptedBackupShare {\n share: BackupShare;\n backup: Backup;\n}\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/**\n * Request body for `POST /spaces/{spaceId}/cubes` as defined in the OpenAPI\n * spec, with `terminationProtection` intersected on because the bundled spec\n * does not declare the field but the v1 API accepts it. A boolean `false` (or\n * omission) leaves the Cube in the documented default-unprotected state; `true`\n * opts the Cube out of customer-initiated deletion until the flag is toggled\n * back via `cubes.setTerminationProtection`.\n */\nexport type CreateCubeInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"] & {\n /** Opt this Cube out of customer-initiated deletion (default `false`). */\n terminationProtection?: boolean;\n};\n\n/**\n * Request body for `PATCH /spaces/{spaceId}/cubes/{cubeId}` — the v1 API\n * endpoint the SDK uses to toggle termination protection on an existing Cube.\n * The bundled OpenAPI spec does not declare a PATCH on this path yet, so the\n * type is structurally derived from the {@link Cube} fields the API echoes\n * back. Only `terminationProtection` is exposed by `setTerminationProtection`;\n * future toggles can extend this without breaking the public signature.\n */\nexport type SetTerminationProtectionInput = {\n terminationProtection: boolean;\n};\n\n/**\n * The dimensions to change in a Cube resize, in the units `POST /cubes` takes:\n * `vcpu` and `diskGb` are integers, `ramGb` may be fractional (`0.5`). Send only\n * what changes; omitted dimensions keep their current value. Disk can only grow.\n */\nexport type ResizeCubeInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/resize\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"][\"resources\"];\n\n/**\n * The 200 response of `POST /spaces/{spaceId}/cubes/{cubeId}/resize`.\n *\n * `state` is always `\"queued\"`: the Cube keeps its size until the worker\n * applies the change, so read the {@link Cube} again to see the new one.\n * `isLive` means no restart is needed; `requiresRestart` is its inverse, and the\n * worker power-cycles the Cube.\n */\nexport type ResizeCubeResult =\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/resize\"][\"post\"][\"responses\"][200][\"content\"][\"application/json\"];\n\n/**\n * A webhook endpoint subscribed to Space events.\n *\n * ⛔ Runtime discrepancy: the bundled OpenAPI spec does not declare\n * `description`, but `GET /spaces/{spaceId}/webhooks/{endpointId}` includes\n * it as `string | null`. The schema-derived type is extended here so callers\n * reading a single webhook see the field; it is optional so list responses\n * (which omit it) still typecheck.\n */\nexport type Webhook = components[\"schemas\"][\"Webhook\"] & {\n description?: string | null;\n};\n\n/** A recorded webhook delivery attempt (last 30 days of history). */\nexport type WebhookDelivery = components[\"schemas\"][\"WebhookDelivery\"];\n\n/**\n * Request body for creating a webhook endpoint.\n *\n * Derived from `paths[\"/spaces/{spaceId}/webhooks\"][\"post\"]` exactly like\n * {@link CreateDomainInput}; `description` is intersected on because the\n * bundled spec omits it but the runtime accepts it.\n */\nexport type CreateWebhookInput = NonNullable<\n paths[\"/spaces/{spaceId}/webhooks\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"] & {\n /** Optional human-readable label shown on the endpoint. */\n description?: string;\n};\n\n/** A webhook plus its signing secret. Returned ONLY by {@link KrovaClient.webhooks}.create. */\nexport type WebhookWithSecret = Webhook & { secret: string };\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/** Path appended to a bare origin such as `https://krova.cloud`. */\nconst API_PATH = \"/api/v1\";\n\n/** `KROVA_BASE_URL` when this runtime has `process.env`; never throws (browsers, edge runtimes, Deno without env access). */\nfunction readEnvBaseUrl(): string | undefined {\n try {\n if (typeof process !== \"undefined\" && process.env) return process.env.KROVA_BASE_URL;\n } catch {\n // Reading the env can throw where access is denied (for example Deno without --allow-env).\n }\n return undefined;\n}\n\n/**\n * Work out the API base URL. Order: the `baseUrl` option, then the\n * `KROVA_BASE_URL` environment variable (where `process.env` exists), then\n * {@link DEFAULT_BASE_URL}. An empty or whitespace-only value counts as unset.\n * Trailing slashes are removed. A bare origin (`https://krova.cloud`) gets\n * `/api/v1` appended; any other path is kept as given.\n */\nfunction resolveBaseUrl(explicit?: string): string {\n const raw = [explicit, readEnvBaseUrl()].find((v) => typeof v === \"string\" && v.trim() !== \"\");\n if (raw === undefined) return DEFAULT_BASE_URL;\n const trimmed = raw.trim().replace(/\\/+$/, \"\");\n let url: URL;\n try {\n url = new URL(trimmed);\n } catch {\n return trimmed;\n }\n if (url.pathname === \"/\" && !url.search && !url.hash) return `${trimmed}${API_PATH}`;\n return trimmed;\n}\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 /**\n * Override the API base URL. Optional. When omitted, the `KROVA_BASE_URL`\n * environment variable is used if set, else {@link DEFAULT_BASE_URL}. Accepts a\n * full API URL (`https://krova.cloud/api/v1`) or a bare origin (`/api/v1` is added).\n */\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> => 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 = resolveBaseUrl(options.baseUrl);\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 * Set `terminationProtection: true` to opt the Cube out of\n * customer-initiated deletion. The flag is per-Cube; power-off, wake,\n * restart, snapshot, and restore remain allowed regardless.\n *\n * @param spaceId Target Space id.\n * @param body Cube spec — `{ name, image, resources, sshPublicKey, terminationProtection?, ... }`.\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n create: async (\n spaceId: string,\n body: CreateCubeInput,\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 ? { header: { \"Idempotency-Key\": opts.idempotencyKey } } : {}),\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(\"/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. (Rename and resize have their own helpers: `cubes.rename` and `cubes.resize`.)\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 /**\n * Toggle a Cube's termination-protection flag.\n *\n * The v1 API exposes `PATCH /spaces/{spaceId}/cubes/{cubeId}` with body\n * `{ terminationProtection: boolean }`. The call is idempotent: passing the\n * current value is a no-op server-side (no audit row is written).\n *\n * Returns the updated {@link Cube}, including `terminationProtection`,\n * `terminationProtectionChangedAt`, and `terminationProtectionChangedBy`.\n */\n setTerminationProtection: async (\n spaceId: string,\n cubeId: string,\n enabled: boolean,\n ): Promise<Cube> => {\n const { data, error, response } = await this.raw.PATCH(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n body: { terminationProtection: enabled } as SetTerminationProtectionInput,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = (data as { cube?: Cube } | undefined)?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, {\n error: \"Set termination-protection response had no `cube`.\",\n });\n }\n return cube;\n },\n\n /**\n * Set a Cube's idle auto-stop timeout. Returns the updated {@link Cube}.\n *\n * `PATCH /spaces/{spaceId}/cubes/{cubeId}` with `{ idleTimeoutMinutes }`: an\n * integer from 10 to 10080 (7 days), or `null` to turn it off. Krova powers\n * the Cube off after that many minutes without activity. Needs the\n * `cube.manage` permission. Passing the current value is a no-op. A server\n * without the idle-timeout feature answers `400`.\n */\n setIdleTimeout: async (\n spaceId: string,\n cubeId: string,\n minutes: number | null,\n ): Promise<Cube> => {\n const { data, error, response } = await this.raw.PATCH(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n body: { idleTimeoutMinutes: minutes },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = (data as { cube?: Cube } | undefined)?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, { error: \"Set idle-timeout response had no `cube`.\" });\n }\n return cube;\n },\n\n /**\n * Rename a Cube. Returns the updated {@link Cube}.\n *\n * `PATCH /spaces/{spaceId}/cubes/{cubeId}` with `{ name }`. The name is\n * trimmed and must be 1 to 64 printable characters; it does not have to be\n * unique in the Space. Renaming to the current name is a no-op. Needs the\n * `cube.manage` permission. The hostname inside a running Cube changes on\n * its next cold restart.\n */\n rename: async (spaceId: string, cubeId: string, name: string): Promise<Cube> => {\n const { data, error, response } = await this.raw.PATCH(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n body: { name },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = (data as { cube?: Cube } | undefined)?.cube;\n if (!cube) throw krovaErrorFrom(response, { error: \"Rename Cube response had no `cube`.\" });\n return cube;\n },\n\n /**\n * Resize a Cube's vCPU, RAM and/or disk (asynchronous: the resize is\n * enqueued). Send only the dimensions to change.\n *\n * Resolves to a {@link ResizeCubeResult} that says whether the change is\n * applied live (`isLive`) or power-cycles the Cube (`requiresRestart`), and\n * echoes the `previous` and `requested` sizes. The Cube keeps its current\n * size until the worker applies the change. Disk can only grow. Throws a\n * {@link KrovaError} with status `400` for a value out of range, above the\n * plan limit, a disk shrink, no change, a Cube that is not `running` or\n * `stopped`, or a host without room, and `409` while a resize is already\n * queued or a transfer is in flight. Needs the `cube.manage` permission.\n *\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n resize: async (\n spaceId: string,\n cubeId: string,\n resources: ResizeCubeInput,\n opts?: { idempotencyKey?: string },\n ): Promise<ResizeCubeResult> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/resize\",\n {\n params: {\n path: { spaceId, cubeId },\n ...(opts?.idempotencyKey ? { header: { \"Idempotency-Key\": opts.idempotencyKey } } : {}),\n },\n body: { resources },\n },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Resize Cube response was empty.\" });\n return data;\n },\n\n /**\n * Delete a Cube (asynchronous — deletion is enqueued).\n *\n * Throws {@link TerminationProtectedError} when the server returns `409`\n * with `error.code = \"termination_protected\"` — the Cube had its\n * termination-protection flag set and must be unprotected first. Any other\n * non-2xx response surfaces as a plain {@link KrovaError}.\n */\n delete: async (spaceId: string, cubeId: string) => {\n const { data, error, response } = await this.raw.DELETE(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n });\n if (error !== undefined || !response.ok) {\n // Most errors are the flat `{ error: string }` schema; the\n // termination-protected 409 is published as `{ error: { code, message,\n // cube } }`. Try the richer shape first; fall through to a plain\n // KrovaError on anything else so callers see a typed error for every\n // failure mode.\n const tpe = terminationProtectedFrom(response, cubeId, error);\n if (tpe) throw tpe;\n throw krovaErrorFrom(response, error);\n }\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(\"/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) 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) 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, {\n error: \"Create TCP mapping response had no `tcpMapping`.\",\n });\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 // ⛔ Every backup call reads the Backups permissions (`backup.view` to\n // read, `backup.manage` for everything else), not the Cube ones. A key whose\n // member holds only Cube permissions gets a 403 here.\n\n readonly backups = {\n /** List the space's backups, newest first, including copies shared into it. */\n list: async (spaceId: string): Promise<Backup[]> => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/backups\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.backups ?? [];\n },\n\n /** Get one backup. */\n get: async (spaceId: string, backupId: string): Promise<Backup> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/backups/{backupId}\",\n { params: { path: { spaceId, backupId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.backup)\n throw krovaErrorFrom(response, { error: \"Get backup response had no `backup`.\" });\n return data.backup;\n },\n\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 * Offer a copy of a backup to another space. Returns the pending\n * {@link BackupShare}.\n *\n * Nothing is copied until the destination accepts: its owner, or a member\n * there with `backup.manage`, within 48 hours. The accepted copy is the\n * destination's own and is billed to it; this space's backup and bill are\n * unchanged. Through the API a share is always a request, even when your\n * user owns both spaces.\n *\n * A refusal at this step never says anything about the destination's\n * billing or verification; those are checked when it accepts.\n *\n * @param spaceId The space that holds the backup.\n * @param backupId The backup to share.\n * @param body `{ destinationSpaceId }`.\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n share: async (\n spaceId: string,\n backupId: string,\n body: { destinationSpaceId: string },\n opts?: { idempotencyKey?: string },\n ): Promise<BackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backups/{backupId}/shares\",\n {\n params: {\n path: { spaceId, backupId },\n ...(opts?.idempotencyKey ? { header: { \"Idempotency-Key\": opts.idempotencyKey } } : {}),\n },\n body,\n },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share)\n throw krovaErrorFrom(response, { error: \"Share backup response had no `share`.\" });\n return data.share;\n },\n };\n\n readonly backupShares = {\n /** Pending, unexpired shares into (`incoming`) and out of (`outgoing`) a space. */\n list: async (spaceId: string): Promise<BackupShareList> => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/backup-shares\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return { incoming: data?.incoming ?? [], outgoing: data?.outgoing ?? [] };\n },\n\n /**\n * Accept a share offered to this space. Returns the share and the space's\n * new copy of the backup.\n *\n * The copy is billed to this space from now, so only a key of the space's\n * owner, or of a member holding `backup.manage`, may accept. A space that\n * cannot take the copy (no card or credit, owner not verified, an open abuse\n * notice, or no backup allowance left on its plan) is refused with a 422.\n */\n accept: async (spaceId: string, shareId: string): Promise<AcceptedBackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backup-shares/{shareId}/accept\",\n { params: { path: { spaceId, shareId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share || !data.backup)\n throw krovaErrorFrom(response, {\n error: \"Accept backup share response had no `share` or `backup`.\",\n });\n return { share: data.share, backup: data.backup };\n },\n\n /** Decline a share offered to this space. Same permission as {@link accept}. */\n decline: async (spaceId: string, shareId: string): Promise<BackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backup-shares/{shareId}/decline\",\n { params: { path: { spaceId, shareId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share)\n throw krovaErrorFrom(response, { error: \"Decline backup share response had no `share`.\" });\n return data.share;\n },\n\n /**\n * Withdraw a pending share this space offered. Allowed for a key of the\n * space's owner, of a member holding `backup.manage`, or of the member who\n * raised the request.\n */\n cancel: async (spaceId: string, shareId: string): Promise<BackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backup-shares/{shareId}/cancel\",\n { params: { path: { spaceId, shareId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share)\n throw krovaErrorFrom(response, { error: \"Cancel backup share response had no `share`.\" });\n return data.share;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Webhooks\n //\n // ⛔ The Krova Cloud API exposes no PATCH endpoint for webhooks, so this\n // group deliberately has no `update` or `rotateSecret` helper. To change a\n // webhook's URL, events, or signing secret, delete it and create a new\n // endpoint. The signing secret is returned ONCE — losing it means every\n // subsequent delivery will fail signature verification.\n // ---------------------------------------------------------------------------\n\n readonly webhooks = {\n /** List webhook endpoints in a Space. */\n list: async (spaceId: string): Promise<Webhook[]> => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/webhooks\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n return (data as { webhooks?: Webhook[] } | undefined)?.webhooks ?? [];\n },\n\n /** Get a single webhook endpoint by id. Does NOT include the signing secret. */\n get: async (spaceId: string, endpointId: string): Promise<Webhook> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/webhooks/{endpointId}\",\n { params: { path: { spaceId, endpointId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n const body = data as { webhook?: Webhook } | undefined;\n if (!body?.webhook)\n throw krovaErrorFrom(response, { error: \"Get webhook response had no `webhook`.\" });\n return body.webhook;\n },\n\n /**\n * Create a webhook endpoint. Returns the endpoint AND its signing secret.\n *\n * ⛔ The signing secret is shown ONLY at creation. Persist it immediately;\n * you cannot retrieve it later — `webhooks.get` deliberately omits it.\n * Losing the secret means every subsequent delivery will fail signature\n * verification, and you will have to delete the endpoint and create a new\n * one. An automation that swallows this helper's return value will lose\n * the secret on the next request, so the response is checked here and\n * throws if the server omits either the webhook or the secret.\n *\n * @param spaceId Target Space id.\n * @param body Webhook spec — `{ url, events, description? }`.\n */\n create: async (spaceId: string, body: CreateWebhookInput): Promise<WebhookWithSecret> => {\n const { data, error, response } = await this.raw.POST(\"/spaces/{spaceId}/webhooks\", {\n params: { path: { spaceId } },\n body,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n const payload = data as { webhook?: WebhookWithSecret } | undefined;\n if (!payload?.webhook)\n throw krovaErrorFrom(response, { error: \"Create webhook response had no `webhook`.\" });\n if (!payload.webhook.secret)\n throw krovaErrorFrom(response, {\n error:\n \"Create webhook response had no `secret` — capture it NOW; it is never returned again.\",\n });\n return payload.webhook;\n },\n\n /**\n * Delete a webhook endpoint (cascades delivery history).\n *\n * Resolves on any 2xx; the response body is intentionally not parsed\n * because the server returns `{ success: true }` but the caller does not\n * need it.\n */\n delete: async (spaceId: string, endpointId: string): Promise<void> => {\n const { error, response } = await this.raw.DELETE(\"/spaces/{spaceId}/webhooks/{endpointId}\", {\n params: { path: { spaceId, endpointId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n },\n\n /**\n * List recent deliveries for a webhook endpoint (last 30 days, max 100).\n *\n * @param spaceId Target Space id.\n * @param endpointId Webhook endpoint id.\n * @param opts Optional `limit` (1..100). Omit to let the server default to 50.\n */\n deliveries: async (\n spaceId: string,\n endpointId: string,\n opts?: { limit?: number },\n ): Promise<WebhookDelivery[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/webhooks/{endpointId}/deliveries\",\n {\n params: {\n path: { spaceId, endpointId },\n ...(opts?.limit !== undefined ? { query: { limit: opts.limit } } : {}),\n },\n },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n return (data as { deliveries?: WebhookDelivery[] } | undefined)?.deliveries ?? [];\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":";;;;;;;;;;;;;AAsCA,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;;;;;;;;;;;;;;;AAgBA,SAAgB,eAAe,UAAoB,MAA2B;CAC5E,MAAM,OACJ,OAAO,SAAS,YAAY,SAAS,QAAQ,OAAQ,KAAwB,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,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
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* const cubes = await krova.cubes.list("space_123");
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
|
-
import { C as TcpMapping, E as paths, S as Space, T as components, _ as PricingTier, a as BackupShareList, b as ResizeCubeResult, c as CreateTcpMappingInput, d as DEFAULT_BASE_URL, f as Domain, g as Pagination, h as KrovaClientOptions, i as BackupShare, l as Cube, m as KrovaClient, n as AuthScheme, o as CreateCubeInput, p as Image, r as Backup, s as CreateDomainInput, t as AcceptedBackupShare, u as CubeSshInfo, v as Region, w as UpdateDomainInput, x as Snapshot, y as ResizeCubeInput } from "./client-
|
|
12
|
+
import { C as TcpMapping, E as paths, S as Space, T as components, _ as PricingTier, a as BackupShareList, b as ResizeCubeResult, c as CreateTcpMappingInput, d as DEFAULT_BASE_URL, f as Domain, g as Pagination, h as KrovaClientOptions, i as BackupShare, l as Cube, m as KrovaClient, n as AuthScheme, o as CreateCubeInput, p as Image, r as Backup, s as CreateDomainInput, t as AcceptedBackupShare, u as CubeSshInfo, v as Region, w as UpdateDomainInput, x as Snapshot, y as ResizeCubeInput } from "./client-dhEm38P2.cjs";
|
|
13
13
|
/**
|
|
14
14
|
* The error body shape returned by the Krova Cloud API.
|
|
15
15
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* const cubes = await krova.cubes.list("space_123");
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
|
-
import { C as TcpMapping, E as paths, S as Space, T as components, _ as PricingTier, a as BackupShareList, b as ResizeCubeResult, c as CreateTcpMappingInput, d as DEFAULT_BASE_URL, f as Domain, g as Pagination, h as KrovaClientOptions, i as BackupShare, l as Cube, m as KrovaClient, n as AuthScheme, o as CreateCubeInput, p as Image, r as Backup, s as CreateDomainInput, t as AcceptedBackupShare, u as CubeSshInfo, v as Region, w as UpdateDomainInput, x as Snapshot, y as ResizeCubeInput } from "./client-
|
|
12
|
+
import { C as TcpMapping, E as paths, S as Space, T as components, _ as PricingTier, a as BackupShareList, b as ResizeCubeResult, c as CreateTcpMappingInput, d as DEFAULT_BASE_URL, f as Domain, g as Pagination, h as KrovaClientOptions, i as BackupShare, l as Cube, m as KrovaClient, n as AuthScheme, o as CreateCubeInput, p as Image, r as Backup, s as CreateDomainInput, t as AcceptedBackupShare, u as CubeSshInfo, v as Region, w as UpdateDomainInput, x as Snapshot, y as ResizeCubeInput } from "./client-dhEm38P2.js";
|
|
13
13
|
/**
|
|
14
14
|
* The error body shape returned by the Krova Cloud API.
|
|
15
15
|
*
|
package/dist/index.js
CHANGED
|
@@ -134,6 +134,34 @@ function terminationProtectedFrom(response, cubeId, body) {
|
|
|
134
134
|
// src/client.ts
|
|
135
135
|
/** Default API base URL — the single `servers[0].url` from the OpenAPI spec. */
|
|
136
136
|
const DEFAULT_BASE_URL = "https://krova.cloud/api/v1";
|
|
137
|
+
/** Path appended to a bare origin such as `https://krova.cloud`. */
|
|
138
|
+
const API_PATH = "/api/v1";
|
|
139
|
+
/** `KROVA_BASE_URL` when this runtime has `process.env`; never throws (browsers, edge runtimes, Deno without env access). */
|
|
140
|
+
function readEnvBaseUrl() {
|
|
141
|
+
try {
|
|
142
|
+
if (typeof process !== "undefined" && process.env) return process.env.KROVA_BASE_URL;
|
|
143
|
+
} catch {}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Work out the API base URL. Order: the `baseUrl` option, then the
|
|
147
|
+
* `KROVA_BASE_URL` environment variable (where `process.env` exists), then
|
|
148
|
+
* {@link DEFAULT_BASE_URL}. An empty or whitespace-only value counts as unset.
|
|
149
|
+
* Trailing slashes are removed. A bare origin (`https://krova.cloud`) gets
|
|
150
|
+
* `/api/v1` appended; any other path is kept as given.
|
|
151
|
+
*/
|
|
152
|
+
function resolveBaseUrl(explicit) {
|
|
153
|
+
const raw = [explicit, readEnvBaseUrl()].find((v) => typeof v === "string" && v.trim() !== "");
|
|
154
|
+
if (raw === void 0) return DEFAULT_BASE_URL;
|
|
155
|
+
const trimmed = raw.trim().replace(/\/+$/, "");
|
|
156
|
+
let url;
|
|
157
|
+
try {
|
|
158
|
+
url = new URL(trimmed);
|
|
159
|
+
} catch {
|
|
160
|
+
return trimmed;
|
|
161
|
+
}
|
|
162
|
+
if (url.pathname === "/" && !url.search && !url.hash) return `${trimmed}${API_PATH}`;
|
|
163
|
+
return trimmed;
|
|
164
|
+
}
|
|
137
165
|
/** Statuses the retry middleware treats as transient. */
|
|
138
166
|
const RETRYABLE_STATUSES = /* @__PURE__ */ new Set([429, 503]);
|
|
139
167
|
/** Fallback backoff (ms) when the server sends no `Retry-After` header. */
|
|
@@ -224,7 +252,7 @@ var KrovaClient = class {
|
|
|
224
252
|
baseUrl;
|
|
225
253
|
constructor(options) {
|
|
226
254
|
if (!options?.apiKey) throw new Error("KrovaClient: `apiKey` is required.");
|
|
227
|
-
this.baseUrl = options.baseUrl
|
|
255
|
+
this.baseUrl = resolveBaseUrl(options.baseUrl);
|
|
228
256
|
const doFetch = options.fetch ?? globalThis.fetch;
|
|
229
257
|
const maxRetries = options.maxRetries ?? 2;
|
|
230
258
|
this.raw = createClient({
|
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 * The richer 409 body shape the v1 API returns for a termination-protected\n * Cube. The base {@link KrovaErrorBody} only carries `error: string` because\n * the documented `Error` schema is flat; the DELETE handler returns this\n * nested form for `error.code = \"termination_protected\"`. The {@link KrovaError}\n * `body` slot stays a `KrovaErrorBody` for backwards compatibility — the\n * dedicated error class below carries the parsed cube fields instead.\n */\nexport interface TerminationProtectedErrorBody {\n error?: {\n code?: string;\n message?: string;\n cube?: {\n id?: string;\n terminationProtectionChangedAt?: string | null;\n terminationProtectionChangedBy?: string | null;\n };\n };\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 *\n * `body` is `unknown` rather than {@link KrovaErrorBody} because not every\n * documented error response is the flat `{ error: string }` shape — DELETE\n * /cubes/{cubeId} publishes a 409 whose `error` is an object. This function\n * already coped with that at runtime; typing the parameter narrowly only meant\n * the call sites had to lie. Widening accepts strictly more, so no caller\n * breaks.\n *\n * `body` is carried onto the error only when it really is the flat shape, so\n * {@link KrovaError.body} never advertises a `string` that is not there. A\n * caller that needs the raw payload of some other shape has `response`.\n */\nexport function krovaErrorFrom(response: Response, body: unknown): KrovaError {\n const flat =\n typeof body === \"object\" && body !== null && typeof (body as KrovaErrorBody).error === \"string\"\n ? (body as KrovaErrorBody)\n : undefined;\n const message =\n flat?.error || response.statusText || `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: flat,\n response,\n });\n}\n\n/**\n * Thrown by `client.cubes.delete` when the server rejects a delete with\n * `409` and `error.code = \"termination_protected\"`.\n *\n * The customer-facing contract is: a Cube with `terminationProtection = true`\n * cannot be deleted until the flag is turned off. The CLI and MCP surface the\n * server's message verbatim, so callers can switch on `code` rather than\n * parsing prose. `cubeId` / `changedAt` / `changedBy` are best-effort — a\n * defensive server (or an older control plane) may omit the `cube` block, in\n * which case the SDK falls back to the id the call was made with and leaves\n * the two timestamps `null`.\n */\nexport class TerminationProtectedError extends KrovaError {\n /** The id of the Cube the customer tried to delete. */\n readonly cubeId: string;\n\n /**\n * When the flag was last changed (`terminationProtectionChangedAt` on the\n * Cube row). `null` when the server's 409 body omitted it.\n */\n readonly changedAt: string | null;\n\n /**\n * Who last changed the flag (`terminationProtectionChangedBy` on the Cube\n * row — typically `\"user:<id>\"`). `null` when the server's 409 body omitted\n * it.\n */\n readonly changedBy: string | null;\n\n constructor(\n message: string,\n init: {\n status: number;\n code: string;\n requestId?: string;\n body?: KrovaErrorBody;\n response?: Response;\n cubeId: string;\n changedAt: string | null;\n changedBy: string | null;\n },\n ) {\n super(message, {\n status: init.status,\n code: init.code,\n ...(init.requestId ? { requestId: init.requestId } : {}),\n ...(init.body ? { body: init.body } : {}),\n ...(init.response ? { response: init.response } : {}),\n });\n this.name = \"TerminationProtectedError\";\n this.cubeId = init.cubeId;\n this.changedAt = init.changedAt;\n this.changedBy = init.changedBy;\n Object.setPrototypeOf(this, TerminationProtectedError.prototype);\n }\n}\n\n/**\n * Try to interpret a failing DELETE response as the v1 API's\n * termination-protected 409. Returns a {@link TerminationProtectedError} when\n * the body shape matches, `null` otherwise (the caller then falls back to a\n * plain {@link KrovaError}).\n *\n * The 409 body is published as `{ error: { code, message, cube: { … } } }`,\n * but the bundled OpenAPI spec only declares `{ error: string }` for the\n * generic `Error` schema — so the cast is best-effort and we tolerate\n * missing optional fields.\n */\nexport function terminationProtectedFrom(\n response: Response,\n cubeId: string,\n body: unknown,\n): TerminationProtectedError | null {\n if (response.status !== 409 || body === null || typeof body !== \"object\") return null;\n const errBlock = (body as TerminationProtectedErrorBody).error;\n if (!errBlock || typeof errBlock !== \"object\") return null;\n if (errBlock.code !== \"termination_protected\") return null;\n const cubeBlock = errBlock.cube;\n const message =\n (typeof errBlock.message === \"string\" && errBlock.message) ||\n `Cube ${cubeId} has termination protection on. Turn it off before deleting.`;\n return new TerminationProtectedError(message, {\n status: 409,\n code: \"termination_protected\",\n requestId: response.headers.get(\"x-request-id\") ?? undefined,\n body: { error: message },\n response,\n cubeId: typeof cubeBlock?.id === \"string\" ? cubeBlock.id : cubeId,\n changedAt:\n typeof cubeBlock?.terminationProtectionChangedAt === \"string\"\n ? cubeBlock.terminationProtectionChangedAt\n : null,\n changedBy:\n typeof cubeBlock?.terminationProtectionChangedBy === \"string\"\n ? cubeBlock.terminationProtectionChangedBy\n : null,\n });\n}\n","import createClient, { type Client, type Middleware } from \"openapi-fetch\";\nimport { krovaErrorFrom, terminationProtectedFrom } 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/**\n * A backup: a Cube's disk and configuration, kept after the Cube is gone and\n * redeployable as a new Cube. `sharedFromBackupId` is set on a copy another\n * space shared with this one.\n */\nexport type Backup = components[\"schemas\"][\"Backup\"];\n\n/**\n * A request to give another space its own copy of a backup.\n *\n * `counterpartySpaceName` is the other side: the destination on an outgoing\n * share, the source on an incoming one. `copyBackupId` is set once accepted.\n */\nexport type BackupShare = components[\"schemas\"][\"BackupShare\"];\n\n/** Pending, unexpired backup shares into and out of a space. */\nexport interface BackupShareList {\n incoming: BackupShare[];\n outgoing: BackupShare[];\n}\n\n/** An accepted share, and the destination space's new copy. */\nexport interface AcceptedBackupShare {\n share: BackupShare;\n backup: Backup;\n}\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/**\n * Request body for `POST /spaces/{spaceId}/cubes` as defined in the OpenAPI\n * spec, with `terminationProtection` intersected on because the bundled spec\n * does not declare the field but the v1 API accepts it. A boolean `false` (or\n * omission) leaves the Cube in the documented default-unprotected state; `true`\n * opts the Cube out of customer-initiated deletion until the flag is toggled\n * back via `cubes.setTerminationProtection`.\n */\nexport type CreateCubeInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"] & {\n /** Opt this Cube out of customer-initiated deletion (default `false`). */\n terminationProtection?: boolean;\n};\n\n/**\n * Request body for `PATCH /spaces/{spaceId}/cubes/{cubeId}` — the v1 API\n * endpoint the SDK uses to toggle termination protection on an existing Cube.\n * The bundled OpenAPI spec does not declare a PATCH on this path yet, so the\n * type is structurally derived from the {@link Cube} fields the API echoes\n * back. Only `terminationProtection` is exposed by `setTerminationProtection`;\n * future toggles can extend this without breaking the public signature.\n */\nexport type SetTerminationProtectionInput = {\n terminationProtection: boolean;\n};\n\n/**\n * The dimensions to change in a Cube resize, in the units `POST /cubes` takes:\n * `vcpu` and `diskGb` are integers, `ramGb` may be fractional (`0.5`). Send only\n * what changes; omitted dimensions keep their current value. Disk can only grow.\n */\nexport type ResizeCubeInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/resize\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"][\"resources\"];\n\n/**\n * The 200 response of `POST /spaces/{spaceId}/cubes/{cubeId}/resize`.\n *\n * `state` is always `\"queued\"`: the Cube keeps its size until the worker\n * applies the change, so read the {@link Cube} again to see the new one.\n * `isLive` means no restart is needed; `requiresRestart` is its inverse, and the\n * worker power-cycles the Cube.\n */\nexport type ResizeCubeResult =\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/resize\"][\"post\"][\"responses\"][200][\"content\"][\"application/json\"];\n\n/**\n * A webhook endpoint subscribed to Space events.\n *\n * ⛔ Runtime discrepancy: the bundled OpenAPI spec does not declare\n * `description`, but `GET /spaces/{spaceId}/webhooks/{endpointId}` includes\n * it as `string | null`. The schema-derived type is extended here so callers\n * reading a single webhook see the field; it is optional so list responses\n * (which omit it) still typecheck.\n */\nexport type Webhook = components[\"schemas\"][\"Webhook\"] & {\n description?: string | null;\n};\n\n/** A recorded webhook delivery attempt (last 30 days of history). */\nexport type WebhookDelivery = components[\"schemas\"][\"WebhookDelivery\"];\n\n/**\n * Request body for creating a webhook endpoint.\n *\n * Derived from `paths[\"/spaces/{spaceId}/webhooks\"][\"post\"]` exactly like\n * {@link CreateDomainInput}; `description` is intersected on because the\n * bundled spec omits it but the runtime accepts it.\n */\nexport type CreateWebhookInput = NonNullable<\n paths[\"/spaces/{spaceId}/webhooks\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"] & {\n /** Optional human-readable label shown on the endpoint. */\n description?: string;\n};\n\n/** A webhook plus its signing secret. Returned ONLY by {@link KrovaClient.webhooks}.create. */\nexport type WebhookWithSecret = Webhook & { secret: string };\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> => 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 * Set `terminationProtection: true` to opt the Cube out of\n * customer-initiated deletion. The flag is per-Cube; power-off, wake,\n * restart, snapshot, and restore remain allowed regardless.\n *\n * @param spaceId Target Space id.\n * @param body Cube spec — `{ name, image, resources, sshPublicKey, terminationProtection?, ... }`.\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n create: async (\n spaceId: string,\n body: CreateCubeInput,\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 ? { header: { \"Idempotency-Key\": opts.idempotencyKey } } : {}),\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(\"/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. (Rename and resize have their own helpers: `cubes.rename` and `cubes.resize`.)\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 /**\n * Toggle a Cube's termination-protection flag.\n *\n * The v1 API exposes `PATCH /spaces/{spaceId}/cubes/{cubeId}` with body\n * `{ terminationProtection: boolean }`. The call is idempotent: passing the\n * current value is a no-op server-side (no audit row is written).\n *\n * Returns the updated {@link Cube}, including `terminationProtection`,\n * `terminationProtectionChangedAt`, and `terminationProtectionChangedBy`.\n */\n setTerminationProtection: async (\n spaceId: string,\n cubeId: string,\n enabled: boolean,\n ): Promise<Cube> => {\n const { data, error, response } = await this.raw.PATCH(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n body: { terminationProtection: enabled } as SetTerminationProtectionInput,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = (data as { cube?: Cube } | undefined)?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, {\n error: \"Set termination-protection response had no `cube`.\",\n });\n }\n return cube;\n },\n\n /**\n * Set a Cube's idle auto-stop timeout. Returns the updated {@link Cube}.\n *\n * `PATCH /spaces/{spaceId}/cubes/{cubeId}` with `{ idleTimeoutMinutes }`: an\n * integer from 10 to 10080 (7 days), or `null` to turn it off. Krova powers\n * the Cube off after that many minutes without activity. Needs the\n * `cube.manage` permission. Passing the current value is a no-op. A server\n * without the idle-timeout feature answers `400`.\n */\n setIdleTimeout: async (\n spaceId: string,\n cubeId: string,\n minutes: number | null,\n ): Promise<Cube> => {\n const { data, error, response } = await this.raw.PATCH(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n body: { idleTimeoutMinutes: minutes },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = (data as { cube?: Cube } | undefined)?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, { error: \"Set idle-timeout response had no `cube`.\" });\n }\n return cube;\n },\n\n /**\n * Rename a Cube. Returns the updated {@link Cube}.\n *\n * `PATCH /spaces/{spaceId}/cubes/{cubeId}` with `{ name }`. The name is\n * trimmed and must be 1 to 64 printable characters; it does not have to be\n * unique in the Space. Renaming to the current name is a no-op. Needs the\n * `cube.manage` permission. The hostname inside a running Cube changes on\n * its next cold restart.\n */\n rename: async (spaceId: string, cubeId: string, name: string): Promise<Cube> => {\n const { data, error, response } = await this.raw.PATCH(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n body: { name },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = (data as { cube?: Cube } | undefined)?.cube;\n if (!cube) throw krovaErrorFrom(response, { error: \"Rename Cube response had no `cube`.\" });\n return cube;\n },\n\n /**\n * Resize a Cube's vCPU, RAM and/or disk (asynchronous: the resize is\n * enqueued). Send only the dimensions to change.\n *\n * Resolves to a {@link ResizeCubeResult} that says whether the change is\n * applied live (`isLive`) or power-cycles the Cube (`requiresRestart`), and\n * echoes the `previous` and `requested` sizes. The Cube keeps its current\n * size until the worker applies the change. Disk can only grow. Throws a\n * {@link KrovaError} with status `400` for a value out of range, above the\n * plan limit, a disk shrink, no change, a Cube that is not `running` or\n * `stopped`, or a host without room, and `409` while a resize is already\n * queued or a transfer is in flight. Needs the `cube.manage` permission.\n *\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n resize: async (\n spaceId: string,\n cubeId: string,\n resources: ResizeCubeInput,\n opts?: { idempotencyKey?: string },\n ): Promise<ResizeCubeResult> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/resize\",\n {\n params: {\n path: { spaceId, cubeId },\n ...(opts?.idempotencyKey ? { header: { \"Idempotency-Key\": opts.idempotencyKey } } : {}),\n },\n body: { resources },\n },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Resize Cube response was empty.\" });\n return data;\n },\n\n /**\n * Delete a Cube (asynchronous — deletion is enqueued).\n *\n * Throws {@link TerminationProtectedError} when the server returns `409`\n * with `error.code = \"termination_protected\"` — the Cube had its\n * termination-protection flag set and must be unprotected first. Any other\n * non-2xx response surfaces as a plain {@link KrovaError}.\n */\n delete: async (spaceId: string, cubeId: string) => {\n const { data, error, response } = await this.raw.DELETE(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n });\n if (error !== undefined || !response.ok) {\n // Most errors are the flat `{ error: string }` schema; the\n // termination-protected 409 is published as `{ error: { code, message,\n // cube } }`. Try the richer shape first; fall through to a plain\n // KrovaError on anything else so callers see a typed error for every\n // failure mode.\n const tpe = terminationProtectedFrom(response, cubeId, error);\n if (tpe) throw tpe;\n throw krovaErrorFrom(response, error);\n }\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(\"/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) 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) 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, {\n error: \"Create TCP mapping response had no `tcpMapping`.\",\n });\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 // ⛔ Every backup call reads the Backups permissions (`backup.view` to\n // read, `backup.manage` for everything else), not the Cube ones. A key whose\n // member holds only Cube permissions gets a 403 here.\n\n readonly backups = {\n /** List the space's backups, newest first, including copies shared into it. */\n list: async (spaceId: string): Promise<Backup[]> => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/backups\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.backups ?? [];\n },\n\n /** Get one backup. */\n get: async (spaceId: string, backupId: string): Promise<Backup> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/backups/{backupId}\",\n { params: { path: { spaceId, backupId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.backup)\n throw krovaErrorFrom(response, { error: \"Get backup response had no `backup`.\" });\n return data.backup;\n },\n\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 * Offer a copy of a backup to another space. Returns the pending\n * {@link BackupShare}.\n *\n * Nothing is copied until the destination accepts: its owner, or a member\n * there with `backup.manage`, within 48 hours. The accepted copy is the\n * destination's own and is billed to it; this space's backup and bill are\n * unchanged. Through the API a share is always a request, even when your\n * user owns both spaces.\n *\n * A refusal at this step never says anything about the destination's\n * billing or verification; those are checked when it accepts.\n *\n * @param spaceId The space that holds the backup.\n * @param backupId The backup to share.\n * @param body `{ destinationSpaceId }`.\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n share: async (\n spaceId: string,\n backupId: string,\n body: { destinationSpaceId: string },\n opts?: { idempotencyKey?: string },\n ): Promise<BackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backups/{backupId}/shares\",\n {\n params: {\n path: { spaceId, backupId },\n ...(opts?.idempotencyKey ? { header: { \"Idempotency-Key\": opts.idempotencyKey } } : {}),\n },\n body,\n },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share)\n throw krovaErrorFrom(response, { error: \"Share backup response had no `share`.\" });\n return data.share;\n },\n };\n\n readonly backupShares = {\n /** Pending, unexpired shares into (`incoming`) and out of (`outgoing`) a space. */\n list: async (spaceId: string): Promise<BackupShareList> => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/backup-shares\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return { incoming: data?.incoming ?? [], outgoing: data?.outgoing ?? [] };\n },\n\n /**\n * Accept a share offered to this space. Returns the share and the space's\n * new copy of the backup.\n *\n * The copy is billed to this space from now, so only a key of the space's\n * owner, or of a member holding `backup.manage`, may accept. A space that\n * cannot take the copy (no card or credit, owner not verified, an open abuse\n * notice, or no backup allowance left on its plan) is refused with a 422.\n */\n accept: async (spaceId: string, shareId: string): Promise<AcceptedBackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backup-shares/{shareId}/accept\",\n { params: { path: { spaceId, shareId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share || !data.backup)\n throw krovaErrorFrom(response, {\n error: \"Accept backup share response had no `share` or `backup`.\",\n });\n return { share: data.share, backup: data.backup };\n },\n\n /** Decline a share offered to this space. Same permission as {@link accept}. */\n decline: async (spaceId: string, shareId: string): Promise<BackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backup-shares/{shareId}/decline\",\n { params: { path: { spaceId, shareId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share)\n throw krovaErrorFrom(response, { error: \"Decline backup share response had no `share`.\" });\n return data.share;\n },\n\n /**\n * Withdraw a pending share this space offered. Allowed for a key of the\n * space's owner, of a member holding `backup.manage`, or of the member who\n * raised the request.\n */\n cancel: async (spaceId: string, shareId: string): Promise<BackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backup-shares/{shareId}/cancel\",\n { params: { path: { spaceId, shareId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share)\n throw krovaErrorFrom(response, { error: \"Cancel backup share response had no `share`.\" });\n return data.share;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Webhooks\n //\n // ⛔ The Krova Cloud API exposes no PATCH endpoint for webhooks, so this\n // group deliberately has no `update` or `rotateSecret` helper. To change a\n // webhook's URL, events, or signing secret, delete it and create a new\n // endpoint. The signing secret is returned ONCE — losing it means every\n // subsequent delivery will fail signature verification.\n // ---------------------------------------------------------------------------\n\n readonly webhooks = {\n /** List webhook endpoints in a Space. */\n list: async (spaceId: string): Promise<Webhook[]> => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/webhooks\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n return (data as { webhooks?: Webhook[] } | undefined)?.webhooks ?? [];\n },\n\n /** Get a single webhook endpoint by id. Does NOT include the signing secret. */\n get: async (spaceId: string, endpointId: string): Promise<Webhook> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/webhooks/{endpointId}\",\n { params: { path: { spaceId, endpointId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n const body = data as { webhook?: Webhook } | undefined;\n if (!body?.webhook)\n throw krovaErrorFrom(response, { error: \"Get webhook response had no `webhook`.\" });\n return body.webhook;\n },\n\n /**\n * Create a webhook endpoint. Returns the endpoint AND its signing secret.\n *\n * ⛔ The signing secret is shown ONLY at creation. Persist it immediately;\n * you cannot retrieve it later — `webhooks.get` deliberately omits it.\n * Losing the secret means every subsequent delivery will fail signature\n * verification, and you will have to delete the endpoint and create a new\n * one. An automation that swallows this helper's return value will lose\n * the secret on the next request, so the response is checked here and\n * throws if the server omits either the webhook or the secret.\n *\n * @param spaceId Target Space id.\n * @param body Webhook spec — `{ url, events, description? }`.\n */\n create: async (spaceId: string, body: CreateWebhookInput): Promise<WebhookWithSecret> => {\n const { data, error, response } = await this.raw.POST(\"/spaces/{spaceId}/webhooks\", {\n params: { path: { spaceId } },\n body,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n const payload = data as { webhook?: WebhookWithSecret } | undefined;\n if (!payload?.webhook)\n throw krovaErrorFrom(response, { error: \"Create webhook response had no `webhook`.\" });\n if (!payload.webhook.secret)\n throw krovaErrorFrom(response, {\n error:\n \"Create webhook response had no `secret` — capture it NOW; it is never returned again.\",\n });\n return payload.webhook;\n },\n\n /**\n * Delete a webhook endpoint (cascades delivery history).\n *\n * Resolves on any 2xx; the response body is intentionally not parsed\n * because the server returns `{ success: true }` but the caller does not\n * need it.\n */\n delete: async (spaceId: string, endpointId: string): Promise<void> => {\n const { error, response } = await this.raw.DELETE(\"/spaces/{spaceId}/webhooks/{endpointId}\", {\n params: { path: { spaceId, endpointId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n },\n\n /**\n * List recent deliveries for a webhook endpoint (last 30 days, max 100).\n *\n * @param spaceId Target Space id.\n * @param endpointId Webhook endpoint id.\n * @param opts Optional `limit` (1..100). Omit to let the server default to 50.\n */\n deliveries: async (\n spaceId: string,\n endpointId: string,\n opts?: { limit?: number },\n ): Promise<WebhookDelivery[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/webhooks/{endpointId}/deliveries\",\n {\n params: {\n path: { spaceId, endpointId },\n ...(opts?.limit !== undefined ? { query: { limit: opts.limit } } : {}),\n },\n },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n return (data as { deliveries?: WebhookDelivery[] } | undefined)?.deliveries ?? [];\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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A,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 * The richer 409 body shape the v1 API returns for a termination-protected\n * Cube. The base {@link KrovaErrorBody} only carries `error: string` because\n * the documented `Error` schema is flat; the DELETE handler returns this\n * nested form for `error.code = \"termination_protected\"`. The {@link KrovaError}\n * `body` slot stays a `KrovaErrorBody` for backwards compatibility — the\n * dedicated error class below carries the parsed cube fields instead.\n */\nexport interface TerminationProtectedErrorBody {\n error?: {\n code?: string;\n message?: string;\n cube?: {\n id?: string;\n terminationProtectionChangedAt?: string | null;\n terminationProtectionChangedBy?: string | null;\n };\n };\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 *\n * `body` is `unknown` rather than {@link KrovaErrorBody} because not every\n * documented error response is the flat `{ error: string }` shape — DELETE\n * /cubes/{cubeId} publishes a 409 whose `error` is an object. This function\n * already coped with that at runtime; typing the parameter narrowly only meant\n * the call sites had to lie. Widening accepts strictly more, so no caller\n * breaks.\n *\n * `body` is carried onto the error only when it really is the flat shape, so\n * {@link KrovaError.body} never advertises a `string` that is not there. A\n * caller that needs the raw payload of some other shape has `response`.\n */\nexport function krovaErrorFrom(response: Response, body: unknown): KrovaError {\n const flat =\n typeof body === \"object\" && body !== null && typeof (body as KrovaErrorBody).error === \"string\"\n ? (body as KrovaErrorBody)\n : undefined;\n const message =\n flat?.error || response.statusText || `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: flat,\n response,\n });\n}\n\n/**\n * Thrown by `client.cubes.delete` when the server rejects a delete with\n * `409` and `error.code = \"termination_protected\"`.\n *\n * The customer-facing contract is: a Cube with `terminationProtection = true`\n * cannot be deleted until the flag is turned off. The CLI and MCP surface the\n * server's message verbatim, so callers can switch on `code` rather than\n * parsing prose. `cubeId` / `changedAt` / `changedBy` are best-effort — a\n * defensive server (or an older control plane) may omit the `cube` block, in\n * which case the SDK falls back to the id the call was made with and leaves\n * the two timestamps `null`.\n */\nexport class TerminationProtectedError extends KrovaError {\n /** The id of the Cube the customer tried to delete. */\n readonly cubeId: string;\n\n /**\n * When the flag was last changed (`terminationProtectionChangedAt` on the\n * Cube row). `null` when the server's 409 body omitted it.\n */\n readonly changedAt: string | null;\n\n /**\n * Who last changed the flag (`terminationProtectionChangedBy` on the Cube\n * row — typically `\"user:<id>\"`). `null` when the server's 409 body omitted\n * it.\n */\n readonly changedBy: string | null;\n\n constructor(\n message: string,\n init: {\n status: number;\n code: string;\n requestId?: string;\n body?: KrovaErrorBody;\n response?: Response;\n cubeId: string;\n changedAt: string | null;\n changedBy: string | null;\n },\n ) {\n super(message, {\n status: init.status,\n code: init.code,\n ...(init.requestId ? { requestId: init.requestId } : {}),\n ...(init.body ? { body: init.body } : {}),\n ...(init.response ? { response: init.response } : {}),\n });\n this.name = \"TerminationProtectedError\";\n this.cubeId = init.cubeId;\n this.changedAt = init.changedAt;\n this.changedBy = init.changedBy;\n Object.setPrototypeOf(this, TerminationProtectedError.prototype);\n }\n}\n\n/**\n * Try to interpret a failing DELETE response as the v1 API's\n * termination-protected 409. Returns a {@link TerminationProtectedError} when\n * the body shape matches, `null` otherwise (the caller then falls back to a\n * plain {@link KrovaError}).\n *\n * The 409 body is published as `{ error: { code, message, cube: { … } } }`,\n * but the bundled OpenAPI spec only declares `{ error: string }` for the\n * generic `Error` schema — so the cast is best-effort and we tolerate\n * missing optional fields.\n */\nexport function terminationProtectedFrom(\n response: Response,\n cubeId: string,\n body: unknown,\n): TerminationProtectedError | null {\n if (response.status !== 409 || body === null || typeof body !== \"object\") return null;\n const errBlock = (body as TerminationProtectedErrorBody).error;\n if (!errBlock || typeof errBlock !== \"object\") return null;\n if (errBlock.code !== \"termination_protected\") return null;\n const cubeBlock = errBlock.cube;\n const message =\n (typeof errBlock.message === \"string\" && errBlock.message) ||\n `Cube ${cubeId} has termination protection on. Turn it off before deleting.`;\n return new TerminationProtectedError(message, {\n status: 409,\n code: \"termination_protected\",\n requestId: response.headers.get(\"x-request-id\") ?? undefined,\n body: { error: message },\n response,\n cubeId: typeof cubeBlock?.id === \"string\" ? cubeBlock.id : cubeId,\n changedAt:\n typeof cubeBlock?.terminationProtectionChangedAt === \"string\"\n ? cubeBlock.terminationProtectionChangedAt\n : null,\n changedBy:\n typeof cubeBlock?.terminationProtectionChangedBy === \"string\"\n ? cubeBlock.terminationProtectionChangedBy\n : null,\n });\n}\n","import createClient, { type Client, type Middleware } from \"openapi-fetch\";\nimport { krovaErrorFrom, terminationProtectedFrom } 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/**\n * A backup: a Cube's disk and configuration, kept after the Cube is gone and\n * redeployable as a new Cube. `sharedFromBackupId` is set on a copy another\n * space shared with this one.\n */\nexport type Backup = components[\"schemas\"][\"Backup\"];\n\n/**\n * A request to give another space its own copy of a backup.\n *\n * `counterpartySpaceName` is the other side: the destination on an outgoing\n * share, the source on an incoming one. `copyBackupId` is set once accepted.\n */\nexport type BackupShare = components[\"schemas\"][\"BackupShare\"];\n\n/** Pending, unexpired backup shares into and out of a space. */\nexport interface BackupShareList {\n incoming: BackupShare[];\n outgoing: BackupShare[];\n}\n\n/** An accepted share, and the destination space's new copy. */\nexport interface AcceptedBackupShare {\n share: BackupShare;\n backup: Backup;\n}\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/**\n * Request body for `POST /spaces/{spaceId}/cubes` as defined in the OpenAPI\n * spec, with `terminationProtection` intersected on because the bundled spec\n * does not declare the field but the v1 API accepts it. A boolean `false` (or\n * omission) leaves the Cube in the documented default-unprotected state; `true`\n * opts the Cube out of customer-initiated deletion until the flag is toggled\n * back via `cubes.setTerminationProtection`.\n */\nexport type CreateCubeInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"] & {\n /** Opt this Cube out of customer-initiated deletion (default `false`). */\n terminationProtection?: boolean;\n};\n\n/**\n * Request body for `PATCH /spaces/{spaceId}/cubes/{cubeId}` — the v1 API\n * endpoint the SDK uses to toggle termination protection on an existing Cube.\n * The bundled OpenAPI spec does not declare a PATCH on this path yet, so the\n * type is structurally derived from the {@link Cube} fields the API echoes\n * back. Only `terminationProtection` is exposed by `setTerminationProtection`;\n * future toggles can extend this without breaking the public signature.\n */\nexport type SetTerminationProtectionInput = {\n terminationProtection: boolean;\n};\n\n/**\n * The dimensions to change in a Cube resize, in the units `POST /cubes` takes:\n * `vcpu` and `diskGb` are integers, `ramGb` may be fractional (`0.5`). Send only\n * what changes; omitted dimensions keep their current value. Disk can only grow.\n */\nexport type ResizeCubeInput = NonNullable<\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/resize\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"][\"resources\"];\n\n/**\n * The 200 response of `POST /spaces/{spaceId}/cubes/{cubeId}/resize`.\n *\n * `state` is always `\"queued\"`: the Cube keeps its size until the worker\n * applies the change, so read the {@link Cube} again to see the new one.\n * `isLive` means no restart is needed; `requiresRestart` is its inverse, and the\n * worker power-cycles the Cube.\n */\nexport type ResizeCubeResult =\n paths[\"/spaces/{spaceId}/cubes/{cubeId}/resize\"][\"post\"][\"responses\"][200][\"content\"][\"application/json\"];\n\n/**\n * A webhook endpoint subscribed to Space events.\n *\n * ⛔ Runtime discrepancy: the bundled OpenAPI spec does not declare\n * `description`, but `GET /spaces/{spaceId}/webhooks/{endpointId}` includes\n * it as `string | null`. The schema-derived type is extended here so callers\n * reading a single webhook see the field; it is optional so list responses\n * (which omit it) still typecheck.\n */\nexport type Webhook = components[\"schemas\"][\"Webhook\"] & {\n description?: string | null;\n};\n\n/** A recorded webhook delivery attempt (last 30 days of history). */\nexport type WebhookDelivery = components[\"schemas\"][\"WebhookDelivery\"];\n\n/**\n * Request body for creating a webhook endpoint.\n *\n * Derived from `paths[\"/spaces/{spaceId}/webhooks\"][\"post\"]` exactly like\n * {@link CreateDomainInput}; `description` is intersected on because the\n * bundled spec omits it but the runtime accepts it.\n */\nexport type CreateWebhookInput = NonNullable<\n paths[\"/spaces/{spaceId}/webhooks\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"] & {\n /** Optional human-readable label shown on the endpoint. */\n description?: string;\n};\n\n/** A webhook plus its signing secret. Returned ONLY by {@link KrovaClient.webhooks}.create. */\nexport type WebhookWithSecret = Webhook & { secret: string };\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/** Path appended to a bare origin such as `https://krova.cloud`. */\nconst API_PATH = \"/api/v1\";\n\n/** `KROVA_BASE_URL` when this runtime has `process.env`; never throws (browsers, edge runtimes, Deno without env access). */\nfunction readEnvBaseUrl(): string | undefined {\n try {\n if (typeof process !== \"undefined\" && process.env) return process.env.KROVA_BASE_URL;\n } catch {\n // Reading the env can throw where access is denied (for example Deno without --allow-env).\n }\n return undefined;\n}\n\n/**\n * Work out the API base URL. Order: the `baseUrl` option, then the\n * `KROVA_BASE_URL` environment variable (where `process.env` exists), then\n * {@link DEFAULT_BASE_URL}. An empty or whitespace-only value counts as unset.\n * Trailing slashes are removed. A bare origin (`https://krova.cloud`) gets\n * `/api/v1` appended; any other path is kept as given.\n */\nfunction resolveBaseUrl(explicit?: string): string {\n const raw = [explicit, readEnvBaseUrl()].find((v) => typeof v === \"string\" && v.trim() !== \"\");\n if (raw === undefined) return DEFAULT_BASE_URL;\n const trimmed = raw.trim().replace(/\\/+$/, \"\");\n let url: URL;\n try {\n url = new URL(trimmed);\n } catch {\n return trimmed;\n }\n if (url.pathname === \"/\" && !url.search && !url.hash) return `${trimmed}${API_PATH}`;\n return trimmed;\n}\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 /**\n * Override the API base URL. Optional. When omitted, the `KROVA_BASE_URL`\n * environment variable is used if set, else {@link DEFAULT_BASE_URL}. Accepts a\n * full API URL (`https://krova.cloud/api/v1`) or a bare origin (`/api/v1` is added).\n */\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> => 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 = resolveBaseUrl(options.baseUrl);\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 * Set `terminationProtection: true` to opt the Cube out of\n * customer-initiated deletion. The flag is per-Cube; power-off, wake,\n * restart, snapshot, and restore remain allowed regardless.\n *\n * @param spaceId Target Space id.\n * @param body Cube spec — `{ name, image, resources, sshPublicKey, terminationProtection?, ... }`.\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n create: async (\n spaceId: string,\n body: CreateCubeInput,\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 ? { header: { \"Idempotency-Key\": opts.idempotencyKey } } : {}),\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(\"/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. (Rename and resize have their own helpers: `cubes.rename` and `cubes.resize`.)\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 /**\n * Toggle a Cube's termination-protection flag.\n *\n * The v1 API exposes `PATCH /spaces/{spaceId}/cubes/{cubeId}` with body\n * `{ terminationProtection: boolean }`. The call is idempotent: passing the\n * current value is a no-op server-side (no audit row is written).\n *\n * Returns the updated {@link Cube}, including `terminationProtection`,\n * `terminationProtectionChangedAt`, and `terminationProtectionChangedBy`.\n */\n setTerminationProtection: async (\n spaceId: string,\n cubeId: string,\n enabled: boolean,\n ): Promise<Cube> => {\n const { data, error, response } = await this.raw.PATCH(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n body: { terminationProtection: enabled } as SetTerminationProtectionInput,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = (data as { cube?: Cube } | undefined)?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, {\n error: \"Set termination-protection response had no `cube`.\",\n });\n }\n return cube;\n },\n\n /**\n * Set a Cube's idle auto-stop timeout. Returns the updated {@link Cube}.\n *\n * `PATCH /spaces/{spaceId}/cubes/{cubeId}` with `{ idleTimeoutMinutes }`: an\n * integer from 10 to 10080 (7 days), or `null` to turn it off. Krova powers\n * the Cube off after that many minutes without activity. Needs the\n * `cube.manage` permission. Passing the current value is a no-op. A server\n * without the idle-timeout feature answers `400`.\n */\n setIdleTimeout: async (\n spaceId: string,\n cubeId: string,\n minutes: number | null,\n ): Promise<Cube> => {\n const { data, error, response } = await this.raw.PATCH(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n body: { idleTimeoutMinutes: minutes },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = (data as { cube?: Cube } | undefined)?.cube;\n if (!cube) {\n throw krovaErrorFrom(response, { error: \"Set idle-timeout response had no `cube`.\" });\n }\n return cube;\n },\n\n /**\n * Rename a Cube. Returns the updated {@link Cube}.\n *\n * `PATCH /spaces/{spaceId}/cubes/{cubeId}` with `{ name }`. The name is\n * trimmed and must be 1 to 64 printable characters; it does not have to be\n * unique in the Space. Renaming to the current name is a no-op. Needs the\n * `cube.manage` permission. The hostname inside a running Cube changes on\n * its next cold restart.\n */\n rename: async (spaceId: string, cubeId: string, name: string): Promise<Cube> => {\n const { data, error, response } = await this.raw.PATCH(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n body: { name },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n const cube = (data as { cube?: Cube } | undefined)?.cube;\n if (!cube) throw krovaErrorFrom(response, { error: \"Rename Cube response had no `cube`.\" });\n return cube;\n },\n\n /**\n * Resize a Cube's vCPU, RAM and/or disk (asynchronous: the resize is\n * enqueued). Send only the dimensions to change.\n *\n * Resolves to a {@link ResizeCubeResult} that says whether the change is\n * applied live (`isLive`) or power-cycles the Cube (`requiresRestart`), and\n * echoes the `previous` and `requested` sizes. The Cube keeps its current\n * size until the worker applies the change. Disk can only grow. Throws a\n * {@link KrovaError} with status `400` for a value out of range, above the\n * plan limit, a disk shrink, no change, a Cube that is not `running` or\n * `stopped`, or a host without room, and `409` while a resize is already\n * queued or a transfer is in flight. Needs the `cube.manage` permission.\n *\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n resize: async (\n spaceId: string,\n cubeId: string,\n resources: ResizeCubeInput,\n opts?: { idempotencyKey?: string },\n ): Promise<ResizeCubeResult> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/cubes/{cubeId}/resize\",\n {\n params: {\n path: { spaceId, cubeId },\n ...(opts?.idempotencyKey ? { header: { \"Idempotency-Key\": opts.idempotencyKey } } : {}),\n },\n body: { resources },\n },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (data === undefined)\n throw krovaErrorFrom(response, { error: \"Resize Cube response was empty.\" });\n return data;\n },\n\n /**\n * Delete a Cube (asynchronous — deletion is enqueued).\n *\n * Throws {@link TerminationProtectedError} when the server returns `409`\n * with `error.code = \"termination_protected\"` — the Cube had its\n * termination-protection flag set and must be unprotected first. Any other\n * non-2xx response surfaces as a plain {@link KrovaError}.\n */\n delete: async (spaceId: string, cubeId: string) => {\n const { data, error, response } = await this.raw.DELETE(\"/spaces/{spaceId}/cubes/{cubeId}\", {\n params: { path: { spaceId, cubeId } },\n });\n if (error !== undefined || !response.ok) {\n // Most errors are the flat `{ error: string }` schema; the\n // termination-protected 409 is published as `{ error: { code, message,\n // cube } }`. Try the richer shape first; fall through to a plain\n // KrovaError on anything else so callers see a typed error for every\n // failure mode.\n const tpe = terminationProtectedFrom(response, cubeId, error);\n if (tpe) throw tpe;\n throw krovaErrorFrom(response, error);\n }\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(\"/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) 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) 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, {\n error: \"Create TCP mapping response had no `tcpMapping`.\",\n });\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 // ⛔ Every backup call reads the Backups permissions (`backup.view` to\n // read, `backup.manage` for everything else), not the Cube ones. A key whose\n // member holds only Cube permissions gets a 403 here.\n\n readonly backups = {\n /** List the space's backups, newest first, including copies shared into it. */\n list: async (spaceId: string): Promise<Backup[]> => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/backups\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return data?.backups ?? [];\n },\n\n /** Get one backup. */\n get: async (spaceId: string, backupId: string): Promise<Backup> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/backups/{backupId}\",\n { params: { path: { spaceId, backupId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.backup)\n throw krovaErrorFrom(response, { error: \"Get backup response had no `backup`.\" });\n return data.backup;\n },\n\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 * Offer a copy of a backup to another space. Returns the pending\n * {@link BackupShare}.\n *\n * Nothing is copied until the destination accepts: its owner, or a member\n * there with `backup.manage`, within 48 hours. The accepted copy is the\n * destination's own and is billed to it; this space's backup and bill are\n * unchanged. Through the API a share is always a request, even when your\n * user owns both spaces.\n *\n * A refusal at this step never says anything about the destination's\n * billing or verification; those are checked when it accepts.\n *\n * @param spaceId The space that holds the backup.\n * @param backupId The backup to share.\n * @param body `{ destinationSpaceId }`.\n * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).\n */\n share: async (\n spaceId: string,\n backupId: string,\n body: { destinationSpaceId: string },\n opts?: { idempotencyKey?: string },\n ): Promise<BackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backups/{backupId}/shares\",\n {\n params: {\n path: { spaceId, backupId },\n ...(opts?.idempotencyKey ? { header: { \"Idempotency-Key\": opts.idempotencyKey } } : {}),\n },\n body,\n },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share)\n throw krovaErrorFrom(response, { error: \"Share backup response had no `share`.\" });\n return data.share;\n },\n };\n\n readonly backupShares = {\n /** Pending, unexpired shares into (`incoming`) and out of (`outgoing`) a space. */\n list: async (spaceId: string): Promise<BackupShareList> => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/backup-shares\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n return { incoming: data?.incoming ?? [], outgoing: data?.outgoing ?? [] };\n },\n\n /**\n * Accept a share offered to this space. Returns the share and the space's\n * new copy of the backup.\n *\n * The copy is billed to this space from now, so only a key of the space's\n * owner, or of a member holding `backup.manage`, may accept. A space that\n * cannot take the copy (no card or credit, owner not verified, an open abuse\n * notice, or no backup allowance left on its plan) is refused with a 422.\n */\n accept: async (spaceId: string, shareId: string): Promise<AcceptedBackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backup-shares/{shareId}/accept\",\n { params: { path: { spaceId, shareId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share || !data.backup)\n throw krovaErrorFrom(response, {\n error: \"Accept backup share response had no `share` or `backup`.\",\n });\n return { share: data.share, backup: data.backup };\n },\n\n /** Decline a share offered to this space. Same permission as {@link accept}. */\n decline: async (spaceId: string, shareId: string): Promise<BackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backup-shares/{shareId}/decline\",\n { params: { path: { spaceId, shareId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share)\n throw krovaErrorFrom(response, { error: \"Decline backup share response had no `share`.\" });\n return data.share;\n },\n\n /**\n * Withdraw a pending share this space offered. Allowed for a key of the\n * space's owner, of a member holding `backup.manage`, or of the member who\n * raised the request.\n */\n cancel: async (spaceId: string, shareId: string): Promise<BackupShare> => {\n const { data, error, response } = await this.raw.POST(\n \"/spaces/{spaceId}/backup-shares/{shareId}/cancel\",\n { params: { path: { spaceId, shareId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n if (!data?.share)\n throw krovaErrorFrom(response, { error: \"Cancel backup share response had no `share`.\" });\n return data.share;\n },\n };\n\n // ---------------------------------------------------------------------------\n // Webhooks\n //\n // ⛔ The Krova Cloud API exposes no PATCH endpoint for webhooks, so this\n // group deliberately has no `update` or `rotateSecret` helper. To change a\n // webhook's URL, events, or signing secret, delete it and create a new\n // endpoint. The signing secret is returned ONCE — losing it means every\n // subsequent delivery will fail signature verification.\n // ---------------------------------------------------------------------------\n\n readonly webhooks = {\n /** List webhook endpoints in a Space. */\n list: async (spaceId: string): Promise<Webhook[]> => {\n const { data, error, response } = await this.raw.GET(\"/spaces/{spaceId}/webhooks\", {\n params: { path: { spaceId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n return (data as { webhooks?: Webhook[] } | undefined)?.webhooks ?? [];\n },\n\n /** Get a single webhook endpoint by id. Does NOT include the signing secret. */\n get: async (spaceId: string, endpointId: string): Promise<Webhook> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/webhooks/{endpointId}\",\n { params: { path: { spaceId, endpointId } } },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n const body = data as { webhook?: Webhook } | undefined;\n if (!body?.webhook)\n throw krovaErrorFrom(response, { error: \"Get webhook response had no `webhook`.\" });\n return body.webhook;\n },\n\n /**\n * Create a webhook endpoint. Returns the endpoint AND its signing secret.\n *\n * ⛔ The signing secret is shown ONLY at creation. Persist it immediately;\n * you cannot retrieve it later — `webhooks.get` deliberately omits it.\n * Losing the secret means every subsequent delivery will fail signature\n * verification, and you will have to delete the endpoint and create a new\n * one. An automation that swallows this helper's return value will lose\n * the secret on the next request, so the response is checked here and\n * throws if the server omits either the webhook or the secret.\n *\n * @param spaceId Target Space id.\n * @param body Webhook spec — `{ url, events, description? }`.\n */\n create: async (spaceId: string, body: CreateWebhookInput): Promise<WebhookWithSecret> => {\n const { data, error, response } = await this.raw.POST(\"/spaces/{spaceId}/webhooks\", {\n params: { path: { spaceId } },\n body,\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n const payload = data as { webhook?: WebhookWithSecret } | undefined;\n if (!payload?.webhook)\n throw krovaErrorFrom(response, { error: \"Create webhook response had no `webhook`.\" });\n if (!payload.webhook.secret)\n throw krovaErrorFrom(response, {\n error:\n \"Create webhook response had no `secret` — capture it NOW; it is never returned again.\",\n });\n return payload.webhook;\n },\n\n /**\n * Delete a webhook endpoint (cascades delivery history).\n *\n * Resolves on any 2xx; the response body is intentionally not parsed\n * because the server returns `{ success: true }` but the caller does not\n * need it.\n */\n delete: async (spaceId: string, endpointId: string): Promise<void> => {\n const { error, response } = await this.raw.DELETE(\"/spaces/{spaceId}/webhooks/{endpointId}\", {\n params: { path: { spaceId, endpointId } },\n });\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n },\n\n /**\n * List recent deliveries for a webhook endpoint (last 30 days, max 100).\n *\n * @param spaceId Target Space id.\n * @param endpointId Webhook endpoint id.\n * @param opts Optional `limit` (1..100). Omit to let the server default to 50.\n */\n deliveries: async (\n spaceId: string,\n endpointId: string,\n opts?: { limit?: number },\n ): Promise<WebhookDelivery[]> => {\n const { data, error, response } = await this.raw.GET(\n \"/spaces/{spaceId}/webhooks/{endpointId}/deliveries\",\n {\n params: {\n path: { spaceId, endpointId },\n ...(opts?.limit !== undefined ? { query: { limit: opts.limit } } : {}),\n },\n },\n );\n if (error !== undefined || !response.ok) throw krovaErrorFrom(response, error);\n // The bundled spec does not declare a response body schema for this\n // path (only `description`); cast to the documented runtime shape.\n return (data as { deliveries?: WebhookDelivery[] } | undefined)?.deliveries ?? [];\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":";;;;;;;;;;AAsCA,IAAa,aAAb,MAAa,mBAAmB,MAAM;;CAEpC;;;;;;CAOA;;;;;CAMA;;CAGA;;CAGA;CAE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Ae,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"}
|
package/dist/ssh.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as CubeSshInfo } from "./client-
|
|
1
|
+
import { u as CubeSshInfo } from "./client-dhEm38P2.cjs";
|
|
2
2
|
import { Client, SFTPWrapper } from "ssh2";
|
|
3
3
|
/** A host public key as the Krova API returns it: `key` is the base64 blob of the OpenSSH `.pub` line. */
|
|
4
4
|
export interface HostKey {
|
package/dist/ssh.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as CubeSshInfo } from "./client-
|
|
1
|
+
import { u as CubeSshInfo } from "./client-dhEm38P2.js";
|
|
2
2
|
import { Client, SFTPWrapper } from "ssh2";
|
|
3
3
|
/** A host public key as the Krova API returns it: `key` is the base64 blob of the OpenSSH `.pub` line. */
|
|
4
4
|
export interface HostKey {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krovacloud/sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
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",
|