@executor-js/plugin-openapi 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 (45) hide show
  1. package/dist/{AddOpenApiSource-FLMNI742.js → AddOpenApiSource-KSOMPQ2R.js} +4 -4
  2. package/dist/{EditOpenApiSource-I4NIGIIJ.js → EditOpenApiSource-AOA7APR2.js} +301 -192
  3. package/dist/EditOpenApiSource-AOA7APR2.js.map +1 -0
  4. package/dist/{OpenApiSourceSummary-CM46DB4L.js → OpenApiSourceSummary-Y3S6ZBOZ.js} +4 -4
  5. package/dist/OpenApiSourceSummary-Y3S6ZBOZ.js.map +1 -0
  6. package/dist/api/group.d.ts +124 -118
  7. package/dist/api/index.d.ts +148 -369
  8. package/dist/chunk-BB5IAKRG.js +136 -0
  9. package/dist/chunk-BB5IAKRG.js.map +1 -0
  10. package/dist/{chunk-E7PZ2QGD.js → chunk-EOXXE5DG.js} +17 -455
  11. package/dist/chunk-EOXXE5DG.js.map +1 -0
  12. package/dist/{chunk-OZ67JNID.js → chunk-NIKLYJ3X.js} +830 -319
  13. package/dist/chunk-NIKLYJ3X.js.map +1 -0
  14. package/dist/{chunk-TGDT6QCH.js → chunk-YJMXYKYX.js} +178 -117
  15. package/dist/chunk-YJMXYKYX.js.map +1 -0
  16. package/dist/{chunk-GFQUEZUW.js → chunk-ZZBTLFTA.js} +78 -93
  17. package/dist/chunk-ZZBTLFTA.js.map +1 -0
  18. package/dist/client.js +7 -137
  19. package/dist/client.js.map +1 -1
  20. package/dist/core.js +5 -10
  21. package/dist/index.js +3 -2
  22. package/dist/react/atoms.d.ts +83 -223
  23. package/dist/react/client.d.ts +123 -117
  24. package/dist/sdk/credential-status.d.ts +3 -3
  25. package/dist/sdk/extract.d.ts +19 -19
  26. package/dist/sdk/index.d.ts +2 -2
  27. package/dist/sdk/invoke.d.ts +7 -7
  28. package/dist/sdk/parse.d.ts +2 -3
  29. package/dist/sdk/plugin.d.ts +181 -275
  30. package/dist/sdk/preview.d.ts +12 -12
  31. package/dist/sdk/source-contracts.d.ts +55 -0
  32. package/dist/sdk/store.d.ts +6 -269
  33. package/dist/sdk/types.d.ts +16 -65
  34. package/dist/testing/index.d.ts +149 -11
  35. package/dist/testing.js +419 -33
  36. package/dist/testing.js.map +1 -1
  37. package/dist/testing.test.d.ts +1 -0
  38. package/package.json +3 -4
  39. package/dist/EditOpenApiSource-I4NIGIIJ.js.map +0 -1
  40. package/dist/OpenApiSourceSummary-CM46DB4L.js.map +0 -1
  41. package/dist/chunk-E7PZ2QGD.js.map +0 -1
  42. package/dist/chunk-GFQUEZUW.js.map +0 -1
  43. package/dist/chunk-OZ67JNID.js.map +0 -1
  44. package/dist/chunk-TGDT6QCH.js.map +0 -1
  45. /package/dist/{AddOpenApiSource-FLMNI742.js.map → AddOpenApiSource-KSOMPQ2R.js.map} +0 -0
@@ -0,0 +1 @@
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&apos;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 </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,WAAW,SAAS,QAAQ,gBAAgB;AACrD,SAAS,YAAY,oBAAoB;AACzC,YAAY,UAAU;AACtB,YAAY,YAAY;AACxB,YAAY,YAAY;AACxB,YAAY,iBAAiB;AAE7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU,oBAAoB;AACvC,SAAS,qBAAqB,uBAAuB;AACrD,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,mBAAmB,wBAAwB;AACpD;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AACP,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oCAAoC;AAC7C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AA6RhC,SAkPM,UAjPJ,KADF;AAhRN,IAAM,eAAsB,cAAO,EAAE,SAAgB,cAAO,CAAC;AAC7D,IAAM,qBAA4B,2BAAoB,YAAY;AAElE,IAAM,uBAAuB,CAAC,M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A,OACP,GACF;AAAA,IAEC,SACC,oBAAC,SAAI,WAAU,sEACb,8BAAC,OAAE,WAAU,4BAA4B,iBAAM,GACjD;AAAA,IAGF,oBAAC,SAAI,WAAU,+DACb,8BAAC,UAAO,SAAQ,SAAQ,SAAS,MAAM,QAAQ,kBAE/C,GACF;AAAA,KACF;AAEJ;","names":["startOAuthExit","response"]}
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  openApiSourceAtom,
3
3
  openApiSourceBindingsAtom
