@executor-js/plugin-openapi 1.4.33 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AddOpenApiSource-7M52SRUX.js +893 -0
- package/dist/AddOpenApiSource-7M52SRUX.js.map +1 -0
- package/dist/EditOpenApiSource-WTAMRJUK.js +68 -0
- package/dist/EditOpenApiSource-WTAMRJUK.js.map +1 -0
- package/dist/OpenApiAccountsPanel-3VJJXNQF.js +112 -0
- package/dist/OpenApiAccountsPanel-3VJJXNQF.js.map +1 -0
- package/dist/api/group.d.ts +104 -225
- package/dist/api/index.d.ts +127 -271
- package/dist/{chunk-BB5IAKRG.js → chunk-AQ7JDDRM.js} +12 -2
- package/dist/chunk-AQ7JDDRM.js.map +1 -0
- package/dist/chunk-BSLE6HCE.js +181 -0
- package/dist/chunk-BSLE6HCE.js.map +1 -0
- package/dist/chunk-MZWZQ24W.js +226 -0
- package/dist/chunk-MZWZQ24W.js.map +1 -0
- package/dist/chunk-OSIFYIQP.js +623 -0
- package/dist/chunk-OSIFYIQP.js.map +1 -0
- package/dist/chunk-QSSRVK6M.js +139 -0
- package/dist/chunk-QSSRVK6M.js.map +1 -0
- package/dist/chunk-V7VCHYOY.js +1544 -0
- package/dist/chunk-V7VCHYOY.js.map +1 -0
- package/dist/{chunk-AN4HJFNP.js → chunk-YVRI7KRC.js} +162 -186
- package/dist/chunk-YVRI7KRC.js.map +1 -0
- package/dist/client.js +9 -8
- package/dist/client.js.map +1 -1
- package/dist/core.js +28 -11
- package/dist/index.js +11 -4
- package/dist/react/AddOpenApiSource.d.ts +2 -13
- package/dist/react/GoogleProductPicker.d.ts +9 -0
- package/dist/react/OpenApiAccountsPanel.d.ts +6 -0
- package/dist/react/OpenApiSourceDetailsFields.d.ts +3 -2
- package/dist/react/atoms.d.ts +177 -192
- package/dist/react/auth-method-config.d.ts +15 -0
- package/dist/react/client.d.ts +103 -224
- package/dist/react/index.d.ts +2 -2
- package/dist/react/source-plugin.d.ts +2 -2
- package/dist/sdk/config.d.ts +75 -0
- package/dist/sdk/configure.test.d.ts +1 -0
- package/dist/sdk/describe-auth-methods.test.d.ts +1 -0
- package/dist/sdk/errors.d.ts +4 -6
- package/dist/sdk/extract.d.ts +7 -5
- package/dist/sdk/google-bundle.test.d.ts +1 -0
- package/dist/sdk/google-discovery.d.ts +43 -0
- package/dist/sdk/google-discovery.test.d.ts +1 -0
- package/dist/sdk/google-oauth-batches.d.ts +13 -0
- package/dist/sdk/google-oauth-batches.test.d.ts +1 -0
- package/dist/sdk/google-oauth-scopes.d.ts +3 -0
- package/dist/sdk/google-oauth-scopes.test.d.ts +1 -0
- package/dist/sdk/google-presets.d.ts +16 -0
- package/dist/sdk/google-presets.test.d.ts +1 -0
- package/dist/sdk/google-product-picker-scopes.test.d.ts +1 -0
- package/dist/sdk/index.d.ts +7 -5
- package/dist/sdk/invoke.d.ts +6 -9
- package/dist/sdk/openapi-utils.d.ts +1 -0
- package/dist/sdk/plugin.d.ts +74 -231
- package/dist/sdk/presets.d.ts +2 -1
- package/dist/sdk/preview.d.ts +20 -15
- package/dist/sdk/query-serialization.test.d.ts +1 -0
- package/dist/sdk/store.d.ts +14 -41
- package/dist/sdk/types.d.ts +23 -51
- package/dist/testing/index.d.ts +49 -38
- package/dist/testing.js +46 -18
- package/dist/testing.js.map +1 -1
- package/package.json +6 -4
- package/dist/AddOpenApiSource-NSCULGTM.js +0 -19
- package/dist/AddOpenApiSource-NSCULGTM.js.map +0 -1
- package/dist/EditOpenApiSource-MV7NYTRP.js +0 -774
- package/dist/EditOpenApiSource-MV7NYTRP.js.map +0 -1
- package/dist/OpenApiSourceSummary-7JBS7PUV.js +0 -122
- package/dist/OpenApiSourceSummary-7JBS7PUV.js.map +0 -1
- package/dist/chunk-2ZKKZYZH.js +0 -1181
- package/dist/chunk-2ZKKZYZH.js.map +0 -1
- package/dist/chunk-AN4HJFNP.js.map +0 -1
- package/dist/chunk-BB5IAKRG.js.map +0 -1
- package/dist/chunk-PRVJDE43.js +0 -2101
- package/dist/chunk-PRVJDE43.js.map +0 -1
- package/dist/chunk-X5JX3KTA.js +0 -201
- package/dist/chunk-X5JX3KTA.js.map +0 -1
- package/dist/react/OpenApiSourceSummary.d.ts +0 -5
- package/dist/sdk/credential-status.d.ts +0 -23
- package/dist/sdk/source-contracts.d.ts +0 -55
- /package/dist/{sdk/credential-status.test.d.ts → react/auth-method-config.test.d.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/EditOpenApiSource.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from \"react\";\nimport { useAtomSet, useAtomValue } from \"@effect/atom-react\";\nimport * as Exit from \"effect/Exit\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\n\nimport {\n connectionsAtom,\n configureSource,\n setSourceCredentialBinding,\n sourceAtom,\n startOAuth,\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 { Button } from \"@executor-js/react/components/button\";\nimport { CopyButton } from \"@executor-js/react/components/copy-button\";\nimport {\n CardStack,\n CardStackContent,\n CardStackEntry,\n CardStackEntryContent,\n CardStackEntryDescription,\n CardStackEntryTitle,\n CardStackEntryField,\n} from \"@executor-js/react/components/card-stack\";\nimport { FieldLabel } from \"@executor-js/react/components/field\";\nimport { HelpTooltip } from \"@executor-js/react/components/help-tooltip\";\nimport { Input } from \"@executor-js/react/components/input\";\nimport { sourceWriteKeys as openApiWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport {\n ConnectionId,\n CredentialBindingRef,\n ScopeId,\n SetSourceCredentialBindingInput,\n} from \"@executor-js/sdk/shared\";\nimport { useSecretPickerSecrets } from \"@executor-js/react/plugins/use-secret-picker-secrets\";\nimport {\n oauthCallbackUrl,\n useOAuthPopupFlow,\n type OAuthCompletionPayload,\n} from \"@executor-js/react/plugins/oauth-sign-in\";\nimport {\n CredentialControlField,\n CredentialScopeDropdown,\n CredentialUsageRow,\n} from \"@executor-js/react/plugins/credential-target-scope\";\nimport {\n effectiveCredentialBindingForScope,\n exactCredentialBindingForScope,\n isConnectionCredentialBindingValue,\n isSecretCredentialBindingValue,\n} from \"@executor-js/react/plugins/credential-bindings\";\nimport { SecretCredentialSlotBindings } from \"@executor-js/react/plugins/credential-slot-bindings\";\nimport {\n useSourceCredentialBindingScopes,\n useSourceCredentialBindingWriter,\n} from \"@executor-js/react/plugins/source-credential-bindings\";\nimport { CreatableSecretPicker } from \"@executor-js/react/plugins/secret-header-auth\";\n\nimport { openApiSourceAtom, openApiSourceBindingsAtom } from \"./atoms\";\nimport { OpenApiSourceDetailsFields } from \"./OpenApiSourceDetailsFields\";\nimport {\n OPENAPI_OAUTH_CALLBACK_PATH,\n OPENAPI_OAUTH_POPUP_NAME,\n inferOAuthIssuerUrl,\n resolveOAuthUrl,\n} from \"./AddOpenApiSource\";\nimport { oauth2ClientSecretSlot } from \"../sdk/source-contracts\";\nimport { OAuth2SourceConfig } 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 SlotDef =\n | {\n readonly kind: \"secret\";\n readonly slot: string;\n readonly label: string;\n readonly hint?: string;\n }\n | {\n readonly kind: \"oauth2\";\n readonly slot: string;\n readonly label: string;\n };\n\ntype OpenApiCredentialBindingRow = CredentialBindingRef;\n\nconst slugify = (value: string): string =>\n value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\") || \"default\";\n\nconst shortHash = (value: string): string => {\n let hash = 0x811c9dc5;\n for (let i = 0; i < value.length; i++) {\n hash ^= value.charCodeAt(i);\n hash = Math.imul(hash, 0x01000193);\n }\n return (hash >>> 0).toString(36).slice(0, 6);\n};\n\nconst openApiOAuthConnectionId = (\n sourceId: string,\n securitySchemeName: string,\n targetScope: ScopeId,\n): ConnectionId =>\n ConnectionId.make(\n `openapi-oauth-${slugify(sourceId)}-${slugify(securitySchemeName)}-${shortHash(targetScope)}`,\n );\n\nconst effectiveClientSecretSlot = (oauth2: {\n readonly securitySchemeName: string;\n readonly clientSecretSlot: string | null;\n}): string => oauth2.clientSecretSlot ?? oauth2ClientSecretSlot(oauth2.securitySchemeName);\n\nexport default function EditOpenApiSource(props: {\n readonly sourceId: string;\n readonly onSave: () => void;\n}) {\n const displayScope = useScope();\n const userScope = useUserScope();\n const sourceSummaryResult = useAtomValue(sourceAtom(props.sourceId, displayScope));\n const sourceSummary =\n AsyncResult.isSuccess(sourceSummaryResult) && sourceSummaryResult.value\n ? sourceSummaryResult.value\n : null;\n const sourceScopeId = sourceSummary?.scopeId ?? displayScope;\n const sourceScope = ScopeId.make(sourceScopeId);\n const {\n credentialScopes,\n credentialScopeOptions,\n organizationCredentialScope,\n secretBindingScopes,\n scopeRanks,\n } = useSourceCredentialBindingScopes({ sourceScope });\n\n const sourceResult = useAtomValue(openApiSourceAtom(sourceScope, props.sourceId));\n const bindingsResult = useAtomValue(\n openApiSourceBindingsAtom(displayScope, props.sourceId, sourceScope),\n );\n const connectionsResult = useAtomValue(connectionsAtom(displayScope));\n const secretList = useSecretPickerSecrets();\n\n const doConfigure = useAtomSet(configureSource, { mode: \"promiseExit\" });\n const doSetBinding = useAtomSet(setSourceCredentialBinding, {\n mode: \"promiseExit\",\n });\n const doStartOAuth = useAtomSet(startOAuth, { mode: \"promiseExit\" });\n const oauth = useOAuthPopupFlow<OAuthCompletionPayload>({\n popupName: OPENAPI_OAUTH_POPUP_NAME,\n popupBlockedMessage: \"OAuth popup was blocked by the browser\",\n startErrorMessage: \"Failed to connect OAuth\",\n });\n\n const source =\n AsyncResult.isSuccess(sourceResult) && sourceResult.value ? sourceResult.value : null;\n const bindingRows: readonly OpenApiCredentialBindingRow[] = AsyncResult.isSuccess(bindingsResult)\n ? bindingsResult.value\n : [];\n const connections = AsyncResult.isSuccess(connectionsResult) ? connectionsResult.value : [];\n const oauth2RedirectUrl = oauthCallbackUrl(OPENAPI_OAUTH_CALLBACK_PATH);\n\n const [name, setName] = useState(source?.name ?? \"\");\n const [baseUrl, setBaseUrl] = useState(source?.config.baseUrl ?? \"\");\n const [sourceSaveState, setSourceSaveState] = useState<\"idle\" | \"saving\" | \"saved\">(\"idle\");\n const [error, setError] = useState<string | null>(null);\n const [busyKey, setBusyKey] = useState<string | null>(null);\n const sourceBindingWriter = useSourceCredentialBindingWriter({\n displayScope,\n source: { id: props.sourceId, scope: sourceScope },\n onError: setError,\n errorMessageFromExit,\n });\n const [pendingOAuthConnection, setPendingOAuthConnection] = useState<{\n readonly scopeId: ScopeId;\n readonly slot: string;\n readonly connectionId: string;\n } | null>(null);\n const [loadedSourceKey, setLoadedSourceKey] = useState<string | null>(null);\n const [selectedOAuthTokenScope, setSelectedOAuthTokenScope] = useState<string>(\n userScope !== sourceScopeId ? userScope : sourceScopeId,\n );\n const [selectedOAuthClientIdScope, setSelectedOAuthClientIdScope] =\n useState<string>(sourceScopeId);\n const [selectedOAuthClientSecretScope, setSelectedOAuthClientSecretScope] =\n useState<string>(sourceScopeId);\n const [oauthEndpointsOpen, setOAuthEndpointsOpen] = useState(false);\n const [oauth2AuthorizationUrl, setOAuth2AuthorizationUrl] = useState(\n source?.config.oauth2?.authorizationUrl ?? \"\",\n );\n const [oauth2TokenUrl, setOAuth2TokenUrl] = useState(source?.config.oauth2?.tokenUrl ?? \"\");\n const [oauth2EndpointsSaveState, setOAuth2EndpointsSaveState] = useState<\n \"idle\" | \"saving\" | \"saved\"\n >(\"idle\");\n const editIdentity = useMemo(\n () => ({\n name,\n namespace: props.sourceId,\n setName,\n setNamespace: () => {},\n reset: () => {},\n }),\n [name, props.sourceId],\n );\n const sourceSaveSeq = useRef(0);\n const oauth2EndpointsSaveSeq = useRef(0);\n\n useEffect(() => {\n setSelectedOAuthTokenScope(userScope !== sourceScopeId ? userScope : sourceScopeId);\n setSelectedOAuthClientIdScope(sourceScopeId);\n setSelectedOAuthClientSecretScope(sourceScopeId);\n }, [sourceScopeId, userScope]);\n\n useEffect(() => {\n if (!source) return;\n const sourceKey = `${sourceScopeId}:${source.namespace}`;\n if (loadedSourceKey === sourceKey) return;\n setName(source.name);\n setBaseUrl(source.config.baseUrl ?? \"\");\n setOAuth2AuthorizationUrl(source.config.oauth2?.authorizationUrl ?? \"\");\n setOAuth2TokenUrl(source.config.oauth2?.tokenUrl ?? \"\");\n setOAuth2EndpointsSaveState(\"idle\");\n setOAuthEndpointsOpen(false);\n setSourceSaveState(\"idle\");\n setLoadedSourceKey(sourceKey);\n }, [loadedSourceKey, source, sourceScopeId]);\n\n useEffect(() => {\n if (!source) return;\n const sourceKey = `${sourceScopeId}:${source.namespace}`;\n if (loadedSourceKey !== sourceKey) return;\n\n const nextName = name.trim();\n const nextBaseUrl = baseUrl.trim();\n const currentName = source.name;\n const currentBaseUrl = source.config.baseUrl ?? \"\";\n if ((nextName || currentName) === currentName && nextBaseUrl === currentBaseUrl) {\n return;\n }\n\n const timeout = window.setTimeout(() => {\n const seq = ++sourceSaveSeq.current;\n setSourceSaveState(\"saving\");\n setError(null);\n void (async () => {\n const exit = await doConfigure({\n params: { scopeId: displayScope },\n payload: {\n source: { id: props.sourceId, scope: sourceScope },\n scope: sourceScope,\n type: \"openapi\",\n config: {\n scope: sourceScope,\n name: nextName || undefined,\n baseUrl: nextBaseUrl || undefined,\n },\n },\n reactivityKeys: openApiWriteKeys,\n });\n if (sourceSaveSeq.current !== seq) return;\n if (Exit.isFailure(exit)) {\n setSourceSaveState(\"idle\");\n setError(errorMessageFromExit(exit, \"Failed to save source details\"));\n return;\n }\n setSourceSaveState(\"saved\");\n window.setTimeout(() => {\n if (sourceSaveSeq.current === seq) setSourceSaveState(\"idle\");\n }, 1600);\n })();\n }, 600);\n\n return () => window.clearTimeout(timeout);\n }, [\n baseUrl,\n displayScope,\n doConfigure,\n loadedSourceKey,\n name,\n props.sourceId,\n source,\n sourceScope,\n sourceScopeId,\n ]);\n\n const secretSlots = useMemo(() => {\n if (!source) return [] as SlotDef[];\n const slots: SlotDef[] = [];\n for (const [headerName, value] of Object.entries(source.config.headers ?? {})) {\n if (typeof value === \"string\") continue;\n slots.push({\n kind: \"secret\",\n slot: value.slot,\n label: headerName,\n hint: value.prefix ? `Prefix: ${value.prefix}` : undefined,\n });\n }\n if (source.config.oauth2) {\n const clientSecretSlot = effectiveClientSecretSlot(source.config.oauth2);\n slots.push({\n kind: \"secret\",\n slot: source.config.oauth2.clientIdSlot,\n label: \"Client ID\",\n });\n slots.push({\n kind: \"secret\",\n slot: clientSecretSlot,\n label: \"Client Secret\",\n hint:\n source.config.oauth2.flow === \"authorizationCode\"\n ? \"Optional for public PKCE clients\"\n : undefined,\n });\n slots.push({\n kind: \"oauth2\",\n slot: source.config.oauth2.connectionSlot,\n label:\n source.config.oauth2.flow === \"clientCredentials\"\n ? \"OAuth Client Credentials\"\n : \"OAuth Authorization Code\",\n });\n }\n return slots;\n }, [source]);\n\n const activeOAuthTokenScope =\n credentialScopes.find((entry) => entry.scopeId === selectedOAuthTokenScope) ??\n credentialScopes[0]!;\n const activeOAuthTokenScopeId = activeOAuthTokenScope.scopeId;\n const activeOAuthTokenScopeLabel = activeOAuthTokenScope.label;\n\n if (!source) {\n return (\n <div className=\"space-y-3\">\n <h1 className=\"text-xl font-semibold text-foreground\">Edit OpenAPI Source</h1>\n <p className=\"text-sm text-muted-foreground\">Loading configuration…</p>\n </div>\n );\n }\n const oauthClientSecretSlot = source.config.oauth2\n ? effectiveClientSecretSlot(source.config.oauth2)\n : null;\n const nonOAuthSecretSlots = secretSlots.filter(\n (slot) =>\n slot.kind === \"secret\" &&\n (!source.config.oauth2 ||\n (slot.slot !== source.config.oauth2.clientIdSlot && slot.slot !== oauthClientSecretSlot)),\n );\n\n const connectOAuth = async (targetScope: ScopeId) => {\n const oauth2 = source.config.oauth2;\n if (!oauth2) return;\n const clientIdBinding = effectiveCredentialBindingForScope(\n bindingRows,\n oauth2.clientIdSlot,\n targetScope,\n scopeRanks,\n );\n const clientSecretSlot = effectiveClientSecretSlot(oauth2);\n const clientSecretBinding = effectiveCredentialBindingForScope(\n bindingRows,\n clientSecretSlot,\n targetScope,\n scopeRanks,\n );\n if (!clientIdBinding || !isSecretCredentialBindingValue(clientIdBinding.value)) {\n setError(\"Client ID must be bound before connecting\");\n return;\n }\n const clientIdSecretId = clientIdBinding.value.secretId;\n const clientIdSecretScopeId = clientIdBinding.value.secretScopeId ?? clientIdBinding.scopeId;\n if (\n oauth2.flow === \"clientCredentials\" &&\n (!clientSecretBinding || !isSecretCredentialBindingValue(clientSecretBinding.value))\n ) {\n setError(\"Client secret must be bound before connecting\");\n return;\n }\n const clientSecretValue =\n oauth2.flow === \"clientCredentials\" &&\n clientSecretBinding &&\n isSecretCredentialBindingValue(clientSecretBinding.value)\n ? clientSecretBinding.value\n : null;\n const clientSecretSecretScopeId =\n clientSecretBinding && isSecretCredentialBindingValue(clientSecretBinding.value)\n ? (clientSecretBinding.value.secretScopeId ?? clientSecretBinding.scopeId)\n : null;\n\n const existingConnection = exactCredentialBindingForScope(\n bindingRows,\n oauth2.connectionSlot,\n targetScope,\n );\n const connectionId =\n existingConnection && isConnectionCredentialBindingValue(existingConnection.value)\n ? existingConnection.value.connectionId\n : openApiOAuthConnectionId(props.sourceId, oauth2.securitySchemeName, targetScope);\n\n setBusyKey(`${targetScope}:${oauth2.connectionSlot}:connect`);\n setPendingOAuthConnection({\n scopeId: targetScope,\n slot: oauth2.connectionSlot,\n connectionId: connectionId,\n });\n setError(null);\n const failConnect = (message: string) => {\n setError(message);\n setPendingOAuthConnection(null);\n setBusyKey(null);\n };\n const displayName = source.name;\n const tokenUrl = resolveOAuthUrl(oauth2.tokenUrl, source.config.baseUrl ?? \"\");\n if (oauth2.flow === \"clientCredentials\") {\n const startOAuthExit = await doStartOAuth({\n params: { scopeId: targetScope },\n payload: {\n endpoint: tokenUrl,\n redirectUrl: tokenUrl,\n connectionId: connectionId,\n tokenScope: targetScope,\n strategy: {\n kind: \"client-credentials\",\n tokenEndpoint: tokenUrl,\n clientIdSecretId,\n clientIdSecretScopeId: String(clientIdSecretScopeId),\n clientSecretSecretId: clientSecretValue!.secretId,\n clientSecretSecretScopeId: clientSecretSecretScopeId\n ? String(clientSecretSecretScopeId)\n : null,\n scopes: [...oauth2.scopes],\n },\n pluginId: \"openapi\",\n identityLabel: `${displayName} OAuth`,\n },\n });\n if (Exit.isFailure(startOAuthExit)) {\n failConnect(errorMessageFromExit(startOAuthExit, \"Failed to connect OAuth\"));\n return;\n }\n const response = startOAuthExit.value;\n if (!response.completedConnection) {\n failConnect(\"Unexpected OAuth response\");\n return;\n }\n const setBindingExit = await doSetBinding({\n params: { scopeId: displayScope },\n payload: SetSourceCredentialBindingInput.make({\n source: { id: props.sourceId, scope: sourceScope },\n scope: targetScope,\n slotKey: oauth2.connectionSlot,\n value: {\n kind: \"connection\",\n connectionId: ConnectionId.make(response.completedConnection.connectionId),\n },\n }),\n reactivityKeys: [...sourceWriteKeys, ...connectionWriteKeys],\n });\n if (Exit.isFailure(setBindingExit)) {\n failConnect(errorMessageFromExit(setBindingExit, \"Failed to connect OAuth\"));\n return;\n }\n setPendingOAuthConnection(null);\n setBusyKey(null);\n return;\n }\n\n const authorizationUrl = resolveOAuthUrl(\n oauth2.authorizationUrl ?? \"\",\n source.config.baseUrl ?? \"\",\n );\n const issuerUrl = oauth2.issuerUrl ?? inferOAuthIssuerUrl(authorizationUrl);\n const startOAuthExit = await doStartOAuth({\n params: { scopeId: targetScope },\n payload: {\n endpoint: authorizationUrl,\n connectionId,\n tokenScope: targetScope,\n redirectUrl: oauth2RedirectUrl,\n strategy: {\n kind: \"authorization-code\",\n authorizationEndpoint: authorizationUrl,\n tokenEndpoint: tokenUrl,\n issuerUrl,\n clientIdSecretId,\n clientIdSecretScopeId: String(clientIdSecretScopeId),\n clientSecretSecretId:\n clientSecretBinding && isSecretCredentialBindingValue(clientSecretBinding.value)\n ? clientSecretBinding.value.secretId\n : null,\n clientSecretSecretScopeId: clientSecretSecretScopeId\n ? String(clientSecretSecretScopeId)\n : null,\n scopes: [...oauth2.scopes],\n },\n pluginId: \"openapi\",\n identityLabel: `${displayName} OAuth`,\n },\n });\n if (Exit.isFailure(startOAuthExit)) {\n failConnect(errorMessageFromExit(startOAuthExit, \"Failed to connect OAuth\"));\n return;\n }\n const response = startOAuthExit.value;\n if (response.authorizationUrl === null) {\n failConnect(\"Unexpected OAuth response\");\n return;\n }\n\n await oauth.openAuthorization({\n tokenScope: targetScope,\n run: async () => ({\n sessionId: response.sessionId,\n authorizationUrl: response.authorizationUrl,\n }),\n onSuccess: async (result) => {\n const setBindingExit = await doSetBinding({\n params: { scopeId: displayScope },\n payload: SetSourceCredentialBindingInput.make({\n source: { id: props.sourceId, scope: sourceScope },\n scope: targetScope,\n slotKey: oauth2.connectionSlot,\n value: {\n kind: \"connection\",\n connectionId: ConnectionId.make(result.connectionId),\n },\n }),\n reactivityKeys: [...sourceWriteKeys, ...connectionWriteKeys],\n });\n if (Exit.isFailure(setBindingExit)) {\n failConnect(errorMessageFromExit(setBindingExit, \"Failed to connect OAuth\"));\n return;\n }\n setPendingOAuthConnection(null);\n setBusyKey(null);\n },\n onError: (message) => {\n setError(message);\n setPendingOAuthConnection(null);\n setBusyKey(null);\n },\n });\n };\n\n return (\n <div className=\"space-y-6\">\n <div>\n <h1 className=\"text-xl font-semibold text-foreground\">OpenAPI Source</h1>\n </div>\n\n <OpenApiSourceDetailsFields\n title=\"Source Details\"\n description=\"Name and base URL save automatically.\"\n identity={editIdentity}\n baseUrl={baseUrl}\n onBaseUrlChange={setBaseUrl}\n specUrl={source.config.sourceUrl ?? \"\"}\n onSpecUrlChange={() => {}}\n specUrlDisabled\n namespaceReadOnly\n saveState={sourceSaveState}\n footer={\n source.config.oauth2\n ? `Authentication Template: OAuth2 ${source.config.oauth2.flow}`\n : Object.keys(source.config.headers ?? {}).length > 0\n ? `Authentication Template: ${Object.keys(source.config.headers ?? {}).length} header binding${\n Object.keys(source.config.headers ?? {}).length === 1 ? \"\" : \"s\"\n }`\n : \"Authentication Template: None\"\n }\n />\n\n <CardStack>\n <CardStackContent className=\"border-t-0\">\n {nonOAuthSecretSlots.length > 0 && (\n <>\n <CardStackEntry>\n <CardStackEntryContent>\n <CardStackEntryTitle>Request credentials</CardStackEntryTitle>\n <CardStackEntryDescription>\n Headers and query parameters sent with every API request.\n </CardStackEntryDescription>\n </CardStackEntryContent>\n </CardStackEntry>\n\n <SecretCredentialSlotBindings\n slots={nonOAuthSecretSlots}\n bindingScopes={secretBindingScopes}\n bindingRows={bindingRows}\n scopeRanks={scopeRanks}\n secrets={secretList}\n sourceId={props.sourceId}\n sourceName={source.name}\n credentialScopeOptions={credentialScopeOptions}\n busyKey={sourceBindingWriter.busyKey}\n onSetSecretBinding={sourceBindingWriter.setSecretBinding}\n onClearBinding={sourceBindingWriter.clearBinding}\n />\n </>\n )}\n\n {source.config.oauth2 &&\n (() => {\n const oauth2 = source.config.oauth2;\n const trimmedAuthUrl = oauth2AuthorizationUrl.trim();\n const trimmedTokenUrl = oauth2TokenUrl.trim();\n const savedAuthUrl = oauth2.authorizationUrl ?? \"\";\n const isAuthCode = oauth2.flow === \"authorizationCode\";\n const endpointsDirty =\n (isAuthCode && trimmedAuthUrl !== savedAuthUrl) ||\n trimmedTokenUrl !== oauth2.tokenUrl;\n const saving = oauth2EndpointsSaveState === \"saving\";\n const tokenUrlMissing = trimmedTokenUrl.length === 0;\n const authUrlMissing = isAuthCode && trimmedAuthUrl.length === 0;\n const canSave = endpointsDirty && !saving && !tokenUrlMissing && !authUrlMissing;\n\n const saveOAuth2Endpoints = async () => {\n const seq = ++oauth2EndpointsSaveSeq.current;\n setOAuth2EndpointsSaveState(\"saving\");\n setError(null);\n const exit = await doConfigure({\n params: { scopeId: displayScope },\n payload: {\n source: { id: props.sourceId, scope: sourceScope },\n scope: sourceScope,\n type: \"openapi\",\n config: {\n scope: sourceScope,\n oauth2Source: OAuth2SourceConfig.make({\n kind: \"oauth2\",\n securitySchemeName: oauth2.securitySchemeName,\n flow: oauth2.flow,\n tokenUrl: trimmedTokenUrl,\n authorizationUrl: isAuthCode ? trimmedAuthUrl || null : null,\n issuerUrl: oauth2.issuerUrl ?? null,\n clientIdSlot: oauth2.clientIdSlot,\n clientSecretSlot: oauth2.clientSecretSlot,\n connectionSlot: oauth2.connectionSlot,\n scopes: [...oauth2.scopes],\n }),\n },\n },\n reactivityKeys: openApiWriteKeys,\n });\n if (oauth2EndpointsSaveSeq.current !== seq) return;\n if (Exit.isFailure(exit)) {\n setOAuth2EndpointsSaveState(\"idle\");\n setError(errorMessageFromExit(exit, \"Failed to save OAuth endpoints\"));\n return;\n }\n setOAuth2EndpointsSaveState(\"saved\");\n window.setTimeout(() => {\n if (oauth2EndpointsSaveSeq.current === seq) {\n setOAuth2EndpointsSaveState(\"idle\");\n }\n }, 1600);\n };\n\n const exact = exactCredentialBindingForScope(\n bindingRows,\n oauth2.connectionSlot,\n activeOAuthTokenScopeId,\n );\n const binding =\n exact ??\n effectiveCredentialBindingForScope(\n bindingRows,\n oauth2.connectionSlot,\n activeOAuthTokenScopeId,\n scopeRanks,\n );\n const connectionBinding =\n binding && isConnectionCredentialBindingValue(binding.value) ? binding.value : null;\n const connection = connectionBinding\n ? connections.find((entry) => entry.id === connectionBinding.connectionId)\n : null;\n const bindingScopeId = connectionBinding && binding ? binding.scopeId : null;\n const isConnecting =\n busyKey === `${activeOAuthTokenScopeId}:${oauth2.connectionSlot}:connect`;\n const isPendingOAuthConnection =\n pendingOAuthConnection?.scopeId === activeOAuthTokenScopeId &&\n pendingOAuthConnection !== null &&\n pendingOAuthConnection.slot === oauth2.connectionSlot;\n const isConnected = connection !== null && connection !== undefined;\n const statusText =\n isConnecting || isPendingOAuthConnection\n ? \"Saving OAuth connection...\"\n : connectionBinding && bindingScopeId\n ? connection\n ? bindingScopeId === activeOAuthTokenScopeId\n ? `Connected in ${activeOAuthTokenScopeLabel.toLowerCase()} as ${\n connection.identityLabel ?? connection.id\n }`\n : `Using organization connection ${\n connection.identityLabel ?? connection.id\n }`\n : bindingScopeId === activeOAuthTokenScopeId\n ? `Saved connection is missing in ${activeOAuthTokenScopeLabel.toLowerCase()}`\n : \"Organization connection is missing\"\n : `No ${activeOAuthTokenScopeLabel.toLowerCase()} connection`;\n const connectDisabled = isConnecting || endpointsDirty || saving;\n const clientSecretSlot = effectiveClientSecretSlot(oauth2);\n const renderAppSecret = (input: {\n readonly slot: string;\n readonly label: string;\n readonly hint?: string;\n readonly scopeId: ScopeId;\n readonly onScopeChange: (scope: ScopeId) => void;\n }) => {\n const activeScope =\n credentialScopes.find((entry) => entry.scopeId === input.scopeId) ??\n organizationCredentialScope;\n const exactSecret = exactCredentialBindingForScope(\n bindingRows,\n input.slot,\n activeScope.scopeId,\n );\n const effectiveSecret = effectiveCredentialBindingForScope(\n bindingRows,\n input.slot,\n activeScope.scopeId,\n scopeRanks,\n );\n const exactSecretId =\n exactSecret && isSecretCredentialBindingValue(exactSecret.value)\n ? exactSecret.value.secretId\n : null;\n const inheritedSecret =\n !exactSecretId &&\n effectiveSecret &&\n effectiveSecret.scopeId !== activeScope.scopeId &&\n isSecretCredentialBindingValue(effectiveSecret.value)\n ? effectiveSecret\n : null;\n const status = exactSecretId\n ? `${activeScope.label} credential set`\n : inheritedSecret\n ? \"Using organization credential\"\n : \"Not set\";\n const inputKey = `${activeScope.scopeId}:${input.slot}`;\n const clearKey = `${activeScope.scopeId}:${input.slot}:clear`;\n\n return (\n <div className=\"space-y-1.5\">\n <FieldLabel className=\"text-[11px]\">\n {input.label}{\" \"}\n {input.hint && <span className=\"text-muted-foreground\">· {input.hint}</span>}\n </FieldLabel>\n <div className=\"grid gap-2 md:grid-cols-2\">\n <div className=\"space-y-1.5\">\n <div className=\"flex items-center gap-1.5\">\n <FieldLabel className=\"text-[11px]\">Secret</FieldLabel>\n <HelpTooltip label={`${input.label} secret`}>\n Select or create the OAuth {input.label.toLowerCase()} secret.\n </HelpTooltip>\n <span className=\"ml-auto truncate text-xs text-muted-foreground\">\n {status}\n </span>\n </div>\n <div className=\"flex items-center gap-2\">\n <div className=\"min-w-0 flex-1\">\n <CreatableSecretPicker\n value={exactSecretId}\n onSelect={(secretId, secretScopeId) =>\n void sourceBindingWriter.setSecretBinding(\n activeScope.scopeId,\n input.slot,\n secretId,\n secretScopeId ?? activeScope.scopeId,\n )\n }\n secrets={secretList}\n placeholder=\"Select or create a secret\"\n targetScope={activeScope.scopeId}\n credentialScopeOptions={credentialScopeOptions}\n suggestedId={`source-binding-${slugify(props.sourceId)}-${slugify(\n input.slot,\n )}-${slugify(activeScope.scopeId)}`}\n sourceName={source.name}\n secretLabel={input.label}\n />\n </div>\n {exactSecretId && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() =>\n void sourceBindingWriter.clearBinding(\n activeScope.scopeId,\n input.slot,\n )\n }\n disabled={sourceBindingWriter.busyKey === clearKey}\n >\n Clear\n </Button>\n )}\n {sourceBindingWriter.busyKey === inputKey && (\n <span className=\"text-xs text-muted-foreground\">Saving…</span>\n )}\n </div>\n </div>\n <CredentialScopeDropdown\n value={activeScope.scopeId}\n options={credentialScopeOptions}\n onChange={input.onScopeChange}\n label=\"Used by\"\n help={`Choose where this OAuth ${input.label.toLowerCase()} credential lives.`}\n />\n </div>\n </div>\n );\n };\n\n return (\n <>\n <CardStackEntry>\n <CardStackEntryContent>\n <CardStackEntryTitle>OAuth</CardStackEntryTitle>\n <CardStackEntryDescription>\n Configure app credentials and connect accounts for this source.\n </CardStackEntryDescription>\n </CardStackEntryContent>\n </CardStackEntry>\n <CardStackEntryField label=\"OAuth app credentials\">\n <div className=\"space-y-4 rounded-lg border border-border/60 bg-muted/10 p-3\">\n {renderAppSecret({\n slot: oauth2.clientIdSlot,\n label: \"Client ID\",\n scopeId: ScopeId.make(selectedOAuthClientIdScope),\n onScopeChange: setSelectedOAuthClientIdScope,\n })}\n {renderAppSecret({\n slot: clientSecretSlot,\n label: \"Client secret\",\n hint:\n oauth2.flow === \"authorizationCode\"\n ? \"Optional for public clients with PKCE\"\n : undefined,\n scopeId: ScopeId.make(selectedOAuthClientSecretScope),\n onScopeChange: setSelectedOAuthClientSecretScope,\n })}\n </div>\n </CardStackEntryField>\n <CardStackEntryField label=\"Account connection\">\n <CredentialUsageRow\n value={activeOAuthTokenScopeId}\n options={credentialScopeOptions}\n onChange={setSelectedOAuthTokenScope}\n label=\"Connection saved to\"\n help=\"Choose where the signed-in OAuth token is saved.\"\n >\n <CredentialControlField\n label=\"OAuth connection\"\n help=\"Start the provider OAuth flow.\"\n >\n <div className=\"flex min-h-9 items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-2\">\n <span className=\"min-w-0 flex-1 truncate text-xs text-muted-foreground\">\n {statusText}\n </span>\n <Button\n size=\"sm\"\n onClick={() => void connectOAuth(activeOAuthTokenScopeId)}\n disabled={connectDisabled}\n >\n {isConnecting ? \"Connecting…\" : isConnected ? \"Reconnect\" : \"Connect\"}\n </Button>\n </div>\n {endpointsDirty && (\n <p className=\"text-xs text-muted-foreground\">\n Save endpoint changes before reconnecting.\n </p>\n )}\n </CredentialControlField>\n </CredentialUsageRow>\n </CardStackEntryField>\n <CardStackEntry>\n <CardStackEntryContent>\n <CardStackEntryTitle>Advanced endpoints</CardStackEntryTitle>\n <CardStackEntryDescription>\n Override provider URLs only when the OpenAPI spec is wrong.\n </CardStackEntryDescription>\n </CardStackEntryContent>\n <div className=\"flex items-center gap-2\">\n {oauth2EndpointsSaveState !== \"idle\" && (\n <span className=\"text-xs text-muted-foreground\">\n {saving ? \"Saving…\" : \"Saved\"}\n </span>\n )}\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setOAuthEndpointsOpen((open) => !open)}\n >\n {oauthEndpointsOpen ? \"Hide\" : endpointsDirty ? \"Review\" : \"Show\"}\n </Button>\n </div>\n </CardStackEntry>\n {oauthEndpointsOpen && (\n <>\n {isAuthCode && (\n <CardStackEntryField label=\"Authorization URL\">\n <Input\n value={oauth2AuthorizationUrl}\n onChange={(e) =>\n setOAuth2AuthorizationUrl((e.target as HTMLInputElement).value)\n }\n className=\"font-mono text-sm\"\n />\n </CardStackEntryField>\n )}\n <CardStackEntryField label=\"Token URL\">\n <Input\n value={oauth2TokenUrl}\n onChange={(e) => setOAuth2TokenUrl((e.target as HTMLInputElement).value)}\n className=\"font-mono text-sm\"\n />\n </CardStackEntryField>\n <CardStackEntryField label=\"Redirect URL\">\n <div className=\"space-y-1.5\">\n <div className=\"flex items-center gap-1 rounded-md border border-border bg-background/50 px-2.5 py-1.5 font-mono text-[11px]\">\n <span className=\"truncate flex-1 text-foreground\">\n {oauth2RedirectUrl}\n </span>\n <CopyButton value={oauth2RedirectUrl} />\n </div>\n <p className=\"text-xs text-muted-foreground\">\n Add this to your OAuth app's allowed redirects.\n </p>\n </div>\n </CardStackEntryField>\n <CardStackEntry>\n <CardStackEntryContent>\n <CardStackEntryDescription>\n Save endpoint changes before reconnecting.\n </CardStackEntryDescription>\n </CardStackEntryContent>\n <Button\n size=\"sm\"\n onClick={() => void saveOAuth2Endpoints()}\n disabled={!canSave}\n >\n Save endpoints\n </Button>\n </CardStackEntry>\n </>\n )}\n </>\n );\n })()}\n </CardStackContent>\n </CardStack>\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-start border-t border-border pt-4\">\n <Button variant=\"ghost\" onClick={props.onSave}>\n Back\n </Button>\n </div>\n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1
|
-
import {
|
|
2
|
-
openApiSourceAtom,
|
|
3
|
-
openApiSourceBindingsAtom
|
|
4
|
-
} from "./chunk-X5JX3KTA.js";
|
|
5
|
-
import {
|
|
6
|
-
oauth2ClientSecretSlot
|
|
7
|
-
} from "./chunk-AN4HJFNP.js";
|
|
8
|
-
|
|
9
|
-
// src/react/OpenApiSourceSummary.tsx
|
|
10
|
-
import { useAtomValue } from "@effect/atom-react";
|
|
11
|
-
import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
|
|
12
|
-
import { connectionsAtom, sourceAtom } from "@executor-js/react/api/atoms";
|
|
13
|
-
import { Badge } from "@executor-js/react/components/badge";
|
|
14
|
-
import { useScope, useScopeStack, useUserScope } from "@executor-js/react/api/scope-context";
|
|
15
|
-
import { ScopeId } from "@executor-js/sdk/shared";
|
|
16
|
-
import {
|
|
17
|
-
SourceCredentialNotice,
|
|
18
|
-
SourceCredentialStatusBadge,
|
|
19
|
-
missingSourceCredentialLabels
|
|
20
|
-
} from "@executor-js/react/plugins/source-credential-status";
|
|
21
|
-
|
|
22
|
-
// src/sdk/credential-status.ts
|
|
23
|
-
var scopeRank = (ranks, scopeId) => ranks.get(scopeId) ?? Number.MAX_SAFE_INTEGER;
|
|
24
|
-
var effectiveBindingForScope = (rows, slot, targetScope, ranks) => rows.filter(
|
|
25
|
-
(row) => row.slot === slot && scopeRank(ranks, row.scopeId) >= scopeRank(ranks, targetScope)
|
|
26
|
-
).sort((a, b) => scopeRank(ranks, a.scopeId) - scopeRank(ranks, b.scopeId))[0] ?? null;
|
|
27
|
-
|
|
28
|
-
// src/react/OpenApiSourceSummary.tsx
|
|
29
|
-
import { jsx } from "react/jsx-runtime";
|
|
30
|
-
function OAuthBadge() {
|
|
31
|
-
return /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: "OAuth" });
|
|
32
|
-
}
|
|
33
|
-
function CheckingCredentialsBadge() {
|
|
34
|
-
return /* @__PURE__ */ jsx(
|
|
35
|
-
Badge,
|
|
36
|
-
{
|
|
37
|
-
variant: "outline",
|
|
38
|
-
className: "border-border bg-muted/50 text-[10px] text-muted-foreground",
|
|
39
|
-
children: "Checking credentials"
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
var effectiveClientSecretSlot = (oauth2) => oauth2.clientSecretSlot ?? oauth2ClientSecretSlot(oauth2.securitySchemeName);
|
|
44
|
-
var sourceCredentialSlots = (source) => {
|
|
45
|
-
const slots = [];
|
|
46
|
-
for (const [name, value] of Object.entries(source.config.headers ?? {})) {
|
|
47
|
-
if (typeof value !== "string") slots.push({ kind: "secret", slot: value.slot, label: name });
|
|
48
|
-
}
|
|
49
|
-
for (const [name, value] of Object.entries(source.config.queryParams ?? {})) {
|
|
50
|
-
if (typeof value !== "string") slots.push({ kind: "secret", slot: value.slot, label: name });
|
|
51
|
-
}
|
|
52
|
-
const oauth2 = source.config.oauth2;
|
|
53
|
-
if (oauth2) {
|
|
54
|
-
slots.push({ kind: "secret", slot: oauth2.clientIdSlot, label: "Client ID" });
|
|
55
|
-
slots.push({
|
|
56
|
-
kind: "secret",
|
|
57
|
-
slot: effectiveClientSecretSlot(oauth2),
|
|
58
|
-
label: "Client Secret"
|
|
59
|
-
});
|
|
60
|
-
slots.push({
|
|
61
|
-
kind: "connection",
|
|
62
|
-
slot: oauth2.connectionSlot,
|
|
63
|
-
label: oauth2.flow === "clientCredentials" ? "OAuth client connection" : "OAuth sign-in"
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return slots;
|
|
67
|
-
};
|
|
68
|
-
function OpenApiSourceSummary(props) {
|
|
69
|
-
const displayScope = useScope();
|
|
70
|
-
const userScope = useUserScope();
|
|
71
|
-
const scopeStack = useScopeStack();
|
|
72
|
-
const summaryResult = useAtomValue(sourceAtom(props.sourceId, displayScope));
|
|
73
|
-
const sourceScopeId = AsyncResult.isSuccess(summaryResult) && summaryResult.value?.scopeId ? summaryResult.value.scopeId : displayScope;
|
|
74
|
-
const sourceResult = useAtomValue(openApiSourceAtom(ScopeId.make(sourceScopeId), props.sourceId));
|
|
75
|
-
const bindingsResult = useAtomValue(
|
|
76
|
-
openApiSourceBindingsAtom(displayScope, props.sourceId, ScopeId.make(sourceScopeId))
|
|
77
|
-
);
|
|
78
|
-
const connectionsResult = useAtomValue(connectionsAtom(displayScope));
|
|
79
|
-
const source = AsyncResult.isSuccess(sourceResult) && sourceResult.value ? sourceResult.value : null;
|
|
80
|
-
if (!source) return null;
|
|
81
|
-
const oauth2 = source.config.oauth2;
|
|
82
|
-
const bindingsLoaded = AsyncResult.isSuccess(bindingsResult);
|
|
83
|
-
const connectionsLoaded = AsyncResult.isSuccess(connectionsResult);
|
|
84
|
-
if (!bindingsLoaded) {
|
|
85
|
-
return props.variant === "panel" ? null : /* @__PURE__ */ jsx(CheckingCredentialsBadge, {});
|
|
86
|
-
}
|
|
87
|
-
const bindings = AsyncResult.isSuccess(bindingsResult) ? bindingsResult.value : [];
|
|
88
|
-
if (oauth2 && !connectionsLoaded) {
|
|
89
|
-
return props.variant === "panel" ? null : /* @__PURE__ */ jsx(CheckingCredentialsBadge, {});
|
|
90
|
-
}
|
|
91
|
-
const connections = AsyncResult.isSuccess(connectionsResult) ? connectionsResult.value : [];
|
|
92
|
-
const liveConnectionIds = new Set(connections.map((connection) => connection.id));
|
|
93
|
-
const scopeRanks = new Map(scopeStack.map((scope, index) => [scope.id, index]));
|
|
94
|
-
const credentialTargetScope = userScope;
|
|
95
|
-
const missing = missingSourceCredentialLabels({
|
|
96
|
-
slots: sourceCredentialSlots(source),
|
|
97
|
-
bindings,
|
|
98
|
-
targetScope: credentialTargetScope,
|
|
99
|
-
scopeRanks,
|
|
100
|
-
liveConnectionIds
|
|
101
|
-
});
|
|
102
|
-
if (props.variant === "panel") {
|
|
103
|
-
return /* @__PURE__ */ jsx(SourceCredentialNotice, { missing, onAction: props.onAction });
|
|
104
|
-
}
|
|
105
|
-
if (missing.length > 0) return /* @__PURE__ */ jsx(SourceCredentialStatusBadge, { missing });
|
|
106
|
-
if (!oauth2) return null;
|
|
107
|
-
const connectionBinding = effectiveBindingForScope(
|
|
108
|
-
bindings,
|
|
109
|
-
oauth2.connectionSlot,
|
|
110
|
-
credentialTargetScope,
|
|
111
|
-
scopeRanks
|
|
112
|
-
);
|
|
113
|
-
const connectionId = connectionBinding && connectionBinding.value.kind === "connection" ? connectionBinding.value.connectionId : null;
|
|
114
|
-
if (connectionId && connections.some((connection) => connection.id === connectionId)) {
|
|
115
|
-
return /* @__PURE__ */ jsx(SourceCredentialStatusBadge, { missing: [] });
|
|
116
|
-
}
|
|
117
|
-
return /* @__PURE__ */ jsx(OAuthBadge, {});
|
|
118
|
-
}
|
|
119
|
-
export {
|
|
120
|
-
OpenApiSourceSummary as default
|
|
121
|
-
};
|
|
122
|
-
//# sourceMappingURL=OpenApiSourceSummary-7JBS7PUV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/OpenApiSourceSummary.tsx","../src/sdk/credential-status.ts"],"sourcesContent":["import { useAtomValue } from \"@effect/atom-react\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\n\nimport { connectionsAtom, sourceAtom } from \"@executor-js/react/api/atoms\";\nimport { Badge } from \"@executor-js/react/components/badge\";\nimport { useScope, useScopeStack, useUserScope } from \"@executor-js/react/api/scope-context\";\nimport { ScopeId } from \"@executor-js/sdk/shared\";\nimport {\n SourceCredentialNotice,\n SourceCredentialStatusBadge,\n missingSourceCredentialLabels,\n type SourceCredentialSlot,\n} from \"@executor-js/react/plugins/source-credential-status\";\n\nimport { openApiSourceAtom, openApiSourceBindingsAtom } from \"./atoms\";\nimport { effectiveBindingForScope } from \"../sdk/credential-status\";\nimport { oauth2ClientSecretSlot, type StoredSourceSchemaType } from \"../sdk/source-contracts\";\n\nfunction OAuthBadge() {\n return <Badge variant=\"secondary\">OAuth</Badge>;\n}\n\nfunction CheckingCredentialsBadge() {\n return (\n <Badge\n variant=\"outline\"\n className=\"border-border bg-muted/50 text-[10px] text-muted-foreground\"\n >\n Checking credentials\n </Badge>\n );\n}\n\nconst effectiveClientSecretSlot = (oauth2: {\n readonly securitySchemeName: string;\n readonly clientSecretSlot: string | null;\n}): string => oauth2.clientSecretSlot ?? oauth2ClientSecretSlot(oauth2.securitySchemeName);\n\nconst sourceCredentialSlots = (source: StoredSourceSchemaType): readonly SourceCredentialSlot[] => {\n const slots: SourceCredentialSlot[] = [];\n for (const [name, value] of Object.entries(source.config.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.config.queryParams ?? {})) {\n if (typeof value !== \"string\") slots.push({ kind: \"secret\", slot: value.slot, label: name });\n }\n const oauth2 = source.config.oauth2;\n if (oauth2) {\n slots.push({ kind: \"secret\", slot: oauth2.clientIdSlot, label: \"Client ID\" });\n slots.push({\n kind: \"secret\",\n slot: effectiveClientSecretSlot(oauth2),\n label: \"Client Secret\",\n });\n slots.push({\n kind: \"connection\",\n slot: oauth2.connectionSlot,\n label: oauth2.flow === \"clientCredentials\" ? \"OAuth client connection\" : \"OAuth sign-in\",\n });\n }\n return slots;\n};\n\n// The entry row already renders name + id + kind, so this summary\n// component only contributes extras — specifically, an OAuth status\n// badge when the source has OAuth2 configured. Non-OAuth sources\n// render nothing.\nexport default function OpenApiSourceSummary(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 summaryResult = useAtomValue(sourceAtom(props.sourceId, displayScope));\n const sourceScopeId =\n AsyncResult.isSuccess(summaryResult) && summaryResult.value?.scopeId\n ? summaryResult.value.scopeId\n : displayScope;\n const sourceResult = useAtomValue(openApiSourceAtom(ScopeId.make(sourceScopeId), props.sourceId));\n const bindingsResult = useAtomValue(\n openApiSourceBindingsAtom(displayScope, props.sourceId, ScopeId.make(sourceScopeId)),\n );\n const connectionsResult = useAtomValue(connectionsAtom(displayScope));\n\n const source =\n AsyncResult.isSuccess(sourceResult) && sourceResult.value ? sourceResult.value : null;\n\n if (!source) return null;\n const oauth2 = source.config.oauth2;\n const bindingsLoaded = AsyncResult.isSuccess(bindingsResult);\n const connectionsLoaded = AsyncResult.isSuccess(connectionsResult);\n if (!bindingsLoaded) {\n return props.variant === \"panel\" ? null : <CheckingCredentialsBadge />;\n }\n\n const bindings = AsyncResult.isSuccess(bindingsResult) ? bindingsResult.value : [];\n if (oauth2 && !connectionsLoaded) {\n return props.variant === \"panel\" ? null : <CheckingCredentialsBadge />;\n }\n const connections = AsyncResult.isSuccess(connectionsResult) ? connectionsResult.value : [];\n const liveConnectionIds = new Set(connections.map((connection) => connection.id));\n const scopeRanks = new Map(scopeStack.map((scope, index) => [scope.id, index] as const));\n const credentialTargetScope = userScope;\n const missing = missingSourceCredentialLabels({\n slots: sourceCredentialSlots(source),\n bindings,\n targetScope: credentialTargetScope,\n scopeRanks,\n liveConnectionIds,\n });\n\n if (props.variant === \"panel\") {\n return <SourceCredentialNotice missing={missing} onAction={props.onAction} />;\n }\n\n if (missing.length > 0) return <SourceCredentialStatusBadge missing={missing} />;\n\n if (!oauth2) return null;\n const connectionBinding = effectiveBindingForScope(\n bindings,\n oauth2.connectionSlot,\n credentialTargetScope,\n scopeRanks,\n );\n const connectionId =\n connectionBinding && connectionBinding.value.kind === \"connection\"\n ? connectionBinding.value.connectionId\n : null;\n\n if (connectionId && connections.some((connection) => connection.id === connectionId)) {\n return <SourceCredentialStatusBadge missing={[]} />;\n }\n\n return <OAuthBadge />;\n}\n","import type { ConnectionId, CredentialBindingValue, ScopeId } from \"@executor-js/sdk/shared\";\n\nimport { oauth2ClientSecretSlot } from \"./source-contracts\";\nimport type { ConfiguredHeaderValue } from \"./types\";\n\nexport type BindingRowForCredentialStatus = {\n readonly slot: string;\n readonly scopeId: ScopeId;\n readonly value: CredentialBindingValue;\n};\n\nexport type SourceForCredentialStatus = {\n readonly config: {\n readonly headers?: Record<string, ConfiguredHeaderValue>;\n readonly oauth2?: {\n readonly securitySchemeName: string;\n readonly flow: \"authorizationCode\" | \"clientCredentials\";\n readonly clientIdSlot: string;\n readonly clientSecretSlot: string | null;\n readonly connectionSlot: string;\n };\n };\n};\n\nconst scopeRank = (ranks: ReadonlyMap<string, number>, scopeId: ScopeId): number =>\n ranks.get(scopeId) ?? Number.MAX_SAFE_INTEGER;\n\nexport const effectiveBindingForScope = (\n rows: readonly BindingRowForCredentialStatus[],\n slot: string,\n targetScope: ScopeId,\n ranks: ReadonlyMap<string, number>,\n): BindingRowForCredentialStatus | null =>\n rows\n .filter(\n (row) => row.slot === slot && scopeRank(ranks, row.scopeId) >= scopeRank(ranks, targetScope),\n )\n .sort((a, b) => scopeRank(ranks, a.scopeId) - scopeRank(ranks, b.scopeId))[0] ?? null;\n\nconst hasSecretBinding = (\n rows: readonly BindingRowForCredentialStatus[],\n slot: string,\n targetScope: ScopeId,\n ranks: ReadonlyMap<string, number>,\n) => effectiveBindingForScope(rows, slot, targetScope, ranks)?.value.kind === \"secret\";\n\nconst hasConnectionBinding = (\n rows: readonly BindingRowForCredentialStatus[],\n slot: string,\n targetScope: ScopeId,\n ranks: ReadonlyMap<string, number>,\n liveConnectionIds?: ReadonlySet<string>,\n) => {\n const binding = effectiveBindingForScope(rows, slot, targetScope, ranks);\n if (binding?.value.kind !== \"connection\") return false;\n return liveConnectionIds ? liveConnectionIds.has(binding.value.connectionId) : true;\n};\n\nconst effectiveClientSecretSlot = (oauth2: {\n readonly securitySchemeName: string;\n readonly clientSecretSlot: string | null;\n}): string => oauth2.clientSecretSlot ?? oauth2ClientSecretSlot(oauth2.securitySchemeName);\n\nexport function missingCredentialLabels(\n source: SourceForCredentialStatus,\n bindings: readonly BindingRowForCredentialStatus[],\n targetScope: ScopeId,\n ranks: ReadonlyMap<string, number>,\n options?: {\n readonly liveConnectionIds?: ReadonlySet<string> | readonly ConnectionId[];\n },\n): string[] {\n const missing: string[] = [];\n const rawLiveConnectionIds = options?.liveConnectionIds;\n const liveConnectionIds = rawLiveConnectionIds\n ? rawLiveConnectionIds instanceof Set\n ? rawLiveConnectionIds\n : new Set(rawLiveConnectionIds)\n : undefined;\n\n for (const [headerName, value] of Object.entries(source.config.headers ?? {})) {\n if (typeof value === \"string\") continue;\n if (!hasSecretBinding(bindings, value.slot, targetScope, ranks)) {\n missing.push(headerName);\n }\n }\n\n const oauth2 = source.config.oauth2;\n if (!oauth2) return missing;\n\n if (!hasSecretBinding(bindings, oauth2.clientIdSlot, targetScope, ranks)) {\n missing.push(\"Client ID\");\n }\n\n const clientSecretSlot = effectiveClientSecretSlot(oauth2);\n if (!hasSecretBinding(bindings, clientSecretSlot, targetScope, ranks)) {\n missing.push(\"Client Secret\");\n }\n\n if (\n !hasConnectionBinding(bindings, oauth2.connectionSlot, targetScope, ranks, liveConnectionIds)\n ) {\n missing.push(oauth2.flow === \"clientCredentials\" ? \"OAuth client connection\" : \"OAuth sign-in\");\n }\n\n return missing;\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,oBAAoB;AAC7B,YAAY,iBAAiB;AAE7B,SAAS,iBAAiB,kBAAkB;AAC5C,SAAS,aAAa;AACtB,SAAS,UAAU,eAAe,oBAAoB;AACtD,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;;;ACYP,IAAM,YAAY,CAAC,OAAoC,YACrD,MAAM,IAAI,OAAO,KAAK,OAAO;AAExB,IAAM,2BAA2B,CACtC,MACA,MACA,aACA,UAEA,KACG;AAAA,EACC,CAAC,QAAQ,IAAI,SAAS,QAAQ,UAAU,OAAO,IAAI,OAAO,KAAK,UAAU,OAAO,WAAW;AAC7F,EACC,KAAK,CAAC,GAAG,MAAM,UAAU,OAAO,EAAE,OAAO,IAAI,UAAU,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK;;;ADlB5E;AADT,SAAS,aAAa;AACpB,SAAO,oBAAC,SAAM,SAAQ,aA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