@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/index.mjs
CHANGED
|
@@ -727,6 +727,59 @@ function parseDocumentTranslation(body, status, response) {
|
|
|
727
727
|
};
|
|
728
728
|
}
|
|
729
729
|
|
|
730
|
+
// src/sdk/feedback.ts
|
|
731
|
+
function feedbackSegment(id) {
|
|
732
|
+
if (typeof id !== "string" || !/^[A-Za-z0-9_-]{1,200}$/.test(id))
|
|
733
|
+
throw new TypeError("Invalid feedback identifier");
|
|
734
|
+
return id;
|
|
735
|
+
}
|
|
736
|
+
var ExecutionFeedback = class {
|
|
737
|
+
constructor(http) {
|
|
738
|
+
this.http = http;
|
|
739
|
+
}
|
|
740
|
+
http;
|
|
741
|
+
async open(input, options) {
|
|
742
|
+
return this.request("POST", "", input, options);
|
|
743
|
+
}
|
|
744
|
+
async sendMessage(id, content, options) {
|
|
745
|
+
return this.request("POST", `/${feedbackSegment(id)}/messages`, { content }, options);
|
|
746
|
+
}
|
|
747
|
+
async selectTopic(id, topicId, selected, options) {
|
|
748
|
+
return this.request(
|
|
749
|
+
"PATCH",
|
|
750
|
+
`/${feedbackSegment(id)}/topics/${feedbackSegment(topicId)}`,
|
|
751
|
+
{ selected },
|
|
752
|
+
options
|
|
753
|
+
);
|
|
754
|
+
}
|
|
755
|
+
async confirm(id, options, topicIds) {
|
|
756
|
+
return this.request(
|
|
757
|
+
"POST",
|
|
758
|
+
`/${feedbackSegment(id)}/confirm`,
|
|
759
|
+
topicIds === void 0 ? {} : { topic_ids: topicIds },
|
|
760
|
+
options
|
|
761
|
+
);
|
|
762
|
+
}
|
|
763
|
+
request(method, suffix, body, { organization, executionId, actorEmail, signal }) {
|
|
764
|
+
if (typeof organization !== "string" || !organization.trim())
|
|
765
|
+
throw new TypeError("Organization is required for execution feedback");
|
|
766
|
+
if (typeof executionId !== "string" || !executionId.trim())
|
|
767
|
+
throw new TypeError("Execution ID is required for execution feedback");
|
|
768
|
+
if (typeof actorEmail !== "string" || !actorEmail.trim())
|
|
769
|
+
throw new TypeError("Operator email is required for execution feedback");
|
|
770
|
+
return this.http.requestJson(method, `/feedback/conversations${suffix}`, {
|
|
771
|
+
query: { organization: organization.trim() },
|
|
772
|
+
body: JSON.stringify({
|
|
773
|
+
...body,
|
|
774
|
+
execution_id: executionId.trim(),
|
|
775
|
+
actor_email: actorEmail.trim()
|
|
776
|
+
}),
|
|
777
|
+
headers: { "content-type": "application/json" },
|
|
778
|
+
signal
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
|
|
730
783
|
// src/sdk/execution-events.ts
|
|
731
784
|
import { createHmac as createHmac2, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
732
785
|
var EXECUTION_NODE_EVENT_TYPES = [
|
|
@@ -1423,6 +1476,7 @@ function fullJitterDelay(intervalMs, maxIntervalMs, attempt, random) {
|
|
|
1423
1476
|
var Docmana = class {
|
|
1424
1477
|
authoring;
|
|
1425
1478
|
reviews;
|
|
1479
|
+
feedback;
|
|
1426
1480
|
executionEvents;
|
|
1427
1481
|
/** Whether this SDK serializes callbackUrl for asynchronous fraud submissions. */
|
|
1428
1482
|
supportsFraudCallbacks = true;
|
|
@@ -1439,6 +1493,7 @@ var Docmana = class {
|
|
|
1439
1493
|
});
|
|
1440
1494
|
this.authoring = new FormulaAuthoring(this.http);
|
|
1441
1495
|
this.reviews = new Reviews(this.http);
|
|
1496
|
+
this.feedback = new ExecutionFeedback(this.http);
|
|
1442
1497
|
this.executionEvents = new ExecutionEvents(this.http);
|
|
1443
1498
|
}
|
|
1444
1499
|
async runFlowAsync(flowId, params, options = {}) {
|
|
@@ -1620,6 +1675,7 @@ export {
|
|
|
1620
1675
|
EXECUTION_NODE_EVENT_TYPES,
|
|
1621
1676
|
EXECUTION_PROGRESS_TYPE,
|
|
1622
1677
|
ExecutionEvents,
|
|
1678
|
+
ExecutionFeedback,
|
|
1623
1679
|
FormulaAuthoring,
|
|
1624
1680
|
PROGRESS_MESSAGE_KEYS,
|
|
1625
1681
|
REVIEW_EVENT_TYPES,
|