@executor-js/plugin-graphql 0.0.1-beta.6 → 0.0.2
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 +25 -14
- package/dist/api/group.d.ts +138 -31
- package/dist/api/handlers.d.ts +2 -2
- package/dist/chunk-ILBZO52O.js +1090 -0
- package/dist/chunk-ILBZO52O.js.map +1 -0
- package/dist/core.js +12 -50
- package/dist/core.js.map +1 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/dist/react/GraphqlSignInButton.d.ts +3 -0
- package/dist/react/atoms.d.ts +78 -0
- package/dist/react/client.d.ts +449 -3
- package/dist/react/defaults.d.ts +2 -0
- package/dist/react/source-plugin.d.ts +1 -1
- package/dist/sdk/errors.d.ts +6 -10
- package/dist/sdk/index.d.ts +4 -6
- package/dist/sdk/introspect.d.ts +2 -2
- package/dist/sdk/invoke.d.ts +7 -13
- package/dist/sdk/plugin.d.ts +118 -14
- package/dist/sdk/store.d.ts +94 -0
- package/dist/sdk/types.d.ts +57 -146
- package/package.json +10 -21
- package/dist/chunk-QEUTMVXO.js +0 -903
- package/dist/chunk-QEUTMVXO.js.map +0 -1
- package/dist/promise.d.ts +0 -7
- package/dist/sdk/config-file-store.d.ts +0 -10
- package/dist/sdk/extract.test.d.ts +0 -1
- package/dist/sdk/kv-operation-store.d.ts +0 -4
- package/dist/sdk/operation-store.d.ts +0 -29
- package/dist/sdk/plugin.test.d.ts +0 -1
- package/dist/sdk/stored-source.d.ts +0 -46
|
@@ -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/store.ts","../src/sdk/plugin.ts"],"sourcesContent":["import { Data, Schema } from \"effect\";\nimport type { Option } from \"effect\";\n\nexport class GraphqlIntrospectionError extends Schema.TaggedErrorClass<GraphqlIntrospectionError>()(\n \"GraphqlIntrospectionError\",\n {\n message: Schema.String,\n },\n) {}\n\nexport class GraphqlExtractionError extends Schema.TaggedErrorClass<GraphqlExtractionError>()(\n \"GraphqlExtractionError\",\n {\n message: Schema.String,\n },\n) {}\n\nexport class GraphqlInvocationError extends Data.TaggedError(\"GraphqlInvocationError\")<{\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/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\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 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.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 (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.tapCause((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 { Effect, Schema } from \"effect\";\nimport { SecretBackedValue } from \"@executor-js/sdk/core\";\n\n// ---------------------------------------------------------------------------\n// GraphQL operation kind\n// ---------------------------------------------------------------------------\n\nexport const GraphqlOperationKind = Schema.Literals([\"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>(\"GraphqlArgument\")({\n name: Schema.String,\n typeName: Schema.String,\n required: Schema.Boolean,\n description: Schema.OptionFromOptional(Schema.String),\n}) {}\n\nexport class ExtractedField extends Schema.Class<ExtractedField>(\"ExtractedField\")({\n /** e.g. \"user\", \"createUser\" */\n fieldName: Schema.String,\n /** \"query\" or \"mutation\" */\n kind: GraphqlOperationKind,\n description: Schema.OptionFromOptional(Schema.String),\n arguments: Schema.Array(GraphqlArgument),\n /** JSON Schema for the input (built from arguments) */\n inputSchema: Schema.OptionFromOptional(Schema.Unknown),\n /** The return type name for documentation */\n returnTypeName: Schema.String,\n}) {}\n\nexport class ExtractionResult extends Schema.Class<ExtractionResult>(\"ExtractionResult\")({\n /** Schema name from introspection */\n schemaName: Schema.OptionFromOptional(Schema.String),\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>(\"OperationBinding\")({\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 = SecretBackedValue;\nexport type HeaderValue = typeof HeaderValue.Type;\nexport const QueryParamValue = HeaderValue;\nexport type QueryParamValue = typeof QueryParamValue.Type;\n\n// ---------------------------------------------------------------------------\n// Source auth\n// ---------------------------------------------------------------------------\n\nexport const GraphqlSourceAuth = Schema.Union(\n [\n Schema.Struct({ kind: Schema.Literal(\"none\") }),\n Schema.Struct({\n kind: Schema.Literal(\"oauth2\"),\n connectionId: Schema.String,\n }),\n ],\n);\nexport type GraphqlSourceAuth = typeof GraphqlSourceAuth.Type;\n\nexport class InvocationConfig extends Schema.Class<InvocationConfig>(\"InvocationConfig\")({\n /** The GraphQL endpoint URL */\n endpoint: Schema.String,\n /** Headers applied to every request. Values can reference secrets. */\n headers: Schema.Record(Schema.String, HeaderValue).pipe(\n Schema.withDecodingDefault(Effect.succeed({})),\n Schema.withConstructorDefault(Effect.succeed({})),\n ),\n /** Query parameters applied to every request. Values can reference secrets. */\n queryParams: Schema.Record(Schema.String, QueryParamValue).pipe(\n Schema.withDecodingDefault(Effect.succeed({})),\n Schema.withConstructorDefault(Effect.succeed({})),\n ),\n}) {}\n\nexport class InvocationResult extends Schema.Class<InvocationResult>(\"InvocationResult\")({\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 => 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 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 ? 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: 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/unstable/http\";\nimport { resolveSecretBackedMap } from \"@executor-js/sdk/core\";\n\nimport { GraphqlInvocationError } from \"./errors\";\nimport { type HeaderValue, type OperationBinding, InvocationResult } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Header resolution — resolves secret refs at invocation time\n// ---------------------------------------------------------------------------\n\nexport const resolveHeaders = (\n headers: Record<string, HeaderValue>,\n secrets: { readonly get: (id: string) => Effect.Effect<string | null, unknown> },\n): Effect.Effect<Record<string, string>> => {\n const entries = Object.entries(headers);\n const secretCount = entries.reduce(\n (acc, [, value]) => (typeof value === \"string\" ? acc : acc + 1),\n 0,\n );\n return resolveSecretBackedMap({\n values: headers,\n getSecret: (secretId) =>\n secrets.get(secretId).pipe(Effect.catch(() => Effect.succeed(null))),\n missing: \"drop\",\n onMissing: (name) =>\n new GraphqlInvocationError({\n message: `Missing secret for header \"${name}\"`,\n statusCode: Option.none(),\n }),\n }).pipe(\n Effect.catch(() => Effect.succeed<Record<string, string> | undefined>(undefined)),\n Effect.map((resolved) => resolved ?? {}),\n Effect.withSpan(\"plugin.graphql.secret.resolve\", {\n attributes: {\n \"plugin.graphql.headers.total\": entries.length,\n \"plugin.graphql.headers.secret_count\": secretCount,\n },\n }),\n );\n};\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\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\n yield* Effect.annotateCurrentSpan({\n \"http.method\": \"POST\",\n \"http.url\": requestEndpoint,\n \"plugin.graphql.endpoint\": endpoint,\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: ${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.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 new InvocationResult({\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.mapError((err) =>\n err instanceof GraphqlInvocationError\n ? err\n : new GraphqlInvocationError({\n message: err instanceof Error ? err.message : String(err),\n statusCode: Option.none(),\n cause: err,\n }),\n ),\n Effect.withSpan(\"plugin.graphql.invoke\", {\n attributes: {\n \"plugin.graphql.endpoint\": endpoint,\n \"plugin.graphql.operation_kind\": operation.kind,\n \"plugin.graphql.field_name\": operation.fieldName,\n },\n }),\n );\n","import { Effect } from \"effect\";\n\nimport {\n defineSchema,\n type StorageDeps,\n type StorageFailure,\n} from \"@executor-js/sdk/core\";\n\nimport {\n OperationBinding,\n type GraphqlSourceAuth,\n type HeaderValue,\n type QueryParamValue,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Schema — two tables:\n// - graphql_source: endpoint + headers + display name per source\n// - graphql_operation: per-tool OperationBinding blob keyed by tool id\n// ---------------------------------------------------------------------------\n\nexport const graphqlSchema = defineSchema({\n graphql_source: {\n fields: {\n id: { type: \"string\", required: true },\n scope_id: { type: \"string\", required: true, index: true },\n name: { type: \"string\", required: true },\n endpoint: { type: \"string\", required: true },\n headers: { type: \"json\", required: false },\n query_params: { type: \"json\", required: false },\n auth: { type: \"json\", required: false },\n },\n },\n graphql_operation: {\n fields: {\n id: { type: \"string\", required: true },\n scope_id: { type: \"string\", required: true, index: true },\n source_id: { type: \"string\", required: true, index: true },\n binding: { type: \"json\", required: true },\n },\n },\n});\n\nexport type GraphqlSchema = typeof graphqlSchema;\n\n// ---------------------------------------------------------------------------\n// In-memory value shapes\n// ---------------------------------------------------------------------------\n\nexport interface StoredGraphqlSource {\n readonly namespace: string;\n /** Executor scope id this source row lives in. Writes stamp this on\n * `scope_id`; reads return whichever scope's row the adapter's\n * fall-through walk surfaced first. */\n readonly scope: string;\n readonly name: string;\n readonly endpoint: string;\n readonly headers: Record<string, HeaderValue>;\n readonly queryParams: Record<string, QueryParamValue>;\n readonly auth: GraphqlSourceAuth;\n}\n\nexport interface StoredOperation {\n readonly toolId: string;\n readonly sourceId: string;\n readonly binding: OperationBinding;\n}\n\n// Persisted JSON shape for an OperationBinding. Reconstructed into a\n// Schema.Class instance on read.\ninterface BindingJson {\n readonly kind: \"query\" | \"mutation\";\n readonly fieldName: string;\n readonly operationString: string;\n readonly variableNames: readonly string[];\n}\n\nconst decodeBinding = (value: unknown): OperationBinding => {\n const data =\n typeof value === \"string\"\n ? (JSON.parse(value) as BindingJson)\n : (value as BindingJson);\n return new OperationBinding({\n kind: data.kind,\n fieldName: data.fieldName,\n operationString: data.operationString,\n variableNames: [...data.variableNames],\n });\n};\n\nconst encodeBinding = (binding: OperationBinding): BindingJson => ({\n kind: binding.kind,\n fieldName: binding.fieldName,\n operationString: binding.operationString,\n variableNames: [...binding.variableNames],\n});\n\nconst toJsonRecord = (value: unknown): Record<string, unknown> =>\n value as Record<string, unknown>;\n\nconst decodeHeaders = (value: unknown): Record<string, HeaderValue> => {\n if (value == null) return {};\n if (typeof value === \"string\")\n return JSON.parse(value) as Record<string, HeaderValue>;\n return value as Record<string, HeaderValue>;\n};\n\nconst decodeQueryParams = (value: unknown): Record<string, QueryParamValue> => {\n if (value == null) return {};\n if (typeof value === \"string\")\n return JSON.parse(value) as Record<string, QueryParamValue>;\n return value as Record<string, QueryParamValue>;\n};\n\nconst decodeAuth = (value: unknown): GraphqlSourceAuth => {\n if (value == null) return { kind: \"none\" };\n const parsed =\n typeof value === \"string\"\n ? (JSON.parse(value) as GraphqlSourceAuth)\n : (value as GraphqlSourceAuth);\n return parsed?.kind === \"oauth2\" && typeof parsed.connectionId === \"string\"\n ? { kind: \"oauth2\", connectionId: parsed.connectionId }\n : { kind: \"none\" };\n};\n\n// ---------------------------------------------------------------------------\n// Store interface\n// ---------------------------------------------------------------------------\n\n// Every read/write that targets a single row pins BOTH the natural id\n// (namespace, toolId) AND the owning `scope_id`. The store runs behind\n// the scoped adapter (which auto-injects `scope_id IN (stack)`), so a\n// bare `{id}` filter resolves to any matching row in the stack in\n// adapter-iteration order. For shadowed rows (same id at multiple\n// scopes — e.g. an org-level GraphQL source with a per-user override),\n// that's a scope-isolation bug: updates and deletes can land on the\n// wrong scope's row. Callers thread the resolved scope in (typically\n// `path.scopeId` for HTTP, `toolRow.scope_id` / `input.scope` for\n// invokeTool/lifecycle) so every keyed mutation targets exactly one\n// row.\nexport interface GraphqlStore {\n readonly upsertSource: (\n input: StoredGraphqlSource,\n operations: readonly StoredOperation[],\n ) => Effect.Effect<void, StorageFailure>;\n\n readonly updateSourceMeta: (\n namespace: string,\n scope: string,\n patch: {\n readonly name?: string;\n readonly endpoint?: string;\n readonly headers?: Record<string, HeaderValue>;\n readonly queryParams?: Record<string, QueryParamValue>;\n readonly auth?: GraphqlSourceAuth;\n },\n ) => Effect.Effect<void, StorageFailure>;\n\n readonly getSource: (\n namespace: string,\n scope: string,\n ) => Effect.Effect<StoredGraphqlSource | null, StorageFailure>;\n\n readonly listSources: () => Effect.Effect<\n readonly StoredGraphqlSource[],\n StorageFailure\n >;\n\n readonly getOperationByToolId: (\n toolId: string,\n scope: string,\n ) => Effect.Effect<StoredOperation | null, StorageFailure>;\n\n readonly listOperationsBySource: (\n sourceId: string,\n scope: string,\n ) => Effect.Effect<readonly StoredOperation[], StorageFailure>;\n\n readonly removeSource: (\n namespace: string,\n scope: string,\n ) => Effect.Effect<void, StorageFailure>;\n}\n\n// ---------------------------------------------------------------------------\n// Default store implementation\n// ---------------------------------------------------------------------------\n\nexport const makeDefaultGraphqlStore = ({\n adapter: db,\n}: StorageDeps<GraphqlSchema>): GraphqlStore => {\n const rowToSource = (row: Record<string, unknown>): StoredGraphqlSource => ({\n namespace: row.id as string,\n scope: row.scope_id as string,\n name: row.name as string,\n endpoint: row.endpoint as string,\n headers: decodeHeaders(row.headers),\n queryParams: decodeQueryParams(row.query_params),\n auth: decodeAuth(row.auth),\n });\n\n const rowToOperation = (row: Record<string, unknown>): StoredOperation => ({\n toolId: row.id as string,\n sourceId: row.source_id as string,\n binding: decodeBinding(row.binding),\n });\n\n const deleteSource = (namespace: string, scope: string) =>\n Effect.gen(function* () {\n yield* db.deleteMany({\n model: \"graphql_operation\",\n where: [\n { field: \"source_id\", value: namespace },\n { field: \"scope_id\", value: scope },\n ],\n });\n yield* db.delete({\n model: \"graphql_source\",\n where: [\n { field: \"id\", value: namespace },\n { field: \"scope_id\", value: scope },\n ],\n });\n });\n\n return {\n upsertSource: (input, operations) =>\n Effect.gen(function* () {\n yield* deleteSource(input.namespace, input.scope);\n yield* db.create({\n model: \"graphql_source\",\n data: {\n id: input.namespace,\n scope_id: input.scope,\n name: input.name,\n endpoint: input.endpoint,\n headers: input.headers,\n query_params: input.queryParams,\n auth: toJsonRecord(input.auth),\n },\n forceAllowId: true,\n });\n if (operations.length > 0) {\n yield* db.createMany({\n model: \"graphql_operation\",\n data: operations.map((op) => ({\n id: op.toolId,\n scope_id: input.scope,\n source_id: op.sourceId,\n binding: toJsonRecord(encodeBinding(op.binding)),\n })),\n forceAllowId: true,\n });\n }\n }),\n\n updateSourceMeta: (namespace, scope, patch) =>\n Effect.gen(function* () {\n const existing = yield* db.findOne({\n model: \"graphql_source\",\n where: [\n { field: \"id\", value: namespace },\n { field: \"scope_id\", value: scope },\n ],\n });\n if (!existing) return;\n const update: Record<string, unknown> = {};\n if (patch.name !== undefined) update.name = patch.name;\n if (patch.endpoint !== undefined) update.endpoint = patch.endpoint;\n if (patch.headers !== undefined) {\n update.headers = patch.headers;\n }\n if (patch.queryParams !== undefined) {\n update.query_params = patch.queryParams;\n }\n if (patch.auth !== undefined) {\n update.auth = toJsonRecord(patch.auth);\n }\n if (Object.keys(update).length === 0) return;\n yield* db.update({\n model: \"graphql_source\",\n where: [\n { field: \"id\", value: namespace },\n { field: \"scope_id\", value: scope },\n ],\n update,\n });\n }),\n\n getSource: (namespace, scope) =>\n db\n .findOne({\n model: \"graphql_source\",\n where: [\n { field: \"id\", value: namespace },\n { field: \"scope_id\", value: scope },\n ],\n })\n .pipe(Effect.map((row) => (row ? rowToSource(row) : null))),\n\n listSources: () =>\n db\n .findMany({ model: \"graphql_source\" })\n .pipe(Effect.map((rows) => rows.map(rowToSource))),\n\n getOperationByToolId: (toolId, scope) =>\n db\n .findOne({\n model: \"graphql_operation\",\n where: [\n { field: \"id\", value: toolId },\n { field: \"scope_id\", value: scope },\n ],\n })\n .pipe(Effect.map((row) => (row ? rowToOperation(row) : null))),\n\n listOperationsBySource: (sourceId, scope) =>\n db\n .findMany({\n model: \"graphql_operation\",\n where: [\n { field: \"source_id\", value: sourceId },\n { field: \"scope_id\", value: scope },\n ],\n })\n .pipe(Effect.map((rows) => rows.map(rowToOperation))),\n\n removeSource: (namespace, scope) => deleteSource(namespace, scope),\n };\n};\n","import { Effect, Option } from \"effect\";\nimport { FetchHttpClient, HttpClient } from \"effect/unstable/http\";\nimport type { Layer } from \"effect\";\n\nimport {\n definePlugin,\n SourceDetectionResult,\n type StorageFailure,\n type ToolAnnotations,\n type ToolRow,\n} from \"@executor-js/sdk/core\";\n\nimport {\n headersToConfigValues,\n type ConfigFileSink,\n type GraphqlSourceConfig as GraphqlConfigEntry,\n} from \"@executor-js/config\";\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 { GraphqlExtractionError, GraphqlIntrospectionError } from \"./errors\";\nimport { invokeWithLayer, resolveHeaders } from \"./invoke\";\nimport {\n graphqlSchema,\n makeDefaultGraphqlStore,\n type GraphqlStore,\n type StoredGraphqlSource,\n type StoredOperation,\n} from \"./store\";\nimport {\n ExtractedField,\n type GraphqlSourceAuth,\n OperationBinding,\n type HeaderValue as HeaderValueValue,\n type QueryParamValue,\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 /**\n * Executor scope id that owns this source row. Must be one of the\n * executor's configured scopes. Typical shape: an admin adds the\n * source at the outermost (organization) scope so it's visible to\n * every inner (per-user) scope via fall-through reads.\n */\n readonly scope: string;\n /** Display name for the source. Falls back to namespace if not provided. */\n readonly name?: 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 /** Query parameters applied to every request. Values can reference secrets. */\n readonly queryParams?: Record<string, QueryParamValue>;\n /** Optional OAuth2 connection used as a Bearer token for every request. */\n readonly auth?: GraphqlSourceAuth;\n}\n\n// ---------------------------------------------------------------------------\n// Plugin extension\n// ---------------------------------------------------------------------------\n\nexport interface GraphqlUpdateSourceInput {\n readonly name?: string;\n readonly endpoint?: string;\n readonly headers?: Record<string, HeaderValue>;\n readonly queryParams?: Record<string, QueryParamValue>;\n readonly auth?: GraphqlSourceAuth;\n}\n\n/**\n * Errors any GraphQL extension method may surface. `GraphqlIntrospectionError`\n * and `GraphqlExtractionError` are plugin-domain tagged errors that flow\n * directly to clients (4xx, each carrying its own `HttpApiSchema` status).\n * `StorageFailure` covers raw backend failures (`StorageError` plus\n * `UniqueViolationError`); the HTTP edge (`@executor-js/api`'s `withCapture`)\n * translates `StorageError` to the opaque `InternalError({ traceId })` at\n * Layer composition.\n */\nexport type GraphqlExtensionFailure =\n | GraphqlIntrospectionError\n | GraphqlExtractionError\n | StorageFailure;\n\nexport interface GraphqlPluginExtension {\n /** Add a GraphQL endpoint and register its operations as tools */\n readonly addSource: (\n config: GraphqlSourceConfig,\n ) => Effect.Effect<\n { readonly toolCount: number; readonly namespace: string },\n GraphqlExtensionFailure\n >;\n\n /** Remove all tools from a previously added GraphQL source by namespace.\n * `scope` pins the cleanup to the exact row — without it a shadowed\n * outer-scope source with the same namespace could be wiped instead. */\n readonly removeSource: (\n namespace: string,\n scope: string,\n ) => Effect.Effect<void, StorageFailure>;\n\n /** Fetch the full stored source by namespace (or null if missing).\n * `scope` returns the exact row at that scope. For fall-through\n * reads across the executor's scope stack, use `executor.sources.*`. */\n readonly getSource: (\n namespace: string,\n scope: string,\n ) => Effect.Effect<StoredGraphqlSource | null, StorageFailure>;\n\n /** Update config (endpoint, headers) for an existing GraphQL source.\n * Does NOT re-introspect or re-register tools — just patches the\n * stored endpoint/headers used at invoke time. `scope` pins the\n * mutation to a single row so shadowed rows at other scopes are\n * untouched. */\n readonly updateSource: (\n namespace: string,\n scope: string,\n input: GraphqlUpdateSourceInput,\n ) => Effect.Effect<void, StorageFailure>;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\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 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 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\ninterface PreparedOperation {\n readonly toolPath: 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<\n string,\n { kind: GraphqlOperationKind; field: IntrospectionField }\n >();\n const schema = introspection.__schema;\n for (const rootKind of [\"query\", \"mutation\"] as const) {\n const typeName =\n 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 const toolPath = `${prefix}.${extracted.fieldName}`;\n const description = Option.getOrElse(\n extracted.description,\n () =>\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} { ${extracted.fieldName} }`;\n\n const binding = new OperationBinding({\n kind: extracted.kind,\n fieldName: extracted.fieldName,\n operationString,\n variableNames: extracted.arguments.map((a) => a.name),\n });\n\n return {\n toolPath,\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// Plugin factory\n// ---------------------------------------------------------------------------\n\nexport interface GraphqlPluginOptions {\n readonly httpClientLayer?: Layer.Layer<HttpClient.HttpClient>;\n /** If provided, source add/remove is mirrored to executor.jsonc\n * (best-effort — file errors are logged, not raised). */\n readonly configFile?: ConfigFileSink;\n}\n\nconst toGraphqlConfigEntry = (\n namespace: string,\n config: GraphqlSourceConfig,\n): GraphqlConfigEntry => ({\n kind: \"graphql\",\n endpoint: config.endpoint,\n introspectionJson: config.introspectionJson,\n namespace,\n headers: headersToConfigValues(config.headers),\n});\n\nexport const graphqlPlugin = definePlugin((options?: GraphqlPluginOptions) => {\n const httpClientLayer = options?.httpClientLayer ?? FetchHttpClient.layer;\n\n return {\n id: \"graphql\" as const,\n schema: graphqlSchema,\n storage: (deps): GraphqlStore => makeDefaultGraphqlStore(deps),\n\n extension: (ctx) => {\n const resolveConfigValues = (\n values: Record<string, HeaderValue> | undefined,\n ) =>\n Effect.gen(function* () {\n if (!values) return undefined;\n const resolved = yield* resolveHeaders(values, ctx.secrets);\n return Object.keys(resolved).length > 0 ? resolved : undefined;\n });\n\n const resolveOAuthHeader = (auth: GraphqlSourceAuth | undefined) =>\n Effect.gen(function* () {\n if (!auth || auth.kind === \"none\") return undefined;\n const accessToken = yield* ctx.connections\n .accessToken(auth.connectionId)\n .pipe(\n Effect.mapError(\n (err) =>\n new GraphqlIntrospectionError({\n message: `Failed to resolve OAuth connection \"${auth.connectionId}\": ${\n \"message\" in err\n ? (err as { message: string }).message\n : String(err)\n }`,\n }),\n ),\n );\n return { Authorization: `Bearer ${accessToken}` };\n });\n\n const resolveRequestHeaders = (\n headers: Record<string, HeaderValue> | undefined,\n auth: GraphqlSourceAuth | undefined,\n ) =>\n Effect.gen(function* () {\n const resolvedHeaders = yield* resolveConfigValues(headers);\n const oauthHeader = yield* resolveOAuthHeader(auth);\n return { ...(resolvedHeaders ?? {}), ...(oauthHeader ?? {}) };\n });\n\n const addSourceInternal = (config: GraphqlSourceConfig) =>\n ctx.transaction(\n Effect.gen(function* () {\n let introspectionResult: IntrospectionResult;\n if (config.introspectionJson) {\n introspectionResult = yield* parseIntrospectionJson(\n config.introspectionJson,\n );\n } else {\n const resolvedHeaders = yield* resolveRequestHeaders(\n config.headers,\n config.auth,\n );\n const resolvedQueryParams = yield* resolveConfigValues(\n config.queryParams,\n );\n introspectionResult = yield* introspect(\n config.endpoint,\n Object.keys(resolvedHeaders).length > 0\n ? resolvedHeaders\n : undefined,\n resolvedQueryParams,\n ).pipe(Effect.provide(httpClientLayer));\n }\n\n const { result, definitions } = yield* extract(introspectionResult);\n const namespace =\n config.namespace ?? namespaceFromEndpoint(config.endpoint);\n const prepared = prepareOperations(\n result.fields,\n introspectionResult,\n );\n\n const displayName = config.name?.trim() || namespace;\n\n // Persist the source + per-operation bindings first so any\n // subsequent core-source register collision rolls back both.\n const storedSource: StoredGraphqlSource = {\n namespace,\n scope: config.scope,\n name: displayName,\n endpoint: config.endpoint,\n headers: config.headers ?? {},\n queryParams: config.queryParams ?? {},\n auth: config.auth ?? { kind: \"none\" },\n };\n\n const storedOps: StoredOperation[] = prepared.map((p) => ({\n toolId: `${namespace}.${p.toolPath}`,\n sourceId: namespace,\n binding: p.binding,\n }));\n\n yield* ctx.storage.upsertSource(storedSource, storedOps);\n\n yield* ctx.core.sources.register({\n id: namespace,\n scope: config.scope,\n kind: \"graphql\",\n name: displayName,\n url: config.endpoint,\n canRemove: true,\n canRefresh: false,\n canEdit: true,\n tools: prepared.map((p) => ({\n name: p.toolPath,\n description: p.description,\n inputSchema: p.inputSchema,\n })),\n });\n\n if (Object.keys(definitions).length > 0) {\n yield* ctx.core.definitions.register({\n sourceId: namespace,\n scope: config.scope,\n definitions,\n });\n }\n\n return { toolCount: prepared.length, namespace };\n }),\n );\n\n const configFile = options?.configFile;\n\n return {\n addSource: (config) =>\n addSourceInternal(config).pipe(\n Effect.tap((result) =>\n configFile\n ? configFile.upsertSource(\n toGraphqlConfigEntry(result.namespace, config),\n )\n : Effect.void,\n ),\n ),\n\n removeSource: (namespace, scope) =>\n Effect.gen(function* () {\n yield* ctx.transaction(\n Effect.gen(function* () {\n yield* ctx.storage.removeSource(namespace, scope);\n yield* ctx.core.sources.unregister(namespace);\n }),\n );\n if (configFile) {\n yield* configFile.removeSource(namespace);\n }\n }),\n\n getSource: (namespace, scope) =>\n ctx.storage.getSource(namespace, scope),\n\n updateSource: (namespace, scope, input) =>\n ctx.storage.updateSourceMeta(namespace, scope, {\n name: input.name?.trim() || undefined,\n endpoint: input.endpoint,\n headers: input.headers,\n queryParams: input.queryParams,\n auth: input.auth,\n }),\n } satisfies GraphqlPluginExtension;\n },\n\n staticSources: (self) => [\n {\n id: \"graphql\",\n kind: \"control\",\n name: \"GraphQL\",\n tools: [\n {\n name: \"addSource\",\n description:\n \"Add a GraphQL endpoint and register its operations as tools\",\n inputSchema: {\n type: \"object\",\n properties: {\n endpoint: { type: \"string\" },\n name: { type: \"string\" },\n introspectionJson: { type: \"string\" },\n namespace: { type: \"string\" },\n headers: { type: \"object\" },\n queryParams: { type: \"object\" },\n auth: { type: \"object\" },\n },\n required: [\"endpoint\"],\n },\n outputSchema: {\n type: \"object\",\n properties: {\n toolCount: { type: \"number\" },\n },\n required: [\"toolCount\"],\n },\n // Static-tool callers don't name a scope. Default to the\n // outermost scope in the executor's stack — for a single-\n // scope executor that's the only scope; for a per-user\n // stack `[user, org]` it writes at `org` so the source is\n // visible across every user.\n handler: ({ ctx, args }) =>\n self.addSource({\n ...(args as Omit<GraphqlSourceConfig, \"scope\">),\n scope: ctx.scopes.at(-1)!.id as string,\n }),\n },\n ],\n },\n ],\n\n invokeTool: ({ ctx, toolRow, args }) =>\n Effect.gen(function* () {\n // toolRow.scope_id is the resolved owning scope of the tool\n // (innermost-wins from the executor's stack). The matching\n // graphql_operation + graphql_source rows live at the same\n // scope, so pin every store lookup to it instead of relying\n // on the scoped adapter's stack-wide fall-through.\n const toolScope = toolRow.scope_id as string;\n const op = yield* ctx.storage.getOperationByToolId(\n toolRow.id,\n toolScope,\n );\n if (!op) {\n return yield* Effect.fail(\n new Error(`No GraphQL operation found for tool \"${toolRow.id}\"`),\n );\n }\n const source = yield* ctx.storage.getSource(op.sourceId, toolScope);\n if (!source) {\n return yield* Effect.fail(\n new Error(`No GraphQL source found for \"${op.sourceId}\"`),\n );\n }\n\n const resolvedHeaders = yield* resolveHeaders(\n source.headers,\n ctx.secrets,\n );\n const resolvedQueryParams = yield* resolveHeaders(\n source.queryParams,\n ctx.secrets,\n );\n if (source.auth.kind === \"oauth2\") {\n const accessToken = yield* ctx.connections.accessToken(\n source.auth.connectionId,\n );\n resolvedHeaders.Authorization = `Bearer ${accessToken}`;\n }\n\n const result = yield* invokeWithLayer(\n op.binding,\n (args ?? {}) as Record<string, unknown>,\n source.endpoint,\n resolvedHeaders,\n resolvedQueryParams,\n httpClientLayer,\n );\n\n return result;\n }),\n\n resolveAnnotations: ({ ctx, sourceId, toolRows }) =>\n Effect.gen(function* () {\n // toolRows for a single (plugin_id, source_id) group can still\n // straddle multiple scopes when the source is shadowed (e.g. an\n // org-level GraphQL source plus a per-user override that\n // re-registers the same tool ids). Run one listOperationsBySource\n // per distinct scope so each lookup pins {source_id, scope_id}\n // and we don't fall through to the wrong scope's bindings.\n const scopes = new Set<string>();\n for (const row of toolRows as readonly ToolRow[]) {\n scopes.add(row.scope_id as string);\n }\n // One listOperationsBySource per scope is independent storage\n // work; run them in parallel so a shadowed source doesn't\n // serialise two ~200ms reads back-to-back in the caller's\n // `executor.tools.list.annotations` span.\n const entries = yield* Effect.forEach(\n [...scopes],\n (scope) =>\n Effect.gen(function* () {\n const ops = yield* ctx.storage.listOperationsBySource(\n sourceId,\n scope,\n );\n const byId = new Map<string, OperationBinding>();\n for (const op of ops) byId.set(op.toolId, op.binding);\n return [scope, byId] as const;\n }),\n { concurrency: \"unbounded\" },\n );\n const byScope = new Map<string, Map<string, OperationBinding>>(entries);\n\n const out: Record<string, ToolAnnotations> = {};\n for (const row of toolRows as readonly ToolRow[]) {\n const binding = byScope.get(row.scope_id as string)?.get(row.id);\n if (binding) out[row.id] = annotationsFor(binding);\n }\n return out;\n }),\n\n removeSource: ({ ctx, sourceId, scope }) =>\n ctx.storage.removeSource(sourceId, scope),\n\n detect: ({ url }) =>\n Effect.gen(function* () {\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(\n Effect.option,\n );\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 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"],"mappings":";AAAA,SAAS,MAAM,cAAc;AAGtB,IAAM,4BAAN,cAAwC,OAAO,iBAA4C;AAAA,EAChG;AAAA,EACA;AAAA,IACE,SAAS,OAAO;AAAA,EAClB;AACF,EAAE;AAAC;AAEI,IAAM,yBAAN,cAAqC,OAAO,iBAAyC;AAAA,EAC1F;AAAA,EACA;AAAA,IACE,SAAS,OAAO;AAAA,EAClB;AACF,EAAE;AAAC;AAEI,IAAM,yBAAN,cAAqC,KAAK,YAAY,wBAAwB,EAIlF;AAAC;;;ACrBJ,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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,QAC/B,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,UAAU;AAAA,QACV;AAAA,QACA,WAAW;AAAA,MACb,CAAC;AAAA,IACH,CAAC;AAAA,EACL;AACF,CAAC;","names":["Effect","Schema","Effect","Effect","Effect","Option","HttpClient","HttpClientRequest","Effect","Option","HttpClient","HttpClientRequest","Effect","Effect","Effect","Option","formatTypeRef","unwrapTypeName","Option","Effect"]}
|
package/dist/core.js
CHANGED
|
@@ -6,60 +6,21 @@ import {
|
|
|
6
6
|
GraphqlIntrospectionError,
|
|
7
7
|
GraphqlInvocationError,
|
|
8
8
|
GraphqlOperationKind,
|
|
9
|
+
GraphqlSourceAuth,
|
|
9
10
|
HeaderValue,
|
|
10
11
|
InvocationConfig,
|
|
11
12
|
InvocationResult,
|
|
12
13
|
OperationBinding,
|
|
13
14
|
extract,
|
|
14
15
|
graphqlPlugin,
|
|
16
|
+
graphqlSchema,
|
|
15
17
|
introspect,
|
|
16
18
|
invoke,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
|
|
23
|
-
// src/sdk/config-file-store.ts
|
|
24
|
-
import { Effect } from "effect";
|
|
25
|
-
import { addSourceToConfig, removeSourceFromConfig, SECRET_REF_PREFIX } from "@executor/config";
|
|
26
|
-
var translateSecretHeaders = (headers) => {
|
|
27
|
-
if (!headers) return void 0;
|
|
28
|
-
const result = {};
|
|
29
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
30
|
-
if (typeof value === "string") {
|
|
31
|
-
result[key] = value;
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
const ref = `${SECRET_REF_PREFIX}${value.secretId}`;
|
|
35
|
-
result[key] = value.prefix ? { value: ref, prefix: value.prefix } : ref;
|
|
36
|
-
}
|
|
37
|
-
return result;
|
|
38
|
-
};
|
|
39
|
-
var toSourceConfig = (source) => ({
|
|
40
|
-
kind: "graphql",
|
|
41
|
-
endpoint: source.config.endpoint,
|
|
42
|
-
introspectionJson: source.config.introspectionJson,
|
|
43
|
-
namespace: source.namespace,
|
|
44
|
-
headers: translateSecretHeaders(source.config.headers)
|
|
45
|
-
});
|
|
46
|
-
var withConfigFile = (inner, configPath, fsLayer) => ({
|
|
47
|
-
...inner,
|
|
48
|
-
putSource: (source) => Effect.gen(function* () {
|
|
49
|
-
yield* inner.putSource(source);
|
|
50
|
-
yield* addSourceToConfig(configPath, toSourceConfig(source)).pipe(
|
|
51
|
-
Effect.provide(fsLayer),
|
|
52
|
-
Effect.catchAll(() => Effect.void)
|
|
53
|
-
);
|
|
54
|
-
}),
|
|
55
|
-
removeSource: (namespace) => Effect.gen(function* () {
|
|
56
|
-
yield* inner.removeSource(namespace);
|
|
57
|
-
yield* removeSourceFromConfig(configPath, namespace).pipe(
|
|
58
|
-
Effect.provide(fsLayer),
|
|
59
|
-
Effect.catchAll(() => Effect.void)
|
|
60
|
-
);
|
|
61
|
-
})
|
|
62
|
-
});
|
|
19
|
+
invokeWithLayer,
|
|
20
|
+
makeDefaultGraphqlStore,
|
|
21
|
+
parseIntrospectionJson,
|
|
22
|
+
resolveHeaders
|
|
23
|
+
} from "./chunk-ILBZO52O.js";
|
|
63
24
|
export {
|
|
64
25
|
ExtractedField,
|
|
65
26
|
ExtractionResult,
|
|
@@ -68,18 +29,19 @@ export {
|
|
|
68
29
|
GraphqlIntrospectionError,
|
|
69
30
|
GraphqlInvocationError,
|
|
70
31
|
GraphqlOperationKind,
|
|
32
|
+
GraphqlSourceAuth,
|
|
71
33
|
HeaderValue,
|
|
72
34
|
InvocationConfig,
|
|
73
35
|
InvocationResult,
|
|
74
36
|
OperationBinding,
|
|
75
37
|
extract,
|
|
76
38
|
graphqlPlugin,
|
|
39
|
+
graphqlSchema,
|
|
77
40
|
introspect,
|
|
78
41
|
invoke,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
makeKvOperationStore,
|
|
42
|
+
invokeWithLayer,
|
|
43
|
+
makeDefaultGraphqlStore,
|
|
82
44
|
parseIntrospectionJson,
|
|
83
|
-
|
|
45
|
+
resolveHeaders
|
|
84
46
|
};
|
|
85
47
|
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
graphqlPlugin
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
|
|
5
|
-
// src/promise.ts
|
|
6
|
-
var graphqlPlugin2 = (options) => graphqlPlugin(options);
|
|
3
|
+
} from "./chunk-ILBZO52O.js";
|
|
7
4
|
export {
|
|
8
|
-
|
|
5
|
+
graphqlPlugin
|
|
9
6
|
};
|
|
10
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ScopeId } from "@executor-js/sdk/core";
|
|
2
|
+
export declare const graphqlSourceAtom: (scopeId: ScopeId, namespace: string) => import("effect/unstable/reactivity/Atom").Atom<import("effect/unstable/reactivity/AsyncResult").AsyncResult<{
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly endpoint: string;
|
|
5
|
+
readonly namespace: string;
|
|
6
|
+
readonly headers: {
|
|
7
|
+
readonly [x: string]: string | {
|
|
8
|
+
readonly secretId: string;
|
|
9
|
+
readonly prefix?: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
readonly queryParams: {
|
|
13
|
+
readonly [x: string]: string | {
|
|
14
|
+
readonly secretId: string;
|
|
15
|
+
readonly prefix?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
readonly auth: {
|
|
19
|
+
readonly kind: "none";
|
|
20
|
+
} | {
|
|
21
|
+
readonly connectionId: string;
|
|
22
|
+
readonly kind: "oauth2";
|
|
23
|
+
};
|
|
24
|
+
} | null, import("@executor-js/api").InternalError | import("../sdk").GraphqlIntrospectionError | import("../sdk").GraphqlExtractionError>>;
|
|
25
|
+
export declare const addGraphqlSource: import("effect/unstable/reactivity/Atom").AtomResultFn<{
|
|
26
|
+
readonly params: {
|
|
27
|
+
readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
28
|
+
};
|
|
29
|
+
readonly payload: {
|
|
30
|
+
readonly endpoint: string;
|
|
31
|
+
readonly name?: string | undefined;
|
|
32
|
+
readonly namespace?: string | undefined;
|
|
33
|
+
readonly headers?: {
|
|
34
|
+
readonly [x: string]: unknown;
|
|
35
|
+
} | undefined;
|
|
36
|
+
readonly queryParams?: {
|
|
37
|
+
readonly [x: string]: unknown;
|
|
38
|
+
} | undefined;
|
|
39
|
+
readonly auth?: {
|
|
40
|
+
readonly kind: "none";
|
|
41
|
+
} | {
|
|
42
|
+
readonly connectionId: string;
|
|
43
|
+
readonly kind: "oauth2";
|
|
44
|
+
} | undefined;
|
|
45
|
+
readonly introspectionJson?: string | undefined;
|
|
46
|
+
};
|
|
47
|
+
readonly responseMode?: "decoded-only" | undefined;
|
|
48
|
+
readonly reactivityKeys?: readonly unknown[] | import("effect/Record").ReadonlyRecord<string, readonly unknown[]> | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
readonly namespace: string;
|
|
51
|
+
readonly toolCount: number;
|
|
52
|
+
}, import("@executor-js/api").InternalError | import("../sdk").GraphqlIntrospectionError | import("../sdk").GraphqlExtractionError>;
|
|
53
|
+
export declare const updateGraphqlSource: import("effect/unstable/reactivity/Atom").AtomResultFn<{
|
|
54
|
+
readonly params: {
|
|
55
|
+
readonly namespace: string;
|
|
56
|
+
readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
57
|
+
};
|
|
58
|
+
readonly payload: {
|
|
59
|
+
readonly name?: string | undefined;
|
|
60
|
+
readonly endpoint?: string | undefined;
|
|
61
|
+
readonly headers?: {
|
|
62
|
+
readonly [x: string]: unknown;
|
|
63
|
+
} | undefined;
|
|
64
|
+
readonly queryParams?: {
|
|
65
|
+
readonly [x: string]: unknown;
|
|
66
|
+
} | undefined;
|
|
67
|
+
readonly auth?: {
|
|
68
|
+
readonly kind: "none";
|
|
69
|
+
} | {
|
|
70
|
+
readonly connectionId: string;
|
|
71
|
+
readonly kind: "oauth2";
|
|
72
|
+
} | undefined;
|
|
73
|
+
};
|
|
74
|
+
readonly responseMode?: "decoded-only" | undefined;
|
|
75
|
+
readonly reactivityKeys?: readonly unknown[] | import("effect/Record").ReadonlyRecord<string, readonly unknown[]> | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
readonly updated: boolean;
|
|
78
|
+
}, import("@executor-js/api").InternalError | import("../sdk").GraphqlIntrospectionError | import("../sdk").GraphqlExtractionError>;
|