@krovacloud/sdk 0.5.4 → 0.5.6

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 CHANGED
@@ -7,18 +7,52 @@ All notable changes to `@krovacloud/sdk` are documented here. This project adher
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ The sections below are grouped by the release that first shipped each change, taken from the `@krovacloud/sdk@<version>` git tags. Versions up to 0.5.5 are published to npm.
11
+
12
+ ### Documentation
13
+
14
+ - README: Node.js 22 or later; `code` and `requestId` on `KrovaError` come from response headers the Krova API does not send today, so they are normally `undefined` (only `TerminationProtectedError` carries a code); `DnsRecord`, `DnsRecordStatus` and the webhook types are reached through `components["schemas"]`, not exported by name; the full `Cube` shape, `imports.cancel`, TCP mapping `label` and `udpEnabled`, the other custom-domain settings, the 600 requests per minute per key limit and the per-plan hourly cap on Cube creates (a `429` with `Retry-After`); `cubes.update` is the SSH port only and RAM is in whole GB. Comment-only changes in the source.
15
+
16
+ ## 0.5.4
17
+
10
18
  ### Added
11
19
 
12
20
  - `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
21
 
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.
22
+ ### Changed
23
+
24
+ - `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.
25
+
26
+ ## 0.5.2
15
27
 
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.
28
+ ### Added
29
+
30
+ - `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). The OpenAPI snapshot and generated types include them. krova-cloud has since deployed the feature, so the live API serves them.
31
+
32
+ - `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, and the live API serves them.
33
+
34
+ ## 0.5.1
35
+
36
+ ### Added
17
37
 
18
38
  - `@krovacloud/sdk/ssh`, a Node-only entry for running commands and moving files on a Cube over its own SSH with a private key you supply: `connectCube(krova, spaceId, cubeId, { privateKey, passphrase?, readyTimeoutMs?, hostKeys? })` returns a shell with `run()`, `files.write/read/upload/download` and `close()`. The host key is checked against the keys from `cubes.ssh()` and a mismatch throws `HostKeyMismatchError`; there is no way to skip the check. Also exports `shellQuote`, `RunTimeoutError` and `SshError`. Adds the `ssh2` dependency; the main entry does not load it.
19
39
 
40
+ ## 0.4.14
41
+
42
+ ### Added
43
+
20
44
  - Backups and sharing them between spaces: `backups.list()`, `backups.get()` and `backups.share()` (with an optional `idempotencyKey`), and a new `backupShares` group with `list()`, `accept()`, `decline()` and `cancel()`. New exported types `Backup`, `BackupShare`, `BackupShareList` and `AcceptedBackupShare`. These endpoints read the Backups permissions (`backup.view`, `backup.manage`), not the Cube ones. The OpenAPI snapshot is refreshed from the live API and the types regenerated.
21
45
 
46
+ ## 0.4.13
47
+
48
+ ### Documentation
49
+
50
+ - README documents `cubes.setTerminationProtection` (and `TerminationProtectedError`), `terminationProtection` on `cubes.create()` and on `Cube`, the `resizing` state, and `client.webhooks`. It no longer says webhooks need `client.raw`.
51
+
52
+ ## 0.4.12
53
+
54
+ ### Added
55
+
22
56
  - `proxyProtocol` (`"v1"`, `"v2"` or `null`) on `domains.create()` and
23
57
  `domains.update()`, and on every returned `Domain`, which now also carries
24
58
  `originScheme`. `confirmMixedProxyProtocol: true` saves a setting that differs
@@ -27,11 +61,13 @@ All notable changes to `@krovacloud/sdk` are documented here. This project adher
27
61
 
28
62
  ### Changed
29
63
 
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
-
32
64
  - The README no longer says HTTPS to the Cube is verified before it applies: the
33
65
  API now applies it as saved.
34
66
 
67
+ ## 0.4.3
68
+
69
+ ### Changed
70
+
35
71
  - **BREAKING** — `KrovaErrorBody` no longer has an open `[key: string]: unknown`
36
72
  index signature; only `error?: string` is part of the public shape. The
