@executor-js/plugin-openapi 0.1.0 → 1.4.20
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-FLMNI742.js +19 -0
- package/dist/AddOpenApiSource-FLMNI742.js.map +1 -0
- package/dist/EditOpenApiSource-I4NIGIIJ.js +665 -0
- package/dist/EditOpenApiSource-I4NIGIIJ.js.map +1 -0
- package/dist/OpenApiSourceSummary-CM46DB4L.js +122 -0
- package/dist/OpenApiSourceSummary-CM46DB4L.js.map +1 -0
- package/dist/api/group.d.ts +224 -16
- package/dist/api/index.d.ts +634 -0
- package/dist/chunk-E7PZ2QGD.js +1303 -0
- package/dist/chunk-E7PZ2QGD.js.map +1 -0
- package/dist/chunk-GFQUEZUW.js +216 -0
- package/dist/chunk-GFQUEZUW.js.map +1 -0
- package/dist/chunk-OZ67JNID.js +1447 -0
- package/dist/chunk-OZ67JNID.js.map +1 -0
- package/dist/chunk-TGDT6QCH.js +1120 -0
- package/dist/chunk-TGDT6QCH.js.map +1 -0
- package/dist/client.js +165 -0
- package/dist/client.js.map +1 -0
- package/dist/core.js +8 -10
- package/dist/index.js +2 -1
- package/dist/react/AddOpenApiSource.d.ts +1 -1
- package/dist/react/OpenApiSourceDetailsFields.d.ts +18 -0
- package/dist/react/atoms.d.ts +320 -15
- package/dist/react/client.d.ts +226 -15
- package/dist/sdk/extract.d.ts +54 -3
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/invoke.d.ts +48 -4
- package/dist/sdk/openapi-utils.d.ts +4 -3
- package/dist/sdk/parse.d.ts +1 -1
- package/dist/sdk/parse.test.d.ts +1 -0
- package/dist/sdk/plugin.d.ts +247 -128
- package/dist/sdk/preview.d.ts +201 -49
- package/dist/sdk/store.d.ts +155 -45
- package/dist/sdk/types.d.ts +204 -137
- package/dist/sdk/usage-scope-isolation.test.d.ts +1 -0
- package/dist/testing/index.d.ts +34 -0
- package/dist/testing.js +56 -0
- package/dist/testing.js.map +1 -0
- package/package.json +16 -4
- package/dist/chunk-RBE3CVB4.js +0 -2837
- package/dist/chunk-RBE3CVB4.js.map +0 -1
|
@@ -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 { connectionsAtom, sourceAtom, startOAuth } from \"@executor-js/react/api/atoms\";\nimport { useScope, useScopeStack, 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 CardStackEntryField,\n CardStackEntryTitle,\n} from \"@executor-js/react/components/card-stack\";\nimport { FilterTabs } from \"@executor-js/react/components/filter-tabs\";\nimport { Input } from \"@executor-js/react/components/input\";\nimport { sourceWriteKeys as openApiWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport { ConnectionId, ScopeId, SecretId } from \"@executor-js/sdk/core\";\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 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\";\n\nimport {\n openApiSourceAtom,\n openApiSourceBindingsAtom,\n removeOpenApiSourceBinding,\n setOpenApiSourceBinding,\n updateOpenApiSource,\n} 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/store\";\nimport {\n OAuth2SourceConfig,\n OpenApiSourceBindingInput,\n type OpenApiSourceBindingRef,\n} 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\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 scopeStack = useScopeStack();\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 scopeRanks = useMemo(\n () => new Map(scopeStack.map((scope, index) => [scope.id, index] as const)),\n [scopeStack],\n );\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 doUpdate = useAtomSet(updateOpenApiSource, { mode: \"promiseExit\" });\n const doSetBinding = useAtomSet(setOpenApiSourceBinding, {\n mode: \"promiseExit\",\n });\n const doRemoveBinding = useAtomSet(removeOpenApiSourceBinding, {\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 OpenApiSourceBindingRef[] = 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 [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 [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 }, [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 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 doUpdate({\n params: { scopeId: displayScope, namespace: props.sourceId },\n payload: {\n sourceScope,\n name: nextName || undefined,\n baseUrl: nextBaseUrl || undefined,\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 doUpdate,\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 credentialScopes = useMemo(() => {\n const entries = [{ scopeId: ScopeId.make(sourceScopeId), label: \"Organization\" }];\n if (userScope !== sourceScopeId) {\n entries.unshift({ scopeId: ScopeId.make(userScope), label: \"Personal\" });\n } else {\n entries[0] = {\n scopeId: ScopeId.make(sourceScopeId),\n label: \"Credentials\",\n };\n }\n return entries;\n }, [sourceScopeId, userScope]);\n const credentialScopeOptions = useMemo(\n () =>\n credentialScopes.map((entry) => ({\n scopeId: entry.scopeId,\n label: entry.label,\n description:\n entry.label === \"Personal\"\n ? \"Saved only for your account.\"\n : \"Shared with everyone who can use this source.\",\n })),\n [credentialScopes],\n );\n const organizationCredentialScope =\n credentialScopes.find((entry) => entry.label === \"Organization\") ?? credentialScopes[0]!;\n const personalCredentialScope =\n credentialScopes.find((entry) => entry.label === \"Personal\") ?? null;\n const secretBindingScopes =\n personalCredentialScope &&\n personalCredentialScope.scopeId !== organizationCredentialScope.scopeId\n ? [organizationCredentialScope, personalCredentialScope]\n : [organizationCredentialScope];\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\n const setSecretBinding = async (\n targetScope: ScopeId,\n slot: string,\n secretId: string,\n secretScope: ScopeId,\n ) => {\n const inputKey = `${targetScope}:${slot}`;\n const trimmed = secretId.trim();\n if (!trimmed) return;\n setBusyKey(inputKey);\n setError(null);\n const exit = await doSetBinding({\n params: { scopeId: displayScope },\n payload: OpenApiSourceBindingInput.make({\n sourceId: props.sourceId,\n sourceScope,\n scope: targetScope,\n slot,\n value: {\n kind: \"secret\",\n secretId: SecretId.make(trimmed),\n secretScopeId: secretScope,\n },\n }),\n reactivityKeys: sourceWriteKeys,\n });\n if (Exit.isFailure(exit)) {\n setError(errorMessageFromExit(exit, \"Failed to save credential binding\"));\n }\n setBusyKey(null);\n };\n\n const clearBinding = async (targetScope: ScopeId, slot: string) => {\n setBusyKey(`${targetScope}:${slot}:clear`);\n setError(null);\n const exit = await doRemoveBinding({\n params: { scopeId: displayScope },\n payload: {\n sourceId: props.sourceId,\n sourceScope,\n slot,\n scope: targetScope,\n },\n reactivityKeys: sourceWriteKeys,\n });\n if (Exit.isFailure(exit)) {\n setError(errorMessageFromExit(exit, \"Failed to clear credential binding\"));\n }\n setBusyKey(null);\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 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\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 clientSecretSecretId: clientSecretValue!.secretId,\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: OpenApiSourceBindingInput.make({\n sourceId: props.sourceId,\n sourceScope,\n scope: targetScope,\n slot: 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 clientSecretSecretId:\n clientSecretBinding && isSecretCredentialBindingValue(clientSecretBinding.value)\n ? clientSecretBinding.value.secretId\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: OpenApiSourceBindingInput.make({\n sourceId: props.sourceId,\n sourceScope,\n scope: targetScope,\n slot: 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 <CardStackEntry>\n <CardStackEntryContent>\n <CardStackEntryTitle>Secrets</CardStackEntryTitle>\n </CardStackEntryContent>\n </CardStackEntry>\n\n <SecretCredentialSlotBindings\n slots={secretSlots.filter((slot) => slot.kind === \"secret\")}\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={busyKey}\n onSetSecretBinding={setSecretBinding}\n onClearBinding={clearBinding}\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 doUpdate({\n params: { scopeId: displayScope, namespace: props.sourceId },\n payload: {\n sourceScope,\n oauth2: 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 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\n return (\n <>\n <CardStackEntry>\n <CardStackEntryContent>\n <CardStackEntryTitle>OAuth Endpoints</CardStackEntryTitle>\n <CardStackEntryDescription>\n Override the URLs from the OpenAPI spec when a provider publishes the wrong\n values.\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 size=\"sm\"\n onClick={() => void saveOAuth2Endpoints()}\n disabled={!canSave}\n >\n Save\n </Button>\n </div>\n </CardStackEntry>\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\">{oauth2RedirectUrl}</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 {credentialScopes.length > 1 && (\n <CardStackEntry>\n <CardStackEntryContent>\n <CardStackEntryTitle>OAuth token</CardStackEntryTitle>\n <CardStackEntryDescription>\n Choose where the signed-in OAuth token is saved.\n </CardStackEntryDescription>\n </CardStackEntryContent>\n <FilterTabs\n tabs={credentialScopes.map((entry) => ({\n value: entry.scopeId,\n label: entry.label,\n }))}\n value={activeOAuthTokenScopeId}\n onChange={setSelectedOAuthTokenScope}\n />\n </CardStackEntry>\n )}\n <CardStackEntryField label=\"OAuth Connection\">\n <div className=\"space-y-2\">\n <div className=\"text-sm text-muted-foreground\">{statusText}</div>\n <Button\n size=\"sm\"\n onClick={() => void connectOAuth(activeOAuthTokenScopeId)}\n disabled={connectDisabled}\n >\n {isConnecting ? \"Connecting…\" : isConnected ? \"Reconnect\" : \"Connect\"}\n </Button>\n {endpointsDirty && (\n <p className=\"text-xs text-muted-foreground\">\n Save endpoint changes before reconnecting.\n </p>\n )}\n </div>\n </CardStackEntryField>\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,SAAS,iBAAiB,YAAY,kBAAkB;AACxD,SAAS,UAAU,eAAe,oBAAoB;AACtD,SAAS,qBAAqB,uBAAuB;AACrD,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,E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AAA,aACF,GACF;AAAA,UACC,iBAAiB,SAAS,KACzB,qBAAC,kBACC;AAAA,iCAAC,yBACC;AAAA,kCAAC,uBAAoB,yBAAW;AAAA,cAChC,oBAAC,6BAA0B,8DAE3B;AAAA,eACF;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,MAAM,iBAAiB,IAAI,CAAC,WAAW;AAAA,kBACrC,OAAO,MAAM;AAAA,kBACb,OAAO,MAAM;AAAA,gBACf,EAAE;AAAA,gBACF,OAAO;AAAA,gBACP,UAAU;AAAA;AAAA,YACZ;AAAA,aACF;AAAA,UAEF,oBAAC,uBAAoB,OAAM,oBACzB,+BAAC,SAAI,WAAU,aACb;AAAA,gCAAC,SAAI,WAAU,iCAAiC,sBAAW;AAAA,YAC3D;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS,MAAM,KAAK,aAAa,uBAAuB;AAAA,gBACxD,UAAU;AAAA,gBAET,yBAAe,qBAAgB,cAAc,cAAc;AAAA;AAAA,YAC9D;AAAA,YACC,kBACC,oBAAC,OAAE,WAAU,iCAAgC,wDAE7C;AAAA,aAEJ,GACF;AAAA,WACF;AAAA,MAEJ,GAAG;AAAA,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"]}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import {
|
|
2
|
+
openApiSourceAtom,
|
|
3
|
+
openApiSourceBindingsAtom
|
|
4
|
+
} from "./chunk-GFQUEZUW.js";
|
|
5
|
+
import {
|
|
6
|
+
oauth2ClientSecretSlot
|
|
7
|
+
} from "./chunk-E7PZ2QGD.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/core";
|
|
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-CM46DB4L.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/core\";\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/store\";\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, ScopeId } from \"@executor-js/sdk/core\";\n\nimport { oauth2ClientSecretSlot } from \"./store\";\nimport type { ConfiguredHeaderValue, OpenApiSourceBindingValue } from \"./types\";\n\nexport type BindingRowForCredentialStatus = {\n readonly slot: string;\n readonly scopeId: ScopeId;\n readonly value: OpenApiSourceBindingValue;\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,aAAY,mBAAK;AACzC;AAEA,SAAS,2BAA2B;AAClC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,WAAU;AAAA,MACX;AAAA;AAAA,EAED;AAEJ;AAEA,IAAM,4BAA4B,CAAC,WAGrB,OAAO,oBAAoB,uBAAuB,OAAO,kBAAkB;AAEzF,IAAM,wBAAwB,CA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AW,OAAO,YAAY,GAAG;AACpF,WAAO,oBAAC,+BAA4B,SAAS,CAAC,GAAG;AAAA,EACnD;AAEA,SAAO,oBAAC,cAAW;AACrB;","names":[]}
|
package/dist/api/group.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
|
-
import { InternalError } from "@executor-js/
|
|
3
|
+
import { InternalError } from "@executor-js/sdk/core";
|
|
4
4
|
import { OpenApiParseError, OpenApiExtractionError, OpenApiOAuthError } from "../sdk/errors";
|
|
5
|
-
import { SpecPreview } from "../sdk/preview";
|
|
6
|
-
import { StoredSourceSchema } from "../sdk/store";
|
|
7
|
-
import { OAuth2Auth, OAuth2SourceConfig, OpenApiSourceBindingRef } from "../sdk/types";
|
|
8
5
|
export declare const OpenApiGroup: HttpApiGroup.HttpApiGroup<"openapi", HttpApiEndpoint.HttpApiEndpoint<"previewSpec", "POST", "/scopes/:scopeId/openapi/preview", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
9
6
|
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
10
7
|
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
@@ -19,9 +16,73 @@ export declare const OpenApiGroup: HttpApiGroup.HttpApiGroup<"openapi", HttpApiE
|
|
|
19
16
|
readonly prefix: Schema.optional<Schema.String>;
|
|
20
17
|
}>]>>>;
|
|
21
18
|
}>>;
|
|
22
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<
|
|
19
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
20
|
+
readonly title: Schema.OptionFromOptional<Schema.String>;
|
|
21
|
+
readonly version: Schema.OptionFromOptional<Schema.String>;
|
|
22
|
+
readonly servers: Schema.$Array<Schema.Struct<{
|
|
23
|
+
readonly url: Schema.String;
|
|
24
|
+
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
25
|
+
readonly variables: Schema.OptionFromOptional<Schema.$Record<Schema.String, Schema.Struct<{
|
|
26
|
+
readonly default: Schema.String;
|
|
27
|
+
readonly enum: Schema.OptionFromOptional<Schema.$Array<Schema.String>>;
|
|
28
|
+
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
29
|
+
}>>>;
|
|
30
|
+
}>>;
|
|
31
|
+
readonly operationCount: Schema.Number;
|
|
32
|
+
readonly operations: Schema.$Array<Schema.Struct<{
|
|
33
|
+
readonly operationId: Schema.String;
|
|
34
|
+
readonly method: Schema.Literals<readonly ["get", "put", "post", "delete", "patch", "head", "options", "trace"]>;
|
|
35
|
+
readonly path: Schema.String;
|
|
36
|
+
readonly summary: Schema.OptionFromOptional<Schema.String>;
|
|
37
|
+
readonly tags: Schema.$Array<Schema.String>;
|
|
38
|
+
readonly deprecated: Schema.Boolean;
|
|
39
|
+
}>>;
|
|
40
|
+
readonly tags: Schema.$Array<Schema.String>;
|
|
41
|
+
readonly securitySchemes: Schema.$Array<Schema.Struct<{
|
|
42
|
+
readonly name: Schema.String;
|
|
43
|
+
readonly type: Schema.Literals<readonly ["http", "apiKey", "oauth2", "openIdConnect"]>;
|
|
44
|
+
readonly scheme: Schema.OptionFromOptional<Schema.String>;
|
|
45
|
+
readonly bearerFormat: Schema.OptionFromOptional<Schema.String>;
|
|
46
|
+
readonly in: Schema.OptionFromOptional<Schema.Literals<readonly ["header", "query", "cookie"]>>;
|
|
47
|
+
readonly headerName: Schema.OptionFromOptional<Schema.String>;
|
|
48
|
+
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
49
|
+
readonly flows: Schema.OptionFromOptional<Schema.Struct<{
|
|
50
|
+
readonly authorizationCode: Schema.OptionFromOptional<Schema.Struct<{
|
|
51
|
+
readonly authorizationUrl: Schema.String;
|
|
52
|
+
readonly tokenUrl: Schema.String;
|
|
53
|
+
readonly refreshUrl: Schema.OptionFromOptional<Schema.String>;
|
|
54
|
+
readonly scopes: Schema.$Record<Schema.String, Schema.String>;
|
|
55
|
+
}>>;
|
|
56
|
+
readonly clientCredentials: Schema.OptionFromOptional<Schema.Struct<{
|
|
57
|
+
readonly tokenUrl: Schema.String;
|
|
58
|
+
readonly refreshUrl: Schema.OptionFromOptional<Schema.String>;
|
|
59
|
+
readonly scopes: Schema.$Record<Schema.String, Schema.String>;
|
|
60
|
+
}>>;
|
|
61
|
+
}>>;
|
|
62
|
+
readonly openIdConnectUrl: Schema.OptionFromOptional<Schema.String>;
|
|
63
|
+
}>>;
|
|
64
|
+
readonly authStrategies: Schema.$Array<Schema.Struct<{
|
|
65
|
+
readonly schemes: Schema.$Array<Schema.String>;
|
|
66
|
+
}>>;
|
|
67
|
+
readonly headerPresets: Schema.$Array<Schema.Struct<{
|
|
68
|
+
readonly label: Schema.String;
|
|
69
|
+
readonly headers: Schema.$Record<Schema.String, Schema.NullOr<Schema.String>>;
|
|
70
|
+
readonly secretHeaders: Schema.$Array<Schema.String>;
|
|
71
|
+
}>>;
|
|
72
|
+
readonly oauth2Presets: Schema.$Array<Schema.Struct<{
|
|
73
|
+
readonly label: Schema.String;
|
|
74
|
+
readonly securitySchemeName: Schema.String;
|
|
75
|
+
readonly flow: Schema.Literals<readonly ["authorizationCode", "clientCredentials"]>;
|
|
76
|
+
readonly authorizationUrl: Schema.OptionFromOptional<Schema.String>;
|
|
77
|
+
readonly tokenUrl: Schema.String;
|
|
78
|
+
readonly refreshUrl: Schema.OptionFromOptional<Schema.String>;
|
|
79
|
+
readonly scopes: Schema.$Record<Schema.String, Schema.String>;
|
|
80
|
+
}>>;
|
|
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<{
|
|
23
82
|
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
24
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">>;
|
|
25
86
|
readonly spec: Schema.String;
|
|
26
87
|
readonly specFetchCredentials: Schema.optional<Schema.Struct<{
|
|
27
88
|
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
@@ -36,37 +97,165 @@ export declare const OpenApiGroup: HttpApiGroup.HttpApiGroup<"openapi", HttpApiE
|
|
|
36
97
|
readonly name: Schema.optional<Schema.String>;
|
|
37
98
|
readonly baseUrl: Schema.optional<Schema.String>;
|
|
38
99
|
readonly namespace: Schema.optional<Schema.String>;
|
|
39
|
-
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.
|
|
40
|
-
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
100
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
|
|
41
101
|
readonly secretId: Schema.String;
|
|
42
102
|
readonly prefix: Schema.optional<Schema.String>;
|
|
43
|
-
|
|
44
|
-
|
|
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;
|
|
120
|
+
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;
|
|
124
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
125
|
+
}>]>]>>>;
|
|
126
|
+
readonly oauth2: Schema.optional<Schema.Struct<{
|
|
127
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
128
|
+
readonly securitySchemeName: Schema.String;
|
|
129
|
+
readonly flow: Schema.Literals<readonly ["authorizationCode", "clientCredentials"]>;
|
|
130
|
+
readonly tokenUrl: Schema.String;
|
|
131
|
+
readonly authorizationUrl: Schema.NullOr<Schema.String>;
|
|
132
|
+
readonly issuerUrl: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
133
|
+
readonly clientIdSlot: Schema.String;
|
|
134
|
+
readonly clientSecretSlot: Schema.NullOr<Schema.String>;
|
|
135
|
+
readonly connectionSlot: Schema.String;
|
|
136
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
137
|
+
}>>;
|
|
45
138
|
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
46
139
|
readonly toolCount: Schema.Number;
|
|
47
140
|
readonly namespace: Schema.String;
|
|
48
141
|
}>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getSource", "GET", "/scopes/:scopeId/openapi/sources/:namespace", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
49
142
|
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
50
143
|
namespace: Schema.String;
|
|
51
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.NullOr<
|
|
144
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.NullOr<Schema.Struct<{
|
|
145
|
+
readonly namespace: Schema.String;
|
|
146
|
+
readonly scope: Schema.String;
|
|
147
|
+
readonly name: Schema.String;
|
|
148
|
+
readonly config: Schema.Struct<{
|
|
149
|
+
readonly spec: Schema.String;
|
|
150
|
+
readonly sourceUrl: Schema.optional<Schema.String>;
|
|
151
|
+
readonly baseUrl: Schema.optional<Schema.String>;
|
|
152
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
153
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
154
|
+
readonly kind: Schema.Literal<"binding">;
|
|
155
|
+
readonly slot: Schema.String;
|
|
156
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
157
|
+
}>]>>>;
|
|
158
|
+
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
159
|
+
readonly kind: Schema.Literal<"binding">;
|
|
160
|
+
readonly slot: Schema.String;
|
|
161
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
162
|
+
}>]>>>;
|
|
163
|
+
readonly specFetchCredentials: Schema.optional<Schema.Struct<{
|
|
164
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
165
|
+
readonly kind: Schema.Literal<"binding">;
|
|
166
|
+
readonly slot: Schema.String;
|
|
167
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
168
|
+
}>]>>>;
|
|
169
|
+
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
170
|
+
readonly kind: Schema.Literal<"binding">;
|
|
171
|
+
readonly slot: Schema.String;
|
|
172
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
173
|
+
}>]>>>;
|
|
174
|
+
}>>;
|
|
175
|
+
readonly oauth2: Schema.optional<Schema.Struct<{
|
|
176
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
177
|
+
readonly securitySchemeName: Schema.String;
|
|
178
|
+
readonly flow: Schema.Literals<readonly ["authorizationCode", "clientCredentials"]>;
|
|
179
|
+
readonly tokenUrl: Schema.String;
|
|
180
|
+
readonly authorizationUrl: Schema.NullOr<Schema.String>;
|
|
181
|
+
readonly issuerUrl: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
182
|
+
readonly clientIdSlot: Schema.String;
|
|
183
|
+
readonly clientSecretSlot: Schema.NullOr<Schema.String>;
|
|
184
|
+
readonly connectionSlot: Schema.String;
|
|
185
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
186
|
+
}>>;
|
|
187
|
+
}>;
|
|
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<{
|
|
52
189
|
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
53
190
|
namespace: Schema.String;
|
|
54
191
|
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
192
|
+
readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
|
|
55
193
|
readonly name: Schema.optional<Schema.String>;
|
|
56
194
|
readonly baseUrl: Schema.optional<Schema.String>;
|
|
57
|
-
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.
|
|
58
|
-
|
|
195
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
|
|
196
|
+
readonly secretId: Schema.String;
|
|
197
|
+
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<{
|
|
201
|
+
readonly secretId: Schema.String;
|
|
202
|
+
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<{
|
|
59
209
|
readonly secretId: Schema.String;
|
|
60
210
|
readonly prefix: Schema.optional<Schema.String>;
|
|
61
|
-
|
|
62
|
-
|
|
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<{
|
|
214
|
+
readonly secretId: Schema.String;
|
|
215
|
+
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">>;
|
|
222
|
+
readonly oauth2: Schema.optional<Schema.Struct<{
|
|
223
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
224
|
+
readonly securitySchemeName: Schema.String;
|
|
225
|
+
readonly flow: Schema.Literals<readonly ["authorizationCode", "clientCredentials"]>;
|
|
226
|
+
readonly tokenUrl: Schema.String;
|
|
227
|
+
readonly authorizationUrl: Schema.NullOr<Schema.String>;
|
|
228
|
+
readonly issuerUrl: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
229
|
+
readonly clientIdSlot: Schema.String;
|
|
230
|
+
readonly clientSecretSlot: Schema.NullOr<Schema.String>;
|
|
231
|
+
readonly connectionSlot: Schema.String;
|
|
232
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
233
|
+
}>>;
|
|
63
234
|
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
64
235
|
readonly updated: Schema.Boolean;
|
|
65
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<{
|
|
66
237
|
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
67
238
|
namespace: Schema.String;
|
|
68
239
|
sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
69
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.$Array<
|
|
240
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.$Array<Schema.Struct<{
|
|
241
|
+
readonly sourceId: Schema.String;
|
|
242
|
+
readonly sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
243
|
+
readonly scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
244
|
+
readonly slot: Schema.String;
|
|
245
|
+
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
|
+
readonly kind: Schema.Literal<"text">;
|
|
254
|
+
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<{
|
|
70
259
|
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
71
260
|
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
72
261
|
readonly sourceId: Schema.String;
|
|
@@ -76,6 +265,23 @@ export declare const OpenApiGroup: HttpApiGroup.HttpApiGroup<"openapi", HttpApiE
|
|
|
76
265
|
readonly value: Schema.Union<readonly [Schema.Struct<{
|
|
77
266
|
readonly kind: Schema.Literal<"secret">;
|
|
78
267
|
readonly secretId: Schema.brand<Schema.String, "SecretId">;
|
|
268
|
+
readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
269
|
+
}>, 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
|
+
readonly kind: Schema.Literal<"secret">;
|
|
283
|
+
readonly secretId: Schema.brand<Schema.String, "SecretId">;
|
|
284
|
+
readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
79
285
|
}>, Schema.Struct<{
|
|
80
286
|
readonly kind: Schema.Literal<"connection">;
|
|
81
287
|
readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
|
|
@@ -83,7 +289,9 @@ export declare const OpenApiGroup: HttpApiGroup.HttpApiGroup<"openapi", HttpApiE
|
|
|
83
289
|
readonly kind: Schema.Literal<"text">;
|
|
84
290
|
readonly text: Schema.String;
|
|
85
291
|
}>]>;
|
|
86
|
-
|
|
292
|
+
readonly createdAt: Schema.Date;
|
|
293
|
+
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<{
|
|
87
295
|
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
88
296
|
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
89
297
|
readonly sourceId: Schema.String;
|