@executor-js/plugin-graphql 0.1.0 → 0.2.1

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 (37) hide show
  1. package/dist/AddGraphqlSource-LGXJQEAR.js +239 -0
  2. package/dist/AddGraphqlSource-LGXJQEAR.js.map +1 -0
  3. package/dist/EditGraphqlSource-5Y47ZAZ7.js +251 -0
  4. package/dist/EditGraphqlSource-5Y47ZAZ7.js.map +1 -0
  5. package/dist/GraphqlSourceSummary-F3JWR4YN.js +70 -0
  6. package/dist/GraphqlSourceSummary-F3JWR4YN.js.map +1 -0
  7. package/dist/api/group.d.ts +169 -13
  8. package/dist/api/handlers.d.ts +15 -3
  9. package/dist/api/index.d.ts +410 -0
  10. package/dist/chunk-7QSGNR4C.js +162 -0
  11. package/dist/chunk-7QSGNR4C.js.map +1 -0
  12. package/dist/chunk-HDPYOBBG.js +1633 -0
  13. package/dist/chunk-HDPYOBBG.js.map +1 -0
  14. package/dist/chunk-M4SJY6CB.js +45 -0
  15. package/dist/chunk-M4SJY6CB.js.map +1 -0
  16. package/dist/chunk-WPRU5C6M.js +182 -0
  17. package/dist/chunk-WPRU5C6M.js.map +1 -0
  18. package/dist/client.js +75 -0
  19. package/dist/client.js.map +1 -0
  20. package/dist/core.js +32 -10
  21. package/dist/index.js +2 -1
  22. package/dist/react/GraphqlSourceFields.d.ts +8 -0
  23. package/dist/react/GraphqlSourceSummary.d.ts +3 -1
  24. package/dist/react/atoms.d.ts +170 -10
  25. package/dist/react/client.d.ts +164 -12
  26. package/dist/sdk/index.d.ts +1 -1
  27. package/dist/sdk/introspect.d.ts +437 -43
  28. package/dist/sdk/invoke.d.ts +3 -2
  29. package/dist/sdk/plugin.d.ts +120 -170
  30. package/dist/sdk/store.d.ts +84 -11
  31. package/dist/sdk/types.d.ts +107 -3
  32. package/dist/testing/index.d.ts +52 -0
  33. package/dist/testing.js +131 -0
  34. package/dist/testing.js.map +1 -0
  35. package/package.json +18 -4
  36. package/dist/chunk-EIC5WI6C.js +0 -1225
  37. package/dist/chunk-EIC5WI6C.js.map +0 -1
@@ -1,13 +1,13 @@
1
1
  import { Effect } from "effect";
2
2
  import type { Layer } from "effect";
3
3
  import { HttpClient } from "effect/unstable/http";
4
- import { GraphqlExtensionService } from "../api/handlers";
5
- import { type StorageFailure } from "@executor-js/sdk/core";
4
+ import { type PluginCtx, type StorageFailure } from "@executor-js/sdk/core";
6
5
  import { type ConfigFileSink } from "@executor-js/config";
7
- import { GraphqlExtractionError, GraphqlIntrospectionError } from "./errors";
6
+ import { GraphqlIntrospectionError } from "./errors";
8
7
  import { type GraphqlStore, type StoredGraphqlSource } from "./store";
9
- import { type GraphqlSourceAuth, type HeaderValue as HeaderValueValue, type QueryParamValue } from "./types";
8
+ import { GraphqlSourceBindingInput, GraphqlSourceBindingRef, type ConfiguredGraphqlCredentialValue, type GraphqlCredentialInput, type HeaderValue as HeaderValueValue, type GraphqlSourceAuthInput } from "./types";
10
9
  export type HeaderValue = HeaderValueValue;
