@docmana/sdk 0.3.4 → 0.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +123 -211
  3. package/dist/api/execution-result.d.ts +3 -0
  4. package/dist/api/execution-status.d.ts +6 -0
  5. package/dist/api/run-flow.d.ts +6 -0
  6. package/dist/cli.mjs +225 -250
  7. package/dist/cli.mjs.map +1 -1
  8. package/dist/client.d.ts +21 -0
  9. package/dist/config.d.ts +21 -0
  10. package/dist/errors.d.ts +55 -0
  11. package/dist/files/resolve-input.d.ts +11 -0
  12. package/dist/http/http-client.d.ts +26 -0
  13. package/dist/index.d.ts +4 -335
  14. package/dist/index.js +167 -291
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +167 -291
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/models/docmana-api-document-execution-result.model.d.ts +9 -0
  19. package/dist/models/docmana-api-document-request.model.d.ts +15 -0
  20. package/dist/models/docmana-api-execution-result.model.d.ts +24 -0
  21. package/dist/models/docmana-api-node-result.model.d.ts +28 -0
  22. package/dist/models/docmana-classification-result.model.d.ts +3 -0
  23. package/dist/models/docmana-conclusion-result.model.d.ts +3 -0
  24. package/dist/models/docmana-cross-validation-result.model.d.ts +3 -0
  25. package/dist/models/docmana-document-mapping.model.d.ts +4 -0
  26. package/dist/models/docmana-document-result.model.d.ts +11 -0
  27. package/dist/models/docmana-execution-result.model.d.ts +15 -0
  28. package/dist/models/docmana-extraction-result.model.d.ts +3 -0
  29. package/dist/models/docmana-metadata-extraction-result.model.d.ts +3 -0
  30. package/dist/models/docmana-node-result.model.d.ts +7 -0
  31. package/dist/models/docmana-score-node-result.model.d.ts +5 -0
  32. package/dist/models/docmana-validation-result.model.d.ts +3 -0
  33. package/dist/models/document-content.model.d.ts +4 -0
  34. package/dist/models/execution-progress.model.d.ts +4 -0
  35. package/dist/models/execution-status.enum.d.ts +1 -0
  36. package/dist/models/flow-configs.model.d.ts +16 -0
  37. package/dist/models/flow-edge.model.d.ts +4 -0
  38. package/dist/models/flow-node-type.enum.d.ts +1 -0
  39. package/dist/models/flow-node.model.d.ts +33 -0
  40. package/dist/models/flow.model.d.ts +11 -0
  41. package/dist/models/index.d.ts +26 -0
  42. package/dist/models/node-translation-result.model.d.ts +7 -0
  43. package/dist/models/physical-document.model.d.ts +9 -0
  44. package/dist/models/virtual-document.model.d.ts +10 -0
  45. package/dist/polling/poll.d.ts +15 -0
  46. package/dist/types.d.ts +76 -0
  47. package/package.json +17 -14
  48. package/dist/index.d.cts +0 -335
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.5
4
+ - Add `runFlowWithCallback(flowId, input)`: 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. Works with both `run_flow` and `run_once_flow` (via `input.once`).
5
+ - New `RunFlowWithCallbackInput` type carries the required `callbackUrl` (wire: `callback_url`). It is intentionally separate from `RunFlowInput`: the polling `runFlow`/`runFlowAsync` remain callback-free, so a callback run never polls or fetches the result inline.
6
+
3
7
  ## 0.3.3
4
8
  - Add `RunFlowInput.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.
5
9
 
package/README.md CHANGED
@@ -1,12 +1,9 @@
1
1
  # @docmana/sdk
2
2
 
3
- Official Docmana SDK run document-analysis flows with a single call.
3
+ Official Docmana SDK for calling `docmana-consumer-edge-api`.
4
4
 
5
- Docmana's HTTP API requires four steps to analyze a document: upload the file, start a flow run, poll for status, then fetch the result. This SDK collapses all four into one call. Authentication, token caching, and polling are handled for you.
6
-
7
- ```ts
8
- const result = await docmana.runFlow("<flow-id>", { file: "./contract.pdf" });
9
- ```
5
+ The SDK sends documents to Consumer, starts an async flow, polls Consumer for
6
+ status, and returns the mapped Consumer execution DTO.
10
7
 
11
8
  ## Installation
12
9
 
@@ -22,103 +19,92 @@ Requires Node.js 20+.
22
19
  import { Docmana } from "@docmana/sdk";
23
20
 
24
21
  const docmana = new Docmana({
25
- clientId: process.env.DOCMANA_CLIENT_ID!,
26
- clientSecret: process.env.DOCMANA_CLIENT_SECRET!,
22
+ apiBaseUrl: process.env.DOCMANA_API_URL!,
23
+ accessToken: process.env.DOCMANA_ACCESS_TOKEN!,
27
24
  });
28
25
 
29
- const result = await docmana.runFlow("<flow-id>", { file: "./contract.pdf" });
26
+ const result = await docmana.runFlow("<flow-id>", {
27
+ file: "./contract.pdf",
28
+ context: { contract: { destination: "Canada" } },
29
+ useDraftVersion: true,
30
+ });
30
31
 
31
- console.log(result.status, result.results);
32
+ console.log(result.status, result.executionId);
32
33
  ```
