Skip to content

Commit

Permalink
fix(Typescript): missing createMany in TypeConverterResolverOpts
Browse files Browse the repository at this point in the history
* Fix createMany exception

* Missing createMany in TypeConverterResolversOpts for TypeScript

* Fix tabs -> spaces
  • Loading branch information
berrymat authored and nodkz committed Aug 29, 2018
1 parent 6dd16a1 commit b2e9ae7
Showing 1 changed file with 76 additions and 59 deletions.
135 changes: 76 additions & 59 deletions src/composeWithMongoose.d.ts
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;

0 comments on commit b2e9ae7

Please sign in to comment.