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

Method deleteScripts

src/app/service/service_worker/script.ts:530–555  ·  view source on GitHub ↗
(uuids: string[])

Source from the content-addressed store, hash-verified

528 }
529
530 async deleteScripts(uuids: string[]) {
531 const logger = this.logger.with({ uuids });
532 const scripts = (await this.scriptDAO.gets(uuids)).filter((s) => !!s);
533 if (!scripts.length) {
534 logger.error("scripts not found");
535 throw new Error("scripts not found");
536 }
537 return this.scriptDAO
538 .deletes(uuids)
539 .then(async () => {
540 await this.scriptCodeDAO.deletes(uuids);
541 await this.compiledResourceDAO.deletes(uuids);
542 logger.info("delete success");
543 const data = scripts.map((script) => ({
544 uuid: script.uuid,
545 storageName: getStorageName(script),
546 type: script.type,
547 })) as TDeleteScript[];
548 this.mq.publish<TDeleteScript[]>("deleteScripts", data);
549 return true;
550 })
551 .catch((e) => {
552 logger.error("delete error", Logger.E(e));
553 throw e;
554 });
555 }
556
557 async enableScript(param: { uuid: string; enable: boolean }) {
558 const { uuid, enable } = param;

Callers

nothing calls this directly

Calls 7

getStorageNameFunction · 0.90
withMethod · 0.80
errorMethod · 0.80
deletesMethod · 0.80
EMethod · 0.80
publishMethod · 0.65
infoMethod · 0.45

Tested by

no test coverage detected