@polishd/next 0.2.3-dev.1 → 0.2.3-dev.3
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/CHANGELOG.md +52 -0
- package/README.md +7 -5
- package/bin/init.mjs +4 -1
- package/dist/dashboard/chrome.d.ts +15 -0
- package/dist/dashboard/chrome.d.ts.map +1 -1
- package/dist/dashboard/chrome.js +5 -1
- package/dist/dashboard/chrome.js.map +1 -1
- package/dist/dashboard/data.d.ts +18 -0
- package/dist/dashboard/data.d.ts.map +1 -0
- package/dist/dashboard/data.js +70 -0
- package/dist/dashboard/data.js.map +1 -0
- package/dist/dashboard/index.d.ts +1 -1
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +209 -85
- package/dist/dashboard/index.js.map +1 -1
- package/dist/dashboard/snapshot-actions.d.ts +15 -5
- package/dist/dashboard/snapshot-actions.d.ts.map +1 -1
- package/dist/dashboard/snapshot-actions.js +64 -24
- package/dist/dashboard/snapshot-actions.js.map +1 -1
- package/dist/dashboard/snapshots.d.ts.map +1 -1
- package/dist/dashboard/snapshots.js +58 -8
- package/dist/dashboard/snapshots.js.map +1 -1
- package/dist/dashboard.css +4 -0
- package/dist/server/snapshots.d.ts +44 -11
- package/dist/server/snapshots.d.ts.map +1 -1
- package/dist/server/snapshots.js +288 -142
- package/dist/server/snapshots.js.map +1 -1
- package/docs/SETUP.md +10 -0
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@ import { requirePolishdAuth } from "../ai/guard";
|
|
|
19
19
|
import { resolveSettings } from "../ai/settings";
|
|
20
20
|
import { isDashboardPath, resolveDashboardRoute } from "../config";
|
|
21
21
|
import { getDesignData } from "../server/design";
|
|
22
|
-
import { MAX_SNAPSHOT_ROUTES,
|
|
22
|
+
import { MAX_SNAPSHOT_ROUTES, beginSnapshot, captureSnapshotRoute, finishSnapshot, readSnapshotImage, } from "../server/snapshots";
|
|
23
23
|
/**
|
|
24
24
|
* The origin to shoot. `POLISHD_SITE_ORIGIN` wins when set (proxies, tunnels,
|
|
25
25
|
* a prod URL shot from a dev machine); otherwise the origin the dashboard was
|
|
@@ -39,36 +39,76 @@ async function resolveSiteOrigin() {
|
|
|
39
39
|
return `${proto}://${host}`;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* Capture is chunked into one action call per route — begin, then one
|
|
43
|
+
* `captureSnapshotRouteAction` per returned route, then finish — so no single
|
|
44
|
+
* request has to outlive a serverless host's function time limit. The client
|
|
45
|
+
* drives the loop; every per-route call is validated against the plan the
|
|
46
|
+
* begin call parked server-side, so the client contributes nothing but ids.
|
|
47
|
+
*
|
|
48
|
+
* Everything after auth reduces to a message rather than a thrown error: a
|
|
49
|
+
* rejected action crashes the dashboard tab into Next's error boundary with
|
|
50
|
+
* an opaque digest, while a returned message renders in the card.
|
|
45
51
|
*/
|
|
46
|
-
export async function
|
|
52
|
+
export async function beginSnapshotCaptureAction() {
|
|
47
53
|
await requirePolishdAuth();
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
try {
|
|
55
|
+
const origin = await resolveSiteOrigin();
|
|
56
|
+
if (!origin) {
|
|
57
|
+
return {
|
|
58
|
+
ok: false,
|
|
59
|
+
message: "Couldn't work out the site's URL from the request — set POLISHD_SITE_ORIGIN " +
|
|
60
|
+
"to the origin the site is reachable at.",
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const data = await getDesignData();
|
|
64
|
+
const dashboardRoute = resolveDashboardRoute();
|
|
65
|
+
// Shoot what visitors have actually rendered, never the dashboard itself
|
|
66
|
+
// (nor the telemetry pseudo-paths the collector namespaces under /~polishd).
|
|
67
|
+
const scanned = data.pages
|
|
68
|
+
.map((p) => p.path)
|
|
69
|
+
.filter((p) => p.startsWith("/") && !p.startsWith("/~") && !isDashboardPath(p, dashboardRoute));
|
|
70
|
+
const routes = (scanned.length > 0 ? scanned : ["/"]).slice(0, MAX_SNAPSHOT_ROUTES);
|
|
71
|
+
// Stamp the snapshot with the same metrics fingerprint the AI review caches
|
|
72
|
+
// under, so "taken before/after this round of changes" is a hash comparison.
|
|
73
|
+
let fingerprint = null;
|
|
74
|
+
if (data.ready && data.pages.length > 0) {
|
|
75
|
+
const { settings } = await resolveSettings();
|
|
76
|
+
fingerprint = fingerprintDigest(buildDesignDigest(data, settings.context));
|
|
77
|
+
}
|
|
78
|
+
return await beginSnapshot({ origin, routes, fingerprint });
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
50
81
|
return {
|
|
51
82
|
ok: false,
|
|
52
|
-
message:
|
|
53
|
-
"to the origin the site is reachable at.",
|
|
83
|
+
message: `Snapshot capture failed unexpectedly: ${err instanceof Error ? err.message : "unknown error"}`,
|
|
54
84
|
};
|
|
55
85
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
86
|
+
}
|
|
87
|
+
/** Shoot one route of the capture in progress — both devices, both themes. */
|
|
88
|
+
export async function captureSnapshotRouteAction(id, route) {
|
|
89
|
+
await requirePolishdAuth();
|
|
90
|
+
try {
|
|
91
|
+
return await captureSnapshotRoute(id, route);
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
return {
|
|
95
|
+
ok: false,
|
|
96
|
+
message: `Screenshot capture failed unexpectedly: ${err instanceof Error ? err.message : "unknown error"}`,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** Record the accumulated shots as a snapshot and prune old ones. */
|
|
101
|
+
export async function finishSnapshotCaptureAction(id) {
|
|
102
|
+
await requirePolishdAuth();
|
|
103
|
+
try {
|
|
104
|
+
return await finishSnapshot(id);
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
return {
|
|
108
|
+
ok: false,
|
|
109
|
+
message: `The snapshot couldn't be recorded: ${err instanceof Error ? err.message : "unknown error"}`,
|
|
110
|
+
};
|
|
70
111
|
}
|
|
71
|
-
return captureSnapshot({ origin, routes, fingerprint });
|
|
72
112
|
}
|
|
73
113
|
/** One shot's PNG as a data URL — fetched lazily as tiles scroll into use. */
|
|
74
114
|
export async function getSnapshotImageAction(snapshotId, file) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot-actions.js","sourceRoot":"","sources":["../../src/dashboard/snapshot-actions.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"snapshot-actions.js","sourceRoot":"","sources":["../../src/dashboard/snapshot-actions.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,qB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1
|
+
{"version":3,"file":"snapshots.d.ts","sourceRoot":"","sources":["../../src/dashboard/snapshots.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,qBAAqB,CAAC;AAwGhF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B;;;;;OAKG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,kBAAkB,+BA2PlF"}
|
|
@@ -10,7 +10,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
10
10
|
* expands into a full-height lightbox.
|
|
11
11
|
*/
|
|
12
12
|
import { useEffect, useState, useTransition } from "react";
|
|
13
|
-
import {
|
|
13
|
+
import { beginSnapshotCaptureAction, captureSnapshotRouteAction, finishSnapshotCaptureAction, getSnapshotImageAction, } from "./snapshot-actions";
|
|
14
14
|
import { border, card, labelCls, primaryBtn, relTime, RefreshIcon } from "./ui";
|
|
15
15
|
const DEVICES = ["desktop", "phone"];
|
|
16
16
|
const THEMES = ["light", "dark"];
|
|
@@ -53,6 +53,7 @@ export default function SnapshotsCard({ initial, captureIssue }) {
|
|
|
53
53
|
const [error, setError] = useState(null);
|
|
54
54
|
const [zoom, setZoom] = useState(null);
|
|
55
55
|
const [pending, startCapture] = useTransition();
|
|
56
|
+
const [progress, setProgress] = useState(null);
|
|
56
57
|
const selected = snapshots.find((s) => s.id === selectedId) ?? snapshots[0] ?? null;
|
|
57
58
|
// A site with no dark mode has its identical dark shots dropped at capture
|
|
58
59
|
// time — hide the toggle rather than offering an empty view.
|
|
@@ -60,13 +61,56 @@ export default function SnapshotsCard({ initial, captureIssue }) {
|
|
|
60
61
|
const capture = () => {
|
|
61
62
|
setError(null);
|
|
62
63
|
startCapture(async () => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
// The capture is one action call per route, so no single request has to
|
|
65
|
+
// outlive a serverless host's function time limit — and every await is
|
|
66
|
+
// caught: a rejected action must land in the error box, never in the
|
|
67
|
+
// error boundary (which would take the whole tab down).
|
|
68
|
+
try {
|
|
69
|
+
const begun = await beginSnapshotCaptureAction();
|
|
70
|
+
if (!begun.ok) {
|
|
71
|
+
setError(begun.message);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
setProgress({ done: 0, total: begun.routes.length });
|
|
75
|
+
const failed = [];
|
|
76
|
+
let failure = null;
|
|
77
|
+
for (const [i, route] of begun.routes.entries()) {
|
|
78
|
+
try {
|
|
79
|
+
const res = await captureSnapshotRouteAction(begun.id, route);
|
|
80
|
+
if (!res.ok) {
|
|
81
|
+
failed.push(route);
|
|
82
|
+
failure = res.message;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
failed.push(route);
|
|
87
|
+
failure =
|
|
88
|
+
"the request failed mid-shoot — usually a serverless function " +
|
|
89
|
+
"time limit; the host's function logs will name the exact failure";
|
|
90
|
+
}
|
|
91
|
+
setProgress({ done: i + 1, total: begun.routes.length });
|
|
92
|
+
}
|
|
93
|
+
// Finish even when every route failed: it sweeps the capture's state
|
|
94
|
+
// and reports "every page failed" — the per-route failure is more
|
|
95
|
+
// specific, so it wins the error box when there is one.
|
|
96
|
+
const fin = await finishSnapshotCaptureAction(begun.id);
|
|
97
|
+
if (fin.ok) {
|
|
98
|
+
setSnapshots((prev) => [fin.snapshot, ...prev]);
|
|
99
|
+
setSelectedId(fin.snapshot.id);
|
|
100
|
+
if (failed.length > 0) {
|
|
101
|
+
setError(`${failed.length} of ${begun.routes.length} page${begun.routes.length === 1 ? "" : "s"} failed to capture (${failure}). The rest are in the snapshot.`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
setError(failure ? `Capture failed: ${failure}.` : fin.message);
|
|
106
|
+
}
|
|
67
107
|
}
|
|
68
|
-
|
|
69
|
-
setError(
|
|
108
|
+
catch {
|
|
109
|
+
setError("The capture failed before a result came back — your host's function " +
|
|
110
|
+
"logs will name the exact failure.");
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
setProgress(null);
|
|
70
114
|
}
|
|
71
115
|
});
|
|
72
116
|
};
|
|
@@ -81,7 +125,13 @@ export default function SnapshotsCard({ initial, captureIssue }) {
|
|
|
81
125
|
// clicks group under these on the collecting side, so "does anyone shoot
|
|
82
126
|
// a second snapshot?" is answerable. Inert for host apps.
|
|
83
127
|
_jsxs("section", { "data-component": "design-snapshots", className: `mb-8 ${card} overflow-hidden`, children: [_jsxs("div", { className: `flex flex-wrap items-center justify-between gap-3 border-b ${border} px-4 py-3 sm:px-5`, children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: labelCls, children: "Site snapshots" }), selected && (_jsx("span", { className: "hidden rounded-full bg-[#1a1a1a] px-2 py-0.5 text-[10px] font-medium text-[#888] sm:inline", children: selected.origin }))] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [selected && (_jsxs(_Fragment, { children: [_jsx(TogglePills, { options: DEVICES, value: device, onChange: setDevice, component: "design-snapshot-device" }), !selected.noDarkMode && (_jsx(TogglePills, { options: THEMES, value: theme, onChange: setTheme, component: "design-snapshot-theme" })), snapshots.length > 1 && (_jsx("select", { "data-component": "design-snapshot-history", value: selected.id, onChange: (e) => setSelectedId(e.target.value), className: "rounded-md border border-[#2e2e2e] bg-[#111] px-2 py-1 text-[11px] text-[#aaa] focus:border-[#555] focus:outline-none", children: snapshots.map((s) => (_jsx("option", { value: s.id, children: relTime(s.capturedAt) }, s.id))) }))] })), _jsx("button", { type: "button", "data-component": "design-snapshot-capture", onClick: capture, disabled: pending || captureIssue !== null, title: captureIssue ??
|
|
84
|
-
"Screenshot every scanned page — phone and desktop, light and dark", className: primaryBtn, children: _jsxs("span", { className: "flex items-center gap-1.5", children: [_jsx(RefreshIcon, { spinning: pending }), pending
|
|
128
|
+
"Screenshot every scanned page — phone and desktop, light and dark", className: primaryBtn, children: _jsxs("span", { className: "flex items-center gap-1.5", children: [_jsx(RefreshIcon, { spinning: pending }), pending
|
|
129
|
+
? progress
|
|
130
|
+
? `Shooting page ${Math.min(progress.done + 1, progress.total)} of ${progress.total}…`
|
|
131
|
+
: "Shooting pages…"
|
|
132
|
+
: selected
|
|
133
|
+
? "Capture again"
|
|
134
|
+
: "Capture snapshot"] }) })] })] }), _jsxs("div", { className: "px-4 py-4 sm:px-5 sm:py-5", children: [captureIssue && (_jsx("div", { className: "mb-3 rounded-md border border-amber-900/50 bg-amber-950/30 px-3 py-2 text-[12px] text-amber-400", children: captureIssue })), error && (_jsx("div", { className: "mb-3 rounded-md border border-red-900/50 bg-red-950/30 px-3 py-2 text-[12px] text-red-400", children: error })), pending && (_jsx("p", { className: "mb-3 text-[12px] text-[#888]", children: "Shooting every scanned page at two sizes in two themes, one page at a time \u2014 this can take a minute. Keep this tab open." })), !selected && !pending && (_jsx("p", { className: "text-[13px] leading-relaxed text-[#888]", children: "No snapshots yet. Capture one to see every page of the site as it renders right now \u2014 the \u201Cbefore\u201D to hold future design changes against." })), selected && (_jsxs(_Fragment, { children: [shots.length === 0 ? (_jsxs("p", { className: "text-[13px] text-[#888]", children: ["No ", device, "/", theme, " shots in this snapshot."] })) : (_jsx("div", { className: `grid gap-4 ${device === "phone"
|
|
85
135
|
? "grid-cols-3 sm:grid-cols-5 lg:grid-cols-6"
|
|
86
136
|
: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-4"}`, children: shots.map((s) => (_jsx(ShotTile, { snapshotId: selected.id, shot: s, onZoom: (src, route) => setZoom({ src, route }) }, `${selected.id}|${s.file}`))) })), _jsxs("div", { className: "mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-[#555]", children: [_jsxs("span", { children: ["Captured ", relTime(selected.capturedAt)] }), selected.noDarkMode && (_jsx("span", { className: "rounded-full bg-[#1a1a1a] px-2 py-0.5 text-[#777]", children: "Site renders identically in dark mode" })), skipped.length > 0 && (_jsxs("span", { className: "text-amber-400/80", children: [skipped.length, " page", skipped.length === 1 ? "" : "s", " skipped", skipped[0].skipped ? ` (${skipped[0].skipped})` : ""] })), selected.authWalled.length > 0 && (_jsxs("span", { className: "text-amber-400/80", children: ["behind login: ", selected.authWalled.slice(0, 3).join(", "), selected.authWalled.length > 3 ? ", …" : ""] }))] })] }))] }), zoom && (_jsx("div", { role: "dialog", "aria-label": `${zoom.route} screenshot`, onClick: () => setZoom(null), className: "fixed inset-0 z-50 flex cursor-zoom-out items-start justify-center overflow-y-auto bg-black/85 p-6", children: _jsx("img", { src: zoom.src, alt: `${zoom.route} full screenshot`, className: "w-full max-w-3xl rounded-md border border-[#333]" }) }))] }));
|
|
87
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshots.js","sourceRoot":"","sources":["../../src/dashboard/snapshots.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3D,OAAO,
|
|
1
|
+
{"version":3,"file":"snapshots.js","sourceRoot":"","sources":["../../src/dashboard/snapshots.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3D,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEhF,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,OAAO,CAAU,CAAC;AAC9C,MAAM,MA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,CAAC,UAAU,IAAI,CACtB,eAAM,SAAS,EAAC,mDAAmD,sDAE5D,CACR,EACA,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CACrB,gBAAM,SAAS,EAAC,mBAAmB,aAChC,OAAO,CAAC,MAAM,WAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,cACpD,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,IAChD,CACR,EACA,QAAQ,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,CACjC,gBAAM,SAAS,EAAC,mBAAmB,+BAClB,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EACxD,QAAQ,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IACvC,CACR,IACG,IACL,CACJ,IACG,EAEL,IAAI,IAAI,CACP,cACE,IAAI,EAAC,QAAQ,gBACD,GAAG,IAAI,CAAC,KAAK,aAAa,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAC5B,SAAS,EAAC,oGAAoG,YAG9G,cACE,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,kBAAkB,EACpC,SAAS,EAAC,kDAAkD,GAC5D,GACE,CACP,IACO,CACX,CAAC;AACJ,CAAC"}
|
package/dist/dashboard.css
CHANGED
|
@@ -49,7 +49,7 @@ export declare function listSnapshots(): Promise<PolishdSnapshot[]>;
|
|
|
49
49
|
* are only ever fetched from the URL the index recorded at capture time.
|
|
50
50
|
*/
|
|
51
51
|
export declare function readSnapshotImage(snapshotId: string, file: string): Promise<string | null>;
|
|
52
|
-
export interface
|
|
52
|
+
export interface BeginSnapshotInput {
|
|
53
53
|
/** The site to shoot, scheme included. */
|
|
54
54
|
origin: string;
|
|
55
55
|
/** Paths to shoot — discovery is skipped, these are shot exactly. */
|
|
@@ -57,6 +57,21 @@ export interface CaptureSnapshotInput {
|
|
|
57
57
|
/** Design-metrics fingerprint at capture time, for later pairing. */
|
|
58
58
|
fingerprint: string | null;
|
|
59
59
|
}
|
|
60
|
+
export type BeginSnapshotResult = {
|
|
61
|
+
ok: true;
|
|
62
|
+
id: string;
|
|
63
|
+
routes: string[];
|
|
64
|
+
} | {
|
|
65
|
+
ok: false;
|
|
66
|
+
message: string;
|
|
67
|
+
};
|
|
68
|
+
export type CaptureRouteResult = {
|
|
69
|
+
ok: true;
|
|
70
|
+
shots: PolishdSnapshotShot[];
|
|
71
|
+
} | {
|
|
72
|
+
ok: false;
|
|
73
|
+
message: string;
|
|
74
|
+
};
|
|
60
75
|
export type CaptureSnapshotResult = {
|
|
61
76
|
ok: true;
|
|
62
77
|
snapshot: PolishdSnapshot;
|
|
@@ -65,17 +80,35 @@ export type CaptureSnapshotResult = {
|
|
|
65
80
|
message: string;
|
|
66
81
|
};
|
|
67
82
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* needed but the import misses, the dashboard can say so up front rather than
|
|
73
|
-
* a minute into a doomed capture.
|
|
83
|
+
* Start a capture: run the environment preflight, sweep any unfinished
|
|
84
|
+
* predecessor's images, and park the plan in the store. The returned routes
|
|
85
|
+
* are what the caller should then feed to `captureSnapshotRoute`, one call
|
|
86
|
+
* each, before `finishSnapshot` records the run.
|
|
74
87
|
*/
|
|
75
|
-
export declare function
|
|
88
|
+
export declare function beginSnapshot(input: BeginSnapshotInput): Promise<BeginSnapshotResult>;
|
|
89
|
+
/**
|
|
90
|
+
* Shoot one route of the capture `beginSnapshot` started — both devices, both
|
|
91
|
+
* themes — store its images, and append the results to the pending record.
|
|
92
|
+
* Bounded work per call by design: this is the request that has to fit inside
|
|
93
|
+
* a serverless host's function time limit.
|
|
94
|
+
*/
|
|
95
|
+
export declare function captureSnapshotRoute(id: string, route: string): Promise<CaptureRouteResult>;
|
|
76
96
|
/**
|
|
77
|
-
*
|
|
78
|
-
* snapshots past `MAX_SNAPSHOTS
|
|
97
|
+
* Close out the capture: record the accumulated shots in the snapshot index
|
|
98
|
+
* and prune old snapshots past `MAX_SNAPSHOTS`, images included. Called once
|
|
99
|
+
* every route has been attempted — routes whose calls failed outright are
|
|
100
|
+
* simply absent from the snapshot.
|
|
79
101
|
*/
|
|
80
|
-
export declare function
|
|
102
|
+
export declare function finishSnapshot(id: string): Promise<CaptureSnapshotResult>;
|
|
103
|
+
/**
|
|
104
|
+
* A problem that will make the next capture fail, detectable from the
|
|
105
|
+
* environment alone — or null when none is. Covers the two setup gaps a
|
|
106
|
+
* serverless deploy can have: no Blob store connected (nowhere for images to
|
|
107
|
+
* live when the filesystem is read-only), and the `--omit=optional` install
|
|
108
|
+
* missing a dependency the environment says will be needed. Either way the
|
|
109
|
+
* dashboard can say so up front rather than a minute into a doomed capture,
|
|
110
|
+
* and `captureSnapshot` runs the same check for callers that never rendered
|
|
111
|
+
* the dashboard.
|
|
112
|
+
*/
|
|
113
|
+
export declare function snapshotCaptureIssue(): Promise<string | null>;
|
|
81
114
|
//# sourceMappingURL=snapshots.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshots.d.ts","sourceRoot":"","sources":["../../src/server/snapshots.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"snapshots.d.ts","sourceRoot":"","sources":["../../src/server/snapshots.ts"],"names":[],"mappings":"AAsCA,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,KAAK,EAAE,MAA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