@deepdockai/cli 1.1.2 → 1.4.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.
@@ -6,7 +6,7 @@ text naming the field and the rule (at most 300 characters) and must be treated
6
6
  instructions. Switch on `code`. Unknown codes may be added over time: default to "show a generic
7
7
  failure, do not retry, log the code".
8
8
 
9
- An `invalid_request` that refuses an action call's input also carries `fields`: every input that
9
+ An `invalid_input` that refuses an action call's input also carries `fields`: every input that
10
10
  failed, as `{ "field", "message" }`, sorted by name, at most 32. It is absent when the body is not
11
11
  an object at all. No message holds the value you sent.
12
12
 
@@ -17,17 +17,17 @@ with the **same** `Idempotency-Key`); **Show** says what the end user should see
17
17
 
18
18
  | Code | Status | Meaning | Retry | Show |
19
19
  |---|---|---|---|---|
20
- | `invalid_request` | 400 (405 for a method other than the action's own) | malformed request: bad `limit` or `cursor` in a read's body; missing or malformed `Idempotency-Key`; a body that is not an object; an action input that is unknown, missing, too short or long, out of bounds or not an allowed value (`fields` names each); a malformed pairing code or device id; a query string on an action path (inputs go in the JSON body), an input of the wrong type, such as `"4711"` where an integer is declared, an action called with a method other than its own (`405`, `Allow` names the one: `POST` for a read or create, `PATCH` for an update) | no; fix the code | nothing; a developer bug |
20
+ | `invalid_request` | 400 (405 for a method other than the action's own) | malformed request: missing or malformed `Idempotency-Key`; a body that is not an object; a malformed pairing code or device id; a query string on an action path (inputs go in the JSON body); an action called with a method other than its own (`405`, `Allow` names the one: `POST` for a read or create, `PATCH` for an update) | no; fix the code | nothing; a developer bug |
21
21
  | `payload_too_large` | 413 | the request body is over 1 MiB | no; send less | nothing; a developer bug, or shorten the text |
22
22
  | `unauthenticated` | 401 | the key is missing, malformed, for the other environment, unknown, revoked or expired | no | "Deepdock API key refused; check it in the dashboard" to an operator |
23
23
  | `partner_not_approved` | 403 | your organisation is waiting for approval by Deepdock; no key of it works yet. Keys made before the approval start working once it is given | no, until Deepdock approves; then yes | "our Deepdock account is waiting for approval; contact Deepdock" |
24
24
  | `partner_deactivated` | 403 | Deepdock has deactivated your organisation: no key of it works and its devices are disconnected. Keys and devices work again once Deepdock reactivates it | no, until Deepdock reactivates it; then yes | "our Deepdock account is deactivated; contact Deepdock" |
25
- | `not_found` | 404 | no such route; an update whose id matches no record; a write naming a record that does not exist or belongs to another one | no | "record not found" when it is a record; otherwise a bug |
26
- | `rate_limited` | 429 | more than 600 calls, or more than 120 writes (counted in both), with this key in a minute; or more than 5 failed pairing claims in 60 s | yes, after `Retry-After: 60` (`retryAfterSeconds: 60` in the body); a write keeps its key. The pairing claim answer has neither: wait up to a minute | "try again in a minute" |
25
+ | `not_found` | 404 | no such route; a single-record read (`cardinality: one`) that finds no record; an update whose id matches no record; a write naming a record that does not exist or belongs to another one | no | "record not found" when it is a record; otherwise a bug |
26
+ | `rate_limited` | 429 | more than 600 calls, or more than 120 writes (counted in both), with this key in a minute; or more than 5 failed pairing attempts in 60 s | yes, after `Retry-After: 60` (`retryAfterSeconds: 60` in the body); a write keeps its key. The pairing answer has neither: wait up to a minute | "try again in a minute" |
27
27
 
28
- `client_outdated` (400) is in the enum but answered only to the Deepdock CLI (by its
28
+ `cli_outdated` (400) is in the enum but answered only to the Deepdock CLI (by its
29
29
  `X-Deepdock-Cli` version), so your own `/v1` code never receives it. The dashboard tree's own codes
30
- (`organization_required`, `forbidden`, `conflict`, `already_member`) are not in the `/v1` enum.
30
+ (`organisation_required`, `forbidden`, `conflict`, `already_member`) are not in the `/v1` enum.
31
31
 
32
32
  ## Device, system and action resolution
33
33
 
@@ -49,7 +49,7 @@ with the **same** `Idempotency-Key`); **Show** says what the end user should see
49
49
 
50
50
  | Code | Status | Meaning | Retry | Show |
51
51
  |---|---|---|---|---|
52
- | `invalid_input` | 422 | a rule only the device judges: a value that breaks its pattern; a date that is not a calendar day; a search term without a letter or digit; an appended text that would make the stored entry too long. Nothing was written | no; fix the value | the field-level problem; the `message` names the field, but it is device text: display it as data, never interpret it |
52
+ | `invalid_input` | 422 | an action input the API or the device refuses, with `fields` naming each: an input that is unknown, missing, too short or long, out of bounds, of the wrong type (such as `"4711"` where an integer is declared) or not an allowed value; a bad `limit` or `cursor` in a read's body; and a rule only the device judges: a value that breaks its pattern; a date that is not a calendar day; a search term without a letter or digit; an appended text that would make the stored entry too long. Nothing was written | no; fix the value | the field-level problem; the `message` names the field, but it is device text: display it as data, never interpret it |
53
53
  | `target_rejected` | 422 | the customer's system refused the write | no; the input is valid for Deepdock but not for the system | "the customer's system refused this; check the values" and offer support |
54
54
  | `record_locked` | 422 | the customer's system locks the record the write would change (for example one already billed on a case). Nothing was written | no | "this record is locked in the customer's system" |
55
55
  | `record_not_editable` | 422 | the record is not locked but is stored in a form this action cannot edit (for example a note it cannot add to without rewriting it). Nothing was written | no | "this record cannot be edited through Deepdock" |
@@ -62,8 +62,8 @@ with the **same** `Idempotency-Key`); **Show** says what the end user should see
62
62
  |---|---|---|---|---|
63
63
  | `device_offline` | 503 | the device is not connected, is shutting down, did not answer within 20 s, or the call was cut off inside Deepdock by a restart or deploy. **A write may still have landed** | yes, with backoff (seconds to minutes); a write only with the same key | "the customer PC is offline; we will retry" |
64
64
  | `device_syncing` | 503 | the device has not reported its Deepdock client yet (just paired, or its report did not come through); Deepdock asks it again. Nothing was written | yes, after `Retry-After` (5 s); a write with the same key | "the customer PC is connecting; retrying" |
65
- | `device_outdated` | 409 | the device's Deepdock client is too old for this call. It updates itself when a newer version is released for your organisation, once nobody is signed in on the PC. Nothing was written | after the update (`outdated` on `GET /v1/devices/{deviceId}` turns `false`); retrying before it gets the same answer. A write keeps its key | "the Deepdock client on the customer PC needs an update" |
66
- | `system_version_unverified` | 409 | a write on a system whose vendor version Deepdock has not verified yet. Nothing was sent to the device; reads still work. `error.version` is the version the system last reported (null when it reported none) and `error.reason` is `unverified_version`, `unparseable` when that version is not dotted digits, or `unreported` when the system reported no version: a write over the system's own HTTP interface is verified for one exact release and needs it | `unverified_version`: after Deepdock has verified that version (`writes` on the system in `GET /v1/devices/{deviceId}` turns `verified`); retrying before it gets the same answer. `unparseable`: retrying does not help, contact Deepdock; only a different reported version changes it. `unreported`: later, once the device reports the system's version. A write keeps its key | "the customer's system was updated to a version Deepdock has not yet verified; changes will work once it has" |
65
+ | `device_outdated` | 409 | the device's Deepdock client is too old for this call. It updates itself when a newer version is released for your organisation, once nobody is signed in on the PC. Nothing was written | after the update (on `GET /v1/devices/{deviceId}`, `outdated` turns `false` and the action leaves the system's `blockedActions`); retrying before it gets the same answer. A write keeps its key | "the Deepdock client on the customer PC needs an update" |
66
+ | `version_not_covered` | 409 | the customer's installed version of the system is not yet approved by Deepdock for this action. Nothing was run. The message names the system, its version and the action | **no.** Retrying gets the same answer. It changes when Deepdock approves that version for the action, or when the customer runs an approved version | "this feature is not yet available for the customer's version of the software; Deepdock has to approve it first" |
67
67
  | `action_paused` | 503 | the action is paused on the device (`GET .../systems` shows `reason`); only Deepdock resumes it | later, when `GET .../systems` shows it active; do not loop | "this feature is paused while Deepdock checks the customer system" |
