ResponseHandler class
Utilities for unwrapping Data API Builder (DAB) GraphQL response envelopes.
Methods
| unwrap |
Unwrap a DAB GraphQL response into its entity items. Accepts either a full response ( |
Method Details
unwrapGraphQLResponse<T>(any, string, boolean)
Unwrap a DAB GraphQL response into its entity items.
Accepts either a full response ({ data: { <entity>: { items } } }) or the
already-unwrapped data portion ({ <entity>: { items } }), applies DAB
deserialization, and returns either a flat array or a paginated result.
static function unwrapGraphQLResponse<T>(response: any, entityPluralName: string, expectPagination?: boolean): T[] | PagedResult<T>
Parameters
- response
-
any
The raw GraphQL response or its data portion.
- entityPluralName
-
string
The DAB query field name (pluralized entity).
- expectPagination
-
boolean
When true, return a PagedResult with
endCursor/hasNextPage; otherwise return a flat array.
Returns
T[] | PagedResult<T>
The deserialized items, or a PagedResult when expectPagination is true.