@executor-js/plugin-openapi 1.4.29 → 1.4.30
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-FLMNI742.js → AddOpenApiSource-KSOMPQ2R.js} +4 -4
- package/dist/{EditOpenApiSource-I4NIGIIJ.js → EditOpenApiSource-AOA7APR2.js} +301 -192
- package/dist/EditOpenApiSource-AOA7APR2.js.map +1 -0
- package/dist/{OpenApiSourceSummary-CM46DB4L.js → OpenApiSourceSummary-Y3S6ZBOZ.js} +4 -4
- package/dist/OpenApiSourceSummary-Y3S6ZBOZ.js.map +1 -0
- package/dist/api/group.d.ts +124 -118
- package/dist/api/index.d.ts +148 -369
- package/dist/chunk-BB5IAKRG.js +136 -0
- package/dist/chunk-BB5IAKRG.js.map +1 -0
- package/dist/{chunk-E7PZ2QGD.js → chunk-EOXXE5DG.js} +17 -455
- package/dist/chunk-EOXXE5DG.js.map +1 -0
- package/dist/{chunk-OZ67JNID.js → chunk-NIKLYJ3X.js} +830 -319
- package/dist/chunk-NIKLYJ3X.js.map +1 -0
- package/dist/{chunk-TGDT6QCH.js → chunk-YJMXYKYX.js} +178 -117
- package/dist/chunk-YJMXYKYX.js.map +1 -0
- package/dist/{chunk-GFQUEZUW.js → chunk-ZZBTLFTA.js} +78 -93
- package/dist/chunk-ZZBTLFTA.js.map +1 -0
- package/dist/client.js +7 -137
- package/dist/client.js.map +1 -1
- package/dist/core.js +5 -10
- package/dist/index.js +3 -2
- package/dist/react/atoms.d.ts +83 -223
- package/dist/react/client.d.ts +123 -117
- package/dist/sdk/credential-status.d.ts +3 -3
- package/dist/sdk/extract.d.ts +19 -19
- package/dist/sdk/index.d.ts +2 -2
- package/dist/sdk/invoke.d.ts +7 -7
- package/dist/sdk/parse.d.ts +2 -3
- package/dist/sdk/plugin.d.ts +181 -275
- package/dist/sdk/preview.d.ts +12 -12
- package/dist/sdk/source-contracts.d.ts +55 -0
- package/dist/sdk/store.d.ts +6 -269
- package/dist/sdk/types.d.ts +16 -65
- package/dist/testing/index.d.ts +149 -11
- package/dist/testing.js +419 -33
- package/dist/testing.js.map +1 -1
- package/dist/testing.test.d.ts +1 -0
- package/package.json +3 -4
- package/dist/EditOpenApiSource-I4NIGIIJ.js.map +0 -1
- package/dist/OpenApiSourceSummary-CM46DB4L.js.map +0 -1
- package/dist/chunk-E7PZ2QGD.js.map +0 -1
- package/dist/chunk-GFQUEZUW.js.map +0 -1
- package/dist/chunk-OZ67JNID.js.map +0 -1
- package/dist/chunk-TGDT6QCH.js.map +0 -1
- /package/dist/{AddOpenApiSource-FLMNI742.js.map → AddOpenApiSource-KSOMPQ2R.js.map} +0 -0
package/dist/sdk/store.d.ts
CHANGED
|
@@ -1,220 +1,11 @@
|
|
|
1
|
-
import { Effect
|
|
1
|
+
import { Effect } from "effect";
|
|
2
2
|
import { type StorageDeps, type StorageFailure } from "@executor-js/sdk/core";
|
|
3
|
-
import {
|
|
4
|
-
export
|
|
5
|
-
|
|
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 oauth2: {
|
|
33
|
-
readonly type: "json";
|
|
34
|
-
readonly required: false;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
readonly openapi_operation: {
|
|
39
|
-
readonly fields: {
|
|
40
|
-
readonly id: {
|
|
41
|
-
readonly type: "string";
|
|
42
|
-
readonly required: true;
|
|
43
|
-
};
|
|
44
|
-
readonly scope_id: {
|
|
45
|
-
readonly type: "string";
|
|
46
|
-
readonly required: true;
|
|
47
|
-
readonly index: true;
|
|
48
|
-
};
|
|
49
|
-
readonly source_id: {
|
|
50
|
-
readonly type: "string";
|
|
51
|
-
readonly required: true;
|
|
52
|
-
readonly index: true;
|
|
53
|
-
};
|
|
54
|
-
readonly binding: {
|
|
55
|
-
readonly type: "json";
|
|
56
|
-
readonly required: true;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
readonly openapi_source_header: {
|
|
61
|
-
readonly fields: {
|
|
62
|
-
readonly id: {
|
|
63
|
-
readonly type: "string";
|
|
64
|
-
readonly required: true;
|
|
65
|
-
};
|
|
66
|
-
readonly scope_id: {
|
|
67
|
-
readonly type: "string";
|
|
68
|
-
readonly required: true;
|
|
69
|
-
readonly index: true;
|
|
70
|
-
};
|
|
71
|
-
readonly source_id: {
|
|
72
|
-
readonly type: "string";
|
|
73
|
-
readonly required: true;
|
|
74
|
-
readonly index: true;
|
|
75
|
-
};
|
|
76
|
-
readonly name: {
|
|
77
|
-
readonly type: "string";
|
|
78
|
-
readonly required: true;
|
|
79
|
-
};
|
|
80
|
-
readonly kind: {
|
|
81
|
-
readonly type: ["text", "binding"];
|
|
82
|
-
readonly required: true;
|
|
83
|
-
};
|
|
84
|
-
readonly text_value: {
|
|
85
|
-
readonly type: "string";
|
|
86
|
-
readonly required: false;
|
|
87
|
-
};
|
|
88
|
-
readonly slot_key: {
|
|
89
|
-
readonly type: "string";
|
|
90
|
-
readonly required: false;
|
|
91
|
-
};
|
|
92
|
-
readonly prefix: {
|
|
93
|
-
readonly type: "string";
|
|
94
|
-
readonly required: false;
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
readonly openapi_source_query_param: {
|
|
99
|
-
readonly fields: {
|
|
100
|
-
readonly id: {
|
|
101
|
-
readonly type: "string";
|
|
102
|
-
readonly required: true;
|
|
103
|
-
};
|
|
104
|
-
readonly scope_id: {
|
|
105
|
-
readonly type: "string";
|
|
106
|
-
readonly required: true;
|
|
107
|
-
readonly index: true;
|
|
108
|
-
};
|
|
109
|
-
readonly source_id: {
|
|
110
|
-
readonly type: "string";
|
|
111
|
-
readonly required: true;
|
|
112
|
-
readonly index: true;
|
|
113
|
-
};
|
|
114
|
-
readonly name: {
|
|
115
|
-
readonly type: "string";
|
|
116
|
-
readonly required: true;
|
|
117
|
-
};
|
|
118
|
-
readonly kind: {
|
|
119
|
-
readonly type: ["text", "binding"];
|
|
120
|
-
readonly required: true;
|
|
121
|
-
};
|
|
122
|
-
readonly text_value: {
|
|
123
|
-
readonly type: "string";
|
|
124
|
-
readonly required: false;
|
|
125
|
-
};
|
|
126
|
-
readonly slot_key: {
|
|
127
|
-
readonly type: "string";
|
|
128
|
-
readonly required: false;
|
|
129
|
-
};
|
|
130
|
-
readonly prefix: {
|
|
131
|
-
readonly type: "string";
|
|
132
|
-
readonly required: false;
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
readonly openapi_source_spec_fetch_header: {
|
|
137
|
-
readonly fields: {
|
|
138
|
-
readonly id: {
|
|
139
|
-
readonly type: "string";
|
|
140
|
-
readonly required: true;
|
|
141
|
-
};
|
|
142
|
-
readonly scope_id: {
|
|
143
|
-
readonly type: "string";
|
|
144
|
-
readonly required: true;
|
|
145
|
-
readonly index: true;
|
|
146
|
-
};
|
|
147
|
-
readonly source_id: {
|
|
148
|
-
readonly type: "string";
|
|
149
|
-
readonly required: true;
|
|
150
|
-
readonly index: true;
|
|
151
|
-
};
|
|
152
|
-
readonly name: {
|
|
153
|
-
readonly type: "string";
|
|
154
|
-
readonly required: true;
|
|
155
|
-
};
|
|
156
|
-
readonly kind: {
|
|
157
|
-
readonly type: ["text", "binding"];
|
|
158
|
-
readonly required: true;
|
|
159
|
-
};
|
|
160
|
-
readonly text_value: {
|
|
161
|
-
readonly type: "string";
|
|
162
|
-
readonly required: false;
|
|
163
|
-
};
|
|
164
|
-
readonly slot_key: {
|
|
165
|
-
readonly type: "string";
|
|
166
|
-
readonly required: false;
|
|
167
|
-
};
|
|
168
|
-
readonly prefix: {
|
|
169
|
-
readonly type: "string";
|
|
170
|
-
readonly required: false;
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
readonly openapi_source_spec_fetch_query_param: {
|
|
175
|
-
readonly fields: {
|
|
176
|
-
readonly id: {
|
|
177
|
-
readonly type: "string";
|
|
178
|
-
readonly required: true;
|
|
179
|
-
};
|
|
180
|
-
readonly scope_id: {
|
|
181
|
-
readonly type: "string";
|
|
182
|
-
readonly required: true;
|
|
183
|
-
readonly index: true;
|
|
184
|
-
};
|
|
185
|
-
readonly source_id: {
|
|
186
|
-
readonly type: "string";
|
|
187
|
-
readonly required: true;
|
|
188
|
-
readonly index: true;
|
|
189
|
-
};
|
|
190
|
-
readonly name: {
|
|
191
|
-
readonly type: "string";
|
|
192
|
-
readonly required: true;
|
|
193
|
-
};
|
|
194
|
-
readonly kind: {
|
|
195
|
-
readonly type: ["text", "binding"];
|
|
196
|
-
readonly required: true;
|
|
197
|
-
};
|
|
198
|
-
readonly text_value: {
|
|
199
|
-
readonly type: "string";
|
|
200
|
-
readonly required: false;
|
|
201
|
-
};
|
|
202
|
-
readonly slot_key: {
|
|
203
|
-
readonly type: "string";
|
|
204
|
-
readonly required: false;
|
|
205
|
-
};
|
|
206
|
-
readonly prefix: {
|
|
207
|
-
readonly type: "string";
|
|
208
|
-
readonly required: false;
|
|
209
|
-
};
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
};
|
|
3
|
+
import { OAuth2SourceConfig, OperationBinding, type ConfiguredHeaderValue } from "./types";
|
|
4
|
+
export { StoredSourceSchema, type StoredSourceSchemaType, headerBindingSlot, oauth2ClientIdSlot, oauth2ClientSecretSlot, oauth2ConnectionSlot, queryParamBindingSlot, } from "./source-contracts";
|
|
5
|
+
export declare const openapiSchema: {};
|
|
213
6
|
export type OpenapiSchema = typeof openapiSchema;
|
|
214
7
|
export interface SourceConfig {
|
|
215
8
|
readonly spec: string;
|
|
216
|
-
/** Origin URL when the spec was fetched from http(s). Absent for
|
|
217
|
-
* raw-text adds. Persisted so `refreshSource` can re-fetch. */
|
|
218
9
|
readonly sourceUrl?: string;
|
|
219
10
|
readonly baseUrl?: string;
|
|
220
11
|
readonly namespace?: string;
|
|
@@ -229,70 +20,15 @@ export interface OpenApiSpecFetchCredentials {
|
|
|
229
20
|
}
|
|
230
21
|
export interface StoredSource {
|
|
231
22
|
readonly namespace: string;
|
|
232
|
-
/** Executor scope id this source row lives in. Writes stamp this on
|
|
233
|
-
* `scope_id`; reads return whichever scope's row the adapter's
|
|
234
|
-
* fall-through filter sees first. */
|
|
235
23
|
readonly scope: string;
|
|
236
24
|
readonly name: string;
|
|
237
25
|
readonly config: SourceConfig;
|
|
238
26
|
}
|
|
239
|
-
export declare const StoredSourceSchema: Schema.Struct<{
|
|
240
|
-
readonly namespace: Schema.String;
|
|
241
|
-
readonly scope: Schema.String;
|
|
242
|
-
readonly name: Schema.String;
|
|
243
|
-
readonly config: Schema.Struct<{
|
|
244
|
-
readonly spec: Schema.String;
|
|
245
|
-
readonly sourceUrl: Schema.optional<Schema.String>;
|
|
246
|
-
readonly baseUrl: Schema.optional<Schema.String>;
|
|
247
|
-
readonly namespace: Schema.optional<Schema.String>;
|
|
248
|
-
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
249
|
-
readonly kind: Schema.Literal<"binding">;
|
|
250
|
-
readonly slot: Schema.String;
|
|
251
|
-
readonly prefix: Schema.optional<Schema.String>;
|
|
252
|
-
}>]>>>;
|
|
253
|
-
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
254
|
-
readonly kind: Schema.Literal<"binding">;
|
|
255
|
-
readonly slot: Schema.String;
|
|
256
|
-
readonly prefix: Schema.optional<Schema.String>;
|
|
257
|
-
}>]>>>;
|
|
258
|
-
readonly specFetchCredentials: Schema.optional<Schema.Struct<{
|
|
259
|
-
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
260
|
-
readonly kind: Schema.Literal<"binding">;
|
|
261
|
-
readonly slot: Schema.String;
|
|
262
|
-
readonly prefix: Schema.optional<Schema.String>;
|
|
263
|
-
}>]>>>;
|
|
264
|
-
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
265
|
-
readonly kind: Schema.Literal<"binding">;
|
|
266
|
-
readonly slot: Schema.String;
|
|
267
|
-
readonly prefix: Schema.optional<Schema.String>;
|
|
268
|
-
}>]>>>;
|
|
269
|
-
}>>;
|
|
270
|
-
readonly oauth2: Schema.optional<Schema.Struct<{
|
|
271
|
-
readonly kind: Schema.Literal<"oauth2">;
|
|
272
|
-
readonly securitySchemeName: Schema.String;
|
|
273
|
-
readonly flow: Schema.Literals<readonly ["authorizationCode", "clientCredentials"]>;
|
|
274
|
-
readonly tokenUrl: Schema.String;
|
|
275
|
-
readonly authorizationUrl: Schema.NullOr<Schema.String>;
|
|
276
|
-
readonly issuerUrl: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
277
|
-
readonly clientIdSlot: Schema.String;
|
|
278
|
-
readonly clientSecretSlot: Schema.NullOr<Schema.String>;
|
|
279
|
-
readonly connectionSlot: Schema.String;
|
|
280
|
-
readonly scopes: Schema.$Array<Schema.String>;
|
|
281
|
-
}>>;
|
|
282
|
-
}>;
|
|
283
|
-
}>;
|
|
284
|
-
export type StoredSourceSchema = typeof StoredSourceSchema.Type;
|
|
285
|
-
export type StoredSourceSchemaType = typeof StoredSourceSchema.Type;
|
|
286
27
|
export interface StoredOperation {
|
|
287
28
|
readonly toolId: string;
|
|
288
29
|
readonly sourceId: string;
|
|
289
30
|
readonly binding: OperationBinding;
|
|
290
31
|
}
|
|
291
|
-
export declare const headerBindingSlot: (headerName: string) => string;
|
|
292
|
-
export declare const queryParamBindingSlot: (name: string) => string;
|
|
293
|
-
export declare const oauth2ClientIdSlot: (securitySchemeName: string) => string;
|
|
294
|
-
export declare const oauth2ClientSecretSlot: (securitySchemeName: string) => string;
|
|
295
|
-
export declare const oauth2ConnectionSlot: (securitySchemeName: string) => string;
|
|
296
32
|
export interface OpenapiStore {
|
|
297
33
|
readonly upsertSource: (input: StoredSource, operations: readonly StoredOperation[]) => Effect.Effect<void, StorageFailure>;
|
|
298
34
|
readonly updateSourceMeta: (namespace: string, scope: string, patch: {
|
|
@@ -300,6 +36,7 @@ export interface OpenapiStore {
|
|
|
300
36
|
readonly baseUrl?: string;
|
|
301
37
|
readonly headers?: Record<string, ConfiguredHeaderValue>;
|
|
302
38
|
readonly queryParams?: Record<string, ConfiguredHeaderValue>;
|
|
39
|
+
readonly specFetchCredentials?: OpenApiSpecFetchCredentials;
|
|
303
40
|
readonly oauth2?: OAuth2SourceConfig;
|
|
304
41
|
}) => Effect.Effect<void, StorageFailure>;
|
|
305
42
|
readonly getSource: (namespace: string, scope: string) => Effect.Effect<StoredSource | null, StorageFailure>;
|
|
@@ -308,4 +45,4 @@ export interface OpenapiStore {
|
|
|
308
45
|
readonly listOperationsBySource: (sourceId: string, scope: string) => Effect.Effect<readonly StoredOperation[], StorageFailure>;
|
|
309
46
|
readonly removeSource: (namespace: string, scope: string) => Effect.Effect<void, StorageFailure>;
|
|
310
47
|
}
|
|
311
|
-
export declare const makeDefaultOpenapiStore: ({
|
|
48
|
+
export declare const makeDefaultOpenapiStore: ({ pluginStorage, }: StorageDeps<OpenapiSchema>) => OpenapiStore;
|
package/dist/sdk/types.d.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
+
import { type OAuth2FlowType, type OAuth2SourceConfigType } from "@executor-js/sdk/http-source";
|
|
3
|
+
export declare const OAuth2Flow: Schema.Literals<readonly ["authorizationCode", "clientCredentials"]>;
|
|
4
|
+
export type OAuth2Flow = OAuth2FlowType;
|
|
5
|
+
export declare const OAuth2SourceConfig: Schema.Struct<{
|
|
6
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
7
|
+
readonly securitySchemeName: Schema.String;
|
|
8
|
+
readonly flow: Schema.Literals<readonly ["authorizationCode", "clientCredentials"]>;
|
|
9
|
+
readonly tokenUrl: Schema.String;
|
|
10
|
+
readonly authorizationUrl: Schema.withDecodingDefault<Schema.optional<Schema.NullOr<Schema.String>>>;
|
|
11
|
+
readonly issuerUrl: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
12
|
+
readonly clientIdSlot: Schema.String;
|
|
13
|
+
readonly clientSecretSlot: Schema.NullOr<Schema.String>;
|
|
14
|
+
readonly connectionSlot: Schema.String;
|
|
15
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
16
|
+
}>;
|
|
17
|
+
export type OAuth2SourceConfig = OAuth2SourceConfigType;
|
|
2
18
|
export declare const OperationId: Schema.brand<Schema.String, "OperationId">;
|
|
3
19
|
export type OperationId = typeof OperationId.Type;
|
|
4
20
|
export declare const HttpMethod: Schema.Literals<readonly ["get", "put", "post", "delete", "patch", "head", "options", "trace"]>;
|
|
@@ -255,71 +271,6 @@ export declare const OpenApiCredentialInput: Schema.Union<readonly [Schema.Struc
|
|
|
255
271
|
readonly prefix: Schema.optional<Schema.String>;
|
|
256
272
|
}>]>]>;
|
|
257
273
|
export type OpenApiCredentialInput = typeof OpenApiCredentialInput.Type;
|
|
258
|
-
export declare const OpenApiSourceBindingValue: Schema.Union<readonly [Schema.Struct<{
|
|
259
|
-
readonly kind: Schema.Literal<"secret">;
|
|
260
|
-
readonly secretId: Schema.brand<Schema.String, "SecretId">;
|
|
261
|
-
readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
262
|
-
}>, Schema.Struct<{
|
|
263
|
-
readonly kind: Schema.Literal<"connection">;
|
|
264
|
-
readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
|
|
265
|
-
}>, Schema.Struct<{
|
|
266
|
-
readonly kind: Schema.Literal<"text">;
|
|
267
|
-
readonly text: Schema.String;
|
|
268
|
-
}>]>;
|
|
269
|
-
export type OpenApiSourceBindingValue = typeof OpenApiSourceBindingValue.Type;
|
|
270
|
-
export declare const OpenApiSourceBindingInput: Schema.Struct<{
|
|
271
|
-
readonly sourceId: Schema.String;
|
|
272
|
-
readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
|
|
273
|
-
readonly scope: Schema.brand<Schema.String, "ScopeId">;
|
|
274
|
-
readonly slot: Schema.String;
|
|
275
|
-
readonly value: Schema.Union<readonly [Schema.Struct<{
|
|
276
|
-
readonly kind: Schema.Literal<"secret">;
|
|
277
|
-
readonly secretId: Schema.brand<Schema.String, "SecretId">;
|
|
278
|
-
readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
279
|
-
}>, Schema.Struct<{
|
|
280
|
-
readonly kind: Schema.Literal<"connection">;
|
|
281
|
-
readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
|
|
282
|
-
}>, Schema.Struct<{
|
|
283
|
-
readonly kind: Schema.Literal<"text">;
|
|
284
|
-
readonly text: Schema.String;
|
|
285
|
-
}>]>;
|
|
286
|
-
}>;
|
|
287
|
-
export type OpenApiSourceBindingInput = typeof OpenApiSourceBindingInput.Type;
|
|
288
|
-
export declare const OpenApiSourceBindingRef: Schema.Struct<{
|
|
289
|
-
readonly sourceId: Schema.String;
|
|
290
|
-
readonly sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
291
|
-
readonly scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
292
|
-
readonly slot: Schema.String;
|
|
293
|
-
readonly value: Schema.Union<readonly [Schema.Struct<{
|
|
294
|
-
readonly kind: Schema.Literal<"secret">;
|
|
295
|
-
readonly secretId: Schema.brand<Schema.String, "SecretId">;
|
|
296
|
-
readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
297
|
-
}>, Schema.Struct<{
|
|
298
|
-
readonly kind: Schema.Literal<"connection">;
|
|
299
|
-
readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
|
|
300
|
-
}>, Schema.Struct<{
|
|
301
|
-
readonly kind: Schema.Literal<"text">;
|
|
302
|
-
readonly text: Schema.String;
|
|
303
|
-
}>]>;
|
|
304
|
-
readonly createdAt: Schema.Date;
|
|
305
|
-
readonly updatedAt: Schema.Date;
|
|
306
|
-
}>;
|
|
307
|
-
export type OpenApiSourceBindingRef = typeof OpenApiSourceBindingRef.Type;
|
|
308
|
-
export declare const OAuth2Flow: Schema.Literals<readonly ["authorizationCode", "clientCredentials"]>;
|
|
309
|
-
export type OAuth2Flow = typeof OAuth2Flow.Type;
|
|
310
|
-
export declare const OAuth2SourceConfig: Schema.Struct<{
|
|
311
|
-
readonly kind: Schema.Literal<"oauth2">;
|
|
312
|
-
readonly securitySchemeName: Schema.String;
|
|
313
|
-
readonly flow: Schema.Literals<readonly ["authorizationCode", "clientCredentials"]>;
|
|
314
|
-
readonly tokenUrl: Schema.String;
|
|
315
|
-
readonly authorizationUrl: Schema.NullOr<Schema.String>;
|
|
316
|
-
readonly issuerUrl: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
317
|
-
readonly clientIdSlot: Schema.String;
|
|
318
|
-
readonly clientSecretSlot: Schema.NullOr<Schema.String>;
|
|
319
|
-
readonly connectionSlot: Schema.String;
|
|
320
|
-
readonly scopes: Schema.$Array<Schema.String>;
|
|
321
|
-
}>;
|
|
322
|
-
export type OAuth2SourceConfig = typeof OAuth2SourceConfig.Type;
|
|
323
274
|
export declare const InvocationResult: Schema.Struct<{
|
|
324
275
|
readonly status: Schema.Number;
|
|
325
276
|
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { Context, Effect, Layer } from "effect";
|
|
2
|
-
import { HttpClient,
|
|
1
|
+
import { Context, Effect, Layer, Scope } from "effect";
|
|
2
|
+
import { HttpClient, HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
|
3
|
+
import { HttpApi } from "effect/unstable/httpapi";
|
|
4
|
+
import { OAuthTestServer } from "@executor-js/sdk/testing";
|
|
5
|
+
import type { OpenApiPluginExtension, OpenApiSpecConfig } from "../sdk/plugin";
|
|
3
6
|
declare const OpenApiTestServerAddressError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
4
7
|
readonly _tag: "OpenApiTestServerAddressError";
|
|
5
8
|
} & Readonly<A>;
|
|
@@ -14,21 +17,156 @@ export declare class OpenApiTestServerSpecError extends OpenApiTestServerSpecErr
|
|
|
14
17
|
readonly cause: unknown;
|
|
15
18
|
}> {
|
|
16
19
|
}
|
|
17
|
-
export interface OpenApiTestServerOptions {
|
|
18
|
-
readonly spec: unknown;
|
|
19
|
-
}
|
|
20
20
|
export interface OpenApiTestServerShape {
|
|
21
21
|
readonly baseUrl: string;
|
|
22
22
|
readonly specJson: string;
|
|
23
23
|
readonly httpClientLayer: Layer.Layer<HttpClient.HttpClient, never, never>;
|
|
24
24
|
}
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
export interface OpenApiHttpApiTestServerOptions {
|
|
26
|
+
readonly api: HttpApi.Any;
|
|
27
|
+
readonly handlersLayer: Layer.Layer<any, any, any>;
|
|
28
|
+
readonly specPath?: `/${string}`;
|
|
29
|
+
readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;
|
|
30
|
+
readonly captureSpecRequest?: (request: HttpServerRequest.HttpServerRequest) => Effect.Effect<void>;
|
|
31
|
+
readonly guardSpecRequest?: (request: HttpServerRequest.HttpServerRequest) => Effect.Effect<HttpServerResponse.HttpServerResponse | null>;
|
|
32
|
+
}
|
|
33
|
+
export interface OpenApiHttpApiTestServerShape extends OpenApiTestServerShape {
|
|
34
|
+
readonly specUrl: string;
|
|
35
|
+
}
|
|
36
|
+
export interface MutableOpenApiSpecTestServerShape extends OpenApiTestServerShape {
|
|
37
|
+
readonly specUrl: string;
|
|
38
|
+
readonly setApi: (api: HttpApi.Any) => Effect.Effect<void, OpenApiTestServerSpecError>;
|
|
39
|
+
readonly requestCount: Effect.Effect<number>;
|
|
40
|
+
}
|
|
41
|
+
export interface OpenApiTestRequest {
|
|
42
|
+
readonly method: string;
|
|
43
|
+
readonly url: string;
|
|
44
|
+
readonly path: string;
|
|
45
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
46
|
+
readonly body: string;
|
|
47
|
+
}
|
|
48
|
+
export interface OpenApiEchoTestServerOptions {
|
|
49
|
+
readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;
|
|
50
|
+
readonly oauth2?: {
|
|
51
|
+
readonly authorizationUrl: string;
|
|
52
|
+
readonly tokenUrl: string;
|
|
53
|
+
readonly scopes?: Readonly<Record<string, string>>;
|
|
54
|
+
readonly validateAuthorization?: (authorization: string | null) => Effect.Effect<boolean>;
|
|
55
|
+
readonly wwwAuthenticate?: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface OpenApiEchoTestServerShape extends OpenApiTestServerShape {
|
|
59
|
+
readonly specUrl: string;
|
|
60
|
+
readonly requests: Effect.Effect<readonly OpenApiTestRequest[]>;
|
|
61
|
+
readonly clearRequests: Effect.Effect<void>;
|
|
62
|
+
}
|
|
63
|
+
export type OpenApiTestSourceOptions = Omit<OpenApiSpecConfig, "spec" | "baseUrl" | "name" | "namespace"> & {
|
|
64
|
+
readonly baseUrl?: string | null;
|
|
65
|
+
readonly name?: string;
|
|
66
|
+
readonly namespace?: string;
|
|
67
|
+
};
|
|
68
|
+
export type OpenApiHttpApiTestSourceOptions = Omit<OpenApiSpecConfig, "spec" | "name" | "namespace" | "baseUrl"> & {
|
|
69
|
+
readonly name?: string;
|
|
70
|
+
readonly namespace?: string;
|
|
71
|
+
readonly baseUrl?: string | null;
|
|
72
|
+
readonly specBaseUrl?: string;
|
|
73
|
+
readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;
|
|
74
|
+
};
|
|
75
|
+
type OpenApiHttpApiAddSpecCredentialInput = string | {
|
|
76
|
+
readonly kind: "secret";
|
|
77
|
+
readonly prefix?: string;
|
|
78
|
+
};
|
|
79
|
+
type OpenApiHttpApiAddSpecCredentialsInput = {
|
|
80
|
+
readonly headers?: Record<string, OpenApiHttpApiAddSpecCredentialInput>;
|
|
81
|
+
readonly queryParams?: Record<string, OpenApiHttpApiAddSpecCredentialInput>;
|
|
82
|
+
};
|
|
83
|
+
export type OpenApiHttpApiTestAddSpecPayloadOptions = Omit<OpenApiHttpApiTestSourceOptions, "scope" | "headers" | "queryParams" | "specFetchCredentials"> & OpenApiHttpApiAddSpecCredentialsInput & {
|
|
84
|
+
readonly specFetchCredentials?: OpenApiHttpApiAddSpecCredentialsInput;
|
|
85
|
+
};
|
|
86
|
+
export type OpenApiTestSourceExecutor = {
|
|
87
|
+
readonly openapi: Pick<OpenApiPluginExtension, "addSpec">;
|
|
88
|
+
};
|
|
89
|
+
export interface OpenApiTestSpecOptions {
|
|
90
|
+
readonly baseUrl?: string;
|
|
91
|
+
readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;
|
|
92
|
+
}
|
|
93
|
+
export declare const makeOpenApiTestSpecJson: (api: HttpApi.Any, options?: OpenApiTestSpecOptions) => string;
|
|
94
|
+
export declare const makeOpenApiTestSourceConfig: (server: OpenApiTestServerShape, options: OpenApiTestSourceOptions) => OpenApiSpecConfig;
|
|
95
|
+
export declare const addOpenApiTestSource: (executor: OpenApiTestSourceExecutor, server: OpenApiTestServerShape, options: OpenApiTestSourceOptions) => Effect.Effect<{
|
|
96
|
+
readonly sourceId: string;
|
|
97
|
+
readonly toolCount: number;
|
|
98
|
+
}, import("@executor-js/sdk/core").StorageFailure | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError, never>;
|
|
99
|
+
export declare const makeOpenApiHttpApiTestSourceConfig: (api: HttpApi.Any, options: OpenApiHttpApiTestSourceOptions) => OpenApiSpecConfig;
|
|
100
|
+
export declare const addOpenApiHttpApiTestSource: (executor: OpenApiTestSourceExecutor, api: HttpApi.Any, options: OpenApiHttpApiTestSourceOptions) => Effect.Effect<{
|
|
101
|
+
readonly sourceId: string;
|
|
102
|
+
readonly toolCount: number;
|
|
103
|
+
}, import("@executor-js/sdk/core").StorageFailure | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError, never>;
|
|
104
|
+
export declare const makeOpenApiHttpApiTestAddSpecPayload: (api: HttpApi.Any, options: OpenApiHttpApiTestAddSpecPayloadOptions) => {
|
|
105
|
+
specFetchCredentials?: OpenApiHttpApiAddSpecCredentialsInput | undefined;
|
|
106
|
+
oauth2?: {
|
|
107
|
+
readonly kind: "oauth2";
|
|
108
|
+
readonly scopes: readonly string[];
|
|
109
|
+
readonly clientSecretSlot: string | null;
|
|
110
|
+
readonly securitySchemeName: string;
|
|
111
|
+
readonly flow: "authorizationCode" | "clientCredentials";
|
|
112
|
+
readonly tokenUrl: string;
|
|
113
|
+
readonly clientIdSlot: string;
|
|
114
|
+
readonly connectionSlot: string;
|
|
115
|
+
readonly issuerUrl?: string | null | undefined;
|
|
116
|
+
readonly authorizationUrl?: string | null | undefined;
|
|
117
|
+
} | undefined;
|
|
118
|
+
queryParams?: Record<string, OpenApiHttpApiAddSpecCredentialInput> | undefined;
|
|
119
|
+
headers?: Record<string, OpenApiHttpApiAddSpecCredentialInput> | undefined;
|
|
120
|
+
spec: {
|
|
121
|
+
readonly kind: "url";
|
|
122
|
+
readonly url: string;
|
|
123
|
+
} | {
|
|
124
|
+
readonly value: string;
|
|
125
|
+
readonly kind: "blob";
|
|
126
|
+
};
|
|
127
|
+
namespace: string;
|
|
128
|
+
name: string;
|
|
129
|
+
baseUrl: string;
|
|
130
|
+
};
|
|
131
|
+
export declare const makeOpenApiHttpApiTestSpecPayload: (api: HttpApi.Any, options?: OpenApiTestSpecOptions) => {
|
|
132
|
+
spec: string;
|
|
133
|
+
};
|
|
134
|
+
export declare const serveOpenApiHttpApiTestServer: (options: OpenApiHttpApiTestServerOptions) => Effect.Effect<OpenApiHttpApiTestServerShape, OpenApiTestServerAddressError | OpenApiTestServerSpecError, Scope.Scope>;
|
|
135
|
+
declare const OpenApiHttpApiTestServer_base: Context.ServiceClass<OpenApiHttpApiTestServer, "@executor-js/plugin-openapi/testing/OpenApiHttpApiTestServer", OpenApiHttpApiTestServerShape>;
|
|
136
|
+
export declare class OpenApiHttpApiTestServer extends OpenApiHttpApiTestServer_base {
|
|
137
|
+
static readonly layer: (options: OpenApiHttpApiTestServerOptions) => Layer.Layer<OpenApiHttpApiTestServer, OpenApiTestServerAddressError | OpenApiTestServerSpecError, never>;
|
|
138
|
+
}
|
|
139
|
+
export declare const serveMutableOpenApiSpecTestServer: (options: {
|
|
140
|
+
readonly initialApi: HttpApi.Any;
|
|
141
|
+
readonly specPath?: `/${string}`;
|
|
142
|
+
readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;
|
|
143
|
+
}) => Effect.Effect<MutableOpenApiSpecTestServerShape, OpenApiTestServerAddressError | OpenApiTestServerSpecError, Scope.Scope>;
|
|
144
|
+
export declare const serveOpenApiEchoTestServer: (options?: OpenApiEchoTestServerOptions) => Effect.Effect<OpenApiEchoTestServerShape, OpenApiTestServerAddressError | OpenApiTestServerSpecError, Scope.Scope>;
|
|
145
|
+
export declare const serveOpenApiEchoTestServerWithOAuth: (options?: Omit<OpenApiEchoTestServerOptions, "oauth2"> & {
|
|
146
|
+
readonly scopes?: Readonly<Record<string, string>>;
|
|
147
|
+
readonly wwwAuthenticate?: string;
|
|
148
|
+
}) => Effect.Effect<OpenApiEchoTestServerShape, OpenApiTestServerAddressError | OpenApiTestServerSpecError, Scope.Scope | OAuthTestServer>;
|
|
149
|
+
declare const OpenApiEchoTestServer_base: Context.ServiceClass<OpenApiEchoTestServer, "@executor-js/plugin-openapi/testing/OpenApiEchoTestServer", OpenApiEchoTestServerShape>;
|
|
150
|
+
export declare class OpenApiEchoTestServer extends OpenApiEchoTestServer_base {
|
|
151
|
+
static readonly layer: (options?: OpenApiEchoTestServerOptions) => Layer.Layer<OpenApiEchoTestServer, OpenApiTestServerAddressError | OpenApiTestServerSpecError, never>;
|
|
152
|
+
static readonly layerWithOAuth: (options?: Omit<OpenApiEchoTestServerOptions, "oauth2"> & {
|
|
153
|
+
readonly scopes?: Readonly<Record<string, string>>;
|
|
154
|
+
readonly wwwAuthenticate?: string;
|
|
155
|
+
}) => Layer.Layer<OpenApiEchoTestServer, OpenApiTestServerAddressError | OpenApiTestServerSpecError, OAuthTestServer>;
|
|
30
156
|
}
|
|
31
157
|
export declare const TestLayers: {
|
|
32
|
-
|
|
158
|
+
httpApi: (options: OpenApiHttpApiTestServerOptions) => Layer.Layer<OpenApiHttpApiTestServer, OpenApiTestServerAddressError | OpenApiTestServerSpecError, never>;
|
|
159
|
+
echo: (options?: OpenApiEchoTestServerOptions) => Layer.Layer<OpenApiEchoTestServer, OpenApiTestServerAddressError | OpenApiTestServerSpecError, never>;
|
|
160
|
+
echoWithOAuth: (options?: Omit<OpenApiEchoTestServerOptions, "oauth2"> & {
|
|
161
|
+
readonly scopes?: Readonly<Record<string, string>>;
|
|
162
|
+
readonly wwwAuthenticate?: string;
|
|
163
|
+
}) => Layer.Layer<OpenApiEchoTestServer, OpenApiTestServerAddressError | OpenApiTestServerSpecError, OAuthTestServer>;
|
|
33
164
|
};
|
|
165
|
+
export interface OpenApiInvocationResult<TData = Record<string, unknown> | unknown[] | null> {
|
|
166
|
+
readonly status: number | null;
|
|
167
|
+
readonly headers: Record<string, string> | null;
|
|
168
|
+
readonly data: TData;
|
|
169
|
+
readonly error: unknown;
|
|
170
|
+
}
|
|
171
|
+
export declare const unwrapInvocation: <TData = Record<string, unknown> | null>(raw: unknown) => OpenApiInvocationResult<TData>;
|
|
34
172
|
export {};
|