@executor-js/plugin-graphql 1.5.11 → 1.5.13
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/{AddGraphqlSource-FGT7DNXV.js → AddGraphqlSource-B7ZOZ7WM.js} +30 -4
- package/dist/AddGraphqlSource-B7ZOZ7WM.js.map +1 -0
- package/dist/{chunk-OGNJZCEF.js → GraphqlAccountsPanel-QGBVXP2A.js} +4 -4
- package/dist/{chunk-OGNJZCEF.js.map → GraphqlAccountsPanel-QGBVXP2A.js.map} +1 -1
- package/dist/api/group.d.ts +1 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/{chunk-HN5FB4DO.js → chunk-VSLIDDNK.js} +7 -9
- package/dist/chunk-VSLIDDNK.js.map +1 -0
- package/dist/{chunk-OUZI3QNC.js → chunk-XFH7IECG.js} +9 -3
- package/dist/chunk-XFH7IECG.js.map +1 -0
- package/dist/client.js +2 -5
- package/dist/client.js.map +1 -1
- package/dist/core.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/GraphqlSourceFields.d.ts +4 -0
- package/dist/react/atoms.d.ts +2 -0
- package/dist/react/client.d.ts +1 -0
- package/dist/sdk/plugin.d.ts +3 -0
- package/package.json +3 -3
- package/dist/AddGraphqlSource-FGT7DNXV.js.map +0 -1
- package/dist/EditGraphqlSource-QELISUYT.js +0 -38
- package/dist/EditGraphqlSource-QELISUYT.js.map +0 -1
- package/dist/GraphqlAccountsPanel-U62WSGHR.js +0 -9
- package/dist/GraphqlAccountsPanel-U62WSGHR.js.map +0 -1
- package/dist/chunk-HN5FB4DO.js.map +0 -1
- package/dist/chunk-OUZI3QNC.js.map +0 -1
- package/dist/react/EditGraphqlSource.d.ts +0 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addGraphqlIntegrationOptimistic,
|
|
3
3
|
graphqlAuthMethodInputsFromPlacements
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VSLIDDNK.js";
|
|
5
5
|
import "./chunk-732HGFSH.js";
|
|
6
6
|
|
|
7
7
|
// src/react/AddGraphqlSource.tsx
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
CardStackEntryField
|
|
36
36
|
} from "@executor-js/react/components/card-stack";
|
|
37
37
|
import { Input } from "@executor-js/react/components/input";
|
|
38
|
+
import { Textarea } from "@executor-js/react/components/textarea";
|
|
38
39
|
import {
|
|
39
40
|
IntegrationIdentityFieldRows
|
|
40
41
|
} from "@executor-js/react/plugins/integration-identity";
|
|
@@ -65,7 +66,21 @@ function GraphqlSourceFields(props) {
|
|
|
65
66
|
namePlaceholder: "e.g. Shopify API",
|
|
66
67
|
namespaceReadOnly: props.namespaceReadOnly
|
|
67
68
|
}
|
|
68
|
-
)
|
|
69
|
+
),
|
|
70
|
+
props.onDescriptionChange && /* @__PURE__ */ jsxs(CardStackEntryField, { label: "Description", children: [
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
Textarea,
|
|
73
|
+
{
|
|
74
|
+
value: props.description ?? "",
|
|
75
|
+
onChange: (e) => props.onDescriptionChange?.(e.target.value),
|
|
76
|
+
placeholder: "What this API is and when to reach for it",
|
|
77
|
+
rows: 2,
|
|
78
|
+
maxRows: 6,
|
|
79
|
+
className: "text-sm"
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground", children: "Agent-visible. Leave blank to use the schema's own description when it has one." })
|
|
83
|
+
] })
|
|
69
84
|
] }) });
|
|
70
85
|
}
|
|
71
86
|
|
|
@@ -74,6 +89,7 @@ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
|
74
89
|
var NO_SEEDS = [];
|
|
75
90
|
function AddGraphqlSource(props) {
|
|
76
91
|
const [endpoint, setEndpoint] = useState(props.initialUrl ?? "");
|
|
92
|
+
const [description, setDescription] = useState("");
|
|
77
93
|
const identity = useIntegrationIdentity({
|
|
78
94
|
fallbackName: integrationDisplayNameFromUrl(endpoint, "GraphQL") ?? ""
|
|
79
95
|
});
|
|
@@ -113,6 +129,7 @@ function AddGraphqlSource(props) {
|
|
|
113
129
|
endpoint: trimmedEndpoint,
|
|
114
130
|
slug,
|
|
115
131
|
name: displayName,
|
|
132
|
+
...description.trim().length > 0 ? { description: description.trim() } : {},
|
|
116
133
|
...authenticationTemplate.length > 0 ? { authenticationTemplate: [...authenticationTemplate] } : {}
|
|
117
134
|
},
|
|
118
135
|
reactivityKeys: integrationWriteKeys
|
|
@@ -127,7 +144,16 @@ function AddGraphqlSource(props) {
|
|
|
127
144
|
};
|
|
128
145
|
return /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 flex-col gap-6", children: [
|
|
129
146
|
/* @__PURE__ */ jsx2("h1", { className: "text-xl font-semibold text-foreground", children: "Add GraphQL Source" }),
|
|
130
|
-
/* @__PURE__ */ jsx2(
|
|
147
|
+
/* @__PURE__ */ jsx2(
|
|
148
|
+
GraphqlSourceFields,
|
|
149
|
+
{
|
|
150
|
+
endpoint,
|
|
151
|
+
onEndpointChange: setEndpoint,
|
|
152
|
+
identity,
|
|
153
|
+
description,
|
|
154
|
+
onDescriptionChange: setDescription
|
|
155
|
+
}
|
|
156
|
+
),
|
|
131
157
|
/* @__PURE__ */ jsx2(
|
|
132
158
|
AuthMethodListEditor,
|
|
133
159
|
{
|
|
@@ -151,4 +177,4 @@ function AddGraphqlSource(props) {
|
|
|
151
177
|
export {
|
|
152
178
|
AddGraphqlSource as default
|
|
153
179
|
};
|
|
154
|
-
//# sourceMappingURL=AddGraphqlSource-
|
|
180
|
+
//# sourceMappingURL=AddGraphqlSource-B7ZOZ7WM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react/AddGraphqlSource.tsx","../src/react/GraphqlSourceFields.tsx"],"sourcesContent":["import { useCallback, useMemo, useState } from \"react\";\nimport { useAtomSet } from \"@effect/atom-react\";\nimport * as Exit from \"effect/Exit\";\n\nimport { integrationWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport {\n integrationDisplayNameFromUrl,\n slugifyNamespace,\n useIntegrationIdentity,\n} from \"@executor-js/react/plugins/integration-identity\";\nimport { Button } from \"@executor-js/react/components/button\";\nimport {\n AuthMethodListEditor,\n useAuthMethodList,\n type AuthMethodRow,\n type AuthMethodSeed,\n} from \"@executor-js/react/components/auth-method-list-editor\";\nimport { FloatActions } from \"@executor-js/react/components/float-actions\";\nimport { Spinner } from \"@executor-js/react/components/spinner\";\nimport {\n addIntegrationErrorMessage,\n FormErrorAlert,\n SlugCollisionAlert,\n useSlugAlreadyExists,\n} from \"@executor-js/react/lib/integration-add\";\n\nimport { addGraphqlIntegrationOptimistic } from \"./atoms\";\nimport { GraphqlSourceFields } from \"./GraphqlSourceFields\";\nimport { graphqlAuthMethodInputsFromPlacements } from \"./auth-method-config\";\nimport type { GraphqlAuthMethodInput } from \"../sdk/types\";\n\n// v2 GraphQL add flow: register the integration with its declared auth-method\n// LIST (the shared `AuthMethodListEditor` — GraphQL stays header/query apiKey;\n// OAuth is hidden), then route to the integration's detail hub. Connection\n// creation is no longer part of the add flow — accounts are added from the hub\n// (P6: add without auth, connect later).\n\n// GraphQL has no add-time detection, so the list starts empty (module constant\n// — a fresh [] every render would re-seed the list each render).\nconst NO_SEEDS: readonly AuthMethodSeed[] = [];\n\nexport default function AddGraphqlSource(props: {\n onComplete: (slug?: string) => void;\n onCancel: () => void;\n initialUrl?: string;\n}) {\n const [endpoint, setEndpoint] = useState(props.initialUrl ?? \"\");\n const [description, setDescription] = useState(\"\");\n const identity = useIntegrationIdentity({\n fallbackName: integrationDisplayNameFromUrl(endpoint, \"GraphQL\") ?? \"\",\n });\n const authMethodList = useAuthMethodList(NO_SEEDS);\n const [adding, setAdding] = useState(false);\n const [addError, setAddError] = useState<string | null>(null);\n\n const doAddIntegration = useAtomSet(addGraphqlIntegrationOptimistic, {\n mode: \"promiseExit\",\n });\n\n // The methods to register: each apikey row declares ONE method carrying\n // every named placement (header + query mix in a single method). Inputs\n // omit slugs — the backend assigns carrier-derived ones. `none` rows\n // register nothing.\n const authenticationTemplate = useMemo<readonly GraphqlAuthMethodInput[]>(\n () =>\n authMethodList.rows.flatMap((row: AuthMethodRow) =>\n row.value.kind === \"apikey\"\n ? graphqlAuthMethodInputsFromPlacements(row.value.placements)\n : [],\n ),\n [authMethodList.rows],\n );\n\n // Every apikey row needs at least one named placement; `none` rows are\n // always valid.\n const apiKeyComplete = authMethodList.rows.every(\n (row: AuthMethodRow) =>\n row.value.kind !== \"apikey\" ||\n row.value.placements.some((placement) => placement.name.trim().length > 0),\n );\n\n const resolvedSlug = useMemo(\n () =>\n slugifyNamespace(identity.namespace) ||\n slugifyNamespace(integrationDisplayNameFromUrl(endpoint.trim(), \"GraphQL\") ?? \"\") ||\n \"graphql\",\n [endpoint, identity.namespace],\n );\n\n // Pre-empt the API's `IntegrationAlreadyExistsError`: adding an integration\n // whose slug already exists clobbers the existing one's connections/policies,\n // so the API blocks it. Surface that here from the tenant-scoped catalog list.\n const slugAlreadyExists = useSlugAlreadyExists(resolvedSlug);\n\n const canAdd = endpoint.trim().length > 0 && apiKeyComplete && !adding && !slugAlreadyExists;\n\n const sourceIdentity = useCallback(() => {\n const trimmedEndpoint = endpoint.trim();\n const slug = resolvedSlug;\n const displayName =\n identity.name.trim() || integrationDisplayNameFromUrl(trimmedEndpoint, \"GraphQL\") || slug;\n return { trimmedEndpoint, slug, displayName };\n }, [endpoint, identity.name, resolvedSlug]);\n\n const handleAdd = async (): Promise<void> => {\n setAdding(true);\n setAddError(null);\n const { trimmedEndpoint, slug, displayName } = sourceIdentity();\n\n const integrationExit = await doAddIntegration({\n payload: {\n endpoint: trimmedEndpoint,\n slug,\n name: displayName,\n ...(description.trim().length > 0 ? { description: description.trim() } : {}),\n ...(authenticationTemplate.length > 0\n ? { authenticationTemplate: [...authenticationTemplate] }\n : {}),\n },\n reactivityKeys: integrationWriteKeys,\n });\n if (Exit.isFailure(integrationExit)) {\n setAddError(addIntegrationErrorMessage(integrationExit, slug, \"Failed to add source\"));\n setAdding(false);\n return;\n }\n const registeredSlug = integrationExit.value.slug;\n\n props.onComplete(String(registeredSlug));\n };\n\n return (\n <div className=\"flex flex-1 flex-col gap-6\">\n <h1 className=\"text-xl font-semibold text-foreground\">Add GraphQL Source</h1>\n\n <GraphqlSourceFields\n endpoint={endpoint}\n onEndpointChange={setEndpoint}\n identity={identity}\n description={description}\n onDescriptionChange={setDescription}\n />\n\n <AuthMethodListEditor\n list={authMethodList}\n allowedKinds={[\"none\", \"apikey\"]}\n emptyHint=\"No authentication declared. Add a method, or add the source without auth and connect an account from the integration page later.\"\n footerHint=\"Every method here is registered with the source. Connect an account from the integration page after adding.\"\n />\n\n {slugAlreadyExists && !adding && <SlugCollisionAlert slug={resolvedSlug} />}\n\n {addError && <FormErrorAlert message={addError} />}\n\n <FloatActions>\n <Button variant=\"ghost\" onClick={() => props.onCancel()} disabled={adding}>\n Cancel\n </Button>\n <Button onClick={() => void handleAdd()} disabled={!canAdd}>\n {adding && <Spinner className=\"size-3.5\" />}\n {adding ? \"Adding...\" : \"Add source\"}\n </Button>\n </FloatActions>\n </div>\n );\n}\n","import {\n CardStack,\n CardStackContent,\n CardStackEntryField,\n} from \"@executor-js/react/components/card-stack\";\nimport { Input } from \"@executor-js/react/components/input\";\nimport { Textarea } from \"@executor-js/react/components/textarea\";\nimport {\n IntegrationIdentityFieldRows,\n type IntegrationIdentity,\n} from \"@executor-js/react/plugins/integration-identity\";\n\nexport function GraphqlSourceFields(props: {\n readonly endpoint: string;\n readonly onEndpointChange: (endpoint: string) => void;\n readonly identity: IntegrationIdentity;\n /** The integration's agent-visible description. Blank = the backend falls\n * back to the introspected schema's own description, then the name. */\n readonly description?: string;\n readonly onDescriptionChange?: (value: string) => void;\n readonly endpointDisabled?: boolean;\n readonly namespaceReadOnly?: boolean;\n}) {\n return (\n <CardStack>\n <CardStackContent className=\"border-t-0\">\n <CardStackEntryField\n label=\"Endpoint\"\n hint=\"The endpoint will be introspected to discover available queries and mutations.\"\n >\n <Input\n value={props.endpoint}\n onChange={(e) => props.onEndpointChange((e.target as HTMLInputElement).value)}\n placeholder=\"https://api.example.com/graphql\"\n className=\"font-mono text-sm\"\n disabled={props.endpointDisabled}\n />\n </CardStackEntryField>\n <IntegrationIdentityFieldRows\n identity={props.identity}\n namePlaceholder=\"e.g. Shopify API\"\n namespaceReadOnly={props.namespaceReadOnly}\n />\n {props.onDescriptionChange && (\n <CardStackEntryField label=\"Description\">\n <Textarea\n value={props.description ?? \"\"}\n onChange={(e) => props.onDescriptionChange?.((e.target as HTMLTextAreaElement).value)}\n placeholder=\"What this API is and when to reach for it\"\n rows={2}\n maxRows={6}\n className=\"text-sm\"\n />\n <p className=\"text-[11px] text-muted-foreground\">\n Agent-visible. Leave blank to use the schema's own description when it has one.\n </p>\n </CardStackEntryField>\n )}\n </CardStackContent>\n </CardStack>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAS,aAAa,SAAS,gBAAgB;AAC/C,SAAS,kBAAkB;AAC3B,YAAY,UAAU;AAEtB,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACxBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,OAEK;AAoBG,cAcA,YAdA;AAlBH,SAAS,oBAAoB,OAUjC;AACD,SACE,oBAAC,aACC,+BAAC,oBAAiB,WAAU,cAC1B;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAM;AAAA,QACN,MAAK;AAAA,QAEL;AAAA,UAAC;AAAA;A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
9
10
|
// src/react/GraphqlAccountsPanel.tsx
|
|
10
11
|
import { useCallback, useMemo } from "react";
|
|
@@ -71,8 +72,7 @@ function GraphqlAccountsPanel(props) {
|
|
|
71
72
|
}
|
|
72
73
|
) });
|
|
73
74
|
}
|
|
74
|
-
|
|
75
75
|
export {
|
|
76
|
-
GraphqlAccountsPanel
|
|
76
|
+
GraphqlAccountsPanel as default
|
|
77
77
|
};
|
|
78
|
-
//# sourceMappingURL=
|
|
78
|
+
//# sourceMappingURL=GraphqlAccountsPanel-QGBVXP2A.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/GraphqlAccountsPanel.tsx"],"sourcesContent":["import { useCallback, useMemo } from \"react\";\nimport { useAtomValue, useAtomSet } from \"@effect/atom-react\";\nimport * as Exit from \"effect/Exit\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport { IntegrationSlug } from \"@executor-js/sdk/shared\";\nimport type { IntegrationAccountHandoff } from \"@executor-js/sdk/client\";\n\nimport { AccountsSection } from \"@executor-js/react/components/accounts-section\";\nimport { integrationWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport type { AuthMethod, Placement } from \"@executor-js/react/lib/auth-placements\";\nimport {\n useCustomMethodActions,\n type AuthMethodsCodec,\n type ConfigureAuthMethods,\n} from \"@executor-js/react/lib/custom-auth-methods\";\n\nimport { graphqlConfigAtom, graphqlConfigure } from \"./atoms\";\nimport {\n authMethodsFromConfig,\n graphqlAuthMethodInputsFromPlacements,\n graphqlWireAuthInput,\n} from \"./auth-method-config\";\nimport type { GraphqlAuthMethod } from \"../sdk/types\";\n\n// ---------------------------------------------------------------------------\n// GraphQL Accounts hub — fills the generic detail page's `accounts` slot.\n//\n// Reads the integration's real `authenticationTemplate` (via `getConfig`),\n// converts it to generic `AuthMethod[]`, and composes the generic\n// `AccountsSection` — whose Add-account offers those methods plus a \"+ Custom\n// method\" row (apikey-only). The custom-method create is INJECTED here\n// (`createCustomMethod`): generic placements → ONE apikey method\n// (`graphqlAuthMethodInputsFromPlacements`, slug omitted → backend\n// `custom_<id>`) merge-appended via `configure`. Stays plugin-side because it\n// touches the graphql sdk method types.\n// ---------------------------------------------------------------------------\n\nexport default function GraphqlAccountsPanel(props: {\n readonly sourceId: string;\n readonly integrationName: string;\n readonly accountHandoff?: IntegrationAccountHandoff | null;\n}) {\n const { sourceId, integrationName, accountHandoff } = props;\n const slug = IntegrationSlug.make(sourceId);\n const configResult = useAtomValue(graphqlConfigAtom(slug));\n const doConfigure = useAtomSet(graphqlConfigure, { mode: \"promiseExit\" });\n\n const existingTemplate = useMemo<readonly GraphqlAuthMethod[]>(() => {\n if (!AsyncResult.isSuccess(configResult) || configResult.value == null) return [];\n return configResult.value.authenticationTemplate ?? [];\n }, [configResult]);\n\n const methods = useMemo<readonly AuthMethod[]>(\n () => authMethodsFromConfig(existingTemplate),\n [existingTemplate],\n );\n\n // Custom-method create/remove: the shared skeleton (merge-append → diff out\n // the created method; filter → replace) parameterized by the GraphQL codec.\n // Stays plugin-side only where it touches the graphql method types.\n const configure = useCallback<ConfigureAuthMethods<GraphqlAuthMethod>>(\n async (input) => {\n const exit = await doConfigure({\n params: { slug: String(slug) },\n payload: {\n authenticationTemplate: input.authenticationTemplate.map(graphqlWireAuthInput),\n ...(input.mode ? { mode: input.mode } : {}),\n },\n reactivityKeys: integrationWriteKeys,\n });\n return Exit.map(exit, (result) => result.authenticationTemplate);\n },\n [doConfigure, slug],\n );\n\n const codec = useMemo<AuthMethodsCodec<GraphqlAuthMethod>>(\n () => ({\n toAuthMethods: authMethodsFromConfig,\n // Inputs omit slugs — the backend merge backfills `custom_<id>`.\n templatesFromPlacements: (placements: readonly Placement[]) =>\n graphqlAuthMethodInputsFromPlacements(placements) as readonly GraphqlAuthMethod[],\n slugOf: (template: GraphqlAuthMethod) => template.slug,\n }),\n [],\n );\n\n const { createCustomMethod, removeCustomMethod } = useCustomMethodActions({\n existing: existingTemplate,\n codec,\n configure,\n });\n\n return (\n <div className=\"mx-auto max-w-3xl space-y-8 px-6 py-8\">\n <AccountsSection\n integration={slug}\n integrationName={integrationName}\n methods={methods}\n accountHandoff={accountHandoff}\n createCustomMethod={createCustomMethod}\n removeCustomMethod={removeCustomMethod}\n />\n </div>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/react/GraphqlAccountsPanel.tsx"],"sourcesContent":["import { useCallback, useMemo } from \"react\";\nimport { useAtomValue, useAtomSet } from \"@effect/atom-react\";\nimport * as Exit from \"effect/Exit\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport { IntegrationSlug } from \"@executor-js/sdk/shared\";\nimport type { IntegrationAccountHandoff } from \"@executor-js/sdk/client\";\n\nimport { AccountsSection } from \"@executor-js/react/components/accounts-section\";\nimport { integrationWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport type { AuthMethod, Placement } from \"@executor-js/react/lib/auth-placements\";\nimport {\n useCustomMethodActions,\n type AuthMethodsCodec,\n type ConfigureAuthMethods,\n} from \"@executor-js/react/lib/custom-auth-methods\";\n\nimport { graphqlConfigAtom, graphqlConfigure } from \"./atoms\";\nimport {\n authMethodsFromConfig,\n graphqlAuthMethodInputsFromPlacements,\n graphqlWireAuthInput,\n} from \"./auth-method-config\";\nimport type { GraphqlAuthMethod } from \"../sdk/types\";\n\n// ---------------------------------------------------------------------------\n// GraphQL Accounts hub — fills the generic detail page's `accounts` slot.\n//\n// Reads the integration's real `authenticationTemplate` (via `getConfig`),\n// converts it to generic `AuthMethod[]`, and composes the generic\n// `AccountsSection` — whose Add-account offers those methods plus a \"+ Custom\n// method\" row (apikey-only). The custom-method create is INJECTED here\n// (`createCustomMethod`): generic placements → ONE apikey method\n// (`graphqlAuthMethodInputsFromPlacements`, slug omitted → backend\n// `custom_<id>`) merge-appended via `configure`. Stays plugin-side because it\n// touches the graphql sdk method types.\n// ---------------------------------------------------------------------------\n\nexport default function GraphqlAccountsPanel(props: {\n readonly sourceId: string;\n readonly integrationName: string;\n readonly accountHandoff?: IntegrationAccountHandoff | null;\n}) {\n const { sourceId, integrationName, accountHandoff } = props;\n const slug = IntegrationSlug.make(sourceId);\n const configResult = useAtomValue(graphqlConfigAtom(slug));\n const doConfigure = useAtomSet(graphqlConfigure, { mode: \"promiseExit\" });\n\n const existingTemplate = useMemo<readonly GraphqlAuthMethod[]>(() => {\n if (!AsyncResult.isSuccess(configResult) || configResult.value == null) return [];\n return configResult.value.authenticationTemplate ?? [];\n }, [configResult]);\n\n const methods = useMemo<readonly AuthMethod[]>(\n () => authMethodsFromConfig(existingTemplate),\n [existingTemplate],\n );\n\n // Custom-method create/remove: the shared skeleton (merge-append → diff out\n // the created method; filter → replace) parameterized by the GraphQL codec.\n // Stays plugin-side only where it touches the graphql method types.\n const configure = useCallback<ConfigureAuthMethods<GraphqlAuthMethod>>(\n async (input) => {\n const exit = await doConfigure({\n params: { slug: String(slug) },\n payload: {\n authenticationTemplate: input.authenticationTemplate.map(graphqlWireAuthInput),\n ...(input.mode ? { mode: input.mode } : {}),\n },\n reactivityKeys: integrationWriteKeys,\n });\n return Exit.map(exit, (result) => result.authenticationTemplate);\n },\n [doConfigure, slug],\n );\n\n const codec = useMemo<AuthMethodsCodec<GraphqlAuthMethod>>(\n () => ({\n toAuthMethods: authMethodsFromConfig,\n // Inputs omit slugs — the backend merge backfills `custom_<id>`.\n templatesFromPlacements: (placements: readonly Placement[]) =>\n graphqlAuthMethodInputsFromPlacements(placements) as readonly GraphqlAuthMethod[],\n slugOf: (template: GraphqlAuthMethod) => template.slug,\n }),\n [],\n );\n\n const { createCustomMethod, removeCustomMethod } = useCustomMethodActions({\n existing: existingTemplate,\n codec,\n configure,\n });\n\n return (\n <div className=\"mx-auto max-w-3xl space-y-8 px-6 py-8\">\n <AccountsSection\n integration={slug}\n integrationName={integrationName}\n methods={methods}\n accountHandoff={accountHandoff}\n createCustomMethod={createCustomMethod}\n removeCustomMethod={removeCustomMethod}\n />\n </div>\n );\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CAAC,aAAgC,SAAS;AAAA,IACpD;AAAA,IACA,CAAC;AAAA,EACH;AAEA,QAAM,EAAE,oBAAoB,mBAAmB,IAAI,uBAAuB;AAAA,IACxE,UAAU;AAAA,IACV;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE,oBAAC,SAAI,WAAU,yCACb;AAAA,IAAC;AAAA;AAAA,MACC,aAAa;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
|
package/dist/api/group.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const GraphqlGroup: HttpApiGroup.HttpApiGroup<"graphql", HttpApiE
|
|
|
6
6
|
readonly endpoint: Schema.String;
|
|
7
7
|
readonly slug: Schema.optional<Schema.String>;
|
|
8
8
|
readonly name: Schema.optional<Schema.String>;
|
|
9
|
+
readonly description: Schema.optional<Schema.String>;
|
|
9
10
|
readonly introspectionJson: Schema.optional<Schema.String>;
|
|
10
11
|
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
11
12
|
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
package/dist/api/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const graphqlHttpPlugin: import("@executor-js/sdk/core").Configur
|
|
|
17
17
|
readonly endpoint: import("effect/Schema").String;
|
|
18
18
|
readonly slug: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
19
19
|
readonly name: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
20
|
+
readonly description: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
20
21
|
readonly introspectionJson: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
21
22
|
readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
22
23
|
readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
@@ -14,6 +14,7 @@ import { ReactivityKey } from "@executor-js/react/api/reactivity-keys";
|
|
|
14
14
|
// src/react/client.ts
|
|
15
15
|
import { createPluginAtomClient } from "@executor-js/sdk/client";
|
|
16
16
|
import {
|
|
17
|
+
getExecutorOrganizationHeaders,
|
|
17
18
|
getExecutorApiBaseUrl,
|
|
18
19
|
getExecutorServerAuthorizationHeader
|
|
19
20
|
} from "@executor-js/react/api/server-connection";
|
|
@@ -29,6 +30,7 @@ var AddIntegrationPayload = Schema.Struct({
|
|
|
29
30
|
endpoint: Schema.String,
|
|
30
31
|
slug: Schema.optional(Schema.String),
|
|
31
32
|
name: Schema.optional(Schema.String),
|
|
33
|
+
description: Schema.optional(Schema.String),
|
|
32
34
|
introspectionJson: Schema.optional(Schema.String),
|
|
33
35
|
headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
34
36
|
queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
@@ -92,15 +94,11 @@ var GraphqlGroup = HttpApiGroup.make("graphql").add(
|
|
|
92
94
|
// src/react/client.ts
|
|
93
95
|
var GraphqlClient = createPluginAtomClient(GraphqlGroup, {
|
|
94
96
|
baseUrl: getExecutorApiBaseUrl,
|
|
95
|
-
authorizationHeader: getExecutorServerAuthorizationHeader
|
|
97
|
+
authorizationHeader: getExecutorServerAuthorizationHeader,
|
|
98
|
+
headers: getExecutorOrganizationHeaders
|
|
96
99
|
});
|
|
97
100
|
|
|
98
101
|
// src/react/atoms.ts
|
|
99
|
-
var graphqlIntegrationConfigAtom = (slug) => GraphqlClient.query("graphql", "getIntegration", {
|
|
100
|
-
params: { slug: String(slug) },
|
|
101
|
-
timeToLive: "15 seconds",
|
|
102
|
-
reactivityKeys: [ReactivityKey.integrations, ReactivityKey.tools]
|
|
103
|
-
});
|
|
104
102
|
var graphqlConfigAtom = (slug) => GraphqlClient.query("graphql", "getConfig", {
|
|
105
103
|
params: { slug: String(slug) },
|
|
106
104
|
timeToLive: "15 seconds",
|
|
@@ -115,13 +113,14 @@ var addGraphqlIntegrationOptimistic = integrationsOptimisticAtom.pipe(
|
|
|
115
113
|
const integration = {
|
|
116
114
|
slug,
|
|
117
115
|
kind: "graphql",
|
|
116
|
+
name: arg.payload.name ?? arg.payload.endpoint,
|
|
118
117
|
description: arg.payload.name ?? arg.payload.endpoint,
|
|
119
118
|
canRemove: false,
|
|
120
119
|
canRefresh: false,
|
|
121
120
|
authMethods: []
|
|
122
121
|
};
|
|
123
122
|
return [integration, ...rows.filter((row) => row.slug !== slug)].sort(
|
|
124
|
-
(a, b) => a.
|
|
123
|
+
(a, b) => a.name.localeCompare(b.name)
|
|
125
124
|
);
|
|
126
125
|
}),
|
|
127
126
|
fn: addGraphqlIntegration
|
|
@@ -160,7 +159,6 @@ function graphqlAuthMethodInputsFromPlacements(placements) {
|
|
|
160
159
|
var graphqlWireAuthInput = (method) => wireAuthInputFromShared(method);
|
|
161
160
|
|
|
162
161
|
export {
|
|
163
|
-
graphqlIntegrationConfigAtom,
|
|
164
162
|
graphqlConfigAtom,
|
|
165
163
|
graphqlConfigure,
|
|
166
164
|
addGraphqlIntegrationOptimistic,
|
|
@@ -168,4 +166,4 @@ export {
|
|
|
168
166
|
graphqlAuthMethodInputsFromPlacements,
|
|
169
167
|
graphqlWireAuthInput
|
|
170
168
|
};
|
|
171
|
-
//# sourceMappingURL=chunk-
|
|
169
|
+
//# sourceMappingURL=chunk-VSLIDDNK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react/atoms.ts","../src/react/client.ts","../src/api/group.ts","../src/react/auth-method-config.ts"],"sourcesContent":["import type { IntegrationSlug } from \"@executor-js/sdk/shared\";\nimport * as Atom from \"effect/unstable/reactivity/Atom\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport { integrationsOptimisticAtom } from \"@executor-js/react/api/atoms\";\nimport { ReactivityKey } from \"@executor-js/react/api/reactivity-keys\";\nimport { GraphqlClient } from \"./client\";\n\n// ---------------------------------------------------------------------------\n// Query atoms — v2 is integration-centric. The graphql HTTP surface exposes\n// only the catalog integration (`getIntegration` → its stored config, which\n// carries the `authenticationTemplate[]`). Connections are created through the\n// core API (`createConnection` / `oauth.start`), not through this plugin's\n// surface.\n// ---------------------------------------------------------------------------\n\nexport const graphqlIntegrationConfigAtom = (slug: IntegrationSlug) =>\n GraphqlClient.query(\"graphql\", \"getIntegration\", {\n params: { slug: String(slug) },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.integrations, ReactivityKey.tools],\n });\n\n// The full opaque config (including `authenticationTemplate`), used by the\n// configure UX to render existing auth methods and add custom ones.\nexport const graphqlConfigAtom = (slug: IntegrationSlug) =>\n GraphqlClient.query(\"graphql\", \"getConfig\", {\n params: { slug: String(slug) },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.integrations, ReactivityKey.tools],\n });\n\n// ---------------------------------------------------------------------------\n// Mutation atoms\n// ---------------------------------------------------------------------------\n\nexport const addGraphqlIntegration = GraphqlClient.mutation(\"graphql\", \"addIntegration\");\n\n// Merge-append custom auth methods onto an integration's `authenticationTemplate`.\nexport const graphqlConfigure = GraphqlClient.mutation(\"graphql\", \"configure\");\n\n// Optimistically slot a pending row into the shared integration catalog so the\n// integrations list reflects the new GraphQL integration before the server\n// round-trips. The reducer mirrors the catalog `Integration` shape.\nexport const addGraphqlIntegrationOptimistic = integrationsOptimisticAtom.pipe(\n Atom.optimisticFn({\n reducer: (\n current,\n arg: {\n readonly payload: {\n readonly endpoint: string;\n readonly slug?: string;\n readonly name?: string;\n };\n },\n ) =>\n AsyncResult.map(current, (rows) => {\n const slug = (arg.payload.slug ??\n `pending-${Math.random().toString(36).slice(2)}`) as IntegrationSlug;\n const integration = {\n slug,\n kind: \"graphql\",\n name: arg.payload.name ?? arg.payload.endpoint,\n description: arg.payload.name ?? arg.payload.endpoint,\n canRemove: false,\n canRefresh: false,\n authMethods: [],\n };\n return [integration, ...rows.filter((row) => row.slug !== slug)].sort((a, b) =>\n a.name.localeCompare(b.name),\n );\n }),\n fn: addGraphqlIntegration,\n }),\n);\n","import { createPluginAtomClient } from \"@executor-js/sdk/client\";\nimport {\n getExecutorOrganizationHeaders,\n getExecutorApiBaseUrl,\n getExecutorServerAuthorizationHeader,\n} from \"@executor-js/react/api/server-connection\";\nimport { GraphqlGroup } from \"../api/group\";\n\nexport const GraphqlClient = createPluginAtomClient(GraphqlGroup, {\n baseUrl: getExecutorApiBaseUrl,\n authorizationHeader: getExecutorServerAuthorizationHeader,\n headers: getExecutorOrganizationHeaders,\n});\n","import { HttpApiEndpoint, HttpApiGroup } from \"effect/unstable/httpapi\";\nimport { Schema } from \"effect\";\nimport { InternalError, IntegrationAlreadyExistsError } from \"@executor-js/sdk/shared\";\n\nimport { GraphqlIntrospectionError, GraphqlExtractionError } from \"../sdk/errors\";\nimport { GraphqlAuthMethod, GraphqlAuthMethodInput } from \"../sdk/types\";\n\n// ---------------------------------------------------------------------------\n// Params\n// ---------------------------------------------------------------------------\n\nconst IntegrationParams = {\n slug: Schema.String,\n};\n\n// ---------------------------------------------------------------------------\n// Payloads\n// ---------------------------------------------------------------------------\n\nconst AddIntegrationPayload = Schema.Struct({\n endpoint: Schema.String,\n slug: Schema.optional(Schema.String),\n name: Schema.optional(Schema.String),\n description: Schema.optional(Schema.String),\n introspectionJson: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n authenticationTemplate: Schema.optional(Schema.Array(GraphqlAuthMethodInput)),\n});\n\n// The `configure` payload — the custom auth methods to merge-append onto the\n// integration's `authenticationTemplate`. Reuses the same input schema as\n// `addIntegration` (slug optional — the backend backfills it) so a custom\n// apikey method round-trips identically.\nconst ConfigurePayload = Schema.Struct({\n authenticationTemplate: Schema.Array(GraphqlAuthMethodInput),\n mode: Schema.optional(Schema.Literals([\"merge\", \"replace\"])),\n});\n\n// ---------------------------------------------------------------------------\n// Responses\n// ---------------------------------------------------------------------------\n\nconst AddIntegrationResponse = Schema.Struct({\n slug: Schema.String,\n name: Schema.String,\n});\n\n// The integration config surfaced for the configure UX. Carries the\n// `authenticationTemplate` the configure / custom-method flow reads/writes.\n// The introspection snapshot is deliberately NOT served: it's a multi-MB\n// build artifact in the plugin blob store, and no client reads it.\nconst GraphqlConfigView = Schema.Struct({\n endpoint: Schema.String,\n name: Schema.String,\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n authenticationTemplate: Schema.Array(GraphqlAuthMethod),\n});\n\n// The configure result — the merged `authenticationTemplate` after the new\n// custom methods were appended/replaced.\nconst ConfigureResponse = Schema.Struct({\n authenticationTemplate: Schema.Array(GraphqlAuthMethod),\n});\n\n// ---------------------------------------------------------------------------\n// Errors with HTTP status\n// ---------------------------------------------------------------------------\n\nconst IntrospectionError = GraphqlIntrospectionError.annotate({\n httpApiStatus: 400,\n});\nconst ExtractionError = GraphqlExtractionError.annotate({ httpApiStatus: 400 });\n\n// ---------------------------------------------------------------------------\n// Group — the GraphQL HTTP surface over integrations.\n//\n// Plugin SDK errors (GraphqlIntrospectionError etc.) are declared once at the\n// group level via `.addError(...)`. `InternalError` is the shared opaque-by-\n// schema 500 surface translated from `StorageError` by `withCapture` at the\n// HTTP edge.\n// ---------------------------------------------------------------------------\n\nconst GraphqlErrors = [\n InternalError,\n IntrospectionError,\n ExtractionError,\n IntegrationAlreadyExistsError,\n] as const;\n\nexport const GraphqlGroup = HttpApiGroup.make(\"graphql\")\n .add(\n HttpApiEndpoint.post(\"addIntegration\", \"/graphql/integrations\", {\n payload: AddIntegrationPayload,\n success: AddIntegrationResponse,\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\"getIntegration\", \"/graphql/integrations/:slug\", {\n params: IntegrationParams,\n success: Schema.NullOr(Schema.Unknown),\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\"getConfig\", \"/graphql/integrations/:slug/config\", {\n params: IntegrationParams,\n success: Schema.NullOr(GraphqlConfigView),\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.post(\"configure\", \"/graphql/integrations/:slug/config\", {\n params: IntegrationParams,\n payload: ConfigurePayload,\n success: ConfigureResponse,\n error: GraphqlErrors,\n }),\n );\n","// ---------------------------------------------------------------------------\n// GraphQL ↔ generic auth-method converters — a thin oauth adapter over the\n// shared codec (`@executor-js/react/lib/shared-auth-method-codec`). The\n// apikey/none paths (multi-placement, multi-variable) live in the shared\n// codec; GraphQL only contributes its oauth flavor: endpoint-less methods that\n// render the connection's access token as a bearer header at invoke time\n// (optionally overriding the header name / prefix).\n// ---------------------------------------------------------------------------\n\nimport { AuthTemplateSlug } from \"@executor-js/sdk/shared\";\nimport type { AuthTemplateEditorValue } from \"@executor-js/react/components/auth-template-editor\";\nimport type { AuthMethod, Placement } from \"@executor-js/react/lib/auth-placements\";\nimport {\n wireAuthInputFromShared,\n authMethodFromSharedTemplate,\n editorValueFromSharedMethod,\n sharedMethodInputFromEditorValue,\n wirePlacementsFromEditor,\n} from \"@executor-js/react/lib/shared-auth-method-codec\";\n\nimport type {\n GraphqlAuthMethod,\n GraphqlAuthMethodInput,\n GraphqlCanonicalAuthMethodInput,\n} from \"../sdk/types\";\n\nconst oauthAuthMethod = (slug: string): AuthMethod => ({\n id: slug,\n label: \"OAuth\",\n kind: \"oauth\",\n source: slug.startsWith(\"custom_\") ? \"custom\" : \"spec\",\n template: AuthTemplateSlug.make(slug),\n placements: [],\n oauth: {},\n});\n\n/** Convert a generic editor value into one GraphQL auth-method input (no slug\n * — the backend assigns carrier-derived slugs). An apikey value keeps every\n * named placement (headers and query params mix freely); one with no usable\n * placement falls back to `none`. */\nexport function graphqlAuthMethodInputFromEditorValue(\n value: AuthTemplateEditorValue,\n): GraphqlAuthMethodInput {\n if (value.kind === \"oauth\") return { kind: \"oauth2\" };\n return (sharedMethodInputFromEditorValue(value) ?? { kind: \"none\" }) as GraphqlAuthMethodInput;\n}\n\n/** Convert one stored GraphQL method into the generic editor value. */\nexport function editorValueFromGraphqlAuthMethod(\n method: GraphqlAuthMethod,\n): AuthTemplateEditorValue {\n if (method.kind === \"oauth2\") {\n // GraphQL oauth methods store no endpoints — only the bearer rendering.\n return { kind: \"oauth\", authorizationUrl: \"\", tokenUrl: \"\", scopes: [] };\n }\n return editorValueFromSharedMethod(method);\n}\n\n/** Project the stored methods into the generic `AuthMethod[]` the hub renders.\n * Mirrors the server's `describeGraphqlAuthMethods`; `custom_` slugs mark\n * user-created methods (removable from the hub). */\nexport function authMethodsFromConfig(methods: readonly GraphqlAuthMethod[]): AuthMethod[] {\n return methods.map((method: GraphqlAuthMethod): AuthMethod => {\n if (method.kind === \"oauth2\") return oauthAuthMethod(method.slug);\n return authMethodFromSharedTemplate(method);\n });\n}\n\n/** Build the GraphQL method input for a custom method from generic placements\n * — ONE method carrying every named placement (header + query mix in a single\n * method; each placement renders from its own input variable, or shares one).\n * Empty when no placement is usable. */\nexport function graphqlAuthMethodInputsFromPlacements(\n placements: readonly Placement[],\n): GraphqlAuthMethodInput[] {\n const wire = wirePlacementsFromEditor(placements);\n if (wire.length === 0) return [];\n return [graphqlWireAuthInput({ kind: \"apikey\", placements: wire })];\n}\n\n/** Serialize a canonical method into the wire input union (apikey → the\n * request-shaped dialect; none/oauth2 pass through). */\nexport const graphqlWireAuthInput = (\n method: GraphqlAuthMethod | GraphqlCanonicalAuthMethodInput,\n): GraphqlAuthMethodInput => wireAuthInputFromShared(method) as GraphqlAuthMethodInput;\n"],"mappings":";;;;;;;;AACA,YAAY,UAAU;AACtB,YAAY,iBAAiB;AAC7B,SAAS,kCAAkC;AAC3C,SAAS,qBAAqB;;;ACJ9B,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACLP,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,cAAc;AACvB,SAAS,eAAe,qCAAqC;AA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Schema3.Struct({
|
|
|
642
642
|
endpoint: Schema3.String,
|
|
643
643
|
slug: Schema3.optional(Schema3.String),
|
|
644
644
|
name: Schema3.optional(Schema3.String),
|
|
645
|
+
/** Agent-visible catalog description. Falls back to the introspected
|
|
646
|
+
* schema's own description, then the display name. */
|
|
647
|
+
description: Schema3.optional(Schema3.String),
|
|
645
648
|
introspectionJson: Schema3.optional(Schema3.String),
|
|
646
649
|
headers: Schema3.optional(Schema3.Record(Schema3.String, Schema3.String)),
|
|
647
650
|
queryParams: Schema3.optional(Schema3.Record(Schema3.String, Schema3.String)),
|
|
@@ -923,7 +926,8 @@ var makeGraphqlExtension = (ctx) => {
|
|
|
923
926
|
yield* ctx.transaction(
|
|
924
927
|
ctx.core.integrations.register({
|
|
925
928
|
slug,
|
|
926
|
-
|
|
929
|
+
name: baseConfig.name,
|
|
930
|
+
description: input.description?.trim() || baseConfig.name,
|
|
927
931
|
config: baseConfig,
|
|
928
932
|
canRemove: true,
|
|
929
933
|
canRefresh: true
|
|
@@ -944,9 +948,11 @@ var makeGraphqlExtension = (ctx) => {
|
|
|
944
948
|
yield* ctx.transaction(
|
|
945
949
|
Effect5.gen(function* () {
|
|
946
950
|
yield* ctx.storage.replaceOperations(String(slug), toStoredOperations(slug, prepared));
|
|
951
|
+
const schemaDescription = typeof introspection.description === "string" ? (introspection.description ?? "").trim() : "";
|
|
947
952
|
yield* ctx.core.integrations.register({
|
|
948
953
|
slug,
|
|
949
|
-
|
|
954
|
+
name: config.name,
|
|
955
|
+
description: input.description?.trim() || schemaDescription || config.name,
|
|
950
956
|
config,
|
|
951
957
|
canRemove: true,
|
|
952
958
|
canRefresh: true
|
|
@@ -1301,4 +1307,4 @@ export {
|
|
|
1301
1307
|
describeGraphqlAuthMethods,
|
|
1302
1308
|
graphqlPlugin
|
|
1303
1309
|
};
|
|
1304
|
-
//# sourceMappingURL=chunk-
|
|
1310
|
+
//# sourceMappingURL=chunk-XFH7IECG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sdk/introspect.ts","../src/sdk/extract.ts","../src/sdk/invoke.ts","../src/sdk/store.ts","../src/sdk/plugin.ts"],"sourcesContent":["import { Effect, Option, Schema } from \"effect\";\nimport { HttpClient, HttpClientRequest } from \"effect/unstable/http\";\n\nimport { GraphqlIntrospectionError } from \"./errors\";\n\n// ---------------------------------------------------------------------------\n// Introspection query — standard GraphQL introspection\n// ---------------------------------------------------------------------------\n\nconst INTROSPECTION_QUERY = `\n query IntrospectionQuery {\n __schema {\n queryType { name }\n mutationType { name }\n types {\n kind\n name\n description\n fields(includeDeprecated: false) {\n name\n description\n args {\n name\n description\n type {\n ...TypeRef\n }\n defaultValue\n }\n type {\n ...TypeRef\n }\n }\n inputFields {\n name\n description\n type {\n ...TypeRef\n }\n defaultValue\n }\n enumValues(includeDeprecated: false) {\n name\n description\n }\n }\n }\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Introspection result types\n// ---------------------------------------------------------------------------\n\nconst IntrospectionTypeRefLeaf = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.Null),\n});\n\nconst IntrospectionTypeRef5 = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRefLeaf)),\n});\n\nconst IntrospectionTypeRef4 = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRef5)),\n});\n\nconst IntrospectionTypeRef3 = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRef4)),\n});\n\nconst IntrospectionTypeRef2 = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRef3)),\n});\n\nconst IntrospectionTypeRefSchema = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRef2)),\n});\n\nconst IntrospectionInputValueSchema = Schema.Struct({\n name: Schema.String,\n description: Schema.NullOr(Schema.String),\n type: IntrospectionTypeRefSchema,\n defaultValue: Schema.NullOr(Schema.String),\n});\n\nconst IntrospectionFieldSchema = Schema.Struct({\n name: Schema.String,\n description: Schema.NullOr(Schema.String),\n args: Schema.Array(IntrospectionInputValueSchema),\n type: IntrospectionTypeRefSchema,\n});\n\nconst IntrospectionTypeSchema = Schema.Struct({\n kind: Schema.String,\n name: Schema.String,\n description: Schema.NullOr(Schema.String),\n fields: Schema.NullOr(Schema.Array(IntrospectionFieldSchema)),\n inputFields: Schema.NullOr(Schema.Array(IntrospectionInputValueSchema)),\n enumValues: Schema.NullOr(\n Schema.Array(\n Schema.Struct({\n name: Schema.String,\n description: Schema.NullOr(Schema.String),\n }),\n ),\n ),\n});\n\nconst IntrospectionResultSchema = Schema.Struct({\n __schema: Schema.Struct({\n queryType: Schema.NullOr(Schema.Struct({ name: Schema.String })),\n mutationType: Schema.NullOr(Schema.Struct({ name: Schema.String })),\n types: Schema.Array(IntrospectionTypeSchema),\n }),\n});\n\nconst IntrospectionResponseSchema = Schema.Struct({\n data: Schema.optional(IntrospectionResultSchema),\n errors: Schema.optional(Schema.Array(Schema.Unknown)),\n});\n\nconst UpstreamErrorResponseSchema = Schema.Struct({\n message: Schema.optional(Schema.String),\n errors: Schema.optional(\n Schema.Array(\n Schema.Struct({\n message: Schema.optional(Schema.String),\n }),\n ),\n ),\n});\n\nconst IntrospectionJsonSchema = Schema.Union([\n Schema.Struct({ data: IntrospectionResultSchema }),\n IntrospectionResultSchema,\n]);\nconst JsonTextSchema = Schema.fromJsonString(Schema.Unknown);\n\nconst decodeUpstreamErrorResponse = Schema.decodeUnknownOption(UpstreamErrorResponseSchema);\n\nexport type IntrospectionTypeRef = typeof IntrospectionTypeRefSchema.Type;\nexport type IntrospectionInputValue = typeof IntrospectionInputValueSchema.Type;\nexport type IntrospectionField = typeof IntrospectionFieldSchema.Type;\nexport type IntrospectionEnumValue = NonNullable<\n (typeof IntrospectionTypeSchema.Type)[\"enumValues\"]\n>[number];\nexport type IntrospectionType = typeof IntrospectionTypeSchema.Type;\nexport type IntrospectionSchema = (typeof IntrospectionResultSchema.Type)[\"__schema\"];\nexport type IntrospectionResult = typeof IntrospectionResultSchema.Type;\n\nconst firstUpstreamErrorMessage = (value: unknown): string | null => {\n const decoded = decodeUpstreamErrorResponse(value);\n return Option.match(decoded, {\n onNone: () => null,\n onSome: (response) => {\n if (response.message) return response.message;\n for (const entry of response.errors ?? []) {\n const message = entry.message;\n if (message) return message;\n }\n return null;\n },\n });\n};\n\nconst redactUpstreamBody = (body: string): string =>\n body\n .replaceAll(\n /(\"(?:access_token|refresh_token|id_token|client_secret|token|authorization)\"\\s*:\\s*\")[^\"]*(\")/gi,\n \"$1[redacted]$2\",\n )\n .replaceAll(\n /((?:access_token|refresh_token|id_token|client_secret|token|authorization)=)[^&\\s]*/gi,\n \"$1[redacted]\",\n )\n .replaceAll(\n /((?:authorization|access-token|refresh-token|id-token|client-secret|token)\\s*:\\s*)(?:bearer\\s+)?[^\\s,;]+/gi,\n \"$1[redacted]\",\n );\n\nconst upstreamTextMessage = (body: string): string | null => {\n const text = redactUpstreamBody(body.replaceAll(/\\s+/g, \" \").trim());\n if (text.length === 0) return null;\n return text.length > 500 ? `${text.slice(0, 500)}...` : text;\n};\n\n// ---------------------------------------------------------------------------\n// Introspect a GraphQL endpoint\n// ---------------------------------------------------------------------------\n\nexport const introspect = Effect.fn(\"GraphQL.introspect\")(function* (\n endpoint: string,\n headers?: Record<string, string>,\n queryParams?: Record<string, string>,\n) {\n const client = yield* HttpClient.HttpClient;\n const requestEndpoint =\n queryParams && Object.keys(queryParams).length > 0\n ? (() => {\n const url = new URL(endpoint);\n for (const [name, value] of Object.entries(queryParams)) {\n url.searchParams.set(name, value);\n }\n return url.toString();\n })()\n : endpoint;\n\n let request = HttpClientRequest.post(requestEndpoint).pipe(\n HttpClientRequest.setHeader(\"Content-Type\", \"application/json\"),\n HttpClientRequest.setHeader(\"Accept\", \"application/json\"),\n HttpClientRequest.setHeader(\"User-Agent\", \"executor-graphql\"),\n HttpClientRequest.bodyJsonUnsafe({\n query: INTROSPECTION_QUERY,\n }),\n );\n\n if (headers) {\n for (const [k, v] of Object.entries(headers)) {\n request = HttpClientRequest.setHeader(request, k, v);\n }\n }\n\n const response = yield* client.execute(request).pipe(\n Effect.tapCause((cause) => Effect.logError(\"graphql introspection request failed\", cause)),\n Effect.mapError(\n () =>\n new GraphqlIntrospectionError({\n message: \"Failed to reach GraphQL endpoint\",\n }),\n ),\n );\n\n if (response.status !== 200) {\n const responseText = yield* response.text.pipe(Effect.catch(() => Effect.succeed(\"\")));\n const raw = responseText\n ? yield* Schema.decodeUnknownEffect(JsonTextSchema)(responseText).pipe(\n Effect.catch(() => Effect.succeed(null)),\n )\n : null;\n const upstreamMessage = upstreamTextMessage(\n (raw === null ? null : firstUpstreamErrorMessage(raw)) ?? responseText,\n );\n return yield* new GraphqlIntrospectionError({\n message: upstreamMessage\n ? `Introspection failed with status ${response.status}: ${upstreamMessage}`\n : `Introspection failed with status ${response.status}`,\n });\n }\n\n const raw = yield* response.json.pipe(\n Effect.tapCause((cause) => Effect.logError(\"graphql introspection JSON parse failed\", cause)),\n Effect.mapError(\n () =>\n new GraphqlIntrospectionError({\n message: `Failed to parse introspection response as JSON`,\n }),\n ),\n );\n\n const json = yield* Schema.decodeUnknownEffect(IntrospectionResponseSchema)(raw).pipe(\n Effect.mapError(\n () =>\n new GraphqlIntrospectionError({\n message: \"Introspection response has an invalid shape\",\n }),\n ),\n );\n\n if (json.errors && Array.isArray(json.errors) && json.errors.length > 0) {\n const upstreamMessage = firstUpstreamErrorMessage(json);\n return yield* new GraphqlIntrospectionError({\n message: upstreamMessage\n ? `Introspection returned ${json.errors.length} error(s): ${upstreamMessage}`\n : `Introspection returned ${json.errors.length} error(s)`,\n });\n }\n\n if (!json.data?.__schema) {\n return yield* new GraphqlIntrospectionError({\n message: \"Introspection response missing __schema\",\n });\n }\n\n return json.data;\n});\n\n// ---------------------------------------------------------------------------\n// Parse an introspection result from a JSON string (for offline/text input)\n// ---------------------------------------------------------------------------\n\nexport const parseIntrospectionJson = (\n text: string,\n): Effect.Effect<IntrospectionResult, GraphqlIntrospectionError> =>\n Schema.decodeUnknownEffect(Schema.fromJsonString(IntrospectionJsonSchema))(text).pipe(\n Effect.map((parsed) => (\"data\" in parsed ? parsed.data : parsed)),\n Effect.mapError(\n () =>\n new GraphqlIntrospectionError({\n message: \"Failed to parse introspection JSON\",\n }),\n ),\n );\n","import { Effect, Match, Option } from \"effect\";\n\nimport { GraphqlExtractionError } from \"./errors\";\nimport type {\n IntrospectionResult,\n IntrospectionSchema,\n IntrospectionType,\n IntrospectionTypeRef,\n IntrospectionInputValue,\n} from \"./introspect\";\nimport {\n ExtractedField,\n ExtractionResult,\n GraphqlArgument,\n type GraphqlOperationKind,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Type ref helpers\n// ---------------------------------------------------------------------------\n\n/** Unwrap NON_NULL / LIST wrappers to get the leaf type name */\nconst unwrapTypeName = (ref: IntrospectionTypeRef): string => {\n if (ref.name) return ref.name;\n if (ref.ofType) return unwrapTypeName(ref.ofType);\n return \"Unknown\";\n};\n\n/** Check if a type ref is non-null (required) */\nconst isNonNull = (ref: IntrospectionTypeRef): boolean => ref.kind === \"NON_NULL\";\n\n// ---------------------------------------------------------------------------\n// Build shared definitions from all INPUT_OBJECT and ENUM types\n// ---------------------------------------------------------------------------\n\nconst buildDefinitions = (\n types: ReadonlyMap<string, IntrospectionType>,\n): Record<string, unknown> => {\n const defs: Record<string, unknown> = {};\n\n for (const [name, type] of types) {\n // Skip internal types\n if (name.startsWith(\"__\")) continue;\n\n if (type.kind === \"INPUT_OBJECT\" && type.inputFields) {\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n for (const field of type.inputFields) {\n const schema = typeRefToJsonSchema(field.type, types);\n if (field.description) {\n (schema as Record<string, unknown>).description = field.description;\n }\n properties[field.name] = schema;\n if (isNonNull(field.type)) {\n required.push(field.name);\n }\n }\n\n const def: Record<string, unknown> = { type: \"object\", properties };\n if (required.length > 0) def.required = required;\n if (type.description) def.description = type.description;\n defs[name] = def;\n }\n\n if (type.kind === \"ENUM\" && type.enumValues) {\n defs[name] = {\n type: \"string\",\n enum: type.enumValues.map((v) => v.name),\n ...(type.description ? { description: type.description } : {}),\n };\n }\n }\n\n return defs;\n};\n\n// ---------------------------------------------------------------------------\n// Convert a type ref to JSON Schema using $ref for complex types\n// ---------------------------------------------------------------------------\n\nconst typeRefToJsonSchema = (\n ref: IntrospectionTypeRef,\n // oxlint-disable-next-line only-used-in-recursion\n types: ReadonlyMap<string, IntrospectionType>,\n): Record<string, unknown> =>\n Match.value(ref.kind).pipe(\n Match.when(\n \"NON_NULL\",\n (): Record<string, unknown> => (ref.ofType ? typeRefToJsonSchema(ref.ofType, types) : {}),\n ),\n Match.when(\n \"LIST\",\n (): Record<string, unknown> => ({\n type: \"array\",\n items: ref.ofType ? typeRefToJsonSchema(ref.ofType, types) : {},\n }),\n ),\n Match.when(\"SCALAR\", (): Record<string, unknown> => scalarToJsonSchema(ref.name ?? \"String\")),\n Match.when(\n \"ENUM\",\n (): Record<string, unknown> =>\n ref.name ? { $ref: `#/$defs/${ref.name}` } : { type: \"string\" },\n ),\n Match.when(\n \"INPUT_OBJECT\",\n (): Record<string, unknown> =>\n ref.name ? { $ref: `#/$defs/${ref.name}` } : { type: \"object\" },\n ),\n Match.whenOr(\n \"OBJECT\",\n \"INTERFACE\",\n \"UNION\",\n (): Record<string, unknown> => ({ type: \"object\" }),\n ),\n Match.option,\n Option.getOrElse((): Record<string, unknown> => ({})),\n );\n\nconst scalarToJsonSchema = (name: string): Record<string, unknown> =>\n Match.value(name).pipe(\n Match.whenOr(\"String\", \"ID\", (): Record<string, unknown> => ({ type: \"string\" })),\n Match.when(\"Int\", (): Record<string, unknown> => ({ type: \"integer\" })),\n Match.when(\"Float\", (): Record<string, unknown> => ({ type: \"number\" })),\n Match.when(\"Boolean\", (): Record<string, unknown> => ({ type: \"boolean\" })),\n Match.option,\n Option.getOrElse(\n (): Record<string, unknown> => ({ type: \"string\", description: `Custom scalar: ${name}` }),\n ),\n );\n\n// ---------------------------------------------------------------------------\n// Build input JSON Schema from field arguments\n// ---------------------------------------------------------------------------\n\nconst buildInputSchema = (\n args: readonly IntrospectionInputValue[],\n types: ReadonlyMap<string, IntrospectionType>,\n): Record<string, unknown> | undefined => {\n if (args.length === 0) return undefined;\n\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n for (const arg of args) {\n const schema = typeRefToJsonSchema(arg.type, types);\n if (arg.description) {\n (schema as Record<string, unknown>).description = arg.description;\n }\n properties[arg.name] = schema;\n if (isNonNull(arg.type)) {\n required.push(arg.name);\n }\n }\n\n const inputSchema: Record<string, unknown> = {\n type: \"object\",\n properties,\n };\n if (required.length > 0) inputSchema.required = required;\n return inputSchema;\n};\n\n/** Format a type ref back to GraphQL type notation (e.g. \"[String!]!\") */\nconst formatTypeRef = (ref: IntrospectionTypeRef): string =>\n Match.value(ref.kind).pipe(\n Match.when(\"NON_NULL\", () => (ref.ofType ? `${formatTypeRef(ref.ofType)}!` : \"Unknown!\")),\n Match.when(\"LIST\", () => (ref.ofType ? `[${formatTypeRef(ref.ofType)}]` : \"[Unknown]\")),\n Match.option,\n Option.getOrElse(() => ref.name ?? \"Unknown\"),\n );\n\n// ---------------------------------------------------------------------------\n// Extract fields from schema\n// ---------------------------------------------------------------------------\n\nconst extractFields = (\n _schema: IntrospectionSchema,\n kind: GraphqlOperationKind,\n typeName: string | null | undefined,\n types: ReadonlyMap<string, IntrospectionType>,\n): ExtractedField[] => {\n if (!typeName) return [];\n\n const type = types.get(typeName);\n if (!type?.fields) return [];\n\n return type.fields\n .filter((f) => !f.name.startsWith(\"__\"))\n .map((field) => {\n const args = field.args.map((arg) =>\n GraphqlArgument.make({\n name: arg.name,\n typeName: formatTypeRef(arg.type),\n required: isNonNull(arg.type),\n description: arg.description ? Option.some(arg.description) : Option.none(),\n }),\n );\n\n const inputSchema = buildInputSchema(field.args, types);\n\n return ExtractedField.make({\n fieldName: field.name,\n kind,\n description: field.description ? Option.some(field.description) : Option.none(),\n arguments: args,\n inputSchema: inputSchema ? Option.some(inputSchema) : Option.none(),\n returnTypeName: unwrapTypeName(field.type),\n });\n });\n};\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\nexport interface ExtractionOutput {\n readonly result: ExtractionResult;\n /** Shared JSON Schema definitions for INPUT_OBJECT and ENUM types.\n * Tool input schemas use `$ref` pointers into these. */\n readonly definitions: Record<string, unknown>;\n}\n\nexport const extract = (\n introspection: IntrospectionResult,\n): Effect.Effect<ExtractionOutput, GraphqlExtractionError> =>\n Effect.try({\n try: () => {\n const schema = introspection.__schema;\n const typeMap = new Map<string, IntrospectionType>();\n for (const t of schema.types) {\n typeMap.set(t.name, t);\n }\n\n const definitions = buildDefinitions(typeMap);\n\n const queryFields = extractFields(schema, \"query\", schema.queryType?.name, typeMap);\n const mutationFields = extractFields(schema, \"mutation\", schema.mutationType?.name, typeMap);\n\n return {\n result: ExtractionResult.make({\n schemaName: Option.none(),\n fields: [...queryFields, ...mutationFields],\n }),\n definitions,\n };\n },\n catch: () =>\n new GraphqlExtractionError({\n message: \"Failed to extract GraphQL schema\",\n }),\n });\n","import { Effect, Layer, Option } from \"effect\";\nimport { HttpClient, HttpClientRequest } from \"effect/unstable/http\";\n\nimport { GraphqlInvocationError } from \"./errors\";\nimport { type OperationBinding, InvocationResult } from \"./types\";\n\nconst endpointWithQueryParams = (endpoint: string, queryParams: Record<string, string>): string => {\n if (Object.keys(queryParams).length === 0) return endpoint;\n const url = new URL(endpoint);\n for (const [name, value] of Object.entries(queryParams)) {\n url.searchParams.set(name, value);\n }\n return url.toString();\n};\n\nexport const endpointForTelemetry = (endpoint: string): string => {\n if (!URL.canParse(endpoint)) return endpoint;\n const url = new URL(endpoint);\n url.search = \"\";\n url.hash = \"\";\n return url.toString();\n};\n\n// ---------------------------------------------------------------------------\n// Response helpers\n// ---------------------------------------------------------------------------\n\nconst isJsonContentType = (ct: string | null | undefined): boolean => {\n if (!ct) return false;\n const normalized = ct.split(\";\")[0]?.trim().toLowerCase() ?? \"\";\n return (\n normalized === \"application/json\" || normalized.includes(\"+json\") || normalized.includes(\"json\")\n );\n};\n\n// ---------------------------------------------------------------------------\n// Public API — execute a GraphQL operation\n// ---------------------------------------------------------------------------\n\nexport const invoke = Effect.fn(\"GraphQL.invoke\")(function* (\n operation: OperationBinding,\n args: Record<string, unknown>,\n endpoint: string,\n resolvedHeaders: Record<string, string>,\n resolvedQueryParams: Record<string, string> = {},\n) {\n const client = yield* HttpClient.HttpClient;\n const requestEndpoint = endpointWithQueryParams(endpoint, resolvedQueryParams);\n const telemetryEndpoint = endpointForTelemetry(endpoint);\n\n yield* Effect.annotateCurrentSpan({\n \"http.method\": \"POST\",\n \"http.url\": telemetryEndpoint,\n \"plugin.graphql.endpoint\": telemetryEndpoint,\n \"plugin.graphql.operation_kind\": operation.kind,\n \"plugin.graphql.field_name\": operation.fieldName,\n \"plugin.graphql.headers.resolved_count\": Object.keys(resolvedHeaders).length,\n \"plugin.graphql.query_params.resolved_count\": Object.keys(resolvedQueryParams).length,\n });\n\n // Build the GraphQL request body\n const variables: Record<string, unknown> = {};\n for (const varName of operation.variableNames) {\n if (args[varName] !== undefined) {\n variables[varName] = args[varName];\n }\n }\n\n // Also pick up any variables from a \"variables\" container\n if (typeof args.variables === \"object\" && args.variables !== null) {\n Object.assign(variables, args.variables);\n }\n\n let request = HttpClientRequest.post(requestEndpoint).pipe(\n HttpClientRequest.setHeader(\"Content-Type\", \"application/json\"),\n HttpClientRequest.bodyJsonUnsafe({\n query: operation.operationString,\n variables: Object.keys(variables).length > 0 ? variables : undefined,\n }),\n );\n\n for (const [name, value] of Object.entries(resolvedHeaders)) {\n request = HttpClientRequest.setHeader(request, name, value);\n }\n\n const response = yield* client.execute(request).pipe(\n Effect.mapError(\n (err) =>\n new GraphqlInvocationError({\n message: \"GraphQL request failed\",\n statusCode: Option.none(),\n cause: err,\n }),\n ),\n );\n\n const status = response.status;\n const contentType = response.headers[\"content-type\"] ?? null;\n\n const body: unknown = isJsonContentType(contentType)\n ? yield* response.json.pipe(Effect.catch(() => response.text))\n : yield* response.text;\n\n // GraphQL responses are always 200 with { data, errors }\n const gqlBody = body as { data?: unknown; errors?: unknown[] } | null;\n const hasErrors = Array.isArray(gqlBody?.errors) && gqlBody.errors.length > 0;\n\n yield* Effect.annotateCurrentSpan({\n \"http.status_code\": status,\n \"plugin.graphql.has_errors\": hasErrors,\n \"plugin.graphql.error_count\": hasErrors ? gqlBody!.errors!.length : 0,\n });\n\n return InvocationResult.make({\n status,\n data: gqlBody?.data ?? null,\n errors: hasErrors ? gqlBody!.errors : null,\n });\n});\n\n// ---------------------------------------------------------------------------\n// Invoke a GraphQL operation with a provided HttpClient layer\n// ---------------------------------------------------------------------------\n\nexport const invokeWithLayer = (\n operation: OperationBinding,\n args: Record<string, unknown>,\n endpoint: string,\n resolvedHeaders: Record<string, string>,\n resolvedQueryParams: Record<string, string>,\n httpClientLayer: Layer.Layer<HttpClient.HttpClient>,\n) =>\n invoke(operation, args, endpoint, resolvedHeaders, resolvedQueryParams).pipe(\n Effect.provide(httpClientLayer),\n Effect.withSpan(\"plugin.graphql.invoke\", {\n attributes: {\n \"plugin.graphql.endpoint\": endpointForTelemetry(endpoint),\n \"plugin.graphql.operation_kind\": operation.kind,\n \"plugin.graphql.field_name\": operation.fieldName,\n },\n }),\n );\n","import { Effect, Option, Predicate, Schema } from \"effect\";\n\nimport {\n type Owner,\n type PluginStorageEntry,\n type StorageDeps,\n type StorageFailure,\n} from \"@executor-js/sdk/core\";\n\nimport { OperationBinding } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Per-integration operation bindings.\n//\n// In v2 the integration's GraphQL operations are derived from introspection and\n// are identical for every connection, so the plugin store keeps one set of\n// operation bindings per integration slug — `invokeTool` reads them back to\n// rebuild the request. Operations are catalog-level metadata, so they live under\n// the shared `owner: \"org\"` partition.\n// ---------------------------------------------------------------------------\n\nconst CATALOG_OWNER: Owner = \"org\";\nconst OPERATION_COLLECTION = \"operation\";\n\nexport interface StoredOperation {\n /** The tool's leaf name, e.g. `query.hello`. */\n readonly toolName: string;\n /** The owning integration slug. */\n readonly integration: string;\n readonly binding: OperationBinding;\n}\n\nconst OperationBindingFromJsonString = Schema.fromJsonString(OperationBinding);\nconst decodeOperationBindingFromJsonString = Schema.decodeUnknownSync(\n OperationBindingFromJsonString,\n);\nconst decodeOperationBinding = Schema.decodeUnknownSync(OperationBinding);\nconst encodeBinding = Schema.encodeSync(OperationBinding);\n\nconst decodeBinding = (value: unknown): OperationBinding => {\n if (typeof value === \"string\") return decodeOperationBindingFromJsonString(value);\n return decodeOperationBinding(value);\n};\n\nconst toJsonRecord = (value: unknown): Record<string, unknown> => value as Record<string, unknown>;\n\nconst OperationStorage = Schema.Struct({\n toolName: Schema.String,\n integration: Schema.String,\n binding: Schema.Unknown,\n});\nconst decodeOperationStorage = Schema.decodeUnknownOption(OperationStorage);\n\nconst operationKey = (integration: string, toolName: string): string =>\n `${integration}.${toolName}`;\n\nconst operationData = (operation: StoredOperation) => ({\n toolName: operation.toolName,\n integration: operation.integration,\n binding: toJsonRecord(encodeBinding(operation.binding)),\n});\n\nconst rowToOperation = (row: PluginStorageEntry): StoredOperation | null => {\n const decoded = decodeOperationStorage(row.data);\n if (Option.isNone(decoded)) return null;\n const operation = decoded.value;\n return {\n toolName: operation.toolName,\n integration: operation.integration,\n binding: decodeBinding(operation.binding),\n };\n};\n\n/** Blob key for an introspection snapshot's content hash. Content-addressed\n * so re-puts are idempotent and identical schemas share one blob per\n * partition. */\nexport const introspectionBlobKey = (introspectionHash: string): string =>\n `introspection/${introspectionHash}`;\n\nexport interface GraphqlStore {\n /** Replace the stored operation bindings for an integration. */\n readonly replaceOperations: (\n integration: string,\n operations: readonly StoredOperation[],\n ) => Effect.Effect<void, StorageFailure>;\n readonly getOperation: (\n integration: string,\n toolName: string,\n ) => Effect.Effect<StoredOperation | null, StorageFailure>;\n readonly listOperations: (\n integration: string,\n ) => Effect.Effect<readonly StoredOperation[], StorageFailure>;\n readonly removeOperations: (integration: string) => Effect.Effect<void, StorageFailure>;\n /** Persist an introspection JSON snapshot under its content hash. Org-owned\n * and content-addressed; never removed on integration removal because\n * another integration in the tenant may share the hash. */\n readonly putIntrospection: (\n introspectionHash: string,\n introspectionJson: string,\n ) => Effect.Effect<void, StorageFailure>;\n /** Load an introspection snapshot by content hash; null when absent. */\n readonly getIntrospection: (\n introspectionHash: string,\n ) => Effect.Effect<string | null, StorageFailure>;\n}\n\nexport const makeDefaultGraphqlStore = ({ pluginStorage, blobs }: StorageDeps): GraphqlStore => {\n const listOperationRows = (integration: string) =>\n pluginStorage\n .list({\n collection: OPERATION_COLLECTION,\n keyPrefix: `${integration}.`,\n })\n .pipe(\n Effect.map((rows) =>\n rows.filter((row) => rowToOperation(row)?.integration === integration),\n ),\n );\n\n const removeOperations = (integration: string) =>\n Effect.gen(function* () {\n const rows = yield* listOperationRows(integration);\n for (const row of rows) {\n yield* pluginStorage.remove({\n owner: CATALOG_OWNER,\n collection: OPERATION_COLLECTION,\n key: row.key,\n });\n }\n });\n\n return {\n replaceOperations: (integration, operations) =>\n Effect.gen(function* () {\n yield* removeOperations(integration);\n for (const operation of operations) {\n yield* pluginStorage.put({\n owner: CATALOG_OWNER,\n collection: OPERATION_COLLECTION,\n key: operationKey(integration, operation.toolName),\n data: operationData(operation),\n });\n }\n }),\n\n getOperation: (integration, toolName) =>\n pluginStorage\n .get({ collection: OPERATION_COLLECTION, key: operationKey(integration, toolName) })\n .pipe(Effect.map((row) => (row ? rowToOperation(row) : null))),\n\n listOperations: (integration) =>\n listOperationRows(integration).pipe(\n Effect.map((rows) => rows.map(rowToOperation).filter(Predicate.isNotNull)),\n ),\n\n removeOperations,\n\n putIntrospection: (introspectionHash, introspectionJson) =>\n blobs.put(introspectionBlobKey(introspectionHash), introspectionJson, {\n owner: CATALOG_OWNER,\n }),\n\n getIntrospection: (introspectionHash) => blobs.get(introspectionBlobKey(introspectionHash)),\n };\n};\n","import { Effect, Match, Option, Schema } from \"effect\";\nimport type { Layer } from \"effect\";\nimport { FetchHttpClient, HttpClient } from \"effect/unstable/http\";\n\nimport {\n authToolFailure,\n AuthTemplateSlug,\n definePlugin,\n IntegrationAlreadyExistsError,\n IntegrationDetectionResult,\n IntegrationSlug,\n mergeAuthTemplates,\n sha256Hex,\n ToolName,\n ToolResult,\n type AuthMethodDescriptor,\n type IntegrationConfig,\n type IntegrationRecord,\n type PluginCtx,\n type StorageFailure,\n type ToolAnnotations,\n type ToolDef,\n} from \"@executor-js/sdk/core\";\n\nimport {\n TOKEN_VARIABLE,\n describeApiKeyAuthMethod,\n describeNoneAuthMethod,\n oauthBearerPlacement,\n renderAuthPlacements,\n requiredPlacementVariables,\n type RenderedAuthPlacements,\n} from \"@executor-js/sdk/http-auth\";\n\nimport {\n introspect,\n parseIntrospectionJson,\n type IntrospectionResult,\n type IntrospectionType,\n type IntrospectionField,\n type IntrospectionTypeRef,\n} from \"./introspect\";\nimport { extract } from \"./extract\";\nimport {\n GraphqlAuthRequiredError,\n GraphqlIntrospectionError,\n GraphqlInvocationError,\n} from \"./errors\";\nimport { invokeWithLayer } from \"./invoke\";\nimport { graphqlPresets } from \"./presets\";\nimport { makeDefaultGraphqlStore, type GraphqlStore, type StoredOperation } from \"./store\";\nimport {\n GraphqlAuthMethodInput,\n decodeGraphqlIntegrationConfig,\n decodeGraphqlIntegrationConfigOption,\n ExtractedField,\n GraphqlIntegrationConfig,\n expandGraphqlAuthMethodInputs,\n normalizeGraphqlAuthMethods,\n OperationBinding,\n type GraphqlAuthMethod,\n type GraphqlOperationKind,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// GraphQL error-body decoding (for invocation responses)\n// ---------------------------------------------------------------------------\n\nconst GraphqlErrorBody = Schema.Struct({ message: Schema.String });\nconst GraphqlErrorsBody = Schema.Array(Schema.Unknown);\nconst decodeGraphqlErrorBody = Schema.decodeUnknownOption(GraphqlErrorBody);\nconst decodeGraphqlErrorsBody = Schema.decodeUnknownOption(GraphqlErrorsBody);\n\nconst decodeGraphqlErrors = (errors: unknown): readonly unknown[] | undefined =>\n Option.getOrUndefined(decodeGraphqlErrorsBody(errors));\n\nconst extractGraphqlErrorMessage = (errors: readonly unknown[]): string | undefined =>\n errors\n .map((error) => Option.getOrUndefined(decodeGraphqlErrorBody(error))?.message)\n .find((message) => message !== undefined && message.length > 0);\n\nconst GRAPHQL_PLUGIN_ID = \"graphql\";\n\n// ---------------------------------------------------------------------------\n// Extension input shapes\n// ---------------------------------------------------------------------------\n\n/** Register a GraphQL integration in the catalog. `endpoint` is the GraphQL URL;\n * `slug` (defaulted from the endpoint) is the catalog id; `introspectionJson`\n * supplies the schema when the endpoint disables live introspection; `headers`\n * / `queryParams` are static and also applied to add-time introspection;\n * `authenticationTemplate` declares the auth methods a connection can apply\n * through. */\nconst GraphqlAddIntegrationInputSchema = Schema.Struct({\n endpoint: Schema.String,\n slug: Schema.optional(Schema.String),\n name: Schema.optional(Schema.String),\n /** Agent-visible catalog description. Falls back to the introspected\n * schema's own description, then the display name. */\n description: Schema.optional(Schema.String),\n introspectionJson: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n authenticationTemplate: Schema.optional(Schema.Array(GraphqlAuthMethodInput)),\n});\nexport type GraphqlAddIntegrationInput = typeof GraphqlAddIntegrationInputSchema.Type;\n\nconst GraphqlConfigureInputSchema = Schema.Struct({\n name: Schema.optional(Schema.String),\n endpoint: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n authenticationTemplate: Schema.optional(Schema.Array(GraphqlAuthMethodInput)),\n});\nexport type GraphqlConfigureInput = typeof GraphqlConfigureInputSchema.Type;\n\n/** Input for the custom-method-create flow (HTTP `POST /graphql/integrations/\n * :slug/config`). Unlike `configure` (which REPLACES the whole config for the\n * generic repair path), `configureAuth` MERGE-APPENDS these methods onto the\n * integration's existing `authenticationTemplate`, mirroring OpenAPI's\n * `configure`. */\nconst GraphqlConfigureAuthInputSchema = Schema.Struct({\n authenticationTemplate: Schema.Array(GraphqlAuthMethodInput),\n mode: Schema.optional(Schema.Literals([\"merge\", \"replace\"])),\n});\nexport type GraphqlConfigureAuthInput = typeof GraphqlConfigureAuthInputSchema.Type;\n\n// ---------------------------------------------------------------------------\n// Static control-tool schemas\n// ---------------------------------------------------------------------------\n\nconst StaticAddIntegrationOutputSchema = Schema.Struct({\n slug: Schema.String,\n name: Schema.String,\n});\nconst StaticGetIntegrationInputSchema = Schema.Struct({\n slug: Schema.String,\n});\nconst StaticGetIntegrationOutputSchema = Schema.Struct({\n integration: Schema.NullOr(Schema.Unknown),\n});\n\nconst StaticAddIntegrationInputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(GraphqlAddIntegrationInputSchema),\n);\nconst StaticAddIntegrationOutputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(StaticAddIntegrationOutputSchema),\n);\nconst StaticGetIntegrationInputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(StaticGetIntegrationInputSchema),\n);\nconst StaticGetIntegrationOutputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(StaticGetIntegrationOutputSchema),\n);\n\nconst graphqlToolFailure = (code: string, message: string, details?: unknown) =>\n ToolResult.fail({\n code,\n message,\n ...(details === undefined ? {} : { details }),\n });\n\nconst graphqlAuthToolFailure = (failure: GraphqlAuthRequiredError) =>\n authToolFailure({\n code: failure.code,\n message: failure.message,\n source: { id: failure.integration, scope: failure.owner },\n credential: {\n kind: failure.credentialKind,\n ...(failure.credentialLabel ? { label: failure.credentialLabel } : {}),\n connectionId: failure.connection,\n },\n ...(failure.status !== undefined ? { status: failure.status } : {}),\n ...(failure.details !== undefined\n ? {\n upstream: {\n ...(failure.status !== undefined ? { status: failure.status } : {}),\n details: failure.details,\n },\n }\n : {}),\n });\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/** Match `token` as a separator-bounded run inside a URL hostname or path,\n * used as a low-confidence detection hint when introspection fails. */\nconst urlMatchesToken = (url: URL, token: string): boolean => {\n const re = new RegExp(`(?:^|[^a-z0-9])${token}(?:$|[^a-z0-9])`, \"i\");\n return re.test(url.hostname) || re.test(url.pathname);\n};\n\n/** Derive an integration slug from an endpoint URL. */\nconst slugFromEndpoint = (endpoint: string): string => {\n // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: URL construction throws; this helper intentionally falls back to the stable default slug\n try {\n const url = new URL(endpoint);\n return url.hostname.replace(/[^a-z0-9]+/gi, \"_\").toLowerCase();\n } catch {\n return \"graphql\";\n }\n};\n\nconst formatTypeRef = (ref: IntrospectionTypeRef): string =>\n Match.value(ref.kind).pipe(\n Match.when(\"NON_NULL\", () => (ref.ofType ? `${formatTypeRef(ref.ofType)}!` : \"Unknown!\")),\n Match.when(\"LIST\", () => (ref.ofType ? `[${formatTypeRef(ref.ofType)}]` : \"[Unknown]\")),\n Match.option,\n Option.getOrElse(() => ref.name ?? \"Unknown\"),\n );\n\nconst unwrapTypeName = (ref: IntrospectionTypeRef): string => {\n if (ref.name) return ref.name;\n if (ref.ofType) return unwrapTypeName(ref.ofType);\n return \"Unknown\";\n};\n\nconst buildSelectionSet = (\n ref: IntrospectionTypeRef,\n types: ReadonlyMap<string, IntrospectionType>,\n depth: number,\n seen: Set<string>,\n): string => {\n if (depth > 2) return \"\";\n\n const leafName = unwrapTypeName(ref);\n if (seen.has(leafName)) return \"\";\n\n const objectType = types.get(leafName);\n if (!objectType?.fields) return \"\";\n\n const kind = objectType.kind;\n if (kind === \"SCALAR\" || kind === \"ENUM\") return \"\";\n\n seen.add(leafName);\n\n const subFields = objectType.fields\n .filter((f: IntrospectionField) => !f.name.startsWith(\"__\"))\n .slice(0, 12)\n .map((f: IntrospectionField) => {\n const sub = buildSelectionSet(f.type, types, depth + 1, seen);\n return sub ? `${f.name} ${sub}` : f.name;\n });\n\n seen.delete(leafName);\n\n return subFields.length > 0 ? `{ ${subFields.join(\" \")} }` : \"\";\n};\n\n// Name every generated operation: some servers reject anonymous operations, and\n// APM tooling keys traces off the operation name. Field names are already valid\n// GraphQL name tokens, so the upper-cased field name is a safe operation name.\nconst operationNameForField = (fieldName: string): string =>\n fieldName.charAt(0).toUpperCase() + fieldName.slice(1);\n\nconst buildOperationStringForField = (\n kind: GraphqlOperationKind,\n field: IntrospectionField,\n types: ReadonlyMap<string, IntrospectionType>,\n): string => {\n const opType = kind === \"query\" ? \"query\" : \"mutation\";\n const opName = operationNameForField(field.name);\n\n const varDefs = field.args.map((arg) => {\n const typeName = formatTypeRef(arg.type);\n return `$${arg.name}: ${typeName}`;\n });\n\n const argPasses = field.args.map((arg) => `${arg.name}: $${arg.name}`);\n const selectionSet = buildSelectionSet(field.type, types, 0, new Set());\n\n const varDefsStr = varDefs.length > 0 ? `(${varDefs.join(\", \")})` : \"\";\n const argPassStr = argPasses.length > 0 ? `(${argPasses.join(\", \")})` : \"\";\n\n return `${opType} ${opName}${varDefsStr} { ${field.name}${argPassStr}${selectionSet ? ` ${selectionSet}` : \"\"} }`;\n};\n\ninterface PreparedOperation {\n readonly toolName: string;\n readonly description: string;\n readonly inputSchema: unknown;\n readonly binding: OperationBinding;\n}\n\nconst prepareOperations = (\n fields: readonly ExtractedField[],\n introspection: IntrospectionResult,\n): readonly PreparedOperation[] => {\n const typeMap = new Map<string, IntrospectionType>();\n for (const t of introspection.__schema.types) {\n typeMap.set(t.name, t);\n }\n\n const fieldMap = new Map<string, { kind: GraphqlOperationKind; field: IntrospectionField }>();\n const schema = introspection.__schema;\n for (const rootKind of [\"query\", \"mutation\"] as const) {\n const typeName = rootKind === \"query\" ? schema.queryType?.name : schema.mutationType?.name;\n if (!typeName) continue;\n const rootType = typeMap.get(typeName);\n if (!rootType?.fields) continue;\n for (const f of rootType.fields) {\n if (!f.name.startsWith(\"__\")) {\n fieldMap.set(`${rootKind}.${f.name}`, { kind: rootKind, field: f });\n }\n }\n }\n\n return fields.map((extracted) => {\n const prefix = extracted.kind === \"mutation\" ? \"mutation\" : \"query\";\n // A tool's name keeps its `<kind>.<field>` path (e.g. `query.hello`,\n // `mutation.setGreeting`). The address grammar treats `<tool>` as the\n // trailing remainder (see parseToolAddress), so the dot nests naturally.\n const toolName = `${prefix}.${extracted.fieldName}`;\n const description = Option.getOrElse(\n extracted.description,\n () => `GraphQL ${extracted.kind}: ${extracted.fieldName} -> ${extracted.returnTypeName}`,\n );\n\n const key = `${extracted.kind}.${extracted.fieldName}`;\n const entry = fieldMap.get(key);\n const operationString = entry\n ? buildOperationStringForField(entry.kind, entry.field, typeMap)\n : `${extracted.kind} ${operationNameForField(extracted.fieldName)} { ${extracted.fieldName} }`;\n\n const binding = OperationBinding.make({\n kind: extracted.kind,\n fieldName: extracted.fieldName,\n operationString,\n variableNames: extracted.arguments.map((a) => a.name),\n });\n\n return {\n toolName,\n description,\n inputSchema: Option.getOrUndefined(extracted.inputSchema),\n binding,\n };\n });\n};\n\nconst annotationsFor = (binding: OperationBinding): ToolAnnotations => {\n if (binding.kind === \"mutation\") {\n return {\n requiresApproval: true,\n approvalDescription: `mutation ${binding.fieldName}`,\n };\n }\n return {};\n};\n\n// ---------------------------------------------------------------------------\n// Auth method rendering (D11) — apply the connection's resolved values through\n// the method the connection references. An oauth2 method is the conventional\n// bearer placement (with the method's optional header/prefix override) over\n// the resolved access token; an apikey method renders its declared placements.\n// ---------------------------------------------------------------------------\n\nconst renderGraphqlAuthMethod = (\n method: GraphqlAuthMethod,\n values: Record<string, string | null>,\n): RenderedAuthPlacements => {\n if (method.kind === \"apikey\") return renderAuthPlacements(method.placements, values);\n if (method.kind === \"oauth2\") {\n return renderAuthPlacements([oauthBearerPlacement(method.header, method.prefix)], values);\n }\n return { headers: {}, queryParams: {} };\n};\n\n// ---------------------------------------------------------------------------\n// Introspection — produce operations from a config (live or stored JSON).\n// ---------------------------------------------------------------------------\n\nconst buildToolDefs = (prepared: readonly PreparedOperation[]): readonly ToolDef[] =>\n prepared.map((p) => ({\n name: ToolName.make(p.toolName),\n description: p.description,\n inputSchema: p.inputSchema,\n annotations: annotationsFor(p.binding),\n }));\n\nconst toStoredOperations = (\n slug: IntegrationSlug,\n prepared: readonly PreparedOperation[],\n): StoredOperation[] =>\n prepared.map((p) => ({\n toolName: p.toolName,\n integration: String(slug),\n binding: p.binding,\n }));\n\n/** Render an integration's static + resolved-credential auth onto introspection\n * headers/query params. Connection-create / tool-generation introspection runs\n * with the connection's credential (exactly how its tools are invoked), so an\n * auth-required endpoint introspects successfully here rather than at add-time. */\nconst introspectHeadersForConnection = (\n config: GraphqlIntegrationConfig,\n values: Record<string, string | null>,\n templateSlug: AuthTemplateSlug | null,\n): RenderedAuthPlacements => {\n const headers: Record<string, string> = { ...(config.headers ?? {}) };\n const queryParams: Record<string, string> = { ...(config.queryParams ?? {}) };\n // Render the exact method the connection references; with no slug\n // (connection row not yet persisted) fall back to the first declared.\n const method =\n (templateSlug !== null\n ? config.authenticationTemplate.find(\n (m: GraphqlAuthMethod) => m.slug === String(templateSlug),\n )\n : undefined) ?? config.authenticationTemplate[0];\n if (method) {\n const rendered = renderGraphqlAuthMethod(method, values);\n Object.assign(headers, rendered.headers);\n Object.assign(queryParams, rendered.queryParams);\n }\n return { headers, queryParams };\n};\n\n/** Resolve a config's introspection snapshot text from the plugin blob store\n * (`introspectionHash`). Null when the integration has no snapshot (live\n * introspection territory). Pre-blob rows that inlined the JSON are\n * rewritten by the introspection-to-blob migrations before this code reads\n * them. */\nconst loadIntrospectionJson = (\n storage: GraphqlStore,\n config: GraphqlIntegrationConfig,\n): Effect.Effect<string | null, StorageFailure> =>\n config.introspectionHash != null\n ? storage.getIntrospection(config.introspectionHash)\n : Effect.succeed(null);\n\n/** Introspect a config live or from its stored snapshot, applying connection\n * auth. A non-null `introspectionJson` (loaded via `loadIntrospectionJson`)\n * short-circuits the network; otherwise this introspects the endpoint with\n * the rendered credential. */\nconst introspectForConnection = (\n config: GraphqlIntegrationConfig,\n introspectionJson: string | null,\n values: Record<string, string | null>,\n templateSlug: AuthTemplateSlug | null,\n httpClientLayer: Layer.Layer<HttpClient.HttpClient>,\n): Effect.Effect<IntrospectionResult, GraphqlIntrospectionError> => {\n if (introspectionJson != null) {\n return parseIntrospectionJson(introspectionJson);\n }\n const auth = introspectHeadersForConnection(config, values, templateSlug);\n return introspect(\n config.endpoint,\n Object.keys(auth.headers).length > 0 ? auth.headers : undefined,\n Object.keys(auth.queryParams).length > 0 ? auth.queryParams : undefined,\n ).pipe(Effect.provide(httpClientLayer));\n};\n\n/** Introspect an integration's endpoint (with this connection's credential),\n * prepare its operations, persist the bindings, and return them. Invoked from\n * `invokeTool` on a cache miss — i.e. when an integration was registered\n * without an add-time schema and its bindings haven't been produced yet. */\nconst materializeOperations = (\n ctx: PluginCtx<GraphqlStore>,\n integration: string,\n config: GraphqlIntegrationConfig,\n credential: {\n readonly template: AuthTemplateSlug;\n readonly values: Record<string, string | null>;\n },\n httpClientLayer: Layer.Layer<HttpClient.HttpClient>,\n): Effect.Effect<readonly StoredOperation[], GraphqlIntrospectionError | StorageFailure> =>\n Effect.gen(function* () {\n // Render the exact method this connection references (we have its slug\n // here, unlike `resolveTools`) so an auth-required endpoint introspects.\n const method = config.authenticationTemplate.find(\n (m: GraphqlAuthMethod) => m.slug === String(credential.template),\n );\n const headers: Record<string, string> = { ...(config.headers ?? {}) };\n const queryParams: Record<string, string> = {\n ...(config.queryParams ?? {}),\n };\n if (method) {\n const rendered = renderGraphqlAuthMethod(method, credential.values);\n Object.assign(headers, rendered.headers);\n Object.assign(queryParams, rendered.queryParams);\n }\n\n const introspectionJson = yield* loadIntrospectionJson(ctx.storage, config);\n const introspection =\n introspectionJson != null\n ? yield* parseIntrospectionJson(introspectionJson)\n : yield* introspect(\n config.endpoint,\n Object.keys(headers).length > 0 ? headers : undefined,\n Object.keys(queryParams).length > 0 ? queryParams : undefined,\n ).pipe(Effect.provide(httpClientLayer));\n\n const { result } = yield* extract(introspection).pipe(\n Effect.catch(() =>\n Effect.succeed({\n result: { fields: [] as readonly ExtractedField[] },\n } as {\n readonly result: { readonly fields: readonly ExtractedField[] };\n }),\n ),\n );\n const prepared = prepareOperations(result.fields, introspection);\n const stored = toStoredOperations(IntegrationSlug.make(integration), prepared);\n yield* ctx.storage.replaceOperations(integration, stored);\n return stored;\n });\n\n// ---------------------------------------------------------------------------\n// Declared auth methods — project the stored `authenticationTemplate` into the\n// catalog's plugin-agnostic `AuthMethodDescriptor[]`. Pure/sync and tolerant of\n// a malformed or foreign config blob (returns `[]`). GraphQL has no accounts\n// slot of its own, so this projection is what surfaces declared + custom methods\n// through the catalog's `authMethods` to the hub / Add-account flows. Exported\n// for tests.\n//\n// none → a no-auth method carrying no credential inputs\n// apikey → carried placements (headers / query params) verbatim\n// oauth2 → one oauth method (no resolved endpoints; graphql renders the\n// connection value as a bearer at invoke time).\n// ---------------------------------------------------------------------------\n\nexport const describeGraphqlAuthMethods = (\n record: IntegrationRecord,\n): readonly AuthMethodDescriptor[] => {\n const config = Option.getOrUndefined(decodeGraphqlIntegrationConfigOption(record.config));\n if (!config) return [];\n return config.authenticationTemplate.map((method: GraphqlAuthMethod): AuthMethodDescriptor => {\n if (method.kind === \"apikey\") return describeApiKeyAuthMethod(method);\n if (method.kind === \"oauth2\") {\n return {\n id: method.slug,\n label: \"OAuth\",\n kind: \"oauth\",\n template: method.slug,\n oauth: {},\n };\n }\n return describeNoneAuthMethod(method.slug);\n });\n};\n\nexport const describeGraphqlIntegrationDisplay = (\n record: IntegrationRecord,\n): { readonly url?: string } => {\n const config = Option.getOrUndefined(decodeGraphqlIntegrationConfigOption(record.config));\n return { url: config?.endpoint };\n};\n\n// ---------------------------------------------------------------------------\n// Plugin extension\n// ---------------------------------------------------------------------------\n\n// The extension only registers integrations (and parses any pre-supplied\n// introspection JSON offline). Live introspection — the only thing that needed\n// an HTTP layer — is deferred to `resolveTools` / `invokeTool`, so the extension\n// no longer takes one.\nconst makeGraphqlExtension = (ctx: PluginCtx<GraphqlStore>) => {\n const buildConfig = (input: GraphqlAddIntegrationInput): GraphqlIntegrationConfig =>\n GraphqlIntegrationConfig.make({\n endpoint: input.endpoint,\n name: input.name?.trim() || slugFromEndpoint(input.endpoint),\n ...(input.headers !== undefined ? { headers: input.headers } : {}),\n ...(input.queryParams !== undefined ? { queryParams: input.queryParams } : {}),\n authenticationTemplate: input.authenticationTemplate\n ? normalizeGraphqlAuthMethods(input.authenticationTemplate)\n : [],\n });\n\n /** Register the integration in the catalog. Registering a source is a\n * catalog statement (\"we use this GraphQL endpoint now\") and MUST NOT make a\n * network call or require auth — exactly like MCP defers discovery. Live\n * introspection (and the operation bindings it yields) is deferred to\n * connection-create / tool-generation (`resolveTools`) and tool invocation\n * (`invokeTool`), where a connection's credential is available.\n *\n * When the caller pre-supplies `introspectionJson`, the schema is already in\n * hand, so we parse it offline (no network) and persist the operation\n * bindings up front. */\n const addIntegrationInternal = (input: GraphqlAddIntegrationInput) =>\n Effect.gen(function* () {\n const slug = IntegrationSlug.make(input.slug ?? slugFromEndpoint(input.endpoint));\n\n // Block re-adding an existing slug. The core `integrations.register`\n // primitive upserts (so boot re-registration is idempotent), but an\n // explicit add must NOT silently clobber an existing integration's tools,\n // connections, and policies. To add more auth, update the existing one.\n const existing = yield* ctx.core.integrations.get(slug);\n if (existing) {\n return yield* new IntegrationAlreadyExistsError({ slug });\n }\n\n return yield* addIntegrationTransaction(input, slug);\n });\n\n const addIntegrationTransaction = (input: GraphqlAddIntegrationInput, slug: IntegrationSlug) =>\n Effect.gen(function* () {\n const baseConfig = buildConfig(input);\n\n // No pre-supplied schema → register WITHOUT introspecting. Tools (and\n // their operation bindings) are produced lazily when a connection is\n // created (`resolveTools`) / a tool is first invoked (`invokeTool`),\n // using that connection's credential.\n if (input.introspectionJson === undefined) {\n yield* ctx.transaction(\n ctx.core.integrations.register({\n slug,\n name: baseConfig.name,\n description: input.description?.trim() || baseConfig.name,\n config: baseConfig,\n canRemove: true,\n canRefresh: true,\n }),\n );\n return { slug: String(slug), name: baseConfig.name, toolCount: 0 };\n }\n\n // Pre-supplied introspection JSON: parse it offline (no network) and\n // persist the operation bindings + snapshot so production stays offline.\n const introspection = yield* parseIntrospectionJson(input.introspectionJson);\n const { result } = yield* extract(introspection);\n const prepared = prepareOperations(result.fields, introspection);\n\n // Snapshot the resolved schema so tool production never needs a live\n // HTTP layer (D6: tools are spec-derived and identical per connection).\n // The snapshot text goes to the plugin blob store (content-addressed,\n // written OUTSIDE the transaction — re-puts are idempotent and an\n // aborted register leaves only an unreferenced blob), and the config\n // carries only its hash.\n const snapshotJson = JSON.stringify({ data: introspection });\n const introspectionHash = yield* sha256Hex(snapshotJson);\n const config = GraphqlIntegrationConfig.make({\n ...baseConfig,\n introspectionHash,\n });\n\n yield* ctx.storage.putIntrospection(introspectionHash, snapshotJson);\n\n yield* ctx.transaction(\n Effect.gen(function* () {\n yield* ctx.storage.replaceOperations(String(slug), toStoredOperations(slug, prepared));\n\n // Prefill order: caller's description, then the schema's own\n // description (present when introspection ran with schema\n // descriptions), then the display name.\n const schemaDescription =\n typeof (introspection as { description?: unknown }).description === \"string\"\n ? ((introspection as { description?: string }).description ?? \"\").trim()\n : \"\";\n yield* ctx.core.integrations.register({\n slug,\n name: config.name,\n description: input.description?.trim() || schemaDescription || config.name,\n config,\n canRemove: true,\n canRefresh: true,\n });\n }),\n );\n\n return {\n slug: String(slug),\n name: config.name,\n toolCount: prepared.length,\n };\n });\n\n const configureIntegration = (slug: string, input: GraphqlConfigureInput) =>\n Effect.gen(function* () {\n const record = yield* ctx.core.integrations.get(IntegrationSlug.make(slug));\n if (!record) return;\n const current = Option.getOrElse(\n // best-effort: re-decode the stored config, falling back to an\n // endpoint-only config if it was never set.\n yield* decodeGraphqlIntegrationConfig(record.config).pipe(Effect.option),\n () =>\n GraphqlIntegrationConfig.make({\n endpoint: \"\",\n name: record.description,\n authenticationTemplate: [],\n }),\n );\n\n const next = GraphqlIntegrationConfig.make({\n endpoint: input.endpoint ?? current.endpoint,\n name: input.name?.trim() || current.name,\n ...(current.introspectionHash !== undefined\n ? { introspectionHash: current.introspectionHash }\n : {}),\n ...((input.headers ?? current.headers) !== undefined\n ? { headers: input.headers ?? current.headers }\n : {}),\n ...((input.queryParams ?? current.queryParams) !== undefined\n ? { queryParams: input.queryParams ?? current.queryParams }\n : {}),\n authenticationTemplate: input.authenticationTemplate\n ? normalizeGraphqlAuthMethods(input.authenticationTemplate)\n : current.authenticationTemplate,\n });\n\n yield* ctx.core.integrations.update(IntegrationSlug.make(slug), {\n description: next.name,\n config: next,\n });\n });\n\n /** Read the integration's decoded config (or `null` when absent / malformed).\n * Surfaces `authenticationTemplate` for the configure / custom-method UX. */\n const getConfig = (\n slug: string,\n ): Effect.Effect<GraphqlIntegrationConfig | null, StorageFailure> =>\n ctx.core.integrations\n .get(IntegrationSlug.make(slug))\n .pipe(\n Effect.map((record) =>\n record ? Option.getOrNull(decodeGraphqlIntegrationConfigOption(record.config)) : null,\n ),\n );\n\n /** Merge-append custom auth methods onto the integration's existing\n * `authenticationTemplate`. Returns the merged array. A no-op (returns `[]`)\n * for an unknown slug or undecodable config. */\n const configureAuthMethods = (\n slug: string,\n input: GraphqlConfigureAuthInput,\n ): Effect.Effect<readonly GraphqlAuthMethod[], StorageFailure> =>\n ctx.transaction(\n Effect.gen(function* () {\n const record = yield* ctx.core.integrations.get(IntegrationSlug.make(slug));\n if (!record) return [] as readonly GraphqlAuthMethod[];\n const current = Option.getOrNull(decodeGraphqlIntegrationConfigOption(record.config));\n if (!current) return [] as readonly GraphqlAuthMethod[];\n\n // Replace mode declares the full set — backfill kind-based slugs.\n // Merge mode appends: `mergeAuthTemplates` replaces on slug match and\n // assigns fresh `custom_<id>` slugs to slug-less entries, so a custom\n // method never silently displaces a declared one.\n const merged =\n input.mode === \"replace\"\n ? normalizeGraphqlAuthMethods(input.authenticationTemplate)\n : mergeAuthTemplates(\n current.authenticationTemplate,\n expandGraphqlAuthMethodInputs(\n input.authenticationTemplate,\n ) as readonly GraphqlAuthMethod[],\n );\n\n const next = GraphqlIntegrationConfig.make({\n ...current,\n authenticationTemplate: merged,\n });\n\n yield* ctx.core.integrations.update(IntegrationSlug.make(slug), {\n config: next,\n });\n\n return merged;\n }),\n );\n\n return {\n /** Register a GraphQL integration (introspects + persists operations). */\n addIntegration: (input: GraphqlAddIntegrationInput) => addIntegrationInternal(input),\n\n /** Read the integration's stored config. */\n getIntegration: (slug: string) =>\n ctx.core.integrations\n .get(IntegrationSlug.make(slug))\n .pipe(Effect.map((record) => (record ? record.config : null))),\n\n /** Read the integration's decoded config (auth templates surfaced). */\n getConfig,\n\n /** Merge-append custom auth methods (custom-method-create flow). */\n configureAuth: configureAuthMethods,\n\n removeIntegration: (slug: string) =>\n ctx.transaction(\n Effect.gen(function* () {\n yield* ctx.storage.removeOperations(slug);\n yield* ctx.core.integrations\n .remove(IntegrationSlug.make(slug))\n .pipe(Effect.catchTag(\"IntegrationRemovalNotAllowedError\", () => Effect.void));\n }),\n ),\n\n configure: configureIntegration,\n };\n};\n\nexport type GraphqlPluginExtension = ReturnType<typeof makeGraphqlExtension>;\n\n// ---------------------------------------------------------------------------\n// Plugin factory\n// ---------------------------------------------------------------------------\n\nexport interface GraphqlPluginOptions {\n readonly httpClientLayer?: Layer.Layer<HttpClient.HttpClient>;\n}\n\nexport const graphqlPlugin = definePlugin((options?: GraphqlPluginOptions) => {\n return {\n id: GRAPHQL_PLUGIN_ID as \"graphql\",\n packageName: \"@executor-js/plugin-graphql\",\n integrationPresets: graphqlPresets.map((preset) => ({\n id: preset.id,\n name: preset.name,\n summary: preset.summary,\n url: preset.url,\n endpoint: preset.endpoint,\n ...(preset.icon ? { icon: preset.icon } : {}),\n ...(preset.featured ? { featured: preset.featured } : {}),\n })),\n storage: (deps): GraphqlStore => makeDefaultGraphqlStore(deps),\n\n extension: (ctx: PluginCtx<GraphqlStore>) => makeGraphqlExtension(ctx),\n\n integrationConfigure: {\n type: \"graphql\",\n schema: GraphqlConfigureInputSchema,\n configure: ({ ctx, integration, config }) =>\n makeGraphqlExtension(ctx).configure(String(integration), config as GraphqlConfigureInput),\n },\n\n describeAuthMethods: describeGraphqlAuthMethods,\n describeIntegrationDisplay: describeGraphqlIntegrationDisplay,\n\n staticSources: (self: GraphqlPluginExtension) => [\n {\n id: \"graphql\",\n kind: \"executor\",\n name: \"GraphQL\",\n tools: [\n {\n name: \"getIntegration\",\n description:\n \"Inspect an existing GraphQL integration, including endpoint, static headers/query params, and auth templates. Use this before repairing an integration with `graphql.configure` or creating a connection.\",\n inputSchema: StaticGetIntegrationInputStandardSchema,\n outputSchema: StaticGetIntegrationOutputStandardSchema,\n handler: ({ args }) => {\n const input = args as typeof StaticGetIntegrationInputSchema.Type;\n return Effect.map(self.getIntegration(input.slug), (integration) =>\n ToolResult.ok({ integration }),\n );\n },\n },\n {\n name: \"addIntegration\",\n description:\n \"Add a GraphQL endpoint to the catalog and register its operations. Introspects the endpoint (or uses provided introspection JSON). After adding, create an owner-scoped connection against the integration to materialize its per-connection tools. For API keys / bearer tokens, declare an `authenticationTemplate` and create a connection whose value is the token.\",\n annotations: {\n requiresApproval: true,\n approvalDescription: \"Add a GraphQL integration\",\n },\n inputSchema: StaticAddIntegrationInputStandardSchema,\n outputSchema: StaticAddIntegrationOutputStandardSchema,\n handler: ({ args }) => {\n const input = args as GraphqlAddIntegrationInput;\n return self.addIntegration(input).pipe(\n Effect.map((result) => ToolResult.ok({ slug: result.slug, name: result.name })),\n Effect.catchTags({\n GraphqlIntrospectionError: ({ message }) =>\n Effect.succeed(graphqlToolFailure(\"graphql_introspection_failed\", message)),\n GraphqlExtractionError: ({ message }) =>\n Effect.succeed(graphqlToolFailure(\"graphql_extraction_failed\", message)),\n IntegrationAlreadyExistsError: ({ slug }: IntegrationAlreadyExistsError) =>\n Effect.succeed(\n graphqlToolFailure(\n \"integration_already_exists\",\n `Integration ${slug} already exists; update it instead of re-adding.`,\n ),\n ),\n }),\n );\n },\n },\n ],\n },\n ],\n\n // -----------------------------------------------------------------------\n // Per-connection tool production. THIS is where a GraphQL integration is\n // introspected — when a connection is created (or refreshed), with that\n // connection's credential — yielding one ToolDef per operation. Registering\n // the integration in the catalog makes no network call; discovery is\n // deferred to here, exactly how MCP defers tool discovery to connect time.\n // The introspected schema is identical across connections, so `invokeTool`\n // re-derives the same operation bindings; only the credential differs.\n // -----------------------------------------------------------------------\n resolveTools: ({\n config,\n template,\n storage,\n getValues,\n }: {\n readonly config: IntegrationConfig;\n readonly template: AuthTemplateSlug | null;\n readonly storage: GraphqlStore;\n readonly getValues: () => Effect.Effect<Record<string, string | null>, unknown>;\n }) =>\n Effect.gen(function* () {\n const decoded = yield* decodeGraphqlIntegrationConfig(config).pipe(Effect.option);\n if (Option.isNone(decoded)) return { tools: [] };\n const graphqlConfig = decoded.value;\n const introspectionJson = yield* loadIntrospectionJson(storage, graphqlConfig);\n // Live introspection (no stored snapshot) needs the connection's\n // credential inputs for auth-required endpoints; resolve them lazily.\n const values =\n introspectionJson == null\n ? yield* getValues().pipe(\n Effect.catch(() => Effect.succeed({} as Record<string, string | null>)),\n )\n : ({} as Record<string, string | null>);\n const introspection = yield* introspectForConnection(\n graphqlConfig,\n introspectionJson,\n values,\n template,\n options?.httpClientLayer ?? httpClientLayerFallback,\n ).pipe(Effect.option);\n if (Option.isNone(introspection)) return { tools: [] };\n const extracted = yield* extract(introspection.value).pipe(Effect.option);\n if (Option.isNone(extracted)) return { tools: [] };\n const prepared = prepareOperations(extracted.value.result.fields, introspection.value);\n return {\n tools: buildToolDefs(prepared),\n definitions: extracted.value.definitions,\n };\n }).pipe(Effect.catch(() => Effect.succeed({ tools: [] as readonly ToolDef[] }))),\n\n // -----------------------------------------------------------------------\n // Invoke one of a connection's tools. Look up the operation by integration\n // + tool name, render the credential through the connection's auth\n // template, and execute the GraphQL request.\n // -----------------------------------------------------------------------\n invokeTool: ({ ctx, toolRow, credential, args }) =>\n Effect.gen(function* () {\n const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;\n const integration = toolRow.integration;\n const toolName = toolRow.name;\n\n const config = yield* decodeGraphqlIntegrationConfig(credential.config).pipe(\n Effect.mapError(\n () =>\n new GraphqlInvocationError({\n message: `Invalid GraphQL integration config for \"${integration}\"`,\n statusCode: Option.none(),\n }),\n ),\n );\n\n // Operation bindings are produced lazily for integrations registered\n // without an add-time schema (no network at catalog registration). On a\n // cache miss, introspect with this connection's credential, persist the\n // bindings, then resolve the requested tool — discovery/persistence are\n // deferred to first use, mirroring MCP.\n let op = yield* ctx.storage.getOperation(integration, toolName);\n if (!op) {\n op = yield* materializeOperations(\n ctx,\n integration,\n config,\n credential,\n httpClientLayer,\n ).pipe(Effect.map((ops) => ops.find((o) => o.toolName === toolName) ?? null));\n }\n if (!op) {\n return yield* new GraphqlInvocationError({\n message: `No GraphQL operation found for tool \"${integration}.${toolName}\"`,\n statusCode: Option.none(),\n });\n }\n\n const headers: Record<string, string> = { ...(config.headers ?? {}) };\n const queryParams: Record<string, string> = {\n ...(config.queryParams ?? {}),\n };\n\n const method = config.authenticationTemplate.find(\n (m: GraphqlAuthMethod) => m.slug === String(credential.template),\n );\n if (method && method.kind !== \"none\") {\n // A method with unresolved inputs fails the invocation explicitly\n // instead of dialing unauthenticated. oauth2 requires the resolved\n // access token (`token`); apikey requires every placement variable.\n const missing = (\n method.kind === \"oauth2\"\n ? [TOKEN_VARIABLE]\n : requiredPlacementVariables(method.placements)\n ).filter((variable) => credential.values[variable] == null);\n if (missing.length > 0) {\n return yield* new GraphqlAuthRequiredError({\n code:\n method.kind === \"oauth2\" ? \"oauth_connection_missing\" : \"connection_value_missing\",\n message:\n method.kind === \"oauth2\"\n ? `Missing OAuth connection value for GraphQL integration \"${integration}\" (connection \"${credential.connection}\")`\n : `Missing credential value for GraphQL integration \"${integration}\" (connection \"${credential.connection}\") for input(s): ${missing.join(\", \")}`,\n owner: credential.owner,\n integration,\n connection: String(credential.connection),\n credentialKind: method.kind === \"oauth2\" ? \"oauth\" : \"secret\",\n credentialLabel: method.kind === \"oauth2\" ? \"OAuth sign-in\" : \"API key\",\n template: String(credential.template),\n });\n }\n const rendered = renderGraphqlAuthMethod(method, credential.values);\n Object.assign(headers, rendered.headers);\n Object.assign(queryParams, rendered.queryParams);\n }\n\n const result = yield* invokeWithLayer(\n op.binding,\n (args ?? {}) as Record<string, unknown>,\n config.endpoint,\n headers,\n queryParams,\n httpClientLayer,\n );\n\n const errors = decodeGraphqlErrors(result.errors);\n if (errors !== undefined && errors.length > 0) {\n const firstMessage = extractGraphqlErrorMessage(errors);\n return ToolResult.fail({\n code: \"graphql_errors\",\n message: firstMessage !== undefined ? firstMessage : \"GraphQL request returned errors\",\n details: { errors },\n });\n }\n if (result.status < 200 || result.status >= 300) {\n if (result.status === 401 || result.status === 403) {\n return authToolFailure({\n code: \"connection_rejected\",\n status: result.status,\n message: `Upstream rejected credentials for GraphQL integration \"${integration}\" with HTTP ${result.status}. Re-authenticate or update the connection before retrying this tool.`,\n source: { id: integration, scope: credential.owner },\n credential: { kind: \"upstream\", label: \"Upstream authorization\" },\n upstream: {\n status: result.status,\n details: {\n data: result.data,\n errors: result.errors,\n },\n },\n });\n }\n return ToolResult.fail({\n code: \"graphql_http_error\",\n status: result.status,\n message: `GraphQL request failed with HTTP ${result.status}`,\n details: {\n status: result.status,\n data: result.data,\n errors: result.errors,\n },\n });\n }\n return ToolResult.ok(result.data);\n }).pipe(\n Effect.catchTag(\"GraphqlAuthRequiredError\", (error) =>\n Effect.succeed(graphqlAuthToolFailure(error)),\n ),\n ),\n\n // Per-connection cleanup. Operation bindings are catalog-level (shared\n // across an integration's connections), so removing a single connection\n // leaves them in place; the executor drops the connection's tool rows.\n removeConnection: () => Effect.void,\n\n detect: ({ ctx, url }: { readonly ctx: PluginCtx<GraphqlStore>; readonly url: string }) =>\n Effect.gen(function* () {\n const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;\n const trimmed = url.trim();\n if (!trimmed) return null;\n const parsed = yield* Effect.try({\n try: () => new URL(trimmed),\n catch: (cause) => cause,\n }).pipe(Effect.option);\n if (Option.isNone(parsed)) return null;\n\n const ok = yield* introspect(trimmed).pipe(\n Effect.provide(httpClientLayer),\n Effect.map(() => true),\n Effect.catch(() => Effect.succeed(false)),\n );\n\n const slug = slugFromEndpoint(trimmed);\n\n if (ok) {\n return IntegrationDetectionResult.make({\n kind: \"graphql\",\n confidence: \"high\",\n endpoint: trimmed,\n name: slug,\n slug,\n });\n }\n\n // Low-confidence URL-token fallback. Introspection can fail for many\n // reasons (auth, CORS, the endpoint disabled introspection, transport\n // errors). When the URL itself strongly implies GraphQL, surface a\n // candidate so the user can still pick it.\n if (urlMatchesToken(parsed.value, \"graphql\")) {\n return IntegrationDetectionResult.make({\n kind: \"graphql\",\n confidence: \"low\",\n endpoint: trimmed,\n name: slug,\n slug,\n });\n }\n\n return null;\n }),\n };\n // HTTP transport (routes/handlers/extensionService) is layered on by the\n // api-aware factory in `@executor-js/plugin-graphql/api`.\n});\n\n// The fallback HTTP layer for `resolveTools`. The hook input carries no `ctx`,\n// so when no explicit layer is passed to the plugin we use the same default the\n// executor wires into `ctx.httpClientLayer` (`FetchHttpClient.layer`). Hosts/\n// tests that need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,2BAA2B,KAAK;AAAA,UACrC,MAAM;AAAA,UACN,YAAY;AAAA,UACZ,UAAU;AAAA,UACV,MAAM;AAAA,UACN;AAAA,QACF,CAAC;AAAA,MACH;AAEA,aAAO;AAAA,IACT,CAAC;AAAA,EACL;AAGF,CAAC;AAMD,IAAM,0BAA8D,gBAAgB;","names":["raw","Effect","Option","Option","Effect","Effect","Option","HttpClient","HttpClientRequest","Effect","HttpClient","HttpClientRequest","Option","Effect","Option","Schema","Schema","Option","Effect","Effect","Match","Option","Schema","Schema","Option","formatTypeRef","Match","unwrapTypeName","Effect"]}
|
package/dist/client.js
CHANGED
|
@@ -7,19 +7,16 @@ import { defineClientPlugin } from "@executor-js/sdk/client";
|
|
|
7
7
|
|
|
8
8
|
// src/react/source-plugin.ts
|
|
9
9
|
import { lazy } from "react";
|
|
10
|
-
var importAdd = () => import("./AddGraphqlSource-
|
|
11
|
-
var
|
|
12
|
-
var importAccounts = () => import("./GraphqlAccountsPanel-U62WSGHR.js");
|
|
10
|
+
var importAdd = () => import("./AddGraphqlSource-B7ZOZ7WM.js");
|
|
11
|
+
var importAccounts = () => import("./GraphqlAccountsPanel-QGBVXP2A.js");
|
|
13
12
|
var graphqlIntegrationPlugin = {
|
|
14
13
|
key: "graphql",
|
|
15
14
|
label: "GraphQL",
|
|
16
15
|
add: lazy(importAdd),
|
|
17
|
-
edit: lazy(importEdit),
|
|
18
16
|
accounts: lazy(importAccounts),
|
|
19
17
|
presets: graphqlPresets,
|
|
20
18
|
preload: () => {
|
|
21
19
|
void importAdd();
|
|
22
|
-
void importEdit();
|
|
23
20
|
void importAccounts();
|
|
24
21
|
}
|
|
25
22
|
};
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/plugin-client.tsx","../src/react/source-plugin.ts"],"sourcesContent":["import { defineClientPlugin } from \"@executor-js/sdk/client\";\n\nimport { graphqlIntegrationPlugin } from \"./source-plugin\";\n\nexport default defineClientPlugin({\n id: \"graphql\" as const,\n integrationPlugin: graphqlIntegrationPlugin,\n});\n","import { lazy } from \"react\";\nimport type { IntegrationPlugin } from \"@executor-js/sdk/client\";\nimport { graphqlPresets } from \"../sdk/presets\";\n\nconst importAdd = () => import(\"./AddGraphqlSource\");\nconst
|
|
1
|
+
{"version":3,"sources":["../src/react/plugin-client.tsx","../src/react/source-plugin.ts"],"sourcesContent":["import { defineClientPlugin } from \"@executor-js/sdk/client\";\n\nimport { graphqlIntegrationPlugin } from \"./source-plugin\";\n\nexport default defineClientPlugin({\n id: \"graphql\" as const,\n integrationPlugin: graphqlIntegrationPlugin,\n});\n","import { lazy } from \"react\";\nimport type { IntegrationPlugin } from \"@executor-js/sdk/client\";\nimport { graphqlPresets } from \"../sdk/presets\";\n\nconst importAdd = () => import(\"./AddGraphqlSource\");\nconst importAccounts = () => import(\"./GraphqlAccountsPanel\");\n\n// No `editSheet`: GraphQL has no plugin-specific configuration beyond auth\n// methods, which the Accounts hub already owns (\"+ Custom method\").\nexport const graphqlIntegrationPlugin: IntegrationPlugin = {\n key: \"graphql\",\n label: \"GraphQL\",\n add: lazy(importAdd),\n accounts: lazy(importAccounts),\n presets: graphqlPresets,\n preload: () => {\n void importAdd();\n void importAccounts();\n },\n};\n"],"mappings":";;;;;AAAA,SAAS,0BAA0B;;;ACAnC,SAAS,YAAY;AAIrB,IAAM,YAAY,MAAM,OAAO,gCAAoB;AACnD,IAAM,iBAAiB,MAAM,OAAO,oCAAwB;AAIrD,IAAM,2BAA8C;AAAA,EACzD,KAAK;AAAA,EACL,OAAO;AAAA,EACP,KAAK,KAAK,SAAS;AAAA,EACnB,UAAU,KAAK,cAAc;AAAA,EAC7B,SAAS;AAAA,EACT,SAAS,MAAM;AACb,SAAK,UAAU;AACf,SAAK,eAAe;AAAA,EACtB;AACF;;;ADfA,IAAO,wBAAQ,mBAAmB;AAAA,EAChC,IAAI;AAAA,EACJ,mBAAmB;AACrB,CAAC;","names":[]}
|
package/dist/core.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,6 +3,10 @@ export declare function GraphqlSourceFields(props: {
|
|
|
3
3
|
readonly endpoint: string;
|
|
4
4
|
readonly onEndpointChange: (endpoint: string) => void;
|
|
5
5
|
readonly identity: IntegrationIdentity;
|
|
6
|
+
/** The integration's agent-visible description. Blank = the backend falls
|
|
7
|
+
* back to the introspected schema's own description, then the name. */
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
readonly onDescriptionChange?: (value: string) => void;
|
|
6
10
|
readonly endpointDisabled?: boolean;
|
|
7
11
|
readonly namespaceReadOnly?: boolean;
|
|
8
12
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/react/atoms.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export declare const addGraphqlIntegration: Atom.AtomResultFn<{
|
|
|
37
37
|
readonly endpoint: string;
|
|
38
38
|
readonly name?: string | undefined;
|
|
39
39
|
readonly slug?: string | undefined;
|
|
40
|
+
readonly description?: string | undefined;
|
|
40
41
|
readonly headers?: {
|
|
41
42
|
readonly [x: string]: string;
|
|
42
43
|
} | undefined;
|
|
@@ -137,6 +138,7 @@ export declare const addGraphqlIntegrationOptimistic: Atom.AtomResultFn<{
|
|
|
137
138
|
readonly endpoint: string;
|
|
138
139
|
readonly name?: string | undefined;
|
|
139
140
|
readonly slug?: string | undefined;
|
|
141
|
+
readonly description?: string | undefined;
|
|
140
142
|
readonly headers?: {
|
|
141
143
|
readonly [x: string]: string;
|
|
142
144
|
} | undefined;
|
package/dist/react/client.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare const GraphqlClient: import("effect/unstable/reactivity/AtomHttpA
|
|
|
2
2
|
readonly endpoint: import("effect/Schema").String;
|
|
3
3
|
readonly slug: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
4
4
|
readonly name: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
5
|
+
readonly description: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
5
6
|
readonly introspectionJson: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
6
7
|
readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
7
8
|
readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
package/dist/sdk/plugin.d.ts
CHANGED
|
@@ -15,6 +15,9 @@ declare const GraphqlAddIntegrationInputSchema: Schema.Struct<{
|
|
|
15
15
|
readonly endpoint: Schema.String;
|
|
16
16
|
readonly slug: Schema.optional<Schema.String>;
|
|
17
17
|
readonly name: Schema.optional<Schema.String>;
|
|
18
|
+
/** Agent-visible catalog description. Falls back to the introspected
|
|
19
|
+
* schema's own description, then the display name. */
|
|
20
|
+
readonly description: Schema.optional<Schema.String>;
|
|
18
21
|
readonly introspectionJson: Schema.optional<Schema.String>;
|
|
19
22
|
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
20
23
|
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@executor-js/plugin-graphql",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.13",
|
|
4
4
|
"homepage": "https://github.com/RhysSullivan/executor/tree/main/packages/plugins/graphql",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/RhysSullivan/executor/issues"
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@effect/platform-node": "4.0.0-beta.59",
|
|
56
|
-
"@executor-js/config": "1.5.
|
|
57
|
-
"@executor-js/sdk": "1.5.
|
|
56
|
+
"@executor-js/config": "1.5.13",
|
|
57
|
+
"@executor-js/sdk": "1.5.13",
|
|
58
58
|
"graphql": "^16.12.0",
|
|
59
59
|
"graphql-yoga": "^5.17.0"
|
|
60
60
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/AddGraphqlSource.tsx","../src/react/GraphqlSourceFields.tsx"],"sourcesContent":["import { useCallback, useMemo, useState } from \"react\";\nimport { useAtomSet } from \"@effect/atom-react\";\nimport * as Exit from \"effect/Exit\";\n\nimport { integrationWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport {\n integrationDisplayNameFromUrl,\n slugifyNamespace,\n useIntegrationIdentity,\n} from \"@executor-js/react/plugins/integration-identity\";\nimport { Button } from \"@executor-js/react/components/button\";\nimport {\n AuthMethodListEditor,\n useAuthMethodList,\n type AuthMethodRow,\n type AuthMethodSeed,\n} from \"@executor-js/react/components/auth-method-list-editor\";\nimport { FloatActions } from \"@executor-js/react/components/float-actions\";\nimport { Spinner } from \"@executor-js/react/components/spinner\";\nimport {\n addIntegrationErrorMessage,\n FormErrorAlert,\n SlugCollisionAlert,\n useSlugAlreadyExists,\n} from \"@executor-js/react/lib/integration-add\";\n\nimport { addGraphqlIntegrationOptimistic } from \"./atoms\";\nimport { GraphqlSourceFields } from \"./GraphqlSourceFields\";\nimport { graphqlAuthMethodInputsFromPlacements } from \"./auth-method-config\";\nimport type { GraphqlAuthMethodInput } from \"../sdk/types\";\n\n// v2 GraphQL add flow: register the integration with its declared auth-method\n// LIST (the shared `AuthMethodListEditor` — GraphQL stays header/query apiKey;\n// OAuth is hidden), then route to the integration's detail hub. Connection\n// creation is no longer part of the add flow — accounts are added from the hub\n// (P6: add without auth, connect later).\n\n// GraphQL has no add-time detection, so the list starts empty (module constant\n// — a fresh [] every render would re-seed the list each render).\nconst NO_SEEDS: readonly AuthMethodSeed[] = [];\n\nexport default function AddGraphqlSource(props: {\n onComplete: (slug?: string) => void;\n onCancel: () => void;\n initialUrl?: string;\n}) {\n const [endpoint, setEndpoint] = useState(props.initialUrl ?? \"\");\n const identity = useIntegrationIdentity({\n fallbackName: integrationDisplayNameFromUrl(endpoint, \"GraphQL\") ?? \"\",\n });\n const authMethodList = useAuthMethodList(NO_SEEDS);\n const [adding, setAdding] = useState(false);\n const [addError, setAddError] = useState<string | null>(null);\n\n const doAddIntegration = useAtomSet(addGraphqlIntegrationOptimistic, {\n mode: \"promiseExit\",\n });\n\n // The methods to register: each apikey row declares ONE method carrying\n // every named placement (header + query mix in a single method). Inputs\n // omit slugs — the backend assigns carrier-derived ones. `none` rows\n // register nothing.\n const authenticationTemplate = useMemo<readonly GraphqlAuthMethodInput[]>(\n () =>\n authMethodList.rows.flatMap((row: AuthMethodRow) =>\n row.value.kind === \"apikey\"\n ? graphqlAuthMethodInputsFromPlacements(row.value.placements)\n : [],\n ),\n [authMethodList.rows],\n );\n\n // Every apikey row needs at least one named placement; `none` rows are\n // always valid.\n const apiKeyComplete = authMethodList.rows.every(\n (row: AuthMethodRow) =>\n row.value.kind !== \"apikey\" ||\n row.value.placements.some((placement) => placement.name.trim().length > 0),\n );\n\n const resolvedSlug = useMemo(\n () =>\n slugifyNamespace(identity.namespace) ||\n slugifyNamespace(integrationDisplayNameFromUrl(endpoint.trim(), \"GraphQL\") ?? \"\") ||\n \"graphql\",\n [endpoint, identity.namespace],\n );\n\n // Pre-empt the API's `IntegrationAlreadyExistsError`: adding an integration\n // whose slug already exists clobbers the existing one's connections/policies,\n // so the API blocks it. Surface that here from the tenant-scoped catalog list.\n const slugAlreadyExists = useSlugAlreadyExists(resolvedSlug);\n\n const canAdd = endpoint.trim().length > 0 && apiKeyComplete && !adding && !slugAlreadyExists;\n\n const sourceIdentity = useCallback(() => {\n const trimmedEndpoint = endpoint.trim();\n const slug = resolvedSlug;\n const displayName =\n identity.name.trim() || integrationDisplayNameFromUrl(trimmedEndpoint, \"GraphQL\") || slug;\n return { trimmedEndpoint, slug, displayName };\n }, [endpoint, identity.name, resolvedSlug]);\n\n const handleAdd = async (): Promise<void> => {\n setAdding(true);\n setAddError(null);\n const { trimmedEndpoint, slug, displayName } = sourceIdentity();\n\n const integrationExit = await doAddIntegration({\n payload: {\n endpoint: trimmedEndpoint,\n slug,\n name: displayName,\n ...(authenticationTemplate.length > 0\n ? { authenticationTemplate: [...authenticationTemplate] }\n : {}),\n },\n reactivityKeys: integrationWriteKeys,\n });\n if (Exit.isFailure(integrationExit)) {\n setAddError(addIntegrationErrorMessage(integrationExit, slug, \"Failed to add source\"));\n setAdding(false);\n return;\n }\n const registeredSlug = integrationExit.value.slug;\n\n props.onComplete(String(registeredSlug));\n };\n\n return (\n <div className=\"flex flex-1 flex-col gap-6\">\n <h1 className=\"text-xl font-semibold text-foreground\">Add GraphQL Source</h1>\n\n <GraphqlSourceFields endpoint={endpoint} onEndpointChange={setEndpoint} identity={identity} />\n\n <AuthMethodListEditor\n list={authMethodList}\n allowedKinds={[\"none\", \"apikey\"]}\n emptyHint=\"No authentication declared. Add a method, or add the source without auth and connect an account from the integration page later.\"\n footerHint=\"Every method here is registered with the source. Connect an account from the integration page after adding.\"\n />\n\n {slugAlreadyExists && !adding && <SlugCollisionAlert slug={resolvedSlug} />}\n\n {addError && <FormErrorAlert message={addError} />}\n\n <FloatActions>\n <Button variant=\"ghost\" onClick={() => props.onCancel()} disabled={adding}>\n Cancel\n </Button>\n <Button onClick={() => void handleAdd()} disabled={!canAdd}>\n {adding && <Spinner className=\"size-3.5\" />}\n {adding ? \"Adding...\" : \"Add source\"}\n </Button>\n </FloatActions>\n </div>\n );\n}\n","import {\n CardStack,\n CardStackContent,\n CardStackEntryField,\n} from \"@executor-js/react/components/card-stack\";\nimport { Input } from \"@executor-js/react/components/input\";\nimport {\n IntegrationIdentityFieldRows,\n type IntegrationIdentity,\n} from \"@executor-js/react/plugins/integration-identity\";\n\nexport function GraphqlSourceFields(props: {\n readonly endpoint: string;\n readonly onEndpointChange: (endpoint: string) => void;\n readonly identity: IntegrationIdentity;\n readonly endpointDisabled?: boolean;\n readonly namespaceReadOnly?: boolean;\n}) {\n return (\n <CardStack>\n <CardStackContent className=\"border-t-0\">\n <CardStackEntryField\n label=\"Endpoint\"\n hint=\"The endpoint will be introspected to discover available queries and mutations.\"\n >\n <Input\n value={props.endpoint}\n onChange={(e) => props.onEndpointChange((e.target as HTMLInputElement).value)}\n placeholder=\"https://api.example.com/graphql\"\n className=\"font-mono text-sm\"\n disabled={props.endpointDisabled}\n />\n </CardStackEntryField>\n <IntegrationIdentityFieldRows\n identity={props.identity}\n namePlaceholder=\"e.g. Shopify API\"\n namespaceReadOnly={props.namespaceReadOnly}\n />\n </CardStackContent>\n </CardStack>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAS,aAAa,SAAS,gBAAgB;AAC/C,SAAS,kBAAkB;AAC3B,YAAY,UAAU;AAEtB,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACxBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,OAEK;AAWD,SAKI,KALJ;AATC,SAAS,oBAAoB,OAMjC;AACD,SACE,oBAAC,aACC,+BAAC,oBAAiB,WAAU,cAC1B;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAM;AAAA,QACN,MAAK;AAAA,QAEL;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,MAAM;AAAA,YACb,UAAU,CAAC,MAAM,MAAM,iBAAkB,EAAE,OAA4B,KAAK;AAAA,YAC5E,aAAY;AAAA,YACZ,WAAU;AAAA,YACV,UAAU,MAAM;AAAA;AAAA,QAClB;AAAA;AAAA,IACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,MAAM;AAAA,QAChB,iBAAgB;AAAA,QAChB,mBAAmB,MAAM;AAAA;AAAA,IAC3B;AAAA,KACF,GACF;AAEJ;;;AD0FM,gBAAAA,MAmBE,QAAAC,aAnBF;AA5FN,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AAA,kBAAU,gBAAAD,KAAC,WAAQ,WAAU,YAAW;AAAA,QACxC,SAAS,cAAc;AAAA,SAC1B;AAAA,OACF;AAAA,KACF;AAEJ;","names":["jsx","jsxs"]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GraphqlAccountsPanel
|
|
3
|
-
} from "./chunk-OGNJZCEF.js";
|
|
4
|
-
import {
|
|
5
|
-
graphqlIntegrationConfigAtom
|
|
6
|
-
} from "./chunk-HN5FB4DO.js";
|
|
7
|
-
import "./chunk-732HGFSH.js";
|
|
8
|
-
|
|
9
|
-
// src/react/EditGraphqlSource.tsx
|
|
10
|
-
import { useAtomValue } from "@effect/atom-react";
|
|
11
|
-
import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
|
|
12
|
-
import * as Option from "effect/Option";
|
|
13
|
-
import { IntegrationSlug } from "@executor-js/sdk/shared";
|
|
14
|
-
import { decodeGraphqlIntegrationConfigOption } from "@executor-js/plugin-graphql";
|
|
15
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
-
function EditGraphqlSource(props) {
|
|
17
|
-
const slug = IntegrationSlug.make(props.sourceId);
|
|
18
|
-
const configResult = useAtomValue(graphqlIntegrationConfigAtom(slug));
|
|
19
|
-
const config = AsyncResult.isSuccess(configResult) ? Option.getOrNull(decodeGraphqlIntegrationConfigOption(configResult.value)) : null;
|
|
20
|
-
if (!AsyncResult.isSuccess(configResult) || !config) {
|
|
21
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
22
|
-
/* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-foreground", children: "GraphQL Source" }),
|
|
23
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Loading configuration\u2026" })
|
|
24
|
-
] });
|
|
25
|
-
}
|
|
26
|
-
return /* @__PURE__ */ jsx(
|
|
27
|
-
GraphqlAccountsPanel,
|
|
28
|
-
{
|
|
29
|
-
sourceId: props.sourceId,
|
|
30
|
-
integrationName: config.name || String(slug),
|
|
31
|
-
accountHandoff: null
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
EditGraphqlSource as default
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=EditGraphqlSource-QELISUYT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/EditGraphqlSource.tsx"],"sourcesContent":["import { useAtomValue } from \"@effect/atom-react\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport * as Option from \"effect/Option\";\n\nimport { IntegrationSlug } from \"@executor-js/sdk/shared\";\nimport { decodeGraphqlIntegrationConfigOption } from \"@executor-js/plugin-graphql\";\n\nimport { graphqlIntegrationConfigAtom } from \"./atoms\";\nimport GraphqlAccountsPanel from \"./GraphqlAccountsPanel\";\n\n// ---------------------------------------------------------------------------\n// Edit form — v2: custom authentication methods and connections live in the\n// shared accounts hub. Keep edit and accounts on the same component path so\n// GraphQL gets the same \"+ Custom method\" behavior as OpenAPI.\n// ---------------------------------------------------------------------------\n\nexport default function EditGraphqlSource(props: {\n readonly sourceId: string;\n readonly onSave: () => void;\n}) {\n const slug = IntegrationSlug.make(props.sourceId);\n const configResult = useAtomValue(graphqlIntegrationConfigAtom(slug));\n const config = AsyncResult.isSuccess(configResult)\n ? Option.getOrNull(decodeGraphqlIntegrationConfigOption(configResult.value))\n : null;\n\n if (!AsyncResult.isSuccess(configResult) || !config) {\n return (\n <div className=\"space-y-3\">\n <h1 className=\"text-xl font-semibold text-foreground\">GraphQL Source</h1>\n <p className=\"text-sm text-muted-foreground\">Loading configuration…</p>\n </div>\n );\n }\n\n return (\n <GraphqlAccountsPanel\n sourceId={props.sourceId}\n integrationName={config.name || String(slug)}\n accountHandoff={null}\n />\n );\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,oBAAoB;AAC7B,YAAY,iBAAiB;AAC7B,YAAY,YAAY;AAExB,SAAS,uBAAuB;AAChC,SAAS,4CAA4C;AAuB/C,SACE,KADF;AAZS,SAAR,kBAAmC,OAGvC;AACD,QAAM,OAAO,gBAAgB,KAAK,MAAM,QAAQ;AAChD,QAAM,eAAe,aAAa,6BAA6B,IAAI,CAAC;AACpE,QAAM,SAAqB,sBAAU,YAAY,IACtC,iBAAU,qCAAqC,aAAa,KAAK,CAAC,IACzE;AAEJ,MAAI,CAAa,sBAAU,YAAY,KAAK,CAAC,QAAQ;AACnD,WACE,qBAAC,SAAI,WAAU,aACb;AAAA,0BAAC,QAAG,WAAU,yCAAwC,4BAAc;AAAA,MACpE,oBAAC,OAAE,WAAU,iCAAgC,yCAAsB;AAAA,OACrE;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,MAAM;AAAA,MAChB,iBAAiB,OAAO,QAAQ,OAAO,IAAI;AAAA,MAC3C,gBAAgB;AAAA;AAAA,EAClB;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/atoms.ts","../src/react/client.ts","../src/api/group.ts","../src/react/auth-method-config.ts"],"sourcesContent":["import type { IntegrationSlug } from \"@executor-js/sdk/shared\";\nimport * as Atom from \"effect/unstable/reactivity/Atom\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport { integrationsOptimisticAtom } from \"@executor-js/react/api/atoms\";\nimport { ReactivityKey } from \"@executor-js/react/api/reactivity-keys\";\nimport { GraphqlClient } from \"./client\";\n\n// ---------------------------------------------------------------------------\n// Query atoms — v2 is integration-centric. The graphql HTTP surface exposes\n// only the catalog integration (`getIntegration` → its stored config, which\n// carries the `authenticationTemplate[]`). Connections are created through the\n// core API (`createConnection` / `oauth.start`), not through this plugin's\n// surface.\n// ---------------------------------------------------------------------------\n\nexport const graphqlIntegrationConfigAtom = (slug: IntegrationSlug) =>\n GraphqlClient.query(\"graphql\", \"getIntegration\", {\n params: { slug: String(slug) },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.integrations, ReactivityKey.tools],\n });\n\n// The full opaque config (including `authenticationTemplate`), used by the\n// configure UX to render existing auth methods and add custom ones.\nexport const graphqlConfigAtom = (slug: IntegrationSlug) =>\n GraphqlClient.query(\"graphql\", \"getConfig\", {\n params: { slug: String(slug) },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.integrations, ReactivityKey.tools],\n });\n\n// ---------------------------------------------------------------------------\n// Mutation atoms\n// ---------------------------------------------------------------------------\n\nexport const addGraphqlIntegration = GraphqlClient.mutation(\"graphql\", \"addIntegration\");\n\n// Merge-append custom auth methods onto an integration's `authenticationTemplate`.\nexport const graphqlConfigure = GraphqlClient.mutation(\"graphql\", \"configure\");\n\n// Optimistically slot a pending row into the shared integration catalog so the\n// integrations list reflects the new GraphQL integration before the server\n// round-trips. The reducer mirrors the catalog `Integration` shape.\nexport const addGraphqlIntegrationOptimistic = integrationsOptimisticAtom.pipe(\n Atom.optimisticFn({\n reducer: (\n current,\n arg: {\n readonly payload: {\n readonly endpoint: string;\n readonly slug?: string;\n readonly name?: string;\n };\n },\n ) =>\n AsyncResult.map(current, (rows) => {\n const slug = (arg.payload.slug ??\n `pending-${Math.random().toString(36).slice(2)}`) as IntegrationSlug;\n const integration = {\n slug,\n kind: \"graphql\",\n description: arg.payload.name ?? arg.payload.endpoint,\n canRemove: false,\n canRefresh: false,\n authMethods: [],\n };\n return [integration, ...rows.filter((row) => row.slug !== slug)].sort((a, b) =>\n a.description.localeCompare(b.description),\n );\n }),\n fn: addGraphqlIntegration,\n }),\n);\n","import { createPluginAtomClient } from \"@executor-js/sdk/client\";\nimport {\n getExecutorApiBaseUrl,\n getExecutorServerAuthorizationHeader,\n} from \"@executor-js/react/api/server-connection\";\nimport { GraphqlGroup } from \"../api/group\";\n\nexport const GraphqlClient = createPluginAtomClient(GraphqlGroup, {\n baseUrl: getExecutorApiBaseUrl,\n authorizationHeader: getExecutorServerAuthorizationHeader,\n});\n","import { HttpApiEndpoint, HttpApiGroup } from \"effect/unstable/httpapi\";\nimport { Schema } from \"effect\";\nimport { InternalError, IntegrationAlreadyExistsError } from \"@executor-js/sdk/shared\";\n\nimport { GraphqlIntrospectionError, GraphqlExtractionError } from \"../sdk/errors\";\nimport { GraphqlAuthMethod, GraphqlAuthMethodInput } from \"../sdk/types\";\n\n// ---------------------------------------------------------------------------\n// Params\n// ---------------------------------------------------------------------------\n\nconst IntegrationParams = {\n slug: Schema.String,\n};\n\n// ---------------------------------------------------------------------------\n// Payloads\n// ---------------------------------------------------------------------------\n\nconst AddIntegrationPayload = Schema.Struct({\n endpoint: Schema.String,\n slug: Schema.optional(Schema.String),\n name: Schema.optional(Schema.String),\n introspectionJson: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n authenticationTemplate: Schema.optional(Schema.Array(GraphqlAuthMethodInput)),\n});\n\n// The `configure` payload — the custom auth methods to merge-append onto the\n// integration's `authenticationTemplate`. Reuses the same input schema as\n// `addIntegration` (slug optional — the backend backfills it) so a custom\n// apikey method round-trips identically.\nconst ConfigurePayload = Schema.Struct({\n authenticationTemplate: Schema.Array(GraphqlAuthMethodInput),\n mode: Schema.optional(Schema.Literals([\"merge\", \"replace\"])),\n});\n\n// ---------------------------------------------------------------------------\n// Responses\n// ---------------------------------------------------------------------------\n\nconst AddIntegrationResponse = Schema.Struct({\n slug: Schema.String,\n name: Schema.String,\n});\n\n// The integration config surfaced for the configure UX. Carries the\n// `authenticationTemplate` the configure / custom-method flow reads/writes.\n// The introspection snapshot is deliberately NOT served: it's a multi-MB\n// build artifact in the plugin blob store, and no client reads it.\nconst GraphqlConfigView = Schema.Struct({\n endpoint: Schema.String,\n name: Schema.String,\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n authenticationTemplate: Schema.Array(GraphqlAuthMethod),\n});\n\n// The configure result — the merged `authenticationTemplate` after the new\n// custom methods were appended/replaced.\nconst ConfigureResponse = Schema.Struct({\n authenticationTemplate: Schema.Array(GraphqlAuthMethod),\n});\n\n// ---------------------------------------------------------------------------\n// Errors with HTTP status\n// ---------------------------------------------------------------------------\n\nconst IntrospectionError = GraphqlIntrospectionError.annotate({\n httpApiStatus: 400,\n});\nconst ExtractionError = GraphqlExtractionError.annotate({ httpApiStatus: 400 });\n\n// ---------------------------------------------------------------------------\n// Group — the GraphQL HTTP surface over integrations.\n//\n// Plugin SDK errors (GraphqlIntrospectionError etc.) are declared once at the\n// group level via `.addError(...)`. `InternalError` is the shared opaque-by-\n// schema 500 surface translated from `StorageError` by `withCapture` at the\n// HTTP edge.\n// ---------------------------------------------------------------------------\n\nconst GraphqlErrors = [\n InternalError,\n IntrospectionError,\n ExtractionError,\n IntegrationAlreadyExistsError,\n] as const;\n\nexport const GraphqlGroup = HttpApiGroup.make(\"graphql\")\n .add(\n HttpApiEndpoint.post(\"addIntegration\", \"/graphql/integrations\", {\n payload: AddIntegrationPayload,\n success: AddIntegrationResponse,\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\"getIntegration\", \"/graphql/integrations/:slug\", {\n params: IntegrationParams,\n success: Schema.NullOr(Schema.Unknown),\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\"getConfig\", \"/graphql/integrations/:slug/config\", {\n params: IntegrationParams,\n success: Schema.NullOr(GraphqlConfigView),\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.post(\"configure\", \"/graphql/integrations/:slug/config\", {\n params: IntegrationParams,\n payload: ConfigurePayload,\n success: ConfigureResponse,\n error: GraphqlErrors,\n }),\n );\n","// ---------------------------------------------------------------------------\n// GraphQL ↔ generic auth-method converters — a thin oauth adapter over the\n// shared codec (`@executor-js/react/lib/shared-auth-method-codec`). The\n// apikey/none paths (multi-placement, multi-variable) live in the shared\n// codec; GraphQL only contributes its oauth flavor: endpoint-less methods that\n// render the connection's access token as a bearer header at invoke time\n// (optionally overriding the header name / prefix).\n// ---------------------------------------------------------------------------\n\nimport { AuthTemplateSlug } from \"@executor-js/sdk/shared\";\nimport type { AuthTemplateEditorValue } from \"@executor-js/react/components/auth-template-editor\";\nimport type { AuthMethod, Placement } from \"@executor-js/react/lib/auth-placements\";\nimport {\n wireAuthInputFromShared,\n authMethodFromSharedTemplate,\n editorValueFromSharedMethod,\n sharedMethodInputFromEditorValue,\n wirePlacementsFromEditor,\n} from \"@executor-js/react/lib/shared-auth-method-codec\";\n\nimport type {\n GraphqlAuthMethod,\n GraphqlAuthMethodInput,\n GraphqlCanonicalAuthMethodInput,\n} from \"../sdk/types\";\n\nconst oauthAuthMethod = (slug: string): AuthMethod => ({\n id: slug,\n label: \"OAuth\",\n kind: \"oauth\",\n source: slug.startsWith(\"custom_\") ? \"custom\" : \"spec\",\n template: AuthTemplateSlug.make(slug),\n placements: [],\n oauth: {},\n});\n\n/** Convert a generic editor value into one GraphQL auth-method input (no slug\n * — the backend assigns carrier-derived slugs). An apikey value keeps every\n * named placement (headers and query params mix freely); one with no usable\n * placement falls back to `none`. */\nexport function graphqlAuthMethodInputFromEditorValue(\n value: AuthTemplateEditorValue,\n): GraphqlAuthMethodInput {\n if (value.kind === \"oauth\") return { kind: \"oauth2\" };\n return (sharedMethodInputFromEditorValue(value) ?? { kind: \"none\" }) as GraphqlAuthMethodInput;\n}\n\n/** Convert one stored GraphQL method into the generic editor value. */\nexport function editorValueFromGraphqlAuthMethod(\n method: GraphqlAuthMethod,\n): AuthTemplateEditorValue {\n if (method.kind === \"oauth2\") {\n // GraphQL oauth methods store no endpoints — only the bearer rendering.\n return { kind: \"oauth\", authorizationUrl: \"\", tokenUrl: \"\", scopes: [] };\n }\n return editorValueFromSharedMethod(method);\n}\n\n/** Project the stored methods into the generic `AuthMethod[]` the hub renders.\n * Mirrors the server's `describeGraphqlAuthMethods`; `custom_` slugs mark\n * user-created methods (removable from the hub). */\nexport function authMethodsFromConfig(methods: readonly GraphqlAuthMethod[]): AuthMethod[] {\n return methods.map((method: GraphqlAuthMethod): AuthMethod => {\n if (method.kind === \"oauth2\") return oauthAuthMethod(method.slug);\n return authMethodFromSharedTemplate(method);\n });\n}\n\n/** Build the GraphQL method input for a custom method from generic placements\n * — ONE method carrying every named placement (header + query mix in a single\n * method; each placement renders from its own input variable, or shares one).\n * Empty when no placement is usable. */\nexport function graphqlAuthMethodInputsFromPlacements(\n placements: readonly Placement[],\n): GraphqlAuthMethodInput[] {\n const wire = wirePlacementsFromEditor(placements);\n if (wire.length === 0) return [];\n return [graphqlWireAuthInput({ kind: \"apikey\", placements: wire })];\n}\n\n/** Serialize a canonical method into the wire input union (apikey → the\n * request-shaped dialect; none/oauth2 pass through). */\nexport const graphqlWireAuthInput = (\n method: GraphqlAuthMethod | GraphqlCanonicalAuthMethodInput,\n): GraphqlAuthMethodInput => wireAuthInputFromShared(method) as GraphqlAuthMethodInput;\n"],"mappings":";;;;;;;;AACA,YAAY,UAAU;AACtB,YAAY,iBAAiB;AAC7B,SAAS,kCAAkC;AAC3C,SAAS,qBAAqB;;;ACJ9B,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,cAAc;AACvB,SAAS,eAAe,qCAAqC;AAS7D,IAAM,oBAAoB;AAAA,EACxB,MAAM,OAAO;AACf;AAMA,IAAM,wBAAwB,OAAO,OAAO;AAAA,EAC1C,UAAU,OAAO;AAAA,EACjB,MAAM,OAAO,SAAS,OAAO,MAAM;AAAA,EACnC,MAAM,OAAO,SAAS,OAAO,MAAM;AAAA,EACnC,mBAAmB,OAAO,SAAS,OAAO,MAAM;AAAA,EAChD,SAAS,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM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a,CAAC;AAAA,MAChB;AACA,aAAO,CAAC,aAAa,GAAG,KAAK,OAAO,CAAC,QAAQ,IAAI,SAAS,IAAI,CAAC,EAAE;AAAA,QAAK,CAAC,GAAG,MACxE,EAAE,YAAY,cAAc,EAAE,WAAW;AAAA,MAC3C;AAAA,IACF,CAAC;AAAA,IACH,IAAI;AAAA,EACN,CAAC;AACH;;;AG/DA,SAAS,wBAAwB;AAGjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP,IAAM,kBAAkB,CAAC,UAA8B;AAAA,EACrD,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ,KAAK,WAAW,SAAS,IAAI,WAAW;AAAA,EAChD,UAAU,iBAAiB,KAAK,IAAI;AAAA,EACpC,YAAY,CAAC;AAAA,EACb,OAAO,CAAC;AACV;AA2BO,SAAS,sBAAsB,SAAqD;AACzF,SAAO,QAAQ,IAAI,CAAC,WAA0C;AAC5D,QAAI,OAAO,SAAS,SAAU,QAAO,gBAAgB,OAAO,IAAI;AAChE,WAAO,6BAA6B,MAAM;AAAA,EAC5C,CAAC;AACH;AAMO,SAAS,sCACd,YAC0B;AAC1B,QAAM,OAAO,yBAAyB,UAAU;AAChD,MAAI,KAAK,WAAW,EAAG,QAAO,CAAC;AAC/B,SAAO,CAAC,qBAAqB,EAAE,MAAM,UAAU,YAAY,KAAK,CAAC,CAAC;AACpE;AAIO,IAAM,uBAAuB,CAClC,WAC2B,wBAAwB,MAAM;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sdk/introspect.ts","../src/sdk/extract.ts","../src/sdk/invoke.ts","../src/sdk/store.ts","../src/sdk/plugin.ts"],"sourcesContent":["import { Effect, Option, Schema } from \"effect\";\nimport { HttpClient, HttpClientRequest } from \"effect/unstable/http\";\n\nimport { GraphqlIntrospectionError } from \"./errors\";\n\n// ---------------------------------------------------------------------------\n// Introspection query — standard GraphQL introspection\n// ---------------------------------------------------------------------------\n\nconst INTROSPECTION_QUERY = `\n query IntrospectionQuery {\n __schema {\n queryType { name }\n mutationType { name }\n types {\n kind\n name\n description\n fields(includeDeprecated: false) {\n name\n description\n args {\n name\n description\n type {\n ...TypeRef\n }\n defaultValue\n }\n type {\n ...TypeRef\n }\n }\n inputFields {\n name\n description\n type {\n ...TypeRef\n }\n defaultValue\n }\n enumValues(includeDeprecated: false) {\n name\n description\n }\n }\n }\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Introspection result types\n// ---------------------------------------------------------------------------\n\nconst IntrospectionTypeRefLeaf = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.Null),\n});\n\nconst IntrospectionTypeRef5 = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRefLeaf)),\n});\n\nconst IntrospectionTypeRef4 = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRef5)),\n});\n\nconst IntrospectionTypeRef3 = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRef4)),\n});\n\nconst IntrospectionTypeRef2 = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRef3)),\n});\n\nconst IntrospectionTypeRefSchema = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRef2)),\n});\n\nconst IntrospectionInputValueSchema = Schema.Struct({\n name: Schema.String,\n description: Schema.NullOr(Schema.String),\n type: IntrospectionTypeRefSchema,\n defaultValue: Schema.NullOr(Schema.String),\n});\n\nconst IntrospectionFieldSchema = Schema.Struct({\n name: Schema.String,\n description: Schema.NullOr(Schema.String),\n args: Schema.Array(IntrospectionInputValueSchema),\n type: IntrospectionTypeRefSchema,\n});\n\nconst IntrospectionTypeSchema = Schema.Struct({\n kind: Schema.String,\n name: Schema.String,\n description: Schema.NullOr(Schema.String),\n fields: Schema.NullOr(Schema.Array(IntrospectionFieldSchema)),\n inputFields: Schema.NullOr(Schema.Array(IntrospectionInputValueSchema)),\n enumValues: Schema.NullOr(\n Schema.Array(\n Schema.Struct({\n name: Schema.String,\n description: Schema.NullOr(Schema.String),\n }),\n ),\n ),\n});\n\nconst IntrospectionResultSchema = Schema.Struct({\n __schema: Schema.Struct({\n queryType: Schema.NullOr(Schema.Struct({ name: Schema.String })),\n mutationType: Schema.NullOr(Schema.Struct({ name: Schema.String })),\n types: Schema.Array(IntrospectionTypeSchema),\n }),\n});\n\nconst IntrospectionResponseSchema = Schema.Struct({\n data: Schema.optional(IntrospectionResultSchema),\n errors: Schema.optional(Schema.Array(Schema.Unknown)),\n});\n\nconst UpstreamErrorResponseSchema = Schema.Struct({\n message: Schema.optional(Schema.String),\n errors: Schema.optional(\n Schema.Array(\n Schema.Struct({\n message: Schema.optional(Schema.String),\n }),\n ),\n ),\n});\n\nconst IntrospectionJsonSchema = Schema.Union([\n Schema.Struct({ data: IntrospectionResultSchema }),\n IntrospectionResultSchema,\n]);\nconst JsonTextSchema = Schema.fromJsonString(Schema.Unknown);\n\nconst decodeUpstreamErrorResponse = Schema.decodeUnknownOption(UpstreamErrorResponseSchema);\n\nexport type IntrospectionTypeRef = typeof IntrospectionTypeRefSchema.Type;\nexport type IntrospectionInputValue = typeof IntrospectionInputValueSchema.Type;\nexport type IntrospectionField = typeof IntrospectionFieldSchema.Type;\nexport type IntrospectionEnumValue = NonNullable<\n (typeof IntrospectionTypeSchema.Type)[\"enumValues\"]\n>[number];\nexport type IntrospectionType = typeof IntrospectionTypeSchema.Type;\nexport type IntrospectionSchema = (typeof IntrospectionResultSchema.Type)[\"__schema\"];\nexport type IntrospectionResult = typeof IntrospectionResultSchema.Type;\n\nconst firstUpstreamErrorMessage = (value: unknown): string | null => {\n const decoded = decodeUpstreamErrorResponse(value);\n return Option.match(decoded, {\n onNone: () => null,\n onSome: (response) => {\n if (response.message) return response.message;\n for (const entry of response.errors ?? []) {\n const message = entry.message;\n if (message) return message;\n }\n return null;\n },\n });\n};\n\nconst redactUpstreamBody = (body: string): string =>\n body\n .replaceAll(\n /(\"(?:access_token|refresh_token|id_token|client_secret|token|authorization)\"\\s*:\\s*\")[^\"]*(\")/gi,\n \"$1[redacted]$2\",\n )\n .replaceAll(\n /((?:access_token|refresh_token|id_token|client_secret|token|authorization)=)[^&\\s]*/gi,\n \"$1[redacted]\",\n )\n .replaceAll(\n /((?:authorization|access-token|refresh-token|id-token|client-secret|token)\\s*:\\s*)(?:bearer\\s+)?[^\\s,;]+/gi,\n \"$1[redacted]\",\n );\n\nconst upstreamTextMessage = (body: string): string | null => {\n const text = redactUpstreamBody(body.replaceAll(/\\s+/g, \" \").trim());\n if (text.length === 0) return null;\n return text.length > 500 ? `${text.slice(0, 500)}...` : text;\n};\n\n// ---------------------------------------------------------------------------\n// Introspect a GraphQL endpoint\n// ---------------------------------------------------------------------------\n\nexport const introspect = Effect.fn(\"GraphQL.introspect\")(function* (\n endpoint: string,\n headers?: Record<string, string>,\n queryParams?: Record<string, string>,\n) {\n const client = yield* HttpClient.HttpClient;\n const requestEndpoint =\n queryParams && Object.keys(queryParams).length > 0\n ? (() => {\n const url = new URL(endpoint);\n for (const [name, value] of Object.entries(queryParams)) {\n url.searchParams.set(name, value);\n }\n return url.toString();\n })()\n : endpoint;\n\n let request = HttpClientRequest.post(requestEndpoint).pipe(\n HttpClientRequest.setHeader(\"Content-Type\", \"application/json\"),\n HttpClientRequest.setHeader(\"Accept\", \"application/json\"),\n HttpClientRequest.setHeader(\"User-Agent\", \"executor-graphql\"),\n HttpClientRequest.bodyJsonUnsafe({\n query: INTROSPECTION_QUERY,\n }),\n );\n\n if (headers) {\n for (const [k, v] of Object.entries(headers)) {\n request = HttpClientRequest.setHeader(request, k, v);\n }\n }\n\n const response = yield* client.execute(request).pipe(\n Effect.tapCause((cause) => Effect.logError(\"graphql introspection request failed\", cause)),\n Effect.mapError(\n () =>\n new GraphqlIntrospectionError({\n message: \"Failed to reach GraphQL endpoint\",\n }),\n ),\n );\n\n if (response.status !== 200) {\n const responseText = yield* response.text.pipe(Effect.catch(() => Effect.succeed(\"\")));\n const raw = responseText\n ? yield* Schema.decodeUnknownEffect(JsonTextSchema)(responseText).pipe(\n Effect.catch(() => Effect.succeed(null)),\n )\n : null;\n const upstreamMessage = upstreamTextMessage(\n (raw === null ? null : firstUpstreamErrorMessage(raw)) ?? responseText,\n );\n return yield* new GraphqlIntrospectionError({\n message: upstreamMessage\n ? `Introspection failed with status ${response.status}: ${upstreamMessage}`\n : `Introspection failed with status ${response.status}`,\n });\n }\n\n const raw = yield* response.json.pipe(\n Effect.tapCause((cause) => Effect.logError(\"graphql introspection JSON parse failed\", cause)),\n Effect.mapError(\n () =>\n new GraphqlIntrospectionError({\n message: `Failed to parse introspection response as JSON`,\n }),\n ),\n );\n\n const json = yield* Schema.decodeUnknownEffect(IntrospectionResponseSchema)(raw).pipe(\n Effect.mapError(\n () =>\n new GraphqlIntrospectionError({\n message: \"Introspection response has an invalid shape\",\n }),\n ),\n );\n\n if (json.errors && Array.isArray(json.errors) && json.errors.length > 0) {\n const upstreamMessage = firstUpstreamErrorMessage(json);\n return yield* new GraphqlIntrospectionError({\n message: upstreamMessage\n ? `Introspection returned ${json.errors.length} error(s): ${upstreamMessage}`\n : `Introspection returned ${json.errors.length} error(s)`,\n });\n }\n\n if (!json.data?.__schema) {\n return yield* new GraphqlIntrospectionError({\n message: \"Introspection response missing __schema\",\n });\n }\n\n return json.data;\n});\n\n// ---------------------------------------------------------------------------\n// Parse an introspection result from a JSON string (for offline/text input)\n// ---------------------------------------------------------------------------\n\nexport const parseIntrospectionJson = (\n text: string,\n): Effect.Effect<IntrospectionResult, GraphqlIntrospectionError> =>\n Schema.decodeUnknownEffect(Schema.fromJsonString(IntrospectionJsonSchema))(text).pipe(\n Effect.map((parsed) => (\"data\" in parsed ? parsed.data : parsed)),\n Effect.mapError(\n () =>\n new GraphqlIntrospectionError({\n message: \"Failed to parse introspection JSON\",\n }),\n ),\n );\n","import { Effect, Match, Option } from \"effect\";\n\nimport { GraphqlExtractionError } from \"./errors\";\nimport type {\n IntrospectionResult,\n IntrospectionSchema,\n IntrospectionType,\n IntrospectionTypeRef,\n IntrospectionInputValue,\n} from \"./introspect\";\nimport {\n ExtractedField,\n ExtractionResult,\n GraphqlArgument,\n type GraphqlOperationKind,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Type ref helpers\n// ---------------------------------------------------------------------------\n\n/** Unwrap NON_NULL / LIST wrappers to get the leaf type name */\nconst unwrapTypeName = (ref: IntrospectionTypeRef): string => {\n if (ref.name) return ref.name;\n if (ref.ofType) return unwrapTypeName(ref.ofType);\n return \"Unknown\";\n};\n\n/** Check if a type ref is non-null (required) */\nconst isNonNull = (ref: IntrospectionTypeRef): boolean => ref.kind === \"NON_NULL\";\n\n// ---------------------------------------------------------------------------\n// Build shared definitions from all INPUT_OBJECT and ENUM types\n// ---------------------------------------------------------------------------\n\nconst buildDefinitions = (\n types: ReadonlyMap<string, IntrospectionType>,\n): Record<string, unknown> => {\n const defs: Record<string, unknown> = {};\n\n for (const [name, type] of types) {\n // Skip internal types\n if (name.startsWith(\"__\")) continue;\n\n if (type.kind === \"INPUT_OBJECT\" && type.inputFields) {\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n for (const field of type.inputFields) {\n const schema = typeRefToJsonSchema(field.type, types);\n if (field.description) {\n (schema as Record<string, unknown>).description = field.description;\n }\n properties[field.name] = schema;\n if (isNonNull(field.type)) {\n required.push(field.name);\n }\n }\n\n const def: Record<string, unknown> = { type: \"object\", properties };\n if (required.length > 0) def.required = required;\n if (type.description) def.description = type.description;\n defs[name] = def;\n }\n\n if (type.kind === \"ENUM\" && type.enumValues) {\n defs[name] = {\n type: \"string\",\n enum: type.enumValues.map((v) => v.name),\n ...(type.description ? { description: type.description } : {}),\n };\n }\n }\n\n return defs;\n};\n\n// ---------------------------------------------------------------------------\n// Convert a type ref to JSON Schema using $ref for complex types\n// ---------------------------------------------------------------------------\n\nconst typeRefToJsonSchema = (\n ref: IntrospectionTypeRef,\n // oxlint-disable-next-line only-used-in-recursion\n types: ReadonlyMap<string, IntrospectionType>,\n): Record<string, unknown> =>\n Match.value(ref.kind).pipe(\n Match.when(\n \"NON_NULL\",\n (): Record<string, unknown> => (ref.ofType ? typeRefToJsonSchema(ref.ofType, types) : {}),\n ),\n Match.when(\n \"LIST\",\n (): Record<string, unknown> => ({\n type: \"array\",\n items: ref.ofType ? typeRefToJsonSchema(ref.ofType, types) : {},\n }),\n ),\n Match.when(\"SCALAR\", (): Record<string, unknown> => scalarToJsonSchema(ref.name ?? \"String\")),\n Match.when(\n \"ENUM\",\n (): Record<string, unknown> =>\n ref.name ? { $ref: `#/$defs/${ref.name}` } : { type: \"string\" },\n ),\n Match.when(\n \"INPUT_OBJECT\",\n (): Record<string, unknown> =>\n ref.name ? { $ref: `#/$defs/${ref.name}` } : { type: \"object\" },\n ),\n Match.whenOr(\n \"OBJECT\",\n \"INTERFACE\",\n \"UNION\",\n (): Record<string, unknown> => ({ type: \"object\" }),\n ),\n Match.option,\n Option.getOrElse((): Record<string, unknown> => ({})),\n );\n\nconst scalarToJsonSchema = (name: string): Record<string, unknown> =>\n Match.value(name).pipe(\n Match.whenOr(\"String\", \"ID\", (): Record<string, unknown> => ({ type: \"string\" })),\n Match.when(\"Int\", (): Record<string, unknown> => ({ type: \"integer\" })),\n Match.when(\"Float\", (): Record<string, unknown> => ({ type: \"number\" })),\n Match.when(\"Boolean\", (): Record<string, unknown> => ({ type: \"boolean\" })),\n Match.option,\n Option.getOrElse(\n (): Record<string, unknown> => ({ type: \"string\", description: `Custom scalar: ${name}` }),\n ),\n );\n\n// ---------------------------------------------------------------------------\n// Build input JSON Schema from field arguments\n// ---------------------------------------------------------------------------\n\nconst buildInputSchema = (\n args: readonly IntrospectionInputValue[],\n types: ReadonlyMap<string, IntrospectionType>,\n): Record<string, unknown> | undefined => {\n if (args.length === 0) return undefined;\n\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n for (const arg of args) {\n const schema = typeRefToJsonSchema(arg.type, types);\n if (arg.description) {\n (schema as Record<string, unknown>).description = arg.description;\n }\n properties[arg.name] = schema;\n if (isNonNull(arg.type)) {\n required.push(arg.name);\n }\n }\n\n const inputSchema: Record<string, unknown> = {\n type: \"object\",\n properties,\n };\n if (required.length > 0) inputSchema.required = required;\n return inputSchema;\n};\n\n/** Format a type ref back to GraphQL type notation (e.g. \"[String!]!\") */\nconst formatTypeRef = (ref: IntrospectionTypeRef): string =>\n Match.value(ref.kind).pipe(\n Match.when(\"NON_NULL\", () => (ref.ofType ? `${formatTypeRef(ref.ofType)}!` : \"Unknown!\")),\n Match.when(\"LIST\", () => (ref.ofType ? `[${formatTypeRef(ref.ofType)}]` : \"[Unknown]\")),\n Match.option,\n Option.getOrElse(() => ref.name ?? \"Unknown\"),\n );\n\n// ---------------------------------------------------------------------------\n// Extract fields from schema\n// ---------------------------------------------------------------------------\n\nconst extractFields = (\n _schema: IntrospectionSchema,\n kind: GraphqlOperationKind,\n typeName: string | null | undefined,\n types: ReadonlyMap<string, IntrospectionType>,\n): ExtractedField[] => {\n if (!typeName) return [];\n\n const type = types.get(typeName);\n if (!type?.fields) return [];\n\n return type.fields\n .filter((f) => !f.name.startsWith(\"__\"))\n .map((field) => {\n const args = field.args.map((arg) =>\n GraphqlArgument.make({\n name: arg.name,\n typeName: formatTypeRef(arg.type),\n required: isNonNull(arg.type),\n description: arg.description ? Option.some(arg.description) : Option.none(),\n }),\n );\n\n const inputSchema = buildInputSchema(field.args, types);\n\n return ExtractedField.make({\n fieldName: field.name,\n kind,\n description: field.description ? Option.some(field.description) : Option.none(),\n arguments: args,\n inputSchema: inputSchema ? Option.some(inputSchema) : Option.none(),\n returnTypeName: unwrapTypeName(field.type),\n });\n });\n};\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\nexport interface ExtractionOutput {\n readonly result: ExtractionResult;\n /** Shared JSON Schema definitions for INPUT_OBJECT and ENUM types.\n * Tool input schemas use `$ref` pointers into these. */\n readonly definitions: Record<string, unknown>;\n}\n\nexport const extract = (\n introspection: IntrospectionResult,\n): Effect.Effect<ExtractionOutput, GraphqlExtractionError> =>\n Effect.try({\n try: () => {\n const schema = introspection.__schema;\n const typeMap = new Map<string, IntrospectionType>();\n for (const t of schema.types) {\n typeMap.set(t.name, t);\n }\n\n const definitions = buildDefinitions(typeMap);\n\n const queryFields = extractFields(schema, \"query\", schema.queryType?.name, typeMap);\n const mutationFields = extractFields(schema, \"mutation\", schema.mutationType?.name, typeMap);\n\n return {\n result: ExtractionResult.make({\n schemaName: Option.none(),\n fields: [...queryFields, ...mutationFields],\n }),\n definitions,\n };\n },\n catch: () =>\n new GraphqlExtractionError({\n message: \"Failed to extract GraphQL schema\",\n }),\n });\n","import { Effect, Layer, Option } from \"effect\";\nimport { HttpClient, HttpClientRequest } from \"effect/unstable/http\";\n\nimport { GraphqlInvocationError } from \"./errors\";\nimport { type OperationBinding, InvocationResult } from \"./types\";\n\nconst endpointWithQueryParams = (endpoint: string, queryParams: Record<string, string>): string => {\n if (Object.keys(queryParams).length === 0) return endpoint;\n const url = new URL(endpoint);\n for (const [name, value] of Object.entries(queryParams)) {\n url.searchParams.set(name, value);\n }\n return url.toString();\n};\n\nexport const endpointForTelemetry = (endpoint: string): string => {\n if (!URL.canParse(endpoint)) return endpoint;\n const url = new URL(endpoint);\n url.search = \"\";\n url.hash = \"\";\n return url.toString();\n};\n\n// ---------------------------------------------------------------------------\n// Response helpers\n// ---------------------------------------------------------------------------\n\nconst isJsonContentType = (ct: string | null | undefined): boolean => {\n if (!ct) return false;\n const normalized = ct.split(\";\")[0]?.trim().toLowerCase() ?? \"\";\n return (\n normalized === \"application/json\" || normalized.includes(\"+json\") || normalized.includes(\"json\")\n );\n};\n\n// ---------------------------------------------------------------------------\n// Public API — execute a GraphQL operation\n// ---------------------------------------------------------------------------\n\nexport const invoke = Effect.fn(\"GraphQL.invoke\")(function* (\n operation: OperationBinding,\n args: Record<string, unknown>,\n endpoint: string,\n resolvedHeaders: Record<string, string>,\n resolvedQueryParams: Record<string, string> = {},\n) {\n const client = yield* HttpClient.HttpClient;\n const requestEndpoint = endpointWithQueryParams(endpoint, resolvedQueryParams);\n const telemetryEndpoint = endpointForTelemetry(endpoint);\n\n yield* Effect.annotateCurrentSpan({\n \"http.method\": \"POST\",\n \"http.url\": telemetryEndpoint,\n \"plugin.graphql.endpoint\": telemetryEndpoint,\n \"plugin.graphql.operation_kind\": operation.kind,\n \"plugin.graphql.field_name\": operation.fieldName,\n \"plugin.graphql.headers.resolved_count\": Object.keys(resolvedHeaders).length,\n \"plugin.graphql.query_params.resolved_count\": Object.keys(resolvedQueryParams).length,\n });\n\n // Build the GraphQL request body\n const variables: Record<string, unknown> = {};\n for (const varName of operation.variableNames) {\n if (args[varName] !== undefined) {\n variables[varName] = args[varName];\n }\n }\n\n // Also pick up any variables from a \"variables\" container\n if (typeof args.variables === \"object\" && args.variables !== null) {\n Object.assign(variables, args.variables);\n }\n\n let request = HttpClientRequest.post(requestEndpoint).pipe(\n HttpClientRequest.setHeader(\"Content-Type\", \"application/json\"),\n HttpClientRequest.bodyJsonUnsafe({\n query: operation.operationString,\n variables: Object.keys(variables).length > 0 ? variables : undefined,\n }),\n );\n\n for (const [name, value] of Object.entries(resolvedHeaders)) {\n request = HttpClientRequest.setHeader(request, name, value);\n }\n\n const response = yield* client.execute(request).pipe(\n Effect.mapError(\n (err) =>\n new GraphqlInvocationError({\n message: \"GraphQL request failed\",\n statusCode: Option.none(),\n cause: err,\n }),\n ),\n );\n\n const status = response.status;\n const contentType = response.headers[\"content-type\"] ?? null;\n\n const body: unknown = isJsonContentType(contentType)\n ? yield* response.json.pipe(Effect.catch(() => response.text))\n : yield* response.text;\n\n // GraphQL responses are always 200 with { data, errors }\n const gqlBody = body as { data?: unknown; errors?: unknown[] } | null;\n const hasErrors = Array.isArray(gqlBody?.errors) && gqlBody.errors.length > 0;\n\n yield* Effect.annotateCurrentSpan({\n \"http.status_code\": status,\n \"plugin.graphql.has_errors\": hasErrors,\n \"plugin.graphql.error_count\": hasErrors ? gqlBody!.errors!.length : 0,\n });\n\n return InvocationResult.make({\n status,\n data: gqlBody?.data ?? null,\n errors: hasErrors ? gqlBody!.errors : null,\n });\n});\n\n// ---------------------------------------------------------------------------\n// Invoke a GraphQL operation with a provided HttpClient layer\n// ---------------------------------------------------------------------------\n\nexport const invokeWithLayer = (\n operation: OperationBinding,\n args: Record<string, unknown>,\n endpoint: string,\n resolvedHeaders: Record<string, string>,\n resolvedQueryParams: Record<string, string>,\n httpClientLayer: Layer.Layer<HttpClient.HttpClient>,\n) =>\n invoke(operation, args, endpoint, resolvedHeaders, resolvedQueryParams).pipe(\n Effect.provide(httpClientLayer),\n Effect.withSpan(\"plugin.graphql.invoke\", {\n attributes: {\n \"plugin.graphql.endpoint\": endpointForTelemetry(endpoint),\n \"plugin.graphql.operation_kind\": operation.kind,\n \"plugin.graphql.field_name\": operation.fieldName,\n },\n }),\n );\n","import { Effect, Option, Predicate, Schema } from \"effect\";\n\nimport {\n type Owner,\n type PluginStorageEntry,\n type StorageDeps,\n type StorageFailure,\n} from \"@executor-js/sdk/core\";\n\nimport { OperationBinding } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Per-integration operation bindings.\n//\n// In v2 the integration's GraphQL operations are derived from introspection and\n// are identical for every connection, so the plugin store keeps one set of\n// operation bindings per integration slug — `invokeTool` reads them back to\n// rebuild the request. Operations are catalog-level metadata, so they live under\n// the shared `owner: \"org\"` partition.\n// ---------------------------------------------------------------------------\n\nconst CATALOG_OWNER: Owner = \"org\";\nconst OPERATION_COLLECTION = \"operation\";\n\nexport interface StoredOperation {\n /** The tool's leaf name, e.g. `query.hello`. */\n readonly toolName: string;\n /** The owning integration slug. */\n readonly integration: string;\n readonly binding: OperationBinding;\n}\n\nconst OperationBindingFromJsonString = Schema.fromJsonString(OperationBinding);\nconst decodeOperationBindingFromJsonString = Schema.decodeUnknownSync(\n OperationBindingFromJsonString,\n);\nconst decodeOperationBinding = Schema.decodeUnknownSync(OperationBinding);\nconst encodeBinding = Schema.encodeSync(OperationBinding);\n\nconst decodeBinding = (value: unknown): OperationBinding => {\n if (typeof value === \"string\") return decodeOperationBindingFromJsonString(value);\n return decodeOperationBinding(value);\n};\n\nconst toJsonRecord = (value: unknown): Record<string, unknown> => value as Record<string, unknown>;\n\nconst OperationStorage = Schema.Struct({\n toolName: Schema.String,\n integration: Schema.String,\n binding: Schema.Unknown,\n});\nconst decodeOperationStorage = Schema.decodeUnknownOption(OperationStorage);\n\nconst operationKey = (integration: string, toolName: string): string =>\n `${integration}.${toolName}`;\n\nconst operationData = (operation: StoredOperation) => ({\n toolName: operation.toolName,\n integration: operation.integration,\n binding: toJsonRecord(encodeBinding(operation.binding)),\n});\n\nconst rowToOperation = (row: PluginStorageEntry): StoredOperation | null => {\n const decoded = decodeOperationStorage(row.data);\n if (Option.isNone(decoded)) return null;\n const operation = decoded.value;\n return {\n toolName: operation.toolName,\n integration: operation.integration,\n binding: decodeBinding(operation.binding),\n };\n};\n\n/** Blob key for an introspection snapshot's content hash. Content-addressed\n * so re-puts are idempotent and identical schemas share one blob per\n * partition. */\nexport const introspectionBlobKey = (introspectionHash: string): string =>\n `introspection/${introspectionHash}`;\n\nexport interface GraphqlStore {\n /** Replace the stored operation bindings for an integration. */\n readonly replaceOperations: (\n integration: string,\n operations: readonly StoredOperation[],\n ) => Effect.Effect<void, StorageFailure>;\n readonly getOperation: (\n integration: string,\n toolName: string,\n ) => Effect.Effect<StoredOperation | null, StorageFailure>;\n readonly listOperations: (\n integration: string,\n ) => Effect.Effect<readonly StoredOperation[], StorageFailure>;\n readonly removeOperations: (integration: string) => Effect.Effect<void, StorageFailure>;\n /** Persist an introspection JSON snapshot under its content hash. Org-owned\n * and content-addressed; never removed on integration removal because\n * another integration in the tenant may share the hash. */\n readonly putIntrospection: (\n introspectionHash: string,\n introspectionJson: string,\n ) => Effect.Effect<void, StorageFailure>;\n /** Load an introspection snapshot by content hash; null when absent. */\n readonly getIntrospection: (\n introspectionHash: string,\n ) => Effect.Effect<string | null, StorageFailure>;\n}\n\nexport const makeDefaultGraphqlStore = ({ pluginStorage, blobs }: StorageDeps): GraphqlStore => {\n const listOperationRows = (integration: string) =>\n pluginStorage\n .list({\n collection: OPERATION_COLLECTION,\n keyPrefix: `${integration}.`,\n })\n .pipe(\n Effect.map((rows) =>\n rows.filter((row) => rowToOperation(row)?.integration === integration),\n ),\n );\n\n const removeOperations = (integration: string) =>\n Effect.gen(function* () {\n const rows = yield* listOperationRows(integration);\n for (const row of rows) {\n yield* pluginStorage.remove({\n owner: CATALOG_OWNER,\n collection: OPERATION_COLLECTION,\n key: row.key,\n });\n }\n });\n\n return {\n replaceOperations: (integration, operations) =>\n Effect.gen(function* () {\n yield* removeOperations(integration);\n for (const operation of operations) {\n yield* pluginStorage.put({\n owner: CATALOG_OWNER,\n collection: OPERATION_COLLECTION,\n key: operationKey(integration, operation.toolName),\n data: operationData(operation),\n });\n }\n }),\n\n getOperation: (integration, toolName) =>\n pluginStorage\n .get({ collection: OPERATION_COLLECTION, key: operationKey(integration, toolName) })\n .pipe(Effect.map((row) => (row ? rowToOperation(row) : null))),\n\n listOperations: (integration) =>\n listOperationRows(integration).pipe(\n Effect.map((rows) => rows.map(rowToOperation).filter(Predicate.isNotNull)),\n ),\n\n removeOperations,\n\n putIntrospection: (introspectionHash, introspectionJson) =>\n blobs.put(introspectionBlobKey(introspectionHash), introspectionJson, {\n owner: CATALOG_OWNER,\n }),\n\n getIntrospection: (introspectionHash) => blobs.get(introspectionBlobKey(introspectionHash)),\n };\n};\n","import { Effect, Match, Option, Schema } from \"effect\";\nimport type { Layer } from \"effect\";\nimport { FetchHttpClient, HttpClient } from \"effect/unstable/http\";\n\nimport {\n authToolFailure,\n AuthTemplateSlug,\n definePlugin,\n IntegrationAlreadyExistsError,\n IntegrationDetectionResult,\n IntegrationSlug,\n mergeAuthTemplates,\n sha256Hex,\n ToolName,\n ToolResult,\n type AuthMethodDescriptor,\n type IntegrationConfig,\n type IntegrationRecord,\n type PluginCtx,\n type StorageFailure,\n type ToolAnnotations,\n type ToolDef,\n} from \"@executor-js/sdk/core\";\n\nimport {\n TOKEN_VARIABLE,\n describeApiKeyAuthMethod,\n describeNoneAuthMethod,\n oauthBearerPlacement,\n renderAuthPlacements,\n requiredPlacementVariables,\n type RenderedAuthPlacements,\n} from \"@executor-js/sdk/http-auth\";\n\nimport {\n introspect,\n parseIntrospectionJson,\n type IntrospectionResult,\n type IntrospectionType,\n type IntrospectionField,\n type IntrospectionTypeRef,\n} from \"./introspect\";\nimport { extract } from \"./extract\";\nimport {\n GraphqlAuthRequiredError,\n GraphqlIntrospectionError,\n GraphqlInvocationError,\n} from \"./errors\";\nimport { invokeWithLayer } from \"./invoke\";\nimport { graphqlPresets } from \"./presets\";\nimport { makeDefaultGraphqlStore, type GraphqlStore, type StoredOperation } from \"./store\";\nimport {\n GraphqlAuthMethodInput,\n decodeGraphqlIntegrationConfig,\n decodeGraphqlIntegrationConfigOption,\n ExtractedField,\n GraphqlIntegrationConfig,\n expandGraphqlAuthMethodInputs,\n normalizeGraphqlAuthMethods,\n OperationBinding,\n type GraphqlAuthMethod,\n type GraphqlOperationKind,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// GraphQL error-body decoding (for invocation responses)\n// ---------------------------------------------------------------------------\n\nconst GraphqlErrorBody = Schema.Struct({ message: Schema.String });\nconst GraphqlErrorsBody = Schema.Array(Schema.Unknown);\nconst decodeGraphqlErrorBody = Schema.decodeUnknownOption(GraphqlErrorBody);\nconst decodeGraphqlErrorsBody = Schema.decodeUnknownOption(GraphqlErrorsBody);\n\nconst decodeGraphqlErrors = (errors: unknown): readonly unknown[] | undefined =>\n Option.getOrUndefined(decodeGraphqlErrorsBody(errors));\n\nconst extractGraphqlErrorMessage = (errors: readonly unknown[]): string | undefined =>\n errors\n .map((error) => Option.getOrUndefined(decodeGraphqlErrorBody(error))?.message)\n .find((message) => message !== undefined && message.length > 0);\n\nconst GRAPHQL_PLUGIN_ID = \"graphql\";\n\n// ---------------------------------------------------------------------------\n// Extension input shapes\n// ---------------------------------------------------------------------------\n\n/** Register a GraphQL integration in the catalog. `endpoint` is the GraphQL URL;\n * `slug` (defaulted from the endpoint) is the catalog id; `introspectionJson`\n * supplies the schema when the endpoint disables live introspection; `headers`\n * / `queryParams` are static and also applied to add-time introspection;\n * `authenticationTemplate` declares the auth methods a connection can apply\n * through. */\nconst GraphqlAddIntegrationInputSchema = Schema.Struct({\n endpoint: Schema.String,\n slug: Schema.optional(Schema.String),\n name: Schema.optional(Schema.String),\n introspectionJson: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n authenticationTemplate: Schema.optional(Schema.Array(GraphqlAuthMethodInput)),\n});\nexport type GraphqlAddIntegrationInput = typeof GraphqlAddIntegrationInputSchema.Type;\n\nconst GraphqlConfigureInputSchema = Schema.Struct({\n name: Schema.optional(Schema.String),\n endpoint: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n authenticationTemplate: Schema.optional(Schema.Array(GraphqlAuthMethodInput)),\n});\nexport type GraphqlConfigureInput = typeof GraphqlConfigureInputSchema.Type;\n\n/** Input for the custom-method-create flow (HTTP `POST /graphql/integrations/\n * :slug/config`). Unlike `configure` (which REPLACES the whole config for the\n * generic repair path), `configureAuth` MERGE-APPENDS these methods onto the\n * integration's existing `authenticationTemplate`, mirroring OpenAPI's\n * `configure`. */\nconst GraphqlConfigureAuthInputSchema = Schema.Struct({\n authenticationTemplate: Schema.Array(GraphqlAuthMethodInput),\n mode: Schema.optional(Schema.Literals([\"merge\", \"replace\"])),\n});\nexport type GraphqlConfigureAuthInput = typeof GraphqlConfigureAuthInputSchema.Type;\n\n// ---------------------------------------------------------------------------\n// Static control-tool schemas\n// ---------------------------------------------------------------------------\n\nconst StaticAddIntegrationOutputSchema = Schema.Struct({\n slug: Schema.String,\n name: Schema.String,\n});\nconst StaticGetIntegrationInputSchema = Schema.Struct({\n slug: Schema.String,\n});\nconst StaticGetIntegrationOutputSchema = Schema.Struct({\n integration: Schema.NullOr(Schema.Unknown),\n});\n\nconst StaticAddIntegrationInputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(GraphqlAddIntegrationInputSchema),\n);\nconst StaticAddIntegrationOutputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(StaticAddIntegrationOutputSchema),\n);\nconst StaticGetIntegrationInputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(StaticGetIntegrationInputSchema),\n);\nconst StaticGetIntegrationOutputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(StaticGetIntegrationOutputSchema),\n);\n\nconst graphqlToolFailure = (code: string, message: string, details?: unknown) =>\n ToolResult.fail({\n code,\n message,\n ...(details === undefined ? {} : { details }),\n });\n\nconst graphqlAuthToolFailure = (failure: GraphqlAuthRequiredError) =>\n authToolFailure({\n code: failure.code,\n message: failure.message,\n source: { id: failure.integration, scope: failure.owner },\n credential: {\n kind: failure.credentialKind,\n ...(failure.credentialLabel ? { label: failure.credentialLabel } : {}),\n connectionId: failure.connection,\n },\n ...(failure.status !== undefined ? { status: failure.status } : {}),\n ...(failure.details !== undefined\n ? {\n upstream: {\n ...(failure.status !== undefined ? { status: failure.status } : {}),\n details: failure.details,\n },\n }\n : {}),\n });\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/** Match `token` as a separator-bounded run inside a URL hostname or path,\n * used as a low-confidence detection hint when introspection fails. */\nconst urlMatchesToken = (url: URL, token: string): boolean => {\n const re = new RegExp(`(?:^|[^a-z0-9])${token}(?:$|[^a-z0-9])`, \"i\");\n return re.test(url.hostname) || re.test(url.pathname);\n};\n\n/** Derive an integration slug from an endpoint URL. */\nconst slugFromEndpoint = (endpoint: string): string => {\n // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: URL construction throws; this helper intentionally falls back to the stable default slug\n try {\n const url = new URL(endpoint);\n return url.hostname.replace(/[^a-z0-9]+/gi, \"_\").toLowerCase();\n } catch {\n return \"graphql\";\n }\n};\n\nconst formatTypeRef = (ref: IntrospectionTypeRef): string =>\n Match.value(ref.kind).pipe(\n Match.when(\"NON_NULL\", () => (ref.ofType ? `${formatTypeRef(ref.ofType)}!` : \"Unknown!\")),\n Match.when(\"LIST\", () => (ref.ofType ? `[${formatTypeRef(ref.ofType)}]` : \"[Unknown]\")),\n Match.option,\n Option.getOrElse(() => ref.name ?? \"Unknown\"),\n );\n\nconst unwrapTypeName = (ref: IntrospectionTypeRef): string => {\n if (ref.name) return ref.name;\n if (ref.ofType) return unwrapTypeName(ref.ofType);\n return \"Unknown\";\n};\n\nconst buildSelectionSet = (\n ref: IntrospectionTypeRef,\n types: ReadonlyMap<string, IntrospectionType>,\n depth: number,\n seen: Set<string>,\n): string => {\n if (depth > 2) return \"\";\n\n const leafName = unwrapTypeName(ref);\n if (seen.has(leafName)) return \"\";\n\n const objectType = types.get(leafName);\n if (!objectType?.fields) return \"\";\n\n const kind = objectType.kind;\n if (kind === \"SCALAR\" || kind === \"ENUM\") return \"\";\n\n seen.add(leafName);\n\n const subFields = objectType.fields\n .filter((f: IntrospectionField) => !f.name.startsWith(\"__\"))\n .slice(0, 12)\n .map((f: IntrospectionField) => {\n const sub = buildSelectionSet(f.type, types, depth + 1, seen);\n return sub ? `${f.name} ${sub}` : f.name;\n });\n\n seen.delete(leafName);\n\n return subFields.length > 0 ? `{ ${subFields.join(\" \")} }` : \"\";\n};\n\n// Name every generated operation: some servers reject anonymous operations, and\n// APM tooling keys traces off the operation name. Field names are already valid\n// GraphQL name tokens, so the upper-cased field name is a safe operation name.\nconst operationNameForField = (fieldName: string): string =>\n fieldName.charAt(0).toUpperCase() + fieldName.slice(1);\n\nconst buildOperationStringForField = (\n kind: GraphqlOperationKind,\n field: IntrospectionField,\n types: ReadonlyMap<string, IntrospectionType>,\n): string => {\n const opType = kind === \"query\" ? \"query\" : \"mutation\";\n const opName = operationNameForField(field.name);\n\n const varDefs = field.args.map((arg) => {\n const typeName = formatTypeRef(arg.type);\n return `$${arg.name}: ${typeName}`;\n });\n\n const argPasses = field.args.map((arg) => `${arg.name}: $${arg.name}`);\n const selectionSet = buildSelectionSet(field.type, types, 0, new Set());\n\n const varDefsStr = varDefs.length > 0 ? `(${varDefs.join(\", \")})` : \"\";\n const argPassStr = argPasses.length > 0 ? `(${argPasses.join(\", \")})` : \"\";\n\n return `${opType} ${opName}${varDefsStr} { ${field.name}${argPassStr}${selectionSet ? ` ${selectionSet}` : \"\"} }`;\n};\n\ninterface PreparedOperation {\n readonly toolName: string;\n readonly description: string;\n readonly inputSchema: unknown;\n readonly binding: OperationBinding;\n}\n\nconst prepareOperations = (\n fields: readonly ExtractedField[],\n introspection: IntrospectionResult,\n): readonly PreparedOperation[] => {\n const typeMap = new Map<string, IntrospectionType>();\n for (const t of introspection.__schema.types) {\n typeMap.set(t.name, t);\n }\n\n const fieldMap = new Map<string, { kind: GraphqlOperationKind; field: IntrospectionField }>();\n const schema = introspection.__schema;\n for (const rootKind of [\"query\", \"mutation\"] as const) {\n const typeName = rootKind === \"query\" ? schema.queryType?.name : schema.mutationType?.name;\n if (!typeName) continue;\n const rootType = typeMap.get(typeName);\n if (!rootType?.fields) continue;\n for (const f of rootType.fields) {\n if (!f.name.startsWith(\"__\")) {\n fieldMap.set(`${rootKind}.${f.name}`, { kind: rootKind, field: f });\n }\n }\n }\n\n return fields.map((extracted) => {\n const prefix = extracted.kind === \"mutation\" ? \"mutation\" : \"query\";\n // A tool's name keeps its `<kind>.<field>` path (e.g. `query.hello`,\n // `mutation.setGreeting`). The address grammar treats `<tool>` as the\n // trailing remainder (see parseToolAddress), so the dot nests naturally.\n const toolName = `${prefix}.${extracted.fieldName}`;\n const description = Option.getOrElse(\n extracted.description,\n () => `GraphQL ${extracted.kind}: ${extracted.fieldName} -> ${extracted.returnTypeName}`,\n );\n\n const key = `${extracted.kind}.${extracted.fieldName}`;\n const entry = fieldMap.get(key);\n const operationString = entry\n ? buildOperationStringForField(entry.kind, entry.field, typeMap)\n : `${extracted.kind} ${operationNameForField(extracted.fieldName)} { ${extracted.fieldName} }`;\n\n const binding = OperationBinding.make({\n kind: extracted.kind,\n fieldName: extracted.fieldName,\n operationString,\n variableNames: extracted.arguments.map((a) => a.name),\n });\n\n return {\n toolName,\n description,\n inputSchema: Option.getOrUndefined(extracted.inputSchema),\n binding,\n };\n });\n};\n\nconst annotationsFor = (binding: OperationBinding): ToolAnnotations => {\n if (binding.kind === \"mutation\") {\n return {\n requiresApproval: true,\n approvalDescription: `mutation ${binding.fieldName}`,\n };\n }\n return {};\n};\n\n// ---------------------------------------------------------------------------\n// Auth method rendering (D11) — apply the connection's resolved values through\n// the method the connection references. An oauth2 method is the conventional\n// bearer placement (with the method's optional header/prefix override) over\n// the resolved access token; an apikey method renders its declared placements.\n// ---------------------------------------------------------------------------\n\nconst renderGraphqlAuthMethod = (\n method: GraphqlAuthMethod,\n values: Record<string, string | null>,\n): RenderedAuthPlacements => {\n if (method.kind === \"apikey\") return renderAuthPlacements(method.placements, values);\n if (method.kind === \"oauth2\") {\n return renderAuthPlacements([oauthBearerPlacement(method.header, method.prefix)], values);\n }\n return { headers: {}, queryParams: {} };\n};\n\n// ---------------------------------------------------------------------------\n// Introspection — produce operations from a config (live or stored JSON).\n// ---------------------------------------------------------------------------\n\nconst buildToolDefs = (prepared: readonly PreparedOperation[]): readonly ToolDef[] =>\n prepared.map((p) => ({\n name: ToolName.make(p.toolName),\n description: p.description,\n inputSchema: p.inputSchema,\n annotations: annotationsFor(p.binding),\n }));\n\nconst toStoredOperations = (\n slug: IntegrationSlug,\n prepared: readonly PreparedOperation[],\n): StoredOperation[] =>\n prepared.map((p) => ({\n toolName: p.toolName,\n integration: String(slug),\n binding: p.binding,\n }));\n\n/** Render an integration's static + resolved-credential auth onto introspection\n * headers/query params. Connection-create / tool-generation introspection runs\n * with the connection's credential (exactly how its tools are invoked), so an\n * auth-required endpoint introspects successfully here rather than at add-time. */\nconst introspectHeadersForConnection = (\n config: GraphqlIntegrationConfig,\n values: Record<string, string | null>,\n templateSlug: AuthTemplateSlug | null,\n): RenderedAuthPlacements => {\n const headers: Record<string, string> = { ...(config.headers ?? {}) };\n const queryParams: Record<string, string> = { ...(config.queryParams ?? {}) };\n // Render the exact method the connection references; with no slug\n // (connection row not yet persisted) fall back to the first declared.\n const method =\n (templateSlug !== null\n ? config.authenticationTemplate.find(\n (m: GraphqlAuthMethod) => m.slug === String(templateSlug),\n )\n : undefined) ?? config.authenticationTemplate[0];\n if (method) {\n const rendered = renderGraphqlAuthMethod(method, values);\n Object.assign(headers, rendered.headers);\n Object.assign(queryParams, rendered.queryParams);\n }\n return { headers, queryParams };\n};\n\n/** Resolve a config's introspection snapshot text from the plugin blob store\n * (`introspectionHash`). Null when the integration has no snapshot (live\n * introspection territory). Pre-blob rows that inlined the JSON are\n * rewritten by the introspection-to-blob migrations before this code reads\n * them. */\nconst loadIntrospectionJson = (\n storage: GraphqlStore,\n config: GraphqlIntegrationConfig,\n): Effect.Effect<string | null, StorageFailure> =>\n config.introspectionHash != null\n ? storage.getIntrospection(config.introspectionHash)\n : Effect.succeed(null);\n\n/** Introspect a config live or from its stored snapshot, applying connection\n * auth. A non-null `introspectionJson` (loaded via `loadIntrospectionJson`)\n * short-circuits the network; otherwise this introspects the endpoint with\n * the rendered credential. */\nconst introspectForConnection = (\n config: GraphqlIntegrationConfig,\n introspectionJson: string | null,\n values: Record<string, string | null>,\n templateSlug: AuthTemplateSlug | null,\n httpClientLayer: Layer.Layer<HttpClient.HttpClient>,\n): Effect.Effect<IntrospectionResult, GraphqlIntrospectionError> => {\n if (introspectionJson != null) {\n return parseIntrospectionJson(introspectionJson);\n }\n const auth = introspectHeadersForConnection(config, values, templateSlug);\n return introspect(\n config.endpoint,\n Object.keys(auth.headers).length > 0 ? auth.headers : undefined,\n Object.keys(auth.queryParams).length > 0 ? auth.queryParams : undefined,\n ).pipe(Effect.provide(httpClientLayer));\n};\n\n/** Introspect an integration's endpoint (with this connection's credential),\n * prepare its operations, persist the bindings, and return them. Invoked from\n * `invokeTool` on a cache miss — i.e. when an integration was registered\n * without an add-time schema and its bindings haven't been produced yet. */\nconst materializeOperations = (\n ctx: PluginCtx<GraphqlStore>,\n integration: string,\n config: GraphqlIntegrationConfig,\n credential: {\n readonly template: AuthTemplateSlug;\n readonly values: Record<string, string | null>;\n },\n httpClientLayer: Layer.Layer<HttpClient.HttpClient>,\n): Effect.Effect<readonly StoredOperation[], GraphqlIntrospectionError | StorageFailure> =>\n Effect.gen(function* () {\n // Render the exact method this connection references (we have its slug\n // here, unlike `resolveTools`) so an auth-required endpoint introspects.\n const method = config.authenticationTemplate.find(\n (m: GraphqlAuthMethod) => m.slug === String(credential.template),\n );\n const headers: Record<string, string> = { ...(config.headers ?? {}) };\n const queryParams: Record<string, string> = {\n ...(config.queryParams ?? {}),\n };\n if (method) {\n const rendered = renderGraphqlAuthMethod(method, credential.values);\n Object.assign(headers, rendered.headers);\n Object.assign(queryParams, rendered.queryParams);\n }\n\n const introspectionJson = yield* loadIntrospectionJson(ctx.storage, config);\n const introspection =\n introspectionJson != null\n ? yield* parseIntrospectionJson(introspectionJson)\n : yield* introspect(\n config.endpoint,\n Object.keys(headers).length > 0 ? headers : undefined,\n Object.keys(queryParams).length > 0 ? queryParams : undefined,\n ).pipe(Effect.provide(httpClientLayer));\n\n const { result } = yield* extract(introspection).pipe(\n Effect.catch(() =>\n Effect.succeed({\n result: { fields: [] as readonly ExtractedField[] },\n } as {\n readonly result: { readonly fields: readonly ExtractedField[] };\n }),\n ),\n );\n const prepared = prepareOperations(result.fields, introspection);\n const stored = toStoredOperations(IntegrationSlug.make(integration), prepared);\n yield* ctx.storage.replaceOperations(integration, stored);\n return stored;\n });\n\n// ---------------------------------------------------------------------------\n// Declared auth methods — project the stored `authenticationTemplate` into the\n// catalog's plugin-agnostic `AuthMethodDescriptor[]`. Pure/sync and tolerant of\n// a malformed or foreign config blob (returns `[]`). GraphQL has no accounts\n// slot of its own, so this projection is what surfaces declared + custom methods\n// through the catalog's `authMethods` to the hub / Add-account flows. Exported\n// for tests.\n//\n// none → a no-auth method carrying no credential inputs\n// apikey → carried placements (headers / query params) verbatim\n// oauth2 → one oauth method (no resolved endpoints; graphql renders the\n// connection value as a bearer at invoke time).\n// ---------------------------------------------------------------------------\n\nexport const describeGraphqlAuthMethods = (\n record: IntegrationRecord,\n): readonly AuthMethodDescriptor[] => {\n const config = Option.getOrUndefined(decodeGraphqlIntegrationConfigOption(record.config));\n if (!config) return [];\n return config.authenticationTemplate.map((method: GraphqlAuthMethod): AuthMethodDescriptor => {\n if (method.kind === \"apikey\") return describeApiKeyAuthMethod(method);\n if (method.kind === \"oauth2\") {\n return {\n id: method.slug,\n label: \"OAuth\",\n kind: \"oauth\",\n template: method.slug,\n oauth: {},\n };\n }\n return describeNoneAuthMethod(method.slug);\n });\n};\n\nexport const describeGraphqlIntegrationDisplay = (\n record: IntegrationRecord,\n): { readonly url?: string } => {\n const config = Option.getOrUndefined(decodeGraphqlIntegrationConfigOption(record.config));\n return { url: config?.endpoint };\n};\n\n// ---------------------------------------------------------------------------\n// Plugin extension\n// ---------------------------------------------------------------------------\n\n// The extension only registers integrations (and parses any pre-supplied\n// introspection JSON offline). Live introspection — the only thing that needed\n// an HTTP layer — is deferred to `resolveTools` / `invokeTool`, so the extension\n// no longer takes one.\nconst makeGraphqlExtension = (ctx: PluginCtx<GraphqlStore>) => {\n const buildConfig = (input: GraphqlAddIntegrationInput): GraphqlIntegrationConfig =>\n GraphqlIntegrationConfig.make({\n endpoint: input.endpoint,\n name: input.name?.trim() || slugFromEndpoint(input.endpoint),\n ...(input.headers !== undefined ? { headers: input.headers } : {}),\n ...(input.queryParams !== undefined ? { queryParams: input.queryParams } : {}),\n authenticationTemplate: input.authenticationTemplate\n ? normalizeGraphqlAuthMethods(input.authenticationTemplate)\n : [],\n });\n\n /** Register the integration in the catalog. Registering a source is a\n * catalog statement (\"we use this GraphQL endpoint now\") and MUST NOT make a\n * network call or require auth — exactly like MCP defers discovery. Live\n * introspection (and the operation bindings it yields) is deferred to\n * connection-create / tool-generation (`resolveTools`) and tool invocation\n * (`invokeTool`), where a connection's credential is available.\n *\n * When the caller pre-supplies `introspectionJson`, the schema is already in\n * hand, so we parse it offline (no network) and persist the operation\n * bindings up front. */\n const addIntegrationInternal = (input: GraphqlAddIntegrationInput) =>\n Effect.gen(function* () {\n const slug = IntegrationSlug.make(input.slug ?? slugFromEndpoint(input.endpoint));\n\n // Block re-adding an existing slug. The core `integrations.register`\n // primitive upserts (so boot re-registration is idempotent), but an\n // explicit add must NOT silently clobber an existing integration's tools,\n // connections, and policies. To add more auth, update the existing one.\n const existing = yield* ctx.core.integrations.get(slug);\n if (existing) {\n return yield* new IntegrationAlreadyExistsError({ slug });\n }\n\n return yield* addIntegrationTransaction(input, slug);\n });\n\n const addIntegrationTransaction = (input: GraphqlAddIntegrationInput, slug: IntegrationSlug) =>\n Effect.gen(function* () {\n const baseConfig = buildConfig(input);\n\n // No pre-supplied schema → register WITHOUT introspecting. Tools (and\n // their operation bindings) are produced lazily when a connection is\n // created (`resolveTools`) / a tool is first invoked (`invokeTool`),\n // using that connection's credential.\n if (input.introspectionJson === undefined) {\n yield* ctx.transaction(\n ctx.core.integrations.register({\n slug,\n description: baseConfig.name,\n config: baseConfig,\n canRemove: true,\n canRefresh: true,\n }),\n );\n return { slug: String(slug), name: baseConfig.name, toolCount: 0 };\n }\n\n // Pre-supplied introspection JSON: parse it offline (no network) and\n // persist the operation bindings + snapshot so production stays offline.\n const introspection = yield* parseIntrospectionJson(input.introspectionJson);\n const { result } = yield* extract(introspection);\n const prepared = prepareOperations(result.fields, introspection);\n\n // Snapshot the resolved schema so tool production never needs a live\n // HTTP layer (D6: tools are spec-derived and identical per connection).\n // The snapshot text goes to the plugin blob store (content-addressed,\n // written OUTSIDE the transaction — re-puts are idempotent and an\n // aborted register leaves only an unreferenced blob), and the config\n // carries only its hash.\n const snapshotJson = JSON.stringify({ data: introspection });\n const introspectionHash = yield* sha256Hex(snapshotJson);\n const config = GraphqlIntegrationConfig.make({\n ...baseConfig,\n introspectionHash,\n });\n\n yield* ctx.storage.putIntrospection(introspectionHash, snapshotJson);\n\n yield* ctx.transaction(\n Effect.gen(function* () {\n yield* ctx.storage.replaceOperations(String(slug), toStoredOperations(slug, prepared));\n\n yield* ctx.core.integrations.register({\n slug,\n description: config.name,\n config,\n canRemove: true,\n canRefresh: true,\n });\n }),\n );\n\n return {\n slug: String(slug),\n name: config.name,\n toolCount: prepared.length,\n };\n });\n\n const configureIntegration = (slug: string, input: GraphqlConfigureInput) =>\n Effect.gen(function* () {\n const record = yield* ctx.core.integrations.get(IntegrationSlug.make(slug));\n if (!record) return;\n const current = Option.getOrElse(\n // best-effort: re-decode the stored config, falling back to an\n // endpoint-only config if it was never set.\n yield* decodeGraphqlIntegrationConfig(record.config).pipe(Effect.option),\n () =>\n GraphqlIntegrationConfig.make({\n endpoint: \"\",\n name: record.description,\n authenticationTemplate: [],\n }),\n );\n\n const next = GraphqlIntegrationConfig.make({\n endpoint: input.endpoint ?? current.endpoint,\n name: input.name?.trim() || current.name,\n ...(current.introspectionHash !== undefined\n ? { introspectionHash: current.introspectionHash }\n : {}),\n ...((input.headers ?? current.headers) !== undefined\n ? { headers: input.headers ?? current.headers }\n : {}),\n ...((input.queryParams ?? current.queryParams) !== undefined\n ? { queryParams: input.queryParams ?? current.queryParams }\n : {}),\n authenticationTemplate: input.authenticationTemplate\n ? normalizeGraphqlAuthMethods(input.authenticationTemplate)\n : current.authenticationTemplate,\n });\n\n yield* ctx.core.integrations.update(IntegrationSlug.make(slug), {\n description: next.name,\n config: next,\n });\n });\n\n /** Read the integration's decoded config (or `null` when absent / malformed).\n * Surfaces `authenticationTemplate` for the configure / custom-method UX. */\n const getConfig = (\n slug: string,\n ): Effect.Effect<GraphqlIntegrationConfig | null, StorageFailure> =>\n ctx.core.integrations\n .get(IntegrationSlug.make(slug))\n .pipe(\n Effect.map((record) =>\n record ? Option.getOrNull(decodeGraphqlIntegrationConfigOption(record.config)) : null,\n ),\n );\n\n /** Merge-append custom auth methods onto the integration's existing\n * `authenticationTemplate`. Returns the merged array. A no-op (returns `[]`)\n * for an unknown slug or undecodable config. */\n const configureAuthMethods = (\n slug: string,\n input: GraphqlConfigureAuthInput,\n ): Effect.Effect<readonly GraphqlAuthMethod[], StorageFailure> =>\n ctx.transaction(\n Effect.gen(function* () {\n const record = yield* ctx.core.integrations.get(IntegrationSlug.make(slug));\n if (!record) return [] as readonly GraphqlAuthMethod[];\n const current = Option.getOrNull(decodeGraphqlIntegrationConfigOption(record.config));\n if (!current) return [] as readonly GraphqlAuthMethod[];\n\n // Replace mode declares the full set — backfill kind-based slugs.\n // Merge mode appends: `mergeAuthTemplates` replaces on slug match and\n // assigns fresh `custom_<id>` slugs to slug-less entries, so a custom\n // method never silently displaces a declared one.\n const merged =\n input.mode === \"replace\"\n ? normalizeGraphqlAuthMethods(input.authenticationTemplate)\n : mergeAuthTemplates(\n current.authenticationTemplate,\n expandGraphqlAuthMethodInputs(\n input.authenticationTemplate,\n ) as readonly GraphqlAuthMethod[],\n );\n\n const next = GraphqlIntegrationConfig.make({\n ...current,\n authenticationTemplate: merged,\n });\n\n yield* ctx.core.integrations.update(IntegrationSlug.make(slug), {\n config: next,\n });\n\n return merged;\n }),\n );\n\n return {\n /** Register a GraphQL integration (introspects + persists operations). */\n addIntegration: (input: GraphqlAddIntegrationInput) => addIntegrationInternal(input),\n\n /** Read the integration's stored config. */\n getIntegration: (slug: string) =>\n ctx.core.integrations\n .get(IntegrationSlug.make(slug))\n .pipe(Effect.map((record) => (record ? record.config : null))),\n\n /** Read the integration's decoded config (auth templates surfaced). */\n getConfig,\n\n /** Merge-append custom auth methods (custom-method-create flow). */\n configureAuth: configureAuthMethods,\n\n removeIntegration: (slug: string) =>\n ctx.transaction(\n Effect.gen(function* () {\n yield* ctx.storage.removeOperations(slug);\n yield* ctx.core.integrations\n .remove(IntegrationSlug.make(slug))\n .pipe(Effect.catchTag(\"IntegrationRemovalNotAllowedError\", () => Effect.void));\n }),\n ),\n\n configure: configureIntegration,\n };\n};\n\nexport type GraphqlPluginExtension = ReturnType<typeof makeGraphqlExtension>;\n\n// ---------------------------------------------------------------------------\n// Plugin factory\n// ---------------------------------------------------------------------------\n\nexport interface GraphqlPluginOptions {\n readonly httpClientLayer?: Layer.Layer<HttpClient.HttpClient>;\n}\n\nexport const graphqlPlugin = definePlugin((options?: GraphqlPluginOptions) => {\n return {\n id: GRAPHQL_PLUGIN_ID as \"graphql\",\n packageName: \"@executor-js/plugin-graphql\",\n integrationPresets: graphqlPresets.map((preset) => ({\n id: preset.id,\n name: preset.name,\n summary: preset.summary,\n url: preset.url,\n endpoint: preset.endpoint,\n ...(preset.icon ? { icon: preset.icon } : {}),\n ...(preset.featured ? { featured: preset.featured } : {}),\n })),\n storage: (deps): GraphqlStore => makeDefaultGraphqlStore(deps),\n\n extension: (ctx: PluginCtx<GraphqlStore>) => makeGraphqlExtension(ctx),\n\n integrationConfigure: {\n type: \"graphql\",\n schema: GraphqlConfigureInputSchema,\n configure: ({ ctx, integration, config }) =>\n makeGraphqlExtension(ctx).configure(String(integration), config as GraphqlConfigureInput),\n },\n\n describeAuthMethods: describeGraphqlAuthMethods,\n describeIntegrationDisplay: describeGraphqlIntegrationDisplay,\n\n staticSources: (self: GraphqlPluginExtension) => [\n {\n id: \"graphql\",\n kind: \"executor\",\n name: \"GraphQL\",\n tools: [\n {\n name: \"getIntegration\",\n description:\n \"Inspect an existing GraphQL integration, including endpoint, static headers/query params, and auth templates. Use this before repairing an integration with `graphql.configure` or creating a connection.\",\n inputSchema: StaticGetIntegrationInputStandardSchema,\n outputSchema: StaticGetIntegrationOutputStandardSchema,\n handler: ({ args }) => {\n const input = args as typeof StaticGetIntegrationInputSchema.Type;\n return Effect.map(self.getIntegration(input.slug), (integration) =>\n ToolResult.ok({ integration }),\n );\n },\n },\n {\n name: \"addIntegration\",\n description:\n \"Add a GraphQL endpoint to the catalog and register its operations. Introspects the endpoint (or uses provided introspection JSON). After adding, create an owner-scoped connection against the integration to materialize its per-connection tools. For API keys / bearer tokens, declare an `authenticationTemplate` and create a connection whose value is the token.\",\n annotations: {\n requiresApproval: true,\n approvalDescription: \"Add a GraphQL integration\",\n },\n inputSchema: StaticAddIntegrationInputStandardSchema,\n outputSchema: StaticAddIntegrationOutputStandardSchema,\n handler: ({ args }) => {\n const input = args as GraphqlAddIntegrationInput;\n return self.addIntegration(input).pipe(\n Effect.map((result) => ToolResult.ok({ slug: result.slug, name: result.name })),\n Effect.catchTags({\n GraphqlIntrospectionError: ({ message }) =>\n Effect.succeed(graphqlToolFailure(\"graphql_introspection_failed\", message)),\n GraphqlExtractionError: ({ message }) =>\n Effect.succeed(graphqlToolFailure(\"graphql_extraction_failed\", message)),\n IntegrationAlreadyExistsError: ({ slug }: IntegrationAlreadyExistsError) =>\n Effect.succeed(\n graphqlToolFailure(\n \"integration_already_exists\",\n `Integration ${slug} already exists; update it instead of re-adding.`,\n ),\n ),\n }),\n );\n },\n },\n ],\n },\n ],\n\n // -----------------------------------------------------------------------\n // Per-connection tool production. THIS is where a GraphQL integration is\n // introspected — when a connection is created (or refreshed), with that\n // connection's credential — yielding one ToolDef per operation. Registering\n // the integration in the catalog makes no network call; discovery is\n // deferred to here, exactly how MCP defers tool discovery to connect time.\n // The introspected schema is identical across connections, so `invokeTool`\n // re-derives the same operation bindings; only the credential differs.\n // -----------------------------------------------------------------------\n resolveTools: ({\n config,\n template,\n storage,\n getValues,\n }: {\n readonly config: IntegrationConfig;\n readonly template: AuthTemplateSlug | null;\n readonly storage: GraphqlStore;\n readonly getValues: () => Effect.Effect<Record<string, string | null>, unknown>;\n }) =>\n Effect.gen(function* () {\n const decoded = yield* decodeGraphqlIntegrationConfig(config).pipe(Effect.option);\n if (Option.isNone(decoded)) return { tools: [] };\n const graphqlConfig = decoded.value;\n const introspectionJson = yield* loadIntrospectionJson(storage, graphqlConfig);\n // Live introspection (no stored snapshot) needs the connection's\n // credential inputs for auth-required endpoints; resolve them lazily.\n const values =\n introspectionJson == null\n ? yield* getValues().pipe(\n Effect.catch(() => Effect.succeed({} as Record<string, string | null>)),\n )\n : ({} as Record<string, string | null>);\n const introspection = yield* introspectForConnection(\n graphqlConfig,\n introspectionJson,\n values,\n template,\n options?.httpClientLayer ?? httpClientLayerFallback,\n ).pipe(Effect.option);\n if (Option.isNone(introspection)) return { tools: [] };\n const extracted = yield* extract(introspection.value).pipe(Effect.option);\n if (Option.isNone(extracted)) return { tools: [] };\n const prepared = prepareOperations(extracted.value.result.fields, introspection.value);\n return {\n tools: buildToolDefs(prepared),\n definitions: extracted.value.definitions,\n };\n }).pipe(Effect.catch(() => Effect.succeed({ tools: [] as readonly ToolDef[] }))),\n\n // -----------------------------------------------------------------------\n // Invoke one of a connection's tools. Look up the operation by integration\n // + tool name, render the credential through the connection's auth\n // template, and execute the GraphQL request.\n // -----------------------------------------------------------------------\n invokeTool: ({ ctx, toolRow, credential, args }) =>\n Effect.gen(function* () {\n const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;\n const integration = toolRow.integration;\n const toolName = toolRow.name;\n\n const config = yield* decodeGraphqlIntegrationConfig(credential.config).pipe(\n Effect.mapError(\n () =>\n new GraphqlInvocationError({\n message: `Invalid GraphQL integration config for \"${integration}\"`,\n statusCode: Option.none(),\n }),\n ),\n );\n\n // Operation bindings are produced lazily for integrations registered\n // without an add-time schema (no network at catalog registration). On a\n // cache miss, introspect with this connection's credential, persist the\n // bindings, then resolve the requested tool — discovery/persistence are\n // deferred to first use, mirroring MCP.\n let op = yield* ctx.storage.getOperation(integration, toolName);\n if (!op) {\n op = yield* materializeOperations(\n ctx,\n integration,\n config,\n credential,\n httpClientLayer,\n ).pipe(Effect.map((ops) => ops.find((o) => o.toolName === toolName) ?? null));\n }\n if (!op) {\n return yield* new GraphqlInvocationError({\n message: `No GraphQL operation found for tool \"${integration}.${toolName}\"`,\n statusCode: Option.none(),\n });\n }\n\n const headers: Record<string, string> = { ...(config.headers ?? {}) };\n const queryParams: Record<string, string> = {\n ...(config.queryParams ?? {}),\n };\n\n const method = config.authenticationTemplate.find(\n (m: GraphqlAuthMethod) => m.slug === String(credential.template),\n );\n if (method && method.kind !== \"none\") {\n // A method with unresolved inputs fails the invocation explicitly\n // instead of dialing unauthenticated. oauth2 requires the resolved\n // access token (`token`); apikey requires every placement variable.\n const missing = (\n method.kind === \"oauth2\"\n ? [TOKEN_VARIABLE]\n : requiredPlacementVariables(method.placements)\n ).filter((variable) => credential.values[variable] == null);\n if (missing.length > 0) {\n return yield* new GraphqlAuthRequiredError({\n code:\n method.kind === \"oauth2\" ? \"oauth_connection_missing\" : \"connection_value_missing\",\n message:\n method.kind === \"oauth2\"\n ? `Missing OAuth connection value for GraphQL integration \"${integration}\" (connection \"${credential.connection}\")`\n : `Missing credential value for GraphQL integration \"${integration}\" (connection \"${credential.connection}\") for input(s): ${missing.join(\", \")}`,\n owner: credential.owner,\n integration,\n connection: String(credential.connection),\n credentialKind: method.kind === \"oauth2\" ? \"oauth\" : \"secret\",\n credentialLabel: method.kind === \"oauth2\" ? \"OAuth sign-in\" : \"API key\",\n template: String(credential.template),\n });\n }\n const rendered = renderGraphqlAuthMethod(method, credential.values);\n Object.assign(headers, rendered.headers);\n Object.assign(queryParams, rendered.queryParams);\n }\n\n const result = yield* invokeWithLayer(\n op.binding,\n (args ?? {}) as Record<string, unknown>,\n config.endpoint,\n headers,\n queryParams,\n httpClientLayer,\n );\n\n const errors = decodeGraphqlErrors(result.errors);\n if (errors !== undefined && errors.length > 0) {\n const firstMessage = extractGraphqlErrorMessage(errors);\n return ToolResult.fail({\n code: \"graphql_errors\",\n message: firstMessage !== undefined ? firstMessage : \"GraphQL request returned errors\",\n details: { errors },\n });\n }\n if (result.status < 200 || result.status >= 300) {\n if (result.status === 401 || result.status === 403) {\n return authToolFailure({\n code: \"connection_rejected\",\n status: result.status,\n message: `Upstream rejected credentials for GraphQL integration \"${integration}\" with HTTP ${result.status}. Re-authenticate or update the connection before retrying this tool.`,\n source: { id: integration, scope: credential.owner },\n credential: { kind: \"upstream\", label: \"Upstream authorization\" },\n upstream: {\n status: result.status,\n details: {\n data: result.data,\n errors: result.errors,\n },\n },\n });\n }\n return ToolResult.fail({\n code: \"graphql_http_error\",\n status: result.status,\n message: `GraphQL request failed with HTTP ${result.status}`,\n details: {\n status: result.status,\n data: result.data,\n errors: result.errors,\n },\n });\n }\n return ToolResult.ok(result.data);\n }).pipe(\n Effect.catchTag(\"GraphqlAuthRequiredError\", (error) =>\n Effect.succeed(graphqlAuthToolFailure(error)),\n ),\n ),\n\n // Per-connection cleanup. Operation bindings are catalog-level (shared\n // across an integration's connections), so removing a single connection\n // leaves them in place; the executor drops the connection's tool rows.\n removeConnection: () => Effect.void,\n\n detect: ({ ctx, url }: { readonly ctx: PluginCtx<GraphqlStore>; readonly url: string }) =>\n Effect.gen(function* () {\n const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;\n const trimmed = url.trim();\n if (!trimmed) return null;\n const parsed = yield* Effect.try({\n try: () => new URL(trimmed),\n catch: (cause) => cause,\n }).pipe(Effect.option);\n if (Option.isNone(parsed)) return null;\n\n const ok = yield* introspect(trimmed).pipe(\n Effect.provide(httpClientLayer),\n Effect.map(() => true),\n Effect.catch(() => Effect.succeed(false)),\n );\n\n const slug = slugFromEndpoint(trimmed);\n\n if (ok) {\n return IntegrationDetectionResult.make({\n kind: \"graphql\",\n confidence: \"high\",\n endpoint: trimmed,\n name: slug,\n slug,\n });\n }\n\n // Low-confidence URL-token fallback. Introspection can fail for many\n // reasons (auth, CORS, the endpoint disabled introspection, transport\n // errors). When the URL itself strongly implies GraphQL, surface a\n // candidate so the user can still pick it.\n if (urlMatchesToken(parsed.value, \"graphql\")) {\n return IntegrationDetectionResult.make({\n kind: \"graphql\",\n confidence: \"low\",\n endpoint: trimmed,\n name: slug,\n slug,\n });\n }\n\n return null;\n }),\n };\n // HTTP transport (routes/handlers/extensionService) is layered on by the\n // api-aware factory in `@executor-js/plugin-graphql/api`.\n});\n\n// The fallback HTTP layer for `resolveTools`. The hook input carries no `ctx`,\n// so when no explicit layer is passed to the plugin we use the same default the\n// executor wires into `ctx.httpClientLayer` (`FetchHttpClient.layer`). Hosts/\n// tests that need a custom transport pass `options.httpClientLayer`.\nconst httpClientLayerFallback: Layer.Layer<HttpClient.HttpClient> = FetchHttpClient.layer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAQ,QAAQ,cAAc;AACvC,SAAS,YAAY,yBAAyB;AAQ9C,IAAM,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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O,MAAM;AACrB,UAAIJ,QAAO,OAAO,MAAM,EAAG,QAAO;AAElC,YAAM,KAAK,OAAO,WAAW,OAAO,EAAE;AAAA,QACpCI,QAAO,QAAQ,eAAe;AAAA,QAC9BA,QAAO,IAAI,MAAM,IAAI;AAAA,QACrBA,QAAO,MAAM,MAAMA,QAAO,QAAQ,KAAK,CAAC;AAAA,MAC1C;AAEA,YAAM,OAAO,iBAAiB,OAAO;AAErC,UAAI,IAAI;AACN,eAAO,2BAA2B,KAAK;AAAA,UACrC,MAAM;AAAA,UACN,YAAY;AAAA,UACZ,UAAU;AAAA,UACV,MAAM;AAAA,UACN;AAAA,QACF,CAAC;AAAA,MACH;AAMA,UAAI,gBAAgB,OAAO,OAAO,SAAS,GAAG;AAC5C,eAAO,2BAA2B,KAAK;AAAA,UACrC,MAAM;AAAA,UACN,YAAY;AAAA,UACZ,UAAU;AAAA,UACV,MAAM;AAAA,UACN;AAAA,QACF,CAAC;AAAA,MACH;AAEA,aAAO;AAAA,IACT,CAAC;AAAA,EACL;AAGF,CAAC;AAMD,IAAM,0BAA8D,gBAAgB;","names":["raw","Effect","Option","Option","Effect","Effect","Option","HttpClient","HttpClientRequest","Effect","HttpClient","HttpClientRequest","Option","Effect","Option","Schema","Schema","Option","Effect","Effect","Match","Option","Schema","Schema","Option","formatTypeRef","Match","unwrapTypeName","Effect"]}
|