@krovacloud/sdk 0.3.9 → 0.3.10

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 CHANGED
@@ -120,7 +120,7 @@ const cube = await krova.cubes.create(
120
120
  image: "ubuntu-24.04",
121
121
  resources: { vcpu: 2, ramGb: 4, diskGb: 40 },
122
122
  sshPublicKey: "ssh-ed25519 AAAA... you@host",
123
- region: "us-east", // optional — slug from catalog.regions()
123
+ region: "us", // optional — slug from catalog.regions()
124
124
  userData: "#cloud-config\n", // optional — cloud-init (max 16 KB)
125
125
  },
126
126
  { idempotencyKey: "deploy-2026-07-01" },
@@ -301,6 +301,34 @@ The package ships its own type declarations — no `@types/*` install needed. `C
301
301
 
302
302
  See [CONTRIBUTING.md](https://github.com/krovacloud/krova-node/blob/main/CONTRIBUTING.md). Report security issues privately per [SECURITY.md](https://github.com/krovacloud/krova-node/blob/main/SECURITY.md).
303
303
 
304
+
305
+ ## Custom domains: HTTPS to the Cube
306
+
307
+ By default the edge reaches your Cube over cleartext HTTP — visitors are on
308
+ HTTPS either way, since TLS terminates at the edge. Set `originScheme: "https"`
309
+ when the Cube terminates TLS *itself*: a control panel holding its own
310
+ certificate, or an app listening on HTTPS, answers plain HTTP with a redirect
311
+ and cannot be served over cleartext at all.
312
+
313
+ ```ts
314
+ // When attaching the domain…
315
+ await krova.domains.create(spaceId, cubeId, {
316
+ domain: "panel.example.com",
317
+ port: 443,
318
+ originScheme: "https",
319
+ });
320
+
321
+ // …or switch an already-attached domain over.
322
+ await krova.domains.update(spaceId, cubeId, mappingId, {
323
+ originScheme: "https",
324
+ });
325
+ ```
326
+
327
+ The dial port is derived: `https` on the default port 80 connects on 443, and a
328
+ deliberate custom port is honoured exactly. The setting is verified against the
329
+ Cube before it is applied — if the domain does not serve, the route is left on
330
+ `http`.
331
+
304
332
  ## License
305
333
 
306
334
  [MIT](./LICENSE) © 2026 Krova Inc.
package/dist/index.d.cts CHANGED
@@ -557,7 +557,7 @@ interface paths {
557
557
  put?: never;
558
558
  /**
559
559
  * Restart a running Cube
560
- * @description Cold-restarts the Cube: the hypervisor process is stopped and relaunched, so the Cube boots against the host's current kernel. This is how a Cube picks up a refreshed guest kernel after a platform image update — a `reboot` issued inside the Cube cannot do it, because the kernel is supplied externally by the host. Disk state is preserved; only the kernel changes. The Cube must be `running` (a stopped Cube already picks up the latest kernel when started). Concurrent restarts of the same Cube are rejected with 409 rather than queued twice.
560
+ * @description Cold-restarts the Cube: the hypervisor process is stopped and relaunched, so the Cube boots against the host's current kernel. This is how a Cube picks up a refreshed guest kernel after a platform image update — a `reboot` issued inside the Cube cannot do it, because the kernel is supplied externally by the host. Disk state is preserved; only the kernel changes. Cube must be `running` (a stopped Cube already picks up the latest kernel when started). Concurrent restarts of the same Cube are rejected with 409 rather than queued twice.
561
561
  */
562
562
  post: {
563
563
  parameters: {
@@ -744,7 +744,7 @@ interface paths {
744
744
  "application/json": {
745
745
  /** @description The hostname to attach, e.g. app.example.com */
746
746
  domain: string;
747
- /** @description The Cube port the domain proxies to. */
747
+ /** @description Cube port the domain proxies to. */
748
748
  port: number;
749
749
  /**
750
750
  * @description enforced = proxy sets platform security headers (HSTS, X-Frame-Options, …); app_managed = the app's own headers pass through. Default enforced.
@@ -769,6 +769,26 @@ interface paths {
769
769
  } | null;
770
770
  /** @description Max request body size (MB). Null = unlimited (default). */
771
771
  maxRequestBodyMb?: number | null;
772
+ /** @description Per-domain CORS policy, applied at the edge. Null (default) = CORS disabled and no Access-Control-* header is emitted anywhere. When set, the proxy answers OPTIONS preflight itself (204, the cube is never involved) and adds the headers to normal AND error responses, so a cross-origin request to a failing or sleeping cube is never CORS-masked. */
773
+ corsConfig?: {
774
+ /** @description Exact scheme://host[:port] origins (no path, query or trailing slash), or the single-element wildcard ["*"]. "*" and allowCredentials are mutually exclusive. */
775
+ allowedOrigins: string[];
776
+ /** @description Allowed methods. Omitted = GET, POST, PUT, PATCH, DELETE, OPTIONS. */
777
+ allowedMethods?: string[];
778
+ /** @description Allowed request headers. Omitted/empty = echo the preflight's Access-Control-Request-Headers. */
779
+ allowedHeaders?: string[];
780
+ /** @description Response headers exposed to JS. Omitted/empty = none. */
781
+ exposedHeaders?: string[];
782
+ /** @description Send Access-Control-Allow-Credentials: true. Rejected together with the "*" origin. */
783
+ allowCredentials?: boolean;
784
+ /** @description Preflight cache TTL. Default 600; 86400 is Chromium's hard cap. */
785
+ maxAgeSeconds?: number;
786
+ } | null;
787
+ /**
788
+ * @description Scheme the edge speaks to the CUBE on the backend hop. http (default) = cleartext. https = the cube terminates TLS itself (a control panel holding its own certificate, or an app listening on HTTPS) and answers plain HTTP with a redirect, so it cannot be reached over cleartext at all. Visitors are on HTTPS either way. The dial port is derived: https on the default port 80 connects on 443; a deliberate custom port is honoured exactly. Verified against the cube before it is applied — if the domain does not serve, the route is left on http.
789
+ * @enum {string}
790
+ */
791
+ originScheme?: "http" | "https";
772
792
  /** @description Edge gzip/zstd compression. Default false (domains behind a CDN are already compressed there). */
773
793
  responseCompression?: boolean;
774
794
  /** @description Visitor IP/CIDR allow-list (v4+v6). Non-empty ⇒ only these reach the app. Null/empty = open. */
@@ -885,6 +905,26 @@ interface paths {
885
905
  } | null;
886
906
  /** @description Max request body size (MB). Null = unlimited (default). */
887
907
  maxRequestBodyMb?: number | null;
908
+ /** @description Per-domain CORS policy, applied at the edge. Null (default) = CORS disabled and no Access-Control-* header is emitted anywhere. When set, the proxy answers OPTIONS preflight itself (204, the cube is never involved) and adds the headers to normal AND error responses, so a cross-origin request to a failing or sleeping cube is never CORS-masked. */
909
+ corsConfig?: {
910
+ /** @description Exact scheme://host[:port] origins (no path, query or trailing slash), or the single-element wildcard ["*"]. "*" and allowCredentials are mutually exclusive. */
911
+ allowedOrigins: string[];
912
+ /** @description Allowed methods. Omitted = GET, POST, PUT, PATCH, DELETE, OPTIONS. */
913
+ allowedMethods?: string[];
914
+ /** @description Allowed request headers. Omitted/empty = echo the preflight's Access-Control-Request-Headers. */
915
+ allowedHeaders?: string[];
916
+ /** @description Response headers exposed to JS. Omitted/empty = none. */
917
+ exposedHeaders?: string[];
918
+ /** @description Send Access-Control-Allow-Credentials: true. Rejected together with the "*" origin. */
919
+ allowCredentials?: boolean;
920
+ /** @description Preflight cache TTL. Default 600; 86400 is Chromium's hard cap. */
921
+ maxAgeSeconds?: number;
922
+ } | null;
923
+ /**
924
+ * @description Scheme the edge speaks to the CUBE on the backend hop. http (default) = cleartext. https = the cube terminates TLS itself (a control panel holding its own certificate, or an app listening on HTTPS) and answers plain HTTP with a redirect, so it cannot be reached over cleartext at all. Visitors are on HTTPS either way. The dial port is derived: https on the default port 80 connects on 443; a deliberate custom port is honoured exactly. Verified against the cube before it is applied — if the domain does not serve, the route is left on http.
925
+ * @enum {string}
926
+ */
927
+ originScheme?: "http" | "https";
888
928
  /** @description Edge gzip/zstd compression. Default false (domains behind a CDN are already compressed there). */
889
929
  responseCompression?: boolean;
890
930
  /** @description Visitor IP/CIDR allow-list (v4+v6). Non-empty ⇒ only these reach the app. Null/empty = open. */
package/dist/index.d.ts CHANGED
@@ -557,7 +557,7 @@ interface paths {
557
557
  put?: never;
558
558
  /**
559
559
  * Restart a running Cube
560
- * @description Cold-restarts the Cube: the hypervisor process is stopped and relaunched, so the Cube boots against the host's current kernel. This is how a Cube picks up a refreshed guest kernel after a platform image update — a `reboot` issued inside the Cube cannot do it, because the kernel is supplied externally by the host. Disk state is preserved; only the kernel changes. The Cube must be `running` (a stopped Cube already picks up the latest kernel when started). Concurrent restarts of the same Cube are rejected with 409 rather than queued twice.
560
+ * @description Cold-restarts the Cube: the hypervisor process is stopped and relaunched, so the Cube boots against the host's current kernel. This is how a Cube picks up a refreshed guest kernel after a platform image update — a `reboot` issued inside the Cube cannot do it, because the kernel is supplied externally by the host. Disk state is preserved; only the kernel changes. Cube must be `running` (a stopped Cube already picks up the latest kernel when started). Concurrent restarts of the same Cube are rejected with 409 rather than queued twice.
561
561
  */
562
562
  post: {
563
563
  parameters: {
@@ -744,7 +744,7 @@ interface paths {
744
744
  "application/json": {
745
745
  /** @description The hostname to attach, e.g. app.example.com */
746
746
  domain: string;
747
- /** @description The Cube port the domain proxies to. */
747
+ /** @description Cube port the domain proxies to. */
748
748
  port: number;
749
749
  /**
750
750
  * @description enforced = proxy sets platform security headers (HSTS, X-Frame-Options, …); app_managed = the app's own headers pass through. Default enforced.
@@ -769,6 +769,26 @@ interface paths {
769
769
  } | null;
770
770
  /** @description Max request body size (MB). Null = unlimited (default). */
771
771
  maxRequestBodyMb?: number | null;
772
+ /** @description Per-domain CORS policy, applied at the edge. Null (default) = CORS disabled and no Access-Control-* header is emitted anywhere. When set, the proxy answers OPTIONS preflight itself (204, the cube is never involved) and adds the headers to normal AND error responses, so a cross-origin request to a failing or sleeping cube is never CORS-masked. */
773
+ corsConfig?: {
774
+ /** @description Exact scheme://host[:port] origins (no path, query or trailing slash), or the single-element wildcard ["*"]. "*" and allowCredentials are mutually exclusive. */
775
+ allowedOrigins: string[];
776
+ /** @description Allowed methods. Omitted = GET, POST, PUT, PATCH, DELETE, OPTIONS. */
777
+ allowedMethods?: string[];
778
+ /** @description Allowed request headers. Omitted/empty = echo the preflight's Access-Control-Request-Headers. */
779
+ allowedHeaders?: string[];
780
+ /** @description Response headers exposed to JS. Omitted/empty = none. */
781
+ exposedHeaders?: string[];
782
+ /** @description Send Access-Control-Allow-Credentials: true. Rejected together with the "*" origin. */
783
+ allowCredentials?: boolean;
784
+ /** @description Preflight cache TTL. Default 600; 86400 is Chromium's hard cap. */
785
+ maxAgeSeconds?: number;
786
+ } | null;
787
+ /**
788
+ * @description Scheme the edge speaks to the CUBE on the backend hop. http (default) = cleartext. https = the cube terminates TLS itself (a control panel holding its own certificate, or an app listening on HTTPS) and answers plain HTTP with a redirect, so it cannot be reached over cleartext at all. Visitors are on HTTPS either way. The dial port is derived: https on the default port 80 connects on 443; a deliberate custom port is honoured exactly. Verified against the cube before it is applied — if the domain does not serve, the route is left on http.
789
+ * @enum {string}
790
+ */
791
+ originScheme?: "http" | "https";
772
792
  /** @description Edge gzip/zstd compression. Default false (domains behind a CDN are already compressed there). */
773
793
  responseCompression?: boolean;
774
794
  /** @description Visitor IP/CIDR allow-list (v4+v6). Non-empty ⇒ only these reach the app. Null/empty = open. */
@@ -885,6 +905,26 @@ interface paths {
885
905
  } | null;
886
906
  /** @description Max request body size (MB). Null = unlimited (default). */
887
907
  maxRequestBodyMb?: number | null;
908
+ /** @description Per-domain CORS policy, applied at the edge. Null (default) = CORS disabled and no Access-Control-* header is emitted anywhere. When set, the proxy answers OPTIONS preflight itself (204, the cube is never involved) and adds the headers to normal AND error responses, so a cross-origin request to a failing or sleeping cube is never CORS-masked. */
909
+ corsConfig?: {
910
+ /** @description Exact scheme://host[:port] origins (no path, query or trailing slash), or the single-element wildcard ["*"]. "*" and allowCredentials are mutually exclusive. */
911
+ allowedOrigins: string[];
912
+ /** @description Allowed methods. Omitted = GET, POST, PUT, PATCH, DELETE, OPTIONS. */
913
+ allowedMethods?: string[];
914
+ /** @description Allowed request headers. Omitted/empty = echo the preflight's Access-Control-Request-Headers. */
915
+ allowedHeaders?: string[];
916
+ /** @description Response headers exposed to JS. Omitted/empty = none. */
917
+ exposedHeaders?: string[];
918
+ /** @description Send Access-Control-Allow-Credentials: true. Rejected together with the "*" origin. */
919
+ allowCredentials?: boolean;
920
+ /** @description Preflight cache TTL. Default 600; 86400 is Chromium's hard cap. */
921
+ maxAgeSeconds?: number;
922
+ } | null;
923
+ /**
924
+ * @description Scheme the edge speaks to the CUBE on the backend hop. http (default) = cleartext. https = the cube terminates TLS itself (a control panel holding its own certificate, or an app listening on HTTPS) and answers plain HTTP with a redirect, so it cannot be reached over cleartext at all. Visitors are on HTTPS either way. The dial port is derived: https on the default port 80 connects on 443; a deliberate custom port is honoured exactly. Verified against the cube before it is applied — if the domain does not serve, the route is left on http.
925
+ * @enum {string}
926
+ */
927
+ originScheme?: "http" | "https";
888
928
  /** @description Edge gzip/zstd compression. Default false (domains behind a CDN are already compressed there). */
889
929
  responseCompression?: boolean;
890
930
  /** @description Visitor IP/CIDR allow-list (v4+v6). Non-empty ⇒ only these reach the app. Null/empty = open. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krovacloud/sdk",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
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",