@flowuent-org/diagramming-core 1.0.8 → 1.1.1

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 (40) hide show
  1. package/apps/diagramming/src/AutomationDiagramData.ts +22 -0
  2. package/apps/diagramming/src/components/AddNodeView.tsx +252 -252
  3. package/apps/diagramming/src/main.tsx +463 -463
  4. package/apps/diagramming/src/node-data.ts +664 -664
  5. package/apps/diagramming/src/stencil-items.ts +31 -31
  6. package/apps/diagramming/src/vite-env.d.ts +1 -1
  7. package/package.json +1 -1
  8. package/packages/diagrams/NODE_DATA_UPDATE_API.md +430 -430
  9. package/packages/diagrams/README.md +7 -463
  10. package/packages/diagrams/UNDO_REDO_API.md +306 -306
  11. package/packages/diagrams/package.json +27 -27
  12. package/packages/diagrams/project.json +42 -42
  13. package/packages/diagrams/rollup.config.js +26 -26
  14. package/packages/diagrams/src/DiagramFlow.tsx +7 -7
  15. package/packages/diagrams/src/index.ts +116 -116
  16. package/packages/diagrams/src/index.ts.bak +99 -99
  17. package/packages/diagrams/src/lib/atoms/CardEditableTitle.tsx +76 -76
  18. package/packages/diagrams/src/lib/atoms/ExpressionInput.tsx +437 -437
  19. package/packages/diagrams/src/lib/components/DiagramPanel.tsx +331 -331
  20. package/packages/diagrams/src/lib/components/automation/AISuggestionsModal.tsx +269 -0
  21. package/packages/diagrams/src/lib/components/automation/AISuggestionsPanel.tsx +227 -0
  22. package/packages/diagrams/src/lib/components/automation/AutomationAISuggestionNode.tsx +178 -115
  23. package/packages/diagrams/src/lib/components/automation/AutomationApiNode.tsx +133 -27
  24. package/packages/diagrams/src/lib/components/automation/AutomationEndNode.tsx +134 -28
  25. package/packages/diagrams/src/lib/components/automation/AutomationFormattingNode.tsx +132 -27
  26. package/packages/diagrams/src/lib/components/automation/AutomationNoteNode.tsx +124 -17
  27. package/packages/diagrams/src/lib/components/automation/AutomationSheetsNode.tsx +122 -15
  28. package/packages/diagrams/src/lib/components/automation/index.ts +3 -0
  29. package/packages/diagrams/src/lib/contexts/onWorkflowNodeDelete.ts +65 -65
  30. package/packages/diagrams/src/lib/organisms/CustomEdge/useCreateBendPoint.tsx +121 -121
  31. package/packages/diagrams/src/lib/organisms/WorkFlowNode/NodeActionButtons.tsx +45 -45
  32. package/packages/diagrams/src/lib/templates/node-forms/CallForm.tsx +370 -370
  33. package/packages/diagrams/src/lib/templates/systemFlow/components/FloatingEdge.tsx +219 -219
  34. package/packages/diagrams/src/lib/types/card-node.ts +68 -68
  35. package/packages/diagrams/src/lib/types/node-types.ts +29 -29
  36. package/packages/diagrams/src/lib/utils/AutomationExecutionEngine.ts +1179 -1179
  37. package/packages/diagrams/tsconfig.lib.json +25 -25
  38. package/tsconfig.base.json +29 -30
  39. package/TRANSLATION_FIX_SUMMARY.md +0 -118
  40. package/packages/diagrams/I18N_SETUP.md +0 -126
