@docmana/sdk 0.37.0 → 0.39.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,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.39.0 - 2026-11-06
4
+
5
+ - Read per-node rule assignments and rule impact and update an existing assignment through Consumer Edge formula authoring.
6
+
7
+ ## 0.38.0 - 2026-11-05
8
+
9
+ - Expose optional extraction grounding, with field origins, page evidence and tool-call references.
10
+ - Export types for review locations keyed by item ID, using the existing conditional document request.
11
+
3
12
  ## 0.37.0 - 2026-11-05
4
13
 
5
14
  - Support upstream field and classification corrections through the existing `continue` decision.
package/README.md CHANGED
@@ -480,6 +480,9 @@ new message. Do not replay an uncertain network failure automatically.
480
480
  `/v1/authoring` endpoints. It requires the DOC-2385 Consumer deployment and the
481
481
  DocMana API authoring endpoints. These methods do not manage Git or YAML.
482
482
 
483
+ Use `registrySnapshot(flowId, options)` for per-node assignments and `ruleImpact(flowId, ruleId, options)` before committing changes to shared content.
484
+ `setRuleAssignment(flowId, ruleId, nodeId, { enabled, expectedEnabled }, options)` saves a single existing attachment independently of the formula draft.
485
+
483
486
  ```ts
484
487
  const options = { organization: "my-organization" };
485
488
  const formulas = await docmana.authoring.list({ ...options, limit: 50, offset: 0 });
@@ -524,6 +527,27 @@ user confirmation before submitting the same file with `confirmOverwrite: true`.
524
527
  `remove(id, options)` permanently deletes the formula and its authoring data;
525
528
  confirm that action with the user. Import and deletion do not use operation IDs.
526
529
 
530
+ ## Grounding
531
+
532
+ Consumer Edge may include `grounding` on an extraction result at
533
+ `documents[docKey].extractions[stepName]`. `DocmanaExtractionResult` exposes
534
+ this metadata separately from the extracted `data`. Each field has a JSON
535
+ Pointer into `data`, an origin, a nullable probability and its evidence.
536
+ One field can have several rectangles on one or more pages.
537
+
538
+ Rectangles are `[x0, y0, x1, y1]` in page fractions measured from the top left.
539
+ Result pages are one-based within the submitted file (within the generated PDF
540
+ for images grouped by Consumer Edge). A `DERIVED` value can point to document
541
+ evidence or to a tool name and zero-based call index. Tool-only values have
542
+ empty page evidence. Older Consumer versions can omit `tools`, and an extraction
543
+ can omit `grounding` entirely.
544
+
545
+ During human review, `reviews.document(executionId, docKey, "locations", options)`
546
+ returns a `Response` whose JSON body has type `ReviewLocationsResponse`. The
547
+ locations are keyed by review item ID and use one-based pages of the **reviewed
548
+ document**, matching the preview images. Items without page evidence are omitted.
549
+ Use `ifNoneMatch` with the response `ETag` and handle `304` before reading JSON.
550
+
527
551
  ## Human review of formula executions
528
552
 
529
553
  The native pending queue omits documents: load the selected task with `reviews.get()`
@@ -99,6 +99,17 @@ export interface AuthoringSnapshot {
99
99
  published: number;
100
100
  };
101
101
  }
102
+ export interface AuthoringRuleImpact {
103
+ impact_hash: string;
104
+ usages: {
105
+ flow_id: string;
106
+ flow_name: string;
107
+ node_id: string;
108
+ node_label: string;
109
+ published: boolean;
110
+ }[];
111
+ flows_to_republish: string[];
112
+ }
102
113
  export interface AuthoringChanges {
103
114
  create?: AuthoringData[];
104
115
  update?: {
@@ -306,6 +317,15 @@ export declare class FormulaAuthoring {
306
317
  flowName?: string;
307
318
  }>;
308
319
  get(id: string, options: AuthoringOptions): Promise<AuthoringSnapshot>;
320
+ registrySnapshot(id: string, options: AuthoringOptions): Promise<AuthoringSnapshot>;
321
+ ruleImpact(id: string, ruleId: string, options: AuthoringOptions): Promise<AuthoringRuleImpact>;
322
+ setRuleAssignment(id: string, ruleId: string, nodeId: string, body: {
323
+ enabled: boolean;
324
+ expectedEnabled: boolean;
325
+ }, options: AuthoringOptions): Promise<{
326
+ node_id: string;
327
+ enabled: boolean;
328
+ }>;
309
329
  create(body: AuthoringCreate, options: AuthoringOptions): Promise<AuthoringReceipt>;
310
330
  save(id: string, body: AuthoringDraft, options: AuthoringOptions): Promise<AuthoringReceipt>;
311
331
  validate(id: string, revisions: AuthoringRevisions, options: AuthoringOptions): Promise<AuthoringData>;
package/dist/cli.mjs CHANGED
@@ -141,6 +141,20 @@ var FormulaAuthoring = class {
141
141
  get(id, options) {
142
142
  return this.request("GET", `flows/${identity(id)}`, options);
143
143
  }
144
+ registrySnapshot(id, options) {
145
+ return this.request("GET", `flows/${identity(id)}/rule-registry`, options);
146
+ }
147
+ ruleImpact(id, ruleId, options) {
148
+ return this.request("POST", `flows/${identity(id)}/rules/${identity(ruleId)}/impact`, options);
149
+ }
150
+ setRuleAssignment(id, ruleId, nodeId, body, options) {
151
+ return this.request(
152
+ "PATCH",
153
+ `flows/${identity(id)}/rules/${identity(ruleId)}/assignments/${identity(nodeId)}`,
154
+ options,
155
+ body
156
+ );
157
+ }
144
158
  create(body, options) {
145
159
  return this.request("POST", "flows", options, body);
146
160
  }