@malloy-publisher/sdk 0.0.382-dev → 0.2.1
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 +115 -95
- package/TREE_SHAKING.md +16 -11
- package/bunfig.toml +7 -0
- package/dist/ServerProvider-Cn_LhKda.cjs.js +1 -0
- package/dist/ServerProvider-sfabtriY.es.js +4076 -0
- package/dist/client/api.d.ts +3773 -1515
- package/dist/client/configuration.d.ts +1 -1
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.es.js +86 -59
- package/dist/components/Connections/EditConnectionDialog.d.ts +2 -1
- package/dist/components/Connections/common.d.ts +8 -2
- package/dist/components/Dashboard/Dashboard.d.ts +62 -0
- package/dist/components/Dashboard/DashboardTile.d.ts +57 -0
- package/dist/components/Dashboard/index.d.ts +2 -0
- package/dist/components/DataAppViewer/DataAppViewer.d.ts +23 -0
- package/dist/components/DataAppViewer/index.d.ts +1 -0
- package/dist/components/Environment/Environment.d.ts +6 -0
- package/dist/components/Environment/index.d.ts +2 -0
- package/dist/components/Home/AddEnvironmentDialog.d.ts +1 -0
- package/dist/components/Home/DeleteEnvironmentDialog.d.ts +5 -0
- package/dist/components/Home/EditEnvironmentDialog.d.ts +7 -0
- package/dist/components/Home/Home.d.ts +2 -2
- package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +14 -0
- package/dist/components/Materializations/CreateMaterializationDialog.d.ts +10 -0
- package/dist/components/Materializations/DeleteMaterializationDialog.d.ts +7 -0
- package/dist/components/Materializations/EnvironmentMaterializations.d.ts +7 -0
- package/dist/components/Materializations/ManifestView.d.ts +13 -0
- package/dist/components/Materializations/MaterializationDetailDialog.d.ts +9 -0
- package/dist/components/Materializations/MaterializationRunsList.d.ts +15 -0
- package/dist/components/Materializations/Materializations.d.ts +7 -0
- package/dist/components/Materializations/ScheduleCard.d.ts +20 -0
- package/dist/components/Materializations/SectionLabel.d.ts +10 -0
- package/dist/components/Materializations/SetScheduleDialog.d.ts +11 -0
- package/dist/components/Materializations/TriggerChip.d.ts +10 -0
- package/dist/components/Materializations/cron.d.ts +23 -0
- package/dist/components/Materializations/index.d.ts +2 -0
- package/dist/components/Materializations/utils.d.ts +46 -0
- package/dist/components/Notebook/Notebook.d.ts +47 -4
- package/dist/components/Notebook/NotebookCell.d.ts +37 -1
- package/dist/components/Notebook/runPlan.d.ts +29 -0
- package/dist/components/Notebook/types.d.ts +10 -0
- package/dist/components/Package/ContentTypeIcon.d.ts +31 -0
- package/dist/components/Package/Package.d.ts +1 -4
- package/dist/components/RenderedResult/RenderedResult.d.ts +7 -1
- package/dist/components/RenderedResult/ResultContainer.d.ts +5 -1
- package/dist/components/RenderedResult/renderLogs.d.ts +6 -0
- package/dist/components/ResultsDialog.d.ts +6 -1
- package/dist/components/ServerProvider.d.ts +28 -4
- package/dist/components/click_helper.d.ts +10 -1
- package/dist/components/drill/index.d.ts +3 -0
- package/dist/components/drill/markDrillableCells.d.ts +55 -0
- package/dist/components/drill/resolveDrill.d.ts +139 -0
- package/dist/components/drill/useDrill.d.ts +63 -0
- package/dist/components/given/GivenInput.d.ts +52 -0
- package/dist/components/given/GivensPanel.d.ts +47 -0
- package/dist/components/given/filterValue.d.ts +97 -0
- package/dist/components/given/index.d.ts +2 -0
- package/dist/components/given/paramCodec.d.ts +60 -0
- package/dist/components/given/utils.d.ts +17 -0
- package/dist/components/highlighter.d.ts +6 -1
- package/dist/components/index.d.ts +7 -2
- package/dist/components/styles.d.ts +47 -0
- package/dist/constants/docLinks.d.ts +12 -0
- package/dist/{core-YNpOLuB1.cjs.js → core-CqRKhtoy.cjs.js} +1 -1
- package/dist/{core-CjeTkq8O.es.js → core-DyU47reh.es.js} +1 -1
- package/dist/github-dark-BKL9xNgN.cjs.js +1 -0
- package/dist/github-dark-DenFmJkN.es.js +4 -0
- package/dist/hooks/givenValue.d.ts +10 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/useDimensionFiltersFromSpec.d.ts +3 -3
- package/dist/hooks/useDimensionFiltersQuery.d.ts +3 -3
- package/dist/hooks/useDimensionalFilterRangeData.d.ts +4 -4
- package/dist/hooks/useGivensState.d.ts +64 -0
- package/dist/hooks/useModelGivens.d.ts +10 -0
- package/dist/hooks/useSuggestOptions.d.ts +78 -0
- package/dist/{index-DRDu9kIV.es.js → index-CAkFE4Ol.es.js} +41278 -28504
- package/dist/index-DD4b_bt0.cjs.js +356 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.es.js +79 -48
- package/dist/malloy-explorer.css +12 -1
- package/dist/sdk.css +1 -1
- package/dist/theme/ThemeContext.d.ts +45 -0
- package/dist/theme/buildMalloyExplicitTheme.d.ts +34 -0
- package/dist/theme/buildTableCssVars.d.ts +41 -0
- package/dist/theme/buildVegaThemeOverride.d.ts +16 -0
- package/dist/theme/defaults.d.ts +7 -0
- package/dist/theme/index.d.ts +8 -0
- package/dist/theme/keys.d.ts +20 -0
- package/dist/theme/readChartAnnotations.d.ts +23 -0
- package/dist/theme/resolveTheme.d.ts +22 -0
- package/dist/theme/types.d.ts +70 -0
- package/dist/utils/dataAppEmbed.d.ts +44 -0
- package/dist/utils/formatting.d.ts +1 -1
- package/dist/utils/malloyString.d.ts +7 -0
- package/dist/utils/parsing.d.ts +2 -2
- package/dist/utils/queryClient.d.ts +5 -0
- package/package.json +19 -8
- package/src/client-entry.ts +3 -0
- package/src/components/AnalyzePackageButton.tsx +9 -3
- package/src/components/ApiErrorDisplay.tsx +3 -0
- package/src/components/Connections/AddConnectionDialog.tsx +132 -25
- package/src/components/Connections/DeleteConnectionDialog.tsx +14 -3
- package/src/components/Connections/EditConnectionDialog.tsx +167 -37
- package/src/components/Connections/common.ts +94 -3
- package/src/components/DOMElement/DOMElement.tsx +3 -0
- package/src/components/DOMElement/index.ts +3 -0
- package/src/components/Dashboard/Dashboard.spec.tsx +216 -0
- package/src/components/Dashboard/Dashboard.tsx +458 -0
- package/src/components/Dashboard/DashboardTile.spec.tsx +81 -0
- package/src/components/Dashboard/DashboardTile.tsx +199 -0
- package/src/components/Dashboard/index.ts +5 -0
- package/src/components/Dashboard/tileGridColumn.spec.ts +35 -0
- package/src/components/DataAppViewer/DataAppViewer.tsx +214 -0
- package/src/components/DataAppViewer/index.ts +4 -0
- package/src/components/{Project → Environment}/About.tsx +11 -4
- package/src/components/Environment/AddPackageDialog.tsx +202 -0
- package/src/components/{Project → Environment}/ConnectionExplorer.tsx +17 -14
- package/src/components/Environment/Connections.tsx +391 -0
- package/src/components/{Project → Environment}/DeletePackageDialog.tsx +8 -4
- package/src/components/{Project → Environment}/EditPackageDialog.tsx +21 -13
- package/src/components/Environment/Environment.tsx +89 -0
- package/src/components/Environment/Packages.tsx +206 -0
- package/src/components/Environment/index.ts +5 -0
- package/src/components/Home/{AddProjectDialog.tsx → AddEnvironmentDialog.tsx} +25 -19
- package/src/components/Home/{DeleteProjectDialog.tsx → DeleteEnvironmentDialog.tsx} +20 -15
- package/src/components/Home/{EditProjectDialog.tsx → EditEnvironmentDialog.tsx} +35 -28
- package/src/components/Home/Home.tsx +386 -408
- package/src/components/Home/index.ts +3 -0
- package/src/components/Loading.tsx +3 -0
- package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +179 -0
- package/src/components/Materializations/CreateMaterializationDialog.tsx +112 -0
- package/src/components/Materializations/DeleteMaterializationDialog.tsx +109 -0
- package/src/components/Materializations/EnvironmentMaterializations.tsx +267 -0
- package/src/components/Materializations/ManifestView.tsx +87 -0
- package/src/components/Materializations/MaterializationDetailDialog.tsx +259 -0
- package/src/components/Materializations/MaterializationRunsList.tsx +256 -0
- package/src/components/Materializations/Materializations.tsx +355 -0
- package/src/components/Materializations/ScheduleCard.tsx +231 -0
- package/src/components/Materializations/SectionLabel.tsx +30 -0
- package/src/components/Materializations/SetScheduleDialog.tsx +162 -0
- package/src/components/Materializations/TriggerChip.tsx +44 -0
- package/src/components/Materializations/cron.ts +124 -0
- package/src/components/Materializations/index.ts +5 -0
- package/src/components/Materializations/utils.ts +145 -0
- package/src/components/Model/Model.tsx +44 -2
- package/src/components/Model/ModelCell.tsx +14 -5
- package/src/components/Model/ModelExplorer.tsx +3 -0
- package/src/components/Model/ModelExplorerDialog.tsx +4 -1
- package/src/components/Model/SourcesExplorer.tsx +9 -6
- package/src/components/Model/index.ts +3 -0
- package/src/components/Model/useModelData.ts +6 -3
- package/src/components/Notebook/Notebook.spec.tsx +88 -0
- package/src/components/Notebook/Notebook.tsx +476 -339
- package/src/components/Notebook/NotebookCell.tsx +264 -25
- package/src/components/Notebook/index.ts +3 -0
- package/src/components/Notebook/runPlan.spec.ts +155 -0
- package/src/components/Notebook/runPlan.ts +67 -0
- package/src/components/Notebook/types.ts +14 -0
- package/src/components/Package/ContentTypeIcon.spec.ts +91 -0
- package/src/components/Package/ContentTypeIcon.tsx +177 -0
- package/src/components/Package/FileTreeView.tsx +3 -0
- package/src/components/Package/Models.tsx +7 -4
- package/src/components/Package/Package.spec.tsx +113 -0
- package/src/components/Package/Package.tsx +692 -59
- package/src/components/Package/index.ts +3 -0
- package/src/components/QueryResult/QueryResult.tsx +17 -8
- package/src/components/QueryResult/index.ts +3 -0
- package/src/components/RenderedResult/RenderedResult.tsx +725 -67
- package/src/components/RenderedResult/ResultContainer.tsx +71 -2
- package/src/components/RenderedResult/index.ts +3 -0
- package/src/components/RenderedResult/renderLogs.spec.ts +58 -0
- package/src/components/RenderedResult/renderLogs.ts +43 -0
- package/src/components/ResultsDialog.tsx +13 -1
- package/src/components/ServerProvider.tsx +175 -51
- package/src/components/Workbook/BrowserWorkbookStorage.ts +3 -0
- package/src/components/Workbook/EditableMalloyCell.tsx +3 -0
- package/src/components/Workbook/ModelPicker.tsx +7 -4
- package/src/components/Workbook/MutableCell.tsx +10 -5
- package/src/components/Workbook/Workbook.tsx +8 -5
- package/src/components/Workbook/WorkbookList.tsx +3 -0
- package/src/components/Workbook/WorkbookManager.ts +3 -0
- package/src/components/Workbook/WorkbookStorage.ts +3 -0
- package/src/components/Workbook/WorkbookStorageProvider.tsx +3 -0
- package/src/components/Workbook/index.ts +3 -0
- package/src/components/click_helper.ts +17 -1
- package/src/components/drill/index.ts +28 -0
- package/src/components/drill/markDrillableCells.dom.spec.ts +313 -0
- package/src/components/drill/markDrillableCells.spec.ts +109 -0
- package/src/components/drill/markDrillableCells.ts +314 -0
- package/src/components/drill/resolveDrill.spec.ts +449 -0
- package/src/components/drill/resolveDrill.ts +375 -0
- package/src/components/drill/useDrill.tsx +203 -0
- package/src/components/filter/DimensionFilter.tsx +3 -0
- package/src/components/filter/index.ts +3 -0
- package/src/components/filter/utils.ts +16 -5
- package/src/components/given/GivenInput.spec.tsx +689 -0
- package/src/components/given/GivenInput.tsx +801 -0
- package/src/components/given/GivensPanel.spec.tsx +175 -0
- package/src/components/given/GivensPanel.tsx +195 -0
- package/src/components/given/filterValue.spec.ts +364 -0
- package/src/components/given/filterValue.ts +207 -0
- package/src/components/given/index.ts +9 -0
- package/src/components/given/paramCodec.spec.ts +857 -0
- package/src/components/given/paramCodec.ts +483 -0
- package/src/components/given/utils.spec.ts +60 -0
- package/src/components/given/utils.ts +79 -0
- package/src/components/highlighter.ts +22 -5
- package/src/components/index.ts +10 -2
- package/src/components/styles.ts +82 -33
- package/src/constants/docLinks.spec.ts +54 -0
- package/src/constants/docLinks.ts +46 -0
- package/src/hooks/givenValue.ts +13 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/useDimensionFilters.ts +4 -7
- package/src/hooks/useDimensionFiltersFromSpec.ts +8 -5
- package/src/hooks/useDimensionFiltersQuery.ts +10 -13
- package/src/hooks/useDimensionalFilterRangeData.ts +11 -14
- package/src/hooks/useGivensState.spec.ts +449 -0
- package/src/hooks/useGivensState.ts +340 -0
- package/src/hooks/useModelGivens.ts +29 -0
- package/src/hooks/useQueryWithApiError.ts +3 -0
- package/src/hooks/useRawQueryData.ts +6 -3
- package/src/hooks/useSuggestOptions.dom.spec.ts +91 -0
- package/src/hooks/useSuggestOptions.spec.ts +112 -0
- package/src/hooks/useSuggestOptions.ts +268 -0
- package/src/index.ts +10 -1
- package/src/react-app-env.d.ts +3 -0
- package/src/theme/ThemeContext.tsx +86 -0
- package/src/theme/buildMalloyExplicitTheme.ts +61 -0
- package/src/theme/buildTableCssVars.spec.ts +86 -0
- package/src/theme/buildTableCssVars.ts +98 -0
- package/src/theme/buildVegaThemeOverride.spec.ts +56 -0
- package/src/theme/buildVegaThemeOverride.ts +47 -0
- package/src/theme/defaults.ts +78 -0
- package/src/theme/index.ts +11 -0
- package/src/theme/keys.ts +32 -0
- package/src/theme/readChartAnnotations.spec.ts +58 -0
- package/src/theme/readChartAnnotations.ts +69 -0
- package/src/theme/resolveTheme.spec.ts +160 -0
- package/src/theme/resolveTheme.ts +121 -0
- package/src/theme/types.ts +79 -0
- package/src/utils/dataAppEmbed.spec.ts +63 -0
- package/src/utils/dataAppEmbed.ts +84 -0
- package/src/utils/formatting.spec.ts +25 -21
- package/src/utils/formatting.ts +11 -7
- package/src/utils/malloyString.spec.ts +24 -0
- package/src/utils/malloyString.ts +12 -0
- package/src/utils/parsing.spec.ts +26 -19
- package/src/utils/parsing.ts +11 -6
- package/src/utils/queryClient.ts +17 -0
- package/test/README.md +185 -0
- package/test/serverProvider.tsx +72 -0
- package/test/setup.ts +29 -0
- package/tsconfig.json +12 -1
- package/tsconfig.spec.json +22 -0
- package/vite.config.ts +3 -0
- package/dist/ServerProvider-lOQXDlqB.cjs.js +0 -1
- package/dist/ServerProvider-on-8FH5Z.es.js +0 -3060
- package/dist/components/Home/AddProjectDialog.d.ts +0 -1
- package/dist/components/Home/DeleteProjectDialog.d.ts +0 -5
- package/dist/components/Home/EditProjectDialog.d.ts +0 -7
- package/dist/components/Package/Config.d.ts +0 -5
- package/dist/components/Package/Databases.d.ts +0 -5
- package/dist/components/Package/Notebooks.d.ts +0 -6
- package/dist/components/Project/Project.d.ts +0 -6
- package/dist/components/Project/index.d.ts +0 -2
- package/dist/index-BOLBP6_i.cjs.js +0 -233
- package/src/components/Package/Config.tsx +0 -97
- package/src/components/Package/Connections.tsx +0 -373
- package/src/components/Package/Databases.tsx +0 -228
- package/src/components/Package/Notebooks.tsx +0 -77
- package/src/components/Project/AddPackageDialog.tsx +0 -159
- package/src/components/Project/Packages.tsx +0 -191
- package/src/components/Project/Project.tsx +0 -52
- package/src/components/Project/index.ts +0 -2
- /package/dist/components/{Project → Environment}/About.d.ts +0 -0
- /package/dist/components/{Project → Environment}/AddPackageDialog.d.ts +0 -0
- /package/dist/components/{Project → Environment}/ConnectionExplorer.d.ts +0 -0
- /package/dist/components/{Package → Environment}/Connections.d.ts +0 -0
- /package/dist/components/{Project → Environment}/DeletePackageDialog.d.ts +0 -0
- /package/dist/components/{Project → Environment}/EditPackageDialog.d.ts +0 -0
- /package/dist/components/{Project → Environment}/Packages.d.ts +0 -0
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
import AddIcon from "@mui/icons-material/Add";
|
|
2
5
|
import DeleteIcon from "@mui/icons-material/Delete";
|
|
3
6
|
import Box from "@mui/material/Box";
|
|
@@ -8,6 +11,8 @@ import DialogContent from "@mui/material/DialogContent";
|
|
|
8
11
|
import DialogContentText from "@mui/material/DialogContentText";
|
|
9
12
|
import DialogTitle from "@mui/material/DialogTitle";
|
|
10
13
|
import IconButton from "@mui/material/IconButton";
|
|
14
|
+
import ListItemIcon from "@mui/material/ListItemIcon";
|
|
15
|
+
import ListItemText from "@mui/material/ListItemText";
|
|
11
16
|
import TextField from "@mui/material/TextField";
|
|
12
17
|
import Typography from "@mui/material/Typography";
|
|
13
18
|
import React, { useState } from "react";
|
|
@@ -28,12 +33,14 @@ import {
|
|
|
28
33
|
gcsAttachedDatabaseFields,
|
|
29
34
|
getAttachedDatabaseFields,
|
|
30
35
|
s3AttachedDatabaseFields,
|
|
36
|
+
uiCreatableConnectionTypes,
|
|
31
37
|
} from "./common";
|
|
32
38
|
|
|
33
39
|
type EditConnectionDialogProps = {
|
|
34
40
|
connection: Connection;
|
|
35
41
|
onSubmit: (connection: Connection) => Promise<unknown>;
|
|
36
42
|
isSubmitting: boolean;
|
|
43
|
+
onCloseDialog?: () => void;
|
|
37
44
|
};
|
|
38
45
|
|
|
39
46
|
function initAttachedDatabases(connection: Connection) {
|
|
@@ -56,6 +63,7 @@ export default function EditConnectionDialog({
|
|
|
56
63
|
connection,
|
|
57
64
|
onSubmit,
|
|
58
65
|
isSubmitting,
|
|
66
|
+
onCloseDialog,
|
|
59
67
|
}: EditConnectionDialogProps) {
|
|
60
68
|
const [open, setOpen] = useState(false);
|
|
61
69
|
const [type, setType] = useState<Connection["type"]>(connection.type);
|
|
@@ -72,10 +80,22 @@ export default function EditConnectionDialog({
|
|
|
72
80
|
const [ducklakeStorageType, setDucklakeStorageType] = useState(() =>
|
|
73
81
|
initDucklakeStorageType(connection),
|
|
74
82
|
);
|
|
83
|
+
// Which S3 credential shape the storage fields are showing. Seeded from the
|
|
84
|
+
// connection being edited, so opening a host-credential connection shows the
|
|
85
|
+
// chain fields rather than empty key fields it does not use.
|
|
86
|
+
const [ducklakeS3Provider, setDucklakeS3Provider] = useState<string>(
|
|
87
|
+
() =>
|
|
88
|
+
connection.ducklakeConnection?.storage?.s3Connection?.provider ??
|
|
89
|
+
"config",
|
|
90
|
+
);
|
|
75
91
|
|
|
76
92
|
const handleClickOpen = () => {
|
|
77
93
|
setAttachedDatabases(initAttachedDatabases(connection));
|
|
78
94
|
setType(connection.type);
|
|
95
|
+
setDucklakeS3Provider(
|
|
96
|
+
connection.ducklakeConnection?.storage?.s3Connection?.provider ??
|
|
97
|
+
"config",
|
|
98
|
+
);
|
|
79
99
|
setDucklakeCatalogType("postgres");
|
|
80
100
|
setDucklakeStorageType(initDucklakeStorageType(connection));
|
|
81
101
|
setOpen(true);
|
|
@@ -83,6 +103,7 @@ export default function EditConnectionDialog({
|
|
|
83
103
|
|
|
84
104
|
const handleClose = () => {
|
|
85
105
|
setOpen(false);
|
|
106
|
+
onCloseDialog?.();
|
|
86
107
|
};
|
|
87
108
|
|
|
88
109
|
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
|
@@ -138,10 +159,23 @@ export default function EditConnectionDialog({
|
|
|
138
159
|
s3Config[field.name] = value;
|
|
139
160
|
}
|
|
140
161
|
});
|
|
141
|
-
// For updates, use existing values if not provided
|
|
162
|
+
// For updates, use existing values if not provided. `provider` and
|
|
163
|
+
// `chain` are carried forward for the same reason the key pair is:
|
|
164
|
+
// this form rebuilds the whole s3Connection from its own fields, so
|
|
165
|
+
// anything it does not resubmit is dropped. Losing `provider` here
|
|
166
|
+
// silently downgrades a host-credential connection to a key-based one
|
|
167
|
+
// that has no key — and because the checks below used to be
|
|
168
|
+
// unconditional, it also made a chain-auth connection impossible to
|
|
169
|
+
// edit at all, including just its bucket URL.
|
|
142
170
|
const existingS3 =
|
|
143
171
|
connection.ducklakeConnection?.storage?.s3Connection;
|
|
144
172
|
if (existingS3) {
|
|
173
|
+
if (!s3Config.provider && existingS3.provider) {
|
|
174
|
+
s3Config.provider = existingS3.provider;
|
|
175
|
+
}
|
|
176
|
+
if (!s3Config.chain && existingS3.chain) {
|
|
177
|
+
s3Config.chain = existingS3.chain;
|
|
178
|
+
}
|
|
145
179
|
if (!s3Config.accessKeyId && existingS3.accessKeyId) {
|
|
146
180
|
s3Config.accessKeyId = existingS3.accessKeyId;
|
|
147
181
|
}
|
|
@@ -149,12 +183,26 @@ export default function EditConnectionDialog({
|
|
|
149
183
|
s3Config.secretAccessKey = existingS3.secretAccessKey;
|
|
150
184
|
}
|
|
151
185
|
}
|
|
152
|
-
// Validate required fields
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
186
|
+
// Validate required fields. Under `credential_chain` the host supplies
|
|
187
|
+
// the credential, so a key pair is not merely optional — the server
|
|
188
|
+
// rejects one that is present and unused.
|
|
189
|
+
if (s3Config.provider === "credential_chain") {
|
|
190
|
+
delete s3Config.accessKeyId;
|
|
191
|
+
delete s3Config.secretAccessKey;
|
|
192
|
+
delete s3Config.sessionToken;
|
|
193
|
+
} else {
|
|
194
|
+
// Symmetric with the deletion above, and load-bearing on the edit
|
|
195
|
+
// path: switching the provider to a key pair unmounts the chain
|
|
196
|
+
// field, so it never resubmits and a carried-forward value would
|
|
197
|
+
// survive into a config the server rejects — naming a field the form
|
|
198
|
+
// is no longer showing.
|
|
199
|
+
delete s3Config.chain;
|
|
200
|
+
if (!s3Config.accessKeyId) {
|
|
201
|
+
throw new Error("S3 Access Key ID is required");
|
|
202
|
+
}
|
|
203
|
+
if (!s3Config.secretAccessKey) {
|
|
204
|
+
throw new Error("S3 Secret Access Key is required");
|
|
205
|
+
}
|
|
158
206
|
}
|
|
159
207
|
if (Object.keys(s3Config).length > 0) {
|
|
160
208
|
storageConfig.s3Connection = s3Config;
|
|
@@ -238,6 +286,32 @@ export default function EditConnectionDialog({
|
|
|
238
286
|
}
|
|
239
287
|
});
|
|
240
288
|
|
|
289
|
+
// The S3 key fields are no longer HTML-`required`, because under
|
|
290
|
+
// `credential_chain` there is no key to give and a hidden required
|
|
291
|
+
// field blocks submit with nothing on screen to fix. Enforce the
|
|
292
|
+
// pair here instead, where it can be conditional — otherwise a
|
|
293
|
+
// keyless key-based attachment would save and fail at attach. This
|
|
294
|
+
// does not ask anyone to retype a secret: the inputs are seeded
|
|
295
|
+
// from the stored connection, so an untouched field resubmits its
|
|
296
|
+
// existing value.
|
|
297
|
+
if (dbType === "s3") {
|
|
298
|
+
if (connectionConfig.provider === "credential_chain") {
|
|
299
|
+
delete connectionConfig.accessKeyId;
|
|
300
|
+
delete connectionConfig.secretAccessKey;
|
|
301
|
+
delete connectionConfig.sessionToken;
|
|
302
|
+
} else {
|
|
303
|
+
delete connectionConfig.chain;
|
|
304
|
+
if (
|
|
305
|
+
!connectionConfig.accessKeyId ||
|
|
306
|
+
!connectionConfig.secretAccessKey
|
|
307
|
+
) {
|
|
308
|
+
throw new Error(
|
|
309
|
+
`Attached database "${dbName}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`,
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
241
315
|
const connectionFieldName =
|
|
242
316
|
attachedDatabaseConnectionFieldName[dbType];
|
|
243
317
|
if (connectionFieldName) {
|
|
@@ -362,6 +436,21 @@ export default function EditConnectionDialog({
|
|
|
362
436
|
if (!connectionConfig.accessToken) {
|
|
363
437
|
throw new Error("Access Token is required");
|
|
364
438
|
}
|
|
439
|
+
} else if (type === "databricks") {
|
|
440
|
+
if (!connectionConfig.host) {
|
|
441
|
+
throw new Error("Host is required");
|
|
442
|
+
}
|
|
443
|
+
if (!connectionConfig.path) {
|
|
444
|
+
throw new Error("HTTP Path is required");
|
|
445
|
+
}
|
|
446
|
+
const hasOAuth =
|
|
447
|
+
connectionConfig.oauthClientId &&
|
|
448
|
+
connectionConfig.oauthClientSecret;
|
|
449
|
+
if (!connectionConfig.token && !hasOAuth) {
|
|
450
|
+
throw new Error(
|
|
451
|
+
"Either Access Token or OAuth Client ID + Secret is required",
|
|
452
|
+
);
|
|
453
|
+
}
|
|
365
454
|
}
|
|
366
455
|
|
|
367
456
|
connectionPayload = {
|
|
@@ -431,15 +520,19 @@ export default function EditConnectionDialog({
|
|
|
431
520
|
|
|
432
521
|
return (
|
|
433
522
|
<React.Fragment>
|
|
434
|
-
<
|
|
523
|
+
<MenuItem
|
|
524
|
+
aria-label={`Edit connection ${connection?.name ?? ""}`.trim()}
|
|
435
525
|
onClick={(event) => {
|
|
436
526
|
event.preventDefault();
|
|
437
527
|
event.stopPropagation();
|
|
438
528
|
handleClickOpen();
|
|
439
529
|
}}
|
|
440
530
|
>
|
|
441
|
-
<
|
|
442
|
-
|
|
531
|
+
<ListItemIcon>
|
|
532
|
+
<Edit fontSize="small" />
|
|
533
|
+
</ListItemIcon>
|
|
534
|
+
<ListItemText>Edit</ListItemText>
|
|
535
|
+
</MenuItem>
|
|
443
536
|
<Dialog open={open} onClose={handleClose}>
|
|
444
537
|
<DialogTitle
|
|
445
538
|
onClick={(event) => {
|
|
@@ -482,7 +575,7 @@ export default function EditConnectionDialog({
|
|
|
482
575
|
setType(event.target.value as ConnectionTypeEnum)
|
|
483
576
|
}
|
|
484
577
|
>
|
|
485
|
-
{
|
|
578
|
+
{uiCreatableConnectionTypes.map((type) => (
|
|
486
579
|
<MenuItem key={type} value={type}>
|
|
487
580
|
{type}
|
|
488
581
|
</MenuItem>
|
|
@@ -597,32 +690,68 @@ export default function EditConnectionDialog({
|
|
|
597
690
|
>
|
|
598
691
|
S3 Credentials
|
|
599
692
|
</Typography>
|
|
600
|
-
{s3AttachedDatabaseFields
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
field.
|
|
612
|
-
field.name
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
693
|
+
{s3AttachedDatabaseFields
|
|
694
|
+
.filter((field) =>
|
|
695
|
+
field.visibleWhen
|
|
696
|
+
? ducklakeS3Provider ===
|
|
697
|
+
field.visibleWhen.value
|
|
698
|
+
: true,
|
|
699
|
+
)
|
|
700
|
+
.map((field) => (
|
|
701
|
+
<TextField
|
|
702
|
+
key={`s3_${field.name}`}
|
|
703
|
+
margin="dense"
|
|
704
|
+
id={`ducklake_s3_${field.name}`}
|
|
705
|
+
name={`ducklake_s3_${field.name}`}
|
|
706
|
+
label={field.label}
|
|
707
|
+
type={
|
|
708
|
+
field.selectOptions
|
|
709
|
+
? undefined
|
|
710
|
+
: field.type
|
|
711
|
+
}
|
|
712
|
+
fullWidth
|
|
713
|
+
variant="standard"
|
|
714
|
+
required={
|
|
715
|
+
field.required &&
|
|
716
|
+
field.name !== "secretAccessKey"
|
|
717
|
+
}
|
|
718
|
+
select={!!field.selectOptions}
|
|
719
|
+
defaultValue={
|
|
720
|
+
field.selectOptions
|
|
721
|
+
? ducklakeS3Provider
|
|
722
|
+
: getDucklakeDefault(
|
|
723
|
+
`s3_${field.name}`,
|
|
724
|
+
)
|
|
725
|
+
}
|
|
726
|
+
onChange={
|
|
727
|
+
field.name === "provider"
|
|
728
|
+
? (e) =>
|
|
729
|
+
setDucklakeS3Provider(
|
|
730
|
+
e.target.value,
|
|
731
|
+
)
|
|
732
|
+
: undefined
|
|
733
|
+
}
|
|
734
|
+
placeholder={
|
|
735
|
+
field.name === "region"
|
|
736
|
+
? "us-east-1"
|
|
737
|
+
: field.name ===
|
|
738
|
+
"secretAccessKey"
|
|
739
|
+
? "Leave empty to keep existing"
|
|
740
|
+
: undefined
|
|
741
|
+
}
|
|
742
|
+
>
|
|
743
|
+
{field.selectOptions?.map(
|
|
744
|
+
(option) => (
|
|
745
|
+
<MenuItem
|
|
746
|
+
key={option.value}
|
|
747
|
+
value={option.value}
|
|
748
|
+
>
|
|
749
|
+
{option.label}
|
|
750
|
+
</MenuItem>
|
|
751
|
+
),
|
|
752
|
+
)}
|
|
753
|
+
</TextField>
|
|
754
|
+
))}
|
|
626
755
|
</>
|
|
627
756
|
)}
|
|
628
757
|
{ducklakeStorageType === "gcs" && (
|
|
@@ -722,6 +851,7 @@ export default function EditConnectionDialog({
|
|
|
722
851
|
Database {index + 1}
|
|
723
852
|
</Typography>
|
|
724
853
|
<IconButton
|
|
854
|
+
aria-label={`Remove attached database ${index + 1}`}
|
|
725
855
|
onClick={() =>
|
|
726
856
|
removeAttachedDatabase(index)
|
|
727
857
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
import { HTMLInputTypeAttribute } from "react";
|
|
5
|
+
import { ConnectionTypeEnum } from "../../client/api";
|
|
2
6
|
import type {
|
|
3
7
|
AzureConnection,
|
|
4
8
|
BigqueryConnection,
|
|
5
|
-
|
|
9
|
+
DatabricksConnection,
|
|
6
10
|
DucklakeConnection,
|
|
7
11
|
GCSConnection,
|
|
8
12
|
MotherDuckConnection,
|
|
@@ -19,6 +23,7 @@ type ConnectionField = {
|
|
|
19
23
|
BigqueryConnection &
|
|
20
24
|
SnowflakeConnection &
|
|
21
25
|
TrinoConnection &
|
|
26
|
+
DatabricksConnection &
|
|
22
27
|
MysqlConnection &
|
|
23
28
|
MotherDuckConnection &
|
|
24
29
|
S3Connection &
|
|
@@ -217,6 +222,50 @@ export const connectionFieldsByType: Record<
|
|
|
217
222
|
required: false, // Can be used instead of password for HTTPS
|
|
218
223
|
},
|
|
219
224
|
],
|
|
225
|
+
databricks: [
|
|
226
|
+
{
|
|
227
|
+
label: "Host",
|
|
228
|
+
name: "host",
|
|
229
|
+
type: "text",
|
|
230
|
+
required: true,
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
label: "HTTP Path",
|
|
234
|
+
name: "path",
|
|
235
|
+
type: "text",
|
|
236
|
+
required: true,
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
label: "Access Token",
|
|
240
|
+
name: "token",
|
|
241
|
+
type: "password",
|
|
242
|
+
required: false, // Either token or OAuth client credentials required
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
label: "OAuth Client ID",
|
|
246
|
+
name: "oauthClientId",
|
|
247
|
+
type: "text",
|
|
248
|
+
required: false, // Required with oauthClientSecret if no token
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
label: "OAuth Client Secret",
|
|
252
|
+
name: "oauthClientSecret",
|
|
253
|
+
type: "password",
|
|
254
|
+
required: false, // Required with oauthClientId if no token
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
label: "Default Catalog",
|
|
258
|
+
name: "defaultCatalog",
|
|
259
|
+
type: "text",
|
|
260
|
+
required: false,
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
label: "Default Schema",
|
|
264
|
+
name: "defaultSchema",
|
|
265
|
+
type: "text",
|
|
266
|
+
required: false,
|
|
267
|
+
},
|
|
268
|
+
],
|
|
220
269
|
mysql: [
|
|
221
270
|
{
|
|
222
271
|
label: "Host",
|
|
@@ -267,6 +316,9 @@ export const connectionFieldsByType: Record<
|
|
|
267
316
|
],
|
|
268
317
|
// DuckLake uses custom form rendering (catalog + storage dropdowns)
|
|
269
318
|
ducklake: [],
|
|
319
|
+
// Publisher connections are defined in publisher.config.json, not built from
|
|
320
|
+
// this form (see uiCreatableConnectionTypes).
|
|
321
|
+
publisher: [],
|
|
270
322
|
};
|
|
271
323
|
|
|
272
324
|
export const attributesFieldName: Record<ConnectionTypeEnum, string> = {
|
|
@@ -274,12 +326,23 @@ export const attributesFieldName: Record<ConnectionTypeEnum, string> = {
|
|
|
274
326
|
bigquery: "bigqueryConnection",
|
|
275
327
|
snowflake: "snowflakeConnection",
|
|
276
328
|
trino: "trinoConnection",
|
|
329
|
+
databricks: "databricksConnection",
|
|
277
330
|
mysql: "mysqlConnection",
|
|
278
331
|
duckdb: "duckdbConnection",
|
|
279
332
|
motherduck: "motherduckConnection",
|
|
280
333
|
ducklake: "ducklakeConnection",
|
|
334
|
+
publisher: "publisherConnection",
|
|
281
335
|
};
|
|
282
336
|
|
|
337
|
+
/**
|
|
338
|
+
* Connection types the Add/Edit dialogs offer as creatable. `publisher` proxy
|
|
339
|
+
* connections are configured in publisher.config.json rather than through the
|
|
340
|
+
* UI, so they are a valid ConnectionTypeEnum but not a form choice.
|
|
341
|
+
*/
|
|
342
|
+
export const uiCreatableConnectionTypes = Object.values(
|
|
343
|
+
ConnectionTypeEnum,
|
|
344
|
+
).filter((type) => type !== ConnectionTypeEnum.Publisher);
|
|
345
|
+
|
|
283
346
|
// Mapping for attached database types to their connection field names
|
|
284
347
|
export const attachedDatabaseConnectionFieldName: Record<string, string> = {
|
|
285
348
|
postgres: "postgresConnection",
|
|
@@ -292,17 +355,44 @@ export const attachedDatabaseConnectionFieldName: Record<string, string> = {
|
|
|
292
355
|
|
|
293
356
|
// Fields for S3 attached database
|
|
294
357
|
export const s3AttachedDatabaseFields: Array<ConnectionField> = [
|
|
358
|
+
{
|
|
359
|
+
label: "Credential Provider",
|
|
360
|
+
name: "provider" as keyof S3Connection,
|
|
361
|
+
type: "text",
|
|
362
|
+
required: false,
|
|
363
|
+
selectOptions: [
|
|
364
|
+
{ label: "Access key pair", value: "config" },
|
|
365
|
+
{ label: "Host credential chain", value: "credential_chain" },
|
|
366
|
+
],
|
|
367
|
+
},
|
|
368
|
+
// Neither key is `required` any more, because under `credential_chain` there is
|
|
369
|
+
// no key to give and a hidden-but-required field blocks submit with nothing on
|
|
370
|
+
// screen to fix. Presence is enforced where it can be conditional instead: each
|
|
371
|
+
// dialog checks the pair on the `config` path, in BOTH the DuckLake storage
|
|
372
|
+
// branch and the attached-database branch. Server-side, a keyless `config`
|
|
373
|
+
// storage DESTINATION is rejected at config load; a DuckLake connection or an
|
|
374
|
+
// attached database still fails at attach, because a load-time throw there would
|
|
375
|
+
// take the whole environment down with it.
|
|
295
376
|
{
|
|
296
377
|
label: "Access Key ID",
|
|
297
378
|
name: "accessKeyId" as keyof S3Connection,
|
|
298
379
|
type: "text",
|
|
299
|
-
required:
|
|
380
|
+
required: false,
|
|
381
|
+
visibleWhen: { field: "provider", value: "config" },
|
|
300
382
|
},
|
|
301
383
|
{
|
|
302
384
|
label: "Secret Access Key",
|
|
303
385
|
name: "secretAccessKey" as keyof S3Connection,
|
|
304
386
|
type: "password",
|
|
305
|
-
required:
|
|
387
|
+
required: false,
|
|
388
|
+
visibleWhen: { field: "provider", value: "config" },
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
label: "Credential Chain",
|
|
392
|
+
name: "chain" as keyof S3Connection,
|
|
393
|
+
type: "text",
|
|
394
|
+
required: false,
|
|
395
|
+
visibleWhen: { field: "provider", value: "credential_chain" },
|
|
306
396
|
},
|
|
307
397
|
{
|
|
308
398
|
label: "Region",
|
|
@@ -321,6 +411,7 @@ export const s3AttachedDatabaseFields: Array<ConnectionField> = [
|
|
|
321
411
|
name: "sessionToken" as keyof S3Connection,
|
|
322
412
|
type: "password",
|
|
323
413
|
required: false,
|
|
414
|
+
visibleWhen: { field: "provider", value: "config" },
|
|
324
415
|
},
|
|
325
416
|
];
|
|
326
417
|
|