@datalayer/core 0.0.13 → 0.0.14

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.
Files changed (75) hide show
  1. package/lib/api/DatalayerApi.js +17 -5
  2. package/lib/api/iam/authentication.d.ts +1 -1
  3. package/lib/api/iam/healthz.d.ts +1 -1
  4. package/lib/api/iam/index.d.ts +1 -1
  5. package/lib/api/iam/index.js +1 -1
  6. package/lib/api/iam/profile.d.ts +1 -1
  7. package/lib/api/iam/usage.d.ts +1 -39
  8. package/lib/api/index.d.ts +0 -1
  9. package/lib/api/index.js +0 -2
  10. package/lib/api/runtimes/environments.d.ts +2 -2
  11. package/lib/api/runtimes/healthz.d.ts +1 -1
  12. package/lib/api/runtimes/runtimes.d.ts +4 -4
  13. package/lib/api/runtimes/snapshots.d.ts +4 -4
  14. package/lib/api/spacer/documents.d.ts +1 -1
  15. package/lib/api/spacer/healthz.d.ts +1 -1
  16. package/lib/api/spacer/items.d.ts +1 -1
  17. package/lib/api/spacer/lexicals.d.ts +1 -1
  18. package/lib/api/spacer/notebooks.d.ts +1 -1
  19. package/lib/api/spacer/spaces.d.ts +1 -1
  20. package/lib/api/spacer/users.d.ts +1 -1
  21. package/lib/client/base.d.ts +2 -2
  22. package/lib/client/index.d.ts +44 -44
  23. package/lib/client/index.js +10 -10
  24. package/lib/client/mixins/IAMMixin.d.ts +7 -7
  25. package/lib/client/mixins/IAMMixin.js +5 -5
  26. package/lib/client/mixins/RuntimesMixin.d.ts +13 -13
  27. package/lib/client/mixins/RuntimesMixin.js +11 -11
  28. package/lib/client/mixins/SpacerMixin.d.ts +14 -14
  29. package/lib/client/mixins/SpacerMixin.js +12 -12
  30. package/lib/client/utils/spacerUtils.d.ts +4 -4
  31. package/lib/client/utils/spacerUtils.js +4 -4
  32. package/lib/components/runtimes/RuntimeLauncherDialog.js +2 -2
  33. package/lib/components/runtimes/RuntimePickerCell.js +1 -1
  34. package/lib/components/runtimes/RuntimePickerNotebook.js +1 -1
  35. package/lib/components/runtimes/RuntimeTransfer.d.ts +1 -1
  36. package/lib/index.d.ts +1 -2
  37. package/lib/index.js +1 -2
  38. package/lib/{client/models/Credits.d.ts → models/CreditsDTO.d.ts} +38 -5
  39. package/lib/{client/models/Credits.js → models/CreditsDTO.js} +7 -2
  40. package/lib/models/Environment.d.ts +1 -1
  41. package/lib/{client/models/Environment.d.ts → models/EnvironmentDTO.d.ts} +55 -3
  42. package/lib/{client/models/Environment.js → models/EnvironmentDTO.js} +2 -2
  43. package/lib/{client/models → models}/HealthCheck.js +1 -1
  44. package/lib/{api/types/iam.d.ts → models/IAM.d.ts} +1 -87
  45. package/lib/{client/models/Item.d.ts → models/ItemDTO.d.ts} +6 -1
  46. package/lib/{client/models/Item.js → models/ItemDTO.js} +2 -7
  47. package/lib/{client/models/Lexical.d.ts → models/LexicalDTO.d.ts} +79 -7
  48. package/lib/{client/models/Lexical.js → models/LexicalDTO.js} +10 -5
  49. package/lib/{client/models/Notebook.d.ts → models/NotebookDTO.d.ts} +16 -7
  50. package/lib/{client/models/Notebook.js → models/NotebookDTO.js} +5 -5
  51. package/lib/models/Profile.d.ts +65 -0
  52. package/lib/{client/models/Runtime.d.ts → models/RuntimeDTO.d.ts} +74 -5
  53. package/lib/{client/models/Runtime.js → models/RuntimeDTO.js} +5 -5
  54. package/lib/{client/models/Snapshot.d.ts → models/RuntimeSnapshotDTO.d.ts} +89 -8
  55. package/lib/{client/models/Snapshot.js → models/RuntimeSnapshotDTO.js} +4 -4
  56. package/lib/models/SpaceDTO.d.ts +280 -0
  57. package/lib/{client/models/Space.js → models/SpaceDTO.js} +17 -12
  58. package/lib/{client/models/User.d.ts → models/UserDTO.d.ts} +25 -3
  59. package/lib/{client/models/User.js → models/UserDTO.js} +3 -2
  60. package/lib/models/index.d.ts +45 -4
  61. package/lib/models/index.js +45 -4
  62. package/package.json +2 -1
  63. package/lib/api/types/index.d.ts +0 -34
  64. package/lib/api/types/index.js +0 -38
  65. package/lib/api/types/runtimes.d.ts +0 -205
  66. package/lib/api/types/runtimes.js +0 -5
  67. package/lib/api/types/spacer.d.ts +0 -243
  68. package/lib/api/types/spacer.js +0 -5
  69. package/lib/client/models/Space.d.ts +0 -135
  70. package/lib/client/models/index.d.ts +0 -26
  71. package/lib/client/models/index.js +0 -25
  72. /package/lib/{api/types/common.d.ts → models/Common.d.ts} +0 -0
  73. /package/lib/{api/types/common.js → models/Common.js} +0 -0
  74. /package/lib/{client/models → models}/HealthCheck.d.ts +0 -0
  75. /package/lib/{api/types/iam.js → models/IAM.js} +0 -0