4
- } from "./chunk-GFQUEZUW.js";
4
+ } from "./chunk-ZZBTLFTA.js";
5
5
  import {
6
6
  oauth2ClientSecretSlot
7
- } from "./chunk-E7PZ2QGD.js";
7
+ } from "./chunk-EOXXE5DG.js";
8
8
 
9
9
  // src/react/OpenApiSourceSummary.tsx
10
10
  import { useAtomValue } from "@effect/atom-react";
@@ -12,7 +12,7 @@ import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
12
12
  import { connectionsAtom, sourceAtom } from "@executor-js/react/api/atoms";
13
13
  import { Badge } from "@executor-js/react/components/badge";
14
14
  import { useScope, useScopeStack, useUserScope } from "@executor-js/react/api/scope-context";
15
- import { ScopeId } from "@executor-js/sdk/core";
15
+ import { ScopeId } from "@executor-js/sdk/shared";
16
16
  import {
17
17
  SourceCredentialNotice,
18
18
  SourceCredentialStatusBadge,
@@ -119,4 +119,4 @@ function OpenApiSourceSummary(props) {
119
119
  export {
120
120
  OpenApiSourceSummary as default
121
121
  };
122
- //# sourceMappingURL=OpenApiSourceSummary-CM46DB4L.js.map
122
+ //# sourceMappingURL=OpenApiSourceSummary-Y3S6ZBOZ.js.map
@@ -0,0 +1 @@
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,SAA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I,YAAY,IAAI,CAAC,eAAe,WAAW,EAAE,CAAC;AAChF,QAAM,aAAa,IAAI,IAAI,WAAW,IAAI,CAAC,OAAO,UAAU,CAAC,MAAM,IAAI,KAAK,CAAU,CAAC;AACvF,QAAM,wBAAwB;AAC9B,QAAM,UAAU,8BAA8B;AAAA,IAC5C,OAAO,sBAAsB,MAAM;AAAA,IACnC;AAAA,IACA,aAAa;AAAA,IACb;AAAA,IACA;AAAA,EACF,CAAC;AAED,MAAI,MAAM,YAAY,SAAS;AAC7B,WAAO,oBAAC,0BAAuB,SAAkB,UAAU,MAAM,UAAU;AAAA,EAC7E;AAEA,MAAI,QAAQ,SAAS,EAAG,QAAO,oBAAC,+BAA4B,SAAkB;AAE9E,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,oBAAoB;AAAA,IACxB;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,EACF;AACA,QAAM,eACJ,qBAAqB,kBAAkB,MAAM,SAAS,eAClD,kBAAkB,MAAM,eACxB;AAEN,MAAI,gBAAgB,YAAY,KAAK,CAAC,eAAe,WAAW,OAAO,YAAY,GAAG;AACpF,WAAO,oBAAC,+BAA4B,SAAS,CAAC,GAAG;AAAA,EACnD;AAEA,SAAO,oBAAC,cAAW;AACrB;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
2
2
  import { Schema } from "effect";
3
- import { InternalError } from "@executor-js/sdk/core";
3
+ import { InternalError } from "@executor-js/sdk/shared";
4
4
  import { OpenApiParseError, OpenApiExtractionError, OpenApiOAuthError } from "../sdk/errors";
5
5
  export declare const OpenApiGroup: HttpApiGroup.HttpApiGroup<"openapi", HttpApiEndpoint.HttpApiEndpoint<"previewSpec", "POST", "/scopes/:scopeId/openapi/preview", HttpApiEndpoint.StringTree<Schema.Struct<{
6
6
  scopeId: Schema.brand<Schema.String, "ScopeId">;
@@ -81,54 +81,40 @@ export declare const OpenApiGroup: HttpApiGroup.HttpApiGroup<"openapi", HttpApiE
81
81
  }>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"addSpec", "POST", "/scopes/:scopeId/openapi/specs", HttpApiEndpoint.StringTree<Schema.Struct<{
82
82
  scopeId: Schema.brand<Schema.String, "ScopeId">;
83
83
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
84
- readonly targetScope: Schema.brand<Schema.String, "ScopeId">;
85
- readonly credentialTargetScope: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
86
- readonly spec: Schema.String;
84
+ readonly spec: Schema.Union<readonly [Schema.Struct<{
85
+ readonly kind: Schema.Literal<"url">;
86
+ readonly url: Schema.String;
87
+ }>, Schema.Struct<{
88
+ readonly kind: Schema.Literal<"blob">;
89
+ readonly value: Schema.String;
90
+ }>]>;
87
91
  readonly specFetchCredentials: Schema.optional<Schema.Struct<{
88
92
  readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
89
- readonly secretId: Schema.String;
93
+ readonly kind: Schema.Literal<"secret">;
90
94
  readonly prefix: Schema.optional<Schema.String>;
91
95
  }>]>>>;
92
96
  readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
93
- readonly secretId: Schema.String;
97
+ readonly kind: Schema.Literal<"secret">;
94
98
  readonly prefix: Schema.optional<Schema.String>;
95
99
  }>]>>>;
