@malloy-publisher/sdk 0.3.1 → 0.4.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 (136) hide show
  1. package/README.md +33 -9
  2. package/dist/{DocumentStorageProvider-tGvodI8f.es.js → DocumentStorage-BiFqO15i.es.js} +7126 -6943
  3. package/dist/DocumentStorage-CMyLifsz.cjs.js +134 -0
  4. package/dist/RenderedResult-CZzE8wv-.cjs.js +115 -0
  5. package/dist/{RenderedResult-mDE-4u8S.es.js → RenderedResult-CvrmYyr5.es.js} +64 -57
  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 +52 -52
  9. package/dist/builder/index.es.js +3961 -3960
  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 +24 -7
  17. package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +12 -10
  18. package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +20 -2
  19. package/dist/components/DashboardBuilder/DashboardEditor.d.ts +21 -11
  20. package/dist/components/DashboardBuilder/newDashboard.d.ts +17 -0
  21. package/dist/components/DashboardBuilder/spliceDocument.d.ts +10 -1
  22. package/dist/components/DocumentStorage/DocumentStorage.d.ts +69 -5
  23. package/dist/components/DocumentStorage/index.d.ts +1 -0
  24. package/dist/components/ItemRow.d.ts +38 -0
  25. package/dist/components/Materializations/MaterializationDetailDialog.d.ts +1 -2
  26. package/dist/components/Materializations/MaterializationRunsList.d.ts +1 -5
  27. package/dist/components/Materializations/Materializations.d.ts +7 -3
  28. package/dist/components/Materializations/ScopeButton.d.ts +18 -0
  29. package/dist/components/Materializations/SectionLabel.d.ts +7 -4
  30. package/dist/components/Materializations/TriggerLabel.d.ts +14 -0
  31. package/dist/components/Materializations/index.d.ts +0 -1
  32. package/dist/components/Package/ContentTypeIcon.d.ts +3 -5
  33. package/dist/components/Package/NewDashboardDialog.d.ts +18 -0
  34. package/dist/components/Package/index.d.ts +0 -1
  35. package/dist/components/PackageSection.d.ts +23 -0
  36. package/dist/components/buttons.d.ts +53 -0
  37. package/dist/components/index.d.ts +5 -0
  38. package/dist/components/styles.d.ts +49 -40
  39. package/dist/hooks/useCrudMutation.d.ts +42 -0
  40. package/dist/index.cjs.js +22 -26
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.es.js +17431 -20676
  43. package/dist/telemetry/consoleEvents.d.ts +60 -0
  44. package/dist/utils/sha256.d.ts +2 -0
  45. package/package.json +1 -1
  46. package/src/components/AppDialog.tsx +115 -0
  47. package/src/components/BackLink.tsx +83 -0
  48. package/src/components/Connections/AddConnectionDialog.tsx +50 -70
  49. package/src/components/Connections/DeleteConnectionDialog.tsx +23 -50
  50. package/src/components/Connections/EditConnectionDialog.tsx +54 -73
  51. package/src/components/Dashboard/DashboardBar.tsx +88 -0
  52. package/src/components/Dashboard/telemetry.ts +24 -5
  53. package/src/components/DashboardBuilder/AddTileDialog.tsx +141 -143
  54. package/src/components/DashboardBuilder/BuilderToolbar.tsx +110 -218
  55. package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +5 -11
  56. package/src/components/DashboardBuilder/DashboardBuilder.tsx +202 -171
  57. package/src/components/DashboardBuilder/DashboardEditor.authoritative.spec.tsx +706 -0
  58. package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +163 -0
  59. package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +2 -25
  60. package/src/components/DashboardBuilder/DashboardEditor.tsx +442 -94
  61. package/src/components/DashboardBuilder/DiffDialog.tsx +75 -82
  62. package/src/components/DashboardBuilder/DrillDialog.tsx +144 -156
  63. package/src/components/DashboardBuilder/FilterDialog.tsx +276 -295
  64. package/src/components/DashboardBuilder/FilterStrip.tsx +11 -10
  65. package/src/components/DashboardBuilder/newDashboard.spec.ts +40 -0
  66. package/src/components/DashboardBuilder/newDashboard.ts +48 -0
  67. package/src/components/DashboardBuilder/spliceDocument.spec.ts +53 -0
  68. package/src/components/DashboardBuilder/spliceDocument.ts +45 -8
  69. package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +56 -0
  70. package/src/components/DashboardBuilder/useDashboardEditor.ts +12 -4
  71. package/src/components/DocumentStorage/BrowserDocumentStorage.ts +7 -6
  72. package/src/components/DocumentStorage/DocumentStorage.ts +78 -5
  73. package/src/components/DocumentStorage/index.ts +1 -0
  74. package/src/components/Environment/About.tsx +14 -28
  75. package/src/components/Environment/AddPackageDialog.tsx +85 -154
  76. package/src/components/Environment/Connections.tsx +125 -205
  77. package/src/components/Environment/DeletePackageDialog.tsx +32 -77
  78. package/src/components/Environment/EditPackageDialog.tsx +46 -58
  79. package/src/components/Environment/Environment.tsx +34 -36
  80. package/src/components/Environment/Packages.tsx +63 -128
  81. package/src/components/Home/AddEnvironmentDialog.tsx +47 -70
  82. package/src/components/Home/DeleteEnvironmentDialog.tsx +32 -77
  83. package/src/components/Home/EditEnvironmentDialog.tsx +47 -61
  84. package/src/components/Home/Home.tsx +101 -214
  85. package/src/components/ItemRow.tsx +165 -0
  86. package/src/components/Materializations/CreateMaterializationDialog.tsx +34 -51
  87. package/src/components/Materializations/DeleteMaterializationDialog.tsx +31 -53
  88. package/src/components/Materializations/MaterializationDetailDialog.tsx +60 -69
  89. package/src/components/Materializations/MaterializationRunsList.tsx +29 -42
  90. package/src/components/Materializations/Materializations.tsx +137 -140
  91. package/src/components/Materializations/ScopeButton.tsx +85 -0
  92. package/src/components/Materializations/SectionLabel.tsx +7 -4
  93. package/src/components/Materializations/SetScheduleDialog.tsx +48 -89
  94. package/src/components/Materializations/TriggerLabel.tsx +36 -0
  95. package/src/components/Materializations/cron.spec.ts +113 -0
  96. package/src/components/Materializations/index.ts +0 -1
  97. package/src/components/Materializations/utils.spec.ts +182 -0
  98. package/src/components/Package/ContentTypeIcon.spec.ts +22 -37
  99. package/src/components/Package/ContentTypeIcon.tsx +10 -12
  100. package/src/components/Package/NewDashboardDialog.spec.tsx +129 -0
  101. package/src/components/Package/NewDashboardDialog.tsx +265 -0
  102. package/src/components/Package/Package.tsx +184 -238
  103. package/src/components/Package/index.ts +0 -1
  104. package/src/components/PackageSection.tsx +85 -0
  105. package/src/components/RenderedResult/RenderedResult.lifecycle.spec.tsx +198 -0
  106. package/src/components/RenderedResult/RenderedResult.tsx +22 -8
  107. package/src/components/ResultsDialog.tsx +8 -32
  108. package/src/components/buttons.tsx +114 -0
  109. package/src/components/designSystem.spec.tsx +316 -0
  110. package/src/components/given/paramCodec.spec.ts +1 -1
  111. package/src/components/index.ts +10 -0
  112. package/src/components/styles.ts +49 -85
  113. package/src/hooks/useCrudMutation.spec.tsx +119 -0
  114. package/src/hooks/useCrudMutation.tsx +85 -0
  115. package/src/index.ts +9 -0
  116. package/src/telemetry/consoleEvents.spec.ts +130 -0
  117. package/src/telemetry/consoleEvents.ts +124 -0
  118. package/src/theme/defaults.ts +34 -23
  119. package/src/theme/resolveTheme.spec.ts +9 -4
  120. package/src/theme/resolveTheme.ts +12 -8
  121. package/src/utils/sha256.ts +13 -0
  122. package/test/README.md +1 -1
  123. package/test/serverProvider.tsx +5 -2
  124. package/dist/DocumentStorageProvider-BeBD0uWc.cjs.js +0 -134
  125. package/dist/RenderedResult-CPi6uQWq.cjs.js +0 -115
  126. package/dist/ServerProvider-CH71GsoL.cjs.js +0 -1
  127. package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +0 -14
  128. package/dist/components/Materializations/EnvironmentMaterializations.d.ts +0 -7
  129. package/dist/components/Materializations/ScheduleCard.d.ts +0 -20
  130. package/dist/components/Materializations/TriggerChip.d.ts +0 -10
  131. package/dist/components/Package/Models.d.ts +0 -6
  132. package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +0 -179
  133. package/src/components/Materializations/EnvironmentMaterializations.tsx +0 -267
  134. package/src/components/Materializations/ScheduleCard.tsx +0 -231
  135. package/src/components/Materializations/TriggerChip.tsx +0 -44
  136. package/src/components/Package/Models.tsx +0 -71
