@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.
Files changed (249) hide show
  1. package/README.md +2 -2
  2. package/lib/api/DatalayerApi.d.ts +38 -26
  3. package/lib/api/DatalayerApi.js +52 -13
  4. package/lib/api/iam/authentication.d.ts +9 -8
  5. package/lib/api/iam/authentication.js +14 -15
  6. package/lib/api/iam/healthz.d.ts +3 -2
  7. package/lib/api/iam/healthz.js +5 -3
  8. package/lib/api/iam/index.d.ts +9 -4
  9. package/lib/api/iam/index.js +9 -4
  10. package/lib/api/iam/oauth2.d.ts +115 -0
  11. package/lib/api/iam/oauth2.js +309 -0
  12. package/lib/api/iam/profile.d.ts +8 -1
  13. package/lib/api/iam/profile.js +17 -2
  14. package/lib/api/iam/usage.d.ts +18 -0
  15. package/lib/api/iam/usage.js +39 -0
  16. package/lib/api/index.d.ts +6 -6
  17. package/lib/api/index.js +6 -7
  18. package/lib/api/runtimes/environments.d.ts +2 -2
  19. package/lib/api/runtimes/environments.js +3 -2
  20. package/lib/api/runtimes/healthz.d.ts +3 -13
  21. package/lib/api/runtimes/healthz.js +4 -3
  22. package/lib/api/runtimes/index.d.ts +3 -2
  23. package/lib/api/runtimes/index.js +3 -2
  24. package/lib/api/runtimes/runtimes.d.ts +4 -4
  25. package/lib/api/runtimes/runtimes.js +17 -6
  26. package/lib/api/runtimes/snapshots.d.ts +4 -4
  27. package/lib/api/runtimes/snapshots.js +3 -2
  28. package/lib/api/spacer/documents.d.ts +12 -0
  29. package/lib/api/spacer/documents.js +43 -0
  30. package/lib/api/spacer/healthz.d.ts +3 -13
  31. package/lib/api/spacer/healthz.js +4 -3
  32. package/lib/api/spacer/index.d.ts +4 -2
  33. package/lib/api/spacer/index.js +4 -2
  34. package/lib/api/spacer/items.d.ts +9 -1
  35. package/lib/api/spacer/items.js +17 -2
  36. package/lib/api/spacer/lexicals.d.ts +1 -1
  37. package/lib/api/spacer/lexicals.js +3 -2
  38. package/lib/api/spacer/notebooks.d.ts +1 -1
  39. package/lib/api/spacer/notebooks.js +3 -2
  40. package/lib/api/spacer/spaces.d.ts +1 -1
  41. package/lib/api/spacer/spaces.js +3 -2
  42. package/lib/api/spacer/users.d.ts +1 -1
  43. package/lib/api/spacer/users.js +3 -2
  44. package/lib/api/utils/validation.d.ts +24 -1
  45. package/lib/api/utils/validation.js +62 -1
  46. package/lib/client/base.d.ts +75 -0
  47. package/lib/client/base.js +199 -0
  48. package/lib/client/constants.d.ts +22 -0
  49. package/lib/client/constants.js +22 -0
  50. package/lib/client/index.d.ts +108 -0
  51. package/lib/client/index.js +79 -0
  52. package/lib/client/mixins/IAMMixin.d.ts +54 -0
  53. package/lib/client/mixins/IAMMixin.js +181 -0
  54. package/lib/client/mixins/RuntimesMixin.d.ts +93 -0
  55. package/lib/client/mixins/RuntimesMixin.js +229 -0
  56. package/lib/client/mixins/SpacerMixin.d.ts +111 -0
  57. package/lib/client/mixins/SpacerMixin.js +340 -0
  58. package/lib/client/utils/mixins.d.ts +12 -0
  59. package/lib/{sdk/client → client}/utils/mixins.js +0 -28
  60. package/lib/client/utils/spacerUtils.d.ts +18 -0
  61. package/lib/client/utils/spacerUtils.js +32 -0
  62. package/lib/collaboration/DatalayerCollaboration.d.ts +6 -1
  63. package/lib/collaboration/DatalayerCollaboration.js +2 -2
  64. package/lib/collaboration/DatalayerCollaborationProvider.d.ts +5 -0
  65. package/lib/collaboration/DatalayerCollaborationProvider.js +10 -9
  66. package/lib/components/progress/CreditsIndicator.d.ts +1 -1
  67. package/lib/components/runtimes/RuntimeCellVariablesDialog.js +1 -1
  68. package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +1 -1
  69. package/lib/components/runtimes/RuntimeLauncherDialog.js +2 -2
  70. package/lib/components/runtimes/RuntimePickerBase.d.ts +1 -1
  71. package/lib/components/runtimes/RuntimePickerBase.js +1 -1
  72. package/lib/components/runtimes/RuntimePickerCell.js +3 -3
  73. package/lib/components/runtimes/RuntimePickerNotebook.d.ts +1 -1
  74. package/lib/components/runtimes/RuntimePickerNotebook.js +2 -2
  75. package/lib/components/runtimes/RuntimeTransfer.d.ts +2 -2
  76. package/lib/components/runtimes/RuntimeUtils.d.ts +1 -1
  77. package/lib/components/snapshots/RuntimeSnapshotMenu.d.ts +1 -1
  78. package/lib/components/snapshots/RuntimeSnapshotMenu.js +27 -20
  79. package/lib/config/Configuration.d.ts +8 -0
  80. package/lib/hooks/useDatalayer.js +1 -1
  81. package/lib/hooks/useRuntimes.js +1 -1
  82. package/lib/hooks/useToast.js +1 -1
  83. package/lib/index.d.ts +2 -3
  84. package/lib/index.js +4 -3
  85. package/lib/models/Common.d.ts +64 -0
  86. package/lib/models/CreditsDTO.d.ts +124 -0
  87. package/lib/models/CreditsDTO.js +135 -0
  88. package/lib/models/Environment.d.ts +1 -1
  89. package/lib/models/EnvironmentDTO.d.ts +125 -0
  90. package/lib/models/EnvironmentDTO.js +88 -0
  91. package/lib/models/HealthCheck.d.ts +72 -0
  92. package/lib/models/HealthCheck.js +107 -0
  93. package/lib/{api/types/iam.d.ts → models/IAM.d.ts} +15 -78
  94. package/lib/models/ItemDTO.d.ts +74 -0
  95. package/lib/models/ItemDTO.js +186 -0
  96. package/lib/models/LexicalDTO.d.ts +155 -0
  97. package/lib/models/LexicalDTO.js +157 -0
  98. package/lib/models/NotebookDTO.d.ts +96 -0
  99. package/lib/models/NotebookDTO.js +153 -0
  100. package/lib/models/Profile.d.ts +65 -0
  101. package/lib/models/RuntimeDTO.d.ts +191 -0
  102. package/lib/models/RuntimeDTO.js +204 -0
  103. package/lib/models/RuntimeSnapshotDTO.d.ts +173 -0
  104. package/lib/models/RuntimeSnapshotDTO.js +139 -0
  105. package/lib/models/SpaceDTO.d.ts +280 -0
  106. package/lib/models/SpaceDTO.js +239 -0
  107. package/lib/models/UserDTO.d.ts +86 -0
  108. package/lib/models/UserDTO.js +84 -0
  109. package/lib/models/index.d.ts +45 -4
  110. package/lib/models/index.js +45 -4
  111. package/lib/sdk/index.d.ts +5 -4
  112. package/lib/sdk/index.js +6 -5
  113. package/lib/services/DatalayerServiceManager.js +1 -1
  114. package/lib/state/substates/CoreState.js +2 -0
  115. package/lib/state/substates/RuntimesState.d.ts +1 -1
  116. package/lib/state/substates/RuntimesState.js +1 -1
  117. package/lib/{sdk/stateful → stateful}/index.d.ts +1 -1
  118. package/lib/{sdk/stateful → stateful}/index.js +1 -1
  119. package/lib/{sdk/stateful → stateful}/jupyter/exec/Snippets.d.ts +1 -41
  120. package/lib/{sdk/stateful → stateful}/jupyter/exec/Snippets.js +1 -20
  121. package/lib/{sdk/stateful → stateful}/runtimes/actions.d.ts +3 -3
  122. package/lib/{sdk/stateful → stateful}/runtimes/actions.js +8 -8
  123. package/lib/{sdk/stateful → stateful}/runtimes/apis.d.ts +8 -8
  124. package/package.json +13 -10
  125. package/lib/__tests__/hooks.test.d.ts +0 -1
  126. package/lib/__tests__/hooks.test.js +0 -19
  127. package/lib/__tests__/index.test.d.ts +0 -1
  128. package/lib/__tests__/index.test.js +0 -27
  129. package/lib/__tests__/integration.test.d.ts +0 -1
  130. package/lib/__tests__/integration.test.js +0 -57
  131. package/lib/__tests__/shared/cleanup-shared.d.ts +0 -4
  132. package/lib/__tests__/shared/cleanup-shared.js +0 -228
  133. package/lib/__tests__/shared/test-config.d.ts +0 -51
  134. package/lib/__tests__/shared/test-config.js +0 -110
  135. package/lib/__tests__/shared/test-constants.d.ts +0 -66
  136. package/lib/__tests__/shared/test-constants.js +0 -79
  137. package/lib/__tests__/utils.test.d.ts +0 -1
  138. package/lib/__tests__/utils.test.js +0 -59
  139. package/lib/api/__tests__/iam.authentication.integration.test.d.ts +0 -1
  140. package/lib/api/__tests__/iam.authentication.integration.test.js +0 -247
  141. package/lib/api/__tests__/iam.healthz.integration.test.d.ts +0 -1
  142. package/lib/api/__tests__/iam.healthz.integration.test.js +0 -63
  143. package/lib/api/__tests__/iam.profile.integration.test.d.ts +0 -1
  144. package/lib/api/__tests__/iam.profile.integration.test.js +0 -252
  145. package/lib/api/__tests__/runtimes.environments.integration.test.d.ts +0 -1
  146. package/lib/api/__tests__/runtimes.environments.integration.test.js +0 -122
  147. package/lib/api/__tests__/runtimes.healthz.integration.test.d.ts +0 -1
  148. package/lib/api/__tests__/runtimes.healthz.integration.test.js +0 -50
  149. package/lib/api/__tests__/runtimes.integration.test.d.ts +0 -1
  150. package/lib/api/__tests__/runtimes.integration.test.js +0 -369
  151. package/lib/api/__tests__/spacer.healthz.integration.test.d.ts +0 -1
  152. package/lib/api/__tests__/spacer.healthz.integration.test.js +0 -50
  153. package/lib/api/__tests__/spacer.integration.test.d.ts +0 -1
  154. package/lib/api/__tests__/spacer.integration.test.js +0 -519
  155. package/lib/api/iam/__tests__/authentication.unit.test.d.ts +0 -1
  156. package/lib/api/iam/__tests__/authentication.unit.test.js +0 -63
  157. package/lib/api/iam/__tests__/healthz.unit.test.d.ts +0 -1
  158. package/lib/api/iam/__tests__/healthz.unit.test.js +0 -60
  159. package/lib/api/iam/__tests__/profile.unit.test.d.ts +0 -1
  160. package/lib/api/iam/__tests__/profile.unit.test.js +0 -57
  161. package/lib/api/runtimes/__tests__/environments.unit.test.d.ts +0 -1
  162. package/lib/api/runtimes/__tests__/environments.unit.test.js +0 -77
  163. package/lib/api/runtimes/__tests__/healthz.unit.test.d.ts +0 -1
  164. package/lib/api/runtimes/__tests__/healthz.unit.test.js +0 -57
  165. package/lib/api/runtimes/__tests__/runtimes.unit.test.d.ts +0 -1
  166. package/lib/api/runtimes/__tests__/runtimes.unit.test.js +0 -139
  167. package/lib/api/runtimes/__tests__/snapshots.unit.test.d.ts +0 -1
  168. package/lib/api/runtimes/__tests__/snapshots.unit.test.js +0 -96
  169. package/lib/api/spacer/__tests__/healthz.unit.test.d.ts +0 -1
  170. package/lib/api/spacer/__tests__/healthz.unit.test.js +0 -57
  171. package/lib/api/spacer/__tests__/items.unit.test.d.ts +0 -1
  172. package/lib/api/spacer/__tests__/items.unit.test.js +0 -165
  173. package/lib/api/spacer/__tests__/lexicals.unit.test.d.ts +0 -1
  174. package/lib/api/spacer/__tests__/lexicals.unit.test.js +0 -323
  175. package/lib/api/spacer/__tests__/notebooks.unit.test.d.ts +0 -1
  176. package/lib/api/spacer/__tests__/notebooks.unit.test.js +0 -224
  177. package/lib/api/spacer/__tests__/users.unit.test.d.ts +0 -1
  178. package/lib/api/spacer/__tests__/users.unit.test.js +0 -132
  179. package/lib/api/types/index.d.ts +0 -32
  180. package/lib/api/types/index.js +0 -36
  181. package/lib/api/types/runtimes.d.ts +0 -235
  182. package/lib/api/types/spacer.d.ts +0 -271
  183. package/lib/api/types/spacer.js +0 -5
  184. package/lib/api/utils/__tests__/validation.test.d.ts +0 -1
  185. package/lib/api/utils/__tests__/validation.test.js +0 -109
  186. package/lib/sdk/client/__tests__/sdk.health.integration.test.d.ts +0 -1
  187. package/lib/sdk/client/__tests__/sdk.health.integration.test.js +0 -110
  188. package/lib/sdk/client/__tests__/sdk.iam.integration.test.d.ts +0 -1
  189. package/lib/sdk/client/__tests__/sdk.iam.integration.test.js +0 -179
  190. package/lib/sdk/client/__tests__/sdk.models.integration.test.d.ts +0 -1
  191. package/lib/sdk/client/__tests__/sdk.models.integration.test.js +0 -376
  192. package/lib/sdk/client/__tests__/sdk.runtimes.integration.test.d.ts +0 -1
  193. package/lib/sdk/client/__tests__/sdk.runtimes.integration.test.js +0 -276
  194. package/lib/sdk/client/__tests__/sdk.spacer.integration.test.d.ts +0 -1
  195. package/lib/sdk/client/__tests__/sdk.spacer.integration.test.js +0 -361
  196. package/lib/sdk/client/base.d.ts +0 -88
  197. package/lib/sdk/client/base.js +0 -112
  198. package/lib/sdk/client/index.d.ts +0 -192
  199. package/lib/sdk/client/index.js +0 -128
  200. package/lib/sdk/client/mixins/HealthMixin.d.ts +0 -100
  201. package/lib/sdk/client/mixins/HealthMixin.js +0 -133
  202. package/lib/sdk/client/mixins/IAMMixin.d.ts +0 -59
  203. package/lib/sdk/client/mixins/IAMMixin.js +0 -83
  204. package/lib/sdk/client/mixins/RuntimesMixin.d.ts +0 -134
  205. package/lib/sdk/client/mixins/RuntimesMixin.js +0 -221
  206. package/lib/sdk/client/mixins/SpacerMixin.d.ts +0 -184
  207. package/lib/sdk/client/mixins/SpacerMixin.js +0 -278
  208. package/lib/sdk/client/models/Lexical.d.ts +0 -156
  209. package/lib/sdk/client/models/Lexical.js +0 -275
  210. package/lib/sdk/client/models/Notebook.d.ts +0 -174
  211. package/lib/sdk/client/models/Notebook.js +0 -311
  212. package/lib/sdk/client/models/Runtime.d.ts +0 -221
  213. package/lib/sdk/client/models/Runtime.js +0 -341
  214. package/lib/sdk/client/models/Snapshot.d.ts +0 -156
  215. package/lib/sdk/client/models/Snapshot.js +0 -244
  216. package/lib/sdk/client/models/Space.d.ts +0 -182
  217. package/lib/sdk/client/models/Space.js +0 -276
  218. package/lib/sdk/client/models/__tests__/Lexical.test.d.ts +0 -1
  219. package/lib/sdk/client/models/__tests__/Lexical.test.js +0 -288
  220. package/lib/sdk/client/models/__tests__/Notebook.test.d.ts +0 -1
  221. package/lib/sdk/client/models/__tests__/Notebook.test.js +0 -206
  222. package/lib/sdk/client/models/__tests__/Runtime.test.d.ts +0 -1
  223. package/lib/sdk/client/models/__tests__/Runtime.test.js +0 -133
  224. package/lib/sdk/client/models/__tests__/Snapshot.test.d.ts +0 -1
  225. package/lib/sdk/client/models/__tests__/Snapshot.test.js +0 -244
  226. package/lib/sdk/client/models/__tests__/Space.test.d.ts +0 -1
  227. package/lib/sdk/client/models/__tests__/Space.test.js +0 -334
  228. package/lib/sdk/client/models/index.d.ts +0 -30
  229. package/lib/sdk/client/models/index.js +0 -30
  230. package/lib/sdk/client/utils/mixins.d.ts +0 -42
  231. /package/lib/{api/types/iam.js → models/Common.js} +0 -0
  232. /package/lib/{api/types/runtimes.js → models/IAM.js} +0 -0
  233. /package/lib/{sdk/stateful → stateful}/jupyter/exec/Python.d.ts +0 -0
  234. /package/lib/{sdk/stateful → stateful}/jupyter/exec/Python.js +0 -0
  235. /package/lib/{sdk/stateful → stateful}/jupyter/exec/index.d.ts +0 -0
  236. /package/lib/{sdk/stateful → stateful}/jupyter/exec/index.js +0 -0
  237. /package/lib/{sdk/stateful → stateful}/jupyter/index.d.ts +0 -0
  238. /package/lib/{sdk/stateful → stateful}/jupyter/index.js +0 -0
  239. /package/lib/{sdk/stateful → stateful}/jupyter/kernelsHandler.d.ts +0 -0
  240. /package/lib/{sdk/stateful → stateful}/jupyter/kernelsHandler.js +0 -0
  241. /package/lib/{sdk/stateful → stateful}/runtimes/apis.js +0 -0
  242. /package/lib/{sdk/stateful → stateful}/runtimes/index.d.ts +0 -0
  243. /package/lib/{sdk/stateful → stateful}/runtimes/index.js +0 -0
  244. /package/lib/{sdk/stateful → stateful}/runtimes/settings.d.ts +0 -0
  245. /package/lib/{sdk/stateful → stateful}/runtimes/settings.js +0 -0
  246. /package/lib/{sdk/stateful → stateful}/runtimes/snapshots.d.ts +0 -0
  247. /package/lib/{sdk/stateful → stateful}/runtimes/snapshots.js +0 -0
  248. /package/lib/{sdk/stateful → stateful}/runtimes/utils.d.ts +0 -0
  249. /package/lib/{sdk/stateful → stateful}/runtimes/utils.js +0 -0
