Skip to content

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 to GraphQLReqeest and match it to the WebIDE version

    export 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 new GitLabService.fetchFromApi method accept the new GraphQLRequest.

  • Drop the processResult callback.

    • this means that in some places we were returning GqlProject instead of GitLabProject and those places had to be updated
    • the getProjectsWithRepositoryInformation now can return undefined and so we had to add || [] to a few places that expected an array
Edited by Tomas Vik (OOO back on 2024-09-23)

Merge request reports