@executor-js/plugin-openapi 1.5.5 → 1.5.7
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-7M52SRUX.js → AddOpenApiSource-7O4LSD7C.js} +79 -241
- package/dist/AddOpenApiSource-7O4LSD7C.js.map +1 -0
- package/dist/{EditOpenApiSource-WTAMRJUK.js → EditOpenApiSource-GIN5RQPL.js} +3 -3
- package/dist/{OpenApiAccountsPanel-3VJJXNQF.js → OpenApiAccountsPanel-7XT6ZMD5.js} +30 -28
- package/dist/OpenApiAccountsPanel-7XT6ZMD5.js.map +1 -0
- package/dist/api/group.d.ts +38 -37
- package/dist/api/index.d.ts +39 -38
- package/dist/{chunk-YVRI7KRC.js → chunk-C3IJX4AN.js} +257 -219
- package/dist/chunk-C3IJX4AN.js.map +1 -0
- package/dist/{chunk-OSIFYIQP.js → chunk-C6PH4R7Q.js} +94 -5
- package/dist/chunk-C6PH4R7Q.js.map +1 -0
- package/dist/{chunk-BSLE6HCE.js → chunk-IB36ED7Y.js} +13 -27
- package/dist/chunk-IB36ED7Y.js.map +1 -0
- package/dist/chunk-RCBR3QMJ.js +73 -0
- package/dist/chunk-RCBR3QMJ.js.map +1 -0
- package/dist/{chunk-V7VCHYOY.js → chunk-WJQIWTZF.js} +97 -172
- package/dist/chunk-WJQIWTZF.js.map +1 -0
- package/dist/client.js +3 -3
- package/dist/core.js +133 -7
- package/dist/core.js.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/react/AddOpenApiSource.d.ts +0 -1
- package/dist/react/OpenApiSourceDetailsFields.d.ts +3 -0
- package/dist/react/atoms.d.ts +40 -52
- package/dist/react/auth-method-config.d.ts +7 -4
- package/dist/react/client.d.ts +38 -37
- package/dist/sdk/config.d.ts +27 -27
- package/dist/sdk/derive-auth.d.ts +9 -0
- package/dist/sdk/extract.d.ts +11 -1
- package/dist/sdk/index.d.ts +6 -2
- package/dist/sdk/invoke.d.ts +11 -1
- package/dist/sdk/migrate-config.d.ts +4 -0
- package/dist/sdk/migrate-config.test.d.ts +1 -0
- package/dist/sdk/openapi-utils.d.ts +4 -8
- package/dist/sdk/output-schema-migration.d.ts +21 -0
- package/dist/sdk/output-schema-migration.test.d.ts +1 -0
- package/dist/sdk/plugin.d.ts +6 -4
- package/dist/sdk/preview.d.ts +77 -1
- package/dist/sdk/server-url-resolution.test.d.ts +1 -0
- package/dist/sdk/spec-blob-migration.d.ts +7 -0
- package/dist/sdk/spec-blob.test.d.ts +1 -0
- package/dist/sdk/store.d.ts +10 -1
- package/dist/sdk/tool-row-projection.test.d.ts +1 -0
- package/dist/sdk/types.d.ts +61 -36
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing.js +4 -20
- package/dist/testing.js.map +1 -1
- package/package.json +3 -3
- package/dist/AddOpenApiSource-7M52SRUX.js.map +0 -1
- package/dist/OpenApiAccountsPanel-3VJJXNQF.js.map +0 -1
- package/dist/chunk-BSLE6HCE.js.map +0 -1
- package/dist/chunk-OSIFYIQP.js.map +0 -1
- package/dist/chunk-QSSRVK6M.js +0 -139
- package/dist/chunk-QSSRVK6M.js.map +0 -1
- package/dist/chunk-V7VCHYOY.js.map +0 -1
- package/dist/chunk-YVRI7KRC.js.map +0 -1
- /package/dist/{EditOpenApiSource-WTAMRJUK.js.map → EditOpenApiSource-GIN5RQPL.js.map} +0 -0
package/dist/sdk/preview.d.ts
CHANGED
|
@@ -191,6 +191,82 @@ export declare const SpecPreview: Schema.Struct<{
|
|
|
191
191
|
}>>;
|
|
192
192
|
}>;
|
|
193
193
|
export type SpecPreview = typeof SpecPreview.Type;
|
|
194
|
+
/** Preview already-resolved spec text — extract metadata without registering
|
|
195
|
+
* anything and without any HTTP dependency. */
|
|
196
|
+
export declare const previewSpecText: (specText: string) => Effect.Effect<{
|
|
197
|
+
readonly version: Option.Option<string>;
|
|
198
|
+
readonly operations: readonly {
|
|
199
|
+
readonly method: "post" | "options" | "delete" | "get" | "put" | "patch" | "head" | "trace";
|
|
200
|
+
readonly deprecated: boolean;
|
|
201
|
+
readonly path: string;
|
|
202
|
+
readonly summary: Option.Option<string>;
|
|
203
|
+
readonly tags: readonly string[];
|
|
204
|
+
readonly operationId: string;
|
|
205
|
+
}[];
|
|
206
|
+
readonly title: Option.Option<string>;
|
|
207
|
+
readonly servers: readonly {
|
|
208
|
+
readonly description: Option.Option<string>;
|
|
209
|
+
readonly url: string;
|
|
210
|
+
readonly variables: Option.Option<{
|
|
211
|
+
readonly [x: string]: {
|
|
212
|
+
readonly default: string;
|
|
213
|
+
readonly description: Option.Option<string>;
|
|
214
|
+
readonly enum: Option.Option<readonly string[]>;
|
|
215
|
+
};
|
|
216
|
+
}>;
|
|
217
|
+
}[];
|
|
218
|
+
readonly tags: readonly string[];
|
|
219
|
+
readonly securitySchemes: readonly {
|
|
220
|
+
readonly name: string;
|
|
221
|
+
readonly type: "oauth2" | "http" | "apiKey" | "openIdConnect";
|
|
222
|
+
readonly in: Option.Option<"header" | "query" | "cookie">;
|
|
223
|
+
readonly description: Option.Option<string>;
|
|
224
|
+
readonly scheme: Option.Option<string>;
|
|
225
|
+
readonly bearerFormat: Option.Option<string>;
|
|
226
|
+
readonly headerName: Option.Option<string>;
|
|
227
|
+
readonly flows: Option.Option<{
|
|
228
|
+
readonly authorizationCode: Option.Option<{
|
|
229
|
+
readonly authorizationUrl: string;
|
|
230
|
+
readonly tokenUrl: string;
|
|
231
|
+
readonly scopes: {
|
|
232
|
+
readonly [x: string]: string;
|
|
233
|
+
};
|
|
234
|
+
readonly refreshUrl: Option.Option<string>;
|
|
235
|
+
}>;
|
|
236
|
+
readonly clientCredentials: Option.Option<{
|
|
237
|
+
readonly tokenUrl: string;
|
|
238
|
+
readonly scopes: {
|
|
239
|
+
readonly [x: string]: string;
|
|
240
|
+
};
|
|
241
|
+
readonly refreshUrl: Option.Option<string>;
|
|
242
|
+
}>;
|
|
243
|
+
}>;
|
|
244
|
+
readonly openIdConnectUrl: Option.Option<string>;
|
|
245
|
+
}[];
|
|
246
|
+
readonly authStrategies: readonly {
|
|
247
|
+
readonly schemes: readonly string[];
|
|
248
|
+
}[];
|
|
249
|
+
readonly headerPresets: readonly {
|
|
250
|
+
readonly label: string;
|
|
251
|
+
readonly headers: {
|
|
252
|
+
readonly [x: string]: string | null;
|
|
253
|
+
};
|
|
254
|
+
readonly secretHeaders: readonly string[];
|
|
255
|
+
}[];
|
|
256
|
+
readonly oauth2Presets: readonly {
|
|
257
|
+
readonly label: string;
|
|
258
|
+
readonly authorizationUrl: Option.Option<string>;
|
|
259
|
+
readonly tokenUrl: string;
|
|
260
|
+
readonly scopes: {
|
|
261
|
+
readonly [x: string]: string;
|
|
262
|
+
};
|
|
263
|
+
readonly refreshUrl: Option.Option<string>;
|
|
264
|
+
readonly flow: "authorizationCode" | "clientCredentials";
|
|
265
|
+
readonly identityScopes: false | "auto" | readonly string[];
|
|
266
|
+
readonly securitySchemeName: string;
|
|
267
|
+
}[];
|
|
268
|
+
readonly operationCount: number;
|
|
269
|
+
}, import("./errors").OpenApiParseError | import("./errors").OpenApiExtractionError, never>;
|
|
194
270
|
/** Preview an OpenAPI spec — extract metadata without registering anything.
|
|
195
271
|
* Accepts either a URL or raw JSON/YAML text. */
|
|
196
272
|
export declare const previewSpec: (input: string) => Effect.Effect<{
|
|
@@ -204,7 +280,6 @@ export declare const previewSpec: (input: string) => Effect.Effect<{
|
|
|
204
280
|
readonly operationId: string;
|
|
205
281
|
}[];
|
|
206
282
|
readonly title: Option.Option<string>;
|
|
207
|
-
readonly tags: readonly string[];
|
|
208
283
|
readonly servers: readonly {
|
|
209
284
|
readonly description: Option.Option<string>;
|
|
210
285
|
readonly url: string;
|
|
@@ -216,6 +291,7 @@ export declare const previewSpec: (input: string) => Effect.Effect<{
|
|
|
216
291
|
};
|
|
217
292
|
}>;
|
|
218
293
|
}[];
|
|
294
|
+
readonly tags: readonly string[];
|
|
219
295
|
readonly securitySchemes: readonly {
|
|
220
296
|
readonly name: string;
|
|
221
297
|
readonly type: "oauth2" | "http" | "apiKey" | "openIdConnect";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { type SqliteDataMigrationClient } from "@executor-js/sdk/core";
|
|
3
|
+
/** Registry entry for the boot-time data-migration ledger. */
|
|
4
|
+
export declare const openApiSpecBlobDataMigration: {
|
|
5
|
+
name: string;
|
|
6
|
+
run: (client: SqliteDataMigrationClient) => Effect.Effect<void, import("@executor-js/sdk/core").DataMigrationError, never>;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/sdk/store.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export interface StoredOperation {
|
|
|
8
8
|
readonly toolName: string;
|
|
9
9
|
readonly binding: OperationBinding;
|
|
10
10
|
}
|
|
11
|
+
/** Blob key for a spec's content hash. Content-addressed so re-puts are
|
|
12
|
+
* idempotent and identical specs share one blob per partition. */
|
|
13
|
+
export declare const specBlobKey: (specHash: string) => string;
|
|
11
14
|
export interface OpenapiStore {
|
|
12
15
|
/** Replace all stored operations for an integration. */
|
|
13
16
|
readonly putOperations: (integration: string, operations: readonly StoredOperation[]) => Effect.Effect<void, StorageFailure>;
|
|
@@ -17,5 +20,11 @@ export interface OpenapiStore {
|
|
|
17
20
|
readonly listOperations: (integration: string) => Effect.Effect<readonly StoredOperation[], StorageFailure>;
|
|
18
21
|
/** Drop all stored operations for an integration. */
|
|
19
22
|
readonly removeOperations: (integration: string) => Effect.Effect<void, StorageFailure>;
|
|
23
|
+
/** Persist resolved spec text under its content hash. Org-owned and
|
|
24
|
+
* content-addressed; never removed on integration removal because another
|
|
25
|
+
* integration in the tenant may share the hash. */
|
|
26
|
+
readonly putSpec: (specHash: string, specText: string) => Effect.Effect<void, StorageFailure>;
|
|
27
|
+
/** Load spec text by content hash; null when no blob exists. */
|
|
28
|
+
readonly getSpec: (specHash: string) => Effect.Effect<string | null, StorageFailure>;
|
|
20
29
|
}
|
|
21
|
-
export declare const makeDefaultOpenapiStore: ({ pluginStorage }: StorageDeps) => OpenapiStore;
|
|
30
|
+
export declare const makeDefaultOpenapiStore: ({ pluginStorage, blobs }: StorageDeps) => OpenapiStore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/sdk/types.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
/** A literal string, or a parts-array mixing literals and variable refs. */
|
|
9
|
-
export type AuthenticationTemplateValue = string | readonly (string | AuthenticationVariable)[];
|
|
10
|
-
export declare const variable: (name: string) => AuthenticationVariable;
|
|
11
|
-
/** The variable name the resolved credential value renders into. */
|
|
12
|
-
export declare const TOKEN_VARIABLE: "token";
|
|
13
|
-
export type APIKeyAuthentication = {
|
|
14
|
-
readonly slug: AuthTemplateSlug;
|
|
15
|
-
readonly type: "apiKey";
|
|
16
|
-
readonly headers?: Record<string, AuthenticationTemplateValue>;
|
|
17
|
-
readonly queryParams?: Record<string, AuthenticationTemplateValue>;
|
|
18
|
-
};
|
|
2
|
+
import { type OAuthAuthentication } from "@executor-js/sdk/shared";
|
|
3
|
+
import { type ApiKeyAuthMethod, type ApiKeyAuthTemplate } from "@executor-js/sdk/http-auth";
|
|
4
|
+
export { TOKEN_VARIABLE } from "@executor-js/sdk/http-auth";
|
|
5
|
+
export type APIKeyAuthentication = ApiKeyAuthMethod;
|
|
6
|
+
/** Every method is keyed by `kind` — `kind: "oauth2"` | `kind: "apikey"`. */
|
|
19
7
|
export type Authentication = OAuthAuthentication | APIKeyAuthentication;
|
|
8
|
+
/** What auth inputs accept: oauth templates (wire-typed: plain slug) plus the
|
|
9
|
+
* request-shaped apikey dialect (`type: "apiKey"`, headers/queryParams
|
|
10
|
+
* records) — the ONE apikey authoring shape. Stored configs and the catalog
|
|
11
|
+
* read as canonical placements; `apiKeyAuthTemplateFromMethod` serializes
|
|
12
|
+
* them back for read-modify-write flows. */
|
|
13
|
+
export type OAuthAuthenticationInput = Omit<OAuthAuthentication, "slug"> & {
|
|
14
|
+
readonly slug: string;
|
|
15
|
+
};
|
|
16
|
+
export type AuthenticationInput = OAuthAuthenticationInput | ApiKeyAuthTemplate;
|
|
17
|
+
/** Expand the request-shaped dialect into canonical placements and brand the
|
|
18
|
+
* oauth slugs. A dialect entry without a slug gets a blank one —
|
|
19
|
+
* `mergeAuthTemplates` backfills `custom_<id>`. */
|
|
20
|
+
export declare const normalizeOpenApiAuthInputs: (inputs: readonly AuthenticationInput[]) => readonly Authentication[];
|
|
20
21
|
export declare const OperationId: Schema.brand<Schema.String, "OperationId">;
|
|
21
22
|
export type OperationId = typeof OperationId.Type;
|
|
22
23
|
export declare const HttpMethod: Schema.Literals<readonly ["get", "put", "post", "delete", "patch", "head", "options", "trace"]>;
|
|
@@ -84,11 +85,35 @@ export declare const OperationRequestBody: Schema.Struct<{
|
|
|
84
85
|
}>>>;
|
|
85
86
|
}>;
|
|
86
87
|
export type OperationRequestBody = typeof OperationRequestBody.Type;
|
|
88
|
+
export declare const ServerVariable: Schema.Struct<{
|
|
89
|
+
readonly default: Schema.String;
|
|
90
|
+
readonly enum: Schema.OptionFromOptional<Schema.$Array<Schema.String>>;
|
|
91
|
+
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
92
|
+
}>;
|
|
93
|
+
export type ServerVariable = typeof ServerVariable.Type;
|
|
94
|
+
export declare const ServerInfo: Schema.Struct<{
|
|
95
|
+
readonly url: Schema.String;
|
|
96
|
+
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
97
|
+
readonly variables: Schema.OptionFromOptional<Schema.$Record<Schema.String, Schema.Struct<{
|
|
98
|
+
readonly default: Schema.String;
|
|
99
|
+
readonly enum: Schema.OptionFromOptional<Schema.$Array<Schema.String>>;
|
|
100
|
+
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
101
|
+
}>>>;
|
|
102
|
+
}>;
|
|
103
|
+
export type ServerInfo = typeof ServerInfo.Type;
|
|
87
104
|
export declare const ExtractedOperation: Schema.Struct<{
|
|
88
105
|
readonly operationId: Schema.brand<Schema.String, "OperationId">;
|
|
89
106
|
readonly toolPath: Schema.OptionFromOptional<Schema.String>;
|
|
90
107
|
readonly method: Schema.Literals<readonly ["get", "put", "post", "delete", "patch", "head", "options", "trace"]>;
|
|
91
|
-
readonly
|
|
108
|
+
readonly servers: Schema.$Array<Schema.Struct<{
|
|
109
|
+
readonly url: Schema.String;
|
|
110
|
+
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
111
|
+
readonly variables: Schema.OptionFromOptional<Schema.$Record<Schema.String, Schema.Struct<{
|
|
112
|
+
readonly default: Schema.String;
|
|
113
|
+
readonly enum: Schema.OptionFromOptional<Schema.$Array<Schema.String>>;
|
|
114
|
+
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
115
|
+
}>>>;
|
|
116
|
+
}>>;
|
|
92
117
|
readonly pathTemplate: Schema.String;
|
|
93
118
|
readonly summary: Schema.OptionFromOptional<Schema.String>;
|
|
94
119
|
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
@@ -130,22 +155,6 @@ export declare const ExtractedOperation: Schema.Struct<{
|
|
|
130
155
|
readonly deprecated: Schema.Boolean;
|
|
131
156
|
}>;
|
|
132
157
|
export type ExtractedOperation = typeof ExtractedOperation.Type;
|
|
133
|
-
export declare const ServerVariable: Schema.Struct<{
|
|
134
|
-
readonly default: Schema.String;
|
|
135
|
-
readonly enum: Schema.OptionFromOptional<Schema.$Array<Schema.String>>;
|
|
136
|
-
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
137
|
-
}>;
|
|
138
|
-
export type ServerVariable = typeof ServerVariable.Type;
|
|
139
|
-
export declare const ServerInfo: Schema.Struct<{
|
|
140
|
-
readonly url: Schema.String;
|
|
141
|
-
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
142
|
-
readonly variables: Schema.OptionFromOptional<Schema.$Record<Schema.String, Schema.Struct<{
|
|
143
|
-
readonly default: Schema.String;
|
|
144
|
-
readonly enum: Schema.OptionFromOptional<Schema.$Array<Schema.String>>;
|
|
145
|
-
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
146
|
-
}>>>;
|
|
147
|
-
}>;
|
|
148
|
-
export type ServerInfo = typeof ServerInfo.Type;
|
|
149
158
|
export declare const ExtractionResult: Schema.Struct<{
|
|
150
159
|
readonly title: Schema.OptionFromOptional<Schema.String>;
|
|
151
160
|
readonly version: Schema.OptionFromOptional<Schema.String>;
|
|
@@ -162,7 +171,15 @@ export declare const ExtractionResult: Schema.Struct<{
|
|
|
162
171
|
readonly operationId: Schema.brand<Schema.String, "OperationId">;
|
|
163
172
|
readonly toolPath: Schema.OptionFromOptional<Schema.String>;
|
|
164
173
|
readonly method: Schema.Literals<readonly ["get", "put", "post", "delete", "patch", "head", "options", "trace"]>;
|
|
165
|
-
readonly
|
|
174
|
+
readonly servers: Schema.$Array<Schema.Struct<{
|
|
175
|
+
readonly url: Schema.String;
|
|
176
|
+
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
177
|
+
readonly variables: Schema.OptionFromOptional<Schema.$Record<Schema.String, Schema.Struct<{
|
|
178
|
+
readonly default: Schema.String;
|
|
179
|
+
readonly enum: Schema.OptionFromOptional<Schema.$Array<Schema.String>>;
|
|
180
|
+
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
181
|
+
}>>>;
|
|
182
|
+
}>>;
|
|
166
183
|
readonly pathTemplate: Schema.String;
|
|
167
184
|
readonly summary: Schema.OptionFromOptional<Schema.String>;
|
|
168
185
|
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
@@ -207,7 +224,15 @@ export declare const ExtractionResult: Schema.Struct<{
|
|
|
207
224
|
export type ExtractionResult = typeof ExtractionResult.Type;
|
|
208
225
|
export declare const OperationBinding: Schema.Struct<{
|
|
209
226
|
readonly method: Schema.Literals<readonly ["get", "put", "post", "delete", "patch", "head", "options", "trace"]>;
|
|
210
|
-
readonly
|
|
227
|
+
readonly servers: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
228
|
+
readonly url: Schema.String;
|
|
229
|
+
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
230
|
+
readonly variables: Schema.OptionFromOptional<Schema.$Record<Schema.String, Schema.Struct<{
|
|
231
|
+
readonly default: Schema.String;
|
|
232
|
+
readonly enum: Schema.OptionFromOptional<Schema.$Array<Schema.String>>;
|
|
233
|
+
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
234
|
+
}>>>;
|
|
235
|
+
}>>>;
|
|
211
236
|
readonly pathTemplate: Schema.String;
|
|
212
237
|
readonly parameters: Schema.$Array<Schema.Struct<{
|
|
213
238
|
readonly name: Schema.String;
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ export declare const addOpenApiHttpApiTestSource: (executor: OpenApiTestSourceEx
|
|
|
120
120
|
readonly toolCount: number;
|
|
121
121
|
}, import("@executor-js/sdk/core").StorageFailure | import("@executor-js/sdk/core").IntegrationAlreadyExistsError | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError, never>;
|
|
122
122
|
export declare const makeOpenApiHttpApiTestAddSpecPayload: (api: HttpApi.Any, options: OpenApiHttpApiTestAddSpecPayloadOptions) => {
|
|
123
|
-
authenticationTemplate?: readonly import("../sdk").
|
|
123
|
+
authenticationTemplate?: readonly import("../sdk").AuthenticationInput[] | undefined;
|
|
124
124
|
queryParams?: Record<string, string> | undefined;
|
|
125
125
|
headers?: Record<string, string> | undefined;
|
|
126
126
|
spec: {
|
package/dist/testing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/testing/index.ts
|
|
2
|
-
import { Context, Data, Effect, Layer,
|
|
2
|
+
import { Context, Data, Effect, Layer, Predicate, Ref, Schema } from "effect";
|
|
3
3
|
import {
|
|
4
4
|
HttpRouter,
|
|
5
5
|
HttpServerRequest,
|
|
@@ -407,12 +407,6 @@ var TestLayers = {
|
|
|
407
407
|
echo: OpenApiEchoTestServer.layer,
|
|
408
408
|
echoWithOAuth: OpenApiEchoTestServer.layerWithOAuth
|
|
409
409
|
};
|
|
410
|
-
var OpenApiTransportEnvelope = Schema.Struct({
|
|
411
|
-
status: Schema.Number,
|
|
412
|
-
headers: Schema.Record(Schema.String, Schema.String),
|
|
413
|
-
data: Schema.Unknown
|
|
414
|
-
});
|
|
415
|
-
var decodeOpenApiTransportEnvelope = Schema.decodeUnknownOption(OpenApiTransportEnvelope);
|
|
416
410
|
var unwrapInvocation = (raw) => {
|
|
417
411
|
if (!isToolResult(raw)) {
|
|
418
412
|
return {
|
|
@@ -423,20 +417,10 @@ var unwrapInvocation = (raw) => {
|
|
|
423
417
|
};
|
|
424
418
|
}
|
|
425
419
|
if (raw.ok) {
|
|
426
|
-
const inner = raw.data;
|
|
427
|
-
const wrapped = Option.getOrUndefined(decodeOpenApiTransportEnvelope(inner));
|
|
428
|
-
if (wrapped !== void 0) {
|
|
429
|
-
return {
|
|
430
|
-
status: wrapped.status,
|
|
431
|
-
headers: wrapped.headers,
|
|
432
|
-
data: wrapped.data,
|
|
433
|
-
error: null
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
420
|
return {
|
|
437
|
-
status: null,
|
|
438
|
-
headers: null,
|
|
439
|
-
data:
|
|
421
|
+
status: raw.http?.status ?? null,
|
|
422
|
+
headers: raw.http?.headers ?? null,
|
|
423
|
+
data: raw.data,
|
|
440
424
|
error: null
|
|
441
425
|
};
|
|
442
426
|
}
|
package/dist/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/testing/index.ts"],"sourcesContent":["import { Context, Data, Effect, Layer, Option, Predicate, Ref, Schema, Scope } from \"effect\";\nimport {\n HttpClient,\n HttpRouter,\n HttpServerRequest,\n HttpServerResponse,\n} from \"effect/unstable/http\";\nimport {\n HttpApi,\n HttpApiBuilder,\n HttpApiEndpoint,\n HttpApiGroup,\n OpenApi,\n} from \"effect/unstable/httpapi\";\nimport { OAuthTestServer, serveTestHttpServerLayer } from \"@executor-js/sdk/testing\";\nimport {\n AuthTemplateSlug,\n ConnectionName,\n IntegrationSlug,\n ProviderItemId,\n ProviderKey,\n ToolAddress,\n isToolResult,\n type Connection,\n type CreateConnectionInput,\n type Owner,\n type ToolAddress as ToolAddressType,\n} from \"@executor-js/sdk/core\";\nimport type { OpenApiPluginExtension, OpenApiSpecConfig } from \"../sdk/plugin\";\n\nexport class OpenApiTestServerAddressError extends Data.TaggedError(\n \"OpenApiTestServerAddressError\",\n)<{\n readonly address: unknown;\n}> {}\n\nexport class OpenApiTestServerSpecError extends Data.TaggedError(\"OpenApiTestServerSpecError\")<{\n readonly cause: unknown;\n}> {}\n\nexport interface OpenApiTestServerShape {\n readonly baseUrl: string;\n readonly specJson: string;\n readonly httpClientLayer: Layer.Layer<HttpClient.HttpClient, never, never>;\n}\n\nexport interface OpenApiHttpApiTestServerOptions {\n readonly api: HttpApi.Any;\n readonly handlersLayer: Layer.Layer<any, any, any>;\n readonly specPath?: `/${string}`;\n readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;\n readonly captureSpecRequest?: (\n request: HttpServerRequest.HttpServerRequest,\n ) => Effect.Effect<void>;\n readonly guardSpecRequest?: (\n request: HttpServerRequest.HttpServerRequest,\n ) => Effect.Effect<HttpServerResponse.HttpServerResponse | null>;\n}\n\nexport interface OpenApiHttpApiTestServerShape extends OpenApiTestServerShape {\n readonly specUrl: string;\n}\n\nexport interface MutableOpenApiSpecTestServerShape extends OpenApiTestServerShape {\n readonly specUrl: string;\n readonly setApi: (api: HttpApi.Any) => Effect.Effect<void, OpenApiTestServerSpecError>;\n readonly requestCount: Effect.Effect<number>;\n}\n\nexport interface OpenApiTestRequest {\n readonly method: string;\n readonly url: string;\n readonly path: string;\n readonly headers: Readonly<Record<string, string>>;\n readonly body: string;\n}\n\nexport interface OpenApiEchoTestServerOptions {\n readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;\n readonly oauth2?: {\n readonly authorizationUrl: string;\n readonly tokenUrl: string;\n readonly scopes?: Readonly<Record<string, string>>;\n readonly validateAuthorization?: (authorization: string | null) => Effect.Effect<boolean>;\n readonly wwwAuthenticate?: string;\n };\n}\n\nexport interface OpenApiEchoTestServerShape extends OpenApiTestServerShape {\n readonly specUrl: string;\n readonly requests: Effect.Effect<readonly OpenApiTestRequest[]>;\n readonly clearRequests: Effect.Effect<void>;\n}\n\nexport type OpenApiTestSourceOptions = Omit<OpenApiSpecConfig, \"spec\" | \"baseUrl\" | \"slug\"> & {\n readonly baseUrl?: string | null;\n readonly slug?: string;\n};\n\nexport type OpenApiHttpApiTestSourceOptions = Omit<\n OpenApiSpecConfig,\n \"spec\" | \"slug\" | \"baseUrl\"\n> & {\n readonly slug?: string;\n readonly baseUrl?: string | null;\n readonly specBaseUrl?: string;\n readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;\n};\n\ntype OpenApiHttpApiAddSpecHeadersInput = {\n readonly headers?: Record<string, string>;\n readonly queryParams?: Record<string, string>;\n};\n\nexport type OpenApiHttpApiTestAddSpecPayloadOptions = Omit<\n OpenApiHttpApiTestSourceOptions,\n \"headers\" | \"queryParams\"\n> &\n OpenApiHttpApiAddSpecHeadersInput;\n\nexport type OpenApiTestSourceExecutor = {\n readonly openapi: Pick<OpenApiPluginExtension, \"addSpec\">;\n};\n\n// ---------------------------------------------------------------------------\n// v2 connection helper. In v2 a connection IS the credential and tools are\n// produced per-connection — so a test that invokes an openapi tool must\n// (1) addSpec to register the integration and (2) create a connection so the\n// tools are stamped + persisted. This helper does both and returns the\n// invokable address builder.\n// ---------------------------------------------------------------------------\n\nexport type OpenApiTestConnectionExecutor = {\n readonly openapi: Pick<OpenApiPluginExtension, \"addSpec\">;\n readonly connections: {\n readonly create: (input: CreateConnectionInput) => Effect.Effect<Connection, unknown>;\n };\n};\n\nexport interface OpenApiTestConnectionOptions {\n readonly slug?: string;\n readonly owner?: Owner;\n readonly connection?: string;\n readonly template?: string;\n /** Inline credential value. Defaults to a throwaway token via the in-memory\n * provider's `from` path is avoided — pass `value` to store a real secret. */\n readonly value?: string;\n readonly baseUrl?: string | null;\n}\n\nexport interface OpenApiTestConnection {\n readonly slug: string;\n readonly owner: Owner;\n readonly connection: string;\n readonly address: (tool: string) => ToolAddressType;\n}\n\n/** addSpec + connections.create from a raw server spec; returns an address\n * builder for `executor.execute`. */\nexport const addOpenApiTestConnection = (\n executor: OpenApiTestConnectionExecutor,\n server: OpenApiTestServerShape,\n sourceOptions: OpenApiTestSourceOptions,\n connectionOptions: OpenApiTestConnectionOptions = {},\n): Effect.Effect<OpenApiTestConnection, unknown> =>\n Effect.gen(function* () {\n const config = makeOpenApiTestSourceConfig(server, sourceOptions);\n const result = yield* executor.openapi.addSpec(config);\n const slug = String(result.slug);\n const owner: Owner = connectionOptions.owner ?? \"org\";\n const connection = connectionOptions.connection ?? \"main\";\n const template = connectionOptions.template ?? \"apiKey\";\n yield* executor.connections.create({\n owner,\n name: ConnectionName.make(connection),\n integration: IntegrationSlug.make(slug),\n template: AuthTemplateSlug.make(template),\n ...(connectionOptions.value !== undefined\n ? { value: connectionOptions.value }\n : {\n from: {\n provider: ProviderKey.make(\"memory\"),\n id: ProviderItemId.make(`${slug}-token`),\n },\n }),\n } satisfies CreateConnectionInput);\n return {\n slug,\n owner,\n connection,\n address: (tool: string) => ToolAddress.make(`tools.${slug}.${owner}.${connection}.${tool}`),\n };\n });\n\nexport interface OpenApiTestSpecOptions {\n readonly baseUrl?: string;\n readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;\n}\n\nexport const makeOpenApiTestSpecJson = (\n api: HttpApi.Any,\n options: OpenApiTestSpecOptions = {},\n): string => {\n const annotations = OpenApi.annotations({\n ...(options.baseUrl !== undefined ? { servers: [{ url: options.baseUrl }] } : {}),\n transform: options.transformSpec,\n });\n const annotated = (api as HttpApi.AnyWithProps).annotateMerge(annotations);\n return JSON.stringify(OpenApi.fromApi(annotated));\n};\n\nexport const makeOpenApiTestSourceConfig = (\n server: OpenApiTestServerShape,\n options: OpenApiTestSourceOptions,\n): OpenApiSpecConfig => {\n const { baseUrl, slug, ...rest } = options;\n return {\n ...rest,\n spec: { kind: \"blob\", value: server.specJson },\n slug: slug ?? \"test_api\",\n ...(baseUrl === null ? {} : { baseUrl: baseUrl ?? server.baseUrl }),\n } satisfies OpenApiSpecConfig;\n};\n\nexport const addOpenApiTestSource = (\n executor: OpenApiTestSourceExecutor,\n server: OpenApiTestServerShape,\n options: OpenApiTestSourceOptions,\n) => executor.openapi.addSpec(makeOpenApiTestSourceConfig(server, options));\n\nexport const makeOpenApiHttpApiTestSourceConfig = (\n api: HttpApi.Any,\n options: OpenApiHttpApiTestSourceOptions,\n): OpenApiSpecConfig => {\n const { baseUrl, specBaseUrl, transformSpec, slug, ...config } = options;\n return {\n ...config,\n spec: {\n kind: \"blob\",\n value: makeOpenApiTestSpecJson(api, { baseUrl: specBaseUrl, transformSpec }),\n },\n slug: slug ?? \"test_api\",\n ...(baseUrl === null ? {} : { baseUrl: baseUrl ?? specBaseUrl ?? \"https://api.example.test\" }),\n } satisfies OpenApiSpecConfig;\n};\n\nexport const addOpenApiHttpApiTestSource = (\n executor: OpenApiTestSourceExecutor,\n api: HttpApi.Any,\n options: OpenApiHttpApiTestSourceOptions,\n) => executor.openapi.addSpec(makeOpenApiHttpApiTestSourceConfig(api, options));\n\nexport const makeOpenApiHttpApiTestAddSpecPayload = (\n api: HttpApi.Any,\n options: OpenApiHttpApiTestAddSpecPayloadOptions,\n) => {\n const { headers, queryParams, ...sourceOptions } = options;\n const config = makeOpenApiHttpApiTestSourceConfig(api, sourceOptions);\n return {\n spec: config.spec,\n slug: config.slug,\n baseUrl: config.baseUrl,\n ...(headers !== undefined ? { headers } : {}),\n ...(queryParams !== undefined ? { queryParams } : {}),\n ...(config.authenticationTemplate !== undefined\n ? { authenticationTemplate: config.authenticationTemplate }\n : {}),\n };\n};\n\nexport const makeOpenApiHttpApiTestSpecPayload = (\n api: HttpApi.Any,\n options: OpenApiTestSpecOptions = {},\n) => ({\n spec: makeOpenApiTestSpecJson(api, options),\n});\n\nconst isJsonObject = (value: unknown): value is Readonly<Record<string, unknown>> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst OpenApiEchoItem = Schema.Struct({\n id: Schema.Number,\n name: Schema.String,\n});\n\nconst OpenApiEchoHeaders = Schema.Struct({\n authorization: Schema.optional(Schema.String),\n \"x-static\": Schema.optional(Schema.String),\n});\n\nconst OpenApiEchoMessage = Schema.Struct({\n message: Schema.String,\n suffix: Schema.optional(Schema.String),\n path: Schema.String,\n});\n\nconst OpenApiEchoItemsGroup = HttpApiGroup.make(\"items\")\n .add(\n HttpApiEndpoint.get(\"listItems\", \"/items\", {\n success: Schema.Array(OpenApiEchoItem),\n }),\n )\n .add(\n HttpApiEndpoint.get(\"echoHeaders\", \"/echo-headers\", {\n success: OpenApiEchoHeaders,\n }),\n );\n\nconst OpenApiEchoGroup = HttpApiGroup.make(\"echo\").add(\n HttpApiEndpoint.get(\"echoMessage\", \"/echo/:message\", {\n params: Schema.Struct({ message: Schema.String }),\n query: Schema.Struct({ suffix: Schema.optional(Schema.String) }),\n success: OpenApiEchoMessage,\n }),\n);\n\nconst OpenApiEchoApi = HttpApi.make(\"executorOpenApiTest\")\n .add(OpenApiEchoItemsGroup)\n .add(OpenApiEchoGroup)\n .annotateMerge(\n OpenApi.annotations({\n title: \"Executor OpenAPI Test Server\",\n version: \"1.0.0\",\n }),\n );\n\nconst openApiSpecJsonFromHttpApi = (\n api: HttpApi.Any,\n baseUrl: string,\n transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>,\n): Effect.Effect<string, OpenApiTestServerSpecError> =>\n Effect.try({\n try: () => makeOpenApiTestSpecJson(api, { baseUrl, transformSpec }),\n catch: (cause) => new OpenApiTestServerSpecError({ cause }),\n });\n\nexport const serveOpenApiHttpApiTestServer = (\n options: OpenApiHttpApiTestServerOptions,\n): Effect.Effect<\n OpenApiHttpApiTestServerShape,\n OpenApiTestServerAddressError | OpenApiTestServerSpecError,\n Scope.Scope\n> =>\n Effect.gen(function* () {\n const specPath = options.specPath ?? \"/spec.json\";\n let specJson = \"\";\n const SpecRoute = HttpRouter.addAll([\n HttpRouter.route(\n \"GET\",\n specPath,\n Effect.gen(function* () {\n const request = yield* HttpServerRequest.HttpServerRequest;\n if (options.captureSpecRequest) {\n yield* options.captureSpecRequest(request);\n }\n const guardResponse = options.guardSpecRequest\n ? yield* options.guardSpecRequest(request)\n : null;\n if (guardResponse) return guardResponse;\n return HttpServerResponse.text(specJson, {\n status: 200,\n contentType: \"application/json\",\n });\n }),\n ),\n ]);\n const ApiLive = HttpApiBuilder.layer(options.api as HttpApi.AnyWithProps).pipe(\n Layer.provide(options.handlersLayer),\n );\n const ServerLayer = HttpRouter.serve(Layer.mergeAll(ApiLive, SpecRoute), {\n disableListenLog: true,\n disableLogger: true,\n });\n const server = yield* serveTestHttpServerLayer(ServerLayer).pipe(\n Effect.mapError((error) =>\n Predicate.isTagged(error, \"TestHttpServerAddressError\")\n ? new OpenApiTestServerAddressError({ address: error.address })\n : new OpenApiTestServerSpecError({ cause: error.cause }),\n ),\n );\n specJson = yield* openApiSpecJsonFromHttpApi(\n options.api,\n server.baseUrl,\n options.transformSpec,\n );\n\n return {\n baseUrl: server.baseUrl,\n specUrl: server.url(specPath),\n specJson,\n httpClientLayer: server.httpClientLayer,\n };\n });\n\nexport class OpenApiHttpApiTestServer extends Context.Service<\n OpenApiHttpApiTestServer,\n OpenApiHttpApiTestServerShape\n>()(\"@executor-js/plugin-openapi/testing/OpenApiHttpApiTestServer\") {\n static readonly layer = (options: OpenApiHttpApiTestServerOptions) =>\n Layer.effect(OpenApiHttpApiTestServer, serveOpenApiHttpApiTestServer(options));\n}\n\nexport const serveMutableOpenApiSpecTestServer = (options: {\n readonly initialApi: HttpApi.Any;\n readonly specPath?: `/${string}`;\n readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;\n}): Effect.Effect<\n MutableOpenApiSpecTestServerShape,\n OpenApiTestServerAddressError | OpenApiTestServerSpecError,\n Scope.Scope\n> =>\n Effect.gen(function* () {\n const specPath = options.specPath ?? \"/spec.json\";\n const specJson = yield* Ref.make(\"\");\n const requests = yield* Ref.make(0);\n const SpecRoute = HttpRouter.addAll([\n HttpRouter.route(\n \"GET\",\n specPath,\n Effect.gen(function* () {\n yield* Ref.update(requests, (count) => count + 1);\n const current = yield* Ref.get(specJson);\n return HttpServerResponse.text(current, {\n status: 200,\n contentType: \"application/json\",\n });\n }),\n ),\n ]);\n const server = yield* serveTestHttpServerLayer(\n HttpRouter.serve(SpecRoute, {\n disableListenLog: true,\n disableLogger: true,\n }),\n ).pipe(\n Effect.mapError((error) =>\n Predicate.isTagged(error, \"TestHttpServerAddressError\")\n ? new OpenApiTestServerAddressError({ address: error.address })\n : new OpenApiTestServerSpecError({ cause: error.cause }),\n ),\n );\n const renderSpec = (api: HttpApi.Any) =>\n openApiSpecJsonFromHttpApi(api, server.baseUrl, options.transformSpec);\n yield* Ref.set(specJson, yield* renderSpec(options.initialApi));\n\n return {\n baseUrl: server.baseUrl,\n specUrl: server.url(specPath),\n specJson: yield* Ref.get(specJson),\n httpClientLayer: server.httpClientLayer,\n setApi: (api) => renderSpec(api).pipe(Effect.flatMap((next) => Ref.set(specJson, next))),\n requestCount: Ref.get(requests),\n };\n });\n\nconst openApiOperationMethods = new Set([\n \"get\",\n \"put\",\n \"post\",\n \"delete\",\n \"options\",\n \"head\",\n \"patch\",\n]);\n\nconst withOAuth2Security =\n (oauth2: NonNullable<OpenApiEchoTestServerOptions[\"oauth2\"]>) =>\n (spec: Record<string, unknown>): Record<string, unknown> => {\n const scopes = oauth2.scopes ?? { read: \"Read test resources\" };\n const security = [{ oauth2: Object.keys(scopes) }];\n const paths = isJsonObject(spec.paths)\n ? Object.fromEntries(\n Object.entries(spec.paths).map(([path, pathItem]) => [\n path,\n isJsonObject(pathItem)\n ? Object.fromEntries(\n Object.entries(pathItem).map(([method, operation]) => [\n method,\n openApiOperationMethods.has(method) && isJsonObject(operation)\n ? { ...operation, security }\n : operation,\n ]),\n )\n : pathItem,\n ]),\n )\n : spec.paths;\n const components = isJsonObject(spec.components) ? spec.components : {};\n const securitySchemes = isJsonObject(components.securitySchemes)\n ? components.securitySchemes\n : {};\n\n return {\n ...spec,\n paths,\n components: {\n ...components,\n securitySchemes: {\n ...securitySchemes,\n oauth2: {\n type: \"oauth2\",\n flows: {\n authorizationCode: {\n authorizationUrl: oauth2.authorizationUrl,\n tokenUrl: oauth2.tokenUrl,\n scopes,\n },\n },\n },\n },\n },\n };\n };\n\nconst composeSpecTransforms =\n (\n ...transforms: readonly (\n | ((spec: Record<string, unknown>) => Record<string, unknown>)\n | undefined\n )[]\n ) =>\n (spec: Record<string, unknown>): Record<string, unknown> =>\n transforms.reduce((current, transform) => (transform ? transform(current) : current), spec);\n\nconst recordOpenApiRequest = (\n requests: Ref.Ref<readonly OpenApiTestRequest[]>,\n request: HttpServerRequest.HttpServerRequest,\n) =>\n Effect.gen(function* () {\n const url = new URL(request.url, \"http://executor.test\");\n const body = yield* request.text.pipe(Effect.catch(() => Effect.succeed(\"\")));\n yield* Ref.update(requests, (all) => [\n ...all,\n {\n method: request.method,\n url: request.url,\n path: url.pathname,\n headers: request.headers,\n body,\n },\n ]);\n return request;\n });\n\nconst captureOpenApiRequest = (requests: Ref.Ref<readonly OpenApiTestRequest[]>) =>\n Effect.gen(function* () {\n const request = yield* HttpServerRequest.HttpServerRequest;\n return yield* recordOpenApiRequest(requests, request);\n });\n\nconst openApiUnauthorizedResponse = (\n options: OpenApiEchoTestServerOptions,\n authorization: string | null,\n): Effect.Effect<HttpServerResponse.HttpServerResponse | null> =>\n options.oauth2?.validateAuthorization\n ? options.oauth2.validateAuthorization(authorization).pipe(\n Effect.map((accepted) =>\n accepted\n ? null\n : HttpServerResponse.jsonUnsafe(\n { error: \"invalid_token\" },\n options.oauth2?.wwwAuthenticate\n ? {\n status: 401,\n headers: {\n \"www-authenticate\": options.oauth2.wwwAuthenticate,\n },\n }\n : { status: 401 },\n ),\n ),\n )\n : Effect.succeed(null);\n\nconst makeOpenApiEchoItemsGroupLive = (\n requests: Ref.Ref<readonly OpenApiTestRequest[]>,\n options: OpenApiEchoTestServerOptions,\n) =>\n HttpApiBuilder.group(OpenApiEchoApi, \"items\", (handlers) =>\n handlers\n .handle(\"listItems\", () =>\n Effect.gen(function* () {\n const request = yield* captureOpenApiRequest(requests);\n const unauthorized = yield* openApiUnauthorizedResponse(\n options,\n request.headers.authorization ?? null,\n );\n if (unauthorized) return unauthorized;\n return [\n OpenApiEchoItem.make({ id: 1, name: \"Widget\" }),\n OpenApiEchoItem.make({ id: 2, name: \"Gadget\" }),\n ];\n }),\n )\n .handle(\"echoHeaders\", () =>\n Effect.gen(function* () {\n const request = yield* captureOpenApiRequest(requests);\n const unauthorized = yield* openApiUnauthorizedResponse(\n options,\n request.headers.authorization ?? null,\n );\n if (unauthorized) return unauthorized;\n return OpenApiEchoHeaders.make({\n authorization: request.headers.authorization,\n \"x-static\": request.headers[\"x-static\"],\n });\n }),\n ),\n );\n\nconst makeOpenApiEchoGroupLive = (\n requests: Ref.Ref<readonly OpenApiTestRequest[]>,\n options: OpenApiEchoTestServerOptions,\n) =>\n HttpApiBuilder.group(OpenApiEchoApi, \"echo\", (handlers) =>\n handlers.handle(\"echoMessage\", ({ params, query }) =>\n Effect.gen(function* () {\n const request = yield* captureOpenApiRequest(requests);\n const unauthorized = yield* openApiUnauthorizedResponse(\n options,\n request.headers.authorization ?? null,\n );\n if (unauthorized) return unauthorized;\n const path = `/echo/${encodeURIComponent(params.message)}`;\n return OpenApiEchoMessage.make({\n message: params.message,\n ...(query.suffix ? { suffix: query.suffix } : {}),\n path,\n });\n }),\n ),\n );\n\nexport const serveOpenApiEchoTestServer = (\n options: OpenApiEchoTestServerOptions = {},\n): Effect.Effect<\n OpenApiEchoTestServerShape,\n OpenApiTestServerAddressError | OpenApiTestServerSpecError,\n Scope.Scope\n> =>\n Effect.gen(function* () {\n const requests = yield* Ref.make<readonly OpenApiTestRequest[]>([]);\n let specJson = \"\";\n const server = yield* serveOpenApiHttpApiTestServer({\n api: OpenApiEchoApi,\n handlersLayer: Layer.mergeAll(\n makeOpenApiEchoItemsGroupLive(requests, options),\n makeOpenApiEchoGroupLive(requests, options),\n ),\n transformSpec: composeSpecTransforms(\n options.oauth2 ? withOAuth2Security(options.oauth2) : undefined,\n options.transformSpec,\n ),\n captureSpecRequest: (request) => recordOpenApiRequest(requests, request).pipe(Effect.asVoid),\n });\n specJson = server.specJson;\n\n return {\n baseUrl: server.baseUrl,\n specUrl: server.specUrl,\n specJson,\n httpClientLayer: server.httpClientLayer,\n requests: Ref.get(requests),\n clearRequests: Ref.set(requests, []),\n };\n });\n\nexport const serveOpenApiEchoTestServerWithOAuth = (\n options: Omit<OpenApiEchoTestServerOptions, \"oauth2\"> & {\n readonly scopes?: Readonly<Record<string, string>>;\n readonly wwwAuthenticate?: string;\n } = {},\n) =>\n Effect.gen(function* () {\n const oauth = yield* OAuthTestServer;\n return yield* serveOpenApiEchoTestServer({\n transformSpec: options.transformSpec,\n oauth2: {\n authorizationUrl: oauth.authorizationEndpoint,\n tokenUrl: oauth.tokenEndpoint,\n scopes: options.scopes,\n validateAuthorization: oauth.acceptsAuthorizationHeader,\n wwwAuthenticate: options.wwwAuthenticate,\n },\n });\n });\n\nexport class OpenApiEchoTestServer extends Context.Service<\n OpenApiEchoTestServer,\n OpenApiEchoTestServerShape\n>()(\"@executor-js/plugin-openapi/testing/OpenApiEchoTestServer\") {\n static readonly layer = (options?: OpenApiEchoTestServerOptions) =>\n Layer.effect(OpenApiEchoTestServer, serveOpenApiEchoTestServer(options));\n\n static readonly layerWithOAuth = (\n options?: Omit<OpenApiEchoTestServerOptions, \"oauth2\"> & {\n readonly scopes?: Readonly<Record<string, string>>;\n readonly wwwAuthenticate?: string;\n },\n ) => Layer.effect(OpenApiEchoTestServer, serveOpenApiEchoTestServerWithOAuth(options));\n}\n\nexport const TestLayers = {\n httpApi: OpenApiHttpApiTestServer.layer,\n echo: OpenApiEchoTestServer.layer,\n echoWithOAuth: OpenApiEchoTestServer.layerWithOAuth,\n};\n\nconst OpenApiTransportEnvelope = Schema.Struct({\n status: Schema.Number,\n headers: Schema.Record(Schema.String, Schema.String),\n data: Schema.Unknown,\n});\n\nconst decodeOpenApiTransportEnvelope = Schema.decodeUnknownOption(OpenApiTransportEnvelope);\n\nexport interface OpenApiInvocationResult<TData = Record<string, unknown> | unknown[] | null> {\n readonly status: number | null;\n readonly headers: Record<string, string> | null;\n readonly data: TData;\n readonly error: unknown;\n}\n\nexport const unwrapInvocation = <TData = Record<string, unknown> | null>(\n raw: unknown,\n): OpenApiInvocationResult<TData> => {\n if (!isToolResult(raw)) {\n return {\n status: null,\n headers: null,\n data: raw as TData,\n error: null,\n };\n }\n if (raw.ok) {\n const inner = raw.data;\n const wrapped = Option.getOrUndefined(decodeOpenApiTransportEnvelope(inner));\n if (wrapped !== undefined) {\n return {\n status: wrapped.status,\n headers: wrapped.headers,\n data: wrapped.data as TData,\n error: null,\n };\n }\n return {\n status: null,\n headers: null,\n data: inner as TData,\n error: null,\n };\n }\n return {\n status: raw.error.status ?? null,\n headers: null,\n data: null as TData,\n error: raw.error.details ?? raw.error,\n };\n};\n"],"mappings":";AAAA,SAAS,SAAS,MAAM,QAAQ,OAAO,QAAQ,WAAW,KAAK,cAAqB;AACpF;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB,gCAAgC;AAC1D;AAAA,EACE;AAAA,EACA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SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO,IAAI,MAAM,WAAW,IAAI;AAAA,EAClC;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/testing/index.ts"],"sourcesContent":["import { Context, Data, Effect, Layer, Predicate, Ref, Schema, Scope } from \"effect\";\nimport {\n HttpClient,\n HttpRouter,\n HttpServerRequest,\n HttpServerResponse,\n} from \"effect/unstable/http\";\nimport {\n HttpApi,\n HttpApiBuilder,\n HttpApiEndpoint,\n HttpApiGroup,\n OpenApi,\n} from \"effect/unstable/httpapi\";\nimport { OAuthTestServer, serveTestHttpServerLayer } from \"@executor-js/sdk/testing\";\nimport {\n AuthTemplateSlug,\n ConnectionName,\n IntegrationSlug,\n ProviderItemId,\n ProviderKey,\n ToolAddress,\n isToolResult,\n type Connection,\n type CreateConnectionInput,\n type Owner,\n type ToolAddress as ToolAddressType,\n} from \"@executor-js/sdk/core\";\nimport type { OpenApiPluginExtension, OpenApiSpecConfig } from \"../sdk/plugin\";\n\nexport class OpenApiTestServerAddressError extends Data.TaggedError(\n \"OpenApiTestServerAddressError\",\n)<{\n readonly address: unknown;\n}> {}\n\nexport class OpenApiTestServerSpecError extends Data.TaggedError(\"OpenApiTestServerSpecError\")<{\n readonly cause: unknown;\n}> {}\n\nexport interface OpenApiTestServerShape {\n readonly baseUrl: string;\n readonly specJson: string;\n readonly httpClientLayer: Layer.Layer<HttpClient.HttpClient, never, never>;\n}\n\nexport interface OpenApiHttpApiTestServerOptions {\n readonly api: HttpApi.Any;\n readonly handlersLayer: Layer.Layer<any, any, any>;\n readonly specPath?: `/${string}`;\n readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;\n readonly captureSpecRequest?: (\n request: HttpServerRequest.HttpServerRequest,\n ) => Effect.Effect<void>;\n readonly guardSpecRequest?: (\n request: HttpServerRequest.HttpServerRequest,\n ) => Effect.Effect<HttpServerResponse.HttpServerResponse | null>;\n}\n\nexport interface OpenApiHttpApiTestServerShape extends OpenApiTestServerShape {\n readonly specUrl: string;\n}\n\nexport interface MutableOpenApiSpecTestServerShape extends OpenApiTestServerShape {\n readonly specUrl: string;\n readonly setApi: (api: HttpApi.Any) => Effect.Effect<void, OpenApiTestServerSpecError>;\n readonly requestCount: Effect.Effect<number>;\n}\n\nexport interface OpenApiTestRequest {\n readonly method: string;\n readonly url: string;\n readonly path: string;\n readonly headers: Readonly<Record<string, string>>;\n readonly body: string;\n}\n\nexport interface OpenApiEchoTestServerOptions {\n readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;\n readonly oauth2?: {\n readonly authorizationUrl: string;\n readonly tokenUrl: string;\n readonly scopes?: Readonly<Record<string, string>>;\n readonly validateAuthorization?: (authorization: string | null) => Effect.Effect<boolean>;\n readonly wwwAuthenticate?: string;\n };\n}\n\nexport interface OpenApiEchoTestServerShape extends OpenApiTestServerShape {\n readonly specUrl: string;\n readonly requests: Effect.Effect<readonly OpenApiTestRequest[]>;\n readonly clearRequests: Effect.Effect<void>;\n}\n\nexport type OpenApiTestSourceOptions = Omit<OpenApiSpecConfig, \"spec\" | \"baseUrl\" | \"slug\"> & {\n readonly baseUrl?: string | null;\n readonly slug?: string;\n};\n\nexport type OpenApiHttpApiTestSourceOptions = Omit<\n OpenApiSpecConfig,\n \"spec\" | \"slug\" | \"baseUrl\"\n> & {\n readonly slug?: string;\n readonly baseUrl?: string | null;\n readonly specBaseUrl?: string;\n readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;\n};\n\ntype OpenApiHttpApiAddSpecHeadersInput = {\n readonly headers?: Record<string, string>;\n readonly queryParams?: Record<string, string>;\n};\n\nexport type OpenApiHttpApiTestAddSpecPayloadOptions = Omit<\n OpenApiHttpApiTestSourceOptions,\n \"headers\" | \"queryParams\"\n> &\n OpenApiHttpApiAddSpecHeadersInput;\n\nexport type OpenApiTestSourceExecutor = {\n readonly openapi: Pick<OpenApiPluginExtension, \"addSpec\">;\n};\n\n// ---------------------------------------------------------------------------\n// v2 connection helper. In v2 a connection IS the credential and tools are\n// produced per-connection — so a test that invokes an openapi tool must\n// (1) addSpec to register the integration and (2) create a connection so the\n// tools are stamped + persisted. This helper does both and returns the\n// invokable address builder.\n// ---------------------------------------------------------------------------\n\nexport type OpenApiTestConnectionExecutor = {\n readonly openapi: Pick<OpenApiPluginExtension, \"addSpec\">;\n readonly connections: {\n readonly create: (input: CreateConnectionInput) => Effect.Effect<Connection, unknown>;\n };\n};\n\nexport interface OpenApiTestConnectionOptions {\n readonly slug?: string;\n readonly owner?: Owner;\n readonly connection?: string;\n readonly template?: string;\n /** Inline credential value. Defaults to a throwaway token via the in-memory\n * provider's `from` path is avoided — pass `value` to store a real secret. */\n readonly value?: string;\n readonly baseUrl?: string | null;\n}\n\nexport interface OpenApiTestConnection {\n readonly slug: string;\n readonly owner: Owner;\n readonly connection: string;\n readonly address: (tool: string) => ToolAddressType;\n}\n\n/** addSpec + connections.create from a raw server spec; returns an address\n * builder for `executor.execute`. */\nexport const addOpenApiTestConnection = (\n executor: OpenApiTestConnectionExecutor,\n server: OpenApiTestServerShape,\n sourceOptions: OpenApiTestSourceOptions,\n connectionOptions: OpenApiTestConnectionOptions = {},\n): Effect.Effect<OpenApiTestConnection, unknown> =>\n Effect.gen(function* () {\n const config = makeOpenApiTestSourceConfig(server, sourceOptions);\n const result = yield* executor.openapi.addSpec(config);\n const slug = String(result.slug);\n const owner: Owner = connectionOptions.owner ?? \"org\";\n const connection = connectionOptions.connection ?? \"main\";\n const template = connectionOptions.template ?? \"apiKey\";\n yield* executor.connections.create({\n owner,\n name: ConnectionName.make(connection),\n integration: IntegrationSlug.make(slug),\n template: AuthTemplateSlug.make(template),\n ...(connectionOptions.value !== undefined\n ? { value: connectionOptions.value }\n : {\n from: {\n provider: ProviderKey.make(\"memory\"),\n id: ProviderItemId.make(`${slug}-token`),\n },\n }),\n } satisfies CreateConnectionInput);\n return {\n slug,\n owner,\n connection,\n address: (tool: string) => ToolAddress.make(`tools.${slug}.${owner}.${connection}.${tool}`),\n };\n });\n\nexport interface OpenApiTestSpecOptions {\n readonly baseUrl?: string;\n readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;\n}\n\nexport const makeOpenApiTestSpecJson = (\n api: HttpApi.Any,\n options: OpenApiTestSpecOptions = {},\n): string => {\n const annotations = OpenApi.annotations({\n ...(options.baseUrl !== undefined ? { servers: [{ url: options.baseUrl }] } : {}),\n transform: options.transformSpec,\n });\n const annotated = (api as HttpApi.AnyWithProps).annotateMerge(annotations);\n return JSON.stringify(OpenApi.fromApi(annotated));\n};\n\nexport const makeOpenApiTestSourceConfig = (\n server: OpenApiTestServerShape,\n options: OpenApiTestSourceOptions,\n): OpenApiSpecConfig => {\n const { baseUrl, slug, ...rest } = options;\n return {\n ...rest,\n spec: { kind: \"blob\", value: server.specJson },\n slug: slug ?? \"test_api\",\n ...(baseUrl === null ? {} : { baseUrl: baseUrl ?? server.baseUrl }),\n } satisfies OpenApiSpecConfig;\n};\n\nexport const addOpenApiTestSource = (\n executor: OpenApiTestSourceExecutor,\n server: OpenApiTestServerShape,\n options: OpenApiTestSourceOptions,\n) => executor.openapi.addSpec(makeOpenApiTestSourceConfig(server, options));\n\nexport const makeOpenApiHttpApiTestSourceConfig = (\n api: HttpApi.Any,\n options: OpenApiHttpApiTestSourceOptions,\n): OpenApiSpecConfig => {\n const { baseUrl, specBaseUrl, transformSpec, slug, ...config } = options;\n return {\n ...config,\n spec: {\n kind: \"blob\",\n value: makeOpenApiTestSpecJson(api, { baseUrl: specBaseUrl, transformSpec }),\n },\n slug: slug ?? \"test_api\",\n ...(baseUrl === null ? {} : { baseUrl: baseUrl ?? specBaseUrl ?? \"https://api.example.test\" }),\n } satisfies OpenApiSpecConfig;\n};\n\nexport const addOpenApiHttpApiTestSource = (\n executor: OpenApiTestSourceExecutor,\n api: HttpApi.Any,\n options: OpenApiHttpApiTestSourceOptions,\n) => executor.openapi.addSpec(makeOpenApiHttpApiTestSourceConfig(api, options));\n\nexport const makeOpenApiHttpApiTestAddSpecPayload = (\n api: HttpApi.Any,\n options: OpenApiHttpApiTestAddSpecPayloadOptions,\n) => {\n const { headers, queryParams, ...sourceOptions } = options;\n const config = makeOpenApiHttpApiTestSourceConfig(api, sourceOptions);\n return {\n spec: config.spec,\n slug: config.slug,\n baseUrl: config.baseUrl,\n ...(headers !== undefined ? { headers } : {}),\n ...(queryParams !== undefined ? { queryParams } : {}),\n ...(config.authenticationTemplate !== undefined\n ? { authenticationTemplate: config.authenticationTemplate }\n : {}),\n };\n};\n\nexport const makeOpenApiHttpApiTestSpecPayload = (\n api: HttpApi.Any,\n options: OpenApiTestSpecOptions = {},\n) => ({\n spec: makeOpenApiTestSpecJson(api, options),\n});\n\nconst isJsonObject = (value: unknown): value is Readonly<Record<string, unknown>> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst OpenApiEchoItem = Schema.Struct({\n id: Schema.Number,\n name: Schema.String,\n});\n\nconst OpenApiEchoHeaders = Schema.Struct({\n authorization: Schema.optional(Schema.String),\n \"x-static\": Schema.optional(Schema.String),\n});\n\nconst OpenApiEchoMessage = Schema.Struct({\n message: Schema.String,\n suffix: Schema.optional(Schema.String),\n path: Schema.String,\n});\n\nconst OpenApiEchoItemsGroup = HttpApiGroup.make(\"items\")\n .add(\n HttpApiEndpoint.get(\"listItems\", \"/items\", {\n success: Schema.Array(OpenApiEchoItem),\n }),\n )\n .add(\n HttpApiEndpoint.get(\"echoHeaders\", \"/echo-headers\", {\n success: OpenApiEchoHeaders,\n }),\n );\n\nconst OpenApiEchoGroup = HttpApiGroup.make(\"echo\").add(\n HttpApiEndpoint.get(\"echoMessage\", \"/echo/:message\", {\n params: Schema.Struct({ message: Schema.String }),\n query: Schema.Struct({ suffix: Schema.optional(Schema.String) }),\n success: OpenApiEchoMessage,\n }),\n);\n\nconst OpenApiEchoApi = HttpApi.make(\"executorOpenApiTest\")\n .add(OpenApiEchoItemsGroup)\n .add(OpenApiEchoGroup)\n .annotateMerge(\n OpenApi.annotations({\n title: \"Executor OpenAPI Test Server\",\n version: \"1.0.0\",\n }),\n );\n\nconst openApiSpecJsonFromHttpApi = (\n api: HttpApi.Any,\n baseUrl: string,\n transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>,\n): Effect.Effect<string, OpenApiTestServerSpecError> =>\n Effect.try({\n try: () => makeOpenApiTestSpecJson(api, { baseUrl, transformSpec }),\n catch: (cause) => new OpenApiTestServerSpecError({ cause }),\n });\n\nexport const serveOpenApiHttpApiTestServer = (\n options: OpenApiHttpApiTestServerOptions,\n): Effect.Effect<\n OpenApiHttpApiTestServerShape,\n OpenApiTestServerAddressError | OpenApiTestServerSpecError,\n Scope.Scope\n> =>\n Effect.gen(function* () {\n const specPath = options.specPath ?? \"/spec.json\";\n let specJson = \"\";\n const SpecRoute = HttpRouter.addAll([\n HttpRouter.route(\n \"GET\",\n specPath,\n Effect.gen(function* () {\n const request = yield* HttpServerRequest.HttpServerRequest;\n if (options.captureSpecRequest) {\n yield* options.captureSpecRequest(request);\n }\n const guardResponse = options.guardSpecRequest\n ? yield* options.guardSpecRequest(request)\n : null;\n if (guardResponse) return guardResponse;\n return HttpServerResponse.text(specJson, {\n status: 200,\n contentType: \"application/json\",\n });\n }),\n ),\n ]);\n const ApiLive = HttpApiBuilder.layer(options.api as HttpApi.AnyWithProps).pipe(\n Layer.provide(options.handlersLayer),\n );\n const ServerLayer = HttpRouter.serve(Layer.mergeAll(ApiLive, SpecRoute), {\n disableListenLog: true,\n disableLogger: true,\n });\n const server = yield* serveTestHttpServerLayer(ServerLayer).pipe(\n Effect.mapError((error) =>\n Predicate.isTagged(error, \"TestHttpServerAddressError\")\n ? new OpenApiTestServerAddressError({ address: error.address })\n : new OpenApiTestServerSpecError({ cause: error.cause }),\n ),\n );\n specJson = yield* openApiSpecJsonFromHttpApi(\n options.api,\n server.baseUrl,\n options.transformSpec,\n );\n\n return {\n baseUrl: server.baseUrl,\n specUrl: server.url(specPath),\n specJson,\n httpClientLayer: server.httpClientLayer,\n };\n });\n\nexport class OpenApiHttpApiTestServer extends Context.Service<\n OpenApiHttpApiTestServer,\n OpenApiHttpApiTestServerShape\n>()(\"@executor-js/plugin-openapi/testing/OpenApiHttpApiTestServer\") {\n static readonly layer = (options: OpenApiHttpApiTestServerOptions) =>\n Layer.effect(OpenApiHttpApiTestServer, serveOpenApiHttpApiTestServer(options));\n}\n\nexport const serveMutableOpenApiSpecTestServer = (options: {\n readonly initialApi: HttpApi.Any;\n readonly specPath?: `/${string}`;\n readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;\n}): Effect.Effect<\n MutableOpenApiSpecTestServerShape,\n OpenApiTestServerAddressError | OpenApiTestServerSpecError,\n Scope.Scope\n> =>\n Effect.gen(function* () {\n const specPath = options.specPath ?? \"/spec.json\";\n const specJson = yield* Ref.make(\"\");\n const requests = yield* Ref.make(0);\n const SpecRoute = HttpRouter.addAll([\n HttpRouter.route(\n \"GET\",\n specPath,\n Effect.gen(function* () {\n yield* Ref.update(requests, (count) => count + 1);\n const current = yield* Ref.get(specJson);\n return HttpServerResponse.text(current, {\n status: 200,\n contentType: \"application/json\",\n });\n }),\n ),\n ]);\n const server = yield* serveTestHttpServerLayer(\n HttpRouter.serve(SpecRoute, {\n disableListenLog: true,\n disableLogger: true,\n }),\n ).pipe(\n Effect.mapError((error) =>\n Predicate.isTagged(error, \"TestHttpServerAddressError\")\n ? new OpenApiTestServerAddressError({ address: error.address })\n : new OpenApiTestServerSpecError({ cause: error.cause }),\n ),\n );\n const renderSpec = (api: HttpApi.Any) =>\n openApiSpecJsonFromHttpApi(api, server.baseUrl, options.transformSpec);\n yield* Ref.set(specJson, yield* renderSpec(options.initialApi));\n\n return {\n baseUrl: server.baseUrl,\n specUrl: server.url(specPath),\n specJson: yield* Ref.get(specJson),\n httpClientLayer: server.httpClientLayer,\n setApi: (api) => renderSpec(api).pipe(Effect.flatMap((next) => Ref.set(specJson, next))),\n requestCount: Ref.get(requests),\n };\n });\n\nconst openApiOperationMethods = new Set([\n \"get\",\n \"put\",\n \"post\",\n \"delete\",\n \"options\",\n \"head\",\n \"patch\",\n]);\n\nconst withOAuth2Security =\n (oauth2: NonNullable<OpenApiEchoTestServerOptions[\"oauth2\"]>) =>\n (spec: Record<string, unknown>): Record<string, unknown> => {\n const scopes = oauth2.scopes ?? { read: \"Read test resources\" };\n const security = [{ oauth2: Object.keys(scopes) }];\n const paths = isJsonObject(spec.paths)\n ? Object.fromEntries(\n Object.entries(spec.paths).map(([path, pathItem]) => [\n path,\n isJsonObject(pathItem)\n ? Object.fromEntries(\n Object.entries(pathItem).map(([method, operation]) => [\n method,\n openApiOperationMethods.has(method) && isJsonObject(operation)\n ? { ...operation, security }\n : operation,\n ]),\n )\n : pathItem,\n ]),\n )\n : spec.paths;\n const components = isJsonObject(spec.components) ? spec.components : {};\n const securitySchemes = isJsonObject(components.securitySchemes)\n ? components.securitySchemes\n : {};\n\n return {\n ...spec,\n paths,\n components: {\n ...components,\n securitySchemes: {\n ...securitySchemes,\n oauth2: {\n type: \"oauth2\",\n flows: {\n authorizationCode: {\n authorizationUrl: oauth2.authorizationUrl,\n tokenUrl: oauth2.tokenUrl,\n scopes,\n },\n },\n },\n },\n },\n };\n };\n\nconst composeSpecTransforms =\n (\n ...transforms: readonly (\n | ((spec: Record<string, unknown>) => Record<string, unknown>)\n | undefined\n )[]\n ) =>\n (spec: Record<string, unknown>): Record<string, unknown> =>\n transforms.reduce((current, transform) => (transform ? transform(current) : current), spec);\n\nconst recordOpenApiRequest = (\n requests: Ref.Ref<readonly OpenApiTestRequest[]>,\n request: HttpServerRequest.HttpServerRequest,\n) =>\n Effect.gen(function* () {\n const url = new URL(request.url, \"http://executor.test\");\n const body = yield* request.text.pipe(Effect.catch(() => Effect.succeed(\"\")));\n yield* Ref.update(requests, (all) => [\n ...all,\n {\n method: request.method,\n url: request.url,\n path: url.pathname,\n headers: request.headers,\n body,\n },\n ]);\n return request;\n });\n\nconst captureOpenApiRequest = (requests: Ref.Ref<readonly OpenApiTestRequest[]>) =>\n Effect.gen(function* () {\n const request = yield* HttpServerRequest.HttpServerRequest;\n return yield* recordOpenApiRequest(requests, request);\n });\n\nconst openApiUnauthorizedResponse = (\n options: OpenApiEchoTestServerOptions,\n authorization: string | null,\n): Effect.Effect<HttpServerResponse.HttpServerResponse | null> =>\n options.oauth2?.validateAuthorization\n ? options.oauth2.validateAuthorization(authorization).pipe(\n Effect.map((accepted) =>\n accepted\n ? null\n : HttpServerResponse.jsonUnsafe(\n { error: \"invalid_token\" },\n options.oauth2?.wwwAuthenticate\n ? {\n status: 401,\n headers: {\n \"www-authenticate\": options.oauth2.wwwAuthenticate,\n },\n }\n : { status: 401 },\n ),\n ),\n )\n : Effect.succeed(null);\n\nconst makeOpenApiEchoItemsGroupLive = (\n requests: Ref.Ref<readonly OpenApiTestRequest[]>,\n options: OpenApiEchoTestServerOptions,\n) =>\n HttpApiBuilder.group(OpenApiEchoApi, \"items\", (handlers) =>\n handlers\n .handle(\"listItems\", () =>\n Effect.gen(function* () {\n const request = yield* captureOpenApiRequest(requests);\n const unauthorized = yield* openApiUnauthorizedResponse(\n options,\n request.headers.authorization ?? null,\n );\n if (unauthorized) return unauthorized;\n return [\n OpenApiEchoItem.make({ id: 1, name: \"Widget\" }),\n OpenApiEchoItem.make({ id: 2, name: \"Gadget\" }),\n ];\n }),\n )\n .handle(\"echoHeaders\", () =>\n Effect.gen(function* () {\n const request = yield* captureOpenApiRequest(requests);\n const unauthorized = yield* openApiUnauthorizedResponse(\n options,\n request.headers.authorization ?? null,\n );\n if (unauthorized) return unauthorized;\n return OpenApiEchoHeaders.make({\n authorization: request.headers.authorization,\n \"x-static\": request.headers[\"x-static\"],\n });\n }),\n ),\n );\n\nconst makeOpenApiEchoGroupLive = (\n requests: Ref.Ref<readonly OpenApiTestRequest[]>,\n options: OpenApiEchoTestServerOptions,\n) =>\n HttpApiBuilder.group(OpenApiEchoApi, \"echo\", (handlers) =>\n handlers.handle(\"echoMessage\", ({ params, query }) =>\n Effect.gen(function* () {\n const request = yield* captureOpenApiRequest(requests);\n const unauthorized = yield* openApiUnauthorizedResponse(\n options,\n request.headers.authorization ?? null,\n );\n if (unauthorized) return unauthorized;\n const path = `/echo/${encodeURIComponent(params.message)}`;\n return OpenApiEchoMessage.make({\n message: params.message,\n ...(query.suffix ? { suffix: query.suffix } : {}),\n path,\n });\n }),\n ),\n );\n\nexport const serveOpenApiEchoTestServer = (\n options: OpenApiEchoTestServerOptions = {},\n): Effect.Effect<\n OpenApiEchoTestServerShape,\n OpenApiTestServerAddressError | OpenApiTestServerSpecError,\n Scope.Scope\n> =>\n Effect.gen(function* () {\n const requests = yield* Ref.make<readonly OpenApiTestRequest[]>([]);\n let specJson = \"\";\n const server = yield* serveOpenApiHttpApiTestServer({\n api: OpenApiEchoApi,\n handlersLayer: Layer.mergeAll(\n makeOpenApiEchoItemsGroupLive(requests, options),\n makeOpenApiEchoGroupLive(requests, options),\n ),\n transformSpec: composeSpecTransforms(\n options.oauth2 ? withOAuth2Security(options.oauth2) : undefined,\n options.transformSpec,\n ),\n captureSpecRequest: (request) => recordOpenApiRequest(requests, request).pipe(Effect.asVoid),\n });\n specJson = server.specJson;\n\n return {\n baseUrl: server.baseUrl,\n specUrl: server.specUrl,\n specJson,\n httpClientLayer: server.httpClientLayer,\n requests: Ref.get(requests),\n clearRequests: Ref.set(requests, []),\n };\n });\n\nexport const serveOpenApiEchoTestServerWithOAuth = (\n options: Omit<OpenApiEchoTestServerOptions, \"oauth2\"> & {\n readonly scopes?: Readonly<Record<string, string>>;\n readonly wwwAuthenticate?: string;\n } = {},\n) =>\n Effect.gen(function* () {\n const oauth = yield* OAuthTestServer;\n return yield* serveOpenApiEchoTestServer({\n transformSpec: options.transformSpec,\n oauth2: {\n authorizationUrl: oauth.authorizationEndpoint,\n tokenUrl: oauth.tokenEndpoint,\n scopes: options.scopes,\n validateAuthorization: oauth.acceptsAuthorizationHeader,\n wwwAuthenticate: options.wwwAuthenticate,\n },\n });\n });\n\nexport class OpenApiEchoTestServer extends Context.Service<\n OpenApiEchoTestServer,\n OpenApiEchoTestServerShape\n>()(\"@executor-js/plugin-openapi/testing/OpenApiEchoTestServer\") {\n static readonly layer = (options?: OpenApiEchoTestServerOptions) =>\n Layer.effect(OpenApiEchoTestServer, serveOpenApiEchoTestServer(options));\n\n static readonly layerWithOAuth = (\n options?: Omit<OpenApiEchoTestServerOptions, \"oauth2\"> & {\n readonly scopes?: Readonly<Record<string, string>>;\n readonly wwwAuthenticate?: string;\n },\n ) => Layer.effect(OpenApiEchoTestServer, serveOpenApiEchoTestServerWithOAuth(options));\n}\n\nexport const TestLayers = {\n httpApi: OpenApiHttpApiTestServer.layer,\n echo: OpenApiEchoTestServer.layer,\n echoWithOAuth: OpenApiEchoTestServer.layerWithOAuth,\n};\n\nexport interface OpenApiInvocationResult<TData = Record<string, unknown> | unknown[] | null> {\n readonly status: number | null;\n readonly headers: Record<string, string> | null;\n readonly data: TData;\n readonly error: unknown;\n}\n\nexport const unwrapInvocation = <TData = Record<string, unknown> | null>(\n raw: unknown,\n): OpenApiInvocationResult<TData> => {\n if (!isToolResult(raw)) {\n return {\n status: null,\n headers: null,\n data: raw as TData,\n error: null,\n };\n }\n if (raw.ok) {\n // Payload-first: `data` is the upstream body; transport status/headers\n // ride in the `http` side channel.\n return {\n status: raw.http?.status ?? null,\n headers: raw.http?.headers ?? null,\n data: raw.data as TData,\n error: null,\n };\n }\n return {\n status: raw.error.status ?? null,\n headers: null,\n data: null as TData,\n error: raw.error.details ?? raw.error,\n };\n};\n"],"mappings":";AAAA,SAAS,SAAS,MAAM,QAAQ,OAAO,WAAW,KAAK,cAAqB;AAC5E;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB,gCAAgC;AAC1D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AA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,MAChB,uBAAuB,MAAM;AAAA,MAC7B,iBAAiB,QAAQ;AAAA,IAC3B;AAAA,EACF,CAAC;AACH,CAAC;AAEI,IAAM,wBAAN,MAAM,+BAA8B,QAAQ,QAGjD,EAAE,2DAA2D,EAAE;AAAA,EAC/D,OAAgB,QAAQ,CAAC,YACvB,MAAM,OAAO,wBAAuB,2BAA2B,OAAO,CAAC;AAAA,EAEzE,OAAgB,iBAAiB,CAC/B,YAIG,MAAM,OAAO,wBAAuB,oCAAoC,OAAO,CAAC;AACvF;AAEO,IAAM,aAAa;AAAA,EACxB,SAAS,yBAAyB;AAAA,EAClC,MAAM,sBAAsB;AAAA,EAC5B,eAAe,sBAAsB;AACvC;AASO,IAAM,mBAAmB,CAC9B,QACmC;AACnC,MAAI,CAAC,aAAa,GAAG,GAAG;AACtB,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,EACF;AACA,MAAI,IAAI,IAAI;AAGV,WAAO;AAAA,MACL,QAAQ,IAAI,MAAM,UAAU;AAAA,MAC5B,SAAS,IAAI,MAAM,WAAW;AAAA,MAC9B,MAAM,IAAI;AAAA,MACV,OAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AAAA,IACL,QAAQ,IAAI,MAAM,UAAU;AAAA,IAC5B,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO,IAAI,MAAM,WAAW,IAAI;AAAA,EAClC;AACF;","names":[]}
|
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.7",
|
|
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.7",
|
|
57
|
+
"@executor-js/sdk": "1.5.7",
|
|
58
58
|
"lucide-react": "^1.7.0",
|
|
59
59
|
"openapi-types": "^12.1.3",
|
|
60
60
|
"yaml": "^2.7.1"
|