graphql-codegen-plugin-typescript-swr 0.8.4 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +5 -0
  2. package/build/main/config.d.ts +27 -0
  3. package/build/main/config.js +3 -0
  4. package/build/main/index.d.ts +6 -0
  5. package/build/main/index.js +35 -0
  6. package/build/main/visitor.d.ts +30 -0
  7. package/build/main/visitor.js +160 -0
  8. package/build/module/config.d.ts +27 -0
  9. package/build/module/config.js +2 -0
  10. package/build/module/index.d.ts +6 -0
  11. package/build/module/index.js +30 -0
  12. package/build/module/visitor.d.ts +30 -0
  13. package/build/module/visitor.js +153 -0
  14. package/package.json +5 -2
  15. package/.editorconfig +0 -13
  16. package/.eslintrc.js +0 -63
  17. package/.github/CONTRIBUTING.md +0 -3
  18. package/.github/ISSUE_TEMPLATE.md +0 -9
  19. package/.github/PULL_REQUEST_TEMPLATE.md +0 -7
  20. package/.github/workflows/main.yml +0 -28
  21. package/.gitignore +0 -8
  22. package/.prettierignore +0 -3
  23. package/.prettierrc.json +0 -4
  24. package/.vscode/extensions.json +0 -8
  25. package/.vscode/launch.json +0 -29
  26. package/.vscode/settings.json +0 -41
  27. package/dev-test/.env +0 -1
  28. package/dev-test/codegen.yml +0 -357
  29. package/dev-test/githunt/__generated__/comment-added.subscription.stencil-component.tsx +0 -47
  30. package/dev-test/githunt/__generated__/comment.query.stencil-component.tsx +0 -68
  31. package/dev-test/githunt/__generated__/comments-page-comment.fragment.stencil-component.tsx +0 -20
  32. package/dev-test/githunt/__generated__/current-user.query.stencil-component.tsx +0 -34
  33. package/dev-test/githunt/__generated__/feed-entry.fragment.stencil-component.tsx +0 -30
  34. package/dev-test/githunt/__generated__/feed.query.stencil-component.tsx +0 -40
  35. package/dev-test/githunt/__generated__/new-entry.mutation.stencil-component.tsx +0 -35
  36. package/dev-test/githunt/__generated__/repo-info.fragment.stencil-component.tsx +0 -26
  37. package/dev-test/githunt/__generated__/submit-comment.mutation.stencil-component.tsx +0 -35
  38. package/dev-test/githunt/__generated__/vote-buttons.fragment.stencil-component.tsx +0 -16
  39. package/dev-test/githunt/__generated__/vote.mutation.stencil-component.tsx +0 -41
  40. package/dev-test/githunt/comment-added.subscription.graphql +0 -11
  41. package/dev-test/githunt/comment.query.graphql +0 -33
  42. package/dev-test/githunt/comments-page-comment.fragment.graphql +0 -9
  43. package/dev-test/githunt/current-user.query.graphql +0 -6
  44. package/dev-test/githunt/feed-entry.fragment.graphql +0 -13
  45. package/dev-test/githunt/feed.query.graphql +0 -8
  46. package/dev-test/githunt/flow.flow.js +0 -367
  47. package/dev-test/githunt/graphql-declared-modules.d.ts +0 -87
  48. package/dev-test/githunt/new-entry.mutation.graphql +0 -5
  49. package/dev-test/githunt/repo-info.fragment.graphql +0 -12
  50. package/dev-test/githunt/schema.js +0 -3
  51. package/dev-test/githunt/schema.json +0 -1750
  52. package/dev-test/githunt/submit-comment.mutation.graphql +0 -5
  53. package/dev-test/githunt/typed-document-nodes.ts +0 -892
  54. package/dev-test/githunt/types.apolloAngular.sdk.ts +0 -570
  55. package/dev-test/githunt/types.apolloAngular.ts +0 -491
  56. package/dev-test/githunt/types.avoidOptionals.ts +0 -266
  57. package/dev-test/githunt/types.d.ts +0 -261
  58. package/dev-test/githunt/types.enumsAsTypes.ts +0 -261
  59. package/dev-test/githunt/types.flatten.preResolveTypes.ts +0 -289
  60. package/dev-test/githunt/types.immutableTypes.ts +0 -267
  61. package/dev-test/githunt/types.preResolveTypes.compatibility.ts +0 -368
  62. package/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts +0 -156
  63. package/dev-test/githunt/types.preResolveTypes.ts +0 -293
  64. package/dev-test/githunt/types.reactApollo.customSuffix.tsx +0 -634
  65. package/dev-test/githunt/types.reactApollo.hooks.tsx +0 -621
  66. package/dev-test/githunt/types.reactApollo.preResolveTypes.tsx +0 -648
  67. package/dev-test/githunt/types.reactApollo.tsx +0 -621
  68. package/dev-test/githunt/types.reactApollo.v2.tsx +0 -635
  69. package/dev-test/githunt/types.stencilApollo.tsx +0 -484
  70. package/dev-test/githunt/types.ts +0 -266
  71. package/dev-test/githunt/types.urql.tsx +0 -444
  72. package/dev-test/githunt/types.vueApollo.ts +0 -647
  73. package/dev-test/githunt/vote-buttons.fragment.graphql +0 -6
  74. package/dev-test/githunt/vote.mutation.graphql +0 -9
  75. package/dev-test/setup.js +0 -3
  76. package/dev-test/test-message/documents.ts +0 -46
  77. package/dev-test/test-message/schema.graphql +0 -23
  78. package/dev-test/test-message/types.tsx +0 -237
  79. package/dev-test/test-schema/env.types.ts +0 -35
  80. package/dev-test/test-schema/flow-types.flow.js +0 -139
  81. package/dev-test/test-schema/local/schema-ast.js +0 -2
  82. package/dev-test/test-schema/local/schema-formats.js +0 -20
  83. package/dev-test/test-schema/local/schema-object.js +0 -2
  84. package/dev-test/test-schema/local/schema-text.js +0 -2
  85. package/dev-test/test-schema/local/schema.graphql +0 -8
  86. package/dev-test/test-schema/resolvers-federation.ts +0 -233
  87. package/dev-test/test-schema/resolvers-root.ts +0 -178
  88. package/dev-test/test-schema/resolvers-types.ts +0 -168
  89. package/dev-test/test-schema/schema-ast.js +0 -2
  90. package/dev-test/test-schema/schema-federation.graphql +0 -30
  91. package/dev-test/test-schema/schema-formats.js +0 -38
  92. package/dev-test/test-schema/schema-json.js +0 -2
  93. package/dev-test/test-schema/schema-object.js +0 -2
  94. package/dev-test/test-schema/schema-text.js +0 -2
  95. package/dev-test/test-schema/schema-with-imports.graphql +0 -9
  96. package/dev-test/test-schema/schema-with-root.graphql +0 -22
  97. package/dev-test/test-schema/schema.graphql +0 -19
  98. package/dev-test/test-schema/schema.json +0 -1070
  99. package/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts +0 -19
  100. package/dev-test/test-schema/types.preResolveTypes.ts +0 -44
  101. package/dev-test/test-schema/typings.avoidOptionals.ts +0 -27
  102. package/dev-test/test-schema/typings.enum.ts +0 -19
  103. package/dev-test/test-schema/typings.immutableTypes.ts +0 -27
  104. package/dev-test/test-schema/typings.ts +0 -156
  105. package/dev-test/test-schema/typings.wrapped.ts +0 -29
  106. package/dev-test/tsconfig.json +0 -18
  107. package/jest.config.js +0 -30
  108. package/renovate.json +0 -2
  109. package/src/config.ts +0 -29
  110. package/src/index.ts +0 -54
  111. package/src/visitor.ts +0 -259
  112. package/tests/outputs/autogenSWRKey.ts +0 -46
  113. package/tests/outputs/excludeQueries.ts +0 -13
  114. package/tests/outputs/infinite.ts +0 -49
  115. package/tests/outputs/mutations.ts +0 -19
  116. package/tests/outputs/rawRequest.ts +0 -19
  117. package/tests/outputs/straight.ts +0 -19
  118. package/tests/swr.spec.ts +0 -306
  119. package/tests/visitor.spec.ts +0 -19
  120. package/tsconfig.json +0 -32
  121. package/tsconfig.main.json +0 -11
  122. package/tsconfig.module.json +0 -13
  123. package/yarn-error.log +0 -5477
  124. package/yarn.lock +0 -5359
