@ekanos/harness 0.27.0 → 0.28.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/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 +77 -77
- 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 +28 -0
- package/dist/internal/lib/docs-links.js +57 -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.js +75 -26
- package/dist/internal/routes/experience-page-host.js +63 -5
- 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 +428 -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 +5 -0
- package/dist/routes.js +2 -0
- package/package.json +8 -8
|
@@ -1,136 +1,424 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import Link from "next/link";
|
|
4
5
|
import { Alert, AlertDescription, AlertTitle } from "@ekanos/ui/alert";
|
|
5
6
|
import { Badge } from "@ekanos/ui/badge";
|
|
6
7
|
import { Button } from "@ekanos/ui/button";
|
|
8
|
+
import { Card } from "@ekanos/ui/card";
|
|
9
|
+
import { Icon } from "@ekanos/ui/icon";
|
|
10
|
+
import { Skeleton } from "@ekanos/ui/skeleton";
|
|
7
11
|
import { StatusBadge } from "@ekanos/ui/status-badge";
|
|
8
12
|
import { Switch } from "@ekanos/ui/switch";
|
|
9
13
|
import { Textarea } from "@ekanos/ui/textarea";
|
|
14
|
+
import { cn } from "@ekanos/ui/utils";
|
|
10
15
|
import { useRunOperation, useRuns } from "../lib/console-hooks.js";
|
|
16
|
+
import { integrationConsoleHref } from "../lib/integration-console-href.js";
|
|
17
|
+
import {
|
|
18
|
+
RUN_OUTCOME_LABELS,
|
|
19
|
+
explainRunReason,
|
|
20
|
+
formatBytes,
|
|
21
|
+
formatDuration,
|
|
22
|
+
runLogHref,
|
|
23
|
+
runOutcome
|
|
24
|
+
} from "../lib/run-log-view.js";
|
|
25
|
+
import { answeredFromExample, fixtureFileName } from "../lib/runner-view.js";
|
|
11
26
|
import {
|
|
12
27
|
formatJson,
|
|
13
28
|
initialValue,
|
|
14
29
|
parseJsonText,
|
|
30
|
+
takesNoInput,
|
|
15
31
|
validateValue
|
|
16
32
|
} from "../lib/schema-form-model.js";
|
|
17
33
|
import { RunModeBadge } from "./integration-badge.js";
|
|
18
34
|
import { SchemaForm } from "./schema-form.js";
|
|
35
|
+
import { SegmentedControl } from "./segmented-control.js";
|
|
19
36
|
const VARIANTS = ["default", "empty", "error"];
|
|
37
|
+
const VARIANT_WORDS = {
|
|
38
|
+
default: "Default returns the usual response.",
|
|
39
|
+
empty: "Empty asks for the integration's empty-result fixture; without one, it answers with the contract example.",
|
|
40
|
+
error: "Error makes the call fail, so you can see how callers handle it."
|
|
41
|
+
};
|
|
42
|
+
const SENSITIVITY_WORDS = {
|
|
43
|
+
public: "Public data",
|
|
44
|
+
internal: "Internal data",
|
|
45
|
+
pii: "Personal data (PII)",
|
|
46
|
+
financial: "Financial data"
|
|
47
|
+
};
|
|
48
|
+
const OUTCOME_TONE = {
|
|
49
|
+
ok: "success",
|
|
50
|
+
failed: "destructive",
|
|
51
|
+
refused: "destructive",
|
|
52
|
+
held: "warning"
|
|
53
|
+
};
|
|
54
|
+
const RECENT_RUNS = 5;
|
|
20
55
|
function operationKey(operation) {
|
|
21
56
|
return `${operation.kind}/${operation.name}`;
|
|
22
57
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
58
|
+
function CopyButton({ text, testId }) {
|
|
59
|
+
const [copied, setCopied] = useState(false);
|
|
60
|
+
return /* @__PURE__ */ jsxs(
|
|
61
|
+
Button,
|
|
62
|
+
{
|
|
63
|
+
type: "button",
|
|
64
|
+
variant: "ghost",
|
|
65
|
+
size: "sm",
|
|
66
|
+
"data-test": testId,
|
|
67
|
+
onClick: async () => {
|
|
68
|
+
try {
|
|
69
|
+
await navigator.clipboard.writeText(text);
|
|
70
|
+
setCopied(true);
|
|
71
|
+
setTimeout(() => setCopied(false), 1500);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.warn("[harness] could not copy to the clipboard:", error);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsx(Icon, { name: copied ? "check" : "copy", "aria-hidden": true, className: "size-4" }),
|
|
78
|
+
copied ? "Copied" : "Copy"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
function JsonBlock({
|
|
26
84
|
value,
|
|
27
|
-
|
|
28
|
-
|
|
85
|
+
testId,
|
|
86
|
+
className
|
|
29
87
|
}) {
|
|
30
88
|
return /* @__PURE__ */ jsx(
|
|
31
|
-
"
|
|
89
|
+
"pre",
|
|
32
90
|
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
91
|
+
className: cn(
|
|
92
|
+
"bg-muted max-h-128 overflow-auto rounded-md p-3 font-mono text-xs leading-relaxed break-words whitespace-pre-wrap",
|
|
93
|
+
className
|
|
94
|
+
),
|
|
95
|
+
"data-test": testId,
|
|
96
|
+
children: JSON.stringify(value, null, 2) ?? "undefined"
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
function Pane({
|
|
101
|
+
title,
|
|
102
|
+
actions,
|
|
103
|
+
children,
|
|
104
|
+
testId,
|
|
105
|
+
className
|
|
106
|
+
}) {
|
|
107
|
+
return /* @__PURE__ */ jsxs(
|
|
108
|
+
Card,
|
|
109
|
+
{
|
|
110
|
+
layout: "bleed",
|
|
111
|
+
className: cn("min-w-0", className),
|
|
112
|
+
"data-test": testId,
|
|
113
|
+
"aria-label": title,
|
|
114
|
+
render: /* @__PURE__ */ jsx("section", {}),
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-11 items-center justify-between gap-2 border-b px-4 py-1.5", children: [
|
|
117
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: title }),
|
|
118
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: actions })
|
|
119
|
+
] }),
|
|
120
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-col gap-3 p-4", children })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
function ExampleOutput({
|
|
126
|
+
operation,
|
|
127
|
+
open
|
|
128
|
+
}) {
|
|
129
|
+
if (operation.outputExample === void 0) return null;
|
|
130
|
+
return /* @__PURE__ */ jsxs(
|
|
131
|
+
"details",
|
|
132
|
+
{
|
|
133
|
+
className: "group text-sm",
|
|
134
|
+
"data-test": "example-output",
|
|
135
|
+
open: open || void 0,
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ jsxs("summary", { className: "text-muted-foreground hover:text-foreground flex cursor-pointer list-none items-center gap-1.5 [&::-webkit-details-marker]:hidden", children: [
|
|
138
|
+
/* @__PURE__ */ jsx(
|
|
139
|
+
Icon,
|
|
140
|
+
{
|
|
141
|
+
name: "caret-right",
|
|
142
|
+
"aria-hidden": true,
|
|
143
|
+
className: "size-3.5 transition-transform duration-(--duration-enter) group-open:rotate-90 motion-reduce:transition-none"
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
"Example output from the contract"
|
|
147
|
+
] }),
|
|
148
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex flex-col gap-1", children: [
|
|
149
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(
|
|
150
|
+
CopyButton,
|
|
151
|
+
{
|
|
152
|
+
text: formatJson(operation.outputExample),
|
|
153
|
+
testId: "copy-example"
|
|
154
|
+
}
|
|
155
|
+
) }),
|
|
156
|
+
/* @__PURE__ */ jsx(
|
|
157
|
+
JsonBlock,
|
|
158
|
+
{
|
|
159
|
+
value: operation.outputExample,
|
|
160
|
+
testId: "example-output-body",
|
|
161
|
+
className: "max-h-72"
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
] })
|
|
165
|
+
]
|
|
56
166
|
}
|
|
57
167
|
);
|
|
58
168
|
}
|
|
59
|
-
function
|
|
169
|
+
function ResultMeta({
|
|
170
|
+
record,
|
|
171
|
+
elapsedMs,
|
|
172
|
+
runId,
|
|
173
|
+
logHref
|
|
174
|
+
}) {
|
|
175
|
+
const duration = record?.durationMs ?? elapsedMs;
|
|
176
|
+
return /* @__PURE__ */ jsxs("dl", { className: "text-muted-foreground flex flex-wrap items-center gap-x-4 gap-y-1 text-xs", children: [
|
|
177
|
+
duration !== null ? /* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
|
|
178
|
+
/* @__PURE__ */ jsx("dt", { children: "Time" }),
|
|
179
|
+
/* @__PURE__ */ jsx("dd", { className: "text-foreground tabular-nums", "data-test": "run-duration", children: formatDuration(duration) })
|
|
180
|
+
] }) : null,
|
|
181
|
+
record ? /* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
|
|
182
|
+
/* @__PURE__ */ jsx("dt", { children: "Size" }),
|
|
183
|
+
/* @__PURE__ */ jsx("dd", { className: "text-foreground tabular-nums", children: formatBytes(record.outputBytes) })
|
|
184
|
+
] }) : null,
|
|
185
|
+
record?.mode ? /* @__PURE__ */ jsx(RunModeBadge, { mode: record.mode }) : null,
|
|
186
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
|
|
187
|
+
/* @__PURE__ */ jsx("dt", { children: "Run" }),
|
|
188
|
+
/* @__PURE__ */ jsx("dd", { "data-test": "run-record-id", children: logHref ? /* @__PURE__ */ jsx(
|
|
189
|
+
Link,
|
|
190
|
+
{
|
|
191
|
+
href: logHref,
|
|
192
|
+
className: "text-foreground font-mono underline-offset-2 hover:underline",
|
|
193
|
+
children: runId
|
|
194
|
+
}
|
|
195
|
+
) : /* @__PURE__ */ jsx("span", { className: "font-mono", children: runId }) })
|
|
196
|
+
] })
|
|
197
|
+
] });
|
|
198
|
+
}
|
|
199
|
+
function ExampleFallback({
|
|
200
|
+
operation,
|
|
201
|
+
ran
|
|
202
|
+
}) {
|
|
203
|
+
const file = fixtureFileName(operationKey(operation), ran.variant);
|
|
204
|
+
if (ran.variant === "empty") {
|
|
205
|
+
return /* @__PURE__ */ jsxs(Alert, { variant: "warning", "data-test": "empty-fallback", children: [
|
|
206
|
+
/* @__PURE__ */ jsx(Icon, { name: "warning", "aria-hidden": true }),
|
|
207
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "No empty fixture: this is the Default body" }),
|
|
208
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: /* @__PURE__ */ jsxs("p", { children: [
|
|
209
|
+
operation.name,
|
|
210
|
+
" has no empty-result fixture, so the run answered with the contract example, the same body Default returns. Add",
|
|
211
|
+
" ",
|
|
212
|
+
/* @__PURE__ */ jsx("code", { children: file }),
|
|
213
|
+
" to the integration's fixtures to test an empty result."
|
|
214
|
+
] }) })
|
|
215
|
+
] });
|
|
216
|
+
}
|
|
217
|
+
return /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-xs", "data-test": "example-fallback", children: [
|
|
218
|
+
"From the contract example: there is no ",
|
|
219
|
+
/* @__PURE__ */ jsx("code", { children: file }),
|
|
220
|
+
" fixture."
|
|
221
|
+
] });
|
|
222
|
+
}
|
|
223
|
+
function ResultView({
|
|
60
224
|
response,
|
|
61
|
-
operation
|
|
225
|
+
operation,
|
|
226
|
+
elapsedMs,
|
|
227
|
+
logBase,
|
|
228
|
+
ran
|
|
62
229
|
}) {
|
|
63
230
|
const runs = useRuns();
|
|
64
231
|
const record = runs.data?.find((entry) => entry.id === response.runId);
|
|
65
232
|
const refused = response.status === "refused";
|
|
66
233
|
const validated = !operation.opaque.output;
|
|
234
|
+
const outcome = record ? runOutcome(record) : refused ? "refused" : "ok";
|
|
235
|
+
const logHref = logBase ? runLogHref(logBase, { run: response.runId }) : null;
|
|
236
|
+
const fromExample = response.status === "ok" && answeredFromExample({
|
|
237
|
+
mode: ran.mode,
|
|
238
|
+
variant: ran.variant,
|
|
239
|
+
output: response.output,
|
|
240
|
+
example: operation.outputExample
|
|
241
|
+
});
|
|
67
242
|
return /* @__PURE__ */ jsxs(
|
|
68
243
|
"div",
|
|
69
244
|
{
|
|
70
|
-
className: "flex flex-col gap-3",
|
|
245
|
+
className: "flex min-w-0 flex-col gap-3",
|
|
71
246
|
"data-test": "run-result",
|
|
72
247
|
"data-status": response.status,
|
|
73
248
|
children: [
|
|
74
249
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
75
|
-
/* @__PURE__ */ jsx(StatusBadge, { tone:
|
|
76
|
-
refused ?
|
|
250
|
+
/* @__PURE__ */ jsx(StatusBadge, { tone: OUTCOME_TONE[outcome], prominent: refused, children: refused ? RUN_OUTCOME_LABELS[outcome] : "OK" }),
|
|
251
|
+
refused ? /* @__PURE__ */ jsx("code", { className: "text-muted-foreground text-xs", children: response.reason }) : /* @__PURE__ */ jsxs(
|
|
77
252
|
Badge,
|
|
78
253
|
{
|
|
79
254
|
variant: "outline",
|
|
80
255
|
"data-test": "output-validated",
|
|
81
256
|
"data-validated": validated,
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
),
|
|
85
|
-
record?.mode ? /* @__PURE__ */ jsx(RunModeBadge, { mode: record.mode }) : null,
|
|
86
|
-
record ? /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground text-xs", children: [
|
|
87
|
-
record.durationMs,
|
|
88
|
-
" ms \xB7 in ",
|
|
89
|
-
record.inputBytes,
|
|
90
|
-
" B \xB7 out",
|
|
91
|
-
" ",
|
|
92
|
-
record.outputBytes,
|
|
93
|
-
" B"
|
|
94
|
-
] }) : null,
|
|
95
|
-
/* @__PURE__ */ jsxs(
|
|
96
|
-
"span",
|
|
97
|
-
{
|
|
98
|
-
className: "text-muted-foreground text-xs",
|
|
99
|
-
"data-test": "run-record-id",
|
|
257
|
+
title: validated ? "The response matched the operation's output schema." : "The contract marks this output opaque, so there is no schema to check it against.",
|
|
100
258
|
children: [
|
|
101
|
-
|
|
102
|
-
|
|
259
|
+
/* @__PURE__ */ jsx(
|
|
260
|
+
Icon,
|
|
261
|
+
{
|
|
262
|
+
name: validated ? "check" : "minus",
|
|
263
|
+
"aria-hidden": true,
|
|
264
|
+
className: "size-3"
|
|
265
|
+
}
|
|
266
|
+
),
|
|
267
|
+
validated ? "Matches output schema" : "Not validated (opaque)"
|
|
103
268
|
]
|
|
104
269
|
}
|
|
105
270
|
)
|
|
106
271
|
] }),
|
|
272
|
+
/* @__PURE__ */ jsx(
|
|
273
|
+
ResultMeta,
|
|
274
|
+
{
|
|
275
|
+
record,
|
|
276
|
+
elapsedMs,
|
|
277
|
+
runId: response.runId,
|
|
278
|
+
logHref
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
fromExample ? /* @__PURE__ */ jsx(ExampleFallback, { operation, ran }) : null,
|
|
107
282
|
refused ? /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
|
|
108
|
-
/* @__PURE__ */ jsx(AlertTitle, { children: response.reason }),
|
|
283
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: explainRunReason(response.reason) ?? "The run did not succeed." }),
|
|
109
284
|
/* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
110
|
-
/* @__PURE__ */
|
|
285
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
286
|
+
response.message,
|
|
287
|
+
response.reason === "invalid_input" ? " Fix the fields marked in Input, then run again." : ""
|
|
288
|
+
] }),
|
|
111
289
|
response.issues && response.issues.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "mt-2 list-disc pl-5", "data-test": "server-issues", children: response.issues.map((issue) => /* @__PURE__ */ jsxs("li", { children: [
|
|
112
290
|
/* @__PURE__ */ jsx("code", { children: issue.path || "(root)" }),
|
|
113
291
|
" ",
|
|
114
292
|
issue.message
|
|
115
293
|
] }, `${issue.path}:${issue.message}`)) }) : null
|
|
116
294
|
] })
|
|
117
|
-
] }) : /* @__PURE__ */
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
295
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
|
|
296
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
297
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs font-medium", children: "Body" }),
|
|
298
|
+
/* @__PURE__ */ jsx(
|
|
299
|
+
CopyButton,
|
|
300
|
+
{
|
|
301
|
+
text: formatJson(response.output),
|
|
302
|
+
testId: "copy-output"
|
|
303
|
+
}
|
|
304
|
+
)
|
|
305
|
+
] }),
|
|
306
|
+
/* @__PURE__ */ jsx(JsonBlock, { value: response.output, testId: "run-output" })
|
|
307
|
+
] })
|
|
125
308
|
]
|
|
126
309
|
}
|
|
127
310
|
);
|
|
128
311
|
}
|
|
312
|
+
function RecentRuns({
|
|
313
|
+
integration,
|
|
314
|
+
opKey,
|
|
315
|
+
logBase
|
|
316
|
+
}) {
|
|
317
|
+
const runs = useRuns();
|
|
318
|
+
const mine = (runs.data ?? []).filter((run) => run.integration === integration && run.opKey === opKey).sort((a, b) => b.seq - a.seq).slice(0, RECENT_RUNS);
|
|
319
|
+
if (mine.length === 0) return null;
|
|
320
|
+
return /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-2", "data-test": "recent-runs", children: [
|
|
321
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
322
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: "Recent runs of this operation" }),
|
|
323
|
+
logBase ? /* @__PURE__ */ jsx(
|
|
324
|
+
Link,
|
|
325
|
+
{
|
|
326
|
+
href: `${logBase}/runs`,
|
|
327
|
+
className: "text-muted-foreground hover:text-foreground text-sm underline-offset-2 hover:underline",
|
|
328
|
+
children: "Open run log"
|
|
329
|
+
}
|
|
330
|
+
) : null
|
|
331
|
+
] }),
|
|
332
|
+
/* @__PURE__ */ jsx(Card, { layout: "bleed", className: "divide-y", render: /* @__PURE__ */ jsx("ul", {}), children: mine.map((run) => {
|
|
333
|
+
const outcome = runOutcome(run);
|
|
334
|
+
const row = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
335
|
+
/* @__PURE__ */ jsx(StatusBadge, { tone: OUTCOME_TONE[outcome], children: RUN_OUTCOME_LABELS[outcome] }),
|
|
336
|
+
run.mode ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs capitalize", children: run.mode }) : null,
|
|
337
|
+
run.reason ? /* @__PURE__ */ jsx("code", { className: "text-muted-foreground truncate text-xs", children: run.reason }) : null,
|
|
338
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground ml-auto flex shrink-0 gap-3 text-xs tabular-nums", children: [
|
|
339
|
+
/* @__PURE__ */ jsx("span", { children: formatDuration(run.durationMs) }),
|
|
340
|
+
/* @__PURE__ */ jsx("time", { dateTime: run.ts, children: new Date(run.ts).toLocaleTimeString() })
|
|
341
|
+
] })
|
|
342
|
+
] });
|
|
343
|
+
return /* @__PURE__ */ jsx("li", { "data-test": "recent-run", children: logBase ? /* @__PURE__ */ jsx(
|
|
344
|
+
Link,
|
|
345
|
+
{
|
|
346
|
+
href: runLogHref(logBase, { run: run.id }),
|
|
347
|
+
className: "hover:bg-muted focus-visible:ring-ring flex items-center gap-3 px-3 py-2 outline-none focus-visible:ring-2 focus-visible:ring-inset",
|
|
348
|
+
children: row
|
|
349
|
+
}
|
|
350
|
+
) : /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3 px-3 py-2", children: row }) }, run.id);
|
|
351
|
+
}) })
|
|
352
|
+
] });
|
|
353
|
+
}
|
|
129
354
|
function startMode(integration, effect) {
|
|
130
355
|
const facts = integration.runtime?.facts;
|
|
131
356
|
if (facts?.forced) return "fixtures";
|
|
132
357
|
return effect === "read" && facts?.answers === "live" ? "live" : integration.defaultMode;
|
|
133
358
|
}
|
|
359
|
+
function revealResponse(element) {
|
|
360
|
+
if (!element || typeof window.matchMedia !== "function") return;
|
|
361
|
+
if (window.matchMedia("(min-width: 64rem)").matches) return;
|
|
362
|
+
const still = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
363
|
+
element.scrollIntoView?.({
|
|
364
|
+
behavior: still ? "auto" : "smooth",
|
|
365
|
+
block: "start"
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
const NOT_LIVE_READY = /* @__PURE__ */ new Set([
|
|
369
|
+
"not_connected",
|
|
370
|
+
"unreadable"
|
|
371
|
+
]);
|
|
372
|
+
function ModeNote({
|
|
373
|
+
integration,
|
|
374
|
+
operation,
|
|
375
|
+
mode,
|
|
376
|
+
variant,
|
|
377
|
+
consoleHref
|
|
378
|
+
}) {
|
|
379
|
+
const name = integration.integration;
|
|
380
|
+
const facts = integration.runtime?.facts;
|
|
381
|
+
const canLive = integration.runModes.includes("live");
|
|
382
|
+
const needsConnection = canLive && facts !== void 0 && NOT_LIVE_READY.has(facts.state);
|
|
383
|
+
return /* @__PURE__ */ jsxs(
|
|
384
|
+
"div",
|
|
385
|
+
{
|
|
386
|
+
className: "text-muted-foreground -mt-3 flex max-w-3xl flex-col gap-1 px-1 text-xs",
|
|
387
|
+
"data-test": "run-mode-note",
|
|
388
|
+
children: [
|
|
389
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
390
|
+
mode === "fixtures" ? `Fixtures answers from the contract's example and the integration's scenario fixtures, without calling ${name}. ${VARIANT_WORDS[variant]}` : operation.effect === "write" ? `Live calls ${name}'s real API with your connection. This is a write: it changes real data.` : `Live calls ${name}'s real API with your connection.`,
|
|
391
|
+
needsConnection ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
392
|
+
" ",
|
|
393
|
+
"Live needs a connection, and ",
|
|
394
|
+
name,
|
|
395
|
+
" is not connected yet",
|
|
396
|
+
consoleHref ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
397
|
+
":",
|
|
398
|
+
" ",
|
|
399
|
+
/* @__PURE__ */ jsx(
|
|
400
|
+
Link,
|
|
401
|
+
{
|
|
402
|
+
href: `${consoleHref}/connect`,
|
|
403
|
+
className: "text-foreground underline underline-offset-2",
|
|
404
|
+
"data-test": "runner-connect-link",
|
|
405
|
+
children: "connect it"
|
|
406
|
+
}
|
|
407
|
+
)
|
|
408
|
+
] }) : null,
|
|
409
|
+
"."
|
|
410
|
+
] }) : null
|
|
411
|
+
] }),
|
|
412
|
+
facts?.forced ? /* @__PURE__ */ jsx("p", { "data-test": "fixtures-pinned", children: "Fixtures \xB7 pinned. Saved for this repo; unpin it from the integrations strip to read live again." }) : null,
|
|
413
|
+
canLive ? null : /* @__PURE__ */ jsxs("p", { "data-test": "fixtures-only", children: [
|
|
414
|
+
"Live is unavailable.",
|
|
415
|
+
" ",
|
|
416
|
+
integration.fixturesOnlyReason ?? "This integration is fixtures-only: it answers from the contract example and scenario fixtures."
|
|
417
|
+
] })
|
|
418
|
+
]
|
|
419
|
+
}
|
|
420
|
+
);
|
|
421
|
+
}
|
|
134
422
|
function OperationRunnerPanel({
|
|
135
423
|
integration,
|
|
136
424
|
operation,
|
|
@@ -151,157 +439,304 @@ function OperationRunnerPanel({
|
|
|
151
439
|
rawError: null,
|
|
152
440
|
attempted: false,
|
|
153
441
|
response: null,
|
|
154
|
-
|
|
442
|
+
ran: {
|
|
443
|
+
mode: startMode(integration, operation.effect),
|
|
444
|
+
variant: "default"
|
|
445
|
+
},
|
|
446
|
+
runError: null,
|
|
447
|
+
elapsedMs: null
|
|
155
448
|
};
|
|
156
449
|
});
|
|
157
450
|
const patch = (next) => setState((current) => ({ ...current, ...next }));
|
|
451
|
+
const key = operationKey(operation);
|
|
452
|
+
const consoleHref = integrationConsoleHref(integration);
|
|
453
|
+
const write = operation.effect === "write";
|
|
158
454
|
const response = state.response;
|
|
159
455
|
const clientIssues = state.attempted ? validateValue(operation.input, state.value) : [];
|
|
160
456
|
const serverIssues = response?.status === "refused" ? response.issues ?? [] : [];
|
|
161
457
|
const issues = serverIssues.length > 0 ? serverIssues : clientIssues;
|
|
458
|
+
const blocked = run.isPending || state.rawError !== null;
|
|
459
|
+
const responseRef = useRef(null);
|
|
162
460
|
const execute = () => {
|
|
163
|
-
if (
|
|
164
|
-
|
|
461
|
+
if (blocked) return;
|
|
462
|
+
const started = performance.now();
|
|
463
|
+
patch({
|
|
464
|
+
attempted: true,
|
|
465
|
+
response: null,
|
|
466
|
+
ran: { mode: state.mode, variant: state.variant },
|
|
467
|
+
runError: null,
|
|
468
|
+
elapsedMs: null
|
|
469
|
+
});
|
|
470
|
+
revealResponse(responseRef.current);
|
|
165
471
|
run.mutate(
|
|
166
472
|
{
|
|
167
473
|
integration: integration.integration,
|
|
168
|
-
opKey:
|
|
474
|
+
opKey: key,
|
|
169
475
|
args: state.value,
|
|
170
476
|
mode: state.mode,
|
|
171
477
|
...state.mode === "fixtures" ? { variant: state.variant } : {},
|
|
172
478
|
// A write runs as a person's click, as it does from a widget.
|
|
173
|
-
channel:
|
|
479
|
+
channel: write ? "interactive" : "http",
|
|
174
480
|
origin: "console"
|
|
175
481
|
},
|
|
176
482
|
{
|
|
177
|
-
onSuccess: (next) => patch({ response: next }),
|
|
483
|
+
onSuccess: (next) => patch({ response: next, elapsedMs: performance.now() - started }),
|
|
178
484
|
onError: (error) => patch({ runError: error.message })
|
|
179
485
|
}
|
|
180
486
|
);
|
|
181
487
|
};
|
|
182
|
-
const liveReason =
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
usedBy.map((use) => `${use.title} (${use.kind})`).join(", ")
|
|
194
|
-
] }) : null,
|
|
195
|
-
operation.opaque.input || operation.opaque.output ? /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-xs", "data-test": "opaque-note", children: [
|
|
196
|
-
"Opaque ",
|
|
197
|
-
operation.opaque.input ? "input" : "",
|
|
198
|
-
operation.opaque.input && operation.opaque.output ? " and " : "",
|
|
199
|
-
operation.opaque.output ? "output" : "",
|
|
200
|
-
operation.opaqueReason ? `: ${operation.opaqueReason}` : ""
|
|
201
|
-
] }) : null
|
|
202
|
-
] }),
|
|
203
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [
|
|
204
|
-
/* @__PURE__ */ jsx(
|
|
205
|
-
Segmented,
|
|
206
|
-
{
|
|
207
|
-
label: "Mode",
|
|
208
|
-
options: ["fixtures", "live"],
|
|
209
|
-
value: state.mode,
|
|
210
|
-
onChange: (mode) => patch({ mode }),
|
|
211
|
-
disabledReason: liveReason
|
|
212
|
-
}
|
|
213
|
-
),
|
|
214
|
-
state.mode === "fixtures" ? /* @__PURE__ */ jsx(
|
|
215
|
-
Segmented,
|
|
216
|
-
{
|
|
217
|
-
label: "Variant",
|
|
218
|
-
options: VARIANTS,
|
|
219
|
-
value: state.variant,
|
|
220
|
-
onChange: (variant) => patch({ variant })
|
|
488
|
+
const liveReason = integration.runModes.includes("live") ? null : integration.fixturesOnlyReason ?? "This integration is fixtures-only.";
|
|
489
|
+
const opaque = operation.opaque.input || operation.opaque.output;
|
|
490
|
+
return /* @__PURE__ */ jsxs(
|
|
491
|
+
"section",
|
|
492
|
+
{
|
|
493
|
+
className: "flex flex-col gap-5",
|
|
494
|
+
"data-test": "operation-runner",
|
|
495
|
+
onKeyDown: (event) => {
|
|
496
|
+
if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
|
|
497
|
+
event.preventDefault();
|
|
498
|
+
execute();
|
|
221
499
|
}
|
|
222
|
-
|
|
223
|
-
|
|
500
|
+
},
|
|
501
|
+
children: [
|
|
502
|
+
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-2", children: [
|
|
503
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
504
|
+
/* @__PURE__ */ jsx(StatusBadge, { tone: write ? "warning" : "info", children: write ? "Write" : "Read" }),
|
|
505
|
+
/* @__PURE__ */ jsx("h2", { className: "font-heading min-w-0 text-xl font-normal break-all", children: /* @__PURE__ */ jsxs("code", { children: [
|
|
506
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
507
|
+
operation.kind,
|
|
508
|
+
"/"
|
|
509
|
+
] }),
|
|
510
|
+
operation.name
|
|
511
|
+
] }) })
|
|
512
|
+
] }),
|
|
513
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground max-w-3xl text-sm", children: operation.description }),
|
|
514
|
+
/* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex flex-wrap items-center gap-x-4 gap-y-1 text-xs", children: [
|
|
515
|
+
/* @__PURE__ */ jsx("span", { children: SENSITIVITY_WORDS[operation.sensitivity] }),
|
|
516
|
+
operation.since ? /* @__PURE__ */ jsxs("span", { children: [
|
|
517
|
+
"Since ",
|
|
518
|
+
operation.since
|
|
519
|
+
] }) : null,
|
|
520
|
+
usedBy.length > 0 ? /* @__PURE__ */ jsxs("span", { "data-test": "used-by", children: [
|
|
521
|
+
"Used by",
|
|
522
|
+
" ",
|
|
523
|
+
[
|
|
524
|
+
...new Set(usedBy.map((use) => `${use.title} (${use.kind})`))
|
|
525
|
+
].join(", ")
|
|
526
|
+
] }) : null,
|
|
527
|
+
opaque ? /* @__PURE__ */ jsxs("span", { "data-test": "opaque-note", children: [
|
|
528
|
+
"Opaque ",
|
|
529
|
+
operation.opaque.input ? "input" : "",
|
|
530
|
+
operation.opaque.input && operation.opaque.output ? " and " : "",
|
|
531
|
+
operation.opaque.output ? "output" : "",
|
|
532
|
+
operation.opaqueReason ? `: ${operation.opaqueReason}` : ""
|
|
533
|
+
] }) : null
|
|
534
|
+
] })
|
|
535
|
+
] }),
|
|
224
536
|
/* @__PURE__ */ jsx(
|
|
225
|
-
|
|
537
|
+
Card,
|
|
226
538
|
{
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
539
|
+
size: "sm",
|
|
540
|
+
className: "sticky top-0 z-20 px-(--card-spacing)",
|
|
541
|
+
"data-test": "run-bar",
|
|
542
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
543
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
544
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs font-medium max-sm:sr-only", children: "Answer from" }),
|
|
545
|
+
/* @__PURE__ */ jsx(
|
|
546
|
+
SegmentedControl,
|
|
547
|
+
{
|
|
548
|
+
label: "Mode",
|
|
549
|
+
testPrefix: "mode",
|
|
550
|
+
value: state.mode,
|
|
551
|
+
onChange: (mode) => patch({ mode }),
|
|
552
|
+
options: [
|
|
553
|
+
{ value: "fixtures", label: "Fixtures" },
|
|
554
|
+
{ value: "live", label: "Live", disabledReason: liveReason }
|
|
555
|
+
]
|
|
556
|
+
}
|
|
557
|
+
)
|
|
558
|
+
] }),
|
|
559
|
+
state.mode === "fixtures" ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
560
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs font-medium max-sm:sr-only", children: "Scenario" }),
|
|
561
|
+
/* @__PURE__ */ jsx(
|
|
562
|
+
SegmentedControl,
|
|
563
|
+
{
|
|
564
|
+
label: "Variant",
|
|
565
|
+
testPrefix: "variant",
|
|
566
|
+
value: state.variant,
|
|
567
|
+
onChange: (variant) => patch({ variant }),
|
|
568
|
+
options: VARIANTS.map((variant) => ({
|
|
569
|
+
value: variant,
|
|
570
|
+
label: variant.charAt(0).toUpperCase() + variant.slice(1)
|
|
571
|
+
}))
|
|
572
|
+
}
|
|
573
|
+
)
|
|
574
|
+
] }) : null,
|
|
575
|
+
/* @__PURE__ */ jsxs(
|
|
576
|
+
Button,
|
|
577
|
+
{
|
|
578
|
+
type: "button",
|
|
579
|
+
onClick: execute,
|
|
580
|
+
loading: run.isPending,
|
|
581
|
+
disabled: state.rawError !== null,
|
|
582
|
+
"data-test": "run-operation",
|
|
583
|
+
className: "ml-auto",
|
|
584
|
+
title: state.rawError ? "Fix the JSON input to run" : "Run (\u2318 Enter, Ctrl Enter)",
|
|
585
|
+
children: [
|
|
586
|
+
run.isPending ? null : /* @__PURE__ */ jsx(Icon, { name: "play", "aria-hidden": true, className: "size-4" }),
|
|
587
|
+
"Run"
|
|
588
|
+
]
|
|
589
|
+
}
|
|
590
|
+
)
|
|
591
|
+
] })
|
|
234
592
|
}
|
|
235
593
|
),
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
children: "Fixtures \xB7 pinned. Saved for this repo; unpin it from the integrations strip to read live again."
|
|
245
|
-
}
|
|
246
|
-
) : null,
|
|
247
|
-
integration.runModes.includes("live") ? null : /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", "data-test": "fixtures-only", children: integration.fixturesOnlyReason ?? "This integration is fixtures-only: it answers from the contract example and scenario fixtures." }),
|
|
248
|
-
state.raw ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", "data-test": "raw-editor", children: [
|
|
249
|
-
/* @__PURE__ */ jsx(
|
|
250
|
-
Textarea,
|
|
251
|
-
{
|
|
252
|
-
className: "font-mono",
|
|
253
|
-
spellCheck: false,
|
|
254
|
-
"aria-label": "Raw JSON input",
|
|
255
|
-
value: state.rawText,
|
|
256
|
-
"aria-invalid": state.rawError ? true : void 0,
|
|
257
|
-
onChange: (event) => {
|
|
258
|
-
const rawText = event.target.value;
|
|
259
|
-
const parsed = parseJsonText(rawText);
|
|
260
|
-
patch(
|
|
261
|
-
parsed.ok ? { rawText, rawError: null, value: parsed.value } : { rawText, rawError: parsed.error }
|
|
262
|
-
);
|
|
594
|
+
/* @__PURE__ */ jsx(
|
|
595
|
+
ModeNote,
|
|
596
|
+
{
|
|
597
|
+
integration,
|
|
598
|
+
operation,
|
|
599
|
+
mode: state.mode,
|
|
600
|
+
variant: state.variant,
|
|
601
|
+
consoleHref
|
|
263
602
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
603
|
+
),
|
|
604
|
+
/* @__PURE__ */ jsxs("div", { className: "grid items-start gap-4 lg:grid-cols-2", children: [
|
|
605
|
+
/* @__PURE__ */ jsx(
|
|
606
|
+
Pane,
|
|
607
|
+
{
|
|
608
|
+
title: "Input",
|
|
609
|
+
testId: "runner-input",
|
|
610
|
+
actions: takesNoInput(operation.input) ? null : /* @__PURE__ */ jsxs("label", { className: "text-muted-foreground flex items-center gap-2 text-xs font-medium", children: [
|
|
611
|
+
/* @__PURE__ */ jsx(
|
|
612
|
+
Switch,
|
|
613
|
+
{
|
|
614
|
+
checked: state.raw,
|
|
615
|
+
"data-test": "raw-json-toggle",
|
|
616
|
+
onCheckedChange: (raw) => patch({
|
|
617
|
+
raw,
|
|
618
|
+
rawText: formatJson(state.value),
|
|
619
|
+
rawError: null
|
|
620
|
+
})
|
|
621
|
+
}
|
|
622
|
+
),
|
|
623
|
+
"Edit as JSON"
|
|
624
|
+
] }),
|
|
625
|
+
children: state.raw && !takesNoInput(operation.input) ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", "data-test": "raw-editor", children: [
|
|
626
|
+
/* @__PURE__ */ jsx(
|
|
627
|
+
Textarea,
|
|
628
|
+
{
|
|
629
|
+
className: "min-h-48 font-mono text-xs",
|
|
630
|
+
spellCheck: false,
|
|
631
|
+
"aria-label": "Raw JSON input",
|
|
632
|
+
value: state.rawText,
|
|
633
|
+
"aria-invalid": state.rawError ? true : void 0,
|
|
634
|
+
onChange: (event) => {
|
|
635
|
+
const rawText = event.target.value;
|
|
636
|
+
const parsed = parseJsonText(rawText);
|
|
637
|
+
patch(
|
|
638
|
+
parsed.ok ? { rawText, rawError: null, value: parsed.value } : { rawText, rawError: parsed.error }
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
),
|
|
643
|
+
state.rawError ? /* @__PURE__ */ jsx("p", { role: "alert", className: "text-destructive text-xs", children: state.rawError }) : null,
|
|
644
|
+
issues.map((issue) => /* @__PURE__ */ jsxs(
|
|
645
|
+
"p",
|
|
646
|
+
{
|
|
647
|
+
className: "text-destructive text-xs",
|
|
648
|
+
children: [
|
|
649
|
+
/* @__PURE__ */ jsx("code", { children: issue.path || "(root)" }),
|
|
650
|
+
" ",
|
|
651
|
+
issue.message
|
|
652
|
+
]
|
|
653
|
+
},
|
|
654
|
+
`${issue.path}:${issue.message}`
|
|
655
|
+
))
|
|
656
|
+
] }) : /* @__PURE__ */ jsx(
|
|
657
|
+
SchemaForm,
|
|
658
|
+
{
|
|
659
|
+
schema: operation.input,
|
|
660
|
+
value: state.value,
|
|
661
|
+
onChange: (value) => patch({ value }),
|
|
662
|
+
issues
|
|
663
|
+
}
|
|
664
|
+
)
|
|
665
|
+
}
|
|
666
|
+
),
|
|
667
|
+
/* @__PURE__ */ jsx(
|
|
668
|
+
"div",
|
|
669
|
+
{
|
|
670
|
+
ref: responseRef,
|
|
671
|
+
className: "min-w-0 scroll-mt-32 lg:sticky lg:top-24",
|
|
672
|
+
children: /* @__PURE__ */ jsxs(
|
|
673
|
+
Pane,
|
|
674
|
+
{
|
|
675
|
+
title: "Response",
|
|
676
|
+
testId: "runner-response",
|
|
677
|
+
actions: response ? /* @__PURE__ */ jsx(
|
|
678
|
+
"span",
|
|
679
|
+
{
|
|
680
|
+
className: "text-muted-foreground text-xs",
|
|
681
|
+
"data-test": "response-ran-with",
|
|
682
|
+
children: state.ran.mode === "fixtures" ? `Fixtures \xB7 ${state.ran.variant}` : "Live"
|
|
683
|
+
}
|
|
684
|
+
) : null,
|
|
685
|
+
children: [
|
|
686
|
+
run.isPending ? /* @__PURE__ */ jsxs(
|
|
687
|
+
"div",
|
|
688
|
+
{
|
|
689
|
+
className: "flex flex-col gap-2",
|
|
690
|
+
"aria-busy": "true",
|
|
691
|
+
"data-test": "run-pending",
|
|
692
|
+
children: [
|
|
693
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-40" }),
|
|
694
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-56" }),
|
|
695
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full" })
|
|
696
|
+
]
|
|
697
|
+
}
|
|
698
|
+
) : state.runError ? /* @__PURE__ */ jsxs(Alert, { variant: "destructive", "data-test": "run-error", children: [
|
|
699
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "The run did not reach the harness" }),
|
|
700
|
+
/* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
701
|
+
/* @__PURE__ */ jsx("p", { children: state.runError }),
|
|
702
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
703
|
+
"Check that ",
|
|
704
|
+
/* @__PURE__ */ jsx("code", { children: "ekanos dev" }),
|
|
705
|
+
" is still running, then run again."
|
|
706
|
+
] })
|
|
707
|
+
] })
|
|
708
|
+
] }) : response ? /* @__PURE__ */ jsx(
|
|
709
|
+
ResultView,
|
|
710
|
+
{
|
|
711
|
+
response,
|
|
712
|
+
operation,
|
|
713
|
+
elapsedMs: state.elapsedMs,
|
|
714
|
+
logBase: consoleHref,
|
|
715
|
+
ran: state.ran
|
|
716
|
+
}
|
|
717
|
+
) : /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-sm", "data-test": "run-idle", children: [
|
|
718
|
+
"Press Run to call ",
|
|
719
|
+
/* @__PURE__ */ jsx("code", { children: operation.name }),
|
|
720
|
+
". The status, time and response body appear here."
|
|
721
|
+
] }),
|
|
722
|
+
/* @__PURE__ */ jsx(ExampleOutput, { operation, open: response === null })
|
|
723
|
+
]
|
|
724
|
+
}
|
|
725
|
+
)
|
|
726
|
+
}
|
|
727
|
+
)
|
|
728
|
+
] }),
|
|
729
|
+
/* @__PURE__ */ jsx(
|
|
730
|
+
RecentRuns,
|
|
731
|
+
{
|
|
732
|
+
integration: integration.integration,
|
|
733
|
+
opKey: key,
|
|
734
|
+
logBase: consoleHref
|
|
735
|
+
}
|
|
736
|
+
)
|
|
737
|
+
]
|
|
738
|
+
}
|
|
739
|
+
);
|
|
305
740
|
}
|
|
306
741
|
export {
|
|
307
742
|
OperationRunnerPanel,
|