(key: string)
| 457 | } |
| 458 | |
| 459 | deleteMetadata(key: string) { |
| 460 | if (!this._metadataSemaphore) { |
| 461 | this._metadataSemaphore = semaphore(1); |
| 462 | } |
| 463 | return new Promise<void>(resolve => |
| 464 | this._metadataSemaphore?.take(async () => { |
| 465 | try { |
| 466 | const branchData = await this.checkMetadataRef(); |
| 467 | const file = { path: `${key}.json`, sha: null }; |
| 468 | |
| 469 | const changeTree = await this.updateTree(branchData.sha, [file]); |
| 470 | const { sha } = await this.commit(`Deleting “${key}” metadata`, changeTree); |
| 471 | await this.patchRef('meta', '_decap_cms', sha); |
| 472 | this._metadataSemaphore?.leave(); |
| 473 | resolve(); |
| 474 | } catch (err) { |
| 475 | this._metadataSemaphore?.leave(); |
| 476 | resolve(); |
| 477 | } |
| 478 | }), |
| 479 | ); |
| 480 | } |
| 481 | |
| 482 | async retrieveMetadataOld(key: string): Promise<Metadata> { |
| 483 | console.log( |
no test coverage detected