-
-
Notifications
You must be signed in to change notification settings - Fork 142
/
index.ts
35 lines (32 loc) · 1.07 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { createModule } from 'graphql-modules';
import TypesTypeDefs from './schema/types';
import getQueryTypeDefs from './schema/query';
import getMutationTypeDefs from './schema/mutation';
import { Query } from './resolvers/query';
import { Mutation } from './resolvers/mutation';
import AccountsPassword, {
AccountsPasswordConfigToken,
type AccountsPasswordOptions,
} from '@accounts/password';
export * from './models';
export interface AccountsPasswordModuleConfig extends AccountsPasswordOptions {
rootQueryName?: string;
rootMutationName?: string;
extendTypeDefs?: boolean;
}
export const createAccountsPasswordModule = (config: AccountsPasswordModuleConfig = {}) =>
createModule({
id: 'accounts-password',
typeDefs: [TypesTypeDefs, getQueryTypeDefs(config), getMutationTypeDefs(config)],
resolvers: {
[config.rootQueryName || 'Query']: Query,
[config.rootMutationName || 'Mutation']: Mutation,
},
providers: [
{
provide: AccountsPasswordConfigToken,
useValue: config,
},
AccountsPassword,
],
});