import { useAtomValue } from "@effect/atom-react"; import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; import { connectionsAllAtom } from "@executor-js/react/api/atoms"; import { ownerLabel, useOwnerDisplay } from "@executor-js/react/api/owner-display"; import { IntegrationSlug, type Connection } from "@executor-js/sdk/shared"; import { Badge } from "@executor-js/react/components/badge"; import { Button } from "@executor-js/react/components/button"; import { CardStack, CardStackContent, CardStackEntry, CardStackEntryContent, CardStackEntryDescription, CardStackEntryTitle, } from "@executor-js/react/components/card-stack"; import { openApiIntegrationAtom } from "./atoms"; // --------------------------------------------------------------------------- // v2 edit — the integration's spec, base URL, and auth templates are part of // its catalog config, which core treats as opaque and the API exposes as a // read-only `getIntegration`. There are no per-scope source rows, no credential // slots, and no binding writers to configure here anymore. Editing is reduced // to surfacing the integration's identity and its current connections; new // credentials are created on the integration's detail/connections surface. // --------------------------------------------------------------------------- export default function EditOpenApiSource(props: { readonly sourceId: string; readonly onSave: () => void; }) { const slug = IntegrationSlug.make(props.sourceId); const integrationResult = useAtomValue(openApiIntegrationAtom(slug)); const ownerDisplay = useOwnerDisplay(); // Connections across BOTH owners (omit-owner read); each row keeps its owner // for the per-connection badge below. const connectionsResult = useAtomValue(connectionsAllAtom); const integration = AsyncResult.isSuccess(integrationResult) && integrationResult.value ? integrationResult.value : null; const connections: readonly Connection[] = AsyncResult.isSuccess(connectionsResult) ? connectionsResult.value.filter((candidate: Connection) => candidate.integration === slug) : []; if (!integration) { return (
Loading…