@datalayer/core 0.0.26 → 1.0.1
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/index.d.ts +1 -1
- package/lib/api/index.js +1 -1
- package/lib/client/utils/spacerUtils.d.ts +2 -2
- package/lib/client/utils/spacerUtils.js +4 -4
- package/lib/components/auth/Login.d.ts +4 -0
- package/lib/components/auth/Login.js +8 -2
- package/lib/components/auth/Login.stories.d.ts +1 -0
- package/lib/components/progress/ConsumptionBar.js +7 -7
- package/lib/components/progress/CreditsIndicator.d.ts +7 -1
- package/lib/components/progress/CreditsIndicator.js +4 -2
- package/lib/components/{screenshot/ScreenCapture.d.ts → screencapture/Screencapture.d.ts} +5 -5
- package/lib/components/{screenshot/ScreenCapture.js → screencapture/Screencapture.js} +2 -2
- package/lib/components/screencapture/ScreencaptureButton.d.ts +3 -0
- package/lib/components/{screenshot/ScreenCaptureButton.js → screencapture/ScreencaptureButton.js} +8 -8
- package/lib/components/screencapture/index.d.ts +2 -0
- package/lib/components/{screenshot → screencapture}/index.js +2 -2
- package/lib/components/storage/ContentsBrowser.js +2 -2
- package/lib/hooks/index.d.ts +1 -1
- package/lib/hooks/index.js +1 -1
- package/lib/hooks/layouts/{LayoutScreenshot.css → LayoutScreencapture.css} +2 -2
- package/lib/hooks/layouts/LayoutScreencapture.d.ts +3 -0
- package/lib/hooks/layouts/{LayoutScreenshot.js → LayoutScreencapture.js} +14 -14
- package/lib/hooks/layouts/index.d.ts +1 -1
- package/lib/hooks/layouts/index.js +1 -1
- package/lib/hooks/useCache.d.ts +12 -2
- package/lib/hooks/useCache.js +180 -68
- package/lib/hooks/useCellOutputshot.js +2 -2
- package/lib/hooks/useScreencapture.d.ts +18 -0
- package/lib/hooks/useScreencapture.js +53 -0
- package/lib/models/CreditsDTO.d.ts +1 -1
- package/lib/models/CreditsDTO.js +1 -1
- package/lib/models/Datasource.d.ts +4 -4
- package/lib/models/Datasource.js +7 -7
- package/lib/models/EnvironmentDTO.d.ts +3 -3
- package/lib/models/EnvironmentDTO.js +3 -3
- package/lib/models/HealthCheck.d.ts +2 -2
- package/lib/models/HealthCheck.js +2 -2
- package/lib/models/IAMProviderUsers.d.ts +11 -0
- package/lib/models/IAMProvidersSpecs.d.ts +2 -1
- package/lib/models/IAMProvidersSpecs.js +14 -0
- package/lib/models/ItemDTO.d.ts +3 -3
- package/lib/models/ItemDTO.js +10 -10
- package/lib/models/LexicalDTO.d.ts +3 -3
- package/lib/models/LexicalDTO.js +4 -4
- package/lib/models/NotebookDTO.d.ts +3 -3
- package/lib/models/NotebookDTO.js +6 -6
- package/lib/models/Page.js +1 -1
- package/lib/models/PageTag.d.ts +1 -1
- package/lib/models/PageTag.js +21 -0
- package/lib/models/RuntimeDTO.d.ts +4 -4
- package/lib/models/RuntimeDTO.js +9 -9
- package/lib/models/RuntimeSnapshotDTO.d.ts +3 -3
- package/lib/models/RuntimeSnapshotDTO.js +7 -7
- package/lib/models/Secret.d.ts +4 -4
- package/lib/models/Secret.js +7 -7
- package/lib/models/Space.js +3 -0
- package/lib/models/SpaceDTO.d.ts +3 -3
- package/lib/models/SpaceDTO.js +14 -14
- package/lib/models/UserDTO.d.ts +2 -2
- package/lib/models/UserDTO.js +2 -2
- package/lib/state/substates/LayoutState.d.ts +5 -5
- package/lib/state/substates/LayoutState.js +3 -3
- package/lib/theme/DatalayerTheme.js +5 -5
- package/lib/utils/Screencapture.d.ts +1 -0
- package/lib/utils/{Screenshot.js → Screencapture.js} +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/views/datasources/DatasourceNew.d.ts +7 -1
- package/lib/views/datasources/DatasourceNew.js +3 -3
- package/lib/views/datasources/Datasources.d.ts +7 -1
- package/lib/views/datasources/Datasources.js +6 -4
- package/package.json +1 -1
- package/style/screencapture/index.css +58 -0
- package/lib/components/screenshot/ScreenCaptureButton.d.ts +0 -3
- package/lib/components/screenshot/index.d.ts +0 -2
- package/lib/hooks/layouts/LayoutScreenshot.d.ts +0 -3
- package/lib/hooks/useScreenshot.d.ts +0 -18
- package/lib/hooks/useScreenshot.js +0 -53
- package/lib/utils/Screenshot.d.ts +0 -1
|
@@ -12,6 +12,9 @@ export class IAMProvidersSpecs {
|
|
|
12
12
|
case 'github': {
|
|
13
13
|
return this.GitHub;
|
|
14
14
|
}
|
|
15
|
+
case 'google': {
|
|
16
|
+
return this.Google;
|
|
17
|
+
}
|
|
15
18
|
case 'linkedin': {
|
|
16
19
|
return this.LinkedIn;
|
|
17
20
|
}
|
|
@@ -46,6 +49,17 @@ export class IAMProvidersSpecs {
|
|
|
46
49
|
postShareURL: '',
|
|
47
50
|
registerUploadURL: '',
|
|
48
51
|
};
|
|
52
|
+
static Google = {
|
|
53
|
+
name: 'google',
|
|
54
|
+
oauth2CallbackServerRoute: 'jupyter_iam/oauth2/callback',
|
|
55
|
+
oauth2CallbackUIRoute: '/iam/oauth2/google/callback',
|
|
56
|
+
accessTokenCookieName: (user) => `__datalayer__google_access_token_${user.id}`,
|
|
57
|
+
refreshTokenCookieName: '__datalayer__google_refresh_token',
|
|
58
|
+
userInfoURL: 'https://openidconnect.googleapis.com/v1/userinfo',
|
|
59
|
+
tokenRefreshURL: 'https://oauth2.googleapis.com/token',
|
|
60
|
+
postShareURL: '',
|
|
61
|
+
registerUploadURL: '',
|
|
62
|
+
};
|
|
49
63
|
static LinkedIn = {
|
|
50
64
|
name: 'linkedin',
|
|
51
65
|
oauth2CallbackServerRoute: 'jupyter_iam/oauth2/callback',
|
package/lib/models/ItemDTO.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
21
|
+
* @param client - Client instance
|
|
22
22
|
*/
|
|
23
|
-
constructor(data: TData,
|
|
23
|
+
constructor(data: TData, client: DatalayerClient);
|
|
24
24
|
/** Check if this item has been deleted. */
|
|
25
25
|
get isDeleted(): boolean;
|
|
26
26
|
/**
|
package/lib/models/ItemDTO.js
CHANGED
|
@@ -12,16 +12,16 @@ import * as items from '../api/spacer/items';
|
|
|
12
12
|
*/
|
|
13
13
|
export class ItemDTO {
|
|
14
14
|
_data;
|
|
15
|
-
|
|
15
|
+
_client;
|
|
16
16
|
_deleted = false;
|
|
17
17
|
/**
|
|
18
18
|
* Create an Item instance.
|
|
19
19
|
* @param data - Item data from API
|
|
20
|
-
* @param
|
|
20
|
+
* @param client - Client instance
|
|
21
21
|
*/
|
|
22
|
-
constructor(data,
|
|
22
|
+
constructor(data, client) {
|
|
23
23
|
this._data = data;
|
|
24
|
-
this.
|
|
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.
|
|
109
|
-
const spacerRunUrl = this.
|
|
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.
|
|
141
|
-
const spacerRunUrl = this.
|
|
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.
|
|
176
|
+
return this._client.getToken();
|
|
177
177
|
}
|
|
178
178
|
/** Get spacer API URL for API calls. */
|
|
179
179
|
_getSpacerRunUrl() {
|
|
180
|
-
return this.
|
|
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
|
|
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
|
|
121
|
+
* @param client - Client instance
|
|
122
122
|
*/
|
|
123
|
-
constructor(data: LexicalData,
|
|
123
|
+
constructor(data: LexicalData, client: DatalayerClient);
|
|
124
124
|
/** Document type identifier. */
|
|
125
125
|
get type(): string;
|
|
126
126
|
/** The cached name of the document. */
|
package/lib/models/LexicalDTO.js
CHANGED
|
@@ -17,7 +17,7 @@ import { validateJSON } from '../api/utils/validation';
|
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```typescript
|
|
20
|
-
* const lexical = await
|
|
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
|
|
29
|
+
* @param client - Client instance
|
|
30
30
|
*/
|
|
31
|
-
constructor(data,
|
|
32
|
-
super(data,
|
|
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
|
|
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
|
|
54
|
+
* @param client - Client instance
|
|
55
55
|
*/
|
|
56
|
-
constructor(data: NotebookData,
|
|
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
|
|
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
|
|
24
|
+
* @param client - Client instance
|
|
25
25
|
*/
|
|
26
|
-
constructor(data,
|
|
27
|
-
super(data,
|
|
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.
|
|
78
|
-
const spacerRunUrl = this.
|
|
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;
|
package/lib/models/Page.js
CHANGED
|
@@ -13,7 +13,7 @@ export const asPage = (s) => {
|
|
|
13
13
|
description: s.description_t,
|
|
14
14
|
theme: s.theme_s,
|
|
15
15
|
nbformat: s.nbformat_s ? JSON.parse(s.nbformat_s) : undefined,
|
|
16
|
-
screenCapture: s.screen_capture_s,
|
|
16
|
+
screenCapture: s.screen_capture_cdn_url_s || s.screen_capture_s,
|
|
17
17
|
tags: s.tags_ss ?? [],
|
|
18
18
|
creator: s.creator ? asUser(s.creator) : undefined,
|
|
19
19
|
creatorId: s.creator_uid,
|
package/lib/models/PageTag.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ type CardIconColorsType = (typeof CardIconColors)[number];
|
|
|
4
4
|
export type PageTagMetadata = {
|
|
5
5
|
fillColor: React.CSSProperties['backgroundColor'];
|
|
6
6
|
};
|
|
7
|
-
export type PageTagName = 'ai' | 'deep-learning' | 'example' | 'llm' | 'python' | 'pytorch' | 'spatial' | 'tutorial';
|
|
7
|
+
export type PageTagName = 'agent' | 'ai' | 'ai-agent' | 'deep-learning' | 'example' | 'llm' | 'notebook' | 'python' | 'pytorch' | 'spatial' | 'tutorial';
|
|
8
8
|
export type PageTag = {
|
|
9
9
|
id: string;
|
|
10
10
|
text?: PageTagName;
|
package/lib/models/PageTag.js
CHANGED
|
@@ -9,12 +9,24 @@ export const PAGE_TAGE_NONE = {
|
|
|
9
9
|
Icon: CopilotIcon,
|
|
10
10
|
color: 'pink',
|
|
11
11
|
};
|
|
12
|
+
const PAGE_TAGE_AGENT = {
|
|
13
|
+
id: '9',
|
|
14
|
+
text: 'agent',
|
|
15
|
+
Icon: CopilotIcon,
|
|
16
|
+
color: 'teal',
|
|
17
|
+
};
|
|
12
18
|
const PAGE_TAGE_AI = {
|
|
13
19
|
id: '1',
|
|
14
20
|
text: 'ai',
|
|
15
21
|
Icon: CopilotIcon,
|
|
16
22
|
color: 'pink',
|
|
17
23
|
};
|
|
24
|
+
const PAGE_TAGE_AI_AGENT = {
|
|
25
|
+
id: '10',
|
|
26
|
+
text: 'ai-agent',
|
|
27
|
+
Icon: CopilotIcon,
|
|
28
|
+
color: 'purple',
|
|
29
|
+
};
|
|
18
30
|
const PAGE_TAGE_DEEP_LEARNING = {
|
|
19
31
|
id: '2',
|
|
20
32
|
text: 'deep-learning',
|
|
@@ -33,6 +45,12 @@ const PAGE_TAGE_LLM = {
|
|
|
33
45
|
Icon: CopilotIcon,
|
|
34
46
|
color: 'coral',
|
|
35
47
|
};
|
|
48
|
+
const PAGE_TAGE_NOTEBOOK = {
|
|
49
|
+
id: '11',
|
|
50
|
+
text: 'notebook',
|
|
51
|
+
Icon: CopilotIcon,
|
|
52
|
+
color: 'blue',
|
|
53
|
+
};
|
|
36
54
|
const PAGE_TAGE_PYTHON = {
|
|
37
55
|
id: '5',
|
|
38
56
|
text: 'python',
|
|
@@ -60,10 +78,13 @@ const PAGE_TAGE_TUTORIAL = {
|
|
|
60
78
|
metadata: { fillColor: 'yellow' },
|
|
61
79
|
};
|
|
62
80
|
export const PAGE_TAGS = [
|
|
81
|
+
PAGE_TAGE_AGENT,
|
|
63
82
|
PAGE_TAGE_AI,
|
|
83
|
+
PAGE_TAGE_AI_AGENT,
|
|
64
84
|
PAGE_TAGE_DEEP_LEARNING,
|
|
65
85
|
PAGE_TAGE_EXAMPLE,
|
|
66
86
|
PAGE_TAGE_LLM,
|
|
87
|
+
PAGE_TAGE_NOTEBOOK,
|
|
67
88
|
PAGE_TAGE_PYTHON,
|
|
68
89
|
PAGE_TAGE_PYTORCH,
|
|
69
90
|
PAGE_TAGE_SPATIAL,
|
|
@@ -105,22 +105,22 @@ export interface ListRuntimesResponse {
|
|
|
105
105
|
*
|
|
106
106
|
* @example
|
|
107
107
|
* ```typescript
|
|
108
|
-
* const runtime = await
|
|
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
|
|
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
|
|
121
|
+
* @param client - Client instance
|
|
122
122
|
*/
|
|
123
|
-
constructor(data: RuntimeData,
|
|
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
|
package/lib/models/RuntimeDTO.js
CHANGED
|
@@ -15,24 +15,24 @@ import { validateJSON } from '../api/utils/validation';
|
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* ```typescript
|
|
18
|
-
* const runtime = await
|
|
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
|
-
|
|
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
|
|
31
|
+
* @param client - Client instance
|
|
32
32
|
*/
|
|
33
|
-
constructor(data,
|
|
33
|
+
constructor(data, client) {
|
|
34
34
|
this._data = data;
|
|
35
|
-
this.
|
|
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.
|
|
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.
|
|
127
|
-
return new RuntimeDTO(updated, this.
|
|
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.
|
|
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
|
|
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
|
|
125
|
+
* @param client - Client instance
|
|
126
126
|
*/
|
|
127
|
-
constructor(data: RuntimeSnapshotData,
|
|
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
|
|
@@ -16,17 +16,17 @@ import { validateJSON } from '../api/utils/validation';
|
|
|
16
16
|
*/
|
|
17
17
|
export class RuntimeSnapshotDTO {
|
|
18
18
|
_data;
|
|
19
|
-
|
|
19
|
+
_client;
|
|
20
20
|
_deleted = false;
|
|
21
21
|
/**
|
|
22
22
|
* Create a Runtime Snapshot instance.
|
|
23
23
|
*
|
|
24
24
|
* @param data - Snapshot data from API
|
|
25
|
-
* @param
|
|
25
|
+
* @param client - Client instance
|
|
26
26
|
*/
|
|
27
|
-
constructor(data,
|
|
27
|
+
constructor(data, client) {
|
|
28
28
|
this._data = data;
|
|
29
|
-
this.
|
|
29
|
+
this._client = client;
|
|
30
30
|
}
|
|
31
31
|
// ========================================================================
|
|
32
32
|
// Helper Methods
|
|
@@ -77,8 +77,8 @@ export class RuntimeSnapshotDTO {
|
|
|
77
77
|
*/
|
|
78
78
|
async delete() {
|
|
79
79
|
this._checkDeleted();
|
|
80
|
-
const token = this.
|
|
81
|
-
const runtimesRunUrl = this.
|
|
80
|
+
const token = this._client.getToken();
|
|
81
|
+
const runtimesRunUrl = this._client.getRuntimesRunUrl();
|
|
82
82
|
await snapshots.deleteSnapshot(token, this.uid, runtimesRunUrl);
|
|
83
83
|
this._deleted = true;
|
|
84
84
|
}
|
|
@@ -90,7 +90,7 @@ export class RuntimeSnapshotDTO {
|
|
|
90
90
|
*/
|
|
91
91
|
async restore(minutesLimit) {
|
|
92
92
|
this._checkDeleted();
|
|
93
|
-
return await this.
|
|
93
|
+
return await this._client.createRuntime({
|
|
94
94
|
environmentName: this.environment,
|
|
95
95
|
type: 'notebook',
|
|
96
96
|
givenName: `Restored from ${this.name}`,
|
package/lib/models/Secret.d.ts
CHANGED
|
@@ -116,7 +116,7 @@ export interface DeleteSecretResponse {
|
|
|
116
116
|
*
|
|
117
117
|
* @example
|
|
118
118
|
* ```typescript
|
|
119
|
-
* const secret = await
|
|
119
|
+
* const secret = await client.createSecret({
|
|
120
120
|
* variant: 'password',
|
|
121
121
|
* name: 'db_password',
|
|
122
122
|
* description: 'Production DB password',
|
|
@@ -131,14 +131,14 @@ export interface DeleteSecretResponse {
|
|
|
131
131
|
export declare class SecretDTO {
|
|
132
132
|
/** @internal */
|
|
133
133
|
_data: SecretData;
|
|
134
|
-
private
|
|
134
|
+
private _client;
|
|
135
135
|
private _deleted;
|
|
136
136
|
/**
|
|
137
137
|
* Create a Secret instance.
|
|
138
138
|
* @param data - Secret data from API
|
|
139
|
-
* @param
|
|
139
|
+
* @param client - Client instance
|
|
140
140
|
*/
|
|
141
|
-
constructor(data: SecretData,
|
|
141
|
+
constructor(data: SecretData, client: DatalayerClient);
|
|
142
142
|
private _checkDeleted;
|
|
143
143
|
private _decodeValue;
|
|
144
144
|
get uid(): string;
|
package/lib/models/Secret.js
CHANGED
|
@@ -21,7 +21,7 @@ import { validateJSON } from '../api/utils/validation';
|
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```typescript
|
|
24
|
-
* const secret = await
|
|
24
|
+
* const secret = await client.createSecret({
|
|
25
25
|
* variant: 'password',
|
|
26
26
|
* name: 'db_password',
|
|
27
27
|
* description: 'Production DB password',
|
|
@@ -36,16 +36,16 @@ import { validateJSON } from '../api/utils/validation';
|
|
|
36
36
|
export class SecretDTO {
|
|
37
37
|
/** @internal */
|
|
38
38
|
_data;
|
|
39
|
-
|
|
39
|
+
_client;
|
|
40
40
|
_deleted = false;
|
|
41
41
|
/**
|
|
42
42
|
* Create a Secret instance.
|
|
43
43
|
* @param data - Secret data from API
|
|
44
|
-
* @param
|
|
44
|
+
* @param client - Client instance
|
|
45
45
|
*/
|
|
46
|
-
constructor(data,
|
|
46
|
+
constructor(data, client) {
|
|
47
47
|
this._data = data;
|
|
48
|
-
this.
|
|
48
|
+
this._client = client;
|
|
49
49
|
}
|
|
50
50
|
// ========================================================================
|
|
51
51
|
// Helper Methods
|
|
@@ -105,7 +105,7 @@ export class SecretDTO {
|
|
|
105
105
|
*/
|
|
106
106
|
async update(updates) {
|
|
107
107
|
this._checkDeleted();
|
|
108
|
-
const updated = await this.
|
|
108
|
+
const updated = await this._client.updateSecret(this.uid, updates);
|
|
109
109
|
return updated;
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
@@ -113,7 +113,7 @@ export class SecretDTO {
|
|
|
113
113
|
*/
|
|
114
114
|
async delete() {
|
|
115
115
|
this._checkDeleted();
|
|
116
|
-
await this.
|
|
116
|
+
await this._client.deleteSecret(this.uid);
|
|
117
117
|
this._deleted = true;
|
|
118
118
|
}
|
|
119
119
|
// ========================================================================
|
package/lib/models/Space.js
CHANGED
|
@@ -34,6 +34,9 @@ export const asSpace = (raw_space) => {
|
|
|
34
34
|
organization: {
|
|
35
35
|
handle: raw_space.handle_s,
|
|
36
36
|
},
|
|
37
|
+
// Preserve raw Solr fields so consumers can access dynamic fields
|
|
38
|
+
// (e.g. attached_agent_pod_name_s for project-agent assignment)
|
|
39
|
+
...raw_space,
|
|
37
40
|
};
|
|
38
41
|
return space;
|
|
39
42
|
};
|
package/lib/models/SpaceDTO.d.ts
CHANGED
|
@@ -48,16 +48,16 @@ export interface SpaceJSON {
|
|
|
48
48
|
*/
|
|
49
49
|
export declare class SpaceDTO {
|
|
50
50
|
protected _data: SpaceData;
|
|
51
|
-
private
|
|
51
|
+
private _client;
|
|
52
52
|
private _items;
|
|
53
53
|
private _deleted;
|
|
54
54
|
/**
|
|
55
55
|
* Create a Space instance.
|
|
56
56
|
*
|
|
57
57
|
* @param data - Space data from API
|
|
58
|
-
* @param
|
|
58
|
+
* @param client - Client instance
|
|
59
59
|
*/
|
|
60
|
-
constructor(data: SpaceData,
|
|
60
|
+
constructor(data: SpaceData, client: DatalayerClient);
|
|
61
61
|
/**
|
|
62
62
|
* Check if this space has been deleted and throw error if so.
|
|
63
63
|
* @throws Error if deleted
|
package/lib/models/SpaceDTO.js
CHANGED
|
@@ -29,18 +29,18 @@ import { validateJSON } from '../api/utils/validation';
|
|
|
29
29
|
*/
|
|
30
30
|
export class SpaceDTO {
|
|
31
31
|
_data;
|
|
32
|
-
|
|
32
|
+
_client;
|
|
33
33
|
_items = null;
|
|
34
34
|
_deleted = false;
|
|
35
35
|
/**
|
|
36
36
|
* Create a Space instance.
|
|
37
37
|
*
|
|
38
38
|
* @param data - Space data from API
|
|
39
|
-
* @param
|
|
39
|
+
* @param client - Client instance
|
|
40
40
|
*/
|
|
41
|
-
constructor(data,
|
|
41
|
+
constructor(data, client) {
|
|
42
42
|
this._data = data;
|
|
43
|
-
this.
|
|
43
|
+
this._client = client;
|
|
44
44
|
}
|
|
45
45
|
// ========================================================================
|
|
46
46
|
// Helper Methods
|
|
@@ -58,8 +58,8 @@ export class SpaceDTO {
|
|
|
58
58
|
* Refresh space data from the API by fetching user's spaces.
|
|
59
59
|
*/
|
|
60
60
|
async refresh() {
|
|
61
|
-
const token = this.
|
|
62
|
-
const spacerRunUrl = this.
|
|
61
|
+
const token = this._client.getToken();
|
|
62
|
+
const spacerRunUrl = this._client.getSpacerRunUrl();
|
|
63
63
|
const response = await users.getMySpaces(token, spacerRunUrl);
|
|
64
64
|
const freshSpace = response.spaces.find(s => s.uid === this.uid);
|
|
65
65
|
if (freshSpace) {
|
|
@@ -110,8 +110,8 @@ export class SpaceDTO {
|
|
|
110
110
|
async _createItem(data) {
|
|
111
111
|
this._checkDeleted();
|
|
112
112
|
// Get necessary configuration from Client
|
|
113
|
-
const token = this.
|
|
114
|
-
const spacerRunUrl = this.
|
|
113
|
+
const token = this._client.getToken();
|
|
114
|
+
const spacerRunUrl = this._client.getSpacerRunUrl();
|
|
115
115
|
if (data.type === ItemTypes.NOTEBOOK) {
|
|
116
116
|
const requestData = {
|
|
117
117
|
spaceId: this.uid,
|
|
@@ -125,7 +125,7 @@ export class SpaceDTO {
|
|
|
125
125
|
throw new Error('Failed to create notebook: No notebook returned');
|
|
126
126
|
}
|
|
127
127
|
else {
|
|
128
|
-
return new NotebookDTO(response.notebook, this.
|
|
128
|
+
return new NotebookDTO(response.notebook, this._client);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
else if (data.type === ItemTypes.LEXICAL) {
|
|
@@ -141,7 +141,7 @@ export class SpaceDTO {
|
|
|
141
141
|
throw new Error('Failed to create lexical document: No document returned');
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
|
-
return new LexicalDTO(response.document, this.
|
|
144
|
+
return new LexicalDTO(response.document, this._client);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
else {
|
|
@@ -155,11 +155,11 @@ export class SpaceDTO {
|
|
|
155
155
|
*/
|
|
156
156
|
async getItems() {
|
|
157
157
|
this._checkDeleted();
|
|
158
|
-
const token = this.
|
|
159
|
-
const spacerRunUrl = this.
|
|
158
|
+
const token = this._client.getToken();
|
|
159
|
+
const spacerRunUrl = this._client.getSpacerRunUrl();
|
|
160
160
|
const response = await items.getSpaceItems(token, this.uid, spacerRunUrl);
|
|
161
161
|
// Use shared utility function to convert items to model instances
|
|
162
|
-
this._items = convertSpaceItemsToModels(response.items || [], this.
|
|
162
|
+
this._items = convertSpaceItemsToModels(response.items || [], this._client);
|
|
163
163
|
return this._items;
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
@@ -215,7 +215,7 @@ export class SpaceDTO {
|
|
|
215
215
|
variant: this.variant,
|
|
216
216
|
handle: this.handle,
|
|
217
217
|
items: this._data.items
|
|
218
|
-
? convertSpaceItemsToModels(this._data.items, this.
|
|
218
|
+
? convertSpaceItemsToModels(this._data.items, this._client).map(item => item.toJSON())
|
|
219
219
|
: [],
|
|
220
220
|
};
|
|
221
221
|
validateJSON(obj, 'Space');
|
package/lib/models/UserDTO.d.ts
CHANGED
|
@@ -54,9 +54,9 @@ export declare class UserDTO {
|
|
|
54
54
|
* Create a User instance.
|
|
55
55
|
*
|
|
56
56
|
* @param data - User data from API
|
|
57
|
-
* @param
|
|
57
|
+
* @param client - Client instance (currently unused but kept for compatibility)
|
|
58
58
|
*/
|
|
59
|
-
constructor(data: UserData,
|
|
59
|
+
constructor(data: UserData, client?: DatalayerClient);
|
|
60
60
|
get id(): string;
|
|
61
61
|
get uid(): string;
|
|
62
62
|
get email(): string;
|
package/lib/models/UserDTO.js
CHANGED
|
@@ -13,9 +13,9 @@ export class UserDTO {
|
|
|
13
13
|
* Create a User instance.
|
|
14
14
|
*
|
|
15
15
|
* @param data - User data from API
|
|
16
|
-
* @param
|
|
16
|
+
* @param client - Client instance (currently unused but kept for compatibility)
|
|
17
17
|
*/
|
|
18
|
-
constructor(data,
|
|
18
|
+
constructor(data, client) {
|
|
19
19
|
this._data = data;
|
|
20
20
|
}
|
|
21
21
|
// Basic properties
|