@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,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
7
|
+
* Distributed under the terms of the Modified BSD License.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* A bucket through the service: listed, stat'ed, read, tested and signed.
|
|
11
|
+
*
|
|
12
|
+
* The credential never comes this way. The service resolves it for each
|
|
13
|
+
* request and hands it to a provider adapter; what a browser gets back is
|
|
14
|
+
* objects, bytes, a verdict, or a URL good for one path, one operation and a
|
|
15
|
+
* bounded time.
|
|
16
|
+
*/
|
|
17
|
+
import { requestDatalayerAPI, requestDatalayerAPIWithResponse, } from '../DatalayerApi.js';
|
|
18
|
+
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
|
|
19
|
+
import { contentsToCamelCase } from '../../models/contents/index.js';
|
|
20
|
+
const convertResponse = (value) => contentsToCamelCase(value);
|
|
21
|
+
const cloudUrl = (baseUrl, sourceUid, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources/${encodeURIComponent(sourceUid)}/cloud${suffix}`;
|
|
22
|
+
/** One page of a bucket under a prefix; `nextCursor` continues it. */
|
|
23
|
+
export const listCloudObjects = async (token, sourceUid, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
|
|
24
|
+
const parameters = new URLSearchParams();
|
|
25
|
+
if (options.prefix) {
|
|
26
|
+
parameters.set('prefix', options.prefix);
|
|
27
|
+
}
|
|
28
|
+
if (options.cursor) {
|
|
29
|
+
parameters.set('cursor', options.cursor);
|
|
30
|
+
}
|
|
31
|
+
const query = parameters.toString();
|
|
32
|
+
return convertResponse(await requestDatalayerAPI({
|
|
33
|
+
url: `${cloudUrl(baseUrl, sourceUid, '/objects')}${query ? `?${query}` : ''}`,
|
|
34
|
+
method: 'GET',
|
|
35
|
+
token,
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
export const statCloudObject = async (token, sourceUid, path, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
39
|
+
url: `${cloudUrl(baseUrl, sourceUid, '/objects/stat')}?path=${encodeURIComponent(path)}`,
|
|
40
|
+
method: 'GET',
|
|
41
|
+
token,
|
|
42
|
+
}));
|
|
43
|
+
/** The bytes of one object, or a range of them. */
|
|
44
|
+
export const downloadCloudObject = async (token, sourceUid, path, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
|
|
45
|
+
const response = await requestDatalayerAPIWithResponse({
|
|
46
|
+
url: `${cloudUrl(baseUrl, sourceUid, '/objects/content')}?path=${encodeURIComponent(path)}`,
|
|
47
|
+
method: 'GET',
|
|
48
|
+
token,
|
|
49
|
+
headers: options.range ? { Range: options.range } : undefined,
|
|
50
|
+
responseType: 'arraybuffer',
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
body: response.data,
|
|
54
|
+
status: response.status,
|
|
55
|
+
headers: response.headers,
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/** Can the bucket be reached with the credential attached: a verdict, not a stack trace. */
|
|
59
|
+
export const testCloudConnection = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
60
|
+
url: cloudUrl(baseUrl, sourceUid, '/test'),
|
|
61
|
+
method: 'POST',
|
|
62
|
+
token,
|
|
63
|
+
}));
|
|
64
|
+
/** A URL good for one path, one operation, a bounded time. A `put` needs the right to update. */
|
|
65
|
+
export const presignCloudObject = async (token, sourceUid, path, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
|
|
66
|
+
const parameters = new URLSearchParams({ path, operation: options.operation ?? 'get' });
|
|
67
|
+
if (options.expiresIn) {
|
|
68
|
+
parameters.set('expires_in', String(options.expiresIn));
|
|
69
|
+
}
|
|
70
|
+
return convertResponse(await requestDatalayerAPI({
|
|
71
|
+
url: `${cloudUrl(baseUrl, sourceUid, '/objects/presign')}?${parameters.toString()}`,
|
|
72
|
+
method: 'POST',
|
|
73
|
+
token,
|
|
74
|
+
}));
|
|
75
|
+
};
|
|
76
|
+
/** Whether the source's credential is referenced and resolvable — never its value. */
|
|
77
|
+
export const getCredentialDiagnostics = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
78
|
+
url: `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources/${encodeURIComponent(sourceUid)}/diagnostics`,
|
|
79
|
+
method: 'GET',
|
|
80
|
+
token,
|
|
81
|
+
}));
|
|
82
|
+
/** Point the source at another credential. Owner only, conditional on the ETag. */
|
|
83
|
+
export const rotateSourceCredential = async (token, sourceUid, credentialUid, etag, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
84
|
+
url: `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources/${encodeURIComponent(sourceUid)}/credential`,
|
|
85
|
+
method: 'POST',
|
|
86
|
+
token,
|
|
87
|
+
headers: { 'If-Match': etag },
|
|
88
|
+
body: { credential_uid: credentialUid },
|
|
89
|
+
}));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CertificateSigningRequest, DataServerConnectivity, DataServerStatus, EffectivePermissions, IssuedIdentity } from './generated';
|
|
2
|
+
/** The states the service keeps a registration in. */
|
|
3
|
+
export type DataserverState = DataServerStatus['state'];
|
|
4
|
+
export declare const DATASERVER_STATES: ReadonlyArray<DataserverState>;
|
|
5
|
+
/** The state as a person reads it. */
|
|
6
|
+
export declare const DATASERVER_STATE_LABELS: Record<DataserverState, string>;
|
|
7
|
+
export type DataserverAction = 'test' | 'rotateIdentity' | 'drain' | 'resume' | 'revoke' | 'archive' | 'delete';
|
|
8
|
+
export interface DataserverActionAvailability {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
/** Why not, when not: the state or the permission that stands in the way. */
|
|
11
|
+
reason?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Which actions a reader may take on a gateway in this state, and why not.
|
|
15
|
+
*
|
|
16
|
+
* `view` inspects; `execute` tests; owner or update-holder registers,
|
|
17
|
+
* rotates, drains, resumes, revokes, archives and deletes. A gateway that is
|
|
18
|
+
* revoked, or one that has gone quiet, keeps its record — the disabled
|
|
19
|
+
* actions name the state as the reason rather than disappearing.
|
|
20
|
+
*/
|
|
21
|
+
export declare const dataserverActionAvailability: (state: DataserverState | null | undefined, permissions: Pick<EffectivePermissions, "isOwner" | "update" | "execute">, options?: {
|
|
22
|
+
archived?: boolean;
|
|
23
|
+
}) => Record<DataserverAction, DataserverActionAvailability>;
|
|
24
|
+
/** The gateway as last heard: its lease, its connectors, its queue. */
|
|
25
|
+
export declare const getDataserverStatus: (token: string, sourceUid: string, baseUrl?: string) => Promise<DataServerStatus>;
|
|
26
|
+
/** Try the gateway on Flight and on the HTTPS fallback; the answer is a verdict per path. */
|
|
27
|
+
export declare const testDataserver: (token: string, sourceUid: string, baseUrl?: string) => Promise<DataServerConnectivity>;
|
|
28
|
+
/** Stop routing new queries; the ones running finish. */
|
|
29
|
+
export declare const drainDataserver: (token: string, sourceUid: string, baseUrl?: string) => Promise<DataServerStatus>;
|
|
30
|
+
/** Route to the gateway again. */
|
|
31
|
+
export declare const resumeDataserver: (token: string, sourceUid: string, baseUrl?: string) => Promise<DataServerStatus>;
|
|
32
|
+
/** Refuse the gateway's identity from now on. Nothing in its network changes. */
|
|
33
|
+
export declare const revokeDataserver: (token: string, sourceUid: string, baseUrl?: string) => Promise<DataServerStatus>;
|
|
34
|
+
/** A first certificate for the identity the CSR names. */
|
|
35
|
+
export declare const issueDataserverIdentity: (token: string, sourceUid: string, request: CertificateSigningRequest, baseUrl?: string) => Promise<IssuedIdentity>;
|
|
36
|
+
/** A new certificate that overlaps the current one, so nothing stops. */
|
|
37
|
+
export declare const rotateDataserverIdentity: (token: string, sourceUid: string, request: CertificateSigningRequest, baseUrl?: string) => Promise<IssuedIdentity>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
7
|
+
* Distributed under the terms of the Modified BSD License.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* A Dataserver registration through the service: read, moved, re-identified.
|
|
11
|
+
*
|
|
12
|
+
* The gateway itself runs in a customer's network. What is here is what it
|
|
13
|
+
* last said of itself — a heartbeat lease, the connectors it advertises,
|
|
14
|
+
* its queue — and the levers the catalog has on it: drain, resume, revoke,
|
|
15
|
+
* and a certificate issued or rotated from a CSR the gateway made, so the
|
|
16
|
+
* private key never travels.
|
|
17
|
+
*
|
|
18
|
+
* The wire types are the generated ones; what is declared here is what the
|
|
19
|
+
* contract does not name — the state union as a standalone type, its labels,
|
|
20
|
+
* and which action a reader may take on a gateway in a given state.
|
|
21
|
+
*/
|
|
22
|
+
import { requestDatalayerAPI } from '../DatalayerApi.js';
|
|
23
|
+
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
|
|
24
|
+
import { contentsToCamelCase } from '../../models/contents/index.js';
|
|
25
|
+
export const DATASERVER_STATES = [
|
|
26
|
+
'registering',
|
|
27
|
+
'ready',
|
|
28
|
+
'degraded',
|
|
29
|
+
'unavailable',
|
|
30
|
+
'draining',
|
|
31
|
+
'revoked',
|
|
32
|
+
];
|
|
33
|
+
/** The state as a person reads it. */
|
|
34
|
+
export const DATASERVER_STATE_LABELS = {
|
|
35
|
+
registering: 'Registering',
|
|
36
|
+
ready: 'Online',
|
|
37
|
+
degraded: 'Degraded',
|
|
38
|
+
unavailable: 'Offline',
|
|
39
|
+
draining: 'Draining',
|
|
40
|
+
revoked: 'Revoked',
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Which actions a reader may take on a gateway in this state, and why not.
|
|
44
|
+
*
|
|
45
|
+
* `view` inspects; `execute` tests; owner or update-holder registers,
|
|
46
|
+
* rotates, drains, resumes, revokes, archives and deletes. A gateway that is
|
|
47
|
+
* revoked, or one that has gone quiet, keeps its record — the disabled
|
|
48
|
+
* actions name the state as the reason rather than disappearing.
|
|
49
|
+
*/
|
|
50
|
+
export const dataserverActionAvailability = (state, permissions, options = {}) => {
|
|
51
|
+
const manages = permissions.isOwner || permissions.update;
|
|
52
|
+
const needsManage = 'Only the owner or an update-holder may do this.';
|
|
53
|
+
const revoked = state === 'revoked';
|
|
54
|
+
const decide = (allowed, permissionReason, stateReason) => {
|
|
55
|
+
if (!allowed) {
|
|
56
|
+
return { enabled: false, reason: permissionReason };
|
|
57
|
+
}
|
|
58
|
+
if (stateReason) {
|
|
59
|
+
return { enabled: false, reason: stateReason };
|
|
60
|
+
}
|
|
61
|
+
return { enabled: true };
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
test: decide(permissions.execute || manages, 'Only someone who may execute through this gateway can test it.', revoked ? 'The gateway is revoked; its identity is no longer accepted.' : undefined),
|
|
65
|
+
rotateIdentity: decide(manages, needsManage, revoked ? 'A revoked gateway is re-admitted with a new identity, not a rotation.' : undefined),
|
|
66
|
+
drain: decide(manages, needsManage, revoked
|
|
67
|
+
? 'The gateway is revoked.'
|
|
68
|
+
: state === 'draining'
|
|
69
|
+
? 'The gateway is already draining.'
|
|
70
|
+
: state === 'registering' || state === 'unavailable' || !state
|
|
71
|
+
? 'Nothing routes to a gateway that is not online; there is nothing to drain.'
|
|
72
|
+
: undefined),
|
|
73
|
+
resume: decide(manages, needsManage, revoked
|
|
74
|
+
? 'The gateway is revoked.'
|
|
75
|
+
: state !== 'draining'
|
|
76
|
+
? 'Only a draining gateway is resumed.'
|
|
77
|
+
: undefined),
|
|
78
|
+
revoke: decide(manages, needsManage, revoked ? 'The gateway is already revoked.' : undefined),
|
|
79
|
+
archive: decide(manages, needsManage, options.archived ? 'The registration is already archived.' : undefined),
|
|
80
|
+
delete: decide(manages, needsManage),
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
const convertResponse = (value) => contentsToCamelCase(value);
|
|
84
|
+
const dataserverUrl = (baseUrl, sourceUid, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/dataservers/${encodeURIComponent(sourceUid)}${suffix}`;
|
|
85
|
+
/** The gateway as last heard: its lease, its connectors, its queue. */
|
|
86
|
+
export const getDataserverStatus = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
87
|
+
url: dataserverUrl(baseUrl, sourceUid, '/status'),
|
|
88
|
+
method: 'GET',
|
|
89
|
+
token,
|
|
90
|
+
}));
|
|
91
|
+
/** Try the gateway on Flight and on the HTTPS fallback; the answer is a verdict per path. */
|
|
92
|
+
export const testDataserver = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
93
|
+
url: dataserverUrl(baseUrl, sourceUid, '/test'),
|
|
94
|
+
method: 'POST',
|
|
95
|
+
token,
|
|
96
|
+
}));
|
|
97
|
+
const transition = async (token, sourceUid, action, baseUrl) => convertResponse(await requestDatalayerAPI({
|
|
98
|
+
url: dataserverUrl(baseUrl, sourceUid, `/${action}`),
|
|
99
|
+
method: 'POST',
|
|
100
|
+
token,
|
|
101
|
+
}));
|
|
102
|
+
/** Stop routing new queries; the ones running finish. */
|
|
103
|
+
export const drainDataserver = (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => transition(token, sourceUid, 'drain', baseUrl);
|
|
104
|
+
/** Route to the gateway again. */
|
|
105
|
+
export const resumeDataserver = (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => transition(token, sourceUid, 'resume', baseUrl);
|
|
106
|
+
/** Refuse the gateway's identity from now on. Nothing in its network changes. */
|
|
107
|
+
export const revokeDataserver = (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => transition(token, sourceUid, 'revoke', baseUrl);
|
|
108
|
+
/** A first certificate for the identity the CSR names. */
|
|
109
|
+
export const issueDataserverIdentity = async (token, sourceUid, request, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
110
|
+
url: dataserverUrl(baseUrl, sourceUid, '/identity'),
|
|
111
|
+
method: 'POST',
|
|
112
|
+
token,
|
|
113
|
+
body: { csr: request.csr },
|
|
114
|
+
}));
|
|
115
|
+
/** A new certificate that overlaps the current one, so nothing stops. */
|
|
116
|
+
export const rotateDataserverIdentity = async (token, sourceUid, request, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
117
|
+
url: dataserverUrl(baseUrl, sourceUid, '/identity/rotate'),
|
|
118
|
+
method: 'POST',
|
|
119
|
+
token,
|
|
120
|
+
body: { csr: request.csr },
|
|
121
|
+
}));
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { DatasetPublication, DatasetPublicationCreate, DatasetPublicationList, DatasetRevision, DatasetRevisionCreate, DatasetRevisionList } from './generated';
|
|
2
|
+
export declare const createDatasetRevision: (token: string, sourceUid: string, request: DatasetRevisionCreate, idempotencyKey: string, baseUrl?: string) => Promise<DatasetRevision>;
|
|
3
|
+
export declare const listDatasetRevisions: (token: string, sourceUid: string, baseUrl?: string) => Promise<DatasetRevisionList>;
|
|
4
|
+
export declare const getDatasetRevision: (token: string, sourceUid: string, revisionUid: string, baseUrl?: string) => Promise<DatasetRevision>;
|
|
5
|
+
export declare const createDatasetPublication: (token: string, sourceUid: string, request: DatasetPublicationCreate, idempotencyKey: string, baseUrl?: string) => Promise<DatasetPublication>;
|
|
6
|
+
export declare const listDatasetPublications: (token: string, sourceUid: string, baseUrl?: string) => Promise<DatasetPublicationList>;
|
|
7
|
+
export declare const unpublishDataset: (token: string, sourceUid: string, publicationUid: string, baseUrl?: string) => Promise<DatasetPublication>;
|
|
8
|
+
/** The Dataset a clone produced, and where it came from. */
|
|
9
|
+
export type DatasetClone = {
|
|
10
|
+
uid: string;
|
|
11
|
+
name: string;
|
|
12
|
+
sourceUid: string;
|
|
13
|
+
publicationUid: string;
|
|
14
|
+
revisionUid: string;
|
|
15
|
+
fileCount: number;
|
|
16
|
+
totalSize: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Take a published Dataset into your own catalog.
|
|
20
|
+
*
|
|
21
|
+
* A publication names one immutable revision, so the clone is a Dataset of
|
|
22
|
+
* the caller's own whose first revision names the same objects. Nothing is
|
|
23
|
+
* copied: the bytes cannot change, which is what makes sharing them safe, and
|
|
24
|
+
* the record and its permissions belong to the caller from that moment.
|
|
25
|
+
*/
|
|
26
|
+
export declare const cloneDatasetPublication: (token: string, sourceUid: string, publicationUid: string, idempotencyKey: string, baseUrl?: string) => Promise<DatasetClone>;
|
|
27
|
+
/**
|
|
28
|
+
* Every Dataset currently published, across sources.
|
|
29
|
+
*
|
|
30
|
+
* What the Library shows: a publication names one immutable revision of a
|
|
31
|
+
* Dataset, so this is the list of what has been made public, not of Datasets.
|
|
32
|
+
* Any signed-in caller may read it — published means public.
|
|
33
|
+
*/
|
|
34
|
+
export declare const listPublishedDatasets: (token: string, baseUrl?: string) => Promise<DatasetPublicationList>;
|
|
35
|
+
/** A published Data Server's catalog, as the library shows it. */
|
|
36
|
+
export type DataServerPublication = {
|
|
37
|
+
uid: string;
|
|
38
|
+
sourceUid: string;
|
|
39
|
+
actorUid: string;
|
|
40
|
+
ownerUid: string;
|
|
41
|
+
name: string;
|
|
42
|
+
description?: string | null;
|
|
43
|
+
tags: string[];
|
|
44
|
+
connectors: string[];
|
|
45
|
+
relations: string[];
|
|
46
|
+
status: string;
|
|
47
|
+
createdAt: string;
|
|
48
|
+
};
|
|
49
|
+
/** The Datasource an attach produced, naming the published Data Server. */
|
|
50
|
+
export type DataServerAttachment = {
|
|
51
|
+
uid: string;
|
|
52
|
+
name: string;
|
|
53
|
+
sourceUid: string;
|
|
54
|
+
publicationUid: string;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Attach a published Data Server as a Datasource of your own.
|
|
58
|
+
*
|
|
59
|
+
* The Datasource names it and the relations it publishes, and carries no
|
|
60
|
+
* credential: the Data Server's own mTLS still decides whether a query
|
|
61
|
+
* reaches it. That is what makes publishing a catalog safe.
|
|
62
|
+
*/
|
|
63
|
+
export declare const attachDataServerPublication: (token: string, sourceUid: string, publicationUid: string, idempotencyKey: string, baseUrl?: string) => Promise<DataServerAttachment>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import { requestDatalayerAPI } from '../DatalayerApi.js';
|
|
6
|
+
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
|
|
7
|
+
import { contentsToCamelCase, contentsToSnakeCase, } from '../../models/contents/index.js';
|
|
8
|
+
const convert = (value) => contentsToCamelCase(value);
|
|
9
|
+
const resourceUrl = (baseUrl, sourceUid, resource, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources/${encodeURIComponent(sourceUid)}/${resource}${suffix}`;
|
|
10
|
+
export const createDatasetRevision = async (token, sourceUid, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
11
|
+
url: resourceUrl(baseUrl, sourceUid, 'revisions'),
|
|
12
|
+
method: 'POST',
|
|
13
|
+
token,
|
|
14
|
+
headers: { 'Idempotency-Key': idempotencyKey },
|
|
15
|
+
body: contentsToSnakeCase(request),
|
|
16
|
+
}));
|
|
17
|
+
export const listDatasetRevisions = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
18
|
+
url: resourceUrl(baseUrl, sourceUid, 'revisions'),
|
|
19
|
+
method: 'GET',
|
|
20
|
+
token,
|
|
21
|
+
}));
|
|
22
|
+
export const getDatasetRevision = async (token, sourceUid, revisionUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
23
|
+
url: resourceUrl(baseUrl, sourceUid, 'revisions', `/${encodeURIComponent(revisionUid)}`),
|
|
24
|
+
method: 'GET',
|
|
25
|
+
token,
|
|
26
|
+
}));
|
|
27
|
+
export const createDatasetPublication = async (token, sourceUid, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
28
|
+
url: resourceUrl(baseUrl, sourceUid, 'publications'),
|
|
29
|
+
method: 'POST',
|
|
30
|
+
token,
|
|
31
|
+
headers: { 'Idempotency-Key': idempotencyKey },
|
|
32
|
+
body: contentsToSnakeCase(request),
|
|
33
|
+
}));
|
|
34
|
+
export const listDatasetPublications = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
35
|
+
url: resourceUrl(baseUrl, sourceUid, 'publications'),
|
|
36
|
+
method: 'GET',
|
|
37
|
+
token,
|
|
38
|
+
}));
|
|
39
|
+
export const unpublishDataset = async (token, sourceUid, publicationUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
40
|
+
url: resourceUrl(baseUrl, sourceUid, 'publications', `/${encodeURIComponent(publicationUid)}`),
|
|
41
|
+
method: 'DELETE',
|
|
42
|
+
token,
|
|
43
|
+
}));
|
|
44
|
+
/**
|
|
45
|
+
* Take a published Dataset into your own catalog.
|
|
46
|
+
*
|
|
47
|
+
* A publication names one immutable revision, so the clone is a Dataset of
|
|
48
|
+
* the caller's own whose first revision names the same objects. Nothing is
|
|
49
|
+
* copied: the bytes cannot change, which is what makes sharing them safe, and
|
|
50
|
+
* the record and its permissions belong to the caller from that moment.
|
|
51
|
+
*/
|
|
52
|
+
export const cloneDatasetPublication = async (token, sourceUid, publicationUid, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
53
|
+
url: resourceUrl(baseUrl, sourceUid, 'publications', `/${encodeURIComponent(publicationUid)}/clone`),
|
|
54
|
+
method: 'POST',
|
|
55
|
+
token,
|
|
56
|
+
headers: { 'Idempotency-Key': idempotencyKey },
|
|
57
|
+
}));
|
|
58
|
+
/**
|
|
59
|
+
* Every Dataset currently published, across sources.
|
|
60
|
+
*
|
|
61
|
+
* What the Library shows: a publication names one immutable revision of a
|
|
62
|
+
* Dataset, so this is the list of what has been made public, not of Datasets.
|
|
63
|
+
* Any signed-in caller may read it — published means public.
|
|
64
|
+
*/
|
|
65
|
+
export const listPublishedDatasets = async (token, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
66
|
+
url: `${baseUrl}${API_BASE_PATHS.CONTENTS}/publications`,
|
|
67
|
+
method: 'GET',
|
|
68
|
+
token,
|
|
69
|
+
}));
|
|
70
|
+
/**
|
|
71
|
+
* Attach a published Data Server as a Datasource of your own.
|
|
72
|
+
*
|
|
73
|
+
* The Datasource names it and the relations it publishes, and carries no
|
|
74
|
+
* credential: the Data Server's own mTLS still decides whether a query
|
|
75
|
+
* reaches it. That is what makes publishing a catalog safe.
|
|
76
|
+
*/
|
|
77
|
+
export const attachDataServerPublication = async (token, sourceUid, publicationUid, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
78
|
+
url: `${baseUrl}/api/contents/v1/sources/${encodeURIComponent(sourceUid)}/dataserver-publications/${encodeURIComponent(publicationUid)}/attach`,
|
|
79
|
+
method: 'POST',
|
|
80
|
+
token,
|
|
81
|
+
headers: { 'Idempotency-Key': idempotencyKey },
|
|
82
|
+
}));
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { CapabilityTicket, CapabilityTicketRequest, DatasetRevision, DatasourceCapabilities, DatasourceConfiguration, DatasourceQuery, DatasourceQueryCreate, DatasourceQueryList, DatasourceSchema, DatasourceTest, QuerySave } from './generated';
|
|
2
|
+
export type DatasourceConnectorType = DatasourceConfiguration['connectorType'];
|
|
3
|
+
export type DatasourceNetworkRoute = NonNullable<DatasourceConfiguration['networkRoute']>;
|
|
4
|
+
export type DatasourceOperation = DatasourceCapabilities['operations'][number];
|
|
5
|
+
export type DatasourceQueryStatus = DatasourceQuery['status'];
|
|
6
|
+
/** The operations a Datasource may allow, in the order a form lists them. */
|
|
7
|
+
export declare const DATASOURCE_OPERATIONS: ReadonlyArray<DatasourceOperation>;
|
|
8
|
+
/**
|
|
9
|
+
* The connectors a person can pick in a form.
|
|
10
|
+
*
|
|
11
|
+
* `table` is not one of them: a published table is created by publishing it
|
|
12
|
+
* from a sandbox, and `POST /sources` refuses one made by hand
|
|
13
|
+
* (`PUBLISHED_TABLE_MANAGED`) because the record and its files have to come
|
|
14
|
+
* into being together. Saying that in the type keeps a creation form from
|
|
15
|
+
* having to invent labels and hints for something it cannot create.
|
|
16
|
+
*/
|
|
17
|
+
export type CreatableDatasourceConnectorType = Exclude<DatasourceConnectorType, 'table' | 'live'>;
|
|
18
|
+
export declare const DATASOURCE_CONNECTOR_LABELS: Record<DatasourceConnectorType, string>;
|
|
19
|
+
/** A query the service has finished with, one way or another. */
|
|
20
|
+
export declare const DATASOURCE_QUERY_TERMINAL_STATUSES: ReadonlySet<DatasourceQueryStatus>;
|
|
21
|
+
export declare const isDatasourceQueryTerminal: (status: DatasourceQueryStatus) => boolean;
|
|
22
|
+
/** The bytes of a result, or a range of them, with what the headers said. */
|
|
23
|
+
export interface DatasourceQueryResultBytes {
|
|
24
|
+
body: ArrayBuffer;
|
|
25
|
+
status: number;
|
|
26
|
+
headers: Record<string, string>;
|
|
27
|
+
}
|
|
28
|
+
/** Does the database answer through this source, right now? A verdict, not a stack trace. */
|
|
29
|
+
export declare const testDatasource: (token: string, sourceUid: string, baseUrl?: string) => Promise<DatasourceTest>;
|
|
30
|
+
/** The tables and columns the source exposes, as the service saw them. */
|
|
31
|
+
export declare const discoverDatasourceSchema: (token: string, sourceUid: string, baseUrl?: string) => Promise<DatasourceSchema>;
|
|
32
|
+
/** What the source may be asked, and how the answer can travel. */
|
|
33
|
+
export declare const getDatasourceCapabilities: (token: string, sourceUid: string, baseUrl?: string) => Promise<DatasourceCapabilities>;
|
|
34
|
+
/**
|
|
35
|
+
* Submit a statement; the answer is the job, not the rows.
|
|
36
|
+
*
|
|
37
|
+
* The service checks the statement against the source's operation allowlist
|
|
38
|
+
* and the limits against its policy before the job exists, so a refused
|
|
39
|
+
* query is refused here, with a reason, and not later on the stream.
|
|
40
|
+
*/
|
|
41
|
+
export declare const createDatasourceQuery: (token: string, sourceUid: string, request: DatasourceQueryCreate, idempotencyKey: string, baseUrl?: string) => Promise<DatasourceQuery>;
|
|
42
|
+
/** The queries run against a source, newest first: its history. */
|
|
43
|
+
export declare const listDatasourceQueries: (token: string, sourceUid: string, options?: {
|
|
44
|
+
cursor?: string;
|
|
45
|
+
limit?: number;
|
|
46
|
+
}, baseUrl?: string) => Promise<DatasourceQueryList>;
|
|
47
|
+
export declare const getDatasourceQuery: (token: string, queryUid: string, baseUrl?: string) => Promise<DatasourceQuery>;
|
|
48
|
+
/** Ask for the query to stop; the cancellation reaches the connector. */
|
|
49
|
+
export declare const cancelDatasourceQuery: (token: string, queryUid: string, baseUrl?: string) => Promise<DatasourceQuery>;
|
|
50
|
+
/** Where a browser fetches a result from; a link, for a download. */
|
|
51
|
+
export declare const datasourceQueryResultsUrl: (queryUid: string, baseUrl?: string) => string;
|
|
52
|
+
/**
|
|
53
|
+
* The result of a finished query, as Arrow IPC bytes, or a `Range` of them.
|
|
54
|
+
*
|
|
55
|
+
* A range is how a stream that broke halfway is resumed rather than
|
|
56
|
+
* restarted — and how a preview reads the first bytes of a large result
|
|
57
|
+
* without the rest.
|
|
58
|
+
*/
|
|
59
|
+
export declare const downloadDatasourceQueryResults: (token: string, queryUid: string, options?: {
|
|
60
|
+
range?: string;
|
|
61
|
+
}, baseUrl?: string) => Promise<DatasourceQueryResultBytes>;
|
|
62
|
+
/**
|
|
63
|
+
* Keep a result: written into a Dataset as a verified revision.
|
|
64
|
+
*
|
|
65
|
+
* The bytes go from the service into the Dataset; nothing is downloaded to
|
|
66
|
+
* be uploaded again, and the answer is the revision that now holds them.
|
|
67
|
+
*/
|
|
68
|
+
export declare const saveDatasourceQueryAsDataset: (token: string, queryUid: string, request: QuerySave, baseUrl?: string) => Promise<DatasetRevision>;
|
|
69
|
+
/** A Flight ticket for the result, for a client inside a sandbox. Never for the browser. */
|
|
70
|
+
export declare const createDatasourceQueryTicket: (token: string, queryUid: string, request?: CapabilityTicketRequest, baseUrl?: string) => Promise<CapabilityTicket>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
7
|
+
* Distributed under the terms of the Modified BSD License.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* A Datasource through the service: tested, described, queried.
|
|
11
|
+
*
|
|
12
|
+
* Nothing here talks to the database. Contents does, with the credential it
|
|
13
|
+
* holds — directly, or through a Dataserver in the customer's network — and
|
|
14
|
+
* answers with a verdict, a schema, or a query job. A job is polled to its
|
|
15
|
+
* end; its result is Arrow IPC bytes read by range, and it can be kept as a
|
|
16
|
+
* Dataset revision rather than downloaded to be uploaded again.
|
|
17
|
+
*
|
|
18
|
+
* The wire types are the generated ones; what is declared here is what the
|
|
19
|
+
* contract does not name — the unions as standalone types, the labels a
|
|
20
|
+
* form shows, which statuses are terminal, and the bytes of a result.
|
|
21
|
+
*/
|
|
22
|
+
import { requestDatalayerAPI, requestDatalayerAPIWithResponse, } from '../DatalayerApi.js';
|
|
23
|
+
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
|
|
24
|
+
import { contentsToCamelCase, contentsToSnakeCase, } from '../../models/contents/index.js';
|
|
25
|
+
/** The operations a Datasource may allow, in the order a form lists them. */
|
|
26
|
+
export const DATASOURCE_OPERATIONS = [
|
|
27
|
+
'select',
|
|
28
|
+
'describe',
|
|
29
|
+
'list',
|
|
30
|
+
];
|
|
31
|
+
export const DATASOURCE_CONNECTOR_LABELS = {
|
|
32
|
+
athena: 'Amazon Athena',
|
|
33
|
+
bigquery: 'Google BigQuery',
|
|
34
|
+
sql: 'SQL database',
|
|
35
|
+
// Listed, unlike above: a published table is a Datasource people see in
|
|
36
|
+
// the catalog and query like any other, even though no form makes one.
|
|
37
|
+
table: 'Published table',
|
|
38
|
+
// The same table while its kernel is up: answered from the live frame,
|
|
39
|
+
// and from the published snapshot once the kernel is gone.
|
|
40
|
+
live: 'Live table',
|
|
41
|
+
};
|
|
42
|
+
/** A query the service has finished with, one way or another. */
|
|
43
|
+
export const DATASOURCE_QUERY_TERMINAL_STATUSES = new Set(['succeeded', 'failed', 'cancelled']);
|
|
44
|
+
export const isDatasourceQueryTerminal = (status) => DATASOURCE_QUERY_TERMINAL_STATUSES.has(status);
|
|
45
|
+
const convertResponse = (value) => contentsToCamelCase(value);
|
|
46
|
+
const convertRequest = (value) => contentsToSnakeCase(value);
|
|
47
|
+
const datasourceUrl = (baseUrl, sourceUid, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources/${encodeURIComponent(sourceUid)}/datasource${suffix}`;
|
|
48
|
+
const queryUrl = (baseUrl, queryUid, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/queries/${encodeURIComponent(queryUid)}${suffix}`;
|
|
49
|
+
/** Does the database answer through this source, right now? A verdict, not a stack trace. */
|
|
50
|
+
export const testDatasource = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
51
|
+
url: datasourceUrl(baseUrl, sourceUid, '/test'),
|
|
52
|
+
method: 'POST',
|
|
53
|
+
token,
|
|
54
|
+
}));
|
|
55
|
+
/** The tables and columns the source exposes, as the service saw them. */
|
|
56
|
+
export const discoverDatasourceSchema = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
57
|
+
url: datasourceUrl(baseUrl, sourceUid, '/schema'),
|
|
58
|
+
method: 'GET',
|
|
59
|
+
token,
|
|
60
|
+
}));
|
|
61
|
+
/** What the source may be asked, and how the answer can travel. */
|
|
62
|
+
export const getDatasourceCapabilities = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
63
|
+
url: datasourceUrl(baseUrl, sourceUid, '/capabilities'),
|
|
64
|
+
method: 'GET',
|
|
65
|
+
token,
|
|
66
|
+
}));
|
|
67
|
+
/**
|
|
68
|
+
* Submit a statement; the answer is the job, not the rows.
|
|
69
|
+
*
|
|
70
|
+
* The service checks the statement against the source's operation allowlist
|
|
71
|
+
* and the limits against its policy before the job exists, so a refused
|
|
72
|
+
* query is refused here, with a reason, and not later on the stream.
|
|
73
|
+
*/
|
|
74
|
+
export const createDatasourceQuery = async (token, sourceUid, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
75
|
+
url: `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources/${encodeURIComponent(sourceUid)}/queries`,
|
|
76
|
+
method: 'POST',
|
|
77
|
+
token,
|
|
78
|
+
headers: { 'Idempotency-Key': idempotencyKey },
|
|
79
|
+
body: convertRequest(request),
|
|
80
|
+
}));
|
|
81
|
+
/** The queries run against a source, newest first: its history. */
|
|
82
|
+
export const listDatasourceQueries = async (token, sourceUid, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
|
|
83
|
+
const parameters = new URLSearchParams();
|
|
84
|
+
parameters.set('limit', String(options.limit ?? 50));
|
|
85
|
+
if (options.cursor) {
|
|
86
|
+
parameters.set('cursor', options.cursor);
|
|
87
|
+
}
|
|
88
|
+
return convertResponse(await requestDatalayerAPI({
|
|
89
|
+
url: `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources/${encodeURIComponent(sourceUid)}/queries?${parameters.toString()}`,
|
|
90
|
+
method: 'GET',
|
|
91
|
+
token,
|
|
92
|
+
}));
|
|
93
|
+
};
|
|
94
|
+
export const getDatasourceQuery = async (token, queryUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
95
|
+
url: queryUrl(baseUrl, queryUid),
|
|
96
|
+
method: 'GET',
|
|
97
|
+
token,
|
|
98
|
+
}));
|
|
99
|
+
/** Ask for the query to stop; the cancellation reaches the connector. */
|
|
100
|
+
export const cancelDatasourceQuery = async (token, queryUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
101
|
+
url: queryUrl(baseUrl, queryUid, '/cancel'),
|
|
102
|
+
method: 'POST',
|
|
103
|
+
token,
|
|
104
|
+
}));
|
|
105
|
+
/** Where a browser fetches a result from; a link, for a download. */
|
|
106
|
+
export const datasourceQueryResultsUrl = (queryUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => queryUrl(baseUrl, queryUid, '/results');
|
|
107
|
+
/**
|
|
108
|
+
* The result of a finished query, as Arrow IPC bytes, or a `Range` of them.
|
|
109
|
+
*
|
|
110
|
+
* A range is how a stream that broke halfway is resumed rather than
|
|
111
|
+
* restarted — and how a preview reads the first bytes of a large result
|
|
112
|
+
* without the rest.
|
|
113
|
+
*/
|
|
114
|
+
export const downloadDatasourceQueryResults = async (token, queryUid, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
|
|
115
|
+
const response = await requestDatalayerAPIWithResponse({
|
|
116
|
+
url: datasourceQueryResultsUrl(queryUid, baseUrl),
|
|
117
|
+
method: 'GET',
|
|
118
|
+
token,
|
|
119
|
+
headers: options.range ? { Range: options.range } : undefined,
|
|
120
|
+
responseType: 'arraybuffer',
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
body: response.data,
|
|
124
|
+
status: response.status,
|
|
125
|
+
headers: response.headers,
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Keep a result: written into a Dataset as a verified revision.
|
|
130
|
+
*
|
|
131
|
+
* The bytes go from the service into the Dataset; nothing is downloaded to
|
|
132
|
+
* be uploaded again, and the answer is the revision that now holds them.
|
|
133
|
+
*/
|
|
134
|
+
export const saveDatasourceQueryAsDataset = async (token, queryUid, request, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
135
|
+
url: queryUrl(baseUrl, queryUid, '/save'),
|
|
136
|
+
method: 'POST',
|
|
137
|
+
token,
|
|
138
|
+
body: convertRequest({
|
|
139
|
+
...request,
|
|
140
|
+
path: request.path.replace(/^\/+/, ''),
|
|
141
|
+
}),
|
|
142
|
+
}));
|
|
143
|
+
/** A Flight ticket for the result, for a client inside a sandbox. Never for the browser. */
|
|
144
|
+
export const createDatasourceQueryTicket = async (token, queryUid, request = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
|
|
145
|
+
url: queryUrl(baseUrl, queryUid, '/ticket'),
|
|
146
|
+
method: 'POST',
|
|
147
|
+
token,
|
|
148
|
+
body: convertRequest(request),
|
|
149
|
+
}));
|