@krovacloud/sdk 0.4.8 → 0.4.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/dist/index.d.cts CHANGED
@@ -372,6 +372,8 @@ interface paths {
372
372
  region?: string;
373
373
  /** @description cloud-init script (max 16 KB, optional). */
374
374
  userData?: string;
375
+ /** @description Opt this Cube out of customer-initiated deletion (default `false`). Power-off, wake, restart, snapshot, and restore remain allowed regardless. Toggleable later via PATCH /spaces/{spaceId}/cubes/{cubeId} with `{ terminationProtection: boolean }`. */
376
+ terminationProtection?: boolean;
375
377
  };
376
378
  };
377
379
  };
@@ -465,7 +467,40 @@ interface paths {
465
467
  };
466
468
  options?: never;
467
469
  head?: never;
468
- patch?: never;
470
+ /** Update a Cube (toggle termination protection) */
471
+ patch: {
472
+ parameters: {
473
+ query?: never;
474
+ header?: never;
475
+ path: {
476
+ spaceId: string;
477
+ cubeId: string;
478
+ };
479
+ cookie?: never;
480
+ };
481
+ requestBody: {
482
+ content: {
483
+ "application/json": {
484
+ terminationProtection?: boolean;
485
+ };
486
+ };
487
+ };
488
+ responses: {
489
+ /** @description Cube updated */
490
+ 200: {
491
+ headers: {
492
+ [name: string]: unknown;
493
+ };
494
+ content: {
495
+ "application/json": {
496
+ cube: components["schemas"]["Cube"];
497
+ };
498
+ };
499
+ };
500
+ 404: components["responses"]["NotFound"];
501
+ 429: components["responses"]["RateLimited"];
502
+ };
503
+ };
469
504
  trace?: never;
470
505
  };
