@krovacloud/sdk 0.4.5 → 0.4.7
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/README.md +13 -1
- package/dist/index.d.cts +14 -5
- package/dist/index.d.ts +14 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,6 +54,13 @@ console.log(` ${cube.resources.vcpu} vCPU / ${cube.resources.ramGb} GB RAM, ima
|
|
|
54
54
|
// Cubes from images that ship a default user (both with passwordless sudo)
|
|
55
55
|
// and "root" on Cubes created before that change, so the image id cannot
|
|
56
56
|
// tell you. `cube.sshUser` on the Cube object carries the same value.
|
|
57
|
+
//
|
|
58
|
+
// `ssh.host` is the Cube's own stable SSH hostname — it survives migration
|
|
59
|
+
// to another server, falling back to the server's public IPv4 only when the
|
|
60
|
+
// Cube has no DNS record yet. If you pin host keys in your own known_hosts
|
|
61
|
+
// (as the CLI does), expect a one-time re-pin for any Cube you'd previously
|
|
62
|
+
// connected to by IP: the host string changes from an IP to a name, so it's
|
|
63
|
+
// a new known_hosts entry, not a compromised host.
|
|
57
64
|
const ssh = await krova.cubes.ssh("space_123", cube.id);
|
|
58
65
|
console.log(`ssh ${ssh.user}@${ssh.host} -p ${ssh.port}`);
|
|
59
66
|
|
|
@@ -115,7 +122,7 @@ Ergonomic helpers for the Cube lifecycle. Each unwraps the response body and thr
|
|
|
115
122
|
| `delete` | `(spaceId, cubeId)` | enqueues deletion |
|
|
116
123
|
| `powerOff` | `(spaceId, cubeId)` | enqueues a power-off |
|
|
117
124
|
| `wake` | `(spaceId, cubeId)` | enqueues a start |
|
|
118
|
-
| `ssh` | `(spaceId, cubeId)` | the Cube's SSH connection info
|
|
125
|
+
| `ssh` | `(spaceId, cubeId)` | the Cube's SSH connection info — `host` is its stable SSH hostname (falls back to the server's public IPv4 with no DNS record yet), plus `port`, `user`, `hostKeys` |
|
|
119
126
|
| `restore` | `(spaceId, cubeId, snapshotId)` | enqueues a restore — replaces the Cube's disk from a snapshot |
|
|
120
127
|
|
|
121
128
|
```ts
|
|
@@ -204,6 +211,11 @@ const mapping = await krova.tcpMappings.create("space_123", "cube_123", {
|
|
|
204
211
|
cubePort: 5432,
|
|
205
212
|
whitelistedIps: ["203.0.113.4/32"],
|
|
206
213
|
});
|
|
214
|
+
// `mapping.host` is where to connect — the Cube's OWN stable hostname, which
|
|
215
|
+
// survives migration to another server. Use it rather than the Cube's
|
|
216
|
+
// `serverDomain`, which is the current physical host and changes when the
|
|
217
|
+
// Cube moves. Null only when the Cube has no server assigned.
|
|
218
|
+
console.log(`psql -h ${mapping.host} -p ${mapping.hostPort}`);
|
|
207
219
|
await krova.tcpMappings.list("space_123", "cube_123");
|
|
208
220
|
await krova.tcpMappings.delete("space_123", "cube_123", mapping.id);
|
|
209
221
|
```
|
package/dist/index.d.cts
CHANGED
|
@@ -654,7 +654,7 @@ interface paths {
|
|
|
654
654
|
};
|
|
655
655
|
/**
|
|
656
656
|
* Get a Cube's SSH connection info
|
|
657
|
-
* @description
|
|
657
|
+
* @description `host` is the Cube's own stable SSH hostname, which survives migration to another server — it falls back to the server's public IPv4 when the Cube has no DNS record yet. Also returns the host SSH port, login user, and the Cube's captured SSH host public keys. **Use `user` rather than assuming a username** — it is `ubuntu` or `debian` on Cubes created from images that ship a default user, and `root` on Cubes created before that change or imported from a rootfs without one. `hostKeys` is empty only until the reachability cron makes its first capture; clients fall back to trust-on-first-use until then, and pin strictly afterwards.
|
|
658
658
|
*/
|
|
659
659
|
get: {
|
|
660
660
|
parameters: {
|
|
@@ -1072,13 +1072,17 @@ interface paths {
|
|
|
1072
1072
|
cubePort: number;
|
|
1073
1073
|
/** @description Optional human label for the mapping. */
|
|
1074
1074
|
label?: string;
|
|
1075
|
-
/**
|
|
1076
|
-
*
|
|
1075
|
+
/**
|
|
1076
|
+
* @description Whether the mapping also forwards UDP traffic on the same host port, in addition to TCP. Optional; defaults to true when omitted.
|
|
1077
|
+
* @default true
|
|
1078
|
+
*/
|
|
1077
1079
|
udpEnabled?: boolean;
|
|
1078
1080
|
/** @description IPs/CIDRs allowed to reach the published port. Omit or send an empty array to leave the port open to the internet. */
|
|
1079
1081
|
whitelistedIps?: string[];
|
|
1080
|
-
/**
|
|
1081
|
-
*
|
|
1082
|
+
/**
|
|
1083
|
+
* @deprecated
|
|
1084
|
+
* @description DEPRECATED alias for `whitelistedIps`, accepted for backwards compatibility. `whitelistedIps` wins if both are sent. Use `whitelistedIps` in new code.
|
|
1085
|
+
*/
|
|
1082
1086
|
whitelistIps?: string[];
|
|
1083
1087
|
};
|
|
1084
1088
|
};
|
|
@@ -1840,6 +1844,8 @@ interface components {
|
|
|
1840
1844
|
image: string;
|
|
1841
1845
|
sshUser: string;
|
|
1842
1846
|
costPerHour: number;
|
|
1847
|
+
/** @description The hostname of the server currently hosting this Cube (e.g. `mango.krova.cloud`). 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. */
|
|
1848
|
+
serverDomain?: string | null;
|
|
1843
1849
|
/** Format: date-time */
|
|
1844
1850
|
createdAt: string;
|
|
1845
1851
|
/** Format: date-time */
|
|
@@ -1941,6 +1947,8 @@ interface components {
|
|
|
1941
1947
|
id: string;
|
|
1942
1948
|
cubeId: string;
|
|
1943
1949
|
cubePort: number;
|
|
1950
|
+
/** @description Where to connect for this mapping: `host:hostPort`. The Cube's own stable hostname, which survives migration to another server, falling back to the server's public IP when the Cube has no DNS record yet. Identical to `host` from GET .../ssh, and the same value for every mapping on a Cube. Null only when the Cube has no server assigned, in which case there is nowhere to connect. Do NOT use `serverDomain` from the Cube object — that is the current physical host and changes when the Cube moves. */
|
|
1951
|
+
host: string | null;
|
|
1944
1952
|
hostPort: number;
|
|
1945
1953
|
label: string | null;
|
|
1946
1954
|
status: string;
|
|
@@ -2171,6 +2179,7 @@ declare class KrovaClient {
|
|
|
2171
2179
|
image: string;
|
|
2172
2180
|
sshUser: string;
|
|
2173
2181
|
costPerHour: number;
|
|
2182
|
+
serverDomain?: string | null;
|
|
2174
2183
|
createdAt: string;
|
|
2175
2184
|
updatedAt: string;
|
|
2176
2185
|
}[];
|
package/dist/index.d.ts
CHANGED
|
@@ -654,7 +654,7 @@ interface paths {
|
|
|
654
654
|
};
|
|
655
655
|
/**
|
|
656
656
|
* Get a Cube's SSH connection info
|
|
657
|
-
* @description
|
|
657
|
+
* @description `host` is the Cube's own stable SSH hostname, which survives migration to another server — it falls back to the server's public IPv4 when the Cube has no DNS record yet. Also returns the host SSH port, login user, and the Cube's captured SSH host public keys. **Use `user` rather than assuming a username** — it is `ubuntu` or `debian` on Cubes created from images that ship a default user, and `root` on Cubes created before that change or imported from a rootfs without one. `hostKeys` is empty only until the reachability cron makes its first capture; clients fall back to trust-on-first-use until then, and pin strictly afterwards.
|
|
658
658
|
*/
|
|
659
659
|
get: {
|
|
660
660
|
parameters: {
|
|
@@ -1072,13 +1072,17 @@ interface paths {
|
|
|
1072
1072
|
cubePort: number;
|
|
1073
1073
|
/** @description Optional human label for the mapping. */
|
|
1074
1074
|
label?: string;
|
|
1075
|
-
/**
|
|
1076
|
-
*
|
|
1075
|
+
/**
|
|
1076
|
+
* @description Whether the mapping also forwards UDP traffic on the same host port, in addition to TCP. Optional; defaults to true when omitted.
|
|
1077
|
+
* @default true
|
|
1078
|
+
*/
|
|
1077
1079
|
udpEnabled?: boolean;
|
|
1078
1080
|
/** @description IPs/CIDRs allowed to reach the published port. Omit or send an empty array to leave the port open to the internet. */
|
|
1079
1081
|
whitelistedIps?: string[];
|
|
1080
|
-
/**
|
|
1081
|
-
*
|
|
1082
|
+
/**
|
|
1083
|
+
* @deprecated
|
|
1084
|
+
* @description DEPRECATED alias for `whitelistedIps`, accepted for backwards compatibility. `whitelistedIps` wins if both are sent. Use `whitelistedIps` in new code.
|
|
1085
|
+
*/
|
|
1082
1086
|
whitelistIps?: string[];
|
|
1083
1087
|
};
|
|
1084
1088
|
};
|
|
@@ -1840,6 +1844,8 @@ interface components {
|
|
|
1840
1844
|
image: string;
|
|
1841
1845
|
sshUser: string;
|
|
1842
1846
|
costPerHour: number;
|
|
1847
|
+
/** @description The hostname of the server currently hosting this Cube (e.g. `mango.krova.cloud`). 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. */
|
|
1848
|
+
serverDomain?: string | null;
|
|
1843
1849
|
/** Format: date-time */
|
|
1844
1850
|
createdAt: string;
|
|
1845
1851
|
/** Format: date-time */
|
|
@@ -1941,6 +1947,8 @@ interface components {
|
|
|
1941
1947
|
id: string;
|
|
1942
1948
|
cubeId: string;
|
|
1943
1949
|
cubePort: number;
|
|
1950
|
+
/** @description Where to connect for this mapping: `host:hostPort`. The Cube's own stable hostname, which survives migration to another server, falling back to the server's public IP when the Cube has no DNS record yet. Identical to `host` from GET .../ssh, and the same value for every mapping on a Cube. Null only when the Cube has no server assigned, in which case there is nowhere to connect. Do NOT use `serverDomain` from the Cube object — that is the current physical host and changes when the Cube moves. */
|
|
1951
|
+
host: string | null;
|
|
1944
1952
|
hostPort: number;
|
|
1945
1953
|
label: string | null;
|
|
1946
1954
|
status: string;
|
|
@@ -2171,6 +2179,7 @@ declare class KrovaClient {
|
|
|
2171
2179
|
image: string;
|
|
2172
2180
|
sshUser: string;
|
|
2173
2181
|
costPerHour: number;
|
|
2182
|
+
serverDomain?: string | null;
|
|
2174
2183
|
createdAt: string;
|
|
2175
2184
|
updatedAt: string;
|
|
2176
2185
|
}[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krovacloud/sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
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",
|