@datalayer/core 0.0.19 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/lib/App.js +0 -5
  2. package/lib/api/iam/datasources.d.ts +86 -0
  3. package/lib/api/iam/datasources.js +185 -0
  4. package/lib/api/iam/index.d.ts +2 -0
  5. package/lib/api/iam/index.js +2 -0
  6. package/lib/api/iam/secrets.d.ts +85 -0
  7. package/lib/api/iam/secrets.js +196 -0
  8. package/lib/client/auth/storage.js +17 -62
  9. package/lib/client/base.d.ts +3 -0
  10. package/lib/client/base.js +2 -2
  11. package/lib/client/index.d.ts +82 -3
  12. package/lib/client/index.js +5 -1
  13. package/lib/client/mixins/IAMMixin.d.ts +62 -0
  14. package/lib/client/mixins/IAMMixin.js +116 -0
  15. package/lib/collaboration/DatalayerCollaboration.d.ts +1 -2
  16. package/lib/collaboration/DatalayerCollaborationProvider.d.ts +1 -1
  17. package/lib/collaboration/DatalayerCollaborationProvider.js +1 -1
  18. package/lib/components/auth/Login.js +0 -5
  19. package/lib/components/auth/index.js +1 -6
  20. package/lib/components/index.d.ts +0 -1
  21. package/lib/components/index.js +0 -1
  22. package/lib/components/toolbars/AssignmentEditorToolbar.js +9 -7
  23. package/lib/examples/CellExample.js +4 -3
  24. package/lib/examples/NotebookExample.js +2 -7
  25. package/lib/hooks/index.d.ts +0 -2
  26. package/lib/hooks/index.js +0 -2
  27. package/lib/hooks/useBackdrop.d.ts +2 -3
  28. package/lib/hooks/useBackdropJupyterLab.d.ts +2 -2
  29. package/lib/hooks/useCache.d.ts +18 -4
  30. package/lib/hooks/useCache.js +87 -69
  31. package/lib/hooks/useScreenshot.d.ts +2 -3
  32. package/lib/hooks/useWindowSize.d.ts +1 -2
  33. package/lib/index.d.ts +2 -1
  34. package/lib/index.js +6 -2
  35. package/lib/main.js +4 -1
  36. package/lib/models/Datasource.d.ts +170 -0
  37. package/lib/models/Datasource.js +140 -0
  38. package/lib/models/Runtime.d.ts +1 -1
  39. package/lib/models/RuntimeSnapshotDTO.d.ts +1 -1
  40. package/lib/models/RuntimeSnapshotDTO.js +1 -1
  41. package/lib/models/Secret.d.ts +159 -0
  42. package/lib/models/Secret.js +135 -0
  43. package/lib/models/SpaceDTO.d.ts +0 -11
  44. package/lib/models/index.d.ts +0 -1
  45. package/lib/models/index.js +0 -1
  46. package/lib/state/substates/IAMState.d.ts +1 -1
  47. package/lib/state/substates/LayoutState.d.ts +2 -2
  48. package/lib/state/substates/NbformatState.d.ts +1 -1
  49. package/lib/state/substates/index.d.ts +0 -1
  50. package/lib/state/substates/index.js +0 -1
  51. package/lib/utils/File.d.ts +1 -1
  52. package/lib/utils/File.js +1 -1
  53. package/lib/utils/Notebook.d.ts +5 -3
  54. package/lib/utils/Notebook.js +5 -3
  55. package/lib/utils/cli/index.js +0 -5
  56. package/lib/utils/cli/query.js +0 -5
  57. package/lib/views/datasources/DatasourceDetail.d.ts +2 -0
  58. package/lib/views/datasources/DatasourceDetail.js +91 -0
  59. package/lib/views/datasources/DatasourceNew.d.ts +2 -0
  60. package/lib/views/datasources/DatasourceNew.js +118 -0
  61. package/lib/views/datasources/Datasources.d.ts +2 -0
  62. package/lib/views/datasources/Datasources.js +49 -0
  63. package/lib/views/datasources/index.d.ts +3 -0
  64. package/lib/views/datasources/index.js +7 -0
  65. package/lib/views/iam-tokens/IAMTokenEdit.d.ts +2 -0
  66. package/lib/views/iam-tokens/IAMTokenEdit.js +86 -0
  67. package/lib/views/iam-tokens/IAMTokenNew.d.ts +2 -0
  68. package/lib/views/iam-tokens/IAMTokenNew.js +118 -0
  69. package/lib/views/iam-tokens/IAMTokens.d.ts +2 -0
  70. package/lib/views/iam-tokens/IAMTokens.js +53 -0
  71. package/lib/views/iam-tokens/Tokens.d.ts +2 -0
  72. package/lib/views/iam-tokens/Tokens.js +53 -0
  73. package/lib/views/iam-tokens/index.d.ts +3 -0
  74. package/lib/views/iam-tokens/index.js +7 -0
  75. package/lib/views/index.d.ts +1 -0
  76. package/lib/views/secrets/SecretEdit.d.ts +2 -0
  77. package/lib/views/secrets/SecretEdit.js +149 -0
  78. package/lib/views/secrets/SecretNew.d.ts +2 -0
  79. package/lib/views/secrets/SecretNew.js +99 -0
  80. package/lib/views/secrets/Secrets.d.ts +2 -0
  81. package/lib/views/secrets/Secrets.js +48 -0
  82. package/lib/views/secrets/index.d.ts +3 -0
  83. package/lib/views/secrets/index.js +7 -0
  84. package/package.json +15 -16
  85. package/patches/.gitkeep +1 -0
  86. package/patches/@datalayer+jupyter-lexical+1.0.7.patch +5491 -0
  87. package/patches/@datalayer+jupyter-react+2.0.1.patch +2674 -0
  88. package/scripts/apply-patches.sh +44 -0
  89. package/scripts/create-patches.sh +40 -0
  90. package/scripts/fix-esm-imports.cjs +124 -0
  91. package/scripts/sync-jupyter.sh +121 -0
  92. package/lib/components/chat/ChatComponent.d.ts +0 -4
  93. package/lib/components/chat/ChatComponent.js +0 -143
  94. package/lib/components/chat/MessagePart.d.ts +0 -11
  95. package/lib/components/chat/MessagePart.js +0 -23
  96. package/lib/components/chat/display/DynamicToolPart.d.ts +0 -6
  97. package/lib/components/chat/display/DynamicToolPart.js +0 -5
  98. package/lib/components/chat/display/ReasoningPart.d.ts +0 -6
  99. package/lib/components/chat/display/ReasoningPart.js +0 -58
  100. package/lib/components/chat/display/TextPart.d.ts +0 -9
  101. package/lib/components/chat/display/TextPart.js +0 -93
  102. package/lib/components/chat/display/ToolPart.d.ts +0 -6
  103. package/lib/components/chat/display/ToolPart.js +0 -148
  104. package/lib/components/chat/display/index.d.ts +0 -4
  105. package/lib/components/chat/display/index.js +0 -13
  106. package/lib/components/chat/handler.d.ts +0 -8
  107. package/lib/components/chat/handler.js +0 -43
  108. package/lib/components/chat/index.d.ts +0 -4
  109. package/lib/components/chat/index.js +0 -13
  110. package/lib/hooks/useAIAgents.d.ts +0 -13
  111. package/lib/hooks/useAIAgents.js +0 -72
  112. package/lib/hooks/useAIJupyterChat.d.ts +0 -36
  113. package/lib/hooks/useAIJupyterChat.js +0 -53
  114. package/lib/hooks/useNotebookAIAgent.d.ts +0 -8
  115. package/lib/hooks/useNotebookAIAgent.js +0 -56
  116. package/lib/models/AIAgent.d.ts +0 -17
  117. package/lib/state/substates/AIAgentState.d.ts +0 -11
  118. package/lib/state/substates/AIAgentState.js +0 -42
  119. package/lib/tools/adapters/agui/AgUIToolAdapter.d.ts +0 -75
  120. package/lib/tools/adapters/agui/AgUIToolAdapter.js +0 -244
  121. package/lib/tools/adapters/agui/index.d.ts +0 -10
  122. package/lib/tools/adapters/agui/index.js +0 -19
  123. package/lib/tools/adapters/agui/lexicalHooks.d.ts +0 -27
  124. package/lib/tools/adapters/agui/lexicalHooks.js +0 -64
  125. package/lib/tools/adapters/agui/notebookHooks.d.ts +0 -27
  126. package/lib/tools/adapters/agui/notebookHooks.js +0 -61
  127. package/lib/tools/index.d.ts +0 -6
  128. package/lib/tools/index.js +0 -18
  129. package/lib/{models/AIAgent.js → views/index.js} +1 -1
