@elqnt/workflow 1.0.7 → 2.0.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.
@@ -0,0 +1,850 @@
1
+ import { JSONSchema } from '@elqnt/types';
2
+
3
+ type NodeSubTypeTS = "actionAIClassify" | "actionAIExtractData" | "actionAISummarize" | "actionApiCall" | "actionAssignSLAPolicy" | "actionCreateEntityRecord" | "actionDeleteEntityRecord" | "actionDocumentExtraction" | "actionNatsRequest" | "actionQueryEntityRecords" | "actionSendEmail" | "actionSendSMS" | "actionSetVariables" | "actionUpdateEntityRecord" | "agentChat" | "agentCustomResponse" | "agentIntentDetector" | "agentKnowledgeGraph" | "agentOpenTicket" | "agentStructuredOutput" | "agentTransferToHuman" | "delay" | "humanActionApproval" | "humanActionAssignment" | "humanActionDataEntry" | "humanActionReview" | "integrationCreateEvent" | "integrationGetDriveFile" | "integrationSearchCalendar" | "integrationSearchDrive" | "integrationSearchEmails" | "integrationSendEmail" | "logicFor" | "logicIf" | "logicSwitch" | "triggerCalendarEvent" | "triggerDriveFileChanged" | "triggerEmailReceived" | "triggerEntityRecordCreated" | "triggerEntityRecordDeleted" | "triggerEntityRecordUpdated" | "triggerEscalation" | "triggerSLABreach" | "triggerSLAWarning" | "triggerSchedule" | "triggerStart" | "triggerWebhookReceived";
4
+ interface NodeSubTypeInfo {
5
+ value: string;
6
+ label: string;
7
+ icon: string;
8
+ description: string;
9
+ }
10
+ declare const nodeDefinitions: Record<string, NodeDefinition>;
11
+ declare const nodeSchemas: Record<string, JSONSchema>;
12
+ declare const TriggerNodeSubTypes: Record<string, NodeSubTypeInfo>;
13
+ declare const HumanActionNodeSubTypes: Record<string, NodeSubTypeInfo>;
14
+ declare const AgentNodeSubTypes: Record<string, NodeSubTypeInfo>;
15
+ declare const ActionNodeSubTypes: Record<string, NodeSubTypeInfo>;
16
+ declare const LogicNodeSubTypes: Record<string, NodeSubTypeInfo>;
17
+ declare const DelayNodeSubTypes: Record<string, NodeSubTypeInfo>;
18
+ declare const ParallelNodeSubTypes: Record<string, NodeSubTypeInfo>;
19
+ declare const DataNodeSubTypes: Record<string, NodeSubTypeInfo>;
20
+ declare const TimerNodeSubTypes: Record<string, NodeSubTypeInfo>;
21
+ declare const LoopNodeSubTypes: Record<string, NodeSubTypeInfo>;
22
+ declare const AccountingNodeSubTypes: Record<string, NodeSubTypeInfo>;
23
+ type TriggerNodeSubType = keyof typeof TriggerNodeSubTypes;
24
+ type HumanActionNodeSubType = keyof typeof HumanActionNodeSubTypes;
25
+ type AgentNodeSubType = keyof typeof AgentNodeSubTypes;
26
+ type ActionNodeSubType = keyof typeof ActionNodeSubTypes;
27
+ type LogicNodeSubType = keyof typeof LogicNodeSubTypes;
28
+ type DelayNodeSubType = keyof typeof DelayNodeSubTypes;
29
+ type DataNodeSubType = keyof typeof DataNodeSubTypes;
30
+ type TimerNodeSubType = keyof typeof TimerNodeSubTypes;
31
+ type LoopNodeSubType = keyof typeof LoopNodeSubTypes;
32
+ type ParallelNodeSubType = keyof typeof ParallelNodeSubTypes;
33
+ type AccountingNodeSubType = keyof typeof AccountingNodeSubTypes;
34
+ type WorkflowNodeSubTypeTS = TriggerNodeSubType | HumanActionNodeSubType | AgentNodeSubType | ActionNodeSubType | LogicNodeSubType | DelayNodeSubType | DataNodeSubType | TimerNodeSubType | LoopNodeSubType | ParallelNodeSubType | AccountingNodeSubType;
35
+ declare const WorkflowNodeTypes: {
36
+ readonly trigger: {
37
+ readonly value: "trigger";
38
+ readonly label: "Trigger";
39
+ readonly category: "Triggers";
40
+ };
41
+ readonly humanAction: {
42
+ readonly value: "humanAction";
43
+ readonly label: "Human Action";
44
+ readonly category: "User Interaction";
45
+ };
46
+ readonly agent: {
47
+ readonly value: "agent";
48
+ readonly label: "Agent";
49
+ readonly category: "Automation";
50
+ };
51
+ readonly action: {
52
+ readonly value: "action";
53
+ readonly label: "Action";
54
+ readonly category: "Automation";
55
+ };
56
+ readonly logic: {
57
+ readonly value: "logic";
58
+ readonly label: "Logic";
59
+ readonly category: "Flow Control";
60
+ };
61
+ readonly data: {
62
+ readonly value: "data";
63
+ readonly label: "Data";
64
+ readonly category: "Data Processing";
65
+ };
66
+ readonly integration: {
67
+ readonly value: "integration";
68
+ readonly label: "Integration";
69
+ readonly category: "Integration";
70
+ };
71
+ readonly timer: {
72
+ readonly value: "timer";
73
+ readonly label: "Timer";
74
+ readonly category: "Time & Scheduling";
75
+ };
76
+ readonly loop: {
77
+ readonly value: "loop";
78
+ readonly label: "Loop";
79
+ readonly category: "Flow Control";
80
+ };
81
+ readonly parallel: {
82
+ readonly value: "parallel";
83
+ readonly label: "Parallel";
84
+ readonly category: "Flow Control";
85
+ };
86
+ readonly delay: {
87
+ readonly value: "delay";
88
+ readonly label: "Delay";
89
+ readonly category: "Flow Control";
90
+ };
91
+ readonly subflow: {
92
+ readonly value: "subflow";
93
+ readonly label: "Subflow";
94
+ readonly category: "Flow Control";
95
+ };
96
+ readonly custom: {
97
+ readonly value: "custom";
98
+ readonly label: "Custom";
99
+ readonly category: "Custom";
100
+ };
101
+ readonly documentExtraction: {
102
+ readonly value: "documentExtraction";
103
+ readonly label: "Document Extraction";
104
+ readonly category: "Data Processing";
105
+ };
106
+ readonly apiCall: {
107
+ readonly value: "apiCall";
108
+ readonly label: "API Call";
109
+ readonly category: "Integration";
110
+ };
111
+ readonly accounting: {
112
+ readonly value: "accounting";
113
+ readonly label: "Accounting";
114
+ readonly category: "Accounting";
115
+ };
116
+ };
117
+ type WorkflowNodeTypeTS = keyof typeof WorkflowNodeTypes;
118
+ type WorkflowNodeTypeOptionTS = typeof WorkflowNodeTypes[WorkflowNodeTypeTS];
119
+ type NodeCategory = "Triggers" | "User Interaction" | "Automation" | "Integration" | "Flow Control" | "Data Processing" | "Time & Scheduling" | "Custom" | "Document Processing" | "API Integration" | "Accounting";
120
+ declare const WorkflowEdgeTypes: Record<string, EdgeTypeDefinition>;
121
+ type WorkflowEdgeTypeTS = keyof typeof WorkflowEdgeTypes;
122
+ type WorkflowEdgeTypeOptionTS = typeof WorkflowEdgeTypes[WorkflowEdgeTypeTS];
123
+ declare const WorkflowTypes: Record<string, WorkflowTypeDefinition>;
124
+ type WorkflowTypeTS = keyof typeof WorkflowTypes;
125
+ type WorkflowTypeOptionTS = typeof WorkflowTypes[WorkflowTypeTS];
126
+
127
+ /**
128
+ * NodeType represents the primary type of a workflow node
129
+ */
130
+ type NodeType = string;
131
+ declare const NodeTypeTrigger: NodeType;
132
+ declare const NodeTypeHumanAction: NodeType;
133
+ declare const NodeTypeAgent: NodeType;
134
+ declare const NodeTypeAction: NodeType;
135
+ declare const NodeTypeLogic: NodeType;
136
+ declare const NodeTypeLoop: NodeType;
137
+ declare const NodeTypeParallel: NodeType;
138
+ declare const NodeTypeDelay: NodeType;
139
+ declare const NodeTypeData: NodeType;
140
+ declare const NodeTypeIntegration: NodeType;
141
+ declare const NodeTypeTimer: NodeType;
142
+ declare const NodeTypeSubflow: NodeType;
143
+ declare const NodeTypeCustom: NodeType;
144
+ declare const NodeTypeAccounting: NodeType;
145
+ /**
146
+ * NodeSubType represents the subtype of a workflow node
147
+ * All node subtypes are unified under this single type
148
+ */
149
+ type NodeSubType = string;
150
+ /**
151
+ * Trigger subtypes
152
+ */
153
+ declare const NodeSubTypeTriggerStart: NodeSubType;
154
+ declare const NodeSubTypeTriggerEntityRecordCreated: NodeSubType;
155
+ declare const NodeSubTypeTriggerEntityRecordUpdated: NodeSubType;
156
+ declare const NodeSubTypeTriggerEntityRecordDeleted: NodeSubType;
157
+ declare const NodeSubTypeTriggerSLAWarning: NodeSubType;
158
+ declare const NodeSubTypeTriggerSLABreach: NodeSubType;
159
+ declare const NodeSubTypeTriggerEscalation: NodeSubType;
160
+ declare const NodeSubTypeTriggerWebhookReceived: NodeSubType;
161
+ /**
162
+ * Human action subtypes
163
+ */
164
+ declare const NodeSubTypeHumanActionReview: NodeSubType;
165
+ declare const NodeSubTypeHumanActionApproval: NodeSubType;
166
+ declare const NodeSubTypeHumanActionDataEntry: NodeSubType;
167
+ declare const NodeSubTypeHumanActionAssignment: NodeSubType;
168
+ /**
169
+ * Agent subtypes
170
+ */
171
+ declare const NodeSubTypeAgentChat: NodeSubType;
172
+ declare const NodeSubTypeAgentIntentDetector: NodeSubType;
173
+ declare const NodeSubTypeAgentKnowledgeGraph: NodeSubType;
174
+ declare const NodeSubTypeAgentClientApiCall: NodeSubType;
175
+ declare const NodeSubTypeAgentTransferToHuman: NodeSubType;
176
+ declare const NodeSubTypeAgentOpenTicket: NodeSubType;
177
+ declare const NodeSubTypeAgentApiIntegration: NodeSubType;
178
+ declare const NodeSubTypeAgentCustomResponse: NodeSubType;
179
+ declare const NodeSubTypeAgentStructuredOutput: NodeSubType;
180
+ /**
181
+ * Action subtypes
182
+ */
183
+ declare const NodeSubTypeActionApiCall: NodeSubType;
184
+ declare const NodeSubTypeActionDocumentExtraction: NodeSubType;
185
+ declare const NodeSubTypeActionSendEmail: NodeSubType;
186
+ declare const NodeSubTypeActionSendSMS: NodeSubType;
187
+ declare const NodeSubTypeActionGenerateDocument: NodeSubType;
188
+ declare const NodeSubTypeActionProcessPayment: NodeSubType;
189
+ declare const NodeSubTypeActionCreateEntityRecord: NodeSubType;
190
+ declare const NodeSubTypeActionUpdateEntityRecord: NodeSubType;
191
+ declare const NodeSubTypeActionDeleteEntityRecord: NodeSubType;
192
+ declare const NodeSubTypeActionMergeEntityRecords: NodeSubType;
193
+ declare const NodeSubTypeActionAssignSLAPolicy: NodeSubType;
194
+ declare const NodeSubTypeActionChangeSLAStatus: NodeSubType;
195
+ declare const NodeSubTypeActionEscalateSLA: NodeSubType;
196
+ declare const NodeSubTypeActionCSATSurvey: NodeSubType;
197
+ declare const NodeSubTypeActionSetVariables: NodeSubType;
198
+ declare const NodeSubTypeActionQueryEntityRecords: NodeSubType;
199
+ declare const NodeSubTypeActionNatsRequest: NodeSubType;
200
+ /**
201
+ * Logic subtypes
202
+ */
203
+ declare const NodeSubTypeLogicIf: NodeSubType;
204
+ declare const NodeSubTypeLogicSwitch: NodeSubType;
205
+ declare const NodeSubTypeLogicFor: NodeSubType;
206
+ declare const NodeSubTypeLogicParallel: NodeSubType;
207
+ /**
208
+ * Loop subtypes
209
+ */
210
+ declare const NodeSubTypeLoopData: NodeSubType;
211
+ /**
212
+ * Delay subtypes
213
+ */
214
+ declare const NodeSubTypeDelay: NodeSubType;
215
+ /**
216
+ * Data subtypes
217
+ */
218
+ declare const NodeSubTypeDataFilter: NodeSubType;
219
+ declare const NodeSubTypeDataMap: NodeSubType;
220
+ declare const NodeSubTypeDataCalculate: NodeSubType;
221
+ declare const NodeSubTypeDataValidate: NodeSubType;
222
+ /**
223
+ * Timer subtypes
224
+ */
225
+ declare const NodeSubTypeTimerDelay: NodeSubType;
226
+ declare const NodeSubTypeTimerSchedule: NodeSubType;
227
+ declare const NodeSubTypeTimerBusinessHours: NodeSubType;
228
+ /**
229
+ * ExpressionType defines the type of expression evaluation to be used
230
+ */
231
+ type ExpressionType = string;
232
+ /**
233
+ * Simple filter-based expressions using predefined operators
234
+ */
235
+ declare const ExpressionTypeFilter: ExpressionType;
236
+ /**
237
+ * JavaScript-like expressions with full language features
238
+ */
239
+ declare const ExpressionTypeJavaScript: ExpressionType;
240
+ /**
241
+ * Template expressions with variable interpolation
242
+ */
243
+ declare const ExpressionTypeTemplate: ExpressionType;
244
+ /**
245
+ * Custom domain-specific language expressions
246
+ */
247
+ declare const ExpressionTypeDSL: ExpressionType;
248
+ /**
249
+ * Complex rule-based expressions (e.g., business rules)
250
+ */
251
+ declare const ExpressionTypeRules: ExpressionType;
252
+ /**
253
+ * EdgeType defines the type and behavior of workflow edges
254
+ */
255
+ type EdgeType = string;
256
+ /**
257
+ * Standard flow between nodes
258
+ */
259
+ declare const EdgeTypeNormal: EdgeType;
260
+ /**
261
+ * Loop back to previous node
262
+ */
263
+ declare const EdgeTypeLoopBack: EdgeType;
264
+ /**
265
+ * Error handling path
266
+ */
267
+ declare const EdgeTypeError: EdgeType;
268
+ /**
269
+ * Fallback/default path when no other conditions match
270
+ */
271
+ declare const EdgeTypeDefault: EdgeType;
272
+ /**
273
+ * Path for parallel execution branch
274
+ */
275
+ declare const EdgeTypeParallel: EdgeType;
276
+ /**
277
+ * Path for conditional branching
278
+ */
279
+ declare const EdgeTypeConditional: EdgeType;
280
+ /**
281
+ * Path for merging parallel branches
282
+ */
283
+ declare const EdgeTypeMerge: EdgeType;
284
+ /**
285
+ * Compensating/rollback path
286
+ */
287
+ declare const EdgeTypeCompensation: EdgeType;
288
+ /**
289
+ * Path for timeout/deadline handling
290
+ */
291
+ declare const EdgeTypeTimeout: EdgeType;
292
+ type WorkflowType = string;
293
+ declare const WorkflowTypeEntity: WorkflowType;
294
+ declare const WorkflowTypeDocument: WorkflowType;
295
+ declare const WorkflowTypeChat: WorkflowType;
296
+ declare const WorkflowTypeAgent: WorkflowType;
297
+ declare const WorkflowTypeProductivity: WorkflowType;
298
+ /**
299
+ * NodeDefinition is the design-time template for creating WorkflowNode instances.
300
+ * This is the single source of truth for all node types in the workflow system.
301
+ * Generated to TypeScript via schema-generator for use in the workflow designer UI.
302
+ */
303
+ interface NodeDefinition {
304
+ type: NodeType;
305
+ subType: NodeSubTypeTS;
306
+ label: string;
307
+ icon: string;
308
+ description: string;
309
+ category: string;
310
+ config: JSONSchema;
311
+ input: JSONSchema;
312
+ output: JSONSchema;
313
+ }
314
+ /**
315
+ * EdgeTypeDefinition defines metadata for an edge type
316
+ */
317
+ interface EdgeTypeDefinition {
318
+ value: string;
319
+ label: string;
320
+ }
321
+ /**
322
+ * WorkflowTypeDefinition defines metadata for a workflow type
323
+ */
324
+ interface WorkflowTypeDefinition {
325
+ value: string;
326
+ label: string;
327
+ }
328
+ interface LogicPath {
329
+ id: string;
330
+ nodeId: string;
331
+ condition: string;
332
+ priority: number;
333
+ }
334
+ interface Intent {
335
+ id: string;
336
+ nodeId: string;
337
+ name: string;
338
+ description: string;
339
+ }
340
+ interface ResponseMetadata {
341
+ success: boolean;
342
+ timestamp: string;
343
+ message?: string;
344
+ error?: string;
345
+ }
346
+ interface Metadata {
347
+ createdBy: string;
348
+ createdAt: string;
349
+ updatedBy?: string;
350
+ updatedAt?: string;
351
+ isActive: boolean;
352
+ version: number;
353
+ }
354
+ interface CreateWorkflowDefinitionRequest {
355
+ definition: WorkflowDefinition;
356
+ orgId: string;
357
+ }
358
+ interface UpdateWorkflowDefinitionRequest {
359
+ definition: WorkflowDefinition;
360
+ orgId: string;
361
+ }
362
+ interface WorkflowDefinitionResponse {
363
+ definition: WorkflowDefinition;
364
+ metadata: ResponseMetadata;
365
+ }
366
+ interface GetWorkflowDefinitionRequest {
367
+ id?: string;
368
+ name?: string;
369
+ title?: string;
370
+ type?: string;
371
+ orgId: string;
372
+ }
373
+ /**
374
+ * GetWorkflowDefinitionByTitleRequest is used for the legacy workflow.definition.get.by.title endpoint
375
+ * Kept for backward compatibility - prefer using GetWorkflowDefinitionRequest with Name field
376
+ */
377
+ interface GetWorkflowDefinitionByTitleRequest {
378
+ title: string;
379
+ name?: string;
380
+ type?: string;
381
+ orgId: string;
382
+ }
383
+ interface ListWorkflowDefinitionsRequest {
384
+ orgId: string;
385
+ status?: string;
386
+ }
387
+ interface ListWorkflowDefinitionsResponse {
388
+ definitions: WorkflowDefinition[];
389
+ metadata: ResponseMetadata;
390
+ }
391
+ interface DeleteWorkflowDefinitionRequest {
392
+ id: string;
393
+ orgId: string;
394
+ }
395
+ /**
396
+ * Workflow Definition models
397
+ */
398
+ interface WorkflowDefinition {
399
+ /**
400
+ * Core Identity
401
+ */
402
+ id?: string;
403
+ name: string;
404
+ title: string;
405
+ description: string;
406
+ type: WorkflowTypeTS;
407
+ /**
408
+ * Graph Structure
409
+ */
410
+ nodes: {
411
+ [key: string]: WorkflowNode;
412
+ };
413
+ edges: WorkflowEdge[];
414
+ entryPoints: string[];
415
+ /**
416
+ * Data Management
417
+ */
418
+ variables: WorkflowVariables;
419
+ constants?: {
420
+ [key: string]: any;
421
+ };
422
+ /**
423
+ * Runtime Configuration
424
+ */
425
+ persistence?: PersistenceType;
426
+ /**
427
+ * Validation and Constraints
428
+ */
429
+ rules?: WorkflowRule[];
430
+ permissions: WorkflowPermissions;
431
+ /**
432
+ * Metadata and Tracking
433
+ */
434
+ metadata: WorkflowMetadata;
435
+ }
436
+ interface WorkflowVariables {
437
+ schema: JSONSchema;
438
+ scope: {
439
+ [key: string]: string;
440
+ };
441
+ defaultValues: {
442
+ [key: string]: any;
443
+ };
444
+ computed: {
445
+ [key: string]: string;
446
+ };
447
+ }
448
+ interface WorkflowRule {
449
+ name: string;
450
+ description: string;
451
+ condition: string;
452
+ action: string;
453
+ level: RuleLevel;
454
+ }
455
+ type RuleLevel = string;
456
+ declare const RuleLevelError: RuleLevel;
457
+ declare const RuleLevelWarning: RuleLevel;
458
+ declare const RuleLevelInfo: RuleLevel;
459
+ interface WorkflowPermissions {
460
+ roles: {
461
+ [key: string]: string[];
462
+ };
463
+ accessLevel: string;
464
+ editableBy: string[];
465
+ viewableBy: string[];
466
+ }
467
+ interface WorkflowMetadata {
468
+ createdBy: string;
469
+ createdAt: string;
470
+ updatedBy?: string;
471
+ updatedAt?: string;
472
+ isActive: boolean;
473
+ version: number;
474
+ tags?: string[];
475
+ category?: string;
476
+ labels?: string[];
477
+ }
478
+ type PersistenceType = string;
479
+ declare const PersistenceTypeEphemeral: PersistenceType;
480
+ declare const PersistenceTypePermanent: PersistenceType;
481
+ /**
482
+ * todo: validate default values against schema
483
+ */
484
+ interface NodeInput {
485
+ schema: JSONSchema;
486
+ defaultValues?: {
487
+ [key: string]: any;
488
+ };
489
+ }
490
+ interface NodeOutput {
491
+ schema: JSONSchema;
492
+ /**
493
+ * Mapping map[string]string `json:"mapping,omitempty"`
494
+ */
495
+ values?: {
496
+ [key: string]: any;
497
+ };
498
+ }
499
+ interface NodeConfig {
500
+ schema: JSONSchema;
501
+ values: {
502
+ [key: string]: any;
503
+ };
504
+ promoteToVariables?: string[];
505
+ }
506
+ interface WorkflowNode {
507
+ id: string;
508
+ title: string;
509
+ name: string;
510
+ label?: string;
511
+ description?: string;
512
+ type: WorkflowNodeTypeTS;
513
+ subType?: WorkflowNodeSubTypeTS;
514
+ config: NodeConfig;
515
+ settings: NodeSettings;
516
+ input: NodeInput;
517
+ output: NodeOutput;
518
+ isStart: boolean;
519
+ }
520
+ /**
521
+ * NodeSettings contains type-specific configuration
522
+ */
523
+ interface NodeSettings {
524
+ /**
525
+ * Shared configs
526
+ */
527
+ execution?: ExecutionConfig;
528
+ retry?: RetryConfig;
529
+ }
530
+ interface ExecutionConfig {
531
+ timeoutSeconds: number;
532
+ priority: number;
533
+ subject?: string;
534
+ }
535
+ interface RetryConfig {
536
+ maxAttempts: number;
537
+ initialDelay: any;
538
+ maxDelay: any;
539
+ backoffMultiplier: number;
540
+ }
541
+ /**
542
+ * CacheConfig defines caching behavior for expression results
543
+ */
544
+ interface CacheConfig {
545
+ enabled: boolean;
546
+ ttl: any;
547
+ key?: string;
548
+ tags?: string[];
549
+ }
550
+ interface ExpressionConfig {
551
+ type: ExpressionType;
552
+ expression: string;
553
+ variables?: string[];
554
+ timeout?: any;
555
+ cache?: CacheConfig;
556
+ }
557
+ /**
558
+ * Example usage in full edge structure
559
+ */
560
+ interface WorkflowEdge {
561
+ id: string;
562
+ fromNodeId: string;
563
+ toNodeId: string;
564
+ type: WorkflowEdgeTypeTS;
565
+ label?: string;
566
+ expression?: ExpressionConfig;
567
+ priority: number;
568
+ retry?: RetryConfig;
569
+ timeout?: TimeoutConfig;
570
+ properties?: {
571
+ [key: string]: string;
572
+ };
573
+ }
574
+ /**
575
+ * TimeoutConfig defines timeout behavior for nodes and edges
576
+ */
577
+ interface TimeoutConfig {
578
+ duration: any;
579
+ action: TimeoutAction;
580
+ retryPolicy?: RetryConfig;
581
+ }
582
+ type TimeoutAction = string;
583
+ declare const TimeoutActionFail: TimeoutAction;
584
+ declare const TimeoutActionSkip: TimeoutAction;
585
+ declare const TimeoutActionRetry: TimeoutAction;
586
+ declare const TimeoutActionAlt: TimeoutAction;
587
+ interface CreateWorkflowInstanceRequest {
588
+ orgId: string;
589
+ definitionId: string;
590
+ variables: {
591
+ [key: string]: any;
592
+ };
593
+ autoExecute: boolean;
594
+ }
595
+ interface WorkflowInstanceResponse {
596
+ instance?: WorkflowInstance;
597
+ metadata: ResponseMetadata;
598
+ }
599
+ interface WorkflowInstanceExecuteNodeRequest {
600
+ orgId: string;
601
+ instanceId: string;
602
+ nodeId: string;
603
+ input: {
604
+ [key: string]: any;
605
+ };
606
+ }
607
+ interface WorkflowInstanceResumeNodeRequest {
608
+ orgId: string;
609
+ instanceId: string;
610
+ nodeId: string;
611
+ result: {
612
+ [key: string]: any;
613
+ };
614
+ }
615
+ interface WorkflowInstanceExecuteNodeLeanRequest {
616
+ orgId: string;
617
+ nodeDef: WorkflowNode;
618
+ input: {
619
+ [key: string]: any;
620
+ };
621
+ }
622
+ interface UpdateInstanceNodeMetadataRequest {
623
+ orgId: string;
624
+ instanceId: string;
625
+ nodeId: string;
626
+ metadataKey: string;
627
+ payload: any;
628
+ }
629
+ interface GetWorkflowInstanceRequest {
630
+ orgId: string;
631
+ instanceId: string;
632
+ }
633
+ /**
634
+ * GetInstanceByStateVariableRequest finds an instance by a variable stored in state.variables
635
+ */
636
+ interface GetInstanceByStateVariableRequest {
637
+ orgId: string;
638
+ definitionId: string;
639
+ variableKey: string;
640
+ variableValue: string;
641
+ }
642
+ interface ListWorkflowInstancesRequest {
643
+ orgId: string;
644
+ definitionId: string;
645
+ userId?: string;
646
+ status?: string;
647
+ }
648
+ interface ListWorkflowInstancesResponse {
649
+ instances: WorkflowInstance[];
650
+ metadata: ResponseMetadata;
651
+ }
652
+ interface UpdateInstanceStatusRequest {
653
+ orgId: string;
654
+ instanceId: string;
655
+ status: InstanceStatus;
656
+ }
657
+ interface RetryNodeRequest {
658
+ orgId: string;
659
+ instanceId: string;
660
+ nodeId: string;
661
+ }
662
+ interface ListInstancesOptions {
663
+ definitionId: string;
664
+ userId?: string;
665
+ status: InstanceStatus;
666
+ limit: number;
667
+ offset: number;
668
+ }
669
+ interface InstanceState {
670
+ variables: {
671
+ [key: string]: any;
672
+ };
673
+ constants: {
674
+ [key: string]: any;
675
+ };
676
+ nodeStates: {
677
+ [key: string]: NodeState;
678
+ };
679
+ edgeStates: {
680
+ [key: string]: EdgeState;
681
+ };
682
+ }
683
+ interface ExecutionContext {
684
+ currentNodes: string[];
685
+ path: ExecutionPathEntry[];
686
+ errors: ExecutionError[];
687
+ }
688
+ /**
689
+ * Workflow Instance models
690
+ */
691
+ interface WorkflowInstance {
692
+ id?: string;
693
+ orgId?: string;
694
+ definitionId: string;
695
+ definitionName?: string;
696
+ title?: string;
697
+ description?: string;
698
+ type?: WorkflowType;
699
+ definitionVersion: number;
700
+ status: InstanceStatus;
701
+ state: InstanceState;
702
+ context: ExecutionContext;
703
+ persistence?: PersistenceType;
704
+ metadata: WorkflowMetadata;
705
+ }
706
+ interface NodeState {
707
+ status: NodeStatus;
708
+ input?: {
709
+ [key: string]: any;
710
+ };
711
+ output?: {
712
+ [key: string]: any;
713
+ };
714
+ /**
715
+ * Variables map[string]interface{} `json:"variables,omitempty"`
716
+ */
717
+ error?: string;
718
+ startTime?: string;
719
+ endTime?: string;
720
+ retryCount: number;
721
+ nextRetryAt?: string;
722
+ }
723
+ interface EdgeState {
724
+ status: EdgeStatus;
725
+ timestamp: string;
726
+ error?: string;
727
+ }
728
+ interface ExecutionPathEntry {
729
+ nodeId: string;
730
+ edgeId: string;
731
+ type: string;
732
+ timestamp: string;
733
+ data?: {
734
+ [key: string]: any;
735
+ };
736
+ }
737
+ interface ExecutionError {
738
+ nodeId?: string;
739
+ edgeId?: string;
740
+ error: string;
741
+ timestamp: string;
742
+ retryable: boolean;
743
+ }
744
+ type InstanceStatus = string;
745
+ declare const InstanceStatusNew: InstanceStatus;
746
+ declare const InstanceStatusRunning: InstanceStatus;
747
+ declare const InstanceStatusWaiting: InstanceStatus;
748
+ declare const InstanceStatusPaused: InstanceStatus;
749
+ declare const InstanceStatusCompleted: InstanceStatus;
750
+ declare const InstanceStatusFailed: InstanceStatus;
751
+ interface NodeInstance {
752
+ nodeId: string;
753
+ status: NodeStatus;
754
+ input?: {
755
+ [key: string]: any;
756
+ };
757
+ output?: {
758
+ [key: string]: any;
759
+ };
760
+ error?: string;
761
+ startTime?: string;
762
+ endTime?: string;
763
+ retryCount: number;
764
+ nextRetryAt?: string;
765
+ }
766
+ type NodeStatus = string;
767
+ declare const NodeStatusPending: NodeStatus;
768
+ declare const NodeStatusRunning: NodeStatus;
769
+ declare const NodeStatusCompleted: NodeStatus;
770
+ declare const NodeStatusFailed: NodeStatus;
771
+ declare const NodeStatusWaiting: NodeStatus;
772
+ declare const NodeStatusSkipped: NodeStatus;
773
+ type EdgeStatus = string;
774
+ declare const EdgeStatusPending: EdgeStatus;
775
+ declare const EdgeStatusCompleted: EdgeStatus;
776
+ declare const EdgeStatusSkipped: EdgeStatus;
777
+ /**
778
+ * WorkflowDefinitionInfo holds summarized info about an active workflow definition
779
+ * Used by schedulers and services that need to process workflows without full definition details
780
+ */
781
+ interface WorkflowDefinitionInfo {
782
+ id: string;
783
+ orgId: string;
784
+ title: string;
785
+ type: string;
786
+ category: string;
787
+ isActive: boolean;
788
+ createdBy: string;
789
+ /**
790
+ * User config from definition.variables.defaultValues (workflow-specific)
791
+ */
792
+ provider?: string;
793
+ userEmail?: string;
794
+ userId?: string;
795
+ }
796
+
797
+ declare const WorkflowDefinitionCreate = "workflow.definition.create";
798
+ declare const WorkflowDefinitionCreated = "workflow.definition.created";
799
+ declare const WorkflowDefinitionUpdate = "workflow.definition.update";
800
+ declare const WorkflowDefinitionUpdated = "workflow.definition.updated";
801
+ declare const WorkflowDefinitionGet = "workflow.definition.get";
802
+ declare const WorkflowDefinitionGetServer = "workflow.definition.get.server";
803
+ declare const WorkflowDefinitionGetByTitle = "workflow.definition.get.by.title";
804
+ declare const WorkflowDefinitionList = "workflow.definition.list";
805
+ declare const WorkflowDefinitionDelete = "workflow.definition.delete";
806
+ declare const WorkflowDefinitionDeleted = "workflow.definition.deleted";
807
+ declare const WorkflowInstanceCreate = "workflow.instance.create";
808
+ declare const WorkflowInstanceExecuteNode = "workflow.instance.execute.node";
809
+ declare const WorkflowInstanceResumeNode = "workflow.instance.resume.node";
810
+ declare const WorkflowInstanceExecuteNodeServer = "workflow.instance.execute.node.server";
811
+ declare const WorkflowInstanceResumeNodeServer = "workflow.instance.resume.node.server";
812
+ declare const WorkflowInstanceExecuteNodeLean = "workflow.instance.execute.node.lean";
813
+ declare const WorkflowInstanceExecuteNodeLeanServer = "workflow.instance.execute.node.lean.server";
814
+ declare const WorkflowInstanceGet = "workflow.instance.get";
815
+ declare const WorkflowInstanceGetByStateVariable = "workflow.instance.get.by.state.variable";
816
+ declare const WorkflowInstanceList = "workflow.instance.list";
817
+ declare const WorkflowInstanceUpdate = "workflow.instance.update";
818
+ declare const WorkflowInstanceUpdated = "workflow.instance.updated";
819
+ declare const WorkflowInstanceUpdateNodeMetadata = "workflow.instance.update.node.metadata";
820
+ /**
821
+ * Template management
822
+ */
823
+ declare const WorkflowTemplateList = "workflow.template.list";
824
+ declare const WorkflowTemplateGet = "workflow.template.get";
825
+ declare const WorkflowTemplateInstantiate = "workflow.template.instantiate";
826
+ /**
827
+ * Schedule management
828
+ */
829
+ declare const WorkflowScheduleCreate = "workflow.schedule.create";
830
+ declare const WorkflowScheduleUpdate = "workflow.schedule.update";
831
+ declare const WorkflowScheduleDelete = "workflow.schedule.delete";
832
+ declare const WorkflowScheduleList = "workflow.schedule.list";
833
+ declare const WorkflowSchedulePause = "workflow.schedule.pause";
834
+ declare const WorkflowScheduleResume = "workflow.schedule.resume";
835
+ /**
836
+ * Trigger management
837
+ */
838
+ declare const WorkflowTriggerRegister = "workflow.trigger.register";
839
+ declare const WorkflowTriggerPause = "workflow.trigger.pause";
840
+ declare const WorkflowTriggerResume = "workflow.trigger.resume";
841
+ declare const WorkflowTriggerStatus = "workflow.trigger.status";
842
+ declare const WorkflowTriggerFired = "workflow.trigger.fired";
843
+ /**
844
+ * Execution events
845
+ */
846
+ declare const WorkflowExecutionStarted = "workflow.execution.started";
847
+ declare const WorkflowExecutionCompleted = "workflow.execution.completed";
848
+ declare const WorkflowExecutionFailed = "workflow.execution.failed";
849
+
850
+ export { NodeSubTypeActionSetVariables as $, NodeSubTypeHumanActionDataEntry as A, NodeSubTypeHumanActionAssignment as B, NodeSubTypeAgentChat as C, NodeSubTypeAgentIntentDetector as D, NodeSubTypeAgentKnowledgeGraph as E, NodeSubTypeAgentClientApiCall as F, NodeSubTypeAgentTransferToHuman as G, NodeSubTypeAgentOpenTicket as H, NodeSubTypeAgentApiIntegration as I, NodeSubTypeAgentCustomResponse as J, NodeSubTypeAgentStructuredOutput as K, NodeSubTypeActionApiCall as L, NodeSubTypeActionDocumentExtraction as M, type NodeType as N, NodeSubTypeActionSendEmail as O, NodeSubTypeActionSendSMS as P, NodeSubTypeActionGenerateDocument as Q, NodeSubTypeActionProcessPayment as R, NodeSubTypeActionCreateEntityRecord as S, NodeSubTypeActionUpdateEntityRecord as T, NodeSubTypeActionDeleteEntityRecord as U, NodeSubTypeActionMergeEntityRecords as V, type WorkflowDefinition as W, NodeSubTypeActionAssignSLAPolicy as X, NodeSubTypeActionChangeSLAStatus as Y, NodeSubTypeActionEscalateSLA as Z, NodeSubTypeActionCSATSurvey as _, type WorkflowInstance as a, type NodeInput as a$, NodeSubTypeActionQueryEntityRecords as a0, NodeSubTypeActionNatsRequest as a1, NodeSubTypeLogicIf as a2, NodeSubTypeLogicSwitch as a3, NodeSubTypeLogicFor as a4, NodeSubTypeLogicParallel as a5, NodeSubTypeLoopData as a6, NodeSubTypeDelay as a7, NodeSubTypeDataFilter as a8, NodeSubTypeDataMap as a9, WorkflowTypeProductivity as aA, type NodeDefinition as aB, type EdgeTypeDefinition as aC, type WorkflowTypeDefinition as aD, type LogicPath as aE, type Intent as aF, type ResponseMetadata as aG, type Metadata as aH, type CreateWorkflowDefinitionRequest as aI, type UpdateWorkflowDefinitionRequest as aJ, type WorkflowDefinitionResponse as aK, type GetWorkflowDefinitionRequest as aL, type GetWorkflowDefinitionByTitleRequest as aM, type ListWorkflowDefinitionsRequest as aN, type ListWorkflowDefinitionsResponse as aO, type DeleteWorkflowDefinitionRequest as aP, type WorkflowVariables as aQ, type WorkflowRule as aR, type RuleLevel as aS, RuleLevelError as aT, RuleLevelWarning as aU, RuleLevelInfo as aV, type WorkflowPermissions as aW, type WorkflowMetadata as aX, type PersistenceType as aY, PersistenceTypeEphemeral as aZ, PersistenceTypePermanent as a_, NodeSubTypeDataCalculate as aa, NodeSubTypeDataValidate as ab, NodeSubTypeTimerDelay as ac, NodeSubTypeTimerSchedule as ad, NodeSubTypeTimerBusinessHours as ae, type ExpressionType as af, ExpressionTypeFilter as ag, ExpressionTypeJavaScript as ah, ExpressionTypeTemplate as ai, ExpressionTypeDSL as aj, ExpressionTypeRules as ak, type EdgeType as al, EdgeTypeNormal as am, EdgeTypeLoopBack as an, EdgeTypeError as ao, EdgeTypeDefault as ap, EdgeTypeParallel as aq, EdgeTypeConditional as ar, EdgeTypeMerge as as, EdgeTypeCompensation as at, EdgeTypeTimeout as au, type WorkflowType as av, WorkflowTypeEntity as aw, WorkflowTypeDocument as ax, WorkflowTypeChat as ay, WorkflowTypeAgent as az, NodeTypeTrigger as b, WorkflowDefinitionDeleted as b$, type NodeOutput as b0, type NodeConfig as b1, type WorkflowNode as b2, type NodeSettings as b3, type ExecutionConfig as b4, type RetryConfig as b5, type CacheConfig as b6, type ExpressionConfig as b7, type WorkflowEdge as b8, type TimeoutConfig as b9, InstanceStatusRunning as bA, InstanceStatusWaiting as bB, InstanceStatusPaused as bC, InstanceStatusCompleted as bD, InstanceStatusFailed as bE, type NodeInstance as bF, type NodeStatus as bG, NodeStatusPending as bH, NodeStatusRunning as bI, NodeStatusCompleted as bJ, NodeStatusFailed as bK, NodeStatusWaiting as bL, NodeStatusSkipped as bM, type EdgeStatus as bN, EdgeStatusPending as bO, EdgeStatusCompleted as bP, EdgeStatusSkipped as bQ, type WorkflowDefinitionInfo as bR, WorkflowDefinitionCreate as bS, WorkflowDefinitionCreated as bT, WorkflowDefinitionUpdate as bU, WorkflowDefinitionUpdated as bV, WorkflowDefinitionGet as bW, WorkflowDefinitionGetServer as bX, WorkflowDefinitionGetByTitle as bY, WorkflowDefinitionList as bZ, WorkflowDefinitionDelete as b_, type TimeoutAction as ba, TimeoutActionFail as bb, TimeoutActionSkip as bc, TimeoutActionRetry as bd, TimeoutActionAlt as be, type CreateWorkflowInstanceRequest as bf, type WorkflowInstanceResponse as bg, type WorkflowInstanceExecuteNodeRequest as bh, type WorkflowInstanceResumeNodeRequest as bi, type WorkflowInstanceExecuteNodeLeanRequest as bj, type UpdateInstanceNodeMetadataRequest as bk, type GetWorkflowInstanceRequest as bl, type GetInstanceByStateVariableRequest as bm, type ListWorkflowInstancesRequest as bn, type ListWorkflowInstancesResponse as bo, type UpdateInstanceStatusRequest as bp, type RetryNodeRequest as bq, type ListInstancesOptions as br, type InstanceState as bs, type ExecutionContext as bt, type NodeState as bu, type EdgeState as bv, type ExecutionPathEntry as bw, type ExecutionError as bx, type InstanceStatus as by, InstanceStatusNew as bz, NodeTypeHumanAction as c, type WorkflowEdgeTypeOptionTS as c$, WorkflowInstanceCreate as c0, WorkflowInstanceExecuteNode as c1, WorkflowInstanceResumeNode as c2, WorkflowInstanceExecuteNodeServer as c3, WorkflowInstanceResumeNodeServer as c4, WorkflowInstanceExecuteNodeLean as c5, WorkflowInstanceExecuteNodeLeanServer as c6, WorkflowInstanceGet as c7, WorkflowInstanceGetByStateVariable as c8, WorkflowInstanceList as c9, AgentNodeSubTypes as cA, ActionNodeSubTypes as cB, LogicNodeSubTypes as cC, DelayNodeSubTypes as cD, ParallelNodeSubTypes as cE, DataNodeSubTypes as cF, TimerNodeSubTypes as cG, LoopNodeSubTypes as cH, AccountingNodeSubTypes as cI, type TriggerNodeSubType as cJ, type HumanActionNodeSubType as cK, type AgentNodeSubType as cL, type ActionNodeSubType as cM, type LogicNodeSubType as cN, type DelayNodeSubType as cO, type DataNodeSubType as cP, type TimerNodeSubType as cQ, type LoopNodeSubType as cR, type ParallelNodeSubType as cS, type AccountingNodeSubType as cT, type WorkflowNodeSubTypeTS as cU, WorkflowNodeTypes as cV, type WorkflowNodeTypeTS as cW, type WorkflowNodeTypeOptionTS as cX, type NodeCategory as cY, WorkflowEdgeTypes as cZ, type WorkflowEdgeTypeTS as c_, WorkflowInstanceUpdate as ca, WorkflowInstanceUpdated as cb, WorkflowInstanceUpdateNodeMetadata as cc, WorkflowTemplateList as cd, WorkflowTemplateGet as ce, WorkflowTemplateInstantiate as cf, WorkflowScheduleCreate as cg, WorkflowScheduleUpdate as ch, WorkflowScheduleDelete as ci, WorkflowScheduleList as cj, WorkflowSchedulePause as ck, WorkflowScheduleResume as cl, WorkflowTriggerRegister as cm, WorkflowTriggerPause as cn, WorkflowTriggerResume as co, WorkflowTriggerStatus as cp, WorkflowTriggerFired as cq, WorkflowExecutionStarted as cr, WorkflowExecutionCompleted as cs, WorkflowExecutionFailed as ct, type NodeSubTypeTS as cu, type NodeSubTypeInfo as cv, nodeDefinitions as cw, nodeSchemas as cx, TriggerNodeSubTypes as cy, HumanActionNodeSubTypes as cz, NodeTypeAgent as d, WorkflowTypes as d0, type WorkflowTypeTS as d1, type WorkflowTypeOptionTS as d2, NodeTypeAction as e, NodeTypeLogic as f, NodeTypeLoop as g, NodeTypeParallel as h, NodeTypeDelay as i, NodeTypeData as j, NodeTypeIntegration as k, NodeTypeTimer as l, NodeTypeSubflow as m, NodeTypeCustom as n, NodeTypeAccounting as o, type NodeSubType as p, NodeSubTypeTriggerStart as q, NodeSubTypeTriggerEntityRecordCreated as r, NodeSubTypeTriggerEntityRecordUpdated as s, NodeSubTypeTriggerEntityRecordDeleted as t, NodeSubTypeTriggerSLAWarning as u, NodeSubTypeTriggerSLABreach as v, NodeSubTypeTriggerEscalation as w, NodeSubTypeTriggerWebhookReceived as x, NodeSubTypeHumanActionReview as y, NodeSubTypeHumanActionApproval as z };