@datalayer/core 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/lib/App.js +2 -2
  2. package/lib/api/DatalayerApi.js +6 -1
  3. package/lib/api/constants.d.ts +1 -1
  4. package/lib/api/constants.js +1 -1
  5. package/lib/api/iam/authentication.js +3 -3
  6. package/lib/api/iam/datasources.js +3 -3
  7. package/lib/api/iam/healthz.js +2 -2
  8. package/lib/api/iam/index.js +12 -12
  9. package/lib/api/iam/oauth2.js +2 -2
  10. package/lib/api/iam/profile.js +3 -3
  11. package/lib/api/iam/secrets.js +3 -3
  12. package/lib/api/iam/usage.js +2 -2
  13. package/lib/api/index.js +8 -8
  14. package/lib/api/otel/index.js +5 -5
  15. package/lib/api/otel/logs.js +3 -3
  16. package/lib/api/otel/metrics.js +3 -3
  17. package/lib/api/otel/query.js +3 -3
  18. package/lib/api/otel/services.js +3 -3
  19. package/lib/api/otel/traces.js +3 -3
  20. package/lib/api/runtimes/checkpoints.js +3 -3
  21. package/lib/api/runtimes/environments.js +3 -3
  22. package/lib/api/runtimes/healthz.js +2 -2
  23. package/lib/api/runtimes/index.js +5 -5
  24. package/lib/api/runtimes/runtimes.js +3 -3
  25. package/lib/api/runtimes/snapshots.js +3 -3
  26. package/lib/api/spacer/documents.js +2 -2
  27. package/lib/api/spacer/healthz.js +2 -2
  28. package/lib/api/spacer/index.js +7 -7
  29. package/lib/api/spacer/items.js +2 -2
  30. package/lib/api/spacer/lexicals.d.ts +8 -0
  31. package/lib/api/spacer/lexicals.js +16 -2
  32. package/lib/api/spacer/notebooks.d.ts +8 -0
  33. package/lib/api/spacer/notebooks.js +16 -2
  34. package/lib/api/spacer/spaces.d.ts +76 -1
  35. package/lib/api/spacer/spaces.js +143 -3
  36. package/lib/api/spacer/users.js +3 -3
  37. package/lib/client/auth/AuthenticationManager.js +3 -3
  38. package/lib/client/auth/index.js +4 -4
  39. package/lib/client/auth/storage.d.ts +3 -1
  40. package/lib/client/auth/storage.js +35 -14
  41. package/lib/client/auth/strategies.js +3 -3
  42. package/lib/client/base.js +2 -2
  43. package/lib/client/index.d.ts +22 -2
  44. package/lib/client/index.js +21 -20
  45. package/lib/client/mixins/IAMMixin.js +10 -10
  46. package/lib/client/mixins/RuntimesMixin.js +7 -7
  47. package/lib/client/mixins/SpacerMixin.d.ts +99 -0
  48. package/lib/client/mixins/SpacerMixin.js +265 -11
  49. package/lib/client/utils/slugify.d.ts +8 -0
  50. package/lib/client/utils/slugify.js +18 -0
  51. package/lib/client/utils/spacerUtils.js +3 -3
  52. package/lib/collaboration/DatalayerCollaborationProvider.js +1 -1
  53. package/lib/collaboration/index.js +2 -2
  54. package/lib/components/auth/Login.js +6 -6
  55. package/lib/components/auth/Login.stories.js +2 -2
  56. package/lib/components/auth/LoginToken.js +2 -2
  57. package/lib/components/auth/index.js +3 -3
  58. package/lib/components/avatars/BoringAvatar.stories.js +1 -1
  59. package/lib/components/avatars/UserProfileAvatar.js +2 -2
  60. package/lib/components/avatars/index.js +2 -2
  61. package/lib/components/banners/NoAutomationBanner.js +1 -1
  62. package/lib/components/banners/index.js +1 -1
  63. package/lib/components/buttons/DownloadCSVButton.js +1 -1
  64. package/lib/components/buttons/DownloadJsonButton.js +1 -1
  65. package/lib/components/buttons/index.js +5 -5
  66. package/lib/components/checkout/StripeCheckout.js +1 -1
  67. package/lib/components/checkout/index.js +1 -1
  68. package/lib/components/confetti/index.js +1 -1
  69. package/lib/components/context/OrganizationSelect.js +2 -2
  70. package/lib/components/context/SpaceSelect.js +2 -2
  71. package/lib/components/context/index.js +2 -2
  72. package/lib/components/display/DatalayerBox.js +1 -1
  73. package/lib/components/display/LiveRelativeTime.js +1 -1
  74. package/lib/components/display/NavLink.js +1 -1
  75. package/lib/components/display/index.js +14 -14
  76. package/lib/components/echarts/index.js +1 -1
  77. package/lib/components/flashes/FlashDisclaimer.js +2 -2
  78. package/lib/components/flashes/FlashGuest.js +4 -4
  79. package/lib/components/flashes/FlashSurveys.js +4 -4
  80. package/lib/components/flashes/FlashUnauthorized.js +1 -1
  81. package/lib/components/flashes/index.js +6 -6
  82. package/lib/components/flashes/surveys/index.js +2 -2
  83. package/lib/components/iam/ExternalTokenSilentLogin.js +3 -3
  84. package/lib/components/iam/index.js +1 -1
  85. package/lib/components/icons/index.js +1 -1
  86. package/lib/components/index.js +2 -2
  87. package/lib/components/labels/index.js +1 -1
  88. package/lib/components/landings/index.js +1 -1
  89. package/lib/components/navbar/NavigationVisbilityObserver.js +4 -4
  90. package/lib/components/navbar/SubdomainNavBar.js +5 -5
  91. package/lib/components/navbar/index.js +2 -2
  92. package/lib/components/nbgrader/index.js +1 -1
  93. package/lib/components/notebooks/index.js +2 -2
  94. package/lib/components/progress/ConsumptionBar.js +1 -1
  95. package/lib/components/progress/CreditsIndicator.js +2 -2
  96. package/lib/components/progress/index.js +6 -6
  97. package/lib/components/runtimes/RuntimeCellVariablesDialog.js +2 -2
  98. package/lib/components/runtimes/RuntimeLauncherDialog.js +9 -9
  99. package/lib/components/runtimes/RuntimePickerBase.js +3 -3
  100. package/lib/components/runtimes/RuntimePickerCell.js +8 -8
  101. package/lib/components/runtimes/RuntimePickerNotebook.js +6 -6
  102. package/lib/components/runtimes/RuntimeSimplePicker.js +3 -3
  103. package/lib/components/runtimes/index.js +11 -11
  104. package/lib/components/screencapture/ScreencaptureButton.js +3 -3
  105. package/lib/components/screencapture/index.js +2 -2
  106. package/lib/components/snapshots/RuntimeSnapshotMenu.js +4 -4
  107. package/lib/components/snapshots/index.js +1 -1
  108. package/lib/components/snippets/SnippetDialog.js +1 -1
  109. package/lib/components/snippets/index.js +1 -1
  110. package/lib/components/sparklines/Sparklines.js +5 -1
  111. package/lib/components/sparklines/dataProcessing.d.ts +2 -4
  112. package/lib/components/sparklines/dataProcessing.js +1 -1
  113. package/lib/components/sparklines/index.d.ts +1 -0
  114. package/lib/components/sparklines/index.js +7 -3
  115. package/lib/components/sparklines/types.js +1 -1
  116. package/lib/components/storage/ContentsBrowser.js +3 -3
  117. package/lib/components/storage/index.js +2 -2
  118. package/lib/components/students/index.js +1 -1
  119. package/lib/components/subnav/SubNav.js +2 -2
  120. package/lib/components/subnav/index.js +1 -1
  121. package/lib/components/tables/index.js +1 -1
  122. package/lib/components/text-reveal/TextRevealAnimation.js +1 -1
  123. package/lib/components/text-reveal/index.js +1 -1
  124. package/lib/components/tokens/index.js +1 -1
  125. package/lib/components/toolbars/AssignmentEditorToolbar.js +1 -1
  126. package/lib/components/toolbars/DocumentEditorToolbar.js +1 -1
  127. package/lib/components/toolbars/index.js +3 -3
  128. package/lib/components/users/PeerIndicator.js +1 -1
  129. package/lib/components/users/index.js +1 -1
  130. package/lib/config/Configuration.d.ts +1 -1
  131. package/lib/config/Configuration.js +2 -2
  132. package/lib/config/index.js +2 -2
  133. package/lib/config/integrations/index.js +1 -1
  134. package/lib/hooks/assets/index.js +1 -1
  135. package/lib/hooks/index.js +33 -33
  136. package/lib/hooks/layouts/LayoutBackdrop.js +2 -2
  137. package/lib/hooks/layouts/LayoutScreencapture.js +3 -3
  138. package/lib/hooks/layouts/index.js +2 -2
  139. package/lib/hooks/useAuthorization.js +3 -3
  140. package/lib/hooks/useBackdrop.js +2 -2
  141. package/lib/hooks/useCache.js +9 -9
  142. package/lib/hooks/useCellOutputshot.js +2 -2
  143. package/lib/hooks/useDatalayer.js +6 -6
  144. package/lib/hooks/useIAM.js +4 -4
  145. package/lib/hooks/useLocation.js +2 -2
  146. package/lib/hooks/useLocationHandles.js +3 -3
  147. package/lib/hooks/useNavigate.js +4 -4
  148. package/lib/hooks/useParams.js +2 -2
  149. package/lib/hooks/useProjects.d.ts +2 -8
  150. package/lib/hooks/useProjects.js +2 -2
  151. package/lib/hooks/useRuntimes.js +1 -1
  152. package/lib/hooks/useScreencapture.js +1 -1
  153. package/lib/hooks/useToast.js +41 -5
  154. package/lib/hooks/useUpload.js +2 -2
  155. package/lib/hooks/useUser.js +1 -1
  156. package/lib/i18n/index.js +1 -1
  157. package/lib/index.d.ts +1 -1
  158. package/lib/index.js +17 -17
  159. package/lib/main.js +1 -1
  160. package/lib/mocks/components/FlashMock.js +1 -1
  161. package/lib/mocks/components/index.js +1 -1
  162. package/lib/mocks/hooks/index.js +1 -1
  163. package/lib/mocks/hooks/rests/index.js +1 -1
  164. package/lib/mocks/hooks/useDatalayerMock.js +5 -5
  165. package/lib/mocks/index.js +5 -5
  166. package/lib/mocks/models/CourseMock.js +3 -3
  167. package/lib/mocks/models/InviteMock.js +2 -2
  168. package/lib/mocks/models/OrganisationMock.js +1 -1
  169. package/lib/mocks/models/SchoolMock.js +1 -1
  170. package/lib/mocks/models/SpaceMock.js +2 -2
  171. package/lib/mocks/models/TeamMock.js +1 -1
  172. package/lib/mocks/models/UserMock.js +1 -1
  173. package/lib/mocks/models/index.js +9 -9
  174. package/lib/mocks/views/ChartMock.js +3 -3
  175. package/lib/mocks/views/DashboardMock.js +2 -2
  176. package/lib/mocks/views/TableMock.js +1 -1
  177. package/lib/mocks/views/index.js +7 -7
  178. package/lib/models/Contact.js +3 -3
  179. package/lib/models/CreditsDTO.js +1 -1
  180. package/lib/models/Datasource.js +1 -1
  181. package/lib/models/EnvironmentDTO.d.ts +1 -1
  182. package/lib/models/EnvironmentDTO.js +2 -2
  183. package/lib/models/HealthCheck.js +1 -1
  184. package/lib/models/IAMProviderUsers.js +1 -1
  185. package/lib/models/Invite.js +1 -1
  186. package/lib/models/ItemDTO.js +1 -1
  187. package/lib/models/LexicalDTO.js +4 -4
  188. package/lib/models/NotebookDTO.js +4 -4
  189. package/lib/models/Organization.js +2 -2
  190. package/lib/models/Page.js +2 -2
  191. package/lib/models/ProjectDTO.d.ts +89 -0
  192. package/lib/models/ProjectDTO.js +131 -0
  193. package/lib/models/RuntimeDTO.js +2 -2
  194. package/lib/models/RuntimeSnapshotDTO.js +2 -2
  195. package/lib/models/Secret.js +1 -1
  196. package/lib/models/Space.d.ts +1 -1
  197. package/lib/models/Space.js +3 -3
  198. package/lib/models/SpaceDTO.d.ts +61 -0
  199. package/lib/models/SpaceDTO.js +9 -9
  200. package/lib/models/Team.js +2 -2
  201. package/lib/models/User.js +5 -5
  202. package/lib/models/UserDTO.js +1 -1
  203. package/lib/models/index.js +75 -75
  204. package/lib/navigation/components.js +1 -1
  205. package/lib/navigation/index.js +4 -4
  206. package/lib/otel/client/OtelClient.js +1 -1
  207. package/lib/otel/client/index.js +1 -1
  208. package/lib/otel/hooks/index.js +1 -1
  209. package/lib/otel/index.js +15 -15
  210. package/lib/otel/types.d.ts +1 -1
  211. package/lib/otel/views/OtelLive.js +11 -11
  212. package/lib/otel/views/OtelLogsList.js +1 -1
  213. package/lib/otel/views/OtelMetricsList.d.ts +2 -5
  214. package/lib/otel/views/OtelMetricsList.js +2 -2
  215. package/lib/otel/views/OtelSpanDetail.js +2 -2
  216. package/lib/otel/views/OtelSpanTree.js +1 -1
  217. package/lib/otel/views/OtelSqlView.js +1 -1
  218. package/lib/otel/views/OtelSystemView.js +1 -1
  219. package/lib/otel/views/OtelTimeline.js +1 -1
  220. package/lib/otel/views/OtelTracesList.js +1 -1
  221. package/lib/otel/views/index.d.ts +1 -0
  222. package/lib/otel/views/index.js +12 -12
  223. package/lib/routes/index.js +1 -1
  224. package/lib/services/DatalayerServiceManager.d.ts +1 -1
  225. package/lib/services/DatalayerServiceManager.js +4 -4
  226. package/lib/services/index.js +3 -3
  227. package/lib/state/State.js +13 -13
  228. package/lib/state/index.js +3 -3
  229. package/lib/state/storage/IAMStorage.js +31 -6
  230. package/lib/state/storage/index.js +1 -1
  231. package/lib/state/substates/CoreState.js +2 -2
  232. package/lib/state/substates/IAMState.js +5 -5
  233. package/lib/state/substates/RuntimesState.js +3 -3
  234. package/lib/state/substates/SurveysState.js +4 -4
  235. package/lib/state/substates/TeamState.js +1 -1
  236. package/lib/state/substates/index.js +14 -14
  237. package/lib/stateful/index.js +2 -2
  238. package/lib/stateful/jupyter/exec/Snippets.js +1 -1
  239. package/lib/stateful/jupyter/exec/index.js +2 -2
  240. package/lib/stateful/jupyter/index.js +2 -2
  241. package/lib/stateful/runtimes/actions.js +4 -4
  242. package/lib/stateful/runtimes/index.js +5 -5
  243. package/lib/stateful/runtimes/snapshots.js +1 -1
  244. package/lib/utils/Date.d.ts +11 -0
  245. package/lib/utils/Date.js +30 -0
  246. package/lib/utils/cli/index.js +1 -1
  247. package/lib/utils/index.js +29 -29
  248. package/lib/views/datasources/DatasourceDetail.js +3 -3
  249. package/lib/views/datasources/DatasourceNew.js +2 -2
  250. package/lib/views/datasources/Datasources.js +1 -1
  251. package/lib/views/datasources/index.js +3 -3
  252. package/lib/views/iam/SignInSimple.js +1 -1
  253. package/lib/views/iam/index.js +1 -1
  254. package/lib/views/iam-tokens/IAMTokenEdit.js +3 -3
  255. package/lib/views/iam-tokens/IAMTokenNew.js +2 -2
  256. package/lib/views/iam-tokens/IAMTokens.js +1 -1
  257. package/lib/views/iam-tokens/Tokens.js +1 -1
  258. package/lib/views/iam-tokens/index.js +3 -3
  259. package/lib/views/index.js +3 -3
  260. package/lib/views/otel/DashboardView.js +1 -1
  261. package/lib/views/otel/LogsView.js +1 -1
  262. package/lib/views/otel/MetricsView.js +1 -1
  263. package/lib/views/otel/OtelHeader.js +1 -1
  264. package/lib/views/otel/SqlView.js +1 -1
  265. package/lib/views/otel/SystemView.js +1 -1
  266. package/lib/views/otel/TracesView.js +1 -1
  267. package/lib/views/otel/index.js +8 -8
  268. package/lib/views/otel/simpleAuthStore.js +1 -1
  269. package/lib/views/profile/UserBadge.js +1 -1
  270. package/lib/views/profile/index.js +1 -1
  271. package/lib/views/secrets/SecretEdit.js +3 -3
  272. package/lib/views/secrets/SecretNew.js +2 -2
  273. package/lib/views/secrets/Secrets.js +1 -1
  274. package/lib/views/secrets/index.js +3 -3
  275. package/package.json +1 -1
