@malloy-publisher/sdk 0.9.7 → 0.9.9

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