Skip to content

Commit 634dc95

Browse files
committed
🚑 5.0.1 Fixed array args
1 parent acbed4c commit 634dc95

File tree

6 files changed

+268
-276
lines changed

6 files changed

+268
-276
lines changed

examples/typescript-node/src/zeus/apollo.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
/* eslint-disable */
22

33
import { Zeus, GraphQLTypes, InputType, ValueTypes, OperationOptions } from './index';
4-
import { gql, useMutation, useSubscription, useQuery, useLazyQuery } from '@apollo/client';
5-
import type { MutationHookOptions, SubscriptionHookOptions, QueryHookOptions, LazyQueryHookOptions } from '@apollo/client';
4+
import { gql, useSubscription, useQuery, useLazyQuery, useMutation } from '@apollo/client';
5+
import type { SubscriptionHookOptions, QueryHookOptions, LazyQueryHookOptions, MutationHookOptions } from '@apollo/client';
66

77

8-
export function useTypedMutation<Z extends ValueTypes[O], O extends "Mutation">(
9-
mutation: Z | ValueTypes[O],
10-
options?: MutationHookOptions<InputType<GraphQLTypes[O], Z>>,
11-
operationOptions?: OperationOptions,
12-
) {
13-
return useMutation<InputType<GraphQLTypes[O], Z>>(gql(Zeus("mutation",mutation, operationOptions)), options);
14-
}
158
export function useTypedSubscription<Z extends ValueTypes[O], O extends "Subscription">(
169
subscription: Z | ValueTypes[O],
1710
options?: SubscriptionHookOptions<InputType<GraphQLTypes[O], Z>>,
@@ -33,3 +26,10 @@ export function useTypedLazyQuery<Z extends ValueTypes[O], O extends "Query">(
3326
) {
3427
return useLazyQuery<InputType<GraphQLTypes[O], Z>>(gql(Zeus("query",LazyQuery, operationOptions)), options);
3528
}
29+
export function useTypedMutation<Z extends ValueTypes[O], O extends "Mutation">(
30+
mutation: Z | ValueTypes[O],
31+
options?: MutationHookOptions<InputType<GraphQLTypes[O], Z>>,
32+
operationOptions?: OperationOptions,
33+
) {
34+
return useMutation<InputType<GraphQLTypes[O], Z>>(gql(Zeus("mutation",mutation, operationOptions)), options);
35+
}
Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,45 @@
11
/* eslint-disable */
22

33
export const AllTypesProps: Record<string,any> = {
4-
Card:{
5-
attack:{
4+
JSON: "String",
5+
createCard:{
6+
skills:"SpecialSkills"
7+
},
8+
Query:{
9+
cardById:{
610

711
}
812
},
13+
SpecialSkills: true,
914
Mutation:{
1015
addCard:{
1116
card:"createCard"
1217
}
1318
},
14-
JSON: "String",
15-
SpecialSkills: true,
16-
Query:{
17-
cardById:{
19+
Card:{
20+
attack:{
1821

1922
}
20-
},
21-
createCard:{
22-
skills:"SpecialSkills"
2323
}
2424
}
2525

2626
export const ReturnTypes: Record<string,any> = {
27-
Card:{
28-
Attack:"Int",
29-
Children:"Int",
30-
Defense:"Int",
31-
attack:"Card",
32-
cardImage:"S3Object",
33-
description:"String",
34-
id:"ID",
35-
image:"String",
36-
info:"JSON",
37-
name:"String",
38-
skills:"SpecialSkills"
39-
},
40-
Nameable:{
41-
"...on Card": "Card",
42-
"...on EffectCard": "EffectCard",
43-
"...on SpecialCard": "SpecialCard",
44-
"...on CardStack": "CardStack",
45-
name:"String"
46-
},
4727
S3Object:{
4828
bucket:"String",
4929
key:"String",
5030
region:"String"
5131
},
32+
Subscription:{
33+
deck:"Card"
34+
},
35+
SpecialCard:{
36+
effect:"String",
37+
name:"String"
38+
},
5239
EffectCard:{
5340
effectSize:"Float",
5441
name:"String"
5542
},
56-
Mutation:{
57-
addCard:"Card"
58-
},
59-
Subscription:{
60-
deck:"Card"
61-
},
6243
Query:{
6344
cardById:"Card",
6445
drawCard:"Card",
@@ -71,18 +52,37 @@ export const ReturnTypes: Record<string,any> = {
7152
"...on SpecialCard":"SpecialCard",
7253
"...on EffectCard":"EffectCard"
7354
},
74-
SpecialCard:{
75-
effect:"String",
55+
Nameable:{
56+
"...on SpecialCard": "SpecialCard",
57+
"...on EffectCard": "EffectCard",
58+
"...on CardStack": "CardStack",
59+
"...on Card": "Card",
7660
name:"String"
7761
},
7862
CardStack:{
7963
cards:"Card",
8064
name:"String"
65+
},
66+
Mutation:{
67+
addCard:"Card"
68+
},
69+
Card:{
70+
Attack:"Int",
71+
Children:"Int",
72+
Defense:"Int",
73+
attack:"Card",
74+
cardImage:"S3Object",
75+
description:"String",
76+
id:"ID",
77+
image:"String",
78+
info:"JSON",
79+
name:"String",
80+
skills:"SpecialSkills"
8181
}
8282
}
8383

8484
export const Ops = {
85-
mutation: "Mutation" as const,
86-
subscription: "Subscription" as const,
87-
query: "Query" as const
85+
subscription: "Subscription" as const,
86+
query: "Query" as const,
87+
mutation: "Mutation" as const
8888
}

0 commit comments

Comments
 (0)