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

Method deleteMetadata

packages/decap-cms-backend-github/src/API.ts:484–505  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

482 }
483
484 deleteMetadata(key: string) {
485 if (!this._metadataSemaphore) {
486 this._metadataSemaphore = semaphore(1);
487 }
488 return new Promise<void>(resolve =>
489 this._metadataSemaphore?.take(async () => {
490 try {
491 const branchData = await this.checkMetadataRef();
492 const file = { path: `${key}.json`, sha: null };
493
494 const changeTree = await this.updateTree(branchData.sha, [file]);
495 const { sha } = await this.commit(`Deleting “${key}” metadata`, changeTree);
496 await this.patchRef('meta', '_decap_cms', sha);
497 this._metadataSemaphore?.leave();
498 resolve();
499 } catch (err) {
500 this._metadataSemaphore?.leave();
501 resolve();
502 }
503 }),
504 );
505 }
506
507 async retrieveMetadataOld(key: string): Promise<Metadata> {
508 console.log(

Callers 2

migrateToVersion1Method · 0.95

Calls 4

checkMetadataRefMethod · 0.95
updateTreeMethod · 0.95
commitMethod · 0.95
patchRefMethod · 0.95

Tested by

no test coverage detected