windmill-components 1.555.1 → 1.558.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/package/components/AIAgentLogViewer.svelte.d.ts +3 -3
  2. package/package/components/AIProviderPicker.svelte.d.ts +3 -3
  3. package/package/components/ArgInput.svelte +2 -0
  4. package/package/components/DBManager.svelte.d.ts +3 -3
  5. package/package/components/DBManagerDrawer.svelte.d.ts +3 -3
  6. package/package/components/DBSchemaExplorer.svelte.d.ts +3 -3
  7. package/package/components/DBTable.svelte.d.ts +3 -3
  8. package/package/components/DBTableEditor.svelte +9 -12
  9. package/package/components/DBTableEditor.svelte.d.ts +3 -3
  10. package/package/components/DateTimeInput.svelte +19 -13
  11. package/package/components/DateTimeInput.svelte.d.ts +5 -0
  12. package/package/components/DucklakePicker.svelte +32 -0
  13. package/package/components/DucklakePicker.svelte.d.ts +13 -0
  14. package/package/components/Editor.svelte +1 -1
  15. package/package/components/EditorBar.svelte +14 -1
  16. package/package/components/FakeMonacoPlaceHolder.svelte +1 -1
  17. package/package/components/FlowGraphViewerStep.svelte +1 -1
  18. package/package/components/FlowPreviewContent.svelte +1 -1
  19. package/package/components/HighlightCode.svelte +21 -10
  20. package/package/components/HighlightCode.svelte.d.ts +12 -22
  21. package/package/components/InputTransformForm.svelte +9 -41
  22. package/package/components/InstanceSetting.svelte +1 -6
  23. package/package/components/ResourceEditor.svelte +1 -1
  24. package/package/components/ResourcePicker.svelte +0 -5
  25. package/package/components/apps/components/display/dbtable/AppDbExplorer.svelte +50 -34
  26. package/package/components/apps/components/display/dbtable/DbExplorerCount.svelte +7 -5
  27. package/package/components/apps/components/display/dbtable/DbExplorerCount.svelte.d.ts +2 -2
  28. package/package/components/apps/components/display/dbtable/DeleteRow.svelte +2 -2
  29. package/package/components/apps/components/display/dbtable/DeleteRow.svelte.d.ts +3 -2
  30. package/package/components/apps/components/display/dbtable/InsertRow.svelte +13 -7
  31. package/package/components/apps/components/display/dbtable/InsertRowRunnable.svelte +6 -3
  32. package/package/components/apps/components/display/dbtable/InsertRowRunnable.svelte.d.ts +2 -1
  33. package/package/components/apps/components/display/dbtable/UpdateCell.svelte +2 -2
  34. package/package/components/apps/components/display/dbtable/UpdateCell.svelte.d.ts +3 -2
  35. package/package/components/apps/components/display/dbtable/queries/count.d.ts +2 -1
  36. package/package/components/apps/components/display/dbtable/queries/count.js +28 -18
  37. package/package/components/apps/components/display/dbtable/queries/createTable.d.ts +1 -1
  38. package/package/components/apps/components/display/dbtable/queries/createTable.js +1 -1
  39. package/package/components/apps/components/display/dbtable/queries/delete.d.ts +2 -1
  40. package/package/components/apps/components/display/dbtable/queries/delete.js +19 -10
  41. package/package/components/apps/components/display/dbtable/queries/insert.d.ts +2 -1
  42. package/package/components/apps/components/display/dbtable/queries/insert.js +16 -10
  43. package/package/components/apps/components/display/dbtable/queries/select.d.ts +2 -1
  44. package/package/components/apps/components/display/dbtable/queries/select.js +20 -16
  45. package/package/components/apps/components/display/dbtable/queries/update.d.ts +2 -1
  46. package/package/components/apps/components/display/dbtable/queries/update.js +19 -10
  47. package/package/components/apps/components/display/dbtable/utils.d.ts +1 -1
  48. package/package/components/apps/components/display/dbtable/utils.js +12 -3
  49. package/package/components/apps/components/display/table/AppAggridExplorerTable.svelte +9 -1
  50. package/package/components/apps/components/display/table/AppAggridExplorerTable.svelte.d.ts +1 -0
  51. package/package/components/apps/components/display/table/AppAggridInfiniteTable.svelte +2 -1
  52. package/package/components/apps/components/display/table/AppAggridInfiniteTable.svelte.d.ts +1 -0
  53. package/package/components/apps/components/display/table/AppAggridInfiniteTableEe.svelte +2 -1
  54. package/package/components/apps/components/display/table/AppAggridInfiniteTableEe.svelte.d.ts +1 -0
  55. package/package/components/apps/components/display/table/AppAggridTable.svelte +9 -1
  56. package/package/components/apps/components/display/table/AppAggridTable.svelte.d.ts +1 -0
  57. package/package/components/apps/components/display/table/AppAggridTableEe.svelte +2 -1
  58. package/package/components/apps/components/display/table/AppAggridTableEe.svelte.d.ts +1 -0
  59. package/package/components/apps/components/helpers/RunnableComponent.svelte +3 -1
  60. package/package/components/apps/components/inputs/AppDateInput.svelte +1 -0
  61. package/package/components/apps/editor/AppEditor.svelte +6 -1
  62. package/package/components/apps/editor/AppEditorHeader.svelte +12 -8
  63. package/package/components/apps/editor/AppJobsDrawer.svelte +5 -5
  64. package/package/components/apps/editor/component/ComponentInner.svelte +4 -0
  65. package/package/components/apps/editor/component/components.d.ts +16 -0
  66. package/package/components/apps/editor/component/components.js +17 -1
  67. package/package/components/apps/editor/settingsPanel/AGChartRichEditor.svelte.d.ts +3 -3
  68. package/package/components/apps/editor/settingsPanel/CSSMigrationModal.svelte.d.ts +3 -3
  69. package/package/components/apps/editor/settingsPanel/ChartJSRichEditor.svelte.d.ts +3 -3
  70. package/package/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte +23 -23
  71. package/package/components/apps/editor/settingsPanel/EventHandlers.svelte +7 -2
  72. package/package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +1 -0
  73. package/package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +2 -1
  74. package/package/components/apps/editor/settingsPanel/inputEditor/DBTableSelect.svelte.d.ts +3 -3
  75. package/package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +10 -0
  76. package/package/components/apps/inputType.d.ts +2 -2
  77. package/package/components/auditLogs/AuditLogsFilters.svelte.d.ts +1 -1
  78. package/package/components/common/button/ConnectionButton.svelte +12 -14
  79. package/package/components/common/button/ConnectionButton.svelte.d.ts +5 -18
  80. package/package/components/copilot/AIFormAssistant.svelte.d.ts +3 -3
  81. package/package/components/copilot/AIFormSettings.svelte.d.ts +3 -3
  82. package/package/components/copilot/FlowInlineScriptAIButton.svelte.d.ts +3 -3
  83. package/package/components/copilot/StepInputsGen.svelte +1 -1
  84. package/package/components/copilot/TestAIKey.svelte.d.ts +3 -3
  85. package/package/components/copilot/chat/AIChat.svelte.d.ts +3 -3
  86. package/package/components/copilot/chat/AIChatDisplay.svelte.d.ts +3 -3
  87. package/package/components/copilot/chat/AIChatInlineWidget.svelte.d.ts +3 -3
  88. package/package/components/copilot/chat/AIChatInput.svelte.d.ts +3 -3
  89. package/package/components/copilot/chat/AIChatMessage.svelte.d.ts +3 -3
  90. package/package/components/copilot/chat/ContextElementBadge.svelte +2 -2
  91. package/package/components/copilot/chat/flow/AIChangesWarningModal.svelte.d.ts +3 -3
  92. package/package/components/copilot/chat/flow/FlowAIButton.svelte.d.ts +3 -3
  93. package/package/components/copilot/chat/flow/FlowAIChat.svelte +4 -1
  94. package/package/components/copilot/chat/flow/FlowAIChat.svelte.d.ts +3 -3
  95. package/package/components/copilot/chat/script/CodeDisplay.svelte +30 -9
  96. package/package/components/copilot/chat/script/core.d.ts +2 -1
  97. package/package/components/copilot/chat/script/core.js +6 -1
  98. package/package/components/details/DetailPageLayout.svelte +11 -3
  99. package/package/components/details/DetailPageLayout.svelte.d.ts +1 -0
  100. package/package/components/flows/content/DynamicInputHelpBox.svelte +4 -4
  101. package/package/components/flows/content/FlowInput.svelte +1 -1
  102. package/package/components/flows/content/FlowInputsQuick.svelte +1 -1
  103. package/package/components/flows/content/FlowLoop.svelte +143 -10
  104. package/package/components/flows/conversations/FlowChatInterface.svelte +110 -0
  105. package/package/components/flows/{FlowChatInterface.svelte.d.ts → conversations/FlowChatInterface.svelte.d.ts} +1 -1
  106. package/package/components/flows/conversations/FlowChatManager.svelte.d.ts +52 -0
  107. package/package/components/flows/conversations/FlowChatManager.svelte.js +422 -0
  108. package/package/components/flows/conversations/FlowChatMessage.svelte +68 -0
  109. package/package/components/flows/{FlowChatMessage.svelte.d.ts → conversations/FlowChatMessage.svelte.d.ts} +2 -4
  110. package/package/components/flows/{FlowConversationsSidebar.svelte → conversations/FlowConversationsSidebar.svelte} +6 -6
  111. package/package/components/flows/flowInfers.js +1 -1
  112. package/package/components/flows/scheduleUtils.js +2 -1
  113. package/package/components/graph/renderers/nodes/AIToolNode.svelte.d.ts +3 -3
  114. package/package/components/graph/renderers/nodes/NewAIToolNode.svelte.d.ts +3 -3
  115. package/package/components/icons/CACertificate.svelte.d.ts +3 -3
  116. package/package/components/icons/MSSqlServerIcon.svelte.d.ts +3 -3
  117. package/package/components/icons/MSTeamsIcon.svelte.d.ts +3 -3
  118. package/package/components/icons/OracleDBIcon.svelte.d.ts +3 -3
  119. package/package/components/icons/PHPIcon.svelte.d.ts +3 -3
  120. package/package/components/icons/QRCodeIcon.svelte.d.ts +3 -3
  121. package/package/components/instanceSettings.js +11 -2
  122. package/package/components/runs/JobsLoader.svelte +3 -3
  123. package/package/components/runs/RunRow.svelte +1 -1
  124. package/package/components/schema/SchemaFormDND.svelte.d.ts +3 -3
  125. package/package/components/settings/AIUserSettings.svelte.d.ts +3 -3
  126. package/package/components/sidebar/SidebarContent.svelte +2 -2
  127. package/package/components/text_input/TextInput.svelte.d.ts +1 -1
  128. package/package/components/triggers/http/OpenAPISpecGenerator.svelte.d.ts +3 -3
  129. package/package/components/triggers/schedules/ScheduleEditorInner.svelte +42 -1
  130. package/package/components/vscode.js +16 -12
  131. package/package/components/wizards/ChartJSWizard.svelte.d.ts +3 -3
  132. package/package/components/wizards/DBExplorerWizard.svelte.d.ts +3 -3
  133. package/package/components/wizards/LoggedWizardResult.svelte +95 -0
  134. package/package/components/wizards/LoggedWizardResult.svelte.d.ts +17 -0
  135. package/package/components/workspaceSettings/AISettings.svelte.d.ts +3 -3
  136. package/package/components/workspaceSettings/DucklakeSettings.svelte +223 -89
  137. package/package/gen/core/OpenAPI.js +1 -1
  138. package/package/gen/schemas.gen.d.ts +73 -5
  139. package/package/gen/schemas.gen.js +73 -5
  140. package/package/gen/services.gen.d.ts +8 -8
  141. package/package/gen/services.gen.js +14 -12
  142. package/package/gen/types.gen.d.ts +69 -18
  143. package/package/svelte5Utils.svelte.d.ts +1 -0
  144. package/package/svelte5Utils.svelte.js +6 -0
  145. package/package/utils.js +2 -5
  146. package/package.json +10 -12
  147. package/package/components/flows/FlowChatInterface.svelte +0 -404
  148. package/package/components/flows/FlowChatMessage.svelte +0 -41
  149. package/package/components/meltComponents/Menubar.svelte.d.ts +0 -503
  150. /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 { assert } from '../../../../../utils';
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(resource, resolvedConfig.type.configuration[resolvedConfig.type.selected].table, columnDefs, whereClause, resolvedConfig.type.selected);
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(resolvedConfig.type.configuration[resolvedConfig.type.selected].resource, resolvedConfig.type.configuration[resolvedConfig.type.selected].table ?? 'unknown', columnDef, resolvedConfig.columnDefs, value, data, oldValue, resolvedConfig.type.selected);
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
- let resource = resolvedConfig.type.configuration?.[resolvedConfig.type.selected]?.resource;
102
- if (!resource)
115
+ if (!dbPath)
103
116
  return;
