MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / deleteScript

Method deleteScript

src/app/service/service_worker/script.ts:505–528  ·  view source on GitHub ↗
(uuid: string, deleteBy?: InstallSource)

Source from the content-addressed store, hash-verified

503 }
504
505 async deleteScript(uuid: string, deleteBy?: InstallSource) {
506 let logger = this.logger.with({ uuid });
507 const script = await this.scriptDAO.get(uuid);
508 if (!script) {
509 logger.error("script not found");
510 throw new Error("script not found");
511 }
512 logger = logger.with({ name: script.name });
513 const storageName = getStorageName(script);
514 return this.scriptDAO
515 .delete(uuid)
516 .then(async () => {
517 await this.scriptCodeDAO.delete(uuid);
518 await this.compiledResourceDAO.delete(uuid);
519 logger.info("delete success");
520 const data = [{ uuid, storageName, type: script.type, deleteBy }] as TDeleteScript[];
521 this.mq.publish("deleteScripts", data);
522 return true;
523 })
524 .catch((e) => {
525 logger.error("delete error", Logger.E(e));
526 throw e;
527 });
528 }
529
530 async deleteScripts(uuids: string[]) {
531 const logger = this.logger.with({ uuids });

Callers 3

deleteMethod · 0.80
upsertScriptMethod · 0.80
syncOnceInternalMethod · 0.80

Calls 8

getStorageNameFunction · 0.90
withMethod · 0.80
errorMethod · 0.80
EMethod · 0.80
getMethod · 0.65
deleteMethod · 0.65
publishMethod · 0.65
infoMethod · 0.45

Tested by

no test coverage detected