@docmana/sdk 0.48.0 → 0.49.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 +4 -0
- package/README.md +4 -0
- package/dist/cli.mjs +55 -0
- package/dist/cli.mjs.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/feedback.d.ts +61 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { FormulaAuthoring } from "./authoring.js";
|
|
2
2
|
import { Reviews } from "./reviews.js";
|
|
3
|
+
import { ExecutionFeedback } from "./feedback.js";
|
|
3
4
|
import { ExecutionEvents } from "./execution-events.js";
|
|
4
5
|
import type { AccessibleOrganization, DocmanaConfig, DocmanaExecutionResult, DownloadedOrganizationDocument, ExecutionStatus, FraudDetectionAccepted, FraudDetectionAsyncOptions, FraudDetectionOptions, FraudDetectionAsyncParams, FraudDetectionParams, FraudDetectionResult, FraudDetectionStatusResult, FlowDefinition, FlowListItem, FlowMetadata, OrganizationDocumentsPayload, RunFlowAsyncParams, RunFlowAsyncOptions, RunFlowOptions, RunFlowParams, RunPartialFlowAsyncParams, RunPartialFlowOptions, RunPartialFlowParams } from "./types.js";
|
|
5
6
|
export declare class Docmana {
|
|
6
7
|
readonly authoring: FormulaAuthoring;
|
|
7
8
|
readonly reviews: Reviews;
|
|
9
|
+
readonly feedback: ExecutionFeedback;
|
|
8
10
|
readonly executionEvents: ExecutionEvents;
|
|
9
11
|
/** Whether this SDK serializes callbackUrl for asynchronous fraud submissions. */
|
|
10
12
|
readonly supportsFraudCallbacks = true;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { HttpClient } from "./http/http-client.js";
|
|
2
|
+
export interface FeedbackOptions {
|
|
3
|
+
organization: string;
|
|
4
|
+
executionId: string;
|
|
5
|
+
/** Email from the authenticated operator's session, for a feedback.delegate integration. */
|
|
6
|
+
actorEmail: string;
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
export interface OpenFeedbackConversation {
|
|
10
|
+
flow_id: string;
|
|
11
|
+
language: "fr" | "en";
|
|
12
|
+
node_name?: string;
|
|
13
|
+
document_id?: string | null;
|
|
14
|
+
execution_results: Record<string, unknown>[];
|
|
15
|
+
signed_transcript?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface FeedbackConversation {
|
|
18
|
+
conversation_id: string;
|
|
19
|
+
expires_at: string;
|
|
20
|
+
signed_transcript?: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface FeedbackTopic {
|
|
23
|
+
topic_id: string;
|
|
24
|
+
title: string;
|
|
25
|
+
comment: string;
|
|
26
|
+
node_type: string;
|
|
27
|
+
node_name: string;
|
|
28
|
+
document_id?: string | null;
|
|
29
|
+
verdict: "agree" | "disagree";
|
|
30
|
+
selected: boolean;
|
|
31
|
+
feedback_id?: string | null;
|
|
32
|
+
}
|
|
33
|
+
export interface FeedbackTurn {
|
|
34
|
+
assistant_message: string;
|
|
35
|
+
expires_at: string;
|
|
36
|
+
signed_transcript?: string | null;
|
|
37
|
+
topics: FeedbackTopic[];
|
|
38
|
+
}
|
|
39
|
+
export interface SavedExecutionFeedback {
|
|
40
|
+
feedback_id: string;
|
|
41
|
+
execution_id: string;
|
|
42
|
+
user_id: string;
|
|
43
|
+
flow_id: string;
|
|
44
|
+
node_type: string;
|
|
45
|
+
node_name: string;
|
|
46
|
+
document_id?: string | null;
|
|
47
|
+
comment: string;
|
|
48
|
+
verdict: FeedbackTopic["verdict"];
|
|
49
|
+
created_at: string;
|
|
50
|
+
}
|
|
51
|
+
export declare class ExecutionFeedback {
|
|
52
|
+
private readonly http;
|
|
53
|
+
constructor(http: HttpClient);
|
|
54
|
+
open(input: OpenFeedbackConversation, options: FeedbackOptions): Promise<FeedbackConversation>;
|
|
55
|
+
sendMessage(id: string, content: string, options: FeedbackOptions): Promise<FeedbackTurn>;
|
|
56
|
+
selectTopic(id: string, topicId: string, selected: boolean, options: FeedbackOptions): Promise<{
|
|
57
|
+
topics: FeedbackTopic[];
|
|
58
|
+
}>;
|
|
59
|
+
confirm(id: string, options: FeedbackOptions, topicIds?: readonly string[]): Promise<SavedExecutionFeedback[]>;
|
|
60
|
+
private request;
|
|
61
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ 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 { ExecutionFeedback } from "./feedback.js";
|
|
6
|
+
export type { FeedbackConversation, FeedbackOptions, FeedbackTopic, FeedbackTurn, OpenFeedbackConversation, SavedExecutionFeedback, } from "./feedback.js";
|
|
5
7
|
export type { ReviewConflictDetails } from "./errors.js";
|
|
6
8
|
export type { AuthoringDocumentTrialNode, AuthoringDocumentTrialSpec, AuthoringDocumentTrialReport, AuthoringSource, AuthoringGitPublication, AuthoringGitProjection, AuthoringPublication, AuthoringConversation, AuthoringConversationInput, AuthoringConversationContext, AuthoringConversationTurn, AuthoringNodeVerdictProposal, AuthoringConversationConfirmation, AuthoringDocumentTypeRename, AuthoringDocumentTypeRenameResult, AuthoringData, AuthoringNode, AuthoringEdge, AuthoringRevisions, AuthoringFlowSummary, AuthoringSnapshot, AuthoringRuleImpact, AuthoringChanges, AuthoringDraft, AuthoringCreate, AuthoringReceipt, AuthoringOptions, AuthoringEditorCatalog, AuthoringPageOptions, } from "./authoring.js";
|
|
7
9
|
export { DocmanaError, DocmanaAuthError, DocmanaRequestError, DocmanaPayloadTooLargeError, DocmanaPermissionError, DocmanaNotFoundError, DocmanaExecutionError, DocmanaFraudDetectionError, DocmanaTimeoutError, DocmanaAbortError, DocmanaServiceUnavailableError, } from "./errors.js";
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ __export(sdk_exports, {
|
|
|
35
35
|
EXECUTION_NODE_EVENT_TYPES: () => EXECUTION_NODE_EVENT_TYPES,
|
|
36
36
|
EXECUTION_PROGRESS_TYPE: () => EXECUTION_PROGRESS_TYPE,
|
|
37
37
|
ExecutionEvents: () => ExecutionEvents,
|
|
38
|
+
ExecutionFeedback: () => ExecutionFeedback,
|
|
38
39
|
FormulaAuthoring: () => FormulaAuthoring,
|
|
39
40
|
PROGRESS_MESSAGE_KEYS: () => PROGRESS_MESSAGE_KEYS,
|
|
40
41
|
REVIEW_EVENT_TYPES: () => REVIEW_EVENT_TYPES,
|
|
@@ -778,6 +779,59 @@ function parseDocumentTranslation(body, status, response) {
|
|
|
778
779
|
};
|
|
779
780
|
}
|
|
780
781
|
|
|
782
|
+
// src/sdk/feedback.ts
|
|
783
|
+
function feedbackSegment(id) {
|
|
784
|
+
if (typeof id !== "string" || !/^[A-Za-z0-9_-]{1,200}$/.test(id))
|
|
785
|
+
throw new TypeError("Invalid feedback identifier");
|
|
786
|
+
return id;
|
|
787
|
+
}
|
|
788
|
+
var ExecutionFeedback = class {
|
|
789
|
+
constructor(http) {
|
|
790
|
+
this.http = http;
|
|
791
|
+
}
|
|
792
|
+
http;
|
|
793
|
+
async open(input, options) {
|
|
794
|
+
return this.request("POST", "", input, options);
|
|
795
|
+
}
|
|
796
|
+
async sendMessage(id, content, options) {
|
|
797
|
+
return this.request("POST", `/${feedbackSegment(id)}/messages`, { content }, options);
|
|
798
|
+
}
|
|
799
|
+
async selectTopic(id, topicId, selected, options) {
|
|
800
|
+
return this.request(
|
|
801
|
+
"PATCH",
|
|
802
|
+
`/${feedbackSegment(id)}/topics/${feedbackSegment(topicId)}`,
|
|
803
|
+
{ selected },
|
|
804
|
+
options
|
|
805
|
+
);
|
|
806
|
+
}
|
|
807
|
+
async confirm(id, options, topicIds) {
|
|
808
|
+
return this.request(
|
|
809
|
+
"POST",
|
|
810
|
+
`/${feedbackSegment(id)}/confirm`,
|
|
811
|
+
topicIds === void 0 ? {} : { topic_ids: topicIds },
|
|
812
|
+
options
|
|
813
|
+
);
|
|
814
|
+
}
|
|
815
|
+
request(method, suffix, body, { organization, executionId, actorEmail, signal }) {
|
|
816
|
+
if (typeof organization !== "string" || !organization.trim())
|
|
817
|
+
throw new TypeError("Organization is required for execution feedback");
|
|
818
|
+
if (typeof executionId !== "string" || !executionId.trim())
|
|
819
|
+
throw new TypeError("Execution ID is required for execution feedback");
|
|
820
|
+
if (typeof actorEmail !== "string" || !actorEmail.trim())
|
|
821
|
+
throw new TypeError("Operator email is required for execution feedback");
|
|
822
|
+
return this.http.requestJson(method, `/feedback/conversations${suffix}`, {
|
|
823
|
+
query: { organization: organization.trim() },
|
|
824
|
+
body: JSON.stringify({
|
|
825
|
+
...body,
|
|
826
|
+
execution_id: executionId.trim(),
|
|
827
|
+
actor_email: actorEmail.trim()
|
|
828
|
+
}),
|
|
829
|
+
headers: { "content-type": "application/json" },
|
|
830
|
+
signal
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
|
|
781
835
|
// src/sdk/execution-events.ts
|
|
782
836
|
var import_node_crypto2 = require("crypto");
|
|
783
837
|
var EXECUTION_NODE_EVENT_TYPES = [
|
|
@@ -1474,6 +1528,7 @@ function fullJitterDelay(intervalMs, maxIntervalMs, attempt, random) {
|
|
|
1474
1528
|
var Docmana = class {
|
|
1475
1529
|
authoring;
|
|
1476
1530
|
reviews;
|
|
1531
|
+
feedback;
|
|
1477
1532
|
executionEvents;
|
|
1478
1533
|
/** Whether this SDK serializes callbackUrl for asynchronous fraud submissions. */
|
|
1479
1534
|
supportsFraudCallbacks = true;
|
|
@@ -1490,6 +1545,7 @@ var Docmana = class {
|
|
|
1490
1545
|
});
|
|
1491
1546
|
this.authoring = new FormulaAuthoring(this.http);
|
|
1492
1547
|
this.reviews = new Reviews(this.http);
|
|
1548
|
+
this.feedback = new ExecutionFeedback(this.http);
|
|
1493
1549
|
this.executionEvents = new ExecutionEvents(this.http);
|
|
1494
1550
|
}
|
|
1495
1551
|
async runFlowAsync(flowId, params, options = {}) {
|
|
@@ -1672,6 +1728,7 @@ function isTransientPollingError(error) {
|
|
|
1672
1728
|
EXECUTION_NODE_EVENT_TYPES,
|
|
1673
1729
|
EXECUTION_PROGRESS_TYPE,
|
|
1674
1730
|
ExecutionEvents,
|
|
1731
|
+
ExecutionFeedback,
|
|
1675
1732
|
FormulaAuthoring,
|
|
1676
1733
|
PROGRESS_MESSAGE_KEYS,
|
|
1677
1734
|
REVIEW_EVENT_TYPES,
|