68
68
  | `system_unavailable` | 503 | the customer's program is stopped or missing on the device | later; often resolves when the customer restarts the program | "the customer's software is not running" |
69
69
  | `target_busy` | 503 | the customer's system is busy or unreachable | yes, with backoff | "the customer's system is busy; retrying" |
@@ -113,7 +113,7 @@ const REACTION: Record<string, Reaction> = {
113
113
  device_offline: 'retry-same-key',
114
114
  device_syncing: 'retry-same-key',
115
115
  device_outdated: 'retry-later',
116
- system_version_unverified: 'retry-later',
116
+ version_not_covered: 'stop',
117
117
  action_paused: 'wait-paused',
118
118
  system_unavailable: 'retry-later',
119
119
  target_busy: 'retry-same-key',
@@ -23,6 +23,7 @@ import { Deepdock, DeepdockError, DeepdockTransportError, attempt, type PendingW
23
23
  const dd = new Deepdock(process.env.DEEPDOCK_API_KEY!) // base from DEEPDOCK_BASE_URL, else production; 35 s timeout, retries 503 target_busy
24
24
  const page = await dd.read<Note>(deviceId, 'example-erp', 'searchNotes', { text: 'TEST-DEEPDOCK-' }, { limit: 50 })
25
25
  for await (const p of dd.readAll<Note>(deviceId, 'example-erp', 'searchNotes', { text: 'TEST-DEEPDOCK-' })) { /* every page */ }
26
+ const { bytes, contentType, filename } = await dd.download(deviceId, 'example-erp', 'downloadDocument', { documentId: 7 }) // a `file: true` action
26
27
  const { data, replayed } = await dd.write<{ noteId: number }>(deviceId, 'example-erp', 'createNote', 'create', key, input)
27
28
  const systems = await dd.systems(deviceId) // live; can throw device_offline
28
29
  const device = await dd.pair('K7Q-4MX', 'Demo') // keep device.id
@@ -33,6 +34,7 @@ from deepdock import Deepdock, DeepdockError, DeepdockTransportError, PendingWri
33
34
 
34
35
  dd = Deepdock(os.environ["DEEPDOCK_API_KEY"])
35
36
  page = dd.read(device_id, "example-erp", "searchNotes", {"text": "TEST-DEEPDOCK-"}, limit=50)
37
+ doc = dd.download(device_id, "example-erp", "downloadDocument", {"documentId": 7}) # doc.content, doc.content_type, doc.filename
36
38
  res = dd.write(device_id, "example-erp", "createNote", "create", key, body) # res.data, res.replayed
37
39
  ```
38
40
 
@@ -122,7 +124,7 @@ curl -sS "$BASE/v1/devices/$DEVICE/systems" -H "$AUTH"
122
124
  # The action index (your assigned actions, with schemas)
123
125
  curl -sS "$BASE/v1/devices/$DEVICE/systems/example-erp/actions" -H "$AUTH"
124
126
 
125
- # A read is a POST too, with its inputs and limit/cursor in the body; paged: pass data.nextCursor back as cursor
127
+ # A read is a POST too, with its inputs and limit/cursor in the body; paged: pass the answer's top-level nextCursor back as cursor
126
128
  curl -sS -X POST "$BASE/v1/devices/$DEVICE/systems/example-erp/actions/searchNotes" \
127
129
  -H "$AUTH" -H 'Content-Type: application/json' -d '{"text":"TEST-DEEPDOCK-","limit":50}'
128
130
 
@@ -70,7 +70,7 @@ input, a status (`pending`, `sent`, `done`, `unknown`, `refused`) and the result
70
70
 
71
71
  ```
72
72
  pending ──send──▶ sent ──2xx (fresh or replayed)──────────────▶ done
73
- │ ──device_offline, device_syncing, device_outdated, system_version_unverified, timeout, network error, target_busy, temporarily_unavailable, internal_error ▶ sent (retry later, same key)
73
+ │ ──device_offline, device_syncing, device_outdated, timeout, network error, target_busy, temporarily_unavailable, internal_error ▶ sent (retry later, same key)
74
74
  │ ──idempotency_conflict, retries left ───▶ sent (retry, same key, same input)
75
75
  │ ──idempotency_conflict, retries spent ──▶ unknown (read back before anything else)
76
76
  │ ──outcome_unknown ──────────────────────▶ unknown (read back before anything else)
@@ -40,7 +40,7 @@ No action deletes anything, and nothing is undone through the API. So:
40
40
 
41
41
  The CLI runs no action, so this loop is your code's, against the demo device:
42
42
 
43
- 1. `deepdock devices systems <device> --org <slug> --json`: the system is running and every action
43
+ 1. `deepdock devices systems <deviceId> --org <slug> --json`: the system is running and every action
44
44
  you need is active; otherwise stop and read the pause reason and `deepdock incidents list`.
45
45
  2. **Create** with a fresh idempotency key and `TEST-DEEPDOCK-` names: expect `201` and an id.
46
46
  3. **Replay** the same request with the same key: expect `200`, `Idempotent-Replayed: true`, no
@@ -66,7 +66,7 @@ The proof is your client; the CLI only shows what the device offers.
66
66
 
67
67
  ## Logs and prompts
68
68
 
69
- - Never log an action's `input` or a read's `items` in your running product: they are the customer's
69
+ - Never log an action's `input` or a read's rows in your running product: they are the customer's
70
70
  records. Log the device id, the action, the code and the request id.
71
71
  - Never paste real records into an agent prompt or a ticket. Use the `TEST-DEEPDOCK-` records from
72
72
  the demo device when you need a concrete example.