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

Method readFileMetadata

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

Source from the content-addressed store, hash-verified

323 };
324
325 async readFileMetadata(path: string, sha: string | null | undefined) {
326 const fetchFileMetadata = async () => {
327 try {
328 const { values }: { values: BitBucketCommit[] } = await this.requestJSON({
329 url: `${this.repoURL}/commits`,
330 params: { path, include: this.branch },
331 });
332 const commit = values[0];
333 return {
334 author: commit.author.user
335 ? commit.author.user.display_name || commit.author.user.nickname
336 : commit.author.raw,
337 updatedOn: commit.date,
338 };
339 } catch (e) {
340 return { author: '', updatedOn: '' };
341 }
342 };
343 const fileMetadata = await readFileMetadata(sha, fetchFileMetadata, localForage);
344 return fileMetadata;
345 }
346
347 async isShaExistsInBranch(branch: string, sha: string) {
348 const { values }: { values: BitBucketCommit[] } = await this.requestJSON({

Callers

nothing calls this directly

Calls 1

readFileMetadataFunction · 0.90

Tested by

no test coverage detected