@executor-js/plugin-graphql 1.5.6 → 1.5.8
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-P3D3UXRJ.js → AddGraphqlSource-FGT7DNXV.js} +39 -64
- package/dist/AddGraphqlSource-FGT7DNXV.js.map +1 -0
- package/dist/{EditGraphqlSource-FVF67CTP.js → EditGraphqlSource-QELISUYT.js} +4 -4
- package/dist/GraphqlAccountsPanel-U62WSGHR.js +9 -0
- package/dist/api/group.d.ts +54 -21
- package/dist/api/handlers.d.ts +1 -1
- package/dist/api/index.d.ts +55 -22
- package/dist/{chunk-N5GJE7R6.js → chunk-732HGFSH.js} +57 -21
- package/dist/chunk-732HGFSH.js.map +1 -0
- package/dist/{chunk-2Y3J3CVO.js → chunk-HN5FB4DO.js} +35 -55
- package/dist/chunk-HN5FB4DO.js.map +1 -0
- package/dist/{chunk-VCYDSSIK.js → chunk-OGNJZCEF.js} +27 -28
- package/dist/chunk-OGNJZCEF.js.map +1 -0
- package/dist/{chunk-ADQTI2OK.js → chunk-OUZI3QNC.js} +119 -124
- package/dist/chunk-OUZI3QNC.js.map +1 -0
- package/dist/client.js +3 -3
- package/dist/core.js +124 -10
- package/dist/core.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/react/atoms.d.ts +83 -29
- package/dist/react/auth-method-config.d.ts +21 -8
- package/dist/react/client.d.ts +54 -21
- package/dist/react/defaults.d.ts +0 -11
- package/dist/sdk/index.d.ts +4 -1
- package/dist/sdk/introspection-blob-migration.d.ts +7 -0
- package/dist/sdk/migrate-config.d.ts +6 -0
- package/dist/sdk/plugin.d.ts +49 -22
- package/dist/sdk/store.d.ts +11 -1
- package/dist/sdk/types.d.ts +102 -47
- package/package.json +3 -3
- package/dist/AddGraphqlSource-P3D3UXRJ.js.map +0 -1
- package/dist/GraphqlAccountsPanel-GBNFHLFH.js +0 -9
- package/dist/chunk-2Y3J3CVO.js.map +0 -1
- package/dist/chunk-ADQTI2OK.js.map +0 -1
- package/dist/chunk-N5GJE7R6.js.map +0 -1
- package/dist/chunk-VCYDSSIK.js.map +0 -1
- /package/dist/{EditGraphqlSource-FVF67CTP.js.map → EditGraphqlSource-QELISUYT.js.map} +0 -0
- /package/dist/{GraphqlAccountsPanel-GBNFHLFH.js.map → GraphqlAccountsPanel-U62WSGHR.js.map} +0 -0
package/dist/sdk/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
+
import { ApiKeyAuthTemplate, ApiKeyAuthMethod } from "@executor-js/sdk/http-auth";
|
|
2
3
|
export declare const GraphqlOperationKind: Schema.Literals<readonly ["query", "mutation"]>;
|
|
3
4
|
export type GraphqlOperationKind = typeof GraphqlOperationKind.Type;
|
|
4
5
|
export declare const GraphqlArgument: Schema.Struct<{
|
|
@@ -57,22 +58,9 @@ export declare const OperationBinding: Schema.Struct<{
|
|
|
57
58
|
readonly variableNames: Schema.$Array<Schema.String>;
|
|
58
59
|
}>;
|
|
59
60
|
export type OperationBinding = typeof OperationBinding.Type;
|
|
60
|
-
/** An
|
|
61
|
-
*
|
|
62
|
-
export declare const
|
|
63
|
-
readonly kind: Schema.Literal<"apiKey">;
|
|
64
|
-
/** The template slug a connection references via `connection.template`. */
|
|
65
|
-
readonly slug: Schema.String;
|
|
66
|
-
readonly in: Schema.Literals<readonly ["header", "query"]>;
|
|
67
|
-
/** The header / query-parameter name the value is written to. */
|
|
68
|
-
readonly name: Schema.String;
|
|
69
|
-
/** Optional prefix prepended to the value (e.g. `Bearer `). */
|
|
70
|
-
readonly prefix: Schema.optional<Schema.String>;
|
|
71
|
-
}>;
|
|
72
|
-
export type ApiKeyAuthTemplate = typeof ApiKeyAuthTemplate.Type;
|
|
73
|
-
/** An OAuth bearer template: write `Authorization: Bearer <access-token>`. The
|
|
74
|
-
* resolved (and refreshed) access token is `credential.value`. */
|
|
75
|
-
export declare const OAuthAuthTemplate: Schema.Struct<{
|
|
61
|
+
/** An OAuth bearer method: write `<header>: <prefix><access-token>`. The
|
|
62
|
+
* resolved (and refreshed) access token is the connection's `token` value. */
|
|
63
|
+
export declare const GraphqlOAuthMethod: Schema.Struct<{
|
|
76
64
|
readonly kind: Schema.Literal<"oauth2">;
|
|
77
65
|
readonly slug: Schema.String;
|
|
78
66
|
/** The header to write the bearer token to. Defaults to `Authorization`. */
|
|
@@ -80,16 +68,21 @@ export declare const OAuthAuthTemplate: Schema.Struct<{
|
|
|
80
68
|
/** The token prefix. Defaults to `Bearer `. */
|
|
81
69
|
readonly prefix: Schema.optional<Schema.String>;
|
|
82
70
|
}>;
|
|
83
|
-
export type
|
|
84
|
-
export declare const
|
|
85
|
-
readonly kind: Schema.Literal<"apiKey">;
|
|
86
|
-
/** The template slug a connection references via `connection.template`. */
|
|
71
|
+
export type GraphqlOAuthMethod = typeof GraphqlOAuthMethod.Type;
|
|
72
|
+
export declare const GraphqlAuthMethod: Schema.Union<readonly [Schema.Struct<{
|
|
87
73
|
readonly slug: Schema.String;
|
|
88
|
-
readonly
|
|
89
|
-
|
|
90
|
-
readonly
|
|
91
|
-
|
|
92
|
-
readonly
|
|
74
|
+
readonly kind: Schema.Literal<"none">;
|
|
75
|
+
}>, Schema.Struct<{
|
|
76
|
+
readonly slug: Schema.String;
|
|
77
|
+
readonly kind: Schema.Literal<"apikey">;
|
|
78
|
+
readonly label: Schema.optional<Schema.String>;
|
|
79
|
+
readonly placements: Schema.$Array<Schema.Struct<{
|
|
80
|
+
readonly carrier: Schema.Literals<readonly ["header", "query"]>;
|
|
81
|
+
readonly name: Schema.String;
|
|
82
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
83
|
+
readonly variable: Schema.optional<Schema.String>;
|
|
84
|
+
readonly literal: Schema.optional<Schema.String>;
|
|
85
|
+
}>>;
|
|
93
86
|
}>, Schema.Struct<{
|
|
94
87
|
readonly kind: Schema.Literal<"oauth2">;
|
|
95
88
|
readonly slug: Schema.String;
|
|
@@ -98,29 +91,75 @@ export declare const AuthTemplate: Schema.Union<readonly [Schema.Struct<{
|
|
|
98
91
|
/** The token prefix. Defaults to `Bearer `. */
|
|
99
92
|
readonly prefix: Schema.optional<Schema.String>;
|
|
100
93
|
}>]>;
|
|
101
|
-
export type
|
|
94
|
+
export type GraphqlAuthMethod = typeof GraphqlAuthMethod.Type;
|
|
95
|
+
/** Input variant of `GraphqlAuthMethod` — callers (UI, agents) may omit the
|
|
96
|
+
* slug; `normalizeGraphqlAuthMethods` backfills it. */
|
|
97
|
+
export declare const GraphqlAuthMethodInput: Schema.Union<readonly [Schema.Struct<{
|
|
98
|
+
readonly slug: Schema.optional<Schema.String>;
|
|
99
|
+
readonly kind: Schema.Literal<"none">;
|
|
100
|
+
}>, Schema.Struct<{
|
|
101
|
+
readonly slug: Schema.optional<Schema.String>;
|
|
102
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
103
|
+
readonly header: Schema.optional<Schema.String>;
|
|
104
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
105
|
+
}>, Schema.Struct<{
|
|
106
|
+
readonly slug: Schema.optional<Schema.String>;
|
|
107
|
+
readonly type: Schema.Literal<"apiKey">;
|
|
108
|
+
readonly label: Schema.optional<Schema.String>;
|
|
109
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
110
|
+
readonly type: Schema.Literal<"variable">;
|
|
111
|
+
readonly name: Schema.String;
|
|
112
|
+
}>]>>]>>>;
|
|
113
|
+
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
114
|
+
readonly type: Schema.Literal<"variable">;
|
|
115
|
+
readonly name: Schema.String;
|
|
116
|
+
}>]>>]>>>;
|
|
117
|
+
}>]>;
|
|
118
|
+
export type GraphqlAuthMethodInput = typeof GraphqlAuthMethodInput.Type;
|
|
119
|
+
/** The expansion target: input arms with the dialect resolved to canonical
|
|
120
|
+
* placements (slug still optional — backfill is a separate pass). */
|
|
121
|
+
export type GraphqlCanonicalAuthMethodInput = Exclude<GraphqlAuthMethodInput, ApiKeyAuthTemplate> | (Omit<ApiKeyAuthMethod, "slug"> & {
|
|
122
|
+
readonly slug?: string;
|
|
123
|
+
});
|
|
124
|
+
/** Expand request-shaped dialect entries into canonical placements; canonical
|
|
125
|
+
* entries pass through. Slug backfill is the caller's concern
|
|
126
|
+
* (`normalizeGraphqlAuthMethods` for declare flows, `mergeAuthTemplates` for
|
|
127
|
+
* the custom-method merge). */
|
|
128
|
+
export declare const expandGraphqlAuthMethodInputs: (methods: readonly GraphqlAuthMethodInput[]) => readonly GraphqlCanonicalAuthMethodInput[];
|
|
129
|
+
/** Assign each method a stable slug: a caller-provided one wins, otherwise a
|
|
130
|
+
* kind/carrier-derived default, suffixed `_2`, `_3`, … on collision. The
|
|
131
|
+
* request-shaped dialect is expanded to canonical placements first. */
|
|
132
|
+
export declare const normalizeGraphqlAuthMethods: (methods: readonly GraphqlAuthMethodInput[]) => readonly GraphqlAuthMethod[];
|
|
102
133
|
export declare const GraphqlIntegrationConfig: Schema.Struct<{
|
|
103
134
|
/** The GraphQL endpoint URL. */
|
|
104
135
|
readonly endpoint: Schema.String;
|
|
105
136
|
/** Display name for the integration. */
|
|
106
137
|
readonly name: Schema.String;
|
|
107
|
-
/**
|
|
108
|
-
*
|
|
109
|
-
|
|
138
|
+
/** Hex SHA-256 of the introspection JSON snapshot — the content address of
|
|
139
|
+
* the blob (`introspection/<hash>` in the plugin blob store). Rows that
|
|
140
|
+
* predate the blob store (inline `introspectionJson` text) are rewritten
|
|
141
|
+
* by the introspection-to-blob migrations before this schema sees them. */
|
|
142
|
+
readonly introspectionHash: Schema.optional<Schema.String>;
|
|
110
143
|
/** Static headers applied to every request (and to add-time introspection). */
|
|
111
144
|
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
112
145
|
/** Static query parameters applied to every request. */
|
|
113
146
|
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
114
|
-
/**
|
|
147
|
+
/** Declared auth methods — how a connection's values are rendered onto
|
|
148
|
+
* requests. A connection's `template` picks one by slug. */
|
|
115
149
|
readonly authenticationTemplate: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
116
|
-
readonly kind: Schema.Literal<"apiKey">;
|
|
117
|
-
/** The template slug a connection references via `connection.template`. */
|
|
118
150
|
readonly slug: Schema.String;
|
|
119
|
-
readonly
|
|
120
|
-
|
|
121
|
-
readonly
|
|
122
|
-
|
|
123
|
-
readonly
|
|
151
|
+
readonly kind: Schema.Literal<"none">;
|
|
152
|
+
}>, Schema.Struct<{
|
|
153
|
+
readonly slug: Schema.String;
|
|
154
|
+
readonly kind: Schema.Literal<"apikey">;
|
|
155
|
+
readonly label: Schema.optional<Schema.String>;
|
|
156
|
+
readonly placements: Schema.$Array<Schema.Struct<{
|
|
157
|
+
readonly carrier: Schema.Literals<readonly ["header", "query"]>;
|
|
158
|
+
readonly name: Schema.String;
|
|
159
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
160
|
+
readonly variable: Schema.optional<Schema.String>;
|
|
161
|
+
readonly literal: Schema.optional<Schema.String>;
|
|
162
|
+
}>>;
|
|
124
163
|
}>, Schema.Struct<{
|
|
125
164
|
readonly kind: Schema.Literal<"oauth2">;
|
|
126
165
|
readonly slug: Schema.String;
|
|
@@ -135,11 +174,19 @@ export declare const decodeGraphqlIntegrationConfig: (input: unknown, options?:
|
|
|
135
174
|
readonly name: string;
|
|
136
175
|
readonly endpoint: string;
|
|
137
176
|
readonly authenticationTemplate: readonly ({
|
|
138
|
-
readonly name: string;
|
|
139
|
-
readonly in: "header" | "query";
|
|
140
177
|
readonly slug: string;
|
|
141
|
-
readonly kind: "
|
|
142
|
-
readonly
|
|
178
|
+
readonly kind: "apikey";
|
|
179
|
+
readonly placements: readonly {
|
|
180
|
+
readonly name: string;
|
|
181
|
+
readonly carrier: "header" | "query";
|
|
182
|
+
readonly variable?: string | undefined;
|
|
183
|
+
readonly prefix?: string | undefined;
|
|
184
|
+
readonly literal?: string | undefined;
|
|
185
|
+
}[];
|
|
186
|
+
readonly label?: string | undefined;
|
|
187
|
+
} | {
|
|
188
|
+
readonly slug: string;
|
|
189
|
+
readonly kind: "none";
|
|
143
190
|
} | {
|
|
144
191
|
readonly slug: string;
|
|
145
192
|
readonly kind: "oauth2";
|
|
@@ -149,20 +196,28 @@ export declare const decodeGraphqlIntegrationConfig: (input: unknown, options?:
|
|
|
149
196
|
readonly headers?: {
|
|
150
197
|
readonly [x: string]: string;
|
|
151
198
|
} | undefined;
|
|
152
|
-
readonly introspectionJson?: string | undefined;
|
|
153
199
|
readonly queryParams?: {
|
|
154
200
|
readonly [x: string]: string;
|
|
155
201
|
} | undefined;
|
|
202
|
+
readonly introspectionHash?: string | undefined;
|
|
156
203
|
}, Schema.SchemaError, never>;
|
|
157
204
|
export declare const decodeGraphqlIntegrationConfigOption: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Option").Option<{
|
|
158
205
|
readonly name: string;
|
|
159
206
|
readonly endpoint: string;
|
|
160
207
|
readonly authenticationTemplate: readonly ({
|
|
161
|
-
readonly name: string;
|
|
162
|
-
readonly in: "header" | "query";
|
|
163
208
|
readonly slug: string;
|
|
164
|
-
readonly kind: "
|
|
165
|
-
readonly
|
|
209
|
+
readonly kind: "apikey";
|
|
210
|
+
readonly placements: readonly {
|
|
211
|
+
readonly name: string;
|
|
212
|
+
readonly carrier: "header" | "query";
|
|
213
|
+
readonly variable?: string | undefined;
|
|
214
|
+
readonly prefix?: string | undefined;
|
|
215
|
+
readonly literal?: string | undefined;
|
|
216
|
+
}[];
|
|
217
|
+
readonly label?: string | undefined;
|
|
218
|
+
} | {
|
|
219
|
+
readonly slug: string;
|
|
220
|
+
readonly kind: "none";
|
|
166
221
|
} | {
|
|
167
222
|
readonly slug: string;
|
|
168
223
|
readonly kind: "oauth2";
|
|
@@ -172,10 +227,10 @@ export declare const decodeGraphqlIntegrationConfigOption: (input: unknown, opti
|
|
|
172
227
|
readonly headers?: {
|
|
173
228
|
readonly [x: string]: string;
|
|
174
229
|
} | undefined;
|
|
175
|
-
readonly introspectionJson?: string | undefined;
|
|
176
230
|
readonly queryParams?: {
|
|
177
231
|
readonly [x: string]: string;
|
|
178
232
|
} | undefined;
|
|
233
|
+
readonly introspectionHash?: string | undefined;
|
|
179
234
|
}>;
|
|
180
235
|
export declare const InvocationResult: Schema.Struct<{
|
|
181
236
|
readonly status: Schema.Number;
|
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.8",
|
|
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.8",
|
|
57
|
+
"@executor-js/sdk": "1.5.8",
|
|
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, useAtomValue } from \"@effect/atom-react\";\nimport { Link } from \"@tanstack/react-router\";\nimport * as Exit from \"effect/Exit\";\nimport * as Option from \"effect/Option\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Schema from \"effect/Schema\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\n\nimport { integrationsOptimisticAtom } from \"@executor-js/react/api/atoms\";\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 AuthTemplateEditor,\n type AuthTemplateEditorValue,\n} from \"@executor-js/react/components/auth-template-editor\";\nimport { FieldLabel } from \"@executor-js/react/components/field\";\nimport { FloatActions } from \"@executor-js/react/components/float-actions\";\nimport { Spinner } from \"@executor-js/react/components/spinner\";\n\nimport { addGraphqlIntegrationOptimistic } from \"./atoms\";\nimport { GraphqlSourceFields } from \"./GraphqlSourceFields\";\nimport { graphqlTemplatesFromPlacements } from \"./auth-method-config\";\n\nconst ErrorMessage = Schema.Struct({ message: Schema.String });\nconst decodeErrorMessage = Schema.decodeUnknownOption(ErrorMessage);\n\nconst errorMessageFromExit = (exit: Exit.Exit<unknown, unknown>, fallback: string): string =>\n Option.match(Option.flatMap(Exit.findErrorOption(exit), decodeErrorMessage), {\n onNone: () => fallback,\n onSome: ({ message }) => message,\n });\n\nconst isIntegrationAlreadyExistsExit = (exit: Exit.Exit<unknown, unknown>): boolean =>\n Option.match(Exit.findErrorOption(exit), {\n onNone: () => false,\n onSome: Predicate.isTagged(\"IntegrationAlreadyExistsError\"),\n });\n\nconst integrationExistsMessage = (slug: string): string =>\n `An integration named \"${slug}\" already exists. To add more authentication, update your existing integration.`;\n\n// v2 GraphQL add flow (post-redesign): register the integration (introspects\n// the endpoint and declares an apiKey auth template when the user configures a\n// header), then route to the integration's detail hub. Connection creation is\n// no longer part of the add flow — accounts are added from the hub (P6: add\n// without auth, connect later). Auth is declared through the shared\n// `AuthTemplateEditor` (GraphQL stays header/query apiKey — OAuth is hidden).\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 [authValue, setAuthValue] = useState<AuthTemplateEditorValue>({ kind: \"none\" });\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 // An apiKey method needs at least one named placement; `none` is always valid.\n const apiKeyComplete =\n authValue.kind !== \"apikey\" ||\n authValue.placements.some((placement) => placement.name.trim().length > 0);\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 integrationsResult = useAtomValue(integrationsOptimisticAtom);\n const slugAlreadyExists = useMemo(\n () =>\n AsyncResult.isSuccess(integrationsResult) &&\n integrationsResult.value.some((integration) => String(integration.slug) === resolvedSlug),\n [integrationsResult, resolvedSlug],\n );\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 authenticationTemplate =\n authValue.kind === \"apikey\" ? graphqlTemplatesFromPlacements(authValue.placements) : [];\n\n const integrationExit = await doAddIntegration({\n payload: {\n endpoint: trimmedEndpoint,\n slug,\n name: displayName,\n ...(authenticationTemplate.length > 0 ? { authenticationTemplate } : {}),\n },\n reactivityKeys: integrationWriteKeys,\n });\n if (Exit.isFailure(integrationExit)) {\n setAddError(\n isIntegrationAlreadyExistsExit(integrationExit)\n ? integrationExistsMessage(slug)\n : errorMessageFromExit(integrationExit, \"Failed to add source\"),\n );\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 <section className=\"space-y-2.5\">\n <FieldLabel>How does this API authenticate?</FieldLabel>\n <AuthTemplateEditor\n value={authValue}\n onChange={setAuthValue}\n allowedKinds={[\"none\", \"apikey\"]}\n />\n </section>\n\n {slugAlreadyExists && !adding && (\n <div className=\"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2\">\n <p className=\"text-[12px] text-destructive\">\n An integration named "{resolvedSlug}" already exists. To add more\n authentication, update your existing integration.{\" \"}\n <Link\n to=\"/integrations/$namespace\"\n params={{ namespace: resolvedSlug }}\n className=\"font-medium underline underline-offset-2\"\n >\n Open it\n </Link>\n </p>\n </div>\n )}\n\n {addError && (\n <div className=\"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2\">\n <p className=\"text-[12px] text-destructive\">{addError}</p>\n </div>\n )}\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,YAAY,oBAAoB;AACzC,SAAS,YAAY;AACrB,YAAY,UAAU;AACtB,YAAY,YAAY;AACxB,YAAY,eAAe;AAC3B,YAAY,YAAY;AACxB,YAAY,iBAAiB;AAE7B,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,OAEK;AACP,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,eAAe;;;ACvBxB;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,cA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AAU,CAAC,QACjD;AAAA,kBAAU,gBAAAD,KAAC,WAAQ,WAAU,YAAW;AAAA,QACxC,SAAS,cAAc;AAAA,SAC1B;AAAA,OACF;AAAA,KACF;AAEJ;","names":["jsx","jsxs"]}
|
|
@@ -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","../src/react/defaults.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 { AuthTemplate } 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(AuthTemplate)),\n});\n\n// The `configure` payload — the custom auth methods to merge-append onto the\n// integration's `authenticationTemplate`. Reuses the same `AuthTemplate` schema\n// as `addIntegration` so a custom apiKey method round-trips identically.\nconst ConfigurePayload = Schema.Struct({\n authenticationTemplate: Schema.Array(AuthTemplate),\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 full opaque integration config, surfaced for the configure UX. Carries\n// the `authenticationTemplate` the configure / custom-method flow reads/writes.\nconst GraphqlConfigView = Schema.Struct({\n endpoint: Schema.String,\n name: 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.Array(AuthTemplate),\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(AuthTemplate),\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.\n//\n// The generic Accounts hub + add-time auth editor speak in plugin-agnostic\n// `AuthMethod` / `Placement` values (`@executor-js/react/lib/auth-placements`).\n// The GraphQL plugin stores auth as its own `AuthTemplate` wire shape\n// (`{ kind:\"apiKey\", slug, in, name, prefix? }` / `{ kind:\"oauth2\", slug, … }`).\n// These converters bridge that wire shape to/from the generic placement model,\n// so they live with the GraphQL plugin — they touch the graphql sdk\n// `AuthTemplate` types and would pull transport specifics into core.\n// ---------------------------------------------------------------------------\n\nimport { AuthTemplateSlug } from \"@executor-js/sdk/shared\";\nimport type { AuthMethod, Placement } from \"@executor-js/react/lib/auth-placements\";\n\nimport { GRAPHQL_APIKEY_TEMPLATE } from \"./defaults\";\nimport type { AuthTemplate } from \"../sdk/types\";\n\n// ---------------------------------------------------------------------------\n// Templates → generic methods.\n// ---------------------------------------------------------------------------\n\nconst labelForApiKey = (slug: string, name: string): string => `API key (${name || slug})`;\n\n/** Map each stored GraphQL auth template to a generic `AuthMethod`. A `custom_`\n * slug marks a user-defined method; everything else is spec-declared. */\nexport function authMethodsFromConfig(templates: readonly AuthTemplate[]): AuthMethod[] {\n return templates.map((template: AuthTemplate): AuthMethod => {\n const slug = String(template.slug);\n const source: \"spec\" | \"custom\" = slug.startsWith(\"custom_\") ? \"custom\" : \"spec\";\n if (template.kind === \"oauth2\") {\n return {\n id: slug,\n label: \"OAuth2\",\n kind: \"oauth\",\n source,\n template: AuthTemplateSlug.make(slug),\n placements: [],\n oauth: {},\n };\n }\n const placement: Placement = {\n carrier: template.in,\n name: template.name,\n prefix: template.prefix ?? \"\",\n };\n return {\n id: slug,\n label: labelForApiKey(slug, template.name),\n kind: \"apikey\",\n source,\n template: AuthTemplateSlug.make(slug),\n placements: [placement],\n };\n });\n}\n\n// ---------------------------------------------------------------------------\n// Generic placements → graphql apiKey templates (inverse).\n//\n// GraphQL's `AuthTemplate` carries ONE header/query slot per template, so a\n// multi-placement method emits one template per named placement. When `slug` is\n// omitted the backend backfills `custom_<id>`; the first template keeps the\n// integration's primary `apiKey` slug so the add flow stays stable.\n// ---------------------------------------------------------------------------\n\n/** Build GraphQL `apiKey` templates from generic placements. The optional\n * `slug` names the FIRST emitted template (subsequent placements get an empty\n * slug so the backend assigns a `custom_<id>` each). */\nexport function graphqlTemplatesFromPlacements(\n placements: readonly Placement[],\n slug?: string,\n): AuthTemplate[] {\n const named = placements.filter((placement: Placement) => placement.name.trim().length > 0);\n return named.map(\n (placement: Placement, index: number): AuthTemplate => ({\n kind: \"apiKey\",\n slug: index === 0 ? (slug ?? GRAPHQL_APIKEY_TEMPLATE) : \"\",\n in: placement.carrier,\n name: placement.name,\n ...(placement.prefix ? { prefix: placement.prefix } : {}),\n }),\n );\n}\n","import type { ConnectionName, Owner } from \"@executor-js/sdk/shared\";\nimport { connectionIdentifier } from \"@executor-js/react/lib/connection-name\";\n\n// ---------------------------------------------------------------------------\n// v2 connection-create defaults for the GraphQL plugin. v1's HTTP-credentials\n// editor (header/query secret slots bound per source per scope) is gone: a\n// connection IS the credential, applied to the integration's auth template.\n// ---------------------------------------------------------------------------\n\n/** The slug of the apiKey auth template the add flow declares + targets. */\nexport const GRAPHQL_APIKEY_TEMPLATE = \"apiKey\";\n\n/** Build the apiKey auth template the integration stores. The connection's\n * value is written to `headerName` at invoke time (no prefix — the user pastes\n * the full header value, e.g. `Bearer ghp_…`). */\nexport const graphqlApiKeyAuthTemplate = (\n headerName: string,\n): {\n readonly kind: \"apiKey\";\n readonly slug: string;\n readonly in: \"header\";\n readonly name: string;\n} => ({\n kind: \"apiKey\",\n slug: GRAPHQL_APIKEY_TEMPLATE,\n in: \"header\",\n name: headerName || \"Authorization\",\n});\n\n/** Deterministic connection name for a GraphQL integration + owner. Keeps a\n * single owner-scoped credential per integration so re-adding overwrites\n * rather than accumulating duplicates. */\nexport const graphqlConnectionName = (slug: string, owner: Owner): ConnectionName =>\n connectionIdentifier(`${slug} ${owner}`);\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,CAAC;AAAA,EACpE,aAAa,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM,CAAC;AAAA,EACxE,wBAAwB,OAAO,SAAS,OAAO,MAAM,YAAY,CAAC;AAC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,EAAE,QAAQ,UAAU,OAAO,IAAI,CAAC;AAAA,IACzD;AAAA,EACF;AACF;","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\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}\n\nexport const makeDefaultGraphqlStore = ({ pluginStorage }: 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};\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 ToolName,\n ToolResult,\n type AuthMethodDescriptor,\n type AuthPlacementDescriptor,\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 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 AuthTemplate,\n decodeGraphqlIntegrationConfig,\n decodeGraphqlIntegrationConfigOption,\n ExtractedField,\n GraphqlIntegrationConfig,\n OperationBinding,\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\nconst AuthTemplateSchema = AuthTemplate;\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(AuthTemplateSchema)),\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(AuthTemplateSchema)),\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 templates onto the\n * integration's existing `authenticationTemplate`, mirroring OpenAPI's\n * `configure`. */\nconst GraphqlConfigureAuthInputSchema = Schema.Struct({\n authenticationTemplate: Schema.Array(AuthTemplateSchema),\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 template rendering (D11) — apply the resolved credential value through\n// the template the connection references, exactly like an apiKey bearer.\n// ---------------------------------------------------------------------------\n\ninterface RenderedAuth {\n readonly headers: Record<string, string>;\n readonly queryParams: Record<string, string>;\n}\n\nconst renderAuthTemplate = (template: AuthTemplate, value: string): RenderedAuth => {\n if (template.kind === \"oauth2\") {\n const header = template.header ?? \"Authorization\";\n const prefix = template.prefix ?? \"Bearer \";\n return { headers: { [header]: `${prefix}${value}` }, queryParams: {} };\n }\n const rendered = template.prefix ? `${template.prefix}${value}` : value;\n if (template.in === \"query\") {\n return { headers: {}, queryParams: { [template.name]: rendered } };\n }\n return { headers: { [template.name]: rendered }, 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 credentialValue: string | null,\n): RenderedAuth => {\n const headers: Record<string, string> = { ...(config.headers ?? {}) };\n const queryParams: Record<string, string> = { ...(config.queryParams ?? {}) };\n if (credentialValue !== null) {\n // A connection references exactly one template; when several are declared we\n // can't know which without the slug (not carried into `resolveTools`), so we\n // apply the first. Most integrations declare a single auth method.\n const template = config.authenticationTemplate[0];\n if (template) {\n const rendered = renderAuthTemplate(template, credentialValue);\n Object.assign(headers, rendered.headers);\n Object.assign(queryParams, rendered.queryParams);\n }\n }\n return { headers, queryParams };\n};\n\n/** Introspect a config live or from its stored JSON, applying connection auth.\n * `parseIntrospectionJson` short-circuits the network when a schema snapshot is\n * present; otherwise this introspects the endpoint with the rendered credential. */\nconst introspectForConnection = (\n config: GraphqlIntegrationConfig,\n credentialValue: string | null,\n httpClientLayer: Layer.Layer<HttpClient.HttpClient>,\n): Effect.Effect<IntrospectionResult, GraphqlIntrospectionError> => {\n if (config.introspectionJson) {\n return parseIntrospectionJson(config.introspectionJson);\n }\n const auth = introspectHeadersForConnection(config, credentialValue);\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 value: string | null;\n },\n httpClientLayer: Layer.Layer<HttpClient.HttpClient>,\n): Effect.Effect<readonly StoredOperation[], GraphqlIntrospectionError | StorageFailure> =>\n Effect.gen(function* () {\n // Render the exact template this connection references (we have its slug\n // here, unlike `resolveTools`) so an auth-required endpoint introspects.\n const template = config.authenticationTemplate.find(\n (t: AuthTemplate) => t.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 (template && credential.value !== null) {\n const rendered = renderAuthTemplate(template, credential.value);\n Object.assign(headers, rendered.headers);\n Object.assign(queryParams, rendered.queryParams);\n }\n\n const introspection = config.introspectionJson\n ? yield* parseIntrospectionJson(config.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// apiKey → one apikey method carrying a single header/query placement (the\n// `name` from the template, with the template's `prefix` defaulted to\n// `\"\"`).\n// oauth2 → one oauth method (no resolved endpoints; graphql renders the\n// connection value as a bearer at invoke time).\n// ---------------------------------------------------------------------------\n\nconst graphqlApiKeyLabel = (placement: AuthPlacementDescriptor): string =>\n `API key (${placement.name || (placement.carrier === \"header\" ? \"header\" : \"query\")})`;\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((template: AuthTemplate): AuthMethodDescriptor => {\n const slug = template.slug;\n if (template.kind === \"oauth2\") {\n return {\n id: slug,\n label: \"OAuth\",\n kind: \"oauth\",\n template: slug,\n oauth: {},\n };\n }\n const placement: AuthPlacementDescriptor = {\n carrier: template.in,\n name: template.name,\n prefix: template.prefix ?? \"\",\n };\n return {\n id: slug,\n label: graphqlApiKeyLabel(placement),\n kind: \"apikey\",\n template: slug,\n placements: [placement],\n };\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// Auth-template merge — append the incoming custom methods onto the existing\n// `authenticationTemplate`, replacing entries whose slug matches and assigning a\n// fresh `custom_<id>` slug to entries that omit one (or collide). Mirrors the\n// OpenAPI plugin's `mergeAuthenticationTemplate` so the custom-method-create UX\n// is identical across plugins (item 2A).\n// ---------------------------------------------------------------------------\n\nconst shortId = (): string => Math.random().toString(36).slice(2, 8);\n\nconst freshCustomSlug = (taken: ReadonlySet<string>): string => {\n let candidate = `custom_${shortId()}`;\n while (taken.has(candidate)) candidate = `custom_${shortId()}`;\n return candidate;\n};\n\nconst mergeGraphqlAuthTemplate = (\n existing: readonly AuthTemplate[],\n incoming: readonly AuthTemplate[],\n): readonly AuthTemplate[] => {\n const result: AuthTemplate[] = existing.map((entry: AuthTemplate) => entry);\n const taken = new Set<string>(result.map((entry: AuthTemplate) => entry.slug));\n for (const entry of incoming) {\n // `slug` is a plain string; a JSON caller may submit it empty/blank — read\n // defensively and backfill so every stored template has a stable slug.\n const requested = entry.slug.trim();\n const existingIndex = result.findIndex((current: AuthTemplate) => current.slug === requested);\n if (requested.length > 0 && existingIndex >= 0) {\n result[existingIndex] = entry;\n continue;\n }\n const slug = requested.length > 0 && !taken.has(requested) ? requested : freshCustomSlug(taken);\n taken.add(slug);\n result.push({ ...entry, slug } as AuthTemplate);\n }\n return result;\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.introspectionJson !== undefined\n ? { introspectionJson: input.introspectionJson }\n : {}),\n ...(input.headers !== undefined ? { headers: input.headers } : {}),\n ...(input.queryParams !== undefined ? { queryParams: input.queryParams } : {}),\n authenticationTemplate: input.authenticationTemplate ?? [],\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 ctx.transaction(\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 (baseConfig.introspectionJson === undefined) {\n yield* ctx.core.integrations.register({\n slug,\n description: baseConfig.name,\n config: baseConfig,\n canRemove: true,\n canRefresh: true,\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(baseConfig.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 const config = GraphqlIntegrationConfig.make({\n ...baseConfig,\n introspectionJson: JSON.stringify({ data: introspection }),\n });\n\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 return {\n slug: String(slug),\n name: config.name,\n toolCount: prepared.length,\n };\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.introspectionJson !== undefined\n ? { introspectionJson: current.introspectionJson }\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 ?? 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 AuthTemplate[], 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 AuthTemplate[];\n const current = Option.getOrNull(decodeGraphqlIntegrationConfigOption(record.config));\n if (!current) return [] as readonly AuthTemplate[];\n\n const merged =\n input.mode === \"replace\"\n ? input.authenticationTemplate\n : mergeGraphqlAuthTemplate(\n current.authenticationTemplate,\n input.authenticationTemplate,\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 getValue,\n }: {\n readonly config: IntegrationConfig;\n readonly getValue: () => Effect.Effect<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 // Live introspection (no stored snapshot) needs the connection's\n // credential for auth-required endpoints; resolve it lazily.\n const credentialValue =\n graphqlConfig.introspectionJson === undefined\n ? yield* getValue().pipe(Effect.catch(() => Effect.succeed(null)))\n : null;\n const introspection = yield* introspectForConnection(\n graphqlConfig,\n credentialValue,\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 template = config.authenticationTemplate.find(\n (t: AuthTemplate) => t.slug === String(credential.template),\n );\n if (template) {\n if (credential.value === null) {\n return yield* new GraphqlAuthRequiredError({\n code:\n template.kind === \"oauth2\"\n ? \"oauth_connection_missing\"\n : \"connection_value_missing\",\n message:\n template.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}\")`,\n owner: credential.owner,\n integration,\n connection: String(credential.connection),\n credentialKind: template.kind === \"oauth2\" ? \"oauth\" : \"secret\",\n credentialLabel: template.kind === \"oauth2\" ? \"OAuth sign-in\" : \"API key\",\n template: String(credential.template),\n });\n }\n const rendered = renderAuthTemplate(template, credential.value);\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0E5B,IAAM,2BAA2B,OAAO,OAAO;AAAA,EAC7C,MAAM,OAAO;AAAA,EACb,MAAM,OAAO,OAAO,OAAO,MAAM;AAAA,EACjC,QAAQ,OAAO,SAAS,OAAO,IAAI;AACrC,CAAC;AAED,IAAM,wBAAwB,OAAO,OAAO;AAAA,EAC1C,MAAM,OAAO;AAAA,EACb,MAAM,OAAO,OAAO,OAAO,MAAM;AAAA,EACjC,QAAQ,OAAO,SAAS,OAAO,OAAO,wBAAwB,CAAC;AACjE,CAAC;AAED,IAAM,wBAAwB,OAAO,OAAO;AAAA,EAC1C,MAAM,OAAO;AAAA,EACb,MAAM,OAAO,OAAO,OAAO,MAAM;AAAA,E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C,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"]}
|