104
- if (lastResource === resource)
117
+ if (lastResource === dbPath)
105
118
  return;
106
- lastResource = resource;
119
+ lastResource = dbPath;
107
120
  const gridItem = findGridItem($app, id);
108
- if (!gridItem) {
121
+ if (!gridItem)
109
122
  return;
110
- }
111
- updateOneOfConfiguration(gridItem.data.configuration.type, resolvedConfig.type, {
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
- await getDbSchemas(resolvedConfig?.type?.selected, resolvedConfig.type.configuration[resolvedConfig?.type?.selected].resource.split(':')[1], $workspaceStore, dbSchemas, () => { });
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, resolvedConfig?.type?.selected, resource.split(':')[1], $workspaceStore)
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 resource = resolvedConfig.type.configuration[selected].resource;
229
- assert('resource starts with $res:', resource?.startsWith('$res:'), resource);
230
- let tableMetadata = await loadTableMetaData({
231
- type: 'database',
232
- resourcePath: resource.substring(5),
233
- resourceType: selected
234
- }, $workspaceStore, resolvedConfig.type.configuration[selected].table);
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(resolvedConfig.type.configuration[selected].resource, $workspaceStore, resolvedConfig.type.configuration[selected].table, resolvedConfig.columnDefs, args, selected);
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
- const selected = resolvedConfig.type.selected;
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, resolvedConfig.type.configuration[resolvedConfig.type.selected].resource);
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
- resolvedConfig.type.configuration?.[resolvedConfig.type.selected]?.resource &&
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
- resource={resolvedConfig?.type?.configuration?.[resolvedConfig?.type?.selected]?.resource}
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={resolvedConfig.type.selected}
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 resolvedConfig.type.configuration?.[resolvedConfig?.type?.selected]?.resource && resolvedConfig.type.configuration?.[resolvedConfig?.type?.selected]?.table}
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, resource, renderCount, quicksearch, resourceType, columnDefs, whereClause } = $props();
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 && resource !== 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(resource, table, quicksearch);
41
+ await getCount(dbInput, table, quicksearch);
40
42
  }
