@executor-js/plugin-graphql 1.4.28 → 1.4.30

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.
Files changed (40) hide show
  1. package/dist/{AddGraphqlSource-3Z3DB4KQ.js → AddGraphqlSource-PBMKSY7Y.js} +29 -18
  2. package/dist/AddGraphqlSource-PBMKSY7Y.js.map +1 -0
  3. package/dist/{EditGraphqlSource-F37RPNKV.js → EditGraphqlSource-AFR4RQHY.js} +107 -91
  4. package/dist/EditGraphqlSource-AFR4RQHY.js.map +1 -0
  5. package/dist/{GraphqlSourceSummary-6EYBXVD2.js → GraphqlSourceSummary-MY4AW37M.js} +4 -4
  6. package/dist/GraphqlSourceSummary-MY4AW37M.js.map +1 -0
  7. package/dist/api/group.d.ts +71 -232
  8. package/dist/api/handlers.d.ts +5 -45
  9. package/dist/api/index.d.ts +76 -404
  10. package/dist/{chunk-PO2TPM5B.js → chunk-7S2FM3ZF.js} +578 -613
  11. package/dist/chunk-7S2FM3ZF.js.map +1 -0
  12. package/dist/chunk-D6E4WAYW.js +51 -0
  13. package/dist/chunk-D6E4WAYW.js.map +1 -0
  14. package/dist/{chunk-445ZPXHU.js → chunk-H422YIM4.js} +15 -34
  15. package/dist/chunk-H422YIM4.js.map +1 -0
  16. package/dist/{chunk-EW4Y3KEX.js → chunk-OYUIHBWZ.js} +23 -80
  17. package/dist/chunk-OYUIHBWZ.js.map +1 -0
  18. package/dist/client.js +7 -47
  19. package/dist/client.js.map +1 -1
  20. package/dist/core.js +3 -8
  21. package/dist/index.js +3 -2
  22. package/dist/react/atoms.d.ts +146 -186
  23. package/dist/react/client.d.ts +70 -231
  24. package/dist/sdk/index.d.ts +2 -2
  25. package/dist/sdk/introspect.d.ts +151 -151
  26. package/dist/sdk/invoke.d.ts +5 -5
  27. package/dist/sdk/plugin.d.ts +74 -228
  28. package/dist/sdk/presets.d.ts +1 -0
  29. package/dist/sdk/store.d.ts +3 -135
  30. package/dist/sdk/types.d.ts +31 -66
  31. package/dist/testing/index.d.ts +20 -2
  32. package/dist/testing.js +77 -29
  33. package/dist/testing.js.map +1 -1
  34. package/package.json +3 -3
  35. package/dist/AddGraphqlSource-3Z3DB4KQ.js.map +0 -1
  36. package/dist/EditGraphqlSource-F37RPNKV.js.map +0 -1
  37. package/dist/GraphqlSourceSummary-6EYBXVD2.js.map +0 -1
  38. package/dist/chunk-445ZPXHU.js.map +0 -1
  39. package/dist/chunk-EW4Y3KEX.js.map +0 -1
  40. package/dist/chunk-PO2TPM5B.js.map +0 -1
@@ -3,8 +3,8 @@ import {
3
3
  } from "./chunk-M4SJY6CB.js";
4
4
  import {
5
5
  addGraphqlSourceOptimistic
6
- } from "./chunk-EW4Y3KEX.js";
7
- import "./chunk-445ZPXHU.js";
6
+ } from "./chunk-OYUIHBWZ.js";
7
+ import "./chunk-H422YIM4.js";
8
8
 
9
9
  // src/react/AddGraphqlSource.tsx
10
10
  import { useCallback, useState } from "react";
@@ -17,8 +17,9 @@ import { sourceWriteKeys } from "@executor-js/react/api/reactivity-keys";
17
17
  import {
18
18
  HttpCredentialsEditor,
19
19
  httpCredentialsValid,
20
- serializeScopedHttpCredentials,
21
- serializeHttpCredentials
20
+ serializeConfigureHttpCredentials,
21
+ serializeHttpCredentials,
22
+ serializeTemplateHttpCredentials
22
23
  } from "@executor-js/react/plugins/http-credentials";
