@executor-js/plugin-openapi 1.5.11 → 1.5.12
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-7O4LSD7C.js → AddOpenApiSource-JFSFWLBZ.js} +45 -11
- package/dist/AddOpenApiSource-JFSFWLBZ.js.map +1 -0
- package/dist/{OpenApiAccountsPanel-7XT6ZMD5.js → OpenApiAccountsPanel-2LHWUKIE.js} +3 -3
- package/dist/UpdateSpecSection-D32QZT3Q.js +104 -0
- package/dist/UpdateSpecSection-D32QZT3Q.js.map +1 -0
- package/dist/api/group.d.ts +37 -2
- package/dist/api/index.d.ts +41 -1
- package/dist/{chunk-WJQIWTZF.js → chunk-3XJSXSED.js} +78 -5
- package/dist/chunk-3XJSXSED.js.map +1 -0
- package/dist/{chunk-C6PH4R7Q.js → chunk-I2XDCVVM.js} +2 -2
- package/dist/{chunk-C3IJX4AN.js → chunk-RFSMGUBJ.js} +7 -1
- package/dist/chunk-RFSMGUBJ.js.map +1 -0
- package/dist/{chunk-IB36ED7Y.js → chunk-UJTNRH4Q.js} +32 -3
- package/dist/chunk-UJTNRH4Q.js.map +1 -0
- package/dist/client.js +5 -5
- package/dist/client.js.map +1 -1
- package/dist/core.js +3 -3
- package/dist/index.js +3 -3
- package/dist/react/OpenApiSourceDetailsFields.d.ts +4 -1
- package/dist/react/UpdateSpecSection.d.ts +2 -0
- package/dist/react/atoms.d.ts +32 -0
- package/dist/react/client.d.ts +34 -1
- package/dist/sdk/extract.d.ts +1 -0
- package/dist/sdk/plugin.d.ts +29 -2
- package/dist/sdk/preview.d.ts +4 -0
- package/dist/sdk/types.d.ts +2 -0
- package/package.json +3 -3
- package/dist/AddOpenApiSource-7O4LSD7C.js.map +0 -1
- package/dist/EditOpenApiSource-GIN5RQPL.js +0 -68
- package/dist/EditOpenApiSource-GIN5RQPL.js.map +0 -1
- package/dist/chunk-C3IJX4AN.js.map +0 -1
- package/dist/chunk-IB36ED7Y.js.map +0 -1
- package/dist/chunk-WJQIWTZF.js.map +0 -1
- package/dist/react/EditOpenApiSource.d.ts +0 -4
- /package/dist/{OpenApiAccountsPanel-7XT6ZMD5.js.map → OpenApiAccountsPanel-2LHWUKIE.js.map} +0 -0
- /package/dist/{chunk-C6PH4R7Q.js.map → chunk-I2XDCVVM.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sdk/errors.ts","../src/sdk/parse.ts","../src/sdk/openapi-utils.ts","../src/sdk/types.ts","../src/sdk/extract.ts","../src/sdk/preview.ts"],"sourcesContent":["import { Data, Schema } from \"effect\";\nimport type { Option } from \"effect\";\nimport type { AuthToolFailureCode } from \"@executor-js/sdk/core\";\n\n// HTTP status lives on the class declaration so HttpApiBuilder's error\n// encoder (which reads `ast.annotations` off the schema it stored on\n// `group.addError(...)`) finds it. Applying the annotation post-hoc\n// via `.annotate(...)` in group.ts produced a transform-wrapper AST\n// whose status was not picked up — the error then slipped the typed\n// channel and was captured as a 500 by the observability middleware,\n// spamming Sentry on user misconfig.\nexport class OpenApiParseError extends Schema.TaggedErrorClass<OpenApiParseError>()(\n \"OpenApiParseError\",\n {\n message: Schema.String,\n },\n { httpApiStatus: 400 },\n) {}\n\nexport class OpenApiExtractionError extends Schema.TaggedErrorClass<OpenApiExtractionError>()(\n \"OpenApiExtractionError\",\n {\n message: Schema.String,\n },\n { httpApiStatus: 400 },\n) {}\n\nexport class OpenApiInvocationError extends Data.TaggedError(\"OpenApiInvocationError\")<{\n readonly message: string;\n readonly statusCode: Option.Option<number>;\n readonly cause?: unknown;\n}> {}\n\nexport class OpenApiOAuthError extends Schema.TaggedErrorClass<OpenApiOAuthError>()(\n \"OpenApiOAuthError\",\n {\n message: Schema.String,\n },\n { httpApiStatus: 400 },\n) {}\n\n// ---------------------------------------------------------------------------\n// Auth required — v2 reframes this around the connection (owner/integration/\n// name) that supplies the missing credential, not v1's source/slot/secret.\n// ---------------------------------------------------------------------------\n\nexport class OpenApiAuthRequiredError extends Data.TaggedError(\"OpenApiAuthRequiredError\")<{\n readonly code: AuthToolFailureCode;\n readonly message: string;\n readonly owner: \"org\" | \"user\";\n readonly integration: string;\n readonly connection: string;\n readonly credentialKind: \"secret\" | \"oauth\" | \"upstream\";\n readonly credentialLabel?: string;\n readonly status?: number;\n readonly details?: unknown;\n readonly cause?: unknown;\n}> {}\n","import type { OpenAPI, OpenAPIV3, OpenAPIV3_1 } from \"openapi-types\";\nimport { Duration, Effect, Schema } from \"effect\";\nimport { HttpClient, HttpClientRequest } from \"effect/unstable/http\";\nimport YAML from \"yaml\";\n\nimport { OpenApiExtractionError, OpenApiParseError } from \"./errors\";\n\nexport type ParsedDocument = OpenAPIV3.Document | OpenAPIV3_1.Document;\n\nexport interface SpecFetchCredentials {\n readonly headers?: Record<string, string>;\n readonly queryParams?: Record<string, string>;\n}\n\n// ExtractionError subclass raised from parse() for non-3.x specs\nclass OpenApiExtractionErrorFromParse extends OpenApiExtractionError {}\n\n/**\n * Fetch an OpenAPI spec URL and return its body text. Uses the Effect\n * HttpClient so the caller chooses the transport via layer — in Cloudflare\n * Workers, `FetchHttpClient.layer` binds to the Workers-native `fetch`.\n * Bounded by a 60s timeout.\n */\nexport const fetchSpecText = Effect.fn(\"OpenApi.fetchSpecText\")(function* (\n url: string,\n credentials?: SpecFetchCredentials,\n) {\n const client = yield* HttpClient.HttpClient;\n const requestUrl = new URL(url);\n for (const [name, value] of Object.entries(credentials?.queryParams ?? {})) {\n requestUrl.searchParams.set(name, value);\n }\n let request = HttpClientRequest.get(requestUrl.toString()).pipe(\n HttpClientRequest.setHeader(\"Accept\", \"application/json, application/yaml, text/yaml, */*\"),\n );\n for (const [name, value] of Object.entries(credentials?.headers ?? {})) {\n request = HttpClientRequest.setHeader(request, name, value);\n }\n const response = yield* client.execute(request).pipe(\n Effect.timeout(Duration.seconds(60)),\n Effect.mapError(\n (_cause) =>\n new OpenApiParseError({\n message: \"Failed to fetch OpenAPI document\",\n }),\n ),\n );\n if (response.status < 200 || response.status >= 300) {\n return yield* new OpenApiParseError({\n message: `Failed to fetch OpenAPI document: HTTP ${response.status}`,\n });\n }\n return yield* response.text.pipe(\n Effect.mapError(\n (_cause) =>\n new OpenApiParseError({\n message: \"Failed to read OpenAPI document body\",\n }),\n ),\n );\n});\n\n/**\n * Resolve an input string to spec text — if it's a URL, fetch it via\n * HttpClient; otherwise return it as-is.\n */\nexport const resolveSpecText = (input: string, credentials?: SpecFetchCredentials) =>\n input.startsWith(\"http://\") || input.startsWith(\"https://\")\n ? fetchSpecText(input, credentials)\n : Effect.succeed(input);\n\n/**\n * Parse an OpenAPI document from spec text and validate it's OpenAPI 3.x.\n *\n * NOTE: does NOT resolve `$ref`s. `DocResolver` + `normalizeOpenApiRefs`\n * downstream work on refs lazily, so inlining them here would just waste\n * memory — and for big specs (e.g. Cloudflare's API) that blows through\n * the 128MB Cloudflare Workers memory cap.\n */\nexport const parse = Effect.fn(\"OpenApi.parse\")(function* (text: string) {\n const api = yield* parseTextToObject(text);\n\n if (!isOpenApi3(api)) {\n return yield* new OpenApiExtractionErrorFromParse({\n message:\n \"Only OpenAPI 3.x documents are supported. Swagger 2.x documents should be converted first.\",\n });\n }\n\n return api as ParsedDocument;\n});\n\n// ---------------------------------------------------------------------------\n// Internals\n// ---------------------------------------------------------------------------\n\nconst isOpenApi3 = (doc: OpenAPI.Document): doc is OpenAPIV3.Document | OpenAPIV3_1.Document =>\n \"openapi\" in doc && typeof doc.openapi === \"string\" && doc.openapi.startsWith(\"3.\");\n\nconst parseTextToObject = (text: string): Effect.Effect<OpenAPI.Document, OpenApiParseError> =>\n Effect.gen(function* () {\n const trimmed = text.trim();\n if (trimmed.length === 0) {\n return yield* new OpenApiParseError({\n message: \"OpenAPI document is empty\",\n });\n }\n\n const parsed = yield* parseJsonLike(trimmed).pipe(\n Effect.mapError(\n () =>\n new OpenApiParseError({\n message: \"Failed to parse OpenAPI document\",\n }),\n ),\n );\n\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n return yield* new OpenApiParseError({\n message: \"OpenAPI document must parse to an object\",\n });\n }\n\n return parsed as OpenAPI.Document;\n });\n\nconst parseJsonText = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Unknown));\n\nconst parseJsonLike = (text: string): Effect.Effect<unknown, unknown> => {\n const parseYaml = Effect.try({\n try: () => YAML.parse(text) as unknown,\n catch: () => \"YamlParseFailed\" as const,\n });\n if (!text.startsWith(\"{\") && !text.startsWith(\"[\")) return parseYaml;\n return parseJsonText(text).pipe(Effect.catch(() => parseYaml));\n};\n","// ---------------------------------------------------------------------------\n// OpenAPI type aliases and $ref resolution\n//\n// Wraps the openapi-types V3/V3_1 union mess and provides clean ref resolution.\n// ---------------------------------------------------------------------------\n\nimport type { OpenAPIV3, OpenAPIV3_1 } from \"openapi-types\";\nimport type { ParsedDocument } from \"./parse\";\nimport type { ServerVariable } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Type aliases — collapse V3 / V3_1 unions into single names\n// ---------------------------------------------------------------------------\n\nexport type ParameterObject = OpenAPIV3.ParameterObject | OpenAPIV3_1.ParameterObject;\nexport type OperationObject = OpenAPIV3.OperationObject | OpenAPIV3_1.OperationObject;\nexport type PathItemObject = OpenAPIV3.PathItemObject | OpenAPIV3_1.PathItemObject;\nexport type RequestBodyObject = OpenAPIV3.RequestBodyObject | OpenAPIV3_1.RequestBodyObject;\nexport type ResponseObject = OpenAPIV3.ResponseObject | OpenAPIV3_1.ResponseObject;\nexport type MediaTypeObject = OpenAPIV3.MediaTypeObject | OpenAPIV3_1.MediaTypeObject;\nexport type ServerObject = OpenAPIV3.ServerObject | OpenAPIV3_1.ServerObject;\n\n// ---------------------------------------------------------------------------\n// DocResolver — wraps a parsed document for clean $ref resolution\n// ---------------------------------------------------------------------------\n\nexport class DocResolver {\n constructor(readonly doc: ParsedDocument) {}\n\n /** Resolve a value that might be a $ref, returning the resolved object */\n resolve<T>(value: T | OpenAPIV3.ReferenceObject | OpenAPIV3_1.ReferenceObject): T | null {\n if (isRef(value)) {\n const resolved = this.resolvePointer(value.$ref);\n return resolved as T | null;\n }\n return value as T;\n }\n\n private resolvePointer(ref: string): unknown {\n if (!ref.startsWith(\"#/\")) return null;\n const segments = ref.slice(2).split(\"/\");\n let current: unknown = this.doc;\n for (const segment of segments) {\n if (typeof current !== \"object\" || current === null) return null;\n current = (current as Record<string, unknown>)[segment];\n }\n return current;\n }\n}\n\nconst isRef = (value: unknown): value is { $ref: string } =>\n typeof value === \"object\" && value !== null && \"$ref\" in value;\n\n// ---------------------------------------------------------------------------\n// Server URL resolution\n// ---------------------------------------------------------------------------\n\n/** Substitute `{var}` placeholders in a templated URL using a plain map. */\nexport const substituteUrlVariables = (url: string, values: Record<string, string>): string => {\n let out = url;\n for (const [name, value] of Object.entries(values)) {\n out = out.replaceAll(`{${name}}`, value);\n }\n return out;\n};\n\n/** Resolve a templated server URL, filling each `{var}` from `overrides` when\n * non-empty, otherwise the variable's spec default. URLs without placeholders\n * pass through unchanged. */\nexport const resolveServerUrl = (\n templateUrl: string,\n variables: Record<string, ServerVariable> | undefined,\n overrides: Record<string, string>,\n): string => {\n const values: Record<string, string> = {};\n for (const [name, v] of Object.entries(variables ?? {})) values[name] = v.default;\n for (const [name, value] of Object.entries(overrides)) {\n if (value) values[name] = value;\n }\n return substituteUrlVariables(templateUrl, values);\n};\n\n// ---------------------------------------------------------------------------\n// Content negotiation\n// ---------------------------------------------------------------------------\n\n/**\n * Return all declared media entries in spec order. `Object.entries` on a\n * plain object preserves insertion order in modern engines, which matches\n * spec declaration order as the parser produced it.\n */\nexport const declaredContents = (\n content: Record<string, MediaTypeObject> | undefined,\n): ReadonlyArray<{ mediaType: string; media: MediaTypeObject }> => {\n if (!content) return [];\n return Object.entries(content).map(([mediaType, media]) => ({ mediaType, media }));\n};\n\n/**\n * Pick the default media type for a requestBody or response. Matches\n * swagger-client behaviour: **first declared wins** (not JSON-first). Spec\n * authors order content entries to signal intent (upload-heavy endpoints\n * declare multipart first, JSON second); respecting that order avoids\n * silently downgrading a multipart endpoint to JSON.\n *\n * For response bodies we still want a JSON preference because the server\n * picks the response content type, not the client — the old `application/\n * json` preference is preserved via `preferredResponseContent` below.\n */\nexport const preferredContent = (\n content: Record<string, MediaTypeObject> | undefined,\n): { mediaType: string; media: MediaTypeObject } | undefined => {\n const first = declaredContents(content)[0];\n return first ? first : undefined;\n};\n\n/** Response-side content picker — still JSON-first because the server\n * picks the response media type, so we want to advertise a preference. */\nexport const preferredResponseContent = (\n content: Record<string, MediaTypeObject> | undefined,\n): { mediaType: string; media: MediaTypeObject } | undefined => {\n if (!content) return undefined;\n const entries = Object.entries(content);\n const pick =\n entries.find(([mt]) => mt === \"application/json\") ??\n entries.find(([mt]) => mt.toLowerCase().includes(\"+json\")) ??\n entries.find(([mt]) => mt.toLowerCase().includes(\"json\")) ??\n entries[0];\n return pick ? { mediaType: pick[0], media: pick[1] } : undefined;\n};\n","import { Schema } from \"effect\";\nimport { AuthTemplateSlug, type OAuthAuthentication } from \"@executor-js/sdk/shared\";\nimport {\n apiKeyMethodFromAuthTemplate,\n isApiKeyAuthTemplate,\n type ApiKeyAuthMethod,\n type ApiKeyAuthTemplate,\n} from \"@executor-js/sdk/http-auth\";\n\n// ---------------------------------------------------------------------------\n// Auth-template model.\n//\n// The apiKey method is the SHARED placements model (`@executor-js/sdk/http-auth`,\n// the same shape the graphql/mcp plugins store): N header/query placements,\n// each rendered from its own credential input. The oauth template is\n// mechanism-intrinsic and comes from core (`OAuthAuthentication`, keyed\n// `kind: \"oauth2\"` with stored endpoints+scopes); an integration's\n// `Authentication` union composes the two. Client credentials\n// (clientId/secret) live on the core `OAuthClient`, not here.\n//\n// Pre-canonical stored templates (`type: \"apiKey\"` with `variable()`-templated\n// header/query records) are rewritten by the one-off config migration\n// (`migrate-config.ts`) — runtime code knows only this model.\n// ---------------------------------------------------------------------------\n\nexport { TOKEN_VARIABLE } from \"@executor-js/sdk/http-auth\";\n\nexport type APIKeyAuthentication = ApiKeyAuthMethod;\n\n/** Every method is keyed by `kind` — `kind: \"oauth2\"` | `kind: \"apikey\"`. */\nexport type Authentication = OAuthAuthentication | APIKeyAuthentication;\n\n/** What auth inputs accept: oauth templates (wire-typed: plain slug) plus the\n * request-shaped apikey dialect (`type: \"apiKey\"`, headers/queryParams\n * records) — the ONE apikey authoring shape. Stored configs and the catalog\n * read as canonical placements; `apiKeyAuthTemplateFromMethod` serializes\n * them back for read-modify-write flows. */\nexport type OAuthAuthenticationInput = Omit<OAuthAuthentication, \"slug\"> & {\n readonly slug: string;\n};\nexport type AuthenticationInput = OAuthAuthenticationInput | ApiKeyAuthTemplate;\n\n/** Expand the request-shaped dialect into canonical placements and brand the\n * oauth slugs. A dialect entry without a slug gets a blank one —\n * `mergeAuthTemplates` backfills `custom_<id>`. */\nexport const normalizeOpenApiAuthInputs = (\n inputs: readonly AuthenticationInput[],\n): readonly Authentication[] =>\n inputs.map((input): Authentication => {\n if (!isApiKeyAuthTemplate(input)) {\n return { ...input, slug: AuthTemplateSlug.make(input.slug) };\n }\n const method = apiKeyMethodFromAuthTemplate(input);\n return { ...method, slug: method.slug ?? \"\" };\n });\n\n// ---------------------------------------------------------------------------\n// Branded IDs\n// ---------------------------------------------------------------------------\n\nexport const OperationId = Schema.String.pipe(Schema.brand(\"OperationId\"));\nexport type OperationId = typeof OperationId.Type;\n\n// ---------------------------------------------------------------------------\n// HTTP\n// ---------------------------------------------------------------------------\n\nexport const HttpMethod = Schema.Literals([\n \"get\",\n \"put\",\n \"post\",\n \"delete\",\n \"patch\",\n \"head\",\n \"options\",\n \"trace\",\n]);\nexport type HttpMethod = typeof HttpMethod.Type;\n\nexport const ParameterLocation = Schema.Literals([\"path\", \"query\", \"header\", \"cookie\"]);\nexport type ParameterLocation = typeof ParameterLocation.Type;\n\n// ---------------------------------------------------------------------------\n// Extracted operation\n// ---------------------------------------------------------------------------\n\nexport const OperationParameter = Schema.Struct({\n name: Schema.String,\n location: ParameterLocation,\n required: Schema.Boolean,\n schema: Schema.OptionFromOptional(Schema.Unknown),\n style: Schema.OptionFromOptional(Schema.String),\n explode: Schema.OptionFromOptional(Schema.Boolean),\n allowReserved: Schema.OptionFromOptional(Schema.Boolean),\n description: Schema.OptionFromOptional(Schema.String),\n});\nexport type OperationParameter = typeof OperationParameter.Type;\n\n/**\n * OpenAPI 3.x `Encoding Object` (§4.8.15). Declared per-property inside a\n * multipart/form-data or application/x-www-form-urlencoded request body.\n *\n * - `contentType` — for multipart, overrides the per-part `Content-Type`\n * header (e.g. `application/json` for a JSON-encoded metadata part).\n * - `style` / `explode` / `allowReserved` — for form-urlencoded, control\n * array / object serialization the same way parameter-level style does.\n */\nexport const EncodingObject = Schema.Struct({\n contentType: Schema.OptionFromOptional(Schema.String),\n style: Schema.OptionFromOptional(Schema.String),\n explode: Schema.OptionFromOptional(Schema.Boolean),\n allowReserved: Schema.OptionFromOptional(Schema.Boolean),\n});\nexport type EncodingObject = typeof EncodingObject.Type;\n\nexport const MediaBinding = Schema.Struct({\n contentType: Schema.String,\n schema: Schema.OptionFromOptional(Schema.Unknown),\n encoding: Schema.OptionFromOptional(Schema.Record(Schema.String, EncodingObject)),\n});\nexport type MediaBinding = typeof MediaBinding.Type;\n\nexport const OperationRequestBody = Schema.Struct({\n required: Schema.Boolean,\n /** Default media type — first declared in spec order (not JSON-first).\n * Used when the caller does not override via the tool's `contentType` arg. */\n contentType: Schema.String,\n /** Schema of the default media type. Kept for backward compat with stored\n * bindings from before `contents` was added. */\n schema: Schema.OptionFromOptional(Schema.Unknown),\n /** All declared media types in spec order. Populated by `extract.ts`\n * going forward; older persisted bindings may have this unset and will\n * fall back to `{contentType, schema}`. */\n contents: Schema.OptionFromOptional(Schema.Array(MediaBinding)),\n});\nexport type OperationRequestBody = typeof OperationRequestBody.Type;\n\nexport const ServerVariable = Schema.Struct({\n default: Schema.String,\n enum: Schema.OptionFromOptional(Schema.Array(Schema.String)),\n description: Schema.OptionFromOptional(Schema.String),\n});\nexport type ServerVariable = typeof ServerVariable.Type;\n\nexport const ServerInfo = Schema.Struct({\n url: Schema.String,\n description: Schema.OptionFromOptional(Schema.String),\n variables: Schema.OptionFromOptional(Schema.Record(Schema.String, ServerVariable)),\n});\nexport type ServerInfo = typeof ServerInfo.Type;\n\nexport const ExtractedOperation = Schema.Struct({\n operationId: OperationId,\n toolPath: Schema.OptionFromOptional(Schema.String),\n method: HttpMethod,\n servers: Schema.Array(ServerInfo),\n pathTemplate: Schema.String,\n summary: Schema.OptionFromOptional(Schema.String),\n description: Schema.OptionFromOptional(Schema.String),\n tags: Schema.Array(Schema.String),\n parameters: Schema.Array(OperationParameter),\n requestBody: Schema.OptionFromOptional(OperationRequestBody),\n inputSchema: Schema.OptionFromOptional(Schema.Unknown),\n outputSchema: Schema.OptionFromOptional(Schema.Unknown),\n deprecated: Schema.Boolean,\n});\nexport type ExtractedOperation = typeof ExtractedOperation.Type;\n\nexport const ExtractionResult = Schema.Struct({\n title: Schema.OptionFromOptional(Schema.String),\n /** The spec's `info.description` — the author's own summary of the API. */\n description: Schema.OptionFromOptional(Schema.String),\n version: Schema.OptionFromOptional(Schema.String),\n servers: Schema.Array(ServerInfo),\n operations: Schema.Array(ExtractedOperation),\n});\nexport type ExtractionResult = typeof ExtractionResult.Type;\n\n// ---------------------------------------------------------------------------\n// Operation binding — minimal invocation data (no schemas/metadata)\n// ---------------------------------------------------------------------------\n\nexport const OperationBinding = Schema.Struct({\n method: HttpMethod,\n servers: Schema.optional(Schema.Array(ServerInfo)),\n pathTemplate: Schema.String,\n parameters: Schema.Array(OperationParameter),\n requestBody: Schema.OptionFromOptional(OperationRequestBody),\n});\nexport type OperationBinding = typeof OperationBinding.Type;\n\n// ---------------------------------------------------------------------------\n// Invocation\n// ---------------------------------------------------------------------------\n\nexport const InvocationResult = Schema.Struct({\n status: Schema.Number,\n headers: Schema.Record(Schema.String, Schema.String),\n data: Schema.NullOr(Schema.Unknown),\n error: Schema.NullOr(Schema.Unknown),\n});\nexport type InvocationResult = typeof InvocationResult.Type;\n","import { Effect, Option } from \"effect\";\n\nimport { OpenApiExtractionError } from \"./errors\";\nimport type { ParsedDocument } from \"./parse\";\nimport {\n declaredContents,\n DocResolver,\n preferredResponseContent,\n type OperationObject,\n type ParameterObject,\n type PathItemObject,\n type RequestBodyObject,\n type ResponseObject,\n type ServerObject,\n} from \"./openapi-utils\";\nimport {\n EncodingObject,\n ExtractedOperation,\n ExtractionResult,\n type HttpMethod,\n MediaBinding,\n OperationId,\n OperationParameter,\n OperationRequestBody,\n type ParameterLocation,\n ServerInfo,\n ServerVariable,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Constants\n// ---------------------------------------------------------------------------\n\nconst HTTP_METHODS: readonly HttpMethod[] = [\n \"get\",\n \"put\",\n \"post\",\n \"delete\",\n \"patch\",\n \"head\",\n \"options\",\n \"trace\",\n];\n\nconst VALID_PARAM_LOCATIONS = new Set<string>([\"path\", \"query\", \"header\", \"cookie\"]);\n\n// ---------------------------------------------------------------------------\n// Parameter extraction\n// ---------------------------------------------------------------------------\n\nconst extractParameters = (\n pathItem: PathItemObject,\n operation: OperationObject,\n r: DocResolver,\n): OperationParameter[] => {\n const merged = new Map<string, ParameterObject>();\n\n for (const raw of pathItem.parameters ?? []) {\n const p = r.resolve<ParameterObject>(raw);\n if (!p) continue;\n merged.set(`${p.in}:${p.name}`, p);\n }\n for (const raw of operation.parameters ?? []) {\n const p = r.resolve<ParameterObject>(raw);\n if (!p) continue;\n merged.set(`${p.in}:${p.name}`, p);\n }\n\n return [...merged.values()]\n .filter((p) => VALID_PARAM_LOCATIONS.has(p.in))\n .map((p) =>\n OperationParameter.make({\n name: p.name,\n location: p.in as ParameterLocation,\n required: p.in === \"path\" ? true : p.required === true,\n schema: Option.fromNullishOr(p.schema),\n style: Option.fromNullishOr(p.style),\n explode: Option.fromNullishOr(p.explode),\n allowReserved: Option.fromNullishOr(\"allowReserved\" in p ? p.allowReserved : undefined),\n description: Option.fromNullishOr(p.description),\n }),\n );\n};\n\n// ---------------------------------------------------------------------------\n// Request body extraction\n// ---------------------------------------------------------------------------\n\nconst buildEncodingRecord = (\n encoding: Record<string, unknown> | undefined,\n): Record<string, EncodingObject> | undefined => {\n if (!encoding) return undefined;\n const out: Record<string, EncodingObject> = {};\n for (const [prop, raw] of Object.entries(encoding)) {\n if (typeof raw !== \"object\" || raw === null) continue;\n const e = raw as {\n contentType?: string;\n style?: string;\n explode?: boolean;\n allowReserved?: boolean;\n };\n out[prop] = EncodingObject.make({\n contentType: Option.fromNullishOr(e.contentType),\n style: Option.fromNullishOr(e.style),\n explode: Option.fromNullishOr(e.explode),\n allowReserved: Option.fromNullishOr(e.allowReserved),\n });\n }\n return Object.keys(out).length > 0 ? out : undefined;\n};\n\nconst extractRequestBody = (\n operation: OperationObject,\n r: DocResolver,\n): OperationRequestBody | undefined => {\n if (!operation.requestBody) return undefined;\n\n const body = r.resolve<RequestBodyObject>(operation.requestBody);\n if (!body) return undefined;\n\n const contents = declaredContents(body.content).map(({ mediaType, media }) =>\n MediaBinding.make({\n contentType: mediaType,\n schema: Option.fromNullishOr(media.schema),\n encoding: Option.fromNullishOr(\n buildEncodingRecord((media as { encoding?: Record<string, unknown> }).encoding),\n ),\n }),\n );\n if (contents.length === 0) return undefined;\n\n // Default = first declared (spec author's preferred order). Callers can\n // override at invoke time with a `contentType` arg.\n const defaultContent = contents[0]!;\n\n return OperationRequestBody.make({\n required: body.required === true,\n contentType: defaultContent.contentType,\n schema: defaultContent.schema,\n contents: Option.some(contents),\n });\n};\n\n// ---------------------------------------------------------------------------\n// Response schema extraction\n// ---------------------------------------------------------------------------\n\nconst extractOutputSchema = (operation: OperationObject, r: DocResolver): unknown | undefined => {\n if (!operation.responses) return undefined;\n\n const entries = Object.entries(operation.responses);\n const preferred = [\n ...entries.filter(([s]) => /^2\\d\\d$/.test(s)).sort(([a], [b]) => a.localeCompare(b)),\n ...entries.filter(([s]) => s === \"default\"),\n ];\n\n for (const [, ref] of preferred) {\n const resp = r.resolve<ResponseObject>(ref);\n if (!resp) continue;\n const content = preferredResponseContent(resp.content);\n if (content?.media.schema) return content.media.schema;\n }\n\n return undefined;\n};\n\n// ---------------------------------------------------------------------------\n// Input schema builder\n// ---------------------------------------------------------------------------\n\n// Optional `server` input — host selection + server-URL variables. Undefined\n// when there's nothing to configure (a single server with no variables).\nconst buildServerInputProperty = (\n servers: readonly ServerInfo[],\n): Record<string, unknown> | undefined => {\n const variableDefs: Record<string, ServerVariable> = {};\n for (const server of servers) {\n for (const [name, v] of Object.entries(Option.getOrUndefined(server.variables) ?? {})) {\n if (!(name in variableDefs)) variableDefs[name] = v;\n }\n }\n const hasMultiple = servers.length > 1;\n const variableNames = Object.keys(variableDefs);\n if (!hasMultiple && variableNames.length === 0) return undefined;\n\n const properties: Record<string, unknown> = {};\n if (hasMultiple) {\n properties.url = {\n type: \"string\",\n enum: servers.map((server) => server.url),\n default: servers[0]!.url,\n description: \"Which of the spec's servers to send the request to.\",\n };\n }\n if (variableNames.length > 0) {\n properties.variables = {\n type: \"object\",\n additionalProperties: false,\n properties: Object.fromEntries(\n Object.entries(variableDefs).map(([name, v]) => [\n name,\n {\n type: \"string\",\n default: v.default,\n ...(Option.isSome(v.enum) ? { enum: v.enum.value } : {}),\n ...(Option.isSome(v.description) ? { description: v.description.value } : {}),\n },\n ]),\n ),\n description: \"Values for the server URL `{variables}`; spec defaults apply when omitted.\",\n };\n }\n return {\n type: \"object\",\n additionalProperties: false,\n properties,\n description: \"Optional host selection and server-URL variables for this request.\",\n };\n};\n\nconst buildInputSchema = (\n parameters: readonly OperationParameter[],\n requestBody: OperationRequestBody | undefined,\n servers: readonly ServerInfo[],\n): Record<string, unknown> | undefined => {\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n for (const param of parameters) {\n properties[param.name] = Option.getOrElse(param.schema, () => ({ type: \"string\" }));\n if (param.required) required.push(param.name);\n }\n\n // A path/query parameter named `server` takes precedence over the host input.\n const serverProperty = buildServerInputProperty(servers);\n if (serverProperty && !(\"server\" in properties)) properties.server = serverProperty;\n\n if (requestBody) {\n properties.body = Option.getOrElse(requestBody.schema, () => ({ type: \"object\" }));\n if (requestBody.required) required.push(\"body\");\n\n // When the spec declares multiple media types for this requestBody,\n // expose `contentType` so the model can pick. Default = first declared.\n // `body` schema tracks the default; the model is responsible for\n // supplying a body shape that matches whichever contentType it picks.\n const contents = Option.getOrUndefined(requestBody.contents);\n if (contents && contents.length > 1) {\n properties.contentType = {\n type: \"string\",\n enum: contents.map((c) => c.contentType),\n default: requestBody.contentType,\n description:\n \"Content-Type for the request body. Declared media types for this operation, in spec order.\",\n };\n }\n }\n\n if (Object.keys(properties).length === 0) return undefined;\n\n return {\n type: \"object\",\n properties,\n ...(required.length > 0 ? { required } : {}),\n additionalProperties: false,\n };\n};\n\n// ---------------------------------------------------------------------------\n// Operation ID derivation\n// ---------------------------------------------------------------------------\n\nconst deriveOperationId = (\n method: HttpMethod,\n pathTemplate: string,\n operation: OperationObject,\n): string =>\n operation.operationId ??\n (`${method}_${pathTemplate.replace(/[^a-zA-Z0-9]+/g, \"_\")}`.replace(/^_+|_+$/g, \"\") ||\n `${method}_operation`);\n\nconst explicitToolPath = (operation: OperationObject): string | undefined => {\n const value = (operation as Record<string, unknown>)[\"x-executor-toolPath\"];\n return typeof value === \"string\" && value.trim().length > 0 ? value.trim() : undefined;\n};\n\nconst explicitPathTemplate = (operation: OperationObject): string | undefined => {\n const value = (operation as Record<string, unknown>)[\"x-executor-pathTemplate\"];\n return typeof value === \"string\" && value.trim().length > 0 ? value.trim() : undefined;\n};\n\n// ---------------------------------------------------------------------------\n// Server extraction\n// ---------------------------------------------------------------------------\n\nconst extractServerList = (servers: readonly ServerObject[] | undefined): ServerInfo[] =>\n (servers ?? []).flatMap((server) => {\n if (!server.url) return [];\n const serverVariables = server.variables as\n | Record<\n string,\n {\n readonly default?: string;\n readonly enum?: readonly string[];\n readonly description?: string;\n }\n >\n | undefined;\n const vars = serverVariables\n ? Object.fromEntries(\n Object.entries(serverVariables).flatMap(([name, v]) => {\n if (v.default === undefined || v.default === null) return [];\n const enumValues = Array.isArray(v.enum)\n ? v.enum.filter((x): x is string => typeof x === \"string\")\n : undefined;\n return [\n [\n name,\n ServerVariable.make({\n default: String(v.default),\n enum:\n enumValues && enumValues.length > 0 ? Option.some(enumValues) : Option.none(),\n description: Option.fromNullishOr(v.description),\n }),\n ],\n ];\n }),\n )\n : undefined;\n return [\n ServerInfo.make({\n url: server.url,\n description: Option.fromNullishOr(server.description),\n variables: vars && Object.keys(vars).length > 0 ? Option.some(vars) : Option.none(),\n }),\n ];\n });\n\nconst extractServers = (doc: ParsedDocument): ServerInfo[] => extractServerList(doc.servers);\n\nconst operationServers = (\n pathItem: PathItemObject,\n operation: OperationObject,\n docServers: readonly ServerInfo[],\n): readonly ServerInfo[] => {\n const operationLevel = extractServerList(operation.servers);\n if (operationLevel.length > 0) return operationLevel;\n const pathLevel = extractServerList(pathItem.servers);\n if (pathLevel.length > 0) return pathLevel;\n return docServers;\n};\n\n// ---------------------------------------------------------------------------\n// Main extraction\n// ---------------------------------------------------------------------------\n\n/** Extract all operations from a bundled OpenAPI 3.x document */\nexport const extract = Effect.fn(\"OpenApi.extract\")(function* (doc: ParsedDocument) {\n const paths = doc.paths;\n if (!paths) {\n return yield* new OpenApiExtractionError({\n message: \"OpenAPI document has no paths defined\",\n });\n }\n\n const r = new DocResolver(doc);\n const docServers = extractServers(doc);\n const operations: ExtractedOperation[] = [];\n\n for (const [pathTemplate, pathItem] of Object.entries(paths).sort(([a], [b]) =>\n a.localeCompare(b),\n )) {\n if (!pathItem) continue;\n\n for (const method of HTTP_METHODS) {\n const operation = pathItem[method];\n if (!operation) continue;\n\n const parameters = extractParameters(pathItem, operation, r);\n const requestBody = extractRequestBody(operation, r);\n const servers = operationServers(pathItem, operation, docServers);\n const inputSchema = buildInputSchema(parameters, requestBody, servers);\n const outputSchema = extractOutputSchema(operation, r);\n const tags = (operation.tags ?? []).filter((t) => t.trim().length > 0);\n const operationPathTemplate = explicitPathTemplate(operation) ?? pathTemplate;\n\n operations.push(\n ExtractedOperation.make({\n operationId: OperationId.make(deriveOperationId(method, pathTemplate, operation)),\n toolPath: Option.fromNullishOr(explicitToolPath(operation)),\n method,\n servers,\n pathTemplate: operationPathTemplate,\n summary: Option.fromNullishOr(operation.summary),\n description: Option.fromNullishOr(operation.description),\n tags,\n parameters,\n requestBody: Option.fromNullishOr(requestBody),\n inputSchema: Option.fromNullishOr(inputSchema),\n outputSchema: Option.fromNullishOr(outputSchema),\n deprecated: operation.deprecated === true,\n }),\n );\n }\n }\n\n return ExtractionResult.make({\n title: Option.fromNullishOr(doc.info?.title),\n description: Option.fromNullishOr(doc.info?.description),\n version: Option.fromNullishOr(doc.info?.version),\n servers: docServers,\n operations,\n });\n});\n","import { Effect, Option, Predicate } from \"effect\";\nimport { Schema } from \"effect\";\n\nimport { parse, resolveSpecText, type ParsedDocument } from \"./parse\";\nimport { extract } from \"./extract\";\nimport { DocResolver } from \"./openapi-utils\";\nimport { HttpMethod, ServerInfo, type ExtractionResult } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// OAuth 2.0 flows — one entry per supported grant type\n// ---------------------------------------------------------------------------\n\n/** Scopes declared by a flow: `{ scopeName: description }` */\nconst OAuth2Scopes = Schema.Record(Schema.String, Schema.String);\nconst SecuritySchemeType = Schema.Literals([\"http\", \"apiKey\", \"oauth2\", \"openIdConnect\"]);\ntype SecuritySchemeType = typeof SecuritySchemeType.Type;\n\nconst decodeSecuritySchemeType = Schema.decodeUnknownOption(SecuritySchemeType);\n\nexport const OAuth2AuthorizationCodeFlow = Schema.Struct({\n authorizationUrl: Schema.String,\n tokenUrl: Schema.String,\n refreshUrl: Schema.OptionFromOptional(Schema.String),\n scopes: OAuth2Scopes,\n});\nexport type OAuth2AuthorizationCodeFlow = typeof OAuth2AuthorizationCodeFlow.Type;\n\nexport const OAuth2ClientCredentialsFlow = Schema.Struct({\n tokenUrl: Schema.String,\n refreshUrl: Schema.OptionFromOptional(Schema.String),\n scopes: OAuth2Scopes,\n});\nexport type OAuth2ClientCredentialsFlow = typeof OAuth2ClientCredentialsFlow.Type;\n\nexport const OAuth2Flows = Schema.Struct({\n authorizationCode: Schema.OptionFromOptional(OAuth2AuthorizationCodeFlow),\n clientCredentials: Schema.OptionFromOptional(OAuth2ClientCredentialsFlow),\n});\nexport type OAuth2Flows = typeof OAuth2Flows.Type;\n\n// ---------------------------------------------------------------------------\n// Security scheme — what the spec declares it needs\n// ---------------------------------------------------------------------------\n\nexport const SecurityScheme = Schema.Struct({\n /** Key name in components.securitySchemes (e.g. \"api_token\") */\n name: Schema.String,\n /** OpenAPI security scheme type */\n type: SecuritySchemeType,\n /** For type: \"http\" — e.g. \"bearer\", \"basic\" */\n scheme: Schema.OptionFromOptional(Schema.String),\n /** For type: \"http\" with scheme \"bearer\" — e.g. \"JWT\" */\n bearerFormat: Schema.OptionFromOptional(Schema.String),\n /** For type: \"apiKey\" — where the key goes */\n in: Schema.OptionFromOptional(Schema.Literals([\"header\", \"query\", \"cookie\"])),\n /** For type: \"apiKey\" — the header/query/cookie name */\n headerName: Schema.OptionFromOptional(Schema.String),\n description: Schema.OptionFromOptional(Schema.String),\n /** For type: \"oauth2\" — declared flows (authorizationCode / clientCredentials only; implicit and password are deprecated). */\n flows: Schema.OptionFromOptional(OAuth2Flows),\n /** For type: \"openIdConnect\" — the discovery URL. */\n openIdConnectUrl: Schema.OptionFromOptional(Schema.String),\n});\nexport type SecurityScheme = typeof SecurityScheme.Type;\n\n// ---------------------------------------------------------------------------\n// Auth strategy — a valid combination of security schemes\n// ---------------------------------------------------------------------------\n\nexport const AuthStrategy = Schema.Struct({\n /** The security schemes required together for this strategy */\n schemes: Schema.Array(Schema.String),\n});\nexport type AuthStrategy = typeof AuthStrategy.Type;\n\n// ---------------------------------------------------------------------------\n// Header preset — derived from an auth strategy\n// ---------------------------------------------------------------------------\n\nexport const HeaderPreset = Schema.Struct({\n /** Human-readable label for the UI (e.g. \"Bearer Token\", \"API Key + Email\") */\n label: Schema.String,\n /** Headers this strategy needs. Value is null when the user must provide it. */\n headers: Schema.Record(Schema.String, Schema.NullOr(Schema.String)),\n /** Which headers should be stored as secrets */\n secretHeaders: Schema.Array(Schema.String),\n});\nexport type HeaderPreset = typeof HeaderPreset.Type;\n\n// ---------------------------------------------------------------------------\n// OAuth2 preset — derived from an oauth2 security scheme + a flow choice\n// ---------------------------------------------------------------------------\n\nexport const OAuth2Preset = Schema.Struct({\n /** Human-readable label for the UI (e.g. \"OAuth2 (Authorization Code) — oauth_app\") */\n label: Schema.String,\n /** The source security scheme this preset came from (components.securitySchemes key). */\n securitySchemeName: Schema.String,\n /** Which OAuth2 flow this preset uses. */\n flow: Schema.Literals([\"authorizationCode\", \"clientCredentials\"]),\n /** For authorizationCode: user-agent redirect URL (from the spec). */\n authorizationUrl: Schema.OptionFromOptional(Schema.String),\n /** Token endpoint to exchange the code / refresh. */\n tokenUrl: Schema.String,\n /** Optional refresh endpoint if the spec declares one separately. */\n refreshUrl: Schema.OptionFromOptional(Schema.String),\n /** Declared scopes for this flow: `{ scope: description }`. */\n scopes: Schema.Record(Schema.String, Schema.String),\n /** Identity scopes to request alongside API scopes. `\"auto\"` discovers standard OIDC scopes. */\n identityScopes: Schema.Union([\n Schema.Literal(\"auto\"),\n Schema.Literal(false),\n Schema.Array(Schema.String),\n ]),\n});\nexport type OAuth2Preset = typeof OAuth2Preset.Type;\n\n// ---------------------------------------------------------------------------\n// Preview operation — lightweight shape for the add-source UI list\n// ---------------------------------------------------------------------------\n\nexport const PreviewOperation = Schema.Struct({\n operationId: Schema.String,\n method: HttpMethod,\n path: Schema.String,\n summary: Schema.OptionFromOptional(Schema.String),\n tags: Schema.Array(Schema.String),\n deprecated: Schema.Boolean,\n});\nexport type PreviewOperation = typeof PreviewOperation.Type;\n\n// ---------------------------------------------------------------------------\n// Spec preview — everything the frontend needs\n// ---------------------------------------------------------------------------\n\nexport const SpecPreview = Schema.Struct({\n title: Schema.OptionFromOptional(Schema.String),\n /** The spec's `info.description` — prefills the add form's description field. */\n description: Schema.OptionFromOptional(Schema.String),\n version: Schema.OptionFromOptional(Schema.String),\n /** Reuses ServerInfo from extraction */\n servers: Schema.Array(ServerInfo),\n operationCount: Schema.Number,\n /** Lightweight operation list for the add-source UI */\n operations: Schema.Array(PreviewOperation),\n tags: Schema.Array(Schema.String),\n securitySchemes: Schema.Array(SecurityScheme),\n /** Valid auth strategies (each is a set of schemes used together) */\n authStrategies: Schema.Array(AuthStrategy),\n /** Pre-built header presets derived from auth strategies */\n headerPresets: Schema.Array(HeaderPreset),\n /** OAuth2 presets — one per (oauth2 scheme × supported flow) combination */\n oauth2Presets: Schema.Array(OAuth2Preset),\n});\nexport type SpecPreview = typeof SpecPreview.Type;\n\n// ---------------------------------------------------------------------------\n// Security scheme extraction\n// ---------------------------------------------------------------------------\n\nconst stringRecord = (value: unknown): Record<string, string> => {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return {};\n const out: Record<string, string> = {};\n for (const [k, v] of Object.entries(value as Record<string, unknown>)) {\n if (typeof v === \"string\") out[k] = v;\n }\n return out;\n};\n\nconst extractFlows = (rawFlows: unknown): Option.Option<OAuth2Flows> => {\n if (!rawFlows || typeof rawFlows !== \"object\") return Option.none();\n const flows = rawFlows as Record<string, unknown>;\n\n const parseFlow = <K extends \"authorizationCode\" | \"clientCredentials\">(key: K): unknown =>\n flows[key];\n\n let authorizationCode: Option.Option<OAuth2AuthorizationCodeFlow> = Option.none();\n const authCodeRaw = parseFlow(\"authorizationCode\");\n if (authCodeRaw && typeof authCodeRaw === \"object\") {\n const f = authCodeRaw as Record<string, unknown>;\n const authUrl = typeof f.authorizationUrl === \"string\" ? f.authorizationUrl : null;\n const tokenUrl = typeof f.tokenUrl === \"string\" ? f.tokenUrl : null;\n if (authUrl && tokenUrl) {\n authorizationCode = Option.some(\n OAuth2AuthorizationCodeFlow.make({\n authorizationUrl: authUrl,\n tokenUrl,\n refreshUrl: Option.fromNullishOr(\n typeof f.refreshUrl === \"string\" ? f.refreshUrl : undefined,\n ),\n scopes: stringRecord(f.scopes),\n }),\n );\n }\n }\n\n let clientCredentials: Option.Option<OAuth2ClientCredentialsFlow> = Option.none();\n const ccRaw = parseFlow(\"clientCredentials\");\n if (ccRaw && typeof ccRaw === \"object\") {\n const f = ccRaw as Record<string, unknown>;\n const tokenUrl = typeof f.tokenUrl === \"string\" ? f.tokenUrl : null;\n if (tokenUrl) {\n clientCredentials = Option.some(\n OAuth2ClientCredentialsFlow.make({\n tokenUrl,\n refreshUrl: Option.fromNullishOr(\n typeof f.refreshUrl === \"string\" ? f.refreshUrl : undefined,\n ),\n scopes: stringRecord(f.scopes),\n }),\n );\n }\n }\n\n if (Option.isNone(authorizationCode) && Option.isNone(clientCredentials)) {\n return Option.none();\n }\n return Option.some(OAuth2Flows.make({ authorizationCode, clientCredentials }));\n};\n\nconst extractSecuritySchemes = (\n rawSchemes: Record<string, unknown>,\n resolver: DocResolver,\n): SecurityScheme[] =>\n Object.entries(rawSchemes).flatMap(([name, schemeOrRef]) => {\n if (!schemeOrRef || typeof schemeOrRef !== \"object\") return [];\n // Resolve $ref so schemes defined via `$ref` aren't silently dropped.\n const resolved = resolver.resolve<Record<string, unknown>>(\n schemeOrRef as Record<string, unknown>,\n );\n if (!resolved || typeof resolved !== \"object\") return [];\n const scheme = resolved;\n\n const type = decodeSecuritySchemeType(scheme.type);\n if (Option.isNone(type)) return [];\n const schemeType = type.value;\n\n return [\n SecurityScheme.make({\n name,\n type: schemeType,\n scheme: Option.fromNullishOr(scheme.scheme as string | undefined),\n bearerFormat: Option.fromNullishOr(scheme.bearerFormat as string | undefined),\n in: Option.fromNullishOr(scheme.in as \"header\" | \"query\" | \"cookie\" | undefined),\n headerName: Option.fromNullishOr(scheme.name as string | undefined),\n description: Option.fromNullishOr(scheme.description as string | undefined),\n flows: schemeType === \"oauth2\" ? extractFlows(scheme.flows) : Option.none(),\n openIdConnectUrl: Option.fromNullishOr(scheme.openIdConnectUrl as string | undefined),\n }),\n ];\n });\n\n// ---------------------------------------------------------------------------\n// Header preset builder\n// ---------------------------------------------------------------------------\n\nconst buildHeaderPresets = (\n schemes: readonly SecurityScheme[],\n strategies: readonly AuthStrategy[],\n): HeaderPreset[] => {\n const schemeMap = new Map(schemes.map((s) => [s.name, s]));\n\n return strategies.flatMap((strategy) => {\n const resolved = strategy.schemes\n .map((name) => schemeMap.get(name))\n .filter(Predicate.isNotUndefined);\n\n if (resolved.length === 0) return [];\n\n const headers: Record<string, string | null> = {};\n const secretHeaders: string[] = [];\n const labelParts: string[] = [];\n\n for (const scheme of resolved) {\n if (scheme.type === \"http\" && Option.getOrElse(scheme.scheme, () => \"\") === \"bearer\") {\n headers[\"Authorization\"] = null;\n secretHeaders.push(\"Authorization\");\n labelParts.push(\"Bearer Token\");\n } else if (scheme.type === \"http\" && Option.getOrElse(scheme.scheme, () => \"\") === \"basic\") {\n headers[\"Authorization\"] = null;\n secretHeaders.push(\"Authorization\");\n labelParts.push(\"Basic Auth\");\n } else if (scheme.type === \"apiKey\" && Option.getOrElse(scheme.in, () => \"\") === \"header\") {\n const headerName = Option.getOrElse(scheme.headerName, () => scheme.name);\n headers[headerName] = null;\n secretHeaders.push(headerName);\n labelParts.push(scheme.name);\n } else if (scheme.type === \"apiKey\") {\n labelParts.push(`${scheme.name} (${Option.getOrElse(scheme.in, () => \"unknown\")})`);\n } else if (scheme.type === \"oauth2\" || scheme.type === \"openIdConnect\") {\n return [];\n } else {\n labelParts.push(scheme.name);\n }\n }\n\n if (Object.keys(headers).length === 0 && resolved.length > 0) {\n return [\n HeaderPreset.make({\n label: labelParts.join(\" + \"),\n headers: {},\n secretHeaders: [],\n }),\n ];\n }\n\n return [\n HeaderPreset.make({\n label: labelParts.join(\" + \"),\n headers,\n secretHeaders,\n }),\n ];\n });\n};\n\n// ---------------------------------------------------------------------------\n// OAuth2 preset builder\n// ---------------------------------------------------------------------------\n\nconst buildOAuth2Presets = (schemes: readonly SecurityScheme[]): OAuth2Preset[] => {\n const presets: OAuth2Preset[] = [];\n for (const scheme of schemes) {\n if (scheme.type !== \"oauth2\") continue;\n if (Option.isNone(scheme.flows)) continue;\n const flows = scheme.flows.value;\n\n if (Option.isSome(flows.authorizationCode)) {\n const flow = flows.authorizationCode.value;\n presets.push(\n OAuth2Preset.make({\n label: `OAuth2 Authorization Code · ${scheme.name}`,\n securitySchemeName: scheme.name,\n flow: \"authorizationCode\",\n authorizationUrl: Option.some(flow.authorizationUrl),\n tokenUrl: flow.tokenUrl,\n refreshUrl: flow.refreshUrl,\n scopes: flow.scopes,\n identityScopes: \"auto\",\n }),\n );\n }\n\n if (Option.isSome(flows.clientCredentials)) {\n const flow = flows.clientCredentials.value;\n presets.push(\n OAuth2Preset.make({\n label: `OAuth2 Client Credentials · ${scheme.name}`,\n securitySchemeName: scheme.name,\n flow: \"clientCredentials\",\n authorizationUrl: Option.none(),\n tokenUrl: flow.tokenUrl,\n refreshUrl: flow.refreshUrl,\n scopes: flow.scopes,\n identityScopes: false,\n }),\n );\n }\n }\n return presets;\n};\n\n// ---------------------------------------------------------------------------\n// Collect unique tags from extraction result\n// ---------------------------------------------------------------------------\n\nconst collectTags = (result: ExtractionResult): string[] => {\n const tagSet = new Set<string>();\n for (const op of result.operations) {\n for (const tag of op.tags) tagSet.add(tag);\n }\n return [...tagSet].sort();\n};\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/** Preview already-resolved spec text — extract metadata without registering\n * anything and without any HTTP dependency. */\nexport const previewSpecText = Effect.fn(\"OpenApi.previewSpecText\")(function* (specText: string) {\n const doc: ParsedDocument = yield* parse(specText);\n const result = yield* extract(doc);\n\n const resolver = new DocResolver(doc);\n const securitySchemes = extractSecuritySchemes(doc.components?.securitySchemes ?? {}, resolver);\n\n const rawSecurity = (doc.security ?? []) as Array<Record<string, unknown>>;\n const declaredStrategies = rawSecurity.map((entry) =>\n AuthStrategy.make({ schemes: Object.keys(entry) }),\n );\n // Fall back to one strategy per scheme when the spec only declares schemes\n // under components (e.g. Sentry) so the user still sees auth options.\n const authStrategies =\n declaredStrategies.length > 0\n ? declaredStrategies\n : securitySchemes.map((scheme) => AuthStrategy.make({ schemes: [scheme.name] }));\n\n return SpecPreview.make({\n title: result.title,\n description: result.description,\n version: result.version,\n servers: result.servers,\n operationCount: result.operations.length,\n operations: result.operations.map((op) =>\n PreviewOperation.make({\n operationId: op.operationId,\n method: op.method,\n path: op.pathTemplate,\n summary: op.summary,\n tags: op.tags,\n deprecated: op.deprecated,\n }),\n ),\n tags: collectTags(result),\n securitySchemes,\n authStrategies,\n headerPresets: buildHeaderPresets(securitySchemes, authStrategies),\n oauth2Presets: buildOAuth2Presets(securitySchemes),\n });\n});\n\n/** Preview an OpenAPI spec — extract metadata without registering anything.\n * Accepts either a URL or raw JSON/YAML text. */\nexport const previewSpec = Effect.fn(\"OpenApi.previewSpec\")(function* (input: string) {\n const specText = yield* resolveSpecText(input);\n return yield* previewSpecText(specText);\n});\n"],"mappings":";AAAA,SAAS,MAAM,cAAc;AAWtB,IAAM,oBAAN,cAAgC,OAAO,iBAAoC;AAAA,EAChF;AAAA,EACA;AAAA,IACE,SAAS,OAAO;AAAA,EAClB;AAAA,EACA,EAAE,eAAe,IAAI;AACvB,EAAE;AAAC;AAEI,IAAM,yBAAN,cAAqC,OAAO,iBAAyC;AAAA,EAC1F;AAAA,EACA;AAAA,IACE,SAAS,OAAO;AAAA,EAClB;AAAA,EACA,EAAE,eAAe,IAAI;AACvB,EAAE;AAAC;AAEI,IAAM,yBAAN,cAAqC,KAAK,YAAY,wBAAwB,EAIlF;AAAC;AAEG,IAAM,oBAAN,cAAgC,OAAO,iBAAoC;AAAA,EAChF;AAAA,EACA;AAAA,IACE,SAAS,OAAO;AAAA,EAClB;AAAA,EACA,EAAE,eAAe,IAAI;AACvB,EAAE;AAAC;AAOI,IAAM,2BAAN,cAAuC,KAAK,YAAY,0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AI,CAAC,OACjC,iBAAiB,KAAK;AAAA,QACpB,aAAa,GAAG;AAAA,QAChB,QAAQ,GAAG;AAAA,QACX,MAAM,GAAG;AAAA,QACT,SAAS,GAAG;AAAA,QACZ,MAAM,GAAG;AAAA,QACT,YAAY,GAAG;AAAA,MACjB,CAAC;AAAA,IACH;AAAA,IACA,MAAM,YAAY,MAAM;AAAA,IACxB;AAAA,IACA;AAAA,IACA,eAAe,mBAAmB,iBAAiB,cAAc;AAAA,IACjE,eAAe,mBAAmB,eAAe;AAAA,EACnD,CAAC;AACH,CAAC;AAIM,IAAM,cAAcA,QAAO,GAAG,qBAAqB,EAAE,WAAW,OAAe;AACpF,QAAM,WAAW,OAAO,gBAAgB,KAAK;AAC7C,SAAO,OAAO,gBAAgB,QAAQ;AACxC,CAAC;","names":["Schema","Schema","Schema","Effect","Effect","Effect","Option","Schema","Schema","Option","Effect"]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
OpenApiOAuthError,
|
|
4
4
|
OpenApiParseError,
|
|
5
5
|
SpecPreview
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RFSMGUBJ.js";
|
|
7
7
|
|
|
8
8
|
// src/react/atoms.ts
|
|
9
9
|
import * as Atom from "effect/unstable/reactivity/Atom";
|
|
@@ -23,6 +23,7 @@ import { ApiKeyAuthMethod, ApiKeyAuthTemplate } from "@executor-js/sdk/http-auth
|
|
|
23
23
|
import {
|
|
24
24
|
InternalError,
|
|
25
25
|
IntegrationAlreadyExistsError,
|
|
26
|
+
IntegrationNotFoundError,
|
|
26
27
|
IntegrationSlug
|
|
27
28
|
} from "@executor-js/sdk/shared";
|
|
28
29
|
var DomainErrors = [
|
|
@@ -32,6 +33,14 @@ var DomainErrors = [
|
|
|
32
33
|
OpenApiOAuthError,
|
|
33
34
|
IntegrationAlreadyExistsError
|
|
34
35
|
];
|
|
36
|
+
var IntegrationNotFound = IntegrationNotFoundError.annotate({ httpApiStatus: 404 });
|
|
37
|
+
var UpdateSpecErrors = [
|
|
38
|
+
InternalError,
|
|
39
|
+
OpenApiParseError,
|
|
40
|
+
OpenApiExtractionError,
|
|
41
|
+
OpenApiOAuthError,
|
|
42
|
+
IntegrationNotFound
|
|
43
|
+
];
|
|
35
44
|
var SlugParams = {
|
|
36
45
|
slug: Schema.String
|
|
37
46
|
};
|
|
@@ -59,6 +68,7 @@ var AuthenticationResponse = Schema.Union([OAuthTemplatePayload, ApiKeyAuthMetho
|
|
|
59
68
|
var AddSpecPayload = Schema.Struct({
|
|
60
69
|
spec: OpenApiSpecInputPayload,
|
|
61
70
|
slug: Schema.String,
|
|
71
|
+
name: Schema.optional(Schema.String),
|
|
62
72
|
description: Schema.optional(Schema.String),
|
|
63
73
|
baseUrl: Schema.optional(Schema.String),
|
|
64
74
|
headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
@@ -76,6 +86,17 @@ var AddSpecResponse = Schema.Struct({
|
|
|
76
86
|
slug: IntegrationSlug,
|
|
77
87
|
toolCount: Schema.Number
|
|
78
88
|
});
|
|
89
|
+
var UpdateSpecPayload = Schema.Struct({
|
|
90
|
+
spec: Schema.optional(OpenApiSpecInputPayload)
|
|
91
|
+
});
|
|
92
|
+
var UpdateSpecResponse = Schema.Struct({
|
|
93
|
+
slug: IntegrationSlug,
|
|
94
|
+
toolCount: Schema.Number,
|
|
95
|
+
/** Tool names new in this spec version (same diff for every connection). */
|
|
96
|
+
addedTools: Schema.Array(Schema.String),
|
|
97
|
+
/** Tool names the new spec no longer defines. */
|
|
98
|
+
removedTools: Schema.Array(Schema.String)
|
|
99
|
+
});
|
|
79
100
|
var IntegrationView = Schema.Struct({
|
|
80
101
|
slug: IntegrationSlug,
|
|
81
102
|
description: Schema.String,
|
|
@@ -125,6 +146,13 @@ var OpenApiGroup = HttpApiGroup.make("openapi").add(
|
|
|
125
146
|
success: ConfigureResponse,
|
|
126
147
|
error: DomainErrors
|
|
127
148
|
})
|
|
149
|
+
).add(
|
|
150
|
+
HttpApiEndpoint.post("updateSpec", "/openapi/integrations/:slug/spec", {
|
|
151
|
+
params: SlugParams,
|
|
152
|
+
payload: UpdateSpecPayload,
|
|
153
|
+
success: UpdateSpecResponse,
|
|
154
|
+
error: UpdateSpecErrors
|
|
155
|
+
})
|
|
128
156
|
).add(
|
|
129
157
|
HttpApiEndpoint.delete("removeSpec", "/openapi/integrations/:slug", {
|
|
130
158
|
params: SlugParams,
|
|
@@ -153,15 +181,16 @@ var openApiConfigAtom = (slug) => OpenApiClient.query("openapi", "getConfig", {
|
|
|
153
181
|
var previewOpenApiSpec = OpenApiClient.mutation("openapi", "previewSpec");
|
|
154
182
|
var addOpenApiSpec = OpenApiClient.mutation("openapi", "addSpec");
|
|
155
183
|
var removeOpenApiSpec = OpenApiClient.mutation("openapi", "removeSpec");
|
|
184
|
+
var updateOpenApiSpec = OpenApiClient.mutation("openapi", "updateSpec");
|
|
156
185
|
var openapiConfigure = OpenApiClient.mutation("openapi", "configure");
|
|
157
186
|
var openApiIntegrationFamily = Atom.family(openApiIntegrationAtom);
|
|
158
187
|
var openApiConfigFamily = Atom.family(openApiConfigAtom);
|
|
159
188
|
|
|
160
189
|
export {
|
|
161
|
-
openApiIntegrationAtom,
|
|
162
190
|
openApiConfigAtom,
|
|
163
191
|
previewOpenApiSpec,
|
|
164
192
|
addOpenApiSpec,
|
|
193
|
+
updateOpenApiSpec,
|
|
165
194
|
openapiConfigure
|
|
166
195
|
};
|
|
167
|
-
//# sourceMappingURL=chunk-
|
|
196
|
+
//# sourceMappingURL=chunk-UJTNRH4Q.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react/atoms.ts","../src/react/client.ts","../src/api/group.ts"],"sourcesContent":["import type { IntegrationSlug } from \"@executor-js/sdk/shared\";\nimport * as Atom from \"effect/unstable/reactivity/Atom\";\nimport { ReactivityKey } from \"@executor-js/react/api/reactivity-keys\";\nimport { OpenApiClient } from \"./client\";\n\n// ---------------------------------------------------------------------------\n// Query atoms — v2: the integration catalog is the unit of identity (the v1\n// per-scope `source` row is gone). `getIntegration` returns the catalog entry\n// (slug/description/kind/canRemove/canRefresh); credentials are owner-scoped\n// connections read from the shared `connections` API, not bound per source.\n// ---------------------------------------------------------------------------\n\nexport const openApiIntegrationAtom = (slug: IntegrationSlug) =>\n OpenApiClient.query(\"openapi\", \"getIntegration\", {\n params: { slug },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.integrations, ReactivityKey.tools],\n });\n\n// The full opaque config (including `authenticationTemplate`), used by the\n// configure UX to render existing auth methods and add custom ones.\nexport const openApiConfigAtom = (slug: IntegrationSlug) =>\n OpenApiClient.query(\"openapi\", \"getConfig\", {\n params: { slug },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.integrations, ReactivityKey.tools],\n });\n\n// ---------------------------------------------------------------------------\n// Mutation atoms\n// ---------------------------------------------------------------------------\n\nexport const previewOpenApiSpec = OpenApiClient.mutation(\"openapi\", \"previewSpec\");\n\nexport const addOpenApiSpec = OpenApiClient.mutation(\"openapi\", \"addSpec\");\n\nexport const removeOpenApiSpec = OpenApiClient.mutation(\"openapi\", \"removeSpec\");\n\n/** Re-fetch (or replace) the integration's spec and rebuild its tools in\n * place — connections, policies, and the description survive. Pass\n * `reactivityKeys: integrationWriteKeys` at the call site. */\nexport const updateOpenApiSpec = OpenApiClient.mutation(\"openapi\", \"updateSpec\");\n\n// Add / merge custom auth methods onto an integration's `authenticationTemplate`.\nexport const openapiConfigure = OpenApiClient.mutation(\"openapi\", \"configure\");\n\n// `getIntegration` is read-only; the atom family lets a caller pass a slug.\nexport const openApiIntegrationFamily = Atom.family(openApiIntegrationAtom);\n\n// `getConfig` is read-only; the atom family lets a caller pass a slug.\nexport const openApiConfigFamily = Atom.family(openApiConfigAtom);\n","import { createPluginAtomClient } from \"@executor-js/sdk/client\";\nimport {\n getExecutorApiBaseUrl,\n getExecutorServerAuthorizationHeader,\n} from \"@executor-js/react/api/server-connection\";\nimport { OpenApiGroup } from \"../api/group\";\n\nexport const OpenApiClient = createPluginAtomClient(OpenApiGroup, {\n baseUrl: getExecutorApiBaseUrl,\n authorizationHeader: getExecutorServerAuthorizationHeader,\n});\n","import { HttpApiEndpoint, HttpApiGroup } from \"effect/unstable/httpapi\";\nimport { Schema } from \"effect\";\nimport { ApiKeyAuthMethod, ApiKeyAuthTemplate } from \"@executor-js/sdk/http-auth\";\nimport {\n InternalError,\n IntegrationAlreadyExistsError,\n IntegrationNotFoundError,\n IntegrationSlug,\n} from \"@executor-js/sdk/shared\";\n\nimport { OpenApiParseError, OpenApiExtractionError, OpenApiOAuthError } from \"../sdk/errors\";\nimport { SpecPreview } from \"../sdk/preview\";\n\n// ---------------------------------------------------------------------------\n// Errors — the plugin-domain tagged errors flow directly to clients\n// (4xx, each carrying its own `httpApiStatus`). `InternalError` is the shared\n// opaque 500 surface; `StorageError` → `InternalError` translation happens at\n// service wiring time. `IntegrationAlreadyExistsError` (409) blocks re-adding\n// an existing slug — see addSpec.\n// ---------------------------------------------------------------------------\n\nconst DomainErrors = [\n InternalError,\n OpenApiParseError,\n OpenApiExtractionError,\n OpenApiOAuthError,\n IntegrationAlreadyExistsError,\n] as const;\n\nconst IntegrationNotFound = IntegrationNotFoundError.annotate({ httpApiStatus: 404 });\n\nconst UpdateSpecErrors = [\n InternalError,\n OpenApiParseError,\n OpenApiExtractionError,\n OpenApiOAuthError,\n IntegrationNotFound,\n] as const;\n\nconst SlugParams = {\n slug: Schema.String,\n};\n\n// ---------------------------------------------------------------------------\n// Payloads\n// ---------------------------------------------------------------------------\n\nconst OpenApiSpecInputPayload = Schema.Union([\n Schema.Struct({ kind: Schema.Literal(\"url\"), url: Schema.String }),\n Schema.Struct({ kind: Schema.Literal(\"blob\"), value: Schema.String }),\n Schema.Struct({\n kind: Schema.Literal(\"googleDiscovery\"),\n url: Schema.String,\n }),\n Schema.Struct({\n kind: Schema.Literal(\"googleDiscoveryBundle\"),\n urls: Schema.Array(Schema.String),\n }),\n]);\n\nconst OAuthTemplatePayload = Schema.Struct({\n slug: Schema.String,\n kind: Schema.Literal(\"oauth2\"),\n authorizationUrl: Schema.String,\n tokenUrl: Schema.String,\n scopes: Schema.Array(Schema.String),\n});\n\n/** Auth INPUTS: oauth templates + the request-shaped apikey dialect. */\nconst AuthenticationPayload = Schema.Union([OAuthTemplatePayload, ApiKeyAuthTemplate]);\n\n/** Auth in RESPONSES: the canonical stored shapes (placements). */\nconst AuthenticationResponse = Schema.Union([OAuthTemplatePayload, ApiKeyAuthMethod]);\n\nconst AddSpecPayload = Schema.Struct({\n spec: OpenApiSpecInputPayload,\n slug: Schema.String,\n name: Schema.optional(Schema.String),\n description: Schema.optional(Schema.String),\n baseUrl: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n authenticationTemplate: Schema.optional(Schema.Array(AuthenticationPayload)),\n});\n\nconst PreviewSpecPayload = Schema.Struct({\n spec: Schema.String,\n});\n\n// The `configure` payload — the new/updated auth methods to merge onto the\n// integration's `authenticationTemplate`. Reuses the same `AuthenticationPayload`\n// schema as `addSpec` so a custom apiKey method round-trips identically.\nconst ConfigurePayload = Schema.Struct({\n authenticationTemplate: Schema.Array(AuthenticationPayload),\n mode: Schema.optional(Schema.Literals([\"merge\", \"replace\"])),\n});\n\n// ---------------------------------------------------------------------------\n// Responses\n// ---------------------------------------------------------------------------\n\nconst AddSpecResponse = Schema.Struct({\n slug: IntegrationSlug,\n toolCount: Schema.Number,\n});\n\n// Update the spec in place. Body optional fields only: an empty payload means\n// \"re-fetch from the stored source URL\".\nconst UpdateSpecPayload = Schema.Struct({\n spec: Schema.optional(OpenApiSpecInputPayload),\n});\n\nconst UpdateSpecResponse = Schema.Struct({\n slug: IntegrationSlug,\n toolCount: Schema.Number,\n /** Tool names new in this spec version (same diff for every connection). */\n addedTools: Schema.Array(Schema.String),\n /** Tool names the new spec no longer defines. */\n removedTools: Schema.Array(Schema.String),\n});\n\nconst IntegrationView = Schema.Struct({\n slug: IntegrationSlug,\n description: Schema.String,\n kind: Schema.String,\n canRemove: Schema.Boolean,\n canRefresh: Schema.Boolean,\n});\n\n// The integration config surfaced for the configure UX. Unlike\n// `IntegrationView` (catalog identity only), this carries the\n// `authenticationTemplate` the configure flow reads/writes. The spec text is\n// deliberately NOT served: it's a multi-MB build artifact in the plugin blob\n// store, and no client reads it (the configure UI only touches the template).\nconst OpenApiConfigView = Schema.Struct({\n sourceUrl: Schema.optional(Schema.String),\n googleDiscoveryUrls: Schema.optional(Schema.Array(Schema.String)),\n baseUrl: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n authenticationTemplate: Schema.optional(Schema.Array(AuthenticationResponse)),\n});\n\n// The configure result — the merged `authenticationTemplate` after the new\n// custom methods were appended/replaced.\nconst ConfigureResponse = Schema.Struct({\n authenticationTemplate: Schema.Array(AuthenticationResponse),\n});\n\n// ---------------------------------------------------------------------------\n// Group — addSpec/preview/get/remove over the integration catalog.\n// ---------------------------------------------------------------------------\n\nexport const OpenApiGroup = HttpApiGroup.make(\"openapi\")\n .add(\n HttpApiEndpoint.post(\"previewSpec\", \"/openapi/preview\", {\n payload: PreviewSpecPayload,\n success: SpecPreview,\n error: DomainErrors,\n }),\n )\n .add(\n HttpApiEndpoint.post(\"addSpec\", \"/openapi/specs\", {\n payload: AddSpecPayload,\n success: AddSpecResponse,\n error: DomainErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\"getIntegration\", \"/openapi/integrations/:slug\", {\n params: SlugParams,\n success: Schema.NullOr(IntegrationView),\n error: DomainErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\"getConfig\", \"/openapi/integrations/:slug/config\", {\n params: SlugParams,\n success: Schema.NullOr(OpenApiConfigView),\n error: DomainErrors,\n }),\n )\n .add(\n HttpApiEndpoint.post(\"configure\", \"/openapi/integrations/:slug/config\", {\n params: SlugParams,\n payload: ConfigurePayload,\n success: ConfigureResponse,\n error: DomainErrors,\n }),\n )\n .add(\n HttpApiEndpoint.post(\"updateSpec\", \"/openapi/integrations/:slug/spec\", {\n params: SlugParams,\n payload: UpdateSpecPayload,\n success: UpdateSpecResponse,\n error: UpdateSpecErrors,\n }),\n )\n .add(\n HttpApiEndpoint.delete(\"removeSpec\", \"/openapi/integrations/:slug\", {\n params: SlugParams,\n success: Schema.Void,\n error: DomainErrors,\n }),\n );\n"],"mappings":";;;;;;;;AACA,YAAY,UAAU;AACtB,SAAS,qBAAqB;;;ACF9B,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,cAAc;AACvB,SAAS,kBAAkB,0BAA0B;AACrD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAaP,IAAM,eAAe;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,sBAAsB,yBAAyB,SAAS,EAAE,eAAe,IAAI,CAAC;AAEpF,IAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,aAAa;AAAA,EACjB,MAAM,OAAO;AACf;AAMA,IAAM,0BAA0B,OAAO,MAAM;AAAA,EAC3C,OAAO,OAAO,EAAE,MAAM,OAAO,QAAQ,KAAK,GAAG,KAAK,OAAO,OAAO,CAAC;AAAA,EACjE,OAAO,OAAO,EAAE,MAAM,OAAO,QAAQ,MAAM,GAAG,OAAO,OAAO,OAAO,CAAC;AAAA,EACpE,OAAO,OAAO;AAAA,IACZ,MAAM,OAAO,QAAQ,iBAAiB;AAAA,IACtC,KAAK,OAAO;AAAA,EACd,CAAC;AAAA,EACD,OAAO,OAAO;AAAA,IACZ,MAAM,OAAO,QAAQ,uBAAuB;AAAA,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,iBAAiB;","names":[]}
|
package/dist/client.js
CHANGED
|
@@ -8,19 +8,19 @@ import { defineClientPlugin } from "@executor-js/sdk/client";
|
|
|
8
8
|
|
|
9
9
|
// src/react/source-plugin.ts
|
|
10
10
|
import { lazy } from "react";
|
|
11
|
-
var importAdd = () => import("./AddOpenApiSource-
|
|
12
|
-
var
|
|
13
|
-
var importAccounts = () => import("./OpenApiAccountsPanel-
|
|
11
|
+
var importAdd = () => import("./AddOpenApiSource-JFSFWLBZ.js");
|
|
12
|
+
var importEditSheet = () => import("./UpdateSpecSection-D32QZT3Q.js");
|
|
13
|
+
var importAccounts = () => import("./OpenApiAccountsPanel-2LHWUKIE.js");
|
|
14
14
|
var openApiIntegrationPlugin = {
|
|
15
15
|
key: "openapi",
|
|
16
16
|
label: "OpenAPI",
|
|
17
17
|
add: lazy(importAdd),
|
|
18
|
-
|
|
18
|
+
editSheet: lazy(importEditSheet),
|
|
19
19
|
accounts: lazy(importAccounts),
|
|
20
20
|
presets: openApiPresets,
|
|
21
21
|
preload: () => {
|
|
22
22
|
void importAdd();
|
|
23
|
-
void
|
|
23
|
+
void importEditSheet();
|
|
24
24
|
void importAccounts();
|
|
25
25
|
}
|
|
26
26
|
};
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/plugin-client.tsx","../src/react/source-plugin.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// @executor-js/plugin-openapi/client — `defineClientPlugin` entry.\n//\n// Aggregates the openapi plugin's frontend contributions into a single\n// declarative spec. The host's Vite plugin reads this via\n// `virtual:executor/plugins-client`, so the host's sources page derives\n// the openapi entry from here without a direct `*/react` import.\n//\n// The richer add/edit/summary components still live in `./react`; this\n// module just imports them and bundles them into the spec.\n// ---------------------------------------------------------------------------\n\nimport { defineClientPlugin } from \"@executor-js/sdk/client\";\n\nimport { openApiIntegrationPlugin } from \"./source-plugin\";\n\nexport default defineClientPlugin({\n id: \"openapi\" as const,\n integrationPlugin: openApiIntegrationPlugin,\n});\n","import { lazy } from \"react\";\nimport type { IntegrationPlugin } from \"@executor-js/sdk/client\";\nimport { openApiPresets } from \"../sdk/presets\";\n\nconst importAdd = () => import(\"./AddOpenApiSource\");\nconst
|
|
1
|
+
{"version":3,"sources":["../src/react/plugin-client.tsx","../src/react/source-plugin.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// @executor-js/plugin-openapi/client — `defineClientPlugin` entry.\n//\n// Aggregates the openapi plugin's frontend contributions into a single\n// declarative spec. The host's Vite plugin reads this via\n// `virtual:executor/plugins-client`, so the host's sources page derives\n// the openapi entry from here without a direct `*/react` import.\n//\n// The richer add/edit/summary components still live in `./react`; this\n// module just imports them and bundles them into the spec.\n// ---------------------------------------------------------------------------\n\nimport { defineClientPlugin } from \"@executor-js/sdk/client\";\n\nimport { openApiIntegrationPlugin } from \"./source-plugin\";\n\nexport default defineClientPlugin({\n id: \"openapi\" as const,\n integrationPlugin: openApiIntegrationPlugin,\n});\n","import { lazy } from \"react\";\nimport type { IntegrationPlugin } from \"@executor-js/sdk/client\";\nimport { openApiPresets } from \"../sdk/presets\";\n\nconst importAdd = () => import(\"./AddOpenApiSource\");\nconst importEditSheet = () => import(\"./UpdateSpecSection\");\nconst importAccounts = () => import(\"./OpenApiAccountsPanel\");\n\nexport const openApiIntegrationPlugin: IntegrationPlugin = {\n key: \"openapi\",\n label: \"OpenAPI\",\n add: lazy(importAdd),\n editSheet: lazy(importEditSheet),\n accounts: lazy(importAccounts),\n presets: openApiPresets,\n preload: () => {\n void importAdd();\n void importEditSheet();\n void importAccounts();\n },\n};\n"],"mappings":";;;;;;AAYA,SAAS,0BAA0B;;;ACZnC,SAAS,YAAY;AAIrB,IAAM,YAAY,MAAM,OAAO,gCAAoB;AACnD,IAAM,kBAAkB,MAAM,OAAO,iCAAqB;AAC1D,IAAM,iBAAiB,MAAM,OAAO,oCAAwB;AAErD,IAAM,2BAA8C;AAAA,EACzD,KAAK;AAAA,EACL,OAAO;AAAA,EACP,KAAK,KAAK,SAAS;AAAA,EACnB,WAAW,KAAK,eAAe;AAAA,EAC/B,UAAU,KAAK,cAAc;AAAA,EAC7B,SAAS;AAAA,EACT,SAAS,MAAM;AACb,SAAK,UAAU;AACf,SAAK,gBAAgB;AACrB,SAAK,eAAe;AAAA,EACtB;AACF;;;ADJA,IAAO,wBAAQ,mBAAmB;AAAA,EAChC,IAAI;AAAA,EACJ,mBAAmB;AACrB,CAAC;","names":[]}
|
package/dist/core.js
CHANGED
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
makeDefaultOpenapiStore,
|
|
9
9
|
openApiPlugin,
|
|
10
10
|
renderAuthTemplate
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-3XJSXSED.js";
|
|
12
12
|
import {
|
|
13
13
|
convertGoogleDiscoveryBundleToOpenApi,
|
|
14
14
|
convertGoogleDiscoveryToOpenApi,
|
|
15
15
|
fetchGoogleDiscoveryDocument,
|
|
16
16
|
isGoogleDiscoveryUrl
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-I2XDCVVM.js";
|
|
18
18
|
import "./chunk-AQ7JDDRM.js";
|
|
19
19
|
import "./chunk-MZWZQ24W.js";
|
|
20
20
|
import {
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
resolveServerUrl,
|
|
57
57
|
resolveSpecText,
|
|
58
58
|
substituteUrlVariables
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-RFSMGUBJ.js";
|
|
60
60
|
|
|
61
61
|
// src/sdk/index.ts
|
|
62
62
|
import { variable } from "@executor-js/sdk/http-auth";
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openApiPlugin
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-3XJSXSED.js";
|
|
4
|
+
import "./chunk-I2XDCVVM.js";
|
|
5
5
|
import "./chunk-AQ7JDDRM.js";
|
|
6
6
|
import "./chunk-MZWZQ24W.js";
|
|
7
7
|
import {
|
|
8
8
|
TOKEN_VARIABLE
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RFSMGUBJ.js";
|
|
10
10
|
|
|
11
11
|
// src/promise.ts
|
|
12
12
|
import { variable } from "@executor-js/sdk/http-auth";
|
|
@@ -2,8 +2,11 @@ import { type FreeformComboboxOption } from "@executor-js/react/components/combo
|
|
|
2
2
|
import { type IntegrationIdentity } from "@executor-js/react/plugins/integration-identity";
|
|
3
3
|
export declare function OpenApiSourceDetailsFields(props: {
|
|
4
4
|
readonly title: string;
|
|
5
|
-
readonly
|
|
5
|
+
readonly subtitle?: string;
|
|
6
6
|
readonly identity: IntegrationIdentity;
|
|
7
|
+
/** The integration's agent-visible description (prefilled from the spec). */
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
readonly onDescriptionChange?: (value: string) => void;
|
|
7
10
|
readonly baseUrl: string;
|
|
8
11
|
readonly onBaseUrlChange: (value: string) => void;
|
|
9
12
|
readonly baseUrlOptions?: readonly FreeformComboboxOption[];
|
package/dist/react/atoms.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export declare const previewOpenApiSpec: Atom.AtomResultFn<{
|
|
|
52
52
|
readonly tags: readonly string[];
|
|
53
53
|
readonly operationId: string;
|
|
54
54
|
}[];
|
|
55
|
+
readonly description: import("effect/Option").Option<string>;
|
|
55
56
|
readonly title: import("effect/Option").Option<string>;
|
|
56
57
|
readonly servers: readonly {
|
|
57
58
|
readonly description: import("effect/Option").Option<string>;
|
|
@@ -132,6 +133,7 @@ export declare const addOpenApiSpec: Atom.AtomResultFn<{
|
|
|
132
133
|
readonly kind: "googleDiscoveryBundle";
|
|
133
134
|
readonly urls: readonly string[];
|
|
134
135
|
};
|
|
136
|
+
readonly name?: string | undefined;
|
|
135
137
|
readonly description?: string | undefined;
|
|
136
138
|
readonly headers?: {
|
|
137
139
|
readonly [x: string]: string;
|
|
@@ -177,6 +179,36 @@ export declare const removeOpenApiSpec: Atom.AtomResultFn<{
|
|
|
177
179
|
readonly responseMode?: "decoded-only" | undefined;
|
|
178
180
|
readonly reactivityKeys?: readonly unknown[] | import("effect/Record").ReadonlyRecord<string, readonly unknown[]> | undefined;
|
|
179
181
|
}, void, import("@executor-js/sdk").IntegrationAlreadyExistsError | import("@executor-js/sdk").InternalError | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError>;
|
|
182
|
+
/** Re-fetch (or replace) the integration's spec and rebuild its tools in
|
|
183
|
+
* place — connections, policies, and the description survive. Pass
|
|
184
|
+
* `reactivityKeys: integrationWriteKeys` at the call site. */
|
|
185
|
+
export declare const updateOpenApiSpec: Atom.AtomResultFn<{
|
|
186
|
+
readonly params: {
|
|
187
|
+
readonly slug: string;
|
|
188
|
+
};
|
|
189
|
+
readonly payload: {
|
|
190
|
+
readonly spec?: {
|
|
191
|
+
readonly kind: "url";
|
|
192
|
+
readonly url: string;
|
|
193
|
+
} | {
|
|
194
|
+
readonly value: string;
|
|
195
|
+
readonly kind: "blob";
|
|
196
|
+
} | {
|
|
197
|
+
readonly kind: "googleDiscovery";
|
|
198
|
+
readonly url: string;
|
|
199
|
+
} | {
|
|
200
|
+
readonly kind: "googleDiscoveryBundle";
|
|
201
|
+
readonly urls: readonly string[];
|
|
202
|
+
} | undefined;
|
|
203
|
+
};
|
|
204
|
+
readonly responseMode?: "decoded-only" | undefined;
|
|
205
|
+
readonly reactivityKeys?: readonly unknown[] | import("effect/Record").ReadonlyRecord<string, readonly unknown[]> | undefined;
|
|
206
|
+
}, {
|
|
207
|
+
readonly slug: string & import("effect/Brand").Brand<"IntegrationSlug">;
|
|
208
|
+
readonly toolCount: number;
|
|
209
|
+
readonly addedTools: readonly string[];
|
|
210
|
+
readonly removedTools: readonly string[];
|
|
211
|
+
}, import("@executor-js/sdk").IntegrationNotFoundError | import("@executor-js/sdk").InternalError | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError>;
|
|
180
212
|
export declare const openapiConfigure: Atom.AtomResultFn<{
|
|
181
213
|
readonly params: {
|
|
182
214
|
readonly slug: string;
|
package/dist/react/client.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare const OpenApiClient: import("effect/unstable/reactivity/AtomHttpA
|
|
|
2
2
|
readonly spec: import("effect/Schema").String;
|
|
3
3
|
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
4
4
|
readonly title: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
5
|
+
readonly description: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
5
6
|
readonly version: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
6
7
|
readonly servers: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
7
8
|
readonly url: import("effect/Schema").String;
|
|
@@ -78,6 +79,7 @@ export declare const OpenApiClient: import("effect/unstable/reactivity/AtomHttpA
|
|
|
78
79
|
readonly urls: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
79
80
|
}>]>;
|
|
80
81
|
readonly slug: import("effect/Schema").String;
|
|
82
|
+
readonly name: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
81
83
|
readonly description: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
82
84
|
readonly baseUrl: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
83
85
|
readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
@@ -180,6 +182,37 @@ export declare const OpenApiClient: import("effect/unstable/reactivity/AtomHttpA
|
|
|
180
182
|
readonly literal: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
181
183
|
}>>;
|
|
182
184
|
}>]>>;
|
|
183
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/sdk").IntegrationAlreadyExistsError | typeof import("@executor-js/sdk").InternalError | typeof import("../sdk").OpenApiParseError | typeof import("../sdk").OpenApiExtractionError | typeof import("../sdk").OpenApiOAuthError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"
|
|
185
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/sdk").IntegrationAlreadyExistsError | typeof import("@executor-js/sdk").InternalError | typeof import("../sdk").OpenApiParseError | typeof import("../sdk").OpenApiExtractionError | typeof import("../sdk").OpenApiOAuthError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"updateSpec", "POST", "/openapi/integrations/:slug/spec", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
186
|
+
slug: import("effect/Schema").String;
|
|
187
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
188
|
+
readonly spec: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
189
|
+
readonly kind: import("effect/Schema").Literal<"url">;
|
|
190
|
+
readonly url: import("effect/Schema").String;
|
|
191
|
+
}>, import("effect/Schema").Struct<{
|
|
192
|
+
readonly kind: import("effect/Schema").Literal<"blob">;
|
|
193
|
+
readonly value: import("effect/Schema").String;
|
|
194
|
+
}>, import("effect/Schema").Struct<{
|
|
195
|
+
readonly kind: import("effect/Schema").Literal<"googleDiscovery">;
|
|
196
|
+
readonly url: import("effect/Schema").String;
|
|
197
|
+
}>, import("effect/Schema").Struct<{
|
|
198
|
+
readonly kind: import("effect/Schema").Literal<"googleDiscoveryBundle">;
|
|
199
|
+
readonly urls: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
200
|
+
}>]>>;
|
|
201
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
202
|
+
readonly slug: import("effect/Schema").brand<import("effect/Schema").String, "IntegrationSlug">;
|
|
203
|
+
readonly toolCount: import("effect/Schema").Number;
|
|
204
|
+
readonly addedTools: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
205
|
+
readonly removedTools: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
206
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<import("@executor-js/sdk").IntegrationNotFoundError, {
|
|
207
|
+
readonly _tag: "IntegrationNotFoundError";
|
|
208
|
+
readonly slug: string;
|
|
209
|
+
}, readonly [import("effect/Schema").TaggedStruct<"IntegrationNotFoundError", {
|
|
210
|
+
readonly slug: import("effect/Schema").brand<import("effect/Schema").String, "IntegrationSlug">;
|
|
211
|
+
}>], {
|
|
212
|
+
readonly _tag: "IntegrationNotFoundError";
|
|
213
|
+
readonly slug: string & import("effect/Brand").Brand<"IntegrationSlug">;
|
|
214
|
+
}>, import("effect/Schema").TaggedStruct<"IntegrationNotFoundError", {
|
|
215
|
+
readonly slug: import("effect/Schema").brand<import("effect/Schema").String, "IntegrationSlug">;
|
|
216
|
+
}>, never, never> | typeof import("@executor-js/sdk").InternalError | typeof import("../sdk").OpenApiParseError | typeof import("../sdk").OpenApiExtractionError | typeof import("../sdk").OpenApiOAuthError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"removeSpec", "DELETE", "/openapi/integrations/:slug", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
184
217
|
slug: import("effect/Schema").String;
|
|
185
218
|
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Void>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/sdk").IntegrationAlreadyExistsError | typeof import("@executor-js/sdk").InternalError | typeof import("../sdk").OpenApiParseError | typeof import("../sdk").OpenApiExtractionError | typeof import("../sdk").OpenApiOAuthError>, never, never>, false>>;
|
package/dist/sdk/extract.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export declare const extract: (doc: ParsedDocument) => Effect.Effect<{
|
|
|
54
54
|
readonly operationId: string & import("effect/Brand").Brand<"OperationId">;
|
|
55
55
|
readonly pathTemplate: string;
|
|
56
56
|
}[];
|
|
57
|
+
readonly description: Option.Option<string>;
|
|
57
58
|
readonly title: Option.Option<string>;
|
|
58
59
|
readonly servers: readonly {
|
|
59
60
|
readonly description: Option.Option<string>;
|
package/dist/sdk/plugin.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, Option, Schema } from "effect";
|
|
2
2
|
import type { Layer } from "effect";
|
|
3
3
|
import { HttpClient } from "effect/unstable/http";
|
|
4
|
-
import { IntegrationAlreadyExistsError, IntegrationSlug, type AuthMethodDescriptor, type Integration, type IntegrationRecord, type StorageFailure } from "@executor-js/sdk/core";
|
|
4
|
+
import { IntegrationAlreadyExistsError, IntegrationNotFoundError, IntegrationSlug, type AuthMethodDescriptor, type Integration, type IntegrationRecord, type StorageFailure } from "@executor-js/sdk/core";
|
|
5
5
|
import { type OpenApiIntegrationConfig } from "./config";
|
|
6
6
|
import { OpenApiExtractionError, OpenApiOAuthError, OpenApiParseError } from "./errors";
|
|
7
7
|
import { type SpecPreview } from "./preview";
|
|
@@ -19,7 +19,10 @@ export interface OpenApiSpecConfig {
|
|
|
19
19
|
readonly spec: OpenApiSpecInput;
|
|
20
20
|
/** The catalog slug for the new integration (the `<integration>` segment). */
|
|
21
21
|
readonly slug: string;
|
|
22
|
-
/**
|
|
22
|
+
/** Display name (defaults to the spec title). */
|
|
23
|
+
readonly name?: string;
|
|
24
|
+
/** Agent-visible description (defaults to the spec's `info.description`,
|
|
25
|
+
* then the title). */
|
|
23
26
|
readonly description?: string;
|
|
24
27
|
readonly baseUrl?: string;
|
|
25
28
|
/** Static headers applied to every request (no secret material). */
|
|
@@ -43,12 +46,29 @@ export interface OpenApiConfigureInput {
|
|
|
43
46
|
readonly authenticationTemplate: readonly AuthenticationInput[];
|
|
44
47
|
readonly mode?: "merge" | "replace";
|
|
45
48
|
}
|
|
49
|
+
/** What changed in the tool catalog when a spec was updated in place. Tool
|
|
50
|
+
* names, not addresses — the same diff applies to every connection. */
|
|
51
|
+
export interface UpdateSpecResult {
|
|
52
|
+
readonly slug: IntegrationSlug;
|
|
53
|
+
readonly toolCount: number;
|
|
54
|
+
readonly addedTools: readonly string[];
|
|
55
|
+
readonly removedTools: readonly string[];
|
|
56
|
+
}
|
|
57
|
+
export interface OpenApiUpdateSpecInput {
|
|
58
|
+
/** New spec source. Omit to re-fetch from the integration's stored
|
|
59
|
+
* `sourceUrl` / Google Discovery bundle URLs. */
|
|
60
|
+
readonly spec?: OpenApiSpecInput;
|
|
61
|
+
}
|
|
46
62
|
export interface OpenApiPluginExtension {
|
|
47
63
|
readonly previewSpec: (input: string | OpenApiPreviewInput) => Effect.Effect<SpecPreview, OpenApiParseError | OpenApiExtractionError | OpenApiOAuthError | StorageFailure>;
|
|
48
64
|
readonly addSpec: (config: OpenApiSpecConfig) => Effect.Effect<{
|
|
49
65
|
readonly slug: IntegrationSlug;
|
|
50
66
|
readonly toolCount: number;
|
|
51
67
|
}, OpenApiParseError | OpenApiExtractionError | OpenApiOAuthError | IntegrationAlreadyExistsError | StorageFailure>;
|
|
68
|
+
/** Re-resolve the integration's spec (from its stored source URL, or the
|
|
69
|
+
* provided input) and rebuild its tools IN PLACE — connections,
|
|
70
|
+
* credentials, policies, and the curated description are untouched. */
|
|
71
|
+
readonly updateSpec: (slug: string, input?: OpenApiUpdateSpecInput) => Effect.Effect<UpdateSpecResult, OpenApiParseError | OpenApiExtractionError | OpenApiOAuthError | IntegrationNotFoundError | StorageFailure>;
|
|
52
72
|
readonly removeSpec: (slug: string) => Effect.Effect<void, StorageFailure>;
|
|
53
73
|
readonly getIntegration: (slug: string) => Effect.Effect<Integration | null, StorageFailure>;
|
|
54
74
|
/** Read the integration's full opaque config, including its
|
|
@@ -89,6 +109,7 @@ export declare const openApiPlugin: import("@executor-js/sdk/core").ConfiguredPl
|
|
|
89
109
|
readonly tags: readonly string[];
|
|
90
110
|
readonly operationId: string;
|
|
91
111
|
}[];
|
|
112
|
+
readonly description: Option.Option<string>;
|
|
92
113
|
readonly title: Option.Option<string>;
|
|
93
114
|
readonly servers: readonly {
|
|
94
115
|
readonly description: Option.Option<string>;
|
|
@@ -157,6 +178,12 @@ export declare const openApiPlugin: import("@executor-js/sdk/core").ConfiguredPl
|
|
|
157
178
|
slug: string & import("effect/Brand").Brand<"IntegrationSlug">;
|
|
158
179
|
toolCount: number;
|
|
159
180
|
}, StorageFailure | IntegrationAlreadyExistsError | OpenApiParseError | OpenApiExtractionError | OpenApiOAuthError, never>;
|
|
181
|
+
updateSpec: (rawSlug: string, input?: OpenApiUpdateSpecInput) => Effect.Effect<{
|
|
182
|
+
slug: string & import("effect/Brand").Brand<"IntegrationSlug">;
|
|
183
|
+
toolCount: number;
|
|
184
|
+
addedTools: string[];
|
|
185
|
+
removedTools: string[];
|
|
186
|
+
}, StorageFailure | IntegrationNotFoundError | OpenApiParseError | OpenApiExtractionError | OpenApiOAuthError, never>;
|
|
160
187
|
removeSpec: (slug: string) => Effect.Effect<void, StorageFailure, never>;
|
|
161
188
|
getIntegration: (slug: string) => Effect.Effect<Integration | null, StorageFailure, never>;
|
|
162
189
|
getConfig: (slug: string) => Effect.Effect<OpenApiIntegrationConfig | null, StorageFailure>;
|