@declaw/sdk 1.1.6 → 1.1.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/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to the Declaw TypeScript / JavaScript SDK are documented in
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.1.7]
9
+
10
+ ### Added
11
+
12
+ - `Sandbox.kill(id)` static — kill by id in one HTTP call.
13
+
8
14
  ## [1.1.6]
9
15
 
10
16
  ### Added
package/dist/index.cjs CHANGED
@@ -2173,6 +2173,33 @@ var Sandbox = class _Sandbox {
2173
2173
  });
2174
2174
  return data.results ?? {};
2175
2175
  }
2176
+ /**
2177
+ * Kill a sandbox by id without first connecting. Sends a single
2178
+ * `DELETE /sandboxes/:id?async=true` and skips the metadata fetch
2179
+ * `Sandbox.connect(id).kill()` would otherwise pay. Useful for bulk
2180
+ * cleanup paths that only have the id.
2181
+ *
2182
+ * @param sandboxId - the sandbox to kill.
2183
+ * @param opts.wait - if true, block until the server finishes the
2184
+ * per-VM teardown. Default is false: server returns 202 once the
2185
+ * kill is queued.
2186
+ * @param opts.requestTimeout - per-request timeout in milliseconds.
2187
+ * @param opts.config - override the default ConnectionConfig.
2188
+ * @returns true if the kill was accepted (default) or completed
2189
+ * (wait=true); false if the server reported the sandbox was
2190
+ * already dead.
2191
+ */
2192
+ static async kill(sandboxId, opts) {
2193
+ const config = opts?.config ?? new ConnectionConfig();
2194
+ const client = getSharedClient(config);
2195
+ const wait = opts?.wait === true;
2196
+ const path = wait ? `/sandboxes/${sandboxId}` : `/sandboxes/${sandboxId}?async=true`;
2197
+ const data = await client.delete(path, {
2198
+ timeout: opts?.requestTimeout
2199
+ });
2200
+ if (!wait) return data.queued ?? true;
2201
+ return data.killed ?? false;
2202
+ }
2176
2203
  /**
2177
2204
  * Check if this sandbox is currently running.
2178
2205
  *