2
2
3
3
import { Hook , HookContext , Params , Query , Paginated , Application } from '@feathersjs/feathers' ;
4
4
import * as ajv from 'ajv' ;
5
- import { GraphQLSchema , parse } from 'graphql' ;
5
+ import { GraphQLSchema , parse , GraphQLFieldResolver } from 'graphql' ;
6
6
import * as libphonenumberjs from 'libphonenumber-js' ;
7
7
8
8
export type HookType = 'before' | 'after' | 'error' ;
@@ -212,28 +212,32 @@ export interface ResolverMap<T> {
212
212
*/
213
213
export function fastJoin ( resolvers : ResolverMap < any > | SyncContextFunction < ResolverMap < any > > , query ?: Query | SyncContextFunction < Query > ) : Hook ;
214
214
215
- export type ResolversFunction = ( app : Application , runtime : any ) => ResolversObject ;
215
+ export type FGraphQLResolverMapFactory = ( app : Application , runtime : any ) => FGraphQLResolverMap ;
216
216
217
- export interface ResolversObject {
217
+ export interface FGraphQLResolverMap {
218
218
[ i : string ] : {
219
- [ i : string ] : ( parent : any , args : any , content : any , ast : any ) => any ;
219
+ [ i : string ] : GraphQLFieldResolver < any , any >
220
220
} ;
221
221
Query : {
222
- [ i : string ] : ( parent : any , args : any , content : any , ast : any ) => any ;
222
+ [ i : string ] : GraphQLFieldResolver < any , any >
223
223
} ;
224
224
}
225
225
226
- export interface FGraphqlOptions {
227
- recordType : string ;
228
- schema : string ;
229
- resolvers : ResolversObject | ResolversFunction ;
230
- query : Query | SyncContextFunction < Query > ;
226
+ export interface FGraphQLOptions {
231
227
skipHookWhen ?: SyncContextFunction < boolean > ;
232
228
inclAllFieldsServer ?: boolean ;
233
229
inclAllFieldsClient ?: boolean ;
234
230
inclAllFields ?: boolean ;
235
231
inclJoinedNames ?: boolean ;
236
232
extraAuthProps ?: string [ ] ;
233
+ }
234
+
235
+ export interface FGraphQLHookOptions {
236
+ recordType : string ;
237
+ schema : string ;
238
+ resolvers : FGraphQLResolverMap | FGraphQLResolverMapFactory ;
239
+ query : Query | SyncContextFunction < Query > ;
240
+ options ?: FGraphQLOptions ;
237
241
runTime : any ;
238
242
parse : typeof parse ;
239
243
}
@@ -242,7 +246,7 @@ export interface FGraphqlOptions {
242
246
* Generate Graphql Resolvers for services
243
247
* {@link https://medium.com/@eddyystop/38faee75dd1}
244
248
*/
245
- export function fgraphql ( options ?: FGraphqlOptions ) : Hook ;
249
+ export function fgraphql ( options ?: FGraphQLHookOptions ) : Hook ;
246
250
247
251
/**
248
252
* Return a property value from an object using dot notation, e.g. address.city. (Utility function.)
0 commit comments