41
43
  }
42
- async function getCount(resource, table, quicksearch) {
43
- input = getCountInput(resource, table, resourceType, localColumnDefs, whereClause);
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(resource, table, allColumns, data, dbType) {
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(resource, table, columns, dbType);
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, type DbType } from './utils';
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: (resource: string, table: string, allColumns: ColumnDef[], data: Record<string, any>, dbType: DbType) => Promise<void>;
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
- let schema = $state(undefined);
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 builtSchema(fields, dbType) {
49
+ async function buildSchema() {
50
50
  const properties = {};
51
51
  const required = [];
52
52
  await init(wasmUrl);
53
- fields.forEach((field) => {
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
- schema = {
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(resource, workspace, table, columns, values, resourceType) {
19
- if (!resource || !table || !workspace) {
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, resource, resourceType);
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: (resource: string, workspace: string | undefined, table: string | undefined, columns: ColumnDef[], values: Record<string, any>, resourceType: string) => Promise<boolean>;
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(resource, table, column, allColumns, valueToUpdate, data, oldValue = undefined, dbType) {
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(resource, table, column, columns, dbType);
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, type DbType } from './utils';
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: (resource: string, table: string, column: ColumnDef, allColumns: ColumnDef[], valueToUpdate: string, data: Record<string, any>, oldValue: string | undefined, dbType: DbType) => Promise<void>;
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(resource: string, table: string, resourceType: DbType, columnDefs: ColumnDef[], whereClause: string | undefined): AppInput | undefined;
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(resource, table, resourceType, columnDefs, whereClause) {
110
- if (!resource || !table || !columnDefs) {
111
- // Return undefined if resource or table is not defined
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 query = makeCountQuery(resourceType, table, whereClause, columnDefs);
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(resourceType),
126
+ language: getLanguageByResourceType(dbType),
121
127
  schema: {
122
128
  $schema: 'https://json-schema.org/draft/2020-12/schema',
123
- properties: {
124
- database: {
125
- description: 'Database name',
126
- type: 'object',
127
- format: `resource-${resourceType}`
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
- database: {
139
- type: 'static',
140
- value: resource,
141
- fieldType: 'object',
142
- format: `resource-${resourceType}`
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
- not_null?: boolean;
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.not_null)
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(resource: string, table: string, columns: ColumnDef[], dbType: DbType): AppInput | undefined;
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(resource, table, columns, dbType) {
52
- if (!resource || !table) {
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: makeDeleteQuery(table, columns, dbType),
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
- database: {
73
- type: 'static',
74
- value: resource,
75
- fieldType: 'object',
76
- format: `resource-${dbType}`
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[], resource: string, dbType: DbType): AppInput;
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, resource, dbType) {
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: makeInsertQuery(table, columns, dbType),
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
- database: {
104
- type: 'static',
105
- value: resource,
106
- fieldType: 'object',
107
- format: `resource-${dbType}`
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(resource: string, table: string | undefined, columnDefs: ColumnDef[], whereClause: string | undefined, dbType: DbType, options?: {
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;