@executor-js/plugin-openapi 0.0.1-beta.6 → 0.0.2
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/README.md +24 -23
- package/dist/api/group.d.ts +94 -37
- package/dist/api/handlers.d.ts +2 -2
- package/dist/chunk-ZZ7TQ4JC.js +2602 -0
- package/dist/chunk-ZZ7TQ4JC.js.map +1 -0
- package/dist/core.js +46 -50
- package/dist/core.js.map +1 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/dist/react/AddOpenApiSource.d.ts +13 -0
- package/dist/react/EditOpenApiSource.d.ts +2 -2
- package/dist/react/OpenApiSourceSummary.d.ts +3 -1
- package/dist/react/atoms.d.ts +129 -0
- package/dist/react/client.d.ts +421 -3
- package/dist/react/source-plugin.d.ts +1 -1
- package/dist/sdk/client-credentials-oauth.test.d.ts +1 -0
- package/dist/sdk/credential-status.d.ts +23 -0
- package/dist/sdk/credential-status.test.d.ts +1 -0
- package/dist/sdk/errors.d.ts +11 -10
- package/dist/sdk/form-urlencoded-body.test.d.ts +1 -0
- package/dist/sdk/index.d.ts +8 -10
- package/dist/sdk/invoke.d.ts +8 -17
- package/dist/sdk/multi-scope-bearer.test.d.ts +1 -0
- package/dist/sdk/multi-scope-oauth.test.d.ts +1 -0
- package/dist/sdk/non-json-body.test.d.ts +1 -0
- package/dist/sdk/oauth-refresh.test.d.ts +1 -0
- package/dist/sdk/openapi-utils.d.ts +35 -4
- package/dist/sdk/parse.d.ts +28 -4
- package/dist/sdk/plugin.d.ts +169 -22
- package/dist/sdk/preview-oauth2.test.d.ts +1 -0
- package/dist/sdk/preview.d.ts +89 -125
- package/dist/sdk/store.d.ts +201 -0
- package/dist/sdk/types.d.ts +234 -266
- package/package.json +11 -22
- package/dist/chunk-V3D5A6HA.js +0 -1224
- package/dist/chunk-V3D5A6HA.js.map +0 -1
- package/dist/promise.d.ts +0 -6
- package/dist/sdk/config-file-store.d.ts +0 -10
- package/dist/sdk/kv-operation-store.d.ts +0 -4
- package/dist/sdk/operation-store.d.ts +0 -35
- package/dist/sdk/stored-source.d.ts +0 -46
package/dist/sdk/invoke.d.ts
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import { Effect, Layer } from "effect";
|
|
2
|
-
import { HttpClient } from "
|
|
3
|
-
import
|
|
2
|
+
import { HttpClient } from "effect/unstable/http";
|
|
3
|
+
import type { SecretOwnedByConnectionError, StorageFailure } from "@executor-js/sdk/core";
|
|
4
4
|
import { OpenApiInvocationError } from "./errors";
|
|
5
|
-
import type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
5
|
+
import { type HeaderValue, type OperationBinding, InvocationResult } from "./types";
|
|
6
|
+
export declare const resolveHeaders: (headers: Record<string, HeaderValue>, secrets: {
|
|
7
|
+
readonly get: (id: string) => Effect.Effect<string | null, SecretOwnedByConnectionError | StorageFailure>;
|
|
8
|
+
}) => Effect.Effect<Record<string, string>, OpenApiInvocationError | StorageFailure>;
|
|
9
|
+
export declare const invoke: (operation: OperationBinding, args: Record<string, unknown>, resolvedHeaders: Record<string, string>, sourceQueryParams?: Record<string, string> | undefined) => Effect.Effect<InvocationResult, OpenApiInvocationError, HttpClient.HttpClient>;
|
|
10
|
+
export declare const invokeWithLayer: (operation: OperationBinding, args: Record<string, unknown>, baseUrl: string, resolvedHeaders: Record<string, string>, sourceQueryParams: Record<string, string>, httpClientLayer: Layer.Layer<HttpClient.HttpClient, never, never>) => Effect.Effect<InvocationResult, OpenApiInvocationError, never>;
|
|
12
11
|
export declare const annotationsForOperation: (method: string, pathTemplate: string) => {
|
|
13
12
|
requiresApproval?: boolean;
|
|
14
13
|
approvalDescription?: string;
|
|
15
14
|
};
|
|
16
|
-
export declare const makeOpenApiInvoker: (opts: {
|
|
17
|
-
readonly operationStore: OpenApiOperationStore;
|
|
18
|
-
readonly httpClientLayer: Layer.Layer<HttpClient.HttpClient>;
|
|
19
|
-
readonly secrets: {
|
|
20
|
-
readonly resolve: (secretId: SecretId, scopeId: ScopeId) => Effect.Effect<string, unknown>;
|
|
21
|
-
};
|
|
22
|
-
readonly scopeId: ScopeId;
|
|
23
|
-
}) => ToolInvoker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -13,12 +13,43 @@ export declare class DocResolver {
|
|
|
13
13
|
resolve<T>(value: T | OpenAPIV3.ReferenceObject | OpenAPIV3_1.ReferenceObject): T | null;
|
|
14
14
|
private resolvePointer;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
/** Substitute `{var}` placeholders in a templated URL using a plain map. */
|
|
17
|
+
export declare const substituteUrlVariables: (url: string, values: Record<string, string>) => string;
|
|
18
|
+
type ServerLike = {
|
|
17
19
|
url: string;
|
|
18
|
-
variables: import("effect/Option").Option<Record<string,
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
variables: import("effect/Option").Option<Record<string, {
|
|
21
|
+
default: string;
|
|
22
|
+
} | string>>;
|
|
23
|
+
};
|
|
24
|
+
export declare const resolveBaseUrl: (servers: readonly ServerLike[]) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Return all declared media entries in spec order. `Object.entries` on a
|
|
27
|
+
* plain object preserves insertion order in modern engines, which matches
|
|
28
|
+
* spec declaration order as the parser produced it.
|
|
29
|
+
*/
|
|
30
|
+
export declare const declaredContents: (content: Record<string, MediaTypeObject> | undefined) => ReadonlyArray<{
|
|
31
|
+
mediaType: string;
|
|
32
|
+
media: MediaTypeObject;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Pick the default media type for a requestBody or response. Matches
|
|
36
|
+
* swagger-client behaviour: **first declared wins** (not JSON-first). Spec
|
|
37
|
+
* authors order content entries to signal intent (upload-heavy endpoints
|
|
38
|
+
* declare multipart first, JSON second); respecting that order avoids
|
|
39
|
+
* silently downgrading a multipart endpoint to JSON.
|
|
40
|
+
*
|
|
41
|
+
* For response bodies we still want a JSON preference because the server
|
|
42
|
+
* picks the response content type, not the client — the old `application/
|
|
43
|
+
* json` preference is preserved via `preferredResponseContent` below.
|
|
44
|
+
*/
|
|
21
45
|
export declare const preferredContent: (content: Record<string, MediaTypeObject> | undefined) => {
|
|
22
46
|
mediaType: string;
|
|
23
47
|
media: MediaTypeObject;
|
|
24
48
|
} | undefined;
|
|
49
|
+
/** Response-side content picker — still JSON-first because the server
|
|
50
|
+
* picks the response media type, so we want to advertise a preference. */
|
|
51
|
+
export declare const preferredResponseContent: (content: Record<string, MediaTypeObject> | undefined) => {
|
|
52
|
+
mediaType: string;
|
|
53
|
+
media: MediaTypeObject;
|
|
54
|
+
} | undefined;
|
|
55
|
+
export {};
|
package/dist/sdk/parse.d.ts
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
import type { OpenAPIV3, OpenAPIV3_1 } from "openapi-types";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
|
-
import {
|
|
3
|
+
import { HttpClient } from "effect/unstable/http";
|
|
4
|
+
import { OpenApiExtractionError, OpenApiParseError } from "./errors";
|
|
4
5
|
export type ParsedDocument = OpenAPIV3.Document | OpenAPIV3_1.Document;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
export interface SpecFetchCredentials {
|
|
7
|
+
readonly headers?: Record<string, string>;
|
|
8
|
+
readonly queryParams?: Record<string, string>;
|
|
9
|
+
}
|
|
8
10
|
declare class OpenApiExtractionErrorFromParse extends OpenApiExtractionError {
|
|
9
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Fetch an OpenAPI spec URL and return its body text. Uses the Effect
|
|
14
|
+
* HttpClient so the caller chooses the transport via layer — in Cloudflare
|
|
15
|
+
* Workers, `FetchHttpClient.layer` binds to the Workers-native `fetch` and
|
|
16
|
+
* avoids json-schema-ref-parser's Node-polyfill http resolver, which hangs
|
|
17
|
+
* in production. Bounded by a 20s timeout.
|
|
18
|
+
*/
|
|
19
|
+
export declare const fetchSpecText: (url: string, credentials?: SpecFetchCredentials | undefined) => Effect.Effect<string, OpenApiParseError, HttpClient.HttpClient>;
|
|
20
|
+
/**
|
|
21
|
+
* Resolve an input string to spec text — if it's a URL, fetch it via
|
|
22
|
+
* HttpClient; otherwise return it as-is.
|
|
23
|
+
*/
|
|
24
|
+
export declare const resolveSpecText: (input: string, credentials?: SpecFetchCredentials) => Effect.Effect<string, OpenApiParseError, HttpClient.HttpClient>;
|
|
25
|
+
/**
|
|
26
|
+
* Parse an OpenAPI document from spec text and validate it's OpenAPI 3.x.
|
|
27
|
+
*
|
|
28
|
+
* NOTE: does NOT resolve `$ref`s. `DocResolver` + `normalizeOpenApiRefs`
|
|
29
|
+
* downstream work on refs lazily, so inlining them here would just waste
|
|
30
|
+
* memory — and for big specs (e.g. Cloudflare's API) that blows through
|
|
31
|
+
* the 128MB Cloudflare Workers memory cap.
|
|
32
|
+
*/
|
|
33
|
+
export declare const parse: (text: string) => Effect.Effect<ParsedDocument, OpenApiParseError | OpenApiExtractionErrorFromParse, never>;
|
|
10
34
|
export {};
|
package/dist/sdk/plugin.d.ts
CHANGED
|
@@ -1,39 +1,186 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { HttpClient } from "
|
|
2
|
+
import { HttpClient } from "effect/unstable/http";
|
|
3
3
|
import type { Layer } from "effect";
|
|
4
|
-
import { type
|
|
5
|
-
import
|
|
4
|
+
import { type StorageFailure } from "@executor-js/sdk/core";
|
|
5
|
+
import { type ConfigFileSink } from "@executor-js/config";
|
|
6
|
+
import { OpenApiExtractionError, OpenApiOAuthError, OpenApiParseError } from "./errors";
|
|
6
7
|
import { SpecPreview } from "./preview";
|
|
7
|
-
import { type
|
|
8
|
-
|
|
8
|
+
import { type OpenapiStore, type StoredSource } from "./store";
|
|
9
|
+
import { OAuth2Auth, OAuth2SourceConfig, OpenApiSourceBindingInput, type OpenApiSourceBindingRef, type ConfiguredHeaderValue as ConfiguredHeaderValueValue, type HeaderValue as HeaderValueValue } from "./types";
|
|
9
10
|
export type HeaderValue = HeaderValueValue;
|
|
11
|
+
export type ConfiguredHeaderValue = ConfiguredHeaderValueValue;
|
|
12
|
+
export type OpenApiHeaderInput = HeaderValue | ConfiguredHeaderValue;
|
|
13
|
+
export type OpenApiOAuthInput = OAuth2Auth | OAuth2SourceConfig;
|
|
14
|
+
export interface OpenApiSpecFetchCredentials {
|
|
15
|
+
readonly headers?: Record<string, HeaderValue>;
|
|
16
|
+
readonly queryParams?: Record<string, HeaderValue>;
|
|
17
|
+
}
|
|
18
|
+
export interface OpenApiPreviewInput {
|
|
19
|
+
readonly spec: string;
|
|
20
|
+
readonly specFetchCredentials?: OpenApiSpecFetchCredentials;
|
|
21
|
+
}
|
|
10
22
|
export interface OpenApiSpecConfig {
|
|
11
23
|
readonly spec: string;
|
|
24
|
+
readonly specFetchCredentials?: OpenApiSpecFetchCredentials;
|
|
25
|
+
/**
|
|
26
|
+
* Executor scope id that owns this source row. Must be one of the
|
|
27
|
+
* executor's configured scopes. Typical shape: an admin adds the
|
|
28
|
+
* source at the outermost (organization) scope so it's visible to
|
|
29
|
+
* every inner (per-user) scope via fall-through reads.
|
|
30
|
+
*/
|
|
31
|
+
readonly scope: string;
|
|
12
32
|
readonly name?: string;
|
|
13
33
|
readonly baseUrl?: string;
|
|
14
34
|
readonly namespace?: string;
|
|
15
|
-
|
|
16
|
-
readonly
|
|
35
|
+
readonly headers?: Record<string, OpenApiHeaderInput>;
|
|
36
|
+
readonly queryParams?: Record<string, HeaderValue>;
|
|
37
|
+
readonly oauth2?: OpenApiOAuthInput;
|
|
17
38
|
}
|
|
18
39
|
export interface OpenApiUpdateSourceInput {
|
|
40
|
+
readonly name?: string;
|
|
19
41
|
readonly baseUrl?: string;
|
|
20
|
-
readonly headers?: Record<string,
|
|
42
|
+
readonly headers?: Record<string, OpenApiHeaderInput>;
|
|
43
|
+
readonly queryParams?: Record<string, HeaderValue>;
|
|
44
|
+
/** Refresh the source's stored OAuth2 metadata after a successful
|
|
45
|
+
* re-authenticate. */
|
|
46
|
+
readonly oauth2?: OpenApiOAuthInput;
|
|
21
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Errors any OpenAPI extension method may surface. The first three are
|
|
50
|
+
* plugin-domain tagged errors that flow directly to clients (4xx, each
|
|
51
|
+
* carrying its own `HttpApiSchema` status). `StorageFailure` covers
|
|
52
|
+
* raw backend failures (`StorageError`) plus `UniqueViolationError`;
|
|
53
|
+
* the HTTP edge (`@executor-js/api`'s `withCapture`) translates
|
|
54
|
+
* `StorageError` to the opaque `InternalError({ traceId })` at Layer
|
|
55
|
+
* composition. `UniqueViolationError` passes through — plugins can
|
|
56
|
+
* `Effect.catchTag` it if they want a friendlier user-facing error.
|
|
57
|
+
*/
|
|
58
|
+
export type OpenApiExtensionFailure = OpenApiParseError | OpenApiExtractionError | OpenApiOAuthError | StorageFailure;
|
|
22
59
|
export interface OpenApiPluginExtension {
|
|
23
|
-
|
|
24
|
-
readonly previewSpec: (specText: string) => Effect.Effect<SpecPreview, Error>;
|
|
25
|
-
/** Add an OpenAPI spec and register its operations as tools */
|
|
60
|
+
readonly previewSpec: (input: string | OpenApiPreviewInput) => Effect.Effect<SpecPreview, OpenApiParseError | OpenApiExtractionError | OpenApiOAuthError | StorageFailure>;
|
|
26
61
|
readonly addSpec: (config: OpenApiSpecConfig) => Effect.Effect<{
|
|
62
|
+
readonly sourceId: string;
|
|
27
63
|
readonly toolCount: number;
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
readonly
|
|
31
|
-
|
|
32
|
-
readonly
|
|
33
|
-
|
|
34
|
-
readonly
|
|
64
|
+
}, OpenApiParseError | OpenApiExtractionError | OpenApiOAuthError | StorageFailure>;
|
|
65
|
+
readonly removeSpec: (namespace: string, scope: string) => Effect.Effect<void, StorageFailure>;
|
|
66
|
+
readonly getSource: (namespace: string, scope: string) => Effect.Effect<StoredSource | null, StorageFailure>;
|
|
67
|
+
readonly updateSource: (namespace: string, scope: string, input: OpenApiUpdateSourceInput) => Effect.Effect<void, StorageFailure>;
|
|
68
|
+
readonly listSourceBindings: (sourceId: string, sourceScope: string) => Effect.Effect<readonly OpenApiSourceBindingRef[], StorageFailure>;
|
|
69
|
+
readonly setSourceBinding: (input: OpenApiSourceBindingInput) => Effect.Effect<OpenApiSourceBindingRef, StorageFailure>;
|
|
70
|
+
readonly removeSourceBinding: (sourceId: string, sourceScope: string, slot: string, scope: string) => Effect.Effect<void, StorageFailure>;
|
|
71
|
+
}
|
|
72
|
+
export interface OpenApiPluginOptions {
|
|
73
|
+
readonly httpClientLayer?: Layer.Layer<HttpClient.HttpClient, never, never>;
|
|
74
|
+
/** If provided, source add/remove is mirrored to executor.jsonc
|
|
75
|
+
* (best-effort — file errors are logged, not raised). */
|
|
76
|
+
readonly configFile?: ConfigFileSink;
|
|
35
77
|
}
|
|
36
|
-
export declare const openApiPlugin: (
|
|
37
|
-
readonly
|
|
38
|
-
|
|
39
|
-
|
|
78
|
+
export declare const openApiPlugin: import("@executor-js/sdk/core").ConfiguredPlugin<"openapi", OpenApiPluginExtension, OpenapiStore, OpenApiPluginOptions, {
|
|
79
|
+
readonly openapi_source: {
|
|
80
|
+
readonly fields: {
|
|
81
|
+
readonly id: {
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
readonly required: true;
|
|
84
|
+
};
|
|
85
|
+
readonly scope_id: {
|
|
86
|
+
readonly type: "string";
|
|
87
|
+
readonly required: true;
|
|
88
|
+
readonly index: true;
|
|
89
|
+
};
|
|
90
|
+
readonly name: {
|
|
91
|
+
readonly type: "string";
|
|
92
|
+
readonly required: true;
|
|
93
|
+
};
|
|
94
|
+
readonly spec: {
|
|
95
|
+
readonly type: "string";
|
|
96
|
+
readonly required: true;
|
|
97
|
+
};
|
|
98
|
+
readonly source_url: {
|
|
99
|
+
readonly type: "string";
|
|
100
|
+
readonly required: false;
|
|
101
|
+
};
|
|
102
|
+
readonly base_url: {
|
|
103
|
+
readonly type: "string";
|
|
104
|
+
readonly required: false;
|
|
105
|
+
};
|
|
106
|
+
readonly headers: {
|
|
107
|
+
readonly type: "json";
|
|
108
|
+
readonly required: false;
|
|
109
|
+
};
|
|
110
|
+
readonly query_params: {
|
|
111
|
+
readonly type: "json";
|
|
112
|
+
readonly required: false;
|
|
113
|
+
};
|
|
114
|
+
readonly oauth2: {
|
|
115
|
+
readonly type: "json";
|
|
116
|
+
readonly required: false;
|
|
117
|
+
};
|
|
118
|
+
readonly invocation_config: {
|
|
119
|
+
readonly type: "json";
|
|
120
|
+
readonly required: true;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
readonly openapi_operation: {
|
|
125
|
+
readonly fields: {
|
|
126
|
+
readonly id: {
|
|
127
|
+
readonly type: "string";
|
|
128
|
+
readonly required: true;
|
|
129
|
+
};
|
|
130
|
+
readonly scope_id: {
|
|
131
|
+
readonly type: "string";
|
|
132
|
+
readonly required: true;
|
|
133
|
+
readonly index: true;
|
|
134
|
+
};
|
|
135
|
+
readonly source_id: {
|
|
136
|
+
readonly type: "string";
|
|
137
|
+
readonly required: true;
|
|
138
|
+
readonly index: true;
|
|
139
|
+
};
|
|
140
|
+
readonly binding: {
|
|
141
|
+
readonly type: "json";
|
|
142
|
+
readonly required: true;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
readonly openapi_source_binding: {
|
|
147
|
+
readonly fields: {
|
|
148
|
+
readonly id: {
|
|
149
|
+
readonly type: "string";
|
|
150
|
+
readonly required: true;
|
|
151
|
+
};
|
|
152
|
+
readonly source_id: {
|
|
153
|
+
readonly type: "string";
|
|
154
|
+
readonly required: true;
|
|
155
|
+
readonly index: true;
|
|
156
|
+
};
|
|
157
|
+
readonly source_scope_id: {
|
|
158
|
+
readonly type: "string";
|
|
159
|
+
readonly required: true;
|
|
160
|
+
readonly index: true;
|
|
161
|
+
};
|
|
162
|
+
readonly target_scope_id: {
|
|
163
|
+
readonly type: "string";
|
|
164
|
+
readonly required: true;
|
|
165
|
+
readonly index: true;
|
|
166
|
+
};
|
|
167
|
+
readonly slot: {
|
|
168
|
+
readonly type: "string";
|
|
169
|
+
readonly required: true;
|
|
170
|
+
readonly index: true;
|
|
171
|
+
};
|
|
172
|
+
readonly value: {
|
|
173
|
+
readonly type: "json";
|
|
174
|
+
readonly required: true;
|
|
175
|
+
};
|
|
176
|
+
readonly created_at: {
|
|
177
|
+
readonly type: "date";
|
|
178
|
+
readonly required: true;
|
|
179
|
+
};
|
|
180
|
+
readonly updated_at: {
|
|
181
|
+
readonly type: "date";
|
|
182
|
+
readonly required: true;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/sdk/preview.d.ts
CHANGED
|
@@ -1,148 +1,112 @@
|
|
|
1
|
-
import { Effect
|
|
1
|
+
import { Effect } from "effect";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
import { ServerInfo } from "./types";
|
|
4
|
+
declare const OAuth2AuthorizationCodeFlow_base: Schema.Class<OAuth2AuthorizationCodeFlow, Schema.Struct<{
|
|
5
|
+
readonly authorizationUrl: Schema.String;
|
|
6
|
+
readonly tokenUrl: Schema.String;
|
|
7
|
+
readonly refreshUrl: Schema.OptionFromOptional<Schema.String>;
|
|
8
|
+
readonly scopes: Schema.$Record<Schema.String, Schema.String>;
|
|
9
|
+
}>, {}>;
|
|
10
|
+
export declare class OAuth2AuthorizationCodeFlow extends OAuth2AuthorizationCodeFlow_base {
|
|
11
|
+
}
|
|
12
|
+
declare const OAuth2ClientCredentialsFlow_base: Schema.Class<OAuth2ClientCredentialsFlow, Schema.Struct<{
|
|
13
|
+
readonly tokenUrl: Schema.String;
|
|
14
|
+
readonly refreshUrl: Schema.OptionFromOptional<Schema.String>;
|
|
15
|
+
readonly scopes: Schema.$Record<Schema.String, Schema.String>;
|
|
16
|
+
}>, {}>;
|
|
17
|
+
export declare class OAuth2ClientCredentialsFlow extends OAuth2ClientCredentialsFlow_base {
|
|
18
|
+
}
|
|
19
|
+
declare const OAuth2Flows_base: Schema.Class<OAuth2Flows, Schema.Struct<{
|
|
20
|
+
readonly authorizationCode: Schema.OptionFromOptional<typeof OAuth2AuthorizationCodeFlow>;
|
|
21
|
+
readonly clientCredentials: Schema.OptionFromOptional<typeof OAuth2ClientCredentialsFlow>;
|
|
22
|
+
}>, {}>;
|
|
23
|
+
export declare class OAuth2Flows extends OAuth2Flows_base {
|
|
24
|
+
}
|
|
25
|
+
declare const SecurityScheme_base: Schema.Class<SecurityScheme, Schema.Struct<{
|
|
24
26
|
/** Key name in components.securitySchemes (e.g. "api_token") */
|
|
25
|
-
name:
|
|
27
|
+
readonly name: Schema.String;
|
|
26
28
|
/** OpenAPI security scheme type */
|
|
27
|
-
type: Schema.
|
|
29
|
+
readonly type: Schema.Literals<readonly ["http", "apiKey", "oauth2", "openIdConnect"]>;
|
|
28
30
|
/** For type: "http" — e.g. "bearer", "basic" */
|
|
29
|
-
scheme: Schema.
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
readonly scheme: Schema.OptionFromOptional<Schema.String>;
|
|
32
|
+
/** For type: "http" with scheme "bearer" — e.g. "JWT" */
|
|
33
|
+
readonly bearerFormat: Schema.OptionFromOptional<Schema.String>;
|
|
32
34
|
/** For type: "apiKey" — where the key goes */
|
|
33
|
-
in: Schema.
|
|
34
|
-
as: "Option";
|
|
35
|
-
}>;
|
|
35
|
+
readonly in: Schema.OptionFromOptional<Schema.Literals<readonly ["header", "query", "cookie"]>>;
|
|
36
36
|
/** For type: "apiKey" — the header/query/cookie name */
|
|
37
|
-
headerName: Schema.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}>,
|
|
44
|
-
readonly name: string;
|
|
45
|
-
} & {
|
|
46
|
-
readonly description: Option.Option<string>;
|
|
47
|
-
} & {
|
|
48
|
-
readonly type: "http" | "apiKey" | "oauth2" | "openIdConnect";
|
|
49
|
-
} & {
|
|
50
|
-
readonly scheme: Option.Option<string>;
|
|
51
|
-
} & {
|
|
52
|
-
readonly in: Option.Option<"query" | "header" | "cookie">;
|
|
53
|
-
} & {
|
|
54
|
-
readonly headerName: Option.Option<string>;
|
|
55
|
-
}, {}, {}>;
|
|
37
|
+
readonly headerName: Schema.OptionFromOptional<Schema.String>;
|
|
38
|
+
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
39
|
+
/** For type: "oauth2" — declared flows (authorizationCode / clientCredentials only; implicit and password are deprecated). */
|
|
40
|
+
readonly flows: Schema.OptionFromOptional<typeof OAuth2Flows>;
|
|
41
|
+
/** For type: "openIdConnect" — the discovery URL. */
|
|
42
|
+
readonly openIdConnectUrl: Schema.OptionFromOptional<Schema.String>;
|
|
43
|
+
}>, {}>;
|
|
56
44
|
export declare class SecurityScheme extends SecurityScheme_base {
|
|
57
45
|
}
|
|
58
|
-
declare const AuthStrategy_base: Schema.Class<AuthStrategy, {
|
|
59
|
-
/** The security schemes required together for this strategy */
|
|
60
|
-
schemes: Schema.Array$<typeof Schema.String>;
|
|
61
|
-
}, Schema.Struct.Encoded<{
|
|
46
|
+
declare const AuthStrategy_base: Schema.Class<AuthStrategy, Schema.Struct<{
|
|
62
47
|
/** The security schemes required together for this strategy */
|
|
63
|
-
schemes: Schema
|
|
64
|
-
}>,
|
|
65
|
-
readonly schemes: readonly string[];
|
|
66
|
-
}, {}, {}>;
|
|
48
|
+
readonly schemes: Schema.$Array<Schema.String>;
|
|
49
|
+
}>, {}>;
|
|
67
50
|
export declare class AuthStrategy extends AuthStrategy_base {
|
|
68
51
|
}
|
|
69
|
-
declare const HeaderPreset_base: Schema.Class<HeaderPreset, {
|
|
52
|
+
declare const HeaderPreset_base: Schema.Class<HeaderPreset, Schema.Struct<{
|
|
70
53
|
/** Human-readable label for the UI (e.g. "Bearer Token", "API Key + Email") */
|
|
71
|
-
label:
|
|
54
|
+
readonly label: Schema.String;
|
|
72
55
|
/** Headers this strategy needs. Value is null when the user must provide it. */
|
|
73
|
-
headers: Schema
|
|
56
|
+
readonly headers: Schema.$Record<Schema.String, Schema.NullOr<Schema.String>>;
|
|
74
57
|
/** Which headers should be stored as secrets */
|
|
75
|
-
secretHeaders: Schema
|
|
76
|
-
}
|
|
77
|
-
/** Human-readable label for the UI (e.g. "Bearer Token", "API Key + Email") */
|
|
78
|
-
label: typeof Schema.String;
|
|
79
|
-
/** Headers this strategy needs. Value is null when the user must provide it. */
|
|
80
|
-
headers: Schema.Record$<typeof Schema.String, Schema.NullOr<typeof Schema.String>>;
|
|
81
|
-
/** Which headers should be stored as secrets */
|
|
82
|
-
secretHeaders: Schema.Array$<typeof Schema.String>;
|
|
83
|
-
}>, never, {
|
|
84
|
-
readonly headers: {
|
|
85
|
-
readonly [x: string]: string | null;
|
|
86
|
-
};
|
|
87
|
-
} & {
|
|
88
|
-
readonly label: string;
|
|
89
|
-
} & {
|
|
90
|
-
readonly secretHeaders: readonly string[];
|
|
91
|
-
}, {}, {}>;
|
|
58
|
+
readonly secretHeaders: Schema.$Array<Schema.String>;
|
|
59
|
+
}>, {}>;
|
|
92
60
|
export declare class HeaderPreset extends HeaderPreset_base {
|
|
93
61
|
}
|
|
94
|
-
declare const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
62
|
+
declare const OAuth2Preset_base: Schema.Class<OAuth2Preset, Schema.Struct<{
|
|
63
|
+
/** Human-readable label for the UI (e.g. "OAuth2 (Authorization Code) — oauth_app") */
|
|
64
|
+
readonly label: Schema.String;
|
|
65
|
+
/** The source security scheme this preset came from (components.securitySchemes key). */
|
|
66
|
+
readonly securitySchemeName: Schema.String;
|
|
67
|
+
/** Which OAuth2 flow this preset uses. */
|
|
68
|
+
readonly flow: Schema.Literals<readonly ["authorizationCode", "clientCredentials"]>;
|
|
69
|
+
/** For authorizationCode: user-agent redirect URL (from the spec). */
|
|
70
|
+
readonly authorizationUrl: Schema.OptionFromOptional<Schema.String>;
|
|
71
|
+
/** Token endpoint to exchange the code / refresh. */
|
|
72
|
+
readonly tokenUrl: Schema.String;
|
|
73
|
+
/** Optional refresh endpoint if the spec declares one separately. */
|
|
74
|
+
readonly refreshUrl: Schema.OptionFromOptional<Schema.String>;
|
|
75
|
+
/** Declared scopes for this flow: `{ scope: description }`. */
|
|
76
|
+
readonly scopes: Schema.$Record<Schema.String, Schema.String>;
|
|
77
|
+
}>, {}>;
|
|
78
|
+
export declare class OAuth2Preset extends OAuth2Preset_base {
|
|
79
|
+
}
|
|
80
|
+
declare const PreviewOperation_base: Schema.Class<PreviewOperation, Schema.Struct<{
|
|
81
|
+
readonly operationId: Schema.String;
|
|
82
|
+
readonly method: Schema.Literals<readonly ["get", "put", "post", "delete", "patch", "head", "options", "trace"]>;
|
|
83
|
+
readonly path: Schema.String;
|
|
84
|
+
readonly summary: Schema.OptionFromOptional<Schema.String>;
|
|
85
|
+
readonly tags: Schema.$Array<Schema.String>;
|
|
86
|
+
readonly deprecated: Schema.Boolean;
|
|
87
|
+
}>, {}>;
|
|
88
|
+
export declare class PreviewOperation extends PreviewOperation_base {
|
|
89
|
+
}
|
|
90
|
+
declare const SpecPreview_base: Schema.Class<SpecPreview, Schema.Struct<{
|
|
91
|
+
readonly title: Schema.OptionFromOptional<Schema.String>;
|
|
92
|
+
readonly version: Schema.OptionFromOptional<Schema.String>;
|
|
117
93
|
/** Reuses ServerInfo from extraction */
|
|
118
|
-
servers: Schema
|
|
119
|
-
operationCount:
|
|
120
|
-
|
|
121
|
-
|
|
94
|
+
readonly servers: Schema.$Array<typeof ServerInfo>;
|
|
95
|
+
readonly operationCount: Schema.Number;
|
|
96
|
+
/** Lightweight operation list for the add-source UI */
|
|
97
|
+
readonly operations: Schema.$Array<typeof PreviewOperation>;
|
|
98
|
+
readonly tags: Schema.$Array<Schema.String>;
|
|
99
|
+
readonly securitySchemes: Schema.$Array<typeof SecurityScheme>;
|
|
122
100
|
/** Valid auth strategies (each is a set of schemes used together) */
|
|
123
|
-
authStrategies: Schema
|
|
101
|
+
readonly authStrategies: Schema.$Array<typeof AuthStrategy>;
|
|
124
102
|
/** Pre-built header presets derived from auth strategies */
|
|
125
|
-
headerPresets: Schema
|
|
126
|
-
|
|
127
|
-
readonly
|
|
128
|
-
}
|
|
129
|
-
readonly servers: readonly unknown[];
|
|
130
|
-
} & {
|
|
131
|
-
readonly tags: readonly string[];
|
|
132
|
-
} & {
|
|
133
|
-
readonly version: Option.Option<string>;
|
|
134
|
-
} & {
|
|
135
|
-
readonly securitySchemes: readonly SecurityScheme[];
|
|
136
|
-
} & {
|
|
137
|
-
readonly operationCount: number;
|
|
138
|
-
} & {
|
|
139
|
-
readonly authStrategies: readonly AuthStrategy[];
|
|
140
|
-
} & {
|
|
141
|
-
readonly headerPresets: readonly HeaderPreset[];
|
|
142
|
-
}, {}, {}>;
|
|
103
|
+
readonly headerPresets: Schema.$Array<typeof HeaderPreset>;
|
|
104
|
+
/** OAuth2 presets — one per (oauth2 scheme × supported flow) combination */
|
|
105
|
+
readonly oauth2Presets: Schema.$Array<typeof OAuth2Preset>;
|
|
106
|
+
}>, {}>;
|
|
143
107
|
export declare class SpecPreview extends SpecPreview_base {
|
|
144
108
|
}
|
|
145
109
|
/** Preview an OpenAPI spec — extract metadata without registering anything.
|
|
146
|
-
*
|
|
147
|
-
export declare const previewSpec: (
|
|
110
|
+
* Accepts either a URL or raw JSON/YAML text. */
|
|
111
|
+
export declare const previewSpec: (input: string) => Effect.Effect<SpecPreview, import("./errors").OpenApiParseError | import("./errors").OpenApiExtractionError, import("effect/unstable/http/HttpClient").HttpClient>;
|
|
148
112
|
export {};
|