@datatechsolutions/ui 2.8.7 → 2.8.9

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 (76) hide show
  1. package/dist/{workflow → astrlabe}/graph-node.js +6 -6
  2. package/dist/{workflow → astrlabe}/graph-node.mjs +2 -2
  3. package/dist/{workflow → astrlabe}/index.d.mts +17 -4
  4. package/dist/{workflow → astrlabe}/index.d.ts +17 -4
  5. package/dist/{workflow → astrlabe}/index.js +139 -137
  6. package/dist/astrlabe/index.js.map +1 -0
  7. package/dist/{workflow → astrlabe}/index.mjs +13 -11
  8. package/dist/astrlabe/index.mjs.map +1 -0
  9. package/dist/{workflow → astrlabe}/utils.js +7 -7
  10. package/dist/{workflow → astrlabe}/utils.mjs +2 -2
  11. package/dist/{workflow → astrlabe}/workflow-canvas.d.mts +1 -1
  12. package/dist/{workflow → astrlabe}/workflow-canvas.d.ts +1 -1
  13. package/dist/{workflow → astrlabe}/workflow-canvas.js +6 -6
  14. package/dist/astrlabe/workflow-canvas.mjs +11 -0
  15. package/dist/{workflow → astrlabe}/workflow-preview-canvas.js.map +1 -1
  16. package/dist/{workflow → astrlabe}/workflow-preview-canvas.mjs.map +1 -1
  17. package/dist/{chunk-GXCWMPW5.js → chunk-2GTIYAXX.js} +3390 -670
  18. package/dist/chunk-2GTIYAXX.js.map +1 -0
  19. package/dist/{chunk-SHKRLL36.mjs → chunk-2X3BZNSE.mjs} +3234 -667
  20. package/dist/chunk-2X3BZNSE.mjs.map +1 -0
  21. package/dist/{chunk-E42PD4X6.js → chunk-3GE3MBUZ.js} +3 -3
  22. package/dist/{chunk-E42PD4X6.js.map → chunk-3GE3MBUZ.js.map} +1 -1
  23. package/dist/chunk-55H6WZQP.js +5 -0
  24. package/dist/{chunk-2HUN5ZXT.js.map → chunk-55H6WZQP.js.map} +1 -1
  25. package/dist/{chunk-BTJP5QCD.mjs → chunk-AM2TTPYM.mjs} +4 -4
  26. package/dist/{chunk-BTJP5QCD.mjs.map → chunk-AM2TTPYM.mjs.map} +1 -1
  27. package/dist/{chunk-55S2KOTZ.mjs → chunk-BLNXRUC4.mjs} +3 -3
  28. package/dist/{chunk-55S2KOTZ.mjs.map → chunk-BLNXRUC4.mjs.map} +1 -1
  29. package/dist/{chunk-ULPKAD4A.js → chunk-DFR6CMJH.js} +4 -4
  30. package/dist/{chunk-ULPKAD4A.js.map → chunk-DFR6CMJH.js.map} +1 -1
  31. package/dist/{chunk-D3INPADN.mjs → chunk-EOU3POSF.mjs} +422 -7
  32. package/dist/chunk-EOU3POSF.mjs.map +1 -0
  33. package/dist/chunk-JB6RNAD2.mjs +4 -0
  34. package/dist/{chunk-A3B3A43Y.mjs.map → chunk-JB6RNAD2.mjs.map} +1 -1
  35. package/dist/{chunk-UBCSCLUW.mjs → chunk-OZNTQROP.mjs} +3 -3
  36. package/dist/{chunk-UBCSCLUW.mjs.map → chunk-OZNTQROP.mjs.map} +1 -1
  37. package/dist/{chunk-NJ6PBGQM.js → chunk-P4YYEM4B.js} +3 -3
  38. package/dist/{chunk-NJ6PBGQM.js.map → chunk-P4YYEM4B.js.map} +1 -1
  39. package/dist/{chunk-Y2KJSGXS.js → chunk-ZN2F2VHX.js} +481 -66
  40. package/dist/chunk-ZN2F2VHX.js.map +1 -0
  41. package/dist/index.d.mts +342 -3
  42. package/dist/index.d.ts +342 -3
  43. package/dist/index.js +1194 -570
  44. package/dist/index.mjs +2 -2
  45. package/dist/{workflow-canvas-CVkbfTQu.d.ts → workflow-canvas-CGeuIgBQ.d.ts} +1 -1
  46. package/dist/{workflow-canvas-B3k03HVM.d.mts → workflow-canvas-at3LMbkg.d.mts} +1 -1
  47. package/package.json +25 -25
  48. package/dist/chunk-2HUN5ZXT.js +0 -5
  49. package/dist/chunk-A3B3A43Y.mjs +0 -4
  50. package/dist/chunk-D3INPADN.mjs.map +0 -1
  51. package/dist/chunk-GXCWMPW5.js.map +0 -1
  52. package/dist/chunk-SHKRLL36.mjs.map +0 -1
  53. package/dist/chunk-Y2KJSGXS.js.map +0 -1
  54. package/dist/workflow/index.js.map +0 -1
  55. package/dist/workflow/index.mjs.map +0 -1
  56. package/dist/workflow/workflow-canvas.mjs +0 -11
  57. /package/dist/{workflow → astrlabe}/contracts.d.mts +0 -0
  58. /package/dist/{workflow → astrlabe}/contracts.d.ts +0 -0
  59. /package/dist/{workflow → astrlabe}/contracts.js +0 -0
  60. /package/dist/{workflow → astrlabe}/contracts.js.map +0 -0
  61. /package/dist/{workflow → astrlabe}/contracts.mjs +0 -0
  62. /package/dist/{workflow → astrlabe}/contracts.mjs.map +0 -0
  63. /package/dist/{workflow → astrlabe}/graph-node.d.mts +0 -0
  64. /package/dist/{workflow → astrlabe}/graph-node.d.ts +0 -0
  65. /package/dist/{workflow → astrlabe}/graph-node.js.map +0 -0
  66. /package/dist/{workflow → astrlabe}/graph-node.mjs.map +0 -0
  67. /package/dist/{workflow → astrlabe}/utils.d.mts +0 -0
  68. /package/dist/{workflow → astrlabe}/utils.d.ts +0 -0
  69. /package/dist/{workflow → astrlabe}/utils.js.map +0 -0
  70. /package/dist/{workflow → astrlabe}/utils.mjs.map +0 -0
  71. /package/dist/{workflow → astrlabe}/workflow-canvas.js.map +0 -0
  72. /package/dist/{workflow → astrlabe}/workflow-canvas.mjs.map +0 -0
  73. /package/dist/{workflow → astrlabe}/workflow-preview-canvas.d.mts +0 -0
  74. /package/dist/{workflow → astrlabe}/workflow-preview-canvas.d.ts +0 -0
  75. /package/dist/{workflow → astrlabe}/workflow-preview-canvas.js +0 -0
  76. /package/dist/{workflow → astrlabe}/workflow-preview-canvas.mjs +0 -0
