@datalayer/core 0.0.12 → 0.0.13
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/README.md +2 -2
- package/lib/api/DatalayerApi.d.ts +38 -26
- package/lib/api/DatalayerApi.js +35 -8
- package/lib/api/iam/authentication.d.ts +8 -7
- package/lib/api/iam/authentication.js +14 -15
- package/lib/api/iam/healthz.d.ts +3 -2
- package/lib/api/iam/healthz.js +5 -3
- package/lib/api/iam/index.d.ts +9 -4
- package/lib/api/iam/index.js +9 -4
- package/lib/api/iam/oauth2.d.ts +115 -0
- package/lib/api/iam/oauth2.js +309 -0
- package/lib/api/iam/profile.d.ts +8 -1
- package/lib/api/iam/profile.js +17 -2
- package/lib/api/iam/usage.d.ts +56 -0
- package/lib/api/iam/usage.js +39 -0
- package/lib/api/index.d.ts +6 -5
- package/lib/api/index.js +6 -5
- package/lib/api/runtimes/environments.js +3 -2
- package/lib/api/runtimes/healthz.d.ts +3 -13
- package/lib/api/runtimes/healthz.js +4 -3
- package/lib/api/runtimes/index.d.ts +3 -2
- package/lib/api/runtimes/index.js +3 -2
- package/lib/api/runtimes/runtimes.js +17 -6
- package/lib/api/runtimes/snapshots.js +3 -2
- package/lib/api/spacer/documents.d.ts +12 -0
- package/lib/api/spacer/documents.js +43 -0
- package/lib/api/spacer/healthz.d.ts +3 -13
- package/lib/api/spacer/healthz.js +4 -3
- package/lib/api/spacer/index.d.ts +4 -2
- package/lib/api/spacer/index.js +4 -2
- package/lib/api/spacer/items.d.ts +9 -1
- package/lib/api/spacer/items.js +17 -2
- package/lib/api/spacer/lexicals.js +3 -2
- package/lib/api/spacer/notebooks.js +3 -2
- package/lib/api/spacer/spaces.js +3 -2
- package/lib/api/spacer/users.js +3 -2
- package/lib/api/types/common.d.ts +64 -0
- package/lib/api/types/iam.d.ts +88 -65
- package/lib/api/types/index.d.ts +4 -2
- package/lib/api/types/index.js +4 -2
- package/lib/api/types/runtimes.d.ts +9 -39
- package/lib/api/types/spacer.d.ts +37 -65
- package/lib/api/utils/validation.d.ts +24 -1
- package/lib/api/utils/validation.js +62 -1
- package/lib/client/base.d.ts +75 -0
- package/lib/client/base.js +199 -0
- package/lib/client/constants.d.ts +22 -0
- package/lib/client/constants.js +22 -0
- package/lib/client/index.d.ts +108 -0
- package/lib/client/index.js +79 -0
- package/lib/client/mixins/IAMMixin.d.ts +54 -0
- package/lib/client/mixins/IAMMixin.js +181 -0
- package/lib/client/mixins/RuntimesMixin.d.ts +93 -0
- package/lib/client/mixins/RuntimesMixin.js +229 -0
- package/lib/client/mixins/SpacerMixin.d.ts +111 -0
- package/lib/client/mixins/SpacerMixin.js +340 -0
- package/lib/client/models/Credits.d.ts +91 -0
- package/lib/client/models/Credits.js +130 -0
- package/lib/client/models/Environment.d.ts +73 -0
- package/lib/client/models/Environment.js +88 -0
- package/lib/client/models/HealthCheck.d.ts +72 -0
- package/lib/client/models/HealthCheck.js +107 -0
- package/lib/client/models/Item.d.ts +69 -0
- package/lib/client/models/Item.js +191 -0
- package/lib/client/models/Lexical.d.ts +83 -0
- package/lib/client/models/Lexical.js +152 -0
- package/lib/client/models/Notebook.d.ts +87 -0
- package/lib/client/models/Notebook.js +153 -0
- package/lib/client/models/Runtime.d.ts +122 -0
- package/lib/client/models/Runtime.js +204 -0
- package/lib/client/models/Snapshot.d.ts +92 -0
- package/lib/client/models/Snapshot.js +139 -0
- package/lib/client/models/Space.d.ts +135 -0
- package/lib/client/models/Space.js +234 -0
- package/lib/client/models/User.d.ts +64 -0
- package/lib/client/models/User.js +83 -0
- package/lib/client/models/index.d.ts +26 -0
- package/lib/client/models/index.js +25 -0
- package/lib/client/utils/mixins.d.ts +12 -0
- package/lib/{sdk/client → client}/utils/mixins.js +0 -28
- package/lib/client/utils/spacerUtils.d.ts +18 -0
- package/lib/client/utils/spacerUtils.js +32 -0
- package/lib/collaboration/DatalayerCollaboration.d.ts +6 -1
- package/lib/collaboration/DatalayerCollaboration.js +2 -2
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +5 -0
- package/lib/collaboration/DatalayerCollaborationProvider.js +10 -9
- package/lib/components/progress/CreditsIndicator.d.ts +1 -1
- package/lib/components/runtimes/RuntimeCellVariablesDialog.js +1 -1
- package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerBase.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerBase.js +1 -1
- package/lib/components/runtimes/RuntimePickerCell.js +2 -2
- package/lib/components/runtimes/RuntimePickerNotebook.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerNotebook.js +1 -1
- package/lib/components/runtimes/RuntimeTransfer.d.ts +1 -1
- package/lib/components/runtimes/RuntimeUtils.d.ts +1 -1
- package/lib/components/snapshots/RuntimeSnapshotMenu.d.ts +1 -1
- package/lib/components/snapshots/RuntimeSnapshotMenu.js +27 -20
- package/lib/config/Configuration.d.ts +8 -0
- package/lib/hooks/useDatalayer.js +1 -1
- package/lib/hooks/useRuntimes.js +1 -1
- package/lib/hooks/useToast.js +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +4 -2
- package/lib/sdk/index.d.ts +5 -4
- package/lib/sdk/index.js +6 -5
- package/lib/services/DatalayerServiceManager.js +1 -1
- package/lib/state/substates/CoreState.js +2 -0
- package/lib/state/substates/RuntimesState.d.ts +1 -1
- package/lib/state/substates/RuntimesState.js +1 -1
- package/lib/{sdk/stateful → stateful}/index.d.ts +1 -1
- package/lib/{sdk/stateful → stateful}/index.js +1 -1
- package/lib/{sdk/stateful → stateful}/jupyter/exec/Snippets.d.ts +1 -41
- package/lib/{sdk/stateful → stateful}/jupyter/exec/Snippets.js +1 -20
- package/lib/{sdk/stateful → stateful}/runtimes/actions.d.ts +3 -3
- package/lib/{sdk/stateful → stateful}/runtimes/actions.js +8 -8
- package/lib/{sdk/stateful → stateful}/runtimes/apis.d.ts +8 -8
- package/lib/stateful/runtimes/apis.js +5 -0
- package/package.json +12 -10
- package/lib/__tests__/hooks.test.d.ts +0 -1
- package/lib/__tests__/hooks.test.js +0 -19
- package/lib/__tests__/index.test.d.ts +0 -1
- package/lib/__tests__/index.test.js +0 -27
- package/lib/__tests__/integration.test.d.ts +0 -1
- package/lib/__tests__/integration.test.js +0 -57
- package/lib/__tests__/shared/cleanup-shared.d.ts +0 -4
- package/lib/__tests__/shared/cleanup-shared.js +0 -228
- package/lib/__tests__/shared/test-config.d.ts +0 -51
- package/lib/__tests__/shared/test-config.js +0 -110
- package/lib/__tests__/shared/test-constants.d.ts +0 -66
- package/lib/__tests__/shared/test-constants.js +0 -79
- package/lib/__tests__/utils.test.d.ts +0 -1
- package/lib/__tests__/utils.test.js +0 -59
- package/lib/api/__tests__/iam.authentication.integration.test.d.ts +0 -1
- package/lib/api/__tests__/iam.authentication.integration.test.js +0 -247
- package/lib/api/__tests__/iam.healthz.integration.test.d.ts +0 -1
- package/lib/api/__tests__/iam.healthz.integration.test.js +0 -63
- package/lib/api/__tests__/iam.profile.integration.test.d.ts +0 -1
- package/lib/api/__tests__/iam.profile.integration.test.js +0 -252
- package/lib/api/__tests__/runtimes.environments.integration.test.d.ts +0 -1
- package/lib/api/__tests__/runtimes.environments.integration.test.js +0 -122
- package/lib/api/__tests__/runtimes.healthz.integration.test.d.ts +0 -1
- package/lib/api/__tests__/runtimes.healthz.integration.test.js +0 -50
- package/lib/api/__tests__/runtimes.integration.test.d.ts +0 -1
- package/lib/api/__tests__/runtimes.integration.test.js +0 -369
- package/lib/api/__tests__/spacer.healthz.integration.test.d.ts +0 -1
- package/lib/api/__tests__/spacer.healthz.integration.test.js +0 -50
- package/lib/api/__tests__/spacer.integration.test.d.ts +0 -1
- package/lib/api/__tests__/spacer.integration.test.js +0 -519
- package/lib/api/iam/__tests__/authentication.unit.test.d.ts +0 -1
- package/lib/api/iam/__tests__/authentication.unit.test.js +0 -63
- package/lib/api/iam/__tests__/healthz.unit.test.d.ts +0 -1
- package/lib/api/iam/__tests__/healthz.unit.test.js +0 -60
- package/lib/api/iam/__tests__/profile.unit.test.d.ts +0 -1
- package/lib/api/iam/__tests__/profile.unit.test.js +0 -57
- package/lib/api/runtimes/__tests__/environments.unit.test.d.ts +0 -1
- package/lib/api/runtimes/__tests__/environments.unit.test.js +0 -77
- package/lib/api/runtimes/__tests__/healthz.unit.test.d.ts +0 -1
- package/lib/api/runtimes/__tests__/healthz.unit.test.js +0 -57
- package/lib/api/runtimes/__tests__/runtimes.unit.test.d.ts +0 -1
- package/lib/api/runtimes/__tests__/runtimes.unit.test.js +0 -139
- package/lib/api/runtimes/__tests__/snapshots.unit.test.d.ts +0 -1
- package/lib/api/runtimes/__tests__/snapshots.unit.test.js +0 -96
- package/lib/api/spacer/__tests__/healthz.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/healthz.unit.test.js +0 -57
- package/lib/api/spacer/__tests__/items.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/items.unit.test.js +0 -165
- package/lib/api/spacer/__tests__/lexicals.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/lexicals.unit.test.js +0 -323
- package/lib/api/spacer/__tests__/notebooks.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/notebooks.unit.test.js +0 -224
- package/lib/api/spacer/__tests__/users.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/users.unit.test.js +0 -132
- package/lib/api/utils/__tests__/validation.test.d.ts +0 -1
- package/lib/api/utils/__tests__/validation.test.js +0 -109
- package/lib/sdk/client/__tests__/sdk.health.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.health.integration.test.js +0 -110
- package/lib/sdk/client/__tests__/sdk.iam.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.iam.integration.test.js +0 -179
- package/lib/sdk/client/__tests__/sdk.models.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.models.integration.test.js +0 -376
- package/lib/sdk/client/__tests__/sdk.runtimes.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.runtimes.integration.test.js +0 -276
- package/lib/sdk/client/__tests__/sdk.spacer.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.spacer.integration.test.js +0 -361
- package/lib/sdk/client/base.d.ts +0 -88
- package/lib/sdk/client/base.js +0 -112
- package/lib/sdk/client/index.d.ts +0 -192
- package/lib/sdk/client/index.js +0 -128
- package/lib/sdk/client/mixins/HealthMixin.d.ts +0 -100
- package/lib/sdk/client/mixins/HealthMixin.js +0 -133
- package/lib/sdk/client/mixins/IAMMixin.d.ts +0 -59
- package/lib/sdk/client/mixins/IAMMixin.js +0 -83
- package/lib/sdk/client/mixins/RuntimesMixin.d.ts +0 -134
- package/lib/sdk/client/mixins/RuntimesMixin.js +0 -221
- package/lib/sdk/client/mixins/SpacerMixin.d.ts +0 -184
- package/lib/sdk/client/mixins/SpacerMixin.js +0 -278
- package/lib/sdk/client/models/Lexical.d.ts +0 -156
- package/lib/sdk/client/models/Lexical.js +0 -275
- package/lib/sdk/client/models/Notebook.d.ts +0 -174
- package/lib/sdk/client/models/Notebook.js +0 -311
- package/lib/sdk/client/models/Runtime.d.ts +0 -221
- package/lib/sdk/client/models/Runtime.js +0 -341
- package/lib/sdk/client/models/Snapshot.d.ts +0 -156
- package/lib/sdk/client/models/Snapshot.js +0 -244
- package/lib/sdk/client/models/Space.d.ts +0 -182
- package/lib/sdk/client/models/Space.js +0 -276
- package/lib/sdk/client/models/__tests__/Lexical.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Lexical.test.js +0 -288
- package/lib/sdk/client/models/__tests__/Notebook.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Notebook.test.js +0 -206
- package/lib/sdk/client/models/__tests__/Runtime.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Runtime.test.js +0 -133
- package/lib/sdk/client/models/__tests__/Snapshot.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Snapshot.test.js +0 -244
- package/lib/sdk/client/models/__tests__/Space.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Space.test.js +0 -334
- package/lib/sdk/client/models/index.d.ts +0 -30
- package/lib/sdk/client/models/index.js +0 -30
- package/lib/sdk/client/utils/mixins.d.ts +0 -42
- /package/lib/{sdk/stateful/runtimes/apis.js → api/types/common.js} +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/exec/Python.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/exec/Python.js +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/exec/index.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/exec/index.js +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/index.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/index.js +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/kernelsHandler.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/kernelsHandler.js +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/index.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/index.js +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/settings.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/settings.js +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/snapshots.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/snapshots.js +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/utils.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/utils.js +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { Runtime as RuntimeData } from '../../api/types/runtimes';
|
|
2
|
+
import type { DatalayerClient } from '../index';
|
|
3
|
+
import { Snapshot } from './Snapshot';
|
|
4
|
+
/**
|
|
5
|
+
* Stable public interface for Runtime data.
|
|
6
|
+
* This is the contract that SDK consumers can rely on.
|
|
7
|
+
* The raw API may change, but this interface remains stable.
|
|
8
|
+
*/
|
|
9
|
+
export interface RuntimeJSON {
|
|
10
|
+
/** ulid for the runtime */
|
|
11
|
+
uid: string;
|
|
12
|
+
/** Kubernetes pod name for the runtime instance */
|
|
13
|
+
podName: string;
|
|
14
|
+
/** User-friendly name for the runtime */
|
|
15
|
+
givenName: string;
|
|
16
|
+
/** Name of the environment this runtime is based on */
|
|
17
|
+
environmentName: string;
|
|
18
|
+
/** Title of the environment for display */
|
|
19
|
+
environmentTitle: string;
|
|
20
|
+
/** Type of runtime - notebook, terminal, or job */
|
|
21
|
+
type: string;
|
|
22
|
+
/** Credits consumed per second */
|
|
23
|
+
burningRate: number;
|
|
24
|
+
/** Credits allocated/available to this runtime */
|
|
25
|
+
ingress: string;
|
|
26
|
+
/** Authentication token for accessing the runtime */
|
|
27
|
+
token: string;
|
|
28
|
+
/** When the runtime was started */
|
|
29
|
+
startedAt: string;
|
|
30
|
+
/** When the runtime will expire */
|
|
31
|
+
expiredAt: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Runtime domain model that wraps API responses with convenient methods.
|
|
35
|
+
* Provides state management and lifecycle operations for computational runtimes.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const runtime = await sdk.createRuntime({ environment_name: 'python-cpu' });
|
|
40
|
+
* await runtime.waitUntilReady();
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare class Runtime {
|
|
44
|
+
/** @internal */
|
|
45
|
+
_data: RuntimeData;
|
|
46
|
+
private _sdk;
|
|
47
|
+
private _deleted;
|
|
48
|
+
/**
|
|
49
|
+
* Create a Runtime instance.
|
|
50
|
+
*
|
|
51
|
+
* @param data - Runtime data from API
|
|
52
|
+
* @param sdk - SDK instance
|
|
53
|
+
*/
|
|
54
|
+
constructor(data: RuntimeData, sdk: DatalayerClient);
|
|
55
|
+
/**
|
|
56
|
+
* Check if this runtime has been deleted and throw error if so.
|
|
57
|
+
* @throws Error if deleted
|
|
58
|
+
*/
|
|
59
|
+
private _checkDeleted;
|
|
60
|
+
/** Kubernetes pod name for the runtime instance. */
|
|
61
|
+
get podName(): string;
|
|
62
|
+
/** Unique identifier for the runtime. */
|
|
63
|
+
get uid(): string;
|
|
64
|
+
/** Name of the environment this runtime is based on. */
|
|
65
|
+
get environmentName(): string;
|
|
66
|
+
/** Ingress URL for accessing the runtime. */
|
|
67
|
+
get ingress(): string;
|
|
68
|
+
/** Authentication token for accessing the runtime. */
|
|
69
|
+
get token(): string;
|
|
70
|
+
/** Credits consumed per second. */
|
|
71
|
+
get burningRate(): number;
|
|
72
|
+
/** User-friendly name for the runtime. */
|
|
73
|
+
get givenName(): string;
|
|
74
|
+
/** Type of runtime (notebook, terminal, or job). */
|
|
75
|
+
get type(): string;
|
|
76
|
+
/** When the runtime started. */
|
|
77
|
+
get startedAt(): Date;
|
|
78
|
+
/** When the runtime will expire. */
|
|
79
|
+
get expiredAt(): Date;
|
|
80
|
+
/** Environment title for display. */
|
|
81
|
+
get environmentTitle(): string;
|
|
82
|
+
/**
|
|
83
|
+
* Delete this runtime permanently.
|
|
84
|
+
* After deletion, subsequent calls to dynamic methods will throw errors.
|
|
85
|
+
*/
|
|
86
|
+
delete(): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Update runtime from a snapshot.
|
|
89
|
+
*
|
|
90
|
+
* @param from - Snapshot identifier to restore from
|
|
91
|
+
* @returns Updated Runtime instance
|
|
92
|
+
*/
|
|
93
|
+
update(from: string): Promise<Runtime>;
|
|
94
|
+
/**
|
|
95
|
+
* Create a snapshot of this runtime.
|
|
96
|
+
*
|
|
97
|
+
* @param name - Name for the snapshot
|
|
98
|
+
* @param description - Optional description
|
|
99
|
+
* @param stop - Whether to stop runtime after snapshotting
|
|
100
|
+
* @returns Created Snapshot instance
|
|
101
|
+
*/
|
|
102
|
+
createSnapshot(name: string, description?: string, stop?: boolean): Promise<Snapshot>;
|
|
103
|
+
/**
|
|
104
|
+
* Get runtime data in camelCase format.
|
|
105
|
+
* Returns only the core fields that consumers need.
|
|
106
|
+
* This provides a stable interface regardless of API changes.
|
|
107
|
+
* Returns the current cached state - call getState() first if you need fresh data.
|
|
108
|
+
*
|
|
109
|
+
* @returns Core runtime data with camelCase properties
|
|
110
|
+
*/
|
|
111
|
+
toJSON(): RuntimeJSON;
|
|
112
|
+
/**
|
|
113
|
+
* Get the raw runtime data exactly as received from the API.
|
|
114
|
+
* This preserves the original snake_case naming from the API response.
|
|
115
|
+
* Returns the current cached state - call getState() first if you need fresh data.
|
|
116
|
+
*
|
|
117
|
+
* @returns Raw runtime data from API
|
|
118
|
+
*/
|
|
119
|
+
rawData(): RuntimeData;
|
|
120
|
+
/** String representation of the runtime. */
|
|
121
|
+
toString(): string;
|
|
122
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Runtime domain model for the Datalayer SDK.
|
|
7
|
+
*
|
|
8
|
+
* @module client/models/Runtime
|
|
9
|
+
*/
|
|
10
|
+
import { updateRuntime } from '../../api/runtimes/runtimes';
|
|
11
|
+
import { validateJSON } from '../../api/utils/validation';
|
|
12
|
+
/**
|
|
13
|
+
* Runtime domain model that wraps API responses with convenient methods.
|
|
14
|
+
* Provides state management and lifecycle operations for computational runtimes.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const runtime = await sdk.createRuntime({ environment_name: 'python-cpu' });
|
|
19
|
+
* await runtime.waitUntilReady();
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export class Runtime {
|
|
23
|
+
/** @internal */
|
|
24
|
+
_data;
|
|
25
|
+
_sdk;
|
|
26
|
+
_deleted = false;
|
|
27
|
+
/**
|
|
28
|
+
* Create a Runtime instance.
|
|
29
|
+
*
|
|
30
|
+
* @param data - Runtime data from API
|
|
31
|
+
* @param sdk - SDK instance
|
|
32
|
+
*/
|
|
33
|
+
constructor(data, sdk) {
|
|
34
|
+
this._data = data;
|
|
35
|
+
this._sdk = sdk;
|
|
36
|
+
}
|
|
37
|
+
// ========================================================================
|
|
38
|
+
// Helper Methods
|
|
39
|
+
// ========================================================================
|
|
40
|
+
/**
|
|
41
|
+
* Check if this runtime has been deleted and throw error if so.
|
|
42
|
+
* @throws Error if deleted
|
|
43
|
+
*/
|
|
44
|
+
_checkDeleted() {
|
|
45
|
+
if (this._deleted) {
|
|
46
|
+
throw new Error(`Runtime ${this._data.pod_name} has been deleted and no longer exists`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// ========================================================================
|
|
50
|
+
// Static Properties (set at creation, never change)
|
|
51
|
+
// ========================================================================
|
|
52
|
+
/** Kubernetes pod name for the runtime instance. */
|
|
53
|
+
get podName() {
|
|
54
|
+
this._checkDeleted();
|
|
55
|
+
return this._data.pod_name;
|
|
56
|
+
}
|
|
57
|
+
/** Unique identifier for the runtime. */
|
|
58
|
+
get uid() {
|
|
59
|
+
this._checkDeleted();
|
|
60
|
+
return this._data.uid;
|
|
61
|
+
}
|
|
62
|
+
/** Name of the environment this runtime is based on. */
|
|
63
|
+
get environmentName() {
|
|
64
|
+
this._checkDeleted();
|
|
65
|
+
return this._data.environment_name;
|
|
66
|
+
}
|
|
67
|
+
/** Ingress URL for accessing the runtime. */
|
|
68
|
+
get ingress() {
|
|
69
|
+
this._checkDeleted();
|
|
70
|
+
return this._data.ingress;
|
|
71
|
+
}
|
|
72
|
+
/** Authentication token for accessing the runtime. */
|
|
73
|
+
get token() {
|
|
74
|
+
this._checkDeleted();
|
|
75
|
+
return this._data.token;
|
|
76
|
+
}
|
|
77
|
+
/** Credits consumed per second. */
|
|
78
|
+
get burningRate() {
|
|
79
|
+
this._checkDeleted();
|
|
80
|
+
return this._data.burning_rate;
|
|
81
|
+
}
|
|
82
|
+
/** User-friendly name for the runtime. */
|
|
83
|
+
get givenName() {
|
|
84
|
+
this._checkDeleted();
|
|
85
|
+
return this._data.given_name;
|
|
86
|
+
}
|
|
87
|
+
/** Type of runtime (notebook, terminal, or job). */
|
|
88
|
+
get type() {
|
|
89
|
+
this._checkDeleted();
|
|
90
|
+
return this._data.type;
|
|
91
|
+
}
|
|
92
|
+
/** When the runtime started. */
|
|
93
|
+
get startedAt() {
|
|
94
|
+
this._checkDeleted();
|
|
95
|
+
return new Date(Number(this._data.started_at) * 1000);
|
|
96
|
+
}
|
|
97
|
+
/** When the runtime will expire. */
|
|
98
|
+
get expiredAt() {
|
|
99
|
+
this._checkDeleted();
|
|
100
|
+
return new Date(Number(this._data.expired_at) * 1000);
|
|
101
|
+
}
|
|
102
|
+
/** Environment title for display. */
|
|
103
|
+
get environmentTitle() {
|
|
104
|
+
this._checkDeleted();
|
|
105
|
+
return this._data.environment_title || '';
|
|
106
|
+
}
|
|
107
|
+
// ========================================================================
|
|
108
|
+
// Action Methods
|
|
109
|
+
// ========================================================================
|
|
110
|
+
/**
|
|
111
|
+
* Delete this runtime permanently.
|
|
112
|
+
* After deletion, subsequent calls to dynamic methods will throw errors.
|
|
113
|
+
*/
|
|
114
|
+
async delete() {
|
|
115
|
+
await this._sdk.deleteRuntime(this.podName);
|
|
116
|
+
this._deleted = true;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Update runtime from a snapshot.
|
|
120
|
+
*
|
|
121
|
+
* @param from - Snapshot identifier to restore from
|
|
122
|
+
* @returns Updated Runtime instance
|
|
123
|
+
*/
|
|
124
|
+
async update(from) {
|
|
125
|
+
this._checkDeleted();
|
|
126
|
+
const updated = await updateRuntime(this._sdk.getToken(), this.podName, from, this._sdk.getRuntimesRunUrl());
|
|
127
|
+
return new Runtime(updated, this._sdk);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Create a snapshot of this runtime.
|
|
131
|
+
*
|
|
132
|
+
* @param name - Name for the snapshot
|
|
133
|
+
* @param description - Optional description
|
|
134
|
+
* @param stop - Whether to stop runtime after snapshotting
|
|
135
|
+
* @returns Created Snapshot instance
|
|
136
|
+
*/
|
|
137
|
+
async createSnapshot(name, description, stop) {
|
|
138
|
+
this._checkDeleted();
|
|
139
|
+
return await this._sdk.createSnapshot(this.podName, name, description, stop);
|
|
140
|
+
}
|
|
141
|
+
// ========================================================================
|
|
142
|
+
// Utility Methods
|
|
143
|
+
// ========================================================================
|
|
144
|
+
/**
|
|
145
|
+
* Get runtime data in camelCase format.
|
|
146
|
+
* Returns only the core fields that consumers need.
|
|
147
|
+
* This provides a stable interface regardless of API changes.
|
|
148
|
+
* Returns the current cached state - call getState() first if you need fresh data.
|
|
149
|
+
*
|
|
150
|
+
* @returns Core runtime data with camelCase properties
|
|
151
|
+
*/
|
|
152
|
+
toJSON() {
|
|
153
|
+
this._checkDeleted();
|
|
154
|
+
// Safely convert dates to ISO strings, handling invalid dates
|
|
155
|
+
const safeToISO = (date) => {
|
|
156
|
+
try {
|
|
157
|
+
const iso = date.toISOString();
|
|
158
|
+
return iso;
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
// If date is invalid, return empty string or current time
|
|
162
|
+
return new Date().toISOString();
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const obj = {
|
|
166
|
+
// Core identifiers
|
|
167
|
+
uid: this.uid,
|
|
168
|
+
podName: this.podName,
|
|
169
|
+
givenName: this.givenName,
|
|
170
|
+
// Environment info
|
|
171
|
+
environmentName: this.environmentName,
|
|
172
|
+
environmentTitle: this.environmentTitle,
|
|
173
|
+
// State and type
|
|
174
|
+
type: this.type,
|
|
175
|
+
// Burning
|
|
176
|
+
burningRate: this.burningRate,
|
|
177
|
+
// URLs and tokens
|
|
178
|
+
// FIXME: Consider renaming? jupyterServerUrl and jupyterServerToken
|
|
179
|
+
ingress: this.ingress,
|
|
180
|
+
token: this.token,
|
|
181
|
+
// Timing
|
|
182
|
+
startedAt: safeToISO(this.startedAt),
|
|
183
|
+
expiredAt: safeToISO(this.expiredAt),
|
|
184
|
+
};
|
|
185
|
+
validateJSON(obj, 'Runtime');
|
|
186
|
+
return obj;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get the raw runtime data exactly as received from the API.
|
|
190
|
+
* This preserves the original snake_case naming from the API response.
|
|
191
|
+
* Returns the current cached state - call getState() first if you need fresh data.
|
|
192
|
+
*
|
|
193
|
+
* @returns Raw runtime data from API
|
|
194
|
+
*/
|
|
195
|
+
rawData() {
|
|
196
|
+
this._checkDeleted();
|
|
197
|
+
return this._data;
|
|
198
|
+
}
|
|
199
|
+
/** String representation of the runtime. */
|
|
200
|
+
toString() {
|
|
201
|
+
this._checkDeleted();
|
|
202
|
+
return `Runtime(${this.podName}, ${this.environmentName})`;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snapshot domain model for the Datalayer SDK.
|
|
3
|
+
*
|
|
4
|
+
* @module client/models/Snapshot
|
|
5
|
+
*/
|
|
6
|
+
import type { RuntimeSnapshot as RuntimeSnapshotData } from '../../api/types/runtimes';
|
|
7
|
+
import type { DatalayerClient } from '../index';
|
|
8
|
+
import { Runtime } from './Runtime';
|
|
9
|
+
/**
|
|
10
|
+
* Stable public interface for Snapshot data.
|
|
11
|
+
* This is the contract that SDK consumers can rely on.
|
|
12
|
+
* The raw API may change, but this interface remains stable.
|
|
13
|
+
*/
|
|
14
|
+
export interface SnapshotJSON {
|
|
15
|
+
/** Unique identifier for the snapshot */
|
|
16
|
+
uid: string;
|
|
17
|
+
/** Name of the snapshot */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Optional description of the snapshot */
|
|
20
|
+
description?: string;
|
|
21
|
+
/** Name of the environment used by the runtime */
|
|
22
|
+
environment: string;
|
|
23
|
+
/** ISO 8601 timestamp when the snapshot was last updated */
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Snapshot domain model that wraps API responses with convenient methods.
|
|
28
|
+
* Provides runtime snapshot management with data refresh and lifecycle operations.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const snapshot = await runtime.createSnapshot('my-checkpoint');
|
|
33
|
+
* const runtime = await snapshot.restore();
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare class Snapshot {
|
|
37
|
+
protected _data: RuntimeSnapshotData;
|
|
38
|
+
private _sdk;
|
|
39
|
+
private _deleted;
|
|
40
|
+
/**
|
|
41
|
+
* Create a Snapshot instance.
|
|
42
|
+
*
|
|
43
|
+
* @param data - Snapshot data from API
|
|
44
|
+
* @param sdk - SDK instance
|
|
45
|
+
*/
|
|
46
|
+
constructor(data: RuntimeSnapshotData, sdk: DatalayerClient);
|
|
47
|
+
/**
|
|
48
|
+
* Check if this snapshot has been deleted and throw error if so.
|
|
49
|
+
* @throws Error if deleted
|
|
50
|
+
*/
|
|
51
|
+
private _checkDeleted;
|
|
52
|
+
/** Unique identifier for the snapshot. */
|
|
53
|
+
get uid(): string;
|
|
54
|
+
/** Name of the snapshot. */
|
|
55
|
+
get name(): string;
|
|
56
|
+
/** Description of the snapshot. */
|
|
57
|
+
get description(): string;
|
|
58
|
+
/** Name of the environment used by the runtime. */
|
|
59
|
+
get environment(): string;
|
|
60
|
+
/** When the snapshot was last updated. */
|
|
61
|
+
get updatedAt(): Date;
|
|
62
|
+
/**
|
|
63
|
+
* Delete this snapshot permanently.
|
|
64
|
+
* After deletion, subsequent calls to dynamic methods will throw errors.
|
|
65
|
+
*/
|
|
66
|
+
delete(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Create a runtime from this snapshot (restore functionality).
|
|
69
|
+
*
|
|
70
|
+
* @param config - Optional runtime configuration to override defaults
|
|
71
|
+
* @returns Created Runtime instance
|
|
72
|
+
*/
|
|
73
|
+
restore(minutesLimit: number): Promise<Runtime>;
|
|
74
|
+
/**
|
|
75
|
+
* Get snapshot data in camelCase format.
|
|
76
|
+
* Returns only the core fields that consumers need.
|
|
77
|
+
* This provides a stable interface regardless of API changes.
|
|
78
|
+
* Note: Returns current cached state - call getStatus() first if you need fresh data.
|
|
79
|
+
*
|
|
80
|
+
* @returns Core snapshot data with camelCase properties
|
|
81
|
+
*/
|
|
82
|
+
toJSON(): SnapshotJSON;
|
|
83
|
+
/**
|
|
84
|
+
* Get the raw snapshot data exactly as received from the API.
|
|
85
|
+
* This preserves the original snake_case naming from the API response.
|
|
86
|
+
*
|
|
87
|
+
* @returns Raw snapshot data from API
|
|
88
|
+
*/
|
|
89
|
+
rawData(): RuntimeSnapshotData;
|
|
90
|
+
/** String representation of the snapshot. */
|
|
91
|
+
toString(): string;
|
|
92
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import { snapshots } from '../../api/runtimes';
|
|
6
|
+
import { validateJSON } from '../../api/utils/validation';
|
|
7
|
+
/**
|
|
8
|
+
* Snapshot domain model that wraps API responses with convenient methods.
|
|
9
|
+
* Provides runtime snapshot management with data refresh and lifecycle operations.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const snapshot = await runtime.createSnapshot('my-checkpoint');
|
|
14
|
+
* const runtime = await snapshot.restore();
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export class Snapshot {
|
|
18
|
+
_data;
|
|
19
|
+
_sdk;
|
|
20
|
+
_deleted = false;
|
|
21
|
+
/**
|
|
22
|
+
* Create a Snapshot instance.
|
|
23
|
+
*
|
|
24
|
+
* @param data - Snapshot data from API
|
|
25
|
+
* @param sdk - SDK instance
|
|
26
|
+
*/
|
|
27
|
+
constructor(data, sdk) {
|
|
28
|
+
this._data = data;
|
|
29
|
+
this._sdk = sdk;
|
|
30
|
+
}
|
|
31
|
+
// ========================================================================
|
|
32
|
+
// Helper Methods
|
|
33
|
+
// ========================================================================
|
|
34
|
+
/**
|
|
35
|
+
* Check if this snapshot has been deleted and throw error if so.
|
|
36
|
+
* @throws Error if deleted
|
|
37
|
+
*/
|
|
38
|
+
_checkDeleted() {
|
|
39
|
+
if (this._deleted) {
|
|
40
|
+
throw new Error(`Snapshot ${this._data.uid} has been deleted and no longer exists`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// ========================================================================
|
|
44
|
+
// Static Properties (set at creation, never change)
|
|
45
|
+
// ========================================================================
|
|
46
|
+
/** Unique identifier for the snapshot. */
|
|
47
|
+
get uid() {
|
|
48
|
+
this._checkDeleted();
|
|
49
|
+
return this._data.uid;
|
|
50
|
+
}
|
|
51
|
+
/** Name of the snapshot. */
|
|
52
|
+
get name() {
|
|
53
|
+
this._checkDeleted();
|
|
54
|
+
return this._data.name;
|
|
55
|
+
}
|
|
56
|
+
/** Description of the snapshot. */
|
|
57
|
+
get description() {
|
|
58
|
+
this._checkDeleted();
|
|
59
|
+
return this._data.description || '';
|
|
60
|
+
}
|
|
61
|
+
/** Name of the environment used by the runtime. */
|
|
62
|
+
get environment() {
|
|
63
|
+
this._checkDeleted();
|
|
64
|
+
return this._data.environment;
|
|
65
|
+
}
|
|
66
|
+
/** When the snapshot was last updated. */
|
|
67
|
+
get updatedAt() {
|
|
68
|
+
this._checkDeleted();
|
|
69
|
+
return new Date(this._data.updated_at);
|
|
70
|
+
}
|
|
71
|
+
// ========================================================================
|
|
72
|
+
// Action Methods
|
|
73
|
+
// ========================================================================
|
|
74
|
+
/**
|
|
75
|
+
* Delete this snapshot permanently.
|
|
76
|
+
* After deletion, subsequent calls to dynamic methods will throw errors.
|
|
77
|
+
*/
|
|
78
|
+
async delete() {
|
|
79
|
+
this._checkDeleted();
|
|
80
|
+
const token = this._sdk.getToken();
|
|
81
|
+
const runtimesRunUrl = this._sdk.getRuntimesRunUrl();
|
|
82
|
+
await snapshots.deleteSnapshot(token, this.uid, runtimesRunUrl);
|
|
83
|
+
this._deleted = true;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Create a runtime from this snapshot (restore functionality).
|
|
87
|
+
*
|
|
88
|
+
* @param config - Optional runtime configuration to override defaults
|
|
89
|
+
* @returns Created Runtime instance
|
|
90
|
+
*/
|
|
91
|
+
async restore(minutesLimit) {
|
|
92
|
+
this._checkDeleted();
|
|
93
|
+
return await this._sdk.createRuntime({
|
|
94
|
+
environmentName: this.environment,
|
|
95
|
+
type: 'notebook',
|
|
96
|
+
givenName: `Restored from ${this.name}`,
|
|
97
|
+
minutesLimit: minutesLimit,
|
|
98
|
+
fromSnapshotId: this.uid,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
// ========================================================================
|
|
102
|
+
// Utility Methods
|
|
103
|
+
// ========================================================================
|
|
104
|
+
/**
|
|
105
|
+
* Get snapshot data in camelCase format.
|
|
106
|
+
* Returns only the core fields that consumers need.
|
|
107
|
+
* This provides a stable interface regardless of API changes.
|
|
108
|
+
* Note: Returns current cached state - call getStatus() first if you need fresh data.
|
|
109
|
+
*
|
|
110
|
+
* @returns Core snapshot data with camelCase properties
|
|
111
|
+
*/
|
|
112
|
+
toJSON() {
|
|
113
|
+
this._checkDeleted();
|
|
114
|
+
const obj = {
|
|
115
|
+
uid: this.uid,
|
|
116
|
+
name: this.name,
|
|
117
|
+
description: this.description,
|
|
118
|
+
environment: this.environment,
|
|
119
|
+
updatedAt: this.updatedAt.toISOString(),
|
|
120
|
+
};
|
|
121
|
+
validateJSON(obj, 'Snapshot');
|
|
122
|
+
return obj;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get the raw snapshot data exactly as received from the API.
|
|
126
|
+
* This preserves the original snake_case naming from the API response.
|
|
127
|
+
*
|
|
128
|
+
* @returns Raw snapshot data from API
|
|
129
|
+
*/
|
|
130
|
+
rawData() {
|
|
131
|
+
this._checkDeleted();
|
|
132
|
+
return this._data;
|
|
133
|
+
}
|
|
134
|
+
/** String representation of the snapshot. */
|
|
135
|
+
toString() {
|
|
136
|
+
this._checkDeleted();
|
|
137
|
+
return `Snapshot(${this.uid}, ${this.name})`;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Space domain model for the Datalayer SDK.
|
|
3
|
+
*
|
|
4
|
+
* @module client/models/Space
|
|
5
|
+
*/
|
|
6
|
+
import type { Space as SpaceData } from '../../api/types/spacer';
|
|
7
|
+
import type { DatalayerClient } from '../index';
|
|
8
|
+
import { Notebook, type NotebookJSON } from './Notebook';
|
|
9
|
+
import { Lexical, type LexicalJSON } from './Lexical';
|
|
10
|
+
/**
|
|
11
|
+
* Stable public interface for Space data.
|
|
12
|
+
* This is the contract that SDK consumers can rely on.
|
|
13
|
+
* The raw API may change, but this interface remains stable.
|
|
14
|
+
*/
|
|
15
|
+
export interface SpaceJSON {
|
|
16
|
+
/** ulid for the space */
|
|
17
|
+
uid: string;
|
|
18
|
+
/** Name of the space */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Handle for the space */
|
|
21
|
+
handle: string;
|
|
22
|
+
/** Variant of the space */
|
|
23
|
+
variant: string;
|
|
24
|
+
/** Description of the space */
|
|
25
|
+
description: string;
|
|
26
|
+
/** Items contained in the space (as JSON) */
|
|
27
|
+
items: Array<NotebookJSON | LexicalJSON>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Space domain model that wraps API responses with convenient methods.
|
|
31
|
+
* Provides workspace management with data refresh and content creation operations.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const space = spaces[0];
|
|
36
|
+
* const items = await space.getItems();
|
|
37
|
+
* const notebook = await space.createNotebook({ name: 'Analysis' });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class Space {
|
|
41
|
+
protected _data: SpaceData;
|
|
42
|
+
private _sdk;
|
|
43
|
+
private _items;
|
|
44
|
+
private _deleted;
|
|
45
|
+
/**
|
|
46
|
+
* Create a Space instance.
|
|
47
|
+
*
|
|
48
|
+
* @param data - Space data from API
|
|
49
|
+
* @param sdk - SDK instance
|
|
50
|
+
*/
|
|
51
|
+
constructor(data: SpaceData, sdk: DatalayerClient);
|
|
52
|
+
/**
|
|
53
|
+
* Check if this space has been deleted and throw error if so.
|
|
54
|
+
* @throws Error if deleted
|
|
55
|
+
*/
|
|
56
|
+
private _checkDeleted;
|
|
57
|
+
/**
|
|
58
|
+
* Refresh space data from the API by fetching user's spaces.
|
|
59
|
+
*/
|
|
60
|
+
refresh(): Promise<void>;
|
|
61
|
+
/** Unique identifier for the space. */
|
|
62
|
+
get uid(): string;
|
|
63
|
+
/** URL-friendly handle for the space. */
|
|
64
|
+
get handle(): string;
|
|
65
|
+
/** Space variant type. */
|
|
66
|
+
get variant(): string;
|
|
67
|
+
/**
|
|
68
|
+
* The name of the space.
|
|
69
|
+
*/
|
|
70
|
+
get name(): string;
|
|
71
|
+
/**
|
|
72
|
+
* The description of the space.
|
|
73
|
+
*/
|
|
74
|
+
get description(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Helper method to create items in this space.
|
|
77
|
+
*
|
|
78
|
+
* @param itemType - Type of item to create
|
|
79
|
+
* @param data - Creation configuration
|
|
80
|
+
* @returns Created model instance
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
private _createItem;
|
|
84
|
+
/**
|
|
85
|
+
* Get all items in this space as model instances.
|
|
86
|
+
*
|
|
87
|
+
* @returns Array of Notebook and Lexical model instances
|
|
88
|
+
*/
|
|
89
|
+
getItems(): Promise<(Notebook | Lexical)[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Create a new notebook in this space.
|
|
92
|
+
*
|
|
93
|
+
* @param data - Notebook creation configuration
|
|
94
|
+
* @returns Created Notebook instance
|
|
95
|
+
*/
|
|
96
|
+
createNotebook(data: {
|
|
97
|
+
name: string;
|
|
98
|
+
description: string;
|
|
99
|
+
file?: File | Blob;
|
|
100
|
+
}): Promise<Notebook>;
|
|
101
|
+
/**
|
|
102
|
+
* Create a new lexical document in this space.
|
|
103
|
+
*
|
|
104
|
+
* @param data - Lexical creation configuration
|
|
105
|
+
* @returns Created Lexical instance
|
|
106
|
+
*/
|
|
107
|
+
createLexical(data: {
|
|
108
|
+
name: string;
|
|
109
|
+
description: string;
|
|
110
|
+
file?: File | Blob;
|
|
111
|
+
}): Promise<Lexical>;
|
|
112
|
+
/**
|
|
113
|
+
* Get raw space data object.
|
|
114
|
+
* Returns cached data without refreshing.
|
|
115
|
+
*
|
|
116
|
+
* @returns Raw space data object
|
|
117
|
+
*/
|
|
118
|
+
/**
|
|
119
|
+
* Get space data in camelCase format.
|
|
120
|
+
* Returns only the core fields that consumers need.
|
|
121
|
+
* This provides a stable interface regardless of API changes.
|
|
122
|
+
*
|
|
123
|
+
* @returns Core space data with camelCase properties
|
|
124
|
+
*/
|
|
125
|
+
toJSON(): SpaceJSON;
|
|
126
|
+
/**
|
|
127
|
+
* Get the raw space data exactly as received from the API.
|
|
128
|
+
* This preserves the original snake_case naming from the API response.
|
|
129
|
+
*
|
|
130
|
+
* @returns Raw space data from API
|
|
131
|
+
*/
|
|
132
|
+
rawData(): SpaceData;
|
|
133
|
+
/** String representation of the space. */
|
|
134
|
+
toString(): string;
|
|
135
|
+
}
|