MCPcopy Create free account
hub / github.com/5e-bits/5e-database / _handleTranslationFileDeleted

Function _handleTranslationFileDeleted

scripts/update/processor.ts:477–492  ·  view source on GitHub ↗
(db: Db, filepath: string)

Source from the content-addressed store, hash-verified

475}
476
477async function _handleTranslationFileDeleted(db: Db, filepath: string): Promise<void> {
478 const lang = getLocaleFromFilepath(filepath);
479 if (!lang) return;
480 const filename = filepath.split('/').pop()!;
481 const indexName = getIndexName(filename);
482 if (!indexName) return;
483
484 const collectionPrefix = getCollectionPrefix(filepath);
485 const translationCollection = db.collection(`${collectionPrefix}translations`);
486
487 console.log(`\nProcessing Deleted translation ${filepath}...`);
488 const result = await translationCollection.deleteMany({ source_collection: indexName, lang });
489 console.log(` Deleted ${result.deletedCount} translation documents.`);
490
491 await _refreshLocaleStatsForLang(db, filepath, lang);
492}
493
494// --- Main Processor Function ---
495

Callers 1

processFileUpdateFunction · 0.85

Calls 4

getLocaleFromFilepathFunction · 0.90
getIndexNameFunction · 0.90
getCollectionPrefixFunction · 0.90

Tested by

no test coverage detected