@@ -1,46 +0,0 @@
1
- import gql from 'graphql-tag';
2
-
3
- // tslint:disable-next-line:variable-name
4
- export const GetMessages = gql`
5
- query GetMessages($tab: String!) {
6
- messages(tab: $tab) {
7
- id
8
- }
9
- }
10
- `;
11
-
12
- // tslint:disable-next-line:variable-name
13
- export const CreateMessage = gql`
14
- mutation CreateMessage($args: CreateMessageInput!) {
15
- createMessage(args: $args) {
16
- id
17
- }
18
- }
19
- `;
20
-
21
- // tslint:disable-next-line:variable-name
22
- export const Decline = gql`
23
- mutation Decline($id: ID!, $reason: String!) {
24
- decline(id: $id, reason: $reason) {
25
- id
26
- }
27
- }
28
- `;
29
-
30
- // tslint:disable-next-line:variable-name
31
- export const Approve = gql`
32
- mutation Approve($id: ID!) {
33
- approve(id: $id) {
34
- id
35
- }
36
- }
37
- `;
38
-
39
- // tslint:disable-next-line:variable-name
40
- export const Escalate = gql`
41
- mutation Escalate($id: ID!) {
42
- escalate(id: $id) {
43
- id
44
- }
45
- }
46
- `;
@@ -1,23 +0,0 @@
1
- type Message {
2
- id: String!
3
- }
4
-
5
- type Query {
6
- messages(tab: String!): [Message]
7
- }
8
-
9
- input CreateMessageInput {
10
- description: String!
11
- }
12
-
13
- type Mutation {
14
- createMessage(args: CreateMessageInput!): Message
15
- approve(id: ID!): Message
16
- decline(id: ID!, reason: String!): Message
17
- escalate(id: ID!): Message
18
- }
19
-
20
- schema {
21
- query: Query
22
- mutation: Mutation
23
- }
@@ -1,237 +0,0 @@
1
- import * as Operations from './documents';
2
- import * as Apollo from '@apollo/client';
3
- export type Maybe<T> = T | null;
4
- export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
5
- /** All built-in and custom scalars, mapped to their actual values */
6
- export type Scalars = {
7
- ID: string;
8
- String: string;
9
- Boolean: boolean;
10
- Int: number;
11
- Float: number;
12
- };
13
-
14
- export type Message = {
15
- __typename?: 'Message';
16
- id: Scalars['String'];
17
- };
18
-
19
- export type Query = {
20
- __typename?: 'Query';
21
- messages?: Maybe<Array<Maybe<Message>>>;
22
- };
23
-
24
- export type QueryMessagesArgs = {
25
- tab: Scalars['String'];
26
- };
27
-
28
- export type CreateMessageInput = {
29
- description: Scalars['String'];
30
- };
31
-
32
- export type Mutation = {
33
- __typename?: 'Mutation';
34
- createMessage?: Maybe<Message>;
35
- approve?: Maybe<Message>;
36
- decline?: Maybe<Message>;
37
- escalate?: Maybe<Message>;
38
- };
39
-
40
- export type MutationCreateMessageArgs = {
41
- args: CreateMessageInput;
42
- };
43
-
44
- export type MutationApproveArgs = {
45
- id: Scalars['ID'];
46
- };
47
-
48
- export type MutationDeclineArgs = {
49
- id: Scalars['ID'];
50
- reason: Scalars['String'];
51
- };
52
-
53
- export type MutationEscalateArgs = {
54
- id: Scalars['ID'];
55
- };
56
-
57
- export type GetMessagesQueryVariables = Exact<{
58
- tab: Scalars['String'];
59
- }>;
60
-
61
- export type GetMessagesQuery = { __typename?: 'Query' } & {
62
- messages?: Maybe<Array<Maybe<{ __typename?: 'Message' } & Pick<Message, 'id'>>>>;
63
- };
64
-
65
- export type CreateMessageMutationVariables = Exact<{
66
- args: CreateMessageInput;
67
- }>;
68
-
69
- export type CreateMessageMutation = { __typename?: 'Mutation' } & {
70
- createMessage?: Maybe<{ __typename?: 'Message' } & Pick<Message, 'id'>>;
71
- };
72
-
73
- export type DeclineMutationVariables = Exact<{
74
- id: Scalars['ID'];
75
- reason: Scalars['String'];
76
- }>;
77
-
78
- export type DeclineMutation = { __typename?: 'Mutation' } & {
79
- decline?: Maybe<{ __typename?: 'Message' } & Pick<Message, 'id'>>;
80
- };
81
-
82
- export type ApproveMutationVariables = Exact<{
83
- id: Scalars['ID'];
84
- }>;
85
-
86
- export type ApproveMutation = { __typename?: 'Mutation' } & {
87
- approve?: Maybe<{ __typename?: 'Message' } & Pick<Message, 'id'>>;
88
- };
89
-
90
- export type EscalateMutationVariables = Exact<{
91
- id: Scalars['ID'];
92
- }>;
93
-
94
- export type EscalateMutation = { __typename?: 'Mutation' } & {
95
- escalate?: Maybe<{ __typename?: 'Message' } & Pick<Message, 'id'>>;
96
- };
97
-
98
- /**
99
- * __useGetMessagesQuery__
100
- *
101
- * To run a query within a React component, call `useGetMessagesQuery` and pass it any options that fit your needs.
102
- * When your component renders, `useGetMessagesQuery` returns an object from Apollo Client that contains loading, error, and data properties
103
- * you can use to render your UI.
104
- *
105
- * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
106
- *
107
- * @example
108
- * const { data, loading, error } = useGetMessagesQuery({
109
- * variables: {
110
- * tab: // value for 'tab'
111
- * },
112
- * });
113
- */
114
- export function useGetMessagesQuery(
115
- baseOptions?: Apollo.QueryHookOptions<GetMessagesQuery, GetMessagesQueryVariables>
116
- ) {
117
- return Apollo.useQuery<GetMessagesQuery, GetMessagesQueryVariables>(Operations.GetMessages, baseOptions);
118
- }
119
- export function useGetMessagesLazyQuery(
120
- baseOptions?: Apollo.LazyQueryHookOptions<GetMessagesQuery, GetMessagesQueryVariables>
121
- ) {
122
- return Apollo.useLazyQuery<GetMessagesQuery, GetMessagesQueryVariables>(Operations.GetMessages, baseOptions);
123
- }
124
- export type GetMessagesQueryHookResult = ReturnType<typeof useGetMessagesQuery>;
125
- export type GetMessagesLazyQueryHookResult = ReturnType<typeof useGetMessagesLazyQuery>;
126
- export type GetMessagesQueryResult = Apollo.QueryResult<GetMessagesQuery, GetMessagesQueryVariables>;
127
-
128
- /**
129
- * __useCreateMessageMutation__
130
- *
131
- * To run a mutation, you first call `useCreateMessageMutation` within a React component and pass it any options that fit your needs.
132
- * When your component renders, `useCreateMessageMutation` returns a tuple that includes:
133
- * - A mutate function that you can call at any time to execute the mutation
134
- * - An object with fields that represent the current status of the mutation's execution
135
- *
136
- * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
137
- *
138
- * @example
139
- * const [createMessageMutation, { data, loading, error }] = useCreateMessageMutation({
140
- * variables: {
141
- * args: // value for 'args'
142
- * },
143
- * });
144
- */
145
- export function useCreateMessageMutation(
146
- baseOptions?: Apollo.MutationHookOptions<CreateMessageMutation, CreateMessageMutationVariables>
147
- ) {
148
- return Apollo.useMutation<CreateMessageMutation, CreateMessageMutationVariables>(
149
- Operations.CreateMessage,
150
- baseOptions
151
- );
152
- }
153
- export type CreateMessageMutationHookResult = ReturnType<typeof useCreateMessageMutation>;
154
- export type CreateMessageMutationResult = Apollo.MutationResult<CreateMessageMutation>;
155
- export type CreateMessageMutationOptions = Apollo.BaseMutationOptions<
156
- CreateMessageMutation,
157
- CreateMessageMutationVariables
158
- >;
159
-
160
- /**
161
- * __useDeclineMutation__
162
- *
163
- * To run a mutation, you first call `useDeclineMutation` within a React component and pass it any options that fit your needs.
164
- * When your component renders, `useDeclineMutation` returns a tuple that includes:
165
- * - A mutate function that you can call at any time to execute the mutation
166
- * - An object with fields that represent the current status of the mutation's execution
167
- *
168
- * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
169
- *
170
- * @example
171
- * const [declineMutation, { data, loading, error }] = useDeclineMutation({
172
- * variables: {
173
- * id: // value for 'id'
174
- * reason: // value for 'reason'
175
- * },
176
- * });
177
- */
178
- export function useDeclineMutation(
179
- baseOptions?: Apollo.MutationHookOptions<DeclineMutation, DeclineMutationVariables>
180
- ) {
181
- return Apollo.useMutation<DeclineMutation, DeclineMutationVariables>(Operations.Decline, baseOptions);
182
- }
183
- export type DeclineMutationHookResult = ReturnType<typeof useDeclineMutation>;
184
- export type DeclineMutationResult = Apollo.MutationResult<DeclineMutation>;
185
- export type DeclineMutationOptions = Apollo.BaseMutationOptions<DeclineMutation, DeclineMutationVariables>;
186
-
187
- /**
188
- * __useApproveMutation__
189
- *
190
- * To run a mutation, you first call `useApproveMutation` within a React component and pass it any options that fit your needs.
191
- * When your component renders, `useApproveMutation` returns a tuple that includes:
192
- * - A mutate function that you can call at any time to execute the mutation
193
- * - An object with fields that represent the current status of the mutation's execution
194
- *
195
- * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
196
- *
197
- * @example
198
- * const [approveMutation, { data, loading, error }] = useApproveMutation({
199
- * variables: {
200
- * id: // value for 'id'
201
- * },
202
- * });
203
- */
204
- export function useApproveMutation(
205
- baseOptions?: Apollo.MutationHookOptions<ApproveMutation, ApproveMutationVariables>
206
- ) {
207
- return Apollo.useMutation<ApproveMutation, ApproveMutationVariables>(Operations.Approve, baseOptions);
208
- }
209
- export type ApproveMutationHookResult = ReturnType<typeof useApproveMutation>;
210
- export type ApproveMutationResult = Apollo.MutationResult<ApproveMutation>;
211
- export type ApproveMutationOptions = Apollo.BaseMutationOptions<ApproveMutation, ApproveMutationVariables>;
212
-
213
- /**
214
- * __useEscalateMutation__
215
- *
216
- * To run a mutation, you first call `useEscalateMutation` within a React component and pass it any options that fit your needs.
217
- * When your component renders, `useEscalateMutation` returns a tuple that includes:
218
- * - A mutate function that you can call at any time to execute the mutation
219
- * - An object with fields that represent the current status of the mutation's execution
220
- *
221
- * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
222
- *
223
- * @example
224
- * const [escalateMutation, { data, loading, error }] = useEscalateMutation({
225
- * variables: {
226
- * id: // value for 'id'
227
- * },
228
- * });
229
- */
230
- export function useEscalateMutation(
231
- baseOptions?: Apollo.MutationHookOptions<EscalateMutation, EscalateMutationVariables>
232
- ) {
233
- return Apollo.useMutation<EscalateMutation, EscalateMutationVariables>(Operations.Escalate, baseOptions);
234
- }
235
- export type EscalateMutationHookResult = ReturnType<typeof useEscalateMutation>;
236
- export type EscalateMutationResult = Apollo.MutationResult<EscalateMutation>;
237
- export type EscalateMutationOptions = Apollo.BaseMutationOptions<EscalateMutation, EscalateMutationVariables>;
@@ -1,35 +0,0 @@
1
- export type Maybe<T> = T | null;
2
- export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
3
- /** All built-in and custom scalars, mapped to their actual values */
4
- export type Scalars = {
5
- ID: string;
6
- String: string;
7
- Boolean: boolean;
8
- Int: number;
9
- Float: number;
10
- };
11
-
12
- export type User = {
13
- __typename?: 'User';
14
- id: Scalars['Int'];
15
- name: Scalars['String'];
16
- email: Scalars['String'];
17
- };
18
-
19
- export type Query = {
20
- __typename?: 'Query';
21
- allUsers: Array<Maybe<User>>;
22
- userById?: Maybe<User>;
23
- /**
24
- * Generates a new answer for th
25
- * guessing game
26
- */
27
- answer: Array<Scalars['Int']>;
28
- testArr1?: Maybe<Array<Maybe<Scalars['String']>>>;
29
- testArr2: Array<Maybe<Scalars['String']>>;
30
- testArr3: Array<Scalars['String']>;
31
- };
32
-
33
- export type QueryUserByIdArgs = {
34
- id: Scalars['Int'];
35
- };
@@ -1,139 +0,0 @@
1
- // @flow
2
-
3
- import { type GraphQLResolveInfo } from 'graphql';
4
- export type $RequireFields<Origin, Keys> = $Diff<Origin, Keys> &
5
- $ObjMapi<Keys, <Key>(k: Key) => $NonMaybeType<$ElementType<Origin, Key>>>;
6
- /** All built-in and custom scalars, mapped to their actual values */
7
- export type Scalars = {|
8
- ID: string,
9
- String: string,
10
- Boolean: boolean,
11
- Int: number,
12
- Float: number,
13
- |};
14
-
15
- export type Query = {|
16
- __typename?: 'Query',
17
- allUsers: Array<?User>,
18
- userById?: ?User,
19
- |};
20
-
21
- export type QueryUserByIdArgs = {|
22
- id: $ElementType<Scalars, 'Int'>,
23
- |};
24
-
25
- export type User = {|
26
- __typename?: 'User',
27
- id: $ElementType<Scalars, 'Int'>,
28
- name: $ElementType<Scalars, 'String'>,
29
- email: $ElementType<Scalars, 'String'>,
30
- |};
31
-
32
- export type Resolver<Result, Parent = {}, Context = {}, Args = {}> = (
33
- parent: Parent,
34
- args: Args,
35
- context: Context,
36
- info: GraphQLResolveInfo
37
- ) => Promise<Result> | Result;
38
-
39
- export type SubscriptionSubscribeFn<Result, Parent, Context, Args> = (
40
- parent: Parent,
41
- args: Args,
42
- context: Context,
43
- info: GraphQLResolveInfo
44
- ) => AsyncIterator<Result> | Promise<AsyncIterator<Result>>;
45
-
46
- export type SubscriptionResolveFn<Result, Parent, Context, Args> = (
47
- parent: Parent,
48
- args: Args,
49
- context: Context,
50
- info: GraphQLResolveInfo
51
- ) => Result | Promise<Result>;
52
-
53
- export interface SubscriptionSubscriberObject<Result, Key: string, Parent, Context, Args> {
54
- subscribe: SubscriptionSubscribeFn<{ [key: Key]: Result }, Parent, Context, Args>;
55
- resolve?: SubscriptionResolveFn<Result, { [key: Key]: Result }, Context, Args>;
56
- }
57
-
58
- export interface SubscriptionResolverObject<Result, Parent, Context, Args> {
59
- subscribe: SubscriptionSubscribeFn<mixed, Parent, Context, Args>;
60
- resolve: SubscriptionResolveFn<Result, mixed, Context, Args>;
61
- }
62
-
63
- export type SubscriptionObject<Result, Key: string, Parent, Context, Args> =
64
- | SubscriptionSubscriberObject<Result, Key, Parent, Context, Args>
65
- | SubscriptionResolverObject<Result, Parent, Context, Args>;
66
-
67
- export type SubscriptionResolver<Result, Key: string, Parent = {}, Context = {}, Args = {}> =
68
- | ((...args: Array<any>) => SubscriptionObject<Result, Key, Parent, Context, Args>)
69
- | SubscriptionObject<Result, Key, Parent, Context, Args>;
70
-
71
- export type TypeResolveFn<Types, Parent = {}, Context = {}> = (
72
- parent: Parent,
73
- context: Context,
74
- info: GraphQLResolveInfo
75
- ) => ?Types | Promise<?Types>;
76
-
77
- export type IsTypeOfResolverFn<T = {}, Context = {}> = (
78
- obj: T,
79
- context: Context,
80
- info: GraphQLResolveInfo
81
- ) => boolean | Promise<boolean>;
82
-
83
- export type NextResolverFn<T> = () => Promise<T>;
84
-
85
- export type DirectiveResolverFn<Result = {}, Parent = {}, Args = {}, Context = {}> = (
86
- next: NextResolverFn<Result>,
87
- parent: Parent,
88
- args: Args,
89
- context: Context,
90
- info: GraphQLResolveInfo
91
- ) => Result | Promise<Result>;
92
-
93
- export type ResolverTypeWrapper<T> = Promise<T> | T;
94
-
95
- /** Mapping between all available schema types and the resolvers types */
96
- export type ResolversTypes = {
97
- Query: ResolverTypeWrapper<{}>,
98
- Int: ResolverTypeWrapper<$ElementType<Scalars, 'Int'>>,
99
- User: ResolverTypeWrapper<User>,
100
- String: ResolverTypeWrapper<$ElementType<Scalars, 'String'>>,
101
- Boolean: ResolverTypeWrapper<$ElementType<Scalars, 'Boolean'>>,
102
- };
103
-
104
- /** Mapping between all available schema types and the resolvers parents */
105
- export type ResolversParentTypes = {
106
- Query: {},
107
- Int: $ElementType<Scalars, 'Int'>,
108
- User: User,
109
- String: $ElementType<Scalars, 'String'>,
110
- Boolean: $ElementType<Scalars, 'Boolean'>,
111
- };
112
-
113
- export type QueryResolvers<ContextType = any, ParentType = $ElementType<ResolversParentTypes, 'Query'>> = {
114
- allUsers?: Resolver<Array<?$ElementType<ResolversTypes, 'User'>>, ParentType, ContextType>,
115
- userById?: Resolver<
116
- ?$ElementType<ResolversTypes, 'User'>,
117
- ParentType,
118
- ContextType,
119
- $RequireFields<QueryUserByIdArgs, { id: * }>
120
- >,
121
- };
122
-
123
- export type UserResolvers<ContextType = any, ParentType = $ElementType<ResolversParentTypes, 'User'>> = {
124
- id?: Resolver<$ElementType<ResolversTypes, 'Int'>, ParentType, ContextType>,
125
- name?: Resolver<$ElementType<ResolversTypes, 'String'>, ParentType, ContextType>,
126
- email?: Resolver<$ElementType<ResolversTypes, 'String'>, ParentType, ContextType>,
127
- __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>,
128
- };
129
-
130
- export type Resolvers<ContextType = any> = {
131
- Query?: QueryResolvers<ContextType>,
132
- User?: UserResolvers<ContextType>,
133
- };
134
-
135
- /**
136
- * @deprecated
137
- * Use "Resolvers" root object instead. If you wish to get "IResolvers", add "typesPrefix: I" to your config.
138
- */
139
- export type IResolvers<ContextType = any> = Resolvers<ContextType>;
@@ -1,2 +0,0 @@
1
- const schemaFormats = require('./schema-formats');
2
- module.exports.schema = schemaFormats.schemaAst;
@@ -1,20 +0,0 @@
1
- /**
2
- * There are four formats the schema can be in:
3
- * 1. GraphQLSchema object
4
- * 2. Text (the GraphQL schema language textual format)
5
- * 3. AST (the GraphQL schema language textual format parsed into an AST)
6
- *
7
- * This file imports the textual and introspection json files and
8
- * exports all four formats to be used in tests.
9
- */
10
-
11
- const GraphQL = require('graphql');
12
- const fs = require('fs');
13
- const path = require('path');
14
- const schemaText = fs.readFileSync(path.join(__dirname, 'schema.graphql'), 'utf8');
15
- const schemaObject = GraphQL.buildSchema(schemaText);
16
- const schemaAst = GraphQL.parse(schemaText);
17
-
18
- module.exports.schemaText = schemaText;
19
- module.exports.schemaAst = schemaAst;
20
- module.exports.schemaObject = schemaObject;
@@ -1,2 +0,0 @@
1
- const schemaFormats = require('./schema-formats');
2
- module.exports.schema = schemaFormats.schemaObject;
@@ -1,2 +0,0 @@
1
- const schemaFormats = require('./schema-formats');
2
- module.exports.schema = schemaFormats.schemaText;
@@ -1,8 +0,0 @@
1
- type Post {
2
- id: Int!
3
- title: String!
4
- }
5
-
6
- type Query {
7
- allPosts: [Post]!
8
- }