@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.
- 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/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/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/{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
|
@@ -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 { snapshots } from '
|
|
6
|
-
import { validateJSON } from '
|
|
5
|
+
import { snapshots } from '../api/runtimes';
|
|
6
|
+
import { validateJSON } from '../api/utils/validation';
|
|
7
7
|
/**
|
|
8
8
|
* Snapshot domain model that wraps API responses with convenient methods.
|
|
9
9
|
* Provides runtime snapshot management with data refresh and lifecycle operations.
|
|
@@ -14,12 +14,12 @@ import { validateJSON } from '../../api/utils/validation';
|
|
|
14
14
|
* const runtime = await snapshot.restore();
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
export class
|
|
17
|
+
export class RuntimeSnapshotDTO {
|
|
18
18
|
_data;
|
|
19
19
|
_sdk;
|
|
20
20
|
_deleted = false;
|
|
21
21
|
/**
|
|
22
|
-
* Create a Snapshot instance.
|
|
22
|
+
* Create a Runtime Snapshot instance.
|
|
23
23
|
*
|
|
24
24
|
* @param data - Snapshot data from API
|
|
25
25
|
* @param sdk - SDK instance
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import type { DatalayerClient } from '../index';
|
|
2
|
+
import { NotebookDTO, type NotebookJSON } from './NotebookDTO';
|
|
3
|
+
import { NotebookData } from './NotebookDTO';
|
|
4
|
+
import { LexicalDTO, type LexicalJSON } from './LexicalDTO';
|
|
5
|
+
/**
|
|
6
|
+
* Represents a workspace or project space in Datalayer
|
|
7
|
+
* @interface SpaceData
|
|
8
|
+
*/
|
|
9
|
+
export interface SpaceData {
|
|
10
|
+
uid: string;
|
|
11
|
+
name_t: string;
|
|
12
|
+
handle_s: string;
|
|
13
|
+
variant_s: string;
|
|
14
|
+
description_t: string;
|
|
15
|
+
tags_ss?: string[];
|
|
16
|
+
members?: any[];
|
|
17
|
+
items?: any[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Stable public interface for Space data.
|
|
21
|
+
* This is the contract that SDK consumers can rely on.
|
|
22
|
+
* The raw API may change, but this interface remains stable.
|
|
23
|
+
*/
|
|
24
|
+
export interface SpaceJSON {
|
|
25
|
+
/** ulid for the space */
|
|
26
|
+
uid: string;
|
|
27
|
+
/** Name of the space */
|
|
28
|
+
name: string;
|
|
29
|
+
/** Handle for the space */
|
|
30
|
+
handle: string;
|
|
31
|
+
/** Variant of the space */
|
|
32
|
+
variant: string;
|
|
33
|
+
/** Description of the space */
|
|
34
|
+
description: string;
|
|
35
|
+
/** Items contained in the space (as JSON) */
|
|
36
|
+
items: Array<NotebookJSON | LexicalJSON>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Space domain model that wraps API responses with convenient methods.
|
|
40
|
+
* Provides workspace management with data refresh and content creation operations.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const space = spaces[0];
|
|
45
|
+
* const items = await space.getItems();
|
|
46
|
+
* const notebook = await space.createNotebook({ name: 'Analysis' });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare class SpaceDTO {
|
|
50
|
+
protected _data: SpaceData;
|
|
51
|
+
private _sdk;
|
|
52
|
+
private _items;
|
|
53
|
+
private _deleted;
|
|
54
|
+
/**
|
|
55
|
+
* Create a Space instance.
|
|
56
|
+
*
|
|
57
|
+
* @param data - Space data from API
|
|
58
|
+
* @param sdk - SDK instance
|
|
59
|
+
*/
|
|
60
|
+
constructor(data: SpaceData, sdk: DatalayerClient);
|
|
61
|
+
/**
|
|
62
|
+
* Check if this space has been deleted and throw error if so.
|
|
63
|
+
* @throws Error if deleted
|
|
64
|
+
*/
|
|
65
|
+
private _checkDeleted;
|
|
66
|
+
/**
|
|
67
|
+
* Refresh space data from the API by fetching user's spaces.
|
|
68
|
+
*/
|
|
69
|
+
refresh(): Promise<void>;
|
|
70
|
+
/** Unique identifier for the space. */
|
|
71
|
+
get uid(): string;
|
|
72
|
+
/** URL-friendly handle for the space. */
|
|
73
|
+
get handle(): string;
|
|
74
|
+
/** Space variant type. */
|
|
75
|
+
get variant(): string;
|
|
76
|
+
/**
|
|
77
|
+
* The name of the space.
|
|
78
|
+
*/
|
|
79
|
+
get name(): string;
|
|
80
|
+
/**
|
|
81
|
+
* The description of the space.
|
|
82
|
+
*/
|
|
83
|
+
get description(): string;
|
|
84
|
+
/**
|
|
85
|
+
* Helper method to create items in this space.
|
|
86
|
+
*
|
|
87
|
+
* @param itemType - Type of item to create
|
|
88
|
+
* @param data - Creation configuration
|
|
89
|
+
* @returns Created model instance
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
private _createItem;
|
|
93
|
+
/**
|
|
94
|
+
* Get all items in this space as model instances.
|
|
95
|
+
*
|
|
96
|
+
* @returns Array of Notebook and Lexical model instances
|
|
97
|
+
*/
|
|
98
|
+
getItems(): Promise<(NotebookDTO | LexicalDTO)[]>;
|
|
99
|
+
/**
|
|
100
|
+
* Create a new notebook in this space.
|
|
101
|
+
*
|
|
102
|
+
* @param data - Notebook creation configuration
|
|
103
|
+
* @returns Created Notebook instance
|
|
104
|
+
*/
|
|
105
|
+
createNotebook(data: {
|
|
106
|
+
name: string;
|
|
107
|
+
description: string;
|
|
108
|
+
file?: File | Blob;
|
|
109
|
+
}): Promise<NotebookDTO>;
|
|
110
|
+
/**
|
|
111
|
+
* Create a new lexical document in this space.
|
|
112
|
+
*
|
|
113
|
+
* @param data - Lexical creation configuration
|
|
114
|
+
* @returns Created Lexical instance
|
|
115
|
+
*/
|
|
116
|
+
createLexical(data: {
|
|
117
|
+
name: string;
|
|
118
|
+
description: string;
|
|
119
|
+
file?: File | Blob;
|
|
120
|
+
}): Promise<LexicalDTO>;
|
|
121
|
+
/**
|
|
122
|
+
* Get raw space data object.
|
|
123
|
+
* Returns cached data without refreshing.
|
|
124
|
+
*
|
|
125
|
+
* @returns Raw space data object
|
|
126
|
+
*/
|
|
127
|
+
/**
|
|
128
|
+
* Get space data in camelCase format.
|
|
129
|
+
* Returns only the core fields that consumers need.
|
|
130
|
+
* This provides a stable interface regardless of API changes.
|
|
131
|
+
*
|
|
132
|
+
* @returns Core space data with camelCase properties
|
|
133
|
+
*/
|
|
134
|
+
toJSON(): SpaceJSON;
|
|
135
|
+
/**
|
|
136
|
+
* Get the raw space data exactly as received from the API.
|
|
137
|
+
* This preserves the original snake_case naming from the API response.
|
|
138
|
+
*
|
|
139
|
+
* @returns Raw space data from API
|
|
140
|
+
*/
|
|
141
|
+
rawData(): SpaceData;
|
|
142
|
+
/** String representation of the space. */
|
|
143
|
+
toString(): string;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Request payload for creating a new space
|
|
147
|
+
* @interface CreateSpaceRequest
|
|
148
|
+
*/
|
|
149
|
+
export interface CreateSpaceRequest {
|
|
150
|
+
name: string;
|
|
151
|
+
description: string;
|
|
152
|
+
variant: string;
|
|
153
|
+
spaceHandle: string;
|
|
154
|
+
organizationId: string;
|
|
155
|
+
seedSpaceId: string;
|
|
156
|
+
public: boolean;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Response from getting a collaboration session ID
|
|
160
|
+
* @interface CollaborationSessionResponse
|
|
161
|
+
*/
|
|
162
|
+
export interface CollaborationSessionResponse {
|
|
163
|
+
success: boolean;
|
|
164
|
+
sessionId?: string;
|
|
165
|
+
error?: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Response from creating a space
|
|
169
|
+
* @interface CreateSpaceResponse
|
|
170
|
+
*/
|
|
171
|
+
export interface CreateSpaceResponse {
|
|
172
|
+
success: boolean;
|
|
173
|
+
message: string;
|
|
174
|
+
space?: SpaceData;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Request payload for creating a new notebook (multipart/form-data)
|
|
178
|
+
* @interface CreateNotebookRequest
|
|
179
|
+
*/
|
|
180
|
+
export interface CreateNotebookRequest {
|
|
181
|
+
spaceId: string;
|
|
182
|
+
notebookType: string;
|
|
183
|
+
name: string;
|
|
184
|
+
description: string;
|
|
185
|
+
file?: File | Blob;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Response from creating a notebook
|
|
189
|
+
* @interface CreateNotebookResponse
|
|
190
|
+
*/
|
|
191
|
+
export interface CreateNotebookResponse {
|
|
192
|
+
success: boolean;
|
|
193
|
+
message: string;
|
|
194
|
+
notebook?: NotebookData;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Response from getting a notebook
|
|
198
|
+
* @interface GetNotebookResponse
|
|
199
|
+
*/
|
|
200
|
+
export interface GetNotebookResponse {
|
|
201
|
+
success: boolean;
|
|
202
|
+
message: string;
|
|
203
|
+
notebook?: NotebookData;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Request payload for creating a notebook
|
|
207
|
+
* @interface CreateNotebookRequest
|
|
208
|
+
*/
|
|
209
|
+
export interface CreateNotebookRequest {
|
|
210
|
+
spaceId: string;
|
|
211
|
+
notebookType: string;
|
|
212
|
+
name: string;
|
|
213
|
+
description: string;
|
|
214
|
+
file?: File | Blob;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Request payload for updating a notebook
|
|
218
|
+
* @interface UpdateNotebookRequest
|
|
219
|
+
*/
|
|
220
|
+
export interface UpdateNotebookRequest {
|
|
221
|
+
name?: string;
|
|
222
|
+
description?: string;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Response from updating a notebook
|
|
226
|
+
* @interface UpdateNotebookResponse
|
|
227
|
+
*/
|
|
228
|
+
export interface UpdateNotebookResponse {
|
|
229
|
+
success: boolean;
|
|
230
|
+
message: string;
|
|
231
|
+
notebook?: NotebookData;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Represents an item within a space
|
|
235
|
+
* @interface SpaceItem
|
|
236
|
+
*/
|
|
237
|
+
export interface SpaceItem {
|
|
238
|
+
id: string;
|
|
239
|
+
type_s: 'notebook' | 'lexical';
|
|
240
|
+
space_id: string;
|
|
241
|
+
item_id: string;
|
|
242
|
+
name: string;
|
|
243
|
+
created_at: string;
|
|
244
|
+
updated_at?: string;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Response from getting space items
|
|
248
|
+
* @interface GetSpaceItemsResponse
|
|
249
|
+
*/
|
|
250
|
+
export interface GetSpaceItemsResponse {
|
|
251
|
+
success: boolean;
|
|
252
|
+
message: string;
|
|
253
|
+
items: SpaceItem[];
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Response from deleting a space item
|
|
257
|
+
* @interface DeleteSpaceItemResponse
|
|
258
|
+
*/
|
|
259
|
+
export interface DeleteSpaceItemResponse {
|
|
260
|
+
success: boolean;
|
|
261
|
+
message: string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Response from getting a single space item
|
|
265
|
+
* @interface GetSpaceItemResponse
|
|
266
|
+
*/
|
|
267
|
+
export interface GetSpaceItemResponse {
|
|
268
|
+
success: boolean;
|
|
269
|
+
message: string;
|
|
270
|
+
item?: any;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Response from getting spaces for a user
|
|
274
|
+
* @interface SpacesForUserResponse
|
|
275
|
+
*/
|
|
276
|
+
export interface SpacesForUserResponse {
|
|
277
|
+
success: boolean;
|
|
278
|
+
message: string;
|
|
279
|
+
spaces: SpaceData[];
|
|
280
|
+
}
|
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
5
|
+
/**
|
|
6
|
+
* Space domain model for the Datalayer SDK.
|
|
7
|
+
*
|
|
8
|
+
* @module models/SpaceDTO
|
|
9
|
+
*/
|
|
10
|
+
import * as users from '../api/spacer/users';
|
|
11
|
+
import * as items from '../api/spacer/items';
|
|
12
|
+
import * as notebooks from '../api/spacer/notebooks';
|
|
13
|
+
import * as lexicals from '../api/spacer/lexicals';
|
|
14
|
+
import { NotebookDTO } from './NotebookDTO';
|
|
15
|
+
import { LexicalDTO } from './LexicalDTO';
|
|
16
|
+
import { ItemTypes } from '../client/constants';
|
|
17
|
+
import { convertSpaceItemsToModels } from '../client/utils/spacerUtils';
|
|
18
|
+
import { validateJSON } from '../api/utils/validation';
|
|
14
19
|
/**
|
|
15
20
|
* Space domain model that wraps API responses with convenient methods.
|
|
16
21
|
* Provides workspace management with data refresh and content creation operations.
|
|
@@ -22,7 +27,7 @@ import { validateJSON } from '../../api/utils/validation';
|
|
|
22
27
|
* const notebook = await space.createNotebook({ name: 'Analysis' });
|
|
23
28
|
* ```
|
|
24
29
|
*/
|
|
25
|
-
export class
|
|
30
|
+
export class SpaceDTO {
|
|
26
31
|
_data;
|
|
27
32
|
_sdk;
|
|
28
33
|
_items = null;
|
|
@@ -120,7 +125,7 @@ export class Space {
|
|
|
120
125
|
throw new Error('Failed to create notebook: No notebook returned');
|
|
121
126
|
}
|
|
122
127
|
else {
|
|
123
|
-
return new
|
|
128
|
+
return new NotebookDTO(response.notebook, this._sdk);
|
|
124
129
|
}
|
|
125
130
|
}
|
|
126
131
|
else if (data.type === ItemTypes.LEXICAL) {
|
|
@@ -136,7 +141,7 @@ export class Space {
|
|
|
136
141
|
throw new Error('Failed to create lexical document: No document returned');
|
|
137
142
|
}
|
|
138
143
|
else {
|
|
139
|
-
return new
|
|
144
|
+
return new LexicalDTO(response.document, this._sdk);
|
|
140
145
|
}
|
|
141
146
|
}
|
|
142
147
|
else {
|
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* User model for the Datalayer SDK with rich functionality.
|
|
3
3
|
*
|
|
4
|
-
* @module
|
|
4
|
+
* @module models/UserDTO
|
|
5
5
|
*/
|
|
6
|
-
import type { User as UserData } from '../../api/types/iam';
|
|
7
6
|
import type { DatalayerClient } from '../index';
|
|
7
|
+
/**
|
|
8
|
+
* Represents a user in the Datalayer platform
|
|
9
|
+
* @interface UserData
|
|
10
|
+
*/
|
|
11
|
+
export interface UserData {
|
|
12
|
+
/** uuid for the user */
|
|
13
|
+
id: string;
|
|
14
|
+
/** ulid for the user */
|
|
15
|
+
uid: string;
|
|
16
|
+
/** User's handle or nickname */
|
|
17
|
+
handle_s: string;
|
|
18
|
+
/** User's email address */
|
|
19
|
+
email_s: string;
|
|
20
|
+
/** User's first name */
|
|
21
|
+
first_name_t: string;
|
|
22
|
+
/** User's last name */
|
|
23
|
+
last_name_t: string;
|
|
24
|
+
/** Display name shown in the UI */
|
|
25
|
+
avatar_url_s: string;
|
|
26
|
+
/** Additional fields that may be present in the response */
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
8
29
|
export interface UserJSON {
|
|
9
30
|
/** uuid for the user */
|
|
10
31
|
id: string;
|
|
@@ -27,7 +48,7 @@ export interface UserJSON {
|
|
|
27
48
|
* User model representing a Datalayer platform user.
|
|
28
49
|
* Provides rich functionality for accessing user data and authentication providers.
|
|
29
50
|
*/
|
|
30
|
-
export declare class
|
|
51
|
+
export declare class UserDTO {
|
|
31
52
|
protected _data: UserData;
|
|
32
53
|
/**
|
|
33
54
|
* Create a User instance.
|
|
@@ -62,3 +83,4 @@ export declare class User {
|
|
|
62
83
|
/** String representation of the user. */
|
|
63
84
|
toString(): string;
|
|
64
85
|
}
|
|
86
|
+
export default UserDTO;
|
|
@@ -2,12 +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 '
|
|
5
|
+
import { validateJSON } from '../api/utils/validation';
|
|
6
6
|
/**
|
|
7
7
|
* User model representing a Datalayer platform user.
|
|
8
8
|
* Provides rich functionality for accessing user data and authentication providers.
|
|
9
9
|
*/
|
|
10
|
-
export class
|
|
10
|
+
export class UserDTO {
|
|
11
11
|
_data;
|
|
12
12
|
/**
|
|
13
13
|
* Create a User instance.
|
|
@@ -81,3 +81,4 @@ export class User {
|
|
|
81
81
|
return `User(${this.uid}, ${this.displayName})`;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
+
export default UserDTO;
|
package/lib/models/index.d.ts
CHANGED
|
@@ -1,9 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Models definitions for all Datalayer API services.
|
|
3
|
+
*
|
|
4
|
+
* This module consolidates all type definitions used by the SDK, providing
|
|
5
|
+
* comprehensive TypeScript support for requests, responses, and data models
|
|
6
|
+
* across all Datalayer services.
|
|
7
|
+
*
|
|
8
|
+
* These types follow the exact backend API format (snake_case naming) to
|
|
9
|
+
* ensure compatibility. For frontend business logic types with camelCase
|
|
10
|
+
* naming, see the models in `/src/models/`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import type {
|
|
15
|
+
* Runtime,
|
|
16
|
+
* Environment,
|
|
17
|
+
* Space,
|
|
18
|
+
* Notebook,
|
|
19
|
+
* User,
|
|
20
|
+
* LoginRequest
|
|
21
|
+
* } from '@datalayer/core/api/types';
|
|
22
|
+
*
|
|
23
|
+
* // Use types for function parameters and return values
|
|
24
|
+
* function createRuntime(config: CreateRuntimeRequest): Promise<Runtime> {
|
|
25
|
+
* // Implementation
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @module models
|
|
30
|
+
*/
|
|
1
31
|
export * from './AIAgent';
|
|
2
|
-
export * from './Base';
|
|
3
32
|
export * from './Assignment';
|
|
33
|
+
export * from './Base';
|
|
4
34
|
export * from './Cell';
|
|
5
35
|
export * from './CodeBlock';
|
|
6
36
|
export * from './CodefeedBlocks';
|
|
37
|
+
export * from './Common';
|
|
7
38
|
export * from './Contact';
|
|
8
39
|
export * from './ContactEvent';
|
|
9
40
|
export * from './ContactIAMProvider';
|
|
@@ -11,29 +42,35 @@ export * from './ContactTags';
|
|
|
11
42
|
export * from './Content';
|
|
12
43
|
export * from './Course';
|
|
13
44
|
export * from './Credits';
|
|
14
|
-
export * from './
|
|
45
|
+
export * from './CreditsDTO';
|
|
15
46
|
export * from './Dataset';
|
|
47
|
+
export * from './Datasource';
|
|
16
48
|
export * from './Dean';
|
|
17
49
|
export * from './Document';
|
|
18
50
|
export * from './Environment';
|
|
51
|
+
export * from './EnvironmentDTO';
|
|
19
52
|
export * from './Errors';
|
|
20
53
|
export * from './Exercise';
|
|
21
54
|
export * from './GrowthKPI';
|
|
55
|
+
export * from './IAM';
|
|
22
56
|
export * from './IAMProviderLinked';
|
|
23
57
|
export * from './IAMProviderPost';
|
|
24
|
-
export * from './IAMProvidersSpecs';
|
|
25
58
|
export * from './IAMProviderUsers';
|
|
26
|
-
export * from './
|
|
59
|
+
export * from './IAMProvidersSpecs';
|
|
27
60
|
export * from './IAMToken';
|
|
28
61
|
export * from './Inbound';
|
|
62
|
+
export * from './Instructor';
|
|
29
63
|
export * from './Invite';
|
|
30
64
|
export * from './Item';
|
|
65
|
+
export * from './ItemDTO';
|
|
31
66
|
export * from './ItemType';
|
|
32
67
|
export * from './LandingRoles';
|
|
33
68
|
export * from './Lesson';
|
|
69
|
+
export * from './LexicalDTO';
|
|
34
70
|
export * from './Library';
|
|
35
71
|
export * from './Member';
|
|
36
72
|
export * from './Notebook';
|
|
73
|
+
export * from './NotebookDTO';
|
|
37
74
|
export * from './Organization';
|
|
38
75
|
export * from './OrganizationMember';
|
|
39
76
|
export * from './Outbound';
|
|
@@ -45,10 +82,13 @@ export * from './RolesOrganization';
|
|
|
45
82
|
export * from './RolesPlatform';
|
|
46
83
|
export * from './RolesTeam';
|
|
47
84
|
export * from './Runtime';
|
|
85
|
+
export * from './RuntimeDTO';
|
|
48
86
|
export * from './RuntimeSnapshot';
|
|
87
|
+
export * from './RuntimeSnapshotDTO';
|
|
49
88
|
export * from './School';
|
|
50
89
|
export * from './Secret';
|
|
51
90
|
export * from './Space';
|
|
91
|
+
export * from './SpaceDTO';
|
|
52
92
|
export * from './SpaceItem';
|
|
53
93
|
export * from './SpaceMember';
|
|
54
94
|
export * from './Student';
|
|
@@ -59,6 +99,7 @@ export * from './TeamMember';
|
|
|
59
99
|
export * from './URN';
|
|
60
100
|
export * from './Usage';
|
|
61
101
|
export * from './User';
|
|
102
|
+
export * from './UserDTO';
|
|
62
103
|
export * from './UserEvent';
|
|
63
104
|
export * from './UserOnboarding';
|
|
64
105
|
export * from './UserSettings';
|
package/lib/models/index.js
CHANGED
|
@@ -2,12 +2,43 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Models definitions for all Datalayer API services.
|
|
7
|
+
*
|
|
8
|
+
* This module consolidates all type definitions used by the SDK, providing
|
|
9
|
+
* comprehensive TypeScript support for requests, responses, and data models
|
|
10
|
+
* across all Datalayer services.
|
|
11
|
+
*
|
|
12
|
+
* These types follow the exact backend API format (snake_case naming) to
|
|
13
|
+
* ensure compatibility. For frontend business logic types with camelCase
|
|
14
|
+
* naming, see the models in `/src/models/`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import type {
|
|
19
|
+
* Runtime,
|
|
20
|
+
* Environment,
|
|
21
|
+
* Space,
|
|
22
|
+
* Notebook,
|
|
23
|
+
* User,
|
|
24
|
+
* LoginRequest
|
|
25
|
+
* } from '@datalayer/core/api/types';
|
|
26
|
+
*
|
|
27
|
+
* // Use types for function parameters and return values
|
|
28
|
+
* function createRuntime(config: CreateRuntimeRequest): Promise<Runtime> {
|
|
29
|
+
* // Implementation
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @module models
|
|
34
|
+
*/
|
|
5
35
|
export * from './AIAgent';
|
|
6
|
-
export * from './Base';
|
|
7
36
|
export * from './Assignment';
|
|
37
|
+
export * from './Base';
|
|
8
38
|
export * from './Cell';
|
|
9
39
|
export * from './CodeBlock';
|
|
10
40
|
export * from './CodefeedBlocks';
|
|
41
|
+
export * from './Common';
|
|
11
42
|
export * from './Contact';
|
|
12
43
|
export * from './ContactEvent';
|
|
13
44
|
export * from './ContactIAMProvider';
|
|
@@ -15,29 +46,35 @@ export * from './ContactTags';
|
|
|
15
46
|
export * from './Content';
|
|
16
47
|
export * from './Course';
|
|
17
48
|
export * from './Credits';
|
|
18
|
-
export * from './
|
|
49
|
+
export * from './CreditsDTO';
|
|
19
50
|
export * from './Dataset';
|
|
51
|
+
export * from './Datasource';
|
|
20
52
|
export * from './Dean';
|
|
21
53
|
export * from './Document';
|
|
22
54
|
export * from './Environment';
|
|
55
|
+
export * from './EnvironmentDTO';
|
|
23
56
|
export * from './Errors';
|
|
24
57
|
export * from './Exercise';
|
|
25
58
|
export * from './GrowthKPI';
|
|
59
|
+
export * from './IAM';
|
|
26
60
|
export * from './IAMProviderLinked';
|
|
27
61
|
export * from './IAMProviderPost';
|
|
28
|
-
export * from './IAMProvidersSpecs';
|
|
29
62
|
export * from './IAMProviderUsers';
|
|
30
|
-
export * from './
|
|
63
|
+
export * from './IAMProvidersSpecs';
|
|
31
64
|
export * from './IAMToken';
|
|
32
65
|
export * from './Inbound';
|
|
66
|
+
export * from './Instructor';
|
|
33
67
|
export * from './Invite';
|
|
34
68
|
export * from './Item';
|
|
69
|
+
export * from './ItemDTO';
|
|
35
70
|
export * from './ItemType';
|
|
36
71
|
export * from './LandingRoles';
|
|
37
72
|
export * from './Lesson';
|
|
73
|
+
export * from './LexicalDTO';
|
|
38
74
|
export * from './Library';
|
|
39
75
|
export * from './Member';
|
|
40
76
|
export * from './Notebook';
|
|
77
|
+
export * from './NotebookDTO';
|
|
41
78
|
export * from './Organization';
|
|
42
79
|
export * from './OrganizationMember';
|
|
43
80
|
export * from './Outbound';
|
|
@@ -49,10 +86,13 @@ export * from './RolesOrganization';
|
|
|
49
86
|
export * from './RolesPlatform';
|
|
50
87
|
export * from './RolesTeam';
|
|
51
88
|
export * from './Runtime';
|
|
89
|
+
export * from './RuntimeDTO';
|
|
52
90
|
export * from './RuntimeSnapshot';
|
|
91
|
+
export * from './RuntimeSnapshotDTO';
|
|
53
92
|
export * from './School';
|
|
54
93
|
export * from './Secret';
|
|
55
94
|
export * from './Space';
|
|
95
|
+
export * from './SpaceDTO';
|
|
56
96
|
export * from './SpaceItem';
|
|
57
97
|
export * from './SpaceMember';
|
|
58
98
|
export * from './Student';
|
|
@@ -63,6 +103,7 @@ export * from './TeamMember';
|
|
|
63
103
|
export * from './URN';
|
|
64
104
|
export * from './Usage';
|
|
65
105
|
export * from './User';
|
|
106
|
+
export * from './UserDTO';
|
|
66
107
|
export * from './UserEvent';
|
|
67
108
|
export * from './UserOnboarding';
|
|
68
109
|
export * from './UserSettings';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
"@primer/react": "^37.19.0",
|
|
104
104
|
"@primer/react-brand": "^0.58.0",
|
|
105
105
|
"@stripe/react-stripe-js": "^2.7.1",
|
|
106
|
+
"@tanstack/react-query": "^5.90.6",
|
|
106
107
|
"axios": "^1.7.7",
|
|
107
108
|
"boring-avatars": "^2.0.1",
|
|
108
109
|
"buffer": "^6.0.3",
|
package/lib/api/types/index.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TypeScript type definitions for all Datalayer API services.
|
|
3
|
-
*
|
|
4
|
-
* This module consolidates all type definitions used by the SDK, providing
|
|
5
|
-
* comprehensive TypeScript support for requests, responses, and data models
|
|
6
|
-
* across all Datalayer services.
|
|
7
|
-
*
|
|
8
|
-
* These types follow the exact backend API format (snake_case naming) to
|
|
9
|
-
* ensure compatibility. For frontend business logic types with camelCase
|
|
10
|
-
* naming, see the models in `/src/models/`.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import type {
|
|
15
|
-
* Runtime,
|
|
16
|
-
* Environment,
|
|
17
|
-
* Space,
|
|
18
|
-
* Notebook,
|
|
19
|
-
* User,
|
|
20
|
-
* LoginRequest
|
|
21
|
-
* } from '@datalayer/core/api/types';
|
|
22
|
-
*
|
|
23
|
-
* // Use types for function parameters and return values
|
|
24
|
-
* function createRuntime(config: CreateRuntimeRequest): Promise<Runtime> {
|
|
25
|
-
* // Implementation
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @module types
|
|
30
|
-
*/
|
|
31
|
-
export * from './common';
|
|
32
|
-
export * from './runtimes';
|
|
33
|
-
export * from './iam';
|
|
34
|
-
export * from './spacer';
|