@forge/cli-shared

9.7.0-next.14-experimental-fd0ebbc9.7.0-next.16
out/graphql/mutation-aware-graphql-client.js
~out/graphql/mutation-aware-graphql-client.jsModified
+10−6
Index: package/out/graphql/mutation-aware-graphql-client.js
===================================================================
--- package/out/graphql/mutation-aware-graphql-client.js
+++ package/out/graphql/mutation-aware-graphql-client.js
@@ -33,25 +33,29 @@
     runner;
     constructor(runner) {
         this.runner = runner;
     }
-    async mutate(document, variables) {
-        const { requestId, response, extensions } = await this.runner.run(String(document), variables);
+    async mutate(query, variables) {
+        const { requestId, response, extensions } = await this.runner.run(query, variables);
         if (!response) {
             throw new UnexpectedGraphQlResponseError(`(requestId: ${requestId || 'unknown'})`);
         }
         const mutationLabel = Object.keys(response)[0];
         if (!mutationLabel || !response[mutationLabel]) {
             throw new UnexpectedGraphQlResponseError(`(requestId: ${requestId || 'unknown'})`);
         }
+        const mutationResponse = response[mutationLabel];
+        if (!mutationResponse) {
+            throw new UnexpectedGraphQlResponseError(`(requestId: ${requestId || 'unknown'})`);
+        }
         return {
-            response,
+            response: { [mutationLabel]: mutationResponse },
             requestId,
             extensions
         };
     }
-    async query(document, variables) {
-        const { response, requestId } = await this.runner.run(String(document), variables);
-        return { ...response, requestId: requestId || '' };
+    async query(query, variables) {
+        const { response, requestId } = await this.runner.run(query, variables);
+        return { ...response, requestId };
     }
 }
 exports.MutationAwareGraphQLClient = MutationAwareGraphQLClient;