package/lib/App.js CHANGED
@@ -6,8 +6,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
6
6
  import { useState } from 'react';
7
7
  import reactLogo from './assets/react.svg';
8
8
  import { useJupyter, JupyterReactTheme } from '@datalayer/jupyter-react';
9
- import { CellExample } from './examples/CellExample';
10
- import { NotebookExample } from './examples/NotebookExample';
9
+ import { CellExample } from './examples/CellExample.js';
10
+ import { NotebookExample } from './examples/NotebookExample.js';
11
11
  import './App.css';
12
12
  export function App() {
13
13
  const { serviceManager } = useJupyter({
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import { URLExt } from '@jupyterlab/coreutils';
12
12
  import axios from 'axios';
13
- import { sleep } from '../utils/Sleep';
13
+ import { sleep } from '../utils/Sleep.js';
14
14
  /**
15
15
  * Error wrapper for failed HTTP responses.
16
16
  * Includes response details, warnings, errors, and tracebacks.
@@ -121,6 +121,11 @@ export async function requestDatalayerAPI({ url, method, body, token, signal, he
121
121
  // CORS mode is handled automatically by axios
122
122
  // Cache control headers
123
123
  };
124
+ // In Vitest+jsdom, axios may pick the XHR adapter and fail with browser-like
125
+ // network restrictions. Force the fetch adapter for integration reliability.
126
+ if (typeof process !== 'undefined' && process.env.VITEST) {
127
+ axiosConfig.adapter = 'fetch';
128
+ }
124
129
  // Add cache control headers only for GET requests (equivalent to cache: 'no-store')
125
130
  if (method === 'GET' || !method) {
126
131
  if (!axiosConfig.headers['Cache-Control']) {
@@ -19,7 +19,7 @@ export declare const DEFAULT_SERVICE_URLS: {
19
19
  /** Default URL for OTEL (OpenTelemetry observability) service */
20
20
  readonly OTEL: "https://prod1.datalayer.run";
21
21
  /** Default URL for Runtimes service */
22
- readonly RUNTIMES: "https://prod1.datalayer.run";
22
+ readonly RUNTIMES: "https://r1.datalayer.run";
23
23
  /** Default URL for Spacer (workspaces and collaboration) service */
24
24
  readonly SPACER: "https://prod1.datalayer.run";
25
25
  };
@@ -23,7 +23,7 @@ export const DEFAULT_SERVICE_URLS = {
23
23
  /** Default URL for OTEL (OpenTelemetry observability) service */
24
24
  OTEL: 'https://prod1.datalayer.run',
25
25
  /** Default URL for Runtimes service */
26
- RUNTIMES: 'https://prod1.datalayer.run',
26
+ RUNTIMES: 'https://r1.datalayer.run',
27
27
  /** Default URL for Spacer (workspaces and collaboration) service */
28
28
  SPACER: 'https://prod1.datalayer.run',
29
29
  };
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * @module api/iam/authentication
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
14
- import { validateToken } from '../utils/validation';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
+ import { validateToken } from '../utils/validation.js';
15
15
  /**
16
16
  * Authenticate a user with credentials or token
17
17
  *
@@ -6,9 +6,9 @@
6
6
  * Datasources API functions.
7
7
  * @module api/iam/datasources
8
8
  */
9
- import { requestDatalayerAPI } from '../DatalayerApi';
10
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
11
- import { validateToken, validateRequiredString } from '../utils/validation';
9
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
10
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
11
+ import { validateToken, validateRequiredString } from '../utils/validation.js';
12
12
  /**
13
13
  * Create a new datasource.
14
14
  * Creates a new datasource configuration for the authenticated user.
@@ -9,8 +9,8 @@
9
9
  *
10
10
  * @module api/iam/healthz
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
14
  /**
15
15
  * Health check ping endpoint
16
16
  *
@@ -9,16 +9,16 @@
9
9
  *
10
10
  * @module api/iam
11
11
  */
12
- export * as authentication from './authentication';
13
- export * as oauth2 from './oauth2';
14
- export * as profile from './profile';
15
- export * as healthz from './healthz';
16
- export * as usage from './usage';
17
- export * as secrets from './secrets';
18
- export * as datasources from './datasources';
12
+ export * as authentication from './authentication.js';
13
+ export * as oauth2 from './oauth2.js';
14
+ export * as profile from './profile.js';
15
+ export * as healthz from './healthz.js';
16
+ export * as usage from './usage.js';
17
+ export * as secrets from './secrets.js';
18
+ export * as datasources from './datasources.js';
19
19
  // For backward compatibility, export the old API structure
20
- export { login, logout, checkAuth } from './authentication';
21
- export { getOAuth2AuthzUrl, getOAuth2AuthzUrlForLink, handleGitHubOAuth2Callback, handleLinkedInOAuth2Callback, handleOktaOAuth2Callback, } from './oauth2';
22
- export { me, whoami } from './profile';
23
- export { ping } from './healthz';
24
- export { getCredits } from './usage';
20
+ export { login, logout, checkAuth } from './authentication.js';
21
+ export { getOAuth2AuthzUrl, getOAuth2AuthzUrlForLink, handleGitHubOAuth2Callback, handleLinkedInOAuth2Callback, handleOktaOAuth2Callback, } from './oauth2.js';
22
+ export { me, whoami } from './profile.js';
23
+ export { ping } from './healthz.js';
24
+ export { getCredits } from './usage.js';
@@ -9,8 +9,8 @@
9
9
  *
10
10
  * @module api/iam/oauth2
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
14
  /**
15
15
  * Get the OAuth2 authorization URL for a specific provider
16
16
  * @param provider - OAuth2 provider (bluesky, github, linkedin, okta)
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * @module api/iam/profile
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
14
- import { validateToken } from '../utils/validation';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
+ import { validateToken } from '../utils/validation.js';
15
15
  /**
16
16
  * Get current authenticated user profile
17
17
  * @param token - Authentication token (required)
@@ -6,9 +6,9 @@
6
6
  * Secrets API functions.
7
7
  * @module api/secrets/secrets
8
8
  */
9
- import { requestDatalayerAPI } from '../DatalayerApi';
10
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
11
- import { validateToken, validateRequiredString } from '../utils/validation';
9
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
10
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
11
+ import { validateToken, validateRequiredString } from '../utils/validation.js';
12
12
  /**
13
13
  * Helper function to Base64 encode a value (cross-platform).
14
14
  * @param value - Plain text value to encode
@@ -9,8 +9,8 @@
9
9
  *
10
10
  * @module api/iam/credits
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
14
  /**
15
15
  * Get the current user's available credits and usage information.
16
16
  *
package/lib/api/index.js CHANGED
@@ -11,16 +11,16 @@
11
11
  * @module @datalayer/core/api
12
12
  */
13
13
  // Base client exports
14
- export { requestDatalayerAPI, RunResponseError, NetworkError, } from './DatalayerApi';
14
+ export { requestDatalayerAPI, RunResponseError, NetworkError, } from './DatalayerApi.js';
15
15
  // Domain-organized API exports
16
- export * as iam from './iam';
17
- export * as otel from './otel';
18
- export * as runtimes from './runtimes';
19
- export * as spacer from './spacer';
16
+ export * as iam from './iam/index.js';
17
+ export * as otel from './otel/index.js';
18
+ export * as runtimes from './runtimes/index.js';
19
+ export * as spacer from './spacer/index.js';
20
20
  /**
21
21
  * @deprecated Please import directly from '@datalayer/core/stateful' instead.
22
22
  * This module provides backward compatibility for the moved apiv1 modules.
23
23
  */
24
- export * from '../stateful/jupyter';
25
- export * from '../stateful/runtimes';
26
- export * from '../api/DatalayerApi';
24
+ export * from '../stateful/jupyter/index.js';
25
+ export * from '../stateful/runtimes/index.js';
26
+ export * from '../api/DatalayerApi.js';
@@ -9,8 +9,8 @@
9
9
  *
10
10
  * @module api/otel
11
11
  */
12
- export * as traces from './traces';
13
- export * as metrics from './metrics';
14
- export * as logs from './logs';
15
- export * as services from './services';
16
- export * as query from './query';
12
+ export * as traces from './traces.js';
13
+ export * as metrics from './metrics.js';
14
+ export * as logs from './logs.js';
15
+ export * as services from './services.js';
16
+ export * as query from './query.js';
@@ -7,9 +7,9 @@
7
7
  *
8
8
  * @module api/otel/logs
9
9
  */
10
- import { requestDatalayerAPI } from '../DatalayerApi';
11
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
- import { validateToken } from '../utils/validation';
10
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
11
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
12
+ import { validateToken } from '../utils/validation.js';
13
13
  /**
14
14
  * Query log records.
15
15
  *
@@ -7,9 +7,9 @@
7
7
  *
8
8
  * @module api/otel/metrics
9
9
  */
10
- import { requestDatalayerAPI } from '../DatalayerApi';
11
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
- import { validateToken } from '../utils/validation';
10
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
11
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
12
+ import { validateToken } from '../utils/validation.js';
13
13
  /**
14
14
  * List available metric names.
15
15
  *
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * @module api/otel/query
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
14
- import { validateToken } from '../utils/validation';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
+ import { validateToken } from '../utils/validation.js';
15
15
  /**
16
16
  * Execute an ad-hoc SQL query via the SQL Engine engine.
17
17
  *
@@ -7,9 +7,9 @@
7
7
  *
8
8
  * @module api/otel/services
9
9
  */
10
- import { requestDatalayerAPI } from '../DatalayerApi';
11
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
- import { validateToken } from '../utils/validation';
10
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
11
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
12
+ import { validateToken } from '../utils/validation.js';
13
13
  /**
14
14
  * List all observed service names.
15
15
  *
@@ -7,9 +7,9 @@
7
7
  *
8
8
  * @module api/otel/traces
9
9
  */
10
- import { requestDatalayerAPI } from '../DatalayerApi';
11
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
- import { validateToken } from '../utils/validation';
10
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
11
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
12
+ import { validateToken } from '../utils/validation.js';
13
13
  /**
14
14
  * List recent traces.
15
15
  *
@@ -10,9 +10,9 @@
10
10
  *
11
11
  * @module api/runtimes/checkpoints
12
12
  */
13
- import { requestDatalayerAPI } from '../DatalayerApi';
14
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
15
- import { validateToken, validateRequiredString } from '../utils/validation';
13
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
14
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
15
+ import { validateToken, validateRequiredString } from '../utils/validation.js';
16
16
  // ─── API Functions ─────────────────────────────────────────────────────────
17
17
  /**
18
18
  * List runtime checkpoints for a specific runtime.
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * @module api/runtimes/environments
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
14
- import { validateToken } from '../utils/validation';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
+ import { validateToken } from '../utils/validation.js';
15
15
  /**
16
16
  * List all available computing environments.
17
17
  * @param token - Authentication token
@@ -9,8 +9,8 @@
9
9
  *
10
10
  * @module api/runtimes/healthz
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
14
  /**
15
15
  * Health check ping endpoint for Runtimes service
16
16
  * @param baseUrl - Base URL for the API (defaults to production Runtimes URL)
@@ -9,8 +9,8 @@
9
9
  *
10
10
  * @module api/runtimes
11
11
  */
12
- export * as environments from './environments';
13
- export * as healthz from './healthz';
14
- export * as runtimes from './runtimes';
15
- export * as snapshots from './snapshots';
16
- export * as checkpoints from './checkpoints';
12
+ export * as environments from './environments.js';
13
+ export * as healthz from './healthz.js';
14
+ export * as runtimes from './runtimes.js';
15
+ export * as snapshots from './snapshots.js';
16
+ export * as checkpoints from './checkpoints.js';
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * @module api/runtimes/runtimes
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
14
- import { validateToken, validateRequiredString } from '../utils/validation';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
+ import { validateToken, validateRequiredString } from '../utils/validation.js';
15
15
  /**
16
16
  * Create a new runtime instance.
17
17
  * @param token - Authentication token
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * @module api/runtimes/snapshots
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
14
- import { validateToken, validateRequiredString } from '../utils/validation';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
+ import { validateToken, validateRequiredString } from '../utils/validation.js';
15
15
  /**
16
16
  * Create a snapshot of a runtime instance.
17
17
  * @param token - Authentication token
@@ -9,8 +9,8 @@
9
9
  *
10
10
  * @module api/spacer/documents
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
14
  /**
15
15
  * Get collaboration session ID for a document.
16
16
  *
@@ -9,8 +9,8 @@
9
9
  *
10
10
  * @module api/spacer/healthz
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
14
  /**
15
15
  * Health check ping endpoint for Spacer service
16
16
  * @param baseUrl - Base URL for the API (defaults to production Spacer URL)
@@ -10,10 +10,10 @@
10
10
  *
11
11
  * @module api/spacer
12
12
  */
13
- export * as documents from './documents';
14
- export * as healthz from './healthz';
15
- export * as items from './items';
16
- export * as lexicals from './lexicals';
17
- export * as notebooks from './notebooks';
18
- export * as spaces from './spaces';
19
- export * as users from './users';
13
+ export * as documents from './documents.js';
14
+ export * as healthz from './healthz.js';
15
+ export * as items from './items.js';
16
+ export * as lexicals from './lexicals.js';
17
+ export * as notebooks from './notebooks.js';
18
+ export * as spaces from './spaces.js';
19
+ export * as users from './users.js';
@@ -9,8 +9,8 @@
9
9
  *
10
10
  * @module api/spacer/items
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
14
  /**
15
15
  * Get the items of a space.
16
16
  * @param token - Authentication token
@@ -24,3 +24,11 @@ export declare const getLexical: (token: string, id: string, baseUrl?: string) =
24
24
  * @returns Promise resolving to the updated document response
25
25
  */
26
26
  export declare const updateLexical: (token: string, id: string, data: UpdateLexicalRequest, baseUrl?: string) => Promise<UpdateLexicalResponse>;
27
+ /**
28
+ * Clone a lexical document.
29
+ * @param token - Authentication token
30
+ * @param id - The document ID to clone
31
+ * @param baseUrl - Base URL for the API (defaults to production)
32
+ * @returns Promise resolving to the cloned document response
33
+ */
34
+ export declare const cloneLexical: (token: string, id: string, baseUrl?: string) => Promise<CreateLexicalResponse>;
@@ -9,8 +9,8 @@
9
9
  *
10
10
  * @module api/spacer/lexicals
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
14
  /**
15
15
  * Create a new lexical document.
16
16
  * @param token - Authentication token
@@ -73,3 +73,17 @@ export const updateLexical = async (token, id, data, baseUrl = DEFAULT_SERVICE_U
73
73
  body: data,
74
74
  });
75
75
  };
76
+ /**
77
+ * Clone a lexical document.
78
+ * @param token - Authentication token
79
+ * @param id - The document ID to clone
80
+ * @param baseUrl - Base URL for the API (defaults to production)
81
+ * @returns Promise resolving to the cloned document response
82
+ */
83
+ export const cloneLexical = async (token, id, baseUrl = DEFAULT_SERVICE_URLS.SPACER) => {
84
+ return requestDatalayerAPI({
85
+ url: `${baseUrl}${API_BASE_PATHS.SPACER}/lexicals/${id}/clone`,
86
+ method: 'POST',
87
+ token,
88
+ });
89
+ };
@@ -24,3 +24,11 @@ export declare const getNotebook: (token: string, id: string, baseUrl?: string)
24
24
  * @returns Promise resolving to the updated notebook response
25
25
  */
26
26
  export declare const updateNotebook: (token: string, id: string, data: UpdateNotebookRequest, baseUrl?: string) => Promise<UpdateNotebookResponse>;
27
+ /**
28
+ * Clone a notebook.
29
+ * @param token - Authentication token
30
+ * @param id - The notebook ID to clone
31
+ * @param baseUrl - Base URL for the API (defaults to production)
32
+ * @returns Promise resolving to the cloned notebook response
33
+ */
34
+ export declare const cloneNotebook: (token: string, id: string, baseUrl?: string) => Promise<CreateNotebookResponse>;
@@ -9,8 +9,8 @@
9
9
  *
10
10
  * @module api/spacer/notebooks
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
14
  /**
15
15
  * Create a new Jupyter notebook.
16
16
  * @param token - Authentication token
@@ -73,3 +73,17 @@ export const updateNotebook = async (token, id, data, baseUrl = DEFAULT_SERVICE_
73
73
  body: data,
74
74
  });
75
75
  };
76
+ /**
77
+ * Clone a notebook.
78
+ * @param token - Authentication token
79
+ * @param id - The notebook ID to clone
80
+ * @param baseUrl - Base URL for the API (defaults to production)
81
+ * @returns Promise resolving to the cloned notebook response
82
+ */
83
+ export const cloneNotebook = async (token, id, baseUrl = DEFAULT_SERVICE_URLS.SPACER) => {
84
+ return requestDatalayerAPI({
85
+ url: `${baseUrl}${API_BASE_PATHS.SPACER}/notebooks/${id}/clone`,
86
+ method: 'POST',
87
+ token,
88
+ });
89
+ };
@@ -1,4 +1,4 @@
1
- import { CreateSpaceRequest, CreateSpaceResponse } from '../../models/SpaceDTO';
1
+ import { CreateSpaceRequest, CreateSpaceResponse, GetSpaceResponse, UpdateSpaceRequest, UpdateSpaceResponse, DeleteSpaceResponse, GetSpaceDefaultItemsResponse, GetSpacesByTypeResponse } from '../../models/SpaceDTO';
2
2
  /**
3
3
  * Create a new workspace space.
4
4
  * @param token - Authentication token
@@ -7,3 +7,78 @@ import { CreateSpaceRequest, CreateSpaceResponse } from '../../models/SpaceDTO';
7
7
  * @returns Promise resolving to the created space response
8
8
  */
9
9
  export declare const createSpace: (token: string, data: CreateSpaceRequest, baseUrl?: string) => Promise<CreateSpaceResponse>;
10
+ /**
11
+ * Get a space by UID.
12
+ * @param token - Authentication token
13
+ * @param uid - Space UID
14
+ * @param baseUrl - Base URL for the API
15
+ * @returns Promise resolving to the space response
16
+ */
17
+ export declare const getSpace: (token: string, uid: string, baseUrl?: string) => Promise<GetSpaceResponse>;
18
+ /**
19
+ * Update a space (owner updating their own space).
20
+ * @param token - Authentication token
21
+ * @param uid - Space UID
22
+ * @param data - Update data (supports arbitrary Solr fields)
23
+ * @param baseUrl - Base URL for the API
24
+ * @returns Promise resolving to the updated space response
25
+ */
26
+ export declare const updateSpace: (token: string, uid: string, data: UpdateSpaceRequest, baseUrl?: string) => Promise<UpdateSpaceResponse>;
27
+ /**
28
+ * Update a user-specific space (e.g., org admin managing another user's space).
29
+ * @param token - Authentication token
30
+ * @param uid - Space UID
31
+ * @param userId - User ID
32
+ * @param data - Update data (supports arbitrary Solr fields)
33
+ * @param baseUrl - Base URL for the API
34
+ * @returns Promise resolving to the updated space response
35
+ */
36
+ export declare const updateUserSpace: (token: string, uid: string, userId: string, data: UpdateSpaceRequest, baseUrl?: string) => Promise<UpdateSpaceResponse>;
37
+ /**
38
+ * Delete a space and all its contents.
39
+ * @param token - Authentication token
40
+ * @param uid - Space UID
41
+ * @param baseUrl - Base URL for the API
42
+ * @returns Promise resolving to the delete response
43
+ */
44
+ export declare const deleteSpace: (token: string, uid: string, baseUrl?: string) => Promise<DeleteSpaceResponse>;
45
+ /**
46
+ * Get default items (notebook UID and document UID) for a space.
47
+ * @param token - Authentication token
48
+ * @param uid - Space UID
49
+ * @param baseUrl - Base URL for the API
50
+ * @returns Promise resolving to the default items response
51
+ */
52
+ export declare const getSpaceDefaultItems: (token: string, uid: string, baseUrl?: string) => Promise<GetSpaceDefaultItemsResponse>;
53
+ /**
54
+ * Get spaces by type (e.g., 'project', 'workspace', 'course').
55
+ * @param token - Authentication token
56
+ * @param type - Space type to filter by
57
+ * @param baseUrl - Base URL for the API
58
+ * @returns Promise resolving to the spaces response
59
+ */
60
+ export declare const getSpacesByType: (token: string, type: string, baseUrl?: string) => Promise<GetSpacesByTypeResponse>;
61
+ /**
62
+ * Make a space public.
63
+ * @param token - Authentication token
64
+ * @param uid - Space UID
65
+ * @param baseUrl - Base URL for the API
66
+ * @returns Promise resolving to the updated space response
67
+ */
68
+ export declare const makeSpacePublic: (token: string, uid: string, baseUrl?: string) => Promise<UpdateSpaceResponse>;
69
+ /**
70
+ * Make a space private.
71
+ * @param token - Authentication token
72
+ * @param uid - Space UID
73
+ * @param baseUrl - Base URL for the API
74
+ * @returns Promise resolving to the updated space response
75
+ */
76
+ export declare const makeSpacePrivate: (token: string, uid: string, baseUrl?: string) => Promise<UpdateSpaceResponse>;
77
+ /**
78
+ * Export a space and its contents.
79
+ * @param token - Authentication token
80
+ * @param uid - Space UID
81
+ * @param baseUrl - Base URL for the API
82
+ * @returns Promise resolving to the export data
83
+ */
84
+ export declare const exportSpace: (token: string, uid: string, baseUrl?: string) => Promise<any>;