@forge/cli-shared
9.7.0-next.15-experimental-554d4179.7.0-next.14-experimental-fd0ebbc
out/graphql/mutation-aware-graphql-client.js~
out/graphql/mutation-aware-graphql-client.jsModified+6−10
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,29 +33,25 @@
runner;
constructor(runner) {
this.runner = runner;
}
- async mutate(query, variables) {
- const { requestId, response, extensions } = await this.runner.run(query, variables);
+ async mutate(document, variables) {
+ const { requestId, response, extensions } = await this.runner.run(String(document), 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: { [mutationLabel]: mutationResponse },
+ response,
requestId,
extensions
};
}
- async query(query, variables) {
- const { response, requestId } = await this.runner.run(query, variables);
- return { ...response, requestId };
+ async query(document, variables) {
+ const { response, requestId } = await this.runner.run(String(document), variables);
+ return { ...response, requestId: requestId || '' };
}
}
exports.MutationAwareGraphQLClient = MutationAwareGraphQLClient;