@@ -1,14 +1,14 @@
1
1
  "use client";
2
- import { EntityDrawer, ContextMenu, FormInput, FormTextarea, FormSelect, Button, Card, CardContent, IconButton, Input } from './chunk-SHKRLL36.mjs';
2
+ import { EntityDrawer, ContextMenu, FormInput, FormTextarea, FormSelect, Button, Card, CardContent, IconButton, Input } from './chunk-2X3BZNSE.mjs';
3
+ import { GraphNodeHeader, GraphNodeMeta, GraphNodeBadge, GraphNodeIconBubble } from './chunk-OZNTQROP.mjs';
4
+ import { getAgentTier, createDefaultLogicNodeConfig, applyDagreLayout } from './chunk-AM2TTPYM.mjs';
3
5
  import { useTranslations, I18nProvider, createI18nFromMessages } from './chunk-7VJ7CMMT.mjs';
4
- import { GraphNodeHeader, GraphNodeMeta, GraphNodeBadge, GraphNodeIconBubble } from './chunk-UBCSCLUW.mjs';
5
- import { getAgentTier, createDefaultLogicNodeConfig, applyDagreLayout } from './chunk-BTJP5QCD.mjs';
6
6
  import { memo, useState, useRef, useCallback, useEffect, lazy, createContext, useMemo, useContext } from 'react';
7
7
  import { Position, NodeResizer, MarkerType, useReactFlow, getBezierPath, BaseEdge, EdgeLabelRenderer, Handle, ReactFlowProvider, useNodesState, useEdgesState, addEdge, BackgroundVariant } from '@xyflow/react';
8
8
  import '@xyflow/react/dist/style.css';
9
9
  import { create } from 'zustand';
10
10
  import { PlusIcon, XMarkIcon } from '@heroicons/react/24/solid';
