@executor-js/plugin-graphql 1.4.33 → 1.5.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.
- package/dist/AddGraphqlSource-P3D3UXRJ.js +179 -0
- package/dist/AddGraphqlSource-P3D3UXRJ.js.map +1 -0
- package/dist/EditGraphqlSource-FVF67CTP.js +38 -0
- package/dist/EditGraphqlSource-FVF67CTP.js.map +1 -0
- package/dist/GraphqlAccountsPanel-GBNFHLFH.js +9 -0
- package/dist/GraphqlAccountsPanel-GBNFHLFH.js.map +1 -0
- package/dist/api/group.d.ts +108 -119
- package/dist/api/handlers.d.ts +9 -7
- package/dist/api/index.d.ts +117 -104
- package/dist/chunk-2Y3J3CVO.js +191 -0
- package/dist/chunk-2Y3J3CVO.js.map +1 -0
- package/dist/chunk-ADQTI2OK.js +1309 -0
- package/dist/chunk-ADQTI2OK.js.map +1 -0
- package/dist/{chunk-UIAHATHP.js → chunk-N5GJE7R6.js} +42 -58
- package/dist/chunk-N5GJE7R6.js.map +1 -0
- package/dist/chunk-VCYDSSIK.js +79 -0
- package/dist/chunk-VCYDSSIK.js.map +1 -0
- package/dist/client.js +7 -7
- package/dist/client.js.map +1 -1
- package/dist/core.js +20 -28
- package/dist/index.js +2 -2
- package/dist/react/AddGraphqlSource.d.ts +1 -1
- package/dist/react/EditGraphqlSource.d.ts +2 -2
- package/dist/react/GraphqlAccountsPanel.d.ts +6 -0
- package/dist/react/GraphqlSignInButton.d.ts +6 -2
- package/dist/react/GraphqlSourceFields.d.ts +2 -2
- package/dist/react/atoms.d.ts +95 -205
- package/dist/react/auth-method-config.d.ts +9 -0
- package/dist/react/client.d.ts +108 -97
- package/dist/react/defaults.d.ts +16 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/source-plugin.d.ts +2 -2
- package/dist/sdk/errors.d.ts +8 -6
- package/dist/sdk/index.d.ts +5 -5
- package/dist/sdk/introspect.d.ts +1 -1
- package/dist/sdk/invoke.d.ts +1 -4
- package/dist/sdk/plugin.d.ts +94 -104
- package/dist/sdk/store.d.ts +11 -28
- package/dist/sdk/types.d.ts +110 -72
- package/package.json +5 -4
- package/dist/AddGraphqlSource-CJCUUYNM.js +0 -250
- package/dist/AddGraphqlSource-CJCUUYNM.js.map +0 -1
- package/dist/EditGraphqlSource-YLTPUYW4.js +0 -267
- package/dist/EditGraphqlSource-YLTPUYW4.js.map +0 -1
- package/dist/GraphqlSourceSummary-YWJX6ONU.js +0 -70
- package/dist/GraphqlSourceSummary-YWJX6ONU.js.map +0 -1
- package/dist/chunk-2252RTCE.js +0 -1730
- package/dist/chunk-2252RTCE.js.map +0 -1
- package/dist/chunk-D3FN3ZDA.js +0 -125
- package/dist/chunk-D3FN3ZDA.js.map +0 -1
- package/dist/chunk-M4SJY6CB.js +0 -45
- package/dist/chunk-M4SJY6CB.js.map +0 -1
- package/dist/chunk-UIAHATHP.js.map +0 -1
- package/dist/react/GraphqlSourceSummary.d.ts +0 -5
package/dist/api/index.d.ts
CHANGED
|
@@ -3,154 +3,167 @@ import { GraphqlExtensionService } from "./handlers";
|
|
|
3
3
|
export { GraphqlGroup } from "./group";
|
|
4
4
|
export { GraphqlHandlers, GraphqlExtensionService } from "./handlers";
|
|
5
5
|
export declare const graphqlHttpPlugin: import("@executor-js/sdk/core").ConfiguredPlugin<"graphql", {
|
|
6
|
-
|
|
6
|
+
addIntegration: (input: import("../sdk").GraphqlAddIntegrationInput) => import("effect/Effect").Effect<{
|
|
7
|
+
slug: string;
|
|
8
|
+
name: string;
|
|
7
9
|
toolCount: number;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
configure: (
|
|
14
|
-
}, import("../sdk").GraphqlStore, GraphqlPluginOptions,
|
|
15
|
-
scopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
16
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
10
|
+
}, import("@executor-js/sdk/core").StorageFailure | import("@executor-js/sdk/shared").IntegrationAlreadyExistsError | import("../sdk").GraphqlIntrospectionError | import("../sdk").GraphqlExtractionError, never>;
|
|
11
|
+
getIntegration: (slug: string) => import("effect/Effect").Effect<unknown, import("@executor-js/sdk/core").StorageFailure, never>;
|
|
12
|
+
getConfig: (slug: string) => import("effect/Effect").Effect<import("../sdk").GraphqlIntegrationConfig | null, import("@executor-js/sdk/core").StorageFailure>;
|
|
13
|
+
configureAuth: (slug: string, input: import("../sdk").GraphqlConfigureAuthInput) => import("effect/Effect").Effect<readonly import("../sdk").AuthTemplate[], import("@executor-js/sdk/core").StorageFailure>;
|
|
14
|
+
removeIntegration: (slug: string) => import("effect/Effect").Effect<void, import("@executor-js/sdk/core").StorageFailure, never>;
|
|
15
|
+
configure: (slug: string, input: import("../sdk").GraphqlConfigureInput) => import("effect/Effect").Effect<void, import("@executor-js/sdk/core").StorageFailure, never>;
|
|
16
|
+
}, import("../sdk").GraphqlStore, GraphqlPluginOptions, typeof GraphqlExtensionService, import("effect/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<"addIntegration", "POST", "/graphql/integrations", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
17
17
|
readonly endpoint: import("effect/Schema").String;
|
|
18
|
-
readonly
|
|
18
|
+
readonly slug: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
19
|
+
readonly name: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
19
20
|
readonly introspectionJson: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
22
|
-
|
|
21
|
+
readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
22
|
+
readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
23
|
+
readonly authenticationTemplate: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
24
|
+
readonly kind: import("effect/Schema").Literal<"apiKey">;
|
|
25
|
+
readonly slug: import("effect/Schema").String;
|
|
26
|
+
readonly in: import("effect/Schema").Literals<readonly ["header", "query"]>;
|
|
27
|
+
readonly name: import("effect/Schema").String;
|
|
23
28
|
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
readonly
|
|
29
|
+
}>, import("effect/Schema").Struct<{
|
|
30
|
+
readonly kind: import("effect/Schema").Literal<"oauth2">;
|
|
31
|
+
readonly slug: import("effect/Schema").String;
|
|
32
|
+
readonly header: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
27
33
|
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
28
34
|
}>]>>>;
|
|
29
|
-
readonly oauth2: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
30
|
-
readonly kind: import("effect/Schema").Literal<"oauth2">;
|
|
31
|
-
readonly securitySchemeName: import("effect/Schema").String;
|
|
32
|
-
readonly flow: import("effect/Schema").Literals<readonly ["authorizationCode", "clientCredentials"]>;
|
|
33
|
-
readonly tokenUrl: import("effect/Schema").String;
|
|
34
|
-
readonly authorizationUrl: import("effect/Schema").withDecodingDefault<import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>>;
|
|
35
|
-
readonly issuerUrl: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
36
|
-
readonly clientIdSlot: import("effect/Schema").String;
|
|
37
|
-
readonly clientSecretSlot: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
38
|
-
readonly connectionSlot: import("effect/Schema").String;
|
|
39
|
-
readonly scopes: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
40
|
-
}>>;
|
|
41
|
-
readonly credentials: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
42
|
-
readonly scope: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
43
|
-
readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Struct<{
|
|
44
|
-
readonly kind: import("effect/Schema").Literal<"text">;
|
|
45
|
-
readonly text: import("effect/Schema").String;
|
|
46
|
-
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
47
|
-
}>, import("effect/Schema").Struct<{
|
|
48
|
-
readonly kind: import("effect/Schema").Literal<"secret">;
|
|
49
|
-
readonly secretId: import("effect/Schema").String;
|
|
50
|
-
readonly secretScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
51
|
-
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
52
|
-
}>, import("effect/Schema").Struct<{
|
|
53
|
-
readonly kind: import("effect/Schema").Literal<"connection">;
|
|
54
|
-
readonly connectionId: import("effect/Schema").String;
|
|
55
|
-
}>]>>>;
|
|
56
|
-
readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Struct<{
|
|
57
|
-
readonly kind: import("effect/Schema").Literal<"text">;
|
|
58
|
-
readonly text: import("effect/Schema").String;
|
|
59
|
-
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
60
|
-
}>, import("effect/Schema").Struct<{
|
|
61
|
-
readonly kind: import("effect/Schema").Literal<"secret">;
|
|
62
|
-
readonly secretId: import("effect/Schema").String;
|
|
63
|
-
readonly secretScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
64
|
-
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
65
|
-
}>, import("effect/Schema").Struct<{
|
|
66
|
-
readonly kind: import("effect/Schema").Literal<"connection">;
|
|
67
|
-
readonly connectionId: import("effect/Schema").String;
|
|
68
|
-
}>]>>>;
|
|
69
|
-
readonly auth: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
70
|
-
readonly kind: import("effect/Schema").Literal<"none">;
|
|
71
|
-
}>, import("effect/Schema").Struct<{
|
|
72
|
-
readonly oauth2: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
73
|
-
readonly connection: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Struct<{
|
|
74
|
-
readonly kind: import("effect/Schema").Literal<"text">;
|
|
75
|
-
readonly text: import("effect/Schema").String;
|
|
76
|
-
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
77
|
-
}>, import("effect/Schema").Struct<{
|
|
78
|
-
readonly kind: import("effect/Schema").Literal<"secret">;
|
|
79
|
-
readonly secretId: import("effect/Schema").String;
|
|
80
|
-
readonly secretScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
81
|
-
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
82
|
-
}>, import("effect/Schema").Struct<{
|
|
83
|
-
readonly kind: import("effect/Schema").Literal<"connection">;
|
|
84
|
-
readonly connectionId: import("effect/Schema").String;
|
|
85
|
-
}>]>>;
|
|
86
|
-
}>>;
|
|
87
|
-
}>]>>;
|
|
88
|
-
}>>;
|
|
89
35
|
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
90
|
-
readonly
|
|
91
|
-
readonly
|
|
92
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/api").InternalError | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<import("../sdk").GraphqlIntrospectionError, {
|
|
93
|
-
readonly _tag: "GraphqlIntrospectionError";
|
|
36
|
+
readonly slug: import("effect/Schema").String;
|
|
37
|
+
readonly name: import("effect/Schema").String;
|
|
38
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/sdk/shared").IntegrationAlreadyExistsError | typeof import("@executor-js/api").InternalError | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<import("../sdk").GraphqlIntrospectionError, {
|
|
94
39
|
readonly message: string;
|
|
40
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
95
41
|
}, readonly [import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
|
|
96
42
|
readonly message: import("effect/Schema").String;
|
|
97
43
|
}>], {
|
|
98
|
-
readonly _tag: "GraphqlIntrospectionError";
|
|
99
44
|
readonly message: string;
|
|
45
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
100
46
|
}>, import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
|
|
101
47
|
readonly message: import("effect/Schema").String;
|
|
102
48
|
}>, never, never> | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<import("../sdk").GraphqlExtractionError, {
|
|
103
|
-
readonly _tag: "GraphqlExtractionError";
|
|
104
49
|
readonly message: string;
|
|
50
|
+
readonly _tag: "GraphqlExtractionError";
|
|
105
51
|
}, readonly [import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
|
|
106
52
|
readonly message: import("effect/Schema").String;
|
|
107
53
|
}>], {
|
|
54
|
+
readonly message: string;
|
|
108
55
|
readonly _tag: "GraphqlExtractionError";
|
|
56
|
+
}>, import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
|
|
57
|
+
readonly message: import("effect/Schema").String;
|
|
58
|
+
}>, never, never>>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getIntegration", "GET", "/graphql/integrations/:slug", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
59
|
+
slug: import("effect/Schema").String;
|
|
60
|
+
}>>, 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").Unknown>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/sdk/shared").IntegrationAlreadyExistsError | typeof import("@executor-js/api").InternalError | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<import("../sdk").GraphqlIntrospectionError, {
|
|
109
61
|
readonly message: string;
|
|
62
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
63
|
+
}, readonly [import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
|
|
64
|
+
readonly message: import("effect/Schema").String;
|
|
65
|
+
}>], {
|
|
66
|
+
readonly message: string;
|
|
67
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
68
|
+
}>, import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
|
|
69
|
+
readonly message: import("effect/Schema").String;
|
|
70
|
+
}>, never, never> | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<import("../sdk").GraphqlExtractionError, {
|
|
71
|
+
readonly message: string;
|
|
72
|
+
readonly _tag: "GraphqlExtractionError";
|
|
73
|
+
}, readonly [import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
|
|
74
|
+
readonly message: import("effect/Schema").String;
|
|
75
|
+
}>], {
|
|
76
|
+
readonly message: string;
|
|
77
|
+
readonly _tag: "GraphqlExtractionError";
|
|
110
78
|
}>, import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
|
|
111
79
|
readonly message: import("effect/Schema").String;
|
|
112
|
-
}>, never, never>>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"
|
|
113
|
-
|
|
114
|
-
namespace: import("effect/Schema").String;
|
|
80
|
+
}>, never, never>>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getConfig", "GET", "/graphql/integrations/:slug/config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
81
|
+
slug: import("effect/Schema").String;
|
|
115
82
|
}>>, 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<{
|
|
116
|
-
readonly namespace: import("effect/Schema").String;
|
|
117
|
-
readonly scope: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
118
|
-
readonly name: import("effect/Schema").String;
|
|
119
83
|
readonly endpoint: import("effect/Schema").String;
|
|
120
|
-
readonly
|
|
121
|
-
|
|
122
|
-
|
|
84
|
+
readonly name: import("effect/Schema").String;
|
|
85
|
+
readonly introspectionJson: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
86
|
+
readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
87
|
+
readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
88
|
+
readonly authenticationTemplate: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
89
|
+
readonly kind: import("effect/Schema").Literal<"apiKey">;
|
|
90
|
+
readonly slug: import("effect/Schema").String;
|
|
91
|
+
readonly in: import("effect/Schema").Literals<readonly ["header", "query"]>;
|
|
92
|
+
readonly name: import("effect/Schema").String;
|
|
93
|
+
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
94
|
+
}>, import("effect/Schema").Struct<{
|
|
95
|
+
readonly kind: import("effect/Schema").Literal<"oauth2">;
|
|
96
|
+
readonly slug: import("effect/Schema").String;
|
|
97
|
+
readonly header: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
123
98
|
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
124
99
|
}>]>>;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
100
|
+
}>>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/sdk/shared").IntegrationAlreadyExistsError | typeof import("@executor-js/api").InternalError | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<import("../sdk").GraphqlIntrospectionError, {
|
|
101
|
+
readonly message: string;
|
|
102
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
103
|
+
}, readonly [import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
|
|
104
|
+
readonly message: import("effect/Schema").String;
|
|
105
|
+
}>], {
|
|
106
|
+
readonly message: string;
|
|
107
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
108
|
+
}>, import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
|
|
109
|
+
readonly message: import("effect/Schema").String;
|
|
110
|
+
}>, never, never> | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<import("../sdk").GraphqlExtractionError, {
|
|
111
|
+
readonly message: string;
|
|
112
|
+
readonly _tag: "GraphqlExtractionError";
|
|
113
|
+
}, readonly [import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
|
|
114
|
+
readonly message: import("effect/Schema").String;
|
|
115
|
+
}>], {
|
|
116
|
+
readonly message: string;
|
|
117
|
+
readonly _tag: "GraphqlExtractionError";
|
|
118
|
+
}>, import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
|
|
119
|
+
readonly message: import("effect/Schema").String;
|
|
120
|
+
}>, never, never>>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"configure", "POST", "/graphql/integrations/:slug/config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
121
|
+
slug: import("effect/Schema").String;
|
|
122
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
123
|
+
readonly authenticationTemplate: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
124
|
+
readonly kind: import("effect/Schema").Literal<"apiKey">;
|
|
125
|
+
readonly slug: import("effect/Schema").String;
|
|
126
|
+
readonly in: import("effect/Schema").Literals<readonly ["header", "query"]>;
|
|
127
|
+
readonly name: import("effect/Schema").String;
|
|
128
|
+
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
129
|
+
}>, import("effect/Schema").Struct<{
|
|
130
|
+
readonly kind: import("effect/Schema").Literal<"oauth2">;
|
|
131
|
+
readonly slug: import("effect/Schema").String;
|
|
132
|
+
readonly header: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
128
133
|
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
129
134
|
}>]>>;
|
|
130
|
-
readonly
|
|
131
|
-
|
|
135
|
+
readonly mode: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["merge", "replace"]>>;
|
|
136
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
137
|
+
readonly authenticationTemplate: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
138
|
+
readonly kind: import("effect/Schema").Literal<"apiKey">;
|
|
139
|
+
readonly slug: import("effect/Schema").String;
|
|
140
|
+
readonly in: import("effect/Schema").Literals<readonly ["header", "query"]>;
|
|
141
|
+
readonly name: import("effect/Schema").String;
|
|
142
|
+
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
132
143
|
}>, import("effect/Schema").Struct<{
|
|
133
144
|
readonly kind: import("effect/Schema").Literal<"oauth2">;
|
|
134
|
-
readonly
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
145
|
+
readonly slug: import("effect/Schema").String;
|
|
146
|
+
readonly header: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
147
|
+
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
148
|
+
}>]>>;
|
|
149
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/sdk/shared").IntegrationAlreadyExistsError | typeof import("@executor-js/api").InternalError | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<import("../sdk").GraphqlIntrospectionError, {
|
|
138
150
|
readonly message: string;
|
|
151
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
139
152
|
}, readonly [import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
|
|
140
153
|
readonly message: import("effect/Schema").String;
|
|
141
154
|
}>], {
|
|
142
|
-
readonly _tag: "GraphqlIntrospectionError";
|
|
143
155
|
readonly message: string;
|
|
156
|
+
readonly _tag: "GraphqlIntrospectionError";
|
|
144
157
|
}>, import("effect/Schema").TaggedStruct<"GraphqlIntrospectionError", {
|
|
145
158
|
readonly message: import("effect/Schema").String;
|
|
146
159
|
}>, never, never> | import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<import("../sdk").GraphqlExtractionError, {
|
|
147
|
-
readonly _tag: "GraphqlExtractionError";
|
|
148
160
|
readonly message: string;
|
|
161
|
+
readonly _tag: "GraphqlExtractionError";
|
|
149
162
|
}, readonly [import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
|
|
150
163
|
readonly message: import("effect/Schema").String;
|
|
151
164
|
}>], {
|
|
152
|
-
readonly _tag: "GraphqlExtractionError";
|
|
153
165
|
readonly message: string;
|
|
166
|
+
readonly _tag: "GraphqlExtractionError";
|
|
154
167
|
}>, import("effect/Schema").TaggedStruct<"GraphqlExtractionError", {
|
|
155
168
|
readonly message: import("effect/Schema").String;
|
|
156
169
|
}>, never, never>>, never, never>, false>>;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AuthTemplate,
|
|
3
|
+
GraphqlExtractionError,
|
|
4
|
+
GraphqlIntrospectionError
|
|
5
|
+
} from "./chunk-N5GJE7R6.js";
|
|
6
|
+
|
|
7
|
+
// src/react/atoms.ts
|
|
8
|
+
import * as Atom from "effect/unstable/reactivity/Atom";
|
|
9
|
+
import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
|
|
10
|
+
import { integrationsOptimisticAtom } from "@executor-js/react/api/atoms";
|
|
11
|
+
import { ReactivityKey } from "@executor-js/react/api/reactivity-keys";
|
|
12
|
+
|
|
13
|
+
// src/react/client.ts
|
|
14
|
+
import { createPluginAtomClient } from "@executor-js/sdk/client";
|
|
15
|
+
import {
|
|
16
|
+
getExecutorApiBaseUrl,
|
|
17
|
+
getExecutorServerAuthorizationHeader
|
|
18
|
+
} from "@executor-js/react/api/server-connection";
|
|
19
|
+
|
|
20
|
+
// src/api/group.ts
|
|
21
|
+
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
22
|
+
import { Schema } from "effect";
|
|
23
|
+
import { InternalError, IntegrationAlreadyExistsError } from "@executor-js/sdk/shared";
|
|
24
|
+
var IntegrationParams = {
|
|
25
|
+
slug: Schema.String
|
|
26
|
+
};
|
|
27
|
+
var AddIntegrationPayload = Schema.Struct({
|
|
28
|
+
endpoint: Schema.String,
|
|
29
|
+
slug: Schema.optional(Schema.String),
|
|
30
|
+
name: Schema.optional(Schema.String),
|
|
31
|
+
introspectionJson: Schema.optional(Schema.String),
|
|
32
|
+
headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
33
|
+
queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
34
|
+
authenticationTemplate: Schema.optional(Schema.Array(AuthTemplate))
|
|
35
|
+
});
|
|
36
|
+
var ConfigurePayload = Schema.Struct({
|
|
37
|
+
authenticationTemplate: Schema.Array(AuthTemplate),
|
|
38
|
+
mode: Schema.optional(Schema.Literals(["merge", "replace"]))
|
|
39
|
+
});
|
|
40
|
+
var AddIntegrationResponse = Schema.Struct({
|
|
41
|
+
slug: Schema.String,
|
|
42
|
+
name: Schema.String
|
|
43
|
+
});
|
|
44
|
+
var GraphqlConfigView = Schema.Struct({
|
|
45
|
+
endpoint: Schema.String,
|
|
46
|
+
name: Schema.String,
|
|
47
|
+
introspectionJson: Schema.optional(Schema.String),
|
|
48
|
+
headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
49
|
+
queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
50
|
+
authenticationTemplate: Schema.Array(AuthTemplate)
|
|
51
|
+
});
|
|
52
|
+
var ConfigureResponse = Schema.Struct({
|
|
53
|
+
authenticationTemplate: Schema.Array(AuthTemplate)
|
|
54
|
+
});
|
|
55
|
+
var IntrospectionError = GraphqlIntrospectionError.annotate({
|
|
56
|
+
httpApiStatus: 400
|
|
57
|
+
});
|
|
58
|
+
var ExtractionError = GraphqlExtractionError.annotate({ httpApiStatus: 400 });
|
|
59
|
+
var GraphqlErrors = [
|
|
60
|
+
InternalError,
|
|
61
|
+
IntrospectionError,
|
|
62
|
+
ExtractionError,
|
|
63
|
+
IntegrationAlreadyExistsError
|
|
64
|
+
];
|
|
65
|
+
var GraphqlGroup = HttpApiGroup.make("graphql").add(
|
|
66
|
+
HttpApiEndpoint.post("addIntegration", "/graphql/integrations", {
|
|
67
|
+
payload: AddIntegrationPayload,
|
|
68
|
+
success: AddIntegrationResponse,
|
|
69
|
+
error: GraphqlErrors
|
|
70
|
+
})
|
|
71
|
+
).add(
|
|
72
|
+
HttpApiEndpoint.get("getIntegration", "/graphql/integrations/:slug", {
|
|
73
|
+
params: IntegrationParams,
|
|
74
|
+
success: Schema.NullOr(Schema.Unknown),
|
|
75
|
+
error: GraphqlErrors
|
|
76
|
+
})
|
|
77
|
+
).add(
|
|
78
|
+
HttpApiEndpoint.get("getConfig", "/graphql/integrations/:slug/config", {
|
|
79
|
+
params: IntegrationParams,
|
|
80
|
+
success: Schema.NullOr(GraphqlConfigView),
|
|
81
|
+
error: GraphqlErrors
|
|
82
|
+
})
|
|
83
|
+
).add(
|
|
84
|
+
HttpApiEndpoint.post("configure", "/graphql/integrations/:slug/config", {
|
|
85
|
+
params: IntegrationParams,
|
|
86
|
+
payload: ConfigurePayload,
|
|
87
|
+
success: ConfigureResponse,
|
|
88
|
+
error: GraphqlErrors
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
// src/react/client.ts
|
|
93
|
+
var GraphqlClient = createPluginAtomClient(GraphqlGroup, {
|
|
94
|
+
baseUrl: getExecutorApiBaseUrl,
|
|
95
|
+
authorizationHeader: getExecutorServerAuthorizationHeader
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// src/react/atoms.ts
|
|
99
|
+
var graphqlIntegrationConfigAtom = (slug) => GraphqlClient.query("graphql", "getIntegration", {
|
|
100
|
+
params: { slug: String(slug) },
|
|
101
|
+
timeToLive: "15 seconds",
|
|
102
|
+
reactivityKeys: [ReactivityKey.integrations, ReactivityKey.tools]
|
|
103
|
+
});
|
|
104
|
+
var graphqlConfigAtom = (slug) => GraphqlClient.query("graphql", "getConfig", {
|
|
105
|
+
params: { slug: String(slug) },
|
|
106
|
+
timeToLive: "15 seconds",
|
|
107
|
+
reactivityKeys: [ReactivityKey.integrations, ReactivityKey.tools]
|
|
108
|
+
});
|
|
109
|
+
var addGraphqlIntegration = GraphqlClient.mutation("graphql", "addIntegration");
|
|
110
|
+
var graphqlConfigure = GraphqlClient.mutation("graphql", "configure");
|
|
111
|
+
var addGraphqlIntegrationOptimistic = integrationsOptimisticAtom.pipe(
|
|
112
|
+
Atom.optimisticFn({
|
|
113
|
+
reducer: (current, arg) => AsyncResult.map(current, (rows) => {
|
|
114
|
+
const slug = arg.payload.slug ?? `pending-${Math.random().toString(36).slice(2)}`;
|
|
115
|
+
const integration = {
|
|
116
|
+
slug,
|
|
117
|
+
kind: "graphql",
|
|
118
|
+
description: arg.payload.name ?? arg.payload.endpoint,
|
|
119
|
+
canRemove: false,
|
|
120
|
+
canRefresh: false,
|
|
121
|
+
authMethods: []
|
|
122
|
+
};
|
|
123
|
+
return [integration, ...rows.filter((row) => row.slug !== slug)].sort(
|
|
124
|
+
(a, b) => a.description.localeCompare(b.description)
|
|
125
|
+
);
|
|
126
|
+
}),
|
|
127
|
+
fn: addGraphqlIntegration
|
|
128
|
+
})
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
// src/react/auth-method-config.ts
|
|
132
|
+
import { AuthTemplateSlug } from "@executor-js/sdk/shared";
|
|
133
|
+
|
|
134
|
+
// src/react/defaults.ts
|
|
135
|
+
import { connectionIdentifier } from "@executor-js/react/lib/connection-name";
|
|
136
|
+
var GRAPHQL_APIKEY_TEMPLATE = "apiKey";
|
|
137
|
+
|
|
138
|
+
// src/react/auth-method-config.ts
|
|
139
|
+
var labelForApiKey = (slug, name) => `API key (${name || slug})`;
|
|
140
|
+
function authMethodsFromConfig(templates) {
|
|
141
|
+
return templates.map((template) => {
|
|
142
|
+
const slug = String(template.slug);
|
|
143
|
+
const source = slug.startsWith("custom_") ? "custom" : "spec";
|
|
144
|
+
if (template.kind === "oauth2") {
|
|
145
|
+
return {
|
|
146
|
+
id: slug,
|
|
147
|
+
label: "OAuth2",
|
|
148
|
+
kind: "oauth",
|
|
149
|
+
source,
|
|
150
|
+
template: AuthTemplateSlug.make(slug),
|
|
151
|
+
placements: [],
|
|
152
|
+
oauth: {}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
const placement = {
|
|
156
|
+
carrier: template.in,
|
|
157
|
+
name: template.name,
|
|
158
|
+
prefix: template.prefix ?? ""
|
|
159
|
+
};
|
|
160
|
+
return {
|
|
161
|
+
id: slug,
|
|
162
|
+
label: labelForApiKey(slug, template.name),
|
|
163
|
+
kind: "apikey",
|
|
164
|
+
source,
|
|
165
|
+
template: AuthTemplateSlug.make(slug),
|
|
166
|
+
placements: [placement]
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function graphqlTemplatesFromPlacements(placements, slug) {
|
|
171
|
+
const named = placements.filter((placement) => placement.name.trim().length > 0);
|
|
172
|
+
return named.map(
|
|
173
|
+
(placement, index) => ({
|
|
174
|
+
kind: "apiKey",
|
|
175
|
+
slug: index === 0 ? slug ?? GRAPHQL_APIKEY_TEMPLATE : "",
|
|
176
|
+
in: placement.carrier,
|
|
177
|
+
name: placement.name,
|
|
178
|
+
...placement.prefix ? { prefix: placement.prefix } : {}
|
|
179
|
+
})
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export {
|
|
184
|
+
graphqlIntegrationConfigAtom,
|
|
185
|
+
graphqlConfigAtom,
|
|
186
|
+
graphqlConfigure,
|
|
187
|
+
addGraphqlIntegrationOptimistic,
|
|
188
|
+
authMethodsFromConfig,
|
|
189
|
+
graphqlTemplatesFromPlacements
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=chunk-2Y3J3CVO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react/atoms.ts","../src/react/client.ts","../src/api/group.ts","../src/react/auth-method-config.ts","../src/react/defaults.ts"],"sourcesContent":["import type { IntegrationSlug } from \"@executor-js/sdk/shared\";\nimport * as Atom from \"effect/unstable/reactivity/Atom\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport { integrationsOptimisticAtom } from \"@executor-js/react/api/atoms\";\nimport { ReactivityKey } from \"@executor-js/react/api/reactivity-keys\";\nimport { GraphqlClient } from \"./client\";\n\n// ---------------------------------------------------------------------------\n// Query atoms — v2 is integration-centric. The graphql HTTP surface exposes\n// only the catalog integration (`getIntegration` → its stored config, which\n// carries the `authenticationTemplate[]`). Connections are created through the\n// core API (`createConnection` / `oauth.start`), not through this plugin's\n// surface.\n// ---------------------------------------------------------------------------\n\nexport const graphqlIntegrationConfigAtom = (slug: IntegrationSlug) =>\n GraphqlClient.query(\"graphql\", \"getIntegration\", {\n params: { slug: String(slug) },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.integrations, ReactivityKey.tools],\n });\n\n// The full opaque config (including `authenticationTemplate`), used by the\n// configure UX to render existing auth methods and add custom ones.\nexport const graphqlConfigAtom = (slug: IntegrationSlug) =>\n GraphqlClient.query(\"graphql\", \"getConfig\", {\n params: { slug: String(slug) },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.integrations, ReactivityKey.tools],\n });\n\n// ---------------------------------------------------------------------------\n// Mutation atoms\n// ---------------------------------------------------------------------------\n\nexport const addGraphqlIntegration = GraphqlClient.mutation(\"graphql\", \"addIntegration\");\n\n// Merge-append custom auth methods onto an integration's `authenticationTemplate`.\nexport const graphqlConfigure = GraphqlClient.mutation(\"graphql\", \"configure\");\n\n// Optimistically slot a pending row into the shared integration catalog so the\n// integrations list reflects the new GraphQL integration before the server\n// round-trips. The reducer mirrors the catalog `Integration` shape.\nexport const addGraphqlIntegrationOptimistic = integrationsOptimisticAtom.pipe(\n Atom.optimisticFn({\n reducer: (\n current,\n arg: {\n readonly payload: {\n readonly endpoint: string;\n readonly slug?: string;\n readonly name?: string;\n };\n },\n ) =>\n AsyncResult.map(current, (rows) => {\n const slug = (arg.payload.slug ??\n `pending-${Math.random().toString(36).slice(2)}`) as IntegrationSlug;\n const integration = {\n slug,\n kind: \"graphql\",\n description: arg.payload.name ?? arg.payload.endpoint,\n canRemove: false,\n canRefresh: false,\n authMethods: [],\n };\n return [integration, ...rows.filter((row) => row.slug !== slug)].sort((a, b) =>\n a.description.localeCompare(b.description),\n );\n }),\n fn: addGraphqlIntegration,\n }),\n);\n","import { createPluginAtomClient } from \"@executor-js/sdk/client\";\nimport {\n getExecutorApiBaseUrl,\n getExecutorServerAuthorizationHeader,\n} from \"@executor-js/react/api/server-connection\";\nimport { GraphqlGroup } from \"../api/group\";\n\nexport const GraphqlClient = createPluginAtomClient(GraphqlGroup, {\n baseUrl: getExecutorApiBaseUrl,\n authorizationHeader: getExecutorServerAuthorizationHeader,\n});\n","import { HttpApiEndpoint, HttpApiGroup } from \"effect/unstable/httpapi\";\nimport { Schema } from \"effect\";\nimport { InternalError, IntegrationAlreadyExistsError } from \"@executor-js/sdk/shared\";\n\nimport { GraphqlIntrospectionError, GraphqlExtractionError } from \"../sdk/errors\";\nimport { AuthTemplate } from \"../sdk/types\";\n\n// ---------------------------------------------------------------------------\n// Params\n// ---------------------------------------------------------------------------\n\nconst IntegrationParams = {\n slug: Schema.String,\n};\n\n// ---------------------------------------------------------------------------\n// Payloads\n// ---------------------------------------------------------------------------\n\nconst AddIntegrationPayload = Schema.Struct({\n endpoint: Schema.String,\n slug: Schema.optional(Schema.String),\n name: Schema.optional(Schema.String),\n introspectionJson: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n authenticationTemplate: Schema.optional(Schema.Array(AuthTemplate)),\n});\n\n// The `configure` payload — the custom auth methods to merge-append onto the\n// integration's `authenticationTemplate`. Reuses the same `AuthTemplate` schema\n// as `addIntegration` so a custom apiKey method round-trips identically.\nconst ConfigurePayload = Schema.Struct({\n authenticationTemplate: Schema.Array(AuthTemplate),\n mode: Schema.optional(Schema.Literals([\"merge\", \"replace\"])),\n});\n\n// ---------------------------------------------------------------------------\n// Responses\n// ---------------------------------------------------------------------------\n\nconst AddIntegrationResponse = Schema.Struct({\n slug: Schema.String,\n name: Schema.String,\n});\n\n// The full opaque integration config, surfaced for the configure UX. Carries\n// the `authenticationTemplate` the configure / custom-method flow reads/writes.\nconst GraphqlConfigView = Schema.Struct({\n endpoint: Schema.String,\n name: Schema.String,\n introspectionJson: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n authenticationTemplate: Schema.Array(AuthTemplate),\n});\n\n// The configure result — the merged `authenticationTemplate` after the new\n// custom methods were appended/replaced.\nconst ConfigureResponse = Schema.Struct({\n authenticationTemplate: Schema.Array(AuthTemplate),\n});\n\n// ---------------------------------------------------------------------------\n// Errors with HTTP status\n// ---------------------------------------------------------------------------\n\nconst IntrospectionError = GraphqlIntrospectionError.annotate({\n httpApiStatus: 400,\n});\nconst ExtractionError = GraphqlExtractionError.annotate({ httpApiStatus: 400 });\n\n// ---------------------------------------------------------------------------\n// Group — the GraphQL HTTP surface over integrations.\n//\n// Plugin SDK errors (GraphqlIntrospectionError etc.) are declared once at the\n// group level via `.addError(...)`. `InternalError` is the shared opaque-by-\n// schema 500 surface translated from `StorageError` by `withCapture` at the\n// HTTP edge.\n// ---------------------------------------------------------------------------\n\nconst GraphqlErrors = [\n InternalError,\n IntrospectionError,\n ExtractionError,\n IntegrationAlreadyExistsError,\n] as const;\n\nexport const GraphqlGroup = HttpApiGroup.make(\"graphql\")\n .add(\n HttpApiEndpoint.post(\"addIntegration\", \"/graphql/integrations\", {\n payload: AddIntegrationPayload,\n success: AddIntegrationResponse,\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\"getIntegration\", \"/graphql/integrations/:slug\", {\n params: IntegrationParams,\n success: Schema.NullOr(Schema.Unknown),\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\"getConfig\", \"/graphql/integrations/:slug/config\", {\n params: IntegrationParams,\n success: Schema.NullOr(GraphqlConfigView),\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.post(\"configure\", \"/graphql/integrations/:slug/config\", {\n params: IntegrationParams,\n payload: ConfigurePayload,\n success: ConfigureResponse,\n error: GraphqlErrors,\n }),\n );\n","// ---------------------------------------------------------------------------\n// GraphQL ↔ generic auth-method converters.\n//\n// The generic Accounts hub + add-time auth editor speak in plugin-agnostic\n// `AuthMethod` / `Placement` values (`@executor-js/react/lib/auth-placements`).\n// The GraphQL plugin stores auth as its own `AuthTemplate` wire shape\n// (`{ kind:\"apiKey\", slug, in, name, prefix? }` / `{ kind:\"oauth2\", slug, … }`).\n// These converters bridge that wire shape to/from the generic placement model,\n// so they live with the GraphQL plugin — they touch the graphql sdk\n// `AuthTemplate` types and would pull transport specifics into core.\n// ---------------------------------------------------------------------------\n\nimport { AuthTemplateSlug } from \"@executor-js/sdk/shared\";\nimport type { AuthMethod, Placement } from \"@executor-js/react/lib/auth-placements\";\n\nimport { GRAPHQL_APIKEY_TEMPLATE } from \"./defaults\";\nimport type { AuthTemplate } from \"../sdk/types\";\n\n// ---------------------------------------------------------------------------\n// Templates → generic methods.\n// ---------------------------------------------------------------------------\n\nconst labelForApiKey = (slug: string, name: string): string => `API key (${name || slug})`;\n\n/** Map each stored GraphQL auth template to a generic `AuthMethod`. A `custom_`\n * slug marks a user-defined method; everything else is spec-declared. */\nexport function authMethodsFromConfig(templates: readonly AuthTemplate[]): AuthMethod[] {\n return templates.map((template: AuthTemplate): AuthMethod => {\n const slug = String(template.slug);\n const source: \"spec\" | \"custom\" = slug.startsWith(\"custom_\") ? \"custom\" : \"spec\";\n if (template.kind === \"oauth2\") {\n return {\n id: slug,\n label: \"OAuth2\",\n kind: \"oauth\",\n source,\n template: AuthTemplateSlug.make(slug),\n placements: [],\n oauth: {},\n };\n }\n const placement: Placement = {\n carrier: template.in,\n name: template.name,\n prefix: template.prefix ?? \"\",\n };\n return {\n id: slug,\n label: labelForApiKey(slug, template.name),\n kind: \"apikey\",\n source,\n template: AuthTemplateSlug.make(slug),\n placements: [placement],\n };\n });\n}\n\n// ---------------------------------------------------------------------------\n// Generic placements → graphql apiKey templates (inverse).\n//\n// GraphQL's `AuthTemplate` carries ONE header/query slot per template, so a\n// multi-placement method emits one template per named placement. When `slug` is\n// omitted the backend backfills `custom_<id>`; the first template keeps the\n// integration's primary `apiKey` slug so the add flow stays stable.\n// ---------------------------------------------------------------------------\n\n/** Build GraphQL `apiKey` templates from generic placements. The optional\n * `slug` names the FIRST emitted template (subsequent placements get an empty\n * slug so the backend assigns a `custom_<id>` each). */\nexport function graphqlTemplatesFromPlacements(\n placements: readonly Placement[],\n slug?: string,\n): AuthTemplate[] {\n const named = placements.filter((placement: Placement) => placement.name.trim().length > 0);\n return named.map(\n (placement: Placement, index: number): AuthTemplate => ({\n kind: \"apiKey\",\n slug: index === 0 ? (slug ?? GRAPHQL_APIKEY_TEMPLATE) : \"\",\n in: placement.carrier,\n name: placement.name,\n ...(placement.prefix ? { prefix: placement.prefix } : {}),\n }),\n );\n}\n","import type { ConnectionName, Owner } from \"@executor-js/sdk/shared\";\nimport { connectionIdentifier } from \"@executor-js/react/lib/connection-name\";\n\n// ---------------------------------------------------------------------------\n// v2 connection-create defaults for the GraphQL plugin. v1's HTTP-credentials\n// editor (header/query secret slots bound per source per scope) is gone: a\n// connection IS the credential, applied to the integration's auth template.\n// ---------------------------------------------------------------------------\n\n/** The slug of the apiKey auth template the add flow declares + targets. */\nexport const GRAPHQL_APIKEY_TEMPLATE = \"apiKey\";\n\n/** Build the apiKey auth template the integration stores. The connection's\n * value is written to `headerName` at invoke time (no prefix — the user pastes\n * the full header value, e.g. `Bearer ghp_…`). */\nexport const graphqlApiKeyAuthTemplate = (\n headerName: string,\n): {\n readonly kind: \"apiKey\";\n readonly slug: string;\n readonly in: \"header\";\n readonly name: string;\n} => ({\n kind: \"apiKey\",\n slug: GRAPHQL_APIKEY_TEMPLATE,\n in: \"header\",\n name: headerName || \"Authorization\",\n});\n\n/** Deterministic connection name for a GraphQL integration + owner. Keeps a\n * single owner-scoped credential per integration so re-adding overwrites\n * rather than accumulating duplicates. */\nexport const graphqlConnectionName = (slug: string, owner: Owner): ConnectionName =>\n connectionIdentifier(`${slug} ${owner}`);\n"],"mappings":";;;;;;;AACA,YAAY,UAAU;AACtB,YAAY,iBAAiB;AAC7B,SAAS,kCAAkC;AAC3C,SAAS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