@datalayer/core 0.0.27 → 1.0.2

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 (62) hide show
  1. package/lib/api/index.d.ts +1 -1
  2. package/lib/api/index.js +1 -1
  3. package/lib/api/spacer/index.d.ts +1 -2
  4. package/lib/api/spacer/index.js +1 -2
  5. package/lib/client/utils/spacerUtils.d.ts +2 -2
  6. package/lib/client/utils/spacerUtils.js +4 -4
  7. package/lib/components/avatars/BoringAvatar.d.ts +3 -1
  8. package/lib/components/avatars/BoringAvatar.js +15 -14
  9. package/lib/components/avatars/BoringAvatar.stories.d.ts +2 -1
  10. package/lib/components/storage/ContentsBrowser.d.ts +6 -0
  11. package/lib/components/storage/ContentsBrowser.js +9 -10
  12. package/lib/hooks/index.d.ts +2 -0
  13. package/lib/hooks/index.js +2 -0
  14. package/lib/hooks/useCache.d.ts +11 -32
  15. package/lib/hooks/useCache.js +54 -226
  16. package/lib/hooks/useProjectStore.d.ts +58 -0
  17. package/lib/hooks/useProjectStore.js +64 -0
  18. package/lib/hooks/useProjects.d.ts +590 -0
  19. package/lib/hooks/useProjects.js +166 -0
  20. package/lib/index.d.ts +0 -1
  21. package/lib/index.js +0 -2
  22. package/lib/models/CreditsDTO.d.ts +1 -1
  23. package/lib/models/CreditsDTO.js +1 -1
  24. package/lib/models/Datasource.d.ts +4 -4
  25. package/lib/models/Datasource.js +7 -7
  26. package/lib/models/EnvironmentDTO.d.ts +3 -3
  27. package/lib/models/EnvironmentDTO.js +3 -3
  28. package/lib/models/HealthCheck.d.ts +2 -2
  29. package/lib/models/HealthCheck.js +2 -2
  30. package/lib/models/ItemDTO.d.ts +3 -3
  31. package/lib/models/ItemDTO.js +10 -10
  32. package/lib/models/LexicalDTO.d.ts +3 -3
  33. package/lib/models/LexicalDTO.js +4 -4
  34. package/lib/models/NotebookDTO.d.ts +3 -3
  35. package/lib/models/NotebookDTO.js +6 -6
  36. package/lib/models/Page.d.ts +2 -0
  37. package/lib/models/RuntimeDTO.d.ts +4 -4
  38. package/lib/models/RuntimeDTO.js +9 -9
  39. package/lib/models/RuntimeSnapshotDTO.d.ts +3 -3
  40. package/lib/models/RuntimeSnapshotDTO.js +7 -7
  41. package/lib/models/Secret.d.ts +4 -4
  42. package/lib/models/Secret.js +7 -7
  43. package/lib/models/Space.js +3 -0
  44. package/lib/models/SpaceDTO.d.ts +3 -3
  45. package/lib/models/SpaceDTO.js +14 -14
  46. package/lib/models/UserDTO.d.ts +2 -2
  47. package/lib/models/UserDTO.js +2 -2
  48. package/lib/views/iam-tokens/Tokens.js +1 -1
  49. package/lib/views/secrets/Secrets.js +1 -1
  50. package/package.json +1 -1
  51. package/lib/api/spacer/agentSpaces.d.ts +0 -193
  52. package/lib/api/spacer/agentSpaces.js +0 -127
  53. package/lib/theme/DatalayerTheme.d.ts +0 -52
  54. package/lib/theme/DatalayerTheme.js +0 -228
  55. package/lib/theme/DatalayerThemeProvider.d.ts +0 -29
  56. package/lib/theme/DatalayerThemeProvider.js +0 -54
  57. package/lib/theme/Palette.d.ts +0 -4
  58. package/lib/theme/Palette.js +0 -10
  59. package/lib/theme/index.d.ts +0 -4
  60. package/lib/theme/index.js +0 -8
  61. package/lib/theme/useSystemColorMode.d.ts +0 -9
  62. package/lib/theme/useSystemColorMode.js +0 -26
