Skip to content

Commit f8c747f

Browse files
committed
✨ default .js import in node
1 parent c5c754d commit f8c747f

File tree

11 files changed

+396
-394
lines changed

11 files changed

+396
-394
lines changed

examples/typescript-node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "typescript-node",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "",
55
"private": true,
66
"main": "index.js",

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

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

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

77

88
export function useTypedMutation<Z extends ValueTypes[O], O extends "Mutation", SCLR extends ScalarDefinition>(
@@ -18,41 +18,41 @@ export function useTypedMutation<Z extends ValueTypes[O], O extends "Mutation",
1818
scalars: options?.scalars
1919
})), options?.apolloOptions);
2020
}
21-
export function useTypedQuery<Z extends ValueTypes[O], O extends "Query", SCLR extends ScalarDefinition>(
22-
query: Z | ValueTypes[O],
21+
export function useTypedSubscription<Z extends ValueTypes[O], O extends "Subscription", SCLR extends ScalarDefinition>(
22+
subscription: Z | ValueTypes[O],
2323
options?:{
24-
apolloOptions?: QueryHookOptions<InputType<GraphQLTypes[O], Z, SCLR>>,
24+
apolloOptions?: SubscriptionHookOptions<InputType<GraphQLTypes[O], Z, SCLR>>,
2525
operationOptions?: OperationOptions,
2626
scalars?: SCLR
2727
}
2828
) {
29-
return useQuery<InputType<GraphQLTypes[O], Z, SCLR>>(gql(Zeus("query",query, {
29+
return useSubscription<InputType<GraphQLTypes[O], Z, SCLR>>(gql(Zeus("subscription",subscription, {
3030
operationOptions: options?.operationOptions,
3131
scalars: options?.scalars
3232
})), options?.apolloOptions);
3333
}
34-
export function useTypedLazyQuery<Z extends ValueTypes[O], O extends "Query", SCLR extends ScalarDefinition>(
35-
LazyQuery: Z | ValueTypes[O],
34+
export function useTypedQuery<Z extends ValueTypes[O], O extends "Query", SCLR extends ScalarDefinition>(
35+
query: Z | ValueTypes[O],
3636
options?:{
37-
apolloOptions?: LazyQueryHookOptions<InputType<GraphQLTypes[O], Z, SCLR>>,
37+
apolloOptions?: QueryHookOptions<InputType<GraphQLTypes[O], Z, SCLR>>,
3838
operationOptions?: OperationOptions,
3939
scalars?: SCLR
4040
}
4141
) {
42-
return useLazyQuery<InputType<GraphQLTypes[O], Z, SCLR>>(gql(Zeus("query",LazyQuery, {
42+
return useQuery<InputType<GraphQLTypes[O], Z, SCLR>>(gql(Zeus("query",query, {
4343
operationOptions: options?.operationOptions,
4444
scalars: options?.scalars
4545
})), options?.apolloOptions);
4646
}
47-
export function useTypedSubscription<Z extends ValueTypes[O], O extends "Subscription", SCLR extends ScalarDefinition>(
48-
subscription: Z | ValueTypes[O],
47+
export function useTypedLazyQuery<Z extends ValueTypes[O], O extends "Query", SCLR extends ScalarDefinition>(
48+
LazyQuery: Z | ValueTypes[O],
4949
options?:{
50-
apolloOptions?: SubscriptionHookOptions<InputType<GraphQLTypes[O], Z, SCLR>>,
50+
apolloOptions?: LazyQueryHookOptions<InputType<GraphQLTypes[O], Z, SCLR>>,
5151
operationOptions?: OperationOptions,
5252
scalars?: SCLR
5353
}
5454
) {
55-
return useSubscription<InputType<GraphQLTypes[O], Z, SCLR>>(gql(Zeus("subscription",subscription, {
55+
return useLazyQuery<InputType<GraphQLTypes[O], Z, SCLR>>(gql(Zeus("query",LazyQuery, {
5656
operationOptions: options?.operationOptions,
5757
scalars: options?.scalars
5858
})), options?.apolloOptions);
Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,87 @@
11
/* eslint-disable */
22

33
export const AllTypesProps: Record<string,any> = {
4-
SpecialSkills: "enum" as const,
5-
JSON: `scalar.JSON` as const,
6-
Card:{
7-
attack:{
8-
9-
}
10-
},
114
createCard:{
125
skills:"SpecialSkills"
136
},
7+
Public:{
8+
powerups:{
9+
10+
}
11+
},
1412
Mutation:{
1513
addCard:{
1614
card:"createCard"
1715
}
1816
},
19-
Query:{
20-
cardById:{
17+
JSON: `scalar.JSON` as const,
18+
Card:{
19+
attack:{
2120

2221
}
2322
},
24-
Public:{
25-
powerups:{
23+
Query:{
24+
cardById:{
2625

2726
}
28-
}
27+
},
28+
SpecialSkills: "enum" as const
2929
}
3030

3131
export const ReturnTypes: Record<string,any> = {
32-
JSON: `scalar.JSON` as const,
33-
Card:{
34-
Attack:"Int",
35-
Children:"Int",
36-
Defense:"Int",
37-
attack:"Card",
38-
cardImage:"S3Object",
39-
description:"String",
40-
id:"ID",
41-
image:"String",
42-
info:"JSON",
43-
name:"String",
44-
skills:"SpecialSkills"
32+
ChangeCard:{
33+
"...on SpecialCard":"SpecialCard",
34+
"...on EffectCard":"EffectCard"
35+
},
36+
CardStack:{
37+
cards:"Card",
38+
name:"String"
39+
},
40+
Public:{
41+
powerups:"Powerup"
42+
},
43+
Mutation:{
44+
addCard:"Card"
45+
},
46+
S3Object:{
47+
bucket:"String",
48+
key:"String",
49+
region:"String"
4550
},
4651
Powerup:{
4752
name:"String"
4853
},
49-
ChangeCard:{
50-
"...on SpecialCard":"SpecialCard",
51-
"...on EffectCard":"EffectCard"
54+
SpecialCard:{
55+
effect:"String",
56+
name:"String"
5257
},
5358
EffectCard:{
5459
effectSize:"Float",
5560
name:"String"
5661
},
5762
Nameable:{
58-
"...on Card": "Card",
59-
"...on EffectCard": "EffectCard",
6063
"...on CardStack": "CardStack",
6164
"...on SpecialCard": "SpecialCard",
65+
"...on EffectCard": "EffectCard",
66+
"...on Card": "Card",
6267
name:"String"
6368
},
64-
CardStack:{
65-
cards:"Card",
66-
name:"String"
67-
},
68-
S3Object:{
69-
bucket:"String",
70-
key:"String",
71-
region:"String"
69+
JSON: `scalar.JSON` as const,
70+
Card:{
71+
Attack:"Int",
72+
Children:"Int",
73+
Defense:"Int",
74+
attack:"Card",
75+
cardImage:"S3Object",
76+
description:"String",
77+
id:"ID",
78+
image:"String",
79+
info:"JSON",
80+
name:"String",
81+
skills:"SpecialSkills"
7282
},
73-
Mutation:{
74-
addCard:"Card"
83+
Subscription:{
84+
deck:"Card"
7585
},
7686
Query:{
7787
cardById:"Card",
@@ -81,21 +91,11 @@ export const ReturnTypes: Record<string,any> = {
8191
myStacks:"CardStack",
8292
nameables:"Nameable",
8393
public:"Public"
84-
},
85-
SpecialCard:{
86-
effect:"String",
87-
name:"String"
88-
},
89-
Public:{
90-
powerups:"Powerup"
91-
},
92-
Subscription:{
93-
deck:"Card"
9494
}
9595
}
9696

9797
export const Ops = {
9898
mutation: "Mutation" as const,
99-
query: "Query" as const,
100-
subscription: "Subscription" as const
99+
subscription: "Subscription" as const,
100+
query: "Query" as const
101101
}

0 commit comments

Comments
 (0)