@datalayer/core 1.0.25 → 1.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -26
- package/lib/api/index.d.ts +0 -9
- package/lib/api/index.js +0 -9
- package/lib/cli-login.js +167 -0
- package/lib/client/base.d.ts +0 -3
- package/lib/client/base.js +0 -2
- package/lib/client/index.d.ts +10 -98
- package/lib/client/index.js +12 -21
- package/lib/components/avatars/UserAvatar.d.ts +16 -0
- package/lib/components/avatars/UserAvatar.js +47 -0
- package/lib/components/avatars/index.d.ts +1 -0
- package/lib/components/avatars/index.js +1 -0
- package/lib/components/billing/BillableAccountSelect.js +4 -0
- package/lib/components/billing/index.js +4 -0
- package/lib/components/context/index.d.ts +0 -1
- package/lib/components/context/index.js +0 -1
- package/lib/components/display/DisplayHandle.d.ts +12 -0
- package/lib/components/display/DisplayHandle.js +11 -0
- package/lib/components/display/LiveRelativeTime.js +4 -0
- package/lib/components/display/index.d.ts +1 -0
- package/lib/components/display/index.js +1 -0
- package/lib/components/flashes/index.d.ts +0 -1
- package/lib/components/flashes/index.js +0 -1
- package/lib/components/index.d.ts +0 -1
- package/lib/components/index.js +0 -1
- package/lib/components/principal/Principal.d.ts +7 -0
- package/lib/components/principal/Principal.js +153 -16
- package/lib/components/principal/PrincipalAvatar.d.ts +1 -1
- package/lib/components/principal/PrincipalAvatar.js +4 -28
- package/lib/components/principal/PrincipalBadge.js +4 -4
- package/lib/components/principal/PrincipalDetailsOverlay.d.ts +4 -2
- package/lib/components/principal/PrincipalDetailsOverlay.js +27 -7
- package/lib/components/principal/PrincipalSwitcherMenu.js +76 -39
- package/lib/components/progress/index.d.ts +0 -1
- package/lib/components/progress/index.js +0 -1
- package/lib/components/sharing/ShareAccessComponent.d.ts +3 -2
- package/lib/components/sharing/ShareAccessComponent.js +180 -133
- package/lib/components/sharing/SharingEditor.js +4 -0
- package/lib/components/snippets/index.d.ts +1 -1
- package/lib/components/snippets/index.js +1 -1
- package/lib/components/students/StudentResultCircle.d.ts +21 -0
- package/lib/components/students/StudentResultCircle.js +59 -0
- package/lib/components/students/index.d.ts +1 -1
- package/lib/components/students/index.js +1 -1
- package/lib/components/time/LiveRelativeTime.js +4 -0
- package/lib/components/time/index.js +4 -0
- package/lib/components/timeline/index.js +4 -0
- package/lib/components/tokens/index.d.ts +1 -1
- package/lib/components/tokens/index.js +1 -1
- package/lib/components/toolbars/index.d.ts +1 -3
- package/lib/components/toolbars/index.js +1 -3
- package/lib/hooks/cacheConverters.d.ts +21 -0
- package/lib/hooks/cacheConverters.js +110 -0
- package/lib/hooks/index.d.ts +0 -2
- package/lib/hooks/index.js +0 -2
- package/lib/hooks/useCache.d.ts +64 -35
- package/lib/hooks/useCache.js +407 -52
- package/lib/hooks/useDatalayer.js +3 -1
- package/lib/hooks/useIAM.js +1 -3
- package/lib/hooks/useLocationHandles.d.ts +3 -1
- package/lib/hooks/useLocationHandles.js +2 -1
- package/lib/hooks/usePrincipalStore.d.ts +2 -2
- package/lib/hooks/usePrincipalStore.js +97 -14
- package/lib/hooks/useSelectedPrincipal.js +1 -1
- package/lib/hooks/useUser.js +19 -2
- package/lib/index.d.ts +1 -6
- package/lib/index.js +1 -13
- package/lib/main.js +3 -3
- package/lib/mocks/index.js +1 -1
- package/lib/mocks/models/index.d.ts +0 -1
- package/lib/mocks/models/index.js +0 -1
- package/lib/models/Datasource.d.ts +2 -2
- package/lib/models/IAM.d.ts +1 -1
- package/lib/models/School.d.ts +12 -3
- package/lib/models/Secret.d.ts +2 -2
- package/lib/models/Student.d.ts +13 -3
- package/lib/models/Usage.d.ts +11 -1
- package/lib/models/UserDTO.d.ts +2 -2
- package/lib/models/index.d.ts +0 -30
- package/lib/models/index.js +0 -30
- package/lib/routes/index.d.ts +1 -0
- package/lib/routes/index.js +1 -0
- package/lib/routes/publicPaths.d.ts +23 -0
- package/lib/routes/publicPaths.js +74 -0
- package/lib/state/State.d.ts +0 -12
- package/lib/state/State.js +0 -12
- package/lib/state/substates/LayoutState.d.ts +12 -1
- package/lib/state/substates/index.d.ts +0 -7
- package/lib/state/substates/index.js +0 -7
- package/lib/utils/Handles.js +3 -1
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -1
- package/lib/views/api-keys/APIKeys.js +12 -3
- package/lib/views/datasources/DatasourceDetail.d.ts +1 -1
- package/lib/views/datasources/DatasourceNew.d.ts +1 -1
- package/lib/views/datasources/Datasources.d.ts +1 -1
- package/lib/views/datasources/Datasources.js +12 -3
- package/lib/views/iam/SignInSimple.d.ts +37 -1
- package/lib/views/iam/SignInSimple.js +110 -12
- package/package.json +5 -3
- package/lib/App.css +0 -47
- package/lib/App.d.ts +0 -3
- package/lib/App.js +0 -21
- package/lib/api/runtimes/checkpoints.d.ts +0 -122
- package/lib/api/runtimes/checkpoints.js +0 -118
- package/lib/api/runtimes/environments.d.ts +0 -9
- package/lib/api/runtimes/environments.js +0 -29
- package/lib/api/runtimes/healthz.d.ts +0 -15
- package/lib/api/runtimes/healthz.js +0 -44
- package/lib/api/runtimes/index.d.ts +0 -12
- package/lib/api/runtimes/index.js +0 -16
- package/lib/api/runtimes/runtimes.d.ts +0 -138
- package/lib/api/runtimes/runtimes.js +0 -230
- package/lib/api/runtimes/snapshots.d.ts +0 -38
- package/lib/api/runtimes/snapshots.js +0 -82
- package/lib/api/scheduler/index.d.ts +0 -6
- package/lib/api/scheduler/index.js +0 -10
- package/lib/api/scheduler/schedules.d.ts +0 -85
- package/lib/api/scheduler/schedules.js +0 -78
- package/lib/api/spacer/documents.d.ts +0 -12
- package/lib/api/spacer/documents.js +0 -43
- package/lib/api/spacer/healthz.d.ts +0 -15
- package/lib/api/spacer/healthz.js +0 -44
- package/lib/api/spacer/index.d.ts +0 -15
- package/lib/api/spacer/index.js +0 -19
- package/lib/api/spacer/items.d.ts +0 -25
- package/lib/api/spacer/items.js +0 -55
- package/lib/api/spacer/lexicals.d.ts +0 -34
- package/lib/api/spacer/lexicals.js +0 -89
- package/lib/api/spacer/notebooks.d.ts +0 -34
- package/lib/api/spacer/notebooks.js +0 -89
- package/lib/api/spacer/spaces.d.ts +0 -84
- package/lib/api/spacer/spaces.js +0 -170
- package/lib/api/spacer/users.d.ts +0 -9
- package/lib/api/spacer/users.js +0 -29
- package/lib/client/mixins/RuntimesMixin.d.ts +0 -93
- package/lib/client/mixins/RuntimesMixin.js +0 -229
- package/lib/client/mixins/SpacerMixin.d.ts +0 -210
- package/lib/client/mixins/SpacerMixin.js +0 -615
- package/lib/client/utils/spacerUtils.d.ts +0 -18
- package/lib/client/utils/spacerUtils.js +0 -32
- package/lib/collaboration/DatalayerCollaboration.d.ts +0 -13
- package/lib/collaboration/DatalayerCollaboration.js +0 -28
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +0 -60
- package/lib/collaboration/DatalayerCollaborationProvider.js +0 -163
- package/lib/collaboration/index.d.ts +0 -2
- package/lib/collaboration/index.js +0 -6
- package/lib/components/context/SpaceSelect.d.ts +0 -2
- package/lib/components/context/SpaceSelect.js +0 -42
- package/lib/components/flashes/FlashDisclaimer.d.ts +0 -2
- package/lib/components/flashes/FlashDisclaimer.js +0 -17
- package/lib/components/icons/ArtifactIcon.d.ts +0 -10
- package/lib/components/icons/ArtifactIcon.js +0 -58
- package/lib/components/icons/index.d.ts +0 -1
- package/lib/components/icons/index.js +0 -5
- package/lib/components/nbgrader/NbGradesDetails.d.ts +0 -5
- package/lib/components/nbgrader/NbGradesDetails.js +0 -14
- package/lib/components/nbgrader/index.d.ts +0 -1
- package/lib/components/nbgrader/index.js +0 -5
- package/lib/components/progress/CreditsIndicator.d.ts +0 -33
- package/lib/components/progress/CreditsIndicator.js +0 -23
- package/lib/components/runtimes/RuntimeCellVariables.d.ts +0 -39
- package/lib/components/runtimes/RuntimeCellVariables.js +0 -172
- package/lib/components/runtimes/RuntimeCellVariablesDialog.d.ts +0 -37
- package/lib/components/runtimes/RuntimeCellVariablesDialog.js +0 -101
- package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +0 -57
- package/lib/components/runtimes/RuntimeLauncherDialog.js +0 -275
- package/lib/components/runtimes/RuntimePickerBase.d.ts +0 -69
- package/lib/components/runtimes/RuntimePickerBase.js +0 -122
- package/lib/components/runtimes/RuntimePickerCell.d.ts +0 -34
- package/lib/components/runtimes/RuntimePickerCell.js +0 -104
- package/lib/components/runtimes/RuntimePickerNotebook.d.ts +0 -42
- package/lib/components/runtimes/RuntimePickerNotebook.js +0 -232
- package/lib/components/runtimes/RuntimeReservationControl.d.ts +0 -47
- package/lib/components/runtimes/RuntimeReservationControl.js +0 -42
- package/lib/components/runtimes/RuntimeSimplePicker.d.ts +0 -38
- package/lib/components/runtimes/RuntimeSimplePicker.js +0 -155
- package/lib/components/runtimes/RuntimeTransfer.d.ts +0 -16
- package/lib/components/runtimes/RuntimeTransfer.js +0 -5
- package/lib/components/runtimes/RuntimeUtils.d.ts +0 -17
- package/lib/components/runtimes/RuntimeUtils.js +0 -178
- package/lib/components/runtimes/RuntimeVariables.d.ts +0 -38
- package/lib/components/runtimes/RuntimeVariables.js +0 -75
- package/lib/components/runtimes/index.d.ts +0 -11
- package/lib/components/runtimes/index.js +0 -15
- package/lib/components/scheduler/ScheduleMenu.d.ts +0 -54
- package/lib/components/scheduler/ScheduleMenu.js +0 -154
- package/lib/components/scheduler/index.d.ts +0 -1
- package/lib/components/scheduler/index.js +0 -5
- package/lib/components/snapshots/SandboxSnapshotMenu.d.ts +0 -33
- package/lib/components/snapshots/SandboxSnapshotMenu.js +0 -169
- package/lib/components/snapshots/index.d.ts +0 -1
- package/lib/components/snapshots/index.js +0 -5
- package/lib/components/snippets/SnippetDialog.d.ts +0 -42
- package/lib/components/snippets/SnippetDialog.js +0 -42
- package/lib/components/students/StudentItemStatus.d.ts +0 -7
- package/lib/components/students/StudentItemStatus.js +0 -66
- package/lib/components/tokens/SpaceVariantToken.d.ts +0 -5
- package/lib/components/tokens/SpaceVariantToken.js +0 -23
- package/lib/components/toolbars/AssignmentEditorToolbar.d.ts +0 -4
- package/lib/components/toolbars/AssignmentEditorToolbar.js +0 -18
- package/lib/components/toolbars/DocumentEditorToolbar.d.ts +0 -2
- package/lib/components/toolbars/DocumentEditorToolbar.js +0 -12
- package/lib/components/toolbars/NotebookEditorToolbar.d.ts +0 -29
- package/lib/components/toolbars/NotebookEditorToolbar.js +0 -30
- package/lib/examples/CellExample.d.ts +0 -6
- package/lib/examples/CellExample.js +0 -20
- package/lib/examples/NotebookExample.d.ts +0 -6
- package/lib/examples/NotebookExample.js +0 -19
- package/lib/examples/lexical-theme.css +0 -436
- package/lib/examples/notebooks/IPyWidgetsExample.ipynb.json +0 -101
- package/lib/examples/notebooks/IPyWidgetsExampleWithState.ipynb.json +0 -112
- package/lib/examples/notebooks/Lite.ipynb.json +0 -128
- package/lib/examples/notebooks/Matplotlib.ipynb.json +0 -137
- package/lib/examples/notebooks/NotebookExample1.ipynb.json +0 -126
- package/lib/examples/notebooks/NotebookExample2.ipynb.json +0 -48
- package/lib/examples/notebooks/NotebookOutputs.ipynb.json +0 -49
- package/lib/examples/notebooks/NotebookToCExample.ipynb.json +0 -102
- package/lib/examples/notebooks/PyGWalker.ipynb.json +0 -55
- package/lib/hooks/useCellOutputshot.d.ts +0 -4
- package/lib/hooks/useCellOutputshot.js +0 -25
- package/lib/hooks/useProjects.d.ts +0 -628
- package/lib/hooks/useProjects.js +0 -190
- package/lib/hooks/useRuntimes.d.ts +0 -5
- package/lib/hooks/useRuntimes.js +0 -34
- package/lib/mocks/jupyter/index.js +0 -5
- package/lib/mocks/models/CourseMock.d.ts +0 -6
- package/lib/mocks/models/CourseMock.js +0 -29
- package/lib/mocks/models/SpaceMock.d.ts +0 -6
- package/lib/mocks/models/SpaceMock.js +0 -25
- package/lib/models/Assignment.d.ts +0 -7
- package/lib/models/Assignment.js +0 -5
- package/lib/models/Cell.d.ts +0 -8
- package/lib/models/Cell.js +0 -5
- package/lib/models/CodeBlock.d.ts +0 -10
- package/lib/models/CodeBlock.js +0 -5
- package/lib/models/CodeSandboxSnapshot.d.ts +0 -92
- package/lib/models/CodeSandboxSnapshot.js +0 -13
- package/lib/models/CodeSandboxSnapshotDTO.d.ts +0 -173
- package/lib/models/CodeSandboxSnapshotDTO.js +0 -139
- package/lib/models/CodefeedBlocks.d.ts +0 -7
- package/lib/models/CodefeedBlocks.js +0 -5
- package/lib/models/Content.d.ts +0 -5
- package/lib/models/Content.js +0 -5
- package/lib/models/Course.d.ts +0 -17
- package/lib/models/Course.js +0 -5
- package/lib/models/Dataset.d.ts +0 -16
- package/lib/models/Dataset.js +0 -5
- package/lib/models/Document.d.ts +0 -8
- package/lib/models/Document.js +0 -5
- package/lib/models/Environment.d.ts +0 -86
- package/lib/models/Environment.js +0 -5
- package/lib/models/EnvironmentDTO.d.ts +0 -125
- package/lib/models/EnvironmentDTO.js +0 -88
- package/lib/models/Exercise.d.ts +0 -16
- package/lib/models/Exercise.js +0 -5
- package/lib/models/Item.d.ts +0 -20
- package/lib/models/Item.js +0 -5
- package/lib/models/ItemDTO.d.ts +0 -74
- package/lib/models/ItemDTO.js +0 -186
- package/lib/models/ItemType.d.ts +0 -2
- package/lib/models/ItemType.js +0 -5
- package/lib/models/Lesson.d.ts +0 -5
- package/lib/models/Lesson.js +0 -5
- package/lib/models/LexicalDTO.d.ts +0 -155
- package/lib/models/LexicalDTO.js +0 -157
- package/lib/models/Library.d.ts +0 -10
- package/lib/models/Library.js +0 -5
- package/lib/models/Notebook.d.ts +0 -11
- package/lib/models/Notebook.js +0 -5
- package/lib/models/NotebookDTO.d.ts +0 -96
- package/lib/models/NotebookDTO.js +0 -153
- package/lib/models/Page.d.ts +0 -41
- package/lib/models/Page.js +0 -25
- package/lib/models/PageTag.d.ts +0 -19
- package/lib/models/PageTag.js +0 -94
- package/lib/models/ProjectDTO.d.ts +0 -89
- package/lib/models/ProjectDTO.js +0 -131
- package/lib/models/Runtime.d.ts +0 -123
- package/lib/models/Runtime.js +0 -18
- package/lib/models/RuntimeDTO.d.ts +0 -191
- package/lib/models/RuntimeDTO.js +0 -204
- package/lib/models/Space.d.ts +0 -35
- package/lib/models/Space.js +0 -66
- package/lib/models/SpaceDTO.d.ts +0 -334
- package/lib/models/SpaceDTO.js +0 -244
- package/lib/models/SpaceItem.d.ts +0 -10
- package/lib/models/SpaceItem.js +0 -5
- package/lib/models/SpaceMember.d.ts +0 -6
- package/lib/models/SpaceMember.js +0 -5
- package/lib/models/StudentItem.d.ts +0 -21
- package/lib/models/StudentItem.js +0 -5
- package/lib/services/DatalayerServiceManager.d.ts +0 -22
- package/lib/services/DatalayerServiceManager.js +0 -69
- package/lib/services/index.d.ts +0 -4
- package/lib/services/index.js +0 -7
- package/lib/services/reconnectToRuntime.d.ts +0 -32
- package/lib/services/reconnectToRuntime.js +0 -59
- package/lib/state/substates/CellState.d.ts +0 -12
- package/lib/state/substates/CellState.js +0 -22
- package/lib/state/substates/DocumentState.d.ts +0 -10
- package/lib/state/substates/DocumentState.js +0 -14
- package/lib/state/substates/GradeState.d.ts +0 -10
- package/lib/state/substates/GradeState.js +0 -14
- package/lib/state/substates/JupyterLabState.d.ts +0 -16
- package/lib/state/substates/JupyterLabState.js +0 -17
- package/lib/state/substates/NbformatState.d.ts +0 -13
- package/lib/state/substates/NbformatState.js +0 -16
- package/lib/state/substates/RuntimesState.d.ts +0 -79
- package/lib/state/substates/RuntimesState.js +0 -180
- package/lib/state/substates/SpaceState.d.ts +0 -11
- package/lib/state/substates/SpaceState.js +0 -16
- package/lib/stateful/index.d.ts +0 -2
- package/lib/stateful/index.js +0 -6
- package/lib/stateful/jupyter/exec/Python.d.ts +0 -5
- package/lib/stateful/jupyter/exec/Python.js +0 -100
- package/lib/stateful/jupyter/exec/Snippets.d.ts +0 -105
- package/lib/stateful/jupyter/exec/Snippets.js +0 -101
- package/lib/stateful/jupyter/exec/index.d.ts +0 -2
- package/lib/stateful/jupyter/exec/index.js +0 -6
- package/lib/stateful/jupyter/index.d.ts +0 -2
- package/lib/stateful/jupyter/index.js +0 -6
- package/lib/stateful/jupyter/kernelsHandler.d.ts +0 -8
- package/lib/stateful/jupyter/kernelsHandler.js +0 -39
- package/lib/stateful/runtimes/actions.d.ts +0 -102
- package/lib/stateful/runtimes/actions.js +0 -249
- package/lib/stateful/runtimes/apis.d.ts +0 -273
- package/lib/stateful/runtimes/apis.js +0 -5
- package/lib/stateful/runtimes/index.d.ts +0 -5
- package/lib/stateful/runtimes/index.js +0 -9
- package/lib/stateful/runtimes/settings.d.ts +0 -15
- package/lib/stateful/runtimes/settings.js +0 -31
- package/lib/stateful/runtimes/snapshots.d.ts +0 -25
- package/lib/stateful/runtimes/snapshots.js +0 -150
- package/lib/stateful/runtimes/utils.d.ts +0 -7
- package/lib/stateful/runtimes/utils.js +0 -14
- package/lib/utils/Cells.d.ts +0 -2
- package/lib/utils/Cells.js +0 -28
- /package/lib/{mocks/jupyter/index.d.ts → cli-login.d.ts} +0 -0
|
@@ -8,6 +8,7 @@ import { useToast } from './useToast.js';
|
|
|
8
8
|
// import { useRuMnock } from './../mocks/index.js';
|
|
9
9
|
import { useIAMStore } from '../state/index.js';
|
|
10
10
|
import { requestDatalayerAPI } from '../api/DatalayerApi.js';
|
|
11
|
+
import { isPublicPath } from '../routes/publicPaths.js';
|
|
11
12
|
export function useDatalayer(props = {}) {
|
|
12
13
|
const { loginRoute = '/login', notifyOnError = true } = props;
|
|
13
14
|
const location = useLocation();
|
|
@@ -56,9 +57,10 @@ export function useDatalayer(props = {}) {
|
|
|
56
57
|
if (responseError.response.status === 401) {
|
|
57
58
|
console.log('Datalayer sent a 401 return code.');
|
|
58
59
|
const resolvedLoginRoute = resolveLoginRoute(loginRoute_);
|
|
60
|
+
const isPublicRoute = isPublicPath(location.pathname || '');
|
|
59
61
|
const alreadyOnLoginRoute = location.pathname === resolvedLoginRoute ||
|
|
60
62
|
location.pathname.endsWith('/login');
|
|
61
|
-
if (!alreadyOnLoginRoute) {
|
|
63
|
+
if (!alreadyOnLoginRoute && !isPublicRoute) {
|
|
62
64
|
iamStore.logout();
|
|
63
65
|
navigate(resolvedLoginRoute);
|
|
64
66
|
}
|
package/lib/hooks/useIAM.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
import { useCache } from './useCache.js';
|
|
7
|
-
import { useIAMStore, useLayoutStore, useOrganizationStore,
|
|
7
|
+
import { useIAMStore, useLayoutStore, useOrganizationStore, } from '../state/index.js';
|
|
8
8
|
import { asUser, ANONYMOUS_USER, ANONYMOUS_USER_TOKEN, } from '../models/index.js';
|
|
9
9
|
import { requestDatalayerAPI, } from '../api/DatalayerApi.js';
|
|
10
10
|
export const useIAM = (props = { user: undefined, token: undefined }) => {
|
|
@@ -13,7 +13,6 @@ export const useIAM = (props = { user: undefined, token: undefined }) => {
|
|
|
13
13
|
const iamStore = useIAMStore();
|
|
14
14
|
const layoutStore = useLayoutStore();
|
|
15
15
|
const organizationStore = useOrganizationStore();
|
|
16
|
-
const spaceStore = useSpaceStore();
|
|
17
16
|
const { useWhoami, useLogout } = useCache();
|
|
18
17
|
const { data: whoamiData } = useWhoami();
|
|
19
18
|
const logoutMutation = useLogout();
|
|
@@ -61,7 +60,6 @@ export const useIAM = (props = { user: undefined, token: undefined }) => {
|
|
|
61
60
|
iamStore.logout();
|
|
62
61
|
layoutStore.reset();
|
|
63
62
|
organizationStore.updateOrganizations([]);
|
|
64
|
-
spaceStore.updateSpaces([]);
|
|
65
63
|
// Call TanStack Query logout mutation which will clear all caches
|
|
66
64
|
logoutMutation.mutate();
|
|
67
65
|
setIAMState({ user: ANONYMOUS_USER, token: ANONYMOUS_USER_TOKEN });
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export declare const useLocationHandles: () => {
|
|
2
2
|
accountHandle: string | undefined;
|
|
3
|
-
spaceHandler:
|
|
3
|
+
spaceHandler: any;
|
|
4
|
+
teamHandle?: undefined;
|
|
4
5
|
spaceHandle?: undefined;
|
|
5
6
|
} | {
|
|
6
7
|
accountHandle: string;
|
|
8
|
+
teamHandle: string;
|
|
7
9
|
spaceHandle: string;
|
|
8
10
|
spaceHandler?: undefined;
|
|
9
11
|
};
|
|
@@ -7,7 +7,7 @@ import { useParams } from './useParams.js';
|
|
|
7
7
|
import { useRunStore } from '../state/index.js';
|
|
8
8
|
export const useLocationHandles = () => {
|
|
9
9
|
const params = useParams();
|
|
10
|
-
const { accountHandle, spaceHandle } = params;
|
|
10
|
+
const { accountHandle, teamHandle, spaceHandle } = params;
|
|
11
11
|
const { pathname } = useLocation();
|
|
12
12
|
const runStore = useRunStore();
|
|
13
13
|
if (pathname.startsWith('/public')) {
|
|
@@ -18,6 +18,7 @@ export const useLocationHandles = () => {
|
|
|
18
18
|
}
|
|
19
19
|
return {
|
|
20
20
|
accountHandle,
|
|
21
|
+
teamHandle,
|
|
21
22
|
spaceHandle,
|
|
22
23
|
};
|
|
23
24
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* and sharing of artifacts. Only user / organization / team are principals.
|
|
6
6
|
* Agents are NOT principals (an agent is owned by an account).
|
|
7
7
|
*/
|
|
8
|
-
export type PrincipalKind = '
|
|
8
|
+
export type PrincipalKind = 'personal' | 'organization' | 'team';
|
|
9
9
|
export type PrincipalState = {
|
|
10
10
|
/** Kind of the currently selected principal. */
|
|
11
11
|
selectedPrincipalKind: PrincipalKind;
|
|
@@ -17,7 +17,7 @@ export type PrincipalState = {
|
|
|
17
17
|
selectedTeamParentOrganizationUid?: string;
|
|
18
18
|
/** Parent organization handle — set only when `selectedPrincipalKind === 'team'`. */
|
|
19
19
|
selectedTeamParentOrganizationHandle?: string;
|
|
20
|
-
|
|
20
|
+
selectPersonalPrincipal: (uid: string, handle: string) => void;
|
|
21
21
|
selectOrganizationPrincipal: (uid: string, handle: string) => void;
|
|
22
22
|
selectTeamPrincipal: (args: {
|
|
23
23
|
teamUid: string;
|
|
@@ -5,14 +5,73 @@
|
|
|
5
5
|
import { create } from 'zustand';
|
|
6
6
|
import { createJSONStorage, persist } from 'zustand/middleware';
|
|
7
7
|
import { useUsageRefreshStore } from './useUsageRefreshStore.js';
|
|
8
|
+
const PRINCIPAL_CONTEXT_COOKIE = 'datalayer-principal-context';
|
|
9
|
+
const PRINCIPAL_CONTEXT_COOKIE_MAX_AGE = 60 * 60 * 24 * 365;
|
|
10
|
+
const readPrincipalContextCookie = () => {
|
|
11
|
+
if (typeof document === 'undefined') {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
const escaped = PRINCIPAL_CONTEXT_COOKIE.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
15
|
+
const match = document.cookie.match(new RegExp(`(?:^|;\\s*)${escaped}=([^;]*)`));
|
|
16
|
+
if (!match?.[1]) {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const parsed = JSON.parse(decodeURIComponent(match[1]));
|
|
21
|
+
if (!parsed || typeof parsed !== 'object') {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
const kind = parsed.selectedPrincipalKind === 'organization' ||
|
|
25
|
+
parsed.selectedPrincipalKind === 'team' ||
|
|
26
|
+
parsed.selectedPrincipalKind === 'personal'
|
|
27
|
+
? parsed.selectedPrincipalKind
|
|
28
|
+
: undefined;
|
|
29
|
+
return {
|
|
30
|
+
selectedPrincipalKind: kind,
|
|
31
|
+
selectedPrincipalUid: typeof parsed.selectedPrincipalUid === 'string'
|
|
32
|
+
? parsed.selectedPrincipalUid
|
|
33
|
+
: undefined,
|
|
34
|
+
selectedPrincipalHandle: typeof parsed.selectedPrincipalHandle === 'string'
|
|
35
|
+
? parsed.selectedPrincipalHandle
|
|
36
|
+
: undefined,
|
|
37
|
+
selectedTeamParentOrganizationUid: typeof parsed.selectedTeamParentOrganizationUid === 'string'
|
|
38
|
+
? parsed.selectedTeamParentOrganizationUid
|
|
39
|
+
: undefined,
|
|
40
|
+
selectedTeamParentOrganizationHandle: typeof parsed.selectedTeamParentOrganizationHandle === 'string'
|
|
41
|
+
? parsed.selectedTeamParentOrganizationHandle
|
|
42
|
+
: undefined,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const writePrincipalContextCookie = (context) => {
|
|
50
|
+
if (typeof document === 'undefined') {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const value = encodeURIComponent(JSON.stringify(context));
|
|
54
|
+
document.cookie =
|
|
55
|
+
`${PRINCIPAL_CONTEXT_COOKIE}=${value};` +
|
|
56
|
+
` path=/; max-age=${PRINCIPAL_CONTEXT_COOKIE_MAX_AGE}; SameSite=Lax`;
|
|
57
|
+
};
|
|
58
|
+
const clearPrincipalContextCookie = () => {
|
|
59
|
+
if (typeof document === 'undefined') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
document.cookie =
|
|
63
|
+
`${PRINCIPAL_CONTEXT_COOKIE}=;` +
|
|
64
|
+
' path=/; max-age=0; SameSite=Lax';
|
|
65
|
+
};
|
|
66
|
+
const initialPrincipalContext = readPrincipalContextCookie();
|
|
8
67
|
export const usePrincipalStore = create()(persist(set => ({
|
|
9
|
-
selectedPrincipalKind: '
|
|
10
|
-
selectedPrincipalUid:
|
|
11
|
-
selectedPrincipalHandle:
|
|
12
|
-
selectedTeamParentOrganizationUid:
|
|
13
|
-
selectedTeamParentOrganizationHandle:
|
|
14
|
-
|
|
15
|
-
const unchanged = state.selectedPrincipalKind === '
|
|
68
|
+
selectedPrincipalKind: initialPrincipalContext.selectedPrincipalKind || 'personal',
|
|
69
|
+
selectedPrincipalUid: initialPrincipalContext.selectedPrincipalUid,
|
|
70
|
+
selectedPrincipalHandle: initialPrincipalContext.selectedPrincipalHandle,
|
|
71
|
+
selectedTeamParentOrganizationUid: initialPrincipalContext.selectedTeamParentOrganizationUid,
|
|
72
|
+
selectedTeamParentOrganizationHandle: initialPrincipalContext.selectedTeamParentOrganizationHandle,
|
|
73
|
+
selectPersonalPrincipal: (uid, handle) => set(state => {
|
|
74
|
+
const unchanged = state.selectedPrincipalKind === 'personal' &&
|
|
16
75
|
state.selectedPrincipalUid === uid &&
|
|
17
76
|
state.selectedPrincipalHandle === handle;
|
|
18
77
|
if (unchanged) {
|
|
@@ -21,13 +80,15 @@ export const usePrincipalStore = create()(persist(set => ({
|
|
|
21
80
|
useUsageRefreshStore
|
|
22
81
|
.getState()
|
|
23
82
|
.requestUsageRefresh('principal-user-changed');
|
|
24
|
-
|
|
25
|
-
selectedPrincipalKind: '
|
|
83
|
+
const nextState = {
|
|
84
|
+
selectedPrincipalKind: 'personal',
|
|
26
85
|
selectedPrincipalUid: uid,
|
|
27
86
|
selectedPrincipalHandle: handle,
|
|
28
87
|
selectedTeamParentOrganizationUid: undefined,
|
|
29
88
|
selectedTeamParentOrganizationHandle: undefined,
|
|
30
89
|
};
|
|
90
|
+
writePrincipalContextCookie(nextState);
|
|
91
|
+
return nextState;
|
|
31
92
|
}),
|
|
32
93
|
selectOrganizationPrincipal: (uid, handle) => set(state => {
|
|
33
94
|
const unchanged = state.selectedPrincipalKind === 'organization' &&
|
|
@@ -39,13 +100,15 @@ export const usePrincipalStore = create()(persist(set => ({
|
|
|
39
100
|
useUsageRefreshStore
|
|
40
101
|
.getState()
|
|
41
102
|
.requestUsageRefresh('principal-organization-changed');
|
|
42
|
-
|
|
103
|
+
const nextState = {
|
|
43
104
|
selectedPrincipalKind: 'organization',
|
|
44
105
|
selectedPrincipalUid: uid,
|
|
45
106
|
selectedPrincipalHandle: handle,
|
|
46
107
|
selectedTeamParentOrganizationUid: undefined,
|
|
47
108
|
selectedTeamParentOrganizationHandle: undefined,
|
|
48
109
|
};
|
|
110
|
+
writePrincipalContextCookie(nextState);
|
|
111
|
+
return nextState;
|
|
49
112
|
}),
|
|
50
113
|
selectTeamPrincipal: ({ teamUid, teamHandle, organizationUid, organizationHandle, }) => set(state => {
|
|
51
114
|
const unchanged = state.selectedPrincipalKind === 'team' &&
|
|
@@ -59,16 +122,18 @@ export const usePrincipalStore = create()(persist(set => ({
|
|
|
59
122
|
useUsageRefreshStore
|
|
60
123
|
.getState()
|
|
61
124
|
.requestUsageRefresh('principal-team-changed');
|
|
62
|
-
|
|
125
|
+
const nextState = {
|
|
63
126
|
selectedPrincipalKind: 'team',
|
|
64
127
|
selectedPrincipalUid: teamUid,
|
|
65
128
|
selectedPrincipalHandle: teamHandle,
|
|
66
129
|
selectedTeamParentOrganizationUid: organizationUid,
|
|
67
130
|
selectedTeamParentOrganizationHandle: organizationHandle,
|
|
68
131
|
};
|
|
132
|
+
writePrincipalContextCookie(nextState);
|
|
133
|
+
return nextState;
|
|
69
134
|
}),
|
|
70
135
|
resetPrincipal: () => set(state => {
|
|
71
|
-
const unchanged = state.selectedPrincipalKind === '
|
|
136
|
+
const unchanged = state.selectedPrincipalKind === 'personal' &&
|
|
72
137
|
state.selectedPrincipalUid === undefined &&
|
|
73
138
|
state.selectedPrincipalHandle === undefined &&
|
|
74
139
|
state.selectedTeamParentOrganizationUid === undefined &&
|
|
@@ -79,13 +144,15 @@ export const usePrincipalStore = create()(persist(set => ({
|
|
|
79
144
|
useUsageRefreshStore
|
|
80
145
|
.getState()
|
|
81
146
|
.requestUsageRefresh('principal-reset');
|
|
82
|
-
|
|
83
|
-
selectedPrincipalKind: '
|
|
147
|
+
const nextState = {
|
|
148
|
+
selectedPrincipalKind: 'personal',
|
|
84
149
|
selectedPrincipalUid: undefined,
|
|
85
150
|
selectedPrincipalHandle: undefined,
|
|
86
151
|
selectedTeamParentOrganizationUid: undefined,
|
|
87
152
|
selectedTeamParentOrganizationHandle: undefined,
|
|
88
153
|
};
|
|
154
|
+
clearPrincipalContextCookie();
|
|
155
|
+
return nextState;
|
|
89
156
|
}),
|
|
90
157
|
}), {
|
|
91
158
|
name: 'datalayer-principal',
|
|
@@ -97,5 +164,21 @@ export const usePrincipalStore = create()(persist(set => ({
|
|
|
97
164
|
selectedTeamParentOrganizationUid: state.selectedTeamParentOrganizationUid,
|
|
98
165
|
selectedTeamParentOrganizationHandle: state.selectedTeamParentOrganizationHandle,
|
|
99
166
|
}),
|
|
167
|
+
onRehydrateStorage: () => state => {
|
|
168
|
+
if (!state) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (state.selectedPrincipalKind === 'personal' && !state.selectedPrincipalUid) {
|
|
172
|
+
clearPrincipalContextCookie();
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
writePrincipalContextCookie({
|
|
176
|
+
selectedPrincipalKind: state.selectedPrincipalKind,
|
|
177
|
+
selectedPrincipalUid: state.selectedPrincipalUid,
|
|
178
|
+
selectedPrincipalHandle: state.selectedPrincipalHandle,
|
|
179
|
+
selectedTeamParentOrganizationUid: state.selectedTeamParentOrganizationUid,
|
|
180
|
+
selectedTeamParentOrganizationHandle: state.selectedTeamParentOrganizationHandle,
|
|
181
|
+
});
|
|
182
|
+
},
|
|
100
183
|
}));
|
|
101
184
|
export default usePrincipalStore;
|
|
@@ -21,7 +21,7 @@ export function useSelectedPrincipal() {
|
|
|
21
21
|
selectedPrincipalHandle,
|
|
22
22
|
selectedTeamParentOrganizationUid,
|
|
23
23
|
selectedTeamParentOrganizationHandle,
|
|
24
|
-
isUserSelected: selectedPrincipalKind === '
|
|
24
|
+
isUserSelected: selectedPrincipalKind === 'personal',
|
|
25
25
|
isOrganizationSelected: selectedPrincipalKind === 'organization',
|
|
26
26
|
isTeamSelected: selectedPrincipalKind === 'team',
|
|
27
27
|
};
|
package/lib/hooks/useUser.js
CHANGED
|
@@ -3,18 +3,35 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
import { useIAMStore } from '../state/index.js';
|
|
6
|
+
import { isPublicPath } from '../routes/publicPaths.js';
|
|
6
7
|
const LOGIN_HREF = '/login';
|
|
8
|
+
/**
|
|
9
|
+
* Whether the browser is currently on a public route where anonymous users are
|
|
10
|
+
* allowed, so `useUser` must NOT force a navigation to the login page.
|
|
11
|
+
*/
|
|
12
|
+
const isOnPublicPath = () => {
|
|
13
|
+
if (typeof window === 'undefined') {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return isPublicPath(window.location?.pathname || '');
|
|
17
|
+
};
|
|
7
18
|
export const useUser = (role) => {
|
|
8
19
|
const { user } = useIAMStore();
|
|
9
20
|
if (role) {
|
|
10
21
|
if (!user?.roles.includes(role.handle)) {
|
|
11
|
-
|
|
22
|
+
if (isOnPublicPath()) {
|
|
23
|
+
return user;
|
|
24
|
+
}
|
|
25
|
+
console.warn(`User should have role ${role.handle} - Forcing navigation to login page...`);
|
|
12
26
|
window.location.href = LOGIN_HREF;
|
|
13
27
|
throw new Error(`User should have role ${role.handle}`);
|
|
14
28
|
}
|
|
15
29
|
}
|
|
16
30
|
if (!user) {
|
|
17
|
-
|
|
31
|
+
if (isOnPublicPath()) {
|
|
32
|
+
return user;
|
|
33
|
+
}
|
|
34
|
+
console.warn('No user found... Forcing navigation to /login');
|
|
18
35
|
window.location.href = LOGIN_HREF;
|
|
19
36
|
}
|
|
20
37
|
return user;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
export * from './components';
|
|
2
2
|
export * from './utils';
|
|
3
3
|
export * from './state';
|
|
4
|
-
export * from './collaboration';
|
|
5
|
-
export * from './services';
|
|
6
4
|
export * from './navigation';
|
|
7
5
|
export * from './hooks';
|
|
8
6
|
export { requestDatalayerAPI, RunResponseError, NetworkError, } from './api/DatalayerApi';
|
|
9
7
|
export type { IRequestDatalayerAPIOptions } from './api/DatalayerApi';
|
|
10
8
|
export { API_BASE_PATHS } from './api/constants';
|
|
11
|
-
export * as runtimesApi from './api/runtimes';
|
|
12
9
|
export * as iamApi from './api/iam';
|
|
13
|
-
export *
|
|
14
|
-
export { DatalayerClient, type DatalayerClientConfig, type ClientHandlers, User, Runtime, Environment, Snapshot, Space, Project, Notebook, LexicalDTO, Secret, Credits, Item, type RuntimeJSON, type EnvironmentJSON, type UserJSON, type RuntimeData, type EnvironmentData, type UserData, type SpaceData, type SpaceItem, type NotebookData, type LexicalData, type CodeSandboxSnapshotData, type CreditsInfo, type CreditReservation, type CreateRuntimeRequest, type CreateRuntimeResponse, type ListRuntimesResponse, type ListEnvironmentsResponse, type CreateCodeSandboxSnapshotRequest, type CreateCodeSandboxSnapshotResponse, type GetCodeSandboxSnapshotResponse, type ListCodeSandboxSnapshotsResponse, type CreateSpaceRequest, type CreateSpaceResponse, type SpacesForUserResponse, type CollaborationSessionResponse, type DeleteSpaceItemResponse, type GetSpaceItemResponse, type GetSpaceItemsResponse, type CreateNotebookRequest, type CreateNotebookResponse, type GetNotebookResponse, type UpdateNotebookRequest, type UpdateNotebookResponse, type CreateLexicalRequest, type CreateLexicalResponse, type GetLexicalResponse, type UpdateLexicalRequest, type UpdateLexicalResponse, type CreditsResponse, type CreateDatasourceResponse, type GetDatasourceResponse, type ListDatasourcesResponse, type UpdateDatasourceResponse, type CreateSecretRequest, type CreateSecretResponse, type GetSecretResponse, type ListSecretsResponse, type UpdateSecretRequest, type UpdateSecretResponse, type SpaceJSON, type ProjectJSON, type ProjectDefaultItems, type UpdateSpaceRequest, type GetSpaceResponse, type UpdateSpaceResponse, type DeleteSpaceResponse, type GetSpaceDefaultItemsResponse, type GetSpacesByTypeResponse, type NotebookJSON, type LexicalJSON, type CodeSandboxSnapshotJSON, HealthCheck, type HealthCheckJSON, type LoginRequest, type LoginResponse, type UserMeResponse, type MembershipsResponse, type WhoAmIResponse, type HealthzPingResponse, AuthenticationManager, type IUser, type IBaseUser, type ICell, type IDatasource, type IDatasourceVariant, type ICredits, type ICreditsReservation, type ISpaceItem, type ISurvey, type ISpace, type IBaseSpace, type IAnySpace, type ISpaceVariant, type IBaseTeam, type IAnyTeam, type IOrganization, type IAnyOrganization, type IBaseOrganization, type IRuntimeModel, type IRuntimePod, type IRuntimeType, type IRuntimeLocation, type IRuntimeCapabilities, type ICodeSandboxSnapshot, type IDatalayerEnvironment, type IResources, type ISnippet, type IRole, type IAssignment, type IContact, type ICourse, type IOrganizationMember, type IPage, type PageTagName, type PageTheme, type PageVariant, type ISecret, type ISecretVariant, type SecretData, type SecretJSON, type DatasourceData, type DatasourceJSON, type DatasourceType, type CreateDatasourceRequest, type UpdateDatasourceRequest, Datasource, type IIAMToken, type IIAMTokenVariant, type IDocument, type IBaseDocument, type IEnvironment, type IExercise, type ICode, type IHelp, type IInvite, type ILesson, type INotebook, type IBaseNotebook, type ISchool, type ITeam, type TeamMember, type IUserOnboarding, type IClient, type IOnboardingPosition, type IOnboardingTours, type ITour, type ITourStatus, type IUserSettings, type IDataset, type IUsage, type IItem, type IItemType, type Member, type Profile, type SpaceMember, type IContactEvent, type IContactIAMProvider, type IStudentItem, type Instructor, type IStudent, type IDean, type IUserEvent, type IIAMProviderLinked, type IContent, type AuthResult, type TokenValidationResult, type AuthOptions, type TokenStorage, type IRuntimeOptions, type IMultiServiceManager, type IRemoteServicesManager, type IEnvironmentsManager, type IRemoteRuntimesManager, type NavigationLinkProps, type IDatalayerCoreConfig, type IRuntimesConfiguration, type IIAMProviderName, } from './client';
|
|
15
|
-
export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getSandboxSnapshots, loadSandboxSnapshot, } from './stateful/runtimes/actions';
|
|
10
|
+
export * from './client';
|
|
16
11
|
export * from './otel';
|
|
17
12
|
export * from './views';
|
package/lib/index.js
CHANGED
|
@@ -6,26 +6,14 @@
|
|
|
6
6
|
export * from './components/index.js';
|
|
7
7
|
export * from './utils/index.js';
|
|
8
8
|
export * from './state/index.js';
|
|
9
|
-
export * from './collaboration/index.js';
|
|
10
|
-
export * from './services/index.js';
|
|
11
9
|
// Export navigation before hooks to avoid conflicts
|
|
12
10
|
export * from './navigation/index.js';
|
|
13
11
|
export * from './hooks/index.js';
|
|
14
12
|
// Export APIs.
|
|
15
13
|
export { requestDatalayerAPI, RunResponseError, NetworkError, } from './api/DatalayerApi.js';
|
|
16
14
|
export { API_BASE_PATHS } from './api/constants.js';
|
|
17
|
-
export * as runtimesApi from './api/runtimes/index.js';
|
|
18
15
|
export * as iamApi from './api/iam/index.js';
|
|
19
|
-
export *
|
|
20
|
-
export {
|
|
21
|
-
// Export client and config types
|
|
22
|
-
DatalayerClient,
|
|
23
|
-
// Export domain models
|
|
24
|
-
User, Runtime, Environment, Snapshot, Space, Project, Notebook, LexicalDTO, Secret, Credits, Item, HealthCheck,
|
|
25
|
-
// Export auth
|
|
26
|
-
AuthenticationManager, Datasource, } from './client/index.js';
|
|
27
|
-
// Export commonly used functions directly for convenience
|
|
28
|
-
export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getSandboxSnapshots, loadSandboxSnapshot, } from './stateful/runtimes/actions.js';
|
|
16
|
+
export * from './client/index.js';
|
|
29
17
|
// OTEL observability components, hooks, and types
|
|
30
18
|
export * from './otel/index.js';
|
|
31
19
|
// Reusable views (sign-in pages, etc.)
|
package/lib/main.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
6
|
import { createRoot } from 'react-dom/client';
|
|
7
|
-
import App from './App.js';
|
|
7
|
+
// import App from './App.js';
|
|
8
8
|
import './index.css';
|
|
9
9
|
const rootElement = document.getElementById('root');
|
|
10
10
|
if (rootElement) {
|
|
11
|
-
createRoot(rootElement).render(_jsx(
|
|
11
|
+
createRoot(rootElement).render(_jsx(_Fragment, {}));
|
|
12
12
|
}
|
package/lib/mocks/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export type IDatasource = {
|
|
|
9
9
|
outputBucket: string;
|
|
10
10
|
};
|
|
11
11
|
export default IDatasource;
|
|
12
|
-
import type {
|
|
12
|
+
import type { DatalayerCoreClient } from '../client';
|
|
13
13
|
/**
|
|
14
14
|
* Datasource type matching UI and API.
|
|
15
15
|
*/
|
|
@@ -148,7 +148,7 @@ export declare class DatasourceDTO {
|
|
|
148
148
|
* @param data - Datasource data from API
|
|
149
149
|
* @param client - Client instance
|
|
150
150
|
*/
|
|
151
|
-
constructor(data: DatasourceData, client:
|
|
151
|
+
constructor(data: DatasourceData, client: DatalayerCoreClient);
|
|
152
152
|
private _checkDeleted;
|
|
153
153
|
get uid(): string;
|
|
154
154
|
get type(): DatasourceType;
|
package/lib/models/IAM.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ export interface MembershipsResponse {
|
|
|
120
120
|
* user can share artifacts with.
|
|
121
121
|
*/
|
|
122
122
|
export interface ShareablePrincipal {
|
|
123
|
-
kind: '
|
|
123
|
+
kind: 'personal' | 'organization' | 'team';
|
|
124
124
|
uid: string;
|
|
125
125
|
handle: string;
|
|
126
126
|
name?: string | null;
|
package/lib/models/School.d.ts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { IDean } from './Dean';
|
|
2
2
|
import { IStudent } from './Student';
|
|
3
|
-
import { ICourse } from './Course';
|
|
4
3
|
import { IBaseOrganization } from './Organization';
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* A school organization.
|
|
6
|
+
*
|
|
7
|
+
* The `courses` field is generic over the course type. The concrete course
|
|
8
|
+
* model lives in the runtime/content package (`@datalayer/agent-runtimes`),
|
|
9
|
+
* so consumers that need the rich `ICourse` shape parameterize this type; the
|
|
10
|
+
* core package intentionally does not depend on the content models.
|
|
11
|
+
*
|
|
12
|
+
* @typeParam C - The course type carried by the `courses` array.
|
|
13
|
+
*/
|
|
14
|
+
export type ISchool<C = unknown> = IBaseOrganization & {
|
|
6
15
|
type: 'school';
|
|
7
16
|
dean?: IDean;
|
|
8
17
|
students: Array<IStudent>;
|
|
9
|
-
courses: Array<
|
|
18
|
+
courses: Array<C>;
|
|
10
19
|
};
|
|
11
20
|
export default ISchool;
|
package/lib/models/Secret.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type ISecret = {
|
|
|
8
8
|
value: string;
|
|
9
9
|
};
|
|
10
10
|
export default ISecret;
|
|
11
|
-
import type {
|
|
11
|
+
import type { DatalayerCoreClient } from '../client';
|
|
12
12
|
/**
|
|
13
13
|
* Raw secret data from API (snake_case with suffixes).
|
|
14
14
|
*/
|
|
@@ -138,7 +138,7 @@ export declare class SecretDTO {
|
|
|
138
138
|
* @param data - Secret data from API
|
|
139
139
|
* @param client - Client instance
|
|
140
140
|
*/
|
|
141
|
-
constructor(data: SecretData, client:
|
|
141
|
+
constructor(data: SecretData, client: DatalayerCoreClient);
|
|
142
142
|
private _checkDeleted;
|
|
143
143
|
private _decodeValue;
|
|
144
144
|
get uid(): string;
|
package/lib/models/Student.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { IUser } from './User';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* A student user.
|
|
4
|
+
*
|
|
5
|
+
* The `studentItems` map is generic over the student-item type. The concrete
|
|
6
|
+
* `IStudentItem` model lives in the runtime/content package
|
|
7
|
+
* (`@datalayer/agent-runtimes`), so consumers that need the rich shape
|
|
8
|
+
* parameterize this type; the core package intentionally does not depend on
|
|
9
|
+
* the content models.
|
|
10
|
+
*
|
|
11
|
+
* @typeParam SI - The student-item type carried by the `studentItems` map.
|
|
12
|
+
*/
|
|
13
|
+
export type IStudent<SI = unknown> = IUser & {
|
|
14
|
+
studentItems?: Map<string, SI>;
|
|
5
15
|
};
|
|
6
16
|
export default IStudent;
|
package/lib/models/Usage.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Compute resource shape (CPU / memory / GPU) associated with a usage record.
|
|
3
|
+
* Mirrors the runtime environment resource shape but is declared locally so
|
|
4
|
+
* the account/usage model does not depend on the runtime/content package.
|
|
5
|
+
*/
|
|
6
|
+
interface IResources {
|
|
7
|
+
cpu: string;
|
|
8
|
+
memory: string;
|
|
9
|
+
'nvidia.com/gpu'?: string;
|
|
10
|
+
}
|
|
2
11
|
export interface IRawUsage {
|
|
3
12
|
account_uid: string;
|
|
4
13
|
resource_uid: string;
|
|
@@ -59,3 +68,4 @@ export interface IUsage {
|
|
|
59
68
|
usagePeriodEnd?: Date;
|
|
60
69
|
metadata: Map<string, string>;
|
|
61
70
|
}
|
|
71
|
+
export {};
|
package/lib/models/UserDTO.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module models/UserDTO
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { DatalayerCoreClient } from '../client';
|
|
7
7
|
/**
|
|
8
8
|
* Represents a user in the Datalayer platform
|
|
9
9
|
* @interface UserData
|
|
@@ -56,7 +56,7 @@ export declare class UserDTO {
|
|
|
56
56
|
* @param data - User data from API
|
|
57
57
|
* @param client - Client instance (currently unused but kept for compatibility)
|
|
58
58
|
*/
|
|
59
|
-
constructor(data: UserData, client?:
|
|
59
|
+
constructor(data: UserData, client?: DatalayerCoreClient);
|
|
60
60
|
get id(): string;
|
|
61
61
|
get uid(): string;
|
|
62
62
|
get email(): string;
|
package/lib/models/index.d.ts
CHANGED
|
@@ -28,28 +28,17 @@
|
|
|
28
28
|
*
|
|
29
29
|
* @module models
|
|
30
30
|
*/
|
|
31
|
-
export * from './Assignment';
|
|
32
31
|
export * from './Base';
|
|
33
|
-
export * from './Cell';
|
|
34
|
-
export * from './CodeBlock';
|
|
35
|
-
export * from './CodefeedBlocks';
|
|
36
32
|
export * from './Common';
|
|
37
33
|
export * from './Contact';
|
|
38
34
|
export * from './ContactEvent';
|
|
39
35
|
export * from './ContactIAMProvider';
|
|
40
36
|
export * from './ContactTags';
|
|
41
|
-
export * from './Content';
|
|
42
|
-
export * from './Course';
|
|
43
37
|
export * from './Credits';
|
|
44
38
|
export * from './CreditsDTO';
|
|
45
|
-
export * from './Dataset';
|
|
46
39
|
export * from './Datasource';
|
|
47
40
|
export * from './Dean';
|
|
48
|
-
export * from './Document';
|
|
49
|
-
export * from './Environment';
|
|
50
|
-
export * from './EnvironmentDTO';
|
|
51
41
|
export * from './Errors';
|
|
52
|
-
export * from './Exercise';
|
|
53
42
|
export * from './GrowthKPI';
|
|
54
43
|
export * from './IAM';
|
|
55
44
|
export * from './IAMProviderLinked';
|
|
@@ -60,38 +49,19 @@ export * from './IAMToken';
|
|
|
60
49
|
export * from './Inbound';
|
|
61
50
|
export * from './Instructor';
|
|
62
51
|
export * from './Invite';
|
|
63
|
-
export * from './Item';
|
|
64
|
-
export * from './ItemDTO';
|
|
65
|
-
export * from './ItemType';
|
|
66
52
|
export * from './LandingRoles';
|
|
67
|
-
export * from './Lesson';
|
|
68
|
-
export * from './LexicalDTO';
|
|
69
|
-
export * from './Library';
|
|
70
53
|
export * from './Member';
|
|
71
|
-
export * from './Notebook';
|
|
72
|
-
export * from './NotebookDTO';
|
|
73
54
|
export * from './Organization';
|
|
74
55
|
export * from './OrganizationMember';
|
|
75
56
|
export * from './Outbound';
|
|
76
|
-
export * from './Page';
|
|
77
|
-
export * from './PageTag';
|
|
78
57
|
export * from './Profile';
|
|
79
58
|
export * from './Role';
|
|
80
59
|
export * from './RolesOrganization';
|
|
81
60
|
export * from './RolesPlatform';
|
|
82
61
|
export * from './RolesTeam';
|
|
83
|
-
export * from './Runtime';
|
|
84
|
-
export * from './RuntimeDTO';
|
|
85
|
-
export * from './CodeSandboxSnapshot';
|
|
86
|
-
export * from './CodeSandboxSnapshotDTO';
|
|
87
62
|
export * from './School';
|
|
88
63
|
export * from './Secret';
|
|
89
|
-
export * from './Space';
|
|
90
|
-
export * from './SpaceDTO';
|
|
91
|
-
export * from './SpaceItem';
|
|
92
|
-
export * from './SpaceMember';
|
|
93
64
|
export * from './Student';
|
|
94
|
-
export * from './StudentItem';
|
|
95
65
|
export * from './Survey';
|
|
96
66
|
export * from './Team';
|
|
97
67
|
export * from './TeamMember';
|