37
73
  documented API contract (`components.schemas.Error` in the bundled OpenAPI
@@ -40,10 +76,6 @@ All notable changes to `@krovacloud/sdk` are documented here. This project adher
40
76
  arbitrary record should narrow to `body?.error` (or cast the body to a
41
77
  concrete shape they actually expect).
42
78
 
43
- ### Documentation
44
-
45
- - README documents `cubes.setTerminationProtection` (and `TerminationProtectedError`), `terminationProtection` on `cubes.create()` and on `Cube`, the `resizing` state, and `client.webhooks`. It no longer says webhooks need `client.raw`.
46
-
47
79
  ## 0.4.2
48
80
 
49
81
  ### Changed
package/README.md CHANGED
@@ -23,7 +23,7 @@ npm i @krovacloud/sdk
23
23
  # or: yarn add @krovacloud/sdk
24
24
  ```
25
25
 
26
- Requires **Node.js ≥ 18** (uses the global `fetch`).
26
+ Requires **Node.js ≥ 22** (uses the global `fetch`).
27
27
 
28
28
  ## Quickstart
29
29
 
@@ -98,7 +98,7 @@ new KrovaClient({
98
98
  });
99
99
  ```
100
100
 
101
- Throws if `apiKey` is missing. Exposes `client.baseUrl` (the resolved base URL), `client.getSpace()`, and the resource helpers `client.cubes`, `client.domains`, `client.snapshots`, `client.tcpMappings`, `client.imports`, `client.backups`, `client.catalog` (each documented in its section below), plus the raw typed client `client.raw`.
101
+ Throws if `apiKey` is missing. Exposes `client.baseUrl` (the resolved base URL), `client.getSpace()`, and the resource helpers `client.cubes`, `client.domains`, `client.snapshots`, `client.tcpMappings`, `client.imports`, `client.backups`, `client.backupShares`, `client.webhooks`, `client.catalog` (each documented in its section below), plus the raw typed client `client.raw`.
102
102
 
103
103
  ### `client.getSpace()`
104
104
 
@@ -122,10 +122,10 @@ Ergonomic helpers for the Cube lifecycle. Each unwraps the response body and thr
122
122
  | `list` | `(spaceId: string)` | the Cube list body |
123
123
  | `create` | `(spaceId, body, opts?)` | the created `Cube` |
124
124
  | `get` | `(spaceId, cubeId)` | the Cube body |
125
- | `update` | `(spaceId, cubeId, body)` | changes the port sshd listens on inside the Cube |
125
+ | `update` | `(spaceId, cubeId, body)` | the API's response body. Changes the port sshd listens on inside the Cube (`body` is `{ cubePort }`) |
126
126
  | `setTerminationProtection` | `(spaceId, cubeId, enabled)` | the updated `Cube`. While protection is on, `delete` throws `TerminationProtectedError` (a `KrovaError` for the API's `409`) |
127
127
  | `rename` | `(spaceId, cubeId, name)` | the updated `Cube`. The name is trimmed, 1 to 64 printable characters, and does not have to be unique |
128
- | `setIdleTimeout` | `(spaceId, cubeId, minutes \| null)` | the updated `Cube`. Krova powers the Cube off after that many minutes without activity: an integer from 10 to 10080, or `null` for off. Needs a server with the idle-timeout feature (an older one answers `400`) |
128
+ | `setIdleTimeout` | `(spaceId, cubeId, minutes \| null)` | the updated `Cube`. Krova powers the Cube off after that many minutes without activity: an integer from 10 to 10080, or `null` for off. `Cube.lastActiveAt` shows the last activity Krova saw |
129
129
  | `resize` | `(spaceId, cubeId, { vcpu?, ramGb?, diskGb? }, opts?)` | enqueues a resize and returns `{ jobId, isLive, requiresRestart, previous, requested }`. `isLive` means no restart; `requiresRestart` is its inverse. Send only what changes; disk can only grow. `opts.idempotencyKey` makes retries safe |
130
130
  | `delete` | `(spaceId, cubeId)` | enqueues deletion |
131
131
  | `powerOff` | `(spaceId, cubeId)` | enqueues a power-off |
@@ -190,7 +190,13 @@ import type { Cube } from "@krovacloud/sdk";
190
190
  // publicIpv4: string | null;
191
191
  // resources: { vcpu: number; ramGb: number; diskGb: number };
192
192
  // image: string; costPerHour: number;
193
+ // sshUser: string; // "ubuntu" | "debian" | "root" (see client.cubes.ssh)
193
194
  // terminationProtection: boolean;
195
+ // terminationProtectionChangedAt: string | null;
196
+ // terminationProtectionChangedBy: string | null;
197
+ // idleTimeoutMinutes: number | null; // null = idle power-off is off
198
+ // lastActiveAt: string | null;
199
+ // serverDomain?: string | null; // the current physical host; changes when the Cube moves
194
200
  // createdAt: string; updatedAt: string;
195
201
  // }
196
202
  ```
@@ -210,7 +216,7 @@ const pricing = await krova.catalog.pricing(); // per-resource hourly rates + vo
210
216
  Typed helpers for a Cube's attached resources — each unwraps the response and throws `KrovaError` on failure.
211
217
 
212
218
  ```ts
213
- // Custom domains — create() resolves to { domain, records } (BREAKING in 0.4.0).
219
+ // Custom domains — create() resolves to { domain, records } (the 0.4.0 change: before 0.4.0 it resolved to the Domain alone).
214
220
  // The records are the DNS entries you must publish for the domain to work, so
215
221
  // you can create them in the same run: a wildcard needs three, an exact host one.
216
222
  const domains = await krova.domains.list("space_123", "cube_123");
@@ -231,7 +237,9 @@ await krova.snapshots.delete("space_123", "cube_123", snap.id);
231
237
  // TCP port mappings (expose a Cube port on the host)
232
238
  const mapping = await krova.tcpMappings.create("space_123", "cube_123", {
233
239
  cubePort: 5432,
234
- whitelistedIps: ["203.0.113.4/32"],
240
+ whitelistedIps: ["203.0.113.4/32"], // omit it and the port is open to the whole internet
241
+ label: "postgres", // optional
242
+ udpEnabled: true, // optional; UDP is forwarded on the same host port by default
235
243
  });
236
244
  // `mapping.host` is where to connect — the Cube's OWN stable hostname, which
237
245
  // survives migration to another server. Use it rather than the Cube's
@@ -242,7 +250,9 @@ await krova.tcpMappings.list("space_123", "cube_123");
242
250
  await krova.tcpMappings.delete("space_123", "cube_123", mapping.id);
243
251
  ```
244
252
 
245
- `Domain`, `Snapshot`, and `TcpMapping` are exported for your own signatures.
253
+ A TCP mapping forwards UDP as well as TCP on its host port unless you send `udpEnabled: false`. The allow-list, when you send one, applies to both protocols. Leave `whitelistedIps` out and the port is open to the internet.
254
+
255
+ `Domain`, `Snapshot`, and `TcpMapping` are exported for your own signatures. The other response and request shapes are in the generated spec types: for example `components["schemas"]["Webhook"]` and `components["schemas"]["WebhookDelivery"]` (`WebhookWithSecret` and `CreateWebhookInput` are not exported by name).
246
256
 
247
257
  ### `domains.records` — the DNS records a domain needs
248
258
 
@@ -264,10 +274,17 @@ error — and `unknown` means the lookup itself could not complete, which says
264
274
  nothing about your DNS. Each record also carries `mustBeGrey` and `proxyOk`:
265
275
  the routing record may sit behind Cloudflare's proxy, the `_acme-challenge`
266
276
  record must not — automation needs both flags, one alone would let you
267
- orange-cloud the single record that has to stay grey.
277
+ orange-cloud the single record that has to stay gray.
268
278
 
269
279
  `DnsRecord` (what `create` returns) and `DnsRecordStatus` (the checked variant,
270
- adding `state`, `detail`, `observed`) are exported for your own signatures.
280
+ adding `state`, `detail`, `observed`) are not exported by name. Use the generated
281
+ types when you need them in your own signatures:
282
+
283
+ ```ts
284
+ import type { components } from "@krovacloud/sdk";
285
+ type DnsRecord = components["schemas"]["DnsRecord"];
286
+ type DnsRecordStatus = components["schemas"]["DnsRecordStatus"];
287
+ ```
271
288
 
272
289
  ### Imports & backups
273
290
 
@@ -279,6 +296,9 @@ const start = await krova.imports.create("space_123", { name: "restored", fileSi
279
296
  await krova.imports.complete("space_123", start.importId, { parts, config });
280
297
  const status = await krova.imports.get("space_123", start.importId);
281
298
 
299
+ // Changed your mind before completing? Cancel the in-progress import.
300
+ await krova.imports.cancel("space_123", start.importId);
301
+
282
302
  // Export: get a time-limited download URL for a backup archive
283
303
  const dl = await krova.backups.download("space_123", "backup_123");
284
304
  ```
@@ -361,8 +381,8 @@ Thrown by every helper on any non-2xx response. (`client.raw` never throws — i
361
381
  | --- | --- | --- |
362
382
  | `status` | `number` | HTTP status code |
363
383
  | `message` | `string` | the API's `error` string, else `statusText` |
364
- | `code` | `string \| undefined` | `X-Error-Code` response header |
365
- | `requestId` | `string \| undefined` | `X-Request-Id` response header |
384
+ | `code` | `string \| undefined` | the `X-Error-Code` response header, when the server sends one. The Krova API does not send it today, so expect `undefined`. The one exception is `TerminationProtectedError`, whose `code` is `"termination_protected"`, read from the response body |
385
+ | `requestId` | `string \| undefined` | the `X-Request-Id` response header, when the server sends one. The Krova API does not send it today, so expect `undefined` |
366
386
  | `body` | `object \| undefined` | the parsed JSON error body |
367
387
  | `response` | `Response \| undefined` | the raw `Response` |
368
388
 
@@ -374,15 +394,23 @@ try {
374
394
  } catch (err) {
375
395
  if (err instanceof KrovaError) {
376
396
  console.error(`[${err.status}] ${err.message}`);
397
+ // `code` and `requestId` are filled in only when the response carries the
398
+ // matching header. Krova does not send either today, so test before you use them.
377
399
  if (err.code) console.error("code:", err.code);
378
- if (err.requestId) console.error("request id:", err.requestId); // quote this to support
400
+ if (err.requestId) console.error("request id:", err.requestId);
379
401
  } else {
380
402
  throw err;
381
403
  }
382
404
  }
383
405
  ```
384
406
 
385
- Mutating `POST` / `DELETE` endpoints are rate-limited (10 requests / 60s per client IP). The client automatically retries `429` and `503` up to `maxRetries` times, honoring the `Retry-After` header.
407
+ ### Rate limits
408
+
409
+ - Mutating `POST` / `DELETE` endpoints: 10 requests per 60 seconds per client IP.
410
+ - Every authenticated request, reads included: 600 requests per 60 seconds per API key.
411
+ - Creating Cubes: each plan allows a number of new Cubes per rolling hour, and every way of creating a Cube counts. `cubes.create`, `imports.create` and `imports.complete` are the SDK calls that answer `429` once it is used up; cloning a snapshot and redeploying a backup in the dashboard count too. Every Cube created in the last 60 minutes counts, including ones since deleted, so deleting a Cube does not free a slot. Past the allowance the API answers `429`. Its `Retry-After` header is the number of seconds until the oldest of those creates leaves the window, and is absent when the plan allows no new Cubes at all.
412
+
413
+ The client automatically retries `429` and `503` up to `maxRetries` times, honoring `Retry-After`, but never waits more than 10 seconds between attempts. A `Retry-After` of minutes or an hour (the Cube-creates allowance) therefore ends in a thrown `KrovaError` with `status` 429, and the header is on `err.response?.headers.get("retry-after")`.
386
414
 
387
415
  ## Run commands and move files
388
416
 
@@ -442,7 +470,7 @@ The package ships its own type declarations — no `@types/*` install needed. `C
442
470
 
443
471
  ## Requirements
444
472
 
445
- - **Node.js ≥ 18** (global `fetch`).
473
+ - **Node.js ≥ 22** (global `fetch`).
446
474
  - Works in any modern runtime with a WHATWG `fetch` (Deno, Bun, edge). Pass a custom `fetch` if the global isn't available.
447
475
 
448
476
  ## Contributing
@@ -496,6 +524,26 @@ would mix them is rejected with a `409` whose message names the other domains.
496
524
  Send `confirmMixedProxyProtocol: true` to save anyway, when the app handles both
497
525
  on that port.
498
526
 
527
+ ## Custom domains: other settings
528
+
529
+ `domains.create()` and `domains.update()` also take these optional settings, all applied at the edge. The API reference (the bundled OpenAPI spec, typed as `UpdateDomainInput`) has the exact shape of each.
530
+
531
+ - `responseCompression`: gzip and zstd on responses.
532
+ - `securityHeadersMode`: `"enforced"` (the default; the edge sets HSTS, X-Frame-Options and similar) or `"app_managed"` (your app's own headers pass through).
533
+ - `requestHeaderOverrides` and `responseHeaderOverrides`: `{ set?, remove? }` header rewrites; `null` clears them.
534
+ - `corsConfig`: a per-domain CORS policy; the edge answers preflight itself. `null` turns CORS off.
535
+ - `ipAllowList` and `ipDenyList`: visitor IPs or CIDRs; a visitor on the deny list gets a `403`.
536
+ - `basicAuthUser` and `basicAuthPassword`: HTTP Basic Auth. The password is hashed on the server and never returned; the `Domain` shows only `basicAuthEnabled`.
537
+ - `maxRequestBodyMb` and `responseHeaderTimeoutSecs`: request size and response-header limits.
538
+
539
+ ```ts
540
+ await krova.domains.update(spaceId, cubeId, mappingId, {
541
+ ipAllowList: ["203.0.113.0/24"],
542
+ corsConfig: { allowedOrigins: ["https://app.example.com"] },
543
+ securityHeadersMode: "app_managed",
544
+ });
545
+ ```
546
+
499
547
  ## License
500
548
 
501
549
  [MIT](./LICENSE) © 2026 Krova Inc.
@@ -805,7 +805,17 @@ interface paths {
805
805
  400: components["responses"]["BadRequest"];
806
806
  401: components["responses"]["Unauthorized"];
807
807
  403: components["responses"]["Forbidden"];
808
- 429: components["responses"]["RateLimited"];
808
+ /** @description Too many requests, or the space has used its plan's allowance of new Cubes per hour. The allowance counts every Cube created in the last 60 minutes, including ones since deleted, so deleting a Cube does not free a slot. `Retry-After` is the number of seconds until the oldest of those creates leaves the 60-minute window; it is absent when the plan allows no new Cubes at all. */
809
+ 429: {
810
+ headers: {
811
+ /** @description Seconds to wait before retrying. */
812
+ "Retry-After"?: number;
813
+ [name: string]: unknown;
814
+ };
815
+ content: {
816
+ "application/json": components["schemas"]["Error"];
817
+ };
818
+ };
809
819
  };
810
820
  };
811
821
  delete?: never;
@@ -894,6 +904,15 @@ interface paths {
894
904
  };
895
905
  content?: never;
896
906
  };
