@executor-js/plugin-graphql 1.4.28 → 1.4.30

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 (40) hide show
  1. package/dist/{AddGraphqlSource-3Z3DB4KQ.js → AddGraphqlSource-PBMKSY7Y.js} +29 -18
  2. package/dist/AddGraphqlSource-PBMKSY7Y.js.map +1 -0
  3. package/dist/{EditGraphqlSource-F37RPNKV.js → EditGraphqlSource-AFR4RQHY.js} +107 -91
  4. package/dist/EditGraphqlSource-AFR4RQHY.js.map +1 -0
  5. package/dist/{GraphqlSourceSummary-6EYBXVD2.js → GraphqlSourceSummary-MY4AW37M.js} +4 -4
  6. package/dist/GraphqlSourceSummary-MY4AW37M.js.map +1 -0
  7. package/dist/api/group.d.ts +71 -232
  8. package/dist/api/handlers.d.ts +5 -45
  9. package/dist/api/index.d.ts +76 -404
  10. package/dist/{chunk-PO2TPM5B.js → chunk-7S2FM3ZF.js} +578 -613
  11. package/dist/chunk-7S2FM3ZF.js.map +1 -0
  12. package/dist/chunk-D6E4WAYW.js +51 -0
  13. package/dist/chunk-D6E4WAYW.js.map +1 -0
  14. package/dist/{chunk-445ZPXHU.js → chunk-H422YIM4.js} +15 -34
  15. package/dist/chunk-H422YIM4.js.map +1 -0
  16. package/dist/{chunk-EW4Y3KEX.js → chunk-OYUIHBWZ.js} +23 -80
  17. package/dist/chunk-OYUIHBWZ.js.map +1 -0
  18. package/dist/client.js +7 -47
  19. package/dist/client.js.map +1 -1
  20. package/dist/core.js +3 -8
  21. package/dist/index.js +3 -2
  22. package/dist/react/atoms.d.ts +146 -186
  23. package/dist/react/client.d.ts +70 -231
  24. package/dist/sdk/index.d.ts +2 -2
  25. package/dist/sdk/introspect.d.ts +151 -151
  26. package/dist/sdk/invoke.d.ts +5 -5
  27. package/dist/sdk/plugin.d.ts +74 -228
  28. package/dist/sdk/presets.d.ts +1 -0
  29. package/dist/sdk/store.d.ts +3 -135
  30. package/dist/sdk/types.d.ts +31 -66
  31. package/dist/testing/index.d.ts +20 -2
  32. package/dist/testing.js +77 -29
  33. package/dist/testing.js.map +1 -1
  34. package/package.json +3 -3
  35. package/dist/AddGraphqlSource-3Z3DB4KQ.js.map +0 -1
  36. package/dist/EditGraphqlSource-F37RPNKV.js.map +0 -1
  37. package/dist/GraphqlSourceSummary-6EYBXVD2.js.map +0 -1
  38. package/dist/chunk-445ZPXHU.js.map +0 -1
  39. package/dist/chunk-EW4Y3KEX.js.map +0 -1
  40. package/dist/chunk-PO2TPM5B.js.map +0 -1
package/dist/testing.js CHANGED
@@ -9,9 +9,11 @@ import {
9
9
  Schema as EffectSchema
10
10
  } from "effect";
