@krovacloud/sdk 0.1.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -126,6 +126,187 @@ interface paths {
126
126
  patch?: never;
127
127
  trace?: never;
128
128
  };
129
+ "/auth/cli/start": {
130
+ parameters: {
131
+ query?: never;
132
+ header?: never;
133
+ path?: never;
134
+ cookie?: never;
135
+ };
136
+ get?: never;
137
+ put?: never;
138
+ /**
139
+ * Begin a CLI device-authorization login (RFC 8628)
140
+ * @description Public, unauthenticated. Mints a device code (returned once) and a short human user code, and returns the verification URIs the user opens in a browser to approve. The CLI then polls /auth/cli/poll. Rate-limited per client IP.
141
+ */
142
+ post: {
143
+ parameters: {
144
+ query?: never;
145
+ header?: never;
146
+ path?: never;
147
+ cookie?: never;
148
+ };
149
+ requestBody?: never;
150
+ responses: {
151
+ /** @description Device-authorization request created */
152
+ 200: {
153
+ headers: {
154
+ [name: string]: unknown;
155
+ };
156
+ content: {
157
+ "application/json": {
158
+ /** @description High-entropy code the CLI keeps secret and presents on each poll. Only its hash is stored server-side. */
159
+ deviceCode: string;
160
+ /** @description Short human-readable code (KROVA-XXXX-XXXX) the user confirms in the browser. */
161
+ userCode: string;
162
+ /**
163
+ * Format: uri
164
+ * @description Browser URL where the user approves.
165
+ */
166
+ verificationUri: string;
167
+ /**
168
+ * Format: uri
169
+ * @description verificationUri with the user code pre-filled.
170
+ */
171
+ verificationUriComplete: string;
172
+ /** @description Seconds to wait between polls. */
173
+ interval: number;
174
+ /** @description Seconds until the device code expires (~600). */
175
+ expiresIn: number;
176
+ };
177
+ };
178
+ };
179
+ 429: components["responses"]["RateLimited"];
180
+ /** @description Could not allocate a login code; retry */
181
+ 503: {
182
+ headers: {
183
+ [name: string]: unknown;
184
+ };
185
+ content?: never;
186
+ };
187
+ };
188
+ };
189
+ delete?: never;
190
+ options?: never;
191
+ head?: never;
192
+ patch?: never;
193
+ trace?: never;
194
+ };
195
+ "/auth/cli/poll": {
196
+ parameters: {
197
+ query?: never;
198
+ header?: never;
199
+ path?: never;
200
+ cookie?: never;
201
+ };
202
+ get?: never;
203
+ put?: never;
204
+ /**
205
+ * Poll for CLI device-authorization approval (RFC 8628)
206
+ * @description Public, unauthenticated. The CLI submits its deviceCode until the user approves or denies. On approval a real API key is minted ONCE, scoped to the approved Space and the approving user's membership, and returned a single time. Rate-limited per client IP.
207
+ */
208
+ post: {
209
+ parameters: {
210
+ query?: never;
211
+ header?: never;
212
+ path?: never;
213
+ cookie?: never;
214
+ };
215
+ requestBody: {
216
+ content: {
217
+ "application/json": {
218
+ /** @description The device code from /auth/cli/start. */
219
+ deviceCode: string;
220
+ };
221
+ };
222
+ };
223
+ responses: {
224
+ /** @description Approved — API key minted (returned once) */
225
+ 200: {
226
+ headers: {
227
+ [name: string]: unknown;
228
+ };
229
+ content: {
230
+ "application/json": {
231
+ /** @description The full API key. Shown once and never returned again — store it securely. */
232
+ apiKey: string;
233
+ /** @description The Space the key is scoped to. */
234
+ spaceId: string;
235
+ };
236
+ };
237
+ };
238
+ 400: components["responses"]["BadRequest"];
239
+ /** @description The user denied the login request */
240
+ 403: {
241
+ headers: {
242
+ [name: string]: unknown;
243
+ };
244
+ content?: never;
245
+ };
246
+ /** @description The device code expired, was already consumed, or is unknown */
247
+ 410: {
248
+ headers: {
249
+ [name: string]: unknown;
250
+ };
251
+ content?: never;
252
+ };
253
+ /** @description Authorization still pending — keep polling at the given interval */
254
+ 428: {
255
+ headers: {
256
+ [name: string]: unknown;
257
+ };
258
+ content?: never;
259
+ };
260
+ 429: components["responses"]["RateLimited"];
261
+ };
262
+ };
263
+ delete?: never;
264
+ options?: never;
265
+ head?: never;
266
+ patch?: never;
267
+ trace?: never;
268
+ };
269
+ "/space": {
270
+ parameters: {
271
+ query?: never;
272
+ header?: never;
273
+ path?: never;
274
+ cookie?: never;
275
+ };
276
+ /**
277
+ * Resolve the space this API key is scoped to
278
+ * @description Returns the single space the API key belongs to. Lets a client auto-resolve the space id from the key alone (no spaceId in the URL).
279
+ */
280
+ get: {
281
+ parameters: {
282
+ query?: never;
283
+ header?: never;
284
+ path?: never;
285
+ cookie?: never;
286
+ };
287
+ requestBody?: never;
288
+ responses: {
289
+ /** @description The key's space */
290
+ 200: {
291
+ headers: {
292
+ [name: string]: unknown;
293
+ };
294
+ content: {
295
+ "application/json": components["schemas"]["Space"];
296
+ };
297
+ };
298
+ 401: components["responses"]["Unauthorized"];
299
+ 404: components["responses"]["NotFound"];
300
+ };
301
+ };
302
+ put?: never;
303
+ post?: never;
304
+ delete?: never;
305
+ options?: never;
306
+ head?: never;
307
+ patch?: never;
308
+ trace?: never;
309
+ };
129
310
  "/spaces/{spaceId}/cubes": {
130
311
  parameters: {
131
312
  query?: never;
@@ -415,6 +596,49 @@ interface paths {
415
596
  patch?: never;
416
597
  trace?: never;
417
598
  };
599
+ "/spaces/{spaceId}/cubes/{cubeId}/ssh": {
600
+ parameters: {
601
+ query?: never;
602
+ header?: never;
603
+ path?: never;
604
+ cookie?: never;
605
+ };
606
+ /**
607
+ * Get a Cube's SSH connection info
608
+ * @description Host (server public IPv4), host SSH port, login user, and any captured SSH host public keys. `hostKeys` is empty until Krova captures cube host keys — clients fall back to trust-on-first-use until then.
609
+ */
610
+ get: {
611
+ parameters: {
612
+ query?: never;
613
+ header?: never;
614
+ path: {
615
+ spaceId: string;
616
+ cubeId: string;
617
+ };
618
+ cookie?: never;
619
+ };
620
+ requestBody?: never;
621
+ responses: {
622
+ /** @description SSH connection info */
623
+ 200: {
624
+ headers: {
625
+ [name: string]: unknown;
626
+ };
627
+ content: {
628
+ "application/json": components["schemas"]["CubeSshInfo"];
629
+ };
630
+ };
631
+ 404: components["responses"]["NotFound"];
632
+ };
633
+ };
634
+ put?: never;
635
+ post?: never;
636
+ delete?: never;
637
+ options?: never;
638
+ head?: never;
639
+ patch?: never;
640
+ trace?: never;
641
+ };
418
642
  "/spaces/{spaceId}/cubes/{cubeId}/domains": {
419
643
  parameters: {
420
644
  query?: never;
@@ -440,7 +664,11 @@ interface paths {
440
664
  headers: {
441
665
  [name: string]: unknown;
442
666
  };
443
- content?: never;
667
+ content: {
668
+ "application/json": {
669
+ domains: components["schemas"]["Domain"][];
670
+ };
671
+ };
444
672
  };
445
673
  };
446
674
  };
@@ -511,7 +739,11 @@ interface paths {
511
739
  headers: {
512
740
  [name: string]: unknown;
513
741
  };
514
- content?: never;
742
+ content: {
743
+ "application/json": {
744
+ domain: components["schemas"]["Domain"];
745
+ };
746
+ };
515
747
  };
516
748
  400: components["responses"]["BadRequest"];
517
749
  429: components["responses"]["RateLimited"];
@@ -552,7 +784,11 @@ interface paths {
552
784
  headers: {
553
785
  [name: string]: unknown;
554
786
  };
555
- content?: never;
787
+ content: {
788
+ "application/json": {
789
+ success: boolean;
790
+ };
791
+ };
556
792
  };
557
793
  404: components["responses"]["NotFound"];
558
794
  };
@@ -619,7 +855,11 @@ interface paths {
619
855
  headers: {
620
856
  [name: string]: unknown;
621
857
  };
622
- content?: never;
858
+ content: {
859
+ "application/json": {
860
+ domain: components["schemas"]["Domain"];
861
+ };
862
+ };
623
863
  };
624
864
  400: components["responses"]["BadRequest"];
625
865
  404: components["responses"]["NotFound"];
@@ -653,7 +893,11 @@ interface paths {
653
893
  headers: {
654
894
  [name: string]: unknown;
655
895
  };
656
- content?: never;
896
+ content: {
897
+ "application/json": {
898
+ tcpMappings: components["schemas"]["TcpMapping"][];
899
+ };
900
+ };
657
901
  };
658
902
  };
