@flanksource/clicky-ui 0.3.24 → 0.3.26
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/NOTICE.md +1 -0
- package/dist/ai.cjs +4 -0
- package/dist/ai.cjs.map +1 -1
- package/dist/ai.js +6 -2
- package/dist/ai.js.map +1 -1
- package/dist/chat.cjs +8 -0
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.js +9 -1
- package/dist/chat.js.map +1 -1
- package/dist/comments/CommentCard.cjs +89 -14
- package/dist/comments/CommentCard.cjs.map +1 -1
- package/dist/comments/CommentCard.d.ts.map +1 -1
- package/dist/comments/CommentCard.js +90 -15
- package/dist/comments/CommentCard.js.map +1 -1
- package/dist/comments/CommentComposer.cjs +25 -2
- package/dist/comments/CommentComposer.cjs.map +1 -1
- package/dist/comments/CommentComposer.d.ts.map +1 -1
- package/dist/comments/CommentComposer.js +25 -2
- package/dist/comments/CommentComposer.js.map +1 -1
- package/dist/comments/CommentProvider.cjs +21 -14
- package/dist/comments/CommentProvider.cjs.map +1 -1
- package/dist/comments/CommentProvider.d.ts +1 -1
- package/dist/comments/CommentProvider.d.ts.map +1 -1
- package/dist/comments/CommentProvider.js +21 -14
- package/dist/comments/CommentProvider.js.map +1 -1
- package/dist/comments/CommentSidePanel.cjs +1 -1
- package/dist/comments/CommentSidePanel.cjs.map +1 -1
- package/dist/comments/CommentSidePanel.js +1 -1
- package/dist/comments/CommentSidePanel.js.map +1 -1
- package/dist/comments/comment-types.cjs.map +1 -1
- package/dist/comments/comment-types.d.ts +6 -0
- package/dist/comments/comment-types.d.ts.map +1 -1
- package/dist/comments/comment-types.js.map +1 -1
- package/dist/components/DimensionField.cjs +56 -0
- package/dist/components/DimensionField.cjs.map +1 -0
- package/dist/components/DimensionField.d.ts +17 -0
- package/dist/components/DimensionField.d.ts.map +1 -0
- package/dist/components/DimensionField.js +56 -0
- package/dist/components/DimensionField.js.map +1 -0
- package/dist/components.cjs +4 -0
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.ts +2 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +4 -0
- package/dist/components.js.map +1 -1
- package/dist/data/Clicky.cjs +4 -5
- package/dist/data/Clicky.cjs.map +1 -1
- package/dist/data/Clicky.d.ts.map +1 -1
- package/dist/data/Clicky.js +4 -5
- package/dist/data/Clicky.js.map +1 -1
- package/dist/data/TaskExecDetails.cjs +8 -3
- package/dist/data/TaskExecDetails.cjs.map +1 -1
- package/dist/data/TaskExecDetails.d.ts +4 -0
- package/dist/data/TaskExecDetails.d.ts.map +1 -1
- package/dist/data/TaskExecDetails.js +9 -4
- package/dist/data/TaskExecDetails.js.map +1 -1
- package/dist/data/TaskManagerButton.cjs +101 -7
- package/dist/data/TaskManagerButton.cjs.map +1 -1
- package/dist/data/TaskManagerButton.d.ts +6 -1
- package/dist/data/TaskManagerButton.d.ts.map +1 -1
- package/dist/data/TaskManagerButton.js +103 -9
- package/dist/data/TaskManagerButton.js.map +1 -1
- package/dist/data/TaskProcessDetails.cjs +2 -0
- package/dist/data/TaskProcessDetails.cjs.map +1 -1
- package/dist/data/TaskProcessDetails.d.ts.map +1 -1
- package/dist/data/TaskProcessDetails.js +2 -0
- package/dist/data/TaskProcessDetails.js.map +1 -1
- package/dist/data/TaskProgress.cjs +14 -4
- package/dist/data/TaskProgress.cjs.map +1 -1
- package/dist/data/TaskProgress.js +14 -4
- package/dist/data/TaskProgress.js.map +1 -1
- package/dist/data/TaskSnapshot.cjs.map +1 -1
- package/dist/data/TaskSnapshot.d.ts +1 -0
- package/dist/data/TaskSnapshot.d.ts.map +1 -1
- package/dist/data/TaskSnapshot.js.map +1 -1
- package/dist/data/ai/ChatWindow.cjs +18 -23
- package/dist/data/ai/ChatWindow.cjs.map +1 -1
- package/dist/data/ai/ChatWindow.d.ts +1 -1
- package/dist/data/ai/ChatWindow.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.js +19 -24
- package/dist/data/ai/ChatWindow.js.map +1 -1
- package/dist/data/ai/ChatWindow.preferences.cjs +12 -21
- package/dist/data/ai/ChatWindow.preferences.cjs.map +1 -1
- package/dist/data/ai/ChatWindow.preferences.d.ts +3 -2
- package/dist/data/ai/ChatWindow.preferences.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.preferences.js +12 -21
- package/dist/data/ai/ChatWindow.preferences.js.map +1 -1
- package/dist/data/ai/ChatWindow.tool-catalog.cjs +21 -38
- package/dist/data/ai/ChatWindow.tool-catalog.cjs.map +1 -1
- package/dist/data/ai/ChatWindow.tool-catalog.d.ts +5 -5
- package/dist/data/ai/ChatWindow.tool-catalog.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.tool-catalog.js +21 -38
- package/dist/data/ai/ChatWindow.tool-catalog.js.map +1 -1
- package/dist/data/ai/ChatWindow.types.d.ts +2 -2
- package/dist/data/ai/ChatWindow.types.d.ts.map +1 -1
- package/dist/data/ai/ChatWindowManager.cjs +2 -2
- package/dist/data/ai/ChatWindowManager.cjs.map +1 -1
- package/dist/data/ai/ChatWindowManager.js +2 -2
- package/dist/data/ai/ChatWindowManager.js.map +1 -1
- package/dist/data/ai/ChatWindowRequestBody.cjs +4 -2
- package/dist/data/ai/ChatWindowRequestBody.cjs.map +1 -1
- package/dist/data/ai/ChatWindowRequestBody.d.ts +15 -3
- package/dist/data/ai/ChatWindowRequestBody.d.ts.map +1 -1
- package/dist/data/ai/ChatWindowRequestBody.js +4 -2
- package/dist/data/ai/ChatWindowRequestBody.js.map +1 -1
- package/dist/data/ai/ToolPreferences.cjs +5 -5
- package/dist/data/ai/ToolPreferences.cjs.map +1 -1
- package/dist/data/ai/ToolPreferences.d.ts +6 -5
- package/dist/data/ai/ToolPreferences.d.ts.map +1 -1
- package/dist/data/ai/ToolPreferences.js +5 -5
- package/dist/data/ai/ToolPreferences.js.map +1 -1
- package/dist/data/ai/ToolPreferences.model.cjs +61 -37
- package/dist/data/ai/ToolPreferences.model.cjs.map +1 -1
- package/dist/data/ai/ToolPreferences.model.d.ts +32 -13
- package/dist/data/ai/ToolPreferences.model.d.ts.map +1 -1
- package/dist/data/ai/ToolPreferences.model.js +62 -38
- package/dist/data/ai/ToolPreferences.model.js.map +1 -1
- package/dist/data/ai/ToolPreferencesList.cjs +17 -20
- package/dist/data/ai/ToolPreferencesList.cjs.map +1 -1
- package/dist/data/ai/ToolPreferencesList.d.ts +16 -7
- package/dist/data/ai/ToolPreferencesList.d.ts.map +1 -1
- package/dist/data/ai/ToolPreferencesList.js +18 -21
- package/dist/data/ai/ToolPreferencesList.js.map +1 -1
- package/dist/data/ai/chat-window-context.cjs +1 -1
- package/dist/data/ai/chat-window-context.cjs.map +1 -1
- package/dist/data/ai/chat-window-context.d.ts +7 -7
- package/dist/data/ai/chat-window-context.d.ts.map +1 -1
- package/dist/data/ai/chat-window-context.js +1 -1
- package/dist/data/ai/chat-window-context.js.map +1 -1
- package/dist/data/ai/index.d.ts +3 -1
- package/dist/data/ai/index.d.ts.map +1 -1
- package/dist/data/chat/Chat.cjs +8 -4
- package/dist/data/chat/Chat.cjs.map +1 -1
- package/dist/data/chat/Chat.d.ts.map +1 -1
- package/dist/data/chat/Chat.js +8 -4
- package/dist/data/chat/Chat.js.map +1 -1
- package/dist/data/chat/ChatRuntimeToolbar.cjs +11 -7
- package/dist/data/chat/ChatRuntimeToolbar.cjs.map +1 -1
- package/dist/data/chat/ChatRuntimeToolbar.d.ts.map +1 -1
- package/dist/data/chat/ChatRuntimeToolbar.js +11 -7
- package/dist/data/chat/ChatRuntimeToolbar.js.map +1 -1
- package/dist/data/chat/ContextMeter.cjs +64 -27
- package/dist/data/chat/ContextMeter.cjs.map +1 -1
- package/dist/data/chat/ContextMeter.d.ts +11 -4
- package/dist/data/chat/ContextMeter.d.ts.map +1 -1
- package/dist/data/chat/ContextMeter.js +64 -27
- package/dist/data/chat/ContextMeter.js.map +1 -1
- package/dist/data/chat/clickyOperationsToTools.cjs +2 -1
- package/dist/data/chat/clickyOperationsToTools.cjs.map +1 -1
- package/dist/data/chat/clickyOperationsToTools.d.ts.map +1 -1
- package/dist/data/chat/clickyOperationsToTools.js +2 -1
- package/dist/data/chat/clickyOperationsToTools.js.map +1 -1
- package/dist/data/chat/index.d.ts +2 -1
- package/dist/data/chat/index.d.ts.map +1 -1
- package/dist/data/chat/tool-policy.cjs +132 -0
- package/dist/data/chat/tool-policy.cjs.map +1 -0
- package/dist/data/chat/tool-policy.d.ts +81 -0
- package/dist/data/chat/tool-policy.d.ts.map +1 -0
- package/dist/data/chat/tool-policy.js +132 -0
- package/dist/data/chat/tool-policy.js.map +1 -0
- package/dist/data/chat/types.cjs +20 -0
- package/dist/data/chat/types.cjs.map +1 -1
- package/dist/data/chat/types.d.ts +41 -2
- package/dist/data/chat/types.d.ts.map +1 -1
- package/dist/data/chat/types.js +20 -0
- package/dist/data/chat/types.js.map +1 -1
- package/dist/data/chat/usage-snapshot.cjs +10 -1
- package/dist/data/chat/usage-snapshot.cjs.map +1 -1
- package/dist/data/chat/usage-snapshot.d.ts.map +1 -1
- package/dist/data/chat/usage-snapshot.js +10 -1
- package/dist/data/chat/usage-snapshot.js.map +1 -1
- package/dist/data/debugConsoleSignal.cjs +64 -0
- package/dist/data/debugConsoleSignal.cjs.map +1 -0
- package/dist/data/debugConsoleSignal.d.ts +83 -0
- package/dist/data/debugConsoleSignal.d.ts.map +1 -0
- package/dist/data/debugConsoleSignal.js +64 -0
- package/dist/data/debugConsoleSignal.js.map +1 -0
- package/dist/data/har/HarPanel.cjs +20 -14
- package/dist/data/har/HarPanel.cjs.map +1 -1
- package/dist/data/har/HarPanel.d.ts.map +1 -1
- package/dist/data/har/HarPanel.js +20 -14
- package/dist/data/har/HarPanel.js.map +1 -1
- package/dist/data/har/types.d.ts +18 -0
- package/dist/data/har/types.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.cjs +4 -42
- package/dist/data/query-browser/QueryBrowser.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.js +5 -43
- package/dist/data/query-browser/QueryBrowser.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.d.ts +0 -1
- package/dist/data/query-browser/QueryBrowser.types.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.js.map +1 -1
- package/dist/data/useDebugAction.cjs +29 -0
- package/dist/data/useDebugAction.cjs.map +1 -0
- package/dist/data/useDebugAction.d.ts +16 -0
- package/dist/data/useDebugAction.d.ts.map +1 -0
- package/dist/data/useDebugAction.js +29 -0
- package/dist/data/useDebugAction.js.map +1 -0
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/data.cjs +16 -8
- package/dist/data.cjs.map +1 -1
- package/dist/data.d.ts +3 -2
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +16 -8
- package/dist/devtools/DebugConsole.cjs +138 -0
- package/dist/devtools/DebugConsole.cjs.map +1 -0
- package/dist/devtools/DebugConsole.d.ts +23 -0
- package/dist/devtools/DebugConsole.d.ts.map +1 -0
- package/dist/devtools/DebugConsole.js +138 -0
- package/dist/devtools/DebugConsole.js.map +1 -0
- package/dist/devtools/DebugConsoleButton.cjs +59 -0
- package/dist/devtools/DebugConsoleButton.cjs.map +1 -0
- package/dist/devtools/DebugConsoleButton.d.ts +20 -0
- package/dist/devtools/DebugConsoleButton.d.ts.map +1 -0
- package/dist/devtools/DebugConsoleButton.js +59 -0
- package/dist/devtools/DebugConsoleButton.js.map +1 -0
- package/dist/devtools/DebugConsoleDock.cjs +112 -0
- package/dist/devtools/DebugConsoleDock.cjs.map +1 -0
- package/dist/devtools/DebugConsoleDock.d.ts +26 -0
- package/dist/devtools/DebugConsoleDock.d.ts.map +1 -0
- package/dist/devtools/DebugConsoleDock.js +112 -0
- package/dist/devtools/DebugConsoleDock.js.map +1 -0
- package/dist/devtools/ExecutionDetail.cjs +135 -0
- package/dist/devtools/ExecutionDetail.cjs.map +1 -0
- package/dist/devtools/ExecutionDetail.d.ts +19 -0
- package/dist/devtools/ExecutionDetail.d.ts.map +1 -0
- package/dist/devtools/ExecutionDetail.js +135 -0
- package/dist/devtools/ExecutionDetail.js.map +1 -0
- package/dist/devtools/debugClient.cjs +172 -0
- package/dist/devtools/debugClient.cjs.map +1 -0
- package/dist/devtools/debugClient.d.ts +98 -0
- package/dist/devtools/debugClient.d.ts.map +1 -0
- package/dist/devtools/debugClient.js +172 -0
- package/dist/devtools/debugClient.js.map +1 -0
- package/dist/devtools/debugStore.cjs +115 -0
- package/dist/devtools/debugStore.cjs.map +1 -0
- package/dist/devtools/debugStore.d.ts +83 -0
- package/dist/devtools/debugStore.d.ts.map +1 -0
- package/dist/devtools/debugStore.js +115 -0
- package/dist/devtools/debugStore.js.map +1 -0
- package/dist/devtools/dockState.cjs +51 -0
- package/dist/devtools/dockState.cjs.map +1 -0
- package/dist/devtools/dockState.d.ts +31 -0
- package/dist/devtools/dockState.d.ts.map +1 -0
- package/dist/devtools/dockState.js +51 -0
- package/dist/devtools/dockState.js.map +1 -0
- package/dist/devtools/tabs/ConsoleTab.cjs +36 -0
- package/dist/devtools/tabs/ConsoleTab.cjs.map +1 -0
- package/dist/devtools/tabs/ConsoleTab.d.ts +19 -0
- package/dist/devtools/tabs/ConsoleTab.d.ts.map +1 -0
- package/dist/devtools/tabs/ConsoleTab.js +36 -0
- package/dist/devtools/tabs/ConsoleTab.js.map +1 -0
- package/dist/devtools/tabs/InspectionCaches.cjs +150 -0
- package/dist/devtools/tabs/InspectionCaches.cjs.map +1 -0
- package/dist/devtools/tabs/InspectionCaches.d.ts +23 -0
- package/dist/devtools/tabs/InspectionCaches.d.ts.map +1 -0
- package/dist/devtools/tabs/InspectionCaches.js +150 -0
- package/dist/devtools/tabs/InspectionCaches.js.map +1 -0
- package/dist/devtools/tabs/InspectionTab.cjs +316 -0
- package/dist/devtools/tabs/InspectionTab.cjs.map +1 -0
- package/dist/devtools/tabs/InspectionTab.d.ts +27 -0
- package/dist/devtools/tabs/InspectionTab.d.ts.map +1 -0
- package/dist/devtools/tabs/InspectionTab.js +316 -0
- package/dist/devtools/tabs/InspectionTab.js.map +1 -0
- package/dist/devtools/tabs/NetworkTab.cjs +91 -0
- package/dist/devtools/tabs/NetworkTab.cjs.map +1 -0
- package/dist/devtools/tabs/NetworkTab.d.ts +20 -0
- package/dist/devtools/tabs/NetworkTab.d.ts.map +1 -0
- package/dist/devtools/tabs/NetworkTab.js +91 -0
- package/dist/devtools/tabs/NetworkTab.js.map +1 -0
- package/dist/devtools/tabs/QueriesTab.cjs +85 -0
- package/dist/devtools/tabs/QueriesTab.cjs.map +1 -0
- package/dist/devtools/tabs/QueriesTab.d.ts +24 -0
- package/dist/devtools/tabs/QueriesTab.d.ts.map +1 -0
- package/dist/devtools/tabs/QueriesTab.js +85 -0
- package/dist/devtools/tabs/QueriesTab.js.map +1 -0
- package/dist/devtools/types.cjs +26 -0
- package/dist/devtools/types.cjs.map +1 -0
- package/dist/devtools/types.d.ts +235 -0
- package/dist/devtools/types.d.ts.map +1 -0
- package/dist/devtools/types.js +26 -0
- package/dist/devtools/types.js.map +1 -0
- package/dist/devtools/useDebugStream.cjs +46 -0
- package/dist/devtools/useDebugStream.cjs.map +1 -0
- package/dist/devtools/useDebugStream.d.ts +23 -0
- package/dist/devtools/useDebugStream.d.ts.map +1 -0
- package/dist/devtools/useDebugStream.js +46 -0
- package/dist/devtools/useDebugStream.js.map +1 -0
- package/dist/devtools.cjs +51 -0
- package/dist/devtools.cjs.map +1 -0
- package/dist/devtools.d.ts +37 -0
- package/dist/devtools.d.ts.map +1 -0
- package/dist/devtools.js +51 -0
- package/dist/devtools.js.map +1 -0
- package/dist/icons/components/UiOpenScad.cjs +10 -0
- package/dist/icons/components/UiOpenScad.cjs.map +1 -0
- package/dist/icons/components/UiOpenScad.d.ts +9 -0
- package/dist/icons/components/UiOpenScad.d.ts.map +1 -0
- package/dist/icons/components/UiOpenScad.js +10 -0
- package/dist/icons/components/UiOpenScad.js.map +1 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/registry.cjs +2 -0
- package/dist/icons/registry.cjs.map +1 -1
- package/dist/icons/registry.d.ts.map +1 -1
- package/dist/icons/registry.js +2 -0
- package/dist/icons/registry.js.map +1 -1
- package/dist/icons.cjs +2 -0
- package/dist/icons.cjs.map +1 -1
- package/dist/icons.js +2 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.cjs +20 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/dist/layout/AppShell.cjs +15 -10
- package/dist/layout/AppShell.cjs.map +1 -1
- package/dist/layout/AppShell.d.ts +11 -0
- package/dist/layout/AppShell.d.ts.map +1 -1
- package/dist/layout/AppShell.js +15 -10
- package/dist/layout/AppShell.js.map +1 -1
- package/dist/layout/AppShell.nav.cjs +170 -49
- package/dist/layout/AppShell.nav.cjs.map +1 -1
- package/dist/layout/AppShell.nav.d.ts.map +1 -1
- package/dist/layout/AppShell.nav.js +170 -49
- package/dist/layout/AppShell.nav.js.map +1 -1
- package/dist/overlay/CellActions.cjs +18 -124
- package/dist/overlay/CellActions.cjs.map +1 -1
- package/dist/overlay/CellActions.d.ts +1 -1
- package/dist/overlay/CellActions.d.ts.map +1 -1
- package/dist/overlay/CellActions.js +18 -124
- package/dist/overlay/CellActions.js.map +1 -1
- package/dist/overlay/ContextMenu.cjs +144 -0
- package/dist/overlay/ContextMenu.cjs.map +1 -0
- package/dist/overlay/ContextMenu.d.ts +8 -0
- package/dist/overlay/ContextMenu.d.ts.map +1 -0
- package/dist/overlay/ContextMenu.js +144 -0
- package/dist/overlay/ContextMenu.js.map +1 -0
- package/dist/profiles/connections/connectionBrowserModel.cjs +14 -65
- package/dist/profiles/connections/connectionBrowserModel.cjs.map +1 -1
- package/dist/profiles/connections/connectionBrowserModel.d.ts +35 -35
- package/dist/profiles/connections/connectionBrowserModel.d.ts.map +1 -1
- package/dist/profiles/connections/connectionBrowserModel.js +14 -65
- package/dist/profiles/connections/connectionBrowserModel.js.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspace.cjs +29 -9
- package/dist/profiles/connections/connectionQueryWorkspace.cjs.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspace.d.ts +3 -2
- package/dist/profiles/connections/connectionQueryWorkspace.d.ts.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspace.js +30 -10
- package/dist/profiles/connections/connectionQueryWorkspace.js.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspaceModel.cjs +15 -0
- package/dist/profiles/connections/connectionQueryWorkspaceModel.cjs.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspaceModel.d.ts +22 -1
- package/dist/profiles/connections/connectionQueryWorkspaceModel.d.ts.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspaceModel.js +15 -0
- package/dist/profiles/connections/connectionQueryWorkspaceModel.js.map +1 -1
- package/dist/profiles/connections/index.d.ts +1 -0
- package/dist/profiles/connections/index.d.ts.map +1 -1
- package/dist/profiles/connections/inspectionStatus.cjs +44 -0
- package/dist/profiles/connections/inspectionStatus.cjs.map +1 -0
- package/dist/profiles/connections/inspectionStatus.d.ts +5 -0
- package/dist/profiles/connections/inspectionStatus.d.ts.map +1 -0
- package/dist/profiles/connections/inspectionStatus.js +44 -0
- package/dist/profiles/connections/inspectionStatus.js.map +1 -0
- package/dist/profiles/connections/useInspection.cjs +123 -0
- package/dist/profiles/connections/useInspection.cjs.map +1 -0
- package/dist/profiles/connections/useInspection.d.ts +35 -0
- package/dist/profiles/connections/useInspection.d.ts.map +1 -0
- package/dist/profiles/connections/useInspection.js +123 -0
- package/dist/profiles/connections/useInspection.js.map +1 -0
- package/dist/profiles/editor/profileBuilderWorkspace.cjs +55 -23
- package/dist/profiles/editor/profileBuilderWorkspace.cjs.map +1 -1
- package/dist/profiles/editor/profileBuilderWorkspace.d.ts.map +1 -1
- package/dist/profiles/editor/profileBuilderWorkspace.js +56 -24
- package/dist/profiles/editor/profileBuilderWorkspace.js.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilder.cjs +12 -3
- package/dist/profiles/elasticsearch/esQueryBuilder.cjs.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilder.d.ts +2 -2
- package/dist/profiles/elasticsearch/esQueryBuilder.d.ts.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilder.js +12 -3
- package/dist/profiles/elasticsearch/esQueryBuilder.js.map +1 -1
- package/dist/profiles/fields/profileFieldEditor.cjs +137 -22
- package/dist/profiles/fields/profileFieldEditor.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldEditor.d.ts.map +1 -1
- package/dist/profiles/fields/profileFieldEditor.js +137 -22
- package/dist/profiles/fields/profileFieldEditor.js.map +1 -1
- package/dist/profiles/fields/profileFieldFilterEditor.cjs +171 -82
- package/dist/profiles/fields/profileFieldFilterEditor.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldFilterEditor.d.ts +0 -9
- package/dist/profiles/fields/profileFieldFilterEditor.d.ts.map +1 -1
- package/dist/profiles/fields/profileFieldFilterEditor.js +174 -85
- package/dist/profiles/fields/profileFieldFilterEditor.js.map +1 -1
- package/dist/profiles/fields/profileFieldIcons.cjs +6 -3
- package/dist/profiles/fields/profileFieldIcons.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldIcons.js +6 -3
- package/dist/profiles/fields/profileFieldIcons.js.map +1 -1
- package/dist/profiles/query/profileSampleFilterLookup.cjs +34 -0
- package/dist/profiles/query/profileSampleFilterLookup.cjs.map +1 -0
- package/dist/profiles/query/profileSampleFilterLookup.d.ts +12 -0
- package/dist/profiles/query/profileSampleFilterLookup.d.ts.map +1 -0
- package/dist/profiles/query/profileSampleFilterLookup.js +34 -0
- package/dist/profiles/query/profileSampleFilterLookup.js.map +1 -0
- package/dist/profiles/query/profileSamplePayload.cjs +6 -4
- package/dist/profiles/query/profileSamplePayload.cjs.map +1 -1
- package/dist/profiles/query/profileSamplePayload.d.ts +11 -4
- package/dist/profiles/query/profileSamplePayload.d.ts.map +1 -1
- package/dist/profiles/query/profileSamplePayload.js +6 -4
- package/dist/profiles/query/profileSamplePayload.js.map +1 -1
- package/dist/profiles/query/profileSampleResult.cjs +26 -0
- package/dist/profiles/query/profileSampleResult.cjs.map +1 -0
- package/dist/profiles/query/profileSampleResult.d.ts +11 -0
- package/dist/profiles/query/profileSampleResult.d.ts.map +1 -0
- package/dist/profiles/query/profileSampleResult.js +26 -0
- package/dist/profiles/query/profileSampleResult.js.map +1 -0
- package/dist/profiles/query/queryTargetPicker.cjs +5 -3
- package/dist/profiles/query/queryTargetPicker.cjs.map +1 -1
- package/dist/profiles/query/queryTargetPicker.d.ts +3 -2
- package/dist/profiles/query/queryTargetPicker.d.ts.map +1 -1
- package/dist/profiles/query/queryTargetPicker.js +5 -3
- package/dist/profiles/query/queryTargetPicker.js.map +1 -1
- package/dist/profiles/wizard/profileWizard.cjs +14 -5
- package/dist/profiles/wizard/profileWizard.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizard.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizard.js +15 -6
- package/dist/profiles/wizard/profileWizard.js.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.cjs +35 -6
- package/dist/profiles/wizard/profileWizardModel.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.d.ts +29 -4
- package/dist/profiles/wizard/profileWizardModel.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.js +35 -6
- package/dist/profiles/wizard/profileWizardModel.js.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.cjs +44 -11
- package/dist/profiles/wizard/profileWizardQueryStep.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.js +46 -13
- package/dist/profiles/wizard/profileWizardQueryStep.js.map +1 -1
- package/dist/profiles/wizard/profileWizardSteps.cjs +33 -2
- package/dist/profiles/wizard/profileWizardSteps.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardSteps.d.ts +11 -2
- package/dist/profiles/wizard/profileWizardSteps.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardSteps.js +33 -2
- package/dist/profiles/wizard/profileWizardSteps.js.map +1 -1
- package/dist/profiles.cjs +8 -2
- package/dist/profiles.cjs.map +1 -1
- package/dist/profiles.js +10 -4
- package/dist/profiles.js.map +1 -1
- package/dist/rpc/FilterForm.cjs +21 -237
- package/dist/rpc/FilterForm.cjs.map +1 -1
- package/dist/rpc/FilterForm.d.ts +3 -1
- package/dist/rpc/FilterForm.d.ts.map +1 -1
- package/dist/rpc/FilterForm.js +21 -237
- package/dist/rpc/FilterForm.js.map +1 -1
- package/dist/rpc/FilterFormFields.cjs +240 -0
- package/dist/rpc/FilterFormFields.cjs.map +1 -0
- package/dist/rpc/FilterFormFields.d.ts +12 -0
- package/dist/rpc/FilterFormFields.d.ts.map +1 -0
- package/dist/rpc/FilterFormFields.js +240 -0
- package/dist/rpc/FilterFormFields.js.map +1 -0
- package/dist/rpc/router.cjs +3 -2
- package/dist/rpc/router.cjs.map +1 -1
- package/dist/rpc/router.d.ts.map +1 -1
- package/dist/rpc/router.js +3 -2
- package/dist/rpc/router.js.map +1 -1
- package/dist/rpc/types.cjs.map +1 -1
- package/dist/rpc/types.d.ts +3 -1
- package/dist/rpc/types.d.ts.map +1 -1
- package/dist/rpc/types.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -1
- package/dist/data/query-info/QueryInfoDialog.cjs +0 -106
- package/dist/data/query-info/QueryInfoDialog.cjs.map +0 -1
- package/dist/data/query-info/QueryInfoDialog.d.ts +0 -16
- package/dist/data/query-info/QueryInfoDialog.d.ts.map +0 -1
- package/dist/data/query-info/QueryInfoDialog.js +0 -106
- package/dist/data/query-info/QueryInfoDialog.js.map +0 -1
- package/dist/data/query-info/index.d.ts +0 -4
- package/dist/data/query-info/index.d.ts.map +0 -1
- package/dist/data/query-info/queryInfo.cjs +0 -42
- package/dist/data/query-info/queryInfo.cjs.map +0 -1
- package/dist/data/query-info/queryInfo.d.ts +0 -45
- package/dist/data/query-info/queryInfo.d.ts.map +0 -1
- package/dist/data/query-info/queryInfo.js +0 -42
- package/dist/data/query-info/queryInfo.js.map +0 -1
- package/dist/data/query-info/useQueryInfo.cjs +0 -48
- package/dist/data/query-info/useQueryInfo.cjs.map +0 -1
- package/dist/data/query-info/useQueryInfo.d.ts +0 -26
- package/dist/data/query-info/useQueryInfo.d.ts.map +0 -1
- package/dist/data/query-info/useQueryInfo.js +0 -48
- package/dist/data/query-info/useQueryInfo.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileSamplePayload.cjs","sources":["../../../src/profiles/query/profileSamplePayload.ts"],"sourcesContent":["import type { QueryBrowserRequest } from \"../../data/query-browser/QueryBrowser.types\";\nimport { sampleRequestProfile } from \"./jsonPathSample\";\nimport type {
|
|
1
|
+
{"version":3,"file":"profileSamplePayload.cjs","sources":["../../../src/profiles/query/profileSamplePayload.ts"],"sourcesContent":["import type { QueryBrowserRequest } from \"../../data/query-browser/QueryBrowser.types\";\nimport { sampleRequestProfile } from \"./jsonPathSample\";\nimport type {\n ProfileColumn,\n ProfileWizardDraft,\n} from \"../wizard/profileWizardModel\";\n\nexport type ProfileSamplePayloadOptions = {\n draft: ProfileWizardDraft;\n request: QueryBrowserRequest;\n params?: Record<string, unknown>;\n filterColumns?: ProfileColumn[];\n};\n\nexport function profileSamplePayload(options: ProfileSamplePayloadOptions) {\n const { draft, request } = options;\n const profile = sampleRequestProfile(draft);\n if (!profile) throw new Error(\"Cannot sample a profile without a provider\");\n return {\n profile,\n params: options.params ?? {},\n ...(request.filters ? { filters: request.filters } : {}),\n ...(options.filterColumns\n ? { filterColumns: options.filterColumns }\n : {}),\n ...(request.pagination ? { pagination: request.pagination } : {}),\n };\n}\n"],"names":["sampleRequestProfile"],"mappings":";;;AAcO,SAAS,qBAAqB,SAAsC;AACzE,QAAM,EAAE,OAAO,QAAA,IAAY;AAC3B,QAAM,UAAUA,eAAAA,qBAAqB,KAAK;AAC1C,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,4CAA4C;AAC1E,SAAO;AAAA,IACL;AAAA,IACA,QAAQ,QAAQ,UAAU,CAAA;AAAA,IAC1B,GAAI,QAAQ,UAAU,EAAE,SAAS,QAAQ,QAAA,IAAY,CAAA;AAAA,IACrD,GAAI,QAAQ,gBACR,EAAE,eAAe,QAAQ,cAAA,IACzB,CAAA;AAAA,IACJ,GAAI,QAAQ,aAAa,EAAE,YAAY,QAAQ,WAAA,IAAe,CAAA;AAAA,EAAC;AAEnE;;"}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { QueryBrowserRequest } from '../../data/query-browser/QueryBrowser.types';
|
|
2
|
-
import { ProfileWizardDraft } from '../wizard/profileWizardModel';
|
|
3
|
-
export
|
|
4
|
-
|
|
2
|
+
import { ProfileColumn, ProfileWizardDraft } from '../wizard/profileWizardModel';
|
|
3
|
+
export type ProfileSamplePayloadOptions = {
|
|
4
|
+
draft: ProfileWizardDraft;
|
|
5
|
+
request: QueryBrowserRequest;
|
|
6
|
+
params?: Record<string, unknown>;
|
|
7
|
+
filterColumns?: ProfileColumn[];
|
|
8
|
+
};
|
|
9
|
+
export declare function profileSamplePayload(options: ProfileSamplePayloadOptions): {
|
|
5
10
|
pagination?: {
|
|
6
11
|
limit: number;
|
|
7
12
|
offset?: number;
|
|
8
13
|
cursor?: string;
|
|
9
14
|
};
|
|
15
|
+
filterColumns?: ProfileColumn[];
|
|
16
|
+
filters?: import('../..').DataTableFilterSelection;
|
|
10
17
|
profile: Record<string, unknown>;
|
|
11
|
-
params:
|
|
18
|
+
params: Record<string, unknown>;
|
|
12
19
|
};
|
|
13
20
|
//# sourceMappingURL=profileSamplePayload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileSamplePayload.d.ts","sourceRoot":"","sources":["../../../src/profiles/query/profileSamplePayload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAEvF,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"profileSamplePayload.d.ts","sourceRoot":"","sources":["../../../src/profiles/query/profileSamplePayload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAEvF,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;CACjC,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B;;;;;;;;;;EAaxE"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { sampleRequestProfile } from "./jsonPathSample.js";
|
|
2
|
-
function profileSamplePayload(
|
|
2
|
+
function profileSamplePayload(options) {
|
|
3
|
+
const { draft, request } = options;
|
|
3
4
|
const profile = sampleRequestProfile(draft);
|
|
4
5
|
if (!profile) throw new Error("Cannot sample a profile without a provider");
|
|
5
6
|
return {
|
|
6
7
|
profile,
|
|
7
|
-
params: {},
|
|
8
|
-
...request.
|
|
9
|
-
...
|
|
8
|
+
params: options.params ?? {},
|
|
9
|
+
...request.filters ? { filters: request.filters } : {},
|
|
10
|
+
...options.filterColumns ? { filterColumns: options.filterColumns } : {},
|
|
11
|
+
...request.pagination ? { pagination: request.pagination } : {}
|
|
10
12
|
};
|
|
11
13
|
}
|
|
12
14
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileSamplePayload.js","sources":["../../../src/profiles/query/profileSamplePayload.ts"],"sourcesContent":["import type { QueryBrowserRequest } from \"../../data/query-browser/QueryBrowser.types\";\nimport { sampleRequestProfile } from \"./jsonPathSample\";\nimport type {
|
|
1
|
+
{"version":3,"file":"profileSamplePayload.js","sources":["../../../src/profiles/query/profileSamplePayload.ts"],"sourcesContent":["import type { QueryBrowserRequest } from \"../../data/query-browser/QueryBrowser.types\";\nimport { sampleRequestProfile } from \"./jsonPathSample\";\nimport type {\n ProfileColumn,\n ProfileWizardDraft,\n} from \"../wizard/profileWizardModel\";\n\nexport type ProfileSamplePayloadOptions = {\n draft: ProfileWizardDraft;\n request: QueryBrowserRequest;\n params?: Record<string, unknown>;\n filterColumns?: ProfileColumn[];\n};\n\nexport function profileSamplePayload(options: ProfileSamplePayloadOptions) {\n const { draft, request } = options;\n const profile = sampleRequestProfile(draft);\n if (!profile) throw new Error(\"Cannot sample a profile without a provider\");\n return {\n profile,\n params: options.params ?? {},\n ...(request.filters ? { filters: request.filters } : {}),\n ...(options.filterColumns\n ? { filterColumns: options.filterColumns }\n : {}),\n ...(request.pagination ? { pagination: request.pagination } : {}),\n };\n}\n"],"names":[],"mappings":";AAcO,SAAS,qBAAqB,SAAsC;AACzE,QAAM,EAAE,OAAO,QAAA,IAAY;AAC3B,QAAM,UAAU,qBAAqB,KAAK;AAC1C,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,4CAA4C;AAC1E,SAAO;AAAA,IACL;AAAA,IACA,QAAQ,QAAQ,UAAU,CAAA;AAAA,IAC1B,GAAI,QAAQ,UAAU,EAAE,SAAS,QAAQ,QAAA,IAAY,CAAA;AAAA,IACrD,GAAI,QAAQ,gBACR,EAAE,eAAe,QAAQ,cAAA,IACzB,CAAA;AAAA,IACJ,GAAI,QAAQ,aAAa,EAAE,YAAY,QAAQ,WAAA,IAAe,CAAA;AAAA,EAAC;AAEnE;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function profileSampleQueryResult(response) {
|
|
4
|
+
if (!Array.isArray(response.resultColumns)) {
|
|
5
|
+
throw new Error("Profile sample response is missing resultColumns");
|
|
6
|
+
}
|
|
7
|
+
const result = {
|
|
8
|
+
...response,
|
|
9
|
+
columns: response.resultColumns
|
|
10
|
+
};
|
|
11
|
+
delete result.resultColumns;
|
|
12
|
+
delete result.renderedQuery;
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
function profileSampleFilterColumns(response) {
|
|
16
|
+
if (!Array.isArray(response.resultColumns)) {
|
|
17
|
+
throw new Error("Profile sample response is missing resultColumns");
|
|
18
|
+
}
|
|
19
|
+
const filterable = new Set(
|
|
20
|
+
response.resultColumns.filter((column) => column.filterKey !== void 0).map((column) => column.name)
|
|
21
|
+
);
|
|
22
|
+
return response.columns.filter((column) => filterable.has(column.name));
|
|
23
|
+
}
|
|
24
|
+
exports.profileSampleFilterColumns = profileSampleFilterColumns;
|
|
25
|
+
exports.profileSampleQueryResult = profileSampleQueryResult;
|
|
26
|
+
//# sourceMappingURL=profileSampleResult.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileSampleResult.cjs","sources":["../../../src/profiles/query/profileSampleResult.ts"],"sourcesContent":["import type { DataTableServerColumn } from \"../../data/data-table-server-filters\";\nimport type { QueryBrowserResult } from \"../../data/query-browser/QueryBrowser.types\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\n\nexport type ProfileSampleResponse = Omit<QueryBrowserResult, \"columns\"> & {\n columns: ProfileColumn[];\n resultColumns?: DataTableServerColumn[];\n renderedQuery: string;\n};\n\nexport function profileSampleQueryResult(\n response: ProfileSampleResponse,\n): QueryBrowserResult {\n if (!Array.isArray(response.resultColumns)) {\n throw new Error(\"Profile sample response is missing resultColumns\");\n }\n const result = {\n ...response,\n columns: response.resultColumns,\n } as QueryBrowserResult & {\n resultColumns?: DataTableServerColumn[];\n renderedQuery?: string;\n };\n delete result.resultColumns;\n delete result.renderedQuery;\n return result;\n}\n\nexport function profileSampleFilterColumns(\n response: ProfileSampleResponse,\n): ProfileColumn[] {\n if (!Array.isArray(response.resultColumns)) {\n throw new Error(\"Profile sample response is missing resultColumns\");\n }\n const filterable = new Set(\n response.resultColumns\n .filter((column) => column.filterKey !== undefined)\n .map((column) => column.name),\n );\n return response.columns.filter((column) => filterable.has(column.name));\n}\n"],"names":[],"mappings":";;AAUO,SAAS,yBACd,UACoB;AACpB,MAAI,CAAC,MAAM,QAAQ,SAAS,aAAa,GAAG;AAC1C,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,QAAM,SAAS;AAAA,IACb,GAAG;AAAA,IACH,SAAS,SAAS;AAAA,EAAA;AAKpB,SAAO,OAAO;AACd,SAAO,OAAO;AACd,SAAO;AACT;AAEO,SAAS,2BACd,UACiB;AACjB,MAAI,CAAC,MAAM,QAAQ,SAAS,aAAa,GAAG;AAC1C,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,QAAM,aAAa,IAAI;AAAA,IACrB,SAAS,cACN,OAAO,CAAC,WAAW,OAAO,cAAc,MAAS,EACjD,IAAI,CAAC,WAAW,OAAO,IAAI;AAAA,EAAA;AAEhC,SAAO,SAAS,QAAQ,OAAO,CAAC,WAAW,WAAW,IAAI,OAAO,IAAI,CAAC;AACxE;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DataTableServerColumn } from '../../data/data-table-server-filters';
|
|
2
|
+
import { QueryBrowserResult } from '../../data/query-browser/QueryBrowser.types';
|
|
3
|
+
import { ProfileColumn } from '../wizard/profileWizardModel';
|
|
4
|
+
export type ProfileSampleResponse = Omit<QueryBrowserResult, "columns"> & {
|
|
5
|
+
columns: ProfileColumn[];
|
|
6
|
+
resultColumns?: DataTableServerColumn[];
|
|
7
|
+
renderedQuery: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function profileSampleQueryResult(response: ProfileSampleResponse): QueryBrowserResult;
|
|
10
|
+
export declare function profileSampleFilterColumns(response: ProfileSampleResponse): ProfileColumn[];
|
|
11
|
+
//# sourceMappingURL=profileSampleResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileSampleResult.d.ts","sourceRoot":"","sources":["../../../src/profiles/query/profileSampleResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;IACxE,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,qBAAqB,GAC9B,kBAAkB,CAcpB;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,qBAAqB,GAC9B,aAAa,EAAE,CAUjB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function profileSampleQueryResult(response) {
|
|
2
|
+
if (!Array.isArray(response.resultColumns)) {
|
|
3
|
+
throw new Error("Profile sample response is missing resultColumns");
|
|
4
|
+
}
|
|
5
|
+
const result = {
|
|
6
|
+
...response,
|
|
7
|
+
columns: response.resultColumns
|
|
8
|
+
};
|
|
9
|
+
delete result.resultColumns;
|
|
10
|
+
delete result.renderedQuery;
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
function profileSampleFilterColumns(response) {
|
|
14
|
+
if (!Array.isArray(response.resultColumns)) {
|
|
15
|
+
throw new Error("Profile sample response is missing resultColumns");
|
|
16
|
+
}
|
|
17
|
+
const filterable = new Set(
|
|
18
|
+
response.resultColumns.filter((column) => column.filterKey !== void 0).map((column) => column.name)
|
|
19
|
+
);
|
|
20
|
+
return response.columns.filter((column) => filterable.has(column.name));
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
profileSampleFilterColumns,
|
|
24
|
+
profileSampleQueryResult
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=profileSampleResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileSampleResult.js","sources":["../../../src/profiles/query/profileSampleResult.ts"],"sourcesContent":["import type { DataTableServerColumn } from \"../../data/data-table-server-filters\";\nimport type { QueryBrowserResult } from \"../../data/query-browser/QueryBrowser.types\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\n\nexport type ProfileSampleResponse = Omit<QueryBrowserResult, \"columns\"> & {\n columns: ProfileColumn[];\n resultColumns?: DataTableServerColumn[];\n renderedQuery: string;\n};\n\nexport function profileSampleQueryResult(\n response: ProfileSampleResponse,\n): QueryBrowserResult {\n if (!Array.isArray(response.resultColumns)) {\n throw new Error(\"Profile sample response is missing resultColumns\");\n }\n const result = {\n ...response,\n columns: response.resultColumns,\n } as QueryBrowserResult & {\n resultColumns?: DataTableServerColumn[];\n renderedQuery?: string;\n };\n delete result.resultColumns;\n delete result.renderedQuery;\n return result;\n}\n\nexport function profileSampleFilterColumns(\n response: ProfileSampleResponse,\n): ProfileColumn[] {\n if (!Array.isArray(response.resultColumns)) {\n throw new Error(\"Profile sample response is missing resultColumns\");\n }\n const filterable = new Set(\n response.resultColumns\n .filter((column) => column.filterKey !== undefined)\n .map((column) => column.name),\n );\n return response.columns.filter((column) => filterable.has(column.name));\n}\n"],"names":[],"mappings":"AAUO,SAAS,yBACd,UACoB;AACpB,MAAI,CAAC,MAAM,QAAQ,SAAS,aAAa,GAAG;AAC1C,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,QAAM,SAAS;AAAA,IACb,GAAG;AAAA,IACH,SAAS,SAAS;AAAA,EAAA;AAKpB,SAAO,OAAO;AACd,SAAO,OAAO;AACd,SAAO;AACT;AAEO,SAAS,2BACd,UACiB;AACjB,MAAI,CAAC,MAAM,QAAQ,SAAS,aAAa,GAAG;AAC1C,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,QAAM,aAAa,IAAI;AAAA,IACrB,SAAS,cACN,OAAO,CAAC,WAAW,OAAO,cAAc,MAAS,EACjD,IAAI,CAAC,WAAW,OAAO,IAAI;AAAA,EAAA;AAEhC,SAAO,SAAS,QAAQ,OAAO,CAAC,WAAW,WAAW,IAAI,OAAO,IAAI,CAAC;AACxE;"}
|
|
@@ -8,7 +8,8 @@ function QueryTargetPicker({
|
|
|
8
8
|
label,
|
|
9
9
|
inspection,
|
|
10
10
|
value,
|
|
11
|
-
onChange
|
|
11
|
+
onChange,
|
|
12
|
+
discoverable = true
|
|
12
13
|
}) {
|
|
13
14
|
const options = react.useMemo(
|
|
14
15
|
() => connectionBrowserModel.openSearchIndexOptions(inspection.data),
|
|
@@ -23,7 +24,7 @@ function QueryTargetPicker({
|
|
|
23
24
|
value,
|
|
24
25
|
onChange: (next) => onChange(next, connectionBrowserModel.openSearchTargetKind(inspection.data, next)),
|
|
25
26
|
options,
|
|
26
|
-
placeholder: inspection.error ? "Unavailable — check the connection" : `Select ${label.toLowerCase()} or type a wildcard…`,
|
|
27
|
+
placeholder: inspection.error ? "Unavailable — check the connection" : discoverable ? `Select ${label.toLowerCase()} or type a wildcard…` : `Enter ${label.toLowerCase()}…`,
|
|
27
28
|
loading: inspection.loading,
|
|
28
29
|
invalid: Boolean(inspection.error),
|
|
29
30
|
allowCustomValue: true,
|
|
@@ -34,7 +35,8 @@ function QueryTargetPicker({
|
|
|
34
35
|
] });
|
|
35
36
|
}
|
|
36
37
|
function targetErrorMessage(error) {
|
|
37
|
-
if (error instanceof Error && error.message.trim())
|
|
38
|
+
if (error instanceof Error && error.message.trim())
|
|
39
|
+
return error.message.trim();
|
|
38
40
|
if (typeof error === "string" && error.trim()) return error.trim();
|
|
39
41
|
return "The inspection request failed. Check the connection settings and try again.";
|
|
40
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryTargetPicker.cjs","sources":["../../../src/profiles/query/queryTargetPicker.tsx"],"sourcesContent":["/**\n * The flat target a query runs against — an OpenSearch index, alias, data\n * stream, or the wildcard a daily rotation rolls up into. A hundred timestamped\n * index names is a searchable list, not a hierarchy, so this replaces the\n * catalog tree wherever the server declares an index target.\n */\n\nimport { Combobox } from \"../../components/Combobox\";\nimport { useMemo } from \"react\";\nimport {\n openSearchIndexOptions,\n openSearchTargetKind,\n
|
|
1
|
+
{"version":3,"file":"queryTargetPicker.cjs","sources":["../../../src/profiles/query/queryTargetPicker.tsx"],"sourcesContent":["/**\n * The flat target a query runs against — an OpenSearch index, alias, data\n * stream, or the wildcard a daily rotation rolls up into. A hundred timestamped\n * index names is a searchable list, not a hierarchy, so this replaces the\n * catalog tree wherever the server declares an index target.\n */\n\nimport { Combobox } from \"../../components/Combobox\";\nimport { useMemo } from \"react\";\nimport {\n openSearchIndexOptions,\n openSearchTargetKind,\n} from \"../connections/connectionBrowserModel\";\nimport type { Inspection } from \"../connections/useInspection\";\n\nexport function QueryTargetPicker({\n label,\n inspection,\n value,\n onChange,\n discoverable = true,\n}: {\n label: string;\n inspection: Inspection;\n value: string;\n onChange: (target: string, kind: string) => void;\n discoverable?: boolean;\n}) {\n const options = useMemo(\n () => openSearchIndexOptions(inspection.data),\n [inspection.data],\n );\n return (\n <div className=\"flex min-w-0 flex-col gap-1\">\n <Combobox\n ariaLabel={label}\n label={label}\n value={value}\n onChange={(next) =>\n onChange(next, openSearchTargetKind(inspection.data, next))\n }\n options={options}\n placeholder={\n inspection.error\n ? \"Unavailable — check the connection\"\n : discoverable\n ? `Select ${label.toLowerCase()} or type a wildcard…`\n : `Enter ${label.toLowerCase()}…`\n }\n loading={inspection.loading}\n invalid={Boolean(inspection.error)}\n allowCustomValue\n className=\"min-w-0\"\n />\n {inspection.error ? (\n <p role=\"alert\" className=\"break-words text-xs text-destructive\">\n {targetErrorMessage(inspection.error)}\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction targetErrorMessage(error: unknown): string {\n if (error instanceof Error && error.message.trim())\n return error.message.trim();\n if (typeof error === \"string\" && error.trim()) return error.trim();\n return \"The inspection request failed. Check the connection settings and try again.\";\n}\n"],"names":["useMemo","openSearchIndexOptions","jsxs","jsx","Combobox","openSearchTargetKind"],"mappings":";;;;;;AAeO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AACjB,GAMG;AACD,QAAM,UAAUA,MAAAA;AAAAA,IACd,MAAMC,uBAAAA,uBAAuB,WAAW,IAAI;AAAA,IAC5C,CAAC,WAAW,IAAI;AAAA,EAAA;AAElB,SACEC,2BAAAA,KAAC,OAAA,EAAI,WAAU,+BACb,UAAA;AAAA,IAAAC,2BAAAA;AAAAA,MAACC,SAAAA;AAAAA,MAAA;AAAA,QACC,WAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA,UAAU,CAAC,SACT,SAAS,MAAMC,uBAAAA,qBAAqB,WAAW,MAAM,IAAI,CAAC;AAAA,QAE5D;AAAA,QACA,aACE,WAAW,QACP,uCACA,eACE,UAAU,MAAM,YAAA,CAAa,yBAC7B,SAAS,MAAM,aAAa;AAAA,QAEpC,SAAS,WAAW;AAAA,QACpB,SAAS,QAAQ,WAAW,KAAK;AAAA,QACjC,kBAAgB;AAAA,QAChB,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAEX,WAAW,QACVF,2BAAAA,IAAC,KAAA,EAAE,MAAK,SAAQ,WAAU,wCACvB,UAAA,mBAAmB,WAAW,KAAK,EAAA,CACtC,IACE;AAAA,EAAA,GACN;AAEJ;AAEA,SAAS,mBAAmB,OAAwB;AAClD,MAAI,iBAAiB,SAAS,MAAM,QAAQ,KAAA;AAC1C,WAAO,MAAM,QAAQ,KAAA;AACvB,MAAI,OAAO,UAAU,YAAY,MAAM,OAAQ,QAAO,MAAM,KAAA;AAC5D,SAAO;AACT;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Inspection } from '../connections/
|
|
2
|
-
export declare function QueryTargetPicker({ label, inspection, value, onChange, }: {
|
|
1
|
+
import { Inspection } from '../connections/useInspection';
|
|
2
|
+
export declare function QueryTargetPicker({ label, inspection, value, onChange, discoverable, }: {
|
|
3
3
|
label: string;
|
|
4
4
|
inspection: Inspection;
|
|
5
5
|
value: string;
|
|
6
6
|
onChange: (target: string, kind: string) => void;
|
|
7
|
+
discoverable?: boolean;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
//# sourceMappingURL=queryTargetPicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryTargetPicker.d.ts","sourceRoot":"","sources":["../../../src/profiles/query/queryTargetPicker.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"queryTargetPicker.d.ts","sourceRoot":"","sources":["../../../src/profiles/query/queryTargetPicker.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE/D,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,UAAU,EACV,KAAK,EACL,QAAQ,EACR,YAAmB,GACpB,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,2CAkCA"}
|
|
@@ -6,7 +6,8 @@ function QueryTargetPicker({
|
|
|
6
6
|
label,
|
|
7
7
|
inspection,
|
|
8
8
|
value,
|
|
9
|
-
onChange
|
|
9
|
+
onChange,
|
|
10
|
+
discoverable = true
|
|
10
11
|
}) {
|
|
11
12
|
const options = useMemo(
|
|
12
13
|
() => openSearchIndexOptions(inspection.data),
|
|
@@ -21,7 +22,7 @@ function QueryTargetPicker({
|
|
|
21
22
|
value,
|
|
22
23
|
onChange: (next) => onChange(next, openSearchTargetKind(inspection.data, next)),
|
|
23
24
|
options,
|
|
24
|
-
placeholder: inspection.error ? "Unavailable — check the connection" : `Select ${label.toLowerCase()} or type a wildcard…`,
|
|
25
|
+
placeholder: inspection.error ? "Unavailable — check the connection" : discoverable ? `Select ${label.toLowerCase()} or type a wildcard…` : `Enter ${label.toLowerCase()}…`,
|
|
25
26
|
loading: inspection.loading,
|
|
26
27
|
invalid: Boolean(inspection.error),
|
|
27
28
|
allowCustomValue: true,
|
|
@@ -32,7 +33,8 @@ function QueryTargetPicker({
|
|
|
32
33
|
] });
|
|
33
34
|
}
|
|
34
35
|
function targetErrorMessage(error) {
|
|
35
|
-
if (error instanceof Error && error.message.trim())
|
|
36
|
+
if (error instanceof Error && error.message.trim())
|
|
37
|
+
return error.message.trim();
|
|
36
38
|
if (typeof error === "string" && error.trim()) return error.trim();
|
|
37
39
|
return "The inspection request failed. Check the connection settings and try again.";
|
|
38
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryTargetPicker.js","sources":["../../../src/profiles/query/queryTargetPicker.tsx"],"sourcesContent":["/**\n * The flat target a query runs against — an OpenSearch index, alias, data\n * stream, or the wildcard a daily rotation rolls up into. A hundred timestamped\n * index names is a searchable list, not a hierarchy, so this replaces the\n * catalog tree wherever the server declares an index target.\n */\n\nimport { Combobox } from \"../../components/Combobox\";\nimport { useMemo } from \"react\";\nimport {\n openSearchIndexOptions,\n openSearchTargetKind,\n
|
|
1
|
+
{"version":3,"file":"queryTargetPicker.js","sources":["../../../src/profiles/query/queryTargetPicker.tsx"],"sourcesContent":["/**\n * The flat target a query runs against — an OpenSearch index, alias, data\n * stream, or the wildcard a daily rotation rolls up into. A hundred timestamped\n * index names is a searchable list, not a hierarchy, so this replaces the\n * catalog tree wherever the server declares an index target.\n */\n\nimport { Combobox } from \"../../components/Combobox\";\nimport { useMemo } from \"react\";\nimport {\n openSearchIndexOptions,\n openSearchTargetKind,\n} from \"../connections/connectionBrowserModel\";\nimport type { Inspection } from \"../connections/useInspection\";\n\nexport function QueryTargetPicker({\n label,\n inspection,\n value,\n onChange,\n discoverable = true,\n}: {\n label: string;\n inspection: Inspection;\n value: string;\n onChange: (target: string, kind: string) => void;\n discoverable?: boolean;\n}) {\n const options = useMemo(\n () => openSearchIndexOptions(inspection.data),\n [inspection.data],\n );\n return (\n <div className=\"flex min-w-0 flex-col gap-1\">\n <Combobox\n ariaLabel={label}\n label={label}\n value={value}\n onChange={(next) =>\n onChange(next, openSearchTargetKind(inspection.data, next))\n }\n options={options}\n placeholder={\n inspection.error\n ? \"Unavailable — check the connection\"\n : discoverable\n ? `Select ${label.toLowerCase()} or type a wildcard…`\n : `Enter ${label.toLowerCase()}…`\n }\n loading={inspection.loading}\n invalid={Boolean(inspection.error)}\n allowCustomValue\n className=\"min-w-0\"\n />\n {inspection.error ? (\n <p role=\"alert\" className=\"break-words text-xs text-destructive\">\n {targetErrorMessage(inspection.error)}\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction targetErrorMessage(error: unknown): string {\n if (error instanceof Error && error.message.trim())\n return error.message.trim();\n if (typeof error === \"string\" && error.trim()) return error.trim();\n return \"The inspection request failed. Check the connection settings and try again.\";\n}\n"],"names":[],"mappings":";;;;AAeO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AACjB,GAMG;AACD,QAAM,UAAU;AAAA,IACd,MAAM,uBAAuB,WAAW,IAAI;AAAA,IAC5C,CAAC,WAAW,IAAI;AAAA,EAAA;AAElB,SACE,qBAAC,OAAA,EAAI,WAAU,+BACb,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA,UAAU,CAAC,SACT,SAAS,MAAM,qBAAqB,WAAW,MAAM,IAAI,CAAC;AAAA,QAE5D;AAAA,QACA,aACE,WAAW,QACP,uCACA,eACE,UAAU,MAAM,YAAA,CAAa,yBAC7B,SAAS,MAAM,aAAa;AAAA,QAEpC,SAAS,WAAW;AAAA,QACpB,SAAS,QAAQ,WAAW,KAAK;AAAA,QACjC,kBAAgB;AAAA,QAChB,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAEX,WAAW,QACV,oBAAC,KAAA,EAAE,MAAK,SAAQ,WAAU,wCACvB,UAAA,mBAAmB,WAAW,KAAK,EAAA,CACtC,IACE;AAAA,EAAA,GACN;AAEJ;AAEA,SAAS,mBAAmB,OAAwB;AAClD,MAAI,iBAAiB,SAAS,MAAM,QAAQ,KAAA;AAC1C,WAAO,MAAM,QAAQ,KAAA;AACvB,MAAI,OAAO,UAAU,YAAY,MAAM,OAAQ,QAAO,MAAM,KAAA;AAC5D,SAAO;AACT;"}
|
|
@@ -192,13 +192,20 @@ function ProfileWizard({
|
|
|
192
192
|
setDraft({
|
|
193
193
|
...draft.namespace !== void 0 ? { namespace: draft.namespace } : {},
|
|
194
194
|
provider: {
|
|
195
|
-
|
|
195
|
+
// The first candidate is the most specific one. Where the
|
|
196
|
+
// connection type is read by several providers the step
|
|
197
|
+
// offers the choice, and this is only what it opens on.
|
|
198
|
+
...choice.providerTypes[0] ? { type: choice.providerTypes[0] } : {},
|
|
196
199
|
connection: choice.value
|
|
197
200
|
}
|
|
198
201
|
});
|
|
199
202
|
setDiscovered([]);
|
|
200
203
|
setActiveField("");
|
|
201
|
-
}
|
|
204
|
+
},
|
|
205
|
+
onProviderTypeChange: (type) => setDraft({
|
|
206
|
+
...draft,
|
|
207
|
+
provider: { ...draft.provider, type }
|
|
208
|
+
})
|
|
202
209
|
}
|
|
203
210
|
) : null,
|
|
204
211
|
step.id === "query" && connectionID ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -239,13 +246,15 @@ function cloneInitialDraft(value) {
|
|
|
239
246
|
}
|
|
240
247
|
function connectionChoice(value, node) {
|
|
241
248
|
const label = clickyNodeText(node) || value;
|
|
242
|
-
const
|
|
243
|
-
if (!
|
|
249
|
+
const connectionType = profileWizardModel.connectionTypeFromLabel(label);
|
|
250
|
+
if (!connectionType) return null;
|
|
251
|
+
const providerTypes = profileWizardModel.providerTypesForConnectionType(connectionType);
|
|
244
252
|
return {
|
|
245
253
|
value,
|
|
246
254
|
label,
|
|
247
255
|
name: profileWizardModel.profileConnectionID(value) ?? label,
|
|
248
|
-
|
|
256
|
+
connectionType,
|
|
257
|
+
providerTypes
|
|
249
258
|
};
|
|
250
259
|
}
|
|
251
260
|
function clickyNodeText(node) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileWizard.cjs","sources":["../../../src/profiles/wizard/profileWizard.tsx"],"sourcesContent":["import { Button } from \"../../components/button\";\nimport type { ClickyNode } from \"../../data/Clicky\";\nimport { Modal } from \"../../overlay/Modal\";\nimport type { ResolvedOperation } from \"../../rpc/types\";\nimport type { OperationsApiClient } from \"../../rpc/useOperations\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useDeferredValue, useMemo, useState } from \"react\";\nimport { ProfileWizardQueryStep, type ProfileSample } from \"./profileWizardQueryStep\";\nimport {\n profileConnectionID,\n profileWizardErrorMessage,\n profileWizardStepReady,\n profileWizardSteps,\n providerTypeFromConnectionLabel,\n type ProfileColumn,\n type ProfileWizardDraft,\n} from \"./profileWizardModel\";\nimport {\n FieldsStep,\n ReviewStep,\n SourceStep,\n WizardProgress,\n type ConnectionChoice,\n} from \"./profileWizardSteps\";\nimport { stepHelp } from \"./profileWizardHelp\";\n\ntype ProfileWizardProps = {\n client: OperationsApiClient;\n action: ResolvedOperation;\n initialValue: Record<string, unknown>;\n onClose: () => void;\n onSuccess: () => void | Promise<void>;\n};\n\nexport function ProfileWizard({\n client,\n action,\n initialValue,\n onClose,\n onSuccess,\n}: ProfileWizardProps) {\n const initialDraft = useMemo(() => cloneInitialDraft(initialValue), [initialValue]);\n const [stepIndex, setStepIndex] = useState(0);\n const [draft, setDraft] = useState<ProfileWizardDraft>(initialDraft);\n const [discovered, setDiscovered] = useState<ProfileColumn[]>(\n initialDraft.columns ?? [],\n );\n const [activeField, setActiveField] = useState(\n initialDraft.columns?.[0]?.name ?? \"\",\n );\n const [connectionSearch, setConnectionSearch] = useState(\"\");\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState(\"\");\n const deferredConnectionSearch = useDeferredValue(connectionSearch);\n const connections = useQuery({\n queryKey: [\"profile-wizard-connections\", deferredConnectionSearch],\n queryFn: () => {\n if (!client.lookupFilterOptions) {\n throw new Error(\"Connection lookup is unavailable\");\n }\n return client.lookupFilterOptions(\n \"/api/v1/connection\",\n \"GET\",\n \"connection\",\n deferredConnectionSearch,\n );\n },\n retry: 0,\n });\n const connectionChoices = useMemo(\n () =>\n Object.entries(connections.data?.options ?? {})\n .map(([value, node]) => connectionChoice(value, node))\n .filter((choice): choice is ConnectionChoice => choice != null)\n .sort((left, right) => left.name.localeCompare(right.name)),\n [connections.data?.options],\n );\n const step = profileWizardSteps[stepIndex];\n // stepIndex only ever moves between 0 and the last step, so an out-of-range\n // one is a broken navigation guard rather than a state the UI should render\n // around — say so instead of rendering a wizard with no current step.\n if (!step) throw new Error(`wizard step ${stepIndex} is out of range`);\n const connectionID = profileConnectionID(draft.provider?.connection ?? \"\");\n const currentStepReady = profileWizardStepReady(\n step.id,\n draft,\n discovered,\n );\n\n const updateQueryDraft = (next: ProfileWizardDraft) => {\n if (next.query !== draft.query) setDiscovered([]);\n setDraft(next);\n };\n\n const acceptSample = ({ columns }: ProfileSample) => {\n setDiscovered(columns);\n setActiveField((current) =>\n columns.some((field) => field.name === current)\n ? current\n : (columns[0]?.name ?? \"\"),\n );\n setDraft((current) => {\n const configuredByName = new Map(\n (current.columns ?? []).map((field) => [field.name, field]),\n );\n return {\n ...current,\n columns:\n configuredByName.size === 0\n ? columns\n : columns\n .filter((field) => configuredByName.has(field.name))\n .map((field) => ({\n ...field,\n ...configuredByName.get(field.name),\n })),\n };\n });\n };\n\n const save = async () => {\n setSaving(true);\n setError(\"\");\n try {\n if (!client.submitForm) {\n throw new Error(\"Profile creation is unavailable\");\n }\n const response = await client.submitForm(action.path, action.method, draft);\n if (!response.success) {\n throw new Error(\n response.error || response.message || \"Profile creation failed\",\n );\n }\n await onSuccess();\n } catch (saveError) {\n setError(profileWizardErrorMessage(saveError, \"Profile creation failed\"));\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <Modal\n open\n onClose={onClose}\n confirmClose={\n stepIndex > 0 || draft.query\n ? {\n title: \"Discard this profile?\",\n message: \"Your query and field configuration will be lost.\",\n confirmLabel: \"Discard profile\",\n }\n : false\n }\n title=\"Build a profile\"\n subtitle={\n <WizardProgress\n stepIndex={stepIndex}\n onStepChange={(next) => {\n if (next < stepIndex) setStepIndex(next);\n }}\n />\n }\n size=\"full\"\n className=\"h-[calc(100dvh-2rem)]\"\n scrollBody={false}\n footer={\n <div className=\"flex w-full items-center gap-3\">\n <span className=\"text-xs text-muted-foreground\">\n Step {stepIndex + 1} of {profileWizardSteps.length}\n </span>\n {error ? (\n <span className=\"ml-3 text-sm text-destructive\">{error}</span>\n ) : null}\n <div className=\"ml-auto flex gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={onClose}>\n Cancel\n </Button>\n {stepIndex > 0 ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={saving}\n onClick={() => setStepIndex((current) => current - 1)}\n >\n Back\n </Button>\n ) : null}\n {stepIndex < profileWizardSteps.length - 1 ? (\n <Button\n type=\"button\"\n disabled={!currentStepReady}\n onClick={() => setStepIndex((current) => current + 1)}\n >\n Continue\n </Button>\n ) : (\n <Button\n type=\"button\"\n disabled={!currentStepReady || saving}\n onClick={() => void save()}\n >\n {saving ? \"Saving…\" : \"Save profile\"}\n </Button>\n )}\n </div>\n </div>\n }\n >\n <div className=\"flex h-full min-h-0 flex-col gap-5\">\n <div className=\"shrink-0\">\n <p className=\"text-xs font-semibold uppercase tracking-[0.18em] text-primary\">\n {step.description}\n </p>\n <h2 className=\"mt-1 text-xl font-semibold\">{step.label}</h2>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n {stepHelp[step.id]}\n </p>\n </div>\n <div key={step.id} className=\"min-h-0 flex-1 overflow-auto\">\n {step.id === \"source\" ? (\n <SourceStep\n choices={connectionChoices}\n loading={connections.isLoading}\n error={connections.error}\n {...(connections.data?.truncated !== undefined\n ? { truncated: connections.data.truncated }\n : {})}\n {...(connections.data?.total !== undefined\n ? { total: connections.data.total }\n : {})}\n search={connectionSearch}\n selected={draft.provider?.connection ?? \"\"}\n selectedType={draft.provider?.type ?? \"\"}\n onSearchChange={setConnectionSearch}\n onSelect={(choice) => {\n if (choice.value === draft.provider?.connection) return;\n setDraft({\n ...(draft.namespace !== undefined\n ? { namespace: draft.namespace }\n : {}),\n provider: {\n type: choice.providerType,\n connection: choice.value,\n },\n });\n setDiscovered([]);\n setActiveField(\"\");\n }}\n />\n ) : null}\n {step.id === \"query\" && connectionID ? (\n <ProfileWizardQueryStep\n key={connectionID}\n connectionID={connectionID}\n draft={draft}\n discovered={discovered}\n onDraftChange={updateQueryDraft}\n onSample={acceptSample}\n />\n ) : null}\n {step.id === \"fields\" ? (\n <FieldsStep\n draft={draft}\n discovered={discovered}\n activeField={activeField}\n onDraftChange={setDraft}\n onActiveFieldChange={setActiveField}\n />\n ) : null}\n {step.id === \"review\" ? (\n <ReviewStep draft={draft} discovered={discovered} />\n ) : null}\n </div>\n </div>\n </Modal>\n );\n}\n\nfunction cloneInitialDraft(value: Record<string, unknown>): ProfileWizardDraft {\n const draft = value as ProfileWizardDraft;\n return {\n ...draft,\n provider: draft.provider ? { ...draft.provider } : {},\n columns: draft.columns?.map((column) => ({ ...column })) ?? [],\n };\n}\n\nfunction connectionChoice(\n value: string,\n node: ClickyNode,\n): ConnectionChoice | null {\n const label = clickyNodeText(node) || value;\n const providerType = providerTypeFromConnectionLabel(label);\n if (!providerType) return null;\n return {\n value,\n label,\n name: profileConnectionID(value) ?? label,\n providerType,\n };\n}\n\nfunction clickyNodeText(node: ClickyNode): string {\n if (node.plain) return node.plain;\n if (node.text) return node.text;\n return (node.children ?? []).map(clickyNodeText).join(\"\");\n}\n"],"names":["useMemo","useState","useDeferredValue","useQuery","_a","profileWizardSteps","profileConnectionID","profileWizardStepReady","profileWizardErrorMessage","jsx","Modal","WizardProgress","jsxs","Button","stepHelp","SourceStep","ProfileWizardQueryStep","FieldsStep","ReviewStep","providerTypeFromConnectionLabel"],"mappings":";;;;;;;;;;;AAkCO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAuB;;AACrB,QAAM,eAAeA,MAAAA,QAAQ,MAAM,kBAAkB,YAAY,GAAG,CAAC,YAAY,CAAC;AAClF,QAAM,CAAC,WAAW,YAAY,IAAIC,MAAAA,SAAS,CAAC;AAC5C,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAA6B,YAAY;AACnE,QAAM,CAAC,YAAY,aAAa,IAAIA,MAAAA;AAAAA,IAClC,aAAa,WAAW,CAAA;AAAA,EAAC;AAE3B,QAAM,CAAC,aAAa,cAAc,IAAIA,MAAAA;AAAAA,MACpC,wBAAa,YAAb,mBAAuB,OAAvB,mBAA2B,SAAQ;AAAA,EAAA;AAErC,QAAM,CAAC,kBAAkB,mBAAmB,IAAIA,MAAAA,SAAS,EAAE;AAC3D,QAAM,CAAC,QAAQ,SAAS,IAAIA,MAAAA,SAAS,KAAK;AAC1C,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAS,EAAE;AACrC,QAAM,2BAA2BC,MAAAA,iBAAiB,gBAAgB;AAClE,QAAM,cAAcC,WAAAA,SAAS;AAAA,IAC3B,UA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AAA;AAAAA,YAAA;AAAA,cAEC;AAAA,cACA;AAAA,cACA;AAAA,cACA,eAAe;AAAA,cACf,UAAU;AAAA,YAAA;AAAA,YALL;AAAA,UAAA,IAOL;AAAA,UACH,KAAK,OAAO,WACXP,2BAAAA;AAAAA,YAACQ,mBAAAA;AAAAA,YAAA;AAAA,cACC;AAAA,cACA;AAAA,cACA;AAAA,cACA,eAAe;AAAA,cACf,qBAAqB;AAAA,YAAA;AAAA,UAAA,IAErB;AAAA,UACH,KAAK,OAAO,0CACVC,mBAAAA,YAAA,EAAW,OAAc,YAAwB,IAChD;AAAA,QAAA,EAAA,GArDI,KAAK,EAsDf;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,SAAS,kBAAkB,OAAoD;;AAC7E,QAAM,QAAQ;AACd,SAAO;AAAA,IACL,GAAG;AAAA,IACH,UAAU,MAAM,WAAW,EAAE,GAAG,MAAM,SAAA,IAAa,CAAA;AAAA,IACnD,WAAS,WAAM,YAAN,mBAAe,IAAI,CAAC,YAAY,EAAE,GAAG,OAAA,QAAc,CAAA;AAAA,EAAC;AAEjE;AAEA,SAAS,iBACP,OACA,MACyB;AACzB,QAAM,QAAQ,eAAe,IAAI,KAAK;AACtC,QAAM,eAAeC,mBAAAA,gCAAgC,KAAK;AAC1D,MAAI,CAAC,aAAc,QAAO;AAC1B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,MAAMb,mBAAAA,oBAAoB,KAAK,KAAK;AAAA,IACpC;AAAA,EAAA;AAEJ;AAEA,SAAS,eAAe,MAA0B;AAChD,MAAI,KAAK,MAAO,QAAO,KAAK;AAC5B,MAAI,KAAK,KAAM,QAAO,KAAK;AAC3B,UAAQ,KAAK,YAAY,CAAA,GAAI,IAAI,cAAc,EAAE,KAAK,EAAE;AAC1D;;"}
|
|
1
|
+
{"version":3,"file":"profileWizard.cjs","sources":["../../../src/profiles/wizard/profileWizard.tsx"],"sourcesContent":["import { Button } from \"../../components/button\";\nimport type { ClickyNode } from \"../../data/Clicky\";\nimport { Modal } from \"../../overlay/Modal\";\nimport type { ResolvedOperation } from \"../../rpc/types\";\nimport type { OperationsApiClient } from \"../../rpc/useOperations\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useDeferredValue, useMemo, useState } from \"react\";\nimport { ProfileWizardQueryStep, type ProfileSample } from \"./profileWizardQueryStep\";\nimport {\n profileConnectionID,\n profileWizardErrorMessage,\n profileWizardStepReady,\n profileWizardSteps,\n connectionTypeFromLabel,\n providerTypesForConnectionType,\n type ProfileColumn,\n type ProfileWizardDraft,\n} from \"./profileWizardModel\";\nimport {\n FieldsStep,\n ReviewStep,\n SourceStep,\n WizardProgress,\n type ConnectionChoice,\n} from \"./profileWizardSteps\";\nimport { stepHelp } from \"./profileWizardHelp\";\n\ntype ProfileWizardProps = {\n client: OperationsApiClient;\n action: ResolvedOperation;\n initialValue: Record<string, unknown>;\n onClose: () => void;\n onSuccess: () => void | Promise<void>;\n};\n\nexport function ProfileWizard({\n client,\n action,\n initialValue,\n onClose,\n onSuccess,\n}: ProfileWizardProps) {\n const initialDraft = useMemo(() => cloneInitialDraft(initialValue), [initialValue]);\n const [stepIndex, setStepIndex] = useState(0);\n const [draft, setDraft] = useState<ProfileWizardDraft>(initialDraft);\n const [discovered, setDiscovered] = useState<ProfileColumn[]>(\n initialDraft.columns ?? [],\n );\n const [activeField, setActiveField] = useState(\n initialDraft.columns?.[0]?.name ?? \"\",\n );\n const [connectionSearch, setConnectionSearch] = useState(\"\");\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState(\"\");\n const deferredConnectionSearch = useDeferredValue(connectionSearch);\n const connections = useQuery({\n queryKey: [\"profile-wizard-connections\", deferredConnectionSearch],\n queryFn: () => {\n if (!client.lookupFilterOptions) {\n throw new Error(\"Connection lookup is unavailable\");\n }\n return client.lookupFilterOptions(\n \"/api/v1/connection\",\n \"GET\",\n \"connection\",\n deferredConnectionSearch,\n );\n },\n retry: 0,\n });\n const connectionChoices = useMemo(\n () =>\n Object.entries(connections.data?.options ?? {})\n .map(([value, node]) => connectionChoice(value, node))\n .filter((choice): choice is ConnectionChoice => choice != null)\n .sort((left, right) => left.name.localeCompare(right.name)),\n [connections.data?.options],\n );\n const step = profileWizardSteps[stepIndex];\n // stepIndex only ever moves between 0 and the last step, so an out-of-range\n // one is a broken navigation guard rather than a state the UI should render\n // around — say so instead of rendering a wizard with no current step.\n if (!step) throw new Error(`wizard step ${stepIndex} is out of range`);\n const connectionID = profileConnectionID(draft.provider?.connection ?? \"\");\n const currentStepReady = profileWizardStepReady(\n step.id,\n draft,\n discovered,\n );\n\n const updateQueryDraft = (next: ProfileWizardDraft) => {\n if (next.query !== draft.query) setDiscovered([]);\n setDraft(next);\n };\n\n const acceptSample = ({ columns }: ProfileSample) => {\n setDiscovered(columns);\n setActiveField((current) =>\n columns.some((field) => field.name === current)\n ? current\n : (columns[0]?.name ?? \"\"),\n );\n setDraft((current) => {\n const configuredByName = new Map(\n (current.columns ?? []).map((field) => [field.name, field]),\n );\n return {\n ...current,\n columns:\n configuredByName.size === 0\n ? columns\n : columns\n .filter((field) => configuredByName.has(field.name))\n .map((field) => ({\n ...field,\n ...configuredByName.get(field.name),\n })),\n };\n });\n };\n\n const save = async () => {\n setSaving(true);\n setError(\"\");\n try {\n if (!client.submitForm) {\n throw new Error(\"Profile creation is unavailable\");\n }\n const response = await client.submitForm(action.path, action.method, draft);\n if (!response.success) {\n throw new Error(\n response.error || response.message || \"Profile creation failed\",\n );\n }\n await onSuccess();\n } catch (saveError) {\n setError(profileWizardErrorMessage(saveError, \"Profile creation failed\"));\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <Modal\n open\n onClose={onClose}\n confirmClose={\n stepIndex > 0 || draft.query\n ? {\n title: \"Discard this profile?\",\n message: \"Your query and field configuration will be lost.\",\n confirmLabel: \"Discard profile\",\n }\n : false\n }\n title=\"Build a profile\"\n subtitle={\n <WizardProgress\n stepIndex={stepIndex}\n onStepChange={(next) => {\n if (next < stepIndex) setStepIndex(next);\n }}\n />\n }\n size=\"full\"\n className=\"h-[calc(100dvh-2rem)]\"\n scrollBody={false}\n footer={\n <div className=\"flex w-full items-center gap-3\">\n <span className=\"text-xs text-muted-foreground\">\n Step {stepIndex + 1} of {profileWizardSteps.length}\n </span>\n {error ? (\n <span className=\"ml-3 text-sm text-destructive\">{error}</span>\n ) : null}\n <div className=\"ml-auto flex gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={onClose}>\n Cancel\n </Button>\n {stepIndex > 0 ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={saving}\n onClick={() => setStepIndex((current) => current - 1)}\n >\n Back\n </Button>\n ) : null}\n {stepIndex < profileWizardSteps.length - 1 ? (\n <Button\n type=\"button\"\n disabled={!currentStepReady}\n onClick={() => setStepIndex((current) => current + 1)}\n >\n Continue\n </Button>\n ) : (\n <Button\n type=\"button\"\n disabled={!currentStepReady || saving}\n onClick={() => void save()}\n >\n {saving ? \"Saving…\" : \"Save profile\"}\n </Button>\n )}\n </div>\n </div>\n }\n >\n <div className=\"flex h-full min-h-0 flex-col gap-5\">\n <div className=\"shrink-0\">\n <p className=\"text-xs font-semibold uppercase tracking-[0.18em] text-primary\">\n {step.description}\n </p>\n <h2 className=\"mt-1 text-xl font-semibold\">{step.label}</h2>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n {stepHelp[step.id]}\n </p>\n </div>\n <div key={step.id} className=\"min-h-0 flex-1 overflow-auto\">\n {step.id === \"source\" ? (\n <SourceStep\n choices={connectionChoices}\n loading={connections.isLoading}\n error={connections.error}\n {...(connections.data?.truncated !== undefined\n ? { truncated: connections.data.truncated }\n : {})}\n {...(connections.data?.total !== undefined\n ? { total: connections.data.total }\n : {})}\n search={connectionSearch}\n selected={draft.provider?.connection ?? \"\"}\n selectedType={draft.provider?.type ?? \"\"}\n onSearchChange={setConnectionSearch}\n onSelect={(choice) => {\n if (choice.value === draft.provider?.connection) return;\n setDraft({\n ...(draft.namespace !== undefined\n ? { namespace: draft.namespace }\n : {}),\n provider: {\n // The first candidate is the most specific one. Where the\n // connection type is read by several providers the step\n // offers the choice, and this is only what it opens on.\n ...(choice.providerTypes[0]\n ? { type: choice.providerTypes[0] }\n : {}),\n connection: choice.value,\n },\n });\n setDiscovered([]);\n setActiveField(\"\");\n }}\n onProviderTypeChange={(type) =>\n setDraft({\n ...draft,\n provider: { ...draft.provider, type },\n })\n }\n />\n ) : null}\n {step.id === \"query\" && connectionID ? (\n <ProfileWizardQueryStep\n key={connectionID}\n connectionID={connectionID}\n draft={draft}\n discovered={discovered}\n onDraftChange={updateQueryDraft}\n onSample={acceptSample}\n />\n ) : null}\n {step.id === \"fields\" ? (\n <FieldsStep\n draft={draft}\n discovered={discovered}\n activeField={activeField}\n onDraftChange={setDraft}\n onActiveFieldChange={setActiveField}\n />\n ) : null}\n {step.id === \"review\" ? (\n <ReviewStep draft={draft} discovered={discovered} />\n ) : null}\n </div>\n </div>\n </Modal>\n );\n}\n\nfunction cloneInitialDraft(value: Record<string, unknown>): ProfileWizardDraft {\n const draft = value as ProfileWizardDraft;\n return {\n ...draft,\n provider: draft.provider ? { ...draft.provider } : {},\n columns: draft.columns?.map((column) => ({ ...column })) ?? [],\n };\n}\n\nfunction connectionChoice(\n value: string,\n node: ClickyNode,\n): ConnectionChoice | null {\n const label = clickyNodeText(node) || value;\n const connectionType = connectionTypeFromLabel(label);\n if (!connectionType) return null;\n // A connection no provider reads is still listed, with an empty candidate\n // set: the Source step says so rather than the wizard emitting a draft whose\n // provider.type is not in the schema's enum.\n const providerTypes = providerTypesForConnectionType(connectionType);\n return {\n value,\n label,\n name: profileConnectionID(value) ?? label,\n connectionType,\n providerTypes,\n };\n}\n\nfunction clickyNodeText(node: ClickyNode): string {\n if (node.plain) return node.plain;\n if (node.text) return node.text;\n return (node.children ?? []).map(clickyNodeText).join(\"\");\n}\n"],"names":["useMemo","useState","useDeferredValue","useQuery","_a","profileWizardSteps","profileConnectionID","profileWizardStepReady","profileWizardErrorMessage","jsx","Modal","WizardProgress","jsxs","Button","stepHelp","SourceStep","ProfileWizardQueryStep","FieldsStep","ReviewStep","connectionTypeFromLabel","providerTypesForConnectionType"],"mappings":";;;;;;;;;;;AAmCO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAuB;;AACrB,QAAM,eAAeA,MAAAA,QAAQ,MAAM,kBAAkB,YAAY,GAAG,CAAC,YAAY,CAAC;AAClF,QAAM,CAAC,WAAW,YAAY,IAAIC,MAAAA,SAAS,CAAC;AAC5C,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAA6B,YAAY;AACnE,QAAM,CAAC,YAAY,aAAa,IAAIA,MAAAA;AAAAA,IAClC,aAAa,WAAW,CAAA;AAAA,EAAC;AAE3B,QAAM,CAAC,aAAa,cAAc,IAAIA,MAAAA;AAAAA,MACpC,wBAAa,YAAb,mBAAuB,OAAvB,mBAA2B,SAAQ;AAAA,EAAA;AAErC,QAAM,CAAC,kBAAkB,mBAAmB,IAAIA,MAAAA,SAAS,EAAE;AAC3D,QAAM,CAAC,QAAQ,SAAS,IAAIA,MAAAA,SAAS,KAAK;AAC1C,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAS,EAAE;AACrC,QAAM,2BAA2BC,MAAAA,iBAAiB,gBAAgB;AAClE,QAAM,cAAcC,WAAAA,SAAS;AAAA,IAC3B,UAAU,CAAC,8BAA8B,wBAAwB;AAAA,IACjE,SAAS,MAAM;AACb,UAAI,CAAC,OAAO,qBAAqB;AAC/B,cAAM,IAAI,MAAM,kCAAkC;AAAA,MACpD;AACA,aAAO,OAAO;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IAEJ;AAAA,IACA,OAAO;AAAA,EAAA,CACR;AACD,QAAM,oBAAoBH,MAAAA;AAAAA,IACxB,MAAA;;AACE,oBAAO,UAAQI,MAAA,YAA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AE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"profileWizard.d.ts","sourceRoot":"","sources":["../../../src/profiles/wizard/profileWizard.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAuBnE,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,MAAM,EACN,YAAY,EACZ,OAAO,EACP,SAAS,GACV,EAAE,kBAAkB,2CAwPpB"}
|
|
@@ -4,7 +4,7 @@ import { Modal } from "../../overlay/Modal.js";
|
|
|
4
4
|
import { useQuery } from "@tanstack/react-query";
|
|
5
5
|
import { useMemo, useState, useDeferredValue } from "react";
|
|
6
6
|
import { ProfileWizardQueryStep } from "./profileWizardQueryStep.js";
|
|
7
|
-
import { profileWizardSteps, profileConnectionID, profileWizardStepReady,
|
|
7
|
+
import { profileWizardSteps, profileConnectionID, profileWizardStepReady, connectionTypeFromLabel, providerTypesForConnectionType, profileWizardErrorMessage } from "./profileWizardModel.js";
|
|
8
8
|
import { SourceStep, FieldsStep, ReviewStep, WizardProgress } from "./profileWizardSteps.js";
|
|
9
9
|
import { stepHelp } from "./profileWizardHelp.js";
|
|
10
10
|
function ProfileWizard({
|
|
@@ -190,13 +190,20 @@ function ProfileWizard({
|
|
|
190
190
|
setDraft({
|
|
191
191
|
...draft.namespace !== void 0 ? { namespace: draft.namespace } : {},
|
|
192
192
|
provider: {
|
|
193
|
-
|
|
193
|
+
// The first candidate is the most specific one. Where the
|
|
194
|
+
// connection type is read by several providers the step
|
|
195
|
+
// offers the choice, and this is only what it opens on.
|
|
196
|
+
...choice.providerTypes[0] ? { type: choice.providerTypes[0] } : {},
|
|
194
197
|
connection: choice.value
|
|
195
198
|
}
|
|
196
199
|
});
|
|
197
200
|
setDiscovered([]);
|
|
198
201
|
setActiveField("");
|
|
199
|
-
}
|
|
202
|
+
},
|
|
203
|
+
onProviderTypeChange: (type) => setDraft({
|
|
204
|
+
...draft,
|
|
205
|
+
provider: { ...draft.provider, type }
|
|
206
|
+
})
|
|
200
207
|
}
|
|
201
208
|
) : null,
|
|
202
209
|
step.id === "query" && connectionID ? /* @__PURE__ */ jsx(
|
|
@@ -237,13 +244,15 @@ function cloneInitialDraft(value) {
|
|
|
237
244
|
}
|
|
238
245
|
function connectionChoice(value, node) {
|
|
239
246
|
const label = clickyNodeText(node) || value;
|
|
240
|
-
const
|
|
241
|
-
if (!
|
|
247
|
+
const connectionType = connectionTypeFromLabel(label);
|
|
248
|
+
if (!connectionType) return null;
|
|
249
|
+
const providerTypes = providerTypesForConnectionType(connectionType);
|
|
242
250
|
return {
|
|
243
251
|
value,
|
|
244
252
|
label,
|
|
245
253
|
name: profileConnectionID(value) ?? label,
|
|
246
|
-
|
|
254
|
+
connectionType,
|
|
255
|
+
providerTypes
|
|
247
256
|
};
|
|
248
257
|
}
|
|
249
258
|
function clickyNodeText(node) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileWizard.js","sources":["../../../src/profiles/wizard/profileWizard.tsx"],"sourcesContent":["import { Button } from \"../../components/button\";\nimport type { ClickyNode } from \"../../data/Clicky\";\nimport { Modal } from \"../../overlay/Modal\";\nimport type { ResolvedOperation } from \"../../rpc/types\";\nimport type { OperationsApiClient } from \"../../rpc/useOperations\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useDeferredValue, useMemo, useState } from \"react\";\nimport { ProfileWizardQueryStep, type ProfileSample } from \"./profileWizardQueryStep\";\nimport {\n profileConnectionID,\n profileWizardErrorMessage,\n profileWizardStepReady,\n profileWizardSteps,\n providerTypeFromConnectionLabel,\n type ProfileColumn,\n type ProfileWizardDraft,\n} from \"./profileWizardModel\";\nimport {\n FieldsStep,\n ReviewStep,\n SourceStep,\n WizardProgress,\n type ConnectionChoice,\n} from \"./profileWizardSteps\";\nimport { stepHelp } from \"./profileWizardHelp\";\n\ntype ProfileWizardProps = {\n client: OperationsApiClient;\n action: ResolvedOperation;\n initialValue: Record<string, unknown>;\n onClose: () => void;\n onSuccess: () => void | Promise<void>;\n};\n\nexport function ProfileWizard({\n client,\n action,\n initialValue,\n onClose,\n onSuccess,\n}: ProfileWizardProps) {\n const initialDraft = useMemo(() => cloneInitialDraft(initialValue), [initialValue]);\n const [stepIndex, setStepIndex] = useState(0);\n const [draft, setDraft] = useState<ProfileWizardDraft>(initialDraft);\n const [discovered, setDiscovered] = useState<ProfileColumn[]>(\n initialDraft.columns ?? [],\n );\n const [activeField, setActiveField] = useState(\n initialDraft.columns?.[0]?.name ?? \"\",\n );\n const [connectionSearch, setConnectionSearch] = useState(\"\");\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState(\"\");\n const deferredConnectionSearch = useDeferredValue(connectionSearch);\n const connections = useQuery({\n queryKey: [\"profile-wizard-connections\", deferredConnectionSearch],\n queryFn: () => {\n if (!client.lookupFilterOptions) {\n throw new Error(\"Connection lookup is unavailable\");\n }\n return client.lookupFilterOptions(\n \"/api/v1/connection\",\n \"GET\",\n \"connection\",\n deferredConnectionSearch,\n );\n },\n retry: 0,\n });\n const connectionChoices = useMemo(\n () =>\n Object.entries(connections.data?.options ?? {})\n .map(([value, node]) => connectionChoice(value, node))\n .filter((choice): choice is ConnectionChoice => choice != null)\n .sort((left, right) => left.name.localeCompare(right.name)),\n [connections.data?.options],\n );\n const step = profileWizardSteps[stepIndex];\n // stepIndex only ever moves between 0 and the last step, so an out-of-range\n // one is a broken navigation guard rather than a state the UI should render\n // around — say so instead of rendering a wizard with no current step.\n if (!step) throw new Error(`wizard step ${stepIndex} is out of range`);\n const connectionID = profileConnectionID(draft.provider?.connection ?? \"\");\n const currentStepReady = profileWizardStepReady(\n step.id,\n draft,\n discovered,\n );\n\n const updateQueryDraft = (next: ProfileWizardDraft) => {\n if (next.query !== draft.query) setDiscovered([]);\n setDraft(next);\n };\n\n const acceptSample = ({ columns }: ProfileSample) => {\n setDiscovered(columns);\n setActiveField((current) =>\n columns.some((field) => field.name === current)\n ? current\n : (columns[0]?.name ?? \"\"),\n );\n setDraft((current) => {\n const configuredByName = new Map(\n (current.columns ?? []).map((field) => [field.name, field]),\n );\n return {\n ...current,\n columns:\n configuredByName.size === 0\n ? columns\n : columns\n .filter((field) => configuredByName.has(field.name))\n .map((field) => ({\n ...field,\n ...configuredByName.get(field.name),\n })),\n };\n });\n };\n\n const save = async () => {\n setSaving(true);\n setError(\"\");\n try {\n if (!client.submitForm) {\n throw new Error(\"Profile creation is unavailable\");\n }\n const response = await client.submitForm(action.path, action.method, draft);\n if (!response.success) {\n throw new Error(\n response.error || response.message || \"Profile creation failed\",\n );\n }\n await onSuccess();\n } catch (saveError) {\n setError(profileWizardErrorMessage(saveError, \"Profile creation failed\"));\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <Modal\n open\n onClose={onClose}\n confirmClose={\n stepIndex > 0 || draft.query\n ? {\n title: \"Discard this profile?\",\n message: \"Your query and field configuration will be lost.\",\n confirmLabel: \"Discard profile\",\n }\n : false\n }\n title=\"Build a profile\"\n subtitle={\n <WizardProgress\n stepIndex={stepIndex}\n onStepChange={(next) => {\n if (next < stepIndex) setStepIndex(next);\n }}\n />\n }\n size=\"full\"\n className=\"h-[calc(100dvh-2rem)]\"\n scrollBody={false}\n footer={\n <div className=\"flex w-full items-center gap-3\">\n <span className=\"text-xs text-muted-foreground\">\n Step {stepIndex + 1} of {profileWizardSteps.length}\n </span>\n {error ? (\n <span className=\"ml-3 text-sm text-destructive\">{error}</span>\n ) : null}\n <div className=\"ml-auto flex gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={onClose}>\n Cancel\n </Button>\n {stepIndex > 0 ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={saving}\n onClick={() => setStepIndex((current) => current - 1)}\n >\n Back\n </Button>\n ) : null}\n {stepIndex < profileWizardSteps.length - 1 ? (\n <Button\n type=\"button\"\n disabled={!currentStepReady}\n onClick={() => setStepIndex((current) => current + 1)}\n >\n Continue\n </Button>\n ) : (\n <Button\n type=\"button\"\n disabled={!currentStepReady || saving}\n onClick={() => void save()}\n >\n {saving ? \"Saving…\" : \"Save profile\"}\n </Button>\n )}\n </div>\n </div>\n }\n >\n <div className=\"flex h-full min-h-0 flex-col gap-5\">\n <div className=\"shrink-0\">\n <p className=\"text-xs font-semibold uppercase tracking-[0.18em] text-primary\">\n {step.description}\n </p>\n <h2 className=\"mt-1 text-xl font-semibold\">{step.label}</h2>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n {stepHelp[step.id]}\n </p>\n </div>\n <div key={step.id} className=\"min-h-0 flex-1 overflow-auto\">\n {step.id === \"source\" ? (\n <SourceStep\n choices={connectionChoices}\n loading={connections.isLoading}\n error={connections.error}\n {...(connections.data?.truncated !== undefined\n ? { truncated: connections.data.truncated }\n : {})}\n {...(connections.data?.total !== undefined\n ? { total: connections.data.total }\n : {})}\n search={connectionSearch}\n selected={draft.provider?.connection ?? \"\"}\n selectedType={draft.provider?.type ?? \"\"}\n onSearchChange={setConnectionSearch}\n onSelect={(choice) => {\n if (choice.value === draft.provider?.connection) return;\n setDraft({\n ...(draft.namespace !== undefined\n ? { namespace: draft.namespace }\n : {}),\n provider: {\n type: choice.providerType,\n connection: choice.value,\n },\n });\n setDiscovered([]);\n setActiveField(\"\");\n }}\n />\n ) : null}\n {step.id === \"query\" && connectionID ? (\n <ProfileWizardQueryStep\n key={connectionID}\n connectionID={connectionID}\n draft={draft}\n discovered={discovered}\n onDraftChange={updateQueryDraft}\n onSample={acceptSample}\n />\n ) : null}\n {step.id === \"fields\" ? (\n <FieldsStep\n draft={draft}\n discovered={discovered}\n activeField={activeField}\n onDraftChange={setDraft}\n onActiveFieldChange={setActiveField}\n />\n ) : null}\n {step.id === \"review\" ? (\n <ReviewStep draft={draft} discovered={discovered} />\n ) : null}\n </div>\n </div>\n </Modal>\n );\n}\n\nfunction cloneInitialDraft(value: Record<string, unknown>): ProfileWizardDraft {\n const draft = value as ProfileWizardDraft;\n return {\n ...draft,\n provider: draft.provider ? { ...draft.provider } : {},\n columns: draft.columns?.map((column) => ({ ...column })) ?? [],\n };\n}\n\nfunction connectionChoice(\n value: string,\n node: ClickyNode,\n): ConnectionChoice | null {\n const label = clickyNodeText(node) || value;\n const providerType = providerTypeFromConnectionLabel(label);\n if (!providerType) return null;\n return {\n value,\n label,\n name: profileConnectionID(value) ?? label,\n providerType,\n };\n}\n\nfunction clickyNodeText(node: ClickyNode): string {\n if (node.plain) return node.plain;\n if (node.text) return node.text;\n return (node.children ?? []).map(clickyNodeText).join(\"\");\n}\n"],"names":["_a"],"mappings":";;;;;;;;;AAkCO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAuB;;AACrB,QAAM,eAAe,QAAQ,MAAM,kBAAkB,YAAY,GAAG,CAAC,YAAY,CAAC;AAClF,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,CAAC;AAC5C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA6B,YAAY;AACnE,QAAM,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC,aAAa,WAAW,CAAA;AAAA,EAAC;AAE3B,QAAM,CAAC,aAAa,cAAc,IAAI;AAAA,MACpC,wBAAa,YAAb,mBAAuB,OAAvB,mBAA2B,SAAQ;AAAA,EAAA;AAErC,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,EAAE;AA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L;AAAA,UACH,KAAK,OAAO,WACX;AAAA,YAAC;AAAA,YAAA;AAAA,cACC;AAAA,cACA;AAAA,cACA;AAAA,cACA,eAAe;AAAA,cACf,qBAAqB;AAAA,YAAA;AAAA,UAAA,IAErB;AAAA,UACH,KAAK,OAAO,+BACV,YAAA,EAAW,OAAc,YAAwB,IAChD;AAAA,QAAA,EAAA,GArDI,KAAK,EAsDf;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,SAAS,kBAAkB,OAAoD;;AAC7E,QAAM,QAAQ;AACd,SAAO;AAAA,IACL,GAAG;AAAA,IACH,UAAU,MAAM,WAAW,EAAE,GAAG,MAAM,SAAA,IAAa,CAAA;AAAA,IACnD,WAAS,WAAM,YAAN,mBAAe,IAAI,CAAC,YAAY,EAAE,GAAG,OAAA,QAAc,CAAA;AAAA,EAAC;AAEjE;AAEA,SAAS,iBACP,OACA,MACyB;AACzB,QAAM,QAAQ,eAAe,IAAI,KAAK;AACtC,QAAM,eAAe,gCAAgC,KAAK;AAC1D,MAAI,CAAC,aAAc,QAAO;AAC1B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,MAAM,oBAAoB,KAAK,KAAK;AAAA,IACpC;AAAA,EAAA;AAEJ;AAEA,SAAS,eAAe,MAA0B;AAChD,MAAI,KAAK,MAAO,QAAO,KAAK;AAC5B,MAAI,KAAK,KAAM,QAAO,KAAK;AAC3B,UAAQ,KAAK,YAAY,CAAA,GAAI,IAAI,cAAc,EAAE,KAAK,EAAE;AAC1D;"}
|
|
1
|
+
{"version":3,"file":"profileWizard.js","sources":["../../../src/profiles/wizard/profileWizard.tsx"],"sourcesContent":["import { Button } from \"../../components/button\";\nimport type { ClickyNode } from \"../../data/Clicky\";\nimport { Modal } from \"../../overlay/Modal\";\nimport type { ResolvedOperation } from \"../../rpc/types\";\nimport type { OperationsApiClient } from \"../../rpc/useOperations\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useDeferredValue, useMemo, useState } from \"react\";\nimport { ProfileWizardQueryStep, type ProfileSample } from \"./profileWizardQueryStep\";\nimport {\n profileConnectionID,\n profileWizardErrorMessage,\n profileWizardStepReady,\n profileWizardSteps,\n connectionTypeFromLabel,\n providerTypesForConnectionType,\n type ProfileColumn,\n type ProfileWizardDraft,\n} from \"./profileWizardModel\";\nimport {\n FieldsStep,\n ReviewStep,\n SourceStep,\n WizardProgress,\n type ConnectionChoice,\n} from \"./profileWizardSteps\";\nimport { stepHelp } from \"./profileWizardHelp\";\n\ntype ProfileWizardProps = {\n client: OperationsApiClient;\n action: ResolvedOperation;\n initialValue: Record<string, unknown>;\n onClose: () => void;\n onSuccess: () => void | Promise<void>;\n};\n\nexport function ProfileWizard({\n client,\n action,\n initialValue,\n onClose,\n onSuccess,\n}: ProfileWizardProps) {\n const initialDraft = useMemo(() => cloneInitialDraft(initialValue), [initialValue]);\n const [stepIndex, setStepIndex] = useState(0);\n const [draft, setDraft] = useState<ProfileWizardDraft>(initialDraft);\n const [discovered, setDiscovered] = useState<ProfileColumn[]>(\n initialDraft.columns ?? [],\n );\n const [activeField, setActiveField] = useState(\n initialDraft.columns?.[0]?.name ?? \"\",\n );\n const [connectionSearch, setConnectionSearch] = useState(\"\");\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState(\"\");\n const deferredConnectionSearch = useDeferredValue(connectionSearch);\n const connections = useQuery({\n queryKey: [\"profile-wizard-connections\", deferredConnectionSearch],\n queryFn: () => {\n if (!client.lookupFilterOptions) {\n throw new Error(\"Connection lookup is unavailable\");\n }\n return client.lookupFilterOptions(\n \"/api/v1/connection\",\n \"GET\",\n \"connection\",\n deferredConnectionSearch,\n );\n },\n retry: 0,\n });\n const connectionChoices = useMemo(\n () =>\n Object.entries(connections.data?.options ?? {})\n .map(([value, node]) => connectionChoice(value, node))\n .filter((choice): choice is ConnectionChoice => choice != null)\n .sort((left, right) => left.name.localeCompare(right.name)),\n [connections.data?.options],\n );\n const step = profileWizardSteps[stepIndex];\n // stepIndex only ever moves between 0 and the last step, so an out-of-range\n // one is a broken navigation guard rather than a state the UI should render\n // around — say so instead of rendering a wizard with no current step.\n if (!step) throw new Error(`wizard step ${stepIndex} is out of range`);\n const connectionID = profileConnectionID(draft.provider?.connection ?? \"\");\n const currentStepReady = profileWizardStepReady(\n step.id,\n draft,\n discovered,\n );\n\n const updateQueryDraft = (next: ProfileWizardDraft) => {\n if (next.query !== draft.query) setDiscovered([]);\n setDraft(next);\n };\n\n const acceptSample = ({ columns }: ProfileSample) => {\n setDiscovered(columns);\n setActiveField((current) =>\n columns.some((field) => field.name === current)\n ? current\n : (columns[0]?.name ?? \"\"),\n );\n setDraft((current) => {\n const configuredByName = new Map(\n (current.columns ?? []).map((field) => [field.name, field]),\n );\n return {\n ...current,\n columns:\n configuredByName.size === 0\n ? columns\n : columns\n .filter((field) => configuredByName.has(field.name))\n .map((field) => ({\n ...field,\n ...configuredByName.get(field.name),\n })),\n };\n });\n };\n\n const save = async () => {\n setSaving(true);\n setError(\"\");\n try {\n if (!client.submitForm) {\n throw new Error(\"Profile creation is unavailable\");\n }\n const response = await client.submitForm(action.path, action.method, draft);\n if (!response.success) {\n throw new Error(\n response.error || response.message || \"Profile creation failed\",\n );\n }\n await onSuccess();\n } catch (saveError) {\n setError(profileWizardErrorMessage(saveError, \"Profile creation failed\"));\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <Modal\n open\n onClose={onClose}\n confirmClose={\n stepIndex > 0 || draft.query\n ? {\n title: \"Discard this profile?\",\n message: \"Your query and field configuration will be lost.\",\n confirmLabel: \"Discard profile\",\n }\n : false\n }\n title=\"Build a profile\"\n subtitle={\n <WizardProgress\n stepIndex={stepIndex}\n onStepChange={(next) => {\n if (next < stepIndex) setStepIndex(next);\n }}\n />\n }\n size=\"full\"\n className=\"h-[calc(100dvh-2rem)]\"\n scrollBody={false}\n footer={\n <div className=\"flex w-full items-center gap-3\">\n <span className=\"text-xs text-muted-foreground\">\n Step {stepIndex + 1} of {profileWizardSteps.length}\n </span>\n {error ? (\n <span className=\"ml-3 text-sm text-destructive\">{error}</span>\n ) : null}\n <div className=\"ml-auto flex gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={onClose}>\n Cancel\n </Button>\n {stepIndex > 0 ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={saving}\n onClick={() => setStepIndex((current) => current - 1)}\n >\n Back\n </Button>\n ) : null}\n {stepIndex < profileWizardSteps.length - 1 ? (\n <Button\n type=\"button\"\n disabled={!currentStepReady}\n onClick={() => setStepIndex((current) => current + 1)}\n >\n Continue\n </Button>\n ) : (\n <Button\n type=\"button\"\n disabled={!currentStepReady || saving}\n onClick={() => void save()}\n >\n {saving ? \"Saving…\" : \"Save profile\"}\n </Button>\n )}\n </div>\n </div>\n }\n >\n <div className=\"flex h-full min-h-0 flex-col gap-5\">\n <div className=\"shrink-0\">\n <p className=\"text-xs font-semibold uppercase tracking-[0.18em] text-primary\">\n {step.description}\n </p>\n <h2 className=\"mt-1 text-xl font-semibold\">{step.label}</h2>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n {stepHelp[step.id]}\n </p>\n </div>\n <div key={step.id} className=\"min-h-0 flex-1 overflow-auto\">\n {step.id === \"source\" ? (\n <SourceStep\n choices={connectionChoices}\n loading={connections.isLoading}\n error={connections.error}\n {...(connections.data?.truncated !== undefined\n ? { truncated: connections.data.truncated }\n : {})}\n {...(connections.data?.total !== undefined\n ? { total: connections.data.total }\n : {})}\n search={connectionSearch}\n selected={draft.provider?.connection ?? \"\"}\n selectedType={draft.provider?.type ?? \"\"}\n onSearchChange={setConnectionSearch}\n onSelect={(choice) => {\n if (choice.value === draft.provider?.connection) return;\n setDraft({\n ...(draft.namespace !== undefined\n ? { namespace: draft.namespace }\n : {}),\n provider: {\n // The first candidate is the most specific one. Where the\n // connection type is read by several providers the step\n // offers the choice, and this is only what it opens on.\n ...(choice.providerTypes[0]\n ? { type: choice.providerTypes[0] }\n : {}),\n connection: choice.value,\n },\n });\n setDiscovered([]);\n setActiveField(\"\");\n }}\n onProviderTypeChange={(type) =>\n setDraft({\n ...draft,\n provider: { ...draft.provider, type },\n })\n }\n />\n ) : null}\n {step.id === \"query\" && connectionID ? (\n <ProfileWizardQueryStep\n key={connectionID}\n connectionID={connectionID}\n draft={draft}\n discovered={discovered}\n onDraftChange={updateQueryDraft}\n onSample={acceptSample}\n />\n ) : null}\n {step.id === \"fields\" ? (\n <FieldsStep\n draft={draft}\n discovered={discovered}\n activeField={activeField}\n onDraftChange={setDraft}\n onActiveFieldChange={setActiveField}\n />\n ) : null}\n {step.id === \"review\" ? (\n <ReviewStep draft={draft} discovered={discovered} />\n ) : null}\n </div>\n </div>\n </Modal>\n );\n}\n\nfunction cloneInitialDraft(value: Record<string, unknown>): ProfileWizardDraft {\n const draft = value as ProfileWizardDraft;\n return {\n ...draft,\n provider: draft.provider ? { ...draft.provider } : {},\n columns: draft.columns?.map((column) => ({ ...column })) ?? [],\n };\n}\n\nfunction connectionChoice(\n value: string,\n node: ClickyNode,\n): ConnectionChoice | null {\n const label = clickyNodeText(node) || value;\n const connectionType = connectionTypeFromLabel(label);\n if (!connectionType) return null;\n // A connection no provider reads is still listed, with an empty candidate\n // set: the Source step says so rather than the wizard emitting a draft whose\n // provider.type is not in the schema's enum.\n const providerTypes = providerTypesForConnectionType(connectionType);\n return {\n value,\n label,\n name: profileConnectionID(value) ?? label,\n connectionType,\n providerTypes,\n };\n}\n\nfunction clickyNodeText(node: ClickyNode): string {\n if (node.plain) return node.plain;\n if (node.text) return node.text;\n return (node.children ?? []).map(clickyNodeText).join(\"\");\n}\n"],"names":["_a"],"mappings":";;;;;;;;;AAmCO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAuB;;AACrB,QAAM,eAAe,QAAQ,MAAM,kBAAkB,YAAY,GAAG,CAAC,YAAY,CAAC;AAClF,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,CAAC;AA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