@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
@@ -9,10 +9,10 @@
9
9
  import * as environments from '../../api/runtimes/environments';
10
10
  import * as runtimes from '../../api/runtimes/runtimes';
11
11
  import * as snapshots from '../../api/runtimes/snapshots';
12
- import { Environment } from '../models/Environment';
13
- import { Runtime } from '../models/Runtime';
14
- import { Snapshot } from '../models/Snapshot';
15
- import { HealthCheck } from '../models/HealthCheck';
12
+ import { EnvironmentDTO } from '../../models/EnvironmentDTO';
13
+ import { RuntimeDTO } from '../../models/RuntimeDTO';
14
+ import { RuntimeSnapshotDTO } from '../../models/RuntimeSnapshotDTO';
15
+ import { HealthCheck } from '../../models/HealthCheck';
16
16
  /** Runtimes mixin providing computational environment and runtime management. */
17
17
  export function RuntimesMixin(Base) {
18
18
  return class extends Base {
@@ -41,7 +41,7 @@ export function RuntimesMixin(Base) {
41
41
  const runtimesRunUrl = this.getRuntimesRunUrl();
42
42
  const response = await environments.listEnvironments(token, runtimesRunUrl);
43
43
  // Save for later use after first call
44
- this.environments = response.environments.map(env => new Environment(env, this));
44
+ this.environments = response.environments.map(env => new EnvironmentDTO(env, this));
45
45
  return this.environments;
46
46
  }
47
47
  // ========================================================================
@@ -76,7 +76,7 @@ export function RuntimesMixin(Base) {
76
76
  from: fromSnapshotId,
77
77
  };
78
78
  const response = await runtimes.createRuntime(token, data, runtimesRunUrl);
79
- return new Runtime(response.runtime, this);
79
+ return new RuntimeDTO(response.runtime, this);
80
80
  }
81
81
  }