659
903
  };
@@ -686,7 +930,11 @@ interface paths {
686
930
  headers: {
687
931
  [name: string]: unknown;
688
932
  };
689
- content?: never;
933
+ content: {
934
+ "application/json": {
935
+ tcpMapping: components["schemas"]["TcpMapping"];
936
+ };
937
+ };
690
938
  };
691
939
  400: components["responses"]["BadRequest"];
692
940
  429: components["responses"]["RateLimited"];
@@ -727,7 +975,11 @@ interface paths {
727
975
  headers: {
728
976
  [name: string]: unknown;
729
977
  };
730
- content?: never;
978
+ content: {
979
+ "application/json": {
980
+ success: boolean;
981
+ };
982
+ };
731
983
  };
732
984
  404: components["responses"]["NotFound"];
733
985
  };
@@ -762,7 +1014,11 @@ interface paths {
762
1014
  headers: {
763
1015
  [name: string]: unknown;
764
1016
  };
765
- content?: never;
1017
+ content: {
1018
+ "application/json": {
1019
+ snapshots: components["schemas"]["Snapshot"][];
1020
+ };
1021
+ };
766
1022
  };
767
1023
  };
768
1024
  };
@@ -794,7 +1050,11 @@ interface paths {
794
1050
  headers: {
795
1051
  [name: string]: unknown;
796
1052
  };
797
- content?: never;
1053
+ content: {
1054
+ "application/json": {
1055
+ snapshot: components["schemas"]["Snapshot"];
1056
+ };
1057
+ };
798
1058
  };