11
- import { Bars2Icon, CursorArrowRaysIcon, HandRaisedIcon, MagnifyingGlassPlusIcon, MagnifyingGlassMinusIcon, ArrowsPointingInIcon, ArrowUturnLeftIcon, ArrowUturnRightIcon, MapIcon, Squares2X2Icon, ArrowsRightLeftIcon, CommandLineIcon, ExclamationTriangleIcon, CpuChipIcon, TrashIcon, WrenchScrewdriverIcon, NewspaperIcon, ChartBarIcon, CloudIcon, ScaleIcon, AdjustmentsHorizontalIcon, CircleStackIcon, PlayIcon, StopIcon, ArrowsPointingOutIcon, CodeBracketIcon, GlobeAltIcon, DocumentTextIcon, ArrowPathIcon, BookOpenIcon, ChatBubbleLeftRightIcon, QuestionMarkCircleIcon, AdjustmentsVerticalIcon, Square3Stack3DIcon, DocumentMagnifyingGlassIcon, ListBulletIcon, PlayCircleIcon, PencilSquareIcon, RectangleGroupIcon, ChevronDownIcon, ChevronUpIcon, ServerStackIcon, PresentationChartBarIcon, ChartPieIcon, ChartBarSquareIcon, CurrencyDollarIcon, ShieldCheckIcon, ClipboardDocumentCheckIcon, FireIcon, ShoppingBagIcon, UsersIcon, BuildingStorefrontIcon, PencilIcon, DocumentDuplicateIcon, ClipboardDocumentIcon, ClipboardIcon, PlusIcon as PlusIcon$1, XMarkIcon as XMarkIcon$1 } from '@heroicons/react/24/outline';
11
+ import { Bars2Icon, CursorArrowRaysIcon, HandRaisedIcon, MagnifyingGlassPlusIcon, MagnifyingGlassMinusIcon, ArrowsPointingInIcon, ArrowUturnLeftIcon, ArrowUturnRightIcon, MapIcon, Squares2X2Icon, ArrowsRightLeftIcon, CommandLineIcon, ExclamationTriangleIcon, CpuChipIcon, TrashIcon, WrenchScrewdriverIcon, NewspaperIcon, ChartBarIcon, CloudIcon, ScaleIcon, AdjustmentsHorizontalIcon, CircleStackIcon, PlayIcon, StopIcon, ArrowsPointingOutIcon, CodeBracketIcon, GlobeAltIcon, DocumentTextIcon, ArrowPathIcon, BookOpenIcon, ChatBubbleLeftRightIcon, QuestionMarkCircleIcon, AdjustmentsVerticalIcon, Square3Stack3DIcon, DocumentMagnifyingGlassIcon, ListBulletIcon, PlayCircleIcon, PencilSquareIcon, ServerStackIcon, RectangleGroupIcon, ChevronDownIcon, ChevronUpIcon, PresentationChartBarIcon, ChartPieIcon, ChartBarSquareIcon, CurrencyDollarIcon, ShieldCheckIcon, ClipboardDocumentCheckIcon, FireIcon, ShoppingBagIcon, UsersIcon, BuildingStorefrontIcon, PencilIcon, DocumentDuplicateIcon, ClipboardDocumentIcon, ClipboardIcon, PlusIcon as PlusIcon$1, XMarkIcon as XMarkIcon$1 } from '@heroicons/react/24/outline';
12
12
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
13
13
 
14
14
  var DEFAULT_PASTE_OFFSET = 40;
@@ -2633,6 +2633,83 @@ var NoteFlowNode = memo(function NoteFlowNode2({ data, selected }) {
2633
2633
  }
2634
2634
  );
2635
2635
  });
