@docmana/sdk 0.36.0-hitl.2 → 0.36.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,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.36.0 - 2026-10-30
4
+
5
+ - Promote the additive review and execution-event client APIs to a stable release.
6
+ Unused review APIs require no additional backend configuration.
7
+ - Align native pending-list envelopes (documents are read on task detail), and
8
+ support confirmations, correction reasons and human review duration.
9
+ - Preserve DOC-2558 review conflict metadata through Consumer Edge: `decidedBy`,
10
+ `decidedAt` and `currentVersion`, with the exported `ReviewConflictDetails` type.
11
+ Keep deprecated legacy aliases and bounded metadata; decision conflicts are
12
+ never retried automatically. Normal executions and final callbacks are unchanged.
13
+
3
14
  ## 0.36.0-hitl.2 - 2026-10-23 (HITL prerelease)
4
15
 
5
16
  - Add `executionEvents.list()` and typed, non-consuming sequence-paged node
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Docmana
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Docmana
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -526,6 +526,12 @@ confirm that action with the user. Import and deletion do not use operation IDs.
526
526
 
527
527
  ## Human review of formula executions
528
528
 
529
+ The native pending queue omits documents: load the selected task with `reviews.get()`
530
+ before displaying its values and documents. Decided tasks leave this queue; resume
531
+ progress belongs to the execution. `ReviewDecision` also supports `confirmations`,
532
+ per-correction `reason`, and `durationSeconds`. Conflict details identify an already
533
+ submitted decision or the current version; no decision is retried automatically.
534
+
529
535
  Read calculation metadata repeatedly with
530
536
  `client.reviews.calculation(executionId, { organization })`. It returns
531
537
  `executionResultId`, normalized `executionStatus` and `calculation` (null for
@@ -595,13 +601,20 @@ options. It returns 200/206/304/416 without consuming the body.
595
601
 
596
602
  A decision receipt means **recorded and resume queued**, never final completion.
597
603
  On 409 inspect `DocmanaError.reviewConflict` and `apiCode`, then re-read the task.
604
+ `REVIEW_ALREADY_SUBMITTED` can include `reviewConflict.decidedBy` (`id`, `name`,
605
+ `source: "integrator" | "token"`) and `decidedAt`.
606
+ `REVIEW_VERSION_STALE` can include `reviewConflict.currentVersion`.
607
+ Missing metadata remains `null`; only bounded, whitelisted fields are retained.
608
+ The previous `version`, `submittedBy` and `submittedAt` properties remain as
609
+ deprecated compatibility aliases. Never replace the submitted version with the
610
+ new version and retry automatically: let the user inspect the refreshed task.
598
611
  On 503 re-read first: the decision may already be recorded. The SDK does not retry
599
612
  a decision after a conflict, 503 or uncertain transport outcome. The standard one-time
600
613
  401 token-refresh retry still applies. Keep the existing final callback/polling result owner;
601
614
  opening a review must not consume the single-use execution result.
602
615
 
603
616
  Release order: compatible Document API, Consumer, published SDK, then Arcana's
604
- exact pinned dependency. This local 0.33.0 candidate is not published by these steps.
617
+ exact pinned dependency. Preparing this change does not publish or deploy it.
605
618
 
606
619
  ## License
607
620
 
package/dist/cli.mjs CHANGED
@@ -544,13 +544,9 @@ var HttpClient = class {
544
544
  const data = await res.clone().json().catch(() => null);
545
545
  if (typeof data?.code === "string" && /^[A-Za-z][A-Za-z0-9_]{0,99}$/.test(data.code))
546
546
  Object.defineProperty(error, "apiCode", { value: data.code, enumerable: true });
547
- if (res.status === 409 && data?.details)
547
+ if (res.status === 409 && isRecord(data?.details))
548
548
  Object.defineProperty(error, "reviewConflict", {
549
- value: {
550
- version: Number.isInteger(data.details.version) ? data.details.version : null,
551
- submittedBy: typeof data.details.submittedBy === "string" ? data.details.submittedBy.slice(0, 200) : null,
552
- submittedAt: typeof data.details.submittedAt === "string" ? data.details.submittedAt.slice(0, 40) : null
553
- },
549
+ value: reviewConflictDetails(data.details),
554
550
  enumerable: true
555
551
  });
556
552
  throw error;
@@ -596,6 +592,32 @@ var HttpClient = class {
596
592
  }
597
593
  }
598
594
  };
595
+ function isRecord(value) {
596
+ return typeof value === "object" && value !== null && !Array.isArray(value);
597
+ }
598
+ function reviewConflictDetails(raw) {
599
+ const text = (value, limit) => typeof value === "string" ? value.slice(0, limit) : null;
600
+ const version = (value) => Number.isSafeInteger(value) && Number(value) >= 1 ? value : null;
601
+ const actor = isRecord(raw.decidedBy) ? raw.decidedBy : {};
602
+ const id = text(actor.id, 200);
603
+ const name = text(actor.name, 200);
604
+ const source = actor.source === "integrator" || actor.source === "token" ? actor.source : null;
605
+ const decidedBy = id !== null || name !== null || source !== null ? {
606
+ ...id !== null ? { id } : {},
607
+ ...name !== null ? { name } : {},
608
+ ...source ? { source } : {}
609
+ } : null;
610
+ const currentVersion = version(raw.currentVersion) ?? version(raw.version);
611
+ const decidedAt = text(raw.decidedAt, 40) ?? text(raw.submittedAt, 40);
612
+ return {
613
+ currentVersion,
614
+ decidedBy,
615
+ decidedAt,
616
+ version: currentVersion,
617
+ submittedBy: id ?? name ?? text(raw.submittedBy, 200),
618
+ submittedAt: decidedAt
619
+ };
620
+ }
599
621
  function parseRetryAfterMs(value) {
600
622
  if (!value) return void 0;
601
623
  const seconds = Number(value);