@@ -1,6 +1,6 @@
1
1
  import { SessionContext } from '@jupyterlab/apputils';
2
2
  import { ITranslator } from '@jupyterlab/translation';
3
- import { IMultiServiceManager } from '../../sdk/stateful/runtimes';
3
+ import { IMultiServiceManager } from '../../stateful/runtimes';
4
4
  import { IRuntimeDesc } from '../../models';
5
5
  export type IDatalayerRuntimeDesc = IRuntimeDesc & {
6
6
  gpu?: string;
@@ -1,6 +1,6 @@
1
1
  import { type PropsWithChildren } from 'react';
2
2
  import { Kernel } from '@jupyterlab/services';
3
- import { IMultiServiceManager } from '../../sdk/stateful/runtimes';
3
+ import { IMultiServiceManager } from '../../stateful/runtimes';
4
4
  /**
5
5
  * Runtime snapshot menu component properties
6
6
  */
@@ -5,10 +5,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
5
5
  */
6
6
  import { useCallback, useEffect, useState, } from 'react';
7
7
  import { CameraIcon } from '@datalayer/icons-react';
8
- import { ActionList, ActionMenu, Box, Flash, FormControl, Select, Spinner, } from '@primer/react';
8
+ import { ActionList, ActionMenu, Flash, FormControl, Select, Spinner, } from '@primer/react';
9
9
  import { Dialog } from '@primer/react/experimental';
10
+ import { Box } from '@datalayer/primer-addons';
10
11
  import { useToast } from '../../hooks';
11
- import { createRuntimeSnapshot, getRuntimeSnapshots, loadBrowserRuntimeSnapshot, loadRuntimeSnapshot, } from '../../sdk/stateful/runtimes';
12
+ import { createRuntimeSnapshot, getRuntimeSnapshots, loadBrowserRuntimeSnapshot, loadRuntimeSnapshot, } from '../../stateful/runtimes';
12
13
  import { useRuntimesStore } from '../../state';
13
14
  import { createRuntimeSnapshotName } from '../../utils';
14
15
  /**
@@ -17,10 +18,10 @@ import { createRuntimeSnapshotName } from '../../utils';
17
18
  export function RuntimeSnapshotMenu(props) {
18
19
  const { children, connection, podName, multiServiceManager, disabled } = props;
19
20
  const { addRuntimeSnapshot, runtimesRunUrl, runtimeSnapshots, setRuntimeSnapshots, } = useRuntimesStore();
20
- const { trackAsyncTask } = useToast();
21
+ const { enqueueToast, trackAsyncTask } = useToast();
21
22
  const [openLoadDialog, setOpenLoadDialog] = useState(false);
22
- const [loadingKernelSnapshot, setLoadingKernelSnapshot] = useState(false);
23
- const [takingKernelSnapshot, setTakingSnapshot] = useState(false);
23
+ const [loadingRuntimeSnapshot, setLoadingRuntimeSnapshot] = useState(false);
24
+ const [takingRuntimeSnapshot, setTakingRuntimeSnapshot] = useState(false);
24
25
  const [selection, setSelection] = useState(runtimeSnapshots[0]?.id ?? '');
25
26
  const [error, setError] = useState();
26
27
  useEffect(() => {
@@ -35,31 +36,37 @@ export function RuntimeSnapshotMenu(props) {
35
36
  console.error(`Failed to fetch remote kernel snapshots; ${reason}`);
36
37
  });
37
38
  }, [runtimesRunUrl]);
38
- const onLoadKernelSnapshot = useCallback(() => {
39
+ const onLoadRuntimeSnapshot = useCallback(() => {
39
40
  setError(undefined);
40
41
  setOpenLoadDialog(true);
41
42
  }, []);
42
- const onKerenelSnapshotChanged = useCallback(event => {
43
+ const onRuntimeSnapshotChanged = useCallback(event => {
43
44
  setSelection(event.target.value);
44
45
  }, []);
45
- const onLoadKernelSnapshotSubmit = useCallback(async ({ id, connection, podName, }) => {
46
+ const onLoadRuntimeSnapshotSubmit = useCallback(async ({ id, connection, podName, }) => {
46
47
  if (podName) {
47
48
  await loadRuntimeSnapshot({ id: podName, from: id });
49
+ enqueueToast(`Runtime snapshot ${podName} is loaded.`, {
50
+ variant: 'success',
51
+ });
48
52
  }
49
53
  else if (connection) {
50
54
  await loadBrowserRuntimeSnapshot({ connection, id });
55
+ enqueueToast(`Runtime snapshot ${id} is loaded.`, {
56
+ variant: 'success',
57
+ });
51
58
  }
52
59
  }, []);
53
- const onTakeKernelSnapshot = useCallback(async () => {
60
+ const onTakeRuntimeSnapshot = useCallback(async () => {
54
61
  try {
55
- setTakingSnapshot(true);
62
+ setTakingRuntimeSnapshot(true);
56
63
  let snapshot;
57
64
  let task;
58
65
  let ref = '';
59
66
  let snapshotName = '';
60
67
  if (podName && multiServiceManager?.remote) {
61
68
  snapshotName = createRuntimeSnapshotName('cloud');
62
- task = multiServiceManager.remote.runtimesManager.snapshot({
69
+ task = multiServiceManager.remote.runtimesManager.snapshotRuntime({
63
70
  podName,
64
71
  name: snapshotName,
65
72
  description: snapshotName,
@@ -97,7 +104,7 @@ export function RuntimeSnapshotMenu(props) {
97
104
  message: (reason, data) => {
98
105
  const msg = reason === 'Empty snapshot'
99
106
  ? `Runtime ${ref} will not be snapshotted as it does not contain any serializable state.`
100
- : `Failed to pause runtime ${ref} - ${reason}`;
107
+ : `Failed to snapshot runtime ${ref} - ${reason}`;
101
108
  return msg;
102
109
  },
103
110
  },
@@ -113,10 +120,10 @@ export function RuntimeSnapshotMenu(props) {
113
120
  }
114
121
  }
115
122
  finally {
116
- setTakingSnapshot(false);
123
+ setTakingRuntimeSnapshot(false);
117
124
  }
118
125
  }, [connection, podName, multiServiceManager]);
119
- return (_jsxs(_Fragment, { children: [_jsxs(ActionMenu, { children: [_jsx(ActionMenu.Button, { leadingVisual: CameraIcon, variant: "invisible", size: "small", disabled: loadingKernelSnapshot || takingKernelSnapshot || disabled, children: children }), _jsx(ActionMenu.Overlay, { children: _jsxs(ActionList, { children: [_jsx(ActionList.Item, { onSelect: onLoadKernelSnapshot, disabled: loadingKernelSnapshot || runtimeSnapshots.length === 0, children: "Load a runtime snapshot\u2026" }), _jsx(ActionList.Item, { onSelect: onTakeKernelSnapshot, disabled: takingKernelSnapshot, children: "Take a runtime snapshot" })] }) })] }), openLoadDialog && (_jsx(Dialog, { title: _jsx("span", { style: { color: 'var(--fgColor-default)' }, children: "Choose a runtime snapshot to load" }), onClose: () => {
126
+ return (_jsxs(_Fragment, { children: [_jsxs(ActionMenu, { children: [_jsx(ActionMenu.Button, { leadingVisual: CameraIcon, variant: "invisible", size: "small", disabled: loadingRuntimeSnapshot || takingRuntimeSnapshot || disabled, children: children }), _jsx(ActionMenu.Overlay, { children: _jsxs(ActionList, { children: [_jsx(ActionList.Item, { onSelect: onLoadRuntimeSnapshot, disabled: loadingRuntimeSnapshot || runtimeSnapshots.length === 0, children: "Load a runtime snapshot\u2026" }), _jsx(ActionList.Item, { onSelect: onTakeRuntimeSnapshot, disabled: takingRuntimeSnapshot, children: "Take a runtime snapshot" })] }) })] }), openLoadDialog && (_jsx(Dialog, { title: _jsx("span", { style: { color: 'var(--fgColor-default)' }, children: "Choose a runtime snapshot to load" }), onClose: () => {
120
127
  setOpenLoadDialog(false);
121
128
  }, footerButtons: [
122
129
  {
@@ -131,17 +138,17 @@ export function RuntimeSnapshotMenu(props) {
131
138
  },
132
139
  {
133
140
  buttonType: 'primary',
134
- content: loadingKernelSnapshot ? (_jsx(Spinner, { size: "small" })) : ('Load'),
135
- disabled: loadingKernelSnapshot,
141
+ content: loadingRuntimeSnapshot ? (_jsx(Spinner, { size: "small" })) : ('Load'),
142
+ disabled: loadingRuntimeSnapshot,
136
143
  onClick: async (event) => {
137
144
  if (!event.defaultPrevented) {
138
145
  event.preventDefault();
139
- setLoadingKernelSnapshot(true);
146
+ setLoadingRuntimeSnapshot(true);
140
147
  try {
141
148
  setError(undefined);
142
149
  const snapshot = runtimeSnapshots.find(s => s.id === selection);
143
150
  if (snapshot && (connection || podName)) {
144
- await onLoadKernelSnapshotSubmit({
151
+ await onLoadRuntimeSnapshotSubmit({
145
152
  connection,
146
153
  id: snapshot.id,
147
154
  podName,
@@ -152,14 +159,14 @@ export function RuntimeSnapshotMenu(props) {
152
159
  }
153
160
  }
154
161
  finally {
155
- setLoadingKernelSnapshot(false);
162
+ setLoadingRuntimeSnapshot(false);
156
163
  setOpenLoadDialog(false);
157
164
  }
158
165
  }
159
166
  },
160
167
  autoFocus: true,
161
168
  },
162
- ], children: _jsxs(Box, { as: "form", children: [_jsxs(FormControl, { children: [_jsx(FormControl.Label, { children: "Snapshot" }), _jsx(Select, { name: "snapshot", value: selection, onChange: onKerenelSnapshotChanged, block: true, children: runtimeSnapshots.map(s => (_jsx(Select.Option, { value: s.id, children: s.name ? `${s.name} (${s.id})` : s.id }, s.id))) })] }), error && _jsx(Flash, { variant: "danger", children: error })] }) }))] }));
169
+ ], children: _jsxs(Box, { as: "form", children: [_jsxs(FormControl, { children: [_jsx(FormControl.Label, { children: "Snapshot" }), _jsx(Select, { name: "snapshot", value: selection, onChange: onRuntimeSnapshotChanged, block: true, children: runtimeSnapshots.map(s => (_jsx(Select.Option, { value: s.id, children: s.name ? `${s.name} (${s.id})` : s.id }, s.id))) })] }), error && _jsx(Flash, { variant: "danger", children: error })] }) }))] }));
163
170
  }
164
171
  RuntimeSnapshotMenu.defaultProps = {
165
172
  disabled: false,
@@ -63,6 +63,14 @@ export type IDatalayerCoreConfig = {
63
63
  * AI Agents API URL.
64
64
  */
65
65
  aiagentsRunUrl: string;
66
+ /**
67
+ * AI Inference API URL.
68
+ */
69
+ aiinferenceRunUrl: string;
70
+ /**
71
+ * MCP Servers API URL.
72
+ */
73
+ mcpserversRunUrl: string;
66
74
  /**
67
75
  * Growth API URL.
68
76
  */
@@ -36,7 +36,7 @@ export function useDatalayer(props = {}) {
36
36
  if (error.name === 'RunResponseError') {
37
37
  const responseError = error;
38
38
  if (responseError.response.status === 401) {
39
- console.log('Datalayer RUN sent a 401 return code.');
39
+ console.log('Datalayer sent a 401 return code.');
40
40
  if (location.pathname !== loginRoute_) {
41
41
  iamStore.logout();
42
42
  navigate(loginRoute_);
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- import { requestJupyterKernelsExtension } from '../sdk/stateful/jupyter/kernelsHandler';
5
+ import { requestJupyterKernelsExtension } from '../stateful/jupyter/kernelsHandler';
6
6
  export const useRuntimes = () => {
7
7
  // Folder Mounting ----------------------------------------------------------
8
8
  const mountLocalFolder = (kernelId) => {
@@ -41,7 +41,7 @@ function createContent(message, closeHandler, actions) {
41
41
  })] }))] }));
