@deepdockai/cli 1.12.2 → 2.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.0
4
+
5
+ - **Breaking:** CLI device records in `--json` output now use `pairedAt` in place of
6
+ `claimedAt`. Update scripts that read device records from the CLI to use the new field.
7
+ - When a table lists device fields by name, the pairing timestamp column is `PAIRED AT`.
8
+ - This release works before and after the API renames the field. Once the API serves
9
+ `pairedAt`, it will require CLI 2.0.0 or newer and return `cli_outdated` to older versions.
10
+
3
11
  ## 1.12.2
4
12
 
5
13
  - The errors reference: an `invalid_input` whose refusal the action itself declares may carry only a message, without `fields`, as the pinned `invalid_input` description says.
package/README.md CHANGED
@@ -149,16 +149,20 @@ On a terminal you get tables and plain sentences. When stdout is not a terminal,
149
149
 
150
150
  ```json
151
151
  {
152
- "data": { "...": "the API's data, unchanged" },
152
+ "data": { "...": "the command's result" },
153
153
  "meta": { "org": { "slug": "muster-it", "name": "Muster IT" }, "requestId": "..." }
154
154
  }
155
155
  ```
156
156
 
157
157
  `systems openapi` is the one exception off a terminal: it prints the OpenAPI document itself, so
158
158
  `deepdock systems openapi <system> > openapi.json` saves a document a generator can read (`--json`
159
- gives the envelope). For list and show commands `data` is the API's answer unchanged, so what the CLI shows is what
160
- your code will receive; `auth`, `orgs select`, `keys create`, `webhooks secret` and `webhooks rotate-secret` build it from named fields. A
161
- failure is one document on stderr, `{ "error": { "code", "message" }, "meta": { "hint" } }`,
159
+ gives the envelope). For list and show commands, `data` generally passes through the API response.
160
+ Device records from `devices list`, `devices pair` and `devices rename` use `pairedAt` in JSON.
161
+ Update scripts that read `claimedAt` from the CLI to read `pairedAt`. The CLI accepts either field from the API.
162
+ Until the API serves `pairedAt`, device JSON from direct API calls still uses `claimedAt`,
163
+ as shown in the API reference and bundled clients.
164
+ `auth`, `orgs select`, `keys create`, `webhooks secret` and `webhooks rotate-secret` build `data`
165
+ from named fields. A failure is one document on stderr, `{ "error": { "code", "message" }, "meta": { "hint" } }`,
162
166
  with the API's error object unchanged. Switch on `code` or on the exit code, never on `message`.
163
167
 
164
168
  | Exit | Meaning |
package/dist/deepdock.js CHANGED
@@ -10986,7 +10986,7 @@ var DEVICE_COLUMNS = [
10986
10986
  "clientVersion",
10987
10987
  "status",
10988
10988
  "lastSeenAt",
10989
- "claimedAt",
10989
+ "pairedAt",
10990
10990
  "updateAvailable",
10991
10991
  "systems"
10992
10992
  ];
@@ -11490,7 +11490,7 @@ import { spawn } from "node:child_process";
11490
11490
  import { homedir, hostname } from "node:os";
11491
11491
 
11492
11492
  // src/version.ts
11493
- var VERSION = "1.12.2";
11493
+ var VERSION = "2.0.0";
11494
11494
 
11495
11495
  // src/runtime.ts
11496
11496
  var DEFAULT_BASE_URL = "https://api.deepdock.ai";
