@@ -24,6 +24,7 @@ import {
2424 ScmIntegrations ,
2525} from '@backstage/integration' ;
2626
27+ import { Gitlab , GroupSchema } from '@gitbeaker/rest' ;
2728import gitUrlParse from 'git-url-parse' ;
2829
2930import { getBranchName , getCatalogFilename } from '../catalog/catalogUtils' ;
@@ -108,18 +109,10 @@ export class GitlabApiService {
108109 { credential, owner : gitUrl . owner } ,
109110 glConfig . baseUrl ,
110111 ) ;
111- const resp = await glKit . Projects . show ( `${ gitUrl . owner } /${ gitUrl . name } ` ) ;
112- const repo = resp ;
112+ const repo = await glKit . Projects . show ( `${ gitUrl . owner } /${ gitUrl . name } ` ) ;
113113 if ( ! repo ) {
114114 continue ;
115115 }
116-
117- // name: repo.name,
118- // full_name: repo.path_with_namespace,
119- // url: repo._links.self,
120- // html_url: repo.web_url,
121- // default_branch: repo.default_branch,
122- // updated_at: repo.updated_at,
123116 repository = {
124117 name : repo . name ,
125118 full_name : repo . path_with_namespace ,
@@ -152,7 +145,7 @@ export class GitlabApiService {
152145 this . integrations ,
153146 {
154147 dataFetcher : async (
155- glApi : any ,
148+ glApi : InstanceType < typeof Gitlab < false > > ,
156149 credential : ExtendedGitlabCredentials ,
157150 glConfig : GitLabIntegrationConfig ,
158151 ) => {
@@ -207,7 +200,7 @@ export class GitlabApiService {
207200 this . integrations ,
208201 {
209202 dataFetcher : async (
210- glApi : any ,
203+ glApi : InstanceType < typeof Gitlab < false > > ,
211204 credential : ExtendedGitlabCredentials ,
212205 glConfig : GitLabIntegrationConfig ,
213206 ) => {
@@ -268,7 +261,7 @@ export class GitlabApiService {
268261 this . integrations ,
269262 {
270263 dataFetcher : async (
271- glApi : any ,
264+ glApi : InstanceType < typeof Gitlab < false > > ,
272265 credential : ExtendedGitlabCredentials ,
273266 glConfig : GitLabIntegrationConfig ,
274267 ) => {
@@ -322,19 +315,19 @@ export class GitlabApiService {
322315 } ,
323316 this . integrations ,
324317 {
325- dataFetcher : async ( gitlab : any ) => {
318+ dataFetcher : async ( gitlab : InstanceType < typeof Gitlab < false > > ) => {
326319 // find authenticated gitlab owner...
327320 const username = ( await gitlab . Users . showCurrentUser ( ) ) . username ;
328321 if ( username ) {
329322 allAccessibleUsernames . add ( username ) ;
330323 }
331324 // ... along with orgs accessible from the token auth
332- (
333- await gitlab . Groups . all ( {
334- all_available : false ,
335- } )
336- )
337- ? .map ( ( org : { path : any } ) => org . path )
325+
326+ const allGroups = await gitlab . Groups . all < false , 'offset' > ( {
327+ allAvailable : false ,
328+ } ) ;
329+ allGroups
330+ . map ( org => org . path )
338331 ?. forEach ( ( orgName : string ) => allAccessibleTokenOrgs . add ( orgName ) ) ;
339332 return { } ;
340333 } ,
@@ -441,7 +434,7 @@ export class GitlabApiService {
441434 repoUrl : input . repoUrl ,
442435 fn : async (
443436 validatedRepo : ValidatedRepo ,
444- gitlab : any ,
437+ gitlab : InstanceType < typeof Gitlab < false > > ,
445438 ) : Promise < {
446439 successful : boolean ;
447440 result ?: {
@@ -618,7 +611,10 @@ export class GitlabApiService {
618611 this . integrations ,
619612 {
620613 repoUrl : input . repoUrl ,
621- fn : async ( validatedRepo : ValidatedRepo , gitlab : any ) => {
614+ fn : async (
615+ validatedRepo : ValidatedRepo ,
616+ gitlab : InstanceType < typeof Gitlab < false > > ,
617+ ) => {
622618 const { owner, repo } = validatedRepo ;
623619 const exists = await fileExistsInDefaultBranch (
624620 this . logger ,
@@ -663,7 +659,10 @@ export class GitlabApiService {
663659 this . integrations ,
664660 {
665661 repoUrl : input . repoUrl ,
666- fn : async ( validatedRepo : ValidatedRepo , gitlab : any ) => {
662+ fn : async (
663+ validatedRepo : ValidatedRepo ,
664+ gitlab : InstanceType < typeof Gitlab < false > > ,
665+ ) => {
667666 const { owner, repo, branchName } = validatedRepo ;
668667 try {
669668 const existingPrForBranch = await findOpenPRForBranch (
@@ -711,7 +710,10 @@ export class GitlabApiService {
711710 this . integrations ,
712711 {
713712 repoUrl : input . repoUrl ,
714- fn : async ( validatedRepo : ValidatedRepo , gitlab : any ) => {
713+ fn : async (
714+ validatedRepo : ValidatedRepo ,
715+ gitlab : InstanceType < typeof Gitlab < false > > ,
716+ ) => {
715717 const { owner, repo, branchName } = validatedRepo ;
716718 try {
717719 await gitlab . Branches . remove ( `${ owner } /${ repo } ` , branchName ) ;
@@ -740,14 +742,15 @@ export class GitlabApiService {
740742 this . integrations ,
741743 {
742744 repoUrl : input . repoUrl ,
743- fn : async ( validatedRepo : ValidatedRepo , gitlab : any ) => {
745+ fn : async (
746+ validatedRepo : ValidatedRepo ,
747+ gitlab : InstanceType < typeof Gitlab < false > > ,
748+ ) => {
744749 const { owner, repo } = validatedRepo ;
745750 const resp = await gitlab . Repositories . allContributors (
746751 `${ owner } /${ repo } ` ,
747752 {
748753 showExpanded : true ,
749- perPage : 1 ,
750- page : 1 ,
751754 } ,
752755 ) ;
753756 return { successful : true , result : resp ?. data ?. length < 1 } ;
0 commit comments