MCPcopy Create free account
hub / github.com/code100x/daily-code / walk

Function walk

apps/web/lib/notion.ts:25–36  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

23 if (!rootId) return [];
24
25 const seen = new Set<string>();
26 const walk = (id: string) => {
27 if (seen.has(id)) return;
28 seen.add(id);
29 const value = blocks[id]?.value;
30 if (!value) return;
31 if (id !== rootId && (value.type === "page" || value.type === "collection_view_page")) return;
32 if (Array.isArray(value.content)) {
33 for (const childId of value.content) walk(childId);
34 }
35 const refId = value.format?.transclusion_reference_pointer?.id;
36 if (refId) walk(refId);
37 };
38 walk(rootId);
39 return Array.from(seen);

Callers 1

collectContentBlockIdsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected