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

Method readFileMetadata

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

Source from the content-addressed store, hash-verified

375 };
376
377 async readFileMetadata(path: string, sha: string | null | undefined) {
378 const fetchFileMetadata = async () => {
379 try {
380 const result: GitLabCommit[] = await this.requestJSON({
381 url: `${this.repoURL}/repository/commits`,
382 params: { path, ref_name: this.branch },
383 });
384 const commit = result[0];
385 return {
386 author: commit.author_name || commit.author_email,
387 updatedOn: commit.authored_date,
388 };
389 } catch (e) {
390 return { author: '', updatedOn: '' };
391 }
392 };
393 const fileMetadata = await readFileMetadata(sha, fetchFileMetadata, localForage);
394 return fileMetadata;
395 }
396
397 getCursorFromHeaders = (headers: Headers) => {
398 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