windmill-components 1.555.1 → 1.558.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/components/AIAgentLogViewer.svelte.d.ts +3 -3
- package/package/components/AIProviderPicker.svelte.d.ts +3 -3
- package/package/components/ArgInput.svelte +2 -0
- package/package/components/DBManager.svelte.d.ts +3 -3
- package/package/components/DBManagerDrawer.svelte.d.ts +3 -3
- package/package/components/DBSchemaExplorer.svelte.d.ts +3 -3
- package/package/components/DBTable.svelte.d.ts +3 -3
- package/package/components/DBTableEditor.svelte +9 -12
- package/package/components/DBTableEditor.svelte.d.ts +3 -3
- package/package/components/DateTimeInput.svelte +19 -13
- package/package/components/DateTimeInput.svelte.d.ts +5 -0
- package/package/components/DucklakePicker.svelte +32 -0
- package/package/components/DucklakePicker.svelte.d.ts +13 -0
- package/package/components/Editor.svelte +1 -1
- package/package/components/EditorBar.svelte +14 -1
- package/package/components/FakeMonacoPlaceHolder.svelte +1 -1
- package/package/components/FlowGraphViewerStep.svelte +1 -1
- package/package/components/FlowPreviewContent.svelte +1 -1
- package/package/components/HighlightCode.svelte +21 -10
- package/package/components/HighlightCode.svelte.d.ts +12 -22
- package/package/components/InputTransformForm.svelte +9 -41
- package/package/components/InstanceSetting.svelte +1 -6
- package/package/components/ResourceEditor.svelte +1 -1
- package/package/components/ResourcePicker.svelte +0 -5
- package/package/components/apps/components/display/dbtable/AppDbExplorer.svelte +50 -34
- package/package/components/apps/components/display/dbtable/DbExplorerCount.svelte +7 -5
- package/package/components/apps/components/display/dbtable/DbExplorerCount.svelte.d.ts +2 -2
- package/package/components/apps/components/display/dbtable/DeleteRow.svelte +2 -2
- package/package/components/apps/components/display/dbtable/DeleteRow.svelte.d.ts +3 -2
- package/package/components/apps/components/display/dbtable/InsertRow.svelte +13 -7
- package/package/components/apps/components/display/dbtable/InsertRowRunnable.svelte +6 -3
- package/package/components/apps/components/display/dbtable/InsertRowRunnable.svelte.d.ts +2 -1
- package/package/components/apps/components/display/dbtable/UpdateCell.svelte +2 -2
- package/package/components/apps/components/display/dbtable/UpdateCell.svelte.d.ts +3 -2
- package/package/components/apps/components/display/dbtable/queries/count.d.ts +2 -1
- package/package/components/apps/components/display/dbtable/queries/count.js +28 -18
- package/package/components/apps/components/display/dbtable/queries/createTable.d.ts +1 -1
- package/package/components/apps/components/display/dbtable/queries/createTable.js +1 -1
- package/package/components/apps/components/display/dbtable/queries/delete.d.ts +2 -1
- package/package/components/apps/components/display/dbtable/queries/delete.js +19 -10
- package/package/components/apps/components/display/dbtable/queries/insert.d.ts +2 -1
- package/package/components/apps/components/display/dbtable/queries/insert.js +16 -10
- package/package/components/apps/components/display/dbtable/queries/select.d.ts +2 -1
- package/package/components/apps/components/display/dbtable/queries/select.js +20 -16
- package/package/components/apps/components/display/dbtable/queries/update.d.ts +2 -1
- package/package/components/apps/components/display/dbtable/queries/update.js +19 -10
- package/package/components/apps/components/display/dbtable/utils.d.ts +1 -1
- package/package/components/apps/components/display/dbtable/utils.js +12 -3
- package/package/components/apps/components/display/table/AppAggridExplorerTable.svelte +9 -1
- package/package/components/apps/components/display/table/AppAggridExplorerTable.svelte.d.ts +1 -0
- package/package/components/apps/components/display/table/AppAggridInfiniteTable.svelte +2 -1
- package/package/components/apps/components/display/table/AppAggridInfiniteTable.svelte.d.ts +1 -0
- package/package/components/apps/components/display/table/AppAggridInfiniteTableEe.svelte +2 -1
- package/package/components/apps/components/display/table/AppAggridInfiniteTableEe.svelte.d.ts +1 -0
- package/package/components/apps/components/display/table/AppAggridTable.svelte +9 -1
- package/package/components/apps/components/display/table/AppAggridTable.svelte.d.ts +1 -0
- package/package/components/apps/components/display/table/AppAggridTableEe.svelte +2 -1
- package/package/components/apps/components/display/table/AppAggridTableEe.svelte.d.ts +1 -0
- package/package/components/apps/components/helpers/RunnableComponent.svelte +3 -1
- package/package/components/apps/components/inputs/AppDateInput.svelte +1 -0
- package/package/components/apps/editor/AppEditor.svelte +6 -1
- package/package/components/apps/editor/AppEditorHeader.svelte +12 -8
- package/package/components/apps/editor/AppJobsDrawer.svelte +5 -5
- package/package/components/apps/editor/component/ComponentInner.svelte +4 -0
- package/package/components/apps/editor/component/components.d.ts +16 -0
- package/package/components/apps/editor/component/components.js +17 -1
- package/package/components/apps/editor/settingsPanel/AGChartRichEditor.svelte.d.ts +3 -3
- package/package/components/apps/editor/settingsPanel/CSSMigrationModal.svelte.d.ts +3 -3
- package/package/components/apps/editor/settingsPanel/ChartJSRichEditor.svelte.d.ts +3 -3
- package/package/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte +23 -23
- package/package/components/apps/editor/settingsPanel/EventHandlers.svelte +7 -2
- package/package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +1 -0
- package/package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +2 -1
- package/package/components/apps/editor/settingsPanel/inputEditor/DBTableSelect.svelte.d.ts +3 -3
- package/package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +10 -0
- package/package/components/apps/inputType.d.ts +2 -2
- package/package/components/auditLogs/AuditLogsFilters.svelte.d.ts +1 -1
- package/package/components/common/button/ConnectionButton.svelte +12 -14
- package/package/components/common/button/ConnectionButton.svelte.d.ts +5 -18
- package/package/components/copilot/AIFormAssistant.svelte.d.ts +3 -3
- package/package/components/copilot/AIFormSettings.svelte.d.ts +3 -3
- package/package/components/copilot/FlowInlineScriptAIButton.svelte.d.ts +3 -3
- package/package/components/copilot/StepInputsGen.svelte +1 -1
- package/package/components/copilot/TestAIKey.svelte.d.ts +3 -3
- package/package/components/copilot/chat/AIChat.svelte.d.ts +3 -3
- package/package/components/copilot/chat/AIChatDisplay.svelte.d.ts +3 -3
- package/package/components/copilot/chat/AIChatInlineWidget.svelte.d.ts +3 -3
- package/package/components/copilot/chat/AIChatInput.svelte.d.ts +3 -3
- package/package/components/copilot/chat/AIChatMessage.svelte.d.ts +3 -3
- package/package/components/copilot/chat/ContextElementBadge.svelte +2 -2
- package/package/components/copilot/chat/flow/AIChangesWarningModal.svelte.d.ts +3 -3
- package/package/components/copilot/chat/flow/FlowAIButton.svelte.d.ts +3 -3
- package/package/components/copilot/chat/flow/FlowAIChat.svelte +4 -1
- package/package/components/copilot/chat/flow/FlowAIChat.svelte.d.ts +3 -3
- package/package/components/copilot/chat/script/CodeDisplay.svelte +30 -9
- package/package/components/copilot/chat/script/core.d.ts +2 -1
- package/package/components/copilot/chat/script/core.js +6 -1
- package/package/components/details/DetailPageLayout.svelte +11 -3
- package/package/components/details/DetailPageLayout.svelte.d.ts +1 -0
- package/package/components/flows/content/DynamicInputHelpBox.svelte +4 -4
- package/package/components/flows/content/FlowInput.svelte +1 -1
- package/package/components/flows/content/FlowInputsQuick.svelte +1 -1
- package/package/components/flows/content/FlowLoop.svelte +143 -10
- package/package/components/flows/conversations/FlowChatInterface.svelte +110 -0
- package/package/components/flows/{FlowChatInterface.svelte.d.ts → conversations/FlowChatInterface.svelte.d.ts} +1 -1
- package/package/components/flows/conversations/FlowChatManager.svelte.d.ts +52 -0
- package/package/components/flows/conversations/FlowChatManager.svelte.js +422 -0
- package/package/components/flows/conversations/FlowChatMessage.svelte +68 -0
- package/package/components/flows/{FlowChatMessage.svelte.d.ts → conversations/FlowChatMessage.svelte.d.ts} +2 -4
- package/package/components/flows/{FlowConversationsSidebar.svelte → conversations/FlowConversationsSidebar.svelte} +6 -6
- package/package/components/flows/flowInfers.js +1 -1
- package/package/components/flows/scheduleUtils.js +2 -1
- package/package/components/graph/renderers/nodes/AIToolNode.svelte.d.ts +3 -3
- package/package/components/graph/renderers/nodes/NewAIToolNode.svelte.d.ts +3 -3
- package/package/components/icons/CACertificate.svelte.d.ts +3 -3
- package/package/components/icons/MSSqlServerIcon.svelte.d.ts +3 -3
- package/package/components/icons/MSTeamsIcon.svelte.d.ts +3 -3
- package/package/components/icons/OracleDBIcon.svelte.d.ts +3 -3
- package/package/components/icons/PHPIcon.svelte.d.ts +3 -3
- package/package/components/icons/QRCodeIcon.svelte.d.ts +3 -3
- package/package/components/instanceSettings.js +11 -2
- package/package/components/runs/JobsLoader.svelte +3 -3
- package/package/components/runs/RunRow.svelte +1 -1
- package/package/components/schema/SchemaFormDND.svelte.d.ts +3 -3
- package/package/components/settings/AIUserSettings.svelte.d.ts +3 -3
- package/package/components/sidebar/SidebarContent.svelte +2 -2
- package/package/components/text_input/TextInput.svelte.d.ts +1 -1
- package/package/components/triggers/http/OpenAPISpecGenerator.svelte.d.ts +3 -3
- package/package/components/triggers/schedules/ScheduleEditorInner.svelte +42 -1
- package/package/components/vscode.js +16 -12
- package/package/components/wizards/ChartJSWizard.svelte.d.ts +3 -3
- package/package/components/wizards/DBExplorerWizard.svelte.d.ts +3 -3
- package/package/components/wizards/LoggedWizardResult.svelte +95 -0
- package/package/components/wizards/LoggedWizardResult.svelte.d.ts +17 -0
- package/package/components/workspaceSettings/AISettings.svelte.d.ts +3 -3
- package/package/components/workspaceSettings/DucklakeSettings.svelte +223 -89
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/schemas.gen.d.ts +73 -5
- package/package/gen/schemas.gen.js +73 -5
- package/package/gen/services.gen.d.ts +8 -8
- package/package/gen/services.gen.js +14 -12
- package/package/gen/types.gen.d.ts +69 -18
- package/package/svelte5Utils.svelte.d.ts +1 -0
- package/package/svelte5Utils.svelte.js +6 -0
- package/package/utils.js +2 -5
- package/package.json +11 -13
- package/package/components/flows/FlowChatInterface.svelte +0 -404
- package/package/components/flows/FlowChatMessage.svelte +0 -41
- package/package/components/meltComponents/Menubar.svelte.d.ts +0 -503
- /package/package/components/flows/{FlowConversationsSidebar.svelte.d.ts → conversations/FlowConversationsSidebar.svelte.d.ts} +0 -0
|
@@ -18,7 +18,7 @@ import { CancelablePromise } from '../../../../../gen';
|
|
|
18
18
|
import RefreshButton from '../../helpers/RefreshButton.svelte';
|
|
19
19
|
import RunnableWrapper from '../../helpers/RunnableWrapper.svelte';
|
|
20
20
|
import InsertRowDrawerButton from '../InsertRowDrawerButton.svelte';
|
|
21
|
-
import {
|
|
21
|
+
import { getDucklakeSchema } from '../../../../dbOps';
|
|
22
22
|
let { id, configuration, customCss = undefined, render, initializing = $bindable(undefined), actions = [] } = $props();
|
|
23
23
|
$effect.pre(() => {
|
|
24
24
|
if (initializing === undefined) {
|
|
@@ -53,7 +53,7 @@ function computeInput(columnDefs, whereClause, resource) {
|
|
|
53
53
|
timeoutInput = setTimeout(() => {
|
|
54
54
|
timeoutInput = undefined;
|
|
55
55
|
console.log('compute input');
|
|
56
|
-
input = getSelectInput(
|
|
56
|
+
input = getSelectInput(dbInput, resolvedConfig.type.configuration[resolvedConfig.type.selected].table, columnDefs, whereClause);
|
|
57
57
|
}, 1000);
|
|
58
58
|
}
|
|
59
59
|
const { app, worldStore, mode, selectedComponent } = getContext('AppViewerContext');
|
|
@@ -68,9 +68,23 @@ let renderCount = $state(0);
|
|
|
68
68
|
let insertDrawer = undefined;
|
|
69
69
|
let componentContainerHeight = $state(undefined);
|
|
70
70
|
let buttonContainerHeight = $state(undefined);
|
|
71
|
+
let dbPath = $derived(resolvedConfig.type.selected !== 'ducklake'
|
|
72
|
+
? resolvedConfig.type.configuration?.[resolvedConfig.type.selected]?.resource
|
|
73
|
+
: resolvedConfig.type.configuration?.[resolvedConfig.type.selected]?.ducklake);
|
|
74
|
+
let dbInput = $derived(resolvedConfig.type.selected === 'ducklake'
|
|
75
|
+
? {
|
|
76
|
+
type: 'ducklake',
|
|
77
|
+
ducklake: dbPath.split('ducklake://')[1]
|
|
78
|
+
}
|
|
79
|
+
: {
|
|
80
|
+
type: 'database',
|
|
81
|
+
resourcePath: dbPath.split('$res:')[1],
|
|
82
|
+
resourceType: resolvedConfig.type.selected
|
|
83
|
+
});
|
|
84
|
+
let dbtype = $derived(resolvedConfig.type.selected === 'ducklake' ? 'duckdb' : resolvedConfig.type.selected);
|
|
71
85
|
function onUpdate(e) {
|
|
72
86
|
const { columnDef, value, data, oldValue } = e.detail;
|
|
73
|
-
updateCell?.triggerUpdate(
|
|
87
|
+
updateCell?.triggerUpdate(dbInput, resolvedConfig.type.configuration[resolvedConfig.type.selected].table ?? 'unknown', columnDef, resolvedConfig.columnDefs, value, data, oldValue);
|
|
74
88
|
}
|
|
75
89
|
let outputs = initOutput($worldStore, id, {
|
|
76
90
|
selectedRowIndex: 0,
|
|
@@ -98,33 +112,34 @@ function updateOneOfConfiguration(oneOfConfiguration, resolvedConfig, patch) {
|
|
|
98
112
|
});
|
|
99
113
|
}
|
|
100
114
|
async function listTables() {
|
|
101
|
-
|
|
102
|
-
if (!resource)
|
|
115
|
+
if (!dbPath)
|
|
103
116
|
return;
|
|
104
|
-
if (lastResource ===
|
|
117
|
+
if (lastResource === dbPath)
|
|
105
118
|
return;
|
|
106
|
-
lastResource =
|
|
119
|
+
lastResource = dbPath;
|
|
107
120
|
const gridItem = findGridItem($app, id);
|
|
108
|
-
if (!gridItem)
|
|
121
|
+
if (!gridItem)
|
|
109
122
|
return;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
table: {
|
|
113
|
-
selectOptions: [],
|
|
114
|
-
loading: true
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
if (!resolvedConfig.type?.configuration?.[resolvedConfig.type.selected]?.resource) {
|
|
123
|
+
updateOneOfConfiguration(gridItem.data.configuration.type, resolvedConfig.type, { table: { selectOptions: [], loading: true } });
|
|
124
|
+
if (!dbPath) {
|
|
118
125
|
$app = $app;
|
|
119
126
|
return;
|
|
120
127
|
}
|
|
121
128
|
try {
|
|
122
129
|
const dbSchemas = {};
|
|
123
|
-
|
|
130
|
+
if (resolvedConfig?.type?.selected === 'ducklake') {
|
|
131
|
+
dbSchemas[dbPath] = await getDucklakeSchema({
|
|
132
|
+
workspace: $workspaceStore,
|
|
133
|
+
ducklake: dbPath.split('ducklake://')[1]
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
await getDbSchemas(resolvedConfig?.type?.selected, dbPath.split('$res:')[1], $workspaceStore, dbSchemas, () => { });
|
|
138
|
+
}
|
|
124
139
|
updateOneOfConfiguration(gridItem.data.configuration.type, resolvedConfig.type, {
|
|
125
140
|
table: {
|
|
126
141
|
selectOptions: dbSchemas
|
|
127
|
-
? await getTablesByResource(dbSchemas,
|
|
142
|
+
? await getTablesByResource(dbSchemas, dbtype, dbPath, $workspaceStore)
|
|
128
143
|
: [],
|
|
129
144
|
loading: false
|
|
130
145
|
}
|
|
@@ -225,13 +240,16 @@ async function listColumnsIfAvailable() {
|
|
|
225
240
|
gridItem.data.configuration.columnDefs.loading = true;
|
|
226
241
|
gridItem.data = gridItem.data;
|
|
227
242
|
$app = $app;
|
|
228
|
-
let
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
243
|
+
let tableMetadata = await loadTableMetaData(resolvedConfig.type.selected === 'ducklake'
|
|
244
|
+
? {
|
|
245
|
+
type: 'ducklake',
|
|
246
|
+
ducklake: dbPath.split('ducklake://')[1]
|
|
247
|
+
}
|
|
248
|
+
: {
|
|
249
|
+
type: 'database',
|
|
250
|
+
resourcePath: dbPath.split('$res:')[1],
|
|
251
|
+
resourceType: dbtype
|
|
252
|
+
}, $workspaceStore, resolvedConfig.type.configuration[selected].table);
|
|
235
253
|
if (!tableMetadata)
|
|
236
254
|
return;
|
|
237
255
|
let old = columnDefs?.value ?? [];
|
|
@@ -339,7 +357,7 @@ function connectToComponents() {
|
|
|
339
357
|
async function insert(args) {
|
|
340
358
|
try {
|
|
341
359
|
const selected = resolvedConfig.type.selected;
|
|
342
|
-
await insertRowRunnable?.insertRow(
|
|
360
|
+
await insertRowRunnable?.insertRow(dbInput, $workspaceStore, resolvedConfig.type.configuration[selected].table, resolvedConfig.columnDefs, args);
|
|
343
361
|
insertDrawer?.closeDrawer();
|
|
344
362
|
renderCount++;
|
|
345
363
|
}
|
|
@@ -355,8 +373,7 @@ let dbExplorerCount = $state(undefined);
|
|
|
355
373
|
function onDelete(e) {
|
|
356
374
|
const data = { ...e.detail };
|
|
357
375
|
delete data['__index'];
|
|
358
|
-
|
|
359
|
-
deleteRow?.triggerDelete(resolvedConfig.type.configuration[selected].resource, resolvedConfig.type.configuration[selected].table ?? 'unknown', resolvedConfig.columnDefs, data, selected);
|
|
376
|
+
deleteRow?.triggerDelete(dbInput, resolvedConfig.type.configuration[resolvedConfig.type.selected].table ?? 'unknown', resolvedConfig.columnDefs, data);
|
|
360
377
|
}
|
|
361
378
|
let refreshCount = $state(0);
|
|
362
379
|
let loading = $state(false);
|
|
@@ -370,14 +387,14 @@ $effect(() => {
|
|
|
370
387
|
resolvedConfig.type.selected &&
|
|
371
388
|
render &&
|
|
372
389
|
untrack(() => {
|
|
373
|
-
computeInput(resolvedConfig.columnDefs, resolvedConfig.whereClause,
|
|
390
|
+
computeInput(resolvedConfig.columnDefs, resolvedConfig.whereClause, dbPath);
|
|
374
391
|
});
|
|
375
392
|
});
|
|
376
393
|
$effect(() => {
|
|
377
394
|
editorContext != undefined &&
|
|
378
395
|
$mode == 'dnd' &&
|
|
379
396
|
resolvedConfig.type &&
|
|
380
|
-
|
|
397
|
+
dbPath &&
|
|
381
398
|
untrack(() => listTables());
|
|
382
399
|
});
|
|
383
400
|
$effect(() => {
|
|
@@ -440,8 +457,7 @@ let hideInsert = $derived(resolvedConfig.hideInsert);
|
|
|
440
457
|
{id}
|
|
441
458
|
{quicksearch}
|
|
442
459
|
{table}
|
|
443
|
-
|
|
444
|
-
resourceType={resolvedConfig?.type?.selected}
|
|
460
|
+
{dbInput}
|
|
445
461
|
columnDefs={resolvedConfig?.columnDefs}
|
|
446
462
|
whereClause={resolvedConfig?.whereClause}
|
|
447
463
|
/>
|
|
@@ -484,14 +500,14 @@ let hideInsert = $derived(resolvedConfig.hideInsert);
|
|
|
484
500
|
{#if hideInsert !== true}
|
|
485
501
|
<InsertRowDrawerButton
|
|
486
502
|
columnDefs={resolvedConfig.columnDefs}
|
|
487
|
-
dbType={
|
|
503
|
+
dbType={dbtype}
|
|
488
504
|
onInsert={(args) => insert(args)}
|
|
489
505
|
/>
|
|
490
506
|
{/if}
|
|
491
507
|
</div>
|
|
492
508
|
</div>
|
|
493
509
|
{/if}
|
|
494
|
-
{#if
|
|
510
|
+
{#if dbPath && resolvedConfig.type.configuration?.[resolvedConfig?.type?.selected]?.table}
|
|
495
511
|
<!-- {JSON.stringify(lastInput)} -->
|
|
496
512
|
<!-- <span class="text-xs">{JSON.stringify(configuration.columnDefs)}</span> -->
|
|
497
513
|
{#key renderCount && render}
|
|
@@ -3,7 +3,7 @@ import RunnableWrapper from '../../helpers/RunnableWrapper.svelte';
|
|
|
3
3
|
import { initOutput } from '../../../editor/appUtils';
|
|
4
4
|
import {} from './utils';
|
|
5
5
|
import { getCountInput } from './queries/count';
|
|
6
|
-
let { id, table,
|
|
6
|
+
let { id, table, renderCount, quicksearch, dbInput, columnDefs, whereClause } = $props();
|
|
7
7
|
const { worldStore } = getContext('AppViewerContext');
|
|
8
8
|
let outputs = initOutput($worldStore, `${id}_count`, {
|
|
9
9
|
result: undefined,
|
|
@@ -32,15 +32,17 @@ export async function computeCount(forceCompute) {
|
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
if (table != undefined &&
|
|
35
|
+
if (table != undefined &&
|
|
36
|
+
((dbInput.type == 'ducklake' && dbInput.ducklake !== undefined) ||
|
|
37
|
+
(dbInput.type == 'database' && dbInput.resourcePath !== undefined))) {
|
|
36
38
|
renderCountLast = renderCount;
|
|
37
39
|
lastTableCount = table;
|
|
38
40
|
quicksearchLast = quicksearch;
|
|
39
|
-
await getCount(
|
|
41
|
+
await getCount(dbInput, table, quicksearch);
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
async function getCount(
|
|
43
|
-
input = getCountInput(
|
|
44
|
+
async function getCount(dbInput, table, quicksearch) {
|
|
45
|
+
input = getCountInput(dbInput, table, localColumnDefs, whereClause);
|
|
44
46
|
await tick();
|
|
45
47
|
if (runnableComponent) {
|
|
46
48
|
await runnableComponent?.runComponent(undefined, undefined, undefined, {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type ColumnDef } from './utils';
|
|
2
|
+
import type { DbInput } from '../../../../dbOps';
|
|
2
3
|
interface Props {
|
|
3
4
|
id: string;
|
|
4
5
|
table: string | undefined;
|
|
5
|
-
resource: string | undefined;
|
|
6
6
|
renderCount: number;
|
|
7
7
|
quicksearch: string;
|
|
8
|
-
resourceType: string;
|
|
9
8
|
columnDefs: ColumnDef[];
|
|
10
9
|
whereClause: string | undefined;
|
|
10
|
+
dbInput: DbInput;
|
|
11
11
|
}
|
|
12
12
|
declare const DbExplorerCount: import("svelte").Component<Props, {
|
|
13
13
|
computeCount: (forceCompute?: boolean | undefined) => Promise<void>;
|
|
@@ -15,10 +15,10 @@ let runnableComponent = $state();
|
|
|
15
15
|
let loading = $state(false);
|
|
16
16
|
let input = $state(undefined);
|
|
17
17
|
const dispatch = createEventDispatcher();
|
|
18
|
-
export async function triggerDelete(
|
|
18
|
+
export async function triggerDelete(dbInput, table, allColumns, data) {
|
|
19
19
|
let primaryColumns = getPrimaryKeys(allColumns);
|
|
20
20
|
let columns = allColumns?.filter((x) => primaryColumns.includes(x.field));
|
|
21
|
-
input = getDeleteInput(
|
|
21
|
+
input = getDeleteInput(dbInput, table, columns);
|
|
22
22
|
await tick();
|
|
23
23
|
if (runnableComponent) {
|
|
24
24
|
let ndata = {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type ColumnDef
|
|
1
|
+
import { type ColumnDef } from './utils';
|
|
2
|
+
import type { DbInput } from '../../../../dbOps';
|
|
2
3
|
interface Props {
|
|
3
4
|
id: string;
|
|
4
5
|
}
|
|
@@ -20,7 +21,7 @@ declare const DeleteRow: $$__sveltets_2_IsomorphicComponent<Props, {
|
|
|
20
21
|
} & {
|
|
21
22
|
[evt: string]: CustomEvent<any>;
|
|
22
23
|
}, {}, {
|
|
23
|
-
triggerDelete: (
|
|
24
|
+
triggerDelete: (dbInput: DbInput, table: string, allColumns: ColumnDef[], data: Record<string, any>) => Promise<void>;
|
|
24
25
|
}, "">;
|
|
25
26
|
type DeleteRow = InstanceType<typeof DeleteRow>;
|
|
26
27
|
export default DeleteRow;
|
|
@@ -6,7 +6,7 @@ import { argSigToJsonSchemaType } from 'windmill-utils-internal';
|
|
|
6
6
|
import SchemaForm from '../../../../SchemaForm.svelte';
|
|
7
7
|
import { untrack } from 'svelte';
|
|
8
8
|
import Toggle from '../../../../Toggle.svelte';
|
|
9
|
-
|
|
9
|
+
import { usePromise } from '../../../../../svelte5Utils.svelte';
|
|
10
10
|
function parseSQLArgs(field, dbType) {
|
|
11
11
|
let rawType = '';
|
|
12
12
|
switch (dbType) {
|
|
@@ -46,11 +46,11 @@ function rawTypeToSchemaType(typ) {
|
|
|
46
46
|
return typ;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
49
|
+
async function buildSchema() {
|
|
50
50
|
const properties = {};
|
|
51
51
|
const required = [];
|
|
52
52
|
await init(wasmUrl);
|
|
53
|
-
fields
|
|
53
|
+
fields?.forEach((field) => {
|
|
54
54
|
const schemaProperty = {
|
|
55
55
|
type: 'string'
|
|
56
56
|
};
|
|
@@ -70,6 +70,12 @@ async function builtSchema(fields, dbType) {
|
|
|
70
70
|
schemaProperty.default = field.defaultValue;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
if (field.type === 'timestamp without time zone' || field.type === 'timestamp') {
|
|
74
|
+
schemaProperty.format = 'naive-date-time';
|
|
75
|
+
}
|
|
76
|
+
if (field.type === 'timestamp with time zone' || field.type === 'timestamptz') {
|
|
77
|
+
schemaProperty.format = 'date-time';
|
|
78
|
+
}
|
|
73
79
|
properties[field.name] = schemaProperty;
|
|
74
80
|
const isRequired = (field.isPrimaryKey || field.defaultValue === undefined || field.defaultValue === null) &&
|
|
75
81
|
field.nullable !== 'YES' &&
|
|
@@ -78,7 +84,7 @@ async function builtSchema(fields, dbType) {
|
|
|
78
84
|
required.push(field.name);
|
|
79
85
|
}
|
|
80
86
|
});
|
|
81
|
-
|
|
87
|
+
return {
|
|
82
88
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
83
89
|
type: 'object',
|
|
84
90
|
properties,
|
|
@@ -107,10 +113,10 @@ let fields = $derived(columnDefs
|
|
|
107
113
|
nullable: column.isnullable
|
|
108
114
|
};
|
|
109
115
|
}));
|
|
116
|
+
let schemaPromise = usePromise(buildSchema);
|
|
117
|
+
let schema = $derived(schemaPromise.value);
|
|
110
118
|
$effect(() => {
|
|
111
|
-
;
|
|
112
|
-
[fields, dbType];
|
|
113
|
-
untrack(() => builtSchema(fields ?? [], dbType));
|
|
119
|
+
fields && dbType && untrack(() => schemaPromise.refresh());
|
|
114
120
|
});
|
|
115
121
|
$effect(() => {
|
|
116
122
|
if (schema) {
|
|
@@ -15,11 +15,14 @@ let runnableComponent = $state();
|
|
|
15
15
|
let loading = $state(false);
|
|
16
16
|
let input = $state(undefined);
|
|
17
17
|
const dispatch = createEventDispatcher();
|
|
18
|
-
export async function insertRow(
|
|
19
|
-
if (
|
|
18
|
+
export async function insertRow(dbInput, workspace, table, columns, values) {
|
|
19
|
+
if ((dbInput.type == 'ducklake' && !dbInput.ducklake) ||
|
|
20
|
+
(dbInput.type == 'database' && !dbInput.resourcePath) ||
|
|
21
|
+
!table ||
|
|
22
|
+
!workspace) {
|
|
20
23
|
return false;
|
|
21
24
|
}
|
|
22
|
-
input = getInsertInput(table, columns
|
|
25
|
+
input = getInsertInput(dbInput, table, columns);
|
|
23
26
|
await tick();
|
|
24
27
|
if (runnableComponent) {
|
|
25
28
|
await runnableComponent?.runComponent(undefined, undefined, undefined, values, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ColumnDef } from './utils';
|
|
2
|
+
import type { DbInput } from '../../../../dbOps';
|
|
2
3
|
interface Props {
|
|
3
4
|
id: string;
|
|
4
5
|
}
|
|
@@ -20,7 +21,7 @@ declare const InsertRowRunnable: $$__sveltets_2_IsomorphicComponent<Props, {
|
|
|
20
21
|
} & {
|
|
21
22
|
[evt: string]: CustomEvent<any>;
|
|
22
23
|
}, {}, {
|
|
23
|
-
insertRow: (
|
|
24
|
+
insertRow: (dbInput: DbInput, workspace: string | undefined, table: string | undefined, columns: ColumnDef[], values: Record<string, any>) => Promise<boolean>;
|
|
24
25
|
}, "">;
|
|
25
26
|
type InsertRowRunnable = InstanceType<typeof InsertRowRunnable>;
|
|
26
27
|
export default InsertRowRunnable;
|
|
@@ -14,11 +14,11 @@ let outputs = initOutput($worldStore, `${id}_update`, {
|
|
|
14
14
|
let runnableComponent = $state(undefined);
|
|
15
15
|
let loading = $state(false);
|
|
16
16
|
let input = $state(undefined);
|
|
17
|
-
export async function triggerUpdate(
|
|
17
|
+
export async function triggerUpdate(dbInput, table, column, allColumns, valueToUpdate, data, oldValue = undefined) {
|
|
18
18
|
// const datatype = tableMetaData?.find((column) => column.isprimarykey)?.datatype
|
|
19
19
|
let primaryColumns = getPrimaryKeys(allColumns);
|
|
20
20
|
let columns = allColumns?.filter((x) => primaryColumns.includes(x.field));
|
|
21
|
-
input = getUpdateInput(
|
|
21
|
+
input = getUpdateInput(dbInput, table, column, columns);
|
|
22
22
|
await tick();
|
|
23
23
|
if (runnableComponent) {
|
|
24
24
|
let ndata = {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { type ColumnDef
|
|
1
|
+
import { type ColumnDef } from './utils';
|
|
2
|
+
import type { DbInput } from '../../../../dbOps';
|
|
2
3
|
interface Props {
|
|
3
4
|
id: string;
|
|
4
5
|
}
|
|
5
6
|
declare const UpdateCell: import("svelte").Component<Props, {
|
|
6
|
-
triggerUpdate: (
|
|
7
|
+
triggerUpdate: (dbInput: DbInput, table: string, column: ColumnDef, allColumns: ColumnDef[], valueToUpdate: string, data: Record<string, any>, oldValue?: string | undefined) => Promise<void>;
|
|
7
8
|
}, "">;
|
|
8
9
|
type UpdateCell = ReturnType<typeof UpdateCell>;
|
|
9
10
|
export default UpdateCell;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AppInput } from '../../../../inputType';
|
|
2
|
+
import { type DbInput } from '../../../../../dbOps';
|
|
2
3
|
import { type DbType } from '../utils';
|
|
3
4
|
import { type ColumnDef } from '../utils';
|
|
4
5
|
export declare function makeCountQuery(dbType: DbType, table: string, whereClause: string | undefined, columnDefs: ColumnDef[]): string;
|
|
5
|
-
export declare function getCountInput(
|
|
6
|
+
export declare function getCountInput(dbInput: DbInput, table: string, columnDefs: ColumnDef[], whereClause: string | undefined): AppInput | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { wrapDucklakeQuery } from '../../../../../dbOps';
|
|
1
2
|
import { buildParameters } from '../utils';
|
|
2
3
|
import { getLanguageByResourceType, buildVisibleFieldList } from '../utils';
|
|
3
4
|
export function makeCountQuery(dbType, table, whereClause = undefined, columnDefs) {
|
|
@@ -106,27 +107,34 @@ export function makeCountQuery(dbType, table, whereClause = undefined, columnDef
|
|
|
106
107
|
}
|
|
107
108
|
return query;
|
|
108
109
|
}
|
|
109
|
-
export function getCountInput(
|
|
110
|
-
if (
|
|
111
|
-
|
|
110
|
+
export function getCountInput(dbInput, table, columnDefs, whereClause) {
|
|
111
|
+
if ((dbInput.type == 'ducklake' && !dbInput.ducklake) ||
|
|
112
|
+
(dbInput.type == 'database' && !dbInput.resourcePath) ||
|
|
113
|
+
!table ||
|
|
114
|
+
!columnDefs?.length) {
|
|
112
115
|
return undefined;
|
|
113
116
|
}
|
|
114
|
-
const
|
|
117
|
+
const dbType = dbInput.type === 'ducklake' ? 'duckdb' : dbInput.resourceType;
|
|
118
|
+
let query = makeCountQuery(dbType, table, whereClause, columnDefs);
|
|
119
|
+
if (dbInput.type === 'ducklake')
|
|
120
|
+
query = wrapDucklakeQuery(query, dbInput.ducklake);
|
|
115
121
|
const updateRunnable = {
|
|
116
122
|
name: 'AppDbExplorer',
|
|
117
123
|
type: 'runnableByName',
|
|
118
124
|
inlineScript: {
|
|
119
125
|
content: query,
|
|
120
|
-
language: getLanguageByResourceType(
|
|
126
|
+
language: getLanguageByResourceType(dbType),
|
|
121
127
|
schema: {
|
|
122
128
|
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
123
|
-
properties:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
129
|
+
properties: dbInput.type === 'database'
|
|
130
|
+
? {
|
|
131
|
+
database: {
|
|
132
|
+
description: 'Database name',
|
|
133
|
+
type: 'object',
|
|
134
|
+
format: `resource-${dbType}`
|
|
135
|
+
}
|
|
128
136
|
}
|
|
129
|
-
|
|
137
|
+
: {},
|
|
130
138
|
required: ['database'],
|
|
131
139
|
type: 'object'
|
|
132
140
|
}
|
|
@@ -134,14 +142,16 @@ export function getCountInput(resource, table, resourceType, columnDefs, whereCl
|
|
|
134
142
|
};
|
|
135
143
|
const updateQuery = {
|
|
136
144
|
runnable: updateRunnable,
|
|
137
|
-
fields:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
145
|
+
fields: dbInput.type === 'database'
|
|
146
|
+
? {
|
|
147
|
+
database: {
|
|
148
|
+
type: 'static',
|
|
149
|
+
value: `$res:${dbInput.resourcePath}`,
|
|
150
|
+
fieldType: 'object',
|
|
151
|
+
format: `resource-${dbType}`
|
|
152
|
+
}
|
|
143
153
|
}
|
|
144
|
-
|
|
154
|
+
: {},
|
|
145
155
|
type: 'runnable',
|
|
146
156
|
fieldType: 'object'
|
|
147
157
|
};
|
|
@@ -17,7 +17,7 @@ type CreateTableValuesColumn = {
|
|
|
17
17
|
datatype: string;
|
|
18
18
|
primaryKey?: boolean;
|
|
19
19
|
defaultValue?: string;
|
|
20
|
-
|
|
20
|
+
nullable?: boolean;
|
|
21
21
|
datatype_length?: number;
|
|
22
22
|
};
|
|
23
23
|
export declare function makeCreateTableQuery(values: CreateTableValues, dbType: DbType, schema?: string): string;
|
|
@@ -5,7 +5,7 @@ export function makeCreateTableQuery(values, dbType, schema) {
|
|
|
5
5
|
const datatype = c.datatype_length ? `${c.datatype}(${c.datatype_length})` : c.datatype;
|
|
6
6
|
const defValue = c.defaultValue && formatDefaultValue(c.defaultValue, datatype, dbType);
|
|
7
7
|
let str = ` ${c.name} ${datatype}`;
|
|
8
|
-
if (c.
|
|
8
|
+
if (!c.nullable)
|
|
9
9
|
str += ' NOT NULL';
|
|
10
10
|
if (defValue)
|
|
11
11
|
str += ` DEFAULT ${defValue}`;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AppInput } from '../../../../inputType';
|
|
2
|
+
import { type DbInput } from '../../../../../dbOps';
|
|
2
3
|
import { type ColumnDef, type DbType } from '../utils';
|
|
3
4
|
export declare function makeDeleteQuery(table: string, columns: ColumnDef[], dbType: DbType): string;
|
|
4
|
-
export declare function getDeleteInput(
|
|
5
|
+
export declare function getDeleteInput(dbInput: DbInput, table: string, columns: ColumnDef[]): AppInput | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { wrapDucklakeQuery } from '../../../../../dbOps';
|
|
1
2
|
import { getLanguageByResourceType, buildParameters } from '../utils';
|
|
2
3
|
export function makeDeleteQuery(table, columns, dbType) {
|
|
3
4
|
let query = buildParameters(dbType === 'snowflake' ? columns.flatMap((c) => [c, c]) : columns, dbType);
|
|
@@ -48,15 +49,21 @@ export function makeDeleteQuery(table, columns, dbType) {
|
|
|
48
49
|
throw new Error('Unsupported database type');
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
|
-
export function getDeleteInput(
|
|
52
|
-
if (
|
|
52
|
+
export function getDeleteInput(dbInput, table, columns) {
|
|
53
|
+
if ((dbInput.type == 'ducklake' && !dbInput.ducklake) ||
|
|
54
|
+
(dbInput.type == 'database' && !dbInput.resourcePath) ||
|
|
55
|
+
!table) {
|
|
53
56
|
return undefined;
|
|
54
57
|
}
|
|
58
|
+
const dbType = dbInput.type === 'ducklake' ? 'duckdb' : dbInput.resourceType;
|
|
59
|
+
let query = makeDeleteQuery(table, columns, dbType);
|
|
60
|
+
if (dbInput.type === 'ducklake')
|
|
61
|
+
query = wrapDucklakeQuery(query, dbInput.ducklake);
|
|
55
62
|
const deleteRunnable = {
|
|
56
63
|
name: 'AppDbExplorer',
|
|
57
64
|
type: 'runnableByName',
|
|
58
65
|
inlineScript: {
|
|
59
|
-
content:
|
|
66
|
+
content: query,
|
|
60
67
|
language: getLanguageByResourceType(dbType),
|
|
61
68
|
schema: {
|
|
62
69
|
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
@@ -68,14 +75,16 @@ export function getDeleteInput(resource, table, columns, dbType) {
|
|
|
68
75
|
};
|
|
69
76
|
const deleteQuery = {
|
|
70
77
|
runnable: deleteRunnable,
|
|
71
|
-
fields:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
fields: dbInput.type == 'database'
|
|
79
|
+
? {
|
|
80
|
+
database: {
|
|
81
|
+
type: 'static',
|
|
82
|
+
value: `$res:${dbInput.resourcePath}`,
|
|
83
|
+
fieldType: 'object',
|
|
84
|
+
format: `resource-${dbType}`
|
|
85
|
+
}
|
|
77
86
|
}
|
|
78
|
-
|
|
87
|
+
: {},
|
|
79
88
|
type: 'runnable',
|
|
80
89
|
fieldType: 'object'
|
|
81
90
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AppInput } from '../../../../inputType';
|
|
2
|
+
import { type DbInput } from '../../../../../dbOps';
|
|
2
3
|
import { type DbType } from '../utils';
|
|
3
4
|
import { type ColumnDef } from '../utils';
|
|
4
5
|
export declare function makeInsertQuery(table: string, columns: ColumnDef[], dbType: DbType): string;
|
|
5
|
-
export declare function getInsertInput(table: string, columns: ColumnDef[]
|
|
6
|
+
export declare function getInsertInput(dbInput: DbInput, table: string, columns: ColumnDef[]): AppInput;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { wrapDucklakeQuery } from '../../../../../dbOps';
|
|
1
2
|
import { buildParameters, ColumnIdentity } from '../utils';
|
|
2
3
|
import { getLanguageByResourceType } from '../utils';
|
|
3
4
|
function formatInsertValues(columns, dbType, startIndex = 1) {
|
|
@@ -80,16 +81,19 @@ export function makeInsertQuery(table, columns, dbType) {
|
|
|
80
81
|
const defaultValues = formatDefaultValues(columnsDefault);
|
|
81
82
|
const commaOrEmpty = shouldInsertComma ? ', ' : '';
|
|
82
83
|
query += `INSERT INTO ${table} (${columnNames}) VALUES (${insertValues}${commaOrEmpty}${defaultValues})`;
|
|
83
|
-
console.log(query);
|
|
84
84
|
return query;
|
|
85
85
|
}
|
|
86
|
-
export function getInsertInput(table, columns
|
|
86
|
+
export function getInsertInput(dbInput, table, columns) {
|
|
87
|
+
const dbType = dbInput.type === 'ducklake' ? 'duckdb' : dbInput.resourceType;
|
|
88
|
+
let query = makeInsertQuery(table, columns, dbType);
|
|
89
|
+
if (dbInput.type === 'ducklake')
|
|
90
|
+
query = wrapDucklakeQuery(query, dbInput.ducklake);
|
|
87
91
|
return {
|
|
88
92
|
runnable: {
|
|
89
93
|
name: 'AppDbExplorer',
|
|
90
94
|
type: 'runnableByName',
|
|
91
95
|
inlineScript: {
|
|
92
|
-
content:
|
|
96
|
+
content: query,
|
|
93
97
|
language: getLanguageByResourceType(dbType),
|
|
94
98
|
schema: {
|
|
95
99
|
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
@@ -99,14 +103,16 @@ export function getInsertInput(table, columns, resource, dbType) {
|
|
|
99
103
|
}
|
|
100
104
|
}
|
|
101
105
|
},
|
|
102
|
-
fields:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
fields: dbInput.type === 'database'
|
|
107
|
+
? {
|
|
108
|
+
database: {
|
|
109
|
+
type: 'static',
|
|
110
|
+
value: `$res:${dbInput.resourcePath}`,
|
|
111
|
+
fieldType: 'object',
|
|
112
|
+
format: `resource-${dbType}`
|
|
113
|
+
}
|
|
108
114
|
}
|
|
109
|
-
|
|
115
|
+
: {},
|
|
110
116
|
type: 'runnable',
|
|
111
117
|
fieldType: 'object'
|
|
112
118
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { AppInput } from '../../../../inputType';
|
|
2
|
+
import { type DbInput } from '../../../../../dbOps';
|
|
2
3
|
import { type DbType } from '../utils';
|
|
3
4
|
import { type ColumnDef } from '../utils';
|
|
4
5
|
export declare function makeSelectQuery(table: string, columnDefs: ColumnDef[], whereClause: string | undefined, dbType: DbType, options?: {
|
|
5
6
|
limit?: number;
|
|
6
7
|
offset?: number;
|
|
7
8
|
}): string;
|
|
8
|
-
export declare function getSelectInput(
|
|
9
|
+
export declare function getSelectInput(dbInput: DbInput, table: string | undefined, columnDefs: ColumnDef[], whereClause: string | undefined, options?: {
|
|
9
10
|
limit?: number;
|
|
10
11
|
offset?: number;
|
|
11
12
|
}): AppInput | undefined;
|