@executor-js/plugin-openapi 1.5.17 → 1.5.18
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-U7AYB224.js → AddOpenApiSource-IBZQRCTW.js} +4 -4
- package/dist/{OpenApiAccountsPanel-GHFHHE6P.js → OpenApiAccountsPanel-U47OVLYG.js} +3 -3
- package/dist/{UpdateSpecSection-PLCBUU4I.js → UpdateSpecSection-FFYVB3VH.js} +3 -3
- package/dist/{chunk-CPPTKUOW.js → chunk-2RNIMASA.js} +2 -2
- package/dist/{chunk-CKBX4SXK.js → chunk-5IDND4UF.js} +2 -2
- package/dist/{chunk-UEKOP6NZ.js → chunk-ELCKZJE4.js} +234 -210
- package/dist/chunk-ELCKZJE4.js.map +1 -0
- package/dist/{chunk-KVPUDOJZ.js → chunk-R3X27XS6.js} +587 -77
- package/dist/chunk-R3X27XS6.js.map +1 -0
- package/dist/client.js +3 -3
- package/dist/core.js +27 -3
- package/dist/core.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/sdk/backing.d.ts +91 -1
- package/dist/sdk/definitions.d.ts +33 -1
- package/dist/sdk/extract.d.ts +66 -0
- package/dist/sdk/index.d.ts +3 -2
- package/dist/sdk/split.d.ts +84 -0
- package/dist/sdk/store.d.ts +19 -0
- package/package.json +3 -3
- package/dist/chunk-KVPUDOJZ.js.map +0 -1
- package/dist/chunk-UEKOP6NZ.js.map +0 -1
- /package/dist/{AddOpenApiSource-U7AYB224.js.map → AddOpenApiSource-IBZQRCTW.js.map} +0 -0
- /package/dist/{OpenApiAccountsPanel-GHFHHE6P.js.map → OpenApiAccountsPanel-U47OVLYG.js.map} +0 -0
- /package/dist/{UpdateSpecSection-PLCBUU4I.js.map → UpdateSpecSection-FFYVB3VH.js.map} +0 -0
- /package/dist/{chunk-CPPTKUOW.js.map → chunk-2RNIMASA.js.map} +0 -0
- /package/dist/{chunk-CKBX4SXK.js.map → chunk-5IDND4UF.js.map} +0 -0
package/dist/sdk/backing.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { type OpenApiIntegrationConfig } from "./config";
|
|
|
6
6
|
import { OpenApiExtractionError, OpenApiParseError } from "./errors";
|
|
7
7
|
import { type ToolDefinition } from "./definitions";
|
|
8
8
|
import { type ParsedDocument } from "./parse";
|
|
9
|
+
import { type KeepPathItem, type SpecStructure } from "./split";
|
|
9
10
|
import { type OpenapiStore, type StoredOperation } from "./store";
|
|
10
11
|
export declare const extractOpenApiUpstreamMessage: (body: unknown, status: number) => string;
|
|
11
12
|
/** Rewrite OpenAPI `#/components/schemas/X` refs to standard `#/$defs/X`. */
|
|
@@ -20,8 +21,97 @@ export declare const compileOpenApiDocument: (doc: ParsedDocument) => Effect.Eff
|
|
|
20
21
|
export declare const compileOpenApiSpec: (specText: string) => Effect.Effect<CompiledOpenApiSpec, OpenApiParseError | OpenApiExtractionError>;
|
|
21
22
|
export declare const openApiToolDefsFromCompiled: (compiled: CompiledOpenApiSpec) => readonly ToolDef[];
|
|
22
23
|
export declare const openApiStoredOperationsFromCompiled: (integration: string, compiled: CompiledOpenApiSpec) => readonly StoredOperation[];
|
|
24
|
+
/**
|
|
25
|
+
* Serialize a document's `components.schemas` into the content-addressed defs
|
|
26
|
+
* blob JSON (`{ "<Name>": <normalized schema>, ... }`), one schema at a time.
|
|
27
|
+
* Normalizing + stringifying per entry keeps the whole normalized definition
|
|
28
|
+
* tree from ever being co-resident with the parsed document, so the streaming
|
|
29
|
+
* add path's peak stays near parse level. The serve path JSON-parses this blob
|
|
30
|
+
* to rebuild the shared `definitions` instead of re-parsing the spec.
|
|
31
|
+
*/
|
|
32
|
+
export declare const buildDefsJson: (doc: ParsedDocument) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Streaming twin of `buildDefsJson`: serialize the content-addressed defs blob
|
|
35
|
+
* from a `SpecStructure` by parsing each `components.schemas` entry in isolation
|
|
36
|
+
* (indent-4 range) rather than from a whole-document parse. Used by the fully
|
|
37
|
+
* streaming add path so the 37MB Microsoft Graph spec never builds its
|
|
38
|
+
* ~300MB tree. The blob carries *all* source schemas (it is shared across every
|
|
39
|
+
* tenant/selection on the same spec hash); extra unreferenced `$defs` are
|
|
40
|
+
* harmless. Like `buildDefsJson`, normalizing + stringifying per entry keeps the
|
|
41
|
+
* whole normalized tree from being co-resident with any parsed schema, and the
|
|
42
|
+
* ConsString accumulation avoids the join-doubling of an array build.
|
|
43
|
+
*/
|
|
44
|
+
export declare const buildDefsJsonStreaming: (structure: SpecStructure) => string;
|
|
45
|
+
export interface OpenApiPersistResult {
|
|
46
|
+
readonly toolCount: number;
|
|
47
|
+
readonly toolNames: readonly string[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Compile a parsed document straight to persisted operation bindings, streaming
|
|
51
|
+
* in bounded chunks so a huge spec's bindings are never all co-resident with
|
|
52
|
+
* the parsed tree. This is the memory-safe replacement for
|
|
53
|
+
* `compileOpenApiDocument` + `openApiStoredOperationsFromCompiled` + `putOperations`
|
|
54
|
+
* on the add/update path: it skips per-op input/output schema assembly (the
|
|
55
|
+
* serve path rebuilds those on demand from the bindings). Clears existing
|
|
56
|
+
* operations first, then appends each chunk. When `specHash` is given, also
|
|
57
|
+
* stream-serializes the document's `#/$defs/*` into the content-addressed defs
|
|
58
|
+
* blob so the serve path can resolve the shared `definitions` without
|
|
59
|
+
* re-parsing the spec.
|
|
60
|
+
*/
|
|
61
|
+
export declare const compileAndPersistOpenApiOperations: ({ doc, integration, storage, specHash, chunkSize, }: {
|
|
62
|
+
readonly doc: ParsedDocument;
|
|
63
|
+
readonly integration: string;
|
|
64
|
+
readonly storage: OpenapiStore;
|
|
65
|
+
readonly specHash?: string;
|
|
66
|
+
readonly chunkSize?: number;
|
|
67
|
+
}) => Effect.Effect<OpenApiPersistResult, OpenApiExtractionError | StorageFailure>;
|
|
68
|
+
/** Parse spec text, then stream-compile + persist its bindings (and, when
|
|
69
|
+
* `specHash` is given, the content-addressed defs blob). */
|
|
70
|
+
export declare const compileAndPersistOpenApiSpec: ({ specText, integration, storage, specHash, chunkSize, }: {
|
|
71
|
+
readonly specText: string;
|
|
72
|
+
readonly integration: string;
|
|
73
|
+
readonly storage: OpenapiStore;
|
|
74
|
+
readonly specHash?: string;
|
|
75
|
+
readonly chunkSize?: number;
|
|
76
|
+
}) => Effect.Effect<OpenApiPersistResult, OpenApiParseError | OpenApiExtractionError | StorageFailure>;
|
|
77
|
+
/**
|
|
78
|
+
* Fully streaming add/update path: compile + persist operation bindings (and the
|
|
79
|
+
* content-addressed defs blob) straight from spec *text*, without ever parsing
|
|
80
|
+
* the whole document. The text is structurally split, then each path-item and
|
|
81
|
+
* each schema is parsed in isolation and discarded, so peak memory stays near
|
|
82
|
+
* one item rather than the ~300MB whole-tree parse that OOMs a 128MB Workers
|
|
83
|
+
* isolate on the 37MB Microsoft Graph spec.
|
|
84
|
+
*
|
|
85
|
+
* There is deliberately no whole-parse fallback: a spec that does not present
|
|
86
|
+
* the streamable block-YAML profile (no top-level `paths:` block) is a hard
|
|
87
|
+
* `OpenApiExtractionError`, because the fallback is exactly the OOM this path
|
|
88
|
+
* exists to avoid. `keepPathItem` optionally filters/trims path-items (the
|
|
89
|
+
* Microsoft Graph scope selection), so the same primitive serves a full-spec
|
|
90
|
+
* compile and a selection identically.
|
|
91
|
+
*/
|
|
92
|
+
export declare const compileAndPersistOpenApiSpecStreaming: ({ specText, integration, storage, specHash, chunkSize, keepPathItem, }: {
|
|
93
|
+
readonly specText: string;
|
|
94
|
+
readonly integration: string;
|
|
95
|
+
readonly storage: OpenapiStore;
|
|
96
|
+
readonly specHash?: string;
|
|
97
|
+
readonly chunkSize?: number;
|
|
98
|
+
readonly keepPathItem?: KeepPathItem;
|
|
99
|
+
}) => Effect.Effect<OpenApiPersistResult, OpenApiExtractionError | StorageFailure>;
|
|
23
100
|
export declare const loadOpenApiSpecText: (storage: OpenapiStore, config: OpenApiIntegrationConfig) => Effect.Effect<string | null, StorageFailure>;
|
|
24
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Resolve the tool defs + shared definitions for a connection refresh
|
|
103
|
+
* (`tools/list`). Fast path: serve from the persisted operation bindings plus
|
|
104
|
+
* the content-addressed defs blob, rebuilding each tool's input/output schema
|
|
105
|
+
* on demand, so a 37MB spec is never re-parsed (the 2nd OOM site). The defs
|
|
106
|
+
* blob is global per `specHash`, so the heavy normalize work is done once at
|
|
107
|
+
* add time and shared across every tenant on the same spec. Falls back to the
|
|
108
|
+
* spec re-parse for legacy rows persisted before the defs blob existed (or if
|
|
109
|
+
* the blob is missing/corrupt).
|
|
110
|
+
*/
|
|
111
|
+
export declare const resolveOpenApiBackedTools: ({ integration, config, storage, }: {
|
|
112
|
+
readonly integration: {
|
|
113
|
+
readonly slug: string;
|
|
114
|
+
};
|
|
25
115
|
readonly config: unknown;
|
|
26
116
|
readonly storage: OpenapiStore;
|
|
27
117
|
}) => Effect.Effect<ResolveToolsResult, StorageFailure>;
|
|
@@ -18,8 +18,40 @@ export interface ToolDefinition {
|
|
|
18
18
|
/** The original operation */
|
|
19
19
|
readonly operation: ExtractedOperation;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* The minimal per-operation metadata the tool-path planner needs. Kept
|
|
23
|
+
* deliberately light (no schemas) so the streaming compile path can plan paths
|
|
24
|
+
* for tens of thousands of operations without holding the full extracted
|
|
25
|
+
* operations in memory.
|
|
26
|
+
*/
|
|
27
|
+
export interface OperationPathInput {
|
|
28
|
+
readonly operationId: string;
|
|
29
|
+
readonly explicitToolPath: string | undefined;
|
|
30
|
+
readonly method: string;
|
|
31
|
+
readonly pathTemplate: string;
|
|
32
|
+
/** The first non-empty tag, used to seed the group segment. */
|
|
33
|
+
readonly tag0: string | undefined;
|
|
34
|
+
}
|
|
35
|
+
/** A resolved tool path plus its index back into the input operations array. */
|
|
36
|
+
export interface PlannedToolPath {
|
|
37
|
+
readonly toolPath: string;
|
|
38
|
+
readonly group: string;
|
|
39
|
+
readonly leaf: string;
|
|
40
|
+
readonly operationIndex: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Plan structured `group.leaf` tool paths from lightweight per-operation
|
|
44
|
+
* metadata. Path derivation + collision resolution need a global view of every
|
|
45
|
+
* operation, but only its name/method/path/tag, never its schemas. Keeping this
|
|
46
|
+
* pass schema-free lets the streaming compile path plan paths for a 16k-op spec
|
|
47
|
+
* without materializing the full extracted operations.
|
|
48
|
+
*
|
|
49
|
+
* The returned `operationIndex` points back into the `inputs` array.
|
|
50
|
+
*/
|
|
51
|
+
export declare const planToolPaths: (inputs: readonly OperationPathInput[]) => PlannedToolPath[];
|
|
21
52
|
/**
|
|
22
53
|
* Compile extracted operations into tool definitions with structured
|
|
23
|
-
* `group.leaf` paths suitable for tree rendering.
|
|
54
|
+
* `group.leaf` paths suitable for tree rendering. Thin wrapper over
|
|
55
|
+
* `planToolPaths` that re-attaches each operation by index.
|
|
24
56
|
*/
|
|
25
57
|
export declare const compileToolDefinitions: (operations: readonly ExtractedOperation[]) => ToolDefinition[];
|
package/dist/sdk/extract.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Effect, Option } from "effect";
|
|
2
2
|
import { OpenApiExtractionError } from "./errors";
|
|
3
3
|
import type { ParsedDocument } from "./parse";
|
|
4
|
+
import { type KeepPathItem, type SpecStructure } from "./split";
|
|
5
|
+
import { OperationBinding, OperationParameter, OperationRequestBody, ServerInfo } from "./types";
|
|
6
|
+
export declare const buildInputSchema: (parameters: readonly OperationParameter[], requestBody: OperationRequestBody | undefined, servers: readonly ServerInfo[]) => Record<string, unknown> | undefined;
|
|
4
7
|
/** Extract all operations from a bundled OpenAPI 3.x document */
|
|
5
8
|
export declare const extract: (doc: ParsedDocument) => Effect.Effect<{
|
|
6
9
|
readonly version: Option.Option<string>;
|
|
@@ -79,3 +82,66 @@ export declare const extract: (doc: ParsedDocument) => Effect.Effect<{
|
|
|
79
82
|
}>;
|
|
80
83
|
}[];
|
|
81
84
|
}, OpenApiExtractionError, never>;
|
|
85
|
+
/** One persisted invocation binding plus the tool name and description it
|
|
86
|
+
* backs. The description is the resolved operation description / summary /
|
|
87
|
+
* method+path fallback, persisted so the serve path needs no re-parse. */
|
|
88
|
+
export interface OperationBindingChunk {
|
|
89
|
+
readonly toolName: string;
|
|
90
|
+
readonly description: string;
|
|
91
|
+
readonly binding: OperationBinding;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Stream invocation bindings out of a parsed document in bounded chunks,
|
|
95
|
+
* persisting each chunk via `onChunk` before building the next.
|
|
96
|
+
*
|
|
97
|
+
* This is the memory-safe compile path for huge specs (e.g. Microsoft Graph,
|
|
98
|
+
* 16.5k operations / 37MB). It differs from `extract` + `compileToolDefinitions`
|
|
99
|
+
* in two ways that keep peak memory at parse level rather than ~doubling it:
|
|
100
|
+
*
|
|
101
|
+
* 1. It never builds `hoistedDefs` or per-operation `inputSchema`/`outputSchema`
|
|
102
|
+
* (the add path only needs invocation bindings, which carry `$ref`s, not
|
|
103
|
+
* inlined schemas).
|
|
104
|
+
* 2. It never holds all bindings at once. Tool-path planning needs a global
|
|
105
|
+
* view, but only of lightweight metadata (`planToolPaths`, schema-free);
|
|
106
|
+
* the heavy per-operation bindings are built, flushed, and dropped one
|
|
107
|
+
* chunk at a time.
|
|
108
|
+
*
|
|
109
|
+
* Bindings reference subtrees of the parsed document rather than copying them,
|
|
110
|
+
* so `onChunk` must sever those references (its storage layer JSON-serializes
|
|
111
|
+
* the binding) before the chunk is dropped. Returns the resolved tool names in
|
|
112
|
+
* sorted order, matching `compileToolDefinitions`.
|
|
113
|
+
*/
|
|
114
|
+
export declare const streamOperationBindings: <E, R>(doc: ParsedDocument, chunkSize: number, onChunk: (chunk: readonly OperationBindingChunk[]) => Effect.Effect<void, E, R>) => Effect.Effect<{
|
|
115
|
+
readonly toolCount: number;
|
|
116
|
+
readonly toolNames: readonly string[];
|
|
117
|
+
}, OpenApiExtractionError | E, R>;
|
|
118
|
+
/**
|
|
119
|
+
* Stream invocation bindings straight from a `SpecStructure` (the structural
|
|
120
|
+
* split of a large spec) without ever materializing the whole-document tree.
|
|
121
|
+
*
|
|
122
|
+
* This is the fully-streaming compile path: it never parses the spec whole.
|
|
123
|
+
* Each path-item is parsed in isolation twice (pass 1 for light tool-path
|
|
124
|
+
* planning metadata, pass 2 to build the heavy binding) and discarded, so peak
|
|
125
|
+
* memory stays near the size of a single path-item plus the raw text, even for
|
|
126
|
+
* the 37MB / 16.5k-operation Microsoft Graph spec that OOMs a whole-tree parse.
|
|
127
|
+
* Re-parsing in pass 2 (rather than holding pass-1 tree references) is the
|
|
128
|
+
* deliberate CPU-for-memory trade that keeps peak at one-path-item level.
|
|
129
|
+
*
|
|
130
|
+
* `keepPathItem`, when given, filters (and may trim) each path-item, so the same
|
|
131
|
+
* primitive serves both a full-spec compile (no filter) and a selection (e.g.
|
|
132
|
+
* the Microsoft Graph scope filter) with identical streaming guarantees. It is
|
|
133
|
+
* applied identically in both passes so the per-operation index stays aligned.
|
|
134
|
+
*
|
|
135
|
+
* Schemas are never resolved here: parameter / requestBody / response component
|
|
136
|
+
* `$ref`s resolve against the small (schema-free) components built from the
|
|
137
|
+
* structure; `#/components/schemas/X` refs stay as strings in the binding and
|
|
138
|
+
* are normalized + served from the content-addressed defs blob. Returns the
|
|
139
|
+
* resolved tool names in sorted order, matching `compileToolDefinitions`.
|
|
140
|
+
*/
|
|
141
|
+
export declare const streamOperationBindingsFromStructure: <E, R>(structure: SpecStructure, options: {
|
|
142
|
+
readonly chunkSize: number;
|
|
143
|
+
readonly keepPathItem?: KeepPathItem;
|
|
144
|
+
}, onChunk: (chunk: readonly OperationBindingChunk[]) => Effect.Effect<void, E, R>) => Effect.Effect<{
|
|
145
|
+
readonly toolCount: number;
|
|
146
|
+
readonly toolNames: readonly string[];
|
|
147
|
+
}, E, R>;
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { parse, resolveSpecText, fetchSpecText } from "./parse";
|
|
2
|
-
export { extract } from "./extract";
|
|
2
|
+
export { extract, streamOperationBindingsFromStructure } from "./extract";
|
|
3
|
+
export { structuralSplit, isStreamableSpec, indexSchemas, collectReferencedSchemas, parseEntry, parseHead, parseSmallComponents, type SpecStructure, type ByteRange, type KeepPathItem, } from "./split";
|
|
3
4
|
export { invoke, invokeWithLayer, annotationsForOperation } from "./invoke";
|
|
4
|
-
export { compileOpenApiDocument, compileOpenApiSpec, extractOpenApiUpstreamMessage, invokeOpenApiBackedTool, loadOpenApiSpecText, normalizeOpenApiRefs, openApiStoredOperationsFromCompiled, openApiToolDefsFromCompiled, resolveOpenApiBackedAnnotations, resolveOpenApiBackedTools, type CompiledOpenApiSpec, } from "./backing";
|
|
5
|
+
export { buildDefsJsonStreaming, compileAndPersistOpenApiOperations, compileAndPersistOpenApiSpec, compileAndPersistOpenApiSpecStreaming, compileOpenApiDocument, compileOpenApiSpec, extractOpenApiUpstreamMessage, invokeOpenApiBackedTool, loadOpenApiSpecText, normalizeOpenApiRefs, openApiStoredOperationsFromCompiled, openApiToolDefsFromCompiled, resolveOpenApiBackedAnnotations, resolveOpenApiBackedTools, type CompiledOpenApiSpec, type OpenApiPersistResult, } from "./backing";
|
|
5
6
|
export type { ParsedDocument } from "./parse";
|
|
6
7
|
export { openApiPlugin, type OpenApiSpecConfig, type OpenApiConfigureInput, type OpenApiSpecInput, type OpenApiPreviewInput, type OpenApiPluginExtension, type OpenApiPluginOptions, } from "./plugin";
|
|
7
8
|
export { type OpenapiStore, type StoredOperation, makeDefaultOpenapiStore } from "./store";
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural splitter for large OpenAPI documents written in clean block YAML.
|
|
3
|
+
*
|
|
4
|
+
* The whole-document parse of a 37MB spec (Microsoft Graph: 16.5k operations,
|
|
5
|
+
* 8.2k schemas) builds a ~300MB JS tree that OOMs the 128MB Cloudflare Workers
|
|
6
|
+
* isolate. This splitter avoids ever holding that tree: it scans the text once,
|
|
7
|
+
* recording the byte range of each top-level key, each path-item (the indent-2
|
|
8
|
+
* entries under `paths:`), and each schema (the indent-4 entries under
|
|
9
|
+
* `components.schemas:`). The streaming compile then slices one item at a time,
|
|
10
|
+
* de-indents it back to column 0, hands the isolated fragment to a real YAML
|
|
11
|
+
* parser, and discards the result before moving on. Peak memory stays near the
|
|
12
|
+
* size of the largest single item plus the raw text, not the parsed whole.
|
|
13
|
+
*
|
|
14
|
+
* This is not a YAML reimplementation: it extracts safe byte ranges from a
|
|
15
|
+
* constrained document shape, then defers every actual parse to `js-yaml`. It
|
|
16
|
+
* is only valid for the block-YAML profile `isStreamableSpec` accepts (2-space
|
|
17
|
+
* block maps, top-level keys at column 0, no anchors/aliases/merge keys). Block
|
|
18
|
+
* scalars (`|` / `>`) in descriptions are tracked so their indented content is
|
|
19
|
+
* never mistaken for structure.
|
|
20
|
+
*/
|
|
21
|
+
export interface ByteRange {
|
|
22
|
+
readonly start: number;
|
|
23
|
+
readonly end: number;
|
|
24
|
+
}
|
|
25
|
+
export interface SpecStructure {
|
|
26
|
+
/** Raw spec text. Every range below indexes into this string. */
|
|
27
|
+
readonly text: string;
|
|
28
|
+
/** Byte ranges of the top-level keys that are not `paths` / `components`
|
|
29
|
+
* (openapi, info, servers, tags, security, ...). Concatenated and parsed as
|
|
30
|
+
* one small document for the head (servers, info). */
|
|
31
|
+
readonly headRanges: readonly ByteRange[];
|
|
32
|
+
/** One range per path-item: the indent-2 entries under `paths:`. */
|
|
33
|
+
readonly pathItems: readonly ByteRange[];
|
|
34
|
+
/** One range per schema entry: the indent-4 entries under
|
|
35
|
+
* `components.schemas:`. */
|
|
36
|
+
readonly schemas: readonly ByteRange[];
|
|
37
|
+
/** Ranges of the indent-2 `components` subkeys we keep whole because they are
|
|
38
|
+
* small and may be `$ref`'d by a kept operation (parameters / requestBodies /
|
|
39
|
+
* responses / headers / links / securitySchemes). Excludes the huge `schemas`
|
|
40
|
+
* (streamed and pruned separately) and `examples` (never referenced by a
|
|
41
|
+
* binding). */
|
|
42
|
+
readonly smallComponentRanges: readonly ByteRange[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Scan a document into its structural ranges. Pure and synchronous; never
|
|
46
|
+
* parses. Returns null when the document does not present the expected shape
|
|
47
|
+
* (no `paths:` block), so the caller can fall back to a whole-document parse.
|
|
48
|
+
*/
|
|
49
|
+
export declare const structuralSplit: (text: string) => SpecStructure | null;
|
|
50
|
+
/**
|
|
51
|
+
* Parse a single indent-N entry range (a path-item or a schema) in isolation.
|
|
52
|
+
* Returns `[name, value]` where `name` is the entry's key and `value` its
|
|
53
|
+
* parsed body, or null when the fragment does not parse to a single-key map.
|
|
54
|
+
*/
|
|
55
|
+
export declare const parseEntry: (text: string, range: ByteRange, indent: number) => readonly [string, unknown] | null;
|
|
56
|
+
/** Parse the concatenation of the head ranges into the document head (openapi,
|
|
57
|
+
* info, servers, tags). Small; safe to materialize whole. */
|
|
58
|
+
export declare const parseHead: (structure: SpecStructure) => Record<string, unknown>;
|
|
59
|
+
/** Parse the small component subkeys (parameters / requestBodies / responses)
|
|
60
|
+
* into a `components`-shaped object for `$ref` resolution. */
|
|
61
|
+
export declare const parseSmallComponents: (structure: SpecStructure) => Record<string, unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* Accept only the block-YAML profile the splitter can safely slice: no tabs, no
|
|
64
|
+
* anchors/aliases, no merge keys, and a `paths:` block present. Block scalars
|
|
65
|
+
* are allowed (tracked during the scan). Conservative by design: a false
|
|
66
|
+
* negative just routes a spec through the whole-document parse.
|
|
67
|
+
*/
|
|
68
|
+
export declare const isStreamableSpec: (text: string) => boolean;
|
|
69
|
+
/** Map each `components.schemas` entry name to its byte range, reading only the
|
|
70
|
+
* key line (never parsing the schema body). The schema name is the raw YAML
|
|
71
|
+
* key, which matches the trailing segment of a `#/components/schemas/<name>`
|
|
72
|
+
* reference. */
|
|
73
|
+
export declare const indexSchemas: (structure: SpecStructure) => ReadonlyMap<string, ByteRange>;
|
|
74
|
+
/**
|
|
75
|
+
* Resolve the transitive closure of schemas referenced by `roots`, parsing each
|
|
76
|
+
* referenced schema once from its byte range (BFS over `$ref`s). Schemas not
|
|
77
|
+
* reachable from `roots` are never parsed, so peak memory tracks the kept
|
|
78
|
+
* subset rather than the full `components.schemas` map.
|
|
79
|
+
*/
|
|
80
|
+
export declare const collectReferencedSchemas: (structure: SpecStructure, index: ReadonlyMap<string, ByteRange>, roots: readonly unknown[]) => Record<string, unknown>;
|
|
81
|
+
/** A path-item filter for the streaming compile: given a parsed path-item,
|
|
82
|
+
* return the (possibly trimmed) value to keep, or null to drop the path
|
|
83
|
+
* entirely. Applied per path-item by `streamOperationBindingsFromStructure`. */
|
|
84
|
+
export type KeepPathItem = (path: string, pathItem: Record<string, unknown>) => Record<string, unknown> | null;
|
package/dist/sdk/store.d.ts
CHANGED
|
@@ -7,13 +7,25 @@ export interface StoredOperation {
|
|
|
7
7
|
/** The tool name (the `<tool>` address segment) this operation backs. */
|
|
8
8
|
readonly toolName: string;
|
|
9
9
|
readonly binding: OperationBinding;
|
|
10
|
+
/** Resolved tool description, persisted alongside the binding so the serve
|
|
11
|
+
* path can rebuild the tool def without re-parsing the spec. */
|
|
12
|
+
readonly description?: string;
|
|
10
13
|
}
|
|
11
14
|
/** Blob key for a spec's content hash. Content-addressed so re-puts are
|
|
12
15
|
* idempotent and identical specs share one blob per partition. */
|
|
13
16
|
export declare const specBlobKey: (specHash: string) => string;
|
|
17
|
+
/** Blob key for a spec's compiled `#/$defs/*` schemas, keyed by the same
|
|
18
|
+
* content hash as the spec. The serve path reads this instead of re-parsing
|
|
19
|
+
* the (potentially multi-MB) spec to rebuild the shared `definitions`. */
|
|
20
|
+
export declare const defsBlobKey: (specHash: string) => string;
|
|
14
21
|
export interface OpenapiStore {
|
|
15
22
|
/** Replace all stored operations for an integration. */
|
|
16
23
|
readonly putOperations: (integration: string, operations: readonly StoredOperation[]) => Effect.Effect<void, StorageFailure>;
|
|
24
|
+
/** Append operations without clearing existing ones. The caller is
|
|
25
|
+
* responsible for `removeOperations` first when doing a full rebuild. Used
|
|
26
|
+
* by the streaming compile path, which persists operations chunk by chunk so
|
|
27
|
+
* a huge spec's bindings are never all materialized at once. */
|
|
28
|
+
readonly appendOperations: (integration: string, operations: readonly StoredOperation[]) => Effect.Effect<void, StorageFailure>;
|
|
17
29
|
/** Look up one operation by integration + tool name. */
|
|
18
30
|
readonly getOperation: (integration: string, toolName: string) => Effect.Effect<StoredOperation | null, StorageFailure>;
|
|
19
31
|
/** List every stored operation for an integration. */
|
|
@@ -26,5 +38,12 @@ export interface OpenapiStore {
|
|
|
26
38
|
readonly putSpec: (specHash: string, specText: string) => Effect.Effect<void, StorageFailure>;
|
|
27
39
|
/** Load spec text by content hash; null when no blob exists. */
|
|
28
40
|
readonly getSpec: (specHash: string) => Effect.Effect<string | null, StorageFailure>;
|
|
41
|
+
/** Persist the compiled `#/$defs/*` JSON for a spec under its content hash.
|
|
42
|
+
* Content-addressed like the spec blob; lets the serve path serve the shared
|
|
43
|
+
* `definitions` without re-parsing the spec. */
|
|
44
|
+
readonly putDefs: (specHash: string, defsJson: string) => Effect.Effect<void, StorageFailure>;
|
|
45
|
+
/** Load the compiled `#/$defs/*` JSON by content hash; null when no blob
|
|
46
|
+
* exists (legacy rows added before the defs blob). */
|
|
47
|
+
readonly getDefs: (specHash: string) => Effect.Effect<string | null, StorageFailure>;
|
|
29
48
|
}
|
|
30
49
|
export declare const makeDefaultOpenapiStore: ({ pluginStorage, blobs }: StorageDeps) => OpenapiStore;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@executor-js/plugin-openapi",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.18",
|
|
4
4
|
"homepage": "https://github.com/RhysSullivan/executor/tree/main/packages/plugins/openapi",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/RhysSullivan/executor/issues"
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@effect/platform-node": "4.0.0-beta.59",
|
|
56
|
-
"@executor-js/config": "1.5.
|
|
57
|
-
"@executor-js/sdk": "1.5.
|
|
56
|
+
"@executor-js/config": "1.5.18",
|
|
57
|
+
"@executor-js/sdk": "1.5.18",
|
|
58
58
|
"js-yaml": "4.1.1",
|
|
59
59
|
"lucide-react": "^1.7.0",
|
|
60
60
|
"openapi-types": "^12.1.3"
|
|
@@ -1 +0,0 @@
|
|
|
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 { JSON_SCHEMA, load as parseYamlDocument } from \"js-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 const specText = yield* response.text.pipe(\n Effect.mapError(\n (_cause) =>\n new OpenApiParseError({\n message: \"Failed to read OpenAPI document body\",\n }),\n ),\n );\n return specText;\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: () => parseYamlDocument(text, { json: true, schema: JSON_SCHEMA }) 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 OperationFileHint = Schema.Struct({\n kind: Schema.Literals([\"binaryResponse\", \"byteField\"]),\n mimeType: Schema.OptionFromOptional(Schema.String),\n dataField: Schema.OptionFromOptional(Schema.String),\n sizeField: Schema.OptionFromOptional(Schema.String),\n encoding: Schema.OptionFromOptional(Schema.Literals([\"base64\", \"base64url\"])),\n});\nexport type OperationFileHint = typeof OperationFileHint.Type;\n\nexport const OperationResponseBody = Schema.Struct({\n contentType: Schema.String,\n schema: Schema.OptionFromOptional(Schema.Unknown),\n fileHint: Schema.OptionFromOptional(OperationFileHint),\n});\nexport type OperationResponseBody = typeof OperationResponseBody.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 responseBody: Schema.OptionFromOptional(OperationResponseBody),\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 responseBody: Schema.OptionFromOptional(OperationResponseBody),\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 OperationFileHint,\n OperationId,\n OperationParameter,\n OperationRequestBody,\n OperationResponseBody,\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 isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst stringType = (schema: Record<string, unknown>): boolean =>\n schema.type === \"string\" || (Array.isArray(schema.type) && schema.type.includes(\"string\"));\n\nconst numericType = (schema: Record<string, unknown>): boolean =>\n schema.type === \"integer\" ||\n schema.type === \"number\" ||\n (Array.isArray(schema.type) &&\n (schema.type.includes(\"integer\") || schema.type.includes(\"number\")));\n\nconst normalizedMediaType = (mediaType: string): string =>\n mediaType.split(\";\")[0]?.trim().toLowerCase() ?? \"\";\n\nconst isJsonMediaType = (mediaType: string): boolean => {\n const normalized = normalizedMediaType(mediaType);\n return (\n normalized === \"application/json\" || normalized.includes(\"+json\") || normalized.includes(\"json\")\n );\n};\n\nconst binaryStringSchema = (schema: Record<string, unknown>): boolean =>\n stringType(schema) && (schema.format === \"binary\" || schema.format === \"byte\");\n\nconst base64EncodingFromDescription = (schema: Record<string, unknown>): \"base64\" | \"base64url\" =>\n typeof schema.description === \"string\" &&\n /base64url|base64-url|url[- ]safe/i.test(schema.description)\n ? \"base64url\"\n : \"base64\";\n\nconst detectFileHint = (\n schema: unknown,\n mediaType: string,\n r: DocResolver,\n): OperationFileHint | undefined => {\n const resolved = isRecord(schema) ? r.resolve<Record<string, unknown>>(schema) : null;\n if (!resolved) return undefined;\n\n if (!isJsonMediaType(mediaType) && binaryStringSchema(resolved)) {\n return OperationFileHint.make({\n kind: \"binaryResponse\",\n mimeType: Option.some(mediaType),\n dataField: Option.none(),\n sizeField: Option.none(),\n encoding: Option.none(),\n });\n }\n\n if (!isJsonMediaType(mediaType)) return undefined;\n\n const properties = resolved.properties;\n if (!isRecord(properties)) return undefined;\n const data = properties.data;\n const dataSchema = isRecord(data) ? r.resolve<Record<string, unknown>>(data) : null;\n if (!dataSchema || !binaryStringSchema(dataSchema)) return undefined;\n\n const size = properties.size;\n const sizeSchema = isRecord(size) ? r.resolve<Record<string, unknown>>(size) : null;\n const sizeField = sizeSchema && numericType(sizeSchema) ? \"size\" : undefined;\n\n return OperationFileHint.make({\n kind: \"byteField\",\n mimeType: Option.some(\"application/octet-stream\"),\n dataField: Option.some(\"data\"),\n sizeField: sizeField ? Option.some(sizeField) : Option.none(),\n encoding: Option.some(base64EncodingFromDescription(dataSchema)),\n });\n};\n\nconst extractResponseBody = (\n operation: OperationObject,\n r: DocResolver,\n): OperationResponseBody | 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) {\n return OperationResponseBody.make({\n contentType: content.mediaType,\n schema: Option.some(content.media.schema),\n fileHint: Option.fromNullishOr(detectFileHint(content.media.schema, content.mediaType, r)),\n });\n }\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 responseBody = extractResponseBody(operation, r);\n const servers = operationServers(pathItem, operation, docServers);\n const inputSchema = buildInputSchema(parameters, requestBody, servers);\n const outputSchema = responseBody ? Option.getOrUndefined(responseBody.schema) : undefined;\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 responseBody: Option.fromNullishOr(responseBody),\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// HTTP/UI preview deliberately omits the per-operation list. Graph-sized specs\n// can define 16k+ operations, while the add flow only needs counts, tags,\n// servers, and auth metadata before registration.\nexport const SpecPreviewSummary = Schema.Struct({\n title: Schema.OptionFromOptional(Schema.String),\n description: Schema.OptionFromOptional(Schema.String),\n version: Schema.OptionFromOptional(Schema.String),\n servers: Schema.Array(ServerInfo),\n operationCount: Schema.Number,\n tags: Schema.Array(Schema.String),\n securitySchemes: Schema.Array(SecurityScheme),\n authStrategies: Schema.Array(AuthStrategy),\n headerPresets: Schema.Array(HeaderPreset),\n oauth2Presets: Schema.Array(OAuth2Preset),\n});\nexport type SpecPreviewSummary = typeof SpecPreviewSummary.Type;\n\nexport const specPreviewSummary = (preview: SpecPreview): SpecPreviewSummary =>\n SpecPreviewSummary.make({\n title: preview.title,\n description: preview.description,\n version: preview.version,\n servers: preview.servers,\n operationCount: preview.operationCount,\n tags: preview.tags,\n securitySchemes: preview.securitySchemes,\n authStrategies: preview.authStrategies,\n headerPresets: preview.headerPresets,\n oauth2Presets: preview.oauth2Presets,\n });\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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