@datalayer/core 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/api/DatalayerApi.d.ts +38 -26
- package/lib/api/DatalayerApi.js +52 -13
- package/lib/api/iam/authentication.d.ts +9 -8
- 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 +18 -0
- package/lib/api/iam/usage.js +39 -0
- package/lib/api/index.d.ts +6 -6
- package/lib/api/index.js +6 -7
- package/lib/api/runtimes/environments.d.ts +2 -2
- 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.d.ts +4 -4
- package/lib/api/runtimes/runtimes.js +17 -6
- package/lib/api/runtimes/snapshots.d.ts +4 -4
- 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.d.ts +1 -1
- package/lib/api/spacer/lexicals.js +3 -2
- package/lib/api/spacer/notebooks.d.ts +1 -1
- package/lib/api/spacer/notebooks.js +3 -2
- package/lib/api/spacer/spaces.d.ts +1 -1
- package/lib/api/spacer/spaces.js +3 -2
- package/lib/api/spacer/users.d.ts +1 -1
- package/lib/api/spacer/users.js +3 -2
- 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/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/RuntimeLauncherDialog.js +2 -2
- package/lib/components/runtimes/RuntimePickerBase.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerBase.js +1 -1
- package/lib/components/runtimes/RuntimePickerCell.js +3 -3
- package/lib/components/runtimes/RuntimePickerNotebook.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerNotebook.js +2 -2
- package/lib/components/runtimes/RuntimeTransfer.d.ts +2 -2
- 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 -3
- package/lib/index.js +4 -3
- package/lib/models/Common.d.ts +64 -0
- package/lib/models/CreditsDTO.d.ts +124 -0
- package/lib/models/CreditsDTO.js +135 -0
- package/lib/models/Environment.d.ts +1 -1
- package/lib/models/EnvironmentDTO.d.ts +125 -0
- package/lib/models/EnvironmentDTO.js +88 -0
- package/lib/models/HealthCheck.d.ts +72 -0
- package/lib/models/HealthCheck.js +107 -0
- package/lib/{api/types/iam.d.ts → models/IAM.d.ts} +15 -78
- package/lib/models/ItemDTO.d.ts +74 -0
- package/lib/models/ItemDTO.js +186 -0
- package/lib/models/LexicalDTO.d.ts +155 -0
- package/lib/models/LexicalDTO.js +157 -0
- package/lib/models/NotebookDTO.d.ts +96 -0
- package/lib/models/NotebookDTO.js +153 -0
- package/lib/models/Profile.d.ts +65 -0
- package/lib/models/RuntimeDTO.d.ts +191 -0
- package/lib/models/RuntimeDTO.js +204 -0
- package/lib/models/RuntimeSnapshotDTO.d.ts +173 -0
- package/lib/models/RuntimeSnapshotDTO.js +139 -0
- package/lib/models/SpaceDTO.d.ts +280 -0
- package/lib/models/SpaceDTO.js +239 -0
- package/lib/models/UserDTO.d.ts +86 -0
- package/lib/models/UserDTO.js +84 -0
- package/lib/models/index.d.ts +45 -4
- package/lib/models/index.js +45 -4
- 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/package.json +13 -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/types/index.d.ts +0 -32
- package/lib/api/types/index.js +0 -36
- package/lib/api/types/runtimes.d.ts +0 -235
- package/lib/api/types/spacer.d.ts +0 -271
- package/lib/api/types/spacer.js +0 -5
- 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/{api/types/iam.js → models/Common.js} +0 -0
- /package/lib/{api/types/runtimes.js → models/IAM.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/apis.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
|
@@ -6,7 +6,7 @@ import { useStore } from 'zustand';
|
|
|
6
6
|
import { createStore } from 'zustand/vanilla';
|
|
7
7
|
import { JSONExt } from '@lumino/coreutils';
|
|
8
8
|
import { Poll } from '@lumino/polling';
|
|
9
|
-
import { getRuntimes } from '../../
|
|
9
|
+
import { getRuntimes } from '../../stateful/runtimes';
|
|
10
10
|
import { coreStore } from './CoreState';
|
|
11
11
|
import { iamStore } from './IAMState';
|
|
12
12
|
/**
|
|
@@ -5,11 +5,6 @@ export interface IRuntimeSnippets {
|
|
|
5
5
|
/**
|
|
6
6
|
* Code snippet to change the current working directory.
|
|
7
7
|
*
|
|
8
|
-
* The code snippet has no returned value.
|
|
9
|
-
*
|
|
10
|
-
* The path is relative to the home directory and use
|
|
11
|
-
* the separator `/`.
|
|
12
|
-
*
|
|
13
8
|
* @param path New current directory
|
|
14
9
|
* @returns The code snippet
|
|
15
10
|
*/
|
|
@@ -17,21 +12,12 @@ export interface IRuntimeSnippets {
|
|
|
17
12
|
/**
|
|
18
13
|
* Code snippet to list the transferable kernel variables.
|
|
19
14
|
*
|
|
20
|
-
* The code snippet must return a serialized-JSON
|
|
21
|
-
* dictionary (<variable name>, <variable type>)
|
|
22
|
-
*
|
|
23
15
|
* @returns The code snippet
|
|
24
16
|
*/
|
|
25
17
|
listVariables(): string;
|
|
26
18
|
/**
|
|
27
19
|
* Code snippet to load kernel variables.
|
|
28
20
|
*
|
|
29
|
-
* The code snippet must return a serialized-JSON list
|
|
30
|
-
* with successfully loaded variables.
|
|
31
|
-
*
|
|
32
|
-
* The format used to store the variable value is up to the kernel.
|
|
33
|
-
* It should JSON-serializable and will be passed from {@link saveVariables}.
|
|
34
|
-
*
|
|
35
21
|
* @param variables Serialized-JSON dictionary (<variable name>, <variable value blob>)
|
|
36
22
|
* @returns The code snippet
|
|
37
23
|
*/
|
|
@@ -39,13 +25,6 @@ export interface IRuntimeSnippets {
|
|
|
39
25
|
/**
|
|
40
26
|
* Code snippet to save kernel variables.
|
|
41
27
|
*
|
|
42
|
-
* The code snippet must return a serialized-JSON dictionary
|
|
43
|
-
* (<variable name>, <variable value blob>).
|
|
44
|
-
*
|
|
45
|
-
* The format used to store the variable value is up to the kernel.
|
|
46
|
-
* It should JSON-serializable and will be passed to {@link loadVariables}
|
|
47
|
-
* without modification.
|
|
48
|
-
*
|
|
49
28
|
* @param variables Variable names.
|
|
50
29
|
* @returns The code snippet
|
|
51
30
|
*/
|
|
@@ -78,10 +57,7 @@ export declare class RuntimeSnippetsFacade {
|
|
|
78
57
|
static supports(language: string): boolean;
|
|
79
58
|
private _language;
|
|
80
59
|
/**
|
|
81
|
-
* Create a kernel snippet generator for a given kernel
|
|
82
|
-
* language.
|
|
83
|
-
*
|
|
84
|
-
* It will raise if the language is not available.
|
|
60
|
+
* Create a kernel snippet generator for a given kernel language.
|
|
85
61
|
*
|
|
86
62
|
* @param language Kernel language
|
|
87
63
|
*/
|
|
@@ -102,21 +78,12 @@ export declare class RuntimeSnippetsFacade {
|
|
|
102
78
|
/**
|
|
103
79
|
* Code snippet to list the transferable kernel variables.
|
|
104
80
|
*
|
|
105
|
-
* The code snippet must return a serialized-JSON
|
|
106
|
-
* dictionary (<variable name>, <variable type>)
|
|
107
|
-
*
|
|
108
81
|
* @returns The code snippet
|
|
109
82
|
*/
|
|
110
83
|
listVariables(): string;
|
|
111
84
|
/**
|
|
112
85
|
* Code snippet to load kernel variables.
|
|
113
86
|
*
|
|
114
|
-
* The code snippet must return a serialized-JSON list
|
|
115
|
-
* with successfully loaded variables.
|
|
116
|
-
*
|
|
117
|
-
* The format used to store the variable value is up to the kernel.
|
|
118
|
-
* It should JSON-serializable and will be passed from {@link saveVariables}.
|
|
119
|
-
*
|
|
120
87
|
* @param variables Serialized-JSON dictionary (<variable name>, <variable value blob>)
|
|
121
88
|
* @returns The code snippet
|
|
122
89
|
*/
|
|
@@ -124,13 +91,6 @@ export declare class RuntimeSnippetsFacade {
|
|
|
124
91
|
/**
|
|
125
92
|
* Code snippet to save kernel variables.
|
|
126
93
|
*
|
|
127
|
-
* The code snippet must return a serialized-JSON dictionary
|
|
128
|
-
* (<variable name>, <variable value blob>).
|
|
129
|
-
*
|
|
130
|
-
* The format used to store the variable value is up to the kernel.
|
|
131
|
-
* It should JSON-serializable and will be passed to {@link loadVariables}
|
|
132
|
-
* without modification.
|
|
133
|
-
*
|
|
134
94
|
* @param variables Variable names.
|
|
135
95
|
* @returns The code snippet
|
|
136
96
|
*/
|
|
@@ -27,10 +27,7 @@ export class RuntimeSnippetsFacade {
|
|
|
27
27
|
}
|
|
28
28
|
_language;
|
|
29
29
|
/**
|
|
30
|
-
* Create a kernel snippet generator for a given kernel
|
|
31
|
-
* language.
|
|
32
|
-
*
|
|
33
|
-
* It will raise if the language is not available.
|
|
30
|
+
* Create a kernel snippet generator for a given kernel language.
|
|
34
31
|
*
|
|
35
32
|
* @param language Kernel language
|
|
36
33
|
*/
|
|
@@ -62,9 +59,6 @@ export class RuntimeSnippetsFacade {
|
|
|
62
59
|
/**
|
|
63
60
|
* Code snippet to list the transferable kernel variables.
|
|
64
61
|
*
|
|
65
|
-
* The code snippet must return a serialized-JSON
|
|
66
|
-
* dictionary (<variable name>, <variable type>)
|
|
67
|
-
*
|
|
68
62
|
* @returns The code snippet
|
|
69
63
|
*/
|
|
70
64
|
listVariables() {
|
|
@@ -73,12 +67,6 @@ export class RuntimeSnippetsFacade {
|
|
|
73
67
|
/**
|
|
74
68
|
* Code snippet to load kernel variables.
|
|
75
69
|
*
|
|
76
|
-
* The code snippet must return a serialized-JSON list
|
|
77
|
-
* with successfully loaded variables.
|
|
78
|
-
*
|
|
79
|
-
* The format used to store the variable value is up to the kernel.
|
|
80
|
-
* It should JSON-serializable and will be passed from {@link saveVariables}.
|
|
81
|
-
*
|
|
82
70
|
* @param variables Serialized-JSON dictionary (<variable name>, <variable value blob>)
|
|
83
71
|
* @returns The code snippet
|
|
84
72
|
*/
|
|
@@ -90,13 +78,6 @@ export class RuntimeSnippetsFacade {
|
|
|
90
78
|
/**
|
|
91
79
|
* Code snippet to save kernel variables.
|
|
92
80
|
*
|
|
93
|
-
* The code snippet must return a serialized-JSON dictionary
|
|
94
|
-
* (<variable name>, <variable value blob>).
|
|
95
|
-
*
|
|
96
|
-
* The format used to store the variable value is up to the kernel.
|
|
97
|
-
* It should JSON-serializable and will be passed to {@link loadVariables}
|
|
98
|
-
* without modification.
|
|
99
|
-
*
|
|
100
81
|
* @param variables Variable names.
|
|
101
82
|
* @returns The code snippet
|
|
102
83
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRuntimeOptions } from '..';
|
|
2
|
-
import type { IRuntimeSnapshot, IDatalayerEnvironment, IRuntimePod } from '
|
|
2
|
+
import type { IRuntimeSnapshot, IDatalayerEnvironment, IRuntimePod } from '../../models';
|
|
3
3
|
/**
|
|
4
4
|
* Get available Environments.
|
|
5
5
|
*/
|
|
@@ -42,7 +42,7 @@ export declare function snapshotRuntime(options: {
|
|
|
42
42
|
*/
|
|
43
43
|
description?: string;
|
|
44
44
|
/**
|
|
45
|
-
* Whether to stop the
|
|
45
|
+
* Whether to stop the runtime after the snapshot completion or not.
|
|
46
46
|
*/
|
|
47
47
|
stop?: boolean;
|
|
48
48
|
}): Promise<IRuntimeSnapshot>;
|
|
@@ -51,7 +51,7 @@ export declare function snapshotRuntime(options: {
|
|
|
51
51
|
*/
|
|
52
52
|
export declare function getRuntimeSnapshots(): Promise<IRuntimeSnapshot[]>;
|
|
53
53
|
/**
|
|
54
|
-
* Load a Runtime Snapshot within a
|
|
54
|
+
* Load a Runtime Snapshot within a Runtime.
|
|
55
55
|
*/
|
|
56
56
|
export declare function loadRuntimeSnapshot(options: {
|
|
57
57
|
/**
|
|
@@ -9,9 +9,9 @@ import { URLExt } from '@jupyterlab/coreutils';
|
|
|
9
9
|
import { PromiseDelegate } from '@lumino/coreutils';
|
|
10
10
|
import { Upload } from 'tus-js-client';
|
|
11
11
|
import { requestDatalayerAPI, } from '..';
|
|
12
|
-
import { asRuntimeSnapshot } from '
|
|
13
|
-
import { iamStore, runtimesStore } from '
|
|
14
|
-
import { sleep } from '
|
|
12
|
+
import { asRuntimeSnapshot } from '../../models';
|
|
13
|
+
import { iamStore, runtimesStore } from '../../state';
|
|
14
|
+
import { sleep } from '../../utils';
|
|
15
15
|
/**
|
|
16
16
|
* Get available Environments.
|
|
17
17
|
*/
|
|
@@ -111,7 +111,7 @@ export async function snapshotRuntime(options) {
|
|
|
111
111
|
token: iamStore.getState().token,
|
|
112
112
|
});
|
|
113
113
|
if (!data.success || !data.snapshot) {
|
|
114
|
-
throw new Error(`Failed to
|
|
114
|
+
throw new Error(`Failed to take the runtime snapshot ${options.id} - ${data}`);
|
|
115
115
|
}
|
|
116
116
|
return asRuntimeSnapshot(data.snapshot);
|
|
117
117
|
}
|
|
@@ -124,13 +124,13 @@ export async function getRuntimeSnapshots() {
|
|
|
124
124
|
token: iamStore.getState().token,
|
|
125
125
|
});
|
|
126
126
|
if (!data.success) {
|
|
127
|
-
console.error('Failed to fetch
|
|
127
|
+
console.error('Failed to fetch runtime snapshots.', data);
|
|
128
128
|
return [];
|
|
129
129
|
}
|
|
130
130
|
return (data.snapshots ?? []).map(asRuntimeSnapshot);
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
|
-
* Load a Runtime Snapshot within a
|
|
133
|
+
* Load a Runtime Snapshot within a Runtime.
|
|
134
134
|
*/
|
|
135
135
|
export async function loadRuntimeSnapshot(options) {
|
|
136
136
|
const data = await requestDatalayerAPI({
|
|
@@ -142,7 +142,7 @@ export async function loadRuntimeSnapshot(options) {
|
|
|
142
142
|
token: iamStore.getState().token,
|
|
143
143
|
});
|
|
144
144
|
if (!data.success) {
|
|
145
|
-
throw new Error(`Failed to load the
|
|
145
|
+
throw new Error(`Failed to load the runtime snapshot; ${data.message}`);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
@@ -181,7 +181,7 @@ export async function deleteRuntimeSnapshot(id) {
|
|
|
181
181
|
method: 'DELETE',
|
|
182
182
|
token: iamStore.getState().token,
|
|
183
183
|
});
|
|
184
|
-
// Poll Runtime Snapshot state up-to its deletion
|
|
184
|
+
// Poll Runtime Snapshot state up-to its deletion.
|
|
185
185
|
try {
|
|
186
186
|
let sleepTimeout = 1000;
|
|
187
187
|
while (true) {
|
|
@@ -5,7 +5,7 @@ import { ISessionContext } from '@jupyterlab/apputils';
|
|
|
5
5
|
import { ServiceManager, Kernel, ServerConnection } from '@jupyterlab/services';
|
|
6
6
|
import { IDisposable } from '@lumino/disposable';
|
|
7
7
|
import { ISignal } from '@lumino/signaling';
|
|
8
|
-
import type { IRuntimeSnapshot, IRuntimeCapabilities, IRuntimeModel, IDatalayerEnvironment, IRuntimeType, IRuntimeLocation } from '
|
|
8
|
+
import type { IRuntimeSnapshot, IRuntimeCapabilities, IRuntimeModel, IDatalayerEnvironment, IRuntimeType, IRuntimeLocation } from '../../models';
|
|
9
9
|
/**
|
|
10
10
|
* Abstract interface for the Datalayer session context.
|
|
11
11
|
* It extends the JupyterLab session context
|
|
@@ -160,16 +160,16 @@ export interface IRemoteRuntimesManager extends IDisposable {
|
|
|
160
160
|
*/
|
|
161
161
|
refreshKernels(): Promise<void>;
|
|
162
162
|
/**
|
|
163
|
-
* Snapshot a
|
|
163
|
+
* Snapshot a runtime
|
|
164
164
|
*
|
|
165
|
-
* The
|
|
165
|
+
* The runtime may be given by its `id` or `podName`.
|
|
166
166
|
* A custom description for the snapshot can be provided.
|
|
167
167
|
*
|
|
168
168
|
* @returns The snapshot description
|
|
169
169
|
*/
|
|
170
|
-
|
|
170
|
+
snapshotRuntime(options: {
|
|
171
171
|
/**
|
|
172
|
-
* The
|
|
172
|
+
* The runtime id to snapshot
|
|
173
173
|
*/
|
|
174
174
|
id?: string;
|
|
175
175
|
/**
|
|
@@ -190,11 +190,11 @@ export interface IRemoteRuntimesManager extends IDisposable {
|
|
|
190
190
|
stop?: boolean;
|
|
191
191
|
}): Promise<IRuntimeSnapshot | undefined>;
|
|
192
192
|
/**
|
|
193
|
-
* Load a snapshot within a
|
|
193
|
+
* Load a snapshot within a runtim
|
|
194
194
|
*
|
|
195
|
-
* The
|
|
195
|
+
* The runtime may be given by its `id` or `podName`.
|
|
196
196
|
*/
|
|
197
|
-
|
|
197
|
+
loadRuntimeSnapshot(options: {
|
|
198
198
|
/**
|
|
199
199
|
* The kernel id
|
|
200
200
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -45,12 +45,14 @@
|
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"dev": "vite",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
48
|
+
"clean": "rimraf lib dist build tsconfig.tsbuildinfo",
|
|
49
|
+
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
|
|
50
|
+
"clean:dist": "rimraf dist",
|
|
51
|
+
"build": "npm run clean && gulp resources-to-lib && tsc -b && vite build",
|
|
52
|
+
"build:lib": "npm run clean:lib && gulp resources-to-lib && tsc -b",
|
|
53
|
+
"build:types": "npm run clean:lib && tsc -b",
|
|
51
54
|
"build:nextjs": "npm run build --workspace=nextjs-notebook-example",
|
|
52
|
-
"build:
|
|
53
|
-
"build:examples": "npm run build:nextjs && npm run build:electron",
|
|
55
|
+
"build:examples": "npm run build:nextjs",
|
|
54
56
|
"build:all": "npm run build && npm run build:examples",
|
|
55
57
|
"lint": "eslint . --quiet",
|
|
56
58
|
"lint:fix": "eslint . --fix",
|
|
@@ -68,7 +70,6 @@
|
|
|
68
70
|
"check:fix": "npm run format:all && npm run lint:fix && npm run type-check:all",
|
|
69
71
|
"preview": "vite preview",
|
|
70
72
|
"start": "vite",
|
|
71
|
-
"clean": "rimraf lib tsconfig.tsbuildinfo",
|
|
72
73
|
"test": "vitest run --project=unit --project=general",
|
|
73
74
|
"test:watch": "vitest --project=unit --project=general",
|
|
74
75
|
"test:ui": "vitest --ui --project=unit --project=general",
|
|
@@ -81,11 +82,10 @@
|
|
|
81
82
|
"typedoc": "typedoc --options typedoc.json --out docs/docs/typescript_api",
|
|
82
83
|
"watch:lib": "run-p 'watch:lib:*'",
|
|
83
84
|
"watch:lib:res": "gulp resources-to-lib-watch",
|
|
84
|
-
"watch:lib:src": "
|
|
85
|
+
"watch:lib:src": "tsc -b -w",
|
|
85
86
|
"type-check:watch": "tsc -b -w --noEmit",
|
|
86
87
|
"example": "vite --config vite.examples.config.ts",
|
|
87
88
|
"example:nextjs": "npm run dev --workspace=nextjs-notebook-example",
|
|
88
|
-
"example:electron": "cd examples/electron && npm run dev",
|
|
89
89
|
"prepare": "husky"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
@@ -101,8 +101,9 @@
|
|
|
101
101
|
"@primer/octicons-react": "^19.15.1",
|
|
102
102
|
"@primer/primitives": "^10.5.0",
|
|
103
103
|
"@primer/react": "^37.19.0",
|
|
104
|
-
"@primer/react-brand": "^0.
|
|
104
|
+
"@primer/react-brand": "^0.58.0",
|
|
105
105
|
"@stripe/react-stripe-js": "^2.7.1",
|
|
106
|
+
"@tanstack/react-query": "^5.90.6",
|
|
106
107
|
"axios": "^1.7.7",
|
|
107
108
|
"boring-avatars": "^2.0.1",
|
|
108
109
|
"buffer": "^6.0.3",
|
|
@@ -118,10 +119,12 @@
|
|
|
118
119
|
"react": "18.3.1",
|
|
119
120
|
"react-confetti": "^6.4.0",
|
|
120
121
|
"react-dom": "18.3.1",
|
|
122
|
+
"react-toastify": "^11.0.5",
|
|
121
123
|
"tus-js-client": "^4.2.3",
|
|
122
124
|
"ulid": "^2.3.0",
|
|
123
125
|
"unique-names-generator": "^4.7.1",
|
|
124
126
|
"usehooks-ts": "^2.9.1",
|
|
127
|
+
"uuid": "^13.0.0",
|
|
125
128
|
"validator": "^13.7.0",
|
|
126
129
|
"zustand": "^4.4.1"
|
|
127
130
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the Modified BSD License.
|
|
4
|
-
*/
|
|
5
|
-
import { describe, it, expect } from 'vitest';
|
|
6
|
-
import { useCache } from '../hooks';
|
|
7
|
-
describe('hooks', () => {
|
|
8
|
-
it('should export qfds constant', () => {
|
|
9
|
-
expect(useCache).toBeDefined();
|
|
10
|
-
});
|
|
11
|
-
/*
|
|
12
|
-
it('useCache should have correct value', () => {
|
|
13
|
-
expect(useCache).toBe('');
|
|
14
|
-
});
|
|
15
|
-
it('useCache should be a string', () => {
|
|
16
|
-
expect(typeof useCache).toBe('string');
|
|
17
|
-
});
|
|
18
|
-
*/
|
|
19
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the Modified BSD License.
|
|
4
|
-
*/
|
|
5
|
-
import { describe, it, expect } from 'vitest';
|
|
6
|
-
import * as coreIndex from '../index';
|
|
7
|
-
describe('@datalayer/core - index', () => {
|
|
8
|
-
it('should export BackdropContext from hooks', () => {
|
|
9
|
-
expect(coreIndex.BackdropContext).toBeDefined();
|
|
10
|
-
expect(coreIndex.BackdropContext).toHaveProperty('$$typeof');
|
|
11
|
-
expect(typeof coreIndex.BackdropContext).toBe('object');
|
|
12
|
-
});
|
|
13
|
-
it('should export utils functions', () => {
|
|
14
|
-
expect(coreIndex.convertToLargestUnit).toBeDefined();
|
|
15
|
-
expect(coreIndex.asArray).toBeDefined();
|
|
16
|
-
});
|
|
17
|
-
it('should export DatalayerServiceManager from services', () => {
|
|
18
|
-
expect(coreIndex.createDatalayerServiceManager).toBeDefined();
|
|
19
|
-
expect(typeof coreIndex.createDatalayerServiceManager).toBe('function');
|
|
20
|
-
});
|
|
21
|
-
it('should have all expected exports', () => {
|
|
22
|
-
const exports = Object.keys(coreIndex);
|
|
23
|
-
expect(exports).toContain('convertToLargestUnit');
|
|
24
|
-
expect(exports).toContain('asArray');
|
|
25
|
-
expect(exports).toContain('createDatalayerServiceManager');
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the Modified BSD License.
|
|
4
|
-
*/
|
|
5
|
-
import { describe, it, expect } from 'vitest';
|
|
6
|
-
describe('@datalayer/core - Integration Tests', () => {
|
|
7
|
-
it('should have proper TypeScript compilation', () => {
|
|
8
|
-
// This test ensures TypeScript compilation is working
|
|
9
|
-
const testNumber = 42;
|
|
10
|
-
const testString = 'hello';
|
|
11
|
-
const testBoolean = true;
|
|
12
|
-
expect(typeof testNumber).toBe('number');
|
|
13
|
-
expect(typeof testString).toBe('string');
|
|
14
|
-
expect(typeof testBoolean).toBe('boolean');
|
|
15
|
-
});
|
|
16
|
-
it('should support modern JavaScript features', () => {
|
|
17
|
-
// Test arrow functions
|
|
18
|
-
const add = (a, b) => a + b;
|
|
19
|
-
expect(add(2, 3)).toBe(5);
|
|
20
|
-
// Test template literals
|
|
21
|
-
const name = 'Datalayer';
|
|
22
|
-
const greeting = `Hello, ${name}!`;
|
|
23
|
-
expect(greeting).toBe('Hello, Datalayer!');
|
|
24
|
-
// Test destructuring
|
|
25
|
-
const obj = { x: 1, y: 2 };
|
|
26
|
-
const { x, y } = obj;
|
|
27
|
-
expect(x).toBe(1);
|
|
28
|
-
expect(y).toBe(2);
|
|
29
|
-
// Test spread operator
|
|
30
|
-
const arr1 = [1, 2, 3];
|
|
31
|
-
const arr2 = [...arr1, 4, 5];
|
|
32
|
-
expect(arr2).toEqual([1, 2, 3, 4, 5]);
|
|
33
|
-
});
|
|
34
|
-
it('should support async/await', async () => {
|
|
35
|
-
const asyncFunction = async () => {
|
|
36
|
-
return new Promise(resolve => {
|
|
37
|
-
setTimeout(() => resolve('async result'), 10);
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
const result = await asyncFunction();
|
|
41
|
-
expect(result).toBe('async result');
|
|
42
|
-
});
|
|
43
|
-
it('should support generics', () => {
|
|
44
|
-
function identity(arg) {
|
|
45
|
-
return arg;
|
|
46
|
-
}
|
|
47
|
-
expect(identity('test')).toBe('test');
|
|
48
|
-
expect(identity(123)).toBe(123);
|
|
49
|
-
expect(identity(true)).toBe(true);
|
|
50
|
-
});
|
|
51
|
-
it('should handle error cases', () => {
|
|
52
|
-
const throwError = () => {
|
|
53
|
-
throw new Error('Test error');
|
|
54
|
-
};
|
|
55
|
-
expect(throwError).toThrow('Test error');
|
|
56
|
-
});
|
|
57
|
-
});
|