11
11
  import { HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
12
- import { GraphQLNonNull, GraphQLObjectType, GraphQLSchema, GraphQLString } from "graphql";
13
- import { createYoga } from "graphql-yoga";
14
- import { serveTestHttpApp } from "@executor-js/sdk/testing";
12
+ import {
13
+ createSchema,
14
+ createYoga
15
+ } from "graphql-yoga";
16
+ import { OAuthTestServer, serveTestHttpApp } from "@executor-js/sdk/testing";
15
17
  var GraphqlRequestPayload = EffectSchema.Struct({
16
18
  query: EffectSchema.optional(EffectSchema.String),
17
19
  variables: EffectSchema.optional(EffectSchema.Record(EffectSchema.String, EffectSchema.Unknown)),
@@ -56,6 +58,21 @@ var serveGraphqlTestServer = (options) => Effect.gen(function* () {
56
58
  });
57
59
  const server = yield* serveTestHttpApp(
58
60
  (request) => Effect.gen(function* () {
61
+ if (options.auth) {
62
+ const accepted = yield* options.auth.validateAuthorization(
63
+ request.headers.authorization ?? null
64
+ );
65
+ if (!accepted) {
66
+ const responseOptions = options.auth.wwwAuthenticate ? {
67
+ status: 401,
68
+ headers: { "www-authenticate": options.auth.wwwAuthenticate }
69
+ } : { status: 401 };
70
+ return HttpServerResponse.jsonUnsafe(
71
+ { errors: [{ message: "Unauthorized" }] },
72
+ responseOptions
73
+ );
74
+ }
75
+ }
59
76
  const webRequest = yield* HttpServerRequest.toWeb(request);
60
77
  const response = yield* Effect.promise(() => Promise.resolve(yoga.handle(webRequest, {})));
61
78
  return HttpServerResponse.fromWeb(response);
@@ -81,51 +98,82 @@ var serveGraphqlTestServer = (options) => Effect.gen(function* () {
81
98
  clearRequests: Ref.set(requests, [])
82
99
  };
83
100
  });
101
+ var serveGraphqlFailureTestServer = (options) => serveTestHttpApp(
102
+ () => Effect.succeed(
103
+ HttpServerResponse.text(options.body, {
104
+ status: options.status,
105
+ contentType: options.contentType ?? "text/plain"
106
+ })
107
+ )
108
+ ).pipe(
109
+ Effect.map((server) => ({
110
+ endpoint: server.url(options.path ?? "/graphql"),
111
+ httpClientLayer: server.httpClientLayer
112
+ }))
113
+ );
84
114
  var GraphqlTestServer = class _GraphqlTestServer extends Context.Service()(
85
115
  "@executor-js/plugin-graphql/testing/GraphqlTestServer"
86
116
  ) {
87
117
  static layer = (options) => Layer.effect(_GraphqlTestServer, serveGraphqlTestServer(options));
118
+ static layerWithOAuth = (options) => Layer.effect(
119
+ _GraphqlTestServer,
120
+ Effect.gen(function* () {
121
+ const oauth = yield* OAuthTestServer;
122
+ return yield* serveGraphqlTestServer({
123
+ ...options,
124
+ auth: {
125
+ validateAuthorization: oauth.acceptsAuthorizationHeader,
126
+ wwwAuthenticate: 'Bearer error="invalid_token"'
127
+ }
128
+ });
129
+ })
130
+ );
88
131
  };
89
132
  var stringArgument = (args, key, fallback) => {
90
133
  const value = args[key];
91
134
  return typeof value === "string" ? value : fallback;
92
135
  };
93
- var makeGreetingGraphqlSchema = () => {
94
- const Query = new GraphQLObjectType({
95
- name: "Query",
96
- fields: {
97
- hello: {
98
- type: GraphQLString,
99
- description: "Say hello",
100
- args: {
101
- name: { type: GraphQLString }
102
- },
103
- resolve: (_source, args) => `Hello ${stringArgument(args, "name", "world")}`
104
- }
105
- }
106
- });
107
- const Mutation = new GraphQLObjectType({
108
- name: "Mutation",
109
- fields: {
110
- setGreeting: {
111
- type: GraphQLString,
112
- description: "Set greeting message",
113
- args: {
114
- message: { type: new GraphQLNonNull(GraphQLString) }
115
- },
116
- resolve: (_source, args) => stringArgument(args, "message", "")
136
+ var makeGreetingGraphqlSchema = (options = {}) => {
137
+ const includeMutation = options.includeMutation ?? true;
138
+ return createSchema({
139
+ typeDefs: (
140
+ /* GraphQL */
141
+ `
142
+ type Query {
143
+ hello(name: String): String
117
144
  }
145
+
146
+ ${includeMutation ? (
147
+ /* GraphQL */
148
+ `
149
+ type Mutation {
150
+ setGreeting(message: String!): String
151
+ }
152
+ `
153
+ ) : ""}
154
+ `
155
+ ),
156
+ resolvers: {
157
+ Query: {
158
+ hello: (_source, args) => `Hello ${stringArgument(args, "name", "world")}`
159
+ },
160
+ ...includeMutation ? {
161
+ Mutation: {
162
+ setGreeting: (_source, args) => stringArgument(args, "message", "")
163
+ }
164
+ } : {}
118
165
  }
119
166
  });
120
- return new GraphQLSchema({ query: Query, mutation: Mutation });
121
167
  };
122
168
  var TestLayers = {
123
- greeting: () => GraphqlTestServer.layer({ schema: makeGreetingGraphqlSchema() })
169
+ greeting: () => GraphqlTestServer.layer({ schema: makeGreetingGraphqlSchema() }),
170
+ greetingWithOAuth: () => GraphqlTestServer.layerWithOAuth({ schema: makeGreetingGraphqlSchema() })
124
171
  };
125
172
  export {
126
173
  GraphqlTestServer,
127
174
  TestLayers,
128
175
  makeGreetingGraphqlSchema,
176
+ serveGraphqlFailureTestServer,
129
177
  serveGraphqlTestServer
130
178
  };
131
179
  //# sourceMappingURL=testing.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/testing/index.ts"],"sourcesContent":["import {\n Context,\n Data,\n Effect,\n Layer,\n Predicate,\n Ref,\n Schema as EffectSchema,\n Scope,\n} from \"effect\";\nimport { HttpServerRequest, HttpServerResponse } from \"effect/unstable/http\";\nimport { GraphQLNonNull, GraphQLObjectType, GraphQLSchema, GraphQLString } from \"graphql\";\nimport { createYoga, type GraphQLParams, type YogaInitialContext } from \"graphql-yoga\";\nimport { serveTestHttpApp } from \"@executor-js/sdk/testing\";\n\nconst GraphqlRequestPayload = EffectSchema.Struct({\n query: EffectSchema.optional(EffectSchema.String),\n variables: EffectSchema.optional(EffectSchema.Record(EffectSchema.String, EffectSchema.Unknown)),\n operationName: EffectSchema.optional(EffectSchema.NullOr(EffectSchema.String)),\n});\n\ntype GraphqlRequestPayload = typeof GraphqlRequestPayload.Type;\n\nexport interface GraphqlTestRequest {\n readonly url: string;\n readonly method: string;\n readonly path: string;\n readonly headers: Readonly<Record<string, string>>;\n readonly payload: GraphqlRequestPayload;\n}\n\nexport interface GraphqlTestContext {\n readonly request: GraphqlTestRequest;\n}\n\nexport interface GraphqlTestServerOptions {\n readonly schema: GraphQLSchema;\n readonly path?: string;\n}\n\nexport interface GraphqlTestServerShape {\n readonly endpoint: string;\n readonly schema: GraphQLSchema;\n readonly requests: Effect.Effect<readonly GraphqlTestRequest[]>;\n readonly clearRequests: Effect.Effect<void>;\n}\n\nclass GraphqlTestServerAddressError extends Data.TaggedError(\"GraphqlTestServerAddressError\")<{\n readonly address: unknown;\n}> {}\n\nclass GraphqlTestServerHandlerError extends Data.TaggedError(\"GraphqlTestServerHandlerError\")<{\n readonly cause: unknown;\n}> {}\n\nconst headersFromRequest = (headers: Headers): Readonly<Record<string, string>> =>\n Object.fromEntries(headers.entries());\n\nconst payloadFromParams = (params: GraphQLParams): GraphqlRequestPayload => ({\n query: params.query,\n variables:\n typeof params.variables === \"object\" && params.variables !== null\n ? params.variables\n : undefined,\n operationName: params.operationName ?? null,\n});\n\nconst captureRequest = (\n initial: YogaInitialContext,\n requests: Ref.Ref<readonly GraphqlTestRequest[]>,\n) => {\n const url = new URL(initial.request.url);\n const captured: GraphqlTestRequest = {\n url: initial.request.url,\n method: initial.request.method,\n path: url.pathname,\n headers: headersFromRequest(initial.request.headers),\n payload: payloadFromParams(initial.params),\n };\n return Effect.runPromise(\n Ref.update(requests, (all) => [...all, captured]).pipe(Effect.as(captured)),\n );\n};\n\nexport const serveGraphqlTestServer = (\n options: GraphqlTestServerOptions,\n): Effect.Effect<\n GraphqlTestServerShape,\n GraphqlTestServerAddressError | GraphqlTestServerHandlerError,\n Scope.Scope\n> =>\n Effect.gen(function* () {\n const requests = yield* Ref.make<readonly GraphqlTestRequest[]>([]);\n const path = options.path ?? \"/graphql\";\n\n const yoga = createYoga<Record<string, never>, GraphqlTestContext>({\n schema: options.schema,\n graphqlEndpoint: path,\n graphiql: false,\n landingPage: false,\n logging: false,\n maskedErrors: false,\n context: (initial) =>\n captureRequest(initial, requests).then((request) => ({\n request,\n })),\n });\n\n const server = yield* serveTestHttpApp((request) =>\n Effect.gen(function* () {\n const webRequest = yield* HttpServerRequest.toWeb(request);\n const response = yield* Effect.promise(() => Promise.resolve(yoga.handle(webRequest, {})));\n return HttpServerResponse.fromWeb(response);\n }).pipe(\n Effect.catch(() =>\n Effect.succeed(\n HttpServerResponse.text(\"GraphQL test server failed\", {\n status: 500,\n contentType: \"text/plain\",\n }),\n ),\n ),\n ),\n ).pipe(\n Effect.mapError((error) =>\n Predicate.isTagged(error, \"TestHttpServerAddressError\")\n ? new GraphqlTestServerAddressError({ address: error.address })\n : new GraphqlTestServerHandlerError({ cause: error.cause }),\n ),\n );\n\n return {\n endpoint: server.url(path),\n schema: options.schema,\n requests: Ref.get(requests),\n clearRequests: Ref.set(requests, []),\n };\n });\n\nexport class GraphqlTestServer extends Context.Service<GraphqlTestServer, GraphqlTestServerShape>()(\n \"@executor-js/plugin-graphql/testing/GraphqlTestServer\",\n) {\n static readonly layer = (options: GraphqlTestServerOptions) =>\n Layer.effect(GraphqlTestServer, serveGraphqlTestServer(options));\n}\n\nconst stringArgument = (\n args: Readonly<Record<string, unknown>>,\n key: string,\n fallback: string,\n): string => {\n const value = args[key];\n return typeof value === \"string\" ? value : fallback;\n};\n\nexport const makeGreetingGraphqlSchema = (): GraphQLSchema => {\n const Query = new GraphQLObjectType<unknown, GraphqlTestContext>({\n name: \"Query\",\n fields: {\n hello: {\n type: GraphQLString,\n description: \"Say hello\",\n args: {\n name: { type: GraphQLString },\n },\n resolve: (_source, args) => `Hello ${stringArgument(args, \"name\", \"world\")}`,\n },\n },\n });\n\n const Mutation = new GraphQLObjectType<unknown, GraphqlTestContext>({\n name: \"Mutation\",\n fields: {\n setGreeting: {\n type: GraphQLString,\n description: \"Set greeting message\",\n args: {\n message: { type: new GraphQLNonNull(GraphQLString) },\n },\n resolve: (_source, args) => stringArgument(args, \"message\", \"\"),\n },\n },\n });\n\n return new GraphQLSchema({ query: Query, mutation: Mutation });\n};\n\nexport const TestLayers = {\n greeting: () => GraphqlTestServer.layer({ schema: makeGreetingGraphqlSchema() }),\n};\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,OAEL;AACP,SAAS,mBAAmB,0BAA0B;AACtD,SAAS,gBAAgB,mBAAmB,eAAe,qBAAqB;AAChF,SAAS,kBAA+D;AACxE,SAAS,wBAAwB;AAEjC,IAAM,wBAAwB,aAAa,OAAO;AAAA,EAChD,OAAO,aAAa,SAAS,aAAa,MAAM;AAAA,EAChD,WAAW,aAAa,SAAS,aAAa,OAAO,aAAa,QAAQ,aAAa,OAAO,CAAC;AAAA,EAC/F,eAAe,aAAa,SAAS,aAAa,OAAO,aAAa,MAAM,CAAC;AAC/E,CAAC;AA4BD,IAAM,gCAAN,cAA4C,KAAK,YAAY,+BAA+B,EAEzF;AAAC;AAEJ,IAAM,gCAAN,cAA4C,KAAK,YAAY,+BAA+B,EAEzF;AAAC;AAEJ,IAAM,qBAAqB,CAAC,YAC1B,OAAO,YAAY,QAAQ,QAAQ,CAAC;AAEtC,IAAM,oBAAoB,CAAC,YAAkD;AAAA,EAC3E,OAAO,OAAO;AAAA,EACd,WACE,OAAO,OAAO,cAAc,YAAY,OAAO,cAAc,OACzD,OAAO,YACP;AAAA,EACN,eAAe,OAAO,iBAAiB;AACzC;AAEA,IAAM,iBAAiB,CACr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S,eAAe,MAAM,WAAW,EAAE;AAAA,MAChE;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO,IAAI,cAAc,EAAE,OAAO,OAAO,UAAU,SAAS,CAAC;AAC/D;AAEO,IAAM,aAAa;AAAA,EACxB,UAAU,MAAM,kBAAkB,MAAM,EAAE,QAAQ,0BAA0B,EAAE,CAAC;AACjF;","names":[]}
1
+ {"version":3,"sources":["../src/testing/index.ts"],"sourcesContent":["import {\n Context,\n Data,\n Effect,\n Layer,\n Predicate,\n Ref,\n Schema as EffectSchema,\n Scope,\n} from \"effect\";\nimport { HttpServerRequest, HttpServerResponse } from \"effect/unstable/http\";\nimport type { GraphQLSchema } from \"graphql\";\nimport {\n createSchema,\n createYoga,\n type GraphQLParams,\n type YogaInitialContext,\n} from \"graphql-yoga\";\nimport { OAuthTestServer, serveTestHttpApp } from \"@executor-js/sdk/testing\";\n\nconst GraphqlRequestPayload = EffectSchema.Struct({\n query: EffectSchema.optional(EffectSchema.String),\n variables: EffectSchema.optional(EffectSchema.Record(EffectSchema.String, EffectSchema.Unknown)),\n operationName: EffectSchema.optional(EffectSchema.NullOr(EffectSchema.String)),\n});\n\ntype GraphqlRequestPayload = typeof GraphqlRequestPayload.Type;\n\nexport interface GraphqlTestRequest {\n readonly url: string;\n readonly method: string;\n readonly path: string;\n readonly headers: Readonly<Record<string, string>>;\n readonly payload: GraphqlRequestPayload;\n}\n\nexport interface GraphqlTestContext {\n readonly request: GraphqlTestRequest;\n}\n\nexport interface GraphqlTestServerOptions {\n readonly schema: GraphQLSchema;\n readonly path?: string;\n readonly auth?: {\n readonly validateAuthorization: (authorization: string | null) => Effect.Effect<boolean>;\n readonly wwwAuthenticate?: string;\n };\n}\n\nexport interface GraphqlTestServerShape {\n readonly endpoint: string;\n readonly schema: GraphQLSchema;\n readonly requests: Effect.Effect<readonly GraphqlTestRequest[]>;\n readonly clearRequests: Effect.Effect<void>;\n}\n\nclass GraphqlTestServerAddressError extends Data.TaggedError(\"GraphqlTestServerAddressError\")<{\n readonly address: unknown;\n}> {}\n\nclass GraphqlTestServerHandlerError extends Data.TaggedError(\"GraphqlTestServerHandlerError\")<{\n readonly cause: unknown;\n}> {}\n\nconst headersFromRequest = (headers: Headers): Readonly<Record<string, string>> =>\n Object.fromEntries(headers.entries());\n\nconst payloadFromParams = (params: GraphQLParams): GraphqlRequestPayload => ({\n query: params.query,\n variables:\n typeof params.variables === \"object\" && params.variables !== null\n ? params.variables\n : undefined,\n operationName: params.operationName ?? null,\n});\n\nconst captureRequest = (\n initial: YogaInitialContext,\n requests: Ref.Ref<readonly GraphqlTestRequest[]>,\n) => {\n const url = new URL(initial.request.url);\n const captured: GraphqlTestRequest = {\n url: initial.request.url,\n method: initial.request.method,\n path: url.pathname,\n headers: headersFromRequest(initial.request.headers),\n payload: payloadFromParams(initial.params),\n };\n return Effect.runPromise(\n Ref.update(requests, (all) => [...all, captured]).pipe(Effect.as(captured)),\n );\n};\n\nexport const serveGraphqlTestServer = (\n options: GraphqlTestServerOptions,\n): Effect.Effect<\n GraphqlTestServerShape,\n GraphqlTestServerAddressError | GraphqlTestServerHandlerError,\n Scope.Scope\n> =>\n Effect.gen(function* () {\n const requests = yield* Ref.make<readonly GraphqlTestRequest[]>([]);\n const path = options.path ?? \"/graphql\";\n\n const yoga = createYoga<Record<string, never>, GraphqlTestContext>({\n schema: options.schema,\n graphqlEndpoint: path,\n graphiql: false,\n landingPage: false,\n logging: false,\n maskedErrors: false,\n context: (initial) =>\n captureRequest(initial, requests).then((request) => ({\n request,\n })),\n });\n\n const server = yield* serveTestHttpApp((request) =>\n Effect.gen(function* () {\n if (options.auth) {\n const accepted = yield* options.auth.validateAuthorization(\n request.headers.authorization ?? null,\n );\n if (!accepted) {\n const responseOptions = options.auth.wwwAuthenticate\n ? {\n status: 401,\n headers: { \"www-authenticate\": options.auth.wwwAuthenticate },\n }\n : { status: 401 };\n return HttpServerResponse.jsonUnsafe(\n { errors: [{ message: \"Unauthorized\" }] },\n responseOptions,\n );\n }\n }\n const webRequest = yield* HttpServerRequest.toWeb(request);\n const response = yield* Effect.promise(() => Promise.resolve(yoga.handle(webRequest, {})));\n return HttpServerResponse.fromWeb(response);\n }).pipe(\n Effect.catch(() =>\n Effect.succeed(\n HttpServerResponse.text(\"GraphQL test server failed\", {\n status: 500,\n contentType: \"text/plain\",\n }),\n ),\n ),\n ),\n ).pipe(\n Effect.mapError((error) =>\n Predicate.isTagged(error, \"TestHttpServerAddressError\")\n ? new GraphqlTestServerAddressError({ address: error.address })\n : new GraphqlTestServerHandlerError({ cause: error.cause }),\n ),\n );\n\n return {\n endpoint: server.url(path),\n schema: options.schema,\n requests: Ref.get(requests),\n clearRequests: Ref.set(requests, []),\n };\n });\n\nexport const serveGraphqlFailureTestServer = (options: {\n readonly status: number;\n readonly body: string;\n readonly contentType?: string;\n readonly path?: string;\n}) =>\n serveTestHttpApp(() =>\n Effect.succeed(\n HttpServerResponse.text(options.body, {\n status: options.status,\n contentType: options.contentType ?? \"text/plain\",\n }),\n ),\n ).pipe(\n Effect.map((server) => ({\n endpoint: server.url(options.path ?? \"/graphql\"),\n httpClientLayer: server.httpClientLayer,\n })),\n );\n\nexport class GraphqlTestServer extends Context.Service<GraphqlTestServer, GraphqlTestServerShape>()(\n \"@executor-js/plugin-graphql/testing/GraphqlTestServer\",\n) {\n static readonly layer = (options: GraphqlTestServerOptions) =>\n Layer.effect(GraphqlTestServer, serveGraphqlTestServer(options));\n\n static readonly layerWithOAuth = (options: Omit<GraphqlTestServerOptions, \"auth\">) =>\n Layer.effect(\n GraphqlTestServer,\n Effect.gen(function* () {\n const oauth = yield* OAuthTestServer;\n return yield* serveGraphqlTestServer({\n ...options,\n auth: {\n validateAuthorization: oauth.acceptsAuthorizationHeader,\n wwwAuthenticate: 'Bearer error=\"invalid_token\"',\n },\n });\n }),\n );\n}\n\nconst stringArgument = (\n args: Readonly<Record<string, unknown>>,\n key: string,\n fallback: string,\n): string => {\n const value = args[key];\n return typeof value === \"string\" ? value : fallback;\n};\n\nexport const makeGreetingGraphqlSchema = (\n options: { readonly includeMutation?: boolean } = {},\n): GraphQLSchema => {\n const includeMutation = options.includeMutation ?? true;\n return createSchema<GraphqlTestContext>({\n typeDefs: /* GraphQL */ `\n type Query {\n hello(name: String): String\n }\n\n ${\n includeMutation\n ? /* GraphQL */ `\n type Mutation {\n setGreeting(message: String!): String\n }\n `\n : \"\"\n }\n `,\n resolvers: {\n Query: {\n hello: (_source: unknown, args: Readonly<Record<string, unknown>>) =>\n `Hello ${stringArgument(args, \"name\", \"world\")}`,\n },\n ...(includeMutation\n ? {\n Mutation: {\n setGreeting: (_source: unknown, args: Readonly<Record<string, unknown>>) =>\n stringArgument(args, \"message\", \"\"),\n },\n }\n : {}),\n },\n });\n};\n\nexport const TestLayers = {\n greeting: () => GraphqlTestServer.layer({ schema: makeGreetingGraphqlSchema() }),\n greetingWithOAuth: () =>\n GraphqlTestServer.layerWithOAuth({ schema: makeGreetingGraphqlSchema() }),\n};\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,OAEL;AACP,SAAS,mBAAmB,0BAA0B;AAEtD;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,iBAAiB,wBAAwB;AAElD,IAAM,wBAAwB,aAAa,OAAO;AAAA,EAChD,OAAO,aAAa,SAAS,aAAa,MAAM;AAAA,EAChD,WAAW,aAAa,SAAS,aAAa,OAAO,aAAa,QAAQ,aAAa,OAAO,CAAC;AAAA,EAC/F,eAAe,aAAa,SAAS,aAAa,OAAO,aAAa,MAAM,CAAC;AAC/E,CAAC;AAgCD,IAAM,gCAAN,cAA4C,KAAK,YAAY,+BAA+B,EAEzF;AAAC;AAEJ,IAAM,gCAAN,cAA4C,KAAK,YAAY,+BAA+B,EAEzF;AAAC;AAEJ,IAAM,qBAAqB,CAAC,YAC1B,OAAO,YAAY,QAAQ,QAAQ,CAAC;AA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E,QAAQ,0BAA0B,EAAE,CAAC;AAAA,EAC/E,mBAAmB,MACjB,kBAAkB,eAAe,EAAE,QAAQ,0BAA0B,EAAE,CAAC;AAC5E;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@executor-js/plugin-graphql",
3
- "version": "1.4.28",
3
+ "version": "1.4.30",
4
4
  "homepage": "https://github.com/RhysSullivan/executor/tree/main/packages/plugins/graphql",
5
5
  "bugs": {
6
6
  "url": "https://github.com/RhysSullivan/executor/issues"
@@ -53,8 +53,8 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@effect/platform-node": "4.0.0-beta.59",
56
- "@executor-js/config": "1.4.28",
57
- "@executor-js/sdk": "1.4.28",
56
+ "@executor-js/config": "1.4.30",
57
+ "@executor-js/sdk": "1.4.30",
58
58
  "effect": "4.0.0-beta.59",
59
59
  "graphql": "^16.12.0",
60
60
  "graphql-yoga": "^5.17.0"
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/react/AddGraphqlSource.tsx","../src/react/defaults.ts"],"sourcesContent":["import { useCallback, useState } from \"react\";\nimport { useAtomSet } from \"@effect/atom-react\";\nimport * as Exit from \"effect/Exit\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\n\nimport { useScope } from \"@executor-js/react/api/scope-context\";\nimport { sourceWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport {\n HttpCredentialsEditor,\n httpCredentialsValid,\n serializeScopedHttpCredentials,\n serializeHttpCredentials,\n type HttpCredentialsState,\n} from \"@executor-js/react/plugins/http-credentials\";\nimport {\n sourceDisplayNameFromUrl,\n slugifyNamespace,\n useSourceIdentity,\n} from \"@executor-js/react/plugins/source-identity\";\nimport {\n oauthCallbackUrl,\n oauthConnectionId,\n useOAuthPopupFlow,\n type OAuthCompletionPayload,\n} from \"@executor-js/react/plugins/oauth-sign-in\";\nimport {\n CredentialControlField,\n CredentialUsageRow,\n useCredentialTargetScope,\n} from \"@executor-js/react/plugins/credential-target-scope\";\nimport { useSecretPickerSecrets } from \"@executor-js/react/plugins/use-secret-picker-secrets\";\nimport { Button } from \"@executor-js/react/components/button\";\nimport { FilterTabs } from \"@executor-js/react/components/filter-tabs\";\nimport { FloatActions } from \"@executor-js/react/components/float-actions\";\nimport { Spinner } from \"@executor-js/react/components/spinner\";\nimport { addGraphqlSourceOptimistic } from \"./atoms\";\nimport { initialGraphqlCredentials } from \"./defaults\";\nimport { GraphqlSourceFields } from \"./GraphqlSourceFields\";\nimport type { GraphqlCredentialInput } from \"../sdk/types\";\n\nconst ErrorMessage = Schema.Struct({ message: Schema.String });\nconst decodeErrorMessage = Schema.decodeUnknownOption(ErrorMessage);\n\nconst errorMessageFromExit = (exit: Exit.Exit<unknown, unknown>, fallback: string): string =>\n Option.match(Option.flatMap(Exit.findErrorOption(exit), decodeErrorMessage), {\n onNone: () => fallback,\n onSome: ({ message }) => message,\n });\n\ntype AuthMode = \"none\" | \"oauth2\";\n\nexport default function AddGraphqlSource(props: {\n onComplete: () => void;\n onCancel: () => void;\n initialUrl?: string;\n}) {\n const [endpoint, setEndpoint] = useState(props.initialUrl ?? \"\");\n const identity = useSourceIdentity({\n fallbackName: sourceDisplayNameFromUrl(endpoint, \"GraphQL\") ?? \"\",\n });\n const [credentials, setCredentials] = useState<HttpCredentialsState>(initialGraphqlCredentials);\n const [adding, setAdding] = useState(false);\n const [addError, setAddError] = useState<string | null>(null);\n const [authMode, setAuthMode] = useState<AuthMode>(\"none\");\n const [tokens, setTokens] = useState<OAuthCompletionPayload | null>(null);\n\n const scopeId = useScope();\n const { credentialTargetScope: requestCredentialTargetScope } = useCredentialTargetScope();\n const {\n credentialTargetScope: oauthCredentialTargetScope,\n setCredentialTargetScope: setOAuthCredentialTargetScope,\n credentialScopeOptions,\n } = useCredentialTargetScope();\n const doAdd = useAtomSet(addGraphqlSourceOptimistic(scopeId), {\n mode: \"promiseExit\",\n });\n const secretList = useSecretPickerSecrets();\n const oauth = useOAuthPopupFlow({\n popupName: \"graphql-oauth\",\n startErrorMessage: \"Failed to start OAuth\",\n });\n\n const canAdd =\n endpoint.trim().length > 0 &&\n httpCredentialsValid(credentials) &&\n (authMode === \"none\" || tokens !== null) &&\n !oauth.busy;\n\n const sourceIdentity = useCallback(() => {\n const trimmedEndpoint = endpoint.trim();\n const namespace =\n slugifyNamespace(identity.namespace) ||\n slugifyNamespace(sourceDisplayNameFromUrl(trimmedEndpoint, \"GraphQL\") ?? \"\") ||\n \"graphql\";\n const displayName =\n identity.name.trim() || sourceDisplayNameFromUrl(trimmedEndpoint, \"GraphQL\") || namespace;\n return { trimmedEndpoint, namespace, displayName };\n }, [endpoint, identity.name, identity.namespace]);\n\n const handleOAuth = useCallback(async () => {\n if (!endpoint.trim() || !httpCredentialsValid(credentials)) return;\n setAddError(null);\n const { trimmedEndpoint, namespace, displayName } = sourceIdentity();\n const { headers, queryParams } = serializeHttpCredentials(credentials);\n await oauth.start({\n payload: {\n endpoint: trimmedEndpoint,\n ...(Object.keys(headers).length > 0 ? { headers } : {}),\n ...(Object.keys(queryParams).length > 0 ? { queryParams } : {}),\n redirectUrl: oauthCallbackUrl(),\n connectionId: oauthConnectionId({ pluginId: \"graphql\", namespace }),\n tokenScope: oauthCredentialTargetScope,\n strategy: { kind: \"dynamic-dcr\" },\n pluginId: \"graphql\",\n identityLabel: `${displayName} OAuth`,\n },\n onSuccess: (result) => {\n setTokens({\n connectionId: result.connectionId,\n expiresAt: result.expiresAt,\n scope: result.scope,\n });\n },\n onError: setAddError,\n });\n }, [endpoint, credentials, oauth, sourceIdentity, oauthCredentialTargetScope]);\n\n const handleAdd = async () => {\n setAdding(true);\n setAddError(null);\n const { headers: headerMap, queryParams } = serializeScopedHttpCredentials(\n credentials,\n requestCredentialTargetScope,\n );\n\n const { trimmedEndpoint, namespace, displayName } = sourceIdentity();\n const exit = await doAdd({\n params: { scopeId },\n payload: {\n targetScope: scopeId,\n endpoint: trimmedEndpoint,\n name: displayName,\n namespace,\n ...(Object.keys(headerMap).length > 0 ? { headers: headerMap } : {}),\n ...(Object.keys(queryParams).length > 0\n ? {\n queryParams: queryParams as Record<string, GraphqlCredentialInput>,\n }\n : {}),\n credentialTargetScope:\n authMode === \"oauth2\" && tokens\n ? oauthCredentialTargetScope\n : requestCredentialTargetScope,\n ...(authMode === \"oauth2\" && tokens\n ? {\n auth: {\n kind: \"oauth2\" as const,\n connectionId: tokens.connectionId,\n },\n }\n : {}),\n },\n reactivityKeys: sourceWriteKeys,\n });\n if (Exit.isFailure(exit)) {\n setAddError(errorMessageFromExit(exit, \"Failed to add source\"));\n setAdding(false);\n return;\n }\n props.onComplete();\n };\n\n return (\n <div className=\"flex flex-1 flex-col gap-6\">\n <h1 className=\"text-xl font-semibold text-foreground\">Add GraphQL Source</h1>\n\n <GraphqlSourceFields endpoint={endpoint} onEndpointChange={setEndpoint} identity={identity} />\n\n <HttpCredentialsEditor\n credentials={credentials}\n onChange={setCredentials}\n existingSecrets={secretList}\n sourceName={identity.name}\n targetScope={requestCredentialTargetScope}\n credentialScopeOptions={credentialScopeOptions}\n bindingScopeOptions={credentialScopeOptions}\n />\n\n {/* Temporarily hidden while we revisit GraphQL OAuth discovery and UX. */}\n <section className=\"hidden space-y-2.5\">\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"text-sm font-medium text-foreground\">Authentication</span>\n <FilterTabs<AuthMode>\n tabs={[\n { value: \"none\", label: \"None\" },\n { value: \"oauth2\", label: \"OAuth\" },\n ]}\n value={authMode}\n onChange={(value) => {\n setAuthMode(value);\n setTokens(null);\n }}\n />\n </div>\n\n {authMode === \"oauth2\" && (\n <CredentialUsageRow\n value={oauthCredentialTargetScope}\n options={credentialScopeOptions}\n onChange={(targetScope) => {\n setOAuthCredentialTargetScope(targetScope);\n setTokens(null);\n }}\n label=\"Connection saved to\"\n help=\"Choose who can use the OAuth connection.\"\n >\n <CredentialControlField label=\"Connect via OAuth\" help=\"Start the provider OAuth flow.\">\n <div className=\"flex min-h-9 items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-2\">\n {tokens ? (\n <span className=\"text-xs font-medium text-emerald-600 dark:text-emerald-400\">\n Authenticated\n </span>\n ) : (\n <span className=\"text-xs text-muted-foreground\">Not connected</span>\n )}\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className=\"ml-auto h-7 px-2 text-xs\"\n onClick={() => void handleOAuth()}\n disabled={!endpoint.trim() || !httpCredentialsValid(credentials) || oauth.busy}\n >\n {oauth.busy ? \"Signing in...\" : tokens ? \"Reconnect\" : \"Sign in\"}\n </Button>\n </div>\n </CredentialControlField>\n </CredentialUsageRow>\n )}\n </section>\n\n {/* Error */}\n {addError && (\n <div className=\"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2\">\n <p className=\"text-[12px] text-destructive\">{addError}</p>\n </div>\n )}\n\n <FloatActions>\n <Button\n variant=\"ghost\"\n onClick={() => {\n oauth.cancel();\n props.onCancel();\n }}\n disabled={adding}\n >\n Cancel\n </Button>\n <Button onClick={handleAdd} disabled={!canAdd || adding}>\n {adding && <Spinner className=\"size-3.5\" />}\n {adding ? \"Adding...\" : \"Add source\"}\n </Button>\n </FloatActions>\n </div>\n );\n}\n","import {\n emptyHttpCredentials,\n type HttpCredentialsState,\n} from \"@executor-js/react/plugins/http-credentials\";\n\nexport const initialGraphqlCredentials = (): HttpCredentialsState => emptyHttpCredentials();\n"],"mappings":";;;;;;;;;AAAA,SAAS,aAAa,gBAAgB;AACtC,SAAS,kBAAkB;AAC3B,YAAY,UAAU;AACtB,YAAY,YAAY;AACxB,YAAY,YAAY;AAExB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,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AAA,UACR,SAAS,MAAM;AACb,kBAAM,OAAO;AACb,kBAAM,SAAS;AAAA,UACjB;AAAA,UACA,UAAU;AAAA,UACX;AAAA;AAAA,MAED;AAAA,MACA,qBAAC,UAAO,SAAS,WAAW,UAAU,CAAC,UAAU,QAC9C;AAAA,kBAAU,oBAAC,WAAQ,WAAU,YAAW;AAAA,QACxC,SAAS,cAAc;AAAA,SAC1B;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/react/EditGraphqlSource.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { useAtomValue, useAtomSet } from \"@effect/atom-react\";\nimport * as Exit from \"effect/Exit\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport {\n graphqlSourceAtom,\n graphqlSourceBindingsAtom,\n setGraphqlSourceBinding,\n updateGraphqlSource,\n} from \"./atoms\";\nimport { connectionsAtom } from \"@executor-js/react/api/atoms\";\nimport { useScope, useScopeStack } from \"@executor-js/react/api/scope-context\";\nimport { connectionWriteKeys, sourceWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport { useSecretPickerSecrets } from \"@executor-js/react/plugins/use-secret-picker-secrets\";\nimport {\n HttpCredentialsEditor,\n serializeHttpCredentials,\n serializeScopedHttpCredentials,\n type HttpCredentialsState,\n} from \"@executor-js/react/plugins/http-credentials\";\nimport {\n effectiveCredentialBindingForScope,\n httpCredentialsFromConfiguredCredentialBindings,\n initialCredentialTargetScope,\n} from \"@executor-js/react/plugins/credential-bindings\";\nimport { slugifyNamespace, useSourceIdentity } from \"@executor-js/react/plugins/source-identity\";\nimport { useCredentialTargetScope } from \"@executor-js/react/plugins/credential-target-scope\";\nimport { Button } from \"@executor-js/react/components/button\";\nimport { FilterTabs } from \"@executor-js/react/components/filter-tabs\";\nimport { SourceOAuthConnectionControl } from \"@executor-js/react/plugins/source-oauth-connection\";\nimport { Badge } from \"@executor-js/react/components/badge\";\nimport { ScopeId } from \"@executor-js/sdk/core\";\nimport { GraphqlSourceFields } from \"./GraphqlSourceFields\";\nimport {\n GRAPHQL_OAUTH_CONNECTION_SLOT,\n type GraphqlCredentialInput,\n GraphqlSourceBindingInput,\n type GraphqlSourceBindingRef,\n} from \"../sdk/types\";\nimport type { StoredGraphqlSource } from \"../sdk/store\";\n\ntype EditableSource = StoredGraphqlSource;\ntype AuthMode = \"none\" | \"oauth2\";\n\n// ---------------------------------------------------------------------------\n// Edit form\n// ---------------------------------------------------------------------------\n\nfunction EditForm(props: {\n sourceId: string;\n initial: EditableSource;\n bindings: readonly GraphqlSourceBindingRef[];\n onSave: () => void;\n}) {\n const displayScope = useScope();\n const scopeStack = useScopeStack();\n const sourceScope = ScopeId.make(props.initial.scope);\n const { credentialTargetScope, credentialScopeOptions } = useCredentialTargetScope({\n sourceScope,\n initialTargetScope: initialCredentialTargetScope(sourceScope, props.bindings),\n });\n const {\n credentialTargetScope: oauthCredentialTargetScope,\n setCredentialTargetScope: setOAuthCredentialTargetScope,\n } = useCredentialTargetScope({\n sourceScope,\n initialTargetScope: initialCredentialTargetScope(sourceScope, props.bindings),\n });\n const doUpdate = useAtomSet(updateGraphqlSource, { mode: \"promiseExit\" });\n const setBinding = useAtomSet(setGraphqlSourceBinding, { mode: \"promise\" });\n const secretList = useSecretPickerSecrets();\n const connectionsResult = useAtomValue(connectionsAtom(displayScope));\n\n const identity = useSourceIdentity({\n fallbackName: props.initial.name,\n fallbackNamespace: props.initial.namespace,\n });\n const [endpoint, setEndpoint] = useState(props.initial.endpoint);\n const [credentials, setCredentials] = useState<HttpCredentialsState>(() =>\n httpCredentialsFromConfiguredCredentialBindings({\n headers: props.initial.headers,\n queryParams: props.initial.queryParams,\n bindings: props.bindings,\n }),\n );\n const [authMode, setAuthMode] = useState<AuthMode>(props.initial.auth.kind);\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [credentialsDirty, setCredentialsDirty] = useState(false);\n const [authDirty, setAuthDirty] = useState(false);\n\n const identityDirty = identity.name.trim() !== props.initial.name.trim();\n const metadataDirty = identityDirty || endpoint.trim() !== props.initial.endpoint.trim();\n const dirty = metadataDirty || credentialsDirty || authDirty;\n const oauth2 = props.initial.auth.kind === \"oauth2\" ? props.initial.auth : null;\n const connections = AsyncResult.isSuccess(connectionsResult) ? connectionsResult.value : [];\n const scopeRanks = new Map(scopeStack.map((scope, index) => [scope.id, index] as const));\n const connectionBinding = oauth2\n ? effectiveCredentialBindingForScope(\n props.bindings,\n oauth2.connectionSlot,\n oauthCredentialTargetScope,\n scopeRanks,\n )\n : null;\n const boundConnectionId =\n connectionBinding?.value.kind === \"connection\" ? connectionBinding.value.connectionId : null;\n const isConnected =\n boundConnectionId !== null &&\n connections.some((connection) => connection.id === boundConnectionId);\n const oauthRequestCredentials = serializeHttpCredentials(credentials);\n\n const handleCredentialsChange = (next: HttpCredentialsState) => {\n setCredentials(next);\n setCredentialsDirty(true);\n };\n\n const handleSave = async () => {\n setSaving(true);\n setError(null);\n const { headers, queryParams } = serializeScopedHttpCredentials(\n credentials,\n credentialTargetScope,\n );\n const payload: {\n sourceScope: ScopeId;\n name?: string;\n endpoint?: string;\n headers?: Record<string, GraphqlCredentialInput>;\n queryParams?: Record<string, GraphqlCredentialInput>;\n credentialTargetScope?: ScopeId;\n auth?: { kind: \"none\" } | { kind: \"oauth2\"; connectionSlot: string };\n } = {\n sourceScope,\n name: metadataDirty ? identity.name.trim() || undefined : undefined,\n endpoint: metadataDirty ? endpoint.trim() || undefined : undefined,\n };\n if (credentialsDirty) {\n payload.headers = headers;\n payload.queryParams = queryParams as Record<string, GraphqlCredentialInput>;\n payload.credentialTargetScope = credentialTargetScope;\n }\n if (authDirty) {\n payload.auth =\n authMode === \"oauth2\"\n ? {\n kind: \"oauth2\",\n connectionSlot:\n props.initial.auth.kind === \"oauth2\"\n ? props.initial.auth.connectionSlot\n : GRAPHQL_OAUTH_CONNECTION_SLOT,\n }\n : { kind: \"none\" };\n payload.credentialTargetScope = credentialTargetScope;\n }\n const exit = await doUpdate({\n params: { scopeId: displayScope, namespace: props.sourceId },\n payload,\n reactivityKeys: sourceWriteKeys,\n });\n\n if (Exit.isFailure(exit)) {\n setError(\"Failed to update source\");\n setSaving(false);\n return;\n }\n\n setCredentialsDirty(false);\n setAuthDirty(false);\n props.onSave();\n setSaving(false);\n };\n\n return (\n <div className=\"space-y-6\">\n <div>\n <h1 className=\"text-xl font-semibold text-foreground\">Edit GraphQL Source</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n Update the endpoint and authentication headers for this source.\n </p>\n </div>\n\n <div className=\"flex items-center gap-3 rounded-lg border border-border bg-card px-4 py-3\">\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-semibold text-card-foreground\">{props.sourceId}</p>\n </div>\n <Badge variant=\"secondary\" className=\"text-xs\">\n GraphQL\n </Badge>\n </div>\n\n <GraphqlSourceFields\n endpoint={endpoint}\n onEndpointChange={setEndpoint}\n identity={identity}\n namespaceReadOnly\n />\n\n <HttpCredentialsEditor\n credentials={credentials}\n onChange={handleCredentialsChange}\n existingSecrets={secretList}\n sourceName={identity.name}\n targetScope={credentialTargetScope}\n credentialScopeOptions={credentialScopeOptions}\n bindingScopeOptions={credentialScopeOptions}\n />\n\n {/* Temporarily hidden while we revisit GraphQL OAuth discovery and UX. */}\n <section className=\"hidden space-y-2.5\">\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"text-sm font-medium text-foreground\">Authentication</span>\n <FilterTabs<AuthMode>\n tabs={[\n { value: \"none\", label: \"None\" },\n { value: \"oauth2\", label: \"OAuth\" },\n ]}\n value={authMode}\n onChange={(value) => {\n setAuthMode(value);\n setAuthDirty(true);\n }}\n />\n </div>\n {authMode === \"oauth2\" && (\n <p className=\"text-xs text-muted-foreground\">\n OAuth sign-in is available from the source header after saving.\n </p>\n )}\n </section>\n\n {oauth2 && (\n <SourceOAuthConnectionControl\n popupName=\"graphql-oauth\"\n pluginId=\"graphql\"\n namespace={slugifyNamespace(props.initial.namespace) || \"graphql\"}\n fallbackNamespace=\"graphql\"\n endpoint={endpoint.trim()}\n tokenScope={oauthCredentialTargetScope}\n onTokenScopeChange={setOAuthCredentialTargetScope}\n credentialScopeOptions={credentialScopeOptions}\n connectionId={boundConnectionId}\n sourceLabel={`${identity.name.trim() || props.initial.namespace || \"GraphQL\"} OAuth`}\n headers={oauthRequestCredentials.headers}\n queryParams={oauthRequestCredentials.queryParams}\n isConnected={isConnected}\n onConnected={async (connectionId) => {\n await setBinding({\n params: { scopeId: oauthCredentialTargetScope },\n payload: GraphqlSourceBindingInput.make({\n sourceId: props.sourceId,\n sourceScope,\n scope: oauthCredentialTargetScope,\n slot: oauth2.connectionSlot,\n value: { kind: \"connection\", connectionId },\n }),\n reactivityKeys: [...sourceWriteKeys, ...connectionWriteKeys],\n });\n }}\n />\n )}\n\n {error && (\n <div className=\"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2\">\n <p className=\"text-sm text-destructive\">{error}</p>\n </div>\n )}\n\n <div className=\"flex items-center justify-between border-t border-border pt-4\">\n <Button variant=\"ghost\" onClick={props.onSave}>\n Cancel\n </Button>\n <Button onClick={handleSave} disabled={!dirty || saving}>\n {saving ? \"Saving…\" : \"Save changes\"}\n </Button>\n </div>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Main component\n// ---------------------------------------------------------------------------\n\nexport default function EditGraphqlSource(props: { sourceId: string; onSave: () => void }) {\n const scopeId = useScope();\n const sourceResult = useAtomValue(graphqlSourceAtom(scopeId, props.sourceId));\n const source =\n AsyncResult.isSuccess(sourceResult) && sourceResult.value ? sourceResult.value : null;\n const sourceScope = source ? ScopeId.make(source.scope) : scopeId;\n const bindingsResult = useAtomValue(\n graphqlSourceBindingsAtom(scopeId, props.sourceId, sourceScope),\n );\n\n if (!AsyncResult.isSuccess(sourceResult) || !source || !AsyncResult.isSuccess(bindingsResult)) {\n return (\n <div className=\"space-y-6\">\n <div>\n <h1 className=\"text-xl font-semibold text-foreground\">Edit GraphQL Source</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">Loading configuration…</p>\n </div>\n </div>\n );\n }\n\n return (\n <EditForm\n sourceId={props.sourceId}\n initial={source as EditableSource}\n bindings={bindingsResult.value}\n onSave={props.onSave}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,cAAc,kBAAkB;AACzC,YAAY,UAAU;AACtB,YAAY,iBAAiB;AAO7B,SAAS,uBAAuB;AAChC,SAAS,UAAU,qBAAqB;AACxC,SAAS,qBAAqB,uBAAuB;AACrD,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,gCAAgC;AACzC,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,oCAAoC;AAC7C,SAAS,aAAa;AACtB,SAAS,eAAe;AAgJlB,SACE,KADF;AA/HN,SAAS,SAAS,OAKf;AACD,QAAM,eAAe,SAAS;AAC9B,QAAM,aAAa,cAAc;AACjC,QAAM,cAAc,QAAQ,KAAK,MAAM,QAAQ,KAAK;AACpD,QAAM,EAAE,uBAAuB,uBAAuB,IAAI,yBAAyB;AAAA,IACjF;AAAA,IACA,oBAAoB,6BAA6B,aAAa,MAAM,QAAQ;AAAA,EAC9E,CAAC;AACD,QAAM;AAAA,IACJ,uBAAuB;AAAA,IACvB,0BAA0B;AAAA,EAC5B,IAAI,yBAAyB;AAAA,IAC3B;AAAA,IACA,oBAAoB,6BAA6B,aAAa,MAAM,QAAQ;AAAA,EAC9E,CAAC;AACD,QAAM,WAAW,WAAW,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACxE,QAAM,aAAa,WAAW,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAC1E,QAAM,aAAa,uBAAuB;AAC1C,QAAM,oBAAoB,aAAa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OAC1E,GACF;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,MAAM;AAAA,MAChB,SAAS;AAAA,MACT,UAAU,eAAe;AAAA,MACzB,QAAQ,MAAM;AAAA;AAAA,EAChB;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/react/GraphqlSourceSummary.tsx"],"sourcesContent":["import { useAtomValue } from \"@effect/atom-react\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\n\nimport { connectionsAtom } from \"@executor-js/react/api/atoms\";\nimport { useScope, useScopeStack, useUserScope } from \"@executor-js/react/api/scope-context\";\nimport {\n SourceCredentialNotice,\n SourceCredentialStatusBadge,\n missingSourceCredentialLabels,\n type SourceCredentialSlot,\n} from \"@executor-js/react/plugins/source-credential-status\";\nimport { ScopeId } from \"@executor-js/sdk/core\";\n\nimport { graphqlSourceAtom, graphqlSourceBindingsAtom } from \"./atoms\";\nimport type { StoredGraphqlSource } from \"../sdk/store\";\n\nconst sourceCredentialSlots = (source: StoredGraphqlSource): readonly SourceCredentialSlot[] => {\n const slots: SourceCredentialSlot[] = [];\n for (const [name, value] of Object.entries(source.headers)) {\n if (typeof value !== \"string\") slots.push({ kind: \"secret\", slot: value.slot, label: name });\n }\n for (const [name, value] of Object.entries(source.queryParams)) {\n if (typeof value !== \"string\") slots.push({ kind: \"secret\", slot: value.slot, label: name });\n }\n if (source.auth.kind === \"oauth2\") {\n slots.push({\n kind: \"connection\",\n slot: source.auth.connectionSlot,\n label: \"OAuth sign-in\",\n });\n }\n return slots;\n};\n\nexport default function GraphqlSourceSummary(props: {\n sourceId: string;\n variant?: \"badge\" | \"panel\";\n onAction?: () => void;\n}) {\n const displayScope = useScope();\n const userScope = useUserScope();\n const scopeStack = useScopeStack();\n const sourceResult = useAtomValue(graphqlSourceAtom(displayScope, props.sourceId));\n const source =\n AsyncResult.isSuccess(sourceResult) && sourceResult.value ? sourceResult.value : null;\n const sourceScope = source ? ScopeId.make(source.scope) : displayScope;\n const bindingsResult = useAtomValue(\n graphqlSourceBindingsAtom(displayScope, props.sourceId, sourceScope),\n );\n const connectionsResult = useAtomValue(connectionsAtom(displayScope));\n\n if (!source) return null;\n const slots = sourceCredentialSlots(source as StoredGraphqlSource);\n if (slots.length === 0) return null;\n if (!AsyncResult.isSuccess(bindingsResult) || !AsyncResult.isSuccess(connectionsResult)) {\n return props.variant === \"panel\" ? null : (\n <SourceCredentialStatusBadge missing={[\"credentials\"]} />\n );\n }\n\n const scopeRanks = new Map(scopeStack.map((scope, index) => [scope.id, index] as const));\n const liveConnectionIds = new Set(connectionsResult.value.map((connection) => connection.id));\n const missing = missingSourceCredentialLabels({\n slots,\n bindings: bindingsResult.value,\n targetScope: userScope,\n scopeRanks,\n liveConnectionIds,\n });\n\n if (props.variant === \"panel\") {\n return <SourceCredentialNotice missing={missing} onAction={props.onAction} />;\n }\n\n return <SourceCredentialStatusBadge missing={missing} />;\n}\n"],"mappings":";;;;;;;AAAA,SAAS,oBAAoB;AAC7B,YAAY,iBAAiB;AAE7B,SAAS,uBAAuB;AAChC,SAAS,UAAU,eAAe,oBAAoB;AACtD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,eAAe;AA6ClB;AAxCN,IAAM,wBAAwB,CAAC,WAAiE;AAC9F,QAAM,QAAgC,CAAC;AACvC,aAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,OAAO,OAAO,GAAG;AAC1D,QAAI,OAAO,UAAU,SAAU,OAAM,KAAK,EAAE,MAAM,UAAU,MAAM,MAAM,MAAM,OAAO,KAAK,CAAC;AAAA,EAC7F;AACA,aAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,OAAO,WAAW,GAAG;AAC9D,QAAI,OAAO,UAAU,SAAU,OAAM,KAAK,EAAE,MAAM,UAAU,MAAM,MAAM,MAAM,OAAO,KAAK,CAAC;AAAA,EAC7F;AACA,MAAI,OAAO,KAAK,SA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","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/sdk/errors.ts","../src/sdk/types.ts"],"sourcesContent":["import { Data, Schema } from \"effect\";\nimport type { Option } from \"effect\";\n\nexport class GraphqlIntrospectionError extends Schema.TaggedErrorClass<GraphqlIntrospectionError>()(\n \"GraphqlIntrospectionError\",\n {\n message: Schema.String,\n },\n) {}\n\nexport class GraphqlExtractionError extends Schema.TaggedErrorClass<GraphqlExtractionError>()(\n \"GraphqlExtractionError\",\n {\n message: Schema.String,\n },\n) {}\n\nexport class GraphqlInvocationError extends Data.TaggedError(\"GraphqlInvocationError\")<{\n readonly message: string;\n readonly statusCode: Option.Option<number>;\n readonly cause?: unknown;\n}> {}\n","import { Effect, Schema } from \"effect\";\nimport {\n ConfiguredCredentialValue,\n CredentialBindingValue,\n credentialSlotKey,\n ScopedSecretCredentialInput,\n SecretBackedValue,\n ScopeId,\n} from \"@executor-js/sdk/core\";\n\n// ---------------------------------------------------------------------------\n// GraphQL operation kind\n// ---------------------------------------------------------------------------\n\nexport const GraphqlOperationKind = Schema.Literals([\"query\", \"mutation\"]);\nexport type GraphqlOperationKind = typeof GraphqlOperationKind.Type;\n\n// ---------------------------------------------------------------------------\n// Extracted field (becomes a tool)\n// ---------------------------------------------------------------------------\n\nexport const GraphqlArgument = Schema.Struct({\n name: Schema.String,\n typeName: Schema.String,\n required: Schema.Boolean,\n description: Schema.OptionFromOptional(Schema.String),\n});\nexport type GraphqlArgument = typeof GraphqlArgument.Type;\n\nexport const ExtractedField = Schema.Struct({\n /** e.g. \"user\", \"createUser\" */\n fieldName: Schema.String,\n /** \"query\" or \"mutation\" */\n kind: GraphqlOperationKind,\n description: Schema.OptionFromOptional(Schema.String),\n arguments: Schema.Array(GraphqlArgument),\n /** JSON Schema for the input (built from arguments) */\n inputSchema: Schema.OptionFromOptional(Schema.Unknown),\n /** The return type name for documentation */\n returnTypeName: Schema.String,\n});\nexport type ExtractedField = typeof ExtractedField.Type;\n\nexport const ExtractionResult = Schema.Struct({\n /** Schema name from introspection */\n schemaName: Schema.OptionFromOptional(Schema.String),\n fields: Schema.Array(ExtractedField),\n});\nexport type ExtractionResult = typeof ExtractionResult.Type;\n\n// ---------------------------------------------------------------------------\n// Operation binding — minimal data needed to invoke\n// ---------------------------------------------------------------------------\n\nexport const OperationBinding = Schema.Struct({\n kind: GraphqlOperationKind,\n fieldName: Schema.String,\n /** The full GraphQL query/mutation string */\n operationString: Schema.String,\n /** Ordered variable names for mapping */\n variableNames: Schema.Array(Schema.String),\n});\nexport type OperationBinding = typeof OperationBinding.Type;\n\n// ---------------------------------------------------------------------------\n// Invocation\n// ---------------------------------------------------------------------------\n\nexport const HeaderValue = SecretBackedValue;\nexport type HeaderValue = typeof HeaderValue.Type;\nexport const QueryParamValue = HeaderValue;\nexport type QueryParamValue = typeof QueryParamValue.Type;\n\nexport const ConfiguredGraphqlCredentialValue = ConfiguredCredentialValue;\nexport type ConfiguredGraphqlCredentialValue = typeof ConfiguredGraphqlCredentialValue.Type;\nexport const GraphqlCredentialInput = Schema.Union([\n ScopedSecretCredentialInput,\n HeaderValue,\n ConfiguredGraphqlCredentialValue,\n]);\nexport type GraphqlCredentialInput = typeof GraphqlCredentialInput.Type;\n\nexport const graphqlHeaderSlot = (name: string): string => credentialSlotKey(\"header\", name);\nexport const graphqlQueryParamSlot = (name: string): string =>\n credentialSlotKey(\"query_param\", name);\nexport const GRAPHQL_OAUTH_CONNECTION_SLOT = \"auth:oauth2:connection\";\n\n// ---------------------------------------------------------------------------\n// Source auth\n// ---------------------------------------------------------------------------\n\nexport const GraphqlSourceAuth = Schema.Union([\n Schema.Struct({ kind: Schema.Literal(\"none\") }),\n Schema.Struct({\n kind: Schema.Literal(\"oauth2\"),\n connectionSlot: Schema.String,\n }),\n]);\nexport type GraphqlSourceAuth = typeof GraphqlSourceAuth.Type;\n\nexport const GraphqlSourceAuthInput = Schema.Union([\n GraphqlSourceAuth,\n Schema.Struct({\n kind: Schema.Literal(\"oauth2\"),\n connectionId: Schema.String,\n }),\n]);\nexport type GraphqlSourceAuthInput = typeof GraphqlSourceAuthInput.Type;\n\nexport const GraphqlSourceBindingValue = CredentialBindingValue;\nexport type GraphqlSourceBindingValue = typeof GraphqlSourceBindingValue.Type;\n\nexport const GraphqlSourceBindingInput = Schema.Struct({\n sourceId: Schema.String,\n sourceScope: ScopeId,\n scope: ScopeId,\n slot: Schema.String,\n value: GraphqlSourceBindingValue,\n});\nexport type GraphqlSourceBindingInput = typeof GraphqlSourceBindingInput.Type;\n\nexport const GraphqlSourceBindingRef = Schema.Struct({\n sourceId: Schema.String,\n sourceScopeId: ScopeId,\n scopeId: ScopeId,\n slot: Schema.String,\n value: GraphqlSourceBindingValue,\n createdAt: Schema.Date,\n updatedAt: Schema.Date,\n});\nexport type GraphqlSourceBindingRef = typeof GraphqlSourceBindingRef.Type;\n\nexport const InvocationConfig = Schema.Struct({\n /** The GraphQL endpoint URL */\n endpoint: Schema.String,\n /** Headers applied to every request. Values can reference secrets. */\n headers: Schema.Record(Schema.String, ConfiguredGraphqlCredentialValue).pipe(\n Schema.withDecodingDefault(Effect.succeed({})),\n Schema.withConstructorDefault(Effect.succeed({})),\n ),\n /** Query parameters applied to every request. Values can reference secrets. */\n queryParams: Schema.Record(Schema.String, ConfiguredGraphqlCredentialValue).pipe(\n Schema.withDecodingDefault(Effect.succeed({})),\n Schema.withConstructorDefault(Effect.succeed({})),\n ),\n});\nexport type InvocationConfig = typeof InvocationConfig.Type;\n\nexport const InvocationResult = Schema.Struct({\n status: Schema.Number,\n data: Schema.NullOr(Schema.Unknown),\n errors: Schema.NullOr(Schema.Unknown),\n});\nexport type InvocationResult = typeof InvocationResult.Type;\n"],"mappings":";AAAA,SAAS,MAAM,cAAc;AAGtB,IAAM,4BAAN,cAAwC,OAAO,iBAA4C;AAAA,EAChG;AAAA,EACA;AAAA,IACE,SAAS,OAAO;AAAA,EAClB;AACF,EAAE;AAAC;AAEI,IAAM,yBAAN,cAAqC,OAAO,iBAA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AAQ,CAAC,CAAC,CAAC;AAAA,IAC7CA,QAAO,uBAAuB,OAAO,QAAQ,CAAC,CAAC,CAAC;AAAA,EAClD;AACF,CAAC;AAGM,IAAM,mBAAmBA,QAAO,OAAO;AAAA,EAC5C,QAAQA,QAAO;AAAA,EACf,MAAMA,QAAO,OAAOA,QAAO,OAAO;AAAA,EAClC,QAAQA,QAAO,OAAOA,QAAO,OAAO;AACtC,CAAC;","names":["Schema"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/react/atoms.ts","../src/react/client.ts","../src/api/group.ts"],"sourcesContent":["import type { ScopeId } from \"@executor-js/sdk/core\";\nimport * as Atom from \"effect/unstable/reactivity/Atom\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport { sourcesOptimisticAtom } from \"@executor-js/react/api/atoms\";\nimport { ReactivityKey } from \"@executor-js/react/api/reactivity-keys\";\nimport { GraphqlClient } from \"./client\";\n\n// ---------------------------------------------------------------------------\n// Query atoms\n// ---------------------------------------------------------------------------\n\nexport const graphqlSourceAtom = (scopeId: ScopeId, namespace: string) =>\n GraphqlClient.query(\"graphql\", \"getSource\", {\n params: { scopeId, namespace },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.sources, ReactivityKey.tools],\n });\n\nexport const graphqlSourceBindingsAtom = (\n scopeId: ScopeId,\n namespace: string,\n sourceScopeId: ScopeId,\n) =>\n GraphqlClient.query(\"graphql\", \"listSourceBindings\", {\n params: { scopeId, namespace, sourceScopeId },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.sources, ReactivityKey.secrets, ReactivityKey.connections],\n });\n\n// ---------------------------------------------------------------------------\n// Mutation atoms\n// ---------------------------------------------------------------------------\n\nexport const addGraphqlSource = GraphqlClient.mutation(\"graphql\", \"addSource\");\n\nexport const addGraphqlSourceOptimistic = Atom.family((scopeId: ScopeId) =>\n sourcesOptimisticAtom(scopeId).pipe(\n Atom.optimisticFn({\n reducer: (current, arg) =>\n AsyncResult.map(current, (rows) => {\n const id = arg.payload.namespace ?? `pending-${Math.random().toString(36).slice(2)}`;\n const source = {\n id,\n scopeId: arg.payload.targetScope,\n kind: \"graphql\",\n pluginId: \"graphql\",\n name: arg.payload.name ?? id,\n url: arg.payload.endpoint,\n canRemove: false,\n canRefresh: false,\n canEdit: false,\n runtime: false,\n };\n return [source, ...rows.filter((row) => row.id !== id)].sort((a, b) =>\n a.name.localeCompare(b.name),\n );\n }),\n fn: addGraphqlSource,\n }),\n ),\n);\n\nexport const updateGraphqlSource = GraphqlClient.mutation(\"graphql\", \"updateSource\");\n\nexport const setGraphqlSourceBinding = GraphqlClient.mutation(\"graphql\", \"setSourceBinding\");\n\nexport const removeGraphqlSourceBinding = GraphqlClient.mutation(\"graphql\", \"removeSourceBinding\");\n","import { createPluginAtomClient } from \"@executor-js/sdk/client\";\nimport { getBaseUrl } from \"@executor-js/react/api/base-url\";\nimport { GraphqlGroup } from \"../api/group\";\n\nexport const GraphqlClient = createPluginAtomClient(GraphqlGroup, {\n baseUrl: getBaseUrl,\n});\n","import { HttpApiEndpoint, HttpApiGroup } from \"effect/unstable/httpapi\";\nimport { Schema } from \"effect\";\nimport { InternalError, ScopeId } from \"@executor-js/sdk/core\";\n\nimport { GraphqlIntrospectionError, GraphqlExtractionError } from \"../sdk/errors\";\nimport {\n ConfiguredGraphqlCredentialValue,\n GraphqlCredentialInput,\n GraphqlSourceAuth,\n GraphqlSourceAuthInput,\n GraphqlSourceBindingInput,\n GraphqlSourceBindingRef,\n} from \"../sdk/types\";\n\n// StoredGraphqlSource shape as an HTTP response schema. Kept local to the\n// api layer because the sdk-side `StoredGraphqlSource` is a plain interface.\nexport const StoredSourceSchema = Schema.Struct({\n namespace: Schema.String,\n scope: ScopeId,\n name: Schema.String,\n endpoint: Schema.String,\n headers: Schema.Record(Schema.String, ConfiguredGraphqlCredentialValue),\n queryParams: Schema.Record(Schema.String, ConfiguredGraphqlCredentialValue),\n auth: GraphqlSourceAuth,\n});\n\n// ---------------------------------------------------------------------------\n// Params\n// ---------------------------------------------------------------------------\n\nconst ScopeParams = {\n scopeId: ScopeId,\n};\n\nconst SourceParams = {\n scopeId: ScopeId,\n namespace: Schema.String,\n};\n\nconst SourceBindingParams = {\n scopeId: ScopeId,\n namespace: Schema.String,\n sourceScopeId: ScopeId,\n};\n\n// ---------------------------------------------------------------------------\n// Payloads\n// ---------------------------------------------------------------------------\n\nconst AddSourcePayload = Schema.Struct({\n targetScope: ScopeId,\n endpoint: Schema.String,\n name: Schema.optional(Schema.String),\n introspectionJson: Schema.optional(Schema.String),\n namespace: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n queryParams: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n credentialTargetScope: Schema.optional(ScopeId),\n auth: Schema.optional(GraphqlSourceAuthInput),\n});\n\nconst UpdateSourcePayload = Schema.Struct({\n sourceScope: ScopeId,\n name: Schema.optional(Schema.String),\n endpoint: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n queryParams: Schema.optional(Schema.Record(Schema.String, GraphqlCredentialInput)),\n credentialTargetScope: Schema.optional(ScopeId),\n auth: Schema.optional(GraphqlSourceAuthInput),\n});\n\nconst UpdateSourceResponse = Schema.Struct({\n updated: Schema.Boolean,\n});\n\nconst RemoveBindingPayload = Schema.Struct({\n sourceId: Schema.String,\n sourceScope: ScopeId,\n slot: Schema.String,\n scope: ScopeId,\n});\n\n// ---------------------------------------------------------------------------\n// Responses\n// ---------------------------------------------------------------------------\n\nconst AddSourceResponse = Schema.Struct({\n toolCount: Schema.Number,\n namespace: Schema.String,\n});\n\n// ---------------------------------------------------------------------------\n// Errors with HTTP status\n// ---------------------------------------------------------------------------\n\nconst IntrospectionError = GraphqlIntrospectionError.annotate({ httpApiStatus: 400 });\nconst ExtractionError = GraphqlExtractionError.annotate({ httpApiStatus: 400 });\n\n// ---------------------------------------------------------------------------\n// Group\n//\n// Plugin SDK errors (GraphqlIntrospectionError etc.) are declared once at\n// the group level via `.addError(...)` — every endpoint inherits them. The\n// errors themselves carry their HTTP status via `HttpApiSchema.annotations`\n// above, so handlers just `return yield* ext.foo(...)` and the schema\n// encodes whatever it gets.\n//\n// 5xx is handled at the API level: `.addError(InternalError)` adds a\n// single shared opaque-by-schema 500 surface translated from `StorageError`\n// by `withCapture` at the HTTP edge. No per-handler wrapping, no\n// per-plugin InternalError.\n// ---------------------------------------------------------------------------\n\nconst GraphqlErrors = [InternalError, IntrospectionError, ExtractionError] as const;\n\nexport const GraphqlGroup = HttpApiGroup.make(\"graphql\")\n .add(\n HttpApiEndpoint.post(\"addSource\", \"/scopes/:scopeId/graphql/sources\", {\n params: ScopeParams,\n payload: AddSourcePayload,\n success: AddSourceResponse,\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\"getSource\", \"/scopes/:scopeId/graphql/sources/:namespace\", {\n params: SourceParams,\n success: Schema.NullOr(StoredSourceSchema),\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.patch(\"updateSource\", \"/scopes/:scopeId/graphql/sources/:namespace\", {\n params: SourceParams,\n payload: UpdateSourcePayload,\n success: UpdateSourceResponse,\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.get(\n \"listSourceBindings\",\n \"/scopes/:scopeId/graphql/sources/:namespace/base/:sourceScopeId/bindings\",\n {\n params: SourceBindingParams,\n success: Schema.Array(GraphqlSourceBindingRef),\n error: GraphqlErrors,\n },\n ),\n )\n .add(\n HttpApiEndpoint.post(\"setSourceBinding\", \"/scopes/:scopeId/graphql/source-bindings\", {\n params: ScopeParams,\n payload: GraphqlSourceBindingInput,\n success: GraphqlSourceBindingRef,\n error: GraphqlErrors,\n }),\n )\n .add(\n HttpApiEndpoint.post(\"removeSourceBinding\", \"/scopes/:scopeId/graphql/source-bindings/remove\", {\n params: ScopeParams,\n payload: RemoveBindingPayload,\n success: Schema.Struct({ removed: Schema.Boolean }),\n error: GraphqlErrors,\n }),\n );\n// Plugin domain errors carry their own HTTP status (4xx);\n// `InternalError` is the shared opaque 500 translated at the HTTP edge.\n"],"mappings":";;;;;;;;;;;;AACA,YAAY,UAAU;AACtB,YAAY,iBAAiB;AAC7B,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;;;ACJ9B,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;;;ACD3B,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,cAAc;AACvB,SAAS,eAAe,eAAe;AAchC,IAAM,qBAAqB,OAAO,OAAO;AAAA,EAC9C,WAAW,OAAO;AAAA,EAClB,OAAO;AAAA,EACP,MAAM,OAAO;AAAA,EACb,UAAU,OAAO;AAAA,EACjB,SAAS,OAAO,OAAO,OAAO,QAAQ,gCAAgC;AAAA,EACtE,aAAa,OAAO,OAAO,OAAO,QAAQ,gCAAgC;AAAA,EAC1E,MAAM;AACR,CAAC;AAMD,IAAM,cAAc;AAAA,EAClB,SAAS;AACX;AAEA,IAAM,eAAe;AAAA,EACnB,SAAS;AAAA,EACT,WAAW,OAAO;AACpB;AAEA,IAAM,sBAAsB;AAAA,EAC1B,SAAS;AAAA,EACT,WAAW,OAAO;AAAA,EAClB,eAAe;AACjB;AAMA,IAAM,mBAAmB,OAAO,OAAO;AAAA,EACrC,aAAa;AAAA,EACb,UAAU,OAAO;AAAA,EACjB,MAAM,OAAO,SAAS,OAAO,MAAM;AAAA,EACnC,mBAAmB,OAAO,SAAS,OAAO,MAAM;AAAA,EAChD,WAAW,OAAO,SAAS,OAAO,MAAM;AAAA,EACxC,SAAS,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,sBAAsB,CAAC;AAAA,EAC7E,aAAa,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,sBAAsB,CAAC;AAAA,EACjF,uBAAuB,OAAO,SAAS,OAAO;AAAA,EAC9C,MAAM,OAAO,SAAS,sBAAsB;AAC9C,CAAC;AAED,IAAM,sBA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