@executor-js/plugin-graphql 0.2.1 → 1.4.21
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-LGXJQEAR.js → AddGraphqlSource-3Z3DB4KQ.js} +3 -3
- package/dist/{EditGraphqlSource-5Y47ZAZ7.js → EditGraphqlSource-F37RPNKV.js} +4 -4
- package/dist/{EditGraphqlSource-5Y47ZAZ7.js.map → EditGraphqlSource-F37RPNKV.js.map} +1 -1
- package/dist/{GraphqlSourceSummary-F3JWR4YN.js → GraphqlSourceSummary-6EYBXVD2.js} +3 -3
- package/dist/api/group.d.ts +38 -3
- package/dist/api/handlers.d.ts +38 -2
- package/dist/api/index.d.ts +76 -4
- package/dist/{chunk-7QSGNR4C.js → chunk-445ZPXHU.js} +18 -32
- package/dist/chunk-445ZPXHU.js.map +1 -0
- package/dist/{chunk-WPRU5C6M.js → chunk-EW4Y3KEX.js} +4 -4
- package/dist/chunk-EW4Y3KEX.js.map +1 -0
- package/dist/{chunk-HDPYOBBG.js → chunk-PO2TPM5B.js} +16 -13
- package/dist/chunk-PO2TPM5B.js.map +1 -0
- package/dist/client.js +3 -3
- package/dist/core.js +2 -2
- package/dist/index.js +2 -2
- package/dist/react/atoms.d.ts +38 -2
- package/dist/react/client.d.ts +38 -2
- package/dist/sdk/invoke.d.ts +16 -3
- package/dist/sdk/plugin.d.ts +77 -5
- package/dist/sdk/types.d.ts +46 -51
- package/package.json +3 -3
- package/dist/chunk-7QSGNR4C.js.map +0 -1
- package/dist/chunk-HDPYOBBG.js.map +0 -1
- package/dist/chunk-WPRU5C6M.js.map +0 -1
- /package/dist/{AddGraphqlSource-LGXJQEAR.js.map → AddGraphqlSource-3Z3DB4KQ.js.map} +0 -0
- /package/dist/{GraphqlSourceSummary-F3JWR4YN.js.map → GraphqlSourceSummary-6EYBXVD2.js.map} +0 -0
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
} from "./chunk-M4SJY6CB.js";
|
|
4
4
|
import {
|
|
5
5
|
addGraphqlSourceOptimistic
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-EW4Y3KEX.js";
|
|
7
|
+
import "./chunk-445ZPXHU.js";
|
|
8
8
|
|
|
9
9
|
// src/react/AddGraphqlSource.tsx
|
|
10
10
|
import { useCallback, useState } from "react";
|
|
@@ -236,4 +236,4 @@ function AddGraphqlSource(props) {
|
|
|
236
236
|
export {
|
|
237
237
|
AddGraphqlSource as default
|
|
238
238
|
};
|
|
239
|
-
//# sourceMappingURL=AddGraphqlSource-
|
|
239
|
+
//# sourceMappingURL=AddGraphqlSource-3Z3DB4KQ.js.map
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
graphqlSourceBindingsAtom,
|
|
7
7
|
setGraphqlSourceBinding,
|
|
8
8
|
updateGraphqlSource
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EW4Y3KEX.js";
|
|
10
10
|
import {
|
|
11
11
|
GRAPHQL_OAUTH_CONNECTION_SLOT,
|
|
12
12
|
GraphqlSourceBindingInput
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-445ZPXHU.js";
|
|
14
14
|
|
|
15
15
|
// src/react/EditGraphqlSource.tsx
|
|
16
16
|
import { useState } from "react";
|
|
@@ -202,7 +202,7 @@ function EditForm(props) {
|
|
|
202
202
|
onConnected: async (connectionId) => {
|
|
203
203
|
await setBinding({
|
|
204
204
|
params: { scopeId: oauthCredentialTargetScope },
|
|
205
|
-
payload:
|
|
205
|
+
payload: GraphqlSourceBindingInput.make({
|
|
206
206
|
sourceId: props.sourceId,
|
|
207
207
|
sourceScope,
|
|
208
208
|
scope: oauthCredentialTargetScope,
|
|
@@ -248,4 +248,4 @@ function EditGraphqlSource(props) {
|
|
|
248
248
|
export {
|
|
249
249
|
EditGraphqlSource as default
|
|
250
250
|
};
|
|
251
|
-
//# sourceMappingURL=EditGraphqlSource-
|
|
251
|
+
//# sourceMappingURL=EditGraphqlSource-F37RPNKV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/EditGraphqlSource.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { useAtomValue, useAtomSet } from \"@effect/atom-react\";\nimport * as Exit from \"effect/Exit\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport {\n graphqlSourceAtom,\n graphqlSourceBindingsAtom,\n setGraphqlSourceBinding,\n updateGraphqlSource,\n} from \"./atoms\";\nimport { connectionsAtom } from \"@executor-js/react/api/atoms\";\nimport { useScope, useScopeStack } from \"@executor-js/react/api/scope-context\";\nimport { connectionWriteKeys, sourceWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport { useSecretPickerSecrets } from \"@executor-js/react/plugins/use-secret-picker-secrets\";\nimport {\n HttpCredentialsEditor,\n serializeHttpCredentials,\n serializeScopedHttpCredentials,\n type HttpCredentialsState,\n} from \"@executor-js/react/plugins/http-credentials\";\nimport {\n effectiveCredentialBindingForScope,\n httpCredentialsFromConfiguredCredentialBindings,\n initialCredentialTargetScope,\n} from \"@executor-js/react/plugins/credential-bindings\";\nimport { slugifyNamespace, useSourceIdentity } from \"@executor-js/react/plugins/source-identity\";\nimport { useCredentialTargetScope } from \"@executor-js/react/plugins/credential-target-scope\";\nimport { Button } from \"@executor-js/react/components/button\";\nimport { FilterTabs } from \"@executor-js/react/components/filter-tabs\";\nimport { SourceOAuthConnectionControl } from \"@executor-js/react/plugins/source-oauth-connection\";\nimport { Badge } from \"@executor-js/react/components/badge\";\nimport { ScopeId } from \"@executor-js/sdk/core\";\nimport { GraphqlSourceFields } from \"./GraphqlSourceFields\";\nimport {\n GRAPHQL_OAUTH_CONNECTION_SLOT,\n type GraphqlCredentialInput,\n GraphqlSourceBindingInput,\n type GraphqlSourceBindingRef,\n} from \"../sdk/types\";\nimport type { StoredGraphqlSource } from \"../sdk/store\";\n\ntype EditableSource = StoredGraphqlSource;\ntype AuthMode = \"none\" | \"oauth2\";\n\n// ---------------------------------------------------------------------------\n// Edit form\n// ---------------------------------------------------------------------------\n\nfunction EditForm(props: {\n sourceId: string;\n initial: EditableSource;\n bindings: readonly GraphqlSourceBindingRef[];\n onSave: () => void;\n}) {\n const displayScope = useScope();\n const scopeStack = useScopeStack();\n const sourceScope = ScopeId.make(props.initial.scope);\n const { credentialTargetScope, credentialScopeOptions } = useCredentialTargetScope({\n sourceScope,\n initialTargetScope: initialCredentialTargetScope(sourceScope, props.bindings),\n });\n const {\n credentialTargetScope: oauthCredentialTargetScope,\n setCredentialTargetScope: setOAuthCredentialTargetScope,\n } = useCredentialTargetScope({\n sourceScope,\n initialTargetScope: initialCredentialTargetScope(sourceScope, props.bindings),\n });\n const doUpdate = useAtomSet(updateGraphqlSource, { mode: \"promiseExit\" });\n const setBinding = useAtomSet(setGraphqlSourceBinding, { mode: \"promise\" });\n const secretList = useSecretPickerSecrets();\n const connectionsResult = useAtomValue(connectionsAtom(displayScope));\n\n const identity = useSourceIdentity({\n fallbackName: props.initial.name,\n fallbackNamespace: props.initial.namespace,\n });\n const [endpoint, setEndpoint] = useState(props.initial.endpoint);\n const [credentials, setCredentials] = useState<HttpCredentialsState>(() =>\n httpCredentialsFromConfiguredCredentialBindings({\n headers: props.initial.headers,\n queryParams: props.initial.queryParams,\n bindings: props.bindings,\n }),\n );\n const [authMode, setAuthMode] = useState<AuthMode>(props.initial.auth.kind);\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [credentialsDirty, setCredentialsDirty] = useState(false);\n const [authDirty, setAuthDirty] = useState(false);\n\n const identityDirty = identity.name.trim() !== props.initial.name.trim();\n const metadataDirty = identityDirty || endpoint.trim() !== props.initial.endpoint.trim();\n const dirty = metadataDirty || credentialsDirty || authDirty;\n const oauth2 = props.initial.auth.kind === \"oauth2\" ? props.initial.auth : null;\n const connections = AsyncResult.isSuccess(connectionsResult) ? connectionsResult.value : [];\n const scopeRanks = new Map(scopeStack.map((scope, index) => [scope.id, index] as const));\n const connectionBinding = oauth2\n ? effectiveCredentialBindingForScope(\n props.bindings,\n oauth2.connectionSlot,\n oauthCredentialTargetScope,\n scopeRanks,\n )\n : null;\n const boundConnectionId =\n connectionBinding?.value.kind === \"connection\" ? connectionBinding.value.connectionId : null;\n const isConnected =\n boundConnectionId !== null &&\n connections.some((connection) => connection.id === boundConnectionId);\n const oauthRequestCredentials = serializeHttpCredentials(credentials);\n\n const handleCredentialsChange = (next: HttpCredentialsState) => {\n setCredentials(next);\n setCredentialsDirty(true);\n };\n\n const handleSave = async () => {\n setSaving(true);\n setError(null);\n const { headers, queryParams } = serializeScopedHttpCredentials(\n credentials,\n credentialTargetScope,\n );\n const payload: {\n sourceScope: ScopeId;\n name?: string;\n endpoint?: string;\n headers?: Record<string, GraphqlCredentialInput>;\n queryParams?: Record<string, GraphqlCredentialInput>;\n credentialTargetScope?: ScopeId;\n auth?: { kind: \"none\" } | { kind: \"oauth2\"; connectionSlot: string };\n } = {\n sourceScope,\n name: metadataDirty ? identity.name.trim() || undefined : undefined,\n endpoint: metadataDirty ? endpoint.trim() || undefined : undefined,\n };\n if (credentialsDirty) {\n payload.headers = headers;\n payload.queryParams = queryParams as Record<string, GraphqlCredentialInput>;\n payload.credentialTargetScope = credentialTargetScope;\n }\n if (authDirty) {\n payload.auth =\n authMode === \"oauth2\"\n ? {\n kind: \"oauth2\",\n connectionSlot:\n props.initial.auth.kind === \"oauth2\"\n ? props.initial.auth.connectionSlot\n : GRAPHQL_OAUTH_CONNECTION_SLOT,\n }\n : { kind: \"none\" };\n payload.credentialTargetScope = credentialTargetScope;\n }\n const exit = await doUpdate({\n params: { scopeId: displayScope, namespace: props.sourceId },\n payload,\n reactivityKeys: sourceWriteKeys,\n });\n\n if (Exit.isFailure(exit)) {\n setError(\"Failed to update source\");\n setSaving(false);\n return;\n }\n\n setCredentialsDirty(false);\n setAuthDirty(false);\n props.onSave();\n setSaving(false);\n };\n\n return (\n <div className=\"space-y-6\">\n <div>\n <h1 className=\"text-xl font-semibold text-foreground\">Edit GraphQL Source</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n Update the endpoint and authentication headers for this source.\n </p>\n </div>\n\n <div className=\"flex items-center gap-3 rounded-lg border border-border bg-card px-4 py-3\">\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-semibold text-card-foreground\">{props.sourceId}</p>\n </div>\n <Badge variant=\"secondary\" className=\"text-xs\">\n GraphQL\n </Badge>\n </div>\n\n <GraphqlSourceFields\n endpoint={endpoint}\n onEndpointChange={setEndpoint}\n identity={identity}\n namespaceReadOnly\n />\n\n <HttpCredentialsEditor\n credentials={credentials}\n onChange={handleCredentialsChange}\n existingSecrets={secretList}\n sourceName={identity.name}\n targetScope={credentialTargetScope}\n credentialScopeOptions={credentialScopeOptions}\n bindingScopeOptions={credentialScopeOptions}\n />\n\n {/* Temporarily hidden while we revisit GraphQL OAuth discovery and UX. */}\n <section className=\"hidden space-y-2.5\">\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"text-sm font-medium text-foreground\">Authentication</span>\n <FilterTabs<AuthMode>\n tabs={[\n { value: \"none\", label: \"None\" },\n { value: \"oauth2\", label: \"OAuth\" },\n ]}\n value={authMode}\n onChange={(value) => {\n setAuthMode(value);\n setAuthDirty(true);\n }}\n />\n </div>\n {authMode === \"oauth2\" && (\n <p className=\"text-xs text-muted-foreground\">\n OAuth sign-in is available from the source header after saving.\n </p>\n )}\n </section>\n\n {oauth2 && (\n <SourceOAuthConnectionControl\n popupName=\"graphql-oauth\"\n pluginId=\"graphql\"\n namespace={slugifyNamespace(props.initial.namespace) || \"graphql\"}\n fallbackNamespace=\"graphql\"\n endpoint={endpoint.trim()}\n tokenScope={oauthCredentialTargetScope}\n onTokenScopeChange={setOAuthCredentialTargetScope}\n credentialScopeOptions={credentialScopeOptions}\n connectionId={boundConnectionId}\n sourceLabel={`${identity.name.trim() || props.initial.namespace || \"GraphQL\"} OAuth`}\n headers={oauthRequestCredentials.headers}\n queryParams={oauthRequestCredentials.queryParams}\n isConnected={isConnected}\n onConnected={async (connectionId) => {\n await setBinding({\n params: { scopeId: oauthCredentialTargetScope },\n payload: new GraphqlSourceBindingInput({\n sourceId: props.sourceId,\n sourceScope,\n scope: oauthCredentialTargetScope,\n slot: oauth2.connectionSlot,\n value: { kind: \"connection\", connectionId },\n }),\n reactivityKeys: [...sourceWriteKeys, ...connectionWriteKeys],\n });\n }}\n />\n )}\n\n {error && (\n <div className=\"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2\">\n <p className=\"text-sm text-destructive\">{error}</p>\n </div>\n )}\n\n <div className=\"flex items-center justify-between border-t border-border pt-4\">\n <Button variant=\"ghost\" onClick={props.onSave}>\n Cancel\n </Button>\n <Button onClick={handleSave} disabled={!dirty || saving}>\n {saving ? \"Saving…\" : \"Save changes\"}\n </Button>\n </div>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Main component\n// ---------------------------------------------------------------------------\n\nexport default function EditGraphqlSource(props: { sourceId: string; onSave: () => void }) {\n const scopeId = useScope();\n const sourceResult = useAtomValue(graphqlSourceAtom(scopeId, props.sourceId));\n const source =\n AsyncResult.isSuccess(sourceResult) && sourceResult.value ? sourceResult.value : null;\n const sourceScope = source ? ScopeId.make(source.scope) : scopeId;\n const bindingsResult = useAtomValue(\n graphqlSourceBindingsAtom(scopeId, props.sourceId, sourceScope),\n );\n\n if (!AsyncResult.isSuccess(sourceResult) || !source || !AsyncResult.isSuccess(bindingsResult)) {\n return (\n <div className=\"space-y-6\">\n <div>\n <h1 className=\"text-xl font-semibold text-foreground\">Edit GraphQL Source</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">Loading configuration…</p>\n </div>\n </div>\n );\n }\n\n return (\n <EditForm\n sourceId={props.sourceId}\n initial={source as EditableSource}\n bindings={bindingsResult.value}\n onSave={props.onSave}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,S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ource.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { useAtomValue, useAtomSet } from \"@effect/atom-react\";\nimport * as Exit from \"effect/Exit\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport {\n graphqlSourceAtom,\n graphqlSourceBindingsAtom,\n setGraphqlSourceBinding,\n updateGraphqlSource,\n} from \"./atoms\";\nimport { connectionsAtom } from \"@executor-js/react/api/atoms\";\nimport { useScope, useScopeStack } from \"@executor-js/react/api/scope-context\";\nimport { connectionWriteKeys, sourceWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport { useSecretPickerSecrets } from \"@executor-js/react/plugins/use-secret-picker-secrets\";\nimport {\n HttpCredentialsEditor,\n serializeHttpCredentials,\n serializeScopedHttpCredentials,\n type HttpCredentialsState,\n} from \"@executor-js/react/plugins/http-credentials\";\nimport {\n effectiveCredentialBindingForScope,\n httpCredentialsFromConfiguredCredentialBindings,\n initialCredentialTargetScope,\n} from \"@executor-js/react/plugins/credential-bindings\";\nimport { slugifyNamespace, useSourceIdentity } from \"@executor-js/react/plugins/source-identity\";\nimport { useCredentialTargetScope } from \"@executor-js/react/plugins/credential-target-scope\";\nimport { Button } from \"@executor-js/react/components/button\";\nimport { FilterTabs } from \"@executor-js/react/components/filter-tabs\";\nimport { SourceOAuthConnectionControl } from \"@executor-js/react/plugins/source-oauth-connection\";\nimport { Badge } from \"@executor-js/react/components/badge\";\nimport { ScopeId } from \"@executor-js/sdk/core\";\nimport { GraphqlSourceFields } from \"./GraphqlSourceFields\";\nimport {\n GRAPHQL_OAUTH_CONNECTION_SLOT,\n type GraphqlCredentialInput,\n GraphqlSourceBindingInput,\n type GraphqlSourceBindingRef,\n} from \"../sdk/types\";\nimport type { StoredGraphqlSource } from \"../sdk/store\";\n\ntype EditableSource = StoredGraphqlSource;\ntype AuthMode = \"none\" | \"oauth2\";\n\n// ---------------------------------------------------------------------------\n// Edit form\n// ---------------------------------------------------------------------------\n\nfunction EditForm(props: {\n sourceId: string;\n initial: EditableSource;\n bindings: readonly GraphqlSourceBindingRef[];\n onSave: () => void;\n}) {\n const displayScope = useScope();\n const scopeStack = useScopeStack();\n const sourceScope = ScopeId.make(props.initial.scope);\n const { credentialTargetScope, credentialScopeOptions } = useCredentialTargetScope({\n sourceScope,\n initialTargetScope: initialCredentialTargetScope(sourceScope, props.bindings),\n });\n const {\n credentialTargetScope: oauthCredentialTargetScope,\n setCredentialTargetScope: setOAuthCredentialTargetScope,\n } = useCredentialTargetScope({\n sourceScope,\n initialTargetScope: initialCredentialTargetScope(sourceScope, props.bindings),\n });\n const doUpdate = useAtomSet(updateGraphqlSource, { mode: \"promiseExit\" });\n const setBinding = useAtomSet(setGraphqlSourceBinding, { mode: \"promise\" });\n const secretList = useSecretPickerSecrets();\n const connectionsResult = useAtomValue(connectionsAtom(displayScope));\n\n const identity = useSourceIdentity({\n fallbackName: props.initial.name,\n fallbackNamespace: props.initial.namespace,\n });\n const [endpoint, setEndpoint] = useState(props.initial.endpoint);\n const [credentials, setCredentials] = useState<HttpCredentialsState>(() =>\n httpCredentialsFromConfiguredCredentialBindings({\n headers: props.initial.headers,\n queryParams: props.initial.queryParams,\n bindings: props.bindings,\n }),\n );\n const [authMode, setAuthMode] = useState<AuthMode>(props.initial.auth.kind);\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [credentialsDirty, setCredentialsDirty] = useState(false);\n const [authDirty, setAuthDirty] = useState(false);\n\n const identityDirty = identity.name.trim() !== props.initial.name.trim();\n const metadataDirty = identityDirty || endpoint.trim() !== props.initial.endpoint.trim();\n const dirty = metadataDirty || credentialsDirty || authDirty;\n const oauth2 = props.initial.auth.kind === \"oauth2\" ? props.initial.auth : null;\n const connections = AsyncResult.isSuccess(connectionsResult) ? connectionsResult.value : [];\n const scopeRanks = new Map(scopeStack.map((scope, index) => [scope.id, index] as const));\n const connectionBinding = oauth2\n ? effectiveCredentialBindingForScope(\n props.bindings,\n oauth2.connectionSlot,\n oauthCredentialTargetScope,\n scopeRanks,\n )\n : null;\n const boundConnectionId =\n connectionBinding?.value.kind === \"connection\" ? connectionBinding.value.connectionId : null;\n const isConnected =\n boundConnectionId !== null &&\n connections.some((connection) => connection.id === boundConnectionId);\n const oauthRequestCredentials = serializeHttpCredentials(credentials);\n\n const handleCredentialsChange = (next: HttpCredentialsState) => {\n setCredentials(next);\n setCredentialsDirty(true);\n };\n\n const handleSave = async () => {\n setSaving(true);\n setError(null);\n const { headers, queryParams } = serializeScopedHttpCredentials(\n credentials,\n credentialTargetScope,\n );\n const payload: {\n sourceScope: ScopeId;\n name?: string;\n endpoint?: string;\n headers?: Record<string, GraphqlCredentialInput>;\n queryParams?: Record<string, GraphqlCredentialInput>;\n credentialTargetScope?: ScopeId;\n auth?: { kind: \"none\" } | { kind: \"oauth2\"; connectionSlot: string };\n } = {\n sourceScope,\n name: metadataDirty ? identity.name.trim() || undefined : undefined,\n endpoint: metadataDirty ? endpoint.trim() || undefined : undefined,\n };\n if (credentialsDirty) {\n payload.headers = headers;\n payload.queryParams = queryParams as Record<string, GraphqlCredentialInput>;\n payload.credentialTargetScope = credentialTargetScope;\n }\n if (authDirty) {\n payload.auth =\n authMode === \"oauth2\"\n ? {\n kind: \"oauth2\",\n connectionSlot:\n props.initial.auth.kind === \"oauth2\"\n ? props.initial.auth.connectionSlot\n : GRAPHQL_OAUTH_CONNECTION_SLOT,\n }\n : { kind: \"none\" };\n payload.credentialTargetScope = credentialTargetScope;\n }\n const exit = await doUpdate({\n params: { scopeId: displayScope, namespace: props.sourceId },\n payload,\n reactivityKeys: sourceWriteKeys,\n });\n\n if (Exit.isFailure(exit)) {\n setError(\"Failed to update source\");\n setSaving(false);\n return;\n }\n\n setCredentialsDirty(false);\n setAuthDirty(false);\n props.onSave();\n setSaving(false);\n };\n\n return (\n <div className=\"space-y-6\">\n <div>\n <h1 className=\"text-xl font-semibold text-foreground\">Edit GraphQL Source</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n Update the endpoint and authentication headers for this source.\n </p>\n </div>\n\n <div className=\"flex items-center gap-3 rounded-lg border border-border bg-card px-4 py-3\">\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-semibold text-card-foreground\">{props.sourceId}</p>\n </div>\n <Badge variant=\"secondary\" className=\"text-xs\">\n GraphQL\n </Badge>\n </div>\n\n <GraphqlSourceFields\n endpoint={endpoint}\n onEndpointChange={setEndpoint}\n identity={identity}\n namespaceReadOnly\n />\n\n <HttpCredentialsEditor\n credentials={credentials}\n onChange={handleCredentialsChange}\n existingSecrets={secretList}\n sourceName={identity.name}\n targetScope={credentialTargetScope}\n credentialScopeOptions={credentialScopeOptions}\n bindingScopeOptions={credentialScopeOptions}\n />\n\n {/* Temporarily hidden while we revisit GraphQL OAuth discovery and UX. */}\n <section className=\"hidden space-y-2.5\">\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"text-sm font-medium text-foreground\">Authentication</span>\n <FilterTabs<AuthMode>\n tabs={[\n { value: \"none\", label: \"None\" },\n { value: \"oauth2\", label: \"OAuth\" },\n ]}\n value={authMode}\n onChange={(value) => {\n setAuthMode(value);\n setAuthDirty(true);\n }}\n />\n </div>\n {authMode === \"oauth2\" && (\n <p className=\"text-xs text-muted-foreground\">\n OAuth sign-in is available from the source header after saving.\n </p>\n )}\n </section>\n\n {oauth2 && (\n <SourceOAuthConnectionControl\n popupName=\"graphql-oauth\"\n pluginId=\"graphql\"\n namespace={slugifyNamespace(props.initial.namespace) || \"graphql\"}\n fallbackNamespace=\"graphql\"\n endpoint={endpoint.trim()}\n tokenScope={oauthCredentialTargetScope}\n onTokenScopeChange={setOAuthCredentialTargetScope}\n credentialScopeOptions={credentialScopeOptions}\n connectionId={boundConnectionId}\n sourceLabel={`${identity.name.trim() || props.initial.namespace || \"GraphQL\"} OAuth`}\n headers={oauthRequestCredentials.headers}\n queryParams={oauthRequestCredentials.queryParams}\n isConnected={isConnected}\n onConnected={async (connectionId) => {\n await setBinding({\n params: { scopeId: oauthCredentialTargetScope },\n payload: GraphqlSourceBindingInput.make({\n sourceId: props.sourceId,\n sourceScope,\n scope: oauthCredentialTargetScope,\n slot: oauth2.connectionSlot,\n value: { kind: \"connection\", connectionId },\n }),\n reactivityKeys: [...sourceWriteKeys, ...connectionWriteKeys],\n });\n }}\n />\n )}\n\n {error && (\n <div className=\"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2\">\n <p className=\"text-sm text-destructive\">{error}</p>\n </div>\n )}\n\n <div className=\"flex items-center justify-between border-t border-border pt-4\">\n <Button variant=\"ghost\" onClick={props.onSave}>\n Cancel\n </Button>\n <Button onClick={handleSave} disabled={!dirty || saving}>\n {saving ? \"Saving…\" : \"Save changes\"}\n </Button>\n </div>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Main component\n// ---------------------------------------------------------------------------\n\nexport default function EditGraphqlSource(props: { sourceId: string; onSave: () => void }) {\n const scopeId = useScope();\n const sourceResult = useAtomValue(graphqlSourceAtom(scopeId, props.sourceId));\n const source =\n AsyncResult.isSuccess(sourceResult) && sourceResult.value ? sourceResult.value : null;\n const sourceScope = source ? ScopeId.make(source.scope) : scopeId;\n const bindingsResult = useAtomValue(\n graphqlSourceBindingsAtom(scopeId, props.sourceId, sourceScope),\n );\n\n if (!AsyncResult.isSuccess(sourceResult) || !source || !AsyncResult.isSuccess(bindingsResult)) {\n return (\n <div className=\"space-y-6\">\n <div>\n <h1 className=\"text-xl font-semibold text-foreground\">Edit GraphQL Source</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">Loading configuration…</p>\n </div>\n </div>\n );\n }\n\n return (\n <EditForm\n sourceId={props.sourceId}\n initial={source as EditableSource}\n bindings={bindingsResult.value}\n onSave={props.onSave}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,cAAc,kBAAkB;AACzC,YAAY,UAAU;AACtB,YAAY,iBAAiB;AAO7B,SAAS,uBAAuB;AAChC,SAAS,UAAU,qBA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k-EW4Y3KEX.js";
|
|
5
|
+
import "./chunk-445ZPXHU.js";
|
|
6
6
|
|
|
7
7
|
// src/react/GraphqlSourceSummary.tsx
|
|
8
8
|
import { useAtomValue } from "@effect/atom-react";
|
|
@@ -67,4 +67,4 @@ function GraphqlSourceSummary(props) {
|
|
|
67
67
|
export {
|
|
68
68
|
GraphqlSourceSummary as default
|
|
69
69
|
};
|
|
70
|
-
//# sourceMappingURL=GraphqlSourceSummary-
|
|
70
|
+
//# sourceMappingURL=GraphqlSourceSummary-6EYBXVD2.js.map
|
package/dist/api/group.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
import { InternalError } from "@executor-js/sdk/core";
|
|
4
4
|
import { GraphqlIntrospectionError, GraphqlExtractionError } from "../sdk/errors";
|
|
5
|
-
import { GraphqlSourceBindingRef } from "../sdk/types";
|
|
6
5
|
export declare const StoredSourceSchema: Schema.Struct<{
|
|
7
6
|
readonly namespace: Schema.String;
|
|
8
7
|
readonly scope: Schema.brand<Schema.String, "ScopeId">;
|
|
@@ -205,7 +204,25 @@ export declare const GraphqlGroup: HttpApiGroup.HttpApiGroup<"graphql", HttpApiE
|
|
|
205
204
|
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
206
205
|
namespace: Schema.String;
|
|
207
206
|
sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
208
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.$Array<
|
|
207
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.$Array<Schema.Struct<{
|
|
208
|
+
readonly sourceId: Schema.String;
|
|
209
|
+
readonly sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
210
|
+
readonly scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
211
|
+
readonly slot: Schema.String;
|
|
212
|
+
readonly value: Schema.Union<readonly [Schema.Struct<{
|
|
213
|
+
readonly kind: Schema.Literal<"text">;
|
|
214
|
+
readonly text: Schema.String;
|
|
215
|
+
}>, Schema.Struct<{
|
|
216
|
+
readonly kind: Schema.Literal<"secret">;
|
|
217
|
+
readonly secretId: Schema.brand<Schema.String, "SecretId">;
|
|
218
|
+
readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
219
|
+
}>, Schema.Struct<{
|
|
220
|
+
readonly kind: Schema.Literal<"connection">;
|
|
221
|
+
readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
|
|
222
|
+
}>]>;
|
|
223
|
+
readonly createdAt: Schema.Date;
|
|
224
|
+
readonly updatedAt: Schema.Date;
|
|
225
|
+
}>>>, HttpApiEndpoint.Json<typeof InternalError | Schema.decodeTo<Schema.declareConstructor<GraphqlIntrospectionError, {
|
|
209
226
|
readonly message: string;
|
|
210
227
|
readonly _tag: "GraphqlIntrospectionError";
|
|
211
228
|
}, readonly [Schema.TaggedStruct<"GraphqlIntrospectionError", {
|
|
@@ -243,7 +260,25 @@ export declare const GraphqlGroup: HttpApiGroup.HttpApiGroup<"graphql", HttpApiE
|
|
|
243
260
|
readonly kind: Schema.Literal<"connection">;
|
|
244
261
|
readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
|
|
245
262
|
}>]>;
|
|
246
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<
|
|
263
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
264
|
+
readonly sourceId: Schema.String;
|
|
265
|
+
readonly sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
266
|
+
readonly scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
267
|
+
readonly slot: Schema.String;
|
|
268
|
+
readonly value: Schema.Union<readonly [Schema.Struct<{
|
|
269
|
+
readonly kind: Schema.Literal<"text">;
|
|
270
|
+
readonly text: Schema.String;
|
|
271
|
+
}>, Schema.Struct<{
|
|
272
|
+
readonly kind: Schema.Literal<"secret">;
|
|
273
|
+
readonly secretId: Schema.brand<Schema.String, "SecretId">;
|
|
274
|
+
readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
275
|
+
}>, Schema.Struct<{
|
|
276
|
+
readonly kind: Schema.Literal<"connection">;
|
|
277
|
+
readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
|
|
278
|
+
}>]>;
|
|
279
|
+
readonly createdAt: Schema.Date;
|
|
280
|
+
readonly updatedAt: Schema.Date;
|
|
281
|
+
}>>, HttpApiEndpoint.Json<typeof InternalError | Schema.decodeTo<Schema.declareConstructor<GraphqlIntrospectionError, {
|
|
247
282
|
readonly message: string;
|
|
248
283
|
readonly _tag: "GraphqlIntrospectionError";
|
|
249
284
|
}, readonly [Schema.TaggedStruct<"GraphqlIntrospectionError", {
|
package/dist/api/handlers.d.ts
CHANGED
|
@@ -9,8 +9,44 @@ declare const GraphqlExtensionService_base: Context.ServiceClass<GraphqlExtensio
|
|
|
9
9
|
removeSource: (namespace: string, scope: string) => Effect.Effect<void, import("@executor-js/storage-core").StorageFailure, never>;
|
|
10
10
|
getSource: (namespace: string, scope: string) => Effect.Effect<import("../sdk").StoredGraphqlSource | null, import("@executor-js/storage-core").StorageFailure, never>;
|
|
11
11
|
updateSource: (namespace: string, scope: string, input: GraphqlUpdateSourceInput) => Effect.Effect<void, import("@executor-js/storage-core").StorageFailure | import("../sdk").GraphqlIntrospectionError, never>;
|
|
12
|
-
listSourceBindings: (sourceId: string, sourceScope: string) => Effect.Effect<readonly
|
|
13
|
-
|
|
12
|
+
listSourceBindings: (sourceId: string, sourceScope: string) => Effect.Effect<readonly {
|
|
13
|
+
readonly value: {
|
|
14
|
+
readonly text: string;
|
|
15
|
+
readonly kind: "text";
|
|
16
|
+
} | {
|
|
17
|
+
readonly secretId: string & import("effect/Brand").Brand<"SecretId">;
|
|
18
|
+
readonly kind: "secret";
|
|
19
|
+
readonly secretScopeId?: (string & import("effect/Brand").Brand<"ScopeId">) | undefined;
|
|
20
|
+
} | {
|
|
21
|
+
readonly connectionId: string & import("effect/Brand").Brand<"ConnectionId">;
|
|
22
|
+
readonly kind: "connection";
|
|
23
|
+
};
|
|
24
|
+
readonly createdAt: Date;
|
|
25
|
+
readonly sourceId: string;
|
|
26
|
+
readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
27
|
+
readonly updatedAt: Date;
|
|
28
|
+
readonly slot: string;
|
|
29
|
+
readonly sourceScopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
30
|
+
}[], import("@executor-js/storage-core").StorageFailure, never>;
|
|
31
|
+
setSourceBinding: (input: GraphqlSourceBindingInput) => Effect.Effect<{
|
|
32
|
+
readonly value: {
|
|
33
|
+
readonly text: string;
|
|
34
|
+
readonly kind: "text";
|
|
35
|
+
} | {
|
|
36
|
+
readonly secretId: string & import("effect/Brand").Brand<"SecretId">;
|
|
37
|
+
readonly kind: "secret";
|
|
38
|
+
readonly secretScopeId?: (string & import("effect/Brand").Brand<"ScopeId">) | undefined;
|
|
39
|
+
} | {
|
|
40
|
+
readonly connectionId: string & import("effect/Brand").Brand<"ConnectionId">;
|
|
41
|
+
readonly kind: "connection";
|
|
42
|
+
};
|
|
43
|
+
readonly createdAt: Date;
|
|
44
|
+
readonly sourceId: string;
|
|
45
|
+
readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
46
|
+
readonly updatedAt: Date;
|
|
47
|
+
readonly slot: string;
|
|
48
|
+
readonly sourceScopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
49
|
+
}, import("@executor-js/storage-core").StorageFailure, never>;
|
|
14
50
|
removeSourceBinding: (sourceId: string, sourceScope: string, slot: string, scope: string) => Effect.Effect<void, import("@executor-js/storage-core").StorageFailure, never>;
|
|
15
51
|
}>;
|
|
16
52
|
export declare class GraphqlExtensionService extends GraphqlExtensionService_base {
|
package/dist/api/index.d.ts
CHANGED
|
@@ -10,8 +10,44 @@ export declare const graphqlHttpPlugin: import("@executor-js/sdk/core").Configur
|
|
|
10
10
|
removeSource: (namespace: string, scope: string) => import("effect/Effect").Effect<void, import("@executor-js/storage-core").StorageFailure, never>;
|
|
11
11
|
getSource: (namespace: string, scope: string) => import("effect/Effect").Effect<import("../sdk").StoredGraphqlSource | null, import("@executor-js/storage-core").StorageFailure, never>;
|
|
12
12
|
updateSource: (namespace: string, scope: string, input: import("../sdk").GraphqlUpdateSourceInput) => import("effect/Effect").Effect<void, import("@executor-js/storage-core").StorageFailure | import("../sdk").GraphqlIntrospectionError, never>;
|
|
13
|
-
listSourceBindings: (sourceId: string, sourceScope: string) => import("effect/Effect").Effect<readonly
|
|
14
|
-
|
|
13
|
+
listSourceBindings: (sourceId: string, sourceScope: string) => import("effect/Effect").Effect<readonly {
|
|
14
|
+
readonly value: {
|
|
15
|
+
readonly text: string;
|
|
16
|
+
readonly kind: "text";
|
|
17
|
+
} | {
|
|
18
|
+
readonly secretId: string & import("effect/Brand").Brand<"SecretId">;
|
|
19
|
+
readonly kind: "secret";
|
|
20
|
+
readonly secretScopeId?: (string & import("effect/Brand").Brand<"ScopeId">) | undefined;
|
|
21
|
+
} | {
|
|
22
|
+
readonly connectionId: string & import("effect/Brand").Brand<"ConnectionId">;
|
|
23
|
+
readonly kind: "connection";
|
|
24
|
+
};
|
|
25
|
+
readonly createdAt: Date;
|
|
26
|
+
readonly sourceId: string;
|
|
27
|
+
readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
28
|
+
readonly updatedAt: Date;
|
|
29
|
+
readonly slot: string;
|
|
30
|
+
readonly sourceScopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
31
|
+
}[], import("@executor-js/storage-core").StorageFailure, never>;
|
|
32
|
+
setSourceBinding: (input: import("../sdk").GraphqlSourceBindingInput) => import("effect/Effect").Effect<{
|
|
33
|
+
readonly value: {
|
|
34
|
+
readonly text: string;
|
|
35
|
+
readonly kind: "text";
|
|
36
|
+
} | {
|
|
37
|
+
readonly secretId: string & import("effect/Brand").Brand<"SecretId">;
|
|
38
|
+
readonly kind: "secret";
|
|
39
|
+
readonly secretScopeId?: (string & import("effect/Brand").Brand<"ScopeId">) | undefined;
|
|
40
|
+
} | {
|
|
41
|
+
readonly connectionId: string & import("effect/Brand").Brand<"ConnectionId">;
|
|
42
|
+
readonly kind: "connection";
|
|
43
|
+
};
|
|
44
|
+
readonly createdAt: Date;
|
|
45
|
+
readonly sourceId: string;
|
|
46
|
+
readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
47
|
+
readonly updatedAt: Date;
|
|
48
|
+
readonly slot: string;
|
|
49
|
+
readonly sourceScopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
50
|
+
}, import("@executor-js/storage-core").StorageFailure, never>;
|
|
15
51
|
removeSourceBinding: (sourceId: string, sourceScope: string, slot: string, scope: string) => import("effect/Effect").Effect<void, import("@executor-js/storage-core").StorageFailure, never>;
|
|
16
52
|
}, import("../sdk").GraphqlStore, GraphqlPluginOptions, {
|
|
17
53
|
readonly graphql_source: {
|
|
@@ -322,7 +358,25 @@ export declare const graphqlHttpPlugin: import("@executor-js/sdk/core").Configur
|
|
|
322
358
|
scopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
323
359
|
namespace: import("effect/Schema").String;
|
|
324
360
|
sourceScopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
325
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").$Array<
|
|
361
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
362
|
+
readonly sourceId: import("effect/Schema").String;
|
|
363
|
+
readonly sourceScopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
364
|
+
readonly scopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
365
|
+
readonly slot: import("effect/Schema").String;
|
|
366
|
+
readonly value: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
367
|
+
readonly kind: import("effect/Schema").Literal<"text">;
|
|
368
|
+
readonly text: import("effect/Schema").String;
|
|
369
|
+
}>, import("effect/Schema").Struct<{
|
|
370
|
+
readonly kind: import("effect/Schema").Literal<"secret">;
|
|
371
|
+
readonly secretId: import("effect/Schema").brand<import("effect/Schema").String, "SecretId">;
|
|
372
|
+
readonly secretScopeId: import("effect/Schema").optional<import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">>;
|
|
373
|
+
}>, import("effect/Schema").Struct<{
|
|
374
|
+
readonly kind: import("effect/Schema").Literal<"connection">;
|
|
375
|
+
readonly connectionId: import("effect/Schema").brand<import("effect/Schema").String, "ConnectionId">;
|
|
376
|
+
}>]>;
|
|
377
|
+
readonly createdAt: import("effect/Schema").Date;
|
|
378
|
+
readonly updatedAt: import("effect/Schema").Date;
|
|
379
|
+
}>>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/api").InternalError | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<import("../sdk").GraphqlIntrospectionError, {
|
|
326
380
|
readonly message: string;
|
|
327
381
|
readonly _tag: "GraphqlIntrospectionError";
|
|
328
382
|
}, readonly [import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
|
|
@@ -360,7 +414,25 @@ export declare const graphqlHttpPlugin: import("@executor-js/sdk/core").Configur
|
|
|
360
414
|
readonly kind: import("effect/Schema").Literal<"connection">;
|
|
361
415
|
readonly connectionId: import("effect/Schema").brand<import("effect/Schema").String, "ConnectionId">;
|
|
362
416
|
}>]>;
|
|
363
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<
|
|
417
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
418
|
+
readonly sourceId: import("effect/Schema").String;
|
|
419
|
+
readonly sourceScopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
420
|
+
readonly scopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
421
|
+
readonly slot: import("effect/Schema").String;
|
|
422
|
+
readonly value: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
423
|
+
readonly kind: import("effect/Schema").Literal<"text">;
|
|
424
|
+
readonly text: import("effect/Schema").String;
|
|
425
|
+
}>, import("effect/Schema").Struct<{
|
|
426
|
+
readonly kind: import("effect/Schema").Literal<"secret">;
|
|
427
|
+
readonly secretId: import("effect/Schema").brand<import("effect/Schema").String, "SecretId">;
|
|
428
|
+
readonly secretScopeId: import("effect/Schema").optional<import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">>;
|
|
429
|
+
}>, import("effect/Schema").Struct<{
|
|
430
|
+
readonly kind: import("effect/Schema").Literal<"connection">;
|
|
431
|
+
readonly connectionId: import("effect/Schema").brand<import("effect/Schema").String, "ConnectionId">;
|
|
432
|
+
}>]>;
|
|
433
|
+
readonly createdAt: import("effect/Schema").Date;
|
|
434
|
+
readonly updatedAt: import("effect/Schema").Date;
|
|
435
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/api").InternalError | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<import("../sdk").GraphqlIntrospectionError, {
|
|
364
436
|
readonly message: string;
|
|
365
437
|
readonly _tag: "GraphqlIntrospectionError";
|
|
366
438
|
}, readonly [import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
|
|
@@ -20,7 +20,7 @@ var GraphqlInvocationError = class extends Data.TaggedError("GraphqlInvocationEr
|
|
|
20
20
|
// src/sdk/types.ts
|
|
21
21
|
import { Effect, Schema as Schema2 } from "effect";
|
|
22
22
|
import {
|
|
23
|
-
|
|
23
|
+
ConfiguredCredentialValue,
|
|
24
24
|
CredentialBindingValue,
|
|
25
25
|
credentialSlotKey,
|
|
26
26
|
ScopedSecretCredentialInput,
|
|
@@ -28,14 +28,13 @@ import {
|
|
|
28
28
|
ScopeId
|
|
29
29
|
} from "@executor-js/sdk/core";
|
|
30
30
|
var GraphqlOperationKind = Schema2.Literals(["query", "mutation"]);
|
|
31
|
-
var GraphqlArgument =
|
|
31
|
+
var GraphqlArgument = Schema2.Struct({
|
|
32
32
|
name: Schema2.String,
|
|
33
33
|
typeName: Schema2.String,
|
|
34
34
|
required: Schema2.Boolean,
|
|
35
35
|
description: Schema2.OptionFromOptional(Schema2.String)
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
var ExtractedField = class extends Schema2.Class("ExtractedField")({
|
|
36
|
+
});
|
|
37
|
+
var ExtractedField = Schema2.Struct({
|
|
39
38
|
/** e.g. "user", "createUser" */
|
|
40
39
|
fieldName: Schema2.String,
|
|
41
40
|
/** "query" or "mutation" */
|
|
@@ -46,26 +45,23 @@ var ExtractedField = class extends Schema2.Class("ExtractedField")({
|
|
|
46
45
|
inputSchema: Schema2.OptionFromOptional(Schema2.Unknown),
|
|
47
46
|
/** The return type name for documentation */
|
|
48
47
|
returnTypeName: Schema2.String
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
var ExtractionResult = class extends Schema2.Class("ExtractionResult")({
|
|
48
|
+
});
|
|
49
|
+
var ExtractionResult = Schema2.Struct({
|
|
52
50
|
/** Schema name from introspection */
|
|
53
51
|
schemaName: Schema2.OptionFromOptional(Schema2.String),
|
|
54
52
|
fields: Schema2.Array(ExtractedField)
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
var OperationBinding = class extends Schema2.Class("OperationBinding")({
|
|
53
|
+
});
|
|
54
|
+
var OperationBinding = Schema2.Struct({
|
|
58
55
|
kind: GraphqlOperationKind,
|
|
59
56
|
fieldName: Schema2.String,
|
|
60
57
|
/** The full GraphQL query/mutation string */
|
|
61
58
|
operationString: Schema2.String,
|
|
62
59
|
/** Ordered variable names for mapping */
|
|
63
60
|
variableNames: Schema2.Array(Schema2.String)
|
|
64
|
-
})
|
|
65
|
-
};
|
|
61
|
+
});
|
|
66
62
|
var HeaderValue = SecretBackedValue;
|
|
67
63
|
var QueryParamValue = HeaderValue;
|
|
68
|
-
var ConfiguredGraphqlCredentialValue =
|
|
64
|
+
var ConfiguredGraphqlCredentialValue = ConfiguredCredentialValue;
|
|
69
65
|
var GraphqlCredentialInput = Schema2.Union([
|
|
70
66
|
ScopedSecretCredentialInput,
|
|
71
67
|
HeaderValue,
|
|
@@ -89,20 +85,14 @@ var GraphqlSourceAuthInput = Schema2.Union([
|
|
|
89
85
|
})
|
|
90
86
|
]);
|
|
91
87
|
var GraphqlSourceBindingValue = CredentialBindingValue;
|
|
92
|
-
var
|
|
88
|
+
var GraphqlSourceBindingInput = Schema2.Struct({
|
|
93
89
|
sourceId: Schema2.String,
|
|
94
90
|
sourceScope: ScopeId,
|
|
95
91
|
scope: ScopeId,
|
|
96
92
|
slot: Schema2.String,
|
|
97
93
|
value: GraphqlSourceBindingValue
|
|
98
94
|
});
|
|
99
|
-
var
|
|
100
|
-
"GraphqlSourceBindingInput"
|
|
101
|
-
)(GraphqlSourceBindingInputSchema.fields) {
|
|
102
|
-
};
|
|
103
|
-
var GraphqlSourceBindingRef = class extends Schema2.Class(
|
|
104
|
-
"GraphqlSourceBindingRef"
|
|
105
|
-
)({
|
|
95
|
+
var GraphqlSourceBindingRef = Schema2.Struct({
|
|
106
96
|
sourceId: Schema2.String,
|
|
107
97
|
sourceScopeId: ScopeId,
|
|
108
98
|
scopeId: ScopeId,
|
|
@@ -110,9 +100,8 @@ var GraphqlSourceBindingRef = class extends Schema2.Class(
|
|
|
110
100
|
value: GraphqlSourceBindingValue,
|
|
111
101
|
createdAt: Schema2.Date,
|
|
112
102
|
updatedAt: Schema2.Date
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
var InvocationConfig = class extends Schema2.Class("InvocationConfig")({
|
|
103
|
+
});
|
|
104
|
+
var InvocationConfig = Schema2.Struct({
|
|
116
105
|
/** The GraphQL endpoint URL */
|
|
117
106
|
endpoint: Schema2.String,
|
|
118
107
|
/** Headers applied to every request. Values can reference secrets. */
|
|
@@ -125,14 +114,12 @@ var InvocationConfig = class extends Schema2.Class("InvocationConfig")({
|
|
|
125
114
|
Schema2.withDecodingDefault(Effect.succeed({})),
|
|
126
115
|
Schema2.withConstructorDefault(Effect.succeed({}))
|
|
127
116
|
)
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
var InvocationResult = class extends Schema2.Class("InvocationResult")({
|
|
117
|
+
});
|
|
118
|
+
var InvocationResult = Schema2.Struct({
|
|
131
119
|
status: Schema2.Number,
|
|
132
120
|
data: Schema2.NullOr(Schema2.Unknown),
|
|
133
121
|
errors: Schema2.NullOr(Schema2.Unknown)
|
|
134
|
-
})
|
|
135
|
-
};
|
|
122
|
+
});
|
|
136
123
|
|
|
137
124
|
export {
|
|
138
125
|
GraphqlIntrospectionError,
|
|
@@ -153,10 +140,9 @@ export {
|
|
|
153
140
|
GraphqlSourceAuth,
|
|
154
141
|
GraphqlSourceAuthInput,
|
|
155
142
|
GraphqlSourceBindingValue,
|
|
156
|
-
GraphqlSourceBindingInputSchema,
|
|
157
143
|
GraphqlSourceBindingInput,
|
|
158
144
|
GraphqlSourceBindingRef,
|
|
159
145
|
InvocationConfig,
|
|
160
146
|
InvocationResult
|
|
161
147
|
};
|
|
162
|
-
//# sourceMappingURL=chunk-
|
|
148
|
+
//# sourceMappingURL=chunk-445ZPXHU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sdk/errors.ts","../src/sdk/types.ts"],"sourcesContent":["import { Data, Schema } from \"effect\";\nimport type { Option } from \"effect\";\n\nexport class GraphqlIntrospectionError extends Schema.TaggedErrorClass<GraphqlIntrospectionError>()(\n \"GraphqlIntrospectionError\",\n {\n message: Schema.String,\n },\n) {}\n\nexport class GraphqlExtractionError extends Schema.TaggedErrorClass<GraphqlExtractionError>()(\n \"GraphqlExtractionError\",\n {\n message: Schema.String,\n },\n) {}\n\nexport class GraphqlInvocationError extends Data.TaggedError(\"GraphqlInvocationError\")<{\n readonly message: string;\n readonly statusCode: Option.Option<number>;\n readonly cause?: unknown;\n}> {}\n","import { Effect, Schema } from \"effect\";\nimport {\n ConfiguredCredentialValue,\n CredentialBindingValue,\n credentialSlotKey,\n ScopedSecretCredentialInput,\n SecretBackedValue,\n ScopeId,\n} from \"@executor-js/sdk/core\";\n\n// ---------------------------------------------------------------------------\n// GraphQL operation kind\n// ---------------------------------------------------------------------------\n\nexport const GraphqlOperationKind = Schema.Literals([\"query\", \"mutation\"]);\nexport type GraphqlOperationKind = typeof GraphqlOperationKind.Type;\n\n// ---------------------------------------------------------------------------\n// Extracted field (becomes a tool)\n// ---------------------------------------------------------------------------\n\nexport 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 GraphqlCredentialInput = Schema.Union([\n ScopedSecretCredentialInput,\n HeaderValue,\n ConfiguredGraphqlCredentialValue,\n]);\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 GraphqlSourceAuth,\n Schema.Struct({\n kind: Schema.Literal(\"oauth2\"),\n connectionId: Schema.String,\n }),\n]);\nexport type GraphqlSourceAuthInput = typeof GraphqlSourceAuthInput.Type;\n\nexport const GraphqlSourceBindingValue = CredentialBindingValue;\nexport type GraphqlSourceBindingValue = typeof GraphqlSourceBindingValue.Type;\n\nexport const GraphqlSourceBindingInput = Schema.Struct({\n sourceId: Schema.String,\n sourceScope: ScopeId,\n scope: ScopeId,\n slot: Schema.String,\n value: GraphqlSourceBindingValue,\n});\nexport type GraphqlSourceBindingInput = typeof GraphqlSourceBindingInput.Type;\n\nexport const GraphqlSourceBindingRef = Schema.Struct({\n sourceId: Schema.String,\n sourceScopeId: ScopeId,\n scopeId: ScopeId,\n slot: Schema.String,\n value: GraphqlSourceBindingValue,\n createdAt: Schema.Date,\n updatedAt: Schema.Date,\n});\nexport type GraphqlSourceBindingRef = typeof GraphqlSourceBindingRef.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;AAGtB,IAAM,4BAAN,cAAwC,OAAO,iBAA4C;AAAA,EAChG;AAAA,EACA;AAAA,IACE,SAAS,OA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AAOA,QAAO,QAAQ,gCAAgC,EAAE;AAAA,IAC1EA,QAAO,oBAAoB,OAAO,QAAQ,CAAC,CAAC,CAAC;AAAA,IAC7CA,QAAO,uBAAuB,OAAO,QAAQ,CAAC,CAAC,CAAC;AAAA,EAClD;AACF,CAAC;AAGM,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"]}
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
GraphqlIntrospectionError,
|
|
6
6
|
GraphqlSourceAuth,
|
|
7
7
|
GraphqlSourceAuthInput,
|
|
8
|
-
|
|
8
|
+
GraphqlSourceBindingInput,
|
|
9
9
|
GraphqlSourceBindingRef
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-445ZPXHU.js";
|
|
11
11
|
|
|
12
12
|
// src/react/atoms.ts
|
|
13
13
|
import * as Atom from "effect/unstable/reactivity/Atom";
|
|
@@ -113,7 +113,7 @@ var GraphqlGroup = HttpApiGroup.make("graphql").add(
|
|
|
113
113
|
).add(
|
|
114
114
|
HttpApiEndpoint.post("setSourceBinding", "/scopes/:scopeId/graphql/source-bindings", {
|
|
115
115
|
params: ScopeParams,
|
|
116
|
-
payload:
|
|
116
|
+
payload: GraphqlSourceBindingInput,
|
|
117
117
|
success: GraphqlSourceBindingRef,
|
|
118
118
|
error: GraphqlErrors
|
|
119
119
|
})
|
|
@@ -179,4 +179,4 @@ export {
|
|
|
179
179
|
updateGraphqlSource,
|
|
180
180
|
setGraphqlSourceBinding
|
|
181
181
|
};
|
|
182
|
-
//# sourceMappingURL=chunk-
|
|
182
|
+
//# sourceMappingURL=chunk-EW4Y3KEX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react/atoms.ts","../src/react/client.ts","../src/api/group.ts"],"sourcesContent":["import type { ScopeId } from \"@executor-js/sdk/core\";\nimport * as Atom from \"effect/unstable/reactivity/Atom\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport { 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) =>\n GraphqlClient.query(\"graphql\", \"listSourceBindings\", {\n params: { scopeId, namespace, sourceScopeId },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.sources, ReactivityKey.secrets, ReactivityKey.connections],\n });\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: arg.payload.targetScope,\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\nexport const updateGraphqlSource = GraphqlClient.mutation(\"graphql\", \"updateSource\");\n\nexport const setGraphqlSourceBinding = GraphqlClient.mutation(\"graphql\", \"setSourceBinding\");\n\nexport const removeGraphqlSourceBinding = GraphqlClient.mutation(\"graphql\", \"removeSourceBinding\");\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/core\";\n\nimport { GraphqlIntrospectionError, GraphqlExtractionError } from \"../sdk/errors\";\nimport {\n ConfiguredGraphqlCredentialValue,\n GraphqlCredentialInput,\n GraphqlSourceAuth,\n GraphqlSourceAuthInput,\n GraphqlSourceBindingInput,\n GraphqlSourceBindingRef,\n} from \"../sdk/types\";\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\nconst SourceBindingParams = {\n scopeId: ScopeId,\n namespace: Schema.String,\n sourceScopeId: ScopeId,\n};\n\n// ---------------------------------------------------------------------------\n// Payloads\n// ---------------------------------------------------------------------------\n\nconst AddSourcePayload = Schema.Struct({\n targetScope: ScopeId,\n endpoint: Schema.String,\n name: Schema.optional(Schema.String),\n introspectionJson: Schema.optional(Schema.String),\n namespace: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n queryParams: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n credentialTargetScope: Schema.optional(ScopeId),\n auth: Schema.optional(GraphqlSourceAuthInput),\n});\n\nconst UpdateSourcePayload = Schema.Struct({\n sourceScope: ScopeId,\n name: Schema.optional(Schema.String),\n endpoint: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n queryParams: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n credentialTargetScope: Schema.optional(ScopeId),\n auth: Schema.optional(GraphqlSourceAuthInput),\n});\n\nconst UpdateSourceResponse = Schema.Struct({\n updated: Schema.Boolean,\n});\n\nconst RemoveBindingPayload = Schema.Struct({\n sourceId: Schema.String,\n sourceScope: ScopeId,\n slot: Schema.String,\n scope: ScopeId,\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 .add(\n HttpApiEndpoint.patch(\"updateSource\", \"/scopes/:scopeId/graphql/sources/:namespace\", {\n params: SourceParams,\n payload: UpdateSourcePayload,\n success: UpdateSourceResponse,\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\n \"listSourceBindings\",\n \"/scopes/:scopeId/graphql/sources/:namespace/base/:sourceScopeId/bindings\",\n {\n params: SourceBindingParams,\n success: Schema.Array(GraphqlSourceBindingRef),\n error: GraphqlErrors,\n },\n ),\n )\n .add(\n HttpApiEndpoint.post(\"setSourceBinding\", \"/scopes/:scopeId/graphql/source-bindings\", {\n params: ScopeParams,\n payload: GraphqlSourceBindingInput,\n success: GraphqlSourceBindingRef,\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.post(\"removeSourceBinding\", \"/scopes/:scopeId/graphql/source-bindings/remove\", {\n params: ScopeParams,\n payload: RemoveBindingPayload,\n success: Schema.Struct({ removed: Schema.Boolean }),\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,6BAA6B;AACtC,SAAS,qBAAqB;;;ACJ9B,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;;;ACD3B,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,cAAc;AACvB,SAAS,eAAe,eAAe;AAchC,IAAM,qBAAqB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