10
+ export type GraphqlCredentialValue = ConfiguredGraphqlCredentialValue;
11
11
  export interface GraphqlSourceConfig {
12
12
  /** The GraphQL endpoint URL */
13
13
  readonly endpoint: string;
@@ -24,50 +24,25 @@ export interface GraphqlSourceConfig {
24
24
  readonly introspectionJson?: string;
25
25
  /** Namespace for the tools (derived from endpoint if not provided) */
26
26
  readonly namespace?: string;
27
- /** Headers applied to every request. Values can reference secrets. */
28
- readonly headers?: Record<string, HeaderValue>;
29
- /** Query parameters applied to every request. Values can reference secrets. */
30
- readonly queryParams?: Record<string, QueryParamValue>;
31
- /** Optional OAuth2 connection used as a Bearer token for every request. */
32
- readonly auth?: GraphqlSourceAuth;
27
+ /** Headers applied to every request. Direct secrets are rewritten to slots. */
28
+ readonly headers?: Record<string, GraphqlCredentialInput>;
29
+ /** Query parameters applied to every request. Direct secrets are rewritten to slots. */
30
+ readonly queryParams?: Record<string, GraphqlCredentialInput>;
31
+ /**
32
+ * Scope that owns any direct credentials supplied on this call. Required
33
+ * whenever headers/queryParams/auth carry direct secret or connection ids.
34
+ */
35
+ readonly credentialTargetScope?: string;
36
+ /** Optional OAuth2 credential used as a Bearer token for every request. */
37
+ readonly auth?: GraphqlSourceAuthInput;
33
38
  }
34
39
  export interface GraphqlUpdateSourceInput {
35
40
  readonly name?: string;
36
41
  readonly endpoint?: string;
37
- readonly headers?: Record<string, HeaderValue>;
38
- readonly queryParams?: Record<string, QueryParamValue>;
39
- readonly auth?: GraphqlSourceAuth;
40
- }
41
- /**
42
- * Errors any GraphQL extension method may surface. `GraphqlIntrospectionError`
43
- * and `GraphqlExtractionError` are plugin-domain tagged errors that flow
44
- * directly to clients (4xx, each carrying its own `HttpApiSchema` status).
45
- * `StorageFailure` covers raw backend failures (`StorageError` plus
46
- * `UniqueViolationError`); the HTTP edge (`@executor-js/api`'s `withCapture`)
47
- * translates `StorageError` to the opaque `InternalError({ traceId })` at
48
- * Layer composition.
49
- */
50
- export type GraphqlExtensionFailure = GraphqlIntrospectionError | GraphqlExtractionError | StorageFailure;
51
- export interface GraphqlPluginExtension {
52
- /** Add a GraphQL endpoint and register its operations as tools */
53
- readonly addSource: (config: GraphqlSourceConfig) => Effect.Effect<{
54
- readonly toolCount: number;
55
- readonly namespace: string;
56
- }, GraphqlExtensionFailure>;
57
- /** Remove all tools from a previously added GraphQL source by namespace.
58
- * `scope` pins the cleanup to the exact row — without it a shadowed
59
- * outer-scope source with the same namespace could be wiped instead. */
60
- readonly removeSource: (namespace: string, scope: string) => Effect.Effect<void, StorageFailure>;
61
- /** Fetch the full stored source by namespace (or null if missing).
62
- * `scope` returns the exact row at that scope. For fall-through
63
- * reads across the executor's scope stack, use `executor.sources.*`. */
64
- readonly getSource: (namespace: string, scope: string) => Effect.Effect<StoredGraphqlSource | null, StorageFailure>;
65
- /** Update config (endpoint, headers) for an existing GraphQL source.
66
- * Does NOT re-introspect or re-register tools — just patches the
67
- * stored endpoint/headers used at invoke time. `scope` pins the
68
- * mutation to a single row so shadowed rows at other scopes are
69
- * untouched. */
70
- readonly updateSource: (namespace: string, scope: string, input: GraphqlUpdateSourceInput) => Effect.Effect<void, StorageFailure>;
42
+ readonly headers?: Record<string, GraphqlCredentialInput>;
43
+ readonly queryParams?: Record<string, GraphqlCredentialInput>;
44
+ readonly credentialTargetScope?: string;
45
+ readonly auth?: GraphqlSourceAuthInput;
71
46
  }
72
47
  export interface GraphqlPluginOptions {
73
48
  readonly httpClientLayer?: Layer.Layer<HttpClient.HttpClient>;
@@ -75,14 +50,30 @@ export interface GraphqlPluginOptions {
75
50
  * (best-effort — file errors are logged, not raised). */
76
51
  readonly configFile?: ConfigFileSink;
77
52
  }
53
+ declare const makeGraphqlExtension: (ctx: PluginCtx<GraphqlStore>, httpClientLayer: Layer.Layer<HttpClient.HttpClient>, configFile: ConfigFileSink | undefined) => {
54
+ addSource: (config: GraphqlSourceConfig) => Effect.Effect<{
55
+ toolCount: number;
56
+ namespace: string;
57
+ }, StorageFailure | GraphqlIntrospectionError | import("./errors").GraphqlExtractionError, never>;
58
+ removeSource: (namespace: string, scope: string) => Effect.Effect<void, StorageFailure, never>;
59
+ getSource: (namespace: string, scope: string) => Effect.Effect<StoredGraphqlSource | null, StorageFailure, never>;
60
+ updateSource: (namespace: string, scope: string, input: GraphqlUpdateSourceInput) => Effect.Effect<void, StorageFailure | GraphqlIntrospectionError, never>;
61
+ listSourceBindings: (sourceId: string, sourceScope: string) => Effect.Effect<readonly GraphqlSourceBindingRef[], StorageFailure, never>;
62
+ setSourceBinding: (input: GraphqlSourceBindingInput) => Effect.Effect<GraphqlSourceBindingRef, StorageFailure, never>;
63
+ removeSourceBinding: (sourceId: string, sourceScope: string, slot: string, scope: string) => Effect.Effect<void, StorageFailure, never>;
64
+ };
65
+ export type GraphqlPluginExtension = ReturnType<typeof makeGraphqlExtension>;
78
66
  export declare const graphqlPlugin: import("@executor-js/sdk/core").ConfiguredPlugin<"graphql", {
79
67
  addSource: (config: GraphqlSourceConfig) => Effect.Effect<{
80
- readonly toolCount: number;
81
- readonly namespace: string;
82
- }, StorageFailure | GraphqlIntrospectionError | GraphqlExtractionError, never>;
68
+ toolCount: number;
69
+ namespace: string;
70
+ }, StorageFailure | GraphqlIntrospectionError | import("./errors").GraphqlExtractionError, never>;
83
71
  removeSource: (namespace: string, scope: string) => Effect.Effect<void, StorageFailure, never>;
84
72
  getSource: (namespace: string, scope: string) => Effect.Effect<StoredGraphqlSource | null, StorageFailure, never>;
85
- updateSource: (namespace: string, scope: string, input: GraphqlUpdateSourceInput) => Effect.Effect<void, StorageFailure, never>;
73
+ updateSource: (namespace: string, scope: string, input: GraphqlUpdateSourceInput) => Effect.Effect<void, StorageFailure | GraphqlIntrospectionError, never>;
74
+ listSourceBindings: (sourceId: string, sourceScope: string) => Effect.Effect<readonly GraphqlSourceBindingRef[], StorageFailure, never>;
75
+ setSourceBinding: (input: GraphqlSourceBindingInput) => Effect.Effect<GraphqlSourceBindingRef, StorageFailure, never>;
76
+ removeSourceBinding: (sourceId: string, sourceScope: string, slot: string, scope: string) => Effect.Effect<void, StorageFailure, never>;
86
77
  }, GraphqlStore, GraphqlPluginOptions, {
87
78
  readonly graphql_source: {
88
79
  readonly fields: {
@@ -103,16 +94,89 @@ export declare const graphqlPlugin: import("@executor-js/sdk/core").ConfiguredPl
103
94
  readonly type: "string";
104
95
  readonly required: true;
105
96
  };
106
- readonly headers: {
107
- readonly type: "json";
97
+ readonly auth_kind: {
98
+ readonly type: ["none", "oauth2"];
99
+ readonly required: true;
100
+ readonly defaultValue: "none";
101
+ };
102
+ readonly auth_connection_slot: {
103
+ readonly type: "string";
108
104
  readonly required: false;
109
105
  };
110
- readonly query_params: {
111
- readonly type: "json";
106
+ };
107
+ };
108
+ readonly graphql_source_header: {
109
+ readonly fields: {
110
+ readonly id: {
111
+ readonly type: "string";
112
+ readonly required: true;
113
+ };
114
+ readonly scope_id: {
115
+ readonly type: "string";
116
+ readonly required: true;
117
+ readonly index: true;
118
+ };
119
+ readonly source_id: {
120
+ readonly type: "string";
121
+ readonly required: true;
122
+ readonly index: true;
123
+ };
124
+ readonly name: {
125
+ readonly type: "string";
126
+ readonly required: true;
127
+ };
128
+ readonly kind: {
129
+ readonly type: ["text", "binding"];
130
+ readonly required: true;
131
+ };
132
+ readonly text_value: {
133
+ readonly type: "string";
112
134
  readonly required: false;
113
135
  };
114
- readonly auth: {
115
- readonly type: "json";
136
+ readonly slot_key: {
137
+ readonly type: "string";
138
+ readonly required: false;
139
+ };
140
+ readonly prefix: {
141
+ readonly type: "string";
142
+ readonly required: false;
143
+ };
144
+ };
145
+ };
146
+ readonly graphql_source_query_param: {
147
+ readonly fields: {
148
+ readonly id: {
149
+ readonly type: "string";
150
+ readonly required: true;
151
+ };
152
+ readonly scope_id: {
153
+ readonly type: "string";
154
+ readonly required: true;
155
+ readonly index: true;
156
+ };
157
+ readonly source_id: {
158
+ readonly type: "string";
159
+ readonly required: true;
160
+ readonly index: true;
161
+ };
162
+ readonly name: {
163
+ readonly type: "string";
164
+ readonly required: true;
165
+ };
166
+ readonly kind: {
167
+ readonly type: ["text", "binding"];
168
+ readonly required: true;
169
+ };
170
+ readonly text_value: {
171
+ readonly type: "string";
172
+ readonly required: false;
173
+ };
174
+ readonly slot_key: {
175
+ readonly type: "string";
176
+ readonly required: false;
177
+ };
178
+ readonly prefix: {
179
+ readonly type: "string";
116
180
  readonly required: false;
117
181
  };
118
182
  };
@@ -139,119 +203,5 @@ export declare const graphqlPlugin: import("@executor-js/sdk/core").ConfiguredPl
139
203
  };
140
204
  };
141
205
  };
142
- }, typeof GraphqlExtensionService, Layer.Layer<import("effect/unstable/httpapi/HttpApiGroup").ApiGroup<"executor", "graphql">, never, import("effect/unstable/http/HttpRouter").Request<"Requires", GraphqlExtensionService>>, import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"graphql", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"addSource", "POST", "/scopes/:scopeId/graphql/sources", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
143
- scopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
144
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
145
- readonly endpoint: import("effect/Schema").String;
146
- readonly name: import("effect/Schema").optional<import("effect/Schema").String>;
147
- readonly introspectionJson: import("effect/Schema").optional<import("effect/Schema").String>;
148
- readonly namespace: import("effect/Schema").optional<import("effect/Schema").String>;
149
- readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>;
150
- readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>;
151
- readonly auth: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
152
- readonly kind: import("effect/Schema").Literal<"none">;
153
- }>, import("effect/Schema").Struct<{
154
- readonly kind: import("effect/Schema").Literal<"oauth2">;
155
- readonly connectionId: import("effect/Schema").String;
156
- }>]>>;
157
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
158
- readonly toolCount: import("effect/Schema").Number;
159
- readonly namespace: import("effect/Schema").String;
160
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/api").InternalError | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<GraphqlIntrospectionError, {
161
- readonly message: string;
162
- readonly _tag: "GraphqlIntrospectionError";
163
- }, readonly [import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
164
- readonly message: import("effect/Schema").String;
165
- }>], {
166
- readonly message: string;
167
- readonly _tag: "GraphqlIntrospectionError";
168
- }>, import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
169
- readonly message: import("effect/Schema").String;
170
- }>, never, never> | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<GraphqlExtractionError, {
171
- readonly message: string;
172
- readonly _tag: "GraphqlExtractionError";
173
- }, readonly [import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
174
- readonly message: import("effect/Schema").String;
175
- }>], {
176
- readonly message: string;
177
- readonly _tag: "GraphqlExtractionError";
178
- }>, import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
179
- readonly message: import("effect/Schema").String;
180
- }>, never, never>>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getSource", "GET", "/scopes/:scopeId/graphql/sources/:namespace", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
181
- scopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
182
- namespace: import("effect/Schema").String;
183
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").NullOr<import("effect/Schema").Struct<{
184
- readonly namespace: import("effect/Schema").String;
185
- readonly name: import("effect/Schema").String;
186
- readonly endpoint: import("effect/Schema").String;
187
- readonly headers: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Struct<{
188
- readonly secretId: import("effect/Schema").String;
189
- readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
190
- }>]>>;
191
- readonly queryParams: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Struct<{
192
- readonly secretId: import("effect/Schema").String;
193
- readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
194
- }>]>>;
195
- readonly auth: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
196
- readonly kind: import("effect/Schema").Literal<"none">;
197
- }>, import("effect/Schema").Struct<{
198
- readonly kind: import("effect/Schema").Literal<"oauth2">;
199
- readonly connectionId: import("effect/Schema").String;
200
- }>]>;
201
- }>>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/api").InternalError | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<GraphqlIntrospectionError, {
202
- readonly message: string;
203
- readonly _tag: "GraphqlIntrospectionError";
204
- }, readonly [import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
205
- readonly message: import("effect/Schema").String;
206
- }>], {
207
- readonly message: string;
208
- readonly _tag: "GraphqlIntrospectionError";
209
- }>, import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
210
- readonly message: import("effect/Schema").String;
211
- }>, never, never> | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<GraphqlExtractionError, {
212
- readonly message: string;
213
- readonly _tag: "GraphqlExtractionError";
214
- }, readonly [import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
215
- readonly message: import("effect/Schema").String;
216
- }>], {
217
- readonly message: string;
218
- readonly _tag: "GraphqlExtractionError";
219
- }>, import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
220
- readonly message: import("effect/Schema").String;
221
- }>, never, never>>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"updateSource", "PATCH", "/scopes/:scopeId/graphql/sources/:namespace", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
222
- scopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
223
- namespace: import("effect/Schema").String;
224
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
225
- readonly name: import("effect/Schema").optional<import("effect/Schema").String>;
226
- readonly endpoint: import("effect/Schema").optional<import("effect/Schema").String>;
227
- readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>;
228
- readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>;
229
- readonly auth: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
230
- readonly kind: import("effect/Schema").Literal<"none">;
231
- }>, import("effect/Schema").Struct<{
232
- readonly kind: import("effect/Schema").Literal<"oauth2">;
233
- readonly connectionId: import("effect/Schema").String;
234
- }>]>>;
235
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
236
- readonly updated: import("effect/Schema").Boolean;
237
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/api").InternalError | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<GraphqlIntrospectionError, {
238
- readonly message: string;
239
- readonly _tag: "GraphqlIntrospectionError";
240
- }, readonly [import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
241
- readonly message: import("effect/Schema").String;
242
- }>], {
243
- readonly message: string;
244
- readonly _tag: "GraphqlIntrospectionError";
245
- }>, import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
246
- readonly message: import("effect/Schema").String;
247
- }>, never, never> | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<GraphqlExtractionError, {
248
- readonly message: string;
249
- readonly _tag: "GraphqlExtractionError";
250
- }, readonly [import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
251
- readonly message: import("effect/Schema").String;
252
- }>], {
253
- readonly message: string;
254
- readonly _tag: "GraphqlExtractionError";
255
- }>, import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
256
- readonly message: import("effect/Schema").String;
257
- }>, never, never>>, never, never>, false>>;
206
+ }, undefined, Layer.Layer<unknown, never, never>, import("effect/unstable/httpapi/HttpApiGroup").Any>;
207
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { Effect } from "effect";
2
2
  import { type StorageDeps, type StorageFailure } from "@executor-js/sdk/core";
