@executor-js/plugin-graphql 0.0.1-beta.6 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -14
- package/dist/api/group.d.ts +138 -31
- package/dist/api/handlers.d.ts +2 -2
- package/dist/chunk-ILBZO52O.js +1090 -0
- package/dist/chunk-ILBZO52O.js.map +1 -0
- package/dist/core.js +12 -50
- package/dist/core.js.map +1 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/dist/react/GraphqlSignInButton.d.ts +3 -0
- package/dist/react/atoms.d.ts +78 -0
- package/dist/react/client.d.ts +449 -3
- package/dist/react/defaults.d.ts +2 -0
- package/dist/react/source-plugin.d.ts +1 -1
- package/dist/sdk/errors.d.ts +6 -10
- package/dist/sdk/index.d.ts +4 -6
- package/dist/sdk/introspect.d.ts +2 -2
- package/dist/sdk/invoke.d.ts +7 -13
- package/dist/sdk/plugin.d.ts +118 -14
- package/dist/sdk/store.d.ts +94 -0
- package/dist/sdk/types.d.ts +57 -146
- package/package.json +10 -21
- package/dist/chunk-QEUTMVXO.js +0 -903
- package/dist/chunk-QEUTMVXO.js.map +0 -1
- package/dist/promise.d.ts +0 -7
- package/dist/sdk/config-file-store.d.ts +0 -10
- package/dist/sdk/extract.test.d.ts +0 -1
- package/dist/sdk/kv-operation-store.d.ts +0 -4
- package/dist/sdk/operation-store.d.ts +0 -29
- package/dist/sdk/plugin.test.d.ts +0 -1
- package/dist/sdk/stored-source.d.ts +0 -46
package/README.md
CHANGED
|
@@ -1,51 +1,62 @@
|
|
|
1
|
-
# @executor/plugin-graphql
|
|
1
|
+
# @executor-js/plugin-graphql
|
|
2
2
|
|
|
3
3
|
Introspect a GraphQL endpoint and expose its queries and mutations as invokable tools on an executor.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
bun add @executor/sdk @executor/plugin-graphql
|
|
8
|
+
bun add @executor-js/sdk @executor-js/plugin-graphql
|
|
9
9
|
# or
|
|
10
|
-
npm install @executor/sdk @executor/plugin-graphql
|
|
10
|
+
npm install @executor-js/sdk @executor-js/plugin-graphql
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
|
-
import { createExecutor } from "@executor/sdk";
|
|
17
|
-
import { graphqlPlugin } from "@executor/plugin-graphql";
|
|
16
|
+
import { createExecutor } from "@executor-js/sdk";
|
|
17
|
+
import { graphqlPlugin } from "@executor-js/plugin-graphql";
|
|
18
18
|
|
|
19
19
|
const executor = await createExecutor({
|
|
20
|
-
|
|
20
|
+
onElicitation: "accept-all",
|
|
21
21
|
plugins: [graphqlPlugin()] as const,
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
// Public endpoint — no auth
|
|
25
25
|
await executor.graphql.addSource({
|
|
26
|
+
scope: executor.scopes[0]!.id,
|
|
26
27
|
endpoint: "https://graphql.anilist.co",
|
|
27
28
|
namespace: "anilist",
|
|
28
29
|
});
|
|
29
30
|
|
|
30
31
|
const tools = await executor.tools.list();
|
|
31
|
-
const result = await executor.tools.invoke(
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
{ onElicitation: "accept-all" },
|
|
35
|
-
);
|
|
32
|
+
const result = await executor.tools.invoke("anilist.Media", {
|
|
33
|
+
search: "Frieren",
|
|
34
|
+
});
|
|
36
35
|
```
|
|
37
36
|
|
|
38
37
|
## Secret-backed auth
|
|
39
38
|
|
|
40
39
|
```ts
|
|
40
|
+
import { createExecutor } from "@executor-js/sdk";
|
|
41
|
+
import { graphqlPlugin } from "@executor-js/plugin-graphql";
|
|
42
|
+
import { fileSecretsPlugin } from "@executor-js/plugin-file-secrets";
|
|
43
|
+
|
|
44
|
+
const executor = await createExecutor({
|
|
45
|
+
onElicitation: "accept-all",
|
|
46
|
+
plugins: [fileSecretsPlugin(), graphqlPlugin()] as const,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const scope = executor.scopes[0]!.id;
|
|
50
|
+
|
|
41
51
|
await executor.secrets.set({
|
|
42
52
|
id: "github-token",
|
|
43
53
|
name: "GitHub Token",
|
|
44
54
|
value: "ghp_...",
|
|
45
|
-
|
|
55
|
+
scope,
|
|
46
56
|
});
|
|
47
57
|
|
|
48
58
|
await executor.graphql.addSource({
|
|
59
|
+
scope,
|
|
49
60
|
endpoint: "https://api.github.com/graphql",
|
|
50
61
|
namespace: "github",
|
|
51
62
|
headers: {
|
|
@@ -56,10 +67,10 @@ await executor.graphql.addSource({
|
|
|
56
67
|
|
|
57
68
|
## Using with Effect
|
|
58
69
|
|
|
59
|
-
If you're building on `@executor/sdk` (the raw Effect entry), import this plugin from its `/core` subpath instead:
|
|
70
|
+
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:
|
|
60
71
|
|
|
61
72
|
```ts
|
|
62
|
-
import { graphqlPlugin } from "@executor/plugin-graphql";
|
|
73
|
+
import { graphqlPlugin } from "@executor-js/plugin-graphql/core";
|
|
63
74
|
```
|
|
64
75
|
|
|
65
76
|
## Status
|
package/dist/api/group.d.ts
CHANGED
|
@@ -1,32 +1,139 @@
|
|
|
1
|
-
import { HttpApiEndpoint, HttpApiGroup } from "
|
|
1
|
+
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { InternalError } from "@executor-js/api";
|
|
2
4
|
import { GraphqlIntrospectionError, GraphqlExtractionError } from "../sdk/errors";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
readonly
|
|
6
|
-
|
|
7
|
-
readonly
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
readonly
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
readonly
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
5
|
+
export declare const StoredSourceSchema: Schema.Struct<{
|
|
6
|
+
readonly namespace: Schema.String;
|
|
7
|
+
readonly name: Schema.String;
|
|
8
|
+
readonly endpoint: Schema.String;
|
|
9
|
+
readonly headers: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
10
|
+
readonly secretId: Schema.String;
|
|
11
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
12
|
+
}>]>>;
|
|
13
|
+
readonly queryParams: 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 auth: Schema.Union<readonly [Schema.Struct<{
|
|
18
|
+
readonly kind: Schema.Literal<"none">;
|
|
19
|
+
}>, Schema.Struct<{
|
|
20
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
21
|
+
readonly connectionId: Schema.String;
|
|
22
|
+
}>]>;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const GraphqlGroup: HttpApiGroup.HttpApiGroup<"graphql", HttpApiEndpoint.HttpApiEndpoint<"addSource", "POST", "/scopes/:scopeId/graphql/sources", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
25
|
+
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
26
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
27
|
+
readonly endpoint: Schema.String;
|
|
28
|
+
readonly name: Schema.optional<Schema.String>;
|
|
29
|
+
readonly introspectionJson: Schema.optional<Schema.String>;
|
|
30
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
31
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
32
|
+
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
33
|
+
readonly auth: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
34
|
+
readonly kind: Schema.Literal<"none">;
|
|
35
|
+
}>, Schema.Struct<{
|
|
36
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
37
|
+
readonly connectionId: Schema.String;
|
|
38
|
+
}>]>>;
|
|
39
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
40
|
+
readonly toolCount: Schema.Number;
|
|
41
|
+
readonly namespace: Schema.String;
|
|
42
|
+
}>>, HttpApiEndpoint.Json<typeof InternalError | Schema.decodeTo<Schema.declareConstructor<GraphqlIntrospectionError, {
|
|
43
|
+
readonly message: string;
|
|
44
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
45
|
+
}, readonly [Schema.TaggedStruct<"GraphqlIntrospectionError", {
|
|
46
|
+
readonly message: Schema.String;
|
|
47
|
+
}>], {
|
|
48
|
+
readonly message: string;
|
|
49
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
50
|
+
}>, Schema.TaggedStruct<"GraphqlIntrospectionError", {
|
|
51
|
+
readonly message: Schema.String;
|
|
52
|
+
}>, never, never> | Schema.decodeTo<Schema.declareConstructor<GraphqlExtractionError, {
|
|
53
|
+
readonly message: string;
|
|
54
|
+
readonly _tag: "GraphqlExtractionError";
|
|
55
|
+
}, readonly [Schema.TaggedStruct<"GraphqlExtractionError", {
|
|
56
|
+
readonly message: Schema.String;
|
|
57
|
+
}>], {
|
|
58
|
+
readonly message: string;
|
|
59
|
+
readonly _tag: "GraphqlExtractionError";
|
|
60
|
+
}>, Schema.TaggedStruct<"GraphqlExtractionError", {
|
|
61
|
+
readonly message: Schema.String;
|
|
62
|
+
}>, never, never>>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getSource", "GET", "/scopes/:scopeId/graphql/sources/:namespace", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
63
|
+
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
64
|
+
namespace: Schema.String;
|
|
65
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.NullOr<Schema.Struct<{
|
|
66
|
+
readonly namespace: Schema.String;
|
|
67
|
+
readonly name: Schema.String;
|
|
68
|
+
readonly endpoint: Schema.String;
|
|
69
|
+
readonly headers: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
70
|
+
readonly secretId: Schema.String;
|
|
71
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
72
|
+
}>]>>;
|
|
73
|
+
readonly queryParams: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
74
|
+
readonly secretId: Schema.String;
|
|
75
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
76
|
+
}>]>>;
|
|
77
|
+
readonly auth: Schema.Union<readonly [Schema.Struct<{
|
|
78
|
+
readonly kind: Schema.Literal<"none">;
|
|
79
|
+
}>, Schema.Struct<{
|
|
80
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
81
|
+
readonly connectionId: Schema.String;
|
|
82
|
+
}>]>;
|
|
83
|
+
}>>>, HttpApiEndpoint.Json<typeof InternalError | Schema.decodeTo<Schema.declareConstructor<GraphqlIntrospectionError, {
|
|
84
|
+
readonly message: string;
|
|
85
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
86
|
+
}, readonly [Schema.TaggedStruct<"GraphqlIntrospectionError", {
|
|
87
|
+
readonly message: Schema.String;
|
|
88
|
+
}>], {
|
|
89
|
+
readonly message: string;
|
|
90
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
91
|
+
}>, Schema.TaggedStruct<"GraphqlIntrospectionError", {
|
|
92
|
+
readonly message: Schema.String;
|
|
93
|
+
}>, never, never> | Schema.decodeTo<Schema.declareConstructor<GraphqlExtractionError, {
|
|
94
|
+
readonly message: string;
|
|
95
|
+
readonly _tag: "GraphqlExtractionError";
|
|
96
|
+
}, readonly [Schema.TaggedStruct<"GraphqlExtractionError", {
|
|
97
|
+
readonly message: Schema.String;
|
|
98
|
+
}>], {
|
|
99
|
+
readonly message: string;
|
|
100
|
+
readonly _tag: "GraphqlExtractionError";
|
|
101
|
+
}>, Schema.TaggedStruct<"GraphqlExtractionError", {
|
|
102
|
+
readonly message: Schema.String;
|
|
103
|
+
}>, never, never>>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"updateSource", "PATCH", "/scopes/:scopeId/graphql/sources/:namespace", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
104
|
+
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
105
|
+
namespace: Schema.String;
|
|
106
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
107
|
+
readonly name: Schema.optional<Schema.String>;
|
|
108
|
+
readonly endpoint: Schema.optional<Schema.String>;
|
|
109
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
110
|
+
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
111
|
+
readonly auth: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
112
|
+
readonly kind: Schema.Literal<"none">;
|
|
113
|
+
}>, Schema.Struct<{
|
|
114
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
115
|
+
readonly connectionId: Schema.String;
|
|
116
|
+
}>]>>;
|
|
117
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
118
|
+
readonly updated: Schema.Boolean;
|
|
119
|
+
}>>, HttpApiEndpoint.Json<typeof InternalError | Schema.decodeTo<Schema.declareConstructor<GraphqlIntrospectionError, {
|
|
120
|
+
readonly message: string;
|
|
121
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
122
|
+
}, readonly [Schema.TaggedStruct<"GraphqlIntrospectionError", {
|
|
123
|
+
readonly message: Schema.String;
|
|
124
|
+
}>], {
|
|
125
|
+
readonly message: string;
|
|
126
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
127
|
+
}>, Schema.TaggedStruct<"GraphqlIntrospectionError", {
|
|
128
|
+
readonly message: Schema.String;
|
|
129
|
+
}>, never, never> | Schema.decodeTo<Schema.declareConstructor<GraphqlExtractionError, {
|
|
130
|
+
readonly message: string;
|
|
131
|
+
readonly _tag: "GraphqlExtractionError";
|
|
132
|
+
}, readonly [Schema.TaggedStruct<"GraphqlExtractionError", {
|
|
133
|
+
readonly message: Schema.String;
|
|
134
|
+
}>], {
|
|
135
|
+
readonly message: string;
|
|
136
|
+
readonly _tag: "GraphqlExtractionError";
|
|
137
|
+
}>, Schema.TaggedStruct<"GraphqlExtractionError", {
|
|
138
|
+
readonly message: Schema.String;
|
|
139
|
+
}>, never, never>>, never, never>, false>;
|
package/dist/api/handlers.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context } from "effect";
|
|
2
2
|
import type { GraphqlPluginExtension } from "../sdk/plugin";
|
|
3
|
-
declare const GraphqlExtensionService_base: Context.
|
|
3
|
+
declare const GraphqlExtensionService_base: Context.ServiceClass<GraphqlExtensionService, "GraphqlExtensionService", GraphqlPluginExtension>;
|
|
4
4
|
export declare class GraphqlExtensionService extends GraphqlExtensionService_base {
|
|
5
5
|
}
|
|
6
|
-
export declare const GraphqlHandlers: import("effect/Layer").Layer<import("
|
|
6
|
+
export declare const GraphqlHandlers: import("effect/Layer").Layer<import("effect/unstable/httpapi/HttpApiGroup").ApiGroup<"executor", "graphql">, never, import("effect/unstable/http/HttpRouter").Request<"Requires", GraphqlExtensionService>>;
|
|
7
7
|
export {};
|