471
506
  "/spaces/{spaceId}/cubes/{cubeId}/power-off": {
@@ -1846,6 +1881,14 @@ interface components {
1846
1881
  costPerHour: number;
1847
1882
  /** @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
1883
  serverDomain?: string | null;
1884
+ /** @description Whether this Cube is locked against customer-initiated deletion. Per-Cube, opt-in, default `false`. Power-off, wake, restart, snapshot, and restore remain allowed regardless. The two audit fields are populated whenever the flag is on. */
1885
+ terminationProtection: boolean;
1886
+ /** @description When `terminationProtection` last changed. `null` until the flag is first set, then tracked on every toggle.
1887
+ *
1888
+ * Format: date-time */
1889
+ terminationProtectionChangedAt?: string | null;
1890
+ /** @description Who last changed `terminationProtection`. `"user:<id>"` for customer toggles, `"admin:<id>"` for operator changes. `null` until the flag is first set. */
1891
+ terminationProtectionChangedBy?: string | null;
1849
1892
  /** Format: date-time */
1850
1893
  createdAt: string;
1851
1894
  /** Format: date-time */
@@ -2103,6 +2146,47 @@ type CreateDomainInput = NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/dom
2103
2146
  type UpdateDomainInput = NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}"]["patch"]["requestBody"]>["content"]["application/json"];
2104
2147
  /** Request body for creating a TCP port mapping. */
2105
2148
  type CreateTcpMappingInput = NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings"]["post"]["requestBody"]>["content"]["application/json"];
2149
+ /**
2150
+ * Request body for `POST /spaces/{spaceId}/cubes` as defined in the OpenAPI
2151
+ * spec, with `terminationProtection` intersected on because the bundled spec
2152
+ * does not declare the field but the v1 API accepts it. A boolean `false` (or
2153
+ * omission) leaves the Cube in the documented default-unprotected state; `true`
2154
+ * opts the Cube out of customer-initiated deletion until the flag is toggled
2155
+ * back via `cubes.setTerminationProtection`.
2156
+ */
2157
+ type CreateCubeInput = NonNullable<paths["/spaces/{spaceId}/cubes"]["post"]["requestBody"]>["content"]["application/json"] & {
2158
+ /** Opt this Cube out of customer-initiated deletion (default `false`). */
2159
+ terminationProtection?: boolean;
2160
+ };
2161
+ /**
2162
+ * A webhook endpoint subscribed to Space events.
2163
+ *
2164
+ * ⛔ Runtime discrepancy: the bundled OpenAPI spec does not declare
2165
+ * `description`, but `GET /spaces/{spaceId}/webhooks/{endpointId}` includes
2166
+ * it as `string | null`. The schema-derived type is extended here so callers
2167
+ * reading a single webhook see the field; it is optional so list responses
2168
+ * (which omit it) still typecheck.
2169
+ */
2170
+ type Webhook = components["schemas"]["Webhook"] & {
2171
+ description?: string | null;
2172
+ };
2173
+ /** A recorded webhook delivery attempt (last 30 days of history). */
2174
+ type WebhookDelivery = components["schemas"]["WebhookDelivery"];
2175
+ /**
2176
+ * Request body for creating a webhook endpoint.
2177
+ *
2178
+ * Derived from `paths["/spaces/{spaceId}/webhooks"]["post"]` exactly like
2179
+ * {@link CreateDomainInput}; `description` is intersected on because the
2180
+ * bundled spec omits it but the runtime accepts it.
2181
+ */
2182
+ type CreateWebhookInput = NonNullable<paths["/spaces/{spaceId}/webhooks"]["post"]["requestBody"]>["content"]["application/json"] & {
2183
+ /** Optional human-readable label shown on the endpoint. */
2184
+ description?: string;
2185
+ };
2186
+ /** A webhook plus its signing secret. Returned ONLY by {@link KrovaClient.webhooks}.create. */
2187
+ type WebhookWithSecret = Webhook & {
2188
+ secret: string;
2189
+ };
2106
2190
  /** Default API base URL — the single `servers[0].url` from the OpenAPI spec. */
2107
2191
  declare const DEFAULT_BASE_URL = "https://krova.cloud/api/v1";
2108
2192
  /**
@@ -2180,6 +2264,9 @@ declare class KrovaClient {
2180
2264
  sshUser: string;
2181
2265
  costPerHour: number;
2182
2266
  serverDomain?: string | null;
2267
+ terminationProtection: boolean;
2268
+ terminationProtectionChangedAt?: string | null;
2269
+ terminationProtectionChangedBy?: string | null;
2183
2270
  createdAt: string;
2184
2271
  updatedAt: string;
2185
2272
  }[];
@@ -2193,11 +2280,15 @@ declare class KrovaClient {
2193
2280
  /**
2194
2281
  * Create a Cube. Returns the created {@link Cube}.
2195
2282
  *
2283
+ * Set `terminationProtection: true` to opt the Cube out of
2284
+ * customer-initiated deletion. The flag is per-Cube; power-off, wake,
2285
+ * restart, snapshot, and restore remain allowed regardless.
2286
+ *
2196
2287
  * @param spaceId Target Space id.
2197
- * @param body Cube spec — `{ name, image, resources, sshPublicKey, ... }`.
2288
+ * @param body Cube spec — `{ name, image, resources, sshPublicKey, terminationProtection?, ... }`.
2198
2289
  * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).
2199
2290
  */
2200
- create: (spaceId: string, body: NonNullable<paths["/spaces/{spaceId}/cubes"]["post"]["requestBody"]>["content"]["application/json"], opts?: {
2291
+ create: (spaceId: string, body: CreateCubeInput, opts?: {
2201
2292
  idempotencyKey?: string;
2202
2293
  }) => Promise<Cube>;
2203
2294
  /** Get a single Cube. Returns the {@link Cube}. */
@@ -2216,7 +2307,25 @@ declare class KrovaClient {
2216
2307
  * endpoint. (Compute resize / rename are not part of the public API.)
2217
2308
  */
2218
2309
  update: (spaceId: string, cubeId: string, body: NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/ssh-port"]["put"]["requestBody"]>["content"]["application/json"]) => Promise<unknown>;
2219
- /** Delete a Cube (asynchronous — deletion is enqueued). */
2310
+ /**
2311
+ * Toggle a Cube's termination-protection flag.
2312
+ *
2313
+ * The v1 API exposes `PATCH /spaces/{spaceId}/cubes/{cubeId}` with body
2314
+ * `{ terminationProtection: boolean }`. The call is idempotent: passing the
2315
+ * current value is a no-op server-side (no audit row is written).
2316
+ *
2317
+ * Returns the updated {@link Cube}, including `terminationProtection`,
2318
+ * `terminationProtectionChangedAt`, and `terminationProtectionChangedBy`.
2319
+ */
2320
+ setTerminationProtection: (spaceId: string, cubeId: string, enabled: boolean) => Promise<Cube>;
2321
+ /**
2322
+ * Delete a Cube (asynchronous — deletion is enqueued).
2323
+ *
2324
+ * Throws {@link TerminationProtectedError} when the server returns `409`
2325
+ * with `error.code = "termination_protected"` — the Cube had its
2326
+ * termination-protection flag set and must be unprotected first. Any other
2327
+ * non-2xx response surfaces as a plain {@link KrovaError}.
2328
+ */
2220
2329
  delete: (spaceId: string, cubeId: string) => Promise<{
2221
2330
  success: boolean;
2222
2331
  }>;
@@ -2403,6 +2512,45 @@ declare class KrovaClient {
2403
2512
  expiresAt?: string;
2404
2513
  } | undefined>;
2405
2514
  };
2515
+ readonly webhooks: {
2516
+ /** List webhook endpoints in a Space. */
2517
+ list: (spaceId: string) => Promise<Webhook[]>;
2518
+ /** Get a single webhook endpoint by id. Does NOT include the signing secret. */
2519
+ get: (spaceId: string, endpointId: string) => Promise<Webhook>;
2520
+ /**
2521
+ * Create a webhook endpoint. Returns the endpoint AND its signing secret.
2522
+ *
2523
+ * ⛔ The signing secret is shown ONLY at creation. Persist it immediately;
2524
+ * you cannot retrieve it later — `webhooks.get` deliberately omits it.
2525
+ * Losing the secret means every subsequent delivery will fail signature
2526
+ * verification, and you will have to delete the endpoint and create a new
2527
+ * one. An automation that swallows this helper's return value will lose
2528
+ * the secret on the next request, so the response is checked here and
2529
+ * throws if the server omits either the webhook or the secret.
2530
+ *
2531
+ * @param spaceId Target Space id.
2532
+ * @param body Webhook spec — `{ url, events, description? }`.
2533
+ */
2534
+ create: (spaceId: string, body: CreateWebhookInput) => Promise<WebhookWithSecret>;
2535
+ /**
2536
+ * Delete a webhook endpoint (cascades delivery history).
2537
+ *
2538
+ * Resolves on any 2xx; the response body is intentionally not parsed
2539
+ * because the server returns `{ success: true }` but the caller does not
2540
+ * need it.
2541
+ */
2542
+ delete: (spaceId: string, endpointId: string) => Promise<void>;
2543
+ /**
2544
+ * List recent deliveries for a webhook endpoint (last 30 days, max 100).
2545
+ *
2546
+ * @param spaceId Target Space id.
2547
+ * @param endpointId Webhook endpoint id.
2548
+ * @param opts Optional `limit` (1..100). Omit to let the server default to 50.
2549
+ */
2550
+ deliveries: (spaceId: string, endpointId: string, opts?: {
2551
+ limit?: number;
2552
+ }) => Promise<WebhookDelivery[]>;
2553
+ };
2406
2554
  readonly catalog: {
2407
2555
  /** List regions with available capacity. */
2408
2556
  regions: () => Promise<{
@@ -2489,6 +2637,55 @@ declare class KrovaError extends Error {
2489
2637
  * Build a {@link KrovaError} from a failing response + parsed error body.
2490
2638
  */
2491
2639
  declare function krovaErrorFrom(response: Response, body: KrovaErrorBody | undefined): KrovaError;
2640
+ /**
2641
+ * Thrown by `client.cubes.delete` when the server rejects a delete with
2642
+ * `409` and `error.code = "termination_protected"`.
2643
+ *
2644
+ * The customer-facing contract is: a Cube with `terminationProtection = true`
2645
+ * cannot be deleted until the flag is turned off. The CLI and MCP surface the
2646
+ * server's message verbatim, so callers can switch on `code` rather than
2647
+ * parsing prose. `cubeId` / `changedAt` / `changedBy` are best-effort — a
2648
+ * defensive server (or an older control plane) may omit the `cube` block, in
2649
+ * which case the SDK falls back to the id the call was made with and leaves
2650
+ * the two timestamps `null`.
2651
+ */
2652
+ declare class TerminationProtectedError extends KrovaError {
2653
+ /** The id of the Cube the customer tried to delete. */
2654
+ readonly cubeId: string;
2655
+ /**
2656
+ * When the flag was last changed (`terminationProtectionChangedAt` on the
2657
+ * Cube row). `null` when the server's 409 body omitted it.
2658
+ */
2659
+ readonly changedAt: string | null;
2660
+ /**
2661
+ * Who last changed the flag (`terminationProtectionChangedBy` on the Cube
2662
+ * row — typically `"user:<id>"`). `null` when the server's 409 body omitted
2663
+ * it.
2664
+ */
2665
+ readonly changedBy: string | null;
2666
+ constructor(message: string, init: {
2667
+ status: number;
2668
+ code: string;
2669
+ requestId?: string;
2670
+ body?: KrovaErrorBody;
2671
+ response?: Response;
2672
+ cubeId: string;
2673
+ changedAt: string | null;
2674
+ changedBy: string | null;
2675
+ });
2676
+ }
2677
+ /**
2678
+ * Try to interpret a failing DELETE response as the v1 API's
2679
+ * termination-protected 409. Returns a {@link TerminationProtectedError} when
2680
+ * the body shape matches, `null` otherwise (the caller then falls back to a
2681
+ * plain {@link KrovaError}).
2682
+ *
2683
+ * The 409 body is published as `{ error: { code, message, cube: { … } } }`,
2684
+ * but the bundled OpenAPI spec only declares `{ error: string }` for the
2685
+ * generic `Error` schema — so the cast is best-effort and we tolerate
2686
+ * missing optional fields.
2687
+ */
2688
+ declare function terminationProtectedFrom(response: Response, cubeId: string, body: unknown): TerminationProtectedError | null;
2492
2689
  //#endregion
2493
- 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 };
2690
+ export { type AuthScheme, type CreateCubeInput, 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, TerminationProtectedError, type UpdateDomainInput, type components, krovaErrorFrom, type paths, terminationProtectedFrom };
2494
2691
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -372,6 +372,8 @@ interface paths {
372
372
  region?: string;
373
373
  /** @description cloud-init script (max 16 KB, optional). */
374
374
  userData?: string;
375
+ /** @description Opt this Cube out of customer-initiated deletion (default `false`). Power-off, wake, restart, snapshot, and restore remain allowed regardless. Toggleable later via PATCH /spaces/{spaceId}/cubes/{cubeId} with `{ terminationProtection: boolean }`. */
376
+ terminationProtection?: boolean;
375
377
  };
376
378
  };
377
379
  };
@@ -465,7 +467,40 @@ interface paths {
465
467
  };
466
468
  options?: never;
467
469
  head?: never;
468
- patch?: never;
470
+ /** Update a Cube (toggle termination protection) */
471
+ patch: {
472
+ parameters: {
473
+ query?: never;
474
+ header?: never;
475
+ path: {
476
+ spaceId: string;
477
+ cubeId: string;
478
+ };
479
+ cookie?: never;
480
+ };
481
+ requestBody: {
482
+ content: {
483
+ "application/json": {
484
+ terminationProtection?: boolean;
485
+ };
486
+ };
487
+ };
488
+ responses: {
489
+ /** @description Cube updated */
490
+ 200: {
491
+ headers: {
492
+ [name: string]: unknown;
493
+ };
494
+ content: {
495
+ "application/json": {
496
+ cube: components["schemas"]["Cube"];
497
+ };
498
+ };
499
+ };
500
+ 404: components["responses"]["NotFound"];
501
+ 429: components["responses"]["RateLimited"];
502
+ };
503
+ };
469
504
  trace?: never;
470
505
  };
471
506
  "/spaces/{spaceId}/cubes/{cubeId}/power-off": {
@@ -1846,6 +1881,14 @@ interface components {
1846
1881
  costPerHour: number;
1847
1882
  /** @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
1883
  serverDomain?: string | null;
1884
+ /** @description Whether this Cube is locked against customer-initiated deletion. Per-Cube, opt-in, default `false`. Power-off, wake, restart, snapshot, and restore remain allowed regardless. The two audit fields are populated whenever the flag is on. */
1885
+ terminationProtection: boolean;
1886
+ /** @description When `terminationProtection` last changed. `null` until the flag is first set, then tracked on every toggle.
1887
+ *
1888
+ * Format: date-time */
1889
+ terminationProtectionChangedAt?: string | null;
1890
+ /** @description Who last changed `terminationProtection`. `"user:<id>"` for customer toggles, `"admin:<id>"` for operator changes. `null` until the flag is first set. */
1891
+ terminationProtectionChangedBy?: string | null;
1849
1892
  /** Format: date-time */
1850
1893
  createdAt: string;
1851
1894
  /** Format: date-time */
@@ -2103,6 +2146,47 @@ type CreateDomainInput = NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/dom
2103
2146
  type UpdateDomainInput = NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}"]["patch"]["requestBody"]>["content"]["application/json"];
2104
2147
  /** Request body for creating a TCP port mapping. */
2105
2148
  type CreateTcpMappingInput = NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings"]["post"]["requestBody"]>["content"]["application/json"];
2149
+ /**
2150
+ * Request body for `POST /spaces/{spaceId}/cubes` as defined in the OpenAPI
2151
+ * spec, with `terminationProtection` intersected on because the bundled spec
2152
+ * does not declare the field but the v1 API accepts it. A boolean `false` (or
2153
+ * omission) leaves the Cube in the documented default-unprotected state; `true`
2154
+ * opts the Cube out of customer-initiated deletion until the flag is toggled
2155
+ * back via `cubes.setTerminationProtection`.
2156
+ */
2157
+ type CreateCubeInput = NonNullable<paths["/spaces/{spaceId}/cubes"]["post"]["requestBody"]>["content"]["application/json"] & {
2158
+ /** Opt this Cube out of customer-initiated deletion (default `false`). */
2159
+ terminationProtection?: boolean;
2160
+ };
2161
+ /**
2162
+ * A webhook endpoint subscribed to Space events.
2163
+ *
2164
+ * ⛔ Runtime discrepancy: the bundled OpenAPI spec does not declare
2165
+ * `description`, but `GET /spaces/{spaceId}/webhooks/{endpointId}` includes
2166
+ * it as `string | null`. The schema-derived type is extended here so callers
2167
+ * reading a single webhook see the field; it is optional so list responses
2168
+ * (which omit it) still typecheck.
2169
+ */
2170
+ type Webhook = components["schemas"]["Webhook"] & {
2171
+ description?: string | null;
2172
+ };
2173
+ /** A recorded webhook delivery attempt (last 30 days of history). */
2174
+ type WebhookDelivery = components["schemas"]["WebhookDelivery"];
2175
+ /**
2176
+ * Request body for creating a webhook endpoint.
2177
+ *
2178
+ * Derived from `paths["/spaces/{spaceId}/webhooks"]["post"]` exactly like
2179
+ * {@link CreateDomainInput}; `description` is intersected on because the
2180
+ * bundled spec omits it but the runtime accepts it.
2181
+ */
2182
+ type CreateWebhookInput = NonNullable<paths["/spaces/{spaceId}/webhooks"]["post"]["requestBody"]>["content"]["application/json"] & {
2183
+ /** Optional human-readable label shown on the endpoint. */
2184
+ description?: string;
2185
+ };
2186
+ /** A webhook plus its signing secret. Returned ONLY by {@link KrovaClient.webhooks}.create. */
2187
+ type WebhookWithSecret = Webhook & {
2188
+ secret: string;
2189
+ };
2106
2190
  /** Default API base URL — the single `servers[0].url` from the OpenAPI spec. */
2107
2191
  declare const DEFAULT_BASE_URL = "https://krova.cloud/api/v1";
2108
2192
  /**
@@ -2180,6 +2264,9 @@ declare class KrovaClient {
2180
2264
  sshUser: string;
2181
2265
  costPerHour: number;
2182
2266
  serverDomain?: string | null;
2267
+ terminationProtection: boolean;
2268
+ terminationProtectionChangedAt?: string | null;
2269
+ terminationProtectionChangedBy?: string | null;
2183
2270
  createdAt: string;
2184
2271
  updatedAt: string;
2185
2272
  }[];
@@ -2193,11 +2280,15 @@ declare class KrovaClient {
2193
2280
  /**
2194
2281
  * Create a Cube. Returns the created {@link Cube}.
2195
2282
  *
2283
+ * Set `terminationProtection: true` to opt the Cube out of
2284
+ * customer-initiated deletion. The flag is per-Cube; power-off, wake,
2285
+ * restart, snapshot, and restore remain allowed regardless.
2286
+ *
2196
2287
  * @param spaceId Target Space id.
2197
- * @param body Cube spec — `{ name, image, resources, sshPublicKey, ... }`.
2288
+ * @param body Cube spec — `{ name, image, resources, sshPublicKey, terminationProtection?, ... }`.
2198
2289
  * @param opts Optional `idempotencyKey` (max 255 chars, scoped per space).
2199
2290
  */
2200
- create: (spaceId: string, body: NonNullable<paths["/spaces/{spaceId}/cubes"]["post"]["requestBody"]>["content"]["application/json"], opts?: {
2291
+ create: (spaceId: string, body: CreateCubeInput, opts?: {
2201
2292
  idempotencyKey?: string;
2202
2293
  }) => Promise<Cube>;
2203
2294
  /** Get a single Cube. Returns the {@link Cube}. */
@@ -2216,7 +2307,25 @@ declare class KrovaClient {
2216
2307
  * endpoint. (Compute resize / rename are not part of the public API.)
2217
2308
  */
2218
2309
  update: (spaceId: string, cubeId: string, body: NonNullable<paths["/spaces/{spaceId}/cubes/{cubeId}/ssh-port"]["put"]["requestBody"]>["content"]["application/json"]) => Promise<unknown>;
2219
- /** Delete a Cube (asynchronous — deletion is enqueued). */
2310
+ /**
2311
+ * Toggle a Cube's termination-protection flag.
2312
+ *
2313
+ * The v1 API exposes `PATCH /spaces/{spaceId}/cubes/{cubeId}` with body
2314
+ * `{ terminationProtection: boolean }`. The call is idempotent: passing the
2315
+ * current value is a no-op server-side (no audit row is written).
2316
+ *
2317
+ * Returns the updated {@link Cube}, including `terminationProtection`,
2318
+ * `terminationProtectionChangedAt`, and `terminationProtectionChangedBy`.
2319
+ */
2320
+ setTerminationProtection: (spaceId: string, cubeId: string, enabled: boolean) => Promise<Cube>;
2321
+ /**
2322
+ * Delete a Cube (asynchronous — deletion is enqueued).
2323
+ *
2324
+ * Throws {@link TerminationProtectedError} when the server returns `409`
2325
+ * with `error.code = "termination_protected"` — the Cube had its
2326
+ * termination-protection flag set and must be unprotected first. Any other
2327
+ * non-2xx response surfaces as a plain {@link KrovaError}.
2328
+ */
2220
2329
  delete: (spaceId: string, cubeId: string) => Promise<{
2221
2330
  success: boolean;
2222
2331
  }>;
@@ -2403,6 +2512,45 @@ declare class KrovaClient {
2403
2512
  expiresAt?: string;
2404
2513
  } | undefined>;
2405
2514
  };
2515
+ readonly webhooks: {
2516
+ /** List webhook endpoints in a Space. */
2517
+ list: (spaceId: string) => Promise<Webhook[]>;
2518
+ /** Get a single webhook endpoint by id. Does NOT include the signing secret. */
2519
+ get: (spaceId: string, endpointId: string) => Promise<Webhook>;
2520
+ /**
2521
+ * Create a webhook endpoint. Returns the endpoint AND its signing secret.
2522
+ *
2523
+ * ⛔ The signing secret is shown ONLY at creation. Persist it immediately;
2524
+ * you cannot retrieve it later — `webhooks.get` deliberately omits it.
2525
+ * Losing the secret means every subsequent delivery will fail signature
2526
+ * verification, and you will have to delete the endpoint and create a new
2527
+ * one. An automation that swallows this helper's return value will lose
2528
+ * the secret on the next request, so the response is checked here and
2529
+ * throws if the server omits either the webhook or the secret.
2530
+ *
2531
+ * @param spaceId Target Space id.
2532
+ * @param body Webhook spec — `{ url, events, description? }`.
2533
+ */
2534
+ create: (spaceId: string, body: CreateWebhookInput) => Promise<WebhookWithSecret>;
2535
+ /**
2536
+ * Delete a webhook endpoint (cascades delivery history).
2537
+ *
2538
+ * Resolves on any 2xx; the response body is intentionally not parsed
2539
+ * because the server returns `{ success: true }` but the caller does not
2540
+ * need it.
2541
+ */
2542
+ delete: (spaceId: string, endpointId: string) => Promise<void>;
2543
+ /**
2544
+ * List recent deliveries for a webhook endpoint (last 30 days, max 100).
2545
+ *
2546
+ * @param spaceId Target Space id.
2547
+ * @param endpointId Webhook endpoint id.
2548
+ * @param opts Optional `limit` (1..100). Omit to let the server default to 50.
2549
+ */
2550
+ deliveries: (spaceId: string, endpointId: string, opts?: {
2551
+ limit?: number;
2552
+ }) => Promise<WebhookDelivery[]>;
2553
+ };
2406
2554
  readonly catalog: {
2407
2555
  /** List regions with available capacity. */
2408
2556
  regions: () => Promise<{
@@ -2489,6 +2637,55 @@ declare class KrovaError extends Error {
2489
2637
  * Build a {@link KrovaError} from a failing response + parsed error body.
2490
2638
  */
2491
2639
  declare function krovaErrorFrom(response: Response, body: KrovaErrorBody | undefined): KrovaError;
2640
+ /**
2641
+ * Thrown by `client.cubes.delete` when the server rejects a delete with
2642
+ * `409` and `error.code = "termination_protected"`.
2643
+ *
2644
+ * The customer-facing contract is: a Cube with `terminationProtection = true`
2645
+ * cannot be deleted until the flag is turned off. The CLI and MCP surface the
2646
+ * server's message verbatim, so callers can switch on `code` rather than
2647
+ * parsing prose. `cubeId` / `changedAt` / `changedBy` are best-effort — a
2648
+ * defensive server (or an older control plane) may omit the `cube` block, in
2649
+ * which case the SDK falls back to the id the call was made with and leaves
2650
+ * the two timestamps `null`.
2651
+ */
2652
+ declare class TerminationProtectedError extends KrovaError {
2653
+ /** The id of the Cube the customer tried to delete. */
2654
+ readonly cubeId: string;
2655
+ /**
2656
+ * When the flag was last changed (`terminationProtectionChangedAt` on the
2657
+ * Cube row). `null` when the server's 409 body omitted it.
2658
+ */
2659
+ readonly changedAt: string | null;
2660
+ /**
2661
+ * Who last changed the flag (`terminationProtectionChangedBy` on the Cube
2662
+ * row — typically `"user:<id>"`). `null` when the server's 409 body omitted
2663
+ * it.
2664
+ */
2665
+ readonly changedBy: string | null;
2666
+ constructor(message: string, init: {
2667
+ status: number;
2668
+ code: string;
2669
+ requestId?: string;
2670
+ body?: KrovaErrorBody;
2671
+ response?: Response;
2672
+ cubeId: string;
2673
+ changedAt: string | null;
2674
+ changedBy: string | null;
2675
+ });
2676
+ }
2677
+ /**
2678
+ * Try to interpret a failing DELETE response as the v1 API's
2679
+ * termination-protected 409. Returns a {@link TerminationProtectedError} when
2680
+ * the body shape matches, `null` otherwise (the caller then falls back to a
2681
+ * plain {@link KrovaError}).
2682
+ *
2683
+ * The 409 body is published as `{ error: { code, message, cube: { … } } }`,
2684
+ * but the bundled OpenAPI spec only declares `{ error: string }` for the
2685
+ * generic `Error` schema — so the cast is best-effort and we tolerate
2686
+ * missing optional fields.
2687
+ */
2688
+ declare function terminationProtectedFrom(response: Response, cubeId: string, body: unknown): TerminationProtectedError | null;
2492
2689
  //#endregion
2493
- 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 };
2690
+ export { type AuthScheme, type CreateCubeInput, 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, TerminationProtectedError, type UpdateDomainInput, type components, krovaErrorFrom, type paths, terminationProtectedFrom };
2494
2691
  //# sourceMappingURL=index.d.ts.map