33
34
 
34
- The package ships both ESM and CommonJS builds. In a CommonJS project:
35
+ ## Authentication
35
36
 
36
- ```js
37
- const { Docmana } = require("@docmana/sdk");
37
+ The public SDK is Bearer-only. It does not acquire OAuth tokens and it never
38
+ calls `docmana-api` directly. Provide either a static `accessToken` or a
39
+ `getAccessToken` provider:
38
40
 
41
+ ```ts
39
42
  const docmana = new Docmana({
40
- clientId: process.env.DOCMANA_CLIENT_ID,
41
- clientSecret: process.env.DOCMANA_CLIENT_SECRET,
43
+ apiBaseUrl: "https://consumer.example.com/v1",
44
+ getAccessToken: async ({ forceRefresh } = {}) => {
45
+ return forceRefresh ? refreshTokenSomehow() : currentToken();
46
+ },
42
47
  });
43
-
44
- const result = await docmana.runFlow("<flow-id>", { file: "./contract.pdf" });
45
48
  ```
46
49
 
47
- ## Authentication
48
-
49
- The SDK authenticates with OAuth2 `client_credentials` against the Docmana CIAM tenant. Docmana provisions a `client_id` and `client_secret` for you during onboarding pass them to the constructor. The SDK acquires the bearer token on the first request, then caches and refreshes it automatically in memory. You never handle tokens directly.
50
+ If Consumer returns `401` and `getAccessToken` is configured, the SDK calls
51
+ `getAccessToken({ forceRefresh: true })` once and retries the request. With a
52
+ static `accessToken`, `401` is returned as an auth error without retry.
50
53
 
51
54
  ## Configuration
52
55
 
53
- The constructor takes a single `DocmanaConfig` object.
56
+ | Field | Type | Required | Description |
57
+ | ------------------- | --------------------------------------------------------------------- | -------- | ------------------------------------------------------------ |
58
+ | `apiBaseUrl` | `string` | Yes | Base URL of Consumer API, including version when applicable. |
59
+ | `accessToken` | `string` | One of | Static Bearer token sent to Consumer. |
60
+ | `getAccessToken` | `(options?: { forceRefresh?: boolean }) => string \| Promise<string>` | One of | Token provider for renewable Bearer tokens. |
61
+ | `timeoutMs` | `number` | No | Maximum polling time for `runFlow`. Default: 5 minutes. |
62
+ | `pollIntervalMs` | `number` | No | Fallback minimum delay between status polls. Default: 2s. |
63
+ | `pollMaxIntervalMs` | `number` | No | Fallback maximum polling delay. Default: 10s. |
64
+ | `fetch` | `typeof fetch` | No | Custom fetch implementation. |
65
+ | `headers` | `Record<string, string>` | No | Extra headers sent on every Consumer request. |
54
66
 
55
- | Field | Type | Required | Default | Description |
56
- | ---------------- | -------------- | -------- | ----------------------------------------- | ------------------------------------------------------------ |
57
- | `clientId` | `string` | Yes | — | OAuth2 client ID provisioned by Docmana at onboarding. |
58
- | `clientSecret` | `string` | Yes | — | OAuth2 client secret provisioned by Docmana at onboarding. |
59
- | `apiBaseUrl` | `string` | No | `https://api.docmana.ai` | Base URL of the Docmana API. |
60
- | `tokenEndpoint` | `string` | No | Docmana CIAM `oauth2/v2.0/token` endpoint | OAuth2 token endpoint used to acquire the bearer token. |
61
- | `scope` | `string` | No | `api://d781e6ba-…/.default` | OAuth2 scope requested for the token. |
62
- | `timeoutMs` | `number` | No | `300000` (5 min) | Maximum time `runFlow` will poll before throwing a timeout. |
63
- | `pollIntervalMs` | `number` | No | `2000` (2 s) | Delay between status polls in `runFlow`. |
64
- | `fetch` | `typeof fetch` | No | global `fetch` | Custom `fetch` implementation (e.g. for proxies or testing). |
65
-
66
- Most integrations only set `clientId` and `clientSecret`. The other fields exist for non-production environments or advanced networking needs.
67
+ `apiBaseUrl` is required so a migrated SDK cannot accidentally call
68
+ `https://api.docmana.ai`.
67
69
 
