@elyx-code/editor-ui 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +109 -0
- package/src/App.tsx +31 -0
- package/src/Router.tsx +115 -0
- package/src/__mocks__/defaultModuleMock.ts +1 -0
- package/src/__mocks__/fileMock.ts +1 -0
- package/src/__mocks__/styleMock.ts +1 -0
- package/src/assets/Clock-11.1s-18px.svg +16 -0
- package/src/assets/Clock-11.1s-28px.svg +16 -0
- package/src/assets/authentication.svg +1 -0
- package/src/assets/canvas-backdrop-0.png +0 -0
- package/src/assets/canvas-backdrop-1.png +0 -0
- package/src/assets/canvas-backdrop-2.png +0 -0
- package/src/assets/canvas-backdrop-3.png +0 -0
- package/src/assets/canvas-backdrop-4.png +0 -0
- package/src/assets/canvas-backdrop-5.png +0 -0
- package/src/assets/canvas-backdrop.png +0 -0
- package/src/assets/checkmark-animation.gif +0 -0
- package/src/assets/checkmark-animation.mp4 +0 -0
- package/src/assets/code-formatting/format-black.svg +6 -0
- package/src/assets/code-formatting/format-dark-grey.svg +6 -0
- package/src/assets/code-formatting/format-light-grey.svg +6 -0
- package/src/assets/code-formatting/format-white.svg +6 -0
- package/src/assets/code-formatting/inline-black.svg +5 -0
- package/src/assets/code-formatting/inline-dark-grey.svg +5 -0
- package/src/assets/code-formatting/inline-light-grey.svg +5 -0
- package/src/assets/code-formatting/inline-white.svg +5 -0
- package/src/assets/contained-logo-full-word.png +0 -0
- package/src/assets/cron-job-color.png +0 -0
- package/src/assets/cron-job.png +0 -0
- package/src/assets/database-table-color.png +0 -0
- package/src/assets/database-table.png +0 -0
- package/src/assets/datatype-icons/black/any.svg +1 -0
- package/src/assets/datatype-icons/black/binary.svg +1 -0
- package/src/assets/datatype-icons/black/boolean.svg +3 -0
- package/src/assets/datatype-icons/black/date-time.svg +3 -0
- package/src/assets/datatype-icons/black/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/black/key-file.svg +1 -0
- package/src/assets/datatype-icons/black/list.svg +3 -0
- package/src/assets/datatype-icons/black/null.svg +3 -0
- package/src/assets/datatype-icons/black/number.svg +13 -0
- package/src/assets/datatype-icons/black/project.svg +12 -0
- package/src/assets/datatype-icons/black/sql-program.svg +2 -0
- package/src/assets/datatype-icons/black/text.svg +3 -0
- package/src/assets/datatype-icons/black/unknown.svg +3 -0
- package/src/assets/datatype-icons/black/uuid.svg +4 -0
- package/src/assets/datatype-icons/black/void.svg +1 -0
- package/src/assets/datatype-icons/dark-grey/any.svg +1 -0
- package/src/assets/datatype-icons/dark-grey/boolean.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/date-time.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/dark-grey/list.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/null.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/number.svg +13 -0
- package/src/assets/datatype-icons/dark-grey/project.svg +12 -0
- package/src/assets/datatype-icons/dark-grey/sql-program.svg +2 -0
- package/src/assets/datatype-icons/dark-grey/text.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/unknown.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/uuid.svg +4 -0
- package/src/assets/datatype-icons/dark-grey/void.svg +1 -0
- package/src/assets/datatype-icons/light-grey/any.svg +1 -0
- package/src/assets/datatype-icons/light-grey/boolean.svg +3 -0
- package/src/assets/datatype-icons/light-grey/date-time.svg +3 -0
- package/src/assets/datatype-icons/light-grey/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/light-grey/list.svg +3 -0
- package/src/assets/datatype-icons/light-grey/null.svg +3 -0
- package/src/assets/datatype-icons/light-grey/number.svg +13 -0
- package/src/assets/datatype-icons/light-grey/project.svg +12 -0
- package/src/assets/datatype-icons/light-grey/sql-program.svg +2 -0
- package/src/assets/datatype-icons/light-grey/text.svg +3 -0
- package/src/assets/datatype-icons/light-grey/unknown.svg +3 -0
- package/src/assets/datatype-icons/light-grey/uuid.svg +4 -0
- package/src/assets/datatype-icons/light-grey/void.svg +1 -0
- package/src/assets/edit.png +0 -0
- package/src/assets/execution.svg +13 -0
- package/src/assets/favicon.svg +14 -0
- package/src/assets/file-search.svg +1 -0
- package/src/assets/http-endpoint.png +0 -0
- package/src/assets/image-input-placeholder.png +0 -0
- package/src/assets/logo-full-word-white.png +0 -0
- package/src/assets/logo-full-word.png +0 -0
- package/src/assets/password.svg +85 -0
- package/src/assets/pencil.png +0 -0
- package/src/assets/publish-project-rich-icon-2.svg +1 -0
- package/src/assets/publish-project-rich-icon.svg +1 -0
- package/src/assets/relational-database.png +0 -0
- package/src/assets/resources.svg +3 -0
- package/src/assets/resume-icon-14px.png +0 -0
- package/src/assets/server.png +0 -0
- package/src/assets/small-status/checkmark.svg +4 -0
- package/src/assets/small-status/error.svg +4 -0
- package/src/assets/small-status/loading.svg +4 -0
- package/src/assets/small-status/skipped.svg +11 -0
- package/src/assets/sql-connection-config.svg +1 -0
- package/src/assets/sql-row-transformer.svg +1 -0
- package/src/assets/ssl-certificate-config.svg +1 -0
- package/src/assets/sync.svg +1 -0
- package/src/assets/testing-logic-icon.svg +1 -0
- package/src/assets/versions.svg +25 -0
- package/src/assets/visual-programming-icon.svg +1 -0
- package/src/assets/warning-sign-24px.png +0 -0
- package/src/auth/index.ts +318 -0
- package/src/components/DialogLoader.tsx +94 -0
- package/src/components/EntityDialogHeader.tsx +110 -0
- package/src/components/EntityDialogSectionHeader.tsx +214 -0
- package/src/components/GalleryAddExternalIntegrationInfoDialog.tsx +87 -0
- package/src/components/GenerateProjectStartingLogicPromptDialog.tsx +281 -0
- package/src/components/LegacyRouteRedirector.tsx +55 -0
- package/src/components/ProPlanChip.tsx +23 -0
- package/src/components/ReportBugDialog.tsx +412 -0
- package/src/components/RequestIntegrationAccessDialog.tsx +261 -0
- package/src/components/UseTemplateProjectDialog.tsx +193 -0
- package/src/components/WorkspaceLayout.tsx +152 -0
- package/src/components/animated-svg/AnimatedCheckmark.tsx +41 -0
- package/src/components/animated-svg/AnimatedCrossmark.tsx +51 -0
- package/src/components/animated-svg/AnimatedEmailSending.tsx +38 -0
- package/src/components/animated-svg/AnimatedLoading.tsx +72 -0
- package/src/components/animated-svg/animated-svg.css +239 -0
- package/src/components/canvas/Canvas.tsx +16 -0
- package/src/components/canvas/CreateEntityMenu.tsx +2020 -0
- package/src/components/canvas/canvas.css +10 -0
- package/src/components/canvas/create-entity-menu.css +579 -0
- package/src/components/canvas-search/CanvasSearch.tsx +501 -0
- package/src/components/canvas-search/canvas-search.css +126 -0
- package/src/components/canvas-settings-menu/CanvasSettingsMenuButton.tsx +515 -0
- package/src/components/canvas-settings-menu/canvas-settings-menu.css +96 -0
- package/src/components/circular-image-upload/CircularImageUpload.tsx +113 -0
- package/src/components/circular-image-upload/circular-image-upload.css +69 -0
- package/src/components/costs/CostsDialog.tsx +459 -0
- package/src/components/data-type/DataTypeBuilder.tsx +3127 -0
- package/src/components/data-type/data-type-builder.css +45 -0
- package/src/components/dialogs/BetaAcknowledgeDialog.tsx +43 -0
- package/src/components/dialogs/ComplexDataDialog.tsx +458 -0
- package/src/components/dialogs/CronBuilderDialog.tsx +2145 -0
- package/src/components/dialogs/ExternalIntegrationConnections.tsx +565 -0
- package/src/components/dialogs/JsonEditorDialog.tsx +1392 -0
- package/src/components/dialogs/StringEditorDialog.tsx +268 -0
- package/src/components/dialogs/argument-declaration/ArgumentDeclaration.tsx +1167 -0
- package/src/components/dialogs/argument-declaration/ArgumentDeclarationDialogContent.tsx +128 -0
- package/src/components/dialogs/beta-dialog.css +165 -0
- package/src/components/dialogs/condition/Condition.tsx +431 -0
- package/src/components/dialogs/condition/ConditionDialogContent.tsx +126 -0
- package/src/components/dialogs/definition-entity/DefinitionEntityDialogContent.tsx +973 -0
- package/src/components/dialogs/function-call/FunctionCall.tsx +442 -0
- package/src/components/dialogs/function-call/FunctionCallDialogContent.tsx +126 -0
- package/src/components/dialogs/function-declaration/FunctionDeclaration.tsx +926 -0
- package/src/components/dialogs/function-declaration/FunctionDeclarationDialogContent.tsx +124 -0
- package/src/components/dialogs/generating-project-starting-logic-overlay/GeneratingProjectStartingLogicOverlay.tsx +176 -0
- package/src/components/dialogs/generating-project-starting-logic-overlay/generating-project-starting-logic-overlay.css +13 -0
- package/src/components/dialogs/global-event/GlobalEvent.tsx +475 -0
- package/src/components/dialogs/global-event/GlobalEventDialogContent.tsx +126 -0
- package/src/components/dialogs/help/HelpDialog.tsx +217 -0
- package/src/components/dialogs/help/HelpDilalogHomeContent.tsx +178 -0
- package/src/components/dialogs/help/help-dialog.css +116 -0
- package/src/components/dialogs/help/help-icon/HelpIconButton.tsx +41 -0
- package/src/components/dialogs/help/help-icon/help-icon.css +9 -0
- package/src/components/dialogs/input-map/InputMap.tsx +635 -0
- package/src/components/dialogs/input-map/InputMapDialogContent.tsx +126 -0
- package/src/components/dialogs/json-editor-dialog.css +4 -0
- package/src/components/dialogs/loop/Loop.tsx +650 -0
- package/src/components/dialogs/loop/LoopDialogContent.tsx +122 -0
- package/src/components/dialogs/operation/Operation.tsx +440 -0
- package/src/components/dialogs/operation/OperationDialogContent.tsx +126 -0
- package/src/components/dialogs/output-map/OutputMap.tsx +536 -0
- package/src/components/dialogs/output-map/OutputMapDialogContent.tsx +126 -0
- package/src/components/dialogs/property/Property.tsx +1490 -0
- package/src/components/dialogs/property/PropertyDialogContent.tsx +106 -0
- package/src/components/dialogs/search-statement/ColumnSelector.tsx +334 -0
- package/src/components/dialogs/search-statement/ConditionBuilder.tsx +750 -0
- package/src/components/dialogs/search-statement/DataAggregationSection.tsx +621 -0
- package/src/components/dialogs/search-statement/DataSourceSelection.tsx +734 -0
- package/src/components/dialogs/search-statement/EntityMetadataSection.tsx +135 -0
- package/src/components/dialogs/search-statement/FilterConditionsSection.tsx +151 -0
- package/src/components/dialogs/search-statement/InlineInputMap.tsx +153 -0
- package/src/components/dialogs/search-statement/LiteralValue.tsx +616 -0
- package/src/components/dialogs/search-statement/MainSourceAndInputsSection.tsx +271 -0
- package/src/components/dialogs/search-statement/NestedSearchStatementBuilder.tsx +170 -0
- package/src/components/dialogs/search-statement/OutputFormatSection.tsx +1779 -0
- package/src/components/dialogs/search-statement/ResultsSection.tsx +344 -0
- package/src/components/dialogs/search-statement/SearchStatementBuilder.tsx +251 -0
- package/src/components/dialogs/search-statement/SearchStatementDialogContent.tsx +398 -0
- package/src/components/dialogs/search-statement/ValueSelector.tsx +766 -0
- package/src/components/dialogs/search-statement/search-statement-context.tsx +1630 -0
- package/src/components/dialogs/search-statement/search-statement-dialog.css +56 -0
- package/src/components/dialogs/search-statement/test.sql +111 -0
- package/src/components/dialogs/value-descriptor/ValueDescriptor.tsx +824 -0
- package/src/components/dialogs/value-descriptor/ValueDescriptorDialogContent.tsx +124 -0
- package/src/components/dialogs/variable-declaration/VariableDeclaration.tsx +836 -0
- package/src/components/dialogs/variable-declaration/VariableDeclarationDialogContent.tsx +106 -0
- package/src/components/dialogs/variable-instance/VariableInstance.tsx +443 -0
- package/src/components/dialogs/variable-instance/VariableInstanceDialogContent.tsx +124 -0
- package/src/components/draggable-entity-card/ArgumentDeclaration.tsx +736 -0
- package/src/components/draggable-entity-card/CollapseEntityButton.tsx +170 -0
- package/src/components/draggable-entity-card/ConditionCard.tsx +1062 -0
- package/src/components/draggable-entity-card/ConnectionDeleteButton.tsx +309 -0
- package/src/components/draggable-entity-card/DataTypeIcon.tsx +624 -0
- package/src/components/draggable-entity-card/DraggableEntityCard.tsx +617 -0
- package/src/components/draggable-entity-card/ErrorMapProperty.tsx +464 -0
- package/src/components/draggable-entity-card/EventCard.tsx +700 -0
- package/src/components/draggable-entity-card/ExecutionInProgressValue.tsx +327 -0
- package/src/components/draggable-entity-card/FunctionDeclarationCard.tsx +819 -0
- package/src/components/draggable-entity-card/InputMapProperty.tsx +1067 -0
- package/src/components/draggable-entity-card/InternalCall.tsx +978 -0
- package/src/components/draggable-entity-card/InternalCallExecutionNode.tsx +643 -0
- package/src/components/draggable-entity-card/LogicScopeCallerNode.tsx +262 -0
- package/src/components/draggable-entity-card/LoopCard.tsx +791 -0
- package/src/components/draggable-entity-card/MainValueInput.tsx +523 -0
- package/src/components/draggable-entity-card/MainValueOutput.tsx +458 -0
- package/src/components/draggable-entity-card/MethodDeclaration.tsx +1088 -0
- package/src/components/draggable-entity-card/NestedCondition.tsx +1025 -0
- package/src/components/draggable-entity-card/OutputMapProperty.tsx +843 -0
- package/src/components/draggable-entity-card/PassthroughEntityCard.tsx +1247 -0
- package/src/components/draggable-entity-card/ReturnedError.tsx +549 -0
- package/src/components/draggable-entity-card/SmallSuccessFailureNodes.tsx +523 -0
- package/src/components/draggable-entity-card/SuccessFailureNodes.tsx +509 -0
- package/src/components/draggable-entity-card/TestEntityButton.tsx +946 -0
- package/src/components/draggable-entity-card/TestMenu.tsx +523 -0
- package/src/components/draggable-entity-card/TestMenuValidationDropdown.tsx +84 -0
- package/src/components/draggable-entity-card/UnreachableMarker.tsx +114 -0
- package/src/components/draggable-entity-card/VariableCard.tsx +1577 -0
- package/src/components/draggable-entity-card/VariableScopeMarker.tsx +117 -0
- package/src/components/draggable-entity-card/collapse-entity-button.css +44 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityCard.tsx +1181 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityIcon.tsx +36 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityProperty.tsx +478 -0
- package/src/components/draggable-entity-card/definition-entity/DynamicFooterActions.tsx +112 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/ExportCredentialsFooterAction.tsx +461 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/RestablishConnectionFooterAction.tsx +199 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/restablish-connection-footer-action.css +85 -0
- package/src/components/draggable-entity-card/definition-entity/actions/google-drive/GoogleDriveFilePickerAPIFooterAction.tsx +277 -0
- package/src/components/draggable-entity-card/definition-entity/actions/google-drive/google-drive-file-picker-api-footer-action.css +107 -0
- package/src/components/draggable-entity-card/definition-entity/actions/persisted-entity/DatabaseFooterAction.tsx +452 -0
- package/src/components/draggable-entity-card/definition-entity/actions/persisted-entity/database-footer-action.css +86 -0
- package/src/components/draggable-entity-card/definition-entity/definition-entity-card.css +17 -0
- package/src/components/draggable-entity-card/draggable-entity-card.css +1140 -0
- package/src/components/draggable-entity-card/entity-locked-icon/EntityLockedIcon.tsx +133 -0
- package/src/components/draggable-entity-card/entity-locked-icon/entity-locked.css +8 -0
- package/src/components/draggable-entity-card/expand-properties-icon-button/ExpandPropertiesIconButton.tsx +84 -0
- package/src/components/draggable-entity-card/expand-properties-icon-button/expand-properties-icon-button.css +21 -0
- package/src/components/draggable-entity-card/implement-entity-icon/ImplementEntityIcon.tsx +74 -0
- package/src/components/draggable-entity-card/implement-entity-icon/implement-entity-icon.css +13 -0
- package/src/components/draggable-entity-card/logic-error/LogicErrorIconMenu.tsx +424 -0
- package/src/components/draggable-entity-card/logic-error/logic-error.css +23 -0
- package/src/components/draggable-entity-card/new-card-input-button/NewCardInputButton.tsx +193 -0
- package/src/components/draggable-entity-card/new-card-input-button/NewDynamicInputButton.tsx +214 -0
- package/src/components/draggable-entity-card/new-card-input-button/new-card-input-button.css +71 -0
- package/src/components/draggable-entity-card/new-card-output-button/NewCardOutputButton.tsx +192 -0
- package/src/components/draggable-entity-card/new-card-output-button/new-card-output-button.css +71 -0
- package/src/components/draggable-entity-card/termination-statement/TerminationStatementCard.tsx +1543 -0
- package/src/components/draggable-entity-card/termination-statement/termination-statement-card.css +17 -0
- package/src/components/draggable-entity-card/test-entity-button.css +55 -0
- package/src/components/draggable-entity-card/test-menu.css +181 -0
- package/src/components/draggable-entity-card/unreachable-marker.css +43 -0
- package/src/components/draggable-entity-card/variable-scope-marker.css +22 -0
- package/src/components/dynamic-value/DynamicValue.tsx +2395 -0
- package/src/components/dynamic-value/DynamicValueEntry.tsx +1957 -0
- package/src/components/dynamic-value/dynamic-value.css +230 -0
- package/src/components/editor/ElyxMonacoEditor.tsx +38 -0
- package/src/components/entity-error/EntityErrorListItem.tsx +47 -0
- package/src/components/entity-error/entity-error.css +198 -0
- package/src/components/entity-icon/EntityIcon.tsx +292 -0
- package/src/components/entity-icon/entity-icon.css +39 -0
- package/src/components/gallery-card/CreateNewProject.tsx +222 -0
- package/src/components/gallery-card/GalleryCard.tsx +171 -0
- package/src/components/gallery-card/MarketplaceCard.tsx +87 -0
- package/src/components/gallery-card/ProjectDuplicationCard.tsx +575 -0
- package/src/components/gallery-card/gallery-card.css +25 -0
- package/src/components/notifications/NotificationsIconButton.tsx +124 -0
- package/src/components/notifications/NotificationsPanel.tsx +385 -0
- package/src/components/notifications/notifications.css +189 -0
- package/src/components/online-users/LocalOnlineUsers.tsx +175 -0
- package/src/components/online-users/PageOnlineUsers.tsx +297 -0
- package/src/components/online-users/online-users.css +72 -0
- package/src/components/page-backdrop/PageBackdrop.tsx +8 -0
- package/src/components/page-backdrop/page-backdrop.css +7 -0
- package/src/components/project-configuration/DeleteProjectConfirmationDialog.tsx +134 -0
- package/src/components/project-configuration/ProjectConfigurationDialog.tsx +972 -0
- package/src/components/project-configuration/ProjectDataForm.tsx +121 -0
- package/src/components/project-configuration/UnpublishProjectConfirmationDialog.tsx +162 -0
- package/src/components/project-configuration/project-configuration-content.css +209 -0
- package/src/components/project-name/ProjectName.tsx +2025 -0
- package/src/components/project-name/project-name.css +599 -0
- package/src/components/publishing/Publication.tsx +133 -0
- package/src/components/publishing/history/PublicationHistoryContent.tsx +414 -0
- package/src/components/publishing/history/PublicationHistoryDialog.tsx +234 -0
- package/src/components/publishing/preview/PublicationPreviewDialog.tsx +1158 -0
- package/src/components/publishing/preview/PublishingPriceForecast.tsx +160 -0
- package/src/components/publishing/preview/PublishingResourcesDetails.tsx +91 -0
- package/src/components/publishing/publication-sequence/PublishingSequenceContent.tsx +375 -0
- package/src/components/publishing/publication-sequence/PublishingSequenceDialog.tsx +344 -0
- package/src/components/publishing/publishing-dialog.css +142 -0
- package/src/components/publishing/utils.ts +227 -0
- package/src/components/resources/ResourcesDialog.tsx +591 -0
- package/src/components/resources/UpgradeBanner.tsx +102 -0
- package/src/components/resources/codebase/CodebaseDetails.tsx +156 -0
- package/src/components/resources/cron-job/CronJobsList.tsx +532 -0
- package/src/components/resources/functions/FunctionsList.tsx +454 -0
- package/src/components/resources/http-api/HttpAPI.tsx +566 -0
- package/src/components/resources/http-api/HttpAPIClientModule.tsx +37 -0
- package/src/components/resources/logs/LogsViewer.tsx +768 -0
- package/src/components/resources/query.ts +74 -0
- package/src/components/resources/relational-database/DatabaseTable.tsx +905 -0
- package/src/components/resources/relational-database/RelationalDatabase.tsx +83 -0
- package/src/components/resources/relational-database/RelationalDatabaseSecrets.tsx +361 -0
- package/src/components/resources/resources-dialog.css +74 -0
- package/src/components/test-relational-database/DatabaseTable.tsx +913 -0
- package/src/components/test-relational-database/TestDatabaseDialogContent.tsx +670 -0
- package/src/components/test-relational-database/query.ts +74 -0
- package/src/components/toolbar/ToolBar.tsx +236 -0
- package/src/components/toolbar/toolbar.css +78 -0
- package/src/components/transaction-history/TransactionHistoryDialog.tsx +268 -0
- package/src/components/user/CurrentUserAvatar.tsx +65 -0
- package/src/components/user/UserChip.tsx +62 -0
- package/src/components/user/user.css +39 -0
- package/src/components/user-profile/ChangePasswordForm.tsx +67 -0
- package/src/components/user-profile/OwnUserProfileContent.tsx +665 -0
- package/src/components/user-profile/PublicUserProfileContent.tsx +99 -0
- package/src/components/user-profile/UserDataForm.tsx +75 -0
- package/src/components/user-profile/UserProfileDialog.tsx +110 -0
- package/src/components/user-profile/user-profile-content.css +25 -0
- package/src/config.ts +130 -0
- package/src/globals.d.ts +13 -0
- package/src/index.html +27 -0
- package/src/index.tsx +23 -0
- package/src/lib/badge/Badge.tsx +35 -0
- package/src/lib/badge/badge.css +32 -0
- package/src/lib/button/Button.tsx +129 -0
- package/src/lib/button/button.css +145 -0
- package/src/lib/canvas/canvas-undo-redo.ts +263 -0
- package/src/lib/canvas/defs.ts +170 -0
- package/src/lib/canvas/index.test.ts +189 -0
- package/src/lib/canvas/index.ts +6999 -0
- package/src/lib/canvas/utils.ts +59 -0
- package/src/lib/card/Card.tsx +62 -0
- package/src/lib/card/LoadingCard.tsx +82 -0
- package/src/lib/card/card.css +259 -0
- package/src/lib/chip/Chip.tsx +79 -0
- package/src/lib/chip/chip.css +0 -0
- package/src/lib/dialog/Dialog.tsx +122 -0
- package/src/lib/dialog/SmallDialog.tsx +61 -0
- package/src/lib/dialog/dialog.css +40 -0
- package/src/lib/display-data-structure/index.tsx +21 -0
- package/src/lib/dropdown/CanvasDropdownMenuCard.tsx +68 -0
- package/src/lib/dropdown/CanvasDropdownMenuCardOption.tsx +136 -0
- package/src/lib/dropdown/DropdownButton.tsx +104 -0
- package/src/lib/dropdown/DropdownMenuCard.tsx +324 -0
- package/src/lib/dropdown/DropdownMenuPopup.tsx +27 -0
- package/src/lib/dropdown/dropdown-button.css +76 -0
- package/src/lib/dropdown/dropdown-menu.css +151 -0
- package/src/lib/json-editor/RawJsonEditor.tsx +137 -0
- package/src/lib/json-editor/json-editor.css +35 -0
- package/src/lib/loader/Loader.tsx +120 -0
- package/src/lib/loader/loader.css +38 -0
- package/src/lib/pagination/Pagination.tsx +64 -0
- package/src/lib/popup/CanvasPopupBaseComponent.tsx +103 -0
- package/src/lib/popup/Popup.tsx +243 -0
- package/src/lib/popup/popup.css +16 -0
- package/src/lib/table/RowForm.tsx +301 -0
- package/src/lib/table/Table.tsx +1069 -0
- package/src/lib/table/table.css +249 -0
- package/src/lib/table/types.ts +108 -0
- package/src/lib/text-area/TextArea.tsx +183 -0
- package/src/lib/text-area/text-area.css +156 -0
- package/src/lib/text-field/TextField.tsx +218 -0
- package/src/lib/text-field/index.ts +8 -0
- package/src/lib/text-field/text-field.css +201 -0
- package/src/lib/tooltip/Tooltip.tsx +24 -0
- package/src/lib/tooltip/tooltip.css +17 -0
- package/src/localization/index.ts +47 -0
- package/src/main.css +343 -0
- package/src/pages/Auth.tsx +848 -0
- package/src/pages/Editor.tsx +883 -0
- package/src/pages/ErrorPage.tsx +179 -0
- package/src/pages/Gallery.tsx +1693 -0
- package/src/pages/NewPaymentMethodCallback.tsx +53 -0
- package/src/pages/NotFoundPage.tsx +126 -0
- package/src/pages/PricingPlans.tsx +155 -0
- package/src/pages/auth.css +304 -0
- package/src/pages/gallery.css +421 -0
- package/src/payments/index.ts +187 -0
- package/src/popup-notification/index.ts +90 -0
- package/src/services/database/index.ts +1 -0
- package/src/services/database/utils.ts +1301 -0
- package/src/services/editor/CanvasElement.tsx +2934 -0
- package/src/services/editor/CanvasElementConnectionDeleteButton.ts +204 -0
- package/src/services/editor/CanvasPopup.tsx +749 -0
- package/src/services/editor/EditorService.ts +8157 -0
- package/src/services/editor/area.ts +1312 -0
- package/src/services/editor/connections.ts +1019 -0
- package/src/services/editor/create/condition.ts +25 -0
- package/src/services/editor/create/definition-entity.ts +29 -0
- package/src/services/editor/create/function-call.ts +25 -0
- package/src/services/editor/create/global-event.ts +33 -0
- package/src/services/editor/create/loop.ts +25 -0
- package/src/services/editor/create/operation.ts +30 -0
- package/src/services/editor/create/utils.ts +140 -0
- package/src/services/editor/create/variable-declaration.ts +135 -0
- package/src/services/editor/create/variable-instance.ts +100 -0
- package/src/services/editor/editor-ui-extensions-context.ts +43 -0
- package/src/services/editor/entities-metadata.json +9310 -0
- package/src/services/editor/icons.ts +1093 -0
- package/src/services/editor/index.ts +1 -0
- package/src/services/editor/layout.ts +102 -0
- package/src/services/editor/modules/built-in-function-implementations/base.ts +14 -0
- package/src/services/editor/modules/built-in-function-implementations/create-persisted-entity/index.ts +56 -0
- package/src/services/editor/modules/built-in-function-implementations/delete-persisted-entity/index.ts +55 -0
- package/src/services/editor/modules/built-in-function-implementations/index.ts +4 -0
- package/src/services/editor/modules/built-in-function-implementations/update-persisted-entity/index.ts +56 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/get-files.ts +183 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/list-drives.ts +124 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/list-root-folders.ts +125 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/smart-fetch-document.ts +702 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/upload-document.ts +535 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-gemini/generate-content.ts +193 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-mail/get-emails.ts +586 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-mail/send-email.ts +386 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/index.ts +12 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/channels.ts +240 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/messages.ts +210 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/replies.ts +200 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/send-message.ts +177 -0
- package/src/services/editor/modules/operations-implementations/index.ts +1 -0
- package/src/services/editor/modules/search-node-implementation/index.ts +42 -0
- package/src/services/editor/modules/sql-migrations-generation.tsx +1054 -0
- package/src/services/editor/publication/publication.ts +578 -0
- package/src/services/editor/ui.ts +1348 -0
- package/src/services/editor/utils.ts +5868 -0
- package/src/services/editor/value-store.ts +619 -0
- package/src/services/execution/built-in-function-implementations.ts +422 -0
- package/src/services/execution/index.ts +4747 -0
- package/src/services/execution/logic.ts +121 -0
- package/src/services/execution/test-instance.tsx +2296 -0
- package/src/services/execution/utils.ts +33 -0
- package/src/services/execution/value-resolution.test.ts +424 -0
- package/src/services/execution/value-resolution.ts +4087 -0
- package/src/services/integrations/ExternalIntegrationsService.ts +439 -0
- package/src/services/integrations/api.ts +175 -0
- package/src/services/local-relational-database/idb_helper.ts +66 -0
- package/src/services/local-relational-database/index.ts +3308 -0
- package/src/services/local-relational-database/utils.ts +403 -0
- package/src/services/notifications/index.ts +525 -0
- package/src/services/user/index.ts +144 -0
- package/src/setupTests.ts +1 -0
- package/src/socket/socket.ts +248 -0
- package/src/socket/utils.ts +10 -0
- package/src/store/workspace.ts +12 -0
- package/src/theme.ts +19 -0
- package/src/utils/DOM.ts +39 -0
- package/src/utils/date.ts +169 -0
- package/src/utils/index.ts +158 -0
- package/src/utils/react.tsx +679 -0
- package/src/utils/testing.ts +103 -0
|
@@ -0,0 +1,1348 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseEntityNames,
|
|
3
|
+
CanvasEntityDisabledReason,
|
|
4
|
+
CanvasEntityOtherDisabledReason,
|
|
5
|
+
ConditionState,
|
|
6
|
+
EntityType,
|
|
7
|
+
lowercaseFirstLetter,
|
|
8
|
+
OperationState,
|
|
9
|
+
PASS_THROUGH_CALLABLE_TYPES,
|
|
10
|
+
PrimitiveTypes,
|
|
11
|
+
READABLE_ENTITY_TYPES,
|
|
12
|
+
ValueDescriptorState,
|
|
13
|
+
VARIABLE_TYPES,
|
|
14
|
+
DataTypeState,
|
|
15
|
+
VariableDeclarationState,
|
|
16
|
+
EntityState,
|
|
17
|
+
CanvasEntityState,
|
|
18
|
+
FunctionCallState,
|
|
19
|
+
FunctionDeclarationState,
|
|
20
|
+
ReturnStatementState,
|
|
21
|
+
DefinitionEntityState,
|
|
22
|
+
InstalledProjectState,
|
|
23
|
+
VariableState,
|
|
24
|
+
LoopState,
|
|
25
|
+
SearchState,
|
|
26
|
+
GlobalEventState,
|
|
27
|
+
BreakStatementState,
|
|
28
|
+
ContinueStatementState,
|
|
29
|
+
checkIsMethod,
|
|
30
|
+
flattenDefinitionEntityExtensionAndImplementationTypes,
|
|
31
|
+
getExtendedDefinitionEntity,
|
|
32
|
+
BuiltInBaseEntityState,
|
|
33
|
+
resolveEntityName,
|
|
34
|
+
TerminationEntityState,
|
|
35
|
+
PassThroughCallableEntityWithOutputsState,
|
|
36
|
+
TERMINATION_TYPES,
|
|
37
|
+
CanvasEntityConnectionDisabledReason,
|
|
38
|
+
toSentenceCase,
|
|
39
|
+
ProjectState,
|
|
40
|
+
BUILT_IN_BASE_ENTITY_IDS,
|
|
41
|
+
EntityInstanceErrorCode,
|
|
42
|
+
} from '@elyx-code/project-logic-tree';
|
|
43
|
+
|
|
44
|
+
export const CANVAS_ENTITY_ID_PREFIX = 'canvas-entity';
|
|
45
|
+
export const CANVAS_NODE_ID_PREFIX = 'canvas-node';
|
|
46
|
+
export const CANVAS_CREATE_ENTITY_MENU_ID_PREFIX = 'create-entity-menu';
|
|
47
|
+
export const CALLED_BY_NODE_ID_SUFFIX = 'called-by';
|
|
48
|
+
export const SUCCESS_CALLER_NODE_ID_SUFFIX = 'success-caller';
|
|
49
|
+
export const ENTRY_CALLER_NODE_ID_SUFFIX = 'entry-caller';
|
|
50
|
+
export const ERROR_CALLER_NODE_ID_SUFFIX = 'error-caller';
|
|
51
|
+
|
|
52
|
+
// Ids for canvas DOM elements are loosely formatted
|
|
53
|
+
// You can extract data from them like the type of entity and the entity id
|
|
54
|
+
// But you can't rely on the format to be consistent
|
|
55
|
+
// Here we check if the canvas id starts with any of the known prefixes
|
|
56
|
+
export function checkIsValidCanvasIdForDestructuring(
|
|
57
|
+
canvasId: string,
|
|
58
|
+
): boolean {
|
|
59
|
+
return (
|
|
60
|
+
canvasId.startsWith(CANVAS_ENTITY_ID_PREFIX) ||
|
|
61
|
+
canvasId.startsWith(CANVAS_NODE_ID_PREFIX) ||
|
|
62
|
+
canvasId.startsWith(CANVAS_CREATE_ENTITY_MENU_ID_PREFIX)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function getCanvasEntityDOMId(
|
|
67
|
+
entity: EntityState,
|
|
68
|
+
debug = false,
|
|
69
|
+
): string {
|
|
70
|
+
const result = `${CANVAS_ENTITY_ID_PREFIX}--${entity.id}--${entity.type}`;
|
|
71
|
+
|
|
72
|
+
if (debug) {
|
|
73
|
+
debugger;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function getCanvasEntityDraggableContainerDOMId(
|
|
80
|
+
entity: EntityState,
|
|
81
|
+
debug = false,
|
|
82
|
+
): string {
|
|
83
|
+
if (debug) {
|
|
84
|
+
debugger;
|
|
85
|
+
}
|
|
86
|
+
const result = `${getCanvasEntityDOMId(entity, debug)}--draggable-container`;
|
|
87
|
+
|
|
88
|
+
if (debug) {
|
|
89
|
+
debugger;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function getCanvasEntityNewErrorOutputDOMId(
|
|
96
|
+
entity: EntityState,
|
|
97
|
+
): string {
|
|
98
|
+
return getCanvasEntityDOMId(entity) + '--new-error-output';
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function getCanvasEntityMainValueInputDOMId(
|
|
102
|
+
entity: VariableState | TerminationEntityState,
|
|
103
|
+
): string {
|
|
104
|
+
return getCanvasEntityDOMId(entity) + '--main-value-input';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function getCanvasEntityMainValueOutputDOMId(
|
|
108
|
+
entity: PassThroughCallableEntityWithOutputsState,
|
|
109
|
+
): string {
|
|
110
|
+
return getCanvasEntityDOMId(entity) + '--main-value-output';
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function getCreateEntityMenuHeaderNodeId(): string {
|
|
114
|
+
return `${CANVAS_CREATE_ENTITY_MENU_ID_PREFIX}--header-node-id`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function getCreateEntityMenuMainValueInputNodeId() {
|
|
118
|
+
return `${CANVAS_CREATE_ENTITY_MENU_ID_PREFIX}--main-value-input-node-id`;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function getCreateEntityMenuMainValueOutputNodeId(): string {
|
|
122
|
+
return `${CANVAS_CREATE_ENTITY_MENU_ID_PREFIX}--main-value-output-node-id`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function getCreateEntityMenuSuccessNodeId(): string {
|
|
126
|
+
return `${CANVAS_CREATE_ENTITY_MENU_ID_PREFIX}--success-node-id`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function getCreateEntityMenuFailureNodeId(): string {
|
|
130
|
+
return `${CANVAS_CREATE_ENTITY_MENU_ID_PREFIX}--failure-node-id`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function getMethodDeclarationDOMId(
|
|
134
|
+
entity: FunctionDeclarationState,
|
|
135
|
+
): string {
|
|
136
|
+
return getCanvasEntityDOMId(entity) + '--method-declaration';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function getCanvasEntityExecutionNodeId(entity: EntityState): string {
|
|
140
|
+
return `${CANVAS_NODE_ID_PREFIX}--${entity.id}--${CALLED_BY_NODE_ID_SUFFIX}`;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function getCanvasEntityNewOutputButtonDOMId(
|
|
144
|
+
entity: EntityState,
|
|
145
|
+
): string {
|
|
146
|
+
return `${CANVAS_NODE_ID_PREFIX}--${entity.id}--new-output`;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function getCanvasEntityNewInputButtonDOMId(
|
|
150
|
+
entity: EntityState,
|
|
151
|
+
): string {
|
|
152
|
+
return `${CANVAS_NODE_ID_PREFIX}--${entity.id}--new-input`;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function getCanvasEntityNewDynamicInputButtonDOMId(
|
|
156
|
+
entity: OperationState | FunctionCallState | ConditionState,
|
|
157
|
+
inputValueDescriptor: ValueDescriptorState,
|
|
158
|
+
): string {
|
|
159
|
+
return `${CANVAS_NODE_ID_PREFIX}--${entity.id}--new-dynamic-input--${inputValueDescriptor.id}`;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function getEntityIdFromNewDynamicInputButtonDOMId(
|
|
163
|
+
canvasId: string,
|
|
164
|
+
): string {
|
|
165
|
+
if (!canvasId.startsWith(CANVAS_NODE_ID_PREFIX)) {
|
|
166
|
+
throw new Error("Canvas ID doesn't belong to a node element");
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return canvasId.split('--')[1];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function getInputValueDescriptorIdFromNewDynamicInputButtonDOMId(
|
|
173
|
+
canvasId: string,
|
|
174
|
+
): string {
|
|
175
|
+
if (!canvasId.startsWith(CANVAS_NODE_ID_PREFIX)) {
|
|
176
|
+
throw new Error("Canvas ID doesn't belong to a node element");
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return canvasId.split('--new-dynamic-input--')[1];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function getCanvasEntitySuccessCallerNodeDOMId(
|
|
183
|
+
entity: EntityState,
|
|
184
|
+
): string {
|
|
185
|
+
return `${CANVAS_NODE_ID_PREFIX}--${entity.id}--${SUCCESS_CALLER_NODE_ID_SUFFIX}`;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function getCanvasEntityEntryCallerNodeDOMId(
|
|
189
|
+
entity: EntityState,
|
|
190
|
+
): string {
|
|
191
|
+
return `${CANVAS_NODE_ID_PREFIX}--${entity.id}--${ENTRY_CALLER_NODE_ID_SUFFIX}`;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export function getCanvasEntityErrorCallerNodeDOMId(
|
|
195
|
+
entity: EntityState,
|
|
196
|
+
): string {
|
|
197
|
+
return `${CANVAS_NODE_ID_PREFIX}--${entity.id}--${ERROR_CALLER_NODE_ID_SUFFIX}`;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export function getEntityIdFromCanvasId(canvasId: string): string {
|
|
201
|
+
if (!checkIsValidCanvasIdForDestructuring(canvasId)) {
|
|
202
|
+
throw new Error(
|
|
203
|
+
"Canvas ID doesn't belong to an element type that can be destructured",
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return canvasId.split('--')[1];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export function getEntityTypeFromCanvasId(canvasId: string): EntityType {
|
|
211
|
+
if (!canvasId.startsWith(CANVAS_ENTITY_ID_PREFIX)) {
|
|
212
|
+
throw new Error("Canvas ID doesn't belong to an entity element");
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return canvasId.split('--')[2] as EntityType;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export enum CardState {
|
|
219
|
+
Disabled = 'disabled',
|
|
220
|
+
Suggestion = 'suggestion',
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export function resolveEntityColorClass(
|
|
224
|
+
entityType: EntityType,
|
|
225
|
+
options: { state?: CardState } = {},
|
|
226
|
+
) {
|
|
227
|
+
return (
|
|
228
|
+
'canvas-draggable-card__backdrop__' +
|
|
229
|
+
entityType +
|
|
230
|
+
(options?.state ? `__${options.state}` : '')
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function getCardColorCSSVariable(entity: EntityState): string {
|
|
235
|
+
return `var(--color-background--${entity.type})`;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export function getCardSupportColorCSSVariable(entity: EntityState): string {
|
|
239
|
+
return `var(--color-background-support--${entity.type})`;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function getBlockedBackground(
|
|
243
|
+
entityType: EntityType,
|
|
244
|
+
options: { invertedStripes?: boolean } = {},
|
|
245
|
+
): string {
|
|
246
|
+
const blocked = `background: repeating-linear-gradient(135deg, var(--color-background--${entityType}), var(--color-background--${entityType}) 8px, var(--color-background-support--${entityType}) 8px, var(--color-background-support--${entityType}) 16px);`;
|
|
247
|
+
const invertedBlocked = `background: repeating-linear-gradient(135deg, var(--color-background-support--${entityType}), var(--color-background-support--${entityType}) 8px, var(--color-background--${entityType}) 8px, var(--color-background--${entityType}) 16px);`;
|
|
248
|
+
|
|
249
|
+
if (options.invertedStripes) {
|
|
250
|
+
return invertedBlocked;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return blocked;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/*
|
|
257
|
+
Same blink-the-stripes machinery as `getCardGradientStatement`, but for
|
|
258
|
+
headers whose normal background is a SOLID colour (set via CSS class)
|
|
259
|
+
rather than the gradient that `getCardGradientStatement` paints inline.
|
|
260
|
+
The internal-call body — `canvas-draggable-card__header--small` — is the
|
|
261
|
+
prime example: it has a single blue fill in the stylesheet, so calling
|
|
262
|
+
`getCardGradientStatement` would clobber that fill with the gradient and
|
|
263
|
+
the rest of the card would no longer match the static visual.
|
|
264
|
+
|
|
265
|
+
This helper only emits the `--unreachable-stripes-bg` custom property
|
|
266
|
+
(when blocked) and nothing else, so the CSS-class background stays in
|
|
267
|
+
place as the "base" layer and the pseudo-element overlay in
|
|
268
|
+
draggable-entity-card.css does the cross-fade on top of it.
|
|
269
|
+
*/
|
|
270
|
+
export function getUnreachableStripesStyle(
|
|
271
|
+
entity: EntityState,
|
|
272
|
+
options: { invertedStripes?: boolean } = {},
|
|
273
|
+
): React.CSSProperties {
|
|
274
|
+
const hasBlockedReachabilityError = !!entity.errors.find(
|
|
275
|
+
(e) =>
|
|
276
|
+
e.code === EntityInstanceErrorCode.LastCalledEntityMustBeReturnEntity,
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
if (!hasBlockedReachabilityError) {
|
|
280
|
+
return {};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const stripes = getBlockedBackground(entity.type, options)
|
|
284
|
+
.replace(/^background:\s*/, '')
|
|
285
|
+
.replace(/;\s*$/, '');
|
|
286
|
+
|
|
287
|
+
// CSS custom-property keys aren't part of React's CSSProperties type, so
|
|
288
|
+
// cast through `Record<string, string>`. The CSS selector still matches
|
|
289
|
+
// via `[style*="--unreachable-stripes-bg"]` because React serialises
|
|
290
|
+
// custom properties verbatim into the inline `style` attribute.
|
|
291
|
+
return { '--unreachable-stripes-bg': stripes } as React.CSSProperties;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export function getCardGradientStatement(
|
|
295
|
+
entity: EntityState,
|
|
296
|
+
options: { state?: CardState; invertedStripes?: boolean } = {},
|
|
297
|
+
): string {
|
|
298
|
+
const hasBlockedReachabilityError = !!entity.errors.find(
|
|
299
|
+
(e) =>
|
|
300
|
+
e.code === EntityInstanceErrorCode.LastCalledEntityMustBeReturnEntity,
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
const baseGradient = options?.state
|
|
304
|
+
? `linear-gradient(to bottom, var(--color-background-${options.state}--${entity.type}), transparent)`
|
|
305
|
+
: `linear-gradient(to bottom, var(--color-background--${entity.type}), var(--color-background-support--${entity.type}))`;
|
|
306
|
+
|
|
307
|
+
if (hasBlockedReachabilityError) {
|
|
308
|
+
// We used to fully replace the header background with the diagonal
|
|
309
|
+
// stripes (`getBlockedBackground(...)`). The new behaviour cross-fades
|
|
310
|
+
// between the regular gradient and the stripes so unreachable nodes
|
|
311
|
+
// pulse instead of sitting still — they're easier for a user to spot
|
|
312
|
+
// when scanning the canvas.
|
|
313
|
+
//
|
|
314
|
+
// To keep this change additive across every node type (every
|
|
315
|
+
// `getCardGradientStatement` caller just slaps the returned string into
|
|
316
|
+
// `style={parse(...)}`), we still emit ONE `background:` declaration —
|
|
317
|
+
// the regular gradient as the base — and additionally expose the
|
|
318
|
+
// stripes pattern via a custom CSS property `--unreachable-stripes-bg`.
|
|
319
|
+
// The CSS rule `.canvas-draggable-card__header[style*="--unreachable-stripes-bg"]::before`
|
|
320
|
+
// (in draggable-entity-card.css) layers a pseudo-element on top of the
|
|
321
|
+
// header with that custom property as its background, and animates its
|
|
322
|
+
// opacity in a loop, producing the blink. No per-component changes
|
|
323
|
+
// needed.
|
|
324
|
+
//
|
|
325
|
+
// The legacy `getBlockedBackground` is still here for any caller that
|
|
326
|
+
// wants the fully-static stripes (e.g. `UnreachableMarker` toyed with
|
|
327
|
+
// it). Removing this dual return would silently break those callers.
|
|
328
|
+
const stripes = getBlockedBackground(entity.type, options)
|
|
329
|
+
// Strip the `background: ` prefix and trailing `;` so we can hand
|
|
330
|
+
// the bare gradient value to the CSS custom property below.
|
|
331
|
+
.replace(/^background:\s*/, '')
|
|
332
|
+
.replace(/;\s*$/, '');
|
|
333
|
+
return `background: ${baseGradient}; --unreachable-stripes-bg: ${stripes};`;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return `background: ${baseGradient};`;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export function resolveMainValueBackgroundCSSVariable(
|
|
340
|
+
entity: PassThroughCallableEntityWithOutputsState | TerminationEntityState,
|
|
341
|
+
) {
|
|
342
|
+
if (TERMINATION_TYPES.includes(entity.type)) {
|
|
343
|
+
return `var(--color-background-light--${entity.type})`;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return `var(--color-background--${entity.type})`;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export function fromDisabledReasonsToCardState(
|
|
350
|
+
disabledReasons: CanvasEntityDisabledReason[],
|
|
351
|
+
): CardState | undefined {
|
|
352
|
+
if (disabledReasons.includes(CanvasEntityOtherDisabledReason.Suggestion)) {
|
|
353
|
+
return CardState.Suggestion;
|
|
354
|
+
} else if (!!disabledReasons.length) {
|
|
355
|
+
return CardState.Disabled;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
return undefined;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export function resolveDatatypeIconName(dataType: DataTypeState) {
|
|
362
|
+
if (dataType.isList) {
|
|
363
|
+
return 'list';
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
if (dataType.entity.type === EntityType.DefinitionEntity) {
|
|
367
|
+
return 'definition-entity';
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
switch (dataType.entity.name) {
|
|
371
|
+
case PrimitiveTypes.Number:
|
|
372
|
+
return 'number';
|
|
373
|
+
case PrimitiveTypes.String:
|
|
374
|
+
return 'text';
|
|
375
|
+
case PrimitiveTypes.Boolean:
|
|
376
|
+
return 'boolean';
|
|
377
|
+
case PrimitiveTypes.UUID:
|
|
378
|
+
return 'uuid';
|
|
379
|
+
case PrimitiveTypes.Date:
|
|
380
|
+
return 'date-time';
|
|
381
|
+
default:
|
|
382
|
+
return 'definition-entity';
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Nested conditions have a single solid card background color
|
|
387
|
+
// Chosen between one of the condition colors
|
|
388
|
+
// Either the `--color-background--condition` or `--color-background-support--condition`
|
|
389
|
+
// Conditions can be infinetly nested and their colors should alternate each level
|
|
390
|
+
// This function checks how many nested levels away from the root condition this condition is
|
|
391
|
+
// And based on whether it is odd or even, it returns the appropriate color
|
|
392
|
+
export function resolveNestedConditionCardColor(
|
|
393
|
+
condition: ConditionState,
|
|
394
|
+
): string {
|
|
395
|
+
let level = 0;
|
|
396
|
+
|
|
397
|
+
while (condition.parent.type === EntityType.Condition) {
|
|
398
|
+
condition = condition.parent;
|
|
399
|
+
level++;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
return level % 2 === 0
|
|
403
|
+
? 'background: var(--color-background-support--condition);'
|
|
404
|
+
: 'background: var(--color-background--condition);';
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// Green
|
|
408
|
+
export const ENTRYPOINTS_COLOR = '#A7D489';
|
|
409
|
+
export const ENTRYPOINTS_SUPPORT_COLOR = '#D5E7B8';
|
|
410
|
+
export const ENTRYPOINTS_ICON_COLOR = '#A7D489';
|
|
411
|
+
export const ENTRYPOINTS_TEXT_COLOR = 'var(--color-dark-grey)';
|
|
412
|
+
|
|
413
|
+
// White card red icons
|
|
414
|
+
export const CUSTOM_ENTITY_COLOR = '#FFFFFF';
|
|
415
|
+
export const CUSTOM_ENTITY_SUPPORT_COLOR = '#FFFFFF';
|
|
416
|
+
export const CUSTOM_ENTITY_ICON_COLOR = '#F65858';
|
|
417
|
+
export const CUSTOM_ENTITY_TEXT_COLOR = '#000000';
|
|
418
|
+
|
|
419
|
+
export const INSTALLED_PROJECT_COLOR = '#FFFFFF';
|
|
420
|
+
export const INSTALLED_PROJECT_SUPPORT_COLOR = '#FFFFFF';
|
|
421
|
+
export const INSTALLED_PROJECT_ICON_COLOR = '#F65858';
|
|
422
|
+
export const INSTALLED_PROJECT_TEXT_COLOR = '#000000';
|
|
423
|
+
|
|
424
|
+
// White card dark purple icon
|
|
425
|
+
export const PROPERTY_COLOR = '#FFFFFF';
|
|
426
|
+
export const PROPERTY_SUPPORT_COLOR = '#FFFFFF';
|
|
427
|
+
export const PROPERTY_ICON_COLOR = '#7e55e6';
|
|
428
|
+
export const PROPERTY_TEXT_COLOR = '#000000';
|
|
429
|
+
|
|
430
|
+
// White card purple icon
|
|
431
|
+
export const PROJECT_COLOR = '#FFFFFF';
|
|
432
|
+
export const PROJECT_SUPPORT_COLOR = '#FFFFFF';
|
|
433
|
+
export const PROJECT_ICON_COLOR = '#A543E1';
|
|
434
|
+
export const PROJECT_TEXT_COLOR = '#000000';
|
|
435
|
+
|
|
436
|
+
// Blue
|
|
437
|
+
export const FUNCTION_CALL_COLOR = '#B5E4FF';
|
|
438
|
+
export const FUNCTION_CALL_SUPPORT_COLOR = '#D9F1FF';
|
|
439
|
+
export const FUNCTION_CALL_ICON_COLOR = '#B5E4FF';
|
|
440
|
+
export const FUNCTION_CALL_TEXT_COLOR = 'var(--color-dark-grey)';
|
|
441
|
+
|
|
442
|
+
export const OPERATION_COLOR = '#B5E4FF';
|
|
443
|
+
export const OPERATION_SUPPORT_COLOR = '#D9F1FF';
|
|
444
|
+
export const OPERATION_ICON_COLOR = '#B5E4FF';
|
|
445
|
+
export const OPERATION_TEXT_COLOR = 'var(--color-dark-grey)';
|
|
446
|
+
|
|
447
|
+
export const INTERNAL_CALL_COLOR = '#B5E4FF';
|
|
448
|
+
export const INTERNAL_CALL_SUPPORT_COLOR = '#D9F1FF';
|
|
449
|
+
export const INTERNAL_CALL_ICON_COLOR = '#B5E4FF';
|
|
450
|
+
export const INTERNAL_CALL_TEXT_COLOR = 'var(--color-dark-grey)';
|
|
451
|
+
|
|
452
|
+
// Yellow
|
|
453
|
+
export const CONDITION_COLOR = '#F5D056';
|
|
454
|
+
export const CONDITION_SUPPORT_COLOR = '#FFE9A1';
|
|
455
|
+
export const CONDITION_ICON_COLOR = '#F5D056';
|
|
456
|
+
export const CONDITION_TEXT_COLOR = 'var(--color-dark-grey)';
|
|
457
|
+
|
|
458
|
+
// Red
|
|
459
|
+
export const RETURN_STATEMENT_COLOR = '#F97C7C';
|
|
460
|
+
export const RETURN_STATEMENT_SUPPORT_COLOR = '#FFC4C4';
|
|
461
|
+
export const RETURN_STATEMENT_ICON_COLOR = '#F97C7C';
|
|
462
|
+
export const RETURN_STATEMENT_TEXT_COLOR = 'var(--color-dark-grey)';
|
|
463
|
+
|
|
464
|
+
// Grey
|
|
465
|
+
export const VARIABLE_DECLARATION_COLOR = '#D4D3D4';
|
|
466
|
+
export const VARIABLE_DECLARATION_SUPPORT_COLOR = '#ECECEC';
|
|
467
|
+
export const VARIABLE_DECLARATION_ICON_COLOR = 'var(--color-dark-grey)';
|
|
468
|
+
export const VARIABLE_DECLARATION_TEXT_COLOR = 'var(--color-dark-grey)';
|
|
469
|
+
|
|
470
|
+
export const VARIABLE_INSTANCE_COLOR = '#D4D3D4';
|
|
471
|
+
export const VARIABLE_INSTANCE_SUPPORT_COLOR = '#ECECEC';
|
|
472
|
+
export const VARIABLE_INSTANCE_ICON_COLOR = 'var(--color-dark-grey)';
|
|
473
|
+
export const VARIABLE_INSTANCE_TEXT_COLOR = 'var(--color-dark-grey)';
|
|
474
|
+
|
|
475
|
+
// Pink
|
|
476
|
+
export const SEARCH_COLOR = '#FFA8E7';
|
|
477
|
+
export const SEARCH_SUPPORT_COLOR = '#FFD3EE';
|
|
478
|
+
export const SEARCH_ICON_COLOR = '#FFA8E7';
|
|
479
|
+
export const SEARCH_TEXT_COLOR = 'var(--color-dark-grey)';
|
|
480
|
+
|
|
481
|
+
// Orange
|
|
482
|
+
export const LOOP_COLOR = '#FFBA90';
|
|
483
|
+
export const LOOP_SUPPORT_COLOR = '#FCDBC7';
|
|
484
|
+
export const LOOP_ICON_COLOR = '#FFBA90';
|
|
485
|
+
export const LOOP_TEXT_COLOR = 'var(--color-dark-grey)';
|
|
486
|
+
|
|
487
|
+
export const ENTITY_COLORS = {
|
|
488
|
+
[EntityType.DefinitionEntity]: CUSTOM_ENTITY_COLOR,
|
|
489
|
+
[EntityType.Property]: PROPERTY_COLOR,
|
|
490
|
+
[EntityType.FunctionDeclaration]: ENTRYPOINTS_COLOR,
|
|
491
|
+
[EntityType.FunctionCall]: FUNCTION_CALL_COLOR,
|
|
492
|
+
[EntityType.GlobalEvent]: ENTRYPOINTS_COLOR,
|
|
493
|
+
[EntityType.Project]: PROJECT_COLOR,
|
|
494
|
+
[EntityType.VariableDeclaration]: VARIABLE_DECLARATION_COLOR,
|
|
495
|
+
[EntityType.VariableInstance]: VARIABLE_INSTANCE_COLOR,
|
|
496
|
+
[EntityType.Condition]: CONDITION_COLOR,
|
|
497
|
+
[EntityType.Operation]: OPERATION_COLOR,
|
|
498
|
+
[EntityType.ReturnStatement]: RETURN_STATEMENT_COLOR,
|
|
499
|
+
[EntityType.BreakStatement]: RETURN_STATEMENT_COLOR,
|
|
500
|
+
[EntityType.ContinueStatement]: RETURN_STATEMENT_COLOR,
|
|
501
|
+
[EntityType.InstalledProject]: INSTALLED_PROJECT_COLOR,
|
|
502
|
+
[EntityType.Search]: SEARCH_COLOR,
|
|
503
|
+
[EntityType.Loop]: LOOP_COLOR,
|
|
504
|
+
[EntityType.InternalCall]: INTERNAL_CALL_COLOR,
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
export const ENTITY_SUPPORT_COLORS = {
|
|
508
|
+
[EntityType.DefinitionEntity]: CUSTOM_ENTITY_SUPPORT_COLOR,
|
|
509
|
+
[EntityType.Property]: PROPERTY_SUPPORT_COLOR,
|
|
510
|
+
[EntityType.FunctionDeclaration]: ENTRYPOINTS_SUPPORT_COLOR,
|
|
511
|
+
[EntityType.FunctionCall]: FUNCTION_CALL_SUPPORT_COLOR,
|
|
512
|
+
[EntityType.GlobalEvent]: ENTRYPOINTS_SUPPORT_COLOR,
|
|
513
|
+
[EntityType.Project]: PROJECT_SUPPORT_COLOR,
|
|
514
|
+
[EntityType.VariableDeclaration]: VARIABLE_DECLARATION_SUPPORT_COLOR,
|
|
515
|
+
[EntityType.VariableInstance]: VARIABLE_INSTANCE_SUPPORT_COLOR,
|
|
516
|
+
[EntityType.Condition]: CONDITION_SUPPORT_COLOR,
|
|
517
|
+
[EntityType.Operation]: OPERATION_SUPPORT_COLOR,
|
|
518
|
+
[EntityType.ReturnStatement]: RETURN_STATEMENT_SUPPORT_COLOR,
|
|
519
|
+
[EntityType.BreakStatement]: RETURN_STATEMENT_SUPPORT_COLOR,
|
|
520
|
+
[EntityType.ContinueStatement]: RETURN_STATEMENT_SUPPORT_COLOR,
|
|
521
|
+
[EntityType.InstalledProject]: INSTALLED_PROJECT_SUPPORT_COLOR,
|
|
522
|
+
[EntityType.Search]: SEARCH_SUPPORT_COLOR,
|
|
523
|
+
[EntityType.Loop]: LOOP_SUPPORT_COLOR,
|
|
524
|
+
[EntityType.InternalCall]: INTERNAL_CALL_SUPPORT_COLOR,
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
export const ENTITY_ICON_COLORS = {
|
|
528
|
+
[EntityType.DefinitionEntity]: CUSTOM_ENTITY_ICON_COLOR,
|
|
529
|
+
[EntityType.Property]: PROPERTY_ICON_COLOR,
|
|
530
|
+
[EntityType.FunctionDeclaration]: ENTRYPOINTS_ICON_COLOR,
|
|
531
|
+
[EntityType.FunctionCall]: FUNCTION_CALL_ICON_COLOR,
|
|
532
|
+
[EntityType.GlobalEvent]: ENTRYPOINTS_ICON_COLOR,
|
|
533
|
+
[EntityType.Project]: PROJECT_ICON_COLOR,
|
|
534
|
+
[EntityType.VariableDeclaration]: VARIABLE_DECLARATION_ICON_COLOR,
|
|
535
|
+
[EntityType.VariableInstance]: VARIABLE_INSTANCE_ICON_COLOR,
|
|
536
|
+
[EntityType.Condition]: CONDITION_ICON_COLOR,
|
|
537
|
+
[EntityType.Operation]: OPERATION_ICON_COLOR,
|
|
538
|
+
[EntityType.ReturnStatement]: RETURN_STATEMENT_ICON_COLOR,
|
|
539
|
+
[EntityType.BreakStatement]: RETURN_STATEMENT_ICON_COLOR,
|
|
540
|
+
[EntityType.ContinueStatement]: RETURN_STATEMENT_ICON_COLOR,
|
|
541
|
+
[EntityType.InstalledProject]: INSTALLED_PROJECT_ICON_COLOR,
|
|
542
|
+
[EntityType.Search]: SEARCH_ICON_COLOR,
|
|
543
|
+
[EntityType.Loop]: LOOP_ICON_COLOR,
|
|
544
|
+
[EntityType.InternalCall]: INTERNAL_CALL_ICON_COLOR,
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
// Entities font-awesome icon names
|
|
548
|
+
export const ENTITY_FA_ICON_NAMES = {
|
|
549
|
+
[EntityType.DefinitionEntity]: 'rectangle-list',
|
|
550
|
+
[EntityType.Property]: 't',
|
|
551
|
+
// @ts-ignore
|
|
552
|
+
[EntityType.FunctionDeclaration]: 'trowel-bricks' || 'cube' || 'right-long',
|
|
553
|
+
// @ts-ignore
|
|
554
|
+
[EntityType.FunctionCall]: 'trowel-bricks' || 'cube' || 'right-long',
|
|
555
|
+
// @ts-ignore
|
|
556
|
+
[EntityType.InternalCall]: 'trowel-bricks' || 'cube' || 'right-long',
|
|
557
|
+
[EntityType.GlobalEvent]: 'ear-listen',
|
|
558
|
+
[EntityType.Project]: 'project-diagram',
|
|
559
|
+
[EntityType.VariableDeclaration]: 'database',
|
|
560
|
+
[EntityType.VariableInstance]: 'database',
|
|
561
|
+
[EntityType.Condition]: 'code-branch',
|
|
562
|
+
// @ts-ignore
|
|
563
|
+
[EntityType.Operation]: 'cogs' || 'calculator',
|
|
564
|
+
// @ts-ignore
|
|
565
|
+
[EntityType.ActionDescriptor]: 'cogs' || 'calculator',
|
|
566
|
+
[EntityType.ReturnStatement]: 'right-from-bracket',
|
|
567
|
+
[EntityType.BreakStatement]: 'right-from-bracket',
|
|
568
|
+
[EntityType.ContinueStatement]: 'forward-step',
|
|
569
|
+
[EntityType.InstalledProject]: 'project-diagram',
|
|
570
|
+
[EntityType.Search]: 'search',
|
|
571
|
+
[EntityType.Loop]: 'sync',
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
export const PLAY_FA_ICON_NAME = 'play';
|
|
575
|
+
export const STOP_FA_ICON_NAME = 'stop';
|
|
576
|
+
export const LOOP_FA_ICON_NAME = 'sync';
|
|
577
|
+
|
|
578
|
+
export const ENTITY_TEST_FA_ICON_NAMES = {
|
|
579
|
+
[EntityType.DefinitionEntity]: PLAY_FA_ICON_NAME,
|
|
580
|
+
[EntityType.FunctionDeclaration]: PLAY_FA_ICON_NAME,
|
|
581
|
+
[EntityType.FunctionCall]: PLAY_FA_ICON_NAME,
|
|
582
|
+
[EntityType.InternalCall]: PLAY_FA_ICON_NAME,
|
|
583
|
+
[EntityType.GlobalEvent]: PLAY_FA_ICON_NAME,
|
|
584
|
+
[EntityType.VariableDeclaration]: PLAY_FA_ICON_NAME,
|
|
585
|
+
[EntityType.VariableInstance]: PLAY_FA_ICON_NAME,
|
|
586
|
+
[EntityType.Condition]: PLAY_FA_ICON_NAME,
|
|
587
|
+
[EntityType.Operation]: PLAY_FA_ICON_NAME,
|
|
588
|
+
[EntityType.InstalledProject]: PLAY_FA_ICON_NAME,
|
|
589
|
+
[EntityType.Search]: PLAY_FA_ICON_NAME,
|
|
590
|
+
[EntityType.ReturnStatement]: STOP_FA_ICON_NAME,
|
|
591
|
+
[EntityType.BreakStatement]: STOP_FA_ICON_NAME,
|
|
592
|
+
[EntityType.ContinueStatement]: STOP_FA_ICON_NAME,
|
|
593
|
+
[EntityType.Loop]: LOOP_FA_ICON_NAME,
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
export function resolveDefinitionEntitySubheader(
|
|
597
|
+
entity: DefinitionEntityState,
|
|
598
|
+
): string {
|
|
599
|
+
// Base on the base logic entity that they extend, derive a human readable subheader text
|
|
600
|
+
const lowestDefinitionEntity = getExtendedDefinitionEntity(entity);
|
|
601
|
+
|
|
602
|
+
if (!lowestDefinitionEntity) {
|
|
603
|
+
const baseEntityTypes =
|
|
604
|
+
flattenDefinitionEntityExtensionAndImplementationTypes(entity);
|
|
605
|
+
|
|
606
|
+
if (baseEntityTypes.includes(BaseEntityNames.HTTP_ENDPOINT)) {
|
|
607
|
+
return 'HTTP endpoint';
|
|
608
|
+
} else if (baseEntityTypes.includes(BaseEntityNames.PERSISTED_ENTITY)) {
|
|
609
|
+
return 'Persisted entity';
|
|
610
|
+
} else if (baseEntityTypes.includes(BaseEntityNames.CRON_JOB)) {
|
|
611
|
+
return 'Scheduled execution';
|
|
612
|
+
} else if (baseEntityTypes.includes(BaseEntityNames.RELATIONAL_DATABASE)) {
|
|
613
|
+
return 'Relational database';
|
|
614
|
+
} else if (
|
|
615
|
+
baseEntityTypes.includes(BaseEntityNames.AIRTABLE_AUTH_CONNECTION)
|
|
616
|
+
) {
|
|
617
|
+
return 'Airtable account connection';
|
|
618
|
+
} else if (
|
|
619
|
+
baseEntityTypes.includes(BaseEntityNames.GOOGLE_AUTH_CONNECTION)
|
|
620
|
+
) {
|
|
621
|
+
return 'Google account connection';
|
|
622
|
+
} else if (
|
|
623
|
+
baseEntityTypes.includes(BaseEntityNames.SLACK_AUTH_CONNECTION)
|
|
624
|
+
) {
|
|
625
|
+
return 'Slack account connection';
|
|
626
|
+
} else if (
|
|
627
|
+
baseEntityTypes.includes(BaseEntityNames.ATLASSIAN_AUTH_CONNECTION)
|
|
628
|
+
) {
|
|
629
|
+
return 'Atlassian account connection';
|
|
630
|
+
} else if (baseEntityTypes.includes(BaseEntityNames.JIRA_AUTH_CONNECTION)) {
|
|
631
|
+
return 'Jira account connection';
|
|
632
|
+
} else if (
|
|
633
|
+
baseEntityTypes.includes(BaseEntityNames.MICROSOFT_AUTH_CONNECTION)
|
|
634
|
+
) {
|
|
635
|
+
return 'Microsoft account connection';
|
|
636
|
+
} else if (
|
|
637
|
+
baseEntityTypes.includes(BaseEntityNames.OPENAI_AUTH_CONNECTION)
|
|
638
|
+
) {
|
|
639
|
+
return 'OpenAI account connection';
|
|
640
|
+
} else if (
|
|
641
|
+
baseEntityTypes.includes(BaseEntityNames.EXTERNAL_INTEGRATION_CONNECTION)
|
|
642
|
+
) {
|
|
643
|
+
return 'External account connection';
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
if (!!lowestDefinitionEntity) {
|
|
648
|
+
let baseName =
|
|
649
|
+
'Extension of ' +
|
|
650
|
+
resolveEntityName(
|
|
651
|
+
lowestDefinitionEntity,
|
|
652
|
+
lowestDefinitionEntity.project,
|
|
653
|
+
) +
|
|
654
|
+
' entity';
|
|
655
|
+
|
|
656
|
+
let baseNameLowerFirst = lowercaseFirstLetter(baseName);
|
|
657
|
+
|
|
658
|
+
const baseEntityTypes =
|
|
659
|
+
flattenDefinitionEntityExtensionAndImplementationTypes(entity);
|
|
660
|
+
|
|
661
|
+
if (baseEntityTypes.includes(BaseEntityNames.HTTP_ENDPOINT)) {
|
|
662
|
+
return (
|
|
663
|
+
'HTTP endpoint' +
|
|
664
|
+
(!!baseNameLowerFirst ? ', ' + baseNameLowerFirst : '')
|
|
665
|
+
);
|
|
666
|
+
} else if (baseEntityTypes.includes(BaseEntityNames.PERSISTED_ENTITY)) {
|
|
667
|
+
return (
|
|
668
|
+
'Persisted entity' +
|
|
669
|
+
(!!baseNameLowerFirst ? ', ' + baseNameLowerFirst : '')
|
|
670
|
+
);
|
|
671
|
+
} else if (baseEntityTypes.includes(BaseEntityNames.CRON_JOB)) {
|
|
672
|
+
return (
|
|
673
|
+
'Scheduled execution' +
|
|
674
|
+
(!!baseNameLowerFirst ? ', ' + baseNameLowerFirst : '')
|
|
675
|
+
);
|
|
676
|
+
} else if (baseEntityTypes.includes(BaseEntityNames.RELATIONAL_DATABASE)) {
|
|
677
|
+
return (
|
|
678
|
+
'Relational database' +
|
|
679
|
+
(!!baseNameLowerFirst ? ', ' + baseNameLowerFirst : '')
|
|
680
|
+
);
|
|
681
|
+
} else if (
|
|
682
|
+
baseEntityTypes.includes(BaseEntityNames.AIRTABLE_AUTH_CONNECTION)
|
|
683
|
+
) {
|
|
684
|
+
return (
|
|
685
|
+
'Airtable account connection' +
|
|
686
|
+
(!!baseNameLowerFirst ? ', ' + baseNameLowerFirst : '')
|
|
687
|
+
);
|
|
688
|
+
} else if (
|
|
689
|
+
baseEntityTypes.includes(BaseEntityNames.GOOGLE_AUTH_CONNECTION)
|
|
690
|
+
) {
|
|
691
|
+
return (
|
|
692
|
+
'Google account connection' +
|
|
693
|
+
(!!baseNameLowerFirst ? ', ' + baseNameLowerFirst : '')
|
|
694
|
+
);
|
|
695
|
+
} else if (
|
|
696
|
+
baseEntityTypes.includes(BaseEntityNames.SLACK_AUTH_CONNECTION)
|
|
697
|
+
) {
|
|
698
|
+
return (
|
|
699
|
+
'Slack account connection' +
|
|
700
|
+
(!!baseNameLowerFirst ? ', ' + baseNameLowerFirst : '')
|
|
701
|
+
);
|
|
702
|
+
} else if (
|
|
703
|
+
baseEntityTypes.includes(BaseEntityNames.ATLASSIAN_AUTH_CONNECTION)
|
|
704
|
+
) {
|
|
705
|
+
return (
|
|
706
|
+
'Atlassian account connection' +
|
|
707
|
+
(!!baseNameLowerFirst ? ', ' + baseNameLowerFirst : '')
|
|
708
|
+
);
|
|
709
|
+
} else if (baseEntityTypes.includes(BaseEntityNames.JIRA_AUTH_CONNECTION)) {
|
|
710
|
+
return (
|
|
711
|
+
'Jira account connection' +
|
|
712
|
+
(!!baseNameLowerFirst ? ', ' + baseNameLowerFirst : '')
|
|
713
|
+
);
|
|
714
|
+
} else if (
|
|
715
|
+
baseEntityTypes.includes(BaseEntityNames.MICROSOFT_AUTH_CONNECTION)
|
|
716
|
+
) {
|
|
717
|
+
return (
|
|
718
|
+
'Microsoft account connection' +
|
|
719
|
+
(!!baseNameLowerFirst ? ', ' + baseNameLowerFirst : '')
|
|
720
|
+
);
|
|
721
|
+
} else if (
|
|
722
|
+
baseEntityTypes.includes(BaseEntityNames.OPENAI_AUTH_CONNECTION)
|
|
723
|
+
) {
|
|
724
|
+
return (
|
|
725
|
+
'OpenAI account connection' +
|
|
726
|
+
(!!baseNameLowerFirst ? ', ' + baseNameLowerFirst : '')
|
|
727
|
+
);
|
|
728
|
+
} else if (
|
|
729
|
+
baseEntityTypes.includes(BaseEntityNames.EXTERNAL_INTEGRATION_CONNECTION)
|
|
730
|
+
) {
|
|
731
|
+
return (
|
|
732
|
+
'External account connection' +
|
|
733
|
+
(!!baseNameLowerFirst ? ', ' + baseNameLowerFirst : '')
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
return baseName;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
let prefix: string = '';
|
|
741
|
+
|
|
742
|
+
if (entity.abstract) {
|
|
743
|
+
prefix = 'Template ';
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
if (entity.static) {
|
|
747
|
+
prefix += !!prefix ? ' single copy ' : 'Single copy ';
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
return !!prefix ? prefix + 'definition' : 'Definition';
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
export function resolveMethodCardSubheader(
|
|
754
|
+
entity: FunctionDeclarationState,
|
|
755
|
+
): string {
|
|
756
|
+
if (
|
|
757
|
+
entity.parent.type === EntityType.DefinitionEntity ||
|
|
758
|
+
entity.parent.type === EntityType.InstalledProject
|
|
759
|
+
) {
|
|
760
|
+
return (
|
|
761
|
+
'Internal action of ' + resolveEntityName(entity.parent, entity.project)
|
|
762
|
+
);
|
|
763
|
+
} else if (entity.parent.type === EntityType.Loop) {
|
|
764
|
+
return 'Action repeated on every iteration';
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
return 'Internal action of entity';
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
export function resolveFunctionDeclarationCardSubheader(
|
|
771
|
+
entity: FunctionDeclarationState,
|
|
772
|
+
): string {
|
|
773
|
+
const isMethod = checkIsMethod(entity);
|
|
774
|
+
|
|
775
|
+
if (isMethod) {
|
|
776
|
+
return resolveMethodCardSubheader(entity);
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
return 'Custom trigger';
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
export function resolveCardSubheader(entity: CanvasEntityState): string {
|
|
783
|
+
switch (entity.type) {
|
|
784
|
+
case EntityType.DefinitionEntity: {
|
|
785
|
+
return resolveDefinitionEntitySubheader(entity);
|
|
786
|
+
}
|
|
787
|
+
case EntityType.FunctionDeclaration: {
|
|
788
|
+
return resolveFunctionDeclarationCardSubheader(entity);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
return READABLE_ENTITY_TYPES[entity.type]?.singular;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
export function resolveEntitySubheader(
|
|
796
|
+
entity:
|
|
797
|
+
| VariableState
|
|
798
|
+
| DefinitionEntityState
|
|
799
|
+
| LoopState
|
|
800
|
+
| SearchState
|
|
801
|
+
| FunctionDeclarationState
|
|
802
|
+
| GlobalEventState
|
|
803
|
+
| ReturnStatementState
|
|
804
|
+
| BreakStatementState
|
|
805
|
+
| ContinueStatementState
|
|
806
|
+
| BuiltInBaseEntityState,
|
|
807
|
+
): string {
|
|
808
|
+
switch (entity.type) {
|
|
809
|
+
case EntityType.DefinitionEntity: {
|
|
810
|
+
return resolveDefinitionEntitySubheader(entity);
|
|
811
|
+
}
|
|
812
|
+
case EntityType.FunctionDeclaration: {
|
|
813
|
+
return resolveFunctionDeclarationCardSubheader(entity);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
return READABLE_ENTITY_TYPES[entity.type]?.singular;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
// Pixels depend on zoom level for all the value below. Therefore these are just an approximation
|
|
821
|
+
export const CANVAS_SIZE = 40000;
|
|
822
|
+
export const CANVAS_CARD_WIDTH = 280;
|
|
823
|
+
|
|
824
|
+
// This is an approximation and the actual height of the card could be calculated based on the number of properties or something else
|
|
825
|
+
export const CANVAS_COMPLEX_CARD_HEIGHT = 300;
|
|
826
|
+
export const CANVAS_SIMPLE_CARD_HEIGHT = 65;
|
|
827
|
+
export const CANVAS_CARD_HEADER_CENTER_HEIGHT = 32;
|
|
828
|
+
|
|
829
|
+
export const PROPERTY_HEIGHT = 39;
|
|
830
|
+
export const NESTED_PROPERTY_HEIGHT = 26;
|
|
831
|
+
export const STATIC_PROPERTY_HEIGHT = 49;
|
|
832
|
+
export const MAIN_VALUE_PROPERTY_HEADER_HEIGHT = 44;
|
|
833
|
+
export const MAIN_VALUE_SUB_PROPERTY_HEIGHT = 35;
|
|
834
|
+
export const ERROR_PROPERTY_HEIGHT = 52;
|
|
835
|
+
export const CARD_PROPERTIES_SECTION_SINGLE_PADDING = 10;
|
|
836
|
+
export const CARD_PROPERTIES_SECTION_PADDING =
|
|
837
|
+
CARD_PROPERTIES_SECTION_SINGLE_PADDING * 2;
|
|
838
|
+
export const CARD_FOOTER_HEIGHT = 38;
|
|
839
|
+
|
|
840
|
+
export const CANVAS_VERTICAL_BUFFER_BETWEEN_CARDS = 90;
|
|
841
|
+
export const CANVAS_HORIZONTAL_BUFFER_BETWEEN_CARDS = 270;
|
|
842
|
+
|
|
843
|
+
// This is some base coordinate that we will use to offset the cards from the top left corner of the canvas
|
|
844
|
+
export const CANVAS_BASE_X = CANVAS_SIZE / 2 + 120;
|
|
845
|
+
export const CANVAS_BASE_Y = CANVAS_SIZE / 2 + 180;
|
|
846
|
+
|
|
847
|
+
export function calculateMethodCardSize(entity: FunctionDeclarationState): {
|
|
848
|
+
height: number;
|
|
849
|
+
width: number;
|
|
850
|
+
} {
|
|
851
|
+
const entityCardWidth = 280;
|
|
852
|
+
|
|
853
|
+
let height: number =
|
|
854
|
+
CANVAS_CARD_HEADER_CENTER_HEIGHT +
|
|
855
|
+
MAIN_VALUE_PROPERTY_HEADER_HEIGHT +
|
|
856
|
+
CARD_FOOTER_HEIGHT +
|
|
857
|
+
CARD_PROPERTIES_SECTION_SINGLE_PADDING;
|
|
858
|
+
|
|
859
|
+
const properties: any[] = [...entity.inputs];
|
|
860
|
+
|
|
861
|
+
if (properties.length) {
|
|
862
|
+
height += CARD_PROPERTIES_SECTION_PADDING;
|
|
863
|
+
|
|
864
|
+
properties.forEach(() => {
|
|
865
|
+
height += NESTED_PROPERTY_HEIGHT;
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
return {
|
|
870
|
+
height: height,
|
|
871
|
+
width: entityCardWidth,
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
export function calculateNestedConditionCardSize(entity: ConditionState): {
|
|
876
|
+
height: number;
|
|
877
|
+
width: number;
|
|
878
|
+
} {
|
|
879
|
+
const entityCardWidth = 280;
|
|
880
|
+
|
|
881
|
+
let height: number =
|
|
882
|
+
CANVAS_CARD_HEADER_CENTER_HEIGHT +
|
|
883
|
+
MAIN_VALUE_PROPERTY_HEADER_HEIGHT +
|
|
884
|
+
CARD_FOOTER_HEIGHT +
|
|
885
|
+
CARD_PROPERTIES_SECTION_SINGLE_PADDING;
|
|
886
|
+
|
|
887
|
+
const properties: any[] = [...entity.inputs];
|
|
888
|
+
|
|
889
|
+
if (properties.length) {
|
|
890
|
+
height += CARD_PROPERTIES_SECTION_PADDING;
|
|
891
|
+
|
|
892
|
+
properties.forEach(() => {
|
|
893
|
+
height += NESTED_PROPERTY_HEIGHT;
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
if (entity.andChildrenGroup) {
|
|
898
|
+
height += CARD_PROPERTIES_SECTION_PADDING;
|
|
899
|
+
|
|
900
|
+
entity.andChildrenGroup.forEach((c) => {
|
|
901
|
+
height += calculateNestedConditionCardSize(c).height;
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
if (entity.orChildrenGroup) {
|
|
906
|
+
height += CARD_PROPERTIES_SECTION_PADDING;
|
|
907
|
+
|
|
908
|
+
entity.orChildrenGroup.forEach((c) => {
|
|
909
|
+
height += calculateNestedConditionCardSize(c).height;
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
if (
|
|
914
|
+
entity.declaration?.id ===
|
|
915
|
+
BUILT_IN_BASE_ENTITY_IDS.condition['condition-group-and'].id ||
|
|
916
|
+
entity.declaration?.id ===
|
|
917
|
+
BUILT_IN_BASE_ENTITY_IDS.condition['condition-group-or'].id
|
|
918
|
+
) {
|
|
919
|
+
// For the new nested condition button
|
|
920
|
+
height += CARD_FOOTER_HEIGHT;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
return {
|
|
924
|
+
height: height,
|
|
925
|
+
width: entityCardWidth,
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
export function calculateCardSize(entity: CanvasEntityState): {
|
|
930
|
+
height: number;
|
|
931
|
+
width: number;
|
|
932
|
+
} {
|
|
933
|
+
const entityCardWidth = 280;
|
|
934
|
+
|
|
935
|
+
let height: number = CANVAS_SIMPLE_CARD_HEIGHT;
|
|
936
|
+
|
|
937
|
+
// Internal card properties which are displayed inside the parent entity in the canvas
|
|
938
|
+
const inputProperties: any[] = [];
|
|
939
|
+
|
|
940
|
+
// Entities with properties
|
|
941
|
+
if ([EntityType.DefinitionEntity].includes(entity.type)) {
|
|
942
|
+
const properties = [
|
|
943
|
+
...((entity as DefinitionEntityState).suggestedProperties || []),
|
|
944
|
+
...((entity as DefinitionEntityState).properties || []),
|
|
945
|
+
];
|
|
946
|
+
|
|
947
|
+
if (properties.length) {
|
|
948
|
+
height += CARD_PROPERTIES_SECTION_PADDING;
|
|
949
|
+
|
|
950
|
+
properties.forEach((property) => {
|
|
951
|
+
height += property.static ? STATIC_PROPERTY_HEIGHT : PROPERTY_HEIGHT;
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
// Entities with methods
|
|
957
|
+
if (
|
|
958
|
+
[
|
|
959
|
+
EntityType.DefinitionEntity,
|
|
960
|
+
EntityType.InstalledProject,
|
|
961
|
+
EntityType.Loop,
|
|
962
|
+
].includes(entity.type)
|
|
963
|
+
) {
|
|
964
|
+
const methods = [
|
|
965
|
+
...((entity as DefinitionEntityState)?.suggestedMethods || []),
|
|
966
|
+
...((entity as DefinitionEntityState).methods || []),
|
|
967
|
+
...((entity as InstalledProjectState).functions || []),
|
|
968
|
+
...((entity as LoopState).body ? [(entity as LoopState).body] : []),
|
|
969
|
+
];
|
|
970
|
+
|
|
971
|
+
if (methods.length) {
|
|
972
|
+
height += CARD_PROPERTIES_SECTION_PADDING;
|
|
973
|
+
|
|
974
|
+
methods.forEach((method) => {
|
|
975
|
+
const methodSize = calculateMethodCardSize(method);
|
|
976
|
+
height += methodSize.height;
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
if (PASS_THROUGH_CALLABLE_TYPES.includes(entity.type)) {
|
|
982
|
+
inputProperties.push(
|
|
983
|
+
...(((entity as FunctionCallState).inputs || []).flatMap((input) => [
|
|
984
|
+
input,
|
|
985
|
+
]) || []),
|
|
986
|
+
);
|
|
987
|
+
|
|
988
|
+
// For the value writting main output
|
|
989
|
+
height += CARD_PROPERTIES_SECTION_PADDING;
|
|
990
|
+
height += MAIN_VALUE_PROPERTY_HEADER_HEIGHT;
|
|
991
|
+
|
|
992
|
+
if (!!(entity as FunctionCallState).error) {
|
|
993
|
+
height += ERROR_PROPERTY_HEIGHT;
|
|
994
|
+
}
|
|
995
|
+
} else if (
|
|
996
|
+
[
|
|
997
|
+
EntityType.ReturnStatement,
|
|
998
|
+
EntityType.BreakStatement,
|
|
999
|
+
EntityType.ContinueStatement,
|
|
1000
|
+
].includes(entity.type)
|
|
1001
|
+
) {
|
|
1002
|
+
inputProperties.push(...((entity as ReturnStatementState).outputs || []));
|
|
1003
|
+
|
|
1004
|
+
if (!!(entity as ReturnStatementState).throws) {
|
|
1005
|
+
height += ERROR_PROPERTY_HEIGHT;
|
|
1006
|
+
}
|
|
1007
|
+
} else if (entity.type === EntityType.Condition) {
|
|
1008
|
+
inputProperties.push(entity.inputs[0]);
|
|
1009
|
+
|
|
1010
|
+
if (entity.inputs[1]) {
|
|
1011
|
+
inputProperties.push(entity.inputs[1]);
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
if (
|
|
1015
|
+
entity.declaration?.id ===
|
|
1016
|
+
BUILT_IN_BASE_ENTITY_IDS.condition['condition-group-and'].id ||
|
|
1017
|
+
entity.declaration?.id ===
|
|
1018
|
+
BUILT_IN_BASE_ENTITY_IDS.condition['condition-group-or'].id
|
|
1019
|
+
) {
|
|
1020
|
+
// For the new nested condition button
|
|
1021
|
+
height += CARD_FOOTER_HEIGHT;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
if (entity.andChildrenGroup) {
|
|
1025
|
+
height += CARD_PROPERTIES_SECTION_PADDING;
|
|
1026
|
+
|
|
1027
|
+
entity.andChildrenGroup.forEach((c) => {
|
|
1028
|
+
height += calculateNestedConditionCardSize(c).height;
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
if (entity.orChildrenGroup) {
|
|
1033
|
+
height += CARD_PROPERTIES_SECTION_PADDING;
|
|
1034
|
+
|
|
1035
|
+
entity.orChildrenGroup.forEach((c) => {
|
|
1036
|
+
height += calculateNestedConditionCardSize(c).height;
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
const numberOfInputProperties = inputProperties.length;
|
|
1042
|
+
|
|
1043
|
+
if (numberOfInputProperties) {
|
|
1044
|
+
height += numberOfInputProperties * PROPERTY_HEIGHT;
|
|
1045
|
+
// Padding for property area
|
|
1046
|
+
height += CARD_PROPERTIES_SECTION_PADDING;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
// Handles all the events
|
|
1050
|
+
const outputProperties: any[] = [];
|
|
1051
|
+
|
|
1052
|
+
if (
|
|
1053
|
+
entity.type === EntityType.FunctionDeclaration ||
|
|
1054
|
+
entity.type === EntityType.GlobalEvent
|
|
1055
|
+
) {
|
|
1056
|
+
outputProperties.push(
|
|
1057
|
+
...((entity as FunctionDeclarationState).inputs || []),
|
|
1058
|
+
);
|
|
1059
|
+
} else if (PASS_THROUGH_CALLABLE_TYPES.includes(entity.type)) {
|
|
1060
|
+
outputProperties.push(...((entity as FunctionCallState).outputs || []));
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
if (VARIABLE_TYPES.includes(entity.type)) {
|
|
1064
|
+
// Handle main value reading and writing
|
|
1065
|
+
height += CARD_PROPERTIES_SECTION_PADDING;
|
|
1066
|
+
height += MAIN_VALUE_PROPERTY_HEADER_HEIGHT;
|
|
1067
|
+
|
|
1068
|
+
// Handle internal calls
|
|
1069
|
+
if ((entity as VariableDeclarationState).usedInternalCalls.length) {
|
|
1070
|
+
(entity as VariableDeclarationState).usedInternalCalls.forEach((ic) => {
|
|
1071
|
+
height += ERROR_PROPERTY_HEIGHT + CARD_PROPERTIES_SECTION_PADDING;
|
|
1072
|
+
|
|
1073
|
+
height += ic.inputs.length * NESTED_PROPERTY_HEIGHT;
|
|
1074
|
+
height += ic.outputs.length * NESTED_PROPERTY_HEIGHT;
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
const variableDataType = (entity as VariableDeclarationState).getDataType(
|
|
1079
|
+
null,
|
|
1080
|
+
);
|
|
1081
|
+
|
|
1082
|
+
if (!variableDataType || variableDataType.canModifyObjectStructure()) {
|
|
1083
|
+
// For the new input button
|
|
1084
|
+
height += CARD_FOOTER_HEIGHT;
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
if (entity.type === EntityType.Search) {
|
|
1089
|
+
// For the new input button
|
|
1090
|
+
height += CARD_FOOTER_HEIGHT;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
const numberOfOutputProperties = outputProperties.length;
|
|
1094
|
+
|
|
1095
|
+
if (numberOfOutputProperties) {
|
|
1096
|
+
height += numberOfOutputProperties * PROPERTY_HEIGHT;
|
|
1097
|
+
// Padding for property area
|
|
1098
|
+
height += CARD_PROPERTIES_SECTION_PADDING;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
// Entities that have a footer button
|
|
1102
|
+
if (
|
|
1103
|
+
[
|
|
1104
|
+
EntityType.DefinitionEntity,
|
|
1105
|
+
EntityType.FunctionDeclaration,
|
|
1106
|
+
EntityType.ReturnStatement,
|
|
1107
|
+
EntityType.BreakStatement,
|
|
1108
|
+
EntityType.ContinueStatement,
|
|
1109
|
+
].includes(entity.type)
|
|
1110
|
+
) {
|
|
1111
|
+
height += CARD_FOOTER_HEIGHT;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
const entityCardHeight = height;
|
|
1115
|
+
|
|
1116
|
+
return {
|
|
1117
|
+
height: entityCardHeight,
|
|
1118
|
+
width: entityCardWidth,
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
export function errorCodeToMessage(errorCode: string): string {
|
|
1123
|
+
// Split the error code by dash to break it into words
|
|
1124
|
+
const words = errorCode.split('-');
|
|
1125
|
+
|
|
1126
|
+
// Capitalize the first letter of each word
|
|
1127
|
+
const humanReadable = words
|
|
1128
|
+
.map((word, index) => {
|
|
1129
|
+
// Capitalize the first word completely (for sentence readability)
|
|
1130
|
+
if (index === 0) {
|
|
1131
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
1132
|
+
}
|
|
1133
|
+
// Lowercase the rest of the words
|
|
1134
|
+
return word.toLowerCase();
|
|
1135
|
+
})
|
|
1136
|
+
.join(' '); // Join the words with spaces in between
|
|
1137
|
+
|
|
1138
|
+
// Return the formatted message
|
|
1139
|
+
return `${humanReadable}.`;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
export function highlightElement(element: HTMLElement) {
|
|
1143
|
+
element.classList.add('highlighted');
|
|
1144
|
+
|
|
1145
|
+
const handleAnimationEnd = () => {
|
|
1146
|
+
element.classList.remove('highlighted');
|
|
1147
|
+
element.removeEventListener('animationend', handleAnimationEnd);
|
|
1148
|
+
};
|
|
1149
|
+
|
|
1150
|
+
element.addEventListener('animationend', handleAnimationEnd);
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
export function highlightElementIndefinetly(element: HTMLElement) {
|
|
1154
|
+
element.classList.add('highlighted-infinate');
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
export function removeHighlightElementIndefinetly(element: HTMLElement) {
|
|
1158
|
+
element.classList.remove('highlighted-infinate');
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
// Success highlight
|
|
1162
|
+
export function highlightElementSuccess(element: HTMLElement) {
|
|
1163
|
+
element.classList.add('highlighted-success');
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
export function removeHighlightElementSuccess(element: HTMLElement) {
|
|
1167
|
+
element.classList.remove('highlighted-success');
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
export function highlighOverlappingElements(
|
|
1171
|
+
elementA: HTMLElement,
|
|
1172
|
+
elementB: HTMLElement,
|
|
1173
|
+
) {
|
|
1174
|
+
elementA.classList.add('errored');
|
|
1175
|
+
elementB.classList.add('errored');
|
|
1176
|
+
|
|
1177
|
+
const handleElementAAnimationEnd = () => {
|
|
1178
|
+
elementA.classList.remove('errored');
|
|
1179
|
+
elementA.removeEventListener('animationend', handleElementAAnimationEnd);
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1182
|
+
elementA.addEventListener('animationend', handleElementAAnimationEnd);
|
|
1183
|
+
|
|
1184
|
+
const handleElementBAnimationEnd = () => {
|
|
1185
|
+
elementB.classList.remove('errored');
|
|
1186
|
+
elementB.removeEventListener('animationend', handleElementBAnimationEnd);
|
|
1187
|
+
};
|
|
1188
|
+
|
|
1189
|
+
elementB.addEventListener('animationend', handleElementBAnimationEnd);
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
export function entityDisabledReasonToShortReadableError(
|
|
1193
|
+
code: CanvasEntityConnectionDisabledReason | string,
|
|
1194
|
+
): string {
|
|
1195
|
+
const errorCallerOnly = (code || '').startsWith('error-caller-only--');
|
|
1196
|
+
const sanitizedCode = errorCallerOnly
|
|
1197
|
+
? code.replace('error-caller-only--', '')
|
|
1198
|
+
: code;
|
|
1199
|
+
|
|
1200
|
+
switch (sanitizedCode) {
|
|
1201
|
+
case CanvasEntityConnectionDisabledReason.CallIsInHigherScope:
|
|
1202
|
+
return 'In a higher scope';
|
|
1203
|
+
case CanvasEntityConnectionDisabledReason.CallIsInLowerScope:
|
|
1204
|
+
return 'In a lower scope';
|
|
1205
|
+
case CanvasEntityConnectionDisabledReason.CallerIsInHigherScope:
|
|
1206
|
+
return 'Caller is in a higher scope';
|
|
1207
|
+
case CanvasEntityConnectionDisabledReason.CallerIsInLowerScope:
|
|
1208
|
+
return 'Caller is in a lower scope';
|
|
1209
|
+
case CanvasEntityConnectionDisabledReason.CannotBeCalledByChildren:
|
|
1210
|
+
return 'Cannot be called by children';
|
|
1211
|
+
case CanvasEntityConnectionDisabledReason.CannotCallAncestor:
|
|
1212
|
+
return 'Cannot call ancestor';
|
|
1213
|
+
case CanvasEntityConnectionDisabledReason.CannotConnectToItself:
|
|
1214
|
+
return 'Cannot connect to itself';
|
|
1215
|
+
case CanvasEntityConnectionDisabledReason.CannotReadMoreThanOneValue:
|
|
1216
|
+
return 'Cannot read more than one value';
|
|
1217
|
+
case CanvasEntityConnectionDisabledReason.CannotReadValueFromChildren:
|
|
1218
|
+
return 'Cannot read value from entities executed after itself';
|
|
1219
|
+
case CanvasEntityConnectionDisabledReason.CannotWriteValueToAncestor:
|
|
1220
|
+
return 'Cannot write value to ancestor';
|
|
1221
|
+
case CanvasEntityOtherDisabledReason.Suggestion:
|
|
1222
|
+
return 'Suggestion';
|
|
1223
|
+
case CanvasEntityConnectionDisabledReason.ContinueOrBreakStatementCalledFromOutsideLoop:
|
|
1224
|
+
return 'Cannot be called from outside loop';
|
|
1225
|
+
case CanvasEntityConnectionDisabledReason.DataTypesNotCompatible:
|
|
1226
|
+
return 'Data types not compatible';
|
|
1227
|
+
case CanvasEntityConnectionDisabledReason.ElementInLoopBodyCallingOutsideLoop:
|
|
1228
|
+
return 'Cannot call outside loop';
|
|
1229
|
+
case CanvasEntityConnectionDisabledReason.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees:
|
|
1230
|
+
return 'Error cannot be connected to success branch';
|
|
1231
|
+
case CanvasEntityConnectionDisabledReason.ExecutionsAlreadyConnected:
|
|
1232
|
+
return 'Executions already connected';
|
|
1233
|
+
case CanvasEntityConnectionDisabledReason.IsNotValueReadingEntity:
|
|
1234
|
+
return 'Is not a value reading entity';
|
|
1235
|
+
case CanvasEntityConnectionDisabledReason.IsNotValueWritingEntity:
|
|
1236
|
+
return 'Is not a value writing entity';
|
|
1237
|
+
case CanvasEntityConnectionDisabledReason.NotInScope:
|
|
1238
|
+
return 'Not in a compatible scope';
|
|
1239
|
+
case CanvasEntityConnectionDisabledReason.OtherIncompatibleScopeReason:
|
|
1240
|
+
return 'Incompatible scope';
|
|
1241
|
+
case CanvasEntityConnectionDisabledReason.SiblingInternalCallAlreadyUsedInParentVariable:
|
|
1242
|
+
return 'Internal call already used in parent variable';
|
|
1243
|
+
case CanvasEntityConnectionDisabledReason.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees:
|
|
1244
|
+
return 'Success cannot be connected to error branch';
|
|
1245
|
+
case CanvasEntityConnectionDisabledReason.ValuesAlreadyConnected:
|
|
1246
|
+
return 'Values already connected';
|
|
1247
|
+
case CanvasEntityConnectionDisabledReason.CannotInteractWithInputInVariableWithInternalCalls:
|
|
1248
|
+
return 'Cannot interact with input in variable with internal calls';
|
|
1249
|
+
case CanvasEntityConnectionDisabledReason.CannotInteractWithOutputInVariableWithInternalCalls:
|
|
1250
|
+
return 'Cannot interact with output in variable with internal calls';
|
|
1251
|
+
case CanvasEntityOtherDisabledReason.CanvasGloballyDisabled:
|
|
1252
|
+
return 'Canvas is globally disabled';
|
|
1253
|
+
case CanvasEntityConnectionDisabledReason.PropertyIsConstantItsValueCantBeReset:
|
|
1254
|
+
return "Property is constant, its value can't be reset";
|
|
1255
|
+
case CanvasEntityConnectionDisabledReason.CannotWriteValueOfGlobalVariableDeclaration:
|
|
1256
|
+
return 'Cannot write value of global variable declaration';
|
|
1257
|
+
case CanvasEntityConnectionDisabledReason.CannotReSetValueOfConstantVariable:
|
|
1258
|
+
return 'Cannot re-set value of constant variable';
|
|
1259
|
+
case CanvasEntityConnectionDisabledReason.CannotConnectToOwnNode:
|
|
1260
|
+
return 'It is part of the same node';
|
|
1261
|
+
case CanvasEntityConnectionDisabledReason.CalledByErrorMustBePassThroughCallable:
|
|
1262
|
+
return 'Called by error must be pass-through callable';
|
|
1263
|
+
case CanvasEntityConnectionDisabledReason.CannotChangeScopeBecauseItCallsOtherEntities:
|
|
1264
|
+
return 'Cannot change scope because it calls other entities in its current scope';
|
|
1265
|
+
case CanvasEntityConnectionDisabledReason.CannotChangeScopeBecauseItIsAlreadyCalledByOtherEntitiesInDifferentScope:
|
|
1266
|
+
return 'Cannot change scope because it is already called by other entities in a different scope';
|
|
1267
|
+
case CanvasEntityConnectionDisabledReason.VariableDeclarationCannotBeMovedToLowerScopeBecauseInstancesUsage:
|
|
1268
|
+
return 'Variable declaration cannot be moved to lower scope because its instances are used in the current or different incompatible lower scope';
|
|
1269
|
+
case CanvasEntityConnectionDisabledReason.CalledBySourceMustBeCallerEntity:
|
|
1270
|
+
return 'Not a caller type';
|
|
1271
|
+
case CanvasEntityConnectionDisabledReason.CalledByErrorCannotBeConnectedToEntitiesCalledByOwnSuccessBranch:
|
|
1272
|
+
return 'Already connected to the success branch from a common origin caller';
|
|
1273
|
+
case CanvasEntityConnectionDisabledReason.CalledBySuccessCannotBeConnectedToEntitiesCalledByOwnErrorBranch:
|
|
1274
|
+
return 'Already connected to the error branch from a common origin caller';
|
|
1275
|
+
case CanvasEntityConnectionDisabledReason.RedundantCall:
|
|
1276
|
+
return 'Redundant call. Already connected further down the execution path';
|
|
1277
|
+
case CanvasEntityConnectionDisabledReason.CannotBeCalledBeforeDeclaration:
|
|
1278
|
+
return 'Cannot be called before declaration';
|
|
1279
|
+
case CanvasEntityConnectionDisabledReason.CannotBeCalledInParallelBranchToDeclaration:
|
|
1280
|
+
return 'Cannot be called in parallel branch to declaration';
|
|
1281
|
+
case CanvasEntityConnectionDisabledReason.CannotBeHigherScopeThanDeclaration:
|
|
1282
|
+
return 'Cannot be in a higher scope than declaration';
|
|
1283
|
+
case CanvasEntityConnectionDisabledReason.CannotCallGlobalVariableDeclaration:
|
|
1284
|
+
return 'Cannot call global variable declaration';
|
|
1285
|
+
case CanvasEntityConnectionDisabledReason.EntityAlreadyCalledBySuccessCannotBeConnectedToUnrelatedErrorBranch: {
|
|
1286
|
+
if (errorCallerOnly) {
|
|
1287
|
+
return 'Cannot connect error: Already connected to a success branch from a common origin caller';
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
return 'Already connected to a success branch from a common origin caller';
|
|
1291
|
+
}
|
|
1292
|
+
default:
|
|
1293
|
+
return toSentenceCase(code || '');
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
export function safeResolveEntityName(
|
|
1298
|
+
entity: EntityState,
|
|
1299
|
+
project: ProjectState,
|
|
1300
|
+
): string {
|
|
1301
|
+
try {
|
|
1302
|
+
return resolveEntityName(entity, project);
|
|
1303
|
+
} catch (e) {
|
|
1304
|
+
return 'Unknown';
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* Calculates how far down the top of the parent definition entity a method starts
|
|
1310
|
+
* Methods are function-declaration entities nested inside definition-entities
|
|
1311
|
+
* But their distance to the top changes based on their index among all other rendered methods as well as all properties the parent has.
|
|
1312
|
+
*/
|
|
1313
|
+
export function calculateVerticalOffsetForMethod(
|
|
1314
|
+
method: FunctionDeclarationState,
|
|
1315
|
+
): { offset: number } {
|
|
1316
|
+
let offset = 0;
|
|
1317
|
+
|
|
1318
|
+
if (method.parent.type !== EntityType.DefinitionEntity) {
|
|
1319
|
+
return { offset };
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
const parent = method.parent as DefinitionEntityState;
|
|
1323
|
+
|
|
1324
|
+
const selfIndexAmongSiblings = parent.methods.findIndex(
|
|
1325
|
+
(m) => m.id === method.id,
|
|
1326
|
+
);
|
|
1327
|
+
|
|
1328
|
+
const methodsBeforeSelf = parent.methods.slice(0, selfIndexAmongSiblings);
|
|
1329
|
+
|
|
1330
|
+
methodsBeforeSelf.forEach((method) => {
|
|
1331
|
+
const methodSize = calculateMethodCardSize(method);
|
|
1332
|
+
offset += methodSize.height;
|
|
1333
|
+
});
|
|
1334
|
+
|
|
1335
|
+
if (parent.properties.length || parent.suggestedProperties.length) {
|
|
1336
|
+
offset += CARD_PROPERTIES_SECTION_PADDING;
|
|
1337
|
+
|
|
1338
|
+
parent.suggestedProperties.forEach(() => {
|
|
1339
|
+
offset += PROPERTY_HEIGHT;
|
|
1340
|
+
});
|
|
1341
|
+
|
|
1342
|
+
parent.properties.forEach(() => {
|
|
1343
|
+
offset += PROPERTY_HEIGHT;
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
return { offset };
|
|
1348
|
+
}
|