@malloy-publisher/sdk 0.0.248 → 0.0.250
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 +37 -17
- package/TREE_SHAKING.md +5 -0
- package/bunfig.toml +3 -0
- package/dist/ServerProvider-CcfeBpt3.cjs.js +1 -0
- package/dist/{ServerProvider-BxEh3nFI.es.js → ServerProvider-EqBlMMqx.es.js} +1056 -905
- package/dist/client/api.d.ts +306 -9
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +74 -70
- package/dist/components/Dashboard/Dashboard.d.ts +49 -0
- package/dist/components/Dashboard/DashboardTile.d.ts +48 -0
- package/dist/components/Dashboard/index.d.ts +2 -0
- package/dist/components/Notebook/Notebook.d.ts +46 -8
- package/dist/components/Notebook/NotebookCell.d.ts +37 -3
- package/dist/components/Notebook/runPlan.d.ts +29 -0
- package/dist/components/Notebook/types.d.ts +10 -0
- package/dist/components/Package/ContentTypeIcon.d.ts +17 -1
- package/dist/components/Package/Package.d.ts +1 -4
- package/dist/components/RenderedResult/RenderedResult.d.ts +7 -1
- package/dist/components/RenderedResult/ResultContainer.d.ts +3 -1
- package/dist/components/ResultsDialog.d.ts +4 -1
- package/dist/components/ServerProvider.d.ts +2 -1
- package/dist/components/click_helper.d.ts +10 -1
- package/dist/components/drill/index.d.ts +3 -0
- package/dist/components/drill/markDrillableCells.d.ts +55 -0
- package/dist/components/drill/resolveDrill.d.ts +139 -0
- package/dist/components/drill/useDrill.d.ts +63 -0
- package/dist/components/given/GivenInput.d.ts +27 -3
- package/dist/components/given/GivensPanel.d.ts +36 -7
- package/dist/components/given/filterValue.d.ts +97 -0
- package/dist/components/given/index.d.ts +1 -1
- package/dist/components/given/paramCodec.d.ts +60 -0
- package/dist/components/index.d.ts +4 -1
- package/dist/components/styles.d.ts +31 -0
- package/dist/constants/docLinks.d.ts +6 -0
- package/dist/{core-C86Rb7tJ.cjs.js → core-CVXEUnnm.cjs.js} +1 -1
- package/dist/{core-BuvlzSIX.es.js → core-Cr-9Wkp3.es.js} +1 -1
- package/dist/hooks/givenValue.d.ts +10 -0
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/useGivensState.d.ts +64 -0
- package/dist/hooks/useSuggestOptions.d.ts +78 -0
- package/dist/index-C-KeIwsG.cjs.js +339 -0
- package/dist/{index-BdtAZ5k6.es.js → index-DVkelll3.es.js} +40981 -39669
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +77 -62
- package/dist/theme/types.d.ts +9 -0
- package/dist/utils/malloyString.d.ts +7 -0
- package/package.json +3 -1
- package/src/client-entry.ts +3 -0
- package/src/components/AnalyzePackageButton.tsx +3 -0
- package/src/components/ApiErrorDisplay.tsx +3 -0
- package/src/components/Connections/AddConnectionDialog.tsx +13 -1
- package/src/components/Connections/DeleteConnectionDialog.tsx +3 -0
- package/src/components/Connections/EditConnectionDialog.tsx +3 -0
- package/src/components/Connections/common.ts +3 -0
- package/src/components/DOMElement/DOMElement.tsx +3 -0
- package/src/components/DOMElement/index.ts +3 -0
- package/src/components/Dashboard/Dashboard.tsx +398 -0
- package/src/components/Dashboard/DashboardTile.tsx +153 -0
- package/src/components/Dashboard/index.ts +5 -0
- package/src/components/DataAppViewer/DataAppViewer.tsx +3 -0
- package/src/components/DataAppViewer/index.ts +3 -0
- package/src/components/Environment/About.tsx +3 -0
- package/src/components/Environment/AddPackageDialog.tsx +3 -0
- package/src/components/Environment/ConnectionExplorer.tsx +3 -0
- package/src/components/Environment/Connections.tsx +3 -0
- package/src/components/Environment/DeletePackageDialog.tsx +3 -0
- package/src/components/Environment/EditPackageDialog.tsx +3 -0
- package/src/components/Environment/Environment.tsx +3 -0
- package/src/components/Environment/Packages.tsx +3 -0
- package/src/components/Environment/index.ts +3 -0
- package/src/components/Home/AddEnvironmentDialog.tsx +3 -0
- package/src/components/Home/DeleteEnvironmentDialog.tsx +3 -0
- package/src/components/Home/EditEnvironmentDialog.tsx +3 -0
- package/src/components/Home/Home.tsx +113 -23
- package/src/components/Home/index.ts +3 -0
- package/src/components/Loading.tsx +3 -0
- package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +3 -0
- package/src/components/Materializations/CreateMaterializationDialog.tsx +3 -0
- package/src/components/Materializations/DeleteMaterializationDialog.tsx +3 -0
- package/src/components/Materializations/EnvironmentMaterializations.tsx +3 -0
- package/src/components/Materializations/ManifestView.tsx +3 -0
- package/src/components/Materializations/MaterializationDetailDialog.tsx +3 -0
- package/src/components/Materializations/MaterializationRunsList.tsx +3 -0
- package/src/components/Materializations/Materializations.tsx +3 -0
- package/src/components/Materializations/ScheduleCard.tsx +3 -0
- package/src/components/Materializations/SectionLabel.tsx +3 -0
- package/src/components/Materializations/SetScheduleDialog.tsx +3 -0
- package/src/components/Materializations/TriggerChip.tsx +3 -0
- package/src/components/Materializations/cron.ts +3 -0
- package/src/components/Materializations/index.ts +3 -0
- package/src/components/Materializations/utils.ts +3 -0
- package/src/components/Model/Model.tsx +3 -0
- package/src/components/Model/ModelCell.tsx +3 -0
- package/src/components/Model/ModelExplorer.tsx +3 -0
- package/src/components/Model/ModelExplorerDialog.tsx +3 -0
- package/src/components/Model/SourcesExplorer.tsx +3 -0
- package/src/components/Model/index.ts +3 -0
- package/src/components/Model/useModelData.ts +3 -0
- package/src/components/Notebook/Notebook.tsx +447 -390
- package/src/components/Notebook/NotebookCell.tsx +120 -3
- package/src/components/Notebook/index.ts +3 -0
- package/src/components/Notebook/runPlan.spec.ts +155 -0
- package/src/components/Notebook/runPlan.ts +67 -0
- package/src/components/Notebook/types.ts +14 -0
- package/src/components/Package/ContentTypeIcon.spec.ts +91 -0
- package/src/components/Package/ContentTypeIcon.tsx +80 -6
- package/src/components/Package/FileTreeView.tsx +3 -0
- package/src/components/Package/Models.tsx +3 -0
- package/src/components/Package/Package.tsx +151 -38
- package/src/components/Package/index.ts +3 -0
- package/src/components/QueryResult/QueryResult.tsx +3 -0
- package/src/components/QueryResult/index.ts +3 -0
- package/src/components/RenderedResult/RenderedResult.tsx +312 -19
- package/src/components/RenderedResult/ResultContainer.tsx +31 -1
- package/src/components/RenderedResult/index.ts +3 -0
- package/src/components/RenderedResult/renderLogs.spec.ts +3 -0
- package/src/components/RenderedResult/renderLogs.ts +3 -0
- package/src/components/ResultsDialog.tsx +8 -0
- package/src/components/ServerProvider.tsx +5 -0
- package/src/components/Workbook/BrowserWorkbookStorage.ts +3 -0
- package/src/components/Workbook/EditableMalloyCell.tsx +3 -0
- package/src/components/Workbook/ModelPicker.tsx +3 -0
- package/src/components/Workbook/MutableCell.tsx +3 -0
- package/src/components/Workbook/Workbook.tsx +3 -0
- package/src/components/Workbook/WorkbookList.tsx +3 -0
- package/src/components/Workbook/WorkbookManager.ts +3 -0
- package/src/components/Workbook/WorkbookStorage.ts +3 -0
- package/src/components/Workbook/WorkbookStorageProvider.tsx +3 -0
- package/src/components/Workbook/index.ts +3 -0
- package/src/components/click_helper.ts +17 -1
- package/src/components/drill/index.ts +28 -0
- package/src/components/drill/markDrillableCells.dom.spec.ts +313 -0
- package/src/components/drill/markDrillableCells.spec.ts +109 -0
- package/src/components/drill/markDrillableCells.ts +314 -0
- package/src/components/drill/resolveDrill.spec.ts +449 -0
- package/src/components/drill/resolveDrill.ts +375 -0
- package/src/components/drill/useDrill.tsx +203 -0
- package/src/components/filter/DimensionFilter.tsx +3 -0
- package/src/components/filter/index.ts +3 -0
- package/src/components/filter/utils.ts +16 -5
- package/src/components/given/GivenInput.spec.tsx +498 -15
- package/src/components/given/GivenInput.tsx +565 -30
- package/src/components/given/GivensPanel.spec.tsx +175 -0
- package/src/components/given/GivensPanel.tsx +142 -32
- package/src/components/given/filterValue.spec.ts +364 -0
- package/src/components/given/filterValue.ts +207 -0
- package/src/components/given/index.ts +8 -1
- package/src/components/given/paramCodec.spec.ts +857 -0
- package/src/components/given/paramCodec.ts +483 -0
- package/src/components/given/utils.spec.ts +3 -0
- package/src/components/given/utils.ts +3 -0
- package/src/components/highlighter.ts +3 -0
- package/src/components/index.ts +7 -1
- package/src/components/styles.ts +38 -3
- package/src/constants/docLinks.spec.ts +54 -0
- package/src/constants/docLinks.ts +29 -0
- package/src/hooks/givenValue.ts +13 -0
- package/src/hooks/index.ts +9 -4
- package/src/hooks/useDimensionFilters.ts +4 -7
- package/src/hooks/useDimensionFiltersFromSpec.ts +3 -0
- package/src/hooks/useDimensionFiltersQuery.ts +4 -7
- package/src/hooks/useDimensionalFilterRangeData.ts +4 -7
- package/src/hooks/useGivensState.spec.ts +449 -0
- package/src/hooks/useGivensState.ts +340 -0
- package/src/hooks/useModelGivens.ts +3 -0
- package/src/hooks/useQueryWithApiError.ts +3 -0
- package/src/hooks/useRawQueryData.ts +3 -0
- package/src/hooks/useSuggestOptions.spec.ts +112 -0
- package/src/hooks/useSuggestOptions.ts +263 -0
- package/src/index.ts +3 -0
- package/src/react-app-env.d.ts +3 -0
- package/src/theme/ThemeContext.tsx +3 -0
- package/src/theme/buildMalloyExplicitTheme.ts +3 -0
- package/src/theme/buildTableCssVars.spec.ts +3 -0
- package/src/theme/buildTableCssVars.ts +7 -0
- package/src/theme/buildVegaThemeOverride.spec.ts +3 -0
- package/src/theme/buildVegaThemeOverride.ts +3 -0
- package/src/theme/defaults.ts +3 -0
- package/src/theme/index.ts +3 -0
- package/src/theme/keys.ts +3 -0
- package/src/theme/readChartAnnotations.spec.ts +3 -0
- package/src/theme/readChartAnnotations.ts +3 -0
- package/src/theme/resolveTheme.spec.ts +16 -0
- package/src/theme/resolveTheme.ts +6 -0
- package/src/theme/types.ts +12 -0
- package/src/utils/dataAppEmbed.spec.ts +3 -0
- package/src/utils/dataAppEmbed.ts +3 -0
- package/src/utils/formatting.spec.ts +3 -0
- package/src/utils/formatting.ts +3 -0
- package/src/utils/malloyString.spec.ts +24 -0
- package/src/utils/malloyString.ts +12 -0
- package/src/utils/parsing.spec.ts +3 -0
- package/src/utils/parsing.ts +3 -0
- package/src/utils/queryClient.ts +3 -0
- package/test/README.md +21 -10
- package/test/setup.ts +3 -0
- package/vite.config.ts +3 -0
- package/dist/ServerProvider-Dg5S1qBU.cjs.js +0 -1
- package/dist/hooks/useGivensForm.d.ts +0 -35
- package/dist/index-MES4MGpQ.cjs.js +0 -309
- package/src/hooks/useGivensForm.spec.ts +0 -99
- package/src/hooks/useGivensForm.ts +0 -107
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
import { MoreVert } from "@mui/icons-material";
|
|
2
5
|
import FolderOutlinedIcon from "@mui/icons-material/FolderOutlined";
|
|
3
6
|
import {
|
|
@@ -17,6 +20,7 @@ import {
|
|
|
17
20
|
import { useState } from "react";
|
|
18
21
|
import { Environment } from "../../client";
|
|
19
22
|
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
23
|
+
import { serverBaseUrl } from "../../utils/dataAppEmbed";
|
|
20
24
|
import { getEnvironmentDescription } from "../../utils/parsing";
|
|
21
25
|
import { DOC_LINKS } from "../../constants/docLinks";
|
|
22
26
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
@@ -30,26 +34,79 @@ interface HomeProps {
|
|
|
30
34
|
onClickEnvironment?: (to: string, event?: React.MouseEvent) => void;
|
|
31
35
|
}
|
|
32
36
|
|
|
37
|
+
/**
|
|
38
|
+
* What this server can do, in the order someone meets it: exploring first, then
|
|
39
|
+
* the three analytics surfaces a package can hold, then the endpoint agents come
|
|
40
|
+
* in through and the rules that govern all of it. Anything that does not earn a
|
|
41
|
+
* card is named in the closing paragraph rather than crowding this list.
|
|
42
|
+
*/
|
|
33
43
|
const FEATURES: Array<{ title: string; body: string; href: string }> = [
|
|
34
44
|
{
|
|
35
45
|
title: "Ad-hoc analysis",
|
|
36
|
-
body: "Browse semantic sources
|
|
46
|
+
body: "Browse the semantic sources on this server and build nested queries in Explorer. Every click writes valid Malloy, so metrics stay correct even across joins.",
|
|
37
47
|
href: DOC_LINKS.explorer,
|
|
38
48
|
},
|
|
39
49
|
{
|
|
40
|
-
title: "
|
|
41
|
-
body: "
|
|
42
|
-
href: DOC_LINKS.
|
|
50
|
+
title: "Notebooks",
|
|
51
|
+
body: "A data story: markdown and live query cells in one file, versioned beside the model it reads. Any givens it imports become a panel of filter controls above the cells.",
|
|
52
|
+
href: DOC_LINKS.surfaces,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
title: "Dashboards",
|
|
56
|
+
body: "A tagged Malloy file is the page. Tags lay out the grid, the filter row is rendered from the query's parameters, and a tagged dimension clicks through to a detail page. No front-end code.",
|
|
57
|
+
href: DOC_LINKS.dashboards,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
title: "Data apps",
|
|
61
|
+
body: "Hand-author an HTML page in a package's public directory and Publisher serves it, backed by that package's models. No build step, and it embeds in a host page.",
|
|
62
|
+
href: DOC_LINKS.dataApps,
|
|
43
63
|
},
|
|
44
64
|
{
|
|
45
65
|
title: "AI data agents",
|
|
46
|
-
body: "
|
|
66
|
+
body: "One MCP endpoint. Agents discover the sources, compile-check the Malloy they write, and ask well-formed questions instead of guessing at raw tables.",
|
|
47
67
|
href: DOC_LINKS.mcpAgents,
|
|
48
68
|
},
|
|
69
|
+
{
|
|
70
|
+
// Deliberately not "so every caller sees only their rows". Givens are
|
|
71
|
+
// caller-asserted (docs/row-level-access.md), so a row-level filter is not
|
|
72
|
+
// a boundary on its own; `#(authorize)` is the thing that refuses. What is
|
|
73
|
+
// true, and what this says, is that the declarations live in the model, so
|
|
74
|
+
// no surface can define its own.
|
|
75
|
+
title: "Governed access",
|
|
76
|
+
body: "Runtime parameters, row-level filters, and per-source access gates are declared in the model, so every surface reads the same rules rather than reimplementing them.",
|
|
77
|
+
href: DOC_LINKS.givens,
|
|
78
|
+
},
|
|
49
79
|
];
|
|
50
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Always a new tab. `Home` is exported from the SDK, so it renders inside other
|
|
83
|
+
* people's pages as well as the standalone console, and same-tab navigation
|
|
84
|
+
* there unloads the host application. That includes the API spec, which is
|
|
85
|
+
* served by the Publisher server but not necessarily by the page's own origin.
|
|
86
|
+
* `target` and `rel` are set together so they cannot desynchronise.
|
|
87
|
+
*/
|
|
88
|
+
function InlineLink({
|
|
89
|
+
href,
|
|
90
|
+
children,
|
|
91
|
+
}: {
|
|
92
|
+
href: string;
|
|
93
|
+
children: React.ReactNode;
|
|
94
|
+
}) {
|
|
95
|
+
return (
|
|
96
|
+
<Box
|
|
97
|
+
component="a"
|
|
98
|
+
href={href}
|
|
99
|
+
target="_blank"
|
|
100
|
+
rel="noopener noreferrer"
|
|
101
|
+
sx={{ color: "text.primary", textDecoration: "underline" }}
|
|
102
|
+
>
|
|
103
|
+
{children}
|
|
104
|
+
</Box>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
51
108
|
export default function Home({ onClickEnvironment }: HomeProps) {
|
|
52
|
-
const { apiClients, mutable } = useServer();
|
|
109
|
+
const { apiClients, mutable, server } = useServer();
|
|
53
110
|
|
|
54
111
|
const { data, isSuccess, isError, error } = useQueryWithApiError({
|
|
55
112
|
queryKey: ["environments"],
|
|
@@ -85,16 +142,24 @@ export default function Home({ onClickEnvironment }: HomeProps) {
|
|
|
85
142
|
color="text.secondary"
|
|
86
143
|
sx={{ maxWidth: 720, lineHeight: 1.6 }}
|
|
87
144
|
>
|
|
88
|
-
Define semantic models once
|
|
89
|
-
serves Malloy models
|
|
90
|
-
|
|
91
|
-
and
|
|
145
|
+
Define semantic models once and use them everywhere. Publisher
|
|
146
|
+
serves Malloy models over a REST API and a single MCP endpoint,
|
|
147
|
+
so applications, BI tools, and AI agents compose queries against
|
|
148
|
+
the model instead of writing SQL, and the numbers come back right
|
|
149
|
+
by construction.
|
|
92
150
|
</Typography>
|
|
93
151
|
</Box>
|
|
94
152
|
|
|
153
|
+
{/* Two columns at every width above the phone breakpoint, and
|
|
154
|
+
deliberately not the three the environment grid below uses: these
|
|
155
|
+
bodies are prose rather than a name. Measured at 1440px, two across
|
|
156
|
+
gives every card a 410px column and a uniform three lines. Three
|
|
157
|
+
across is narrower than a third of the container, since the grid
|
|
158
|
+
subtracts its gutters, and the bodies then wrap unevenly so the row
|
|
159
|
+
heights stop matching. */}
|
|
95
160
|
<Grid container spacing={4} sx={{ mb: 5 }}>
|
|
96
161
|
{FEATURES.map((feature) => (
|
|
97
|
-
<Grid size={{ xs: 12,
|
|
162
|
+
<Grid size={{ xs: 12, sm: 6 }} key={feature.title}>
|
|
98
163
|
<Stack spacing={1}>
|
|
99
164
|
<Typography
|
|
100
165
|
variant="body2"
|
|
@@ -198,21 +263,46 @@ export default function Home({ onClickEnvironment }: HomeProps) {
|
|
|
198
263
|
|
|
199
264
|
<Divider sx={{ my: 4 }} />
|
|
200
265
|
|
|
201
|
-
<Typography
|
|
266
|
+
<Typography
|
|
267
|
+
variant="body2"
|
|
268
|
+
color="text.secondary"
|
|
269
|
+
sx={{ maxWidth: 720, lineHeight: 1.6 }}
|
|
270
|
+
>
|
|
271
|
+
{/* Six of the ten types in the api-doc.yaml enum. connections.md
|
|
272
|
+
names eight. Two of the six named here, mysql and trino,
|
|
273
|
+
appear in connections.md exactly once, in the parenthetical that
|
|
274
|
+
ends "etc."; Databricks and MotherDuck it never names at all. "And more"
|
|
275
|
+
rather than a full list, because a list that reads as complete
|
|
276
|
+
while omitting Databricks is worse than a short one that says
|
|
277
|
+
it is short. */}
|
|
278
|
+
Also here:{" "}
|
|
279
|
+
<InlineLink href={DOC_LINKS.connections}>connections</InlineLink> to
|
|
280
|
+
BigQuery, Snowflake, Postgres, MySQL, Trino, DuckDB and more;{" "}
|
|
281
|
+
<InlineLink href={DOC_LINKS.materialization}>
|
|
282
|
+
materialized tables
|
|
283
|
+
</InlineLink>{" "}
|
|
284
|
+
built on demand or on a schedule; and a{" "}
|
|
285
|
+
{/* Built from the configured server rather than written as
|
|
286
|
+
"/api-doc.html". The spec is a static file off the Publisher
|
|
287
|
+
server's root, and an SDK consumer's page origin need not be
|
|
288
|
+
that server: a root-relative href resolves against the host and
|
|
289
|
+
404s. serverBaseUrl exists for exactly this. */}
|
|
290
|
+
<InlineLink href={`${serverBaseUrl(server)}/api-doc.html`}>
|
|
291
|
+
REST API
|
|
292
|
+
</InlineLink>{" "}
|
|
293
|
+
that does everything this console does.
|
|
294
|
+
</Typography>
|
|
295
|
+
|
|
296
|
+
<Typography
|
|
297
|
+
variant="body2"
|
|
298
|
+
color="text.secondary"
|
|
299
|
+
sx={{ maxWidth: 720, lineHeight: 1.6, mt: 2 }}
|
|
300
|
+
>
|
|
202
301
|
Publisher is built on fully open infrastructure and designed for the
|
|
203
302
|
AI era. Join the{" "}
|
|
204
|
-
<
|
|
205
|
-
component="a"
|
|
206
|
-
href="https://join.slack.com/t/malloy-community/shared_invite/zt-1kgfwgi5g-CrsdaRqs81QY67QW0~t_uw"
|
|
207
|
-
target="_blank"
|
|
208
|
-
rel="noopener noreferrer"
|
|
209
|
-
sx={{
|
|
210
|
-
color: "text.primary",
|
|
211
|
-
textDecoration: "underline",
|
|
212
|
-
}}
|
|
213
|
-
>
|
|
303
|
+
<InlineLink href="https://join.slack.com/t/malloy-community/shared_invite/zt-1kgfwgi5g-CrsdaRqs81QY67QW0~t_uw">
|
|
214
304
|
Malloy Slack community
|
|
215
|
-
</
|
|
305
|
+
</InlineLink>{" "}
|
|
216
306
|
to ask questions, share ideas, and contribute.
|
|
217
307
|
</Typography>
|
|
218
308
|
</Container>
|