68
70
  ## Inputs
69
71
 
70
- `runFlow(flowId, input)` (and the lower-level `runFlowAsync`) accept a `RunFlowInput`:
71
-
72
- | Field | Type | Description |
73
- | ---------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------- |
74
- | `file` | `string \| { path: string } \| Buffer \| NodeJS.ReadableStream` | A single document. A string or `{ path }` is treated as a file path. |
75
- | `files` | `(string \| { path: string } \| Buffer \| NodeJS.ReadableStream)[]` | Multiple documents for a multi-document flow. |
76
- | `fileName` | `string` | Required when passing a `Buffer` or stream with no derivable name. |
77
- | `signal` | `AbortSignal` | Cancels the in-flight run. |
78
- | `timeoutMs` | `number` | Overrides the configured polling timeout for this call. |
79
- | `pollIntervalMs` | `number` | Overrides the configured poll interval for this call. |
80
-
81
- Provide either `file` or `files`.
82
-
83
- A file path:
84
-
85
- ```ts
86
- await docmana.runFlow("<flow-id>", { file: "./contract.pdf" });
87
- ```
88
-
89
- A `Buffer` (or stream) — supply `fileName` so Docmana can infer the document type:
90
-
91
- ```ts
92
- import { readFile } from "node:fs/promises";
93
-
94
- const buffer = await readFile("./contract.pdf");
95
- await docmana.runFlow("<flow-id>", { file: buffer, fileName: "contract.pdf" });
96
- ```
97
-
98
- Multiple documents:
99
-
100
- ```ts
101
- await docmana.runFlow("<flow-id>", {
102
- files: ["./statement.pdf", "./id-card.png"],
103
- });
104
- ```
105
-
106
- Path objects are also supported, which is useful when your caller already models uploads as
107
- objects:
108
-
109
- ```ts
110
- await docmana.runFlow("<flow-id>", {
111
- files: [{ path: "./contract.pdf" }],
112
- });
113
- ```
114
-
115
- ## Lower-level methods
116
-
117
- `runFlow` is the recommended entry point. If you need to manage polling yourself — for example to surface progress in your own job queue — the underlying steps are exposed:
118
-
119
- - `runFlowAsync(flowId, input)` → `{ executionResultId, fileIds }` — uploads the file(s) and starts the flow without waiting; `fileIds` are the uploaded document UUIDs.
120
- - `getStatus(executionResultId)` → `{ status }` — current execution status (`"Pending" | "Running" | "Completed" | "Failed"`).
121
- - `getResult(executionResultId)` → `ExecutionResult` — the result payload once the flow has finished.
72
+ `runFlow(flowId, input)` and `runFlowAsync(flowId, input)` accept:
73
+
74
+ | Field | Type | Description |
75
+ | ------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------- |
76
+ | `file` | `string \| { path: string } \| Buffer \| NodeJS.ReadableStream` | A single document. A string or `{ path }` is treated as a file path. |
77
+ | `files` | `(string \| { path: string } \| Buffer \| NodeJS.ReadableStream)[]` | Multiple documents for a multi-document flow. |
78
+ | `fileName` | `string` | Required when passing a `Buffer` or stream with no derivable name. |
79
+ | `context` | `Record<string, unknown>` | Business context serialized as multipart `json_context`. |
80
+ | `language` | `string` | Optional result language passed to Consumer. |
81
+ | `useDraftVersion` | `boolean` | Runs the current draft flow version. |
82
+ | `signal` | `AbortSignal` | Cancels the in-flight request/polling. |
83
+ | `timeoutMs` | `number` | Overrides configured polling timeout for this call. |
84
+ | `pollIntervalMs` | `number` | Overrides configured fallback minimum polling interval. |
85
+ | `pollMaxIntervalMs` | `number` | Overrides configured fallback maximum polling interval. |
86
+ | `onPoll` | `(event) => void` | Called after each status poll. |
87
+ | `onRateLimit` | `(event) => void` | Called when polling receives `429`; includes `retryAfterMs`. |
88
+
89
+ `once` was removed. Use `useDraftVersion`.
90
+
91
+ ## Methods
92
+
93
+ - `runFlowAsync(flowId, input)` posts multipart files to
94
+ `POST /v1/flows/:flowId/execute-async` and returns
95
+ `{ executionResultId, fileIds }`.
96
+ - `getStatus(executionResultId)` calls
97
+ `GET /v1/executions/:executionResultId/status`.
98
+ - `getResult(executionResultId, signal?, language?)` calls
99
+ `GET /v1/executions/:executionResultId/result`.
100
+ - `runFlow(flowId, input)` starts async execution, polls status, fetches the
101
+ result, respects `X-Poll-After` and `429 Retry-After` while polling, and throws
102
+ `DocmanaExecutionError` if the result status is `Failed`.
103
+
104
+ Consumer is the polling authority. When `GET /status` returns `X-Poll-After`,
105
+ the SDK waits that many milliseconds before the next status call. If the header
106
+ is absent, the SDK falls back to capped exponential full jitter between
107
+ `pollIntervalMs` and `pollMaxIntervalMs`. `Retry-After` on `429` always wins.
122
108
 
