@datalayer/core 0.0.13 → 0.0.15
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/api/DatalayerApi.js +17 -5
- package/lib/api/iam/authentication.d.ts +1 -1
- package/lib/api/iam/healthz.d.ts +1 -1
- package/lib/api/iam/index.d.ts +1 -1
- package/lib/api/iam/index.js +1 -1
- package/lib/api/iam/profile.d.ts +1 -1
- package/lib/api/iam/usage.d.ts +1 -39
- package/lib/api/index.d.ts +0 -1
- package/lib/api/index.js +0 -2
- package/lib/api/runtimes/environments.d.ts +2 -2
- package/lib/api/runtimes/healthz.d.ts +1 -1
- package/lib/api/runtimes/runtimes.d.ts +4 -4
- package/lib/api/runtimes/snapshots.d.ts +4 -4
- package/lib/api/spacer/documents.d.ts +1 -1
- package/lib/api/spacer/healthz.d.ts +1 -1
- package/lib/api/spacer/items.d.ts +1 -1
- package/lib/api/spacer/lexicals.d.ts +1 -1
- package/lib/api/spacer/notebooks.d.ts +1 -1
- package/lib/api/spacer/spaces.d.ts +1 -1
- package/lib/api/spacer/users.d.ts +1 -1
- package/lib/client/base.d.ts +2 -2
- package/lib/client/index.d.ts +44 -44
- package/lib/client/index.js +10 -10
- package/lib/client/mixins/IAMMixin.d.ts +7 -7
- package/lib/client/mixins/IAMMixin.js +5 -5
- package/lib/client/mixins/RuntimesMixin.d.ts +13 -13
- package/lib/client/mixins/RuntimesMixin.js +11 -11
- package/lib/client/mixins/SpacerMixin.d.ts +14 -14
- package/lib/client/mixins/SpacerMixin.js +12 -12
- package/lib/client/utils/spacerUtils.d.ts +4 -4
- package/lib/client/utils/spacerUtils.js +4 -4
- package/lib/components/checkout/StripeCheckout.js +19 -23
- package/lib/components/context/OrganizationSelect.js +12 -15
- package/lib/components/context/SpaceSelect.js +24 -25
- package/lib/components/runtimes/RuntimeLauncherDialog.js +2 -2
- package/lib/components/runtimes/RuntimePickerCell.js +1 -1
- package/lib/components/runtimes/RuntimePickerNotebook.js +1 -1
- package/lib/components/runtimes/RuntimeTransfer.d.ts +1 -1
- package/lib/hooks/useAuthorization.js +4 -2
- package/lib/hooks/useCache.d.ts +932 -285
- package/lib/hooks/useCache.js +5736 -2767
- package/lib/hooks/useCache0.d.ts +312 -0
- package/lib/hooks/useCache0.js +3189 -0
- package/lib/hooks/useIAM.js +18 -17
- package/lib/index.d.ts +1 -2
- package/lib/index.js +1 -2
- package/lib/{client/models/Credits.d.ts → models/CreditsDTO.d.ts} +38 -5
- package/lib/{client/models/Credits.js → models/CreditsDTO.js} +7 -2
- package/lib/models/Environment.d.ts +1 -1
- package/lib/{client/models/Environment.d.ts → models/EnvironmentDTO.d.ts} +55 -3
- package/lib/{client/models/Environment.js → models/EnvironmentDTO.js} +2 -2
- package/lib/{client/models → models}/HealthCheck.js +1 -1
- package/lib/{api/types/iam.d.ts → models/IAM.d.ts} +1 -87
- package/lib/{client/models/Item.d.ts → models/ItemDTO.d.ts} +6 -1
- package/lib/{client/models/Item.js → models/ItemDTO.js} +2 -7
- package/lib/{client/models/Lexical.d.ts → models/LexicalDTO.d.ts} +79 -7
- package/lib/{client/models/Lexical.js → models/LexicalDTO.js} +10 -5
- package/lib/{client/models/Notebook.d.ts → models/NotebookDTO.d.ts} +16 -7
- package/lib/{client/models/Notebook.js → models/NotebookDTO.js} +5 -5
- package/lib/models/Profile.d.ts +65 -0
- package/lib/models/Runtime.d.ts +49 -49
- package/lib/{client/models/Runtime.d.ts → models/RuntimeDTO.d.ts} +74 -5
- package/lib/{client/models/Runtime.js → models/RuntimeDTO.js} +5 -5
- package/lib/{client/models/Snapshot.d.ts → models/RuntimeSnapshotDTO.d.ts} +89 -8
- package/lib/{client/models/Snapshot.js → models/RuntimeSnapshotDTO.js} +4 -4
- package/lib/models/SpaceDTO.d.ts +280 -0
- package/lib/{client/models/Space.js → models/SpaceDTO.js} +17 -12
- package/lib/{client/models/User.d.ts → models/UserDTO.d.ts} +25 -3
- package/lib/{client/models/User.js → models/UserDTO.js} +3 -2
- package/lib/models/index.d.ts +45 -4
- package/lib/models/index.js +45 -4
- package/package.json +2 -1
- package/lib/api/types/index.d.ts +0 -34
- package/lib/api/types/index.js +0 -38
- package/lib/api/types/runtimes.d.ts +0 -205
- package/lib/api/types/runtimes.js +0 -5
- package/lib/api/types/spacer.d.ts +0 -243
- package/lib/api/types/spacer.js +0 -5
- package/lib/client/models/Space.d.ts +0 -135
- package/lib/client/models/index.d.ts +0 -26
- package/lib/client/models/index.js +0 -25
- /package/lib/{api/types/common.d.ts → models/Common.d.ts} +0 -0
- /package/lib/{api/types/common.js → models/Common.js} +0 -0
- /package/lib/{client/models → models}/HealthCheck.d.ts +0 -0
- /package/lib/{api/types/iam.js → models/IAM.js} +0 -0
package/lib/api/DatalayerApi.js
CHANGED
|
@@ -154,9 +154,21 @@ export async function requestDatalayerAPI({ url, method, body, token, signal, he
|
|
|
154
154
|
}
|
|
155
155
|
try {
|
|
156
156
|
const response = await axios(axiosConfig);
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
if (response.status < 300) {
|
|
158
|
+
// Handle redirections if needed.
|
|
159
|
+
if (response.status === 202 && response.headers.location) {
|
|
160
|
+
return await handleAxiosRedirection(response, axiosConfig);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
const adaptedResponse = {
|
|
165
|
+
ok: false,
|
|
166
|
+
status: response.status,
|
|
167
|
+
statusText: response.statusText,
|
|
168
|
+
json: async () => response?.data,
|
|
169
|
+
text: async () => JSON.stringify(response?.data),
|
|
170
|
+
};
|
|
171
|
+
throw await RunResponseError.create(adaptedResponse);
|
|
160
172
|
}
|
|
161
173
|
return response.data;
|
|
162
174
|
}
|
|
@@ -164,14 +176,14 @@ export async function requestDatalayerAPI({ url, method, body, token, signal, he
|
|
|
164
176
|
if (axios.isAxiosError(error)) {
|
|
165
177
|
if (error.response) {
|
|
166
178
|
// Convert axios error to our RunResponseError format
|
|
167
|
-
const
|
|
179
|
+
const adaptedResponse = {
|
|
168
180
|
ok: false,
|
|
169
181
|
status: error.response.status,
|
|
170
182
|
statusText: error.response.statusText,
|
|
171
183
|
json: async () => error.response?.data,
|
|
172
184
|
text: async () => JSON.stringify(error.response?.data),
|
|
173
185
|
};
|
|
174
|
-
throw await RunResponseError.create(
|
|
186
|
+
throw await RunResponseError.create(adaptedResponse);
|
|
175
187
|
}
|
|
176
188
|
throw new NetworkError(error);
|
|
177
189
|
}
|
package/lib/api/iam/healthz.d.ts
CHANGED
package/lib/api/iam/index.d.ts
CHANGED
|
@@ -14,4 +14,4 @@ export { login, logout, checkAuth } from './authentication';
|
|
|
14
14
|
export { getOAuth2AuthzUrl, getOAuth2AuthzUrlForLink, handleGitHubOAuth2Callback, handleLinkedInOAuth2Callback, handleOktaOAuth2Callback, type OAuth2Provider, type OAuth2AuthzUrlResponse, type OAuth2CallbackParams, type OAuth2CallbackResponse, } from './oauth2';
|
|
15
15
|
export { me, whoami } from './profile';
|
|
16
16
|
export { ping } from './healthz';
|
|
17
|
-
export { getCredits
|
|
17
|
+
export { getCredits } from './usage';
|
package/lib/api/iam/index.js
CHANGED
|
@@ -19,4 +19,4 @@ export { login, logout, checkAuth } from './authentication';
|
|
|
19
19
|
export { getOAuth2AuthzUrl, getOAuth2AuthzUrlForLink, handleGitHubOAuth2Callback, handleLinkedInOAuth2Callback, handleOktaOAuth2Callback, } from './oauth2';
|
|
20
20
|
export { me, whoami } from './profile';
|
|
21
21
|
export { ping } from './healthz';
|
|
22
|
-
export { getCredits
|
|
22
|
+
export { getCredits } from './usage';
|
package/lib/api/iam/profile.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MembershipsResponse, UserMeResponse, WhoAmIResponse } from '
|
|
1
|
+
import { MembershipsResponse, UserMeResponse, WhoAmIResponse } from '../../models/IAM';
|
|
2
2
|
/**
|
|
3
3
|
* Get current authenticated user profile
|
|
4
4
|
* @param token - Authentication token (required)
|
package/lib/api/iam/usage.d.ts
CHANGED
|
@@ -1,42 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Credit information for a user.
|
|
3
|
-
*/
|
|
4
|
-
export interface CreditsInfo {
|
|
5
|
-
/** Available credits */
|
|
6
|
-
credits: number;
|
|
7
|
-
/** Credit quota (null if unlimited) */
|
|
8
|
-
quota: number | null;
|
|
9
|
-
/** Last update timestamp */
|
|
10
|
-
last_update: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Credit reservation information.
|
|
14
|
-
*/
|
|
15
|
-
export interface CreditReservation {
|
|
16
|
-
/** Reservation ID */
|
|
17
|
-
id: string;
|
|
18
|
-
/** Reserved credits */
|
|
19
|
-
credits: number;
|
|
20
|
-
/** Resource ID (e.g., runtime ID) */
|
|
21
|
-
resource: string;
|
|
22
|
-
/** Last update timestamp */
|
|
23
|
-
last_update: string;
|
|
24
|
-
/** Burning rate (credits per hour) for this reservation */
|
|
25
|
-
burning_rate: number;
|
|
26
|
-
/** Start date of the reservation */
|
|
27
|
-
start_date: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Response from the credits endpoint.
|
|
31
|
-
*/
|
|
32
|
-
export interface CreditsResponse {
|
|
33
|
-
/** Operation success status */
|
|
34
|
-
success: boolean;
|
|
35
|
-
/** Credit information */
|
|
36
|
-
credits: CreditsInfo;
|
|
37
|
-
/** Active credit reservations */
|
|
38
|
-
reservations: CreditReservation[];
|
|
39
|
-
}
|
|
1
|
+
import { CreditsResponse } from '../../models/CreditsDTO';
|
|
40
2
|
/**
|
|
41
3
|
* Get the current user's available credits and usage information.
|
|
42
4
|
*
|
package/lib/api/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export { requestDatalayerAPI, RunResponseError, NetworkError, } from './DatalayerApi';
|
|
10
10
|
export type { IRequestDatalayerAPIOptions } from './DatalayerApi';
|
|
11
|
-
export * from './types';
|
|
12
11
|
export * as iam from './iam';
|
|
13
12
|
export * as runtimes from './runtimes';
|
|
14
13
|
export * as spacer from './spacer';
|
package/lib/api/index.js
CHANGED
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
*/
|
|
13
13
|
// Base client exports
|
|
14
14
|
export { requestDatalayerAPI, RunResponseError, NetworkError, } from './DatalayerApi';
|
|
15
|
-
// Type exports
|
|
16
|
-
export * from './types';
|
|
17
15
|
// Domain-organized API exports
|
|
18
16
|
export * as iam from './iam';
|
|
19
17
|
export * as runtimes from './runtimes';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ListEnvironmentsResponse } from '../../models/EnvironmentDTO';
|
|
2
2
|
/**
|
|
3
3
|
* List all available computing environments.
|
|
4
4
|
* @param token - Authentication token
|
|
@@ -6,4 +6,4 @@ import { EnvironmentsListResponse } from '../types/runtimes';
|
|
|
6
6
|
* @returns Promise resolving to list of available environments
|
|
7
7
|
* @throws {Error} If authentication token is missing or invalid
|
|
8
8
|
*/
|
|
9
|
-
export declare const listEnvironments: (token: string, baseUrl?: string) => Promise<
|
|
9
|
+
export declare const listEnvironments: (token: string, baseUrl?: string) => Promise<ListEnvironmentsResponse>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RuntimeData, CreateRuntimeRequest, CreateRuntimeResponse, ListRuntimesResponse } from '../../models/RuntimeDTO';
|
|
2
2
|
/**
|
|
3
3
|
* Create a new runtime instance.
|
|
4
4
|
* @param token - Authentication token
|
|
@@ -17,7 +17,7 @@ export declare const createRuntime: (token: string, data: CreateRuntimeRequest,
|
|
|
17
17
|
* @returns Promise resolving to list of runtime instances
|
|
18
18
|
* @throws {Error} If authentication token is missing or invalid
|
|
19
19
|
*/
|
|
20
|
-
export declare const listRuntimes: (token: string, baseUrl?: string) => Promise<
|
|
20
|
+
export declare const listRuntimes: (token: string, baseUrl?: string) => Promise<ListRuntimesResponse>;
|
|
21
21
|
/**
|
|
22
22
|
* Get details for a specific runtime instance.
|
|
23
23
|
* @param token - Authentication token
|
|
@@ -28,7 +28,7 @@ export declare const listRuntimes: (token: string, baseUrl?: string) => Promise<
|
|
|
28
28
|
* @throws {Error} If pod name is missing or invalid
|
|
29
29
|
* @throws {Error} With status 404 if the runtime is not found
|
|
30
30
|
*/
|
|
31
|
-
export declare const getRuntime: (token: string, podName: string, baseUrl?: string) => Promise<
|
|
31
|
+
export declare const getRuntime: (token: string, podName: string, baseUrl?: string) => Promise<RuntimeData>;
|
|
32
32
|
/**
|
|
33
33
|
* Delete a runtime instance.
|
|
34
34
|
* @param token - Authentication token
|
|
@@ -51,4 +51,4 @@ export declare const deleteRuntime: (token: string, podName: string, baseUrl?: s
|
|
|
51
51
|
* @throws {Error} If pod name is missing or invalid
|
|
52
52
|
* @throws {Error} With status 404 if the runtime is not found
|
|
53
53
|
*/
|
|
54
|
-
export declare const updateRuntime: (token: string, podName: string, from: string, baseUrl?: string) => Promise<
|
|
54
|
+
export declare const updateRuntime: (token: string, podName: string, from: string, baseUrl?: string) => Promise<RuntimeData>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateRuntimeSnapshotRequest,
|
|
1
|
+
import { CreateRuntimeSnapshotRequest, ListRuntimeSnapshotsResponse, GetRuntimeSnapshotResponse, CreateRuntimeSnapshotResponse } from '../../models/RuntimeSnapshotDTO';
|
|
2
2
|
/**
|
|
3
3
|
* Create a snapshot of a runtime instance.
|
|
4
4
|
* @param token - Authentication token
|
|
@@ -7,7 +7,7 @@ import { CreateRuntimeSnapshotRequest, SnapshotsListResponse, SnapshotGetRespons
|
|
|
7
7
|
* @returns Promise resolving to the created snapshot response
|
|
8
8
|
* @throws {Error} If authentication token is missing or invalid
|
|
9
9
|
*/
|
|
10
|
-
export declare const createSnapshot: (token: string, data: CreateRuntimeSnapshotRequest, baseUrl?: string) => Promise<
|
|
10
|
+
export declare const createSnapshot: (token: string, data: CreateRuntimeSnapshotRequest, baseUrl?: string) => Promise<CreateRuntimeSnapshotResponse>;
|
|
11
11
|
/**
|
|
12
12
|
* List all runtime snapshots.
|
|
13
13
|
* @param token - Authentication token
|
|
@@ -15,7 +15,7 @@ export declare const createSnapshot: (token: string, data: CreateRuntimeSnapshot
|
|
|
15
15
|
* @returns Promise resolving to list of snapshots
|
|
16
16
|
* @throws {Error} If authentication token is missing or invalid
|
|
17
17
|
*/
|
|
18
|
-
export declare const listSnapshots: (token: string, baseUrl?: string) => Promise<
|
|
18
|
+
export declare const listSnapshots: (token: string, baseUrl?: string) => Promise<ListRuntimeSnapshotsResponse>;
|
|
19
19
|
/**
|
|
20
20
|
* Get details for a specific runtime snapshot.
|
|
21
21
|
* @param token - Authentication token
|
|
@@ -25,7 +25,7 @@ export declare const listSnapshots: (token: string, baseUrl?: string) => Promise
|
|
|
25
25
|
* @throws {Error} If authentication token is missing or invalid
|
|
26
26
|
* @throws {Error} If snapshot ID is missing or invalid
|
|
27
27
|
*/
|
|
28
|
-
export declare const getSnapshot: (token: string, snapshotId: string, baseUrl?: string) => Promise<
|
|
28
|
+
export declare const getSnapshot: (token: string, snapshotId: string, baseUrl?: string) => Promise<GetRuntimeSnapshotResponse>;
|
|
29
29
|
/**
|
|
30
30
|
* Delete a runtime snapshot.
|
|
31
31
|
* @param token - Authentication token
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeleteSpaceItemResponse, GetSpaceItemResponse, GetSpaceItemsResponse } from '
|
|
1
|
+
import { DeleteSpaceItemResponse, GetSpaceItemResponse, GetSpaceItemsResponse } from '../../models/SpaceDTO';
|
|
2
2
|
/**
|
|
3
3
|
* Get the items of a space.
|
|
4
4
|
* @param token - Authentication token
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateLexicalRequest, CreateLexicalResponse, GetLexicalResponse, UpdateLexicalRequest, UpdateLexicalResponse } from '
|
|
1
|
+
import { CreateLexicalRequest, CreateLexicalResponse, GetLexicalResponse, UpdateLexicalRequest, UpdateLexicalResponse } from '../../models/LexicalDTO';
|
|
2
2
|
/**
|
|
3
3
|
* Create a new lexical document.
|
|
4
4
|
* @param token - Authentication token
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateNotebookRequest, CreateNotebookResponse, GetNotebookResponse, UpdateNotebookRequest, UpdateNotebookResponse } from '
|
|
1
|
+
import { CreateNotebookRequest, CreateNotebookResponse, GetNotebookResponse, UpdateNotebookRequest, UpdateNotebookResponse } from '../../models/SpaceDTO';
|
|
2
2
|
/**
|
|
3
3
|
* Create a new Jupyter notebook.
|
|
4
4
|
* @param token - Authentication token
|
package/lib/client/base.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnvironmentDTO } from '../models/EnvironmentDTO';
|
|
2
2
|
/** Handlers for SDK method lifecycle events. */
|
|
3
3
|
export interface SDKHandlers {
|
|
4
4
|
/** Called before any SDK method execution */
|
|
@@ -32,7 +32,7 @@ export declare class DatalayerClientBase {
|
|
|
32
32
|
/** Authentication token */
|
|
33
33
|
token?: string;
|
|
34
34
|
/** Environments */
|
|
35
|
-
readonly environments:
|
|
35
|
+
readonly environments: EnvironmentDTO[];
|
|
36
36
|
/** Method lifecycle handlers */
|
|
37
37
|
readonly handlers?: SDKHandlers;
|
|
38
38
|
/**
|
package/lib/client/index.d.ts
CHANGED
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
17
|
import { DatalayerClientBase, type DatalayerClientConfig, type SDKHandlers } from './base';
|
|
18
|
-
import type {
|
|
19
|
-
import type {
|
|
20
|
-
import type {
|
|
21
|
-
import type {
|
|
22
|
-
import type {
|
|
23
|
-
import type {
|
|
24
|
-
import type {
|
|
25
|
-
import type {
|
|
26
|
-
import type { HealthCheck } from '
|
|
18
|
+
import type { UserDTO } from './../models/UserDTO';
|
|
19
|
+
import type { CreditsDTO } from '../models/CreditsDTO';
|
|
20
|
+
import type { EnvironmentDTO } from '../models/EnvironmentDTO';
|
|
21
|
+
import type { RuntimeDTO } from '../models/RuntimeDTO';
|
|
22
|
+
import type { RuntimeSnapshotDTO } from '../models/RuntimeSnapshotDTO';
|
|
23
|
+
import type { SpaceDTO } from '../models/SpaceDTO';
|
|
24
|
+
import type { NotebookDTO } from '../models/NotebookDTO';
|
|
25
|
+
import type { LexicalDTO } from '../models/LexicalDTO';
|
|
26
|
+
import type { HealthCheck } from '../models/HealthCheck';
|
|
27
27
|
declare const DatalayerClientWithMixins: typeof DatalayerClientBase;
|
|
28
28
|
/**
|
|
29
29
|
* Main Datalayer Client providing unified access to all platform services.
|
|
@@ -52,54 +52,54 @@ export declare class DatalayerClient extends DatalayerClientWithMixins {
|
|
|
52
52
|
}
|
|
53
53
|
export type { DatalayerClientConfig, SDKHandlers };
|
|
54
54
|
export { DatalayerClientBase };
|
|
55
|
-
export { User } from '
|
|
56
|
-
export type { UserJSON } from '
|
|
57
|
-
export { Runtime } from '
|
|
58
|
-
export type { RuntimeJSON } from '
|
|
59
|
-
export { Environment } from '
|
|
60
|
-
export type { EnvironmentJSON } from '
|
|
61
|
-
export { Snapshot } from '
|
|
62
|
-
export { Space } from '
|
|
63
|
-
export { Notebook } from '
|
|
64
|
-
export {
|
|
65
|
-
export { Credits } from '
|
|
66
|
-
export { Item } from '
|
|
67
|
-
export { HealthCheck } from '
|
|
68
|
-
export type { HealthCheckJSON } from '
|
|
55
|
+
export { UserDTO as User } from './../models/UserDTO';
|
|
56
|
+
export type { UserJSON } from './../models/UserDTO';
|
|
57
|
+
export { RuntimeDTO as Runtime } from '../models/RuntimeDTO';
|
|
58
|
+
export type { RuntimeJSON } from '../models/RuntimeDTO';
|
|
59
|
+
export { EnvironmentDTO as Environment } from '../models/EnvironmentDTO';
|
|
60
|
+
export type { EnvironmentJSON } from '../models/EnvironmentDTO';
|
|
61
|
+
export { RuntimeSnapshotDTO as Snapshot } from '../models/RuntimeSnapshotDTO';
|
|
62
|
+
export { SpaceDTO as Space } from '../models/SpaceDTO';
|
|
63
|
+
export { NotebookDTO as Notebook } from '../models/NotebookDTO';
|
|
64
|
+
export { LexicalDTO } from '../models/LexicalDTO';
|
|
65
|
+
export { CreditsDTO as Credits } from '../models/CreditsDTO';
|
|
66
|
+
export { ItemDTO as Item } from '../models/ItemDTO';
|
|
67
|
+
export { HealthCheck } from '../models/HealthCheck';
|
|
68
|
+
export type { HealthCheckJSON } from '../models/HealthCheck';
|
|
69
69
|
export { ItemTypes } from './constants';
|
|
70
70
|
export type { ItemType } from './constants';
|
|
71
71
|
export interface DatalayerClient {
|
|
72
72
|
getToken(): string | undefined;
|
|
73
73
|
setToken(token: string): Promise<void>;
|
|
74
|
-
whoami(): Promise<
|
|
75
|
-
login(token: string): Promise<
|
|
74
|
+
whoami(): Promise<UserDTO>;
|
|
75
|
+
login(token: string): Promise<UserDTO>;
|
|
76
76
|
logout(): Promise<void>;
|
|
77
|
-
getCredits(): Promise<
|
|
77
|
+
getCredits(): Promise<CreditsDTO>;
|
|
78
78
|
calculateMaxRuntimeMinutes(availableCredits: number, burningRate: number): number;
|
|
79
79
|
calculateCreditsRequired(minutes: number, burningRate: number): number;
|
|
80
80
|
checkIAMHealth(): Promise<HealthCheck>;
|
|
81
|
-
listEnvironments(): Promise<
|
|
82
|
-
ensureRuntime(environmentName?: string, creditsLimit?: number, waitForReady?: boolean, maxWaitTime?: number, reuseExisting?: boolean, snapshotId?: string): Promise<
|
|
83
|
-
createRuntime(environmentName: string, type: 'notebook' | 'terminal' | 'job', givenName: string, minutesLimit: number, fromSnapshotId?: string): Promise<
|
|
84
|
-
listRuntimes(): Promise<
|
|
85
|
-
getRuntime(podName: string): Promise<
|
|
81
|
+
listEnvironments(): Promise<EnvironmentDTO[]>;
|
|
82
|
+
ensureRuntime(environmentName?: string, creditsLimit?: number, waitForReady?: boolean, maxWaitTime?: number, reuseExisting?: boolean, snapshotId?: string): Promise<RuntimeDTO>;
|
|
83
|
+
createRuntime(environmentName: string, type: 'notebook' | 'terminal' | 'job', givenName: string, minutesLimit: number, fromSnapshotId?: string): Promise<RuntimeDTO>;
|
|
84
|
+
listRuntimes(): Promise<RuntimeDTO[]>;
|
|
85
|
+
getRuntime(podName: string): Promise<RuntimeDTO>;
|
|
86
86
|
deleteRuntime(podName: string): Promise<void>;
|
|
87
87
|
terminateAllRuntimes(): Promise<PromiseSettledResult<void>[]>;
|
|
88
|
-
createSnapshot(podName: string, name: string, description: string, stop?: boolean): Promise<
|
|
89
|
-
listSnapshots(): Promise<
|
|
90
|
-
getSnapshot(id: string): Promise<
|
|
88
|
+
createSnapshot(podName: string, name: string, description: string, stop?: boolean): Promise<RuntimeSnapshotDTO>;
|
|
89
|
+
listSnapshots(): Promise<RuntimeSnapshotDTO[]>;
|
|
90
|
+
getSnapshot(id: string): Promise<RuntimeSnapshotDTO>;
|
|
91
91
|
deleteSnapshot(id: string): Promise<void>;
|
|
92
92
|
checkRuntimesHealth(): Promise<HealthCheck>;
|
|
93
|
-
getMySpaces(): Promise<
|
|
94
|
-
createSpace(name: string, description: string, variant: string, spaceHandle: string, organizationId: string, seedSpaceId: string, isPublic: boolean): Promise<
|
|
95
|
-
createNotebook(spaceId: string, name: string, description: string, file?: File | Blob): Promise<
|
|
96
|
-
getNotebook(id: string): Promise<
|
|
97
|
-
updateNotebook(id: string, name?: string, description?: string): Promise<
|
|
98
|
-
createLexical(spaceId: string, name: string, description: string, file?: File | Blob): Promise<
|
|
99
|
-
getLexical(id: string): Promise<
|
|
100
|
-
updateLexical(id: string, name?: string, description?: string): Promise<
|
|
101
|
-
getSpaceItems(spaceId: string): Promise<(
|
|
102
|
-
getSpaceItem(itemId: string): Promise<
|
|
93
|
+
getMySpaces(): Promise<SpaceDTO[]>;
|
|
94
|
+
createSpace(name: string, description: string, variant: string, spaceHandle: string, organizationId: string, seedSpaceId: string, isPublic: boolean): Promise<SpaceDTO>;
|
|
95
|
+
createNotebook(spaceId: string, name: string, description: string, file?: File | Blob): Promise<NotebookDTO>;
|
|
96
|
+
getNotebook(id: string): Promise<NotebookDTO>;
|
|
97
|
+
updateNotebook(id: string, name?: string, description?: string): Promise<NotebookDTO>;
|
|
98
|
+
createLexical(spaceId: string, name: string, description: string, file?: File | Blob): Promise<LexicalDTO>;
|
|
99
|
+
getLexical(id: string): Promise<LexicalDTO>;
|
|
100
|
+
updateLexical(id: string, name?: string, description?: string): Promise<LexicalDTO>;
|
|
101
|
+
getSpaceItems(spaceId: string): Promise<(NotebookDTO | LexicalDTO)[]>;
|
|
102
|
+
getSpaceItem(itemId: string): Promise<NotebookDTO | LexicalDTO>;
|
|
103
103
|
deleteSpaceItem(itemId: string): Promise<void>;
|
|
104
104
|
getCollaborationSessionId(documentId: string): Promise<string>;
|
|
105
105
|
getContent(itemId: string): Promise<any>;
|
package/lib/client/index.js
CHANGED
|
@@ -65,15 +65,15 @@ export class DatalayerClient extends DatalayerClientWithMixins {
|
|
|
65
65
|
}
|
|
66
66
|
export { DatalayerClientBase };
|
|
67
67
|
// Export models for use by consumers
|
|
68
|
-
export { User } from '
|
|
69
|
-
export { Runtime } from '
|
|
70
|
-
export { Environment } from '
|
|
71
|
-
export { Snapshot } from '
|
|
72
|
-
export { Space } from '
|
|
73
|
-
export { Notebook } from '
|
|
74
|
-
export {
|
|
75
|
-
export { Credits } from '
|
|
76
|
-
export { Item } from '
|
|
77
|
-
export { HealthCheck } from '
|
|
68
|
+
export { UserDTO as User } from './../models/UserDTO';
|
|
69
|
+
export { RuntimeDTO as Runtime } from '../models/RuntimeDTO';
|
|
70
|
+
export { EnvironmentDTO as Environment } from '../models/EnvironmentDTO';
|
|
71
|
+
export { RuntimeSnapshotDTO as Snapshot } from '../models/RuntimeSnapshotDTO';
|
|
72
|
+
export { SpaceDTO as Space } from '../models/SpaceDTO';
|
|
73
|
+
export { NotebookDTO as Notebook } from '../models/NotebookDTO';
|
|
74
|
+
export { LexicalDTO } from '../models/LexicalDTO';
|
|
75
|
+
export { CreditsDTO as Credits } from '../models/CreditsDTO';
|
|
76
|
+
export { ItemDTO as Item } from '../models/ItemDTO';
|
|
77
|
+
export { HealthCheck } from '../models/HealthCheck';
|
|
78
78
|
// Export constants
|
|
79
79
|
export { ItemTypes } from './constants';
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import type { Constructor } from '../utils/mixins';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { HealthCheck } from '
|
|
2
|
+
import { UserDTO } from '../../models/UserDTO';
|
|
3
|
+
import { CreditsDTO } from '../../models/CreditsDTO';
|
|
4
|
+
import { HealthCheck } from '../../models/HealthCheck';
|
|
5
5
|
/** IAM mixin providing authentication and user management. */
|
|
6
6
|
export declare function IAMMixin<TBase extends Constructor>(Base: TBase): {
|
|
7
7
|
new (...args: any[]): {
|
|
8
|
-
currentUserCache?:
|
|
8
|
+
currentUserCache?: UserDTO;
|
|
9
9
|
/**
|
|
10
10
|
* Get the current user's profile information.
|
|
11
11
|
* @returns User model instance
|
|
12
12
|
*/
|
|
13
|
-
whoami(): Promise<
|
|
13
|
+
whoami(): Promise<UserDTO>;
|
|
14
14
|
/**
|
|
15
15
|
* Authenticate the user with a token.
|
|
16
16
|
* @param token - Authentication token
|
|
17
17
|
* @returns User object on successful login
|
|
18
18
|
* @throws Error if token is invalid
|
|
19
19
|
*/
|
|
20
|
-
login(token: string): Promise<
|
|
20
|
+
login(token: string): Promise<UserDTO>;
|
|
21
21
|
/** Log out the current user. */
|
|
22
22
|
logout(): Promise<void>;
|
|
23
23
|
/**
|
|
24
24
|
* Get the current user's available credits and usage information.
|
|
25
25
|
* @returns Credits model instance
|
|
26
26
|
*/
|
|
27
|
-
getCredits(): Promise<
|
|
27
|
+
getCredits(): Promise<CreditsDTO>;
|
|
28
28
|
/**
|
|
29
29
|
* Calculate the maximum runtime duration in minutes based on available credits and burning rate.
|
|
30
30
|
* @param availableCredits - The amount of credits available
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
import * as authentication from '../../api/iam/authentication';
|
|
10
10
|
import * as profile from '../../api/iam/profile';
|
|
11
11
|
import * as usage from '../../api/iam/usage';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { HealthCheck } from '
|
|
12
|
+
import { UserDTO } from '../../models/UserDTO';
|
|
13
|
+
import { CreditsDTO } from '../../models/CreditsDTO';
|
|
14
|
+
import { HealthCheck } from '../../models/HealthCheck';
|
|
15
15
|
/** IAM mixin providing authentication and user management. */
|
|
16
16
|
export function IAMMixin(Base) {
|
|
17
17
|
return class extends Base {
|
|
@@ -53,7 +53,7 @@ export function IAMMixin(Base) {
|
|
|
53
53
|
throw new Error(`Unexpected response format from profile.whoami API: ${JSON.stringify(response)}`);
|
|
54
54
|
}
|
|
55
55
|
// Create new User instance (User model is immutable, no update method)
|
|
56
|
-
this.currentUserCache = new
|
|
56
|
+
this.currentUserCache = new UserDTO(userData, this);
|
|
57
57
|
return this.currentUserCache;
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
@@ -96,7 +96,7 @@ export function IAMMixin(Base) {
|
|
|
96
96
|
if (!response || !response.credits) {
|
|
97
97
|
throw new Error('Invalid response from credits API');
|
|
98
98
|
}
|
|
99
|
-
return new
|
|
99
|
+
return new CreditsDTO(response.credits, response.reservations || []);
|
|
100
100
|
}
|
|
101
101
|
// ========================================================================
|
|
102
102
|
// Credits Calculation Utilities
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Constructor } from '../utils/mixins';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { HealthCheck } from '
|
|
2
|
+
import { EnvironmentDTO } from '../../models/EnvironmentDTO';
|
|
3
|
+
import { RuntimeDTO } from '../../models/RuntimeDTO';
|
|
4
|
+
import { RuntimeSnapshotDTO } from '../../models/RuntimeSnapshotDTO';
|
|
5
|
+
import { HealthCheck } from '../../models/HealthCheck';
|
|
6
6
|
/** Options for ensuring a runtime is available. */
|
|
7
7
|
export interface EnsureRuntimeOptions {
|
|
8
8
|
/** Name of the environment to use */
|
|
@@ -21,13 +21,13 @@ export interface EnsureRuntimeOptions {
|
|
|
21
21
|
/** Runtimes mixin providing computational environment and runtime management. */
|
|
22
22
|
export declare function RuntimesMixin<TBase extends Constructor>(Base: TBase): {
|
|
23
23
|
new (...args: any[]): {
|
|
24
|
-
_extractRuntimePodName(runtimePodNameOrInstance: string |
|
|
25
|
-
_extractSnapshotId(snapshotIdOrInstance: string |
|
|
24
|
+
_extractRuntimePodName(runtimePodNameOrInstance: string | RuntimeDTO): string;
|
|
25
|
+
_extractSnapshotId(snapshotIdOrInstance: string | RuntimeSnapshotDTO): string;
|
|
26
26
|
/**
|
|
27
27
|
* List all available computational environments.
|
|
28
28
|
* @returns Array of Environment model instances
|
|
29
29
|
*/
|
|
30
|
-
listEnvironments(): Promise<
|
|
30
|
+
listEnvironments(): Promise<EnvironmentDTO[]>;
|
|
31
31
|
/**
|
|
32
32
|
* Create a new computational runtime.
|
|
33
33
|
* @param environmentName - Name of the environment to use
|
|
@@ -36,18 +36,18 @@ export declare function RuntimesMixin<TBase extends Constructor>(Base: TBase): {
|
|
|
36
36
|
* @param creditsLimit - Credits limit
|
|
37
37
|
* @returns Created runtime
|
|
38
38
|
*/
|
|
39
|
-
createRuntime(environmentName: string, type: "notebook" | "terminal" | "job", givenName: string, minutesLimit: number, fromSnapshotId?: string): Promise<
|
|
39
|
+
createRuntime(environmentName: string, type: "notebook" | "terminal" | "job", givenName: string, minutesLimit: number, fromSnapshotId?: string): Promise<RuntimeDTO>;
|
|
40
40
|
/**
|
|
41
41
|
* List all runtimes.
|
|
42
42
|
* @returns Array of runtimes
|
|
43
43
|
*/
|
|
44
|
-
listRuntimes(): Promise<
|
|
44
|
+
listRuntimes(): Promise<RuntimeDTO[]>;
|
|
45
45
|
/**
|
|
46
46
|
* Get details for a specific runtime by pod name.
|
|
47
47
|
* @param podName - Runtime pod name
|
|
48
48
|
* @returns Runtime details
|
|
49
49
|
*/
|
|
50
|
-
getRuntime(podName: string): Promise<
|
|
50
|
+
getRuntime(podName: string): Promise<RuntimeDTO>;
|
|
51
51
|
/**
|
|
52
52
|
* Delete a runtime permanently.
|
|
53
53
|
* @param podName - Runtime pod name
|
|
@@ -67,18 +67,18 @@ export declare function RuntimesMixin<TBase extends Constructor>(Base: TBase): {
|
|
|
67
67
|
* @param stop - Whether to stop the runtime after creating snapshot (defaults to false)
|
|
68
68
|
* @returns Created snapshot
|
|
69
69
|
*/
|
|
70
|
-
createSnapshot(podName: string, name: string, description: string, stop?: boolean): Promise<
|
|
70
|
+
createSnapshot(podName: string, name: string, description: string, stop?: boolean): Promise<RuntimeSnapshotDTO>;
|
|
71
71
|
/**
|
|
72
72
|
* List all runtime snapshots.
|
|
73
73
|
* @returns Array of snapshots
|
|
74
74
|
*/
|
|
75
|
-
listSnapshots(): Promise<
|
|
75
|
+
listSnapshots(): Promise<RuntimeSnapshotDTO[]>;
|
|
76
76
|
/**
|
|
77
77
|
* Get details for a specific snapshot by ID.
|
|
78
78
|
* @param id - Snapshot ID
|
|
79
79
|
* @returns Snapshot details
|
|
80
80
|
*/
|
|
81
|
-
getSnapshot(id: string): Promise<
|
|
81
|
+
getSnapshot(id: string): Promise<RuntimeSnapshotDTO>;
|
|
82
82
|
/**
|
|
83
83
|
* Delete a snapshot permanently.
|
|
84
84
|
* @param id - Snapshot ID
|