@@ -5,14 +5,10 @@ import AddIcon from "@mui/icons-material/Add";
5
5
  import DeleteIcon from "@mui/icons-material/Delete";
6
6
  import Box from "@mui/material/Box";
7
7
  import Button from "@mui/material/Button";
8
- import Dialog from "@mui/material/Dialog";
9
- import DialogActions from "@mui/material/DialogActions";
10
- import DialogContent from "@mui/material/DialogContent";
11
- import DialogContentText from "@mui/material/DialogContentText";
12
- import DialogTitle from "@mui/material/DialogTitle";
13
8
  import IconButton from "@mui/material/IconButton";
14
9
  import ListItemIcon from "@mui/material/ListItemIcon";
15
10
  import ListItemText from "@mui/material/ListItemText";
11
+ import Stack from "@mui/material/Stack";
16
12
  import TextField from "@mui/material/TextField";
17
13
  import Typography from "@mui/material/Typography";
18
14
  import React, { useState } from "react";
@@ -35,6 +31,8 @@ import {
35
31
  s3AttachedDatabaseFields,
36
32
  uiCreatableConnectionTypes,
37
33
  } from "./common";
34
+ import { AppDialog } from "../AppDialog";
35
+ import { SecondaryButton } from "../buttons";
38
36
 
39
37
  /**
40
38
  * Credential fields the API deliberately never returns, so an edit form can
@@ -520,42 +518,53 @@ export default function EditConnectionDialog({
520
518
  </ListItemIcon>
521
519
  <ListItemText>Edit</ListItemText>
522
520
  </MenuItem>
523
- <Dialog open={open} onClose={handleClose}>
524
- <DialogTitle
525
- onClick={(event) => {
526
- event.stopPropagation();
527
- }}
528
- >
529
- Edit Connection
530
- </DialogTitle>
531
- <DialogContent
532
- onClick={(event) => {
533
- event.stopPropagation();
534
- }}
535
- >
536
- <DialogContentText>
537
- Edit a connection to query your data database using Malloy.
538
- </DialogContentText>
539
- <form onSubmit={handleSubmit} id="connection-form">
521
+ {/* The `Menu` this is rendered inside already stops its own clicks
522
+ reaching the row behind it, so the dialog needs no per-section
523
+ stopPropagation of its own — it had one on each of the title,
524
+ the body and the actions. */}
525
+ <AppDialog
526
+ open={open}
527
+ onClose={handleClose}
528
+ title="Edit connection"
529
+ description="Change how packages in this environment reach your database."
530
+ actions={
531
+ <>
532
+ <Button disabled={isSubmitting} onClick={handleClose}>
533
+ Cancel
534
+ </Button>
535
+ <Button
536
+ type="submit"
537
+ form="connection-form"
538
+ variant="contained"
539
+ loading={isSubmitting}
540
+ >
541
+ Save changes
542
+ </Button>
543
+ </>
544
+ }
545
+ >
546
+ <form onSubmit={handleSubmit} id="connection-form">
547
+ {/* One column, one gap. The fields carry no margin of
548
+ their own, so without this they sit flush and their
549
+ borders overlap. */}
550
+ <Stack sx={{ gap: 2 }}>
540
551
  <TextField