@@ -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
- // Handle redirections if needed
158
- if (response.status === 202 && response.headers.location) {
159
- return await handleAxiosRedirection(response, axiosConfig);
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 mockResponse = {
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(mockResponse);
186
+ throw await RunResponseError.create(adaptedResponse);
175
187
  }
176
188
  throw new NetworkError(error);
177
189
  }
@@ -1,4 +1,4 @@
1
- import { LoginRequest, LoginResponse } from '../types/iam';
1
+ import { LoginRequest, LoginResponse } from '../../models/IAM';
2
2
  /**
3
3
  * Authenticate a user with credentials or token
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { HealthzPingResponse } from '../types/common';
1
+ import type { HealthzPingResponse } from '../../models/Common';
2
2
  /**
3
3
  * Health check ping endpoint
4
4
  *
@@ -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, type CreditsInfo, type CreditReservation, type CreditsResponse, } from './usage';
17
+ export { getCredits } from './usage';
@@ -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, } from './usage';
22
+ export { getCredits } from './usage';
@@ -1,4 +1,4 @@
1
- import { MembershipsResponse, UserMeResponse, WhoAmIResponse } from '../types/iam';
1
+ import { MembershipsResponse, UserMeResponse, WhoAmIResponse } from '../../models/IAM';
2
2
  /**
3
3
  * Get current authenticated user profile
4
4
  * @param token - Authentication token (required)
@@ -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
  *
@@ -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 { EnvironmentsListResponse } from '../types/runtimes';
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<EnvironmentsListResponse>;
9
+ export declare const listEnvironments: (token: string, baseUrl?: string) => Promise<ListEnvironmentsResponse>;
@@ -1,4 +1,4 @@
1
- import type { HealthzPingResponse } from '../types/common';
1
+ import type { HealthzPingResponse } from '../../models/Common';
2
2
  /**
3
3
  * Health check ping endpoint for Runtimes service
4
4
  * @param baseUrl - Base URL for the API (defaults to production Runtimes URL)
@@ -1,4 +1,4 @@
1
- import { Runtime, CreateRuntimeRequest, CreateRuntimeResponse, RuntimesListResponse } from '../types/runtimes';
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<RuntimesListResponse>;
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<Runtime>;
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<Runtime>;
54
+ export declare const updateRuntime: (token: string, podName: string, from: string, baseUrl?: string) => Promise<RuntimeData>;
@@ -1,4 +1,4 @@
1
- import { CreateRuntimeSnapshotRequest, SnapshotsListResponse, SnapshotGetResponse, SnapshotCreateResponse } from '../types/runtimes';
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<SnapshotCreateResponse>;
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<SnapshotsListResponse>;
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<SnapshotGetResponse>;
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 { CollaborationSessionResponse } from '../types/spacer';
1
+ import { CollaborationSessionResponse } from '../../models/SpaceDTO';
2
2
  /**
3
3
  * Get collaboration session ID for a document.
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { HealthzPingResponse } from '../types/common';
1
+ import type { HealthzPingResponse } from '../../models/Common';
2
2
  /**
3
3
  * Health check ping endpoint for Spacer service
4
4
  * @param baseUrl - Base URL for the API (defaults to production Spacer URL)
@@ -1,4 +1,4 @@
1
- import { DeleteSpaceItemResponse, GetSpaceItemResponse, GetSpaceItemsResponse } from '../types/spacer';
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 '../types/spacer';
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 '../types/spacer';
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
@@ -1,4 +1,4 @@
1
- import { CreateSpaceRequest, CreateSpaceResponse } from '../types/spacer';
1
+ import { CreateSpaceRequest, CreateSpaceResponse } from '../../models/SpaceDTO';
2
2
  /**
3
3
  * Create a new workspace space.
4
4
  * @param token - Authentication token
@@ -1,4 +1,4 @@
1
- import { SpacesForUserResponse } from '../types/spacer';
1
+ import { SpacesForUserResponse } from '../../models/SpaceDTO';
2
2
  /**
3
3
  * Get all spaces for the current authenticated user.
4
4
  * @param token - Authentication token
@@ -1,4 +1,4 @@
1
- import { Environment } from './models/Environment';
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: Environment[];
35
+ readonly environments: EnvironmentDTO[];
36
36
  /** Method lifecycle handlers */
