@datalayer/core 1.1.60 → 1.2.10
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 +41 -18
- package/lib/api/DatalayerApi.d.ts +42 -1
- package/lib/api/DatalayerApi.js +90 -3
- package/lib/api/constants.d.ts +19 -1
- package/lib/api/constants.js +19 -1
- package/lib/api/contents/attachments.d.ts +9 -0
- package/lib/api/contents/attachments.js +39 -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 +63 -0
- package/lib/api/contents/datasets.js +82 -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 +21 -0
- package/lib/api/contents/sandboxUid.js +27 -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/evals/client.d.ts +402 -0
- package/lib/api/evals/client.js +359 -0
- package/lib/api/evals/index.d.ts +10 -0
- package/lib/api/evals/index.js +18 -0
- package/lib/api/evals/request.d.ts +43 -0
- package/lib/api/evals/request.js +67 -0
- package/lib/api/evals/status.d.ts +27 -0
- package/lib/api/evals/status.js +122 -0
- package/lib/api/evals/types.d.ts +1335 -0
- package/lib/api/evals/types.js +5 -0
- package/lib/api/iam/connectedAgents.d.ts +68 -0
- package/lib/api/iam/connectedAgents.js +87 -0
- package/lib/api/iam/identityProviders.d.ts +76 -0
- package/lib/api/iam/identityProviders.js +187 -0
- package/lib/api/iam/index.d.ts +3 -1
- package/lib/api/iam/index.js +3 -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 +181 -0
- package/lib/api/iam/mcpPolicy.js +168 -0
- package/lib/api/iam/organizationTeams.d.ts +13 -0
- package/lib/api/iam/organizationTeams.js +43 -0
- package/lib/api/iam/profile.d.ts +17 -1
- package/lib/api/iam/profile.js +27 -0
- package/lib/api/iam/scimTokens.d.ts +79 -0
- package/lib/api/iam/scimTokens.js +141 -0
- package/lib/api/iam/secrets.js +9 -21
- package/lib/api/iam/serviceAgents.d.ts +68 -0
- package/lib/api/iam/serviceAgents.js +119 -0
- package/lib/api/iam/trials.d.ts +38 -0
- package/lib/api/iam/trials.js +66 -0
- package/lib/api/index.d.ts +8 -1
- package/lib/api/index.js +7 -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 +141 -0
- package/lib/api/mcp/observability.js +267 -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/orchestration/client.d.ts +53 -0
- package/lib/api/orchestration/client.js +105 -0
- package/lib/api/orchestration/events.d.ts +88 -0
- package/lib/api/orchestration/events.js +245 -0
- package/lib/api/orchestration/generated.d.ts +693 -0
- package/lib/api/orchestration/generated.js +687 -0
- package/lib/api/orchestration/index.d.ts +30 -0
- package/lib/api/orchestration/index.js +34 -0
- package/lib/api/orchestration/lifecycle.d.ts +39 -0
- package/lib/api/orchestration/lifecycle.js +57 -0
- package/lib/api/orchestration/measures.d.ts +55 -0
- package/lib/api/orchestration/measures.js +99 -0
- package/lib/api/otel/dashboards.d.ts +56 -0
- package/lib/api/otel/dashboards.js +50 -0
- package/lib/api/otel/index.d.ts +1 -0
- package/lib/api/otel/index.js +1 -0
- package/lib/api/otel/metrics.d.ts +16 -0
- package/lib/api/otel/metrics.js +15 -0
- package/lib/api/scheduler/client.d.ts +32 -0
- package/lib/api/scheduler/client.js +42 -0
- package/lib/api/scheduler/index.d.ts +8 -0
- package/lib/api/scheduler/index.js +16 -0
- package/lib/api/scheduler/request.d.ts +28 -0
- package/lib/api/scheduler/request.js +50 -0
- package/lib/api/scheduler/types.d.ts +88 -0
- package/lib/api/scheduler/types.js +5 -0
- package/lib/api/spacer/comments.d.ts +97 -0
- package/lib/api/spacer/comments.js +45 -0
- package/lib/api/spacer/index.d.ts +9 -0
- package/lib/api/spacer/index.js +17 -0
- package/lib/api/spacer/notebooks.d.ts +33 -0
- package/lib/api/spacer/notebooks.js +39 -0
- package/lib/api/spacer/request.d.ts +25 -0
- package/lib/api/spacer/request.js +46 -0
- package/lib/api/spacer/spaces.d.ts +68 -0
- package/lib/api/spacer/spaces.js +45 -0
- package/lib/api/utils/validation.d.ts +4 -4
- package/lib/api/utils/validation.js +10 -7
- 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/constants.d.ts +1 -0
- package/lib/client/constants.js +1 -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 +2 -44
- package/lib/components/animation/AnimatedText.js +6 -126
- package/lib/components/anonymous/AnonymousKeyExpired.d.ts +56 -0
- package/lib/components/anonymous/AnonymousKeyExpired.js +96 -0
- package/lib/components/anonymous/AnonymousKeyTimer.d.ts +63 -0
- package/lib/components/anonymous/AnonymousKeyTimer.js +140 -0
- package/lib/components/anonymous/index.d.ts +7 -0
- package/lib/components/anonymous/index.js +15 -0
- 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 +16 -1
- package/lib/components/avatars/UserAvatar.js +15 -13
- 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 +16 -0
- package/lib/components/billing/BillingEntitySelect.js +49 -27
- package/lib/components/billing/eligibility.d.ts +22 -0
- package/lib/components/billing/eligibility.js +27 -0
- package/lib/components/billing/index.d.ts +1 -0
- package/lib/components/billing/index.js +1 -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 +36 -0
- package/lib/components/collaboration/LiveEditorCollaborators.js +88 -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 -3
- package/lib/components/display/DatalayerBox.js +7 -7
- 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/NavLink.js +3 -2
- 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 +2 -9
- package/lib/components/labels/StatusLabels.js +2 -26
- 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 +22 -42
- package/lib/components/principal/PrincipalAppearance.js +232 -182
- package/lib/components/principal/PrincipalAvatar.d.ts +9 -1
- package/lib/components/principal/PrincipalAvatar.js +18 -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 +38 -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 +5 -14
- 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/Screencapture.js +46 -3
- package/lib/components/screencapture/ScreencaptureButton.d.ts +1 -1
- package/lib/components/sharing/ShareAccessComponent.d.ts +58 -3
- package/lib/components/sharing/ShareAccessComponent.js +143 -98
- package/lib/components/sharing/SharingEditor.d.ts +21 -0
- package/lib/components/sharing/SharingEditor.js +9 -28
- package/lib/components/sharing/index.d.ts +1 -0
- package/lib/components/sharing/index.js +1 -0
- package/lib/components/sharing/sandboxSharing.d.ts +26 -0
- package/lib/components/sharing/sandboxSharing.js +41 -0
- package/lib/components/spaces/SpaceDetailsOverlay.d.ts +39 -0
- package/lib/components/spaces/SpaceDetailsOverlay.js +80 -0
- package/lib/components/spaces/SpaceDisplay.d.ts +38 -0
- package/lib/components/spaces/SpaceDisplay.js +92 -0
- package/lib/components/spaces/index.d.ts +4 -0
- package/lib/components/spaces/index.js +7 -0
- package/lib/components/spaces/spaceDisplayModel.d.ts +93 -0
- package/lib/components/spaces/spaceDisplayModel.js +170 -0
- 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/cacheConverters.d.ts +0 -7
- package/lib/hooks/cacheConverters.js +0 -25
- package/lib/hooks/index.d.ts +3 -0
- package/lib/hooks/index.js +3 -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/useBillingEntityStore.js +3 -0
- package/lib/hooks/useCache.d.ts +478 -130
- package/lib/hooks/useCache.js +1580 -676
- package/lib/hooks/useContainsFocus.d.ts +1 -1
- package/lib/hooks/useContents.d.ts +334 -0
- package/lib/hooks/useContents.js +1033 -0
- package/lib/hooks/useFocusTrap.d.ts +4 -4
- package/lib/hooks/useFocusTrap.js +1 -1
- package/lib/hooks/useMcp.d.ts +315 -0
- package/lib/hooks/useMcp.js +891 -0
- package/lib/hooks/useMobile.js +0 -5
- package/lib/hooks/useNavigate.d.ts +41 -3
- package/lib/hooks/useNavigate.js +106 -52
- package/lib/hooks/usePrincipalCacheStore.js +3 -0
- package/lib/hooks/usePrincipalStore.js +3 -0
- 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/useSpaceCacheStore.d.ts +50 -0
- package/lib/hooks/useSpaceCacheStore.js +85 -0
- package/lib/hooks/useToast.js +0 -4
- 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/CreditsDTO.d.ts +6 -5
- package/lib/models/CreditsDTO.js +7 -5
- package/lib/models/McpAuditEvent.d.ts +52 -0
- package/lib/models/McpAuditEvent.js +5 -0
- package/lib/models/McpBinding.d.ts +57 -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/Organization.d.ts +69 -0
- package/lib/models/Organization.js +96 -0
- package/lib/models/Secret.d.ts +1 -2
- package/lib/models/Secret.js +2 -18
- package/lib/models/StartedBy.d.ts +91 -0
- package/lib/models/StartedBy.js +117 -0
- package/lib/models/Team.d.ts +2 -0
- package/lib/models/Team.js +2 -0
- package/lib/models/User.d.ts +4 -0
- package/lib/models/User.js +3 -0
- package/lib/models/UserDTO.js +4 -2
- package/lib/models/UserSettings.d.ts +13 -0
- package/lib/models/UserSettings.js +9 -0
- package/lib/models/contents/__fixtures__/solr-codec.json +57 -0
- package/lib/models/contents/__fixtures__/v1-contracts.json +194 -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/navigation/components.js +2 -3
- package/lib/routes/publicPaths.js +4 -0
- package/lib/state/index.d.ts +1 -0
- package/lib/state/index.js +1 -0
- package/lib/state/sessionEnd.d.ts +55 -0
- package/lib/state/sessionEnd.js +162 -0
- package/lib/state/substates/CoreState.d.ts +15 -7
- package/lib/state/substates/CoreState.js +21 -17
- package/lib/state/substates/IAMState.d.ts +1 -1
- package/lib/state/substates/IAMState.js +12 -5
- package/lib/state/substates/LayoutState.js +12 -0
- package/lib/state/substates/ProfileState.d.ts +1 -0
- package/lib/state/substates/ProfileState.js +1 -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/Lazy.d.ts +20 -0
- package/lib/utils/Lazy.js +32 -6
- package/lib/utils/Screencapture.js +3 -0
- package/lib/utils/WithSuspense.d.ts +11 -1
- package/lib/utils/WithSuspense.js +11 -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/AdmittedClients.d.ts +44 -0
- package/lib/views/mcp/AdmittedClients.js +59 -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/ApprovalQueue.d.ts +66 -0
- package/lib/views/mcp/ApprovalQueue.js +95 -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 +135 -0
- package/lib/views/mcp/EnterpriseConsole.d.ts +74 -0
- package/lib/views/mcp/EnterpriseConsole.js +195 -0
- package/lib/views/mcp/IdentityProviders.d.ts +33 -0
- package/lib/views/mcp/IdentityProviders.js +299 -0
- package/lib/views/mcp/McpDashboard.d.ts +50 -0
- package/lib/views/mcp/McpDashboard.js +430 -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 +79 -0
- package/lib/views/mcp/McpObservability.js +236 -0
- package/lib/views/mcp/NotebookRuns.d.ts +39 -0
- package/lib/views/mcp/NotebookRuns.js +44 -0
- package/lib/views/mcp/OrganizationPolicy.d.ts +45 -0
- package/lib/views/mcp/OrganizationPolicy.js +108 -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 +126 -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 +83 -0
- package/lib/views/mcp/PolicyForm.js +113 -0
- package/lib/views/mcp/PolicyHistory.d.ts +58 -0
- package/lib/views/mcp/PolicyHistory.js +75 -0
- package/lib/views/mcp/RunDetail.d.ts +87 -0
- package/lib/views/mcp/RunDetail.js +186 -0
- package/lib/views/mcp/ScimProvisioning.d.ts +54 -0
- package/lib/views/mcp/ScimProvisioning.js +173 -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 +159 -0
- package/lib/views/mcp/ToolAccess.d.ts +60 -0
- package/lib/views/mcp/ToolAccess.js +101 -0
- package/lib/views/mcp/TraceTimeline.d.ts +81 -0
- package/lib/views/mcp/TraceTimeline.js +132 -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 +34 -0
- package/lib/views/mcp/index.js +42 -0
- package/lib/views/mcp/types.d.ts +66 -0
- package/lib/views/mcp/types.js +5 -0
- package/lib/views/otel/simpleAuthStore.js +3 -0
- package/lib/views/secrets/SecretEdit.d.ts +5 -1
- package/lib/views/secrets/SecretEdit.js +5 -4
- package/lib/views/secrets/SecretNew.d.ts +11 -1
- package/lib/views/secrets/SecretNew.js +7 -3
- package/lib/views/secrets/Secrets.d.ts +12 -1
- package/lib/views/secrets/Secrets.js +2 -2
- package/package.json +269 -260
- package/scripts/generate-contents-types.py +169 -0
- package/scripts/generate-mcp-types.py +233 -0
- package/scripts/generate-orchestration-types.py +920 -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,169 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
# Distributed under the terms of the Modified BSD License.
|
|
4
|
+
|
|
5
|
+
"""Generate deterministic TypeScript wire types from Contents OpenAPI."""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
import subprocess
|
|
12
|
+
import sys
|
|
13
|
+
import tempfile
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Any
|
|
16
|
+
|
|
17
|
+
ROOT = Path(__file__).parents[1]
|
|
18
|
+
DEFAULT_OPENAPI = (
|
|
19
|
+
ROOT.parents[2]
|
|
20
|
+
/ "k8s/services/contents/datalayer_contents/contracts/v1/openapi.json"
|
|
21
|
+
)
|
|
22
|
+
OPENAPI = Path(os.environ.get("DATALAYER_CONTENTS_OPENAPI", DEFAULT_OPENAPI))
|
|
23
|
+
DEFAULT_CONTRACT_FIXTURES = (
|
|
24
|
+
ROOT.parents[2] / "k8s/services/contents/tests/fixtures/v1-contracts.json"
|
|
25
|
+
)
|
|
26
|
+
DEFAULT_SOLR_CODEC_FIXTURE = (
|
|
27
|
+
ROOT.parents[2]
|
|
28
|
+
/ "k8s/services/common/datalayer_common/tests/fixtures/solr_codec.json"
|
|
29
|
+
)
|
|
30
|
+
CONTRACT_FIXTURES = Path(
|
|
31
|
+
os.environ.get("DATALAYER_CONTENTS_CONTRACT_FIXTURES", DEFAULT_CONTRACT_FIXTURES)
|
|
32
|
+
)
|
|
33
|
+
SOLR_CODEC_FIXTURE = Path(
|
|
34
|
+
os.environ.get("DATALAYER_SOLR_CODEC_FIXTURE", DEFAULT_SOLR_CODEC_FIXTURE)
|
|
35
|
+
)
|
|
36
|
+
OUTPUT = ROOT / "src/api/contents/generated.ts"
|
|
37
|
+
PYTHON_OUTPUT = ROOT / "datalayer_core/models/contents/generated.py"
|
|
38
|
+
CLIENT_CONTRACT_FIXTURES = ROOT / "src/models/contents/__fixtures__/v1-contracts.json"
|
|
39
|
+
CLIENT_SOLR_CODEC_FIXTURE = ROOT / "src/models/contents/__fixtures__/solr-codec.json"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def type_name(reference: str) -> str:
|
|
43
|
+
return reference.rsplit("/", 1)[-1]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def ts_type(schema: dict[str, Any]) -> str:
|
|
47
|
+
if "$ref" in schema:
|
|
48
|
+
return type_name(schema["$ref"])
|
|
49
|
+
if "const" in schema:
|
|
50
|
+
return json.dumps(schema["const"])
|
|
51
|
+
if "enum" in schema:
|
|
52
|
+
return " | ".join(json.dumps(value) for value in schema["enum"])
|
|
53
|
+
if "oneOf" in schema:
|
|
54
|
+
return " | ".join(ts_type(item) for item in schema["oneOf"])
|
|
55
|
+
if "anyOf" in schema:
|
|
56
|
+
return " | ".join(ts_type(item) for item in schema["anyOf"])
|
|
57
|
+
kind = schema.get("type")
|
|
58
|
+
if isinstance(kind, list):
|
|
59
|
+
return " | ".join(
|
|
60
|
+
"null" if item == "null" else ts_type({"type": item}) for item in kind
|
|
61
|
+
)
|
|
62
|
+
if kind == "array":
|
|
63
|
+
return f"Array<{ts_type(schema.get('items', {}))}>"
|
|
64
|
+
if kind == "object":
|
|
65
|
+
additional = schema.get("additionalProperties")
|
|
66
|
+
return (
|
|
67
|
+
f"Record<string, {ts_type(additional)}>"
|
|
68
|
+
if isinstance(additional, dict)
|
|
69
|
+
else "Record<string, unknown>"
|
|
70
|
+
)
|
|
71
|
+
if kind in {"integer", "number"}:
|
|
72
|
+
return "number"
|
|
73
|
+
if kind == "boolean":
|
|
74
|
+
return "boolean"
|
|
75
|
+
if kind == "null":
|
|
76
|
+
return "null"
|
|
77
|
+
if kind == "string":
|
|
78
|
+
return "string"
|
|
79
|
+
return "unknown"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def camel(name: str) -> str:
|
|
83
|
+
parts = name.split("_")
|
|
84
|
+
return parts[0] + "".join(part[:1].upper() + part[1:] for part in parts[1:])
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def generate() -> str:
|
|
88
|
+
document = json.loads(OPENAPI.read_text())
|
|
89
|
+
schemas = document["components"]["schemas"]
|
|
90
|
+
lines = [
|
|
91
|
+
"/* This file is generated from Datalayer Contents OpenAPI. Do not edit. */",
|
|
92
|
+
"",
|
|
93
|
+
]
|
|
94
|
+
for name, schema in schemas.items():
|
|
95
|
+
if schema.get("type") == "object" and "properties" in schema:
|
|
96
|
+
lines.append(f"export interface {name} {{")
|
|
97
|
+
required = set(schema.get("required", []))
|
|
98
|
+
for property_name, property_schema in schema["properties"].items():
|
|
99
|
+
optional = "" if property_name in required else "?"
|
|
100
|
+
lines.append(
|
|
101
|
+
f" {camel(property_name)}{optional}: {ts_type(property_schema)};"
|
|
102
|
+
)
|
|
103
|
+
lines.extend(["}", ""])
|
|
104
|
+
else:
|
|
105
|
+
lines.extend([f"export type {name} = {ts_type(schema)};", ""])
|
|
106
|
+
return "\n".join(lines)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def main() -> None:
|
|
110
|
+
expected = generate()
|
|
111
|
+
expected_fixtures = CONTRACT_FIXTURES.read_text()
|
|
112
|
+
expected_solr_fixture = SOLR_CODEC_FIXTURE.read_text()
|
|
113
|
+
check = "--check" in sys.argv[1:]
|
|
114
|
+
if check:
|
|
115
|
+
if not OUTPUT.exists() or OUTPUT.read_text() != expected:
|
|
116
|
+
raise SystemExit("Stale generated Contents TypeScript types")
|
|
117
|
+
if (
|
|
118
|
+
not CLIENT_CONTRACT_FIXTURES.exists()
|
|
119
|
+
or CLIENT_CONTRACT_FIXTURES.read_text() != expected_fixtures
|
|
120
|
+
):
|
|
121
|
+
raise SystemExit("Stale generated Contents contract fixtures")
|
|
122
|
+
if (
|
|
123
|
+
not CLIENT_SOLR_CODEC_FIXTURE.exists()
|
|
124
|
+
or CLIENT_SOLR_CODEC_FIXTURE.read_text() != expected_solr_fixture
|
|
125
|
+
):
|
|
126
|
+
raise SystemExit("Stale generated Solr codec fixture")
|
|
127
|
+
else:
|
|
128
|
+
OUTPUT.parent.mkdir(parents=True, exist_ok=True)
|
|
129
|
+
OUTPUT.write_text(expected)
|
|
130
|
+
CLIENT_CONTRACT_FIXTURES.parent.mkdir(parents=True, exist_ok=True)
|
|
131
|
+
CLIENT_CONTRACT_FIXTURES.write_text(expected_fixtures)
|
|
132
|
+
CLIENT_SOLR_CODEC_FIXTURE.write_text(expected_solr_fixture)
|
|
133
|
+
|
|
134
|
+
with tempfile.TemporaryDirectory() as temporary_directory:
|
|
135
|
+
generated_python = (
|
|
136
|
+
Path(temporary_directory) / "generated.py" if check else PYTHON_OUTPUT
|
|
137
|
+
)
|
|
138
|
+
generated_python.parent.mkdir(parents=True, exist_ok=True)
|
|
139
|
+
subprocess.run(
|
|
140
|
+
[
|
|
141
|
+
"datamodel-codegen",
|
|
142
|
+
"--input",
|
|
143
|
+
str(OPENAPI),
|
|
144
|
+
"--input-file-type",
|
|
145
|
+
"openapi",
|
|
146
|
+
"--output",
|
|
147
|
+
str(generated_python),
|
|
148
|
+
"--output-model-type",
|
|
149
|
+
"pydantic_v2.BaseModel",
|
|
150
|
+
"--target-python-version",
|
|
151
|
+
"3.10",
|
|
152
|
+
"--use-standard-collections",
|
|
153
|
+
"--use-union-operator",
|
|
154
|
+
"--disable-timestamp",
|
|
155
|
+
"--enum-field-as-literal",
|
|
156
|
+
"all",
|
|
157
|
+
"--collapse-root-models",
|
|
158
|
+
],
|
|
159
|
+
check=True,
|
|
160
|
+
)
|
|
161
|
+
if check and (
|
|
162
|
+
not PYTHON_OUTPUT.exists()
|
|
163
|
+
or PYTHON_OUTPUT.read_text() != generated_python.read_text()
|
|
164
|
+
):
|
|
165
|
+
raise SystemExit("Stale generated Contents Python types")
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
if __name__ == "__main__":
|
|
169
|
+
main()
|
|
@@ -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://r1.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()
|