@datalayer/core 0.0.18 → 0.0.20
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/lib/App.js +0 -5
- package/lib/components/auth/Login.js +0 -5
- package/lib/components/auth/index.js +1 -6
- package/lib/components/index.d.ts +0 -1
- package/lib/components/index.js +0 -1
- package/lib/components/toolbars/AssignmentEditorToolbar.js +9 -7
- package/lib/examples/CellExample.js +4 -3
- package/lib/examples/NotebookExample.js +2 -7
- package/lib/hooks/index.d.ts +0 -2
- package/lib/hooks/index.js +0 -2
- package/lib/hooks/useCache.d.ts +15 -1
- package/lib/hooks/useCache.js +87 -69
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/main.js +4 -1
- package/lib/models/index.d.ts +0 -1
- package/lib/models/index.js +0 -1
- package/lib/state/substates/index.d.ts +0 -1
- package/lib/state/substates/index.js +0 -1
- package/lib/utils/cli/index.js +0 -5
- package/lib/utils/cli/query.js +0 -5
- package/lib/views/datasources/DatasourceDetail.d.ts +2 -0
- package/lib/views/datasources/DatasourceDetail.js +91 -0
- package/lib/views/datasources/DatasourceNew.d.ts +2 -0
- package/lib/views/datasources/DatasourceNew.js +118 -0
- package/lib/views/datasources/Datasources.d.ts +2 -0
- package/lib/views/datasources/Datasources.js +49 -0
- package/lib/views/datasources/index.d.ts +3 -0
- package/lib/views/datasources/index.js +7 -0
- package/lib/views/iam-tokens/IAMTokenEdit.d.ts +2 -0
- package/lib/views/iam-tokens/IAMTokenEdit.js +86 -0
- package/lib/views/iam-tokens/IAMTokenNew.d.ts +2 -0
- package/lib/views/iam-tokens/IAMTokenNew.js +118 -0
- package/lib/views/iam-tokens/IAMTokens.d.ts +2 -0
- package/lib/views/iam-tokens/IAMTokens.js +53 -0
- package/lib/views/iam-tokens/Tokens.d.ts +2 -0
- package/lib/views/iam-tokens/Tokens.js +53 -0
- package/lib/views/iam-tokens/index.d.ts +3 -0
- package/lib/views/iam-tokens/index.js +7 -0
- package/lib/views/index.d.ts +1 -0
- package/lib/views/secrets/SecretEdit.d.ts +2 -0
- package/lib/views/secrets/SecretEdit.js +149 -0
- package/lib/views/secrets/SecretNew.d.ts +2 -0
- package/lib/views/secrets/SecretNew.js +99 -0
- package/lib/views/secrets/Secrets.d.ts +2 -0
- package/lib/views/secrets/Secrets.js +48 -0
- package/lib/views/secrets/index.d.ts +3 -0
- package/lib/views/secrets/index.js +7 -0
- package/package.json +8 -12
- package/lib/components/chat/ChatComponent.d.ts +0 -4
- package/lib/components/chat/ChatComponent.js +0 -143
- package/lib/components/chat/MessagePart.d.ts +0 -11
- package/lib/components/chat/MessagePart.js +0 -23
- package/lib/components/chat/display/DynamicToolPart.d.ts +0 -6
- package/lib/components/chat/display/DynamicToolPart.js +0 -5
- package/lib/components/chat/display/ReasoningPart.d.ts +0 -6
- package/lib/components/chat/display/ReasoningPart.js +0 -58
- package/lib/components/chat/display/TextPart.d.ts +0 -9
- package/lib/components/chat/display/TextPart.js +0 -93
- package/lib/components/chat/display/ToolPart.d.ts +0 -6
- package/lib/components/chat/display/ToolPart.js +0 -148
- package/lib/components/chat/display/index.d.ts +0 -4
- package/lib/components/chat/display/index.js +0 -13
- package/lib/components/chat/handler.d.ts +0 -8
- package/lib/components/chat/handler.js +0 -43
- package/lib/components/chat/index.d.ts +0 -4
- package/lib/components/chat/index.js +0 -13
- package/lib/hooks/useAIAgents.d.ts +0 -13
- package/lib/hooks/useAIAgents.js +0 -72
- package/lib/hooks/useAIJupyterChat.d.ts +0 -36
- package/lib/hooks/useAIJupyterChat.js +0 -53
- package/lib/hooks/useNotebookAIAgent.d.ts +0 -8
- package/lib/hooks/useNotebookAIAgent.js +0 -56
- package/lib/models/AIAgent.d.ts +0 -17
- package/lib/state/substates/AIAgentState.d.ts +0 -11
- package/lib/state/substates/AIAgentState.js +0 -42
- package/lib/tools/adapters/agui/AgUIToolAdapter.d.ts +0 -75
- package/lib/tools/adapters/agui/AgUIToolAdapter.js +0 -244
- package/lib/tools/adapters/agui/index.d.ts +0 -10
- package/lib/tools/adapters/agui/index.js +0 -19
- package/lib/tools/adapters/agui/lexicalHooks.d.ts +0 -27
- package/lib/tools/adapters/agui/lexicalHooks.js +0 -64
- package/lib/tools/adapters/agui/notebookHooks.d.ts +0 -27
- package/lib/tools/adapters/agui/notebookHooks.js +0 -61
- package/lib/tools/index.d.ts +0 -6
- package/lib/tools/index.js +0 -18
- package/lib/{models/AIAgent.js → views/index.js} +1 -1
package/lib/App.js
CHANGED
|
@@ -3,11 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
8
|
-
*
|
|
9
|
-
* MIT License
|
|
10
|
-
*/
|
|
11
6
|
import { useState } from 'react';
|
|
12
7
|
import reactLogo from './assets/react.svg';
|
|
13
8
|
import { useJupyter, JupyterReactTheme } from '@datalayer/jupyter-react';
|
|
@@ -3,11 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
8
|
-
*
|
|
9
|
-
* Datalayer License
|
|
10
|
-
*/
|
|
11
6
|
import { useEffect, useState } from 'react';
|
|
12
7
|
import { PageConfig, URLExt } from '@jupyterlab/coreutils';
|
|
13
8
|
import { EyeIcon, EyeClosedIcon, MarkGithubIcon } from '@primer/octicons-react';
|
|
@@ -2,15 +2,10 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
/**
|
|
11
6
|
* Authentication components for Datalayer platform
|
|
12
7
|
*/
|
|
13
8
|
export * from './Login';
|
|
14
|
-
// LoginCLI is excluded from build - it's meant for CLI apps with full routing
|
|
9
|
+
// LoginCLI is excluded from build - it's meant for CLI apps with full routing.
|
|
15
10
|
// export * from './LoginCLI';
|
|
16
11
|
export * from './LoginToken';
|
package/lib/components/index.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { 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
|
-
import { Button
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { Button } from '@primer/react';
|
|
7
|
+
import { Box } from '@datalayer/primer-addons';
|
|
8
|
+
import { RepoPushIcon } from '@primer/octicons-react';
|
|
9
|
+
// import { PlayIcon, StopIcon } from '@primer/octicons-react';
|
|
10
|
+
// import { notebookStore } from '@datalayer/jupyter-react';
|
|
9
11
|
import { useGradeStore } from '../../state';
|
|
10
12
|
export const AssignmentEditorToolbar = (props) => {
|
|
11
|
-
const { notebookId } = props;
|
|
13
|
+
// const { notebookId } = props;
|
|
14
|
+
// const notebook = notebookStore.getState().selectNotebook(notebookId);
|
|
12
15
|
const { grade } = useGradeStore();
|
|
13
|
-
|
|
14
|
-
return (_jsxs(Box, { display: "flex", children: [_jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: RepoPushIcon, onClick: () => grade(new Date()), children: "Grade" }) }), notebook?.kernelStatus !== 'busy' && (_jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: PlayIcon, onClick: e => notebookStore.getState().runAll(notebookId), children: "Run all" }) })), notebook?.kernelStatus === 'busy' && (_jsx(Box, { children: _jsx(Button, { variant: "danger", size: "small", leadingVisual: StopIcon, onClick: e => notebookStore.getState().interrupt(notebookId), children: "Interrupt" }) }))] }));
|
|
16
|
+
return (_jsx(Box, { display: "flex", children: _jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: RepoPushIcon, onClick: () => grade(new Date()), children: "Grade" }) }) }));
|
|
15
17
|
};
|
|
16
18
|
export default AssignmentEditorToolbar;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { JupyterReactTheme, Cell, KernelIndicator, useJupyter, useKernelsStore, useCellsStore, } from '@datalayer/jupyter-react';
|
|
3
3
|
import { Button, Label } from '@primer/react';
|
|
4
4
|
import { Box } from '@datalayer/primer-addons';
|
|
5
5
|
const CELL_ID = 'cell-example-1';
|
|
@@ -7,13 +7,14 @@ const DEFAULT_SOURCE = `from IPython.display import display
|
|
|
7
7
|
|
|
8
8
|
for i in range(10):
|
|
9
9
|
display('I am a long string which is repeatedly added to the dom in separated divs: %d' % i)`;
|
|
10
|
-
const CellExampleContent = () => {
|
|
10
|
+
const CellExampleContent = (props) => {
|
|
11
|
+
// const { serviceManager } = props;
|
|
11
12
|
const { defaultKernel } = useJupyter({ startDefaultKernel: true });
|
|
12
13
|
const cellsStore = useCellsStore();
|
|
13
14
|
const kernelsStore = useKernelsStore();
|
|
14
15
|
return (_jsxs(Box, { p: 4, children: [_jsx(Box, { as: "h1", children: "A Jupyter Cell" }), _jsxs(Box, { children: ["Source: ", cellsStore.getSource(CELL_ID)] }), _jsxs(Box, { children: ["Outputs Count: ", cellsStore.getOutputsCount(CELL_ID)] }), _jsxs(Box, { children: ["Kernel State:", ' ', _jsx(Label, { children: defaultKernel && kernelsStore.getExecutionState(defaultKernel.id) })] }), _jsxs(Box, { children: ["Kernel Phase:", ' ', _jsx(Label, { children: defaultKernel && kernelsStore.getExecutionPhase(defaultKernel.id) })] }), _jsxs(Box, { display: "flex", children: [_jsx(Box, { children: "Kernel Indicator:" }), _jsx(Box, { ml: 3, children: _jsx(KernelIndicator, { kernel: defaultKernel && defaultKernel.connection }) })] }), _jsx(Box, { children: _jsx(Button, { onClick: () => cellsStore.execute(CELL_ID), children: "Run cell" }) }), _jsx(Cell, { source: DEFAULT_SOURCE, id: CELL_ID, kernel: defaultKernel })] }));
|
|
15
16
|
};
|
|
16
17
|
export const CellExample = (props) => {
|
|
17
|
-
return (_jsx(
|
|
18
|
+
return (_jsx(JupyterReactTheme, { children: _jsx(CellExampleContent, { ...props }) }));
|
|
18
19
|
};
|
|
19
20
|
export default CellExample;
|
|
@@ -3,14 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
8
|
-
*
|
|
9
|
-
* MIT License
|
|
10
|
-
*/
|
|
11
6
|
import { useMemo } from 'react';
|
|
12
7
|
import { Box } from '@datalayer/primer-addons';
|
|
13
|
-
import {
|
|
8
|
+
import { Notebook, NotebookToolbar, CellSidebarExtension, CellSidebarButton, } from '@datalayer/jupyter-react';
|
|
14
9
|
import nbformatExample from './notebooks/NotebookExample1.ipynb.json';
|
|
15
10
|
const NOTEBOOK_ID = 'notebook-example-1';
|
|
16
11
|
export const NotebookExample = (props) => {
|
|
@@ -19,6 +14,6 @@ export const NotebookExample = (props) => {
|
|
|
19
14
|
if (!serviceManager) {
|
|
20
15
|
return (_jsxs(Box, { as: "h1", children: ["A Jupyter Notebook", _jsx("div", { children: "Loading..." })] }));
|
|
21
16
|
}
|
|
22
|
-
return (_jsxs(_Fragment, { children: [_jsx(Box, { as: "h1", children: "A Jupyter Notebook" }), _jsx(
|
|
17
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, { as: "h1", children: "A Jupyter Notebook" }), _jsx(Notebook, { id: NOTEBOOK_ID, nbformat: nbformatExample, serviceManager: serviceManager, startDefaultKernel: true, extensions: extensions, Toolbar: NotebookToolbar })] }));
|
|
23
18
|
};
|
|
24
19
|
export default NotebookExample;
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './useAIAgents';
|
|
2
1
|
export * from './useAuthorization';
|
|
3
2
|
export * from './useBackdrop';
|
|
4
3
|
export * from './useBackdropJupyterLab';
|
|
@@ -17,7 +16,6 @@ export * from './useLocation';
|
|
|
17
16
|
export * from './useLocationHandles';
|
|
18
17
|
export * from './useNavigate';
|
|
19
18
|
export * from './useParams';
|
|
20
|
-
export * from './useNotebookAIAgent';
|
|
21
19
|
export * from './useOnClickOutside';
|
|
22
20
|
export * from './useRef';
|
|
23
21
|
export * from './useRuntimes';
|
package/lib/hooks/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
export * from './useAIAgents';
|
|
6
5
|
export * from './useAuthorization';
|
|
7
6
|
export * from './useBackdrop';
|
|
8
7
|
export * from './useBackdropJupyterLab';
|
|
@@ -22,7 +21,6 @@ export * from './useLocation';
|
|
|
22
21
|
export * from './useLocationHandles';
|
|
23
22
|
export * from './useNavigate';
|
|
24
23
|
export * from './useParams';
|
|
25
|
-
export * from './useNotebookAIAgent';
|
|
26
24
|
export * from './useOnClickOutside';
|
|
27
25
|
export * from './useRef';
|
|
28
26
|
export * from './useRuntimes';
|
package/lib/hooks/useCache.d.ts
CHANGED
|
@@ -515,6 +515,7 @@ export declare const useCache: ({ loginRoute }?: CacheProps) => {
|
|
|
515
515
|
name: string;
|
|
516
516
|
description?: string;
|
|
517
517
|
notebookType?: string;
|
|
518
|
+
file?: File;
|
|
518
519
|
}, unknown>;
|
|
519
520
|
useUpdateNotebook: () => import("@tanstack/react-query").UseMutationResult<any, Error, {
|
|
520
521
|
id: string;
|
|
@@ -530,6 +531,13 @@ export declare const useCache: ({ loginRoute }?: CacheProps) => {
|
|
|
530
531
|
useRefreshSpaceNotebooks: (options?: UseMutationOptions<unknown, Error, string>) => import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
531
532
|
useDocument: (documentId: string) => import("@tanstack/react-query").UseQueryResult<IDocument, Error>;
|
|
532
533
|
useDocumentsBySpace: (spaceId: string) => import("@tanstack/react-query").UseQueryResult<any, Error>;
|
|
534
|
+
useCreateDocument: () => import("@tanstack/react-query").UseMutationResult<any, Error, {
|
|
535
|
+
spaceId: string;
|
|
536
|
+
name: string;
|
|
537
|
+
description?: string;
|
|
538
|
+
documentType?: string;
|
|
539
|
+
file?: File;
|
|
540
|
+
}, unknown>;
|
|
533
541
|
useUpdateDocument: () => import("@tanstack/react-query").UseMutationResult<any, Error, {
|
|
534
542
|
id: string;
|
|
535
543
|
name: string;
|
|
@@ -645,7 +653,10 @@ export declare const useCache: ({ loginRoute }?: CacheProps) => {
|
|
|
645
653
|
useDatasources: () => import("@tanstack/react-query").UseQueryResult<any, Error>;
|
|
646
654
|
useCreateDatasource: () => import("@tanstack/react-query").UseMutationResult<any, Error, Omit<IDatasource, "id">, unknown>;
|
|
647
655
|
useUpdateDatasource: () => import("@tanstack/react-query").UseMutationResult<any, Error, IDatasource, unknown>;
|
|
648
|
-
useSecret: (secretId: string
|
|
656
|
+
useSecret: (secretId: string, options?: {
|
|
657
|
+
enabled?: boolean;
|
|
658
|
+
refetchOnMount?: boolean;
|
|
659
|
+
}) => import("@tanstack/react-query").UseQueryResult<ISecret | null | undefined, Error>;
|
|
649
660
|
useSecrets: () => import("@tanstack/react-query").UseQueryResult<any, Error>;
|
|
650
661
|
useCreateSecret: () => import("@tanstack/react-query").UseMutationResult<any, Error, Omit<ISecret, "id">, unknown>;
|
|
651
662
|
useUpdateSecret: () => import("@tanstack/react-query").UseMutationResult<any, Error, ISecret, unknown>;
|
|
@@ -957,5 +968,8 @@ export declare const useCache: ({ loginRoute }?: CacheProps) => {
|
|
|
957
968
|
notebookUploadLoading: boolean;
|
|
958
969
|
notebookUploadProgress: number;
|
|
959
970
|
resetNotebookUpload: () => void;
|
|
971
|
+
documentUploadLoading: boolean;
|
|
972
|
+
documentUploadProgress: number;
|
|
973
|
+
resetDocumentUpload: () => void;
|
|
960
974
|
};
|
|
961
975
|
export default useCache;
|
package/lib/hooks/useCache.js
CHANGED
|
@@ -322,6 +322,8 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
322
322
|
const { checkIsOrganizationMember } = useAuthorization();
|
|
323
323
|
// Hook for notebook upload/creation
|
|
324
324
|
const { isLoading: notebookUploadLoading, uploadAndSubmit: uploadNotebook, progress: notebookUploadProgress, reset: resetNotebookUpload, } = useUploadForm(`${coreStore.configuration.spacerRunUrl}/api/spacer/v1/notebooks`);
|
|
325
|
+
// Hook for document upload/creation
|
|
326
|
+
const { isLoading: documentUploadLoading, uploadAndSubmit: uploadDocument, progress: documentUploadProgress, reset: resetDocumentUpload, } = useUploadForm(`${coreStore.configuration.spacerRunUrl}/api/spacer/v1/lexicals`);
|
|
325
327
|
// ============================================================================
|
|
326
328
|
// Transformation Functions (kept from original useCache)
|
|
327
329
|
// Note: These functions use 'any' because they handle dynamic API responses
|
|
@@ -1384,12 +1386,15 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1384
1386
|
*/
|
|
1385
1387
|
const useCreateNotebook = () => {
|
|
1386
1388
|
return useMutation({
|
|
1387
|
-
mutationFn: async ({ spaceId, name, description, notebookType = 'notebook', }) => {
|
|
1389
|
+
mutationFn: async ({ spaceId, name, description, notebookType = 'notebook', file, }) => {
|
|
1388
1390
|
const formData = new FormData();
|
|
1389
1391
|
formData.append('spaceId', spaceId);
|
|
1390
1392
|
formData.append('notebookType', notebookType);
|
|
1391
1393
|
formData.append('name', name);
|
|
1392
1394
|
formData.append('description', description || '');
|
|
1395
|
+
if (file) {
|
|
1396
|
+
formData.append('file', file);
|
|
1397
|
+
}
|
|
1393
1398
|
const resp = await uploadNotebook(formData);
|
|
1394
1399
|
return resp;
|
|
1395
1400
|
},
|
|
@@ -1398,10 +1403,12 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1398
1403
|
const notebook = toNotebook(resp.notebook);
|
|
1399
1404
|
// Set detail cache
|
|
1400
1405
|
queryClient.setQueryData(queryKeys.notebooks.detail(notebook.id), notebook);
|
|
1401
|
-
//
|
|
1402
|
-
queryClient.
|
|
1406
|
+
// Refetch all notebook queries immediately (including bySpace)
|
|
1407
|
+
queryClient.refetchQueries({
|
|
1403
1408
|
queryKey: queryKeys.notebooks.all(),
|
|
1404
1409
|
});
|
|
1410
|
+
// Refetch space items lists immediately
|
|
1411
|
+
queryClient.refetchQueries({ queryKey: queryKeys.items.all() });
|
|
1405
1412
|
}
|
|
1406
1413
|
},
|
|
1407
1414
|
});
|
|
@@ -1473,16 +1480,12 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1473
1480
|
const notebook = toNotebook(resp.notebook);
|
|
1474
1481
|
// Set detail cache
|
|
1475
1482
|
queryClient.setQueryData(queryKeys.notebooks.detail(notebook.id), notebook);
|
|
1476
|
-
//
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
queryKey: queryKeys.notebooks.bySpace(spaceIdStr),
|
|
1483
|
-
});
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1483
|
+
// Refetch all notebook queries immediately
|
|
1484
|
+
queryClient.refetchQueries({
|
|
1485
|
+
queryKey: queryKeys.notebooks.all(),
|
|
1486
|
+
});
|
|
1487
|
+
// Refetch space items lists immediately
|
|
1488
|
+
queryClient.refetchQueries({ queryKey: queryKeys.items.all() });
|
|
1486
1489
|
}
|
|
1487
1490
|
},
|
|
1488
1491
|
});
|
|
@@ -1586,6 +1589,38 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1586
1589
|
},
|
|
1587
1590
|
});
|
|
1588
1591
|
};
|
|
1592
|
+
/**
|
|
1593
|
+
* Create document
|
|
1594
|
+
*/
|
|
1595
|
+
const useCreateDocument = () => {
|
|
1596
|
+
return useMutation({
|
|
1597
|
+
mutationFn: async ({ spaceId, name, description, documentType = 'document', file, }) => {
|
|
1598
|
+
const formData = new FormData();
|
|
1599
|
+
formData.append('spaceId', spaceId);
|
|
1600
|
+
formData.append('documentType', documentType);
|
|
1601
|
+
formData.append('name', name);
|
|
1602
|
+
formData.append('description', description || '');
|
|
1603
|
+
if (file) {
|
|
1604
|
+
formData.append('file', file);
|
|
1605
|
+
}
|
|
1606
|
+
const resp = await uploadDocument(formData);
|
|
1607
|
+
return resp;
|
|
1608
|
+
},
|
|
1609
|
+
onSuccess: (resp, _variables) => {
|
|
1610
|
+
if (resp.success && resp.document) {
|
|
1611
|
+
const document = toDocument(resp.document);
|
|
1612
|
+
// Set detail cache
|
|
1613
|
+
queryClient.setQueryData(queryKeys.documents.detail(document.id), document);
|
|
1614
|
+
// Refetch all document queries immediately (including bySpace)
|
|
1615
|
+
queryClient.refetchQueries({
|
|
1616
|
+
queryKey: queryKeys.documents.all(),
|
|
1617
|
+
});
|
|
1618
|
+
// Refetch space items lists immediately
|
|
1619
|
+
queryClient.refetchQueries({ queryKey: queryKeys.items.all() });
|
|
1620
|
+
}
|
|
1621
|
+
},
|
|
1622
|
+
});
|
|
1623
|
+
};
|
|
1589
1624
|
/**
|
|
1590
1625
|
* Clone document
|
|
1591
1626
|
*/
|
|
@@ -1602,16 +1637,12 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1602
1637
|
const doc = toDocument(resp.document);
|
|
1603
1638
|
// Set detail cache
|
|
1604
1639
|
queryClient.setQueryData(queryKeys.documents.detail(doc.id), doc);
|
|
1605
|
-
//
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
queryKey: queryKeys.documents.bySpace(spaceIdStr),
|
|
1612
|
-
});
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1640
|
+
// Refetch all document queries immediately
|
|
1641
|
+
queryClient.refetchQueries({
|
|
1642
|
+
queryKey: queryKeys.documents.all(),
|
|
1643
|
+
});
|
|
1644
|
+
// Refetch space items lists immediately
|
|
1645
|
+
queryClient.refetchQueries({ queryKey: queryKeys.items.all() });
|
|
1615
1646
|
}
|
|
1616
1647
|
},
|
|
1617
1648
|
});
|
|
@@ -1826,6 +1857,7 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1826
1857
|
return [];
|
|
1827
1858
|
},
|
|
1828
1859
|
...DEFAULT_QUERY_OPTIONS,
|
|
1860
|
+
refetchOnMount: true, // Override to refetch when stale after invalidation
|
|
1829
1861
|
});
|
|
1830
1862
|
};
|
|
1831
1863
|
/**
|
|
@@ -1896,6 +1928,7 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1896
1928
|
return [];
|
|
1897
1929
|
},
|
|
1898
1930
|
...DEFAULT_QUERY_OPTIONS,
|
|
1931
|
+
refetchOnMount: true, // Override to refetch when stale after invalidation
|
|
1899
1932
|
});
|
|
1900
1933
|
};
|
|
1901
1934
|
/**
|
|
@@ -2159,7 +2192,7 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
2159
2192
|
/**
|
|
2160
2193
|
* Get single secret by ID
|
|
2161
2194
|
*/
|
|
2162
|
-
const useSecret = (secretId) => {
|
|
2195
|
+
const useSecret = (secretId, options) => {
|
|
2163
2196
|
return useQuery({
|
|
2164
2197
|
queryKey: queryKeys.secrets.detail(secretId),
|
|
2165
2198
|
queryFn: async () => {
|
|
@@ -2173,7 +2206,8 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
2173
2206
|
return null;
|
|
2174
2207
|
},
|
|
2175
2208
|
...DEFAULT_QUERY_OPTIONS,
|
|
2176
|
-
enabled: !!secretId,
|
|
2209
|
+
enabled: options?.enabled ?? !!secretId,
|
|
2210
|
+
refetchOnMount: options?.refetchOnMount ?? DEFAULT_QUERY_OPTIONS.refetchOnMount,
|
|
2177
2211
|
});
|
|
2178
2212
|
};
|
|
2179
2213
|
/**
|
|
@@ -3352,17 +3386,12 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
3352
3386
|
const cell = toCell(resp.cell);
|
|
3353
3387
|
// Set detail cache
|
|
3354
3388
|
queryClient.setQueryData(queryKeys.cells.detail(cell.id), cell);
|
|
3355
|
-
//
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
queryClient.invalidateQueries({
|
|
3362
|
-
queryKey: queryKeys.cells.bySpace(spaceIdStr),
|
|
3363
|
-
});
|
|
3364
|
-
}
|
|
3365
|
-
}
|
|
3389
|
+
// Refetch all cell queries immediately
|
|
3390
|
+
queryClient.refetchQueries({
|
|
3391
|
+
queryKey: queryKeys.cells.all(),
|
|
3392
|
+
});
|
|
3393
|
+
// Refetch space items lists immediately
|
|
3394
|
+
queryClient.refetchQueries({ queryKey: queryKeys.items.all() });
|
|
3366
3395
|
}
|
|
3367
3396
|
},
|
|
3368
3397
|
});
|
|
@@ -3530,17 +3559,12 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
3530
3559
|
const lesson = toLesson(resp.notebook);
|
|
3531
3560
|
// Set detail cache
|
|
3532
3561
|
queryClient.setQueryData(queryKeys.lessons.detail(lesson.id), lesson);
|
|
3533
|
-
//
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
queryClient.invalidateQueries({
|
|
3540
|
-
queryKey: queryKeys.lessons.bySpace(spaceIdStr),
|
|
3541
|
-
});
|
|
3542
|
-
}
|
|
3543
|
-
}
|
|
3562
|
+
// Refetch all lesson queries immediately
|
|
3563
|
+
queryClient.refetchQueries({
|
|
3564
|
+
queryKey: queryKeys.lessons.all(),
|
|
3565
|
+
});
|
|
3566
|
+
// Refetch space items lists immediately
|
|
3567
|
+
queryClient.refetchQueries({ queryKey: queryKeys.items.all() });
|
|
3544
3568
|
}
|
|
3545
3569
|
},
|
|
3546
3570
|
});
|
|
@@ -3632,17 +3656,12 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
3632
3656
|
const exercise = toExercise(resp.exercise);
|
|
3633
3657
|
// Set detail cache
|
|
3634
3658
|
queryClient.setQueryData(queryKeys.exercises.detail(exercise.id), exercise);
|
|
3635
|
-
//
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
queryClient.invalidateQueries({
|
|
3642
|
-
queryKey: queryKeys.exercises.bySpace(spaceIdStr),
|
|
3643
|
-
});
|
|
3644
|
-
}
|
|
3645
|
-
}
|
|
3659
|
+
// Refetch all exercise queries immediately
|
|
3660
|
+
queryClient.refetchQueries({
|
|
3661
|
+
queryKey: queryKeys.exercises.all(),
|
|
3662
|
+
});
|
|
3663
|
+
// Refetch space items lists immediately
|
|
3664
|
+
queryClient.refetchQueries({ queryKey: queryKeys.items.all() });
|
|
3646
3665
|
}
|
|
3647
3666
|
},
|
|
3648
3667
|
});
|
|
@@ -3703,17 +3722,12 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
3703
3722
|
const assignment = toAssignment(resp.notebook);
|
|
3704
3723
|
// Set detail cache
|
|
3705
3724
|
queryClient.setQueryData(queryKeys.assignments.detail(assignment.id), assignment);
|
|
3706
|
-
//
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
queryClient.invalidateQueries({
|
|
3713
|
-
queryKey: queryKeys.assignments.bySpace(spaceIdStr),
|
|
3714
|
-
});
|
|
3715
|
-
}
|
|
3716
|
-
}
|
|
3725
|
+
// Refetch all assignment queries immediately
|
|
3726
|
+
queryClient.refetchQueries({
|
|
3727
|
+
queryKey: queryKeys.assignments.all(),
|
|
3728
|
+
});
|
|
3729
|
+
// Refetch space items lists immediately
|
|
3730
|
+
queryClient.refetchQueries({ queryKey: queryKeys.items.all() });
|
|
3717
3731
|
}
|
|
3718
3732
|
},
|
|
3719
3733
|
});
|
|
@@ -6046,6 +6060,7 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
6046
6060
|
// Documents
|
|
6047
6061
|
useDocument,
|
|
6048
6062
|
useDocumentsBySpace,
|
|
6063
|
+
useCreateDocument,
|
|
6049
6064
|
useUpdateDocument,
|
|
6050
6065
|
useUpdateDocumentModel,
|
|
6051
6066
|
useCloneDocument,
|
|
@@ -6189,6 +6204,9 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
6189
6204
|
notebookUploadLoading,
|
|
6190
6205
|
notebookUploadProgress,
|
|
6191
6206
|
resetNotebookUpload,
|
|
6207
|
+
documentUploadLoading,
|
|
6208
|
+
documentUploadProgress,
|
|
6209
|
+
resetDocumentUpload,
|
|
6192
6210
|
};
|
|
6193
6211
|
};
|
|
6194
6212
|
export default useCache;
|
package/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './collaboration';
|
|
|
5
5
|
export * from './services';
|
|
6
6
|
export * from './navigation';
|
|
7
7
|
export * from './hooks';
|
|
8
|
+
export * from './theme';
|
|
8
9
|
export { requestDatalayerAPI, RunResponseError, NetworkError, } from './api/DatalayerApi';
|
|
9
10
|
export type { IRequestDatalayerAPIOptions } from './api/DatalayerApi';
|
|
10
11
|
export { API_BASE_PATHS } from './api/constants';
|
package/lib/index.js
CHANGED
|
@@ -11,7 +11,9 @@ export * from './services';
|
|
|
11
11
|
// Export navigation before hooks to avoid conflicts
|
|
12
12
|
export * from './navigation';
|
|
13
13
|
export * from './hooks';
|
|
14
|
-
// Export
|
|
14
|
+
// Export Theme.
|
|
15
|
+
export * from './theme';
|
|
16
|
+
// Export APIs.
|
|
15
17
|
export { requestDatalayerAPI, RunResponseError, NetworkError, } from './api/DatalayerApi';
|
|
16
18
|
export { API_BASE_PATHS } from './api/constants';
|
|
17
19
|
export * as runtimesApi from './api/runtimes';
|
package/lib/main.js
CHANGED
|
@@ -6,4 +6,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
6
6
|
import { createRoot } from 'react-dom/client';
|
|
7
7
|
import App from './App';
|
|
8
8
|
import './index.css';
|
|
9
|
-
|
|
9
|
+
const rootElement = document.getElementById('root');
|
|
10
|
+
if (rootElement) {
|
|
11
|
+
createRoot(rootElement).render(_jsx(App, {}));
|
|
12
|
+
}
|
package/lib/models/index.d.ts
CHANGED
package/lib/models/index.js
CHANGED
package/lib/utils/cli/index.js
CHANGED
package/lib/utils/cli/query.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2021-2024 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
import { QueryClient } from '@tanstack/react-query';
|
|
11
6
|
/**
|
|
12
7
|
* Shared QueryClient instance for TanStack Query
|