@datalayer/core 1.0.12 → 1.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 (252) hide show
  1. package/lib/App.js +2 -2
  2. package/lib/api/DatalayerApi.js +1 -1
  3. package/lib/api/iam/authentication.js +3 -3
  4. package/lib/api/iam/datasources.js +3 -3
  5. package/lib/api/iam/healthz.js +2 -2
  6. package/lib/api/iam/index.js +12 -12
  7. package/lib/api/iam/oauth2.js +2 -2
  8. package/lib/api/iam/profile.js +3 -3
  9. package/lib/api/iam/secrets.js +3 -3
  10. package/lib/api/iam/usage.js +2 -2
  11. package/lib/api/index.js +8 -8
  12. package/lib/api/otel/index.js +5 -5
  13. package/lib/api/otel/logs.js +3 -3
  14. package/lib/api/otel/metrics.js +3 -3
  15. package/lib/api/otel/query.js +3 -3
  16. package/lib/api/otel/services.js +3 -3
  17. package/lib/api/otel/traces.js +3 -3
  18. package/lib/api/runtimes/checkpoints.js +3 -3
  19. package/lib/api/runtimes/environments.js +3 -3
  20. package/lib/api/runtimes/healthz.js +2 -2
  21. package/lib/api/runtimes/index.js +5 -5
  22. package/lib/api/runtimes/runtimes.js +3 -3
  23. package/lib/api/runtimes/snapshots.js +3 -3
  24. package/lib/api/spacer/documents.js +2 -2
  25. package/lib/api/spacer/healthz.js +2 -2
  26. package/lib/api/spacer/index.js +7 -7
  27. package/lib/api/spacer/items.js +2 -2
  28. package/lib/api/spacer/lexicals.js +2 -2
  29. package/lib/api/spacer/notebooks.js +2 -2
  30. package/lib/api/spacer/spaces.js +3 -3
  31. package/lib/api/spacer/users.js +3 -3
  32. package/lib/client/auth/AuthenticationManager.js +3 -3
  33. package/lib/client/auth/index.js +4 -4
  34. package/lib/client/auth/storage.js +1 -1
  35. package/lib/client/auth/strategies.js +3 -3
  36. package/lib/client/base.js +2 -2
  37. package/lib/client/index.js +19 -19
  38. package/lib/client/mixins/IAMMixin.js +10 -10
  39. package/lib/client/mixins/RuntimesMixin.js +7 -7
  40. package/lib/client/mixins/SpacerMixin.js +11 -11
  41. package/lib/client/utils/spacerUtils.js +3 -3
  42. package/lib/collaboration/DatalayerCollaborationProvider.js +1 -1
  43. package/lib/collaboration/index.js +2 -2
  44. package/lib/components/auth/Login.js +6 -6
  45. package/lib/components/auth/Login.stories.js +2 -2
  46. package/lib/components/auth/LoginToken.js +2 -2
  47. package/lib/components/auth/index.js +3 -3
  48. package/lib/components/avatars/BoringAvatar.stories.js +1 -1
  49. package/lib/components/avatars/UserProfileAvatar.js +2 -2
  50. package/lib/components/avatars/index.js +2 -2
  51. package/lib/components/banners/NoAutomationBanner.js +1 -1
  52. package/lib/components/banners/index.js +1 -1
  53. package/lib/components/buttons/DownloadCSVButton.js +1 -1
  54. package/lib/components/buttons/DownloadJsonButton.js +1 -1
  55. package/lib/components/buttons/index.js +5 -5
  56. package/lib/components/checkout/StripeCheckout.js +1 -1
  57. package/lib/components/checkout/index.js +1 -1
  58. package/lib/components/confetti/index.js +1 -1
  59. package/lib/components/context/OrganizationSelect.js +2 -2
  60. package/lib/components/context/SpaceSelect.js +2 -2
  61. package/lib/components/context/index.js +2 -2
  62. package/lib/components/display/DatalayerBox.js +1 -1
  63. package/lib/components/display/LiveRelativeTime.js +1 -1
  64. package/lib/components/display/NavLink.js +1 -1
  65. package/lib/components/display/index.js +14 -14
  66. package/lib/components/echarts/index.js +1 -1
  67. package/lib/components/flashes/FlashDisclaimer.js +2 -2
  68. package/lib/components/flashes/FlashGuest.js +4 -4
  69. package/lib/components/flashes/FlashSurveys.js +4 -4
  70. package/lib/components/flashes/FlashUnauthorized.js +1 -1
  71. package/lib/components/flashes/index.js +6 -6
  72. package/lib/components/flashes/surveys/index.js +2 -2
  73. package/lib/components/iam/ExternalTokenSilentLogin.js +3 -3
  74. package/lib/components/iam/index.js +1 -1
  75. package/lib/components/icons/index.js +1 -1
  76. package/lib/components/index.js +2 -2
  77. package/lib/components/labels/index.js +1 -1
  78. package/lib/components/landings/index.js +1 -1
  79. package/lib/components/navbar/NavigationVisbilityObserver.js +4 -4
  80. package/lib/components/navbar/SubdomainNavBar.js +5 -5
  81. package/lib/components/navbar/index.js +2 -2
  82. package/lib/components/nbgrader/index.js +1 -1
  83. package/lib/components/notebooks/index.js +2 -2
  84. package/lib/components/progress/ConsumptionBar.js +1 -1
  85. package/lib/components/progress/CreditsIndicator.js +2 -2
  86. package/lib/components/progress/index.js +6 -6
  87. package/lib/components/runtimes/RuntimeCellVariablesDialog.js +2 -2
  88. package/lib/components/runtimes/RuntimeLauncherDialog.js +9 -9
  89. package/lib/components/runtimes/RuntimePickerBase.js +3 -3
  90. package/lib/components/runtimes/RuntimePickerCell.js +8 -8
  91. package/lib/components/runtimes/RuntimePickerNotebook.js +6 -6
  92. package/lib/components/runtimes/RuntimeSimplePicker.js +3 -3
  93. package/lib/components/runtimes/index.js +11 -11
  94. package/lib/components/screencapture/ScreencaptureButton.js +3 -3
  95. package/lib/components/screencapture/index.js +2 -2
  96. package/lib/components/snapshots/RuntimeSnapshotMenu.js +4 -4
  97. package/lib/components/snapshots/index.js +1 -1
  98. package/lib/components/snippets/SnippetDialog.js +1 -1
  99. package/lib/components/snippets/index.js +1 -1
  100. package/lib/components/sparklines/Sparklines.js +5 -1
  101. package/lib/components/sparklines/dataProcessing.js +4 -0
  102. package/lib/components/sparklines/index.js +7 -3
  103. package/lib/components/sparklines/types.js +1 -1
  104. package/lib/components/storage/ContentsBrowser.js +3 -3
  105. package/lib/components/storage/index.js +2 -2
  106. package/lib/components/students/index.js +1 -1
  107. package/lib/components/subnav/SubNav.js +2 -2
  108. package/lib/components/subnav/index.js +1 -1
  109. package/lib/components/tables/index.js +1 -1
  110. package/lib/components/text-reveal/TextRevealAnimation.js +1 -1
  111. package/lib/components/text-reveal/index.js +1 -1
  112. package/lib/components/tokens/index.js +1 -1
  113. package/lib/components/toolbars/AssignmentEditorToolbar.js +1 -1
  114. package/lib/components/toolbars/DocumentEditorToolbar.js +1 -1
  115. package/lib/components/toolbars/index.js +3 -3
  116. package/lib/components/users/PeerIndicator.js +1 -1
  117. package/lib/components/users/index.js +1 -1
  118. package/lib/config/Configuration.js +1 -1
  119. package/lib/config/index.js +2 -2
  120. package/lib/config/integrations/index.js +1 -1
  121. package/lib/hooks/assets/index.js +1 -1
  122. package/lib/hooks/index.js +33 -33
  123. package/lib/hooks/layouts/LayoutBackdrop.js +2 -2
  124. package/lib/hooks/layouts/LayoutScreencapture.js +3 -3
  125. package/lib/hooks/layouts/index.js +2 -2
  126. package/lib/hooks/useAuthorization.js +3 -3
  127. package/lib/hooks/useBackdrop.js +2 -2
  128. package/lib/hooks/useCache.js +8 -8
  129. package/lib/hooks/useCellOutputshot.js +2 -2
  130. package/lib/hooks/useDatalayer.js +6 -6
  131. package/lib/hooks/useIAM.js +4 -4
  132. package/lib/hooks/useLocation.js +2 -2
  133. package/lib/hooks/useLocationHandles.js +3 -3
  134. package/lib/hooks/useNavigate.js +4 -4
  135. package/lib/hooks/useParams.js +2 -2
  136. package/lib/hooks/useProjects.js +1 -1
  137. package/lib/hooks/useRuntimes.js +1 -1
  138. package/lib/hooks/useScreencapture.js +1 -1
  139. package/lib/hooks/useToast.js +41 -5
  140. package/lib/hooks/useUpload.js +2 -2
  141. package/lib/hooks/useUser.js +1 -1
  142. package/lib/i18n/index.js +1 -1
  143. package/lib/index.js +16 -16
  144. package/lib/main.js +1 -1
  145. package/lib/mocks/components/FlashMock.js +1 -1
  146. package/lib/mocks/components/index.js +1 -1
  147. package/lib/mocks/hooks/index.js +1 -1
  148. package/lib/mocks/hooks/rests/index.js +1 -1
  149. package/lib/mocks/hooks/useDatalayerMock.js +5 -5
  150. package/lib/mocks/index.js +5 -5
  151. package/lib/mocks/models/CourseMock.js +3 -3
  152. package/lib/mocks/models/InviteMock.js +2 -2
  153. package/lib/mocks/models/OrganisationMock.js +1 -1
  154. package/lib/mocks/models/SchoolMock.js +1 -1
  155. package/lib/mocks/models/SpaceMock.js +2 -2
  156. package/lib/mocks/models/TeamMock.js +1 -1
  157. package/lib/mocks/models/UserMock.js +1 -1
  158. package/lib/mocks/models/index.js +9 -9
  159. package/lib/mocks/views/ChartMock.js +3 -3
  160. package/lib/mocks/views/DashboardMock.js +2 -2
  161. package/lib/mocks/views/TableMock.js +1 -1
  162. package/lib/mocks/views/index.js +7 -7
  163. package/lib/models/Contact.js +3 -3
  164. package/lib/models/CreditsDTO.js +1 -1
  165. package/lib/models/Datasource.js +1 -1
  166. package/lib/models/EnvironmentDTO.js +1 -1
  167. package/lib/models/HealthCheck.js +1 -1
  168. package/lib/models/IAMProviderUsers.js +1 -1
  169. package/lib/models/Invite.js +1 -1
  170. package/lib/models/ItemDTO.js +1 -1
  171. package/lib/models/LexicalDTO.js +4 -4
  172. package/lib/models/NotebookDTO.js +4 -4
  173. package/lib/models/Organization.js +2 -2
  174. package/lib/models/Page.js +2 -2
  175. package/lib/models/RuntimeDTO.js +2 -2
  176. package/lib/models/RuntimeSnapshotDTO.js +2 -2
  177. package/lib/models/Secret.js +1 -1
  178. package/lib/models/Space.js +3 -3
  179. package/lib/models/SpaceDTO.js +9 -9
  180. package/lib/models/Team.js +2 -2
  181. package/lib/models/User.js +5 -5
  182. package/lib/models/UserDTO.js +1 -1
  183. package/lib/models/index.js +75 -75
  184. package/lib/navigation/components.js +1 -1
  185. package/lib/navigation/index.js +4 -4
  186. package/lib/otel/client/OtelClient.js +1 -1
  187. package/lib/otel/client/index.js +1 -1
  188. package/lib/otel/hooks/index.js +1 -1
  189. package/lib/otel/index.js +15 -15
  190. package/lib/otel/views/OtelLive.js +11 -11
  191. package/lib/otel/views/OtelLogsList.js +1 -1
  192. package/lib/otel/views/OtelMetricsList.js +2 -2
  193. package/lib/otel/views/OtelSpanDetail.js +2 -2
  194. package/lib/otel/views/OtelSpanTree.js +1 -1
  195. package/lib/otel/views/OtelSqlView.js +1 -1
  196. package/lib/otel/views/OtelSystemView.js +1 -1
  197. package/lib/otel/views/OtelTimeline.js +1 -1
  198. package/lib/otel/views/OtelTracesList.js +1 -1
  199. package/lib/otel/views/index.js +12 -12
  200. package/lib/routes/index.js +1 -1
  201. package/lib/services/DatalayerServiceManager.js +3 -3
  202. package/lib/services/index.js +3 -3
  203. package/lib/state/State.js +13 -13
  204. package/lib/state/index.js +3 -3
  205. package/lib/state/storage/IAMStorage.js +2 -2
  206. package/lib/state/storage/index.js +1 -1
  207. package/lib/state/substates/CoreState.js +1 -1
  208. package/lib/state/substates/IAMState.js +5 -5
  209. package/lib/state/substates/RuntimesState.js +3 -3
  210. package/lib/state/substates/SurveysState.js +4 -4
  211. package/lib/state/substates/TeamState.js +1 -1
  212. package/lib/state/substates/index.js +14 -14
  213. package/lib/stateful/index.js +2 -2
  214. package/lib/stateful/jupyter/exec/Snippets.js +1 -1
  215. package/lib/stateful/jupyter/exec/index.js +2 -2
  216. package/lib/stateful/jupyter/index.js +2 -2
  217. package/lib/stateful/runtimes/actions.js +4 -4
  218. package/lib/stateful/runtimes/index.js +5 -5
  219. package/lib/stateful/runtimes/snapshots.js +1 -1
  220. package/lib/utils/Date.d.ts +11 -0
  221. package/lib/utils/Date.js +30 -0
  222. package/lib/utils/DownloadFile.d.ts +13 -0
  223. package/lib/utils/DownloadFile.js +20 -0
  224. package/lib/utils/cli/index.js +1 -1
  225. package/lib/utils/index.js +29 -29
  226. package/lib/views/datasources/DatasourceDetail.js +3 -3
  227. package/lib/views/datasources/DatasourceNew.js +2 -2
  228. package/lib/views/datasources/Datasources.js +1 -1
  229. package/lib/views/datasources/index.js +3 -3
  230. package/lib/views/iam/SignInSimple.js +9 -2
  231. package/lib/views/iam/index.js +1 -1
  232. package/lib/views/iam-tokens/IAMTokenEdit.js +3 -3
  233. package/lib/views/iam-tokens/IAMTokenNew.js +2 -2
  234. package/lib/views/iam-tokens/IAMTokens.js +1 -1
  235. package/lib/views/iam-tokens/Tokens.js +1 -1
  236. package/lib/views/iam-tokens/index.js +3 -3
  237. package/lib/views/index.js +3 -3
  238. package/lib/views/otel/DashboardView.js +1 -1
  239. package/lib/views/otel/LogsView.js +1 -1
  240. package/lib/views/otel/MetricsView.js +1 -1
  241. package/lib/views/otel/OtelHeader.js +1 -1
  242. package/lib/views/otel/SqlView.js +1 -1
  243. package/lib/views/otel/SystemView.js +1 -1
  244. package/lib/views/otel/TracesView.js +1 -1
  245. package/lib/views/otel/index.js +8 -8
  246. package/lib/views/profile/UserBadge.js +1 -1
  247. package/lib/views/profile/index.js +1 -1
  248. package/lib/views/secrets/SecretEdit.js +3 -3
  249. package/lib/views/secrets/SecretNew.js +2 -2
  250. package/lib/views/secrets/Secrets.js +1 -1
  251. package/lib/views/secrets/index.js +3 -3
  252. package/package.json +4 -4
