@malloy-publisher/sdk 0.2.7 → 0.3.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 +180 -204
- package/dist/DocumentStorageProvider-BeBD0uWc.cjs.js +134 -0
- package/dist/DocumentStorageProvider-tGvodI8f.es.js +24268 -0
- package/dist/RenderedResult-CPi6uQWq.cjs.js +115 -0
- package/dist/RenderedResult-mDE-4u8S.es.js +542 -0
- package/dist/{ServerProvider-xXW1HJOJ.cjs.js → ServerProvider-CH71GsoL.cjs.js} +1 -1
- package/dist/{ServerProvider-ksC5Su_x.es.js → ServerProvider-X2Ma0HRs.es.js} +324 -359
- package/dist/builder/index.cjs.js +105 -0
- package/dist/builder/index.d.ts +2 -0
- package/dist/builder/index.es.js +9561 -0
- package/dist/builder-entry.d.ts +8 -0
- package/dist/client/api.d.ts +13 -1
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/ApiErrorDisplay.d.ts +1 -2
- package/dist/components/Dashboard/Dashboard.d.ts +23 -16
- package/dist/components/Dashboard/DashboardGrid.d.ts +67 -0
- package/dist/components/Dashboard/DashboardTile.d.ts +6 -1
- package/dist/components/Dashboard/ExploreDialog.d.ts +18 -0
- package/dist/components/Dashboard/RowsDialog.d.ts +47 -0
- package/dist/components/Dashboard/TileCard.d.ts +44 -0
- package/dist/components/Dashboard/index.d.ts +2 -0
- package/dist/components/Dashboard/promoteMeasureRow.d.ts +40 -0
- package/dist/components/Dashboard/telemetry.d.ts +43 -0
- package/dist/components/DashboardBuilder/AddTileDialog.d.ts +35 -0
- package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +29 -0
- package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +112 -0
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +32 -0
- package/dist/components/DashboardBuilder/DiffDialog.d.ts +15 -0
- package/dist/components/DashboardBuilder/DrillDialog.d.ts +15 -0
- package/dist/components/DashboardBuilder/FilterDialog.d.ts +54 -0
- package/dist/components/DashboardBuilder/FilterStrip.d.ts +17 -0
- package/dist/components/DashboardBuilder/SettingsPopover.d.ts +20 -0
- package/dist/components/DashboardBuilder/TileFrame.d.ts +42 -0
- package/dist/components/DashboardBuilder/TileMenu.d.ts +24 -0
- package/dist/components/DashboardBuilder/catalog.d.ts +62 -0
- package/dist/components/DashboardBuilder/controls.d.ts +157 -0
- package/dist/components/DashboardBuilder/diff.d.ts +35 -0
- package/dist/components/DashboardBuilder/document.d.ts +218 -0
- package/dist/components/DashboardBuilder/layout.d.ts +71 -0
- package/dist/components/DashboardBuilder/malloyText.d.ts +45 -0
- package/dist/components/DashboardBuilder/preview.d.ts +60 -0
- package/dist/components/DashboardBuilder/readDocument.d.ts +106 -0
- package/dist/components/DashboardBuilder/sortable.d.ts +51 -0
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +44 -0
- package/dist/components/DashboardBuilder/testing/fixtures.d.ts +10 -0
- package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +22 -0
- package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +63 -0
- package/dist/components/DashboardBuilder/useDraft.d.ts +13 -0
- package/dist/components/DashboardBuilder/useFilterForm.d.ts +65 -0
- package/dist/components/DashboardBuilder/useTileReorder.d.ts +22 -0
- package/dist/components/DashboardBuilder/useTileResize.d.ts +29 -0
- package/dist/components/DocumentStorage/BrowserDocumentStorage.d.ts +14 -0
- package/dist/components/DocumentStorage/DocumentStorage.d.ts +58 -0
- package/dist/components/DocumentStorage/DocumentStorageProvider.d.ts +25 -0
- package/dist/components/DocumentStorage/index.d.ts +3 -0
- package/dist/components/FloatingIconButton.d.ts +16 -0
- package/dist/components/Model/index.d.ts +0 -1
- package/dist/components/Prose.d.ts +46 -0
- package/dist/components/RenderedResult/RenderedResult.d.ts +12 -0
- package/dist/components/RenderedResult/ResultContainer.d.ts +7 -1
- package/dist/components/RenderedResult/ResultPanel.d.ts +30 -0
- package/dist/components/RenderedResult/index.d.ts +2 -0
- package/dist/components/RenderedResult/resultSizing.d.ts +183 -0
- package/dist/components/drill/index.d.ts +2 -1
- package/dist/components/drill/resolveDrill.d.ts +22 -0
- package/dist/components/drill/useDrill.d.ts +11 -2
- package/dist/components/drill/useDrillSelf.d.ts +46 -0
- package/dist/components/given/filterValue.d.ts +63 -0
- package/dist/components/given/index.d.ts +1 -0
- package/dist/components/given/useGivenUrlParams.d.ts +39 -0
- package/dist/components/index.d.ts +3 -3
- package/dist/components/styles.d.ts +3 -7
- package/dist/core-8NVBCLZh.cjs.js +148 -0
- package/dist/{core-BY7vB5gN.es.js → core-B8oMW4sm.es.js} +3540 -2335
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/useDocumentControls.d.ts +70 -0
- package/dist/hooks/useQueryResult.d.ts +40 -0
- package/dist/hooks/useSuggestOptions.d.ts +28 -12
- package/dist/index.cjs.js +34 -1
- package/dist/index.es.js +21487 -79
- package/dist/sdk.css +1 -1
- package/dist/styles.css +0 -1
- package/dist/utils/malloyLiteral.d.ts +11 -0
- package/package.json +25 -14
- package/src/builder-entry.ts +55 -0
- package/src/components/ApiErrorDisplay.tsx +1 -1
- package/src/components/Connections/EditConnectionDialog.tsx +96 -86
- package/src/components/Dashboard/Dashboard.spec.tsx +7 -10
- package/src/components/Dashboard/Dashboard.tsx +184 -229
- package/src/components/Dashboard/DashboardGrid.tsx +124 -0
- package/src/components/Dashboard/DashboardTile.spec.tsx +30 -6
- package/src/components/Dashboard/DashboardTile.tsx +67 -101
- package/src/components/Dashboard/ExploreDialog.tsx +84 -0
- package/src/components/Dashboard/RowsDialog.spec.ts +42 -0
- package/src/components/Dashboard/RowsDialog.tsx +234 -0
- package/src/components/Dashboard/TileCard.tsx +120 -0
- package/src/components/Dashboard/index.ts +2 -0
- package/src/components/Dashboard/promoteMeasureRow.spec.ts +207 -0
- package/src/components/Dashboard/promoteMeasureRow.ts +160 -0
- package/src/components/Dashboard/telemetry.ts +44 -0
- package/src/components/Dashboard/tileGridColumn.spec.ts +1 -1
- package/src/components/DashboardBuilder/AddTileDialog.tsx +249 -0
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +270 -0
- package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +858 -0
- package/src/components/DashboardBuilder/DashboardBuilder.tsx +653 -0
- package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +211 -0
- package/src/components/DashboardBuilder/DashboardEditor.tsx +493 -0
- package/src/components/DashboardBuilder/DiffDialog.tsx +129 -0
- package/src/components/DashboardBuilder/DrillDialog.tsx +281 -0
- package/src/components/DashboardBuilder/FilterDialog.tsx +581 -0
- package/src/components/DashboardBuilder/FilterStrip.tsx +125 -0
- package/src/components/DashboardBuilder/SettingsPopover.tsx +168 -0
- package/src/components/DashboardBuilder/TileFrame.tsx +380 -0
- package/src/components/DashboardBuilder/TileMenu.tsx +188 -0
- package/src/components/DashboardBuilder/catalog.spec.ts +215 -0
- package/src/components/DashboardBuilder/catalog.ts +225 -0
- package/src/components/DashboardBuilder/controls.spec.ts +243 -0
- package/src/components/DashboardBuilder/controls.ts +398 -0
- package/src/components/DashboardBuilder/diff.spec.ts +44 -0
- package/src/components/DashboardBuilder/diff.ts +93 -0
- package/src/components/DashboardBuilder/document.ts +209 -0
- package/src/components/DashboardBuilder/keepRowStructure.spec.ts +84 -0
- package/src/components/DashboardBuilder/layout.ts +143 -0
- package/src/components/DashboardBuilder/malloyText.spec.ts +84 -0
- package/src/components/DashboardBuilder/malloyText.ts +151 -0
- package/src/components/DashboardBuilder/moveIntoGap.spec.ts +90 -0
- package/src/components/DashboardBuilder/preview.spec.ts +149 -0
- package/src/components/DashboardBuilder/preview.ts +172 -0
- package/src/components/DashboardBuilder/readDocument.spec.ts +375 -0
- package/src/components/DashboardBuilder/readDocument.ts +467 -0
- package/src/components/DashboardBuilder/sortable.tsx +151 -0
- package/src/components/DashboardBuilder/spliceDocument.spec.ts +1108 -0
- package/src/components/DashboardBuilder/spliceDocument.ts +1098 -0
- package/src/components/DashboardBuilder/testing/fixtures.ts +48 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.ts +88 -0
- package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +255 -0
- package/src/components/DashboardBuilder/useDashboardEditor.ts +193 -0
- package/src/components/DashboardBuilder/useDraft.ts +43 -0
- package/src/components/DashboardBuilder/useFilterForm.spec.tsx +144 -0
- package/src/components/DashboardBuilder/useFilterForm.ts +352 -0
- package/src/components/DashboardBuilder/useTileReorder.spec.tsx +97 -0
- package/src/components/DashboardBuilder/useTileReorder.ts +115 -0
- package/src/components/DashboardBuilder/useTileResize.spec.tsx +121 -0
- package/src/components/DashboardBuilder/useTileResize.ts +110 -0
- package/src/components/DashboardBuilder/withGaps.spec.ts +96 -0
- package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +81 -0
- package/src/components/DocumentStorage/BrowserDocumentStorage.ts +105 -0
- package/src/components/DocumentStorage/DocumentStorage.ts +73 -0
- package/src/components/DocumentStorage/DocumentStorageProvider.tsx +58 -0
- package/src/components/DocumentStorage/index.ts +16 -0
- package/src/components/Environment/About.tsx +4 -36
- package/src/components/FloatingIconButton.tsx +41 -0
- package/src/components/Model/Model.tsx +6 -23
- package/src/components/Model/ModelCell.tsx +34 -72
- package/src/components/Model/index.ts +0 -1
- package/src/components/Notebook/Notebook.tsx +27 -156
- package/src/components/Notebook/NotebookCell.tsx +37 -191
- package/src/components/Prose.spec.tsx +85 -0
- package/src/components/Prose.tsx +179 -0
- package/src/components/QueryResult/QueryResult.tsx +15 -43
- package/src/components/RenderedResult/RenderedResult.tsx +86 -76
- package/src/components/RenderedResult/ResultContainer.tsx +25 -36
- package/src/components/RenderedResult/ResultPanel.spec.tsx +49 -0
- package/src/components/RenderedResult/ResultPanel.tsx +73 -0
- package/src/components/RenderedResult/index.ts +16 -0
- package/src/components/RenderedResult/resultSizing.spec.ts +249 -0
- package/src/components/RenderedResult/resultSizing.ts +308 -0
- package/src/components/ResultsDialog.tsx +2 -1
- package/src/components/drill/index.ts +6 -0
- package/src/components/drill/resolveDrill.ts +22 -1
- package/src/components/drill/useDrill.spec.tsx +94 -0
- package/src/components/drill/useDrill.tsx +52 -12
- package/src/components/drill/useDrillSelf.spec.tsx +64 -0
- package/src/components/drill/useDrillSelf.ts +110 -0
- package/src/components/given/GivenInput.spec.tsx +196 -2
- package/src/components/given/GivenInput.tsx +300 -25
- package/src/components/given/GivensPanel.tsx +1 -1
- package/src/components/given/filterValue.spec.ts +112 -0
- package/src/components/given/filterValue.ts +188 -0
- package/src/components/given/index.ts +4 -0
- package/src/components/given/useGivenUrlParams.spec.tsx +74 -0
- package/src/components/given/useGivenUrlParams.ts +87 -0
- package/src/components/index.ts +11 -3
- package/src/components/styles.ts +0 -37
- package/src/hooks/index.ts +13 -1
- package/src/hooks/useDocumentControls.ts +170 -0
- package/src/hooks/useGivensState.spec.ts +158 -0
- package/src/hooks/useGivensState.ts +114 -23
- package/src/hooks/useQueryResult.ts +82 -0
- package/src/hooks/useSuggestOptions.dom.spec.ts +60 -1
- package/src/hooks/useSuggestOptions.ts +94 -51
- package/src/utils/malloyLiteral.spec.ts +43 -0
- package/src/utils/malloyLiteral.ts +76 -0
- package/vite.config.ts +5 -1
- package/dist/components/AnalyzePackageButton.d.ts +0 -6
- package/dist/components/Workbook/BrowserWorkbookStorage.d.ts +0 -9
- package/dist/components/Workbook/EditableMalloyCell.d.ts +0 -11
- package/dist/components/Workbook/ModelPicker.d.ts +0 -11
- package/dist/components/Workbook/MutableCell.d.ts +0 -17
- package/dist/components/Workbook/Workbook.d.ts +0 -7
- package/dist/components/Workbook/WorkbookList.d.ts +0 -7
- package/dist/components/Workbook/WorkbookManager.d.ts +0 -84
- package/dist/components/Workbook/WorkbookStorage.d.ts +0 -17
- package/dist/components/Workbook/WorkbookStorageProvider.d.ts +0 -12
- package/dist/components/Workbook/index.d.ts +0 -7
- package/dist/core-CWKmWEg2.cjs.js +0 -148
- package/dist/index-B0WyZAUA.es.js +0 -66412
- package/dist/index-kxVD1RjY.cjs.js +0 -356
- package/dist/markdown-editor.css +0 -341
- package/src/components/AnalyzePackageButton.tsx +0 -319
- package/src/components/Workbook/BrowserWorkbookStorage.ts +0 -64
- package/src/components/Workbook/EditableMalloyCell.tsx +0 -49
- package/src/components/Workbook/ModelPicker.tsx +0 -134
- package/src/components/Workbook/MutableCell.tsx +0 -458
- package/src/components/Workbook/Workbook.tsx +0 -501
- package/src/components/Workbook/WorkbookList.tsx +0 -110
- package/src/components/Workbook/WorkbookManager.ts +0 -214
- package/src/components/Workbook/WorkbookStorage.ts +0 -35
- package/src/components/Workbook/WorkbookStorageProvider.tsx +0 -40
- package/src/components/Workbook/index.ts +0 -10
|
@@ -36,6 +36,30 @@ import {
|
|
|
36
36
|
uiCreatableConnectionTypes,
|
|
37
37
|
} from "./common";
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Credential fields the API deliberately never returns, so an edit form can
|
|
41
|
+
* never prefill them (see the server's connection_public_view.ts). Left blank
|
|
42
|
+
* they are omitted from the update and the server keeps the value it already
|
|
43
|
+
* holds; typed into, they replace it. Presence therefore cannot be validated
|
|
44
|
+
* here, and is validated server-side against the merged config instead.
|
|
45
|
+
*/
|
|
46
|
+
const SERVER_HELD_SECRETS = new Set([
|
|
47
|
+
"password",
|
|
48
|
+
"connectionString",
|
|
49
|
+
"privateKey",
|
|
50
|
+
"privateKeyPass",
|
|
51
|
+
"serviceAccountKeyJson",
|
|
52
|
+
"token",
|
|
53
|
+
"oauthClientSecret",
|
|
54
|
+
"accessToken",
|
|
55
|
+
"peakaKey",
|
|
56
|
+
"secret",
|
|
57
|
+
"secretAccessKey",
|
|
58
|
+
"sessionToken",
|
|
59
|
+
"clientSecret",
|
|
60
|
+
"sasUrl",
|
|
61
|
+
]);
|
|
62
|
+
|
|
39
63
|
type EditConnectionDialogProps = {
|
|
40
64
|
connection: Connection;
|
|
41
65
|
onSubmit: (connection: Connection) => Promise<unknown>;
|
|
@@ -67,6 +91,14 @@ export default function EditConnectionDialog({
|
|
|
67
91
|
}: EditConnectionDialogProps) {
|
|
68
92
|
const [open, setOpen] = useState(false);
|
|
69
93
|
const [type, setType] = useState<Connection["type"]>(connection.type);
|
|
94
|
+
// One reader for withheldFields, so the form labels a box as holding a
|
|
95
|
+
// credential on the same evidence the submit path uses. Keyed by the dotted
|
|
96
|
+
// path the API reports, e.g. "postgresConnection.connectionString".
|
|
97
|
+
const withheldFields = React.useMemo(
|
|
98
|
+
() => new Set(connection.withheldFields ?? []),
|
|
99
|
+
[connection.withheldFields],
|
|
100
|
+
);
|
|
101
|
+
|
|
70
102
|
const [attachedDatabases, setAttachedDatabases] = useState<
|
|
71
103
|
Array<{
|
|
72
104
|
name: string;
|
|
@@ -176,12 +208,12 @@ export default function EditConnectionDialog({
|
|
|
176
208
|
if (!s3Config.chain && existingS3.chain) {
|
|
177
209
|
s3Config.chain = existingS3.chain;
|
|
178
210
|
}
|
|
211
|
+
// The identifier is still readable; the secret beside it is not,
|
|
212
|
+
// so there is nothing to carry forward for it. Blank means "keep
|
|
213
|
+
// the stored value" and the server merges it.
|
|
179
214
|
if (!s3Config.accessKeyId && existingS3.accessKeyId) {
|
|
180
215
|
s3Config.accessKeyId = existingS3.accessKeyId;
|
|
181
216
|
}
|
|
182
|
-
if (!s3Config.secretAccessKey && existingS3.secretAccessKey) {
|
|
183
|
-
s3Config.secretAccessKey = existingS3.secretAccessKey;
|
|
184
|
-
}
|
|
185
217
|
}
|
|
186
218
|
// Validate required fields. Under `credential_chain` the host supplies
|
|
187
219
|
// the credential, so a key pair is not merely optional — the server
|
|
@@ -200,9 +232,9 @@ export default function EditConnectionDialog({
|
|
|
200
232
|
if (!s3Config.accessKeyId) {
|
|
201
233
|
throw new Error("S3 Access Key ID is required");
|
|
202
234
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
235
|
+
// No check for the secret: it is server-held, so a blank box means
|
|
236
|
+
// "keep the stored one", and only the server sees the merged config
|
|
237
|
+
// it would have to be validated against.
|
|
206
238
|
}
|
|
207
239
|
if (Object.keys(s3Config).length > 0) {
|
|
208
240
|
storageConfig.s3Connection = s3Config;
|
|
@@ -217,24 +249,16 @@ export default function EditConnectionDialog({
|
|
|
217
249
|
gcsConfig[field.name] = value;
|
|
218
250
|
}
|
|
219
251
|
});
|
|
220
|
-
//
|
|
252
|
+
// Same split as S3 above: the key ID is readable, the secret is
|
|
253
|
+
// not, so a blank secret means "keep the stored value".
|
|
221
254
|
const existingGcs =
|
|
222
255
|
connection.ducklakeConnection?.storage?.gcsConnection;
|
|
223
|
-
if (existingGcs) {
|
|
224
|
-
|
|
225
|
-
gcsConfig.keyId = existingGcs.keyId;
|
|
226
|
-
}
|
|
227
|
-
if (!gcsConfig.secret && existingGcs.secret) {
|
|
228
|
-
gcsConfig.secret = existingGcs.secret;
|
|
229
|
-
}
|
|
256
|
+
if (existingGcs && !gcsConfig.keyId && existingGcs.keyId) {
|
|
257
|
+
gcsConfig.keyId = existingGcs.keyId;
|
|
230
258
|
}
|
|
231
|
-
// Validate required fields
|
|
232
259
|
if (!gcsConfig.keyId) {
|
|
233
260
|
throw new Error("GCS Key ID is required");
|
|
234
261
|
}
|
|
235
|
-
if (!gcsConfig.secret) {
|
|
236
|
-
throw new Error("GCS Secret is required");
|
|
237
|
-
}
|
|
238
262
|
if (Object.keys(gcsConfig).length > 0) {
|
|
239
263
|
storageConfig.gcsConnection = gcsConfig;
|
|
240
264
|
}
|
|
@@ -340,20 +364,14 @@ export default function EditConnectionDialog({
|
|
|
340
364
|
const formValue = formData.get(field.name)?.toString();
|
|
341
365
|
const existingValue = existingConfig[field.name];
|
|
342
366
|
|
|
343
|
-
//
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
field.name === "secretAccessKey" ||
|
|
348
|
-
field.name === "secret" ||
|
|
349
|
-
field.name === "accessToken" ||
|
|
350
|
-
field.name === "privateKey";
|
|
351
|
-
|
|
367
|
+
// A credential is never read back from the API, so there is no
|
|
368
|
+
// existing value to fall back on and nothing is sent when the field
|
|
369
|
+
// is left blank: the server keeps what it already stored. Sending a
|
|
370
|
+
// placeholder here would store the placeholder as the credential.
|
|
352
371
|
if (formValue) {
|
|
353
372
|
connectionConfig[field.name] = formValue;
|
|
354
|
-
} else if (
|
|
355
|
-
//
|
|
356
|
-
connectionConfig[field.name] = existingValue;
|
|
373
|
+
} else if (SERVER_HELD_SECRETS.has(field.name)) {
|
|
374
|
+
// Leave it out entirely; absent means unchanged.
|
|
357
375
|
} else if (formValue !== undefined) {
|
|
358
376
|
connectionConfig[field.name] = formValue;
|
|
359
377
|
} else if (existingValue) {
|
|
@@ -363,17 +381,22 @@ export default function EditConnectionDialog({
|
|
|
363
381
|
|
|
364
382
|
// Validate required fields based on connection type
|
|
365
383
|
if (type === "postgres") {
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
384
|
+
const detailFields = ["host", "port", "databaseName", "userName"];
|
|
385
|
+
// A stored connection string is not readable, so its absence from
|
|
386
|
+
// the form does not mean there is none. withheldFields is what
|
|
387
|
+
// separates "this connection is described by a connection string"
|
|
388
|
+
// from "this connection has nothing".
|
|
389
|
+
const hasStoredConnectionString = withheldFields.has(
|
|
390
|
+
"postgresConnection.connectionString",
|
|
391
|
+
);
|
|
392
|
+
const describedByConnectionString =
|
|
393
|
+
!!connectionConfig.connectionString?.trim() ||
|
|
394
|
+
hasStoredConnectionString;
|
|
395
|
+
// Something has to describe the connection. A connection string
|
|
396
|
+
// does it on its own; otherwise all four detail fields are
|
|
397
|
+
// required, and "the form mentions one of them" is not enough.
|
|
398
|
+
if (!describedByConnectionString) {
|
|
399
|
+
const requiredFields = detailFields;
|
|
377
400
|
for (const fieldName of requiredFields) {
|
|
378
401
|
if (!connectionConfig[fieldName]) {
|
|
379
402
|
throw new Error(
|
|
@@ -382,10 +405,6 @@ export default function EditConnectionDialog({
|
|
|
382
405
|
}
|
|
383
406
|
}
|
|
384
407
|
}
|
|
385
|
-
} else if (type === "bigquery") {
|
|
386
|
-
if (!connectionConfig.serviceAccountKeyJson) {
|
|
387
|
-
throw new Error("Service Account Key JSON is required");
|
|
388
|
-
}
|
|
389
408
|
} else if (type === "snowflake") {
|
|
390
409
|
if (!connectionConfig.account) {
|
|
391
410
|
throw new Error("Account is required");
|
|
@@ -396,9 +415,6 @@ export default function EditConnectionDialog({
|
|
|
396
415
|
if (!connectionConfig.warehouse) {
|
|
397
416
|
throw new Error("Warehouse is required");
|
|
398
417
|
}
|
|
399
|
-
if (!connectionConfig.password && !connectionConfig.privateKey) {
|
|
400
|
-
throw new Error("Either password or private key is required");
|
|
401
|
-
}
|
|
402
418
|
} else if (type === "trino") {
|
|
403
419
|
if (!connectionConfig.server) {
|
|
404
420
|
throw new Error("Server is required");
|
|
@@ -406,25 +422,8 @@ export default function EditConnectionDialog({
|
|
|
406
422
|
if (!connectionConfig.user) {
|
|
407
423
|
throw new Error("User is required");
|
|
408
424
|
}
|
|
409
|
-
// Password is required for HTTPS unless peakaKey is used
|
|
410
|
-
const server = connectionConfig.server.trim();
|
|
411
|
-
if (
|
|
412
|
-
server.startsWith("https://") &&
|
|
413
|
-
!connectionConfig.password &&
|
|
414
|
-
!connectionConfig.peakaKey
|
|
415
|
-
) {
|
|
416
|
-
throw new Error(
|
|
417
|
-
"Password is required for HTTPS connections (or use Peaka Key)",
|
|
418
|
-
);
|
|
419
|
-
}
|
|
420
425
|
} else if (type === "mysql") {
|
|
421
|
-
const requiredFields = [
|
|
422
|
-
"host",
|
|
423
|
-
"port",
|
|
424
|
-
"database",
|
|
425
|
-
"user",
|
|
426
|
-
"password",
|
|
427
|
-
];
|
|
426
|
+
const requiredFields = ["host", "port", "database", "user"];
|
|
428
427
|
for (const fieldName of requiredFields) {
|
|
429
428
|
if (!connectionConfig[fieldName]) {
|
|
430
429
|
throw new Error(
|
|
@@ -432,10 +431,6 @@ export default function EditConnectionDialog({
|
|
|
432
431
|
);
|
|
433
432
|
}
|
|
434
433
|
}
|
|
435
|
-
} else if (type === "motherduck") {
|
|
436
|
-
if (!connectionConfig.accessToken) {
|
|
437
|
-
throw new Error("Access Token is required");
|
|
438
|
-
}
|
|
439
434
|
} else if (type === "databricks") {
|
|
440
435
|
if (!connectionConfig.host) {
|
|
441
436
|
throw new Error("Host is required");
|
|
@@ -443,14 +438,6 @@ export default function EditConnectionDialog({
|
|
|
443
438
|
if (!connectionConfig.path) {
|
|
444
439
|
throw new Error("HTTP Path is required");
|
|
445
440
|
}
|
|
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
|
-
}
|
|
454
441
|
}
|
|
455
442
|
|
|
456
443
|
connectionPayload = {
|
|
@@ -735,7 +722,10 @@ export default function EditConnectionDialog({
|
|
|
735
722
|
field.name === "region"
|
|
736
723
|
? "us-east-1"
|
|
737
724
|
: field.name ===
|
|
738
|
-
|
|
725
|
+
"secretAccessKey" &&
|
|
726
|
+
withheldFields.has(
|
|
727
|
+
"ducklakeConnection.storage.s3Connection.secretAccessKey",
|
|
728
|
+
)
|
|
739
729
|
? "Leave empty to keep existing"
|
|
740
730
|
: undefined
|
|
741
731
|
}
|
|
@@ -781,7 +771,10 @@ export default function EditConnectionDialog({
|
|
|
781
771
|
`gcs_${field.name}`,
|
|
782
772
|
)}
|
|
783
773
|
placeholder={
|
|
784
|
-
field.name === "secret"
|
|
774
|
+
field.name === "secret" &&
|
|
775
|
+
withheldFields.has(
|
|
776
|
+
"ducklakeConnection.storage.gcsConnection.secret",
|
|
777
|
+
)
|
|
785
778
|
? "Leave empty to keep existing"
|
|
786
779
|
: undefined
|
|
787
780
|
}
|
|
@@ -979,13 +972,23 @@ export default function EditConnectionDialog({
|
|
|
979
972
|
connection?.[attributesFieldName[type] ?? ""]?.[
|
|
980
973
|
field.name ?? ""
|
|
981
974
|
] ?? "";
|
|
975
|
+
// Wider than the submit path's check on purpose: a
|
|
976
|
+
// password-typed field that nobody added to
|
|
977
|
+
// SERVER_HELD_SECRETS still renders as a secret, so it
|
|
978
|
+
// is never prefilled. It would, however, submit an
|
|
979
|
+
// empty string, which reads as an explicit clear, so a
|
|
980
|
+
// new secret field belongs in that set.
|
|
982
981
|
const isPasswordField =
|
|
983
982
|
field.type === "password" ||
|
|
984
|
-
field.name
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
983
|
+
SERVER_HELD_SECRETS.has(field.name);
|
|
984
|
+
// Whether THIS connection holds a value for THIS field,
|
|
985
|
+
// rather than whether the field is the kind that can
|
|
986
|
+
// hold one. Saying "leave empty to keep it" over a box
|
|
987
|
+
// with nothing behind it is the confusion
|
|
988
|
+
// withheldFields exists to remove.
|
|
989
|
+
const isStored = withheldFields.has(
|
|
990
|
+
`${attributesFieldName[type] ?? ""}.${field.name}`,
|
|
991
|
+
);
|
|
989
992
|
return (
|
|
990
993
|
<TextField
|
|
991
994
|
key={field.name}
|
|
@@ -1003,10 +1006,17 @@ export default function EditConnectionDialog({
|
|
|
1003
1006
|
}
|
|
1004
1007
|
defaultValue={existingValue}
|
|
1005
1008
|
placeholder={
|
|
1006
|
-
|
|
1009
|
+
isStored
|
|
1007
1010
|
? "Leave empty to keep existing"
|
|
1008
1011
|
: undefined
|
|
1009
1012
|
}
|
|
1013
|
+
helperText={
|
|
1014
|
+
isPasswordField
|
|
1015
|
+
? isStored
|
|
1016
|
+
? "Stored value is not shown. Leave empty to keep it."
|
|
1017
|
+
: "No value stored."
|
|
1018
|
+
: undefined
|
|
1019
|
+
}
|
|
1010
1020
|
/>
|
|
1011
1021
|
);
|
|
1012
1022
|
})
|
|
@@ -151,9 +151,9 @@ describe("the version reaches what the manifest drives", () => {
|
|
|
151
151
|
it("runs the tile's query against the same version", async () => {
|
|
152
152
|
render(dashboardAt("v2"), { wrapper: serverWrapper });
|
|
153
153
|
|
|
154
|
-
await waitFor(() => expect(cacheKeys("
|
|
154
|
+
await waitFor(() => expect(cacheKeys("queryResult").length).toBe(1));
|
|
155
155
|
expect(tileRequest()?.versionId).toBe("v2");
|
|
156
|
-
expect(cacheKeys("
|
|
156
|
+
expect(cacheKeys("queryResult")[0]).toContain('"v2"');
|
|
157
157
|
});
|
|
158
158
|
|
|
159
159
|
it("runs every composite tile against the same version", async () => {
|
|
@@ -171,9 +171,8 @@ describe("the version reaches what the manifest drives", () => {
|
|
|
171
171
|
|
|
172
172
|
render(dashboardAt("v2"), { wrapper: serverWrapper });
|
|
173
173
|
|
|
174
|
-
await waitFor(() => expect(cacheKeys("
|
|
175
|
-
for (const key of cacheKeys("
|
|
176
|
-
expect(key).toContain('"v2"');
|
|
174
|
+
await waitFor(() => expect(cacheKeys("queryResult").length).toBe(2));
|
|
175
|
+
for (const key of cacheKeys("queryResult")) expect(key).toContain('"v2"');
|
|
177
176
|
});
|
|
178
177
|
|
|
179
178
|
it("runs the control's suggest query against the same version", async () => {
|
|
@@ -195,7 +194,7 @@ describe("the version reaches what the manifest drives", () => {
|
|
|
195
194
|
const { rerender } = render(dashboardAt("v1"), {
|
|
196
195
|
wrapper: serverWrapper,
|
|
197
196
|
});
|
|
198
|
-
await waitFor(() => expect(cacheKeys("
|
|
197
|
+
await waitFor(() => expect(cacheKeys("queryResult").length).toBe(1));
|
|
199
198
|
|
|
200
199
|
fireEvent.change(await screen.findByLabelText("REGION"), {
|
|
201
200
|
target: { value: "CA" },
|
|
@@ -206,10 +205,8 @@ describe("the version reaches what the manifest drives", () => {
|
|
|
206
205
|
|
|
207
206
|
rerender(dashboardAt("v2"));
|
|
208
207
|
|
|
209
|
-
await waitFor(() => expect(cacheKeys("
|
|
210
|
-
const v2 = cacheKeys("
|
|
211
|
-
key.includes('"v2"'),
|
|
212
|
-
);
|
|
208
|
+
await waitFor(() => expect(cacheKeys("queryResult").length).toBe(3));
|
|
209
|
+
const v2 = cacheKeys("queryResult").filter((key) => key.includes('"v2"'));
|
|
213
210
|
expect(v2).toHaveLength(1);
|
|
214
211
|
expect(v2[0]).not.toContain("CA");
|
|
215
212
|
});
|