@ekanos/harness 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-types.d.ts +4 -0
- package/dist/internal/components/runtime-strip.js +33 -5
- package/dist/internal/components/schema-form.js +1 -1
- package/dist/internal/components/surface-nav.d.ts +3 -2
- package/dist/internal/components/surface-nav.js +25 -36
- package/dist/internal/lib/experience-runtime.d.ts +2 -1
- package/dist/internal/lib/experience-runtime.js +5 -3
- package/dist/internal/lib/integration-console-href.d.ts +10 -0
- package/dist/internal/lib/integration-console-href.js +10 -0
- package/dist/internal/routes/experience-connect-page.js +5 -5
- package/dist/internal/routes/experience-summary-page.js +9 -12
- package/dist/internal/server/ekanos-api-router.js +20 -5
- package/dist/internal/server/repo-api-router.js +20 -7
- package/package.json +6 -6
package/dist/api-types.d.ts
CHANGED
|
@@ -549,6 +549,8 @@ export interface RepoExperienceIntegration {
|
|
|
549
549
|
modes: BindingMode[];
|
|
550
550
|
/** The integration is a package of this repo. */
|
|
551
551
|
sameRepo: boolean;
|
|
552
|
+
/** That package's name (its bare slug), which its own API is keyed by. */
|
|
553
|
+
packageName: string | null;
|
|
552
554
|
connection: RepoConnection | null;
|
|
553
555
|
/** Levels this experience will ask for once published, within what the integration supports. */
|
|
554
556
|
levels: RepoConnectLevel[];
|
|
@@ -556,6 +558,8 @@ export interface RepoExperienceIntegration {
|
|
|
556
558
|
levelProblem?: string;
|
|
557
559
|
/** Link to connect it (the integration's console), when it is a package of this repo. */
|
|
558
560
|
connectHref: string | null;
|
|
561
|
+
/** The integration's console, when it is a package of this repo. */
|
|
562
|
+
consoleHref: string | null;
|
|
559
563
|
}
|
|
560
564
|
export interface RepoExperienceRow {
|
|
561
565
|
name: string;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
3
4
|
import { usePathname } from "next/navigation";
|
|
4
5
|
import { Button } from "@ekanos/ui/button";
|
|
5
6
|
import { ConfirmDialog } from "@ekanos/ui/confirm-dialog";
|
|
7
|
+
import { cn } from "@ekanos/ui/utils";
|
|
6
8
|
import { answerLabel } from "../lib/connection-facts.js";
|
|
7
9
|
import { useConsoleClient } from "../lib/console-context.js";
|
|
8
10
|
import {
|
|
@@ -10,13 +12,39 @@ import {
|
|
|
10
12
|
useProject,
|
|
11
13
|
useRefreshRuntime
|
|
12
14
|
} from "../lib/console-hooks.js";
|
|
15
|
+
import { integrationConsoleHref } from "../lib/integration-console-href.js";
|
|
13
16
|
import { ConnectDialog } from "./connect-dialog.js";
|
|
14
17
|
import { ConnectionChip } from "./connection-chip.js";
|
|
18
|
+
import { FOCUS_RING } from "./scrollable-nav.js";
|
|
15
19
|
function runtimeChipText(integration) {
|
|
16
20
|
const facts = integration.runtime?.facts;
|
|
17
21
|
if (!facts) return null;
|
|
18
22
|
return `${integration.integration} \xB7 ${answerLabel(facts)}`;
|
|
19
23
|
}
|
|
24
|
+
function IntegrationName({
|
|
25
|
+
integration
|
|
26
|
+
}) {
|
|
27
|
+
const id = integration.integration;
|
|
28
|
+
const slash = id.lastIndexOf("/");
|
|
29
|
+
const namespace = slash === -1 ? null : id.slice(0, slash + 1);
|
|
30
|
+
const name = slash === -1 ? id : id.slice(slash + 1);
|
|
31
|
+
const href = integrationConsoleHref(integration);
|
|
32
|
+
const parts = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33
|
+
namespace ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground min-w-0 truncate", children: namespace }) : null,
|
|
34
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0", children: name })
|
|
35
|
+
] });
|
|
36
|
+
const className = "flex min-w-0 items-baseline rounded-sm font-mono text-sm font-medium";
|
|
37
|
+
return href ? /* @__PURE__ */ jsx(
|
|
38
|
+
Link,
|
|
39
|
+
{
|
|
40
|
+
href,
|
|
41
|
+
className: cn(className, "hover:underline", FOCUS_RING),
|
|
42
|
+
title: `Open the ${id} console`,
|
|
43
|
+
"data-test": "runtime-integration-name",
|
|
44
|
+
children: parts
|
|
45
|
+
}
|
|
46
|
+
) : /* @__PURE__ */ jsx("span", { className, title: id, "data-test": "runtime-integration-name", children: parts });
|
|
47
|
+
}
|
|
20
48
|
function onConnectTab(pathname) {
|
|
21
49
|
return Boolean(pathname && /\/connect\/?$/.test(pathname));
|
|
22
50
|
}
|
|
@@ -41,7 +69,7 @@ function RuntimeStrip() {
|
|
|
41
69
|
const list = /* @__PURE__ */ jsx(
|
|
42
70
|
"ul",
|
|
43
71
|
{
|
|
44
|
-
className: "flex flex-col gap-2",
|
|
72
|
+
className: "flex flex-col gap-2 sm:grid sm:grid-cols-[max-content_minmax(0,1fr)_auto] sm:gap-x-3",
|
|
45
73
|
"data-test": "runtime-strip",
|
|
46
74
|
"aria-label": "Where each integration gets its answers",
|
|
47
75
|
children: rows.map((integration) => {
|
|
@@ -53,14 +81,14 @@ function RuntimeStrip() {
|
|
|
53
81
|
return /* @__PURE__ */ jsxs(
|
|
54
82
|
"li",
|
|
55
83
|
{
|
|
56
|
-
className: "flex flex-wrap items-center gap-x-3 gap-y-2",
|
|
84
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-2 sm:col-span-3 sm:grid sm:grid-cols-subgrid",
|
|
57
85
|
"data-test": `runtime-${integration.integration}`,
|
|
58
86
|
"data-mode": runtime.mode,
|
|
59
87
|
"data-reason": runtime.reason,
|
|
60
88
|
children: [
|
|
61
|
-
/* @__PURE__ */ jsx(
|
|
89
|
+
/* @__PURE__ */ jsx(IntegrationName, { integration }),
|
|
62
90
|
/* @__PURE__ */ jsx("span", { className: "flex min-w-48 flex-1 flex-wrap items-center gap-x-3 gap-y-1", children: /* @__PURE__ */ jsx(ConnectionChip, { facts, variant: "answer" }) }),
|
|
63
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
91
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 sm:justify-end", children: [
|
|
64
92
|
connectable && facts.state === "not_connected" ? /* @__PURE__ */ jsx(
|
|
65
93
|
ConnectDialog,
|
|
66
94
|
{
|
|
@@ -249,7 +249,7 @@ function Field({
|
|
|
249
249
|
/* @__PURE__ */ jsxs(
|
|
250
250
|
"div",
|
|
251
251
|
{
|
|
252
|
-
className: "bg-
|
|
252
|
+
className: "bg-secondary flex flex-col gap-2 rounded-md border p-3",
|
|
253
253
|
children: [
|
|
254
254
|
/* @__PURE__ */ jsx(
|
|
255
255
|
Field,
|
|
@@ -24,8 +24,9 @@ export declare function experienceTabs(base?: string, repo?: boolean): ConsoleTa
|
|
|
24
24
|
export declare const EXPERIENCE_TABS: readonly ConsoleTab[];
|
|
25
25
|
/**
|
|
26
26
|
* The mode-aware console nav. An integration repo gets the console as home:
|
|
27
|
-
* one integration, six tabs. An experience
|
|
28
|
-
*
|
|
27
|
+
* one integration, six tabs. An experience gets the experience tabs; the
|
|
28
|
+
* runtime strip under the nav lists its integrations and links each console.
|
|
29
|
+
* Inside one of those consoles, that integration's own tabs follow.
|
|
29
30
|
*/
|
|
30
31
|
export declare function ConsoleNav({ project, pendingApprovals, }: {
|
|
31
32
|
project: ConsoleProject;
|
|
@@ -6,9 +6,9 @@ import { Icon } from "@ekanos/ui/icon";
|
|
|
6
6
|
import { cn } from "@ekanos/ui/utils";
|
|
7
7
|
import { useConsoleLinks } from "../lib/console-context.js";
|
|
8
8
|
import { SURFACE_DOCS } from "../lib/docs-links.js";
|
|
9
|
+
import { integrationConsoleHref } from "../lib/integration-console-href.js";
|
|
9
10
|
import { previewHref, previewSections } from "../lib/preview-sections.js";
|
|
10
11
|
import { DocsLink } from "./docs-link.js";
|
|
11
|
-
import { ProvenanceBadge } from "./integration-badge.js";
|
|
12
12
|
import { FOCUS_RING, ScrollableNav } from "./scrollable-nav.js";
|
|
13
13
|
function PreviewNav({
|
|
14
14
|
integration
|
|
@@ -198,30 +198,6 @@ function TabLink({ tab, pathname }) {
|
|
|
198
198
|
}
|
|
199
199
|
);
|
|
200
200
|
}
|
|
201
|
-
function IntegrationTab({
|
|
202
|
-
integration,
|
|
203
|
-
pathname
|
|
204
|
-
}) {
|
|
205
|
-
const href = `/integrations/${integration.integration}`;
|
|
206
|
-
const active = pathname === href || pathname.startsWith(`${href}/`);
|
|
207
|
-
return /* @__PURE__ */ jsxs(
|
|
208
|
-
Link,
|
|
209
|
-
{
|
|
210
|
-
href,
|
|
211
|
-
"aria-current": active ? "page" : void 0,
|
|
212
|
-
"data-test": `integration-tab-${integration.integration}`,
|
|
213
|
-
className: cn(
|
|
214
|
-
"flex items-center gap-2 rounded-md px-3 py-2 whitespace-nowrap transition-colors",
|
|
215
|
-
FOCUS_RING,
|
|
216
|
-
active ? "bg-accent text-accent-foreground text-sm font-medium" : "text-muted-foreground hover:bg-accent text-sm"
|
|
217
|
-
),
|
|
218
|
-
children: [
|
|
219
|
-
integration.integration,
|
|
220
|
-
/* @__PURE__ */ jsx(ProvenanceBadge, { provenance: integration.provenance })
|
|
221
|
-
]
|
|
222
|
-
}
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
201
|
function ConsoleNav({
|
|
226
202
|
project,
|
|
227
203
|
pendingApprovals = 0
|
|
@@ -229,6 +205,10 @@ function ConsoleNav({
|
|
|
229
205
|
const pathname = usePathname();
|
|
230
206
|
const links = useConsoleLinks();
|
|
231
207
|
const own = project.integrations[0];
|
|
208
|
+
const current = project.integrations.flatMap((integration) => {
|
|
209
|
+
const href = integrationConsoleHref(integration);
|
|
210
|
+
return href ? [{ integration, href }] : [];
|
|
211
|
+
}).find(({ href }) => pathname === href || pathname.startsWith(`${href}/`));
|
|
232
212
|
return /* @__PURE__ */ jsxs(
|
|
233
213
|
"div",
|
|
234
214
|
{
|
|
@@ -277,17 +257,26 @@ function ConsoleNav({
|
|
|
277
257
|
/* @__PURE__ */ jsx(ScrollableNav, { label: "Experience", children: experienceTabs(links.experience, links.repoHome !== null).map(
|
|
278
258
|
(tab) => /* @__PURE__ */ jsx(TabLink, { tab, pathname }, tab.href)
|
|
279
259
|
) }),
|
|
280
|
-
/* @__PURE__ */ jsxs(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
260
|
+
current ? /* @__PURE__ */ jsxs(
|
|
261
|
+
ScrollableNav,
|
|
262
|
+
{
|
|
263
|
+
label: `${current.integration.integration} console`,
|
|
264
|
+
className: "items-center",
|
|
265
|
+
children: [
|
|
266
|
+
/* @__PURE__ */ jsx(
|
|
267
|
+
"code",
|
|
268
|
+
{
|
|
269
|
+
className: "px-1 text-sm font-medium whitespace-nowrap",
|
|
270
|
+
"data-test": "current-integration",
|
|
271
|
+
children: current.integration.integration
|
|
272
|
+
}
|
|
273
|
+
),
|
|
274
|
+
integrationTabs(current.href.slice("/integrations/".length)).map(
|
|
275
|
+
(tab) => /* @__PURE__ */ jsx(TabLink, { tab, pathname }, tab.href)
|
|
276
|
+
)
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
) : null
|
|
291
280
|
] })
|
|
292
281
|
]
|
|
293
282
|
}
|
|
@@ -26,7 +26,8 @@ export interface ExperienceRuntimeLinks {
|
|
|
26
26
|
* of this experience by `id` (`<experience>/pages/<id>`, the route
|
|
27
27
|
* `ExperiencePageHost` serves) and where to connect an integration (a repo
|
|
28
28
|
* shell's `<experience>/connect` tab; a single project's
|
|
29
|
-
* `/integrations/<name>/connect
|
|
29
|
+
* `/integrations/<name>/connect`, or the experience view for a namespaced
|
|
30
|
+
* one). `navigate` is injectable for tests.
|
|
30
31
|
*/
|
|
31
32
|
export declare function withExperienceLinks(runtime: ExperienceRuntime, options: {
|
|
32
33
|
links: ExperienceRuntimeLinks;
|
|
@@ -45,6 +45,10 @@ function createExperienceRuntime(apiPrefix, options = {}) {
|
|
|
45
45
|
}))
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
+
function connectHref(integration, links) {
|
|
49
|
+
if (links.repoHome !== null) return `${links.experience}/connect`;
|
|
50
|
+
return integration.includes("/") ? links.experience : `/integrations/${encodeURIComponent(integration)}/connect`;
|
|
51
|
+
}
|
|
48
52
|
function withExperienceLinks(runtime, options) {
|
|
49
53
|
const navigate = options.navigate ?? ((href) => globalThis.location.assign(href));
|
|
50
54
|
return {
|
|
@@ -52,9 +56,7 @@ function withExperienceLinks(runtime, options) {
|
|
|
52
56
|
pageHref: (page) => options.pageIds.includes(page) ? `${options.links.experience}/pages/${encodeURIComponent(page)}` : null,
|
|
53
57
|
connect: (integration) => {
|
|
54
58
|
if (!options.integrationNames().includes(integration)) return false;
|
|
55
|
-
navigate(
|
|
56
|
-
options.links.repoHome === null ? `/integrations/${encodeURIComponent(integration)}/connect` : `${options.links.experience}/connect`
|
|
57
|
-
);
|
|
59
|
+
navigate(connectHref(integration, options.links));
|
|
58
60
|
return true;
|
|
59
61
|
}
|
|
60
62
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConsoleIntegration } from './console-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where an integration's console lives, or null when this harness serves none.
|
|
4
|
+
*
|
|
5
|
+
* The console route is one `[slug]` segment, so a namespaced id
|
|
6
|
+
* (`vastly-internal/news`) never routes as written. A package of this same repo
|
|
7
|
+
* is served under its bare slug; a bare id is served as itself; anything else
|
|
8
|
+
* (a registry or published integration) has no console here.
|
|
9
|
+
*/
|
|
10
|
+
export declare function integrationConsoleHref(integration: Pick<ConsoleIntegration, 'integration' | 'provenance'>): string | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function integrationConsoleHref(integration) {
|
|
2
|
+
const id = integration.integration;
|
|
3
|
+
const slash = id.lastIndexOf("/");
|
|
4
|
+
if (slash === -1) return `/integrations/${id}`;
|
|
5
|
+
const { provenance } = integration;
|
|
6
|
+
return provenance.kind === "local" && provenance.scope === "repo" ? `/integrations/${id.slice(slash + 1)}` : null;
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
integrationConsoleHref
|
|
10
|
+
};
|
|
@@ -73,14 +73,14 @@ function Checklist({
|
|
|
73
73
|
index + 1,
|
|
74
74
|
"."
|
|
75
75
|
] }),
|
|
76
|
-
/* @__PURE__ */ jsx(
|
|
76
|
+
used.consoleHref ? /* @__PURE__ */ jsx(
|
|
77
77
|
Link,
|
|
78
78
|
{
|
|
79
|
-
href:
|
|
79
|
+
href: used.consoleHref,
|
|
80
80
|
className: "text-sm font-medium hover:underline",
|
|
81
81
|
children: used.name
|
|
82
82
|
}
|
|
83
|
-
),
|
|
83
|
+
) : /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: used.name }),
|
|
84
84
|
/* @__PURE__ */ jsx(ConnectionStatusChip, { connection: used.connection }),
|
|
85
85
|
used.connection && used.connection.facts.kind !== "none" && used.connection.facts.state !== "connected" ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: CONNECTION_TYPE[used.connection.type] }) : null,
|
|
86
86
|
!used.sameRepo ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: "from the registry" }) : null
|
|
@@ -92,10 +92,10 @@ function Checklist({
|
|
|
92
92
|
] }),
|
|
93
93
|
used.levelProblem ? /* @__PURE__ */ jsx("p", { className: "text-warning-foreground bg-warning rounded-md px-3 py-2 text-xs", children: used.levelProblem }) : null,
|
|
94
94
|
used.connection?.detail ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: used.connection.detail }) : null,
|
|
95
|
-
used.
|
|
95
|
+
used.packageName ? /* @__PURE__ */ jsx(
|
|
96
96
|
ConnectControls,
|
|
97
97
|
{
|
|
98
|
-
name: used.
|
|
98
|
+
name: used.packageName,
|
|
99
99
|
connection: used.connection,
|
|
100
100
|
returnPath: `/experiences/${experience.name}/connect`,
|
|
101
101
|
onChanged: refresh
|
|
@@ -19,11 +19,19 @@ import {
|
|
|
19
19
|
} from "../components/integration-badge.js";
|
|
20
20
|
import { localIntegrations } from "../components/provenance-banner.js";
|
|
21
21
|
import { useProject } from "../lib/console-hooks.js";
|
|
22
|
+
import { integrationConsoleHref } from "../lib/integration-console-href.js";
|
|
22
23
|
const CHECK_TONES = {
|
|
23
24
|
ok: "success",
|
|
24
25
|
failed: "destructive",
|
|
25
26
|
unknown: "neutral"
|
|
26
27
|
};
|
|
28
|
+
function IntegrationConsoleLink({
|
|
29
|
+
integration
|
|
30
|
+
}) {
|
|
31
|
+
const href = integrationConsoleHref(integration);
|
|
32
|
+
const label = `${integration.integration}@${integration.version}`;
|
|
33
|
+
return href ? /* @__PURE__ */ jsx(Link, { href, className: "hover:underline", children: label }) : /* @__PURE__ */ jsx("span", { children: label });
|
|
34
|
+
}
|
|
27
35
|
function ExperienceSummaryPage() {
|
|
28
36
|
const project = useProject();
|
|
29
37
|
if (!project.data) {
|
|
@@ -58,18 +66,7 @@ function ExperienceSummaryPage() {
|
|
|
58
66
|
{
|
|
59
67
|
"data-test": "integration-row",
|
|
60
68
|
children: [
|
|
61
|
-
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */
|
|
62
|
-
Link,
|
|
63
|
-
{
|
|
64
|
-
href: `/integrations/${integration.integration}`,
|
|
65
|
-
className: "hover:underline",
|
|
66
|
-
children: [
|
|
67
|
-
integration.integration,
|
|
68
|
-
"@",
|
|
69
|
-
integration.version
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
) }),
|
|
69
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(IntegrationConsoleLink, { integration }) }),
|
|
73
70
|
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
74
71
|
/* @__PURE__ */ jsx(
|
|
75
72
|
ProvenanceBadge,
|
|
@@ -37,7 +37,6 @@ import {
|
|
|
37
37
|
import { isPinnedToFixtures, setPinnedToFixtures } from "./local-state.js";
|
|
38
38
|
import { loopbackRefusal, isLoopbackHost } from "./loopback-guard.js";
|
|
39
39
|
import { describeOAuthConnections } from "./oauth-connections.js";
|
|
40
|
-
import { hasStoredOauthConnection } from "./oauth-persistence.js";
|
|
41
40
|
import {
|
|
42
41
|
createFileFixtureSource,
|
|
43
42
|
runOperation
|
|
@@ -230,16 +229,32 @@ function createEkanosApiRouter(partial = {}) {
|
|
|
230
229
|
});
|
|
231
230
|
}
|
|
232
231
|
const usesOauth = Boolean(definition.oauth) || Object.keys(definition.oauthConnections ?? {}).length > 0;
|
|
233
|
-
const
|
|
232
|
+
const oauthHeld = usesOauth && describeOAuthConnections({
|
|
233
|
+
definition,
|
|
234
|
+
filled: Object.keys(secrets.values),
|
|
235
|
+
values: secrets.values,
|
|
236
|
+
held: getLiveStore().get(definition.slug),
|
|
237
|
+
stored: readOauthConnections({
|
|
238
|
+
projectRoot: integration.credentialRoot,
|
|
239
|
+
slug: definition.slug
|
|
240
|
+
}),
|
|
241
|
+
personal: {
|
|
242
|
+
slug: definition.slug,
|
|
243
|
+
switches: readConsoleSwitches(integration.credentialRoot),
|
|
244
|
+
stored: readPersonTier({
|
|
245
|
+
projectRoot: integration.credentialRoot,
|
|
246
|
+
slug: definition.slug,
|
|
247
|
+
userId: HARNESS_USER_ID
|
|
248
|
+
}).oauth
|
|
249
|
+
}
|
|
250
|
+
}).some((connection) => connection.connected);
|
|
234
251
|
return deriveConnectionFacts({
|
|
235
252
|
...base,
|
|
236
253
|
usesOauth,
|
|
237
254
|
declared: names,
|
|
238
255
|
missing: secrets.missing,
|
|
239
256
|
activationFieldsSet: Object.keys(secrets.activation),
|
|
240
|
-
oauthHeld
|
|
241
|
-
held && (held.connection || Object.keys(held.connections).length > 0)
|
|
242
|
-
) || hasStoredOauthConnection(integration.credentialRoot, definition.slug),
|
|
257
|
+
oauthHeld,
|
|
243
258
|
manageable: true,
|
|
244
259
|
target: selectConnectionTarget(secrets.activation, names)
|
|
245
260
|
});
|
|
@@ -120,7 +120,10 @@ function createRepoApiRouter(partial) {
|
|
|
120
120
|
declared: data?.declared ?? [],
|
|
121
121
|
missing: data?.missing ?? [],
|
|
122
122
|
activationFieldsSet: data?.activationFieldsSet ?? [],
|
|
123
|
-
|
|
123
|
+
// The package reports each OAuth connection in the tier it connects
|
|
124
|
+
// into (a `level: 'user'` one is the person's); fall back to any held
|
|
125
|
+
// token only for a package that does not report them.
|
|
126
|
+
oauthHeld: manageable && (data?.oauth ?? contractAuth === "oauth2") && (data?.oauthConnections ? data.oauthConnections.some((connection) => connection.connected) : hasOauthConnection(pkg.name, pkg.dir)),
|
|
124
127
|
manageable,
|
|
125
128
|
target: data?.target ?? [],
|
|
126
129
|
supportsLive: manageable,
|
|
@@ -177,7 +180,7 @@ function createRepoApiRouter(partial) {
|
|
|
177
180
|
return failed(error instanceof Error ? error.message : String(error));
|
|
178
181
|
}
|
|
179
182
|
}
|
|
180
|
-
async function experienceRow(request, pkg, connections,
|
|
183
|
+
async function experienceRow(request, pkg, connections, repoPackageName) {
|
|
181
184
|
const row = {
|
|
182
185
|
name: pkg.name,
|
|
183
186
|
version: pkg.version,
|
|
@@ -192,10 +195,11 @@ function createRepoApiRouter(partial) {
|
|
|
192
195
|
}
|
|
193
196
|
const integrations = [];
|
|
194
197
|
for (const view of resolved.data.integrations) {
|
|
195
|
-
const
|
|
198
|
+
const local = repoPackageName(view.integration);
|
|
199
|
+
const sameRepo = local !== null;
|
|
196
200
|
let connection = null;
|
|
197
201
|
if (sameRepo) {
|
|
198
|
-
connection = connections.get(
|
|
202
|
+
connection = connections.get(local) ?? null;
|
|
199
203
|
} else {
|
|
200
204
|
const contract = await call(request, pkg, [
|
|
201
205
|
"contract",
|
|
@@ -233,7 +237,9 @@ function createRepoApiRouter(partial) {
|
|
|
233
237
|
...unsupported.length > 0 ? {
|
|
234
238
|
levelProblem: `Asks for ${unsupported.join(", ")} but ${view.integration} supports ${supported.join(", ") || "no level"}.`
|
|
235
239
|
} : {},
|
|
236
|
-
connectHref: sameRepo ? `/integrations/${
|
|
240
|
+
connectHref: sameRepo ? `/integrations/${local}/connect` : null,
|
|
241
|
+
consoleHref: sameRepo ? `/integrations/${local}` : null,
|
|
242
|
+
packageName: local
|
|
237
243
|
});
|
|
238
244
|
}
|
|
239
245
|
return { ...row, integrations };
|
|
@@ -247,6 +253,11 @@ function createRepoApiRouter(partial) {
|
|
|
247
253
|
(p) => p.kind === "experience"
|
|
248
254
|
);
|
|
249
255
|
const repoNames = new Set(integrationPackages.map((p) => p.name));
|
|
256
|
+
const repoPackageName = (integration) => {
|
|
257
|
+
const slash = integration.lastIndexOf("/");
|
|
258
|
+
const name = slash === -1 ? integration : integration.slice(0, slash) === repo.namespace ? integration.slice(slash + 1) : null;
|
|
259
|
+
return name !== null && repoNames.has(name) ? name : null;
|
|
260
|
+
};
|
|
250
261
|
const connections = /* @__PURE__ */ new Map();
|
|
251
262
|
const integrations = [];
|
|
252
263
|
for (const pkg of integrationPackages) {
|
|
@@ -257,12 +268,14 @@ function createRepoApiRouter(partial) {
|
|
|
257
268
|
const experiences = [];
|
|
258
269
|
for (const pkg of experiencePackages) {
|
|
259
270
|
experiences.push(
|
|
260
|
-
await experienceRow(request, pkg, connections,
|
|
271
|
+
await experienceRow(request, pkg, connections, repoPackageName)
|
|
261
272
|
);
|
|
262
273
|
}
|
|
263
274
|
for (const experience of experiences) {
|
|
264
275
|
for (const used of experience.integrations) {
|
|
265
|
-
|
|
276
|
+
if (!used.sameRepo) continue;
|
|
277
|
+
const local = repoPackageName(used.name);
|
|
278
|
+
integrations.find((row) => row.name === local)?.usedBy.push(experience.name);
|
|
266
279
|
}
|
|
267
280
|
}
|
|
268
281
|
const connectable = integrations.filter(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekanos/harness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Ekanos integration dev harness — every surface of an integration rendered in real Ekanos chrome, from fixtures, with no Supabase or auth; and, in live mode, a real localhost OAuth loop over your own dev-app credentials.",
|
|
6
6
|
"homepage": "https://sdk.ekanos.dev/harness/overview",
|
|
@@ -72,13 +72,13 @@
|
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@ekanos/integration-schema": "0.
|
|
75
|
+
"@ekanos/integration-schema": "0.27.0",
|
|
76
76
|
"next-themes": "0.4.6",
|
|
77
77
|
"tw-animate-css": "1.4.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@ekanos/sdk": "0.
|
|
81
|
-
"@ekanos/ui": "0.
|
|
80
|
+
"@ekanos/sdk": "0.27.0",
|
|
81
|
+
"@ekanos/ui": "0.27.0",
|
|
82
82
|
"@kit/tsconfig": "0.1.0",
|
|
83
83
|
"@tailwindcss/postcss": "4.3.4",
|
|
84
84
|
"@tanstack/react-query": "5.106.1",
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"zod": "4.6.7"
|
|
99
99
|
},
|
|
100
100
|
"peerDependencies": {
|
|
101
|
-
"@ekanos/sdk": "^0.
|
|
102
|
-
"@ekanos/ui": "^0.
|
|
101
|
+
"@ekanos/sdk": "^0.27.0",
|
|
102
|
+
"@ekanos/ui": "^0.27.0",
|
|
103
103
|
"@tanstack/react-query": "^5.101.4",
|
|
104
104
|
"next": "^16.0.0",
|
|
105
105
|
"next-intl": "^4.14.7",
|