talawa-api / Exports / utilities/graphQLConnection/parseGraphQLConnectionArguments
Module: utilities/graphQLConnection/parseGraphQLConnectionArguments
Table of contents
Type Aliases
- ParseGraphQLConnectionArgumentsResult
- ParseGraphQLConnectionCursor
- ParseGraphQLConnectionCursorArguments
- ParseGraphQLConnectionCursorResult
- ParsedGraphQLConnectionArguments
Functions
Type Aliases
ParseGraphQLConnectionArgumentsResult
Ƭ ParseGraphQLConnectionArgumentsResult<T0
>: { errors
: DefaultGraphQLArgumentError
[] ; isSuccessful
: false
} | { isSuccessful
: true
; parsedArgs
: ParsedGraphQLConnectionArguments
<T0
> }
This is typescript type of the object returned from parseGraphQLConnectionArguments
function.
Type parameters
Name |
---|
T0 |
Defined in
src/utilities/graphQLConnection/parseGraphQLConnectionArguments.ts:57
ParseGraphQLConnectionCursor
Ƭ ParseGraphQLConnectionCursor<T0
>: (args
: ParseGraphQLConnectionCursorArguments
) => ParseGraphQLConnectionCursorResult
<T0
>
This is typescript type of the callback function parseCursor
.
Type parameters
Name |
---|
T0 |
Type declaration
▸ (args
): ParseGraphQLConnectionCursorResult
<T0
>
Parameters
Name | Type |
---|---|
args | ParseGraphQLConnectionCursorArguments |
Returns
ParseGraphQLConnectionCursorResult
<T0
>
Defined in
src/utilities/graphQLConnection/parseGraphQLConnectionArguments.ts:39
ParseGraphQLConnectionCursorArguments
Ƭ ParseGraphQLConnectionCursorArguments: Object
This is typescript type of the single object callback function parseCursor
takes in as
an argument.
Type declaration
Name | Type |
---|---|
cursorName | "after" | "before" |
cursorPath | string [] |
cursorValue | string |
Defined in
src/utilities/graphQLConnection/parseGraphQLConnectionArguments.ts:13
ParseGraphQLConnectionCursorResult
Ƭ ParseGraphQLConnectionCursorResult<T0
>: Promise
<{ errors
: DefaultGraphQLArgumentError
[] ; isSuccessful
: false
} | { isSuccessful
: true
; parsedCursor
: T0
}>
This is typescript type of object returned from the callback function parseCursor
passed
as an argument to parseGraphQLConnectionArguments
, parseGraphQLConnectionArgumentsWithSortedBy
,
parseGraphQLConnectionArgumentsWithWhere
and parseGraphQLConnectionArgumentsWithSortedByAndWhere
functions.
Type parameters
Name |
---|
T0 |
Defined in
src/utilities/graphQLConnection/parseGraphQLConnectionArguments.ts:25
ParsedGraphQLConnectionArguments
Ƭ ParsedGraphQLConnectionArguments<T0
>: Object
This is typescript type of the object containing the validated and transformed connection
arguments passed to parseGraphQLConnectionArguments
function.
Type parameters
Name |
---|
T0 |
Type declaration
Name | Type |
---|---|
cursor | T0 | null |
direction | GraphQLConnectionTraversalDirection |
limit | number |
Defined in
src/utilities/graphQLConnection/parseGraphQLConnectionArguments.ts:47
Functions
parseGraphQLConnectionArguments
▸ parseGraphQLConnectionArguments<T0
>(«destructured»
): Promise
<ParseGraphQLConnectionArgumentsResult
<T0
>>
This function handles validating and transforming arguments of a base graphQL connection.
Type parameters
Name |
---|
T0 |
Parameters
Name | Type | Default value |
---|---|---|
«destructured» | Object | undefined |
› args | DefaultGraphQLConnectionArguments | undefined |
› maximumLimit? | number | MAXIMUM_FETCH_LIMIT |
› parseCursor | ParseGraphQLConnectionCursor <T0 > | undefined |
Returns
Promise
<ParseGraphQLConnectionArgumentsResult
<T0
>>
Example
const result = await parseGraphQLConnectionArguments(\{
args: \{
after,
first,
\},
maximumLimit: 20,
parseCursor
\})
if (result.isSuccessful === false) \{
throw new GraphQLError("Invalid arguments provided.", \{
extensions: \{
code: "INVALID_ARGUMENTS",
errors: result.errors
\}
\})
\}
const \{ parsedArgs: \{ cursor, direction, limit \} \} = result;
Defined in
src/utilities/graphQLConnection/parseGraphQLConnectionArguments.ts:88