windmill-components 1.37.0 → 1.46.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/common.d.ts +1 -0
- package/components/AppConnect.svelte +45 -49
- package/components/ArgInfo.svelte +37 -15
- package/components/ArgInput.svelte +33 -34
- package/components/ArgInput.svelte.d.ts +3 -1
- package/components/ButtonAndDropdown.svelte +1 -1
- package/components/CenteredPage.svelte +2 -2
- package/components/CronInput.svelte +24 -20
- package/components/CronInput.svelte.d.ts +1 -0
- package/components/DisplayResult.svelte +2 -2
- package/components/Dropdown.svelte +10 -13
- package/components/Dropdown.svelte.d.ts +4 -1
- package/components/Editor.svelte +27 -3
- package/components/Editor.svelte.d.ts +3 -1
- package/components/EditorBar.svelte +77 -30
- package/components/EditorBar.svelte.d.ts +3 -1
- package/components/FieldHeader.svelte +6 -5
- package/components/FlowBuilder.svelte +52 -55
- package/components/FlowBuilder.svelte.d.ts +2 -0
- package/components/FlowJobResult.svelte +11 -18
- package/components/FlowJobResult.svelte.d.ts +2 -2
- package/components/FlowMetadata.svelte +65 -0
- package/components/FlowMetadata.svelte.d.ts +17 -0
- package/components/FlowModulesViewer.svelte +18 -4
- package/components/FlowPreviewContent.svelte +88 -50
- package/components/FlowPreviewContent.svelte.d.ts +1 -0
- package/components/FlowStatusViewer.svelte +123 -61
- package/components/FlowStatusViewer.svelte.d.ts +8 -3
- package/components/FlowViewer.svelte +84 -9
- package/components/FlowViewer.svelte.d.ts +1 -0
- package/components/GroupModal.svelte +43 -44
- package/components/GroupModal.svelte.d.ts +2 -2
- package/components/HighlightCode.svelte +4 -1
- package/components/HighlightCode.svelte.d.ts +1 -1
- package/components/IconedResourceType.svelte +6 -4
- package/components/IconedResourceType.svelte.d.ts +1 -0
- package/components/InputTransformForm.svelte +38 -27
- package/components/InputTransformsViewer.svelte +2 -1
- package/components/InviteGlobalUser.svelte +6 -10
- package/components/InviteGlobalUser.svelte.d.ts +1 -4
- package/components/InviteUser.svelte +4 -8
- package/components/InviteUser.svelte.d.ts +1 -4
- package/components/ItemPicker.svelte +50 -43
- package/components/ItemPicker.svelte.d.ts +2 -2
- package/components/JobArgs.svelte +33 -0
- package/components/JobArgs.svelte.d.ts +16 -0
- package/components/JobStatus.svelte +21 -17
- package/components/LogViewer.svelte +11 -6
- package/components/Modal.svelte +5 -5
- package/components/Modal.svelte.d.ts +4 -4
- package/components/ModulePreview.svelte +47 -63
- package/components/ModulePreview.svelte.d.ts +0 -1
- package/components/PageHeader.svelte +6 -6
- package/components/Password.svelte +1 -1
- package/components/Path.svelte +28 -7
- package/components/Path.svelte.d.ts +3 -3
- package/components/Popover.svelte +61 -0
- package/components/Popover.svelte.d.ts +17 -0
- package/components/Required.svelte +4 -4
- package/components/Required.svelte.d.ts +1 -0
- package/components/ResourceEditor.svelte +105 -116
- package/components/ResourceEditor.svelte.d.ts +0 -1
- package/components/ResourcePicker.svelte +9 -6
- package/components/ResourceTypePicker.svelte +3 -1
- package/components/RunChart.svelte +102 -0
- package/components/RunChart.svelte.d.ts +20 -0
- package/components/RunForm.svelte +58 -40
- package/components/RunForm.svelte.d.ts +13 -0
- package/components/SchemaEditor.svelte +5 -5
- package/components/SchemaEditorProperty.svelte +1 -1
- package/components/SchemaForm.svelte +3 -1
- package/components/SchemaForm.svelte.d.ts +1 -0
- package/components/SchemaModal.svelte +113 -105
- package/components/SchemaModal.svelte.d.ts +4 -4
- package/components/SchemaViewer.svelte +7 -4
- package/components/ScriptBuilder.svelte +143 -163
- package/components/ScriptBuilder.svelte.d.ts +1 -0
- package/components/ScriptEditor.svelte +117 -114
- package/components/ScriptEditor.svelte.d.ts +1 -0
- package/components/ScriptPicker.svelte +16 -24
- package/components/ScriptSchema.svelte +33 -32
- package/components/ShareModal.svelte +74 -68
- package/components/ShareModal.svelte.d.ts +2 -2
- package/components/SimpleEditor.svelte +4 -2
- package/components/SuperadminSettings.svelte +134 -0
- package/components/SuperadminSettings.svelte.d.ts +19 -0
- package/components/TableCustom.svelte +1 -1
- package/components/TableSimple.svelte +1 -1
- package/components/TestJobLoader.svelte +14 -6
- package/components/TestJobLoader.svelte.d.ts +4 -2
- package/components/Toggle.svelte +5 -3
- package/components/Toggle.svelte.d.ts +2 -0
- package/components/Tooltip.svelte +9 -64
- package/components/UserSettings.svelte +241 -0
- package/components/UserSettings.svelte.d.ts +19 -0
- package/components/VariableEditor.svelte +80 -74
- package/components/common/actionRow/ActionRow.svelte +5 -4
- package/components/common/alert/Alert.svelte +1 -1
- package/components/common/alert/Alert.svelte.d.ts +1 -0
- package/components/common/badge/Badge.svelte +2 -2
- package/components/common/breadcrumb/Breadcrumb.svelte +24 -0
- package/components/common/breadcrumb/Breadcrumb.svelte.d.ts +22 -0
- package/components/common/button/Button.svelte +20 -8
- package/components/common/button/Button.svelte.d.ts +1 -0
- package/components/common/button/model.d.ts +1 -1
- package/components/common/confirmationModal/ConfirmationModal.svelte +1 -0
- package/components/common/drawer/Drawer.svelte +38 -7
- package/components/common/drawer/Drawer.svelte.d.ts +6 -0
- package/components/common/drawer/DrawerContent.svelte +21 -7
- package/components/common/drawer/DrawerContent.svelte.d.ts +4 -0
- package/components/common/index.d.ts +1 -0
- package/components/common/index.js +1 -0
- package/components/common/kbd/Kbd.svelte +1 -1
- package/components/common/languageIcons/Bash.svelte +18 -0
- package/components/common/languageIcons/Bash.svelte.d.ts +27 -0
- package/components/common/languageIcons/Go.svelte +34 -0
- package/components/common/languageIcons/Go.svelte.d.ts +27 -0
- package/components/common/languageIcons/LanguageIcon.svelte +19 -0
- package/components/common/languageIcons/LanguageIcon.svelte.d.ts +21 -0
- package/components/common/languageIcons/Python.svelte +51 -0
- package/components/common/languageIcons/Python.svelte.d.ts +27 -0
- package/components/common/languageIcons/TypeScript.svelte +31 -0
- package/components/common/languageIcons/TypeScript.svelte.d.ts +27 -0
- package/components/common/languageIcons/index.d.ts +5 -0
- package/components/common/languageIcons/index.js +5 -0
- package/components/common/menu/Menu.svelte +15 -19
- package/components/common/skeleton/Skeleton.svelte +1 -2
- package/components/common/skeleton/Skeleton.svelte.d.ts +0 -1
- package/components/common/skeleton/SkeletonElement.svelte +1 -1
- package/components/common/tabs/TabContent.svelte +2 -1
- package/components/common/tabs/TabContent.svelte.d.ts +1 -0
- package/components/common/tabs/Tabs.svelte +8 -6
- package/components/common/tabs/Tabs.svelte.d.ts +1 -0
- package/components/flows/FlowEditor.svelte +11 -20
- package/components/flows/FlowProgressBar.svelte +55 -0
- package/components/flows/FlowProgressBar.svelte.d.ts +21 -0
- package/components/flows/common/FlowCardHeader.svelte +5 -6
- package/components/flows/content/CapturePayload.svelte +112 -0
- package/components/flows/content/CapturePayload.svelte.d.ts +17 -0
- package/components/flows/content/DynamicInputHelpBox.svelte +6 -10
- package/components/flows/content/FlowBranchAllWrapper.svelte +21 -0
- package/components/flows/content/FlowBranchAllWrapper.svelte.d.ts +21 -0
- package/components/flows/content/FlowBranchOneWrapper.svelte +49 -0
- package/components/flows/content/FlowBranchOneWrapper.svelte.d.ts +23 -0
- package/components/flows/content/FlowBranchesWrapper.svelte +140 -0
- package/components/flows/content/FlowBranchesWrapper.svelte.d.ts +19 -0
- package/components/flows/content/FlowEditorPanel.svelte +8 -6
- package/components/flows/content/FlowFailureModule.svelte +4 -6
- package/components/flows/content/FlowInput.svelte +31 -5
- package/components/flows/content/FlowInputs.svelte +119 -50
- package/components/flows/content/FlowInputs.svelte.d.ts +5 -4
- package/components/flows/content/FlowLoop.svelte +85 -142
- package/components/flows/content/FlowLoop.svelte.d.ts +2 -1
- package/components/flows/content/FlowModuleComponent.svelte +231 -0
- package/components/flows/content/FlowModuleComponent.svelte.d.ts +20 -0
- package/components/flows/content/FlowModuleEarlyStop.svelte +45 -48
- package/components/flows/content/FlowModuleEarlyStop.svelte.d.ts +1 -0
- package/components/flows/content/FlowModuleHeader.svelte +11 -40
- package/components/flows/content/FlowModuleHeader.svelte.d.ts +0 -1
- package/components/flows/content/FlowModuleScript.svelte +7 -12
- package/components/flows/content/FlowModuleScript.svelte.d.ts +1 -2
- package/components/flows/content/FlowModuleSuspend.svelte +31 -15
- package/components/flows/content/FlowModuleSuspend.svelte.d.ts +1 -0
- package/components/flows/content/FlowModuleWrapper.svelte +138 -38
- package/components/flows/content/FlowModuleWrapper.svelte.d.ts +6 -1
- package/components/flows/content/FlowRetries.svelte +13 -2
- package/components/flows/content/FlowRetries.svelte.d.ts +1 -0
- package/components/flows/content/FlowSchedules.svelte +0 -2
- package/components/flows/content/FlowSettings.svelte +103 -72
- package/components/flows/flowState.d.ts +8 -8
- package/components/flows/flowState.js +32 -17
- package/components/flows/flowStateUtils.d.ts +21 -38
- package/components/flows/flowStateUtils.js +86 -158
- package/components/flows/flowStore.d.ts +3 -2
- package/components/flows/flowStore.js +60 -7
- package/components/flows/header/FlowImportExportMenu.svelte +12 -22
- package/components/flows/header/FlowPreviewButtons.svelte +11 -11
- package/components/flows/map/FlowBranchAllMap.svelte +90 -0
- package/components/flows/map/FlowBranchAllMap.svelte.d.ts +17 -0
- package/components/flows/map/FlowBranchOneMap.svelte +116 -0
- package/components/flows/map/FlowBranchOneMap.svelte.d.ts +17 -0
- package/components/flows/map/FlowErrorHandlerItem.svelte +14 -11
- package/components/flows/map/FlowInputsItem.svelte +19 -0
- package/components/flows/map/FlowInputsItem.svelte.d.ts +14 -0
- package/components/flows/map/FlowModuleSchemaItem.svelte +53 -36
- package/components/flows/map/FlowModuleSchemaItem.svelte.d.ts +5 -5
- package/components/flows/map/FlowModuleSchemaMap.svelte +73 -144
- package/components/flows/map/FlowModuleSchemaMap.svelte.d.ts +2 -3
- package/components/flows/map/FlowSettingsItem.svelte +29 -0
- package/components/flows/map/FlowSettingsItem.svelte.d.ts +14 -0
- package/components/flows/map/InsertModuleButton.svelte +11 -0
- package/components/flows/map/InsertModuleButton.svelte.d.ts +16 -0
- package/components/flows/map/MapItem.svelte +105 -0
- package/components/flows/map/MapItem.svelte.d.ts +22 -0
- package/components/flows/pickers/FlowScriptPicker.svelte +14 -4
- package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +1 -1
- package/components/flows/pickers/PickHubScript.svelte +5 -4
- package/components/flows/pickers/PickHubScript.svelte.d.ts +1 -0
- package/components/flows/pickers/PickScript.svelte +6 -5
- package/components/flows/pickers/PickScript.svelte.d.ts +1 -0
- package/components/flows/previousResults.d.ts +14 -0
- package/components/flows/previousResults.js +118 -0
- package/components/flows/propPicker/PropPickerWrapper.svelte +22 -15
- package/components/flows/propPicker/PropPickerWrapper.svelte.d.ts +6 -2
- package/components/flows/utils.d.ts +8 -5
- package/components/flows/utils.js +86 -56
- package/components/graph/FlowGraph.svelte +259 -0
- package/components/graph/FlowGraph.svelte.d.ts +20 -0
- package/components/graph/index.d.ts +3 -0
- package/components/graph/index.js +3 -0
- package/components/graph/model.d.ts +20 -0
- package/components/graph/model.js +9 -0
- package/components/graph/util.d.ts +9 -0
- package/components/graph/util.js +14 -0
- package/components/icons/WindmillIcon.svelte +85 -52
- package/components/icons/WindmillIcon.svelte.d.ts +2 -0
- package/components/jobs/JobDetail.svelte +40 -30
- package/components/landing/FlowGettingStarted.svelte +4 -3
- package/components/landing/FlowLandingBox.svelte +23 -53
- package/components/landing/RessourceGettingStarted.svelte +1 -1
- package/components/landing/ScriptBox.svelte +25 -27
- package/components/landing/ScriptGettingStarted.svelte +4 -3
- package/components/preview/FlowPreviewStatus.svelte +1 -1
- package/components/progressBar/ProgressBar.svelte +89 -0
- package/components/{ProgressBar.svelte.d.ts → progressBar/ProgressBar.svelte.d.ts} +5 -2
- package/components/progressBar/ProgressBarGeneralPart.svelte +22 -0
- package/components/progressBar/ProgressBarGeneralPart.svelte.d.ts +19 -0
- package/components/progressBar/ProgressBarLoopAccessor.svelte +14 -0
- package/components/progressBar/ProgressBarLoopAccessor.svelte.d.ts +19 -0
- package/components/progressBar/ProgressBarLoopPart.svelte +34 -0
- package/components/progressBar/ProgressBarLoopPart.svelte.d.ts +19 -0
- package/components/progressBar/index.d.ts +2 -0
- package/components/progressBar/index.js +2 -0
- package/components/progressBar/model.d.ts +32 -0
- package/components/progressBar/model.js +14 -0
- package/components/propertyPicker/ObjectViewer.svelte +18 -13
- package/components/propertyPicker/ObjectViewer.svelte.d.ts +1 -0
- package/components/propertyPicker/PropPicker.svelte +90 -44
- package/components/propertyPicker/PropPicker.svelte.d.ts +4 -1
- package/components/propertyPicker/PropPickerResult.svelte +12 -0
- package/components/propertyPicker/PropPickerResult.svelte.d.ts +18 -0
- package/components/propertyPicker/utils.d.ts +1 -1
- package/components/propertyPicker/utils.js +4 -1
- package/components/{script_editor → scriptEditor}/LogPanel.svelte +30 -20
- package/components/{script_editor → scriptEditor}/LogPanel.svelte.d.ts +0 -0
- package/components/scripts/CreateActions.svelte +2 -2
- package/components/sidebar/SidebarContent.svelte +1 -1
- package/components/sidebar/UserMenu.svelte +17 -1
- package/components/sidebar/UserMenu.svelte.d.ts +3 -0
- package/components/sidebar/WorkspaceMenu.svelte +16 -14
- package/components/splitPanes/SplitPanesWrapper.svelte +34 -0
- package/components/splitPanes/SplitPanesWrapper.svelte.d.ts +20 -0
- package/editorUtils.js +2 -0
- package/gen/core/OpenAPI.js +1 -1
- package/gen/index.d.ts +8 -1
- package/gen/index.js +5 -0
- package/gen/models/AppWithLastVersion.d.ts +21 -0
- package/gen/models/AppWithLastVersion.js +12 -0
- package/gen/models/BranchAll.d.ts +10 -0
- package/gen/models/{Branches.js → BranchAll.js} +0 -0
- package/gen/models/{Branches.d.ts → BranchOne.d.ts} +3 -5
- package/gen/models/BranchOne.js +4 -0
- package/gen/models/CompletedJob.d.ts +4 -2
- package/gen/models/CompletedJob.js +2 -0
- package/gen/models/FlowModule.d.ts +2 -1
- package/gen/models/FlowModuleValue.d.ts +4 -2
- package/gen/models/FlowStatusModule.d.ts +11 -2
- package/gen/models/ForloopFlow.d.ts +1 -0
- package/gen/models/Identity.d.ts +3 -0
- package/gen/models/Identity.js +4 -0
- package/gen/models/ListableApp.d.ts +16 -0
- package/gen/models/ListableApp.js +12 -0
- package/gen/models/ListableVariable.d.ts +1 -1
- package/gen/models/PathScript.d.ts +2 -0
- package/gen/models/Policy.d.ts +12 -0
- package/gen/models/Policy.js +12 -0
- package/gen/models/Preview.d.ts +2 -1
- package/gen/models/Preview.js +1 -0
- package/gen/models/QueuedJob.d.ts +4 -2
- package/gen/models/QueuedJob.js +2 -0
- package/gen/models/RawScript.d.ts +4 -1
- package/gen/models/RawScript.js +1 -0
- package/gen/models/Script.d.ts +4 -2
- package/gen/models/Script.js +2 -0
- package/gen/services/AppService.d.ts +31 -0
- package/gen/services/AppService.js +49 -0
- package/gen/services/CaptureService.d.ts +30 -0
- package/gen/services/CaptureService.js +52 -0
- package/gen/services/FlowService.d.ts +90 -0
- package/gen/services/FlowService.js +72 -0
- package/gen/services/JobService.d.ts +57 -8
- package/gen/services/JobService.js +78 -10
- package/gen/services/OauthService.d.ts +6 -15
- package/gen/services/OauthService.js +6 -19
- package/gen/services/ResourceService.d.ts +10 -1
- package/gen/services/ResourceService.js +16 -1
- package/gen/services/ScriptService.d.ts +28 -3
- package/gen/services/ScriptService.js +27 -0
- package/gen/services/UserService.d.ts +14 -6
- package/gen/services/UserService.js +25 -11
- package/infer.d.ts +1 -1
- package/infer.js +35 -18
- package/logout.d.ts +1 -1
- package/logout.js +7 -9
- package/package.json +74 -68
- package/script_helpers.d.ts +5 -3
- package/script_helpers.js +42 -12
- package/scripts.js +9 -4
- package/utils.d.ts +8 -9
- package/utils.js +42 -81
- package/components/AutosizedTextarea.svelte +0 -34
- package/components/AutosizedTextarea.svelte.d.ts +0 -19
- package/components/ProgressBar.svelte +0 -31
- package/components/ProgressBarPart.svelte +0 -20
- package/components/ProgressBarPart.svelte.d.ts +0 -20
- package/components/Switch.svelte +0 -61
- package/components/Switch.svelte.d.ts +0 -31
- package/components/flows/content/CopyFirstStepSchema.svelte +0 -13
- package/components/flows/content/CopyFirstStepSchema.svelte.d.ts +0 -14
- package/components/flows/content/FlowLoopWrapper.svelte +0 -9
- package/components/flows/content/FlowLoopWrapper.svelte.d.ts +0 -14
- package/components/flows/content/FlowModule.svelte +0 -217
- package/components/flows/content/FlowModule.svelte.d.ts +0 -29
- package/gen/schemas/$AuditLog.d.ts +0 -32
- package/gen/schemas/$AuditLog.js +0 -35
- package/gen/schemas/$CompletedJob.d.ts +0 -98
- package/gen/schemas/$CompletedJob.js +0 -103
- package/gen/schemas/$ContextualVariable.d.ts +0 -16
- package/gen/schemas/$ContextualVariable.js +0 -19
- package/gen/schemas/$CreateResource.d.ts +0 -22
- package/gen/schemas/$CreateResource.js +0 -25
- package/gen/schemas/$CreateVariable.d.ts +0 -26
- package/gen/schemas/$CreateVariable.js +0 -29
- package/gen/schemas/$CreateWorkspace.d.ts +0 -20
- package/gen/schemas/$CreateWorkspace.js +0 -23
- package/gen/schemas/$EditResource.d.ts +0 -13
- package/gen/schemas/$EditResource.js +0 -16
- package/gen/schemas/$EditResourceType.d.ts +0 -10
- package/gen/schemas/$EditResourceType.js +0 -13
- package/gen/schemas/$EditSchedule.d.ts +0 -20
- package/gen/schemas/$EditSchedule.js +0 -23
- package/gen/schemas/$EditVariable.d.ts +0 -16
- package/gen/schemas/$EditVariable.js +0 -19
- package/gen/schemas/$EditWorkspaceUser.d.ts +0 -7
- package/gen/schemas/$EditWorkspaceUser.js +0 -10
- package/gen/schemas/$Flow.d.ts +0 -23
- package/gen/schemas/$Flow.js +0 -26
- package/gen/schemas/$FlowMetadata.d.ts +0 -31
- package/gen/schemas/$FlowMetadata.js +0 -34
- package/gen/schemas/$FlowPreview.d.ts +0 -80
- package/gen/schemas/$FlowPreview.js +0 -83
- package/gen/schemas/$GlobalUserInfo.d.ts +0 -26
- package/gen/schemas/$GlobalUserInfo.js +0 -29
- package/gen/schemas/$Group.d.ts +0 -23
- package/gen/schemas/$Group.js +0 -26
- package/gen/schemas/$Job.d.ts +0 -17
- package/gen/schemas/$Job.js +0 -20
- package/gen/schemas/$ListableVariable.d.ts +0 -35
- package/gen/schemas/$ListableVariable.js +0 -38
- package/gen/schemas/$Login.d.ts +0 -12
- package/gen/schemas/$Login.js +0 -15
- package/gen/schemas/$MainArgSignature.d.ts +0 -50
- package/gen/schemas/$MainArgSignature.js +0 -53
- package/gen/schemas/$NewSchedule.d.ts +0 -30
- package/gen/schemas/$NewSchedule.js +0 -33
- package/gen/schemas/$NewToken.d.ts +0 -11
- package/gen/schemas/$NewToken.js +0 -14
- package/gen/schemas/$NewUser.d.ts +0 -16
- package/gen/schemas/$NewUser.js +0 -19
- package/gen/schemas/$Preview.d.ts +0 -19
- package/gen/schemas/$Preview.js +0 -22
- package/gen/schemas/$QueuedJob.d.ts +0 -139
- package/gen/schemas/$QueuedJob.js +0 -144
- package/gen/schemas/$Resource.d.ts +0 -31
- package/gen/schemas/$Resource.js +0 -34
- package/gen/schemas/$ResourceType.d.ts +0 -17
- package/gen/schemas/$ResourceType.js +0 -20
- package/gen/schemas/$Schedule.d.ts +0 -47
- package/gen/schemas/$Schedule.js +0 -50
- package/gen/schemas/$Script.d.ts +0 -77
- package/gen/schemas/$Script.js +0 -80
- package/gen/schemas/$ScriptArgs.d.ts +0 -6
- package/gen/schemas/$ScriptArgs.js +0 -9
- package/gen/schemas/$SlackToken.d.ts +0 -24
- package/gen/schemas/$SlackToken.js +0 -27
- package/gen/schemas/$TokenResponse.d.ts +0 -23
- package/gen/schemas/$TokenResponse.js +0 -26
- package/gen/schemas/$TruncatedToken.d.ts +0 -25
- package/gen/schemas/$TruncatedToken.js +0 -28
- package/gen/schemas/$Usage.d.ts +0 -13
- package/gen/schemas/$Usage.js +0 -16
- package/gen/schemas/$User.d.ts +0 -42
- package/gen/schemas/$User.js +0 -45
- package/gen/schemas/$UserWorkspaceList.d.ts +0 -28
- package/gen/schemas/$UserWorkspaceList.js +0 -31
- package/gen/schemas/$WorkerPing.d.ts +0 -31
- package/gen/schemas/$WorkerPing.js +0 -34
- package/gen/schemas/$Workspace.d.ts +0 -19
- package/gen/schemas/$Workspace.js +0 -22
- package/gen/schemas/$WorkspaceInvite.d.ts +0 -16
- package/gen/schemas/$WorkspaceInvite.js +0 -19
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { schemaToObject } from '../../utils';
|
|
2
|
+
function dfs(id, flow, getParents = true) {
|
|
3
|
+
if (id === undefined) {
|
|
4
|
+
return [];
|
|
5
|
+
}
|
|
6
|
+
function getSubModules(flowModule) {
|
|
7
|
+
if (flowModule.value.type === 'forloopflow') {
|
|
8
|
+
return [flowModule.value.modules];
|
|
9
|
+
}
|
|
10
|
+
else if (flowModule.value.type === 'branchall') {
|
|
11
|
+
return flowModule.value.branches.map((branch) => branch.modules);
|
|
12
|
+
}
|
|
13
|
+
else if (flowModule.value.type == 'branchone') {
|
|
14
|
+
return [
|
|
15
|
+
...flowModule.value.branches.map((branch) => branch.modules),
|
|
16
|
+
flowModule.value.default
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
function rec(id, moduleBranches) {
|
|
22
|
+
for (let modules of moduleBranches) {
|
|
23
|
+
for (const [i, module] of modules.entries()) {
|
|
24
|
+
if (module.id === id) {
|
|
25
|
+
return getParents ? [module] : modules.slice(0, i + 1).reverse();
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const submodules = getSubModules(module);
|
|
29
|
+
if (submodules) {
|
|
30
|
+
let found = rec(id, submodules);
|
|
31
|
+
if (found) {
|
|
32
|
+
return getParents ? [...found, module] : [...found, ...modules.slice(0, i).reverse()];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return rec(id, [flow.value.modules]) ?? [];
|
|
41
|
+
}
|
|
42
|
+
function getFlowInput(parentModules, flowState, args, schema) {
|
|
43
|
+
const parentModule = parentModules.shift();
|
|
44
|
+
const parentState = parentModule ? flowState[parentModule.id] : undefined;
|
|
45
|
+
if (parentState && parentModule) {
|
|
46
|
+
if (parentState.previewArgs) {
|
|
47
|
+
return parentState.previewArgs;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const parentFlowInput = getFlowInput(parentModules, flowState, args, schema);
|
|
51
|
+
if (parentModule.value.type === 'forloopflow') {
|
|
52
|
+
return {
|
|
53
|
+
iter: {
|
|
54
|
+
value: "Iteration's value",
|
|
55
|
+
index: "Iteration's index"
|
|
56
|
+
},
|
|
57
|
+
...parentFlowInput,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return parentFlowInput;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return schemaToObject(schema, args);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export function getStepPropPicker(flowState, parentModule, previousModule, id, flow, args, include_node, approvers = false) {
|
|
70
|
+
const flowInput = getFlowInput(dfs(parentModule?.id, flow), flowState, args, flow.schema);
|
|
71
|
+
const previousIds = dfs(id, flow, false).map((x) => x.id);
|
|
72
|
+
if (!include_node) {
|
|
73
|
+
previousIds.shift();
|
|
74
|
+
}
|
|
75
|
+
let priorIds = Object.fromEntries(previousIds.map((id) => [id, flowState[id]?.previewResult ?? {}]).reverse());
|
|
76
|
+
const pickableProperties = {
|
|
77
|
+
flow_input: flowInput,
|
|
78
|
+
priorIds: priorIds,
|
|
79
|
+
previousId: previousIds[0]
|
|
80
|
+
};
|
|
81
|
+
if (approvers && ((previousModule?.suspend?.required_events ?? 0) > 0)) {
|
|
82
|
+
pickableProperties["approvers"] = "The list of approvers";
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
extraLib: buildExtraLib(flowInput, priorIds),
|
|
86
|
+
pickableProperties
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export function buildExtraLib(flowInput, results) {
|
|
90
|
+
return `
|
|
91
|
+
/**
|
|
92
|
+
* get variable (including secret) at path
|
|
93
|
+
* @param {string} path - path of the variable (e.g: g/all/pretty_secret)
|
|
94
|
+
*/
|
|
95
|
+
export function variable(path: string): string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* get resource at path
|
|
99
|
+
* @param {string} path - path of the resource (e.g: g/all/my_resource)
|
|
100
|
+
*/
|
|
101
|
+
export function resource(path: string): any;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* flow input as an object
|
|
105
|
+
*/
|
|
106
|
+
export const flow_input = ${JSON.stringify(flowInput)};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* static params of this same step
|
|
110
|
+
*/
|
|
111
|
+
export const params: any;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* result by id
|
|
115
|
+
*/
|
|
116
|
+
export const results = ${JSON.stringify(results)};
|
|
117
|
+
`;
|
|
118
|
+
}
|
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
</script>
|
|
3
3
|
|
|
4
4
|
<script>import PropPicker from '../../propertyPicker/PropPicker.svelte';
|
|
5
|
+
import PropPickerResult from '../../propertyPicker/PropPickerResult.svelte';
|
|
5
6
|
import { createEventDispatcher, setContext } from 'svelte';
|
|
6
|
-
import {
|
|
7
|
+
import { Pane, Splitpanes } from 'svelte-splitpanes';
|
|
7
8
|
import { writable } from 'svelte/store';
|
|
8
|
-
export let pickableProperties
|
|
9
|
+
export let pickableProperties;
|
|
10
|
+
export let result = undefined;
|
|
11
|
+
export let error = false;
|
|
9
12
|
export let displayContext = true;
|
|
13
|
+
export let notSelectable = false;
|
|
10
14
|
const propPickerConfig = writable(undefined);
|
|
11
15
|
const dispatch = createEventDispatcher();
|
|
12
16
|
setContext('PropPickerWrapper', {
|
|
@@ -24,23 +28,26 @@ setContext('PropPickerWrapper', {
|
|
|
24
28
|
});
|
|
25
29
|
</script>
|
|
26
30
|
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
<Splitpanes>
|
|
32
|
+
<Pane minSize={20} size={66} class="relative p-4 !transition-none">
|
|
33
|
+
<slot />
|
|
34
|
+
</Pane>
|
|
35
|
+
<Pane minSize={20} size={34} class="px-2 py-2 h-full !transition-none">
|
|
36
|
+
{#if result}
|
|
37
|
+
<PropPickerResult {result} />
|
|
38
|
+
{:else if pickableProperties}
|
|
35
39
|
<PropPicker
|
|
36
40
|
{displayContext}
|
|
41
|
+
{error}
|
|
37
42
|
{pickableProperties}
|
|
43
|
+
{notSelectable}
|
|
38
44
|
on:select={({ detail }) => {
|
|
39
45
|
dispatch('select', detail)
|
|
40
|
-
$propPickerConfig?.onSelect(detail)
|
|
41
|
-
|
|
46
|
+
if ($propPickerConfig?.onSelect(detail)) {
|
|
47
|
+
propPickerConfig.set(undefined)
|
|
48
|
+
}
|
|
42
49
|
}}
|
|
43
50
|
/>
|
|
44
|
-
|
|
45
|
-
</
|
|
46
|
-
</
|
|
51
|
+
{/if}
|
|
52
|
+
</Pane>
|
|
53
|
+
</Splitpanes>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
declare type InsertionMode = 'append' | 'connect' | 'insert';
|
|
3
|
-
declare type SelectCallback = (path: string) =>
|
|
3
|
+
declare type SelectCallback = (path: string) => boolean;
|
|
4
4
|
declare type PropPickerConfig = {
|
|
5
5
|
insertionMode: InsertionMode;
|
|
6
6
|
propName: string;
|
|
@@ -12,10 +12,14 @@ export declare type PropPickerWrapperContext = {
|
|
|
12
12
|
clearFocus: () => void;
|
|
13
13
|
};
|
|
14
14
|
import { type Writable } from 'svelte/store';
|
|
15
|
+
import type { PickableProperties } from '../previousResults';
|
|
15
16
|
declare const __propDef: {
|
|
16
17
|
props: {
|
|
17
|
-
pickableProperties
|
|
18
|
+
pickableProperties: PickableProperties | undefined;
|
|
19
|
+
result?: any;
|
|
20
|
+
error?: boolean | undefined;
|
|
18
21
|
displayContext?: boolean | undefined;
|
|
22
|
+
notSelectable?: boolean | undefined;
|
|
19
23
|
};
|
|
20
24
|
events: {
|
|
21
25
|
select: CustomEvent<any>;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { Schema } from '../../common';
|
|
2
2
|
import { type Flow, type FlowModule, type InputTransform, type Job } from '../../gen';
|
|
3
|
-
import type { FlowModuleState
|
|
3
|
+
import type { FlowModuleState } from './flowState';
|
|
4
4
|
export declare function cleanInputs(flow: Flow | any): Flow;
|
|
5
|
+
export declare function cleanExpr(expr: string): string;
|
|
5
6
|
export declare function getTypeAsString(arg: any): string;
|
|
6
|
-
export declare function selectedIdToIndexes(selectedId: string): number[];
|
|
7
|
-
export declare function selectedIdToModule(selectedId: string, flow: Flow): FlowModule;
|
|
8
|
-
export declare function selectedIdToModuleState(selectedId: string, flow: FlowState): FlowModuleState;
|
|
9
7
|
export declare function loadSchemaFromModule(module: FlowModule): Promise<{
|
|
10
8
|
input_transforms: Record<string, InputTransform>;
|
|
11
9
|
schema: Schema;
|
|
@@ -15,4 +13,9 @@ export declare function getDefaultExpr(importPath?: string | undefined, key?: st
|
|
|
15
13
|
export declare function jobsToResults(jobs: Job[]): any;
|
|
16
14
|
export declare function runFlowPreview(args: Record<string, any>, flow: Flow): Promise<string>;
|
|
17
15
|
export declare function codeToStaticTemplate(code?: string): string | undefined;
|
|
18
|
-
export declare
|
|
16
|
+
export declare const NEVER_TESTED_THIS_FAR = "never tested this far";
|
|
17
|
+
export declare function emptyFlowModuleState(): FlowModuleState;
|
|
18
|
+
export declare function numberToChars(n: number): any;
|
|
19
|
+
export declare function charsToNumber(n: string): number;
|
|
20
|
+
export declare function isEmptyFlowModule(flowModule: FlowModule): boolean;
|
|
21
|
+
export declare function findNextAvailablePath(path: string): Promise<string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JobService } from '../../gen';
|
|
1
|
+
import { JobService, ScriptService } from '../../gen';
|
|
2
2
|
import { inferArgs } from '../../infer';
|
|
3
3
|
import { loadSchema } from '../../scripts';
|
|
4
4
|
import { workspaceStore } from '../../stores';
|
|
@@ -7,25 +7,34 @@ import { get } from 'svelte/store';
|
|
|
7
7
|
export function cleanInputs(flow) {
|
|
8
8
|
const newFlow = JSON.parse(JSON.stringify(flow));
|
|
9
9
|
newFlow.value.modules.forEach((mod) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
inp.value = undefined;
|
|
15
|
-
inp.expr = inp.expr
|
|
16
|
-
.split('\n')
|
|
17
|
-
.filter((x) => x != '' &&
|
|
18
|
-
!x.startsWith(`import { previous_result, flow_input, step, variable, resource, params } from 'windmill@`))
|
|
19
|
-
.join('\n');
|
|
10
|
+
if (mod.value.type == 'rawscript' || mod.value.type == 'script') {
|
|
11
|
+
if (Object.keys(mod.input_transforms ?? {}).length > 0) {
|
|
12
|
+
mod.value.input_transforms = mod.input_transforms;
|
|
13
|
+
delete mod.input_transforms;
|
|
20
14
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
inp.
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
Object.values(mod.value.input_transforms ?? {}).forEach((inp) => {
|
|
16
|
+
// for now we use the value for dynamic expression when done in the static editor so we have to resort to this
|
|
17
|
+
if (inp.type == 'javascript') {
|
|
18
|
+
//@ts-ignore
|
|
19
|
+
inp.value = undefined;
|
|
20
|
+
inp.expr = cleanExpr(inp.expr);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
//@ts-ignore
|
|
24
|
+
inp.expr = undefined;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
return newFlow;
|
|
28
30
|
}
|
|
31
|
+
export function cleanExpr(expr) {
|
|
32
|
+
return expr
|
|
33
|
+
.split('\n')
|
|
34
|
+
.filter((x) => x != '' &&
|
|
35
|
+
!x.startsWith(`import `))
|
|
36
|
+
.join('\n');
|
|
37
|
+
}
|
|
29
38
|
export function getTypeAsString(arg) {
|
|
30
39
|
if (arg === null) {
|
|
31
40
|
return 'null';
|
|
@@ -35,35 +44,6 @@ export function getTypeAsString(arg) {
|
|
|
35
44
|
}
|
|
36
45
|
return typeof arg;
|
|
37
46
|
}
|
|
38
|
-
export function selectedIdToIndexes(selectedId) {
|
|
39
|
-
const splitted = selectedId.split('-');
|
|
40
|
-
if (splitted[0] == 'loop') {
|
|
41
|
-
return [Number(splitted[1])];
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
return splitted.map(Number);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
export function selectedIdToModule(selectedId, flow) {
|
|
48
|
-
const [p, c] = selectedIdToIndexes(selectedId);
|
|
49
|
-
const pm = flow.value.modules[p];
|
|
50
|
-
if (c && pm.value.type == 'forloopflow') {
|
|
51
|
-
return pm.value.modules[c];
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
return pm;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export function selectedIdToModuleState(selectedId, flow) {
|
|
58
|
-
const [p, c] = selectedIdToIndexes(selectedId);
|
|
59
|
-
const pm = flow.modules[p];
|
|
60
|
-
if (c && pm.childFlowModules) {
|
|
61
|
-
return pm.childFlowModules[c];
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
return pm;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
47
|
export async function loadSchemaFromModule(module) {
|
|
68
48
|
const mod = module.value;
|
|
69
49
|
if (mod.type == 'rawscript' || mod.type === 'script') {
|
|
@@ -82,10 +62,13 @@ export async function loadSchemaFromModule(module) {
|
|
|
82
62
|
};
|
|
83
63
|
}
|
|
84
64
|
const keys = Object.keys(schema?.properties ?? {});
|
|
85
|
-
|
|
86
|
-
|
|
65
|
+
if (Object.keys(module.input_transforms ?? {}).length > 0) {
|
|
66
|
+
mod.input_transforms = module.input_transforms;
|
|
67
|
+
}
|
|
68
|
+
let input_transforms = mod.input_transforms ?? module.input_transforms ?? {};
|
|
69
|
+
if (JSON.stringify(keys.sort()) !== JSON.stringify(Object.keys(input_transforms).sort())) {
|
|
87
70
|
input_transforms = keys.reduce((accu, key) => {
|
|
88
|
-
let nv =
|
|
71
|
+
let nv = input_transforms[key] ?? {
|
|
89
72
|
type: 'static',
|
|
90
73
|
value: undefined
|
|
91
74
|
};
|
|
@@ -111,8 +94,8 @@ export function isCodeInjection(expr) {
|
|
|
111
94
|
return dynamicTemplateRegex.test(expr);
|
|
112
95
|
}
|
|
113
96
|
export function getDefaultExpr(importPath = undefined, key = 'myfield', previousExpr) {
|
|
114
|
-
const expr = previousExpr ?? `
|
|
115
|
-
return `import {
|
|
97
|
+
const expr = previousExpr ?? `results.${key}`;
|
|
98
|
+
return `import { results, flow_input, variable, resource, params } from 'windmill${importPath ? `@${importPath}` : ''}'
|
|
116
99
|
|
|
117
100
|
${expr}`;
|
|
118
101
|
}
|
|
@@ -152,11 +135,58 @@ export function codeToStaticTemplate(code) {
|
|
|
152
135
|
}
|
|
153
136
|
return undefined;
|
|
154
137
|
}
|
|
155
|
-
export
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
138
|
+
export const NEVER_TESTED_THIS_FAR = 'never tested this far';
|
|
139
|
+
export function emptyFlowModuleState() {
|
|
140
|
+
return {
|
|
141
|
+
schema: emptySchema(),
|
|
142
|
+
previewResult: NEVER_TESTED_THIS_FAR
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
const aCharCode = 'a'.charCodeAt(0);
|
|
146
|
+
export function numberToChars(n) {
|
|
147
|
+
var b = [n], sp, out, i, div;
|
|
148
|
+
sp = 0;
|
|
149
|
+
while (sp < b.length) {
|
|
150
|
+
if (b[sp] > 25) {
|
|
151
|
+
div = Math.floor(b[sp] / 26);
|
|
152
|
+
b[sp + 1] = div - 1;
|
|
153
|
+
b[sp] %= 26;
|
|
154
|
+
}
|
|
155
|
+
sp += 1;
|
|
156
|
+
}
|
|
157
|
+
out = '';
|
|
158
|
+
for (i = 0; i < b.length; i += 1) {
|
|
159
|
+
out = String.fromCharCode(aCharCode + b[i]) + out;
|
|
160
|
+
}
|
|
161
|
+
return out;
|
|
162
|
+
}
|
|
163
|
+
export function charsToNumber(n) {
|
|
164
|
+
let b = Math.pow(26, n.length - 1);
|
|
165
|
+
let res = 0;
|
|
166
|
+
for (let c of n) {
|
|
167
|
+
res += (c.charCodeAt(0) - aCharCode + 1) * b;
|
|
168
|
+
b = b / 26;
|
|
169
|
+
}
|
|
170
|
+
return res - 1;
|
|
171
|
+
}
|
|
172
|
+
export function isEmptyFlowModule(flowModule) {
|
|
173
|
+
return flowModule.value.type === 'identity';
|
|
174
|
+
}
|
|
175
|
+
export async function findNextAvailablePath(path) {
|
|
176
|
+
try {
|
|
177
|
+
await ScriptService.getScriptByPath({
|
|
178
|
+
workspace: get(workspaceStore),
|
|
179
|
+
path
|
|
180
|
+
});
|
|
181
|
+
const [_, version] = path.split(/.*_([0-9]*)/);
|
|
182
|
+
if (version.length > 0) {
|
|
183
|
+
path = path.slice(0, -(version.length + 1));
|
|
184
|
+
}
|
|
185
|
+
path = `${path}_${Number(version) + 1}`;
|
|
186
|
+
return findNextAvailablePath(path);
|
|
187
|
+
}
|
|
188
|
+
catch (e) {
|
|
189
|
+
// Catching an error means the path is available
|
|
190
|
+
return path;
|
|
159
191
|
}
|
|
160
|
-
indexes.push(childIndex);
|
|
161
|
-
return indexes;
|
|
162
192
|
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
<script>import Svelvet, {} from 'svelvet';
|
|
2
|
+
import { sugiyama, dagStratify, decrossOpt, coordGreedy, coordCenter } from 'd3-dag';
|
|
3
|
+
import { NODE, createIdGenerator, isNode, isLoop, isBranch } from '.';
|
|
4
|
+
import { truncate, truncateRev } from '../../utils';
|
|
5
|
+
import { createEventDispatcher } from 'svelte';
|
|
6
|
+
import { numberToChars } from '../flows/utils';
|
|
7
|
+
export let modules = [];
|
|
8
|
+
export let failureModule = undefined;
|
|
9
|
+
const idGenerator = createIdGenerator();
|
|
10
|
+
let nestedNodes;
|
|
11
|
+
let nodes = [];
|
|
12
|
+
let edges = [];
|
|
13
|
+
let width, height;
|
|
14
|
+
let dispatch = createEventDispatcher();
|
|
15
|
+
$: if (modules?.length) {
|
|
16
|
+
createGraph(modules, failureModule);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
nodes = edges = [];
|
|
20
|
+
}
|
|
21
|
+
function createGraph(modules, failureModule) {
|
|
22
|
+
nestedNodes = nodes = [];
|
|
23
|
+
nestedNodes.push(createVirtualNode(getParentIds(), 'Flow start'));
|
|
24
|
+
modules.forEach((m) => {
|
|
25
|
+
const item = getConvertedFlowModule(m);
|
|
26
|
+
item && nestedNodes.push(item);
|
|
27
|
+
});
|
|
28
|
+
const endParentIds = getParentIds();
|
|
29
|
+
nestedNodes.push(createVirtualNode(getParentIds(), 'Flow end'));
|
|
30
|
+
if (failureModule) {
|
|
31
|
+
nestedNodes.push(createErrorHandler(endParentIds, failureModule));
|
|
32
|
+
}
|
|
33
|
+
const flatNodes = flattenNestedNodes(nestedNodes);
|
|
34
|
+
const layered = layoutNodes(flatNodes);
|
|
35
|
+
nodes = layered.nodes;
|
|
36
|
+
width = layered.width;
|
|
37
|
+
height = layered.height;
|
|
38
|
+
edges = createEdges(nodes);
|
|
39
|
+
}
|
|
40
|
+
function getConvertedFlowModule(module, parent = undefined, edgeLabel = undefined) {
|
|
41
|
+
const type = module.value.type;
|
|
42
|
+
const parentIds = getParentIds(parent);
|
|
43
|
+
if (type === 'rawscript') {
|
|
44
|
+
const lang = module.value.language;
|
|
45
|
+
return flowModuleToNode(parentIds, module.id, module.summary || 'Inline script', 'inline', module, lang, edgeLabel);
|
|
46
|
+
}
|
|
47
|
+
else if (type === 'script') {
|
|
48
|
+
return flowModuleToNode(parentIds, module.id, module.summary || module.value.path || 'Hub script', module.value.path.startsWith('hub/') ? 'hub' : 'workspace', module, undefined, edgeLabel);
|
|
49
|
+
}
|
|
50
|
+
else if (type === 'forloopflow') {
|
|
51
|
+
const expr = module.value.iterator['expr'];
|
|
52
|
+
return flowModuleToLoop(module.value.modules, `For loop: ${truncate(expr, 10)}`, parent);
|
|
53
|
+
}
|
|
54
|
+
else if (type === 'branchone') {
|
|
55
|
+
const branches = [module.value.default, ...module.value.branches.map((b) => b.modules)];
|
|
56
|
+
return flowModuleToBranch(branches, ['Default', ...module.value.branches.map((x) => `If ${truncateRev(x.expr, 20)}`)], parent);
|
|
57
|
+
}
|
|
58
|
+
else if (type === 'branchall') {
|
|
59
|
+
const branches = module.value.branches.map((b) => b.modules);
|
|
60
|
+
return flowModuleToBranch(branches, [], parent);
|
|
61
|
+
}
|
|
62
|
+
return flowModuleToNode(parentIds, module.id, module.summary || 'Identity script', 'inline', module, undefined, edgeLabel);
|
|
63
|
+
}
|
|
64
|
+
function getParentIds(items = undefined) {
|
|
65
|
+
const item = items?.at(-1) || nestedNodes.at(-1);
|
|
66
|
+
if (!item)
|
|
67
|
+
return [];
|
|
68
|
+
if (isNode(item)) {
|
|
69
|
+
return ['' + item.id];
|
|
70
|
+
}
|
|
71
|
+
else if (isLoop(item)) {
|
|
72
|
+
return getParentIds(item.items);
|
|
73
|
+
}
|
|
74
|
+
else if (isBranch(item)) {
|
|
75
|
+
return item.items.map((i) => getParentIds(i)).flat();
|
|
76
|
+
}
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
function flowModuleToNode(parentIds, id, title, host, onClickDetail, lang, edgeLabel) {
|
|
80
|
+
const langImg = {
|
|
81
|
+
deno: '/icons/ts-lang.svg',
|
|
82
|
+
go: '/icons/go-lang.svg',
|
|
83
|
+
python3: '/icons/python-lang.svg',
|
|
84
|
+
bash: '/icons/bash-lang.svg'
|
|
85
|
+
};
|
|
86
|
+
const hostImg = {
|
|
87
|
+
hub: '/icons/hub-script.svg',
|
|
88
|
+
workspace: '/icons/inline-script.svg',
|
|
89
|
+
inline: ''
|
|
90
|
+
};
|
|
91
|
+
const wrapperWidth = lang ? 'w-[calc(100%-70px)]' : 'w-[calc(100%-50px)]';
|
|
92
|
+
const graphId = idGenerator.next().value;
|
|
93
|
+
return {
|
|
94
|
+
id: graphId,
|
|
95
|
+
position: { x: -1, y: -1 },
|
|
96
|
+
data: {
|
|
97
|
+
html: `
|
|
98
|
+
<div class="w-full flex justify-between items-center px-1">
|
|
99
|
+
<div class="${wrapperWidth} text-left ellipsize text-2xs">
|
|
100
|
+
${title}
|
|
101
|
+
</div>
|
|
102
|
+
<div class="flex items-center">
|
|
103
|
+
${lang ? `<img src="${langImg[lang]}" class="grayscale">` : ''}
|
|
104
|
+
${host != 'inline' ? `<img src="${hostImg[host]}" class="grayscale">` : ''}
|
|
105
|
+
<span class="center-center font-semibold bg-indigo-100 text-indigo-800 rounded px-1 pb-[2px] ml-[2px]">
|
|
106
|
+
${id ?? numberToChars(graphId - 1)}
|
|
107
|
+
</span>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
`
|
|
111
|
+
},
|
|
112
|
+
host,
|
|
113
|
+
width: NODE.width,
|
|
114
|
+
height: NODE.height,
|
|
115
|
+
bgColor: 'white',
|
|
116
|
+
parentIds,
|
|
117
|
+
clickCallback: (node) => {
|
|
118
|
+
dispatch('click', onClickDetail);
|
|
119
|
+
},
|
|
120
|
+
edgeLabel
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function flowModuleToLoop(modules, startLabel, parent = undefined) {
|
|
124
|
+
const loop = {
|
|
125
|
+
type: 'loop',
|
|
126
|
+
items: [createVirtualNode(getParentIds(parent), startLabel)]
|
|
127
|
+
};
|
|
128
|
+
modules.forEach((module) => {
|
|
129
|
+
const item = getConvertedFlowModule(module, loop.items);
|
|
130
|
+
item && loop.items.push(item);
|
|
131
|
+
});
|
|
132
|
+
loop.items.push(createVirtualNode(getParentIds(loop.items), 'Collection of the results'));
|
|
133
|
+
return loop;
|
|
134
|
+
}
|
|
135
|
+
function flowModuleToBranch(branches, edgesLabel, parent = undefined) {
|
|
136
|
+
const branch = {
|
|
137
|
+
type: 'branch',
|
|
138
|
+
items: []
|
|
139
|
+
};
|
|
140
|
+
branches.forEach((modules, i) => {
|
|
141
|
+
const items = [];
|
|
142
|
+
if (!modules.length) {
|
|
143
|
+
items.push(createVirtualNode(getParentIds(parent), 'Empty branch', edgesLabel[i]));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
modules.forEach((module) => {
|
|
147
|
+
const item = getConvertedFlowModule(module, items.length ? items : parent, edgesLabel[i]);
|
|
148
|
+
item && items.push(item);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
items.length && branch.items.push(items);
|
|
152
|
+
});
|
|
153
|
+
return branch;
|
|
154
|
+
}
|
|
155
|
+
function flattenNestedNodes(nestedNodes, nodes = []) {
|
|
156
|
+
const array = nodes;
|
|
157
|
+
nestedNodes.forEach((node) => {
|
|
158
|
+
if (isNode(node)) {
|
|
159
|
+
array.push(node);
|
|
160
|
+
}
|
|
161
|
+
else if (isLoop(node)) {
|
|
162
|
+
flattenNestedNodes(node.items, array);
|
|
163
|
+
}
|
|
164
|
+
else if (isBranch(node)) {
|
|
165
|
+
node.items.forEach((item) => {
|
|
166
|
+
flattenNestedNodes(item, array);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
return array;
|
|
171
|
+
}
|
|
172
|
+
function layoutNodes(nodes) {
|
|
173
|
+
if (!nodes.length)
|
|
174
|
+
return { nodes: [], width: 0, height: 0 };
|
|
175
|
+
const stratify = dagStratify().id(({ id }) => '' + id);
|
|
176
|
+
const dag = stratify(nodes);
|
|
177
|
+
const layout = sugiyama()
|
|
178
|
+
.decross(decrossOpt())
|
|
179
|
+
.coord(coordCenter())
|
|
180
|
+
.nodeSize(() => [NODE.width + NODE.gap.horizontal, NODE.height + NODE.gap.vertical]);
|
|
181
|
+
const { width, height } = layout(dag);
|
|
182
|
+
return {
|
|
183
|
+
nodes: dag.descendants().map((des) => ({
|
|
184
|
+
...des.data,
|
|
185
|
+
id: +des.data.id,
|
|
186
|
+
position: { x: des.x ? des.x - NODE.width / 2 : 0, y: des.y || 0 }
|
|
187
|
+
})),
|
|
188
|
+
width: width,
|
|
189
|
+
height: height + NODE.height
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function createEdges(nodes) {
|
|
193
|
+
const edges = [];
|
|
194
|
+
nodes.forEach((node) => {
|
|
195
|
+
node.parentIds.forEach((pid, i) => {
|
|
196
|
+
edges.push({
|
|
197
|
+
id: `e-${pid}-${node.id}`,
|
|
198
|
+
source: +pid,
|
|
199
|
+
target: node.id,
|
|
200
|
+
labelBgColor: 'white',
|
|
201
|
+
arrow: true,
|
|
202
|
+
animate: false,
|
|
203
|
+
noHandle: false,
|
|
204
|
+
label: node.edgeLabel
|
|
205
|
+
// type: 'smoothstep'
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
return edges;
|
|
210
|
+
}
|
|
211
|
+
function createVirtualNode(parentIds, label, edgesLabel) {
|
|
212
|
+
return {
|
|
213
|
+
id: idGenerator.next().value,
|
|
214
|
+
position: { x: -1, y: -1 },
|
|
215
|
+
data: {
|
|
216
|
+
html: `
|
|
217
|
+
<div class="w-full max-h-full text-center ellipsize-multi-line text-2xs [-webkit-line-clamp:2] px-1">
|
|
218
|
+
${label}
|
|
219
|
+
</div>
|
|
220
|
+
`
|
|
221
|
+
},
|
|
222
|
+
width: NODE.width,
|
|
223
|
+
height: NODE.height,
|
|
224
|
+
bgColor: '#d4e4ff',
|
|
225
|
+
parentIds
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function createErrorHandler(parentIds, module) {
|
|
229
|
+
return {
|
|
230
|
+
id: -1,
|
|
231
|
+
position: { x: -1, y: -1 },
|
|
232
|
+
data: {
|
|
233
|
+
html: `
|
|
234
|
+
<div class="w-full max-h-full text-center ellipsize-multi-line text-2xs [-webkit-line-clamp:2] px-1">
|
|
235
|
+
Error handler
|
|
236
|
+
</div>
|
|
237
|
+
`
|
|
238
|
+
},
|
|
239
|
+
width: NODE.width,
|
|
240
|
+
height: NODE.height,
|
|
241
|
+
bgColor: 'rgb(248 113 113)',
|
|
242
|
+
parentIds,
|
|
243
|
+
clickCallback: (node) => {
|
|
244
|
+
dispatch('click', module);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
</script>
|
|
249
|
+
|
|
250
|
+
<div
|
|
251
|
+
on:scroll={() => console.log('X')}
|
|
252
|
+
bind:clientWidth={width}
|
|
253
|
+
bind:clientHeight={height}
|
|
254
|
+
class="w-full h-full overflow-hidden"
|
|
255
|
+
>
|
|
256
|
+
{#if width && height}
|
|
257
|
+
<Svelvet {nodes} {edges} {width} {height} bgColor="rgb(249 250 251)" />
|
|
258
|
+
{/if}
|
|
259
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { FlowModule } from '../../gen';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
modules?: FlowModule[] | undefined;
|
|
6
|
+
failureModule?: FlowModule | undefined;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
click: CustomEvent<any>;
|
|
10
|
+
} & {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
};
|
|
15
|
+
export declare type FlowGraphProps = typeof __propDef.props;
|
|
16
|
+
export declare type FlowGraphEvents = typeof __propDef.events;
|
|
17
|
+
export declare type FlowGraphSlots = typeof __propDef.slots;
|
|
18
|
+
export default class FlowGraph extends SvelteComponentTyped<FlowGraphProps, FlowGraphEvents, FlowGraphSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|