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

Method readFileMetadata

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

readFileMetadataFunction · 0.90

Tested by

no test coverage detected