799
1059
  429: components["responses"]["RateLimited"];
800
1060
  };
@@ -834,7 +1094,11 @@ interface paths {
834
1094
  headers: {
835
1095
  [name: string]: unknown;
836
1096
  };
837
- content?: never;
1097
+ content: {
1098
+ "application/json": {
1099
+ success: boolean;
1100
+ };
1101
+ };
838
1102
  };
839
1103
  404: components["responses"]["NotFound"];
840
1104
  };
@@ -877,7 +1141,11 @@ interface paths {
877
1141
  headers: {
878
1142
  [name: string]: unknown;
879
1143
  };
880
- content?: never;
1144
+ content: {
1145
+ "application/json": {
1146
+ success: boolean;
1147
+ };
1148
+ };
881
1149
  };
882
1150
  404: components["responses"]["NotFound"];
883
1151
  };
@@ -1098,7 +1366,11 @@ interface paths {
1098
1366
  headers: {
1099
1367
  [name: string]: unknown;
1100
1368
  };
1101
- content?: never;
1369
+ content: {
1370
+ "application/json": {
1371
+ success: boolean;
1372
+ };
1373
+ };
1102
1374
  };
1103
1375
  404: components["responses"]["NotFound"];
1104
1376
  /** @description Cannot cancel an import past the 'uploading' state */
@@ -1377,6 +1649,22 @@ interface paths {
1377
1649
  }