123
109
  ```ts
124
110
  const { executionResultId } = await docmana.runFlowAsync("<flow-id>", {
@@ -131,177 +117,103 @@ while (status !== "Completed" && status !== "Failed") {
131
117
  ({ status } = await docmana.getStatus(executionResultId));
132
118
  }
133
119
 
134
- const result = await docmana.getResult(executionResultId);
135
- console.log(result.status, result.results);
120
+ const result = await docmana.getResult(executionResultId, undefined, "fr");
136
121
  ```
137
122
 
138
- Unlike `runFlow`, `getResult` does not throw on a failed execution — inspect `result.status` and `result.errors` yourself.
123
+ ## Webhook callbacks
139
124
 
140
- ## CLI
141
-
142
- The package also installs a `docmana` command for simple terminal usage:
143
-
144
- ```bash
145
- docmana flow run "<flow-id>" --files "./contract.pdf" --organisation "<organisation-id>"
146
- ```
125
+ `runFlowWithCallback` uses the same Consumer async endpoint with `callback_url`.
126
+ It returns immediately and does not poll.
147
127
 
148
- You can create a local config file interactively:
149
-
150
- ```bash
151
- docmana config init
152
- ```
153
-
154
- This writes `docmana.config.json` in the current directory. The file can include Docmana URLs,
155
- scope, organisation, client id, and client secret, so it is ignored by Git.
156
-
157
- Use a custom config path when needed:
158
-
159
- ```bash
160
- docmana config init --config ./docmana.dev.config.json
161
- docmana flow run "<flow-id>" --files "./contract.pdf" --config ./docmana.dev.config.json
162
- ```
163
-
164
- `flow run` automatically loads `./docmana.config.json` when present. Credentials and connection
165
- settings can also be read from the environment:
166
-
167
- ```bash
168
- DOCMANA_CLIENT_ID="<client-id>"
169
- DOCMANA_CLIENT_SECRET="<client-secret>"
170
- DOCMANA_ORGANISATION="<organisation-id>"
171
- DOCMANA_API_URL="https://api.docmana.ai"
172
- DOCMANA_TOKEN_URL="<token-endpoint>"
173
- DOCMANA_SCOPE="<oauth-scope>"
174
-
175
- docmana flow run "<flow-id>" --files "./contract.pdf,./annexe.pdf"
128
+ ```ts
129
+ const { executionResultId } = await docmana.runFlowWithCallback("<flow-id>", {
130
+ file: "./contract.pdf",
131
+ callbackUrl: "https://your-service.example.com/webhooks/docmana/executions",
132
+ language: "fr",
133
+ });
176
134
  ```
177
135
 
178
- You can override config or environment values with flags:
136
+ Consumer posts the mapped result DTO to your callback URL when the execution is
137
+ finished. Keep `executionResultId` if you also want to poll as a fallback.
179
138
 
180
- ```bash
181
- docmana flow run "<flow-id>" \
182
- --files "./contract.pdf" \
183
- --client-id "<client-id>" \
184
- --client-secret "<client-secret>" \
185
- --organisation "<organisation-id>" \
186
- --api-url "https://api.docmana.ai" \
187
- --token-url "<token-endpoint>" \
188
- --scope "<oauth-scope>"
189
- ```
139
+ ## CLI
190
140
 
191
- The CLI caches OAuth2 access tokens in `docmana.token.json` by default, so repeated commands do
192
- not request a new token until the cached token expires. The cache file is ignored by Git. Use a
193
- custom token cache path when needed:
141
+ The CLI can still acquire and cache a token through OAuth:
194
142
 
195
143
  ```bash