@@ -12933,6 +12933,12 @@ var readAllPages = async (ctx, path, org) => {
12933
12933
 
12934
12934
  // src/commands/devices.ts
12935
12935
  var meta = (requestId) => requestId ? { requestId } : {};
12936
+ var normalizeDevice = (device) => {
12937
+ if (!isRecord(device))
12938
+ return device;
12939
+ const { claimedAt, pairedAt = claimedAt, ...record } = device;
12940
+ return { ...record, pairedAt };
12941
+ };
12936
12942
  var updateNotes = (ctx, devices) => {
12937
12943
  for (const device of devices.filter(isRecord)) {
12938
12944
  const update = field(device, "updateAvailable");
@@ -12943,7 +12949,8 @@ var updateNotes = (ctx, devices) => {
12943
12949
  }
12944
12950
  };
12945
12951
  var list = async (ctx) => {
12946
- const { items: devices, requestId } = await readAllPages(ctx, "/partner/devices");
12952
+ const { items, requestId } = await readAllPages(ctx, "/partner/devices");
12953
+ const devices = items.map(normalizeDevice);
12947
12954
  if (devices.length === 0) {
12948
12955
  return {
12949
12956
  data: devices,
@@ -12980,8 +12987,12 @@ var pair = async (ctx, code, label) => {
12980
12987
  lines.push(` Status: ${status}`);
12981
12988
  lines.push(` Systems: ${systemsLabel(device)}`);
12982
12989
  lines.push(`Next: \`deepdock devices systems ${id}\` shows its actions.`);
12983
- return { data: response.data, meta: meta(response.requestId), text: lines.join(`
12984
- `) };
12990
+ return {
12991
+ data: normalizeDevice(response.data),
12992
+ meta: meta(response.requestId),
12993
+ text: lines.join(`
12994
+ `)
12995
+ };
12985
12996
  };
12986
12997
  var rename = async (ctx, id, label) => {
12987
12998
  const deviceId = deviceIdArg(id);
@@ -12994,7 +13005,7 @@ var rename = async (ctx, id, label) => {
12994
13005
  body: { label }
12995
13006
  });
12996
13007
  return {
12997
- data: response.data,
13008
+ data: normalizeDevice(response.data),
12998
13009
  meta: meta(response.requestId),
12999
13010
  text: `${paint(ctx.out, "success", "Renamed")} device ${deviceId} to ${stripControl(label)}.`
13000
13011
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepdockai/cli",
3
- "version": "1.12.2",
3
+ "version": "2.0.0",
4
4
  "description": "Deepdock partner CLI: pair devices, see systems and actions, create the API key your code runs them with.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -19,7 +19,7 @@ the API key the CLI wrote to the app's env file.
19
19
  | `orgs select [slug]` | sets the default organisation; without a slug, a pick-list on a terminal | member |
20
20
  | `systems list` | the systems and actions assigned to the organisation | member |
21
21
  | `systems openapi <system>` | the system's OpenAPI document on stdout; redirect it to a file | member |
22
- | `devices list` | paired devices with id, label, status, last seen, and each system with its access | member |
22
+ | `devices list` | paired devices with id, label, status, systems and last seen | member |
23
23
  | `devices pair <code> [--label <text>]` | pair a device by the code on its screen, or the code `--admin pairing-code` prints on it (see [auth-and-keys.md](auth-and-keys.md#pairing-from-a-shell)) | member |
24
24
  | `devices rename <deviceId> <label>` | rename a device | member |
25
25
  | `devices release <deviceId>` | release a device (asks on a terminal; `--yes` otherwise) | admin |
@@ -71,10 +71,14 @@ JSON is the default when stdout is not a terminal; pass `--json` to be sure. One
71
71
  stdout:
72
72
 
73
73
  ```json
74
- { "data": <the API's data, unchanged>, "meta": { "org": { "slug": "…", "name": "…" }, "requestId": "…" } }
74
+ { "data": <the command's result>, "meta": { "org": { "slug": "…", "name": "…" }, "requestId": "…" } }
75
75
  ```
76
76
 
77
- `data` is what the API answered, so what you see is what your code will receive. `meta` holds the
77
+ `data` generally passes through the API response. Device records from `devices list`,
78
+ `devices pair` and `devices rename` use `pairedAt` in JSON. Update scripts that read `claimedAt`
79
+ from the CLI to read `pairedAt`. The CLI accepts either field from the API.
80
+ Until the API serves `pairedAt`, device JSON from direct API calls still uses `claimedAt`,
81
+ as shown in the API reference and bundled clients. `meta` holds the
78
82
  organisation the command acted in, the request id, and, where it applies, `written` (`{ file,
79
83
  name }` from `keys create`) and `pending` (from `--no-wait`). `keys create` builds its `data` from
80
84
  id, name, prefix, createdAt and expiresAt; the key value is in neither stream. `webhooks secret` and
@@ -24,7 +24,8 @@ Details: [auth-and-keys.md](auth-and-keys.md).
24
24
  The Deepdock client installed on the customer's Windows PC next to their system. It connects
25
25
  outwards to Deepdock; nothing in the customer's network is opened to the internet. A device is
26
26
  identified by a UUID (`id`), carries a `label`, `hostname`, `os`, `clientVersion`, `status`
27
- (`connected`, `offline` or `inactive`), `lastSeenAt`, `lastKnownAt`, `claimedAt` (may be `null`), `outdated` (an
27
+ (`connected`, `offline` or `inactive`), `lastSeenAt`, `lastKnownAt`, `claimedAt` (may be `null`, named
28
+ `pairedAt` in CLI `--json` output), `outdated` (an
28
29
  assigned action needs a newer client: it answers `device_outdated`) and the `systems` it reported (each with a `versionIssue` when `version` is missing, `blockedActions` when this device's client cannot run some actions yet: those answer `device_outdated` until the client updates, the others keep running, `execution` while the system is stopped, and `actions`: whether each of your actions on that system would be admitted now). An action whose system runs a program version Deepdock has not yet approved for it answers `version_not_covered`; nothing is sent to the system, and it works once Deepdock has approved that version.
29
30
 
30
31
  - **Pair**: take a device into your organisation with the 6-character code it shows while unpaired.