@malloy-publisher/sdk 0.0.382-dev → 0.2.1

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 (284) hide show
  1. package/README.md +115 -95
  2. package/TREE_SHAKING.md +16 -11
  3. package/bunfig.toml +7 -0
  4. package/dist/ServerProvider-Cn_LhKda.cjs.js +1 -0
  5. package/dist/ServerProvider-sfabtriY.es.js +4076 -0
  6. package/dist/client/api.d.ts +3773 -1515
  7. package/dist/client/configuration.d.ts +1 -1
  8. package/dist/client/index.cjs.js +1 -1
  9. package/dist/client/index.d.ts +1 -1
  10. package/dist/client/index.es.js +86 -59
  11. package/dist/components/Connections/EditConnectionDialog.d.ts +2 -1
  12. package/dist/components/Connections/common.d.ts +8 -2
  13. package/dist/components/Dashboard/Dashboard.d.ts +62 -0
  14. package/dist/components/Dashboard/DashboardTile.d.ts +57 -0
  15. package/dist/components/Dashboard/index.d.ts +2 -0
  16. package/dist/components/DataAppViewer/DataAppViewer.d.ts +23 -0
  17. package/dist/components/DataAppViewer/index.d.ts +1 -0
  18. package/dist/components/Environment/Environment.d.ts +6 -0
  19. package/dist/components/Environment/index.d.ts +2 -0
  20. package/dist/components/Home/AddEnvironmentDialog.d.ts +1 -0
  21. package/dist/components/Home/DeleteEnvironmentDialog.d.ts +5 -0
  22. package/dist/components/Home/EditEnvironmentDialog.d.ts +7 -0
  23. package/dist/components/Home/Home.d.ts +2 -2
  24. package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +14 -0
  25. package/dist/components/Materializations/CreateMaterializationDialog.d.ts +10 -0
  26. package/dist/components/Materializations/DeleteMaterializationDialog.d.ts +7 -0
  27. package/dist/components/Materializations/EnvironmentMaterializations.d.ts +7 -0
  28. package/dist/components/Materializations/ManifestView.d.ts +13 -0
  29. package/dist/components/Materializations/MaterializationDetailDialog.d.ts +9 -0
  30. package/dist/components/Materializations/MaterializationRunsList.d.ts +15 -0
  31. package/dist/components/Materializations/Materializations.d.ts +7 -0
  32. package/dist/components/Materializations/ScheduleCard.d.ts +20 -0
  33. package/dist/components/Materializations/SectionLabel.d.ts +10 -0
  34. package/dist/components/Materializations/SetScheduleDialog.d.ts +11 -0
  35. package/dist/components/Materializations/TriggerChip.d.ts +10 -0
  36. package/dist/components/Materializations/cron.d.ts +23 -0
  37. package/dist/components/Materializations/index.d.ts +2 -0
  38. package/dist/components/Materializations/utils.d.ts +46 -0
  39. package/dist/components/Notebook/Notebook.d.ts +47 -4
  40. package/dist/components/Notebook/NotebookCell.d.ts +37 -1
  41. package/dist/components/Notebook/runPlan.d.ts +29 -0
  42. package/dist/components/Notebook/types.d.ts +10 -0
  43. package/dist/components/Package/ContentTypeIcon.d.ts +31 -0
  44. package/dist/components/Package/Package.d.ts +1 -4
  45. package/dist/components/RenderedResult/RenderedResult.d.ts +7 -1
  46. package/dist/components/RenderedResult/ResultContainer.d.ts +5 -1
  47. package/dist/components/RenderedResult/renderLogs.d.ts +6 -0
  48. package/dist/components/ResultsDialog.d.ts +6 -1
  49. package/dist/components/ServerProvider.d.ts +28 -4
  50. package/dist/components/click_helper.d.ts +10 -1
  51. package/dist/components/drill/index.d.ts +3 -0
  52. package/dist/components/drill/markDrillableCells.d.ts +55 -0
  53. package/dist/components/drill/resolveDrill.d.ts +139 -0
  54. package/dist/components/drill/useDrill.d.ts +63 -0
  55. package/dist/components/given/GivenInput.d.ts +52 -0
  56. package/dist/components/given/GivensPanel.d.ts +47 -0
  57. package/dist/components/given/filterValue.d.ts +97 -0
  58. package/dist/components/given/index.d.ts +2 -0
  59. package/dist/components/given/paramCodec.d.ts +60 -0
  60. package/dist/components/given/utils.d.ts +17 -0
  61. package/dist/components/highlighter.d.ts +6 -1
  62. package/dist/components/index.d.ts +7 -2
  63. package/dist/components/styles.d.ts +47 -0
  64. package/dist/constants/docLinks.d.ts +12 -0
  65. package/dist/{core-YNpOLuB1.cjs.js → core-CqRKhtoy.cjs.js} +1 -1
  66. package/dist/{core-CjeTkq8O.es.js → core-DyU47reh.es.js} +1 -1
  67. package/dist/github-dark-BKL9xNgN.cjs.js +1 -0
  68. package/dist/github-dark-DenFmJkN.es.js +4 -0
  69. package/dist/hooks/givenValue.d.ts +10 -0
  70. package/dist/hooks/index.d.ts +4 -0
  71. package/dist/hooks/useDimensionFiltersFromSpec.d.ts +3 -3
  72. package/dist/hooks/useDimensionFiltersQuery.d.ts +3 -3
  73. package/dist/hooks/useDimensionalFilterRangeData.d.ts +4 -4
  74. package/dist/hooks/useGivensState.d.ts +64 -0
  75. package/dist/hooks/useModelGivens.d.ts +10 -0
  76. package/dist/hooks/useSuggestOptions.d.ts +78 -0
  77. package/dist/{index-DRDu9kIV.es.js → index-CAkFE4Ol.es.js} +41278 -28504
  78. package/dist/index-DD4b_bt0.cjs.js +356 -0
  79. package/dist/index.cjs.js +1 -1
  80. package/dist/index.d.ts +4 -1
  81. package/dist/index.es.js +79 -48
  82. package/dist/malloy-explorer.css +12 -1
  83. package/dist/sdk.css +1 -1
  84. package/dist/theme/ThemeContext.d.ts +45 -0
  85. package/dist/theme/buildMalloyExplicitTheme.d.ts +34 -0
  86. package/dist/theme/buildTableCssVars.d.ts +41 -0
  87. package/dist/theme/buildVegaThemeOverride.d.ts +16 -0
  88. package/dist/theme/defaults.d.ts +7 -0
  89. package/dist/theme/index.d.ts +8 -0
  90. package/dist/theme/keys.d.ts +20 -0
  91. package/dist/theme/readChartAnnotations.d.ts +23 -0
  92. package/dist/theme/resolveTheme.d.ts +22 -0
  93. package/dist/theme/types.d.ts +70 -0
  94. package/dist/utils/dataAppEmbed.d.ts +44 -0
  95. package/dist/utils/formatting.d.ts +1 -1
  96. package/dist/utils/malloyString.d.ts +7 -0
  97. package/dist/utils/parsing.d.ts +2 -2
  98. package/dist/utils/queryClient.d.ts +5 -0
  99. package/package.json +19 -8
  100. package/src/client-entry.ts +3 -0
  101. package/src/components/AnalyzePackageButton.tsx +9 -3
  102. package/src/components/ApiErrorDisplay.tsx +3 -0
  103. package/src/components/Connections/AddConnectionDialog.tsx +132 -25
  104. package/src/components/Connections/DeleteConnectionDialog.tsx +14 -3
  105. package/src/components/Connections/EditConnectionDialog.tsx +167 -37
  106. package/src/components/Connections/common.ts +94 -3
  107. package/src/components/DOMElement/DOMElement.tsx +3 -0
  108. package/src/components/DOMElement/index.ts +3 -0
  109. package/src/components/Dashboard/Dashboard.spec.tsx +216 -0
  110. package/src/components/Dashboard/Dashboard.tsx +458 -0
  111. package/src/components/Dashboard/DashboardTile.spec.tsx +81 -0
  112. package/src/components/Dashboard/DashboardTile.tsx +199 -0
  113. package/src/components/Dashboard/index.ts +5 -0
  114. package/src/components/Dashboard/tileGridColumn.spec.ts +35 -0
  115. package/src/components/DataAppViewer/DataAppViewer.tsx +214 -0
  116. package/src/components/DataAppViewer/index.ts +4 -0
  117. package/src/components/{Project → Environment}/About.tsx +11 -4
  118. package/src/components/Environment/AddPackageDialog.tsx +202 -0
  119. package/src/components/{Project → Environment}/ConnectionExplorer.tsx +17 -14
  120. package/src/components/Environment/Connections.tsx +391 -0
  121. package/src/components/{Project → Environment}/DeletePackageDialog.tsx +8 -4
  122. package/src/components/{Project → Environment}/EditPackageDialog.tsx +21 -13
  123. package/src/components/Environment/Environment.tsx +89 -0
  124. package/src/components/Environment/Packages.tsx +206 -0
  125. package/src/components/Environment/index.ts +5 -0
  126. package/src/components/Home/{AddProjectDialog.tsx → AddEnvironmentDialog.tsx} +25 -19
  127. package/src/components/Home/{DeleteProjectDialog.tsx → DeleteEnvironmentDialog.tsx} +20 -15
  128. package/src/components/Home/{EditProjectDialog.tsx → EditEnvironmentDialog.tsx} +35 -28
  129. package/src/components/Home/Home.tsx +386 -408
  130. package/src/components/Home/index.ts +3 -0
  131. package/src/components/Loading.tsx +3 -0
  132. package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +179 -0
  133. package/src/components/Materializations/CreateMaterializationDialog.tsx +112 -0
  134. package/src/components/Materializations/DeleteMaterializationDialog.tsx +109 -0
  135. package/src/components/Materializations/EnvironmentMaterializations.tsx +267 -0
  136. package/src/components/Materializations/ManifestView.tsx +87 -0
  137. package/src/components/Materializations/MaterializationDetailDialog.tsx +259 -0
  138. package/src/components/Materializations/MaterializationRunsList.tsx +256 -0
  139. package/src/components/Materializations/Materializations.tsx +355 -0
  140. package/src/components/Materializations/ScheduleCard.tsx +231 -0
  141. package/src/components/Materializations/SectionLabel.tsx +30 -0
  142. package/src/components/Materializations/SetScheduleDialog.tsx +162 -0
  143. package/src/components/Materializations/TriggerChip.tsx +44 -0
  144. package/src/components/Materializations/cron.ts +124 -0
  145. package/src/components/Materializations/index.ts +5 -0
  146. package/src/components/Materializations/utils.ts +145 -0
  147. package/src/components/Model/Model.tsx +44 -2
  148. package/src/components/Model/ModelCell.tsx +14 -5
  149. package/src/components/Model/ModelExplorer.tsx +3 -0
  150. package/src/components/Model/ModelExplorerDialog.tsx +4 -1
  151. package/src/components/Model/SourcesExplorer.tsx +9 -6
  152. package/src/components/Model/index.ts +3 -0
  153. package/src/components/Model/useModelData.ts +6 -3
  154. package/src/components/Notebook/Notebook.spec.tsx +88 -0
  155. package/src/components/Notebook/Notebook.tsx +476 -339
  156. package/src/components/Notebook/NotebookCell.tsx +264 -25
  157. package/src/components/Notebook/index.ts +3 -0
  158. package/src/components/Notebook/runPlan.spec.ts +155 -0
  159. package/src/components/Notebook/runPlan.ts +67 -0
  160. package/src/components/Notebook/types.ts +14 -0
  161. package/src/components/Package/ContentTypeIcon.spec.ts +91 -0
  162. package/src/components/Package/ContentTypeIcon.tsx +177 -0
  163. package/src/components/Package/FileTreeView.tsx +3 -0
  164. package/src/components/Package/Models.tsx +7 -4
  165. package/src/components/Package/Package.spec.tsx +113 -0
  166. package/src/components/Package/Package.tsx +692 -59
  167. package/src/components/Package/index.ts +3 -0
  168. package/src/components/QueryResult/QueryResult.tsx +17 -8
  169. package/src/components/QueryResult/index.ts +3 -0
  170. package/src/components/RenderedResult/RenderedResult.tsx +725 -67
  171. package/src/components/RenderedResult/ResultContainer.tsx +71 -2
  172. package/src/components/RenderedResult/index.ts +3 -0
  173. package/src/components/RenderedResult/renderLogs.spec.ts +58 -0
  174. package/src/components/RenderedResult/renderLogs.ts +43 -0
  175. package/src/components/ResultsDialog.tsx +13 -1
  176. package/src/components/ServerProvider.tsx +175 -51
  177. package/src/components/Workbook/BrowserWorkbookStorage.ts +3 -0
  178. package/src/components/Workbook/EditableMalloyCell.tsx +3 -0
  179. package/src/components/Workbook/ModelPicker.tsx +7 -4
  180. package/src/components/Workbook/MutableCell.tsx +10 -5
  181. package/src/components/Workbook/Workbook.tsx +8 -5
  182. package/src/components/Workbook/WorkbookList.tsx +3 -0
  183. package/src/components/Workbook/WorkbookManager.ts +3 -0
  184. package/src/components/Workbook/WorkbookStorage.ts +3 -0
  185. package/src/components/Workbook/WorkbookStorageProvider.tsx +3 -0
  186. package/src/components/Workbook/index.ts +3 -0
  187. package/src/components/click_helper.ts +17 -1
  188. package/src/components/drill/index.ts +28 -0
  189. package/src/components/drill/markDrillableCells.dom.spec.ts +313 -0
  190. package/src/components/drill/markDrillableCells.spec.ts +109 -0
  191. package/src/components/drill/markDrillableCells.ts +314 -0
  192. package/src/components/drill/resolveDrill.spec.ts +449 -0
  193. package/src/components/drill/resolveDrill.ts +375 -0
  194. package/src/components/drill/useDrill.tsx +203 -0
  195. package/src/components/filter/DimensionFilter.tsx +3 -0
  196. package/src/components/filter/index.ts +3 -0
  197. package/src/components/filter/utils.ts +16 -5
  198. package/src/components/given/GivenInput.spec.tsx +689 -0
  199. package/src/components/given/GivenInput.tsx +801 -0
  200. package/src/components/given/GivensPanel.spec.tsx +175 -0
  201. package/src/components/given/GivensPanel.tsx +195 -0
  202. package/src/components/given/filterValue.spec.ts +364 -0
  203. package/src/components/given/filterValue.ts +207 -0
  204. package/src/components/given/index.ts +9 -0
  205. package/src/components/given/paramCodec.spec.ts +857 -0
  206. package/src/components/given/paramCodec.ts +483 -0
  207. package/src/components/given/utils.spec.ts +60 -0
  208. package/src/components/given/utils.ts +79 -0
  209. package/src/components/highlighter.ts +22 -5
  210. package/src/components/index.ts +10 -2
  211. package/src/components/styles.ts +82 -33
  212. package/src/constants/docLinks.spec.ts +54 -0
  213. package/src/constants/docLinks.ts +46 -0
  214. package/src/hooks/givenValue.ts +13 -0
  215. package/src/hooks/index.ts +13 -0
  216. package/src/hooks/useDimensionFilters.ts +4 -7
  217. package/src/hooks/useDimensionFiltersFromSpec.ts +8 -5
  218. package/src/hooks/useDimensionFiltersQuery.ts +10 -13
  219. package/src/hooks/useDimensionalFilterRangeData.ts +11 -14
  220. package/src/hooks/useGivensState.spec.ts +449 -0
  221. package/src/hooks/useGivensState.ts +340 -0
  222. package/src/hooks/useModelGivens.ts +29 -0
  223. package/src/hooks/useQueryWithApiError.ts +3 -0
  224. package/src/hooks/useRawQueryData.ts +6 -3
  225. package/src/hooks/useSuggestOptions.dom.spec.ts +91 -0
  226. package/src/hooks/useSuggestOptions.spec.ts +112 -0
  227. package/src/hooks/useSuggestOptions.ts +268 -0
  228. package/src/index.ts +10 -1
  229. package/src/react-app-env.d.ts +3 -0
  230. package/src/theme/ThemeContext.tsx +86 -0
  231. package/src/theme/buildMalloyExplicitTheme.ts +61 -0
  232. package/src/theme/buildTableCssVars.spec.ts +86 -0
  233. package/src/theme/buildTableCssVars.ts +98 -0
  234. package/src/theme/buildVegaThemeOverride.spec.ts +56 -0
  235. package/src/theme/buildVegaThemeOverride.ts +47 -0
  236. package/src/theme/defaults.ts +78 -0
  237. package/src/theme/index.ts +11 -0
  238. package/src/theme/keys.ts +32 -0
  239. package/src/theme/readChartAnnotations.spec.ts +58 -0
  240. package/src/theme/readChartAnnotations.ts +69 -0
  241. package/src/theme/resolveTheme.spec.ts +160 -0
  242. package/src/theme/resolveTheme.ts +121 -0
  243. package/src/theme/types.ts +79 -0
  244. package/src/utils/dataAppEmbed.spec.ts +63 -0
  245. package/src/utils/dataAppEmbed.ts +84 -0
  246. package/src/utils/formatting.spec.ts +25 -21
  247. package/src/utils/formatting.ts +11 -7
  248. package/src/utils/malloyString.spec.ts +24 -0
  249. package/src/utils/malloyString.ts +12 -0
  250. package/src/utils/parsing.spec.ts +26 -19
  251. package/src/utils/parsing.ts +11 -6
  252. package/src/utils/queryClient.ts +17 -0
  253. package/test/README.md +185 -0
  254. package/test/serverProvider.tsx +72 -0
  255. package/test/setup.ts +29 -0
  256. package/tsconfig.json +12 -1
  257. package/tsconfig.spec.json +22 -0
  258. package/vite.config.ts +3 -0
  259. package/dist/ServerProvider-lOQXDlqB.cjs.js +0 -1
  260. package/dist/ServerProvider-on-8FH5Z.es.js +0 -3060
  261. package/dist/components/Home/AddProjectDialog.d.ts +0 -1
  262. package/dist/components/Home/DeleteProjectDialog.d.ts +0 -5
  263. package/dist/components/Home/EditProjectDialog.d.ts +0 -7
  264. package/dist/components/Package/Config.d.ts +0 -5
  265. package/dist/components/Package/Databases.d.ts +0 -5
  266. package/dist/components/Package/Notebooks.d.ts +0 -6
  267. package/dist/components/Project/Project.d.ts +0 -6
  268. package/dist/components/Project/index.d.ts +0 -2
  269. package/dist/index-BOLBP6_i.cjs.js +0 -233
  270. package/src/components/Package/Config.tsx +0 -97
  271. package/src/components/Package/Connections.tsx +0 -373
  272. package/src/components/Package/Databases.tsx +0 -228
  273. package/src/components/Package/Notebooks.tsx +0 -77
  274. package/src/components/Project/AddPackageDialog.tsx +0 -159
  275. package/src/components/Project/Packages.tsx +0 -191
  276. package/src/components/Project/Project.tsx +0 -52
  277. package/src/components/Project/index.ts +0 -2
  278. /package/dist/components/{Project → Environment}/About.d.ts +0 -0
  279. /package/dist/components/{Project → Environment}/AddPackageDialog.d.ts +0 -0
  280. /package/dist/components/{Project → Environment}/ConnectionExplorer.d.ts +0 -0
  281. /package/dist/components/{Package → Environment}/Connections.d.ts +0 -0
  282. /package/dist/components/{Project → Environment}/DeletePackageDialog.d.ts +0 -0
  283. /package/dist/components/{Project → Environment}/EditPackageDialog.d.ts +0 -0
  284. /package/dist/components/{Project → Environment}/Packages.d.ts +0 -0
