@malloy-publisher/sdk 0.3.1 → 0.4.0

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 (129) hide show
  1. package/README.md +14 -9
  2. package/dist/{DocumentStorageProvider-tGvodI8f.es.js → DocumentStorageProvider-CyOJ0hqf.es.js} +7114 -6939
  3. package/dist/DocumentStorageProvider-DGPQEd_l.cjs.js +134 -0
  4. package/dist/{RenderedResult-mDE-4u8S.es.js → RenderedResult-BnPzJ9Jf.es.js} +64 -57
  5. package/dist/{RenderedResult-CPi6uQWq.cjs.js → RenderedResult-Dp22kZsQ.cjs.js} +2 -2
  6. package/dist/{ServerProvider-X2Ma0HRs.es.js → ServerProvider-BWOEKg0O.es.js} +1217 -1244
  7. package/dist/ServerProvider-Cc489A3f.cjs.js +1 -0
  8. package/dist/builder/index.cjs.js +41 -41
  9. package/dist/builder/index.es.js +2752 -2831
  10. package/dist/client/api.d.ts +100 -42
  11. package/dist/client/index.cjs.js +1 -1
  12. package/dist/client/index.es.js +1 -1
  13. package/dist/components/AppDialog.d.ts +30 -0
  14. package/dist/components/BackLink.d.ts +32 -0
  15. package/dist/components/Dashboard/DashboardBar.d.ts +21 -0
  16. package/dist/components/Dashboard/telemetry.d.ts +10 -5
  17. package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +12 -10
  18. package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +8 -2
  19. package/dist/components/DashboardBuilder/DashboardEditor.d.ts +8 -10
  20. package/dist/components/DashboardBuilder/newDashboard.d.ts +17 -0
  21. package/dist/components/DashboardBuilder/spliceDocument.d.ts +10 -1
  22. package/dist/components/ItemRow.d.ts +38 -0
  23. package/dist/components/Materializations/MaterializationDetailDialog.d.ts +1 -2
  24. package/dist/components/Materializations/MaterializationRunsList.d.ts +1 -5
  25. package/dist/components/Materializations/Materializations.d.ts +7 -3
  26. package/dist/components/Materializations/ScopeButton.d.ts +18 -0
  27. package/dist/components/Materializations/SectionLabel.d.ts +7 -4
  28. package/dist/components/Materializations/TriggerLabel.d.ts +14 -0
  29. package/dist/components/Materializations/index.d.ts +0 -1
  30. package/dist/components/Package/ContentTypeIcon.d.ts +3 -5
  31. package/dist/components/Package/NewDashboardDialog.d.ts +18 -0
  32. package/dist/components/Package/index.d.ts +0 -1
  33. package/dist/components/PackageSection.d.ts +23 -0
  34. package/dist/components/buttons.d.ts +53 -0
  35. package/dist/components/index.d.ts +5 -0
  36. package/dist/components/styles.d.ts +49 -40
  37. package/dist/hooks/useCrudMutation.d.ts +42 -0
  38. package/dist/index.cjs.js +22 -26
  39. package/dist/index.d.ts +1 -0
  40. package/dist/index.es.js +17425 -20672
  41. package/dist/telemetry/consoleEvents.d.ts +60 -0
  42. package/dist/utils/sha256.d.ts +2 -0
  43. package/package.json +1 -1
  44. package/src/components/AppDialog.tsx +115 -0
  45. package/src/components/BackLink.tsx +83 -0
  46. package/src/components/Connections/AddConnectionDialog.tsx +50 -70
  47. package/src/components/Connections/DeleteConnectionDialog.tsx +23 -50
  48. package/src/components/Connections/EditConnectionDialog.tsx +54 -73
  49. package/src/components/Dashboard/DashboardBar.tsx +88 -0
  50. package/src/components/Dashboard/telemetry.ts +10 -3
  51. package/src/components/DashboardBuilder/AddTileDialog.tsx +141 -143
  52. package/src/components/DashboardBuilder/BuilderToolbar.tsx +110 -218
  53. package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +5 -11
  54. package/src/components/DashboardBuilder/DashboardBuilder.tsx +184 -171
  55. package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +163 -0
  56. package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +2 -25
  57. package/src/components/DashboardBuilder/DashboardEditor.tsx +135 -61
  58. package/src/components/DashboardBuilder/DiffDialog.tsx +75 -82
  59. package/src/components/DashboardBuilder/DrillDialog.tsx +144 -156
  60. package/src/components/DashboardBuilder/FilterDialog.tsx +276 -295
  61. package/src/components/DashboardBuilder/FilterStrip.tsx +11 -10
  62. package/src/components/DashboardBuilder/newDashboard.spec.ts +40 -0
  63. package/src/components/DashboardBuilder/newDashboard.ts +48 -0
  64. package/src/components/DashboardBuilder/spliceDocument.spec.ts +53 -0
  65. package/src/components/DashboardBuilder/spliceDocument.ts +45 -8
  66. package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +56 -0
  67. package/src/components/DashboardBuilder/useDashboardEditor.ts +12 -4
  68. package/src/components/Environment/About.tsx +14 -28
  69. package/src/components/Environment/AddPackageDialog.tsx +85 -154
  70. package/src/components/Environment/Connections.tsx +125 -205
  71. package/src/components/Environment/DeletePackageDialog.tsx +32 -77
  72. package/src/components/Environment/EditPackageDialog.tsx +46 -58
  73. package/src/components/Environment/Environment.tsx +34 -36
  74. package/src/components/Environment/Packages.tsx +63 -128
  75. package/src/components/Home/AddEnvironmentDialog.tsx +47 -70
  76. package/src/components/Home/DeleteEnvironmentDialog.tsx +32 -77
  77. package/src/components/Home/EditEnvironmentDialog.tsx +47 -61
  78. package/src/components/Home/Home.tsx +101 -214
  79. package/src/components/ItemRow.tsx +165 -0
  80. package/src/components/Materializations/CreateMaterializationDialog.tsx +34 -51
  81. package/src/components/Materializations/DeleteMaterializationDialog.tsx +31 -53
  82. package/src/components/Materializations/MaterializationDetailDialog.tsx +60 -69
  83. package/src/components/Materializations/MaterializationRunsList.tsx +29 -42
  84. package/src/components/Materializations/Materializations.tsx +137 -140
  85. package/src/components/Materializations/ScopeButton.tsx +85 -0
  86. package/src/components/Materializations/SectionLabel.tsx +7 -4
  87. package/src/components/Materializations/SetScheduleDialog.tsx +48 -89
  88. package/src/components/Materializations/TriggerLabel.tsx +36 -0
  89. package/src/components/Materializations/cron.spec.ts +113 -0
  90. package/src/components/Materializations/index.ts +0 -1
  91. package/src/components/Materializations/utils.spec.ts +182 -0
  92. package/src/components/Package/ContentTypeIcon.spec.ts +22 -37
  93. package/src/components/Package/ContentTypeIcon.tsx +10 -12
  94. package/src/components/Package/NewDashboardDialog.spec.tsx +129 -0
  95. package/src/components/Package/NewDashboardDialog.tsx +265 -0
  96. package/src/components/Package/Package.tsx +179 -238
  97. package/src/components/Package/index.ts +0 -1
  98. package/src/components/PackageSection.tsx +85 -0
  99. package/src/components/RenderedResult/RenderedResult.lifecycle.spec.tsx +198 -0
  100. package/src/components/RenderedResult/RenderedResult.tsx +22 -8
  101. package/src/components/ResultsDialog.tsx +8 -32
  102. package/src/components/buttons.tsx +114 -0
  103. package/src/components/designSystem.spec.tsx +316 -0
  104. package/src/components/given/paramCodec.spec.ts +1 -1
  105. package/src/components/index.ts +10 -0
  106. package/src/components/styles.ts +49 -85
  107. package/src/hooks/useCrudMutation.spec.tsx +119 -0
  108. package/src/hooks/useCrudMutation.tsx +85 -0
  109. package/src/index.ts +9 -0
  110. package/src/telemetry/consoleEvents.spec.ts +130 -0
  111. package/src/telemetry/consoleEvents.ts +124 -0
  112. package/src/theme/defaults.ts +34 -23
  113. package/src/theme/resolveTheme.spec.ts +9 -4
  114. package/src/theme/resolveTheme.ts +12 -8
  115. package/src/utils/sha256.ts +13 -0
  116. package/test/README.md +1 -1
  117. package/test/serverProvider.tsx +5 -2
  118. package/dist/DocumentStorageProvider-BeBD0uWc.cjs.js +0 -134
  119. package/dist/ServerProvider-CH71GsoL.cjs.js +0 -1
  120. package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +0 -14
  121. package/dist/components/Materializations/EnvironmentMaterializations.d.ts +0 -7
  122. package/dist/components/Materializations/ScheduleCard.d.ts +0 -20
  123. package/dist/components/Materializations/TriggerChip.d.ts +0 -10
  124. package/dist/components/Package/Models.d.ts +0 -6
  125. package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +0 -179
  126. package/src/components/Materializations/EnvironmentMaterializations.tsx +0 -267
  127. package/src/components/Materializations/ScheduleCard.tsx +0 -231
  128. package/src/components/Materializations/TriggerChip.tsx +0 -44
  129. package/src/components/Package/Models.tsx +0 -71
