@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
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { type StorageDeps, type StorageFailure } from "@executor-js/sdk/core";
|
|
3
|
+
import { ConfiguredHeaderValue, ConfiguredHeaderBinding, HeaderValue, OAuth2Auth, OAuth2SourceConfig, OpenApiSourceBindingInput, OpenApiSourceBindingRef, OperationBinding } from "./types";
|
|
4
|
+
export declare const openapiSchema: {
|
|
5
|
+
readonly openapi_source: {
|
|
6
|
+
readonly fields: {
|
|
7
|
+
readonly id: {
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
readonly required: true;
|
|
10
|
+
};
|
|
11
|
+
readonly scope_id: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly required: true;
|
|
14
|
+
readonly index: true;
|
|
15
|
+
};
|
|
16
|
+
readonly name: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
readonly required: true;
|
|
19
|
+
};
|
|
20
|
+
readonly spec: {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly required: true;
|
|
23
|
+
};
|
|
24
|
+
readonly source_url: {
|
|
25
|
+
readonly type: "string";
|
|
26
|
+
readonly required: false;
|
|
27
|
+
};
|
|
28
|
+
readonly base_url: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly required: false;
|
|
31
|
+
};
|
|
32
|
+
readonly headers: {
|
|
33
|
+
readonly type: "json";
|
|
34
|
+
readonly required: false;
|
|
35
|
+
};
|
|
36
|
+
readonly query_params: {
|
|
37
|
+
readonly type: "json";
|
|
38
|
+
readonly required: false;
|
|
39
|
+
};
|
|
40
|
+
readonly oauth2: {
|
|
41
|
+
readonly type: "json";
|
|
42
|
+
readonly required: false;
|
|
43
|
+
};
|
|
44
|
+
readonly invocation_config: {
|
|
45
|
+
readonly type: "json";
|
|
46
|
+
readonly required: true;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
readonly openapi_operation: {
|
|
51
|
+
readonly fields: {
|
|
52
|
+
readonly id: {
|
|
53
|
+
readonly type: "string";
|
|
54
|
+
readonly required: true;
|
|
55
|
+
};
|
|
56
|
+
readonly scope_id: {
|
|
57
|
+
readonly type: "string";
|
|
58
|
+
readonly required: true;
|
|
59
|
+
readonly index: true;
|
|
60
|
+
};
|
|
61
|
+
readonly source_id: {
|
|
62
|
+
readonly type: "string";
|
|
63
|
+
readonly required: true;
|
|
64
|
+
readonly index: true;
|
|
65
|
+
};
|
|
66
|
+
readonly binding: {
|
|
67
|
+
readonly type: "json";
|
|
68
|
+
readonly required: true;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
readonly openapi_source_binding: {
|
|
73
|
+
readonly fields: {
|
|
74
|
+
readonly id: {
|
|
75
|
+
readonly type: "string";
|
|
76
|
+
readonly required: true;
|
|
77
|
+
};
|
|
78
|
+
readonly source_id: {
|
|
79
|
+
readonly type: "string";
|
|
80
|
+
readonly required: true;
|
|
81
|
+
readonly index: true;
|
|
82
|
+
};
|
|
83
|
+
readonly source_scope_id: {
|
|
84
|
+
readonly type: "string";
|
|
85
|
+
readonly required: true;
|
|
86
|
+
readonly index: true;
|
|
87
|
+
};
|
|
88
|
+
readonly target_scope_id: {
|
|
89
|
+
readonly type: "string";
|
|
90
|
+
readonly required: true;
|
|
91
|
+
readonly index: true;
|
|
92
|
+
};
|
|
93
|
+
readonly slot: {
|
|
94
|
+
readonly type: "string";
|
|
95
|
+
readonly required: true;
|
|
96
|
+
readonly index: true;
|
|
97
|
+
};
|
|
98
|
+
readonly value: {
|
|
99
|
+
readonly type: "json";
|
|
100
|
+
readonly required: true;
|
|
101
|
+
};
|
|
102
|
+
readonly created_at: {
|
|
103
|
+
readonly type: "date";
|
|
104
|
+
readonly required: true;
|
|
105
|
+
};
|
|
106
|
+
readonly updated_at: {
|
|
107
|
+
readonly type: "date";
|
|
108
|
+
readonly required: true;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
export type OpenapiSchema = typeof openapiSchema;
|
|
114
|
+
export interface SourceConfig {
|
|
115
|
+
readonly spec: string;
|
|
116
|
+
/** Origin URL when the spec was fetched from http(s). Absent for
|
|
117
|
+
* raw-text adds. Persisted so `refreshSource` can re-fetch. */
|
|
118
|
+
readonly sourceUrl?: string;
|
|
119
|
+
readonly baseUrl?: string;
|
|
120
|
+
readonly namespace?: string;
|
|
121
|
+
readonly headers?: Record<string, ConfiguredHeaderValue>;
|
|
122
|
+
readonly queryParams?: Record<string, HeaderValue>;
|
|
123
|
+
readonly specFetchCredentials?: OpenApiSpecFetchCredentials;
|
|
124
|
+
readonly oauth2?: OAuth2SourceConfig;
|
|
125
|
+
}
|
|
126
|
+
export interface OpenApiSpecFetchCredentials {
|
|
127
|
+
readonly headers?: Record<string, HeaderValue>;
|
|
128
|
+
readonly queryParams?: Record<string, HeaderValue>;
|
|
129
|
+
}
|
|
130
|
+
export interface StoredSource {
|
|
131
|
+
readonly namespace: string;
|
|
132
|
+
/** Executor scope id this source row lives in. Writes stamp this on
|
|
133
|
+
* `scope_id`; reads return whichever scope's row the adapter's
|
|
134
|
+
* fall-through filter sees first. */
|
|
135
|
+
readonly scope: string;
|
|
136
|
+
readonly name: string;
|
|
137
|
+
readonly config: SourceConfig;
|
|
138
|
+
readonly legacy?: {
|
|
139
|
+
readonly headers?: Record<string, HeaderValue>;
|
|
140
|
+
readonly oauth2?: OAuth2Auth;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
declare const StoredSourceSchema_base: Schema.Class<StoredSourceSchema, Schema.Struct<{
|
|
144
|
+
readonly namespace: Schema.String;
|
|
145
|
+
readonly name: Schema.String;
|
|
146
|
+
readonly config: Schema.Struct<{
|
|
147
|
+
readonly spec: Schema.String;
|
|
148
|
+
readonly sourceUrl: Schema.optional<Schema.String>;
|
|
149
|
+
readonly baseUrl: Schema.optional<Schema.String>;
|
|
150
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
151
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, typeof ConfiguredHeaderBinding]>>>;
|
|
152
|
+
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
153
|
+
readonly secretId: Schema.String;
|
|
154
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
155
|
+
}>]>>>;
|
|
156
|
+
readonly specFetchCredentials: Schema.optional<Schema.Struct<{
|
|
157
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
158
|
+
readonly secretId: Schema.String;
|
|
159
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
160
|
+
}>]>>>;
|
|
161
|
+
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
162
|
+
readonly secretId: Schema.String;
|
|
163
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
164
|
+
}>]>>>;
|
|
165
|
+
}>>;
|
|
166
|
+
readonly oauth2: Schema.optional<typeof OAuth2SourceConfig>;
|
|
167
|
+
}>;
|
|
168
|
+
}>, {}>;
|
|
169
|
+
export declare class StoredSourceSchema extends StoredSourceSchema_base {
|
|
170
|
+
}
|
|
171
|
+
export type StoredSourceSchemaType = typeof StoredSourceSchema.Type;
|
|
172
|
+
export interface StoredOperation {
|
|
173
|
+
readonly toolId: string;
|
|
174
|
+
readonly sourceId: string;
|
|
175
|
+
readonly binding: OperationBinding;
|
|
176
|
+
}
|
|
177
|
+
export declare const headerBindingSlot: (headerName: string) => string;
|
|
178
|
+
export declare const oauth2ClientIdSlot: (securitySchemeName: string) => string;
|
|
179
|
+
export declare const oauth2ClientSecretSlot: (securitySchemeName: string) => string;
|
|
180
|
+
export declare const oauth2ConnectionSlot: (securitySchemeName: string) => string;
|
|
181
|
+
export interface OpenapiStore {
|
|
182
|
+
readonly upsertSource: (input: StoredSource, operations: readonly StoredOperation[]) => Effect.Effect<void, StorageFailure>;
|
|
183
|
+
readonly updateSourceMeta: (namespace: string, scope: string, patch: {
|
|
184
|
+
readonly name?: string;
|
|
185
|
+
readonly baseUrl?: string;
|
|
186
|
+
readonly headers?: Record<string, ConfiguredHeaderValue>;
|
|
187
|
+
readonly queryParams?: Record<string, HeaderValue>;
|
|
188
|
+
readonly oauth2?: OAuth2SourceConfig;
|
|
189
|
+
}) => Effect.Effect<void, StorageFailure>;
|
|
190
|
+
readonly getSource: (namespace: string, scope: string) => Effect.Effect<StoredSource | null, StorageFailure>;
|
|
191
|
+
readonly listSources: () => Effect.Effect<readonly StoredSource[], StorageFailure>;
|
|
192
|
+
readonly getOperationByToolId: (toolId: string, scope: string) => Effect.Effect<StoredOperation | null, StorageFailure>;
|
|
193
|
+
readonly listOperationsBySource: (sourceId: string, scope: string) => Effect.Effect<readonly StoredOperation[], StorageFailure>;
|
|
194
|
+
readonly removeSource: (namespace: string, scope: string) => Effect.Effect<void, StorageFailure>;
|
|
195
|
+
readonly listSourceBindings: (sourceId: string, sourceScope: string) => Effect.Effect<readonly OpenApiSourceBindingRef[], StorageFailure>;
|
|
196
|
+
readonly resolveSourceBinding: (sourceId: string, sourceScope: string, slot: string) => Effect.Effect<OpenApiSourceBindingRef | null, StorageFailure>;
|
|
197
|
+
readonly setSourceBinding: (input: OpenApiSourceBindingInput) => Effect.Effect<OpenApiSourceBindingRef, StorageFailure>;
|
|
198
|
+
readonly removeSourceBinding: (sourceId: string, sourceScope: string, slot: string, scope: string) => Effect.Effect<void, StorageFailure>;
|
|
199
|
+
}
|
|
200
|
+
export declare const makeDefaultOpenapiStore: ({ adapter, scopes, }: StorageDeps<OpenapiSchema>) => OpenapiStore;
|
|
201
|
+
export {};
|