@@ -1,664 +1,664 @@
1
- import { v4 as uuidv4 } from 'uuid';
2
- import { Edge, MarkerType } from '@xyflow/react';
3
- import { ICardNode } from '@flowuent-labs/diagrams';
4
-
5
- const nodeColors = {
6
- blue: 'rgba(100, 181, 246, 0.6)',
7
- green: 'rgba(76, 175, 80, 0.6)',
8
- orange: 'rgba(255, 152, 0, 0.6)',
9
- purple: 'rgba(156, 39, 176, 0.6)',
10
- pink: 'rgba(240, 98, 146, 0.6)',
11
- };
12
-
13
- export const classDefaultEdges: Edge[] = [
14
- {
15
- id: 'edge1',
16
- source: 'parentId',
17
- target: 'child1Id',
18
- type: 'default',
19
- },
20
- {
21
- id: 'edge2',
22
- source: 'parentId',
23
- target: 'child2Id',
24
- type: 'default',
25
- },
26
- {
27
- id: 'edge3',
28
- source: 'parentId',
29
- target: 'posts',
30
- type: 'default',
31
- },
32
- {
33
- id: 'edge4',
34
- source: 'posts',
35
- target: 'comments',
36
- type: 'default',
37
- },
38
- {
39
- id: 'edge5',
40
- source: 'parentId',
41
- target: 'notifications',
42
- type: 'default',
43
- },
44
- ];
45
-
46
- export const classDefaultNodes: ICardNode[] = [
47
- {
48
- id: 'parentId',
49
- type: 'entity',
50
- position: { x: 0, y: 0 },
51
- data: {
52
- isBlock: true,
53
- nodeId: 'parentId',
54
- color: 'red',
55
- title: 'User',
56
- blocks: [
57
- { color: 'red', id: uuidv4(), title: 'firstname', type: 'String' },
58
- { color: 'red', id: uuidv4(), title: 'lastname', type: 'String' },
59
- { color: 'red', id: uuidv4(), title: 'age', type: 'Number' },
60
- { color: 'red', id: uuidv4(), title: 'birthdate', type: 'Date' },
61
- { color: 'red', id: uuidv4(), title: 'email', type: 'String' },
62
- { color: 'red', id: uuidv4(), title: 'password', type: 'String' },
63
- ],
64
- },
65
- },
66
- {
67
- id: 'child1Id',
68
- type: 'entity',
69
- position: { x: 50, y: 500 },
70
- data: {
71
- isBlock: true,
72
- nodeId: 'child1Id',
73
- color: 'green',
74
- title: 'Profile',
75
- blocks: [
76
- { color: 'red', id: uuidv4(), title: 'bio', type: 'String' },
77
- { color: 'red', id: uuidv4(), title: 'avatar', type: 'String' },
78
- { color: 'red', id: uuidv4(), title: 'socialLinks', type: 'Array' },
79
- { color: 'red', id: uuidv4(), title: 'location', type: 'String' },
80
- ],
81
- },
82
- },
83
- {
84
- id: 'child2Id',
85
- type: 'entity',
86
- position: { x: 350, y: 250 },
87
- data: {
88
- isBlock: true,
89
- nodeId: 'child2Id',
90
- color: 'green',
91
- title: 'Authentication',
92
- blocks: [
93
- { color: 'red', id: uuidv4(), title: 'token', type: 'String' },
94
- { color: 'red', id: uuidv4(), title: 'refreshToken', type: 'String' },
95
- { color: 'red', id: uuidv4(), title: 'expiresAt', type: 'Date' },
96
- { color: 'red', id: uuidv4(), title: 'lastLogin', type: 'Date' },
97
- ],
98
- },
99
- },
100
- {
101
- id: 'posts',
102
- type: 'entity',
103
- position: { x: -300, y: 250 },
104
- data: {
105
- isBlock: true,
106
- nodeId: 'posts',
107
- color: 'blue',
108
- title: 'Post',
109
- blocks: [
110
- { color: 'red', id: uuidv4(), title: 'title', type: 'String' },
111
- { color: 'red', id: uuidv4(), title: 'content', type: 'String' },
112
- { color: 'red', id: uuidv4(), title: 'createdAt', type: 'Date' },
113
- { color: 'red', id: uuidv4(), title: 'updatedAt', type: 'Date' },
114
- { color: 'red', id: uuidv4(), title: 'tags', type: 'Array' },
115
- ],
116
- },
117
- },
118
- {
119
- id: 'comments',
120
- type: 'entity',
121
- position: { x: -300, y: 500 },
122
- data: {
123
- isBlock: true,
124
- nodeId: 'comments',
125
- color: 'purple',
126
- title: 'Comment',
127
- blocks: [
128
- { color: 'red', id: uuidv4(), title: 'content', type: 'String' },
129
- { color: 'red', id: uuidv4(), title: 'createdAt', type: 'Date' },
130
- { color: 'red', id: uuidv4(), title: 'likes', type: 'Number' },
131
- ],
132
- },
133
- },
134
- {
135
- id: 'notifications',
136
- type: 'entity',
137
- position: { x: 350, y: 500 },
138
- data: {
139
- isBlock: true,
140
- nodeId: 'notifications',
141
- color: 'orange',
142
- title: 'Notification',
143
- blocks: [
144
- { color: 'red', id: uuidv4(), title: 'type', type: 'String' },
145
- { color: 'red', id: uuidv4(), title: 'message', type: 'String' },
146
- { color: 'red', id: uuidv4(), title: 'isRead', type: 'Boolean' },
147
- { color: 'red', id: uuidv4(), title: 'createdAt', type: 'Date' },
148
- ],
149
- },
150
- },
151
- ];
152
-
153
- export const workflowDefaultNodesAndEdges = {
154
- nodes: [
155
- {
156
- id: 'workflow-node-main-function',
157
- type: 'workflow',
158
- position: {
159
- x: 1004,
160
- y: 200,
161
- },
162
- draggable: false,
163
- data: {
164
- formData: {
165
- type: 'function',
166
- parameters: [{ name: 'limit', type: 'number' }],
167
- name: 'categorizeNumbers',
168
- body: [],
169
- },
170
- title: 'workflow',
171
- type: 'function',
172
- nodeId: 'workflow-node-main-function',
173
- isPinned: false,
174
- isBlock: false,
175
- blocks: [],
176
- parallelChildrenCount: 0,
177
- conditions: {
178
- combinator: 'and',
179
- rules: [],
180
- },
181
- },
182
- style: {
183
- width: 336,
184
- height: 316.46875,
185
- },
186
- width: 336,
187
- height: 316.46875,
188
- selected: false,
189
- },
190
- {
191
- id: 'workflow-node-api-call',
192
- type: 'workflow',
193
- position: {
194
- x: 1400,
195
- y: 200,
196
- },
197
- draggable: false,
198
- data: {
199
- formData: {
200
- type: 'api',
201
- method: 'GET',
202
- url: 'https://jsonplaceholder.typicode.com/posts',
203
- headers: [
204
- { key: 'Content-Type', value: 'application/json', enabled: true },
205
- {
206
- key: 'Authorization',
207
- value: 'Bearer your-token-here',
208
- enabled: false,
209
- },
210
- { key: 'Accept', value: 'application/json', enabled: true },
211
- ],
212
- queryParams: [
213
- { key: 'limit', value: '10', enabled: true },
214
- { key: 'page', value: '1', enabled: true },
215
- { key: 'sort', value: 'desc', enabled: false },
216
- ],
217
- body: '',
218
- bodyType: 'json',
219
- responseVariable: 'postsData',
220
- responseDataType: 'Array',
221
- },
222
- title: 'Fetch Posts API',
223
- type: 'api',
224
- nodeId: 'workflow-node-api-call',
225
- isPinned: false,
226
- isBlock: false,
227
- blocks: [],
228
- parallelChildrenCount: 0,
229
- conditions: {
230
- combinator: 'and',
231
- rules: [],
232
- },
233
- },
234
- style: {
235
- width: 336,
236
- height: 400,
237
- },
238
- width: 336,
239
- height: 400,
240
- selected: false,
241
- },
242
- {
243
- id: 'workflow-node-post-api',
244
- type: 'workflow',
245
- position: {
246
- x: 1800,
247
- y: 200,
248
- },
249
- draggable: false,
250
- data: {
251
- formData: {
252
- type: 'api',
253
- method: 'POST',
254
- url: 'https://jsonplaceholder.typicode.com/posts',
255
- headers: [
256
- { key: 'Content-Type', value: 'application/json', enabled: true },
257
- {
258
- key: 'Authorization',
259
- value: 'Bearer your-token-here',
260
- enabled: true,
261
- },
262
- { key: 'Accept', value: 'application/json', enabled: true },
263
- ],
264
- queryParams: [],
265
- body: '{\n "title": "New Post",\n "body": "This is the content of the new post",\n "userId": 1\n}',
266
- bodyType: 'json',
267
- responseVariable: 'newPost',
268
- responseDataType: 'Object',
269
- },
270
- title: 'Create Post API',
271
- type: 'api',
272
- nodeId: 'workflow-node-post-api',
273
- isPinned: false,
274
- isBlock: false,
275
- blocks: [],
276
- parallelChildrenCount: 0,
277
- conditions: {
278
- combinator: 'and',
279
- rules: [],
280
- },
281
- },
282
- style: {
283
- width: 336,
284
- height: 400,
285
- },
286
- width: 336,
287
- height: 400,
288
- selected: false,
289
- },
290
- {
291
- id: 'workflow-node-put-api',
292
- type: 'workflow',
293
- position: {
294
- x: 2200,
295
- y: 200,
296
- },
297
- draggable: false,
298
- data: {
299
- formData: {
300
- type: 'api',
301
- method: 'PUT',
302
- url: 'https://jsonplaceholder.typicode.com/posts/1',
303
- headers: [
304
- { key: 'Content-Type', value: 'application/json', enabled: true },
305
- {
306
- key: 'Authorization',
307
- value: 'Bearer your-token-here',
308
- enabled: true,
309
- },
310
- { key: 'Accept', value: 'application/json', enabled: true },
311
- ],
312
- queryParams: [],
313
- body: '{\n "id": 1,\n "title": "Updated Post",\n "body": "This is the updated content of the post",\n "userId": 1\n}',
314
- bodyType: 'json',
315
- responseVariable: 'updatedPost',
316
- responseDataType: 'Object',
317
- },
318
- title: 'Update Post API',
319
- type: 'api',
320
- nodeId: 'workflow-node-put-api',
321
- isPinned: false,
322
- isBlock: false,
323
- blocks: [],
324
- parallelChildrenCount: 0,
325
- conditions: {
326
- combinator: 'and',
327
- rules: [],
328
- },
329
- },
330
- style: {
331
- width: 336,
332
- height: 400,
333
- },
334
- width: 336,
335
- height: 400,
336
- selected: false,
337
- },
338
- {
339
- id: 'workflow-node-patch-api',
340
- type: 'workflow',
341
- position: {
342
- x: 2600,
343
- y: 200,
344
- },
345
- draggable: false,
346
- data: {
347
- formData: {
348
- type: 'api',
349
- method: 'PATCH',
350
- url: 'https://jsonplaceholder.typicode.com/posts/1',
351
- headers: [
352
- { key: 'Content-Type', value: 'application/json', enabled: true },
353
- {
354
- key: 'Authorization',
355
- value: 'Bearer your-token-here',
356
- enabled: true,
357
- },
358
- { key: 'Accept', value: 'application/json', enabled: true },
359
- ],
360
- queryParams: [],
361
- body: '{\n "title": "Partially Updated Post"\n}',
362
- bodyType: 'json',
363
- responseVariable: 'patchedPost',
364
- responseDataType: 'Object',
365
- },
366
- title: 'Patch Post API',
367
- type: 'api',
368
- nodeId: 'workflow-node-patch-api',
369
- isPinned: false,
370
- isBlock: false,
371
- blocks: [],
372
- parallelChildrenCount: 0,
373
- conditions: {
374
- combinator: 'and',
375
- rules: [],
376
- },
377
- },
378
- style: {
379
- width: 336,
380
- height: 400,
381
- },
382
- width: 336,
383
- height: 400,
384
- selected: false,
385
- },
386
- {
387
- id: 'workflow-node-delete-api',
388
- type: 'workflow',
389
- position: {
390
- x: 3000,
391
- y: 200,
392
- },
393
- draggable: false,
394
- data: {
395
- formData: {
396
- type: 'api',
397
- method: 'DELETE',
398
- url: 'https://jsonplaceholder.typicode.com/posts/1',
399
- headers: [
400
- { key: 'Content-Type', value: 'application/json', enabled: true },
401
- {
402
- key: 'Authorization',
403
- value: 'Bearer your-token-here',
404
- enabled: true,
405
- },
406
- { key: 'Accept', value: 'application/json', enabled: true },
407
- ],
408
- queryParams: [],
409
- body: '',
410
- bodyType: 'json',
411
- responseVariable: 'deleteResult',
412
- responseDataType: 'Object',
413
- },
414
- title: 'Delete Post API',
415
- type: 'api',
416
- nodeId: 'workflow-node-delete-api',
417
- isPinned: false,
418
- isBlock: false,
419
- blocks: [],
420
- parallelChildrenCount: 0,
421
- conditions: {
422
- combinator: 'and',
423
- rules: [],
424
- },
425
- },
426
- style: {
427
- width: 336,
428
- height: 400,
429
- },
430
- width: 336,
431
- height: 400,
432
- selected: false,
433
- },
434
- ],
435
- edges: [
436
- {
437
- id: 'edge-main-function-to-api-call',
438
- source: 'workflow-node-main-function',
439
- target: 'workflow-node-api-call',
440
- type: 'default',
441
- sourceHandle: 'workflow-node-main-function-bottom',
442
- markerEnd: {
443
- type: 'arrow',
444
- color: 'black',
445
- strokeWidth: 2,
446
- },
447
- },
448
- {
449
- id: 'edge-get-api-to-post-api',
450
- source: 'workflow-node-api-call',
451
- target: 'workflow-node-post-api',
452
- type: 'default',
453
- sourceHandle: 'workflow-node-api-call-bottom',
454
- markerEnd: {
455
- type: 'arrow',
456
- color: 'black',
457
- strokeWidth: 2,
458
- },
459
- },
460
- {
461
- id: 'edge-post-api-to-put-api',
462
- source: 'workflow-node-post-api',
463
- target: 'workflow-node-put-api',
464
- type: 'default',
465
- sourceHandle: 'workflow-node-post-api-bottom',
466
- markerEnd: {
467
- type: 'arrow',
468
- color: 'black',
469
- strokeWidth: 2,
470
- },
471
- },
472
- {
473
- id: 'edge-put-api-to-patch-api',
474
- source: 'workflow-node-put-api',
475
- target: 'workflow-node-patch-api',
476
- type: 'default',
477
- sourceHandle: 'workflow-node-put-api-bottom',
478
- markerEnd: {
479
- type: 'arrow',
480
- color: 'black',
481
- strokeWidth: 2,
482
- },
483
- },
484
- {
485
- id: 'edge-patch-api-to-delete-api',
486
- source: 'workflow-node-patch-api',
487
- target: 'workflow-node-delete-api',
488
- type: 'default',
489
- sourceHandle: 'workflow-node-patch-api-bottom',
490
- markerEnd: {
491
- type: 'arrow',
492
- color: 'black',
493
- strokeWidth: 2,
494
- },
495
- },
496
- ],
497
- };
498
-
499
- export const conditionBuilderData = {
500
- states: [
501
- {
502
- id: 1,
503
- label: 'personal_details',
504
- value: {
505
- lastName: 'Majid',
506
- firstName: 'Abdul',
507
- contactDetails: {
508
- email: 'a.majid1025@gmail.com',
509
- phone: '03040430789',
510
- address: {
511
- city: 'Lahore',
512
- street: '115 C-1 Nespak Society College Road',
513
- country: 'Pakistan',
514
- postalCode: '54700',
515
- },
516
- },
517
- },
518
- },
519
- ],
520
- envVar: [
521
- {
522
- id: 1,
523
- label: 'port',
524
- },
525
- ],
526
- };
527
-
528
- export const archNodes = [
529
- {
530
- id: 'gateway',
531
- type: 'serviceNode',
532
- position: { x: 400, y: 100 },
533
- data: {
534
- label: 'API Gateway',
535
- service: 'api-gateway',
536
- handles: ['bottom'],
537
- },
538
- style: {
539
- background: 'rgba(240, 98, 146, 0.6)',
540
- border: '1px solid #777',
541
- borderRadius: '8px',
542
- padding: '10px',
543
- width: 130,
544
- height: 40,
545
- zIndex: 2,
546
- },
547
- },
548
- {
549
- id: 'auth-service',
550
- type: 'serviceNode',
551
- position: { x: 200, y: 250 },
552
- data: {
553
- label: 'Auth Service',
554
- service: 'auth',
555
- handles: ['top', 'bottom'],
556
- },
557
- style: {
558
- background: 'rgba(100, 181, 246, 0.6)',
559
- border: '1px solid #777',
560
- borderRadius: '8px',
561
- padding: '10px',
562
- width: 130,
563
- height: 40,
564
- zIndex: 2,
565
- },
566
- },
567
- {
568
- id: 'user-service',
569
- type: 'serviceNode',
570
- position: { x: 400, y: 250 },
571
- data: {
572
- label: 'User Service',
573
- service: 'user',
574
- handles: ['top', 'bottom'],
575
- },
576
- style: {
577
- background: 'rgba(100, 181, 246, 0.6)',
578
- border: '1px solid #777',
579
- borderRadius: '8px',
580
- padding: '10px',
581
- width: 130,
582
- height: 40,
583
- zIndex: 2,
584
- },
585
- },
586
- {
587
- id: 'database',
588
- type: 'serviceNode',
589
- position: { x: 300, y: 400 },
590
- data: {
591
- label: 'Database',
592
- service: 'database',
593
- handles: ['top'],
594
- },
595
- style: {
596
- background: 'rgba(255, 183, 77, 0.6)',
597
- border: '1px solid #777',
598
- borderRadius: '8px',
599
- padding: '10px',
600
- width: 130,
601
- height: 40,
602
- zIndex: 2,
603
- },
604
- },
605
- ];
606
-
607
- export const archEdges = [
608
- {
609
- id: 'e1',
610
- source: 'gateway',
611
- target: 'auth-service',
612
- type: 'smoothstep',
613
- animated: false,
614
- style: { stroke: '#555', strokeWidth: 2 },
615
- markerEnd: {
616
- type: MarkerType.ArrowClosed,
617
- width: 20,
618
- height: 20,
619
- color: '#555',
620
- },
621
- },
622
- {
623
- id: 'e2',
624
- source: 'gateway',
625
- target: 'user-service',
626
- type: 'smoothstep',
627
- animated: false,
628
- style: { stroke: '#555', strokeWidth: 2 },
629
- markerEnd: {
630
- type: MarkerType.ArrowClosed,
631
- width: 20,
632
- height: 20,
633
- color: '#555',
634
- },
635
- },
636
- {
637
- id: 'e3',
638
- source: 'auth-service',
639
- target: 'database',
640
- type: 'smoothstep',
641
- animated: false,
642
- style: { stroke: '#555', strokeWidth: 2 },
643
- markerEnd: {
644
- type: MarkerType.ArrowClosed,
645
- width: 20,
646
- height: 20,
647
- color: '#555',
648
- },
649
- },
650
- {
651
- id: 'e4',
652
- source: 'user-service',
653
- target: 'database',
654
- type: 'smoothstep',
655
- animated: false,
656
- style: { stroke: '#555', strokeWidth: 2 },
657
- markerEnd: {
658
- type: MarkerType.ArrowClosed,
659
- width: 20,
660
- height: 20,
661
- color: '#555',
662
- },
663
- },
664
- ];
1
+ import { v4 as uuidv4 } from 'uuid';
2
+ import { Edge, MarkerType } from '@xyflow/react';
3
+ import { ICardNode } from '@flowuent-labs/diagrams';
4
+
5
+ const nodeColors = {
6
+ blue: 'rgba(100, 181, 246, 0.6)',
7
+ green: 'rgba(76, 175, 80, 0.6)',
8
+ orange: 'rgba(255, 152, 0, 0.6)',
9
+ purple: 'rgba(156, 39, 176, 0.6)',
10
+ pink: 'rgba(240, 98, 146, 0.6)',
11
+ };
12
+
13
+ export const classDefaultEdges: Edge[] = [
14
+ {
15
+ id: 'edge1',
16
+ source: 'parentId',
17
+ target: 'child1Id',
18
+ type: 'default',
19
+ },
20
+ {
21
+ id: 'edge2',
22
+ source: 'parentId',
23
+ target: 'child2Id',
24
+ type: 'default',
25
+ },
26
+ {
27
+ id: 'edge3',
28
+ source: 'parentId',
29
+ target: 'posts',
30
+ type: 'default',
31
+ },
32
+ {
33
+ id: 'edge4',
34
+ source: 'posts',
35
+ target: 'comments',
36
+ type: 'default',
37
+ },
38
+ {
39
+ id: 'edge5',
40
+ source: 'parentId',
41
+ target: 'notifications',
42
+ type: 'default',
43
+ },
44
+ ];
45
+
46
+ export const classDefaultNodes: ICardNode[] = [
47
+ {
48
+ id: 'parentId',
49
+ type: 'entity',
50
+ position: { x: 0, y: 0 },
51
+ data: {
52
+ isBlock: true,
53
+ nodeId: 'parentId',
54
+ color: 'red',
55
+ title: 'User',
56
+ blocks: [
57
+ { color: 'red', id: uuidv4(), title: 'firstname', type: 'String' },
58
+ { color: 'red', id: uuidv4(), title: 'lastname', type: 'String' },
59
+ { color: 'red', id: uuidv4(), title: 'age', type: 'Number' },
60
+ { color: 'red', id: uuidv4(), title: 'birthdate', type: 'Date' },
61
+ { color: 'red', id: uuidv4(), title: 'email', type: 'String' },
62
+ { color: 'red', id: uuidv4(), title: 'password', type: 'String' },
63
+ ],
64
+ },
65
+ },
66
+ {
67
+ id: 'child1Id',
68
+ type: 'entity',
69
+ position: { x: 50, y: 500 },
70
+ data: {
71
+ isBlock: true,
72
+ nodeId: 'child1Id',
73
+ color: 'green',
74
+ title: 'Profile',
75
+ blocks: [
76
+ { color: 'red', id: uuidv4(), title: 'bio', type: 'String' },
77
+ { color: 'red', id: uuidv4(), title: 'avatar', type: 'String' },
78
+ { color: 'red', id: uuidv4(), title: 'socialLinks', type: 'Array' },
79
+ { color: 'red', id: uuidv4(), title: 'location', type: 'String' },
80
+ ],
81
+ },
82
+ },
83
+ {
84
+ id: 'child2Id',
85
+ type: 'entity',
86
+ position: { x: 350, y: 250 },
87
+ data: {
88
+ isBlock: true,
89
+ nodeId: 'child2Id',
90
+ color: 'green',
91
+ title: 'Authentication',
92
+ blocks: [
93
+ { color: 'red', id: uuidv4(), title: 'token', type: 'String' },
94
+ { color: 'red', id: uuidv4(), title: 'refreshToken', type: 'String' },
95
+ { color: 'red', id: uuidv4(), title: 'expiresAt', type: 'Date' },
96
+ { color: 'red', id: uuidv4(), title: 'lastLogin', type: 'Date' },
97
+ ],
98
+ },
99
+ },
100
+ {
101
+ id: 'posts',
102
+ type: 'entity',
103
+ position: { x: -300, y: 250 },
104
+ data: {
105
+ isBlock: true,
106
+ nodeId: 'posts',
107
+ color: 'blue',
108
+ title: 'Post',
109
+ blocks: [
110
+ { color: 'red', id: uuidv4(), title: 'title', type: 'String' },
111
+ { color: 'red', id: uuidv4(), title: 'content', type: 'String' },
112
+ { color: 'red', id: uuidv4(), title: 'createdAt', type: 'Date' },
113
+ { color: 'red', id: uuidv4(), title: 'updatedAt', type: 'Date' },
114
+ { color: 'red', id: uuidv4(), title: 'tags', type: 'Array' },
115
+ ],
116
+ },
117
+ },
118
+ {
119
+ id: 'comments',
120
+ type: 'entity',
121
+ position: { x: -300, y: 500 },
122
+ data: {
123
+ isBlock: true,
124
+ nodeId: 'comments',
125
+ color: 'purple',
126
+ title: 'Comment',
127
+ blocks: [
128
+ { color: 'red', id: uuidv4(), title: 'content', type: 'String' },
129
+ { color: 'red', id: uuidv4(), title: 'createdAt', type: 'Date' },
130
+ { color: 'red', id: uuidv4(), title: 'likes', type: 'Number' },
131
+ ],
132
+ },
133
+ },
134
+ {
135
+ id: 'notifications',
136
+ type: 'entity',
137
+ position: { x: 350, y: 500 },
138
+ data: {
139
+ isBlock: true,
140
+ nodeId: 'notifications',
141
+ color: 'orange',
142
+ title: 'Notification',
143
+ blocks: [
144
+ { color: 'red', id: uuidv4(), title: 'type', type: 'String' },
145
+ { color: 'red', id: uuidv4(), title: 'message', type: 'String' },
146
+ { color: 'red', id: uuidv4(), title: 'isRead', type: 'Boolean' },
147
+ { color: 'red', id: uuidv4(), title: 'createdAt', type: 'Date' },
148
+ ],
149
+ },
150
+ },
151
+ ];
152
+
153
+ export const workflowDefaultNodesAndEdges = {
154
+ nodes: [
155
+ {
156
+ id: 'workflow-node-main-function',
157
+ type: 'workflow',
158
+ position: {
159
+ x: 1004,
160
+ y: 200,
161
+ },
162
+ draggable: false,
163
+ data: {
164
+ formData: {
165
+ type: 'function',
166
+ parameters: [{ name: 'limit', type: 'number' }],
167
+ name: 'categorizeNumbers',
168
+ body: [],
169
+ },
170
+ title: 'workflow',
171
+ type: 'function',
172
+ nodeId: 'workflow-node-main-function',
173
+ isPinned: false,
174
+ isBlock: false,
175
+ blocks: [],
176
+ parallelChildrenCount: 0,
177
+ conditions: {
178
+ combinator: 'and',
179
+ rules: [],
180
+ },
181
+ },
182
+ style: {
183
+ width: 336,
184
+ height: 316.46875,
185
+ },
186
+ width: 336,
187
+ height: 316.46875,
188
+ selected: false,
189
+ },
190
+ {
191
+ id: 'workflow-node-api-call',
192
+ type: 'workflow',
193
+ position: {
194
+ x: 1400,
195
+ y: 200,
196
+ },
197
+ draggable: false,
198
+ data: {
199
+ formData: {
200
+ type: 'api',
201
+ method: 'GET',
202
+ url: 'https://jsonplaceholder.typicode.com/posts',
203
+ headers: [
204
+ { key: 'Content-Type', value: 'application/json', enabled: true },
205
+ {
206
+ key: 'Authorization',
207
+ value: 'Bearer your-token-here',
208
+ enabled: false,
209
+ },
210
+ { key: 'Accept', value: 'application/json', enabled: true },
211
+ ],
212
+ queryParams: [
213
+ { key: 'limit', value: '10', enabled: true },
214
+ { key: 'page', value: '1', enabled: true },
215
+ { key: 'sort', value: 'desc', enabled: false },
216
+ ],
217
+ body: '',
218
+ bodyType: 'json',
219
+ responseVariable: 'postsData',
220
+ responseDataType: 'Array',
221
+ },
222
+ title: 'Fetch Posts API',
223
+ type: 'api',
224
+ nodeId: 'workflow-node-api-call',
225
+ isPinned: false,
226
+ isBlock: false,
227
+ blocks: [],
228
+ parallelChildrenCount: 0,
229
+ conditions: {
230
+ combinator: 'and',
231
+ rules: [],
232
+ },
233
+ },
234
+ style: {
235
+ width: 336,
236
+ height: 400,
237
+ },
238
+ width: 336,
239
+ height: 400,
240
+ selected: false,
241
+ },
242
+ {
243
+ id: 'workflow-node-post-api',
244
+ type: 'workflow',
245
+ position: {
246
+ x: 1800,
247
+ y: 200,
248
+ },
249
+ draggable: false,
250
+ data: {
251
+ formData: {
252
+ type: 'api',
253
+ method: 'POST',
254
+ url: 'https://jsonplaceholder.typicode.com/posts',
255
+ headers: [
256
+ { key: 'Content-Type', value: 'application/json', enabled: true },
257
+ {
258
+ key: 'Authorization',
259
+ value: 'Bearer your-token-here',
260
+ enabled: true,
261
+ },
262
+ { key: 'Accept', value: 'application/json', enabled: true },
263
+ ],
264
+ queryParams: [],
265
+ body: '{\n "title": "New Post",\n "body": "This is the content of the new post",\n "userId": 1\n}',
266
+ bodyType: 'json',
267
+ responseVariable: 'newPost',
268
+ responseDataType: 'Object',
269
+ },
270
+ title: 'Create Post API',
271
+ type: 'api',
272
+ nodeId: 'workflow-node-post-api',
273
+ isPinned: false,
274
+ isBlock: false,
275
+ blocks: [],
276
+ parallelChildrenCount: 0,
277
+ conditions: {
278
+ combinator: 'and',
279
+ rules: [],
280
+ },
281
+ },
282
+ style: {
283
+ width: 336,
284
+ height: 400,
285
+ },
286
+ width: 336,
287
+ height: 400,
288
+ selected: false,
289
+ },
290
+ {
291
+ id: 'workflow-node-put-api',
292
+ type: 'workflow',
293
+ position: {
294
+ x: 2200,
295
+ y: 200,
296
+ },
297
+ draggable: false,
298
+ data: {
299
+ formData: {
300
+ type: 'api',
301
+ method: 'PUT',
302
+ url: 'https://jsonplaceholder.typicode.com/posts/1',
303
+ headers: [
304
+ { key: 'Content-Type', value: 'application/json', enabled: true },
305
+ {
306
+ key: 'Authorization',
307
+ value: 'Bearer your-token-here',
308
+ enabled: true,
309
+ },
310
+ { key: 'Accept', value: 'application/json', enabled: true },
311
+ ],
312
+ queryParams: [],
313
+ body: '{\n "id": 1,\n "title": "Updated Post",\n "body": "This is the updated content of the post",\n "userId": 1\n}',
314
+ bodyType: 'json',
315
+ responseVariable: 'updatedPost',
316
+ responseDataType: 'Object',
317
+ },
318
+ title: 'Update Post API',
319
+ type: 'api',
320
+ nodeId: 'workflow-node-put-api',
321
+ isPinned: false,
322
+ isBlock: false,
323
+ blocks: [],
324
+ parallelChildrenCount: 0,
325
+ conditions: {
326
+ combinator: 'and',
327
+ rules: [],
328
+ },
329
+ },
330
+ style: {
331
+ width: 336,
332
+ height: 400,
333
+ },
334
+ width: 336,
335
+ height: 400,
336
+ selected: false,
337
+ },
338
+ {
339
+ id: 'workflow-node-patch-api',
340
+ type: 'workflow',
341
+ position: {
342
+ x: 2600,
343
+ y: 200,
344
+ },
345
+ draggable: false,
346
+ data: {
347
+ formData: {
348
+ type: 'api',
349
+ method: 'PATCH',
350
+ url: 'https://jsonplaceholder.typicode.com/posts/1',
351
+ headers: [
352
+ { key: 'Content-Type', value: 'application/json', enabled: true },
353
+ {
354
+ key: 'Authorization',
355
+ value: 'Bearer your-token-here',
356
+ enabled: true,
357
+ },
358
+ { key: 'Accept', value: 'application/json', enabled: true },
359
+ ],
360
+ queryParams: [],
361
+ body: '{\n "title": "Partially Updated Post"\n}',
362
+ bodyType: 'json',
363
+ responseVariable: 'patchedPost',
364
+ responseDataType: 'Object',
365
+ },
366
+ title: 'Patch Post API',
367
+ type: 'api',
368
+ nodeId: 'workflow-node-patch-api',
369
+ isPinned: false,
370
+ isBlock: false,
371
+ blocks: [],
372
+ parallelChildrenCount: 0,
373
+ conditions: {
374
+ combinator: 'and',
375
+ rules: [],
376
+ },
377
+ },
378
+ style: {
379
+ width: 336,
380
+ height: 400,
381
+ },
382
+ width: 336,
383
+ height: 400,
384
+ selected: false,
385
+ },
386
+ {
387
+ id: 'workflow-node-delete-api',
388
+ type: 'workflow',
389
+ position: {
390
+ x: 3000,
391
+ y: 200,
392
+ },
393
+ draggable: false,
394
+ data: {
395
+ formData: {
396
+ type: 'api',
397
+ method: 'DELETE',
398
+ url: 'https://jsonplaceholder.typicode.com/posts/1',
399
+ headers: [
400
+ { key: 'Content-Type', value: 'application/json', enabled: true },
401
+ {
402
+ key: 'Authorization',
403
+ value: 'Bearer your-token-here',
404
+ enabled: true,
405
+ },
406
+ { key: 'Accept', value: 'application/json', enabled: true },
407
+ ],
408
+ queryParams: [],
409
+ body: '',
410
+ bodyType: 'json',
411
+ responseVariable: 'deleteResult',
412
+ responseDataType: 'Object',
413
+ },
414
+ title: 'Delete Post API',
415
+ type: 'api',
416
+ nodeId: 'workflow-node-delete-api',
417
+ isPinned: false,
418
+ isBlock: false,
419
+ blocks: [],
420
+ parallelChildrenCount: 0,
421
+ conditions: {
422
+ combinator: 'and',
423
+ rules: [],
424
+ },
425
+ },
426
+ style: {
427
+ width: 336,
428
+ height: 400,
429
+ },
430
+ width: 336,
431
+ height: 400,
432
+ selected: false,
433
+ },
434
+ ],
435
+ edges: [
436
+ {
437
+ id: 'edge-main-function-to-api-call',
438
+ source: 'workflow-node-main-function',
439
+ target: 'workflow-node-api-call',
440
+ type: 'default',
441
+ sourceHandle: 'workflow-node-main-function-bottom',
442
+ markerEnd: {
443
+ type: 'arrow',
444
+ color: 'black',
445
+ strokeWidth: 2,
446
+ },
447
+ },
448
+ {
449
+ id: 'edge-get-api-to-post-api',
450
+ source: 'workflow-node-api-call',
451
+ target: 'workflow-node-post-api',
452
+ type: 'default',
453
+ sourceHandle: 'workflow-node-api-call-bottom',
454
+ markerEnd: {
455
+ type: 'arrow',
456
+ color: 'black',
457
+ strokeWidth: 2,
458
+ },
459
+ },
460
+ {
461
+ id: 'edge-post-api-to-put-api',
462
+ source: 'workflow-node-post-api',
463
+ target: 'workflow-node-put-api',
464
+ type: 'default',
465
+ sourceHandle: 'workflow-node-post-api-bottom',
466
+ markerEnd: {
467
+ type: 'arrow',
468
+ color: 'black',
469
+ strokeWidth: 2,
470
+ },
471
+ },
472
+ {
473
+ id: 'edge-put-api-to-patch-api',
474
+ source: 'workflow-node-put-api',
475
+ target: 'workflow-node-patch-api',
476
+ type: 'default',
477
+ sourceHandle: 'workflow-node-put-api-bottom',
478
+ markerEnd: {
479
+ type: 'arrow',
480
+ color: 'black',
481
+ strokeWidth: 2,
482
+ },
483
+ },
484
+ {
485
+ id: 'edge-patch-api-to-delete-api',
486
+ source: 'workflow-node-patch-api',
487
+ target: 'workflow-node-delete-api',
488
+ type: 'default',
489
+ sourceHandle: 'workflow-node-patch-api-bottom',
490
+ markerEnd: {
491
+ type: 'arrow',
492
+ color: 'black',
493
+ strokeWidth: 2,
494
+ },
495
+ },
496
+ ],
497
+ };
498
+
499
+ export const conditionBuilderData = {
500
+ states: [
501
+ {
502
+ id: 1,
503
+ label: 'personal_details',
504
+ value: {
505
+ lastName: 'Majid',
506
+ firstName: 'Abdul',
507
+ contactDetails: {
508
+ email: 'a.majid1025@gmail.com',
509
+ phone: '03040430789',
510
+ address: {
511
+ city: 'Lahore',
512
+ street: '115 C-1 Nespak Society College Road',
513
+ country: 'Pakistan',
514
+ postalCode: '54700',
515
+ },
516
+ },
517
+ },
518
+ },
519
+ ],
520
+ envVar: [
521
+ {
522
+ id: 1,
523
+ label: 'port',
524
+ },
525
+ ],
526
+ };
527
+
528
+ export const archNodes = [
529
+ {
530
+ id: 'gateway',
531
+ type: 'serviceNode',
532
+ position: { x: 400, y: 100 },
533
+ data: {
534
+ label: 'API Gateway',
535
+ service: 'api-gateway',
536
+ handles: ['bottom'],
537
+ },
538
+ style: {
539
+ background: 'rgba(240, 98, 146, 0.6)',
540
+ border: '1px solid #777',
541
+ borderRadius: '8px',
542
+ padding: '10px',
543
+ width: 130,
544
+ height: 40,
545
+ zIndex: 2,
546
+ },
547
+ },
548
+ {
549
+ id: 'auth-service',
550
+ type: 'serviceNode',
551
+ position: { x: 200, y: 250 },
552
+ data: {
553
+ label: 'Auth Service',
554
+ service: 'auth',
555
+ handles: ['top', 'bottom'],
556
+ },
557
+ style: {
558
+ background: 'rgba(100, 181, 246, 0.6)',
559
+ border: '1px solid #777',
560
+ borderRadius: '8px',
561
+ padding: '10px',
562
+ width: 130,
563
+ height: 40,
564
+ zIndex: 2,
565
+ },
566
+ },
567
+ {
568
+ id: 'user-service',
569
+ type: 'serviceNode',
570
+ position: { x: 400, y: 250 },
571
+ data: {
572
+ label: 'User Service',
573
+ service: 'user',
574
+ handles: ['top', 'bottom'],
575
+ },
576
+ style: {
577
+ background: 'rgba(100, 181, 246, 0.6)',
578
+ border: '1px solid #777',
579
+ borderRadius: '8px',
580
+ padding: '10px',
581
+ width: 130,
582
+ height: 40,
583
+ zIndex: 2,
584
+ },
585
+ },
586
+ {
587
+ id: 'database',
588
+ type: 'serviceNode',
589
+ position: { x: 300, y: 400 },
590
+ data: {
591
+ label: 'Database',
592
+ service: 'database',
593
+ handles: ['top'],
594
+ },
595
+ style: {
596
+ background: 'rgba(255, 183, 77, 0.6)',
597
+ border: '1px solid #777',
598
+ borderRadius: '8px',
599
+ padding: '10px',
600
+ width: 130,
601
+ height: 40,
602
+ zIndex: 2,
603
+ },
604
+ },
605
+ ];
606
+
607
+ export const archEdges = [
608
+ {
609
+ id: 'e1',
610
+ source: 'gateway',
611
+ target: 'auth-service',
612
+ type: 'smoothstep',
613
+ animated: false,
614
+ style: { stroke: '#555', strokeWidth: 2 },
615
+ markerEnd: {
616
+ type: MarkerType.ArrowClosed,
617
+ width: 20,
618
+ height: 20,
619
+ color: '#555',
620
+ },
621
+ },
622
+ {
623
+ id: 'e2',
624
+ source: 'gateway',
625
+ target: 'user-service',
626
+ type: 'smoothstep',
627
+ animated: false,
628
+ style: { stroke: '#555', strokeWidth: 2 },
629
+ markerEnd: {
630
+ type: MarkerType.ArrowClosed,
631
+ width: 20,
632
+ height: 20,
633
+ color: '#555',
634
+ },
635
+ },
636
+ {
637
+ id: 'e3',
638
+ source: 'auth-service',
639
+ target: 'database',
640
+ type: 'smoothstep',
641
+ animated: false,
642
+ style: { stroke: '#555', strokeWidth: 2 },
643
+ markerEnd: {
644
+ type: MarkerType.ArrowClosed,
645
+ width: 20,
646
+ height: 20,
647
+ color: '#555',
648
+ },
649
+ },
650
+ {
651
+ id: 'e4',
652
+ source: 'user-service',
653
+ target: 'database',
654
+ type: 'smoothstep',
655
+ animated: false,
656
+ style: { stroke: '#555', strokeWidth: 2 },
657
+ markerEnd: {
658
+ type: MarkerType.ArrowClosed,
659
+ width: 20,
660
+ height: 20,
661
+ color: '#555',
662
+ },
663
+ },
664
+ ];