@@ -5,11 +5,11 @@
5
5
  import { Poll } from '@lumino/polling';
6
6
  import { useStore } from 'zustand';
7
7
  import { createStore } from 'zustand/vanilla';
8
- import { ANONYMOUS_USER_TOKEN, ANONYMOUS_USER, asUser, IAMProvidersSpecs, } from '../../models';
9
- import { getStoredToken, getStoredUser, loadRefreshTokenFromCookie, storeToken, storeUser, } from '../storage';
10
- import { requestDatalayerAPI, } from '../../api/DatalayerApi';
11
- import { getCookie, setCookie, deleteCookie } from '../../utils';
12
- import { coreStore } from './CoreState';
8
+ import { ANONYMOUS_USER_TOKEN, ANONYMOUS_USER, asUser, IAMProvidersSpecs, } from '../../models/index.js';
9
+ import { getStoredToken, getStoredUser, loadRefreshTokenFromCookie, storeToken, storeUser, } from '../storage/index.js';
10
+ import { requestDatalayerAPI, } from '../../api/DatalayerApi.js';
11
+ import { getCookie, setCookie, deleteCookie } from '../../utils/index.js';
12
+ import { coreStore } from './CoreState.js';
13
13
  /**
14
14
  * Limit to warn about low credits in milliseconds.
15
15
  */
