@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,10 +1,16 @@
1
- import { CreatedDocument, CreateTarget, DocumentCreatedEvent } from '../DocumentCreate';
2
- import { DocumentType } from '../DocumentStorage/DocumentStorage';
1
+ import { CreatedDocument, CreateTarget } from '../DocumentCreate';
2
+ import { ReportEventHandler } from '../Report/telemetry';
3
+ import { DocumentKind } from '../legacy/kindAdapter';
4
+ import { ReportLayout } from './documentLocation';
3
5
  export interface NewDocumentDialogProps {
4
6
  open: boolean;
5
- /** Which kind the dialog opens on. */
6
- kind: DocumentType;
7
- /** Whether the reader may switch to the other kind. Default true. */
7
+ /** Which layout the dialog opens on. Default linear. */
8
+ layout?: ReportLayout;
9
+ /** @deprecated Pass `layout`: `dashboard` is grid, `notebook` linear. */
10
+ kind?: DocumentKind;
11
+ /** Whether the reader may switch the layout. Default true. */
12
+ allowLayoutChange?: boolean;
13
+ /** @deprecated Pass `allowLayoutChange`. */
8
14
  allowKindChange?: boolean;
9
15
  environmentName: string;
10
16
  packageName: string;
@@ -23,11 +29,14 @@ export interface NewDocumentDialogProps {
23
29
  savedAs?: string;
24
30
  onClose: () => void;
25
31
  onCreated: (created: CreatedDocument) => void;
26
- onEvent?: (event: DocumentCreatedEvent) => void;
32
+ /** `report.created` or `report.create_refused`; see `ReportEvent`. */
33
+ onEvent?: ReportEventHandler;
27
34
  }
28
35
  /**
29
- * A new dashboard or notebook: pick the model, the view its first tile or
30
- * query shows, and a title. The file is the one the builder would write, so
31
- * everything after this is the builder's; the host opens it from `onCreated`.
36
+ * A new report: pick the model, the view its first query tile shows, a title
37
+ * and a layout. The file is written as `<slug>.malloy` at the package root, or
38
+ * at the location the author types instead. It is the file the builder would
39
+ * write, so everything after this is the builder's; the host opens it from
40
+ * `onCreated`.
32
41
  */
33
- export declare function NewDocumentDialog({ open, kind: initialKind, allowKindChange, environmentName, packageName, versionId, models, modelsLoading, modelsError, onRetryModels, target, savedAs, onClose, onCreated, onEvent, }: NewDocumentDialogProps): import("react/jsx-runtime").JSX.Element;
42
+ export declare function NewDocumentDialog({ open, layout: layoutProp, kind: kindProp, allowLayoutChange, allowKindChange, environmentName, packageName, versionId, models, modelsLoading, modelsError, onRetryModels, target, savedAs, onClose, onCreated, onEvent, }: NewDocumentDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,12 @@
1
1
  import { default as React } from 'react';
2
- import { DocumentKind } from './documentLocation';
3
- /** A served notebook opens by slug, like a dashboard; a `.malloynb` opens by path. */
4
- /** A dashboard or notebook the package page asks its host to open, and how. */
2
+ import { ReportEventHandler } from '../Report/telemetry';
3
+ import { ReportLayout } from './documentLocation';
4
+ /** A report the package page asks its host to open, and how. */
5
5
  export interface OpenDocumentRequest {
6
- kind: DocumentKind;
6
+ /** The report's package path, `sales/q3.malloy`: its identity, and how to open it. */
7
+ path: string;
8
+ layout: ReportLayout;
9
+ /** @deprecated The basename, a label only: two reports may share it. Open by `path`. */
7
10
  slug: string;
8
11
  /** `edit` for a document just created or a draft picked up; `view` otherwise. */
9
12
  mode: "view" | "edit";
@@ -11,13 +14,15 @@ export interface OpenDocumentRequest {
11
14
  interface PackageProps {
12
15
  onClickPackageFile?: (to: string, event?: React.MouseEvent) => void;
13
16
  /**
14
- * Open a dashboard or notebook, to read or to edit. Where reading and
15
- * editing live is the host's business, not the package page's, so a host
16
- * with a builder of its own routes this. Absent, the page navigates to the
17
- * Console's own routes: the document's, and `/edit` under it to edit.
17
+ * Open a report, to read or to edit. Where reading and editing live is the
18
+ * host's business, not the package page's, so a host with a builder of its
19
+ * own routes this. Absent, the page navigates to the Console's own routes:
20
+ * the report's path, and the same path with `?edit` to edit.
18
21
  */
19
22
  onOpenDocument?: (request: OpenDocumentRequest, event?: React.MouseEvent) => void;
20
23
  resourceUri: string;
24
+ /** What the New report dialog creates, or why it could not; see `ReportEvent`. */
25
+ onEvent?: ReportEventHandler;
21
26
  }
22
- export default function Package({ onClickPackageFile, onOpenDocument, resourceUri, }: PackageProps): import("react/jsx-runtime").JSX.Element;
27
+ export default function Package({ onClickPackageFile, onOpenDocument, resourceUri, onEvent, }: PackageProps): import("react/jsx-runtime").JSX.Element;
23
28
  export {};
@@ -1,28 +1,71 @@
1
- /** A layout document is a dashboard or a notebook; the artifact tag says which, not the folder. */
2
- export type DocumentKind = "dashboard" | "notebook";
1
+ /**
2
+ * A report's layout: `grid` places tiles by columns, `linear` reads top to
3
+ * bottom. The artifact tag decides it; where the file lives never does.
4
+ */
5
+ export type ReportLayout = "grid" | "linear";
6
+ /** One report as the package's listing (`GET …/reports`) has it. */
7
+ export interface ListedReport {
8
+ path?: string;
9
+ name?: string;
10
+ layout?: string;
11
+ title?: string;
12
+ editable?: boolean;
13
+ }
3
14
  export interface LocatedDocument {
4
- kind: DocumentKind;
5
- /** The file within the package, wherever it lives. */
15
+ layout: ReportLayout;
16
+ /** The file within the package, wherever it lives: the report's identity. */
6
17
  path: string;
18
+ /** Whether the builder opens it; false for a `.malloynb` or a `run:`-cell report. */
19
+ editable: boolean;
7
20
  }
8
- /** The slug of a document in either folder: `notebooks/tour.malloy` and `dashboards/tour.malloy` are `tour`. */
9
- export declare const documentSlug: (path: string | undefined) => string;
10
- /** The Console route of a document of this kind; the slug is a filename, so it is encoded. */
11
- export declare const documentRoute: (environmentName: string, packageName: string, kind: DocumentKind, slug: string) => string;
12
21
  /**
13
- * Where the document a route names really is, and what kind its tag makes it.
14
- *
15
- * The listings sort by tag, so a hit in one says the kind. The route's own kind
16
- * is tried first, so a slug in both folders opens the one the link was built for.
22
+ * A report's display label: the basename of any path, without `.malloy` or
23
+ * `.malloynb`. `sales/q3.malloy` is `q3`. A label only: two reports in
24
+ * different directories may share it.
25
+ */
26
+ export declare const documentSlug: (path: string | undefined) => string | undefined;
27
+ /** The route segment of a report's path: the path without `.malloy`, each segment encoded. A `.malloynb` keeps its suffix, since it opens by path. */
28
+ export declare const reportRoutePath: (path: string) => string;
29
+ /**
30
+ * The Console route of a report: `/<env>/<pkg>/sales/q3` for
31
+ * `sales/q3.malloy`. Every segment is encoded here, the environment and
32
+ * package included, so no caller encodes any of them again.
33
+ */
34
+ export declare const reportRoute: (environmentName: string, packageName: string, path: string) => string;
35
+ /**
36
+ * The query parameter that opens a report's route in the builder:
37
+ * `/<env>/<pkg>/sales/q3?edit`. A parameter rather than a trailing `/edit`
38
+ * segment, because a segment is also a path: `sales/edit.malloy` is a report
39
+ * whose route is `/<env>/<pkg>/sales/edit`.
40
+ */
41
+ export declare const REPORT_EDIT_PARAM = "edit";
42
+ /** The Console route that edits a report: its {@link reportRoute} with `?edit`. */
43
+ export declare const reportEditRoute: (environmentName: string, packageName: string, path: string) => string;
44
+ /** A listed report's layout: anything but `linear` draws as a grid. */
45
+ export declare const listedLayout: (report: ListedReport) => ReportLayout;
46
+ /** A listed report with a path, as a host opens it. */
47
+ export declare const locatedReport: (report: ListedReport & {
48
+ path: string;
49
+ }) => LocatedDocument;
50
+ /** The listed report at exactly this path, or undefined. */
51
+ export declare function locateReport(path: string, reports: readonly ListedReport[]): LocatedDocument | undefined;
52
+ /** Where a `# drill { to=… }` lands. */
53
+ export type DrillTarget = {
54
+ kind: "path";
55
+ report: LocatedDocument;
56
+ } | {
57
+ kind: "unresolved";
58
+ };
59
+ /**
60
+ * Whether a `# drill { to=… }` is a plain package path: non-empty segments,
61
+ * none `.` or `..`, and no leading `/`. Anything else could name a route
62
+ * outside the package (`../../x`), so it resolves to nothing and a host must
63
+ * not build a route from it. The server's `isDrillTargetPath` is the same rule.
64
+ */
65
+ export declare function isDrillTargetPath(to: string): boolean;
66
+ /**
67
+ * A `# drill` destination, by the server's rule (`resolveDrillDestination`):
68
+ * a package path from the root, with or without `.malloy` (`sales/overview`
69
+ * is `sales/overview.malloy`, and a bare name is a file at the root).
17
70
  */
18
- export declare function locateDocument({ kind, slug, dashboards, notebooks, }: {
19
- kind: DocumentKind;
20
- slug: string;
21
- dashboards: readonly {
22
- name?: string;
23
- path?: string;
24
- }[];
25
- notebooks: readonly {
26
- path?: string;
27
- }[];
28
- }): LocatedDocument | undefined;
71
+ export declare function resolveDrillTarget(to: string, reports: readonly ListedReport[]): DrillTarget;
@@ -1,5 +1,6 @@
1
1
  export { default as Package, type OpenDocumentRequest } from './Package';
2
- export { documentRoute, documentSlug, locateDocument, type LocatedDocument, } from './documentLocation';
3
- export { useDocumentLocation } from './useDocumentLocation';
2
+ export { documentSlug, isDrillTargetPath, locateReport, REPORT_EDIT_PARAM, reportEditRoute, reportRoute, reportRoutePath, resolveDrillTarget, type DrillTarget, type ListedReport, type LocatedDocument, type ReportLayout, } from './documentLocation';
3
+ export { useDocumentLocation, useReportListing } from './useDocumentLocation';
4
+ export { useDraftLayout } from './useDraftLayout';
4
5
  export { NewDocumentDialog, type NewDocumentDialogProps, } from './NewDocumentDialog';
5
6
  export { canRetryRequest } from '../DocumentCreate/canRetry';
@@ -0,0 +1,8 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ /**
3
+ * Drop every cached read of a package's reports after a write changed them:
4
+ * each report's manifest, the listing, and the deprecated readers' copies,
5
+ * whose listings a layout switch moves a report between. With `modelPath`,
6
+ * the one report's own cached reads too.
7
+ */
8
+ export declare function invalidateReportQueries(queryClient: QueryClient, environmentName: string, packageName: string, modelPath?: string): void;
@@ -1,12 +1,42 @@
1
- import { DocumentKind, LocatedDocument } from './documentLocation';
1
+ import { ApiClients } from '../ServerProvider';
2
+ import { ListedReport, LocatedDocument } from './documentLocation';
3
+ import { ApiError } from '../ApiErrorDisplay';
4
+ import { RefetchOptions, QueryObserverResult } from '@tanstack/query-core';
2
5
  /**
3
- * Where a routed document really lives, from the package's listings.
6
+ * `GET …/reports`, as the array every reader of {@link reportsQueryKey} caches.
7
+ * An older server with no such route (404) is a package with no reports to
8
+ * list rather than an error. Anything else, including no answer at all, is
9
+ * raised: every reader caches this listing, and an empty one standing in for
10
+ * a failure would say "nothing here" about a package that has reports.
11
+ */
12
+ export declare function fetchReportListing(apiClients: ApiClients, environmentName: string, packageName: string, versionId?: string): Promise<ListedReport[]>;
13
+ /**
14
+ * The package's reports, from `GET …/reports`: one listing for both layouts.
15
+ *
16
+ * `settled` is false until it has answered. An older server with no such
17
+ * route answers 404, which reads as a package with no reports rather than an
18
+ * error, so a host still renders. Any other failure is `isError`, with
19
+ * `refetch` to try again: a caller shows it rather than an empty listing.
20
+ * `isFetching` is true while a request is in flight, including the refetch
21
+ * that follows a write's invalidation, when the cached `reports` predate it.
22
+ */
23
+ export declare function useReportListing(environmentName: string, packageName: string, versionId?: string, enabled?: boolean): {
24
+ reports: ListedReport[];
25
+ settled: boolean;
26
+ isFetching: boolean;
27
+ isError: boolean;
28
+ error: ApiError;
29
+ refetch: (options?: RefetchOptions) => Promise< QueryObserverResult<ListedReport[], ApiError>>;
30
+ };
31
+ /**
32
+ * The report at a package path, from the package's listing, matched exactly.
4
33
  *
5
- * `settled` is false until both listings have answered; a document neither
6
- * lists (a draft, or an older server) has a `location` of undefined and the
7
- * caller falls back to the folder its route names.
34
+ * `settled` is false until the listing has answered; a path the listing does
35
+ * not have (a draft, a model, or an older server) has a `location` of
36
+ * undefined, and the caller decides what that path is instead.
8
37
  */
9
- export declare function useDocumentLocation(environmentName: string, packageName: string, kind: DocumentKind, slug: string, versionId?: string): {
38
+ export declare function useDocumentLocation(environmentName: string, packageName: string, path: string, versionId?: string): {
10
39
  location: LocatedDocument | undefined;
11
40
  settled: boolean;
41
+ reports: readonly ListedReport[];
12
42
  };
@@ -0,0 +1,20 @@
1
+ import { DocumentStorage } from '../DocumentStorage';
2
+ import { ReportLayout } from './documentLocation';
3
+ /**
4
+ * The layout of the host's copy of the report at `path`, as its store
5
+ * recorded it on the last save, or undefined when it keeps no copy. A report
6
+ * that is only a draft is not in the package's listing, so this is the one
7
+ * place its layout can be read before the editor opens its text; the editor
8
+ * then follows the text. Asks the workspace the editor reads from.
9
+ */
10
+ export declare function findDraftLayout(storage: DocumentStorage, environmentName: string, packageName: string, path: string): Promise<ReportLayout | undefined>;
11
+ /**
12
+ * {@link findDraftLayout} for a component: `settled` is false until the host
13
+ * has answered. Without a host store, or when not `enabled`, it is settled at
14
+ * once with no layout. A store that cannot answer settles with no layout too:
15
+ * the editor then opens and reports the read failure itself.
16
+ */
17
+ export declare function useDraftLayout(environmentName: string, packageName: string, path: string, enabled?: boolean): {
18
+ layout: ReportLayout | undefined;
19
+ settled: boolean;
20
+ };
@@ -0,0 +1,89 @@
1
+ import { NotebookCell as RawCell, RawNotebook } from '../../client';
2
+ import { GivenValue } from '../../hooks/givenValue';
3
+ import { ApiError } from '../ApiErrorDisplay';
4
+ import { NavigationClick } from '../click_helper';
5
+ import { DrillNavigation } from '../drill';
6
+ /** What one cell's run is handed: the cell, its index, the values to run it with, and the signal that cancels it. */
7
+ interface CellRun {
8
+ cell: RawCell;
9
+ index: number;
10
+ givens: ReadonlyMap<string, GivenValue>;
11
+ declaredTypes: ReadonlyMap<string, string | undefined>;
12
+ signal: AbortSignal;
13
+ }
14
+ /** Runs one cell. Stable across renders: a new runner re-runs every cell. */
15
+ export type CellRunner = (run: CellRun) => Promise<{
16
+ result?: string;
17
+ newSources?: string[];
18
+ }>;
19
+ export interface CellReportProps {
20
+ /** `publisher://…/models/<path>`: the report, and the model its cells run against. */
21
+ resourceUri: string;
22
+ maxResultSize?: number;
23
+ /**
24
+ * Parameter values from the host, typically its URL query parameters: the
25
+ * same contract `Report` takes, so a link into a filtered report works the
26
+ * way a link into a filtered grid does.
27
+ */
28
+ givens?: Record<string, string>;
29
+ /**
30
+ * Applied parameter values, for a host that wants them in its URL. Fires
31
+ * with what the cells actually ran with, which is what makes the URL a link
32
+ * that reproduces the view.
33
+ *
34
+ * That is every committed change. Under `## autorun=false` a change is
35
+ * committed on Apply, so reports are batched; otherwise every change is
36
+ * committed and typing in a text control reports per keystroke. It does NOT
37
+ * run per keystroke: a changed value waits `GIVEN_SETTLE_MS` before
38
+ * anything is dispatched, so a burst of typing produces one run. A run that
39
+ * does start supersedes and aborts the one before it. The REPORTS are still
40
+ * per keystroke, so a host doing something expensive per call should
41
+ * debounce.
42
+ *
43
+ * `managed` names every given this report declares, set or not. A host
44
+ * writing to a shared query string needs it: `givens` alone says which
45
+ * parameters to write but not which to *remove*.
46
+ */
47
+ onGivensChange?: (givens: Record<string, string>, managed: readonly string[]) => void;
48
+ /**
49
+ * Optional SPA navigation handler for links inside the cells. When omitted,
50
+ * links fall back to plain absolute anchors, so no react-router context is
51
+ * required to render one.
52
+ *
53
+ * It does NOT carry drill. A `# drill { to=self }` filters this report
54
+ * through `given:` state and needs no handler at all, and a drill naming a
55
+ * report goes through {@link onDrillNavigate}, which takes a destination
56
+ * rather than a URL.
57
+ */
58
+ onNavigate?: (to: string, event?: NavigationClick) => void;
59
+ /**
60
+ * Opens a `# drill { to=<report> }` from a cell, seeded with the clicked
61
+ * value. Omitted on a host with no report route, which leaves those
62
+ * destinations inert AND unmarked rather than painting a dead link.
63
+ */
64
+ onDrillNavigate?: (target: DrillNavigation, event?: MouseEvent) => void;
65
+ }
66
+ /**
67
+ * Cells run one by one, the engine behind a report written as `run:` cells.
68
+ * Takes the cells (undefined while they load, `error` when they could not be
69
+ * read) and the runner that executes one; what reads the cells and what runs
70
+ * them is the caller's.
71
+ */
72
+ export declare function CellRunnerView({ resourceUri, maxResultSize, givens, onGivensChange, onNavigate, onDrillNavigate, notebook, error, runCell, }: CellReportProps & {
73
+ notebook: RawNotebook | undefined;
74
+ /** Why the cells could not be read; the view says so in place of them. */
75
+ error?: ApiError | null;
76
+ runCell: CellRunner;
77
+ }): import("react/jsx-runtime").JSX.Element;
78
+ /**
79
+ * A `.malloy` report written as `run:` cells, whose cells the caller already
80
+ * holds (`Report` reads them off `GET …/reports/{path}`). Each runs through
81
+ * the governed query endpoint the grid tiles use
82
+ * (`POST …/models/{path}/query`, the report's path as the model and the cell's
83
+ * text as the query), which holds a cell to the same surface, `#(authorize)`
84
+ * and row-level gates a tile is held to.
85
+ */
86
+ export declare function CellReport({ notebook: held, ...props }: CellReportProps & {
87
+ notebook: RawNotebook;
88
+ }): import("react/jsx-runtime").JSX.Element;
89
+ export {};
@@ -0,0 +1,18 @@
1
+ import { DashboardManifest } from '../../client';
2
+ import { DrillNavigation } from '../drill';
3
+ /**
4
+ * A linear report written as tiles: a one-column grid, its prose drawn bare
5
+ * above the tiles and its controls as a panel.
6
+ */
7
+ export declare function LinearReport({ manifest, environmentName, packageName, versionId, documentName, givens, onGivensChange, onDrillNavigate, maxResultSize, }: {
8
+ /** A report manifest, or the tile layout a deprecated notebook read carries. */
9
+ manifest: DashboardManifest;
10
+ environmentName: string;
11
+ packageName: string;
12
+ versionId: string | undefined;
13
+ documentName: string;
14
+ givens?: Record<string, string>;
15
+ onGivensChange?: (givens: Record<string, string>, managed: readonly string[]) => void;
16
+ onDrillNavigate?: (target: DrillNavigation, event?: MouseEvent) => void;
17
+ maxResultSize?: number;
18
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,62 @@
1
+ import { NavigationClick } from '../click_helper';
2
+ import { TileChrome } from '../Dashboard/TileCard';
3
+ import { DrillNavigation } from '../drill';
4
+ import { DrillOutcome, ReportEventHandler } from './telemetry';
5
+ export interface ReportProps {
6
+ /** `publisher://environments/{env}/packages/{pkg}`, optionally `?versionId=`. */
7
+ resourceUri: string;
8
+ /**
9
+ * The report's package path, including `.malloy`, exactly as
10
+ * `GET …/reports` lists it: `sales/q3.malloy`. Its identity. A `.malloynb`
11
+ * the listing also has is rendered by the deprecated `Notebook`, which runs
12
+ * its cells through the only routes that can.
13
+ */
14
+ path: string;
15
+ /**
16
+ * Control values from the host, typically its URL query parameters. These
17
+ * beat the report's own starting values, so a shared link shows what the
18
+ * sender was looking at.
19
+ */
20
+ givens?: Record<string, string>;
21
+ /**
22
+ * Applied control values, for a host that wants them in its URL.
23
+ *
24
+ * `managed` is every given this report declares, set or not: `givens` alone
25
+ * says which parameters to write but not which to REMOVE.
26
+ */
27
+ onGivensChange?: (givens: Record<string, string>, managed: readonly string[]) => void;
28
+ /**
29
+ * Where to go when a `# drill` cell is clicked. `target.path` is the
30
+ * tag's `to=` as written: a package path from the root, without `.malloy`,
31
+ * for the host to resolve against `GET …/reports` (`resolveDrillTarget`).
32
+ * Without it, drilling to another report is inert: `to=self` still filters
33
+ * in place. Return what the target resolved to and the drill is reported
34
+ * as a `report.drill` event; return nothing and it is not.
35
+ */
36
+ onNavigate?: (target: DrillNavigation, event?: MouseEvent) => DrillOutcome | void;
37
+ /**
38
+ * An ordinary link inside a linear report's prose, for a host with its own
39
+ * router. Omitted, links are plain anchors.
40
+ */
41
+ onLinkNavigate?: (to: string, event?: NavigationClick) => void;
42
+ /** Height cap for a grid tile's result panel; see `Dashboard`. */
43
+ height?: number;
44
+ maxResultSize?: number;
45
+ /**
46
+ * What the report does — opened, failed to load, a failed query, rows
47
+ * shown, a drill — for the host to log or count; see `ReportEvent`.
48
+ */
49
+ onEvent?: ReportEventHandler;
50
+ /** A grid report's tile chrome: `card` (default) or `none`. */
51
+ chrome?: TileChrome;
52
+ }
53
+ /**
54
+ * A report of either layout, from `GET …/reports/{path}`: a grid drawn as a
55
+ * dashboard, a linear report top to bottom, and a linear report written as
56
+ * `run:` cells cell by cell, each through the governed query endpoint.
57
+ *
58
+ * Host-agnostic, like `Dashboard`: it takes props rather than reading a
59
+ * router, and hands navigation and URL state back to whoever mounted it.
60
+ */
61
+ export declare function Report({ resourceUri, path, givens, onGivensChange, onNavigate, onLinkNavigate, height, maxResultSize, onEvent, chrome, }: ReportProps): import("react/jsx-runtime").JSX.Element;
62
+ export default Report;
@@ -0,0 +1,2 @@
1
+ export { Report, type ReportProps } from './Report';
2
+ export type { DrillOutcome, ReportEvent, ReportEventContext, ReportEventHandler, ReportFailure, SavesTo, } from './telemetry';
@@ -0,0 +1,163 @@
1
+ import { ReportLayout } from '../Package/documentLocation';
2
+ import { Context } from 'react';
3
+ /**
4
+ * Where a Save lands, named by which storage took the write: `package` is the
5
+ * package file on the server, `browser` the Console's own browser store, and
6
+ * `host` a host storage that holds the record. Separate because a save into
7
+ * the package or the record is a change every reader sees, while a browser
8
+ * save is one person's copy on one machine.
9
+ */
10
+ export type SavesTo = "package" | "browser" | "host";
11
+ /**
12
+ * Why something failed, as a category a sink can count. Never the error's
13
+ * message: that can carry a path, a value or a query the reader typed.
14
+ */
15
+ export type ReportFailure = "not_found" | "forbidden" | "invalid" | "unsupported" | "server" | "network" | "unknown";
16
+ /** What a `# drill` click came to. */
17
+ export type DrillOutcome =
18
+ /** It reached a destination: a report the listing has, or this report's own control. */
19
+ "resolved"
20
+ /** A well-formed destination nothing answers to. */
21
+ | "unresolved"
22
+ /**
23
+ * It navigated to the destination as written before the host could say
24
+ * whether a report is there (its listing not read yet, or unreadable). Not
25
+ * a failure: the page it lands on says what is there.
26
+ */
27
+ | "unverified"
28
+ /** A target or value that cannot be a destination at all. */
29
+ | "malformed";
30
+ /**
31
+ * Which report an event is about, on every event. `path` is the report's
32
+ * package path (`sales/q3.malloy`); the host that mounted the surface knows
33
+ * the environment and package and adds them when it logs. `layout` is the
34
+ * report's layout when the event happened, which an editor's layout switch
35
+ * changes.
36
+ */
37
+ export interface ReportEventContext {
38
+ path: string;
39
+ layout: ReportLayout;
40
+ }
41
+ /**
42
+ * What a report surface reports about itself, for the host to log or count:
43
+ * one event per outcome a reader or author would recognise, each with how long
44
+ * it took where that means anything. Delivered through the `onEvent` prop of
45
+ * `Report`, `ReportEditor`, `ReportBuilder`, `NewDocumentDialog` and
46
+ * `Package`.
47
+ */
48
+ export type ReportEvent = {
49
+ /**
50
+ * The report could not be opened. `layout` is absent when it failed
51
+ * before the report said what it is.
52
+ */
53
+ type: "report.load_failed";
54
+ path: string;
55
+ layout?: ReportLayout;
56
+ surface: "view" | "edit";
57
+ category: ReportFailure;
58
+ } | (ReportEventContext & ({
59
+ type: "report.opened";
60
+ /** The reader's view, or the builder. */
61
+ surface: "view" | "edit";
62
+ /**
63
+ * The package file, a draft the host had saved beside it, or the
64
+ * host's own copy when that copy is the record.
65
+ */
66
+ from: "package" | "draft" | "record";
67
+ /** Tiles, or cells on a report written as `run:` cells. */
68
+ tiles: number;
69
+ durationMs: number;
70
+ } | {
71
+ /** A tile's (or cell's) query failed; `tile` absent means the run as a whole. */
72
+ type: "report.query_failed";
73
+ tile?: number;
74
+ category: ReportFailure;
75
+ } | {
76
+ type: "report.rows_shown";
77
+ source: string;
78
+ view: string;
79
+ field: string;
80
+ ok: boolean;
81
+ durationMs: number;
82
+ } | {
83
+ type: "report.explored";
84
+ tile: string;
85
+ } | {
86
+ type: "report.saved";
87
+ tiles: number;
88
+ /** Whether a tile was added or removed, which moves declarations. */
89
+ structural: boolean;
90
+ /** The save rewrote a report in the cell format as tiles. */
91
+ converted?: boolean;
92
+ where: SavesTo;
93
+ /** The host workspace that took the write; never set for a package save. */
94
+ workspace?: string;
95
+ durationMs: number;
96
+ } | {
97
+ type: "report.save_refused";
98
+ reason: string;
99
+ } | {
100
+ /** Undo save wrote the file back as it was before the last save. */
101
+ type: "report.save_undone";
102
+ tiles: number;
103
+ structural: boolean;
104
+ where: SavesTo;
105
+ workspace?: string;
106
+ durationMs: number;
107
+ } | {
108
+ type: "report.save_undo_refused";
109
+ reason: string;
110
+ } | {
111
+ type: "report.created";
112
+ /** Which storage took the write, as on `report.saved`. */
113
+ where: "package" | "host";
114
+ durationMs: number;
115
+ } | {
116
+ type: "report.create_refused";
117
+ reason: string;
118
+ } | {
119
+ /** The author switched the report between Linear and Grid; `layout` is `to`. */
120
+ type: "report.layout_changed";
121
+ from: ReportLayout;
122
+ to: ReportLayout;
123
+ } | {
124
+ type: "report.drill";
125
+ /** `self` filtered this report; `report` went to another. */
126
+ to: "self" | "report";
127
+ outcome: DrillOutcome;
128
+ }));
129
+ export type ReportEventHandler = (event: ReportEvent) => void;
130
+ type WithoutContext<E> = E extends unknown ? Omit<E, keyof ReportEventContext> : never;
131
+ /** An event before the surface stamps it with the report it is about. */
132
+ export type ReportEventBody = WithoutContext<ReportEvent>;
133
+ /** Which report a surface emits for: its layout is unknown until it has read the report. */
134
+ export type ReportEventTarget = Omit<ReportEventContext, "layout"> & Partial<Pick<ReportEventContext, "layout">>;
135
+ /** Stamp an event with its report. */
136
+ export declare const withReportContext: (body: ReportEventBody, target: ReportEventTarget) => ReportEvent;
137
+ /**
138
+ * How a surface deep inside a report emits: the report fills in which report
139
+ * it is, and a sink's own failure never reaches the reader.
140
+ */
141
+ export interface ReportEmitter {
142
+ emit: (body: ReportEventBody) => void;
143
+ /**
144
+ * Whether a host is listening. A diagnostic with no other symptom (a cell
145
+ * that failed, a drill that went nowhere) goes to the console only when no
146
+ * host is, so it is never lost and never said twice.
147
+ */
148
+ listening: boolean;
149
+ }
150
+ /** An emitter for one report, or a silent one when no host listens. */
151
+ export declare function reportEmitter(target: ReportEventTarget, onEvent: ReportEventHandler | undefined): ReportEmitter;
152
+ /**
153
+ * {@link reportEmitter} for a component: stable while the report and whether
154
+ * anyone listens stay the same, so an effect that emits on a change does not
155
+ * emit again because the host passed a new handler.
156
+ */
157
+ export declare function useReportEmitter(target: ReportEventTarget, onEvent: ReportEventHandler | undefined): ReportEmitter;
158
+ /** Set by `Report` around what it renders; silent outside one. */
159
+ export declare const ReportEventsContext: Context<ReportEmitter>;
160
+ export declare const useReportEvents: () => ReportEmitter;
161
+ /** The category of a failed request, from its HTTP status or the lack of one. */
162
+ export declare function failureCategory(error: unknown): ReportFailure;
163
+ export {};
@@ -3,7 +3,7 @@ import { UnsavedChangesDialog } from '../UnsavedChangesDialog';
3
3
  import { PackageCatalog } from './catalog';
4
4
  import { ConversionConfirm } from './useConversionConfirm';
5
5
  import { useControlBindings } from './useControlBindings';
6
- import { DashboardEditor } from './useDashboardEditor';
6
+ import { ReportEditorHandle } from './useReportEditor';
7
7
  import { useTileEditing } from './useTileEditing';
8
8
  /**
9
9
  * Every window the builder opens, each driven by state its hooks hold: the
@@ -11,7 +11,7 @@ import { useTileEditing } from './useTileEditing';
11
11
  * question, the unsaved-changes guard and the add-tile picker.
12
12
  */
13
13
  export declare function BuilderDialogs({ editor, catalog, columns, dashboards, bindings, tiles, drillSource, setDrillSource, confirmConversion, exitDialog, }: {
14
- editor: DashboardEditor;
14
+ editor: ReportEditorHandle;
15
15
  catalog: PackageCatalog | undefined;
16
16
  columns: number;
17
17
  dashboards: string[] | undefined;
@@ -1,7 +1,7 @@
1
1
  import { ReactNode, RefObject } from 'react';
2
2
  import { TileChrome, TileHeadingSlots } from '../Dashboard/TileCard';
3
3
  import { DashboardTile, QueryTile } from './document';
4
- import { DashboardEditor } from './useDashboardEditor';
4
+ import { ReportEditorHandle } from './useReportEditor';
5
5
  import { useTileReorder } from './useTileReorder';
6
6
  import { useTileResize } from './useTileResize';
7
7
  /**
@@ -10,7 +10,7 @@ import { useTileResize } from './useTileResize';
10
10
  * affordances: selection, the grip and menu, the width handle.
11
11
  */
12
12
  export declare function BuilderGrid({ editor, reorder, resizing, gridBox, columns, notebook, chrome, canAdd, selected, flash, menuIndex, onSelect, onOpenMenu, openAdd, editTile, renderTile, }: {
13
- editor: DashboardEditor;
13
+ editor: ReportEditorHandle;
14
14
  reorder: ReturnType<typeof useTileReorder>;
15
15
  resizing: ReturnType<typeof useTileResize>;
16
16
  gridBox: RefObject<HTMLDivElement | null>;