@executor-js/plugin-graphql 0.0.1-beta.3 → 0.0.1-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -10
- package/dist/{chunk-5CCYOYRL.js → chunk-QP62AGHJ.js} +19 -27
- package/dist/chunk-QP62AGHJ.js.map +1 -0
- package/dist/core.js +1 -1
- package/dist/index.js +1 -1
- package/dist/sdk/errors.d.ts +9 -11
- package/package.json +2 -2
- package/dist/chunk-5CCYOYRL.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
# @executor
|
|
1
|
+
# @executor/plugin-graphql
|
|
2
2
|
|
|
3
3
|
Introspect a GraphQL endpoint and expose its queries and mutations as invokable tools on an executor.
|
|
4
4
|
|
|
5
|
-
Pairs with [`@executor-js/sdk`](https://www.npmjs.com/package/@executor-js/sdk) (promise-based) or [`@executor-js/core`](https://www.npmjs.com/package/@executor-js/core) (Effect-based).
|
|
6
|
-
|
|
7
5
|
## Install
|
|
8
6
|
|
|
9
7
|
```sh
|
|
10
|
-
bun add @executor
|
|
8
|
+
bun add @executor/sdk @executor/plugin-graphql
|
|
11
9
|
# or
|
|
12
|
-
npm install @executor
|
|
10
|
+
npm install @executor/sdk @executor/plugin-graphql
|
|
13
11
|
```
|
|
14
12
|
|
|
15
13
|
## Usage
|
|
16
14
|
|
|
17
15
|
```ts
|
|
18
|
-
import { createExecutor } from "@executor
|
|
19
|
-
import { graphqlPlugin } from "@executor
|
|
16
|
+
import { createExecutor } from "@executor/sdk";
|
|
17
|
+
import { graphqlPlugin } from "@executor/plugin-graphql";
|
|
20
18
|
|
|
21
19
|
const executor = await createExecutor({
|
|
22
20
|
scope: { name: "my-app" },
|
|
@@ -56,12 +54,12 @@ await executor.graphql.addSource({
|
|
|
56
54
|
});
|
|
57
55
|
```
|
|
58
56
|
|
|
59
|
-
##
|
|
57
|
+
## Using with Effect
|
|
60
58
|
|
|
61
|
-
If you're
|
|
59
|
+
If you're building on `@executor/sdk/core` (the raw Effect entry), import this plugin from its `/core` subpath instead:
|
|
62
60
|
|
|
63
61
|
```ts
|
|
64
|
-
import { graphqlPlugin } from "@executor
|
|
62
|
+
import { graphqlPlugin } from "@executor/plugin-graphql/core";
|
|
65
63
|
```
|
|
66
64
|
|
|
67
65
|
## Status
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// src/sdk/errors.ts
|
|
2
|
-
import { Schema } from "effect";
|
|
2
|
+
import { Data, Schema } from "effect";
|
|
3
3
|
var GraphqlIntrospectionError = class extends Schema.TaggedError()(
|
|
4
4
|
"GraphqlIntrospectionError",
|
|
5
5
|
{
|
|
6
|
-
message: Schema.String
|
|
7
|
-
error: Schema.Defect
|
|
6
|
+
message: Schema.String
|
|
8
7
|
}
|
|
9
8
|
) {
|
|
10
9
|
};
|
|
@@ -15,13 +14,8 @@ var GraphqlExtractionError = class extends Schema.TaggedError()(
|
|
|
15
14
|
}
|
|
16
15
|
) {
|
|
17
16
|
};
|
|
18
|
-
var GraphqlInvocationError = class extends
|
|
19
|
-
"GraphqlInvocationError"
|
|
20
|
-
{
|
|
21
|
-
message: Schema.String,
|
|
22
|
-
statusCode: Schema.optionalWith(Schema.Number, { as: "Option" }),
|
|
23
|
-
error: Schema.Defect
|
|
24
|
-
}
|
|
17
|
+
var GraphqlInvocationError = class extends Data.TaggedError(
|
|
18
|
+
"GraphqlInvocationError"
|
|
25
19
|
) {
|
|
26
20
|
};
|
|
27
21
|
|
|
@@ -111,40 +105,39 @@ var introspect = Effect.fn("GraphQL.introspect")(function* (endpoint, headers) {
|
|
|
111
105
|
}
|
|
112
106
|
}
|
|
113
107
|
const response = yield* client.execute(request).pipe(
|
|
108
|
+
Effect.tapErrorCause(
|
|
109
|
+
(cause) => Effect.logError("graphql introspection request failed", cause)
|
|
110
|
+
),
|
|
114
111
|
Effect.mapError(
|
|
115
112
|
(err) => new GraphqlIntrospectionError({
|
|
116
|
-
message: `Failed to reach GraphQL endpoint: ${err.message}
|
|
117
|
-
error: err
|
|
113
|
+
message: `Failed to reach GraphQL endpoint: ${err.message}`
|
|
118
114
|
})
|
|
119
115
|
)
|
|
120
116
|
);
|
|
121
117
|
if (response.status !== 200) {
|
|
122
|
-
const body = yield* response.text.pipe(Effect.catchAll(() => Effect.succeed("")));
|
|
123
118
|
return yield* new GraphqlIntrospectionError({
|
|
124
|
-
message: `Introspection failed with status ${response.status}
|
|
125
|
-
error: void 0
|
|
119
|
+
message: `Introspection failed with status ${response.status}`
|
|
126
120
|
});
|
|
127
121
|
}
|
|
128
122
|
const raw = yield* response.json.pipe(
|
|
123
|
+
Effect.tapErrorCause(
|
|
124
|
+
(cause) => Effect.logError("graphql introspection JSON parse failed", cause)
|
|
125
|
+
),
|
|
129
126
|
Effect.mapError(
|
|
130
|
-
(
|
|
131
|
-
message: `Failed to parse introspection response as JSON
|
|
132
|
-
error: err
|
|
127
|
+
() => new GraphqlIntrospectionError({
|
|
128
|
+
message: `Failed to parse introspection response as JSON`
|
|
133
129
|
})
|
|
134
130
|
)
|
|
135
131
|
);
|
|
136
132
|
const json = raw;
|
|
137
133
|
if (json.errors && Array.isArray(json.errors) && json.errors.length > 0) {
|
|
138
134
|
return yield* new GraphqlIntrospectionError({
|
|
139
|
-
|
|
140
|
-
message: `Introspection returned errors: ${JSON.stringify(json.errors)}`,
|
|
141
|
-
error: void 0
|
|
135
|
+
message: `Introspection returned ${json.errors.length} error(s)`
|
|
142
136
|
});
|
|
143
137
|
}
|
|
144
138
|
if (!json.data?.__schema) {
|
|
145
139
|
return yield* new GraphqlIntrospectionError({
|
|
146
|
-
message: "Introspection response missing __schema"
|
|
147
|
-
error: void 0
|
|
140
|
+
message: "Introspection response missing __schema"
|
|
148
141
|
});
|
|
149
142
|
}
|
|
150
143
|
return json.data;
|
|
@@ -159,8 +152,7 @@ var parseIntrospectionJson = (text) => Effect.try({
|
|
|
159
152
|
return result;
|
|
160
153
|
},
|
|
161
154
|
catch: (err) => new GraphqlIntrospectionError({
|
|
162
|
-
message: `Failed to parse introspection JSON: ${err instanceof Error ? err.message : String(err)}
|
|
163
|
-
error: err
|
|
155
|
+
message: `Failed to parse introspection JSON: ${err instanceof Error ? err.message : String(err)}`
|
|
164
156
|
})
|
|
165
157
|
});
|
|
166
158
|
|
|
@@ -464,7 +456,7 @@ var invoke = Effect3.fn("GraphQL.invoke")(function* (operation, args, config, re
|
|
|
464
456
|
(err) => new GraphqlInvocationError({
|
|
465
457
|
message: `GraphQL request failed: ${err.message}`,
|
|
466
458
|
statusCode: Option2.none(),
|
|
467
|
-
|
|
459
|
+
cause: err
|
|
468
460
|
})
|
|
469
461
|
)
|
|
470
462
|
);
|
|
@@ -901,4 +893,4 @@ export {
|
|
|
901
893
|
makeInMemoryOperationStore,
|
|
902
894
|
graphqlPlugin
|
|
903
895
|
};
|
|
904
|
-
//# sourceMappingURL=chunk-
|
|
896
|
+
//# sourceMappingURL=chunk-QP62AGHJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sdk/errors.ts","../src/sdk/introspect.ts","../src/sdk/types.ts","../src/sdk/extract.ts","../src/sdk/invoke.ts","../src/sdk/kv-operation-store.ts","../src/sdk/plugin.ts"],"sourcesContent":["import { Data, Schema } from \"effect\";\nimport type { Option } from \"effect\";\n\nexport class GraphqlIntrospectionError extends Schema.TaggedError<GraphqlIntrospectionError>()(\n \"GraphqlIntrospectionError\",\n {\n message: Schema.String,\n },\n) {}\n\nexport class GraphqlExtractionError extends Schema.TaggedError<GraphqlExtractionError>()(\n \"GraphqlExtractionError\",\n {\n message: Schema.String,\n },\n) {}\n\nexport class GraphqlInvocationError extends Data.TaggedError(\n \"GraphqlInvocationError\",\n)<{\n readonly message: string;\n readonly statusCode: Option.Option<number>;\n readonly cause?: unknown;\n}> {}\n","import { Effect } from \"effect\";\nimport { HttpClient, HttpClientRequest } from \"@effect/platform\";\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\nexport interface IntrospectionTypeRef {\n readonly kind: string;\n readonly name: string | null;\n readonly ofType: IntrospectionTypeRef | null;\n}\n\nexport interface IntrospectionInputValue {\n readonly name: string;\n readonly description: string | null;\n readonly type: IntrospectionTypeRef;\n readonly defaultValue: string | null;\n}\n\nexport interface IntrospectionField {\n readonly name: string;\n readonly description: string | null;\n readonly args: readonly IntrospectionInputValue[];\n readonly type: IntrospectionTypeRef;\n}\n\nexport interface IntrospectionEnumValue {\n readonly name: string;\n readonly description: string | null;\n}\n\nexport interface IntrospectionType {\n readonly kind: string;\n readonly name: string;\n readonly description: string | null;\n readonly fields: readonly IntrospectionField[] | null;\n readonly inputFields: readonly IntrospectionInputValue[] | null;\n readonly enumValues: readonly IntrospectionEnumValue[] | null;\n}\n\nexport interface IntrospectionSchema {\n readonly queryType: { readonly name: string } | null;\n readonly mutationType: { readonly name: string } | null;\n readonly types: readonly IntrospectionType[];\n}\n\nexport interface IntrospectionResult {\n readonly __schema: IntrospectionSchema;\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) {\n const client = yield* HttpClient.HttpClient;\n\n let request = HttpClientRequest.post(endpoint).pipe(\n HttpClientRequest.setHeader(\"Content-Type\", \"application/json\"),\n HttpClientRequest.bodyUnsafeJson({\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.tapErrorCause((cause) =>\n Effect.logError(\"graphql introspection request failed\", cause),\n ),\n Effect.mapError(\n (err) =>\n new GraphqlIntrospectionError({\n message: `Failed to reach GraphQL endpoint: ${err.message}`,\n }),\n ),\n );\n\n if (response.status !== 200) {\n return yield* new GraphqlIntrospectionError({\n message: `Introspection failed with status ${response.status}`,\n });\n }\n\n const raw = yield* response.json.pipe(\n Effect.tapErrorCause((cause) =>\n Effect.logError(\"graphql introspection JSON parse failed\", cause),\n ),\n Effect.mapError(\n () =>\n new GraphqlIntrospectionError({\n message: `Failed to parse introspection response as JSON`,\n }),\n ),\n );\n\n const json = raw as { data?: IntrospectionResult; errors?: unknown[] };\n\n if (json.errors && Array.isArray(json.errors) && json.errors.length > 0) {\n return yield* new GraphqlIntrospectionError({\n message: `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 Effect.try({\n try: () => {\n const parsed = JSON.parse(text);\n // Accept both { data: { __schema } } and { __schema } formats\n const result = parsed.data ?? parsed;\n if (!result.__schema) {\n throw new Error(\"Missing __schema in introspection JSON\");\n }\n return result as IntrospectionResult;\n },\n catch: (err) =>\n new GraphqlIntrospectionError({\n message: `Failed to parse introspection JSON: ${err instanceof Error ? err.message : String(err)}`,\n }),\n });\n","import { Schema } from \"effect\";\n\n// ---------------------------------------------------------------------------\n// GraphQL operation kind\n// ---------------------------------------------------------------------------\n\nexport const GraphqlOperationKind = Schema.Literal(\"query\", \"mutation\");\nexport type GraphqlOperationKind = typeof GraphqlOperationKind.Type;\n\n// ---------------------------------------------------------------------------\n// Extracted field (becomes a tool)\n// ---------------------------------------------------------------------------\n\nexport class GraphqlArgument extends Schema.Class<GraphqlArgument>(\n \"GraphqlArgument\",\n)({\n name: Schema.String,\n typeName: Schema.String,\n required: Schema.Boolean,\n description: Schema.optionalWith(Schema.String, { as: \"Option\" }),\n}) {}\n\nexport class ExtractedField extends Schema.Class<ExtractedField>(\n \"ExtractedField\",\n)({\n /** e.g. \"user\", \"createUser\" */\n fieldName: Schema.String,\n /** \"query\" or \"mutation\" */\n kind: GraphqlOperationKind,\n description: Schema.optionalWith(Schema.String, { as: \"Option\" }),\n arguments: Schema.Array(GraphqlArgument),\n /** JSON Schema for the input (built from arguments) */\n inputSchema: Schema.optionalWith(Schema.Unknown, { as: \"Option\" }),\n /** The return type name for documentation */\n returnTypeName: Schema.String,\n}) {}\n\nexport class ExtractionResult extends Schema.Class<ExtractionResult>(\n \"ExtractionResult\",\n)({\n /** Schema name from introspection */\n schemaName: Schema.optionalWith(Schema.String, { as: \"Option\" }),\n fields: Schema.Array(ExtractedField),\n}) {}\n\n// ---------------------------------------------------------------------------\n// Operation binding — minimal data needed to invoke\n// ---------------------------------------------------------------------------\n\nexport class OperationBinding extends Schema.Class<OperationBinding>(\n \"OperationBinding\",\n)({\n kind: GraphqlOperationKind,\n fieldName: Schema.String,\n /** The full GraphQL query/mutation string */\n operationString: Schema.String,\n /** Ordered variable names for mapping */\n variableNames: Schema.Array(Schema.String),\n}) {}\n\n// ---------------------------------------------------------------------------\n// Invocation\n// ---------------------------------------------------------------------------\n\nexport const HeaderValue = Schema.Union(\n Schema.String,\n Schema.Struct({\n secretId: Schema.String,\n prefix: Schema.optional(Schema.String),\n }),\n);\nexport type HeaderValue = typeof HeaderValue.Type;\n\nexport class InvocationConfig extends Schema.Class<InvocationConfig>(\n \"InvocationConfig\",\n)({\n /** The GraphQL endpoint URL */\n endpoint: Schema.String,\n /** Headers applied to every request. Values can reference secrets. */\n headers: Schema.optionalWith(\n Schema.Record({ key: Schema.String, value: HeaderValue }),\n { default: () => ({}) },\n ),\n}) {}\n\nexport class InvocationResult extends Schema.Class<InvocationResult>(\n \"InvocationResult\",\n)({\n status: Schema.Number,\n data: Schema.NullOr(Schema.Unknown),\n errors: Schema.NullOr(Schema.Unknown),\n}) {}\n","import { Effect, 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 =>\n 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 types: ReadonlyMap<string, IntrospectionType>,\n): Record<string, unknown> => {\n switch (ref.kind) {\n case \"NON_NULL\":\n return ref.ofType ? typeRefToJsonSchema(ref.ofType, types) : {};\n\n case \"LIST\":\n return {\n type: \"array\",\n items: ref.ofType ? typeRefToJsonSchema(ref.ofType, types) : {},\n };\n\n case \"SCALAR\":\n return scalarToJsonSchema(ref.name ?? \"String\");\n\n case \"ENUM\":\n // Reference the shared definition\n return ref.name ? { $ref: `#/$defs/${ref.name}` } : { type: \"string\" };\n\n case \"INPUT_OBJECT\":\n // Reference the shared definition — no recursive expansion needed\n return ref.name ? { $ref: `#/$defs/${ref.name}` } : { type: \"object\" };\n\n case \"OBJECT\":\n case \"INTERFACE\":\n case \"UNION\":\n return { type: \"object\" };\n\n default:\n return {};\n }\n};\n\nconst scalarToJsonSchema = (name: string): Record<string, unknown> => {\n switch (name) {\n case \"String\":\n case \"ID\":\n return { type: \"string\" };\n case \"Int\":\n return { type: \"integer\" };\n case \"Float\":\n return { type: \"number\" };\n case \"Boolean\":\n return { type: \"boolean\" };\n default:\n return { 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 switch (ref.kind) {\n case \"NON_NULL\":\n return ref.ofType ? `${formatTypeRef(ref.ofType)}!` : \"Unknown!\";\n case \"LIST\":\n return ref.ofType ? `[${formatTypeRef(ref.ofType)}]` : \"[Unknown]\";\n default:\n return ref.name ?? \"Unknown\";\n }\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(\n (arg) =>\n new GraphqlArgument({\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 new ExtractedField({\n fieldName: field.name,\n kind,\n description: field.description\n ? Option.some(field.description)\n : 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(\n schema,\n \"query\",\n schema.queryType?.name,\n typeMap,\n );\n const mutationFields = extractFields(\n schema,\n \"mutation\",\n schema.mutationType?.name,\n typeMap,\n );\n\n return {\n result: new ExtractionResult({\n schemaName: Option.none(),\n fields: [...queryFields, ...mutationFields],\n }),\n definitions,\n };\n },\n catch: (err) =>\n new GraphqlExtractionError({\n message: `Failed to extract GraphQL schema: ${err instanceof Error ? err.message : String(err)}`,\n }),\n });\n","import { Effect, Layer, Option } from \"effect\";\nimport { HttpClient, HttpClientRequest } from \"@effect/platform\";\n\nimport {\n type ToolId,\n type ToolInvoker,\n ToolInvocationResult,\n ToolInvocationError,\n type ScopeId,\n type SecretId,\n} from \"@executor/sdk/core\";\n\nimport { GraphqlInvocationError } from \"./errors\";\nimport type { GraphqlOperationStore } from \"./operation-store\";\nimport {\n type HeaderValue,\n type OperationBinding,\n InvocationConfig,\n InvocationResult,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Header resolution — resolves secret refs at invocation time\n// ---------------------------------------------------------------------------\n\nconst resolveHeaders = (\n headers: Record<string, HeaderValue>,\n secrets: { readonly resolve: (secretId: SecretId, scopeId: ScopeId) => Effect.Effect<string, unknown> },\n scopeId: ScopeId,\n): Effect.Effect<Record<string, string>, ToolInvocationError> =>\n Effect.gen(function* () {\n const resolved: Record<string, string> = {};\n for (const [name, value] of Object.entries(headers)) {\n if (typeof value === \"string\") {\n resolved[name] = value;\n } else {\n const secret = yield* secrets.resolve(value.secretId as SecretId, scopeId).pipe(\n Effect.mapError(() =>\n new ToolInvocationError({\n toolId: \"\" as ToolId,\n message: `Failed to resolve secret \"${value.secretId}\" for header \"${name}\"`,\n cause: undefined,\n }),\n ),\n );\n resolved[name] = value.prefix ? `${value.prefix}${secret}` : secret;\n }\n }\n return resolved;\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\" ||\n normalized.includes(\"+json\") ||\n 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 config: InvocationConfig,\n resolvedHeaders?: Record<string, string>,\n) {\n const client = yield* HttpClient.HttpClient;\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(config.endpoint).pipe(\n HttpClientRequest.setHeader(\"Content-Type\", \"application/json\"),\n HttpClientRequest.bodyUnsafeJson({\n query: operation.operationString,\n variables: Object.keys(variables).length > 0 ? variables : undefined,\n }),\n );\n\n // Apply resolved headers\n if (resolvedHeaders) {\n for (const [name, value] of Object.entries(resolvedHeaders)) {\n request = HttpClientRequest.setHeader(request, name, value);\n }\n }\n\n const response = yield* client.execute(request).pipe(\n Effect.mapError(\n (err) =>\n new GraphqlInvocationError({\n message: `GraphQL request failed: ${err.message}`,\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.catchAll(() => 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 return new InvocationResult({\n status,\n data: gqlBody?.data ?? null,\n errors: hasErrors ? gqlBody!.errors : null,\n });\n});\n\n// ---------------------------------------------------------------------------\n// ToolInvoker — bridges operation store + HTTP client into SDK invoker\n// ---------------------------------------------------------------------------\n\nexport const makeGraphqlInvoker = (opts: {\n readonly operationStore: GraphqlOperationStore;\n readonly httpClientLayer: Layer.Layer<HttpClient.HttpClient>;\n readonly secrets: { readonly resolve: (secretId: SecretId, scopeId: ScopeId) => Effect.Effect<string, unknown> };\n readonly scopeId: ScopeId;\n}): ToolInvoker => ({\n resolveAnnotations: (toolId: ToolId) =>\n Effect.gen(function* () {\n const entry = yield* opts.operationStore.get(toolId);\n if (!entry) return undefined;\n // Mutations require approval, queries don't\n if (entry.binding.kind === \"mutation\") {\n return {\n requiresApproval: true,\n approvalDescription: `mutation ${entry.binding.fieldName}`,\n };\n }\n return {};\n }),\n\n invoke: (toolId: ToolId, args: unknown) =>\n Effect.gen(function* () {\n const entry = yield* opts.operationStore.get(toolId);\n if (!entry) {\n return yield* new ToolInvocationError({\n toolId,\n message: `No GraphQL operation found for tool \"${toolId}\"`,\n cause: undefined,\n });\n }\n\n const { binding, config } = entry;\n\n // Resolve secret-backed headers\n const resolvedHeaders = yield* resolveHeaders(\n config.headers,\n opts.secrets,\n opts.scopeId,\n );\n\n const result = yield* invoke(\n binding,\n (args ?? {}) as Record<string, unknown>,\n config,\n resolvedHeaders,\n ).pipe(Effect.provide(opts.httpClientLayer));\n\n return new ToolInvocationResult({\n data: result.data,\n error: result.errors,\n status: result.status,\n });\n }).pipe(\n Effect.catchAll((err) => {\n if (\n typeof err === \"object\" &&\n err !== null &&\n \"_tag\" in err &&\n (err as { _tag: string })._tag === \"ToolInvocationError\"\n ) {\n return Effect.fail(err as ToolInvocationError);\n }\n return Effect.fail(\n new ToolInvocationError({\n toolId,\n message: `GraphQL invocation failed: ${err instanceof Error ? err.message : String(err)}`,\n cause: err,\n }),\n );\n }),\n ),\n});\n","// ---------------------------------------------------------------------------\n// KV-backed GraphqlOperationStore\n// ---------------------------------------------------------------------------\n\nimport { Effect, Schema } from \"effect\";\nimport { scopeKv, makeInMemoryScopedKv, type Kv, type ToolId, type ScopedKv } from \"@executor/sdk/core\";\n\nimport type { GraphqlOperationStore, StoredSource } from \"./operation-store\";\nimport { OperationBinding, InvocationConfig, HeaderValue } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Stored schemas\n// ---------------------------------------------------------------------------\n\nclass StoredEntry extends Schema.Class<StoredEntry>(\"StoredEntry\")({\n namespace: Schema.String,\n binding: OperationBinding,\n config: InvocationConfig,\n}) {}\n\nconst encodeEntry = Schema.encodeSync(Schema.parseJson(StoredEntry));\nconst decodeEntry = Schema.decodeUnknownSync(Schema.parseJson(StoredEntry));\n\nconst StoredSourceSchema = Schema.Struct({\n namespace: Schema.String,\n name: Schema.String,\n config: Schema.Struct({\n endpoint: Schema.String,\n introspectionJson: Schema.optional(Schema.String),\n namespace: Schema.optional(Schema.String),\n headers: Schema.optional(\n Schema.Record({ key: Schema.String, value: HeaderValue }),\n ),\n }),\n});\nconst encodeSource = Schema.encodeSync(Schema.parseJson(StoredSourceSchema));\nconst decodeSource = Schema.decodeUnknownSync(Schema.parseJson(StoredSourceSchema));\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\nconst makeStore = (\n bindings: ScopedKv,\n sources: ScopedKv,\n): GraphqlOperationStore => ({\n get: (toolId) =>\n Effect.gen(function* () {\n const raw = yield* bindings.get(toolId);\n if (!raw) return null;\n const entry = decodeEntry(raw);\n return { binding: entry.binding, config: entry.config };\n }),\n\n put: (toolId, namespace, binding, config) =>\n bindings.set(\n toolId,\n encodeEntry(new StoredEntry({ namespace, binding, config })),\n ),\n\n remove: (toolId) => bindings.delete(toolId).pipe(Effect.asVoid),\n\n listByNamespace: (namespace) =>\n Effect.gen(function* () {\n const entries = yield* bindings.list();\n const ids: ToolId[] = [];\n for (const e of entries) {\n const entry = decodeEntry(e.value);\n if (entry.namespace === namespace) ids.push(e.key as ToolId);\n }\n return ids;\n }),\n\n removeByNamespace: (namespace) =>\n Effect.gen(function* () {\n const entries = yield* bindings.list();\n const ids: ToolId[] = [];\n for (const e of entries) {\n const entry = decodeEntry(e.value);\n if (entry.namespace === namespace) {\n ids.push(e.key as ToolId);\n yield* bindings.delete(e.key);\n }\n }\n return ids;\n }),\n\n putSource: (source) =>\n sources.set(source.namespace, encodeSource(source)),\n\n removeSource: (namespace) =>\n sources.delete(namespace).pipe(Effect.asVoid),\n\n listSources: () =>\n Effect.gen(function* () {\n const entries = yield* sources.list();\n return entries.map((e) => decodeSource(e.value) as StoredSource);\n }),\n});\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nexport const makeKvOperationStore = (\n kv: Kv,\n namespace: string,\n): GraphqlOperationStore =>\n makeStore(\n scopeKv(kv, `${namespace}.bindings`),\n scopeKv(kv, `${namespace}.sources`),\n );\n\nexport const makeInMemoryOperationStore = (): GraphqlOperationStore =>\n makeStore(\n makeInMemoryScopedKv(),\n makeInMemoryScopedKv(),\n );\n","import { Effect, Option, Schema } from \"effect\";\nimport { FetchHttpClient, HttpClient } from \"@effect/platform\";\nimport type { Layer } from \"effect\";\n\nimport {\n Source,\n SourceDetectionResult,\n definePlugin,\n registerRuntimeTools,\n runtimeTool,\n type ExecutorPlugin,\n type PluginContext,\n ToolId,\n type SecretId,\n type ToolRegistration,\n} from \"@executor/sdk/core\";\n\nimport { introspect, parseIntrospectionJson, type IntrospectionResult, type IntrospectionType, type IntrospectionField } from \"./introspect\";\nimport { extract } from \"./extract\";\nimport {\n GraphqlExtractionError,\n} from \"./errors\";\nimport { makeGraphqlInvoker } from \"./invoke\";\nimport type { GraphqlOperationStore } from \"./operation-store\";\nimport { makeInMemoryOperationStore } from \"./kv-operation-store\";\nimport {\n ExtractedField,\n HeaderValue as HeaderValueSchema,\n InvocationConfig,\n OperationBinding,\n type HeaderValue as HeaderValueValue,\n type GraphqlOperationKind,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Plugin config\n// ---------------------------------------------------------------------------\n\nexport type HeaderValue = HeaderValueValue;\n\nexport interface GraphqlSourceConfig {\n /** The GraphQL endpoint URL */\n readonly endpoint: string;\n /** Optional: introspection JSON text (if endpoint doesn't support introspection) */\n readonly introspectionJson?: string;\n /** Namespace for the tools (derived from endpoint if not provided) */\n readonly namespace?: string;\n /** Headers applied to every request. Values can reference secrets. */\n readonly headers?: Record<string, HeaderValue>;\n}\n\n// ---------------------------------------------------------------------------\n// Plugin extension\n// ---------------------------------------------------------------------------\n\nexport interface GraphqlPluginExtension {\n /** Add a GraphQL endpoint and register its operations as tools */\n readonly addSource: (\n config: GraphqlSourceConfig,\n ) => Effect.Effect<{ readonly toolCount: number }, Error>;\n\n /** Remove all tools from a previously added GraphQL source by namespace */\n readonly removeSource: (namespace: string) => Effect.Effect<void>;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nconst AddSourceInputSchema = Schema.Struct({\n endpoint: Schema.String,\n introspectionJson: Schema.optional(Schema.String),\n namespace: Schema.optional(Schema.String),\n headers: Schema.optional(\n Schema.Record({ key: Schema.String, value: HeaderValueSchema }),\n ),\n});\ntype AddSourceInput = typeof AddSourceInputSchema.Type;\n\nconst AddSourceOutputSchema = Schema.Struct({\n sourceId: Schema.String,\n toolCount: Schema.Number,\n});\n\n/** Derive a namespace from an endpoint URL */\nconst namespaceFromEndpoint = (endpoint: string): string => {\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 buildOperationStringForField = (\n kind: GraphqlOperationKind,\n field: IntrospectionField,\n types: ReadonlyMap<string, IntrospectionType>,\n): string => {\n const opType = kind === \"query\" ? \"query\" : \"mutation\";\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}${varDefsStr} { ${field.name}${argPassStr}${selectionSet ? ` ${selectionSet}` : \"\"} }`;\n};\n\nimport type { IntrospectionTypeRef } from \"./introspect\";\n\nconst formatTypeRef = (ref: IntrospectionTypeRef): string => {\n switch (ref.kind) {\n case \"NON_NULL\":\n return ref.ofType ? `${formatTypeRef(ref.ofType)}!` : \"Unknown!\";\n case \"LIST\":\n return ref.ofType ? `[${formatTypeRef(ref.ofType)}]` : \"[Unknown]\";\n default:\n return ref.name ?? \"Unknown\";\n }\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) => !f.name.startsWith(\"__\"))\n .slice(0, 12)\n .map((f) => {\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\nconst toRegistration = (\n field: ExtractedField,\n namespace: string,\n): ToolRegistration => {\n const prefix = field.kind === \"mutation\" ? \"mutation\" : \"query\";\n const toolPath = `${prefix}.${field.fieldName}`;\n const description = Option.getOrElse(field.description, () =>\n `GraphQL ${field.kind}: ${field.fieldName} -> ${field.returnTypeName}`,\n );\n\n return {\n id: ToolId.make(`${namespace}.${toolPath}`),\n pluginKey: \"graphql\",\n sourceId: namespace,\n name: toolPath,\n description,\n inputSchema: Option.getOrUndefined(field.inputSchema),\n outputSchema: undefined,\n };\n};\n\n// ---------------------------------------------------------------------------\n// Plugin factory\n// ---------------------------------------------------------------------------\n\nexport const graphqlPlugin = (options?: {\n readonly httpClientLayer?: Layer.Layer<HttpClient.HttpClient>;\n readonly operationStore?: GraphqlOperationStore;\n}): ExecutorPlugin<\"graphql\", GraphqlPluginExtension> => {\n const httpClientLayer = options?.httpClientLayer ?? FetchHttpClient.layer;\n const operationStore =\n options?.operationStore ?? makeInMemoryOperationStore();\n\n return definePlugin({\n key: \"graphql\",\n init: (ctx: PluginContext) =>\n Effect.gen(function* () {\n yield* ctx.tools.registerInvoker(\n \"graphql\",\n makeGraphqlInvoker({\n operationStore,\n httpClientLayer,\n secrets: ctx.secrets,\n scopeId: ctx.scope.id,\n }),\n );\n\n yield* ctx.sources.addManager({\n kind: \"graphql\",\n\n list: () =>\n operationStore.listSources().pipe(\n Effect.map((metas) =>\n metas.map(\n (s) =>\n new Source({\n id: s.namespace,\n name: s.name,\n kind: \"graphql\",\n runtime: false,\n canRemove: true,\n canRefresh: false,\n }),\n ),\n ),\n ),\n\n remove: (sourceId: string) =>\n Effect.gen(function* () {\n yield* operationStore.removeByNamespace(sourceId);\n yield* operationStore.removeSource(sourceId);\n yield* ctx.tools.unregisterBySource(sourceId);\n }),\n\n detect: (url: string) =>\n Effect.gen(function* () {\n const trimmed = url.trim();\n if (!trimmed) return null;\n const parsed = yield* Effect.try(() => new URL(trimmed)).pipe(Effect.option);\n if (parsed._tag === \"None\") return null;\n\n const ok = yield* introspect(trimmed).pipe(\n Effect.provide(httpClientLayer),\n Effect.map(() => true),\n Effect.catchAll(() => Effect.succeed(false)),\n );\n\n if (!ok) return null;\n\n const name = namespaceFromEndpoint(trimmed);\n return new SourceDetectionResult({\n kind: \"graphql\",\n confidence: \"high\",\n endpoint: trimmed,\n name,\n namespace: name,\n });\n }),\n });\n\n const addSourceInternal = (config: GraphqlSourceConfig) =>\n Effect.gen(function* () {\n // Get introspection result — either by querying the endpoint or parsing provided JSON\n let introspectionResult: IntrospectionResult;\n if (config.introspectionJson) {\n introspectionResult = yield* parseIntrospectionJson(config.introspectionJson);\n } else {\n // Resolve all headers (including secret refs) for introspection\n const resolvedHeaders: Record<string, string> = {};\n if (config.headers) {\n for (const [name, value] of Object.entries(config.headers)) {\n if (typeof value === \"string\") {\n resolvedHeaders[name] = value;\n } else {\n const secret = yield* ctx.secrets\n .resolve(value.secretId as SecretId, ctx.scope.id)\n .pipe(Effect.catchAll(() => Effect.succeed(\"\")));\n if (secret) {\n resolvedHeaders[name] = value.prefix\n ? `${value.prefix}${secret}`\n : secret;\n }\n }\n }\n }\n\n introspectionResult = yield* introspect(\n config.endpoint,\n Object.keys(resolvedHeaders).length > 0 ? resolvedHeaders : undefined,\n ).pipe(Effect.provide(httpClientLayer));\n }\n\n const { result, definitions } = yield* extract(introspectionResult);\n const namespace = config.namespace ?? namespaceFromEndpoint(config.endpoint);\n\n // Register shared JSON Schema definitions ($ref targets)\n if (Object.keys(definitions).length > 0) {\n yield* ctx.tools.registerDefinitions(definitions);\n }\n\n const invocationConfig = new InvocationConfig({\n endpoint: config.endpoint,\n headers: config.headers ?? {},\n });\n\n // Build type map for operation string generation\n const typeMap = new Map<string, IntrospectionType>();\n for (const t of introspectionResult.__schema.types) {\n typeMap.set(t.name, t);\n }\n\n // Build field map for operation strings\n const fieldMap = new Map<string, { kind: GraphqlOperationKind; field: IntrospectionField }>();\n const schema = introspectionResult.__schema;\n\n for (const rootKind of [\"query\", \"mutation\"] as const) {\n const typeName = rootKind === \"query\"\n ? schema.queryType?.name\n : 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 const registrations: ToolRegistration[] = [];\n\n yield* Effect.forEach(\n result.fields,\n (extractedField) => {\n const reg = toRegistration(extractedField, namespace);\n registrations.push(reg);\n\n const key = `${extractedField.kind}.${extractedField.fieldName}`;\n const entry = fieldMap.get(key);\n\n const operationString = entry\n ? buildOperationStringForField(entry.kind, entry.field, typeMap)\n : `${extractedField.kind} { ${extractedField.fieldName} }`;\n\n const binding = new OperationBinding({\n kind: extractedField.kind,\n fieldName: extractedField.fieldName,\n operationString,\n variableNames: extractedField.arguments.map((a) => a.name),\n });\n\n return operationStore.put(reg.id, namespace, binding, invocationConfig);\n },\n { discard: true },\n );\n\n yield* ctx.tools.register(registrations);\n\n yield* operationStore.putSource({\n namespace,\n name: namespace,\n config: {\n endpoint: config.endpoint,\n introspectionJson: config.introspectionJson,\n namespace: config.namespace,\n headers: config.headers,\n },\n });\n\n return { sourceId: namespace, toolCount: registrations.length };\n });\n\n const runtimeTools = yield* registerRuntimeTools({\n registry: ctx.tools,\n sources: ctx.sources,\n pluginKey: \"graphql\",\n source: {\n id: \"built-in\",\n name: \"Built In\",\n kind: \"built-in\",\n },\n tools: [\n runtimeTool({\n id: \"graphql.addSource\",\n name: \"graphql.addSource\",\n description:\n \"Add a GraphQL endpoint and register its operations as tools\",\n inputSchema: AddSourceInputSchema,\n outputSchema: AddSourceOutputSchema,\n handler: (input: AddSourceInput) => addSourceInternal(input),\n }),\n ],\n });\n\n return {\n extension: {\n addSource: (config: GraphqlSourceConfig) =>\n addSourceInternal(config).pipe(\n Effect.map(({ toolCount }) => ({ toolCount })),\n Effect.mapError(\n (err) =>\n new GraphqlExtractionError({\n message:\n err instanceof Error ? err.message : String(err),\n }),\n ),\n ),\n\n removeSource: (namespace: string) =>\n Effect.gen(function* () {\n const toolIds =\n yield* operationStore.removeByNamespace(namespace);\n if (toolIds.length > 0) {\n yield* ctx.tools.unregister(toolIds);\n }\n yield* operationStore.removeSource(namespace);\n }),\n },\n\n close: () => runtimeTools.close(),\n };\n }),\n });\n};\n"],"mappings":";AAAA,SAAS,MAAM,cAAc;AAGtB,IAAM,4BAAN,cAAwC,OAAO,YAAuC;AAAA,EAC3F;AAAA,EACA;AAAA,IACE,SAAS,OAAO;AAAA,EAClB;AACF,EAAE;AAAC;AAEI,IAAM,yBAAN,cAAqC,OAAO,YAAoC;AAAA,EACrF;AAAA,EACA;AAAA,IACE,SAAS,OAAO;AAAA,EAClB;AACF,EAAE;AAAC;AAEI,IAAM,yBAAN,cAAqC,KAAK;AAAA,EAC/C;AACF,EAIG;AAAC;;;ACvBJ,SAAS,cAAc;AACvB,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;AA0HrB,IAAM,aAAa,OAAO,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HttpClient","HttpClientRequest","Effect","HttpClient","HttpClientRequest","Option","Effect","Schema","Schema","Effect","Effect","Option","Schema","Schema","formatTypeRef","unwrapTypeName","Option","Effect"]}
|
package/dist/core.js
CHANGED
package/dist/index.js
CHANGED
package/dist/sdk/errors.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
+
import type { Option } from "effect";
|
|
2
3
|
declare const GraphqlIntrospectionError_base: Schema.TaggedErrorClass<GraphqlIntrospectionError, "GraphqlIntrospectionError", {
|
|
3
4
|
readonly _tag: Schema.tag<"GraphqlIntrospectionError">;
|
|
4
5
|
} & {
|
|
5
6
|
message: typeof Schema.String;
|
|
6
|
-
error: typeof Schema.Defect;
|
|
7
7
|
}>;
|
|
8
8
|
export declare class GraphqlIntrospectionError extends GraphqlIntrospectionError_base {
|
|
9
9
|
}
|
|
@@ -14,15 +14,13 @@ declare const GraphqlExtractionError_base: Schema.TaggedErrorClass<GraphqlExtrac
|
|
|
14
14
|
}>;
|
|
15
15
|
export declare class GraphqlExtractionError extends GraphqlExtractionError_base {
|
|
16
16
|
}
|
|
17
|
-
declare const GraphqlInvocationError_base:
|
|
18
|
-
readonly _tag:
|
|
19
|
-
} &
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}>;
|
|
26
|
-
export declare class GraphqlInvocationError extends GraphqlInvocationError_base {
|
|
17
|
+
declare const GraphqlInvocationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
18
|
+
readonly _tag: "GraphqlInvocationError";
|
|
19
|
+
} & Readonly<A>;
|
|
20
|
+
export declare class GraphqlInvocationError extends GraphqlInvocationError_base<{
|
|
21
|
+
readonly message: string;
|
|
22
|
+
readonly statusCode: Option.Option<number>;
|
|
23
|
+
readonly cause?: unknown;
|
|
24
|
+
}> {
|
|
27
25
|
}
|
|
28
26
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@executor-js/plugin-graphql",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.1-beta.
|
|
4
|
+
"version": "0.0.1-beta.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@effect/platform": "^0.96.0",
|
|
37
37
|
"@effect/platform-node": "^0.106.0",
|
|
38
|
-
"@executor-js/sdk": "0.0.1-beta.
|
|
38
|
+
"@executor-js/sdk": "0.0.1-beta.5",
|
|
39
39
|
"effect": "^3.21.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sdk/errors.ts","../src/sdk/introspect.ts","../src/sdk/types.ts","../src/sdk/extract.ts","../src/sdk/invoke.ts","../src/sdk/kv-operation-store.ts","../src/sdk/plugin.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nexport class GraphqlIntrospectionError extends Schema.TaggedError<GraphqlIntrospectionError>()(\n \"GraphqlIntrospectionError\",\n {\n message: Schema.String,\n error: Schema.Defect,\n },\n) {}\n\nexport class GraphqlExtractionError extends Schema.TaggedError<GraphqlExtractionError>()(\n \"GraphqlExtractionError\",\n {\n message: Schema.String,\n },\n) {}\n\nexport class GraphqlInvocationError extends Schema.TaggedError<GraphqlInvocationError>()(\n \"GraphqlInvocationError\",\n {\n message: Schema.String,\n statusCode: Schema.optionalWith(Schema.Number, { as: \"Option\" }),\n error: Schema.Defect,\n },\n) {}\n","import { Effect } from \"effect\";\nimport { HttpClient, HttpClientRequest } from \"@effect/platform\";\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\nexport interface IntrospectionTypeRef {\n readonly kind: string;\n readonly name: string | null;\n readonly ofType: IntrospectionTypeRef | null;\n}\n\nexport interface IntrospectionInputValue {\n readonly name: string;\n readonly description: string | null;\n readonly type: IntrospectionTypeRef;\n readonly defaultValue: string | null;\n}\n\nexport interface IntrospectionField {\n readonly name: string;\n readonly description: string | null;\n readonly args: readonly IntrospectionInputValue[];\n readonly type: IntrospectionTypeRef;\n}\n\nexport interface IntrospectionEnumValue {\n readonly name: string;\n readonly description: string | null;\n}\n\nexport interface IntrospectionType {\n readonly kind: string;\n readonly name: string;\n readonly description: string | null;\n readonly fields: readonly IntrospectionField[] | null;\n readonly inputFields: readonly IntrospectionInputValue[] | null;\n readonly enumValues: readonly IntrospectionEnumValue[] | null;\n}\n\nexport interface IntrospectionSchema {\n readonly queryType: { readonly name: string } | null;\n readonly mutationType: { readonly name: string } | null;\n readonly types: readonly IntrospectionType[];\n}\n\nexport interface IntrospectionResult {\n readonly __schema: IntrospectionSchema;\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) {\n const client = yield* HttpClient.HttpClient;\n\n let request = HttpClientRequest.post(endpoint).pipe(\n HttpClientRequest.setHeader(\"Content-Type\", \"application/json\"),\n HttpClientRequest.bodyUnsafeJson({\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.mapError(\n (err) =>\n new GraphqlIntrospectionError({\n message: `Failed to reach GraphQL endpoint: ${err.message}`,\n error: err,\n }),\n ),\n );\n\n if (response.status !== 200) {\n const body = yield* response.text.pipe(Effect.catchAll(() => Effect.succeed(\"\")));\n return yield* new GraphqlIntrospectionError({\n message: `Introspection failed with status ${response.status}: ${body}`,\n error: undefined,\n });\n }\n\n const raw = yield* response.json.pipe(\n Effect.mapError(\n (err) =>\n new GraphqlIntrospectionError({\n message: `Failed to parse introspection response as JSON`,\n error: err,\n }),\n ),\n );\n\n const json = raw as { data?: IntrospectionResult; errors?: unknown[] };\n\n if (json.errors && Array.isArray(json.errors) && json.errors.length > 0) {\n return yield* new GraphqlIntrospectionError({\n // @effect-diagnostics-next-line preferSchemaOverJson:off\n message: `Introspection returned errors: ${JSON.stringify(json.errors)}`,\n error: undefined,\n });\n }\n\n if (!json.data?.__schema) {\n return yield* new GraphqlIntrospectionError({\n message: \"Introspection response missing __schema\",\n error: undefined,\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 Effect.try({\n try: () => {\n const parsed = JSON.parse(text);\n // Accept both { data: { __schema } } and { __schema } formats\n const result = parsed.data ?? parsed;\n if (!result.__schema) {\n throw new Error(\"Missing __schema in introspection JSON\");\n }\n return result as IntrospectionResult;\n },\n catch: (err) =>\n new GraphqlIntrospectionError({\n message: `Failed to parse introspection JSON: ${err instanceof Error ? err.message : String(err)}`,\n error: err,\n }),\n });\n","import { Schema } from \"effect\";\n\n// ---------------------------------------------------------------------------\n// GraphQL operation kind\n// ---------------------------------------------------------------------------\n\nexport const GraphqlOperationKind = Schema.Literal(\"query\", \"mutation\");\nexport type GraphqlOperationKind = typeof GraphqlOperationKind.Type;\n\n// ---------------------------------------------------------------------------\n// Extracted field (becomes a tool)\n// ---------------------------------------------------------------------------\n\nexport class GraphqlArgument extends Schema.Class<GraphqlArgument>(\n \"GraphqlArgument\",\n)({\n name: Schema.String,\n typeName: Schema.String,\n required: Schema.Boolean,\n description: Schema.optionalWith(Schema.String, { as: \"Option\" }),\n}) {}\n\nexport class ExtractedField extends Schema.Class<ExtractedField>(\n \"ExtractedField\",\n)({\n /** e.g. \"user\", \"createUser\" */\n fieldName: Schema.String,\n /** \"query\" or \"mutation\" */\n kind: GraphqlOperationKind,\n description: Schema.optionalWith(Schema.String, { as: \"Option\" }),\n arguments: Schema.Array(GraphqlArgument),\n /** JSON Schema for the input (built from arguments) */\n inputSchema: Schema.optionalWith(Schema.Unknown, { as: \"Option\" }),\n /** The return type name for documentation */\n returnTypeName: Schema.String,\n}) {}\n\nexport class ExtractionResult extends Schema.Class<ExtractionResult>(\n \"ExtractionResult\",\n)({\n /** Schema name from introspection */\n schemaName: Schema.optionalWith(Schema.String, { as: \"Option\" }),\n fields: Schema.Array(ExtractedField),\n}) {}\n\n// ---------------------------------------------------------------------------\n// Operation binding — minimal data needed to invoke\n// ---------------------------------------------------------------------------\n\nexport class OperationBinding extends Schema.Class<OperationBinding>(\n \"OperationBinding\",\n)({\n kind: GraphqlOperationKind,\n fieldName: Schema.String,\n /** The full GraphQL query/mutation string */\n operationString: Schema.String,\n /** Ordered variable names for mapping */\n variableNames: Schema.Array(Schema.String),\n}) {}\n\n// ---------------------------------------------------------------------------\n// Invocation\n// ---------------------------------------------------------------------------\n\nexport const HeaderValue = Schema.Union(\n Schema.String,\n Schema.Struct({\n secretId: Schema.String,\n prefix: Schema.optional(Schema.String),\n }),\n);\nexport type HeaderValue = typeof HeaderValue.Type;\n\nexport class InvocationConfig extends Schema.Class<InvocationConfig>(\n \"InvocationConfig\",\n)({\n /** The GraphQL endpoint URL */\n endpoint: Schema.String,\n /** Headers applied to every request. Values can reference secrets. */\n headers: Schema.optionalWith(\n Schema.Record({ key: Schema.String, value: HeaderValue }),\n { default: () => ({}) },\n ),\n}) {}\n\nexport class InvocationResult extends Schema.Class<InvocationResult>(\n \"InvocationResult\",\n)({\n status: Schema.Number,\n data: Schema.NullOr(Schema.Unknown),\n errors: Schema.NullOr(Schema.Unknown),\n}) {}\n","import { Effect, 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 =>\n 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 types: ReadonlyMap<string, IntrospectionType>,\n): Record<string, unknown> => {\n switch (ref.kind) {\n case \"NON_NULL\":\n return ref.ofType ? typeRefToJsonSchema(ref.ofType, types) : {};\n\n case \"LIST\":\n return {\n type: \"array\",\n items: ref.ofType ? typeRefToJsonSchema(ref.ofType, types) : {},\n };\n\n case \"SCALAR\":\n return scalarToJsonSchema(ref.name ?? \"String\");\n\n case \"ENUM\":\n // Reference the shared definition\n return ref.name ? { $ref: `#/$defs/${ref.name}` } : { type: \"string\" };\n\n case \"INPUT_OBJECT\":\n // Reference the shared definition — no recursive expansion needed\n return ref.name ? { $ref: `#/$defs/${ref.name}` } : { type: \"object\" };\n\n case \"OBJECT\":\n case \"INTERFACE\":\n case \"UNION\":\n return { type: \"object\" };\n\n default:\n return {};\n }\n};\n\nconst scalarToJsonSchema = (name: string): Record<string, unknown> => {\n switch (name) {\n case \"String\":\n case \"ID\":\n return { type: \"string\" };\n case \"Int\":\n return { type: \"integer\" };\n case \"Float\":\n return { type: \"number\" };\n case \"Boolean\":\n return { type: \"boolean\" };\n default:\n return { 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 switch (ref.kind) {\n case \"NON_NULL\":\n return ref.ofType ? `${formatTypeRef(ref.ofType)}!` : \"Unknown!\";\n case \"LIST\":\n return ref.ofType ? `[${formatTypeRef(ref.ofType)}]` : \"[Unknown]\";\n default:\n return ref.name ?? \"Unknown\";\n }\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(\n (arg) =>\n new GraphqlArgument({\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 new ExtractedField({\n fieldName: field.name,\n kind,\n description: field.description\n ? Option.some(field.description)\n : 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(\n schema,\n \"query\",\n schema.queryType?.name,\n typeMap,\n );\n const mutationFields = extractFields(\n schema,\n \"mutation\",\n schema.mutationType?.name,\n typeMap,\n );\n\n return {\n result: new ExtractionResult({\n schemaName: Option.none(),\n fields: [...queryFields, ...mutationFields],\n }),\n definitions,\n };\n },\n catch: (err) =>\n new GraphqlExtractionError({\n message: `Failed to extract GraphQL schema: ${err instanceof Error ? err.message : String(err)}`,\n }),\n });\n","import { Effect, Layer, Option } from \"effect\";\nimport { HttpClient, HttpClientRequest } from \"@effect/platform\";\n\nimport {\n type ToolId,\n type ToolInvoker,\n ToolInvocationResult,\n ToolInvocationError,\n type ScopeId,\n type SecretId,\n} from \"@executor-js/sdk/core\";\n\nimport { GraphqlInvocationError } from \"./errors\";\nimport type { GraphqlOperationStore } from \"./operation-store\";\nimport {\n type HeaderValue,\n type OperationBinding,\n InvocationConfig,\n InvocationResult,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Header resolution — resolves secret refs at invocation time\n// ---------------------------------------------------------------------------\n\nconst resolveHeaders = (\n headers: Record<string, HeaderValue>,\n secrets: { readonly resolve: (secretId: SecretId, scopeId: ScopeId) => Effect.Effect<string, unknown> },\n scopeId: ScopeId,\n): Effect.Effect<Record<string, string>, ToolInvocationError> =>\n Effect.gen(function* () {\n const resolved: Record<string, string> = {};\n for (const [name, value] of Object.entries(headers)) {\n if (typeof value === \"string\") {\n resolved[name] = value;\n } else {\n const secret = yield* secrets.resolve(value.secretId as SecretId, scopeId).pipe(\n Effect.mapError(() =>\n new ToolInvocationError({\n toolId: \"\" as ToolId,\n message: `Failed to resolve secret \"${value.secretId}\" for header \"${name}\"`,\n cause: undefined,\n }),\n ),\n );\n resolved[name] = value.prefix ? `${value.prefix}${secret}` : secret;\n }\n }\n return resolved;\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\" ||\n normalized.includes(\"+json\") ||\n 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 config: InvocationConfig,\n resolvedHeaders?: Record<string, string>,\n) {\n const client = yield* HttpClient.HttpClient;\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(config.endpoint).pipe(\n HttpClientRequest.setHeader(\"Content-Type\", \"application/json\"),\n HttpClientRequest.bodyUnsafeJson({\n query: operation.operationString,\n variables: Object.keys(variables).length > 0 ? variables : undefined,\n }),\n );\n\n // Apply resolved headers\n if (resolvedHeaders) {\n for (const [name, value] of Object.entries(resolvedHeaders)) {\n request = HttpClientRequest.setHeader(request, name, value);\n }\n }\n\n const response = yield* client.execute(request).pipe(\n Effect.mapError(\n (err) =>\n new GraphqlInvocationError({\n message: `GraphQL request failed: ${err.message}`,\n statusCode: Option.none(),\n error: 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.catchAll(() => 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 return new InvocationResult({\n status,\n data: gqlBody?.data ?? null,\n errors: hasErrors ? gqlBody!.errors : null,\n });\n});\n\n// ---------------------------------------------------------------------------\n// ToolInvoker — bridges operation store + HTTP client into SDK invoker\n// ---------------------------------------------------------------------------\n\nexport const makeGraphqlInvoker = (opts: {\n readonly operationStore: GraphqlOperationStore;\n readonly httpClientLayer: Layer.Layer<HttpClient.HttpClient>;\n readonly secrets: { readonly resolve: (secretId: SecretId, scopeId: ScopeId) => Effect.Effect<string, unknown> };\n readonly scopeId: ScopeId;\n}): ToolInvoker => ({\n resolveAnnotations: (toolId: ToolId) =>\n Effect.gen(function* () {\n const entry = yield* opts.operationStore.get(toolId);\n if (!entry) return undefined;\n // Mutations require approval, queries don't\n if (entry.binding.kind === \"mutation\") {\n return {\n requiresApproval: true,\n approvalDescription: `mutation ${entry.binding.fieldName}`,\n };\n }\n return {};\n }),\n\n invoke: (toolId: ToolId, args: unknown) =>\n Effect.gen(function* () {\n const entry = yield* opts.operationStore.get(toolId);\n if (!entry) {\n return yield* new ToolInvocationError({\n toolId,\n message: `No GraphQL operation found for tool \"${toolId}\"`,\n cause: undefined,\n });\n }\n\n const { binding, config } = entry;\n\n // Resolve secret-backed headers\n const resolvedHeaders = yield* resolveHeaders(\n config.headers,\n opts.secrets,\n opts.scopeId,\n );\n\n const result = yield* invoke(\n binding,\n (args ?? {}) as Record<string, unknown>,\n config,\n resolvedHeaders,\n ).pipe(Effect.provide(opts.httpClientLayer));\n\n return new ToolInvocationResult({\n data: result.data,\n error: result.errors,\n status: result.status,\n });\n }).pipe(\n Effect.catchAll((err) => {\n if (\n typeof err === \"object\" &&\n err !== null &&\n \"_tag\" in err &&\n (err as { _tag: string })._tag === \"ToolInvocationError\"\n ) {\n return Effect.fail(err as ToolInvocationError);\n }\n return Effect.fail(\n new ToolInvocationError({\n toolId,\n message: `GraphQL invocation failed: ${err instanceof Error ? err.message : String(err)}`,\n cause: err,\n }),\n );\n }),\n ),\n});\n","// ---------------------------------------------------------------------------\n// KV-backed GraphqlOperationStore\n// ---------------------------------------------------------------------------\n\nimport { Effect, Schema } from \"effect\";\nimport { scopeKv, makeInMemoryScopedKv, type Kv, type ToolId, type ScopedKv } from \"@executor-js/sdk/core\";\n\nimport type { GraphqlOperationStore, StoredSource } from \"./operation-store\";\nimport { OperationBinding, InvocationConfig, HeaderValue } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Stored schemas\n// ---------------------------------------------------------------------------\n\nclass StoredEntry extends Schema.Class<StoredEntry>(\"StoredEntry\")({\n namespace: Schema.String,\n binding: OperationBinding,\n config: InvocationConfig,\n}) {}\n\nconst encodeEntry = Schema.encodeSync(Schema.parseJson(StoredEntry));\nconst decodeEntry = Schema.decodeUnknownSync(Schema.parseJson(StoredEntry));\n\nconst StoredSourceSchema = Schema.Struct({\n namespace: Schema.String,\n name: Schema.String,\n config: Schema.Struct({\n endpoint: Schema.String,\n introspectionJson: Schema.optional(Schema.String),\n namespace: Schema.optional(Schema.String),\n headers: Schema.optional(\n Schema.Record({ key: Schema.String, value: HeaderValue }),\n ),\n }),\n});\nconst encodeSource = Schema.encodeSync(Schema.parseJson(StoredSourceSchema));\nconst decodeSource = Schema.decodeUnknownSync(Schema.parseJson(StoredSourceSchema));\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\nconst makeStore = (\n bindings: ScopedKv,\n sources: ScopedKv,\n): GraphqlOperationStore => ({\n get: (toolId) =>\n Effect.gen(function* () {\n const raw = yield* bindings.get(toolId);\n if (!raw) return null;\n const entry = decodeEntry(raw);\n return { binding: entry.binding, config: entry.config };\n }),\n\n put: (toolId, namespace, binding, config) =>\n bindings.set(\n toolId,\n encodeEntry(new StoredEntry({ namespace, binding, config })),\n ),\n\n remove: (toolId) => bindings.delete(toolId).pipe(Effect.asVoid),\n\n listByNamespace: (namespace) =>\n Effect.gen(function* () {\n const entries = yield* bindings.list();\n const ids: ToolId[] = [];\n for (const e of entries) {\n const entry = decodeEntry(e.value);\n if (entry.namespace === namespace) ids.push(e.key as ToolId);\n }\n return ids;\n }),\n\n removeByNamespace: (namespace) =>\n Effect.gen(function* () {\n const entries = yield* bindings.list();\n const ids: ToolId[] = [];\n for (const e of entries) {\n const entry = decodeEntry(e.value);\n if (entry.namespace === namespace) {\n ids.push(e.key as ToolId);\n yield* bindings.delete(e.key);\n }\n }\n return ids;\n }),\n\n putSource: (source) =>\n sources.set(source.namespace, encodeSource(source)),\n\n removeSource: (namespace) =>\n sources.delete(namespace).pipe(Effect.asVoid),\n\n listSources: () =>\n Effect.gen(function* () {\n const entries = yield* sources.list();\n return entries.map((e) => decodeSource(e.value) as StoredSource);\n }),\n});\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nexport const makeKvOperationStore = (\n kv: Kv,\n namespace: string,\n): GraphqlOperationStore =>\n makeStore(\n scopeKv(kv, `${namespace}.bindings`),\n scopeKv(kv, `${namespace}.sources`),\n );\n\nexport const makeInMemoryOperationStore = (): GraphqlOperationStore =>\n makeStore(\n makeInMemoryScopedKv(),\n makeInMemoryScopedKv(),\n );\n","import { Effect, Option, Schema } from \"effect\";\nimport { FetchHttpClient, HttpClient } from \"@effect/platform\";\nimport type { Layer } from \"effect\";\n\nimport {\n Source,\n SourceDetectionResult,\n definePlugin,\n registerRuntimeTools,\n runtimeTool,\n type ExecutorPlugin,\n type PluginContext,\n ToolId,\n type SecretId,\n type ToolRegistration,\n} from \"@executor-js/sdk/core\";\n\nimport { introspect, parseIntrospectionJson, type IntrospectionResult, type IntrospectionType, type IntrospectionField } from \"./introspect\";\nimport { extract } from \"./extract\";\nimport {\n GraphqlExtractionError,\n} from \"./errors\";\nimport { makeGraphqlInvoker } from \"./invoke\";\nimport type { GraphqlOperationStore } from \"./operation-store\";\nimport { makeInMemoryOperationStore } from \"./kv-operation-store\";\nimport {\n ExtractedField,\n HeaderValue as HeaderValueSchema,\n InvocationConfig,\n OperationBinding,\n type HeaderValue as HeaderValueValue,\n type GraphqlOperationKind,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Plugin config\n// ---------------------------------------------------------------------------\n\nexport type HeaderValue = HeaderValueValue;\n\nexport interface GraphqlSourceConfig {\n /** The GraphQL endpoint URL */\n readonly endpoint: string;\n /** Optional: introspection JSON text (if endpoint doesn't support introspection) */\n readonly introspectionJson?: string;\n /** Namespace for the tools (derived from endpoint if not provided) */\n readonly namespace?: string;\n /** Headers applied to every request. Values can reference secrets. */\n readonly headers?: Record<string, HeaderValue>;\n}\n\n// ---------------------------------------------------------------------------\n// Plugin extension\n// ---------------------------------------------------------------------------\n\nexport interface GraphqlPluginExtension {\n /** Add a GraphQL endpoint and register its operations as tools */\n readonly addSource: (\n config: GraphqlSourceConfig,\n ) => Effect.Effect<{ readonly toolCount: number }, Error>;\n\n /** Remove all tools from a previously added GraphQL source by namespace */\n readonly removeSource: (namespace: string) => Effect.Effect<void>;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nconst AddSourceInputSchema = Schema.Struct({\n endpoint: Schema.String,\n introspectionJson: Schema.optional(Schema.String),\n namespace: Schema.optional(Schema.String),\n headers: Schema.optional(\n Schema.Record({ key: Schema.String, value: HeaderValueSchema }),\n ),\n});\ntype AddSourceInput = typeof AddSourceInputSchema.Type;\n\nconst AddSourceOutputSchema = Schema.Struct({\n sourceId: Schema.String,\n toolCount: Schema.Number,\n});\n\n/** Derive a namespace from an endpoint URL */\nconst namespaceFromEndpoint = (endpoint: string): string => {\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 buildOperationStringForField = (\n kind: GraphqlOperationKind,\n field: IntrospectionField,\n types: ReadonlyMap<string, IntrospectionType>,\n): string => {\n const opType = kind === \"query\" ? \"query\" : \"mutation\";\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}${varDefsStr} { ${field.name}${argPassStr}${selectionSet ? ` ${selectionSet}` : \"\"} }`;\n};\n\nimport type { IntrospectionTypeRef } from \"./introspect\";\n\nconst formatTypeRef = (ref: IntrospectionTypeRef): string => {\n switch (ref.kind) {\n case \"NON_NULL\":\n return ref.ofType ? `${formatTypeRef(ref.ofType)}!` : \"Unknown!\";\n case \"LIST\":\n return ref.ofType ? `[${formatTypeRef(ref.ofType)}]` : \"[Unknown]\";\n default:\n return ref.name ?? \"Unknown\";\n }\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) => !f.name.startsWith(\"__\"))\n .slice(0, 12)\n .map((f) => {\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\nconst toRegistration = (\n field: ExtractedField,\n namespace: string,\n): ToolRegistration => {\n const prefix = field.kind === \"mutation\" ? \"mutation\" : \"query\";\n const toolPath = `${prefix}.${field.fieldName}`;\n const description = Option.getOrElse(field.description, () =>\n `GraphQL ${field.kind}: ${field.fieldName} -> ${field.returnTypeName}`,\n );\n\n return {\n id: ToolId.make(`${namespace}.${toolPath}`),\n pluginKey: \"graphql\",\n sourceId: namespace,\n name: toolPath,\n description,\n inputSchema: Option.getOrUndefined(field.inputSchema),\n outputSchema: undefined,\n };\n};\n\n// ---------------------------------------------------------------------------\n// Plugin factory\n// ---------------------------------------------------------------------------\n\nexport const graphqlPlugin = (options?: {\n readonly httpClientLayer?: Layer.Layer<HttpClient.HttpClient>;\n readonly operationStore?: GraphqlOperationStore;\n}): ExecutorPlugin<\"graphql\", GraphqlPluginExtension> => {\n const httpClientLayer = options?.httpClientLayer ?? FetchHttpClient.layer;\n const operationStore =\n options?.operationStore ?? makeInMemoryOperationStore();\n\n return definePlugin({\n key: \"graphql\",\n init: (ctx: PluginContext) =>\n Effect.gen(function* () {\n yield* ctx.tools.registerInvoker(\n \"graphql\",\n makeGraphqlInvoker({\n operationStore,\n httpClientLayer,\n secrets: ctx.secrets,\n scopeId: ctx.scope.id,\n }),\n );\n\n yield* ctx.sources.addManager({\n kind: \"graphql\",\n\n list: () =>\n operationStore.listSources().pipe(\n Effect.map((metas) =>\n metas.map(\n (s) =>\n new Source({\n id: s.namespace,\n name: s.name,\n kind: \"graphql\",\n runtime: false,\n canRemove: true,\n canRefresh: false,\n }),\n ),\n ),\n ),\n\n remove: (sourceId: string) =>\n Effect.gen(function* () {\n yield* operationStore.removeByNamespace(sourceId);\n yield* operationStore.removeSource(sourceId);\n yield* ctx.tools.unregisterBySource(sourceId);\n }),\n\n detect: (url: string) =>\n Effect.gen(function* () {\n const trimmed = url.trim();\n if (!trimmed) return null;\n const parsed = yield* Effect.try(() => new URL(trimmed)).pipe(Effect.option);\n if (parsed._tag === \"None\") return null;\n\n const ok = yield* introspect(trimmed).pipe(\n Effect.provide(httpClientLayer),\n Effect.map(() => true),\n Effect.catchAll(() => Effect.succeed(false)),\n );\n\n if (!ok) return null;\n\n const name = namespaceFromEndpoint(trimmed);\n return new SourceDetectionResult({\n kind: \"graphql\",\n confidence: \"high\",\n endpoint: trimmed,\n name,\n namespace: name,\n });\n }),\n });\n\n const addSourceInternal = (config: GraphqlSourceConfig) =>\n Effect.gen(function* () {\n // Get introspection result — either by querying the endpoint or parsing provided JSON\n let introspectionResult: IntrospectionResult;\n if (config.introspectionJson) {\n introspectionResult = yield* parseIntrospectionJson(config.introspectionJson);\n } else {\n // Resolve all headers (including secret refs) for introspection\n const resolvedHeaders: Record<string, string> = {};\n if (config.headers) {\n for (const [name, value] of Object.entries(config.headers)) {\n if (typeof value === \"string\") {\n resolvedHeaders[name] = value;\n } else {\n const secret = yield* ctx.secrets\n .resolve(value.secretId as SecretId, ctx.scope.id)\n .pipe(Effect.catchAll(() => Effect.succeed(\"\")));\n if (secret) {\n resolvedHeaders[name] = value.prefix\n ? `${value.prefix}${secret}`\n : secret;\n }\n }\n }\n }\n\n introspectionResult = yield* introspect(\n config.endpoint,\n Object.keys(resolvedHeaders).length > 0 ? resolvedHeaders : undefined,\n ).pipe(Effect.provide(httpClientLayer));\n }\n\n const { result, definitions } = yield* extract(introspectionResult);\n const namespace = config.namespace ?? namespaceFromEndpoint(config.endpoint);\n\n // Register shared JSON Schema definitions ($ref targets)\n if (Object.keys(definitions).length > 0) {\n yield* ctx.tools.registerDefinitions(definitions);\n }\n\n const invocationConfig = new InvocationConfig({\n endpoint: config.endpoint,\n headers: config.headers ?? {},\n });\n\n // Build type map for operation string generation\n const typeMap = new Map<string, IntrospectionType>();\n for (const t of introspectionResult.__schema.types) {\n typeMap.set(t.name, t);\n }\n\n // Build field map for operation strings\n const fieldMap = new Map<string, { kind: GraphqlOperationKind; field: IntrospectionField }>();\n const schema = introspectionResult.__schema;\n\n for (const rootKind of [\"query\", \"mutation\"] as const) {\n const typeName = rootKind === \"query\"\n ? schema.queryType?.name\n : 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 const registrations: ToolRegistration[] = [];\n\n yield* Effect.forEach(\n result.fields,\n (extractedField) => {\n const reg = toRegistration(extractedField, namespace);\n registrations.push(reg);\n\n const key = `${extractedField.kind}.${extractedField.fieldName}`;\n const entry = fieldMap.get(key);\n\n const operationString = entry\n ? buildOperationStringForField(entry.kind, entry.field, typeMap)\n : `${extractedField.kind} { ${extractedField.fieldName} }`;\n\n const binding = new OperationBinding({\n kind: extractedField.kind,\n fieldName: extractedField.fieldName,\n operationString,\n variableNames: extractedField.arguments.map((a) => a.name),\n });\n\n return operationStore.put(reg.id, namespace, binding, invocationConfig);\n },\n { discard: true },\n );\n\n yield* ctx.tools.register(registrations);\n\n yield* operationStore.putSource({\n namespace,\n name: namespace,\n config: {\n endpoint: config.endpoint,\n introspectionJson: config.introspectionJson,\n namespace: config.namespace,\n headers: config.headers,\n },\n });\n\n return { sourceId: namespace, toolCount: registrations.length };\n });\n\n const runtimeTools = yield* registerRuntimeTools({\n registry: ctx.tools,\n sources: ctx.sources,\n pluginKey: \"graphql\",\n source: {\n id: \"built-in\",\n name: \"Built In\",\n kind: \"built-in\",\n },\n tools: [\n runtimeTool({\n id: \"graphql.addSource\",\n name: \"graphql.addSource\",\n description:\n \"Add a GraphQL endpoint and register its operations as tools\",\n inputSchema: AddSourceInputSchema,\n outputSchema: AddSourceOutputSchema,\n handler: (input: AddSourceInput) => addSourceInternal(input),\n }),\n ],\n });\n\n return {\n extension: {\n addSource: (config: GraphqlSourceConfig) =>\n addSourceInternal(config).pipe(\n Effect.map(({ toolCount }) => ({ toolCount })),\n Effect.mapError(\n (err) =>\n new GraphqlExtractionError({\n message:\n err instanceof Error ? err.message : String(err),\n }),\n ),\n ),\n\n removeSource: (namespace: string) =>\n Effect.gen(function* () {\n const toolIds =\n yield* operationStore.removeByNamespace(namespace);\n if (toolIds.length > 0) {\n yield* ctx.tools.unregister(toolIds);\n }\n yield* operationStore.removeSource(namespace);\n }),\n },\n\n close: () => runtimeTools.close(),\n };\n }),\n });\n};\n"],"mappings":";AAAA,SAAS,cAAc;AAEhB,IAAM,4BAAN,cAAwC,OAAO,YAAuC;AAAA,EAC3F;AAAA,EACA;AAAA,IACE,SAAS,OAAO;AAAA,IAChB,OAAO,OAAO;AAAA,EAChB;AACF,EAAE;AAAC;AAEI,IAAM,yBAAN,cAAqC,OAAO,YAAoC;AAAA,EACrF;AAAA,EACA;AAAA,IACE,SAAS,OAAO;AAAA,EAClB;AACF,EAAE;AAAC;AAEI,IAAM,yBAAN,cAAqC,OAAO,YAAoC;AAAA,EACrF;AAAA,EACA;AAAA,IACE,SAAS,OAAO;AAAA,IAChB,YAAY,OAAO,aAAa,OAAO,QAAQ,EAAE,IAAI,SAAS,CAAC;AAAA,IAC/D,OAAO,OAAO;AAAA,EAChB;AACF,EAAE;AAAC;;;ACxBH,SAAS,cAAc;AACvB,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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B,qBAAO,IAAI,MAAM,WAAW,OAAO;AAAA,YACrC;AACA,mBAAO,eAAe,aAAa,SAAS;AAAA,UAC9C,CAAC;AAAA,QACL;AAAA,QAEA,OAAO,MAAM,aAAa,MAAM;AAAA,MAClC;AAAA,IACF,CAAC;AAAA,EACL,CAAC;AACH;","names":["Schema","Effect","Effect","Effect","Option","HttpClient","HttpClientRequest","Effect","HttpClient","HttpClientRequest","Option","Effect","Schema","Schema","Effect","Effect","Option","Schema","Schema","formatTypeRef","unwrapTypeName","Option","Effect"]}
|