@malloy-publisher/sdk 0.13.1 → 0.15.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.
- package/dist/{RenderedResult-C4rimzu4.cjs.js → RenderedResult-B2VzqpJV.cjs.js} +1 -1
- package/dist/{RenderedResult-D5HJr2Xo.es.js → RenderedResult-Ct3z543g.es.js} +9 -9
- package/dist/{ServerProvider-8Eul_YOl.es.js → ServerProvider-Be9eusDF.es.js} +1076 -993
- package/dist/ServerProvider-DDr5VOVF.cjs.js +1 -0
- package/dist/builder/index.cjs.js +1 -1
- package/dist/builder/index.es.js +335 -335
- package/dist/client/api.d.ts +261 -82
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +110 -104
- package/dist/components/Materializations/DeleteMaterializationDialog.d.ts +1 -1
- package/dist/components/Materializations/MaterializationRunsList.d.ts +1 -1
- package/dist/components/Materializations/utils.d.ts +28 -6
- package/dist/components/Package/PackageProblems.d.ts +6 -0
- package/dist/index.cjs.js +36 -36
- package/dist/index.es.js +7045 -7521
- package/dist/{useCompiledDocument-UADoxvYb.cjs.js → useCompiledDocument-CQG6VO-x.cjs.js} +20 -20
- package/dist/{useCompiledDocument-CwMwrEXo.es.js → useCompiledDocument-CuSAYHX_.es.js} +56 -60
- package/package.json +1 -1
- package/src/components/Materializations/DeleteMaterializationDialog.tsx +5 -16
- package/src/components/Materializations/MaterializationDetailDialog.tsx +4 -4
- package/src/components/Materializations/MaterializationRunsList.tsx +8 -10
- package/src/components/Materializations/Materializations.tsx +3 -13
- package/src/components/Materializations/Materializations.versions.spec.tsx +6 -3
- package/src/components/Materializations/TriggerLabel.tsx +2 -2
- package/src/components/Materializations/utils.spec.ts +29 -1
- package/src/components/Materializations/utils.ts +48 -7
- package/src/components/Package/PackageProblems.spec.tsx +25 -1
- package/src/components/Package/PackageProblems.tsx +32 -2
- package/dist/ServerProvider-Cvllj0GN.cjs.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as S, jsxs as re, Fragment as Bt } from "react/jsx-runtime";
|
|
2
2
|
import { Box as be, Dialog as Ed, DialogTitle as Od, IconButton as Qn, DialogContent as Ad, Typography as Ge, Stack as wt, DialogActions as Fd, Button as st, Tooltip as wn, TextField as Vn, InputAdornment as Wl, Alert as Ld, Autocomplete as Nd, CircularProgress as Hl, FormControl as Ki, Slider as Bd, FormHelperText as Xi, FormControlLabel as Vd, Checkbox as zd, Paper as ni, MenuItem as An, ButtonBase as Ul, Popover as _d, LinearProgress as Wd } from "@mui/material";
|
|
3
|
-
import {
|
|
3
|
+
import { bB as Ke, bG as Zn, bH as Hd, bC as Jn, bA as Yl, bW as Ud } from "./ServerProvider-Be9eusDF.es.js";
|
|
4
4
|
import * as x from "react";
|
|
5
5
|
import xt, { useState as Oe, useEffect as He, useRef as Ye, useId as jl, useMemo as Ve, useCallback as et, createContext as Fo, useContext as er, isValidElement as co, cloneElement as uo, Children as Yd, Suspense as jd, lazy as Gd } from "react";
|
|
6
6
|
import { useQueries as Gl, QueryClientContext as qd, useQuery as Kd, useMutation as Xd, keepPreviousData as Qd } from "@tanstack/react-query";
|
|
@@ -23485,7 +23485,7 @@ function mk(e) {
|
|
|
23485
23485
|
`)
|
|
23486
23486
|
};
|
|
23487
23487
|
}
|
|
23488
|
-
const gk = Gd(() => import("./RenderedResult-
|
|
23488
|
+
const gk = Gd(() => import("./RenderedResult-Ct3z543g.es.js").then((e) => e.c));
|
|
23489
23489
|
function yk({
|
|
23490
23490
|
result: e,
|
|
23491
23491
|
maxHeight: t,
|
|
@@ -25179,7 +25179,7 @@ export {
|
|
|
25179
25179
|
Bc as by,
|
|
25180
25180
|
KD as bz,
|
|
25181
25181
|
dk as c,
|
|
25182
|
-
|
|
25182
|
+
dd as c$,
|
|
25183
25183
|
BD as c0,
|
|
25184
25184
|
qe as c1,
|
|
25185
25185
|
Or as c2,
|
|
@@ -25190,33 +25190,33 @@ export {
|
|
|
25190
25190
|
Yk as c7,
|
|
25191
25191
|
Ft as c8,
|
|
25192
25192
|
Ht as c9,
|
|
25193
|
-
|
|
25194
|
-
|
|
25195
|
-
|
|
25196
|
-
|
|
25197
|
-
|
|
25198
|
-
|
|
25199
|
-
|
|
25200
|
-
|
|
25201
|
-
|
|
25202
|
-
|
|
25203
|
-
|
|
25204
|
-
|
|
25205
|
-
|
|
25206
|
-
|
|
25207
|
-
|
|
25208
|
-
|
|
25209
|
-
|
|
25210
|
-
|
|
25211
|
-
|
|
25212
|
-
|
|
25213
|
-
|
|
25214
|
-
|
|
25215
|
-
|
|
25216
|
-
|
|
25217
|
-
|
|
25218
|
-
|
|
25219
|
-
|
|
25193
|
+
Lg as cA,
|
|
25194
|
+
LD as cB,
|
|
25195
|
+
xd as cC,
|
|
25196
|
+
yk as cD,
|
|
25197
|
+
AD as cE,
|
|
25198
|
+
FD as cF,
|
|
25199
|
+
Dg as cG,
|
|
25200
|
+
bD as cH,
|
|
25201
|
+
fk as cI,
|
|
25202
|
+
wm as cJ,
|
|
25203
|
+
yD as cK,
|
|
25204
|
+
oT as cL,
|
|
25205
|
+
ID as cM,
|
|
25206
|
+
eg as cN,
|
|
25207
|
+
uM as cO,
|
|
25208
|
+
Ls as cP,
|
|
25209
|
+
qD as cQ,
|
|
25210
|
+
kk as cR,
|
|
25211
|
+
lM as cS,
|
|
25212
|
+
Dk as cT,
|
|
25213
|
+
Zk as cU,
|
|
25214
|
+
Wm as cV,
|
|
25215
|
+
gD as cW,
|
|
25216
|
+
Cs as cX,
|
|
25217
|
+
EP as cY,
|
|
25218
|
+
Tk as cZ,
|
|
25219
|
+
yT as c_,
|
|
25220
25220
|
wa as ca,
|
|
25221
25221
|
yw as cb,
|
|
25222
25222
|
S0 as cc,
|
|
@@ -25239,37 +25239,33 @@ export {
|
|
|
25239
25239
|
WM as ct,
|
|
25240
25240
|
rn as cu,
|
|
25241
25241
|
ei as cv,
|
|
25242
|
-
|
|
25243
|
-
|
|
25244
|
-
|
|
25245
|
-
|
|
25242
|
+
pk as cw,
|
|
25243
|
+
ud as cx,
|
|
25244
|
+
HD as cy,
|
|
25245
|
+
OP as cz,
|
|
25246
25246
|
QD as d,
|
|
25247
|
-
|
|
25248
|
-
|
|
25249
|
-
|
|
25250
|
-
|
|
25251
|
-
|
|
25252
|
-
|
|
25253
|
-
|
|
25254
|
-
|
|
25255
|
-
|
|
25256
|
-
|
|
25257
|
-
|
|
25258
|
-
|
|
25259
|
-
|
|
25260
|
-
|
|
25261
|
-
|
|
25262
|
-
|
|
25263
|
-
|
|
25264
|
-
|
|
25265
|
-
|
|
25266
|
-
|
|
25267
|
-
|
|
25268
|
-
|
|
25269
|
-
XD as dm,
|
|
25270
|
-
bT as dn,
|
|
25271
|
-
vg as dp,
|
|
25272
|
-
cm as dq,
|
|
25247
|
+
Em as d0,
|
|
25248
|
+
Mk as d1,
|
|
25249
|
+
Tg as d2,
|
|
25250
|
+
_k as d3,
|
|
25251
|
+
Wk as d4,
|
|
25252
|
+
bc as d5,
|
|
25253
|
+
Ak as d6,
|
|
25254
|
+
wk as d7,
|
|
25255
|
+
$m as d8,
|
|
25256
|
+
TD as d9,
|
|
25257
|
+
bg as da,
|
|
25258
|
+
Om as db,
|
|
25259
|
+
Rk as dc,
|
|
25260
|
+
wd as dd,
|
|
25261
|
+
Un as de,
|
|
25262
|
+
yM as df,
|
|
25263
|
+
Pk as dg,
|
|
25264
|
+
Pa as dh,
|
|
25265
|
+
XD as di,
|
|
25266
|
+
bT as dj,
|
|
25267
|
+
vg as dk,
|
|
25268
|
+
cm as dl,
|
|
25273
25269
|
fD as e,
|
|
25274
25270
|
Tm as f,
|
|
25275
25271
|
hD as g,
|
package/package.json
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
import { Delete } from "@mui/icons-material";
|
|
5
5
|
import Button from "@mui/material/Button";
|
|
6
|
-
import Checkbox from "@mui/material/Checkbox";
|
|
7
|
-
import FormControlLabel from "@mui/material/FormControlLabel";
|
|
8
6
|
import ListItemIcon from "@mui/material/ListItemIcon";
|
|
9
7
|
import ListItemText from "@mui/material/ListItemText";
|
|
10
8
|
import MenuItem from "@mui/material/MenuItem";
|
|
@@ -22,15 +20,13 @@ export default function DeleteMaterializationDialog({
|
|
|
22
20
|
materialization: Materialization;
|
|
23
21
|
onCloseDialog: () => void;
|
|
24
22
|
isMutating: boolean;
|
|
25
|
-
onDelete: (
|
|
23
|
+
onDelete: () => void;
|
|
26
24
|
}) {
|
|
27
25
|
const [open, setOpen] = useState(false);
|
|
28
|
-
const [dropTables, setDropTables] = useState(false);
|
|
29
26
|
|
|
30
27
|
const handleClickOpen = () => setOpen(true);
|
|
31
28
|
const handleClose = () => {
|
|
32
29
|
setOpen(false);
|
|
33
|
-
setDropTables(false);
|
|
34
30
|
onCloseDialog();
|
|
35
31
|
};
|
|
36
32
|
|
|
@@ -61,7 +57,7 @@ export default function DeleteMaterializationDialog({
|
|
|
61
57
|
variant="contained"
|
|
62
58
|
color="error"
|
|
63
59
|
autoFocus
|
|
64
|
-
onClick={() => onDelete(
|
|
60
|
+
onClick={() => onDelete()}
|
|
65
61
|
loading={isMutating}
|
|
66
62
|
>
|
|
67
63
|
Delete run
|
|
@@ -70,17 +66,10 @@ export default function DeleteMaterializationDialog({
|
|
|
70
66
|
}
|
|
71
67
|
>
|
|
72
68
|
<Typography variant="body2">
|
|
73
|
-
Delete this run's record? This cannot be undone.
|
|
69
|
+
Delete this run's record? This cannot be undone. The tables
|
|
70
|
+
it built stay in place: drop any you no longer need through their
|
|
71
|
+
connection.
|
|
74
72
|
</Typography>
|
|
75
|
-
<FormControlLabel
|
|
76
|
-
control={
|
|
77
|
-
<Checkbox
|
|
78
|
-
checked={dropTables}
|
|
79
|
-
onChange={(event) => setDropTables(event.target.checked)}
|
|
80
|
-
/>
|
|
81
|
-
}
|
|
82
|
-
label="Also drop the materialized tables this run produced"
|
|
83
|
-
/>
|
|
84
73
|
</AppDialog>
|
|
85
74
|
</React.Fragment>
|
|
86
75
|
);
|
|
@@ -30,8 +30,8 @@ import {
|
|
|
30
30
|
parseMetadata,
|
|
31
31
|
refusedSourcesOf,
|
|
32
32
|
sourcesSummary,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
runColor,
|
|
34
|
+
runLabel,
|
|
35
35
|
} from "./utils";
|
|
36
36
|
|
|
37
37
|
/**
|
|
@@ -86,8 +86,8 @@ export default function MaterializationDetailDialog({
|
|
|
86
86
|
>
|
|
87
87
|
<Chip
|
|
88
88
|
size="small"
|
|
89
|
-
label={
|
|
90
|
-
color={
|
|
89
|
+
label={runLabel(materialization)}
|
|
90
|
+
color={runColor(materialization)}
|
|
91
91
|
variant={
|
|
92
92
|
isActiveStatus(materialization.status)
|
|
93
93
|
? "filled"
|
|
@@ -30,8 +30,8 @@ import {
|
|
|
30
30
|
isTerminalStatus,
|
|
31
31
|
parseMetadata,
|
|
32
32
|
sourcesSummary,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
runColor,
|
|
34
|
+
runLabel,
|
|
35
35
|
} from "./utils";
|
|
36
36
|
|
|
37
37
|
type MaterializationRunsListProps = {
|
|
@@ -39,7 +39,7 @@ type MaterializationRunsListProps = {
|
|
|
39
39
|
mutable: boolean;
|
|
40
40
|
isMutating: boolean;
|
|
41
41
|
onStop: (materialization: Materialization) => void;
|
|
42
|
-
onDelete: (materialization: Materialization
|
|
42
|
+
onDelete: (materialization: Materialization) => void;
|
|
43
43
|
onViewDetails: (materialization: Materialization) => void;
|
|
44
44
|
};
|
|
45
45
|
|
|
@@ -115,7 +115,7 @@ function MaterializationRow({
|
|
|
115
115
|
mutable: boolean;
|
|
116
116
|
isMutating: boolean;
|
|
117
117
|
onStop: (materialization: Materialization) => void;
|
|
118
|
-
onDelete: (materialization: Materialization
|
|
118
|
+
onDelete: (materialization: Materialization) => void;
|
|
119
119
|
onViewDetails: (materialization: Materialization) => void;
|
|
120
120
|
}) {
|
|
121
121
|
const [menuAnchorEl, setMenuAnchorEl] = useState<null | HTMLElement>(null);
|
|
@@ -164,12 +164,12 @@ function MaterializationRow({
|
|
|
164
164
|
sx={{
|
|
165
165
|
fontWeight: 500,
|
|
166
166
|
color:
|
|
167
|
-
|
|
167
|
+
runColor(materialization) === "default"
|
|
168
168
|
? "text.primary"
|
|
169
|
-
: `${
|
|
169
|
+
: `${runColor(materialization)}.main`,
|
|
170
170
|
}}
|
|
171
171
|
>
|
|
172
|
-
{
|
|
172
|
+
{runLabel(materialization)}
|
|
173
173
|
</Typography>
|
|
174
174
|
{error && (
|
|
175
175
|
<Tooltip title={error}>
|
|
@@ -230,9 +230,7 @@ function MaterializationRow({
|
|
|
230
230
|
materialization={materialization}
|
|
231
231
|
isMutating={isMutating}
|
|
232
232
|
onCloseDialog={handleMenuClose}
|
|
233
|
-
onDelete={(
|
|
234
|
-
onDelete(materialization, dropTables)
|
|
235
|
-
}
|
|
233
|
+
onDelete={() => onDelete(materialization)}
|
|
236
234
|
/>
|
|
237
235
|
)}
|
|
238
236
|
</Menu>
|
|
@@ -183,18 +183,11 @@ export default function Materializations({
|
|
|
183
183
|
mutationFn: reporting(
|
|
184
184
|
"materialization",
|
|
185
185
|
"delete",
|
|
186
|
-
(
|
|
187
|
-
materialization,
|
|
188
|
-
dropTables,
|
|
189
|
-
}: {
|
|
190
|
-
materialization: Materialization;
|
|
191
|
-
dropTables: boolean;
|
|
192
|
-
}) =>
|
|
186
|
+
(materialization: Materialization) =>
|
|
193
187
|
apiClients.materializations.deleteMaterialization(
|
|
194
188
|
environmentName,
|
|
195
189
|
packageName,
|
|
196
190
|
materialization.id as string,
|
|
197
|
-
dropTables,
|
|
198
191
|
versionId,
|
|
199
192
|
),
|
|
200
193
|
),
|
|
@@ -385,11 +378,8 @@ export default function Materializations({
|
|
|
385
378
|
onStop={(materialization) =>
|
|
386
379
|
stopMaterialization.mutate(materialization)
|
|
387
380
|
}
|
|
388
|
-
onDelete={(materialization
|
|
389
|
-
deleteMaterialization.mutate(
|
|
390
|
-
materialization,
|
|
391
|
-
dropTables,
|
|
392
|
-
})
|
|
381
|
+
onDelete={(materialization) =>
|
|
382
|
+
deleteMaterialization.mutate(materialization)
|
|
393
383
|
}
|
|
394
384
|
onViewDetails={(materialization) =>
|
|
395
385
|
setSelectedId(materialization.id ?? null)
|
|
@@ -40,7 +40,6 @@ const deleteMaterialization = mock(
|
|
|
40
40
|
_environmentName: string,
|
|
41
41
|
_packageName: string,
|
|
42
42
|
_materializationId: string,
|
|
43
|
-
_dropTables?: boolean,
|
|
44
43
|
_versionId?: string,
|
|
45
44
|
) => Promise.resolve({ data: undefined }),
|
|
46
45
|
);
|
|
@@ -138,6 +137,12 @@ async function deleteTheRun(resourceUri: string) {
|
|
|
138
137
|
await waitFor(() => expect(deleteMaterialization).toHaveBeenCalled());
|
|
139
138
|
}
|
|
140
139
|
|
|
140
|
+
it("deletes a run with no table option: the dialog offers none", async () => {
|
|
141
|
+
await deleteTheRun("publisher://environments/env/packages/pkg");
|
|
142
|
+
|
|
143
|
+
expect(screen.queryByRole("checkbox")).toBeNull();
|
|
144
|
+
});
|
|
145
|
+
|
|
141
146
|
it("lists and deletes a pinned version's run by that version", async () => {
|
|
142
147
|
await deleteTheRun("publisher://environments/env/packages/pkg?versionId=v2");
|
|
143
148
|
|
|
@@ -146,7 +151,6 @@ it("lists and deletes a pinned version's run by that version", async () => {
|
|
|
146
151
|
"env",
|
|
147
152
|
"pkg",
|
|
148
153
|
"run-1",
|
|
149
|
-
false,
|
|
150
154
|
"v2",
|
|
151
155
|
]);
|
|
152
156
|
});
|
|
@@ -158,7 +162,6 @@ it("deletes with no version when none is pinned, as before", async () => {
|
|
|
158
162
|
"env",
|
|
159
163
|
"pkg",
|
|
160
164
|
"run-1",
|
|
161
|
-
false,
|
|
162
165
|
undefined,
|
|
163
166
|
]);
|
|
164
167
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
4
|
import { Tooltip, Typography } from "@mui/material";
|
|
5
|
-
import { MaterializationMetadata, triggerLabel } from "./utils";
|
|
5
|
+
import { isScheduledRun, MaterializationMetadata, triggerLabel } from "./utils";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* How a run was initiated — Scheduled (the standalone scheduler fired the
|
|
@@ -19,7 +19,7 @@ export default function TriggerLabel({
|
|
|
19
19
|
}: {
|
|
20
20
|
meta: MaterializationMetadata;
|
|
21
21
|
}) {
|
|
22
|
-
const scheduled = meta
|
|
22
|
+
const scheduled = isScheduledRun(meta);
|
|
23
23
|
return (
|
|
24
24
|
<Tooltip
|
|
25
25
|
title={
|
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
isTerminalStatus,
|
|
12
12
|
parseMetadata,
|
|
13
13
|
refusedSourcesOf,
|
|
14
|
+
runColor,
|
|
15
|
+
runLabel,
|
|
14
16
|
sourcesSummary,
|
|
15
17
|
statusColor,
|
|
16
18
|
statusLabel,
|
|
@@ -103,6 +105,27 @@ describe("statusColor", () => {
|
|
|
103
105
|
});
|
|
104
106
|
});
|
|
105
107
|
|
|
108
|
+
describe("runLabel and runColor", () => {
|
|
109
|
+
const run = (metadata: Record<string, unknown>) =>
|
|
110
|
+
({
|
|
111
|
+
status: MaterializationStatus.ManifestFileReady,
|
|
112
|
+
metadata,
|
|
113
|
+
}) as unknown as Materialization;
|
|
114
|
+
|
|
115
|
+
it("reads a run whose manifest did not load as built, not served, a warning", () => {
|
|
116
|
+
const failed = run({ autoLoad: "failed", autoLoadError: "boom" });
|
|
117
|
+
expect(runLabel(failed)).toBe("Built, not served");
|
|
118
|
+
expect(runColor(failed)).toBe("warning");
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("reads a served run, or one with no load recorded, as done", () => {
|
|
122
|
+
for (const m of [run({ autoLoad: "loaded" }), run({})]) {
|
|
123
|
+
expect(runLabel(m)).toBe("Done");
|
|
124
|
+
expect(runColor(m)).toBe("success");
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
106
129
|
describe("parseMetadata and triggerLabel", () => {
|
|
107
130
|
const run = (metadata: unknown) =>
|
|
108
131
|
({ metadata }) as unknown as Materialization;
|
|
@@ -123,9 +146,14 @@ describe("parseMetadata and triggerLabel", () => {
|
|
|
123
146
|
});
|
|
124
147
|
|
|
125
148
|
it("calls a run manual unless the scheduler says otherwise", () => {
|
|
149
|
+
expect(triggerLabel({ trigger: "scheduler" })).toBe("Scheduled");
|
|
150
|
+
expect(triggerLabel({ trigger: "on_demand" })).toBe("Manual");
|
|
151
|
+
expect(triggerLabel({})).toBe("Manual");
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("reads an older server's upper-case trigger the same", () => {
|
|
126
155
|
expect(triggerLabel({ trigger: "SCHEDULER" })).toBe("Scheduled");
|
|
127
156
|
expect(triggerLabel({ trigger: "ON_DEMAND" })).toBe("Manual");
|
|
128
|
-
expect(triggerLabel({})).toBe("Manual");
|
|
129
157
|
});
|
|
130
158
|
});
|
|
131
159
|
|
|
@@ -5,8 +5,9 @@ import { Materialization, MaterializationStatus } from "../../client";
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Non-terminal phases of a build: PENDING (building) -> MANIFEST_ROWS_READY
|
|
8
|
-
* (tables built
|
|
9
|
-
*
|
|
8
|
+
* (tables built, manifest recorded, and an auto-run's manifest loading into
|
|
9
|
+
* its package) -> MANIFEST_FILE_READY (terminal: an auto-run's package serves
|
|
10
|
+
* the new tables). Any non-terminal phase may be polled and stopped.
|
|
10
11
|
*/
|
|
11
12
|
export function isActiveStatus(status?: MaterializationStatus): boolean {
|
|
12
13
|
return (
|
|
@@ -63,6 +64,32 @@ export function statusColor(status?: MaterializationStatus): ChipColor {
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Whether an auto-run built its tables but its manifest did not load into the
|
|
69
|
+
* package (`metadata.autoLoad: "failed"`): it reached MANIFEST_FILE_READY, but
|
|
70
|
+
* queries are not answered from the new tables.
|
|
71
|
+
*/
|
|
72
|
+
export function builtNotServed(materialization: Materialization): boolean {
|
|
73
|
+
return (
|
|
74
|
+
materialization.status === MaterializationStatus.ManifestFileReady &&
|
|
75
|
+
parseMetadata(materialization).autoLoad === "failed"
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** {@link statusLabel} for a run, which reads a built-but-not-served run apart. */
|
|
80
|
+
export function runLabel(materialization: Materialization): string {
|
|
81
|
+
return builtNotServed(materialization)
|
|
82
|
+
? "Built, not served"
|
|
83
|
+
: statusLabel(materialization.status);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** {@link statusColor} for a run: a built-but-not-served run is a warning. */
|
|
87
|
+
export function runColor(materialization: Materialization): ChipColor {
|
|
88
|
+
return builtNotServed(materialization)
|
|
89
|
+
? "warning"
|
|
90
|
+
: statusColor(materialization.status);
|
|
91
|
+
}
|
|
92
|
+
|
|
66
93
|
/**
|
|
67
94
|
* Shape of Materialization.metadata. The generated client types it as
|
|
68
95
|
* `object | null`, so callers must read it through parseMetadata(), which
|
|
@@ -73,12 +100,13 @@ export interface MaterializationMetadata {
|
|
|
73
100
|
sourceNames?: string[];
|
|
74
101
|
mode?: "auto" | "orchestrated";
|
|
75
102
|
/**
|
|
76
|
-
* What initiated the run. `
|
|
77
|
-
* package's `materialization.schedule` cron; `
|
|
103
|
+
* What initiated the run. `scheduler` = the standalone scheduler fired the
|
|
104
|
+
* package's `materialization.schedule` cron; `on_demand` (default) = an
|
|
78
105
|
* explicit API/UI create. Recorded on the run so a scheduled rebuild is
|
|
79
|
-
* distinguishable from a manual one.
|
|
106
|
+
* distinguishable from a manual one. Servers before 0.15 wrote
|
|
107
|
+
* `SCHEDULER` and `ON_DEMAND`; read with {@link isScheduledRun}.
|
|
80
108
|
*/
|
|
81
|
-
trigger?: "ON_DEMAND" | "SCHEDULER";
|
|
109
|
+
trigger?: "on_demand" | "scheduler" | "ON_DEMAND" | "SCHEDULER";
|
|
82
110
|
sourcesBuilt?: number;
|
|
83
111
|
sourcesReused?: number;
|
|
84
112
|
/**
|
|
@@ -93,6 +121,14 @@ export interface MaterializationMetadata {
|
|
|
93
121
|
* `refused`; {@link refusedSourcesOf} reads both.
|
|
94
122
|
*/
|
|
95
123
|
refusedSources?: Record<string, { name: string; message: string }>;
|
|
124
|
+
/**
|
|
125
|
+
* An auto-run's manifest load, recorded when it reaches MANIFEST_FILE_READY:
|
|
126
|
+
* `loaded`, or `failed` with the step and error. Absent on an orchestrated
|
|
127
|
+
* run, which loads nothing.
|
|
128
|
+
*/
|
|
129
|
+
autoLoad?: "loaded" | "failed";
|
|
130
|
+
autoLoadStep?: string;
|
|
131
|
+
autoLoadError?: string;
|
|
96
132
|
}
|
|
97
133
|
|
|
98
134
|
/** One source a run did not build because the eligibility gate refused it. */
|
|
@@ -145,11 +181,16 @@ export function parseMetadata(
|
|
|
145
181
|
return (materialization.metadata ?? {}) as MaterializationMetadata;
|
|
146
182
|
}
|
|
147
183
|
|
|
184
|
+
/** Whether the scheduler fired the run, in either spelling a server wrote. */
|
|
185
|
+
export function isScheduledRun(meta: MaterializationMetadata): boolean {
|
|
186
|
+
return meta.trigger === "scheduler" || meta.trigger === "SCHEDULER";
|
|
187
|
+
}
|
|
188
|
+
|
|
148
189
|
/** Human label for how a run was initiated. */
|
|
149
190
|
export function triggerLabel(
|
|
150
191
|
meta: MaterializationMetadata,
|
|
151
192
|
): "Scheduled" | "Manual" {
|
|
152
|
-
return meta
|
|
193
|
+
return isScheduledRun(meta) ? "Scheduled" : "Manual";
|
|
153
194
|
}
|
|
154
195
|
|
|
155
196
|
/** Human-readable elapsed time between two ISO timestamps (to now if open). */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { describe, expect, it } from "bun:test";
|
|
5
5
|
import { fireEvent, render, screen } from "@testing-library/react";
|
|
6
|
-
import { PackageProblems } from "./PackageProblems";
|
|
6
|
+
import { PackageProblems, withoutRetainedAliases } from "./PackageProblems";
|
|
7
7
|
|
|
8
8
|
const KIND_REMOVED = {
|
|
9
9
|
model: "notebooks/overview.malloy",
|
|
@@ -39,3 +39,27 @@ describe("PackageProblems", () => {
|
|
|
39
39
|
expect(screen.getByText(/is deprecated/)).toBeDefined();
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
|
+
|
|
43
|
+
describe("withoutRetainedAliases", () => {
|
|
44
|
+
const notBuilt = {
|
|
45
|
+
model: "m.malloy",
|
|
46
|
+
subject: "orders",
|
|
47
|
+
code: "rollup-not-built",
|
|
48
|
+
severity: "warn" as const,
|
|
49
|
+
message: "not built",
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
it("shows a renamed code's one-release repeat once", () => {
|
|
53
|
+
expect(
|
|
54
|
+
withoutRetainedAliases([
|
|
55
|
+
notBuilt,
|
|
56
|
+
{ ...notBuilt, code: "preaggregate-not-built" },
|
|
57
|
+
]),
|
|
58
|
+
).toEqual([notBuilt]);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("keeps an older server's former code when it is the only copy", () => {
|
|
62
|
+
const old = { ...notBuilt, code: "preaggregate-not-built" };
|
|
63
|
+
expect(withoutRetainedAliases([old])).toEqual([old]);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -13,6 +13,35 @@ import { useState } from "react";
|
|
|
13
13
|
import type { PackageWarningsInner } from "../../client";
|
|
14
14
|
import { MONO_FONT_FAMILY } from "../styles";
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* A renamed warning code's former name, which a server repeats beside the new
|
|
18
|
+
* one, same message, for one release: by former code, the code it repeats.
|
|
19
|
+
* `persist-source-refused` is 0.14.0's; the others are 0.15.0's.
|
|
20
|
+
*/
|
|
21
|
+
const RETAINED_ALIAS_OF: Readonly<Record<string, string>> = {
|
|
22
|
+
"persist-source-refused": "persist-not-built",
|
|
23
|
+
"preaggregate-not-built": "rollup-not-built",
|
|
24
|
+
"preaggregate-join-one-key-repeated": "rollup-join-one-key-repeated",
|
|
25
|
+
"stored-native-schema-missing": "database-native-type-missing",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* `warnings` with each retained-alias repeat dropped when the warning it
|
|
30
|
+
* repeats is beside it, so each problem shows once. An older server's
|
|
31
|
+
* former code, with no new code beside it, is the only copy and still shows.
|
|
32
|
+
*/
|
|
33
|
+
export function withoutRetainedAliases(
|
|
34
|
+
warnings: readonly PackageWarningsInner[],
|
|
35
|
+
): PackageWarningsInner[] {
|
|
36
|
+
const key = (code: string | undefined, w: PackageWarningsInner) =>
|
|
37
|
+
`${code}\u0000${w.subject ?? ""}\u0000${w.message ?? ""}`;
|
|
38
|
+
const present = new Set(warnings.map((w) => key(w.code, w)));
|
|
39
|
+
return warnings.filter((w) => {
|
|
40
|
+
const now = w.code !== undefined ? RETAINED_ALIAS_OF[w.code] : undefined;
|
|
41
|
+
return now === undefined || !present.has(key(now, w));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
16
45
|
/**
|
|
17
46
|
* What the server found wrong with a package when it loaded it, on the
|
|
18
47
|
* package page.
|
|
@@ -29,8 +58,9 @@ export function PackageProblems({
|
|
|
29
58
|
warnings: PackageWarningsInner[] | undefined;
|
|
30
59
|
}) {
|
|
31
60
|
const [showNotes, setShowNotes] = useState(false);
|
|
32
|
-
const
|
|
33
|
-
const
|
|
61
|
+
const shown = withoutRetainedAliases(warnings ?? []);
|
|
62
|
+
const errors = shown.filter((w) => w.severity === "error");
|
|
63
|
+
const notes = shown.filter((w) => w.severity !== "error");
|
|
34
64
|
if (errors.length === 0 && notes.length === 0) return null;
|
|
35
65
|
return (
|
|
36
66
|
<Stack sx={{ gap: 1, mb: 4 }}>
|