@datalayer/core 1.1.66 → 1.2.12
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 +43 -20
- package/lib/api/constants.d.ts +1 -1
- package/lib/api/constants.js +1 -1
- package/lib/api/contents/attachments.js +3 -7
- package/lib/api/contents/datasets.d.ts +48 -0
- package/lib/api/contents/datasets.js +44 -7
- package/lib/api/contents/runtimeMounts.js +1 -1
- package/lib/api/contents/sandboxUid.d.ts +13 -45
- package/lib/api/contents/sandboxUid.js +14 -65
- 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/authentication.js +6 -4
- package/lib/api/iam/connectedAgents.d.ts +29 -0
- package/lib/api/iam/connectedAgents.js +35 -0
- package/lib/api/iam/healthz.js +2 -2
- package/lib/api/iam/identityProviders.d.ts +76 -0
- package/lib/api/iam/identityProviders.js +187 -0
- package/lib/api/iam/index.d.ts +1 -0
- package/lib/api/iam/index.js +1 -0
- package/lib/api/iam/mcpPolicy.d.ts +102 -1
- package/lib/api/iam/mcpPolicy.js +38 -2
- package/lib/api/iam/oauth2.js +18 -12
- 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 +10 -23
- package/lib/api/iam/trials.d.ts +38 -0
- package/lib/api/iam/trials.js +66 -0
- package/lib/api/index.d.ts +4 -0
- package/lib/api/index.js +4 -0
- package/lib/api/mcp/observability.d.ts +34 -11
- package/lib/api/mcp/observability.js +97 -59
- 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/strategies.js +1 -1
- package/lib/client/constants.d.ts +1 -0
- package/lib/client/constants.js +1 -0
- package/lib/client/mixins/IAMMixin.js +2 -2
- package/lib/components/animation/AnimatedText.d.ts +1 -44
- package/lib/components/animation/AnimatedText.js +6 -122
- 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/avatars/UserAvatar.d.ts +7 -1
- package/lib/components/avatars/UserAvatar.js +15 -1
- package/lib/components/billing/BillingEntitySelect.d.ts +6 -0
- package/lib/components/billing/BillingEntitySelect.js +49 -10
- 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 -0
- package/lib/components/checkout/StripeCheckout.d.ts +1 -1
- package/lib/components/checkout/StripeCheckout.js +1 -1
- package/lib/components/collaboration/LiveEditorCollaborators.d.ts +5 -0
- package/lib/components/collaboration/LiveEditorCollaborators.js +3 -1
- package/lib/components/display/DatalayerBox.d.ts +2 -3
- package/lib/components/display/DatalayerBox.js +1 -1
- package/lib/components/display/NavLink.js +3 -2
- package/lib/components/display/VisuallyHidden.d.ts +1 -2
- package/lib/components/labels/StatusLabels.d.ts +2 -10
- package/lib/components/labels/StatusLabels.js +2 -26
- package/lib/components/principal/PrincipalAppearance.d.ts +21 -42
- package/lib/components/principal/PrincipalAppearance.js +232 -174
- package/lib/components/principal/PrincipalAvatar.d.ts +8 -1
- package/lib/components/principal/PrincipalAvatar.js +2 -2
- package/lib/components/principal/PrincipalDetailsOverlay.d.ts +8 -1
- package/lib/components/principal/PrincipalDetailsOverlay.js +2 -2
- package/lib/components/screencapture/Screencapture.js +46 -3
- package/lib/components/sharing/ShareAccessComponent.d.ts +45 -4
- package/lib/components/sharing/ShareAccessComponent.js +110 -78
- package/lib/components/sharing/SharingEditor.d.ts +5 -1
- package/lib/components/sharing/SharingEditor.js +9 -4
- 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 +47 -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/config/Configuration.d.ts +4 -4
- package/lib/config/Configuration.js +7 -7
- package/lib/config/index.d.ts +1 -0
- package/lib/config/index.js +1 -0
- package/lib/config/planes.d.ts +45 -0
- package/lib/config/planes.js +53 -0
- package/lib/hooks/cacheConverters.d.ts +0 -7
- package/lib/hooks/cacheConverters.js +0 -25
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/useBackdrop.d.ts +4 -5
- package/lib/hooks/useBillingEntityStore.js +3 -0
- package/lib/hooks/useCache.d.ts +197 -44
- package/lib/hooks/useCache.js +1586 -494
- package/lib/hooks/useContents.d.ts +22 -1
- package/lib/hooks/useContents.js +90 -21
- package/lib/hooks/useMcp.d.ts +87 -1
- package/lib/hooks/useMcp.js +248 -13
- package/lib/hooks/useNavigate.d.ts +41 -3
- package/lib/hooks/useNavigate.js +116 -52
- package/lib/hooks/usePrincipalCacheStore.js +3 -0
- package/lib/hooks/usePrincipalStore.js +3 -0
- package/lib/hooks/useSpaceCacheStore.d.ts +50 -0
- package/lib/hooks/useSpaceCacheStore.js +85 -0
- package/lib/hooks/useWindowSize.js +1 -1
- package/lib/models/CreditsDTO.d.ts +6 -5
- package/lib/models/CreditsDTO.js +7 -5
- package/lib/models/IAMProvidersSpecs.d.ts +10 -5
- package/lib/models/IAMProvidersSpecs.js +0 -23
- package/lib/models/McpBinding.d.ts +6 -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 +34 -0
- package/lib/models/StartedBy.js +36 -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/UserSettings.d.ts +13 -0
- package/lib/models/UserSettings.js +9 -0
- package/lib/models/contents/__fixtures__/v1-contracts.json +158 -30
- package/lib/navigation/adapters/react-router.d.ts +1 -1
- package/lib/navigation/adapters/react-router.js +3 -0
- 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.js +3 -16
- package/lib/state/substates/IAMState.d.ts +3 -3
- package/lib/state/substates/IAMState.js +7 -0
- package/lib/state/substates/LayoutState.js +12 -0
- package/lib/state/substates/NavigationState.d.ts +82 -0
- package/lib/state/substates/NavigationState.js +255 -0
- package/lib/state/substates/ProfileState.d.ts +1 -0
- package/lib/state/substates/ProfileState.js +1 -0
- package/lib/state/substates/index.d.ts +1 -0
- package/lib/state/substates/index.js +1 -0
- package/lib/utils/Lazy.d.ts +20 -0
- package/lib/utils/Lazy.js +32 -6
- package/lib/utils/Screencapture.d.ts +15 -0
- package/lib/utils/Screencapture.js +26 -20
- package/lib/utils/WithSuspense.d.ts +11 -1
- package/lib/utils/WithSuspense.js +11 -1
- package/lib/views/mcp/AdmittedClients.d.ts +44 -0
- package/lib/views/mcp/AdmittedClients.js +59 -0
- package/lib/views/mcp/ApprovalQueue.d.ts +66 -0
- package/lib/views/mcp/ApprovalQueue.js +95 -0
- package/lib/views/mcp/ConnectedAgents.js +38 -3
- package/lib/views/mcp/EnterpriseConsole.d.ts +1 -1
- package/lib/views/mcp/EnterpriseConsole.js +23 -1
- package/lib/views/mcp/IdentityProviders.d.ts +33 -0
- package/lib/views/mcp/IdentityProviders.js +299 -0
- package/lib/views/mcp/McpDashboard.js +90 -7
- package/lib/views/mcp/McpHome.js +1 -1
- package/lib/views/mcp/McpObservability.d.ts +30 -1
- package/lib/views/mcp/McpObservability.js +105 -19
- package/lib/views/mcp/NotebookRuns.d.ts +39 -0
- package/lib/views/mcp/NotebookRuns.js +44 -0
- package/lib/views/mcp/OrganizationPolicy.js +2 -1
- package/lib/views/mcp/PersonalPolicy.js +2 -1
- package/lib/views/mcp/PolicyForm.d.ts +17 -1
- package/lib/views/mcp/PolicyForm.js +25 -3
- package/lib/views/mcp/PolicyHistory.d.ts +13 -0
- package/lib/views/mcp/PolicyHistory.js +14 -1
- 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/TeamPolicies.js +66 -5
- 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/index.d.ts +5 -0
- package/lib/views/mcp/index.js +5 -0
- package/lib/views/otel/simpleAuthStore.js +3 -0
- package/lib/views/secrets/SecretEdit.js +3 -2
- package/lib/views/secrets/SecretNew.js +5 -1
- package/package.json +271 -264
- package/scripts/generate-mcp-types.py +16 -10
- package/scripts/generate-orchestration-types.py +920 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/sponsors/datalayer)
|
|
4
4
|
|
|
5
|
-
# ☰
|
|
5
|
+
# ☰ 🌀 Datalayer Core
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<strong>Python and Typescript libraries for Datalayer</strong>
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
<a href="https://pypi.org/project/datalayer-core/"><img src="https://img.shields.io/pypi/pyversions/datalayer-core.svg" alt="Python versions"></img></a>
|
|
14
14
|
<a href="https://github.com/datalayer/core/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-BSD%203--Clause-blue.svg" alt="License"></img></a>
|
|
15
15
|
<a href="https://datalayer.ai/docs/"><img src="https://img.shields.io/badge/docs-datalayer.app-blue" alt="Documentation"></img></a>
|
|
16
|
-
<a href="https://github.com/datalayer/core/actions/workflows/py-tests.
|
|
16
|
+
<a href="https://github.com/datalayer/core/actions/workflows/py-tests.yaml"><img src="https://github.com/datalayer/core/actions/workflows/py-tests.yaml/badge.svg" alt="Units Tests"></img></a><a href="https://github.com/datalayer/core/actions/workflows/ts-tests.yaml"><img src="https://github.com/datalayer/core/actions/workflows/ts-tests.yaml/badge.svg" alt="Units Tests"></img></a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
19
|
## Overview
|
|
20
20
|
|
|
21
|
-
Datalayer Core is the foundational package that powers the [Datalayer AI Platform](https://datalayer.
|
|
21
|
+
Datalayer Core is the foundational package that powers the [Datalayer AI Platform](https://datalayer.app/). It provides a TypesScript and Python packages as a Command Line Interface (CLI) for AI engineers, data scientists, and researchers to seamlessly integrate scalable compute runtimes into their workflows.
|
|
22
22
|
|
|
23
23
|
This package serves as the base foundation used by many other Datalayer packages, containing core application classes, configuration, and unified APIs for authentication, runtime management, and code execution in cloud-based environments.
|
|
24
24
|
|
|
@@ -66,6 +66,8 @@ npm install
|
|
|
66
66
|
|
|
67
67
|
## Quick Start with Python
|
|
68
68
|
|
|
69
|
+
### 1. Authentication
|
|
70
|
+
|
|
69
71
|
Set your Datalayer token as an environment variable:
|
|
70
72
|
|
|
71
73
|
```bash
|
|
@@ -87,19 +89,31 @@ if client.authenticate():
|
|
|
87
89
|
print("Successfully authenticated!")
|
|
88
90
|
```
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
### 2. Runtime, Snapshots, and Evals
|
|
91
93
|
|
|
92
|
-
|
|
94
|
+
Runtime execution, snapshot workflows, and evals CLI are now documented and maintained in:
|
|
93
95
|
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
|
|
97
|
-
-
|
|
98
|
-
- **Resource Management**: Automatic cleanup and lifecycle management
|
|
96
|
+
- [agent-runtimes README](https://github.com/datalayer/agent-runtimes/blob/main/README.md)
|
|
97
|
+
- [agent-runtimes CLI docs](https://agent-runtimes.datalayer.tech/cli)
|
|
98
|
+
|
|
99
|
+
Use `agent-runtimes` for runtime workloads (`RuntimeClient`, `@datalayer`, snapshots, and evals), and use `datalayer-core` for account/platform operations (authentication, secrets, API keys, usage, profile).
|
|
99
100
|
|
|
100
101
|
## Examples
|
|
101
102
|
|
|
102
|
-
|
|
103
|
+
Examples have moved to Agent Runtimes:
|
|
104
|
+
|
|
105
|
+
- [Agent Runtimes examples README](https://github.com/datalayer/agent-runtimes/blob/main/examples/README.md)
|
|
106
|
+
- [Agent Runtimes examples directory](https://github.com/datalayer/agent-runtimes/tree/main/examples)
|
|
107
|
+
|
|
108
|
+
## Platform Integration
|
|
109
|
+
|
|
110
|
+
Datalayer adds AI capabilities and scalable compute runtimes to your development workflows. The platform is designed to seamlessly integrate into your existing processes and supercharge your computations with the processing power you need.
|
|
111
|
+
|
|
112
|
+
Key platform features accessible through this Client and CLI:
|
|
113
|
+
|
|
114
|
+
- **Remote Runtimes**: Execute code on powerful remote machines with CPU, RAM, and GPU resources
|
|
115
|
+
- **Multiple Interfaces**: Access and consume runtimes through Python Client, CLI, or other integrated tools
|
|
116
|
+
- **Scalable Compute**: Dynamically scale your computational resources based on workload requirements
|
|
103
117
|
|
|
104
118
|
## Documentation
|
|
105
119
|
|
|
@@ -179,6 +193,16 @@ This Client is designed to be simple and extensible. We welcome contributions! P
|
|
|
179
193
|
|
|
180
194
|
For issues and enhancement requests, please use the [GitHub issue tracker](https://github.com/datalayer/core/issues).
|
|
181
195
|
|
|
196
|
+
## Architecture
|
|
197
|
+
|
|
198
|
+
Datalayer Core serves as the foundation for the entire Datalayer ecosystem:
|
|
199
|
+
|
|
200
|
+
- **Base Classes**: Core application classes inherited by other Datalayer packages
|
|
201
|
+
- **Configuration Management**: Centralized configuration system for all Datalayer components
|
|
202
|
+
- **Authentication Layer**: Unified authentication across all Datalayer services
|
|
203
|
+
- **Runtime Abstraction**: Common interface for different types of compute runtimes
|
|
204
|
+
- **Resource Management**: Automatic cleanup and lifecycle management
|
|
205
|
+
|
|
182
206
|
## Use Cases
|
|
183
207
|
|
|
184
208
|
- **AI/ML Development**: Scale your machine learning workflows with cloud compute using Client or CLI
|
|
@@ -195,16 +219,15 @@ This project is licensed under the [BSD 3-Clause License](https://github.com/dat
|
|
|
195
219
|
|
|
196
220
|
- **Documentation**: [Datalayer Platform Documentation](https://datalayer.ai/docs/)
|
|
197
221
|
- **Issues**: [GitHub Issues](https://github.com/datalayer/core/issues)
|
|
198
|
-
- **Community**: [Datalayer Platform](https://datalayer.
|
|
222
|
+
- **Community**: [Datalayer Platform](https://datalayer.app/)
|
|
199
223
|
|
|
200
224
|
---
|
|
201
225
|
|
|
202
|
-
<
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
Made with ❤️ by [Datalayer](https://datalayer.ai)
|
|
207
|
-
|
|
208
|
-
<img src="https://assets.datalayer.tech/datalayer-25.svg" alt="Datalayer Logo" width="200"></img>
|
|
226
|
+
<p align="center">
|
|
227
|
+
<img src="https://assets.datalayer.tech/datalayer-25.svg" alt="Datalayer Logo" width="200"></img>
|
|
228
|
+
</p>
|
|
209
229
|
|
|
210
|
-
|
|
230
|
+
<p align="center">
|
|
231
|
+
<strong>🚀 AI Agents for Data Analysis</strong><br></br>
|
|
232
|
+
<a href="https://datalayer.app/">Get started with Datalayer today!</a>
|
|
233
|
+
</p>
|
package/lib/api/constants.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const API_BASE_PATHS: {
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const DEFAULT_SERVICE_URLS: {
|
|
18
18
|
/** Default URL for AI Agents (durable agent management) service */
|
|
19
|
-
readonly AI_AGENTS: "https://
|
|
19
|
+
readonly AI_AGENTS: "https://r1.datalayer.run";
|
|
20
20
|
/**
|
|
21
21
|
* Default URL for the Contents service.
|
|
22
22
|
*
|
package/lib/api/constants.js
CHANGED
|
@@ -20,7 +20,7 @@ export const API_BASE_PATHS = {
|
|
|
20
20
|
*/
|
|
21
21
|
export const DEFAULT_SERVICE_URLS = {
|
|
22
22
|
/** Default URL for AI Agents (durable agent management) service */
|
|
23
|
-
AI_AGENTS: 'https://
|
|
23
|
+
AI_AGENTS: 'https://r1.datalayer.run',
|
|
24
24
|
/**
|
|
25
25
|
* Default URL for the Contents service.
|
|
26
26
|
*
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { requestDatalayerAPI } from '../DatalayerApi.js';
|
|
6
6
|
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
|
|
7
|
-
import { contentsToCamelCase, contentsToSnakeCase } from '../../models/contents/index.js';
|
|
8
|
-
import { assertSandboxUid } from './sandboxUid.js';
|
|
7
|
+
import { contentsToCamelCase, contentsToSnakeCase, } from '../../models/contents/index.js';
|
|
9
8
|
const convert = (value) => contentsToCamelCase(value);
|
|
10
9
|
const url = (baseUrl, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/attachments${suffix}`;
|
|
11
10
|
export const createAttachment = async (token, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
@@ -18,7 +17,7 @@ export const createAttachment = async (token, request, idempotencyKey, baseUrl =
|
|
|
18
17
|
export const listAttachments = async (token, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
|
|
19
18
|
const parameters = new URLSearchParams();
|
|
20
19
|
if (options.sandboxUid)
|
|
21
|
-
parameters.set('sandbox_uid',
|
|
20
|
+
parameters.set('sandbox_uid', options.sandboxUid);
|
|
22
21
|
if (options.sourceUid)
|
|
23
22
|
parameters.set('source_uid', options.sourceUid);
|
|
24
23
|
parameters.set('active', String(options.active ?? false));
|
|
@@ -29,10 +28,7 @@ export const listAttachments = async (token, options = {}, baseUrl = DEFAULT_SER
|
|
|
29
28
|
}));
|
|
30
29
|
};
|
|
31
30
|
export const getAttachmentManifest = async (token, sandboxUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
32
|
-
|
|
33
|
-
// reply, so sending the wrong spelling produced a 500 the caller could
|
|
34
|
-
// not read; this fails where the caller can be seen.
|
|
35
|
-
url: url(baseUrl, `/manifest/${encodeURIComponent(assertSandboxUid(sandboxUid))}`),
|
|
31
|
+
url: url(baseUrl, `/manifest/${encodeURIComponent(sandboxUid)}`),
|
|
36
32
|
method: 'GET',
|
|
37
33
|
token,
|
|
38
34
|
}));
|
|
@@ -5,6 +5,25 @@ export declare const getDatasetRevision: (token: string, sourceUid: string, revi
|
|
|
5
5
|
export declare const createDatasetPublication: (token: string, sourceUid: string, request: DatasetPublicationCreate, idempotencyKey: string, baseUrl?: string) => Promise<DatasetPublication>;
|
|
6
6
|
export declare const listDatasetPublications: (token: string, sourceUid: string, baseUrl?: string) => Promise<DatasetPublicationList>;
|
|
7
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>;
|
|
8
27
|
/**
|
|
9
28
|
* Every Dataset currently published, across sources.
|
|
10
29
|
*
|
|
@@ -13,3 +32,32 @@ export declare const unpublishDataset: (token: string, sourceUid: string, public
|
|
|
13
32
|
* Any signed-in caller may read it — published means public.
|
|
14
33
|
*/
|
|
15
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>;
|
|
@@ -4,32 +4,56 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { requestDatalayerAPI } from '../DatalayerApi.js';
|
|
6
6
|
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
|
|
7
|
-
import { contentsToCamelCase, contentsToSnakeCase } from '../../models/contents/index.js';
|
|
7
|
+
import { contentsToCamelCase, contentsToSnakeCase, } from '../../models/contents/index.js';
|
|
8
8
|
const convert = (value) => contentsToCamelCase(value);
|
|
9
9
|
const resourceUrl = (baseUrl, sourceUid, resource, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources/${encodeURIComponent(sourceUid)}/${resource}${suffix}`;
|
|
10
10
|
export const createDatasetRevision = async (token, sourceUid, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
11
|
-
url: resourceUrl(baseUrl, sourceUid, 'revisions'),
|
|
11
|
+
url: resourceUrl(baseUrl, sourceUid, 'revisions'),
|
|
12
|
+
method: 'POST',
|
|
13
|
+
token,
|
|
12
14
|
headers: { 'Idempotency-Key': idempotencyKey },
|
|
13
15
|
body: contentsToSnakeCase(request),
|
|
14
16
|
}));
|
|
15
17
|
export const listDatasetRevisions = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
16
|
-
url: resourceUrl(baseUrl, sourceUid, 'revisions'),
|
|
18
|
+
url: resourceUrl(baseUrl, sourceUid, 'revisions'),
|
|
19
|
+
method: 'GET',
|
|
20
|
+
token,
|
|
17
21
|
}));
|
|
18
22
|
export const getDatasetRevision = async (token, sourceUid, revisionUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
19
23
|
url: resourceUrl(baseUrl, sourceUid, 'revisions', `/${encodeURIComponent(revisionUid)}`),
|
|
20
|
-
method: 'GET',
|
|
24
|
+
method: 'GET',
|
|
25
|
+
token,
|
|
21
26
|
}));
|
|
22
27
|
export const createDatasetPublication = async (token, sourceUid, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
23
|
-
url: resourceUrl(baseUrl, sourceUid, 'publications'),
|
|
28
|
+
url: resourceUrl(baseUrl, sourceUid, 'publications'),
|
|
29
|
+
method: 'POST',
|
|
30
|
+
token,
|
|
24
31
|
headers: { 'Idempotency-Key': idempotencyKey },
|
|
25
32
|
body: contentsToSnakeCase(request),
|
|
26
33
|
}));
|
|
27
34
|
export const listDatasetPublications = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
28
|
-
url: resourceUrl(baseUrl, sourceUid, 'publications'),
|
|
35
|
+
url: resourceUrl(baseUrl, sourceUid, 'publications'),
|
|
36
|
+
method: 'GET',
|
|
37
|
+
token,
|
|
29
38
|
}));
|
|
30
39
|
export const unpublishDataset = async (token, sourceUid, publicationUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
|
|
31
40
|
url: resourceUrl(baseUrl, sourceUid, 'publications', `/${encodeURIComponent(publicationUid)}`),
|
|
32
|
-
method: 'DELETE',
|
|
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 },
|
|
33
57
|
}));
|
|
34
58
|
/**
|
|
35
59
|
* Every Dataset currently published, across sources.
|
|
@@ -43,3 +67,16 @@ export const listPublishedDatasets = async (token, baseUrl = DEFAULT_SERVICE_URL
|
|
|
43
67
|
method: 'GET',
|
|
44
68
|
token,
|
|
45
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
|
+
}));
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* A Pod's volumes are fixed when it is created, so for most of a sandbox's
|
|
9
9
|
* life its mounts were decided before it existed. The mount gateway lifts
|
|
10
10
|
* that for the Home Folder: the platform binds a folder into a running pod
|
|
11
|
-
* and the sandbox sees it at `/home/
|
|
11
|
+
* and the sandbox sees it at `/home/datalayer/{handle}` within a second or two,
|
|
12
12
|
* with no restart.
|
|
13
13
|
*
|
|
14
14
|
* Not every Runtime can take one — a pod created before the gateway cannot,
|
|
@@ -1,53 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A sandbox is identified by its uid,
|
|
2
|
+
* A sandbox is identified by its uid, a ULID.
|
|
3
3
|
*
|
|
4
|
-
* A Datalayer runtime has
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* Passing the Pod name where a uid belongs used to *work* at the call site
|
|
10
|
-
* and fail far away: Contents validates `sandbox_uid` while building its
|
|
11
|
-
* reply, so a Pod name became an unhandled 500 that reached the browser as
|
|
12
|
-
* "Network Error", with nothing readable in it and nothing pointing at the
|
|
13
|
-
* caller. Throwing here names the caller in the stack instead.
|
|
4
|
+
* A Datalayer runtime has one name: its uid. The Pod is called by it, the
|
|
5
|
+
* `runtime_name` field and every `/runtimes/{uid}` route carry it, and
|
|
6
|
+
* Contents keys an attachment on it. There used to be a second spelling — a
|
|
7
|
+
* Pod name `runtime-<ulid>` — and every place the two met needed a
|
|
8
|
+
* converter; the converters went with the prefix.
|
|
14
9
|
*
|
|
15
10
|
* The server half of this is `datalayer_common.runtime_names`.
|
|
16
11
|
*/
|
|
17
|
-
/**
|
|
18
|
-
export declare const
|
|
19
|
-
/** Thrown when a Pod name is given where a sandbox uid is required. */
|
|
20
|
-
export declare class RuntimeNameNotAUid extends Error {
|
|
21
|
-
readonly value: string;
|
|
22
|
-
constructor(value: string);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Assert that a value is a sandbox uid, and return it.
|
|
26
|
-
*
|
|
27
|
-
* Use this wherever a `sandbox_uid` is sent. A non-Datalayer identifier —
|
|
28
|
-
* Daytona, E2B and Modal name their own sandboxes — passes through: there is
|
|
29
|
-
* no ULID to check it against, and inventing one would be worse.
|
|
30
|
-
*/
|
|
31
|
-
export declare function assertSandboxUid(value: string): string;
|
|
32
|
-
/**
|
|
33
|
-
* The Pod name for a sandbox uid, converting on purpose.
|
|
34
|
-
*
|
|
35
|
-
* The mirror of {@link sandboxUidFromRuntimeName}, and the direction that was
|
|
36
|
-
* missing: route parameters and `runtime_name` fields carry the **Pod name**,
|
|
37
|
-
* so anything addressing `/runtimes/{name}/…` needs one. Without this, a
|
|
38
|
-
* caller holding only a uid either wrote the prefix itself or — the version
|
|
39
|
-
* that was here — passed the uid and hoped, which is a `404` from a route
|
|
40
|
-
* whose parameter looked plausible.
|
|
41
|
-
*
|
|
42
|
-
* Idempotent, like the server's `runtime_name()`: a name that has been
|
|
43
|
-
* through here stays one name rather than growing a second prefix.
|
|
44
|
-
*/
|
|
45
|
-
export declare function runtimeNameFromSandboxUid(value: string): string;
|
|
12
|
+
/** Crockford base32, 26 characters — a ULID, in either case. */
|
|
13
|
+
export declare const SANDBOX_UID_PATTERN: RegExp;
|
|
46
14
|
/**
|
|
47
|
-
*
|
|
15
|
+
* Whether a value is a sandbox uid.
|
|
48
16
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* uid
|
|
17
|
+
* What tells a runtime apart from anything else that can stand in a route:
|
|
18
|
+
* an agentspec id, a word the listing itself addresses. A sandbox at an
|
|
19
|
+
* external provider is named `external-<provider>-<uid>` and is not one.
|
|
52
20
|
*/
|
|
53
|
-
export declare function
|
|
21
|
+
export declare function isSandboxUid(value: string | undefined | null): boolean;
|
|
@@ -3,76 +3,25 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* A sandbox is identified by its uid,
|
|
6
|
+
* A sandbox is identified by its uid, a ULID.
|
|
7
7
|
*
|
|
8
|
-
* A Datalayer runtime has
|
|
9
|
-
* `
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Passing the Pod name where a uid belongs used to *work* at the call site
|
|
14
|
-
* and fail far away: Contents validates `sandbox_uid` while building its
|
|
15
|
-
* reply, so a Pod name became an unhandled 500 that reached the browser as
|
|
16
|
-
* "Network Error", with nothing readable in it and nothing pointing at the
|
|
17
|
-
* caller. Throwing here names the caller in the stack instead.
|
|
8
|
+
* A Datalayer runtime has one name: its uid. The Pod is called by it, the
|
|
9
|
+
* `runtime_name` field and every `/runtimes/{uid}` route carry it, and
|
|
10
|
+
* Contents keys an attachment on it. There used to be a second spelling — a
|
|
11
|
+
* Pod name `runtime-<ulid>` — and every place the two met needed a
|
|
12
|
+
* converter; the converters went with the prefix.
|
|
18
13
|
*
|
|
19
14
|
* The server half of this is `datalayer_common.runtime_names`.
|
|
20
15
|
*/
|
|
21
|
-
/**
|
|
22
|
-
export const
|
|
23
|
-
/** Thrown when a Pod name is given where a sandbox uid is required. */
|
|
24
|
-
export class RuntimeNameNotAUid extends Error {
|
|
25
|
-
value;
|
|
26
|
-
constructor(value) {
|
|
27
|
-
super(`'${value}' is a runtime Pod name, not a sandbox uid. A sandbox is ` +
|
|
28
|
-
`identified by its ULID ('${value.slice(RUNTIME_NAME_PREFIX.length)}'). ` +
|
|
29
|
-
'If all you hold is the Pod name, convert it deliberately with ' +
|
|
30
|
-
'sandboxUidFromRuntimeName().');
|
|
31
|
-
this.name = 'RuntimeNameNotAUid';
|
|
32
|
-
this.value = value;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Assert that a value is a sandbox uid, and return it.
|
|
37
|
-
*
|
|
38
|
-
* Use this wherever a `sandbox_uid` is sent. A non-Datalayer identifier —
|
|
39
|
-
* Daytona, E2B and Modal name their own sandboxes — passes through: there is
|
|
40
|
-
* no ULID to check it against, and inventing one would be worse.
|
|
41
|
-
*/
|
|
42
|
-
export function assertSandboxUid(value) {
|
|
43
|
-
if (value.startsWith(RUNTIME_NAME_PREFIX)) {
|
|
44
|
-
throw new RuntimeNameNotAUid(value);
|
|
45
|
-
}
|
|
46
|
-
return value;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* The Pod name for a sandbox uid, converting on purpose.
|
|
50
|
-
*
|
|
51
|
-
* The mirror of {@link sandboxUidFromRuntimeName}, and the direction that was
|
|
52
|
-
* missing: route parameters and `runtime_name` fields carry the **Pod name**,
|
|
53
|
-
* so anything addressing `/runtimes/{name}/…` needs one. Without this, a
|
|
54
|
-
* caller holding only a uid either wrote the prefix itself or — the version
|
|
55
|
-
* that was here — passed the uid and hoped, which is a `404` from a route
|
|
56
|
-
* whose parameter looked plausible.
|
|
57
|
-
*
|
|
58
|
-
* Idempotent, like the server's `runtime_name()`: a name that has been
|
|
59
|
-
* through here stays one name rather than growing a second prefix.
|
|
60
|
-
*/
|
|
61
|
-
export function runtimeNameFromSandboxUid(value) {
|
|
62
|
-
if (!value || value.startsWith(RUNTIME_NAME_PREFIX)) {
|
|
63
|
-
return value;
|
|
64
|
-
}
|
|
65
|
-
return `${RUNTIME_NAME_PREFIX}${value}`;
|
|
66
|
-
}
|
|
16
|
+
/** Crockford base32, 26 characters — a ULID, in either case. */
|
|
17
|
+
export const SANDBOX_UID_PATTERN = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
67
18
|
/**
|
|
68
|
-
*
|
|
19
|
+
* Whether a value is a sandbox uid.
|
|
69
20
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* uid
|
|
21
|
+
* What tells a runtime apart from anything else that can stand in a route:
|
|
22
|
+
* an agentspec id, a word the listing itself addresses. A sandbox at an
|
|
23
|
+
* external provider is named `external-<provider>-<uid>` and is not one.
|
|
73
24
|
*/
|
|
74
|
-
export function
|
|
75
|
-
return value.
|
|
76
|
-
? value.slice(RUNTIME_NAME_PREFIX.length)
|
|
77
|
-
: value;
|
|
25
|
+
export function isSandboxUid(value) {
|
|
26
|
+
return !!value && SANDBOX_UID_PATTERN.test(value);
|
|
78
27
|
}
|