@datalayer/core 0.0.20 → 0.0.21
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/iam/datasources.d.ts +86 -0
- package/lib/api/iam/datasources.js +185 -0
- package/lib/api/iam/index.d.ts +2 -0
- package/lib/api/iam/index.js +2 -0
- package/lib/api/iam/secrets.d.ts +85 -0
- package/lib/api/iam/secrets.js +196 -0
- package/lib/client/auth/storage.js +17 -62
- package/lib/client/base.d.ts +3 -0
- package/lib/client/base.js +2 -2
- package/lib/client/index.d.ts +82 -3
- package/lib/client/index.js +5 -1
- package/lib/client/mixins/IAMMixin.d.ts +62 -0
- package/lib/client/mixins/IAMMixin.js +116 -0
- package/lib/collaboration/DatalayerCollaboration.d.ts +1 -2
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +1 -1
- package/lib/collaboration/DatalayerCollaborationProvider.js +1 -1
- package/lib/hooks/useBackdrop.d.ts +2 -3
- package/lib/hooks/useBackdropJupyterLab.d.ts +2 -2
- package/lib/hooks/useCache.d.ts +3 -3
- package/lib/hooks/useScreenshot.d.ts +2 -3
- package/lib/hooks/useWindowSize.d.ts +1 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -1
- package/lib/models/Datasource.d.ts +170 -0
- package/lib/models/Datasource.js +140 -0
- package/lib/models/Runtime.d.ts +1 -1
- package/lib/models/RuntimeSnapshotDTO.d.ts +1 -1
- package/lib/models/RuntimeSnapshotDTO.js +1 -1
- package/lib/models/Secret.d.ts +159 -0
- package/lib/models/Secret.js +135 -0
- package/lib/models/SpaceDTO.d.ts +0 -11
- package/lib/state/substates/IAMState.d.ts +1 -1
- package/lib/state/substates/LayoutState.d.ts +2 -2
- package/lib/state/substates/NbformatState.d.ts +1 -1
- package/lib/utils/File.d.ts +1 -1
- package/lib/utils/File.js +1 -1
- package/lib/utils/Notebook.d.ts +5 -3
- package/lib/utils/Notebook.js +5 -3
- package/package.json +7 -5
- package/patches/.gitkeep +1 -0
- package/patches/@datalayer+jupyter-lexical+1.0.7.patch +5491 -0
- package/patches/@datalayer+jupyter-react+2.0.1.patch +2674 -0
- package/scripts/apply-patches.sh +44 -0
- package/scripts/create-patches.sh +40 -0
- package/scripts/fix-esm-imports.cjs +124 -0
- package/scripts/sync-jupyter.sh +121 -0
|
@@ -114,12 +114,18 @@ export class NodeStorage {
|
|
|
114
114
|
this.serviceUrl = serviceUrl;
|
|
115
115
|
try {
|
|
116
116
|
// Load keytar for system keyring access
|
|
117
|
-
// VS Code
|
|
118
|
-
//
|
|
119
|
-
|
|
117
|
+
// VS Code bundles keytar, but require path may vary
|
|
118
|
+
// Try multiple possible paths for compatibility
|
|
119
|
+
try {
|
|
120
|
+
this.keytar = require('keytar');
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
// Try alternate path for VS Code bundled keytar
|
|
124
|
+
this.keytar = require('@vscode/keytar');
|
|
125
|
+
}
|
|
120
126
|
}
|
|
121
127
|
catch (e) {
|
|
122
|
-
// Keyring not available,
|
|
128
|
+
// Keyring not available, tokens will not persist across sessions
|
|
123
129
|
console.warn('keytar not available, tokens will not persist');
|
|
124
130
|
}
|
|
125
131
|
}
|
|
@@ -128,181 +134,137 @@ export class NodeStorage {
|
|
|
128
134
|
* Supports both sync (getPasswordSync) and async (getPassword) keytar APIs
|
|
129
135
|
*/
|
|
130
136
|
get(key) {
|
|
131
|
-
console.log('[NodeStorage.get] key:', key, 'keytar available:', !!this.keytar);
|
|
132
137
|
// 1. Try keyring first (if available)
|
|
133
138
|
if (this.keytar) {
|
|
134
139
|
try {
|
|
135
140
|
// Try sync API first (CLI keytar)
|
|
136
141
|
if (this.keytar.getPasswordSync) {
|
|
137
|
-
console.log('[NodeStorage.get] using keytar.getPasswordSync');
|
|
138
142
|
const value = this.keytar.getPasswordSync(this.serviceUrl, key);
|
|
139
|
-
console.log('[NodeStorage.get] keytar returned:', value ? 'token found' : 'null');
|
|
140
143
|
if (value)
|
|
141
144
|
return value;
|
|
142
145
|
}
|
|
143
|
-
else {
|
|
144
|
-
console.log('[NodeStorage.get] getPasswordSync not available, skipping sync keytar');
|
|
145
|
-
}
|
|
146
146
|
}
|
|
147
147
|
catch (e) {
|
|
148
|
-
console.warn('[NodeStorage.get] keytar.getPasswordSync failed:', e);
|
|
149
148
|
// Fall through to other methods
|
|
150
149
|
}
|
|
151
150
|
}
|
|
152
151
|
// 2. Try environment variables
|
|
153
152
|
const envValue = process.env[key];
|
|
154
|
-
console.log('[NodeStorage.get] env var', key, ':', envValue ? 'found' : 'not found');
|
|
155
153
|
if (envValue)
|
|
156
154
|
return envValue;
|
|
157
155
|
// 3. Fall back to memory storage
|
|
158
|
-
|
|
159
|
-
console.log('[NodeStorage.get] memory storage:', memValue ? 'found' : 'not found');
|
|
160
|
-
return memValue;
|
|
156
|
+
return this.memoryStorage.get(key) || null;
|
|
161
157
|
}
|
|
162
158
|
/**
|
|
163
159
|
* Set token in keyring or memory storage (sync version)
|
|
164
160
|
*/
|
|
165
161
|
set(key, value) {
|
|
166
|
-
console.log('[NodeStorage.set] key:', key, 'keytar available:', !!this.keytar);
|
|
167
162
|
// Store in keyring if available and has sync API
|
|
168
163
|
if (this.keytar && this.keytar.setPasswordSync) {
|
|
169
164
|
try {
|
|
170
|
-
console.log('[NodeStorage.set] calling keytar.setPasswordSync');
|
|
171
165
|
this.keytar.setPasswordSync(this.serviceUrl, key, value);
|
|
172
|
-
console.log('[NodeStorage.set] keytar.setPasswordSync succeeded');
|
|
173
166
|
return;
|
|
174
167
|
}
|
|
175
168
|
catch (e) {
|
|
176
|
-
|
|
169
|
+
// Fall through to memory storage
|
|
177
170
|
}
|
|
178
171
|
}
|
|
179
|
-
else if (this.keytar) {
|
|
180
|
-
console.log('[NodeStorage.set] setPasswordSync not available, use setAsync() instead');
|
|
181
|
-
}
|
|
182
172
|
// Fall back to memory
|
|
183
|
-
console.log('[NodeStorage.set] falling back to memory storage');
|
|
184
173
|
this.memoryStorage.set(key, value);
|
|
185
174
|
}
|
|
186
175
|
/**
|
|
187
176
|
* Async version of set - supports VS Code's async keytar API
|
|
188
177
|
*/
|
|
189
178
|
async setAsync(key, value) {
|
|
190
|
-
console.log('[NodeStorage.setAsync] key:', key, 'keytar available:', !!this.keytar);
|
|
191
179
|
// Store in keyring if available
|
|
192
180
|
if (this.keytar) {
|
|
193
181
|
try {
|
|
194
182
|
// Try async API (VS Code keytar)
|
|
195
183
|
if (this.keytar.setPassword) {
|
|
196
|
-
console.log('[NodeStorage.setAsync] calling keytar.setPassword (async)');
|
|
197
184
|
await this.keytar.setPassword(this.serviceUrl, key, value);
|
|
198
|
-
console.log('[NodeStorage.setAsync] keytar.setPassword succeeded');
|
|
199
185
|
// IMPORTANT: Also store in memory so synchronous get() can access it
|
|
200
186
|
this.memoryStorage.set(key, value);
|
|
201
187
|
return;
|
|
202
188
|
}
|
|
203
189
|
// Try sync API (CLI keytar)
|
|
204
190
|
else if (this.keytar.setPasswordSync) {
|
|
205
|
-
console.log('[NodeStorage.setAsync] calling keytar.setPasswordSync');
|
|
206
191
|
this.keytar.setPasswordSync(this.serviceUrl, key, value);
|
|
207
|
-
console.log('[NodeStorage.setAsync] keytar.setPasswordSync succeeded');
|
|
208
192
|
// Also store in memory for consistency
|
|
209
193
|
this.memoryStorage.set(key, value);
|
|
210
194
|
return;
|
|
211
195
|
}
|
|
212
196
|
}
|
|
213
197
|
catch (e) {
|
|
214
|
-
|
|
198
|
+
// Fall through to memory storage
|
|
215
199
|
}
|
|
216
200
|
}
|
|
217
201
|
// Fall back to memory
|
|
218
|
-
console.log('[NodeStorage.setAsync] falling back to memory storage');
|
|
219
202
|
this.memoryStorage.set(key, value);
|
|
220
203
|
}
|
|
221
204
|
/**
|
|
222
205
|
* Async version of get - supports VS Code's async keytar API
|
|
223
206
|
*/
|
|
224
207
|
async getAsync(key) {
|
|
225
|
-
console.log('[NodeStorage.getAsync] key:', key, 'keytar available:', !!this.keytar);
|
|
226
208
|
// Try keyring first (if available)
|
|
227
209
|
if (this.keytar) {
|
|
228
210
|
try {
|
|
229
211
|
// Try async API (VS Code keytar)
|
|
230
212
|
if (this.keytar.getPassword) {
|
|
231
|
-
console.log('[NodeStorage.getAsync] calling keytar.getPassword (async)');
|
|
232
213
|
const value = await this.keytar.getPassword(this.serviceUrl, key);
|
|
233
|
-
console.log('[NodeStorage.getAsync] keytar returned:', value ? 'token found' : 'null');
|
|
234
214
|
if (value)
|
|
235
215
|
return value;
|
|
236
216
|
}
|
|
237
217
|
// Try sync API (CLI keytar)
|
|
238
218
|
else if (this.keytar.getPasswordSync) {
|
|
239
|
-
console.log('[NodeStorage.getAsync] calling keytar.getPasswordSync');
|
|
240
219
|
const value = this.keytar.getPasswordSync(this.serviceUrl, key);
|
|
241
|
-
console.log('[NodeStorage.getAsync] keytar returned:', value ? 'token found' : 'null');
|
|
242
220
|
if (value)
|
|
243
221
|
return value;
|
|
244
222
|
}
|
|
245
223
|
}
|
|
246
224
|
catch (e) {
|
|
247
|
-
|
|
225
|
+
// Fall through to other methods
|
|
248
226
|
}
|
|
249
227
|
}
|
|
250
228
|
// Try environment variables
|
|
251
229
|
const envValue = process.env[key];
|
|
252
|
-
console.log('[NodeStorage.getAsync] env var', key, ':', envValue ? 'found' : 'not found');
|
|
253
230
|
if (envValue)
|
|
254
231
|
return envValue;
|
|
255
232
|
// Fall back to memory storage
|
|
256
|
-
|
|
257
|
-
console.log('[NodeStorage.getAsync] memory storage:', memValue ? 'found' : 'not found');
|
|
258
|
-
return memValue;
|
|
233
|
+
return this.memoryStorage.get(key) || null;
|
|
259
234
|
}
|
|
260
235
|
/**
|
|
261
236
|
* Delete token from keyring or memory storage (sync version)
|
|
262
237
|
*/
|
|
263
238
|
delete(key) {
|
|
264
|
-
console.log('[NodeStorage.delete] key:', key, 'keytar available:', !!this.keytar);
|
|
265
239
|
if (this.keytar && this.keytar.deletePasswordSync) {
|
|
266
240
|
try {
|
|
267
|
-
console.log('[NodeStorage.delete] calling keytar.deletePasswordSync');
|
|
268
241
|
this.keytar.deletePasswordSync(this.serviceUrl, key);
|
|
269
|
-
console.log('[NodeStorage.delete] keytar.deletePasswordSync succeeded');
|
|
270
242
|
}
|
|
271
243
|
catch (e) {
|
|
272
|
-
|
|
244
|
+
// Fall through to memory deletion
|
|
273
245
|
}
|
|
274
246
|
}
|
|
275
|
-
else if (this.keytar) {
|
|
276
|
-
console.log('[NodeStorage.delete] deletePasswordSync not available, use deleteAsync() instead');
|
|
277
|
-
}
|
|
278
|
-
console.log('[NodeStorage.delete] deleting from memory storage');
|
|
279
247
|
this.memoryStorage.delete(key);
|
|
280
248
|
}
|
|
281
249
|
/**
|
|
282
250
|
* Async version of delete - supports VS Code's async keytar API
|
|
283
251
|
*/
|
|
284
252
|
async deleteAsync(key) {
|
|
285
|
-
console.log('[NodeStorage.deleteAsync] key:', key, 'keytar available:', !!this.keytar);
|
|
286
253
|
if (this.keytar) {
|
|
287
254
|
try {
|
|
288
255
|
// Try async API (VS Code keytar)
|
|
289
256
|
if (this.keytar.deletePassword) {
|
|
290
|
-
console.log('[NodeStorage.deleteAsync] calling keytar.deletePassword (async)');
|
|
291
257
|
await this.keytar.deletePassword(this.serviceUrl, key);
|
|
292
|
-
console.log('[NodeStorage.deleteAsync] keytar.deletePassword succeeded');
|
|
293
258
|
}
|
|
294
259
|
// Try sync API (CLI keytar)
|
|
295
260
|
else if (this.keytar.deletePasswordSync) {
|
|
296
|
-
console.log('[NodeStorage.deleteAsync] calling keytar.deletePasswordSync');
|
|
297
261
|
this.keytar.deletePasswordSync(this.serviceUrl, key);
|
|
298
|
-
console.log('[NodeStorage.deleteAsync] keytar.deletePasswordSync succeeded');
|
|
299
262
|
}
|
|
300
263
|
}
|
|
301
264
|
catch (e) {
|
|
302
|
-
|
|
265
|
+
// Fall through to memory deletion
|
|
303
266
|
}
|
|
304
267
|
}
|
|
305
|
-
console.log('[NodeStorage.deleteAsync] deleting from memory storage');
|
|
306
268
|
this.memoryStorage.delete(key);
|
|
307
269
|
}
|
|
308
270
|
/**
|
|
@@ -339,29 +301,22 @@ export class NodeStorage {
|
|
|
339
301
|
* Store authentication token (async version - use this in auth strategies)
|
|
340
302
|
*/
|
|
341
303
|
async setToken(token) {
|
|
342
|
-
console.log('[NodeStorage] setToken called, keytar available:', !!this.keytar);
|
|
343
|
-
console.log('[NodeStorage] storing token with key: access_token, service:', this.serviceUrl);
|
|
344
304
|
// Use async method to support VS Code's keytar
|
|
345
305
|
await this.setAsync('access_token', token);
|
|
346
|
-
console.log('[NodeStorage] token stored successfully');
|
|
347
306
|
}
|
|
348
307
|
/**
|
|
349
308
|
* Delete authentication token (async version - use this in auth manager)
|
|
350
309
|
*/
|
|
351
310
|
async deleteToken() {
|
|
352
|
-
console.log('[NodeStorage] deleteToken called');
|
|
353
311
|
// Use async method to support VS Code's keytar
|
|
354
312
|
await this.deleteAsync('access_token');
|
|
355
|
-
console.log('[NodeStorage] token deleted successfully');
|
|
356
313
|
}
|
|
357
314
|
/**
|
|
358
315
|
* Clear all authentication data (async version - use this in auth manager)
|
|
359
316
|
*/
|
|
360
317
|
async clear() {
|
|
361
|
-
console.log('[NodeStorage] clear called');
|
|
362
318
|
await this.deleteToken();
|
|
363
319
|
this.memoryStorage.clear();
|
|
364
|
-
console.log('[NodeStorage] all data cleared');
|
|
365
320
|
}
|
|
366
321
|
}
|
|
367
322
|
/**
|
package/lib/client/base.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EnvironmentDTO } from '../models/EnvironmentDTO';
|
|
2
2
|
import { AuthenticationManager } from './auth';
|
|
3
|
+
import type { TokenStorage } from './auth/types';
|
|
3
4
|
/** Handlers for SDK method lifecycle events. */
|
|
4
5
|
export interface SDKHandlers {
|
|
5
6
|
/** Called before any SDK method execution */
|
|
@@ -19,6 +20,8 @@ export interface DatalayerClientConfig {
|
|
|
19
20
|
runtimesRunUrl?: string;
|
|
20
21
|
/** URL for the Spacer service */
|
|
21
22
|
spacerRunUrl?: string;
|
|
23
|
+
/** Custom token storage backend (optional, defaults to auto-detected) */
|
|
24
|
+
storage?: TokenStorage;
|
|
22
25
|
/** Handlers for intercepting SDK method calls */
|
|
23
26
|
handlers?: SDKHandlers;
|
|
24
27
|
}
|
package/lib/client/base.js
CHANGED
|
@@ -35,8 +35,8 @@ export class DatalayerClientBase {
|
|
|
35
35
|
this.spacerRunUrl = config.spacerRunUrl || DEFAULT_SERVICE_URLS.SPACER;
|
|
36
36
|
this.token = config.token;
|
|
37
37
|
this.handlers = config.handlers;
|
|
38
|
-
// Initialize authentication manager
|
|
39
|
-
this.auth = new AuthenticationManager(this.iamRunUrl);
|
|
38
|
+
// Initialize authentication manager with custom storage if provided
|
|
39
|
+
this.auth = new AuthenticationManager(this.iamRunUrl, config.storage);
|
|
40
40
|
// If a token was provided, store it in the auth manager
|
|
41
41
|
if (this.token) {
|
|
42
42
|
this.auth.storeToken(this.token);
|
package/lib/client/index.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ import type { SpaceDTO } from '../models/SpaceDTO';
|
|
|
24
24
|
import type { NotebookDTO } from '../models/NotebookDTO';
|
|
25
25
|
import type { LexicalDTO } from '../models/LexicalDTO';
|
|
26
26
|
import type { HealthCheck } from '../models/HealthCheck';
|
|
27
|
+
import type { SecretDTO } from '../models/Secret';
|
|
28
|
+
import type { CreateSecretRequest, UpdateSecretRequest } from '../models/Secret';
|
|
29
|
+
import type { DatasourceDTO } from '../models/Datasource';
|
|
30
|
+
import type { CreateDatasourceRequest, UpdateDatasourceRequest } from '../models/Datasource';
|
|
27
31
|
declare const DatalayerClientWithMixins: typeof DatalayerClientBase;
|
|
28
32
|
/**
|
|
29
33
|
* Main Datalayer Client providing unified access to all platform services.
|
|
@@ -53,19 +57,84 @@ export declare class DatalayerClient extends DatalayerClientWithMixins {
|
|
|
53
57
|
export type { DatalayerClientConfig, SDKHandlers };
|
|
54
58
|
export { DatalayerClientBase };
|
|
55
59
|
export { UserDTO as User } from './../models/UserDTO';
|
|
56
|
-
export type { UserJSON } from './../models/UserDTO';
|
|
60
|
+
export type { UserJSON, UserData } from './../models/UserDTO';
|
|
57
61
|
export { RuntimeDTO as Runtime } from '../models/RuntimeDTO';
|
|
58
|
-
export type { RuntimeJSON } from '../models/RuntimeDTO';
|
|
62
|
+
export type { RuntimeJSON, RuntimeData, CreateRuntimeRequest, CreateRuntimeResponse, ListRuntimesResponse, } from '../models/RuntimeDTO';
|
|
59
63
|
export { EnvironmentDTO as Environment } from '../models/EnvironmentDTO';
|
|
60
|
-
export type { EnvironmentJSON } from '../models/EnvironmentDTO';
|
|
64
|
+
export type { EnvironmentJSON, EnvironmentData, ListEnvironmentsResponse, } from '../models/EnvironmentDTO';
|
|
61
65
|
export { RuntimeSnapshotDTO as Snapshot } from '../models/RuntimeSnapshotDTO';
|
|
66
|
+
export type { RuntimeSnapshotJSON, RuntimeSnapshotData, CreateRuntimeSnapshotRequest, CreateRuntimeSnapshotResponse, GetRuntimeSnapshotResponse, ListRuntimeSnapshotsResponse, } from '../models/RuntimeSnapshotDTO';
|
|
62
67
|
export { SpaceDTO as Space } from '../models/SpaceDTO';
|
|
68
|
+
export type { SpaceJSON, SpaceData, SpaceItem, CreateSpaceRequest, CreateSpaceResponse, SpacesForUserResponse, CollaborationSessionResponse, DeleteSpaceItemResponse, GetSpaceItemResponse, GetSpaceItemsResponse, CreateNotebookRequest, CreateNotebookResponse, GetNotebookResponse, UpdateNotebookRequest, UpdateNotebookResponse, } from '../models/SpaceDTO';
|
|
63
69
|
export { NotebookDTO as Notebook } from '../models/NotebookDTO';
|
|
70
|
+
export type { NotebookJSON, NotebookData } from '../models/NotebookDTO';
|
|
64
71
|
export { LexicalDTO } from '../models/LexicalDTO';
|
|
72
|
+
export type { LexicalJSON, LexicalData, CreateLexicalRequest, CreateLexicalResponse, GetLexicalResponse, UpdateLexicalRequest, UpdateLexicalResponse, } from '../models/LexicalDTO';
|
|
65
73
|
export { CreditsDTO as Credits } from '../models/CreditsDTO';
|
|
74
|
+
export type { CreditsInfo, CreditReservation, CreditsResponse, } from '../models/CreditsDTO';
|
|
66
75
|
export { ItemDTO as Item } from '../models/ItemDTO';
|
|
67
76
|
export { HealthCheck } from '../models/HealthCheck';
|
|
68
77
|
export type { HealthCheckJSON } from '../models/HealthCheck';
|
|
78
|
+
export { SecretDTO as Secret } from './../models/Secret';
|
|
79
|
+
export type { SecretJSON, SecretData, CreateSecretRequest, UpdateSecretRequest, CreateSecretResponse, GetSecretResponse, ListSecretsResponse, UpdateSecretResponse, DeleteSecretResponse, } from './../models/Secret';
|
|
80
|
+
export { DatasourceDTO as Datasource } from './../models/Datasource';
|
|
81
|
+
export type { DatasourceJSON, DatasourceData, DatasourceType, CreateDatasourceRequest, UpdateDatasourceRequest, CreateDatasourceResponse, GetDatasourceResponse, ListDatasourcesResponse, UpdateDatasourceResponse, } from './../models/Datasource';
|
|
82
|
+
export type { LoginRequest, LoginResponse, UserMeResponse, MembershipsResponse, WhoAmIResponse, } from '../models/IAM';
|
|
83
|
+
export type { HealthzPingResponse } from '../models/Common';
|
|
84
|
+
export { AuthenticationManager } from './auth/AuthenticationManager';
|
|
85
|
+
export type { IUser, IBaseUser } from '../models/User';
|
|
86
|
+
export type { ICell } from '../models/Cell';
|
|
87
|
+
export type { IDatasource, IDatasourceVariant } from '../models/Datasource';
|
|
88
|
+
export type { ICredits, ICreditsReservation } from '../models/Credits';
|
|
89
|
+
export type { ISpaceItem } from '../models/SpaceItem';
|
|
90
|
+
export type { ISurvey } from '../models/Survey';
|
|
91
|
+
export type { ISpace, IBaseSpace, IAnySpace, ISpaceVariant, } from '../models/Space';
|
|
92
|
+
export type { IBaseTeam, IAnyTeam } from '../models/Team';
|
|
93
|
+
export type { IOrganization, IAnyOrganization, IBaseOrganization, } from '../models/Organization';
|
|
94
|
+
export type { IRuntimeModel, IRuntimePod, IRuntimeType, IRuntimeLocation, IRuntimeCapabilities, } from '../models/Runtime';
|
|
95
|
+
export type { IRuntimeSnapshot } from '../models/RuntimeSnapshot';
|
|
96
|
+
export type { IDatalayerEnvironment, IResources, ISnippet, } from '../models/Environment';
|
|
97
|
+
export type { IRole } from '../models/Role';
|
|
98
|
+
export type { IAssignment } from '../models/Assignment';
|
|
99
|
+
export type { IContact } from '../models/Contact';
|
|
100
|
+
export type { ICourse } from '../models/Course';
|
|
101
|
+
export type { IOrganizationMember } from '../models/OrganizationMember';
|
|
102
|
+
export type { IPage, PageTheme, PageVariant } from '../models/Page';
|
|
103
|
+
export type { PageTagName } from '../models/PageTag';
|
|
104
|
+
export type { ISecret, ISecretVariant } from '../models/Secret';
|
|
105
|
+
export type { IIAMToken, IIAMTokenVariant } from '../models/IAMToken';
|
|
106
|
+
export type { IDocument, IBaseDocument } from '../models/Document';
|
|
107
|
+
export type { IEnvironment } from '../models/Environment';
|
|
108
|
+
export type { IExercise, ICode, IHelp } from '../models/Exercise';
|
|
109
|
+
export type { IInvite } from '../models/Invite';
|
|
110
|
+
export type { ILesson } from '../models/Lesson';
|
|
111
|
+
export type { INotebook, IBaseNotebook } from '../models/Notebook';
|
|
112
|
+
export type { ISchool } from '../models/School';
|
|
113
|
+
export type { ITeam } from '../models/Team';
|
|
114
|
+
export type { TeamMember } from '../models/TeamMember';
|
|
115
|
+
export type { IUserOnboarding, IClient, IOnboardingPosition, IOnboardingTours, ITour, ITourStatus, } from '../models/UserOnboarding';
|
|
116
|
+
export type { IUserSettings } from '../models/UserSettings';
|
|
117
|
+
export type { IDataset } from '../models/Dataset';
|
|
118
|
+
export type { IUsage } from '../models/Usage';
|
|
119
|
+
export type { IItem } from '../models/Item';
|
|
120
|
+
export type { IItemType } from '../models/ItemType';
|
|
121
|
+
export type { Member } from '../models/Member';
|
|
122
|
+
export type { Profile } from '../models/Profile';
|
|
123
|
+
export type { SpaceMember } from '../models/SpaceMember';
|
|
124
|
+
export type { IContactEvent } from '../models/ContactEvent';
|
|
125
|
+
export type { IContactIAMProvider } from '../models/ContactIAMProvider';
|
|
126
|
+
export type { IStudentItem } from '../models/StudentItem';
|
|
127
|
+
export type { Instructor } from '../models/Instructor';
|
|
128
|
+
export type { IStudent } from '../models/Student';
|
|
129
|
+
export type { IDean } from '../models/Dean';
|
|
130
|
+
export type { IUserEvent } from '../models/UserEvent';
|
|
131
|
+
export type { IIAMProviderLinked } from '../models/IAMProviderLinked';
|
|
132
|
+
export type { IContent } from '../models/Content';
|
|
133
|
+
export type { AuthResult, TokenValidationResult, AuthOptions, TokenStorage, } from './auth/types';
|
|
134
|
+
export type { IRuntimeOptions, IMultiServiceManager, IRemoteServicesManager, IEnvironmentsManager, IRemoteRuntimesManager, } from '../stateful/runtimes/apis';
|
|
135
|
+
export type { IDatalayerCoreConfig, IRuntimesConfiguration, } from '../config/Configuration';
|
|
136
|
+
export type { IIAMProviderName } from '../models/IAMProvidersSpecs';
|
|
137
|
+
export type { NavigationLinkProps } from '../navigation/components';
|
|
69
138
|
export { ItemTypes } from './constants';
|
|
70
139
|
export type { ItemType } from './constants';
|
|
71
140
|
export * from './auth';
|
|
@@ -79,6 +148,16 @@ export interface DatalayerClient {
|
|
|
79
148
|
calculateMaxRuntimeMinutes(availableCredits: number, burningRate: number): number;
|
|
80
149
|
calculateCreditsRequired(minutes: number, burningRate: number): number;
|
|
81
150
|
checkIAMHealth(): Promise<HealthCheck>;
|
|
151
|
+
createSecret(data: CreateSecretRequest): Promise<SecretDTO>;
|
|
152
|
+
listSecrets(): Promise<SecretDTO[]>;
|
|
153
|
+
getSecret(secretId: string): Promise<SecretDTO>;
|
|
154
|
+
updateSecret(secretId: string, updates: UpdateSecretRequest): Promise<SecretDTO>;
|
|
155
|
+
deleteSecret(secretId: string): Promise<void>;
|
|
156
|
+
createDatasource(data: CreateDatasourceRequest): Promise<DatasourceDTO>;
|
|
157
|
+
listDatasources(): Promise<DatasourceDTO[]>;
|
|
158
|
+
getDatasource(datasourceId: string): Promise<DatasourceDTO>;
|
|
159
|
+
updateDatasource(datasourceId: string, updates: UpdateDatasourceRequest): Promise<DatasourceDTO>;
|
|
160
|
+
deleteDatasource(datasourceId: string): Promise<void>;
|
|
82
161
|
listEnvironments(): Promise<EnvironmentDTO[]>;
|
|
83
162
|
ensureRuntime(environmentName?: string, creditsLimit?: number, waitForReady?: boolean, maxWaitTime?: number, reuseExisting?: boolean, snapshotId?: string): Promise<RuntimeDTO>;
|
|
84
163
|
createRuntime(environmentName: string, type: 'notebook' | 'terminal' | 'job', givenName: string, minutesLimit: number, fromSnapshotId?: string): Promise<RuntimeDTO>;
|
package/lib/client/index.js
CHANGED
|
@@ -75,7 +75,11 @@ export { LexicalDTO } from '../models/LexicalDTO';
|
|
|
75
75
|
export { CreditsDTO as Credits } from '../models/CreditsDTO';
|
|
76
76
|
export { ItemDTO as Item } from '../models/ItemDTO';
|
|
77
77
|
export { HealthCheck } from '../models/HealthCheck';
|
|
78
|
-
|
|
78
|
+
export { SecretDTO as Secret } from './../models/Secret';
|
|
79
|
+
export { DatasourceDTO as Datasource } from './../models/Datasource';
|
|
80
|
+
// Export auth types
|
|
81
|
+
export { AuthenticationManager } from './auth/AuthenticationManager';
|
|
82
|
+
// Constants
|
|
79
83
|
export { ItemTypes } from './constants';
|
|
80
84
|
// Export authentication module
|
|
81
85
|
export * from './auth';
|
|
@@ -2,6 +2,10 @@ import type { Constructor } from '../utils/mixins';
|
|
|
2
2
|
import { UserDTO } from '../../models/UserDTO';
|
|
3
3
|
import { CreditsDTO } from '../../models/CreditsDTO';
|
|
4
4
|
import { HealthCheck } from '../../models/HealthCheck';
|
|
5
|
+
import { SecretDTO } from '../../models/Secret';
|
|
6
|
+
import type { CreateSecretRequest, UpdateSecretRequest } from '../../models/Secret';
|
|
7
|
+
import { DatasourceDTO } from '../../models/Datasource';
|
|
8
|
+
import type { CreateDatasourceRequest, UpdateDatasourceRequest } from '../../models/Datasource';
|
|
5
9
|
/** IAM mixin providing authentication and user management. */
|
|
6
10
|
export declare function IAMMixin<TBase extends Constructor>(Base: TBase): {
|
|
7
11
|
new (...args: any[]): {
|
|
@@ -50,5 +54,63 @@ export declare function IAMMixin<TBase extends Constructor>(Base: TBase): {
|
|
|
50
54
|
* @returns Health check model instance
|
|
51
55
|
*/
|
|
52
56
|
checkIAMHealth(): Promise<HealthCheck>;
|
|
57
|
+
/**
|
|
58
|
+
* Create a new secret.
|
|
59
|
+
* @param data - Secret configuration
|
|
60
|
+
* @returns Created secret instance
|
|
61
|
+
*/
|
|
62
|
+
createSecret(data: CreateSecretRequest): Promise<SecretDTO>;
|
|
63
|
+
/**
|
|
64
|
+
* List all secrets.
|
|
65
|
+
* @returns Array of secret instances
|
|
66
|
+
*/
|
|
67
|
+
listSecrets(): Promise<SecretDTO[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Get a specific secret by ID.
|
|
70
|
+
* @param secretId - Secret unique identifier
|
|
71
|
+
* @returns Secret instance
|
|
72
|
+
*/
|
|
73
|
+
getSecret(secretId: string): Promise<SecretDTO>;
|
|
74
|
+
/**
|
|
75
|
+
* Update a secret.
|
|
76
|
+
* @param secretId - Secret unique identifier
|
|
77
|
+
* @param updates - Fields to update
|
|
78
|
+
* @returns Updated secret instance
|
|
79
|
+
*/
|
|
80
|
+
updateSecret(secretId: string, updates: UpdateSecretRequest): Promise<SecretDTO>;
|
|
81
|
+
/**
|
|
82
|
+
* Delete a secret.
|
|
83
|
+
* @param secretId - Secret unique identifier
|
|
84
|
+
*/
|
|
85
|
+
deleteSecret(secretId: string): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Create a new datasource.
|
|
88
|
+
* @param data - Datasource configuration
|
|
89
|
+
* @returns Created datasource instance
|
|
90
|
+
*/
|
|
91
|
+
createDatasource(data: CreateDatasourceRequest): Promise<DatasourceDTO>;
|
|
92
|
+
/**
|
|
93
|
+
* List all datasources.
|
|
94
|
+
* @returns Array of datasource instances
|
|
95
|
+
*/
|
|
96
|
+
listDatasources(): Promise<DatasourceDTO[]>;
|
|
97
|
+
/**
|
|
98
|
+
* Get a specific datasource by ID.
|
|
99
|
+
* @param datasourceId - Datasource unique identifier
|
|
100
|
+
* @returns Datasource instance
|
|
101
|
+
*/
|
|
102
|
+
getDatasource(datasourceId: string): Promise<DatasourceDTO>;
|
|
103
|
+
/**
|
|
104
|
+
* Update a datasource.
|
|
105
|
+
* @param datasourceId - Datasource unique identifier
|
|
106
|
+
* @param updates - Fields to update
|
|
107
|
+
* @returns Updated datasource instance
|
|
108
|
+
*/
|
|
109
|
+
updateDatasource(datasourceId: string, updates: UpdateDatasourceRequest): Promise<DatasourceDTO>;
|
|
110
|
+
/**
|
|
111
|
+
* Delete a datasource.
|
|
112
|
+
* @param datasourceId - Datasource unique identifier
|
|
113
|
+
*/
|
|
114
|
+
deleteDatasource(datasourceId: string): Promise<void>;
|
|
53
115
|
};
|
|
54
116
|
} & TBase;
|
|
@@ -9,9 +9,13 @@
|
|
|
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 * as secrets from '../../api/iam/secrets';
|
|
13
|
+
import * as datasources from '../../api/iam/datasources';
|
|
12
14
|
import { UserDTO } from '../../models/UserDTO';
|
|
13
15
|
import { CreditsDTO } from '../../models/CreditsDTO';
|
|
14
16
|
import { HealthCheck } from '../../models/HealthCheck';
|
|
17
|
+
import { SecretDTO } from '../../models/Secret';
|
|
18
|
+
import { DatasourceDTO } from '../../models/Datasource';
|
|
15
19
|
/** IAM mixin providing authentication and user management. */
|
|
16
20
|
export function IAMMixin(Base) {
|
|
17
21
|
return class extends Base {
|
|
@@ -177,5 +181,117 @@ export function IAMMixin(Base) {
|
|
|
177
181
|
}, this);
|
|
178
182
|
}
|
|
179
183
|
}
|
|
184
|
+
// ========================================================================
|
|
185
|
+
// Secrets Management
|
|
186
|
+
// ========================================================================
|
|
187
|
+
/**
|
|
188
|
+
* Create a new secret.
|
|
189
|
+
* @param data - Secret configuration
|
|
190
|
+
* @returns Created secret instance
|
|
191
|
+
*/
|
|
192
|
+
async createSecret(data) {
|
|
193
|
+
const token = this.getToken();
|
|
194
|
+
const iamRunUrl = this.getIamRunUrl();
|
|
195
|
+
const response = await secrets.createSecret(token, data, iamRunUrl);
|
|
196
|
+
return new SecretDTO(response.secret, this);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* List all secrets.
|
|
200
|
+
* @returns Array of secret instances
|
|
201
|
+
*/
|
|
202
|
+
async listSecrets() {
|
|
203
|
+
const token = this.getToken();
|
|
204
|
+
const iamRunUrl = this.getIamRunUrl();
|
|
205
|
+
const response = await secrets.listSecrets(token, iamRunUrl);
|
|
206
|
+
return response.secrets.map(s => new SecretDTO(s, this));
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Get a specific secret by ID.
|
|
210
|
+
* @param secretId - Secret unique identifier
|
|
211
|
+
* @returns Secret instance
|
|
212
|
+
*/
|
|
213
|
+
async getSecret(secretId) {
|
|
214
|
+
const token = this.getToken();
|
|
215
|
+
const iamRunUrl = this.getIamRunUrl();
|
|
216
|
+
const response = await secrets.getSecret(token, secretId, iamRunUrl);
|
|
217
|
+
return new SecretDTO(response.secret, this);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Update a secret.
|
|
221
|
+
* @param secretId - Secret unique identifier
|
|
222
|
+
* @param updates - Fields to update
|
|
223
|
+
* @returns Updated secret instance
|
|
224
|
+
*/
|
|
225
|
+
async updateSecret(secretId, updates) {
|
|
226
|
+
const token = this.getToken();
|
|
227
|
+
const iamRunUrl = this.getIamRunUrl();
|
|
228
|
+
const response = await secrets.updateSecret(token, secretId, updates, iamRunUrl);
|
|
229
|
+
return new SecretDTO(response.secret, this);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Delete a secret.
|
|
233
|
+
* @param secretId - Secret unique identifier
|
|
234
|
+
*/
|
|
235
|
+
async deleteSecret(secretId) {
|
|
236
|
+
const token = this.getToken();
|
|
237
|
+
const iamRunUrl = this.getIamRunUrl();
|
|
238
|
+
await secrets.deleteSecret(token, secretId, iamRunUrl);
|
|
239
|
+
}
|
|
240
|
+
// ========================================================================
|
|
241
|
+
// Datasources Management
|
|
242
|
+
// ========================================================================
|
|
243
|
+
/**
|
|
244
|
+
* Create a new datasource.
|
|
245
|
+
* @param data - Datasource configuration
|
|
246
|
+
* @returns Created datasource instance
|
|
247
|
+
*/
|
|
248
|
+
async createDatasource(data) {
|
|
249
|
+
const token = this.getToken();
|
|
250
|
+
const iamRunUrl = this.getIamRunUrl();
|
|
251
|
+
const response = await datasources.createDatasource(token, data, iamRunUrl);
|
|
252
|
+
return new DatasourceDTO(response.datasource, this);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* List all datasources.
|
|
256
|
+
* @returns Array of datasource instances
|
|
257
|
+
*/
|
|
258
|
+
async listDatasources() {
|
|
259
|
+
const token = this.getToken();
|
|
260
|
+
const iamRunUrl = this.getIamRunUrl();
|
|
261
|
+
const response = await datasources.listDatasources(token, iamRunUrl);
|
|
262
|
+
return response.datasources.map(d => new DatasourceDTO(d, this));
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Get a specific datasource by ID.
|
|
266
|
+
* @param datasourceId - Datasource unique identifier
|
|
267
|
+
* @returns Datasource instance
|
|
268
|
+
*/
|
|
269
|
+
async getDatasource(datasourceId) {
|
|
270
|
+
const token = this.getToken();
|
|
271
|
+
const iamRunUrl = this.getIamRunUrl();
|
|
272
|
+
const response = await datasources.getDatasource(token, datasourceId, iamRunUrl);
|
|
273
|
+
return new DatasourceDTO(response.datasource, this);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Update a datasource.
|
|
277
|
+
* @param datasourceId - Datasource unique identifier
|
|
278
|
+
* @param updates - Fields to update
|
|
279
|
+
* @returns Updated datasource instance
|
|
280
|
+
*/
|
|
281
|
+
async updateDatasource(datasourceId, updates) {
|
|
282
|
+
const token = this.getToken();
|
|
283
|
+
const iamRunUrl = this.getIamRunUrl();
|
|
284
|
+
const response = await datasources.updateDatasource(token, datasourceId, updates, iamRunUrl);
|
|
285
|
+
return new DatasourceDTO(response.datasource, this);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Delete a datasource.
|
|
289
|
+
* @param datasourceId - Datasource unique identifier
|
|
290
|
+
*/
|
|
291
|
+
async deleteDatasource(datasourceId) {
|
|
292
|
+
const token = this.getToken();
|
|
293
|
+
const iamRunUrl = this.getIamRunUrl();
|
|
294
|
+
await datasources.deleteDatasource(token, datasourceId, iamRunUrl);
|
|
295
|
+
}
|
|
180
296
|
};
|
|
181
297
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type IFetchSessionId = {
|
|
1
|
+
export type IFetchSessionId = {
|
|
2
2
|
url: string;
|
|
3
3
|
token?: string;
|
|
4
4
|
/**
|
|
@@ -11,4 +11,3 @@ type IFetchSessionId = {
|
|
|
11
11
|
* Fetch the session ID of a collaborative documents from Datalayer.
|
|
12
12
|
*/
|
|
13
13
|
export declare function requestDatalayerCollaborationSessionId({ url, token, fetchFn, }: IFetchSessionId): Promise<string>;
|
|
14
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { YNotebook } from '@jupyter/ydoc';
|
|
2
2
|
import { WebsocketProvider } from 'y-websocket';
|
|
3
3
|
import type { ICollaborationProvider, ICollaborationProviderEvents } from '@datalayer/jupyter-react';
|
|
4
|
-
declare enum CollaborationStatus {
|
|
4
|
+
export declare enum CollaborationStatus {
|
|
5
5
|
Disconnected = "disconnected",
|
|
6
6
|
Connecting = "connecting",
|
|
7
7
|
Connected = "connected",
|
|
@@ -6,7 +6,7 @@ import { WebsocketProvider } from 'y-websocket';
|
|
|
6
6
|
import { URLExt } from '@jupyterlab/coreutils';
|
|
7
7
|
import { Signal } from '@lumino/signaling';
|
|
8
8
|
// Import CollaborationStatus enum separately since it's exported
|
|
9
|
-
var CollaborationStatus;
|
|
9
|
+
export var CollaborationStatus;
|
|
10
10
|
(function (CollaborationStatus) {
|
|
11
11
|
CollaborationStatus["Disconnected"] = "disconnected";
|
|
12
12
|
CollaborationStatus["Connecting"] = "connecting";
|