144
+ docmana config init
196
145
  docmana login
197
- docmana flow run "<flow-id>" --files "./contract.pdf" --token-cache ./docmana.dev.token.json
198
146
  ```
199
147
 
200
- `docmana login` loads the same config, environment variables, and auth flags as `flow run`, then
201
- ensures a valid token is cached. It does not print the token.
148
+ `docmana login` reads `clientId`, `clientSecret`, `tokenEndpoint`, and `scope`
149
+ from flags, environment variables, or `docmana.config.json`, then stores the
150
+ access token in `docmana.token.json`.
202
151
 
203
- By default, the CLI prints a human-readable summary with a preview of the results. Use `--json`
204
- to print the complete result payload to stdout:
152
+ `docmana flow run` always passes a Bearer token to the SDK. It resolves the token
153
+ in this order:
205
154
 
206
- ```bash
207
- docmana flow run "<flow-id>" --files "./contract.pdf" --organisation "<organisation-id>" --json
208
- ```
209
-
210
- `--files` is a simple comma-separated list. Paths containing commas are not supported.
211
-
212
- To build the local checkout and expose the `docmana` command on your machine:
155
+ 1. `--access-token`
156
+ 2. `DOCMANA_ACCESS_TOKEN`
157
+ 3. valid `docmana.token.json`
158
+ 4. OAuth refresh using CLI/config credentials
213
159
 
214
160
  ```bash
215
- npm run cli:link
161
+ DOCMANA_API_URL="https://consumer.example.com/v1"
162
+ docmana flow run "<flow-id>" --files "./contract.pdf"
216
163
  ```
217
164
 
218
- Then run:
165
+ You can also run without the cache:
219
166
 
220
167
  ```bash
