@malloy-publisher/sdk 0.9.6 → 0.9.8

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 (350) hide show
  1. package/README.md +117 -17
  2. package/dist/{RenderedResult-qnpbr4tc.cjs.js → RenderedResult-BrvrMDAP.cjs.js} +1 -1
  3. package/dist/{RenderedResult-BUb2Xvr2.es.js → RenderedResult-DZj-FnOJ.es.js} +2 -2
  4. package/dist/{ServerProvider-C6QQVKPm.es.js → ServerProvider-B_bPAsu2.es.js} +595 -410
  5. package/dist/ServerProvider-DuEOzwPc.cjs.js +1 -0
  6. package/dist/builder/index.cjs.js +93 -93
  7. package/dist/builder/index.es.js +4630 -4562
  8. package/dist/builder-entry.d.ts +13 -12
  9. package/dist/client/api.d.ts +489 -111
  10. package/dist/client/index.cjs.js +1 -1
  11. package/dist/client/index.es.js +105 -95
  12. package/dist/components/Dashboard/DashboardTile.d.ts +3 -1
  13. package/dist/components/Dashboard/DashboardView.d.ts +1 -3
  14. package/dist/components/Dashboard/index.d.ts +0 -2
  15. package/dist/components/DocumentCreate/createDocument.d.ts +29 -9
  16. package/dist/components/DocumentCreate/documentPath.d.ts +21 -6
  17. package/dist/components/DocumentCreate/guards.d.ts +2 -3
  18. package/dist/components/DocumentCreate/index.d.ts +2 -3
  19. package/dist/components/DocumentCreate/newNotebook.d.ts +14 -5
  20. package/dist/components/DocumentStorage/BrowserDocumentStorage.d.ts +6 -0
  21. package/dist/components/DocumentStorage/DocumentStorage.d.ts +52 -24
  22. package/dist/components/Loading.d.ts +1 -1
  23. package/dist/components/Package/DataSchemaDialog.d.ts +26 -0
  24. package/dist/components/Package/NewDocumentDialog.d.ts +19 -10
  25. package/dist/components/Package/Package.d.ts +14 -9
  26. package/dist/components/Package/documentLocation.d.ts +66 -23
  27. package/dist/components/Package/index.d.ts +3 -2
  28. package/dist/components/Package/reportQueries.d.ts +8 -0
  29. package/dist/components/Package/useDocumentLocation.d.ts +36 -6
  30. package/dist/components/Package/useDraftLayout.d.ts +20 -0
  31. package/dist/components/Report/CellReport.d.ts +89 -0
  32. package/dist/components/Report/LinearReport.d.ts +18 -0
  33. package/dist/components/Report/Report.d.ts +62 -0
  34. package/dist/components/Report/index.d.ts +2 -0
  35. package/dist/components/Report/telemetry.d.ts +163 -0
  36. package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.d.ts +2 -2
  37. package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.d.ts +2 -2
  38. package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.d.ts +5 -4
  39. package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.d.ts +5 -1
  40. package/dist/components/{DashboardBuilder → ReportBuilder}/EditorSurface.d.ts +10 -7
  41. package/dist/components/{DashboardBuilder/DashboardBuilder.d.ts → ReportBuilder/ReportBuilder.d.ts} +17 -8
  42. package/dist/components/{DashboardBuilder/DashboardEditor.d.ts → ReportBuilder/ReportEditor.d.ts} +41 -14
  43. package/dist/components/ReportBuilder/builderReport.d.ts +14 -0
  44. package/dist/components/{DashboardBuilder → ReportBuilder}/catalog.d.ts +8 -5
  45. package/dist/components/{DashboardBuilder → ReportBuilder}/document.d.ts +3 -4
  46. package/dist/components/{DashboardBuilder → ReportBuilder}/documentSession.d.ts +1 -1
  47. package/dist/components/{DashboardBuilder → ReportBuilder}/imports.d.ts +5 -1
  48. package/dist/components/{DashboardBuilder → ReportBuilder}/malloyTree.d.ts +9 -0
  49. package/dist/components/{DashboardBuilder → ReportBuilder}/newDashboard.d.ts +7 -1
  50. package/dist/components/{DashboardBuilder → ReportBuilder}/readDocument.d.ts +7 -5
  51. package/dist/components/{DashboardBuilder → ReportBuilder}/readForEditor.d.ts +1 -1
  52. package/dist/components/ReportBuilder/reportTag.d.ts +52 -0
  53. package/dist/components/{DashboardBuilder → ReportBuilder}/spliceDocument.d.ts +1 -7
  54. package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.d.ts +2 -2
  55. package/dist/components/{DashboardBuilder → ReportBuilder}/useControlBindings.d.ts +2 -2
  56. package/dist/components/ReportBuilder/useEditorCatalog.d.ts +25 -0
  57. package/dist/components/{DashboardBuilder → ReportBuilder}/useHostCopy.d.ts +5 -3
  58. package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.d.ts +7 -5
  59. package/dist/components/{DashboardBuilder/useDashboardEditor.d.ts → ReportBuilder/useReportEditor.d.ts} +3 -7
  60. package/dist/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.d.ts +6 -4
  61. package/dist/components/{DashboardBuilder → ReportBuilder}/useTileEditing.d.ts +2 -2
  62. package/dist/components/ServerProvider.d.ts +2 -1
  63. package/dist/components/drill/resolveDrill.d.ts +8 -1
  64. package/dist/components/drill/useDrillSelf.d.ts +4 -2
  65. package/dist/components/index.d.ts +2 -1
  66. package/dist/components/{Dashboard → legacy}/Dashboard.d.ts +15 -9
  67. package/dist/components/legacy/MalloynbCells.d.ts +13 -0
  68. package/dist/components/legacy/Notebook.d.ts +15 -0
  69. package/dist/components/{DashboardBuilder → legacy}/NotebookEditor.d.ts +3 -3
  70. package/dist/components/legacy/builderNames.d.ts +10 -0
  71. package/dist/components/legacy/index.d.ts +11 -0
  72. package/dist/components/legacy/kindAdapter.d.ts +11 -0
  73. package/dist/components/legacy/kindTypedDrafts.d.ts +10 -0
  74. package/dist/components/legacy/nameAlias.d.ts +44 -0
  75. package/dist/components/legacy/queryKeys.d.ts +8 -0
  76. package/dist/index.cjs.js +19 -19
  77. package/dist/index.es.js +7984 -7452
  78. package/dist/text/index.es.js +2 -2
  79. package/dist/{text-entry-CA0LZ1xL.es.js → text-entry-72YFLeNk.es.js} +10 -10
  80. package/dist/useCompiledDocument-oocN5cGE.cjs.js +141 -0
  81. package/dist/{useCompiledDocument-0sxonf6N.es.js → useCompiledDocument-x0B2RAH3.es.js} +4593 -4395
  82. package/package.json +2 -2
  83. package/src/builder-entry.ts +32 -24
  84. package/src/components/Dashboard/DashboardTile.tsx +17 -0
  85. package/src/components/Dashboard/DashboardView.spec.tsx +0 -21
  86. package/src/components/Dashboard/DashboardView.tsx +8 -24
  87. package/src/components/Dashboard/dropValueUrlTags.spec.ts +1 -4
  88. package/src/components/Dashboard/index.ts +0 -2
  89. package/src/components/DocumentCreate/createDocument.spec.ts +346 -53
  90. package/src/components/DocumentCreate/createDocument.ts +143 -63
  91. package/src/components/DocumentCreate/documentPath.ts +41 -12
  92. package/src/components/DocumentCreate/guards.ts +7 -15
  93. package/src/components/DocumentCreate/index.ts +3 -7
  94. package/src/components/DocumentCreate/newNotebook.spec.ts +113 -43
  95. package/src/components/DocumentCreate/newNotebook.ts +32 -10
  96. package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +130 -28
  97. package/src/components/DocumentStorage/BrowserDocumentStorage.ts +78 -40
  98. package/src/components/DocumentStorage/DocumentStorage.contract.spec.tsx +426 -0
  99. package/src/components/DocumentStorage/DocumentStorage.ts +57 -24
  100. package/src/components/Home/AddEnvironmentDialog.tsx +1 -1
  101. package/src/components/Home/Home.tsx +1 -1
  102. package/src/components/Loading.tsx +1 -1
  103. package/src/components/Model/SourcesExplorer.tsx +1 -1
  104. package/src/components/Notebook/NotebookCell.tsx +6 -5
  105. package/src/components/Notebook/cellKind.spec.ts +15 -7
  106. package/src/components/Package/DataSchemaDialog.spec.tsx +85 -0
  107. package/src/components/Package/DataSchemaDialog.tsx +367 -0
  108. package/src/components/Package/NewDocumentDialog.spec.tsx +145 -88
  109. package/src/components/Package/NewDocumentDialog.tsx +93 -48
  110. package/src/components/Package/Package.artifacts.spec.tsx +79 -60
  111. package/src/components/Package/Package.create.spec.tsx +126 -112
  112. package/src/components/Package/Package.notebooks.spec.tsx +46 -27
  113. package/src/components/Package/Package.spec.tsx +43 -30
  114. package/src/components/Package/Package.tsx +173 -292
  115. package/src/components/Package/documentLocation.spec.ts +145 -50
  116. package/src/components/Package/documentLocation.ts +118 -39
  117. package/src/components/Package/index.ts +12 -3
  118. package/src/components/Package/reportQueries.ts +25 -0
  119. package/src/components/Package/useDocumentLocation.spec.ts +58 -0
  120. package/src/components/Package/useDocumentLocation.ts +90 -32
  121. package/src/components/Package/useDraftLayout.spec.tsx +143 -0
  122. package/src/components/Package/useDraftLayout.ts +81 -0
  123. package/src/components/Prose.spec.tsx +3 -3
  124. package/src/components/RenderedResult/RenderedResult.tsx +1 -1
  125. package/src/components/Report/CellReport.spec.tsx +155 -0
  126. package/src/components/{Notebook/Notebook.tsx → Report/CellReport.tsx} +178 -220
  127. package/src/components/Report/LinearReport.tsx +71 -0
  128. package/src/components/Report/Report.spec.tsx +238 -0
  129. package/src/components/Report/Report.telemetry.spec.tsx +292 -0
  130. package/src/components/Report/Report.tsx +277 -0
  131. package/src/components/Report/index.ts +12 -0
  132. package/src/components/Report/telemetry.spec.ts +90 -0
  133. package/src/components/Report/telemetry.ts +250 -0
  134. package/src/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.tsx +5 -5
  135. package/src/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.tsx +2 -2
  136. package/src/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.tsx +6 -7
  137. package/src/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.tsx +33 -0
  138. package/src/components/{DashboardBuilder → ReportBuilder}/DrillDialog.tsx +2 -2
  139. package/src/components/{DashboardBuilder → ReportBuilder}/EditorSurface.tsx +67 -107
  140. package/src/components/{DashboardBuilder → ReportBuilder}/FilterDialog.tsx +3 -4
  141. package/src/components/{DashboardBuilder/DashboardBuilder.charts.spec.tsx → ReportBuilder/ReportBuilder.charts.spec.tsx} +4 -4
  142. package/src/components/{DashboardBuilder/DashboardBuilder.exit.spec.tsx → ReportBuilder/ReportBuilder.exit.spec.tsx} +5 -5
  143. package/src/components/{DashboardBuilder/DashboardBuilder.inline.spec.tsx → ReportBuilder/ReportBuilder.inline.spec.tsx} +4 -4
  144. package/src/components/ReportBuilder/ReportBuilder.layoutSwitch.spec.tsx +145 -0
  145. package/src/components/{DashboardBuilder/DashboardBuilder.notebook.spec.tsx → ReportBuilder/ReportBuilder.notebook.spec.tsx} +22 -21
  146. package/src/components/{DashboardBuilder/DashboardBuilder.openDraft.spec.tsx → ReportBuilder/ReportBuilder.openDraft.spec.tsx} +3 -3
  147. package/src/components/{DashboardBuilder/DashboardBuilder.sources.spec.tsx → ReportBuilder/ReportBuilder.sources.spec.tsx} +19 -8
  148. package/src/components/{DashboardBuilder/DashboardBuilder.spec.tsx → ReportBuilder/ReportBuilder.spec.tsx} +34 -34
  149. package/src/components/{DashboardBuilder/DashboardBuilder.textTiles.spec.tsx → ReportBuilder/ReportBuilder.textTiles.spec.tsx} +5 -5
  150. package/src/components/{DashboardBuilder/DashboardBuilder.tsx → ReportBuilder/ReportBuilder.tsx} +46 -21
  151. package/src/components/{DashboardBuilder/DashboardEditor.authoritative.spec.tsx → ReportBuilder/ReportEditor.authoritative.spec.tsx} +28 -20
  152. package/src/components/{DashboardBuilder/DashboardEditor.emptyStart.spec.tsx → ReportBuilder/ReportEditor.emptyStart.spec.tsx} +19 -11
  153. package/src/components/{DashboardBuilder/DashboardEditor.filterTag.spec.tsx → ReportBuilder/ReportEditor.filterTag.spec.tsx} +7 -7
  154. package/src/components/{DashboardBuilder/DashboardEditor.notebook.spec.tsx → ReportBuilder/ReportEditor.notebook.spec.tsx} +70 -49
  155. package/src/components/{DashboardBuilder/DashboardEditor.package.spec.tsx → ReportBuilder/ReportEditor.package.spec.tsx} +52 -8
  156. package/src/components/{DashboardBuilder/DashboardEditor.resourceUri.spec.tsx → ReportBuilder/ReportEditor.resourceUri.spec.tsx} +50 -18
  157. package/src/components/{DashboardBuilder/DashboardEditor.spec.tsx → ReportBuilder/ReportEditor.spec.tsx} +65 -20
  158. package/src/components/{DashboardBuilder/DashboardEditor.textSource.spec.tsx → ReportBuilder/ReportEditor.textSource.spec.tsx} +6 -6
  159. package/src/components/{DashboardBuilder/DashboardEditor.tsx → ReportBuilder/ReportEditor.tsx} +92 -35
  160. package/src/components/{DashboardBuilder → ReportBuilder}/addTile.compile.spec.ts +6 -4
  161. package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.spec.ts +1 -0
  162. package/src/components/{DashboardBuilder → ReportBuilder}/artifactBlock.spec.ts +21 -29
  163. package/src/components/ReportBuilder/builderReport.ts +53 -0
  164. package/src/components/{DashboardBuilder → ReportBuilder}/catalog.spec.ts +28 -10
  165. package/src/components/{DashboardBuilder → ReportBuilder}/catalog.ts +17 -10
  166. package/src/components/{DashboardBuilder → ReportBuilder}/controls.spec.ts +1 -0
  167. package/src/components/{DashboardBuilder → ReportBuilder}/document.ts +4 -7
  168. package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.spec.ts +5 -5
  169. package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.ts +1 -1
  170. package/src/components/{DashboardBuilder → ReportBuilder}/imports.spec.ts +6 -2
  171. package/src/components/{DashboardBuilder → ReportBuilder}/imports.ts +8 -4
  172. package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.chart.spec.ts +1 -1
  173. package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.convert.spec.ts +9 -13
  174. package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.read.spec.ts +15 -15
  175. package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.ts +7 -2
  176. package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.ts +25 -0
  177. package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.spec.ts +12 -4
  178. package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.ts +11 -24
  179. package/src/components/{DashboardBuilder → ReportBuilder}/preview.spec.ts +1 -0
  180. package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.spec.ts +64 -36
  181. package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.ts +33 -32
  182. package/src/components/ReportBuilder/readForEditor.spec.ts +96 -0
  183. package/src/components/{DashboardBuilder → ReportBuilder}/readForEditor.ts +3 -11
  184. package/src/components/ReportBuilder/reportTag.ts +108 -0
  185. package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.imports.spec.ts +28 -1
  186. package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.spec.ts +32 -3
  187. package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.ts +37 -60
  188. package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.spec.ts +3 -3
  189. package/src/components/{DashboardBuilder → ReportBuilder}/testing/artifactTagParity.json +2 -2
  190. package/src/components/ReportBuilder/testing/drillResolution.json +279 -0
  191. package/src/components/ReportBuilder/testing/reportLayoutParity.json +125 -0
  192. package/src/components/{DashboardBuilder → ReportBuilder}/textTiles.spec.ts +66 -143
  193. package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.ts +2 -2
  194. package/src/components/{DashboardBuilder → ReportBuilder}/useControlBindings.ts +2 -2
  195. package/src/components/ReportBuilder/useEditorCatalog.spec.tsx +156 -0
  196. package/src/components/ReportBuilder/useEditorCatalog.ts +119 -0
  197. package/src/components/{DashboardBuilder → ReportBuilder}/useHostCopy.ts +7 -5
  198. package/src/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.ts +56 -35
  199. package/src/components/{DashboardBuilder/useDashboardEditor.spec.ts → ReportBuilder/useReportEditor.spec.ts} +6 -6
  200. package/src/components/{DashboardBuilder/useDashboardEditor.ts → ReportBuilder/useReportEditor.ts} +6 -17
  201. package/src/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.ts +36 -35
  202. package/src/components/{DashboardBuilder → ReportBuilder}/useTileEditing.ts +2 -2
  203. package/src/components/ServerProvider.tsx +2 -0
  204. package/src/components/drill/resolveDrill.ts +9 -2
  205. package/src/components/drill/useDrill.tsx +1 -0
  206. package/src/components/drill/useDrillSelf.spec.tsx +60 -7
  207. package/src/components/drill/useDrillSelf.ts +29 -12
  208. package/src/components/index.ts +2 -1
  209. package/src/components/{Dashboard → legacy}/Dashboard.spec.tsx +1 -1
  210. package/src/components/{Dashboard → legacy}/Dashboard.tsx +40 -28
  211. package/src/components/legacy/MalloynbCells.tsx +88 -0
  212. package/src/components/{Notebook → legacy}/Notebook.served.spec.tsx +17 -13
  213. package/src/components/{Notebook → legacy}/Notebook.spec.tsx +24 -20
  214. package/src/components/legacy/Notebook.tsx +44 -0
  215. package/src/components/{DashboardBuilder → legacy}/NotebookEditor.tsx +7 -4
  216. package/src/components/legacy/builderNames.ts +25 -0
  217. package/src/components/legacy/index.ts +20 -0
  218. package/src/components/legacy/kindAdapter.ts +19 -0
  219. package/src/components/legacy/kindTypedDrafts.ts +34 -0
  220. package/src/components/legacy/nameAlias.spec.ts +124 -0
  221. package/src/components/legacy/nameAlias.ts +95 -0
  222. package/src/components/legacy/queryKeys.ts +26 -0
  223. package/src/hooks/useGivensState.spec.ts +9 -9
  224. package/src/mainEntry.spec.ts +1 -1
  225. package/src/textEntry.spec.ts +9 -9
  226. package/src/utils/formatting.spec.ts +5 -5
  227. package/src/utils/parsing.spec.ts +1 -1
  228. package/src/utils/parsing.ts +1 -1
  229. package/dist/ServerProvider-Gj-im5VD.cjs.js +0 -1
  230. package/dist/components/Dashboard/telemetry.d.ts +0 -73
  231. package/dist/components/DashboardBuilder/builderReport.d.ts +0 -13
  232. package/dist/components/DashboardBuilder/telemetry.d.ts +0 -43
  233. package/dist/components/DocumentCreate/events.d.ts +0 -10
  234. package/dist/components/Notebook/Notebook.d.ts +0 -52
  235. package/dist/components/Notebook/index.d.ts +0 -1
  236. package/dist/useCompiledDocument-tBejqZ7s.cjs.js +0 -142
  237. package/src/components/Dashboard/telemetry.ts +0 -75
  238. package/src/components/DashboardBuilder/builderReport.ts +0 -74
  239. package/src/components/DashboardBuilder/readForEditor.spec.ts +0 -80
  240. package/src/components/DashboardBuilder/telemetry.ts +0 -47
  241. package/src/components/DashboardBuilder/testing/documentKindRule.json +0 -40
  242. package/src/components/DocumentCreate/events.ts +0 -15
  243. package/src/components/Notebook/index.ts +0 -4
  244. /package/dist/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.d.ts +0 -0
  245. /package/dist/components/{DashboardBuilder → ReportBuilder}/ChartPicker.d.ts +0 -0
  246. /package/dist/components/{DashboardBuilder → ReportBuilder}/DrillDialog.d.ts +0 -0
  247. /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterDialog.d.ts +0 -0
  248. /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterStrip.d.ts +0 -0
  249. /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.d.ts +0 -0
  250. /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineText.d.ts +0 -0
  251. /package/dist/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.d.ts +0 -0
  252. /package/dist/components/{DashboardBuilder → ReportBuilder}/TextTileBody.d.ts +0 -0
  253. /package/dist/components/{DashboardBuilder → ReportBuilder}/TileFrame.d.ts +0 -0
  254. /package/dist/components/{DashboardBuilder → ReportBuilder}/TileMenu.d.ts +0 -0
  255. /package/dist/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.d.ts +0 -0
  256. /package/dist/components/{DashboardBuilder → ReportBuilder}/annotationText.d.ts +0 -0
  257. /package/dist/components/{DashboardBuilder → ReportBuilder}/changedTile.d.ts +0 -0
  258. /package/dist/components/{DashboardBuilder → ReportBuilder}/chartLine.d.ts +0 -0
  259. /package/dist/components/{DashboardBuilder → ReportBuilder}/controls.d.ts +0 -0
  260. /package/dist/components/{DashboardBuilder → ReportBuilder}/inlineEdit.d.ts +0 -0
  261. /package/dist/components/{DashboardBuilder → ReportBuilder}/layout.d.ts +0 -0
  262. /package/dist/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.d.ts +0 -0
  263. /package/dist/components/{DashboardBuilder → ReportBuilder}/loadMalloy.d.ts +0 -0
  264. /package/dist/components/{DashboardBuilder → ReportBuilder}/openDraft.d.ts +0 -0
  265. /package/dist/components/{DashboardBuilder → ReportBuilder}/preview.d.ts +0 -0
  266. /package/dist/components/{DashboardBuilder → ReportBuilder}/sortable.d.ts +0 -0
  267. /package/dist/components/{DashboardBuilder → ReportBuilder}/spliceResult.d.ts +0 -0
  268. /package/dist/components/{DashboardBuilder → ReportBuilder}/tagParse.d.ts +0 -0
  269. /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.d.ts +0 -0
  270. /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/inline.d.ts +0 -0
  271. /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/resize.d.ts +0 -0
  272. /package/dist/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.d.ts +0 -0
  273. /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.d.ts +0 -0
  274. /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.d.ts +0 -0
  275. /package/dist/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.d.ts +0 -0
  276. /package/dist/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.d.ts +0 -0
  277. /package/dist/components/{DashboardBuilder → ReportBuilder}/useDraft.d.ts +0 -0
  278. /package/dist/components/{DashboardBuilder → ReportBuilder}/useExitGuard.d.ts +0 -0
  279. /package/dist/components/{DashboardBuilder → ReportBuilder}/useFilterForm.d.ts +0 -0
  280. /package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.d.ts +0 -0
  281. /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileReorder.d.ts +0 -0
  282. /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileResize.d.ts +0 -0
  283. /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.spec.tsx +0 -0
  284. /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.tsx +0 -0
  285. /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.render.spec.tsx +0 -0
  286. /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.spec.ts +0 -0
  287. /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.tsx +0 -0
  288. /package/src/components/{DashboardBuilder → ReportBuilder}/FilterStrip.tsx +0 -0
  289. /package/src/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.tsx +0 -0
  290. /package/src/components/{DashboardBuilder → ReportBuilder}/InlineText.tsx +0 -0
  291. /package/src/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.tsx +0 -0
  292. /package/src/components/{DashboardBuilder → ReportBuilder}/TextTileBody.tsx +0 -0
  293. /package/src/components/{DashboardBuilder → ReportBuilder}/TileFrame.tsx +0 -0
  294. /package/src/components/{DashboardBuilder → ReportBuilder}/TileMenu.tsx +0 -0
  295. /package/src/components/{DashboardBuilder → ReportBuilder}/__test__/inventory.ts +0 -0
  296. /package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.ts +0 -0
  297. /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.spec.ts +0 -0
  298. /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.ts +0 -0
  299. /package/src/components/{DashboardBuilder → ReportBuilder}/artifactTagParity.spec.ts +0 -0
  300. /package/src/components/{DashboardBuilder → ReportBuilder}/catalog.aggregate.spec.ts +0 -0
  301. /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.spec.ts +0 -0
  302. /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.ts +0 -0
  303. /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.spec.ts +0 -0
  304. /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.ts +0 -0
  305. /package/src/components/{DashboardBuilder → ReportBuilder}/controls.ts +0 -0
  306. /package/src/components/{DashboardBuilder → ReportBuilder}/emptyStart.spec.ts +0 -0
  307. /package/src/components/{DashboardBuilder → ReportBuilder}/inlineEdit.tsx +0 -0
  308. /package/src/components/{DashboardBuilder → ReportBuilder}/invariants.spec.ts +0 -0
  309. /package/src/components/{DashboardBuilder → ReportBuilder}/keepRowStructure.spec.ts +0 -0
  310. /package/src/components/{DashboardBuilder → ReportBuilder}/layout.ts +0 -0
  311. /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.spec.ts +0 -0
  312. /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.ts +0 -0
  313. /package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.spec.ts +0 -0
  314. /package/src/components/{DashboardBuilder → ReportBuilder}/moveIntoGap.spec.ts +0 -0
  315. /package/src/components/{DashboardBuilder → ReportBuilder}/openDraft.ts +0 -0
  316. /package/src/components/{DashboardBuilder → ReportBuilder}/preview.shapes.spec.ts +0 -0
  317. /package/src/components/{DashboardBuilder → ReportBuilder}/preview.ts +0 -0
  318. /package/src/components/{DashboardBuilder → ReportBuilder}/scannerShapes.spec.ts +0 -0
  319. /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.spec.ts +0 -0
  320. /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.tsx +0 -0
  321. /package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.chart.spec.ts +0 -0
  322. /package/src/components/{DashboardBuilder → ReportBuilder}/spliceResult.ts +0 -0
  323. /package/src/components/{DashboardBuilder → ReportBuilder}/statementExtent.spec.ts +0 -0
  324. /package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.ts +0 -0
  325. /package/src/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.ts +0 -0
  326. /package/src/components/{DashboardBuilder → ReportBuilder}/testing/inline.ts +0 -0
  327. /package/src/components/{DashboardBuilder → ReportBuilder}/testing/resize.ts +0 -0
  328. /package/src/components/{DashboardBuilder → ReportBuilder}/testing/urlRenderTags.json +0 -0
  329. /package/src/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.ts +0 -0
  330. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.spec.ts +0 -0
  331. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.ts +0 -0
  332. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.overlay.spec.tsx +0 -0
  333. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.spec.tsx +0 -0
  334. /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.ts +0 -0
  335. /package/src/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.ts +0 -0
  336. /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.spec.ts +0 -0
  337. /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.ts +0 -0
  338. /package/src/components/{DashboardBuilder → ReportBuilder}/useDraft.ts +0 -0
  339. /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.spec.ts +0 -0
  340. /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.ts +0 -0
  341. /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.existing.spec.tsx +0 -0
  342. /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.spec.tsx +0 -0
  343. /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.ts +0 -0
  344. /package/src/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.ts +0 -0
  345. /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.spec.tsx +0 -0
  346. /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.ts +0 -0
  347. /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.spec.tsx +0 -0
  348. /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.ts +0 -0
  349. /package/src/components/{DashboardBuilder → ReportBuilder}/withGaps.spec.ts +0 -0
  350. /package/src/components/{Notebook → legacy}/Notebook.layout.spec.tsx +0 -0
