@executor-js/plugin-graphql 1.5.5 → 1.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AddGraphqlSource-P3D3UXRJ.js → AddGraphqlSource-FGT7DNXV.js} +39 -64
- package/dist/AddGraphqlSource-FGT7DNXV.js.map +1 -0
- package/dist/{EditGraphqlSource-FVF67CTP.js → EditGraphqlSource-QELISUYT.js} +4 -4
- package/dist/GraphqlAccountsPanel-U62WSGHR.js +9 -0
- package/dist/api/group.d.ts +54 -21
- package/dist/api/handlers.d.ts +1 -1
- package/dist/api/index.d.ts +55 -22
- package/dist/{chunk-N5GJE7R6.js → chunk-732HGFSH.js} +57 -21
- package/dist/chunk-732HGFSH.js.map +1 -0
- package/dist/{chunk-2Y3J3CVO.js → chunk-HN5FB4DO.js} +35 -55
- package/dist/chunk-HN5FB4DO.js.map +1 -0
- package/dist/{chunk-VCYDSSIK.js → chunk-OGNJZCEF.js} +27 -28
- package/dist/chunk-OGNJZCEF.js.map +1 -0
- package/dist/{chunk-ADQTI2OK.js → chunk-OUZI3QNC.js} +119 -124
- package/dist/chunk-OUZI3QNC.js.map +1 -0
- package/dist/client.js +3 -3
- package/dist/core.js +124 -10
- package/dist/core.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/react/atoms.d.ts +83 -29
- package/dist/react/auth-method-config.d.ts +21 -8
- package/dist/react/client.d.ts +54 -21
- package/dist/react/defaults.d.ts +0 -11
- package/dist/sdk/index.d.ts +4 -1
- package/dist/sdk/introspection-blob-migration.d.ts +7 -0
- package/dist/sdk/migrate-config.d.ts +6 -0
- package/dist/sdk/plugin.d.ts +49 -22
- package/dist/sdk/store.d.ts +11 -1
- package/dist/sdk/types.d.ts +102 -47
- package/package.json +3 -3
- package/dist/AddGraphqlSource-P3D3UXRJ.js.map +0 -1
- package/dist/GraphqlAccountsPanel-GBNFHLFH.js +0 -9
- package/dist/chunk-2Y3J3CVO.js.map +0 -1
- package/dist/chunk-ADQTI2OK.js.map +0 -1
- package/dist/chunk-N5GJE7R6.js.map +0 -1
- package/dist/chunk-VCYDSSIK.js.map +0 -1
- /package/dist/{EditGraphqlSource-FVF67CTP.js.map → EditGraphqlSource-QELISUYT.js.map} +0 -0
- /package/dist/{GraphqlAccountsPanel-GBNFHLFH.js.map → GraphqlAccountsPanel-U62WSGHR.js.map} +0 -0
|
@@ -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\n/** A tool invocation could not produce a usable credential. Re-keyed for v2:\n * references the connection by (owner, integration, name) instead of a v1\n * source id + scope. */\nexport class GraphqlAuthRequiredError extends Data.TaggedError(\"GraphqlAuthRequiredError\")<{\n readonly code: AuthToolFailureCode;\n readonly message: string;\n readonly owner: string;\n readonly integration: string;\n readonly connection: string;\n readonly credentialKind: \"secret\" | \"oauth\" | \"upstream\";\n readonly credentialLabel?: string;\n readonly template?: string;\n readonly status?: number;\n readonly details?: unknown;\n readonly cause?: unknown;\n}> {}\n","import { Schema } from \"effect\";\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// Authentication template (v2)\n//\n// The integration's `config.authenticationTemplate` describes WHERE a\n// connection's resolved value is applied: an apiKey header / query param (with\n// an optional prefix like `Bearer `) or an OAuth bearer header. There are no\n// secret slots and no credential bindings — a connection IS the credential, and\n// the plugin renders `credential.value` onto the request through the template\n// matched by `credential.template` (D11: \"auth state derived into the\n// auth-template format\" — an OAuth access token renders exactly like an apiKey\n// bearer).\n// ---------------------------------------------------------------------------\n\n/** An apiKey-style template: place the value in a header or query parameter,\n * optionally prefixed (e.g. `Bearer `). */\nexport const ApiKeyAuthTemplate = Schema.Struct({\n kind: Schema.Literal(\"apiKey\"),\n /** The template slug a connection references via `connection.template`. */\n slug: Schema.String,\n in: Schema.Literals([\"header\", \"query\"]),\n /** The header / query-parameter name the value is written to. */\n name: Schema.String,\n /** Optional prefix prepended to the value (e.g. `Bearer `). */\n prefix: Schema.optional(Schema.String),\n});\nexport type ApiKeyAuthTemplate = typeof ApiKeyAuthTemplate.Type;\n\n/** An OAuth bearer template: write `Authorization: Bearer <access-token>`. The\n * resolved (and refreshed) access token is `credential.value`. */\nexport const OAuthAuthTemplate = Schema.Struct({\n kind: Schema.Literal(\"oauth2\"),\n slug: Schema.String,\n /** The header to write the bearer token to. Defaults to `Authorization`. */\n header: Schema.optional(Schema.String),\n /** The token prefix. Defaults to `Bearer `. */\n prefix: Schema.optional(Schema.String),\n});\nexport type OAuthAuthTemplate = typeof OAuthAuthTemplate.Type;\n\nexport const AuthTemplate = Schema.Union([ApiKeyAuthTemplate, OAuthAuthTemplate]);\nexport type AuthTemplate = typeof AuthTemplate.Type;\n\n// ---------------------------------------------------------------------------\n// Integration config — the opaque-to-core blob the graphql plugin stores on the\n// integration row. Holds everything `resolveTools` (introspection) and\n// `invokeTool` (request building + auth rendering) need.\n// ---------------------------------------------------------------------------\n\nexport const GraphqlIntegrationConfig = Schema.Struct({\n /** The GraphQL endpoint URL. */\n endpoint: Schema.String,\n /** Display name for the integration. */\n name: Schema.String,\n /** Optional introspection JSON text (when the endpoint doesn't support\n * live introspection). */\n introspectionJson: Schema.optional(Schema.String),\n /** Static headers applied to every request (and to add-time introspection). */\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n /** Static query parameters applied to every request. */\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n /** Auth methods a connection can be applied through. */\n authenticationTemplate: Schema.Array(AuthTemplate),\n});\nexport type GraphqlIntegrationConfig = typeof GraphqlIntegrationConfig.Type;\n\nexport const decodeGraphqlIntegrationConfig = Schema.decodeUnknownEffect(GraphqlIntegrationConfig);\nexport const decodeGraphqlIntegrationConfigOption =\n Schema.decodeUnknownOption(GraphqlIntegrationConfig);\n\n// ---------------------------------------------------------------------------\n// Invocation\n// ---------------------------------------------------------------------------\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;AAKG,IAAM,2BAAN,cAAuC,KAAK,YAAY,0BAA0B,EAYtF;AAAC;;;ACvCJ,SAAS,UAAAA,eAAc;AAMhB,IAAM,uBAAuBA,QAAO,SAAS,CAAC,SAAS,UAAU,CAAC;AAOlE,IAAM,kBAAkBA,QAAO,OAAO;AAAA,EAC3C,MAAMA,QAAO;AAAA,EACb,UAAUA,QAAO;AAAA,EACjB,UAAUA,QAAO;AAAA,EACjB,aAAaA,QAAO,mBAAmBA,QAAO,MAAM;AACtD,CAAC;AAGM,IAAM,iBAAiBA,QAAO,OAAO;AAAA;AAAA,EAE1C,WAAWA,QAAO;AAAA;AAAA,EAElB,MAAM;AAAA,EACN,aAAaA,QAAO,mBAAmBA,QAAO,MAAM;AAAA,EACpD,WAAWA,QAAO,MAAM,eAAe;AAAA;AAAA,EAEvC,aAAaA,QAAO,mBAAmBA,QAAO,OAAO;AAAA;AAAA,EAErD,gBAAgBA,QAAO;AACzB,CAAC;AAGM,IAAM,mBAAmBA,QAAO,OAAO;AAAA;AAAA,EAE5C,YAAYA,QAAO,mBAAmBA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AAM9C,IAAM,mBAAmBA,QAAO,OAAO;AAAA,EAC5C,QAAQA,QAAO;AAAA,EACf,MAAMA,QAAO,OAAOA,QAAO,OAAO;AAAA,EAClC,QAAQA,QAAO,OAAOA,QAAO,OAAO;AACtC,CAAC;","names":["Schema"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/GraphqlAccountsPanel.tsx"],"sourcesContent":["import { useCallback, useMemo } from \"react\";\nimport { useAtomValue, useAtomSet } from \"@effect/atom-react\";\nimport * as Exit from \"effect/Exit\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport { IntegrationSlug } from \"@executor-js/sdk/shared\";\nimport type { IntegrationAccountHandoff } from \"@executor-js/sdk/client\";\n\nimport { AccountsSection } from \"@executor-js/react/components/accounts-section\";\nimport { integrationWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport type { CreateCustomMethod } from \"@executor-js/react/components/add-custom-method-modal\";\nimport type { AuthMethod, Placement } from \"@executor-js/react/lib/auth-placements\";\n\nimport { graphqlConfigAtom, graphqlConfigure } from \"./atoms\";\nimport { authMethodsFromConfig, graphqlTemplatesFromPlacements } from \"./auth-method-config\";\nimport type { AuthTemplate } from \"../sdk/types\";\n\n// ---------------------------------------------------------------------------\n// GraphQL Accounts hub — fills the generic detail page's `accounts` slot.\n//\n// Reads the integration's real `authenticationTemplate` (via `getConfig`),\n// converts it to generic `AuthMethod[]`, and composes the generic\n// `AccountsSection` — whose Add-account offers those methods plus a \"+ Custom\n// method\" row (apiKey-only). The custom-method create is INJECTED here\n// (`createCustomMethod`): generic placements → graphql `apiKey` templates\n// (`graphqlTemplatesFromPlacements`, slug omitted → backend `custom_<id>`)\n// merge-appended via `configure`. Stays plugin-side because it touches the\n// graphql sdk `AuthTemplate` types.\n// ---------------------------------------------------------------------------\n\nexport default function GraphqlAccountsPanel(props: {\n readonly sourceId: string;\n readonly integrationName: string;\n readonly accountHandoff?: IntegrationAccountHandoff | null;\n}) {\n const { sourceId, integrationName, accountHandoff } = props;\n const slug = IntegrationSlug.make(sourceId);\n const configResult = useAtomValue(graphqlConfigAtom(slug));\n const doConfigure = useAtomSet(graphqlConfigure, { mode: \"promiseExit\" });\n\n const existingTemplate = useMemo<readonly AuthTemplate[]>(() => {\n if (!AsyncResult.isSuccess(configResult) || configResult.value == null) return [];\n return configResult.value.authenticationTemplate ?? [];\n }, [configResult]);\n\n const methods = useMemo<readonly AuthMethod[]>(\n () => authMethodsFromConfig(existingTemplate),\n [existingTemplate],\n );\n\n // Add a custom apiKey method: build graphql `apiKey` templates from the\n // generic placements (slug omitted → backend backfills `custom_<id>`),\n // merge-append (the configure endpoint merges) and persist. Returns the\n // created `AuthMethod` so Add-account can select it immediately.\n const createCustomMethod = useCallback<CreateCustomMethod>(\n async (input: { readonly label: string; readonly placements: readonly Placement[] }) => {\n const templates = graphqlTemplatesFromPlacements(input.placements, \"\");\n if (templates.length === 0) return null;\n const exit = await doConfigure({\n params: { slug: String(slug) },\n payload: { authenticationTemplate: templates },\n reactivityKeys: integrationWriteKeys,\n });\n if (Exit.isFailure(exit)) return null;\n const before = new Set(existingTemplate.map((template: AuthTemplate) => template.slug));\n const created = authMethodsFromConfig(exit.value.authenticationTemplate).find(\n (candidate: AuthMethod) => !before.has(String(candidate.template)),\n );\n return created ?? null;\n },\n [doConfigure, existingTemplate, slug],\n );\n\n const removeCustomMethod = useCallback(\n async (method: AuthMethod): Promise<boolean> => {\n if (method.source !== \"custom\") return false;\n const next = existingTemplate.filter(\n (template: AuthTemplate) => template.slug !== String(method.template),\n );\n const exit = await doConfigure({\n params: { slug: String(slug) },\n payload: { authenticationTemplate: next, mode: \"replace\" },\n reactivityKeys: integrationWriteKeys,\n });\n return Exit.isSuccess(exit);\n },\n [doConfigure, existingTemplate, slug],\n );\n\n return (\n <div className=\"mx-auto max-w-3xl space-y-8 px-6 py-8\">\n <AccountsSection\n integration={slug}\n integrationName={integrationName}\n methods={methods}\n accountHandoff={accountHand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