1 | import { parser, DocumentType } from "../parser/index.js";
|
2 | import { withQuery } from "./query-hoc.js";
|
3 | import { withMutation } from "./mutation-hoc.js";
|
4 | import { withSubscription } from "./subscription-hoc.js";
|
5 | export 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 |
|
\ | No newline at end of file |