@@ -5,10 +5,6 @@ import {
5
5
  Box,
6
6
  Button,
7
7
  Chip,
8
- Dialog,
9
- DialogActions,
10
- DialogContent,
11
- DialogTitle,
12
8
  List,
13
9
  ListItemButton,
14
10
  ListItemText,
@@ -21,6 +17,7 @@ import { useEffect, useMemo, useState } from "react";
21
17
  import { usePublisherTheme } from "../../theme/ThemeContext";
22
18
  import type { CatalogSource, PackageCatalog } from "./catalog";
23
19
  import type { DashboardDocument } from "./document";
20
+ import { AppDialog } from "../AppDialog";
24
21
 
25
22
  /**
26
23
  * What a new tile is: a view, picked from the package, on a source this file
@@ -102,148 +99,149 @@ export function AddTileDialog({
102
99
  const canAdd = base !== "" && view !== "";
103
100
 
104
101
  return (
105
- <Dialog open={open} onClose={onClose} maxWidth="sm" fullWidth>
106
- <DialogTitle sx={{ pb: 0.5 }}>Add a tile</DialogTitle>
107
- <DialogContent>
108
- <Stack sx={{ gap: 2, pt: 1 }}>
109
- {sources.length === 0 ? (
110
- <Typography variant="body2" sx={{ color: theme.tileTitle }}>
111
- {catalog
112
- ? "This dashboard imports no source by name, so there is nothing to put a tile on. Import a source in the file first."
113
- : "The package's sources are still loading."}
114
- </Typography>
115
- ) : (
116
- <>
117
- <TextField
118
- select
119
- size="small"
120
- label="Source"
121
- value={base}
122
- onChange={(event) => {
123
- setBase(event.target.value);
124
- setView("");
125
- }}
126
- inputProps={{ "aria-label": "Source" }}
127
- >
128
- {sources.map((s) => (
129
- <MenuItem key={s.name} value={s.name}>
130
- {s.name}
131
- {s.description && (
132
- <Typography
133
- component="span"
134
- variant="caption"
135
- sx={{ ml: 1, opacity: 0.6 }}
136
- >
137
- {s.description}
138
- </Typography>
139
- )}
140
- </MenuItem>
141
- ))}
142
- </TextField>
143
- <Box>
144
- <Typography variant="subtitle2" sx={{ mb: 0.5 }}>
145
- View
146
- </Typography>
147
- <List
148
- dense
149
- disablePadding
150
- aria-label="Views"
151
- sx={{
152
- maxHeight: 280,
153
- overflowY: "auto",
154
- border: theme.border,
155
- borderRadius: 1,
156
- }}
157
- >
158
- {(source?.views ?? []).map((v) => (
159
- <ListItemButton
160
- key={v.name}
161
- selected={view === v.name}
162
- onClick={() => setView(v.name)}
163
- aria-label={`View ${v.name}`}
164
- >
165
- <ListItemText
166
- primary={v.name}
167
- secondary={v.description}
168
- primaryTypographyProps={{
169
- fontFamily: "ui-monospace, monospace",
170
- fontSize: 13,
171
- }}
172
- />
173
- {v.chart && (
174
- <Chip
175
- size="small"
176
- variant="outlined"
177
- label={v.chart.replace(/_chart$/, "")}
178
- />
179
- )}
180
- </ListItemButton>
181
- ))}
182
- {source && source.views.length === 0 && (
102
+ <AppDialog
103
+ open={open}
104
+ onClose={onClose}
105
+ title="Add a tile"
106
+ description="A tile shows one view of one source this dashboard imports."
107
+ actions={
108
+ <>
109
+ <Button onClick={onClose}>Cancel</Button>
110
+ <Button
111
+ variant="contained"
112
+ disabled={!canAdd}
113
+ onClick={() =>
114
+ onAdd({
115
+ base,
116
+ view,
117
+ ...(label.trim() ? { label: label.trim() } : {}),
118
+ colspan,
119
+ })
120
+ }
121
+ >
122
+ Add tile
123
+ </Button>
124
+ </>
125
+ }
126
+ >
127
+ <Stack sx={{ gap: 2, pt: 1 }}>
128
+ {sources.length === 0 ? (
129
+ <Typography variant="body2" sx={{ color: theme.tileTitle }}>
130
+ {catalog
131
+ ? "This dashboard imports no source by name, so there is nothing to put a tile on. Import a source in the file first."
132
+ : "The package's sources are still loading."}
133
+ </Typography>
134
+ ) : (
135
+ <>
136
+ <TextField
137
+ select
138
+ size="small"
139
+ label="Source"
140
+ value={base}
141
+ onChange={(event) => {
142
+ setBase(event.target.value);
143
+ setView("");
144
+ }}
145
+ inputProps={{ "aria-label": "Source" }}
146
+ >
147
+ {sources.map((s) => (
148
+ <MenuItem key={s.name} value={s.name}>
149
+ {s.name}
150
+ {s.description && (
183
151
  <Typography
184
- variant="body2"
185
- sx={{ p: 1.5, color: theme.tileTitle }}
152
+ component="span"
153
+ variant="caption"
154
+ sx={{ ml: 1, opacity: 0.6 }}
186
155
  >
187
- This source declares no views.
156
+ {s.description}
188
157
  </Typography>
189
158
  )}
190
- </List>
191
- </Box>
192
- <Stack direction="row" sx={{ gap: 1.5 }}>
193
- <TextField
194
- size="small"
195
- label="Title"
196
- placeholder="Uses the view's name"
197
- value={label}
198
- onChange={(event) => setLabel(event.target.value)}
199
- inputProps={{ "aria-label": "Tile title" }}
200
- sx={{ flex: 1 }}
201
- />
202
- <TextField
203
- size="small"
204
- type="number"
205
- label={`Width (of ${columns})`}
206
- value={colspan}
207
- onChange={(event) =>
208
- setColspan(
209
- Math.min(
210
- Math.max(
211
- Number(event.target.value) || 1,
212
- 1,
213
- ),
214
- columns,
215
- ),
216
- )
217
- }
218
- inputProps={{
219
- min: 1,
220
- max: columns,
221
- "aria-label": "Tile width",
222
- }}
223
- sx={{ width: 140 }}
224
- />
225
- </Stack>
226
- </>
227
- )}
228
- </Stack>
229
- </DialogContent>
230
- <DialogActions sx={{ px: 3, py: 1.5 }}>
231
- <Button onClick={onClose}>Cancel</Button>
232
- <Button
233
- variant="contained"
234
- disabled={!canAdd}
235
- onClick={() =>
236
- onAdd({
237
- base,
238
- view,
239
- ...(label.trim() ? { label: label.trim() } : {}),
240
- colspan,
241
- })
242
- }
243
- >
244
- Add tile
245
- </Button>
246
- </DialogActions>
247
- </Dialog>
159
+ </MenuItem>
160
+ ))}
161
+ </TextField>
162
+ <Box>
163
+ <Typography variant="subtitle2" sx={{ mb: 0.5 }}>
164
+ View
165
+ </Typography>
166
+ <List
167
+ dense
168
+ disablePadding
169
+ aria-label="Views"
170
+ sx={{
171
+ maxHeight: 280,
172
+ overflowY: "auto",
173
+ border: theme.border,
174
+ borderRadius: 1,
175
+ }}
176
+ >
177
+ {(source?.views ?? []).map((v) => (
178
+ <ListItemButton
179
+ key={v.name}
180
+ selected={view === v.name}
181
+ onClick={() => setView(v.name)}
182
+ aria-label={`View ${v.name}`}
183
+ >
184
+ <ListItemText
185
+ primary={v.name}
186
+ secondary={v.description}
187
+ primaryTypographyProps={{
188
+ fontFamily: "ui-monospace, monospace",
189
+ fontSize: 13,
190
+ }}
191
+ />
192
+ {v.chart && (
193
+ <Chip
194
+ size="small"
195
+ variant="outlined"
196
+ label={v.chart.replace(/_chart$/, "")}
197
+ />
198
+ )}
199
+ </ListItemButton>
200
+ ))}
201
+ {source && source.views.length === 0 && (
202
+ <Typography
203
+ variant="body2"
204
+ sx={{ p: 1.5, color: theme.tileTitle }}
205
+ >
206
+ This source declares no views.
207
+ </Typography>
208
+ )}
209
+ </List>
210
+ </Box>
211
+ <Stack direction="row" sx={{ gap: 1.5 }}>
212
+ <TextField
213
+ size="small"
214
+ label="Title"
215
+ placeholder="Uses the view's name"
216
+ value={label}
217
+ onChange={(event) => setLabel(event.target.value)}
218
+ inputProps={{ "aria-label": "Tile title" }}
219
+ sx={{ flex: 1 }}
220
+ />
221
+ <TextField
222
+ size="small"
223
+ type="number"
224
+ label={`Width (of ${columns})`}
225
+ value={colspan}
226
+ onChange={(event) =>
227
+ setColspan(
228
+ Math.min(
229
+ Math.max(Number(event.target.value) || 1, 1),
230
+ columns,
231
+ ),
232
+ )
233
+ }
234
+ inputProps={{
235
+ min: 1,
236
+ max: columns,
237
+ "aria-label": "Tile width",
238
+ }}
239
+ sx={{ width: 140 }}
240
+ />
241
+ </Stack>
242
+ </>
243
+ )}
244
+ </Stack>
245
+ </AppDialog>
248
246
  );
249
247
  }