@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 +11 -0
- package/LICENSE +21 -21
- package/README.md +14 -1
- package/dist/cli.mjs +28 -6
- package/dist/cli.mjs.map +1 -1
- package/dist/errors.d.ts +17 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +28 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -6
- package/dist/index.mjs.map +1 -1
- package/dist/reviews.d.ts +9 -1
- package/package.json +1 -1
package/dist/errors.d.ts
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
import type { DocmanaExecutionResult } from "./models/docmana-execution-result.model.js";
|
|
2
2
|
import type { FraudDetectionError, FraudDetectionResult } from "./types.js";
|
|
3
|
+
/** Whitelisted metadata returned by Consumer Edge for a review HTTP 409. */
|
|
4
|
+
export interface ReviewConflictDetails {
|
|
5
|
+
currentVersion?: number | null;
|
|
6
|
+
decidedBy?: {
|
|
7
|
+
id?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
source?: "integrator" | "token";
|
|
10
|
+
} | null;
|
|
11
|
+
decidedAt?: string | null;
|
|
12
|
+
/** @deprecated Use currentVersion. Retained for existing SDK consumers. */
|
|
13
|
+
version: number | null;
|
|
14
|
+
/** @deprecated Use decidedBy. Retained for existing SDK consumers. */
|
|
15
|
+
submittedBy: string | null;
|
|
16
|
+
/** @deprecated Use decidedAt. Retained for existing SDK consumers. */
|
|
17
|
+
submittedAt: string | null;
|
|
18
|
+
}
|
|
3
19
|
export declare class DocmanaError extends Error {
|
|
4
20
|
readonly status?: number;
|
|
5
21
|
readonly requestId?: string;
|
|
6
22
|
readonly code: string;
|
|
7
23
|
/** Public API business code; `code` retains the SDK's existing error category. */
|
|
8
24
|
readonly apiCode?: string;
|
|
9
|
-
readonly reviewConflict?:
|
|
10
|
-
version: number | null;
|
|
11
|
-
submittedBy: string | null;
|
|
12
|
-
submittedAt: string | null;
|
|
13
|
-
};
|
|
25
|
+
readonly reviewConflict?: ReviewConflictDetails;
|
|
14
26
|
constructor(message: string, opts?: {
|
|
15
27
|
status?: number;
|
|
16
28
|
requestId?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { Docmana } from "./client.js";
|
|
|
2
2
|
export { REVIEW_EVENT_TYPES, parseReviewEventCallback, verifyReviewEventCallback, ReviewEventVerificationError, } from "./review-events.js";
|
|
3
3
|
export type { ReviewEventCallback, ReviewEventType } from "./review-events.js";
|
|
4
4
|
export { FormulaAuthoring } from "./authoring.js";
|
|
5
|
+
export type { ReviewConflictDetails } from "./errors.js";
|
|
5
6
|
export type { AuthoringDocumentTrialNode, AuthoringDocumentTrialSpec, AuthoringDocumentTrialReport, AuthoringSource, AuthoringGitPublication, AuthoringGitProjection, AuthoringPublication, AuthoringConversation, AuthoringConversationInput, AuthoringConversationContext, AuthoringConversationTurn, AuthoringData, AuthoringNode, AuthoringEdge, AuthoringRevisions, AuthoringFlowSummary, AuthoringSnapshot, AuthoringChanges, AuthoringDraft, AuthoringCreate, AuthoringReceipt, AuthoringOptions, AuthoringEditorCatalog, AuthoringPageOptions, } from "./authoring.js";
|
|
6
7
|
export { DocmanaError, DocmanaAuthError, DocmanaRequestError, DocmanaPayloadTooLargeError, DocmanaPermissionError, DocmanaNotFoundError, DocmanaExecutionError, DocmanaFraudDetectionError, DocmanaTimeoutError, DocmanaAbortError, DocmanaServiceUnavailableError, } from "./errors.js";
|
|
7
8
|
export type { AccessibleOrganization, DownloadedOrganizationDocument, DocmanaConfig, FlowDefinition, FlowDefinitionField, FlowDefinitionNode, FlowDefinitionNodeMetadata, FlowDocumentRequirement, FlowListItem, FlowMetadata, FraudDetectionAccepted, FraudDetectionAsyncOptions, FraudDetectionBaseParams, FraudDetectionError, FraudDetectionFileParams, FraudDetectionOptions, FraudDetectionParams, FraudDetectionProcessor, FraudDetectionResult, FraudDetectionStatus, FraudDetectionStatusResult, FraudDetectionSummary, FraudDetectionUrlParams, FraudDetectionVerdict, FraudFinding, FraudFindingLocation, FraudFindingSeverity, FraudSeverityCounts, OrganizationDocument, OrganizationDocumentsPayload, PartialExecutionFlowVersion, PartialExecutionMetadata, PartialExecutionScope, RunFlowAsyncParams, RunFlowAsyncOptions, RunFlowOptions, RunFlowParams, RunPartialFlowAsyncParams, RunPartialFlowOptions, RunPartialFlowParams, FileInput, NamedFileInput, PathFileInput, DocmanaExecutionResult, DocmanaExecutionVerdict, ExecutionStatus, DocmanaDocumentMapping, DocmanaSourceDocument, DocmanaDocumentResult, DocmanaNodeResult, DocmanaScoreNodeResult, DocmanaCrossValidationResult, DocmanaConclusionResult, DocmanaClassificationResult, DocmanaMetadataExtractionResult, DocmanaExtractionResult, DocmanaValidationResult, DocmanaPreprocessingResult, } from "./types.js";
|
package/dist/index.js
CHANGED
|
@@ -625,13 +625,9 @@ var HttpClient = class {
|
|
|
625
625
|
const data = await res.clone().json().catch(() => null);
|
|
626
626
|
if (typeof data?.code === "string" && /^[A-Za-z][A-Za-z0-9_]{0,99}$/.test(data.code))
|
|
627
627
|
Object.defineProperty(error, "apiCode", { value: data.code, enumerable: true });
|
|
628
|
-
if (res.status === 409 && data?.details)
|
|
628
|
+
if (res.status === 409 && isRecord(data?.details))
|
|
629
629
|
Object.defineProperty(error, "reviewConflict", {
|
|
630
|
-
value:
|
|
631
|
-
version: Number.isInteger(data.details.version) ? data.details.version : null,
|
|
632
|
-
submittedBy: typeof data.details.submittedBy === "string" ? data.details.submittedBy.slice(0, 200) : null,
|
|
633
|
-
submittedAt: typeof data.details.submittedAt === "string" ? data.details.submittedAt.slice(0, 40) : null
|
|
634
|
-
},
|
|
630
|
+
value: reviewConflictDetails(data.details),
|
|
635
631
|
enumerable: true
|
|
636
632
|
});
|
|
637
633
|
throw error;
|
|
@@ -677,6 +673,32 @@ var HttpClient = class {
|
|
|
677
673
|
}
|
|
678
674
|
}
|
|
679
675
|
};
|
|
676
|
+
function isRecord(value) {
|
|
677
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
678
|
+
}
|
|
679
|
+
function reviewConflictDetails(raw) {
|
|
680
|
+
const text = (value, limit) => typeof value === "string" ? value.slice(0, limit) : null;
|
|
681
|
+
const version = (value) => Number.isSafeInteger(value) && Number(value) >= 1 ? value : null;
|
|
682
|
+
const actor = isRecord(raw.decidedBy) ? raw.decidedBy : {};
|
|
683
|
+
const id = text(actor.id, 200);
|
|
684
|
+
const name = text(actor.name, 200);
|
|
685
|
+
const source = actor.source === "integrator" || actor.source === "token" ? actor.source : null;
|
|
686
|
+
const decidedBy = id !== null || name !== null || source !== null ? {
|
|
687
|
+
...id !== null ? { id } : {},
|
|
688
|
+
...name !== null ? { name } : {},
|
|
689
|
+
...source ? { source } : {}
|
|
690
|
+
} : null;
|
|
691
|
+
const currentVersion = version(raw.currentVersion) ?? version(raw.version);
|
|
692
|
+
const decidedAt = text(raw.decidedAt, 40) ?? text(raw.submittedAt, 40);
|
|
693
|
+
return {
|
|
694
|
+
currentVersion,
|
|
695
|
+
decidedBy,
|
|
696
|
+
decidedAt,
|
|
697
|
+
version: currentVersion,
|
|
698
|
+
submittedBy: id ?? name ?? text(raw.submittedBy, 200),
|
|
699
|
+
submittedAt: decidedAt
|
|
700
|
+
};
|
|
701
|
+
}
|
|
680
702
|
function parseRetryAfterMs(value) {
|
|
681
703
|
if (!value) return void 0;
|
|
682
704
|
const seconds = Number(value);
|