541
552
  autoFocus
542
553
  required
543
- margin="dense"
544
554
  id="name"
545
555
  name="name"
546
- label="Connection Name"
556
+ label="Name"
547
557
  type="text"
548
558
  fullWidth
549
- variant="standard"
559
+ size="small"
550
560
  defaultValue={connection.name}
551
561
  />
552
562
  <TextField
553
- margin="dense"
554
563
  id="type"
555
564
  name="type"
556
565
  label="Connection Type"
557
566
  fullWidth
558
- variant="standard"
567
+ size="small"
559
568
  value={type}
560
569
  select
561
570
  onChange={(event) =>
@@ -587,11 +596,10 @@ export default function EditConnectionDialog({
587
596
  Catalog
588
597
  </Typography>
589
598
  <TextField
590
- margin="dense"
591
599
  id="ducklake_catalogType"
592
600
  label="Catalog Type"
593
601
  fullWidth
594
- variant="standard"
602
+ size="small"
595
603
  value={ducklakeCatalogType}
596
604
  select
597
605
  onChange={(event) =>
@@ -606,13 +614,12 @@ export default function EditConnectionDialog({
606
614
  (field) => (
607
615
  <TextField
608
616
  key={`pg_${field.name}`}
609
- margin="dense"
610
617
  id={`ducklake_pg_${field.name}`}
611
618
  name={`ducklake_pg_${field.name}`}
612
619
  label={field.label}
613
620
  type={field.type}
614
621
  fullWidth
615
- variant="standard"
622
+ size="small"
616
623
  defaultValue={getDucklakeDefault(
617
624
  `pg_${field.name}`,
618
625
  )}
@@ -639,11 +646,10 @@ export default function EditConnectionDialog({
639
646
  Storage
640
647
  </Typography>
641
648
  <TextField
642
- margin="dense"
643
649
  id="ducklake_storageType"
644
650
  label="Storage Type"
645
651
  fullWidth
646
- variant="standard"
652
+ size="small"
647
653
  value={ducklakeStorageType}
648
654
  select
649
655
  onChange={(event) =>
@@ -654,7 +660,6 @@ export default function EditConnectionDialog({
654
660
  <MenuItem value="gcs">GCS</MenuItem>
655
661
  </TextField>
656
662
  <TextField
657
- margin="dense"
658
663
  required
659
664
  id="ducklake_bucketUrl"
660
665
  name="ducklake_bucketUrl"
@@ -665,7 +670,7 @@ export default function EditConnectionDialog({
665
670
  }
666
671
  type="text"
667
672
  fullWidth
668
- variant="standard"
673
+ size="small"
669
674
  defaultValue={getDucklakeDefault("bucketUrl")}
670
675
  />
671
676
  {ducklakeStorageType === "s3" && (
@@ -687,7 +692,6 @@ export default function EditConnectionDialog({
687
692
  .map((field) => (
688
693
  <TextField
689
694
  key={`s3_${field.name}`}
690
- margin="dense"
691
695
  id={`ducklake_s3_${field.name}`}
692
696
  name={`ducklake_s3_${field.name}`}
693
697
  label={field.label}
@@ -697,7 +701,7 @@ export default function EditConnectionDialog({
697
701
  : field.type
698
702
  }
699
703
  fullWidth
700
- variant="standard"
704
+ size="small"
701
705
  required={
702
706
  field.required &&
703
707
  field.name !== "secretAccessKey"
@@ -756,13 +760,12 @@ export default function EditConnectionDialog({
756
760
  {gcsAttachedDatabaseFields.map((field) => (
757
761
  <TextField
758
762
  key={`gcs_${field.name}`}
759
- margin="dense"
760
763
  id={`ducklake_gcs_${field.name}`}
761
764
  name={`ducklake_gcs_${field.name}`}
762
765
  label={field.label}
763
766
  type={field.type}
764
767
  fullWidth
765
- variant="standard"
768
+ size="small"
766
769
  required={
767
770
  field.required &&
768
771
  field.name !== "secret"
@@ -797,14 +800,12 @@ export default function EditConnectionDialog({
797
800
  <Typography variant="subtitle1" fontWeight={500}>
798
801
  Attached Databases
799
802
  </Typography>
800
- <Button
801
- startIcon={<AddIcon />}
803
+ <SecondaryButton
804
+ label="Database"
805
+ icon={<AddIcon />}
802
806
  onClick={addAttachedDatabase}
803
- size="small"
804
- variant="outlined"
805
- >
806
- Add Database
807
- </Button>
807
+ ariaLabel="Add database"
808
+ />
808
809
  </Box>
809
810
  {attachedDatabases.length === 0 && (
810
811
  <Typography
@@ -855,23 +856,21 @@ export default function EditConnectionDialog({
855
856
  </IconButton>
856
857
  </Box>
857
858
  <TextField
858
- margin="dense"
859
859
  required
860
860
  id={`attachedDb_${index}_name`}
861
861
  name={`attachedDb_${index}_name`}
862
862
  label="Database Name"
863
863
  type="text"
864
864
  fullWidth
865
- variant="standard"
865
+ size="small"
866
866
  defaultValue={db.name}
867
867
  />
868
868
  <TextField
869
- margin="dense"
870
869
  id={`attachedDb_${index}_type`}
871
870
  name={`attachedDb_${index}_type`}
872
871
  label="Database Type"
873
872
  fullWidth
874
- variant="standard"
873
+ size="small"
875
874
  value={db.dbType}
876
875
  select
877
876
  onChange={(event) =>
@@ -912,7 +911,6 @@ export default function EditConnectionDialog({
912
911
  .map((field) => (
913
912
  <TextField
914
913
  key={field.name}
915
- margin="dense"
916
914
  id={`attachedDb_${index}_${field.name}`}
917
915
  name={`attachedDb_${index}_${field.name}`}
918
916
  label={field.label}
@@ -922,7 +920,7 @@ export default function EditConnectionDialog({
922
920
  : field.type
923
921
  }
924
922
  fullWidth
925
- variant="standard"
923
+ size="small"
926
924
  required={field.required}
927
925
  select={!!field.selectOptions}
928
926
  defaultValue={
@@ -992,13 +990,12 @@ export default function EditConnectionDialog({
992
990
  return (
993
991
  <TextField
994
992
  key={field.name}
995
- margin="dense"
996
993
  id={field.name}
997
994
  name={field.name}
998
995
  label={field.label}
999
996
  type={field.type}
1000
997
  fullWidth
1001
- variant="standard"
998
+ size="small"
1002
999
  required={
1003
1000
  field.required &&
1004
1001
  !isPasswordField &&
@@ -1021,25 +1018,9 @@ export default function EditConnectionDialog({
1021
1018
  );
1022
1019
  })
1023
1020
  )}
1024
- </form>
1025
- </DialogContent>
1026
- <DialogActions
1027
- onClick={(event) => {
1028
- event.stopPropagation();
1029
- }}
1030
- >
1031
- <Button disabled={isSubmitting} onClick={handleClose}>
1032
- Cancel
1033
- </Button>
1034
- <Button
1035
- type="submit"
1036
- form="connection-form"
1037
- loading={isSubmitting}
1038
- >
1039
- Edit Connection
1040
- </Button>
1041
- </DialogActions>
1042
- </Dialog>
1021
+ </Stack>
1022
+ </form>
1023
+ </AppDialog>
1043
1024
  </React.Fragment>
1044
1025
  );
1045
1026
  }
@@ -0,0 +1,88 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ import { Stack } from "@mui/material";
5
+ import type { ReactNode } from "react";
6
+ import { usePublisherTheme } from "../../theme/ThemeContext";
7
+
8
+ /**
9
+ * The bar above a dashboard, in the one shape both the reader's view and the
10
+ * builder use.
11
+ *
12
+ * Reading and editing are the same page in two states, so the bar that carries
13
+ * the switch is the same bar: same height, same ground, same edge, and the
14
+ * same left and right margins as the dashboard under it — the state on the
15
+ * left, the way out of it on the right. The fixed height is the load-bearing
16
+ * part: it is what makes switching modes move nothing on the page.
17
+ *
18
+ * No horizontal padding of its own: it is laid out inside whatever insets the
19
+ * dashboard, so the left item lines up with the title below it and the right
20
+ * item with the right edge of the grid.
21
+ */
22
+ export function DashboardBar({
23
+ left,
24
+ children,
25
+ }: {
26
+ /** The page's state, at the left edge: a chip, or nothing while reading. */
27
+ left?: ReactNode;
28
+ /** What can be done about it, at the right edge. */
29
+ children?: ReactNode;
30
+ }) {
31
+ const { theme } = usePublisherTheme();
32
+ return (
33
+ <Stack
34
+ direction="row"
35
+ sx={{
36
+ position: "sticky",
37
+ top: 0,
38
+ zIndex: 5,
39
+ alignItems: "center",
40
+ justifyContent: "space-between",
41
+ gap: 1,
42
+ // One height whether or not the bar has anything on the left, so
43
+ // switching modes moves nothing.
44
+ minHeight: 48,
45
+ py: 0.5,
46
+ // The rule is the bar's own edge, not the page's underline: the
47
+ // title below needs room to read as a heading rather than as the
48
+ // bar's caption.
49
+ mb: 3,
50
+ // Its own ground, so the tiles scrolling under it do not show
51
+ // through, and an edge so it reads as a bar rather than a row. The
52
+ // Publisher theme's ground and edge, like every other surface here
53
+ // — MUI's own palette would not follow an instance theme or its
54
+ // dark mode.
55
+ bgcolor: theme.background,
56
+ borderBottom: theme.border,
57
+ }}
58
+ >
59
+ <Stack
60
+ direction="row"
61
+ sx={{
62
+ alignItems: "center",
63
+ gap: 1,
64
+ // The side that gives way: without a zero min-width a hint that
65
+ // will not wrap makes the whole bar wider than the page, and the
66
+ // controls on the right end up past the fold.
67
+ minWidth: 0,
68
+ overflow: "hidden",
69
+ }}
70
+ >
71
+ {left}
72
+ </Stack>
73
+ <Stack
74
+ direction="row"
75
+ sx={{
76
+ alignItems: "center",
77
+ gap: 0.5,
78
+ // A button's label never wraps onto a second line; anything
79
+ // beside them gives way first.
80
+ flexShrink: 0,
81
+ "& .MuiButton-root": { whiteSpace: "nowrap" },
82
+ }}
83
+ >
84
+ {children}
85
+ </Stack>
86
+ </Stack>
87
+ );
88
+ }
@@ -3,8 +3,8 @@
3
3
 
4
4
  /**
5
5
  * What a dashboard surface reports about itself, for the host to log or
6
- * count: the operations that matter (open, save, export, the rows behind a
7
- * value, exploring a tile), each with its outcome and how long it took.
6
+ * count: the operations that matter (open, save, the rows behind a value,
7
+ * exploring a tile), each with its outcome and how long it took.
8
8
  *
9
9
  * Context-free on purpose — the host that mounted the surface knows which
10
10
  * environment, package and dashboard it is, and adds that when it logs.
@@ -12,8 +12,12 @@
12
12
  export type DashboardEvent =
13
13
  | {
14
14
  type: "dashboard.opened";
15
- /** The package file, or a draft the host had saved. */
16
- from: "package" | "draft";
15
+ /**
16
+ * The package file, a draft the host had saved beside it, or the
17
+ * host's own copy when that copy is the record. A record open is not a
18
+ * "draft" open: nothing was resumed and nothing is pending.
19
+ */
20
+ from: "package" | "draft" | "record";
17
21
  tiles: number;
18
22
  durationMs: number;
19
23
  }
@@ -23,10 +27,25 @@ export type DashboardEvent =
23
27
  tiles: number;
24
28
  /** Whether a tile was added or removed, which moves declarations. */
25
29
  structural: boolean;
30
+ /**
31
+ * Where it went, named by which storage took the write rather than by
32
+ * where that storage happens to keep things, since "browser" and
33
+ * "host" do not divide by English: `package` is the package file on
34
+ * the server, `browser` is the Console's own browser store, and `host`
35
+ * is a host storage that holds the record.
36
+ *
37
+ * Separate because they are not the same event. A save into the
38
+ * package or the record is a change every reader sees; a browser save
39
+ * is one person's copy on one machine. Counting them together makes
40
+ * "dashboards are being edited" unreadable, because a read-only server
41
+ * reports exactly as much saving as a writable one.
42
+ */
43
+ where: "package" | "browser" | "host";
44
+ /** The workspace that took the write, so the event says so itself. */
45
+ workspace?: string;
26
46
  durationMs: number;
27
47
  }
28
48
  | { type: "dashboard.save_refused"; reason: string }
29
- | { type: "dashboard.exported"; bytes: number }
30
49
  | {
31
50
  type: "dashboard.rows_shown";
32
51
  source: string;