-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve type definitions, expose
FieldConfig
& `NamespaceConf…
…ig` types
- Loading branch information
Showing
30 changed files
with
99 additions
and
36 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,3 +1,5 @@ | ||
import { NamespaceConfig } from '../../../typeDefs'; | ||
|
||
export default { | ||
resolve: () => ({}), | ||
}; | ||
} as NamespaceConfig; |
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,6 +1,8 @@ | ||
import { FieldConfig } from '../../../typeDefs'; | ||
|
||
export default { | ||
type: 'Boolean', | ||
description: 'Login operation', | ||
args: { email: 'String', password: 'String' }, | ||
resolve: () => true, | ||
}; | ||
} as FieldConfig; |
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../typeDefs'; | ||
|
||
export default { | ||
type: 'Boolean', | ||
resolve: () => true, | ||
}; | ||
} as FieldConfig; |
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../../typeDefs'; | ||
|
||
export default { | ||
type: 'Boolean', | ||
resolve: () => true, | ||
}; | ||
} as FieldConfig; |
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../typeDefs'; | ||
|
||
export default { | ||
type: 'Boolean', | ||
resolve: () => true, | ||
}; | ||
} as FieldConfig; |
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../typeDefs'; | ||
|
||
export default { | ||
type: 'Boolean', | ||
resolve: () => true, | ||
}; | ||
} as FieldConfig; |
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../../typeDefs'; | ||
|
||
export default { | ||
type: 'Boolean', | ||
resolve: () => true, | ||
}; | ||
} as FieldConfig; |
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,3 +1,5 @@ | ||
import { NamespaceConfig } from '../../../typeDefs'; | ||
|
||
export default { | ||
type: 'NamespaceCustomTypeName', | ||
}; | ||
} as NamespaceConfig; |
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../typeDefs'; | ||
|
||
export default { | ||
type: (sc) => sc.get('Boolean'), | ||
resolve: () => true, | ||
}; | ||
} as FieldConfig; |
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../../typeDefs'; | ||
|
||
export default { | ||
type: 'Boolean', | ||
resolve: () => true, | ||
}; | ||
} as FieldConfig; |
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../../typeDefs'; | ||
|
||
export default { | ||
type: 'String', | ||
resolve: () => 'text', | ||
}; | ||
} as FieldConfig; |
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,5 +1,7 @@ | ||
import { FieldConfig } from '../../../typeDefs'; | ||
|
||
export default { | ||
type: 'String', | ||
description: 'This file should be skipped', | ||
resolve: () => 'ok', | ||
}; | ||
} as FieldConfig; |
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../typeDefs'; | ||
|
||
export default { | ||
type: 'String', | ||
resolve: () => 'ok', | ||
}; | ||
} as FieldConfig; |
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,3 +1,5 @@ | ||
import { NamespaceConfig } from '../../../typeDefs'; | ||
|
||
export default { | ||
resolve: () => ({}), | ||
}; | ||
} as NamespaceConfig; |
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../../typeDefs'; | ||
|
||
export default { | ||
type: 'Boolean', | ||
resolve: () => true, | ||
}; | ||
} as FieldConfig; |
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../../typeDefs'; | ||
|
||
export default { | ||
type: 'Boolean', | ||
resolve: () => true, | ||
}; | ||
} as FieldConfig; |
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,9 +1,11 @@ | ||
import { NamespaceConfig } from '../../../../typeDefs'; | ||
|
||
export default { | ||
args: { | ||
arg: 'Int', | ||
}, | ||
resolve: (_: any, __: any, context: any) => { | ||
resolve: (_, __, context) => { | ||
if (!context?.isAdmin) throw new Error('You should be the ADMIN'); | ||
return {}; | ||
}, | ||
}; | ||
} as NamespaceConfig; |
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../../typeDefs'; | ||
|
||
export default { | ||
type: 'String', | ||
resolve: () => 'nodkz', | ||
}; | ||
} as FieldConfig; |
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,8 +1,10 @@ | ||
import { FieldConfig } from '../../../typeDefs'; | ||
|
||
export default { | ||
type: ` | ||
type SomeIndexFileType { | ||
awesomeValue: String | ||
} | ||
`, | ||
resolve: () => ({ awesomeValue: 'awesomeValue' }), | ||
}; | ||
} as FieldConfig; |
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../typeDefs'; | ||
|
||
export default { | ||
type: 'Int', | ||
resolve: () => 123, | ||
}; | ||
} as FieldConfig; |
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,8 +1,10 @@ | ||
import { FieldConfig } from '../../../../typeDefs'; | ||
|
||
export default { | ||
type: ` | ||
type UserExtendedData { | ||
starsCount: Int | ||
} | ||
`, | ||
resolve: () => ({ starsCount: 10 }), | ||
}; | ||
} as FieldConfig; |
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
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,4 +1,6 @@ | ||
import { FieldConfig } from '../../../../typeDefs'; | ||
|
||
export default { | ||
type: ['String'], | ||
resolve: () => ['ADMIN', 'USER'], | ||
}; | ||
} as FieldConfig; |
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ObjectTypeComposerFieldConfigAsObjectDefinition } from 'graphql-compose'; | ||
|
||
export type FieldConfig<TContext = any, TArgs = any, TSource = any> = | ||
ObjectTypeComposerFieldConfigAsObjectDefinition<TSource, TContext, TArgs>; | ||
|
||
export type NamespaceConfig<TContext = any, TArgs = any, TSource = any> = Partial< | ||
ObjectTypeComposerFieldConfigAsObjectDefinition<TSource, TContext, TArgs> | ||
>; |