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