@executor-js/plugin-openapi 0.0.1 → 0.1.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.
Files changed (43) hide show
  1. package/README.md +24 -23
  2. package/dist/api/group.d.ts +94 -38
  3. package/dist/api/handlers.d.ts +2 -2
  4. package/dist/chunk-RBE3CVB4.js +2837 -0
  5. package/dist/chunk-RBE3CVB4.js.map +1 -0
  6. package/dist/core.js +44 -50
  7. package/dist/core.js.map +1 -1
  8. package/dist/index.js +2 -5
  9. package/dist/index.js.map +1 -1
  10. package/dist/react/AddOpenApiSource.d.ts +13 -0
  11. package/dist/react/EditOpenApiSource.d.ts +2 -2
  12. package/dist/react/OpenApiSourceSummary.d.ts +3 -1
  13. package/dist/react/atoms.d.ts +129 -0
  14. package/dist/react/client.d.ts +88 -3
  15. package/dist/react/plugin-client.d.ts +2 -0
  16. package/dist/react/source-plugin.d.ts +1 -1
  17. package/dist/sdk/client-credentials-oauth.test.d.ts +1 -0
  18. package/dist/sdk/credential-status.d.ts +23 -0
  19. package/dist/sdk/credential-status.test.d.ts +1 -0
  20. package/dist/sdk/errors.d.ts +11 -10
  21. package/dist/sdk/form-urlencoded-body.test.d.ts +1 -0
  22. package/dist/sdk/index.d.ts +8 -10
  23. package/dist/sdk/invoke.d.ts +8 -17
  24. package/dist/sdk/multi-scope-bearer.test.d.ts +1 -0
  25. package/dist/sdk/multi-scope-oauth.test.d.ts +1 -0
  26. package/dist/sdk/non-json-body.test.d.ts +1 -0
  27. package/dist/sdk/oauth-refresh.test.d.ts +1 -0
  28. package/dist/sdk/openapi-utils.d.ts +35 -4
  29. package/dist/sdk/parse.d.ts +28 -4
  30. package/dist/sdk/plugin.d.ts +278 -23
  31. package/dist/sdk/preview-oauth2.test.d.ts +1 -0
  32. package/dist/sdk/preview.d.ts +86 -161
  33. package/dist/sdk/store.d.ts +201 -0
  34. package/dist/sdk/types.d.ts +234 -266
  35. package/dist/sdk/upstream-failures.test.d.ts +1 -0
  36. package/package.json +11 -22
  37. package/dist/chunk-KPGROAQO.js +0 -1279
  38. package/dist/chunk-KPGROAQO.js.map +0 -1
  39. package/dist/promise.d.ts +0 -6
  40. package/dist/sdk/config-file-store.d.ts +0 -10
  41. package/dist/sdk/kv-operation-store.d.ts +0 -4
  42. package/dist/sdk/operation-store.d.ts +0 -36
  43. package/dist/sdk/stored-source.d.ts +0 -51
package/README.md CHANGED
@@ -1,39 +1,36 @@
1
- # @executor/plugin-openapi
1
+ # @executor-js/plugin-openapi
2
2
 