1378
1650
  interface components {
1379
1651
  schemas: {
1652
+ Space: {
1653
+ id: string;
1654
+ name: string;
1655
+ tier: string;
1656
+ /** Format: date-time */
1657
+ createdAt: string;
1658
+ };
1659
+ CubeSshInfo: {
1660
+ host: string | null;
1661
+ port: number;
1662
+ user: string;
1663
+ hostKeys: {
1664
+ type: string;
1665
+ key: string;
1666
+ }[];
1667
+ };
1380
1668
  Cube: {
1381
1669
  id: string;
1382
1670
  name: string;
@@ -1571,6 +1859,22 @@ type Image = components["schemas"]["Image"];
1571
1859
  type PricingTier = components["schemas"]["PricingTier"];
1572
1860
  /** Pagination envelope returned alongside a Cube list. */
1573
1861
  type Pagination = components["schemas"]["Pagination"];
1862
+ /** A Space — the tenancy an API key is scoped to. */
1863
+ type Space = components["schemas"]["Space"];
1864
+ /** A Cube's SSH connection info (host, port, user, and pinned host keys). */
1865
+ type CubeSshInfo = components["schemas"]["CubeSshInfo"];
1866
+ /** A custom domain attached to a Cube. */
1867
+ type Domain = components["schemas"]["Domain"];
1868
+ /** A snapshot of a Cube's disk. */
1869
+ type Snapshot = components["schemas"]["Snapshot"];
1870
+ /** A TCP port mapping exposing a Cube port on the host. */
1871
+ type TcpMapping = components["schemas"]["TcpMapping"];
1872
+ /** Request body for attaching a custom domain to a Cube. */
1873
+ type CreateDomainInput = NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/domains"]["post"]["requestBody"]>["content"]["application/json"];
1874
+ /** Request body for updating a custom domain's proxy settings. */
1875
+ type UpdateDomainInput = NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}"]["patch"]["requestBody"]>["content"]["application/json"];
1876
+ /** Request body for creating a TCP port mapping. */
1877
+ type CreateTcpMappingInput = NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings"]["post"]["requestBody"]>["content"]["application/json"];
1574
1878
  /** Default API base URL — the single `servers[0].url` from the OpenAPI spec. */
1575
1879
  declare const DEFAULT_BASE_URL = "https://krova.cloud/api/v1";
1576
1880
  /**
@@ -1685,6 +1989,120 @@ declare class KrovaClient {
1685
1989
  sleep: (spaceId: string, cubeId: string) => Promise<unknown>;
1686
1990
  /** Wake a sleeping Cube (asynchronous — wake is enqueued). */
1687
1991
  wake: (spaceId: string, cubeId: string) => Promise<unknown>;
1992
+ /**
1993
+ * Get a Cube's SSH connection info — host, port, login user, and (when
1994
+ * available) the pinned host public keys for strict host-key verification.
1995
+ */
1996
+ ssh: (spaceId: string, cubeId: string) => Promise<CubeSshInfo>;
1997
+ /**
1998
+ * Restore a Cube's disk from one of its {@link Snapshot}s (asynchronous —
1999
+ * the restore is enqueued). The Cube's current disk is replaced.
2000
+ */
2001
+ restore: (spaceId: string, cubeId: string, snapshotId: string) => Promise<{
2002
+ success: boolean;
2003
+ }>;
2004
+ };
2005
+ /**
2006
+ * Resolve the {@link Space} this API key is scoped to — so you don't have to
2007
+ * hardcode a `spaceId`. Handy right after constructing the client:
2008
+ *
2009
+ * @example
2010
+ * ```ts
2011
+ * const space = await krova.getSpace();
2012
+ * const cubes = await krova.cubes.list(space.id);
2013
+ * ```
2014
+ */
2015
+ getSpace(): Promise<Space>;
2016
+ readonly domains: {
2017
+ /** List the custom domains attached to a Cube. */
2018
+ list: (spaceId: string, cubeId: string) => Promise<Domain[]>;
2019
+ /** Attach a custom domain to a Cube. `domain` + `port` are required. */
2020
+ create: (spaceId: string, cubeId: string, body: CreateDomainInput) => Promise<Domain>;
2021
+ /** Update a domain's per-domain proxy settings. */
2022
+ update: (spaceId: string, cubeId: string, mappingId: string, body: UpdateDomainInput) => Promise<Domain>;
2023
+ /** Detach a custom domain from a Cube. */
2024
+ delete: (spaceId: string, cubeId: string, mappingId: string) => Promise<{
2025
+ success: boolean;
2026
+ }>;
2027
+ };
2028
+ readonly snapshots: {
2029
+ /** List a Cube's snapshots. */
2030
+ list: (spaceId: string, cubeId: string) => Promise<Snapshot[]>;
2031
+ /** Create a snapshot of a Cube's disk (asynchronous — enqueued). */
2032
+ create: (spaceId: string, cubeId: string, body?: {
2033
+ name?: string;
2034
+ }) => Promise<Snapshot>;
2035
+ /** Delete a snapshot. */
2036
+ delete: (spaceId: string, cubeId: string, snapshotId: string) => Promise<{
2037
+ success: boolean;
2038
+ }>;
2039
+ };
2040
+ readonly tcpMappings: {
2041
+ /** List a Cube's TCP port mappings. */
2042
+ list: (spaceId: string, cubeId: string) => Promise<TcpMapping[]>;
2043
+ /**
2044
+ * Create a TCP port mapping exposing a Cube port on the host. `cubePort` is
2045
+ * required; `whitelistIps` optionally restricts who can reach it.
2046
+ */
2047
+ create: (spaceId: string, cubeId: string, body: CreateTcpMappingInput) => Promise<TcpMapping>;
2048
+ /** Delete a TCP port mapping. */
2049
+ delete: (spaceId: string, cubeId: string, mappingId: string) => Promise<{
2050
+ success: boolean;
2051
+ }>;
2052
+ };
2053
+ readonly imports: {
2054
+ /**
2055
+ * Start importing a `.cube` archive into a new Cube. Returns the multipart
2056
+ * upload target (`importId`, `uploadId`, presigned `parts`, …). Upload the
2057
+ * archive to those URLs, then call {@link imports.complete}.
2058
+ */
2059
+ create: (spaceId: string, body: NonNullable<paths["/spaces/{spaceId}/cubes/imports"]["post"]["requestBody"]>["content"]["application/json"]) => Promise<{
2060
+ importId?: string | undefined;
2061
+ uploadId?: string | undefined;
2062
+ key?: string | undefined;
2063
+ chunkSizeBytes?: number | undefined;
2064
+ parts?: {
2065
+ partNumber?: number | undefined;
2066
+ url?: string | undefined;
2067
+ }[] | undefined;
2068
+ expiresAt?: string | undefined;
2069
+ } | undefined>;
2070
+ /** Get an in-progress or completed import by id. */
2071
+ get: (spaceId: string, importId: string) => Promise<{
2072
+ import?: {
2073
+ id?: string | undefined;
2074
+ name?: string | undefined;
2075
+ status?: "uploading" | "finalizing" | "provisioning" | "complete" | "failed" | "expired" | undefined;
2076
+ cubeId?: string | null | undefined;
2077
+ error?: string | null | undefined;
2078
+ createdAt?: string | undefined;
2079
+ updatedAt?: string | undefined;
2080
+ completedAt?: string | null | undefined;
2081
+ } | undefined;
2082
+ }>;
2083
+ /**
2084
+ * Finish an import after the archive has been uploaded — provisions the
2085
+ * Cube. Pass the uploaded `parts` (partNumber + etag) and the resolved
2086
+ * `config`.
2087
+ */
2088
+ complete: (spaceId: string, importId: string, body: NonNullable<paths["/spaces/{spaceId}/cubes/imports/{importId}/complete"]["post"]["requestBody"]>["content"]["application/json"]) => Promise<{
2089
+ importId?: string | undefined;
2090
+ cubeId?: string | undefined;
2091
+ status?: "provisioning" | undefined;
2092
+ } | undefined>;
2093
+ /** Cancel an in-progress import. */
2094
+ cancel: (spaceId: string, importId: string) => Promise<{
2095
+ success: boolean;
2096
+ } | undefined>;
2097
+ };
2098
+ readonly backups: {
2099
+ /** Get a time-limited download URL for a backup `.cube` archive. */
2100
+ download: (spaceId: string, backupId: string) => Promise<{
2101
+ url?: string | undefined;
2102
+ filename?: string | undefined;
2103
+ sizeBytes?: number | null | undefined;
2104
+ expiresAt?: string | undefined;
2105
+ } | undefined>;
1688
2106
  };
1689
2107
  readonly catalog: {
1690
2108
  /** List regions with available capacity. */
@@ -1773,4 +2191,4 @@ declare class KrovaError extends Error {
1773
2191
  */
1774
2192
  declare function krovaErrorFrom(response: Response, body: KrovaErrorBody | undefined): KrovaError;
1775
2193
 
1776
- export { type AuthScheme, type Cube, DEFAULT_BASE_URL, type Image, KrovaClient, type KrovaClientOptions, KrovaError, type KrovaErrorBody, type Pagination, type PricingTier, type Region, type components, krovaErrorFrom, type paths };
2194
+ export { type AuthScheme, type CreateDomainInput, type CreateTcpMappingInput, type Cube, type CubeSshInfo, DEFAULT_BASE_URL, type Domain, type Image, KrovaClient, type KrovaClientOptions, KrovaError, type KrovaErrorBody, type Pagination, type PricingTier, type Region, type Snapshot, type Space, type TcpMapping, type UpdateDomainInput, type components, krovaErrorFrom, type paths };