* WIP * Add debug * Dedupe inserts * Add deterministic ordering * Fix whitespaces * Update insta * Add integration test script * Rename * Add test * Working for non-deletes * omg it mostly works for deletes * Isdeleted fix * remove created dates * update api * Take document id * No max attempt * works * Use string uuids * . * working!!!! (hopefully) * Improve bundling * Add module * lint * . * lint * Fix CI * use toolchain * clean up * Add useSlowFileEvents * Delete fuzz * Fix CI * use docker * fix script * clean up * Clean up * change node version * Build docker image on every commit * fix ci * 1 db per vault * Add scritps folder * Bump versions * Lint * . * Fix tests for real * Style * . * try * Consistent ordering * Fix tests * hmm * . * Clean up diff * Fixes * . * Fix version bump * . * . * .
14 lines
445 B
TypeScript
14 lines
445 B
TypeScript
import type { DocumentRecord } from "../persistence/database";
|
|
import { EMPTY_HASH } from "./hash";
|
|
|
|
// TODO: make this smarter so that offline files can be renamed & edited at the same time
|
|
export function findMatchingFile(
|
|
contentHash: string,
|
|
candidates: DocumentRecord[]
|
|
): DocumentRecord | undefined {
|
|
if (contentHash === EMPTY_HASH) {
|
|
return undefined;
|
|
}
|
|
|
|
return candidates.find(({ metadata }) => metadata?.hash === contentHash);
|
|
}
|