96
100
  }>>;
97
- readonly name: Schema.optional<Schema.String>;
98
- readonly baseUrl: Schema.optional<Schema.String>;
99
- readonly namespace: Schema.optional<Schema.String>;
100
- readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
101
- readonly secretId: Schema.String;
102
- readonly prefix: Schema.optional<Schema.String>;
103
- readonly targetScope: Schema.brand<Schema.String, "ScopeId">;
104
- readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
105
- }>, Schema.Union<readonly [Schema.String, Schema.Struct<{
106
- readonly secretId: Schema.String;
107
- readonly prefix: Schema.optional<Schema.String>;
108
- }>]>, Schema.Union<readonly [Schema.String, Schema.Struct<{
109
- readonly kind: Schema.Literal<"binding">;
110
- readonly slot: Schema.String;
111
- readonly prefix: Schema.optional<Schema.String>;
112
- }>]>]>>>;
113
- readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
114
- readonly secretId: Schema.String;
115
- readonly prefix: Schema.optional<Schema.String>;
116
- readonly targetScope: Schema.brand<Schema.String, "ScopeId">;
117
- readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
118
- }>, Schema.Union<readonly [Schema.String, Schema.Struct<{
119
- readonly secretId: Schema.String;
101
+ readonly name: Schema.String;
102
+ readonly baseUrl: Schema.String;
103
+ readonly namespace: Schema.String;
104
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
105
+ readonly kind: Schema.Literal<"secret">;
120
106
  readonly prefix: Schema.optional<Schema.String>;
121
- }>]>, Schema.Union<readonly [Schema.String, Schema.Struct<{
122
- readonly kind: Schema.Literal<"binding">;
123
- readonly slot: Schema.String;
107
+ }>]>>>;
108
+ readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
109
+ readonly kind: Schema.Literal<"secret">;
124
110
  readonly prefix: Schema.optional<Schema.String>;
