@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.
Files changed (221) hide show
  1. package/README.md +180 -204
  2. package/dist/DocumentStorageProvider-BeBD0uWc.cjs.js +134 -0
  3. package/dist/DocumentStorageProvider-tGvodI8f.es.js +24268 -0
  4. package/dist/RenderedResult-CPi6uQWq.cjs.js +115 -0
  5. package/dist/RenderedResult-mDE-4u8S.es.js +542 -0
  6. package/dist/{ServerProvider-xXW1HJOJ.cjs.js → ServerProvider-CH71GsoL.cjs.js} +1 -1
  7. package/dist/{ServerProvider-ksC5Su_x.es.js → ServerProvider-X2Ma0HRs.es.js} +324 -359
  8. package/dist/builder/index.cjs.js +105 -0
  9. package/dist/builder/index.d.ts +2 -0
  10. package/dist/builder/index.es.js +9561 -0
  11. package/dist/builder-entry.d.ts +8 -0
  12. package/dist/client/api.d.ts +13 -1
  13. package/dist/client/index.cjs.js +1 -1
  14. package/dist/client/index.es.js +1 -1
  15. package/dist/components/ApiErrorDisplay.d.ts +1 -2
  16. package/dist/components/Dashboard/Dashboard.d.ts +23 -16
  17. package/dist/components/Dashboard/DashboardGrid.d.ts +67 -0
  18. package/dist/components/Dashboard/DashboardTile.d.ts +6 -1
  19. package/dist/components/Dashboard/ExploreDialog.d.ts +18 -0
  20. package/dist/components/Dashboard/RowsDialog.d.ts +47 -0
  21. package/dist/components/Dashboard/TileCard.d.ts +44 -0
  22. package/dist/components/Dashboard/index.d.ts +2 -0
  23. package/dist/components/Dashboard/promoteMeasureRow.d.ts +40 -0
  24. package/dist/components/Dashboard/telemetry.d.ts +43 -0
  25. package/dist/components/DashboardBuilder/AddTileDialog.d.ts +35 -0
  26. package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +29 -0
  27. package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +112 -0
  28. package/dist/components/DashboardBuilder/DashboardEditor.d.ts +32 -0
  29. package/dist/components/DashboardBuilder/DiffDialog.d.ts +15 -0
  30. package/dist/components/DashboardBuilder/DrillDialog.d.ts +15 -0
  31. package/dist/components/DashboardBuilder/FilterDialog.d.ts +54 -0
  32. package/dist/components/DashboardBuilder/FilterStrip.d.ts +17 -0
  33. package/dist/components/DashboardBuilder/SettingsPopover.d.ts +20 -0
  34. package/dist/components/DashboardBuilder/TileFrame.d.ts +42 -0
  35. package/dist/components/DashboardBuilder/TileMenu.d.ts +24 -0
  36. package/dist/components/DashboardBuilder/catalog.d.ts +62 -0
  37. package/dist/components/DashboardBuilder/controls.d.ts +157 -0
  38. package/dist/components/DashboardBuilder/diff.d.ts +35 -0
  39. package/dist/components/DashboardBuilder/document.d.ts +218 -0
  40. package/dist/components/DashboardBuilder/layout.d.ts +71 -0
  41. package/dist/components/DashboardBuilder/malloyText.d.ts +45 -0
  42. package/dist/components/DashboardBuilder/preview.d.ts +60 -0
  43. package/dist/components/DashboardBuilder/readDocument.d.ts +106 -0
  44. package/dist/components/DashboardBuilder/sortable.d.ts +51 -0
  45. package/dist/components/DashboardBuilder/spliceDocument.d.ts +44 -0
  46. package/dist/components/DashboardBuilder/testing/fixtures.d.ts +10 -0
  47. package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +22 -0
  48. package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +63 -0
  49. package/dist/components/DashboardBuilder/useDraft.d.ts +13 -0
  50. package/dist/components/DashboardBuilder/useFilterForm.d.ts +65 -0
  51. package/dist/components/DashboardBuilder/useTileReorder.d.ts +22 -0
  52. package/dist/components/DashboardBuilder/useTileResize.d.ts +29 -0
  53. package/dist/components/DocumentStorage/BrowserDocumentStorage.d.ts +14 -0
  54. package/dist/components/DocumentStorage/DocumentStorage.d.ts +58 -0
  55. package/dist/components/DocumentStorage/DocumentStorageProvider.d.ts +25 -0
  56. package/dist/components/DocumentStorage/index.d.ts +3 -0
  57. package/dist/components/FloatingIconButton.d.ts +16 -0
  58. package/dist/components/Model/index.d.ts +0 -1
  59. package/dist/components/Prose.d.ts +46 -0
  60. package/dist/components/RenderedResult/RenderedResult.d.ts +12 -0
  61. package/dist/components/RenderedResult/ResultContainer.d.ts +7 -1
  62. package/dist/components/RenderedResult/ResultPanel.d.ts +30 -0
  63. package/dist/components/RenderedResult/index.d.ts +2 -0
  64. package/dist/components/RenderedResult/resultSizing.d.ts +183 -0
  65. package/dist/components/drill/index.d.ts +2 -1
  66. package/dist/components/drill/resolveDrill.d.ts +22 -0
  67. package/dist/components/drill/useDrill.d.ts +11 -2
  68. package/dist/components/drill/useDrillSelf.d.ts +46 -0
  69. package/dist/components/given/filterValue.d.ts +63 -0
  70. package/dist/components/given/index.d.ts +1 -0
  71. package/dist/components/given/useGivenUrlParams.d.ts +39 -0
  72. package/dist/components/index.d.ts +3 -3
  73. package/dist/components/styles.d.ts +3 -7
  74. package/dist/core-8NVBCLZh.cjs.js +148 -0
  75. package/dist/{core-BY7vB5gN.es.js → core-B8oMW4sm.es.js} +3540 -2335
  76. package/dist/hooks/index.d.ts +3 -1
  77. package/dist/hooks/useDocumentControls.d.ts +70 -0
  78. package/dist/hooks/useQueryResult.d.ts +40 -0
  79. package/dist/hooks/useSuggestOptions.d.ts +28 -12
  80. package/dist/index.cjs.js +34 -1
  81. package/dist/index.es.js +21487 -79
  82. package/dist/sdk.css +1 -1
  83. package/dist/styles.css +0 -1
  84. package/dist/utils/malloyLiteral.d.ts +11 -0
  85. package/package.json +25 -14
  86. package/src/builder-entry.ts +55 -0
  87. package/src/components/ApiErrorDisplay.tsx +1 -1
  88. package/src/components/Connections/EditConnectionDialog.tsx +96 -86
  89. package/src/components/Dashboard/Dashboard.spec.tsx +7 -10
  90. package/src/components/Dashboard/Dashboard.tsx +184 -229
  91. package/src/components/Dashboard/DashboardGrid.tsx +124 -0
  92. package/src/components/Dashboard/DashboardTile.spec.tsx +30 -6
  93. package/src/components/Dashboard/DashboardTile.tsx +67 -101
  94. package/src/components/Dashboard/ExploreDialog.tsx +84 -0
  95. package/src/components/Dashboard/RowsDialog.spec.ts +42 -0
  96. package/src/components/Dashboard/RowsDialog.tsx +234 -0
  97. package/src/components/Dashboard/TileCard.tsx +120 -0
  98. package/src/components/Dashboard/index.ts +2 -0
  99. package/src/components/Dashboard/promoteMeasureRow.spec.ts +207 -0
  100. package/src/components/Dashboard/promoteMeasureRow.ts +160 -0
  101. package/src/components/Dashboard/telemetry.ts +44 -0
  102. package/src/components/Dashboard/tileGridColumn.spec.ts +1 -1
  103. package/src/components/DashboardBuilder/AddTileDialog.tsx +249 -0
  104. package/src/components/DashboardBuilder/BuilderToolbar.tsx +270 -0
  105. package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +858 -0
  106. package/src/components/DashboardBuilder/DashboardBuilder.tsx +653 -0
  107. package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +211 -0
  108. package/src/components/DashboardBuilder/DashboardEditor.tsx +493 -0
  109. package/src/components/DashboardBuilder/DiffDialog.tsx +129 -0
  110. package/src/components/DashboardBuilder/DrillDialog.tsx +281 -0
  111. package/src/components/DashboardBuilder/FilterDialog.tsx +581 -0
  112. package/src/components/DashboardBuilder/FilterStrip.tsx +125 -0
  113. package/src/components/DashboardBuilder/SettingsPopover.tsx +168 -0
  114. package/src/components/DashboardBuilder/TileFrame.tsx +380 -0
  115. package/src/components/DashboardBuilder/TileMenu.tsx +188 -0
  116. package/src/components/DashboardBuilder/catalog.spec.ts +215 -0
  117. package/src/components/DashboardBuilder/catalog.ts +225 -0
  118. package/src/components/DashboardBuilder/controls.spec.ts +243 -0
  119. package/src/components/DashboardBuilder/controls.ts +398 -0
  120. package/src/components/DashboardBuilder/diff.spec.ts +44 -0
  121. package/src/components/DashboardBuilder/diff.ts +93 -0
  122. package/src/components/DashboardBuilder/document.ts +209 -0
  123. package/src/components/DashboardBuilder/keepRowStructure.spec.ts +84 -0
  124. package/src/components/DashboardBuilder/layout.ts +143 -0
  125. package/src/components/DashboardBuilder/malloyText.spec.ts +84 -0
  126. package/src/components/DashboardBuilder/malloyText.ts +151 -0
  127. package/src/components/DashboardBuilder/moveIntoGap.spec.ts +90 -0
  128. package/src/components/DashboardBuilder/preview.spec.ts +149 -0
  129. package/src/components/DashboardBuilder/preview.ts +172 -0
  130. package/src/components/DashboardBuilder/readDocument.spec.ts +375 -0
  131. package/src/components/DashboardBuilder/readDocument.ts +467 -0
  132. package/src/components/DashboardBuilder/sortable.tsx +151 -0
  133. package/src/components/DashboardBuilder/spliceDocument.spec.ts +1108 -0
  134. package/src/components/DashboardBuilder/spliceDocument.ts +1098 -0
  135. package/src/components/DashboardBuilder/testing/fixtures.ts +48 -0
  136. package/src/components/DashboardBuilder/useBuilderShortcuts.ts +88 -0
  137. package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +255 -0
  138. package/src/components/DashboardBuilder/useDashboardEditor.ts +193 -0
  139. package/src/components/DashboardBuilder/useDraft.ts +43 -0
  140. package/src/components/DashboardBuilder/useFilterForm.spec.tsx +144 -0
  141. package/src/components/DashboardBuilder/useFilterForm.ts +352 -0
  142. package/src/components/DashboardBuilder/useTileReorder.spec.tsx +97 -0
  143. package/src/components/DashboardBuilder/useTileReorder.ts +115 -0
  144. package/src/components/DashboardBuilder/useTileResize.spec.tsx +121 -0
  145. package/src/components/DashboardBuilder/useTileResize.ts +110 -0
  146. package/src/components/DashboardBuilder/withGaps.spec.ts +96 -0
  147. package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +81 -0
  148. package/src/components/DocumentStorage/BrowserDocumentStorage.ts +105 -0
  149. package/src/components/DocumentStorage/DocumentStorage.ts +73 -0
  150. package/src/components/DocumentStorage/DocumentStorageProvider.tsx +58 -0
  151. package/src/components/DocumentStorage/index.ts +16 -0
  152. package/src/components/Environment/About.tsx +4 -36
  153. package/src/components/FloatingIconButton.tsx +41 -0
  154. package/src/components/Model/Model.tsx +6 -23
  155. package/src/components/Model/ModelCell.tsx +34 -72
  156. package/src/components/Model/index.ts +0 -1
  157. package/src/components/Notebook/Notebook.tsx +27 -156
  158. package/src/components/Notebook/NotebookCell.tsx +37 -191
  159. package/src/components/Prose.spec.tsx +85 -0
  160. package/src/components/Prose.tsx +179 -0
  161. package/src/components/QueryResult/QueryResult.tsx +15 -43
  162. package/src/components/RenderedResult/RenderedResult.tsx +86 -76
  163. package/src/components/RenderedResult/ResultContainer.tsx +25 -36
  164. package/src/components/RenderedResult/ResultPanel.spec.tsx +49 -0
  165. package/src/components/RenderedResult/ResultPanel.tsx +73 -0
  166. package/src/components/RenderedResult/index.ts +16 -0
  167. package/src/components/RenderedResult/resultSizing.spec.ts +249 -0
  168. package/src/components/RenderedResult/resultSizing.ts +308 -0
  169. package/src/components/ResultsDialog.tsx +2 -1
  170. package/src/components/drill/index.ts +6 -0
  171. package/src/components/drill/resolveDrill.ts +22 -1
  172. package/src/components/drill/useDrill.spec.tsx +94 -0
  173. package/src/components/drill/useDrill.tsx +52 -12
  174. package/src/components/drill/useDrillSelf.spec.tsx +64 -0
  175. package/src/components/drill/useDrillSelf.ts +110 -0
  176. package/src/components/given/GivenInput.spec.tsx +196 -2
  177. package/src/components/given/GivenInput.tsx +300 -25
  178. package/src/components/given/GivensPanel.tsx +1 -1
  179. package/src/components/given/filterValue.spec.ts +112 -0
  180. package/src/components/given/filterValue.ts +188 -0
  181. package/src/components/given/index.ts +4 -0
  182. package/src/components/given/useGivenUrlParams.spec.tsx +74 -0
  183. package/src/components/given/useGivenUrlParams.ts +87 -0
  184. package/src/components/index.ts +11 -3
  185. package/src/components/styles.ts +0 -37
  186. package/src/hooks/index.ts +13 -1
  187. package/src/hooks/useDocumentControls.ts +170 -0
  188. package/src/hooks/useGivensState.spec.ts +158 -0
  189. package/src/hooks/useGivensState.ts +114 -23
  190. package/src/hooks/useQueryResult.ts +82 -0
  191. package/src/hooks/useSuggestOptions.dom.spec.ts +60 -1
  192. package/src/hooks/useSuggestOptions.ts +94 -51
  193. package/src/utils/malloyLiteral.spec.ts +43 -0
  194. package/src/utils/malloyLiteral.ts +76 -0
  195. package/vite.config.ts +5 -1
  196. package/dist/components/AnalyzePackageButton.d.ts +0 -6
  197. package/dist/components/Workbook/BrowserWorkbookStorage.d.ts +0 -9
  198. package/dist/components/Workbook/EditableMalloyCell.d.ts +0 -11
  199. package/dist/components/Workbook/ModelPicker.d.ts +0 -11
  200. package/dist/components/Workbook/MutableCell.d.ts +0 -17
  201. package/dist/components/Workbook/Workbook.d.ts +0 -7
  202. package/dist/components/Workbook/WorkbookList.d.ts +0 -7
  203. package/dist/components/Workbook/WorkbookManager.d.ts +0 -84
  204. package/dist/components/Workbook/WorkbookStorage.d.ts +0 -17
  205. package/dist/components/Workbook/WorkbookStorageProvider.d.ts +0 -12
  206. package/dist/components/Workbook/index.d.ts +0 -7
  207. package/dist/core-CWKmWEg2.cjs.js +0 -148
  208. package/dist/index-B0WyZAUA.es.js +0 -66412
  209. package/dist/index-kxVD1RjY.cjs.js +0 -356
  210. package/dist/markdown-editor.css +0 -341
  211. package/src/components/AnalyzePackageButton.tsx +0 -319
  212. package/src/components/Workbook/BrowserWorkbookStorage.ts +0 -64
  213. package/src/components/Workbook/EditableMalloyCell.tsx +0 -49
  214. package/src/components/Workbook/ModelPicker.tsx +0 -134
  215. package/src/components/Workbook/MutableCell.tsx +0 -458
  216. package/src/components/Workbook/Workbook.tsx +0 -501
  217. package/src/components/Workbook/WorkbookList.tsx +0 -110
  218. package/src/components/Workbook/WorkbookManager.ts +0 -214
  219. package/src/components/Workbook/WorkbookStorage.ts +0 -35
  220. package/src/components/Workbook/WorkbookStorageProvider.tsx +0 -40
  221. 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