23
24
  import {
24
25
  sourceDisplayNameFromUrl,
@@ -117,27 +118,37 @@ function AddGraphqlSource(props) {
117
118
  const handleAdd = async () => {
118
119
  setAdding(true);
119
120
  setAddError(null);
120
- const { headers: headerMap, queryParams } = serializeScopedHttpCredentials(
121
- credentials,
122
- requestCredentialTargetScope
123
- );
121
+ const { headers: templateHeaders, queryParams: templateQueryParams } = serializeTemplateHttpCredentials(credentials);
122
+ const { headers: configureHeaders, queryParams: configureQueryParams } = serializeConfigureHttpCredentials(credentials, requestCredentialTargetScope);
123
+ const hasInitialCredentials = Object.keys(configureHeaders).length > 0 || Object.keys(configureQueryParams).length > 0 || authMode === "oauth2" && tokens;
124
124
  const { trimmedEndpoint, namespace, displayName } = sourceIdentity();
125
125
  const exit = await doAdd({
126
126
  params: { scopeId },
127
127
  payload: {
128
- targetScope: scopeId,
129
128
  endpoint: trimmedEndpoint,
130
129
  name: displayName,
131
130
  namespace,
132
- ...Object.keys(headerMap).length > 0 ? { headers: headerMap } : {},
133
- ...Object.keys(queryParams).length > 0 ? {
134
- queryParams
131
+ ...Object.keys(templateHeaders).length > 0 ? { headers: templateHeaders } : {},
132
+ ...Object.keys(templateQueryParams).length > 0 ? {
133
+ queryParams: templateQueryParams
135
134
  } : {},
136
- credentialTargetScope: authMode === "oauth2" && tokens ? oauthCredentialTargetScope : requestCredentialTargetScope,
137
- ...authMode === "oauth2" && tokens ? {
138
- auth: {
139
- kind: "oauth2",
140
- connectionId: tokens.connectionId
135
+ ...hasInitialCredentials ? {
136
+ credentials: {
137
+ scope: requestCredentialTargetScope,
138
+ ...Object.keys(configureHeaders).length > 0 ? { headers: configureHeaders } : {},
139
+ ...Object.keys(configureQueryParams).length > 0 ? {
140
+ queryParams: configureQueryParams
141
+ } : {},
142
+ ...authMode === "oauth2" && tokens ? {
143
+ auth: {
144
+ oauth2: {
145
+ connection: {
146
+ kind: "connection",
147
+ connectionId: tokens.connectionId
148
+ }
149
+ }
150
+ }
151
+ } : {}
141
152
  }
142
153
  } : {}
143
154
  },
@@ -236,4 +247,4 @@ function AddGraphqlSource(props) {
236
247
  export {
237
248
  AddGraphqlSource as default
238
249
  };
239
- //# sourceMappingURL=AddGraphqlSource-3Z3DB4KQ.js.map
250
+ //# sourceMappingURL=AddGraphqlSource-PBMKSY7Y.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/react/AddGraphqlSource.tsx","../src/react/defaults.ts"],"sourcesContent":["import { useCallback, useState } from \"react\";\nimport { useAtomSet } from \"@effect/atom-react\";\nimport * as Exit from \"effect/Exit\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\n\nimport { useScope } from \"@executor-js/react/api/scope-context\";\nimport { sourceWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport {\n HttpCredentialsEditor,\n httpCredentialsValid,\n serializeConfigureHttpCredentials,\n serializeHttpCredentials,\n serializeTemplateHttpCredentials,\n type HttpCredentialsState,\n} from \"@executor-js/react/plugins/http-credentials\";\nimport {\n sourceDisplayNameFromUrl,\n slugifyNamespace,\n useSourceIdentity,\n} from \"@executor-js/react/plugins/source-identity\";\nimport {\n oauthCallbackUrl,\n oauthConnectionId,\n useOAuthPopupFlow,\n type OAuthCompletionPayload,\n} from \"@executor-js/react/plugins/oauth-sign-in\";\nimport {\n CredentialControlField,\n CredentialUsageRow,\n useCredentialTargetScope,\n} from \"@executor-js/react/plugins/credential-target-scope\";\nimport { useSecretPickerSecrets } from \"@executor-js/react/plugins/use-secret-picker-secrets\";\nimport { Button } from \"@executor-js/react/components/button\";\nimport { FilterTabs } from \"@executor-js/react/components/filter-tabs\";\nimport { FloatActions } from \"@executor-js/react/components/float-actions\";\nimport { Spinner } from \"@executor-js/react/components/spinner\";\nimport { addGraphqlSourceOptimistic } from \"./atoms\";\nimport { initialGraphqlCredentials } from \"./defaults\";\nimport { GraphqlSourceFields } from \"./GraphqlSourceFields\";\nimport type { GraphqlConfiguredValueInput, GraphqlCredentialInput } from \"../sdk/types\";\n\nconst ErrorMessage = Schema.Struct({ message: Schema.String });\nconst decodeErrorMessage = Schema.decodeUnknownOption(ErrorMessage);\n\nconst errorMessageFromExit = (exit: Exit.Exit<unknown, unknown>, fallback: string): string =>\n Option.match(Option.flatMap(Exit.findErrorOption(exit), decodeErrorMessage), {\n onNone: () => fallback,\n onSome: ({ message }) => message,\n });\n\ntype AuthMode = \"none\" | \"oauth2\";\n\nexport default function AddGraphqlSource(props: {\n onComplete: () => void;\n onCancel: () => void;\n initialUrl?: string;\n}) {\n const [endpoint, setEndpoint] = useState(props.initialUrl ?? \"\");\n const identity = useSourceIdentity({\n fallbackName: sourceDisplayNameFromUrl(endpoint, \"GraphQL\") ?? \"\",\n });\n const [credentials, setCredentials] = useState<HttpCredentialsState>(initialGraphqlCredentials);\n const [adding, setAdding] = useState(false);\n const [addError, setAddError] = useState<string | null>(null);\n const [authMode, setAuthMode] = useState<AuthMode>(\"none\");\n const [tokens, setTokens] = useState<OAuthCompletionPayload | null>(null);\n\n const scopeId = useScope();\n const { credentialTargetScope: requestCredentialTargetScope } = useCredentialTargetScope();\n const {\n credentialTargetScope: oauthCredentialTargetScope,\n setCredentialTargetScope: setOAuthCredentialTargetScope,\n credentialScopeOptions,\n } = useCredentialTargetScope();\n const doAdd = useAtomSet(addGraphqlSourceOptimistic(scopeId), {\n mode: \"promiseExit\",\n });\n const secretList = useSecretPickerSecrets();\n const oauth = useOAuthPopupFlow({\n popupName: \"graphql-oauth\",\n startErrorMessage: \"Failed to start OAuth\",\n });\n\n const canAdd =\n endpoint.trim().length > 0 &&\n httpCredentialsValid(credentials) &&\n (authMode === \"none\" || tokens !== null) &&\n !oauth.busy;\n\n const sourceIdentity = useCallback(() => {\n const trimmedEndpoint = endpoint.trim();\n const namespace =\n slugifyNamespace(identity.namespace) ||\n slugifyNamespace(sourceDisplayNameFromUrl(trimmedEndpoint, \"GraphQL\") ?? \"\") ||\n \"graphql\";\n const displayName =\n identity.name.trim() || sourceDisplayNameFromUrl(trimmedEndpoint, \"GraphQL\") || namespace;\n return { trimmedEndpoint, namespace, displayName };\n }, [endpoint, identity.name, identity.namespace]);\n\n const handleOAuth = useCallback(async () => {\n if (!endpoint.trim() || !httpCredentialsValid(credentials)) return;\n setAddError(null);\n const { trimmedEndpoint, namespace, displayName } = sourceIdentity();\n const { headers, queryParams } = serializeHttpCredentials(credentials);\n await oauth.start({\n payload: {\n endpoint: trimmedEndpoint,\n ...(Object.keys(headers).length > 0 ? { headers } : {}),\n ...(Object.keys(queryParams).length > 0 ? { queryParams } : {}),\n redirectUrl: oauthCallbackUrl(),\n connectionId: oauthConnectionId({ pluginId: \"graphql\", namespace }),\n tokenScope: oauthCredentialTargetScope,\n strategy: { kind: \"dynamic-dcr\" },\n pluginId: \"graphql\",\n identityLabel: `${displayName} OAuth`,\n },\n onSuccess: (result) => {\n setTokens({\n connectionId: result.connectionId,\n expiresAt: result.expiresAt,\n scope: result.scope,\n });\n },\n onError: setAddError,\n });\n }, [endpoint, credentials, oauth, sourceIdentity, oauthCredentialTargetScope]);\n\n const handleAdd = async () => {\n setAdding(true);\n setAddError(null);\n const { headers: templateHeaders, queryParams: templateQueryParams } =\n serializeTemplateHttpCredentials(credentials);\n const { headers: configureHeaders, queryParams: configureQueryParams } =\n serializeConfigureHttpCredentials(credentials, requestCredentialTargetScope);\n const hasInitialCredentials =\n Object.keys(configureHeaders).length > 0 ||\n Object.keys(configureQueryParams).length > 0 ||\n (authMode === \"oauth2\" && tokens);\n\n const { trimmedEndpoint, namespace, displayName } = sourceIdentity();\n const exit = await doAdd({\n params: { scopeId },\n payload: {\n endpoint: trimmedEndpoint,\n name: displayName,\n namespace,\n ...(Object.keys(templateHeaders).length > 0\n ? { headers: templateHeaders as Record<string, GraphqlConfiguredValueInput> }\n : {}),\n ...(Object.keys(templateQueryParams).length > 0\n ? {\n queryParams: templateQueryParams as Record<string, GraphqlConfiguredValueInput>,\n }\n : {}),\n ...(hasInitialCredentials\n ? {\n credentials: {\n scope: requestCredentialTargetScope,\n ...(Object.keys(configureHeaders).length > 0\n ? { headers: configureHeaders as Record<string, GraphqlCredentialInput> }\n : {}),\n ...(Object.keys(configureQueryParams).length > 0\n ? {\n queryParams: configureQueryParams as Record<string, GraphqlCredentialInput>,\n }\n : {}),\n ...(authMode === \"oauth2\" && tokens\n ? {\n auth: {\n oauth2: {\n connection: {\n kind: \"connection\" as const,\n connectionId: tokens.connectionId,\n },\n },\n },\n }\n : {}),\n },\n }\n : {}),\n },\n reactivityKeys: sourceWriteKeys,\n });\n if (Exit.isFailure(exit)) {\n setAddError(errorMessageFromExit(exit, \"Failed to add source\"));\n setAdding(false);\n return;\n }\n props.onComplete();\n };\n\n return (\n <div className=\"flex flex-1 flex-col gap-6\">\n <h1 className=\"text-xl font-semibold text-foreground\">Add GraphQL Source</h1>\n\n <GraphqlSourceFields endpoint={endpoint} onEndpointChange={setEndpoint} identity={identity} />\n\n <HttpCredentialsEditor\n credentials={credentials}\n onChange={setCredentials}\n existingSecrets={secretList}\n sourceName={identity.name}\n targetScope={requestCredentialTargetScope}\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 setTokens(null);\n }}\n />\n </div>\n\n {authMode === \"oauth2\" && (\n <CredentialUsageRow\n value={oauthCredentialTargetScope}\n options={credentialScopeOptions}\n onChange={(targetScope) => {\n setOAuthCredentialTargetScope(targetScope);\n setTokens(null);\n }}\n label=\"Connection saved to\"\n help=\"Choose who can use the OAuth connection.\"\n >\n <CredentialControlField label=\"Connect via OAuth\" help=\"Start the provider OAuth flow.\">\n <div className=\"flex min-h-9 items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-2\">\n {tokens ? (\n <span className=\"text-xs font-medium text-emerald-600 dark:text-emerald-400\">\n Authenticated\n </span>\n ) : (\n <span className=\"text-xs text-muted-foreground\">Not connected</span>\n )}\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className=\"ml-auto h-7 px-2 text-xs\"\n onClick={() => void handleOAuth()}\n disabled={!endpoint.trim() || !httpCredentialsValid(credentials) || oauth.busy}\n >\n {oauth.busy ? \"Signing in...\" : tokens ? \"Reconnect\" : \"Sign in\"}\n </Button>\n </div>\n </CredentialControlField>\n </CredentialUsageRow>\n )}\n </section>\n\n {/* Error */}\n {addError && (\n <div className=\"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2\">\n <p className=\"text-[12px] text-destructive\">{addError}</p>\n </div>\n )}\n\n <FloatActions>\n <Button\n variant=\"ghost\"\n onClick={() => {\n oauth.cancel();\n props.onCancel();\n }}\n disabled={adding}\n >\n Cancel\n </Button>\n <Button onClick={handleAdd} disabled={!canAdd || adding}>\n {adding && <Spinner className=\"size-3.5\" />}\n {adding ? \"Adding...\" : \"Add source\"}\n </Button>\n </FloatActions>\n </div>\n );\n}\n","import {\n emptyHttpCredentials,\n type HttpCredentialsState,\n} from \"@executor-js/react/plugins/http-credentials\";\n\nexport const initialGraphqlCredentials = (): HttpCredentialsState => emptyHttpCredentials();\n"],"mappings":";;;;;;;;;AAAA,SAAS,aAAa,gBAAgB;AACtC,SAAS,kBAAkB;AAC3B,YAAY,UAAU;AACtB,YAAY,YAAY;AACxB,YAAY,YAAY;AAExB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,8BAA8B;AACvC,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,eAAe;;;ACpCxB;AAAA,EACE;AAAA,OAEK;AAEA,IAAM,4BAA4B,MAA4B,qBAAqB;;;AD+LpF,cAgBE,YAhBF;AA1JN,IAAM,eAAsB,cAAO,EAAE,SAAgB,cAAO,CAAC;AAC7D,IAAM,qBAA4B,2BAAoB,YAAY;AAElE,IAAM,uBAAuB,CAAC,MAAmC,aACxD,aAAa,eAAa,qBAAgB,IAAI,GAAG,kBAAkB,G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AAE,WAAU,gCAAgC,oBAAS,GACxD;AAAA,IAGF,qBAAC,gBACC;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,MAAM;AACb,kBAAM,OAAO;AACb,kBAAM,SAAS;AAAA,UACjB;AAAA,UACA,UAAU;AAAA,UACX;AAAA;AAAA,MAED;AAAA,MACA,qBAAC,UAAO,SAAS,WAAW,UAAU,CAAC,UAAU,QAC9C;AAAA,kBAAU,oBAAC,WAAQ,WAAU,YAAW;AAAA,QACxC,SAAS,cAAc;AAAA,SAC1B;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
@@ -3,124 +3,128 @@ import {
3
3
  } from "./chunk-M4SJY6CB.js";
4
4
  import {
5
5
  graphqlSourceAtom,
6
- graphqlSourceBindingsAtom,
7
- setGraphqlSourceBinding,
8
- updateGraphqlSource
9
- } from "./chunk-EW4Y3KEX.js";
10
- import {
11
- GRAPHQL_OAUTH_CONNECTION_SLOT,
12
- GraphqlSourceBindingInput
13
- } from "./chunk-445ZPXHU.js";
6
+ graphqlSourceBindingsAtom
7
+ } from "./chunk-OYUIHBWZ.js";
8
+ import "./chunk-H422YIM4.js";
14
9
 
15
10
  // src/react/EditGraphqlSource.tsx
16
- import { useState } from "react";
11
+ import { useMemo, useState } from "react";
17
12
  import { useAtomValue, useAtomSet } from "@effect/atom-react";
18
13
  import * as Exit from "effect/Exit";
19
14
  import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
20
- import { connectionsAtom } from "@executor-js/react/api/atoms";
21
- import { useScope, useScopeStack } from "@executor-js/react/api/scope-context";
15
+ import {
16
+ configureSource,
17
+ connectionsAtom,
18
+ setSourceCredentialBinding
19
+ } from "@executor-js/react/api/atoms";
20
+ import { useScope, useUserScope } from "@executor-js/react/api/scope-context";
22
21
  import { connectionWriteKeys, sourceWriteKeys } from "@executor-js/react/api/reactivity-keys";
23
22
  import { useSecretPickerSecrets } from "@executor-js/react/plugins/use-secret-picker-secrets";
24
23
  import {
25
- HttpCredentialsEditor,
26
- serializeHttpCredentials,
27
- serializeScopedHttpCredentials
28
- } from "@executor-js/react/plugins/http-credentials";
29
- import {
30
- effectiveCredentialBindingForScope,
31
24
  httpCredentialsFromConfiguredCredentialBindings,
32
- initialCredentialTargetScope
33
- } from "@executor-js/react/plugins/credential-bindings";
25
+ serializeHttpCredentials
26
+ } from "@executor-js/react/plugins/http-credentials";
34
27
  import { slugifyNamespace, useSourceIdentity } from "@executor-js/react/plugins/source-identity";
35
28
  import { useCredentialTargetScope } from "@executor-js/react/plugins/credential-target-scope";
29
+ import {
30
+ useSourceCredentialBindingScopes,
31
+ useSourceCredentialBindingWriter
32
+ } from "@executor-js/react/plugins/source-credential-bindings";
36
33
  import { Button } from "@executor-js/react/components/button";
34
+ import {
35
+ CardStack,
36
+ CardStackContent,
37
+ CardStackEntry,
38
+ CardStackEntryContent,
39
+ CardStackEntryDescription,
40
+ CardStackEntryTitle
41
+ } from "@executor-js/react/components/card-stack";
37
42
  import { FilterTabs } from "@executor-js/react/components/filter-tabs";
38
- import { SourceOAuthConnectionControl } from "@executor-js/react/plugins/source-oauth-connection";
43
+ import {
44
+ SourceOAuthConnectionControl,
45
+ sourceOAuthConnectionUiState
46
+ } from "@executor-js/react/plugins/source-oauth-connection";
39
47
  import { Badge } from "@executor-js/react/components/badge";
40
- import { ScopeId } from "@executor-js/sdk/core";
48
+ import { ScopeId } from "@executor-js/sdk/shared";
49
+ import {
50
+ SecretCredentialSlotBindings,
51
+ secretCredentialSlotsFromHttpConfig
52
+ } from "@executor-js/react/plugins/credential-slot-bindings";
41
53
  import { jsx, jsxs } from "react/jsx-runtime";
42
54
  function EditForm(props) {
43
55
  const displayScope = useScope();
44
- const scopeStack = useScopeStack();
56
+ const userScope = useUserScope();
45
57
  const sourceScope = ScopeId.make(props.initial.scope);
46
- const { credentialTargetScope, credentialScopeOptions } = useCredentialTargetScope({
47
- sourceScope,
48
- initialTargetScope: initialCredentialTargetScope(sourceScope, props.bindings)
49
- });
50
58
  const {
51
59
  credentialTargetScope: oauthCredentialTargetScope,
52
60
  setCredentialTargetScope: setOAuthCredentialTargetScope
53
61
  } = useCredentialTargetScope({
54
62
  sourceScope,
55
- initialTargetScope: initialCredentialTargetScope(sourceScope, props.bindings)
63
+ initialTargetScope: userScope
56
64
  });
57
- const doUpdate = useAtomSet(updateGraphqlSource, { mode: "promiseExit" });
58
- const setBinding = useAtomSet(setGraphqlSourceBinding, { mode: "promise" });
65
+ const doConfigure = useAtomSet(configureSource, { mode: "promiseExit" });
66
+ const setConnectionBinding = useAtomSet(setSourceCredentialBinding, { mode: "promise" });
59
67
  const secretList = useSecretPickerSecrets();
60
- const connectionsResult = useAtomValue(connectionsAtom(displayScope));
68
+ const connectionsResult = useAtomValue(connectionsAtom(userScope));
61
69
  const identity = useSourceIdentity({
62
70
  fallbackName: props.initial.name,
63
71
  fallbackNamespace: props.initial.namespace
64
72
  });
65
73
  const [endpoint, setEndpoint] = useState(props.initial.endpoint);
66
- const [credentials, setCredentials] = useState(
74
+ const credentials = useMemo(
67
75
  () => httpCredentialsFromConfiguredCredentialBindings({
68
76
  headers: props.initial.headers,
69
77
  queryParams: props.initial.queryParams,
70
78
  bindings: props.bindings
71
- })
79
+ }),
80
+ [props.bindings, props.initial.headers, props.initial.queryParams]
72
81
  );
73
82
  const [authMode, setAuthMode] = useState(props.initial.auth.kind);
74
83
  const [saving, setSaving] = useState(false);
75
84
  const [error, setError] = useState(null);
76
- const [credentialsDirty, setCredentialsDirty] = useState(false);
77
85
  const [authDirty, setAuthDirty] = useState(false);
86
+ const { busyKey, setSecretBinding, clearBinding } = useSourceCredentialBindingWriter({
87
+ displayScope,
88
+ source: { id: props.sourceId, scope: sourceScope },
89
+ onError: setError
90
+ });
78
91
  const identityDirty = identity.name.trim() !== props.initial.name.trim();
79
92
  const metadataDirty = identityDirty || endpoint.trim() !== props.initial.endpoint.trim();
80
- const dirty = metadataDirty || credentialsDirty || authDirty;
93
+ const dirty = metadataDirty || authDirty;
81
94
  const oauth2 = props.initial.auth.kind === "oauth2" ? props.initial.auth : null;
82
95
  const connections = AsyncResult.isSuccess(connectionsResult) ? connectionsResult.value : [];
83
- const scopeRanks = new Map(scopeStack.map((scope, index) => [scope.id, index]));
84
- const connectionBinding = oauth2 ? effectiveCredentialBindingForScope(
85
- props.bindings,
86
- oauth2.connectionSlot,
87
- oauthCredentialTargetScope,
88
- scopeRanks
89
- ) : null;
90
- const boundConnectionId = connectionBinding?.value.kind === "connection" ? connectionBinding.value.connectionId : null;
91
- const isConnected = boundConnectionId !== null && connections.some((connection) => connection.id === boundConnectionId);
96
+ const { credentialScopeOptions, secretBindingScopes, scopeRanks } = useSourceCredentialBindingScopes({ sourceScope });
97
+ const secretSlots = secretCredentialSlotsFromHttpConfig({
98
+ headers: props.initial.headers,
99
+ queryParams: props.initial.queryParams
100
+ });
101
+ const oauthConnectionState = oauth2 ? sourceOAuthConnectionUiState({
102
+ bindings: props.bindings,
103
+ connectionSlot: oauth2.connectionSlot,
104
+ tokenScope: oauthCredentialTargetScope,
105
+ scopeRanks,
106
+ credentialScopeOptions,
107
+ connections
108
+ }) : null;
92
109
  const oauthRequestCredentials = serializeHttpCredentials(credentials);
93
- const handleCredentialsChange = (next) => {
94
- setCredentials(next);
95
- setCredentialsDirty(true);
96
- };
97
110
  const handleSave = async () => {
98
111
  setSaving(true);
99
112
  setError(null);
100
- const { headers, queryParams } = serializeScopedHttpCredentials(
101
- credentials,
102
- credentialTargetScope
103
- );
104
- const payload = {
105
- sourceScope,
113
+ const config = {
106
114
  name: metadataDirty ? identity.name.trim() || void 0 : void 0,
107
115
  endpoint: metadataDirty ? endpoint.trim() || void 0 : void 0
108
116
  };
109
- if (credentialsDirty) {
110
- payload.headers = headers;
111
- payload.queryParams = queryParams;
112
- payload.credentialTargetScope = credentialTargetScope;
113
- }
114
117
  if (authDirty) {
115
- payload.auth = authMode === "oauth2" ? {
116
- kind: "oauth2",
117
- connectionSlot: props.initial.auth.kind === "oauth2" ? props.initial.auth.connectionSlot : GRAPHQL_OAUTH_CONNECTION_SLOT
118
- } : { kind: "none" };
119
- payload.credentialTargetScope = credentialTargetScope;
118
+ config.auth = authMode === "oauth2" ? { oauth2: {} } : { kind: "none" };
120
119
  }
121
- const exit = await doUpdate({
122
- params: { scopeId: displayScope, namespace: props.sourceId },
123
- payload,
120
+ const exit = await doConfigure({
121
+ params: { scopeId: displayScope },
122
+ payload: {
123
+ source: { id: props.sourceId, scope: sourceScope },
124
+ scope: sourceScope,
125
+ type: "graphql",
126
+ config
127
+ },
124
128
  reactivityKeys: sourceWriteKeys
125
129
  });
126
130
  if (Exit.isFailure(exit)) {
@@ -128,7 +132,6 @@ function EditForm(props) {
128
132
  setSaving(false);
129
133
  return;
130
134
  }
131
- setCredentialsDirty(false);
132
135
  setAuthDirty(false);
133
136
  props.onSave();
134
137
  setSaving(false);
@@ -151,18 +154,28 @@ function EditForm(props) {
151
154
  namespaceReadOnly: true
152
155
  }
153
156
  ),
154
- /* @__PURE__ */ jsx(
155
- HttpCredentialsEditor,
156
- {
157
- credentials,
158
- onChange: handleCredentialsChange,
159
- existingSecrets: secretList,
160
- sourceName: identity.name,
161
- targetScope: credentialTargetScope,
162
- credentialScopeOptions,
163
- bindingScopeOptions: credentialScopeOptions
164
- }
165
- ),
157
+ secretSlots.length > 0 && /* @__PURE__ */ jsx(CardStack, { children: /* @__PURE__ */ jsxs(CardStackContent, { className: "border-t-0", children: [
158
+ /* @__PURE__ */ jsx(CardStackEntry, { children: /* @__PURE__ */ jsxs(CardStackEntryContent, { children: [
159
+ /* @__PURE__ */ jsx(CardStackEntryTitle, { children: "Request credentials" }),
160
+ /* @__PURE__ */ jsx(CardStackEntryDescription, { children: "Headers and query parameters sent with every GraphQL request." })
161
+ ] }) }),
162
+ /* @__PURE__ */ jsx(
163
+ SecretCredentialSlotBindings,
164
+ {
165
+ slots: secretSlots,
166
+ bindingScopes: secretBindingScopes,
167
+ bindingRows: props.bindings,
168
+ scopeRanks,
169
+ secrets: secretList,
170
+ sourceId: props.sourceId,
171
+ sourceName: identity.name,
172
+ credentialScopeOptions,
173
+ busyKey,
174
+ onSetSecretBinding: setSecretBinding,
175
+ onClearBinding: clearBinding
176
+ }
177
+ )
178
+ ] }) }),
166
179
  /* @__PURE__ */ jsxs("section", { className: "hidden space-y-2.5", children: [
167
180
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
168
181
  /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: "Authentication" }),
@@ -183,7 +196,7 @@ function EditForm(props) {
183
196
  ] }),
184
197
  authMode === "oauth2" && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "OAuth sign-in is available from the source header after saving." })
185
198
  ] }),
186
- oauth2 && /* @__PURE__ */ jsx(
199
+ oauth2 && oauthConnectionState && /* @__PURE__ */ jsx(
187
200
  SourceOAuthConnectionControl,
188
201
  {
189
202
  popupName: "graphql-oauth",
@@ -194,24 +207,26 @@ function EditForm(props) {
194
207
  tokenScope: oauthCredentialTargetScope,
195
208
  onTokenScopeChange: setOAuthCredentialTargetScope,
196
209
  credentialScopeOptions,
197
- connectionId: boundConnectionId,
210
+ connectionId: oauthConnectionState.connectionId,
198
211
  sourceLabel: `${identity.name.trim() || props.initial.namespace || "GraphQL"} OAuth`,
199
212
  headers: oauthRequestCredentials.headers,
200
213
  queryParams: oauthRequestCredentials.queryParams,
201
- isConnected,
214
+ isConnected: oauthConnectionState.isConnected,
215
+ buttonIsConnected: oauthConnectionState.buttonIsConnected,
216
+ statusLabel: oauthConnectionState.statusLabel,
202
217
  onConnected: async (connectionId) => {
203
- await setBinding({
218
+ await setConnectionBinding({
204
219
  params: { scopeId: oauthCredentialTargetScope },
205
- payload: GraphqlSourceBindingInput.make({
206
- sourceId: props.sourceId,
207
- sourceScope,
220
+ payload: {
208
221
  scope: oauthCredentialTargetScope,
209
- slot: oauth2.connectionSlot,
222
+ source: { id: props.sourceId, scope: sourceScope },
223
+ slotKey: oauth2.connectionSlot,
210
224
  value: { kind: "connection", connectionId }
211
- }),
225
+ },
212
226
  reactivityKeys: [...sourceWriteKeys, ...connectionWriteKeys]
213
227
  });
214
- }
228
+ },
229
+ signInLabel: oauthConnectionState.signInLabel
215
230
  }
216
231
  ),
217
232
  error && /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error }) }),
@@ -223,11 +238,12 @@ function EditForm(props) {
223
238
  }
224
239
  function EditGraphqlSource(props) {
225
240
  const scopeId = useScope();
241
+ const userScope = useUserScope();
226
242
  const sourceResult = useAtomValue(graphqlSourceAtom(scopeId, props.sourceId));
227
243
  const source = AsyncResult.isSuccess(sourceResult) && sourceResult.value ? sourceResult.value : null;
228
244
  const sourceScope = source ? ScopeId.make(source.scope) : scopeId;
229
245
  const bindingsResult = useAtomValue(
230
- graphqlSourceBindingsAtom(scopeId, props.sourceId, sourceScope)
246
+ graphqlSourceBindingsAtom(userScope, props.sourceId, sourceScope)
231
247
  );
232
248
  if (!AsyncResult.isSuccess(sourceResult) || !source || !AsyncResult.isSuccess(bindingsResult)) {
233
249
  return /* @__PURE__ */ jsx("div", { className: "space-y-6", children: /* @__PURE__ */ jsxs("div", { children: [
@@ -248,4 +264,4 @@ function EditGraphqlSource(props) {
248
264
  export {
249
265
  EditGraphqlSource as default
250
266
  };
251
- //# sourceMappingURL=EditGraphqlSource-F37RPNKV.js.map
267
+ //# sourceMappingURL=EditGraphqlSource-AFR4RQHY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/react/EditGraphqlSource.tsx"],"sourcesContent":["import { useMemo, 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 { graphqlSourceAtom, graphqlSourceBindingsAtom } from \"./atoms\";\nimport {\n configureSource,\n connectionsAtom,\n setSourceCredentialBinding,\n} from \"@executor-js/react/api/atoms\";\nimport { useScope, useUserScope } 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 httpCredentialsFromConfiguredCredentialBindings,\n serializeHttpCredentials,\n type HttpCredentialsState,\n} from \"@executor-js/react/plugins/http-credentials\";\nimport { slugifyNamespace, useSourceIdentity } from \"@executor-js/react/plugins/source-identity\";\nimport { useCredentialTargetScope } from \"@executor-js/react/plugins/credential-target-scope\";\nimport {\n useSourceCredentialBindingScopes,\n useSourceCredentialBindingWriter,\n} from \"@executor-js/react/plugins/source-credential-bindings\";\nimport { Button } from \"@executor-js/react/components/button\";\nimport {\n CardStack,\n CardStackContent,\n CardStackEntry,\n CardStackEntryContent,\n CardStackEntryDescription,\n CardStackEntryTitle,\n} from \"@executor-js/react/components/card-stack\";\nimport { FilterTabs } from \"@executor-js/react/components/filter-tabs\";\nimport {\n SourceOAuthConnectionControl,\n sourceOAuthConnectionUiState,\n} from \"@executor-js/react/plugins/source-oauth-connection\";\nimport { Badge } from \"@executor-js/react/components/badge\";\nimport { type CredentialBindingRef, ScopeId } from \"@executor-js/sdk/shared\";\nimport {\n SecretCredentialSlotBindings,\n secretCredentialSlotsFromHttpConfig,\n} from \"@executor-js/react/plugins/credential-slot-bindings\";\nimport { GraphqlSourceFields } from \"./GraphqlSourceFields\";\nimport type { GraphqlSourceAuthInput } 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 CredentialBindingRef[];\n onSave: () => void;\n}) {\n const displayScope = useScope();\n const userScope = useUserScope();\n const sourceScope = ScopeId.make(props.initial.scope);\n const {\n credentialTargetScope: oauthCredentialTargetScope,\n setCredentialTargetScope: setOAuthCredentialTargetScope,\n } = useCredentialTargetScope({\n sourceScope,\n initialTargetScope: userScope,\n });\n const doConfigure = useAtomSet(configureSource, { mode: \"promiseExit\" });\n const setConnectionBinding = useAtomSet(setSourceCredentialBinding, { mode: \"promise\" });\n const secretList = useSecretPickerSecrets();\n const connectionsResult = useAtomValue(connectionsAtom(userScope));\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 = useMemo<HttpCredentialsState>(\n () =>\n httpCredentialsFromConfiguredCredentialBindings({\n headers: props.initial.headers,\n queryParams: props.initial.queryParams,\n bindings: props.bindings,\n }),\n [props.bindings, props.initial.headers, props.initial.queryParams],\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 [authDirty, setAuthDirty] = useState(false);\n const { busyKey, setSecretBinding, clearBinding } = useSourceCredentialBindingWriter({\n displayScope,\n source: { id: props.sourceId, scope: sourceScope },\n onError: setError,\n });\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 || authDirty;\n const oauth2 = props.initial.auth.kind === \"oauth2\" ? props.initial.auth : null;\n const connections = AsyncResult.isSuccess(connectionsResult) ? connectionsResult.value : [];\n const { credentialScopeOptions, secretBindingScopes, scopeRanks } =\n useSourceCredentialBindingScopes({ sourceScope });\n const secretSlots = secretCredentialSlotsFromHttpConfig({\n headers: props.initial.headers,\n queryParams: props.initial.queryParams,\n });\n const oauthConnectionState = oauth2\n ? sourceOAuthConnectionUiState({\n bindings: props.bindings,\n connectionSlot: oauth2.connectionSlot,\n tokenScope: oauthCredentialTargetScope,\n scopeRanks,\n credentialScopeOptions,\n connections,\n })\n : null;\n const oauthRequestCredentials = serializeHttpCredentials(credentials);\n\n const handleSave = async () => {\n setSaving(true);\n setError(null);\n const config: {\n name?: string;\n endpoint?: string;\n auth?: GraphqlSourceAuthInput;\n } = {\n name: metadataDirty ? identity.name.trim() || undefined : undefined,\n endpoint: metadataDirty ? endpoint.trim() || undefined : undefined,\n };\n if (authDirty) {\n config.auth = authMode === \"oauth2\" ? { oauth2: {} } : { kind: \"none\" };\n }\n const exit = await doConfigure({\n params: { scopeId: displayScope },\n payload: {\n source: { id: props.sourceId, scope: sourceScope },\n scope: sourceScope,\n type: \"graphql\",\n config,\n },\n reactivityKeys: sourceWriteKeys,\n });\n\n if (Exit.isFailure(exit)) {\n setError(\"Failed to update source\");\n setSaving(false);\n return;\n }\n\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 {secretSlots.length > 0 && (\n <CardStack>\n <CardStackContent className=\"border-t-0\">\n <CardStackEntry>\n <CardStackEntryContent>\n <CardStackEntryTitle>Request credentials</CardStackEntryTitle>\n <CardStackEntryDescription>\n Headers and query parameters sent with every GraphQL request.\n </CardStackEntryDescription>\n </CardStackEntryContent>\n </CardStackEntry>\n <SecretCredentialSlotBindings\n slots={secretSlots}\n bindingScopes={secretBindingScopes}\n bindingRows={props.bindings}\n scopeRanks={scopeRanks}\n secrets={secretList}\n sourceId={props.sourceId}\n sourceName={identity.name}\n credentialScopeOptions={credentialScopeOptions}\n busyKey={busyKey}\n onSetSecretBinding={setSecretBinding}\n onClearBinding={clearBinding}\n />\n </CardStackContent>\n </CardStack>\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 && oauthConnectionState && (\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={oauthConnectionState.connectionId}\n sourceLabel={`${identity.name.trim() || props.initial.namespace || \"GraphQL\"} OAuth`}\n headers={oauthRequestCredentials.headers}\n queryParams={oauthRequestCredentials.queryParams}\n isConnected={oauthConnectionState.isConnected}\n buttonIsConnected={oauthConnectionState.buttonIsConnected}\n statusLabel={oauthConnectionState.statusLabel}\n onConnected={async (connectionId) => {\n await setConnectionBinding({\n params: { scopeId: oauthCredentialTargetScope },\n payload: {\n scope: oauthCredentialTargetScope,\n source: { id: props.sourceId, scope: sourceScope },\n slotKey: oauth2.connectionSlot,\n value: { kind: \"connection\", connectionId },\n },\n reactivityKeys: [...sourceWriteKeys, ...connectionWriteKeys],\n });\n }}\n signInLabel={oauthConnectionState.signInLabel}\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 userScope = useUserScope();\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(userScope, 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,SAAS,gBAAgB;AAClC,SAAS,cAAc,kBAAkB;AACzC,YAAY,UAAU;AACtB,YAAY,iBAAiB;AAE7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU,oBAAoB;AACvC,SAAS,qBAAqB,uBAAuB;AACrD,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAAkB,yBAAyB;AAC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tom,
3
3
  graphqlSourceBindingsAtom
4
- } from "./chunk-EW4Y3KEX.js";
5
- import "./chunk-445ZPXHU.js";
4
+ } from "./chunk-OYUIHBWZ.js";
5
+ import "./chunk-H422YIM4.js";
6
6
 
7
7
  // src/react/GraphqlSourceSummary.tsx
8
8
  import { useAtomValue } from "@effect/atom-react";
@@ -14,7 +14,7 @@ import {
14
14
  SourceCredentialStatusBadge,
15
15
  missingSourceCredentialLabels
16
16
  } from "@executor-js/react/plugins/source-credential-status";
17
- import { ScopeId } from "@executor-js/sdk/core";
17
+ import { ScopeId } from "@executor-js/sdk/shared";
18
18
  import { jsx } from "react/jsx-runtime";
19
19
  var sourceCredentialSlots = (source) => {
20
20
  const slots = [];
@@ -67,4 +67,4 @@ function GraphqlSourceSummary(props) {
67
67
  export {
68
68
  GraphqlSourceSummary as default
69
69
  };
70
- //# sourceMappingURL=GraphqlSourceSummary-6EYBXVD2.js.map
70
+ //# sourceMappingURL=GraphqlSourceSummary-MY4AW37M.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/react/GraphqlSourceSummary.tsx"],"sourcesContent":["import { useAtomValue } from \"@effect/atom-react\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\n\nimport { connectionsAtom } from \"@executor-js/react/api/atoms\";\nimport { useScope, useScopeStack, useUserScope } from \"@executor-js/react/api/scope-context\";\nimport {\n SourceCredentialNotice,\n SourceCredentialStatusBadge,\n missingSourceCredentialLabels,\n type SourceCredentialSlot,\n} from \"@executor-js/react/plugins/source-credential-status\";\nimport { ScopeId } from \"@executor-js/sdk/shared\";\n\nimport { graphqlSourceAtom, graphqlSourceBindingsAtom } from \"./atoms\";\nimport type { StoredGraphqlSource } from \"../sdk/store\";\n\nconst sourceCredentialSlots = (source: StoredGraphqlSource): readonly SourceCredentialSlot[] => {\n const slots: SourceCredentialSlot[] = [];\n for (const [name, value] of Object.entries(source.headers)) {\n if (typeof value !== \"string\") slots.push({ kind: \"secret\", slot: value.slot, label: name });\n }\n for (const [name, value] of Object.entries(source.queryParams)) {\n if (typeof value !== \"string\") slots.push({ kind: \"secret\", slot: value.slot, label: name });\n }\n if (source.auth.kind === \"oauth2\") {\n slots.push({\n kind: \"connection\",\n slot: source.auth.connectionSlot,\n label: \"OAuth sign-in\",\n });\n }\n return slots;\n};\n\nexport default function GraphqlSourceSummary(props: {\n sourceId: string;\n variant?: \"badge\" | \"panel\";\n onAction?: () => void;\n}) {\n const displayScope = useScope();\n const userScope = useUserScope();\n const scopeStack = useScopeStack();\n const sourceResult = useAtomValue(graphqlSourceAtom(displayScope, props.sourceId));\n const source =\n AsyncResult.isSuccess(sourceResult) && sourceResult.value ? sourceResult.value : null;\n const sourceScope = source ? ScopeId.make(source.scope) : displayScope;\n const bindingsResult = useAtomValue(\n graphqlSourceBindingsAtom(displayScope, props.sourceId, sourceScope),\n );\n const connectionsResult = useAtomValue(connectionsAtom(displayScope));\n\n if (!source) return null;\n const slots = sourceCredentialSlots(source as StoredGraphqlSource);\n if (slots.length === 0) return null;\n if (!AsyncResult.isSuccess(bindingsResult) || !AsyncResult.isSuccess(connectionsResult)) {\n return props.variant === \"panel\" ? null : (\n <SourceCredentialStatusBadge missing={[\"credentials\"]} />\n );\n }\n\n const scopeRanks = new Map(scopeStack.map((scope, index) => [scope.id, index] as const));\n const liveConnectionIds = new Set(connectionsResult.value.map((connection) => connection.id));\n const missing = missingSourceCredentialLabels({\n slots,\n bindings: bindingsResult.value,\n targetScope: userScope,\n scopeRanks,\n liveConnectionIds,\n });\n\n if (props.variant === \"panel\") {\n return <SourceCredentialNotice missing={missing} onAction={props.onAction} />;\n }\n\n return <SourceCredentialStatusBadge missing={missing} />;\n}\n"],"mappings":";;;;;;;AAAA,SAAS,oBAAoB;AAC7B,YAAY,iBAAiB;AAE7B,SAAS,uBAAuB;AAChC,SAAS,UAAU,eAAe,oBAAoB;AACtD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,eAAe;AA6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