221
- docmana flow run "<flow-id>" --files "./contract.pdf" --organisation "<organisation-id>"
222
- ```
223
-
224
- ## Error handling
225
-
226
- Every error thrown by the SDK extends `DocmanaError`, which carries `.status` (HTTP status, when applicable), `.code`, and an optional `.requestId`.
227
-
228
- | Error | Thrown when |
229
- | ------------------------ | ------------------------------------------------------------------------------- |
230
- | `DocmanaRequestError` | `400` — bad request (e.g. calling for a result before the flow has finished). |
231
- | `DocmanaAuthError` | `401` — bad credentials, wrong scope, or an expired/rejected token. |
232
- | `DocmanaPermissionError` | `403` — the client is missing the `access_m2m_apps` role. |
233
- | `DocmanaNotFoundError` | `404` — the flow or endpoint was not found. |
234
- | `DocmanaExecutionError` | The flow finished with status `"Failed"`. Carries the flow errors in `.errors`. |
235
- | `DocmanaTimeoutError` | Polling exceeded `timeoutMs` before the flow reached a terminal state. |
236
- | `DocmanaAbortError` | The provided `AbortSignal` fired. |
237
-
238
- ```ts
239
- import {
240
- Docmana,
241
- DocmanaAuthError,
242
- DocmanaExecutionError,
243
- DocmanaTimeoutError,
244
- } from "@docmana/sdk";
245
-
246
- try {
247
- const result = await docmana.runFlow("<flow-id>", { file: "./contract.pdf" });
248
- console.log(result.results);
249
- } catch (err) {
250
- if (err instanceof DocmanaAuthError) {
251
- // Check client_id / client_secret / scope.
252
- } else if (err instanceof DocmanaExecutionError) {
253
- console.error("Flow failed:", err.errors);
254
- } else if (err instanceof DocmanaTimeoutError) {
255
- // Retry, or raise timeoutMs.
256
- } else {
257
- throw err;
258
- }
259
- }
168
+ docmana flow run "<flow-id>" \
169
+ --api-url "https://consumer.example.com/v1" \
170
+ --access-token "$DOCMANA_ACCESS_TOKEN" \
171
+ --files "./contract.pdf,./annexe.pdf" \
172
+ --draft \
173
+ --json
260
174
  ```
261
175
 
262
- ## Security
176
+ Use `--draft` to run the current draft flow version.
263
177
 
264
- Treat `clientSecret` as a credential with full access to your Docmana account.
178
+ The CLI no longer sends `X-Selected-Organization`; Consumer derives identity
179
+ from the Bearer token.
265
180
 
266
- - Store `clientId` and `clientSecret` in a secrets manager (Azure Key Vault, AWS Secrets Manager, etc.).
267
- - Never commit them to source control, and never expose them in a browser or frontend bundle — this SDK is server-side only.
268
- - Never log them.
269
-
270
- The SDK keeps the bearer token in memory only. It is never written to disk.
181
+ ## Error handling
271
182
 
272
- ## Requirements
183
+ Every SDK error extends `DocmanaError`, which carries `.status`, `.code`, and an
184
+ optional `.requestId` when available.
273
185
 
274
- - Node.js 20 or later.
275
- - ESM and CommonJS are both supported.
186
+ | Error | Thrown when |
187
+ | ------------------------ | -------------------------------------------------------------------------- |
188
+ | `DocmanaRequestError` | `400` bad request. |
189
+ | `DocmanaAuthError` | `401` rejected or expired Bearer token. |
190
+ | `DocmanaPermissionError` | `403` missing permission. |
191
+ | `DocmanaNotFoundError` | `404` flow or execution not found. |
192
+ | `DocmanaExecutionError` | The flow finished with status `"Failed"`. Carries `.errors` and `.result`. |
193
+ | `DocmanaTimeoutError` | Polling exceeded `timeoutMs`. |
194
+ | `DocmanaAbortError` | The provided `AbortSignal` fired. |
276
195
 
277
196
  ## Local development with yalc
278
197
 
279
- To test changes to this SDK inside a consuming project without publishing to npm, use [yalc](https://github.com/wclr/yalc).
280
-
281
- In **this library**:
198
+ In this library:
282
199
 
283
200
  ```bash
284
201
  npm run dev
285
202
  ```
286
203
 
287
- This runs `tsup` in watch mode. After every rebuild it runs `yalc push`, propagating the freshly built package to every project that has linked it.
288
-
289
- In the **consuming project** (once):
204
+ In the consuming project:
290
205
 
291
206
  ```bash
292
207
  yalc add @docmana/sdk
293
208
  npm install
294
209
  ```
295
210
 
296
- From then on, each change you save here is rebuilt and pushed automatically — the consumer picks it up without reinstalling. To stop using the local copy and restore the registry version:
211
+ For a one-shot publish to the local yalc store:
297
212
 
298
213
  ```bash
299
- yalc remove @docmana/sdk
300
- npm install
214
+ npm run yalc:publish
301
215
  ```
302
216
 
303
- For a single one-shot publish to the local yalc store (no watch), use `npm run yalc:publish`.
304
-
305
217
  ## License
306
218
 
307
219
  MIT
@@ -0,0 +1,3 @@
1
+ import type { HttpClient } from "../http/http-client.js";
2
+ import type { DocmanaExecutionResult } from "../types.js";
3
+ export declare function getResult(http: HttpClient, executionResultId: string, signal?: AbortSignal, language?: string): Promise<DocmanaExecutionResult>;
@@ -0,0 +1,6 @@
1
+ import type { HttpClient } from "../http/http-client.js";
2
+ import type { ExecutionStatus } from "../types.js";
3
+ export declare function getStatus(http: HttpClient, executionResultId: string, signal?: AbortSignal): Promise<{
4
+ status: ExecutionStatus | string;
5
+ pollAfterMs?: number;
6
+ }>;
@@ -0,0 +1,6 @@
1
+ import type { ResolvedPart } from "../files/resolve-input.js";
2
+ import type { HttpClient } from "../http/http-client.js";
3
+ export declare function runFlow(http: HttpClient, flowId: string, parts: ResolvedPart[], signal?: AbortSignal, useDraftVersion?: boolean, context?: Record<string, unknown>, callbackUrl?: string, language?: string): Promise<{
4
+ executionResultId: string;
5
+ fileIds: string[];
6
+ }>;