@datalayer/core 0.0.13 → 0.0.15
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/checkout/StripeCheckout.js +19 -23
- package/lib/components/context/OrganizationSelect.js +12 -15
- package/lib/components/context/SpaceSelect.js +24 -25
- 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/hooks/useAuthorization.js +4 -2
- package/lib/hooks/useCache.d.ts +932 -285
- package/lib/hooks/useCache.js +5736 -2767
- package/lib/hooks/useCache0.d.ts +312 -0
- package/lib/hooks/useCache0.js +3189 -0
- package/lib/hooks/useIAM.js +18 -17
- 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/models/Runtime.d.ts +49 -49
- 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
package/lib/models/Runtime.d.ts
CHANGED
|
@@ -21,6 +21,55 @@ export type IRuntimeLocation = 'browser' | 'local' | string;
|
|
|
21
21
|
*/
|
|
22
22
|
export interface IRuntimeModel extends IRuntimePod, Kernel.IModel {
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Runtime pod.
|
|
26
|
+
*/
|
|
27
|
+
export interface IRuntimePod {
|
|
28
|
+
/**
|
|
29
|
+
* Environment display name
|
|
30
|
+
*/
|
|
31
|
+
environment_title: string;
|
|
32
|
+
/**
|
|
33
|
+
* Environment name
|
|
34
|
+
*/
|
|
35
|
+
environment_name: string;
|
|
36
|
+
/**
|
|
37
|
+
* Runtime name
|
|
38
|
+
*/
|
|
39
|
+
pod_name: string;
|
|
40
|
+
/**
|
|
41
|
+
* Runtime ingress URL
|
|
42
|
+
*/
|
|
43
|
+
ingress: string;
|
|
44
|
+
/**
|
|
45
|
+
* Runtime user given name
|
|
46
|
+
*/
|
|
47
|
+
given_name: string;
|
|
48
|
+
/**
|
|
49
|
+
* Runtime type
|
|
50
|
+
*/
|
|
51
|
+
type: IRuntimeType;
|
|
52
|
+
/**
|
|
53
|
+
* Server authentication token
|
|
54
|
+
*/
|
|
55
|
+
token: string;
|
|
56
|
+
/**
|
|
57
|
+
* Credits burning rate per second
|
|
58
|
+
*/
|
|
59
|
+
burning_rate: number;
|
|
60
|
+
/**
|
|
61
|
+
* Kernel reservation ID
|
|
62
|
+
*/
|
|
63
|
+
reservation_id?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Runtime usage starting timestamp
|
|
66
|
+
*/
|
|
67
|
+
started_at: string;
|
|
68
|
+
/**
|
|
69
|
+
* Runtime credits reservation expiration timestamp
|
|
70
|
+
*/
|
|
71
|
+
expired_at?: string;
|
|
72
|
+
}
|
|
24
73
|
/**
|
|
25
74
|
* Runtime description.
|
|
26
75
|
*/
|
|
@@ -72,52 +121,3 @@ export type IRuntimeType = 'notebook' | 'cell';
|
|
|
72
121
|
* Runtime optional capabilities.
|
|
73
122
|
*/
|
|
74
123
|
export type IRuntimeCapabilities = 'user_storage';
|
|
75
|
-
/**
|
|
76
|
-
* Runtime pod.
|
|
77
|
-
*/
|
|
78
|
-
export interface IRuntimePod {
|
|
79
|
-
/**
|
|
80
|
-
* Environment display name
|
|
81
|
-
*/
|
|
82
|
-
environment_title: string;
|
|
83
|
-
/**
|
|
84
|
-
* Environment name
|
|
85
|
-
*/
|
|
86
|
-
environment_name: string;
|
|
87
|
-
/**
|
|
88
|
-
* Runtime name
|
|
89
|
-
*/
|
|
90
|
-
pod_name: string;
|
|
91
|
-
/**
|
|
92
|
-
* Runtime ingress URL
|
|
93
|
-
*/
|
|
94
|
-
ingress: string;
|
|
95
|
-
/**
|
|
96
|
-
* Runtime user given name
|
|
97
|
-
*/
|
|
98
|
-
given_name: string;
|
|
99
|
-
/**
|
|
100
|
-
* Runtime type
|
|
101
|
-
*/
|
|
102
|
-
type: IRuntimeType;
|
|
103
|
-
/**
|
|
104
|
-
* Server authentication token
|
|
105
|
-
*/
|
|
106
|
-
token: string;
|
|
107
|
-
/**
|
|
108
|
-
* Credits burning rate per second
|
|
109
|
-
*/
|
|
110
|
-
burning_rate: number;
|
|
111
|
-
/**
|
|
112
|
-
* Kernel reservation ID
|
|
113
|
-
*/
|
|
114
|
-
reservation_id?: string;
|
|
115
|
-
/**
|
|
116
|
-
* Runtime usage starting timestamp
|
|
117
|
-
*/
|
|
118
|
-
started_at: string;
|
|
119
|
-
/**
|
|
120
|
-
* Runtime credits reservation expiration timestamp
|
|
121
|
-
*/
|
|
122
|
-
expired_at?: string;
|
|
123
|
-
}
|
|
@@ -1,6 +1,33 @@
|
|
|
1
|
-
import type { Runtime as RuntimeData } from '../../api/types/runtimes';
|
|
2
1
|
import type { DatalayerClient } from '../index';
|
|
3
|
-
import {
|
|
2
|
+
import { RuntimeSnapshotDTO } from './RuntimeSnapshotDTO';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a running instance of a computing environment.
|
|
5
|
+
* @interface RuntimeData
|
|
6
|
+
*/
|
|
7
|
+
export interface RuntimeData {
|
|
8
|
+
/** Kubernetes pod name for the runtime instance */
|
|
9
|
+
pod_name: string;
|
|
10
|
+
/** Unique identifier for the runtime */
|
|
11
|
+
uid: string;
|
|
12
|
+
/** Name of the environment this runtime is based on */
|
|
13
|
+
environment_name: string;
|
|
14
|
+
/** Title of the environment for display */
|
|
15
|
+
environment_title: string;
|
|
16
|
+
/** Type of runtime - notebook, terminal, or job */
|
|
17
|
+
type: string;
|
|
18
|
+
/** Credits consumed per second */
|
|
19
|
+
burning_rate: number;
|
|
20
|
+
/** User-friendly name for the runtime */
|
|
21
|
+
given_name: string;
|
|
22
|
+
/** Authentication token for accessing the runtime */
|
|
23
|
+
token: string;
|
|
24
|
+
/** Ingress URL for accessing the runtime */
|
|
25
|
+
ingress: string;
|
|
26
|
+
/** ISO 8601 timestamp of when the runtime started */
|
|
27
|
+
started_at: string;
|
|
28
|
+
/** ISO 8601 timestamp of when the runtime will expire */
|
|
29
|
+
expired_at: string;
|
|
30
|
+
}
|
|
4
31
|
/**
|
|
5
32
|
* Stable public interface for Runtime data.
|
|
6
33
|
* This is the contract that SDK consumers can rely on.
|
|
@@ -30,6 +57,48 @@ export interface RuntimeJSON {
|
|
|
30
57
|
/** When the runtime will expire */
|
|
31
58
|
expiredAt: string;
|
|
32
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Request payload for creating a new runtime
|
|
62
|
+
* @interface CreateRuntimeRequest
|
|
63
|
+
*/
|
|
64
|
+
export interface CreateRuntimeRequest {
|
|
65
|
+
/** Name of the environment to use */
|
|
66
|
+
environment_name: string;
|
|
67
|
+
/** Type of runtime (e.g., 'notebook', 'terminal', 'job') */
|
|
68
|
+
type?: 'notebook' | 'terminal' | 'job';
|
|
69
|
+
/** Optional given name for the runtime */
|
|
70
|
+
given_name?: string;
|
|
71
|
+
/** Maximum credits this runtime can consume */
|
|
72
|
+
credits_limit?: number;
|
|
73
|
+
/** Optional capabilities for the runtime */
|
|
74
|
+
capabilities?: string[];
|
|
75
|
+
/** Optional source to create runtime from (e.g., snapshot ID) */
|
|
76
|
+
from?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Response from creating a new runtime
|
|
80
|
+
* @interface CreateRuntimeResponse
|
|
81
|
+
*/
|
|
82
|
+
export interface CreateRuntimeResponse {
|
|
83
|
+
/** Whether the request was successful */
|
|
84
|
+
success: boolean;
|
|
85
|
+
/** Response message from the server */
|
|
86
|
+
message: string;
|
|
87
|
+
/** The created runtime instance */
|
|
88
|
+
runtime: RuntimeData;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Response from listing runtimes
|
|
92
|
+
* @interface ListRuntimesResponse
|
|
93
|
+
*/
|
|
94
|
+
export interface ListRuntimesResponse {
|
|
95
|
+
/** Whether the request was successful */
|
|
96
|
+
success: boolean;
|
|
97
|
+
/** Response message from the server */
|
|
98
|
+
message: string;
|
|
99
|
+
/** Array of runtime instances */
|
|
100
|
+
runtimes: RuntimeData[];
|
|
101
|
+
}
|
|
33
102
|
/**
|
|
34
103
|
* Runtime domain model that wraps API responses with convenient methods.
|
|
35
104
|
* Provides state management and lifecycle operations for computational runtimes.
|
|
@@ -40,7 +109,7 @@ export interface RuntimeJSON {
|
|
|
40
109
|
* await runtime.waitUntilReady();
|
|
41
110
|
* ```
|
|
42
111
|
*/
|
|
43
|
-
export declare class
|
|
112
|
+
export declare class RuntimeDTO {
|
|
44
113
|
/** @internal */
|
|
45
114
|
_data: RuntimeData;
|
|
46
115
|
private _sdk;
|
|
@@ -90,7 +159,7 @@ export declare class Runtime {
|
|
|
90
159
|
* @param from - Snapshot identifier to restore from
|
|
91
160
|
* @returns Updated Runtime instance
|
|
92
161
|
*/
|
|
93
|
-
update(from: string): Promise<
|
|
162
|
+
update(from: string): Promise<RuntimeDTO>;
|
|
94
163
|
/**
|
|
95
164
|
* Create a snapshot of this runtime.
|
|
96
165
|
*
|
|
@@ -99,7 +168,7 @@ export declare class Runtime {
|
|
|
99
168
|
* @param stop - Whether to stop runtime after snapshotting
|
|
100
169
|
* @returns Created Snapshot instance
|
|
101
170
|
*/
|
|
102
|
-
createSnapshot(name: string, description?: string, stop?: boolean): Promise<
|
|
171
|
+
createSnapshot(name: string, description?: string, stop?: boolean): Promise<RuntimeSnapshotDTO>;
|
|
103
172
|
/**
|
|
104
173
|
* Get runtime data in camelCase format.
|
|
105
174
|
* Returns only the core fields that consumers need.
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Runtime domain model for the Datalayer SDK.
|
|
7
7
|
*
|
|
8
|
-
* @module
|
|
8
|
+
* @module models/RuntimeDTO
|
|
9
9
|
*/
|
|
10
|
-
import { updateRuntime } from '
|
|
11
|
-
import { validateJSON } from '
|
|
10
|
+
import { updateRuntime } from '../api/runtimes/runtimes';
|
|
11
|
+
import { validateJSON } from '../api/utils/validation';
|
|
12
12
|
/**
|
|
13
13
|
* Runtime domain model that wraps API responses with convenient methods.
|
|
14
14
|
* Provides state management and lifecycle operations for computational runtimes.
|
|
@@ -19,7 +19,7 @@ import { validateJSON } from '../../api/utils/validation';
|
|
|
19
19
|
* await runtime.waitUntilReady();
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
export class
|
|
22
|
+
export class RuntimeDTO {
|
|
23
23
|
/** @internal */
|
|
24
24
|
_data;
|
|
25
25
|
_sdk;
|
|
@@ -124,7 +124,7 @@ export class Runtime {
|
|
|
124
124
|
async update(from) {
|
|
125
125
|
this._checkDeleted();
|
|
126
126
|
const updated = await updateRuntime(this._sdk.getToken(), this.podName, from, this._sdk.getRuntimesRunUrl());
|
|
127
|
-
return new
|
|
127
|
+
return new RuntimeDTO(updated, this._sdk);
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
130
|
* Create a snapshot of this runtime.
|
|
@@ -1,17 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Snapshot domain model for the Datalayer SDK.
|
|
3
3
|
*
|
|
4
|
-
* @module
|
|
4
|
+
* @module models/RuntimeSnapshotDTO
|
|
5
5
|
*/
|
|
6
|
-
import type { RuntimeSnapshot as RuntimeSnapshotData } from '../../api/types/runtimes';
|
|
7
6
|
import type { DatalayerClient } from '../index';
|
|
8
|
-
import {
|
|
7
|
+
import { RuntimeDTO } from './RuntimeDTO';
|
|
8
|
+
/**
|
|
9
|
+
* Represents a runthime snapshot of a runtime's state and files.
|
|
10
|
+
* @interface RuntimeSnapshotData
|
|
11
|
+
*/
|
|
12
|
+
export interface RuntimeSnapshotData {
|
|
13
|
+
/** Unique identifier for the snapshot */
|
|
14
|
+
uid: string;
|
|
15
|
+
/** Name of the snapshot */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Optional description of the snapshot */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** Name of the environment used by the runtime */
|
|
20
|
+
environment: string;
|
|
21
|
+
/** Metadata associated with the snapshot */
|
|
22
|
+
metadata?: {
|
|
23
|
+
version?: string;
|
|
24
|
+
language_info?: any;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
};
|
|
27
|
+
/** Size of the snapshot in bytes */
|
|
28
|
+
size?: number;
|
|
29
|
+
/** Format of the snapshot */
|
|
30
|
+
format?: string;
|
|
31
|
+
/** Format version of the snapshot */
|
|
32
|
+
format_version?: string;
|
|
33
|
+
/** Status of the snapshot */
|
|
34
|
+
status?: string;
|
|
35
|
+
/** ISO 8601 timestamp when the snapshot was last updated */
|
|
36
|
+
updated_at: string;
|
|
37
|
+
/** List of files included in the snapshot */
|
|
38
|
+
files?: any[];
|
|
39
|
+
}
|
|
9
40
|
/**
|
|
10
41
|
* Stable public interface for Snapshot data.
|
|
11
42
|
* This is the contract that SDK consumers can rely on.
|
|
12
43
|
* The raw API may change, but this interface remains stable.
|
|
13
44
|
*/
|
|
14
|
-
export interface
|
|
45
|
+
export interface RuntimeSnapshotJSON {
|
|
15
46
|
/** Unique identifier for the snapshot */
|
|
16
47
|
uid: string;
|
|
17
48
|
/** Name of the snapshot */
|
|
@@ -23,6 +54,56 @@ export interface SnapshotJSON {
|
|
|
23
54
|
/** ISO 8601 timestamp when the snapshot was last updated */
|
|
24
55
|
updatedAt: string;
|
|
25
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Request payload for creating a runtime snapshot
|
|
59
|
+
* @interface CreateRuntimeSnapshotRequest
|
|
60
|
+
*/
|
|
61
|
+
export interface CreateRuntimeSnapshotRequest {
|
|
62
|
+
/** Pod name of the runtime to snapshot */
|
|
63
|
+
pod_name: string;
|
|
64
|
+
/** Name for the snapshot */
|
|
65
|
+
name: string;
|
|
66
|
+
/** Description of the snapshot */
|
|
67
|
+
description: string;
|
|
68
|
+
/** Whether to stop the runtime after creating snapshot */
|
|
69
|
+
stop: boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Response for getting a specific runtime snapshot
|
|
73
|
+
* @interface GetRuntimeSnapshotResponse
|
|
74
|
+
*/
|
|
75
|
+
export interface GetRuntimeSnapshotResponse {
|
|
76
|
+
/** Indicates if the request was successful */
|
|
77
|
+
success: boolean;
|
|
78
|
+
/** Response message */
|
|
79
|
+
message: string;
|
|
80
|
+
/** The snapshot details */
|
|
81
|
+
snapshot: RuntimeSnapshotData;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Response for creating a runtime snapshot
|
|
85
|
+
* @interface CreateRuntimeSnapshotResponse
|
|
86
|
+
*/
|
|
87
|
+
export interface CreateRuntimeSnapshotResponse {
|
|
88
|
+
/** Indicates if the request was successful */
|
|
89
|
+
success: boolean;
|
|
90
|
+
/** Response message */
|
|
91
|
+
message: string;
|
|
92
|
+
/** The created snapshot details */
|
|
93
|
+
snapshot: RuntimeSnapshotData;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Response from listing runtime snapshots
|
|
97
|
+
* @interface RuntimeSnapshotsListResponse
|
|
98
|
+
*/
|
|
99
|
+
export interface ListRuntimeSnapshotsResponse {
|
|
100
|
+
/** Whether the request was successful */
|
|
101
|
+
success: boolean;
|
|
102
|
+
/** Response message from the server */
|
|
103
|
+
message: string;
|
|
104
|
+
/** Array of runtime snapshots */
|
|
105
|
+
snapshots: RuntimeSnapshotData[];
|
|
106
|
+
}
|
|
26
107
|
/**
|
|
27
108
|
* Snapshot domain model that wraps API responses with convenient methods.
|
|
28
109
|
* Provides runtime snapshot management with data refresh and lifecycle operations.
|
|
@@ -33,12 +114,12 @@ export interface SnapshotJSON {
|
|
|
33
114
|
* const runtime = await snapshot.restore();
|
|
34
115
|
* ```
|
|
35
116
|
*/
|
|
36
|
-
export declare class
|
|
117
|
+
export declare class RuntimeSnapshotDTO {
|
|
37
118
|
protected _data: RuntimeSnapshotData;
|
|
38
119
|
private _sdk;
|
|
39
120
|
private _deleted;
|
|
40
121
|
/**
|
|
41
|
-
* Create a Snapshot instance.
|
|
122
|
+
* Create a Runtime Snapshot instance.
|
|
42
123
|
*
|
|
43
124
|
* @param data - Snapshot data from API
|
|
44
125
|
* @param sdk - SDK instance
|
|
@@ -70,7 +151,7 @@ export declare class Snapshot {
|
|
|
70
151
|
* @param config - Optional runtime configuration to override defaults
|
|
71
152
|
* @returns Created Runtime instance
|
|
72
153
|
*/
|
|
73
|
-
restore(minutesLimit: number): Promise<
|
|
154
|
+
restore(minutesLimit: number): Promise<RuntimeDTO>;
|
|
74
155
|
/**
|
|
75
156
|
* Get snapshot data in camelCase format.
|
|
76
157
|
* Returns only the core fields that consumers need.
|
|
@@ -79,7 +160,7 @@ export declare class Snapshot {
|
|
|
79
160
|
*
|
|
80
161
|
* @returns Core snapshot data with camelCase properties
|
|
81
162
|
*/
|
|
82
|
-
toJSON():
|
|
163
|
+
toJSON(): RuntimeSnapshotJSON;
|
|
83
164
|
/**
|
|
84
165
|
* Get the raw snapshot data exactly as received from the API.
|
|
85
166
|
* This preserves the original snake_case naming from the API response.
|
|
@@ -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
|
+
}
|