@malloy-publisher/sdk 0.9.7 → 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.
- package/README.md +117 -17
- package/dist/{RenderedResult-qnpbr4tc.cjs.js → RenderedResult-BrvrMDAP.cjs.js} +1 -1
- package/dist/{RenderedResult-CkUS04tl.es.js → RenderedResult-DZj-FnOJ.es.js} +2 -2
- package/dist/{ServerProvider-DnLLeXEX.es.js → ServerProvider-B_bPAsu2.es.js} +583 -398
- package/dist/ServerProvider-DuEOzwPc.cjs.js +1 -0
- package/dist/builder/index.cjs.js +93 -93
- package/dist/builder/index.es.js +4630 -4562
- package/dist/builder-entry.d.ts +13 -12
- package/dist/client/api.d.ts +472 -94
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +105 -95
- package/dist/components/Dashboard/DashboardTile.d.ts +3 -1
- package/dist/components/Dashboard/DashboardView.d.ts +1 -3
- package/dist/components/Dashboard/index.d.ts +0 -2
- package/dist/components/DocumentCreate/createDocument.d.ts +29 -9
- package/dist/components/DocumentCreate/documentPath.d.ts +21 -6
- package/dist/components/DocumentCreate/guards.d.ts +2 -3
- package/dist/components/DocumentCreate/index.d.ts +2 -3
- package/dist/components/DocumentCreate/newNotebook.d.ts +14 -5
- package/dist/components/DocumentStorage/BrowserDocumentStorage.d.ts +6 -0
- package/dist/components/DocumentStorage/DocumentStorage.d.ts +52 -24
- package/dist/components/Loading.d.ts +1 -1
- package/dist/components/Package/DataSchemaDialog.d.ts +26 -0
- package/dist/components/Package/NewDocumentDialog.d.ts +19 -10
- package/dist/components/Package/Package.d.ts +14 -9
- package/dist/components/Package/documentLocation.d.ts +66 -23
- package/dist/components/Package/index.d.ts +3 -2
- package/dist/components/Package/reportQueries.d.ts +8 -0
- package/dist/components/Package/useDocumentLocation.d.ts +36 -6
- package/dist/components/Package/useDraftLayout.d.ts +20 -0
- package/dist/components/Report/CellReport.d.ts +89 -0
- package/dist/components/Report/LinearReport.d.ts +18 -0
- package/dist/components/Report/Report.d.ts +62 -0
- package/dist/components/Report/index.d.ts +2 -0
- package/dist/components/Report/telemetry.d.ts +163 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.d.ts +2 -2
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.d.ts +2 -2
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.d.ts +5 -4
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.d.ts +5 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/EditorSurface.d.ts +10 -7
- package/dist/components/{DashboardBuilder/DashboardBuilder.d.ts → ReportBuilder/ReportBuilder.d.ts} +17 -8
- package/dist/components/{DashboardBuilder/DashboardEditor.d.ts → ReportBuilder/ReportEditor.d.ts} +41 -14
- package/dist/components/ReportBuilder/builderReport.d.ts +14 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/catalog.d.ts +8 -5
- package/dist/components/{DashboardBuilder → ReportBuilder}/document.d.ts +3 -4
- package/dist/components/{DashboardBuilder → ReportBuilder}/documentSession.d.ts +1 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/imports.d.ts +5 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/malloyTree.d.ts +9 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/newDashboard.d.ts +7 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/readDocument.d.ts +7 -5
- package/dist/components/{DashboardBuilder → ReportBuilder}/readForEditor.d.ts +1 -1
- package/dist/components/ReportBuilder/reportTag.d.ts +52 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/spliceDocument.d.ts +1 -7
- package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.d.ts +2 -2
- package/dist/components/{DashboardBuilder → ReportBuilder}/useControlBindings.d.ts +2 -2
- package/dist/components/ReportBuilder/useEditorCatalog.d.ts +25 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/useHostCopy.d.ts +5 -3
- package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.d.ts +7 -5
- package/dist/components/{DashboardBuilder/useDashboardEditor.d.ts → ReportBuilder/useReportEditor.d.ts} +3 -7
- package/dist/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.d.ts +6 -4
- package/dist/components/{DashboardBuilder → ReportBuilder}/useTileEditing.d.ts +2 -2
- package/dist/components/ServerProvider.d.ts +2 -1
- package/dist/components/drill/resolveDrill.d.ts +8 -1
- package/dist/components/drill/useDrillSelf.d.ts +4 -2
- package/dist/components/index.d.ts +2 -1
- package/dist/components/{Dashboard → legacy}/Dashboard.d.ts +15 -9
- package/dist/components/legacy/MalloynbCells.d.ts +13 -0
- package/dist/components/legacy/Notebook.d.ts +15 -0
- package/dist/components/{DashboardBuilder → legacy}/NotebookEditor.d.ts +3 -3
- package/dist/components/legacy/builderNames.d.ts +10 -0
- package/dist/components/legacy/index.d.ts +11 -0
- package/dist/components/legacy/kindAdapter.d.ts +11 -0
- package/dist/components/legacy/kindTypedDrafts.d.ts +10 -0
- package/dist/components/legacy/nameAlias.d.ts +44 -0
- package/dist/components/legacy/queryKeys.d.ts +8 -0
- package/dist/index.cjs.js +19 -19
- package/dist/index.es.js +7984 -7452
- package/dist/text/index.es.js +2 -2
- package/dist/{text-entry-CA0LZ1xL.es.js → text-entry-72YFLeNk.es.js} +10 -10
- package/dist/useCompiledDocument-oocN5cGE.cjs.js +141 -0
- package/dist/{useCompiledDocument-Bf72Ob5v.es.js → useCompiledDocument-x0B2RAH3.es.js} +4593 -4395
- package/package.json +2 -2
- package/src/builder-entry.ts +32 -24
- package/src/components/Dashboard/DashboardTile.tsx +17 -0
- package/src/components/Dashboard/DashboardView.spec.tsx +0 -21
- package/src/components/Dashboard/DashboardView.tsx +8 -24
- package/src/components/Dashboard/dropValueUrlTags.spec.ts +1 -4
- package/src/components/Dashboard/index.ts +0 -2
- package/src/components/DocumentCreate/createDocument.spec.ts +346 -53
- package/src/components/DocumentCreate/createDocument.ts +143 -63
- package/src/components/DocumentCreate/documentPath.ts +41 -12
- package/src/components/DocumentCreate/guards.ts +7 -15
- package/src/components/DocumentCreate/index.ts +3 -7
- package/src/components/DocumentCreate/newNotebook.spec.ts +113 -43
- package/src/components/DocumentCreate/newNotebook.ts +32 -10
- package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +130 -28
- package/src/components/DocumentStorage/BrowserDocumentStorage.ts +78 -40
- package/src/components/DocumentStorage/DocumentStorage.contract.spec.tsx +426 -0
- package/src/components/DocumentStorage/DocumentStorage.ts +57 -24
- package/src/components/Home/AddEnvironmentDialog.tsx +1 -1
- package/src/components/Home/Home.tsx +1 -1
- package/src/components/Loading.tsx +1 -1
- package/src/components/Model/SourcesExplorer.tsx +1 -1
- package/src/components/Notebook/NotebookCell.tsx +6 -5
- package/src/components/Notebook/cellKind.spec.ts +15 -7
- package/src/components/Package/DataSchemaDialog.spec.tsx +85 -0
- package/src/components/Package/DataSchemaDialog.tsx +367 -0
- package/src/components/Package/NewDocumentDialog.spec.tsx +145 -88
- package/src/components/Package/NewDocumentDialog.tsx +93 -48
- package/src/components/Package/Package.artifacts.spec.tsx +79 -60
- package/src/components/Package/Package.create.spec.tsx +126 -112
- package/src/components/Package/Package.notebooks.spec.tsx +46 -27
- package/src/components/Package/Package.spec.tsx +43 -30
- package/src/components/Package/Package.tsx +173 -292
- package/src/components/Package/documentLocation.spec.ts +145 -50
- package/src/components/Package/documentLocation.ts +118 -39
- package/src/components/Package/index.ts +12 -3
- package/src/components/Package/reportQueries.ts +25 -0
- package/src/components/Package/useDocumentLocation.spec.ts +58 -0
- package/src/components/Package/useDocumentLocation.ts +90 -32
- package/src/components/Package/useDraftLayout.spec.tsx +143 -0
- package/src/components/Package/useDraftLayout.ts +81 -0
- package/src/components/Prose.spec.tsx +3 -3
- package/src/components/RenderedResult/RenderedResult.tsx +1 -1
- package/src/components/Report/CellReport.spec.tsx +155 -0
- package/src/components/{Notebook/Notebook.tsx → Report/CellReport.tsx} +178 -220
- package/src/components/Report/LinearReport.tsx +71 -0
- package/src/components/Report/Report.spec.tsx +238 -0
- package/src/components/Report/Report.telemetry.spec.tsx +292 -0
- package/src/components/Report/Report.tsx +277 -0
- package/src/components/Report/index.ts +12 -0
- package/src/components/Report/telemetry.spec.ts +90 -0
- package/src/components/Report/telemetry.ts +250 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.tsx +5 -5
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.tsx +2 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.tsx +6 -7
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.tsx +33 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/DrillDialog.tsx +2 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/EditorSurface.tsx +67 -107
- package/src/components/{DashboardBuilder → ReportBuilder}/FilterDialog.tsx +3 -4
- package/src/components/{DashboardBuilder/DashboardBuilder.charts.spec.tsx → ReportBuilder/ReportBuilder.charts.spec.tsx} +4 -4
- package/src/components/{DashboardBuilder/DashboardBuilder.exit.spec.tsx → ReportBuilder/ReportBuilder.exit.spec.tsx} +5 -5
- package/src/components/{DashboardBuilder/DashboardBuilder.inline.spec.tsx → ReportBuilder/ReportBuilder.inline.spec.tsx} +4 -4
- package/src/components/ReportBuilder/ReportBuilder.layoutSwitch.spec.tsx +145 -0
- package/src/components/{DashboardBuilder/DashboardBuilder.notebook.spec.tsx → ReportBuilder/ReportBuilder.notebook.spec.tsx} +22 -21
- package/src/components/{DashboardBuilder/DashboardBuilder.openDraft.spec.tsx → ReportBuilder/ReportBuilder.openDraft.spec.tsx} +3 -3
- package/src/components/{DashboardBuilder/DashboardBuilder.sources.spec.tsx → ReportBuilder/ReportBuilder.sources.spec.tsx} +19 -8
- package/src/components/{DashboardBuilder/DashboardBuilder.spec.tsx → ReportBuilder/ReportBuilder.spec.tsx} +34 -34
- package/src/components/{DashboardBuilder/DashboardBuilder.textTiles.spec.tsx → ReportBuilder/ReportBuilder.textTiles.spec.tsx} +5 -5
- package/src/components/{DashboardBuilder/DashboardBuilder.tsx → ReportBuilder/ReportBuilder.tsx} +46 -21
- package/src/components/{DashboardBuilder/DashboardEditor.authoritative.spec.tsx → ReportBuilder/ReportEditor.authoritative.spec.tsx} +28 -20
- package/src/components/{DashboardBuilder/DashboardEditor.emptyStart.spec.tsx → ReportBuilder/ReportEditor.emptyStart.spec.tsx} +19 -11
- package/src/components/{DashboardBuilder/DashboardEditor.filterTag.spec.tsx → ReportBuilder/ReportEditor.filterTag.spec.tsx} +7 -7
- package/src/components/{DashboardBuilder/DashboardEditor.notebook.spec.tsx → ReportBuilder/ReportEditor.notebook.spec.tsx} +70 -49
- package/src/components/{DashboardBuilder/DashboardEditor.package.spec.tsx → ReportBuilder/ReportEditor.package.spec.tsx} +52 -8
- package/src/components/{DashboardBuilder/DashboardEditor.resourceUri.spec.tsx → ReportBuilder/ReportEditor.resourceUri.spec.tsx} +50 -18
- package/src/components/{DashboardBuilder/DashboardEditor.spec.tsx → ReportBuilder/ReportEditor.spec.tsx} +65 -20
- package/src/components/{DashboardBuilder/DashboardEditor.textSource.spec.tsx → ReportBuilder/ReportEditor.textSource.spec.tsx} +6 -6
- package/src/components/{DashboardBuilder/DashboardEditor.tsx → ReportBuilder/ReportEditor.tsx} +92 -35
- package/src/components/{DashboardBuilder → ReportBuilder}/addTile.compile.spec.ts +1 -3
- package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.spec.ts +1 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/artifactBlock.spec.ts +21 -29
- package/src/components/ReportBuilder/builderReport.ts +53 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/catalog.spec.ts +28 -10
- package/src/components/{DashboardBuilder → ReportBuilder}/catalog.ts +17 -10
- package/src/components/{DashboardBuilder → ReportBuilder}/controls.spec.ts +1 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/document.ts +4 -7
- package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.spec.ts +5 -5
- package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.ts +1 -1
- package/src/components/{DashboardBuilder → ReportBuilder}/imports.spec.ts +6 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/imports.ts +8 -4
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.chart.spec.ts +1 -1
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.convert.spec.ts +9 -13
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.read.spec.ts +15 -15
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.ts +7 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.ts +25 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.spec.ts +12 -4
- package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.ts +11 -24
- package/src/components/{DashboardBuilder → ReportBuilder}/preview.spec.ts +1 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.spec.ts +64 -36
- package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.ts +33 -32
- package/src/components/ReportBuilder/readForEditor.spec.ts +96 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/readForEditor.ts +3 -11
- package/src/components/ReportBuilder/reportTag.ts +108 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.imports.spec.ts +28 -1
- package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.spec.ts +32 -3
- package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.ts +37 -60
- package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.spec.ts +3 -3
- package/src/components/{DashboardBuilder → ReportBuilder}/testing/artifactTagParity.json +2 -2
- package/src/components/ReportBuilder/testing/drillResolution.json +279 -0
- package/src/components/ReportBuilder/testing/reportLayoutParity.json +125 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/textTiles.spec.ts +66 -143
- package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.ts +2 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/useControlBindings.ts +2 -2
- package/src/components/ReportBuilder/useEditorCatalog.spec.tsx +156 -0
- package/src/components/ReportBuilder/useEditorCatalog.ts +119 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/useHostCopy.ts +7 -5
- package/src/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.ts +56 -35
- package/src/components/{DashboardBuilder/useDashboardEditor.spec.ts → ReportBuilder/useReportEditor.spec.ts} +6 -6
- package/src/components/{DashboardBuilder/useDashboardEditor.ts → ReportBuilder/useReportEditor.ts} +6 -17
- package/src/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.ts +36 -35
- package/src/components/{DashboardBuilder → ReportBuilder}/useTileEditing.ts +2 -2
- package/src/components/ServerProvider.tsx +2 -0
- package/src/components/drill/resolveDrill.ts +9 -2
- package/src/components/drill/useDrill.tsx +1 -0
- package/src/components/drill/useDrillSelf.spec.tsx +60 -7
- package/src/components/drill/useDrillSelf.ts +29 -12
- package/src/components/index.ts +2 -1
- package/src/components/{Dashboard → legacy}/Dashboard.spec.tsx +1 -1
- package/src/components/{Dashboard → legacy}/Dashboard.tsx +40 -28
- package/src/components/legacy/MalloynbCells.tsx +88 -0
- package/src/components/{Notebook → legacy}/Notebook.served.spec.tsx +17 -13
- package/src/components/{Notebook → legacy}/Notebook.spec.tsx +24 -20
- package/src/components/legacy/Notebook.tsx +44 -0
- package/src/components/{DashboardBuilder → legacy}/NotebookEditor.tsx +7 -4
- package/src/components/legacy/builderNames.ts +25 -0
- package/src/components/legacy/index.ts +20 -0
- package/src/components/legacy/kindAdapter.ts +19 -0
- package/src/components/legacy/kindTypedDrafts.ts +34 -0
- package/src/components/legacy/nameAlias.spec.ts +124 -0
- package/src/components/legacy/nameAlias.ts +95 -0
- package/src/components/legacy/queryKeys.ts +26 -0
- package/src/hooks/useGivensState.spec.ts +9 -9
- package/src/mainEntry.spec.ts +1 -1
- package/src/textEntry.spec.ts +9 -9
- package/src/utils/formatting.spec.ts +5 -5
- package/src/utils/parsing.spec.ts +1 -1
- package/src/utils/parsing.ts +1 -1
- package/dist/ServerProvider-Gj-im5VD.cjs.js +0 -1
- package/dist/components/Dashboard/telemetry.d.ts +0 -73
- package/dist/components/DashboardBuilder/builderReport.d.ts +0 -13
- package/dist/components/DashboardBuilder/telemetry.d.ts +0 -43
- package/dist/components/DocumentCreate/events.d.ts +0 -10
- package/dist/components/Notebook/Notebook.d.ts +0 -52
- package/dist/components/Notebook/index.d.ts +0 -1
- package/dist/useCompiledDocument-tBejqZ7s.cjs.js +0 -142
- package/src/components/Dashboard/telemetry.ts +0 -75
- package/src/components/DashboardBuilder/builderReport.ts +0 -74
- package/src/components/DashboardBuilder/readForEditor.spec.ts +0 -80
- package/src/components/DashboardBuilder/telemetry.ts +0 -47
- package/src/components/DashboardBuilder/testing/documentKindRule.json +0 -40
- package/src/components/DocumentCreate/events.ts +0 -15
- package/src/components/Notebook/index.ts +0 -4
- /package/dist/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/ChartPicker.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/DrillDialog.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterDialog.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterStrip.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineText.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/TextTileBody.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/TileFrame.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/TileMenu.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/annotationText.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/changedTile.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/chartLine.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/controls.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/inlineEdit.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/layout.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/loadMalloy.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/openDraft.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/preview.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/sortable.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/spliceResult.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/tagParse.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/inline.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/resize.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useDraft.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useExitGuard.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useFilterForm.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileReorder.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileResize.d.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.render.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/FilterStrip.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/InlineText.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/TextTileBody.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/TileFrame.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/TileMenu.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/__test__/inventory.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/artifactTagParity.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/catalog.aggregate.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/controls.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/emptyStart.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/inlineEdit.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/invariants.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/keepRowStructure.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/layout.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/moveIntoGap.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/openDraft.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/preview.shapes.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/preview.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/scannerShapes.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.chart.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/spliceResult.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/statementExtent.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/inline.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/resize.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/urlRenderTags.json +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.overlay.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useDraft.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.existing.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/withGaps.spec.ts +0 -0
- /package/src/components/{Notebook → legacy}/Notebook.layout.spec.tsx +0 -0
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
import { afterEach, describe, expect, it, mock, spyOn } from "bun:test";
|
|
5
5
|
import { renderHook } from "@testing-library/react";
|
|
6
|
+
import type { ReactNode } from "react";
|
|
6
7
|
import type { GivenValue } from "../../hooks/givenValue";
|
|
8
|
+
import {
|
|
9
|
+
reportEmitter,
|
|
10
|
+
ReportEventsContext,
|
|
11
|
+
type ReportEvent,
|
|
12
|
+
} from "../Report/telemetry";
|
|
7
13
|
import { useDrillSelf } from "./useDrillSelf";
|
|
8
14
|
|
|
9
15
|
const TYPES = new Map<string, string | undefined>([
|
|
@@ -11,13 +17,28 @@ const TYPES = new Map<string, string | undefined>([
|
|
|
11
17
|
["MIN_AMOUNT", "number"],
|
|
12
18
|
]);
|
|
13
19
|
|
|
14
|
-
function hook(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
function hook(
|
|
21
|
+
setGiven = mock((_n: string, _v: GivenValue) => {}),
|
|
22
|
+
onEvent?: (event: ReportEvent) => void,
|
|
23
|
+
) {
|
|
24
|
+
const events = reportEmitter(
|
|
25
|
+
{ path: "overview.malloy", layout: "grid" },
|
|
26
|
+
onEvent,
|
|
27
|
+
);
|
|
28
|
+
const view = renderHook(
|
|
29
|
+
() =>
|
|
30
|
+
useDrillSelf({
|
|
31
|
+
declaredTypes: TYPES,
|
|
32
|
+
setGiven,
|
|
33
|
+
documentName: "overview",
|
|
34
|
+
}),
|
|
35
|
+
{
|
|
36
|
+
wrapper: ({ children }: { children: ReactNode }) => (
|
|
37
|
+
<ReportEventsContext.Provider value={events}>
|
|
38
|
+
{children}
|
|
39
|
+
</ReportEventsContext.Provider>
|
|
40
|
+
),
|
|
41
|
+
},
|
|
21
42
|
);
|
|
22
43
|
return { ...view.result.current, setGiven };
|
|
23
44
|
}
|
|
@@ -61,4 +82,36 @@ describe("useDrillSelf", () => {
|
|
|
61
82
|
expect.stringContaining("Drill declined"),
|
|
62
83
|
);
|
|
63
84
|
});
|
|
85
|
+
|
|
86
|
+
describe("inside a report", () => {
|
|
87
|
+
const outcomes = (onEvent: ReturnType<typeof mock>) =>
|
|
88
|
+
(onEvent.mock.calls as [ReportEvent][]).map(([event]) => event);
|
|
89
|
+
|
|
90
|
+
it("reports a drill that set the given as resolved", () => {
|
|
91
|
+
const onEvent = mock((_event: ReportEvent) => {});
|
|
92
|
+
hook(undefined, onEvent).onSelf("region", "West");
|
|
93
|
+
expect(outcomes(onEvent)).toEqual([
|
|
94
|
+
{
|
|
95
|
+
type: "report.drill",
|
|
96
|
+
path: "overview.malloy",
|
|
97
|
+
layout: "grid",
|
|
98
|
+
to: "self",
|
|
99
|
+
outcome: "resolved",
|
|
100
|
+
},
|
|
101
|
+
]);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("reports an undeclared name as unresolved and an unencodable value as malformed, instead of warning", () => {
|
|
105
|
+
warn = spyOn(console, "warn").mockImplementation(() => {});
|
|
106
|
+
const onEvent = mock((_event: ReportEvent) => {});
|
|
107
|
+
const { onSelf } = hook(undefined, onEvent);
|
|
108
|
+
onSelf("STATE", "CA");
|
|
109
|
+
onSelf("MIN_AMOUNT", "not a number");
|
|
110
|
+
expect(outcomes(onEvent).map((event) => event)).toMatchObject([
|
|
111
|
+
{ type: "report.drill", outcome: "unresolved" },
|
|
112
|
+
{ type: "report.drill", outcome: "malformed" },
|
|
113
|
+
]);
|
|
114
|
+
expect(warn).not.toHaveBeenCalled();
|
|
115
|
+
});
|
|
116
|
+
});
|
|
64
117
|
});
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { useCallback, useMemo } from "react";
|
|
5
5
|
import type { GivenValue } from "../../hooks/givenValue";
|
|
6
|
+
import { useReportEvents } from "../Report/telemetry";
|
|
6
7
|
import { encodeDrillValue } from "./resolveDrill";
|
|
7
8
|
|
|
8
9
|
export interface UseDrillSelfOptions {
|
|
@@ -48,14 +49,17 @@ export interface UseDrillSelfResult {
|
|
|
48
49
|
* server knows.
|
|
49
50
|
* - **A refusal is said aloud.** `canSelf` checks only that the name resolves,
|
|
50
51
|
* so a `given=` naming a type the clicked value cannot become still paints a
|
|
51
|
-
* whole column clickable and would then drop every click in silence.
|
|
52
|
-
*
|
|
52
|
+
* whole column clickable and would then drop every click in silence. Inside
|
|
53
|
+
* a `Report` every click is a `report.drill` event; a refusal also warns on
|
|
54
|
+
* the console when no host listens, because each is an authoring mistake
|
|
55
|
+
* with no other symptom.
|
|
53
56
|
*/
|
|
54
57
|
export function useDrillSelf({
|
|
55
58
|
declaredTypes,
|
|
56
59
|
setGiven,
|
|
57
60
|
documentName,
|
|
58
61
|
}: UseDrillSelfOptions): UseDrillSelfResult {
|
|
62
|
+
const events = useReportEvents();
|
|
59
63
|
const givenNamesByFold = useMemo(() => {
|
|
60
64
|
const byFold = new Map<string, string>();
|
|
61
65
|
for (const name of declaredTypes.keys()) {
|
|
@@ -85,25 +89,38 @@ export function useDrillSelf({
|
|
|
85
89
|
(given: string, rawValue: unknown) => {
|
|
86
90
|
const declared = resolveGiven(given);
|
|
87
91
|
if (declared === undefined) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
);
|
|
92
|
+
events.emit({
|
|
93
|
+
type: "report.drill",
|
|
94
|
+
to: "self",
|
|
95
|
+
outcome: "unresolved",
|
|
96
|
+
});
|
|
97
|
+
if (!events.listening)
|
|
98
|
+
console.warn(
|
|
99
|
+
`# drill { to=self } tried to set '${given}', which ` +
|
|
100
|
+
`'${documentName}' does not declare as a given. Name the ` +
|
|
101
|
+
`given with 'given=' on the drill tag.`,
|
|
102
|
+
);
|
|
93
103
|
return;
|
|
94
104
|
}
|
|
95
105
|
const declaredType = declaredTypes.get(declared);
|
|
96
106
|
const value = encodeDrillValue(rawValue, declaredType);
|
|
97
107
|
if (value === undefined) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
108
|
+
events.emit({
|
|
109
|
+
type: "report.drill",
|
|
110
|
+
to: "self",
|
|
111
|
+
outcome: "malformed",
|
|
112
|
+
});
|
|
113
|
+
if (!events.listening)
|
|
114
|
+
console.warn(
|
|
115
|
+
`Drill declined: ${JSON.stringify(rawValue)} cannot be a value for given "${declared}"` +
|
|
116
|
+
(declaredType ? ` of type ${declaredType}` : ""),
|
|
117
|
+
);
|
|
102
118
|
return;
|
|
103
119
|
}
|
|
104
120
|
setGiven(declared, value);
|
|
121
|
+
events.emit({ type: "report.drill", to: "self", outcome: "resolved" });
|
|
105
122
|
},
|
|
106
|
-
[declaredTypes, documentName, resolveGiven, setGiven],
|
|
123
|
+
[declaredTypes, documentName, resolveGiven, setGiven, events],
|
|
107
124
|
);
|
|
108
125
|
|
|
109
126
|
return { resolveGiven, canSelf, onSelf };
|
package/src/components/index.ts
CHANGED
|
@@ -27,7 +27,6 @@ export * from "./Home";
|
|
|
27
27
|
export * from "./Loading";
|
|
28
28
|
export * from "./Materializations";
|
|
29
29
|
export * from "./Model";
|
|
30
|
-
export * from "./Notebook";
|
|
31
30
|
export * from "./Package";
|
|
32
31
|
export {
|
|
33
32
|
Prose,
|
|
@@ -37,6 +36,8 @@ export {
|
|
|
37
36
|
} from "./Prose";
|
|
38
37
|
export * from "./QueryResult";
|
|
39
38
|
export * from "./RenderedResult";
|
|
39
|
+
export * from "./Report";
|
|
40
|
+
export * from "./legacy";
|
|
40
41
|
export { ServerProvider, useServer } from "./ServerProvider";
|
|
41
42
|
export type { ServerContextValue, ServerProviderProps } from "./ServerProvider";
|
|
42
43
|
export * from "./DocumentStorage";
|
|
@@ -141,7 +141,7 @@ describe("the version reaches what the manifest drives", () => {
|
|
|
141
141
|
const manifest: DashboardManifest = {
|
|
142
142
|
name: "ops",
|
|
143
143
|
path: "dashboards/ops.malloy",
|
|
144
|
-
query: "overview",
|
|
144
|
+
tiles: [{ kind: "query", query: "overview" }],
|
|
145
145
|
givens: [
|
|
146
146
|
{ name: "REGION", type: "string" },
|
|
147
147
|
{
|
|
@@ -8,19 +8,18 @@ import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
|
8
8
|
import type { DrillNavigation } from "../drill";
|
|
9
9
|
import { Loading, LOADING_COPY } from "../Loading";
|
|
10
10
|
import { useServer } from "../ServerProvider";
|
|
11
|
-
import { DashboardView } from "
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export { DashboardProse } from "./DashboardView";
|
|
11
|
+
import { DashboardView } from "../Dashboard/DashboardView";
|
|
12
|
+
import {
|
|
13
|
+
ReportEventsContext,
|
|
14
|
+
useReportEmitter,
|
|
15
|
+
type ReportEventHandler,
|
|
16
|
+
} from "../Report/telemetry";
|
|
17
|
+
import type { TileChrome } from "../Dashboard/TileCard";
|
|
19
18
|
|
|
20
19
|
export interface DashboardProps {
|
|
21
20
|
/** `publisher://environments/{env}/packages/{pkg}`, optionally `?versionId=`. */
|
|
22
21
|
resourceUri: string;
|
|
23
|
-
/** The
|
|
22
|
+
/** The report's basename, as listed by the deprecated dashboards endpoint. */
|
|
24
23
|
dashboard: string;
|
|
25
24
|
/**
|
|
26
25
|
* Control values from the host, typically its URL query parameters. These
|
|
@@ -58,8 +57,11 @@ export interface DashboardProps {
|
|
|
58
57
|
*/
|
|
59
58
|
height?: number;
|
|
60
59
|
maxResultSize?: number;
|
|
61
|
-
/**
|
|
62
|
-
|
|
60
|
+
/**
|
|
61
|
+
* The rows shown and failed tile queries, for the host to log or count;
|
|
62
|
+
* see `ReportEvent`. `path` is the manifest's model path.
|
|
63
|
+
*/
|
|
64
|
+
onEvent?: ReportEventHandler;
|
|
63
65
|
/**
|
|
64
66
|
* `card` (default) draws each tile as a panel; `none` draws them bare, a
|
|
65
67
|
* document that reads top to bottom.
|
|
@@ -68,8 +70,13 @@ export interface DashboardProps {
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
/**
|
|
71
|
-
* A
|
|
72
|
-
* declared entirely by
|
|
73
|
+
* A grid report by its basename: a control row over one or more query
|
|
74
|
+
* results, declared entirely by the file's tags.
|
|
75
|
+
*
|
|
76
|
+
* @deprecated Render `Report` with the file's path instead. This reads the
|
|
77
|
+
* deprecated `GET …/dashboards/{name}`, which resolves a basename only when one
|
|
78
|
+
* grid report has it, and draws the result with the same renderer as `Report`.
|
|
79
|
+
* Kept for hosts that still mount it.
|
|
73
80
|
*
|
|
74
81
|
* Host-agnostic on purpose. It takes props rather than reading a router, and
|
|
75
82
|
* hands navigation and URL state back to whoever mounted it, so the Publisher
|
|
@@ -126,6 +133,10 @@ export function Dashboard({
|
|
|
126
133
|
enabled: uriNamesBoth,
|
|
127
134
|
});
|
|
128
135
|
const manifest = manifestResponse?.data;
|
|
136
|
+
const events = useReportEmitter(
|
|
137
|
+
{ path: manifest?.path ?? dashboard, layout: "grid" },
|
|
138
|
+
onEvent,
|
|
139
|
+
);
|
|
129
140
|
|
|
130
141
|
if (!uriNamesBoth) {
|
|
131
142
|
return (
|
|
@@ -145,24 +156,25 @@ export function Dashboard({
|
|
|
145
156
|
);
|
|
146
157
|
}
|
|
147
158
|
if (!isSuccess || !manifest) {
|
|
148
|
-
return <Loading text={LOADING_COPY.opening("
|
|
159
|
+
return <Loading text={LOADING_COPY.opening("report")} />;
|
|
149
160
|
}
|
|
150
161
|
|
|
151
162
|
return (
|
|
152
|
-
<
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
<ReportEventsContext.Provider value={events}>
|
|
164
|
+
<DashboardView
|
|
165
|
+
manifest={manifest}
|
|
166
|
+
environmentName={environmentName}
|
|
167
|
+
packageName={packageName}
|
|
168
|
+
versionId={versionId}
|
|
169
|
+
documentName={dashboard}
|
|
170
|
+
givens={givens}
|
|
171
|
+
onGivensChange={onGivensChange}
|
|
172
|
+
onNavigate={onNavigate}
|
|
173
|
+
height={height}
|
|
174
|
+
maxResultSize={maxResultSize}
|
|
175
|
+
chrome={chrome}
|
|
176
|
+
/>
|
|
177
|
+
</ReportEventsContext.Provider>
|
|
166
178
|
);
|
|
167
179
|
}
|
|
168
180
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { useCallback } from "react";
|
|
5
|
+
import type { RawNotebook } from "../../client";
|
|
6
|
+
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
7
|
+
import { parseResourceUri } from "../../utils/formatting";
|
|
8
|
+
import { givensToRequest } from "../given/paramCodec";
|
|
9
|
+
import {
|
|
10
|
+
CellRunnerView,
|
|
11
|
+
type CellReportProps,
|
|
12
|
+
type CellRunner,
|
|
13
|
+
} from "../Report/CellReport";
|
|
14
|
+
import { useServer } from "../ServerProvider";
|
|
15
|
+
|
|
16
|
+
/** The deprecated notebook read, one cache entry per URI however many components ask. */
|
|
17
|
+
export function useNotebookQuery(resourceUri: string) {
|
|
18
|
+
const { apiClients } = useServer();
|
|
19
|
+
const {
|
|
20
|
+
environmentName,
|
|
21
|
+
packageName,
|
|
22
|
+
versionId,
|
|
23
|
+
modelPath: notebookPath,
|
|
24
|
+
} = parseResourceUri(resourceUri);
|
|
25
|
+
return useQueryWithApiError<RawNotebook>({
|
|
26
|
+
queryKey: [resourceUri],
|
|
27
|
+
queryFn: async () => {
|
|
28
|
+
const response = await apiClients.notebooks.getNotebook(
|
|
29
|
+
environmentName,
|
|
30
|
+
packageName,
|
|
31
|
+
notebookPath,
|
|
32
|
+
versionId,
|
|
33
|
+
);
|
|
34
|
+
return response.data;
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A notebook's cells read and run through the deprecated notebooks routes,
|
|
41
|
+
* `GET …/notebooks/{path}` and `GET …/notebooks/{path}/cells/{i}`: the only
|
|
42
|
+
* routes that run a `.malloynb`, and what the `Notebook` wrapper has always
|
|
43
|
+
* read a cell-format report through.
|
|
44
|
+
*/
|
|
45
|
+
export function MalloynbCells(props: CellReportProps) {
|
|
46
|
+
const { apiClients } = useServer();
|
|
47
|
+
const { environmentName, packageName, versionId, modelPath } =
|
|
48
|
+
parseResourceUri(props.resourceUri);
|
|
49
|
+
const query = useNotebookQuery(props.resourceUri);
|
|
50
|
+
const runCell = useCallback<CellRunner>(
|
|
51
|
+
async ({ index, givens, declaredTypes, signal }) => {
|
|
52
|
+
const request = givensToRequest(givens, declaredTypes);
|
|
53
|
+
// `filterParams` and `bypassFilters` go over as undefined: `given:`
|
|
54
|
+
// takes the `#(filter)` panel's place, and a `required` filter the
|
|
55
|
+
// server enforces fails the cell visibly rather than blankly.
|
|
56
|
+
return (
|
|
57
|
+
await apiClients.notebooks.executeNotebookCell(
|
|
58
|
+
environmentName,
|
|
59
|
+
packageName,
|
|
60
|
+
modelPath,
|
|
61
|
+
index,
|
|
62
|
+
versionId,
|
|
63
|
+
undefined,
|
|
64
|
+
undefined,
|
|
65
|
+
Object.keys(request).length > 0
|
|
66
|
+
? JSON.stringify(request)
|
|
67
|
+
: undefined,
|
|
68
|
+
{ signal },
|
|
69
|
+
)
|
|
70
|
+
).data;
|
|
71
|
+
},
|
|
72
|
+
[
|
|
73
|
+
apiClients.notebooks,
|
|
74
|
+
environmentName,
|
|
75
|
+
packageName,
|
|
76
|
+
modelPath,
|
|
77
|
+
versionId,
|
|
78
|
+
],
|
|
79
|
+
);
|
|
80
|
+
return (
|
|
81
|
+
<CellRunnerView
|
|
82
|
+
{...props}
|
|
83
|
+
notebook={query.isSuccess ? query.data : undefined}
|
|
84
|
+
error={query.isError ? query.error : undefined}
|
|
85
|
+
runCell={runCell}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
import { beforeEach, expect, it, mock } from "bun:test";
|
|
4
|
+
import { beforeEach, describe, expect, it, mock } from "bun:test";
|
|
5
5
|
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
|
6
6
|
import {
|
|
7
7
|
clearCache,
|
|
@@ -108,18 +108,22 @@ it("puts the copy-link icon on the first markdown cell, not on a leading definit
|
|
|
108
108
|
expect(screen.getAllByTestId("LinkOutlinedIcon")).toHaveLength(1);
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
// DEPRECATED FEATURE COVERAGE — delete together with
|
|
112
|
+
// `.malloynb` notebooks (see RELEASE_NOTES deprecations).
|
|
113
|
+
describe("deprecated: .malloynb notebooks", () => {
|
|
114
|
+
it("keeps the copy-link icon off a .malloynb that opens with a code cell", async () => {
|
|
115
|
+
current = {
|
|
116
|
+
format: "malloynb",
|
|
117
|
+
notebookCells: [
|
|
118
|
+
{ type: "code", text: "import { orders } from '../orders.malloy'" },
|
|
119
|
+
{ type: "markdown", text: "Legacy prose" },
|
|
120
|
+
],
|
|
121
|
+
} as RawNotebook;
|
|
122
|
+
render(<Notebook resourceUri={URI} />, { wrapper: serverWrapper });
|
|
123
|
+
|
|
124
|
+
await screen.findByText("Legacy prose");
|
|
125
|
+
expect(screen.queryAllByTestId("LinkOutlinedIcon")).toHaveLength(0);
|
|
126
|
+
});
|
|
123
127
|
});
|
|
124
128
|
|
|
125
129
|
it("renders a query cell's markdown above its caption, without repeating it in the code", async () => {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* trailing optional argument, which is the kind that goes missing without a
|
|
11
11
|
* test noticing, so it is asserted here rather than only on the hook.
|
|
12
12
|
*/
|
|
13
|
-
import { beforeEach, expect, it, mock } from "bun:test";
|
|
13
|
+
import { beforeEach, describe, expect, it, mock } from "bun:test";
|
|
14
14
|
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
|
15
15
|
import type { ReactNode } from "react";
|
|
16
16
|
import {
|
|
@@ -161,23 +161,27 @@ it("opens a cell's 'Data sources' dialog with the notebook's current values", as
|
|
|
161
161
|
);
|
|
162
162
|
});
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
164
|
+
// DEPRECATED FEATURE COVERAGE — delete together with
|
|
165
|
+
// `.malloynb` notebooks (see RELEASE_NOTES deprecations).
|
|
166
|
+
describe("deprecated: .malloynb notebooks", () => {
|
|
167
|
+
it("renders a .malloynb as before: runs every code cell, no caption, no folded definition", async () => {
|
|
168
|
+
current = {
|
|
169
|
+
notebookCells: [
|
|
170
|
+
{ type: "markdown", text: "Prose" },
|
|
171
|
+
{ type: "code", text: "run: a -> b" },
|
|
172
|
+
{ type: "code", text: '#" x\nrun: a -> c' },
|
|
173
|
+
],
|
|
174
|
+
} as RawNotebook;
|
|
175
|
+
render(<Notebook resourceUri={URI} />, { wrapper: serverWrapper });
|
|
176
|
+
|
|
177
|
+
await screen.findByText("Prose");
|
|
178
|
+
await waitFor(() => expect(executeNotebookCell).toHaveBeenCalledTimes(2));
|
|
179
|
+
expect(executeNotebookCell.mock.calls.map((call) => call[3])).toEqual([
|
|
180
|
+
1, 2,
|
|
181
|
+
]);
|
|
182
|
+
expect(screen.queryByText("x")).toBeNull();
|
|
183
|
+
expect(
|
|
184
|
+
screen.queryByRole("button", { name: /^(run|source|import)/ }),
|
|
185
|
+
).toBeNull();
|
|
186
|
+
});
|
|
183
187
|
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { parseResourceUri } from "../../utils/formatting";
|
|
5
|
+
import type { CellReportProps } from "../Report/CellReport";
|
|
6
|
+
import { LinearReport } from "../Report/LinearReport";
|
|
7
|
+
import { MalloynbCells, useNotebookQuery } from "./MalloynbCells";
|
|
8
|
+
|
|
9
|
+
type NotebookProps = CellReportProps;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A notebook by its package path, read through the deprecated
|
|
13
|
+
* `GET …/notebooks/{path}`: a tile layout drawn as a linear report, anything
|
|
14
|
+
* else (a `.malloynb`, or a report written as `run:` cells) cell by cell
|
|
15
|
+
* through the deprecated cell route.
|
|
16
|
+
*
|
|
17
|
+
* @deprecated Render `Report` with the file's path instead: it reads
|
|
18
|
+
* `GET …/reports/{path}` and renders either layout. Kept, over the same
|
|
19
|
+
* renderers, for hosts that still mount it and for the `.malloynb` format,
|
|
20
|
+
* which only these routes run.
|
|
21
|
+
*/
|
|
22
|
+
// Requires PackageProvider
|
|
23
|
+
export default function Notebook(props: NotebookProps) {
|
|
24
|
+
const { data: notebook } = useNotebookQuery(props.resourceUri);
|
|
25
|
+
// A notebook written as a tile layout renders as a one-column grid.
|
|
26
|
+
if (notebook?.dashboard) {
|
|
27
|
+
const { environmentName, packageName, versionId, modelPath } =
|
|
28
|
+
parseResourceUri(props.resourceUri);
|
|
29
|
+
return (
|
|
30
|
+
<LinearReport
|
|
31
|
+
manifest={notebook.dashboard}
|
|
32
|
+
environmentName={environmentName}
|
|
33
|
+
packageName={packageName}
|
|
34
|
+
versionId={versionId}
|
|
35
|
+
documentName={modelPath}
|
|
36
|
+
givens={props.givens}
|
|
37
|
+
onGivensChange={props.onGivensChange}
|
|
38
|
+
onDrillNavigate={props.onDrillNavigate}
|
|
39
|
+
maxResultSize={props.maxResultSize}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return <MalloynbCells {...props} />;
|
|
44
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ReportEditor,
|
|
6
|
+
type ReportEditorProps,
|
|
7
|
+
} from "../ReportBuilder/ReportEditor";
|
|
5
8
|
|
|
6
9
|
/** The props a host passed the notebook editor before notebooks opened in the one builder. */
|
|
7
10
|
export type NotebookEditorProps = (
|
|
@@ -18,9 +21,9 @@ export type NotebookEditorProps = (
|
|
|
18
21
|
notebookName: string;
|
|
19
22
|
}
|
|
20
23
|
) &
|
|
21
|
-
Pick<
|
|
24
|
+
Pick<ReportEditorProps, "onEvent" | "onDirtyChange" | "onExit" | "path">;
|
|
22
25
|
|
|
23
|
-
/** `
|
|
26
|
+
/** `ReportEditor` opened on a notebook, under the name hosts already import. */
|
|
24
27
|
export function NotebookEditor(props: NotebookEditorProps) {
|
|
25
28
|
const { onEvent, onDirtyChange, onExit, path } = props;
|
|
26
29
|
const target =
|
|
@@ -32,7 +35,7 @@ export function NotebookEditor(props: NotebookEditorProps) {
|
|
|
32
35
|
dashboardName: props.notebookName,
|
|
33
36
|
};
|
|
34
37
|
return (
|
|
35
|
-
<
|
|
38
|
+
<ReportEditor
|
|
36
39
|
{...target}
|
|
37
40
|
kind="notebook"
|
|
38
41
|
{...(onEvent ? { onEvent } : {})}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The builder's names from before it edited every report, kept for hosts that
|
|
6
|
+
* still import them from `@malloy-publisher/sdk/builder`. Builder-only: the
|
|
7
|
+
* main entry must not reach this module (see `mainEntry.spec.ts`).
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
ReportBuilder,
|
|
11
|
+
type ReportBuilderProps,
|
|
12
|
+
} from "../ReportBuilder/ReportBuilder";
|
|
13
|
+
import {
|
|
14
|
+
ReportEditor,
|
|
15
|
+
type ReportEditorProps,
|
|
16
|
+
} from "../ReportBuilder/ReportEditor";
|
|
17
|
+
|
|
18
|
+
/** @deprecated Use `ReportEditor`. */
|
|
19
|
+
export const DashboardEditor = ReportEditor;
|
|
20
|
+
/** @deprecated Use `ReportEditorProps`. */
|
|
21
|
+
export type DashboardEditorProps = ReportEditorProps;
|
|
22
|
+
/** @deprecated Use `ReportBuilder`. */
|
|
23
|
+
export const DashboardBuilder = ReportBuilder;
|
|
24
|
+
/** @deprecated Use `ReportBuilderProps`. */
|
|
25
|
+
export type DashboardBuilderProps = ReportBuilderProps;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Deprecated surface kept for hosts that still use it: the by-name wrappers
|
|
6
|
+
* over the deprecated `…/dashboards*` and `…/notebooks*` routes, the
|
|
7
|
+
* by-name lookups behind old links, and the kind-typed vocabulary. Report
|
|
8
|
+
* code imports nothing from here; removing a feature is deleting its module
|
|
9
|
+
* and its line below.
|
|
10
|
+
*/
|
|
11
|
+
export { Dashboard, type DashboardProps } from "./Dashboard";
|
|
12
|
+
export { default as Notebook } from "./Notebook";
|
|
13
|
+
export { type DocumentKind } from "./kindAdapter";
|
|
14
|
+
export {
|
|
15
|
+
documentRoute,
|
|
16
|
+
legacyAliasOf,
|
|
17
|
+
locateDocument,
|
|
18
|
+
locateReportByName,
|
|
19
|
+
type NameLookup,
|
|
20
|
+
} from "./nameAlias";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import type { ReportLayout } from "../Package/documentLocation";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated A report has a layout; pass `layout` (`grid` or `linear`). The
|
|
8
|
+
* layout's old name, which the kind-typed props hosts still pass speak:
|
|
9
|
+
* `dashboard` is a grid report, `notebook` a linear one.
|
|
10
|
+
*/
|
|
11
|
+
export type DocumentKind = "dashboard" | "notebook";
|
|
12
|
+
|
|
13
|
+
/** The layout a kind-typed prop names. Only the deprecated props call this. */
|
|
14
|
+
export const layoutOfKind = (kind: DocumentKind): ReportLayout =>
|
|
15
|
+
kind === "notebook" ? "linear" : "grid";
|
|
16
|
+
|
|
17
|
+
/** The file the deprecated name-only editor props open: `<kind>s/<name>.malloy`. */
|
|
18
|
+
export const legacyNamedPath = (kind: DocumentKind, name: string): string =>
|
|
19
|
+
`${kind}s/${name}.malloy`;
|