- if (!s3Config.secretAccessKey) {
204
- throw new Error("S3 Secret Access Key is required");
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
- // For updates, use existing values if not provided
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
- if (!gcsConfig.keyId && existingGcs.keyId) {
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
- // For password/secret fields, use existing value if form value is empty
344
- const isPasswordField =
345
- field.type === "password" ||
346
- field.name === "password" ||
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 (isPasswordField && existingValue) {
355
- // Keep existing password/secret if not provided
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 hasConnectionString =
367
- !!connectionConfig.connectionString?.trim();
368
- if (!hasConnectionString) {
369
- // All detailed fields are required if no connection string
370
- const requiredFields = [
371
- "host",
372
- "port",
373
- "databaseName",
374
- "userName",
375
- "password",
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
- "secretAccessKey"
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 === "password" ||
985
- field.name === "secretAccessKey" ||
986
- field.name === "secret" ||
987
- field.name === "accessToken" ||
988
- field.name === "privateKey";
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
- isPasswordField && existingValue
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("dashboardTile").length).toBe(1));
154
+ await waitFor(() => expect(cacheKeys("queryResult").length).toBe(1));
155
155
  expect(tileRequest()?.versionId).toBe("v2");
156
- expect(cacheKeys("dashboardTile")[0]).toContain('"v2"');
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("dashboardTile").length).toBe(2));
175
- for (const key of cacheKeys("dashboardTile"))
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("dashboardTile").length).toBe(1));
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("dashboardTile").length).toBe(3));
210
- const v2 = cacheKeys("dashboardTile").filter((key) =>
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
  });