@docmana/sdk 0.43.0 → 0.45.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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.45.0 - 2026-11-19
4
+
5
+ - Add optional `callbackUrl` to `detectFraudAsync` for file and URL jobs. Consumer Edge delivers the terminal `FraudDetectionResult` by POST. Applications can check `supportsFraudCallbacks` when running against multiple SDK versions.
6
+
7
+ ## 0.44.0 - 2026-11-19
8
+
9
+ - Add optional `ReviewDecision.pageReassignments` to move physical pages into
10
+ new typed documents through the native versioned review decision. The request
11
+ preserves organization scope and is sent once without automatic retry.
12
+
3
13
  ## 0.43.0 - 2026-11-18
4
14
 
5
15
  - Add `authoring.renameDocumentType` and its public request/result types. It
package/README.md CHANGED
@@ -273,7 +273,10 @@ const fromUrl = await docmana.detectFraudAsync({
273
273
  filename: "claim.pdf",
274
274
  });
275
275
 
276
+ // Supply callbackUrl to receive a terminal FraudDetectionResult by HTTP POST.
277
+ // Persist success or failure before returning 2xx, and deduplicate by x-docmana-callback-id.
276
278
  const fromFile = await docmana.detectFraudAsync({
279
+ callbackUrl: "https://example.com/webhooks/fraud?token=YOUR_CAPABILITY",
277
280
  file: { path: "./claim.pdf" },
278
281
  analystContext: "Check the invoice total.",
279
282
  });
@@ -578,6 +581,13 @@ evidence or to a tool name and zero-based call index. Tool-only values have
578
581
  empty page evidence. Older Consumer versions can omit `tools`, and an extraction
579
582
  can omit `grounding` entirely.
580
583
 
584
+ `reviews.decide()` accepts optional `pageReassignments`, for example
585
+ `[{ docKey: "receipt", page: 2, documentType: "payment_proof", group: "payment" }]`.
586
+ Pages are one-based and each moved page has one target type. The optional group
587
+ joins moved pages into the same new document. The native API validates the
588
+ document, physical page, target type and review version. Deploy Consumer support
589
+ before using this additive field; decisions are never retried automatically.
590
+
581
591
  During human review, `reviews.document(executionId, docKey, "locations", options)`
582
592
  returns a `Response` whose JSON body has type `ReviewLocationsResponse`. The
583
593
  locations are keyed by review item ID and use one-based pages of the **reviewed
@@ -1,5 +1,5 @@
1
1
  import type { HttpClient } from "../http/http-client.js";
2
- import type { FraudDetectionAccepted, FraudDetectionParams, FraudDetectionResult, FraudDetectionStatusResult } from "../types.js";
3
- export declare function startFraudDetection(http: HttpClient, params: FraudDetectionParams, signal?: AbortSignal): Promise<FraudDetectionAccepted>;
2
+ import type { FraudDetectionAccepted, FraudDetectionAsyncParams, FraudDetectionResult, FraudDetectionStatusResult } from "../types.js";
3
+ export declare function startFraudDetection(http: HttpClient, params: FraudDetectionAsyncParams, signal?: AbortSignal): Promise<FraudDetectionAccepted>;
4
4
  export declare function getFraudDetectionStatus(http: HttpClient, jobId: string, signal?: AbortSignal, organization?: string): Promise<FraudDetectionStatusResult>;
5
5
  export declare function getFraudDetectionResult(http: HttpClient, jobId: string, signal?: AbortSignal, organization?: string): Promise<FraudDetectionResult>;
package/dist/cli.mjs CHANGED
@@ -899,6 +899,7 @@ async function startFraudDetection(http, params, signal) {
899
899
  if (params.analystContext !== void 0) {
900
900
  form.append("analystContext", params.analystContext);
901
901
  }
902
+ if (params.callbackUrl !== void 0) form.append("callbackUrl", params.callbackUrl);
902
903
  return form;
903
904
  },
904
905
  signal
@@ -909,6 +910,7 @@ async function startFraudDetection(http, params, signal) {
909
910
  body: JSON.stringify({
910
911
  documentUrl: params.documentUrl,
911
912
  filename: params.filename,
913
+ ...params.callbackUrl === void 0 ? {} : { callbackUrl: params.callbackUrl },
912
914
  ...params.analystContext === void 0 ? {} : { analystContext: params.analystContext }
913
915
  }),
914
916
  signal
@@ -1125,6 +1127,8 @@ var Docmana = class {
1125
1127
  authoring;
1126
1128
  reviews;
1127
1129
  executionEvents;
1130
+ /** Whether this SDK serializes callbackUrl for asynchronous fraud submissions. */
1131
+ supportsFraudCallbacks = true;
1128
1132
  config;
1129
1133
  http;
1130
1134
  constructor(config) {
@@ -1154,7 +1158,9 @@ var Docmana = class {
1154
1158
  return getFraudDetectionResult(this.http, jobId, signal, organization);
1155
1159
  }
1156
1160
  async detectFraud(params, options = {}) {
1157
- const { jobId } = await this.detectFraudAsync(params, { signal: options.signal });
1161
+ const { file, documentUrl, filename, analystContext } = params;
1162
+ const request = file === void 0 ? { documentUrl, filename, analystContext } : { file, analystContext };
1163
+ const { jobId } = await this.detectFraudAsync(request, { signal: options.signal });
1158
1164
  let attempt = 0;
1159
1165
  const startedAt = Date.now();
1160
1166
  await pollUntilTerminal({