@datalayer/core 0.0.9 → 0.0.11
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/lib/__tests__/shared/cleanup-shared.d.ts +4 -0
- package/lib/__tests__/shared/cleanup-shared.js +228 -0
- package/lib/__tests__/shared/test-config.d.ts +51 -0
- package/lib/__tests__/shared/test-config.js +110 -0
- package/lib/__tests__/shared/test-constants.d.ts +66 -0
- package/lib/__tests__/shared/test-constants.js +79 -0
- package/lib/api/DatalayerApi.d.ts +1 -1
- package/lib/api/DatalayerApi.js +73 -42
- package/lib/api/__tests__/iam.authentication.integration.test.d.ts +1 -0
- package/lib/api/__tests__/iam.authentication.integration.test.js +247 -0
- package/lib/api/__tests__/iam.healthz.integration.test.d.ts +1 -0
- package/lib/api/__tests__/iam.healthz.integration.test.js +63 -0
- package/lib/api/__tests__/iam.profile.integration.test.d.ts +1 -0
- package/lib/api/__tests__/iam.profile.integration.test.js +252 -0
- package/lib/api/__tests__/runtimes.environments.integration.test.d.ts +1 -0
- package/lib/api/__tests__/runtimes.environments.integration.test.js +122 -0
- package/lib/api/__tests__/runtimes.healthz.integration.test.d.ts +1 -0
- package/lib/api/__tests__/runtimes.healthz.integration.test.js +50 -0
- package/lib/api/__tests__/runtimes.integration.test.d.ts +1 -0
- package/lib/api/__tests__/runtimes.integration.test.js +369 -0
- package/lib/api/__tests__/spacer.healthz.integration.test.d.ts +1 -0
- package/lib/api/__tests__/spacer.healthz.integration.test.js +50 -0
- package/lib/api/__tests__/spacer.integration.test.d.ts +1 -0
- package/lib/api/__tests__/spacer.integration.test.js +519 -0
- package/lib/api/constants.d.ts +19 -0
- package/lib/api/constants.js +23 -0
- package/lib/api/iam/__tests__/authentication.unit.test.d.ts +1 -0
- package/lib/api/iam/__tests__/authentication.unit.test.js +63 -0
- package/lib/api/iam/__tests__/healthz.unit.test.d.ts +1 -0
- package/lib/api/iam/__tests__/healthz.unit.test.js +60 -0
- package/lib/api/iam/__tests__/profile.unit.test.d.ts +1 -0
- package/lib/api/iam/__tests__/profile.unit.test.js +57 -0
- package/lib/api/iam/authentication.d.ts +40 -0
- package/lib/api/iam/authentication.js +128 -0
- package/lib/api/iam/healthz.d.ts +15 -0
- package/lib/api/iam/healthz.js +43 -0
- package/lib/api/iam/index.d.ts +12 -0
- package/lib/api/iam/index.js +17 -0
- package/lib/api/iam/profile.d.ts +15 -0
- package/lib/api/iam/profile.js +41 -0
- package/lib/api/index.d.ts +20 -3
- package/lib/api/index.js +22 -3
- package/lib/api/runtimes/__tests__/environments.unit.test.d.ts +1 -0
- package/lib/api/runtimes/__tests__/environments.unit.test.js +77 -0
- package/lib/api/runtimes/__tests__/healthz.unit.test.d.ts +1 -0
- package/lib/api/runtimes/__tests__/healthz.unit.test.js +57 -0
- package/lib/api/runtimes/__tests__/runtimes.unit.test.d.ts +1 -0
- package/lib/api/runtimes/__tests__/runtimes.unit.test.js +139 -0
- package/lib/api/runtimes/__tests__/snapshots.unit.test.d.ts +1 -0
- package/lib/api/runtimes/__tests__/snapshots.unit.test.js +96 -0
- package/lib/api/runtimes/environments.d.ts +9 -0
- package/lib/api/runtimes/environments.js +28 -0
- package/lib/api/runtimes/healthz.d.ts +25 -0
- package/lib/api/runtimes/healthz.js +43 -0
- package/lib/api/runtimes/index.d.ts +10 -5
- package/lib/api/runtimes/index.js +10 -5
- package/lib/api/runtimes/runtimes.d.ts +54 -0
- package/lib/api/runtimes/runtimes.js +169 -0
- package/lib/api/runtimes/snapshots.d.ts +34 -21
- package/lib/api/runtimes/snapshots.js +69 -138
- package/lib/api/spacer/__tests__/healthz.unit.test.d.ts +1 -0
- package/lib/api/spacer/__tests__/healthz.unit.test.js +57 -0
- package/lib/api/spacer/__tests__/items.unit.test.d.ts +1 -0
- package/lib/api/spacer/__tests__/items.unit.test.js +165 -0
- package/lib/api/spacer/__tests__/lexicals.unit.test.d.ts +1 -0
- package/lib/api/spacer/__tests__/lexicals.unit.test.js +323 -0
- package/lib/api/spacer/__tests__/notebooks.unit.test.d.ts +1 -0
- package/lib/api/spacer/__tests__/notebooks.unit.test.js +224 -0
- package/lib/api/spacer/__tests__/users.unit.test.d.ts +1 -0
- package/lib/api/spacer/__tests__/users.unit.test.js +132 -0
- package/lib/api/spacer/healthz.d.ts +25 -0
- package/lib/api/spacer/healthz.js +43 -0
- package/lib/api/spacer/index.d.ts +13 -0
- package/lib/api/spacer/index.js +17 -0
- package/lib/api/spacer/items.d.ts +17 -0
- package/lib/api/spacer/items.js +40 -0
- package/lib/api/spacer/lexicals.d.ts +26 -0
- package/lib/api/spacer/lexicals.js +74 -0
- package/lib/api/spacer/notebooks.d.ts +26 -0
- package/lib/api/spacer/notebooks.js +74 -0
- package/lib/api/spacer/spaces.d.ts +9 -0
- package/lib/api/spacer/spaces.js +29 -0
- package/lib/api/spacer/users.d.ts +9 -0
- package/lib/api/spacer/users.js +28 -0
- package/lib/api/types/iam.d.ts +180 -0
- package/lib/api/types/index.d.ts +32 -0
- package/lib/api/types/index.js +36 -0
- package/lib/api/types/runtimes.d.ts +235 -0
- package/lib/api/types/runtimes.js +5 -0
- package/lib/api/types/spacer.d.ts +271 -0
- package/lib/api/types/spacer.js +5 -0
- package/lib/api/utils/__tests__/validation.test.d.ts +1 -0
- package/lib/api/utils/__tests__/validation.test.js +109 -0
- package/lib/api/utils/validation.d.ts +24 -0
- package/lib/api/utils/validation.js +133 -0
- package/lib/components/display/JupyterDialog.js +4 -8
- package/lib/components/progress/CreditsIndicator.d.ts +1 -1
- package/lib/components/runtimes/RuntimeCellVariablesDialog.js +2 -2
- package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +1 -1
- package/lib/components/runtimes/RuntimeLauncherDialog.js +5 -2
- package/lib/components/runtimes/RuntimePickerBase.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerBase.js +1 -1
- package/lib/components/runtimes/RuntimePickerCell.js +2 -1
- package/lib/components/runtimes/RuntimePickerNotebook.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerNotebook.js +1 -1
- package/lib/components/runtimes/RuntimeSimplePicker.js +2 -1
- package/lib/components/runtimes/RuntimeTransfer.d.ts +1 -1
- package/lib/components/runtimes/RuntimeUtils.d.ts +1 -1
- package/lib/components/snapshots/RuntimeSnapshotMenu.d.ts +1 -1
- package/lib/components/snapshots/RuntimeSnapshotMenu.js +2 -2
- package/lib/components/snippets/SnippetDialog.js +1 -1
- package/lib/components/storage/ContentsBrowser.js +2 -2
- package/lib/components/tables/DataTable.js +2 -1
- package/lib/hooks/useDatalayer.d.ts +1 -1
- package/lib/hooks/useDatalayer.js +1 -1
- package/lib/hooks/useIAM.js +1 -1
- package/lib/hooks/useRuntimes.js +1 -1
- package/lib/index.d.ts +9 -0
- package/lib/index.js +10 -0
- package/lib/sdk/client/__tests__/sdk.health.integration.test.d.ts +1 -0
- package/lib/sdk/client/__tests__/sdk.health.integration.test.js +110 -0
- package/lib/sdk/client/__tests__/sdk.iam.integration.test.d.ts +1 -0
- package/lib/sdk/client/__tests__/sdk.iam.integration.test.js +179 -0
- package/lib/sdk/client/__tests__/sdk.models.integration.test.d.ts +1 -0
- package/lib/sdk/client/__tests__/sdk.models.integration.test.js +376 -0
- package/lib/sdk/client/__tests__/sdk.runtimes.integration.test.d.ts +1 -0
- package/lib/sdk/client/__tests__/sdk.runtimes.integration.test.js +276 -0
- package/lib/sdk/client/__tests__/sdk.spacer.integration.test.d.ts +1 -0
- package/lib/sdk/client/__tests__/sdk.spacer.integration.test.js +361 -0
- package/lib/sdk/client/base.d.ts +88 -0
- package/lib/sdk/client/base.js +112 -0
- package/lib/sdk/client/index.d.ts +192 -0
- package/lib/sdk/client/index.js +128 -0
- package/lib/sdk/client/mixins/HealthMixin.d.ts +100 -0
- package/lib/sdk/client/mixins/HealthMixin.js +133 -0
- package/lib/sdk/client/mixins/IAMMixin.d.ts +59 -0
- package/lib/sdk/client/mixins/IAMMixin.js +83 -0
- package/lib/sdk/client/mixins/RuntimesMixin.d.ts +134 -0
- package/lib/sdk/client/mixins/RuntimesMixin.js +221 -0
- package/lib/sdk/client/mixins/SpacerMixin.d.ts +184 -0
- package/lib/sdk/client/mixins/SpacerMixin.js +278 -0
- package/lib/sdk/client/models/Lexical.d.ts +156 -0
- package/lib/sdk/client/models/Lexical.js +275 -0
- package/lib/sdk/client/models/Notebook.d.ts +174 -0
- package/lib/sdk/client/models/Notebook.js +311 -0
- package/lib/sdk/client/models/Runtime.d.ts +221 -0
- package/lib/sdk/client/models/Runtime.js +341 -0
- package/lib/sdk/client/models/Snapshot.d.ts +156 -0
- package/lib/sdk/client/models/Snapshot.js +244 -0
- package/lib/sdk/client/models/Space.d.ts +182 -0
- package/lib/sdk/client/models/Space.js +276 -0
- package/lib/sdk/client/models/__tests__/Lexical.test.d.ts +1 -0
- package/lib/sdk/client/models/__tests__/Lexical.test.js +288 -0
- package/lib/sdk/client/models/__tests__/Notebook.test.d.ts +1 -0
- package/lib/sdk/client/models/__tests__/Notebook.test.js +206 -0
- package/lib/sdk/client/models/__tests__/Runtime.test.d.ts +1 -0
- package/lib/sdk/client/models/__tests__/Runtime.test.js +133 -0
- package/lib/sdk/client/models/__tests__/Snapshot.test.d.ts +1 -0
- package/lib/sdk/client/models/__tests__/Snapshot.test.js +244 -0
- package/lib/sdk/client/models/__tests__/Space.test.d.ts +1 -0
- package/lib/sdk/client/models/__tests__/Space.test.js +334 -0
- package/lib/sdk/client/models/index.d.ts +30 -0
- package/lib/sdk/client/models/index.js +30 -0
- package/lib/sdk/client/utils/mixins.d.ts +42 -0
- package/lib/sdk/client/utils/mixins.js +47 -0
- package/lib/sdk/index.d.ts +26 -0
- package/lib/sdk/index.js +32 -0
- package/lib/sdk/stateful/index.d.ts +3 -0
- package/lib/sdk/stateful/index.js +7 -0
- package/lib/{api → sdk/stateful}/runtimes/actions.d.ts +1 -1
- package/lib/{api → sdk/stateful}/runtimes/actions.js +3 -3
- package/lib/{api → sdk/stateful}/runtimes/apis.d.ts +1 -1
- package/lib/sdk/stateful/runtimes/apis.js +5 -0
- package/lib/sdk/stateful/runtimes/index.d.ts +5 -0
- package/lib/sdk/stateful/runtimes/index.js +9 -0
- package/lib/sdk/stateful/runtimes/snapshots.d.ts +25 -0
- package/lib/sdk/stateful/runtimes/snapshots.js +150 -0
- package/lib/services/DatalayerServiceManager.js +1 -1
- package/lib/state/substates/IAMState.js +1 -1
- package/lib/state/substates/RuntimesState.d.ts +1 -1
- package/lib/state/substates/RuntimesState.js +1 -1
- package/lib/state/substates/SurveysState.js +1 -1
- package/lib/test-setup.js +1 -0
- package/package.json +19 -9
- /package/lib/api/{runtimes/apis.js → types/iam.js} +0 -0
- /package/lib/{api → sdk/stateful}/jupyter/exec/Python.d.ts +0 -0
- /package/lib/{api → sdk/stateful}/jupyter/exec/Python.js +0 -0
- /package/lib/{api → sdk/stateful}/jupyter/exec/Snippets.d.ts +0 -0
- /package/lib/{api → sdk/stateful}/jupyter/exec/Snippets.js +0 -0
- /package/lib/{api → sdk/stateful}/jupyter/exec/index.d.ts +0 -0
- /package/lib/{api → sdk/stateful}/jupyter/exec/index.js +0 -0
- /package/lib/{api → sdk/stateful}/jupyter/index.d.ts +0 -0
- /package/lib/{api → sdk/stateful}/jupyter/index.js +0 -0
- /package/lib/{api → sdk/stateful}/jupyter/kernelsHandler.d.ts +0 -0
- /package/lib/{api → sdk/stateful}/jupyter/kernelsHandler.js +0 -0
- /package/lib/{api → sdk/stateful}/runtimes/settings.d.ts +0 -0
- /package/lib/{api → sdk/stateful}/runtimes/settings.js +0 -0
- /package/lib/{api → sdk/stateful}/runtimes/utils.d.ts +0 -0
- /package/lib/{api → sdk/stateful}/runtimes/utils.js +0 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a user in the Datalayer platform
|
|
3
|
+
* @interface User
|
|
4
|
+
*/
|
|
5
|
+
export interface User {
|
|
6
|
+
/** Unique identifier for the user */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Alternative unique identifier (UUID format) */
|
|
9
|
+
uid?: string;
|
|
10
|
+
/** User ID in the authentication system */
|
|
11
|
+
user_id?: string;
|
|
12
|
+
/** Username for login */
|
|
13
|
+
username?: string;
|
|
14
|
+
/** User's handle or nickname */
|
|
15
|
+
handle?: string;
|
|
16
|
+
/** User's email address */
|
|
17
|
+
email: string;
|
|
18
|
+
/** User's first name */
|
|
19
|
+
first_name?: string;
|
|
20
|
+
/** User's last name */
|
|
21
|
+
last_name?: string;
|
|
22
|
+
/** Display name shown in the UI */
|
|
23
|
+
display_name?: string;
|
|
24
|
+
/** URL to the user's avatar image */
|
|
25
|
+
avatar_url?: string;
|
|
26
|
+
/** Alternative property name for avatar URL (for backwards compatibility) */
|
|
27
|
+
avatarUrl?: string;
|
|
28
|
+
/** ISO 8601 timestamp of when the user was created */
|
|
29
|
+
created_at?: string;
|
|
30
|
+
/** ISO 8601 timestamp of when the user was last updated */
|
|
31
|
+
updated_at?: string;
|
|
32
|
+
/** Whether the user account is active */
|
|
33
|
+
is_active?: boolean;
|
|
34
|
+
/** Whether the user's email has been verified */
|
|
35
|
+
is_verified?: boolean;
|
|
36
|
+
/** Whether multi-factor authentication is enabled */
|
|
37
|
+
mfa_enabled?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Request payload for user login
|
|
41
|
+
* @interface LoginRequest
|
|
42
|
+
*
|
|
43
|
+
* Must provide either:
|
|
44
|
+
* - handle + password for credential-based authentication
|
|
45
|
+
* - token for token-based authentication
|
|
46
|
+
*
|
|
47
|
+
* Both methods cannot be used simultaneously.
|
|
48
|
+
*/
|
|
49
|
+
export interface LoginRequest {
|
|
50
|
+
/** User handle (username/email) for credential-based authentication */
|
|
51
|
+
handle?: string;
|
|
52
|
+
/** User's password for credential-based authentication */
|
|
53
|
+
password?: string;
|
|
54
|
+
/** Authentication token for token-based authentication */
|
|
55
|
+
token?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Response from a successful login request
|
|
59
|
+
* @interface LoginResponse
|
|
60
|
+
*/
|
|
61
|
+
export interface LoginResponse {
|
|
62
|
+
/** Whether the request was successful */
|
|
63
|
+
success: boolean;
|
|
64
|
+
/** Response message from the server */
|
|
65
|
+
message: string;
|
|
66
|
+
/** User information for the authenticated user */
|
|
67
|
+
user: {
|
|
68
|
+
/** ISO 8601 timestamp of when the user was created */
|
|
69
|
+
creation_ts_dt: string;
|
|
70
|
+
/** Unique identifier for the user */
|
|
71
|
+
id: string;
|
|
72
|
+
/** ISO 8601 timestamp of when the user requested to join */
|
|
73
|
+
join_request_ts_dt: string;
|
|
74
|
+
/** ISO 8601 timestamp of when the user joined */
|
|
75
|
+
join_ts_dt: string;
|
|
76
|
+
/** ISO 8601 timestamp of when the user was last updated */
|
|
77
|
+
last_update_ts_dt: string;
|
|
78
|
+
/** Origin of the user account */
|
|
79
|
+
origin_s: string;
|
|
80
|
+
/** Type of the entity */
|
|
81
|
+
type_s: string;
|
|
82
|
+
/** Alternative unique identifier (UUID format) */
|
|
83
|
+
uid: string;
|
|
84
|
+
/** User's email address */
|
|
85
|
+
email_s: string;
|
|
86
|
+
/** User's first name */
|
|
87
|
+
first_name_t: string;
|
|
88
|
+
/** User's handle or identifier */
|
|
89
|
+
handle_s: string;
|
|
90
|
+
/** User's last name */
|
|
91
|
+
last_name_t: string;
|
|
92
|
+
/** Additional fields that may be present in the response */
|
|
93
|
+
[key: string]: any;
|
|
94
|
+
};
|
|
95
|
+
/** JWT token for API authentication */
|
|
96
|
+
token: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Response from the /me endpoint containing current user information
|
|
100
|
+
* @interface UserMeResponse
|
|
101
|
+
*/
|
|
102
|
+
export interface UserMeResponse {
|
|
103
|
+
/** Whether the request was successful */
|
|
104
|
+
success: boolean;
|
|
105
|
+
/** Response message from the server */
|
|
106
|
+
message: string;
|
|
107
|
+
/** Current user's profile information */
|
|
108
|
+
me: {
|
|
109
|
+
/** Unique identifier (full ID) for the user */
|
|
110
|
+
id: string;
|
|
111
|
+
/** Unique identifier (UID) for the user */
|
|
112
|
+
uid: string;
|
|
113
|
+
/** User handle (username) */
|
|
114
|
+
handle: string;
|
|
115
|
+
/** Email address of the user */
|
|
116
|
+
email: string;
|
|
117
|
+
/** First name of the user */
|
|
118
|
+
firstName: string;
|
|
119
|
+
/** Last name of the user */
|
|
120
|
+
lastName: string;
|
|
121
|
+
/** Avatar URL for the user */
|
|
122
|
+
avatarUrl: string;
|
|
123
|
+
/** Array of roles assigned to the user */
|
|
124
|
+
roles: string[];
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Response from the /whoami endpoint
|
|
129
|
+
* @interface WhoAmIResponse
|
|
130
|
+
*/
|
|
131
|
+
export interface WhoAmIResponse {
|
|
132
|
+
/** Whether the request was successful */
|
|
133
|
+
success: boolean;
|
|
134
|
+
/** Response message from the server */
|
|
135
|
+
message: string;
|
|
136
|
+
/** User profile information */
|
|
137
|
+
profile: {
|
|
138
|
+
/** ISO 8601 timestamp of when the user was created */
|
|
139
|
+
creation_ts_dt: string;
|
|
140
|
+
/** Unique identifier for the user */
|
|
141
|
+
id: string;
|
|
142
|
+
/** ISO 8601 timestamp of when the user requested to join */
|
|
143
|
+
join_request_ts_dt: string | null;
|
|
144
|
+
/** ISO 8601 timestamp of when the user joined */
|
|
145
|
+
join_ts_dt: string;
|
|
146
|
+
/** ISO 8601 timestamp of last update */
|
|
147
|
+
last_update_ts_dt: string;
|
|
148
|
+
/** Origin of the user account */
|
|
149
|
+
origin_s: string;
|
|
150
|
+
/** Type of the record */
|
|
151
|
+
type_s: string;
|
|
152
|
+
/** User ID */
|
|
153
|
+
uid: string;
|
|
154
|
+
/** Email address */
|
|
155
|
+
email_s: string;
|
|
156
|
+
/** First name */
|
|
157
|
+
first_name_t: string;
|
|
158
|
+
/** User handle */
|
|
159
|
+
handle_s: string;
|
|
160
|
+
/** Last name */
|
|
161
|
+
last_name_t: string;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Response from the health check ping endpoint
|
|
166
|
+
* @interface HealthzPingResponse
|
|
167
|
+
*/
|
|
168
|
+
export interface HealthzPingResponse {
|
|
169
|
+
/** Whether the request was successful */
|
|
170
|
+
success: boolean;
|
|
171
|
+
/** Response message from the server */
|
|
172
|
+
message: string;
|
|
173
|
+
/** Service status information */
|
|
174
|
+
status: {
|
|
175
|
+
/** Status indicator (e.g., "OK") */
|
|
176
|
+
status: string;
|
|
177
|
+
};
|
|
178
|
+
/** API version */
|
|
179
|
+
version: string;
|
|
180
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module types
|
|
3
|
+
* @description TypeScript type definitions for all Datalayer API services.
|
|
4
|
+
*
|
|
5
|
+
* This module consolidates all type definitions used by the SDK, providing
|
|
6
|
+
* comprehensive TypeScript support for requests, responses, and data models
|
|
7
|
+
* across all Datalayer services.
|
|
8
|
+
*
|
|
9
|
+
* These types follow the exact backend API format (snake_case naming) to
|
|
10
|
+
* ensure compatibility. For frontend business logic types with camelCase
|
|
11
|
+
* naming, see the models in `/src/models/`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import type {
|
|
16
|
+
* Runtime,
|
|
17
|
+
* Environment,
|
|
18
|
+
* Space,
|
|
19
|
+
* Notebook,
|
|
20
|
+
* User,
|
|
21
|
+
* LoginRequest
|
|
22
|
+
* } from '@datalayer/core/api/types';
|
|
23
|
+
*
|
|
24
|
+
* // Use types for function parameters and return values
|
|
25
|
+
* function createRuntime(config: CreateRuntimeRequest): Promise<Runtime> {
|
|
26
|
+
* // Implementation
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export * from './runtimes';
|
|
31
|
+
export * from './iam';
|
|
32
|
+
export * from './spacer';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module types
|
|
7
|
+
* @description TypeScript type definitions for all Datalayer API services.
|
|
8
|
+
*
|
|
9
|
+
* This module consolidates all type definitions used by the SDK, providing
|
|
10
|
+
* comprehensive TypeScript support for requests, responses, and data models
|
|
11
|
+
* across all Datalayer services.
|
|
12
|
+
*
|
|
13
|
+
* These types follow the exact backend API format (snake_case naming) to
|
|
14
|
+
* ensure compatibility. For frontend business logic types with camelCase
|
|
15
|
+
* naming, see the models in `/src/models/`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import type {
|
|
20
|
+
* Runtime,
|
|
21
|
+
* Environment,
|
|
22
|
+
* Space,
|
|
23
|
+
* Notebook,
|
|
24
|
+
* User,
|
|
25
|
+
* LoginRequest
|
|
26
|
+
* } from '@datalayer/core/api/types';
|
|
27
|
+
*
|
|
28
|
+
* // Use types for function parameters and return values
|
|
29
|
+
* function createRuntime(config: CreateRuntimeRequest): Promise<Runtime> {
|
|
30
|
+
* // Implementation
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export * from './runtimes';
|
|
35
|
+
export * from './iam';
|
|
36
|
+
export * from './spacer';
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a computing environment available in the Datalayer platform
|
|
3
|
+
* @interface Environment
|
|
4
|
+
*/
|
|
5
|
+
export interface Environment {
|
|
6
|
+
/** Human-readable title for the environment */
|
|
7
|
+
title: string;
|
|
8
|
+
/** Detailed description of the environment */
|
|
9
|
+
description: string;
|
|
10
|
+
/** Docker image used for this environment */
|
|
11
|
+
dockerImage: string;
|
|
12
|
+
/** Example usage or description */
|
|
13
|
+
example?: string;
|
|
14
|
+
/** Code snippets for this environment */
|
|
15
|
+
snippets?: any[];
|
|
16
|
+
/** Content mounts for this environment */
|
|
17
|
+
contents?: any[];
|
|
18
|
+
/** Kernel configuration */
|
|
19
|
+
kernel?: {
|
|
20
|
+
/** Template for kernel naming */
|
|
21
|
+
givenNameTemplate?: string;
|
|
22
|
+
};
|
|
23
|
+
/** Programming language (e.g., "python", "r") */
|
|
24
|
+
language: string;
|
|
25
|
+
/** Resource ranges configuration */
|
|
26
|
+
resourcesRanges?: any;
|
|
27
|
+
/** Credits consumed per hour when running */
|
|
28
|
+
burning_rate: number;
|
|
29
|
+
/** Simple resource specification */
|
|
30
|
+
resources?: any;
|
|
31
|
+
/** Name identifier for the environment */
|
|
32
|
+
name?: string;
|
|
33
|
+
/** Docker registry for the image */
|
|
34
|
+
dockerRegistry?: string;
|
|
35
|
+
/** Icon or avatar URL for the environment */
|
|
36
|
+
icon?: string;
|
|
37
|
+
/** Whether the environment is enabled */
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
/** Tags associated with the environment */
|
|
40
|
+
tags?: string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Represents a running instance of a computing environment
|
|
44
|
+
* @interface Runtime
|
|
45
|
+
*/
|
|
46
|
+
export interface Runtime {
|
|
47
|
+
/** Kubernetes pod name for the runtime instance */
|
|
48
|
+
pod_name: string;
|
|
49
|
+
/** Unique identifier for the runtime */
|
|
50
|
+
uid: string;
|
|
51
|
+
/** Name of the environment this runtime is based on */
|
|
52
|
+
environment_name: string;
|
|
53
|
+
/** Title of the environment for display */
|
|
54
|
+
environment_title?: string;
|
|
55
|
+
/** Credits allocated to this runtime */
|
|
56
|
+
credits?: number;
|
|
57
|
+
/** Current state of the runtime */
|
|
58
|
+
state?: 'starting' | 'running' | 'stopping' | 'stopped' | 'error';
|
|
59
|
+
/** Type of runtime - notebook, terminal, or job */
|
|
60
|
+
type?: 'notebook' | 'terminal' | 'job';
|
|
61
|
+
/** Type of runtime (deprecated, use type) */
|
|
62
|
+
runtime_type?: 'notebook' | 'cell';
|
|
63
|
+
/** Credits consumed per hour */
|
|
64
|
+
burning_rate: number;
|
|
65
|
+
/** User-friendly name for the runtime */
|
|
66
|
+
given_name?: string;
|
|
67
|
+
/** Authentication token for accessing the runtime */
|
|
68
|
+
token?: string;
|
|
69
|
+
/** Ingress URL for accessing the runtime */
|
|
70
|
+
ingress?: string;
|
|
71
|
+
/** Reservation ID if runtime is reserved */
|
|
72
|
+
reservation_id?: string;
|
|
73
|
+
/** ISO 8601 timestamp of when the runtime started */
|
|
74
|
+
started_at?: string;
|
|
75
|
+
/** ISO 8601 timestamp of when the runtime will expire */
|
|
76
|
+
expired_at?: string;
|
|
77
|
+
/** ISO 8601 timestamp of when the runtime was created */
|
|
78
|
+
created_at?: string;
|
|
79
|
+
/** ISO 8601 timestamp of last update */
|
|
80
|
+
updated_at?: string;
|
|
81
|
+
/** Jupyter kernel ID if applicable */
|
|
82
|
+
kernel_id?: string;
|
|
83
|
+
/** Path to the notebook file if runtime is for a notebook */
|
|
84
|
+
notebook_path?: string;
|
|
85
|
+
/** Cell ID if runtime is for a specific cell */
|
|
86
|
+
cell_id?: string;
|
|
87
|
+
/** URL for accessing Jupyter server */
|
|
88
|
+
jupyter_url?: string;
|
|
89
|
+
/** Token for Jupyter server authentication */
|
|
90
|
+
jupyter_token?: string;
|
|
91
|
+
/** Detailed status information */
|
|
92
|
+
status?: any;
|
|
93
|
+
/** Alternative naming from API responses */
|
|
94
|
+
podName?: string;
|
|
95
|
+
/** Alternative naming from API responses */
|
|
96
|
+
createdAt?: string;
|
|
97
|
+
/** Alternative naming from API responses */
|
|
98
|
+
environment?: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Request payload for creating a new runtime
|
|
102
|
+
* @interface CreateRuntimeRequest
|
|
103
|
+
*/
|
|
104
|
+
export interface CreateRuntimeRequest {
|
|
105
|
+
/** Name of the environment to use */
|
|
106
|
+
environment_name: string;
|
|
107
|
+
/** Type of runtime (e.g., 'notebook', 'terminal', 'job') */
|
|
108
|
+
type?: 'notebook' | 'terminal' | 'job';
|
|
109
|
+
/** Optional given name for the runtime */
|
|
110
|
+
given_name?: string;
|
|
111
|
+
/** Maximum credits this runtime can consume */
|
|
112
|
+
credits_limit?: number;
|
|
113
|
+
/** Optional capabilities for the runtime */
|
|
114
|
+
capabilities?: string[];
|
|
115
|
+
/** Optional source to create runtime from (e.g., snapshot ID) */
|
|
116
|
+
from?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Represents a snapshot of a runtime's state and files
|
|
120
|
+
* @interface RuntimeSnapshot
|
|
121
|
+
*/
|
|
122
|
+
export interface RuntimeSnapshot {
|
|
123
|
+
/** Unique identifier for the snapshot */
|
|
124
|
+
uid: string;
|
|
125
|
+
/** Name of the snapshot */
|
|
126
|
+
name: string;
|
|
127
|
+
/** Optional description of the snapshot */
|
|
128
|
+
description?: string;
|
|
129
|
+
/** Name of the environment used by the runtime */
|
|
130
|
+
environment: string;
|
|
131
|
+
/** Metadata associated with the snapshot */
|
|
132
|
+
metadata?: {
|
|
133
|
+
version?: string;
|
|
134
|
+
language_info?: any;
|
|
135
|
+
[key: string]: any;
|
|
136
|
+
};
|
|
137
|
+
/** Size of the snapshot in bytes */
|
|
138
|
+
size?: number;
|
|
139
|
+
/** Format of the snapshot */
|
|
140
|
+
format?: string;
|
|
141
|
+
/** Format version of the snapshot */
|
|
142
|
+
format_version?: string;
|
|
143
|
+
/** Status of the snapshot */
|
|
144
|
+
status?: string;
|
|
145
|
+
/** ISO 8601 timestamp when the snapshot was last updated */
|
|
146
|
+
updated_at: string;
|
|
147
|
+
/** List of files included in the snapshot */
|
|
148
|
+
files?: any[];
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Request payload for creating a runtime snapshot
|
|
152
|
+
* @interface CreateRuntimeSnapshotRequest
|
|
153
|
+
*/
|
|
154
|
+
export interface CreateRuntimeSnapshotRequest {
|
|
155
|
+
/** Pod name of the runtime to snapshot */
|
|
156
|
+
pod_name: string;
|
|
157
|
+
/** Name for the snapshot */
|
|
158
|
+
name: string;
|
|
159
|
+
/** Description of the snapshot */
|
|
160
|
+
description: string;
|
|
161
|
+
/** Whether to stop the runtime after creating snapshot */
|
|
162
|
+
stop: boolean;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Response for getting a specific runtime snapshot
|
|
166
|
+
* @interface SnapshotGetResponse
|
|
167
|
+
*/
|
|
168
|
+
export interface SnapshotGetResponse {
|
|
169
|
+
/** Indicates if the request was successful */
|
|
170
|
+
success: boolean;
|
|
171
|
+
/** Response message */
|
|
172
|
+
message: string;
|
|
173
|
+
/** The snapshot details */
|
|
174
|
+
snapshot: RuntimeSnapshot;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Response for creating a runtime snapshot
|
|
178
|
+
* @interface SnapshotCreateResponse
|
|
179
|
+
*/
|
|
180
|
+
export interface SnapshotCreateResponse {
|
|
181
|
+
/** Indicates if the request was successful */
|
|
182
|
+
success: boolean;
|
|
183
|
+
/** Response message */
|
|
184
|
+
message: string;
|
|
185
|
+
/** The created snapshot details */
|
|
186
|
+
snapshot: RuntimeSnapshot;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Response from listing available environments
|
|
190
|
+
* @interface EnvironmentsListResponse
|
|
191
|
+
*/
|
|
192
|
+
export interface EnvironmentsListResponse {
|
|
193
|
+
/** Whether the request was successful */
|
|
194
|
+
success: boolean;
|
|
195
|
+
/** Response message from the server */
|
|
196
|
+
message: string;
|
|
197
|
+
/** Array of available environments */
|
|
198
|
+
environments: Environment[];
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Response from creating a new runtime
|
|
202
|
+
* @interface RuntimeCreateResponse
|
|
203
|
+
*/
|
|
204
|
+
export interface CreateRuntimeResponse {
|
|
205
|
+
/** Whether the request was successful */
|
|
206
|
+
success: boolean;
|
|
207
|
+
/** Response message from the server */
|
|
208
|
+
message: string;
|
|
209
|
+
/** The created runtime instance */
|
|
210
|
+
runtime: Runtime;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Response from listing runtimes
|
|
214
|
+
* @interface RuntimesListResponse
|
|
215
|
+
*/
|
|
216
|
+
export interface RuntimesListResponse {
|
|
217
|
+
/** Whether the request was successful */
|
|
218
|
+
success: boolean;
|
|
219
|
+
/** Response message from the server */
|
|
220
|
+
message: string;
|
|
221
|
+
/** Array of runtime instances */
|
|
222
|
+
runtimes: Runtime[];
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Response from listing runtime snapshots
|
|
226
|
+
* @interface RuntimeSnapshotsListResponse
|
|
227
|
+
*/
|
|
228
|
+
export interface SnapshotsListResponse {
|
|
229
|
+
/** Whether the request was successful */
|
|
230
|
+
success: boolean;
|
|
231
|
+
/** Response message from the server */
|
|
232
|
+
message: string;
|
|
233
|
+
/** Array of runtime snapshots */
|
|
234
|
+
snapshots: RuntimeSnapshot[];
|
|
235
|
+
}
|