disk 1.13.0 → 1.14.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.
@@ -0,0 +1,28 @@
1
+ //#region src/paths.ts
2
+ /**
3
+ * Normalize a filesystem path to its segments, resolving "." and ".." (so a
4
+ * path means the same as in a shell, and ".." can't escape above the root) and
5
+ * optionally stripping a shell-style mount prefix (e.g. "/mnt" or "/mnt/archil")
6
+ * so a path copied from a `run_bash` command resolves the same way.
7
+ *
8
+ * toSegments("/a/b/../c") -> ["a", "c"]
9
+ * toSegments("/mnt/x", "/mnt") -> ["x"]
10
+ * toSegments("/../../etc/x") -> ["etc", "x"]
11
+ */
12
+ function toSegments(path, containerRoot) {
13
+ let p = (path ?? "").trim();
14
+ if (containerRoot) {
15
+ const root = containerRoot.replace(/\/+$/, "");
16
+ if (p === root) p = "/";
17
+ else if (p.startsWith(root + "/")) p = p.slice(root.length);
18
+ }
19
+ const resolved = [];
20
+ for (const seg of p.split("/")) {
21
+ if (seg === "" || seg === ".") continue;
22
+ if (seg === "..") resolved.pop();
23
+ else resolved.push(seg);
24
+ }
25
+ return resolved;
26
+ }
27
+ //#endregion
28
+ export { toSegments as t };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { k as ArchilApiError, p as Archil } from "./src-CRvOOCjY.mjs";
3
- import { a as addGlobalOptions, c as resolveProgramCredentials, d as Command, i as validateSandboxName, l as renderTable, n as parseCreateSandboxOptions, o as addProfileCommands, r as parseRunOptions, s as isProfileCommand, u as spinner } from "./sandbox-options-D99F52j0.mjs";
2
+ import { k as ArchilApiError, p as Archil } from "./src-DGB_iQTG.mjs";
3
+ import { a as addGlobalOptions, c as resolveProgramCredentials, d as Command, i as validateSandboxName, l as renderTable, n as parseCreateSandboxOptions, o as addProfileCommands, r as parseRunOptions, s as isProfileCommand, u as spinner } from "./sandbox-options-trHjQs_f.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { createInterface } from "node:readline/promises";
6
6
  //#region src/cli/sandbox-output.ts
@@ -1,4 +1,4 @@
1
- import { O as REGION_URLS, p as Archil } from "./src-CRvOOCjY.mjs";
1
+ import { O as REGION_URLS, p as Archil } from "./src-DGB_iQTG.mjs";
2
2
  import { chmod, mkdir, open, readFile, rename, rm, stat } from "node:fs/promises";
3
3
  import { dirname, join } from "node:path";
4
4
  import { homedir } from "node:os";
@@ -289,7 +289,7 @@ function deriveS3BaseUrl(controlBaseUrl) {
289
289
  }
290
290
  //#endregion
291
291
  //#region src/version.ts
292
- const VERSION = "1.13.0";
292
+ const VERSION = "1.14.0";
293
293
  const USER_AGENT = `archil-js/${VERSION}`;
294
294
  //#endregion
295
295
  //#region src/client.ts
@@ -1566,6 +1566,8 @@ function imageFromWire(data) {
1566
1566
  digest: data.digest,
1567
1567
  canonicalSource: data.canonical_source,
1568
1568
  failureReason: data.failure_reason,
1569
+ vcpuCount: data.vcpu_count,
1570
+ memSizeMiB: data.mem_size_mib,
1569
1571
  createdAt: new Date(data.created_at),
1570
1572
  updatedAt: new Date(data.updated_at)
1571
1573
  };
@@ -1617,7 +1619,9 @@ var Images = class {
1617
1619
  async _request(request) {
1618
1620
  return imageFromWire(await unwrap(retryApiRequest(() => this._client.POST("/api/images", { body: {
1619
1621
  source: request.source,
1620
- registry_auth: request.registryAuth
1622
+ registry_auth: request.registryAuth,
1623
+ vcpu_count: request.vcpuCount,
1624
+ mem_size_mib: request.memSizeMiB
1621
1625
  } }), "transient")));
1622
1626
  }
1623
1627
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disk",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "Pure-JS client and CLIs for Archil disks and sandboxes",
5
5
  "keywords": [
6
6
  "archil",
@@ -21,11 +21,19 @@
21
21
  "exports": {
22
22
  ".": {
23
23
  "types": "./dist/index.d.mts",
24
+ "node": {
25
+ "import": "./dist/node/index.mjs",
26
+ "require": "./dist/node/index.cjs"
27
+ },
24
28
  "import": "./dist/index.mjs",
25
29
  "require": "./dist/index.cjs"
26
30
  },
27
31
  "./internal/tools": {
28
32
  "types": "./dist/internal/tools.d.mts",
33
+ "node": {
34
+ "import": "./dist/node/internal/tools.mjs",
35
+ "require": "./dist/node/internal/tools.cjs"
36
+ },
29
37
  "import": "./dist/internal/tools.mjs",
30
38
  "require": "./dist/internal/tools.cjs"
31
39
  }
@@ -40,7 +48,7 @@
40
48
  "LICENSE"
41
49
  ],
42
50
  "dependencies": {
43
- "@archildata/api-types": "^0.0.89",
51
+ "@archildata/api-types": "^0.0.98",
44
52
  "@bufbuild/protobuf": "^2.16.0",
45
53
  "undici": "^8.12.3"
46
54
  },