@unboundcx/sdk 4.13.108 → 4.13.110
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/package.json +1 -1
- package/services/workflows.js +54 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.110",
|
|
4
4
|
"description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
package/services/workflows.js
CHANGED
|
@@ -97,6 +97,30 @@ export class WorkflowsService {
|
|
|
97
97
|
return result;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
// Delete guard (soft-delete workflows / hard-delete draft versions):
|
|
101
|
+
// resolves everything a workflow (or a specific draft version) is
|
|
102
|
+
// referenced by, so the client can block the delete with a named list
|
|
103
|
+
// instead of a generic FK error. Exactly one of workflowId/
|
|
104
|
+
// workflowVersionId is expected.
|
|
105
|
+
async references({ workflowId, workflowVersionId } = {}) {
|
|
106
|
+
this.sdk.validateParams(
|
|
107
|
+
{ workflowId, workflowVersionId },
|
|
108
|
+
{
|
|
109
|
+
workflowId: { type: 'string', required: false },
|
|
110
|
+
workflowVersionId: { type: 'string', required: false },
|
|
111
|
+
},
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const query = {};
|
|
115
|
+
if (workflowId) query.workflowId = workflowId;
|
|
116
|
+
if (workflowVersionId) query.workflowVersionId = workflowVersionId;
|
|
117
|
+
|
|
118
|
+
const result = await internalRequest(this.sdk, '/workflows/references', 'GET', {
|
|
119
|
+
query,
|
|
120
|
+
});
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
|
|
100
124
|
// P6 §6 — variable catalogue (inputs/system/context/module outputs) for
|
|
101
125
|
// the designer's `{{` autocomplete + variables panel.
|
|
102
126
|
async variables(versionId) {
|
|
@@ -519,4 +543,34 @@ export class WorkflowSessionsService {
|
|
|
519
543
|
);
|
|
520
544
|
return result;
|
|
521
545
|
}
|
|
546
|
+
|
|
547
|
+
// P10 click-to-filter: GET /workflows/:workflowVersionId/sessions ->
|
|
548
|
+
// {sessionIds}. filter is {workflowItemId?, fromItemId?, toItemId?,
|
|
549
|
+
// startDate?, endDate?} -- workflowItemId alone, or fromItemId+toItemId
|
|
550
|
+
// together, is required (validated server-side in sessionsByPath.js).
|
|
551
|
+
async sessionsByPath(workflowVersionId, filter = {}) {
|
|
552
|
+
this.sdk.validateParams(
|
|
553
|
+
{ workflowVersionId },
|
|
554
|
+
{
|
|
555
|
+
workflowVersionId: { type: 'string', required: true },
|
|
556
|
+
},
|
|
557
|
+
);
|
|
558
|
+
|
|
559
|
+
const { workflowItemId, fromItemId, toItemId, startDate, endDate } =
|
|
560
|
+
filter || {};
|
|
561
|
+
const query = {};
|
|
562
|
+
if (workflowItemId) query.workflowItemId = workflowItemId;
|
|
563
|
+
if (fromItemId) query.fromItemId = fromItemId;
|
|
564
|
+
if (toItemId) query.toItemId = toItemId;
|
|
565
|
+
if (startDate) query.startDate = startDate;
|
|
566
|
+
if (endDate) query.endDate = endDate;
|
|
567
|
+
|
|
568
|
+
const result = await internalRequest(
|
|
569
|
+
this.sdk,
|
|
570
|
+
`/workflows/${workflowVersionId}/sessions`,
|
|
571
|
+
'GET',
|
|
572
|
+
{ query },
|
|
573
|
+
);
|
|
574
|
+
return result;
|
|
575
|
+
}
|
|
522
576
|
}
|