@@ -0,0 +1,166 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Hook for fetching and managing projects.
7
+ *
8
+ * Projects are backed by the Spacer service as spaces with type_s="project".
9
+ * Projects persist forever — only agents can terminate.
10
+ *
11
+ * Free tier limits: max 3 projects per user.
12
+ *
13
+ * @module hooks/useProjects
14
+ */
15
+ import { useMemo, useCallback } from 'react';
16
+ import { useCache } from './useCache';
17
+ /** The space type value used to identify project spaces in Solr */
18
+ export const PROJECT_SPACE_VARIANT = 'project';
19
+ /**
20
+ * Hook to fetch user's projects (spaces with type "project").
21
+ *
22
+ * Uses the spacer service's spaces endpoint filtered by type.
23
+ */
24
+ export function useProjects() {
25
+ const { useUserSpaces } = useCache();
26
+ const { data: allSpaces, ...rest } = useUserSpaces();
27
+ // Filter to only project-type spaces
28
+ const projects = useMemo(() => {
29
+ if (!allSpaces)
30
+ return [];
31
+ return allSpaces
32
+ .filter((space) => space.variant === PROJECT_SPACE_VARIANT ||
33
+ space.type_s === PROJECT_SPACE_VARIANT)
34
+ .map((space) => ({
35
+ uid: space.uid,
36
+ id: space.id ?? space.uid,
37
+ handle: space.handle ?? space.handle_s,
38
+ name: space.name ?? space.name_t,
39
+ description: space.description ?? space.description_t ?? '',
40
+ createdAt: space.created_at ? new Date(space.created_at) : new Date(),
41
+ isPublic: space.public ?? space.public_b ?? false,
42
+ attachedAgentPodName: space.attached_agent_pod_name_s || undefined,
43
+ attachedAgentSpecId: space.attached_agent_spec_id_s || undefined,
44
+ }));
45
+ }, [allSpaces]);
46
+ return { data: projects, ...rest };
47
+ }
48
+ /**
49
+ * Hook to fetch a single project by UID.
50
+ */
51
+ export function useProject(uid) {
52
+ const { useSpace } = useCache();
53
+ // useSpace requires a string – pass empty string when uid is undefined
54
+ // (the query is disabled when spaceId is falsy inside useCache)
55
+ const { data: space, ...rest } = useSpace(uid ?? '');
56
+ const project = useMemo(() => {
57
+ if (!space)
58
+ return undefined;
59
+ const s = space;
60
+ return {
61
+ uid: s.uid,
62
+ id: s.id ?? s.uid,
63
+ handle: s.handle ?? s.handle_s,
64
+ name: s.name ?? s.name_t,
65
+ description: s.description ?? s.description_t ?? '',
66
+ createdAt: s.created_at ? new Date(s.created_at) : new Date(),
67
+ isPublic: s.public ?? s.public_b ?? false,
68
+ attachedAgentPodName: s.attached_agent_pod_name_s || undefined,
69
+ attachedAgentSpecId: s.attached_agent_spec_id_s || undefined,
70
+ };
71
+ }, [space]);
72
+ return { data: project, ...rest };
73
+ }
74
+ /**
75
+ * Hook to create a new project.
76
+ * Creates a space with type "project" via the spacer service.
77
+ */
78
+ export function useCreateProject() {
79
+ const { useCreateSpace } = useCache();
80
+ const createSpaceMutation = useCreateSpace();
81
+ const createProject = useCallback(async (request) => {
82
+ const spaceHandle = request.name
83
+ .toLowerCase()
84
+ .replace(/[^a-z0-9]+/g, '-')
85
+ .replace(/^-|-$/g, '');
86
+ return createSpaceMutation.mutateAsync({
87
+ space: {
88
+ name: request.name,
89
+ description: request.description || '',
90
+ handle: spaceHandle || `project-${Date.now()}`,
91
+ variant: PROJECT_SPACE_VARIANT,
92
+ public: false,
93
+ },
94
+ });
95
+ }, [createSpaceMutation]);
96
+ return {
97
+ ...createSpaceMutation,
98
+ createProject,
99
+ };
100
+ }
101
+ /**
102
+ * Hook to update a project (e.g. persist the attached agent pod name).
103
+ * Uses the spacer PUT endpoint via useUpdateSpace.
104
+ */
105
+ export function useUpdateProject() {
106
+ const { useUpdateSpace } = useCache();
107
+ const updateSpaceMutation = useUpdateSpace();
108
+ /** Assign an agent runtime to the project */
109
+ const assignAgent = useCallback(async (project, agentPodName, agentSpecId) => {
110
+ return updateSpaceMutation.mutateAsync({
111
+ id: project.id,
112
+ name: project.name,
113
+ description: project.description,
114
+ attached_agent_pod_name_s: agentPodName,
115
+ attached_agent_spec_id_s: agentSpecId || '',
116
+ });
117
+ }, [updateSpaceMutation]);
118
+ /** Rename a project */
119
+ const renameProject = useCallback(async (project, newName) => {
120
+ return updateSpaceMutation.mutateAsync({
121
+ id: project.id,
122
+ name: newName,
123
+ description: project.description,
124
+ });
125
+ }, [updateSpaceMutation]);
126
+ /** Remove the agent assignment from the project */
127
+ const unassignAgent = useCallback(async (project) => {
128
+ return updateSpaceMutation.mutateAsync({
129
+ id: project.id,
130
+ name: project.name,
131
+ description: project.description,
132
+ attached_agent_pod_name_s: '',
133
+ attached_agent_spec_id_s: '',
134
+ });
135
+ }, [updateSpaceMutation]);
136
+ return {
137
+ ...updateSpaceMutation,
138
+ assignAgent,
139
+ unassignAgent,
140
+ renameProject,
141
+ };
142
+ }
143
+ /**
144
+ * Hook to refresh the projects list.
145
+ */
146
+ export function useRefreshProjects() {
147
+ const { useRefreshUserSpaces } = useCache();
148
+ return useRefreshUserSpaces();
149
+ }
150
+ /**
151
+ * Hook to delete a project (space) and all its contents.
152
+ */
153
+ export function useDeleteProject() {
154
+ const { useDeleteSpace } = useCache();
155
+ return useDeleteSpace();
156
+ }
157
+ /**
158
+ * Hook to fetch the default notebook and document UIDs for a project.
159
+ *
160
+ * This calls the spacer `GET /spaces/{uid}/default-items` endpoint which
161
+ * returns the UID of the first notebook and first document in the space.
162
+ */
163
+ export function useProjectDefaultItems(projectUid) {
164
+ const { useSpaceDefaultItems } = useCache();
165
+ return useSpaceDefaultItems(projectUid);
166
+ }
package/lib/index.d.ts CHANGED
@@ -5,7 +5,6 @@ export * from './collaboration';
5
5
  export * from './services';