82
82
  else {
@@ -91,7 +91,7 @@ export function RuntimesMixin(Base) {
91
91
  const token = this.getToken();
92
92
  const runtimesRunUrl = this.getRuntimesRunUrl();
93
93
  const response = await runtimes.listRuntimes(token, runtimesRunUrl);
94
- return response.runtimes.map(r => new Runtime(r, this));
94
+ return response.runtimes.map(r => new RuntimeDTO(r, this));
95
95
  }
96
96
  /**
97
97
  * Get details for a specific runtime by pod name.
@@ -102,7 +102,7 @@ export function RuntimesMixin(Base) {
102
102
  const token = this.getToken();
103
103
  const runtimesRunUrl = this.getRuntimesRunUrl();
104
104
  const runtimeData = await runtimes.getRuntime(token, podName, runtimesRunUrl);
105
- return new Runtime(runtimeData, this);
105
+ return new RuntimeDTO(runtimeData, this);
106
106
  }
107
107
  /**
108
108
  * Delete a runtime permanently.
@@ -148,7 +148,7 @@ export function RuntimesMixin(Base) {
148
148
  stop,
149
149
  };
150
150
  const response = await snapshots.createSnapshot(token, data, runtimesRunUrl);
151
- return new Snapshot(response.snapshot, this);
151
+ return new RuntimeSnapshotDTO(response.snapshot, this);
152
152
  }
153
153
  /**
154
154
  * List all runtime snapshots.
@@ -158,7 +158,7 @@ export function RuntimesMixin(Base) {
158
158
  const token = this.getToken();
159
159
  const runtimesRunUrl = this.getRuntimesRunUrl();
160
160
  const response = await snapshots.listSnapshots(token, runtimesRunUrl);
161
- return response.snapshots.map(s => new Snapshot(s, this));
161
+ return response.snapshots.map(s => new RuntimeSnapshotDTO(s, this));
162
162
  }
163
163
  /**
164
164
  * Get details for a specific snapshot by ID.
@@ -169,7 +169,7 @@ export function RuntimesMixin(Base) {
169
169
  const token = this.getToken();
170
170
  const runtimesRunUrl = this.getRuntimesRunUrl();
171
171
  const response = await snapshots.getSnapshot(token, id, runtimesRunUrl);
172
- return new Snapshot(response.snapshot, this);
172
+ return new RuntimeSnapshotDTO(response.snapshot, this);
173
173
  }
174
174
  /**
175
175
  * Delete a snapshot permanently.
@@ -1,8 +1,8 @@
1
1
  import type { Constructor } from '../utils/mixins';
2
- import { Notebook } from '../models/Notebook';
3
- import { Lexical } from '../models/Lexical';
4
- import { Space } from '../models/Space';
5
- import { HealthCheck } from '../models/HealthCheck';
2
+ import { NotebookDTO } from '../../models/NotebookDTO';
3
+ import { LexicalDTO } from '../../models/LexicalDTO';
4
+ import { SpaceDTO } from '../../models/SpaceDTO';
5
+ import { HealthCheck } from '../../models/HealthCheck';
6
6
  /** Options for content loading with CDN support. */
7
7
  export interface ContentLoadingOptions {
8
8
  /** Whether to try CDN first before API (default: true) */
@@ -17,7 +17,7 @@ export declare function SpacerMixin<TBase extends Constructor>(Base: TBase): {
17
17
  * Get all workspaces for the authenticated user.
18
18
  * @returns Array of Space instances
19
19
  */
20
- getMySpaces(): Promise<Space[]>;
20
+ getMySpaces(): Promise<SpaceDTO[]>;
21
21
  /**
22
22
  * Create a new workspace.
23
23
  * @param name - Space name
@@ -29,7 +29,7 @@ export declare function SpacerMixin<TBase extends Constructor>(Base: TBase): {
29
29
  * @param isPublic - Whether the space is public
30
30
  * @returns Created Space instance
31
31
  */
32
- createSpace(name: string, description: string, variant: string, spaceHandle: string, organizationId: string, seedSpaceId: string, isPublic: boolean): Promise<Space>;
32
+ createSpace(name: string, description: string, variant: string, spaceHandle: string, organizationId: string, seedSpaceId: string, isPublic: boolean): Promise<SpaceDTO>;
33
33
  /**
34
34
  * Create a new notebook.
35
35
  * @param spaceId - ID of the space to create the notebook in
@@ -38,13 +38,13 @@ export declare function SpacerMixin<TBase extends Constructor>(Base: TBase): {
38
38
  * @param file - Optional file for notebook content
39
39
  * @returns Created Notebook instance
40
40
  */
41
- createNotebook(spaceId: string, name: string, description: string, file?: File | Blob): Promise<Notebook>;
41
+ createNotebook(spaceId: string, name: string, description: string, file?: File | Blob): Promise<NotebookDTO>;
42
42
  /**
43
43
  * Get a notebook by ID.
44
44
  * @param id - Notebook ID
45
45
  * @returns Notebook instance
46
46
  */
47
- getNotebook(id: string): Promise<Notebook>;
47
+ getNotebook(id: string): Promise<NotebookDTO>;
48
48
  /**
49
49
  * Update a notebook.
50
50
  * @param id - Notebook ID
@@ -52,7 +52,7 @@ export declare function SpacerMixin<TBase extends Constructor>(Base: TBase): {
52
52
  * @param description - Optional new description for the notebook
53
53
  * @returns Updated Notebook instance
54
54
  */
55
- updateNotebook(id: string, name?: string, description?: string): Promise<Notebook>;
55
+ updateNotebook(id: string, name?: string, description?: string): Promise<NotebookDTO>;
56
56
  /**
57
57
  * Create a new lexical document.
58
58
  * @param spaceId - ID of the space to create the lexical document in
@@ -61,13 +61,13 @@ export declare function SpacerMixin<TBase extends Constructor>(Base: TBase): {
61
61
  * @param file - Optional file for document content
62
62
  * @returns Created Lexical instance
63
63
  */
64
- createLexical(spaceId: string, name: string, description: string, file?: File | Blob): Promise<Lexical>;
64
+ createLexical(spaceId: string, name: string, description: string, file?: File | Blob): Promise<LexicalDTO>;
65
65
  /**
66
66
  * Get a lexical document by ID.
67
67
  * @param id - Document ID
68
68
  * @returns Lexical instance
69
69
  */
70
- getLexical(id: string): Promise<Lexical>;
70
+ getLexical(id: string): Promise<LexicalDTO>;
71
71
  /**
72
72
  * Update a lexical document.
73
73
  * @param id - Document ID
@@ -75,20 +75,20 @@ export declare function SpacerMixin<TBase extends Constructor>(Base: TBase): {
75
75
  * @param description - Optional new description for the lexical document
76
76
  * @returns Updated Lexical instance
77
77
  */
78
- updateLexical(id: string, name?: string, description?: string): Promise<Lexical>;
78
+ updateLexical(id: string, name?: string, description?: string): Promise<LexicalDTO>;
79
79
  /**
80
80
  * Get the items of a space as model instances.
81
81
  * @param spaceId - Space ID
82
82
  * @returns Array of Notebook and Lexical model instances
83
83
  */
84
- getSpaceItems(spaceId: string): Promise<(Notebook | Lexical)[]>;
84
+ getSpaceItems(spaceId: string): Promise<(NotebookDTO | LexicalDTO)[]>;
85
85
  /**
86
86
  * Get a single item from a space.
87
87
  * @param itemId - Item ID to retrieve
88
88
  * @returns Notebook or Lexical model instance
89
89
  * @throws Error if item not found
90
90
  */
91
- getSpaceItem(itemId: string): Promise<Notebook | Lexical>;
91
+ getSpaceItem(itemId: string): Promise<NotebookDTO | LexicalDTO>;
92
92
  /**
93
93
  * Delete an item from a space.
94
94
  * @param itemId - Item ID to delete
@@ -12,10 +12,10 @@ import * as users from '../../api/spacer/users';
12
12
  import * as lexicals from '../../api/spacer/lexicals';
13
13
  import * as documents from '../../api/spacer/documents';
14
14
  import * as items from '../../api/spacer/items';
15
- import { Notebook } from '../models/Notebook';
16
- import { Lexical } from '../models/Lexical';
17
- import { Space } from '../models/Space';
18
- import { HealthCheck } from '../models/HealthCheck';
15
+ import { NotebookDTO } from '../../models/NotebookDTO';
16
+ import { LexicalDTO } from '../../models/LexicalDTO';
17
+ import { SpaceDTO } from '../../models/SpaceDTO';
18
+ import { HealthCheck } from '../../models/HealthCheck';
19
19
  import { convertSpaceItemsToModels } from '../utils/spacerUtils';
20
20
  /** Spacer mixin providing workspace and content management. */
21
21
  export function SpacerMixin(Base) {
@@ -31,7 +31,7 @@ export function SpacerMixin(Base) {
31
31
  const token = this.getToken();
32
32
  const spacerRunUrl = this.getSpacerRunUrl();
33
33
  const response = await users.getMySpaces(token, spacerRunUrl);
34
- return response.spaces.map(s => new Space(s, this));
34
+ return response.spaces.map(s => new SpaceDTO(s, this));
35
35
  }
36
36
  // ========================================================================
37
37
  // Spaces
@@ -63,7 +63,7 @@ export function SpacerMixin(Base) {
63
63
  if (!response.space) {
64
64
  throw new Error('Failed to create space: no space returned');
65
65
  }
66
- return new Space(response.space, this);
66
+ return new SpaceDTO(response.space, this);
67
67
  }
68
68
  // ========================================================================
69
69
  // Notebooks
@@ -102,7 +102,7 @@ export function SpacerMixin(Base) {
102
102
  if (!response.notebook) {
103
103
  throw new Error(`Notebook with ID '${id}' not found`);
104
104
  }
105
- return new Notebook(response.notebook, this);
105
+ return new NotebookDTO(response.notebook, this);
106
106
  }
107
107
  /**
108
108
  * Update a notebook.
@@ -123,7 +123,7 @@ export function SpacerMixin(Base) {
123
123
  if (!response.notebook) {
124
124
  throw new Error('Failed to update notebook: no notebook returned');
125
125
  }
126
- return new Notebook(response.notebook, this);
126
+ return new NotebookDTO(response.notebook, this);
127
127
  }
128
128
  // ========================================================================
129
129
  // Lexicals
@@ -162,7 +162,7 @@ export function SpacerMixin(Base) {
162
162
  if (!response.document) {
163
163
  throw new Error(`Lexical document with ID '${id}' not found`);
164
164
  }
165
- return new Lexical(response.document, this);
165
+ return new LexicalDTO(response.document, this);
166
166
  }
167
167
  /**
168
168
  * Update a lexical document.
@@ -180,7 +180,7 @@ export function SpacerMixin(Base) {
180
180
  if (description !== undefined)
181
181
  data.description = description;
182
182
  const response = await lexicals.updateLexical(token, id, data, spacerRunUrl);
183
- return new Lexical(response.document, this);
183
+ return new LexicalDTO(response.document, this);
184
184
  }
185
185
  // ========================================================================
186
186
  // Items
@@ -213,11 +213,11 @@ export function SpacerMixin(Base) {
213
213
  // Determine item type and create appropriate model
214
214
  const item = response.item;
215
215
  if (item.type_s === 'notebook' || item.notebook_name_s !== undefined) {
216
- return new Notebook(item, this);
216
+ return new NotebookDTO(item, this);
217
217
  }
218
218
  else if (item.type_s === 'lexical' ||
219
219
  item.document_name_s !== undefined) {
220
- return new Lexical(item, this);
220
+ return new LexicalDTO(item, this);
221
221
  }
222
222
  else {
223
223
  throw new Error(`Unknown item type for item '${itemId}'`);
@@ -2,10 +2,10 @@
2
2
  * Utility functions for Spacer-related operations to avoid code duplication.
3
3
  * @module client/utils/spacerUtils
4
4
  */
5
- import type { GetSpaceItemsResponse } from '../../api/types/spacer';
5
+ import type { GetSpaceItemsResponse } from '../../models/SpaceDTO';
6
6
  import type { DatalayerClient } from '../index';
7
- import { Notebook } from '../models/Notebook';
8
- import { Lexical } from '../models/Lexical';
7
+ import { NotebookDTO } from '../../models/NotebookDTO';
8
+ import { LexicalDTO } from '../../models/LexicalDTO';
9
9
  /**
10
10
  * Convert raw space items from API response to model instances.
11
11
  * This utility function is shared between Space.getItems() and SpacerMixin.getSpaceItems()
@@ -15,4 +15,4 @@ import { Lexical } from '../models/Lexical';
15
15
  * @param sdk - SDK instance to pass to model constructors
16
16
  * @returns Array of Notebook and Lexical model instances
17
17
  */
18
- export declare function convertSpaceItemsToModels(items: GetSpaceItemsResponse['items'], sdk: DatalayerClient): (Notebook | Lexical)[];
18
+ export declare function convertSpaceItemsToModels(items: GetSpaceItemsResponse['items'], sdk: DatalayerClient): (NotebookDTO | LexicalDTO)[];
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- import { Notebook } from '../models/Notebook';
6
- import { Lexical } from '../models/Lexical';
5
+ import { NotebookDTO } from '../../models/NotebookDTO';
6
+ import { LexicalDTO } from '../../models/LexicalDTO';
7
7
  import { ItemTypes } from '../constants';
8
8
  /**
9
9
  * Convert raw space items from API response to model instances.
@@ -21,10 +21,10 @@ export function convertSpaceItemsToModels(items, sdk) {
21
21
  const itemType = item.type_s;
22
22
  // Only include notebooks and lexicals
23
23
  if (itemType === ItemTypes.NOTEBOOK) {
24
- modelItems.push(new Notebook(item, sdk));
24
+ modelItems.push(new NotebookDTO(item, sdk));
25
25
  }
26
26
  else if (itemType === ItemTypes.LEXICAL) {
27
- modelItems.push(new Lexical(item, sdk));
27
+ modelItems.push(new LexicalDTO(item, sdk));
28
28
  }
29
29
  // Skip everything else (exercises, cells, etc.)
30
30
  }
@@ -50,7 +50,7 @@ export function RuntimeLauncherDialog(props) {
50
50
  const jupyterLabAdapter = jupyterReactStore.jupyterLabAdapter;
51
51
  const [selection, setSelection] = useState((kernelSnapshot?.environment || environments[0]?.name) ?? '');
52
52
  const [timeLimit, setTimeLimit] = useState(Math.min(credits?.available ?? 0, 10));
53
- const [runtimeName, setRuntimeName] = useState(environments[0]?.kernel?.givenNameTemplate || environments[0]?.title || '');
53
+ const [runtimeName, setRuntimeName] = useState(environments[0]?.runtime?.givenNameTemplate || environments[0]?.title || '');
54
54
  // Whether the runtim name has been changed by the user or not
55
55
  const [hasCustomRuntimeName, setHasCustomRuntimeName] = useState(false);
56
56
  const [userStorage, setUserStorage] = useState(false);
@@ -75,7 +75,7 @@ export function RuntimeLauncherDialog(props) {
75
75
  setSelection(selection);
76
76
  if (!hasCustomRuntimeName) {
77
77
  const spec = environments.find(env => env.name === selection);
78
- setRuntimeName(spec?.kernel?.givenNameTemplate || spec?.title || '');
78
+ setRuntimeName(spec?.runtime?.givenNameTemplate || spec?.title || '');
79
79
  }
80
80
  }, [setSelection, hasCustomRuntimeName]);
81
81
  const handleSubmitRuntime = useCallback(async () => {
@@ -61,7 +61,7 @@ export function RuntimePickerCell(props) {
61
61
  }, [preference]);
62
62
  const setSelectedRuntimeDesc = useCallback((kernel) => {
63
63
  const datalayerMeta = model.getMetadata('datalayer') ?? {
64
- kernel: undefined,
64
+ runtime: undefined,
65
65
  };
66
66
  if (!kernel) {
67
67
  delete datalayerMeta.kernel;
@@ -120,7 +120,7 @@ export function RuntimePickerNotebook(props) {
120
120
  : undefined;
121
121
  setValue(creditsLimit !== 0
122
122
  ? {
123
- kernel: selectedRuntimeDesc
123
+ runtime: selectedRuntimeDesc
124
124
  ? {
125
125
  environmentName: ['browser', 'remote'].includes(selectedRuntimeDesc.location)
126
126
  ? `${selectedRuntimeDesc.location}-${selectedRuntimeDesc.name}`
@@ -3,7 +3,7 @@ export interface RuntimeTransfer {
3
3
  /**
4
4
  * Selected Kernel.
5
5
  */
6
- kernel: Partial<Omit<IRuntimeOptions, 'kernelType'> & {
6
+ runtime: Partial<Omit<IRuntimeOptions, 'kernelType'> & {
7
7
  id: string;
8
8
  }> | null;
9
9
  /**
package/lib/index.d.ts CHANGED
@@ -7,9 +7,8 @@ export * from './hooks';
7
7
  export { requestDatalayerAPI, RunResponseError, NetworkError, } from './api/DatalayerApi';
8
8
  export type { IRequestDatalayerAPIOptions } from './api/DatalayerApi';
9
9
  export { API_BASE_PATHS } from './api/constants';
10
- export * from './api/types';
11
10
  export * as runtimesApi from './api/runtimes';
12
11
  export * as iamApi from './api/iam';
13
12
  export * as spacerApi from './api/spacer';
14
- export { DatalayerClient, type DatalayerClientConfig, type SDKHandlers, User, Runtime, Environment, Snapshot, Space, Notebook, Lexical, Credits, Item, type RuntimeJSON, type EnvironmentJSON, type UserJSON, } from './client';
13
+ export { DatalayerClient, type DatalayerClientConfig, type SDKHandlers, User, Runtime, Environment, Snapshot, Space, Notebook, LexicalDTO, Credits, Item, type RuntimeJSON, type EnvironmentJSON, type UserJSON, } from './client';
15
14
  export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './stateful/runtimes/actions';
package/lib/index.js CHANGED
@@ -12,12 +12,11 @@ export * from './hooks';
12
12
  // Export API and SDK layers
13
13
  export { requestDatalayerAPI, RunResponseError, NetworkError, } from './api/DatalayerApi';
14
14
  export { API_BASE_PATHS } from './api/constants';
15
- export * from './api/types';
16
15
  export * as runtimesApi from './api/runtimes';
17
16
  export * as iamApi from './api/iam';
18
17
  export * as spacerApi from './api/spacer';
19
18
  export { DatalayerClient,
20
19
  // Export SDK models
21
- User, Runtime, Environment, Snapshot, Space, Notebook, Lexical, Credits, Item, } from './client';
20
+ User, Runtime, Environment, Snapshot, Space, Notebook, LexicalDTO, Credits, Item, } from './client';
22
21
  // Export commonly used SDK functions directly for convenience
23
22
  export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './stateful/runtimes/actions';
@@ -1,9 +1,42 @@
1
1
  /**
2
- * Credits model for the Datalayer SDK.
3
- *
4
- * @module client/models/Credits
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.
5
14
  */
6
- import type { CreditsInfo, CreditReservation } from '../../api/iam/usage';
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
+ }
7
40
  /**
8
41
  * Credits model representing user's available credits and usage.
9
42
  *
@@ -17,7 +50,7 @@ import type { CreditsInfo, CreditReservation } from '../../api/iam/usage';
17
50
  * const maxMinutes = credits.calculateMaxRuntimeMinutes(environment.burningRate);
18
51
  * ```
19
52
  */
20
- export declare class Credits {
53
+ export declare class CreditsDTO {
21
54
  /** @internal */
22
55
  _data: CreditsInfo;
23
56
  private _reservations;
@@ -2,7 +2,12 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- import { validateJSON } from '../../api/utils/validation';
5
+ /**
6
+ * Credits model for the Datalayer SDK.
7
+ *
8
+ * @module models/CreditsDTO
9
+ */
10
+ import { validateJSON } from '../api/utils/validation';
6
11
  /**
7
12
  * Credits model representing user's available credits and usage.
8
13
  *
@@ -16,7 +21,7 @@ import { validateJSON } from '../../api/utils/validation';
16
21
  * const maxMinutes = credits.calculateMaxRuntimeMinutes(environment.burningRate);
17
22
  * ```
18
23
  */
19
- export class Credits {
24
+ export class CreditsDTO {
20
25
  /** @internal */
21
26
  _data;
22
27
  _reservations;
@@ -60,7 +60,7 @@ export interface IDatalayerEnvironment {
60
60
  /**
61
61
  * Associate kernel attributes
62
62
  */
63
- kernel?: {
63
+ runtime?: {
64
64
  /**
65
65
  * Proposed display name
66
66
  */
@@ -1,10 +1,50 @@
1
1
  /**
2
2
  * Environment domain model for the Datalayer SDK.
3
3
  *
4
- * @module client/models/Environment
4
+ * @module models/EnvironmentDTO
5
5
  */
6
- import type { Environment as EnvironmentData } from '../../api/types/runtimes';
7
6
  import type { DatalayerClient } from '../index';
7
+ /**
8
+ * Represents a computing environment available in the Datalayer platform.
9
+ * @interface EnvironmentData
10
+ */
11
+ export interface EnvironmentData {
12
+ /** Human-readable title for the environment */
13
+ title: string;
14
+ /** Detailed description of the environment */
15
+ description: string;
16
+ /** Docker image used for this environment */
17
+ dockerImage: string;
18
+ /** Example usage or description */
19
+ example?: string;
20
+ /** Code snippets for this environment */
21
+ snippets?: any[];
22
+ /** Content mounts for this environment */
23
+ contents?: any[];
24
+ /** Kernel configuration */
25
+ runtime?: {
26
+ /** Template for kernel naming */
27
+ givenNameTemplate?: string;
28
+ };
29
+ /** Programming language (e.g., "python", "r") */
30
+ language: string;
31
+ /** Resource ranges configuration */
32
+ resourcesRanges?: any;
33
+ /** Credits consumed per hour when running */
34
+ burning_rate: number;
35
+ /** Simple resource specification */
36
+ resources?: any;
37
+ /** Name identifier for the environment */
38
+ name: string;
39
+ /** Docker registry for the image */
40
+ dockerRegistry?: string;
41
+ /** Icon or avatar URL for the environment */
42
+ icon?: string;
43
+ /** Whether the environment is enabled */
44
+ enabled?: boolean;
45
+ /** Tags associated with the environment */
46
+ tags?: string[];
47
+ }
8
48
  /**
9
49
  * Stable public interface for Environment data.
10
50
  * This is the contract that SDK consumers can rely on.
@@ -22,6 +62,18 @@ export interface EnvironmentJSON {
22
62
  /** Rich description of the environment (contains HTML markup) */
23
63
  richDescription: string;
24
64
  }
65
+ /**
66
+ * Response from listing available environments
67
+ * @interface ListEnvironmentsResponse
68
+ */
69
+ export interface ListEnvironmentsResponse {
70
+ /** Whether the request was successful */
71
+ success: boolean;
72
+ /** Response message from the server */
73
+ message: string;
74
+ /** Array of available environments */
75
+ environments: EnvironmentData[];
76
+ }
25
77
  /**
26
78
  * Environment domain model that wraps API responses with convenient methods.
27
79
  * Provides information about available computational environments.
@@ -33,7 +85,7 @@ export interface EnvironmentJSON {
33
85
  * console.log(aiEnv.title); // "AI Environment"
34
86
  * ```
35
87
  */
36
- export declare class Environment {
88
+ export declare class EnvironmentDTO {
37
89
  /** @internal */
38
90
  _data: EnvironmentData;
39
91
  /**
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- import { validateJSON } from '../../api/utils/validation';
5
+ import { validateJSON } from '../api/utils/validation';
6
6
  /**
7
7
  * Environment domain model that wraps API responses with convenient methods.
8
8
  * Provides information about available computational environments.
@@ -14,7 +14,7 @@ import { validateJSON } from '../../api/utils/validation';
14
14
  * console.log(aiEnv.title); // "AI Environment"
15
15
  * ```
16
16
  */
17
- export class Environment {
17
+ export class EnvironmentDTO {
18
18
  /** @internal */
19
19
  _data;
20
20
  /**
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- import { validateJSON } from '../../api/utils/validation';
5
+ import { validateJSON } from '../api/utils/validation';
6
6
  /**
7
7
  * Represents a health check response from a Datalayer service.
8
8
  * Provides standardized health status information across all services.