2636
+ var DatasourceFlowNode = memo(function DatasourceFlowNode2({ id, data, selected }) {
2637
+ const t = useTranslations("agents.workflow");
2638
+ const { config, label, onEdit, onRemoveFromCanvas } = data;
2639
+ const isCompact = data.displayMode === "compact";
2640
+ if (!config || config.type !== "datasource") {
2641
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2642
+ /* @__PURE__ */ jsx(NodeRunningIndicator, { nodeId: id }),
2643
+ /* @__PURE__ */ jsx(WorkflowHandle, { type: "target", position: Position.Left, id: "left-in", colorClass: "!bg-cyan-400" }),
2644
+ /* @__PURE__ */ jsx(NodeCard, { variant: "error", nodeType: "datasource", children: /* @__PURE__ */ jsx(
2645
+ NodeCardHeader,
2646
+ {
2647
+ icon: /* @__PURE__ */ jsx(ExclamationTriangleIcon, { className: "h-5 w-5 text-white" }),
2648
+ title: label || t("datasourceNodeType"),
2649
+ description: t("datasourceNotConfigured"),
2650
+ iconClassName: "flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-amber-400 to-orange-500 shadow-lg"
2651
+ }
2652
+ ) }),
2653
+ /* @__PURE__ */ jsx(WorkflowHandle, { type: "source", position: Position.Right, id: "right-out", colorClass: "!bg-cyan-400" })
2654
+ ] });
2655
+ }
2656
+ const columnCount = config.selectedColumns?.length ?? 0;
2657
+ const filterCount = config.filterVariables ? Object.keys(config.filterVariables).length : 0;
2658
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2659
+ /* @__PURE__ */ jsx(NodeRunningIndicator, { nodeId: id }),
2660
+ /* @__PURE__ */ jsx(WorkflowHandle, { type: "target", position: Position.Left, id: "left-in", colorClass: "!bg-cyan-400" }),
2661
+ /* @__PURE__ */ jsx(
2662
+ "button",
2663
+ {
2664
+ type: "button",
2665
+ onClick: () => onEdit?.(id),
2666
+ className: "w-full text-left",
2667
+ children: /* @__PURE__ */ jsxs(NodeCard, { compact: isCompact, selected, nodeType: "datasource", children: [
2668
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
2669
+ /* @__PURE__ */ jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-cyan-500 to-blue-600 shadow-lg", children: /* @__PURE__ */ jsx(ServerStackIcon, { className: "h-5 w-5 text-white" }) }),
2670
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
2671
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-gray-900 dark:text-white", children: label }),
2672
+ !isCompact && /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs text-gray-500 dark:text-gray-400", children: config.table ?? config.datasourceId })
2673
+ ] })
2674
+ ] }),
2675
+ /* @__PURE__ */ jsxs(NodeCardMeta, { compact: isCompact, children: [
2676
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2677
+ config.dialect && /* @__PURE__ */ jsx(NodeCardBadge, { className: "inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300", children: config.dialect }),
2678
+ config.table && /* @__PURE__ */ jsx(NodeCardBadge, { className: "inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300", children: config.table }),
2679
+ columnCount > 0 && /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: [
2680
+ columnCount,
2681
+ " ",
2682
+ t("datasourceColumns")
2683
+ ] }),
2684
+ config.limit > 0 && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: t("datasourceLimit", { count: config.limit }) }),
2685
+ filterCount > 0 && /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: [
2686
+ filterCount,
2687
+ " ",
2688
+ t("datasourceFilters")
2689
+ ] })
2690
+ ] }),
2691
+ onRemoveFromCanvas && /* @__PURE__ */ jsx(
2692
+ "span",
2693
+ {
2694
+ role: "button",
2695
+ tabIndex: 0,
2696
+ onClick: (event) => {
2697
+ event.stopPropagation();
2698
+ event.preventDefault();
2699
+ onRemoveFromCanvas(id);
2700
+ },
2701
+ className: "nodrag nopan cursor-pointer rounded-lg p-1 opacity-0 transition hover:bg-red-50 group-hover:opacity-100 dark:hover:bg-red-900/20",
2702
+ "aria-label": t("removeFromCanvas"),
2703
+ children: /* @__PURE__ */ jsx(TrashIcon, { className: "h-3.5 w-3.5 text-red-600 dark:text-red-400" })
2704
+ }
2705
+ )
2706
+ ] })
2707
+ ] })
2708
+ }
2709
+ ),
2710
+ /* @__PURE__ */ jsx(WorkflowHandle, { type: "source", position: Position.Right, id: "right-out", colorClass: "!bg-cyan-400" })
2711
+ ] });
2712
+ });
2636
2713
  var GROUP_COLORS = {
2637
2714
  indigo: {
2638
2715
  border: "border-indigo-300/50 dark:border-indigo-600/50",
@@ -4555,6 +4632,328 @@ function EntityNodeConfigForm({ config, entities = [], onSave, onCancel }) {
4555
4632
  ] })
4556
4633
  ] });
4557
4634
  }
