@executor-js/plugin-graphql 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.
- package/README.md +25 -14
- package/dist/api/group.d.ts +138 -33
- package/dist/api/handlers.d.ts +2 -2
- package/dist/chunk-EIC5WI6C.js +1225 -0
- package/dist/chunk-EIC5WI6C.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 +116 -3
- package/dist/react/defaults.d.ts +2 -0
- package/dist/react/plugin-client.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 +231 -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-AC5VPNLE.js +0 -916
- package/dist/chunk-AC5VPNLE.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 -31
- package/dist/sdk/plugin.test.d.ts +0 -1
- package/dist/sdk/stored-source.d.ts +0 -51
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export { introspect, parseIntrospectionJson } from "./introspect";
|
|
2
2
|
export { extract, type ExtractionOutput } from "./extract";
|
|
3
|
-
export { invoke,
|
|
4
|
-
export { graphqlPlugin, type GraphqlSourceConfig, type GraphqlPluginExtension } from "./plugin";
|
|
5
|
-
export { type
|
|
6
|
-
export { makeKvOperationStore, makeInMemoryOperationStore } from "./kv-operation-store";
|
|
7
|
-
export { withConfigFile } from "./config-file-store";
|
|
3
|
+
export { invoke, invokeWithLayer, resolveHeaders } from "./invoke";
|
|
4
|
+
export { graphqlPlugin, type GraphqlSourceConfig, type GraphqlPluginExtension, type GraphqlPluginOptions, type GraphqlUpdateSourceInput, } from "./plugin";
|
|
5
|
+
export { graphqlSchema, makeDefaultGraphqlStore, type GraphqlSchema, type GraphqlStore, type StoredGraphqlSource, type StoredOperation, } from "./store";
|
|
8
6
|
export { GraphqlIntrospectionError, GraphqlExtractionError, GraphqlInvocationError, } from "./errors";
|
|
9
|
-
export { ExtractedField, ExtractionResult, GraphqlArgument, GraphqlOperationKind, InvocationConfig, InvocationResult, OperationBinding, HeaderValue, } from "./types";
|
|
7
|
+
export { ExtractedField, ExtractionResult, GraphqlArgument, GraphqlOperationKind, GraphqlSourceAuth, InvocationConfig, InvocationResult, OperationBinding, HeaderValue, type QueryParamValue, } from "./types";
|
package/dist/sdk/introspect.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { HttpClient } from "
|
|
2
|
+
import { HttpClient } from "effect/unstable/http";
|
|
3
3
|
import { GraphqlIntrospectionError } from "./errors";
|
|
4
4
|
export interface IntrospectionTypeRef {
|
|
5
5
|
readonly kind: string;
|
|
@@ -42,5 +42,5 @@ export interface IntrospectionSchema {
|
|
|
42
42
|
export interface IntrospectionResult {
|
|
43
43
|
readonly __schema: IntrospectionSchema;
|
|
44
44
|
}
|
|
45
|
-
export declare const introspect: (endpoint: string, headers?: Record<string, string> | undefined) => Effect.Effect<IntrospectionResult, GraphqlIntrospectionError, HttpClient.HttpClient>;
|
|
45
|
+
export declare const introspect: (endpoint: string, headers?: Record<string, string> | undefined, queryParams?: Record<string, string> | undefined) => Effect.Effect<IntrospectionResult, GraphqlIntrospectionError, HttpClient.HttpClient>;
|
|
46
46
|
export declare const parseIntrospectionJson: (text: string) => Effect.Effect<IntrospectionResult, GraphqlIntrospectionError>;
|
package/dist/sdk/invoke.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { Effect, Layer } from "effect";
|
|
2
|
-
import { HttpClient } from "
|
|
3
|
-
import { type ToolInvoker, type ScopeId, type SecretId } from "@executor-js/sdk";
|
|
2
|
+
import { HttpClient } from "effect/unstable/http";
|
|
4
3
|
import { GraphqlInvocationError } from "./errors";
|
|
5
|
-
import type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
readonly secrets: {
|
|
12
|
-
readonly resolve: (secretId: SecretId, scopeId: ScopeId) => Effect.Effect<string, unknown>;
|
|
13
|
-
};
|
|
14
|
-
readonly scopeId: ScopeId;
|
|
15
|
-
}) => ToolInvoker;
|
|
4
|
+
import { type HeaderValue, type OperationBinding, InvocationResult } from "./types";
|
|
5
|
+
export declare const resolveHeaders: (headers: Record<string, HeaderValue>, secrets: {
|
|
6
|
+
readonly get: (id: string) => Effect.Effect<string | null, unknown>;
|
|
7
|
+
}) => Effect.Effect<Record<string, string>>;
|
|
8
|
+
export declare const invoke: (operation: OperationBinding, args: Record<string, unknown>, endpoint: string, resolvedHeaders: Record<string, string>, resolvedQueryParams?: Record<string, string> | undefined) => Effect.Effect<InvocationResult, GraphqlInvocationError | import("effect/unstable/http/HttpClientError").HttpClientError, HttpClient.HttpClient>;
|
|
9
|
+
export declare const invokeWithLayer: (operation: OperationBinding, args: Record<string, unknown>, endpoint: string, resolvedHeaders: Record<string, string>, resolvedQueryParams: Record<string, string>, httpClientLayer: Layer.Layer<HttpClient.HttpClient>) => Effect.Effect<InvocationResult, GraphqlInvocationError, never>;
|
package/dist/sdk/plugin.d.ts
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { HttpClient } from "@effect/platform";
|
|
3
2
|
import type { Layer } from "effect";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { type
|
|
3
|
+
import { HttpClient } from "effect/unstable/http";
|
|
4
|
+
import { GraphqlExtensionService } from "../api/handlers";
|
|
5
|
+
import { type StorageFailure } from "@executor-js/sdk/core";
|
|
6
|
+
import { type ConfigFileSink } from "@executor-js/config";
|
|
7
|
+
import { GraphqlExtractionError, GraphqlIntrospectionError } from "./errors";
|
|
8
|
+
import { type GraphqlStore, type StoredGraphqlSource } from "./store";
|
|
9
|
+
import { type GraphqlSourceAuth, type HeaderValue as HeaderValueValue, type QueryParamValue } from "./types";
|
|
7
10
|
export type HeaderValue = HeaderValueValue;
|
|
8
11
|
export interface GraphqlSourceConfig {
|
|
9
12
|
/** The GraphQL endpoint URL */
|
|
10
13
|
readonly endpoint: string;
|
|
14
|
+
/**
|
|
15
|
+
* Executor scope id that owns this source row. Must be one of the
|
|
16
|
+
* executor's configured scopes. Typical shape: an admin adds the
|
|
17
|
+
* source at the outermost (organization) scope so it's visible to
|
|
18
|
+
* every inner (per-user) scope via fall-through reads.
|
|
19
|
+
*/
|
|
20
|
+
readonly scope: string;
|
|
11
21
|
/** Display name for the source. Falls back to namespace if not provided. */
|
|
12
22
|
readonly name?: string;
|
|
13
23
|
/** Optional: introspection JSON text (if endpoint doesn't support introspection) */
|
|
@@ -16,25 +26,232 @@ export interface GraphqlSourceConfig {
|
|
|
16
26
|
readonly namespace?: string;
|
|
17
27
|
/** Headers applied to every request. Values can reference secrets. */
|
|
18
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;
|
|
19
33
|
}
|
|
20
34
|
export interface GraphqlUpdateSourceInput {
|
|
21
35
|
readonly name?: string;
|
|
22
36
|
readonly endpoint?: string;
|
|
23
37
|
readonly headers?: Record<string, HeaderValue>;
|
|
38
|
+
readonly queryParams?: Record<string, QueryParamValue>;
|
|
39
|
+
readonly auth?: GraphqlSourceAuth;
|
|
24
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;
|
|
25
51
|
export interface GraphqlPluginExtension {
|
|
26
52
|
/** Add a GraphQL endpoint and register its operations as tools */
|
|
27
53
|
readonly addSource: (config: GraphqlSourceConfig) => Effect.Effect<{
|
|
28
54
|
readonly toolCount: number;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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>;
|
|
36
71
|
}
|
|
37
|
-
export
|
|
72
|
+
export interface GraphqlPluginOptions {
|
|
38
73
|
readonly httpClientLayer?: Layer.Layer<HttpClient.HttpClient>;
|
|
39
|
-
|
|
40
|
-
|
|
74
|
+
/** If provided, source add/remove is mirrored to executor.jsonc
|
|
75
|
+
* (best-effort — file errors are logged, not raised). */
|
|
76
|
+
readonly configFile?: ConfigFileSink;
|
|
77
|
+
}
|
|
78
|
+
export declare const graphqlPlugin: import("@executor-js/sdk/core").ConfiguredPlugin<"graphql", {
|
|
79
|
+
addSource: (config: GraphqlSourceConfig) => Effect.Effect<{
|
|
80
|
+
readonly toolCount: number;
|
|
81
|
+
readonly namespace: string;
|
|
82
|
+
}, StorageFailure | GraphqlIntrospectionError | GraphqlExtractionError, never>;
|
|
83
|
+
removeSource: (namespace: string, scope: string) => Effect.Effect<void, StorageFailure, never>;
|
|
84
|
+
getSource: (namespace: string, scope: string) => Effect.Effect<StoredGraphqlSource | null, StorageFailure, never>;
|
|
85
|
+
updateSource: (namespace: string, scope: string, input: GraphqlUpdateSourceInput) => Effect.Effect<void, StorageFailure, never>;
|
|
86
|
+
}, GraphqlStore, GraphqlPluginOptions, {
|
|
87
|
+
readonly graphql_source: {
|
|
88
|
+
readonly fields: {
|
|
89
|
+
readonly id: {
|
|
90
|
+
readonly type: "string";
|
|
91
|
+
readonly required: true;
|
|
92
|
+
};
|
|
93
|
+
readonly scope_id: {
|
|
94
|
+
readonly type: "string";
|
|
95
|
+
readonly required: true;
|
|
96
|
+
readonly index: true;
|
|
97
|
+
};
|
|
98
|
+
readonly name: {
|
|
99
|
+
readonly type: "string";
|
|
100
|
+
readonly required: true;
|
|
101
|
+
};
|
|
102
|
+
readonly endpoint: {
|
|
103
|
+
readonly type: "string";
|
|
104
|
+
readonly required: true;
|
|
105
|
+
};
|
|
106
|
+
readonly headers: {
|
|
107
|
+
readonly type: "json";
|
|
108
|
+
readonly required: false;
|
|
109
|
+
};
|
|
110
|
+
readonly query_params: {
|
|
111
|
+
readonly type: "json";
|
|
112
|
+
readonly required: false;
|
|
113
|
+
};
|
|
114
|
+
readonly auth: {
|
|
115
|
+
readonly type: "json";
|
|
116
|
+
readonly required: false;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
readonly graphql_operation: {
|
|
121
|
+
readonly fields: {
|
|
122
|
+
readonly id: {
|
|
123
|
+
readonly type: "string";
|
|
124
|
+
readonly required: true;
|
|
125
|
+
};
|
|
126
|
+
readonly scope_id: {
|
|
127
|
+
readonly type: "string";
|
|
128
|
+
readonly required: true;
|
|
129
|
+
readonly index: true;
|
|
130
|
+
};
|
|
131
|
+
readonly source_id: {
|
|
132
|
+
readonly type: "string";
|
|
133
|
+
readonly required: true;
|
|
134
|
+
readonly index: true;
|
|
135
|
+
};
|
|
136
|
+
readonly binding: {
|
|
137
|
+
readonly type: "json";
|
|
138
|
+
readonly required: true;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
};
|
|
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>>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { type StorageDeps, type StorageFailure } from "@executor-js/sdk/core";
|
|
3
|
+
import { OperationBinding, type GraphqlSourceAuth, type HeaderValue, type QueryParamValue } from "./types";
|
|
4
|
+
export declare const graphqlSchema: {
|
|
5
|
+
readonly graphql_source: {
|
|
6
|
+
readonly fields: {
|
|
7
|
+
readonly id: {
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
readonly required: true;
|
|
10
|
+
};
|
|
11
|
+
readonly scope_id: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly required: true;
|
|
14
|
+
readonly index: true;
|
|
15
|
+
};
|
|
16
|
+
readonly name: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
readonly required: true;
|
|
19
|
+
};
|
|
20
|
+
readonly endpoint: {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly required: true;
|
|
23
|
+
};
|
|
24
|
+
readonly headers: {
|
|
25
|
+
readonly type: "json";
|
|
26
|
+
readonly required: false;
|
|
27
|
+
};
|
|
28
|
+
readonly query_params: {
|
|
29
|
+
readonly type: "json";
|
|
30
|
+
readonly required: false;
|
|
31
|
+
};
|
|
32
|
+
readonly auth: {
|
|
33
|
+
readonly type: "json";
|
|
34
|
+
readonly required: false;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
readonly graphql_operation: {
|
|
39
|
+
readonly fields: {
|
|
40
|
+
readonly id: {
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
readonly required: true;
|
|
43
|
+
};
|
|
44
|
+
readonly scope_id: {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
readonly required: true;
|
|
47
|
+
readonly index: true;
|
|
48
|
+
};
|
|
49
|
+
readonly source_id: {
|
|
50
|
+
readonly type: "string";
|
|
51
|
+
readonly required: true;
|
|
52
|
+
readonly index: true;
|
|
53
|
+
};
|
|
54
|
+
readonly binding: {
|
|
55
|
+
readonly type: "json";
|
|
56
|
+
readonly required: true;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export type GraphqlSchema = typeof graphqlSchema;
|
|
62
|
+
export interface StoredGraphqlSource {
|
|
63
|
+
readonly namespace: string;
|
|
64
|
+
/** Executor scope id this source row lives in. Writes stamp this on
|
|
65
|
+
* `scope_id`; reads return whichever scope's row the adapter's
|
|
66
|
+
* fall-through walk surfaced first. */
|
|
67
|
+
readonly scope: string;
|
|
68
|
+
readonly name: string;
|
|
69
|
+
readonly endpoint: string;
|
|
70
|
+
readonly headers: Record<string, HeaderValue>;
|
|
71
|
+
readonly queryParams: Record<string, QueryParamValue>;
|
|
72
|
+
readonly auth: GraphqlSourceAuth;
|
|
73
|
+
}
|
|
74
|
+
export interface StoredOperation {
|
|
75
|
+
readonly toolId: string;
|
|
76
|
+
readonly sourceId: string;
|
|
77
|
+
readonly binding: OperationBinding;
|
|
78
|
+
}
|
|
79
|
+
export interface GraphqlStore {
|
|
80
|
+
readonly upsertSource: (input: StoredGraphqlSource, operations: readonly StoredOperation[]) => Effect.Effect<void, StorageFailure>;
|
|
81
|
+
readonly updateSourceMeta: (namespace: string, scope: string, patch: {
|
|
82
|
+
readonly name?: string;
|
|
83
|
+
readonly endpoint?: string;
|
|
84
|
+
readonly headers?: Record<string, HeaderValue>;
|
|
85
|
+
readonly queryParams?: Record<string, QueryParamValue>;
|
|
86
|
+
readonly auth?: GraphqlSourceAuth;
|
|
87
|
+
}) => Effect.Effect<void, StorageFailure>;
|
|
88
|
+
readonly getSource: (namespace: string, scope: string) => Effect.Effect<StoredGraphqlSource | null, StorageFailure>;
|
|
89
|
+
readonly listSources: () => Effect.Effect<readonly StoredGraphqlSource[], StorageFailure>;
|
|
90
|
+
readonly getOperationByToolId: (toolId: string, scope: string) => Effect.Effect<StoredOperation | null, StorageFailure>;
|
|
91
|
+
readonly listOperationsBySource: (sourceId: string, scope: string) => Effect.Effect<readonly StoredOperation[], StorageFailure>;
|
|
92
|
+
readonly removeSource: (namespace: string, scope: string) => Effect.Effect<void, StorageFailure>;
|
|
93
|
+
}
|
|
94
|
+
export declare const makeDefaultGraphqlStore: ({ adapter: db, }: StorageDeps<GraphqlSchema>) => GraphqlStore;
|