@datalayer/core 1.1.59 → 1.1.66
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/README.md +2 -2
- package/lib/api/DatalayerApi.d.ts +42 -1
- package/lib/api/DatalayerApi.js +90 -3
- package/lib/api/constants.d.ts +18 -0
- package/lib/api/constants.js +18 -0
- package/lib/api/contents/attachments.d.ts +9 -0
- package/lib/api/contents/attachments.js +43 -0
- package/lib/api/contents/bridges.d.ts +22 -0
- package/lib/api/contents/bridges.js +79 -0
- package/lib/api/contents/capabilities.d.ts +11 -0
- package/lib/api/contents/capabilities.js +21 -0
- package/lib/api/contents/cloudStorage.d.ts +31 -0
- package/lib/api/contents/cloudStorage.js +89 -0
- package/lib/api/contents/dataservers.d.ts +37 -0
- package/lib/api/contents/dataservers.js +121 -0
- package/lib/api/contents/datasets.d.ts +15 -0
- package/lib/api/contents/datasets.js +45 -0
- package/lib/api/contents/datasources.d.ts +70 -0
- package/lib/api/contents/datasources.js +149 -0
- package/lib/api/contents/generated.d.ts +1070 -0
- package/lib/api/contents/index.d.ts +16 -0
- package/lib/api/contents/index.js +20 -0
- package/lib/api/contents/mcp.d.ts +46 -0
- package/lib/api/contents/mcp.js +157 -0
- package/lib/api/contents/objects.d.ts +31 -0
- package/lib/api/contents/objects.js +88 -0
- package/lib/api/contents/operations.d.ts +3 -0
- package/lib/api/contents/operations.js +19 -0
- package/lib/api/contents/runtimeMounts.d.ts +40 -0
- package/lib/api/contents/runtimeMounts.js +59 -0
- package/lib/api/contents/sandboxUid.d.ts +53 -0
- package/lib/api/contents/sandboxUid.js +78 -0
- package/lib/api/contents/sources.d.ts +19 -0
- package/lib/api/contents/sources.js +119 -0
- package/lib/api/contents/sync.d.ts +18 -0
- package/lib/api/contents/sync.js +69 -0
- package/lib/api/contents/transfers.d.ts +38 -0
- package/lib/api/contents/transfers.js +123 -0
- package/lib/api/iam/connectedAgents.d.ts +39 -0
- package/lib/api/iam/connectedAgents.js +52 -0
- package/lib/api/iam/index.d.ts +2 -1
- package/lib/api/iam/index.js +2 -1
- package/lib/api/iam/mcpAlertRules.d.ts +51 -0
- package/lib/api/iam/mcpAlertRules.js +198 -0
- package/lib/api/iam/mcpAuditSettings.d.ts +46 -0
- package/lib/api/iam/mcpAuditSettings.js +120 -0
- package/lib/api/iam/mcpPolicy.d.ts +80 -0
- package/lib/api/iam/mcpPolicy.js +132 -0
- package/lib/api/iam/organizationTeams.d.ts +13 -0
- package/lib/api/iam/organizationTeams.js +43 -0
- package/lib/api/iam/serviceAgents.d.ts +68 -0
- package/lib/api/iam/serviceAgents.js +119 -0
- package/lib/api/index.d.ts +4 -1
- package/lib/api/index.js +3 -1
- package/lib/api/mcp/activity.d.ts +37 -0
- package/lib/api/mcp/activity.js +26 -0
- package/lib/api/mcp/alerts.d.ts +25 -0
- package/lib/api/mcp/alerts.js +51 -0
- package/lib/api/mcp/audit.d.ts +29 -0
- package/lib/api/mcp/audit.js +55 -0
- package/lib/api/mcp/bindings.d.ts +18 -0
- package/lib/api/mcp/bindings.js +42 -0
- package/lib/api/mcp/forwarding.d.ts +25 -0
- package/lib/api/mcp/forwarding.js +46 -0
- package/lib/api/mcp/gateway.d.ts +16 -0
- package/lib/api/mcp/gateway.js +70 -0
- package/lib/api/mcp/generated.d.ts +22 -0
- package/lib/api/mcp/generated.js +213 -0
- package/lib/api/mcp/index.d.ts +17 -0
- package/lib/api/mcp/index.js +25 -0
- package/lib/api/mcp/observability.d.ts +125 -0
- package/lib/api/mcp/observability.js +254 -0
- package/lib/api/mcp/operations.d.ts +83 -0
- package/lib/api/mcp/operations.js +50 -0
- package/lib/api/mcp/organizations.d.ts +102 -0
- package/lib/api/mcp/organizations.js +46 -0
- package/lib/api/mcp/policy.d.ts +9 -0
- package/lib/api/mcp/policy.js +23 -0
- package/lib/api/mcp/tasks.d.ts +49 -0
- package/lib/api/mcp/tasks.js +147 -0
- package/lib/api/utils/validation.d.ts +1 -1
- package/lib/api/utils/validation.js +1 -1
- package/lib/client/auth/index.js +0 -5
- package/lib/client/auth/storage.js +0 -5
- package/lib/client/auth/strategies.js +0 -5
- package/lib/client/base.d.ts +6 -0
- package/lib/client/base.js +8 -0
- package/lib/client/index.d.ts +0 -10
- package/lib/client/index.js +2 -2
- package/lib/client/mixins/ContentsMixin.d.ts +71 -0
- package/lib/client/mixins/ContentsMixin.js +157 -0
- package/lib/client/mixins/IAMMixin.d.ts +0 -31
- package/lib/client/mixins/IAMMixin.js +0 -58
- package/lib/components/animation/AnimatedText.d.ts +1 -0
- package/lib/components/animation/AnimatedText.js +0 -4
- package/lib/components/auth/SigInAPIKey.d.ts +1 -0
- package/lib/components/auth/SigInAPIKey.js +0 -6
- package/lib/components/auth/SignIn.d.ts +1 -0
- package/lib/components/auth/SignIn.js +0 -4
- package/lib/components/auth/SignIn.stories.d.ts +2 -2
- package/lib/components/avatars/BoringAvatar.d.ts +1 -1
- package/lib/components/avatars/BoringAvatar.stories.d.ts +1 -1
- package/lib/components/avatars/DLAvatar.d.ts +1 -1
- package/lib/components/avatars/DLAvatar.js +0 -4
- package/lib/components/avatars/UserAvatar.d.ts +18 -1
- package/lib/components/avatars/UserAvatar.js +14 -14
- package/lib/components/avatars/UserProfileAvatar.d.ts +1 -1
- package/lib/components/banners/NoAutomationBanner.d.ts +1 -1
- package/lib/components/billing/BillingEntitySelect.d.ts +10 -0
- package/lib/components/billing/BillingEntitySelect.js +0 -17
- package/lib/components/billing/index.js +0 -4
- package/lib/components/buttons/DownloadCSVButton.d.ts +1 -1
- package/lib/components/buttons/DownloadJsonButton.d.ts +1 -1
- package/lib/components/buttons/LongActionButton.d.ts +1 -0
- package/lib/components/buttons/LongActionButton.js +0 -4
- package/lib/components/buttons/UploadButton.d.ts +1 -0
- package/lib/components/buttons/UploadButton.js +0 -4
- package/lib/components/checkout/StripeCheckout.d.ts +1 -1
- package/lib/components/collaboration/LiveEditorCollaborators.d.ts +31 -0
- package/lib/components/collaboration/LiveEditorCollaborators.js +98 -53
- package/lib/components/collaboration/index.js +0 -4
- package/lib/components/confetti/ConfettiSuccess.d.ts +1 -1
- package/lib/components/contents/ContentSourceCard.d.ts +8 -0
- package/lib/components/contents/ContentSourceCard.js +23 -0
- package/lib/components/contents/HomeFolderObjectsBrowser.d.ts +10 -0
- package/lib/components/contents/HomeFolderObjectsBrowser.js +148 -0
- package/lib/components/contents/index.d.ts +2 -0
- package/lib/components/contents/index.js +6 -0
- package/lib/components/context/OrganizationSelect.d.ts +1 -1
- package/lib/components/display/AvatarSkeleton.d.ts +1 -1
- package/lib/components/display/BusyDots.d.ts +1 -1
- package/lib/components/display/CenteredSpinner.d.ts +1 -1
- package/lib/components/display/CodePreview.d.ts +1 -1
- package/lib/components/display/DatalayerBox.d.ts +7 -2
- package/lib/components/display/DatalayerBox.js +6 -6
- package/lib/components/display/HorizontalCenter.d.ts +1 -1
- package/lib/components/display/JupyterDialog.d.ts +1 -0
- package/lib/components/display/JupyterDialog.js +1 -7
- package/lib/components/display/Markdown.d.ts +1 -0
- package/lib/components/display/NotebookSkeleton.d.ts +1 -1
- package/lib/components/display/Placeholder.d.ts +1 -1
- package/lib/components/display/ToTopBranded.d.ts +1 -1
- package/lib/components/echarts/EChartsReact.d.ts +1 -1
- package/lib/components/flashes/FlashClosable.d.ts +1 -0
- package/lib/components/flashes/FlashClosable.js +0 -4
- package/lib/components/flashes/FlashGuest.d.ts +1 -1
- package/lib/components/flashes/FlashSurveys.d.ts +1 -1
- package/lib/components/flashes/FlashUnauthorized.d.ts +1 -0
- package/lib/components/flashes/FlashUnauthorized.js +0 -6
- package/lib/components/flashes/surveys/Survey2025_1.d.ts +1 -1
- package/lib/components/iam/ExternalTokenSilentLogin.d.ts +1 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/labels/StatusLabels.d.ts +10 -0
- package/lib/components/labels/StatusLabels.js +30 -1
- package/lib/components/labels/VisibilityLabel.d.ts +1 -1
- package/lib/components/landings/StepBlock.d.ts +1 -1
- package/lib/components/mcp/ClientBadge.d.ts +41 -0
- package/lib/components/mcp/ClientBadge.js +33 -0
- package/lib/components/mcp/McpErrorBlankslate.d.ts +21 -0
- package/lib/components/mcp/McpErrorBlankslate.js +17 -0
- package/lib/components/mcp/ScopeList.d.ts +28 -0
- package/lib/components/mcp/ScopeList.js +14 -0
- package/lib/components/mcp/index.d.ts +10 -0
- package/lib/components/mcp/index.js +18 -0
- package/lib/components/navbar/NavigationVisbilityObserver.d.ts +2 -1
- package/lib/components/navbar/SubdomainNavBar.d.ts +10 -5
- package/lib/components/navbar/SubdomainNavBar.js +2 -1
- package/lib/components/notebooks/JupyterNotebook.d.ts +1 -1
- package/lib/components/notebooks/JupyterNotebookToolbar.d.ts +1 -1
- package/lib/components/principal/PrincipalAppearance.d.ts +1 -0
- package/lib/components/principal/PrincipalAppearance.js +0 -8
- package/lib/components/principal/PrincipalAvatar.d.ts +9 -1
- package/lib/components/principal/PrincipalAvatar.js +25 -10
- package/lib/components/principal/PrincipalBadge.d.ts +1 -1
- package/lib/components/principal/PrincipalBanner.d.ts +1 -1
- package/lib/components/principal/PrincipalDetailsOverlay.d.ts +31 -1
- package/lib/components/principal/PrincipalDetailsOverlay.js +64 -33
- package/lib/components/principal/PrincipalHoverCard.d.ts +31 -0
- package/lib/components/principal/PrincipalHoverCard.js +52 -0
- package/lib/components/principal/PrincipalSwitcherMenu.d.ts +1 -0
- package/lib/components/principal/PrincipalSwitcherMenu.js +7 -15
- package/lib/components/principal/index.d.ts +2 -1
- package/lib/components/principal/index.js +2 -1
- package/lib/components/progress/ConsumptionBar.d.ts +1 -0
- package/lib/components/progress/ConsumptionBar.js +0 -4
- package/lib/components/progress/ProgressRing.d.ts +1 -0
- package/lib/components/progress/SpinnerBar.d.ts +1 -1
- package/lib/components/progress/Timer.d.ts +1 -0
- package/lib/components/progress/Timer.js +0 -4
- package/lib/components/screencapture/ScreencaptureButton.d.ts +1 -1
- package/lib/components/sharing/ShareAccessComponent.d.ts +15 -1
- package/lib/components/sharing/ShareAccessComponent.js +36 -23
- package/lib/components/sharing/SharingEditor.d.ts +17 -0
- package/lib/components/sharing/SharingEditor.js +0 -24
- package/lib/components/sparklines/Sparklines.js +3 -4
- package/lib/components/sparklines/index.js +0 -4
- package/lib/components/storage/ContentsBrowser.d.ts +25 -1
- package/lib/components/storage/ContentsBrowser.js +145 -52
- package/lib/components/storage/ContentsBrowserMock.d.ts +3 -0
- package/lib/components/storage/ContentsBrowserMock.js +75 -0
- package/lib/components/storage/ContentsItems.d.ts +2 -1
- package/lib/components/storage/ContentsItems.js +0 -4
- package/lib/components/storage/ContentsTable.d.ts +50 -0
- package/lib/components/storage/ContentsTable.js +134 -0
- package/lib/components/storage/HomeFolderDrive.d.ts +71 -0
- package/lib/components/storage/HomeFolderDrive.js +248 -0
- package/lib/components/storage/index.d.ts +2 -0
- package/lib/components/storage/index.js +2 -0
- package/lib/components/students/StudentItemStatus.d.ts +1 -1
- package/lib/components/students/StudentResultCircle.d.ts +1 -1
- package/lib/components/subnav/SubNav.d.ts +5 -5
- package/lib/components/subnav/SubNav.js +11 -9
- package/lib/components/tables/DataTable.d.ts +1 -1
- package/lib/components/text-reveal/TextRevealAnimation.d.ts +2 -2
- package/lib/components/text-reveal/useTextRevealAnimationLines.d.ts +1 -1
- package/lib/components/time/LiveRelativeTime.d.ts +1 -0
- package/lib/components/time/LiveRelativeTime.js +0 -8
- package/lib/components/time/index.js +0 -4
- package/lib/components/timeline/Timeline.d.ts +1 -1
- package/lib/components/timeline/index.js +0 -4
- package/lib/components/users/PeerIndicator.d.ts +1 -0
- package/lib/components/users/PeerIndicator.js +0 -4
- package/lib/config/Configuration.d.ts +15 -17
- package/lib/config/Configuration.js +7 -0
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/layouts/LayoutBackdrop.d.ts +1 -1
- package/lib/hooks/layouts/LayoutScreencapture.d.ts +1 -1
- package/lib/hooks/useBackdrop.d.ts +1 -1
- package/lib/hooks/useBackdropJupyterLab.d.ts +3 -2
- package/lib/hooks/useBackdropJupyterLab.js +0 -4
- package/lib/hooks/useCache.d.ts +310 -105
- package/lib/hooks/useCache.js +142 -355
- package/lib/hooks/useContainsFocus.d.ts +1 -1
- package/lib/hooks/useContents.d.ts +313 -0
- package/lib/hooks/useContents.js +964 -0
- package/lib/hooks/useFocusTrap.d.ts +4 -4
- package/lib/hooks/useFocusTrap.js +1 -1
- package/lib/hooks/useMcp.d.ts +229 -0
- package/lib/hooks/useMcp.js +656 -0
- package/lib/hooks/useMobile.js +0 -5
- package/lib/hooks/useProjectStore.d.ts +3 -3
- package/lib/hooks/useProjectStore.js +4 -4
- package/lib/hooks/useRef.d.ts +1 -1
- package/lib/hooks/useRef.js +3 -0
- package/lib/hooks/useScreencapture.d.ts +2 -1
- package/lib/hooks/useScreencapture.js +0 -4
- package/lib/hooks/useToast.js +0 -4
- package/lib/hooks/useUser.js +42 -0
- package/lib/hooks/useVisibilityObserver.d.ts +1 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.js +3 -1
- package/lib/mocks/components/FlashMock.d.ts +1 -1
- package/lib/mocks/views/ActionMenuMock.d.ts +1 -1
- package/lib/mocks/views/ChartMock.d.ts +1 -1
- package/lib/mocks/views/DashboardMock.d.ts +1 -1
- package/lib/mocks/views/FormMock.d.ts +1 -1
- package/lib/mocks/views/TableMock.d.ts +1 -1
- package/lib/mocks/views/WipMock.d.ts +1 -1
- package/lib/models/Credits.d.ts +16 -0
- package/lib/models/Credits.js +22 -0
- package/lib/models/McpAuditEvent.d.ts +52 -0
- package/lib/models/McpAuditEvent.js +5 -0
- package/lib/models/McpBinding.d.ts +51 -0
- package/lib/models/McpBinding.js +5 -0
- package/lib/models/McpPolicy.d.ts +77 -0
- package/lib/models/McpPolicy.js +5 -0
- package/lib/models/McpTask.d.ts +94 -0
- package/lib/models/McpTask.js +7 -0
- package/lib/models/StartedBy.d.ts +57 -0
- package/lib/models/StartedBy.js +81 -0
- package/lib/models/UserDTO.js +4 -2
- package/lib/models/contents/__fixtures__/solr-codec.json +57 -0
- package/lib/models/contents/__fixtures__/v1-contracts.json +66 -0
- package/lib/models/contents/fieldCase.d.ts +8 -0
- package/lib/models/contents/fieldCase.js +37 -0
- package/lib/models/contents/index.d.ts +2 -0
- package/lib/models/contents/index.js +6 -0
- package/lib/models/contents/permissions.d.ts +16 -0
- package/lib/models/contents/permissions.js +34 -0
- package/lib/models/index.d.ts +5 -1
- package/lib/models/index.js +5 -1
- package/lib/state/substates/CoreState.d.ts +15 -7
- package/lib/state/substates/CoreState.js +18 -14
- package/lib/state/substates/IAMState.d.ts +1 -1
- package/lib/state/substates/IAMState.js +5 -5
- package/lib/state/substates/ProfileState.js +0 -4
- package/lib/state/substates/index.d.ts +0 -1
- package/lib/state/substates/index.js +0 -1
- package/lib/utils/Jwt.d.ts +26 -0
- package/lib/utils/Jwt.js +37 -0
- package/lib/utils/WithSuspense.d.ts +1 -1
- package/lib/views/api-keys/APIKeyEdit.d.ts +1 -1
- package/lib/views/api-keys/APIKeyNew.d.ts +1 -1
- package/lib/views/api-keys/APIKeys.d.ts +1 -1
- package/lib/views/api-keys/APIKeys.js +30 -4
- package/lib/views/api-keys/APIKeysStandalone.d.ts +5 -1
- package/lib/views/api-keys/APIKeysStandalone.js +2 -2
- package/lib/views/datasources/DatasourceDetail.d.ts +12 -5
- package/lib/views/datasources/DatasourceDetail.js +80 -110
- package/lib/views/datasources/DatasourceNew.d.ts +14 -8
- package/lib/views/datasources/DatasourceNew.js +129 -118
- package/lib/views/datasources/Datasources.d.ts +39 -7
- package/lib/views/datasources/Datasources.js +95 -40
- package/lib/views/datasources/DatasourcesMock.d.ts +3 -0
- package/lib/views/datasources/DatasourcesMock.js +57 -0
- package/lib/views/iam/SignInSimple.d.ts +12 -0
- package/lib/views/iam/SignInSimple.js +4 -4
- package/lib/views/index.d.ts +1 -0
- package/lib/views/index.js +1 -0
- package/lib/views/mcp/AlertDestinations.d.ts +34 -0
- package/lib/views/mcp/AlertDestinations.js +75 -0
- package/lib/views/mcp/AlertRules.d.ts +32 -0
- package/lib/views/mcp/AlertRules.js +245 -0
- package/lib/views/mcp/AuditLog.d.ts +42 -0
- package/lib/views/mcp/AuditLog.js +144 -0
- package/lib/views/mcp/ConnectedAgents.d.ts +34 -0
- package/lib/views/mcp/ConnectedAgents.js +100 -0
- package/lib/views/mcp/EnterpriseConsole.d.ts +74 -0
- package/lib/views/mcp/EnterpriseConsole.js +173 -0
- package/lib/views/mcp/McpDashboard.d.ts +50 -0
- package/lib/views/mcp/McpDashboard.js +347 -0
- package/lib/views/mcp/McpHome.d.ts +92 -0
- package/lib/views/mcp/McpHome.js +153 -0
- package/lib/views/mcp/McpObservability.d.ts +50 -0
- package/lib/views/mcp/McpObservability.js +150 -0
- package/lib/views/mcp/OrganizationPolicy.d.ts +45 -0
- package/lib/views/mcp/OrganizationPolicy.js +107 -0
- package/lib/views/mcp/OrganizationUsage.d.ts +69 -0
- package/lib/views/mcp/OrganizationUsage.js +113 -0
- package/lib/views/mcp/PersonalPolicy.d.ts +54 -0
- package/lib/views/mcp/PersonalPolicy.js +125 -0
- package/lib/views/mcp/Policies.d.ts +53 -0
- package/lib/views/mcp/Policies.js +210 -0
- package/lib/views/mcp/PolicyForm.d.ts +67 -0
- package/lib/views/mcp/PolicyForm.js +91 -0
- package/lib/views/mcp/PolicyHistory.d.ts +45 -0
- package/lib/views/mcp/PolicyHistory.js +62 -0
- package/lib/views/mcp/ServiceAgents.d.ts +46 -0
- package/lib/views/mcp/ServiceAgents.js +194 -0
- package/lib/views/mcp/TeamPolicies.d.ts +33 -0
- package/lib/views/mcp/TeamPolicies.js +98 -0
- package/lib/views/mcp/format.d.ts +25 -0
- package/lib/views/mcp/format.js +77 -0
- package/lib/views/mcp/index.d.ts +29 -0
- package/lib/views/mcp/index.js +37 -0
- package/lib/views/mcp/types.d.ts +66 -0
- package/lib/views/mcp/types.js +5 -0
- package/lib/views/secrets/SecretEdit.d.ts +5 -1
- package/lib/views/secrets/SecretEdit.js +2 -2
- package/lib/views/secrets/SecretNew.d.ts +11 -1
- package/lib/views/secrets/SecretNew.js +2 -2
- package/lib/views/secrets/Secrets.d.ts +12 -1
- package/lib/views/secrets/Secrets.js +2 -2
- package/package.json +28 -24
- package/scripts/generate-contents-types.py +169 -0
- package/scripts/generate-mcp-types.py +233 -0
- package/lib/api/iam/datasources.d.ts +0 -86
- package/lib/api/iam/datasources.js +0 -185
- package/lib/components/toolbars/index.d.ts +0 -1
- package/lib/models/Datasource.d.ts +0 -181
- package/lib/models/Datasource.js +0 -154
- package/lib/state/substates/DatasourceState.d.ts +0 -11
- package/lib/state/substates/DatasourceState.js +0 -16
- /package/lib/{components/toolbars/index.js → api/contents/generated.js} +0 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
# Distributed under the terms of the Modified BSD License.
|
|
4
|
+
|
|
5
|
+
# Copyright (c) 2023-2026 Datalayer, Inc.
|
|
6
|
+
# Distributed under the terms of the Modified BSD License.
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
Generate deterministic TypeScript wire types from the Jupyter MCP Server's
|
|
10
|
+
OpenAPI document, on the `generate-contents-types.py` pattern.
|
|
11
|
+
|
|
12
|
+
The gateway keeps no contract file: its FastAPI application *is* the
|
|
13
|
+
contract, and the document is read from it — imported from the sibling
|
|
14
|
+
checkout of the service when there is one, otherwise fetched from a running
|
|
15
|
+
gateway. `DATALAYER_JUPYTER_MCP_OPENAPI` names either a file or an URL and
|
|
16
|
+
wins over both; the deployed gateway publishes its document without
|
|
17
|
+
authentication at ``/api/mcp/v1/openapi.json``.
|
|
18
|
+
|
|
19
|
+
What is written to ``src/api/mcp/generated.ts``:
|
|
20
|
+
|
|
21
|
+
- one ``interface`` or ``type`` per ``components.schemas`` entry, snake case
|
|
22
|
+
turned to camel case as the Contents generator does;
|
|
23
|
+
- ``MCP_GATEWAY_ROUTES``: the routes the document declares, with method,
|
|
24
|
+
path, operation id and parameters, so a client that names a route the
|
|
25
|
+
gateway dropped fails to type-check rather than at runtime.
|
|
26
|
+
|
|
27
|
+
``--check`` exits non-zero when the checked-in file differs from what the
|
|
28
|
+
document gives — the CI check that the file is current.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
from __future__ import annotations
|
|
32
|
+
|
|
33
|
+
import importlib
|
|
34
|
+
import json
|
|
35
|
+
import os
|
|
36
|
+
import subprocess
|
|
37
|
+
import sys
|
|
38
|
+
from pathlib import Path
|
|
39
|
+
from typing import Any
|
|
40
|
+
from urllib.request import Request, urlopen
|
|
41
|
+
|
|
42
|
+
ROOT = Path(__file__).parents[1]
|
|
43
|
+
DEFAULT_GATEWAY_CHECKOUT = ROOT.parents[2] / "k8s/services/jupyter-mcp-server"
|
|
44
|
+
DEFAULT_GATEWAY_OPENAPI_URL = "https://mcp.datalayer.run/api/mcp/v1/openapi.json"
|
|
45
|
+
GATEWAY_APP = "datalayer_jupyter_mcp_server.main:app"
|
|
46
|
+
OUTPUT = ROOT / "src/api/mcp/generated.ts"
|
|
47
|
+
#: The licence header every source file in this repository carries. It is
|
|
48
|
+
#: emitted here because `fix-license-header` adds it to whatever this writes,
|
|
49
|
+
#: and then `--check` compares that against output that never had one — so the
|
|
50
|
+
#: two CI jobs each broke the other, permanently, and the check was red for
|
|
51
|
+
#: reasons that had nothing to do with the types. It stayed red long enough
|
|
52
|
+
#: for a dozen MCP routes to drift without anybody being able to see it.
|
|
53
|
+
LICENCE = (
|
|
54
|
+
"/*\n"
|
|
55
|
+
" * Copyright (c) 2023-2025 Datalayer, Inc.\n"
|
|
56
|
+
" * Distributed under the terms of the Modified BSD License.\n"
|
|
57
|
+
" */"
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
HEADER = "/* This file is generated from the Datalayer Jupyter MCP Server OpenAPI. Do not edit. */"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def type_name(reference: str) -> str:
|
|
64
|
+
return reference.rsplit("/", 1)[-1]
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def ts_type(schema: dict[str, Any]) -> str:
|
|
68
|
+
if "$ref" in schema:
|
|
69
|
+
return type_name(schema["$ref"])
|
|
70
|
+
if "const" in schema:
|
|
71
|
+
return json.dumps(schema["const"])
|
|
72
|
+
if "enum" in schema:
|
|
73
|
+
return " | ".join(json.dumps(value) for value in schema["enum"])
|
|
74
|
+
if "oneOf" in schema:
|
|
75
|
+
return " | ".join(ts_type(item) for item in schema["oneOf"])
|
|
76
|
+
if "anyOf" in schema:
|
|
77
|
+
return " | ".join(ts_type(item) for item in schema["anyOf"])
|
|
78
|
+
kind = schema.get("type")
|
|
79
|
+
if isinstance(kind, list):
|
|
80
|
+
return " | ".join(
|
|
81
|
+
"null" if item == "null" else ts_type({"type": item}) for item in kind
|
|
82
|
+
)
|
|
83
|
+
if kind == "array":
|
|
84
|
+
return f"Array<{ts_type(schema.get('items', {}))}>"
|
|
85
|
+
if kind == "object":
|
|
86
|
+
additional = schema.get("additionalProperties")
|
|
87
|
+
return (
|
|
88
|
+
f"Record<string, {ts_type(additional)}>"
|
|
89
|
+
if isinstance(additional, dict)
|
|
90
|
+
else "Record<string, unknown>"
|
|
91
|
+
)
|
|
92
|
+
if kind in {"integer", "number"}:
|
|
93
|
+
return "number"
|
|
94
|
+
if kind == "boolean":
|
|
95
|
+
return "boolean"
|
|
96
|
+
if kind == "null":
|
|
97
|
+
return "null"
|
|
98
|
+
if kind == "string":
|
|
99
|
+
return "string"
|
|
100
|
+
return "unknown"
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def camel(name: str) -> str:
|
|
104
|
+
parts = name.split("_")
|
|
105
|
+
return parts[0] + "".join(part[:1].upper() + part[1:] for part in parts[1:])
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _read_from_checkout(checkout: Path) -> dict[str, Any] | None:
|
|
109
|
+
"""The document of the application in a sibling checkout, in a subprocess.
|
|
110
|
+
|
|
111
|
+
A subprocess so the gateway's imports — its dependencies, its logging
|
|
112
|
+
configuration — never leak into this one, and so an environment that
|
|
113
|
+
cannot import it says so cleanly and the fetch takes over.
|
|
114
|
+
"""
|
|
115
|
+
if not (checkout / "datalayer_jupyter_mcp_server").is_dir():
|
|
116
|
+
return None
|
|
117
|
+
module, _, attribute = GATEWAY_APP.partition(":")
|
|
118
|
+
code = (
|
|
119
|
+
"import json, sys\n"
|
|
120
|
+
f"from {module} import {attribute} as app\n"
|
|
121
|
+
"json.dump(app.openapi(), sys.stdout)\n"
|
|
122
|
+
)
|
|
123
|
+
completed = subprocess.run(
|
|
124
|
+
[sys.executable, "-c", code],
|
|
125
|
+
cwd=checkout,
|
|
126
|
+
capture_output=True,
|
|
127
|
+
text=True,
|
|
128
|
+
env={**os.environ, "LOG_LEVEL": "ERROR"},
|
|
129
|
+
)
|
|
130
|
+
if completed.returncode != 0:
|
|
131
|
+
sys.stderr.write(
|
|
132
|
+
f"Could not import {GATEWAY_APP} from {checkout}; "
|
|
133
|
+
"reading the deployed gateway instead.\n"
|
|
134
|
+
)
|
|
135
|
+
return None
|
|
136
|
+
return json.loads(completed.stdout)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def _read_from_url(url: str) -> dict[str, Any]:
|
|
140
|
+
with urlopen(Request(url, headers={"Accept": "application/json"}), timeout=15) as response:
|
|
141
|
+
return json.load(response)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def read_openapi() -> dict[str, Any]:
|
|
145
|
+
"""The document, from the override, the sibling checkout or the deployed gateway."""
|
|
146
|
+
override = os.environ.get("DATALAYER_JUPYTER_MCP_OPENAPI", "").strip()
|
|
147
|
+
if override.startswith(("http://", "https://")):
|
|
148
|
+
return _read_from_url(override)
|
|
149
|
+
if override:
|
|
150
|
+
return json.loads(Path(override).read_text())
|
|
151
|
+
document = _read_from_checkout(DEFAULT_GATEWAY_CHECKOUT)
|
|
152
|
+
if document is not None:
|
|
153
|
+
return document
|
|
154
|
+
return _read_from_url(DEFAULT_GATEWAY_OPENAPI_URL)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _routes(document: dict[str, Any]) -> list[dict[str, Any]]:
|
|
158
|
+
routes = []
|
|
159
|
+
for path, operations in sorted(document.get("paths", {}).items()):
|
|
160
|
+
for method, operation in sorted(operations.items()):
|
|
161
|
+
if method.lower() not in {"get", "post", "put", "patch", "delete"}:
|
|
162
|
+
continue
|
|
163
|
+
routes.append(
|
|
164
|
+
{
|
|
165
|
+
"method": method.upper(),
|
|
166
|
+
"path": path,
|
|
167
|
+
"operationId": operation.get("operationId", ""),
|
|
168
|
+
"parameters": [
|
|
169
|
+
{"name": parameter["name"], "in": parameter["in"]}
|
|
170
|
+
for parameter in operation.get("parameters", [])
|
|
171
|
+
],
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
return routes
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def generate(document: dict[str, Any]) -> str:
|
|
178
|
+
schemas = (document.get("components") or {}).get("schemas") or {}
|
|
179
|
+
lines = [LICENCE, "", HEADER, ""]
|
|
180
|
+
for name, schema in sorted(schemas.items()):
|
|
181
|
+
if schema.get("type") == "object" and "properties" in schema:
|
|
182
|
+
lines.append(f"export interface {name} {{")
|
|
183
|
+
required = set(schema.get("required", []))
|
|
184
|
+
for property_name, property_schema in schema["properties"].items():
|
|
185
|
+
optional = "" if property_name in required else "?"
|
|
186
|
+
lines.append(
|
|
187
|
+
f" {camel(property_name)}{optional}: {ts_type(property_schema)};"
|
|
188
|
+
)
|
|
189
|
+
lines.extend(["}", ""])
|
|
190
|
+
else:
|
|
191
|
+
lines.extend([f"export type {name} = {ts_type(schema)};", ""])
|
|
192
|
+
lines.extend(
|
|
193
|
+
[
|
|
194
|
+
"/** One REST route the gateway declares. */",
|
|
195
|
+
"export interface McpGatewayRoute {",
|
|
196
|
+
" method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';",
|
|
197
|
+
" path: string;",
|
|
198
|
+
" operationId: string;",
|
|
199
|
+
" parameters: Array<{ name: string; in: string }>;",
|
|
200
|
+
"}",
|
|
201
|
+
"",
|
|
202
|
+
f"/** The gateway version the routes were read from: {document.get('info', {}).get('version', '')}. */",
|
|
203
|
+
"export const MCP_GATEWAY_ROUTES: ReadonlyArray<McpGatewayRoute> = [",
|
|
204
|
+
]
|
|
205
|
+
)
|
|
206
|
+
for route in _routes(document):
|
|
207
|
+
parameters = ", ".join(
|
|
208
|
+
f"{{ name: {json.dumps(p['name'])}, in: {json.dumps(p['in'])} }}"
|
|
209
|
+
for p in route["parameters"]
|
|
210
|
+
)
|
|
211
|
+
lines.append(
|
|
212
|
+
f" {{ method: '{route['method']}', path: {json.dumps(route['path'])}, "
|
|
213
|
+
f"operationId: {json.dumps(route['operationId'])}, parameters: [{parameters}] }},"
|
|
214
|
+
)
|
|
215
|
+
lines.extend(["];", ""])
|
|
216
|
+
return "\n".join(lines)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def main() -> None:
|
|
220
|
+
expected = generate(read_openapi())
|
|
221
|
+
if "--check" in sys.argv[1:]:
|
|
222
|
+
if not OUTPUT.exists() or OUTPUT.read_text() != expected:
|
|
223
|
+
raise SystemExit(
|
|
224
|
+
"Stale generated Jupyter MCP Server TypeScript types: "
|
|
225
|
+
"run `python scripts/generate-mcp-types.py`"
|
|
226
|
+
)
|
|
227
|
+
return
|
|
228
|
+
OUTPUT.parent.mkdir(parents=True, exist_ok=True)
|
|
229
|
+
OUTPUT.write_text(expected)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
if __name__ == "__main__":
|
|
233
|
+
main()
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { CreateDatasourceRequest, CreateDatasourceResponse, GetDatasourceResponse, ListDatasourcesResponse, UpdateDatasourceRequest, UpdateDatasourceResponse } from '../../models/Datasource';
|
|
2
|
-
/**
|
|
3
|
-
* Create a new datasource.
|
|
4
|
-
* Creates a new datasource configuration for the authenticated user.
|
|
5
|
-
*
|
|
6
|
-
* @param token - Authentication token
|
|
7
|
-
* @param data - Datasource creation data
|
|
8
|
-
* @param baseUrl - Base URL for IAM service
|
|
9
|
-
* @returns Created datasource data
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const response = await createDatasource(token, {
|
|
14
|
-
* type: 'Amazon Athena',
|
|
15
|
-
* name: 'my-athena-datasource',
|
|
16
|
-
* description: 'Production Athena datasource',
|
|
17
|
-
* database: 'my_database',
|
|
18
|
-
* output_bucket: 's3://my-bucket/output/'
|
|
19
|
-
* });
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare const createDatasource: (token: string, data: CreateDatasourceRequest, baseUrl?: string) => Promise<CreateDatasourceResponse>;
|
|
23
|
-
/**
|
|
24
|
-
* List all datasources for authenticated user.
|
|
25
|
-
* Retrieves all datasource configurations accessible to the user.
|
|
26
|
-
*
|
|
27
|
-
* @param token - Authentication token
|
|
28
|
-
* @param baseUrl - Base URL for IAM service
|
|
29
|
-
* @returns List of datasources
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* const response = await listDatasources(token);
|
|
34
|
-
* console.log(response.datasources);
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare const listDatasources: (token: string, baseUrl?: string) => Promise<ListDatasourcesResponse>;
|
|
38
|
-
/**
|
|
39
|
-
* Get a specific datasource by ID.
|
|
40
|
-
* Retrieves detailed information about a specific datasource.
|
|
41
|
-
*
|
|
42
|
-
* @param token - Authentication token
|
|
43
|
-
* @param datasourceId - Datasource unique identifier
|
|
44
|
-
* @param baseUrl - Base URL for IAM service
|
|
45
|
-
* @returns Datasource data
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```typescript
|
|
49
|
-
* const response = await getDatasource(token, 'datasource-id-123');
|
|
50
|
-
* console.log(response.datasource);
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export declare const getDatasource: (token: string, datasourceId: string, baseUrl?: string) => Promise<GetDatasourceResponse>;
|
|
54
|
-
/**
|
|
55
|
-
* Update a specific datasource.
|
|
56
|
-
* Updates the configuration of an existing datasource.
|
|
57
|
-
*
|
|
58
|
-
* @param token - Authentication token
|
|
59
|
-
* @param datasourceId - Datasource unique identifier
|
|
60
|
-
* @param data - Update data
|
|
61
|
-
* @param baseUrl - Base URL for IAM service
|
|
62
|
-
* @returns Updated datasource data
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* ```typescript
|
|
66
|
-
* const response = await updateDatasource(token, 'datasource-id-123', {
|
|
67
|
-
* description: 'Updated description',
|
|
68
|
-
* database: 'new_database'
|
|
69
|
-
* });
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
export declare const updateDatasource: (token: string, datasourceId: string, data: UpdateDatasourceRequest, baseUrl?: string) => Promise<UpdateDatasourceResponse>;
|
|
73
|
-
/**
|
|
74
|
-
* Delete a specific datasource.
|
|
75
|
-
* Removes a datasource configuration.
|
|
76
|
-
*
|
|
77
|
-
* @param token - Authentication token
|
|
78
|
-
* @param datasourceId - Datasource unique identifier
|
|
79
|
-
* @param baseUrl - Base URL for IAM service
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```typescript
|
|
83
|
-
* await deleteDatasource(token, 'datasource-id-123');
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
export declare const deleteDatasource: (token: string, datasourceId: string, baseUrl?: string) => Promise<void>;
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the Modified BSD License.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Datasources API functions.
|
|
7
|
-
* @module api/iam/datasources
|
|
8
|
-
*/
|
|
9
|
-
import { requestDatalayerAPI } from '../DatalayerApi.js';
|
|
10
|
-
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
|
|
11
|
-
import { validateToken, validateRequiredString } from '../utils/validation.js';
|
|
12
|
-
/**
|
|
13
|
-
* Create a new datasource.
|
|
14
|
-
* Creates a new datasource configuration for the authenticated user.
|
|
15
|
-
*
|
|
16
|
-
* @param token - Authentication token
|
|
17
|
-
* @param data - Datasource creation data
|
|
18
|
-
* @param baseUrl - Base URL for IAM service
|
|
19
|
-
* @returns Created datasource data
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* const response = await createDatasource(token, {
|
|
24
|
-
* type: 'Amazon Athena',
|
|
25
|
-
* name: 'my-athena-datasource',
|
|
26
|
-
* description: 'Production Athena datasource',
|
|
27
|
-
* database: 'my_database',
|
|
28
|
-
* output_bucket: 's3://my-bucket/output/'
|
|
29
|
-
* });
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export const createDatasource = async (token, data, baseUrl = DEFAULT_SERVICE_URLS.IAM) => {
|
|
33
|
-
validateToken(token);
|
|
34
|
-
validateRequiredString(data.name, 'Datasource name');
|
|
35
|
-
validateRequiredString(data.type, 'Datasource type');
|
|
36
|
-
// Map datasource type to API variant format
|
|
37
|
-
const variantMap = {
|
|
38
|
-
'Amazon Athena': 'athena',
|
|
39
|
-
'Google BigQuery': 'bigquery',
|
|
40
|
-
'Microsoft Sentinel': 'sentinel',
|
|
41
|
-
Splunk: 'splunk',
|
|
42
|
-
};
|
|
43
|
-
const requestBody = {
|
|
44
|
-
name: data.name,
|
|
45
|
-
variant: variantMap[data.type] || data.type.toLowerCase(),
|
|
46
|
-
description: data.description || '',
|
|
47
|
-
database: data.database || '',
|
|
48
|
-
outputBucket: data.output_bucket || '',
|
|
49
|
-
};
|
|
50
|
-
try {
|
|
51
|
-
return await requestDatalayerAPI({
|
|
52
|
-
url: `${baseUrl}${API_BASE_PATHS.IAM}/datasources`,
|
|
53
|
-
method: 'POST',
|
|
54
|
-
body: requestBody,
|
|
55
|
-
token,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
if (error.response?.status === 409) {
|
|
60
|
-
throw new Error(`Datasource with name '${data.name}' already exists. Please use a different name.`);
|
|
61
|
-
}
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* List all datasources for authenticated user.
|
|
67
|
-
* Retrieves all datasource configurations accessible to the user.
|
|
68
|
-
*
|
|
69
|
-
* @param token - Authentication token
|
|
70
|
-
* @param baseUrl - Base URL for IAM service
|
|
71
|
-
* @returns List of datasources
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```typescript
|
|
75
|
-
* const response = await listDatasources(token);
|
|
76
|
-
* console.log(response.datasources);
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
export const listDatasources = async (token, baseUrl = DEFAULT_SERVICE_URLS.IAM) => {
|
|
80
|
-
validateToken(token);
|
|
81
|
-
return await requestDatalayerAPI({
|
|
82
|
-
url: `${baseUrl}${API_BASE_PATHS.IAM}/datasources`,
|
|
83
|
-
method: 'GET',
|
|
84
|
-
token,
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Get a specific datasource by ID.
|
|
89
|
-
* Retrieves detailed information about a specific datasource.
|
|
90
|
-
*
|
|
91
|
-
* @param token - Authentication token
|
|
92
|
-
* @param datasourceId - Datasource unique identifier
|
|
93
|
-
* @param baseUrl - Base URL for IAM service
|
|
94
|
-
* @returns Datasource data
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```typescript
|
|
98
|
-
* const response = await getDatasource(token, 'datasource-id-123');
|
|
99
|
-
* console.log(response.datasource);
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
export const getDatasource = async (token, datasourceId, baseUrl = DEFAULT_SERVICE_URLS.IAM) => {
|
|
103
|
-
validateToken(token);
|
|
104
|
-
validateRequiredString(datasourceId, 'Datasource ID');
|
|
105
|
-
try {
|
|
106
|
-
return await requestDatalayerAPI({
|
|
107
|
-
url: `${baseUrl}${API_BASE_PATHS.IAM}/datasources/${datasourceId}`,
|
|
108
|
-
method: 'GET',
|
|
109
|
-
token,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
if (error.response?.status === 404) {
|
|
114
|
-
throw new Error(`Datasource '${datasourceId}' not found.`);
|
|
115
|
-
}
|
|
116
|
-
throw error;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Update a specific datasource.
|
|
121
|
-
* Updates the configuration of an existing datasource.
|
|
122
|
-
*
|
|
123
|
-
* @param token - Authentication token
|
|
124
|
-
* @param datasourceId - Datasource unique identifier
|
|
125
|
-
* @param data - Update data
|
|
126
|
-
* @param baseUrl - Base URL for IAM service
|
|
127
|
-
* @returns Updated datasource data
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* ```typescript
|
|
131
|
-
* const response = await updateDatasource(token, 'datasource-id-123', {
|
|
132
|
-
* description: 'Updated description',
|
|
133
|
-
* database: 'new_database'
|
|
134
|
-
* });
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
export const updateDatasource = async (token, datasourceId, data, baseUrl = DEFAULT_SERVICE_URLS.IAM) => {
|
|
138
|
-
validateToken(token);
|
|
139
|
-
validateRequiredString(datasourceId, 'Datasource ID');
|
|
140
|
-
const requestBody = { ...data };
|
|
141
|
-
try {
|
|
142
|
-
return await requestDatalayerAPI({
|
|
143
|
-
url: `${baseUrl}${API_BASE_PATHS.IAM}/datasources/${datasourceId}`,
|
|
144
|
-
method: 'PUT',
|
|
145
|
-
body: requestBody,
|
|
146
|
-
token,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
catch (error) {
|
|
150
|
-
if (error.response?.status === 404) {
|
|
151
|
-
throw new Error(`Datasource '${datasourceId}' not found.`);
|
|
152
|
-
}
|
|
153
|
-
throw error;
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* Delete a specific datasource.
|
|
158
|
-
* Removes a datasource configuration.
|
|
159
|
-
*
|
|
160
|
-
* @param token - Authentication token
|
|
161
|
-
* @param datasourceId - Datasource unique identifier
|
|
162
|
-
* @param baseUrl - Base URL for IAM service
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* ```typescript
|
|
166
|
-
* await deleteDatasource(token, 'datasource-id-123');
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
export const deleteDatasource = async (token, datasourceId, baseUrl = DEFAULT_SERVICE_URLS.IAM) => {
|
|
170
|
-
validateToken(token);
|
|
171
|
-
validateRequiredString(datasourceId, 'Datasource ID');
|
|
172
|
-
try {
|
|
173
|
-
await requestDatalayerAPI({
|
|
174
|
-
url: `${baseUrl}${API_BASE_PATHS.IAM}/datasources/${datasourceId}`,
|
|
175
|
-
method: 'DELETE',
|
|
176
|
-
token,
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
catch (error) {
|
|
180
|
-
if (error.response?.status === 404) {
|
|
181
|
-
throw new Error(`Datasource '${datasourceId}' not found.`);
|
|
182
|
-
}
|
|
183
|
-
throw error;
|
|
184
|
-
}
|
|
185
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
export declare const asDatasource: (s: any) => IDatasource;
|
|
2
|
-
export type IDatasourceVariant = 'athena' | 'bigquery' | 'mssentinel' | 'splunk';
|
|
3
|
-
export type IDatasource = {
|
|
4
|
-
id: string;
|
|
5
|
-
variant: IDatasourceVariant;
|
|
6
|
-
name: string;
|
|
7
|
-
description: string;
|
|
8
|
-
database: string;
|
|
9
|
-
outputBucket: string;
|
|
10
|
-
};
|
|
11
|
-
export default IDatasource;
|
|
12
|
-
import type { DatalayerCoreClient } from '../client';
|
|
13
|
-
/**
|
|
14
|
-
* Datasource type matching UI and API.
|
|
15
|
-
*/
|
|
16
|
-
export type DatasourceType = 'Amazon Athena' | 'Google BigQuery' | 'Microsoft Sentinel' | 'Splunk';
|
|
17
|
-
/**
|
|
18
|
-
* Raw datasource data from API (snake_case with suffixes).
|
|
19
|
-
*/
|
|
20
|
-
export interface DatasourceData {
|
|
21
|
-
/** Unique identifier (ULID) */
|
|
22
|
-
uid: string;
|
|
23
|
-
/** Datasource type */
|
|
24
|
-
type_s: DatasourceType;
|
|
25
|
-
/** Datasource name */
|
|
26
|
-
name_s: string;
|
|
27
|
-
/** Datasource description */
|
|
28
|
-
description_t: string;
|
|
29
|
-
/** Datasource variant (athena, bigquery, mssentinel, splunk) */
|
|
30
|
-
variant_s?: string;
|
|
31
|
-
/** Optional: Database name (required for Amazon Athena) */
|
|
32
|
-
database_s?: string;
|
|
33
|
-
/** Optional: S3 output bucket (required for Amazon Athena) */
|
|
34
|
-
output_bucket_s?: string;
|
|
35
|
-
/** Creation timestamp */
|
|
36
|
-
created_at?: string;
|
|
37
|
-
/** Last update timestamp */
|
|
38
|
-
updated_at?: string;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Public JSON interface for Datasource (camelCase).
|
|
42
|
-
*/
|
|
43
|
-
export interface DatasourceJSON {
|
|
44
|
-
/** Unique identifier */
|
|
45
|
-
uid: string;
|
|
46
|
-
/** Datasource type */
|
|
47
|
-
type: DatasourceType;
|
|
48
|
-
/** Datasource name */
|
|
49
|
-
name: string;
|
|
50
|
-
/** Datasource description */
|
|
51
|
-
description: string;
|
|
52
|
-
/** Optional: Database name */
|
|
53
|
-
database?: string;
|
|
54
|
-
/** Optional: S3 output bucket */
|
|
55
|
-
outputBucket?: string;
|
|
56
|
-
/** Creation timestamp */
|
|
57
|
-
createdAt?: Date;
|
|
58
|
-
/** Last update timestamp */
|
|
59
|
-
updatedAt?: Date;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Request data for creating a new datasource.
|
|
63
|
-
*/
|
|
64
|
-
export interface CreateDatasourceRequest {
|
|
65
|
-
/** Datasource type */
|
|
66
|
-
type: DatasourceType;
|
|
67
|
-
/** Datasource name (unique identifier) */
|
|
68
|
-
name: string;
|
|
69
|
-
/** Human-readable description */
|
|
70
|
-
description?: string;
|
|
71
|
-
/** Optional: Database name (required for Amazon Athena) */
|
|
72
|
-
database?: string;
|
|
73
|
-
/** Optional: S3 output bucket (required for Amazon Athena) */
|
|
74
|
-
output_bucket?: string;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Request data for updating a datasource.
|
|
78
|
-
*/
|
|
79
|
-
export interface UpdateDatasourceRequest {
|
|
80
|
-
/** Optional: update type */
|
|
81
|
-
type?: DatasourceType;
|
|
82
|
-
/** Optional: update name */
|
|
83
|
-
name?: string;
|
|
84
|
-
/** Optional: update description */
|
|
85
|
-
description?: string;
|
|
86
|
-
/** Optional: update database */
|
|
87
|
-
database?: string;
|
|
88
|
-
/** Optional: update output bucket */
|
|
89
|
-
output_bucket?: string;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Response from creating a datasource.
|
|
93
|
-
*/
|
|
94
|
-
export interface CreateDatasourceResponse {
|
|
95
|
-
success: boolean;
|
|
96
|
-
message: string;
|
|
97
|
-
datasource: DatasourceData;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Response from getting a datasource.
|
|
101
|
-
*/
|
|
102
|
-
export interface GetDatasourceResponse {
|
|
103
|
-
success: boolean;
|
|
104
|
-
message: string;
|
|
105
|
-
datasource: DatasourceData;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Response from listing datasources.
|
|
109
|
-
*/
|
|
110
|
-
export interface ListDatasourcesResponse {
|
|
111
|
-
success: boolean;
|
|
112
|
-
message: string;
|
|
113
|
-
datasources: DatasourceData[];
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Response from updating a datasource.
|
|
117
|
-
*/
|
|
118
|
-
export interface UpdateDatasourceResponse {
|
|
119
|
-
success: boolean;
|
|
120
|
-
message: string;
|
|
121
|
-
datasource: DatasourceData;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Datasource domain model for the Datalayer Client.
|
|
125
|
-
* Provides state management and operations for datasources.
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```typescript
|
|
129
|
-
* const datasource = await client.createDatasource({
|
|
130
|
-
* type: 'Amazon Athena',
|
|
131
|
-
* name: 'my-athena-datasource',
|
|
132
|
-
* description: 'Production Athena datasource',
|
|
133
|
-
* database: 'my_database',
|
|
134
|
-
* output_bucket: 's3://my-bucket/output/'
|
|
135
|
-
* });
|
|
136
|
-
*
|
|
137
|
-
* await datasource.update({ description: 'Updated description' });
|
|
138
|
-
* await datasource.delete();
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
export declare class DatasourceDTO {
|
|
142
|
-
/** @internal */
|
|
143
|
-
_data: DatasourceData;
|
|
144
|
-
private _client;
|
|
145
|
-
private _deleted;
|
|
146
|
-
/**
|
|
147
|
-
* Create a Datasource instance.
|
|
148
|
-
* @param data - Datasource data from API
|
|
149
|
-
* @param client - Client instance
|
|
150
|
-
*/
|
|
151
|
-
constructor(data: DatasourceData, client: DatalayerCoreClient);
|
|
152
|
-
private _checkDeleted;
|
|
153
|
-
get uid(): string;
|
|
154
|
-
get type(): DatasourceType;
|
|
155
|
-
get variant(): string | undefined;
|
|
156
|
-
get name(): string;
|
|
157
|
-
get description(): string;
|
|
158
|
-
get database(): string | undefined;
|
|
159
|
-
get outputBucket(): string | undefined;
|
|
160
|
-
get createdAt(): Date | undefined;
|
|
161
|
-
get updatedAt(): Date | undefined;
|
|
162
|
-
/**
|
|
163
|
-
* Update this datasource.
|
|
164
|
-
* @param updates - Fields to update
|
|
165
|
-
* @returns Updated Datasource instance
|
|
166
|
-
*/
|
|
167
|
-
update(updates: UpdateDatasourceRequest): Promise<DatasourceDTO>;
|
|
168
|
-
/**
|
|
169
|
-
* Delete this datasource permanently.
|
|
170
|
-
*/
|
|
171
|
-
delete(): Promise<void>;
|
|
172
|
-
/**
|
|
173
|
-
* Get datasource data in camelCase format.
|
|
174
|
-
*/
|
|
175
|
-
toJSON(): DatasourceJSON;
|
|
176
|
-
/**
|
|
177
|
-
* Get raw datasource data exactly as received from API.
|
|
178
|
-
*/
|
|
179
|
-
rawData(): DatasourceData;
|
|
180
|
-
toString(): string;
|
|
181
|
-
}
|