125
- }>]>]>>>;
111
+ }>]>>>;
126
112
  readonly oauth2: Schema.optional<Schema.Struct<{
127
113
  readonly kind: Schema.Literal<"oauth2">;
128
114
  readonly securitySchemeName: Schema.String;
129
115
  readonly flow: Schema.Literals<readonly ["authorizationCode", "clientCredentials"]>;
130
116
  readonly tokenUrl: Schema.String;
131
- readonly authorizationUrl: Schema.NullOr<Schema.String>;
117
+ readonly authorizationUrl: Schema.withDecodingDefault<Schema.optional<Schema.NullOr<Schema.String>>>;
132
118
  readonly issuerUrl: Schema.optional<Schema.NullOr<Schema.String>>;
133
119
  readonly clientIdSlot: Schema.String;
134
120
  readonly clientSecretSlot: Schema.NullOr<Schema.String>;
@@ -146,7 +132,7 @@ export declare const OpenApiGroup: HttpApiGroup.HttpApiGroup<"openapi", HttpApiE
146
132
  readonly scope: Schema.String;
147
133
  readonly name: Schema.String;
148
134
  readonly config: Schema.Struct<{
149
- readonly spec: Schema.String;
135
+ readonly spec: Schema.optional<Schema.String>;
150
136
  readonly sourceUrl: Schema.optional<Schema.String>;
151
137
  readonly baseUrl: Schema.optional<Schema.String>;
152
138
  readonly namespace: Schema.optional<Schema.String>;
@@ -177,7 +163,7 @@ export declare const OpenApiGroup: HttpApiGroup.HttpApiGroup<"openapi", HttpApiE
177
163
  readonly securitySchemeName: Schema.String;
178
164
  readonly flow: Schema.Literals<readonly ["authorizationCode", "clientCredentials"]>;
179
165
  readonly tokenUrl: Schema.String;
180
- readonly authorizationUrl: Schema.NullOr<Schema.String>;
166
+ readonly authorizationUrl: Schema.withDecodingDefault<Schema.optional<Schema.NullOr<Schema.String>>>;
181
167
  readonly issuerUrl: Schema.optional<Schema.NullOr<Schema.String>>;
182
168
  readonly clientIdSlot: Schema.String;
183
169
  readonly clientSecretSlot: Schema.NullOr<Schema.String>;
@@ -185,119 +171,139 @@ export declare const OpenApiGroup: HttpApiGroup.HttpApiGroup<"openapi", HttpApiE
185
171
  readonly scopes: Schema.$Array<Schema.String>;
186
172
  }>>;
187
173
  }>;
188
- }>>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"updateSource", "PATCH", "/scopes/:scopeId/openapi/sources/:namespace", HttpApiEndpoint.StringTree<Schema.Struct<{
174
+ }>>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"configure", "POST", "/scopes/:scopeId/openapi/configure", HttpApiEndpoint.StringTree<Schema.Struct<{
189
175
  scopeId: Schema.brand<Schema.String, "ScopeId">;
190
- namespace: Schema.String;
191
176
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
192
- readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
193
- readonly name: Schema.optional<Schema.String>;
194
- readonly baseUrl: Schema.optional<Schema.String>;
195
- readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
196
- readonly secretId: Schema.String;
177
+ readonly source: Schema.Struct<{
178
+ readonly id: Schema.String;
179
+ readonly scope: Schema.brand<Schema.String, "ScopeId">;
180
+ }>;
181
+ readonly scope: Schema.brand<Schema.String, "ScopeId">;
182
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
183
+ readonly kind: Schema.Literal<"text">;
184
+ readonly text: Schema.String;
197
185
  readonly prefix: Schema.optional<Schema.String>;
198
- readonly targetScope: Schema.brand<Schema.String, "ScopeId">;
199
- readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
200
- }>, Schema.Union<readonly [Schema.String, Schema.Struct<{
186
+ }>, Schema.Struct<{
187
+ readonly kind: Schema.Literal<"secret">;
201
188
  readonly secretId: Schema.String;
189
+ readonly secretScope: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
202
190
  readonly prefix: Schema.optional<Schema.String>;
203
- }>]>, Schema.Union<readonly [Schema.String, Schema.Struct<{
204
- readonly kind: Schema.Literal<"binding">;
205
- readonly slot: Schema.String;
206
- readonly prefix: Schema.optional<Schema.String>;
207
- }>]>]>>>;
208
- readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
209
- readonly secretId: Schema.String;
191
+ }>, Schema.Struct<{
192
+ readonly kind: Schema.Literal<"connection">;
193
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
194
+ }>]>>>;
195
+ readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
196
+ readonly kind: Schema.Literal<"text">;
197
+ readonly text: Schema.String;
210
198
  readonly prefix: Schema.optional<Schema.String>;
