-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Typescript): missing createMany in TypeConverterResolverOpts
* Fix createMany exception * Missing createMany in TypeConverterResolversOpts for TypeScript * Fix tabs -> spaces
- Loading branch information
Showing
1 changed file
with
76 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,121 +1,138 @@ | ||
import { InputTypeComposer, SchemaComposer, TypeComposer } from 'graphql-compose'; | ||
import { | ||
InputTypeComposer, | ||
SchemaComposer, | ||
TypeComposer, | ||
} from 'graphql-compose'; | ||
import { Document, Model } from 'mongoose'; | ||
import { ConnectionSortMapOpts } from './resolvers/connection'; | ||
import { | ||
FilterHelperArgsOpts, LimitHelperArgsOpts, RecordHelperArgsOpts, SortHelperArgsOpts, | ||
FilterHelperArgsOpts, | ||
LimitHelperArgsOpts, | ||
RecordHelperArgsOpts, | ||
SortHelperArgsOpts, | ||
} from './resolvers/helpers'; | ||
import { PaginationResolverOpts } from './resolvers/pagination'; | ||
|
||
export type TypeConverterOpts = { | ||
schemaComposer?: SchemaComposer<any>, | ||
name?: string, | ||
description?: string, | ||
schemaComposer?: SchemaComposer<any>; | ||
name?: string; | ||
description?: string; | ||
fields?: { | ||
only?: string[], | ||
remove?: string[], | ||
}, | ||
inputType?: TypeConverterInputTypeOpts, | ||
resolvers?: false | TypeConverterResolversOpts, | ||
only?: string[]; | ||
remove?: string[]; | ||
}; | ||
inputType?: TypeConverterInputTypeOpts; | ||
resolvers?: false | TypeConverterResolversOpts; | ||
}; | ||
|
||
export type TypeConverterInputTypeOpts = { | ||
name?: string, | ||
description?: string, | ||
name?: string; | ||
description?: string; | ||
fields?: { | ||
only?: string[], | ||
remove?: string[], | ||
required?: string[], | ||
}, | ||
only?: string[]; | ||
remove?: string[]; | ||
required?: string[]; | ||
}; | ||
}; | ||
|
||
export type TypeConverterResolversOpts = { | ||
findById?: false, | ||
findById?: false; | ||
findByIds?: | ||
| false | ||
| { | ||
limit?: LimitHelperArgsOpts | false, | ||
sort?: SortHelperArgsOpts | false, | ||
}, | ||
limit?: LimitHelperArgsOpts | false; | ||
sort?: SortHelperArgsOpts | false; | ||
}; | ||
findOne?: | ||
| false | ||
| { | ||
filter?: FilterHelperArgsOpts | false, | ||
sort?: SortHelperArgsOpts | false, | ||
skip?: false, | ||
}, | ||
filter?: FilterHelperArgsOpts | false; | ||
sort?: SortHelperArgsOpts | false; | ||
skip?: false; | ||
}; | ||
findMany?: | ||
| false | ||
| { | ||
filter?: FilterHelperArgsOpts | false, | ||
sort?: SortHelperArgsOpts | false, | ||
limit?: LimitHelperArgsOpts | false, | ||
skip?: false, | ||
}, | ||
filter?: FilterHelperArgsOpts | false; | ||
sort?: SortHelperArgsOpts | false; | ||
limit?: LimitHelperArgsOpts | false; | ||
skip?: false; | ||
}; | ||
updateById?: | ||
| false | ||
| { | ||
record?: RecordHelperArgsOpts | false, | ||
}, | ||
record?: RecordHelperArgsOpts | false; | ||
}; | ||
updateOne?: | ||
| false | ||
| { | ||
input?: RecordHelperArgsOpts | false, | ||
filter?: FilterHelperArgsOpts | false, | ||
sort?: SortHelperArgsOpts | false, | ||
skip?: false, | ||
}, | ||
input?: RecordHelperArgsOpts | false; | ||
filter?: FilterHelperArgsOpts | false; | ||
sort?: SortHelperArgsOpts | false; | ||
skip?: false; | ||
}; | ||
updateMany?: | ||
| false | ||
| { | ||
record?: RecordHelperArgsOpts | false, | ||
filter?: FilterHelperArgsOpts | false, | ||
sort?: SortHelperArgsOpts | false, | ||
limit?: LimitHelperArgsOpts | false, | ||
skip?: false, | ||
}, | ||
removeById?: false, | ||
record?: RecordHelperArgsOpts | false; | ||
filter?: FilterHelperArgsOpts | false; | ||
sort?: SortHelperArgsOpts | false; | ||
limit?: LimitHelperArgsOpts | false; | ||
skip?: false; | ||
}; | ||
removeById?: false; | ||
removeOne?: | ||
| false | ||
| { | ||
filter?: FilterHelperArgsOpts | false, | ||
sort?: SortHelperArgsOpts | false, | ||
}, | ||
filter?: FilterHelperArgsOpts | false; | ||
sort?: SortHelperArgsOpts | false; | ||
}; | ||
removeMany?: | ||
| false | ||
| { | ||
filter?: FilterHelperArgsOpts | false, | ||
}, | ||
filter?: FilterHelperArgsOpts | false; | ||
}; | ||
createOne?: | ||
| false | ||
| { | ||
record?: RecordHelperArgsOpts | false, | ||
}, | ||
record?: RecordHelperArgsOpts | false; | ||
}; | ||
createMany?: | ||
| false | ||
| { | ||
record?: RecordHelperArgsOpts | false; | ||
}; | ||
count?: | ||
| false | ||
| { | ||
filter?: FilterHelperArgsOpts | false, | ||
}, | ||
connection?: ConnectionSortMapOpts | false, | ||
pagination?: PaginationResolverOpts | false, | ||
filter?: FilterHelperArgsOpts | false; | ||
}; | ||
connection?: ConnectionSortMapOpts | false; | ||
pagination?: PaginationResolverOpts | false; | ||
}; | ||
|
||
export function composeWithMongoose( | ||
model: Model<any>, | ||
opts?: TypeConverterOpts): TypeComposer<any>; | ||
opts?: TypeConverterOpts, | ||
): TypeComposer<any>; | ||
|
||
export function prepareFields( | ||
tc: TypeComposer<any>, | ||
opts: { only?: string[], remove?: string[] }): void; | ||
opts: { only?: string[]; remove?: string[] }, | ||
): void; | ||
|
||
export function prepareInputFields( | ||
inputTypeComposer: InputTypeComposer, | ||
inputFieldsOpts: { only?: string[], remove?: string[], required?: string[] }): void; | ||
inputFieldsOpts: { only?: string[]; remove?: string[]; required?: string[] }, | ||
): void; | ||
|
||
export function createInputType( | ||
tc: TypeComposer<any>, | ||
inputTypeOpts?: TypeConverterInputTypeOpts): void; | ||
inputTypeOpts?: TypeConverterInputTypeOpts, | ||
): void; | ||
|
||
export function createResolvers<TDocument extends Document>( | ||
model: Model<TDocument>, | ||
tc: TypeComposer<any>, | ||
opts: TypeConverterResolversOpts): void; | ||
opts: TypeConverterResolversOpts, | ||
): void; |