@meshagent/meshagent-ts-auth 0.41.9 → 0.42.2

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
@@ -1,3 +1,20 @@
1
+ ## [0.42.2]
2
+ - Added `ContainerExitStatus`, `RoomContainerStats`, and published build image metadata to the TypeScript container client models.
3
+ - Added `waitForExitStatus` while keeping `waitForExit` as the exit-code convenience wrapper.
4
+ - Container list parsing now preserves image IDs, runtime stats, and exit-status metadata from API responses.
5
+
6
+ ## [0.42.1]
7
+ - Stability
8
+
9
+ ## [0.42.0]
10
+ - Added project lookup by key.
11
+ - Container and room APIs now return structured `containerPort`/`hostPort` entries instead of integer port lists, which is a breaking response-shape change.
12
+ - `ContainerSpec`, `PortSpec`, and `RoutePathSpec` now support `template`, `host_port`, and `stripPrefix`, and room service URL resolution uses `host_port` when available.
13
+ - `createRoom` now serializes typed permissions, and container creation now accepts a `template` option.
14
+
15
+ ## [0.41.10]
16
+ - Stability
17
+
1
18
  ## [0.41.9]
2
19
  - Stability
3
20
 
@@ -15958,6 +15958,7 @@ ${err.toString()}`);
15958
15958
  credentials: toCredentials(params.credentials ?? []),
15959
15959
  name: params.name,
15960
15960
  mounts: params.mounts,
15961
+ template: params.template,
15961
15962
  writable_root_fs: params.writableRootFs,
15962
15963
  private: params.private
15963
15964
  });
@@ -16068,14 +16069,27 @@ ${err.toString()}`);
16068
16069
  force: params.force ?? false
16069
16070
  });
16070
16071
  }
