1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.defineImports = void 0;
|
4 | var fragmentType_template_1 = require("./fragmentType.template");
|
5 | exports.defineImports = function (_a) {
|
6 | var codegenReactHooks = _a.codegenReactHooks, codegenVueHooks = _a.codegenVueHooks, codegenMethods = _a.codegenMethods, codegenTemplates = _a.codegenTemplates;
|
7 | var template = '';
|
8 | if (codegenReactHooks || codegenMethods || codegenTemplates || codegenVueHooks) {
|
9 | template = "\n import { OperationDefinitionNode } from 'graphql';\n import sgtsQL, { DocumentNode } from 'graphql-tag';\n " + fragmentType_template_1.guessFragmentTypeTemplate + "\n ";
|
10 | if (codegenReactHooks) {
|
11 | template += "\n import { useMutation, useQuery, useSubscription, QueryHookOptions, MutationHookOptions, SubscriptionHookOptions, MutationTuple } from '@apollo/react-hooks'\n ";
|
12 | }
|
13 | if (codegenVueHooks) {
|
14 | template += "\n import { Ref } from '@vue/composition-api'\n import { useMutation, useQuery, useSubscription, UseQueryOptions, UseMutationOptions, UseSubscriptionOptions } from '@vue/apollo-composable'\n export type ReactiveFunction<TParam> = () => TParam;\n ";
|
15 | }
|
16 | if (codegenMethods) {
|
17 | template += "\n import ApolloClient, { QueryOptions, OperationVariables, MutationOptions, ObservableQuery } from 'apollo-client';\n import { execute } from 'apollo-link';\n ";
|
18 | }
|
19 | }
|
20 | return template;
|
21 | };
|