3
- import { OperationBinding, type GraphqlSourceAuth, type HeaderValue, type QueryParamValue } from "./types";
3
+ import { OperationBinding, type ConfiguredGraphqlCredentialValue, type GraphqlSourceAuth } from "./types";
4
4
  export declare const graphqlSchema: {
5
5
  readonly graphql_source: {
6
6
  readonly fields: {
@@ -21,16 +21,89 @@ export declare const graphqlSchema: {
21
21
  readonly type: "string";
22
22
  readonly required: true;
23
23
  };
24
- readonly headers: {
25
- readonly type: "json";
24
+ readonly auth_kind: {
25
+ readonly type: ["none", "oauth2"];
26
+ readonly required: true;
27
+ readonly defaultValue: "none";
28
+ };
29
+ readonly auth_connection_slot: {
30
+ readonly type: "string";
26
31
  readonly required: false;
27
32
  };
28
- readonly query_params: {
29
- readonly type: "json";
33
+ };
34
+ };
35
+ readonly graphql_source_header: {
36
+ readonly fields: {
37
+ readonly id: {
38
+ readonly type: "string";
39
+ readonly required: true;
40
+ };
41
+ readonly scope_id: {
42
+ readonly type: "string";
43
+ readonly required: true;
44
+ readonly index: true;
45
+ };
46
+ readonly source_id: {
47
+ readonly type: "string";
48
+ readonly required: true;
49
+ readonly index: true;
50
+ };
51
+ readonly name: {
52
+ readonly type: "string";
53
+ readonly required: true;
54
+ };
55
+ readonly kind: {
56
+ readonly type: ["text", "binding"];
57
+ readonly required: true;
58
+ };
59
+ readonly text_value: {
60
+ readonly type: "string";
30
61
  readonly required: false;
31
62
  };
32
- readonly auth: {
33
- readonly type: "json";
63
+ readonly slot_key: {
64
+ readonly type: "string";
65
+ readonly required: false;
66
+ };
67
+ readonly prefix: {
68
+ readonly type: "string";
69
+ readonly required: false;
70
+ };
71
+ };
72
+ };
73
+ readonly graphql_source_query_param: {
74
+ readonly fields: {
75
+ readonly id: {
76
+ readonly type: "string";
77
+ readonly required: true;
78
+ };
79
+ readonly scope_id: {
80
+ readonly type: "string";
81
+ readonly required: true;
82
+ readonly index: true;
83
+ };
84
+ readonly source_id: {
85
+ readonly type: "string";
86
+ readonly required: true;
87
+ readonly index: true;
88
+ };
89
+ readonly name: {
90
+ readonly type: "string";
91
+ readonly required: true;
92
+ };
93
+ readonly kind: {
94
+ readonly type: ["text", "binding"];
95
+ readonly required: true;
96
+ };
97
+ readonly text_value: {
98
+ readonly type: "string";
99
+ readonly required: false;
100
+ };
101
+ readonly slot_key: {
102
+ readonly type: "string";
103
+ readonly required: false;
104
+ };
105
+ readonly prefix: {
106
+ readonly type: "string";
34
107
  readonly required: false;
35
108
  };
36
109
  };
@@ -67,8 +140,8 @@ export interface StoredGraphqlSource {
67
140
  readonly scope: string;
68
141
  readonly name: string;
69
142
  readonly endpoint: string;
70
- readonly headers: Record<string, HeaderValue>;
71
- readonly queryParams: Record<string, QueryParamValue>;
143
+ readonly headers: Record<string, ConfiguredGraphqlCredentialValue>;
144
+ readonly queryParams: Record<string, ConfiguredGraphqlCredentialValue>;
72
145
  readonly auth: GraphqlSourceAuth;
73
146
  }
74
147
  export interface StoredOperation {
@@ -81,8 +154,8 @@ export interface GraphqlStore {
81
154
  readonly updateSourceMeta: (namespace: string, scope: string, patch: {
82
155
  readonly name?: string;
83
156
  readonly endpoint?: string;
84
- readonly headers?: Record<string, HeaderValue>;
85
- readonly queryParams?: Record<string, QueryParamValue>;
157
+ readonly headers?: Record<string, ConfiguredGraphqlCredentialValue>;
158
+ readonly queryParams?: Record<string, ConfiguredGraphqlCredentialValue>;
86
159
  readonly auth?: GraphqlSourceAuth;
87
160
  }) => Effect.Effect<void, StorageFailure>;
88
161
  readonly getSource: (namespace: string, scope: string) => Effect.Effect<StoredGraphqlSource | null, StorageFailure>;
@@ -50,24 +50,128 @@ export declare const QueryParamValue: Schema.Union<readonly [Schema.String, Sche
50
50
  readonly prefix: Schema.optional<Schema.String>;
51
51
  }>]>;
52
52
  export type QueryParamValue = typeof QueryParamValue.Type;
53
+ export declare const ConfiguredGraphqlCredentialValue: Schema.Union<readonly [Schema.String, Schema.Struct<{
54
+ readonly kind: Schema.Literal<"binding">;
55
+ readonly slot: Schema.String;
56
+ readonly prefix: Schema.optional<Schema.String>;
57
+ }>]>;
58
+ export type ConfiguredGraphqlCredentialValue = typeof ConfiguredGraphqlCredentialValue.Type;
59
+ export declare const GraphqlCredentialInput: Schema.Union<readonly [Schema.Struct<{
60
+ readonly secretId: Schema.String;
61
+ readonly prefix: Schema.optional<Schema.String>;
62
+ readonly targetScope: Schema.brand<Schema.String, "ScopeId">;
63
+ readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
64
+ }>, Schema.Union<readonly [Schema.String, Schema.Struct<{
65
+ readonly secretId: Schema.String;
66
+ readonly prefix: Schema.optional<Schema.String>;
67
+ }>]>, Schema.Union<readonly [Schema.String, Schema.Struct<{
68
+ readonly kind: Schema.Literal<"binding">;
69
+ readonly slot: Schema.String;
70
+ readonly prefix: Schema.optional<Schema.String>;
71
+ }>]>]>;
72
+ export type GraphqlCredentialInput = typeof GraphqlCredentialInput.Type;
73
+ export declare const graphqlHeaderSlot: (name: string) => string;
74
+ export declare const graphqlQueryParamSlot: (name: string) => string;
75
+ export declare const GRAPHQL_OAUTH_CONNECTION_SLOT = "auth:oauth2:connection";
53
76
  export declare const GraphqlSourceAuth: Schema.Union<readonly [Schema.Struct<{
54
77
  readonly kind: Schema.Literal<"none">;
55
78
  }>, Schema.Struct<{
56
79
  readonly kind: Schema.Literal<"oauth2">;
57
- readonly connectionId: Schema.String;
80
+ readonly connectionSlot: Schema.String;
58
81
  }>]>;
59
82
  export type GraphqlSourceAuth = typeof GraphqlSourceAuth.Type;
83
+ export declare const GraphqlSourceAuthInput: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
84
+ readonly kind: Schema.Literal<"none">;
85
+ }>, Schema.Struct<{
86
+ readonly kind: Schema.Literal<"oauth2">;
87
+ readonly connectionSlot: Schema.String;
88
+ }>]>, Schema.Struct<{
89
+ readonly kind: Schema.Literal<"oauth2">;
90
+ readonly connectionId: Schema.String;
91
+ }>]>;
92
+ export type GraphqlSourceAuthInput = typeof GraphqlSourceAuthInput.Type;
93
+ export declare const GraphqlSourceBindingValue: Schema.Union<readonly [Schema.Struct<{
94
+ readonly kind: Schema.Literal<"text">;
95
+ readonly text: Schema.String;
96
+ }>, Schema.Struct<{
97
+ readonly kind: Schema.Literal<"secret">;
98
+ readonly secretId: Schema.brand<Schema.String, "SecretId">;
99
+ readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
100
+ }>, Schema.Struct<{
101
+ readonly kind: Schema.Literal<"connection">;
102
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
103
+ }>]>;
104
+ export type GraphqlSourceBindingValue = typeof GraphqlSourceBindingValue.Type;
105
+ export declare const GraphqlSourceBindingInputSchema: Schema.Struct<{
106
+ readonly sourceId: Schema.String;
107
+ readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
108
+ readonly scope: Schema.brand<Schema.String, "ScopeId">;
109
+ readonly slot: Schema.String;
110
+ readonly value: Schema.Union<readonly [Schema.Struct<{
111
+ readonly kind: Schema.Literal<"text">;
112
+ readonly text: Schema.String;
113
+ }>, Schema.Struct<{
114
+ readonly kind: Schema.Literal<"secret">;
115
+ readonly secretId: Schema.brand<Schema.String, "SecretId">;
116
+ readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
117
+ }>, Schema.Struct<{
118
+ readonly kind: Schema.Literal<"connection">;
119
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
120
+ }>]>;
121
+ }>;
122
+ declare const GraphqlSourceBindingInput_base: Schema.Class<GraphqlSourceBindingInput, Schema.Struct<{
123
+ readonly sourceId: Schema.String;
124
+ readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
125
+ readonly scope: Schema.brand<Schema.String, "ScopeId">;
126
+ readonly slot: Schema.String;
127
+ readonly value: Schema.Union<readonly [Schema.Struct<{
128
+ readonly kind: Schema.Literal<"text">;
129
+ readonly text: Schema.String;
130
+ }>, Schema.Struct<{
131
+ readonly kind: Schema.Literal<"secret">;
132
+ readonly secretId: Schema.brand<Schema.String, "SecretId">;
133
+ readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
134
+ }>, Schema.Struct<{
135
+ readonly kind: Schema.Literal<"connection">;
136
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
137
+ }>]>;
138
+ }>, {}>;
139
+ export declare class GraphqlSourceBindingInput extends GraphqlSourceBindingInput_base {
140
+ }
141
+ declare const GraphqlSourceBindingRef_base: Schema.Class<GraphqlSourceBindingRef, Schema.Struct<{
142
+ readonly sourceId: Schema.String;
143
+ readonly sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
144
+ readonly scopeId: Schema.brand<Schema.String, "ScopeId">;
145
+ readonly slot: Schema.String;
146
+ readonly value: Schema.Union<readonly [Schema.Struct<{
147
+ readonly kind: Schema.Literal<"text">;
148
+ readonly text: Schema.String;
149
+ }>, Schema.Struct<{
150
+ readonly kind: Schema.Literal<"secret">;
151
+ readonly secretId: Schema.brand<Schema.String, "SecretId">;
152
+ readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
153
+ }>, Schema.Struct<{
154
+ readonly kind: Schema.Literal<"connection">;
155
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
156
+ }>]>;
157
+ readonly createdAt: Schema.Date;
158
+ readonly updatedAt: Schema.Date;
159
+ }>, {}>;
160
+ export declare class GraphqlSourceBindingRef extends GraphqlSourceBindingRef_base {
161
+ }
60
162
  declare const InvocationConfig_base: Schema.Class<InvocationConfig, Schema.Struct<{
61
163
  /** The GraphQL endpoint URL */
62
164
  readonly endpoint: Schema.String;
63
165
  /** Headers applied to every request. Values can reference secrets. */
64
166
  readonly headers: Schema.withConstructorDefault<Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
65
- readonly secretId: Schema.String;
167
+ readonly kind: Schema.Literal<"binding">;
168
+ readonly slot: Schema.String;
66
169
  readonly prefix: Schema.optional<Schema.String>;
67
170
  }>]>>>>;
68
171
  /** Query parameters applied to every request. Values can reference secrets. */
69
172
  readonly queryParams: Schema.withConstructorDefault<Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
70
- readonly secretId: Schema.String;
173
+ readonly kind: Schema.Literal<"binding">;
174
+ readonly slot: Schema.String;
71
175
  readonly prefix: Schema.optional<Schema.String>;
72
176
  }>]>>>>;