3
3
  Load [OpenAPI](https://www.openapis.org/) specifications into an executor. Every operation in the spec becomes an invokable tool with a JSON-Schema input, automatic request building, and optional secret-backed auth.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```sh
8
- bun add @executor/sdk @executor/plugin-openapi
8
+ bun add @executor-js/sdk @executor-js/plugin-openapi
9
9
  # or
10
- npm install @executor/sdk @executor/plugin-openapi
10
+ npm install @executor-js/sdk @executor-js/plugin-openapi
11
11
  ```
12
12
 
13
13
  ## Usage
14
14
 
15
15
  ```ts
16
- import { createExecutor } from "@executor/sdk";
17
- import { openApiPlugin } from "@executor/plugin-openapi";
16
+ import { createExecutor } from "@executor-js/sdk";
17
+ import { openApiPlugin } from "@executor-js/plugin-openapi";
18
18
 
19
19
  const executor = await createExecutor({
20
- scope: { name: "my-app" },
20
+ onElicitation: "accept-all",
21
21
  plugins: [openApiPlugin()] as const,
22
22
  });
23
23
 
24
24
  // Load a spec by URL (JSON or YAML, remote or file://)
25
25
  await executor.openapi.addSpec({
26
+ scope: executor.scopes[0]!.id,
26
27
  spec: "https://petstore3.swagger.io/api/v3/openapi.json",
27
28
  namespace: "petstore",
28
29
  });
29
30
 
30
31
  // List and invoke tools like any other plugin
31
32
  const tools = await executor.tools.list();
32
- const result = await executor.tools.invoke(
33
- "petstore.listPets",
34
- {},
35
- { onElicitation: "accept-all" },
36
- );
33
+ const result = await executor.tools.invoke("petstore.listPets", {});
37
34
  ```
38
35
 
39
36
  ## Secret-backed auth headers
@@ -41,14 +38,26 @@ const result = await executor.tools.invoke(
41
38
  Wire API keys or bearer tokens through the executor's secret store — never hard-code them in source configs:
42
39
 
43
40
  ```ts
41
+ import { createExecutor } from "@executor-js/sdk";
42
+ import { openApiPlugin } from "@executor-js/plugin-openapi";
43
+ import { fileSecretsPlugin } from "@executor-js/plugin-file-secrets";
44
+
45
+ const executor = await createExecutor({
46
+ onElicitation: "accept-all",
47
+ plugins: [fileSecretsPlugin(), openApiPlugin()] as const,
48
+ });
49
+
50
+ const scope = executor.scopes[0]!.id;
51
+
44
52
  await executor.secrets.set({
45
53
  id: "stripe-key",
46
54
  name: "Stripe Key",
47
55
  value: "sk_live_...",
48
- purpose: "authentication",
56
+ scope,
49
57
  });
50
58
 
51
59
  await executor.openapi.addSpec({
60
+ scope,
52
61
  spec: "https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json",
53
62
  namespace: "stripe",
54
63
  headers: {
@@ -57,20 +66,12 @@ await executor.openapi.addSpec({
57
66
  });
58
67
  ```
59
68
 
60
- ## Presets
61
-
62
- Common public APIs are available as presets from the `/presets` subpath:
63
-
64
- ```ts
65
- import { openApiPresets } from "@executor/plugin-openapi/presets";
66
- ```
67
-
68
- ## Effect entry point
69
+ ## Using with Effect
69
70
 
70
- If you're using `@executor/core` directly, import from the `/core` subpath:
71
+ If you're building on `@executor-js/sdk/core` (the raw Effect entry), import this plugin from its `/core` subpath instead — it returns the Effect-shaped plugin with `Effect.Effect<...>`-returning methods rather than promisified wrappers:
71
72
 
72
73
  ```ts
73
- import { openApiPlugin } from "@executor/plugin-openapi";
74
+ import { openApiPlugin } from "@executor-js/plugin-openapi/core";
74
75
  ```
75
76
 
76
77
  ## Status
@@ -1,39 +1,95 @@
1
- import { HttpApiEndpoint, HttpApiGroup } from "@effect/platform";
2
- import { OpenApiParseError, OpenApiExtractionError } from "../sdk/errors";
1
+ import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
2
+ import { Schema } from "effect";
3
+ import { InternalError } from "@executor-js/api";
4
+ import { OpenApiParseError, OpenApiExtractionError, OpenApiOAuthError } from "../sdk/errors";
3
5
  import { SpecPreview } from "../sdk/preview";
4
- import { StoredSourceSchema } from "../sdk/stored-source";
5
- declare const OpenApiGroup_base: HttpApiGroup.HttpApiGroup<"openapi", HttpApiEndpoint.HttpApiEndpoint<"previewSpec", "POST", {
6
- readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
7
- }, never, {
8
- readonly spec: string;
9
- }, never, SpecPreview, OpenApiParseError | OpenApiExtractionError, never, never> | HttpApiEndpoint.HttpApiEndpoint<"addSpec", "POST", {
10
- readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
11
- }, never, {
12
- readonly name?: string | undefined;
13
- readonly namespace?: string | undefined;
14
- readonly headers?: {
15
- readonly [x: string]: unknown;
16
- } | undefined;
17
- readonly baseUrl?: string | undefined;
18
- readonly spec: string;
19
- }, never, {
20
- readonly namespace: string;
21
- readonly toolCount: number;
22
- }, OpenApiParseError | OpenApiExtractionError, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getSource", "GET", {
23
- readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
24
- readonly namespace: string;
25
- }, never, never, never, StoredSourceSchema | null, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"updateSource", "PATCH", {
26
- readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
27
- readonly namespace: string;
28
- }, never, {
29
- readonly name?: string | undefined;
30
- readonly headers?: {
31
- readonly [x: string]: unknown;
32
- } | undefined;
33
- readonly baseUrl?: string | undefined;
34
- }, never, {
35
- readonly updated: boolean;
36
- }, never, never, never>, never, never, false>;
37
- export declare class OpenApiGroup extends OpenApiGroup_base {
38
- }
39
- export {};
6
+ import { StoredSourceSchema } from "../sdk/store";
7
+ import { OAuth2Auth, OAuth2SourceConfig, OpenApiSourceBindingRef } from "../sdk/types";
8
+ export declare const OpenApiGroup: HttpApiGroup.HttpApiGroup<"openapi", HttpApiEndpoint.HttpApiEndpoint<"previewSpec", "POST", "/scopes/:scopeId/openapi/preview", HttpApiEndpoint.StringTree<Schema.Struct<{
9
+ scopeId: Schema.brand<Schema.String, "ScopeId">;
10
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
11
+ readonly spec: Schema.String;
12
+ readonly specFetchCredentials: Schema.optional<Schema.Struct<{
13
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
14
+ readonly secretId: Schema.String;
15
+ readonly prefix: Schema.optional<Schema.String>;
16
+ }>]>>>;
17
+ readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
18
+ readonly secretId: Schema.String;
19
+ readonly prefix: Schema.optional<Schema.String>;
20
+ }>]>>>;
21
+ }>>;
22
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<typeof SpecPreview>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"addSpec", "POST", "/scopes/:scopeId/openapi/specs", HttpApiEndpoint.StringTree<Schema.Struct<{
23
+ scopeId: Schema.brand<Schema.String, "ScopeId">;
24
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
25
+ readonly spec: Schema.String;
26
+ readonly specFetchCredentials: Schema.optional<Schema.Struct<{
27
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
28
+ readonly secretId: Schema.String;
29
+ readonly prefix: Schema.optional<Schema.String>;
30
+ }>]>>>;
31
+ readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
32
+ readonly secretId: Schema.String;
33
+ readonly prefix: Schema.optional<Schema.String>;
34
+ }>]>>>;
35
+ }>>;
36
+ readonly name: Schema.optional<Schema.String>;
37
+ readonly baseUrl: Schema.optional<Schema.String>;
38
+ readonly namespace: Schema.optional<Schema.String>;
39
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
40
+ readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
41
+ readonly secretId: Schema.String;
42
+ readonly prefix: Schema.optional<Schema.String>;
43
+ }>]>>>;
44
+ readonly oauth2: Schema.optional<Schema.Union<readonly [typeof OAuth2Auth, typeof OAuth2SourceConfig]>>;
45
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
46
+ readonly toolCount: Schema.Number;
47
+ readonly namespace: Schema.String;
48
+ }>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getSource", "GET", "/scopes/:scopeId/openapi/sources/:namespace", HttpApiEndpoint.StringTree<Schema.Struct<{
49
+ scopeId: Schema.brand<Schema.String, "ScopeId">;
50
+ namespace: Schema.String;
51
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.NullOr<typeof StoredSourceSchema>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"updateSource", "PATCH", "/scopes/:scopeId/openapi/sources/:namespace", HttpApiEndpoint.StringTree<Schema.Struct<{
52
+ scopeId: Schema.brand<Schema.String, "ScopeId">;
53
+ namespace: Schema.String;
54
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
55
+ readonly name: Schema.optional<Schema.String>;
56
+ readonly baseUrl: Schema.optional<Schema.String>;
57
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
58
+ readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
59
+ readonly secretId: Schema.String;
60
+ readonly prefix: Schema.optional<Schema.String>;
61
+ }>]>>>;
62
+ readonly oauth2: Schema.optional<Schema.Union<readonly [typeof OAuth2Auth, typeof OAuth2SourceConfig]>>;
63
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
64
+ readonly updated: Schema.Boolean;
65
+ }>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listSourceBindings", "GET", "/scopes/:scopeId/openapi/sources/:namespace/base/:sourceScopeId/bindings", HttpApiEndpoint.StringTree<Schema.Struct<{
66
+ scopeId: Schema.brand<Schema.String, "ScopeId">;
67
+ namespace: Schema.String;
68
+ sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
69
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.$Array<typeof OpenApiSourceBindingRef>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"setSourceBinding", "POST", "/scopes/:scopeId/openapi/source-bindings", HttpApiEndpoint.StringTree<Schema.Struct<{
70
+ scopeId: Schema.brand<Schema.String, "ScopeId">;
71
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
72
+ readonly sourceId: Schema.String;
73
+ readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
74
+ readonly scope: Schema.brand<Schema.String, "ScopeId">;
75
+ readonly slot: Schema.String;
76
+ readonly value: Schema.Union<readonly [Schema.Struct<{
77
+ readonly kind: Schema.Literal<"secret">;
78
+ readonly secretId: Schema.brand<Schema.String, "SecretId">;
79
+ }>, Schema.Struct<{
80
+ readonly kind: Schema.Literal<"connection">;
81
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
82
+ }>, Schema.Struct<{
83
+ readonly kind: Schema.Literal<"text">;
84
+ readonly text: Schema.String;
85
+ }>]>;
86
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<typeof OpenApiSourceBindingRef>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"removeSourceBinding", "POST", "/scopes/:scopeId/openapi/source-bindings/remove", HttpApiEndpoint.StringTree<Schema.Struct<{
87
+ scopeId: Schema.brand<Schema.String, "ScopeId">;
88
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
89
+ readonly sourceId: Schema.String;
90
+ readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
91
+ readonly slot: Schema.String;
92
+ readonly scope: Schema.brand<Schema.String, "ScopeId">;
93
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
94
+ readonly removed: Schema.Boolean;
95
+ }>>, HttpApiEndpoint.Json<typeof InternalError | typeof OpenApiParseError | typeof OpenApiExtractionError | typeof OpenApiOAuthError>, never, never>, false>;
@@ -1,7 +1,7 @@
1
1
  import { Context } from "effect";
2
2
  import type { OpenApiPluginExtension } from "../sdk/plugin";
3
- declare const OpenApiExtensionService_base: Context.TagClass<OpenApiExtensionService, "OpenApiExtensionService", OpenApiPluginExtension>;
3
+ declare const OpenApiExtensionService_base: Context.ServiceClass<OpenApiExtensionService, "OpenApiExtensionService", OpenApiPluginExtension>;
4
4
  export declare class OpenApiExtensionService extends OpenApiExtensionService_base {
5
5
  }
6
- export declare const OpenApiHandlers: import("effect/Layer").Layer<import("@effect/platform/HttpApiGroup").ApiGroup<"executor", "openapi">, never, OpenApiExtensionService>;
6
+ export declare const OpenApiHandlers: import("effect/Layer").Layer<import("effect/unstable/httpapi/HttpApiGroup").ApiGroup<"executor", "openapi">, never, import("effect/unstable/http/HttpRouter").Request<"Requires", OpenApiExtensionService>>;
7
7
  export {};