@executor-js/plugin-openapi 1.4.33 → 1.5.0
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 +893 -0
- package/dist/AddOpenApiSource-7M52SRUX.js.map +1 -0
- package/dist/EditOpenApiSource-WTAMRJUK.js +68 -0
- package/dist/EditOpenApiSource-WTAMRJUK.js.map +1 -0
- package/dist/OpenApiAccountsPanel-3VJJXNQF.js +112 -0
- package/dist/OpenApiAccountsPanel-3VJJXNQF.js.map +1 -0
- package/dist/api/group.d.ts +104 -225
- package/dist/api/index.d.ts +127 -271
- package/dist/{chunk-BB5IAKRG.js → chunk-AQ7JDDRM.js} +12 -2
- package/dist/chunk-AQ7JDDRM.js.map +1 -0
- package/dist/chunk-BSLE6HCE.js +181 -0
- package/dist/chunk-BSLE6HCE.js.map +1 -0
- package/dist/chunk-MZWZQ24W.js +226 -0
- package/dist/chunk-MZWZQ24W.js.map +1 -0
- package/dist/chunk-OSIFYIQP.js +623 -0
- package/dist/chunk-OSIFYIQP.js.map +1 -0
- package/dist/chunk-QSSRVK6M.js +139 -0
- package/dist/chunk-QSSRVK6M.js.map +1 -0
- package/dist/chunk-V7VCHYOY.js +1544 -0
- package/dist/chunk-V7VCHYOY.js.map +1 -0
- package/dist/{chunk-AN4HJFNP.js → chunk-YVRI7KRC.js} +162 -186
- package/dist/chunk-YVRI7KRC.js.map +1 -0
- package/dist/client.js +9 -8
- package/dist/client.js.map +1 -1
- package/dist/core.js +28 -11
- package/dist/index.js +11 -4
- package/dist/react/AddOpenApiSource.d.ts +2 -13
- package/dist/react/GoogleProductPicker.d.ts +9 -0
- package/dist/react/OpenApiAccountsPanel.d.ts +6 -0
- package/dist/react/OpenApiSourceDetailsFields.d.ts +3 -2
- package/dist/react/atoms.d.ts +177 -192
- package/dist/react/auth-method-config.d.ts +15 -0
- package/dist/react/client.d.ts +103 -224
- package/dist/react/index.d.ts +2 -2
- package/dist/react/source-plugin.d.ts +2 -2
- package/dist/sdk/config.d.ts +75 -0
- package/dist/sdk/configure.test.d.ts +1 -0
- package/dist/sdk/describe-auth-methods.test.d.ts +1 -0
- package/dist/sdk/errors.d.ts +4 -6
- package/dist/sdk/extract.d.ts +7 -5
- package/dist/sdk/google-bundle.test.d.ts +1 -0
- package/dist/sdk/google-discovery.d.ts +43 -0
- package/dist/sdk/google-discovery.test.d.ts +1 -0
- package/dist/sdk/google-oauth-batches.d.ts +13 -0
- package/dist/sdk/google-oauth-batches.test.d.ts +1 -0
- package/dist/sdk/google-oauth-scopes.d.ts +3 -0
- package/dist/sdk/google-oauth-scopes.test.d.ts +1 -0
- package/dist/sdk/google-presets.d.ts +16 -0
- package/dist/sdk/google-presets.test.d.ts +1 -0
- package/dist/sdk/google-product-picker-scopes.test.d.ts +1 -0
- package/dist/sdk/index.d.ts +7 -5
- package/dist/sdk/invoke.d.ts +6 -9
- package/dist/sdk/openapi-utils.d.ts +1 -0
- package/dist/sdk/plugin.d.ts +74 -231
- package/dist/sdk/presets.d.ts +2 -1
- package/dist/sdk/preview.d.ts +20 -15
- package/dist/sdk/query-serialization.test.d.ts +1 -0
- package/dist/sdk/store.d.ts +14 -41
- package/dist/sdk/types.d.ts +23 -51
- package/dist/testing/index.d.ts +49 -38
- package/dist/testing.js +46 -18
- package/dist/testing.js.map +1 -1
- package/package.json +6 -4
- package/dist/AddOpenApiSource-NSCULGTM.js +0 -19
- package/dist/AddOpenApiSource-NSCULGTM.js.map +0 -1
- package/dist/EditOpenApiSource-MV7NYTRP.js +0 -774
- package/dist/EditOpenApiSource-MV7NYTRP.js.map +0 -1
- package/dist/OpenApiSourceSummary-7JBS7PUV.js +0 -122
- package/dist/OpenApiSourceSummary-7JBS7PUV.js.map +0 -1
- package/dist/chunk-2ZKKZYZH.js +0 -1181
- package/dist/chunk-2ZKKZYZH.js.map +0 -1
- package/dist/chunk-AN4HJFNP.js.map +0 -1
- package/dist/chunk-BB5IAKRG.js.map +0 -1
- package/dist/chunk-PRVJDE43.js +0 -2101
- package/dist/chunk-PRVJDE43.js.map +0 -1
- package/dist/chunk-X5JX3KTA.js +0 -201
- package/dist/chunk-X5JX3KTA.js.map +0 -1
- package/dist/react/OpenApiSourceSummary.d.ts +0 -5
- package/dist/sdk/credential-status.d.ts +0 -23
- package/dist/sdk/source-contracts.d.ts +0 -55
- /package/dist/{sdk/credential-status.test.d.ts → react/auth-method-config.test.d.ts} +0 -0
package/dist/sdk/store.d.ts
CHANGED
|
@@ -1,48 +1,21 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { type StorageDeps, type StorageFailure } from "@executor-js/sdk/core";
|
|
3
|
-
import {
|
|
4
|
-
export { StoredSourceSchema, type StoredSourceSchemaType, headerBindingSlot, oauth2ClientIdSlot, oauth2ClientSecretSlot, oauth2ConnectionSlot, queryParamBindingSlot, } from "./source-contracts";
|
|
5
|
-
export declare const openapiSchema: {};
|
|
6
|
-
export type OpenapiSchema = typeof openapiSchema;
|
|
7
|
-
export interface SourceConfig {
|
|
8
|
-
readonly spec: string;
|
|
9
|
-
readonly sourceUrl?: string;
|
|
10
|
-
readonly baseUrl?: string;
|
|
11
|
-
readonly namespace?: string;
|
|
12
|
-
readonly headers?: Record<string, ConfiguredHeaderValue>;
|
|
13
|
-
readonly queryParams?: Record<string, ConfiguredHeaderValue>;
|
|
14
|
-
readonly specFetchCredentials?: OpenApiSpecFetchCredentials;
|
|
15
|
-
readonly oauth2?: OAuth2SourceConfig;
|
|
16
|
-
}
|
|
17
|
-
export interface OpenApiSpecFetchCredentials {
|
|
18
|
-
readonly headers?: Record<string, ConfiguredHeaderValue>;
|
|
19
|
-
readonly queryParams?: Record<string, ConfiguredHeaderValue>;
|
|
20
|
-
}
|
|
21
|
-
export interface StoredSource {
|
|
22
|
-
readonly namespace: string;
|
|
23
|
-
readonly scope: string;
|
|
24
|
-
readonly name: string;
|
|
25
|
-
readonly config: SourceConfig;
|
|
26
|
-
}
|
|
3
|
+
import { OperationBinding } from "./types";
|
|
27
4
|
export interface StoredOperation {
|
|
28
|
-
|
|
29
|
-
readonly
|
|
5
|
+
/** The integration slug this operation belongs to. */
|
|
6
|
+
readonly integration: string;
|
|
7
|
+
/** The tool name (the `<tool>` address segment) this operation backs. */
|
|
8
|
+
readonly toolName: string;
|
|
30
9
|
readonly binding: OperationBinding;
|
|
31
10
|
}
|
|
32
11
|
export interface OpenapiStore {
|
|
33
|
-
|
|
34
|
-
readonly
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}) => Effect.Effect<void, StorageFailure>;
|
|
42
|
-
readonly getSource: (namespace: string, scope: string) => Effect.Effect<StoredSource | null, StorageFailure>;
|
|
43
|
-
readonly listSources: () => Effect.Effect<readonly StoredSource[], StorageFailure>;
|
|
44
|
-
readonly getOperationByToolId: (toolId: string, scope: string) => Effect.Effect<StoredOperation | null, StorageFailure>;
|
|
45
|
-
readonly listOperationsBySource: (sourceId: string, scope: string) => Effect.Effect<readonly StoredOperation[], StorageFailure>;
|
|
46
|
-
readonly removeSource: (namespace: string, scope: string) => Effect.Effect<void, StorageFailure>;
|
|
12
|
+
/** Replace all stored operations for an integration. */
|
|
13
|
+
readonly putOperations: (integration: string, operations: readonly StoredOperation[]) => Effect.Effect<void, StorageFailure>;
|
|
14
|
+
/** Look up one operation by integration + tool name. */
|
|
15
|
+
readonly getOperation: (integration: string, toolName: string) => Effect.Effect<StoredOperation | null, StorageFailure>;
|
|
16
|
+
/** List every stored operation for an integration. */
|
|
17
|
+
readonly listOperations: (integration: string) => Effect.Effect<readonly StoredOperation[], StorageFailure>;
|
|
18
|
+
/** Drop all stored operations for an integration. */
|
|
19
|
+
readonly removeOperations: (integration: string) => Effect.Effect<void, StorageFailure>;
|
|
47
20
|
}
|
|
48
|
-
export declare const makeDefaultOpenapiStore: ({ pluginStorage
|
|
21
|
+
export declare const makeDefaultOpenapiStore: ({ pluginStorage }: StorageDeps) => OpenapiStore;
|
package/dist/sdk/types.d.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
readonly
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
import type { AuthTemplateSlug } from "@executor-js/sdk/shared";
|
|
3
|
+
import type { OAuthAuthentication } from "@executor-js/sdk/shared";
|
|
4
|
+
export type AuthenticationVariable = {
|
|
5
|
+
readonly type: "variable";
|
|
6
|
+
readonly name: string;
|
|
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
|
+
};
|
|
19
|
+
export type Authentication = OAuthAuthentication | APIKeyAuthentication;
|
|
18
20
|
export declare const OperationId: Schema.brand<Schema.String, "OperationId">;
|
|
19
21
|
export type OperationId = typeof OperationId.Type;
|
|
20
22
|
export declare const HttpMethod: Schema.Literals<readonly ["get", "put", "post", "delete", "patch", "head", "options", "trace"]>;
|
|
@@ -84,7 +86,9 @@ export declare const OperationRequestBody: Schema.Struct<{
|
|
|
84
86
|
export type OperationRequestBody = typeof OperationRequestBody.Type;
|
|
85
87
|
export declare const ExtractedOperation: Schema.Struct<{
|
|
86
88
|
readonly operationId: Schema.brand<Schema.String, "OperationId">;
|
|
89
|
+
readonly toolPath: Schema.OptionFromOptional<Schema.String>;
|
|
87
90
|
readonly method: Schema.Literals<readonly ["get", "put", "post", "delete", "patch", "head", "options", "trace"]>;
|
|
91
|
+
readonly baseUrl: Schema.optional<Schema.String>;
|
|
88
92
|
readonly pathTemplate: Schema.String;
|
|
89
93
|
readonly summary: Schema.OptionFromOptional<Schema.String>;
|
|
90
94
|
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
@@ -156,7 +160,9 @@ export declare const ExtractionResult: Schema.Struct<{
|
|
|
156
160
|
}>>;
|
|
157
161
|
readonly operations: Schema.$Array<Schema.Struct<{
|
|
158
162
|
readonly operationId: Schema.brand<Schema.String, "OperationId">;
|
|
163
|
+
readonly toolPath: Schema.OptionFromOptional<Schema.String>;
|
|
159
164
|
readonly method: Schema.Literals<readonly ["get", "put", "post", "delete", "patch", "head", "options", "trace"]>;
|
|
165
|
+
readonly baseUrl: Schema.optional<Schema.String>;
|
|
160
166
|
readonly pathTemplate: Schema.String;
|
|
161
167
|
readonly summary: Schema.OptionFromOptional<Schema.String>;
|
|
162
168
|
readonly description: Schema.OptionFromOptional<Schema.String>;
|
|
@@ -201,6 +207,7 @@ export declare const ExtractionResult: Schema.Struct<{
|
|
|
201
207
|
export type ExtractionResult = typeof ExtractionResult.Type;
|
|
202
208
|
export declare const OperationBinding: Schema.Struct<{
|
|
203
209
|
readonly method: Schema.Literals<readonly ["get", "put", "post", "delete", "patch", "head", "options", "trace"]>;
|
|
210
|
+
readonly baseUrl: Schema.optional<Schema.String>;
|
|
204
211
|
readonly pathTemplate: Schema.String;
|
|
205
212
|
readonly parameters: Schema.$Array<Schema.Struct<{
|
|
206
213
|
readonly name: Schema.String;
|
|
@@ -236,41 +243,6 @@ export declare const OperationBinding: Schema.Struct<{
|
|
|
236
243
|
}>>;
|
|
237
244
|
}>;
|
|
238
245
|
export type OperationBinding = typeof OperationBinding.Type;
|
|
239
|
-
/**
|
|
240
|
-
* A header value — either a static string or a reference to a secret.
|
|
241
|
-
* Stored as JSON-serializable data.
|
|
242
|
-
*/
|
|
243
|
-
export declare const HeaderValue: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
244
|
-
readonly secretId: Schema.String;
|
|
245
|
-
readonly prefix: Schema.optional<Schema.String>;
|
|
246
|
-
}>]>;
|
|
247
|
-
export type HeaderValue = typeof HeaderValue.Type;
|
|
248
|
-
export declare const ConfiguredHeaderBinding: Schema.Struct<{
|
|
249
|
-
readonly kind: Schema.Literal<"binding">;
|
|
250
|
-
readonly slot: Schema.String;
|
|
251
|
-
readonly prefix: Schema.optional<Schema.String>;
|
|
252
|
-
}>;
|
|
253
|
-
export type ConfiguredHeaderBinding = typeof ConfiguredHeaderBinding.Type;
|
|
254
|
-
export declare const ConfiguredHeaderValue: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
255
|
-
readonly kind: Schema.Literal<"binding">;
|
|
256
|
-
readonly slot: Schema.String;
|
|
257
|
-
readonly prefix: Schema.optional<Schema.String>;
|
|
258
|
-
}>]>;
|
|
259
|
-
export type ConfiguredHeaderValue = typeof ConfiguredHeaderValue.Type;
|
|
260
|
-
export declare const OpenApiCredentialInput: Schema.Union<readonly [Schema.Struct<{
|
|
261
|
-
readonly secretId: Schema.String;
|
|
262
|
-
readonly prefix: Schema.optional<Schema.String>;
|
|
263
|
-
readonly targetScope: Schema.brand<Schema.String, "ScopeId">;
|
|
264
|
-
readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
265
|
-
}>, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
266
|
-
readonly secretId: Schema.String;
|
|
267
|
-
readonly prefix: Schema.optional<Schema.String>;
|
|
268
|
-
}>]>, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
269
|
-
readonly kind: Schema.Literal<"binding">;
|
|
270
|
-
readonly slot: Schema.String;
|
|
271
|
-
readonly prefix: Schema.optional<Schema.String>;
|
|
272
|
-
}>]>]>;
|
|
273
|
-
export type OpenApiCredentialInput = typeof OpenApiCredentialInput.Type;
|
|
274
246
|
export declare const InvocationResult: Schema.Struct<{
|
|
275
247
|
readonly status: Schema.Number;
|
|
276
248
|
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Context, Effect, Layer, Scope } from "effect";
|
|
|
2
2
|
import { HttpClient, HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
|
3
3
|
import { HttpApi } from "effect/unstable/httpapi";
|
|
4
4
|
import { OAuthTestServer } from "@executor-js/sdk/testing";
|
|
5
|
+
import { IntegrationSlug, type Connection, type CreateConnectionInput, type Owner, type ToolAddress as ToolAddressType } from "@executor-js/sdk/core";
|
|
5
6
|
import type { OpenApiPluginExtension, OpenApiSpecConfig } from "../sdk/plugin";
|
|
6
7
|
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 & {
|
|
7
8
|
readonly _tag: "OpenApiTestServerAddressError";
|
|
@@ -60,32 +61,49 @@ export interface OpenApiEchoTestServerShape extends OpenApiTestServerShape {
|
|
|
60
61
|
readonly requests: Effect.Effect<readonly OpenApiTestRequest[]>;
|
|
61
62
|
readonly clearRequests: Effect.Effect<void>;
|
|
62
63
|
}
|
|
63
|
-
export type OpenApiTestSourceOptions = Omit<OpenApiSpecConfig, "spec" | "baseUrl" | "
|
|
64
|
+
export type OpenApiTestSourceOptions = Omit<OpenApiSpecConfig, "spec" | "baseUrl" | "slug"> & {
|
|
64
65
|
readonly baseUrl?: string | null;
|
|
65
|
-
readonly
|
|
66
|
-
readonly namespace?: string;
|
|
66
|
+
readonly slug?: string;
|
|
67
67
|
};
|
|
68
|
-
export type OpenApiHttpApiTestSourceOptions = Omit<OpenApiSpecConfig, "spec" | "
|
|
69
|
-
readonly
|
|
70
|
-
readonly namespace?: string;
|
|
68
|
+
export type OpenApiHttpApiTestSourceOptions = Omit<OpenApiSpecConfig, "spec" | "slug" | "baseUrl"> & {
|
|
69
|
+
readonly slug?: string;
|
|
71
70
|
readonly baseUrl?: string | null;
|
|
72
71
|
readonly specBaseUrl?: string;
|
|
73
72
|
readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;
|
|
74
73
|
};
|
|
75
|
-
type
|
|
76
|
-
readonly
|
|
77
|
-
readonly
|
|
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;
|
|
74
|
+
type OpenApiHttpApiAddSpecHeadersInput = {
|
|
75
|
+
readonly headers?: Record<string, string>;
|
|
76
|
+
readonly queryParams?: Record<string, string>;
|
|
85
77
|
};
|
|
78
|
+
export type OpenApiHttpApiTestAddSpecPayloadOptions = Omit<OpenApiHttpApiTestSourceOptions, "headers" | "queryParams"> & OpenApiHttpApiAddSpecHeadersInput;
|
|
86
79
|
export type OpenApiTestSourceExecutor = {
|
|
87
80
|
readonly openapi: Pick<OpenApiPluginExtension, "addSpec">;
|
|
88
81
|
};
|
|
82
|
+
export type OpenApiTestConnectionExecutor = {
|
|
83
|
+
readonly openapi: Pick<OpenApiPluginExtension, "addSpec">;
|
|
84
|
+
readonly connections: {
|
|
85
|
+
readonly create: (input: CreateConnectionInput) => Effect.Effect<Connection, unknown>;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export interface OpenApiTestConnectionOptions {
|
|
89
|
+
readonly slug?: string;
|
|
90
|
+
readonly owner?: Owner;
|
|
91
|
+
readonly connection?: string;
|
|
92
|
+
readonly template?: string;
|
|
93
|
+
/** Inline credential value. Defaults to a throwaway token via the in-memory
|
|
94
|
+
* provider's `from` path is avoided — pass `value` to store a real secret. */
|
|
95
|
+
readonly value?: string;
|
|
96
|
+
readonly baseUrl?: string | null;
|
|
97
|
+
}
|
|
98
|
+
export interface OpenApiTestConnection {
|
|
99
|
+
readonly slug: string;
|
|
100
|
+
readonly owner: Owner;
|
|
101
|
+
readonly connection: string;
|
|
102
|
+
readonly address: (tool: string) => ToolAddressType;
|
|
103
|
+
}
|
|
104
|
+
/** addSpec + connections.create from a raw server spec; returns an address
|
|
105
|
+
* builder for `executor.execute`. */
|
|
106
|
+
export declare const addOpenApiTestConnection: (executor: OpenApiTestConnectionExecutor, server: OpenApiTestServerShape, sourceOptions: OpenApiTestSourceOptions, connectionOptions?: OpenApiTestConnectionOptions) => Effect.Effect<OpenApiTestConnection, unknown>;
|
|
89
107
|
export interface OpenApiTestSpecOptions {
|
|
90
108
|
readonly baseUrl?: string;
|
|
91
109
|
readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;
|
|
@@ -93,40 +111,33 @@ export interface OpenApiTestSpecOptions {
|
|
|
93
111
|
export declare const makeOpenApiTestSpecJson: (api: HttpApi.Any, options?: OpenApiTestSpecOptions) => string;
|
|
94
112
|
export declare const makeOpenApiTestSourceConfig: (server: OpenApiTestServerShape, options: OpenApiTestSourceOptions) => OpenApiSpecConfig;
|
|
95
113
|
export declare const addOpenApiTestSource: (executor: OpenApiTestSourceExecutor, server: OpenApiTestServerShape, options: OpenApiTestSourceOptions) => Effect.Effect<{
|
|
96
|
-
readonly
|
|
114
|
+
readonly slug: IntegrationSlug;
|
|
97
115
|
readonly toolCount: number;
|
|
98
|
-
}, import("@executor-js/sdk/core").StorageFailure | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError, never>;
|
|
116
|
+
}, import("@executor-js/sdk/core").StorageFailure | import("@executor-js/sdk/core").IntegrationAlreadyExistsError | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError, never>;
|
|
99
117
|
export declare const makeOpenApiHttpApiTestSourceConfig: (api: HttpApi.Any, options: OpenApiHttpApiTestSourceOptions) => OpenApiSpecConfig;
|
|
100
118
|
export declare const addOpenApiHttpApiTestSource: (executor: OpenApiTestSourceExecutor, api: HttpApi.Any, options: OpenApiHttpApiTestSourceOptions) => Effect.Effect<{
|
|
101
|
-
readonly
|
|
119
|
+
readonly slug: IntegrationSlug;
|
|
102
120
|
readonly toolCount: number;
|
|
103
|
-
}, import("@executor-js/sdk/core").StorageFailure | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError, never>;
|
|
121
|
+
}, import("@executor-js/sdk/core").StorageFailure | import("@executor-js/sdk/core").IntegrationAlreadyExistsError | import("../sdk").OpenApiParseError | import("../sdk").OpenApiExtractionError | import("../sdk").OpenApiOAuthError, never>;
|
|
104
122
|
export declare const makeOpenApiHttpApiTestAddSpecPayload: (api: HttpApi.Any, options: OpenApiHttpApiTestAddSpecPayloadOptions) => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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;
|
|
123
|
+
authenticationTemplate?: readonly import("../sdk").Authentication[] | undefined;
|
|
124
|
+
queryParams?: Record<string, string> | undefined;
|
|
125
|
+
headers?: Record<string, string> | undefined;
|
|
120
126
|
spec: {
|
|
121
127
|
readonly kind: "url";
|
|
122
128
|
readonly url: string;
|
|
123
129
|
} | {
|
|
124
130
|
readonly value: string;
|
|
125
131
|
readonly kind: "blob";
|
|
132
|
+
} | {
|
|
133
|
+
readonly kind: "googleDiscovery";
|
|
134
|
+
readonly url: string;
|
|
135
|
+
} | {
|
|
136
|
+
readonly kind: "googleDiscoveryBundle";
|
|
137
|
+
readonly urls: readonly string[];
|
|
126
138
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
baseUrl: string;
|
|
139
|
+
slug: string;
|
|
140
|
+
baseUrl: string | undefined;
|
|
130
141
|
};
|
|
131
142
|
export declare const makeOpenApiHttpApiTestSpecPayload: (api: HttpApi.Any, options?: OpenApiTestSpecOptions) => {
|
|
132
143
|
spec: string;
|
package/dist/testing.js
CHANGED
|
@@ -13,13 +13,47 @@ import {
|
|
|
13
13
|
OpenApi
|
|
14
14
|
} from "effect/unstable/httpapi";
|
|
15
15
|
import { OAuthTestServer, serveTestHttpServerLayer } from "@executor-js/sdk/testing";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
AuthTemplateSlug,
|
|
18
|
+
ConnectionName,
|
|
19
|
+
IntegrationSlug,
|
|
20
|
+
ProviderItemId,
|
|
21
|
+
ProviderKey,
|
|
22
|
+
ToolAddress,
|
|
23
|
+
isToolResult
|
|
24
|
+
} from "@executor-js/sdk/core";
|
|
17
25
|
var OpenApiTestServerAddressError = class extends Data.TaggedError(
|
|
18
26
|
"OpenApiTestServerAddressError"
|
|
19
27
|
) {
|
|
20
28
|
};
|
|
21
29
|
var OpenApiTestServerSpecError = class extends Data.TaggedError("OpenApiTestServerSpecError") {
|
|
22
30
|
};
|
|
31
|
+
var addOpenApiTestConnection = (executor, server, sourceOptions, connectionOptions = {}) => Effect.gen(function* () {
|
|
32
|
+
const config = makeOpenApiTestSourceConfig(server, sourceOptions);
|
|
33
|
+
const result = yield* executor.openapi.addSpec(config);
|
|
34
|
+
const slug = String(result.slug);
|
|
35
|
+
const owner = connectionOptions.owner ?? "org";
|
|
36
|
+
const connection = connectionOptions.connection ?? "main";
|
|
37
|
+
const template = connectionOptions.template ?? "apiKey";
|
|
38
|
+
yield* executor.connections.create({
|
|
39
|
+
owner,
|
|
40
|
+
name: ConnectionName.make(connection),
|
|
41
|
+
integration: IntegrationSlug.make(slug),
|
|
42
|
+
template: AuthTemplateSlug.make(template),
|
|
43
|
+
...connectionOptions.value !== void 0 ? { value: connectionOptions.value } : {
|
|
44
|
+
from: {
|
|
45
|
+
provider: ProviderKey.make("memory"),
|
|
46
|
+
id: ProviderItemId.make(`${slug}-token`)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
slug,
|
|
52
|
+
owner,
|
|
53
|
+
connection,
|
|
54
|
+
address: (tool) => ToolAddress.make(`tools.${slug}.${owner}.${connection}.${tool}`)
|
|
55
|
+
};
|
|
56
|
+
});
|
|
23
57
|
var makeOpenApiTestSpecJson = (api, options = {}) => {
|
|
24
58
|
const annotations = OpenApi.annotations({
|
|
25
59
|
...options.baseUrl !== void 0 ? { servers: [{ url: options.baseUrl }] } : {},
|
|
@@ -29,45 +63,38 @@ var makeOpenApiTestSpecJson = (api, options = {}) => {
|
|
|
29
63
|
return JSON.stringify(OpenApi.fromApi(annotated));
|
|
30
64
|
};
|
|
31
65
|
var makeOpenApiTestSourceConfig = (server, options) => {
|
|
32
|
-
const { baseUrl, ...rest } = options;
|
|
66
|
+
const { baseUrl, slug, ...rest } = options;
|
|
33
67
|
return {
|
|
34
68
|
...rest,
|
|
35
69
|
spec: { kind: "blob", value: server.specJson },
|
|
36
|
-
|
|
37
|
-
namespace: rest.namespace ?? "test_api",
|
|
70
|
+
slug: slug ?? "test_api",
|
|
38
71
|
...baseUrl === null ? {} : { baseUrl: baseUrl ?? server.baseUrl }
|
|
39
72
|
};
|
|
40
73
|
};
|
|
41
74
|
var addOpenApiTestSource = (executor, server, options) => executor.openapi.addSpec(makeOpenApiTestSourceConfig(server, options));
|
|
42
75
|
var makeOpenApiHttpApiTestSourceConfig = (api, options) => {
|
|
43
|
-
const { baseUrl, specBaseUrl, transformSpec, ...config } = options;
|
|
76
|
+
const { baseUrl, specBaseUrl, transformSpec, slug, ...config } = options;
|
|
44
77
|
return {
|
|
45
78
|
...config,
|
|
46
79
|
spec: {
|
|
47
80
|
kind: "blob",
|
|
48
81
|
value: makeOpenApiTestSpecJson(api, { baseUrl: specBaseUrl, transformSpec })
|
|
49
82
|
},
|
|
50
|
-
|
|
51
|
-
namespace: config.namespace ?? "test_api",
|
|
83
|
+
slug: slug ?? "test_api",
|
|
52
84
|
...baseUrl === null ? {} : { baseUrl: baseUrl ?? specBaseUrl ?? "https://api.example.test" }
|
|
53
85
|
};
|
|
54
86
|
};
|
|
55
87
|
var addOpenApiHttpApiTestSource = (executor, api, options) => executor.openapi.addSpec(makeOpenApiHttpApiTestSourceConfig(api, options));
|
|
56
88
|
var makeOpenApiHttpApiTestAddSpecPayload = (api, options) => {
|
|
57
|
-
const { ...sourceOptions } = options;
|
|
58
|
-
const config = makeOpenApiHttpApiTestSourceConfig(api,
|
|
59
|
-
...sourceOptions,
|
|
60
|
-
scope: "unused-http-helper-scope"
|
|
61
|
-
});
|
|
89
|
+
const { headers, queryParams, ...sourceOptions } = options;
|
|
90
|
+
const config = makeOpenApiHttpApiTestSourceConfig(api, sourceOptions);
|
|
62
91
|
return {
|
|
63
92
|
spec: config.spec,
|
|
64
|
-
|
|
65
|
-
name: config.name,
|
|
93
|
+
slug: config.slug,
|
|
66
94
|
baseUrl: config.baseUrl,
|
|
67
|
-
...
|
|
68
|
-
...
|
|
69
|
-
...config.
|
|
70
|
-
...sourceOptions.specFetchCredentials !== void 0 ? { specFetchCredentials: sourceOptions.specFetchCredentials } : {}
|
|
95
|
+
...headers !== void 0 ? { headers } : {},
|
|
96
|
+
...queryParams !== void 0 ? { queryParams } : {},
|
|
97
|
+
...config.authenticationTemplate !== void 0 ? { authenticationTemplate: config.authenticationTemplate } : {}
|
|
71
98
|
};
|
|
72
99
|
};
|
|
73
100
|
var makeOpenApiHttpApiTestSpecPayload = (api, options = {}) => ({
|
|
@@ -427,6 +454,7 @@ export {
|
|
|
427
454
|
OpenApiTestServerSpecError,
|
|
428
455
|
TestLayers,
|
|
429
456
|
addOpenApiHttpApiTestSource,
|
|
457
|
+
addOpenApiTestConnection,
|
|
430
458
|
addOpenApiTestSource,
|
|
431
459
|
makeOpenApiHttpApiTestAddSpecPayload,
|
|
432
460
|
makeOpenApiHttpApiTestSourceConfig,
|
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 { isToolResult } 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<\n OpenApiSpecConfig,\n \"spec\" | \"baseUrl\" | \"name\" | \"namespace\"\n> & {\n readonly baseUrl?: string | null;\n readonly name?: string;\n readonly namespace?: string;\n};\n\nexport type OpenApiHttpApiTestSourceOptions = Omit<\n OpenApiSpecConfig,\n \"spec\" | \"name\" | \"namespace\" | \"baseUrl\"\n> & {\n readonly name?: string;\n readonly namespace?: string;\n readonly baseUrl?: string | null;\n readonly specBaseUrl?: string;\n readonly transformSpec?: (spec: Record<string, unknown>) => Record<string, unknown>;\n};\n\ntype OpenApiHttpApiAddSpecCredentialInput =\n | string\n | {\n readonly kind: \"secret\";\n readonly prefix?: string;\n };\n\ntype OpenApiHttpApiAddSpecCredentialsInput = {\n readonly headers?: Record<string, OpenApiHttpApiAddSpecCredentialInput>;\n readonly queryParams?: Record<string, OpenApiHttpApiAddSpecCredentialInput>;\n};\n\nexport type OpenApiHttpApiTestAddSpecPayloadOptions = Omit<\n OpenApiHttpApiTestSourceOptions,\n \"scope\" | \"headers\" | \"queryParams\" | \"specFetchCredentials\"\n> &\n OpenApiHttpApiAddSpecCredentialsInput & {\n readonly specFetchCredentials?: OpenApiHttpApiAddSpecCredentialsInput;\n };\n\nexport type OpenApiTestSourceExecutor = {\n readonly openapi: Pick<OpenApiPluginExtension, \"addSpec\">;\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, ...rest } = options;\n return {\n ...rest,\n spec: { kind: \"blob\", value: server.specJson },\n name: rest.name ?? \"Test API\",\n namespace: rest.namespace ?? \"test_api\",\n ...(baseUrl === null ? {} : { baseUrl: baseUrl ?? server.baseUrl }),\n } as 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, ...config } = options;\n return {\n ...config,\n spec: {\n kind: \"blob\",\n value: makeOpenApiTestSpecJson(api, { baseUrl: specBaseUrl, transformSpec }),\n },\n name: config.name ?? \"Test API\",\n namespace: config.namespace ?? \"test_api\",\n ...(baseUrl === null ? {} : { baseUrl: baseUrl ?? specBaseUrl ?? \"https://api.example.test\" }),\n } as 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 { ...sourceOptions } = options;\n const config = makeOpenApiHttpApiTestSourceConfig(api, {\n ...sourceOptions,\n scope: \"unused-http-helper-scope\",\n });\n return {\n spec: config.spec,\n namespace: config.namespace,\n name: config.name,\n baseUrl: config.baseUrl,\n ...(sourceOptions.headers !== undefined ? { headers: sourceOptions.headers } : {}),\n ...(sourceOptions.queryParams !== undefined ? { queryParams: sourceOptions.queryParams } : {}),\n ...(config.oauth2 !== undefined ? { oauth2: config.oauth2 } : {}),\n ...(sourceOptions.specFetchCredentials !== undefined\n ? { specFetchCredentials: sourceOptions.specFetchCredentials }\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,SAAS,oBAAoB;AAGtB,IAAM,gCAAN,cAA4C,KAAK;AAAA,EACtD;AACF,EAEG;AAAC;AAEG,IAAM,6BAAN,cAAyC,KAAK,YAAY,4BAA4B,EAE1F;AAAC;AAyGG,IAAM,0BAA0B,CACrC,KACA,UAAkC,CAAC,MACxB;AACX,QAAM,cAAc,QAAQ,YAAY;AAAA,IACtC,GAAI,QAAQ,YAAY,SAAY,EAAE,SAAS,CAAC,EAAE,KAA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W;AACzB,aAAO;AAAA,QACL,QAAQ,QAAQ;AAAA,QAChB,SAAS,QAAQ;AAAA,QACjB,MAAM,QAAQ;AAAA,QACd,OAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,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":[]}
|
|
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;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AAGA,IAAM,gCAAN,cAA4C,KAAK;AAAA,EACtD;AACF,EAEG;AAAC;AAEG,IAAM,6BAAN,cAAyC,KAAK,YAAY,4BAA4B,EAE1F;AAAC;AAyHG,IAAM,2BAA2B,CACtC,UACA,QACA,eACA,oBAAkD,CAAC,MAEnD,OAAO,IAAI,aAAa;AACtB,QAAM,SAAS,4BAA4B,QAAQ,aAAa;AAChE,QAAM,SAAS,OAAO,SAAS,QAAQ,QAAQ,MAAM;AACrD,QAAM,OAAO,OAAO,OAAO,IAAI;AAC/B,QAAM,QAAe,kBAAkB,SAAS;AAChD,QAAM,aAAa,kBAAkB,cAAc;AACnD,QAAM,WAAW,kBAAkB,YAAY;AAC/C,SAAO,SAAS,YAAY,OAAO;AAAA,IACjC;AAAA,IACA,MAAM,eAAe,KAAK,UAAU;AAAA,IACpC,aAAa,gBAAgB,KAAK,IAAI;AAAA,IACtC,UAAU,iBAAiB,KAAK,QAAQ;AAAA,IACxC,GAAI,kBAAkB,UAAU,SAC5B,EAAE,OAAO,kBAAkB,MAAM,IACjC;AAAA,MAC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AAA,MACL,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,EACF;AACA,MAAI,IAAI,IAAI;AACV,UAAM,QAAQ,IAAI;AAClB,UAAM,UAAU,OAAO,eAAe,+BAA+B,KAAK,CAAC;AAC3E,QAAI,YAAY,QAAW;AACzB,aAAO;AAAA,QACL,QAAQ,QAAQ;AAAA,QAChB,SAAS,QAAQ;AAAA,QACjB,MAAM,QAAQ;AAAA,QACd,OAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,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.
|
|
3
|
+
"version": "1.5.0",
|
|
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,9 +53,9 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@effect/platform-node": "4.0.0-beta.59",
|
|
56
|
-
"@executor-js/config": "1.
|
|
57
|
-
"@executor-js/sdk": "1.
|
|
58
|
-
"
|
|
56
|
+
"@executor-js/config": "1.5.0",
|
|
57
|
+
"@executor-js/sdk": "1.5.0",
|
|
58
|
+
"lucide-react": "^1.7.0",
|
|
59
59
|
"openapi-types": "^12.1.3",
|
|
60
60
|
"yaml": "^2.7.1"
|
|
61
61
|
},
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@types/node": "^24.3.1",
|
|
66
66
|
"@types/react": "^19.1.0",
|
|
67
67
|
"bun-types": "^1.2.22",
|
|
68
|
+
"effect": "4.0.0-beta.59",
|
|
68
69
|
"react": "^19.1.0",
|
|
69
70
|
"tsup": "^8.5.0",
|
|
70
71
|
"vitest": "^4.1.5"
|
|
@@ -72,6 +73,7 @@
|
|
|
72
73
|
"peerDependencies": {
|
|
73
74
|
"@effect/atom-react": "4.0.0-beta.59",
|
|
74
75
|
"@tanstack/react-router": "^1.168.10",
|
|
76
|
+
"effect": "4.0.0-beta.59",
|
|
75
77
|
"react": "^19.1.0"
|
|
76
78
|
},
|
|
77
79
|
"peerDependenciesMeta": {
|