UNPKG

719 BJavaScriptView Raw
1import { parser, DocumentType } from "../parser/index.js";
2import { withQuery } from "./query-hoc.js";
3import { withMutation } from "./mutation-hoc.js";
4import { withSubscription } from "./subscription-hoc.js";
5export function graphql(document, operationOptions) {
6 if (operationOptions === void 0) { operationOptions = {}; }
7 switch (parser(document).type) {
8 case DocumentType.Mutation:
9 return withMutation(document, operationOptions);
10 case DocumentType.Subscription:
11 return withSubscription(document, operationOptions);
12 case DocumentType.Query:
13 default:
14 return withQuery(document, operationOptions);
15 }
16}
17//# sourceMappingURL=graphql.js.map
\No newline at end of file