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

Method readFileMetadata

packages/decap-cms-backend-gitlab/src/API.ts:368–386  ·  view source on GitHub ↗
(path: string, sha: string | null | undefined)

Source from the content-addressed store, hash-verified

366 };
367
368 async readFileMetadata(path: string, sha: string | null | undefined) {
369 const fetchFileMetadata = async () => {
370 try {
371 const result: GitLabCommit[] = await this.requestJSON({
372 url: `${this.repoURL}/repository/commits`,
373 params: { path, ref_name: this.branch },
374 });
375 const commit = result[0];
376 return {
377 author: commit.author_name || commit.author_email,
378 updatedOn: commit.authored_date,
379 };
380 } catch (e) {
381 return { author: '', updatedOn: '' };
382 }
383 };
384 const fileMetadata = await readFileMetadata(sha, fetchFileMetadata, localForage);
385 return fileMetadata;
386 }
387
388 getCursorFromHeaders = (headers: Headers) => {
389 const page = parseInt(headers.get('X-Page') as string, 10);

Callers

nothing calls this directly

Calls 1

readFileMetadataFunction · 0.90

Tested by

no test coverage detected