@@ -0,0 +1,53 @@
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
+ */
6
+ import { useState, useEffect } from 'react';
7
+ import { PageLayout, Button, IconButton, Text, Label, RelativeTime, } from '@primer/react';
8
+ import { Blankslate, PageHeader, Table, DataTable, } from '@primer/react/experimental';
9
+ import { Box } from '@datalayer/primer-addons';
10
+ import { EditIcon } from '@datalayer/icons-react';
11
+ import { useCache, useNavigate } from '../../hooks';
12
+ const TokensTable = () => {
13
+ const { useTokens } = useCache();
14
+ const getTokensQuery = useTokens();
15
+ const navigate = useNavigate();
16
+ const [tokens, setTokens] = useState([]);
17
+ useEffect(() => {
18
+ if (getTokensQuery.data) {
19
+ setTokens(getTokensQuery.data);
20
+ }
21
+ }, [getTokensQuery.data]);
22
+ return tokens.length === 0 ? (_jsxs(Blankslate, { border: true, spacious: true, children: [_jsx(Blankslate.Heading, { children: "IAM Tokens" }), _jsx(Blankslate.Description, { children: _jsx(Text, { sx: { textAlign: 'center' }, children: "No IAM Tokens found." }) })] })) : (_jsxs(Table.Container, { children: [_jsx(Table.Title, { as: "h2", id: "tokens", children: "IAM Tokens" }), _jsx(Table.Subtitle, { as: "p", id: "tokens-subtitle", children: "Your tokens." }), _jsx(DataTable, { "aria-labelledby": "teams", "aria-describedby": "teams-subtitle", data: tokens, columns: [
23
+ {
24
+ header: 'Type',
25
+ field: 'variant',
26
+ renderCell: token => _jsx(Label, { children: token.variant }),
27
+ },
28
+ {
29
+ header: 'Name',
30
+ field: 'name',
31
+ rowHeader: true,
32
+ },
33
+ {
34
+ header: 'Description',
35
+ field: 'description',
36
+ },
37
+ {
38
+ header: 'Expiration date',
39
+ field: 'expirationDate',
40
+ renderCell: token => (_jsx(RelativeTime, { date: new Date(token.expirationDate) })),
41
+ },
42
+ {
43
+ header: '',
44
+ field: 'id',
45
+ renderCell: token => (_jsx(IconButton, { icon: EditIcon, "aria-label": "Edit", size: "small", variant: "invisible", onClick: e => navigate(`${token.id}`, e) })),
46
+ },
47
+ ] })] }));
48
+ };
49
+ export const IAMTokens = () => {
50
+ const navigate = useNavigate();
51
+ return (_jsxs(PageLayout, { containerWidth: "full", padding: "normal", style: { overflow: 'visible', minHeight: 'calc(100vh - 45px)' }, children: [_jsx(PageLayout.Header, { children: _jsxs(PageHeader, { children: [_jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "IAM Tokens" }) }), _jsx(PageHeader.Actions, { children: _jsx(Button, { size: "small", variant: "primary", onClick: e => navigate('/new/token', e), children: "New IAM token" }) })] }) }), _jsx(PageLayout.Content, { children: _jsx(Box, { children: _jsx(TokensTable, {}) }) })] }));
52
+ };
53
+ export default IAMTokens;
@@ -0,0 +1,2 @@
1
+ export declare const Tokens: () => import("react/jsx-runtime").JSX.Element;
2
+ export default Tokens;
@@ -0,0 +1,53 @@
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
+ */
6
+ import { useState, useEffect } from 'react';
7
+ import { PageLayout, Button, IconButton, Text, Label, RelativeTime, } from '@primer/react';
8
+ import { Blankslate, PageHeader, Table, DataTable, } from '@primer/react/experimental';
9
+ import { Box } from '@datalayer/primer-addons';
10
+ import { EditIcon } from '@datalayer/icons-react';
11
+ import { useCache, useNavigate } from '../../hooks';
12
+ const TokensTable = () => {
13
+ const { useTokens } = useCache();
14
+ const getTokensQuery = useTokens();
15
+ const navigate = useNavigate();
16
+ const [tokens, setTokens] = useState([]);
17
+ useEffect(() => {
18
+ if (getTokensQuery.data) {
19
+ setTokens(getTokensQuery.data);
20
+ }
21
+ }, [getTokensQuery.data]);
22
+ return tokens.length === 0 ? (_jsxs(Blankslate, { border: true, spacious: true, children: [_jsx(Blankslate.Heading, { children: "Tokens" }), _jsx(Blankslate.Description, { children: _jsx(Text, { sx: { textAlign: 'center' }, children: "No Tokens found." }) })] })) : (_jsxs(Table.Container, { children: [_jsx(Table.Title, { as: "h2", id: "tokens", children: "Tokens" }), _jsx(Table.Subtitle, { as: "p", id: "tokens-subtitle", children: "Your tokens." }), _jsx(DataTable, { "aria-labelledby": "teams", "aria-describedby": "teams-subtitle", data: tokens, columns: [
23
+ {
24
+ header: 'Type',
25
+ field: 'variant',
26
+ renderCell: token => _jsx(Label, { children: token.variant }),
27
+ },
28
+ {
29
+ header: 'Name',
30
+ field: 'name',
31
+ rowHeader: true,
32
+ },
33
+ {
34
+ header: 'Description',
35
+ field: 'description',
36
+ },
37
+ {
38
+ header: 'Expiration date',
39
+ field: 'expirationDate',
40
+ renderCell: token => (_jsx(RelativeTime, { date: new Date(token.expirationDate) })),
41
+ },
42
+ {
43
+ header: '',
44
+ field: 'id',
45
+ renderCell: token => (_jsx(IconButton, { icon: EditIcon, "aria-label": "Edit", size: "small", variant: "invisible", onClick: e => navigate(`${token.id}`, e) })),
46
+ },
47
+ ] })] }));
48
+ };
49
+ export const Tokens = () => {
50
+ const navigate = useNavigate();
51
+ return (_jsxs(PageLayout, { containerWidth: "full", padding: "normal", style: { overflow: 'visible', minHeight: 'calc(100vh - 45px)' }, children: [_jsx(PageLayout.Header, { children: _jsxs(PageHeader, { children: [_jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "Tokens" }) }), _jsx(PageHeader.Actions, { children: _jsx(Button, { size: "small", variant: "primary", onClick: e => navigate('/new/token', e), children: "New token" }) })] }) }), _jsx(PageLayout.Content, { children: _jsx(Box, { children: _jsx(TokensTable, {}) }) })] }));
52
+ };
53
+ export default Tokens;
@@ -0,0 +1,3 @@
1
+ export * from './IAMTokenEdit';
2
+ export * from './IAMTokenNew';
3
+ export * from './IAMTokens';
@@ -0,0 +1,7 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ export * from './IAMTokenEdit';
6
+ export * from './IAMTokenNew';
7
+ export * from './IAMTokens';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const SecretEdit: () => import("react/jsx-runtime").JSX.Element;
2
+ export default SecretEdit;
@@ -0,0 +1,149 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2023-2025 Datalayer, Inc.
4
+ * Distributed under the terms of the Modified BSD License.
5
+ */
6
+ import { useState, useEffect } from 'react';
7
+ import { useParams } from 'react-router-dom';
8
+ import { PageHeader, Heading, Text, Button, TextInput, FormControl, Textarea, Label, } from '@primer/react';
9
+ import { Box } from '@datalayer/primer-addons';
10
+ import { EyeIcon, EyeClosedIcon } from '@primer/octicons-react';
11
+ import { BoringAvatar } from '../../components/avatars';
12
+ import { useCache, useNavigate, useToast } from '../../hooks';
13
+ import { useRunStore } from '../../state';
14
+ export const SecretEdit = () => {
15
+ const { secretId } = useParams();
16
+ const runStore = useRunStore();
17
+ const navigate = useNavigate();
18
+ const { enqueueToast } = useToast();
19
+ const { useUpdateSecret, useSecret, useDeleteSecret } = useCache();
20
+ const updateSecretMutation = useUpdateSecret();
21
+ const deleteSecretMutation = useDeleteSecret();
22
+ const secretQuery = useSecret(secretId, {
23
+ refetchOnMount: true,
24
+ });
25
+ const [secret, setSecret] = useState();
26
+ const [formValues, setFormValues] = useState({
27
+ name: '',
28
+ nameConfirm: '',
29
+ description: '',
30
+ value: '',
31
+ });
32
+ const [validationResult, setValidationResult] = useState({
33
+ name: undefined,
34
+ nameConfirm: undefined,
35
+ description: undefined,
36
+ value: undefined,
37
+ });
38
+ const [passwordVisible, setPasswordVisible] = useState(false);
39
+ useEffect(() => {
40
+ if (secretQuery.data) {
41
+ const secret = secretQuery.data;
42
+ setSecret(secret);
43
+ setFormValues({
44
+ name: secret.name || '',
45
+ nameConfirm: '',
46
+ description: secret.description || '',
47
+ value: secret.value ? atob(secret.value) : '',
48
+ });
49
+ }
50
+ }, [secretQuery.data]);
51
+ const secretNameChanged = (event) => {
52
+ setFormValues(prevFormValues => ({
53
+ ...prevFormValues,
54
+ name: event.target.value,
55
+ }));
56
+ };
57
+ const secretNameConfirmChanged = (event) => {
58
+ setFormValues(prevFormValues => ({
59
+ ...prevFormValues,
60
+ nameConfirm: event.target.value,
61
+ }));
62
+ };
63
+ const secretDescriptionChanged = (event) => {
64
+ setFormValues(prevFormValues => ({
65
+ ...prevFormValues,
66
+ description: event.target.value,
67
+ }));
68
+ };
69
+ const secretValueChanged = (event) => {
70
+ setFormValues(prevFormValues => ({
71
+ ...prevFormValues,
72
+ value: event.target.value,
73
+ }));
74
+ };
75
+ useEffect(() => {
76
+ setValidationResult({
77
+ ...validationResult,
78
+ name: formValues.name === undefined
79
+ ? undefined
80
+ : formValues.name.length > 2
81
+ ? true
82
+ : false,
83
+ nameConfirm: formValues.nameConfirm === secret?.name ? true : false,
84
+ description: formValues.description === undefined
85
+ ? undefined
86
+ : formValues.description.length > 2
87
+ ? true
88
+ : false,
89
+ value: formValues.value === undefined
90
+ ? undefined
91
+ : formValues.value.length > 0 && formValues.value.length < 4096
92
+ ? true
93
+ : false,
94
+ });
95
+ }, [formValues]);
96
+ const submitUpdate = async () => {
97
+ runStore.layout().showBackdrop('Updating the secret...');
98
+ secret.name = formValues.name;
99
+ secret.description = formValues.description;
100
+ secret.value = btoa(formValues.value);
101
+ updateSecretMutation.mutate(secret, {
102
+ onSuccess: (resp) => {
103
+ if (resp.success) {
104
+ enqueueToast('The secret is successfully updated.', {
105
+ variant: 'success',
106
+ });
107
+ setSecret(secret);
108
+ }
109
+ },
110
+ onSettled: () => {
111
+ runStore.layout().hideBackdrop();
112
+ },
113
+ });
114
+ };
115
+ const submitDelete = async () => {
116
+ runStore.layout().showBackdrop('Deleting the secret...');
117
+ deleteSecretMutation.mutate(secret.id, {
118
+ onSuccess: (resp) => {
119
+ if (resp.success) {
120
+ enqueueToast('The secret is successfully deleted.', {
121
+ variant: 'success',
122
+ });
123
+ navigate(`/settings/iam/secrets`);
124
+ }
125
+ },
126
+ onSettled: () => {
127
+ runStore.layout().hideBackdrop();
128
+ },
129
+ });
130
+ };
131
+ return (_jsxs(_Fragment, { children: [_jsx(PageHeader, { children: _jsx(Heading, { sx: { fontSize: 3 }, children: "Secret" }) }), _jsxs(Box, { display: "flex", children: [_jsxs(Box, { children: [_jsx(BoringAvatar, { displayName: secret?.name, size: 100, style: { paddingRight: 10 } }), _jsx(Text, { as: "h2", sx: { paddingTop: 3 }, children: secret?.name }), _jsx(Box, { mt: 3, children: _jsx(Label, { size: "large", children: secret?.variant }) })] }), _jsxs(Box, { ml: 10, children: [_jsxs(Box, { sx: { label: { marginTop: 2 } }, children: [_jsxs(FormControl, { children: [_jsx(FormControl.Label, { children: "Name" }), _jsx(TextInput, { block: true, value: formValues.name, onChange: secretNameChanged }), validationResult.name === false && (_jsx(FormControl.Validation, { variant: "error", children: "Name must have more than 2 characters." }))] }), _jsxs(FormControl, { children: [_jsx(FormControl.Label, { children: "Description" }), _jsx(Textarea, { block: true, value: formValues.description, onChange: secretDescriptionChanged, rows: 5 }), validationResult.description === false && (_jsx(FormControl.Validation, { variant: "error", children: "Description must have more than 2 characters." }))] }), _jsxs(FormControl, { children: [_jsx(FormControl.Label, { children: "Value" }), _jsx(TextInput, { placeholder: "Value", monospace: true, size: "large", contrast: !passwordVisible, disabled: !passwordVisible, onChange: secretValueChanged, type: passwordVisible ? 'text' : 'password', value: formValues.value, trailingAction: _jsx(TextInput.Action, { onClick: () => {
132
+ setPasswordVisible(!passwordVisible);
133
+ }, icon: passwordVisible ? EyeClosedIcon : EyeIcon, "aria-label": passwordVisible ? 'Hide secret' : 'Reveal secret', sx: { color: 'var(--fgColor-muted)' } }), sx: { overflow: 'visible' } }), validationResult.value === false && (_jsx(FormControl.Validation, { variant: "error", children: "Value must have more than 1 and less than 4096 characters." }))] }), _jsx(Box, { sx: { marginTop: 3 }, children: _jsx(Button, { variant: "primary", disabled: !validationResult.name || !validationResult.description, onClick: submitUpdate, children: "Update secret" }) })] }), _jsxs(Box, { sx: { marginTop: 3 }, children: [_jsx(Heading, { as: "h2", sx: {
134
+ fontSize: 4,
135
+ fontWeight: 'normal',
136
+ color: 'danger.fg',
137
+ mb: 2,
138
+ }, children: "Danger zone" }), _jsxs(Box, { sx: {
139
+ border: '1px solid',
140
+ borderColor: 'danger.emphasis',
141
+ borderRadius: 2,
142
+ p: 3,
143
+ display: 'flex',
144
+ alignItems: 'center',
145
+ justifyContent: 'space-between',
146
+ gap: 3,
147
+ }, children: [_jsxs(Box, { sx: { display: 'grid', gap: 1 }, children: [_jsx(Text, { sx: { fontSize: 1, fontWeight: 'bold', color: 'danger.fg' }, children: "Confirm the secret name to delete" }), _jsx(FormControl, { children: _jsx(TextInput, { block: true, value: formValues.nameConfirm, onChange: secretNameConfirmChanged }) }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "This operation is not reversible." })] }), _jsx(Button, { variant: "danger", disabled: !validationResult.nameConfirm, onClick: submitDelete, children: "Delete secret" })] })] })] })] })] }));
148
+ };
149
+ export default SecretEdit;
@@ -0,0 +1,2 @@
1
+ export declare const SecretNew: () => import("react/jsx-runtime").JSX.Element;
2
+ export default SecretNew;
@@ -0,0 +1,99 @@
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
+ */
6
+ import { useEffect, useState } from 'react';
7
+ import { PageHeader, FormControl, Button, TextInput, Textarea, Select, } from '@primer/react';
8
+ import { Box } from '@datalayer/primer-addons';
9
+ import { useCache, useNavigate, useToast } from '../../hooks';
10
+ import { useRunStore } from '../../state';
11
+ export const SecretNew = () => {
12
+ const runStore = useRunStore();
13
+ const navigate = useNavigate();
14
+ const { useCreateSecret } = useCache();
15
+ const createSecretMutation = useCreateSecret();
16
+ const { enqueueToast } = useToast();
17
+ const [formValues, setFormValues] = useState({
18
+ variant: 'generic',
19
+ value: undefined,
20
+ name: undefined,
21
+ description: undefined,
22
+ });
23
+ const [validationResult, setValidationResult] = useState({
24
+ variant: undefined,
25
+ value: undefined,
26
+ name: undefined,
27
+ description: undefined,
28
+ });
29
+ const secretVariantChanged = (event) => {
30
+ setFormValues(prevFormValues => ({
31
+ ...prevFormValues,
32
+ variant: event.target.value,
33
+ }));
34
+ };
35
+ const secretValueChanged = (event) => {
36
+ setFormValues(prevFormValues => ({
37
+ ...prevFormValues,
38
+ value: event.target.value,
39
+ }));
40
+ };
41
+ const secretNameChanged = (event) => {
42
+ setFormValues(prevFormValues => ({
43
+ ...prevFormValues,
44
+ name: event.target.value,
45
+ }));
46
+ };
47
+ const secretDescriptionChanged = (event) => {
48
+ setFormValues(prevFormValues => ({
49
+ ...prevFormValues,
50
+ description: event.target.value,
51
+ }));
52
+ };
53
+ useEffect(() => {
54
+ setValidationResult({
55
+ ...validationResult,
56
+ name: formValues.name === undefined
57
+ ? undefined
58
+ : formValues.name.length > 2
59
+ ? true
60
+ : false,
61
+ description: formValues.description === undefined
62
+ ? undefined
63
+ : formValues.description.length > 2
64
+ ? true
65
+ : false,
66
+ value: formValues.value === undefined
67
+ ? undefined
68
+ : formValues.value.length > 0 && formValues.value.length < 4096
69
+ ? true
70
+ : false,
71
+ });
72
+ }, [formValues]);
73
+ const submitCreate = () => {
74
+ runStore.layout().showBackdrop('Creating an secret...');
75
+ createSecretMutation.mutate({
76
+ variant: formValues.variant,
77
+ name: formValues.name,
78
+ description: formValues.description,
79
+ value: btoa(formValues.value),
80
+ }, {
81
+ onSuccess: (resp) => {
82
+ if (resp.success) {
83
+ enqueueToast(resp.message, { variant: 'success' });
84
+ navigate(`/settings/iam/secrets`);
85
+ }
86
+ },
87
+ onSettled: () => {
88
+ runStore.layout().hideBackdrop();
89
+ },
90
+ });
91
+ };
92
+ return (_jsxs(Box, { children: [_jsx(PageHeader, { children: _jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "New Secret" }) }) }), _jsx(Box, { display: "grid", gridTemplateColumns: "1fr 1fr", sx: { gap: 3 }, children: _jsx(Box, { children: _jsxs(Box, { sx: { label: { marginTop: 2 } }, children: [_jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Secret type" }), _jsxs(Select, { name: "type", value: formValues.variant, onChange: secretVariantChanged, children: [_jsx(Select.Option, { value: "generic", children: "Generic" }), _jsx(Select.Option, { value: "password", children: "Password" }), _jsx(Select.Option, { value: "key", children: "Key" }), _jsx(Select.Option, { value: "token", children: "Token" })] }), _jsx(FormControl.Caption, { children: "Pick the most appropriate secret type." })] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Name" }), _jsx(TextInput, { block: true, value: formValues.name, onChange: secretNameChanged, autoFocus: true }), _jsx(FormControl.Caption, { children: "Hint: The secret name is a short name that identifies in a unique way your secret." }), validationResult.name === false && (_jsx(FormControl.Validation, { variant: "error", children: "Name length must be between 2 and 32 characters." }))] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Description" }), _jsx(Textarea, { block: true, value: formValues.description, onChange: secretDescriptionChanged, rows: 3 }), validationResult.description === false && (_jsx(FormControl.Validation, { variant: "error", children: "Description must have more than 2 characters." }))] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Value" }), _jsx(Textarea, { block: true, value: formValues.value, onChange: secretValueChanged, rows: 5 }), validationResult.value === false && (_jsx(FormControl.Validation, { variant: "error", children: "Value must have more than 1 and less than 4096 characters." }))] }), _jsx(Button, { variant: "primary", disabled: !validationResult.value ||
93
+ !validationResult.name ||
94
+ !validationResult.description, sx: { marginTop: 2 }, onClick: e => {
95
+ e.preventDefault();
96
+ submitCreate();
97
+ }, children: "Create a secret" })] }) }) })] }));
98
+ };
99
+ export default SecretNew;
@@ -0,0 +1,2 @@
1
+ export declare const Secrets: () => import("react/jsx-runtime").JSX.Element;
2
+ export default Secrets;
@@ -0,0 +1,48 @@
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
+ */
6
+ import { useState, useEffect } from 'react';
7
+ import { PageLayout, Button, IconButton, Text, Label } from '@primer/react';
8
+ import { Blankslate, PageHeader, Table, DataTable, } from '@primer/react/experimental';
9
+ import { Box } from '@datalayer/primer-addons';
10
+ import { EditIcon } from '@datalayer/icons-react';
11
+ import { useCache, useNavigate } from '../../hooks';
12
+ const SecretsTable = () => {
13
+ const { useSecrets } = useCache();
14
+ const secretsQuery = useSecrets();
15
+ const navigate = useNavigate();
16
+ const [secrets, setSecrets] = useState([]);
17
+ useEffect(() => {
18
+ if (secretsQuery.data) {
19
+ setSecrets(secretsQuery.data || []);
20
+ }
21
+ }, [secretsQuery.data]);
22
+ return secrets.length === 0 ? (_jsxs(Blankslate, { border: true, spacious: true, children: [_jsx(Blankslate.Heading, { children: "Secrets" }), _jsx(Blankslate.Description, { children: _jsx(Text, { sx: { textAlign: 'center' }, children: "No Secrets found." }) })] })) : (_jsxs(Table.Container, { children: [_jsx(Table.Title, { as: "h2", id: "secrets", children: "Secrets" }), _jsx(DataTable, { "aria-labelledby": "secrets", "aria-describedby": "secrets-subtitle", data: secrets, columns: [
23
+ {
24
+ header: 'Type',
25
+ field: 'variant',
26
+ renderCell: secret => _jsx(Label, { children: secret.variant }),
27
+ },
28
+ {
29
+ header: 'Name',
30
+ field: 'name',
31
+ rowHeader: true,
32
+ },
33
+ {
34
+ header: 'Description',
35
+ field: 'description',
36
+ },
37
+ {
38
+ header: '',
39
+ field: 'id',
40
+ renderCell: secret => (_jsx(IconButton, { icon: EditIcon, "aria-label": "Edit", size: "small", variant: "invisible", onClick: e => navigate(`${secret.id}`, e) })),
41
+ },
42
+ ] })] }));
43
+ };
44
+ export const Secrets = () => {
45
+ const navigate = useNavigate();
46
+ return (_jsxs(PageLayout, { containerWidth: "full", padding: "normal", style: { overflow: 'visible', minHeight: 'calc(100vh - 45px)' }, children: [_jsx(PageLayout.Header, { children: _jsxs(PageHeader, { children: [_jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "Secrets" }) }), _jsx(PageHeader.Actions, { children: _jsx(Button, { size: "small", variant: "primary", onClick: e => navigate('/new/secret', e), children: "New secret" }) })] }) }), _jsx(PageLayout.Content, { children: _jsx(Box, { children: _jsx(SecretsTable, {}) }) })] }));
47
+ };
48
+ export default Secrets;
@@ -0,0 +1,3 @@
1
+ export * from './SecretEdit';
2
+ export * from './SecretNew';
3
+ export * from './Secrets';
@@ -0,0 +1,7 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ export * from './SecretEdit';
6
+ export * from './SecretNew';
7
+ export * from './Secrets';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/core",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  ".",
@@ -22,7 +22,9 @@
22
22
  "files": [
23
23
  "lib/**/*.{css,d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
24
24
  "style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
25
- "schema/*.json"
25
+ "schema/*.json",
26
+ "patches/",
27
+ "scripts/"
26
28
  ],
27
29
  "main": "lib/index.js",
28
30
  "types": "lib/index.d.ts",
@@ -50,7 +52,7 @@
50
52
  "clean:dist": "rimraf dist",
51
53
  "clean:cache": "rimraf node_modules/.vite",
52
54
  "build": "npm run clean && gulp resources-to-lib && tsc -b && vite build",
53
- "build:lib": "npm run clean:lib && gulp resources-to-lib && tsc -b",
55
+ "build:lib": "npm run clean:lib && gulp resources-to-lib && tsc -b && node scripts/fix-esm-imports.cjs",
54
56
  "build:types": "npm run clean:lib && tsc -b",
55
57
  "build:nextjs": "npm run build --workspace=nextjs-notebook-example",
56
58
  "build:examples": "npm run build:nextjs",
@@ -81,16 +83,17 @@
81
83
  "storybook": "storybook dev -p 6006",
82
84
  "build-storybook": "storybook build",
83
85
  "typedoc": "typedoc --options typedoc.json --out docs/docs/typescript_api",
86
+ "docs": "make typedoc && make pydoc && cd docs && npm install && npm run build",
84
87
  "watch:lib": "run-p 'watch:lib:*'",
85
88
  "watch:lib:res": "gulp resources-to-lib-watch",
86
89
  "watch:lib:src": "tsc -b -w",
87
90
  "type-check:watch": "tsc -b -w --noEmit",
88
- "examples": "vite --config vite.examples.config.ts",
89
- "examples:chat": "run-p jupyter:start example:chat:vite",
90
- "examples:chat:vite": "EXAMPLE=ChatExample vite --config vite.examples.config.ts",
91
+ "examples": "run-p jupyter:start examples:vite",
92
+ "examples:vite": "VITE_DATALAYER_RUN_URL=http://localhost:8888 vite --config vite.examples.config.ts",
91
93
  "examples:nextjs": "npm run dev --workspace=nextjs-notebook-example",
92
94
  "jupyter:start": "./dev/sh/start-jupyter-server.sh",
93
- "prepare": "husky",
95
+ "prepare": "husky || true",
96
+ "postinstall": "bash scripts/apply-patches.sh",
94
97
  "kill": "./dev/sh/kill.sh || true",
95
98
  "sync:jupyter": "bash scripts/sync-jupyter.sh",
96
99
  "sync:jupyter:watch": "bash scripts/sync-jupyter.sh --watch",
@@ -100,14 +103,12 @@
100
103
  "rebuild:fresh": "npm run create:patches && npm install && npm run build && npm run clean:cache"
101
104
  },
102
105
  "dependencies": {
103
- "@ai-sdk/react": "^2.0.34",
104
- "@copilotkit/react-core": "^1.10.6",
105
- "@copilotkit/react-ui": "^1.10.6",
106
106
  "@datalayer/icons-react": "^1.0.6",
107
- "@datalayer/jupyter-lexical": "^1.0.6",
108
- "@datalayer/jupyter-react": "^1.1.8",
107
+ "@datalayer/jupyter-lexical": "^1.0.7",
108
+ "@datalayer/jupyter-react": "^2.0.0",
109
109
  "@datalayer/primer-addons": "^1.0.4",
110
110
  "@datalayer/primer-rjsf": "^1.0.1",
111
+ "@fluentui/react": "^8.125.3",
111
112
  "@jupyter-widgets/base-manager": "^1.0.12",
112
113
  "@jupyter-widgets/schema": "^0.5.6",
113
114
  "@jupyterlab/apputils": "^4.6.0",
@@ -119,7 +120,6 @@
119
120
  "@jupyterlab/services": "^7.0.0",
120
121
  "@jupyterlab/translation": "^4.5.0",
121
122
  "@jupyterlab/ui-components": "^4.5.0",
122
- "@jupyterlite/javascript-kernel-extension": "^0.3.0",
123
123
  "@lumino/commands": "^2.3.3",
124
124
  "@lumino/coreutils": "^2.2.2",
125
125
  "@lumino/datagrid": "^2.5.3",
@@ -140,13 +140,12 @@
140
140
  "@tailwindcss/vite": "^4.1.13",
141
141
  "@tanstack/react-query": "^5.90.6",
142
142
  "@toon-format/toon": "^1.3.0",
143
- "ai": "^5.0.78",
144
143
  "ansi-to-html": "^0.7.2",
145
144
  "axios": "^1.7.7",
146
145
  "boring-avatars": "^2.0.1",
147
- "buffer": "^6.0.3",
148
146
  "date-fns": "^2.29.3",
149
147
  "deepmerge": "^4.3.1",
148
+ "diff": "^8.0.2",
150
149
  "echarts": "^5.5.0",
151
150
  "echarts-for-react": "^3.0.2",
152
151
  "fuse.js": "^7.0.0",
@@ -174,6 +173,7 @@
174
173
  "uuid": "^13.0.0",
175
174
  "validator": "^13.7.0",
176
175
  "zod": "^4.1.13",
176
+ "zod-to-json-schema": "^3.25.0",
177
177
  "zustand": "^4.4.1"
178
178
  },
179
179
  "peerDependencies": {
@@ -203,7 +203,6 @@
203
203
  "@vitest/coverage-v8": "^3.2.4",
204
204
  "abort-controller": "^3.0.0",
205
205
  "autoprefixer": "^10.4.21",
206
- "buffer": "^6.0.3",
207
206
  "crypto-browserify": "^3.12.1",
208
207
  "dotenv": "^17.2.2",
209
208
  "eslint": "^9.29.0",
@@ -0,0 +1 @@
1
+ # Patches directory for patch-package