MCPcopy Create free account
hub / github.com/Shazbot/WH3-Mod-Manager / tryGetPackWithReference

Function tryGetPackWithReference

src/DBClone.ts:419–451  ·  view source on GitHub ↗
(
    pack: Pack,
    newTableName: string,
    newTableColumnName: string,
    resolvedKeyValue: string
  )

Source from the content-addressed store, hash-verified

417 };
418
419 const tryGetPackWithReference = async (
420 pack: Pack,
421 newTableName: string,
422 newTableColumnName: string,
423 resolvedKeyValue: string
424 ) => {
425 console.log("tryGetPackWithReference:", pack.path, newTableName, newTableColumnName, resolvedKeyValue);
426
427 let newPackFile = pack.packedFiles.find(
428 (pf) =>
429 getDBNameFromString(pf.name) == newTableName &&
430 pf.schemaFields
431 ?.filter((sF) => (sF as AmendedSchemaField).name == newTableColumnName)
432 .some((sF) => (sF as AmendedSchemaField).resolvedKeyValue == resolvedKeyValue)
433 );
434
435 if (!newPackFile || !newPackFile.schemaFields) {
436 console.log("CALLING getRef");
437 await getRef(newTableName, pack);
438
439 newPackFile = pack.packedFiles.find(
440 (pf) =>
441 getDBNameFromString(pf.name) == newTableName &&
442 pf.schemaFields
443 ?.filter((sF) => (sF as AmendedSchemaField).name == newTableColumnName)
444 .some((sF) => (sF as AmendedSchemaField).resolvedKeyValue == resolvedKeyValue)
445 );
446
447 return newPackFile;
448 }
449
450 return newPackFile;
451 };
452
453 const addNewCellFromReference = async (
454 acc: DBCell[],

Callers 1

addNewCellFromReferenceFunction · 0.85

Calls 2

getDBNameFromStringFunction · 0.90
getRefFunction · 0.85

Tested by

no test coverage detected