Export person data from firebase console and copy that file to this folder with name data.json
Run bun index.ts
This will output out.json
import jsonFile from "./data.json";
const path = "./out.json";
const jsonCopy = JSON.parse(JSON.stringify(jsonFile));
/**
* This will check if bookmakr's taggedPersons are in the persons' taggedUrls
*/
Object.entries<any>(jsonCopy.bookmarks.urlList).forEach(([bmId, bmData]) => {
if (!bmData.taggedPersons) {
return;
}
bmData.taggedPersons.forEach((personId) => {
const person = jsonCopy.persons[personId];
if (!person.taggedUrls?.includes(bmId)) {
/**
* First run with this being commented to just know what changes will be made.
* Then once knowing the ouput, uncomment this and run.
*/
// person.taggedUrls = person.taggedUrls || [];
// person.taggedUrls.push(bmId);
console.log(
"Person not tagged",
bmId,
decodeURIComponent(atob(bmData.title)),
personId
);
}
});
});
/**
* This will just output persons with no bookmarks
*/
Object.entries<any>(jsonCopy.persons).forEach(([personId, personData]) => {
if (!personData.taggedUrls?.length) {
console.log(
"Person not tagged",
personId,
decodeURIComponent(atob(personData.name))
);
}
});
await Bun.write(path, JSON.stringify(jsonCopy));
bun init
in a new folderdata.json
bun index.ts
out.json