@docmana/sdk 0.28.1 → 0.32.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 +251 -209
- package/LICENSE +21 -21
- package/README.md +94 -0
- package/dist/authoring.d.ts +317 -0
- package/dist/cli.mjs +144 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/errors.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +148 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +146 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,217 +1,259 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.32.0 - 2026-10-19
|
|
6
|
+
|
|
7
|
+
- Release the additive `Docmana.authoring` API for scoped formula reads, create/save/validate/publish/history, native archives, sorting, assisted conversations, editor catalog and mapping proposals.
|
|
8
|
+
- Preserve normalized API business error codes and optional POC provenance types. Optional Git/projection write fields are not accepted by DocMana API main; omit them on the ordinary Mongo authoring path.
|
|
9
|
+
- Add revision-pinned `authoring.documentTrialDefinitions` for server-side assisted document trials in DocMana Flows, using existing DocMana API main reads.
|
|
10
|
+
- Document assisted trial execution separately from native manual trials; document-trial reports can identify their executor. No new DocMana API endpoint is required.
|
|
11
|
+
|
|
12
|
+
### Earlier local POC iteration notes
|
|
13
|
+
|
|
14
|
+
The earlier 0.29–0.31 authoring iterations are incorporated in 0.32.0. Assisted classification/extraction now uses `documentTrialDefinitions` and the Flows executor; the experimental DocMana API `/extract/test-assisted` route is not required. The multipart `documentTrial` execution route remains manual-only with API main.
|
|
15
|
+
|
|
16
|
+
### Previously unreleased authoring additions
|
|
17
|
+
|
|
18
|
+
- Add full compiled prompt upserts, Git projection provenance, the staged state,
|
|
19
|
+
runtime capabilities and artifact/tooling hashes for traced publication.
|
|
20
|
+
|
|
21
|
+
- Add organization-scoped document trials through Consumer Edge and native DocMana API, with native revision checks or compiled YAML draft prompts.
|
|
22
|
+
|
|
23
|
+
- Add typed Git/Mongo authoring sources, Git publication provenance and Mongo divergence state; forward an optional exact Git commit when publishing.
|
|
24
|
+
|
|
25
|
+
### Editor catalog and conversations
|
|
26
|
+
|
|
27
|
+
- Add the organization-scoped native editor catalog and JSONata mapping proposal methods.
|
|
28
|
+
|
|
29
|
+
- Preserve public API business error codes in optional `DocmanaError.apiCode`,
|
|
30
|
+
without changing existing SDK error categories or retry behavior.
|
|
31
|
+
|
|
32
|
+
- Add organization-scoped assisted-rule conversations: opening with context and
|
|
33
|
+
optional transcript, sending messages, and acknowledging approved proposals.
|
|
34
|
+
- Preserve native proposal/context payloads and expired-conversation HTTP 410.
|
|
35
|
+
Requires Consumer Edge's additive authoring conversation endpoints (DOC-2385).
|
|
36
|
+
|
|
37
|
+
### Native authoring and archives
|
|
38
|
+
|
|
39
|
+
- Add `Docmana.authoring` for organization-scoped native formula discovery,
|
|
40
|
+
creation, draft saving, validation, publication, history and feature flags.
|
|
41
|
+
- Export lossless native authoring types and revision/operation receipt types.
|
|
42
|
+
Requires Consumer Edge's additive `/v1/authoring` contract (DOC-2385).
|
|
5
43
|
## 0.28.1 - 2026-10-02
|
|
6
44
|
|
|
7
45
|
- Add `QUEUED` to the public `ExecutionStatus` type and verify that polling
|
|
8
46
|
continues through `QUEUED` and `INCOMPLETED` before retrieving the completed result.
|
|
9
47
|
|
|
48
|
+
- Add native archive import/export and formula deletion, with explicit import
|
|
49
|
+
overwrite confirmation and a 10 MiB archive limit.
|
|
50
|
+
- Add server-side list sorting and formula dates/execution/document totals.
|
|
51
|
+
|
|
10
52
|
## 0.28.0 - 2026-09-09
|
|
11
|
-
|
|
12
|
-
- Expose optional Fraud Detection API build identity on results through
|
|
13
|
-
`processor.apiVersion`, `processor.gitCommit`, and `processor.buildTime`.
|
|
14
|
-
|
|
15
|
-
## 0.27.0 - 2026-09-08
|
|
16
|
-
|
|
17
|
-
- Expose optional physical-document provenance, logical-document identifiers,
|
|
18
|
-
and page ranges on execution document mappings.
|
|
19
|
-
- Preserve legacy execution mappings unchanged when source provenance is absent.
|
|
20
|
-
|
|
21
|
-
## 0.26.0 - 2026-09-07
|
|
22
|
-
|
|
23
|
-
- Expose the exact numeric version that a new flow execution would use through
|
|
24
|
-
`getFlowMetadata`.
|
|
25
|
-
|
|
26
|
-
## 0.25.0 - 2026-08-24
|
|
27
|
-
|
|
28
|
-
- Stream file-path inputs from disk instead of loading them completely into memory.
|
|
29
|
-
- Expose typed `413` and `503` upload errors, preserve `Retry-After`, and retry one
|
|
30
|
-
multipart admission `503` carrying that header with a fresh request body.
|
|
31
|
-
|
|
32
|
-
## 0.24.0 - 2026-08-20
|
|
33
|
-
|
|
34
|
-
- Preserve the exact numeric flow version when mapping raw execution results.
|
|
35
|
-
- Expose each processing step's LLM model and immutable prompt identifier without
|
|
36
|
-
reintroducing token or cost telemetry.
|
|
37
|
-
- Update vulnerable HTTP and build-tool transitive dependencies to patched versions.
|
|
38
|
-
|
|
39
|
-
## 0.23.0 - 2026-08-07
|
|
40
|
-
|
|
41
|
-
- Align the Fraud result with Consumer Edge's functional public contract.
|
|
42
|
-
- Keep verdict, confidence, reasoning, summary, findings, document id, and duration.
|
|
43
|
-
- Remove internal preprocessing, layer telemetry, model usage, token counts, costs,
|
|
44
|
-
and persistence diagnostics; finding categories remain available through `finding.layer`.
|
|
45
|
-
|
|
46
|
-
## 0.22.0 - 2026-08-06
|
|
47
|
-
|
|
48
|
-
- Expose the complete Consumer Edge fraud-analysis telemetry: global totals,
|
|
49
|
-
preprocessing, verdict, and per-layer duration, token usage, LLM calls, model
|
|
50
|
-
usage, cost, and errors.
|
|
51
|
-
- Keep model usage Mongo-safe as `modelUsage[]` and continue excluding the
|
|
52
|
-
sensitive Fraud `document` payload.
|
|
53
|
-
|
|
54
|
-
## 0.21.0 - 2026-08-05
|
|
55
|
-
|
|
56
|
-
- Relay the native Fraud job identifier through Consumer Edge while preserving
|
|
57
|
-
the existing high-level polling workflow.
|
|
58
|
-
- Add local file, named byte, and readable stream inputs to `detectFraud` and
|
|
59
|
-
`detectFraudAsync` through the existing `FileInput` contract.
|
|
60
|
-
- Stop sending organization correlation on Fraud requests. The deprecated
|
|
61
|
-
organization arguments remain accepted and ignored for source compatibility.
|
|
62
|
-
- Expose Consumer Edge's BI-friendly Fraud result contract: aggregate `summary`,
|
|
63
|
-
referenced `findings`, and detection `layers` keyed by their unique names.
|
|
64
|
-
|
|
65
|
-
## 0.20.0 - 2026-08-04
|
|
66
|
-
|
|
67
|
-
- Add `detectFraud` to start a Consumer Edge fraud-detection job, poll its
|
|
68
|
-
status, and return the normalized verdict and findings.
|
|
69
|
-
- Add `detectFraudAsync`, `getFraudDetectionStatus`, and
|
|
70
|
-
`getFraudDetectionResult` for callers that manage polling themselves.
|
|
71
|
-
- Respect `X-Poll-After` and `Retry-After`, retry transient status failures,
|
|
72
|
-
and expose typed failure, timeout, and cancellation errors.
|
|
73
|
-
|
|
74
|
-
## 0.19.0 - 2026-08-04
|
|
75
|
-
|
|
76
|
-
- Add synchronous and asynchronous V2 partial flow execution through Consumer Edge.
|
|
77
|
-
- Use `executionScope`, `flowVersion`, and `classificationNodeNames` in the
|
|
78
|
-
multipart body, leaving only `organization` in the query string.
|
|
79
|
-
- Return the standard `DocmanaExecutionResult` shape with optional
|
|
80
|
-
`partialExecution` metadata.
|
|
81
|
-
|
|
82
|
-
## 0.18.0
|
|
83
|
-
- Expose the optional aggregate `verdict` on `DocmanaExecutionResult`, preserving
|
|
84
|
-
the `VALID`, `PARTIAL`, `WARNING`, `FAILED`, or `UNKNOWN` value computed by
|
|
85
|
-
Docmana API and returned by consumer-edge.
|
|
86
|
-
|
|
87
|
-
## 0.17.0
|
|
88
|
-
- Expose the optional `flowVersion` on `DocmanaExecutionResult`, preserving the
|
|
89
|
-
exact Docmana flow version used by an execution in polling and callback results.
|
|
90
|
-
|
|
91
|
-
consu## 0.16.0
|
|
92
|
-
- Scope organization document access to a specific organization: `listOrganizationDocuments`
|
|
93
|
-
now accepts an `organization` option and `downloadOrganizationDocument(s)` an optional
|
|
94
|
-
`organization` argument, both forwarded as the `?organization=` query param (relayed to
|
|
95
|
-
docmana-api as `X-Selected-Organization`). Without it, consumer-edge reads the caller's
|
|
96
|
-
default organization depot, which leaks another org's documents to callers scoping by site.
|
|
97
|
-
|
|
98
|
-
## 0.15.0
|
|
99
|
-
- Expose `rejectionCode`, `rejectionMessage`, `documentTypeProximity`, and
|
|
100
|
-
`documentContentNature` as optional system fields on node results instead of
|
|
101
|
-
including them in user-defined `data`.
|
|
102
|
-
|
|
103
|
-
## 0.14.0
|
|
104
|
-
- Add the optional human-readable `label` to every mapped node result while
|
|
105
|
-
preserving the stable node name as the record key.
|
|
106
|
-
- Preserve the `REJECTED` status returned by classification nodes and expose it
|
|
107
|
-
in the public `ExecutionStatus` contract.
|
|
108
|
-
- Add document-level `preprocessing` results, including generated steps such as
|
|
109
|
-
`Document Extraction`, correlated to their document by `doc_key`.
|
|
110
|
-
|
|
111
|
-
## 0.13.0
|
|
112
|
-
- Add normalized execution metrics to `DocmanaExecutionResult`:
|
|
113
|
-
`flowId`, `totalDocuments`, `totalPages`, `totalTokens`, `totalMana`, and
|
|
114
|
-
`totalRunningTime`.
|
|
115
|
-
- Add node-level execution metrics to mapped node results: `runningTime` and
|
|
116
|
-
`mana`.
|
|
117
|
-
|
|
118
|
-
## 0.12.0
|
|
119
|
-
- Add `--context <json>` to `docmana flow run`, parsed as a JSON object and
|
|
120
|
-
passed through to `runFlow` as `RunFlowParams.context`.
|
|
121
|
-
- Return CLI usage errors when `--context` is invalid JSON or is not a JSON
|
|
122
|
-
object.
|
|
123
|
-
|
|
124
|
-
## 0.11.0
|
|
125
|
-
- Normalize execution statuses to uppercase SDK values:
|
|
126
|
-
`PENDING`, `RUNNING`, `INCOMPLETED`, `COMPLETED`, and `FAILED`.
|
|
127
|
-
- Normalize raw API and polling statuses before checking terminal or failed
|
|
128
|
-
states, so legacy mixed-case values still map consistently.
|
|
129
|
-
- Rename flow metadata `contextSchema` to `jsonContextSchema` in the public
|
|
130
|
-
`FlowMetadata` shape and README examples.
|
|
131
|
-
|
|
132
|
-
## 0.10.0
|
|
133
|
-
- Add an optional `organization` to flow selection, emitted as a
|
|
134
|
-
`?organization=<org>` query param on the request to
|
|
135
|
-
`docmana-consumer-edge-api`. Purely additive — existing calls are unchanged.
|
|
136
|
-
- `listFlows({ organization })`, `getFlowMetadata(flowId, { organization })`,
|
|
137
|
-
and `getFlowDefinition(flowId, { organization })` accept the option.
|
|
138
|
-
- `RunFlowParams` (and therefore `runFlow` / `runFlowAsync`) gains
|
|
139
|
-
`organization`, threaded onto the `execute-async` request URL.
|
|
140
|
-
- Expose `organization` on `FlowListItem`: when the consumer-edge tags a flow
|
|
141
|
-
with its organization, `listFlows()` now carries it through on each item.
|
|
142
|
-
|
|
143
|
-
## 0.8.1
|
|
144
|
-
- Rename the multipart wire fields sent to `docmana-consumer-edge-api` from
|
|
145
|
-
`json_context` / `callback_url` to `jsonContext` / `callbackUrl`, matching the
|
|
146
|
-
edge-api DTOs that dropped their snake_case `@Expose` mappings. Public inputs
|
|
147
|
-
(`context`, `callbackUrl`) are unchanged.
|
|
148
|
-
|
|
149
|
-
## 0.8.0
|
|
150
|
-
- Add organization document depot methods and CLI commands:
|
|
151
|
-
`listOrganizationDocuments()`, `downloadOrganizationDocument()`, and
|
|
152
|
-
`downloadOrganizationDocuments()`.
|
|
153
|
-
- Add `docmana organization document list/download`.
|
|
154
|
-
- Make `docmana organization document download --output` optional; default output
|
|
155
|
-
is `./{path}`.
|
|
156
|
-
|
|
157
|
-
## 0.7.0
|
|
158
|
-
- Add `getFlowMetadata()` / `docmana flow metadata` for projected flow runtime
|
|
159
|
-
metadata from `docmana-consumer-edge-api`.
|
|
160
|
-
- Add `getFlowDefinition()` / `docmana flow definition` for normalized flow
|
|
161
|
-
graph definitions without exposing the Docmana ZIP export.
|
|
162
|
-
|
|
163
|
-
## 0.6.0
|
|
164
|
-
- Add `listOrganizations()` and `docmana organization list` to list organizations
|
|
165
|
-
available through `docmana-consumer-edge-api`.
|
|
166
|
-
|
|
167
|
-
## 0.5.0
|
|
168
|
-
- Add `listFlows()` to list flows available through `docmana-consumer-edge-api`,
|
|
169
|
-
returning `{ id, name, state }[]` with `state: "unknown"` when Docmana omits it.
|
|
170
|
-
- Add `docmana flow list` CLI command, with the same API URL and Bearer token resolution as `docmana flow run`.
|
|
171
|
-
- Rename `RunFlowInput` to `RunFlowParams` and move polling controls to
|
|
172
|
-
`RunFlowOptions`.
|
|
173
|
-
- Remove the single-file `file` shortcut from flow params; callers now pass
|
|
174
|
-
`files`.
|
|
175
|
-
- Remove `fileName` from flow params; byte and stream inputs now use
|
|
176
|
-
`{ data, filename, contentType? }`.
|
|
177
|
-
- Replace `runFlowWithCallback` with `runFlowAsync(..., { callbackUrl })`.
|
|
178
|
-
|
|
179
|
-
## 0.3.5
|
|
180
|
-
- Add callback execution support: starts a flow and returns `{ executionResultId, fileIds }` **without polling**, registering a `callback_url` so docmana-api POSTs a completion notification when the run finishes. Call `getResult(executionResultId)` on receipt to fetch the mapped result.
|
|
181
|
-
|
|
182
|
-
## 0.3.3
|
|
183
|
-
- Add `RunFlowParams.context` (business `json_context`): when provided, `runFlow`/`runFlowAsync` include `json_context` in the request body for both `run_flow` and `run_once_flow`. The context is passed through as-is — filtering against the flow's *Start* node properties is performed server-side by docmana-api.
|
|
184
|
-
|
|
185
|
-
## 0.3.2
|
|
186
|
-
- Add `scoreDescription` to score-node results (Validation, Classification, CrossValidation, Conclusion).
|
|
187
|
-
- Fix: when a target `language` is requested, the **textual** score-node fields `feedback` and `scoreDescription` are now returned from `translations[language]` (falling back to the default values when the translation omits them). The numeric `score` is language-independent and is always taken from the default node. Previously only the dynamic `data` fields were translated while the textual fields stayed in the flow's default language.
|
|
188
|
-
|
|
189
|
-
## 0.3.1
|
|
190
|
-
- Fix: upload all files in a single `/upload` call (one folder UUID) instead of one call per file. Sending each file separately made Docmana treat them as distinct documents, which breaks multi-document flows ("Node already present" when the same flow node is built per document).
|
|
191
|
-
|
|
192
|
-
## 0.3.0
|
|
193
|
-
- Relocated mapper logic and tests to `src/mappers/`.
|
|
194
|
-
- Renamed SDK models to `DocmanaX` and API models to `DocmanaApiX` to distinguish raw backend types from clean public SDK types.
|
|
195
|
-
- Pluralized `classification` results into a `classifications` key-value record on document results.
|
|
196
|
-
- Nested dynamic extraction fields inside a dedicated `data` record on node results to prevent property name collisions.
|
|
197
|
-
- Restructured node result interfaces to remove `score` and `feedback` from `DocmanaExtractionResult` and `DocmanaMetadataExtractionResult` (via new `DocmanaScoreNodeResult` interface).
|
|
198
|
-
- Excluded internal fields `result` and `documentType` from mapped SDK results.
|
|
199
|
-
|
|
200
|
-
## 0.2.2
|
|
201
|
-
- Fix `package-lock.json`.
|
|
202
|
-
|
|
203
|
-
## 0.2.1
|
|
204
|
-
- 400 responses now throw `DocmanaRequestError` (was `DocmanaAuthError`); add `Incompleted` to `ExecutionStatus`.
|
|
205
|
-
|
|
206
|
-
## 0.2.0
|
|
207
|
-
- `RunFlowParams.once` selects the ad-hoc `run_once_flow` endpoint (current/draft flow) instead of the published `run_flow`.
|
|
208
|
-
- `DocmanaConfig.headers` are sent on every API request (e.g. `X-Selected-Organization`), without overriding the bearer token or per-request headers.
|
|
209
|
-
- `FileInput` now accepts a plain `Uint8Array` (e.g. pdf-lib output) in addition to path, `Buffer`, and `Stream`.
|
|
210
|
-
- Uploads send a `Content-Type` inferred from the filename extension instead of always `application/octet-stream`.
|
|
211
|
-
|
|
212
|
-
## 0.1.0
|
|
213
|
-
- Single-call `runFlow` orchestration: upload → run → poll → result.
|
|
214
|
-
- OAuth2 client-credentials auth with in-memory token cache and automatic refresh.
|
|
215
|
-
- Typed error hierarchy (`DocmanaError`, `DocmanaExecutionError`, …).
|
|
216
|
-
- Flexible file inputs: path, `Buffer`, `Stream`, and multi-file uploads.
|
|
217
|
-
- Dual ESM + CJS distribution with bundled type definitions.
|
|
53
|
+
|
|
54
|
+
- Expose optional Fraud Detection API build identity on results through
|
|
55
|
+
`processor.apiVersion`, `processor.gitCommit`, and `processor.buildTime`.
|
|
56
|
+
|
|
57
|
+
## 0.27.0 - 2026-09-08
|
|
58
|
+
|
|
59
|
+
- Expose optional physical-document provenance, logical-document identifiers,
|
|
60
|
+
and page ranges on execution document mappings.
|
|
61
|
+
- Preserve legacy execution mappings unchanged when source provenance is absent.
|
|
62
|
+
|
|
63
|
+
## 0.26.0 - 2026-09-07
|
|
64
|
+
|
|
65
|
+
- Expose the exact numeric version that a new flow execution would use through
|
|
66
|
+
`getFlowMetadata`.
|
|
67
|
+
|
|
68
|
+
## 0.25.0 - 2026-08-24
|
|
69
|
+
|
|
70
|
+
- Stream file-path inputs from disk instead of loading them completely into memory.
|
|
71
|
+
- Expose typed `413` and `503` upload errors, preserve `Retry-After`, and retry one
|
|
72
|
+
multipart admission `503` carrying that header with a fresh request body.
|
|
73
|
+
|
|
74
|
+
## 0.24.0 - 2026-08-20
|
|
75
|
+
|
|
76
|
+
- Preserve the exact numeric flow version when mapping raw execution results.
|
|
77
|
+
- Expose each processing step's LLM model and immutable prompt identifier without
|
|
78
|
+
reintroducing token or cost telemetry.
|
|
79
|
+
- Update vulnerable HTTP and build-tool transitive dependencies to patched versions.
|
|
80
|
+
|
|
81
|
+
## 0.23.0 - 2026-08-07
|
|
82
|
+
|
|
83
|
+
- Align the Fraud result with Consumer Edge's functional public contract.
|
|
84
|
+
- Keep verdict, confidence, reasoning, summary, findings, document id, and duration.
|
|
85
|
+
- Remove internal preprocessing, layer telemetry, model usage, token counts, costs,
|
|
86
|
+
and persistence diagnostics; finding categories remain available through `finding.layer`.
|
|
87
|
+
|
|
88
|
+
## 0.22.0 - 2026-08-06
|
|
89
|
+
|
|
90
|
+
- Expose the complete Consumer Edge fraud-analysis telemetry: global totals,
|
|
91
|
+
preprocessing, verdict, and per-layer duration, token usage, LLM calls, model
|
|
92
|
+
usage, cost, and errors.
|
|
93
|
+
- Keep model usage Mongo-safe as `modelUsage[]` and continue excluding the
|
|
94
|
+
sensitive Fraud `document` payload.
|
|
95
|
+
|
|
96
|
+
## 0.21.0 - 2026-08-05
|
|
97
|
+
|
|
98
|
+
- Relay the native Fraud job identifier through Consumer Edge while preserving
|
|
99
|
+
the existing high-level polling workflow.
|
|
100
|
+
- Add local file, named byte, and readable stream inputs to `detectFraud` and
|
|
101
|
+
`detectFraudAsync` through the existing `FileInput` contract.
|
|
102
|
+
- Stop sending organization correlation on Fraud requests. The deprecated
|
|
103
|
+
organization arguments remain accepted and ignored for source compatibility.
|
|
104
|
+
- Expose Consumer Edge's BI-friendly Fraud result contract: aggregate `summary`,
|
|
105
|
+
referenced `findings`, and detection `layers` keyed by their unique names.
|
|
106
|
+
|
|
107
|
+
## 0.20.0 - 2026-08-04
|
|
108
|
+
|
|
109
|
+
- Add `detectFraud` to start a Consumer Edge fraud-detection job, poll its
|
|
110
|
+
status, and return the normalized verdict and findings.
|
|
111
|
+
- Add `detectFraudAsync`, `getFraudDetectionStatus`, and
|
|
112
|
+
`getFraudDetectionResult` for callers that manage polling themselves.
|
|
113
|
+
- Respect `X-Poll-After` and `Retry-After`, retry transient status failures,
|
|
114
|
+
and expose typed failure, timeout, and cancellation errors.
|
|
115
|
+
|
|
116
|
+
## 0.19.0 - 2026-08-04
|
|
117
|
+
|
|
118
|
+
- Add synchronous and asynchronous V2 partial flow execution through Consumer Edge.
|
|
119
|
+
- Use `executionScope`, `flowVersion`, and `classificationNodeNames` in the
|
|
120
|
+
multipart body, leaving only `organization` in the query string.
|
|
121
|
+
- Return the standard `DocmanaExecutionResult` shape with optional
|
|
122
|
+
`partialExecution` metadata.
|
|
123
|
+
|
|
124
|
+
## 0.18.0
|
|
125
|
+
- Expose the optional aggregate `verdict` on `DocmanaExecutionResult`, preserving
|
|
126
|
+
the `VALID`, `PARTIAL`, `WARNING`, `FAILED`, or `UNKNOWN` value computed by
|
|
127
|
+
Docmana API and returned by consumer-edge.
|
|
128
|
+
|
|
129
|
+
## 0.17.0
|
|
130
|
+
- Expose the optional `flowVersion` on `DocmanaExecutionResult`, preserving the
|
|
131
|
+
exact Docmana flow version used by an execution in polling and callback results.
|
|
132
|
+
|
|
133
|
+
consu## 0.16.0
|
|
134
|
+
- Scope organization document access to a specific organization: `listOrganizationDocuments`
|
|
135
|
+
now accepts an `organization` option and `downloadOrganizationDocument(s)` an optional
|
|
136
|
+
`organization` argument, both forwarded as the `?organization=` query param (relayed to
|
|
137
|
+
docmana-api as `X-Selected-Organization`). Without it, consumer-edge reads the caller's
|
|
138
|
+
default organization depot, which leaks another org's documents to callers scoping by site.
|
|
139
|
+
|
|
140
|
+
## 0.15.0
|
|
141
|
+
- Expose `rejectionCode`, `rejectionMessage`, `documentTypeProximity`, and
|
|
142
|
+
`documentContentNature` as optional system fields on node results instead of
|
|
143
|
+
including them in user-defined `data`.
|
|
144
|
+
|
|
145
|
+
## 0.14.0
|
|
146
|
+
- Add the optional human-readable `label` to every mapped node result while
|
|
147
|
+
preserving the stable node name as the record key.
|
|
148
|
+
- Preserve the `REJECTED` status returned by classification nodes and expose it
|
|
149
|
+
in the public `ExecutionStatus` contract.
|
|
150
|
+
- Add document-level `preprocessing` results, including generated steps such as
|
|
151
|
+
`Document Extraction`, correlated to their document by `doc_key`.
|
|
152
|
+
|
|
153
|
+
## 0.13.0
|
|
154
|
+
- Add normalized execution metrics to `DocmanaExecutionResult`:
|
|
155
|
+
`flowId`, `totalDocuments`, `totalPages`, `totalTokens`, `totalMana`, and
|
|
156
|
+
`totalRunningTime`.
|
|
157
|
+
- Add node-level execution metrics to mapped node results: `runningTime` and
|
|
158
|
+
`mana`.
|
|
159
|
+
|
|
160
|
+
## 0.12.0
|
|
161
|
+
- Add `--context <json>` to `docmana flow run`, parsed as a JSON object and
|
|
162
|
+
passed through to `runFlow` as `RunFlowParams.context`.
|
|
163
|
+
- Return CLI usage errors when `--context` is invalid JSON or is not a JSON
|
|
164
|
+
object.
|
|
165
|
+
|
|
166
|
+
## 0.11.0
|
|
167
|
+
- Normalize execution statuses to uppercase SDK values:
|
|
168
|
+
`PENDING`, `RUNNING`, `INCOMPLETED`, `COMPLETED`, and `FAILED`.
|
|
169
|
+
- Normalize raw API and polling statuses before checking terminal or failed
|
|
170
|
+
states, so legacy mixed-case values still map consistently.
|
|
171
|
+
- Rename flow metadata `contextSchema` to `jsonContextSchema` in the public
|
|
172
|
+
`FlowMetadata` shape and README examples.
|
|
173
|
+
|
|
174
|
+
## 0.10.0
|
|
175
|
+
- Add an optional `organization` to flow selection, emitted as a
|
|
176
|
+
`?organization=<org>` query param on the request to
|
|
177
|
+
`docmana-consumer-edge-api`. Purely additive — existing calls are unchanged.
|
|
178
|
+
- `listFlows({ organization })`, `getFlowMetadata(flowId, { organization })`,
|
|
179
|
+
and `getFlowDefinition(flowId, { organization })` accept the option.
|
|
180
|
+
- `RunFlowParams` (and therefore `runFlow` / `runFlowAsync`) gains
|
|
181
|
+
`organization`, threaded onto the `execute-async` request URL.
|
|
182
|
+
- Expose `organization` on `FlowListItem`: when the consumer-edge tags a flow
|
|
183
|
+
with its organization, `listFlows()` now carries it through on each item.
|
|
184
|
+
|
|
185
|
+
## 0.8.1
|
|
186
|
+
- Rename the multipart wire fields sent to `docmana-consumer-edge-api` from
|
|
187
|
+
`json_context` / `callback_url` to `jsonContext` / `callbackUrl`, matching the
|
|
188
|
+
edge-api DTOs that dropped their snake_case `@Expose` mappings. Public inputs
|
|
189
|
+
(`context`, `callbackUrl`) are unchanged.
|
|
190
|
+
|
|
191
|
+
## 0.8.0
|
|
192
|
+
- Add organization document depot methods and CLI commands:
|
|
193
|
+
`listOrganizationDocuments()`, `downloadOrganizationDocument()`, and
|
|
194
|
+
`downloadOrganizationDocuments()`.
|
|
195
|
+
- Add `docmana organization document list/download`.
|
|
196
|
+
- Make `docmana organization document download --output` optional; default output
|
|
197
|
+
is `./{path}`.
|
|
198
|
+
|
|
199
|
+
## 0.7.0
|
|
200
|
+
- Add `getFlowMetadata()` / `docmana flow metadata` for projected flow runtime
|
|
201
|
+
metadata from `docmana-consumer-edge-api`.
|
|
202
|
+
- Add `getFlowDefinition()` / `docmana flow definition` for normalized flow
|
|
203
|
+
graph definitions without exposing the Docmana ZIP export.
|
|
204
|
+
|
|
205
|
+
## 0.6.0
|
|
206
|
+
- Add `listOrganizations()` and `docmana organization list` to list organizations
|
|
207
|
+
available through `docmana-consumer-edge-api`.
|
|
208
|
+
|
|
209
|
+
## 0.5.0
|
|
210
|
+
- Add `listFlows()` to list flows available through `docmana-consumer-edge-api`,
|
|
211
|
+
returning `{ id, name, state }[]` with `state: "unknown"` when Docmana omits it.
|
|
212
|
+
- Add `docmana flow list` CLI command, with the same API URL and Bearer token resolution as `docmana flow run`.
|
|
213
|
+
- Rename `RunFlowInput` to `RunFlowParams` and move polling controls to
|
|
214
|
+
`RunFlowOptions`.
|
|
215
|
+
- Remove the single-file `file` shortcut from flow params; callers now pass
|
|
216
|
+
`files`.
|
|
217
|
+
- Remove `fileName` from flow params; byte and stream inputs now use
|
|
218
|
+
`{ data, filename, contentType? }`.
|
|
219
|
+
- Replace `runFlowWithCallback` with `runFlowAsync(..., { callbackUrl })`.
|
|
220
|
+
|
|
221
|
+
## 0.3.5
|
|
222
|
+
- Add callback execution support: starts a flow and returns `{ executionResultId, fileIds }` **without polling**, registering a `callback_url` so docmana-api POSTs a completion notification when the run finishes. Call `getResult(executionResultId)` on receipt to fetch the mapped result.
|
|
223
|
+
|
|
224
|
+
## 0.3.3
|
|
225
|
+
- Add `RunFlowParams.context` (business `json_context`): when provided, `runFlow`/`runFlowAsync` include `json_context` in the request body for both `run_flow` and `run_once_flow`. The context is passed through as-is — filtering against the flow's *Start* node properties is performed server-side by docmana-api.
|
|
226
|
+
|
|
227
|
+
## 0.3.2
|
|
228
|
+
- Add `scoreDescription` to score-node results (Validation, Classification, CrossValidation, Conclusion).
|
|
229
|
+
- Fix: when a target `language` is requested, the **textual** score-node fields `feedback` and `scoreDescription` are now returned from `translations[language]` (falling back to the default values when the translation omits them). The numeric `score` is language-independent and is always taken from the default node. Previously only the dynamic `data` fields were translated while the textual fields stayed in the flow's default language.
|
|
230
|
+
|
|
231
|
+
## 0.3.1
|
|
232
|
+
- Fix: upload all files in a single `/upload` call (one folder UUID) instead of one call per file. Sending each file separately made Docmana treat them as distinct documents, which breaks multi-document flows ("Node already present" when the same flow node is built per document).
|
|
233
|
+
|
|
234
|
+
## 0.3.0
|
|
235
|
+
- Relocated mapper logic and tests to `src/mappers/`.
|
|
236
|
+
- Renamed SDK models to `DocmanaX` and API models to `DocmanaApiX` to distinguish raw backend types from clean public SDK types.
|
|
237
|
+
- Pluralized `classification` results into a `classifications` key-value record on document results.
|
|
238
|
+
- Nested dynamic extraction fields inside a dedicated `data` record on node results to prevent property name collisions.
|
|
239
|
+
- Restructured node result interfaces to remove `score` and `feedback` from `DocmanaExtractionResult` and `DocmanaMetadataExtractionResult` (via new `DocmanaScoreNodeResult` interface).
|
|
240
|
+
- Excluded internal fields `result` and `documentType` from mapped SDK results.
|
|
241
|
+
|
|
242
|
+
## 0.2.2
|
|
243
|
+
- Fix `package-lock.json`.
|
|
244
|
+
|
|
245
|
+
## 0.2.1
|
|
246
|
+
- 400 responses now throw `DocmanaRequestError` (was `DocmanaAuthError`); add `Incompleted` to `ExecutionStatus`.
|
|
247
|
+
|
|
248
|
+
## 0.2.0
|
|
249
|
+
- `RunFlowParams.once` selects the ad-hoc `run_once_flow` endpoint (current/draft flow) instead of the published `run_flow`.
|
|
250
|
+
- `DocmanaConfig.headers` are sent on every API request (e.g. `X-Selected-Organization`), without overriding the bearer token or per-request headers.
|
|
251
|
+
- `FileInput` now accepts a plain `Uint8Array` (e.g. pdf-lib output) in addition to path, `Buffer`, and `Stream`.
|
|
252
|
+
- Uploads send a `Content-Type` inferred from the filename extension instead of always `application/octet-stream`.
|
|
253
|
+
|
|
254
|
+
## 0.1.0
|
|
255
|
+
- Single-call `runFlow` orchestration: upload → run → poll → result.
|
|
256
|
+
- OAuth2 client-credentials auth with in-memory token cache and automatic refresh.
|
|
257
|
+
- Typed error hierarchy (`DocmanaError`, `DocmanaExecutionError`, …).
|
|
258
|
+
- Flexible file inputs: path, `Buffer`, `Stream`, and multi-file uploads.
|
|
259
|
+
- Dual ESM + CJS distribution with bundled type definitions.
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Docmana
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Docmana
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Official Docmana SDK for calling `docmana-consumer-edge-api`.
|
|
4
4
|
|
|
5
|
+
SDK 0.32.0 adds native formula authoring, assisted conversations and revision-pinned
|
|
6
|
+
document-trial preparation. Deploy Consumer authoring support before publishing
|
|
7
|
+
and adopting this version. DocMana API main supports the ordinary Mongo path;
|
|
8
|
+
assisted document trials run in DocMana Flows. A local development tarball is not
|
|
9
|
+
an npm release. Optional Git/projection types remain POC contracts, not proof of
|
|
10
|
+
support by API main.
|
|
11
|
+
|
|
5
12
|
The SDK sends documents to Consumer, starts an async flow, polls Consumer for
|
|
6
13
|
status, and returns the mapped Consumer execution DTO.
|
|
7
14
|
|
|
@@ -345,6 +352,9 @@ from the Bearer token.
|
|
|
345
352
|
Every SDK error extends `DocmanaError`, which carries `.status`, `.code`, and an
|
|
346
353
|
optional `.requestId` when available.
|
|
347
354
|
|
|
355
|
+
The optional `.apiCode` preserves the public API business code (for example,
|
|
356
|
+
`RULE_INTEGRITY_VIOLATION`). `.code` keeps its existing SDK error category.
|
|
357
|
+
|
|
348
358
|
| Error | Thrown when |
|
|
349
359
|
| -------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
350
360
|
| `DocmanaRequestError` | `400` bad request. |
|
|
@@ -379,6 +389,90 @@ For a one-shot publish to the local yalc store:
|
|
|
379
389
|
npm run yalc:publish
|
|
380
390
|
```
|
|
381
391
|
|
|
392
|
+
## Native formula authoring
|
|
393
|
+
|
|
394
|
+
SDK 0.30.0 adds the existing DocMana stateful assistant through
|
|
395
|
+
`authoring.openConversation({ flow_id, language, scope?, node_id?, messages? }, options)`,
|
|
396
|
+
`sendConversationMessage(conversationId, content, options)` and
|
|
397
|
+
`confirmConversation(conversationId, { rule_id?, document_type_rename? }, options)`.
|
|
398
|
+
All three require organization scope and accept an abort signal. Opening does
|
|
399
|
+
not call the LLM. Replies contain native context, suggestions and proposals;
|
|
400
|
+
the client must explicitly apply and save approved rules. Confirmation only
|
|
401
|
+
acknowledges acceptance; it does not save or publish. HTTP 410 means the session
|
|
402
|
+
expired: reopen with the prior transcript and resolved context, then send the
|
|
403
|
+
new message. Do not replay an uncertain network failure automatically.
|
|
404
|
+
|
|
405
|
+
`docmana.authoring` manages native formulas through Consumer Edge's
|
|
406
|
+
`/v1/authoring` endpoints. It requires the DOC-2385 Consumer deployment and the
|
|
407
|
+
DocMana API authoring endpoints. These methods do not manage Git or YAML.
|
|
408
|
+
|
|
409
|
+
```ts
|
|
410
|
+
const options = { organization: "my-organization" };
|
|
411
|
+
const formulas = await docmana.authoring.list({ ...options, limit: 50, offset: 0 });
|
|
412
|
+
const snapshot = await docmana.authoring.get(formulas[0].id, options);
|
|
413
|
+
const command = {
|
|
414
|
+
operationId: crypto.randomUUID(),
|
|
415
|
+
expectedRevisions: snapshot.revisions,
|
|
416
|
+
flowPatch: { name: "Updated formula" },
|
|
417
|
+
};
|
|
418
|
+
const receipt = await docmana.authoring.save(snapshot.flow.id, command, options);
|
|
419
|
+
await docmana.authoring.validate(snapshot.flow.id, receipt.revisions, options);
|
|
420
|
+
// Publication is an explicit separate operation.
|
|
421
|
+
await docmana.authoring.publish(
|
|
422
|
+
snapshot.flow.id,
|
|
423
|
+
{
|
|
424
|
+
operationId: crypto.randomUUID(),
|
|
425
|
+
expectedRevisions: receipt.revisions,
|
|
426
|
+
},
|
|
427
|
+
options,
|
|
428
|
+
);
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
Also available: `create`, `history(id, "snapshots" | "published", options)` and
|
|
432
|
+
`flags(options)`. Every call requires an organization and accepts an AbortSignal.
|
|
433
|
+
Lists return arrays; list limits are 1–200 and history limits are 1–100. List sorting is applied before pagination using `sort`: `id` (default), `name`, `newest`, `oldest`, `recentlyModified`, or `leastRecentlyModified`. Summaries include creation/modification dates and execution/document totals when available.
|
|
434
|
+
`get` returns the editable graph, assisted rules, revisions and history counts.
|
|
435
|
+
Create/save/publish return a receipt, not a reloaded graph. Reload with `get`
|
|
436
|
+
after a successful mutation when server-generated prompt/rule identities matter.
|
|
437
|
+
|
|
438
|
+
Retain the same operation ID **and identical body** when retrying an uncertain
|
|
439
|
+
mutation outcome. A 409 has `error.status === 409`: keep the user's draft and
|
|
440
|
+
resolve the conflict explicitly. The SDK never silently rebases or retries a
|
|
441
|
+
conflict. Native metadata remains opaque and must be preserved by editors;
|
|
442
|
+
server-owned identities, history and revisions are not patchable. Assisted
|
|
443
|
+
editing requires the organization's `assisted-flows` flag and backend roles.
|
|
444
|
+
|
|
445
|
+
Archive transfers use the existing DocMana `.docmana`/ZIP format, including
|
|
446
|
+
assisted rules. `exportArchive(id, options)` returns `Uint8Array` bytes.
|
|
447
|
+
`importArchive(blob, filename, options)` accepts one archive up to 10 MiB and
|
|
448
|
+
returns `imported` or `confirmation_required`. On a duplicate, obtain explicit
|
|
449
|
+
user confirmation before submitting the same file with `confirmOverwrite: true`.
|
|
450
|
+
`remove(id, options)` permanently deletes the formula and its authoring data;
|
|
451
|
+
confirm that action with the user. Import and deletion do not use operation IDs.
|
|
452
|
+
|
|
382
453
|
## License
|
|
383
454
|
|
|
384
455
|
MIT
|
|
456
|
+
|
|
457
|
+
`authoring.editorCatalog(options)` retrieves organization-scoped models, tools, external-system field definitions, default prompts and feature flags for native node editors. External-system credentials are excluded. `authoring.generateMapping({ workflow_fields, expected_fields, current_mapping, user_instructions }, options)` returns `{ jsonataExpression }` from the native mapper; it does not save or publish the proposal.
|
|
458
|
+
|
|
459
|
+
### Git publication provenance (local authoring POC)
|
|
460
|
+
|
|
461
|
+
The types preserve optional `authoringSource`, Git commit/artifact hashes and
|
|
462
|
+
projection fields for the POC contract. DocMana API main rejects these fields on
|
|
463
|
+
native create/save/publish, including an explicit `{kind: "mongo"}` discriminator;
|
|
464
|
+
omit them for ordinary Mongo authoring. The current Git POC uses the explicitly
|
|
465
|
+
local Mongo release adapter in DocMana Flows instead.
|
|
466
|
+
|
|
467
|
+
Optional response provenance remains lossless when a compatible backend provides
|
|
468
|
+
it. Consumer and the SDK do not synchronize repositories, verify a checkout,
|
|
469
|
+
compute a publication baseline or automatically publish newer commits. The
|
|
470
|
+
presence of a TypeScript field does not enable an unsupported backend capability.
|
|
471
|
+
|
|
472
|
+
### Document trials
|
|
473
|
+
|
|
474
|
+
Use `authoring.trialDocument(fileBlob, filename, spec, { organization, signal })` for manual document-node trials. `spec` selects a saved native `flowId`, `expectedRevisions`, and either `node` or `allNodes`; alternatively it contains compiled YAML `nodes` with native prompts. Consumer calls the existing DocMana API test-fields/test-metadata endpoints. Temporary YAML prompts are removed in finally; abrupt process failure can leave one for administrator cleanup.
|
|
475
|
+
|
|
476
|
+
For assisted Mongo nodes, call `authoring.documentTrialDefinitions({ flowId, expectedRevisions, node | allNodes }, { organization, signal })`. This read-only preparation pins active node-owned rules and settings to the coherent native snapshot, checking revisions again after resolution. Pass the returned definition and uploaded file to the server-side `runAssistedDocumentTrial` library in `@docmana/docmana-flows`. Git callers use Flows' `prepareDocumentTrial` directly. Neither path requires `/extract/test-assisted` or a modified DocMana API. Calling the old native trial method with assisted nodes now fails before upload with HTTP 422.
|
|
477
|
+
|
|
478
|
+
Flows owns assisted IDP/model calls and requires its server-side provider configuration. It analyzes the file once and tries up to 100 compatible classification/extraction nodes independently, retaining evidence envelopes. Files are nonempty PDF/images up to 20 MiB. Definitions and uploads use disposable local storage, cleaned after completion; no formula, rule, reference expectation or publication is saved. These trials do not execute production routing, translate results, compare expectations or produce release approval evidence. Missing upstream context is rejected. Native API accounting and PromptShield are not implied by the Flows executor. No new CLI command is introduced.
|