MCPcopy Create free account
hub / github.com/decaporg/decap-cms / GitLab

Class GitLab

packages/decap-cms-backend-gitlab/src/implementation.ts:52–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50const MAX_CONCURRENT_DOWNLOADS = 10;
51
52export default class GitLab implements Implementation {
53 lock: AsyncLock;
54 api: API | null;
55 updateUserCredentials: (args: { token: string; refresh_token?: string }) => Promise<null>;
56 options: {
57 proxied: boolean;
58 API: API | null;
59 updateUserCredentials: (args: { token: string; refresh_token?: string }) => Promise<null>;
60 initialWorkflowStatus: string;
61 };
62 repo: string;
63 isBranchConfigured: boolean;
64 branch: string;
65 apiRoot: string;
66 token: string | null;
67 squashMerges: boolean;
68 cmsLabelPrefix: string;
69 mediaFolder: string;
70 previewContext: string;
71 useGraphQL: boolean;
72 graphQLAPIRoot: string;
73 authType: string;
74 baseUrl: string;
75 authEndpoint: string;
76 appID: string;
77 refreshToken?: string;
78 refreshedTokenPromise?: Promise<string>;
79 authenticator?: PkceAuthenticator;
80
81 _mediaDisplayURLSem?: Semaphore;
82
83 constructor(config: Config, options = {}) {
84 this.options = {
85 proxied: false,
86 API: null,
87 updateUserCredentials: async () => null,
88 initialWorkflowStatus: '',
89 ...options,
90 };
91
92 if (
93 !this.options.proxied &&
94 (config.backend.repo === null || config.backend.repo === undefined)
95 ) {
96 throw new Error('The GitLab backend needs a "repo" in the backend configuration.');
97 }
98
99 this.api = this.options.API || null;
100
101 this.updateUserCredentials = this.options.updateUserCredentials;
102
103 this.repo = config.backend.repo || '';
104 this.branch = config.backend.branch || 'master';
105 this.isBranchConfigured = config.backend.branch ? true : false;
106 this.apiRoot = config.backend.api_root || 'https://gitlab.com/api/v4';
107 this.token = '';
108 this.squashMerges = config.backend.squash_merges || false;
109 this.cmsLabelPrefix = config.backend.cms_label_prefix || '';

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected