@ekanos/harness 0.3.0 → 0.4.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 -6
- package/dist/app.js +2 -2
- package/dist/internal/components/harness-widget-provider.d.ts +1 -1
- package/dist/internal/components/i18n-provider.d.ts +3 -3
- package/dist/internal/components/i18n-provider.js +3 -3
- package/dist/internal/components/viewport-frame.js +2 -2
- package/dist/internal/components/widget-boundary.d.ts +1 -1
- package/dist/internal/components/widget-surface.js +2 -0
- package/dist/internal/lib/actions-transport.d.ts +1 -1
- package/dist/internal/lib/harness-live-fetch.d.ts +1 -1
- package/dist/internal/lib/harness-query-client.d.ts +1 -1
- package/dist/internal/lib/toolbar-context.d.ts +4 -4
- package/dist/internal/routes/activation-page.js +2 -2
- package/dist/internal/routes/index-page.js +1 -1
- package/dist/internal/routes/root-layout.js +1 -1
- package/dist/internal/routes/triggers-page.js +24 -4
- package/dist/internal/server/actions-fixtures-context.js +6 -2
- package/dist/internal/server/api-router.d.ts +1 -1
- package/dist/internal/server/api-router.js +5 -2
- package/dist/internal/server/oauth-loop.d.ts +1 -1
- package/dist/internal/server/storage-read.d.ts +1 -1
- package/dist/registry.d.ts +7 -7
- package/dist/styles.css +2 -2
- package/package.json +36 -41
- package/dist/internal/lib/i18n.d.ts +0 -2
- package/dist/internal/lib/i18n.js +0 -17
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @ekanos/harness
|
|
2
2
|
|
|
3
3
|
The Ekanos integration dev harness: every surface of an integration rendered in
|
|
4
|
-
real
|
|
4
|
+
real Ekanos chrome — the actual dashboard grid, the actual `Widget.*` compound
|
|
5
5
|
components, the actual design tokens — from fixtures, with no Supabase, no auth
|
|
6
6
|
and no network.
|
|
7
7
|
|
|
@@ -589,7 +589,7 @@ on it to write a fixture.
|
|
|
589
589
|
|
|
590
590
|
## Live mode — real requests to your own API
|
|
591
591
|
|
|
592
|
-
The harness mocks
|
|
592
|
+
The harness mocks Ekanos, not your vendor. Declare a `live` block and the
|
|
593
593
|
toolbar grows a fixtures ⇄ live switch: in live mode the harness stops seeding
|
|
594
594
|
your data keys, your widgets' own query functions run, and their requests reach
|
|
595
595
|
the real API. There is still no Supabase, no auth and no server actions in
|
|
@@ -642,11 +642,11 @@ work to do. A definition declaring more than live mode exercises is fine; the
|
|
|
642
642
|
reverse is the fault, and while it stands the harness forces fixtures mode and
|
|
643
643
|
says so on the surface.
|
|
644
644
|
|
|
645
|
-
**`seeds` are the keys that stay mocked in live mode.**
|
|
645
|
+
**`seeds` are the keys that stay mocked in live mode.** Ekanos-side state your
|
|
646
646
|
widgets read before they can call anything: a saved location, an account
|
|
647
647
|
preference, whatever your own host route would have returned. Everything not
|
|
648
648
|
listed runs its real query function. That one line is the whole boundary the
|
|
649
|
-
design draws:
|
|
649
|
+
design draws: Ekanos mocked, vendor real.
|
|
650
650
|
|
|
651
651
|
An integration with no `live` block is fixtures-only; the toolbar control is
|
|
652
652
|
disabled for it and says why. One WITH a `live` block still opens in fixtures
|
|
@@ -938,7 +938,7 @@ oauth: { connected: { empty: false } }, // show the Connect prompt on `empty`
|
|
|
938
938
|
|
|
939
939
|
The mock context is derived from the definition — slug, storage schemas, egress
|
|
940
940
|
— and from your `fixtures`, which answer `ctx.fetch` here exactly as they answer
|
|
941
|
-
a widget. `triggerMocks` supplies the rest: whatever
|
|
941
|
+
a widget. `triggerMocks` supplies the rest: whatever Ekanos-side state your
|
|
942
942
|
handlers need to run a happy path.
|
|
943
943
|
|
|
944
944
|
**So do not re-author your vendor payloads as `fetchHandlers`.** That was the
|
|
@@ -1144,4 +1144,4 @@ published tarball, in a clean room outside the workspace.
|
|
|
1144
1144
|
|
|
1145
1145
|
MIT. Font Awesome is the consuming app's responsibility: this package ships no
|
|
1146
1146
|
icon-font data, and the generated shell loads Font Awesome **Free**, because
|
|
1147
|
-
|
|
1147
|
+
Ekanos's own Pro webfonts are commercially licensed and cannot be redistributed.
|
package/dist/app.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RootLayout } from "./internal/routes/root-layout.js";
|
|
2
2
|
import { IndexPage } from "./internal/routes/index-page.js";
|
|
3
3
|
const harnessMetadata = {
|
|
4
|
-
title: "
|
|
5
|
-
description: "Render integration widgets, marketplace tiles and activation forms in real
|
|
4
|
+
title: "Ekanos Integration Harness",
|
|
5
|
+
description: "Render integration widgets, marketplace tiles and activation forms in real Ekanos chrome, from fixtures, with no Supabase, auth or network."
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
8
8
|
IndexPage,
|
|
@@ -12,7 +12,7 @@ import { type WidgetHealth, type WidgetRenderState } from '@ekanos/sdk/component
|
|
|
12
12
|
* from `WidgetContext`, and something has to PROVIDE it. In the real app that is
|
|
13
13
|
* `DashboardWidgetProvider`, which lives in the host's own package and is not
|
|
14
14
|
* part of the published `@ekanos/sdk` surface — on purpose. It is coupled to
|
|
15
|
-
* things that only exist inside
|
|
15
|
+
* things that only exist inside Ekanos: `'use server'` persistence callbacks
|
|
16
16
|
* for the widget-config hierarchy, and the Supabase rows behind them. The SDK
|
|
17
17
|
* inversion drew the line exactly there: the SDK exports the CONSUMER side
|
|
18
18
|
* (`WidgetContext` plus `WidgetContextValue` / `WidgetState` / `WidgetActions` /
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import '../lib/i18n.js';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* The next-intl provider `@ekanos/ui/trans` reads. The harness ships no
|
|
4
|
+
* translations: every SDK `<Trans>` carries `defaults`, which is what renders
|
|
5
|
+
* when a key is missing, so empty messages are all it needs.
|
|
6
6
|
*/
|
|
7
7
|
export declare function I18nProvider({ children }: {
|
|
8
8
|
children: ReactNode;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { NextIntlClientProvider } from "next-intl";
|
|
4
4
|
function I18nProvider({ children }) {
|
|
5
|
-
return /* @__PURE__ */ jsx(
|
|
5
|
+
return /* @__PURE__ */ jsx(NextIntlClientProvider, { locale: "en", messages: {}, timeZone: "UTC", children });
|
|
6
6
|
}
|
|
7
7
|
export {
|
|
8
8
|
I18nProvider
|
|
@@ -15,8 +15,8 @@ function ViewportFrame({ children }) {
|
|
|
15
15
|
/* @__PURE__ */ jsx(
|
|
16
16
|
"div",
|
|
17
17
|
{
|
|
18
|
-
className: "w-full overflow-hidden rounded-lg border p-5",
|
|
19
|
-
style: {
|
|
18
|
+
className: "w-full max-w-(--viewport-width) overflow-hidden rounded-lg border p-5",
|
|
19
|
+
style: { "--viewport-width": `${width}px` },
|
|
20
20
|
children
|
|
21
21
|
}
|
|
22
22
|
)
|
|
@@ -20,6 +20,6 @@ export declare class WidgetBoundary extends Component<Props, State> {
|
|
|
20
20
|
static getDerivedStateFromError(error: Error): State;
|
|
21
21
|
componentDidUpdate(previous: Props): void;
|
|
22
22
|
componentDidCatch(error: Error): void;
|
|
23
|
-
render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean |
|
|
23
|
+
render(): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
24
24
|
}
|
|
25
25
|
export {};
|
|
@@ -32,6 +32,8 @@ function toWidgetConfig(widget, productSlug, unhealthy) {
|
|
|
32
32
|
integrationMetadata: {
|
|
33
33
|
productId: productSlug,
|
|
34
34
|
productSlug,
|
|
35
|
+
// The harness previews a partner package, which is always an integration.
|
|
36
|
+
kind: "integration",
|
|
35
37
|
integrationName: productSlug,
|
|
36
38
|
description: "",
|
|
37
39
|
category: "harness",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* through, and read by `internal/server/api-router.ts`'s action handler.
|
|
24
24
|
* Neither is a production concept — they never leave this process, an
|
|
25
25
|
* absent or garbled value on the server side falls back to fixtures (never
|
|
26
|
-
* to live), and no real
|
|
26
|
+
* to live), and no real Ekanos host route reads either header because a
|
|
27
27
|
* real host route has no "mode" to be told.
|
|
28
28
|
*/
|
|
29
29
|
export declare const HARNESS_ACTIONS_MODE_HEADER = "x-ekanos-harness-data-mode";
|
|
@@ -4,7 +4,7 @@ import type { IntegrationFetch } from '@ekanos/sdk';
|
|
|
4
4
|
* THE HARNESS'S `ctx.fetch`
|
|
5
5
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
6
6
|
*
|
|
7
|
-
* The harness mocks
|
|
7
|
+
* The harness mocks Ekanos. It does NOT mock your vendor's API — and in live
|
|
8
8
|
* mode it stops standing between you and it. What it does instead is enforce
|
|
9
9
|
* the one rule that matters: an integration may only reach the origins it
|
|
10
10
|
* DECLARED in `defineIntegration({ egress })`.
|
|
@@ -33,7 +33,7 @@ export declare class MissingFixtureError extends Error {
|
|
|
33
33
|
*
|
|
34
34
|
* LIVE mode installs no override at all, so react-query falls through to each
|
|
35
35
|
* widget's own `queryFn` — the real one, reaching the real vendor API through
|
|
36
|
-
* the allowlisted fetch.
|
|
36
|
+
* the allowlisted fetch. Ekanos-side keys are still pre-seeded, so a widget
|
|
37
37
|
* that needs an account setting before it can call anything still gets one.
|
|
38
38
|
*
|
|
39
39
|
* `retry: false` matters as much as the rest: the default three retries with
|
|
@@ -4,19 +4,19 @@ import { type DataMode, type FixtureVariant } from '../../registry.js';
|
|
|
4
4
|
export declare const RENDER_STATES: readonly ["active", "loading", "error", "inactive", "disabled"];
|
|
5
5
|
export declare const VIEWPORTS: {
|
|
6
6
|
readonly mobile: {
|
|
7
|
-
readonly label:
|
|
7
|
+
readonly label: 'Mobile';
|
|
8
8
|
readonly width: 390;
|
|
9
9
|
};
|
|
10
10
|
readonly tablet: {
|
|
11
|
-
readonly label:
|
|
11
|
+
readonly label: 'Tablet';
|
|
12
12
|
readonly width: 820;
|
|
13
13
|
};
|
|
14
14
|
readonly desktop: {
|
|
15
|
-
readonly label:
|
|
15
|
+
readonly label: 'Desktop';
|
|
16
16
|
readonly width: 1280;
|
|
17
17
|
};
|
|
18
18
|
readonly full: {
|
|
19
|
-
readonly label:
|
|
19
|
+
readonly label: 'Full';
|
|
20
20
|
readonly width: null;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
@@ -68,7 +68,7 @@ function ActivationPage() {
|
|
|
68
68
|
/* @__PURE__ */ jsx(AlertTitle, { children: mode === "live" ? "Submissions run onActivate on the dev server" : "Submissions go nowhere" }),
|
|
69
69
|
/* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
70
70
|
/* @__PURE__ */ jsxs("p", { children: [
|
|
71
|
-
"The harness has no
|
|
71
|
+
"The harness has no Ekanos backend. Submitting shows you the",
|
|
72
72
|
" ",
|
|
73
73
|
/* @__PURE__ */ jsx("code", { children: "ActivationResult" }),
|
|
74
74
|
" your form handed back instead of persisting it \u2014 which is the part worth checking, since that payload is what the real activation action would store. The dialog, the capability and permission sections and the connected state are the real ones, rendered from your ",
|
|
@@ -322,7 +322,7 @@ function ConnectedState({
|
|
|
322
322
|
{
|
|
323
323
|
className: "text-muted-foreground text-sm",
|
|
324
324
|
"data-test": "activation-mode-notice",
|
|
325
|
-
children: mode === "live" ? hasLiveActivationData ? "The toolbar is on Live API \u2014 this activation data is available to live-mode widgets on this visit." : "The toolbar is on Live API. This activation submitted no data of its own; an OAuth integration\u2019s credentials live on the dev server, where onTokens stored them." : "This surface is
|
|
325
|
+
children: mode === "live" ? hasLiveActivationData ? "The toolbar is on Live API \u2014 this activation data is available to live-mode widgets on this visit." : "The toolbar is on Live API. This activation submitted no data of its own; an OAuth integration\u2019s credentials live on the dev server, where onTokens stored them." : "This surface is Ekanos-mocked; widgets read fixtures \u2014 switch the toolbar to Live API to exercise real requests."
|
|
326
326
|
}
|
|
327
327
|
),
|
|
328
328
|
/* @__PURE__ */ jsx(
|
|
@@ -8,7 +8,7 @@ function IndexPage({
|
|
|
8
8
|
return /* @__PURE__ */ jsxs("main", { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 px-6 py-10", children: [
|
|
9
9
|
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-2", children: [
|
|
10
10
|
/* @__PURE__ */ jsx("h1", { className: "font-heading text-3xl tracking-tight", children: "Integration harness" }),
|
|
11
|
-
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Every registered integration, rendered in real
|
|
11
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Every registered integration, rendered in real Ekanos chrome from fixtures. No Supabase, no auth, no network." })
|
|
12
12
|
] }),
|
|
13
13
|
integrations.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "bg-card flex flex-col items-center gap-3 rounded-lg border p-6 text-center", children: [
|
|
14
14
|
/* @__PURE__ */ jsx(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import "@fortawesome/fontawesome-free/css/all.min.css";
|
|
3
4
|
import { IconStyleOverrideProvider } from "@ekanos/ui/icon";
|
|
4
5
|
import { cn } from "@ekanos/ui/utils";
|
|
5
|
-
import "@fortawesome/fontawesome-free/css/all.min.css";
|
|
6
6
|
import { ThemeProvider } from "next-themes";
|
|
7
7
|
import { DevToolbar } from "../components/dev-toolbar.js";
|
|
8
8
|
import { I18nProvider } from "../components/i18n-provider.js";
|
|
@@ -3,6 +3,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
4
|
import { notFound } from "next/navigation";
|
|
5
5
|
import { isEgressAllowed } from "@ekanos/sdk/context";
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_SIGNATURE_TOLERANCE_SECONDS
|
|
8
|
+
} from "@ekanos/sdk/integration";
|
|
6
9
|
import { Alert, AlertDescription, AlertTitle } from "@ekanos/ui/alert";
|
|
7
10
|
import { Badge } from "@ekanos/ui/badge";
|
|
8
11
|
import { Button } from "@ekanos/ui/button";
|
|
@@ -16,6 +19,22 @@ import {
|
|
|
16
19
|
createServerTriggerRunner
|
|
17
20
|
} from "../lib/trigger-runner.js";
|
|
18
21
|
import { useHarnessIntegration } from "../registry-context.js";
|
|
22
|
+
function describeSignatureScheme(scheme) {
|
|
23
|
+
const parts = [`HMAC-${(scheme.algorithm ?? "sha256").toUpperCase()}`];
|
|
24
|
+
parts.push(`over ${scheme.signedPayload ?? "{body}"}`);
|
|
25
|
+
if (scheme.format === "keyed") {
|
|
26
|
+
parts.push(
|
|
27
|
+
`keyed (${scheme.digestKey}${scheme.timestampKey ? `, t=${scheme.timestampKey}` : ""})`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
if (scheme.timestampHeader)
|
|
31
|
+
parts.push(`timestamp header ${scheme.timestampHeader}`);
|
|
32
|
+
if (scheme.timestampKey || scheme.timestampHeader) {
|
|
33
|
+
const tolerance = scheme.toleranceSeconds ?? DEFAULT_SIGNATURE_TOLERANCE_SECONDS;
|
|
34
|
+
parts.push(tolerance === 0 ? "no replay window" : `\xB1${tolerance}s`);
|
|
35
|
+
}
|
|
36
|
+
return parts.join(" \xB7 ");
|
|
37
|
+
}
|
|
19
38
|
function OutcomePanel({ outcome }) {
|
|
20
39
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", "data-test": "trigger-outcome", children: [
|
|
21
40
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -77,7 +96,8 @@ function WebhookCard({
|
|
|
77
96
|
' \u21D0 secret "',
|
|
78
97
|
webhook.signature.secretName,
|
|
79
98
|
'"'
|
|
80
|
-
] })
|
|
99
|
+
] }),
|
|
100
|
+
webhook.signature !== "none" && webhook.signature.scheme ? /* @__PURE__ */ jsx(Badge, { variant: "outline", "data-test": `webhook-${webhook.id}-scheme`, children: describeSignatureScheme(webhook.signature.scheme) }) : null
|
|
81
101
|
] }),
|
|
82
102
|
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: webhook.description }),
|
|
83
103
|
webhook.signature !== "none" ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: "Signature verification is the transport's job \u2014 the harness skips it (and says so in the handler logs); the host ingress will enforce it before your handler ever runs." }) : null,
|
|
@@ -223,17 +243,17 @@ function OAuthCard({
|
|
|
223
243
|
" via",
|
|
224
244
|
" ",
|
|
225
245
|
/* @__PURE__ */ jsx("code", { children: "ctx.secrets" }),
|
|
226
|
-
". The hosted transport runs it in
|
|
246
|
+
". The hosted transport runs it in Ekanos; in live mode the generated shell runs the same loop here, on localhost, against your own developer app \u2014 see Local OAuth below."
|
|
227
247
|
] }),
|
|
228
248
|
/* @__PURE__ */ jsxs("p", { children: [
|
|
229
249
|
/* @__PURE__ */ jsx("strong", { children: "Redirect URI \u2014 host-derived, and not something you declare." }),
|
|
230
250
|
" ",
|
|
231
251
|
"Whichever host runs the flow builds it from its own origin, so there is no field for it in ",
|
|
232
252
|
/* @__PURE__ */ jsx("code", { children: "defineIntegration()" }),
|
|
233
|
-
". You register one per environment with your provider: the harness's (below, in live mode) and the
|
|
253
|
+
". You register one per environment with your provider: the harness's (below, in live mode) and the Ekanos host's,",
|
|
234
254
|
" ",
|
|
235
255
|
/* @__PURE__ */ jsxs("code", { children: [
|
|
236
|
-
"https://<your-
|
|
256
|
+
"https://<your-ekanos-host>/api/integrations/",
|
|
237
257
|
definition.slug,
|
|
238
258
|
"/oauth/callback"
|
|
239
259
|
] }),
|
|
@@ -5,7 +5,11 @@ import {
|
|
|
5
5
|
HARNESS_ACCOUNT_ID,
|
|
6
6
|
resolveEgress
|
|
7
7
|
} from "../../registry.js";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
compileFixtures,
|
|
10
|
+
fixturesToMockHandlers,
|
|
11
|
+
needsSelfOrigin
|
|
12
|
+
} from "../lib/http-fixtures.js";
|
|
9
13
|
const STORE = /* @__PURE__ */ Symbol.for("ekanos.harness.fixtures-actions-state");
|
|
10
14
|
function getStore() {
|
|
11
15
|
const carrier = globalThis;
|
|
@@ -23,7 +27,7 @@ function getFixturesActionsState(input) {
|
|
|
23
27
|
const definition = input.definition;
|
|
24
28
|
const mocks = input.integration.triggerMocks ?? {};
|
|
25
29
|
const egress = resolveEgress(input.integration);
|
|
26
|
-
const declaredFixtures = input.integration.fixtures?.[input.variant] ?? [];
|
|
30
|
+
const declaredFixtures = (input.integration.fixtures?.[input.variant] ?? []).filter((fixture) => !needsSelfOrigin(fixture));
|
|
27
31
|
const ctx = createMockContext({
|
|
28
32
|
accountId: HARNESS_ACCOUNT_ID,
|
|
29
33
|
integration: { slug: definition.slug },
|
|
@@ -26,7 +26,7 @@ import { type HarnessIntegration } from '../../registry.js';
|
|
|
26
26
|
* `trigger`) or a dedicated per-variant fixtures ctx
|
|
27
27
|
* (`getFixturesActionsState`, network-free).
|
|
28
28
|
*
|
|
29
|
-
* Contracts mirror the
|
|
29
|
+
* Contracts mirror the Ekanos host's own partner routes — the hosted OAuth
|
|
30
30
|
* transport and the generic storage route — so the SDK's client
|
|
31
31
|
* helpers (`createPartnerConnectionCheck`, `fetchIntegrationStorage`,
|
|
32
32
|
* `partnerOAuthErrorParam`) work against either unchanged. Where the harness
|
|
@@ -38,6 +38,9 @@ import {
|
|
|
38
38
|
} from "./oauth-loop.js";
|
|
39
39
|
import { resolveProjectRoot } from "./project-root.js";
|
|
40
40
|
import { parseStorageQuery, readClientReadableStorage } from "./storage-read.js";
|
|
41
|
+
function asSafeParseSchema(schema) {
|
|
42
|
+
return schema;
|
|
43
|
+
}
|
|
41
44
|
function json(body, init = {}) {
|
|
42
45
|
return new Response(JSON.stringify(body), {
|
|
43
46
|
...init,
|
|
@@ -434,7 +437,7 @@ async function actionInvoke(ctx, actionName) {
|
|
|
434
437
|
{ status: 400 }
|
|
435
438
|
);
|
|
436
439
|
}
|
|
437
|
-
const parsed = action.input.safeParse(
|
|
440
|
+
const parsed = asSafeParseSchema(action.input).safeParse(
|
|
438
441
|
body?.input
|
|
439
442
|
);
|
|
440
443
|
if (!parsed.success) {
|
|
@@ -458,7 +461,7 @@ async function actionInvoke(ctx, actionName) {
|
|
|
458
461
|
}).ctx;
|
|
459
462
|
const data = await action.handler(executionCtx, parsed.data);
|
|
460
463
|
if (action.output) {
|
|
461
|
-
const validated = action.output.safeParse(data);
|
|
464
|
+
const validated = asSafeParseSchema(action.output).safeParse(data);
|
|
462
465
|
if (!validated.success) {
|
|
463
466
|
console.error(
|
|
464
467
|
`[harness:${ctx.slug}] action "${actionName}" resolved a value that fails its own declared \`output\` schema:`,
|
|
@@ -5,7 +5,7 @@ import type { OAuthProviderDeclaration, OAuthTokens } from '@ekanos/sdk/integrat
|
|
|
5
5
|
* THE LOCALHOST OAUTH LOOP — pure helpers
|
|
6
6
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
7
7
|
*
|
|
8
|
-
* The REFERENCE implementation is the
|
|
8
|
+
* The REFERENCE implementation is the Ekanos host's hosted OAuth transport
|
|
9
9
|
* (its `oauth-transport` module). These helpers mirror its pure half — PKCE, the authorize URL, the return-path check, the
|
|
10
10
|
* code exchange and its token mapping — so a flow that works here works
|
|
11
11
|
* there. They are duplicated rather than shared because that module is host
|
|
@@ -2,7 +2,7 @@ import type { IntegrationContext } from '@ekanos/sdk';
|
|
|
2
2
|
import type { IntegrationDefinition } from '@ekanos/sdk/integration';
|
|
3
3
|
/**
|
|
4
4
|
* The read half of `GET /api/integrations/[slug]/storage`, mirroring the
|
|
5
|
-
*
|
|
5
|
+
* Ekanos host's generic storage route so `fetchIntegrationStorage()` in `@ekanos/sdk` — and therefore every
|
|
6
6
|
* partner widget built on it — works against the harness unchanged:
|
|
7
7
|
*
|
|
8
8
|
* - `?accountId=…&keys=a,b`, at most 20 keys, 400 on a malformed request;
|
package/dist/registry.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { MockFetchHandler } from '@ekanos/sdk/testing';
|
|
|
8
8
|
* supply at least `default`; the others are optional and fall back to
|
|
9
9
|
* "nothing seeded", which surfaces as the widget's own error state.
|
|
10
10
|
*/
|
|
11
|
-
export declare const FIXTURE_VARIANTS: readonly [
|
|
11
|
+
export declare const FIXTURE_VARIANTS: readonly ['default', 'empty', 'error'];
|
|
12
12
|
export type FixtureVariant = (typeof FIXTURE_VARIANTS)[number];
|
|
13
13
|
/**
|
|
14
14
|
* One programmed outcome for one react-query key.
|
|
@@ -104,12 +104,12 @@ export interface HarnessWidget {
|
|
|
104
104
|
* LIVE MODE — opting your integration into real third-party requests
|
|
105
105
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
106
106
|
*
|
|
107
|
-
* The harness mocks
|
|
107
|
+
* The harness mocks Ekanos, not your vendor. Declare this and the toolbar grows
|
|
108
108
|
* a fixtures ⇄ live switch for your integration: in live mode the harness stops
|
|
109
109
|
* seeding your data keys, your widgets' own query functions run, and the
|
|
110
110
|
* requests they make reach the real API.
|
|
111
111
|
*
|
|
112
|
-
*
|
|
112
|
+
* Ekanos stays mocked either way. There is still no Supabase, no auth and no
|
|
113
113
|
* server action — which is what `seeds` below is for.
|
|
114
114
|
*
|
|
115
115
|
* What you write is three fields:
|
|
@@ -279,7 +279,7 @@ export interface HarnessLiveMode {
|
|
|
279
279
|
children: ReactNode;
|
|
280
280
|
}>;
|
|
281
281
|
/**
|
|
282
|
-
* Keys that stay MOCKED in live mode:
|
|
282
|
+
* Keys that stay MOCKED in live mode: Ekanos-side state your widgets read
|
|
283
283
|
* before they can call anything — a saved location, an account preference,
|
|
284
284
|
* whatever your own host route would have returned. Seeded exactly like a
|
|
285
285
|
* fixture, and for exactly the same reason: the harness has no Supabase.
|
|
@@ -297,7 +297,7 @@ export interface HarnessLiveMode {
|
|
|
297
297
|
* schedules against ONE `createMockContext()` per visit (state accumulates
|
|
298
298
|
* across invocations, like a real account). The context is derived from the
|
|
299
299
|
* definition itself — slug, storage schemas, egress — and these seeds are the
|
|
300
|
-
* only extra input: whatever
|
|
300
|
+
* only extra input: whatever Ekanos-side state your handlers need to run a
|
|
301
301
|
* happy path (a stored config row, a seeded API key, a programmed response
|
|
302
302
|
* for `ctx.fetch`). There is no Supabase and no network in here either way.
|
|
303
303
|
*/
|
|
@@ -398,7 +398,7 @@ export interface HarnessIntegration {
|
|
|
398
398
|
};
|
|
399
399
|
}
|
|
400
400
|
/** The two data sources a surface can render from. */
|
|
401
|
-
export declare const DATA_MODES: readonly [
|
|
401
|
+
export declare const DATA_MODES: readonly ['fixtures', 'live'];
|
|
402
402
|
export type DataMode = (typeof DATA_MODES)[number];
|
|
403
403
|
/**
|
|
404
404
|
* The account/product identifiers every surface is rendered with. These are
|
|
@@ -469,7 +469,7 @@ export declare function collectSeeds(integration: HarnessIntegration, variant: F
|
|
|
469
469
|
* The seeds for one integration in one mode.
|
|
470
470
|
*
|
|
471
471
|
* Fixtures mode seeds everything the widgets declare. Live mode seeds ONLY the
|
|
472
|
-
*
|
|
472
|
+
* Ekanos-side keys, so every other query function runs for real — that one
|
|
473
473
|
* difference is the whole fixtures ⇄ live switch.
|
|
474
474
|
*/
|
|
475
475
|
export declare function seedsForMode(integration: HarnessIntegration, variant: FixtureVariant, mode: DataMode): FixtureSeed[];
|
package/dist/styles.css
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
@import 'tailwindcss';
|
|
18
18
|
|
|
19
|
-
/*
|
|
19
|
+
/* Ekanos design tokens + the Tailwind v4 @theme preset, consumed from the
|
|
20
20
|
* published package instead of a hand-maintained fork. This single import
|
|
21
21
|
* pulls in the token values, the base rules, the `dark:` variant and the full
|
|
22
22
|
* semantic @theme map. Resolves to `@ekanos/ui/dist/theme.css`, so that
|
|
@@ -156,7 +156,7 @@ i:is(.fa-light, .fa-thin, .fa-duotone, .fa-sharp) {
|
|
|
156
156
|
* Aliasing those by codepoint here is strictly better than the question mark
|
|
157
157
|
* and strictly honest about what it is: an APPROXIMATION for the Free build.
|
|
158
158
|
* `fa-cloud` is not `fa-clouds` and `fa-sun` is not `fa-sun-bright` — in
|
|
159
|
-
* production, where
|
|
159
|
+
* production, where Ekanos loads Font Awesome Pro, the real Pro rule is (0,1,0)
|
|
160
160
|
* and lives in an unlayered vendor sheet, so it wins over the `i.fa-*` selectors
|
|
161
161
|
* below and the authored Pro glyph renders exactly as designed. Nothing here
|
|
162
162
|
* changes what a correctly licensed host shows.
|
package/package.json
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekanos/harness",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "The Ekanos integration dev harness — every surface of an integration rendered in real Fusion chrome, from fixtures, with no Supabase or auth; and, in live mode, a real localhost OAuth loop over your own dev-app credentials.",
|
|
6
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"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.",
|
|
7
5
|
"bugs": {
|
|
8
6
|
"email": "npm@govastly.com"
|
|
9
7
|
},
|
|
10
|
-
"
|
|
11
|
-
"**/*.css",
|
|
12
|
-
"**/i18n.js"
|
|
13
|
-
],
|
|
14
|
-
"ekanos": {
|
|
15
|
-
"shellContract": 2
|
|
16
|
-
},
|
|
8
|
+
"license": "MIT",
|
|
17
9
|
"files": [
|
|
18
10
|
"dist",
|
|
19
11
|
"README.md",
|
|
20
12
|
"LICENSE"
|
|
21
13
|
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"**/*.css",
|
|
17
|
+
"**/i18n.js"
|
|
18
|
+
],
|
|
19
|
+
"typesVersions": {
|
|
20
|
+
"*": {
|
|
21
|
+
"*": [
|
|
22
|
+
"dist/*"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
22
26
|
"exports": {
|
|
23
27
|
"./registry": {
|
|
24
28
|
"types": "./dist/registry.d.ts",
|
|
@@ -55,55 +59,46 @@
|
|
|
55
59
|
},
|
|
56
60
|
"dependencies": {
|
|
57
61
|
"@fortawesome/fontawesome-free": "^7.3.1",
|
|
58
|
-
"i18next": "^25.10.10",
|
|
59
62
|
"next-themes": "0.4.6",
|
|
60
|
-
"react-i18next": "^16.6.6",
|
|
61
63
|
"tw-animate-css": "1.4.0"
|
|
62
64
|
},
|
|
63
|
-
"peerDependencies": {
|
|
64
|
-
"@ekanos/sdk": "^0.3.0",
|
|
65
|
-
"@ekanos/ui": "^0.3.0",
|
|
66
|
-
"@tanstack/react-query": "^5.101.4",
|
|
67
|
-
"next": "^16.0.0",
|
|
68
|
-
"react": "^19.2.8",
|
|
69
|
-
"react-dom": "^19.2.8",
|
|
70
|
-
"react-hook-form": "^7.68.0",
|
|
71
|
-
"tailwindcss": "^4.0.0"
|
|
72
|
-
},
|
|
73
65
|
"devDependencies": {
|
|
74
|
-
"@ekanos/sdk": "0.
|
|
75
|
-
"@ekanos/ui": "0.
|
|
76
|
-
"@kit/eslint-config": "0.2.0",
|
|
77
|
-
"@kit/prettier-config": "0.1.0",
|
|
66
|
+
"@ekanos/sdk": "0.4.0",
|
|
67
|
+
"@ekanos/ui": "0.4.0",
|
|
78
68
|
"@kit/tsconfig": "0.1.0",
|
|
79
69
|
"@tailwindcss/postcss": "4.3.3",
|
|
80
|
-
"@tanstack/react-query": "5.
|
|
70
|
+
"@tanstack/react-query": "5.103.2",
|
|
81
71
|
"@types/node": "25.0.1",
|
|
82
72
|
"@types/react": "19.2.18",
|
|
83
73
|
"@types/react-dom": "19.2.5",
|
|
84
|
-
"next": "16.3.
|
|
74
|
+
"next": "16.3.6",
|
|
75
|
+
"next-intl": "^4.14.7",
|
|
85
76
|
"react": "19.2.8",
|
|
86
77
|
"react-dom": "19.2.8",
|
|
87
|
-
"react-hook-form": "^7.
|
|
78
|
+
"react-hook-form": "^7.88.0",
|
|
88
79
|
"tailwindcss": "4.3.3",
|
|
89
80
|
"tsup": "8.5.1",
|
|
90
|
-
"typescript": "^
|
|
81
|
+
"typescript": "^7.0.2",
|
|
91
82
|
"vitest": "4.1.10",
|
|
92
|
-
"zod": "
|
|
83
|
+
"zod": "4.6.5"
|
|
93
84
|
},
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
"
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"@ekanos/sdk": "^0.4.0",
|
|
87
|
+
"@ekanos/ui": "^0.4.0",
|
|
88
|
+
"@tanstack/react-query": "^5.101.4",
|
|
89
|
+
"next": "^16.0.0",
|
|
90
|
+
"next-intl": "^4.14.7",
|
|
91
|
+
"react": "^19.2.8",
|
|
92
|
+
"react-dom": "^19.2.8",
|
|
93
|
+
"react-hook-form": "^7.68.0",
|
|
94
|
+
"tailwindcss": "^4.0.0"
|
|
95
|
+
},
|
|
96
|
+
"ekanos": {
|
|
97
|
+
"shellContract": 2
|
|
101
98
|
},
|
|
102
99
|
"scripts": {
|
|
103
100
|
"build": "tsup && tsc -p tsconfig.build.json && node scripts/rewrite-esm-specifiers.mjs && node scripts/build-css.mjs",
|
|
104
101
|
"clean": "git clean -xdf .turbo node_modules dist",
|
|
105
|
-
"format": "prettier --check \"**/*.{ts,tsx,mjs}\"",
|
|
106
|
-
"lint": "eslint .",
|
|
107
102
|
"typecheck": "tsc --noEmit",
|
|
108
103
|
"test": "vitest run --config vitest.config.ts",
|
|
109
104
|
"pack:test": "node scripts/pack-test.mjs"
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import i18next from "i18next";
|
|
3
|
-
import { initReactI18next } from "react-i18next";
|
|
4
|
-
if (!i18next.isInitialized) {
|
|
5
|
-
void i18next.use(initReactI18next).init({
|
|
6
|
-
lng: "en",
|
|
7
|
-
fallbackLng: "en",
|
|
8
|
-
supportedLngs: ["en"],
|
|
9
|
-
resources: { en: {} },
|
|
10
|
-
interpolation: { escapeValue: false },
|
|
11
|
-
react: { useSuspense: false }
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
var i18n_default = i18next;
|
|
15
|
-
export {
|
|
16
|
-
i18n_default as default
|
|
17
|
-
};
|