talawa-api / Exports / utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithSortedBy
Module: utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithSortedBy
Table of contents
Type Aliases
- ParseGraphQLConnectionArgumentsWithSortedByResult
- ParseGraphQLConnectionSortedByResult
- ParsedGraphQLConnectionArgumentsWithSortedBy
Functions
Type Aliases
ParseGraphQLConnectionArgumentsWithSortedByResult
Ƭ ParseGraphQLConnectionArgumentsWithSortedByResult<T0
, T1
>: Promise
<{ errors
: DefaultGraphQLArgumentError
[] ; isSuccessful
: false
} | { isSuccessful
: true
; parsedArgs
: ParsedGraphQLConnectionArgumentsWithSortedBy
<T0
, T1
> }>
This is typescript type of the object returned from parseGraphQLConnectionArgumentsWithSortedBy
function.
Type parameters
Name |
---|
T0 |
T1 |
Defined in
src/utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithSortedBy.ts:36
ParseGraphQLConnectionSortedByResult
Ƭ ParseGraphQLConnectionSortedByResult<T0
>: { errors
: DefaultGraphQLArgumentError
[] ; isSuccessful
: false
} | { isSuccessful
: true
; parsedSortedBy
: T0
}
This is typescript type of the object returned from callback function parseSortedBy
.
Type parameters
Name |
---|
T0 |
Defined in
src/utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithSortedBy.ts:15
ParsedGraphQLConnectionArgumentsWithSortedBy
Ƭ ParsedGraphQLConnectionArgumentsWithSortedBy<T0
, T1
>: { sort
: T1
} & ParsedGraphQLConnectionArguments
<T0
>
This is typescript type of the object containing validated and transformed connection
arguments passed to parseGraphQLConnectionArgumentsWithSortedBy
function.
Type parameters
Name |
---|
T0 |
T1 |
Defined in
src/utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithSortedBy.ts:29
Functions
parseGraphQLConnectionArgumentsWithSortedBy
▸ parseGraphQLConnectionArgumentsWithSortedBy<T0
, T1
>(«destructured»
): ParseGraphQLConnectionArgumentsWithSortedByResult
<T0
, T1
>
This function is used for validating and transforming arguments for a graphQL connection that also provides sorting capabilities.
Type parameters
Name |
---|
T0 |
T1 |
Parameters
Name | Type | Default value |
---|---|---|
«destructured» | Object | undefined |
› args | DefaultGraphQLConnectionArguments | undefined |
› maximumLimit? | number | MAXIMUM_FETCH_LIMIT |
› parseCursor | ParseGraphQLConnectionCursor <T0 > | undefined |
› parseSortedByResult | ParseGraphQLConnectionSortedByResult <T1 > | undefined |
Returns
ParseGraphQLConnectionArgumentsWithSortedByResult
<T0
, T1
>
Example
const result = await parseGraphQLConnectionArgumentsWithSortedBy(\{
args: \{
after,
first,
\},
maximumLimit: 20,
parseCursor,
parseSortedBy,
\})
if (result.isSuccessful === false) \{
throw new GraphQLError("Invalid arguments provided.", \{
extensions: \{
code: "INVALID_ARGUMENTS",
errors: result.errors
\}
\})
\}
const \{ parsedArgs: \{ cursor, direction, limit, sort \} \} = result;
Defined in
src/utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithSortedBy.ts:70