73
177
  }>, {}>;
@@ -0,0 +1,52 @@
1
+ import { Context, Effect, Layer, Schema as EffectSchema, Scope } from "effect";
2
+ import { GraphQLSchema } from "graphql";
3
+ declare const GraphqlRequestPayload: EffectSchema.Struct<{
4
+ readonly query: EffectSchema.optional<EffectSchema.String>;
5
+ readonly variables: EffectSchema.optional<EffectSchema.$Record<EffectSchema.String, EffectSchema.Unknown>>;
6
+ readonly operationName: EffectSchema.optional<EffectSchema.NullOr<EffectSchema.String>>;
7
+ }>;
8
+ type GraphqlRequestPayload = typeof GraphqlRequestPayload.Type;
9
+ export interface GraphqlTestRequest {
10
+ readonly url: string;
11
+ readonly method: string;
12
+ readonly path: string;
13
+ readonly headers: Readonly<Record<string, string>>;
14
+ readonly payload: GraphqlRequestPayload;
15
+ }
16
+ export interface GraphqlTestContext {
17
+ readonly request: GraphqlTestRequest;
18
+ }
19
+ export interface GraphqlTestServerOptions {
20
+ readonly schema: GraphQLSchema;
21
+ readonly path?: string;
22
+ }
23
+ export interface GraphqlTestServerShape {
24
+ readonly endpoint: string;
25
+ readonly schema: GraphQLSchema;
26
+ readonly requests: Effect.Effect<readonly GraphqlTestRequest[]>;
27
+ readonly clearRequests: Effect.Effect<void>;
28
+ }
29
+ declare const GraphqlTestServerAddressError_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 & {
30
+ readonly _tag: "GraphqlTestServerAddressError";
31
+ } & Readonly<A>;
32
+ declare class GraphqlTestServerAddressError extends GraphqlTestServerAddressError_base<{
33
+ readonly address: unknown;
34
+ }> {
35
+ }
36
+ declare const GraphqlTestServerHandlerError_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 & {
37
+ readonly _tag: "GraphqlTestServerHandlerError";
38
+ } & Readonly<A>;
39
+ declare class GraphqlTestServerHandlerError extends GraphqlTestServerHandlerError_base<{
40
+ readonly cause: unknown;
41
+ }> {
42
+ }
43
+ export declare const serveGraphqlTestServer: (options: GraphqlTestServerOptions) => Effect.Effect<GraphqlTestServerShape, GraphqlTestServerAddressError | GraphqlTestServerHandlerError, Scope.Scope>;
44
+ declare const GraphqlTestServer_base: Context.ServiceClass<GraphqlTestServer, "@executor-js/plugin-graphql/testing/GraphqlTestServer", GraphqlTestServerShape>;
45
+ export declare class GraphqlTestServer extends GraphqlTestServer_base {
46
+ static readonly layer: (options: GraphqlTestServerOptions) => Layer.Layer<GraphqlTestServer, GraphqlTestServerAddressError | GraphqlTestServerHandlerError, never>;
47
+ }
48
+ export declare const makeGreetingGraphqlSchema: () => GraphQLSchema;
49
+ export declare const TestLayers: {
50
+ greeting: () => Layer.Layer<GraphqlTestServer, GraphqlTestServerAddressError | GraphqlTestServerHandlerError, never>;
51
+ };
52
+ export {};