@agentuity/core 2.0.1 → 2.0.2

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.
Files changed (52) hide show
  1. package/AGENTS.md +15 -0
  2. package/dist/deprecation.d.ts +1 -1
  3. package/dist/deprecation.d.ts.map +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/services/auth/index.d.ts +1 -1
  9. package/dist/services/auth/index.d.ts.map +1 -1
  10. package/dist/services/index.d.ts +1 -0
  11. package/dist/services/index.d.ts.map +1 -1
  12. package/dist/services/index.js +1 -0
  13. package/dist/services/index.js.map +1 -1
  14. package/dist/services/queue/destinations.d.ts +10 -0
  15. package/dist/services/queue/destinations.d.ts.map +1 -1
  16. package/dist/services/queue/destinations.js.map +1 -1
  17. package/dist/services/queue/types.d.ts +24 -33
  18. package/dist/services/queue/types.d.ts.map +1 -1
  19. package/dist/services/queue/types.js +11 -5
  20. package/dist/services/queue/types.js.map +1 -1
  21. package/dist/services/webhook/types.d.ts +1 -0
  22. package/dist/services/webhook/types.d.ts.map +1 -1
  23. package/dist/services/webhook/types.js +1 -0
  24. package/dist/services/webhook/types.js.map +1 -1
  25. package/dist/services/workflow/api-reference.d.ts +4 -0
  26. package/dist/services/workflow/api-reference.d.ts.map +1 -0
  27. package/dist/services/workflow/api-reference.js +335 -0
  28. package/dist/services/workflow/api-reference.js.map +1 -0
  29. package/dist/services/workflow/index.d.ts +3 -0
  30. package/dist/services/workflow/index.d.ts.map +1 -0
  31. package/dist/services/workflow/index.js +3 -0
  32. package/dist/services/workflow/index.js.map +1 -0
  33. package/dist/services/workflow/service.d.ts +235 -0
  34. package/dist/services/workflow/service.d.ts.map +1 -0
  35. package/dist/services/workflow/service.js +553 -0
  36. package/dist/services/workflow/service.js.map +1 -0
  37. package/dist/services/workflow/types.d.ts +270 -0
  38. package/dist/services/workflow/types.d.ts.map +1 -0
  39. package/dist/services/workflow/types.js +174 -0
  40. package/dist/services/workflow/types.js.map +1 -0
  41. package/package.json +2 -2
  42. package/src/deprecation.ts +1 -1
  43. package/src/index.ts +1 -1
  44. package/src/services/auth/index.ts +1 -1
  45. package/src/services/index.ts +1 -0
  46. package/src/services/queue/destinations.ts +1 -1
  47. package/src/services/queue/types.ts +11 -5
  48. package/src/services/webhook/types.ts +1 -0
  49. package/src/services/workflow/api-reference.ts +350 -0
  50. package/src/services/workflow/index.ts +2 -0
  51. package/src/services/workflow/service.ts +633 -0
  52. package/src/services/workflow/types.ts +233 -0