@@ -6,9 +6,9 @@ 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 '../../stateful/runtimes';
10
- import { coreStore } from './CoreState';
11
- import { iamStore } from './IAMState';
9
+ import { getRuntimes } from '../../stateful/runtimes/index.js';
10
+ import { coreStore } from './CoreState.js';
11
+ import { iamStore } from './IAMState.js';
12
12
  /**
13
13
  * Kernel store
14
14
  */
@@ -4,10 +4,10 @@
4
4
  */
5
5
  import { createStore } from 'zustand/vanilla';
6
6
  import { useStore } from 'zustand';
7
- import { requestDatalayerAPI, } from '../../api/DatalayerApi';
8
- import { asSurvey, } from '../../models';
9
- import { coreStore } from './CoreState';
10
- import { iamStore } from './IAMState';
7
+ import { requestDatalayerAPI, } from '../../api/DatalayerApi.js';
8
+ import { asSurvey, } from '../../models/index.js';
9
+ import { coreStore } from './CoreState.js';
10
+ import { iamStore } from './IAMState.js';
11
11
  export const surveysStore = createStore((set, get) => ({
12
12
  surveys: undefined,
13
13
  growthRunUrl: coreStore.getState().configuration?.growthRunUrl,
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { createStore } from 'zustand/vanilla';
6
6
  import { useStore } from 'zustand';
7
- import { TEAMS_MOCK } from '../../mocks';
7
+ import { TEAMS_MOCK } from '../../mocks/index.js';
8
8
  export const teamStore = createStore((set, get) => ({
9
9
  teams: TEAMS_MOCK,
10
10
  update: (teams) => set((state) => ({
@@ -2,17 +2,17 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export * from './CellState';
6
- export * from './CoreState';
7
- export * from './DatasourceState';
8
- export * from './DocumentState';
9
- export * from './GradeState';
10
- export * from './IAMState';
11
- export * from './JupyterLabState';
12
- export * from './LayoutState';
13
- export * from './NbformatState';
14
- export * from './OrganizationState';
15
- export * from './RuntimesState';
16
- export * from './SpaceState';
17
- export * from './SurveysState';
18
- export * from './TeamState';
5
+ export * from './CellState.js';
6
+ export * from './CoreState.js';
7
+ export * from './DatasourceState.js';
8
+ export * from './DocumentState.js';
9
+ export * from './GradeState.js';
10
+ export * from './IAMState.js';
11
+ export * from './JupyterLabState.js';
12
+ export * from './LayoutState.js';
13
+ export * from './NbformatState.js';
14
+ export * from './OrganizationState.js';
15
+ export * from './RuntimesState.js';
16
+ export * from './SpaceState.js';
17
+ export * from './SurveysState.js';
18
+ export * from './TeamState.js';
@@ -2,5 +2,5 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export * from './jupyter';
6
- export * from './runtimes';
5
+ export * from './jupyter/index.js';
6
+ export * from './runtimes/index.js';
@@ -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 * as Python from './Python';
5
+ import * as Python from './Python.js';
6
6
  /**
7
7
  * Facade to interact with kernels by requesting code execution.
8
8
  */
@@ -2,5 +2,5 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export * from './Python';
6
- export * from './Snippets';
5
+ export * from './Python.js';
6
+ export * from './Snippets.js';
@@ -2,5 +2,5 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export * from './exec';
6
- export * from './kernelsHandler';
5
+ export * from './exec/index.js';
6
+ export * from './kernelsHandler.js';
@@ -8,10 +8,10 @@
8
8
  import { URLExt } from '@jupyterlab/coreutils';
9
9
  import { PromiseDelegate } from '@lumino/coreutils';
10
10
  import { Upload } from 'tus-js-client';
11
- import { requestDatalayerAPI, } from '../../api';
12
- import { asRuntimeSnapshot } from '../../models';
13
- import { iamStore, runtimesStore } from '../../state';
14
- import { sleep } from '../../utils';
11
+ import { requestDatalayerAPI, } from '../../api/index.js';
12
+ import { asRuntimeSnapshot } from '../../models/index.js';
13
+ import { iamStore, runtimesStore } from '../../state/index.js';
14
+ import { sleep } from '../../utils/index.js';
15
15
  /**
16
16
  * Get available Environments.
17
17
  */
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export * from './actions';
6
- export * from './apis';
7
- export * from './settings';
8
- export * from './snapshots';
9
- export * from './utils';
5
+ export * from './actions.js';
6
+ export * from './apis.js';
7
+ export * from './settings.js';
8
+ export * from './snapshots.js';
9
+ export * from './utils.js';
@@ -3,7 +3,7 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  import { KernelExecutor } from '@datalayer/jupyter-react';
6
- import { createRuntimeSnapshotDownloadURL, uploadRuntimeSnapshot } from '.';
6
+ import { createRuntimeSnapshotDownloadURL, uploadRuntimeSnapshot } from './index.js';
7
7
  /**
8
8
  * Snapshot a runtime through the frontend and upload it to the cloud.
9
9
  *
@@ -6,3 +6,14 @@ export declare const timeSince: (date: Date) => string;
6
6
  * Examples: "just now", "15m ago", "3h ago", "2d ago", "4w ago", "1y ago".
7
7
  */
8
8
  export declare const formatRelativeTime: (value?: Date | string | number, now?: Date) => string | undefined;
9
+ /**
10
+ * Format a duration in milliseconds into a human-readable string.
11
+ *
12
+ * Examples:
13
+ * - 500 → "< 1s"
14
+ * - 1500 → "1s"
15
+ * - 65000 → "1m 5s"
16
+ * - 3661000 → "1h 1m 1s"
17
+ * - 90061000 → "1d 1h 1m"
18
+ */
19
+ export declare const formatDurationMs: (ms: number) => string;
package/lib/utils/Date.js CHANGED
@@ -95,3 +95,33 @@ export const formatRelativeTime = (value, now = new Date()) => {
95
95
  const years = Math.floor(days / 365);
96
96
  return `${years}y ago`;
97
97
  };
98
+ /**
99
+ * Format a duration in milliseconds into a human-readable string.
100
+ *
101
+ * Examples:
102
+ * - 500 → "< 1s"
103
+ * - 1500 → "1s"
104
+ * - 65000 → "1m 5s"
105
+ * - 3661000 → "1h 1m 1s"
106
+ * - 90061000 → "1d 1h 1m"
107
+ */
108
+ export const formatDurationMs = (ms) => {
109
+ const clamped = Math.max(0, ms);
110
+ const totalSeconds = Math.floor(clamped / 1000);
111
+ if (totalSeconds < 1)
112
+ return '< 1s';
113
+ const days = Math.floor(totalSeconds / 86400);
114
+ const hours = Math.floor((totalSeconds % 86400) / 3600);
115
+ const minutes = Math.floor((totalSeconds % 3600) / 60);
116
+ const seconds = totalSeconds % 60;
117
+ const parts = [];
118
+ if (days > 0)
119
+ parts.push(`${days}d`);
120
+ if (hours > 0)
121
+ parts.push(`${hours}h`);
122
+ if (minutes > 0)
123
+ parts.push(`${minutes}m`);
124
+ if (seconds > 0 && days === 0)
125
+ parts.push(`${seconds}s`);
126
+ return parts.join(' ') || '< 1s';
127
+ };
@@ -7,4 +7,17 @@
7
7
  * .zip ZIP archive application/zip
8
8
  */
9
9
  export declare const downloadFile: (data: any, filename: string, mime?: any, bom?: any) => void;
10
+ export type TextDownloadPayload = {
11
+ content: string;
12
+ filename: string;
13
+ mime: string;
14
+ };
15
+ /**
16
+ * Create a generic markdown text payload for file downloads.
17
+ */
18
+ export declare const createMarkdownDownloadPayload: (content: string, fileStem: string) => TextDownloadPayload;
19
+ /**
20
+ * Download a text payload produced by a helper such as createMarkdownDownloadPayload.
21
+ */
22
+ export declare const downloadTextPayload: (payload: TextDownloadPayload, withBom?: boolean) => void;
10
23
  export default downloadFile;
@@ -35,4 +35,24 @@ export const downloadFile = (data, filename, mime, bom) => {
35
35
  window.URL.revokeObjectURL(blobURL);
36
36
  }, 200);
37
37
  };
38
+ const sanitizeFileStem = (value) => value
39
+ .trim()
40
+ .replace(/\s+/g, '-')
41
+ .replace(/[^a-zA-Z0-9-_]/g, '-')
42
+ .replace(/-+/g, '-')
43
+ .replace(/^-+|-+$/g, '') || 'download';
44
+ /**
45
+ * Create a generic markdown text payload for file downloads.
46
+ */
47
+ export const createMarkdownDownloadPayload = (content, fileStem) => ({
48
+ content,
49
+ filename: `${sanitizeFileStem(fileStem)}.md`,
50
+ mime: 'text/markdown;charset=utf-8',
51
+ });
52
+ /**
53
+ * Download a text payload produced by a helper such as createMarkdownDownloadPayload.
54
+ */
55
+ export const downloadTextPayload = (payload, withBom = true) => {
56
+ downloadFile(payload.content, payload.filename, payload.mime, withBom ? '\uFEFF' : undefined);
57
+ };
38
58
  export default downloadFile;
@@ -5,4 +5,4 @@
5
5
  /**
6
6
  * CLI utilities
7
7
  */
8
- export * from './query';
8
+ export * from './query.js';
@@ -2,32 +2,32 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export * from './Array';
6
- export * from './Avatar';
7
- export * from './Browser';
8
- export * from './cli';
9
- export * from './Cookie';
10
- export * from './Cells';
11
- export * from './Date';
12
- export * from './Download';
13
- export * from './DownloadFile';
14
- export * from './Env';
15
- export * from './File';
16
- export * from './Format';
17
- export * from './Ids';
18
- export * from './Jwt';
19
- export * from './Jupyter';
20
- export * from './Lazy';
21
- export * from './Msc';
22
- export * from './Name';
23
- export * from './Notebook';
24
- export * from './Number';
25
- export * from './Plots';
26
- export * from './Random';
27
- // export * from './Screencapture'; Do not export html2canvas for now.
28
- export * from './Sleep';
29
- export * from './Snapshot';
30
- export * from './String';
31
- export * from './Uri';
32
- export * from './Validator';
33
- export * from './WithSuspense';
5
+ export * from './Array.js';
6
+ export * from './Avatar.js';
7
+ export * from './Browser.js';
8
+ export * from './cli/index.js';
9
+ export * from './Cookie.js';
10
+ export * from './Cells.js';
11
+ export * from './Date.js';
12
+ export * from './Download.js';
13
+ export * from './DownloadFile.js';
14
+ export * from './Env.js';
15
+ export * from './File.js';
16
+ export * from './Format.js';
17
+ export * from './Ids.js';
18
+ export * from './Jwt.js';
19
+ export * from './Jupyter.js';
20
+ export * from './Lazy.js';
21
+ export * from './Msc.js';
22
+ export * from './Name.js';
23
+ export * from './Notebook.js';
24
+ export * from './Number.js';
25
+ export * from './Plots.js';
26
+ export * from './Random.js';
27
+ // export * from './Screencapture.js'; Do not export html2canvas for now.
28
+ export * from './Sleep.js';
29
+ export * from './Snapshot.js';
30
+ export * from './String.js';
31
+ export * from './Uri.js';
32
+ export * from './Validator.js';
33
+ export * from './WithSuspense.js';
@@ -8,9 +8,9 @@ import { useParams } from 'react-router-dom';
8
8
  import { PageHeader, Heading, Text, Button, TextInput, FormControl, Textarea, Label, } from '@primer/react';
9
9
  import { Box } from '@datalayer/primer-addons';
10
10
  import { EyeIcon, EyeClosedIcon } from '@primer/octicons-react';
11
- import { BoringAvatar } from '../../components/avatars';
12
- import { useCache, useToast } from '../../hooks';
13
- import { useRunStore } from '../../state';
11
+ import { BoringAvatar } from '../../components/avatars/index.js';
12
+ import { useCache, useToast } from '../../hooks/index.js';
13
+ import { useRunStore } from '../../state/index.js';
14
14
  export const DatasourceDetail = () => {
15
15
  const { datasourceId } = useParams();
16
16
  const runStore = useRunStore();
@@ -6,8 +6,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
6
6
  import { useEffect, useState } from 'react';
7
7
  import { PageHeader, FormControl, Button, TextInput, Text, Textarea, Select, Flash, Link, } from '@primer/react';
8
8
  import { Box } from '@datalayer/primer-addons';
9
- import { useCache, useNavigate, useToast } from '../../hooks';
10
- import { useRunStore } from '../../state';
9
+ import { useCache, useNavigate, useToast } from '../../hooks/index.js';
10
+ import { useRunStore } from '../../state/index.js';
11
11
  export const DatasourceNew = ({ datasourcesListRoute = '/settings/integrations/datasources', secretsRoute = '/settings/iam/secrets', } = {}) => {
12
12
  const runStore = useRunStore();
13
13
  const { useCreateDatasource } = useCache();
@@ -8,7 +8,7 @@ import { PageLayout, Button, IconButton, Text, Label } from '@primer/react';
8
8
  import { Blankslate, PageHeader, Table, DataTable, } from '@primer/react/experimental';
9
9
  import { Box } from '@datalayer/primer-addons';
10
10
  import { EditIcon } from '@datalayer/icons-react';
11
- import { useCache, useNavigate } from '../../hooks';
11
+ import { useCache, useNavigate } from '../../hooks/index.js';
12
12
  const DatasourcesTable = ({ datasourcesListRoute, }) => {
13
13
  const { useDatasources } = useCache();
14
14
  const datasourcesQuery = useDatasources();
@@ -2,6 +2,6 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export * from './DatasourceDetail';
6
- export * from './DatasourceNew';
7
- export * from './Datasources';
5
+ export * from './DatasourceDetail.js';
6
+ export * from './DatasourceNew.js';
7
+ export * from './Datasources.js';
@@ -12,12 +12,19 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
12
12
  *
13
13
  * @module views/signin
14
14
  */
15
- import { useState, useCallback, useRef } from 'react';
15
+ import { useState, useCallback, useRef, useMemo } from 'react';
16
16
  import { Box, Button, FormControl, Heading, Text, Textarea, TextInput, } from '@primer/react';
17
17
  import { Dialog } from '@primer/react/experimental';
18
18
  import { EyeIcon, EyeClosedIcon, KeyIcon, TelescopeIcon, } from '@primer/octicons-react';
19
+ import { coreStore } from '../../state/index.js';
19
20
  // ── Component ────────────────────────────────────────────────────────
20
- export const SignInSimple = ({ onSignIn, onApiKeySignIn, loginUrl = '/api/iam/v1/login', title = 'Datalayer OTEL', description = 'Sign in to access the observability dashboard.', leadingIcon = _jsx(TelescopeIcon, { size: 24 }), }) => {
21
+ export const SignInSimple = ({ onSignIn, onApiKeySignIn, loginUrl: loginUrlProp, title = 'Datalayer OTEL', description = 'Sign in to access the observability dashboard.', leadingIcon = _jsx(TelescopeIcon, { size: 24 }), }) => {
22
+ const loginUrl = useMemo(() => {
23
+ if (loginUrlProp)
24
+ return loginUrlProp;
25
+ const iamRunUrl = coreStore.getState().configuration?.iamRunUrl;
26
+ return iamRunUrl ? `${iamRunUrl}/api/iam/v1/login` : '/api/iam/v1/login';
27
+ }, [loginUrlProp]);
21
28
  const [handle, setHandle] = useState('');
22
29
  const [password, setPassword] = useState('');
23
30
  const [showPassword, setShowPassword] = useState(false);
@@ -2,4 +2,4 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export { SignInSimple } from './SignInSimple';
5
+ export { SignInSimple } from './SignInSimple.js';
@@ -7,9 +7,9 @@ import { useState, useEffect } from 'react';
7
7
  import { useParams } from 'react-router-dom';
8
8
  import { PageHeader, Heading, Text, Button, TextInput, FormControl, Textarea, Label, } from '@primer/react';
9
9
  import { Box } from '@datalayer/primer-addons';
10
- import { BoringAvatar } from '../../components/avatars';
11
- import { useCache, useNavigate, useToast } from '../../hooks';
12
- import { useRunStore } from '../../state';
10
+ import { BoringAvatar } from '../../components/avatars/index.js';
11
+ import { useCache, useNavigate, useToast } from '../../hooks/index.js';
12
+ import { useRunStore } from '../../state/index.js';
13
13
  export const IAMTokenEdit = ({ tokensListRoute = '/settings/iam/tokens', } = {}) => {
14
14
  const { tokenId } = useParams();
15
15
  const runStore = useRunStore();
@@ -8,8 +8,8 @@ import { PageHeader, FormControl, Button, TextInput, Textarea, Select, Text, Ico
8
8
  import { Box } from '@datalayer/primer-addons';
9
9
  import { CopyIcon } from '@primer/octicons-react';
10
10
  import { Calendar, defaultCalendarStrings } from '@fluentui/react';
11
- import { useCache, useNavigate, useToast } from '../../hooks';
12
- import { useRunStore } from '../../state';
11
+ import { useCache, useNavigate, useToast } from '../../hooks/index.js';
12
+ import { useRunStore } from '../../state/index.js';
13
13
  export const IAMTokenNew = ({ tokensListRoute = '/settings/iam/tokens', } = {}) => {
14
14
  const runStore = useRunStore();
15
15
  const { useCreateToken } = useCache();
@@ -9,7 +9,7 @@ import { Blankslate, PageHeader, Table, DataTable, } from '@primer/react/experim
9
9
  import { Box } from '@datalayer/primer-addons';
10
10
  import { EditIcon } from '@datalayer/icons-react';
11
11
  import { TrashIcon } from '@primer/octicons-react';
12
- import { useCache, useNavigate, useToast } from '../../hooks';
12
+ import { useCache, useNavigate, useToast } from '../../hooks/index.js';
13
13
  const TokensTable = ({ tokensListRoute, showTitle = true, }) => {
14
14
  const { useTokens, useDeleteToken } = useCache();
15
15
  const { enqueueToast } = useToast();
@@ -9,7 +9,7 @@ import { Blankslate, PageHeader, Table, DataTable, } from '@primer/react/experim
9
9
  import { Box } from '@datalayer/primer-addons';
10
10
  import { EditIcon } from '@datalayer/icons-react';
11
11
  import { TrashIcon } from '@primer/octicons-react';
12
- import { useCache, useNavigate, useToast } from '../../hooks';
12
+ import { useCache, useNavigate, useToast } from '../../hooks/index.js';
13
13
  const TokensTable = () => {
14
14
  const { useTokens, useDeleteToken } = useCache();
15
15
  const { enqueueToast } = useToast();
@@ -2,6 +2,6 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export * from './IAMTokenEdit';
6
- export * from './IAMTokenNew';
7
- export * from './IAMTokens';
5
+ export * from './IAMTokenEdit.js';
6
+ export * from './IAMTokenNew.js';
7
+ export * from './IAMTokens.js';
@@ -2,6 +2,6 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export * from './iam';
6
- export * from './profile';
7
- export * from './otel';
5
+ export * from './iam/index.js';
6
+ export * from './profile/index.js';
7
+ export * from './otel/index.js';
@@ -1,4 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Box } from '@primer/react';
3
- import { OtelLive } from '../../otel';
3
+ import { OtelLive } from '../../otel/index.js';
4
4
  export const DashboardView = ({ baseUrl = '', wsBaseUrl, token, autoRefreshMs = 5000, defaultSignal = 'traces', limit = 200, onSignalRef, }) => (_jsx(Box, { sx: { display: 'flex', flex: 1, minHeight: 0, overflow: 'hidden' }, children: _jsx(OtelLive, { baseUrl: baseUrl, wsBaseUrl: wsBaseUrl, token: token, autoRefreshMs: autoRefreshMs, defaultSignal: defaultSignal, limit: limit, onSignalRef: onSignalRef }) }));
@@ -1,4 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Box } from '@primer/react';
3
- import { OtelLive } from '../../otel';
3
+ import { OtelLive } from '../../otel/index.js';
4
4
  export const LogsView = ({ baseUrl = '', token, autoRefreshMs = 5000, limit = 200, }) => (_jsx(Box, { sx: { display: 'flex', flex: 1, minHeight: 0, overflow: 'hidden' }, children: _jsx(OtelLive, { baseUrl: baseUrl, token: token, autoRefreshMs: autoRefreshMs, defaultSignal: "logs", limit: limit }) }));
@@ -1,4 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Box } from '@primer/react';
3
- import { OtelLive } from '../../otel';
3
+ import { OtelLive } from '../../otel/index.js';
4
4
  export const MetricsView = ({ baseUrl = '', token, autoRefreshMs = 5000, limit = 200, }) => (_jsx(Box, { sx: { display: 'flex', flex: 1, minHeight: 0, overflow: 'hidden' }, children: _jsx(OtelLive, { baseUrl: baseUrl, token: token, autoRefreshMs: autoRefreshMs, defaultSignal: "metrics", limit: limit }) }));
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
13
13
  import { useState, useCallback, useRef } from 'react';
14
14
  import { Box, Text, Button, Dialog } from '@primer/react';
15
15
  import { TelescopeIcon, SignOutIcon } from '@primer/octicons-react';
16
- import { UserBadge } from '../profile';
16
+ import { UserBadge } from '../profile/index.js';
17
17
  export const OtelHeader = ({ baseUrl = '', token, trailing, onNavigate, onSignOut, showGenerateButtons = true, }) => {
18
18
  const [dialogOpen, setDialogOpen] = useState(false);
19
19
  const [dialogTitle, setDialogTitle] = useState('');
@@ -1,4 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Box } from '@primer/react';
3
- import { OtelSqlView } from '../../otel';
3
+ import { OtelSqlView } from '../../otel/index.js';
4
4
  export const SqlView = ({ baseUrl = '', token }) => (_jsx(Box, { sx: { display: 'flex', flex: 1, minHeight: 0, overflow: 'hidden' }, children: _jsx(OtelSqlView, { baseUrl: baseUrl, token: token }) }));
@@ -1,4 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Box } from '@primer/react';
3
- import { OtelSystemView } from '../../otel';
3
+ import { OtelSystemView } from '../../otel/index.js';
4
4
  export const SystemView = ({ baseUrl = '', token, }) => (_jsx(Box, { sx: { display: 'flex', flex: 1, minHeight: 0, overflow: 'hidden' }, children: _jsx(OtelSystemView, { baseUrl: baseUrl, token: token }) }));
@@ -1,4 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Box } from '@primer/react';
3
- import { OtelLive } from '../../otel';
3
+ import { OtelLive } from '../../otel/index.js';
4
4
  export const TracesView = ({ baseUrl = '', token, autoRefreshMs = 5000, limit = 200, }) => (_jsx(Box, { sx: { display: 'flex', flex: 1, minHeight: 0, overflow: 'hidden' }, children: _jsx(OtelLive, { baseUrl: baseUrl, token: token, autoRefreshMs: autoRefreshMs, defaultSignal: "traces", limit: limit }) }));
@@ -2,11 +2,11 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export { DashboardView } from './DashboardView';
6
- export { TracesView } from './TracesView';
7
- export { LogsView } from './LogsView';
8
- export { MetricsView } from './MetricsView';
9
- export { SqlView } from './SqlView';
10
- export { SystemView } from './SystemView';
11
- export { OtelHeader } from './OtelHeader';
12
- export { useSimpleAuthStore } from './simpleAuthStore';
5
+ export { DashboardView } from './DashboardView.js';
6
+ export { TracesView } from './TracesView.js';
7
+ export { LogsView } from './LogsView.js';
8
+ export { MetricsView } from './MetricsView.js';
9
+ export { SqlView } from './SqlView.js';
10
+ export { SystemView } from './SystemView.js';
11
+ export { OtelHeader } from './OtelHeader.js';
12
+ export { useSimpleAuthStore } from './simpleAuthStore.js';
@@ -16,7 +16,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
16
16
  */
17
17
  import { useState, useRef, useCallback } from 'react';
18
18
  import { Box, Text } from '@primer/react';
19
- import { parseJwtPayload, getDatalayerJwtUser, getDatalayerDisplayName, } from '../../utils/Jwt';
19
+ import { parseJwtPayload, getDatalayerJwtUser, getDatalayerDisplayName, } from '../../utils/Jwt.js';
20
20
  // ── Component ─────────────────────────────────────────────────────
21
21
  export const UserBadge = ({ token, variant = 'full', }) => {
22
22
  const [open, setOpen] = useState(false);
@@ -2,4 +2,4 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export { UserBadge } from './UserBadge';
5
+ export { UserBadge } from './UserBadge.js';
@@ -8,9 +8,9 @@ import { useParams } from 'react-router-dom';
8
8
  import { PageHeader, Heading, Text, Button, TextInput, FormControl, Textarea, Label, } from '@primer/react';
9
9
  import { Box } from '@datalayer/primer-addons';
10
10
  import { EyeIcon, EyeClosedIcon } from '@primer/octicons-react';
11
- import { BoringAvatar } from '../../components/avatars';
12
- import { useCache, useNavigate, useToast } from '../../hooks';
13
- import { useRunStore } from '../../state';
11
+ import { BoringAvatar } from '../../components/avatars/index.js';
12
+ import { useCache, useNavigate, useToast } from '../../hooks/index.js';
13
+ import { useRunStore } from '../../state/index.js';
14
14
  export const SecretEdit = () => {
15
15
  const { secretId } = useParams();
16
16
  const runStore = useRunStore();
@@ -6,8 +6,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  import { useEffect, useState } from 'react';
7
7
  import { PageHeader, FormControl, Button, TextInput, Textarea, Select, } from '@primer/react';
8
8
  import { Box } from '@datalayer/primer-addons';
9
- import { useCache, useNavigate, useToast } from '../../hooks';
10
- import { useRunStore } from '../../state';
9
+ import { useCache, useNavigate, useToast } from '../../hooks/index.js';
10
+ import { useRunStore } from '../../state/index.js';
11
11
  export const SecretNew = () => {
12
12
  const runStore = useRunStore();
13
13
  const navigate = useNavigate();
@@ -8,7 +8,7 @@ import { PageLayout, Button, IconButton, Text, Label } from '@primer/react';
8
8
  import { Blankslate, PageHeader, Table, DataTable, } from '@primer/react/experimental';
9
9
  import { Box } from '@datalayer/primer-addons';
10
10
  import { EditIcon } from '@datalayer/icons-react';
11
- import { useCache, useNavigate } from '../../hooks';
11
+ import { useCache, useNavigate } from '../../hooks/index.js';
12
12
  const SecretsTable = () => {
13
13
  const { useSecrets } = useCache();
14
14
  const secretsQuery = useSecrets();