MCPcopy Create free account
hub / github.com/EvoMap/evolver / assertNoLocalReuseIdConflict

Function assertNoLocalReuseIdConflict

src/gep/cliContracts.js:664–673  ·  view source on GitHub ↗
(asset, store, type)

Source from the content-addressed store, hash-verified

662}
663
664function assertNoLocalReuseIdConflict(asset, store, type) {
665 if (!asset || !asset.id) return;
666 const local = findLocalAssetByTypeAndId(store, type, asset.id);
667 if (!local) return;
668 const incomingAssetId = asset.asset_id || computeAssetId(asset);
669 const localAssetId = local.asset_id || computeAssetId(local);
670 if (incomingAssetId !== localAssetId) {
671 throw new ContractError('internal_error', 'local asset id conflict');
672 }
673}
674
675function findLocalAssetByTypeAndId(store, type, id) {
676 const loader = type === 'Gene' ? store.loadGenes : store.loadCapsules;

Callers 2

prepareReuseAssetStoreFunction · 0.85
storeReusedAssetFunction · 0.85

Calls 1

Tested by

no test coverage detected