khotan-data 0.1.0 → 0.2.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 +89 -6
- package/dist/cli.js +405 -35
- package/dist/factory.cjs +1160 -106
- package/dist/factory.cjs.map +1 -1
- package/dist/factory.d.cts +262 -38
- package/dist/factory.d.ts +262 -38
- package/dist/factory.js +1158 -108
- package/dist/factory.js.map +1 -1
- package/dist/templates/api-state.tsx +249 -0
- package/dist/templates/cache.example.ts +11 -0
- package/dist/templates/cache.ts +58 -0
- package/dist/templates/catch.ts +13 -1
- package/dist/templates/debug-index-page.tsx +56 -36
- package/dist/templates/hub.tsx +9 -23
- package/dist/templates/inflow.ts +5 -6
- package/dist/templates/khotan-config.ts +30 -4
- package/dist/templates/mapping-browser.tsx +773 -0
- package/dist/templates/mappings-page.tsx +9 -0
- package/dist/templates/outflow.ts +5 -5
- package/dist/templates/pass.ts +10 -0
- package/dist/templates/plug-debugger.tsx +15 -7
- package/dist/templates/relay.example.ts +11 -1
- package/dist/templates/relay.ts +16 -7
- package/dist/templates/runs-table.tsx +133 -130
- package/dist/templates/schema.ts +81 -0
- package/dist/templates/skill-plug.md +38 -15
- package/dist/templates/skill-setup.md +80 -3
- package/dist/templates/topology-canvas.tsx +19 -30
- package/dist/templates/var-panel.tsx +33 -10
- package/dist/templates/webhook-events-table.tsx +105 -102
- package/dist/templates/wire-panel.tsx +30 -8
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import { useEffect, useState, useCallback } from "react";
|
|
|
4
4
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
5
5
|
import { Badge } from "@/components/ui/badge";
|
|
6
6
|
import { Button } from "@/components/ui/button";
|
|
7
|
+
import { khotanFetch, ApiErrorState } from "./api-state";
|
|
7
8
|
|
|
8
9
|
// ============================================================================
|
|
9
10
|
// Wire Panel — UI for managing webhook subscriptions
|
|
@@ -45,21 +46,23 @@ export function WirePanel({
|
|
|
45
46
|
const [loading, setLoading] = useState(true);
|
|
46
47
|
const [acting, setActing] = useState(false);
|
|
47
48
|
const [error, setError] = useState<string | null>(null);
|
|
49
|
+
const [loadError, setLoadError] = useState<unknown>(null);
|
|
48
50
|
|
|
49
51
|
const fetchWire = useCallback(async () => {
|
|
52
|
+
setLoading(true);
|
|
53
|
+
setLoadError(null);
|
|
50
54
|
try {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const data = await res.json();
|
|
55
|
+
const data = await khotanFetch<{
|
|
56
|
+
configured?: boolean;
|
|
57
|
+
wire?: WireRecord | null;
|
|
58
|
+
}>(`${basePath}/wires/${plugName}`);
|
|
58
59
|
setConfigured(data.configured ?? false);
|
|
59
60
|
setWire(data.wire ?? null);
|
|
60
61
|
setError(null);
|
|
61
|
-
} catch {
|
|
62
|
+
} catch (err) {
|
|
62
63
|
setConfigured(false);
|
|
64
|
+
setWire(null);
|
|
65
|
+
setLoadError(err);
|
|
63
66
|
} finally {
|
|
64
67
|
setLoading(false);
|
|
65
68
|
}
|
|
@@ -136,6 +139,25 @@ export function WirePanel({
|
|
|
136
139
|
);
|
|
137
140
|
}
|
|
138
141
|
|
|
142
|
+
if (loadError) {
|
|
143
|
+
return (
|
|
144
|
+
<Card>
|
|
145
|
+
<CardHeader className="pb-2">
|
|
146
|
+
<CardTitle className="text-sm font-medium capitalize">
|
|
147
|
+
{displayName} Wire
|
|
148
|
+
</CardTitle>
|
|
149
|
+
</CardHeader>
|
|
150
|
+
<CardContent>
|
|
151
|
+
<ApiErrorState
|
|
152
|
+
error={loadError}
|
|
153
|
+
onRetry={() => void fetchWire()}
|
|
154
|
+
compact
|
|
155
|
+
/>
|
|
156
|
+
</CardContent>
|
|
157
|
+
</Card>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
139
161
|
if (!configured) return null;
|
|
140
162
|
|
|
141
163
|
const isActive = wire?.status === "active";
|