16071
- async waitForExit(params) {
16072
+ async waitForExitStatus(params) {
16072
16073
  const output = await this.invoke("wait_for_exit", {
16073
16074
  container_id: params.containerId
16074
16075
  });
16075
16076
  if (!(output instanceof response_1.JsonContent) || !isRecord(output.json)) {
16076
16077
  throw this.unexpectedResponseError("wait_for_exit");
16077
16078
  }
16078
- return readIntegerField(output.json, "exit_code", "wait_for_exit");
16079
+ const exitCode = readIntegerField(output.json, "exit_code", "wait_for_exit");
16080
+ const reason = output.json["reason"];
16081
+ const message2 = output.json["message"];
16082
+ const oomKilled = output.json["oom_killed"];
16083
+ return {
16084
+ exitCode,
16085
+ reason: typeof reason === "string" ? reason : void 0,
16086
+ message: typeof message2 === "string" ? message2 : void 0,
16087
+ oomKilled: typeof oomKilled === "boolean" ? oomKilled : void 0
16088
+ };
16089
+ }
16090
+ async waitForExit(params) {
16091
+ const status = await this.waitForExitStatus(params);
16092
+ return status.exitCode;
16079
16093
  }
16080
16094
  async deleteContainer(params) {
16081
16095
  await this.invoke("delete_container", {
@@ -16327,23 +16341,66 @@ ${err.toString()}`);
16327
16341
  throw this.unexpectedResponseError("list");
16328
16342
  }
16329
16343
  const nameRaw = entry["name"];
16344
+ const imageIdRaw = entry["image_id"];
16330
16345
  const portsRaw = entry["ports"];
16331
16346
  const serviceIdRaw = entry["service_id"];
16332
- if (!Array.isArray(portsRaw) || !portsRaw.every((port) => typeof port === "number" && Number.isInteger(port))) {
16347
+ const statsRaw = entry["stats"];
16348
+ const exitStatusRaw = entry["exit_status"];
16349
+ if (!Array.isArray(portsRaw) || !portsRaw.every((port) => {
16350
+ if (!isRecord(port)) {
16351
+ return false;
16352
+ }
16353
+ return typeof port["container_port"] === "number" && Number.isInteger(port["container_port"]) && typeof port["host_port"] === "number" && Number.isInteger(port["host_port"]);
16354
+ })) {
16333
16355
  throw this.unexpectedResponseError("list");
16334
16356
  }
16357
+ const ports = portsRaw.map((port) => ({
16358
+ containerPort: port["container_port"],
16359
+ hostPort: port["host_port"]
16360
+ }));
16361
+ let stats;
16362
+ if (isRecord(statsRaw)) {
16363
+ const cpuUsageNanoCores = statsRaw["cpu_usage_nano_cores"];
16364
+ const memoryUsageBytes = statsRaw["memory_usage_bytes"];
16365
+ const memoryWorkingSetBytes = statsRaw["memory_working_set_bytes"];
16366
+ const timestampNs = statsRaw["timestamp_ns"];
16367
+ stats = {
16368
+ cpuUsageNanoCores: typeof cpuUsageNanoCores === "number" ? cpuUsageNanoCores : void 0,
16369
+ memoryUsageBytes: typeof memoryUsageBytes === "number" ? memoryUsageBytes : void 0,
16370
+ memoryWorkingSetBytes: typeof memoryWorkingSetBytes === "number" ? memoryWorkingSetBytes : void 0,
16371
+ timestampNs: typeof timestampNs === "number" ? timestampNs : void 0
16372
+ };
16373
+ }
16374
+ let exitStatus;
16375
+ if (isRecord(exitStatusRaw)) {
16376
+ const exitCode = exitStatusRaw["exit_code"];
16377
+ if (typeof exitCode === "number" && Number.isInteger(exitCode)) {
16378
+ const reason = exitStatusRaw["reason"];
16379
+ const message2 = exitStatusRaw["message"];
16380
+ const oomKilled = exitStatusRaw["oom_killed"];
16381
+ exitStatus = {
16382
+ exitCode,
16383
+ reason: typeof reason === "string" ? reason : void 0,
16384
+ message: typeof message2 === "string" ? message2 : void 0,
16385
+ oomKilled: typeof oomKilled === "boolean" ? oomKilled : void 0
16386
+ };
16387
+ }
16388
+ }
16335
16389
  items.push({
16336
16390
  id,
16337
16391
  image,
16392
+ imageId: typeof imageIdRaw === "string" ? imageIdRaw : void 0,
16338
16393
  name: typeof nameRaw === "string" ? nameRaw : void 0,
16339
- ports: portsRaw,
16394
+ ports,
16340
16395
  startedBy: {
16341
16396
  id: startedById,
16342
16397
  name: startedByName
16343
16398
  },
16344
16399
  state,
16345
16400
  private: privateFlag,
16346
- serviceId: typeof serviceIdRaw === "string" ? serviceIdRaw : void 0
16401
+ serviceId: typeof serviceIdRaw === "string" ? serviceIdRaw : void 0,
16402
+ stats,
16403
+ exitStatus
16347
16404
  });
16348
16405
  }
16349
16406
  return items;
@@ -42135,6 +42192,11 @@ ${newlined}
42135
42192
  action: "get project"
42136
42193
  });
42137
42194
  }
42195
+ async getProjectByKey(projectKey) {
42196
+ return await this.request(`/accounts/projects/by-key/${encodeURIComponent(projectKey)}`, {
42197
+ action: "get project by key"
42198
+ });
42199
+ }
42138
42200
  async createApiKey(projectId, name, description) {
42139
42201
  return await this.request(`/accounts/projects/${projectId}/api-keys`, {
42140
42202
  method: "POST",
@@ -47354,7 +47416,7 @@ ${newlined}
47354
47416
  }
47355
47417
  function roomServiceMcpServerUrl({ service, port, endpoint }) {
47356
47418
  const endpointPath = normalizeEndpointPath(endpoint.path);
47357
- const portValue = typeof port.num === "number" ? port.num : null;
47419
+ const portValue = port.host_port ?? (typeof port.num === "number" ? port.num : null);
47358
47420
  if (service.external == null) {
47359
47421
  if (portValue == null) {
47360
47422
  return `http://localhost${endpointPath}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshagent/meshagent-ts-auth",
3
- "version": "0.41.9",
3
+ "version": "0.42.2",
4
4
  "description": "Meshagent Typescript Auth",
5
5
  "homepage": "https://github.com/meshagent/meshagent-ts-auth",
6
6
  "scripts": {
@@ -39,7 +39,7 @@
39
39
  "CHANGELOG.md"
40
40
  ],
41
41
  "dependencies": {
42
- "@meshagent/meshagent": "^0.41.9",
42
+ "@meshagent/meshagent": "^0.42.2",
43
43
  "typescript": "^5.8.3"
44
44
  },
45
45
  "devDependencies": {