@executor-js/plugin-graphql 1.4.33 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AddGraphqlSource-P3D3UXRJ.js +179 -0
- package/dist/AddGraphqlSource-P3D3UXRJ.js.map +1 -0
- package/dist/EditGraphqlSource-FVF67CTP.js +38 -0
- package/dist/EditGraphqlSource-FVF67CTP.js.map +1 -0
- package/dist/GraphqlAccountsPanel-GBNFHLFH.js +9 -0
- package/dist/GraphqlAccountsPanel-GBNFHLFH.js.map +1 -0
- package/dist/api/group.d.ts +108 -119
- package/dist/api/handlers.d.ts +9 -7
- package/dist/api/index.d.ts +117 -104
- package/dist/chunk-2Y3J3CVO.js +191 -0
- package/dist/chunk-2Y3J3CVO.js.map +1 -0
- package/dist/chunk-ADQTI2OK.js +1309 -0
- package/dist/chunk-ADQTI2OK.js.map +1 -0
- package/dist/{chunk-UIAHATHP.js → chunk-N5GJE7R6.js} +42 -58
- package/dist/chunk-N5GJE7R6.js.map +1 -0
- package/dist/chunk-VCYDSSIK.js +79 -0
- package/dist/chunk-VCYDSSIK.js.map +1 -0
- package/dist/client.js +7 -7
- package/dist/client.js.map +1 -1
- package/dist/core.js +20 -28
- package/dist/index.js +2 -2
- package/dist/react/AddGraphqlSource.d.ts +1 -1
- package/dist/react/EditGraphqlSource.d.ts +2 -2
- package/dist/react/GraphqlAccountsPanel.d.ts +6 -0
- package/dist/react/GraphqlSignInButton.d.ts +6 -2
- package/dist/react/GraphqlSourceFields.d.ts +2 -2
- package/dist/react/atoms.d.ts +95 -205
- package/dist/react/auth-method-config.d.ts +9 -0
- package/dist/react/client.d.ts +108 -97
- package/dist/react/defaults.d.ts +16 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/source-plugin.d.ts +2 -2
- package/dist/sdk/errors.d.ts +8 -6
- package/dist/sdk/index.d.ts +5 -5
- package/dist/sdk/introspect.d.ts +1 -1
- package/dist/sdk/invoke.d.ts +1 -4
- package/dist/sdk/plugin.d.ts +94 -104
- package/dist/sdk/store.d.ts +11 -28
- package/dist/sdk/types.d.ts +110 -72
- package/package.json +5 -4
- package/dist/AddGraphqlSource-CJCUUYNM.js +0 -250
- package/dist/AddGraphqlSource-CJCUUYNM.js.map +0 -1
- package/dist/EditGraphqlSource-YLTPUYW4.js +0 -267
- package/dist/EditGraphqlSource-YLTPUYW4.js.map +0 -1
- package/dist/GraphqlSourceSummary-YWJX6ONU.js +0 -70
- package/dist/GraphqlSourceSummary-YWJX6ONU.js.map +0 -1
- package/dist/chunk-2252RTCE.js +0 -1730
- package/dist/chunk-2252RTCE.js.map +0 -1
- package/dist/chunk-D3FN3ZDA.js +0 -125
- package/dist/chunk-D3FN3ZDA.js.map +0 -1
- package/dist/chunk-M4SJY6CB.js +0 -45
- package/dist/chunk-M4SJY6CB.js.map +0 -1
- package/dist/chunk-UIAHATHP.js.map +0 -1
- package/dist/react/GraphqlSourceSummary.d.ts +0 -5
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sdk/introspect.ts","../src/sdk/extract.ts","../src/sdk/invoke.ts","../src/sdk/store.ts","../src/sdk/plugin.ts"],"sourcesContent":["import { Effect, Option, Schema } from \"effect\";\nimport { HttpClient, HttpClientRequest } from \"effect/unstable/http\";\n\nimport { GraphqlIntrospectionError } from \"./errors\";\n\n// ---------------------------------------------------------------------------\n// Introspection query — standard GraphQL introspection\n// ---------------------------------------------------------------------------\n\nconst INTROSPECTION_QUERY = `\n query IntrospectionQuery {\n __schema {\n queryType { name }\n mutationType { name }\n types {\n kind\n name\n description\n fields(includeDeprecated: false) {\n name\n description\n args {\n name\n description\n type {\n ...TypeRef\n }\n defaultValue\n }\n type {\n ...TypeRef\n }\n }\n inputFields {\n name\n description\n type {\n ...TypeRef\n }\n defaultValue\n }\n enumValues(includeDeprecated: false) {\n name\n description\n }\n }\n }\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Introspection result types\n// ---------------------------------------------------------------------------\n\nconst IntrospectionTypeRefLeaf = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.Null),\n});\n\nconst IntrospectionTypeRef5 = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRefLeaf)),\n});\n\nconst IntrospectionTypeRef4 = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRef5)),\n});\n\nconst IntrospectionTypeRef3 = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRef4)),\n});\n\nconst IntrospectionTypeRef2 = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRef3)),\n});\n\nconst IntrospectionTypeRefSchema = Schema.Struct({\n kind: Schema.String,\n name: Schema.NullOr(Schema.String),\n ofType: Schema.optional(Schema.NullOr(IntrospectionTypeRef2)),\n});\n\nconst IntrospectionInputValueSchema = Schema.Struct({\n name: Schema.String,\n description: Schema.NullOr(Schema.String),\n type: IntrospectionTypeRefSchema,\n defaultValue: Schema.NullOr(Schema.String),\n});\n\nconst IntrospectionFieldSchema = Schema.Struct({\n name: Schema.String,\n description: Schema.NullOr(Schema.String),\n args: Schema.Array(IntrospectionInputValueSchema),\n type: IntrospectionTypeRefSchema,\n});\n\nconst IntrospectionTypeSchema = Schema.Struct({\n kind: Schema.String,\n name: Schema.String,\n description: Schema.NullOr(Schema.String),\n fields: Schema.NullOr(Schema.Array(IntrospectionFieldSchema)),\n inputFields: Schema.NullOr(Schema.Array(IntrospectionInputValueSchema)),\n enumValues: Schema.NullOr(\n Schema.Array(\n Schema.Struct({\n name: Schema.String,\n description: Schema.NullOr(Schema.String),\n }),\n ),\n ),\n});\n\nconst IntrospectionResultSchema = Schema.Struct({\n __schema: Schema.Struct({\n queryType: Schema.NullOr(Schema.Struct({ name: Schema.String })),\n mutationType: Schema.NullOr(Schema.Struct({ name: Schema.String })),\n types: Schema.Array(IntrospectionTypeSchema),\n }),\n});\n\nconst IntrospectionResponseSchema = Schema.Struct({\n data: Schema.optional(IntrospectionResultSchema),\n errors: Schema.optional(Schema.Array(Schema.Unknown)),\n});\n\nconst UpstreamErrorResponseSchema = Schema.Struct({\n message: Schema.optional(Schema.String),\n errors: Schema.optional(\n Schema.Array(\n Schema.Struct({\n message: Schema.optional(Schema.String),\n }),\n ),\n ),\n});\n\nconst IntrospectionJsonSchema = Schema.Union([\n Schema.Struct({ data: IntrospectionResultSchema }),\n IntrospectionResultSchema,\n]);\nconst JsonTextSchema = Schema.fromJsonString(Schema.Unknown);\n\nconst decodeUpstreamErrorResponse = Schema.decodeUnknownOption(UpstreamErrorResponseSchema);\n\nexport type IntrospectionTypeRef = typeof IntrospectionTypeRefSchema.Type;\nexport type IntrospectionInputValue = typeof IntrospectionInputValueSchema.Type;\nexport type IntrospectionField = typeof IntrospectionFieldSchema.Type;\nexport type IntrospectionEnumValue = NonNullable<\n (typeof IntrospectionTypeSchema.Type)[\"enumValues\"]\n>[number];\nexport type IntrospectionType = typeof IntrospectionTypeSchema.Type;\nexport type IntrospectionSchema = (typeof IntrospectionResultSchema.Type)[\"__schema\"];\nexport type IntrospectionResult = typeof IntrospectionResultSchema.Type;\n\nconst firstUpstreamErrorMessage = (value: unknown): string | null => {\n const decoded = decodeUpstreamErrorResponse(value);\n return Option.match(decoded, {\n onNone: () => null,\n onSome: (response) => {\n if (response.message) return response.message;\n for (const entry of response.errors ?? []) {\n const message = entry.message;\n if (message) return message;\n }\n return null;\n },\n });\n};\n\nconst redactUpstreamBody = (body: string): string =>\n body\n .replaceAll(\n /(\"(?:access_token|refresh_token|id_token|client_secret|token|authorization)\"\\s*:\\s*\")[^\"]*(\")/gi,\n \"$1[redacted]$2\",\n )\n .replaceAll(\n /((?:access_token|refresh_token|id_token|client_secret|token|authorization)=)[^&\\s]*/gi,\n \"$1[redacted]\",\n )\n .replaceAll(\n /((?:authorization|access-token|refresh-token|id-token|client-secret|token)\\s*:\\s*)(?:bearer\\s+)?[^\\s,;]+/gi,\n \"$1[redacted]\",\n );\n\nconst upstreamTextMessage = (body: string): string | null => {\n const text = redactUpstreamBody(body.replaceAll(/\\s+/g, \" \").trim());\n if (text.length === 0) return null;\n return text.length > 500 ? `${text.slice(0, 500)}...` : text;\n};\n\n// ---------------------------------------------------------------------------\n// Introspect a GraphQL endpoint\n// ---------------------------------------------------------------------------\n\nexport const introspect = Effect.fn(\"GraphQL.introspect\")(function* (\n endpoint: string,\n headers?: Record<string, string>,\n queryParams?: Record<string, string>,\n) {\n const client = yield* HttpClient.HttpClient;\n const requestEndpoint =\n queryParams && Object.keys(queryParams).length > 0\n ? (() => {\n const url = new URL(endpoint);\n for (const [name, value] of Object.entries(queryParams)) {\n url.searchParams.set(name, value);\n }\n return url.toString();\n })()\n : endpoint;\n\n let request = HttpClientRequest.post(requestEndpoint).pipe(\n HttpClientRequest.setHeader(\"Content-Type\", \"application/json\"),\n HttpClientRequest.setHeader(\"Accept\", \"application/json\"),\n HttpClientRequest.setHeader(\"User-Agent\", \"executor-graphql\"),\n HttpClientRequest.bodyJsonUnsafe({\n query: INTROSPECTION_QUERY,\n }),\n );\n\n if (headers) {\n for (const [k, v] of Object.entries(headers)) {\n request = HttpClientRequest.setHeader(request, k, v);\n }\n }\n\n const response = yield* client.execute(request).pipe(\n Effect.tapCause((cause) => Effect.logError(\"graphql introspection request failed\", cause)),\n Effect.mapError(\n () =>\n new GraphqlIntrospectionError({\n message: \"Failed to reach GraphQL endpoint\",\n }),\n ),\n );\n\n if (response.status !== 200) {\n const responseText = yield* response.text.pipe(Effect.catch(() => Effect.succeed(\"\")));\n const raw = responseText\n ? yield* Schema.decodeUnknownEffect(JsonTextSchema)(responseText).pipe(\n Effect.catch(() => Effect.succeed(null)),\n )\n : null;\n const upstreamMessage = upstreamTextMessage(\n (raw === null ? null : firstUpstreamErrorMessage(raw)) ?? responseText,\n );\n return yield* new GraphqlIntrospectionError({\n message: upstreamMessage\n ? `Introspection failed with status ${response.status}: ${upstreamMessage}`\n : `Introspection failed with status ${response.status}`,\n });\n }\n\n const raw = yield* response.json.pipe(\n Effect.tapCause((cause) => Effect.logError(\"graphql introspection JSON parse failed\", cause)),\n Effect.mapError(\n () =>\n new GraphqlIntrospectionError({\n message: `Failed to parse introspection response as JSON`,\n }),\n ),\n );\n\n const json = yield* Schema.decodeUnknownEffect(IntrospectionResponseSchema)(raw).pipe(\n Effect.mapError(\n () =>\n new GraphqlIntrospectionError({\n message: \"Introspection response has an invalid shape\",\n }),\n ),\n );\n\n if (json.errors && Array.isArray(json.errors) && json.errors.length > 0) {\n const upstreamMessage = firstUpstreamErrorMessage(json);\n return yield* new GraphqlIntrospectionError({\n message: upstreamMessage\n ? `Introspection returned ${json.errors.length} error(s): ${upstreamMessage}`\n : `Introspection returned ${json.errors.length} error(s)`,\n });\n }\n\n if (!json.data?.__schema) {\n return yield* new GraphqlIntrospectionError({\n message: \"Introspection response missing __schema\",\n });\n }\n\n return json.data;\n});\n\n// ---------------------------------------------------------------------------\n// Parse an introspection result from a JSON string (for offline/text input)\n// ---------------------------------------------------------------------------\n\nexport const parseIntrospectionJson = (\n text: string,\n): Effect.Effect<IntrospectionResult, GraphqlIntrospectionError> =>\n Schema.decodeUnknownEffect(Schema.fromJsonString(IntrospectionJsonSchema))(text).pipe(\n Effect.map((parsed) => (\"data\" in parsed ? parsed.data : parsed)),\n Effect.mapError(\n () =>\n new GraphqlIntrospectionError({\n message: \"Failed to parse introspection JSON\",\n }),\n ),\n );\n","import { Effect, Match, Option } from \"effect\";\n\nimport { GraphqlExtractionError } from \"./errors\";\nimport type {\n IntrospectionResult,\n IntrospectionSchema,\n IntrospectionType,\n IntrospectionTypeRef,\n IntrospectionInputValue,\n} from \"./introspect\";\nimport {\n ExtractedField,\n ExtractionResult,\n GraphqlArgument,\n type GraphqlOperationKind,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Type ref helpers\n// ---------------------------------------------------------------------------\n\n/** Unwrap NON_NULL / LIST wrappers to get the leaf type name */\nconst unwrapTypeName = (ref: IntrospectionTypeRef): string => {\n if (ref.name) return ref.name;\n if (ref.ofType) return unwrapTypeName(ref.ofType);\n return \"Unknown\";\n};\n\n/** Check if a type ref is non-null (required) */\nconst isNonNull = (ref: IntrospectionTypeRef): boolean => ref.kind === \"NON_NULL\";\n\n// ---------------------------------------------------------------------------\n// Build shared definitions from all INPUT_OBJECT and ENUM types\n// ---------------------------------------------------------------------------\n\nconst buildDefinitions = (\n types: ReadonlyMap<string, IntrospectionType>,\n): Record<string, unknown> => {\n const defs: Record<string, unknown> = {};\n\n for (const [name, type] of types) {\n // Skip internal types\n if (name.startsWith(\"__\")) continue;\n\n if (type.kind === \"INPUT_OBJECT\" && type.inputFields) {\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n for (const field of type.inputFields) {\n const schema = typeRefToJsonSchema(field.type, types);\n if (field.description) {\n (schema as Record<string, unknown>).description = field.description;\n }\n properties[field.name] = schema;\n if (isNonNull(field.type)) {\n required.push(field.name);\n }\n }\n\n const def: Record<string, unknown> = { type: \"object\", properties };\n if (required.length > 0) def.required = required;\n if (type.description) def.description = type.description;\n defs[name] = def;\n }\n\n if (type.kind === \"ENUM\" && type.enumValues) {\n defs[name] = {\n type: \"string\",\n enum: type.enumValues.map((v) => v.name),\n ...(type.description ? { description: type.description } : {}),\n };\n }\n }\n\n return defs;\n};\n\n// ---------------------------------------------------------------------------\n// Convert a type ref to JSON Schema using $ref for complex types\n// ---------------------------------------------------------------------------\n\nconst typeRefToJsonSchema = (\n ref: IntrospectionTypeRef,\n // oxlint-disable-next-line only-used-in-recursion\n types: ReadonlyMap<string, IntrospectionType>,\n): Record<string, unknown> =>\n Match.value(ref.kind).pipe(\n Match.when(\n \"NON_NULL\",\n (): Record<string, unknown> => (ref.ofType ? typeRefToJsonSchema(ref.ofType, types) : {}),\n ),\n Match.when(\n \"LIST\",\n (): Record<string, unknown> => ({\n type: \"array\",\n items: ref.ofType ? typeRefToJsonSchema(ref.ofType, types) : {},\n }),\n ),\n Match.when(\"SCALAR\", (): Record<string, unknown> => scalarToJsonSchema(ref.name ?? \"String\")),\n Match.when(\n \"ENUM\",\n (): Record<string, unknown> =>\n ref.name ? { $ref: `#/$defs/${ref.name}` } : { type: \"string\" },\n ),\n Match.when(\n \"INPUT_OBJECT\",\n (): Record<string, unknown> =>\n ref.name ? { $ref: `#/$defs/${ref.name}` } : { type: \"object\" },\n ),\n Match.whenOr(\n \"OBJECT\",\n \"INTERFACE\",\n \"UNION\",\n (): Record<string, unknown> => ({ type: \"object\" }),\n ),\n Match.option,\n Option.getOrElse((): Record<string, unknown> => ({})),\n );\n\nconst scalarToJsonSchema = (name: string): Record<string, unknown> =>\n Match.value(name).pipe(\n Match.whenOr(\"String\", \"ID\", (): Record<string, unknown> => ({ type: \"string\" })),\n Match.when(\"Int\", (): Record<string, unknown> => ({ type: \"integer\" })),\n Match.when(\"Float\", (): Record<string, unknown> => ({ type: \"number\" })),\n Match.when(\"Boolean\", (): Record<string, unknown> => ({ type: \"boolean\" })),\n Match.option,\n Option.getOrElse(\n (): Record<string, unknown> => ({ type: \"string\", description: `Custom scalar: ${name}` }),\n ),\n );\n\n// ---------------------------------------------------------------------------\n// Build input JSON Schema from field arguments\n// ---------------------------------------------------------------------------\n\nconst buildInputSchema = (\n args: readonly IntrospectionInputValue[],\n types: ReadonlyMap<string, IntrospectionType>,\n): Record<string, unknown> | undefined => {\n if (args.length === 0) return undefined;\n\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n for (const arg of args) {\n const schema = typeRefToJsonSchema(arg.type, types);\n if (arg.description) {\n (schema as Record<string, unknown>).description = arg.description;\n }\n properties[arg.name] = schema;\n if (isNonNull(arg.type)) {\n required.push(arg.name);\n }\n }\n\n const inputSchema: Record<string, unknown> = {\n type: \"object\",\n properties,\n };\n if (required.length > 0) inputSchema.required = required;\n return inputSchema;\n};\n\n/** Format a type ref back to GraphQL type notation (e.g. \"[String!]!\") */\nconst formatTypeRef = (ref: IntrospectionTypeRef): string =>\n Match.value(ref.kind).pipe(\n Match.when(\"NON_NULL\", () => (ref.ofType ? `${formatTypeRef(ref.ofType)}!` : \"Unknown!\")),\n Match.when(\"LIST\", () => (ref.ofType ? `[${formatTypeRef(ref.ofType)}]` : \"[Unknown]\")),\n Match.option,\n Option.getOrElse(() => ref.name ?? \"Unknown\"),\n );\n\n// ---------------------------------------------------------------------------\n// Extract fields from schema\n// ---------------------------------------------------------------------------\n\nconst extractFields = (\n _schema: IntrospectionSchema,\n kind: GraphqlOperationKind,\n typeName: string | null | undefined,\n types: ReadonlyMap<string, IntrospectionType>,\n): ExtractedField[] => {\n if (!typeName) return [];\n\n const type = types.get(typeName);\n if (!type?.fields) return [];\n\n return type.fields\n .filter((f) => !f.name.startsWith(\"__\"))\n .map((field) => {\n const args = field.args.map((arg) =>\n GraphqlArgument.make({\n name: arg.name,\n typeName: formatTypeRef(arg.type),\n required: isNonNull(arg.type),\n description: arg.description ? Option.some(arg.description) : Option.none(),\n }),\n );\n\n const inputSchema = buildInputSchema(field.args, types);\n\n return ExtractedField.make({\n fieldName: field.name,\n kind,\n description: field.description ? Option.some(field.description) : Option.none(),\n arguments: args,\n inputSchema: inputSchema ? Option.some(inputSchema) : Option.none(),\n returnTypeName: unwrapTypeName(field.type),\n });\n });\n};\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\nexport interface ExtractionOutput {\n readonly result: ExtractionResult;\n /** Shared JSON Schema definitions for INPUT_OBJECT and ENUM types.\n * Tool input schemas use `$ref` pointers into these. */\n readonly definitions: Record<string, unknown>;\n}\n\nexport const extract = (\n introspection: IntrospectionResult,\n): Effect.Effect<ExtractionOutput, GraphqlExtractionError> =>\n Effect.try({\n try: () => {\n const schema = introspection.__schema;\n const typeMap = new Map<string, IntrospectionType>();\n for (const t of schema.types) {\n typeMap.set(t.name, t);\n }\n\n const definitions = buildDefinitions(typeMap);\n\n const queryFields = extractFields(schema, \"query\", schema.queryType?.name, typeMap);\n const mutationFields = extractFields(schema, \"mutation\", schema.mutationType?.name, typeMap);\n\n return {\n result: ExtractionResult.make({\n schemaName: Option.none(),\n fields: [...queryFields, ...mutationFields],\n }),\n definitions,\n };\n },\n catch: () =>\n new GraphqlExtractionError({\n message: \"Failed to extract GraphQL schema\",\n }),\n });\n","import { Effect, Layer, Option } from \"effect\";\nimport { HttpClient, HttpClientRequest } from \"effect/unstable/http\";\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) => 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\nexport const endpointForTelemetry = (endpoint: string): string => {\n if (!URL.canParse(endpoint)) return endpoint;\n const url = new URL(endpoint);\n url.search = \"\";\n url.hash = \"\";\n return url.toString();\n};\n\n// ---------------------------------------------------------------------------\n// Response helpers\n// ---------------------------------------------------------------------------\n\nconst isJsonContentType = (ct: string | null | undefined): boolean => {\n if (!ct) return false;\n const normalized = ct.split(\";\")[0]?.trim().toLowerCase() ?? \"\";\n return (\n normalized === \"application/json\" || normalized.includes(\"+json\") || normalized.includes(\"json\")\n );\n};\n\n// ---------------------------------------------------------------------------\n// Public API — execute a GraphQL operation\n// ---------------------------------------------------------------------------\n\nexport const invoke = Effect.fn(\"GraphQL.invoke\")(function* (\n operation: OperationBinding,\n args: Record<string, unknown>,\n endpoint: string,\n resolvedHeaders: Record<string, string>,\n resolvedQueryParams: Record<string, string> = {},\n) {\n const client = yield* HttpClient.HttpClient;\n const requestEndpoint = endpointWithQueryParams(endpoint, resolvedQueryParams);\n const telemetryEndpoint = endpointForTelemetry(endpoint);\n\n yield* Effect.annotateCurrentSpan({\n \"http.method\": \"POST\",\n \"http.url\": telemetryEndpoint,\n \"plugin.graphql.endpoint\": telemetryEndpoint,\n \"plugin.graphql.operation_kind\": operation.kind,\n \"plugin.graphql.field_name\": operation.fieldName,\n \"plugin.graphql.headers.resolved_count\": Object.keys(resolvedHeaders).length,\n \"plugin.graphql.query_params.resolved_count\": Object.keys(resolvedQueryParams).length,\n });\n\n // Build the GraphQL request body\n const variables: Record<string, unknown> = {};\n for (const varName of operation.variableNames) {\n if (args[varName] !== undefined) {\n variables[varName] = args[varName];\n }\n }\n\n // Also pick up any variables from a \"variables\" container\n if (typeof args.variables === \"object\" && args.variables !== null) {\n Object.assign(variables, args.variables);\n }\n\n let request = HttpClientRequest.post(requestEndpoint).pipe(\n HttpClientRequest.setHeader(\"Content-Type\", \"application/json\"),\n HttpClientRequest.bodyJsonUnsafe({\n query: operation.operationString,\n variables: Object.keys(variables).length > 0 ? variables : undefined,\n }),\n );\n\n for (const [name, value] of Object.entries(resolvedHeaders)) {\n request = HttpClientRequest.setHeader(request, name, value);\n }\n\n const response = yield* client.execute(request).pipe(\n Effect.mapError(\n (err) =>\n new GraphqlInvocationError({\n message: \"GraphQL request failed\",\n statusCode: Option.none(),\n cause: err,\n }),\n ),\n );\n\n const status = response.status;\n const contentType = response.headers[\"content-type\"] ?? null;\n\n const body: unknown = isJsonContentType(contentType)\n ? yield* response.json.pipe(Effect.catch(() => response.text))\n : yield* response.text;\n\n // GraphQL responses are always 200 with { data, errors }\n const gqlBody = body as { data?: unknown; errors?: unknown[] } | null;\n const hasErrors = Array.isArray(gqlBody?.errors) && gqlBody.errors.length > 0;\n\n yield* Effect.annotateCurrentSpan({\n \"http.status_code\": status,\n \"plugin.graphql.has_errors\": hasErrors,\n \"plugin.graphql.error_count\": hasErrors ? gqlBody!.errors!.length : 0,\n });\n\n return InvocationResult.make({\n status,\n data: gqlBody?.data ?? null,\n errors: hasErrors ? gqlBody!.errors : null,\n });\n});\n\n// ---------------------------------------------------------------------------\n// Invoke a GraphQL operation with a provided HttpClient layer\n// ---------------------------------------------------------------------------\n\nexport const invokeWithLayer = (\n operation: OperationBinding,\n args: Record<string, unknown>,\n endpoint: string,\n resolvedHeaders: Record<string, string>,\n resolvedQueryParams: Record<string, string>,\n httpClientLayer: Layer.Layer<HttpClient.HttpClient>,\n) =>\n invoke(operation, args, endpoint, resolvedHeaders, resolvedQueryParams).pipe(\n Effect.provide(httpClientLayer),\n Effect.withSpan(\"plugin.graphql.invoke\", {\n attributes: {\n \"plugin.graphql.endpoint\": endpointForTelemetry(endpoint),\n \"plugin.graphql.operation_kind\": operation.kind,\n \"plugin.graphql.field_name\": operation.fieldName,\n },\n }),\n );\n","import { Effect, Option, Predicate, Schema } from \"effect\";\n\nimport {\n ConfiguredCredentialBinding,\n type FumaTables,\n type PluginStorageEntry,\n type StorageDeps,\n type StorageFailure,\n} from \"@executor-js/sdk/core\";\n\nimport {\n GraphqlSourceAuth,\n OperationBinding,\n type ConfiguredGraphqlCredentialValue,\n} from \"./types\";\n\nexport const graphqlSchema = {} satisfies FumaTables;\nexport type GraphqlSchema = typeof graphqlSchema;\n\nexport interface StoredGraphqlSource {\n readonly namespace: string;\n readonly scope: string;\n readonly name: string;\n readonly endpoint: string;\n readonly headers: Record<string, ConfiguredGraphqlCredentialValue>;\n readonly queryParams: Record<string, ConfiguredGraphqlCredentialValue>;\n readonly auth: GraphqlSourceAuth;\n}\n\nexport interface StoredOperation {\n readonly toolId: string;\n readonly sourceId: string;\n readonly binding: OperationBinding;\n}\n\nconst SOURCE_COLLECTION = \"source\";\nconst OPERATION_COLLECTION = \"operation\";\n\nconst OperationBindingFromJsonString = Schema.fromJsonString(OperationBinding);\nconst decodeOperationBindingFromJsonString = Schema.decodeUnknownSync(\n OperationBindingFromJsonString,\n);\nconst decodeOperationBinding = Schema.decodeUnknownSync(OperationBinding);\nconst encodeBinding = Schema.encodeSync(OperationBinding);\n\nconst decodeBinding = (value: unknown): OperationBinding => {\n if (typeof value === \"string\") return decodeOperationBindingFromJsonString(value);\n return decodeOperationBinding(value);\n};\n\nconst toJsonRecord = (value: unknown): Record<string, unknown> => value as Record<string, unknown>;\n\nconst OptionalNullableString = Schema.optional(Schema.NullOr(Schema.String));\nconst ConfiguredCredentialBindingStorage = Schema.Struct({\n kind: Schema.Literal(\"binding\"),\n slot: Schema.String,\n prefix: OptionalNullableString,\n});\nconst ConfiguredCredentialValueStorage = Schema.Union([\n Schema.String,\n ConfiguredCredentialBindingStorage,\n]);\nconst CredentialMapStorage = Schema.Record(Schema.String, ConfiguredCredentialValueStorage);\nconst SourceStorage = Schema.Struct({\n namespace: Schema.String,\n scope: Schema.String,\n name: Schema.String,\n endpoint: Schema.String,\n headers: Schema.optional(CredentialMapStorage),\n queryParams: Schema.optional(CredentialMapStorage),\n auth: GraphqlSourceAuth,\n});\nconst OperationStorage = Schema.Struct({\n toolId: Schema.String,\n sourceId: Schema.String,\n binding: Schema.Unknown,\n});\nconst decodeSourceStorage = Schema.decodeUnknownOption(SourceStorage);\nconst decodeOperationStorage = Schema.decodeUnknownOption(OperationStorage);\n\nconst normalizeCredentialMap = (\n values: Readonly<Record<string, typeof ConfiguredCredentialValueStorage.Type>> | undefined,\n): Record<string, ConfiguredGraphqlCredentialValue> => {\n if (!values) return {};\n const normalized: Record<string, ConfiguredGraphqlCredentialValue> = {};\n for (const [name, value] of Object.entries(values)) {\n if (typeof value === \"string\") {\n normalized[name] = value;\n continue;\n }\n normalized[name] =\n value.prefix != null\n ? ConfiguredCredentialBinding.make({\n kind: \"binding\",\n slot: value.slot,\n prefix: value.prefix,\n })\n : ConfiguredCredentialBinding.make({\n kind: \"binding\",\n slot: value.slot,\n });\n }\n return normalized;\n};\n\nconst sourceData = (source: StoredGraphqlSource) => ({\n namespace: source.namespace,\n scope: source.scope,\n name: source.name,\n endpoint: source.endpoint,\n headers: source.headers,\n queryParams: source.queryParams,\n auth: source.auth,\n});\n\nconst operationData = (operation: StoredOperation) => ({\n toolId: operation.toolId,\n sourceId: operation.sourceId,\n binding: toJsonRecord(encodeBinding(operation.binding)),\n});\n\nconst rowToSource = (row: PluginStorageEntry): StoredGraphqlSource | null => {\n const decoded = decodeSourceStorage(row.data);\n if (Option.isNone(decoded)) return null;\n const source = decoded.value;\n return {\n namespace: source.namespace,\n scope: source.scope,\n name: source.name,\n endpoint: source.endpoint,\n headers: normalizeCredentialMap(source.headers),\n queryParams: normalizeCredentialMap(source.queryParams),\n auth: source.auth,\n };\n};\n\nconst rowToOperation = (row: PluginStorageEntry): StoredOperation | null => {\n const decoded = decodeOperationStorage(row.data);\n if (Option.isNone(decoded)) return null;\n const operation = decoded.value;\n return {\n toolId: operation.toolId,\n sourceId: operation.sourceId,\n binding: decodeBinding(operation.binding),\n };\n};\n\nexport interface GraphqlStore {\n readonly upsertSource: (\n input: StoredGraphqlSource,\n operations: readonly StoredOperation[],\n ) => Effect.Effect<void, StorageFailure>;\n readonly updateSourceMeta: (\n namespace: string,\n scope: string,\n patch: {\n readonly name?: string;\n readonly endpoint?: string;\n readonly headers?: Record<string, ConfiguredGraphqlCredentialValue>;\n readonly queryParams?: Record<string, ConfiguredGraphqlCredentialValue>;\n readonly auth?: GraphqlSourceAuth;\n },\n ) => Effect.Effect<void, StorageFailure>;\n readonly getSource: (\n namespace: string,\n scope: string,\n ) => Effect.Effect<StoredGraphqlSource | null, StorageFailure>;\n readonly listSources: () => Effect.Effect<readonly StoredGraphqlSource[], StorageFailure>;\n readonly getOperationByToolId: (\n toolId: string,\n scope: string,\n ) => Effect.Effect<StoredOperation | null, StorageFailure>;\n readonly listOperationsBySource: (\n sourceId: string,\n scope: string,\n ) => Effect.Effect<readonly StoredOperation[], StorageFailure>;\n readonly removeSource: (namespace: string, scope: string) => Effect.Effect<void, StorageFailure>;\n}\n\nexport const makeDefaultGraphqlStore = ({\n pluginStorage,\n}: StorageDeps<GraphqlSchema>): GraphqlStore => {\n const listOperationRowsForSourceScope = (sourceId: string, scope: string) =>\n pluginStorage\n .list({\n collection: OPERATION_COLLECTION,\n keyPrefix: `${sourceId}.`,\n })\n .pipe(\n Effect.map((rows) =>\n rows.filter((row) => {\n if (String(row.scopeId) !== scope) return false;\n return rowToOperation(row)?.sourceId === sourceId;\n }),\n ),\n );\n\n const removeOperationsForSourceScope = (sourceId: string, scope: string) =>\n Effect.gen(function* () {\n const rows = yield* listOperationRowsForSourceScope(sourceId, scope);\n for (const row of rows) {\n yield* pluginStorage.remove({\n scope,\n collection: OPERATION_COLLECTION,\n key: row.key,\n });\n }\n });\n\n const deleteSource = (namespace: string, scope: string) =>\n Effect.gen(function* () {\n yield* removeOperationsForSourceScope(namespace, scope);\n yield* pluginStorage.remove({\n scope,\n collection: SOURCE_COLLECTION,\n key: namespace,\n });\n });\n\n return {\n upsertSource: (input, operations) =>\n Effect.gen(function* () {\n yield* deleteSource(input.namespace, input.scope);\n yield* pluginStorage.put({\n scope: input.scope,\n collection: SOURCE_COLLECTION,\n key: input.namespace,\n data: sourceData(input),\n });\n for (const operation of operations) {\n yield* pluginStorage.put({\n scope: input.scope,\n collection: OPERATION_COLLECTION,\n key: operation.toolId,\n data: operationData(operation),\n });\n }\n }),\n\n updateSourceMeta: (namespace, scope, patch) =>\n Effect.gen(function* () {\n const existing = yield* pluginStorage.getAtScope({\n scope,\n collection: SOURCE_COLLECTION,\n key: namespace,\n });\n if (!existing) return;\n const source = rowToSource(existing);\n if (!source) return;\n yield* pluginStorage.put({\n scope,\n collection: SOURCE_COLLECTION,\n key: namespace,\n data: sourceData({\n ...source,\n name: patch.name ?? source.name,\n endpoint: patch.endpoint ?? source.endpoint,\n headers: patch.headers ?? source.headers,\n queryParams: patch.queryParams ?? source.queryParams,\n auth: patch.auth ?? source.auth,\n }),\n });\n }),\n\n getSource: (namespace, scope) =>\n pluginStorage\n .getAtScope({ scope, collection: SOURCE_COLLECTION, key: namespace })\n .pipe(Effect.map((row) => (row ? rowToSource(row) : null))),\n\n listSources: () =>\n pluginStorage\n .list({ collection: SOURCE_COLLECTION })\n .pipe(Effect.map((rows) => rows.map(rowToSource).filter(Predicate.isNotNull))),\n\n getOperationByToolId: (toolId, scope) =>\n pluginStorage\n .getAtScope({ scope, collection: OPERATION_COLLECTION, key: toolId })\n .pipe(Effect.map((row) => (row ? rowToOperation(row) : null))),\n\n listOperationsBySource: (sourceId, scope) =>\n listOperationRowsForSourceScope(sourceId, scope).pipe(\n Effect.map((rows) => rows.map(rowToOperation).filter(Predicate.isNotNull)),\n ),\n\n removeSource: (namespace, scope) => deleteSource(namespace, scope),\n };\n};\n","import { Effect, Match, Option, Schema } from \"effect\";\nimport type { Layer } from \"effect\";\nimport { HttpClient } from \"effect/unstable/http\";\n\nimport {\n type CredentialBindingRef,\n type CredentialBindingValue,\n definePlugin,\n tool,\n defaultSourceInstallScopeId,\n ScopeId,\n SourceDetectionResult,\n StorageError,\n ToolResult,\n authToolFailure,\n type PluginCtx,\n type StorageFailure,\n type ToolAnnotations,\n type ToolRow,\n} from \"@executor-js/sdk/core\";\nimport {\n compileHttpNamedCredentialMap,\n OAuth2SourceConfig,\n httpCredentialInputToBindingValue,\n type HttpConfiguredValueInput,\n} from \"@executor-js/sdk/http-source\";\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 {\n GraphqlAuthRequiredError,\n GraphqlIntrospectionError,\n GraphqlInvocationError,\n} from \"./errors\";\nimport { invokeWithLayer } from \"./invoke\";\nimport { graphqlPresets } from \"./presets\";\nimport {\n graphqlSchema,\n makeDefaultGraphqlStore,\n type GraphqlStore,\n type StoredGraphqlSource,\n type StoredOperation,\n} from \"./store\";\nimport {\n ExtractedField,\n GraphqlConfiguredValueInput as GraphqlConfiguredValueInputSchema,\n GRAPHQL_OAUTH_CONNECTION_SLOT,\n GraphqlCredentialInput as GraphqlCredentialInputSchema,\n GraphqlSourceAuthInput as GraphqlSourceAuthInputSchema,\n graphqlHeaderSlot,\n graphqlQueryParamSlot,\n OperationBinding,\n type ConfiguredGraphqlCredentialValue,\n type GraphqlConfiguredValueInput,\n type GraphqlCredentialInput,\n type GraphqlSourceAuth,\n type HeaderValue as HeaderValueValue,\n type GraphqlSourceAuthInput,\n type GraphqlOperationKind,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Plugin config\n// ---------------------------------------------------------------------------\n\nconst GraphqlErrorBody = Schema.Struct({ message: Schema.String });\nconst GraphqlErrorsBody = Schema.Array(Schema.Unknown);\nconst decodeGraphqlErrorBody = Schema.decodeUnknownOption(GraphqlErrorBody);\nconst decodeGraphqlErrorsBody = Schema.decodeUnknownOption(GraphqlErrorsBody);\n\nconst decodeGraphqlErrors = (errors: unknown): readonly unknown[] | undefined =>\n Option.getOrUndefined(decodeGraphqlErrorsBody(errors));\n\nconst extractGraphqlErrorMessage = (errors: readonly unknown[]): string | undefined =>\n errors\n .map((error) => Option.getOrUndefined(decodeGraphqlErrorBody(error))?.message)\n .find((message) => message !== undefined && message.length > 0);\n\nexport type HeaderValue = HeaderValueValue;\nexport type GraphqlCredentialValue = ConfiguredGraphqlCredentialValue;\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. */\n readonly name: string;\n /** Optional: introspection JSON text (if endpoint doesn't support introspection) */\n readonly introspectionJson?: string;\n /** Namespace for the tools. */\n readonly namespace: string;\n /** Headers applied to every request. Secret entries declare source-owned slots. */\n readonly headers?: Record<string, GraphqlConfiguredValueInput>;\n /** Query parameters applied to every request. Secret entries declare source-owned slots. */\n readonly queryParams?: Record<string, GraphqlConfiguredValueInput>;\n /** Optional OAuth2 credential used as a Bearer token for every request. */\n readonly oauth2?: OAuth2SourceConfig;\n /** Initial credential bindings used while adding and introspecting this source. */\n readonly credentials?: GraphqlInitialCredentialsInput;\n}\n\nconst GraphqlInitialCredentialsInputSchema = Schema.Struct({\n scope: Schema.String,\n headers: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInputSchema)),\n queryParams: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInputSchema)),\n auth: Schema.optional(GraphqlSourceAuthInputSchema),\n});\ntype GraphqlInitialCredentialsInput = typeof GraphqlInitialCredentialsInputSchema.Type;\n\nconst StaticAddSourceInputSchema = Schema.Struct({\n endpoint: Schema.String,\n name: Schema.String,\n introspectionJson: Schema.optional(Schema.String),\n namespace: Schema.String,\n headers: Schema.optional(Schema.Record(Schema.String, GraphqlConfiguredValueInputSchema)),\n queryParams: Schema.optional(Schema.Record(Schema.String, GraphqlConfiguredValueInputSchema)),\n oauth2: Schema.optional(OAuth2SourceConfig),\n credentials: Schema.optional(GraphqlInitialCredentialsInputSchema),\n});\nconst SourceConfigureInputSchema = Schema.Struct({\n name: Schema.optional(Schema.String),\n endpoint: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInputSchema)),\n queryParams: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInputSchema)),\n auth: Schema.optional(GraphqlSourceAuthInputSchema),\n});\nconst StaticConfigureSourceInputSchema = Schema.Struct({\n source: Schema.Struct({\n id: Schema.String,\n scope: Schema.String,\n }),\n scope: Schema.String,\n ...SourceConfigureInputSchema.fields,\n});\nconst StaticConfigureSourceOutputSchema = Schema.Struct({\n configured: Schema.Boolean,\n});\nconst StaticGetSourceInputSchema = Schema.Struct({\n namespace: Schema.String,\n scope: Schema.String,\n});\nconst StaticGetSourceOutputSchema = Schema.Struct({\n source: Schema.NullOr(Schema.Unknown),\n});\n\nconst StaticAddSourceInputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(StaticAddSourceInputSchema),\n);\nconst StaticAddSourceOutputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(\n Schema.Struct({\n namespace: Schema.String,\n source: Schema.Struct({\n id: Schema.String,\n scope: Schema.String,\n }),\n toolCount: Schema.Number,\n }),\n ),\n);\nconst StaticGetSourceInputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(StaticGetSourceInputSchema),\n);\nconst StaticGetSourceOutputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(StaticGetSourceOutputSchema),\n);\nconst StaticConfigureSourceInputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(StaticConfigureSourceInputSchema),\n);\nconst StaticConfigureSourceOutputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(StaticConfigureSourceOutputSchema),\n);\n\nconst graphqlToolFailure = (code: string, message: string, details?: unknown) =>\n ToolResult.fail({\n code,\n message,\n ...(details === undefined ? {} : { details }),\n });\n\nconst graphqlAuthToolFailure = (failure: GraphqlAuthRequiredError) =>\n authToolFailure({\n code: failure.code,\n message: failure.message,\n source: { id: failure.sourceId, scope: failure.sourceScope },\n credential: {\n kind: failure.credentialKind,\n ...(failure.credentialLabel ? { label: failure.credentialLabel } : {}),\n ...(failure.slotKey ? { slotKey: failure.slotKey } : {}),\n ...(failure.secretId ? { secretId: failure.secretId } : {}),\n ...(failure.connectionId ? { connectionId: failure.connectionId } : {}),\n },\n ...(failure.status !== undefined ? { status: failure.status } : {}),\n ...(failure.details !== undefined\n ? {\n upstream: {\n ...(failure.status !== undefined ? { status: failure.status } : {}),\n details: failure.details,\n },\n }\n : {}),\n recovery: { configureSourceTool: \"executor.graphql.configureSource\" },\n });\n\nconst resolveStaticScopeInput = (\n ctx: { readonly scopes: readonly { readonly id: ScopeId; readonly name: string }[] },\n value: string,\n): string =>\n String(\n ctx.scopes.find((scope) => scope.name === value || String(scope.id) === value)?.id ?? value,\n );\n\n// ---------------------------------------------------------------------------\n// Plugin extension\n// ---------------------------------------------------------------------------\n\nexport interface GraphqlSourceRef {\n readonly id: string;\n readonly scope: string;\n}\n\nexport interface GraphqlConfigureSourceInput {\n readonly scope: string;\n readonly name?: string;\n readonly endpoint?: string;\n readonly headers?: Record<string, GraphqlCredentialInput>;\n readonly queryParams?: Record<string, GraphqlCredentialInput>;\n readonly auth?: GraphqlSourceAuthInput;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/** Match `token` as a separator-bounded run inside a URL hostname or path,\n * used as a low-confidence detection hint when introspection fails.\n * Boundary chars are everything non-alphanumeric, so `/api/graphql`,\n * `graphql.example.com`, `graphql-api`, and `graphql_v2` all match while\n * `graphqlserver` and `/graphqlite` do not. */\nconst urlMatchesToken = (url: URL, token: string): boolean => {\n const re = new RegExp(`(?:^|[^a-z0-9])${token}(?:$|[^a-z0-9])`, \"i\");\n return re.test(url.hostname) || re.test(url.pathname);\n};\n\n/** Derive a namespace from an endpoint URL */\nconst namespaceFromEndpoint = (endpoint: string): string => {\n // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: URL construction throws; this helper intentionally falls back to the stable default namespace\n try {\n const url = new URL(endpoint);\n return url.hostname.replace(/[^a-z0-9]+/gi, \"_\").toLowerCase();\n } catch {\n return \"graphql\";\n }\n};\n\nconst formatTypeRef = (ref: IntrospectionTypeRef): string =>\n Match.value(ref.kind).pipe(\n Match.when(\"NON_NULL\", () => (ref.ofType ? `${formatTypeRef(ref.ofType)}!` : \"Unknown!\")),\n Match.when(\"LIST\", () => (ref.ofType ? `[${formatTypeRef(ref.ofType)}]` : \"[Unknown]\")),\n Match.option,\n Option.getOrElse(() => ref.name ?? \"Unknown\"),\n );\n\nconst unwrapTypeName = (ref: IntrospectionTypeRef): string => {\n if (ref.name) return ref.name;\n if (ref.ofType) return unwrapTypeName(ref.ofType);\n return \"Unknown\";\n};\n\nconst buildSelectionSet = (\n ref: IntrospectionTypeRef,\n types: ReadonlyMap<string, IntrospectionType>,\n depth: number,\n seen: Set<string>,\n): string => {\n if (depth > 2) return \"\";\n\n const leafName = unwrapTypeName(ref);\n if (seen.has(leafName)) return \"\";\n\n const objectType = types.get(leafName);\n if (!objectType?.fields) return \"\";\n\n const kind = objectType.kind;\n if (kind === \"SCALAR\" || kind === \"ENUM\") return \"\";\n\n seen.add(leafName);\n\n const subFields = objectType.fields\n .filter((f) => !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<string, { kind: GraphqlOperationKind; field: IntrospectionField }>();\n const schema = introspection.__schema;\n for (const rootKind of [\"query\", \"mutation\"] as const) {\n const typeName = rootKind === \"query\" ? schema.queryType?.name : schema.mutationType?.name;\n if (!typeName) continue;\n const rootType = typeMap.get(typeName);\n if (!rootType?.fields) continue;\n for (const f of rootType.fields) {\n if (!f.name.startsWith(\"__\")) {\n fieldMap.set(`${rootKind}.${f.name}`, { kind: rootKind, field: f });\n }\n }\n }\n\n return fields.map((extracted) => {\n const prefix = extracted.kind === \"mutation\" ? \"mutation\" : \"query\";\n const toolPath = `${prefix}.${extracted.fieldName}`;\n const description = Option.getOrElse(\n extracted.description,\n () => `GraphQL ${extracted.kind}: ${extracted.fieldName} -> ${extracted.returnTypeName}`,\n );\n\n const key = `${extracted.kind}.${extracted.fieldName}`;\n const entry = fieldMap.get(key);\n const operationString = entry\n ? buildOperationStringForField(entry.kind, entry.field, typeMap)\n : `${extracted.kind} { ${extracted.fieldName} }`;\n\n const binding = OperationBinding.make({\n kind: extracted.kind,\n fieldName: extracted.fieldName,\n operationString,\n variableNames: extracted.arguments.map((a) => a.name),\n });\n\n return {\n 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 const headers: Record<string, HeaderValue> = {};\n for (const [name, value] of Object.entries(config.headers ?? {})) {\n if (typeof value === \"string\" || !(\"kind\" in value)) {\n headers[name] = value;\n }\n }\n return {\n kind: \"graphql\",\n endpoint: config.endpoint,\n introspectionJson: config.introspectionJson,\n namespace,\n headers: headersToConfigValues(Object.keys(headers).length > 0 ? headers : undefined),\n };\n};\n\nconst GRAPHQL_PLUGIN_ID = \"graphql\";\n\nconst scopeRanks = (ctx: PluginCtx<GraphqlStore>): ReadonlyMap<string, number> =>\n new Map(ctx.scopes.map((scope, index) => [String(scope.id), index]));\n\nconst scopeRank = (ranks: ReadonlyMap<string, number>, scopeId: string): number =>\n ranks.get(scopeId) ?? Infinity;\n\nconst resolveGraphqlSourceBinding = (\n ctx: PluginCtx<GraphqlStore>,\n sourceId: string,\n sourceScope: string,\n slot: string,\n): Effect.Effect<CredentialBindingRef | null, StorageFailure> =>\n Effect.gen(function* () {\n const ranks = scopeRanks(ctx);\n const sourceSourceRank = scopeRank(ranks, sourceScope);\n if (sourceSourceRank === Infinity) return null;\n const bindings = yield* ctx.credentialBindings.listForSource({\n pluginId: GRAPHQL_PLUGIN_ID,\n sourceId,\n sourceScope: ScopeId.make(sourceScope),\n });\n const binding = bindings\n .filter(\n (candidate) =>\n candidate.slotKey === slot && scopeRank(ranks, candidate.scopeId) <= sourceSourceRank,\n )\n .sort((a, b) => scopeRank(ranks, a.scopeId) - scopeRank(ranks, b.scopeId))[0];\n return binding ?? null;\n });\n\nconst validateGraphqlBindingTarget = (\n ctx: PluginCtx<GraphqlStore>,\n input: {\n readonly sourceScope: string;\n readonly targetScope: string;\n readonly sourceId: string;\n },\n): Effect.Effect<void, StorageFailure> =>\n Effect.gen(function* () {\n const ranks = scopeRanks(ctx);\n const sourceSourceRank = scopeRank(ranks, input.sourceScope);\n const targetRank = scopeRank(ranks, input.targetScope);\n const scopeList = `[${ctx.scopes.map((s) => s.id).join(\", \")}]`;\n if (sourceSourceRank === Infinity) {\n return yield* new StorageError({\n message:\n `GraphQL source binding references source scope \"${input.sourceScope}\" ` +\n `which is not in the executor's scope stack ${scopeList}.`,\n cause: undefined,\n });\n }\n if (targetRank === Infinity) {\n return yield* new StorageError({\n message:\n `GraphQL source binding targets scope \"${input.targetScope}\" which is not ` +\n `in the executor's scope stack ${scopeList}.`,\n cause: undefined,\n });\n }\n if (targetRank > sourceSourceRank) {\n return yield* new StorageError({\n message:\n `GraphQL source bindings for \"${input.sourceId}\" cannot be written at ` +\n `outer scope \"${input.targetScope}\" because the base source lives at ` +\n `\"${input.sourceScope}\"`,\n cause: undefined,\n });\n }\n });\n\nconst canonicalizeCredentialMap = compileHttpNamedCredentialMap;\n\nconst canonicalizeConfiguredValueMap = (\n values: Record<string, GraphqlConfiguredValueInput> | undefined,\n slotForName: (name: string) => string,\n): Record<string, ConfiguredGraphqlCredentialValue> => {\n const next: Record<string, ConfiguredGraphqlCredentialValue> = {};\n for (const [name, value] of Object.entries(values ?? {})) {\n if (typeof value === \"string\") {\n next[name] = value;\n continue;\n }\n next[name] = {\n kind: \"binding\",\n slot: slotForName(name),\n prefix: value.prefix,\n };\n }\n return next;\n};\n\nconst resolveConfiguredValueMap = (\n values: Record<string, HttpConfiguredValueInput> | undefined,\n): Record<string, string> | undefined => {\n if (!values) return undefined;\n const resolved: Record<string, string> = {};\n for (const [name, value] of Object.entries(values)) {\n if (typeof value === \"string\") resolved[name] = value;\n }\n return Object.keys(resolved).length > 0 ? resolved : undefined;\n};\n\nconst authFromOAuth2Source = (oauth2: OAuth2SourceConfig | undefined): GraphqlSourceAuth =>\n oauth2 ? { kind: \"oauth2\", connectionSlot: oauth2.connectionSlot } : { kind: \"none\" };\n\nconst canonicalizeAuth = (\n auth: GraphqlSourceAuthInput | undefined,\n): {\n readonly auth: GraphqlSourceAuth;\n readonly bindings: ReadonlyArray<{\n readonly slot: string;\n readonly value: CredentialBindingValue;\n readonly targetScope?: string;\n }>;\n} => {\n if (!auth || \"kind\" in auth || !auth.oauth2) return { auth: { kind: \"none\" }, bindings: [] };\n const connection = auth.oauth2.connection;\n return {\n auth: { kind: \"oauth2\", connectionSlot: GRAPHQL_OAUTH_CONNECTION_SLOT },\n bindings: connection\n ? [\n {\n slot: GRAPHQL_OAUTH_CONNECTION_SLOT,\n value: httpCredentialInputToBindingValue(connection),\n },\n ]\n : [],\n };\n};\n\nconst resolveInitialCredentialValueMap = (\n ctx: PluginCtx<GraphqlStore>,\n values: Record<string, ConfiguredGraphqlCredentialValue>,\n bindings: ReadonlyArray<{ readonly slot: string; readonly value: CredentialBindingValue }>,\n targetScope: string,\n): Effect.Effect<Record<string, string> | undefined, GraphqlIntrospectionError | StorageFailure> =>\n Effect.gen(function* () {\n const bySlot = new Map(bindings.map((binding) => [binding.slot, binding.value] as const));\n const resolved: Record<string, string> = {};\n for (const [name, value] of Object.entries(values)) {\n if (typeof value === \"string\") {\n resolved[name] = value;\n continue;\n }\n const binding = bySlot.get(value.slot);\n if (binding?.kind === \"secret\") {\n const secret = yield* ctx.secrets\n .getAtScope(binding.secretId, binding.secretScopeId ?? ScopeId.make(targetScope))\n .pipe(\n Effect.catchTag(\"SecretOwnedByConnectionError\", () =>\n Effect.fail(\n new GraphqlIntrospectionError({\n message: `Secret not found for ${name}`,\n }),\n ),\n ),\n );\n if (secret === null) {\n return yield* new GraphqlIntrospectionError({\n message: `Missing secret \"${binding.secretId}\" for ${name}`,\n });\n }\n resolved[name] = value.prefix ? `${value.prefix}${secret}` : secret;\n continue;\n }\n if (binding?.kind === \"text\") {\n resolved[name] = value.prefix ? `${value.prefix}${binding.text}` : binding.text;\n }\n }\n return Object.keys(resolved).length > 0 ? resolved : undefined;\n });\n\nconst resolveInitialOAuthHeaders = (\n ctx: PluginCtx<GraphqlStore>,\n bindings: ReadonlyArray<{ readonly slot: string; readonly value: CredentialBindingValue }>,\n targetScope: string,\n): Effect.Effect<Record<string, string> | undefined, GraphqlIntrospectionError | StorageFailure> =>\n Effect.gen(function* () {\n const connection = bindings.find(\n (binding) =>\n binding.slot === GRAPHQL_OAUTH_CONNECTION_SLOT && binding.value.kind === \"connection\",\n );\n if (!connection || connection.value.kind !== \"connection\") return undefined;\n const connectionId = connection.value.connectionId;\n const accessToken = yield* ctx.connections\n .accessTokenAtScope(connectionId, ScopeId.make(targetScope))\n .pipe(\n Effect.mapError(\n ({ message }) =>\n new GraphqlIntrospectionError({\n message: `Failed to resolve OAuth connection \"${connectionId}\": ${message}`,\n }),\n ),\n );\n return { Authorization: `Bearer ${accessToken}` };\n });\n\nconst resolveGraphqlBindingValueMap = (\n ctx: PluginCtx<GraphqlStore>,\n values: Record<string, ConfiguredGraphqlCredentialValue> | undefined,\n params: {\n readonly sourceId: string;\n readonly sourceScope: string;\n readonly missingLabel: string;\n },\n): Effect.Effect<Record<string, string> | undefined, GraphqlAuthRequiredError | StorageFailure> =>\n Effect.gen(function* () {\n if (!values) return undefined;\n const resolved: Record<string, string> = {};\n for (const [name, value] of Object.entries(values)) {\n if (typeof value === \"string\") {\n resolved[name] = value;\n continue;\n }\n const binding = yield* resolveGraphqlSourceBinding(\n ctx,\n params.sourceId,\n params.sourceScope,\n value.slot,\n );\n if (binding?.value.kind === \"secret\") {\n const secretBinding = binding.value;\n const secret = yield* ctx.secrets.getAtScope(secretBinding.secretId, binding.scopeId).pipe(\n Effect.catchTag(\"SecretOwnedByConnectionError\", () =>\n Effect.fail(\n new GraphqlAuthRequiredError({\n code: \"credential_secret_missing\",\n sourceId: params.sourceId,\n sourceScope: params.sourceScope,\n credentialKind: \"secret\",\n credentialLabel: name,\n slotKey: value.slot,\n secretId: String(secretBinding.secretId),\n message: `Secret not found for ${params.missingLabel} \"${name}\"`,\n }),\n ),\n ),\n );\n if (secret === null) {\n return yield* new GraphqlAuthRequiredError({\n code: \"credential_secret_missing\",\n sourceId: params.sourceId,\n sourceScope: params.sourceScope,\n credentialKind: \"secret\",\n credentialLabel: name,\n slotKey: value.slot,\n secretId: String(secretBinding.secretId),\n message: `Missing secret \"${secretBinding.secretId}\" for ${params.missingLabel} \"${name}\"`,\n });\n }\n resolved[name] = value.prefix ? `${value.prefix}${secret}` : secret;\n continue;\n }\n if (binding?.value.kind === \"text\") {\n resolved[name] = value.prefix ? `${value.prefix}${binding.value.text}` : binding.value.text;\n continue;\n }\n return yield* new GraphqlAuthRequiredError({\n code: \"credential_binding_missing\",\n sourceId: params.sourceId,\n sourceScope: params.sourceScope,\n credentialKind: \"secret\",\n credentialLabel: name,\n slotKey: value.slot,\n message: `Missing binding for ${params.missingLabel} \"${name}\"`,\n });\n }\n return Object.keys(resolved).length > 0 ? resolved : undefined;\n });\n\nconst resolveGraphqlStoredOAuthHeader = (\n ctx: PluginCtx<GraphqlStore>,\n sourceId: string,\n sourceScope: string,\n auth: GraphqlSourceAuth | undefined,\n) =>\n Effect.gen(function* () {\n if (!auth || auth.kind === \"none\") return undefined;\n const binding = yield* resolveGraphqlSourceBinding(\n ctx,\n sourceId,\n sourceScope,\n auth.connectionSlot,\n );\n if (binding?.value.kind !== \"connection\") {\n return yield* new GraphqlAuthRequiredError({\n code: \"oauth_connection_missing\",\n sourceId,\n sourceScope,\n credentialKind: \"connection\",\n credentialLabel: \"OAuth sign-in\",\n slotKey: auth.connectionSlot,\n message: `Missing OAuth connection binding for GraphQL source \"${sourceId}\"`,\n });\n }\n const connectionId = binding.value.connectionId;\n const accessToken = yield* ctx.connections\n .accessTokenAtScope(connectionId, binding.scopeId)\n .pipe(\n Effect.catchTags({\n ConnectionReauthRequiredError: ({ message, connectionId }) =>\n Effect.fail(\n new GraphqlAuthRequiredError({\n code: \"oauth_reauth_required\",\n sourceId,\n sourceScope,\n credentialKind: \"oauth\",\n credentialLabel: \"OAuth sign-in\",\n slotKey: auth.connectionSlot,\n connectionId: String(connectionId),\n message: `OAuth connection \"${connectionId}\" needs re-authentication: ${message}`,\n }),\n ),\n ConnectionNotFoundError: ({ connectionId }) =>\n Effect.fail(\n new GraphqlAuthRequiredError({\n code: \"oauth_connection_missing\",\n sourceId,\n sourceScope,\n credentialKind: \"connection\",\n credentialLabel: \"OAuth sign-in\",\n slotKey: auth.connectionSlot,\n connectionId: String(connectionId),\n message: `OAuth connection \"${connectionId}\" was not found for GraphQL source \"${sourceId}\"`,\n }),\n ),\n ConnectionProviderNotRegisteredError: ({ provider }) =>\n Effect.fail(\n new GraphqlAuthRequiredError({\n code: \"oauth_connection_failed\",\n sourceId,\n sourceScope,\n credentialKind: \"oauth\",\n credentialLabel: \"OAuth sign-in\",\n slotKey: auth.connectionSlot,\n connectionId: String(connectionId),\n message: `OAuth provider \"${provider}\" is not registered`,\n }),\n ),\n ConnectionRefreshNotSupportedError: ({ provider, connectionId }) =>\n Effect.fail(\n new GraphqlAuthRequiredError({\n code: \"oauth_connection_failed\",\n sourceId,\n sourceScope,\n credentialKind: \"oauth\",\n credentialLabel: \"OAuth sign-in\",\n slotKey: auth.connectionSlot,\n connectionId: String(connectionId),\n message: `OAuth provider \"${provider}\" cannot refresh connection \"${connectionId}\"`,\n }),\n ),\n ConnectionRefreshError: ({ message, connectionId }) =>\n Effect.fail(\n new GraphqlAuthRequiredError({\n code: \"oauth_connection_failed\",\n sourceId,\n sourceScope,\n credentialKind: \"oauth\",\n credentialLabel: \"OAuth sign-in\",\n slotKey: auth.connectionSlot,\n connectionId: String(connectionId),\n message: `OAuth connection \"${connectionId}\" refresh failed: ${message}`,\n }),\n ),\n }),\n );\n return { Authorization: `Bearer ${accessToken}` };\n });\n\nconst makeGraphqlExtension = (\n ctx: PluginCtx<GraphqlStore>,\n httpClientLayer: Layer.Layer<HttpClient.HttpClient>,\n configFile: ConfigFileSink | undefined,\n) => {\n const addSourceInternal = (config: GraphqlSourceConfig) =>\n ctx.transaction(\n Effect.gen(function* () {\n const namespace = config.namespace;\n const canonicalHeaders = canonicalizeConfiguredValueMap(config.headers, graphqlHeaderSlot);\n const canonicalQueryParams = canonicalizeConfiguredValueMap(\n config.queryParams,\n graphqlQueryParamSlot,\n );\n const initialHeaders =\n config.credentials?.headers !== undefined\n ? canonicalizeCredentialMap(config.credentials.headers, graphqlHeaderSlot)\n : null;\n const initialQueryParams =\n config.credentials?.queryParams !== undefined\n ? canonicalizeCredentialMap(config.credentials.queryParams, graphqlQueryParamSlot)\n : null;\n const initialAuth =\n config.credentials?.auth !== undefined ? canonicalizeAuth(config.credentials.auth) : null;\n const auth = config.oauth2\n ? authFromOAuth2Source(config.oauth2)\n : (initialAuth?.auth ?? { kind: \"none\" });\n const initialBindings = [\n ...(initialHeaders?.bindings ?? []),\n ...(initialQueryParams?.bindings ?? []),\n ...(initialAuth?.bindings ?? []),\n ];\n const initialScope = config.credentials?.scope;\n if (initialScope && initialBindings.length > 0) {\n yield* validateGraphqlBindingTarget(ctx, {\n sourceId: namespace,\n sourceScope: config.scope,\n targetScope: initialScope,\n });\n }\n\n let introspectionResult: IntrospectionResult;\n if (config.introspectionJson) {\n introspectionResult = yield* parseIntrospectionJson(config.introspectionJson);\n } else {\n const resolvedInitialHeaders =\n initialHeaders && initialScope\n ? yield* resolveInitialCredentialValueMap(\n ctx,\n canonicalHeaders,\n initialHeaders.bindings,\n initialScope,\n )\n : undefined;\n const resolvedOAuthHeaders =\n initialAuth && initialScope\n ? yield* resolveInitialOAuthHeaders(ctx, initialAuth.bindings, initialScope)\n : undefined;\n const resolvedHeaders = {\n ...(resolveConfiguredValueMap(config.headers) ?? {}),\n ...(resolvedInitialHeaders ?? {}),\n ...(resolvedOAuthHeaders ?? {}),\n };\n const resolvedInitialQueryParams =\n initialQueryParams && initialScope\n ? yield* resolveInitialCredentialValueMap(\n ctx,\n canonicalQueryParams,\n initialQueryParams.bindings,\n initialScope,\n )\n : undefined;\n const resolvedQueryParams = {\n ...(resolveConfiguredValueMap(config.queryParams) ?? {}),\n ...(resolvedInitialQueryParams ?? {}),\n };\n introspectionResult = yield* introspect(\n config.endpoint,\n Object.keys(resolvedHeaders).length > 0 ? resolvedHeaders : undefined,\n Object.keys(resolvedQueryParams).length > 0 ? resolvedQueryParams : undefined,\n ).pipe(Effect.provide(httpClientLayer));\n }\n\n const { result, definitions } = yield* extract(introspectionResult);\n const prepared = prepareOperations(result.fields, introspectionResult);\n\n const displayName = config.name?.trim() || namespace;\n\n const storedSource: StoredGraphqlSource = {\n namespace,\n scope: config.scope,\n name: displayName,\n endpoint: config.endpoint,\n headers: canonicalHeaders,\n queryParams: canonicalQueryParams,\n auth,\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 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 if (initialScope && initialBindings.length > 0) {\n yield* ctx.credentialBindings.replaceForSource({\n targetScope: ScopeId.make(initialScope),\n pluginId: GRAPHQL_PLUGIN_ID,\n sourceId: namespace,\n sourceScope: ScopeId.make(config.scope),\n slotPrefixes: [\n ...(config.credentials?.headers !== undefined ? [\"header:\"] : []),\n ...(config.credentials?.queryParams !== undefined ? [\"query_param:\"] : []),\n ...(config.credentials?.auth !== undefined ? [\"auth:\"] : []),\n ],\n bindings: initialBindings.map((binding) => ({\n slotKey: binding.slot,\n value: binding.value,\n })),\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 configureSource = (\n namespace: string,\n scope: string,\n targetScope: string,\n input: Omit<GraphqlConfigureSourceInput, \"scope\">,\n ) =>\n Effect.gen(function* () {\n const existing = yield* ctx.storage.getSource(namespace, scope);\n if (!existing) return;\n const canonicalHeaders =\n input.headers !== undefined\n ? canonicalizeCredentialMap(input.headers, graphqlHeaderSlot)\n : null;\n const canonicalQueryParams =\n input.queryParams !== undefined\n ? canonicalizeCredentialMap(input.queryParams, graphqlQueryParamSlot)\n : null;\n const canonicalAuth = input.auth !== undefined ? canonicalizeAuth(input.auth) : null;\n const directBindings = [\n ...(canonicalHeaders?.bindings ?? []),\n ...(canonicalQueryParams?.bindings ?? []),\n ...(canonicalAuth?.bindings ?? []),\n ];\n if (directBindings.length > 0) {\n yield* validateGraphqlBindingTarget(ctx, {\n sourceId: namespace,\n sourceScope: scope,\n targetScope,\n });\n }\n const affectedPrefixes = [\n ...(input.headers !== undefined ? [\"header:\"] : []),\n ...(input.queryParams !== undefined ? [\"query_param:\"] : []),\n ...(input.auth !== undefined ? [\"auth:\"] : []),\n ];\n yield* ctx.transaction(\n Effect.gen(function* () {\n yield* ctx.storage.updateSourceMeta(namespace, scope, {\n name: input.name?.trim() || undefined,\n endpoint: input.endpoint,\n headers: canonicalHeaders?.values,\n queryParams: canonicalQueryParams?.values,\n auth: canonicalAuth?.auth,\n });\n if (affectedPrefixes.length > 0 || directBindings.length > 0) {\n yield* ctx.credentialBindings.replaceForSource({\n targetScope: ScopeId.make(targetScope),\n pluginId: GRAPHQL_PLUGIN_ID,\n sourceId: namespace,\n sourceScope: ScopeId.make(scope),\n slotPrefixes: affectedPrefixes,\n bindings: directBindings.map((binding) => ({\n slotKey: binding.slot,\n value: binding.value,\n })),\n });\n }\n }),\n );\n });\n\n return {\n addSource: (config: GraphqlSourceConfig) =>\n addSourceInternal(config).pipe(\n Effect.tap((result) =>\n configFile\n ? configFile.upsertSource(toGraphqlConfigEntry(result.namespace, config))\n : Effect.void,\n ),\n ),\n\n removeSource: (namespace: string, scope: string) =>\n Effect.gen(function* () {\n yield* ctx.transaction(\n Effect.gen(function* () {\n yield* ctx.credentialBindings.removeForSource({\n pluginId: GRAPHQL_PLUGIN_ID,\n sourceId: namespace,\n sourceScope: ScopeId.make(scope),\n });\n yield* ctx.storage.removeSource(namespace, scope);\n yield* ctx.core.sources.unregister({ id: namespace, targetScope: scope });\n }),\n );\n if (configFile) {\n yield* configFile.removeSource(namespace);\n }\n }),\n\n getSource: (namespace: string, scope: string) => ctx.storage.getSource(namespace, scope),\n\n configureSource,\n\n configure: (source: GraphqlSourceRef, input: GraphqlConfigureSourceInput) =>\n configureSource(source.id, source.scope, input.scope, input),\n };\n};\n\nexport type GraphqlPluginExtension = ReturnType<typeof makeGraphqlExtension>;\n\nexport const graphqlPlugin = definePlugin((options?: GraphqlPluginOptions) => {\n return {\n id: \"graphql\" as const,\n packageName: \"@executor-js/plugin-graphql\",\n sourcePresets: graphqlPresets,\n schema: graphqlSchema,\n storage: (deps): GraphqlStore => makeDefaultGraphqlStore(deps),\n\n extension: (ctx) =>\n makeGraphqlExtension(\n ctx,\n options?.httpClientLayer ?? ctx.httpClientLayer,\n options?.configFile,\n ),\n\n sourceConfigure: {\n type: \"graphql\",\n schema: SourceConfigureInputSchema,\n configure: ({ ctx, sourceId, sourceScope, targetScope, config }) =>\n makeGraphqlExtension(\n ctx,\n options?.httpClientLayer ?? ctx.httpClientLayer,\n options?.configFile,\n ).configureSource(\n sourceId,\n sourceScope,\n targetScope,\n config as GraphqlConfigureSourceInput,\n ),\n },\n\n staticSources: (self) => [\n {\n id: \"graphql\",\n kind: \"executor\",\n name: \"GraphQL\",\n tools: [\n tool({\n name: \"getSource\",\n description:\n \"Inspect an existing GraphQL source, including endpoint, auth mode, configured headers/query params, and credential slots. Use this before repairing an existing source with `graphql.configureSource`, `secrets.create`, or `oauth.start`.\",\n inputSchema: StaticGetSourceInputStandardSchema,\n outputSchema: StaticGetSourceOutputStandardSchema,\n execute: (input, { ctx }) =>\n Effect.map(\n self.getSource(input.namespace, resolveStaticScopeInput(ctx, input.scope)),\n (source) => ToolResult.ok({ source }),\n ),\n }),\n tool({\n name: \"addSource\",\n description:\n \"Add a GraphQL endpoint and register its operations as tools. Executor chooses the source install scope (local scope locally, organization scope in cloud) and returns it as `source`. For API keys or bearer tokens, first call `executor.coreTools.secrets.create` at the user's chosen credential scope and pass secret refs through `credentials`. For OAuth, start the browser flow with `executor.coreTools.oauth.start` using `credentialScope` set to the user's chosen personal or organization credential scope, verify completion with `connections.list`, then bind the connection through `credentials` or `graphql.configureSource`.\",\n annotations: {\n requiresApproval: true,\n approvalDescription: \"Add a GraphQL source\",\n },\n inputSchema: StaticAddSourceInputStandardSchema,\n outputSchema: StaticAddSourceOutputStandardSchema,\n execute: (input, { ctx }) => {\n const sourceScope = defaultSourceInstallScopeId(ctx.scopes);\n if (sourceScope === null) {\n return Effect.succeed(\n graphqlToolFailure(\n \"source_scope_unavailable\",\n \"Cannot add a GraphQL source because this executor has no source install scope.\",\n ),\n );\n }\n return self.addSource({ ...input, scope: sourceScope }).pipe(\n Effect.map((result) =>\n ToolResult.ok({\n ...result,\n source: { id: result.namespace, scope: sourceScope },\n }),\n ),\n Effect.catchTags({\n GraphqlIntrospectionError: ({ message }) =>\n Effect.succeed(graphqlToolFailure(\"graphql_introspection_failed\", message)),\n GraphqlExtractionError: ({ message }) =>\n Effect.succeed(graphqlToolFailure(\"graphql_extraction_failed\", message)),\n }),\n );\n },\n }),\n tool({\n name: \"configureSource\",\n description:\n 'Configure an existing GraphQL source with concrete fields. Use `source` returned by `graphql.addSource` or `sources.list`. The top-level `scope` is the credential target scope for bindings; in cloud, choose the user or organization credential scope deliberately. Pass secret refs as `{kind:\"secret\", secretId}` and OAuth connections as `{kind:\"connection\", connectionId}`.',\n annotations: {\n requiresApproval: true,\n approvalDescription: \"Configure a GraphQL source\",\n },\n inputSchema: StaticConfigureSourceInputStandardSchema,\n outputSchema: StaticConfigureSourceOutputStandardSchema,\n execute: (input, { ctx }) => {\n const { source, ...config } = input as typeof StaticConfigureSourceInputSchema.Type;\n const sourceScope = resolveStaticScopeInput(ctx, source.scope);\n const targetScope = resolveStaticScopeInput(ctx, config.scope);\n return Effect.as(\n self.configure(\n { id: source.id, scope: sourceScope },\n { ...config, scope: targetScope },\n ),\n ToolResult.ok({ configured: true }),\n );\n },\n }),\n ],\n },\n ],\n\n invokeTool: ({ ctx, toolRow, args }) =>\n Effect.gen(function* () {\n const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;\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 + source plugin-storage rows live at the same\n // scope, so pin every store lookup to it instead of relying on\n // stack-wide scope fall-through.\n const toolScope = toolRow.scope_id;\n const op = yield* ctx.storage.getOperationByToolId(toolRow.id, toolScope);\n if (!op) {\n return yield* new GraphqlInvocationError({\n message: `No GraphQL operation found for tool \"${toolRow.id}\"`,\n statusCode: Option.none(),\n });\n }\n const source = yield* ctx.storage.getSource(op.sourceId, toolScope);\n if (!source) {\n return yield* new GraphqlInvocationError({\n message: `No GraphQL source found for \"${op.sourceId}\"`,\n statusCode: Option.none(),\n });\n }\n\n const resolvedHeaders =\n (yield* resolveGraphqlBindingValueMap(ctx, source.headers, {\n sourceId: source.namespace,\n sourceScope: source.scope,\n missingLabel: \"header\",\n })) ?? {};\n const resolvedQueryParams =\n (yield* resolveGraphqlBindingValueMap(ctx, source.queryParams, {\n sourceId: source.namespace,\n sourceScope: source.scope,\n missingLabel: \"query parameter\",\n })) ?? {};\n const oauthHeader = yield* resolveGraphqlStoredOAuthHeader(\n ctx,\n source.namespace,\n source.scope,\n source.auth,\n );\n Object.assign(resolvedHeaders, oauthHeader ?? {});\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 const errors = decodeGraphqlErrors(result.errors);\n if (errors !== undefined && errors.length > 0) {\n const firstMessage = extractGraphqlErrorMessage(errors);\n return ToolResult.fail({\n code: \"graphql_errors\",\n message: firstMessage !== undefined ? firstMessage : \"GraphQL request returned errors\",\n details: { errors },\n });\n }\n if (result.status < 200 || result.status >= 300) {\n if (result.status === 401 || result.status === 403) {\n return authToolFailure({\n code: \"credential_rejected\",\n status: result.status,\n message: `Upstream rejected credentials for GraphQL source \"${source.namespace}\" with HTTP ${result.status}. Re-authenticate or update the source credentials before retrying this tool.`,\n source: { id: source.namespace, scope: source.scope },\n credential: { kind: \"upstream\", label: \"Upstream authorization\" },\n upstream: {\n status: result.status,\n details: {\n data: result.data,\n errors: result.errors,\n },\n },\n recovery: { configureSourceTool: \"executor.graphql.configureSource\" },\n });\n }\n return ToolResult.fail({\n code: \"graphql_http_error\",\n status: result.status,\n message: `GraphQL request failed with HTTP ${result.status}`,\n details: {\n status: result.status,\n data: result.data,\n errors: result.errors,\n },\n });\n }\n return ToolResult.ok(result.data);\n }).pipe(\n Effect.catchTag(\"GraphqlAuthRequiredError\", (error) =>\n Effect.succeed(graphqlAuthToolFailure(error)),\n ),\n ),\n\n 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);\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(sourceId, scope);\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)?.get(row.id);\n if (binding) out[row.id] = annotationsFor(binding);\n }\n return out;\n }),\n\n removeSource: ({ ctx, sourceId, scope }) =>\n Effect.gen(function* () {\n yield* ctx.transaction(\n Effect.gen(function* () {\n yield* ctx.credentialBindings.removeForSource({\n pluginId: GRAPHQL_PLUGIN_ID,\n sourceId,\n sourceScope: ScopeId.make(scope),\n });\n yield* ctx.storage.removeSource(sourceId, scope);\n }),\n );\n if (options?.configFile) {\n yield* options.configFile.removeSource(sourceId);\n }\n }),\n\n usagesForSecret: () => Effect.succeed([]),\n\n usagesForConnection: () => Effect.succeed([]),\n\n detect: ({ ctx, url }) =>\n Effect.gen(function* () {\n const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;\n const trimmed = url.trim();\n if (!trimmed) return null;\n const parsed = yield* Effect.try({\n try: () => new URL(trimmed),\n catch: (cause) => cause,\n }).pipe(Effect.option);\n if (Option.isNone(parsed)) return null;\n\n const ok = yield* introspect(trimmed).pipe(\n Effect.provide(httpClientLayer),\n Effect.map(() => true),\n Effect.catch(() => Effect.succeed(false)),\n );\n\n const name = namespaceFromEndpoint(trimmed);\n\n if (ok) {\n return SourceDetectionResult.make({\n kind: \"graphql\",\n confidence: \"high\",\n endpoint: trimmed,\n name,\n namespace: name,\n });\n }\n\n // Low-confidence URL-token fallback. Introspection can fail for\n // many reasons (auth, CORS, the endpoint disabled introspection\n // in production, transport errors). When the URL itself\n // strongly implies GraphQL, surface a candidate so the user\n // can still pick it from the detect dropdown.\n if (urlMatchesToken(parsed.value, \"graphql\")) {\n return SourceDetectionResult.make({\n kind: \"graphql\",\n confidence: \"low\",\n endpoint: trimmed,\n name,\n namespace: name,\n });\n }\n\n return null;\n }),\n };\n // HTTP transport (routes/handlers/extensionService) is layered on by\n // the api-aware factory in `@executor-js/plugin-graphql/api`. Hosts that\n // want the HTTP surface import the plugin from there; SDK-only\n // consumers stay on this entry and avoid the server-only deps.\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAQ,QAAQ,cAAc;AACvC,SAAS,YAAY,yBAAyB;AAQ9C,IAAM,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0E5B,IAAM,2BAA2B,OAA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AAO,OAAO,SAAS,GAAG;AAC5C,eAAO,sBAAsB,KAAK;AAAA,UAChC,MAAM;AAAA,UACN,YAAY;AAAA,UACZ,UAAU;AAAA,UACV;AAAA,UACA,WAAW;AAAA,QACb,CAAC;AAAA,MACH;AAEA,aAAO;AAAA,IACT,CAAC;AAAA,EACL;AAKF,CAAC;","names":["raw","Effect","Option","Option","Effect","Effect","Option","HttpClient","HttpClientRequest","Effect","Option","HttpClient","HttpClientRequest","Effect","Option","Schema","Schema","Option","Effect","Effect","Match","Option","Schema","Schema","Option","formatTypeRef","Match","unwrapTypeName","Effect","connectionId"]}
|
package/dist/chunk-D3FN3ZDA.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfiguredGraphqlCredentialValue,
|
|
3
|
-
GraphqlConfiguredValueInput,
|
|
4
|
-
GraphqlCredentialInput,
|
|
5
|
-
GraphqlExtractionError,
|
|
6
|
-
GraphqlIntrospectionError,
|
|
7
|
-
GraphqlSourceAuth,
|
|
8
|
-
GraphqlSourceAuthInput
|
|
9
|
-
} from "./chunk-UIAHATHP.js";
|
|
10
|
-
|
|
11
|
-
// src/react/atoms.ts
|
|
12
|
-
import * as Atom from "effect/unstable/reactivity/Atom";
|
|
13
|
-
import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
|
|
14
|
-
import { sourceCredentialBindingsAtom, sourcesOptimisticAtom } from "@executor-js/react/api/atoms";
|
|
15
|
-
import { ReactivityKey } from "@executor-js/react/api/reactivity-keys";
|
|
16
|
-
|
|
17
|
-
// src/react/client.ts
|
|
18
|
-
import { createPluginAtomClient } from "@executor-js/sdk/client";
|
|
19
|
-
import { getBaseUrl } from "@executor-js/react/api/base-url";
|
|
20
|
-
|
|
21
|
-
// src/api/group.ts
|
|
22
|
-
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
23
|
-
import { Schema } from "effect";
|
|
24
|
-
import { InternalError, ScopeId } from "@executor-js/sdk/shared";
|
|
25
|
-
import { OAuth2SourceConfig } from "@executor-js/sdk/http-source";
|
|
26
|
-
var StoredSourceSchema = Schema.Struct({
|
|
27
|
-
namespace: Schema.String,
|
|
28
|
-
scope: ScopeId,
|
|
29
|
-
name: Schema.String,
|
|
30
|
-
endpoint: Schema.String,
|
|
31
|
-
headers: Schema.Record(Schema.String, ConfiguredGraphqlCredentialValue),
|
|
32
|
-
queryParams: Schema.Record(Schema.String, ConfiguredGraphqlCredentialValue),
|
|
33
|
-
auth: GraphqlSourceAuth
|
|
34
|
-
});
|
|
35
|
-
var ScopeParams = {
|
|
36
|
-
scopeId: ScopeId
|
|
37
|
-
};
|
|
38
|
-
var SourceParams = {
|
|
39
|
-
scopeId: ScopeId,
|
|
40
|
-
namespace: Schema.String
|
|
41
|
-
};
|
|
42
|
-
var AddSourcePayload = Schema.Struct({
|
|
43
|
-
endpoint: Schema.String,
|
|
44
|
-
name: Schema.String,
|
|
45
|
-
introspectionJson: Schema.optional(Schema.String),
|
|
46
|
-
namespace: Schema.String,
|
|
47
|
-
headers: Schema.optional(Schema.Record(Schema.String, GraphqlConfiguredValueInput)),
|
|
48
|
-
queryParams: Schema.optional(Schema.Record(Schema.String, GraphqlConfiguredValueInput)),
|
|
49
|
-
oauth2: Schema.optional(OAuth2SourceConfig),
|
|
50
|
-
credentials: Schema.optional(
|
|
51
|
-
Schema.Struct({
|
|
52
|
-
scope: ScopeId,
|
|
53
|
-
headers: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),
|
|
54
|
-
queryParams: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),
|
|
55
|
-
auth: Schema.optional(GraphqlSourceAuthInput)
|
|
56
|
-
})
|
|
57
|
-
)
|
|
58
|
-
});
|
|
59
|
-
var AddSourceResponse = Schema.Struct({
|
|
60
|
-
toolCount: Schema.Number,
|
|
61
|
-
namespace: Schema.String
|
|
62
|
-
});
|
|
63
|
-
var IntrospectionError = GraphqlIntrospectionError.annotate({ httpApiStatus: 400 });
|
|
64
|
-
var ExtractionError = GraphqlExtractionError.annotate({ httpApiStatus: 400 });
|
|
65
|
-
var GraphqlErrors = [InternalError, IntrospectionError, ExtractionError];
|
|
66
|
-
var GraphqlGroup = HttpApiGroup.make("graphql").add(
|
|
67
|
-
HttpApiEndpoint.post("addSource", "/scopes/:scopeId/graphql/sources", {
|
|
68
|
-
params: ScopeParams,
|
|
69
|
-
payload: AddSourcePayload,
|
|
70
|
-
success: AddSourceResponse,
|
|
71
|
-
error: GraphqlErrors
|
|
72
|
-
})
|
|
73
|
-
).add(
|
|
74
|
-
HttpApiEndpoint.get("getSource", "/scopes/:scopeId/graphql/sources/:namespace", {
|
|
75
|
-
params: SourceParams,
|
|
76
|
-
success: Schema.NullOr(StoredSourceSchema),
|
|
77
|
-
error: GraphqlErrors
|
|
78
|
-
})
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
// src/react/client.ts
|
|
82
|
-
var GraphqlClient = createPluginAtomClient(GraphqlGroup, {
|
|
83
|
-
baseUrl: getBaseUrl
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
// src/react/atoms.ts
|
|
87
|
-
var graphqlSourceAtom = (scopeId, namespace) => GraphqlClient.query("graphql", "getSource", {
|
|
88
|
-
params: { scopeId, namespace },
|
|
89
|
-
timeToLive: "15 seconds",
|
|
90
|
-
reactivityKeys: [ReactivityKey.sources, ReactivityKey.tools]
|
|
91
|
-
});
|
|
92
|
-
var graphqlSourceBindingsAtom = (scopeId, namespace, sourceScopeId) => sourceCredentialBindingsAtom(scopeId, namespace, sourceScopeId);
|
|
93
|
-
var addGraphqlSource = GraphqlClient.mutation("graphql", "addSource");
|
|
94
|
-
var addGraphqlSourceOptimistic = Atom.family(
|
|
95
|
-
(scopeId) => sourcesOptimisticAtom(scopeId).pipe(
|
|
96
|
-
Atom.optimisticFn({
|
|
97
|
-
reducer: (current, arg) => AsyncResult.map(current, (rows) => {
|
|
98
|
-
const id = arg.payload.namespace ?? `pending-${Math.random().toString(36).slice(2)}`;
|
|
99
|
-
const source = {
|
|
100
|
-
id,
|
|
101
|
-
scopeId,
|
|
102
|
-
kind: "graphql",
|
|
103
|
-
pluginId: "graphql",
|
|
104
|
-
name: arg.payload.name ?? id,
|
|
105
|
-
url: arg.payload.endpoint,
|
|
106
|
-
canRemove: false,
|
|
107
|
-
canRefresh: false,
|
|
108
|
-
canEdit: false,
|
|
109
|
-
runtime: false
|
|
110
|
-
};
|
|
111
|
-
return [source, ...rows.filter((row) => row.id !== id)].sort(
|
|
112
|
-
(a, b) => a.name.localeCompare(b.name)
|
|
113
|
-
);
|
|
114
|
-
}),
|
|
115
|
-
fn: addGraphqlSource
|
|
116
|
-
})
|
|
117
|
-
)
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
export {
|
|
121
|
-
graphqlSourceAtom,
|
|
122
|
-
graphqlSourceBindingsAtom,
|
|
123
|
-
addGraphqlSourceOptimistic
|
|
124
|
-
};
|
|
125
|
-
//# sourceMappingURL=chunk-D3FN3ZDA.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/atoms.ts","../src/react/client.ts","../src/api/group.ts"],"sourcesContent":["import type { ScopeId } from \"@executor-js/sdk/shared\";\nimport * as Atom from \"effect/unstable/reactivity/Atom\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport { sourceCredentialBindingsAtom, sourcesOptimisticAtom } from \"@executor-js/react/api/atoms\";\nimport { ReactivityKey } from \"@executor-js/react/api/reactivity-keys\";\nimport { GraphqlClient } from \"./client\";\n\n// ---------------------------------------------------------------------------\n// Query atoms\n// ---------------------------------------------------------------------------\n\nexport const graphqlSourceAtom = (scopeId: ScopeId, namespace: string) =>\n GraphqlClient.query(\"graphql\", \"getSource\", {\n params: { scopeId, namespace },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.sources, ReactivityKey.tools],\n });\n\nexport const graphqlSourceBindingsAtom = (\n scopeId: ScopeId,\n namespace: string,\n sourceScopeId: ScopeId,\n) => sourceCredentialBindingsAtom(scopeId, namespace, sourceScopeId);\n\n// ---------------------------------------------------------------------------\n// Mutation atoms\n// ---------------------------------------------------------------------------\n\nexport const addGraphqlSource = GraphqlClient.mutation(\"graphql\", \"addSource\");\n\nexport const addGraphqlSourceOptimistic = Atom.family((scopeId: ScopeId) =>\n sourcesOptimisticAtom(scopeId).pipe(\n Atom.optimisticFn({\n reducer: (current, arg) =>\n AsyncResult.map(current, (rows) => {\n const id = arg.payload.namespace ?? `pending-${Math.random().toString(36).slice(2)}`;\n const source = {\n id,\n scopeId,\n kind: \"graphql\",\n pluginId: \"graphql\",\n name: arg.payload.name ?? id,\n url: arg.payload.endpoint,\n canRemove: false,\n canRefresh: false,\n canEdit: false,\n runtime: false,\n };\n return [source, ...rows.filter((row) => row.id !== id)].sort((a, b) =>\n a.name.localeCompare(b.name),\n );\n }),\n fn: addGraphqlSource,\n }),\n ),\n);\n","import { createPluginAtomClient } from \"@executor-js/sdk/client\";\nimport { getBaseUrl } from \"@executor-js/react/api/base-url\";\nimport { GraphqlGroup } from \"../api/group\";\n\nexport const GraphqlClient = createPluginAtomClient(GraphqlGroup, {\n baseUrl: getBaseUrl,\n});\n","import { HttpApiEndpoint, HttpApiGroup } from \"effect/unstable/httpapi\";\nimport { Schema } from \"effect\";\nimport { InternalError, ScopeId } from \"@executor-js/sdk/shared\";\n\nimport { GraphqlIntrospectionError, GraphqlExtractionError } from \"../sdk/errors\";\nimport {\n GraphqlConfiguredValueInput,\n ConfiguredGraphqlCredentialValue,\n GraphqlCredentialInput,\n GraphqlSourceAuth,\n GraphqlSourceAuthInput,\n} from \"../sdk/types\";\nimport { OAuth2SourceConfig } from \"@executor-js/sdk/http-source\";\n\n// StoredGraphqlSource shape as an HTTP response schema. Kept local to the\n// api layer because the sdk-side `StoredGraphqlSource` is a plain interface.\nexport const StoredSourceSchema = Schema.Struct({\n namespace: Schema.String,\n scope: ScopeId,\n name: Schema.String,\n endpoint: Schema.String,\n headers: Schema.Record(Schema.String, ConfiguredGraphqlCredentialValue),\n queryParams: Schema.Record(Schema.String, ConfiguredGraphqlCredentialValue),\n auth: GraphqlSourceAuth,\n});\n\n// ---------------------------------------------------------------------------\n// Params\n// ---------------------------------------------------------------------------\n\nconst ScopeParams = {\n scopeId: ScopeId,\n};\n\nconst SourceParams = {\n scopeId: ScopeId,\n namespace: Schema.String,\n};\n\n// ---------------------------------------------------------------------------\n// Payloads\n// ---------------------------------------------------------------------------\n\nconst AddSourcePayload = Schema.Struct({\n endpoint: Schema.String,\n name: Schema.String,\n introspectionJson: Schema.optional(Schema.String),\n namespace: Schema.String,\n headers: Schema.optional(Schema.Record(Schema.String, GraphqlConfiguredValueInput)),\n queryParams: Schema.optional(Schema.Record(Schema.String, GraphqlConfiguredValueInput)),\n oauth2: Schema.optional(OAuth2SourceConfig),\n credentials: Schema.optional(\n Schema.Struct({\n scope: ScopeId,\n headers: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n queryParams: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n auth: Schema.optional(GraphqlSourceAuthInput),\n }),\n ),\n});\n\n// ---------------------------------------------------------------------------\n// Responses\n// ---------------------------------------------------------------------------\n\nconst AddSourceResponse = Schema.Struct({\n toolCount: Schema.Number,\n namespace: Schema.String,\n});\n\n// ---------------------------------------------------------------------------\n// Errors with HTTP status\n// ---------------------------------------------------------------------------\n\nconst IntrospectionError = GraphqlIntrospectionError.annotate({ httpApiStatus: 400 });\nconst ExtractionError = GraphqlExtractionError.annotate({ httpApiStatus: 400 });\n\n// ---------------------------------------------------------------------------\n// Group\n//\n// Plugin SDK errors (GraphqlIntrospectionError etc.) are declared once at\n// the group level via `.addError(...)` — every endpoint inherits them. The\n// errors themselves carry their HTTP status via `HttpApiSchema.annotations`\n// above, so handlers just `return yield* ext.foo(...)` and the schema\n// encodes whatever it gets.\n//\n// 5xx is handled at the API level: `.addError(InternalError)` adds a\n// single shared opaque-by-schema 500 surface translated from `StorageError`\n// by `withCapture` at the HTTP edge. No per-handler wrapping, no\n// per-plugin InternalError.\n// ---------------------------------------------------------------------------\n\nconst GraphqlErrors = [InternalError, IntrospectionError, ExtractionError] as const;\n\nexport const GraphqlGroup = HttpApiGroup.make(\"graphql\")\n .add(\n HttpApiEndpoint.post(\"addSource\", \"/scopes/:scopeId/graphql/sources\", {\n params: ScopeParams,\n payload: AddSourcePayload,\n success: AddSourceResponse,\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\"getSource\", \"/scopes/:scopeId/graphql/sources/:namespace\", {\n params: SourceParams,\n success: Schema.NullOr(StoredSourceSchema),\n error: GraphqlErrors,\n }),\n );\n// Plugin domain errors carry their own HTTP status (4xx);\n// `InternalError` is the shared opaque 500 translated at the HTTP edge.\n"],"mappings":";;;;;;;;;;;AACA,YAAY,UAAU;AACtB,YAAY,iBAAiB;AAC7B,SAAS,8BAA8B,6BAA6B;AACpE,SAAS,qBAAqB;;;ACJ9B,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;;;ACD3B,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,cAAc;AACvB,SAAS,eAAe,eAAe;AAUvC,SAAS,0BAA0B;AAI5B,IAAM,qBAAqB,OAAO,OAAO;AAAA,EAC9C,WAAW,OAAO;AAAA,EAClB,OAAO;AAAA,EACP,MAAM,OAAO;AAAA,EACb,UAAU,OAAO;AAAA,EACjB,SAAS,OAAO,OAAO,OAAO,QAAQ,gCAAgC;AAAA,EACtE,aAAa,OAAO,OAAO,OAAO,QAAQ,gCAAgC;AAAA,EAC1E,MAAM;AACR,CAAC;AAMD,IAAM,cAAc;AAAA,EAClB,SAAS;AACX;AAEA,IAAM,eAAe;AAAA,EACnB,SAAS;AAAA,EACT,WAAW,OAAO;AACpB;AAMA,IAAM,mBAAmB,OAAO,OAAO;AAAA,EACrC,UAAU,OAAO;AAAA,EACjB,MAAM,OAAO;AAAA,EACb,mBAAmB,OAAO,SAAS,OA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E,SAAS,UAAU;AAAA,EAC7B,YAAY;AAAA,EACZ,gBAAgB,CAAC,cAAc,SAAS,cAAc,KAAK;AAC7D,CAAC;AAEI,IAAM,4BAA4B,CACvC,SACA,WACA,kBACG,6BAA6B,SAAS,WAAW,aAAa;AAM5D,IAAM,mBAAmB,cAAc,SAAS,WAAW,WAAW;AAEtE,IAAM,6BAAkC;AAAA,EAAO,CAAC,YACrD,sBAAsB,OAAO,EAAE;AAAA,IACxB,kBAAa;AAAA,MAChB,SAAS,CAAC,SAAS,QACL,gBAAI,SAAS,CAAC,SAAS;AACjC,cAAM,KAAK,IAAI,QAAQ,aAAa,WAAW,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AAClF,cAAM,SAAS;AAAA,UACb;AAAA,UACA;AAAA,UACA,MAAM;AAAA,UACN,UAAU;AAAA,UACV,MAAM,IAAI,QAAQ,QAAQ;AAAA,UAC1B,KAAK,IAAI,QAAQ;AAAA,UACjB,WAAW;AAAA,UACX,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,SAAS;AAAA,QACX;AACA,eAAO,CAAC,QAAQ,GAAG,KAAK,OAAO,CAAC,QAAQ,IAAI,OAAO,EAAE,CAAC,EAAE;AAAA,UAAK,CAAC,GAAG,MAC/D,EAAE,KAAK,cAAc,EAAE,IAAI;AAAA,QAC7B;AAAA,MACF,CAAC;AAAA,MACH,IAAI;AAAA,IACN,CAAC;AAAA,EACH;AACF;","names":[]}
|
package/dist/chunk-M4SJY6CB.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// src/react/GraphqlSourceFields.tsx
|
|
2
|
-
import {
|
|
3
|
-
CardStack,
|
|
4
|
-
CardStackContent,
|
|
5
|
-
CardStackEntryField
|
|
6
|
-
} from "@executor-js/react/components/card-stack";
|
|
7
|
-
import { Input } from "@executor-js/react/components/input";
|
|
8
|
-
import {
|
|
9
|
-
SourceIdentityFieldRows
|
|
10
|
-
} from "@executor-js/react/plugins/source-identity";
|
|
11
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
function GraphqlSourceFields(props) {
|
|
13
|
-
return /* @__PURE__ */ jsx(CardStack, { children: /* @__PURE__ */ jsxs(CardStackContent, { className: "border-t-0", children: [
|
|
14
|
-
/* @__PURE__ */ jsx(
|
|
15
|
-
CardStackEntryField,
|
|
16
|
-
{
|
|
17
|
-
label: "Endpoint",
|
|
18
|
-
hint: "The endpoint will be introspected to discover available queries and mutations.",
|
|
19
|
-
children: /* @__PURE__ */ jsx(
|
|
20
|
-
Input,
|
|
21
|
-
{
|
|
22
|
-
value: props.endpoint,
|
|
23
|
-
onChange: (e) => props.onEndpointChange(e.target.value),
|
|
24
|
-
placeholder: "https://api.example.com/graphql",
|
|
25
|
-
className: "font-mono text-sm",
|
|
26
|
-
disabled: props.endpointDisabled
|
|
27
|
-
}
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
),
|
|
31
|
-
/* @__PURE__ */ jsx(
|
|
32
|
-
SourceIdentityFieldRows,
|
|
33
|
-
{
|
|
34
|
-
identity: props.identity,
|
|
35
|
-
namePlaceholder: "e.g. Shopify API",
|
|
36
|
-
namespaceReadOnly: props.namespaceReadOnly
|
|
37
|
-
}
|
|
38
|
-
)
|
|
39
|
-
] }) });
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export {
|
|
43
|
-
GraphqlSourceFields
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=chunk-M4SJY6CB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/GraphqlSourceFields.tsx"],"sourcesContent":["import {\n CardStack,\n CardStackContent,\n CardStackEntryField,\n} from \"@executor-js/react/components/card-stack\";\nimport { Input } from \"@executor-js/react/components/input\";\nimport {\n SourceIdentityFieldRows,\n type SourceIdentity,\n} from \"@executor-js/react/plugins/source-identity\";\n\nexport function GraphqlSourceFields(props: {\n readonly endpoint: string;\n readonly onEndpointChange: (endpoint: string) => void;\n readonly identity: SourceIdentity;\n readonly endpointDisabled?: boolean;\n readonly namespaceReadOnly?: boolean;\n}) {\n return (\n <CardStack>\n <CardStackContent className=\"border-t-0\">\n <CardStackEntryField\n label=\"Endpoint\"\n hint=\"The endpoint will be introspected to discover available queries and mutations.\"\n >\n <Input\n value={props.endpoint}\n onChange={(e) => props.onEndpointChange((e.target as HTMLInputElement).value)}\n placeholder=\"https://api.example.com/graphql\"\n className=\"font-mono text-sm\"\n disabled={props.endpointDisabled}\n />\n </CardStackEntryField>\n <SourceIdentityFieldRows\n identity={props.identity}\n namePlaceholder=\"e.g. Shopify API\"\n namespaceReadOnly={props.namespaceReadOnly}\n />\n </CardStackContent>\n </CardStack>\n );\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,OAEK;AAWD,SAKI,KALJ;AATC,SAAS,oBAAoB,OAMjC;AACD,SACE,oBAAC,aACC,+BAAC,oBAAiB,WAAU,cAC1B;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAM;AAAA,QACN,MAAK;AAAA,QAEL;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,MAAM;AAAA,YACb,UAAU,CAAC,MAAM,MAAM,iBAAkB,EAAE,OAA4B,KAAK;AAAA,YAC5E,aAAY;AAAA,YACZ,WAAU;AAAA,YACV,UAAU,MAAM;AAAA;AAAA,QAClB;AAAA;AAAA,IACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,MAAM;AAAA,QAChB,iBAAgB;AAAA,QAChB,mBAAmB,MAAM;AAAA;AAAA,IAC3B;AAAA,KACF,GACF;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sdk/errors.ts","../src/sdk/types.ts"],"sourcesContent":["import { Data, Schema } from \"effect\";\nimport type { Option } from \"effect\";\nimport type { AuthToolFailureCode } from \"@executor-js/sdk/core\";\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\nexport class GraphqlAuthRequiredError extends Data.TaggedError(\"GraphqlAuthRequiredError\")<{\n readonly code: AuthToolFailureCode;\n readonly message: string;\n readonly sourceId: string;\n readonly sourceScope: string;\n readonly credentialKind: \"secret\" | \"connection\" | \"oauth\" | \"upstream\";\n readonly credentialLabel?: string;\n readonly slotKey?: string;\n readonly secretId?: string;\n readonly connectionId?: string;\n readonly status?: number;\n readonly details?: unknown;\n readonly cause?: unknown;\n}> {}\n","import { Effect, Schema } from \"effect\";\nimport {\n ConfiguredCredentialValue,\n credentialSlotKey,\n SecretBackedValue,\n} from \"@executor-js/sdk/shared\";\nimport { HttpConfiguredValueInput, HttpCredentialInput } from \"@executor-js/sdk/http-source\";\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 const GraphqlArgument = Schema.Struct({\n name: Schema.String,\n typeName: Schema.String,\n required: Schema.Boolean,\n description: Schema.OptionFromOptional(Schema.String),\n});\nexport type GraphqlArgument = typeof GraphqlArgument.Type;\n\nexport const ExtractedField = Schema.Struct({\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});\nexport type ExtractedField = typeof ExtractedField.Type;\n\nexport const ExtractionResult = Schema.Struct({\n /** Schema name from introspection */\n schemaName: Schema.OptionFromOptional(Schema.String),\n fields: Schema.Array(ExtractedField),\n});\nexport type ExtractionResult = typeof ExtractionResult.Type;\n\n// ---------------------------------------------------------------------------\n// Operation binding — minimal data needed to invoke\n// ---------------------------------------------------------------------------\n\nexport const OperationBinding = Schema.Struct({\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});\nexport type OperationBinding = typeof OperationBinding.Type;\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\nexport const ConfiguredGraphqlCredentialValue = ConfiguredCredentialValue;\nexport type ConfiguredGraphqlCredentialValue = typeof ConfiguredGraphqlCredentialValue.Type;\nexport const GraphqlConfiguredValueInput = HttpConfiguredValueInput;\nexport type GraphqlConfiguredValueInput = typeof GraphqlConfiguredValueInput.Type;\nexport const GraphqlCredentialInput = HttpCredentialInput;\nexport type GraphqlCredentialInput = typeof GraphqlCredentialInput.Type;\n\nexport const graphqlHeaderSlot = (name: string): string => credentialSlotKey(\"header\", name);\nexport const graphqlQueryParamSlot = (name: string): string =>\n credentialSlotKey(\"query_param\", name);\nexport const GRAPHQL_OAUTH_CONNECTION_SLOT = \"auth:oauth2:connection\";\n\n// ---------------------------------------------------------------------------\n// Source auth\n// ---------------------------------------------------------------------------\n\nexport const GraphqlSourceAuth = Schema.Union([\n Schema.Struct({ kind: Schema.Literal(\"none\") }),\n Schema.Struct({\n kind: Schema.Literal(\"oauth2\"),\n connectionSlot: Schema.String,\n }),\n]);\nexport type GraphqlSourceAuth = typeof GraphqlSourceAuth.Type;\n\nexport const GraphqlSourceAuthInput = Schema.Union([\n Schema.Struct({\n kind: Schema.Literal(\"none\"),\n }),\n Schema.Struct({\n oauth2: Schema.optional(\n Schema.Struct({\n connection: Schema.optional(HttpCredentialInput),\n }),\n ),\n }),\n]);\nexport type GraphqlSourceAuthInput = typeof GraphqlSourceAuthInput.Type;\n\nexport const InvocationConfig = Schema.Struct({\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, ConfiguredGraphqlCredentialValue).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, ConfiguredGraphqlCredentialValue).pipe(\n Schema.withDecodingDefault(Effect.succeed({})),\n Schema.withConstructorDefault(Effect.succeed({})),\n ),\n});\nexport type InvocationConfig = typeof InvocationConfig.Type;\n\nexport const InvocationResult = Schema.Struct({\n status: Schema.Number,\n data: Schema.NullOr(Schema.Unknown),\n errors: Schema.NullOr(Schema.Unknown),\n});\nexport type InvocationResult = typeof InvocationResult.Type;\n"],"mappings":";AAAA,SAAS,MAAM,cAAc;AAItB,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;AAEG,IAAM,2BAAN,cAAuC,KAAK,YAAY,0BAA0B,EAatF;AAAC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