@docmana/sdk 0.41.0 → 0.43.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 +16 -0
- package/README.md +66 -0
- package/dist/api/run-flow.d.ts +2 -1
- package/dist/authoring.d.ts +28 -4
- package/dist/cli.mjs +16 -14
- package/dist/cli.mjs.map +1 -1
- package/dist/files/resolve-input.d.ts +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -14
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +6 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.43.0 - 2026-11-18
|
|
4
|
+
|
|
5
|
+
- Add `authoring.renameDocumentType` and its public request/result types. It
|
|
6
|
+
persists an organization-wide rename through the existing native API; callers
|
|
7
|
+
must confirm explicitly, reload afterwards and republish affected formulas.
|
|
8
|
+
Ambiguous failures are not retried automatically.
|
|
9
|
+
|
|
10
|
+
- Expose optional native node-verdict proposals in authoring conversations and the
|
|
11
|
+
`node_verdict` acknowledgement, including joint rule/verdict proposals. Export
|
|
12
|
+
`AuthoringNodeVerdictProposal` and `AuthoringConversationConfirmation` types.
|
|
13
|
+
Confirmation does not save or publish formula changes.
|
|
14
|
+
|
|
15
|
+
## 0.42.0 - 2026-11-16
|
|
16
|
+
|
|
17
|
+
- Support optional `documentData` in full and partial flow executions. Each string is a separate inline document. Use it with uploaded files or by itself.
|
|
18
|
+
|
|
3
19
|
## 0.41.0 - 2026-11-12
|
|
4
20
|
|
|
5
21
|
- Expose optional per-document `receivabilities` in execution results.
|
package/README.md
CHANGED
|
@@ -170,11 +170,18 @@ use `RunFlowParams` for request data:
|
|
|
170
170
|
| Field | Type | Description |
|
|
171
171
|
| ----------------- | -------------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
172
172
|
| `files` | `(string \| { path: string } \| { data, filename, contentType? })[]` | Documents to upload. A string or `{ path }` is treated as a file path. |
|
|
173
|
+
| `documentData` | `readonly string[]` | Inline document text, one string per document. |
|
|
173
174
|
| `context` | `Record<string, unknown>` | Business context serialized as multipart `jsonContext`. |
|
|
174
175
|
| `language` | `string` | Optional result language passed to Consumer. |
|
|
175
176
|
| `useDraftVersion` | `boolean` | Runs the current draft flow version. |
|
|
176
177
|
| `callbackUrl` | `string` | Async-only callback URL, serialized as `callbackUrl`. |
|
|
177
178
|
|
|
179
|
+
Supply `files`, `documentData`, or both. Use one string per document, such as
|
|
180
|
+
`JSON.stringify(transcript)` for a JSON transcript. DocMana classifies each inline
|
|
181
|
+
document separately without OCR. Consumer Edge versions that support
|
|
182
|
+
`documentData` also accept UTF-8 `.json` files in `files`, subject to the inline
|
|
183
|
+
execution payload limit. These inputs are also available for partial executions.
|
|
184
|
+
|
|
178
185
|
`runFlow` uses `RunFlowOptions` for local execution controls:
|
|
179
186
|
|
|
180
187
|
| Field | Type | Description |
|
|
@@ -468,6 +475,32 @@ npm run yalc:publish
|
|
|
468
475
|
|
|
469
476
|
## Native formula authoring
|
|
470
477
|
|
|
478
|
+
### Rename a document type across an organization (0.43.0)
|
|
479
|
+
|
|
480
|
+
After saving local edits and obtaining explicit confirmation:
|
|
481
|
+
|
|
482
|
+
```ts
|
|
483
|
+
const result = await docmana.authoring.renameDocumentType(
|
|
484
|
+
{ flow_id: "formula-id", old_document_type: "invoice", new_document_type: "bill" },
|
|
485
|
+
{ organization: "organization-name", signal: abortController.signal },
|
|
486
|
+
);
|
|
487
|
+
console.log(result.renamed_rules, result.updated_edges);
|
|
488
|
+
// Reload formula/rule-registry snapshots; republish affected formulas separately.
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
`flow_id` is optional context; this always affects the selected organization,
|
|
492
|
+
including other formulas. Consumer delegates to native
|
|
493
|
+
`POST /rules/rename-document-type`; DocMana API owns validation, rule versions,
|
|
494
|
+
references, classification edges and priorities. Native editing roles are
|
|
495
|
+
required. An empty new type is reserved for the native legacy `other` conversion.
|
|
496
|
+
This operation persists immediately, independently of draft save and publication.
|
|
497
|
+
It has no preview or idempotency receipt. On an ambiguous failure, reload and
|
|
498
|
+
inspect the result before another attempt; the SDK does not automatically retry
|
|
499
|
+
409/422/5xx or network errors. Deploy the compatible Consumer route before using
|
|
500
|
+
this method.
|
|
501
|
+
|
|
502
|
+
### Conversations and native editor
|
|
503
|
+
|
|
471
504
|
SDK 0.30.0 adds the existing DocMana stateful assistant through
|
|
472
505
|
`authoring.openConversation({ flow_id, language, scope?, node_id?, messages? }, options)`,
|
|
473
506
|
`sendConversationMessage(conversationId, content, options)` and
|
|
@@ -667,6 +700,39 @@ MIT
|
|
|
667
700
|
|
|
668
701
|
`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.
|
|
669
702
|
|
|
703
|
+
### Assistant node-verdict proposals
|
|
704
|
+
|
|
705
|
+
The native rule assistant can return an optional `proposed_node_verdict` alongside
|
|
706
|
+
`proposed_rule`. Its shape is `{ node_id, verdict_instruction?, score_acceptance_threshold? }`.
|
|
707
|
+
Only supplied settings change: an empty instruction disables the verdict; the
|
|
708
|
+
threshold is an integer from 1 to 100. Validate the target against the same
|
|
709
|
+
assisted Validation/CrossValidation node, review the before/after values, then
|
|
710
|
+
apply the settings to the local draft. A joint rule/verdict proposal should be
|
|
711
|
+
reviewed and applied together.
|
|
712
|
+
|
|
713
|
+
```ts
|
|
714
|
+
const turn = await docmana.authoring.sendConversationMessage(conversationId, message, options);
|
|
715
|
+
const verdict = turn.proposed_node_verdict;
|
|
716
|
+
// After explicit user review and local draft application:
|
|
717
|
+
if (verdict) {
|
|
718
|
+
await docmana.authoring.confirmConversation(
|
|
719
|
+
conversationId,
|
|
720
|
+
{
|
|
721
|
+
...(turn.proposed_rule ? { rule_id: String(turn.proposed_rule.rule_id) } : {}),
|
|
722
|
+
node_verdict: true,
|
|
723
|
+
},
|
|
724
|
+
options,
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
// Save the reviewed draft separately with authoring.save(...), retaining revisions.
|
|
728
|
+
// Publication remains an explicit, separate action.
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
Confirmation only acknowledges acceptance to the assistant; it does not save or
|
|
732
|
+
publish a formula. Retain the local draft if acknowledgement fails. Existing
|
|
733
|
+
backends may omit the optional proposal. Deploy compatible Consumer support
|
|
734
|
+
before publishing SDK 0.43.0 and adopting it in applications.
|
|
735
|
+
|
|
670
736
|
### Git publication provenance (local authoring POC)
|
|
671
737
|
|
|
672
738
|
The types preserve optional `authoringSource`, Git commit/artifact hashes and
|
package/dist/api/run-flow.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ResolvedPart } from "../files/resolve-input.js";
|
|
2
2
|
import type { HttpClient } from "../http/http-client.js";
|
|
3
|
-
|
|
3
|
+
import type { RunFlowAsyncParams } from "../types.js";
|
|
4
|
+
export declare function runFlow(http: HttpClient, flowId: string, parts: ResolvedPart[], params?: RunFlowAsyncParams, signal?: AbortSignal): Promise<{
|
|
4
5
|
executionResultId: string;
|
|
5
6
|
fileIds: string[];
|
|
6
7
|
}>;
|
package/dist/authoring.d.ts
CHANGED
|
@@ -110,6 +110,17 @@ export interface AuthoringRuleImpact {
|
|
|
110
110
|
}[];
|
|
111
111
|
flows_to_republish: string[];
|
|
112
112
|
}
|
|
113
|
+
export interface AuthoringDocumentTypeRename {
|
|
114
|
+
/** Editor context only. The rename always affects the selected organization. */
|
|
115
|
+
flow_id?: string;
|
|
116
|
+
old_document_type: string;
|
|
117
|
+
/** Empty is accepted only for the native legacy other-to-untyped conversion. */
|
|
118
|
+
new_document_type: string;
|
|
119
|
+
}
|
|
120
|
+
export interface AuthoringDocumentTypeRenameResult {
|
|
121
|
+
renamed_rules: string[];
|
|
122
|
+
updated_edges: number;
|
|
123
|
+
}
|
|
113
124
|
export interface AuthoringChanges {
|
|
114
125
|
create?: AuthoringData[];
|
|
115
126
|
update?: {
|
|
@@ -257,11 +268,25 @@ export interface AuthoringConversationInput {
|
|
|
257
268
|
content: string;
|
|
258
269
|
}[];
|
|
259
270
|
}
|
|
271
|
+
/** Only supplied settings change. An empty instruction disables the verdict. */
|
|
272
|
+
export interface AuthoringNodeVerdictProposal {
|
|
273
|
+
node_id: string;
|
|
274
|
+
verdict_instruction?: string;
|
|
275
|
+
/** Integer from 1 to 100. */
|
|
276
|
+
score_acceptance_threshold?: number;
|
|
277
|
+
}
|
|
278
|
+
/** Acknowledge a reviewed proposal; does not save or publish formula data. */
|
|
279
|
+
export interface AuthoringConversationConfirmation {
|
|
280
|
+
rule_id?: string;
|
|
281
|
+
document_type_rename?: boolean;
|
|
282
|
+
node_verdict?: boolean;
|
|
283
|
+
}
|
|
260
284
|
export interface AuthoringConversationTurn {
|
|
261
285
|
assistant_message: string;
|
|
262
286
|
options?: unknown[] | null;
|
|
263
287
|
proposed_rule?: AuthoringData | null;
|
|
264
288
|
proposed_document_type_rename?: AuthoringData | null;
|
|
289
|
+
proposed_node_verdict?: AuthoringNodeVerdictProposal | null;
|
|
265
290
|
context: AuthoringConversationContext;
|
|
266
291
|
target_resolved: boolean;
|
|
267
292
|
expires_at: string;
|
|
@@ -288,6 +313,8 @@ export declare class FormulaAuthoring {
|
|
|
288
313
|
/** Native manual execution through Consumer Edge; assisted trials use definitions plus server-side Flows. */
|
|
289
314
|
trialDocument(file: Blob, filename: string, spec: AuthoringDocumentTrialSpec, options: AuthoringOptions): Promise<AuthoringDocumentTrialReport>;
|
|
290
315
|
editorCatalog(options: AuthoringOptions): Promise<AuthoringEditorCatalog>;
|
|
316
|
+
/** Persists organization-wide. No idempotency receipt: reload after ambiguous failure before retrying. */
|
|
317
|
+
renameDocumentType(body: AuthoringDocumentTypeRename, options: AuthoringOptions): Promise<AuthoringDocumentTypeRenameResult>;
|
|
291
318
|
generateMapping(body: {
|
|
292
319
|
workflow_fields: AuthoringData[];
|
|
293
320
|
expected_fields: AuthoringData[];
|
|
@@ -298,10 +325,7 @@ export declare class FormulaAuthoring {
|
|
|
298
325
|
}>;
|
|
299
326
|
openConversation(body: AuthoringConversationInput, options: AuthoringOptions): Promise<AuthoringConversation>;
|
|
300
327
|
sendConversationMessage(id: string, content: string, options: AuthoringOptions): Promise<AuthoringConversationTurn>;
|
|
301
|
-
confirmConversation(id: string, body: {
|
|
302
|
-
rule_id?: string;
|
|
303
|
-
document_type_rename?: boolean;
|
|
304
|
-
}, options: AuthoringOptions): Promise<{
|
|
328
|
+
confirmConversation(id: string, body: AuthoringConversationConfirmation, options: AuthoringOptions): Promise<{
|
|
305
329
|
expires_at: string;
|
|
306
330
|
}>;
|
|
307
331
|
private request;
|
package/dist/cli.mjs
CHANGED
|
@@ -78,6 +78,11 @@ var FormulaAuthoring = class {
|
|
|
78
78
|
editorCatalog(options) {
|
|
79
79
|
return this.request("GET", "editor-catalog", options);
|
|
80
80
|
}
|
|
81
|
+
/** Persists organization-wide. No idempotency receipt: reload after ambiguous failure before retrying. */
|
|
82
|
+
renameDocumentType(body, options) {
|
|
83
|
+
if (body.flow_id !== void 0) identity(body.flow_id);
|
|
84
|
+
return this.request("POST", "document-types/rename", options, body);
|
|
85
|
+
}
|
|
81
86
|
generateMapping(body, options) {
|
|
82
87
|
return this.request("POST", "generate-mapping", options, body);
|
|
83
88
|
}
|
|
@@ -724,8 +729,10 @@ async function resolveOne(input) {
|
|
|
724
729
|
throw new Error("Unsupported file input type");
|
|
725
730
|
}
|
|
726
731
|
async function resolveInputs(input) {
|
|
727
|
-
const list = input.files;
|
|
728
|
-
if (list.length
|
|
732
|
+
const list = input.files ?? [];
|
|
733
|
+
if (!list.length && !input.documentData?.length) {
|
|
734
|
+
throw new Error("runFlow requires `files` or `documentData`");
|
|
735
|
+
}
|
|
729
736
|
return Promise.all(list.map((item) => resolveOne(item)));
|
|
730
737
|
}
|
|
731
738
|
|
|
@@ -766,7 +773,8 @@ async function waitForRetry(delayMs, signal) {
|
|
|
766
773
|
}
|
|
767
774
|
|
|
768
775
|
// src/sdk/api/run-flow.ts
|
|
769
|
-
async function runFlow(http, flowId, parts,
|
|
776
|
+
async function runFlow(http, flowId, parts, params = {}, signal) {
|
|
777
|
+
const { context, documentData, callbackUrl, language, organization, useDraftVersion } = params;
|
|
770
778
|
const path = `/flows/${flowId}/execute-async`;
|
|
771
779
|
return requestMultipartJson(
|
|
772
780
|
http,
|
|
@@ -775,6 +783,7 @@ async function runFlow(http, flowId, parts, signal, useDraftVersion = false, con
|
|
|
775
783
|
const form = new FormData();
|
|
776
784
|
for (const part of parts) form.append("files", part.data, part.filename);
|
|
777
785
|
if (context !== void 0) form.append("jsonContext", JSON.stringify(context));
|
|
786
|
+
if (documentData?.length) form.append("documentData", JSON.stringify(documentData));
|
|
778
787
|
if (callbackUrl !== void 0) form.append("callbackUrl", callbackUrl);
|
|
779
788
|
if (language !== void 0) form.append("language", language);
|
|
780
789
|
if (useDraftVersion) form.append("useDraftVersion", "true");
|
|
@@ -794,6 +803,9 @@ function buildRequest(flowId, parts, params, asyncMode) {
|
|
|
794
803
|
const form = new FormData();
|
|
795
804
|
for (const part of parts) form.append("files", part.data, part.filename);
|
|
796
805
|
if (params.context !== void 0) form.append("jsonContext", JSON.stringify(params.context));
|
|
806
|
+
if (params.documentData?.length) {
|
|
807
|
+
form.append("documentData", JSON.stringify(params.documentData));
|
|
808
|
+
}
|
|
797
809
|
form.append("executionScope", params.executionScope);
|
|
798
810
|
if (params.flowVersion !== void 0) form.append("flowVersion", params.flowVersion);
|
|
799
811
|
for (const name of params.classificationNodeNames ?? []) {
|
|
@@ -1130,17 +1142,7 @@ var Docmana = class {
|
|
|
1130
1142
|
}
|
|
1131
1143
|
async runFlowAsync(flowId, params, options = {}) {
|
|
1132
1144
|
const parts = await resolveInputs(params);
|
|
1133
|
-
return runFlow(
|
|
1134
|
-
this.http,
|
|
1135
|
-
flowId,
|
|
1136
|
-
parts,
|
|
1137
|
-
options.signal,
|
|
1138
|
-
params.useDraftVersion ?? false,
|
|
1139
|
-
params.context,
|
|
1140
|
-
params.callbackUrl,
|
|
1141
|
-
params.language,
|
|
1142
|
-
params.organization
|
|
1143
|
-
);
|
|
1145
|
+
return runFlow(this.http, flowId, parts, params, options.signal);
|
|
1144
1146
|
}
|
|
1145
1147
|
async detectFraudAsync(params, options = {}) {
|
|
1146
1148
|
return startFraudDetection(this.http, params, options.signal);
|