@docmana/sdk 0.41.0 → 0.42.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 +4 -0
- package/README.md +7 -0
- package/dist/api/run-flow.d.ts +2 -1
- package/dist/cli.mjs +11 -14
- package/dist/cli.mjs.map +1 -1
- package/dist/files/resolve-input.d.ts +2 -1
- package/dist/index.js +11 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -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,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.42.0 - 2026-11-16
|
|
4
|
+
|
|
5
|
+
- Support optional `documentData` in full and partial flow executions. Each string is a separate inline document. Use it with uploaded files or by itself.
|
|
6
|
+
|
|
3
7
|
## 0.41.0 - 2026-11-12
|
|
4
8
|
|
|
5
9
|
- 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 |
|
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/cli.mjs
CHANGED
|
@@ -724,8 +724,10 @@ async function resolveOne(input) {
|
|
|
724
724
|
throw new Error("Unsupported file input type");
|
|
725
725
|
}
|
|
726
726
|
async function resolveInputs(input) {
|
|
727
|
-
const list = input.files;
|
|
728
|
-
if (list.length
|
|
727
|
+
const list = input.files ?? [];
|
|
728
|
+
if (!list.length && !input.documentData?.length) {
|
|
729
|
+
throw new Error("runFlow requires `files` or `documentData`");
|
|
730
|
+
}
|
|
729
731
|
return Promise.all(list.map((item) => resolveOne(item)));
|
|
730
732
|
}
|
|
731
733
|
|
|
@@ -766,7 +768,8 @@ async function waitForRetry(delayMs, signal) {
|
|
|
766
768
|
}
|
|
767
769
|
|
|
768
770
|
// src/sdk/api/run-flow.ts
|
|
769
|
-
async function runFlow(http, flowId, parts,
|
|
771
|
+
async function runFlow(http, flowId, parts, params = {}, signal) {
|
|
772
|
+
const { context, documentData, callbackUrl, language, organization, useDraftVersion } = params;
|
|
770
773
|
const path = `/flows/${flowId}/execute-async`;
|
|
771
774
|
return requestMultipartJson(
|
|
772
775
|
http,
|
|
@@ -775,6 +778,7 @@ async function runFlow(http, flowId, parts, signal, useDraftVersion = false, con
|
|
|
775
778
|
const form = new FormData();
|
|
776
779
|
for (const part of parts) form.append("files", part.data, part.filename);
|
|
777
780
|
if (context !== void 0) form.append("jsonContext", JSON.stringify(context));
|
|
781
|
+
if (documentData?.length) form.append("documentData", JSON.stringify(documentData));
|
|
778
782
|
if (callbackUrl !== void 0) form.append("callbackUrl", callbackUrl);
|
|
779
783
|
if (language !== void 0) form.append("language", language);
|
|
780
784
|
if (useDraftVersion) form.append("useDraftVersion", "true");
|
|
@@ -794,6 +798,9 @@ function buildRequest(flowId, parts, params, asyncMode) {
|
|
|
794
798
|
const form = new FormData();
|
|
795
799
|
for (const part of parts) form.append("files", part.data, part.filename);
|
|
796
800
|
if (params.context !== void 0) form.append("jsonContext", JSON.stringify(params.context));
|
|
801
|
+
if (params.documentData?.length) {
|
|
802
|
+
form.append("documentData", JSON.stringify(params.documentData));
|
|
803
|
+
}
|
|
797
804
|
form.append("executionScope", params.executionScope);
|
|
798
805
|
if (params.flowVersion !== void 0) form.append("flowVersion", params.flowVersion);
|
|
799
806
|
for (const name of params.classificationNodeNames ?? []) {
|
|
@@ -1130,17 +1137,7 @@ var Docmana = class {
|
|
|
1130
1137
|
}
|
|
1131
1138
|
async runFlowAsync(flowId, params, options = {}) {
|
|
1132
1139
|
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
|
-
);
|
|
1140
|
+
return runFlow(this.http, flowId, parts, params, options.signal);
|
|
1144
1141
|
}
|
|
1145
1142
|
async detectFraudAsync(params, options = {}) {
|
|
1146
1143
|
return startFraudDetection(this.http, params, options.signal);
|