@@ -1,7 +1,6 @@
1
1
  // Copyright (c) Credible Data Inc.
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
- import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
5
4
  import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline";
6
5
  import OpenInNewIcon from "@mui/icons-material/OpenInNew";
7
6
  import {
@@ -10,14 +9,7 @@ import {
10
9
  Button,
11
10
  Container,
12
11
  IconButton,
13
- Menu,
14
- MenuItem,
15
12
  Stack,
16
- Table,
17
- TableBody,
18
- TableCell,
19
- TableHead,
20
- TableRow,
21
13
  Tooltip,
22
14
  Typography,
23
15
  } from "@mui/material";
@@ -28,49 +20,56 @@ import { useNarrowScreen } from "../../hooks/useNarrowScreen";
28
20
  import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
29
21
  import { ApiErrorDisplay } from "../ApiErrorDisplay";
30
22
  import { Loading } from "../Loading";
31
- import { chooseWorkspace } from "../DashboardBuilder/documentSession";
23
+ import { chooseWorkspace } from "../ReportBuilder/documentSession";
32
24
  import { createRoute, type CreateTarget } from "../DocumentCreate";
33
25
  import type {
34
26
  DocumentLocator,
35
- DocumentType,
36
27
  Workspace,
37
28
  } from "../DocumentStorage/DocumentStorage";
38
29
  import { useOptionalDocumentStorage } from "../DocumentStorage/DocumentStorageProvider";
39
- import { Notebook } from "../Notebook";
30
+ import { Report } from "../Report";
40
31
  import { useServer } from "../ServerProvider";
41
32
  import { NewDocumentDialog } from "./NewDocumentDialog";
33
+ import type { ReportEventHandler } from "../Report/telemetry";
34
+ import { DataSchemaDialog, formatRowCount } from "./DataSchemaDialog";
42
35
  import { encodeResourceUri, parseResourceUri } from "../../utils/formatting";
43
36
  import { serverBaseUrl } from "../../utils/dataAppEmbed";
44
37
  import ContentTypeIcon, {
45
38
  CONTENT_TINT,
46
39
  type ContentType,
47
40
  } from "./ContentTypeIcon";
48
- import { AppDialog } from "../AppDialog";
49
41
  import { ItemRow } from "../ItemRow";
50
42
  import { Materializations } from "../Materializations";
51
43
  import { PackageSection } from "../PackageSection";
44
+ import { draftKey } from "../DocumentCreate/documentPath";
52
45
  import {
53
- documentRoute,
54
46
  documentSlug,
55
- type DocumentKind,
47
+ listedLayout,
48
+ reportEditRoute,
49
+ reportRoute,
50
+ type ListedReport,
51
+ type ReportLayout,
56
52
  } from "./documentLocation";
57
-
58
- // The pinned README: the root `.malloynb`, or a served notebook named README in `notebooks/`.
53
+ import { invalidateReportQueries } from "./reportQueries";
54
+ import { useReportListing } from "./useDocumentLocation";
55
+
56
+ /**
57
+ * The pinned README: a report at the package root whose basename is README,
58
+ * in any case. The legacy root `README.malloynb` wins when both exist, so a
59
+ * listing order never flips the pin.
60
+ */
59
61
  const README_NOTEBOOK = "README.malloynb";
60
- const isServedReadme = (path: string | undefined) =>
61
- path?.toLowerCase() === "notebooks/readme.malloy";
62
-
63
- const draftPrefix = (
64
- environmentName: string,
65
- packageName: string,
66
- kind: DocumentType,
67
- ) => `${environmentName}/${packageName}/${kind}s/`;
62
+ const isRootReadme = (path: string | undefined) =>
63
+ !!path &&
64
+ !path.includes("/") &&
65
+ documentSlug(path)?.toLowerCase() === "readme";
68
66
 
69
- /** A served notebook opens by slug, like a dashboard; a `.malloynb` opens by path. */
70
-
71
- /** A dashboard or notebook the package page asks its host to open, and how. */
67
+ /** A report the package page asks its host to open, and how. */
72
68
  export interface OpenDocumentRequest {
73
- kind: DocumentKind;
69
+ /** The report's package path, `sales/q3.malloy`: its identity, and how to open it. */
70
+ path: string;
71
+ layout: ReportLayout;
72
+ /** @deprecated The basename, a label only: two reports may share it. Open by `path`. */
74
73
  slug: string;
75
74
  /** `edit` for a document just created or a draft picked up; `view` otherwise. */
76
75
  mode: "view" | "edit";
@@ -79,22 +78,25 @@ export interface OpenDocumentRequest {
79
78
  interface PackageProps {
80
79
  onClickPackageFile?: (to: string, event?: React.MouseEvent) => void;
81
80
  /**
82
- * Open a dashboard or notebook, to read or to edit. Where reading and
83
- * editing live is the host's business, not the package page's, so a host
84
- * with a builder of its own routes this. Absent, the page navigates to the
85
- * Console's own routes: the document's, and `/edit` under it to edit.
81
+ * Open a report, to read or to edit. Where reading and editing live is the
82
+ * host's business, not the package page's, so a host with a builder of its
83
+ * own routes this. Absent, the page navigates to the Console's own routes:
84
+ * the report's path, and the same path with `?edit` to edit.
86
85
  */
87
86
  onOpenDocument?: (
88
87
  request: OpenDocumentRequest,
89
88
  event?: React.MouseEvent,
90
89
  ) => void;
91
90
  resourceUri: string;
91
+ /** What the New report dialog creates, or why it could not; see `ReportEvent`. */
92
+ onEvent?: ReportEventHandler;
92
93
  }
93
94
 
94
95
  export default function Package({
95
96
  onClickPackageFile,
96
97
  onOpenDocument,
97
98
  resourceUri,
99
+ onEvent,
98
100
  }: PackageProps) {
99
101
  const { apiClients, server, mutable } = useServer();
100
102
  const queryClient = useQueryClient();
@@ -108,22 +110,22 @@ export default function Package({
108
110
  const openDocument =
109
111
  onOpenDocument ??
110
112
  ((request: OpenDocumentRequest, event?: React.MouseEvent) => {
111
- const to = `${documentRoute(environmentName, packageName, request.kind, request.slug)}${request.mode === "edit" ? "/edit" : ""}`;
113
+ const to =
114
+ request.mode === "edit"
115
+ ? reportEditRoute(environmentName, packageName, request.path)
116
+ : reportRoute(environmentName, packageName, request.path);
112
117
  // Without an event, called exactly as before this hook existed.
113
118
  if (event) onClick(to, event);
114
119
  else onClick(to);
115
120
  });
116
121
 
117
122
  const [schemaDatabase, setSchemaDatabase] = useState<Database | null>(null);
118
- const [creating, setCreating] = useState<DocumentType | undefined>(
119
- undefined,
120
- );
121
- const [newMenu, setNewMenu] = useState<HTMLElement | null>(null);
123
+ const [creating, setCreating] = useState(false);
122
124
  const narrow = useNarrowScreen();
123
125
 
124
- // Dashboards and notebooks the host keeps for this package and the package
125
- // does not have: the builder's drafts, listed so they are found rather than
126
- // stumbled on.
126
+ // Every report the host keeps for this package in a writeable workspace: the
127
+ // builder's drafts, both of reports the package does not have yet and of
128
+ // reports it does, listed so they are found rather than stumbled on.
127
129
  // Each carries the workspace's own description, because where a document is
128
130
  // kept is the backend's to say and only one host's answer is "this browser".
129
131
  const storage = useOptionalDocumentStorage()?.documentStorage;
@@ -147,24 +149,19 @@ export default function Package({
147
149
  }
148
150
  setWorkspace({ state: "ready", chosen: chooseWorkspace(workspaces) });
149
151
  const found: { locator: DocumentLocator; where: string }[] = [];
152
+ // One listing per workspace, every layout: a draft is found by its path under this package.
153
+ const prefix = draftKey(environmentName, packageName, "");
150
154
  for (const candidate of workspaces.filter((w) => w.writeable))
151
- for (const kind of ["dashboard", "notebook"] as const)
152
- for (const locator of await storage.listDocuments(candidate, kind))
153
- if (
154
- locator.path.startsWith(
155
- draftPrefix(environmentName, packageName, kind),
156
- )
157
- )
158
- found.push({ locator, where: candidate.description });
155
+ for (const locator of await storage.listDocuments(candidate))
156
+ if (locator.path.startsWith(prefix))
157
+ found.push({ locator, where: candidate.description });
159
158
  setDrafts(found);
160
159
  }, [storage, environmentName, packageName]);
161
160
  useEffect(() => {
162
161
  void refreshDrafts();
163
162
  }, [refreshDrafts]);
164
- const draftSlug = (locator: DocumentLocator) =>
165
- locator.path
166
- .slice(draftPrefix(environmentName, packageName, locator.type).length)
167
- .replace(/\.malloy$/, "");
163
+ const draftPath = (locator: DocumentLocator) =>
164
+ locator.path.slice(draftKey(environmentName, packageName, "").length);
168
165
 
169
166
  const pkgQuery = useQueryWithApiError({
170
167
  queryKey: ["package", environmentName, packageName, versionId],
@@ -177,29 +174,12 @@ export default function Package({
177
174
  ),
178
175
  });
179
176
 
180
- const notebooksQuery = useQueryWithApiError({
181
- queryKey: ["notebooks", environmentName, packageName, versionId],
182
- queryFn: async () => {
183
- try {
184
- return await apiClients.notebooks.listNotebooks(
185
- environmentName,
186
- packageName,
187
- versionId,
188
- );
189
- } catch (e) {
190
- // Non-fatal like the dashboards list: an older Publisher without
191
- // the route has no notebooks to list.
192
- const status = (e as { response?: { status?: number } })?.response
193
- ?.status;
194
- if (status === 404 || status === undefined) {
195
- return { data: [] } as Awaited<
196
- ReturnType<typeof apiClients.notebooks.listNotebooks>
197
- >;
198
- }
199
- throw e;
200
- }
201
- },
202
- });
177
+ // One listing for both layouts, by path, shared with every other reader.
178
+ const reportListing = useReportListing(
179
+ environmentName,
180
+ packageName,
181
+ versionId,
182
+ );
203
183
 
204
184
  const modelsQuery = useQueryWithApiError({
205
185
  queryKey: ["models", environmentName, packageName, versionId],
@@ -236,7 +216,7 @@ export default function Package({
236
216
  } catch (e) {
237
217
  // A 404 or transport-level failure (older Publisher without the
238
218
  // /data-apps route, network blip) is non-fatal: render the package
239
- // page without a Data Apps section. A genuinely missing package
219
+ // page without an Apps section. A genuinely missing package
240
220
  // surfaces its own error via the package query above, so an empty
241
221
  // list here can't hide it.
242
222
  const status = (e as { response?: { status?: number } })?.response
@@ -252,48 +232,22 @@ export default function Package({
252
232
  });
253
233
  const dataApps = dataAppsQuery.data?.data ?? [];
254
234
 
255
- const dashboardsQuery = useQueryWithApiError({
256
- queryKey: ["dashboards", environmentName, packageName, versionId],
257
- queryFn: async () => {
258
- try {
259
- return await apiClients.dashboards.listDashboards(
260
- environmentName,
261
- packageName,
262
- versionId,
263
- );
264
- } catch (e) {
265
- // Non-fatal for the same reasons as the data-apps list above: an
266
- // older Publisher without the route should render a package page
267
- // without a Dashboards section, not an error.
268
- const status = (e as { response?: { status?: number } })?.response
269
- ?.status;
270
- if (status === 404 || status === undefined) {
271
- return { data: [] } as Awaited<
272
- ReturnType<typeof apiClients.dashboards.listDashboards>
273
- >;
274
- }
275
- throw e;
276
- }
277
- },
278
- });
279
- const dashboards = dashboardsQuery.data?.data ?? [];
280
- const notebooks = (notebooksQuery.data?.data ?? [])
281
- .slice()
282
- .sort((a, b) => (a.path ?? "").localeCompare(b.path ?? ""));
283
- const artifacts = artifactRows(dashboards, notebooks);
284
- // A dashboard is listed once, under Artifacts. Its file is a model like any
285
- // other, so it would otherwise appear a second time under Semantic Models
286
- // where clicking it opens the Explorer rather than the dashboard. Untagged
287
- // shared includes in `dashboards/` are not dashboards and stay in the model
288
- // list, which is where they belong.
289
- const dashboardPaths = new Set(
290
- dashboards
291
- .map((dashboard) => dashboard.path)
235
+ const reports: ListedReport[] = reportListing.reports.filter(
236
+ (r) => !!r.path,
237
+ );
238
+ const artifacts = reportRows(reports);
239
+ // A report is listed once, under Reports. Its file is a model like any
240
+ // other, so it would otherwise appear a second time under Models
241
+ // where clicking it opens the Explorer rather than the report. The listed
242
+ // paths decide it, never a directory name.
243
+ const reportPaths = new Set(
244
+ reports
245
+ .map((report) => report.path)
292
246
  .filter((path): path is string => path !== undefined),
293
247
  );
294
248
  const models = (modelsQuery.data?.data ?? [])
295
249
  .slice()
296
- .filter((model) => !dashboardPaths.has(model.path))
250
+ .filter((model) => !reportPaths.has(model.path))
297
251
  .sort((a, b) => a.path.localeCompare(b.path));
298
252
  const databases = (databasesQuery.data?.data ?? [])
299
253
  .slice()
@@ -310,22 +264,16 @@ export default function Package({
310
264
  ...(versionId === undefined ? {} : { versionId }),
311
265
  })
312
266
  : undefined;
313
- // A name is chosen against the listings, so New waits for all three rather than offering names a still-loading listing would have taken.
314
- const listingsSettled = [dashboardsQuery, notebooksQuery, modelsQuery].every(
315
- (q) => q.isSuccess || q.isError,
316
- );
267
+ // A name is chosen against the listings, so New waits for both rather than offering names a still-loading listing would have taken.
268
+ const listingsSettled =
269
+ reportListing.settled && (modelsQuery.isSuccess || modelsQuery.isError);
317
270
  const canCreate = route !== undefined && listingsSettled;
318
271
  // The editors step aside on a narrow screen, so no entry point to one is offered there.
319
272
  const canNew = canCreate && !narrow;
320
273
  const createTarget = useMemo((): CreateTarget | undefined => {
321
274
  if (!canCreate) return undefined;
322
275
  const existing = [
323
- ...(dashboardsQuery.data?.data ?? []).flatMap((d) =>
324
- d.path ? [d.path] : [],
325
- ),
326
- ...(notebooksQuery.data?.data ?? []).flatMap((n) =>
327
- n.path ? [n.path] : [],
328
- ),
276
+ ...reportListing.reports.flatMap((r) => (r.path ? [r.path] : [])),
329
277
  ...(modelsQuery.data?.data ?? []).flatMap((m) =>
330
278
  m.path ? [m.path] : [],
331
279
  ),
@@ -362,48 +310,22 @@ export default function Package({
362
310
  environmentName,
363
311
  packageName,
364
312
  apiClients,
365
- dashboardsQuery.data,
366
- notebooksQuery.data,
313
+ reportListing.reports,
367
314
  modelsQuery.data,
368
315
  ]);
369
316
 
370
317
  const description = pkgQuery.data?.data?.description ?? "";
371
- // The root `.malloynb` wins when both exist, so a listing order never flips the pin.
372
318
  const readmePath = (
373
- notebooks.find((n) => n.path === README_NOTEBOOK) ??
374
- notebooks.find((n) => isServedReadme(n.path))
319
+ reports.find((r) => r.path === README_NOTEBOOK) ??
320
+ reports.find((r) => isRootReadme(r.path))
375
321
  )?.path;
376
- const readmeResourceUri = encodeResourceUri({
377
- environmentName,
378
- packageName,
379
- versionId,
380
- modelPath: readmePath,
381
- });
382
322
 
383
- // The dashboards list is part of the gate, not just the notebooks one,
384
- // because the models list is FILTERED by it. Gated on notebooks alone, a
385
- // dashboards call that resolves after the models call rendered the sections
386
- // with an empty `dashboardPaths`, so `dashboards/overview.malloy` appeared
387
- // under Semantic Models and then vanished: the double listing the filter
388
- // exists to prevent, briefly on screen.
389
- //
390
- // What this covers and what it COSTS, since the two are different questions.
391
- // It cannot hang the page on a FAILURE: the query above turns a 404 or a
392
- // transport failure into an empty list. It does add LATENCY, and to every
393
- // section rather than to the one that needs it: Notebooks, Semantic Models,
394
- // Data Apps and Databases now wait on the dashboards call where they used to
395
- // render as soon as notebooks resolved. The only thing that actually needs
396
- // the gate is the `dashboardPaths` filter on the models list.
397
- //
398
- // Accepted rather than narrowed because the cost is bounded and small:
399
- // `listDashboards` is a synchronous read off the already-loaded package
400
- // (`service/package.ts`, reached with `getPackage(name, false)`, so no
401
- // reload), which makes this one more parallel request and not a compile.
402
- // Narrowing it means gating only the models section, which trades this
403
- // whole-page wait for a models list that pops in after its neighbours.
404
- const isLoading =
405
- (!notebooksQuery.isSuccess && !notebooksQuery.isError) ||
406
- (!dashboardsQuery.isSuccess && !dashboardsQuery.isError);
323
+ // The models list is FILTERED by the report listing, so every section waits
324
+ // for it: gated on anything less, a late listing would show a report under
325
+ // Models and then take it away. A failure cannot hang the page, since the
326
+ // query turns a 404 or a transport failure into an empty list; the cost is
327
+ // one parallel request's latency.
328
+ const isLoading = !reportListing.settled;
407
329
 
408
330
  if (pkgQuery.isError) {
409
331
  return (
@@ -440,28 +362,10 @@ export default function Package({
440
362
 
441
363
  {isLoading && <Loading text="Loading package..." />}
442
364
 
443
- <Menu
444
- anchorEl={newMenu}
445
- open={newMenu !== null}
446
- onClose={() => setNewMenu(null)}
447
- >
448
- {(["dashboard", "notebook"] as const).map((kind) => (
449
- <MenuItem
450
- key={kind}
451
- onClick={() => {
452
- setNewMenu(null);
453
- setCreating(kind);
454
- }}
455
- >
456
- {kind === "dashboard" ? "Dashboard" : "Notebook"}
457
- </MenuItem>
458
- ))}
459
- </Menu>
460
-
461
365
  {createTarget && (
462
366
  <NewDocumentDialog
463
- open={creating !== undefined}
464
- kind={creating ?? "dashboard"}
367
+ open={creating}
368
+ layout="linear"
465
369
  environmentName={environmentName}
466
370
  packageName={packageName}
467
371
  {...(versionId !== undefined ? { versionId } : {})}
@@ -471,8 +375,7 @@ export default function Package({
471
375
  (path): path is string =>
472
376
  typeof path === "string" &&
473
377
  path.endsWith(".malloy") &&
474
- !path.startsWith("dashboards/") &&
475
- !path.startsWith("notebooks/"),
378
+ !reportPaths.has(path),
476
379
  )}
477
380
  modelsLoading={modelsQuery.isPending}
478
381
  {...(modelsQuery.isError
@@ -480,13 +383,19 @@ export default function Package({
480
383
  : {})}
481
384
  onRetryModels={() => void modelsQuery.refetch()}
482
385
  target={createTarget}
483
- onClose={() => setCreating(undefined)}
386
+ {...(onEvent ? { onEvent } : {})}
387
+ onClose={() => setCreating(false)}
484
388
  onCreated={(created) => {
485
- setCreating(undefined);
486
- for (const key of ["dashboards", "notebooks", "models"])
487
- void queryClient.invalidateQueries({ queryKey: [key] });
389
+ setCreating(false);
390
+ invalidateReportQueries(
391
+ queryClient,
392
+ environmentName,
393
+ packageName,
394
+ );
395
+ void queryClient.invalidateQueries({ queryKey: ["models"] });
488
396
  openDocument({
489
- kind: created.kind,
397
+ path: created.path,
398
+ layout: created.layout,
490
399
  slug: created.slug,
491
400
  mode: "edit",
492
401
  });
@@ -502,17 +411,28 @@ export default function Package({
502
411
  else here would say a word, and one failed list hides only
503
412
  half the artifacts. The 404 swallowed in each query is an
504
413
  older Publisher with no route, which genuinely has none. */}
505
- {(dashboardsQuery.isError || notebooksQuery.isError) && (
414
+ {reportListing.isError && (
506
415
  <Box sx={{ mb: 4 }}>
507
- <Alert severity="warning">
508
- Could not list some artifacts, so any this package has
509
- are missing from this page.
416
+ <Alert
417
+ severity="warning"
418
+ action={
419
+ <Button
420
+ color="inherit"
421
+ size="small"
422
+ onClick={() => void reportListing.refetch()}
423
+ >
424
+ Retry
425
+ </Button>
426
+ }
427
+ >
428
+ Could not list this package&apos;s reports, so any it
429
+ has are missing from this page.
510
430
  </Alert>
511
431
  </Box>
512
432
  )}
513
433
  {(artifacts.length > 0 || canCreate) && (
514
434
  <PackageSection
515
- title="Artifacts"
435
+ title="Reports"
516
436
  count={artifacts.length}
517
437
  {...(canNew
518
438
  ? {
@@ -520,14 +440,9 @@ export default function Package({
520
440
  <Button
521
441
  variant="outlined"
522
442
  size="small"
523
- endIcon={<ArrowDropDownIcon />}
524
- aria-haspopup="menu"
525
- aria-label="New"
526
- onClick={(event) =>
527
- setNewMenu(event.currentTarget)
528
- }
443
+ onClick={() => setCreating(true)}
529
444
  >
530
- New
445
+ New report
531
446
  </Button>
532
447
  ),
533
448
  }
@@ -535,13 +450,12 @@ export default function Package({
535
450
  >
536
451
  {artifacts.length === 0 && (
537
452
  <EmptyRow
538
- label="No artifacts yet"
453
+ label="No reports yet"
539
454
  {...(canNew
540
455
  ? {
541
456
  action: {
542
- label: "New artifact",
543
- onClick: (event) =>
544
- setNewMenu(event.currentTarget),
457
+ label: "New report",
458
+ onClick: () => setCreating(true),
545
459
  },
546
460
  }
547
461
  : {})}
@@ -549,25 +463,27 @@ export default function Package({
549
463
  )}
550
464
  {artifacts.map((artifact) => (
551
465
  <PackageItemRow
552
- key={`${artifact.kind}:${artifact.path}`}
466
+ key={artifact.path}
553
467
  type={
554
- artifact.kind === "dashboard"
468
+ artifact.layout === "grid"
555
469
  ? "dashboard"
556
470
  : "report"
557
471
  }
558
472
  label={artifact.label}
473
+ rightLabel={artifact.layout}
559
474
  {...(artifact.secondary === undefined
560
475
  ? {}
561
476
  : { description: artifact.secondary })}
562
477
  onClick={(event) =>
563
- artifact.slug === undefined
478
+ artifact.path.endsWith(".malloynb")
564
479
  ? onClick(
565
480
  `/${environmentName}/${packageName}/${artifact.path}`,
566
481
  event,
567
482
  )
568
483
  : openDocument(
569
484
  {
570
- kind: artifact.kind,
485
+ path: artifact.path,
486
+ layout: artifact.layout,
571
487
  slug: artifact.slug,
572
488
  mode: "view",
573
489
  },
@@ -582,19 +498,19 @@ export default function Package({
582
498
  <PackageSection title="Drafts" count={drafts.length}>
583
499
  {drafts.map(({ locator, where }) => (
584
500
  <PackageItemRow
585
- key={`${locator.type}:${locator.path}`}
501
+ key={`${locator.workspace}:${locator.path}`}
586
502
  type={
587
- locator.type === "dashboard"
588
- ? "dashboard"
589
- : "report"
503
+ locator.type === "grid" ? "dashboard" : "report"
590
504
  }
591
- label={draftSlug(locator)}
505
+ label={draftPath(locator)}
592
506
  rightLabel={where}
593
507
  onClick={(event) =>
594
508
  openDocument(
595
509
  {
596
- kind: locator.type,
597
- slug: draftSlug(locator),
510
+ path: draftPath(locator),
511
+ layout: locator.type,
512
+ slug:
513
+ documentSlug(draftPath(locator)) ?? "",
598
514
  mode: "edit",
599
515
  },
600
516
  event,
@@ -604,7 +520,7 @@ export default function Package({
604
520
  <Tooltip title="Delete this draft">
605
521
  <IconButton
606
522
  size="small"
607
- aria-label={`Delete draft ${draftSlug(locator)}`}
523
+ aria-label={`Delete draft ${draftPath(locator)}`}
608
524
  onClick={(event) => {
609
525
  event.stopPropagation();
610
526
  void storage
@@ -622,7 +538,7 @@ export default function Package({
622
538
  )}
623
539
 
624
540
  {dataApps.length > 0 && (
625
- <PackageSection title="Data Apps" count={dataApps.length}>
541
+ <PackageSection title="Apps" count={dataApps.length}>
626
542
  {dataApps.map((dataApp) => {
627
543
  const hasTitle =
628
544
  !!dataApp.title && dataApp.title !== dataApp.path;
@@ -686,7 +602,7 @@ export default function Package({
686
602
  </PackageSection>
687
603
  )}
688
604
 
689
- <PackageSection title="Semantic Models" count={models.length}>
605
+ <PackageSection title="Models" count={models.length}>
690
606
  {models.map((model) => (
691
607
  <PackageItemRow
692
608
  key={model.path}
@@ -703,7 +619,7 @@ export default function Package({
703
619
  {models.length === 0 && <EmptyRow label="No models" />}
704
620
  </PackageSection>
705
621
 
706
- <PackageSection title="Package Data" count={databases.length}>
622
+ <PackageSection title="Data" count={databases.length}>
707
623
  {databases.map((database) => (
708
624
  <PackageItemRow
709
625
  key={database.path}
@@ -727,47 +643,24 @@ export default function Package({
727
643
 
728
644
  {readmePath && (
729
645
  <Box sx={{ mt: 6 }}>
730
- <Notebook
731
- resourceUri={readmeResourceUri}
732
- onNavigate={onClick}
646
+ <Report
647
+ resourceUri={encodeResourceUri({
648
+ environmentName,
649
+ packageName,
650
+ versionId,
651
+ })}
652
+ path={readmePath}
653
+ onLinkNavigate={onClick}
733
654
  />
734
655
  </Box>
735
656
  )}
736
657
  </>
737
658
  )}
738
659
 
739
- <AppDialog
740
- open={schemaDatabase !== null}
660
+ <DataSchemaDialog
661
+ database={schemaDatabase}
741
662
  onClose={() => setSchemaDatabase(null)}
742
- title={schemaDatabase?.path ?? "Columns"}
743
- showClose
744
- >
745
- {schemaDatabase?.error && (
746
- <Typography variant="body2" color="error">
747
- {schemaDatabase.error}
748
- </Typography>
749
- )}
750
- {schemaDatabase?.info?.columns && (
751
- <Table size="small">
752
- <TableHead>
753
- <TableRow>
754
- <TableCell>Column</TableCell>
755
- <TableCell>Type</TableCell>
756
- </TableRow>
757
- </TableHead>
758
- <TableBody>
759
- {schemaDatabase.info.columns.map((column) => (
760
- <TableRow key={column.name}>
761
- <TableCell component="th" scope="row">
762
- {column.name}
763
- </TableCell>
764
- <TableCell>{column.type}</TableCell>
765
- </TableRow>
766
- ))}
767
- </TableBody>
768
- </Table>
769
- )}
770
- </AppDialog>
663
+ />
771
664
  </Container>
772
665
  );
773
666
  }
@@ -804,51 +697,47 @@ function PackageItemRow({
804
697
  );
805
698
  }
806
699
 
807
- interface ArtifactRow {
808
- kind: DocumentKind;
700
+ interface ReportRow {
809
701
  path: string;
810
- /** Absent for a `.malloynb`, which opens by path. */
811
- slug: string | undefined;
702
+ layout: ReportLayout;
703
+ /** The basename, a label. */
704
+ slug: string;
812
705
  label: string;
813
706
  /** The path, when the label alone does not say which file this is. */
814
707
  secondary: string | undefined;
815
708
  }
816
709
 
817
- /** Dashboards and notebooks as one list: the title when set, else the slug, ordered by what is shown. */
818
- function artifactRows(
819
- dashboards: readonly { name?: string; path?: string; title?: string }[],
820
- notebooks: readonly { path?: string; title?: string }[],
821
- ): ArtifactRow[] {
822
- const rows = [
823
- ...dashboards.map((d) => ({
824
- kind: "dashboard" as const,
825
- path: d.path ?? "",
826
- slug: d.name ?? documentSlug(d.path),
827
- title: d.title,
828
- })),
829
- ...notebooks.map((n) => ({
830
- kind: "notebook" as const,
831
- path: n.path ?? "",
832
- slug: documentSlug(n.path),
833
- title: n.title,
834
- })),
835
- ];
710
+ /** Every report as one list: the title when set, else the basename, ordered by what is shown. */
711
+ function reportRows(reports: readonly ListedReport[]): ReportRow[] {
712
+ const rows = reports.map((r) => ({
713
+ path: r.path ?? "",
714
+ layout: listedLayout(r),
715
+ slug: documentSlug(r.path) ?? r.path ?? "",
716
+ title: r.title,
717
+ }));
836
718
  const slugCount = new Map<string, number>();
837
719
  for (const row of rows)
838
- if (row.slug !== undefined)
839
- slugCount.set(row.slug, (slugCount.get(row.slug) ?? 0) + 1);
720
+ slugCount.set(row.slug, (slugCount.get(row.slug) ?? 0) + 1);
840
721
  return rows
841
- .map(({ title, ...row }): ArtifactRow => {
842
- // A title equal to the slug or path is the server's fallback for a file that names itself neither way.
722
+ .map(({ title, ...row }): ReportRow => {
723
+ // A title equal to the basename or path is the server's fallback for a file that names itself neither way.
843
724
  const hasTitle = !!title && title !== row.slug && title !== row.path;
844
- const ambiguous =
845
- row.slug !== undefined && (slugCount.get(row.slug) ?? 0) > 1;
725
+ // The path is shown whenever the label alone does not name the file: a title, a basename two reports share, or a report below the root.
726
+ const ambiguous = (slugCount.get(row.slug) ?? 0) > 1;
727
+ // A legacy `.malloynb` with no title of its own is named by its file, extension included.
728
+ const label = hasTitle
729
+ ? title
730
+ : row.path.endsWith(".malloynb")
731
+ ? row.path
732
+ : row.slug;
846
733
  return {
847
734
  ...row,
848
- label: hasTitle ? title : (row.slug ?? row.path),
849
- secondary: (row.slug === undefined ? hasTitle : ambiguous)
850
- ? row.path
851
- : undefined,
735
+ label,
736
+ secondary:
737
+ label !== row.path &&
738
+ (hasTitle || ambiguous || row.path.includes("/"))
739
+ ? row.path
740
+ : undefined,
852
741
  };
853
742
  })
854
743
  .sort(
@@ -884,11 +773,3 @@ function EmptyRow({
884
773
  </Stack>
885
774
  );
886
775
  }
887
-
888
- function formatRowCount(rows: number): string {
889
- if (rows >= 1_000_000_000)
890
- return `${(rows / 1_000_000_000).toFixed(1)} B rows`;
891
- if (rows >= 1_000_000) return `${(rows / 1_000_000).toFixed(1)} M rows`;
892
- if (rows >= 1_000) return `${(rows / 1_000).toFixed(1)} K rows`;
893
- return `${rows} rows`;
894
- }