windmill-components 1.613.4 → 1.623.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/package/assets/tokens/tokens.json +1 -11
- package/package/ata/apis.js +5 -78
- package/package/components/AddUser.svelte +1 -1
- package/package/components/CenteredModal.svelte +24 -32
- package/package/components/CenteredModal.svelte.d.ts +27 -7
- package/package/components/CenteredPage.svelte +2 -5
- package/package/components/CenteredPage.svelte.d.ts +0 -2
- package/package/components/ConcurrentJobsChart.svelte +2 -3
- package/package/components/ConcurrentJobsChart.svelte.d.ts +2 -2
- package/package/components/CustomPopover.svelte +23 -20
- package/package/components/CustomPopover.svelte.d.ts +39 -14
- package/package/components/DBManager.svelte +17 -105
- package/package/components/DBManager.svelte.d.ts +1 -2
- package/package/components/DBManagerContent.svelte +3 -4
- package/package/components/DBManagerContent.svelte.d.ts +1 -1
- package/package/components/DBTableEditor.svelte +171 -210
- package/package/components/DBTableEditor.svelte.d.ts +3 -22
- package/package/components/Description.svelte +2 -3
- package/package/components/Dev.svelte +2 -36
- package/package/components/DiffDrawer.svelte +29 -8
- package/package/components/DiffEditor.svelte +2 -32
- package/package/components/DisplayResult.svelte +24 -32
- package/package/components/Editor.svelte +16 -70
- package/package/components/Editor.svelte.d.ts +0 -3
- package/package/components/EditorBar.svelte +1 -1
- package/package/components/FakeMonacoPlaceHolder.svelte +1 -1
- package/package/components/FlowBuilder.svelte +11 -17
- package/package/components/FlowPreviewContent.svelte +2 -3
- package/package/components/FlowPreviewResult.svelte +4 -0
- package/package/components/FlowRestartButton.svelte +3 -2
- package/package/components/FlowRestartButton.svelte.d.ts +0 -3
- package/package/components/FlowStatusViewerInner.svelte +33 -50
- package/package/components/FlowStatusViewerInner.svelte.d.ts +1 -1
- package/package/components/FlowStatusWaitingForEvents.svelte +23 -27
- package/package/components/FlowStatusWaitingForEvents.svelte.d.ts +18 -4
- package/package/components/FlowViewer.svelte +2 -103
- package/package/components/FlowViewer.svelte.d.ts +3 -9
- package/package/components/ForkWorkspaceBanner.svelte +13 -16
- package/package/components/GraphqlSchemaViewer.svelte +1 -8
- package/package/components/HistoricInputs.svelte +27 -25
- package/package/components/HistoricInputs.svelte.d.ts +2 -2
- package/package/components/InstanceSetting.svelte +0 -38
- package/package/components/InviteUser.svelte +42 -16
- package/package/components/InviteUser.svelte.d.ts +18 -4
- package/package/components/JsonInputs.svelte +8 -6
- package/package/components/JsonInputs.svelte.d.ts +8 -7
- package/package/components/LogViewer.svelte +33 -91
- package/package/components/Login.svelte +0 -21
- package/package/components/ManualPopover.svelte +6 -5
- package/package/components/ManualPopover.svelte.d.ts +35 -9
- package/package/components/MemoryFootprintViewer.svelte +6 -2
- package/package/components/ModulePreview.svelte +21 -23
- package/package/components/ModulePreview.svelte.d.ts +0 -1
- package/package/components/Path.svelte +2 -2
- package/package/components/Path.svelte.d.ts +1 -1
- package/package/components/ResourcePicker.svelte +0 -3
- package/package/components/ResourcePicker.svelte.d.ts +0 -1
- package/package/components/RunButton.svelte +15 -5
- package/package/components/RunButton.svelte.d.ts +19 -7
- package/package/components/RunChart.svelte +4 -8
- package/package/components/RunChart.svelte.d.ts +2 -2
- package/package/components/RunFormAdvancedPopup.svelte +1 -1
- package/package/components/RunsPage.svelte +539 -170
- package/package/components/RunsPage.svelte.d.ts +5 -5
- package/package/components/S3FilePicker.svelte +11 -7
- package/package/components/S3FilePickerInner.svelte +3 -2
- package/package/components/S3FilePickerInner.svelte.d.ts +2 -2
- package/package/components/SavedInputs.svelte +416 -0
- package/package/components/{tutorials/workspace/WorkspaceOnboardingOperatorTutorial.svelte.d.ts → SavedInputs.svelte.d.ts} +11 -8
- package/package/components/SchemaForm.svelte +19 -26
- package/package/components/SchemaFormWithArgPicker.svelte +3 -4
- package/package/components/ScriptBuilder.svelte +1 -1
- package/package/components/ScriptEditor.svelte +101 -575
- package/package/components/Section.svelte +1 -3
- package/package/components/ServiceLogsInner.svelte +4 -4
- package/package/components/SimpleEditor.svelte +2 -46
- package/package/components/SuperadminSettingsInner.svelte +1 -1
- package/package/components/TemplateEditor.svelte +29 -54
- package/package/components/TemplateEditor.svelte.d.ts +102 -13
- package/package/components/UserSettings.svelte +1 -1
- package/package/components/WorkerTagPicker.svelte +1 -1
- package/package/components/WorkerTagSelect.svelte +2 -5
- package/package/components/WorkspaceTutorials.svelte +0 -5
- package/package/components/apps/components/buttons/AppButton.svelte +6 -21
- package/package/components/apps/components/buttons/AppForm.svelte +1 -2
- package/package/components/apps/components/buttons/AppFormButton.svelte +1 -2
- package/package/components/apps/components/display/dbtable/AppDbExplorer.svelte +4 -0
- package/package/components/apps/components/display/dbtable/metadata.js +30 -69
- package/package/components/apps/components/display/dbtable/queries/createTable.d.ts +24 -2
- package/package/components/apps/components/display/dbtable/queries/createTable.js +25 -11
- package/package/components/apps/components/display/dbtable/queries/select.d.ts +0 -2
- package/package/components/apps/components/display/dbtable/queries/select.js +6 -37
- package/package/components/apps/components/display/dbtable/utils.d.ts +1 -10
- package/package/components/apps/components/display/dbtable/utils.js +20 -52
- package/package/components/apps/components/helpers/HiddenComponent.svelte +1 -1
- package/package/components/apps/components/helpers/InputValue.svelte +1 -1
- package/package/components/apps/components/helpers/ResolveConfig.svelte +1 -1
- package/package/components/apps/components/helpers/RunnableComponent.svelte +2 -3
- package/package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +1 -1
- package/package/components/apps/components/helpers/RunnableWrapper.svelte +2 -2
- package/package/components/apps/editor/AppEditorHeader.svelte +1 -8
- package/package/components/apps/editor/AppEditorHeaderDeploy.svelte +29 -32
- package/package/components/apps/editor/AppEditorHeaderDeploy.svelte.d.ts +2 -2
- package/package/components/apps/editor/AppEditorHeaderDeployInitialDraft.svelte +4 -4
- package/package/components/apps/editor/AppEditorHeaderDeployInitialDraft.svelte.d.ts +3 -3
- package/package/components/apps/editor/PublicApp.svelte +30 -49
- package/package/components/apps/editor/PublicApp.svelte.d.ts +0 -1
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptRunnableByPath.svelte +7 -77
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptRunnableByPath.svelte.d.ts +2 -2
- package/package/components/apps/editor/inlineScriptsPanel/utils.d.ts +2 -2
- package/package/components/apps/editor/inlineScriptsPanel/utils.js +1 -10
- package/package/components/apps/inputType.d.ts +1 -6
- package/package/components/auditLogs/AuditLogsFilters.svelte +17 -9
- package/package/components/auditLogs/AuditLogsFilters.svelte.d.ts +1 -1
- package/package/components/common/button/model.js +1 -1
- package/package/components/common/calendarPicker/CalendarPicker.svelte.d.ts +1 -1
- package/package/components/common/languageIcons/TypeScript.svelte +3 -5
- package/package/components/common/languageIcons/TypeScript.svelte.d.ts +0 -1
- package/package/components/common/modal/Modal.svelte +3 -3
- package/package/components/copilot/autocomplete/Autocompletor.js +2 -3
- package/package/components/copilot/chat/AIButtonStyle.d.ts +1 -1
- package/package/components/copilot/chat/AIButtonStyle.js +1 -2
- package/package/components/copilot/chat/AIChat.svelte +1 -3
- package/package/components/copilot/chat/AIChatDisplay.svelte +4 -89
- package/package/components/copilot/chat/AIChatInput.svelte +0 -275
- package/package/components/copilot/chat/AIChatManager.svelte.js +1 -107
- package/package/components/copilot/chat/AiChatLayout.svelte +30 -15
- package/package/components/copilot/chat/ContextElementBadge.svelte +0 -44
- package/package/components/copilot/chat/DatatableCreationPolicy.svelte +33 -32
- package/package/components/copilot/chat/ProviderModelSelector.svelte +1 -1
- package/package/components/copilot/chat/__tests__/app/appEvalHelpers.js +0 -3
- package/package/components/copilot/chat/__tests__/flow/flowEvalHelpers.js +0 -4
- package/package/components/copilot/chat/app/core.d.ts +15 -56
- package/package/components/copilot/chat/app/core.js +22 -141
- package/package/components/copilot/chat/context.d.ts +2 -59
- package/package/components/copilot/chat/context.js +2 -6
- package/package/components/copilot/chat/flow/FlowAIChat.svelte +0 -22
- package/package/components/copilot/chat/flow/core.d.ts +1 -3
- package/package/components/copilot/chat/flow/core.js +2 -29
- package/package/components/copilot/chat/flow/openFlow.json +1 -1
- package/package/components/copilot/chat/flow/openFlowZod.d.ts +0 -1
- package/package/components/copilot/chat/flow/openFlowZod.js +2 -14
- package/package/components/copilot/chat/script/core.d.ts +1 -4
- package/package/components/copilot/chat/script/core.js +2 -38
- package/package/components/copilot/chat/shared.d.ts +0 -10
- package/package/components/copilot/chat/shared.js +0 -24
- package/package/components/copilot/lib.d.ts +1 -1
- package/package/components/custom_ui.d.ts +0 -2
- package/package/components/dbOps.d.ts +4 -18
- package/package/components/dbOps.js +3 -25
- package/package/components/flows/CreateActionsApp.svelte +4 -6
- package/package/components/flows/DebounceLimit.svelte.d.ts +1 -1
- package/package/components/flows/FlowHistoryInner.svelte +4 -15
- package/package/components/flows/content/AgentToolWrapper.svelte +1 -1
- package/package/components/flows/content/FlowInput.svelte +37 -211
- package/package/components/flows/content/FlowModuleComponent.svelte +67 -553
- package/package/components/flows/content/FlowModuleEarlyStop.svelte +10 -8
- package/package/components/flows/content/FlowModuleHeader.svelte +4 -7
- package/package/components/flows/content/FlowModuleWorkerTagSelect.svelte +1 -1
- package/package/components/flows/content/McpToolEditor.svelte +37 -50
- package/package/components/flows/content/McpToolEditor.svelte.d.ts +1 -0
- package/package/components/flows/conversations/FlowChat.svelte +2 -16
- package/package/components/flows/conversations/FlowChat.svelte.d.ts +1 -2
- package/package/components/flows/conversations/FlowChatInterface.svelte +6 -103
- package/package/components/flows/conversations/FlowChatInterface.svelte.d.ts +0 -2
- package/package/components/flows/conversations/FlowChatManager.svelte.js +21 -53
- package/package/components/flows/header/FlowImportExportMenu.svelte +1 -1
- package/package/components/flows/propPicker/PropPickerWrapper.svelte +1 -3
- package/package/components/flows/types.d.ts +0 -2
- package/package/components/git_sync/GitSyncRepositoryCard.svelte +8 -16
- package/package/components/home/ItemsList.svelte +5 -5
- package/package/components/home/TutorialBanner.svelte +18 -34
- package/package/components/icons/CssIcon.svelte +0 -20
- package/package/components/icons/CssIcon.svelte.d.ts +25 -7
- package/package/components/icons/JavaScriptIcon.svelte +2 -10
- package/package/components/icons/JavaScriptIcon.svelte.d.ts +0 -1
- package/package/components/icons/JsonIcon.svelte +2 -8
- package/package/components/icons/JsonIcon.svelte.d.ts +0 -1
- package/package/components/icons/ReactIcon.svelte +2 -10
- package/package/components/icons/ReactIcon.svelte.d.ts +0 -1
- package/package/components/icons/SvelteIcon.svelte +2 -10
- package/package/components/icons/SvelteIcon.svelte.d.ts +0 -1
- package/package/components/icons/VueIcon.svelte +2 -10
- package/package/components/icons/VueIcon.svelte.d.ts +0 -1
- package/package/components/instanceSettings.d.ts +1 -2
- package/package/components/instanceSettings.js +1 -32
- package/package/components/jobs/JobPreview.svelte +39 -46
- package/package/components/jobs/JobPreview.svelte.d.ts +0 -1
- package/package/components/monacoLanguagesOptions.js +15 -16
- package/package/components/propertyPicker/PropPicker.svelte +2 -16
- package/package/components/propertyPicker/PropPicker.svelte.d.ts +0 -2
- package/package/components/raw_apps/DefaultDatabaseSelector.svelte +5 -9
- package/package/components/raw_apps/FileEditorIcon.svelte +7 -12
- package/package/components/raw_apps/FileEditorIcon.svelte.d.ts +0 -2
- package/package/components/raw_apps/FileTreeNode.svelte +83 -119
- package/package/components/raw_apps/RawAppBackgroundRunner.svelte +8 -88
- package/package/components/raw_apps/RawAppDataTableList.svelte +9 -12
- package/package/components/raw_apps/RawAppEditor.svelte +68 -218
- package/package/components/raw_apps/RawAppEditorHeader.svelte +16 -33
- package/package/components/raw_apps/RawAppHistoryList.svelte +80 -264
- package/package/components/raw_apps/RawAppHistoryList.svelte.d.ts +0 -1
- package/package/components/raw_apps/RawAppHistoryManager.svelte.d.ts +1 -15
- package/package/components/raw_apps/RawAppHistoryManager.svelte.js +12 -46
- package/package/components/raw_apps/RawAppInlineScriptEditor.svelte +47 -549
- package/package/components/raw_apps/RawAppInlineScriptEditor.svelte.d.ts +5 -31
- package/package/components/raw_apps/RawAppInlineScriptPanelList.svelte +18 -25
- package/package/components/raw_apps/RawAppInlineScriptPanelList.svelte.d.ts +0 -1
- package/package/components/raw_apps/RawAppInlineScriptRunnable.svelte +10 -141
- package/package/components/raw_apps/RawAppInlineScriptRunnable.svelte.d.ts +0 -8
- package/package/components/raw_apps/RawAppInlineScriptsPanel.svelte +1 -2
- package/package/components/raw_apps/RawAppInlineScriptsPanel.svelte.d.ts +1 -9
- package/package/components/raw_apps/RawAppInputsSpecEditor.svelte +3 -47
- package/package/components/raw_apps/RawAppInputsSpecEditor.svelte.d.ts +2 -2
- package/package/components/raw_apps/RawAppModules.svelte +7 -13
- package/package/components/raw_apps/RawAppPreview.svelte +6 -48
- package/package/components/raw_apps/RawAppSidebar.svelte +125 -194
- package/package/components/raw_apps/RawAppSidebar.svelte.d.ts +0 -1
- package/package/components/raw_apps/utils.d.ts +1 -1
- package/package/components/raw_apps/utils.js +18 -76
- package/package/components/runs/JobsLoader.svelte +468 -0
- package/package/components/runs/JobsLoader.svelte.d.ts +49 -0
- package/package/components/runs/ManuelDatePicker.svelte +3 -3
- package/package/components/runs/ManuelDatePicker.svelte.d.ts +3 -3
- package/package/components/runs/NoWorkerWithTagWarning.svelte +1 -5
- package/package/components/runs/RunsFilter.svelte +63 -75
- package/package/components/runs/RunsFilter.svelte.d.ts +4 -35
- package/package/components/runs/RunsQueue.svelte.d.ts +1 -1
- package/package/components/runs/RunsTable.svelte +1 -1
- package/package/components/runs/RunsTable.svelte.d.ts +1 -1
- package/package/components/schema/SchemaPicker.svelte +92 -0
- package/package/components/{tutorials/RunsTutorial.svelte.d.ts → schema/SchemaPicker.svelte.d.ts} +12 -11
- package/package/components/scriptEditor/LogPanel.svelte +2 -17
- package/package/components/scriptEditor/LogPanel.svelte.d.ts +0 -2
- package/package/components/select/SelectDropdown.svelte +2 -2
- package/package/components/settings/ChangeWorkspaceColor.svelte +3 -4
- package/package/components/settings/ChangeWorkspaceId.svelte +10 -14
- package/package/components/settings/ChangeWorkspaceName.svelte +6 -7
- package/package/components/settings/CreateToken.svelte +1 -1
- package/package/components/settings/UserAIPromptsSettings.svelte +15 -56
- package/package/components/settings/WorkspaceOperatorSettings.svelte +85 -68
- package/package/components/settings/WorkspaceUserSettings.svelte +406 -531
- package/package/components/sidebar/MenuButton.svelte +24 -46
- package/package/components/sidebar/MenuButton.svelte.d.ts +0 -2
- package/package/components/sidebar/MultiplayerMenu.svelte +3 -3
- package/package/components/sidebar/OperatorMenu.svelte +88 -63
- package/package/components/sidebar/SidebarContent.svelte +2 -7
- package/package/components/sidebar/UserMenu.svelte +1 -1
- package/package/components/sidebar/WorkspaceMenu.svelte +85 -35
- package/package/components/sqlTypeService.js +3 -4
- package/package/components/table/DataTable.svelte +2 -3
- package/package/components/table/DataTable.svelte.d.ts +0 -1
- package/package/components/text_input/TextInput.svelte +0 -3
- package/package/components/text_input/TextInput.svelte.d.ts +0 -2
- package/package/components/triggers/utils.js +1 -0
- package/package/components/tutorials/FlowBuilderLiveTutorial.svelte +35 -6
- package/package/components/tutorials/TroubleshootFlowTutorial.svelte +20 -5
- package/package/components/tutorials/utils.d.ts +0 -16
- package/package/components/tutorials/utils.js +0 -96
- package/package/components/vscode.js +6 -6
- package/package/components/workspaceSettings/AISettings.svelte +108 -146
- package/package/components/workspaceSettings/CreateWorkspace.svelte +12 -26
- package/package/components/workspaceSettings/DucklakeSettings.svelte +23 -46
- package/package/components/workspaceSettings/DucklakeSettings.svelte.d.ts +1 -2
- package/package/components/workspaceSettings/ModelTokenLimits.svelte +18 -14
- package/package/components/workspaceSettings/StorageSettings.svelte +241 -280
- package/package/components/workspaceSettings/StorageSettings.svelte.d.ts +0 -1
- package/package/consts.js +1 -4
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/schemas.gen.d.ts +0 -126
- package/package/gen/schemas.gen.js +0 -126
- package/package/gen/services.gen.d.ts +2 -151
- package/package/gen/services.gen.js +4 -301
- package/package/gen/types.gen.d.ts +2 -584
- package/package/hubPaths.json +2 -3
- package/package/infer.js +0 -2
- package/package/logout.d.ts +2 -0
- package/package/logout.js +23 -2
- package/package/monaco_workers/graphql.worker.bundle.js +121 -121
- package/package/navigation.d.ts +1 -1
- package/package/rawAppWmillTs.d.ts +0 -11
- package/package/rawAppWmillTs.js +1 -38
- package/package/svelte5Utils.svelte.d.ts +1 -7
- package/package/svelte5Utils.svelte.js +2 -23
- package/package/tutorialUtils.js +4 -0
- package/package/tutorials/config.js +3 -31
- package/package/tutorials/roleUtils.d.ts +1 -1
- package/package/tutorials/roleUtils.js +2 -6
- package/package/utils.js +1 -159
- package/package.json +14 -16
- package/dist/sharedUtils/assets/tokens/colorTokensConfig.d.ts +0 -2
- package/dist/sharedUtils/base.d.ts +0 -1
- package/dist/sharedUtils/cloud.d.ts +0 -1
- package/dist/sharedUtils/common.d.ts +0 -111
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/count.d.ts +0 -5
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/delete.d.ts +0 -5
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/insert.d.ts +0 -5
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/select.d.ts +0 -13
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/update.d.ts +0 -11
- package/dist/sharedUtils/components/apps/components/display/dbtable/utils.d.ts +0 -95
- package/dist/sharedUtils/components/apps/editor/appPolicy.d.ts +0 -6
- package/dist/sharedUtils/components/apps/editor/appUtilsCore.d.ts +0 -7
- package/dist/sharedUtils/components/apps/editor/appUtilsS3.d.ts +0 -33
- package/dist/sharedUtils/components/apps/editor/commonAppUtils.d.ts +0 -10
- package/dist/sharedUtils/components/apps/editor/component/components.d.ts +0 -5371
- package/dist/sharedUtils/components/apps/editor/component/default-codes.d.ts +0 -3
- package/dist/sharedUtils/components/apps/editor/component/index.d.ts +0 -3
- package/dist/sharedUtils/components/apps/editor/component/sets.d.ts +0 -7
- package/dist/sharedUtils/components/apps/editor/componentsPanel/componentDefaultProps.d.ts +0 -3
- package/dist/sharedUtils/components/apps/gridUtils.d.ts +0 -14
- package/dist/sharedUtils/components/apps/inputType.d.ts +0 -178
- package/dist/sharedUtils/components/apps/rx.d.ts +0 -29
- package/dist/sharedUtils/components/apps/sharedTypes.d.ts +0 -21
- package/dist/sharedUtils/components/apps/types.d.ts +0 -274
- package/dist/sharedUtils/components/assets/lib.d.ts +0 -25
- package/dist/sharedUtils/components/common/alert/model.d.ts +0 -2
- package/dist/sharedUtils/components/common/badge/model.d.ts +0 -8
- package/dist/sharedUtils/components/common/button/model.d.ts +0 -45
- package/dist/sharedUtils/components/common/fileInput/model.d.ts +0 -1
- package/dist/sharedUtils/components/common/index.d.ts +0 -24
- package/dist/sharedUtils/components/common/skeleton/model.d.ts +0 -21
- package/dist/sharedUtils/components/dbTypes.d.ts +0 -14
- package/dist/sharedUtils/components/diff_drawer.d.ts +0 -26
- package/dist/sharedUtils/components/ducklake.d.ts +0 -1
- package/dist/sharedUtils/components/flows/scheduleUtils.d.ts +0 -7
- package/dist/sharedUtils/components/icons/index.d.ts +0 -101
- package/dist/sharedUtils/components/random_positive_adjetive.d.ts +0 -1
- package/dist/sharedUtils/components/raw_apps/rawAppPolicy.d.ts +0 -10
- package/dist/sharedUtils/components/raw_apps/utils.d.ts +0 -15
- package/dist/sharedUtils/components/triggers/email/utils.d.ts +0 -4
- package/dist/sharedUtils/components/triggers/gcp/utils.d.ts +0 -2
- package/dist/sharedUtils/components/triggers/http/utils.d.ts +0 -11
- package/dist/sharedUtils/components/triggers/kafka/utils.d.ts +0 -2
- package/dist/sharedUtils/components/triggers/mqtt/utils.d.ts +0 -2
- package/dist/sharedUtils/components/triggers/nats/utils.d.ts +0 -2
- package/dist/sharedUtils/components/triggers/postgres/utils.d.ts +0 -8
- package/dist/sharedUtils/components/triggers/sqs/utils.d.ts +0 -2
- package/dist/sharedUtils/components/triggers/triggers.svelte.d.ts +0 -32
- package/dist/sharedUtils/components/triggers/utils.d.ts +0 -80
- package/dist/sharedUtils/components/triggers/websocket/utils.d.ts +0 -2
- package/dist/sharedUtils/components/triggers.d.ts +0 -20
- package/dist/sharedUtils/gen/core/ApiError.d.ts +0 -10
- package/dist/sharedUtils/gen/core/ApiRequestOptions.d.ts +0 -13
- package/dist/sharedUtils/gen/core/ApiResult.d.ts +0 -7
- package/dist/sharedUtils/gen/core/CancelablePromise.d.ts +0 -26
- package/dist/sharedUtils/gen/core/OpenAPI.d.ts +0 -27
- package/dist/sharedUtils/gen/core/request.d.ts +0 -29
- package/dist/sharedUtils/gen/index.d.ts +0 -6
- package/dist/sharedUtils/gen/schemas.gen.d.ts +0 -7036
- package/dist/sharedUtils/gen/services.gen.d.ts +0 -6047
- package/dist/sharedUtils/gen/types.gen.d.ts +0 -21881
- package/dist/sharedUtils/history.svelte.d.ts +0 -9
- package/dist/sharedUtils/hub.d.ts +0 -49
- package/dist/sharedUtils/jsr.json +0 -6
- package/dist/sharedUtils/lib.d.ts +0 -5
- package/dist/sharedUtils/lib.es.js +0 -1588
- package/dist/sharedUtils/package.json +0 -12
- package/dist/sharedUtils/schema.d.ts +0 -3
- package/dist/sharedUtils/stores.d.ts +0 -97
- package/dist/sharedUtils/svelte5Utils.svelte.d.ts +0 -80
- package/dist/sharedUtils/toast.d.ts +0 -8
- package/dist/sharedUtils/utils.d.ts +0 -265
- package/package/components/FlowDiffViewer.svelte +0 -37
- package/package/components/FlowDiffViewer.svelte.d.ts +0 -7
- package/package/components/JobOtelTraces.svelte +0 -287
- package/package/components/JobOtelTraces.svelte.d.ts +0 -6
- package/package/components/apps/components/display/dbtable/queries/alterTable.d.ts +0 -46
- package/package/components/apps/components/display/dbtable/queries/alterTable.js +0 -314
- package/package/components/apps/components/display/dbtable/queries/alterTable.test.d.ts +0 -1
- package/package/components/apps/components/display/dbtable/queries/alterTable.test.js +0 -867
- package/package/components/apps/components/display/dbtable/queries/dbQueriesUtils.d.ts +0 -9
- package/package/components/apps/components/display/dbtable/queries/dbQueriesUtils.js +0 -45
- package/package/components/apps/components/display/dbtable/queries/relationalKeys.d.ts +0 -47
- package/package/components/apps/components/display/dbtable/queries/relationalKeys.js +0 -402
- package/package/components/apps/components/display/dbtable/tableEditor.d.ts +0 -35
- package/package/components/apps/components/display/dbtable/tableEditor.js +0 -49
- package/package/components/copilot/chat/AppAvailableContextList.svelte +0 -263
- package/package/components/copilot/chat/AppAvailableContextList.svelte.d.ts +0 -13
- package/package/components/debug/DebugConsole.svelte +0 -277
- package/package/components/debug/DebugConsole.svelte.d.ts +0 -13
- package/package/components/debug/DebugPanel.svelte +0 -97
- package/package/components/debug/DebugPanel.svelte.d.ts +0 -11
- package/package/components/debug/DebugToolbar.svelte +0 -148
- package/package/components/debug/DebugToolbar.svelte.d.ts +0 -17
- package/package/components/debug/DebugVariableViewer.svelte +0 -115
- package/package/components/debug/DebugVariableViewer.svelte.d.ts +0 -11
- package/package/components/debug/MonacoDebugger.svelte +0 -384
- package/package/components/debug/MonacoDebugger.svelte.d.ts +0 -15
- package/package/components/debug/dapClient.d.ts +0 -192
- package/package/components/debug/dapClient.js +0 -426
- package/package/components/debug/debugUtils.d.ts +0 -30
- package/package/components/debug/debugUtils.js +0 -131
- package/package/components/debug/index.d.ts +0 -75
- package/package/components/debug/index.js +0 -82
- package/package/components/flows/content/FlowEditorDrawer.svelte +0 -124
- package/package/components/flows/content/FlowEditorDrawer.svelte.d.ts +0 -22
- package/package/components/flows/content/McpOAuthConnect.svelte +0 -217
- package/package/components/flows/content/McpOAuthConnect.svelte.d.ts +0 -7
- package/package/components/icons/HtmlIcon.svelte +0 -20
- package/package/components/icons/HtmlIcon.svelte.d.ts +0 -8
- package/package/components/icons/LessIcon.svelte +0 -16
- package/package/components/icons/LessIcon.svelte.d.ts +0 -8
- package/package/components/icons/MarkdownIcon.svelte +0 -20
- package/package/components/icons/MarkdownIcon.svelte.d.ts +0 -8
- package/package/components/icons/SassIcon.svelte +0 -28
- package/package/components/icons/SassIcon.svelte.d.ts +0 -8
- package/package/components/icons/YamlIcon.svelte +0 -20
- package/package/components/icons/YamlIcon.svelte.d.ts +0 -8
- package/package/components/instanceSettings/SecretBackendConfig.svelte +0 -514
- package/package/components/instanceSettings/SecretBackendConfig.svelte.d.ts +0 -8
- package/package/components/raw_apps/RunnableRow.svelte +0 -41
- package/package/components/raw_apps/RunnableRow.svelte.d.ts +0 -11
- package/package/components/runs/useJobsLoader.svelte.d.ts +0 -34
- package/package/components/runs/useJobsLoader.svelte.js +0 -507
- package/package/components/settings/AIPromptsModal.svelte +0 -88
- package/package/components/settings/AIPromptsModal.svelte.d.ts +0 -11
- package/package/components/tutorials/RunsTutorial.svelte +0 -399
- package/package/components/tutorials/workspace/WorkspaceOnboardingOperatorTutorial.svelte +0 -133
- package/package/components/workspace/WorkspaceCard.svelte +0 -184
- package/package/components/workspace/WorkspaceCard.svelte.d.ts +0 -24
- package/package/components/workspace/WorkspaceIcon.svelte +0 -21
- package/package/components/workspace/WorkspaceIcon.svelte.d.ts +0 -9
- package/package/components/workspace/WorkspaceTreeView.svelte +0 -331
- package/package/components/workspace/WorkspaceTreeView.svelte.d.ts +0 -15
- package/package/logoutKit.d.ts +0 -2
- package/package/logoutKit.js +0 -26
- package/package/svelte5UtilsKit.svelte.d.ts +0 -3
- package/package/svelte5UtilsKit.svelte.js +0 -30
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { workspaceStore } from '../stores';
|
|
2
|
-
import { Alert, Skeleton } from './common';
|
|
3
|
-
import { Activity } from 'lucide-svelte';
|
|
4
|
-
import { JobService } from '../gen';
|
|
5
|
-
import { msToReadableTime } from '../utils';
|
|
6
|
-
// OTEL SpanKind enum values from opentelemetry-proto/opentelemetry/proto/trace/v1/trace.proto
|
|
7
|
-
const SpanKind = {
|
|
8
|
-
UNSPECIFIED: 0,
|
|
9
|
-
INTERNAL: 1,
|
|
10
|
-
SERVER: 2,
|
|
11
|
-
CLIENT: 3,
|
|
12
|
-
PRODUCER: 4,
|
|
13
|
-
CONSUMER: 5
|
|
14
|
-
};
|
|
15
|
-
// OTEL StatusCode enum values from opentelemetry-proto/opentelemetry/proto/trace/v1/trace.proto
|
|
16
|
-
const StatusCode = {
|
|
17
|
-
UNSET: 0,
|
|
18
|
-
OK: 1,
|
|
19
|
-
ERROR: 2
|
|
20
|
-
};
|
|
21
|
-
let { jobId } = $props();
|
|
22
|
-
let traces = $state([]);
|
|
23
|
-
let loading = $state(true);
|
|
24
|
-
let error = $state(null);
|
|
25
|
-
let expandedSpans = $state(new Set());
|
|
26
|
-
$effect(() => {
|
|
27
|
-
if (jobId) {
|
|
28
|
-
loadTraces();
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
async function loadTraces() {
|
|
32
|
-
if (!$workspaceStore || !jobId)
|
|
33
|
-
return;
|
|
34
|
-
loading = true;
|
|
35
|
-
error = null;
|
|
36
|
-
try {
|
|
37
|
-
const response = await JobService.getJobOtelTraces({
|
|
38
|
-
workspace: $workspaceStore,
|
|
39
|
-
id: jobId
|
|
40
|
-
});
|
|
41
|
-
traces = response;
|
|
42
|
-
}
|
|
43
|
-
catch (e) {
|
|
44
|
-
if (e?.status === 404) {
|
|
45
|
-
traces = [];
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
error = `Error loading traces: ${e?.message ?? e}`;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
finally {
|
|
52
|
-
loading = false;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function getDurationMs(span) {
|
|
56
|
-
return (span.end_time_unix_nano - span.start_time_unix_nano) / 1_000_000;
|
|
57
|
-
}
|
|
58
|
-
function formatTimestamp(ns) {
|
|
59
|
-
const date = new Date(ns / 1000000);
|
|
60
|
-
return date.toISOString();
|
|
61
|
-
}
|
|
62
|
-
function getStatusColor(statusCode) {
|
|
63
|
-
switch (statusCode) {
|
|
64
|
-
case StatusCode.UNSET:
|
|
65
|
-
return 'text-secondary';
|
|
66
|
-
case StatusCode.OK:
|
|
67
|
-
return 'text-green-600';
|
|
68
|
-
case StatusCode.ERROR:
|
|
69
|
-
return 'text-red-600';
|
|
70
|
-
default:
|
|
71
|
-
return 'text-secondary';
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function getStatusLabel(statusCode) {
|
|
75
|
-
switch (statusCode) {
|
|
76
|
-
case StatusCode.UNSET:
|
|
77
|
-
return 'Unset';
|
|
78
|
-
case StatusCode.OK:
|
|
79
|
-
return 'OK';
|
|
80
|
-
case StatusCode.ERROR:
|
|
81
|
-
return 'Error';
|
|
82
|
-
default:
|
|
83
|
-
return 'Unknown';
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function toggleSpan(spanId) {
|
|
87
|
-
const newSet = new Set(expandedSpans);
|
|
88
|
-
if (newSet.has(spanId)) {
|
|
89
|
-
newSet.delete(spanId);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
newSet.add(spanId);
|
|
93
|
-
}
|
|
94
|
-
expandedSpans = newSet;
|
|
95
|
-
}
|
|
96
|
-
function getKindLabel(kind) {
|
|
97
|
-
switch (kind) {
|
|
98
|
-
case SpanKind.INTERNAL: return 'Internal';
|
|
99
|
-
case SpanKind.SERVER: return 'Server';
|
|
100
|
-
case SpanKind.CLIENT: return 'Client';
|
|
101
|
-
case SpanKind.PRODUCER: return 'Producer';
|
|
102
|
-
case SpanKind.CONSUMER: return 'Consumer';
|
|
103
|
-
default: return 'Unknown';
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
// Parse OTEL proto AnyValue to a simple value
|
|
107
|
-
function parseAnyValue(anyValue) {
|
|
108
|
-
if (!anyValue)
|
|
109
|
-
return null;
|
|
110
|
-
if (anyValue.stringValue !== undefined)
|
|
111
|
-
return anyValue.stringValue;
|
|
112
|
-
if (anyValue.intValue !== undefined)
|
|
113
|
-
return anyValue.intValue;
|
|
114
|
-
if (anyValue.boolValue !== undefined)
|
|
115
|
-
return anyValue.boolValue;
|
|
116
|
-
if (anyValue.doubleValue !== undefined)
|
|
117
|
-
return anyValue.doubleValue;
|
|
118
|
-
if (anyValue.arrayValue?.values) {
|
|
119
|
-
return anyValue.arrayValue.values.map(parseAnyValue);
|
|
120
|
-
}
|
|
121
|
-
if (anyValue.kvlistValue?.values) {
|
|
122
|
-
return parseAttributes(anyValue.kvlistValue.values);
|
|
123
|
-
}
|
|
124
|
-
return JSON.stringify(anyValue);
|
|
125
|
-
}
|
|
126
|
-
// Parse OTEL proto attributes array to a simple key-value object
|
|
127
|
-
function parseAttributes(attributes) {
|
|
128
|
-
if (!attributes)
|
|
129
|
-
return {};
|
|
130
|
-
if (!Array.isArray(attributes))
|
|
131
|
-
return attributes; // already parsed
|
|
132
|
-
const result = {};
|
|
133
|
-
for (const attr of attributes) {
|
|
134
|
-
if (attr.key && attr.value !== undefined) {
|
|
135
|
-
result[attr.key] = parseAnyValue(attr.value);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return result;
|
|
139
|
-
}
|
|
140
|
-
// Calculate timeline metrics
|
|
141
|
-
function getTimelineMetrics(spans) {
|
|
142
|
-
if (spans.length === 0)
|
|
143
|
-
return { minTime: 0, maxTime: 0, totalDuration: 0 };
|
|
144
|
-
const minTime = Math.min(...spans.map((s) => s.start_time_unix_nano));
|
|
145
|
-
const maxTime = Math.max(...spans.map((s) => s.end_time_unix_nano));
|
|
146
|
-
return { minTime, maxTime, totalDuration: maxTime - minTime };
|
|
147
|
-
}
|
|
148
|
-
let timelineMetrics = $derived(getTimelineMetrics(traces));
|
|
149
|
-
</script>
|
|
150
|
-
|
|
151
|
-
<div class="p-4">
|
|
152
|
-
{#if loading}
|
|
153
|
-
<Skeleton layout={[[4], [8], [6], [10]]} />
|
|
154
|
-
{:else if error}
|
|
155
|
-
<Alert type="error" title="Error">{error}</Alert>
|
|
156
|
-
{:else if traces.length === 0}
|
|
157
|
-
<div class="flex flex-col items-center justify-center py-8 text-secondary">
|
|
158
|
-
<Activity size={48} class="mb-4 opacity-50" />
|
|
159
|
-
<p class="text-lg font-medium">No HTTP requests captured</p>
|
|
160
|
-
<p class="text-sm mt-2">
|
|
161
|
-
This job did not make any HTTP/HTTPS requests, or HTTP Request Tracing is not enabled in instance settings.
|
|
162
|
-
</p>
|
|
163
|
-
</div>
|
|
164
|
-
{:else}
|
|
165
|
-
<div class="space-y-4">
|
|
166
|
-
<div class="flex items-center justify-between">
|
|
167
|
-
<h3 class="text-lg font-semibold">Traces ({traces.length} spans)</h3>
|
|
168
|
-
<button
|
|
169
|
-
class="text-sm text-blue-600 hover:underline"
|
|
170
|
-
onclick={loadTraces}
|
|
171
|
-
>
|
|
172
|
-
Refresh
|
|
173
|
-
</button>
|
|
174
|
-
</div>
|
|
175
|
-
|
|
176
|
-
<!-- Timeline view -->
|
|
177
|
-
<div class="border rounded-lg overflow-hidden">
|
|
178
|
-
<div class="bg-surface-secondary px-4 py-2 border-b">
|
|
179
|
-
<div class="grid grid-cols-12 gap-2 text-xs font-medium text-secondary">
|
|
180
|
-
<div class="col-span-4">Operation</div>
|
|
181
|
-
<div class="col-span-1">Status</div>
|
|
182
|
-
<div class="col-span-5">Timeline</div>
|
|
183
|
-
<div class="col-span-2 text-right">Duration</div>
|
|
184
|
-
</div>
|
|
185
|
-
</div>
|
|
186
|
-
|
|
187
|
-
<div class="divide-y">
|
|
188
|
-
{#each traces as span (span.span_id)}
|
|
189
|
-
{@const durationNs = span.end_time_unix_nano - span.start_time_unix_nano}
|
|
190
|
-
{@const startOffset =
|
|
191
|
-
((span.start_time_unix_nano - timelineMetrics.minTime) /
|
|
192
|
-
timelineMetrics.totalDuration) *
|
|
193
|
-
100}
|
|
194
|
-
{@const width = (durationNs / timelineMetrics.totalDuration) * 100}
|
|
195
|
-
{@const statusCode = span.status?.code ?? 0}
|
|
196
|
-
|
|
197
|
-
<div class="hover:bg-surface-hover">
|
|
198
|
-
<button
|
|
199
|
-
class="w-full px-4 py-2 text-left"
|
|
200
|
-
onclick={() => toggleSpan(span.span_id)}
|
|
201
|
-
>
|
|
202
|
-
<div class="grid grid-cols-12 gap-2 items-center">
|
|
203
|
-
<div class="col-span-4 flex items-center gap-2">
|
|
204
|
-
<span class="text-xs text-secondary">
|
|
205
|
-
{expandedSpans.has(span.span_id) ? '▼' : '▶'}
|
|
206
|
-
</span>
|
|
207
|
-
<span class="font-medium truncate" title={span.name}>
|
|
208
|
-
{span.name}
|
|
209
|
-
</span>
|
|
210
|
-
</div>
|
|
211
|
-
<div class="col-span-1">
|
|
212
|
-
<span class={`text-xs font-medium ${getStatusColor(statusCode)}`}>
|
|
213
|
-
{getStatusLabel(statusCode)}
|
|
214
|
-
</span>
|
|
215
|
-
</div>
|
|
216
|
-
<div class="col-span-5 relative h-4">
|
|
217
|
-
<div class="absolute inset-0 bg-surface-secondary rounded"></div>
|
|
218
|
-
<div
|
|
219
|
-
class="absolute h-full bg-blue-500 rounded opacity-75"
|
|
220
|
-
style="left: {startOffset}%; width: {Math.max(width, 0.5)}%;"
|
|
221
|
-
></div>
|
|
222
|
-
</div>
|
|
223
|
-
<div class="col-span-2 text-right text-sm font-mono">
|
|
224
|
-
{msToReadableTime(getDurationMs(span))}
|
|
225
|
-
</div>
|
|
226
|
-
</div>
|
|
227
|
-
</button>
|
|
228
|
-
|
|
229
|
-
{#if expandedSpans.has(span.span_id)}
|
|
230
|
-
{@const parsedAttrs = parseAttributes(span.attributes)}
|
|
231
|
-
<div class="px-4 pb-4 bg-surface-secondary/50">
|
|
232
|
-
<div class="grid grid-cols-2 gap-4 text-sm">
|
|
233
|
-
<div>
|
|
234
|
-
<p class="text-xs text-secondary mb-1">Trace ID</p>
|
|
235
|
-
<p class="font-mono text-xs break-all">{span.trace_id}</p>
|
|
236
|
-
</div>
|
|
237
|
-
<div>
|
|
238
|
-
<p class="text-xs text-secondary mb-1">Span ID</p>
|
|
239
|
-
<p class="font-mono text-xs">{span.span_id}</p>
|
|
240
|
-
</div>
|
|
241
|
-
{#if span.parent_span_id}
|
|
242
|
-
<div>
|
|
243
|
-
<p class="text-xs text-secondary mb-1">Parent Span ID</p>
|
|
244
|
-
<p class="font-mono text-xs">{span.parent_span_id}</p>
|
|
245
|
-
</div>
|
|
246
|
-
{/if}
|
|
247
|
-
<div>
|
|
248
|
-
<p class="text-xs text-secondary mb-1">Kind</p>
|
|
249
|
-
<p class="font-mono text-xs">{getKindLabel(span.kind)}</p>
|
|
250
|
-
</div>
|
|
251
|
-
<div>
|
|
252
|
-
<p class="text-xs text-secondary mb-1">Start Time</p>
|
|
253
|
-
<p class="font-mono text-xs">{formatTimestamp(span.start_time_unix_nano)}</p>
|
|
254
|
-
</div>
|
|
255
|
-
<div>
|
|
256
|
-
<p class="text-xs text-secondary mb-1">End Time</p>
|
|
257
|
-
<p class="font-mono text-xs">{formatTimestamp(span.end_time_unix_nano)}</p>
|
|
258
|
-
</div>
|
|
259
|
-
{#if span.status?.message}
|
|
260
|
-
<div class="col-span-2">
|
|
261
|
-
<p class="text-xs text-secondary mb-1">Status Message</p>
|
|
262
|
-
<p class="text-xs">{span.status.message}</p>
|
|
263
|
-
</div>
|
|
264
|
-
{/if}
|
|
265
|
-
{#if Object.keys(parsedAttrs).length > 0}
|
|
266
|
-
<div class="col-span-2">
|
|
267
|
-
<p class="text-xs text-secondary mb-1">Attributes</p>
|
|
268
|
-
<div class="bg-surface-secondary p-2 rounded text-xs space-y-1">
|
|
269
|
-
{#each Object.entries(parsedAttrs) as [key, value]}
|
|
270
|
-
<div class="flex gap-2">
|
|
271
|
-
<span class="text-secondary font-medium shrink-0">{key}:</span>
|
|
272
|
-
<span class="font-mono break-all">{typeof value === 'object' ? JSON.stringify(value) : value}</span>
|
|
273
|
-
</div>
|
|
274
|
-
{/each}
|
|
275
|
-
</div>
|
|
276
|
-
</div>
|
|
277
|
-
{/if}
|
|
278
|
-
</div>
|
|
279
|
-
</div>
|
|
280
|
-
{/if}
|
|
281
|
-
</div>
|
|
282
|
-
{/each}
|
|
283
|
-
</div>
|
|
284
|
-
</div>
|
|
285
|
-
</div>
|
|
286
|
-
{/if}
|
|
287
|
-
</div>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { DbType } from '../../../../../dbTypes';
|
|
2
|
-
import { type TableEditorForeignKey, type TableEditorValues, type TableEditorValuesColumn } from '../tableEditor';
|
|
3
|
-
export type AlterTableValues = {
|
|
4
|
-
name: string;
|
|
5
|
-
operations: AlterTableOperation[];
|
|
6
|
-
};
|
|
7
|
-
type AddColumnOperation = {
|
|
8
|
-
kind: 'addColumn';
|
|
9
|
-
column: TableEditorValuesColumn;
|
|
10
|
-
};
|
|
11
|
-
type DropColumnOperation = {
|
|
12
|
-
kind: 'dropColumn';
|
|
13
|
-
name: string;
|
|
14
|
-
};
|
|
15
|
-
export type AlterColumnOperation = {
|
|
16
|
-
kind: 'alterColumn';
|
|
17
|
-
original: TableEditorValuesColumn;
|
|
18
|
-
defaultConstraintName?: string;
|
|
19
|
-
changes: Partial<Omit<TableEditorValuesColumn, 'initialName'>>;
|
|
20
|
-
};
|
|
21
|
-
type AddForeignKeyOperation = {
|
|
22
|
-
kind: 'addForeignKey';
|
|
23
|
-
foreignKey: TableEditorForeignKey;
|
|
24
|
-
};
|
|
25
|
-
type DropForeignKeyOperation = {
|
|
26
|
-
kind: 'dropForeignKey';
|
|
27
|
-
fk_constraint_name: string;
|
|
28
|
-
};
|
|
29
|
-
type RenameTableOperation = {
|
|
30
|
-
kind: 'renameTable';
|
|
31
|
-
to: string;
|
|
32
|
-
};
|
|
33
|
-
type AddPrimaryKeyOperation = {
|
|
34
|
-
kind: 'addPrimaryKey';
|
|
35
|
-
columns: string[];
|
|
36
|
-
};
|
|
37
|
-
type DropPrimaryKeyOperation = {
|
|
38
|
-
kind: 'dropPrimaryKey';
|
|
39
|
-
pk_constraint_name?: string;
|
|
40
|
-
};
|
|
41
|
-
export type AlterTableOperation = AddColumnOperation | DropColumnOperation | AlterColumnOperation | AddForeignKeyOperation | DropForeignKeyOperation | RenameTableOperation | AddPrimaryKeyOperation | DropPrimaryKeyOperation;
|
|
42
|
-
export declare function makeAlterTableQuery(values: AlterTableValues, dbType: DbType, schema?: string): string;
|
|
43
|
-
export declare function makeAlterTableQueries(values: AlterTableValues, dbType: DbType, schema?: string): string[];
|
|
44
|
-
export declare function diffTableEditorValues(original: TableEditorValues, updated: TableEditorValues): AlterTableValues;
|
|
45
|
-
export declare function dbSupportsTransactionalDdl(dbType: DbType): boolean;
|
|
46
|
-
export {};
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
import { deepEqual } from 'fast-equals';
|
|
2
|
-
import { datatypeHasLength, dbSupportsSchemas, renderDbQuotedIdentifier } from '../utils';
|
|
3
|
-
import {} from '../tableEditor';
|
|
4
|
-
import { formatDefaultValue, renderColumn, renderForeignKey } from './dbQueriesUtils';
|
|
5
|
-
import { clone } from '../../../../../../utils';
|
|
6
|
-
export function makeAlterTableQuery(values, dbType, schema) {
|
|
7
|
-
let queries = makeAlterTableQueries(values, dbType, schema);
|
|
8
|
-
if (queries.length === 0)
|
|
9
|
-
return '';
|
|
10
|
-
let queriesStr = queries.join('\n');
|
|
11
|
-
if (dbSupportsTransactionalDdl(dbType)) {
|
|
12
|
-
if (dbType === 'ms_sql_server')
|
|
13
|
-
return 'BEGIN TRANSACTION;\n' + queriesStr + '\nCOMMIT TRANSACTION;';
|
|
14
|
-
return 'BEGIN;\n' + queriesStr + '\nCOMMIT;';
|
|
15
|
-
}
|
|
16
|
-
return queriesStr;
|
|
17
|
-
}
|
|
18
|
-
export function makeAlterTableQueries(values, dbType, schema) {
|
|
19
|
-
const useSchema = dbSupportsSchemas(dbType);
|
|
20
|
-
const tableRef = useSchema && schema ? `${schema.trim()}.${values.name}` : values.name;
|
|
21
|
-
const queries = [];
|
|
22
|
-
for (const op of values.operations) {
|
|
23
|
-
switch (op.kind) {
|
|
24
|
-
case 'addColumn':
|
|
25
|
-
queries.push(`ALTER TABLE ${tableRef} ADD COLUMN ${renderColumn(op.column, dbType)};`);
|
|
26
|
-
break;
|
|
27
|
-
case 'dropColumn':
|
|
28
|
-
queries.push(`ALTER TABLE ${tableRef} DROP COLUMN ${renderDbQuotedIdentifier(op.name, dbType)};`);
|
|
29
|
-
break;
|
|
30
|
-
case 'alterColumn':
|
|
31
|
-
queries.push(...renderAlterColumn(tableRef, op, dbType));
|
|
32
|
-
break;
|
|
33
|
-
case 'addForeignKey':
|
|
34
|
-
queries.push(`ALTER TABLE ${tableRef} ADD ${renderForeignKey(op.foreignKey, {
|
|
35
|
-
useSchema,
|
|
36
|
-
dbType,
|
|
37
|
-
tableName: values.name
|
|
38
|
-
})};`);
|
|
39
|
-
break;
|
|
40
|
-
case 'dropForeignKey':
|
|
41
|
-
queries.push(renderDropForeignKey(tableRef, op.fk_constraint_name, dbType));
|
|
42
|
-
break;
|
|
43
|
-
case 'renameTable':
|
|
44
|
-
queries.push(`ALTER TABLE ${tableRef} RENAME TO ${op.to};`);
|
|
45
|
-
break;
|
|
46
|
-
case 'addPrimaryKey':
|
|
47
|
-
const notEnforced = dbType === 'bigquery' ? ' NOT ENFORCED' : '';
|
|
48
|
-
queries.push(`ALTER TABLE ${tableRef} ADD PRIMARY KEY (${op.columns.join(', ')})${notEnforced};`);
|
|
49
|
-
break;
|
|
50
|
-
case 'dropPrimaryKey':
|
|
51
|
-
queries.push(renderDropPrimaryKey(tableRef, dbType, op.pk_constraint_name));
|
|
52
|
-
break;
|
|
53
|
-
default:
|
|
54
|
-
throw new Error('Unimplemented case');
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return queries;
|
|
58
|
-
}
|
|
59
|
-
function renderAlterColumn(tableRef, op, dbType) {
|
|
60
|
-
const queries = [];
|
|
61
|
-
const { changes, original } = op;
|
|
62
|
-
const baseDatatype = changes.datatype ?? original.datatype;
|
|
63
|
-
const datatypeLength = datatypeHasLength(baseDatatype)
|
|
64
|
-
? (changes.datatype_length ?? original.datatype_length)
|
|
65
|
-
: undefined;
|
|
66
|
-
const datatype = datatypeLength ? `${baseDatatype}(${datatypeLength})` : baseDatatype;
|
|
67
|
-
if (changes.datatype || changes.datatype_length) {
|
|
68
|
-
queries.push(renderAlterDatatype(tableRef, original.name, datatype, dbType));
|
|
69
|
-
}
|
|
70
|
-
if ('defaultValue' in changes) {
|
|
71
|
-
if (changes.defaultValue === undefined && original.defaultValue) {
|
|
72
|
-
queries.push(renderDropDefaultValue(tableRef, original.name, datatype, dbType, op.defaultConstraintName));
|
|
73
|
-
}
|
|
74
|
-
else if (changes.defaultValue !== undefined) {
|
|
75
|
-
const def = formatDefaultValue(changes.defaultValue, original.datatype ?? '', dbType);
|
|
76
|
-
queries.push(renderAddDefaultValue(tableRef, original.name, def, dbType));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (typeof changes.nullable === 'boolean') {
|
|
80
|
-
queries.push(renderAlterNullable(tableRef, original.name, changes.nullable, datatype, dbType));
|
|
81
|
-
}
|
|
82
|
-
if (changes.name) {
|
|
83
|
-
queries.push(renderRenameColumn(tableRef, original.name, changes.name, dbType));
|
|
84
|
-
}
|
|
85
|
-
return queries;
|
|
86
|
-
}
|
|
87
|
-
function renderAlterDatatype(tableRef, columnName, datatype, dbType) {
|
|
88
|
-
switch (dbType) {
|
|
89
|
-
case 'postgresql':
|
|
90
|
-
case 'duckdb':
|
|
91
|
-
return `ALTER TABLE ${tableRef} ALTER COLUMN ${columnName} TYPE ${datatype};`;
|
|
92
|
-
case 'ms_sql_server':
|
|
93
|
-
return `ALTER TABLE ${tableRef} ALTER COLUMN ${columnName} ${datatype};`;
|
|
94
|
-
case 'mysql':
|
|
95
|
-
return `ALTER TABLE ${tableRef} MODIFY COLUMN ${columnName} ${datatype};`;
|
|
96
|
-
case 'snowflake':
|
|
97
|
-
case 'bigquery':
|
|
98
|
-
return `ALTER TABLE ${tableRef} ALTER COLUMN ${columnName} SET DATA TYPE ${datatype};`;
|
|
99
|
-
default:
|
|
100
|
-
throw new Error(`Unsupported database type: ${dbType}`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function renderDropDefaultValue(tableRef, columnName, datatype, dbType, defaultConstraintName) {
|
|
104
|
-
switch (dbType) {
|
|
105
|
-
case 'postgresql':
|
|
106
|
-
case 'duckdb':
|
|
107
|
-
case 'mysql':
|
|
108
|
-
case 'snowflake':
|
|
109
|
-
case 'bigquery':
|
|
110
|
-
return `ALTER TABLE ${tableRef} ALTER COLUMN ${columnName} DROP DEFAULT;`;
|
|
111
|
-
case 'ms_sql_server':
|
|
112
|
-
return `ALTER TABLE ${tableRef} DROP CONSTRAINT ${defaultConstraintName};`;
|
|
113
|
-
default:
|
|
114
|
-
throw new Error(`Unsupported database type: ${dbType}`);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
function renderAddDefaultValue(tableRef, columnName, defaultValue, dbType) {
|
|
118
|
-
switch (dbType) {
|
|
119
|
-
case 'postgresql':
|
|
120
|
-
case 'duckdb':
|
|
121
|
-
case 'mysql':
|
|
122
|
-
case 'snowflake':
|
|
123
|
-
case 'bigquery':
|
|
124
|
-
return `ALTER TABLE ${tableRef} ALTER COLUMN ${columnName} SET DEFAULT ${defaultValue};`;
|
|
125
|
-
case 'ms_sql_server':
|
|
126
|
-
// MS SQL uses constraints for defaults
|
|
127
|
-
return `ALTER TABLE ${tableRef} ADD CONSTRAINT DF_${tableRef.replace('.', '_')}_${columnName} DEFAULT ${defaultValue} FOR ${columnName};`;
|
|
128
|
-
default:
|
|
129
|
-
throw new Error(`Unsupported database type: ${dbType}`);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
function renderAlterNullable(tableRef, columnName, nullable, datatype, dbType) {
|
|
133
|
-
switch (dbType) {
|
|
134
|
-
case 'postgresql':
|
|
135
|
-
case 'duckdb':
|
|
136
|
-
case 'snowflake':
|
|
137
|
-
case 'bigquery':
|
|
138
|
-
return `ALTER TABLE ${tableRef} ALTER COLUMN ${columnName} ${nullable ? 'DROP' : 'SET'} NOT NULL;`;
|
|
139
|
-
case 'ms_sql_server':
|
|
140
|
-
// MS SQL requires specifying the datatype when altering nullability
|
|
141
|
-
return `ALTER TABLE ${tableRef} ALTER COLUMN ${columnName} ${datatype} ${nullable ? 'NULL' : 'NOT NULL'};`;
|
|
142
|
-
case 'mysql':
|
|
143
|
-
return `ALTER TABLE ${tableRef} MODIFY COLUMN ${columnName} ${datatype} ${nullable ? 'NULL' : 'NOT NULL'};`;
|
|
144
|
-
default:
|
|
145
|
-
throw new Error(`Unsupported database type: ${dbType}`);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function renderRenameColumn(tableRef, oldName, newName, dbType) {
|
|
149
|
-
switch (dbType) {
|
|
150
|
-
case 'postgresql':
|
|
151
|
-
case 'duckdb':
|
|
152
|
-
case 'snowflake':
|
|
153
|
-
case 'bigquery':
|
|
154
|
-
case 'mysql':
|
|
155
|
-
return `ALTER TABLE ${tableRef} RENAME COLUMN ${oldName} TO ${newName};`;
|
|
156
|
-
case 'ms_sql_server':
|
|
157
|
-
return `EXEC sp_rename '${tableRef}.${oldName}', '${newName}', 'COLUMN';`;
|
|
158
|
-
default:
|
|
159
|
-
throw new Error(`Unsupported database type: ${dbType}`);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
function renderDropForeignKey(tableRef, fk_constraint_name, dbType) {
|
|
163
|
-
if (dbType === 'mysql')
|
|
164
|
-
return `ALTER TABLE ${tableRef} DROP FOREIGN KEY ${renderDbQuotedIdentifier(fk_constraint_name, dbType)};`;
|
|
165
|
-
return `ALTER TABLE ${tableRef} DROP CONSTRAINT ${fk_constraint_name};`;
|
|
166
|
-
}
|
|
167
|
-
function renderDropPrimaryKey(tableRef, dbType, pk_constraint_name) {
|
|
168
|
-
if (dbType === 'mysql' || !pk_constraint_name)
|
|
169
|
-
return `ALTER TABLE ${tableRef} DROP PRIMARY KEY;`;
|
|
170
|
-
return `ALTER TABLE ${tableRef} DROP CONSTRAINT ${renderDbQuotedIdentifier(pk_constraint_name, dbType)};`;
|
|
171
|
-
}
|
|
172
|
-
export function diffTableEditorValues(original, updated) {
|
|
173
|
-
const operations = [];
|
|
174
|
-
// Check for dropped columns
|
|
175
|
-
for (const originalCol of original.columns) {
|
|
176
|
-
const stillExists = updated.columns.some((upd) => upd.initialName === originalCol.name);
|
|
177
|
-
if (!stillExists) {
|
|
178
|
-
operations.push({ kind: 'dropColumn', name: originalCol.name });
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
// Check for added or modified columns
|
|
182
|
-
for (const updatedCol of updated.columns) {
|
|
183
|
-
const originalCol = updatedCol.initialName
|
|
184
|
-
? original.columns.find((og) => og.name === updatedCol.initialName)
|
|
185
|
-
: undefined;
|
|
186
|
-
if (!originalCol) {
|
|
187
|
-
// New column
|
|
188
|
-
operations.push({ kind: 'addColumn', column: updatedCol });
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
// Existing column - check for modifications
|
|
192
|
-
const changes = {};
|
|
193
|
-
if (originalCol.datatype !== updatedCol.datatype ||
|
|
194
|
-
originalCol.datatype_length != updatedCol.datatype_length) {
|
|
195
|
-
changes.datatype = updatedCol.datatype;
|
|
196
|
-
changes.datatype_length = updatedCol.datatype_length;
|
|
197
|
-
}
|
|
198
|
-
if (originalCol.defaultValue !== updatedCol.defaultValue) {
|
|
199
|
-
changes.defaultValue = updatedCol.defaultValue;
|
|
200
|
-
}
|
|
201
|
-
if (originalCol.nullable !== updatedCol.nullable) {
|
|
202
|
-
changes.nullable = updatedCol.nullable;
|
|
203
|
-
}
|
|
204
|
-
if (originalCol.name !== updatedCol.name) {
|
|
205
|
-
changes.name = updatedCol.name;
|
|
206
|
-
}
|
|
207
|
-
if (Object.keys(changes).length > 0) {
|
|
208
|
-
operations.push({
|
|
209
|
-
kind: 'alterColumn',
|
|
210
|
-
changes,
|
|
211
|
-
original: originalCol,
|
|
212
|
-
defaultConstraintName: originalCol.default_constraint_name
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
// Check for renamed table.
|
|
218
|
-
if (original.name !== updated.name) {
|
|
219
|
-
operations.push({ kind: 'renameTable', to: updated.name });
|
|
220
|
-
}
|
|
221
|
-
// Check for foreign key changes
|
|
222
|
-
const originalForeignKeys = original.foreignKeys ?? [];
|
|
223
|
-
const updatedForeignKeys = updated.foreignKeys ?? [];
|
|
224
|
-
// Check for dropped foreign keys
|
|
225
|
-
for (let i = 0; i < originalForeignKeys.length; i++) {
|
|
226
|
-
const originalFk = originalForeignKeys[i];
|
|
227
|
-
const stillExists = updatedForeignKeys.some((updFk) => fkEqual(originalFk, normalizeNewFkToOldColNames(updFk, updated)));
|
|
228
|
-
const fk_constraint_name = originalFk.fk_constraint_name;
|
|
229
|
-
if (!fk_constraint_name) {
|
|
230
|
-
throw new Error('Original foreign key missing constraint name : ' + JSON.stringify(originalFk));
|
|
231
|
-
}
|
|
232
|
-
if (!stillExists) {
|
|
233
|
-
operations.push({ kind: 'dropForeignKey', fk_constraint_name });
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
// Check for added foreign keys
|
|
237
|
-
for (const updatedFk of updatedForeignKeys) {
|
|
238
|
-
const isNew = !originalForeignKeys.some((origFk) => fkEqual(origFk, normalizeNewFkToOldColNames(updatedFk, updated)));
|
|
239
|
-
if (isNew) {
|
|
240
|
-
operations.push({ kind: 'addForeignKey', foreignKey: updatedFk });
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
// Check for primary key changes
|
|
244
|
-
const originalPkColumns = original.columns.filter((c) => c.primaryKey).map((c) => c.name);
|
|
245
|
-
const updatedPkColumns = updated.columns.filter((c) => c.primaryKey);
|
|
246
|
-
const pkChanged = originalPkColumns.length !== updatedPkColumns.length ||
|
|
247
|
-
!originalPkColumns.every((col) => updatedPkColumns.map((c) => c.initialName).includes(col));
|
|
248
|
-
if (pkChanged) {
|
|
249
|
-
// Drop old primary key if it exists
|
|
250
|
-
if (originalPkColumns.length > 0) {
|
|
251
|
-
operations.push({ kind: 'dropPrimaryKey', pk_constraint_name: original.pk_constraint_name });
|
|
252
|
-
}
|
|
253
|
-
// Add new primary key if columns are specified
|
|
254
|
-
if (updatedPkColumns.length > 0) {
|
|
255
|
-
operations.push({ kind: 'addPrimaryKey', columns: updatedPkColumns.map((c) => c.name) });
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
// Sort operations to avoid dependency issues
|
|
259
|
-
const sortedOperations = sortOperations(operations);
|
|
260
|
-
return {
|
|
261
|
-
name: original.name,
|
|
262
|
-
operations: sortedOperations
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Sort operations to avoid dependency issues.
|
|
267
|
-
*
|
|
268
|
-
* Order of operations:
|
|
269
|
-
* 1. Drop foreign keys (must come first as they depend on columns)
|
|
270
|
-
* 2. Drop primary keys (must come before dropping columns that are part of PK)
|
|
271
|
-
* 3. Drop columns
|
|
272
|
-
* 4. Alter columns (modify existing columns)
|
|
273
|
-
* 5. Add columns (new columns must exist before adding FKs/PKs to them)
|
|
274
|
-
* 6. Add primary keys (must come after columns exist)
|
|
275
|
-
* 7. Add foreign keys (must come last as they depend on columns existing)
|
|
276
|
-
* 8. Rename table (should be last to avoid confusion with table references)
|
|
277
|
-
*/
|
|
278
|
-
function sortOperations(operations) {
|
|
279
|
-
const operationPriority = {
|
|
280
|
-
dropForeignKey: 1,
|
|
281
|
-
dropPrimaryKey: 2,
|
|
282
|
-
dropColumn: 3,
|
|
283
|
-
alterColumn: 4,
|
|
284
|
-
addColumn: 5,
|
|
285
|
-
addPrimaryKey: 6,
|
|
286
|
-
addForeignKey: 7,
|
|
287
|
-
renameTable: 8
|
|
288
|
-
};
|
|
289
|
-
return [...operations].sort((a, b) => {
|
|
290
|
-
return operationPriority[a.kind] - operationPriority[b.kind];
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
function fkEqual(fk1, fk2) {
|
|
294
|
-
return (deepEqual(fk1.columns, fk2.columns) &&
|
|
295
|
-
fk1.onDelete === fk2.onDelete &&
|
|
296
|
-
fk1.onUpdate === fk2.onUpdate &&
|
|
297
|
-
fk1.targetTable === fk2.targetTable);
|
|
298
|
-
}
|
|
299
|
-
// Avoid detecting fk change if we just renamed the source columns
|
|
300
|
-
function normalizeNewFkToOldColNames(fk, updated) {
|
|
301
|
-
let fkCopy = clone(fk);
|
|
302
|
-
for (let col of fkCopy.columns) {
|
|
303
|
-
let col2 = updated.columns.find((c) => c.name === col.sourceColumn);
|
|
304
|
-
col.sourceColumn = col2 ? col2.initialName : col.sourceColumn;
|
|
305
|
-
}
|
|
306
|
-
return fkCopy;
|
|
307
|
-
}
|
|
308
|
-
export function dbSupportsTransactionalDdl(dbType) {
|
|
309
|
-
return dbType === 'postgresql' || dbType === 'ms_sql_server';
|
|
310
|
-
// Commented out temporarily because Ducklake transactional DDL sometimes put the
|
|
311
|
-
// ducklake in an unusable state.
|
|
312
|
-
// See : https://github.com/duckdb/ducklake/issues/683
|
|
313
|
-
// || dbType === 'duckdb'
|
|
314
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|