211
- readonly targetScope: Schema.brand<Schema.String, "ScopeId">;
212
- readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
213
- }>, Schema.Union<readonly [Schema.String, Schema.Struct<{
199
+ }>, Schema.Struct<{
200
+ readonly kind: Schema.Literal<"secret">;
214
201
  readonly secretId: Schema.String;
202
+ readonly secretScope: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
215
203
  readonly prefix: Schema.optional<Schema.String>;
216
- }>]>, Schema.Union<readonly [Schema.String, Schema.Struct<{
217
- readonly kind: Schema.Literal<"binding">;
218
- readonly slot: Schema.String;
219
- readonly prefix: Schema.optional<Schema.String>;
220
- }>]>]>>>;
221
- readonly credentialTargetScope: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
204
+ }>, Schema.Struct<{
205
+ readonly kind: Schema.Literal<"connection">;
206
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
207
+ }>]>>>;
208
+ readonly specFetchCredentials: Schema.optional<Schema.Struct<{
209
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
210
+ readonly kind: Schema.Literal<"text">;
211
+ readonly text: Schema.String;
212
+ readonly prefix: Schema.optional<Schema.String>;
213
+ }>, Schema.Struct<{
214
+ readonly kind: Schema.Literal<"secret">;
215
+ readonly secretId: Schema.String;
216
+ readonly secretScope: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
217
+ readonly prefix: Schema.optional<Schema.String>;
218
+ }>, Schema.Struct<{
219
+ readonly kind: Schema.Literal<"connection">;
220
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
221
+ }>]>>>;
222
+ readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
223
+ readonly kind: Schema.Literal<"text">;
224
+ readonly text: Schema.String;
225
+ readonly prefix: Schema.optional<Schema.String>;
226
+ }>, Schema.Struct<{
227
+ readonly kind: Schema.Literal<"secret">;
228
+ readonly secretId: Schema.String;
229
+ readonly secretScope: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
230
+ readonly prefix: Schema.optional<Schema.String>;
231
+ }>, Schema.Struct<{
232
+ readonly kind: Schema.Literal<"connection">;
233
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
234
+ }>]>>>;
235
+ }>>;
222
236
  readonly oauth2: Schema.optional<Schema.Struct<{
237
+ readonly clientId: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Struct<{
238
+ readonly kind: Schema.Literal<"text">;
239
+ readonly text: Schema.String;
240
+ readonly prefix: Schema.optional<Schema.String>;
241
+ }>, Schema.Struct<{
242
+ readonly kind: Schema.Literal<"secret">;
243
+ readonly secretId: Schema.String;
244
+ readonly secretScope: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
245
+ readonly prefix: Schema.optional<Schema.String>;
246
+ }>, Schema.Struct<{
247
+ readonly kind: Schema.Literal<"connection">;
248
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
249
+ }>]>>;
250
+ readonly clientSecret: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Struct<{
251
+ readonly kind: Schema.Literal<"text">;
252
+ readonly text: Schema.String;
253
+ readonly prefix: Schema.optional<Schema.String>;
254
+ }>, Schema.Struct<{
255
+ readonly kind: Schema.Literal<"secret">;
256
+ readonly secretId: Schema.String;
257
+ readonly secretScope: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
258
+ readonly prefix: Schema.optional<Schema.String>;
259
+ }>, Schema.Struct<{
260
+ readonly kind: Schema.Literal<"connection">;
261
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
262
+ }>]>>;
263
+ readonly connection: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Struct<{
264
+ readonly kind: Schema.Literal<"text">;
265
+ readonly text: Schema.String;
266
+ readonly prefix: Schema.optional<Schema.String>;
267
+ }>, Schema.Struct<{
268
+ readonly kind: Schema.Literal<"secret">;
269
+ readonly secretId: Schema.String;
270
+ readonly secretScope: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
271
+ readonly prefix: Schema.optional<Schema.String>;
272
+ }>, Schema.Struct<{
273
+ readonly kind: Schema.Literal<"connection">;
274
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
275
+ }>]>>;
276
+ }>>;
277
+ readonly oauth2Source: Schema.optional<Schema.Struct<{
223
278
  readonly kind: Schema.Literal<"oauth2">;
224
279
  readonly securitySchemeName: Schema.String;
225
280
  readonly flow: Schema.Literals<readonly ["authorizationCode", "clientCredentials"]>;
226
281
  readonly tokenUrl: Schema.String;
227
- readonly authorizationUrl: Schema.NullOr<Schema.String>;
282
+ readonly authorizationUrl: Schema.withDecodingDefault<Schema.optional<Schema.NullOr<Schema.String>>>;
228
283
  readonly issuerUrl: Schema.optional<Schema.NullOr<Schema.String>>;
229
284
  readonly clientIdSlot: Schema.String;
230
285
  readonly clientSecretSlot: Schema.NullOr<Schema.String>;
231
286
  readonly connectionSlot: Schema.String;
232
287
  readonly scopes: Schema.$Array<Schema.String>;
233
288
  }>>;
