(path: string, sha: string | null | undefined)
| 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({ |
nothing calls this directly
no test coverage detected