Skip to content

Commit 230a019

Browse files
committed
🐛 alias fix
1 parent e709727 commit 230a019

File tree

7 files changed

+275
-259
lines changed

7 files changed

+275
-259
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
node-version: '14.x'
1414
registry-url: 'https://registry.npmjs.org'
1515
- run: npm install
16+
- run: npm run produce-lib
1617
- run: npm test
1718
- run: npm run build
1819
- run: npm publish --access public --tag latest

examples/typescript-node/src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ const run = async () => {
101101
});
102102
printQueryResult('drawChangeCard thunder', blalbaThunder.drawChangeCard);
103103

104-
const { listCards: stack, drawCard: newCard, drawChangeCard } = await Gql('query')({
104+
const {
105+
listCards: stack,
106+
drawCard: newCard,
107+
drawChangeCard,
108+
} = await Gql('query')({
105109
listCards: {
106110
name: true,
107111
cardImage: {
@@ -171,6 +175,9 @@ const run = async () => {
171175
{
172176
listCards: {
173177
__alias: {
178+
namy: {
179+
name: true,
180+
},
174181
atak: {
175182
attack: [
176183
{ cardID: $('cardIds') },

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, useSubscription, useQuery, useLazyQuery, useMutation } from '@apollo/client';
5-
import type { SubscriptionHookOptions, QueryHookOptions, LazyQueryHookOptions, MutationHookOptions } from '@apollo/client';
4+
import { gql, useQuery, useLazyQuery, useMutation, useSubscription } from '@apollo/client';
5+
import type { QueryHookOptions, LazyQueryHookOptions, MutationHookOptions, SubscriptionHookOptions } from '@apollo/client';
66

77

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

33
export const AllTypesProps: Record<string,any> = {
4-
JSON: "String",
5-
createCard:{
6-
skills:"SpecialSkills"
7-
},
84
Query:{
95
cardById:{
106

117
}
128
},
139
SpecialSkills: true,
10+
JSON: "String",
11+
Card:{
12+
attack:{
13+
14+
}
15+
},
1416
Mutation:{
1517
addCard:{
1618
card:"createCard"
1719
}
1820
},
19-
Card:{
20-
attack:{
21-
22-
}
21+
createCard:{
22+
skills:"SpecialSkills"
2323
}
2424
}
2525

2626
export const ReturnTypes: Record<string,any> = {
27-
S3Object:{
28-
bucket:"String",
29-
key:"String",
30-
region:"String"
31-
},
32-
Subscription:{
33-
deck:"Card"
34-
},
35-
SpecialCard:{
36-
effect:"String",
37-
name:"String"
38-
},
39-
EffectCard:{
40-
effectSize:"Float",
41-
name:"String"
42-
},
4327
Query:{
4428
cardById:"Card",
4529
drawCard:"Card",
@@ -48,24 +32,26 @@ export const ReturnTypes: Record<string,any> = {
4832
myStacks:"CardStack",
4933
nameables:"Nameable"
5034
},
35+
CardStack:{
36+
cards:"Card",
37+
name:"String"
38+
},
39+
S3Object:{
40+
bucket:"String",
41+
key:"String",
42+
region:"String"
43+
},
5144
ChangeCard:{
5245
"...on SpecialCard":"SpecialCard",
5346
"...on EffectCard":"EffectCard"
5447
},
5548
Nameable:{
56-
"...on SpecialCard": "SpecialCard",
57-
"...on EffectCard": "EffectCard",
5849
"...on CardStack": "CardStack",
5950
"...on Card": "Card",
51+
"...on SpecialCard": "SpecialCard",
52+
"...on EffectCard": "EffectCard",
6053
name:"String"
6154
},
62-
CardStack:{
63-
cards:"Card",
64-
name:"String"
65-
},
66-
Mutation:{
67-
addCard:"Card"
68-
},
6955
Card:{
7056
Attack:"Int",
7157
Children:"Int",
@@ -78,11 +64,25 @@ export const ReturnTypes: Record<string,any> = {
7864
info:"JSON",
7965
name:"String",
8066
skills:"SpecialSkills"
67+
},
68+
Mutation:{
69+
addCard:"Card"
70+
},
71+
Subscription:{
72+
deck:"Card"
73+
},
74+
SpecialCard:{
75+
effect:"String",
76+
name:"String"
77+
},
78+
EffectCard:{
79+
effectSize:"Float",
80+
name:"String"
8181
}
8282
}
8383

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

0 commit comments

Comments
 (0)