@flowuent-org/diagramming-core 1.3.10 → 1.4.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.
- package/.editorconfig +13 -13
- package/.eslintignore +1 -1
- package/.eslintrc.json +35 -35
- package/.prettierignore +3 -3
- package/.prettierrc +3 -3
- package/.vscode/settings.json +6 -6
- package/README.md +95 -95
- package/apps/authentication/tsconfig.app.json +23 -23
- package/apps/authentication/tsconfig.json +21 -21
- package/apps/authentication/tsconfig.spec.json +28 -28
- package/apps/diagramming/.eslintrc.json +18 -18
- package/apps/diagramming/index.html +16 -16
- package/apps/diagramming/project.json +53 -53
- package/apps/diagramming/public/aws-icons/compute/App Runner.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Application Auto Scaling.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Batch.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Bottlerocket.svg +19 -19
- package/apps/diagramming/public/aws-icons/compute/Compute Optimizer.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/EC2 Auto Scaling.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/EC2 Image Builder.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/EC2.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Elastic Beanstalk.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Elastic Fabric Adapter.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Fargate.svg +19 -19
- package/apps/diagramming/public/aws-icons/compute/Genomics CLI.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Lambda.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Local Zones.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/NICE DCV.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/NICE EnginFrame.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Nitro Enclaves.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Outposts family.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Outposts rack.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Outposts servers.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/ParallelCluster.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Serverless Application Repository.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/SimSpace Weaver.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Thinkbox Deadline.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Thinkbox Frost.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Thinkbox Sequoia.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Thinkbox Stoke.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Thinkbox XMesh.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/VMware Cloud on AWS.svg +17 -17
- package/apps/diagramming/public/aws-icons/compute/Wavelength.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/ECS Anywhere.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/EKS Anywhere.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/EKS Cloud.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/EKS Distro.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/Elastic Container Registry.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/Elastic Container Service.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/Elastic Kubernetes Service.svg +17 -17
- package/apps/diagramming/public/aws-icons/container/Fargate.svg +19 -19
- package/apps/diagramming/public/aws-icons/container/Red Hat OpenShift Service on AWS.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/Aurora.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/Database Migration Service.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/DocumentDB.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/ElastiCache.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/Keyspaces.svg +15 -15
- package/apps/diagramming/public/aws-icons/database/MemoryDB for Redis.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/Neptune.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/RDS on VMware.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/RDS.svg +17 -17
- package/apps/diagramming/public/aws-icons/database/Timestream.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/App Mesh.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Client VPN.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Cloud Directory.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Cloud Map.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Cloud WAN.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/CloudFront.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Direct Connect.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Elastic Load Balancing.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Global Accelerator.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Private 5G.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/PrivateLink.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Route 53.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Site to Site VPN.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Transit Gateway.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/VPC Lattice.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Verified Access.svg +17 -17
- package/apps/diagramming/public/aws-icons/networking/Virtual Private Cloud.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Artifact.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Audit Manager.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Certificate Manager.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/CloudHSM.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Cognito.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Detective.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Directory Service.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Firewall Manager.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/GuardDuty.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/IAM Identity Center.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Identity and Access Management.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Inspector.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Key Management Service.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Macie.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Network Firewall.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Resource Access Manager.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Secrets Manager.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Security Hub.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Security Lake.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Shield.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Signer.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/Verified Permissions.svg +17 -17
- package/apps/diagramming/public/aws-icons/security/WAF.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Backup.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/EFS.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Elastic Block Store.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Elastic Disaster Recovery.svg +15 -15
- package/apps/diagramming/public/aws-icons/storage/FSx for Lustre.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/FSx for NetApp ONTAP.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/FSx for OpenZFS.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/FSx for WFS.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/FSx.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/File Cache.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/S3 on Outposts.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Simple Storage Service Glacier.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Simple Storage Service.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Snowball Edge.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Snowball.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Snowcone.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Snowmobile.svg +17 -17
- package/apps/diagramming/public/aws-icons/storage/Storage Gateway.svg +17 -17
- package/apps/diagramming/public/azure-icons/compute/02112-icon-service-Automanaged-VM.svg +1 -1
- package/apps/diagramming/public/azure-icons/databases/02390-icon-service-Azure-SQL.svg +1 -1
- package/apps/diagramming/public/azure-icons/databases/02392-icon-service-SSIS-Lift-And-Shift-IR.svg +1 -1
- package/apps/diagramming/public/azure-icons/networking/02145-icon-service-Resource-Management-Private-Link.svg +1 -1
- package/apps/diagramming/public/azure-icons/security/02247-icon-service-Microsoft-Defender-for-IoT.svg +1 -1
- package/apps/diagramming/public/sample-node-complete.json +63 -63
- package/apps/diagramming/public/sample-node-data.json +63 -63
- package/apps/diagramming/src/AutomationDiagramData.ts +147 -480
- package/apps/diagramming/src/CollaborationDiagramData.ts +127 -127
- package/apps/diagramming/src/CustomIconExamples.ts +233 -233
- package/apps/diagramming/src/DiagramTabs.tsx +205 -205
- package/apps/diagramming/src/Pages/DevPlayground.tsx +3 -3
- package/apps/diagramming/src/Pages/Home.tsx +111 -111
- package/apps/diagramming/src/SequenceDiagramData.ts +215 -215
- package/apps/diagramming/src/StateMachineDiagramData.ts +64 -64
- package/apps/diagramming/src/UseCaseDiagramData.ts +52 -52
- package/apps/diagramming/src/cloud-data.ts +371 -371
- package/apps/diagramming/src/components/AddNodeView.tsx +252 -252
- package/apps/diagramming/src/createSelecors.tsx +17 -17
- package/apps/diagramming/src/index.scss +12 -12
- package/apps/diagramming/src/main.tsx +463 -463
- package/apps/diagramming/src/node-data.ts +664 -664
- package/apps/diagramming/src/sample-workflow-content.ts +55 -55
- package/apps/diagramming/src/stencil-items.ts +31 -31
- package/apps/diagramming/src/style.css +13 -13
- package/apps/diagramming/src/tabsStore.tsx +152 -152
- package/apps/diagramming/src/vite-env.d.ts +1 -1
- package/apps/diagramming/tsconfig.app.json +23 -23
- package/apps/diagramming/tsconfig.json +21 -21
- package/apps/diagramming/tsconfig.spec.json +28 -28
- package/apps/diagramming/vite.config.ts +34 -34
- package/apps/diagramming/webpack.config.js +13 -13
- package/apps/workflow/.eslintrc.json +18 -18
- package/apps/workflow/group/group-form-hooks/index.ts +3 -3
- package/apps/workflow/group/group-form-hooks/useFormValidation.ts +20 -20
- package/apps/workflow/group/group-form-schema/SettingsTabFormSchema.ts +7 -7
- package/apps/workflow/group/group-form-schema/index.ts +3 -3
- package/apps/workflow/i18n.ts +19 -19
- package/apps/workflow/index.html +16 -16
- package/apps/workflow/locales/en/translation.json +713 -713
- package/apps/workflow/project.json +8 -8
- package/apps/workflow/src/app/app.module.css +1 -1
- package/apps/workflow/src/app/app.spec.tsx +15 -15
- package/apps/workflow/src/app/app.tsx +370 -370
- package/apps/workflow/src/main.tsx +13 -13
- package/apps/workflow/src/styles.css +1 -1
- package/apps/workflow/src/theme/index.ts +546 -546
- package/apps/workflow/tsconfig.app.json +23 -23
- package/apps/workflow/tsconfig.json +21 -21
- package/apps/workflow/tsconfig.spec.json +28 -28
- package/apps/workflow/vite.config.ts +51 -51
- package/nx.json +58 -58
- package/package.json +1 -1
- package/packages/api/.babelrc +12 -12
- package/packages/api/.eslintrc.json +18 -18
- package/packages/api/README.md +7 -7
- package/packages/api/project.json +8 -8
- package/packages/api/src/index.ts +3 -3
- package/packages/api/src/lib/jsonPlaceholderService/endpoints.ts +3 -3
- package/packages/api/src/lib/jsonPlaceholderService/service.ts +13 -13
- package/packages/api/tsconfig.json +17 -17
- package/packages/api/tsconfig.lib.json +24 -24
- package/packages/atoms/.babelrc +12 -12
- package/packages/atoms/.eslintrc.json +18 -18
- package/packages/atoms/README.md +7 -7
- package/packages/atoms/forms/AuthenticationTabForm/authenticationTabForm.json +224 -224
- package/packages/atoms/forms/AuthenticationTabForm/index.tsx +255 -255
- package/packages/atoms/forms/SettingsTabForm/index.tsx +85 -85
- package/packages/atoms/forms/SettingsTabForm/settingTabForm.json +27 -27
- package/packages/atoms/forms/index.ts +4 -4
- package/packages/atoms/project.json +8 -8
- package/packages/atoms/src/index.ts +33 -33
- package/packages/atoms/src/lib/Accordion/Accordion.module.css +7 -7
- package/packages/atoms/src/lib/Accordion/Accordion.spec.tsx +13 -13
- package/packages/atoms/src/lib/Accordion/Accordion.tsx +29 -29
- package/packages/atoms/src/lib/Alert/Alert.module.css +7 -7
- package/packages/atoms/src/lib/Alert/Alert.spec.tsx +10 -10
- package/packages/atoms/src/lib/Alert/Alert.tsx +19 -19
- package/packages/atoms/src/lib/Avatar/Avatar.module.css +7 -7
- package/packages/atoms/src/lib/Avatar/Avatar.spec.tsx +10 -10
- package/packages/atoms/src/lib/Avatar/Avatar.tsx +22 -22
- package/packages/atoms/src/lib/Box/Box.module.css +7 -7
- package/packages/atoms/src/lib/Box/Box.spec.tsx +10 -10
- package/packages/atoms/src/lib/Box/Box.tsx +19 -19
- package/packages/atoms/src/lib/BulkEdit/BulkEdit.module.css +7 -7
- package/packages/atoms/src/lib/BulkEdit/BulkEdit.spec.tsx +10 -10
- package/packages/atoms/src/lib/BulkEdit/BulkEdit.tsx +15 -15
- package/packages/atoms/src/lib/Button/Button.module.css +7 -7
- package/packages/atoms/src/lib/Button/Button.spec.tsx +10 -10
- package/packages/atoms/src/lib/Button/Button.tsx +78 -78
- package/packages/atoms/src/lib/Card/Card.module.css +7 -7
- package/packages/atoms/src/lib/Card/Card.spec.tsx +10 -10
- package/packages/atoms/src/lib/Card/Card.tsx +19 -19
- package/packages/atoms/src/lib/CardContent/CardContent.module.css +7 -7
- package/packages/atoms/src/lib/CardContent/CardContent.spec.tsx +10 -10
- package/packages/atoms/src/lib/CardContent/CardContent.tsx +22 -22
- package/packages/atoms/src/lib/FormTextField/FormTextField.module.css +7 -7
- package/packages/atoms/src/lib/FormTextField/FormTextField.spec.tsx +10 -10
- package/packages/atoms/src/lib/FormTextField/FormTextField.tsx +35 -35
- package/packages/atoms/src/lib/Grid/Grid.module.css +7 -7
- package/packages/atoms/src/lib/Grid/Grid.spec.tsx +10 -10
- package/packages/atoms/src/lib/Grid/Grid.tsx +19 -19
- package/packages/atoms/src/lib/Stack/Stack.module.css +7 -7
- package/packages/atoms/src/lib/Stack/Stack.spec.tsx +10 -10
- package/packages/atoms/src/lib/Stack/Stack.tsx +19 -19
- package/packages/atoms/src/lib/Switch/Switch.module.css +7 -7
- package/packages/atoms/src/lib/Switch/Switch.spec.tsx +10 -10
- package/packages/atoms/src/lib/Switch/Switch.tsx +46 -46
- package/packages/atoms/src/lib/TableView/TableView.module.css +7 -7
- package/packages/atoms/src/lib/TableView/TableView.spec.tsx +10 -10
- package/packages/atoms/src/lib/TableView/TableView.tsx +88 -88
- package/packages/atoms/src/lib/TextField/TextField.module.css +7 -7
- package/packages/atoms/src/lib/TextField/TextField.spec.tsx +10 -10
- package/packages/atoms/src/lib/TextField/TextField.tsx +17 -17
- package/packages/atoms/src/lib/Typography/Typography.module.css +7 -7
- package/packages/atoms/src/lib/Typography/Typography.spec.tsx +10 -10
- package/packages/atoms/src/lib/Typography/Typography.tsx +22 -22
- package/packages/atoms/tsconfig.json +17 -17
- package/packages/atoms/tsconfig.lib.json +30 -30
- package/packages/common/.babelrc +12 -12
- package/packages/common/.eslintrc.json +18 -18
- package/packages/common/README.md +7 -7
- package/packages/common/project.json +8 -8
- package/packages/common/src/index.ts +4 -4
- package/packages/common/src/lib/generateRandomProfilePic.ts +3 -3
- package/packages/common/src/lib/generateValidationSchema.ts +46 -46
- package/packages/common/tsconfig.json +17 -17
- package/packages/common/tsconfig.lib.json +24 -24
- package/packages/contexts/.babelrc +12 -12
- package/packages/contexts/.eslintrc.json +18 -18
- package/packages/contexts/README.md +7 -7
- package/packages/contexts/project.json +8 -8
- package/packages/contexts/src/index.ts +2 -2
- package/packages/contexts/tsconfig.json +17 -17
- package/packages/contexts/tsconfig.lib.json +24 -24
- package/packages/diagrams/.babelrc +12 -12
- package/packages/diagrams/.ctirc +208 -208
- package/packages/diagrams/.eslintrc.json +17 -17
- package/packages/diagrams/CUSTOM_ICONS.md +232 -232
- package/packages/diagrams/GOOGLE_SHEETS_IMPLEMENTATION.md +233 -233
- package/packages/diagrams/NODE_DATA_UPDATE_API.md +430 -430
- package/packages/diagrams/README.md +7 -7
- package/packages/diagrams/UNDO_REDO_API.md +306 -306
- package/packages/diagrams/locales/en/translation.json +713 -713
- package/packages/diagrams/package.json +27 -27
- package/packages/diagrams/pnpm-lock.yaml +2606 -2606
- package/packages/diagrams/project.json +42 -42
- package/packages/diagrams/rollup.config.js +26 -26
- package/packages/diagrams/src/DiagramFlow.tsx +7 -7
- package/packages/diagrams/src/declarations.d.ts +7 -7
- package/packages/diagrams/src/index.ts +8 -1
- package/packages/diagrams/src/index.ts.bak +99 -99
- package/packages/diagrams/src/lib/assets/markers/markers.param.tsx +101 -101
- package/packages/diagrams/src/lib/assets/markers/markers.type.ts +10 -10
- package/packages/diagrams/src/lib/atoms/ActorNode.tsx +123 -123
- package/packages/diagrams/src/lib/atoms/AddParallelColButton.tsx +26 -26
- package/packages/diagrams/src/lib/atoms/BendpointNode.tsx +71 -71
- package/packages/diagrams/src/lib/atoms/CardBlockTypeSelector.tsx +35 -35
- package/packages/diagrams/src/lib/atoms/CardEditableTitle.tsx +76 -76
- package/packages/diagrams/src/lib/atoms/CardMainContent.tsx +19 -19
- package/packages/diagrams/src/lib/atoms/ConnectionPoints.tsx +149 -149
- package/packages/diagrams/src/lib/atoms/ContentAssist.tsx +341 -341
- package/packages/diagrams/src/lib/atoms/DiagramControls.tsx +56 -56
- package/packages/diagrams/src/lib/atoms/ExpressionInput.tsx +437 -437
- package/packages/diagrams/src/lib/atoms/FloatingConnectionLine.tsx +73 -73
- package/packages/diagrams/src/lib/atoms/LazyIcon.tsx +31 -31
- package/packages/diagrams/src/lib/atoms/MarkerSelector.tsx +106 -106
- package/packages/diagrams/src/lib/atoms/MultiSelectInput.tsx +87 -87
- package/packages/diagrams/src/lib/atoms/ParameterInput.tsx +199 -199
- package/packages/diagrams/src/lib/atoms/PropertyInput.tsx +114 -114
- package/packages/diagrams/src/lib/atoms/StyledBox.tsx +69 -69
- package/packages/diagrams/src/lib/atoms/ValidationError.tsx +37 -37
- package/packages/diagrams/src/lib/atoms/ValidationMessage.tsx +63 -63
- package/packages/diagrams/src/lib/components/AiButton.tsx +52 -52
- package/packages/diagrams/src/lib/components/ControlEdgeList.tsx +303 -303
- package/packages/diagrams/src/lib/components/CreateFunctionModal.tsx +264 -264
- package/packages/diagrams/src/lib/components/CustomCodeModal.tsx +287 -287
- package/packages/diagrams/src/lib/components/DiagramPanel.tsx +331 -331
- package/packages/diagrams/src/lib/components/FunctionModalTooltip.tsx +30 -30
- package/packages/diagrams/src/lib/components/GraphQLCustomCodeModal.tsx +210 -210
- package/packages/diagrams/src/lib/components/Header.tsx +143 -143
- package/packages/diagrams/src/lib/components/MiniMapCommon.tsx +24 -24
- package/packages/diagrams/src/lib/components/ResizeIcon.tsx +81 -81
- package/packages/diagrams/src/lib/components/SideBar.tsx +40 -40
- package/packages/diagrams/src/lib/components/automation/AISuggestionsModal.tsx +269 -269
- package/packages/diagrams/src/lib/components/automation/AISuggestionsPanel.tsx +28 -175
- package/packages/diagrams/src/lib/components/automation/AutomationApiNode.tsx +1 -1
- package/packages/diagrams/src/lib/components/automation/AutomationDecisionNode.tsx +94 -0
- package/packages/diagrams/src/lib/components/automation/AutomationEndNode.tsx +1 -1
- package/packages/diagrams/src/lib/components/automation/AutomationExecutionPanel.tsx +439 -439
- package/packages/diagrams/src/lib/components/automation/AutomationFormattingNode.tsx +1 -1
- package/packages/diagrams/src/lib/components/automation/AutomationInteractionNode.tsx +693 -693
- package/packages/diagrams/src/lib/components/automation/AutomationMonitoringNode.tsx +399 -399
- package/packages/diagrams/src/lib/components/automation/AutomationNavigationNode.tsx +1 -1
- package/packages/diagrams/src/lib/components/automation/AutomationNodeCard.tsx +414 -0
- package/packages/diagrams/src/lib/components/automation/AutomationSlackNode.tsx +694 -694
- package/packages/diagrams/src/lib/components/automation/AutomationSmsNode.tsx +62 -0
- package/packages/diagrams/src/lib/components/automation/AutomationStartNode.tsx +1 -1
- package/packages/diagrams/src/lib/components/automation/AutomationTelegramNode.tsx +664 -664
- package/packages/diagrams/src/lib/components/automation/AutomationVoiceCallNode.tsx +65 -0
- package/packages/diagrams/src/lib/components/automation/AutomationWorkflowNode.tsx +85 -0
- package/packages/diagrams/src/lib/components/automation/NodeAIAssistantPopup.tsx +504 -504
- package/packages/diagrams/src/lib/components/automation/index.ts +29 -19
- package/packages/diagrams/src/lib/components/automation/statusColors.ts +124 -124
- package/packages/diagrams/src/lib/contexts/CardDataProvider.tsx +111 -111
- package/packages/diagrams/src/lib/contexts/DiagramProvider.tsx +392 -391
- package/packages/diagrams/src/lib/contexts/diagramStoreTypes.tsx +134 -134
- package/packages/diagrams/src/lib/contexts/onConnect.ts +39 -39
- package/packages/diagrams/src/lib/contexts/onDragStart.ts +45 -45
- package/packages/diagrams/src/lib/contexts/onNodeDragEnd.ts +179 -179
- package/packages/diagrams/src/lib/contexts/onNodesChange.ts +406 -406
- package/packages/diagrams/src/lib/contexts/onReconnect.ts +59 -59
- package/packages/diagrams/src/lib/contexts/onWorkflowNodeDelete.ts +65 -65
- package/packages/diagrams/src/lib/contexts/setContentHeight.ts +14 -14
- package/packages/diagrams/src/lib/contexts/setDiagramType.ts +10 -10
- package/packages/diagrams/src/lib/contexts/setEdgeShapeType.ts +7 -7
- package/packages/diagrams/src/lib/contexts/setEdges.ts +9 -9
- package/packages/diagrams/src/lib/contexts/setLayoutDirection.ts +9 -9
- package/packages/diagrams/src/lib/contexts/setNodeSetting.ts +17 -17
- package/packages/diagrams/src/lib/contexts/setNodes.ts +10 -10
- package/packages/diagrams/src/lib/contexts/setPannable.ts +7 -7
- package/packages/diagrams/src/lib/contexts/setSelectedEdge.ts +7 -7
- package/packages/diagrams/src/lib/contexts/setSelectedNode.ts +7 -7
- package/packages/diagrams/src/lib/contexts/undo.ts +163 -163
- package/packages/diagrams/src/lib/contexts/updateNodeSetting.ts +17 -17
- package/packages/diagrams/src/lib/examples/TwilioWhatsAppConfigExample.ts +128 -128
- package/packages/diagrams/src/lib/externals.ts +4 -4
- package/packages/diagrams/src/lib/hooks/customUseReactFlow.tsx +90 -90
- package/packages/diagrams/src/lib/hooks/updateNodes.ts +45 -45
- package/packages/diagrams/src/lib/hooks/useAddChildButton.tsx +61 -61
- package/packages/diagrams/src/lib/hooks/useAddSwitchCase.ts +75 -75
- package/packages/diagrams/src/lib/hooks/useAutoRegisterFunctions.ts +135 -135
- package/packages/diagrams/src/lib/hooks/useAutoRegisterVariables.ts +286 -286
- package/packages/diagrams/src/lib/hooks/useDeleteNodeByEvent.ts +64 -64
- package/packages/diagrams/src/lib/hooks/useDragCallbacks.tsx +122 -122
- package/packages/diagrams/src/lib/hooks/useFormValidation.ts +349 -349
- package/packages/diagrams/src/lib/hooks/useFunctionFormCallbacks.ts +136 -136
- package/packages/diagrams/src/lib/hooks/useIsSelectedNode.ts +11 -11
- package/packages/diagrams/src/lib/hooks/useModalControls.ts +13 -13
- package/packages/diagrams/src/lib/hooks/useNodeDragHandlers.ts +43 -43
- package/packages/diagrams/src/lib/hooks/useNodeSelection.ts +55 -55
- package/packages/diagrams/src/lib/hooks/useRenderDividers.tsx +19 -19
- package/packages/diagrams/src/lib/hooks/useRenderPins.tsx +74 -74
- package/packages/diagrams/src/lib/hooks/useResizeObserver.ts +21 -21
- package/packages/diagrams/src/lib/hooks/useTreeChildNode.ts +536 -536
- package/packages/diagrams/src/lib/i18n.ts +42 -42
- package/packages/diagrams/src/lib/icons/icons.tsx +324 -0
- package/packages/diagrams/src/lib/icons/index.ts +29 -0
- package/packages/diagrams/src/lib/icons/types.ts +7 -0
- package/packages/diagrams/src/lib/molecules/AddingBlock.tsx +147 -147
- package/packages/diagrams/src/lib/molecules/AvailableVariablesDisplay.tsx +57 -57
- package/packages/diagrams/src/lib/molecules/Block.tsx +143 -143
- package/packages/diagrams/src/lib/molecules/BlockProvider.tsx +28 -28
- package/packages/diagrams/src/lib/molecules/BlockWrapper.tsx +14 -14
- package/packages/diagrams/src/lib/molecules/ConditionRule.tsx +131 -131
- package/packages/diagrams/src/lib/molecules/DraggablePane.tsx +198 -198
- package/packages/diagrams/src/lib/molecules/EntityNodeBlocks.tsx +66 -66
- package/packages/diagrams/src/lib/molecules/SideHandles.tsx +215 -215
- package/packages/diagrams/src/lib/molecules/StencilItem.tsx +85 -85
- package/packages/diagrams/src/lib/molecules/WorkflowNodeActionButtons.tsx +62 -62
- package/packages/diagrams/src/lib/molecules/animated-add-button.tsx +83 -83
- package/packages/diagrams/src/lib/molecules/json-viewer.tsx +107 -107
- package/packages/diagrams/src/lib/organisms/AddNodeView.tsx +102 -102
- package/packages/diagrams/src/lib/organisms/Card/EntityNode.tsx +259 -259
- package/packages/diagrams/src/lib/organisms/Card/card.params.ts +29 -29
- package/packages/diagrams/src/lib/organisms/Card/card.types.ts +5 -5
- package/packages/diagrams/src/lib/organisms/CodeModal.tsx +105 -105
- package/packages/diagrams/src/lib/organisms/ConditionRuleGroup.tsx +138 -138
- package/packages/diagrams/src/lib/organisms/CustomEdge/EdgeMarkers.tsx +51 -51
- package/packages/diagrams/src/lib/organisms/CustomEdge/custom-edge-generator.tsx +135 -135
- package/packages/diagrams/src/lib/organisms/CustomEdge/custom-edge.params.ts +6 -6
- package/packages/diagrams/src/lib/organisms/CustomEdge/custom-edge.type.ts +15 -15
- package/packages/diagrams/src/lib/organisms/CustomEdge/useCreateBendPoint.tsx +121 -121
- package/packages/diagrams/src/lib/organisms/CustomEdge/useEdgeModal.ts +37 -37
- package/packages/diagrams/src/lib/organisms/CustomEdge/useEdgePath.tsx +99 -99
- package/packages/diagrams/src/lib/organisms/DownloadPanel.tsx +345 -345
- package/packages/diagrams/src/lib/organisms/EdgeModal.tsx +243 -243
- package/packages/diagrams/src/lib/organisms/HistoryPane.tsx +118 -118
- package/packages/diagrams/src/lib/organisms/NodeContextMenu.tsx +259 -259
- package/packages/diagrams/src/lib/organisms/PropertiesPane.tsx +276 -276
- package/packages/diagrams/src/lib/organisms/SmartDynamicForm.tsx +226 -226
- package/packages/diagrams/src/lib/organisms/Stencil.tsx +60 -60
- package/packages/diagrams/src/lib/organisms/UseDiagramStore.tsx +4 -4
- package/packages/diagrams/src/lib/organisms/WorkFlowNode/NodeActionButtons.tsx +45 -45
- package/packages/diagrams/src/lib/organisms/WorkFlowNode/NodeTypeDisplay.tsx +114 -114
- package/packages/diagrams/src/lib/organisms/WorkFlowNode/WorkflowNodeIcons.tsx +21 -23
- package/packages/diagrams/src/lib/organisms/WorkflowNode.tsx +484 -484
- package/packages/diagrams/src/lib/services/GoogleSheetsService.ts +961 -961
- package/packages/diagrams/src/lib/services/SlackService.ts +134 -134
- package/packages/diagrams/src/lib/services/TwilioWhatsAppService.ts +273 -273
- package/packages/diagrams/src/lib/styles.css +55 -55
- package/packages/diagrams/src/lib/templates/PageLinks.tsx +13 -13
- package/packages/diagrams/src/lib/templates/arch/ArchDiagram.tsx +793 -793
- package/packages/diagrams/src/lib/templates/arch/components/EdgeDialog.tsx +82 -82
- package/packages/diagrams/src/lib/templates/arch/components/EdgeSettings.tsx +81 -81
- package/packages/diagrams/src/lib/templates/arch/components/GroupControls.tsx +59 -59
- package/packages/diagrams/src/lib/templates/arch/components/GroupSizeDialog.tsx +81 -81
- package/packages/diagrams/src/lib/templates/arch/components/NodeDialog.tsx +214 -214
- package/packages/diagrams/src/lib/templates/arch/components/nodeTypes.ts +91 -91
- package/packages/diagrams/src/lib/templates/arch/controls/ArchDiagramControls.tsx +349 -349
- package/packages/diagrams/src/lib/templates/arch/data/templatee-data.ts +212 -212
- package/packages/diagrams/src/lib/templates/cloud-arch/components/CloudArchitectureDiagram.tsx +3912 -3912
- package/packages/diagrams/src/lib/templates/cloud-arch/components/FormatConverter.tsx +809 -809
- package/packages/diagrams/src/lib/templates/cloud-arch/components/FragmentImporter.tsx +276 -276
- package/packages/diagrams/src/lib/templates/cloud-arch/components/PropertiesPanel.tsx +1063 -1063
- package/packages/diagrams/src/lib/templates/cloud-arch/components/ServiceIconPicker.tsx +138 -138
- package/packages/diagrams/src/lib/templates/cloud-arch/components/SettingsSidebar.tsx +656 -656
- package/packages/diagrams/src/lib/templates/cloud-arch/components/SubnetSelector.tsx +468 -468
- package/packages/diagrams/src/lib/templates/cloud-arch/components/nodes/ServiceNode.tsx +310 -310
- package/packages/diagrams/src/lib/templates/cloud-arch/components/nodes/SubnetNode.tsx +475 -475
- package/packages/diagrams/src/lib/templates/cloud-arch/components/nodes/UsersNode.tsx +277 -277
- package/packages/diagrams/src/lib/templates/cloud-arch/data/diagramManager.ts +364 -364
- package/packages/diagrams/src/lib/templates/cloud-arch/data/types.ts +183 -183
- package/packages/diagrams/src/lib/templates/cloud-arch/integration/diagramValidator.ts +379 -379
- package/packages/diagrams/src/lib/templates/cloud-arch/messages/errorMessages.json +95 -95
- package/packages/diagrams/src/lib/templates/cloud-arch/types/localization.ts +368 -368
- package/packages/diagrams/src/lib/templates/cloud-arch/types/validation.ts +72 -72
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/aws-icons.ts +557 -557
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/awsValidation.ts +446 -446
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/azure-icons.ts +802 -802
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/azureValidation.ts +495 -495
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/cloudValidation.ts +929 -929
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/errorMessages.ts +283 -283
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/gcp-icons.ts +186 -186
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/gcpValidation.ts +312 -312
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/genericValidation.ts +689 -689
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/iconMapping.ts +383 -383
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/idGenerator.ts +220 -220
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/localizationManager.ts +300 -300
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/restrictionEngine.ts +550 -550
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/restrictionValidator.ts +400 -400
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/serviceIcons.tsx +129 -129
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/serviceMapping.ts +330 -330
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/translations.ts +54 -54
- package/packages/diagrams/src/lib/templates/cloud-arch/utils/validationExtractor.ts +342 -342
- package/packages/diagrams/src/lib/templates/collaborationDiagram/CollaborationDiagram.tsx +15 -15
- package/packages/diagrams/src/lib/templates/collaborationDiagram/components/AddCollabEdgeDialog.tsx +181 -181
- package/packages/diagrams/src/lib/templates/collaborationDiagram/components/CollabLayout.ts +182 -182
- package/packages/diagrams/src/lib/templates/collaborationDiagram/components/CollabObjectNodeSettings.tsx +86 -86
- package/packages/diagrams/src/lib/templates/collaborationDiagram/components/CollaborationDiagramFlow.tsx +731 -731
- package/packages/diagrams/src/lib/templates/collaborationDiagram/components/DraggableEdgeLabel.tsx +123 -123
- package/packages/diagrams/src/lib/templates/collaborationDiagram/controls/CollaborationControls.tsx +131 -131
- package/packages/diagrams/src/lib/templates/collaborationDiagram/nodes/CollabEdge.tsx +170 -170
- package/packages/diagrams/src/lib/templates/collaborationDiagram/nodes/CollabObjectNode.tsx +178 -178
- package/packages/diagrams/src/lib/templates/home.style.css +16 -16
- package/packages/diagrams/src/lib/templates/node-forms/ApiForm.tsx +416 -416
- package/packages/diagrams/src/lib/templates/node-forms/CallForm.tsx +370 -370
- package/packages/diagrams/src/lib/templates/node-forms/ForLoopNode.tsx +313 -313
- package/packages/diagrams/src/lib/templates/node-forms/FunctionForm.tsx +211 -211
- package/packages/diagrams/src/lib/templates/node-forms/GraphQLForm.tsx +679 -679
- package/packages/diagrams/src/lib/templates/node-forms/IfNodeForm.tsx +97 -97
- package/packages/diagrams/src/lib/templates/node-forms/LetNodeForm.tsx +533 -533
- package/packages/diagrams/src/lib/templates/node-forms/LoopNode.tsx +149 -149
- package/packages/diagrams/src/lib/templates/node-forms/NodeForm.tsx +383 -383
- package/packages/diagrams/src/lib/templates/node-forms/ReturnNodeForm.tsx +96 -96
- package/packages/diagrams/src/lib/templates/node-forms/SetNodeForm.tsx +141 -141
- package/packages/diagrams/src/lib/templates/node-forms/SwitchNodeForm.tsx +249 -249
- package/packages/diagrams/src/lib/templates/node-forms/TryCatchForm.tsx +167 -167
- package/packages/diagrams/src/lib/templates/nodeFormSchema.json +84 -84
- package/packages/diagrams/src/lib/templates/sequence/SequenceDiagram.tsx +22 -22
- package/packages/diagrams/src/lib/templates/sequence/components/ActivationBarNode.tsx +33 -33
- package/packages/diagrams/src/lib/templates/sequence/components/AddMessageDialog.tsx +302 -302
- package/packages/diagrams/src/lib/templates/sequence/components/CombinedFragmentNode.tsx +65 -65
- package/packages/diagrams/src/lib/templates/sequence/components/EntitySettings.tsx +559 -559
- package/packages/diagrams/src/lib/templates/sequence/components/FragmentSettings.tsx +116 -116
- package/packages/diagrams/src/lib/templates/sequence/components/SequenceComponents.tsx +14 -14
- package/packages/diagrams/src/lib/templates/sequence/components/SequenceDiagramFlow.tsx +1361 -1361
- package/packages/diagrams/src/lib/templates/sequence/components/SequenceEntityNode.tsx +394 -394
- package/packages/diagrams/src/lib/templates/sequence/components/SequenceMessageEdge.tsx +272 -272
- package/packages/diagrams/src/lib/templates/sequence/components/SimpleEntitySettings.tsx +89 -89
- package/packages/diagrams/src/lib/templates/sequence/controls/DiagramControls.tsx +707 -707
- package/packages/diagrams/src/lib/templates/sequence/data/template-data.ts +635 -635
- package/packages/diagrams/src/lib/templates/stateMachine/StateMachineDiagram.tsx +66 -66
- package/packages/diagrams/src/lib/templates/stateMachine/components/CompositeStateNodeSettings.tsx +638 -638
- package/packages/diagrams/src/lib/templates/stateMachine/components/CustomEdge.tsx +220 -220
- package/packages/diagrams/src/lib/templates/stateMachine/components/EdgeSettings.tsx +193 -193
- package/packages/diagrams/src/lib/templates/stateMachine/components/SelfConnectingEdge.tsx +41 -41
- package/packages/diagrams/src/lib/templates/stateMachine/components/StateMachineComponents.tsx +49 -49
- package/packages/diagrams/src/lib/templates/stateMachine/components/StateMachineDiagramFlow.tsx +1238 -1238
- package/packages/diagrams/src/lib/templates/stateMachine/components/StateMachineLayout.ts +350 -350
- package/packages/diagrams/src/lib/templates/stateMachine/components/StateNodeSettings.tsx +188 -188
- package/packages/diagrams/src/lib/templates/stateMachine/components/useSelfTransition.ts +114 -114
- package/packages/diagrams/src/lib/templates/stateMachine/controls/StateDiagramControls.tsx +488 -488
- package/packages/diagrams/src/lib/templates/stateMachine/data/template-data.ts +4 -4
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/ChoicePointNode.tsx +54 -54
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/CompositeStateNode.tsx +225 -225
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/EntryPointNode.tsx +31 -31
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/ExitPointNode.tsx +44 -44
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/FinalStateNode.tsx +41 -41
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/ForkJoinNode.tsx +53 -53
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/HistoryStateNode.tsx +36 -36
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/InitialStateNode.tsx +29 -29
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/JunctionPointNode.tsx +33 -33
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/PinPointNode.tsx +111 -111
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/StateNode.tsx +124 -124
- package/packages/diagrams/src/lib/templates/stateMachine/nodes/bendPoint.tsx +71 -71
- package/packages/diagrams/src/lib/templates/systemFlow/SystemFlowDiagram.tsx +67 -67
- package/packages/diagrams/src/lib/templates/systemFlow/components/EdgeSettings.tsx +330 -330
- package/packages/diagrams/src/lib/templates/systemFlow/components/FloatingEdge.tsx +219 -219
- package/packages/diagrams/src/lib/templates/systemFlow/components/SystemFlowComponents.tsx +28 -28
- package/packages/diagrams/src/lib/templates/systemFlow/components/SystemFlowDiagramFlow.tsx +1179 -1179
- package/packages/diagrams/src/lib/templates/systemFlow/components/SystemFlowNodeSettings.tsx +151 -151
- package/packages/diagrams/src/lib/templates/systemFlow/controls/SystemFlowControls.tsx +435 -435
- package/packages/diagrams/src/lib/templates/systemFlow/data/template-data.ts +308 -308
- package/packages/diagrams/src/lib/templates/systemFlow/demo.tsx +91 -91
- package/packages/diagrams/src/lib/templates/systemFlow/index.ts +5 -5
- package/packages/diagrams/src/lib/templates/systemFlow/nodes/BendpointNode.tsx +80 -80
- package/packages/diagrams/src/lib/templates/systemFlow/nodes/SystemNode.tsx +92 -92
- package/packages/diagrams/src/lib/templates/systemFlow/nodes/TreeSystemNode.tsx +755 -755
- package/packages/diagrams/src/lib/templates/useCaseDiagram/UseCaseDiagram.tsx +16 -16
- package/packages/diagrams/src/lib/templates/useCaseDiagram/components/ActorNodeSettings.tsx +103 -103
- package/packages/diagrams/src/lib/templates/useCaseDiagram/components/AddRelationshipDialog.tsx +186 -186
- package/packages/diagrams/src/lib/templates/useCaseDiagram/components/PackageNodeSettings.tsx +205 -205
- package/packages/diagrams/src/lib/templates/useCaseDiagram/components/UseCaseDiagramFlow.tsx +637 -637
- package/packages/diagrams/src/lib/templates/useCaseDiagram/components/UseCaseNodeSettings.tsx +120 -120
- package/packages/diagrams/src/lib/templates/useCaseDiagram/controls/UseCaseControls.tsx +289 -289
- package/packages/diagrams/src/lib/templates/useCaseDiagram/nodes/PackageNode.tsx +83 -83
- package/packages/diagrams/src/lib/templates/useCaseDiagram/nodes/UseCaseEdge.tsx +115 -115
- package/packages/diagrams/src/lib/templates/useCaseDiagram/nodes/UseCaseNode.tsx +230 -230
- package/packages/diagrams/src/lib/templates/validationSchema.json +277 -277
- package/packages/diagrams/src/lib/theme.ts +439 -439
- package/packages/diagrams/src/lib/types/FunctionSignature.ts +11 -11
- package/packages/diagrams/src/lib/types/SmartDynamicFormField.ts +37 -37
- package/packages/diagrams/src/lib/types/automation-node-data-types.ts +45 -131
- package/packages/diagrams/src/lib/types/available-variables.ts +18 -18
- package/packages/diagrams/src/lib/types/card-node.ts +68 -68
- package/packages/diagrams/src/lib/types/collaboration-types.ts +114 -114
- package/packages/diagrams/src/lib/types/colors.ts +25 -25
- package/packages/diagrams/src/lib/types/condition-builder.ts +18 -18
- package/packages/diagrams/src/lib/types/diagram-types.ts +14 -14
- package/packages/diagrams/src/lib/types/edge-types.ts +39 -39
- package/packages/diagrams/src/lib/types/function-execution.ts +35 -35
- package/packages/diagrams/src/lib/types/hooks.types.ts +6 -6
- package/packages/diagrams/src/lib/types/ndoe-form-types.ts +139 -139
- package/packages/diagrams/src/lib/types/node-types.ts +13 -23
- package/packages/diagrams/src/lib/types/sequence-types.ts +178 -178
- package/packages/diagrams/src/lib/types/shared-node-types.ts +21 -21
- package/packages/diagrams/src/lib/types/state-machine-types.ts +225 -225
- package/packages/diagrams/src/lib/types/stencil-item.ts +7 -7
- package/packages/diagrams/src/lib/types/structures.ts +80 -80
- package/packages/diagrams/src/lib/types/system-flow-types.ts +129 -129
- package/packages/diagrams/src/lib/types/usecase-types.ts +84 -84
- package/packages/diagrams/src/lib/types/validation-types.ts +134 -134
- package/packages/diagrams/src/lib/types/workflow-content-dynamic-form-type.ts +23 -23
- package/packages/diagrams/src/lib/types/workflow-node-data-types.ts +172 -172
- package/packages/diagrams/src/lib/utils/AutomationExecutionEngine.ts +658 -1179
- package/packages/diagrams/src/lib/utils/add-new-block.ts +34 -34
- package/packages/diagrams/src/lib/utils/add-new-node.ts +52 -52
- package/packages/diagrams/src/lib/utils/addToHistory.ts +15 -15
- package/packages/diagrams/src/lib/utils/automation-flow-processor.ts +556 -619
- package/packages/diagrams/src/lib/utils/closestPoint.ts +45 -45
- package/packages/diagrams/src/lib/utils/color-options.tsx +26 -26
- package/packages/diagrams/src/lib/utils/compress-img.ts +59 -59
- package/packages/diagrams/src/lib/utils/configLoader.ts +329 -329
- package/packages/diagrams/src/lib/utils/constant-lengths.ts +8 -8
- package/packages/diagrams/src/lib/utils/create-updated.tsx +40 -40
- package/packages/diagrams/src/lib/utils/createHistoryChange.ts +3 -3
- package/packages/diagrams/src/lib/utils/dividerUtils.tsx +59 -59
- package/packages/diagrams/src/lib/utils/edge-hooks.ts +53 -53
- package/packages/diagrams/src/lib/utils/elkLayout.ts +297 -297
- package/packages/diagrams/src/lib/utils/event-hooks.ts +69 -69
- package/packages/diagrams/src/lib/utils/event-store.ts +58 -58
- package/packages/diagrams/src/lib/utils/flow-node-hooks.ts +28 -28
- package/packages/diagrams/src/lib/utils/flow-to-js.ts +1465 -1465
- package/packages/diagrams/src/lib/utils/functionGenerator.ts +38 -38
- package/packages/diagrams/src/lib/utils/generateEdgesFromNodeOrder.ts +113 -113
- package/packages/diagrams/src/lib/utils/helpers.types.ts +10 -10
- package/packages/diagrams/src/lib/utils/highlightText.tsx +93 -93
- package/packages/diagrams/src/lib/utils/iconMapper.tsx +76 -76
- package/packages/diagrams/src/lib/utils/logger.ts +5 -5
- package/packages/diagrams/src/lib/utils/model-hooks.ts +129 -129
- package/packages/diagrams/src/lib/utils/node-hooks.ts +78 -78
- package/packages/diagrams/src/lib/utils/nodeAIAssistantConfig.ts +54 -54
- package/packages/diagrams/src/lib/utils/nodeOrderByEdges.ts +437 -437
- package/packages/diagrams/src/lib/utils/nodeutils.ts +242 -242
- package/packages/diagrams/src/lib/utils/object.ts +13 -13
- package/packages/diagrams/src/lib/utils/useDebounce.ts +19 -19
- package/packages/diagrams/src/lib/utils/utilities.ts +105 -105
- package/packages/diagrams/src/lib/utils/validationEngine.ts +610 -610
- package/packages/diagrams/src/lib/utils/vhToPixels.ts +9 -9
- package/packages/diagrams/tsconfig.json +21 -21
- package/packages/diagrams/tsconfig.lib.json +26 -25
- package/packages/diagrams/webpack.config.js +17 -17
- package/packages/interfaces/.babelrc +12 -12
- package/packages/interfaces/.eslintrc.json +18 -18
- package/packages/interfaces/README.md +7 -7
- package/packages/interfaces/project.json +8 -8
- package/packages/interfaces/src/index.ts +21 -21
- package/packages/interfaces/src/lib/Button.tsx +1 -1
- package/packages/interfaces/src/lib/DataGrid.ts +14 -14
- package/packages/interfaces/src/lib/StyledBox.tsx +1 -1
- package/packages/interfaces/src/lib/ToolbarItem.ts +7 -7
- package/packages/interfaces/src/lib/UserCard.ts +8 -8
- package/packages/interfaces/src/lib/yup.ts +3 -3
- package/packages/interfaces/tsconfig.json +17 -17
- package/packages/interfaces/tsconfig.lib.json +24 -24
- package/packages/molecules/.babelrc +12 -12
- package/packages/molecules/.eslintrc.json +18 -18
- package/packages/molecules/README.md +7 -7
- package/packages/molecules/project.json +8 -8
- package/packages/molecules/src/index.ts +47 -41
- package/packages/molecules/src/lib/ActionTextField/ActionTextField.module.css +7 -7
- package/packages/molecules/src/lib/ActionTextField/ActionTextField.spec.tsx +10 -10
- package/packages/molecules/src/lib/ActionTextField/ActionTextField.tsx +33 -33
- package/packages/molecules/src/lib/ClosableButton/CloseableButton.module.css +7 -7
- package/packages/molecules/src/lib/ClosableButton/CloseableButton.spec.tsx +11 -11
- package/packages/molecules/src/lib/ClosableButton/CloseableButton.tsx +69 -69
- package/packages/molecules/src/lib/EditorTab/EditorTab.module.css +7 -7
- package/packages/molecules/src/lib/EditorTab/EditorTab.spec.tsx +10 -10
- package/packages/molecules/src/lib/EditorTab/EditorTab.tsx +42 -42
- package/packages/molecules/src/lib/EditorTab/TabPanel.tsx +25 -25
- package/packages/molecules/src/lib/ParamsActionField/ParamsActionField.module.css +7 -7
- package/packages/molecules/src/lib/ParamsActionField/ParamsActionField.spec.tsx +10 -10
- package/packages/molecules/src/lib/ParamsActionField/ParamsActionField.tsx +24 -24
- package/packages/molecules/src/lib/SvgIcons/icons.tsx +323 -291
- package/packages/molecules/src/lib/SvgIcons/index.ts +31 -25
- package/packages/molecules/src/lib/SvgIcons/types.ts +7 -7
- package/packages/molecules/src/lib/TableWithInlineView/TableWithInlineView.module.css +7 -7
- package/packages/molecules/src/lib/TableWithInlineView/TableWithInlineView.spec.tsx +10 -10
- package/packages/molecules/src/lib/TableWithInlineView/TableWithInlineView.tsx +47 -47
- package/packages/molecules/src/lib/UserCard/UserCard.module.css +7 -7
- package/packages/molecules/src/lib/UserCard/UserCard.spec.tsx +11 -11
- package/packages/molecules/src/lib/UserCard/UserCard.tsx +22 -22
- package/packages/molecules/src/lib/VerbSelection/HTTPVerbSelection.module.css +7 -7
- package/packages/molecules/src/lib/VerbSelection/HTTPVerbSelection.spec.tsx +10 -10
- package/packages/molecules/src/lib/VerbSelection/HTTPVerbSelection.tsx +72 -72
- package/packages/molecules/tsconfig.json +17 -17
- package/packages/molecules/tsconfig.lib.json +30 -30
- package/packages/organisms/.babelrc +12 -12
- package/packages/organisms/.eslintrc.json +18 -18
- package/packages/organisms/README.md +7 -7
- package/packages/organisms/project.json +8 -8
- package/packages/organisms/src/index.ts +4 -4
- package/packages/organisms/src/lib/EditorToolbar/EditorToolbar.module.css +7 -7
- package/packages/organisms/src/lib/EditorToolbar/EditorToolbar.spec.tsx +10 -10
- package/packages/organisms/src/lib/EditorToolbar/EditorToolbar.tsx +117 -117
- package/packages/organisms/src/lib/EditorToolbar/SortableItem.tsx +51 -51
- package/packages/organisms/src/lib/UserList/UserList.module.css +7 -7
- package/packages/organisms/src/lib/UserList/UserList.spec.tsx +11 -11
- package/packages/organisms/src/lib/UserList/UserList.tsx +48 -48
- package/packages/organisms/src/lib/UserList/store.ts +49 -49
- package/packages/organisms/tsconfig.json +17 -17
- package/packages/organisms/tsconfig.lib.json +24 -24
- package/packages/zustand/.babelrc +12 -12
- package/packages/zustand/.eslintrc.json +18 -18
- package/packages/zustand/README.md +7 -7
- package/packages/zustand/project.json +8 -8
- package/packages/zustand/src/index.ts +4 -4
- package/packages/zustand/tsconfig.json +17 -17
- package/packages/zustand/tsconfig.lib.json +24 -24
- package/tsconfig.base.json +29 -29
- package/packages/diagrams/src/lib/components/automation/AutomationAISuggestionNode.tsx +0 -304
- package/packages/diagrams/src/lib/components/automation/AutomationEmailNode.tsx +0 -773
- package/packages/diagrams/src/lib/components/automation/AutomationGoogleServicesNode.tsx +0 -779
- package/packages/diagrams/src/lib/components/automation/AutomationNoteNode.tsx +0 -422
- package/packages/diagrams/src/lib/components/automation/AutomationSheetsNode.tsx +0 -1135
- package/packages/diagrams/src/lib/examples/GoogleSheetsConfigurationExamples.ts +0 -306
|
@@ -1,1179 +1,658 @@
|
|
|
1
|
-
import { Node, Edge } from '@xyflow/react';
|
|
2
|
-
import {
|
|
3
|
-
AutomationNodeForm,
|
|
4
|
-
AutomationStartNodeForm,
|
|
5
|
-
AutomationApiNodeForm,
|
|
6
|
-
AutomationFormattingNodeForm,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export interface
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
method
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
errorMessage
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
'
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
);
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
aiConfig.apiKey.
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
);
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
this.
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
this.
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
if (exportOptions.exportFormat === 'both') {
|
|
660
|
-
response = {
|
|
661
|
-
...response,
|
|
662
|
-
excelExport: excelResponse,
|
|
663
|
-
combinedSuccess: response.success && excelResponse.success,
|
|
664
|
-
};
|
|
665
|
-
} else {
|
|
666
|
-
response = excelResponse;
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
// Optional email send (via mailto fallback or Gmail API if implemented)
|
|
671
|
-
if (exportOptions.emailSendEnabled) {
|
|
672
|
-
const emailRecipients = exportOptions.emailRecipients || [];
|
|
673
|
-
if (emailRecipients.length > 0) {
|
|
674
|
-
this.log(
|
|
675
|
-
'info',
|
|
676
|
-
node.id,
|
|
677
|
-
'AutomationSheetsNode',
|
|
678
|
-
`Sending email to ${emailRecipients.length} recipient(s)...`,
|
|
679
|
-
);
|
|
680
|
-
const emailSent = await sheetsService.sendEmail({
|
|
681
|
-
from: exportOptions.emailSender,
|
|
682
|
-
to: emailRecipients,
|
|
683
|
-
subject: exportOptions.emailSubject || 'Automation Output',
|
|
684
|
-
message: exportOptions.emailMessage,
|
|
685
|
-
spreadsheetUrl:
|
|
686
|
-
exportOptions.includeSpreadsheetLink &&
|
|
687
|
-
(response as any)?.spreadsheetUrl
|
|
688
|
-
? (response as any).spreadsheetUrl
|
|
689
|
-
: undefined,
|
|
690
|
-
// Note: attachExcel via Gmail requires Gmail scope and MIME building;
|
|
691
|
-
// mailto cannot attach files. This is a placeholder hook.
|
|
692
|
-
attachExcelBlob: undefined,
|
|
693
|
-
attachExcelFileName: sheetsExportOptions.fileName,
|
|
694
|
-
// Critical: disable UI fallback to ensure fully automated send
|
|
695
|
-
disableUiFallback: true,
|
|
696
|
-
});
|
|
697
|
-
|
|
698
|
-
if (emailSent) {
|
|
699
|
-
this.log(
|
|
700
|
-
'success',
|
|
701
|
-
node.id,
|
|
702
|
-
'AutomationSheetsNode',
|
|
703
|
-
`Email sent to ${emailRecipients.length} recipient(s)`,
|
|
704
|
-
);
|
|
705
|
-
outputStatuses.gmail = 'connected';
|
|
706
|
-
} else {
|
|
707
|
-
this.log(
|
|
708
|
-
'error',
|
|
709
|
-
node.id,
|
|
710
|
-
'AutomationSheetsNode',
|
|
711
|
-
'Email send failed (API)',
|
|
712
|
-
);
|
|
713
|
-
outputStatuses.gmail = 'failed';
|
|
714
|
-
}
|
|
715
|
-
(data as any).outputStatuses = outputStatuses;
|
|
716
|
-
if (this.onNodeUpdate) this.onNodeUpdate(node.id, data);
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
// Optional Slack send via webhook
|
|
721
|
-
if (exportOptions.slack?.enabled) {
|
|
722
|
-
const slackService = new SlackService();
|
|
723
|
-
const validation = slackService.validateConfig(exportOptions.slack);
|
|
724
|
-
if (!validation.valid) {
|
|
725
|
-
throw new Error(
|
|
726
|
-
`Slack configuration invalid: ${validation.errors.join(', ')}`,
|
|
727
|
-
);
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
// Build message text with simple token replacements
|
|
731
|
-
const template =
|
|
732
|
-
exportOptions.slack.messageTemplate ||
|
|
733
|
-
'Automation update for {{fileName}}';
|
|
734
|
-
const contextVars: Record<string, any> = {
|
|
735
|
-
fileName: exportOptions.fileName,
|
|
736
|
-
rowsAdded: (response as any)?.rowsAdded,
|
|
737
|
-
sheetName:
|
|
738
|
-
(response as any)?.sheetName || formData.sheetsConfig?.sheetName,
|
|
739
|
-
};
|
|
740
|
-
const messageText = template.replace(/\{\{(\w+)\}\}/g, (_, key) =>
|
|
741
|
-
key in contextVars ? String(contextVars[key]) : '',
|
|
742
|
-
);
|
|
743
|
-
|
|
744
|
-
// Prefer spreadsheetUrl from Sheets response if available and flag set
|
|
745
|
-
const spreadsheetUrl = exportOptions.slack.includeSpreadsheetLink
|
|
746
|
-
? (response as any)?.spreadsheetUrl || undefined
|
|
747
|
-
: undefined;
|
|
748
|
-
|
|
749
|
-
const payload = slackService.buildPayload(
|
|
750
|
-
exportOptions.slack,
|
|
751
|
-
messageText,
|
|
752
|
-
inputData,
|
|
753
|
-
spreadsheetUrl,
|
|
754
|
-
);
|
|
755
|
-
|
|
756
|
-
try {
|
|
757
|
-
this.log(
|
|
758
|
-
'info',
|
|
759
|
-
node.id,
|
|
760
|
-
'AutomationSheetsNode',
|
|
761
|
-
`Sending Slack message to #${exportOptions.slack.channel}...`,
|
|
762
|
-
);
|
|
763
|
-
await slackService.sendMessage({
|
|
764
|
-
webhookUrl: exportOptions.slack.webhookUrl,
|
|
765
|
-
payload,
|
|
766
|
-
});
|
|
767
|
-
this.log(
|
|
768
|
-
'success',
|
|
769
|
-
node.id,
|
|
770
|
-
'AutomationSheetsNode',
|
|
771
|
-
`Slack message sent to #${exportOptions.slack.channel}`,
|
|
772
|
-
);
|
|
773
|
-
outputStatuses.slack = 'connected';
|
|
774
|
-
(data as any).outputStatuses = outputStatuses;
|
|
775
|
-
if (this.onNodeUpdate) this.onNodeUpdate(node.id, data);
|
|
776
|
-
} catch (slackErr) {
|
|
777
|
-
const msg =
|
|
778
|
-
slackErr instanceof Error ? slackErr.message : String(slackErr);
|
|
779
|
-
this.log(
|
|
780
|
-
'error',
|
|
781
|
-
node.id,
|
|
782
|
-
'AutomationSheetsNode',
|
|
783
|
-
`Slack send failed: ${msg}`,
|
|
784
|
-
);
|
|
785
|
-
// Do not fail the whole workflow due to Slack CORS; mark Slack as failed but continue
|
|
786
|
-
outputStatuses.slack = 'failed';
|
|
787
|
-
(data as any).outputStatuses = outputStatuses;
|
|
788
|
-
if (this.onNodeUpdate) this.onNodeUpdate(node.id, data);
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
// Optional WhatsApp send
|
|
793
|
-
if (exportOptions.whatsapp?.enabled) {
|
|
794
|
-
try {
|
|
795
|
-
this.log(
|
|
796
|
-
'info',
|
|
797
|
-
node.id,
|
|
798
|
-
'AutomationSheetsNode',
|
|
799
|
-
`Sending WhatsApp message to ${exportOptions.whatsapp.phoneNumber}...`,
|
|
800
|
-
);
|
|
801
|
-
|
|
802
|
-
// Build WhatsApp message with template replacements
|
|
803
|
-
const template =
|
|
804
|
-
exportOptions.whatsapp.messageTemplate ||
|
|
805
|
-
'Automation Result: {{fileName}} completed successfully. Rows processed: {{rowsAdded}}.';
|
|
806
|
-
const contextVars: Record<string, any> = {
|
|
807
|
-
fileName: exportOptions.fileName,
|
|
808
|
-
rowsAdded: (response as any)?.rowsAdded,
|
|
809
|
-
sheetName:
|
|
810
|
-
(response as any)?.sheetName || formData.sheetsConfig?.sheetName,
|
|
811
|
-
timestamp: new Date().toLocaleString(),
|
|
812
|
-
};
|
|
813
|
-
const messageText = template.replace(/\{\{(\w+)\}\}/g, (_, key) =>
|
|
814
|
-
key in contextVars ? String(contextVars[key]) : '',
|
|
815
|
-
);
|
|
816
|
-
|
|
817
|
-
// Create WhatsApp message with execution data
|
|
818
|
-
const whatsappMessage = `
|
|
819
|
-
Automation Result:
|
|
820
|
-
------------------
|
|
821
|
-
${messageText}
|
|
822
|
-
|
|
823
|
-
Execution Details:
|
|
824
|
-
- Run ID: ${this.context.runId}
|
|
825
|
-
- Start Time: ${this.context.startTime.toLocaleString()}
|
|
826
|
-
- Status: Completed Successfully
|
|
827
|
-
- Data: ${JSON.stringify(inputData, null, 2)}
|
|
828
|
-
`;
|
|
829
|
-
|
|
830
|
-
// Check if Twilio is configured
|
|
831
|
-
if (exportOptions.whatsapp.twilio?.enabled) {
|
|
832
|
-
// Use Twilio WhatsApp API
|
|
833
|
-
const twilioService = new TwilioWhatsAppService({
|
|
834
|
-
accountSid: exportOptions.whatsapp.twilio.accountSid,
|
|
835
|
-
authToken: exportOptions.whatsapp.twilio.authToken,
|
|
836
|
-
fromNumber: exportOptions.whatsapp.twilio.fromNumber,
|
|
837
|
-
isSandbox: exportOptions.whatsapp.twilio.isSandbox,
|
|
838
|
-
});
|
|
839
|
-
|
|
840
|
-
// Validate Twilio configuration
|
|
841
|
-
const validation = twilioService.validateConfig();
|
|
842
|
-
if (!validation.valid) {
|
|
843
|
-
throw new Error(
|
|
844
|
-
`Twilio configuration invalid: ${validation.errors.join(', ')}`,
|
|
845
|
-
);
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
// Send message via Twilio
|
|
849
|
-
|
|
850
|
-
const twilioResult = await twilioService.sendMessage({
|
|
851
|
-
to: exportOptions.whatsapp.phoneNumber,
|
|
852
|
-
message: whatsappMessage.trim(),
|
|
853
|
-
templateSid: exportOptions.whatsapp.twilio.templateSid,
|
|
854
|
-
templateVariables:
|
|
855
|
-
exportOptions.whatsapp.twilio.templateVariables,
|
|
856
|
-
});
|
|
857
|
-
|
|
858
|
-
if (twilioResult.success) {
|
|
859
|
-
this.log(
|
|
860
|
-
'success',
|
|
861
|
-
node.id,
|
|
862
|
-
'AutomationSheetsNode',
|
|
863
|
-
`WhatsApp message sent via Twilio (SID: ${twilioResult.messageSid})`,
|
|
864
|
-
);
|
|
865
|
-
outputStatuses.whatsapp = 'connected';
|
|
866
|
-
} else {
|
|
867
|
-
throw new Error(`Twilio send failed: ${twilioResult.error}`);
|
|
868
|
-
}
|
|
869
|
-
} else {
|
|
870
|
-
// Fallback to WhatsApp Web (existing behavior)
|
|
871
|
-
const encodedMsg = encodeURIComponent(whatsappMessage.trim());
|
|
872
|
-
const whatsappUrl = `https://wa.me/${exportOptions.whatsapp.phoneNumber}?text=${encodedMsg}`;
|
|
873
|
-
|
|
874
|
-
// Open WhatsApp in a new tab
|
|
875
|
-
window.open(whatsappUrl, '_blank');
|
|
876
|
-
|
|
877
|
-
this.log(
|
|
878
|
-
'success',
|
|
879
|
-
node.id,
|
|
880
|
-
'AutomationSheetsNode',
|
|
881
|
-
`WhatsApp message opened for ${exportOptions.whatsapp.phoneNumber}`,
|
|
882
|
-
);
|
|
883
|
-
outputStatuses.whatsapp = 'connected';
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
(data as any).outputStatuses = outputStatuses;
|
|
887
|
-
if (this.onNodeUpdate) this.onNodeUpdate(node.id, data);
|
|
888
|
-
} catch (whatsappErr) {
|
|
889
|
-
const msg =
|
|
890
|
-
whatsappErr instanceof Error
|
|
891
|
-
? whatsappErr.message
|
|
892
|
-
: String(whatsappErr);
|
|
893
|
-
this.log(
|
|
894
|
-
'error',
|
|
895
|
-
node.id,
|
|
896
|
-
'AutomationSheetsNode',
|
|
897
|
-
`WhatsApp send failed: ${msg}`,
|
|
898
|
-
);
|
|
899
|
-
outputStatuses.whatsapp = 'failed';
|
|
900
|
-
(data as any).outputStatuses = outputStatuses;
|
|
901
|
-
if (this.onNodeUpdate) this.onNodeUpdate(node.id, data);
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
// Store the execution result in node data
|
|
906
|
-
this.storeExecutionResult(node.id, response, true);
|
|
907
|
-
|
|
908
|
-
return response;
|
|
909
|
-
} catch (error) {
|
|
910
|
-
const errorMessage =
|
|
911
|
-
error instanceof Error ? error.message : 'Unknown error';
|
|
912
|
-
this.log(
|
|
913
|
-
'error',
|
|
914
|
-
node.id,
|
|
915
|
-
'AutomationSheetsNode',
|
|
916
|
-
`Google Sheets export failed: ${errorMessage}`,
|
|
917
|
-
);
|
|
918
|
-
|
|
919
|
-
// Mark failing outputs
|
|
920
|
-
const dataRef: any = node.data;
|
|
921
|
-
dataRef.outputStatuses = dataRef.outputStatuses || {};
|
|
922
|
-
// If config missing -> not-set should be turned failed on workflow failure
|
|
923
|
-
const sheetsCfg =
|
|
924
|
-
dataRef.formData?.sheetsConfig || dataRef.sheetsConfig || {};
|
|
925
|
-
const creds = sheetsCfg.credentials || {};
|
|
926
|
-
const gsHasRequired = Boolean(
|
|
927
|
-
(sheetsCfg.spreadsheetId || creds.clientId) &&
|
|
928
|
-
sheetsCfg.sheetName &&
|
|
929
|
-
creds.type,
|
|
930
|
-
);
|
|
931
|
-
dataRef.outputStatuses.googleSheets = gsHasRequired ? 'failed' : 'failed';
|
|
932
|
-
|
|
933
|
-
const ex = dataRef.formData?.exportOptions || dataRef.exportOptions || {};
|
|
934
|
-
const gmHasRequired = Boolean(
|
|
935
|
-
ex.emailSendEnabled &&
|
|
936
|
-
ex.emailSender &&
|
|
937
|
-
(ex.emailRecipients?.length || 0) > 0 &&
|
|
938
|
-
ex.emailSubject &&
|
|
939
|
-
ex.emailMessage,
|
|
940
|
-
);
|
|
941
|
-
if (ex.emailSendEnabled) {
|
|
942
|
-
dataRef.outputStatuses.gmail = gmHasRequired ? 'failed' : 'failed';
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
const sl = ex.slack || {};
|
|
946
|
-
const slackHasRequired = Boolean(
|
|
947
|
-
sl.enabled && sl.webhookUrl && sl.channel,
|
|
948
|
-
);
|
|
949
|
-
if (sl.enabled) {
|
|
950
|
-
dataRef.outputStatuses.slack = slackHasRequired ? 'failed' : 'failed';
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
const wa = ex.whatsapp || {};
|
|
954
|
-
const whatsappHasRequired = Boolean(wa.enabled && wa.phoneNumber);
|
|
955
|
-
if (wa.enabled) {
|
|
956
|
-
dataRef.outputStatuses.whatsapp = whatsappHasRequired
|
|
957
|
-
? 'failed'
|
|
958
|
-
: 'failed';
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
if (this.onNodeUpdate) this.onNodeUpdate(node.id, dataRef);
|
|
962
|
-
|
|
963
|
-
// Store the execution result in node data
|
|
964
|
-
this.storeExecutionResult(node.id, null, false, errorMessage);
|
|
965
|
-
|
|
966
|
-
throw error;
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
private getNestedValue(obj: any, path: string): any {
|
|
971
|
-
return path.split('.').reduce((current, key) => current?.[key], obj);
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
private formatValueForSheets(value: any, dataType: string): any {
|
|
975
|
-
if (value === null || value === undefined) {
|
|
976
|
-
return '';
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
switch (dataType) {
|
|
980
|
-
case 'string':
|
|
981
|
-
return String(value);
|
|
982
|
-
case 'number':
|
|
983
|
-
return Number(value);
|
|
984
|
-
case 'date':
|
|
985
|
-
return new Date(value).toISOString();
|
|
986
|
-
case 'boolean':
|
|
987
|
-
return Boolean(value);
|
|
988
|
-
default:
|
|
989
|
-
return String(value);
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
private async executeEndNode(
|
|
994
|
-
node: Node,
|
|
995
|
-
inputData: string | number | boolean | object | null,
|
|
996
|
-
): Promise<string | number | boolean | object | null> {
|
|
997
|
-
const data = node.data;
|
|
998
|
-
const formData = (data.formData || data) as AutomationEndNodeForm;
|
|
999
|
-
|
|
1000
|
-
this.log(
|
|
1001
|
-
'info',
|
|
1002
|
-
node.id,
|
|
1003
|
-
'AutomationEndNode',
|
|
1004
|
-
'Workflow completed successfully',
|
|
1005
|
-
);
|
|
1006
|
-
|
|
1007
|
-
// Handle different output types
|
|
1008
|
-
switch (formData.outputType) {
|
|
1009
|
-
case 'display':
|
|
1010
|
-
this.log(
|
|
1011
|
-
'info',
|
|
1012
|
-
node.id,
|
|
1013
|
-
'AutomationEndNode',
|
|
1014
|
-
'Output displayed in UI',
|
|
1015
|
-
inputData,
|
|
1016
|
-
);
|
|
1017
|
-
break;
|
|
1018
|
-
case 'store':
|
|
1019
|
-
this.log(
|
|
1020
|
-
'info',
|
|
1021
|
-
node.id,
|
|
1022
|
-
'AutomationEndNode',
|
|
1023
|
-
'Data stored to destination',
|
|
1024
|
-
inputData,
|
|
1025
|
-
);
|
|
1026
|
-
break;
|
|
1027
|
-
case 'send':
|
|
1028
|
-
this.log(
|
|
1029
|
-
'info',
|
|
1030
|
-
node.id,
|
|
1031
|
-
'AutomationEndNode',
|
|
1032
|
-
'Data sent to destination',
|
|
1033
|
-
inputData,
|
|
1034
|
-
);
|
|
1035
|
-
break;
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
// Store the execution result in node data
|
|
1039
|
-
this.storeExecutionResult(node.id, inputData, true);
|
|
1040
|
-
|
|
1041
|
-
return inputData;
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
private async executeNode(
|
|
1045
|
-
node: Node,
|
|
1046
|
-
inputData?: string | number | boolean | object | null,
|
|
1047
|
-
): Promise<string | number | boolean | object | null> {
|
|
1048
|
-
const nodeType = node.type;
|
|
1049
|
-
|
|
1050
|
-
switch (nodeType) {
|
|
1051
|
-
case 'AutomationStartNode':
|
|
1052
|
-
return await this.executeStartNode(node);
|
|
1053
|
-
case 'AutomationApiNode':
|
|
1054
|
-
return await this.executeApiNode(node);
|
|
1055
|
-
case 'AutomationFormattingNode':
|
|
1056
|
-
return await this.executeFormattingNode(node, inputData || null);
|
|
1057
|
-
case 'AutomationSheetsNode':
|
|
1058
|
-
return await this.executeSheetsNode(node, inputData || null);
|
|
1059
|
-
case 'AutomationEndNode':
|
|
1060
|
-
return await this.executeEndNode(node, inputData || null);
|
|
1061
|
-
default:
|
|
1062
|
-
throw new Error(`Unknown node type: ${nodeType}`);
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
public async executeWorkflow(): Promise<AutomationResult> {
|
|
1067
|
-
try {
|
|
1068
|
-
// Find start node
|
|
1069
|
-
const startNode = this.nodes.find(
|
|
1070
|
-
(node) => node.type === 'AutomationStartNode',
|
|
1071
|
-
);
|
|
1072
|
-
if (!startNode) {
|
|
1073
|
-
throw new Error('No start node found in workflow');
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
this.log('info', 'workflow', 'engine', 'Starting workflow execution');
|
|
1077
|
-
|
|
1078
|
-
// Execute nodes in sequence
|
|
1079
|
-
let currentNode: Node | null = startNode;
|
|
1080
|
-
let currentData: string | number | boolean | object | null = null;
|
|
1081
|
-
const visitedNodes = new Set<string>();
|
|
1082
|
-
|
|
1083
|
-
while (currentNode) {
|
|
1084
|
-
if (visitedNodes.has(currentNode.id)) {
|
|
1085
|
-
throw new Error(
|
|
1086
|
-
`Circular dependency detected: node ${currentNode.id} already visited`,
|
|
1087
|
-
);
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
visitedNodes.add(currentNode.id);
|
|
1091
|
-
|
|
1092
|
-
// Announce node execution start
|
|
1093
|
-
this.log(
|
|
1094
|
-
'info',
|
|
1095
|
-
currentNode.id,
|
|
1096
|
-
String(currentNode.type || 'node'),
|
|
1097
|
-
'Executing node...',
|
|
1098
|
-
);
|
|
1099
|
-
|
|
1100
|
-
// Update node status to running
|
|
1101
|
-
(currentNode.data as Record<string, unknown>).status = 'Running';
|
|
1102
|
-
if (this.onNodeUpdate) {
|
|
1103
|
-
// Create new object reference so React detects the change
|
|
1104
|
-
this.onNodeUpdate(currentNode.id, { ...currentNode.data });
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
try {
|
|
1108
|
-
currentData = await this.executeNode(currentNode, currentData);
|
|
1109
|
-
(currentNode.data as Record<string, unknown>).status = 'Completed';
|
|
1110
|
-
(currentNode.data as Record<string, unknown>).lastRun =
|
|
1111
|
-
new Date().toISOString();
|
|
1112
|
-
if (this.onNodeUpdate) {
|
|
1113
|
-
// Create new object reference so React detects the change
|
|
1114
|
-
this.onNodeUpdate(currentNode.id, { ...currentNode.data });
|
|
1115
|
-
}
|
|
1116
|
-
} catch (error) {
|
|
1117
|
-
(currentNode.data as Record<string, unknown>).status = 'Error';
|
|
1118
|
-
(currentNode.data as Record<string, unknown>).lastRun =
|
|
1119
|
-
new Date().toISOString();
|
|
1120
|
-
if (this.onNodeUpdate) {
|
|
1121
|
-
// Create new object reference so React detects the change
|
|
1122
|
-
this.onNodeUpdate(currentNode.id, { ...currentNode.data });
|
|
1123
|
-
}
|
|
1124
|
-
throw error;
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
// Find next node
|
|
1128
|
-
const nextNodes = this.getNextNodes(currentNode.id);
|
|
1129
|
-
if (nextNodes.length > 0) {
|
|
1130
|
-
const next = nextNodes[0];
|
|
1131
|
-
this.log(
|
|
1132
|
-
'info',
|
|
1133
|
-
next.id,
|
|
1134
|
-
String(next.type || 'node'),
|
|
1135
|
-
'Moving to next node',
|
|
1136
|
-
);
|
|
1137
|
-
currentNode = next;
|
|
1138
|
-
} else {
|
|
1139
|
-
this.log('info', 'workflow', 'engine', 'No next node. Ending.');
|
|
1140
|
-
currentNode = null;
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
this.log(
|
|
1145
|
-
'success',
|
|
1146
|
-
'workflow',
|
|
1147
|
-
'engine',
|
|
1148
|
-
'Workflow execution completed successfully',
|
|
1149
|
-
);
|
|
1150
|
-
|
|
1151
|
-
return {
|
|
1152
|
-
success: true,
|
|
1153
|
-
context: this.context,
|
|
1154
|
-
finalOutput: currentData,
|
|
1155
|
-
};
|
|
1156
|
-
} catch (error) {
|
|
1157
|
-
this.log(
|
|
1158
|
-
'error',
|
|
1159
|
-
'workflow',
|
|
1160
|
-
'engine',
|
|
1161
|
-
`Workflow execution failed: ${error}`,
|
|
1162
|
-
);
|
|
1163
|
-
|
|
1164
|
-
return {
|
|
1165
|
-
success: false,
|
|
1166
|
-
context: this.context,
|
|
1167
|
-
error: error instanceof Error ? error.message : String(error),
|
|
1168
|
-
};
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
public getLogs(): AutomationLog[] {
|
|
1173
|
-
return this.context.logs;
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
public getContext(): AutomationContext {
|
|
1177
|
-
return this.context;
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1
|
+
import { Node, Edge } from '@xyflow/react';
|
|
2
|
+
import {
|
|
3
|
+
AutomationNodeForm,
|
|
4
|
+
AutomationStartNodeForm,
|
|
5
|
+
AutomationApiNodeForm,
|
|
6
|
+
AutomationFormattingNodeForm,
|
|
7
|
+
AutomationEndNodeForm,
|
|
8
|
+
} from '../types/automation-node-data-types';
|
|
9
|
+
|
|
10
|
+
export interface AutomationContext {
|
|
11
|
+
runId: string;
|
|
12
|
+
startTime: Date;
|
|
13
|
+
variables: Record<string, string | number | boolean | object | null>;
|
|
14
|
+
logs: AutomationLog[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface AutomationLog {
|
|
18
|
+
timestamp: Date;
|
|
19
|
+
nodeId: string;
|
|
20
|
+
nodeType: string;
|
|
21
|
+
level: 'info' | 'warning' | 'error' | 'success';
|
|
22
|
+
message: string;
|
|
23
|
+
data?: string | number | boolean | object | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface AutomationResult {
|
|
27
|
+
success: boolean;
|
|
28
|
+
context: AutomationContext;
|
|
29
|
+
finalOutput?: string | number | boolean | object | null;
|
|
30
|
+
error?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class AutomationExecutionEngine {
|
|
34
|
+
private nodes: Node[];
|
|
35
|
+
private edges: Edge[];
|
|
36
|
+
private context: AutomationContext;
|
|
37
|
+
private onNodeUpdate?: (nodeId: string, updatedData: any) => void;
|
|
38
|
+
private onLog?: (log: AutomationLog) => void;
|
|
39
|
+
|
|
40
|
+
constructor(
|
|
41
|
+
nodes: Node[],
|
|
42
|
+
edges: Edge[],
|
|
43
|
+
onNodeUpdate?: (nodeId: string, updatedData: any) => void,
|
|
44
|
+
onLog?: (log: AutomationLog) => void,
|
|
45
|
+
) {
|
|
46
|
+
this.nodes = nodes;
|
|
47
|
+
this.edges = edges;
|
|
48
|
+
this.onNodeUpdate = onNodeUpdate;
|
|
49
|
+
this.onLog = onLog;
|
|
50
|
+
this.context = {
|
|
51
|
+
runId: this.generateRunId(),
|
|
52
|
+
startTime: new Date(),
|
|
53
|
+
variables: {},
|
|
54
|
+
logs: [],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private generateRunId(): string {
|
|
59
|
+
return `run_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private storeExecutionResult(
|
|
63
|
+
nodeId: string,
|
|
64
|
+
result: string | number | boolean | object | null,
|
|
65
|
+
success: boolean = true,
|
|
66
|
+
error?: string,
|
|
67
|
+
executionTime?: number,
|
|
68
|
+
): void {
|
|
69
|
+
const node = this.nodes.find((n) => n.id === nodeId);
|
|
70
|
+
if (!node) return;
|
|
71
|
+
|
|
72
|
+
const executionResult = {
|
|
73
|
+
success,
|
|
74
|
+
data: result,
|
|
75
|
+
timestamp: new Date().toISOString(),
|
|
76
|
+
error,
|
|
77
|
+
executionTime,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// Update the node's formData with execution result
|
|
81
|
+
if (node.data.formData) {
|
|
82
|
+
(node.data.formData as any).executionResult = executionResult;
|
|
83
|
+
} else {
|
|
84
|
+
(node.data as any).executionResult = executionResult;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Notify the parent component about the node update
|
|
88
|
+
if (this.onNodeUpdate) {
|
|
89
|
+
// Create new object reference with deep clone of formData so React detects the change
|
|
90
|
+
const updatedData = {
|
|
91
|
+
...node.data,
|
|
92
|
+
...(node.data.formData ? { formData: { ...node.data.formData } } : {}),
|
|
93
|
+
};
|
|
94
|
+
this.onNodeUpdate(nodeId, updatedData);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private log(
|
|
99
|
+
level: AutomationLog['level'],
|
|
100
|
+
nodeId: string,
|
|
101
|
+
nodeType: string,
|
|
102
|
+
message: string,
|
|
103
|
+
data?: string | number | boolean | object | null,
|
|
104
|
+
) {
|
|
105
|
+
const entry: AutomationLog = {
|
|
106
|
+
timestamp: new Date(),
|
|
107
|
+
nodeId,
|
|
108
|
+
nodeType,
|
|
109
|
+
level,
|
|
110
|
+
message,
|
|
111
|
+
data,
|
|
112
|
+
};
|
|
113
|
+
this.context.logs.push(entry);
|
|
114
|
+
if (this.onLog) {
|
|
115
|
+
try {
|
|
116
|
+
this.onLog(entry);
|
|
117
|
+
} catch {
|
|
118
|
+
// ignore UI callback errors
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private getNextNodes(currentNodeId: string): Node[] {
|
|
124
|
+
const outgoingEdges = this.edges.filter(
|
|
125
|
+
(edge) => edge.source === currentNodeId,
|
|
126
|
+
);
|
|
127
|
+
const nextNodeIds = outgoingEdges.map((edge) => edge.target);
|
|
128
|
+
return this.nodes.filter((node) => nextNodeIds.includes(node.id));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private async executeStartNode(
|
|
132
|
+
node: Node,
|
|
133
|
+
): Promise<{ runId: string; startTime: string }> {
|
|
134
|
+
const data = node.data;
|
|
135
|
+
this.log(
|
|
136
|
+
'info',
|
|
137
|
+
node.id,
|
|
138
|
+
'AutomationStartNode',
|
|
139
|
+
'Starting automation workflow',
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// Set initial context variables
|
|
143
|
+
this.context.variables.runId = this.context.runId;
|
|
144
|
+
this.context.variables.startTime = this.context.startTime.toISOString();
|
|
145
|
+
|
|
146
|
+
const result = {
|
|
147
|
+
runId: this.context.runId,
|
|
148
|
+
startTime: this.context.startTime.toISOString(),
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Store the execution result in node data
|
|
152
|
+
this.storeExecutionResult(node.id, result, true);
|
|
153
|
+
|
|
154
|
+
return result;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
private async executeApiNode(node: Node): Promise<object> {
|
|
158
|
+
const data = node.data;
|
|
159
|
+
const formData = (data.formData || data) as AutomationApiNodeForm;
|
|
160
|
+
|
|
161
|
+
this.log(
|
|
162
|
+
'info',
|
|
163
|
+
node.id,
|
|
164
|
+
'AutomationApiNode',
|
|
165
|
+
`Making ${formData.method} request to ${formData.url}`,
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
try {
|
|
169
|
+
const headers: Record<string, string> = {};
|
|
170
|
+
if (formData.headers && Array.isArray(formData.headers)) {
|
|
171
|
+
formData.headers.forEach((header) => {
|
|
172
|
+
if (header.enabled) {
|
|
173
|
+
headers[header.key] = header.value;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const queryParams = new URLSearchParams();
|
|
179
|
+
if (formData.queryParams && Array.isArray(formData.queryParams)) {
|
|
180
|
+
formData.queryParams.forEach((param) => {
|
|
181
|
+
if (param.enabled) {
|
|
182
|
+
queryParams.append(param.key, param.value);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const url = queryParams.toString()
|
|
188
|
+
? `${formData.url}?${queryParams.toString()}`
|
|
189
|
+
: formData.url;
|
|
190
|
+
|
|
191
|
+
const requestOptions: RequestInit = {
|
|
192
|
+
method: formData.method,
|
|
193
|
+
headers,
|
|
194
|
+
signal: AbortSignal.timeout(formData.timeout || 30000),
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
if (
|
|
198
|
+
formData.body &&
|
|
199
|
+
(formData.method === 'POST' || formData.method === 'PUT')
|
|
200
|
+
) {
|
|
201
|
+
requestOptions.body = formData.body;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const response = await fetch(url, requestOptions);
|
|
205
|
+
|
|
206
|
+
if (!response.ok) {
|
|
207
|
+
throw new Error(
|
|
208
|
+
`HTTP ${response.status}: ${response.statusText} - ${url}`,
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const responseData = await response.json();
|
|
213
|
+
this.log(
|
|
214
|
+
'success',
|
|
215
|
+
node.id,
|
|
216
|
+
'AutomationApiNode',
|
|
217
|
+
'API call completed successfully',
|
|
218
|
+
responseData,
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
// Store the execution result in node data
|
|
222
|
+
this.storeExecutionResult(node.id, responseData, true);
|
|
223
|
+
|
|
224
|
+
return responseData;
|
|
225
|
+
} catch (error) {
|
|
226
|
+
let errorMessage = `API call failed: ${error}`;
|
|
227
|
+
|
|
228
|
+
if (error instanceof TypeError && error.message.includes('fetch')) {
|
|
229
|
+
errorMessage = `Network error: Unable to connect to ${formData.url}. This might be due to CORS restrictions or network connectivity issues.`;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
this.log(
|
|
233
|
+
'error',
|
|
234
|
+
node.id,
|
|
235
|
+
'AutomationApiNode',
|
|
236
|
+
errorMessage,
|
|
237
|
+
error instanceof Error ? error.message : String(error),
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
// Store the error result in node data
|
|
241
|
+
this.storeExecutionResult(node.id, null, false, errorMessage);
|
|
242
|
+
|
|
243
|
+
throw new Error(errorMessage);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
private async executeFormattingNode(
|
|
248
|
+
node: Node,
|
|
249
|
+
inputData: string | number | boolean | object | null,
|
|
250
|
+
): Promise<string | number | boolean | object | null> {
|
|
251
|
+
const data = node.data;
|
|
252
|
+
const formData = (data.formData || data) as AutomationFormattingNodeForm;
|
|
253
|
+
|
|
254
|
+
this.log(
|
|
255
|
+
'info',
|
|
256
|
+
node.id,
|
|
257
|
+
'AutomationFormattingNode',
|
|
258
|
+
'Starting data formatting',
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
try {
|
|
262
|
+
if (formData.formattingType === 'ai-powered' && formData.aiFormatting) {
|
|
263
|
+
// AI-powered formatting
|
|
264
|
+
this.log('info', node.id, 'AutomationFormattingNode', 'AI thinking...');
|
|
265
|
+
const aiResponse = await this.callAiApi(
|
|
266
|
+
formData.aiFormatting,
|
|
267
|
+
inputData,
|
|
268
|
+
);
|
|
269
|
+
this.log(
|
|
270
|
+
'success',
|
|
271
|
+
node.id,
|
|
272
|
+
'AutomationFormattingNode',
|
|
273
|
+
'AI formatting completed',
|
|
274
|
+
aiResponse,
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
// Store the execution result in node data
|
|
278
|
+
this.storeExecutionResult(node.id, aiResponse, true);
|
|
279
|
+
|
|
280
|
+
return aiResponse;
|
|
281
|
+
} else {
|
|
282
|
+
// Basic formatting
|
|
283
|
+
const formattedData = this.basicFormatting(inputData, formData);
|
|
284
|
+
this.log(
|
|
285
|
+
'success',
|
|
286
|
+
node.id,
|
|
287
|
+
'AutomationFormattingNode',
|
|
288
|
+
'Basic formatting completed',
|
|
289
|
+
formattedData,
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
// Store the execution result in node data
|
|
293
|
+
this.storeExecutionResult(node.id, formattedData, true);
|
|
294
|
+
|
|
295
|
+
return formattedData;
|
|
296
|
+
}
|
|
297
|
+
} catch (error) {
|
|
298
|
+
this.log(
|
|
299
|
+
'error',
|
|
300
|
+
node.id,
|
|
301
|
+
'AutomationFormattingNode',
|
|
302
|
+
`Formatting failed: ${error}`,
|
|
303
|
+
error instanceof Error ? error.message : String(error),
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
// Store the error result in node data
|
|
307
|
+
this.storeExecutionResult(
|
|
308
|
+
node.id,
|
|
309
|
+
null,
|
|
310
|
+
false,
|
|
311
|
+
error instanceof Error ? error.message : String(error),
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
throw error;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
private async callAiApi(
|
|
319
|
+
aiConfig: NonNullable<AutomationFormattingNodeForm['aiFormatting']>,
|
|
320
|
+
inputData: string | number | boolean | object | null,
|
|
321
|
+
): Promise<string | number | boolean | object | null> {
|
|
322
|
+
// Validate API key is not a placeholder
|
|
323
|
+
if (
|
|
324
|
+
!aiConfig.apiKey ||
|
|
325
|
+
aiConfig.apiKey.includes('your-openai-api-key-here') ||
|
|
326
|
+
aiConfig.apiKey.length < 10
|
|
327
|
+
) {
|
|
328
|
+
throw new Error('Invalid API key. Please provide a valid API key.');
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Additional validation for Gemini API key format
|
|
332
|
+
if (aiConfig.apiUrl.includes('generativelanguage.googleapis.com')) {
|
|
333
|
+
if (!aiConfig.apiKey.startsWith('AIza')) {
|
|
334
|
+
throw new Error(
|
|
335
|
+
'Invalid Gemini API key format. Gemini API keys should start with "AIza".',
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const prompt = `${aiConfig.instruction}\n\nInput data: ${JSON.stringify(inputData)}`;
|
|
341
|
+
|
|
342
|
+
// Determine if this is Gemini API or OpenAI API based on URL
|
|
343
|
+
const isGeminiApi = aiConfig.apiUrl.includes(
|
|
344
|
+
'generativelanguage.googleapis.com',
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
let requestBody: any;
|
|
348
|
+
let headers: Record<string, string>;
|
|
349
|
+
|
|
350
|
+
if (isGeminiApi) {
|
|
351
|
+
// Gemini API format
|
|
352
|
+
headers = {
|
|
353
|
+
'Content-Type': 'application/json',
|
|
354
|
+
'X-goog-api-key': aiConfig.apiKey,
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
requestBody = {
|
|
358
|
+
contents: [
|
|
359
|
+
{
|
|
360
|
+
parts: [
|
|
361
|
+
{
|
|
362
|
+
text: `${aiConfig.systemPrompt || 'You are a data formatting assistant.'}\n\n${prompt}`,
|
|
363
|
+
},
|
|
364
|
+
],
|
|
365
|
+
},
|
|
366
|
+
],
|
|
367
|
+
generationConfig: {
|
|
368
|
+
temperature: aiConfig.temperature || 0.1,
|
|
369
|
+
maxOutputTokens: aiConfig.maxTokens || 1000,
|
|
370
|
+
responseMimeType: 'application/json',
|
|
371
|
+
},
|
|
372
|
+
};
|
|
373
|
+
} else {
|
|
374
|
+
// OpenAI API format
|
|
375
|
+
headers = {
|
|
376
|
+
'Content-Type': 'application/json',
|
|
377
|
+
Authorization: `Bearer ${aiConfig.apiKey}`,
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
requestBody = {
|
|
381
|
+
model: aiConfig.model,
|
|
382
|
+
messages: [
|
|
383
|
+
{
|
|
384
|
+
role: 'system',
|
|
385
|
+
content:
|
|
386
|
+
aiConfig.systemPrompt || 'You are a data formatting assistant.',
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
role: 'user',
|
|
390
|
+
content: prompt,
|
|
391
|
+
},
|
|
392
|
+
],
|
|
393
|
+
temperature: aiConfig.temperature || 0.1,
|
|
394
|
+
max_tokens: aiConfig.maxTokens || 1000,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const response = await fetch(aiConfig.apiUrl, {
|
|
399
|
+
method: 'POST',
|
|
400
|
+
headers,
|
|
401
|
+
body: JSON.stringify(requestBody),
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
if (!response.ok) {
|
|
405
|
+
const errorText = await response.text();
|
|
406
|
+
throw new Error(
|
|
407
|
+
`AI API call failed: ${response.status} ${response.statusText}. ${errorText}`,
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const result = await response.json();
|
|
412
|
+
|
|
413
|
+
let content: string;
|
|
414
|
+
|
|
415
|
+
if (isGeminiApi) {
|
|
416
|
+
// Gemini API response format
|
|
417
|
+
if (
|
|
418
|
+
!result.candidates ||
|
|
419
|
+
!result.candidates[0] ||
|
|
420
|
+
!result.candidates[0].content ||
|
|
421
|
+
!result.candidates[0].content.parts
|
|
422
|
+
) {
|
|
423
|
+
throw new Error('Invalid Gemini API response format');
|
|
424
|
+
}
|
|
425
|
+
content = result.candidates[0].content.parts[0].text;
|
|
426
|
+
} else {
|
|
427
|
+
// OpenAI API response format
|
|
428
|
+
if (!result.choices || !result.choices[0] || !result.choices[0].message) {
|
|
429
|
+
throw new Error('Invalid AI API response format');
|
|
430
|
+
}
|
|
431
|
+
content = result.choices[0].message.content;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Try to parse as JSON, fallback to string if parsing fails
|
|
435
|
+
try {
|
|
436
|
+
return JSON.parse(content);
|
|
437
|
+
} catch {
|
|
438
|
+
return content;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
private basicFormatting(
|
|
443
|
+
inputData: string | number | boolean | object | null,
|
|
444
|
+
config: AutomationFormattingNodeForm,
|
|
445
|
+
): string | number | boolean | object | null {
|
|
446
|
+
// Basic data transformation logic
|
|
447
|
+
if (typeof inputData === 'string') {
|
|
448
|
+
return inputData.trim();
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
if (Array.isArray(inputData)) {
|
|
452
|
+
return inputData.map((item) => this.basicFormatting(item, config));
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if (typeof inputData === 'object' && inputData !== null) {
|
|
456
|
+
const formatted: Record<string, unknown> = {};
|
|
457
|
+
Object.keys(inputData).forEach((key) => {
|
|
458
|
+
formatted[key] = this.basicFormatting(
|
|
459
|
+
(inputData as Record<string, unknown>)[key] as
|
|
460
|
+
| string
|
|
461
|
+
| number
|
|
462
|
+
| boolean
|
|
463
|
+
| object
|
|
464
|
+
| null,
|
|
465
|
+
config,
|
|
466
|
+
);
|
|
467
|
+
});
|
|
468
|
+
return formatted;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
return inputData;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
private async executeEndNode(
|
|
475
|
+
node: Node,
|
|
476
|
+
inputData: string | number | boolean | object | null,
|
|
477
|
+
): Promise<string | number | boolean | object | null> {
|
|
478
|
+
const data = node.data;
|
|
479
|
+
const formData = (data.formData || data) as AutomationEndNodeForm;
|
|
480
|
+
|
|
481
|
+
this.log(
|
|
482
|
+
'info',
|
|
483
|
+
node.id,
|
|
484
|
+
'AutomationEndNode',
|
|
485
|
+
'Workflow completed successfully',
|
|
486
|
+
);
|
|
487
|
+
|
|
488
|
+
// Handle different output types
|
|
489
|
+
switch (formData.outputType) {
|
|
490
|
+
case 'display':
|
|
491
|
+
this.log(
|
|
492
|
+
'info',
|
|
493
|
+
node.id,
|
|
494
|
+
'AutomationEndNode',
|
|
495
|
+
'Output displayed in UI',
|
|
496
|
+
inputData,
|
|
497
|
+
);
|
|
498
|
+
break;
|
|
499
|
+
case 'store':
|
|
500
|
+
this.log(
|
|
501
|
+
'info',
|
|
502
|
+
node.id,
|
|
503
|
+
'AutomationEndNode',
|
|
504
|
+
'Data stored to destination',
|
|
505
|
+
inputData,
|
|
506
|
+
);
|
|
507
|
+
break;
|
|
508
|
+
case 'send':
|
|
509
|
+
this.log(
|
|
510
|
+
'info',
|
|
511
|
+
node.id,
|
|
512
|
+
'AutomationEndNode',
|
|
513
|
+
'Data sent to destination',
|
|
514
|
+
inputData,
|
|
515
|
+
);
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// Store the execution result in node data
|
|
520
|
+
this.storeExecutionResult(node.id, inputData, true);
|
|
521
|
+
|
|
522
|
+
return inputData;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
private async executeNode(
|
|
526
|
+
node: Node,
|
|
527
|
+
inputData?: string | number | boolean | object | null,
|
|
528
|
+
): Promise<string | number | boolean | object | null> {
|
|
529
|
+
const nodeType = node.type;
|
|
530
|
+
|
|
531
|
+
switch (nodeType) {
|
|
532
|
+
case 'AutomationStartNode':
|
|
533
|
+
return await this.executeStartNode(node);
|
|
534
|
+
case 'AutomationApiNode':
|
|
535
|
+
return await this.executeApiNode(node);
|
|
536
|
+
case 'AutomationFormattingNode':
|
|
537
|
+
return await this.executeFormattingNode(node, inputData || null);
|
|
538
|
+
case 'AutomationEndNode':
|
|
539
|
+
return await this.executeEndNode(node, inputData || null);
|
|
540
|
+
default:
|
|
541
|
+
throw new Error(`Unknown node type: ${nodeType}`);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
public async executeWorkflow(): Promise<AutomationResult> {
|
|
546
|
+
try {
|
|
547
|
+
// Find start node
|
|
548
|
+
const startNode = this.nodes.find(
|
|
549
|
+
(node) => node.type === 'AutomationStartNode',
|
|
550
|
+
);
|
|
551
|
+
if (!startNode) {
|
|
552
|
+
throw new Error('No start node found in workflow');
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
this.log('info', 'workflow', 'engine', 'Starting workflow execution');
|
|
556
|
+
|
|
557
|
+
// Execute nodes in sequence
|
|
558
|
+
let currentNode: Node | null = startNode;
|
|
559
|
+
let currentData: string | number | boolean | object | null = null;
|
|
560
|
+
const visitedNodes = new Set<string>();
|
|
561
|
+
|
|
562
|
+
while (currentNode) {
|
|
563
|
+
if (visitedNodes.has(currentNode.id)) {
|
|
564
|
+
throw new Error(
|
|
565
|
+
`Circular dependency detected: node ${currentNode.id} already visited`,
|
|
566
|
+
);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
visitedNodes.add(currentNode.id);
|
|
570
|
+
|
|
571
|
+
// Announce node execution start
|
|
572
|
+
this.log(
|
|
573
|
+
'info',
|
|
574
|
+
currentNode.id,
|
|
575
|
+
String(currentNode.type || 'node'),
|
|
576
|
+
'Executing node...',
|
|
577
|
+
);
|
|
578
|
+
|
|
579
|
+
// Update node status to running
|
|
580
|
+
(currentNode.data as Record<string, unknown>).status = 'Running';
|
|
581
|
+
if (this.onNodeUpdate) {
|
|
582
|
+
// Create new object reference so React detects the change
|
|
583
|
+
this.onNodeUpdate(currentNode.id, { ...currentNode.data });
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
try {
|
|
587
|
+
currentData = await this.executeNode(currentNode, currentData);
|
|
588
|
+
(currentNode.data as Record<string, unknown>).status = 'Completed';
|
|
589
|
+
(currentNode.data as Record<string, unknown>).lastRun =
|
|
590
|
+
new Date().toISOString();
|
|
591
|
+
if (this.onNodeUpdate) {
|
|
592
|
+
// Create new object reference so React detects the change
|
|
593
|
+
this.onNodeUpdate(currentNode.id, { ...currentNode.data });
|
|
594
|
+
}
|
|
595
|
+
} catch (error) {
|
|
596
|
+
(currentNode.data as Record<string, unknown>).status = 'Error';
|
|
597
|
+
(currentNode.data as Record<string, unknown>).lastRun =
|
|
598
|
+
new Date().toISOString();
|
|
599
|
+
if (this.onNodeUpdate) {
|
|
600
|
+
// Create new object reference so React detects the change
|
|
601
|
+
this.onNodeUpdate(currentNode.id, { ...currentNode.data });
|
|
602
|
+
}
|
|
603
|
+
throw error;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
// Find next node
|
|
607
|
+
const nextNodes = this.getNextNodes(currentNode.id);
|
|
608
|
+
if (nextNodes.length > 0) {
|
|
609
|
+
const next = nextNodes[0];
|
|
610
|
+
this.log(
|
|
611
|
+
'info',
|
|
612
|
+
next.id,
|
|
613
|
+
String(next.type || 'node'),
|
|
614
|
+
'Moving to next node',
|
|
615
|
+
);
|
|
616
|
+
currentNode = next;
|
|
617
|
+
} else {
|
|
618
|
+
this.log('info', 'workflow', 'engine', 'No next node. Ending.');
|
|
619
|
+
currentNode = null;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
this.log(
|
|
624
|
+
'success',
|
|
625
|
+
'workflow',
|
|
626
|
+
'engine',
|
|
627
|
+
'Workflow execution completed successfully',
|
|
628
|
+
);
|
|
629
|
+
|
|
630
|
+
return {
|
|
631
|
+
success: true,
|
|
632
|
+
context: this.context,
|
|
633
|
+
finalOutput: currentData,
|
|
634
|
+
};
|
|
635
|
+
} catch (error) {
|
|
636
|
+
this.log(
|
|
637
|
+
'error',
|
|
638
|
+
'workflow',
|
|
639
|
+
'engine',
|
|
640
|
+
`Workflow execution failed: ${error}`,
|
|
641
|
+
);
|
|
642
|
+
|
|
643
|
+
return {
|
|
644
|
+
success: false,
|
|
645
|
+
context: this.context,
|
|
646
|
+
error: error instanceof Error ? error.message : String(error),
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
public getLogs(): AutomationLog[] {
|
|
652
|
+
return this.context.logs;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
public getContext(): AutomationContext {
|
|
656
|
+
return this.context;
|
|
657
|
+
}
|
|
658
|
+
}
|