@octaviaflow/flow-rules 0.1.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 +96 -0
- package/dist/catalog/actions/console-log/config.d.ts +58 -0
- package/dist/catalog/actions/console-log/config.js +70 -0
- package/dist/catalog/actions/console-log/index.d.ts +7 -0
- package/dist/catalog/actions/console-log/index.js +89 -0
- package/dist/catalog/actions/delay/config.d.ts +50 -0
- package/dist/catalog/actions/delay/config.js +79 -0
- package/dist/catalog/actions/delay/index.d.ts +7 -0
- package/dist/catalog/actions/delay/index.js +71 -0
- package/dist/catalog/actions/delay/migrate.d.ts +18 -0
- package/dist/catalog/actions/delay/migrate.js +38 -0
- package/dist/catalog/actions/delay/types.d.ts +58 -0
- package/dist/catalog/actions/delay/types.js +17 -0
- package/dist/catalog/actions/http-request/config.d.ts +114 -0
- package/dist/catalog/actions/http-request/config.js +111 -0
- package/dist/catalog/actions/http-request/index.d.ts +7 -0
- package/dist/catalog/actions/http-request/index.js +223 -0
- package/dist/catalog/ai/ai-agent/index.d.ts +12 -0
- package/dist/catalog/ai/ai-agent/index.js +72 -0
- package/dist/catalog/ai/idp-extract/index.d.ts +18 -0
- package/dist/catalog/ai/idp-extract/index.js +90 -0
- package/dist/catalog/api/graphql-query/config.d.ts +36 -0
- package/dist/catalog/api/graphql-query/config.js +31 -0
- package/dist/catalog/api/graphql-query/index.d.ts +7 -0
- package/dist/catalog/api/graphql-query/index.js +75 -0
- package/dist/catalog/communication/email-send/config.d.ts +80 -0
- package/dist/catalog/communication/email-send/config.js +80 -0
- package/dist/catalog/communication/email-send/index.d.ts +11 -0
- package/dist/catalog/communication/email-send/index.js +152 -0
- package/dist/catalog/communication/google-chat/config.d.ts +45 -0
- package/dist/catalog/communication/google-chat/config.js +28 -0
- package/dist/catalog/communication/google-chat/index.d.ts +5 -0
- package/dist/catalog/communication/google-chat/index.js +36 -0
- package/dist/catalog/communication/slack-message/config.d.ts +47 -0
- package/dist/catalog/communication/slack-message/config.js +36 -0
- package/dist/catalog/communication/slack-message/index.d.ts +5 -0
- package/dist/catalog/communication/slack-message/index.js +37 -0
- package/dist/catalog/communication/teams-message/config.d.ts +48 -0
- package/dist/catalog/communication/teams-message/config.js +29 -0
- package/dist/catalog/communication/teams-message/index.d.ts +5 -0
- package/dist/catalog/communication/teams-message/index.js +39 -0
- package/dist/catalog/communication/webhook-call/config.d.ts +36 -0
- package/dist/catalog/communication/webhook-call/config.js +31 -0
- package/dist/catalog/communication/webhook-call/index.d.ts +5 -0
- package/dist/catalog/communication/webhook-call/index.js +43 -0
- package/dist/catalog/communication/whatsapp-send/config.d.ts +23 -0
- package/dist/catalog/communication/whatsapp-send/config.js +36 -0
- package/dist/catalog/communication/whatsapp-send/index.d.ts +15 -0
- package/dist/catalog/communication/whatsapp-send/index.js +57 -0
- package/dist/catalog/general/query/config.d.ts +36 -0
- package/dist/catalog/general/query/config.js +257 -0
- package/dist/catalog/general/query/index.d.ts +11 -0
- package/dist/catalog/general/query/index.js +271 -0
- package/dist/catalog/general/query/types.d.ts +205 -0
- package/dist/catalog/general/query/types.js +82 -0
- package/dist/catalog/general/transform/config.d.ts +117 -0
- package/dist/catalog/general/transform/config.js +95 -0
- package/dist/catalog/general/transform/index.d.ts +8 -0
- package/dist/catalog/general/transform/index.js +63 -0
- package/dist/catalog/index.d.ts +57 -0
- package/dist/catalog/index.js +168 -0
- package/dist/catalog/logic/condition/config.d.ts +54 -0
- package/dist/catalog/logic/condition/config.js +93 -0
- package/dist/catalog/logic/condition/index.d.ts +7 -0
- package/dist/catalog/logic/condition/index.js +64 -0
- package/dist/catalog/logic/for-each/config.d.ts +100 -0
- package/dist/catalog/logic/for-each/config.js +75 -0
- package/dist/catalog/logic/for-each/index.d.ts +7 -0
- package/dist/catalog/logic/for-each/index.js +92 -0
- package/dist/catalog/logic/for-each/pathOptions.d.ts +62 -0
- package/dist/catalog/logic/for-each/pathOptions.js +151 -0
- package/dist/catalog/logic/group/index.d.ts +15 -0
- package/dist/catalog/logic/group/index.js +46 -0
- package/dist/catalog/policies.d.ts +75 -0
- package/dist/catalog/policies.js +62 -0
- package/dist/catalog/storage/csv-action/index.d.ts +2 -0
- package/dist/catalog/storage/csv-action/index.js +38 -0
- package/dist/catalog/storage/dropbox-action/index.d.ts +2 -0
- package/dist/catalog/storage/dropbox-action/index.js +33 -0
- package/dist/catalog/storage/excel-action/index.d.ts +2 -0
- package/dist/catalog/storage/excel-action/index.js +32 -0
- package/dist/catalog/storage/file-action/index.d.ts +2 -0
- package/dist/catalog/storage/file-action/index.js +119 -0
- package/dist/catalog/storage/file-operation/config.d.ts +48 -0
- package/dist/catalog/storage/file-operation/config.js +45 -0
- package/dist/catalog/storage/file-operation/index.d.ts +8 -0
- package/dist/catalog/storage/file-operation/index.js +111 -0
- package/dist/catalog/storage/ftp-action/index.d.ts +2 -0
- package/dist/catalog/storage/ftp-action/index.js +33 -0
- package/dist/catalog/storage/google-drive-action/index.d.ts +2 -0
- package/dist/catalog/storage/google-drive-action/index.js +38 -0
- package/dist/catalog/storage/json-action/index.d.ts +2 -0
- package/dist/catalog/storage/json-action/index.js +31 -0
- package/dist/catalog/storage/onedrive-action/index.d.ts +2 -0
- package/dist/catalog/storage/onedrive-action/index.js +33 -0
- package/dist/catalog/storage/s3-action/index.d.ts +2 -0
- package/dist/catalog/storage/s3-action/index.js +36 -0
- package/dist/catalog/storage/storage-action/index.d.ts +13 -0
- package/dist/catalog/storage/storage-action/index.js +72 -0
- package/dist/catalog/storage/storageCapabilities.d.ts +57 -0
- package/dist/catalog/storage/storageCapabilities.js +207 -0
- package/dist/catalog/storage/xml-action/index.d.ts +2 -0
- package/dist/catalog/storage/xml-action/index.js +31 -0
- package/dist/catalog/transforms/format/config.d.ts +23 -0
- package/dist/catalog/transforms/format/config.js +19 -0
- package/dist/catalog/transforms/format/index.d.ts +5 -0
- package/dist/catalog/transforms/format/index.js +39 -0
- package/dist/catalog/triggers/connector-trigger/index.d.ts +7 -0
- package/dist/catalog/triggers/connector-trigger/index.js +72 -0
- package/dist/catalog/triggers/manual-trigger/config.d.ts +40 -0
- package/dist/catalog/triggers/manual-trigger/config.js +60 -0
- package/dist/catalog/triggers/manual-trigger/index.d.ts +10 -0
- package/dist/catalog/triggers/manual-trigger/index.js +74 -0
- package/dist/catalog/triggers/schedule-trigger/config.d.ts +42 -0
- package/dist/catalog/triggers/schedule-trigger/config.js +42 -0
- package/dist/catalog/triggers/schedule-trigger/index.d.ts +7 -0
- package/dist/catalog/triggers/schedule-trigger/index.js +102 -0
- package/dist/catalog/triggers/webhook-trigger/config.d.ts +31 -0
- package/dist/catalog/triggers/webhook-trigger/config.js +27 -0
- package/dist/catalog/triggers/webhook-trigger/index.d.ts +7 -0
- package/dist/catalog/triggers/webhook-trigger/index.js +89 -0
- package/dist/catalog/types.d.ts +360 -0
- package/dist/catalog/types.js +135 -0
- package/dist/catalog/utility/debug/config.d.ts +72 -0
- package/dist/catalog/utility/debug/config.js +90 -0
- package/dist/catalog/utility/debug/index.d.ts +11 -0
- package/dist/catalog/utility/debug/index.js +38 -0
- package/dist/catalog/utility/error/config.d.ts +26 -0
- package/dist/catalog/utility/error/config.js +25 -0
- package/dist/catalog/utility/error/index.d.ts +7 -0
- package/dist/catalog/utility/error/index.js +46 -0
- package/dist/catalog/utility/variables/config.d.ts +76 -0
- package/dist/catalog/utility/variables/config.js +70 -0
- package/dist/catalog/utility/variables/index.d.ts +13 -0
- package/dist/catalog/utility/variables/index.js +40 -0
- package/dist/catalog/workflow.d.ts +308 -0
- package/dist/catalog/workflow.js +25 -0
- package/dist/ids.d.ts +31 -0
- package/dist/ids.js +53 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +28 -0
- package/dist/rules/nodeConfigStatus.d.ts +33 -0
- package/dist/rules/nodeConfigStatus.js +217 -0
- package/dist/rules/workflowValidator.d.ts +53 -0
- package/dist/rules/workflowValidator.js +358 -0
- package/package.json +41 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { ActionDefinition } from './types';
|
|
2
|
+
export interface Position {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}
|
|
6
|
+
export interface Dimensions {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
export interface Bounds {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}
|
|
16
|
+
export declare enum NodeStatus {
|
|
17
|
+
Idle = "idle",
|
|
18
|
+
Running = "running",
|
|
19
|
+
Success = "success",
|
|
20
|
+
Error = "error",
|
|
21
|
+
Warning = "warning",
|
|
22
|
+
Disabled = "disabled"
|
|
23
|
+
}
|
|
24
|
+
export interface NodePort {
|
|
25
|
+
id: string;
|
|
26
|
+
type: 'input' | 'output';
|
|
27
|
+
position: 'top' | 'right' | 'bottom' | 'left';
|
|
28
|
+
label?: string;
|
|
29
|
+
connected: boolean;
|
|
30
|
+
maxConnections?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface DataSchema {
|
|
33
|
+
type: 'object' | 'array' | 'string' | 'number' | 'boolean' | 'null';
|
|
34
|
+
properties?: Record<string, DataSchema>;
|
|
35
|
+
items?: DataSchema;
|
|
36
|
+
required?: string[];
|
|
37
|
+
description?: string;
|
|
38
|
+
example?: unknown;
|
|
39
|
+
/**
|
|
40
|
+
* Iterable list marker. When set on an array, the Field Mapper treats
|
|
41
|
+
* the node as expandable regardless of whether items.properties are
|
|
42
|
+
* known — covering empty-sample and primitive-item arrays the user
|
|
43
|
+
* still wants to loop over (legacy `loopable` semantics).
|
|
44
|
+
*/
|
|
45
|
+
loopable?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface WorkflowNode {
|
|
48
|
+
id: string;
|
|
49
|
+
type: 'action' | 'trigger' | 'condition' | 'transform' | 'group' | 'forEach';
|
|
50
|
+
actionDefinitionId: string;
|
|
51
|
+
actionDefinition?: ActionDefinition;
|
|
52
|
+
name?: string;
|
|
53
|
+
label: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
icon?: string;
|
|
56
|
+
color?: string;
|
|
57
|
+
position: Position;
|
|
58
|
+
dimensions?: Dimensions;
|
|
59
|
+
parentId?: string;
|
|
60
|
+
extent?: 'parent';
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
config: Record<string, unknown>;
|
|
63
|
+
configStatus?: 'valid' | 'warning' | 'error' | 'unconfigured' | 'hidden';
|
|
64
|
+
ports: {
|
|
65
|
+
input: NodePort[];
|
|
66
|
+
output: NodePort[];
|
|
67
|
+
};
|
|
68
|
+
inputSchema?: DataSchema;
|
|
69
|
+
outputSchema?: DataSchema;
|
|
70
|
+
status: NodeStatus;
|
|
71
|
+
selected: boolean;
|
|
72
|
+
dragging: boolean;
|
|
73
|
+
isValid: boolean;
|
|
74
|
+
validationErrors?: string[];
|
|
75
|
+
expanded: boolean;
|
|
76
|
+
minimized: boolean;
|
|
77
|
+
locked: boolean;
|
|
78
|
+
executionData?: {
|
|
79
|
+
lastRun?: string;
|
|
80
|
+
duration?: number;
|
|
81
|
+
output?: unknown;
|
|
82
|
+
error?: string;
|
|
83
|
+
};
|
|
84
|
+
createdAt: string;
|
|
85
|
+
updatedAt: string;
|
|
86
|
+
notes?: string;
|
|
87
|
+
}
|
|
88
|
+
export declare enum EdgeType {
|
|
89
|
+
Default = "default",
|
|
90
|
+
Conditional = "conditional",
|
|
91
|
+
Loop = "loop",
|
|
92
|
+
Error = "error"
|
|
93
|
+
}
|
|
94
|
+
export interface EdgeStyle {
|
|
95
|
+
stroke?: string;
|
|
96
|
+
strokeWidth?: number;
|
|
97
|
+
strokeDasharray?: string;
|
|
98
|
+
animated?: boolean;
|
|
99
|
+
}
|
|
100
|
+
export interface WorkflowEdge {
|
|
101
|
+
id: string;
|
|
102
|
+
type: EdgeType;
|
|
103
|
+
source: string;
|
|
104
|
+
sourcePort: string;
|
|
105
|
+
target: string;
|
|
106
|
+
targetPort: string;
|
|
107
|
+
style?: EdgeStyle;
|
|
108
|
+
label?: string;
|
|
109
|
+
condition?: string;
|
|
110
|
+
selected: boolean;
|
|
111
|
+
animated: boolean;
|
|
112
|
+
createdAt: string;
|
|
113
|
+
}
|
|
114
|
+
export interface CanvasViewport {
|
|
115
|
+
x: number;
|
|
116
|
+
y: number;
|
|
117
|
+
zoom: number;
|
|
118
|
+
}
|
|
119
|
+
export interface CanvasSettings {
|
|
120
|
+
snapToGrid: boolean;
|
|
121
|
+
gridSize: number;
|
|
122
|
+
showGrid: boolean;
|
|
123
|
+
showMinimap: boolean;
|
|
124
|
+
autoLayout: boolean;
|
|
125
|
+
useAdvancedLayout: boolean;
|
|
126
|
+
theme: 'light' | 'dark';
|
|
127
|
+
}
|
|
128
|
+
export interface WorkflowCanvasState {
|
|
129
|
+
nodes: WorkflowNode[];
|
|
130
|
+
edges: WorkflowEdge[];
|
|
131
|
+
viewport: CanvasViewport;
|
|
132
|
+
selectedNodes: string[];
|
|
133
|
+
selectedEdges: string[];
|
|
134
|
+
isDragging: boolean;
|
|
135
|
+
isPanning: boolean;
|
|
136
|
+
isConnecting: boolean;
|
|
137
|
+
connectingFrom?: {
|
|
138
|
+
nodeId: string;
|
|
139
|
+
portId: string;
|
|
140
|
+
portType: 'input' | 'output';
|
|
141
|
+
};
|
|
142
|
+
settings: CanvasSettings;
|
|
143
|
+
history: {
|
|
144
|
+
past: WorkflowCanvasState[];
|
|
145
|
+
future: WorkflowCanvasState[];
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export type WorkflowAction = {
|
|
149
|
+
type: 'ADD_NODE';
|
|
150
|
+
payload: WorkflowNode;
|
|
151
|
+
} | {
|
|
152
|
+
type: 'UPDATE_NODE';
|
|
153
|
+
payload: {
|
|
154
|
+
id: string;
|
|
155
|
+
updates: Partial<WorkflowNode>;
|
|
156
|
+
};
|
|
157
|
+
} | {
|
|
158
|
+
type: 'DELETE_NODE';
|
|
159
|
+
payload: string;
|
|
160
|
+
} | {
|
|
161
|
+
type: 'DELETE_NODES';
|
|
162
|
+
payload: string[];
|
|
163
|
+
} | {
|
|
164
|
+
type: 'ADD_EDGE';
|
|
165
|
+
payload: WorkflowEdge;
|
|
166
|
+
} | {
|
|
167
|
+
type: 'DELETE_EDGE';
|
|
168
|
+
payload: string;
|
|
169
|
+
} | {
|
|
170
|
+
type: 'DELETE_EDGES';
|
|
171
|
+
payload: string[];
|
|
172
|
+
} | {
|
|
173
|
+
type: 'SELECT_NODE';
|
|
174
|
+
payload: string;
|
|
175
|
+
} | {
|
|
176
|
+
type: 'SELECT_NODES';
|
|
177
|
+
payload: string[];
|
|
178
|
+
} | {
|
|
179
|
+
type: 'SELECT_EDGE';
|
|
180
|
+
payload: string;
|
|
181
|
+
} | {
|
|
182
|
+
type: 'DESELECT_ALL';
|
|
183
|
+
} | {
|
|
184
|
+
type: 'UPDATE_VIEWPORT';
|
|
185
|
+
payload: Partial<CanvasViewport>;
|
|
186
|
+
} | {
|
|
187
|
+
type: 'UPDATE_SETTINGS';
|
|
188
|
+
payload: Partial<CanvasSettings>;
|
|
189
|
+
} | {
|
|
190
|
+
type: 'START_CONNECTING';
|
|
191
|
+
payload: {
|
|
192
|
+
nodeId: string;
|
|
193
|
+
portId: string;
|
|
194
|
+
portType: 'input' | 'output';
|
|
195
|
+
};
|
|
196
|
+
} | {
|
|
197
|
+
type: 'END_CONNECTING';
|
|
198
|
+
} | {
|
|
199
|
+
type: 'UNDO';
|
|
200
|
+
} | {
|
|
201
|
+
type: 'REDO';
|
|
202
|
+
} | {
|
|
203
|
+
type: 'RESET';
|
|
204
|
+
};
|
|
205
|
+
export interface DraggedAction {
|
|
206
|
+
actionDefinition: ActionDefinition;
|
|
207
|
+
type: 'action';
|
|
208
|
+
}
|
|
209
|
+
export interface DropPosition {
|
|
210
|
+
x: number;
|
|
211
|
+
y: number;
|
|
212
|
+
canvasX: number;
|
|
213
|
+
canvasY: number;
|
|
214
|
+
}
|
|
215
|
+
export interface LayoutOptions {
|
|
216
|
+
algorithm: 'dagre' | 'elk' | 'manual';
|
|
217
|
+
direction: 'TB' | 'BT' | 'LR' | 'RL';
|
|
218
|
+
spacing: {
|
|
219
|
+
node: number;
|
|
220
|
+
rank: number;
|
|
221
|
+
};
|
|
222
|
+
align?: 'UL' | 'UR' | 'DL' | 'DR';
|
|
223
|
+
}
|
|
224
|
+
export interface ValidationResult {
|
|
225
|
+
isValid: boolean;
|
|
226
|
+
errors: ValidationIssue[];
|
|
227
|
+
warnings: ValidationIssue[];
|
|
228
|
+
}
|
|
229
|
+
export interface ValidationIssue {
|
|
230
|
+
/** Stable identity for the issue (rule + anchor) — list keys, dedupe. */
|
|
231
|
+
id: string;
|
|
232
|
+
type: 'node' | 'edge' | 'workflow';
|
|
233
|
+
severity: 'error' | 'warning';
|
|
234
|
+
message: string;
|
|
235
|
+
nodeId?: string;
|
|
236
|
+
edgeId?: string;
|
|
237
|
+
}
|
|
238
|
+
/** Back-compat aliases (same shape since DEV-220). */
|
|
239
|
+
export type ValidationError = ValidationIssue;
|
|
240
|
+
export type ValidationWarning = ValidationIssue;
|
|
241
|
+
export interface ExecutionState {
|
|
242
|
+
status: 'idle' | 'running' | 'paused' | 'completed' | 'failed';
|
|
243
|
+
startedAt?: string;
|
|
244
|
+
completedAt?: string;
|
|
245
|
+
currentNodeId?: string;
|
|
246
|
+
nodeStates: Record<string, NodeExecutionState>;
|
|
247
|
+
}
|
|
248
|
+
export interface NodeExecutionState {
|
|
249
|
+
status: 'pending' | 'running' | 'success' | 'error' | 'skipped';
|
|
250
|
+
startedAt?: string;
|
|
251
|
+
completedAt?: string;
|
|
252
|
+
duration?: number;
|
|
253
|
+
input?: unknown;
|
|
254
|
+
output?: unknown;
|
|
255
|
+
error?: string;
|
|
256
|
+
logs?: string[];
|
|
257
|
+
}
|
|
258
|
+
export interface WorkflowMetadata {
|
|
259
|
+
id: string;
|
|
260
|
+
name: string;
|
|
261
|
+
description?: string;
|
|
262
|
+
projectId: string;
|
|
263
|
+
version: string;
|
|
264
|
+
status: 'draft' | 'active' | 'paused' | 'archived';
|
|
265
|
+
createdAt: string;
|
|
266
|
+
updatedAt: string;
|
|
267
|
+
createdBy: string;
|
|
268
|
+
tags: string[];
|
|
269
|
+
}
|
|
270
|
+
export interface Workflow {
|
|
271
|
+
metadata: WorkflowMetadata;
|
|
272
|
+
canvas: WorkflowCanvasState;
|
|
273
|
+
policies: import('./policies').WorkflowPolicies;
|
|
274
|
+
validation: ValidationResult;
|
|
275
|
+
execution?: ExecutionState;
|
|
276
|
+
}
|
|
277
|
+
export interface WorkflowContextValue {
|
|
278
|
+
workflow: Workflow;
|
|
279
|
+
dispatch: (action: WorkflowAction) => void;
|
|
280
|
+
addNode: (actionDefinition: ActionDefinition, position: Position) => void;
|
|
281
|
+
updateNode: (id: string, updates: Partial<WorkflowNode>) => void;
|
|
282
|
+
deleteNode: (id: string) => void;
|
|
283
|
+
deleteNodes: (ids: string[]) => void;
|
|
284
|
+
addEdge: (source: string, sourcePort: string, target: string, targetPort: string) => void;
|
|
285
|
+
deleteEdge: (id: string) => void;
|
|
286
|
+
startConnecting: (nodeId: string, portId: string, portType: 'input' | 'output') => void;
|
|
287
|
+
endConnecting: () => void;
|
|
288
|
+
selectNode: (id: string, multi?: boolean) => void;
|
|
289
|
+
selectEdge: (id: string) => void;
|
|
290
|
+
deselectAll: () => void;
|
|
291
|
+
zoomIn: () => void;
|
|
292
|
+
zoomOut: () => void;
|
|
293
|
+
zoomToFit: () => void;
|
|
294
|
+
resetViewport: () => void;
|
|
295
|
+
undo: () => void;
|
|
296
|
+
redo: () => void;
|
|
297
|
+
canUndo: boolean;
|
|
298
|
+
canRedo: boolean;
|
|
299
|
+
validate: () => ValidationResult;
|
|
300
|
+
executeWorkflow: () => Promise<void>;
|
|
301
|
+
stopExecution: () => void;
|
|
302
|
+
}
|
|
303
|
+
export type NodeMap = Map<string, WorkflowNode>;
|
|
304
|
+
export type EdgeMap = Map<string, WorkflowEdge>;
|
|
305
|
+
export interface ConnectionValidation {
|
|
306
|
+
valid: boolean;
|
|
307
|
+
reason?: string;
|
|
308
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// ============================================
|
|
2
|
+
// workflow.d.ts - Workflow Canvas Type Definitions
|
|
3
|
+
// ============================================
|
|
4
|
+
// ============================================
|
|
5
|
+
// WORKFLOW NODE
|
|
6
|
+
// ============================================
|
|
7
|
+
export var NodeStatus;
|
|
8
|
+
(function (NodeStatus) {
|
|
9
|
+
NodeStatus["Idle"] = "idle";
|
|
10
|
+
NodeStatus["Running"] = "running";
|
|
11
|
+
NodeStatus["Success"] = "success";
|
|
12
|
+
NodeStatus["Error"] = "error";
|
|
13
|
+
NodeStatus["Warning"] = "warning";
|
|
14
|
+
NodeStatus["Disabled"] = "disabled";
|
|
15
|
+
})(NodeStatus || (NodeStatus = {}));
|
|
16
|
+
// ============================================
|
|
17
|
+
// WORKFLOW EDGE (CONNECTION)
|
|
18
|
+
// ============================================
|
|
19
|
+
export var EdgeType;
|
|
20
|
+
(function (EdgeType) {
|
|
21
|
+
EdgeType["Default"] = "default";
|
|
22
|
+
EdgeType["Conditional"] = "conditional";
|
|
23
|
+
EdgeType["Loop"] = "loop";
|
|
24
|
+
EdgeType["Error"] = "error";
|
|
25
|
+
})(EdgeType || (EdgeType = {}));
|
package/dist/ids.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ID Generator Utilities
|
|
3
|
+
*
|
|
4
|
+
* All randomness comes from the Web Crypto API (`crypto.getRandomValues`),
|
|
5
|
+
* which is available in every browser and as a Node global (≥18), so these
|
|
6
|
+
* helpers work both client- and server-side. Using crypto instead of
|
|
7
|
+
* `Math.random()` also clears the weak-PRNG security hotspot. These IDs are
|
|
8
|
+
* NOT secrets — crypto is used for collision resistance, not unpredictability.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Cryptographically-strong short token: `length` base36 chars (0-9a-z).
|
|
12
|
+
* Drop-in replacement for the old `Math.random().toString(36).slice(2, 2+n)`
|
|
13
|
+
* pattern — same character set and length, collision-resistant source.
|
|
14
|
+
*/
|
|
15
|
+
export declare function randomSuffix(length?: number): string;
|
|
16
|
+
/**
|
|
17
|
+
* Generate a UUID v4 string using the Web Crypto API.
|
|
18
|
+
*/
|
|
19
|
+
export declare function generateUUIDv4(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Generate a workflow ID using UUID v4
|
|
22
|
+
*/
|
|
23
|
+
export declare function generateWorkflowId(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Generate a step/node ID with prefix for clarity
|
|
26
|
+
*/
|
|
27
|
+
export declare function generateStepId(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Generate an edge/connection ID with prefix for clarity
|
|
30
|
+
*/
|
|
31
|
+
export declare function generateEdgeId(sourceId: string, targetId: string): string;
|
package/dist/ids.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ID Generator Utilities
|
|
3
|
+
*
|
|
4
|
+
* All randomness comes from the Web Crypto API (`crypto.getRandomValues`),
|
|
5
|
+
* which is available in every browser and as a Node global (≥18), so these
|
|
6
|
+
* helpers work both client- and server-side. Using crypto instead of
|
|
7
|
+
* `Math.random()` also clears the weak-PRNG security hotspot. These IDs are
|
|
8
|
+
* NOT secrets — crypto is used for collision resistance, not unpredictability.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Cryptographically-strong short token: `length` base36 chars (0-9a-z).
|
|
12
|
+
* Drop-in replacement for the old `Math.random().toString(36).slice(2, 2+n)`
|
|
13
|
+
* pattern — same character set and length, collision-resistant source.
|
|
14
|
+
*/
|
|
15
|
+
export function randomSuffix(length = 7) {
|
|
16
|
+
const bytes = new Uint8Array(length);
|
|
17
|
+
crypto.getRandomValues(bytes);
|
|
18
|
+
let out = '';
|
|
19
|
+
for (let i = 0; i < length; i++) {
|
|
20
|
+
out += (bytes[i] % 36).toString(36);
|
|
21
|
+
}
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Generate a UUID v4 string using the Web Crypto API.
|
|
26
|
+
*/
|
|
27
|
+
export function generateUUIDv4() {
|
|
28
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
29
|
+
const r = crypto.getRandomValues(new Uint8Array(1))[0] % 16;
|
|
30
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
31
|
+
return v.toString(16);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Generate a workflow ID using UUID v4
|
|
36
|
+
*/
|
|
37
|
+
export function generateWorkflowId() {
|
|
38
|
+
return generateUUIDv4();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Generate a step/node ID with prefix for clarity
|
|
42
|
+
*/
|
|
43
|
+
export function generateStepId() {
|
|
44
|
+
return `node_${Date.now()}_${randomSuffix(7)}`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Generate an edge/connection ID with prefix for clarity
|
|
48
|
+
*/
|
|
49
|
+
export function generateEdgeId(sourceId, targetId) {
|
|
50
|
+
// Random suffix (same pattern as generateStepId) guarantees uniqueness even for
|
|
51
|
+
// two calls in the same millisecond with identical source/target.
|
|
52
|
+
return `edge_${sourceId}_${targetId}_${Date.now()}_${randomSuffix(7)}`;
|
|
53
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @octaviaflow/flow-rules
|
|
3
|
+
*
|
|
4
|
+
* One definition of what a flow action accepts, and one definition of what
|
|
5
|
+
* makes a flow valid.
|
|
6
|
+
*
|
|
7
|
+
* Both lived in `octaviaflow-ui` and were therefore reachable only from a
|
|
8
|
+
* browser. That was fine while the editor was the only thing building flows.
|
|
9
|
+
* It stopped being fine when an AI agent became a second author (DEV-391): an
|
|
10
|
+
* agent that cannot read an action's input schema guesses at the config, and
|
|
11
|
+
* an agent that cannot run the rules cannot tell whether what it built works.
|
|
12
|
+
*
|
|
13
|
+
* Copying either into Backend would have produced two rule sets that agree on
|
|
14
|
+
* the day they are written — the same failure mode as a duplicated permission
|
|
15
|
+
* predicate, and the copy that drifts would be the one the agent trusts. So
|
|
16
|
+
* they live here, and both the editor and the server import them.
|
|
17
|
+
*
|
|
18
|
+
* NO React, and no imports from either consumer. The config PANELS stay in
|
|
19
|
+
* octaviaflow-ui; this package is the data and the rules they are built on.
|
|
20
|
+
*/
|
|
21
|
+
export * from "./catalog/types";
|
|
22
|
+
export { actionsRegistry, getAllActions, getActionById, getActionsByCategory, } from "./catalog/index";
|
|
23
|
+
export { validateNode, validateEdge, validateWorkflow, getNodeValidationStatus, getEdgeValidationStatus, type ValidationError, type ValidationResult, } from "./rules/workflowValidator";
|
|
24
|
+
export { getNodeConfigStatus, type NodeConfigStatus, type NodeConfigStatusResult, } from "./rules/nodeConfigStatus";
|
|
25
|
+
export { generateWorkflowId, generateStepId, generateEdgeId, generateUUIDv4, } from "./ids";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @octaviaflow/flow-rules
|
|
3
|
+
*
|
|
4
|
+
* One definition of what a flow action accepts, and one definition of what
|
|
5
|
+
* makes a flow valid.
|
|
6
|
+
*
|
|
7
|
+
* Both lived in `octaviaflow-ui` and were therefore reachable only from a
|
|
8
|
+
* browser. That was fine while the editor was the only thing building flows.
|
|
9
|
+
* It stopped being fine when an AI agent became a second author (DEV-391): an
|
|
10
|
+
* agent that cannot read an action's input schema guesses at the config, and
|
|
11
|
+
* an agent that cannot run the rules cannot tell whether what it built works.
|
|
12
|
+
*
|
|
13
|
+
* Copying either into Backend would have produced two rule sets that agree on
|
|
14
|
+
* the day they are written — the same failure mode as a duplicated permission
|
|
15
|
+
* predicate, and the copy that drifts would be the one the agent trusts. So
|
|
16
|
+
* they live here, and both the editor and the server import them.
|
|
17
|
+
*
|
|
18
|
+
* NO React, and no imports from either consumer. The config PANELS stay in
|
|
19
|
+
* octaviaflow-ui; this package is the data and the rules they are built on.
|
|
20
|
+
*/
|
|
21
|
+
// ── The catalog: what an action is, and what it accepts ────────────────────
|
|
22
|
+
export * from "./catalog/types";
|
|
23
|
+
export { actionsRegistry, getAllActions, getActionById, getActionsByCategory, } from "./catalog/index";
|
|
24
|
+
// ── The rules: what makes a flow valid (Flow Doctor's verdict) ─────────────
|
|
25
|
+
export { validateNode, validateEdge, validateWorkflow, getNodeValidationStatus, getEdgeValidationStatus, } from "./rules/workflowValidator";
|
|
26
|
+
export { getNodeConfigStatus, } from "./rules/nodeConfigStatus";
|
|
27
|
+
// ── Ids, so a caller building a flow makes ones the editor recognises ──────
|
|
28
|
+
export { generateWorkflowId, generateStepId, generateEdgeId, generateUUIDv4, } from "./ids";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Config Status Utility
|
|
3
|
+
*
|
|
4
|
+
* Determines the status indicator for a workflow node based on
|
|
5
|
+
* how completely its configuration has been filled out relative
|
|
6
|
+
* to the action definition's input schema.
|
|
7
|
+
*
|
|
8
|
+
* Handles:
|
|
9
|
+
* - Nested config keys (e.g., "visualConfig.tables" → config.visualConfig.tables)
|
|
10
|
+
* - Conditional required fields (only enforced when their condition is met)
|
|
11
|
+
* - Default values (count as filled if present)
|
|
12
|
+
*/
|
|
13
|
+
import type { WorkflowNode } from '../catalog/workflow';
|
|
14
|
+
export type NodeConfigStatus = 'valid' | 'warning' | 'error' | 'unconfigured' | 'hidden';
|
|
15
|
+
export interface NodeConfigStatusResult {
|
|
16
|
+
status: NodeConfigStatus;
|
|
17
|
+
requiredTotal: number;
|
|
18
|
+
requiredFilled: number;
|
|
19
|
+
optionalTotal: number;
|
|
20
|
+
optionalFilled: number;
|
|
21
|
+
missingRequired: string[];
|
|
22
|
+
filledOptional: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Determine the config completeness status of a workflow node.
|
|
26
|
+
*
|
|
27
|
+
* Status logic:
|
|
28
|
+
* - "valid" → All active required fields are filled (or no required fields exist)
|
|
29
|
+
* - "warning" → Some active required fields are missing, but at least one field has data
|
|
30
|
+
* - "error" → Has active required fields and none are filled, config is empty
|
|
31
|
+
* - "unconfigured" → Action definition not found (unknown action type)
|
|
32
|
+
*/
|
|
33
|
+
export declare function getNodeConfigStatus(node: WorkflowNode): NodeConfigStatusResult;
|