refactor: unify GraphQLRequest interface with WebIDE
This MR creates updates the GraphQLRequest
interface and uses it to retrieve project(s).
Related to gitlab#413507 (closed)
The main changes are:
-
Change the
GraphQLQuery
interface toGraphQLReqeest
and match it to the WebIDE versionexport interface GraphQLRequest<TReturnType> { type: 'graphql'; query: string; /** Options passed to the GraphQL query */ options: Record<string, unknown>; /** * Address of the result within the returned object * it uses the syntax of lodash _.get function * https://lodash.com/docs/4.17.15#get * When omitted, the full GraphQL response is returned. * * For example if the result is `{ a: [{b: "c"}]}` * you can set resultPath to `a[0].b` to retrieve only "c" */ resultPath?: string; }
-
Remove the "legacy"
GitLabService.execute
method and make the newGitLabService.fetchFromApi
method accept the newGraphQLRequest
. -
Drop the
processResult
callback.- this means that in some places we were returning
GqlProject
instead ofGitLabProject
and those places had to be updated - the
getProjectsWithRepositoryInformation
now can returnundefined
and so we had to add|| []
to a few places that expected an array
- this means that in some places we were returning
Edited by Tomas Vik (OOO back on 2024-09-23)