42
42
  }
43
43
  export const useToast = () => {
44
- // This CANNOT use React hooks as it is used outside React context.
44
+ // This CANNOT use Jupyter React hooks as it may be used outside Jupyter React context.
45
45
  const insideJupyterLab = isInsideJupyterLab();
46
46
  const enqueueToast = (message, options = { variant: 'info' }) => {
47
47
  const { actions, autoClose } = options;
package/lib/index.d.ts CHANGED
@@ -7,9 +7,8 @@ export * from './hooks';
7
7
  export { requestDatalayerAPI, RunResponseError, NetworkError, } from './api/DatalayerApi';
8
8
  export type { IRequestDatalayerAPIOptions } from './api/DatalayerApi';
9
9
  export { API_BASE_PATHS } from './api/constants';
10
- export * from './api/types';
11
10
  export * as runtimesApi from './api/runtimes';
12
11
  export * as iamApi from './api/iam';
13
12
  export * as spacerApi from './api/spacer';
14
- export { DatalayerSDK, type DatalayerSDKConfig } from './sdk/client';
15
- export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './sdk/stateful/runtimes/actions';
13
+ export { DatalayerClient, type DatalayerClientConfig, type SDKHandlers, User, Runtime, Environment, Snapshot, Space, Notebook, LexicalDTO, Credits, Item, type RuntimeJSON, type EnvironmentJSON, type UserJSON, } from './client';
14
+ export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './stateful/runtimes/actions';
package/lib/index.js CHANGED
@@ -12,10 +12,11 @@ export * from './hooks';
12
12
  // Export API and SDK layers
13
13
  export { requestDatalayerAPI, RunResponseError, NetworkError, } from './api/DatalayerApi';
14
14
  export { API_BASE_PATHS } from './api/constants';
15
- export * from './api/types';
16
15
  export * as runtimesApi from './api/runtimes';
17
16
  export * as iamApi from './api/iam';
18
17
  export * as spacerApi from './api/spacer';
19
- export { DatalayerSDK } from './sdk/client';
18
+ export { DatalayerClient,
19
+ // Export SDK models
20
+ User, Runtime, Environment, Snapshot, Space, Notebook, LexicalDTO, Credits, Item, } from './client';
20
21
  // Export commonly used SDK functions directly for convenience
21
- export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './sdk/stateful/runtimes/actions';
22
+ export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './stateful/runtimes/actions';
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Common types shared across all Datalayer API services.
3
+ *
4
+ * @module api/types/common
5
+ */
6
+ /**
7
+ * Standard health check response used by all services.
8
+ * @interface HealthzPingResponse
9
+ */
10
+ export interface HealthzPingResponse {
11
+ /** Whether the request was successful */
12
+ success: boolean;
13
+ /** Response message from the server */
14
+ message: string;
15
+ /** Service status information */
16
+ status?: {
17
+ /** Status indicator (e.g., "OK") */
18
+ status: string;
19
+ };
20
+ /** API version */
21
+ version?: string;
22
+ }
23
+ /**
24
+ * Standard error response structure.
25
+ * @interface ErrorResponse
26
+ */
27
+ export interface ErrorResponse {
28
+ /** Whether the request was successful (always false for errors) */
29
+ success: false;
30
+ /** Error message */
31
+ message: string;
32
+ /** Optional error code */
33
+ code?: string;
34
+ /** Optional additional error details */
35
+ details?: any;
36
+ }
37
+ /**
38
+ * Standard pagination parameters.
39
+ * @interface PaginationParams
40
+ */
41
+ export interface PaginationParams {
42
+ /** Page number (1-based) */
43
+ page?: number;
44
+ /** Items per page */
45
+ limit?: number;
46
+ /** Sort field */
47
+ sort?: string;
48
+ /** Sort order */
49
+ order?: 'asc' | 'desc';
50
+ }
51
+ /**
52
+ * Standard pagination response metadata.
53
+ * @interface PaginationMeta
54
+ */
55
+ export interface PaginationMeta {
56
+ /** Current page */
57
+ page: number;
58
+ /** Items per page */
59
+ limit: number;
60
+ /** Total number of items */
61
+ total: number;
62
+ /** Total number of pages */
63
+ totalPages: number;
64
+ }
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Credit information for a user.
3
+ */
4
+ export interface CreditsInfo {
5
+ /** Available credits */
6
+ credits: number;
7
+ /** Credit quota (null if unlimited) */
8
+ quota: number | null;
9
+ /** Last update timestamp */
10
+ last_update: string;
11
+ }
12
+ /**
13
+ * Credit reservation information.
14
+ */
15
+ export interface CreditReservation {
16
+ /** Reservation ID */
17
+ id: string;
18
+ /** Reserved credits */
19
+ credits: number;
20
+ /** Resource ID (e.g., runtime ID) */
21
+ resource: string;
22
+ /** Last update timestamp */
23
+ last_update: string;
24
+ /** Burning rate (credits per hour) for this reservation */
25
+ burning_rate: number;
26
+ /** Start date of the reservation */
27
+ start_date: string;
28
+ }
29
+ /**
30
+ * Response from the credits endpoint.
31
+ */
32
+ export interface CreditsResponse {
33
+ /** Operation success status */
34
+ success: boolean;
35
+ /** Credit information */
36
+ credits: CreditsInfo;
37
+ /** Active credit reservations */
38
+ reservations: CreditReservation[];
39
+ }
40
+ /**
41
+ * Credits model representing user's available credits and usage.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const credits = await sdk.getCredits();
46
+ * console.log(`Available: ${credits.available}`);
47
+ * console.log(`Quota: ${credits.quota || 'unlimited'}`);
48
+ *
49
+ * // Calculate maximum runtime for an environment
50
+ * const maxMinutes = credits.calculateMaxRuntimeMinutes(environment.burningRate);
51
+ * ```
52
+ */
53
+ export declare class CreditsDTO {
54
+ /** @internal */
55
+ _data: CreditsInfo;
56
+ private _reservations;
57
+ constructor(data: CreditsInfo, reservations?: CreditReservation[]);
58
+ /**
59
+ * Available credits for the user.
60
+ */
61
+ get available(): number;
62
+ /**
63
+ * Credit quota for the user.
64
+ * Returns null if unlimited.
65
+ */
66
+ get quota(): number | null;
67
+ /**
68
+ * Last update timestamp.
69
+ */
70
+ get lastUpdate(): string;
71
+ /**
72
+ * Active credit reservations.
73
+ */
74
+ get reservations(): CreditReservation[];
75
+ /**
76
+ * Total reserved credits across all reservations.
77
+ */
78
+ get totalReserved(): number;
79
+ /**
80
+ * Net available credits (available minus reserved).
81
+ */
82
+ get netAvailable(): number;
83
+ /**
84
+ * Get runtime reservations (reservations that start with 'runtime-').
85
+ */
86
+ get runtimeReservations(): CreditReservation[];
87
+ /**
88
+ * Check if there are any active runtime reservations.
89
+ */
90
+ get hasActiveRuntimes(): boolean;
91
+ /**
92
+ * Calculate maximum runtime in minutes based on environment burning rate.
93
+ *
94
+ * @param burningRate - Credits consumed per hour
95
+ * @returns Maximum runtime in minutes
96
+ */
97
+ calculateMaxRuntimeMinutes(burningRate: number): number;
98
+ /**
99
+ * Calculate credits needed for runtime duration.
100
+ *
101
+ * @param minutes - Runtime duration in minutes
102
+ * @param burningRate - Credits consumed per hour
103
+ * @returns Credits needed
104
+ */
105
+ calculateCreditsFromMinutes(minutes: number, burningRate: number): number;
106
+ /**
107
+ * Check if user has enough credits for runtime.
108
+ *
109
+ * @param minutes - Runtime duration in minutes
110
+ * @param burningRate - Credits consumed per hour
111
+ * @returns True if user has enough credits
112
+ */
113
+ hasEnoughCreditsForRuntime(minutes: number, burningRate: number): boolean;
114
+ /**
115
+ * Convert to JSON representation.
116
+ */
117
+ toJSON(): CreditsInfo & {
118
+ reservations: CreditReservation[];
119
+ };
120
+ /**
121
+ * String representation of credits.
122
+ */
123
+ toString(): string;
124
+ }
@@ -0,0 +1,135 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Credits model for the Datalayer SDK.
7
+ *
8
+ * @module models/CreditsDTO
9
+ */
10
+ import { validateJSON } from '../api/utils/validation';
11
+ /**
12
+ * Credits model representing user's available credits and usage.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const credits = await sdk.getCredits();
17
+ * console.log(`Available: ${credits.available}`);
18
+ * console.log(`Quota: ${credits.quota || 'unlimited'}`);
19
+ *
20
+ * // Calculate maximum runtime for an environment
21
+ * const maxMinutes = credits.calculateMaxRuntimeMinutes(environment.burningRate);
22
+ * ```
23
+ */
24
+ export class CreditsDTO {
25
+ /** @internal */
26
+ _data;
27
+ _reservations;
28
+ constructor(data, reservations = []) {
29
+ this._data = data;
30
+ this._reservations = reservations;
31
+ }
32
+ /**
33
+ * Available credits for the user.
34
+ */
35
+ get available() {
36
+ return this._data.credits;
37
+ }
38
+ /**
39
+ * Credit quota for the user.
40
+ * Returns null if unlimited.
41
+ */
42
+ get quota() {
43
+ return this._data.quota;
44
+ }
45
+ /**
46
+ * Last update timestamp.
47
+ */
48
+ get lastUpdate() {
49
+ return this._data.last_update;
50
+ }
51
+ /**
52
+ * Active credit reservations.
53
+ */
54
+ get reservations() {
55
+ return [...this._reservations];
56
+ }
57
+ /**
58
+ * Total reserved credits across all reservations.
59
+ */
60
+ get totalReserved() {
61
+ return this._reservations.reduce((sum, r) => sum + r.credits, 0);
62
+ }
63
+ /**
64
+ * Net available credits (available minus reserved).
65
+ */
66
+ get netAvailable() {
67
+ return Math.max(0, this.available - this.totalReserved);
68
+ }
69
+ /**
70
+ * Get runtime reservations (reservations that start with 'runtime-').
71
+ */
72
+ get runtimeReservations() {
73
+ return this._reservations.filter(r => r.id.startsWith('runtime-'));
74
+ }
75
+ /**
76
+ * Check if there are any active runtime reservations.
77
+ */
78
+ get hasActiveRuntimes() {
79
+ return this.runtimeReservations.length > 0;
80
+ }
81
+ /**
82
+ * Calculate maximum runtime in minutes based on environment burning rate.
83
+ *
84
+ * @param burningRate - Credits consumed per hour
85
+ * @returns Maximum runtime in minutes
86
+ */
87
+ calculateMaxRuntimeMinutes(burningRate) {
88
+ if (burningRate <= 0)
89
+ return 0;
90
+ const burningRatePerMinute = burningRate * 60;
91
+ return Math.floor(this.netAvailable / burningRatePerMinute);
92
+ }
93
+ /**
94
+ * Calculate credits needed for runtime duration.
95
+ *
96
+ * @param minutes - Runtime duration in minutes
97
+ * @param burningRate - Credits consumed per hour
98
+ * @returns Credits needed
99
+ */
100
+ calculateCreditsFromMinutes(minutes, burningRate) {
101
+ const burningRatePerMinute = burningRate * 60;
102
+ return minutes * burningRatePerMinute;
103
+ }
104
+ /**
105
+ * Check if user has enough credits for runtime.
106
+ *
107
+ * @param minutes - Runtime duration in minutes
108
+ * @param burningRate - Credits consumed per hour
109
+ * @returns True if user has enough credits
110
+ */
111
+ hasEnoughCreditsForRuntime(minutes, burningRate) {
112
+ const creditsNeeded = this.calculateCreditsFromMinutes(minutes, burningRate);
113
+ return this.netAvailable >= creditsNeeded;
114
+ }
115
+ /**
116
+ * Convert to JSON representation.
117
+ */
118
+ toJSON() {
119
+ // FIXME
120
+ const obj = {
121
+ ...this._data,
122
+ reservations: this._reservations,
123
+ };
124
+ validateJSON(obj, 'Credits');
125
+ return obj;
126
+ }
127
+ /**
128
+ * String representation of credits.
129
+ */
130
+ toString() {
131
+ const quotaStr = this.quota !== null ? ` of ${this.quota}` : '';
132
+ const reservedStr = this.totalReserved > 0 ? ` (${this.totalReserved} reserved)` : '';
133
+ return `Credits: ${this.available}${quotaStr}${reservedStr}`;
134
+ }
135
+ }
@@ -60,7 +60,7 @@ export interface IDatalayerEnvironment {
60
60
  /**
61
61
  * Associate kernel attributes
62
62
  */
63
- kernel?: {
63
+ runtime?: {
64
64
  /**
65
65
  * Proposed display name
66
66
  */