Skip to main content

talawa-api / Exports / utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithWhere

Module: utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithWhere

Table of contents

Type Aliases

Functions

Type Aliases

ParseGraphQLConnectionArgumentsWithWhereResult

Ƭ ParseGraphQLConnectionArgumentsWithWhereResult<T0, T1>: Promise<{ errors: DefaultGraphQLArgumentError[] ; isSuccessful: false } | { isSuccessful: true ; parsedArgs: ParsedGraphQLConnectionArgumentsWithWhere<T0, T1> }>

This is typescript type of the object returned from parseGraphQLConnectionArgumentsWithWhere function.

Type parameters

Name
T0
T1

Defined in

src/utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithWhere.ts:36


ParseGraphQLConnectionWhereResult

Ƭ ParseGraphQLConnectionWhereResult<T0>: { errors: DefaultGraphQLArgumentError[] ; isSuccessful: false } | { isSuccessful: true ; parsedWhere: T0 }

This is typescript type of the object returned from callback function parseWhere.

Type parameters

Name
T0

Defined in

src/utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithWhere.ts:15


ParsedGraphQLConnectionArgumentsWithWhere

Ƭ ParsedGraphQLConnectionArgumentsWithWhere<T0, T1>: { where: T1 } & ParsedGraphQLConnectionArguments<T0>

This is typescript type of the object containing the validated and transformed connection arguments passed to parseGraphQLConnectionArgumentsWithWhere function.

Type parameters

Name
T0
T1

Defined in

src/utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithWhere.ts:29

Functions

parseGraphQLConnectionArgumentsWithWhere

parseGraphQLConnectionArgumentsWithWhere<T0, T1>(«destructured»): ParseGraphQLConnectionArgumentsWithWhereResult<T0, T1>

This function handles validating and transforming arguments for a custom graphQL connection that also provides filtering capabilities.

Type parameters

Name
T0
T1

Parameters

NameTypeDefault value
«destructured»Objectundefined
› argsDefaultGraphQLConnectionArgumentsundefined
› maximumLimit?numberMAXIMUM_FETCH_LIMIT
› parseCursorParseGraphQLConnectionCursor<T0>undefined
› parseWhereResultParseGraphQLConnectionWhereResult<T1>undefined

Returns

ParseGraphQLConnectionArgumentsWithWhereResult<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, filter, limit \} \} = result;

Defined in

src/utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithWhere.ts:70