907
+ /** @description Too many requests, or the space has used its plan's allowance of new Cubes per hour. The allowance counts every Cube created in the last 60 minutes, including ones since deleted, so deleting a Cube does not free a slot. `Retry-After` is the number of seconds until the oldest of those creates leaves the 60-minute window; it is absent when the plan allows no new Cubes at all. */
908
+ 429: {
909
+ headers: {
910
+ /** @description Seconds to wait before retrying. */
911
+ "Retry-After"?: number;
912
+ [name: string]: unknown;
913
+ };
914
+ content?: never;
915
+ };
897
916
  /** @description No active storage backend */
898
917
  503: {
899
918
  headers: {
@@ -1067,6 +1086,15 @@ interface paths {
1067
1086
  };
1068
1087
  content?: never;
1069
1088
  };
1089
+ /** @description Too many requests, or the space has used its plan's allowance of new Cubes per hour. The allowance counts every Cube created in the last 60 minutes, including ones since deleted, so deleting a Cube does not free a slot. `Retry-After` is the number of seconds until the oldest of those creates leaves the 60-minute window; it is absent when the plan allows no new Cubes at all. */
1090
+ 429: {
1091
+ headers: {
1092
+ /** @description Seconds to wait before retrying. */
1093
+ "Retry-After"?: number;
1094
+ [name: string]: unknown;
1095
+ };
1096
+ content?: never;
1097
+ };
1070
1098
  /** @description S3 finalization failed */
1071
1099
  502: {
1072
1100
  headers: {
@@ -1178,7 +1206,7 @@ interface paths {
1178
1206
  head?: never;
1179
1207
  /**
1180
1208
  * Update a Cube (rename, termination protection, idle auto-stop)
1181
- * @description Idempotent. The PATCHable fields are `name`, `terminationProtection` and `idleTimeoutMinutes`; send any of them. Sending a value the Cube already has returns the Cube unchanged and writes no audit row. Sending neither is a 400 rather than a no-op, so a typo in a field name cannot look like success. Renaming and changing the idle auto-stop timeout need the `cube.manage` permission, and changing termination protection needs `cube.termination_protection`; a request with several fields needs each permission. Every supplied field is validated before any is applied. Names are not unique within a space. Renaming is metadata only: the hostname inside a running Cube changes on its next cold restart. To change vCPU, RAM or disk use `POST .../resize`.
1209
+ * @description Idempotent. The PATCHable fields are `name`, `terminationProtection` and `idleTimeoutMinutes`; send any combination. Sending a value a field already has returns the Cube unchanged and writes no audit row. Sending none of them is a 400 rather than a no-op, so a typo in a field name cannot look like success. Renaming and changing the idle auto-stop timeout need the `cube.manage` permission and changing termination protection needs `cube.termination_protection`; a request with several fields needs every matching permission. Every supplied field is validated before any is applied. Names are not unique within a space. Renaming is metadata only: the hostname inside a running Cube changes on its next cold restart. To change vCPU, RAM or disk use `POST .../resize`.
1182
1210
  */
1183
1211
  patch: {
1184
1212
  parameters: {
@@ -2471,6 +2499,7 @@ interface components {
2471
2499
  };
2472
2500
  /** @description The hostname of the server currently hosting this Cube (e.g. `mango.krova.cloud`), shared by every Cube on that server. This is NOT the Cube's own SSH target — use `host` from GET .../ssh for that, which is the Cube's own stable hostname and survives migration to another server. Null when the Cube has no server assigned. Only present on the single-Cube GET; list and create responses omit it. */
2473
2501
  serverDomain?: string | null;
2502
+ /** @description The account to SSH in as: `ubuntu` or `debian` on Cubes created from images that ship a default user, `root` on Cubes created before that change or imported from a rootfs without one. The same value on create, GET and GET .../ssh (`user`). Recorded while the Cube provisions; the create response reports the image's default user, which is what the recorded value will be. */
2474
2503
  sshUser: string;
2475
2504
  /** @enum {string} */
2476
2505
  state: "pending" | "booting" | "running" | "stopped" | "stopping" | "resizing" | "error" | "deleted";
@@ -2802,7 +2831,8 @@ type CreateCubeInput = NonNullable<paths["/spaces/{spaceId}/cubes"]["post"]["req
2802
2831
  };
2803
2832
  /**
2804
2833
  * The dimensions to change in a Cube resize, in the units `POST /cubes` takes:
2805
- * `vcpu` and `diskGb` are integers, `ramGb` may be fractional (`0.5`). Send only
2834
+ * `vcpu`, `ramGb` and `diskGb` are whole numbers: the server accepts RAM in whole
2835
+ * GB steps (1 GB) only, so a fraction such as `0.5` is refused. Send only
2806
2836
  * what changes; omitted dimensions keep their current value. Disk can only grow.
2807
2837
  */
2808
2838
  type ResizeCubeInput = NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/resize"]["post"]["requestBody"]>["content"]["application/json"]["resources"];
@@ -2964,10 +2994,11 @@ declare class KrovaClient {
2964
2994
  * changed by this call. Pointing this at a port nothing is listening on
2965
2995
  * inside the Cube will silently make SSH unreachable; the default is 22.
2966
2996
  *
2967
- * The Krova Cloud API exposes no general Cube-mutation endpoint; the only
2968
- * mutable Cube field over the API is this port, via
2969
- * `PUT /spaces/{spaceId}/cubes/{cubeId}/ssh-port`. This helper maps to that
2970
- * endpoint. (Rename and resize have their own helpers: `cubes.rename` and `cubes.resize`.)
2997
+ * This helper maps to `PUT /spaces/{spaceId}/cubes/{cubeId}/ssh-port` and
2998
+ * changes only that port. The other mutable Cube fields have their own
2999
+ * helpers: `cubes.rename`, `cubes.setIdleTimeout` and
3000
+ * `cubes.setTerminationProtection` (all `PATCH /spaces/{spaceId}/cubes/{cubeId}`),
3001
+ * and `cubes.resize`.
2971
3002
  */
2972
3003
  update: (spaceId: string, cubeId: string, body: NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/ssh-port"]["put"]["requestBody"]>["content"]["application/json"]) => Promise<unknown>;
2973
3004
  /**
@@ -805,7 +805,17 @@ interface paths {
805
805
  400: components["responses"]["BadRequest"];
806
806
  401: components["responses"]["Unauthorized"];
807
807
  403: components["responses"]["Forbidden"];
808
- 429: components["responses"]["RateLimited"];
808
+ /** @description Too many requests, or the space has used its plan's allowance of new Cubes per hour. The allowance counts every Cube created in the last 60 minutes, including ones since deleted, so deleting a Cube does not free a slot. `Retry-After` is the number of seconds until the oldest of those creates leaves the 60-minute window; it is absent when the plan allows no new Cubes at all. */
809
+ 429: {
810
+ headers: {
811
+ /** @description Seconds to wait before retrying. */
812
+ "Retry-After"?: number;
813
+ [name: string]: unknown;
814
+ };
815
+ content: {
816
+ "application/json": components["schemas"]["Error"];
817
+ };
818
+ };
809
819
  };
810
820
  };
811
821
  delete?: never;
@@ -894,6 +904,15 @@ interface paths {
894
904
  };
895
905
  content?: never;
896
906
  };
907
+ /** @description Too many requests, or the space has used its plan's allowance of new Cubes per hour. The allowance counts every Cube created in the last 60 minutes, including ones since deleted, so deleting a Cube does not free a slot. `Retry-After` is the number of seconds until the oldest of those creates leaves the 60-minute window; it is absent when the plan allows no new Cubes at all. */
908
+ 429: {
909
+ headers: {
910
+ /** @description Seconds to wait before retrying. */
911
+ "Retry-After"?: number;
912
+ [name: string]: unknown;
913
+ };
914
+ content?: never;
915
+ };
897
916
  /** @description No active storage backend */
898
917
  503: {
899
918
  headers: {
@@ -1067,6 +1086,15 @@ interface paths {
1067
1086
  };
1068
1087
  content?: never;
1069
1088
  };
1089
+ /** @description Too many requests, or the space has used its plan's allowance of new Cubes per hour. The allowance counts every Cube created in the last 60 minutes, including ones since deleted, so deleting a Cube does not free a slot. `Retry-After` is the number of seconds until the oldest of those creates leaves the 60-minute window; it is absent when the plan allows no new Cubes at all. */
1090
+ 429: {
1091
+ headers: {
1092
+ /** @description Seconds to wait before retrying. */
1093
+ "Retry-After"?: number;
1094
+ [name: string]: unknown;
1095
+ };
1096
+ content?: never;
1097
+ };
1070
1098
  /** @description S3 finalization failed */
1071
1099
  502: {
1072
1100
  headers: {
@@ -1178,7 +1206,7 @@ interface paths {
1178
1206
  head?: never;
1179
1207
  /**
1180
1208
  * Update a Cube (rename, termination protection, idle auto-stop)
1181
- * @description Idempotent. The PATCHable fields are `name`, `terminationProtection` and `idleTimeoutMinutes`; send any of them. Sending a value the Cube already has returns the Cube unchanged and writes no audit row. Sending neither is a 400 rather than a no-op, so a typo in a field name cannot look like success. Renaming and changing the idle auto-stop timeout need the `cube.manage` permission, and changing termination protection needs `cube.termination_protection`; a request with several fields needs each permission. Every supplied field is validated before any is applied. Names are not unique within a space. Renaming is metadata only: the hostname inside a running Cube changes on its next cold restart. To change vCPU, RAM or disk use `POST .../resize`.
1209
+ * @description Idempotent. The PATCHable fields are `name`, `terminationProtection` and `idleTimeoutMinutes`; send any combination. Sending a value a field already has returns the Cube unchanged and writes no audit row. Sending none of them is a 400 rather than a no-op, so a typo in a field name cannot look like success. Renaming and changing the idle auto-stop timeout need the `cube.manage` permission and changing termination protection needs `cube.termination_protection`; a request with several fields needs every matching permission. Every supplied field is validated before any is applied. Names are not unique within a space. Renaming is metadata only: the hostname inside a running Cube changes on its next cold restart. To change vCPU, RAM or disk use `POST .../resize`.
1182
1210
  */
1183
1211
  patch: {
1184
1212
  parameters: {
@@ -2471,6 +2499,7 @@ interface components {
2471
2499
  };
2472
2500
  /** @description The hostname of the server currently hosting this Cube (e.g. `mango.krova.cloud`), shared by every Cube on that server. This is NOT the Cube's own SSH target — use `host` from GET .../ssh for that, which is the Cube's own stable hostname and survives migration to another server. Null when the Cube has no server assigned. Only present on the single-Cube GET; list and create responses omit it. */
2473
2501
  serverDomain?: string | null;
2502
+ /** @description The account to SSH in as: `ubuntu` or `debian` on Cubes created from images that ship a default user, `root` on Cubes created before that change or imported from a rootfs without one. The same value on create, GET and GET .../ssh (`user`). Recorded while the Cube provisions; the create response reports the image's default user, which is what the recorded value will be. */
2474
2503
  sshUser: string;
2475
2504
  /** @enum {string} */
2476
2505
  state: "pending" | "booting" | "running" | "stopped" | "stopping" | "resizing" | "error" | "deleted";
@@ -2802,7 +2831,8 @@ type CreateCubeInput = NonNullable<paths["/spaces/{spaceId}/cubes"]["post"]["req
2802
2831
  };
2803
2832
  /**
2804
2833
  * The dimensions to change in a Cube resize, in the units `POST /cubes` takes:
2805
- * `vcpu` and `diskGb` are integers, `ramGb` may be fractional (`0.5`). Send only
2834
+ * `vcpu`, `ramGb` and `diskGb` are whole numbers: the server accepts RAM in whole
2835
+ * GB steps (1 GB) only, so a fraction such as `0.5` is refused. Send only
2806
2836
  * what changes; omitted dimensions keep their current value. Disk can only grow.
2807
2837
  */
2808
2838
  type ResizeCubeInput = NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/resize"]["post"]["requestBody"]>["content"]["application/json"]["resources"];
@@ -2964,10 +2994,11 @@ declare class KrovaClient {
2964
2994
  * changed by this call. Pointing this at a port nothing is listening on
2965
2995
  * inside the Cube will silently make SSH unreachable; the default is 22.
2966
2996
  *
2967
- * The Krova Cloud API exposes no general Cube-mutation endpoint; the only
2968
- * mutable Cube field over the API is this port, via
2969
- * `PUT /spaces/{spaceId}/cubes/{cubeId}/ssh-port`. This helper maps to that
2970
- * endpoint. (Rename and resize have their own helpers: `cubes.rename` and `cubes.resize`.)
2997
+ * This helper maps to `PUT /spaces/{spaceId}/cubes/{cubeId}/ssh-port` and
2998
+ * changes only that port. The other mutable Cube fields have their own
2999
+ * helpers: `cubes.rename`, `cubes.setIdleTimeout` and
3000
+ * `cubes.setTerminationProtection` (all `PATCH /spaces/{spaceId}/cubes/{cubeId}`),
3001
+ * and `cubes.resize`.
2971
3002
  */
2972
3003
  update: (spaceId: string, cubeId: string, body: NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/ssh-port"]["put"]["requestBody"]>["content"]["application/json"]) => Promise<unknown>;
2973
3004
  /**
package/dist/index.cjs CHANGED
@@ -317,10 +317,11 @@ var KrovaClient = class {
317
317
  * changed by this call. Pointing this at a port nothing is listening on
318
318
  * inside the Cube will silently make SSH unreachable; the default is 22.
319
319
  *
320
- * The Krova Cloud API exposes no general Cube-mutation endpoint; the only
321
- * mutable Cube field over the API is this port, via
322
- * `PUT /spaces/{spaceId}/cubes/{cubeId}/ssh-port`. This helper maps to that
323
- * endpoint. (Rename and resize have their own helpers: `cubes.rename` and `cubes.resize`.)
320
+ * This helper maps to `PUT /spaces/{spaceId}/cubes/{cubeId}/ssh-port` and
321
+ * changes only that port. The other mutable Cube fields have their own
322
+ * helpers: `cubes.rename`, `cubes.setIdleTimeout` and
323
+ * `cubes.setTerminationProtection` (all `PATCH /spaces/{spaceId}/cubes/{cubeId}`),
324
+ * and `cubes.resize`.
324
325
  */
325
326
  update: async (spaceId, cubeId, body) => {
326
327
  const { data, error, response } = await this.raw.PUT("/spaces/{spaceId}/cubes/{cubeId}/ssh-port", {