@malloy-publisher/sdk 0.14.0 → 0.16.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-C9PiHrGC.cjs.js → RenderedResult-DTM9o4Ql.cjs.js} +1 -1
- package/dist/{RenderedResult-D0kAzSrP.es.js → RenderedResult-vyM2wQbC.es.js} +9 -9
- package/dist/ServerProvider-DpOy4_Kf.cjs.js +1 -0
- package/dist/{ServerProvider-BHM9y5l0.es.js → ServerProvider-lAZ5ZdQS.es.js} +1182 -1034
- package/dist/builder/index.cjs.js +1 -1
- package/dist/builder/index.es.js +335 -335
- package/dist/client/api.d.ts +324 -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 +7 -4
- package/dist/components/Package/PackageProblems.d.ts +6 -0
- package/dist/index.cjs.js +38 -38
- package/dist/index.es.js +6176 -6665
- package/dist/{useCompiledDocument-Co-INO6B.cjs.js → useCompiledDocument-2huaKTJN.cjs.js} +20 -20
- package/dist/{useCompiledDocument-CF5s0cXj.es.js → useCompiledDocument-CSXZufFO.es.js} +56 -60
- package/package.json +1 -1
- package/src/components/Materializations/DeleteMaterializationDialog.tsx +5 -16
- package/src/components/Materializations/MaterializationRunsList.tsx +3 -5
- 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 +6 -1
- package/src/components/Materializations/utils.ts +11 -5
- package/src/components/Package/PackageProblems.spec.tsx +25 -1
- package/src/components/Package/PackageProblems.tsx +30 -12
- package/src/components/RenderedResult/RenderedResult.lifecycle.spec.tsx +15 -1
- package/dist/ServerProvider-D97_rUv5.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-lAZ5ZdQS.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-vyM2wQbC.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
|
);
|
|
@@ -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);
|
|
@@ -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={
|
|
@@ -146,9 +146,14 @@ describe("parseMetadata and triggerLabel", () => {
|
|
|
146
146
|
});
|
|
147
147
|
|
|
148
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", () => {
|
|
149
155
|
expect(triggerLabel({ trigger: "SCHEDULER" })).toBe("Scheduled");
|
|
150
156
|
expect(triggerLabel({ trigger: "ON_DEMAND" })).toBe("Manual");
|
|
151
|
-
expect(triggerLabel({})).toBe("Manual");
|
|
152
157
|
});
|
|
153
158
|
});
|
|
154
159
|
|
|
@@ -100,12 +100,13 @@ export interface MaterializationMetadata {
|
|
|
100
100
|
sourceNames?: string[];
|
|
101
101
|
mode?: "auto" | "orchestrated";
|
|
102
102
|
/**
|
|
103
|
-
* What initiated the run. `
|
|
104
|
-
* 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
|
|
105
105
|
* explicit API/UI create. Recorded on the run so a scheduled rebuild is
|
|
106
|
-
* 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}.
|
|
107
108
|
*/
|
|
108
|
-
trigger?: "ON_DEMAND" | "SCHEDULER";
|
|
109
|
+
trigger?: "on_demand" | "scheduler" | "ON_DEMAND" | "SCHEDULER";
|
|
109
110
|
sourcesBuilt?: number;
|
|
110
111
|
sourcesReused?: number;
|
|
111
112
|
/**
|
|
@@ -180,11 +181,16 @@ export function parseMetadata(
|
|
|
180
181
|
return (materialization.metadata ?? {}) as MaterializationMetadata;
|
|
181
182
|
}
|
|
182
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
|
+
|
|
183
189
|
/** Human label for how a run was initiated. */
|
|
184
190
|
export function triggerLabel(
|
|
185
191
|
meta: MaterializationMetadata,
|
|
186
192
|
): "Scheduled" | "Manual" {
|
|
187
|
-
return meta
|
|
193
|
+
return isScheduledRun(meta) ? "Scheduled" : "Manual";
|
|
188
194
|
}
|
|
189
195
|
|
|
190
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,18 +58,7 @@ export function PackageProblems({
|
|
|
29
58
|
warnings: PackageWarningsInner[] | undefined;
|
|
30
59
|
}) {
|
|
31
60
|
const [showNotes, setShowNotes] = useState(false);
|
|
32
|
-
|
|
33
|
-
// `persist-not-built` warning, same message, for API clients; show each
|
|
34
|
-
// problem once. An older server's `persist-source-refused`, with no
|
|
35
|
-
// `persist-not-built` beside it, is the only copy and still shows.
|
|
36
|
-
const notBuilt = new Set(
|
|
37
|
-
(warnings ?? [])
|
|
38
|
-
.filter((w) => w.code === "persist-not-built")
|
|
39
|
-
.map((w) => w.message),
|
|
40
|
-
);
|
|
41
|
-
const shown = (warnings ?? []).filter(
|
|
42
|
-
(w) => w.code !== "persist-source-refused" || !notBuilt.has(w.message),
|
|
43
|
-
);
|
|
61
|
+
const shown = withoutRetainedAliases(warnings ?? []);
|
|
44
62
|
const errors = shown.filter((w) => w.severity === "error");
|
|
45
63
|
const notes = shown.filter((w) => w.severity !== "error");
|
|
46
64
|
if (errors.length === 0 && notes.length === 0) return null;
|
|
@@ -84,7 +84,7 @@ class FakeViz {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
const fakeRenderModule = {
|
|
88
88
|
MalloyRenderer: class {
|
|
89
89
|
constructor(options: (typeof rendererOptions)[number]) {
|
|
90
90
|
rendererOptions.push(options);
|
|
@@ -95,6 +95,20 @@ mock.module("@malloydata/render", () => ({
|
|
|
95
95
|
return viz;
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
mock.module("@malloydata/render", () => fakeRenderModule);
|
|
101
|
+
// The fake goes in at the loader too, not only at the package. `loadRenderer`
|
|
102
|
+
// caches the import's promise for the whole process, and an earlier spec file
|
|
103
|
+
// that mounts a `ResultPanel` with a result warms it, starting the real 3.4 MB
|
|
104
|
+
// import. When that import is still in flight as this file mocks the package,
|
|
105
|
+
// it resolves to the REAL renderer anyway, the cache keeps it, and every test
|
|
106
|
+
// here waits on an `onReady` the real renderer never calls on this fake
|
|
107
|
+
// payload: each times out, in the file orders where that warm-up lands just
|
|
108
|
+
// before this file.
|
|
109
|
+
mock.module("./loadRenderer", () => ({
|
|
110
|
+
loadMalloyRenderer: async () => fakeRenderModule,
|
|
111
|
+
warmMalloyRenderer: () => {},
|
|
98
112
|
}));
|
|
99
113
|
|
|
100
114
|
const RenderedResult = (await import("./RenderedResult")).default;
|