@legatoacc3/workflow-api 0.1.0-alpha.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/README.md +35 -0
- package/dist/client.d.ts +62 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/contracts.d.ts +205 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +173 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Workflow API
|
|
2
|
+
|
|
3
|
+
`@legatoacc3/workflow-api` is the planned typed SDK boundary for workflow integration.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
This package is for:
|
|
8
|
+
|
|
9
|
+
- workflow draft CRUD
|
|
10
|
+
- validate and publish calls
|
|
11
|
+
- builder node metadata loading
|
|
12
|
+
- workflow request submission
|
|
13
|
+
- workflow runs and node executions
|
|
14
|
+
- approval tasks
|
|
15
|
+
- pause/resume actions
|
|
16
|
+
|
|
17
|
+
## Current State
|
|
18
|
+
|
|
19
|
+
This package is scaffolded with:
|
|
20
|
+
|
|
21
|
+
- starter DTOs
|
|
22
|
+
- a fetch-based API client
|
|
23
|
+
- clear method groupings for builder and runtime flows
|
|
24
|
+
|
|
25
|
+
It is intended to replace app-local wrappers currently found in:
|
|
26
|
+
|
|
27
|
+
- `apps/lsflow-web/app/features/builder/api/workflow-drafts.ts`
|
|
28
|
+
- `apps/lsflow-web/app/features/runtime/api/workflow-runtime.ts`
|
|
29
|
+
- `apps/lsflow-web/app/features/builder/debug/builder-debug-api.ts`
|
|
30
|
+
|
|
31
|
+
## Notes
|
|
32
|
+
|
|
33
|
+
This is a starter boundary, not the final extracted implementation.
|
|
34
|
+
|
|
35
|
+
The DTOs should later be aligned against the canonical shared contracts used by both frontend and backend systems.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { BuilderDebugRunResources, BuilderDebugRunSummary, BuilderNodeMetadataResponse, PublishedWorkflowSummary, RuntimeActorContext, WorkflowActorContext, WorkflowApprovalTask, WorkflowDraft, WorkflowDraftCreateInput, WorkflowDraftUpdateInput, WorkflowNodeExecutionRecord, WorkflowPauseResumeInput, WorkflowRequestInstance, WorkflowRequestSubmissionResult, WorkflowRunEventRecord, WorkflowRunRecord, WorkflowWorkItemRecord } from './contracts';
|
|
2
|
+
export interface WorkflowApiClientOptions {
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
fetch?: typeof globalThis.fetch;
|
|
5
|
+
headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
6
|
+
}
|
|
7
|
+
export interface WorkflowApiClient {
|
|
8
|
+
listWorkflowDrafts(): Promise<WorkflowDraft[]>;
|
|
9
|
+
createWorkflowDraft(input?: Partial<WorkflowDraftCreateInput>): Promise<WorkflowDraft>;
|
|
10
|
+
fetchWorkflowDraft(draftId: string): Promise<WorkflowDraft>;
|
|
11
|
+
updateWorkflowDraft(draftId: string, input: WorkflowDraftUpdateInput): Promise<WorkflowDraft>;
|
|
12
|
+
validateWorkflowDraft(draftId: string): Promise<WorkflowDraft>;
|
|
13
|
+
publishWorkflowDraft(draftId: string): Promise<WorkflowDraft>;
|
|
14
|
+
fetchBuilderNodeMetadata(): Promise<BuilderNodeMetadataResponse>;
|
|
15
|
+
listPublishedWorkflows(): Promise<PublishedWorkflowSummary[]>;
|
|
16
|
+
getPublishedWorkflow(workflowId: string): Promise<PublishedWorkflowSummary>;
|
|
17
|
+
submitWorkflowRequest(workflowId: string, values: Record<string, unknown>): Promise<WorkflowRequestSubmissionResult>;
|
|
18
|
+
listWorkflowRequests(mine?: boolean): Promise<WorkflowRequestInstance[]>;
|
|
19
|
+
getWorkflowRequest(requestId: string): Promise<WorkflowRequestInstance>;
|
|
20
|
+
listWorkflowRuns(input?: {
|
|
21
|
+
requestId?: string;
|
|
22
|
+
workflowId?: string;
|
|
23
|
+
}): Promise<WorkflowRunRecord[]>;
|
|
24
|
+
getWorkflowRun(workflowRunId: string): Promise<WorkflowRunRecord>;
|
|
25
|
+
listWorkflowRunEvents(workflowRunId: string): Promise<WorkflowRunEventRecord[]>;
|
|
26
|
+
listWorkflowNodeExecutions(workflowRunId: string): Promise<WorkflowNodeExecutionRecord[]>;
|
|
27
|
+
listWorkflowWorkItems(workflowRunId: string): Promise<WorkflowWorkItemRecord[]>;
|
|
28
|
+
resumeWorkflowHumanInput(workflowRunId: string, input: WorkflowPauseResumeInput): Promise<WorkflowRequestInstance>;
|
|
29
|
+
listApprovalTasks(mine?: boolean): Promise<Array<{
|
|
30
|
+
request: WorkflowRequestInstance;
|
|
31
|
+
task: WorkflowApprovalTask;
|
|
32
|
+
}>>;
|
|
33
|
+
decideApprovalTask(taskId: string, decision: 'approve' | 'reject'): Promise<WorkflowRequestInstance>;
|
|
34
|
+
startBuilderDebugRun(input: {
|
|
35
|
+
publishedWorkflowVersionId: string;
|
|
36
|
+
inputPayload: Record<string, unknown>;
|
|
37
|
+
}): Promise<BuilderDebugRunResources>;
|
|
38
|
+
startBuilderSingleNodeDebugRun(input: {
|
|
39
|
+
publishedWorkflowVersionId: string;
|
|
40
|
+
nodeId: string;
|
|
41
|
+
inputPayload: Record<string, unknown>;
|
|
42
|
+
baseWorkflowRunId?: string;
|
|
43
|
+
variableOverrides?: Record<string, unknown>;
|
|
44
|
+
}): Promise<BuilderDebugRunResources>;
|
|
45
|
+
getBuilderDebugRun(workflowRunId: string): Promise<BuilderDebugRunResources>;
|
|
46
|
+
listBuilderDebugRuns(workflowId: string): Promise<BuilderDebugRunSummary[]>;
|
|
47
|
+
resumeBuilderDebugHumanInput(workflowRunId: string, input: WorkflowPauseResumeInput): Promise<BuilderDebugRunResources>;
|
|
48
|
+
resumeBuilderDebugApproval(workflowRunId: string, input: {
|
|
49
|
+
taskId?: string;
|
|
50
|
+
decision: 'approve' | 'reject';
|
|
51
|
+
}): Promise<BuilderDebugRunResources>;
|
|
52
|
+
}
|
|
53
|
+
export declare function createWorkflowActorHeaders(context: WorkflowActorContext): {
|
|
54
|
+
'x-lsflow-role': import("./contracts").WorkflowActorRole;
|
|
55
|
+
'x-lsflow-tenant-id': string;
|
|
56
|
+
'x-lsflow-workspace-id': string;
|
|
57
|
+
'x-lsflow-user-id': string;
|
|
58
|
+
'x-lsflow-user-name': string;
|
|
59
|
+
};
|
|
60
|
+
export declare function createWorkflowApiClient(options?: WorkflowApiClientOptions): WorkflowApiClient;
|
|
61
|
+
export declare function createWorkflowApiClientForActor(context: RuntimeActorContext, options?: WorkflowApiClientOptions): WorkflowApiClient;
|
|
62
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACtB,2BAA2B,EAC3B,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,wBAAwB,EACxB,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,EACvB,+BAA+B,EAC/B,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,aAAa,CAAA;AAEpB,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;IAC/B,OAAO,CAAC,EAAE,WAAW,GAAG,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAA;CACnE;AAED,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAA;IAC9C,mBAAmB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA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E,MAAM,EACrB,KAAK,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,SAAS,GAAG,QAAQ,CAAA;KAAE,GACzD,OAAO,CAAC,wBAAwB,CAAC,CAAA;CACrC;AA8BD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,oBAAoB;;;;;;EAQvE;AAcD,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,wBAA6B,GAAG,iBAAiB,CAgJjG;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,GAAE,wBAA6B,qBAQnH"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import type { WorkflowDraft, WorkflowDraftCreateInput, PublishedWorkflowDefinition } from '@legatoacc3/workflow-builder/domain';
|
|
2
|
+
import type { BuilderNodeMetadataResponse } from '@legatoacc3/workflow-builder/builder-node-metadata-response';
|
|
3
|
+
export type { BuilderNodeMetadataResponse, PublishedWorkflowDefinition, WorkflowDraft, WorkflowDraftCreateInput };
|
|
4
|
+
export type WorkflowActorRole = 'requester' | 'approver' | 'operator' | 'admin';
|
|
5
|
+
export interface WorkflowActorContext {
|
|
6
|
+
role: WorkflowActorRole;
|
|
7
|
+
tenantId: string;
|
|
8
|
+
workspaceId: string;
|
|
9
|
+
userId: string;
|
|
10
|
+
displayName: string;
|
|
11
|
+
}
|
|
12
|
+
export type BuilderAdminContext = WorkflowActorContext & {
|
|
13
|
+
role: 'admin';
|
|
14
|
+
};
|
|
15
|
+
export type RuntimeActorContext = WorkflowActorContext;
|
|
16
|
+
export type WorkflowDraftUpdateInput = WorkflowDraft;
|
|
17
|
+
export type WorkflowRequestStatus = 'submitted' | 'in-progress' | 'pending-approval' | 'approved' | 'rejected' | 'rerouted' | 'escalated' | 'completed' | 'failed';
|
|
18
|
+
export type WorkflowRunStatus = 'running' | 'waiting' | 'completed' | 'failed' | 'cancelled';
|
|
19
|
+
export type WorkflowRunEventType = 'run-created' | 'run-started' | 'run-waiting' | 'run-resumed' | 'run-completed' | 'run-failed' | 'node-entered' | 'node-completed' | 'node-waiting' | 'node-failed' | 'approval-task-created' | 'approval-task-rerouted' | 'approval-task-escalated' | 'approval-task-decided' | 'secure-link-generated' | 'secure-link-used';
|
|
20
|
+
export type WorkflowRunTriggerSource = 'request-submission' | 'approval-decision' | 'secure-approval-decision' | 'operator-resume' | 'batch-execution' | 'debug-single-step';
|
|
21
|
+
export type WorkflowRunPauseKind = 'approval' | 'human-input' | 'timer';
|
|
22
|
+
export type WorkflowNodeExecutionStatus = 'running' | 'waiting' | 'succeeded' | 'failed' | 'skipped' | 'cancelled';
|
|
23
|
+
export type WorkflowWorkItemStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';
|
|
24
|
+
export type WorkflowWorkItemKind = 'execute-node';
|
|
25
|
+
export interface WorkflowRunPauseState {
|
|
26
|
+
kind: WorkflowRunPauseKind;
|
|
27
|
+
nodeId: string;
|
|
28
|
+
nodeLabel: string;
|
|
29
|
+
reason: string;
|
|
30
|
+
taskId?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface WorkflowRunRecord {
|
|
33
|
+
id: string;
|
|
34
|
+
tenantId: string;
|
|
35
|
+
workspaceId: string;
|
|
36
|
+
requestId: string;
|
|
37
|
+
workflowId: string;
|
|
38
|
+
workflowVersionId: string;
|
|
39
|
+
workflowVersionNumber: number;
|
|
40
|
+
workflowName: string;
|
|
41
|
+
status: WorkflowRunStatus;
|
|
42
|
+
triggerSource: WorkflowRunTriggerSource;
|
|
43
|
+
startedByActorId: string;
|
|
44
|
+
startedByActorName: string;
|
|
45
|
+
startedAt: string;
|
|
46
|
+
updatedAt: string;
|
|
47
|
+
completedAt: string | null;
|
|
48
|
+
currentNodeId: string | null;
|
|
49
|
+
currentNodeLabel: string | null;
|
|
50
|
+
outcome: Extract<WorkflowRequestStatus, 'approved' | 'rejected' | 'completed' | 'failed'> | null;
|
|
51
|
+
pauseState: WorkflowRunPauseState | null;
|
|
52
|
+
latestEventId: string | null;
|
|
53
|
+
}
|
|
54
|
+
export interface WorkflowNodeExecutionRecord {
|
|
55
|
+
id: string;
|
|
56
|
+
tenantId: string;
|
|
57
|
+
workspaceId: string;
|
|
58
|
+
workflowRunId: string;
|
|
59
|
+
requestId: string;
|
|
60
|
+
workflowId: string;
|
|
61
|
+
workflowVersionId: string;
|
|
62
|
+
workflowVersionNumber: number;
|
|
63
|
+
nodeId: string;
|
|
64
|
+
nodeKind: string;
|
|
65
|
+
nodeLabel: string;
|
|
66
|
+
predecessorNodeId: string | null;
|
|
67
|
+
status: WorkflowNodeExecutionStatus;
|
|
68
|
+
attempt: number;
|
|
69
|
+
startedAt: string;
|
|
70
|
+
finishedAt: string | null;
|
|
71
|
+
inputSnapshot: Record<string, unknown> | null;
|
|
72
|
+
outputSnapshot: Record<string, unknown> | null;
|
|
73
|
+
errorDetail: string | null;
|
|
74
|
+
waitState: WorkflowRunPauseState | null;
|
|
75
|
+
}
|
|
76
|
+
export interface WorkflowRunEventRecord {
|
|
77
|
+
id: string;
|
|
78
|
+
tenantId: string;
|
|
79
|
+
workspaceId: string;
|
|
80
|
+
workflowRunId: string;
|
|
81
|
+
requestId: string;
|
|
82
|
+
workflowId: string;
|
|
83
|
+
workflowVersionId: string;
|
|
84
|
+
workflowVersionNumber: number;
|
|
85
|
+
nodeExecutionId: string | null;
|
|
86
|
+
nodeId: string | null;
|
|
87
|
+
nodeLabel: string | null;
|
|
88
|
+
type: WorkflowRunEventType;
|
|
89
|
+
actorId: string;
|
|
90
|
+
actorName: string;
|
|
91
|
+
timestamp: string;
|
|
92
|
+
summary: string;
|
|
93
|
+
detail: string;
|
|
94
|
+
payload: Record<string, unknown> | null;
|
|
95
|
+
}
|
|
96
|
+
export interface WorkflowWorkItemRecord {
|
|
97
|
+
id: string;
|
|
98
|
+
tenantId: string;
|
|
99
|
+
workspaceId: string;
|
|
100
|
+
workflowRunId: string;
|
|
101
|
+
requestId: string;
|
|
102
|
+
workflowId: string;
|
|
103
|
+
workflowVersionId: string;
|
|
104
|
+
workflowVersionNumber: number;
|
|
105
|
+
kind: WorkflowWorkItemKind;
|
|
106
|
+
status: WorkflowWorkItemStatus;
|
|
107
|
+
nodeId: string;
|
|
108
|
+
predecessorNodeId: string | null;
|
|
109
|
+
sequenceNumber: number;
|
|
110
|
+
retryCount: number;
|
|
111
|
+
availableAt: string | null;
|
|
112
|
+
createdAt: string;
|
|
113
|
+
updatedAt: string;
|
|
114
|
+
startedAt: string | null;
|
|
115
|
+
finishedAt: string | null;
|
|
116
|
+
workerId: string | null;
|
|
117
|
+
payload: Record<string, unknown> | null;
|
|
118
|
+
errorDetail: string | null;
|
|
119
|
+
}
|
|
120
|
+
export interface WorkflowApprovalTask {
|
|
121
|
+
id: string;
|
|
122
|
+
requestId: string;
|
|
123
|
+
workflowId: string;
|
|
124
|
+
workflowVersionId: string;
|
|
125
|
+
nodeId: string;
|
|
126
|
+
nodeLabel: string;
|
|
127
|
+
status: 'pending' | 'approved' | 'rejected' | 'rerouted' | 'escalated' | 'cancelled';
|
|
128
|
+
assigneeId: string;
|
|
129
|
+
assigneeName: string;
|
|
130
|
+
createdAt: string;
|
|
131
|
+
updatedAt: string;
|
|
132
|
+
decidedAt: string | null;
|
|
133
|
+
decision: 'approve' | 'reject' | null;
|
|
134
|
+
lastRouteReason: string | null;
|
|
135
|
+
history: Array<Record<string, unknown>>;
|
|
136
|
+
}
|
|
137
|
+
export interface WorkflowRequestHistoryEntry {
|
|
138
|
+
id: string;
|
|
139
|
+
action: string;
|
|
140
|
+
actorId: string;
|
|
141
|
+
actorName: string;
|
|
142
|
+
timestamp: string;
|
|
143
|
+
detail: string;
|
|
144
|
+
status: WorkflowRequestStatus;
|
|
145
|
+
}
|
|
146
|
+
export interface WorkflowRequestInstance {
|
|
147
|
+
id: string;
|
|
148
|
+
tenantId: string;
|
|
149
|
+
workspaceId: string;
|
|
150
|
+
workflowRunId: string;
|
|
151
|
+
workflowId: string;
|
|
152
|
+
workflowVersionId: string;
|
|
153
|
+
workflowVersionNumber: number;
|
|
154
|
+
formVersionId: string;
|
|
155
|
+
workflowName: string;
|
|
156
|
+
requesterId: string;
|
|
157
|
+
requesterName: string;
|
|
158
|
+
status: WorkflowRequestStatus;
|
|
159
|
+
currentNodeId: string | null;
|
|
160
|
+
currentNodeLabel: string | null;
|
|
161
|
+
submittedAt: string;
|
|
162
|
+
updatedAt: string;
|
|
163
|
+
completedAt: string | null;
|
|
164
|
+
failureDetail: string | null;
|
|
165
|
+
submittedData: Record<string, unknown>;
|
|
166
|
+
workflowDefinition: PublishedWorkflowDefinition;
|
|
167
|
+
approvalTasks: WorkflowApprovalTask[];
|
|
168
|
+
history: WorkflowRequestHistoryEntry[];
|
|
169
|
+
runtimeState: Record<string, unknown>;
|
|
170
|
+
}
|
|
171
|
+
export interface PublishedWorkflowSummary {
|
|
172
|
+
tenantId: string;
|
|
173
|
+
workspaceId: string;
|
|
174
|
+
workflowId: string;
|
|
175
|
+
workflowVersionId: string;
|
|
176
|
+
workflowVersionNumber: number;
|
|
177
|
+
workflowName: string;
|
|
178
|
+
workflowDescription: string;
|
|
179
|
+
publishedAt: string;
|
|
180
|
+
formSchema: PublishedWorkflowDefinition['formSchema'];
|
|
181
|
+
}
|
|
182
|
+
export interface WorkflowRequestSubmissionInput {
|
|
183
|
+
workflowId: string;
|
|
184
|
+
values: Record<string, unknown>;
|
|
185
|
+
}
|
|
186
|
+
export interface WorkflowRequestSubmissionResult {
|
|
187
|
+
request: WorkflowRequestInstance;
|
|
188
|
+
confirmation: {
|
|
189
|
+
requestId: string;
|
|
190
|
+
status: WorkflowRequestStatus;
|
|
191
|
+
message: string;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
export interface WorkflowPauseResumeInput {
|
|
195
|
+
taskId?: string;
|
|
196
|
+
submittedData: Record<string, unknown>;
|
|
197
|
+
}
|
|
198
|
+
export interface BuilderDebugRunResources {
|
|
199
|
+
run: WorkflowRunRecord;
|
|
200
|
+
executions: WorkflowNodeExecutionRecord[];
|
|
201
|
+
events: WorkflowRunEventRecord[];
|
|
202
|
+
workItems: WorkflowWorkItemRecord[];
|
|
203
|
+
}
|
|
204
|
+
export type BuilderDebugRunSummary = WorkflowRunRecord;
|
|
205
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6DAA6D,CAAA;AAE9G,YAAY,EACV,2BAA2B,EAC3B,2BAA2B,EAC3B,aAAa,EACb,wBAAwB,EACzB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAA;AAE/E,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,iBAAiB,CAAA;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,GAAG;IACvD,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAA;AAEtD,MAAM,MAAM,wBAAwB,GAAG,aAAa,CAAA;AAEpD,MAAM,MAAM,qBAAqB,GAC7B,WAAW,GACX,aAAa,GACb,kBAAkB,GAClB,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,GACX,WAAW,GACX,QAAQ,CAAA;AAEZ,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAA;AAC5F,MAAM,MAAM,oBAAoB,GAC5B,aAAa,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,YAAY,EAAE;QACZ,SAAS,EAAE,MAAM,CAAA;QACjB,MAAM,EAAE,qBAAqB,CAAA;QAC7B,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACvC;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,iBAAiB,CAAA;IACtB,UAAU,EAAE,2BAA2B,EAAE,CAAA;IACzC,MAAM,EAAE,sBAAsB,EAAE,CAAA;IAChC,SAAS,EAAE,sBAAsB,EAAE,CAAA;CACpC;AAED,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
//#region src/client.ts
|
|
2
|
+
function trimTrailingSlash(value) {
|
|
3
|
+
return value.endsWith("/") ? value.slice(0, -1) : value;
|
|
4
|
+
}
|
|
5
|
+
function isHeaders(value) {
|
|
6
|
+
return typeof Headers !== "undefined" && value instanceof Headers;
|
|
7
|
+
}
|
|
8
|
+
function normalizeHeaders(value) {
|
|
9
|
+
if (!value) return {};
|
|
10
|
+
if (isHeaders(value)) return Object.fromEntries(value.entries());
|
|
11
|
+
if (Array.isArray(value)) return Object.fromEntries(value);
|
|
12
|
+
return { ...value };
|
|
13
|
+
}
|
|
14
|
+
async function resolveHeaders(input) {
|
|
15
|
+
return normalizeHeaders(typeof input === "function" ? await input() : input);
|
|
16
|
+
}
|
|
17
|
+
function createWorkflowActorHeaders(context) {
|
|
18
|
+
return {
|
|
19
|
+
"x-lsflow-role": context.role,
|
|
20
|
+
"x-lsflow-tenant-id": context.tenantId,
|
|
21
|
+
"x-lsflow-workspace-id": context.workspaceId,
|
|
22
|
+
"x-lsflow-user-id": context.userId,
|
|
23
|
+
"x-lsflow-user-name": context.displayName
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function buildQuery(input) {
|
|
27
|
+
const query = new URLSearchParams();
|
|
28
|
+
for (const [key, value] of Object.entries(input)) if (value !== void 0) query.set(key, String(value));
|
|
29
|
+
return query.size > 0 ? `?${query.toString()}` : "";
|
|
30
|
+
}
|
|
31
|
+
function createWorkflowApiClient(options = {}) {
|
|
32
|
+
const baseUrl = options.baseUrl ? trimTrailingSlash(options.baseUrl) : "";
|
|
33
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
34
|
+
if (!fetchImpl) throw new Error("A fetch implementation is required to create a workflow API client.");
|
|
35
|
+
async function request(path, init = {}) {
|
|
36
|
+
const headers = await resolveHeaders(options.headers);
|
|
37
|
+
const response = await fetchImpl(`${baseUrl}${path}`, {
|
|
38
|
+
...init,
|
|
39
|
+
headers: {
|
|
40
|
+
...init.body ? { "content-type": "application/json" } : {},
|
|
41
|
+
...headers,
|
|
42
|
+
...normalizeHeaders(init.headers)
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (!response.ok) {
|
|
46
|
+
const errorBody = await response.text();
|
|
47
|
+
throw new Error(`Workflow API request failed (${response.status}): ${errorBody}`);
|
|
48
|
+
}
|
|
49
|
+
if (response.status === 204) return;
|
|
50
|
+
return response.json();
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
listWorkflowDrafts() {
|
|
54
|
+
return request("/api/workflow-drafts");
|
|
55
|
+
},
|
|
56
|
+
createWorkflowDraft(input = {}) {
|
|
57
|
+
return request("/api/workflow-drafts", {
|
|
58
|
+
method: "POST",
|
|
59
|
+
body: JSON.stringify(input)
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
fetchWorkflowDraft(draftId) {
|
|
63
|
+
return request(`/api/workflow-drafts/${draftId}`);
|
|
64
|
+
},
|
|
65
|
+
updateWorkflowDraft(draftId, input) {
|
|
66
|
+
return request(`/api/workflow-drafts/${draftId}`, {
|
|
67
|
+
method: "PATCH",
|
|
68
|
+
body: JSON.stringify(input)
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
validateWorkflowDraft(draftId) {
|
|
72
|
+
return request(`/api/workflow-drafts/${draftId}/validate`, { method: "POST" });
|
|
73
|
+
},
|
|
74
|
+
publishWorkflowDraft(draftId) {
|
|
75
|
+
return request(`/api/workflow-drafts/${draftId}/publish`, { method: "POST" });
|
|
76
|
+
},
|
|
77
|
+
fetchBuilderNodeMetadata() {
|
|
78
|
+
return request("/api/builder-node-metadata");
|
|
79
|
+
},
|
|
80
|
+
listPublishedWorkflows() {
|
|
81
|
+
return request("/api/published-workflows");
|
|
82
|
+
},
|
|
83
|
+
getPublishedWorkflow(workflowId) {
|
|
84
|
+
return request(`/api/published-workflows/${workflowId}`);
|
|
85
|
+
},
|
|
86
|
+
submitWorkflowRequest(workflowId, values) {
|
|
87
|
+
return request("/api/workflow-requests", {
|
|
88
|
+
method: "POST",
|
|
89
|
+
body: JSON.stringify({
|
|
90
|
+
workflowId,
|
|
91
|
+
values
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
listWorkflowRequests(mine = true) {
|
|
96
|
+
return request(`/api/workflow-requests${buildQuery({ mine })}`);
|
|
97
|
+
},
|
|
98
|
+
getWorkflowRequest(requestId) {
|
|
99
|
+
return request(`/api/workflow-requests/${requestId}`);
|
|
100
|
+
},
|
|
101
|
+
listWorkflowRuns(input = {}) {
|
|
102
|
+
return request("/api/workflow-runs" + buildQuery(input));
|
|
103
|
+
},
|
|
104
|
+
getWorkflowRun(workflowRunId) {
|
|
105
|
+
return request(`/api/workflow-runs/${workflowRunId}`);
|
|
106
|
+
},
|
|
107
|
+
listWorkflowRunEvents(workflowRunId) {
|
|
108
|
+
return request(`/api/workflow-runs/${workflowRunId}/events`);
|
|
109
|
+
},
|
|
110
|
+
listWorkflowNodeExecutions(workflowRunId) {
|
|
111
|
+
return request(`/api/workflow-runs/${workflowRunId}/node-executions`);
|
|
112
|
+
},
|
|
113
|
+
listWorkflowWorkItems(workflowRunId) {
|
|
114
|
+
return request(`/api/workflow-runs/${workflowRunId}/work-items`);
|
|
115
|
+
},
|
|
116
|
+
resumeWorkflowHumanInput(workflowRunId, input) {
|
|
117
|
+
return request(`/api/workflow-runs/${workflowRunId}/resume-human-input`, {
|
|
118
|
+
method: "POST",
|
|
119
|
+
body: JSON.stringify(input)
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
listApprovalTasks(mine = true) {
|
|
123
|
+
return request(`/api/approval-tasks${buildQuery({ mine })}`);
|
|
124
|
+
},
|
|
125
|
+
decideApprovalTask(taskId, decision) {
|
|
126
|
+
return request(`/api/approval-tasks/${taskId}/decision`, {
|
|
127
|
+
method: "POST",
|
|
128
|
+
body: JSON.stringify({ decision })
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
startBuilderDebugRun(input) {
|
|
132
|
+
return request("/api/workflow-debug-runs", {
|
|
133
|
+
method: "POST",
|
|
134
|
+
body: JSON.stringify(input)
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
startBuilderSingleNodeDebugRun(input) {
|
|
138
|
+
return request("/api/workflow-debug-runs/start-single-node", {
|
|
139
|
+
method: "POST",
|
|
140
|
+
body: JSON.stringify(input)
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
getBuilderDebugRun(workflowRunId) {
|
|
144
|
+
return request(`/api/workflow-debug-runs/${workflowRunId}`);
|
|
145
|
+
},
|
|
146
|
+
listBuilderDebugRuns(workflowId) {
|
|
147
|
+
return request(`/api/workflow-debug-runs${buildQuery({ workflowId })}`);
|
|
148
|
+
},
|
|
149
|
+
resumeBuilderDebugHumanInput(workflowRunId, input) {
|
|
150
|
+
return request(`/api/workflow-debug-runs/${workflowRunId}/resume-human-input`, {
|
|
151
|
+
method: "POST",
|
|
152
|
+
body: JSON.stringify(input)
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
resumeBuilderDebugApproval(workflowRunId, input) {
|
|
156
|
+
return request(`/api/workflow-debug-runs/${workflowRunId}/resume-approval`, {
|
|
157
|
+
method: "POST",
|
|
158
|
+
body: JSON.stringify(input)
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function createWorkflowApiClientForActor(context, options = {}) {
|
|
164
|
+
return createWorkflowApiClient({
|
|
165
|
+
...options,
|
|
166
|
+
headers: async () => ({
|
|
167
|
+
...createWorkflowActorHeaders(context),
|
|
168
|
+
...normalizeHeaders(typeof options.headers === "function" ? await options.headers() : options.headers)
|
|
169
|
+
})
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
173
|
+
export { createWorkflowActorHeaders, createWorkflowApiClient, createWorkflowApiClientForActor };
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@legatoacc3/workflow-api",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "Typed workflow API client for drafts, runtime state, approvals, metadata, and publish flows.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@legatoacc3/workflow-builder": "^0.1.0-alpha.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/node": "^24.12.2",
|
|
21
|
+
"typescript": "~6.0.2",
|
|
22
|
+
"vite": "^8.0.4"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public",
|
|
31
|
+
"tag": "alpha"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"clean": "node -e \"const fs=require('node:fs'); fs.rmSync('dist',{recursive:true,force:true}); fs.rmSync('tsconfig.build.tsbuildinfo',{force:true})\"",
|
|
35
|
+
"build": "pnpm run clean && vite build && tsc -p tsconfig.build.json",
|
|
36
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
37
|
+
}
|
|
38
|
+
}
|