@ekanos/harness 0.27.0 → 0.29.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/README.md +6 -4
- package/dist/internal/components/approvals-tray.d.ts +44 -6
- package/dist/internal/components/approvals-tray.js +252 -30
- package/dist/internal/components/ask-assistant-bridge.js +7 -1
- package/dist/internal/components/connect-controls.js +4 -2
- package/dist/internal/components/connect-dialog.d.ts +8 -1
- package/dist/internal/components/connect-dialog.js +23 -10
- package/dist/internal/components/connect-panel.d.ts +3 -2
- package/dist/internal/components/connect-panel.js +680 -340
- package/dist/internal/components/connect-steps.d.ts +72 -0
- package/dist/internal/components/connect-steps.js +341 -0
- package/dist/internal/components/console-not-found.d.ts +14 -0
- package/dist/internal/components/console-not-found.js +57 -0
- package/dist/internal/components/dashboard-grid.d.ts +10 -5
- package/dist/internal/components/dashboard-grid.js +8 -9
- package/dist/internal/components/dev-toolbar.d.ts +27 -5
- package/dist/internal/components/dev-toolbar.js +214 -176
- package/dist/internal/components/ekanos-logo.d.ts +18 -0
- package/dist/internal/components/ekanos-logo.js +74 -0
- package/dist/internal/components/events-panel.d.ts +13 -4
- package/dist/internal/components/events-panel.js +478 -81
- package/dist/internal/components/harness-widget-provider.d.ts +6 -8
- package/dist/internal/components/harness-widget-provider.js +5 -19
- package/dist/internal/components/health-panel.d.ts +8 -1
- package/dist/internal/components/health-panel.js +328 -31
- package/dist/internal/components/integration-badge.js +4 -2
- package/dist/internal/components/integration-tab-skeletons.d.ts +8 -0
- package/dist/internal/components/integration-tab-skeletons.js +76 -0
- package/dist/internal/components/not-found-state.d.ts +39 -0
- package/dist/internal/components/not-found-state.js +127 -0
- package/dist/internal/components/operation-runner-panel.d.ts +1 -1
- package/dist/internal/components/operation-runner-panel.js +624 -189
- package/dist/internal/components/operation-scope.d.ts +13 -0
- package/dist/internal/components/operation-scope.js +79 -0
- package/dist/internal/components/page-skeletons.d.ts +11 -0
- package/dist/internal/components/page-skeletons.js +61 -0
- package/dist/internal/components/provenance-banner.d.ts +13 -4
- package/dist/internal/components/provenance-banner.js +35 -10
- package/dist/internal/components/run-log-copy.d.ts +17 -0
- package/dist/internal/components/run-log-copy.js +67 -0
- package/dist/internal/components/run-log-detail.d.ts +22 -0
- package/dist/internal/components/run-log-detail.js +295 -0
- package/dist/internal/components/run-log-empty.d.ts +13 -0
- package/dist/internal/components/run-log-empty.js +46 -0
- package/dist/internal/components/run-log.d.ts +23 -3
- package/dist/internal/components/run-log.js +384 -130
- package/dist/internal/components/runtime-strip.d.ts +5 -1
- package/dist/internal/components/runtime-strip.js +82 -5
- package/dist/internal/components/schema-form.d.ts +2 -1
- package/dist/internal/components/schema-form.js +212 -79
- package/dist/internal/components/scrollable-nav.js +14 -2
- package/dist/internal/components/segmented-control.d.ts +19 -0
- package/dist/internal/components/segmented-control.js +46 -0
- package/dist/internal/components/shell-header.d.ts +25 -0
- package/dist/internal/components/shell-header.js +126 -0
- package/dist/internal/components/surface-nav.d.ts +12 -4
- package/dist/internal/components/surface-nav.js +79 -80
- package/dist/internal/components/widget-surface.d.ts +5 -1
- package/dist/internal/components/widget-surface.js +86 -14
- package/dist/internal/components/workflow-runner.d.ts +23 -10
- package/dist/internal/components/workflow-runner.js +451 -69
- package/dist/internal/lib/connect-model.d.ts +134 -0
- package/dist/internal/lib/connect-model.js +282 -0
- package/dist/internal/lib/connection-facts.js +2 -1
- package/dist/internal/lib/console-client.js +5 -2
- package/dist/internal/lib/console-hooks.d.ts +4 -1
- package/dist/internal/lib/console-hooks.js +3 -2
- package/dist/internal/lib/console-types.d.ts +6 -0
- package/dist/internal/lib/docs-links.d.ts +27 -0
- package/dist/internal/lib/docs-links.js +55 -1
- package/dist/internal/lib/event-delivery.d.ts +33 -0
- package/dist/internal/lib/event-delivery.js +66 -0
- package/dist/internal/lib/font-files/OFL-BricolageGrotesque.txt +93 -0
- package/dist/internal/lib/font-files/OFL-Figtree.txt +93 -0
- package/dist/internal/lib/font-files/bricolage-grotesque-latin-variable.woff2 +0 -0
- package/dist/internal/lib/font-files/figtree-latin-variable.woff2 +0 -0
- package/dist/internal/lib/fonts.js +13 -12
- package/dist/internal/lib/health-model.d.ts +58 -0
- package/dist/internal/lib/health-model.js +140 -0
- package/dist/internal/lib/integration-console-href.d.ts +5 -0
- package/dist/internal/lib/integration-console-href.js +7 -1
- package/dist/internal/lib/oauth-setup-guide.d.ts +28 -0
- package/dist/internal/lib/oauth-setup-guide.js +35 -1
- package/dist/internal/lib/operation-catalog.d.ts +70 -0
- package/dist/internal/lib/operation-catalog.js +261 -0
- package/dist/internal/lib/overview-model.d.ts +34 -0
- package/dist/internal/lib/overview-model.js +91 -0
- package/dist/internal/lib/registry-entry.d.ts +8 -0
- package/dist/internal/lib/registry-entry.js +11 -0
- package/dist/internal/lib/repo-name.d.ts +9 -0
- package/dist/internal/lib/repo-name.js +21 -0
- package/dist/internal/lib/run-log-view.d.ts +66 -1
- package/dist/internal/lib/run-log-view.js +183 -4
- package/dist/internal/lib/runner-view.d.ts +15 -0
- package/dist/internal/lib/runner-view.js +18 -0
- package/dist/internal/lib/schema-form-model.d.ts +17 -0
- package/dist/internal/lib/schema-form-model.js +50 -0
- package/dist/internal/lib/setup-checklist.d.ts +34 -0
- package/dist/internal/lib/setup-checklist.js +79 -0
- package/dist/internal/lib/toolbar-context.d.ts +0 -1
- package/dist/internal/lib/toolbar-context.js +0 -2
- package/dist/internal/lib/toolbar-visibility.d.ts +9 -2
- package/dist/internal/lib/toolbar-visibility.js +5 -0
- package/dist/internal/lib/use-operation-effects.d.ts +7 -0
- package/dist/internal/lib/use-operation-effects.js +28 -0
- package/dist/internal/lib/use-run-log-query.d.ts +9 -0
- package/dist/internal/lib/use-run-log-query.js +35 -0
- package/dist/internal/lib/widget-grid-gaps.d.ts +18 -0
- package/dist/internal/lib/widget-grid-gaps.js +41 -0
- package/dist/internal/lib/workflow-summary.d.ts +54 -0
- package/dist/internal/lib/workflow-summary.js +147 -0
- package/dist/internal/routes/console-home-page.js +2 -1
- package/dist/internal/routes/experience-connect-page.js +46 -17
- package/dist/internal/routes/experience-layout-page.d.ts +6 -6
- package/dist/internal/routes/experience-layout-page.js +3 -119
- package/dist/internal/routes/experience-page-host.js +61 -5
- package/dist/internal/routes/experience-pages-page.d.ts +5 -0
- package/dist/internal/routes/experience-pages-page.js +118 -0
- package/dist/internal/routes/experience-review-queue-page.d.ts +4 -1
- package/dist/internal/routes/experience-review-queue-page.js +108 -12
- package/dist/internal/routes/experience-runs-page.js +57 -4
- package/dist/internal/routes/experience-summary-page.d.ts +19 -0
- package/dist/internal/routes/experience-summary-page.js +212 -52
- package/dist/internal/routes/experience-widget-page.js +58 -7
- package/dist/internal/routes/experience-widgets-page.d.ts +2 -3
- package/dist/internal/routes/experience-widgets-page.js +29 -4
- package/dist/internal/routes/experience-workflow-page.js +81 -9
- package/dist/internal/routes/experience-workflows-page.js +85 -21
- package/dist/internal/routes/integration-layout.js +28 -3
- package/dist/internal/routes/integrations-connect-page.js +16 -6
- package/dist/internal/routes/integrations-events-page.js +22 -1
- package/dist/internal/routes/integrations-health-page.js +16 -1
- package/dist/internal/routes/integrations-layout.js +28 -4
- package/dist/internal/routes/integrations-list-page.d.ts +0 -1
- package/dist/internal/routes/integrations-list-page.js +11 -9
- package/dist/internal/routes/integrations-operation-page.js +53 -17
- package/dist/internal/routes/integrations-operations-page.js +539 -49
- package/dist/internal/routes/integrations-overview-page.js +332 -69
- package/dist/internal/routes/integrations-runs-page.js +53 -3
- package/dist/internal/routes/integrations-scope.d.ts +15 -2
- package/dist/internal/routes/integrations-scope.js +66 -18
- package/dist/internal/routes/preview-index-page.js +2 -2
- package/dist/internal/routes/repo-home-page.d.ts +2 -2
- package/dist/internal/routes/repo-home-page.js +429 -236
- package/dist/internal/routes/repo-layout.d.ts +12 -0
- package/dist/internal/routes/repo-layout.js +50 -38
- package/dist/internal/routes/repo-package-layouts.js +22 -8
- package/dist/internal/routes/single-widget-page.d.ts +1 -1
- package/dist/internal/routes/single-widget-page.js +28 -5
- package/dist/internal/routes/tile-page.d.ts +1 -1
- package/dist/internal/routes/tile-page.js +1 -2
- package/dist/internal/routes/widgets-page.d.ts +1 -1
- package/dist/internal/routes/widgets-page.js +5 -3
- package/dist/registry.d.ts +4 -5
- package/dist/registry.js +0 -1
- package/dist/routes.d.ts +8 -1
- package/dist/routes.js +4 -0
- package/package.json +14 -14
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
const RUN_PAGE_SIZE = 50;
|
|
2
|
+
const RUN_LOG_KEEPS = 200;
|
|
2
3
|
const RUN_OUTCOMES = [
|
|
3
4
|
"ok",
|
|
4
|
-
"refused",
|
|
5
5
|
"failed",
|
|
6
|
+
"refused",
|
|
6
7
|
"held"
|
|
7
8
|
];
|
|
9
|
+
const RUN_OUTCOME_LABELS = {
|
|
10
|
+
ok: "OK",
|
|
11
|
+
failed: "Failed",
|
|
12
|
+
refused: "Refused",
|
|
13
|
+
held: "Held"
|
|
14
|
+
};
|
|
8
15
|
const HELD_REASONS = /* @__PURE__ */ new Set([
|
|
9
16
|
"write_not_approved",
|
|
10
17
|
"write_refused_on_channel",
|
|
@@ -37,10 +44,80 @@ const REASON_EXPLANATIONS = {
|
|
|
37
44
|
function explainRunReason(reason) {
|
|
38
45
|
return reason ? REASON_EXPLANATIONS[reason] ?? null : null;
|
|
39
46
|
}
|
|
40
|
-
|
|
47
|
+
function explainRun(run) {
|
|
48
|
+
const known = explainRunReason(run.reason);
|
|
49
|
+
if (known) return known;
|
|
50
|
+
if (run.status === "ok") return null;
|
|
51
|
+
if (runKind(run) === "event") {
|
|
52
|
+
return run.status === "refused" ? "The payload didn't match the event's schema in the contract, so nothing was delivered." : "The integration's webhook handler threw while handling the event.";
|
|
53
|
+
}
|
|
54
|
+
return run.status === "error" ? "The operation ran and failed." : "The harness refused the call before it ran.";
|
|
55
|
+
}
|
|
56
|
+
function runKind(run) {
|
|
57
|
+
return run.opKey.startsWith("event/") ? "event" : "operation";
|
|
58
|
+
}
|
|
59
|
+
function splitOpKey(opKey) {
|
|
60
|
+
const slash = opKey.indexOf("/");
|
|
61
|
+
return slash === -1 ? { kind: "", name: opKey } : { kind: opKey.slice(0, slash), name: opKey.slice(slash + 1) };
|
|
62
|
+
}
|
|
63
|
+
function runTargetHref(consoleHref, opKey) {
|
|
64
|
+
if (!consoleHref) return null;
|
|
65
|
+
const { kind, name } = splitOpKey(opKey);
|
|
66
|
+
if (!name) return null;
|
|
67
|
+
if (kind === "event") {
|
|
68
|
+
return `${consoleHref}/events?event=${encodeURIComponent(name)}`;
|
|
69
|
+
}
|
|
70
|
+
if (kind === "tool" || kind === "action") {
|
|
71
|
+
return `${consoleHref}/operations/${kind}/${encodeURIComponent(name)}`;
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
const CHANNEL_WORDS = {
|
|
76
|
+
http: "A call to the harness's HTTP API",
|
|
77
|
+
rsc: "A server render of a widget or page",
|
|
78
|
+
workflow: "A workflow step",
|
|
79
|
+
interactive: "A person's click in a widget or page"
|
|
80
|
+
};
|
|
81
|
+
function describeRunSource(run) {
|
|
82
|
+
const origin = run.origin ?? "";
|
|
83
|
+
if (origin === "console") return "The operation runner in this console";
|
|
84
|
+
if (origin === "events/emit") return "A test event sent from the Events tab";
|
|
85
|
+
if (origin === "review-queue") return "The review queue";
|
|
86
|
+
if (origin.startsWith("workflow:")) {
|
|
87
|
+
const [workflow, step] = origin.slice("workflow:".length).split("/");
|
|
88
|
+
return step ? `Workflow ${workflow}, step ${step}` : `Workflow ${workflow ?? ""}`.trim();
|
|
89
|
+
}
|
|
90
|
+
return CHANNEL_WORDS[run.channel] ?? run.channel;
|
|
91
|
+
}
|
|
92
|
+
const MODE_WORDS = {
|
|
93
|
+
fixtures: "Fixtures: recorded responses, no network",
|
|
94
|
+
live: "Live: the integration's real API"
|
|
95
|
+
};
|
|
96
|
+
function formatBytes(bytes) {
|
|
97
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
98
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
99
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
100
|
+
}
|
|
101
|
+
function formatDuration(ms) {
|
|
102
|
+
if (ms < 1e3) return `${Math.round(ms)} ms`;
|
|
103
|
+
return `${(ms / 1e3).toFixed(ms < 1e4 ? 2 : 1)} s`;
|
|
104
|
+
}
|
|
105
|
+
const NO_RUN_FILTER = {
|
|
106
|
+
outcome: "all",
|
|
107
|
+
integration: "all",
|
|
108
|
+
mode: "all",
|
|
109
|
+
kind: "all",
|
|
110
|
+
q: ""
|
|
111
|
+
};
|
|
112
|
+
function isFiltered(filter) {
|
|
113
|
+
return filter.outcome !== "all" || filter.integration !== "all" || (filter.mode ?? "all") !== "all" || (filter.kind ?? "all") !== "all" || (filter.q ?? "").trim() !== "";
|
|
114
|
+
}
|
|
41
115
|
function filterRuns(runs, filter) {
|
|
116
|
+
const mode = filter.mode ?? "all";
|
|
117
|
+
const kind = filter.kind ?? "all";
|
|
118
|
+
const q = (filter.q ?? "").trim().toLowerCase();
|
|
42
119
|
return runs.filter(
|
|
43
|
-
(run) => (filter.outcome === "all" || runOutcome(run) === filter.outcome) && (filter.integration === "all" || run.integration === filter.integration)
|
|
120
|
+
(run) => (filter.outcome === "all" || runOutcome(run) === filter.outcome) && (filter.integration === "all" || run.integration === filter.integration) && (mode === "all" || run.mode === mode) && (kind === "all" || runKind(run) === kind) && (q === "" || run.opKey.toLowerCase().includes(q))
|
|
44
121
|
).slice().reverse();
|
|
45
122
|
}
|
|
46
123
|
function pageRuns(rows, limit) {
|
|
@@ -49,12 +126,114 @@ function pageRuns(rows, limit) {
|
|
|
49
126
|
remaining: Math.max(0, rows.length - limit)
|
|
50
127
|
};
|
|
51
128
|
}
|
|
129
|
+
function countOutcomes(runs) {
|
|
130
|
+
const counts = {
|
|
131
|
+
ok: 0,
|
|
132
|
+
failed: 0,
|
|
133
|
+
refused: 0,
|
|
134
|
+
held: 0
|
|
135
|
+
};
|
|
136
|
+
for (const run of runs) counts[runOutcome(run)] += 1;
|
|
137
|
+
return counts;
|
|
138
|
+
}
|
|
139
|
+
function isOneOf(value, options) {
|
|
140
|
+
return value !== null && options.includes(value);
|
|
141
|
+
}
|
|
142
|
+
function parseRunQuery(params) {
|
|
143
|
+
const outcome = params.get("outcome");
|
|
144
|
+
const mode = params.get("mode");
|
|
145
|
+
const kind = params.get("kind");
|
|
146
|
+
return {
|
|
147
|
+
filter: {
|
|
148
|
+
outcome: isOneOf(outcome, RUN_OUTCOMES) ? outcome : "all",
|
|
149
|
+
integration: params.get("integration") || "all",
|
|
150
|
+
mode: isOneOf(mode, ["fixtures", "live"]) ? mode : "all",
|
|
151
|
+
kind: isOneOf(kind, ["operation", "event"]) ? kind : "all",
|
|
152
|
+
q: params.get("q") ?? ""
|
|
153
|
+
},
|
|
154
|
+
run: params.get("run") || null
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function runQueryString(query) {
|
|
158
|
+
const params = new URLSearchParams();
|
|
159
|
+
const { filter } = query;
|
|
160
|
+
if (filter.outcome !== "all") params.set("outcome", filter.outcome);
|
|
161
|
+
if (filter.kind && filter.kind !== "all") params.set("kind", filter.kind);
|
|
162
|
+
if (filter.mode && filter.mode !== "all") params.set("mode", filter.mode);
|
|
163
|
+
if (filter.integration !== "all") {
|
|
164
|
+
params.set("integration", filter.integration);
|
|
165
|
+
}
|
|
166
|
+
if (filter.q && filter.q.trim() !== "") params.set("q", filter.q);
|
|
167
|
+
if (query.run) params.set("run", query.run);
|
|
168
|
+
const text = params.toString();
|
|
169
|
+
return text ? `?${text}` : "";
|
|
170
|
+
}
|
|
171
|
+
function runLogHref(base, options) {
|
|
172
|
+
return `${base}/runs${runQueryString({
|
|
173
|
+
filter: options.event ? { ...NO_RUN_FILTER, kind: "event", q: options.event } : NO_RUN_FILTER,
|
|
174
|
+
run: options.run ?? null
|
|
175
|
+
})}`;
|
|
176
|
+
}
|
|
177
|
+
function dayKey(date) {
|
|
178
|
+
return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
|
|
179
|
+
}
|
|
180
|
+
function groupRunsByDay(runs, now = /* @__PURE__ */ new Date()) {
|
|
181
|
+
const today = dayKey(now);
|
|
182
|
+
const yesterday = dayKey(
|
|
183
|
+
new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1)
|
|
184
|
+
);
|
|
185
|
+
const days = [];
|
|
186
|
+
for (const run of runs) {
|
|
187
|
+
const date = new Date(run.ts);
|
|
188
|
+
const key = dayKey(date);
|
|
189
|
+
let day = days.at(-1);
|
|
190
|
+
if (!day || day.key !== key) {
|
|
191
|
+
day = {
|
|
192
|
+
key,
|
|
193
|
+
label: key === today ? "Today" : key === yesterday ? "Yesterday" : date.toLocaleDateString(void 0, {
|
|
194
|
+
weekday: "short",
|
|
195
|
+
month: "short",
|
|
196
|
+
day: "numeric"
|
|
197
|
+
}),
|
|
198
|
+
runs: []
|
|
199
|
+
};
|
|
200
|
+
days.push(day);
|
|
201
|
+
}
|
|
202
|
+
day.runs.push(run);
|
|
203
|
+
}
|
|
204
|
+
return days;
|
|
205
|
+
}
|
|
206
|
+
function runNeighbours(rows, id) {
|
|
207
|
+
const index = id ? rows.findIndex((row) => row.id === id) : -1;
|
|
208
|
+
return {
|
|
209
|
+
index,
|
|
210
|
+
newer: index > 0 ? rows[index - 1] ?? null : null,
|
|
211
|
+
older: index >= 0 ? rows[index + 1] ?? null : null
|
|
212
|
+
};
|
|
213
|
+
}
|
|
52
214
|
export {
|
|
215
|
+
MODE_WORDS,
|
|
53
216
|
NO_RUN_FILTER,
|
|
217
|
+
RUN_LOG_KEEPS,
|
|
54
218
|
RUN_OUTCOMES,
|
|
219
|
+
RUN_OUTCOME_LABELS,
|
|
55
220
|
RUN_PAGE_SIZE,
|
|
221
|
+
countOutcomes,
|
|
222
|
+
describeRunSource,
|
|
223
|
+
explainRun,
|
|
56
224
|
explainRunReason,
|
|
57
225
|
filterRuns,
|
|
226
|
+
formatBytes,
|
|
227
|
+
formatDuration,
|
|
228
|
+
groupRunsByDay,
|
|
229
|
+
isFiltered,
|
|
58
230
|
pageRuns,
|
|
59
|
-
|
|
231
|
+
parseRunQuery,
|
|
232
|
+
runKind,
|
|
233
|
+
runLogHref,
|
|
234
|
+
runNeighbours,
|
|
235
|
+
runOutcome,
|
|
236
|
+
runQueryString,
|
|
237
|
+
runTargetHref,
|
|
238
|
+
splitOpKey
|
|
60
239
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RunMode, ScenarioVariant } from './console-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a fixtures run answered with the contract's `outputExample` rather
|
|
4
|
+
* than a scenario fixture of its own. The server falls back to the example
|
|
5
|
+
* when no `<op>.<scenario>.json` exists and does not say so, so the console
|
|
6
|
+
* infers it by comparing the body with the example.
|
|
7
|
+
*/
|
|
8
|
+
export declare function answeredFromExample({ mode, variant, output, example, }: {
|
|
9
|
+
mode: RunMode;
|
|
10
|
+
variant: ScenarioVariant;
|
|
11
|
+
output: unknown;
|
|
12
|
+
example: unknown;
|
|
13
|
+
}): boolean;
|
|
14
|
+
/** The fixture file a scenario reads: `tool/list_issues`, `empty` → `tool-list_issues.empty.json`. */
|
|
15
|
+
export declare function fixtureFileName(opKey: string, variant: ScenarioVariant): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function answeredFromExample({
|
|
2
|
+
mode,
|
|
3
|
+
variant,
|
|
4
|
+
output,
|
|
5
|
+
example
|
|
6
|
+
}) {
|
|
7
|
+
if (mode !== "fixtures" || variant === "error" || example === void 0) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return JSON.stringify(output) === JSON.stringify(example);
|
|
11
|
+
}
|
|
12
|
+
function fixtureFileName(opKey, variant) {
|
|
13
|
+
return `${opKey.replace("/", "-")}.${variant}.json`;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
answeredFromExample,
|
|
17
|
+
fixtureFileName
|
|
18
|
+
};
|
|
@@ -18,6 +18,23 @@ export declare function objectProperties(schema: JsonSchema): Array<{
|
|
|
18
18
|
schema: JsonSchema;
|
|
19
19
|
required: boolean;
|
|
20
20
|
}>;
|
|
21
|
+
/** An object input with no declared properties: nothing to fill or edit. */
|
|
22
|
+
export declare function takesNoInput(schema: JsonSchema): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The short type a field's label shows: the `format` when there is one
|
|
25
|
+
* (`uuid`, `date-time`), else the JSON type; `string[]` for an array, `enum`
|
|
26
|
+
* for a fixed set, `| null` when null is allowed. Null for raw-JSON nodes.
|
|
27
|
+
*/
|
|
28
|
+
export declare function typeLabel(input: JsonSchema): string | null;
|
|
29
|
+
/** Whether a field holds something a person set: not unset, blank or empty. */
|
|
30
|
+
export declare function hasValue(value: unknown): boolean;
|
|
31
|
+
/** Past this many optional fields, the form folds them under one disclosure. */
|
|
32
|
+
export declare const OPTIONAL_FOLD_AFTER = 6;
|
|
33
|
+
/** Required properties first, then optional, each keeping schema order. */
|
|
34
|
+
export declare function orderedProperties(schema: JsonSchema): {
|
|
35
|
+
required: ReturnType<typeof objectProperties>;
|
|
36
|
+
optional: ReturnType<typeof objectProperties>;
|
|
37
|
+
};
|
|
21
38
|
/** A starting value: schema default, first example, else a type skeleton. */
|
|
22
39
|
export declare function initialValue(input: JsonSchema): unknown;
|
|
23
40
|
/** Issues keyed by JSON-pointer path; `''` is the root. */
|
|
@@ -69,6 +69,47 @@ function objectProperties(schema) {
|
|
|
69
69
|
return child ? [{ key, schema: child, required: required.has(key) }] : [];
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
+
function takesNoInput(schema) {
|
|
73
|
+
const shape = classify(schema);
|
|
74
|
+
return shape.kind === "object" && objectProperties(shape.schema).length === 0;
|
|
75
|
+
}
|
|
76
|
+
function typeLabel(input) {
|
|
77
|
+
const { kind, nullable, schema } = classify(input);
|
|
78
|
+
const base = (() => {
|
|
79
|
+
switch (kind) {
|
|
80
|
+
case "unsupported":
|
|
81
|
+
return null;
|
|
82
|
+
case "enum":
|
|
83
|
+
return "enum";
|
|
84
|
+
case "array": {
|
|
85
|
+
const item = typeLabel(asRecord(schema.items) ?? {});
|
|
86
|
+
return item && !item.includes(" ") ? `${item}[]` : "array";
|
|
87
|
+
}
|
|
88
|
+
case "string":
|
|
89
|
+
return typeof schema.format === "string" ? schema.format : "string";
|
|
90
|
+
default:
|
|
91
|
+
return kind;
|
|
92
|
+
}
|
|
93
|
+
})();
|
|
94
|
+
if (base === null) return null;
|
|
95
|
+
return nullable ? `${base} | null` : base;
|
|
96
|
+
}
|
|
97
|
+
function hasValue(value) {
|
|
98
|
+
if (value === void 0 || value === "") return false;
|
|
99
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
100
|
+
if (typeof value === "object" && value !== null) {
|
|
101
|
+
return Object.values(value).some(hasValue);
|
|
102
|
+
}
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
const OPTIONAL_FOLD_AFTER = 6;
|
|
106
|
+
function orderedProperties(schema) {
|
|
107
|
+
const all = objectProperties(schema);
|
|
108
|
+
return {
|
|
109
|
+
required: all.filter((property) => property.required),
|
|
110
|
+
optional: all.filter((property) => !property.required)
|
|
111
|
+
};
|
|
112
|
+
}
|
|
72
113
|
function initialValue(input) {
|
|
73
114
|
if ("default" in input) return input.default;
|
|
74
115
|
const examples = asArray(input.examples);
|
|
@@ -104,6 +145,10 @@ function check(input, value, path, issues) {
|
|
|
104
145
|
}
|
|
105
146
|
return;
|
|
106
147
|
}
|
|
148
|
+
if (value === void 0) {
|
|
149
|
+
if (kind !== "unsupported") issues.push({ path, message: "needs a value" });
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
107
152
|
const enumValues = asArray(schema.enum);
|
|
108
153
|
if (enumValues) {
|
|
109
154
|
if (!enumValues.some((entry) => entry === value)) {
|
|
@@ -262,11 +307,16 @@ function formatJson(value) {
|
|
|
262
307
|
return value === void 0 ? "" : JSON.stringify(value, null, 2);
|
|
263
308
|
}
|
|
264
309
|
export {
|
|
310
|
+
OPTIONAL_FOLD_AFTER,
|
|
265
311
|
classify,
|
|
266
312
|
formatJson,
|
|
313
|
+
hasValue,
|
|
267
314
|
initialValue,
|
|
268
315
|
issuesByPath,
|
|
269
316
|
objectProperties,
|
|
317
|
+
orderedProperties,
|
|
270
318
|
parseJsonText,
|
|
319
|
+
takesNoInput,
|
|
320
|
+
typeLabel,
|
|
271
321
|
validateValue
|
|
272
322
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { IntegrationConnectionFacts, RepoResponse } from '../../api-types.js';
|
|
2
|
+
/** `vastly-dev/linear` -> `linear`: the name a person reads. */
|
|
3
|
+
export declare function shortName(id: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* The key names a not-connected detail lists, from either server wording:
|
|
6
|
+
* `Save the app keys first: a, b` (OAuth) or `Missing a, b` (API keys).
|
|
7
|
+
*/
|
|
8
|
+
export declare function missingKeys(detail: string | undefined): string[];
|
|
9
|
+
/**
|
|
10
|
+
* `6 app keys to save` for an OAuth app, where not every key gates the first
|
|
11
|
+
* connection, and `1 key needed` for API keys; null when none are missing.
|
|
12
|
+
*/
|
|
13
|
+
export declare function keysNeededLabel(facts: Pick<IntegrationConnectionFacts, 'kind' | 'detail'> | null): string | null;
|
|
14
|
+
/** Whether an integration has anything for the developer to connect here. */
|
|
15
|
+
export declare function needsConnecting(facts: IntegrationConnectionFacts | null): boolean;
|
|
16
|
+
/** What connecting an integration takes, in one line: `OAuth · 6 app keys to save, then sign in`. */
|
|
17
|
+
export declare function connectHint(facts: IntegrationConnectionFacts): string;
|
|
18
|
+
export interface SetupStep {
|
|
19
|
+
id: string;
|
|
20
|
+
kind: 'integration' | 'experience';
|
|
21
|
+
name: string;
|
|
22
|
+
done: boolean;
|
|
23
|
+
title: string;
|
|
24
|
+
hint: string;
|
|
25
|
+
/** The page that finishes the step. */
|
|
26
|
+
href: string;
|
|
27
|
+
actionLabel: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The repo home's "Get set up" list, derived from the repo's real state: one
|
|
31
|
+
* step per integration with something to connect, one per experience whose
|
|
32
|
+
* integrations are not all ready. A step is done when its state says so.
|
|
33
|
+
*/
|
|
34
|
+
export declare function setupSteps(repo: Pick<RepoResponse, 'integrations' | 'experiences'>): SetupStep[];
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { CONNECTION_KIND_LABEL, isReady, targetLine } from "./connection-facts.js";
|
|
2
|
+
function shortName(id) {
|
|
3
|
+
return id.slice(id.lastIndexOf("/") + 1);
|
|
4
|
+
}
|
|
5
|
+
function missingKeys(detail) {
|
|
6
|
+
if (!detail) return [];
|
|
7
|
+
const match = /^(?:Save the app keys first:|Missing)\s+(.+)$/.exec(detail);
|
|
8
|
+
if (!match?.[1]) return [];
|
|
9
|
+
return match[1].split(",").map((key) => key.trim()).filter(Boolean);
|
|
10
|
+
}
|
|
11
|
+
function keysNeededLabel(facts) {
|
|
12
|
+
const count = missingKeys(facts?.detail).length;
|
|
13
|
+
if (count === 0) return null;
|
|
14
|
+
const plural = count === 1 ? "" : "s";
|
|
15
|
+
return facts?.kind === "oauth" ? `${count} app key${plural} to save` : `${count} key${plural} needed`;
|
|
16
|
+
}
|
|
17
|
+
function needsConnecting(facts) {
|
|
18
|
+
return facts !== null && facts.kind !== "none" && facts.state !== "managed" && facts.state !== "no_connection_needed";
|
|
19
|
+
}
|
|
20
|
+
function connectHint(facts) {
|
|
21
|
+
if (facts.state === "connected") {
|
|
22
|
+
return targetLine(facts) ?? "Connected";
|
|
23
|
+
}
|
|
24
|
+
if (facts.state === "unreadable") {
|
|
25
|
+
return "The harness could not read its stored credentials";
|
|
26
|
+
}
|
|
27
|
+
const keys = keysNeededLabel(facts);
|
|
28
|
+
const kind = CONNECTION_KIND_LABEL[facts.kind];
|
|
29
|
+
if (facts.kind === "oauth") {
|
|
30
|
+
return keys ? `${kind} \xB7 ${keys}, then sign in` : `${kind} \xB7 sign in`;
|
|
31
|
+
}
|
|
32
|
+
return keys ? `${kind} \xB7 ${keys}` : kind;
|
|
33
|
+
}
|
|
34
|
+
function integrationStep(row) {
|
|
35
|
+
const facts = row.connection?.facts ?? null;
|
|
36
|
+
if (!facts || !needsConnecting(facts)) return null;
|
|
37
|
+
const done = facts.state === "connected";
|
|
38
|
+
return {
|
|
39
|
+
id: `integration-${row.name}`,
|
|
40
|
+
kind: "integration",
|
|
41
|
+
name: row.name,
|
|
42
|
+
done,
|
|
43
|
+
title: done ? `${row.name} is connected` : `Connect ${row.name}`,
|
|
44
|
+
hint: connectHint(facts),
|
|
45
|
+
href: `${row.consoleHref}/connect`,
|
|
46
|
+
actionLabel: "Connect"
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function experienceStep(row) {
|
|
50
|
+
if (row.integrations.length === 0) return null;
|
|
51
|
+
const waiting = row.integrations.filter(
|
|
52
|
+
(used) => !isReady(used.connection?.facts ?? null)
|
|
53
|
+
);
|
|
54
|
+
const done = waiting.length === 0;
|
|
55
|
+
return {
|
|
56
|
+
id: `experience-${row.name}`,
|
|
57
|
+
kind: "experience",
|
|
58
|
+
name: row.name,
|
|
59
|
+
done,
|
|
60
|
+
title: done ? `${row.name} is ready to run live` : `Get ${row.name} ready`,
|
|
61
|
+
hint: done ? `All ${row.integrations.length} of its integrations are ready` : `Waiting on ${waiting.map((used) => shortName(used.name)).join(", ")}`,
|
|
62
|
+
href: row.connectHref,
|
|
63
|
+
actionLabel: "Open checklist"
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function setupSteps(repo) {
|
|
67
|
+
return [
|
|
68
|
+
...repo.integrations.flatMap((row) => integrationStep(row) ?? []),
|
|
69
|
+
...repo.experiences.flatMap((row) => experienceStep(row) ?? [])
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
connectHint,
|
|
74
|
+
keysNeededLabel,
|
|
75
|
+
missingKeys,
|
|
76
|
+
needsConnecting,
|
|
77
|
+
setupSteps,
|
|
78
|
+
shortName
|
|
79
|
+
};
|
|
@@ -38,7 +38,6 @@ export interface ToolbarState {
|
|
|
38
38
|
dataMode: DataMode | null;
|
|
39
39
|
variant: FixtureVariant;
|
|
40
40
|
viewport: ViewportKey;
|
|
41
|
-
collapsed: boolean;
|
|
42
41
|
/**
|
|
43
42
|
* Simulates an integration whose health probe is failing after having
|
|
44
43
|
* previously succeeded — the one condition that makes
|
|
@@ -34,7 +34,6 @@ const DEFAULT_STATE = {
|
|
|
34
34
|
dataMode: null,
|
|
35
35
|
variant: "default",
|
|
36
36
|
viewport: "full",
|
|
37
|
-
collapsed: false,
|
|
38
37
|
unhealthy: false
|
|
39
38
|
};
|
|
40
39
|
const STORAGE_KEY = "fusion-harness-toolbar-v2";
|
|
@@ -65,7 +64,6 @@ function readStored() {
|
|
|
65
64
|
dataMode: isDataMode(candidate.dataMode) ? candidate.dataMode : DEFAULT_STATE.dataMode,
|
|
66
65
|
variant: isVariant(candidate.variant) ? candidate.variant : DEFAULT_STATE.variant,
|
|
67
66
|
viewport: isViewport(candidate.viewport) ? candidate.viewport : DEFAULT_STATE.viewport,
|
|
68
|
-
collapsed: typeof candidate.collapsed === "boolean" ? candidate.collapsed : DEFAULT_STATE.collapsed,
|
|
69
67
|
unhealthy: typeof candidate.unhealthy === "boolean" ? candidate.unhealthy : DEFAULT_STATE.unhealthy
|
|
70
68
|
};
|
|
71
69
|
} catch (error) {
|
|
@@ -2,15 +2,22 @@
|
|
|
2
2
|
* Which dev-toolbar controls a page earns. Pure, so it is testable without a
|
|
3
3
|
* DOM.
|
|
4
4
|
*
|
|
5
|
-
* Render state, fixture scenario, viewport
|
|
5
|
+
* Render state, fixture scenario, viewport and unhealthy drive the
|
|
6
6
|
* widget machinery, so they appear only where widgets render: an experience's
|
|
7
7
|
* Widgets tab and an integration's Preview surfaces. The Data switch also
|
|
8
8
|
* reaches the Triggers surface.
|
|
9
9
|
*/
|
|
10
10
|
export interface ToolbarControls {
|
|
11
|
-
/** Render state, fixture scenario, viewport,
|
|
11
|
+
/** Render state, fixture scenario, viewport, unhealthy. */
|
|
12
12
|
widget: boolean;
|
|
13
13
|
/** The global Data switch (fixtures or live API). */
|
|
14
14
|
data: boolean;
|
|
15
15
|
}
|
|
16
16
|
export declare function toolbarControlsFor(pathname: string): ToolbarControls;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the page draws the preview controls itself, inline above its widget
|
|
19
|
+
* grid: an experience's Widgets tab and an integration's Preview widgets. The
|
|
20
|
+
* top-of-page band is then left out, so the controls sit next to the widgets
|
|
21
|
+
* they change rather than above the page heading.
|
|
22
|
+
*/
|
|
23
|
+
export declare function rendersInlineControls(pathname: string): boolean;
|
|
@@ -26,6 +26,11 @@ function toolbarControlsFor(pathname) {
|
|
|
26
26
|
const widget = isExperienceWidgets(segments) || surface !== null && PREVIEW_WIDGET_SURFACES.has(surface);
|
|
27
27
|
return { widget, data: widget || surface === "triggers" };
|
|
28
28
|
}
|
|
29
|
+
function rendersInlineControls(pathname) {
|
|
30
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
31
|
+
return isExperienceWidgets(segments) || previewSurface(segments) === "widgets";
|
|
32
|
+
}
|
|
29
33
|
export {
|
|
34
|
+
rendersInlineControls,
|
|
30
35
|
toolbarControlsFor
|
|
31
36
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EffectOf } from './workflow-summary.js';
|
|
2
|
+
/**
|
|
3
|
+
* Read or write for each operation of the given integrations, from their
|
|
4
|
+
* contracts (the same cache the console's own pages read). Unknown until a
|
|
5
|
+
* contract loads, and for an integration whose contract cannot be read.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useOperationEffects(integrations: readonly string[]): EffectOf;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQueries } from "@tanstack/react-query";
|
|
3
|
+
import { useConsoleClient } from "./console-context.js";
|
|
4
|
+
import { consoleKeys } from "./console-hooks.js";
|
|
5
|
+
function useOperationEffects(integrations) {
|
|
6
|
+
const client = useConsoleClient();
|
|
7
|
+
const contracts = useQueries({
|
|
8
|
+
queries: integrations.map((integration) => ({
|
|
9
|
+
queryKey: consoleKeys.contract(integration),
|
|
10
|
+
queryFn: () => client.getContract(integration)
|
|
11
|
+
}))
|
|
12
|
+
});
|
|
13
|
+
const effects = /* @__PURE__ */ new Map();
|
|
14
|
+
contracts.forEach((result, index) => {
|
|
15
|
+
const integration = integrations[index];
|
|
16
|
+
if (!integration || !result.data) return;
|
|
17
|
+
for (const operation of result.data.operations) {
|
|
18
|
+
effects.set(
|
|
19
|
+
`${integration} ${operation.kind}/${operation.name}`,
|
|
20
|
+
operation.effect
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return (integration, opKey) => effects.get(`${integration} ${opKey}`);
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
useOperationEffects
|
|
28
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type RunLogQuery } from './run-log-view.js';
|
|
2
|
+
/**
|
|
3
|
+
* The run log's filters and open run, kept in the query string so a view can
|
|
4
|
+
* be linked and survives a reload. The state answers at once (a search field
|
|
5
|
+
* must not wait on the router); the URL follows with `replaceState`, which
|
|
6
|
+
* Next syncs into `useSearchParams`. A URL this hook did not write (a link
|
|
7
|
+
* from another tab, back/forward) replaces the state.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useRunLogQuery(): readonly [RunLogQuery, (query: RunLogQuery) => void];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { usePathname, useSearchParams } from "next/navigation";
|
|
4
|
+
import {
|
|
5
|
+
parseRunQuery,
|
|
6
|
+
runQueryString
|
|
7
|
+
} from "./run-log-view.js";
|
|
8
|
+
function useRunLogQuery() {
|
|
9
|
+
const params = useSearchParams();
|
|
10
|
+
const pathname = usePathname();
|
|
11
|
+
const search = params.toString();
|
|
12
|
+
const [state, setState] = useState(() => ({
|
|
13
|
+
search,
|
|
14
|
+
query: parseRunQuery(params),
|
|
15
|
+
/** Query strings this hook wrote that the router may not have caught up with. */
|
|
16
|
+
written: []
|
|
17
|
+
}));
|
|
18
|
+
if (search !== state.search && !state.written.includes(search)) {
|
|
19
|
+
setState({ search, query: parseRunQuery(params), written: [] });
|
|
20
|
+
}
|
|
21
|
+
const setQuery = (query) => {
|
|
22
|
+
const next = runQueryString(query);
|
|
23
|
+
const bare = next.replace(/^\?/, "");
|
|
24
|
+
setState((previous) => ({
|
|
25
|
+
search: bare,
|
|
26
|
+
query,
|
|
27
|
+
written: [...previous.written.slice(-19), bare]
|
|
28
|
+
}));
|
|
29
|
+
window.history.replaceState(null, "", `${pathname}${next}`);
|
|
30
|
+
};
|
|
31
|
+
return [state.query, setQuery];
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
useRunLogQuery
|
|
35
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SizedWidget, type WidgetSize } from '@ekanos/sdk/layout';
|
|
2
|
+
/**
|
|
3
|
+
* The widgets that leave part of their row empty on a wide dashboard, laid
|
|
4
|
+
* out by the same rules as the product's grid: a half-width widget with no
|
|
5
|
+
* partner beside it, and the compact tiles of a run that does not fill its
|
|
6
|
+
* last row of four. Ids in widget order.
|
|
7
|
+
*/
|
|
8
|
+
export declare function widgetsLeavingGaps<T extends SizedWidget & {
|
|
9
|
+
id: string;
|
|
10
|
+
}>(widgets: readonly T[]): string[];
|
|
11
|
+
/**
|
|
12
|
+
* The width a widget declares, as its caption reads it. A harness entry may
|
|
13
|
+
* declare `width` instead, which counts only when `size` and `layouts` are
|
|
14
|
+
* absent (the host's precedence).
|
|
15
|
+
*/
|
|
16
|
+
export declare function declaredWidthLabel(widget: SizedWidget & {
|
|
17
|
+
width?: WidgetSize;
|
|
18
|
+
}): string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildRowGroups,
|
|
3
|
+
pairRows,
|
|
4
|
+
resolveWidgetSize
|
|
5
|
+
} from "@ekanos/sdk/layout";
|
|
6
|
+
const COMPACT_PER_ROW = 4;
|
|
7
|
+
function widgetsLeavingGaps(widgets) {
|
|
8
|
+
const rows = pairRows(widgets);
|
|
9
|
+
const lone = /* @__PURE__ */ new Set();
|
|
10
|
+
for (const group of buildRowGroups(widgets)) {
|
|
11
|
+
if (group.type === "half") {
|
|
12
|
+
for (const widget of group.widgets) {
|
|
13
|
+
if (rows.get(widget.id)?.size === 1) lone.add(widget.id);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if (group.type === "compact") {
|
|
17
|
+
const remainder = group.widgets.length % COMPACT_PER_ROW;
|
|
18
|
+
if (remainder > 0) {
|
|
19
|
+
for (const widget of group.widgets.slice(-remainder)) {
|
|
20
|
+
lone.add(widget.id);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return widgets.filter((widget) => lone.has(widget.id)).map(({ id }) => id);
|
|
26
|
+
}
|
|
27
|
+
const SIZE_LABELS = {
|
|
28
|
+
compact: "compact",
|
|
29
|
+
half: "half width",
|
|
30
|
+
full: "full width"
|
|
31
|
+
};
|
|
32
|
+
function declaredWidthLabel(widget) {
|
|
33
|
+
if (!widget.size && !widget.layouts && widget.width) {
|
|
34
|
+
return SIZE_LABELS[widget.width];
|
|
35
|
+
}
|
|
36
|
+
return SIZE_LABELS[resolveWidgetSize(widget)];
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
declaredWidthLabel,
|
|
40
|
+
widgetsLeavingGaps
|
|
41
|
+
};
|