234
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
235
- readonly updated: Schema.Boolean;
236
- }>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listSourceBindings", "GET", "/scopes/:scopeId/openapi/sources/:namespace/base/:sourceScopeId/bindings", HttpApiEndpoint.StringTree<Schema.Struct<{
237
- scopeId: Schema.brand<Schema.String, "ScopeId">;
238
- namespace: Schema.String;
239
- sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
240
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.$Array<Schema.Struct<{
289
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.$Array<Schema.Struct<{
290
+ readonly id: Schema.brand<Schema.String, "CredentialBindingId">;
291
+ readonly scopeId: Schema.brand<Schema.String, "ScopeId">;
292
+ readonly pluginId: Schema.String;
241
293
  readonly sourceId: Schema.String;
242
294
  readonly sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
243
- readonly scopeId: Schema.brand<Schema.String, "ScopeId">;
244
- readonly slot: Schema.String;
295
+ readonly slotKey: Schema.String;
245
296
  readonly value: Schema.Union<readonly [Schema.Struct<{
246
- readonly kind: Schema.Literal<"secret">;
247
- readonly secretId: Schema.brand<Schema.String, "SecretId">;
248
- readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
249
- }>, Schema.Struct<{
250
- readonly kind: Schema.Literal<"connection">;
251
- readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
252
- }>, Schema.Struct<{
253
297
  readonly kind: Schema.Literal<"text">;
254
298
  readonly text: Schema.String;
255
- }>]>;
256
- readonly createdAt: Schema.Date;
257
- readonly updatedAt: Schema.Date;
258
- }>>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"setSourceBinding", "POST", "/scopes/:scopeId/openapi/source-bindings", HttpApiEndpoint.StringTree<Schema.Struct<{
259
- scopeId: Schema.brand<Schema.String, "ScopeId">;
260
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
261
- readonly sourceId: Schema.String;
262
- readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
263
- readonly scope: Schema.brand<Schema.String, "ScopeId">;
264
- readonly slot: Schema.String;
265
- readonly value: Schema.Union<readonly [Schema.Struct<{
266
- readonly kind: Schema.Literal<"secret">;
267
- readonly secretId: Schema.brand<Schema.String, "SecretId">;
268
- readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
269
299
  }>, Schema.Struct<{
270
- readonly kind: Schema.Literal<"connection">;
271
- readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
272
- }>, Schema.Struct<{
273
- readonly kind: Schema.Literal<"text">;
274
- readonly text: Schema.String;
275
- }>]>;
276
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
277
- readonly sourceId: Schema.String;
278
- readonly sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
279
- readonly scopeId: Schema.brand<Schema.String, "ScopeId">;
280
- readonly slot: Schema.String;
281
- readonly value: Schema.Union<readonly [Schema.Struct<{
282
300
  readonly kind: Schema.Literal<"secret">;
283
301
  readonly secretId: Schema.brand<Schema.String, "SecretId">;
284
302
  readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
285
303
  }>, Schema.Struct<{
286
304
  readonly kind: Schema.Literal<"connection">;
287
305
  readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
288
- }>, Schema.Struct<{
289
- readonly kind: Schema.Literal<"text">;
290
- readonly text: Schema.String;
291
306
  }>]>;
292
307
  readonly createdAt: Schema.Date;
293
308
  readonly updatedAt: Schema.Date;
294
- }>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"removeSourceBinding", "POST", "/scopes/:scopeId/openapi/source-bindings/remove", HttpApiEndpoint.StringTree<Schema.Struct<{
295
- scopeId: Schema.brand<Schema.String, "ScopeId">;
296
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
297
- readonly sourceId: Schema.String;
298
- readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
299
- readonly slot: Schema.String;
300
- readonly scope: Schema.brand<Schema.String, "ScopeId">;
301
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
302
- readonly removed: Schema.Boolean;
303
- }>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never>, false>;
309
+ }>>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never>, false>;