mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
fix: add types to authentication context object & executeQuery for @types/keystonejs__keystone (#43257)
* fix: add types to authentication context for keystone v6.0
* fix: add other fields from authentication context data packet
some fields were undefined. I have added these as optional with any for now.
* fix: pass default values with the optional options for executeQuery()
This permits
```
executeQuery(
`query {
_allUsersMeta {
count
}
}`
```
as well as
```
executeQuery(
`query {
_allUsersMeta {
count
}
}`,
{
variables: {
password,
email,
},
}
```
* fix: remove initializer from interface property
* fix: ci error
`A parameter initializer is only allowed in a function or constructor implementation.`
* fix: i am done with semicolons
This commit is contained in:
parent
8ab0898586
commit
7afb65a981
26
types/keystonejs__keystone/index.d.ts
vendored
26
types/keystonejs__keystone/index.d.ts
vendored
@ -1,7 +1,8 @@
|
||||
// Type definitions for @keystonejs/keystone 5.2
|
||||
// Type definitions for @keystonejs/keystone 6.0
|
||||
// Project: https://github.com/keystonejs/keystone
|
||||
// Definitions by: Kevin Brown <https://github.com/thekevinbrown>
|
||||
// Timothee Clain <https://github.com/tclain>
|
||||
// Abhijith Vijayan <https://github.com/abhijithvijayan>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.5
|
||||
|
||||
@ -48,7 +49,21 @@ declare module '@keystonejs/keystone' {
|
||||
}
|
||||
|
||||
interface AuthenticationContext {
|
||||
authentication: { item: any }; // TODO
|
||||
authentication: {
|
||||
item: {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
isAdmin: boolean;
|
||||
password: string;
|
||||
};
|
||||
listKey: string;
|
||||
operation: string;
|
||||
originalInput?: any; // TODO: types
|
||||
gqlName: string;
|
||||
itemId?: any; // TODO: types
|
||||
itemIds?: any; // TODO: types
|
||||
};
|
||||
}
|
||||
|
||||
interface GraphQLWhereClause {
|
||||
@ -217,6 +232,11 @@ declare module '@keystonejs/keystone' {
|
||||
mutations?: GraphQLExtension[];
|
||||
}
|
||||
|
||||
interface QueryExecutionSchema {
|
||||
variables?: any;
|
||||
context?: any;
|
||||
}
|
||||
|
||||
class Keystone<ListNames extends string = string> {
|
||||
constructor(options: KeystoneOptions);
|
||||
|
||||
@ -228,7 +248,7 @@ declare module '@keystonejs/keystone' {
|
||||
|
||||
// The return type is actually important info here. I don't believe this generic is unnecessary.
|
||||
// tslint:disable-next-line:no-unnecessary-generics
|
||||
executeQuery<Output = any>(query: string, config: { variables: any; context: any }): Output;
|
||||
executeQuery<Output = any>(query: string, config?: QueryExecutionSchema): Output;
|
||||
connect(): Promise<void>;
|
||||
disconnect(): Promise<void>;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user