37
37
  readonly handlers?: SDKHandlers;
38
38
  /**
@@ -15,15 +15,15 @@
15
15
  * ```
16
16
  */
17
17
  import { DatalayerClientBase, type DatalayerClientConfig, type SDKHandlers } from './base';
18
- import type { User } from './models/User';
19
- import type { Credits } from './models/Credits';
20
- import type { Environment } from './models/Environment';
21
- import type { Runtime } from './models/Runtime';
22
- import type { Snapshot } from './models/Snapshot';
23
- import type { Space } from './models/Space';
24
- import type { Notebook } from './models/Notebook';
25
- import type { Lexical } from './models/Lexical';
26
- import type { HealthCheck } from './models/HealthCheck';
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 './models/User';
56
- export type { UserJSON } from './models/User';
57
- export { Runtime } from './models/Runtime';
58
- export type { RuntimeJSON } from './models/Runtime';
59
- export { Environment } from './models/Environment';
60
- export type { EnvironmentJSON } from './models/Environment';
61
- export { Snapshot } from './models/Snapshot';
62
- export { Space } from './models/Space';
63
- export { Notebook } from './models/Notebook';
64
- export { Lexical } from './models/Lexical';
65
- export { Credits } from './models/Credits';
66
- export { Item } from './models/Item';
67
- export { HealthCheck } from './models/HealthCheck';
68
- export type { HealthCheckJSON } from './models/HealthCheck';
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<User>;
75
- login(token: string): Promise<User>;
74
+ whoami(): Promise<UserDTO>;
75
+ login(token: string): Promise<UserDTO>;
76
76
  logout(): Promise<void>;
77
- getCredits(): Promise<Credits>;
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<Environment[]>;
82
- ensureRuntime(environmentName?: string, creditsLimit?: number, waitForReady?: boolean, maxWaitTime?: number, reuseExisting?: boolean, snapshotId?: string): Promise<Runtime>;
83
- createRuntime(environmentName: string, type: 'notebook' | 'terminal' | 'job', givenName: string, minutesLimit: number, fromSnapshotId?: string): Promise<Runtime>;
84
- listRuntimes(): Promise<Runtime[]>;
85
- getRuntime(podName: string): Promise<Runtime>;
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<Snapshot>;
89
- listSnapshots(): Promise<Snapshot[]>;
90
- getSnapshot(id: string): Promise<Snapshot>;
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<Space[]>;
94
- createSpace(name: string, description: string, variant: string, spaceHandle: string, organizationId: string, seedSpaceId: string, isPublic: boolean): Promise<Space>;
95
- createNotebook(spaceId: string, name: string, description: string, file?: File | Blob): Promise<Notebook>;
96
- getNotebook(id: string): Promise<Notebook>;
97
- updateNotebook(id: string, name?: string, description?: string): Promise<Notebook>;
98
- createLexical(spaceId: string, name: string, description: string, file?: File | Blob): Promise<Lexical>;
99
- getLexical(id: string): Promise<Lexical>;
100
- updateLexical(id: string, name?: string, description?: string): Promise<Lexical>;
101
- getSpaceItems(spaceId: string): Promise<(Notebook | Lexical)[]>;
102
- getSpaceItem(itemId: string): Promise<Notebook | Lexical>;
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>;
@@ -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 './models/User';
69
- export { Runtime } from './models/Runtime';
70
- export { Environment } from './models/Environment';
71
- export { Snapshot } from './models/Snapshot';
72
- export { Space } from './models/Space';
73
- export { Notebook } from './models/Notebook';
74
- export { Lexical } from './models/Lexical';
75
- export { Credits } from './models/Credits';
76
- export { Item } from './models/Item';
77
- export { HealthCheck } from './models/HealthCheck';
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 { User } from '../models/User';
3
- import { Credits } from '../models/Credits';
4
- import { HealthCheck } from '../models/HealthCheck';
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?: User;
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<User>;
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<User>;
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<Credits>;
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 { User } from '../models/User';
13
- import { Credits } from '../models/Credits';
14
- import { HealthCheck } from '../models/HealthCheck';
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 User(userData, this);
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 Credits(response.credits, response.reservations || []);
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 { Environment } from '../models/Environment';
3
- import { Runtime } from '../models/Runtime';
4
- import { Snapshot } from '../models/Snapshot';
5
- import { HealthCheck } from '../models/HealthCheck';
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 | Runtime): string;
25
- _extractSnapshotId(snapshotIdOrInstance: string | Snapshot): 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<Environment[]>;
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<Runtime>;
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<Runtime[]>;
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<Runtime>;
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<Snapshot>;
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<Snapshot[]>;
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<Snapshot>;
81
+ getSnapshot(id: string): Promise<RuntimeSnapshotDTO>;
82
82
  /**
83
83
  * Delete a snapshot permanently.
84
84
  * @param id - Snapshot ID