@@ -0,0 +1,335 @@
1
+ import { CreateWorkflowRequestSchema, UpdateWorkflowRequestSchema, UpdateWorkflowGraphRequestSchema, TestWorkflowRequestSchema, WorkflowListResultSchema, WorkflowGetResultSchema, WorkflowCreateResultSchema, WorkflowUpdateResultSchema, WorkflowActivitySchema, WorkflowExecutionSchema, WorkflowDeliverySchema, TestWorkflowResultSchema, } from "./types.js";
2
+ import { z } from 'zod';
3
+ const service = {
4
+ name: 'Workflows',
5
+ slug: 'workflows',
6
+ description: 'Create and manage workflows that route events from sources to destinations',
7
+ endpoints: [
8
+ {
9
+ id: 'list-workflows',
10
+ title: 'List Workflows',
11
+ sectionTitle: 'Workflow Management',
12
+ method: 'GET',
13
+ path: '/workflow/list',
14
+ description: 'List all workflows with optional filtering and pagination.',
15
+ pathParams: [],
16
+ queryParams: [
17
+ {
18
+ name: 'limit',
19
+ type: 'number',
20
+ description: 'Maximum number of workflows to return',
21
+ required: false,
22
+ },
23
+ {
24
+ name: 'offset',
25
+ type: 'number',
26
+ description: 'Pagination offset',
27
+ required: false,
28
+ },
29
+ {
30
+ name: 'status',
31
+ type: 'string',
32
+ description: 'Filter by status (enabled or disabled)',
33
+ required: false,
34
+ },
35
+ {
36
+ name: 'source_type',
37
+ type: 'string',
38
+ description: 'Filter by source type (email, queue, webhook, or schedule)',
39
+ required: false,
40
+ },
41
+ {
42
+ name: 'filter',
43
+ type: 'string',
44
+ description: 'Filter workflows by name',
45
+ required: false,
46
+ },
47
+ ],
48
+ requestBody: null,
49
+ responseDescription: 'Returns paginated list of workflows.',
50
+ responseFields: { schema: WorkflowListResultSchema },
51
+ statuses: [
52
+ { code: 200, description: 'Workflows returned' },
53
+ { code: 401, description: 'Unauthorized — invalid or missing Bearer token' },
54
+ ],
55
+ examplePath: '/workflow/list',
56
+ },
57
+ {
58
+ id: 'get-workflow',
59
+ title: 'Get Workflow',
60
+ sectionTitle: 'Workflow Management',
61
+ method: 'GET',
62
+ path: '/workflow/{workflowId}',
63
+ description: 'Get a specific workflow by ID.',
64
+ pathParams: [
65
+ {
66
+ name: 'workflowId',
67
+ type: 'string',
68
+ description: 'Workflow ID (wf_ prefix)',
69
+ required: true,
70
+ },
71
+ ],
72
+ queryParams: [],
73
+ requestBody: null,
74
+ responseDescription: 'Returns the workflow object.',
75
+ responseFields: { schema: WorkflowGetResultSchema, stripRequired: true },
76
+ statuses: [
77
+ { code: 200, description: 'Workflow returned' },
78
+ { code: 401, description: 'Unauthorized — invalid or missing Bearer token' },
79
+ { code: 404, description: 'Workflow not found' },
80
+ ],
81
+ examplePath: '/workflow/wf_abc123',
82
+ },
83
+ {
84
+ id: 'create-workflow',
85
+ title: 'Create Workflow',
86
+ sectionTitle: 'Workflow Management',
87
+ method: 'POST',
88
+ path: '/workflow/create',
89
+ description: 'Create a new workflow with a source type and reference.',
90
+ pathParams: [],
91
+ queryParams: [],
92
+ requestBody: {
93
+ description: 'Workflow creation payload.',
94
+ fields: { schema: CreateWorkflowRequestSchema },
95
+ },
96
+ responseDescription: 'Returns the created workflow.',
97
+ responseFields: { schema: WorkflowCreateResultSchema },
98
+ statuses: [
99
+ { code: 201, description: 'Workflow created' },
100
+ { code: 401, description: 'Unauthorized — invalid or missing Bearer token' },
101
+ ],
102
+ examplePath: '/workflow/create',
103
+ exampleBody: {
104
+ name: 'GitHub to Slack',
105
+ source_type: 'webhook',
106
+ source_ref_id: 'wh_abc123',
107
+ },
108
+ },
109
+ {
110
+ id: 'update-workflow',
111
+ title: 'Update Workflow',
112
+ sectionTitle: 'Workflow Management',
113
+ method: 'PATCH',
114
+ path: '/workflow/{workflowId}',
115
+ description: "Update a workflow's name, description, or status.",
116
+ pathParams: [
117
+ {
118
+ name: 'workflowId',
119
+ type: 'string',
120
+ description: 'Workflow ID',
121
+ required: true,
122
+ },
123
+ ],
124
+ queryParams: [],
125
+ requestBody: {
126
+ description: 'Fields to update.',
127
+ fields: { schema: UpdateWorkflowRequestSchema },
128
+ },
129
+ responseDescription: 'Returns the updated workflow.',
130
+ responseFields: { schema: WorkflowUpdateResultSchema, stripRequired: true },
131
+ statuses: [
132
+ { code: 200, description: 'Workflow updated' },
133
+ { code: 401, description: 'Unauthorized — invalid or missing Bearer token' },
134
+ { code: 404, description: 'Workflow not found' },
135
+ ],
136
+ examplePath: '/workflow/wf_abc123',
137
+ exampleBody: { name: 'Renamed Workflow', status: 'disabled' },
138
+ },
139
+ {
140
+ id: 'update-workflow-graph',
141
+ title: 'Update Workflow Graph',
142
+ sectionTitle: 'Workflow Management',
143
+ method: 'PUT',
144
+ path: '/workflow/{workflowId}/graph',
145
+ description: 'Update the workflow graph definition (nodes and edges).',
146
+ pathParams: [
147
+ {
148
+ name: 'workflowId',
149
+ type: 'string',
150
+ description: 'Workflow ID',
151
+ required: true,
152
+ },
153
+ ],
154
+ queryParams: [],
155
+ requestBody: {
156
+ description: 'Graph definition with nodes and edges.',
157
+ fields: { schema: UpdateWorkflowGraphRequestSchema },
158
+ },
159
+ responseDescription: 'Returns the updated workflow.',
160
+ responseFields: { schema: WorkflowUpdateResultSchema, stripRequired: true },
161
+ statuses: [
162
+ { code: 200, description: 'Workflow graph updated' },
163
+ { code: 401, description: 'Unauthorized — invalid or missing Bearer token' },
164
+ { code: 404, description: 'Workflow not found' },
165
+ ],
166
+ examplePath: '/workflow/wf_abc123/graph',
167
+ exampleBody: {
168
+ nodes: [
169
+ { id: 'n1', type: 'filter' },
170
+ { id: 'n2', type: 'action' },
171
+ ],
172
+ edges: [{ id: 'e1', source: 'n1', target: 'n2' }],
173
+ },
174
+ },
175
+ {
176
+ id: 'delete-workflow',
177
+ title: 'Delete Workflow',
178
+ sectionTitle: 'Workflow Management',
179
+ method: 'DELETE',
180
+ path: '/workflow/{workflowId}',
181
+ description: 'Delete a workflow and all associated executions and deliveries.',
182
+ pathParams: [
183
+ {
184
+ name: 'workflowId',
185
+ type: 'string',
186
+ description: 'Workflow ID',
187
+ required: true,
188
+ },
189
+ ],
190
+ queryParams: [],
191
+ requestBody: null,
192
+ responseDescription: 'Empty response on success.',
193
+ statuses: [
194
+ { code: 204, description: 'Workflow deleted' },
195
+ { code: 401, description: 'Unauthorized — invalid or missing Bearer token' },
196
+ { code: 404, description: 'Workflow not found' },
197
+ ],
198
+ examplePath: '/workflow/wf_abc123',
199
+ },
200
+ {
201
+ id: 'test-workflow',
202
+ title: 'Test Workflow',
203
+ sectionTitle: 'Testing',
204
+ method: 'POST',
205
+ path: '/workflow/{workflowId}/test',
206
+ description: 'Test a workflow with a sample payload.',
207
+ pathParams: [
208
+ {
209
+ name: 'workflowId',
210
+ type: 'string',
211
+ description: 'Workflow ID',
212
+ required: true,
213
+ },
214
+ ],
215
+ queryParams: [],
216
+ requestBody: {
217
+ description: 'Test payload to send through the workflow.',
218
+ fields: { schema: TestWorkflowRequestSchema },
219
+ },
220
+ responseDescription: 'Returns the test execution result.',
221
+ responseFields: { schema: TestWorkflowResultSchema },
222
+ statuses: [
223
+ { code: 200, description: 'Test completed' },
224
+ { code: 401, description: 'Unauthorized — invalid or missing Bearer token' },
225
+ { code: 404, description: 'Workflow not found' },
226
+ ],
227
+ examplePath: '/workflow/wf_abc123/test',
228
+ exampleBody: { payload: { event: 'test', data: { key: 'value' } } },
229
+ },
230
+ {
231
+ id: 'workflow-activity',
232
+ title: 'Get Workflow Activity',
233
+ sectionTitle: 'Analytics',
234
+ method: 'GET',
235
+ path: '/workflow/activity',
236
+ description: 'Get workflow activity statistics for the organization.',
237
+ pathParams: [],
238
+ queryParams: [
239
+ {
240
+ name: 'days',
241
+ type: 'number',
242
+ description: 'Number of days to look back',
243
+ required: false,
244
+ },
245
+ ],
246
+ requestBody: null,
247
+ responseDescription: 'Returns aggregate workflow activity statistics.',
248
+ responseFields: { schema: WorkflowActivitySchema },
249
+ statuses: [
250
+ { code: 200, description: 'Activity returned' },
251
+ { code: 401, description: 'Unauthorized — invalid or missing Bearer token' },
252
+ ],
253
+ examplePath: '/workflow/activity',
254
+ },
255
+ {
256
+ id: 'list-workflow-executions',
257
+ title: 'List Workflow Executions',
258
+ sectionTitle: 'Executions',
259
+ method: 'GET',
260
+ path: '/workflow/{workflowId}/executions',
261
+ description: 'List execution records for a specific workflow.',
262
+ pathParams: [
263
+ {
264
+ name: 'workflowId',
265
+ type: 'string',
266
+ description: 'Workflow ID',
267
+ required: true,
268
+ },
269
+ ],
270
+ queryParams: [],
271
+ requestBody: null,
272
+ responseDescription: 'Returns list of executions.',
273
+ responseFields: { schema: z.array(WorkflowExecutionSchema) },
274
+ statuses: [
275
+ { code: 200, description: 'Executions returned' },
276
+ { code: 401, description: 'Unauthorized — invalid or missing Bearer token' },
277
+ { code: 404, description: 'Workflow not found' },
278
+ ],
279
+ examplePath: '/workflow/wf_abc123/executions',
280
+ },
281
+ {
282
+ id: 'list-workflow-deliveries',
283
+ title: 'List Workflow Deliveries',
284
+ sectionTitle: 'Deliveries',
285
+ method: 'GET',
286
+ path: '/workflow/executions/{executionId}/deliveries',
287
+ description: 'List delivery records for a specific execution.',
288
+ pathParams: [
289
+ {
290
+ name: 'executionId',
291
+ type: 'string',
292
+ description: 'Execution ID',
293
+ required: true,
294
+ },
295
+ ],
296
+ queryParams: [],
297
+ requestBody: null,
298
+ responseDescription: 'Returns list of deliveries.',
299
+ responseFields: { schema: z.array(WorkflowDeliverySchema) },
300
+ statuses: [
301
+ { code: 200, description: 'Deliveries returned' },
302
+ { code: 401, description: 'Unauthorized — invalid or missing Bearer token' },
303
+ { code: 404, description: 'Execution not found' },
304
+ ],
305
+ examplePath: '/workflow/executions/exec_abc123/deliveries',
306
+ },
307
+ {
308
+ id: 'get-recent-payload',
309
+ title: 'Get Recent Payload',
310
+ sectionTitle: 'Analytics',
311
+ method: 'GET',
312
+ path: '/workflow/{workflowId}/recent-payload',
313
+ description: 'Get the most recent payload received by a workflow.',
314
+ pathParams: [
315
+ {
316
+ name: 'workflowId',
317
+ type: 'string',
318
+ description: 'Workflow ID',
319
+ required: true,
320
+ },
321
+ ],
322
+ queryParams: [],
323
+ requestBody: null,
324
+ responseDescription: 'Returns the most recent payload data.',
325
+ statuses: [
326
+ { code: 200, description: 'Payload returned' },
327
+ { code: 401, description: 'Unauthorized — invalid or missing Bearer token' },
328
+ { code: 404, description: 'Workflow not found or no recent payload' },
329
+ ],
330
+ examplePath: '/workflow/wf_abc123/recent-payload',
331
+ },
332
+ ],
333
+ };
334
+ export default service;
335
+ //# sourceMappingURL=api-reference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-reference.js","sourceRoot":"","sources":["../../../src/services/workflow/api-reference.ts"],"names":[],"mappings":"AACA,OAAO,EACN,2BAA2B,EAC3B,2BAA2B,EAC3B,gCAAgC,EAChC,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,GACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,OAAO,GAAY;IACxB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,4EAA4E;IACzF,SAAS,EAAE;QACV;YACC,EAAE,EAAE,gBAAgB;YACpB,KAAK,EAAE,gBAAgB;YACvB,YAAY,EAAE,qBAAqB;YACnC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,gBAAgB;YAC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,cAAc,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,EAAE;YAC3D,QAAQ,EAAE;gBACT,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,qBAAqB,EAAE;gBACjD,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,gDAAgD,EAAE;gBAC5E,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,qBAAqB,EAAE;aACjD;YACD,WAAW,EAAE,6CAA6C;SAC1D;QACD;YACC,EAAE,EAAE,oBAAoB;YACxB,KAAK,EAAE,oBAAoB;YAC3B,YAAY,EAAE,WAAW;YACzB,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,uCAAuC;YAC7C,WAAW,EAAE,qDAAqD;YAClE,UAAU,EAAE;gBACX;oBACC,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,aAAa;oBAC1B,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,WAAW,EAAE,EAAE;YACf,WAAW,EAAE,IAAI;YACjB,mBAAmB,EAAE,uCAAuC;YAC5D,QAAQ,EAAE;gBACT,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,kBAAkB,EAAE;gBAC9C,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,gDAAgD,EAAE;gBAC5E,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,yCAAyC,EAAE;aACrE;YACD,WAAW,EAAE,oCAAoC;SACjD;KACD;CACD,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './service.ts';
2
+ export * from './types.ts';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/workflow/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./service.js";
2
+ export * from "./types.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/workflow/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,235 @@
1
+ import type { CreateWorkflowRequest, ListWorkflowsRequest, UpdateWorkflowGraphRequest, UpdateWorkflowRequest, WorkflowActivity, WorkflowCreateResult, WorkflowDelivery, WorkflowExecution, WorkflowGetResult, WorkflowListResult, WorkflowUpdateResult, TestWorkflowRequest, TestWorkflowResult } from './types.ts';
2
+ import type { FetchAdapter } from '../adapter.ts';
3
+ /**
4
+ * Client for the Agentuity Workflow service.
5
+ *
6
+ * Provides methods for creating and managing workflows that route events from
7
+ * sources (email, queue, webhook, schedule) to configured destinations. The
8
+ * service supports:
9
+ *
10
+ * - **Workflows**: Named routing configurations with a source and graph
11
+ * - **Executions**: Records of workflow runs with step-level detail
12
+ * - **Deliveries**: Records of destination delivery attempts
13
+ * - **Testing**: Send test payloads through a workflow
14
+ *
15
+ * All methods are instrumented with OpenTelemetry spans for observability.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const workflows = new WorkflowService(baseUrl, adapter);
20
+ *
21
+ * // Create a workflow
22
+ * const { workflow } = await workflows.create({
23
+ * name: 'GitHub to Slack',
24
+ * source_type: 'webhook',
25
+ * source_ref_id: 'wh_abc123',
26
+ * });
27
+ *
28
+ * // List active workflows
29
+ * const { workflows: list } = await workflows.list({ status: 'enabled' });
30
+ * ```
31
+ */
32
+ export declare class WorkflowService {
33
+ #private;
34
+ /**
35
+ * Creates a new WorkflowService instance.
36
+ *
37
+ * @param baseUrl - The base URL of the workflow API
38
+ * @param adapter - The HTTP fetch adapter used for making API requests
39
+ */
40
+ constructor(baseUrl: string, adapter: FetchAdapter);
41
+ /**
42
+ * Lists all workflows for the authenticated organization.
43
+ *
44
+ * @param params - Optional filter and pagination parameters
45
+ * @returns A promise resolving to the paginated list of workflows
46
+ * @throws {@link WorkflowResponseError} If the API returns a failure response body
47
+ * @throws {@link ServiceException} If the HTTP request fails
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const result = await service.list({ status: 'enabled', limit: 10 });
52
+ * console.log(`Found ${result.total} workflows`);
53
+ * for (const wf of result.workflows) {
54
+ * console.log(`${wf.name} (${wf.source_type})`);
55
+ * }
56
+ * ```
57
+ */
58
+ list(params?: ListWorkflowsRequest): Promise<WorkflowListResult>;
59
+ /**
60
+ * Gets a single workflow by its ID.
61
+ *
62
+ * @param workflowId - The unique workflow identifier (prefixed with wf_)
63
+ * @returns A promise resolving to the workflow details
64
+ * @throws {@link WorkflowResponseError} If the API returns a failure response body
65
+ * @throws {@link ServiceException} If the HTTP request fails
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * const result = await service.get('wf_abc123');
70
+ * console.log(result.workflow.name);
71
+ * ```
72
+ */
73
+ get(workflowId: string): Promise<WorkflowGetResult>;
74
+ /**
75
+ * Creates a new workflow.
76
+ *
77
+ * @param params - The workflow creation parameters including name, source type, and source reference
78
+ * @returns A promise resolving to the newly created workflow
79
+ * @throws {@link WorkflowResponseError} If the API returns a failure response body
80
+ * @throws {@link ServiceException} If the HTTP request fails
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * const result = await service.create({
85
+ * name: 'Email to Slack',
86
+ * source_type: 'email',
87
+ * source_ref_id: 'user@example.com',
88
+ * });
89
+ * console.log('Created:', result.workflow.id);
90
+ * ```
91
+ */
92
+ create(params: CreateWorkflowRequest): Promise<WorkflowCreateResult>;
93
+ /**
94
+ * Updates an existing workflow's name, description, or status.
95
+ *
96
+ * @param workflowId - The unique workflow identifier
97
+ * @param params - Fields to update; only provided fields are changed
98
+ * @returns A promise resolving to the updated workflow
99
+ * @throws {@link WorkflowResponseError} If the API returns a failure response body
100
+ * @throws {@link ServiceException} If the HTTP request fails
101
+ *
102
+ * @example
103
+ * ```typescript
104
+ * const result = await service.update('wf_abc123', {
105
+ * name: 'Updated Workflow Name',
106
+ * status: 'disabled',
107
+ * });
108
+ * console.log('Updated:', result.workflow.name);
109
+ * ```
110
+ */
111
+ update(workflowId: string, params: UpdateWorkflowRequest): Promise<WorkflowUpdateResult>;
112
+ /**
113
+ * Updates the workflow graph (nodes and edges) for a workflow.
114
+ *
115
+ * @param workflowId - The unique workflow identifier
116
+ * @param params - The new graph definition with nodes and edges
117
+ * @returns A promise resolving to the updated workflow
118
+ * @throws {@link WorkflowResponseError} If the API returns a failure response body
119
+ * @throws {@link ServiceException} If the HTTP request fails
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * const result = await service.updateGraph('wf_abc123', {
124
+ * nodes: [{ id: 'n1', type: 'filter', data: { expr: '...' } }],
125
+ * edges: [{ id: 'e1', source: 'n1', target: 'n2' }],
126
+ * });
127
+ * ```
128
+ */
129
+ updateGraph(workflowId: string, params: UpdateWorkflowGraphRequest): Promise<WorkflowUpdateResult>;
130
+ /**
131
+ * Deletes a workflow and all associated data.
132
+ *
133
+ * @param workflowId - The unique workflow identifier
134
+ * @throws {@link WorkflowResponseError} If the API returns a failure response body
135
+ * @throws {@link ServiceException} If the HTTP request fails
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * await service.delete('wf_abc123');
140
+ * console.log('Workflow deleted');
141
+ * ```
142
+ */
143
+ delete(workflowId: string): Promise<void>;
144
+ /**
145
+ * Tests a workflow with a sample payload.
146
+ *
147
+ * Sends the provided payload through the workflow and returns the execution
148
+ * result including individual step outcomes.
149
+ *
150
+ * @param workflowId - The unique workflow identifier
151
+ * @param params - The test parameters including the payload to send
152
+ * @returns A promise resolving to the test execution result
153
+ * @throws {@link WorkflowResponseError} If the API returns a failure response body
154
+ * @throws {@link ServiceException} If the HTTP request fails
155
+ *
156
+ * @example
157
+ * ```typescript
158
+ * const result = await service.test('wf_abc123', {
159
+ * payload: { event: 'push', repo: 'my-repo' },
160
+ * });
161
+ * console.log('Test status:', result.status);
162
+ * ```
163
+ */
164
+ test(workflowId: string, params: TestWorkflowRequest): Promise<TestWorkflowResult>;
165
+ /**
166
+ * Gets workflow activity statistics for the authenticated organization.
167
+ *
168
+ * Returns aggregate counts of workflows, executions, and their statuses.
169
+ *
170
+ * @param days - Optional number of days to look back for activity (default: server-side default)
171
+ * @returns A promise resolving to the activity statistics
172
+ * @throws {@link WorkflowResponseError} If the API returns a failure response body
173
+ * @throws {@link ServiceException} If the HTTP request fails
174
+ *
175
+ * @example
176
+ * ```typescript
177
+ * const activity = await service.activity(7);
178
+ * console.log(`${activity.total_workflows} workflows, ${activity.total_executions} executions`);
179
+ * ```
180
+ */
181
+ activity(days?: number): Promise<WorkflowActivity>;
182
+ /**
183
+ * Lists execution records for a specific workflow.
184
+ *
185
+ * @param workflowId - The unique workflow identifier
186
+ * @returns A promise resolving to the list of executions
187
+ * @throws {@link WorkflowResponseError} If the API returns a failure response body
188
+ * @throws {@link ServiceException} If the HTTP request fails
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * const executions = await service.listExecutions('wf_abc123');
193
+ * for (const exec of executions) {
194
+ * console.log(`${exec.id}: ${exec.status}`);
195
+ * }
196
+ * ```
197
+ */
198
+ listExecutions(workflowId: string): Promise<WorkflowExecution[]>;
199
+ /**
200
+ * Lists delivery records for a specific workflow execution.
201
+ *
202
+ * @param executionId - The unique execution identifier
203
+ * @returns A promise resolving to the list of deliveries
204
+ * @throws {@link WorkflowResponseError} If the API returns a failure response body
205
+ * @throws {@link ServiceException} If the HTTP request fails
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * const deliveries = await service.listDeliveries('exec_abc123');
210
+ * for (const d of deliveries) {
211
+ * console.log(`${d.destination_type}: ${d.status}`);
212
+ * }
213
+ * ```
214
+ */
215
+ listDeliveries(executionId: string): Promise<WorkflowDelivery[]>;
216
+ /**
217
+ * Gets the most recent payload received by a workflow.
218
+ *
219
+ * Useful for inspecting the last event that triggered the workflow, e.g.
220
+ * when building or debugging workflow graphs.
221
+ *
222
+ * @param workflowId - The unique workflow identifier
223
+ * @returns A promise resolving to the recent payload data
224
+ * @throws {@link WorkflowResponseError} If the API returns a failure response body
225
+ * @throws {@link ServiceException} If the HTTP request fails
226
+ *
227
+ * @example
228
+ * ```typescript
229
+ * const payload = await service.getRecentPayload('wf_abc123');
230
+ * console.log('Last payload:', JSON.stringify(payload, null, 2));
231
+ * ```
232
+ */
233
+ getRecentPayload(workflowId: string): Promise<unknown>;
234
+ }
235
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/services/workflow/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AA8ClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,eAAe;;IAI3B;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY;IAUlD;;;;;;;;;;;;;;;;OAgBG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkCtE;;;;;;;;;;;;;OAaG;IACG,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6BzD;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA+B1E;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAA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