4635
+ var COLUMN_TYPE_BADGE_COLORS = {
4636
+ string: "bg-gray-100 text-gray-600 dark:bg-gray-500/20 dark:text-gray-300",
4637
+ varchar: "bg-gray-100 text-gray-600 dark:bg-gray-500/20 dark:text-gray-300",
4638
+ text: "bg-gray-100 text-gray-600 dark:bg-gray-500/20 dark:text-gray-300",
4639
+ integer: "bg-blue-100 text-blue-600 dark:bg-blue-500/20 dark:text-blue-300",
4640
+ int: "bg-blue-100 text-blue-600 dark:bg-blue-500/20 dark:text-blue-300",
4641
+ bigint: "bg-blue-100 text-blue-600 dark:bg-blue-500/20 dark:text-blue-300",
4642
+ number: "bg-blue-100 text-blue-600 dark:bg-blue-500/20 dark:text-blue-300",
4643
+ decimal: "bg-blue-100 text-blue-600 dark:bg-blue-500/20 dark:text-blue-300",
4644
+ float: "bg-blue-100 text-blue-600 dark:bg-blue-500/20 dark:text-blue-300",
4645
+ boolean: "bg-green-100 text-green-600 dark:bg-green-500/20 dark:text-green-300",
4646
+ date: "bg-amber-100 text-amber-600 dark:bg-amber-500/20 dark:text-amber-300",
4647
+ timestamp: "bg-amber-100 text-amber-600 dark:bg-amber-500/20 dark:text-amber-300",
4648
+ datetime: "bg-amber-100 text-amber-600 dark:bg-amber-500/20 dark:text-amber-300",
4649
+ json: "bg-purple-100 text-purple-600 dark:bg-purple-500/20 dark:text-purple-300",
4650
+ jsonb: "bg-purple-100 text-purple-600 dark:bg-purple-500/20 dark:text-purple-300",
4651
+ uuid: "bg-teal-100 text-teal-600 dark:bg-teal-500/20 dark:text-teal-300"
4652
+ };
4653
+ function DatasourceNodeConfigForm({
4654
+ nodeId,
4655
+ config,
4656
+ onSave,
4657
+ onCancel,
4658
+ datasources,
4659
+ onLoadTables,
4660
+ onLoadSchema
4661
+ }) {
4662
+ const t = useTranslations("agents.workflow.datasourceNodeConfig");
4663
+ const [selectedDatasourceId, setSelectedDatasourceId] = useState(config.datasourceId ?? "");
4664
+ const [selectedTable, setSelectedTable] = useState(config.table ?? "");
4665
+ const [availableTables, setAvailableTables] = useState([]);
4666
+ const [availableColumns, setAvailableColumns] = useState([]);
4667
+ const [selectedColumns, setSelectedColumns] = useState([...config.selectedColumns]);
4668
+ const [outputVariable, setOutputVariable] = useState(config.outputVariable);
4669
+ const [limit, setLimit] = useState(config.limit);
4670
+ const [filterVariables, setFilterVariables] = useState({ ...config.filterVariables });
4671
+ const allColumnNames = availableColumns.map((column) => column.name);
4672
+ const allSelected = selectedColumns.length > 0 && selectedColumns.length === allColumnNames.length;
4673
+ const selectedDatasource = datasources.find((datasource) => datasource.id === selectedDatasourceId);
4674
+ const loadTables = useCallback(async (datasourceId) => {
4675
+ if (!datasourceId) {
4676
+ setAvailableTables([]);
4677
+ return;
4678
+ }
4679
+ const tables = await onLoadTables(datasourceId);
4680
+ setAvailableTables(tables);
4681
+ }, [onLoadTables]);
4682
+ const loadSchema = useCallback(async (datasourceId, table) => {
4683
+ if (!datasourceId || !table) {
4684
+ setAvailableColumns([]);
4685
+ return;
4686
+ }
4687
+ const columns = await onLoadSchema(datasourceId, table);
4688
+ setAvailableColumns(columns);
4689
+ }, [onLoadSchema]);
4690
+ useEffect(() => {
4691
+ if (selectedDatasourceId) {
4692
+ loadTables(selectedDatasourceId);
4693
+ }
4694
+ }, [selectedDatasourceId, loadTables]);
4695
+ useEffect(() => {
4696
+ if (selectedDatasourceId && selectedTable) {
4697
+ loadSchema(selectedDatasourceId, selectedTable);
4698
+ }
4699
+ }, [selectedDatasourceId, selectedTable, loadSchema]);
4700
+ const handleDatasourceChange = (datasourceId) => {
4701
+ setSelectedDatasourceId(datasourceId);
4702
+ setSelectedTable("");
4703
+ setAvailableTables([]);
4704
+ setAvailableColumns([]);
4705
+ setSelectedColumns([]);
4706
+ setFilterVariables({});
4707
+ };
4708
+ const handleTableChange = (table) => {
4709
+ setSelectedTable(table);
4710
+ setAvailableColumns([]);
4711
+ setSelectedColumns([]);
4712
+ setFilterVariables({});
4713
+ };
4714
+ const handleToggleSelectAll = () => {
4715
+ if (allSelected) {
4716
+ setSelectedColumns([]);
4717
+ } else {
4718
+ setSelectedColumns([...allColumnNames]);
4719
+ }
4720
+ };
4721
+ const handleToggleColumn = (columnName) => {
4722
+ setSelectedColumns(
4723
+ (previous) => previous.includes(columnName) ? previous.filter((name) => name !== columnName) : [...previous, columnName]
4724
+ );
4725
+ };
4726
+ const handleAddFilter = () => {
4727
+ setFilterVariables((previous) => ({ ...previous, "": "" }));
4728
+ };
4729
+ const handleUpdateFilterVariable = (oldKey, newKey) => {
4730
+ setFilterVariables((previous) => {
4731
+ const updated = { ...previous };
4732
+ const value = updated[oldKey] ?? "";
4733
+ delete updated[oldKey];
4734
+ updated[newKey] = value;
4735
+ return updated;
4736
+ });
4737
+ };
4738
+ const handleUpdateFilterField = (key, newValue) => {
4739
+ setFilterVariables((previous) => ({ ...previous, [key]: newValue }));
4740
+ };
4741
+ const handleRemoveFilter = (key) => {
4742
+ setFilterVariables((previous) => {
4743
+ const updated = { ...previous };
4744
+ delete updated[key];
4745
+ return updated;
4746
+ });
4747
+ };
4748
+ const handleSave = () => {
4749
+ const cleanedFilters = {};
4750
+ for (const [key, value] of Object.entries(filterVariables)) {
4751
+ if (key.trim() && value.trim()) {
4752
+ cleanedFilters[key.trim()] = value.trim();
4753
+ }
4754
+ }
4755
+ onSave({
4756
+ ...config,
4757
+ datasourceId: selectedDatasourceId,
4758
+ dialect: selectedDatasource?.dialect ?? "",
4759
+ table: selectedTable,
4760
+ selectedColumns,
4761
+ outputVariable: outputVariable.trim(),
4762
+ limit,
4763
+ filterVariables: cleanedFilters
4764
+ });
4765
+ };
4766
+ const filterEntries = Object.entries(filterVariables);
4767
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-5", children: [
4768
+ /* @__PURE__ */ jsxs("div", { children: [
4769
+ /* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("datasourceLabel") }),
4770
+ /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-gray-500 dark:text-gray-400", children: t("datasourceHelp") }),
4771
+ /* @__PURE__ */ jsxs(
4772
+ "select",
4773
+ {
4774
+ value: selectedDatasourceId,
4775
+ onChange: (event) => handleDatasourceChange(event.target.value),
4776
+ className: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white",
4777
+ children: [
4778
+ /* @__PURE__ */ jsx("option", { value: "", children: t("selectDatasource") }),
4779
+ datasources.map((datasource) => /* @__PURE__ */ jsxs("option", { value: datasource.id, children: [
4780
+ datasource.name,
4781
+ " (",
4782
+ datasource.dialect,
4783
+ ")"
4784
+ ] }, datasource.id))
4785
+ ]
4786
+ }
4787
+ ),
4788
+ selectedDatasource && /* @__PURE__ */ jsx("div", { className: "mt-2 flex items-center gap-2", children: /* @__PURE__ */ jsx("span", { className: "inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300", children: selectedDatasource.dialect }) })
4789
+ ] }),
4790
+ /* @__PURE__ */ jsxs("div", { children: [
4791
+ /* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("tableLabel") }),
4792
+ /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-gray-500 dark:text-gray-400", children: t("tableHelp") }),
4793
+ /* @__PURE__ */ jsxs(
4794
+ "select",
4795
+ {
4796
+ value: selectedTable,
4797
+ onChange: (event) => handleTableChange(event.target.value),
4798
+ disabled: !selectedDatasourceId,
4799
+ className: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-white",
4800
+ children: [
4801
+ /* @__PURE__ */ jsx("option", { value: "", children: t("selectTable") }),
4802
+ availableTables.map((table) => /* @__PURE__ */ jsx("option", { value: table, children: table }, table))
4803
+ ]
4804
+ }
4805
+ )
4806
+ ] }),
4807
+ /* @__PURE__ */ jsxs("div", { children: [
4808
+ /* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("outputVariableLabel") }),
4809
+ /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-gray-500 dark:text-gray-400", children: t("outputVariableHelp") }),
4810
+ /* @__PURE__ */ jsx(
4811
+ "input",
4812
+ {
4813
+ type: "text",
4814
+ value: outputVariable,
4815
+ onChange: (event) => setOutputVariable(event.target.value),
4816
+ placeholder: "datasourceResult",
4817
+ className: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500"
4818
+ }
4819
+ )
4820
+ ] }),
4821
+ /* @__PURE__ */ jsxs("div", { children: [
4822
+ /* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("limitLabel") }),
4823
+ /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-gray-500 dark:text-gray-400", children: t("limitHelp") }),
4824
+ /* @__PURE__ */ jsx(
4825
+ "input",
4826
+ {
4827
+ type: "number",
4828
+ value: limit,
4829
+ onChange: (event) => setLimit(Math.max(1, Number.parseInt(event.target.value, 10) || 1)),
4830
+ min: 1,
4831
+ max: 1e4,
4832
+ className: "w-32 rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white"
4833
+ }
4834
+ )
4835
+ ] }),
4836
+ /* @__PURE__ */ jsxs("div", { children: [
4837
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between", children: [
4838
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: t("columnsLabel") }),
4839
+ /* @__PURE__ */ jsx(
4840
+ "button",
4841
+ {
4842
+ type: "button",
4843
+ onClick: handleToggleSelectAll,
4844
+ disabled: availableColumns.length === 0,
4845
+ className: "text-xs font-medium text-indigo-600 hover:text-indigo-700 disabled:cursor-not-allowed disabled:opacity-50 dark:text-indigo-400 dark:hover:text-indigo-300",
4846
+ children: allSelected ? t("deselectAll") : t("selectAll")
4847
+ }
4848
+ )
4849
+ ] }),
4850
+ selectedColumns.length === 0 && availableColumns.length > 0 && /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-amber-600 dark:text-amber-400", children: t("noColumnsSelected") }),
4851
+ /* @__PURE__ */ jsxs("div", { className: "max-h-48 space-y-1 overflow-y-auto rounded-lg border border-gray-200 p-2 dark:border-gray-700", children: [
4852
+ availableColumns.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-2 py-2 text-xs text-gray-500 dark:text-gray-400", children: t("noColumnsAvailable") }),
4853
+ availableColumns.map((column) => {
4854
+ const isSelected = selectedColumns.includes(column.name);
4855
+ const typeBadgeColor = COLUMN_TYPE_BADGE_COLORS[column.type.toLowerCase()] ?? COLUMN_TYPE_BADGE_COLORS.string;
4856
+ return /* @__PURE__ */ jsxs(
4857
+ "label",
4858
+ {
4859
+ className: `flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors ${isSelected ? "bg-indigo-50 dark:bg-indigo-500/10" : "hover:bg-gray-50 dark:hover:bg-gray-800"}`,
4860
+ children: [
4861
+ /* @__PURE__ */ jsx(
4862
+ "input",
4863
+ {
4864
+ type: "checkbox",
4865
+ checked: isSelected,
4866
+ onChange: () => handleToggleColumn(column.name),
4867
+ className: "h-3.5 w-3.5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 dark:border-gray-600"
4868
+ }
4869
+ ),
4870
+ /* @__PURE__ */ jsxs("span", { className: "flex-1 text-xs font-medium text-gray-900 dark:text-white", children: [
4871
+ column.name,
4872
+ column.nullable && /* @__PURE__ */ jsx("span", { className: "ml-1 text-[9px] text-gray-400 dark:text-gray-500", children: "?" })
4873
+ ] }),
4874
+ /* @__PURE__ */ jsx("span", { className: `rounded-full px-1.5 py-0.5 text-[9px] font-medium ${typeBadgeColor}`, children: column.type })
4875
+ ]
4876
+ },
4877
+ column.name
4878
+ );
4879
+ })
4880
+ ] })
4881
+ ] }),
4882
+ /* @__PURE__ */ jsxs("div", { children: [
4883
+ /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center justify-between", children: [
4884
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: t("filtersLabel") }),
4885
+ /* @__PURE__ */ jsxs(
4886
+ "button",
4887
+ {
4888
+ type: "button",
4889
+ onClick: handleAddFilter,
4890
+ className: "flex items-center gap-1 text-xs font-medium text-indigo-600 hover:text-indigo-700 dark:text-indigo-400 dark:hover:text-indigo-300",
4891
+ children: [
4892
+ /* @__PURE__ */ jsx(PlusIcon$1, { className: "h-3 w-3" }),
4893
+ t("addFilter")
4894
+ ]
4895
+ }
4896
+ )
4897
+ ] }),
4898
+ /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-gray-500 dark:text-gray-400", children: t("filtersHelp") }),
4899
+ filterEntries.length > 0 && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: filterEntries.map(([variableName, columnName], index) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4900
+ /* @__PURE__ */ jsxs(
4901
+ "select",
4902
+ {
4903
+ value: columnName,
4904
+ onChange: (event) => handleUpdateFilterField(variableName, event.target.value),
4905
+ className: "flex-1 rounded-lg border border-gray-300 bg-white px-2 py-1.5 text-xs text-gray-900 outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white",
4906
+ children: [
4907
+ /* @__PURE__ */ jsx("option", { value: "", children: t("columnName") }),
4908
+ availableColumns.map((column) => /* @__PURE__ */ jsx("option", { value: column.name, children: column.name }, column.name))
4909
+ ]
4910
+ }
4911
+ ),
4912
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-400", children: "=" }),
4913
+ /* @__PURE__ */ jsx(
4914
+ "input",
4915
+ {
4916
+ type: "text",
4917
+ value: variableName,
4918
+ onChange: (event) => handleUpdateFilterVariable(variableName, event.target.value),
4919
+ placeholder: t("variableReference"),
4920
+ className: "flex-1 rounded-lg border border-gray-300 bg-white px-2 py-1.5 text-xs text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500"
4921
+ }
4922
+ ),
4923
+ /* @__PURE__ */ jsx(
4924
+ "button",
4925
+ {
4926
+ type: "button",
4927
+ onClick: () => handleRemoveFilter(variableName),
4928
+ className: "rounded-md p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20",
4929
+ children: /* @__PURE__ */ jsx(XMarkIcon$1, { className: "h-3.5 w-3.5" })
4930
+ }
4931
+ )
4932
+ ] }, index)) })
4933
+ ] }),
4934
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2 border-t border-gray-200 pt-4 dark:border-gray-700", children: [
4935
+ /* @__PURE__ */ jsx(
4936
+ "button",
4937
+ {
4938
+ type: "button",
4939
+ onClick: onCancel,
4940
+ className: "rounded-lg border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",
4941
+ children: t("cancel")
4942
+ }
4943
+ ),
4944
+ /* @__PURE__ */ jsx(
4945
+ "button",
4946
+ {
4947
+ type: "button",
4948
+ onClick: handleSave,
4949
+ disabled: !selectedDatasourceId || !selectedTable || selectedColumns.length === 0,
4950
+ className: "rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-indigo-500 dark:hover:bg-indigo-600",
4951
+ children: t("save")
4952
+ }
4953
+ )
4954
+ ] })
4955
+ ] });
4956
+ }
4558
4957
  var GROUP_COLOR_OPTIONS = [
4559
4958
  { value: "indigo", ring: "ring-indigo-500", fill: "bg-indigo-500" },
4560
4959
  { value: "teal", ring: "ring-teal-500", fill: "bg-teal-500" },
@@ -4641,9 +5040,10 @@ var NODE_TITLE_KEYS = {
4641
5040
  list_operator: "listOperatorNodeConfig",
4642
5041
  iteration_start: "iterationStartNodeConfig",
4643
5042
  entity: "entityNodeConfig",
5043
+ datasource: "datasourceNodeConfig",
4644
5044
  group: "groupNodeConfig"
4645
5045
  };
4646
- function LogicNodeDrawer({ onSave, entities = [] }) {
5046
+ function LogicNodeDrawer({ onSave, entities = [], datasources = [], onLoadTables, onLoadSchema }) {
4647
5047
  const t = useTranslations("agents.workflow");
4648
5048
  const activeDrawer = useDrawerStore((s) => s.activeDrawer);
4649
5049
  const logicNodeData = useDrawerStore((s) => s.logicNodeData);
@@ -4695,6 +5095,19 @@ function LogicNodeDrawer({ onSave, entities = [] }) {
4695
5095
  return /* @__PURE__ */ jsx(ListOperatorNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
4696
5096
  case "iteration_start":
4697
5097
  return /* @__PURE__ */ jsx(IterationStartNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
5098
+ case "datasource":
5099
+ return /* @__PURE__ */ jsx(
5100
+ DatasourceNodeConfigForm,
5101
+ {
5102
+ nodeId,
5103
+ config,
5104
+ onSave: handleSave,
5105
+ onCancel: closeDrawer,
5106
+ datasources,
5107
+ onLoadTables: onLoadTables ?? (async () => []),
5108
+ onLoadSchema: onLoadSchema ?? (async () => [])
5109
+ }
5110
+ );
4698
5111
  case "entity":
4699
5112
  return /* @__PURE__ */ jsx(EntityNodeConfigForm, { config, entities, onSave: handleSave, onCancel: closeDrawer });
4700
5113
  case "group":
@@ -5066,6 +5479,7 @@ var BUILT_IN_NODE_TYPES = {
5066
5479
  list_operator: ListOperatorFlowNode,
5067
5480
  iteration_start: IterationStartFlowNode,
5068
5481
  note: NoteFlowNode,
5482
+ datasource: DatasourceFlowNode,
5069
5483
  group: GroupFlowNode
5070
5484
  };
5071
5485
  var ALL_LOGIC_NODE_TYPES = [
@@ -5090,6 +5504,7 @@ var ALL_LOGIC_NODE_TYPES = [
5090
5504
  "tool",
5091
5505
  "rule",
5092
5506
  "entity",
5507
+ "datasource",
5093
5508
  "group"
5094
5509
  ];
5095
5510
  function isLogicNodeType(nodeType) {
@@ -6748,5 +7163,5 @@ function Workspace({
6748
7163
  }
6749
7164
 
6750
7165
  export { AgentFlowNode, AgentToolFlowNode, AnswerFlowNode, AnthropicIcon, CATEGORY_COLORS, CATEGORY_PILL_COLORS, CodeFlowNode, CrewAIIcon, DocumentExtractorFlowNode, EndFlowNode, EntityFlowNode, FRAMEWORK_META, GoogleADKIcon, GroupFlowNode, HttpRequestFlowNode, ICON_MAP, IfElseFlowNode, IterationFlowNode, IterationStartFlowNode, KnowledgeBaseFlowNode, LOGIC_ICON_MAP, LOGIC_NODE_BADGE_COLORS, LOGIC_NODE_GRADIENTS, LOGIC_NODE_HANDLE_COLORS, LangChainIcon, ListOperatorFlowNode, LogicNodeDrawer, MINIMAP_NODE_COLORS, NodeCard, NodeContextMenu, NoteFlowNode, OpenAIIcon, PanelContextMenu, ParameterExtractorFlowNode, QuestionClassifierFlowNode, RuleFlowNode, SelectionContextMenu, StartFlowNode, StrandsIcon, TemplateTransformFlowNode, ToolFlowNode, VariableAggregatorFlowNode, VariableAssignerFlowNode, WorkflowBuilderProvider, WorkflowCanvas, Workspace, WorkspaceDrawer, getCompatibleModels, getDefaultFrameworkForModel, getEntityBadgeColor, getEntityGradient, getEntityHandleColor, getEntityIcon, getEntityMinimapColor, getFrameworkMeta, isModelCompatibleWithFramework, useDrawerStore, useWorkflowBuilderClient, useWorkflowBuilderClientOptional, useWorkflowStore };
6751
- //# sourceMappingURL=chunk-D3INPADN.mjs.map
6752
- //# sourceMappingURL=chunk-D3INPADN.mjs.map
7166
+ //# sourceMappingURL=chunk-EOU3POSF.mjs.map
7167
+ //# sourceMappingURL=chunk-EOU3POSF.mjs.map