| 55 | const MAX_CONCURRENT_DOWNLOADS = 10; |
| 56 | |
| 57 | export default class GitLab implements Implementation { |
| 58 | notesApi?: GitLabNotesAPI; |
| 59 | pollingManager?: NotesPollingManager; |
| 60 | private unwatchNotes = new Map<string, () => void>(); |
| 61 | private notesUserPromise?: Promise<{ username?: string; name?: string }>; |
| 62 | |
| 63 | lock: AsyncLock; |
| 64 | api: API | null; |
| 65 | updateUserCredentials: (args: { token: string; refresh_token?: string }) => Promise<null>; |
| 66 | options: { |
| 67 | proxied: boolean; |
| 68 | API: API | null; |
| 69 | updateUserCredentials: (args: { token: string; refresh_token?: string }) => Promise<null>; |
| 70 | initialWorkflowStatus: string; |
| 71 | }; |
| 72 | repo: string; |
| 73 | isBranchConfigured: boolean; |
| 74 | branch: string; |
| 75 | apiRoot: string; |
| 76 | token: string | null; |
| 77 | squashMerges: boolean; |
| 78 | cmsLabelPrefix: string; |
| 79 | mediaFolder: string; |
| 80 | previewContext: string; |
| 81 | useGraphQL: boolean; |
| 82 | graphQLAPIRoot: string; |
| 83 | authType: string; |
| 84 | baseUrl: string; |
| 85 | authEndpoint: string; |
| 86 | appID: string; |
| 87 | refreshToken?: string; |
| 88 | refreshedTokenPromise?: Promise<string>; |
| 89 | authenticator?: PkceAuthenticator; |
| 90 | |
| 91 | _mediaDisplayURLSem?: Semaphore; |
| 92 | |
| 93 | constructor(config: Config, options = {}) { |
| 94 | this.options = { |
| 95 | proxied: false, |
| 96 | API: null, |
| 97 | updateUserCredentials: async () => null, |
| 98 | initialWorkflowStatus: '', |
| 99 | ...options, |
| 100 | }; |
| 101 | |
| 102 | if ( |
| 103 | !this.options.proxied && |
| 104 | (config.backend.repo === null || config.backend.repo === undefined) |
| 105 | ) { |
| 106 | throw new Error('The GitLab backend needs a "repo" in the backend configuration.'); |
| 107 | } |
| 108 | |
| 109 | this.api = this.options.API || null; |
| 110 | |
| 111 | this.updateUserCredentials = this.options.updateUserCredentials; |
| 112 | |
| 113 | this.repo = config.backend.repo || ''; |
| 114 | this.branch = config.backend.branch || 'master'; |
nothing calls this directly
no test coverage detected