debug: add [BOOKMARK_TS] logging to investigate timestamp issues

- Log parentCreatedAt value when processApplesauceBookmarks is called
- Log each bookmark event with its kind and created_at timestamp
- Log count and timestamp for notes, articles, and URLs being processed
- Prefixed with [BOOKMARK_TS] for easy console filtering
This commit is contained in:
Gigi
2025-10-20 13:56:07 +02:00
parent 7516013e67
commit 2b061afa47
2 changed files with 6 additions and 0 deletions

View File

@@ -67,12 +67,15 @@ export const processApplesauceBookmarks = (
): IndividualBookmark[] => {
if (!bookmarks) return []
console.log('[BOOKMARK_TS] processApplesauceBookmarks called with parentCreatedAt:', parentCreatedAt, 'isPrivate:', isPrivate)
if (typeof bookmarks === 'object' && bookmarks !== null && !Array.isArray(bookmarks)) {
const applesauceBookmarks = bookmarks as ApplesauceBookmarks
const allItems: IndividualBookmark[] = []
// Process notes (EventPointer[])
if (applesauceBookmarks.notes) {
console.log('[BOOKMARK_TS] Processing', applesauceBookmarks.notes.length, 'notes with timestamp:', parentCreatedAt || 0)
applesauceBookmarks.notes.forEach((note: EventPointer) => {
allItems.push({
id: note.id,
@@ -91,6 +94,7 @@ export const processApplesauceBookmarks = (
// Process articles (AddressPointer[])
if (applesauceBookmarks.articles) {
console.log('[BOOKMARK_TS] Processing', applesauceBookmarks.articles.length, 'articles with timestamp:', parentCreatedAt || 0)
applesauceBookmarks.articles.forEach((article: AddressPointer) => {
// Convert AddressPointer to coordinate format: kind:pubkey:identifier
const coordinate = `${article.kind}:${article.pubkey}:${article.identifier || ''}`
@@ -129,6 +133,7 @@ export const processApplesauceBookmarks = (
// Process URLs (string[])
if (applesauceBookmarks.urls) {
console.log('[BOOKMARK_TS] Processing', applesauceBookmarks.urls.length, 'URLs with timestamp:', parentCreatedAt || 0)
applesauceBookmarks.urls.forEach((url: string) => {
allItems.push({
id: `url-${url}`,

View File

@@ -121,6 +121,7 @@ export async function collectBookmarksFromEvents(
const decryptJobs: Array<{ evt: NostrEvent; metadata: { dTag?: string; setTitle?: string; setDescription?: string; setImage?: string } }> = []
for (const evt of bookmarkListEvents) {
console.log('[BOOKMARK_TS] Processing bookmark event', evt.id, 'kind:', evt.kind, 'created_at:', evt.created_at)
newestCreatedAt = Math.max(newestCreatedAt, evt.created_at || 0)
if (!latestContent && evt.content && !Helpers.hasHiddenContent(evt)) latestContent = evt.content
if (Array.isArray(evt.tags)) allTags = allTags.concat(evt.tags)