@datalayer/core 1.0.25 → 1.1.43
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 +11 -134
- 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/auth/AuthenticationManager.d.ts +3 -3
- package/lib/client/auth/AuthenticationManager.js +13 -13
- package/lib/client/auth/strategies.d.ts +2 -2
- package/lib/client/auth/strategies.js +6 -6
- package/lib/client/base.d.ts +9 -12
- package/lib/client/base.js +17 -19
- package/lib/client/index.d.ts +10 -98
- package/lib/client/index.js +12 -21
- package/lib/client/mixins/IAMMixin.js +26 -26
- package/lib/components/auth/Login.js +2 -2
- 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 +79 -42
- 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 +194 -147
- 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/config/Configuration.d.ts +13 -13
- package/lib/config/Configuration.js +5 -5
- 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 +661 -306
- package/lib/hooks/useDatalayer.js +3 -1
- package/lib/hooks/useIAM.js +2 -4
- 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/UserSettings.d.ts +1 -1
- package/lib/models/UserSettings.js +1 -1
- package/lib/models/index.d.ts +0 -30
- package/lib/models/index.js +0 -30
- package/lib/otel/client/OtelClient.d.ts +2 -2
- package/lib/otel/client/OtelClient.js +2 -2
- package/lib/otel/hooks/index.js +5 -5
- package/lib/otel/types.d.ts +1 -1
- package/lib/otel/views/OtelLive.js +1 -1
- 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/CoreState.js +13 -13
- package/lib/state/substates/IAMState.d.ts +1 -1
- package/lib/state/substates/IAMState.js +14 -14
- package/lib/state/substates/LayoutState.d.ts +12 -1
- package/lib/state/substates/SurveysState.d.ts +1 -1
- package/lib/state/substates/SurveysState.js +10 -10
- 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 +111 -13
- 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
package/lib/client/index.d.ts
CHANGED
|
@@ -17,41 +17,31 @@
|
|
|
17
17
|
import { DatalayerClientBase, type DatalayerClientConfig, type ClientHandlers } from './base';
|
|
18
18
|
import type { UserDTO } from './../models/UserDTO';
|
|
19
19
|
import type { CreditsDTO } from '../models/CreditsDTO';
|
|
20
|
-
import type { EnvironmentDTO } from '../models/EnvironmentDTO';
|
|
21
|
-
import type { RuntimeDTO } from '../models/RuntimeDTO';
|
|
22
|
-
import type { CodeSandboxSnapshotDTO } from '../models/CodeSandboxSnapshotDTO';
|
|
23
|
-
import type { SpaceDTO } from '../models/SpaceDTO';
|
|
24
|
-
import type { NotebookDTO } from '../models/NotebookDTO';
|
|
25
|
-
import type { LexicalDTO } from '../models/LexicalDTO';
|
|
26
20
|
import type { HealthCheck } from '../models/HealthCheck';
|
|
27
21
|
import type { SecretDTO } from '../models/Secret';
|
|
28
22
|
import type { CreateSecretRequest, UpdateSecretRequest } from '../models/Secret';
|
|
29
|
-
import type { ProjectDTO } from '../models/ProjectDTO';
|
|
30
|
-
import type { ProjectDefaultItems } from '../models/ProjectDTO';
|
|
31
|
-
import type { UpdateSpaceRequest } from '../models/SpaceDTO';
|
|
32
23
|
import type { DatasourceDTO } from '../models/Datasource';
|
|
33
24
|
import type { CreateDatasourceRequest, UpdateDatasourceRequest } from '../models/Datasource';
|
|
34
|
-
declare const
|
|
25
|
+
declare const DatalayerCoreClientWithMixins: typeof DatalayerClientBase;
|
|
35
26
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
27
|
+
* Core Datalayer Client providing access to identity, plans and account
|
|
28
|
+
* services (IAM). Runtime and workspace/content features are provided by
|
|
29
|
+
* `AgentRuntimesClient` in `@datalayer/agent-runtimes`, which extends this
|
|
30
|
+
* class.
|
|
38
31
|
*
|
|
39
32
|
* @example
|
|
40
33
|
* ```typescript
|
|
41
|
-
* const client = new
|
|
34
|
+
* const client = new DatalayerCoreClient({
|
|
42
35
|
* token: 'your-token'
|
|
43
36
|
* });
|
|
44
37
|
*
|
|
45
38
|
* const user = await client.whoami();
|
|
46
|
-
* const
|
|
47
|
-
* environment_name: 'ai-agents-env',
|
|
48
|
-
* credits_limit: 100
|
|
49
|
-
* });
|
|
39
|
+
* const credits = await client.getCredits();
|
|
50
40
|
* ```
|
|
51
41
|
*/
|
|
52
|
-
export declare class
|
|
42
|
+
export declare class DatalayerCoreClient extends DatalayerCoreClientWithMixins {
|
|
53
43
|
/**
|
|
54
|
-
* Create a
|
|
44
|
+
* Create a DatalayerCoreClient instance.
|
|
55
45
|
*
|
|
56
46
|
* @param config - Client configuration options
|
|
57
47
|
*/
|
|
@@ -61,23 +51,8 @@ export type { DatalayerClientConfig, ClientHandlers };
|
|
|
61
51
|
export { DatalayerClientBase };
|
|
62
52
|
export { UserDTO as User } from './../models/UserDTO';
|
|
63
53
|
export type { UserJSON, UserData } from './../models/UserDTO';
|
|
64
|
-
export { RuntimeDTO as Runtime } from '../models/RuntimeDTO';
|
|
65
|
-
export type { RuntimeJSON, RuntimeData, CreateRuntimeRequest, CreateRuntimeResponse, ListRuntimesResponse, } from '../models/RuntimeDTO';
|
|
66
|
-
export { EnvironmentDTO as Environment } from '../models/EnvironmentDTO';
|
|
67
|
-
export type { EnvironmentJSON, EnvironmentData, ListEnvironmentsResponse, } from '../models/EnvironmentDTO';
|
|
68
|
-
export { CodeSandboxSnapshotDTO as Snapshot } from '../models/CodeSandboxSnapshotDTO';
|
|
69
|
-
export type { CodeSandboxSnapshotJSON, CodeSandboxSnapshotData, CreateCodeSandboxSnapshotRequest, CreateCodeSandboxSnapshotResponse, GetCodeSandboxSnapshotResponse, ListCodeSandboxSnapshotsResponse, } from '../models/CodeSandboxSnapshotDTO';
|
|
70
|
-
export { SpaceDTO as Space } from '../models/SpaceDTO';
|
|
71
|
-
export type { SpaceJSON, SpaceData, SpaceItem, CreateSpaceRequest, CreateSpaceResponse, SpacesForUserResponse, CollaborationSessionResponse, DeleteSpaceItemResponse, GetSpaceItemResponse, GetSpaceItemsResponse, CreateNotebookRequest, CreateNotebookResponse, GetNotebookResponse, UpdateNotebookRequest, UpdateNotebookResponse, UpdateSpaceRequest, GetSpaceResponse, UpdateSpaceResponse, DeleteSpaceResponse, GetSpaceDefaultItemsResponse, GetSpacesByTypeResponse, } from '../models/SpaceDTO';
|
|
72
|
-
export { ProjectDTO as Project } from '../models/ProjectDTO';
|
|
73
|
-
export type { ProjectJSON, ProjectDefaultItems } from '../models/ProjectDTO';
|
|
74
|
-
export { NotebookDTO as Notebook } from '../models/NotebookDTO';
|
|
75
|
-
export type { NotebookJSON, NotebookData } from '../models/NotebookDTO';
|
|
76
|
-
export { LexicalDTO } from '../models/LexicalDTO';
|
|
77
|
-
export type { LexicalJSON, LexicalData, CreateLexicalRequest, CreateLexicalResponse, GetLexicalResponse, UpdateLexicalRequest, UpdateLexicalResponse, } from '../models/LexicalDTO';
|
|
78
54
|
export { CreditsDTO as Credits } from '../models/CreditsDTO';
|
|
79
55
|
export type { CreditsInfo, CreditReservation, CreditsResponse, } from '../models/CreditsDTO';
|
|
80
|
-
export { ItemDTO as Item } from '../models/ItemDTO';
|
|
81
56
|
export { HealthCheck } from '../models/HealthCheck';
|
|
82
57
|
export type { HealthCheckJSON } from '../models/HealthCheck';
|
|
83
58
|
export { SecretDTO as Secret } from './../models/Secret';
|
|
@@ -88,62 +63,40 @@ export type { LoginRequest, LoginResponse, UserMeResponse, MembershipsResponse,
|
|
|
88
63
|
export type { HealthzPingResponse } from '../models/Common';
|
|
89
64
|
export { AuthenticationManager } from './auth/AuthenticationManager';
|
|
90
65
|
export type { IUser, IBaseUser } from '../models/User';
|
|
91
|
-
export type { ICell } from '../models/Cell';
|
|
92
66
|
export type { IDatasource, IDatasourceVariant } from '../models/Datasource';
|
|
93
67
|
export type { ICredits, ICreditsReservation } from '../models/Credits';
|
|
94
|
-
export type { ISpaceItem } from '../models/SpaceItem';
|
|
95
68
|
export type { ISurvey } from '../models/Survey';
|
|
96
|
-
export type { ISpace, IBaseSpace, IAnySpace, ISpaceVariant, } from '../models/Space';
|
|
97
69
|
export type { IBaseTeam, IAnyTeam } from '../models/Team';
|
|
98
70
|
export type { IOrganization, IAnyOrganization, IBaseOrganization, } from '../models/Organization';
|
|
99
|
-
export type { IRuntimeModel, IRuntimePod, IRuntimeType, IRuntimeLocation, IRuntimeCapabilities, } from '../models/Runtime';
|
|
100
|
-
export type { ICodeSandboxSnapshot } from '../models/CodeSandboxSnapshot';
|
|
101
|
-
export type { IDatalayerEnvironment, IResources, ISnippet, } from '../models/Environment';
|
|
102
71
|
export type { IRole } from '../models/Role';
|
|
103
|
-
export type { IAssignment } from '../models/Assignment';
|
|
104
72
|
export type { IContact } from '../models/Contact';
|
|
105
|
-
export type { ICourse } from '../models/Course';
|
|
106
73
|
export type { IOrganizationMember } from '../models/OrganizationMember';
|
|
107
|
-
export type { IPage, PageTheme, PageVariant } from '../models/Page';
|
|
108
|
-
export type { PageTagName } from '../models/PageTag';
|
|
109
74
|
export type { ISecret, ISecretVariant } from '../models/Secret';
|
|
110
75
|
export type { IIAMToken, IIAMTokenVariant } from '../models/IAMToken';
|
|
111
|
-
export type { IDocument, IBaseDocument } from '../models/Document';
|
|
112
|
-
export type { IEnvironment } from '../models/Environment';
|
|
113
|
-
export type { IExercise, ICode, IHelp } from '../models/Exercise';
|
|
114
76
|
export type { IInvite } from '../models/Invite';
|
|
115
|
-
export type { ILesson } from '../models/Lesson';
|
|
116
|
-
export type { INotebook, IBaseNotebook } from '../models/Notebook';
|
|
117
77
|
export type { ISchool } from '../models/School';
|
|
118
78
|
export type { ITeam } from '../models/Team';
|
|
119
79
|
export type { TeamMember } from '../models/TeamMember';
|
|
120
80
|
export type { IUserOnboarding, IClient, IOnboardingPosition, IOnboardingTours, ITour, ITourStatus, } from '../models/UserOnboarding';
|
|
121
81
|
export type { IUserSettings } from '../models/UserSettings';
|
|
122
|
-
export type { IDataset } from '../models/Dataset';
|
|
123
82
|
export type { IUsage } from '../models/Usage';
|
|
124
|
-
export type { IItem } from '../models/Item';
|
|
125
|
-
export type { IItemType } from '../models/ItemType';
|
|
126
83
|
export type { Member } from '../models/Member';
|
|
127
84
|
export type { Profile } from '../models/Profile';
|
|
128
|
-
export type { SpaceMember } from '../models/SpaceMember';
|
|
129
85
|
export type { IContactEvent } from '../models/ContactEvent';
|
|
130
86
|
export type { IContactIAMProvider } from '../models/ContactIAMProvider';
|
|
131
|
-
export type { IStudentItem } from '../models/StudentItem';
|
|
132
87
|
export type { Instructor } from '../models/Instructor';
|
|
133
88
|
export type { IStudent } from '../models/Student';
|
|
134
89
|
export type { IDean } from '../models/Dean';
|
|
135
90
|
export type { IUserEvent } from '../models/UserEvent';
|
|
136
91
|
export type { IIAMProviderLinked } from '../models/IAMProviderLinked';
|
|
137
|
-
export type { IContent } from '../models/Content';
|
|
138
92
|
export type { AuthResult, TokenValidationResult, AuthOptions, TokenStorage, } from './auth/types';
|
|
139
|
-
export type { IRuntimeOptions, IMultiServiceManager, IRemoteServicesManager, IEnvironmentsManager, IRemoteRuntimesManager, } from '../stateful/runtimes/apis';
|
|
140
93
|
export type { IDatalayerCoreConfig, IRuntimesConfiguration, } from '../config/Configuration';
|
|
141
94
|
export type { IIAMProviderName } from '../models/IAMProvidersSpecs';
|
|
142
95
|
export type { NavigationLinkProps } from '../navigation/components';
|
|
143
96
|
export { ItemTypes } from './constants';
|
|
144
97
|
export type { ItemType } from './constants';
|
|
145
98
|
export * from './auth';
|
|
146
|
-
export interface
|
|
99
|
+
export interface DatalayerCoreClient {
|
|
147
100
|
getToken(): string | undefined;
|
|
148
101
|
setToken(token: string): Promise<void>;
|
|
149
102
|
whoami(): Promise<UserDTO>;
|
|
@@ -163,46 +116,5 @@ export interface DatalayerClient {
|
|
|
163
116
|
getDatasource(datasourceId: string): Promise<DatasourceDTO>;
|
|
164
117
|
updateDatasource(datasourceId: string, updates: UpdateDatasourceRequest): Promise<DatasourceDTO>;
|
|
165
118
|
deleteDatasource(datasourceId: string): Promise<void>;
|
|
166
|
-
listEnvironments(): Promise<EnvironmentDTO[]>;
|
|
167
|
-
ensureRuntime(environmentName?: string, creditsLimit?: number, waitForReady?: boolean, maxWaitTime?: number, reuseExisting?: boolean, snapshotId?: string): Promise<RuntimeDTO>;
|
|
168
|
-
createRuntime(environmentName: string, type: 'notebook' | 'terminal' | 'job', givenName: string, minutesLimit: number, fromSnapshotId?: string): Promise<RuntimeDTO>;
|
|
169
|
-
listRuntimes(): Promise<RuntimeDTO[]>;
|
|
170
|
-
getRuntime(podName: string): Promise<RuntimeDTO>;
|
|
171
|
-
deleteRuntime(podName: string): Promise<void>;
|
|
172
|
-
terminateAllRuntimes(): Promise<PromiseSettledResult<void>[]>;
|
|
173
|
-
createSnapshot(podName: string, name: string, description: string, stop?: boolean): Promise<CodeSandboxSnapshotDTO>;
|
|
174
|
-
listSnapshots(): Promise<CodeSandboxSnapshotDTO[]>;
|
|
175
|
-
getSnapshot(id: string): Promise<CodeSandboxSnapshotDTO>;
|
|
176
|
-
deleteSnapshot(id: string): Promise<void>;
|
|
177
|
-
checkRuntimesHealth(): Promise<HealthCheck>;
|
|
178
|
-
getMySpaces(): Promise<SpaceDTO[]>;
|
|
179
|
-
createSpace(name: string, description: string, variant: string, spaceHandle: string, organizationId: string, seedSpaceId: string, isPublic: boolean): Promise<SpaceDTO>;
|
|
180
|
-
createNotebook(spaceId: string, name: string, description: string, file?: File | Blob): Promise<NotebookDTO>;
|
|
181
|
-
getNotebook(id: string): Promise<NotebookDTO>;
|
|
182
|
-
updateNotebook(id: string, name?: string, description?: string): Promise<NotebookDTO>;
|
|
183
|
-
createLexical(spaceId: string, name: string, description: string, file?: File | Blob): Promise<LexicalDTO>;
|
|
184
|
-
getLexical(id: string): Promise<LexicalDTO>;
|
|
185
|
-
updateLexical(id: string, name?: string, description?: string): Promise<LexicalDTO>;
|
|
186
|
-
getSpaceItems(spaceId: string): Promise<(NotebookDTO | LexicalDTO)[]>;
|
|
187
|
-
getSpaceItem(itemId: string): Promise<NotebookDTO | LexicalDTO>;
|
|
188
|
-
deleteSpaceItem(itemId: string): Promise<void>;
|
|
189
|
-
getCollaborationSessionId(documentId: string): Promise<string>;
|
|
190
|
-
getContent(itemId: string): Promise<any>;
|
|
191
|
-
checkSpacerHealth(): Promise<HealthCheck>;
|
|
192
|
-
getSpace(uid: string): Promise<SpaceDTO>;
|
|
193
|
-
updateSpace(uid: string, data: UpdateSpaceRequest): Promise<SpaceDTO>;
|
|
194
|
-
updateUserSpace(uid: string, userId: string, data: UpdateSpaceRequest): Promise<SpaceDTO>;
|
|
195
|
-
deleteSpace(uid: string): Promise<void>;
|
|
196
|
-
makeSpacePublic(uid: string): Promise<SpaceDTO>;
|
|
197
|
-
makeSpacePrivate(uid: string): Promise<SpaceDTO>;
|
|
198
|
-
exportSpace(uid: string): Promise<any>;
|
|
199
|
-
cloneNotebook(id: string): Promise<NotebookDTO>;
|
|
200
|
-
cloneLexical(id: string): Promise<LexicalDTO>;
|
|
201
|
-
getProjects(): Promise<ProjectDTO[]>;
|
|
202
|
-
getProject(uid: string): Promise<ProjectDTO>;
|
|
203
|
-
createProject(name: string, description?: string): Promise<ProjectDTO>;
|
|
204
|
-
updateProject(uid: string, data: UpdateSpaceRequest): Promise<ProjectDTO>;
|
|
205
|
-
renameProject(uid: string, newName: string, description?: string): Promise<ProjectDTO>;
|
|
206
|
-
getProjectDefaultItems(uid: string): Promise<ProjectDefaultItems>;
|
|
207
119
|
calculateCreditsFromMinutes(minutes: number, burningRate: number): number;
|
|
208
120
|
}
|
package/lib/client/index.js
CHANGED
|
@@ -20,8 +20,6 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { DatalayerClientBase, } from './base.js';
|
|
22
22
|
import { IAMMixin } from './mixins/IAMMixin.js';
|
|
23
|
-
import { RuntimesMixin } from './mixins/RuntimesMixin.js';
|
|
24
|
-
import { SpacerMixin } from './mixins/SpacerMixin.js';
|
|
25
23
|
/**
|
|
26
24
|
* Helper function to compose mixins in a more readable way.
|
|
27
25
|
* Applies mixins in the order provided.
|
|
@@ -32,28 +30,29 @@ import { SpacerMixin } from './mixins/SpacerMixin.js';
|
|
|
32
30
|
function composeMixins(...mixins) {
|
|
33
31
|
return mixins.reduce((base, mixin) => mixin(base), DatalayerClientBase);
|
|
34
32
|
}
|
|
35
|
-
// Apply
|
|
36
|
-
|
|
33
|
+
// Apply the IAM mixin to the base class. Runtime and content (Spacer) features
|
|
34
|
+
// live in @datalayer/agent-runtimes, which composes AgentRuntimesClient on top
|
|
35
|
+
// of this core client.
|
|
36
|
+
const DatalayerCoreClientWithMixins = composeMixins(IAMMixin);
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* Core Datalayer Client providing access to identity, plans and account
|
|
39
|
+
* services (IAM). Runtime and workspace/content features are provided by
|
|
40
|
+
* `AgentRuntimesClient` in `@datalayer/agent-runtimes`, which extends this
|
|
41
|
+
* class.
|
|
40
42
|
*
|
|
41
43
|
* @example
|
|
42
44
|
* ```typescript
|
|
43
|
-
* const client = new
|
|
45
|
+
* const client = new DatalayerCoreClient({
|
|
44
46
|
* token: 'your-token'
|
|
45
47
|
* });
|
|
46
48
|
*
|
|
47
49
|
* const user = await client.whoami();
|
|
48
|
-
* const
|
|
49
|
-
* environment_name: 'ai-agents-env',
|
|
50
|
-
* credits_limit: 100
|
|
51
|
-
* });
|
|
50
|
+
* const credits = await client.getCredits();
|
|
52
51
|
* ```
|
|
53
52
|
*/
|
|
54
|
-
export class
|
|
53
|
+
export class DatalayerCoreClient extends DatalayerCoreClientWithMixins {
|
|
55
54
|
/**
|
|
56
|
-
* Create a
|
|
55
|
+
* Create a DatalayerCoreClient instance.
|
|
57
56
|
*
|
|
58
57
|
* @param config - Client configuration options
|
|
59
58
|
*/
|
|
@@ -66,15 +65,7 @@ export class DatalayerClient extends DatalayerClientWithMixins {
|
|
|
66
65
|
export { DatalayerClientBase };
|
|
67
66
|
// Export models for use by consumers
|
|
68
67
|
export { UserDTO as User } from './../models/UserDTO.js';
|
|
69
|
-
export { RuntimeDTO as Runtime } from '../models/RuntimeDTO.js';
|
|
70
|
-
export { EnvironmentDTO as Environment } from '../models/EnvironmentDTO.js';
|
|
71
|
-
export { CodeSandboxSnapshotDTO as Snapshot } from '../models/CodeSandboxSnapshotDTO.js';
|
|
72
|
-
export { SpaceDTO as Space } from '../models/SpaceDTO.js';
|
|
73
|
-
export { ProjectDTO as Project } from '../models/ProjectDTO.js';
|
|
74
|
-
export { NotebookDTO as Notebook } from '../models/NotebookDTO.js';
|
|
75
|
-
export { LexicalDTO } from '../models/LexicalDTO.js';
|
|
76
68
|
export { CreditsDTO as Credits } from '../models/CreditsDTO.js';
|
|
77
|
-
export { ItemDTO as Item } from '../models/ItemDTO.js';
|
|
78
69
|
export { HealthCheck } from '../models/HealthCheck.js';
|
|
79
70
|
export { SecretDTO as Secret } from './../models/Secret.js';
|
|
80
71
|
export { DatasourceDTO as Datasource } from './../models/Datasource.js';
|
|
@@ -29,8 +29,8 @@ export function IAMMixin(Base) {
|
|
|
29
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
30
|
const token = this.getToken();
|
|
31
31
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
-
const
|
|
33
|
-
const response = await profile.whoami(token,
|
|
32
|
+
const iamUrl = this.getIamUrl();
|
|
33
|
+
const response = await profile.whoami(token, iamUrl);
|
|
34
34
|
// Handle the whoami response format
|
|
35
35
|
let userData;
|
|
36
36
|
if (!response) {
|
|
@@ -83,8 +83,8 @@ export function IAMMixin(Base) {
|
|
|
83
83
|
/** Log out the current user. */
|
|
84
84
|
async logout() {
|
|
85
85
|
const token = this.getToken();
|
|
86
|
-
const
|
|
87
|
-
await authentication.logout(token,
|
|
86
|
+
const iamUrl = this.getIamUrl();
|
|
87
|
+
await authentication.logout(token, iamUrl);
|
|
88
88
|
// Clear the token from the Client and cached user
|
|
89
89
|
this.setToken('');
|
|
90
90
|
this.currentUserCache = undefined;
|
|
@@ -95,8 +95,8 @@ export function IAMMixin(Base) {
|
|
|
95
95
|
*/
|
|
96
96
|
async getCredits() {
|
|
97
97
|
const token = this.getToken();
|
|
98
|
-
const
|
|
99
|
-
const response = await usage.getCredits(token,
|
|
98
|
+
const iamUrl = this.getIamUrl();
|
|
99
|
+
const response = await usage.getCredits(token, iamUrl);
|
|
100
100
|
if (!response || !response.credits) {
|
|
101
101
|
throw new Error('Invalid response from credits API');
|
|
102
102
|
}
|
|
@@ -191,8 +191,8 @@ export function IAMMixin(Base) {
|
|
|
191
191
|
*/
|
|
192
192
|
async createSecret(data) {
|
|
193
193
|
const token = this.getToken();
|
|
194
|
-
const
|
|
195
|
-
const response = await secrets.createSecret(token, data,
|
|
194
|
+
const iamUrl = this.getIamUrl();
|
|
195
|
+
const response = await secrets.createSecret(token, data, iamUrl);
|
|
196
196
|
return new SecretDTO(response.secret, this);
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
@@ -201,8 +201,8 @@ export function IAMMixin(Base) {
|
|
|
201
201
|
*/
|
|
202
202
|
async listSecrets() {
|
|
203
203
|
const token = this.getToken();
|
|
204
|
-
const
|
|
205
|
-
const response = await secrets.listSecrets(token,
|
|
204
|
+
const iamUrl = this.getIamUrl();
|
|
205
|
+
const response = await secrets.listSecrets(token, iamUrl);
|
|
206
206
|
return response.secrets.map(s => new SecretDTO(s, this));
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
@@ -212,8 +212,8 @@ export function IAMMixin(Base) {
|
|
|
212
212
|
*/
|
|
213
213
|
async getSecret(secretId) {
|
|
214
214
|
const token = this.getToken();
|
|
215
|
-
const
|
|
216
|
-
const response = await secrets.getSecret(token, secretId,
|
|
215
|
+
const iamUrl = this.getIamUrl();
|
|
216
|
+
const response = await secrets.getSecret(token, secretId, iamUrl);
|
|
217
217
|
return new SecretDTO(response.secret, this);
|
|
218
218
|
}
|
|
219
219
|
/**
|
|
@@ -224,8 +224,8 @@ export function IAMMixin(Base) {
|
|
|
224
224
|
*/
|
|
225
225
|
async updateSecret(secretId, updates) {
|
|
226
226
|
const token = this.getToken();
|
|
227
|
-
const
|
|
228
|
-
const response = await secrets.updateSecret(token, secretId, updates,
|
|
227
|
+
const iamUrl = this.getIamUrl();
|
|
228
|
+
const response = await secrets.updateSecret(token, secretId, updates, iamUrl);
|
|
229
229
|
return new SecretDTO(response.secret, this);
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
@@ -234,8 +234,8 @@ export function IAMMixin(Base) {
|
|
|
234
234
|
*/
|
|
235
235
|
async deleteSecret(secretId) {
|
|
236
236
|
const token = this.getToken();
|
|
237
|
-
const
|
|
238
|
-
await secrets.deleteSecret(token, secretId,
|
|
237
|
+
const iamUrl = this.getIamUrl();
|
|
238
|
+
await secrets.deleteSecret(token, secretId, iamUrl);
|
|
239
239
|
}
|
|
240
240
|
// ========================================================================
|
|
241
241
|
// Datasources Management
|
|
@@ -247,8 +247,8 @@ export function IAMMixin(Base) {
|
|
|
247
247
|
*/
|
|
248
248
|
async createDatasource(data) {
|
|
249
249
|
const token = this.getToken();
|
|
250
|
-
const
|
|
251
|
-
const response = await datasources.createDatasource(token, data,
|
|
250
|
+
const iamUrl = this.getIamUrl();
|
|
251
|
+
const response = await datasources.createDatasource(token, data, iamUrl);
|
|
252
252
|
return new DatasourceDTO(response.datasource, this);
|
|
253
253
|
}
|
|
254
254
|
/**
|
|
@@ -257,8 +257,8 @@ export function IAMMixin(Base) {
|
|
|
257
257
|
*/
|
|
258
258
|
async listDatasources() {
|
|
259
259
|
const token = this.getToken();
|
|
260
|
-
const
|
|
261
|
-
const response = await datasources.listDatasources(token,
|
|
260
|
+
const iamUrl = this.getIamUrl();
|
|
261
|
+
const response = await datasources.listDatasources(token, iamUrl);
|
|
262
262
|
return response.datasources.map(d => new DatasourceDTO(d, this));
|
|
263
263
|
}
|
|
264
264
|
/**
|
|
@@ -268,8 +268,8 @@ export function IAMMixin(Base) {
|
|
|
268
268
|
*/
|
|
269
269
|
async getDatasource(datasourceId) {
|
|
270
270
|
const token = this.getToken();
|
|
271
|
-
const
|
|
272
|
-
const response = await datasources.getDatasource(token, datasourceId,
|
|
271
|
+
const iamUrl = this.getIamUrl();
|
|
272
|
+
const response = await datasources.getDatasource(token, datasourceId, iamUrl);
|
|
273
273
|
return new DatasourceDTO(response.datasource, this);
|
|
274
274
|
}
|
|
275
275
|
/**
|
|
@@ -280,8 +280,8 @@ export function IAMMixin(Base) {
|
|
|
280
280
|
*/
|
|
281
281
|
async updateDatasource(datasourceId, updates) {
|
|
282
282
|
const token = this.getToken();
|
|
283
|
-
const
|
|
284
|
-
const response = await datasources.updateDatasource(token, datasourceId, updates,
|
|
283
|
+
const iamUrl = this.getIamUrl();
|
|
284
|
+
const response = await datasources.updateDatasource(token, datasourceId, updates, iamUrl);
|
|
285
285
|
return new DatasourceDTO(response.datasource, this);
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
@@ -290,8 +290,8 @@ export function IAMMixin(Base) {
|
|
|
290
290
|
*/
|
|
291
291
|
async deleteDatasource(datasourceId) {
|
|
292
292
|
const token = this.getToken();
|
|
293
|
-
const
|
|
294
|
-
await datasources.deleteDatasource(token, datasourceId,
|
|
293
|
+
const iamUrl = this.getIamUrl();
|
|
294
|
+
await datasources.deleteDatasource(token, datasourceId, iamUrl);
|
|
295
295
|
}
|
|
296
296
|
};
|
|
297
297
|
}
|
|
@@ -22,7 +22,7 @@ export const Login = (props) => {
|
|
|
22
22
|
const loginMutation = useLogin();
|
|
23
23
|
const getOAuth2URLMutation = useOAuth2AuthorizationURL();
|
|
24
24
|
const { loginAndNavigate, setLogin } = useIAM();
|
|
25
|
-
const { externalToken, iamProvidersAuthorizationURL, addIAMProviderAuthorizationURL,
|
|
25
|
+
const { externalToken, iamProvidersAuthorizationURL, addIAMProviderAuthorizationURL, iamUrl, logout, checkIAMToken, } = useIAMStore();
|
|
26
26
|
const { enqueueToast } = useToast();
|
|
27
27
|
const navigate = useNavigate();
|
|
28
28
|
const [loading, setLoading] = useState(false);
|
|
@@ -76,7 +76,7 @@ export const Login = (props) => {
|
|
|
76
76
|
if (!iamProvidersAuthorizationURL[IAMProvidersSpecs.LinkedIn.name]) {
|
|
77
77
|
initIAMProvider(IAMProvidersSpecs.LinkedIn);
|
|
78
78
|
}
|
|
79
|
-
}, [
|
|
79
|
+
}, [iamUrl, iamProvidersAuthorizationURL, addIAMProviderAuthorizationURL]);
|
|
80
80
|
useEffect(() => {
|
|
81
81
|
if (externalToken) {
|
|
82
82
|
setLoadingWithToken(1);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns `true` when the given URL points to a real user avatar (i.e. not a
|
|
3
|
+
* Gravatar default placeholder).
|
|
4
|
+
*/
|
|
5
|
+
export declare function hasRealAvatar(url?: string): boolean;
|
|
6
|
+
export type UserAvatarProps = {
|
|
7
|
+
avatarUrl?: string;
|
|
8
|
+
/** Avatar edge length in pixels. Defaults to 100. */
|
|
9
|
+
size?: number;
|
|
10
|
+
/** Render with rounded square corners instead of a circle. Defaults to true. */
|
|
11
|
+
square?: boolean;
|
|
12
|
+
/** Fallback icon size. Defaults to ~48% of `size`. */
|
|
13
|
+
iconSize?: number;
|
|
14
|
+
};
|
|
15
|
+
export declare const UserAvatar: ({ avatarUrl, size, square, iconSize, }: UserAvatarProps) => JSX.Element;
|
|
16
|
+
export default UserAvatar;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
|
+
* Distributed under the terms of the Modified BSD License.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* UserAvatar – Single source of truth for rendering a user's avatar.
|
|
8
|
+
*
|
|
9
|
+
* When a real (non-Gravatar) avatar URL is available it renders a
|
|
10
|
+
* {@link DLAvatar}. Otherwise it falls back to a themed, colormoded
|
|
11
|
+
* {@link AlienIcon} placeholder so every consumer (profile, sidebar,
|
|
12
|
+
* principal overlay, …) shares the same default look.
|
|
13
|
+
*/
|
|
14
|
+
import { AlienIcon } from '@datalayer/icons-react';
|
|
15
|
+
import { Box, useColorPalette } from '@datalayer/primer-addons';
|
|
16
|
+
import { DLAvatar } from './DLAvatar.js';
|
|
17
|
+
/**
|
|
18
|
+
* Returns `true` when the given URL points to a real user avatar (i.e. not a
|
|
19
|
+
* Gravatar default placeholder).
|
|
20
|
+
*/
|
|
21
|
+
export function hasRealAvatar(url) {
|
|
22
|
+
if (!url) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
if (url.startsWith('https://www.gravatar.com/avatar')) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
export const UserAvatar = ({ avatarUrl, size = 100, square = true, iconSize, }) => {
|
|
31
|
+
const palette = useColorPalette();
|
|
32
|
+
if (hasRealAvatar(avatarUrl)) {
|
|
33
|
+
return _jsx(DLAvatar, { square: square, src: avatarUrl, size: size });
|
|
34
|
+
}
|
|
35
|
+
const resolvedIconSize = iconSize ?? Math.round(size * 0.48);
|
|
36
|
+
return (_jsx(Box, { sx: {
|
|
37
|
+
width: size,
|
|
38
|
+
height: size,
|
|
39
|
+
borderRadius: square ? 2 : '50%',
|
|
40
|
+
bg: 'accent.subtle',
|
|
41
|
+
display: 'flex',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
justifyContent: 'center',
|
|
44
|
+
'--datalayer-icon-fg': palette.primary,
|
|
45
|
+
}, children: _jsx(AlienIcon, { size: resolvedIconSize, themed: true, colormoded: true }) }));
|
|
46
|
+
};
|
|
47
|
+
export default UserAvatar;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
|
+
* Distributed under the terms of the Modified BSD License.
|
|
5
|
+
*/
|
|
2
6
|
/*
|
|
3
7
|
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
4
8
|
* Distributed under the terms of the Modified BSD License.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type DisplayHandleProps = {
|
|
3
|
+
handle?: string;
|
|
4
|
+
withAt?: boolean;
|
|
5
|
+
fallback?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const displayHandleText: (handle?: string, options?: {
|
|
8
|
+
withAt?: boolean;
|
|
9
|
+
fallback?: string;
|
|
10
|
+
}) => string;
|
|
11
|
+
export declare const DisplayHandle: React.FC<DisplayHandleProps>;
|
|
12
|
+
export default DisplayHandle;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { formatFriendlyHandle } from '../../utils/Handles.js';
|
|
3
|
+
export const displayHandleText = (handle, options) => {
|
|
4
|
+
const withAt = options?.withAt ?? true;
|
|
5
|
+
const fallback = options?.fallback ?? 'unknown';
|
|
6
|
+
const friendly = formatFriendlyHandle(handle);
|
|
7
|
+
const normalized = String(friendly || '').trim() || fallback;
|
|
8
|
+
return withAt ? `@${normalized}` : normalized;
|
|
9
|
+
};
|
|
10
|
+
export const DisplayHandle = ({ handle, withAt = true, fallback = 'unknown', }) => _jsx(_Fragment, { children: displayHandleText(handle, { withAt, fallback }) });
|
|
11
|
+
export default DisplayHandle;
|
|
@@ -2,6 +2,7 @@ export * from './AvatarSkeleton';
|
|
|
2
2
|
export * from './CenteredSpinner';
|
|
3
3
|
export * from './CodePreview';
|
|
4
4
|
export * from './DatalayerBox';
|
|
5
|
+
export * from './DisplayHandle';
|
|
5
6
|
export * from './HorizontalCenter';
|
|
6
7
|
export * from './JupyterDialog';
|
|
7
8
|
export * from './LiveRelativeTime';
|
|
@@ -6,6 +6,7 @@ export * from './AvatarSkeleton.js';
|
|
|
6
6
|
export * from './CenteredSpinner.js';
|
|
7
7
|
export * from './CodePreview.js';
|
|
8
8
|
export * from './DatalayerBox.js';
|
|
9
|
+
export * from './DisplayHandle.js';
|
|
9
10
|
export * from './HorizontalCenter.js';
|
|
10
11
|
export * from './JupyterDialog.js';
|
|
11
12
|
export * from './LiveRelativeTime.js';
|
package/lib/components/index.js
CHANGED
|
@@ -17,6 +17,8 @@ export type PrincipalDescriptor = {
|
|
|
17
17
|
kind: PrincipalKind;
|
|
18
18
|
uid?: string;
|
|
19
19
|
displayName: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
description?: string;
|
|
20
22
|
handle?: string;
|
|
21
23
|
accountHandle?: string;
|
|
22
24
|
firstName?: string;
|
|
@@ -31,6 +33,11 @@ export type PrincipalProps = {
|
|
|
31
33
|
avatarSize?: number;
|
|
32
34
|
gap?: number;
|
|
33
35
|
square?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum length of the placeholder (handle or uid) shown before the real
|
|
38
|
+
* display name resolves. Defaults to {@link DEFAULT_PLACEHOLDER_MAX_LENGTH}.
|
|
39
|
+
*/
|
|
40
|
+
placeholderMaxLength?: number;
|
|
34
41
|
sx?: any;
|
|
35
42
|
};
|
|
36
43
|
export declare const Principal: React.FC<PrincipalProps>;
|