6
6
  export * from './navigation';
7
7
  export * from './hooks';
8
- export * from './theme';
9
8
  export { requestDatalayerAPI, RunResponseError, NetworkError, } from './api/DatalayerApi';
10
9
  export type { IRequestDatalayerAPIOptions } from './api/DatalayerApi';
11
10
  export { API_BASE_PATHS } from './api/constants';
package/lib/index.js CHANGED
@@ -11,8 +11,6 @@ export * from './services';
11
11
  // Export navigation before hooks to avoid conflicts
12
12
  export * from './navigation';
13
13
  export * from './hooks';
14
- // Export Theme.
15
- export * from './theme';
16
14
  // Export APIs.
17
15
  export { requestDatalayerAPI, RunResponseError, NetworkError, } from './api/DatalayerApi';
18
16
  export { API_BASE_PATHS } from './api/constants';
@@ -42,7 +42,7 @@ export interface CreditsResponse {
42
42
  *
43
43
  * @example
44
44
  * ```typescript
45
- * const credits = await sdk.getCredits();
45
+ * const credits = await client.getCredits();
46
46
  * console.log(`Available: ${credits.available}`);
47
47
  * console.log(`Quota: ${credits.quota || 'unlimited'}`);
48
48
  *
@@ -13,7 +13,7 @@ import { validateJSON } from '../api/utils/validation';
13
13
  *
14
14
  * @example
15
15
  * ```typescript
16
- * const credits = await sdk.getCredits();
16
+ * const credits = await client.getCredits();
17
17
  * console.log(`Available: ${credits.available}`);
18
18
  * console.log(`Quota: ${credits.quota || 'unlimited'}`);
19
19
  *
@@ -126,7 +126,7 @@ export interface UpdateDatasourceResponse {
126
126
  *
127
127
  * @example
128
128
  * ```typescript
129
- * const datasource = await sdk.createDatasource({
129
+ * const datasource = await client.createDatasource({
130
130
  * type: 'Amazon Athena',
131
131
  * name: 'my-athena-datasource',
132
132
  * description: 'Production Athena datasource',
@@ -141,14 +141,14 @@ export interface UpdateDatasourceResponse {
141
141
  export declare class DatasourceDTO {
142
142
  /** @internal */
143
143
  _data: DatasourceData;
144
- private _sdk;
144
+ private _client;
145
145
  private _deleted;
146
146
  /**
147
147
  * Create a Datasource instance.
148
148
  * @param data - Datasource data from API
149
- * @param sdk - Client instance
149
+ * @param client - Client instance
150
150
  */
151
- constructor(data: DatasourceData, sdk: DatalayerClient);
151
+ constructor(data: DatasourceData, client: DatalayerClient);
152
152
  private _checkDeleted;
153
153
  get uid(): string;
154
154
  get type(): DatasourceType;
@@ -25,7 +25,7 @@ import { validateJSON } from '../api/utils/validation';
25
25
  *
26
26
  * @example
27
27
  * ```typescript
28
- * const datasource = await sdk.createDatasource({
28
+ * const datasource = await client.createDatasource({
29
29
  * type: 'Amazon Athena',
30
30
  * name: 'my-athena-datasource',
31
31
  * description: 'Production Athena datasource',
@@ -40,16 +40,16 @@ import { validateJSON } from '../api/utils/validation';
40
40
  export class DatasourceDTO {
41
41
  /** @internal */
42
42
  _data;
43
- _sdk;
43
+ _client;
44
44
  _deleted = false;
45
45
  /**
46
46
  * Create a Datasource instance.
47
47
  * @param data - Datasource data from API
48
- * @param sdk - Client instance
48
+ * @param client - Client instance
49
49
  */
50
- constructor(data, sdk) {
50
+ constructor(data, client) {
51
51
  this._data = data;
52
- this._sdk = sdk;
52
+ this._client = client;
53
53
  }
54
54
  // ========================================================================
55
55
  // Helper Methods
@@ -108,7 +108,7 @@ export class DatasourceDTO {
108
108
  */
109
109
  async update(updates) {
110
110
  this._checkDeleted();
111
- const updated = await this._sdk.updateDatasource(this.uid, updates);
111
+ const updated = await this._client.updateDatasource(this.uid, updates);
112
112
  return updated;
113
113
  }
114
114
  /**
@@ -116,7 +116,7 @@ export class DatasourceDTO {
116
116
  */
117
117
  async delete() {
118
118
  this._checkDeleted();
119
- await this._sdk.deleteDatasource(this.uid);
119
+ await this._client.deleteDatasource(this.uid);
120
120
  this._deleted = true;
121
121
  }
122
122
  // ========================================================================
@@ -80,7 +80,7 @@ export interface ListEnvironmentsResponse {
80
80
  *
81
81
  * @example
82
82
  * ```typescript
83
- * const environments = await sdk.listEnvironments();
83
+ * const environments = await client.listEnvironments();
84
84
  * const aiEnv = environments.find(env => env.name === 'ai-env');
85
85
  * console.log(aiEnv.title); // "AI Environment"
86
86
  * ```
@@ -92,9 +92,9 @@ export declare class EnvironmentDTO {
92
92
  * Create an Environment instance.
93
93
  *
94
94
  * @param data - Environment data from API
95
- * @param _sdk - Client instance (not currently used but kept for consistency)
95
+ * @param _client - Client instance (not currently used but kept for consistency)
96
96
  */
97
- constructor(data: EnvironmentData, _sdk: DatalayerClient);
97
+ constructor(data: EnvironmentData, _client: DatalayerClient);
98
98
  /** Human-readable title for the environment (e.g., 'AI Environment', 'Python CPU Environment'). */
99
99
  get title(): string;
100
100
  /** Unique name identifier for the environment (e.g., 'ai-env', 'python-cpu-env'). */
@@ -9,7 +9,7 @@ import { validateJSON } from '../api/utils/validation';
9
9
  *
10
10
  * @example
11
11
  * ```typescript
12
- * const environments = await sdk.listEnvironments();
12
+ * const environments = await client.listEnvironments();
13
13
  * const aiEnv = environments.find(env => env.name === 'ai-env');
14
14
  * console.log(aiEnv.title); // "AI Environment"
15
15
  * ```
@@ -21,9 +21,9 @@ export class EnvironmentDTO {
21
21
  * Create an Environment instance.
22
22
  *
23
23
  * @param data - Environment data from API
24
- * @param _sdk - Client instance (not currently used but kept for consistency)
24
+ * @param _client - Client instance (not currently used but kept for consistency)
25
25
  */
26
- constructor(data, _sdk) {
26
+ constructor(data, _client) {
27
27
  this._data = data;
28
28
  // Client instance not currently used but kept for future extensibility
29
29
  }
@@ -11,9 +11,9 @@ export declare class HealthCheck {
11
11
  /**
12
12
  * Create a HealthCheck instance.
13
13
  * @param data - The health check data
14
- * @param sdk - Reference to the Client instance (unused but kept for consistency)
14
+ * @param client - Reference to the Client instance (unused but kept for consistency)
15
15
  */
16
- constructor(data: any, sdk: any);
16
+ constructor(data: any, client: any);
17
17
  /**
18
18
  * Check if the service is healthy.
19
19
  * @returns True if the service is healthy
@@ -17,9 +17,9 @@ export class HealthCheck {
17
17
  /**
18
18
  * Create a HealthCheck instance.
19
19
  * @param data - The health check data
20
- * @param sdk - Reference to the Client instance (unused but kept for consistency)
20
+ * @param client - Reference to the Client instance (unused but kept for consistency)
21
21
  */
22
- constructor(data, sdk) {
22
+ constructor(data, client) {
23
23
  // Initialize properties
24
24
  this.healthy = data.healthy || false;
25
25
  this.status = data.status || 'unknown';
@@ -13,14 +13,14 @@ import type { DatalayerClient } from '../index';
13
13
  */
14
14
  export declare abstract class ItemDTO<TData> {
15
15
  protected _data: TData;
16
- private _sdk;
16
+ private _client;
17
17
  private _deleted;
18
18
  /**
19
19
  * Create an Item instance.
20
20
  * @param data - Item data from API
21
- * @param sdk - Client instance
21
+ * @param client - Client instance
22
22
  */
23
- constructor(data: TData, sdk: DatalayerClient);
23
+ constructor(data: TData, client: DatalayerClient);
24
24
  /** Check if this item has been deleted. */
25
25
  get isDeleted(): boolean;
26
26
  /**
@@ -12,16 +12,16 @@ import * as items from '../api/spacer/items';
12
12
  */
13
13
  export class ItemDTO {
14
14
  _data;
15
- _sdk;
15
+ _client;
16
16
  _deleted = false;
17
17
  /**
18
18
  * Create an Item instance.
19
19
  * @param data - Item data from API
20
- * @param sdk - Client instance
20
+ * @param client - Client instance
21
21
  */
22
- constructor(data, sdk) {
22
+ constructor(data, client) {
23
23
  this._data = data;
24
- this._sdk = sdk;
24
+ this._client = client;
25
25
  }
26
26
  // ========================================================================
27
27
  // Deletion State Management
@@ -105,8 +105,8 @@ export class ItemDTO {
105
105
  */
106
106
  async delete() {
107
107
  this._checkDeleted();
108
- const token = this._sdk.getToken();
109
- const spacerRunUrl = this._sdk.getSpacerRunUrl();
108
+ const token = this._client.getToken();
109
+ const spacerRunUrl = this._client.getSpacerRunUrl();
110
110
  await items.deleteItem(token, this.uid, spacerRunUrl);
111
111
  this._deleted = true;
112
112
  }
@@ -137,8 +137,8 @@ export class ItemDTO {
137
137
  }
138
138
  // Third try: Fetch full item details from API
139
139
  try {
140
- const token = this._sdk.getToken();
141
- const spacerRunUrl = this._sdk.getSpacerRunUrl();
140
+ const token = this._client.getToken();
141
+ const spacerRunUrl = this._client.getSpacerRunUrl();
142
142
  const response = await items.getItem(token, this.uid, spacerRunUrl);
143
143
  // Update internal data with full item details
144
144
  if (response.success && response.item) {
@@ -173,11 +173,11 @@ export class ItemDTO {
173
173
  // ========================================================================
174
174
  /** Get Client token for API calls. */
175
175
  _getToken() {
176
- return this._sdk.getToken();
176
+ return this._client.getToken();
177
177
  }
178
178
  /** Get spacer API URL for API calls. */
179
179
  _getSpacerRunUrl() {
180
- return this._sdk.getSpacerRunUrl();
180
+ return this._client.getSpacerRunUrl();
181
181
  }
182
182
  /** Update internal data after API call. */
183
183
  _updateData(newData) {
@@ -109,7 +109,7 @@ export interface LexicalJSON {
109
109
  *
110
110
  * @example
111
111
  * ```typescript
112
- * const lexical = await sdk.createLexical(formData);
112
+ * const lexical = await client.createLexical(formData);
113
113
  * await lexical.update({ name: 'Updated Documentation' });
114
114
  * ```
115
115
  */
@@ -118,9 +118,9 @@ export declare class LexicalDTO extends ItemDTO<LexicalData> {
118
118
  * Create a Lexical instance.
119
119
  *
120
120
  * @param data - Lexical data from API
121
- * @param sdk - Client instance
121
+ * @param client - Client instance
122
122
  */
123
- constructor(data: LexicalData, sdk: DatalayerClient);
123
+ constructor(data: LexicalData, client: DatalayerClient);
124
124
  /** Document type identifier. */
125
125
  get type(): string;
126
126
  /** The cached name of the document. */
@@ -17,7 +17,7 @@ import { validateJSON } from '../api/utils/validation';
17
17
  *
18
18
  * @example
19
19
  * ```typescript
20
- * const lexical = await sdk.createLexical(formData);
20
+ * const lexical = await client.createLexical(formData);
21
21
  * await lexical.update({ name: 'Updated Documentation' });
22
22
  * ```
23
23
  */
@@ -26,10 +26,10 @@ export class LexicalDTO extends ItemDTO {
26
26
  * Create a Lexical instance.
27
27
  *
28
28
  * @param data - Lexical data from API
29
- * @param sdk - Client instance
29
+ * @param client - Client instance
30
30
  */
31
- constructor(data, sdk) {
32
- super(data, sdk);
31
+ constructor(data, client) {
32
+ super(data, client);
33
33
  }
34
34
  // ========================================================================
35
35
  // Abstract Method Implementations
@@ -42,7 +42,7 @@ export interface NotebookJSON {
42
42
  *
43
43
  * @example
44
44
  * ```typescript
45
- * const notebook = await sdk.createNotebook(formData);
45
+ * const notebook = await client.createNotebook(formData);
46
46
  * const kernelSpec = await notebook.getKernelSpec();
47
47
  * ```
48
48
  */
@@ -51,9 +51,9 @@ export declare class NotebookDTO extends ItemDTO<NotebookData> {
51
51
  * Create a Notebook instance.
52
52
  *
53
53
  * @param data - Notebook data from API
54
- * @param sdk - Client instance
54
+ * @param client - Client instance
55
55
  */
56
- constructor(data: NotebookData, sdk: DatalayerClient);
56
+ constructor(data: NotebookData, client: DatalayerClient);
57
57
  /** Document type identifier. */
58
58
  get type(): string;
59
59
  /** The cached name of the notebook. */
@@ -12,7 +12,7 @@ import { validateJSON } from '../api/utils/validation';
12
12
  *
13
13
  * @example
14
14
  * ```typescript
15
- * const notebook = await sdk.createNotebook(formData);
15
+ * const notebook = await client.createNotebook(formData);
16
16
  * const kernelSpec = await notebook.getKernelSpec();
17
17
  * ```
18
18
  */
@@ -21,10 +21,10 @@ export class NotebookDTO extends ItemDTO {
21
21
  * Create a Notebook instance.
22
22
  *
23
23
  * @param data - Notebook data from API
24
- * @param sdk - Client instance
24
+ * @param client - Client instance
25
25
  */
26
- constructor(data, sdk) {
27
- super(data, sdk);
26
+ constructor(data, client) {
27
+ super(data, client);
28
28
  }
29
29
  // ========================================================================
30
30
  // Abstract Method Implementations
@@ -74,8 +74,8 @@ export class NotebookDTO extends ItemDTO {
74
74
  async update(name, description) {
75
75
  // FIXME: check if both are needed, and use the existing values if only one provided
76
76
  this._checkDeleted();
77
- const token = this._sdk.getToken();
78
- const spacerRunUrl = this._sdk.getSpacerRunUrl();
77
+ const token = this._client.getToken();
78
+ const spacerRunUrl = this._client.getSpacerRunUrl();
79
79
  const updateData = {};
80
80
  if (name !== undefined)
81
81
  updateData.name = name;
@@ -31,6 +31,8 @@ export type IPage = {
31
31
  creatorId?: string;
32
32
  kernelSnapshot?: IRuntimeSnapshot;
33
33
  kernelSnapshotId?: string;
34
+ createdAt?: string;
35
+ updatedAt?: string;
34
36
  };
35
37
  export declare const asPage: (s: any) => IPage;
36
38
  export default IPage;
@@ -105,22 +105,22 @@ export interface ListRuntimesResponse {
105
105
  *
106
106
  * @example
107
107
  * ```typescript
108
- * const runtime = await sdk.createRuntime({ environment_name: 'python-cpu' });
108
+ * const runtime = await client.createRuntime({ environment_name: 'python-cpu' });
109
109
  * await runtime.waitUntilReady();
110
110
  * ```
111
111
  */
112
112
  export declare class RuntimeDTO {
113
113
  /** @internal */
114
114
  _data: RuntimeData;
115
- private _sdk;
115
+ private _client;
116
116
  private _deleted;
117
117
  /**
118
118
  * Create a Runtime instance.
119
119
  *
120
120
  * @param data - Runtime data from API
121
- * @param sdk - Client instance
121
+ * @param client - Client instance
122
122
  */
123
- constructor(data: RuntimeData, sdk: DatalayerClient);
123
+ constructor(data: RuntimeData, client: DatalayerClient);
124
124
  /**
125
125
  * Check if this runtime has been deleted and throw error if so.
126
126
  * @throws Error if deleted
@@ -15,24 +15,24 @@ import { validateJSON } from '../api/utils/validation';
15
15
  *
16
16
  * @example
17
17
  * ```typescript
18
- * const runtime = await sdk.createRuntime({ environment_name: 'python-cpu' });
18
+ * const runtime = await client.createRuntime({ environment_name: 'python-cpu' });
19
19
  * await runtime.waitUntilReady();
20
20
  * ```
21
21
  */
22
22
  export class RuntimeDTO {
23
23
  /** @internal */
24
24
  _data;
25
- _sdk;
25
+ _client;
26
26
  _deleted = false;
27
27
  /**
28
28
  * Create a Runtime instance.
29
29
  *
30
30
  * @param data - Runtime data from API
31
- * @param sdk - Client instance
31
+ * @param client - Client instance
32
32
  */
33
- constructor(data, sdk) {
33
+ constructor(data, client) {
34
34
  this._data = data;
35
- this._sdk = sdk;
35
+ this._client = client;
36
36
  }
37
37
  // ========================================================================
38
38
  // Helper Methods
@@ -112,7 +112,7 @@ export class RuntimeDTO {
112
112
  * After deletion, subsequent calls to dynamic methods will throw errors.
113
113
  */
114
114
  async delete() {
115
- await this._sdk.deleteRuntime(this.podName);
115
+ await this._client.deleteRuntime(this.podName);
116
116
  this._deleted = true;
117
117
  }
118
118
  /**
@@ -123,8 +123,8 @@ export class RuntimeDTO {
123
123
  */
124
124
  async update(from) {
125
125
  this._checkDeleted();
126
- const updated = await updateRuntime(this._sdk.getToken(), this.podName, from, this._sdk.getRuntimesRunUrl());
127
- return new RuntimeDTO(updated, this._sdk);
126
+ const updated = await updateRuntime(this._client.getToken(), this.podName, from, this._client.getRuntimesRunUrl());
127
+ return new RuntimeDTO(updated, this._client);
128
128
  }
129
129
  /**
130
130
  * Create a snapshot of this runtime.
@@ -136,7 +136,7 @@ export class RuntimeDTO {
136
136
  */
137
137
  async createSnapshot(name, description, stop) {
138
138
  this._checkDeleted();
139
- return await this._sdk.createSnapshot(this.podName, name, description, stop);
139
+ return await this._client.createSnapshot(this.podName, name, description, stop);
140
140
  }
141
141
  // ========================================================================
142
142
  // Utility Methods
@@ -116,15 +116,15 @@ export interface ListRuntimeSnapshotsResponse {
116
116
  */
117
117
  export declare class RuntimeSnapshotDTO {
118
118
  protected _data: RuntimeSnapshotData;
119
- private _sdk;
119
+ private _client;
120
120
  private _deleted;
121
121
  /**
122
122
  * Create a Runtime Snapshot instance.
123
123
  *
124
124
  * @param data - Snapshot data from API
125
- * @param sdk - Client instance
125
+ * @param client - Client instance
126
126
  */
127
- constructor(data: RuntimeSnapshotData, sdk: DatalayerClient);
127
+ constructor(data: RuntimeSnapshotData, client: DatalayerClient);
128
128
  /**
129
129
  * Check if this snapshot has been deleted and throw error if so.
130
130
  * @throws Error if deleted