@@ -0,0 +1,23 @@
1
+ import { Tag } from '@malloydata/malloy-tag';
2
+ import { Theme } from './types';
3
+ /**
4
+ * Read a `theme.*` annotation block out of a parsed Malloy {@link Tag}
5
+ * and turn it into a partial {@link Theme} suitable for the cascade.
6
+ * Returns `undefined` if the tag has no `theme` namespace.
7
+ *
8
+ * Recognised annotation forms (all optional, all sit under `theme`):
9
+ *
10
+ * # theme.palette.series = ["#ff0080", "#ff6b00"]
11
+ * # theme.palette.background.light = "#fff"
12
+ * # theme.palette.background.dark = "#000"
13
+ * # theme.palette.tableHeader.light = "#666"
14
+ * # theme.palette.tableHeader.dark = "#aaa"
15
+ * # theme.font.family = "Roboto, sans-serif"
16
+ * # theme.font.size = 13
17
+ *
18
+ * Series and font are shared across modes; only the seven
19
+ * {@link PER_MODE_COLOR_KEYS} accept light/dark variants. Annotations
20
+ * with the wrong type are silently ignored. The goal is "worst-case a
21
+ * typo means no styling", not "a typo crashes the renderer."
22
+ */
23
+ export declare function readChartAnnotations(tag: Tag | undefined): Theme | undefined;
@@ -0,0 +1,22 @@
1
+ import { ResolvedTheme, Theme, ThemeMode } from './types';
2
+ /**
3
+ * Collapse the layered theme cascade into a {@link ResolvedTheme} that
4
+ * downstream code can consume without null-checks or mode branches.
5
+ * Layer order is low → high precedence; later layers overwrite earlier
6
+ * ones for the keys they set. Per-mode colour objects merge per-mode
7
+ * (a layer that sets only `palette.tile.dark` doesn't clobber the
8
+ * instance-level `palette.tile.light`).
9
+ *
10
+ * The derived fields on ResolvedTheme (border, pinnedBorder,
11
+ * valueColor, foreground, axisFaint) are computed once here from the
12
+ * active mode so the three builders that consume the theme stop
13
+ * recomputing them with duplicated hex literals.
14
+ */
15
+ export declare function resolveTheme(layers: Array<Theme | undefined>, mode: ThemeMode): ResolvedTheme;
16
+ /**
17
+ * Pick the active mode for a viewer given the operator's `defaultMode`,
18
+ * any persisted viewer choice, and a snapshot of the OS dark-mode
19
+ * preference. "auto" is resolved here; callers see only "light" or
20
+ * "dark".
21
+ */
22
+ export declare function resolveMode(defaultMode: Theme["defaultMode"] | undefined, userChoice: ThemeMode | "auto" | undefined, prefersDark: boolean): ThemeMode;
@@ -0,0 +1,70 @@
1
+ import { Theme } from '../client';
2
+ export type { Theme };
3
+ export type ThemeMode = "light" | "dark";
4
+ /**
5
+ * A Theme with every field downstream consumers need actually filled in.
6
+ * Produced by `resolveTheme(layers, mode)`, which flattens the cascade
7
+ * and the per-mode colour split into a single mode-agnostic shape — so
8
+ * `buildTableCssVars`, `buildVegaThemeOverride`, and
9
+ * `buildMalloyExplicitTheme` never have to branch on mode themselves.
10
+ *
11
+ * The seven `palette.*` colour keys are stored per-mode on the raw Theme
12
+ * (one of light/dark per field) and collapse to the active mode here.
13
+ * The five "derived" fields (border, pinnedBorder, valueColor,
14
+ * foreground, axisFaint) are computed once from the resolved mode so
15
+ * the same hex literal isn't repeated across three builders.
16
+ */
17
+ export interface ResolvedTheme {
18
+ mode: ThemeMode;
19
+ series: string[];
20
+ font: {
21
+ family: string;
22
+ size: number;
23
+ };
24
+ background: string;
25
+ tableHeader: string;
26
+ tableHeaderBackground: string;
27
+ tableBody: string;
28
+ tile: string;
29
+ tileTitle: string;
30
+ /**
31
+ * Saturated end of the gradient used by sequential color scales
32
+ * (choropleth maps, heatmaps). The renderer pairs it with a
33
+ * near-neutral low-end so the operator only picks the brand end.
34
+ */
35
+ mapColor: string;
36
+ border: string;
37
+ pinnedBorder: string;
38
+ valueColor: string;
39
+ foreground: string;
40
+ axisFaint: string;
41
+ /**
42
+ * Background for the renderer's HTML chrome (the area between
43
+ * dashboard tiles). Mode-keyed and intentionally NOT
44
+ * operator-customizable — when an operator picks a bold accent
45
+ * for `palette.background` (the chart canvas), the surrounding
46
+ * panel should stay neutral so the accent reads cleanly. In dark
47
+ * mode it paints slate so the panel doesn't sit as a stark white
48
+ * box on the dark page chrome.
49
+ */
50
+ dashboardRoot: string;
51
+ /**
52
+ * Colour a `# drill` cell takes on hover, when it reads as a link. A link
53
+ * blue rather than anything from `palette.series`, deliberately: the
54
+ * affordance has to stay legible as a link against whatever the operator
55
+ * picked for the data, and a drillable bar or cell should not look like it
56
+ * belongs to a series. Mode-keyed and not operator-customizable, like
57
+ * `dashboardRoot`.
58
+ */
59
+ drillLink: string;
60
+ /**
61
+ * Background for the renderer's table interior. Follows the
62
+ * operator's `palette.background` (the chart canvas colour) so
63
+ * tables and charts share a single "viz surface" colour. In dark
64
+ * mode this also keeps the (light-slate) header/body text from
65
+ * painting unreadable light-on-white against the renderer's
66
+ * hardcoded default. Distinct from `dashboardRoot`, which is the
67
+ * panel BETWEEN tiles and stays mode-keyed / neutral.
68
+ */
69
+ tableBackground: string;
70
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * postMessage `type` an embedded data app emits to its host frame as its
3
+ * content height changes, so the host can resize the iframe to avoid nested
4
+ * scrollbars. Payload shape is {@link PublisherResizeMessage}.
5
+ */
6
+ export declare const PUBLISHER_RESIZE_MESSAGE_TYPE = "publisher:resize";
7
+ /** Resize message posted by an embedded data app's publisher.js runtime. */
8
+ export interface PublisherResizeMessage {
9
+ type: typeof PUBLISHER_RESIZE_MESSAGE_TYPE;
10
+ /** Content height in CSS pixels. */
11
+ height: number;
12
+ }
13
+ /** Type guard for a {@link PublisherResizeMessage} arriving via postMessage. */
14
+ export declare function isPublisherResizeMessage(data: unknown): data is PublisherResizeMessage;
15
+ /**
16
+ * Derive the Publisher data origin (where static package files are served)
17
+ * from the configured API base URL by stripping the trailing `/api/v0`.
18
+ *
19
+ * The static-file routes live off the server root, not under the API prefix,
20
+ * and the data origin can differ from the SPA origin in multi-host
21
+ * deployments — so a data app's standalone URL is `serverBaseUrl(server)`
22
+ * joined with its root-relative `resource`.
23
+ */
24
+ export declare function serverBaseUrl(server: string): string;
25
+ /**
26
+ * Absolute URL of a file inside a package, as Publisher serves it:
27
+ * `<data origin>/environments/<env>/packages/<pkg>/<path>`.
28
+ *
29
+ * The one home for this string. Both the data app viewer's iframe and the
30
+ * "this is not a model" page point at it, and hand-building it in each place is
31
+ * how the two drift.
32
+ *
33
+ * `path` is relative to the package's `public/` directory and is inserted as
34
+ * given, since it may contain slashes. A leading `public/` is dropped, because
35
+ * the served path does not include it and a caller passing a path a reader typed
36
+ * would otherwise produce `public/public/<file>`, which 404s. The server's own
37
+ * redirect drops it for the same reason.
38
+ */
39
+ export declare function packageFileUrl({ server, environmentName, packageName, path, }: {
40
+ server: string;
41
+ environmentName: string;
42
+ packageName: string;
43
+ path: string;
44
+ }): string;
@@ -1,5 +1,5 @@
1
1
  export type ParsedResource = {
2
- projectName: string;
2
+ environmentName: string;
3
3
  packageName?: string | undefined;
4
4
  connectionName?: string | undefined;
5
5
  versionId?: string | undefined;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Escape a value for use inside a single-quoted Malloy string literal.
3
+ *
4
+ * Backslashes are escaped first, then quotes: doing it the other way round
5
+ * would re-escape the backslash that the quote escape introduced.
6
+ */
7
+ export declare function escapeMalloyString(value: string): string;
@@ -1,5 +1,5 @@
1
- export declare const getProjectDescription: (readme: string | undefined) => string;
2
- export declare const generateProjectReadme: (project: {
1
+ export declare const getEnvironmentDescription: (readme: string | undefined) => string;
2
+ export declare const generateEnvironmentReadme: (environment: {
3
3
  name: string;
4
4
  readme?: string;
5
5
  }, description?: string) => string;
@@ -1,2 +1,7 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
2
  export declare const globalQueryClient: QueryClient;
3
+ export declare const CHART_RESULT_QUERY_OPTIONS: {
4
+ readonly staleTime: number;
5
+ readonly refetchOnWindowFocus: false;
6
+ readonly refetchOnReconnect: false;
7
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/sdk",
3
3
  "description": "Malloy Publisher SDK",
4
- "version": "0.0.382-dev",
4
+ "version": "0.2.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.es.js",
@@ -60,7 +60,7 @@
60
60
  "build": "bun generate-api-types && bunx vite build",
61
61
  "postbuild": "cp ../../node_modules/@malloydata/malloy-explorer/dist/malloy-explorer.css ./dist/malloy-explorer.css && cp ../../node_modules/@uiw/react-md-editor/markdown-editor.css ./dist/markdown-editor.css && echo '/* SDK Styles */\n@import \"./malloy-explorer.css\";\n@import \"./markdown-editor.css\";' > ./dist/styles.css",
62
62
  "test": "bun test",
63
- "lint": "bunx eslint ./src --fix",
63
+ "lint": "bunx eslint ./src ./test --fix",
64
64
  "format": "bunx prettier --write --parser typescript '**/*.{ts,tsx}'",
65
65
  "analyze": "bunx vite-bundle-visualizer",
66
66
  "generate-api-types": "bunx openapi-generator-cli generate -i ../../api-doc.yaml -g typescript-axios -o src/client/"
@@ -70,10 +70,12 @@
70
70
  "react-dom": ">=19.1.0",
71
71
  "react-router-dom": ">=7.6.2",
72
72
  "@tanstack/react-query": ">=5.59.16",
73
- "@malloydata/malloy-explorer": ">=0.0.338-dev260215172810",
74
- "@malloydata/malloy-interfaces": ">=0.0.374",
75
- "@malloydata/malloy-query-builder": ">=0.0.374",
76
- "@malloydata/render": ">=0.0.374",
73
+ "@malloydata/malloy-explorer": "0.0.338-dev260215172810",
74
+ "@malloydata/malloy-filter": "^0.0.432",
75
+ "@malloydata/malloy-interfaces": "^0.0.432",
76
+ "@malloydata/malloy-query-builder": "^0.0.432",
77
+ "@malloydata/malloy-tag": "^0.0.432",
78
+ "@malloydata/render": "^0.0.432",
77
79
  "@mui/icons-material": ">=7.1.1",
78
80
  "@mui/x-date-pickers": ">=7.1.1",
79
81
  "@mui/material": ">=7.1.1",
@@ -86,11 +88,22 @@
86
88
  "@emotion/styled": "^11.14.0",
87
89
  "@react-spring/web": "^10.0.1",
88
90
  "@uiw/react-md-editor": "^4.0.6",
91
+ "cron-parser": "^5.6.2",
92
+ "cronstrue": "^2.50.0",
89
93
  "markdown-to-jsx": "^7.7.6",
90
94
  "dayjs": "^1.11.13"
91
95
  },
92
96
  "devDependencies": {
97
+ "@happy-dom/global-registrator": "^20.11.1",
98
+ "@malloydata/malloy-explorer": "0.0.338-dev260215172810",
99
+ "@malloydata/malloy-filter": "^0.0.432",
100
+ "@malloydata/malloy-query-builder": "^0.0.432",
101
+ "@malloydata/malloy-tag": "^0.0.432",
93
102
  "@openapitools/openapi-generator-cli": "^2.20.2",
103
+ "@shikijs/langs": "^1.16.3",
104
+ "@shikijs/themes": "^1.16.3",
105
+ "@testing-library/dom": "^10.4.1",
106
+ "@testing-library/react": "^16.3.2",
94
107
  "@types/bun": "^1.2.21",
95
108
  "@types/k6": "^1.0.2",
96
109
  "@types/react": "^19.1.7",
@@ -106,8 +119,6 @@
106
119
  "eslint-plugin-react-hooks": "5.0.0",
107
120
  "eslint-plugin-storybook": "^0.11.4",
108
121
  "shiki": "^1.16.3",
109
- "@shikijs/langs": "^1.16.3",
110
- "@shikijs/themes": "^1.16.3",
111
122
  "vite": "^6.3.2",
112
123
  "vite-plugin-dts": "^4.5.3",
113
124
  "vite-plugin-svgr": "^4.3.0"
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  // Lightweight client entry point for better code splitting
2
5
  // This module contains essential client functionality without heavy UI components
3
6
 
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { Add, Launch } from "@mui/icons-material";
2
5
  import {
3
6
  Box,
@@ -230,13 +233,16 @@ export function AnalyzePackageButton({
230
233
  </FormControl>
231
234
  ) : availableWorkspaces.length === 1 ? (
232
235
  <Box
233
- sx={{
236
+ sx={(theme) => ({
234
237
  p: 2,
235
238
  border: 1,
236
239
  borderColor: "divider",
237
240
  borderRadius: 1,
238
- backgroundColor: "grey.50",
239
- }}
241
+ backgroundColor:
242
+ theme.palette.mode === "dark"
243
+ ? "rgba(255, 255, 255, 0.04)"
244
+ : "grey.50",
245
+ })}
240
246
  >
241
247
  <Typography
242
248
  variant="body2"
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { Typography } from "@mui/material";
2
5
 
3
6
  export interface ApiError extends Error {
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import AddIcon from "@mui/icons-material/Add";
2
5
  import DeleteIcon from "@mui/icons-material/Delete";
3
6
  import Box from "@mui/material/Box";
@@ -27,6 +30,7 @@ import {
27
30
  gcsAttachedDatabaseFields,
28
31
  getAttachedDatabaseFields,
29
32
  s3AttachedDatabaseFields,
33
+ uiCreatableConnectionTypes,
30
34
  } from "./common";
31
35
 
32
36
  type AddConnectionDialogProps = {
@@ -52,6 +56,10 @@ export default function AddConnectionDialog({
52
56
  // DuckLake top-level connection state
53
57
  const [ducklakeCatalogType, setDucklakeCatalogType] = useState("postgres");
54
58
  const [ducklakeStorageType, setDucklakeStorageType] = useState("s3");
59
+ // Which S3 credential shape the storage fields are showing. Needed as state
60
+ // because this section renders uncontrolled inputs read from FormData, so
61
+ // `visibleWhen` has nothing to compare against without it.
62
+ const [ducklakeS3Provider, setDucklakeS3Provider] = useState("config");
55
63
 
56
64
  const handleClickOpen = () => {
57
65
  setOpen(true);
@@ -63,6 +71,7 @@ export default function AddConnectionDialog({
63
71
  setType("postgres");
64
72
  setDucklakeCatalogType("postgres");
65
73
  setDucklakeStorageType("s3");
74
+ setDucklakeS3Provider("config");
66
75
  };
67
76
 
68
77
  const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
@@ -119,11 +128,26 @@ export default function AddConnectionDialog({
119
128
  }
120
129
  });
121
130
  // Validate required fields
122
- if (!s3Config.accessKeyId) {
123
- throw new Error("S3 Access Key ID is required");
124
- }
125
- if (!s3Config.secretAccessKey) {
126
- throw new Error("S3 Secret Access Key is required");
131
+ // Under `credential_chain` the host supplies the credential, so a key
132
+ // pair is not merely optional — the server rejects one that is present
133
+ // and unused.
134
+ if (s3Config.provider === "credential_chain") {
135
+ delete s3Config.accessKeyId;
136
+ delete s3Config.secretAccessKey;
137
+ delete s3Config.sessionToken;
138
+ } else {
139
+ // Symmetric with the deletion above, and load-bearing on the edit
140
+ // path: switching the provider to a key pair unmounts the chain
141
+ // field, so it never resubmits and a carried-forward value would
142
+ // survive into a config the server rejects — naming a field the form
143
+ // is no longer showing.
144
+ delete s3Config.chain;
145
+ if (!s3Config.accessKeyId) {
146
+ throw new Error("S3 Access Key ID is required");
147
+ }
148
+ if (!s3Config.secretAccessKey) {
149
+ throw new Error("S3 Secret Access Key is required");
150
+ }
127
151
  }
128
152
  if (Object.keys(s3Config).length > 0) {
129
153
  storageConfig.s3Connection = s3Config;
@@ -199,6 +223,29 @@ export default function AddConnectionDialog({
199
223
  }
200
224
  });
201
225
 
226
+ // The S3 key fields are no longer HTML-`required`, because under
227
+ // `credential_chain` there is no key to give and a hidden required
228
+ // field blocks submit with nothing on screen to fix. Enforce the
229
+ // pair here instead, where it can be conditional — otherwise a
230
+ // keyless key-based attachment would save and fail at attach.
231
+ if (dbType === "s3") {
232
+ if (connectionConfig.provider === "credential_chain") {
233
+ delete connectionConfig.accessKeyId;
234
+ delete connectionConfig.secretAccessKey;
235
+ delete connectionConfig.sessionToken;
236
+ } else {
237
+ delete connectionConfig.chain;
238
+ if (
239
+ !connectionConfig.accessKeyId ||
240
+ !connectionConfig.secretAccessKey
241
+ ) {
242
+ throw new Error(
243
+ `Attached database "${dbName}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`,
244
+ );
245
+ }
246
+ }
247
+ }
248
+
202
249
  // Set the appropriate connection property based on type
203
250
  const connectionFieldName =
204
251
  attachedDatabaseConnectionFieldName[dbType];
@@ -304,6 +351,21 @@ export default function AddConnectionDialog({
304
351
  if (!connectionConfig.accessToken) {
305
352
  throw new Error("Access Token is required");
306
353
  }
354
+ } else if (type === "databricks") {
355
+ if (!connectionConfig.host) {
356
+ throw new Error("Host is required");
357
+ }
358
+ if (!connectionConfig.path) {
359
+ throw new Error("HTTP Path is required");
360
+ }
361
+ const hasOAuth =
362
+ connectionConfig.oauthClientId &&
363
+ connectionConfig.oauthClientSecret;
364
+ if (!connectionConfig.token && !hasOAuth) {
365
+ throw new Error(
366
+ "Either Access Token or OAuth Client ID + Secret is required",
367
+ );
368
+ }
307
369
  }
308
370
 
309
371
  connectionPayload = {
@@ -339,7 +401,16 @@ export default function AddConnectionDialog({
339
401
 
340
402
  return (
341
403
  <React.Fragment>
342
- <Button variant="outlined" onClick={handleClickOpen}>
404
+ {/* Contained with a start icon, matching AddEnvironmentDialog and
405
+ AddPackageDialog. This was the only add-trigger of the three still
406
+ outlined and icon-less, which read as the secondary action on a
407
+ screen where it is the primary one. */}
408
+ <Button
409
+ variant="contained"
410
+ color="primary"
411
+ startIcon={<AddIcon />}
412
+ onClick={handleClickOpen}
413
+ >
343
414
  Add Connection
344
415
  </Button>
345
416
  <Dialog open={open} onClose={handleClose}>
@@ -373,7 +444,7 @@ export default function AddConnectionDialog({
373
444
  setType(event.target.value as ConnectionTypeEnum)
374
445
  }
375
446
  >
376
- {Object.values(ConnectionTypeEnum).map((type) => (
447
+ {uiCreatableConnectionTypes.map((type) => (
377
448
  <MenuItem key={type} value={type}>
378
449
  {type}
379
450
  </MenuItem>
@@ -484,24 +555,60 @@ export default function AddConnectionDialog({
484
555
  >
485
556
  S3 Credentials
486
557
  </Typography>
487
- {s3AttachedDatabaseFields.map((field) => (
488
- <TextField
489
- key={`s3_${field.name}`}
490
- margin="dense"
491
- id={`ducklake_s3_${field.name}`}
492
- name={`ducklake_s3_${field.name}`}
493
- label={field.label}
494
- type={field.type}
495
- fullWidth
496
- variant="standard"
497
- required={field.required}
498
- placeholder={
499
- field.name === "region"
500
- ? "us-east-1"
501
- : undefined
502
- }
503
- />
504
- ))}
558
+ {s3AttachedDatabaseFields
559
+ .filter((field) =>
560
+ field.visibleWhen
561
+ ? ducklakeS3Provider ===
562
+ field.visibleWhen.value
563
+ : true,
564
+ )
565
+ .map((field) => (
566
+ <TextField
567
+ key={`s3_${field.name}`}
568
+ margin="dense"
569
+ id={`ducklake_s3_${field.name}`}
570
+ name={`ducklake_s3_${field.name}`}
571
+ label={field.label}
572
+ type={
573
+ field.selectOptions
574
+ ? undefined
575
+ : field.type
576
+ }
577
+ fullWidth
578
+ variant="standard"
579
+ required={field.required}
580
+ select={!!field.selectOptions}
581
+ defaultValue={
582
+ field.selectOptions
583
+ ? ducklakeS3Provider
584
+ : undefined
585
+ }
586
+ onChange={
587
+ field.name === "provider"
588
+ ? (e) =>
589
+ setDucklakeS3Provider(
590
+ e.target.value,
591
+ )
592
+ : undefined
593
+ }
594
+ placeholder={
595
+ field.name === "region"
596
+ ? "us-east-1"
597
+ : undefined
598
+ }
599
+ >
600
+ {field.selectOptions?.map(
601
+ (option) => (
602
+ <MenuItem
603
+ key={option.value}
604
+ value={option.value}
605
+ >
606
+ {option.label}
607
+ </MenuItem>
608
+ ),
609
+ )}
610
+ </TextField>
611
+ ))}
505
612
  </>
506
613
  )}
507
614
  {ducklakeStorageType === "gcs" && (
@@ -1,3 +1,6 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
1
4
  import { Delete } from "@mui/icons-material";
2
5
  import CloseIcon from "@mui/icons-material/Close";
3
6
  import { Snackbar } from "@mui/material";
@@ -7,6 +10,9 @@ import DialogActions from "@mui/material/DialogActions";
7
10
  import DialogContent from "@mui/material/DialogContent";
8
11
  import DialogTitle from "@mui/material/DialogTitle";
9
12
  import IconButton from "@mui/material/IconButton";
13
+ import ListItemIcon from "@mui/material/ListItemIcon";
14
+ import ListItemText from "@mui/material/ListItemText";
15
+ import MenuItem from "@mui/material/MenuItem";
10
16
  import Typography from "@mui/material/Typography";
11
17
  import React, { useState } from "react";
12
18
  import { Connection } from "../../client";
@@ -34,14 +40,19 @@ export default function DeleteConnectionDialog({
34
40
 
35
41
  return (
36
42
  <React.Fragment>
37
- <IconButton
43
+ <MenuItem
44
+ aria-label={`Delete connection ${connection?.name ?? ""}`.trim()}
38
45
  onClick={(event) => {
39
46
  event.stopPropagation();
40
47
  handleClickOpen();
41
48
  }}
49
+ sx={{ color: "error.main" }}
42
50
  >
43
- <Delete />
44
- </IconButton>
51
+ <ListItemIcon sx={{ color: "inherit" }}>
52
+ <Delete fontSize="small" />
53
+ </ListItemIcon>
54
+ <ListItemText>Delete</ListItemText>
55
+ </MenuItem>
45
56
 
46
57
  <Dialog
47
58
  onClose={handleClose}