|
1 | | -import { InputTypeComposer, SchemaComposer, TypeComposer } from 'graphql-compose'; |
| 1 | +import { |
| 2 | + InputTypeComposer, |
| 3 | + SchemaComposer, |
| 4 | + TypeComposer, |
| 5 | +} from 'graphql-compose'; |
2 | 6 | import { Document, Model } from 'mongoose'; |
3 | 7 | import { ConnectionSortMapOpts } from './resolvers/connection'; |
4 | 8 | import { |
5 | | - FilterHelperArgsOpts, LimitHelperArgsOpts, RecordHelperArgsOpts, SortHelperArgsOpts, |
| 9 | + FilterHelperArgsOpts, |
| 10 | + LimitHelperArgsOpts, |
| 11 | + RecordHelperArgsOpts, |
| 12 | + SortHelperArgsOpts, |
6 | 13 | } from './resolvers/helpers'; |
7 | 14 | import { PaginationResolverOpts } from './resolvers/pagination'; |
8 | 15 |
|
9 | 16 | export type TypeConverterOpts = { |
10 | | - schemaComposer?: SchemaComposer<any>, |
11 | | - name?: string, |
12 | | - description?: string, |
| 17 | + schemaComposer?: SchemaComposer<any>; |
| 18 | + name?: string; |
| 19 | + description?: string; |
13 | 20 | fields?: { |
14 | | - only?: string[], |
15 | | - remove?: string[], |
16 | | - }, |
17 | | - inputType?: TypeConverterInputTypeOpts, |
18 | | - resolvers?: false | TypeConverterResolversOpts, |
| 21 | + only?: string[]; |
| 22 | + remove?: string[]; |
| 23 | + }; |
| 24 | + inputType?: TypeConverterInputTypeOpts; |
| 25 | + resolvers?: false | TypeConverterResolversOpts; |
19 | 26 | }; |
20 | 27 |
|
21 | 28 | export type TypeConverterInputTypeOpts = { |
22 | | - name?: string, |
23 | | - description?: string, |
| 29 | + name?: string; |
| 30 | + description?: string; |
24 | 31 | fields?: { |
25 | | - only?: string[], |
26 | | - remove?: string[], |
27 | | - required?: string[], |
28 | | - }, |
| 32 | + only?: string[]; |
| 33 | + remove?: string[]; |
| 34 | + required?: string[]; |
| 35 | + }; |
29 | 36 | }; |
30 | 37 |
|
31 | 38 | export type TypeConverterResolversOpts = { |
32 | | - findById?: false, |
| 39 | + findById?: false; |
33 | 40 | findByIds?: |
34 | 41 | | false |
35 | 42 | | { |
36 | | - limit?: LimitHelperArgsOpts | false, |
37 | | - sort?: SortHelperArgsOpts | false, |
38 | | - }, |
| 43 | + limit?: LimitHelperArgsOpts | false; |
| 44 | + sort?: SortHelperArgsOpts | false; |
| 45 | + }; |
39 | 46 | findOne?: |
40 | 47 | | false |
41 | 48 | | { |
42 | | - filter?: FilterHelperArgsOpts | false, |
43 | | - sort?: SortHelperArgsOpts | false, |
44 | | - skip?: false, |
45 | | - }, |
| 49 | + filter?: FilterHelperArgsOpts | false; |
| 50 | + sort?: SortHelperArgsOpts | false; |
| 51 | + skip?: false; |
| 52 | + }; |
46 | 53 | findMany?: |
47 | 54 | | false |
48 | 55 | | { |
49 | | - filter?: FilterHelperArgsOpts | false, |
50 | | - sort?: SortHelperArgsOpts | false, |
51 | | - limit?: LimitHelperArgsOpts | false, |
52 | | - skip?: false, |
53 | | - }, |
| 56 | + filter?: FilterHelperArgsOpts | false; |
| 57 | + sort?: SortHelperArgsOpts | false; |
| 58 | + limit?: LimitHelperArgsOpts | false; |
| 59 | + skip?: false; |
| 60 | + }; |
54 | 61 | updateById?: |
55 | 62 | | false |
56 | 63 | | { |
57 | | - record?: RecordHelperArgsOpts | false, |
58 | | - }, |
| 64 | + record?: RecordHelperArgsOpts | false; |
| 65 | + }; |
59 | 66 | updateOne?: |
60 | 67 | | false |
61 | 68 | | { |
62 | | - input?: RecordHelperArgsOpts | false, |
63 | | - filter?: FilterHelperArgsOpts | false, |
64 | | - sort?: SortHelperArgsOpts | false, |
65 | | - skip?: false, |
66 | | - }, |
| 69 | + input?: RecordHelperArgsOpts | false; |
| 70 | + filter?: FilterHelperArgsOpts | false; |
| 71 | + sort?: SortHelperArgsOpts | false; |
| 72 | + skip?: false; |
| 73 | + }; |
67 | 74 | updateMany?: |
68 | 75 | | false |
69 | 76 | | { |
70 | | - record?: RecordHelperArgsOpts | false, |
71 | | - filter?: FilterHelperArgsOpts | false, |
72 | | - sort?: SortHelperArgsOpts | false, |
73 | | - limit?: LimitHelperArgsOpts | false, |
74 | | - skip?: false, |
75 | | - }, |
76 | | - removeById?: false, |
| 77 | + record?: RecordHelperArgsOpts | false; |
| 78 | + filter?: FilterHelperArgsOpts | false; |
| 79 | + sort?: SortHelperArgsOpts | false; |
| 80 | + limit?: LimitHelperArgsOpts | false; |
| 81 | + skip?: false; |
| 82 | + }; |
| 83 | + removeById?: false; |
77 | 84 | removeOne?: |
78 | 85 | | false |
79 | 86 | | { |
80 | | - filter?: FilterHelperArgsOpts | false, |
81 | | - sort?: SortHelperArgsOpts | false, |
82 | | - }, |
| 87 | + filter?: FilterHelperArgsOpts | false; |
| 88 | + sort?: SortHelperArgsOpts | false; |
| 89 | + }; |
83 | 90 | removeMany?: |
84 | 91 | | false |
85 | 92 | | { |
86 | | - filter?: FilterHelperArgsOpts | false, |
87 | | - }, |
| 93 | + filter?: FilterHelperArgsOpts | false; |
| 94 | + }; |
88 | 95 | createOne?: |
89 | 96 | | false |
90 | 97 | | { |
91 | | - record?: RecordHelperArgsOpts | false, |
92 | | - }, |
| 98 | + record?: RecordHelperArgsOpts | false; |
| 99 | + }; |
| 100 | + createMany?: |
| 101 | + | false |
| 102 | + | { |
| 103 | + record?: RecordHelperArgsOpts | false; |
| 104 | + }; |
93 | 105 | count?: |
94 | 106 | | false |
95 | 107 | | { |
96 | | - filter?: FilterHelperArgsOpts | false, |
97 | | - }, |
98 | | - connection?: ConnectionSortMapOpts | false, |
99 | | - pagination?: PaginationResolverOpts | false, |
| 108 | + filter?: FilterHelperArgsOpts | false; |
| 109 | + }; |
| 110 | + connection?: ConnectionSortMapOpts | false; |
| 111 | + pagination?: PaginationResolverOpts | false; |
100 | 112 | }; |
101 | 113 |
|
102 | 114 | export function composeWithMongoose( |
103 | 115 | model: Model<any>, |
104 | | - opts?: TypeConverterOpts): TypeComposer<any>; |
| 116 | + opts?: TypeConverterOpts, |
| 117 | +): TypeComposer<any>; |
105 | 118 |
|
106 | 119 | export function prepareFields( |
107 | 120 | tc: TypeComposer<any>, |
108 | | - opts: { only?: string[], remove?: string[] }): void; |
| 121 | + opts: { only?: string[]; remove?: string[] }, |
| 122 | +): void; |
109 | 123 |
|
110 | 124 | export function prepareInputFields( |
111 | 125 | inputTypeComposer: InputTypeComposer, |
112 | | - inputFieldsOpts: { only?: string[], remove?: string[], required?: string[] }): void; |
| 126 | + inputFieldsOpts: { only?: string[]; remove?: string[]; required?: string[] }, |
| 127 | +): void; |
113 | 128 |
|
114 | 129 | export function createInputType( |
115 | 130 | tc: TypeComposer<any>, |
116 | | - inputTypeOpts?: TypeConverterInputTypeOpts): void; |
| 131 | + inputTypeOpts?: TypeConverterInputTypeOpts, |
| 132 | +): void; |
117 | 133 |
|
118 | 134 | export function createResolvers<TDocument extends Document>( |
119 | 135 | model: Model<TDocument>, |
120 | 136 | tc: TypeComposer<any>, |
121 | | - opts: TypeConverterResolversOpts): void; |
| 137 | + opts: TypeConverterResolversOpts, |
| 138 | +): void; |
0 commit comments