windmill-components 1.511.0 → 1.522.0
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/components/AppConnectInner.svelte.d.ts +1 -1
- package/package/components/ArgInput.svelte +56 -18
- package/package/components/ArgInput.svelte.d.ts +2 -10
- package/package/components/AssignableTagsInner.svelte +5 -0
- package/package/components/AuthSettings.svelte +4 -2
- package/package/components/AuthSettings.svelte.d.ts +1 -0
- package/package/components/DBManagerDrawer.svelte +154 -151
- package/package/components/DBManagerDrawer.svelte.d.ts +2 -2
- package/package/components/DBTable.svelte +3 -3
- package/package/components/DBTable.svelte.d.ts +1 -0
- package/package/components/DBTableEditor.svelte +7 -7
- package/package/components/DBTableEditor.svelte.d.ts +1 -1
- package/package/components/DeployWorkspace.svelte +1 -1
- package/package/components/DisplayResult.svelte +34 -8
- package/package/components/DisplayResult.svelte.d.ts +4 -1
- package/package/components/DynSelect.svelte +58 -34
- package/package/components/DynSelect.svelte.d.ts +3 -11
- package/package/components/EditableSchemaForm.svelte +126 -6
- package/package/components/EditableSchemaForm.svelte.d.ts +5 -1
- package/package/components/Editor.svelte +1 -1
- package/package/components/EditorBar.svelte +82 -4
- package/package/components/ErrorOrRecoveryHandler.svelte +76 -8
- package/package/components/ErrorOrRecoveryHandler.svelte.d.ts +2 -1
- package/package/components/ExploreAssetButton.svelte +14 -4
- package/package/components/ExploreAssetButton.svelte.d.ts +1 -0
- package/package/components/FlowJobResult.svelte +3 -3
- package/package/components/FlowJobResult.svelte.d.ts +1 -0
- package/package/components/FlowPreviewContent.svelte +9 -0
- package/package/components/FlowPreviewContent.svelte.d.ts +3 -0
- package/package/components/FlowPreviewResult.svelte +4 -1
- package/package/components/FlowPreviewResult.svelte.d.ts +1 -0
- package/package/components/FlowStatusViewer.svelte +2 -1
- package/package/components/FlowStatusViewer.svelte.d.ts +3 -0
- package/package/components/FlowStatusViewerInner.svelte +23 -3
- package/package/components/FlowStatusViewerInner.svelte.d.ts +10 -1
- package/package/components/FolderEditor.svelte +1 -1
- package/package/components/GitDiffPreview.svelte +14 -18
- package/package/components/GitDiffPreview.svelte.d.ts +2 -8
- package/package/components/GitHubAppIntegration.svelte +3 -1
- package/package/components/IdEditorInput.svelte +25 -22
- package/package/components/IdEditorInput.svelte.d.ts +11 -23
- package/package/components/InstanceSetting.svelte +7 -2
- package/package/components/InstanceSettings.svelte +1 -0
- package/package/components/JobLoader.svelte +48 -5
- package/package/components/JobLoader.svelte.d.ts +7 -2
- package/package/components/Login.svelte +8 -2
- package/package/components/MemoryFootprintViewer.svelte +1 -1
- package/package/components/ModulePreviewResultViewer.svelte +2 -2
- package/package/components/MoveDrawer.svelte.d.ts +2 -2
- package/package/components/NextcloudSetting.svelte +84 -0
- package/package/components/NextcloudSetting.svelte.d.ts +7 -0
- package/package/components/ObjectResourceInput.svelte +3 -2
- package/package/components/ObjectResourceInput.svelte.d.ts +1 -0
- package/package/components/ParqetCsvTableRenderer.svelte +1 -1
- package/package/components/ResourceEditor.svelte +1 -1
- package/package/components/ResourcePicker.svelte +8 -1
- package/package/components/ResourcePicker.svelte.d.ts +1 -0
- package/package/components/ResultStreamDisplay.svelte +5 -0
- package/package/components/ResultStreamDisplay.svelte.d.ts +5 -0
- package/package/components/RunForm.svelte +9 -1
- package/package/components/SchemaForm.svelte +2 -2
- package/package/components/SchemaForm.svelte.d.ts +2 -10
- package/package/components/ScriptBuilder.svelte +13 -8
- package/package/components/ScriptBuilder.svelte.d.ts +1 -1
- package/package/components/ScriptEditor.svelte.d.ts +1 -1
- package/package/components/ScriptWrapper.svelte +1 -1
- package/package/components/ShareModal.svelte.d.ts +1 -1
- package/package/components/SimpleAgTable.svelte +2 -0
- package/package/components/SimpleAgTable.svelte.d.ts +2 -0
- package/package/components/SqlRepl.svelte +21 -7
- package/package/components/SqlRepl.svelte.d.ts +2 -2
- package/package/components/StringTypeNarrowing.svelte.d.ts +1 -1
- package/package/components/WorkerTagSelect.svelte +70 -1
- package/package/components/apps/components/display/AppDisplayComponent.svelte +13 -1
- package/package/components/apps/components/display/AppText.svelte +2 -2
- package/package/components/apps/components/display/dbtable/AppDbExplorer.svelte +8 -1
- package/package/components/apps/components/display/dbtable/InsertRow.svelte +5 -4
- package/package/components/apps/components/display/dbtable/queries/count.js +11 -1
- package/package/components/apps/components/display/dbtable/queries/createTable.d.ts +1 -1
- package/package/components/apps/components/display/dbtable/queries/createTable.js +3 -3
- package/package/components/apps/components/display/dbtable/queries/delete.js +7 -0
- package/package/components/apps/components/display/dbtable/queries/insert.js +2 -0
- package/package/components/apps/components/display/dbtable/queries/select.js +14 -0
- package/package/components/apps/components/display/dbtable/queries/update.js +7 -0
- package/package/components/apps/components/display/dbtable/utils.d.ts +6 -5
- package/package/components/apps/components/display/dbtable/utils.js +52 -28
- package/package/components/apps/components/display/table/AppAggridExplorerTable.svelte +1 -1
- package/package/components/apps/components/display/table/AppAggridInfiniteTable.svelte +1 -0
- package/package/components/apps/components/display/table/AppAggridInfiniteTable.svelte.d.ts +1 -0
- package/package/components/apps/components/display/table/AppAggridTable.svelte +5 -4
- package/package/components/apps/components/display/table/AppAggridTable.svelte.d.ts +1 -0
- package/package/components/apps/components/display/table/utils.js +7 -4
- package/package/components/apps/components/helpers/HiddenComponent.svelte +2 -2
- package/package/components/apps/components/helpers/RunnableComponent.svelte +4 -1
- package/package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +2 -1
- package/package/components/apps/components/inputs/AppS3FileInput.svelte +2 -2
- package/package/components/apps/components/layout/AppDecisionTree.svelte +1 -1
- package/package/components/apps/components/layout/AppStepper.svelte +1 -1
- package/package/components/apps/components/layout/AppTabs.svelte +1 -1
- package/package/components/apps/editor/AppEditorHeader.svelte +13 -2
- package/package/components/apps/editor/GridViewer.svelte +1 -0
- package/package/components/apps/editor/RunnableJobPanelInner.svelte +2 -1
- package/package/components/apps/editor/contextPanel/components/IdEditor.svelte +7 -7
- package/package/components/apps/editor/contextPanel/components/IdEditor.svelte.d.ts +7 -19
- package/package/components/apps/editor/contextPanel/components/OutputHeader.svelte +8 -12
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte.d.ts +1 -1
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte.d.ts +1 -1
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptRunnableByPath.svelte.d.ts +1 -1
- package/package/components/apps/editor/settingsPanel/DecisionTreeGraphEditor.svelte +3 -3
- package/package/components/apps/editor/settingsPanel/decisionTree/DecisionTreePreview.svelte +1 -3
- package/package/components/assets/AssetsDropdownButton.svelte +1 -1
- package/package/components/assets/JobAssetsViewer.svelte +2 -2
- package/package/components/assets/lib.js +4 -0
- package/package/components/auditLogs/AuditLogsFilters.svelte +7 -9
- package/package/components/common/button/Button.svelte +4 -3
- package/package/components/common/button/Button.svelte.d.ts +1 -0
- package/package/components/common/confirmationModal/ConfirmationModal.svelte +6 -5
- package/package/components/common/confirmationModal/ConfirmationModal.svelte.d.ts +6 -11
- package/package/components/common/confirmationModal/asyncConfirmationModal.svelte.d.ts +26 -0
- package/package/components/common/confirmationModal/asyncConfirmationModal.svelte.js +50 -0
- package/package/components/common/modal/Modal.svelte +2 -5
- package/package/components/common/tabs/TabsV2.svelte +2 -1
- package/package/components/common/tabs/TabsV2.svelte.d.ts +1 -0
- package/package/components/copilot/chat/AIChatManager.svelte.js +61 -7
- package/package/components/copilot/chat/ContextTextarea.svelte +1 -1
- package/package/components/copilot/chat/script/core.js +28 -29
- package/package/components/copilot/chat/shared.d.ts +1 -1
- package/package/components/copilot/chat/shared.js +8 -2
- package/package/components/custom_ui.d.ts +3 -0
- package/package/components/dbOps.d.ts +20 -8
- package/package/components/dbOps.js +85 -40
- package/package/components/details/DetailPageHeader.svelte +0 -2
- package/package/components/flows/content/FlowInput.svelte +5 -0
- package/package/components/flows/content/FlowModuleComponent.svelte +1 -0
- package/package/components/flows/content/FlowModuleScript.svelte +0 -1
- package/package/components/flows/idUtils.js +2 -1
- package/package/components/flows/map/FlowModuleSchemaItem.svelte +3 -3
- package/package/components/flows/map/FlowModuleSchemaMap.svelte +5 -0
- package/package/components/flows/map/InsertModuleButton.svelte +4 -1
- package/package/components/flows/propPicker/OutputBadge.svelte +5 -1
- package/package/components/flows/propPicker/OutputPickerInner.svelte +9 -5
- package/package/components/flows/propPicker/OutputPickerInner.svelte.d.ts +6 -2
- package/package/components/flows/propPicker/StepHistory.svelte +4 -1
- package/package/components/git_sync/DetectionFlow.svelte +202 -0
- package/package/components/git_sync/DetectionFlow.svelte.d.ts +6 -0
- package/package/components/git_sync/GitSyncContext.svelte.d.ts +82 -0
- package/package/components/git_sync/GitSyncContext.svelte.js +461 -0
- package/package/components/git_sync/GitSyncModalManager.svelte +99 -0
- package/package/components/git_sync/GitSyncModalManager.svelte.d.ts +18 -0
- package/package/components/git_sync/GitSyncRepositoryCard.svelte +339 -0
- package/package/components/git_sync/GitSyncRepositoryCard.svelte.d.ts +6 -0
- package/package/components/git_sync/GitSyncRepositoryList.svelte +17 -0
- package/package/components/git_sync/GitSyncRepositoryList.svelte.d.ts +18 -0
- package/package/components/git_sync/GitSyncSection.svelte +89 -0
- package/package/components/git_sync/GitSyncSection.svelte.d.ts +3 -0
- package/package/components/git_sync/GitSyncSuccessModal.svelte +58 -0
- package/package/components/git_sync/GitSyncSuccessModal.svelte.d.ts +7 -0
- package/package/components/git_sync/PullWorkspaceModal.svelte +575 -0
- package/package/components/git_sync/PullWorkspaceModal.svelte.d.ts +15 -0
- package/package/components/git_sync/PushWorkspaceModal.svelte +320 -0
- package/package/components/git_sync/PushWorkspaceModal.svelte.d.ts +12 -0
- package/package/components/graph/FlowGraphV2.svelte +5 -1
- package/package/components/graph/graphBuilder.svelte.js +1 -1
- package/package/components/graph/renderers/nodes/AssetNode.svelte +4 -4
- package/package/components/icons/AssetDucklakeIcon.svelte +28 -0
- package/package/components/icons/AssetDucklakeIcon.svelte.d.ts +9 -0
- package/package/components/icons/AssetGenericIcon.svelte +3 -0
- package/package/components/icons/DucklakeIcon.svelte +18 -0
- package/package/components/icons/DucklakeIcon.svelte.d.ts +6 -0
- package/package/components/instanceSettings.js +11 -3
- package/package/components/runs/JobPreview.svelte +2 -2
- package/package/components/runs/NoWorkerWithTagWarning.svelte +3 -3
- package/package/components/runs/RunsFilter.svelte.d.ts +1 -1
- package/package/components/schema/FlowPropertyEditor.svelte +3 -2
- package/package/components/schema/FlowPropertyEditor.svelte.d.ts +1 -1
- package/package/components/schema/PropertyEditor.svelte +0 -2
- package/package/components/schema/PropertyEditor.svelte.d.ts +1 -1
- package/package/components/schema/SchemaFormDND.svelte +2 -1
- package/package/components/schema/SchemaFormDND.svelte.d.ts +2 -0
- package/package/components/scriptEditor/LogPanel.svelte +5 -3
- package/package/components/scriptEditor/LogPanel.svelte.d.ts +5 -1
- package/package/components/select/Select.svelte +7 -4
- package/package/components/select/Select.svelte.d.ts +5 -0
- package/package/components/select/SelectDropdown.svelte +2 -1
- package/package/components/select/SelectDropdown.svelte.d.ts +3 -0
- package/package/components/sidebar/changelogs.js +5 -0
- package/package/components/table/AutoDataTable.svelte +6 -4
- package/package/components/table/AutoDataTable.svelte.d.ts +1 -0
- package/package/components/table/DataTable.svelte +12 -10
- package/package/components/table/DataTable.svelte.d.ts +1 -0
- package/package/components/triggers/TriggerRetriesAndErrorHandler.svelte.d.ts +2 -2
- package/package/components/triggers/gcp/GcpTriggerEditorConfigSection.svelte +1 -1
- package/package/components/triggers/gcp/GcpTriggerEditorConfigSection.svelte.d.ts +2 -1
- package/package/components/triggers/gcp/GcpTriggerEditorInner.svelte +50 -11
- package/package/components/triggers/gcp/utils.js +1 -0
- package/package/components/triggers/http/utils.js +1 -1
- package/package/components/triggers/kafka/utils.js +1 -1
- package/package/components/triggers/mqtt/utils.js +1 -1
- package/package/components/triggers/nats/utils.js +1 -1
- package/package/components/triggers/postgres/utils.js +1 -1
- package/package/components/triggers/sqs/utils.js +1 -1
- package/package/components/triggers/utils.js +2 -1
- package/package/components/triggers/webhook/WebhooksConfigSection.svelte +24 -26
- package/package/components/triggers/webhook/WebhooksPanel.svelte +1 -15
- package/package/components/triggers/websocket/utils.js +1 -1
- package/package/components/workspaceSettings/AISettings.svelte +52 -36
- package/package/components/workspaceSettings/DucklakeSettings.svelte +321 -0
- package/package/components/workspaceSettings/DucklakeSettings.svelte.d.ts +23 -0
- package/package/components/workspaceSettings/GitSyncFilterSettings.svelte +122 -499
- package/package/components/workspaceSettings/GitSyncFilterSettings.svelte.d.ts +8 -10
- package/package/consts.js +2 -1
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/schemas.gen.d.ts +33 -24
- package/package/gen/schemas.gen.js +36 -27
- package/package/gen/services.gen.d.ts +19 -1
- package/package/gen/services.gen.js +38 -0
- package/package/gen/types.gen.d.ts +103 -9
- package/package/git-sync.d.ts +36 -0
- package/package/git-sync.js +1 -0
- package/package/hub.d.ts +1 -0
- package/package/hubPaths.json +5 -2
- package/package/infer.js +3 -2
- package/package/script_helpers.d.ts +2 -2
- package/package/script_helpers.js +29 -11
- package/package/services/JobManager.d.ts +28 -0
- package/package/services/JobManager.js +114 -0
- package/package/stores.d.ts +1 -1
- package/package/utils.d.ts +18 -1
- package/package/utils.js +55 -2
- package/package.json +13 -12
- package/package/components/InitGitRepoPopover.svelte +0 -410
- package/package/components/InitGitRepoPopover.svelte.d.ts +0 -13
- package/package/components/PullGitRepoPopover.svelte +0 -355
- package/package/components/PullGitRepoPopover.svelte.d.ts +0 -18
- package/package/inferArgSig.d.ts +0 -35
- package/package/inferArgSig.js +0 -191
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface SyncResponse {
|
|
2
|
+
success: true;
|
|
3
|
+
changes: Array<{
|
|
4
|
+
type: 'added' | 'edited' | 'deleted';
|
|
5
|
+
path: string;
|
|
6
|
+
codebase_changed?: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
total: number;
|
|
9
|
+
settingsDiffResult?: {
|
|
10
|
+
hasChanges: boolean;
|
|
11
|
+
diff: Record<string, {
|
|
12
|
+
from: any;
|
|
13
|
+
to: any;
|
|
14
|
+
}>;
|
|
15
|
+
local: SettingsObject;
|
|
16
|
+
backend: SettingsObject;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface SettingsResponse {
|
|
20
|
+
success: true;
|
|
21
|
+
hasChanges: boolean;
|
|
22
|
+
local: SettingsObject;
|
|
23
|
+
backend: SettingsObject;
|
|
24
|
+
diff: Record<string, {
|
|
25
|
+
from: any;
|
|
26
|
+
to: any;
|
|
27
|
+
}>;
|
|
28
|
+
repository: string;
|
|
29
|
+
}
|
|
30
|
+
import type { GitSyncObjectType } from './gen';
|
|
31
|
+
export interface SettingsObject {
|
|
32
|
+
include_path: string[];
|
|
33
|
+
exclude_path: string[];
|
|
34
|
+
extra_include_path: string[];
|
|
35
|
+
include_type: GitSyncObjectType[];
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package/hub.d.ts
CHANGED
package/package/hubPaths.json
CHANGED
|
@@ -8,15 +8,18 @@
|
|
|
8
8
|
"gitSync_6": "hub/11666/sync-script-to-git-repo-windmill",
|
|
9
9
|
"gitSync_7": "hub/11668/sync-script-to-git-repo-windmill",
|
|
10
10
|
"gitSync_8": "hub/19673/sync-script-to-git-repo-windmill",
|
|
11
|
-
"
|
|
11
|
+
"gitSync_9": "hub/19738/sync-script-to-git-repo-windmill",
|
|
12
|
+
"gitSync_10": "hub/19785/sync-script-to-git-repo-windmill",
|
|
13
|
+
"gitSync": "hub/19789/sync-script-to-git-repo-windmill",
|
|
12
14
|
"gitSyncTest_0": "hub/9073/git-repo-test-read-write-windmill",
|
|
13
15
|
"gitSyncTest_1": "hub/11499/git-repo-test-read-write-windmill",
|
|
14
16
|
"gitSyncTest_2": "hub/11667/git-repo-test-read-write-windmill",
|
|
15
17
|
"gitSyncTest": "hub/11669/git-repo-test-read-write-windmill",
|
|
16
|
-
"gitInitRepo": "hub/
|
|
18
|
+
"gitInitRepo": "hub/19787/git-sync%3A-init-repository-windmill",
|
|
17
19
|
"slackErrorHandler": "hub/19741/workspace-or-schedule-error-handler-slack",
|
|
18
20
|
"slackErrorHandler_0": "hub/9079/workspace-or-schedule-error-handler-slack",
|
|
19
21
|
"slackErrorHandler_1": "hub/9206/workspace-or-schedule-error-handler-slack",
|
|
22
|
+
"emailErrorHandler": "hub/19795/workspace-or-error-handler-email",
|
|
20
23
|
"slackRecoveryHandler": "hub/9080/slack/schedule-recovery-handler-slack",
|
|
21
24
|
"slackSuccessHandler": "hub/9072/slack/schedule-success-handler-slack",
|
|
22
25
|
"teamsErrorHandler": "hub/19742/workspace-or-schedule-error-handler-teams",
|
package/package/infer.js
CHANGED
|
@@ -23,7 +23,7 @@ import wasmUrlCSharp from 'windmill-parser-wasm-csharp/windmill_parser_wasm_bg.w
|
|
|
23
23
|
import wasmUrlNu from 'windmill-parser-wasm-nu/windmill_parser_wasm_bg.wasm?url';
|
|
24
24
|
import wasmUrlJava from 'windmill-parser-wasm-java/windmill_parser_wasm_bg.wasm?url';
|
|
25
25
|
import { workspaceStore } from './stores.js';
|
|
26
|
-
import { argSigToJsonSchemaType } from '
|
|
26
|
+
import { argSigToJsonSchemaType } from 'windmill-utils-internal';
|
|
27
27
|
import {} from './components/assets/lib.js';
|
|
28
28
|
const loadSchemaLastRun = writable(undefined);
|
|
29
29
|
let initializeTsPromise = undefined;
|
|
@@ -64,7 +64,8 @@ export async function inferAssets(language, code) {
|
|
|
64
64
|
try {
|
|
65
65
|
if (language === 'duckdb') {
|
|
66
66
|
await initWasmRegex();
|
|
67
|
-
|
|
67
|
+
let r = JSON.parse(parse_assets_sql(code));
|
|
68
|
+
return r;
|
|
68
69
|
}
|
|
69
70
|
if (language === 'deno' || language === 'nativets' || language === 'bun') {
|
|
70
71
|
await initWasmTs();
|
|
@@ -2,10 +2,10 @@ import { type Script } from './gen';
|
|
|
2
2
|
import type { SupportedLanguage } from './common';
|
|
3
3
|
export declare const TS_PREPROCESSOR_SCRIPT_INTRO = "/**\n * Trigger preprocessor\n *\n * \u26A0\uFE0F This function runs BEFORE the main function.\n *\n * It processes raw trigger data from various sources (webhook, custom HTTP route, SQS, WebSocket, Kafka, NATS, MQTT, Postgres, or email)\n * before passing it to `main`. This separates the trigger logic from the main logic and keeps the auto-generated runnable UI clean.\n *\n * The returned object defines the parameter values passed to `main()`.\n * e.g., { b: 1, a: 2 } \u2192 Calls `main(2, 1)`, assuming `main` is defined as `main(a: number, b: number)`.\n * Ensure that the parameter names in `main` match the keys in the returned object.\n * \n * Learn more: https://www.windmill.dev/docs/core_concepts/preprocessors\n */\n";
|
|
4
4
|
export declare const TS_PREPROCESSOR_FLOW_INTRO = "/**\n * Trigger preprocessor\n *\n * It processes raw trigger data from various sources (webhook, custom HTTP route, SQS, WebSocket, Kafka, NATS, MQTT, Postgres, or email) \n * before passing it to the flow. This separates the trigger logic from the flow logic and keeps the auto-generated UI clean.\n * \n * The returned object determines the parameter values passed to the flow.\n * e.g., `{ b: 1, a: 2 }` \u2192 Calls the flow with `a = 2` and `b = 1`, assuming the flow has two inputs called `a` and `b`.\n * Ensure that the input names of the flow match the keys in the returned object.\n * \n * Learn more: https://www.windmill.dev/docs/core_concepts/preprocessors\n */\n";
|
|
5
|
-
export declare const TS_PREPROCESSOR_MODULE_CODE = "export async function preprocessor(\n event:\n | {\n kind: \"webhook\";\n body: any;\n raw_string: string | null;\n query: Record<string, string>;\n headers: Record<string, string>;\n }\n | {\n kind: \"http\";\n body: any;\n raw_string: string | null;\n route: string;\n path: string;\n method: string;\n params: Record<string, string>;\n query: Record<string, string>;\n headers: Record<string, string>;\n }\n | {\n kind: \"email\";\n parsed_email: any;\n raw_email: string;\n }\n | { kind: \"websocket\"; msg: string; url: string }\n | {\n kind: \"kafka\";\n payload: string;\n brokers: string[];\n topic: string;\n group_id: string;\n }\n | {\n kind: \"nats\";\n payload: string;\n servers: string[];\n subject: string;\n headers?: Record<string, string[]>;\n status?: number;\n description?: string;\n length: number;\n }\n | {\n kind: \"sqs\";\n msg: string;\n queue_url: string;\n message_id?: string;\n receipt_handle?: string;\n attributes: Record<string, string>;\n message_attributes?: Record<\n string,\n { string_value?: string; data_type: string }\n >;\n }\n | {\n kind: \"mqtt\";\n payload: string;\n topic: string;\n retain: boolean;\n pkid: number;\n qos: number;\n v5?: {\n payload_format_indicator?: number;\n topic_alias?: number;\n response_topic?: string;\n correlation_data?: Array<number>;\n user_properties?: Array<[string, string]>;\n subscription_identifiers?: Array<number>;\n content_type?: string;\n };\n }\n | {\n kind: \"gcp\";\n payload: string;\n message_id: string;\n subscription: string;\n ordering_key?: string;\n attributes?: Record<string, string>;\n delivery_type: \"push\" | \"pull\";\n headers?: Record<string, string>;\n publish_time?: string;\n }\n | {\n kind: \"postgres\";\n transaction_type: \"insert\" | \"update\" | \"delete\",\n schema_name: string,\n table_name: string,\n old_row?: Record<string, any>,\n row: Record<string, any>\n }\n) {\n return {\n // return the args to be passed to the runnable\n };\n}\n";
|
|
5
|
+
export declare const TS_PREPROCESSOR_MODULE_CODE = "export async function preprocessor(\n event:\n | {\n kind: \"webhook\";\n body: any;\n raw_string: string | null;\n query: Record<string, string>;\n headers: Record<string, string>;\n }\n | {\n kind: \"http\";\n body: any;\n raw_string: string | null;\n route: string;\n path: string;\n method: string;\n params: Record<string, string>;\n query: Record<string, string>;\n headers: Record<string, string>;\n }\n | {\n kind: \"email\";\n parsed_email: any;\n raw_email: string;\n }\n | { kind: \"websocket\"; msg: string; url: string }\n | {\n kind: \"kafka\";\n payload: string;\n brokers: string[];\n topic: string;\n group_id: string;\n }\n | {\n kind: \"nats\";\n payload: string;\n servers: string[];\n subject: string;\n headers?: Record<string, string[]>;\n status?: number;\n description?: string;\n length: number;\n }\n | {\n kind: \"sqs\";\n msg: string;\n queue_url: string;\n message_id?: string;\n receipt_handle?: string;\n attributes: Record<string, string>;\n message_attributes?: Record<\n string,\n { string_value?: string; data_type: string }\n >;\n }\n | {\n kind: \"mqtt\";\n payload: string;\n topic: string;\n retain: boolean;\n pkid: number;\n qos: number;\n v5?: {\n payload_format_indicator?: number;\n topic_alias?: number;\n response_topic?: string;\n correlation_data?: Array<number>;\n user_properties?: Array<[string, string]>;\n subscription_identifiers?: Array<number>;\n content_type?: string;\n };\n }\n | {\n kind: \"gcp\";\n payload: string;\n message_id: string;\n subscription: string;\n ordering_key?: string;\n attributes?: Record<string, string>;\n delivery_type: \"push\" | \"pull\";\n headers?: Record<string, string>;\n publish_time?: string;\n ack_id?: string;\n }\n | {\n kind: \"postgres\";\n transaction_type: \"insert\" | \"update\" | \"delete\",\n schema_name: string,\n table_name: string,\n old_row?: Record<string, any>,\n row: Record<string, any>\n }\n) {\n return {\n // return the args to be passed to the runnable\n };\n}\n";
|
|
6
6
|
export declare const PYTHON_PREPROCESSOR_SCRIPT_INTRO = "# Trigger preprocessor\n#\n# \u26A0\uFE0F This function runs BEFORE the main function.\n#\n# It processes raw trigger data from various sources (webhook, custom HTTP route, SQS, WebSocket, Kafka, NATS, MQTT, Postgres, or email) \n# before passing it to `main`. This separates the trigger logic from the main logic and keeps the auto-generated UI clean.\n#\n# The returned object defines the parameter values passed to `main()`.\n# e.g., { b: 1, a: 2 } \u2192 Calls `main(2, 1)`, assuming `main` is defined as `main(a: int, b: int)`.\n# Ensure that the parameter names in `main` match the keys in the returned object.\n#\n# Learn more: https://www.windmill.dev/docs/core_concepts/preprocessors\n\n";
|
|
7
7
|
export declare const PYTHON_PREPROCESSOR_FLOW_INTRO = "# Trigger preprocessor\n#\n# It processes raw trigger data from various sources (webhook, custom HTTP route, SQS, WebSocket, Kafka, NATS, MQTT, Postgres, or email) \n# before passing it to the flow. This separates the trigger logic from the flow logic and keeps the auto-generated UI clean.\n# \n# The returned object determines the parameter values passed to the flow.\n# e.g., `{ b: 1, a: 2 }` \u2192 Calls the flow with `a = 2` and `b = 1`, assuming the flow has two inputs called `a` and `b`.\n# Ensure that the input names of the flow match the keys in the returned object.\n#\n# Learn more: https://www.windmill.dev/docs/core_concepts/preprocessors\n\n";
|
|
8
|
-
export declare const PYTHON_PREPROCESSOR_MODULE_CODE = "from typing import TypedDict, Literal, Optional, Union\n\n\nclass WebhookEvent(TypedDict):\n kind: Literal[\"webhook\"]\n body: dict\n raw_string: Optional[str]\n query: dict[str, str]\n headers: dict[str, str]\n\n\nclass HttpEvent(TypedDict):\n kind: Literal[\"http\"]\n body: dict\n raw_string: Optional[str]\n route: str\n path: str\n method: str\n params: dict[str, str]\n query: dict[str, str]\n headers: dict[str, str]\n\n\nclass EmailEvent(TypedDict):\n kind: Literal[\"email\"]\n parsed_email: dict\n raw_email: str\n\n\nclass WebsocketEvent(TypedDict):\n kind: Literal[\"websocket\"]\n msg: str\n url: str\n\n\nclass KafkaEvent(TypedDict):\n kind: Literal[\"kafka\"]\n payload: str\n brokers: list[str]\n topic: str\n group_id: str\n\n\nclass NatsEvent(TypedDict):\n kind: Literal[\"nats\"]\n payload: str\n servers: list[str]\n subject: str\n headers: Optional[dict[str, list[str]]]\n status: Optional[int]\n description: Optional[str]\n length: int\n\n\nclass MessageAttribute(TypedDict):\n string_value: Optional[str]\n data_type: str\n\n\nclass SqsEvent(TypedDict):\n kind: Literal[\"sqs\"]\n msg: str\n queue_url: str\n message_id: Optional[str]\n receipt_handle: Optional[str]\n attributes: dict[str, str]\n message_attributes: Optional[dict[str, MessageAttribute]]\n\n\nclass MqttV5Properties(TypedDict, total=False):\n payload_format_indicator: Optional[int]\n topic_alias: Optional[int]\n response_topic: Optional[str]\n correlation_data: Optional[list[int]]\n user_properties: Optional[list[tuple[str, str]]]\n subscription_identifiers: Optional[list[int]]\n content_type: Optional[str]\n\n\nclass MqttEvent(TypedDict):\n kind: Literal[\"mqtt\"]\n payload: str\n topic: str\n retain: bool\n pkid: int\n qos: int\n v5: Optional[MqttV5Properties]\n\n\nclass GcpEvent(TypedDict):\n kind: Literal[\"gcp\"]\n payload: str\n message_id: str\n subscription: str\n ordering_key: Optional[str]\n attributes: Optional[dict[str, str]]\n delivery_type: Literal[\"push\", \"pull\"]\n headers: Optional[dict[str, str]]\n publish_time: Optional[str]\n\n\nclass PostgresEvent(TypedDict):\n kind: Literal[\"postgres\"]\n transaction_type: Literal[\"insert\", \"update\", \"delete\"]\n schema_name: str\n table_name: str\n old_row: Optional[dict[str, any]]\n row: dict[str, any]\n\n\nEvent = Union[\n WebhookEvent,\n HttpEvent,\n EmailEvent,\n WebsocketEvent,\n KafkaEvent,\n NatsEvent,\n SqsEvent,\n MqttEvent,\n GcpEvent,\n PostgresEvent,\n]\n\n\ndef preprocessor(event: Event):\n return {\n # return the args to be passed to the runnable\n }\n";
|
|
8
|
+
export declare const PYTHON_PREPROCESSOR_MODULE_CODE = "from typing import TypedDict, Literal, Optional, Union\n\n\nclass WebhookEvent(TypedDict):\n kind: Literal[\"webhook\"]\n body: dict\n raw_string: Optional[str]\n query: dict[str, str]\n headers: dict[str, str]\n\n\nclass HttpEvent(TypedDict):\n kind: Literal[\"http\"]\n body: dict\n raw_string: Optional[str]\n route: str\n path: str\n method: str\n params: dict[str, str]\n query: dict[str, str]\n headers: dict[str, str]\n\n\nclass EmailEvent(TypedDict):\n kind: Literal[\"email\"]\n parsed_email: dict\n raw_email: str\n\n\nclass WebsocketEvent(TypedDict):\n kind: Literal[\"websocket\"]\n msg: str\n url: str\n\n\nclass KafkaEvent(TypedDict):\n kind: Literal[\"kafka\"]\n payload: str\n brokers: list[str]\n topic: str\n group_id: str\n\n\nclass NatsEvent(TypedDict):\n kind: Literal[\"nats\"]\n payload: str\n servers: list[str]\n subject: str\n headers: Optional[dict[str, list[str]]]\n status: Optional[int]\n description: Optional[str]\n length: int\n\n\nclass MessageAttribute(TypedDict):\n string_value: Optional[str]\n data_type: str\n\n\nclass SqsEvent(TypedDict):\n kind: Literal[\"sqs\"]\n msg: str\n queue_url: str\n message_id: Optional[str]\n receipt_handle: Optional[str]\n attributes: dict[str, str]\n message_attributes: Optional[dict[str, MessageAttribute]]\n\n\nclass MqttV5Properties(TypedDict, total=False):\n payload_format_indicator: Optional[int]\n topic_alias: Optional[int]\n response_topic: Optional[str]\n correlation_data: Optional[list[int]]\n user_properties: Optional[list[tuple[str, str]]]\n subscription_identifiers: Optional[list[int]]\n content_type: Optional[str]\n\n\nclass MqttEvent(TypedDict):\n kind: Literal[\"mqtt\"]\n payload: str\n topic: str\n retain: bool\n pkid: int\n qos: int\n v5: Optional[MqttV5Properties]\n\n\nclass GcpEvent(TypedDict):\n kind: Literal[\"gcp\"]\n payload: str\n message_id: str\n subscription: str\n ordering_key: Optional[str]\n attributes: Optional[dict[str, str]]\n delivery_type: Literal[\"push\", \"pull\"]\n headers: Optional[dict[str, str]]\n publish_time: Optional[str]\n ack_id: Optional[str]\n\n\nclass PostgresEvent(TypedDict):\n kind: Literal[\"postgres\"]\n transaction_type: Literal[\"insert\", \"update\", \"delete\"]\n schema_name: str\n table_name: str\n old_row: Optional[dict[str, any]]\n row: dict[str, any]\n\n\nEvent = Union[\n WebhookEvent,\n HttpEvent,\n EmailEvent,\n WebsocketEvent,\n KafkaEvent,\n NatsEvent,\n SqsEvent,\n MqttEvent,\n GcpEvent,\n PostgresEvent,\n]\n\n\ndef preprocessor(event: Event):\n return {\n # return the args to be passed to the runnable\n }\n";
|
|
9
9
|
export declare const INITIAL_CODE: {
|
|
10
10
|
bun: {
|
|
11
11
|
scriptInitCodeBlock: string;
|
|
@@ -279,17 +279,33 @@ const MSSQL_INIT_CODE = `-- return_last_result
|
|
|
279
279
|
INSERT INTO demo VALUES (@P1, @P2);
|
|
280
280
|
UPDATE demo SET col2 = @P3 WHERE col2 = @P2;
|
|
281
281
|
`;
|
|
282
|
-
const DUCKDB_INIT_CODE = `-- $
|
|
283
|
-
-- $
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
282
|
+
const DUCKDB_INIT_CODE = `-- $name (text) = Ben
|
|
283
|
+
-- $age (text) = 20
|
|
284
|
+
-- -- $friends_csv (s3object)
|
|
285
|
+
|
|
286
|
+
-- Click the +Database button to connect to a database
|
|
287
|
+
-- https://www.windmill.dev/docs/getting_started/scripts_quickstart/sql#duckdb-1
|
|
288
|
+
--
|
|
289
|
+
-- ATTACH '$res:u/demo/amazed_postgresql' AS db (TYPE postgres);
|
|
290
|
+
-- SELECT * FROM db.public.friends;
|
|
291
|
+
|
|
292
|
+
-- Click the +Ducklake button to use a ducklake
|
|
293
|
+
-- https://www.windmill.dev/docs/core_concepts/ducklake
|
|
294
|
+
--
|
|
295
|
+
-- ATTACH 'ducklake' AS dl;
|
|
296
|
+
-- USE dl;
|
|
297
|
+
-- SELECT * FROM customers;
|
|
298
|
+
|
|
299
|
+
CREATE TABLE friends (
|
|
300
|
+
name text,
|
|
301
|
+
age int
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
INSERT INTO friends VALUES ($name, $age);
|
|
305
|
+
-- INSERT INTO friends
|
|
306
|
+
-- SELECT name, age FROM read_csv($friends_csv);
|
|
307
|
+
|
|
308
|
+
SELECT * FROM friends;
|
|
293
309
|
`;
|
|
294
310
|
const GRAPHQL_INIT_CODE = `query($name4: String, $name2: Int, $name3: [String]) {
|
|
295
311
|
demo(name1: $name1, name2: $name2, name3: $name3) {
|
|
@@ -709,6 +725,7 @@ export const TS_PREPROCESSOR_MODULE_CODE = `export async function preprocessor(
|
|
|
709
725
|
delivery_type: "push" | "pull";
|
|
710
726
|
headers?: Record<string, string>;
|
|
711
727
|
publish_time?: string;
|
|
728
|
+
ack_id?: string;
|
|
712
729
|
}
|
|
713
730
|
| {
|
|
714
731
|
kind: "postgres";
|
|
@@ -871,6 +888,7 @@ class GcpEvent(TypedDict):
|
|
|
871
888
|
delivery_type: Literal["push", "pull"]
|
|
872
889
|
headers: Optional[dict[str, str]]
|
|
873
890
|
publish_time: Optional[str]
|
|
891
|
+
ack_id: Optional[str]
|
|
874
892
|
|
|
875
893
|
|
|
876
894
|
class PostgresEvent(TypedDict):
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface JobStatus {
|
|
2
|
+
status: 'running' | 'success' | 'failure';
|
|
3
|
+
result?: any;
|
|
4
|
+
error?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface JobOptions {
|
|
7
|
+
onProgress?: (status: JobStatus) => void;
|
|
8
|
+
timeout?: number;
|
|
9
|
+
workspace: string;
|
|
10
|
+
interval?: number;
|
|
11
|
+
timeoutMessage?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class JobManager {
|
|
14
|
+
private activeJobs;
|
|
15
|
+
private cleanupInterval;
|
|
16
|
+
private readonly STALE_TIMEOUT;
|
|
17
|
+
private readonly CLEANUP_INTERVAL;
|
|
18
|
+
constructor();
|
|
19
|
+
private startCleanupTimer;
|
|
20
|
+
private cleanup;
|
|
21
|
+
runWithProgress<T>(jobRunner: () => Promise<string>, options: JobOptions): Promise<T>;
|
|
22
|
+
cancel(jobId: string): void;
|
|
23
|
+
cancelAll(): void;
|
|
24
|
+
isActive(jobId: string): boolean;
|
|
25
|
+
get activeJobCount(): number;
|
|
26
|
+
destroy(): void;
|
|
27
|
+
}
|
|
28
|
+
export declare const jobManager: JobManager;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { JobService } from '../gen';
|
|
2
|
+
import { tryEvery } from '../utils';
|
|
3
|
+
export class JobManager {
|
|
4
|
+
activeJobs = new Map();
|
|
5
|
+
cleanupInterval = null;
|
|
6
|
+
STALE_TIMEOUT = 300000; // 5 minutes
|
|
7
|
+
CLEANUP_INTERVAL = 60000; // 1 minute
|
|
8
|
+
constructor() {
|
|
9
|
+
this.startCleanupTimer();
|
|
10
|
+
}
|
|
11
|
+
startCleanupTimer() {
|
|
12
|
+
if (typeof window !== 'undefined') {
|
|
13
|
+
this.cleanupInterval = setInterval(() => {
|
|
14
|
+
this.cleanup();
|
|
15
|
+
}, this.CLEANUP_INTERVAL);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
cleanup() {
|
|
19
|
+
const now = Date.now();
|
|
20
|
+
const staleJobs = [];
|
|
21
|
+
for (const [jobId, entry] of this.activeJobs.entries()) {
|
|
22
|
+
if (now - entry.startTime > this.STALE_TIMEOUT) {
|
|
23
|
+
entry.controller.abort();
|
|
24
|
+
staleJobs.push(jobId);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
staleJobs.forEach(jobId => {
|
|
28
|
+
this.activeJobs.delete(jobId);
|
|
29
|
+
});
|
|
30
|
+
if (staleJobs.length > 0) {
|
|
31
|
+
console.warn(`Cleaned up ${staleJobs.length} stale job controllers`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async runWithProgress(jobRunner, options) {
|
|
35
|
+
const { onProgress, timeout = 60000, workspace, interval = 500, timeoutMessage = `Job timed out after ${timeout / 1000}s` } = options;
|
|
36
|
+
const controller = new AbortController();
|
|
37
|
+
const jobId = await jobRunner();
|
|
38
|
+
this.activeJobs.set(jobId, {
|
|
39
|
+
controller,
|
|
40
|
+
startTime: Date.now()
|
|
41
|
+
});
|
|
42
|
+
try {
|
|
43
|
+
onProgress?.({ status: 'running' });
|
|
44
|
+
const result = await tryEvery({
|
|
45
|
+
tryCode: async () => {
|
|
46
|
+
if (controller.signal.aborted) {
|
|
47
|
+
throw new Error('Job was cancelled');
|
|
48
|
+
}
|
|
49
|
+
const jobResult = await JobService.getCompletedJob({
|
|
50
|
+
workspace,
|
|
51
|
+
id: jobId
|
|
52
|
+
});
|
|
53
|
+
const success = !!jobResult.success;
|
|
54
|
+
const status = {
|
|
55
|
+
status: success ? 'success' : 'failure',
|
|
56
|
+
result: jobResult.result,
|
|
57
|
+
error: success ? undefined : jobResult.result?.error?.message || 'Job failed'
|
|
58
|
+
};
|
|
59
|
+
onProgress?.(status);
|
|
60
|
+
if (!success) {
|
|
61
|
+
throw new Error(status.error);
|
|
62
|
+
}
|
|
63
|
+
return jobResult.result;
|
|
64
|
+
},
|
|
65
|
+
timeoutCode: async () => {
|
|
66
|
+
try {
|
|
67
|
+
await JobService.cancelQueuedJob({
|
|
68
|
+
workspace,
|
|
69
|
+
id: jobId,
|
|
70
|
+
requestBody: { reason: timeoutMessage }
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
console.error('Failed to cancel job:', err);
|
|
75
|
+
}
|
|
76
|
+
onProgress?.({ status: 'failure', error: timeoutMessage });
|
|
77
|
+
throw new Error(timeoutMessage);
|
|
78
|
+
},
|
|
79
|
+
interval,
|
|
80
|
+
timeout
|
|
81
|
+
});
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
this.activeJobs.delete(jobId);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
cancel(jobId) {
|
|
89
|
+
const entry = this.activeJobs.get(jobId);
|
|
90
|
+
if (entry) {
|
|
91
|
+
entry.controller.abort();
|
|
92
|
+
this.activeJobs.delete(jobId);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
cancelAll() {
|
|
96
|
+
this.activeJobs.forEach(entry => entry.controller.abort());
|
|
97
|
+
this.activeJobs.clear();
|
|
98
|
+
}
|
|
99
|
+
isActive(jobId) {
|
|
100
|
+
return this.activeJobs.has(jobId);
|
|
101
|
+
}
|
|
102
|
+
get activeJobCount() {
|
|
103
|
+
return this.activeJobs.size;
|
|
104
|
+
}
|
|
105
|
+
destroy() {
|
|
106
|
+
if (this.cleanupInterval) {
|
|
107
|
+
clearInterval(this.cleanupInterval);
|
|
108
|
+
this.cleanupInterval = null;
|
|
109
|
+
}
|
|
110
|
+
this.cancelAll();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Singleton instance for global usage
|
|
114
|
+
export const jobManager = new JobManager();
|
package/package/stores.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ type SQLBaseSchema = {
|
|
|
77
77
|
};
|
|
78
78
|
export declare const SQLSchemaLanguages: readonly ["mysql", "bigquery", "postgresql", "snowflake", "mssql", "oracledb"];
|
|
79
79
|
export interface SQLSchema {
|
|
80
|
-
lang: (typeof SQLSchemaLanguages)[number];
|
|
80
|
+
lang: (typeof SQLSchemaLanguages)[number] | 'ducklake';
|
|
81
81
|
schema: SQLBaseSchema;
|
|
82
82
|
publicOnly: boolean | undefined;
|
|
83
83
|
stringified: string;
|
package/package/utils.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare function isJobCancelable(j: Job): boolean;
|
|
|
33
33
|
export declare function isJobReRunnable(j: Job): boolean;
|
|
34
34
|
export declare const WORKER_NAME_PREFIX = "wk";
|
|
35
35
|
export declare function isJobSelectable(selectionType: RunsSelectionMode): (j: Job) => boolean;
|
|
36
|
+
export declare function escapeHtml(unsafe: string): string;
|
|
36
37
|
export declare function validateUsername(username: string): string;
|
|
37
38
|
export declare function parseQueryParams(url: string | undefined): Record<string, string>;
|
|
38
39
|
export declare function displayDateOnly(dateString: string | Date | undefined): string;
|
|
@@ -97,6 +98,21 @@ export declare function truncate(s: string, n: number, suffix?: string): string;
|
|
|
97
98
|
export declare function truncateRev(s: string, n: number, prefix?: string): string;
|
|
98
99
|
export declare function isString(value: any): value is string | String;
|
|
99
100
|
export type InputCat = 'string' | 'email' | 'number' | 'boolean' | 'list' | 'resource-object' | 'enum' | 'date' | 'base64' | 'resource-string' | 'object' | 'sql' | 'yaml' | 'currency' | 'oneOf' | 'dynselect';
|
|
101
|
+
export declare namespace DynamicSelect {
|
|
102
|
+
type HelperScript = {
|
|
103
|
+
type: 'inline';
|
|
104
|
+
path?: string;
|
|
105
|
+
lang: Script['language'];
|
|
106
|
+
code: string;
|
|
107
|
+
} | {
|
|
108
|
+
type: 'hash';
|
|
109
|
+
hash: string;
|
|
110
|
+
};
|
|
111
|
+
const generatePythonFnTemplate: (functionName: string) => string;
|
|
112
|
+
const generateJsFnTemplate: (functionName: string) => string;
|
|
113
|
+
const generateDefaultTemplateFn: (functionName: string, lang: ScriptLang) => string;
|
|
114
|
+
const getGenerateTemplateFn: (lang: ScriptLang) => (functionName: string) => string;
|
|
115
|
+
}
|
|
100
116
|
export declare function setInputCat(type: string | undefined, format: string | undefined, itemsType: string | undefined, enum_: any, contentEncoding: string | undefined): InputCat;
|
|
101
117
|
export declare function formatCron(inp: string): string;
|
|
102
118
|
export declare function scriptLangArrayToCommaList(languages: ScriptLang[]): string;
|
|
@@ -209,4 +225,5 @@ export declare function parseS3Object(s3Object: S3Object): {
|
|
|
209
225
|
export declare function formatS3Object(s3Object: S3Object): S3Uri;
|
|
210
226
|
export declare function isS3Uri(uri: string): uri is S3Uri;
|
|
211
227
|
export declare function uniqueBy<T>(array: T[], key: (t: T) => any): T[];
|
|
212
|
-
export declare function
|
|
228
|
+
export declare function pruneNullishArray<T>(array: (T | null | undefined)[]): T[];
|
|
229
|
+
export declare function assert(msg: string, condition: boolean, value?: any): void;
|
package/package/utils.js
CHANGED
|
@@ -82,6 +82,14 @@ export function isJobSelectable(selectionType) {
|
|
|
82
82
|
}[selectionType];
|
|
83
83
|
return f;
|
|
84
84
|
}
|
|
85
|
+
export function escapeHtml(unsafe) {
|
|
86
|
+
return unsafe
|
|
87
|
+
.replace(/&/g, '&')
|
|
88
|
+
.replace(/</g, '<')
|
|
89
|
+
.replace(/>/g, '>')
|
|
90
|
+
.replace(/"/g, '"')
|
|
91
|
+
.replace(/'/g, ''');
|
|
92
|
+
}
|
|
85
93
|
export function validateUsername(username) {
|
|
86
94
|
if (username != '' && !/^[a-zA-Z]\w+$/.test(username)) {
|
|
87
95
|
return 'username can only contain letters and numbers and must start with a letter';
|
|
@@ -474,6 +482,40 @@ export function truncateRev(s, n, prefix = '...') {
|
|
|
474
482
|
export function isString(value) {
|
|
475
483
|
return typeof value === 'string' || value instanceof String;
|
|
476
484
|
}
|
|
485
|
+
export var DynamicSelect;
|
|
486
|
+
(function (DynamicSelect) {
|
|
487
|
+
DynamicSelect.generatePythonFnTemplate = (functionName) => {
|
|
488
|
+
return `
|
|
489
|
+
def ${functionName}():
|
|
490
|
+
return [
|
|
491
|
+
{ "label": "Foo", "value": "foo" },
|
|
492
|
+
{ "label": "Bar", "value": "bar" }
|
|
493
|
+
]
|
|
494
|
+
|
|
495
|
+
`;
|
|
496
|
+
};
|
|
497
|
+
DynamicSelect.generateJsFnTemplate = (functionName) => {
|
|
498
|
+
return `
|
|
499
|
+
// you can use filterText to filter the results from the backend
|
|
500
|
+
// you can refer to other args directly as parameters (e.g. foobar: string)
|
|
501
|
+
export function ${functionName}(filterText: string) {
|
|
502
|
+
return [
|
|
503
|
+
{ label: 'Foo', value: 'foo' },
|
|
504
|
+
{ label: 'Bar', value: 'bar' }
|
|
505
|
+
];
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
`;
|
|
509
|
+
};
|
|
510
|
+
DynamicSelect.generateDefaultTemplateFn = (functionName, lang) => {
|
|
511
|
+
return lang === 'bun'
|
|
512
|
+
? DynamicSelect.generateJsFnTemplate(functionName)
|
|
513
|
+
: DynamicSelect.generatePythonFnTemplate(functionName);
|
|
514
|
+
};
|
|
515
|
+
DynamicSelect.getGenerateTemplateFn = (lang) => {
|
|
516
|
+
return lang === 'bun' ? DynamicSelect.generateJsFnTemplate : DynamicSelect.generatePythonFnTemplate;
|
|
517
|
+
};
|
|
518
|
+
})(DynamicSelect || (DynamicSelect = {}));
|
|
477
519
|
export function setInputCat(type, format, itemsType, enum_, contentEncoding) {
|
|
478
520
|
if (type === 'number' || type === 'integer') {
|
|
479
521
|
return 'number';
|
|
@@ -487,7 +529,8 @@ export function setInputCat(type, format, itemsType, enum_, contentEncoding) {
|
|
|
487
529
|
else if (type == 'object' && format?.startsWith('resource')) {
|
|
488
530
|
return 'resource-object';
|
|
489
531
|
}
|
|
490
|
-
else if (type == 'object' &&
|
|
532
|
+
else if (type == 'object' &&
|
|
533
|
+
(format?.startsWith('dynselect-') || format?.startsWith('dynselect_'))) {
|
|
491
534
|
return 'dynselect';
|
|
492
535
|
}
|
|
493
536
|
else if (!type || type == 'object' || type == 'array') {
|
|
@@ -1236,6 +1279,16 @@ export function uniqueBy(array, key) {
|
|
|
1236
1279
|
}
|
|
1237
1280
|
});
|
|
1238
1281
|
}
|
|
1239
|
-
export function
|
|
1282
|
+
export function pruneNullishArray(array) {
|
|
1240
1283
|
return array.filter((item) => item !== null && item !== undefined);
|
|
1241
1284
|
}
|
|
1285
|
+
export function assert(msg, condition, value) {
|
|
1286
|
+
if (!condition) {
|
|
1287
|
+
let m = 'Assertion failed: ' + msg;
|
|
1288
|
+
if (value)
|
|
1289
|
+
m += '\nValue: ' + JSON.stringify(value, null, 2);
|
|
1290
|
+
m += '\nPlease alert the Windmill team about this';
|
|
1291
|
+
sendUserToast(m, true);
|
|
1292
|
+
console.error(m);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "windmill-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.522.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build",
|
|
@@ -141,17 +141,18 @@
|
|
|
141
141
|
"vscode-languageclient": "~9.0.1",
|
|
142
142
|
"vscode-uri": "~3.1.0",
|
|
143
143
|
"vscode-ws-jsonrpc": "~3.4.0",
|
|
144
|
-
"windmill-parser-wasm-csharp": "
|
|
145
|
-
"windmill-parser-wasm-go": "
|
|
146
|
-
"windmill-parser-wasm-java": "
|
|
147
|
-
"windmill-parser-wasm-nu": "
|
|
148
|
-
"windmill-parser-wasm-php": "
|
|
149
|
-
"windmill-parser-wasm-py": "
|
|
150
|
-
"windmill-parser-wasm-regex": "
|
|
151
|
-
"windmill-parser-wasm-rust": "
|
|
152
|
-
"windmill-parser-wasm-ts": "
|
|
153
|
-
"windmill-parser-wasm-yaml": "
|
|
154
|
-
"windmill-sql-datatype-parser-wasm": "
|
|
144
|
+
"windmill-parser-wasm-csharp": "1.510.1",
|
|
145
|
+
"windmill-parser-wasm-go": "1.510.1",
|
|
146
|
+
"windmill-parser-wasm-java": "1.510.1",
|
|
147
|
+
"windmill-parser-wasm-nu": "1.510.1",
|
|
148
|
+
"windmill-parser-wasm-php": "1.510.1",
|
|
149
|
+
"windmill-parser-wasm-py": "1.510.1",
|
|
150
|
+
"windmill-parser-wasm-regex": "1.512.0",
|
|
151
|
+
"windmill-parser-wasm-rust": "1.510.1",
|
|
152
|
+
"windmill-parser-wasm-ts": "1.514.1",
|
|
153
|
+
"windmill-parser-wasm-yaml": "1.510.1",
|
|
154
|
+
"windmill-sql-datatype-parser-wasm": "1.512.0",
|
|
155
|
+
"windmill-utils-internal": "^1.0.0",
|
|
155
156
|
"xterm": "^5.3.0",
|
|
156
157
|
"xterm-readline": "^1.1.2",
|
|
157
158
|
"y-monaco": "^0.1.4",
|