@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/core.js
CHANGED
|
@@ -1,105 +1,101 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AuthStrategy,
|
|
3
3
|
DocResolver,
|
|
4
|
+
EncodingObject,
|
|
4
5
|
ExtractedOperation,
|
|
5
6
|
ExtractionResult,
|
|
6
7
|
HeaderPreset,
|
|
7
8
|
HttpMethod,
|
|
8
9
|
InvocationConfig,
|
|
9
10
|
InvocationResult,
|
|
11
|
+
MediaBinding,
|
|
12
|
+
OAuth2Auth,
|
|
13
|
+
OAuth2AuthorizationCodeFlow,
|
|
14
|
+
OAuth2ClientCredentialsFlow,
|
|
15
|
+
OAuth2Flows,
|
|
16
|
+
OAuth2Preset,
|
|
17
|
+
OAuth2SourceConfig,
|
|
10
18
|
OpenApiExtractionError,
|
|
11
19
|
OpenApiInvocationError,
|
|
20
|
+
OpenApiOAuthError,
|
|
12
21
|
OpenApiParseError,
|
|
22
|
+
OpenApiSourceBindingInput,
|
|
23
|
+
OpenApiSourceBindingRef,
|
|
24
|
+
OpenApiSourceBindingValue,
|
|
13
25
|
OperationBinding,
|
|
14
26
|
OperationId,
|
|
15
27
|
OperationParameter,
|
|
16
28
|
OperationRequestBody,
|
|
17
29
|
ParameterLocation,
|
|
30
|
+
PreviewOperation,
|
|
18
31
|
SecurityScheme,
|
|
19
32
|
ServerInfo,
|
|
33
|
+
ServerVariable,
|
|
20
34
|
SpecPreview,
|
|
35
|
+
annotationsForOperation,
|
|
21
36
|
extract,
|
|
37
|
+
fetchSpecText,
|
|
22
38
|
invoke,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
makeOpenApiInvoker,
|
|
39
|
+
invokeWithLayer,
|
|
40
|
+
makeDefaultOpenapiStore,
|
|
26
41
|
openApiPlugin,
|
|
42
|
+
openapiSchema,
|
|
27
43
|
parse,
|
|
28
44
|
preferredContent,
|
|
29
45
|
previewSpec,
|
|
30
|
-
resolveBaseUrl
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
import { addSourceToConfig, removeSourceFromConfig, SECRET_REF_PREFIX } from "@executor/config";
|
|
36
|
-
var translateSecretHeaders = (headers) => {
|
|
37
|
-
if (!headers) return void 0;
|
|
38
|
-
const result = {};
|
|
39
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
40
|
-
if (typeof value === "string") {
|
|
41
|
-
result[key] = value;
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
const ref = `${SECRET_REF_PREFIX}${value.secretId}`;
|
|
45
|
-
result[key] = value.prefix ? { value: ref, prefix: value.prefix } : ref;
|
|
46
|
-
}
|
|
47
|
-
return result;
|
|
48
|
-
};
|
|
49
|
-
var toSourceConfig = (source) => ({
|
|
50
|
-
kind: "openapi",
|
|
51
|
-
spec: source.config.spec,
|
|
52
|
-
baseUrl: source.config.baseUrl,
|
|
53
|
-
namespace: source.namespace,
|
|
54
|
-
headers: translateSecretHeaders(source.config.headers)
|
|
55
|
-
});
|
|
56
|
-
var withConfigFile = (inner, configPath, fsLayer) => ({
|
|
57
|
-
...inner,
|
|
58
|
-
putSource: (source) => Effect.gen(function* () {
|
|
59
|
-
yield* inner.putSource(source);
|
|
60
|
-
yield* addSourceToConfig(configPath, toSourceConfig(source)).pipe(
|
|
61
|
-
Effect.provide(fsLayer),
|
|
62
|
-
Effect.catchAll(() => Effect.void)
|
|
63
|
-
);
|
|
64
|
-
}),
|
|
65
|
-
removeSource: (namespace) => Effect.gen(function* () {
|
|
66
|
-
yield* inner.removeSource(namespace);
|
|
67
|
-
yield* removeSourceFromConfig(configPath, namespace).pipe(
|
|
68
|
-
Effect.provide(fsLayer),
|
|
69
|
-
Effect.catchAll(() => Effect.void)
|
|
70
|
-
);
|
|
71
|
-
})
|
|
72
|
-
});
|
|
46
|
+
resolveBaseUrl,
|
|
47
|
+
resolveHeaders,
|
|
48
|
+
resolveSpecText,
|
|
49
|
+
substituteUrlVariables
|
|
50
|
+
} from "./chunk-ZZ7TQ4JC.js";
|
|
73
51
|
export {
|
|
74
52
|
AuthStrategy,
|
|
75
53
|
DocResolver,
|
|
54
|
+
EncodingObject,
|
|
76
55
|
ExtractedOperation,
|
|
77
56
|
ExtractionResult,
|
|
78
57
|
HeaderPreset,
|
|
79
58
|
HttpMethod,
|
|
80
59
|
InvocationConfig,
|
|
81
60
|
InvocationResult,
|
|
61
|
+
MediaBinding,
|
|
62
|
+
OAuth2Auth,
|
|
63
|
+
OAuth2AuthorizationCodeFlow,
|
|
64
|
+
OAuth2ClientCredentialsFlow,
|
|
65
|
+
OAuth2Flows,
|
|
66
|
+
OAuth2Preset,
|
|
67
|
+
OAuth2SourceConfig,
|
|
82
68
|
OpenApiExtractionError,
|
|
83
69
|
OpenApiInvocationError,
|
|
70
|
+
OpenApiOAuthError,
|
|
84
71
|
OpenApiParseError,
|
|
72
|
+
OpenApiSourceBindingInput,
|
|
73
|
+
OpenApiSourceBindingRef,
|
|
74
|
+
OpenApiSourceBindingValue,
|
|
85
75
|
OperationBinding,
|
|
86
76
|
OperationId,
|
|
87
77
|
OperationParameter,
|
|
88
78
|
OperationRequestBody,
|
|
89
79
|
ParameterLocation,
|
|
80
|
+
PreviewOperation,
|
|
90
81
|
SecurityScheme,
|
|
91
82
|
ServerInfo,
|
|
83
|
+
ServerVariable,
|
|
92
84
|
SpecPreview,
|
|
85
|
+
annotationsForOperation,
|
|
93
86
|
extract,
|
|
87
|
+
fetchSpecText,
|
|
94
88
|
invoke,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
makeOpenApiInvoker,
|
|
89
|
+
invokeWithLayer,
|
|
90
|
+
makeDefaultOpenapiStore,
|
|
98
91
|
openApiPlugin,
|
|
92
|
+
openapiSchema,
|
|
99
93
|
parse,
|
|
100
94
|
preferredContent,
|
|
101
95
|
previewSpec,
|
|
102
96
|
resolveBaseUrl,
|
|
103
|
-
|
|
97
|
+
resolveHeaders,
|
|
98
|
+
resolveSpecText,
|
|
99
|
+
substituteUrlVariables
|
|
104
100
|
};
|
|
105
101
|
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openApiPlugin
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
|
|
5
|
-
// src/promise.ts
|
|
6
|
-
var openApiPlugin2 = (options) => openApiPlugin(options);
|
|
3
|
+
} from "./chunk-ZZ7TQ4JC.js";
|
|
7
4
|
export {
|
|
8
|
-
|
|
5
|
+
openApiPlugin
|
|
9
6
|
};
|
|
10
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import type { OAuth2Preset } from "../sdk/preview";
|
|
2
|
+
export declare const OPENAPI_OAUTH_POPUP_NAME = "openapi-oauth";
|
|
3
|
+
export declare const OPENAPI_OAUTH_CALLBACK_PATH = "/api/oauth/callback";
|
|
4
|
+
export declare const openApiOAuthConnectionId: (namespaceSlug: string, flow: OAuth2Preset["flow"]) => string;
|
|
5
|
+
/**
|
|
6
|
+
* OpenAPI 3.x requires OAuth2 tokenUrl/authorizationUrl to be absolute,
|
|
7
|
+
* but some specs ship relative paths like `/api/rest/v1/oauth/token`.
|
|
8
|
+
* Resolve them against the source's chosen baseUrl so the backend can
|
|
9
|
+
* fetch them directly and the absolute URL is what gets persisted on
|
|
10
|
+
* OAuth2Auth.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveOAuthUrl(url: string, baseUrl: string): string;
|
|
13
|
+
export declare function inferOAuthIssuerUrl(authorizationUrl: string): string | null;
|
|
1
14
|
export default function AddOpenApiSource(props: {
|
|
2
15
|
onComplete: () => void;
|
|
3
16
|
onCancel: () => void;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { ScopeId } from "@executor-js/sdk/core";
|
|
2
|
+
export declare const openApiSourceAtom: (scopeId: ScopeId, namespace: string) => import("effect/unstable/reactivity/Atom").Atom<import("effect/unstable/reactivity/AsyncResult").AsyncResult<import("../sdk/store").StoredSourceSchema | null, import("@executor-js/api").InternalError | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError>>;
|
|
3
|
+
export declare const openApiSourceBindingsAtom: (scopeId: ScopeId, namespace: string, sourceScopeId: ScopeId) => import("effect/unstable/reactivity/Atom").Atom<import("effect/unstable/reactivity/AsyncResult").AsyncResult<readonly import("../sdk").OpenApiSourceBindingRef[], import("@executor-js/api").InternalError | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError>>;
|
|
4
|
+
export declare const previewOpenApiSpec: import("effect/unstable/reactivity/Atom").AtomResultFn<{
|
|
5
|
+
readonly params: {
|
|
6
|
+
readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
7
|
+
};
|
|
8
|
+
readonly payload: {
|
|
9
|
+
readonly spec: string;
|
|
10
|
+
readonly specFetchCredentials?: {
|
|
11
|
+
readonly headers?: {
|
|
12
|
+
readonly [x: string]: string | {
|
|
13
|
+
readonly secretId: string;
|
|
14
|
+
readonly prefix?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
} | undefined;
|
|
17
|
+
readonly queryParams?: {
|
|
18
|
+
readonly [x: string]: string | {
|
|
19
|
+
readonly secretId: string;
|
|
20
|
+
readonly prefix?: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
} | undefined;
|
|
23
|
+
} | undefined;
|
|
24
|
+
};
|
|
25
|
+
readonly responseMode?: "decoded-only" | undefined;
|
|
26
|
+
readonly reactivityKeys?: readonly unknown[] | import("effect/Record").ReadonlyRecord<string, readonly unknown[]> | undefined;
|
|
27
|
+
}, import("../sdk").SpecPreview, import("@executor-js/api").InternalError | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError>;
|
|
28
|
+
export declare const addOpenApiSpec: import("effect/unstable/reactivity/Atom").AtomResultFn<{
|
|
29
|
+
readonly params: {
|
|
30
|
+
readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
31
|
+
};
|
|
32
|
+
readonly payload: {
|
|
33
|
+
readonly spec: string;
|
|
34
|
+
readonly name?: string | undefined;
|
|
35
|
+
readonly namespace?: string | undefined;
|
|
36
|
+
readonly oauth2?: import("../sdk").OAuth2Auth | import("../sdk").OAuth2SourceConfig | undefined;
|
|
37
|
+
readonly headers?: {
|
|
38
|
+
readonly [x: string]: unknown;
|
|
39
|
+
} | undefined;
|
|
40
|
+
readonly queryParams?: {
|
|
41
|
+
readonly [x: string]: string | {
|
|
42
|
+
readonly secretId: string;
|
|
43
|
+
readonly prefix?: string | undefined;
|
|
44
|
+
};
|
|
45
|
+
} | undefined;
|
|
46
|
+
readonly baseUrl?: string | undefined;
|
|
47
|
+
readonly specFetchCredentials?: {
|
|
48
|
+
readonly headers?: {
|
|
49
|
+
readonly [x: string]: string | {
|
|
50
|
+
readonly secretId: string;
|
|
51
|
+
readonly prefix?: string | undefined;
|
|
52
|
+
};
|
|
53
|
+
} | undefined;
|
|
54
|
+
readonly queryParams?: {
|
|
55
|
+
readonly [x: string]: string | {
|
|
56
|
+
readonly secretId: string;
|
|
57
|
+
readonly prefix?: string | undefined;
|
|
58
|
+
};
|
|
59
|
+
} | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
};
|
|
62
|
+
readonly responseMode?: "decoded-only" | undefined;
|
|
63
|
+
readonly reactivityKeys?: readonly unknown[] | import("effect/Record").ReadonlyRecord<string, readonly unknown[]> | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
readonly namespace: string;
|
|
66
|
+
readonly toolCount: number;
|
|
67
|
+
}, import("@executor-js/api").InternalError | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError>;
|
|
68
|
+
export declare const updateOpenApiSource: import("effect/unstable/reactivity/Atom").AtomResultFn<{
|
|
69
|
+
readonly params: {
|
|
70
|
+
readonly namespace: string;
|
|
71
|
+
readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
72
|
+
};
|
|
73
|
+
readonly payload: {
|
|
74
|
+
readonly name?: string | undefined;
|
|
75
|
+
readonly oauth2?: import("../sdk").OAuth2Auth | import("../sdk").OAuth2SourceConfig | undefined;
|
|
76
|
+
readonly headers?: {
|
|
77
|
+
readonly [x: string]: unknown;
|
|
78
|
+
} | undefined;
|
|
79
|
+
readonly queryParams?: {
|
|
80
|
+
readonly [x: string]: string | {
|
|
81
|
+
readonly secretId: string;
|
|
82
|
+
readonly prefix?: string | undefined;
|
|
83
|
+
};
|
|
84
|
+
} | undefined;
|
|
85
|
+
readonly baseUrl?: string | undefined;
|
|
86
|
+
};
|
|
87
|
+
readonly responseMode?: "decoded-only" | undefined;
|
|
88
|
+
readonly reactivityKeys?: readonly unknown[] | import("effect/Record").ReadonlyRecord<string, readonly unknown[]> | undefined;
|
|
89
|
+
}, {
|
|
90
|
+
readonly updated: boolean;
|
|
91
|
+
}, import("@executor-js/api").InternalError | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError>;
|
|
92
|
+
export declare const setOpenApiSourceBinding: import("effect/unstable/reactivity/Atom").AtomResultFn<{
|
|
93
|
+
readonly params: {
|
|
94
|
+
readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
95
|
+
};
|
|
96
|
+
readonly payload: {
|
|
97
|
+
readonly value: {
|
|
98
|
+
readonly secretId: string & import("effect/Brand").Brand<"SecretId">;
|
|
99
|
+
readonly kind: "secret";
|
|
100
|
+
} | {
|
|
101
|
+
readonly connectionId: string & import("effect/Brand").Brand<"ConnectionId">;
|
|
102
|
+
readonly kind: "connection";
|
|
103
|
+
} | {
|
|
104
|
+
readonly kind: "text";
|
|
105
|
+
readonly text: string;
|
|
106
|
+
};
|
|
107
|
+
readonly sourceId: string;
|
|
108
|
+
readonly scope: string & import("effect/Brand").Brand<"ScopeId">;
|
|
109
|
+
readonly slot: string;
|
|
110
|
+
readonly sourceScope: string & import("effect/Brand").Brand<"ScopeId">;
|
|
111
|
+
};
|
|
112
|
+
readonly responseMode?: "decoded-only" | undefined;
|
|
113
|
+
readonly reactivityKeys?: readonly unknown[] | import("effect/Record").ReadonlyRecord<string, readonly unknown[]> | undefined;
|
|
114
|
+
}, import("../sdk").OpenApiSourceBindingRef, import("@executor-js/api").InternalError | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError>;
|
|
115
|
+
export declare const removeOpenApiSourceBinding: import("effect/unstable/reactivity/Atom").AtomResultFn<{
|
|
116
|
+
readonly params: {
|
|
117
|
+
readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
|
|
118
|
+
};
|
|
119
|
+
readonly payload: {
|
|
120
|
+
readonly sourceId: string;
|
|
121
|
+
readonly scope: string & import("effect/Brand").Brand<"ScopeId">;
|
|
122
|
+
readonly slot: string;
|
|
123
|
+
readonly sourceScope: string & import("effect/Brand").Brand<"ScopeId">;
|
|
124
|
+
};
|
|
125
|
+
readonly responseMode?: "decoded-only" | undefined;
|
|
126
|
+
readonly reactivityKeys?: readonly unknown[] | import("effect/Record").ReadonlyRecord<string, readonly unknown[]> | undefined;
|
|
127
|
+
}, {
|
|
128
|
+
readonly removed: boolean;
|
|
129
|
+
}, import("@executor-js/api").InternalError | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError>;
|