tfrere HF Staff commited on
Commit
d9fd132
·
1 Parent(s): db4f7ee

debug: add logging to publish extraction pipeline

Browse files
Files changed (1) hide show
  1. backend/src/publisher/index.ts +14 -1
backend/src/publisher/index.ts CHANGED
@@ -60,12 +60,25 @@ function extractFromYDoc(ydoc: Y.Doc): {
60
  frontmatter[key] = value;
61
  });
62
 
63
- // Convert Y.XmlFragment ProseMirror JSON using TipTap extensions
 
 
 
 
 
 
 
 
 
 
64
  const extensions = getServerExtensions();
65
  const json = TiptapTransformer
66
  .extensions(extensions)
67
  .fromYdoc(ydoc, "default");
68
 
 
 
 
69
  if (json && typeof json === "object" && json.type === "doc") {
70
  return { json, frontmatter };
71
  }
 
60
  frontmatter[key] = value;
61
  });
62
 
63
+ // Debug: list all shared types in the Y.Doc
64
+ const sharedTypes: string[] = [];
65
+ ydoc.share.forEach((_value, key) => sharedTypes.push(key));
66
+ console.log("[publish] Y.Doc shared types:", sharedTypes);
67
+ console.log("[publish] frontmatter:", JSON.stringify(frontmatter));
68
+
69
+ // Check the XmlFragment directly
70
+ const fragment = ydoc.getXmlFragment("default");
71
+ console.log("[publish] XmlFragment 'default' length:", fragment.length);
72
+
73
+ // Convert Y.XmlFragment -> ProseMirror JSON using TipTap extensions
74
  const extensions = getServerExtensions();
75
  const json = TiptapTransformer
76
  .extensions(extensions)
77
  .fromYdoc(ydoc, "default");
78
 
79
+ console.log("[publish] TiptapTransformer result type:", json?.type);
80
+ console.log("[publish] TiptapTransformer content count:", Array.isArray((json as any)?.content) ? (json as any).content.length : "N/A");
81
+
82
  if (json && typeof json === "object" && json.type === "doc") {
83
  return { json, frontmatter };
84
  }