notion-utils
Advanced tools
Comparing version 3.2.3 to 3.2.4
@@ -13,5 +13,5 @@ import { ExtendedRecordMap, PageMap } from 'notion-types'; | ||
*/ | ||
export declare function getAllPagesInSpace(rootPageId: string, rootSpaceId: string, getPage: (pageId: string) => Promise<ExtendedRecordMap>, { concurrency, fetchCollections }?: { | ||
export declare function getAllPagesInSpace(rootPageId: string, rootSpaceId: string, getPage: (pageId: string) => Promise<ExtendedRecordMap>, { concurrency, traverseCollections }?: { | ||
concurrency?: number; | ||
fetchCollections?: boolean; | ||
traverseCollections?: boolean; | ||
}): Promise<PageMap>; |
@@ -57,3 +57,3 @@ "use strict"; | ||
function getAllPagesInSpace(rootPageId, rootSpaceId, getPage, _a) { | ||
var _b = _a === void 0 ? {} : _a, _c = _b.concurrency, concurrency = _c === void 0 ? 4 : _c, _d = _b.fetchCollections, fetchCollections = _d === void 0 ? true : _d; | ||
var _b = _a === void 0 ? {} : _a, _c = _b.concurrency, concurrency = _c === void 0 ? 4 : _c, _d = _b.traverseCollections, traverseCollections = _d === void 0 ? true : _d; | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -83,3 +83,4 @@ function processPage(pageId) { | ||
var isPage = block.type === 'page' || block.type === 'collection_view_page'; | ||
// the space id check is important because pages can link to pages in other spaces | ||
// the space id check is important to limit traversal because pages | ||
// can reference pages in other spaces | ||
return isPage && block.space_id === rootSpaceId; | ||
@@ -89,3 +90,3 @@ }) | ||
// traverse collection item pages as they may contain subpages as well | ||
if (fetchCollections) { | ||
if (traverseCollections) { | ||
for (_i = 0, _a = Object.values(page_1.collection_query); _i < _a.length; _i++) { | ||
@@ -92,0 +93,0 @@ collectionViews = _a[_i]; |
@@ -13,5 +13,5 @@ import { ExtendedRecordMap, PageMap } from 'notion-types'; | ||
*/ | ||
export declare function getAllPagesInSpace(rootPageId: string, rootSpaceId: string, getPage: (pageId: string) => Promise<ExtendedRecordMap>, { concurrency, fetchCollections }?: { | ||
export declare function getAllPagesInSpace(rootPageId: string, rootSpaceId: string, getPage: (pageId: string) => Promise<ExtendedRecordMap>, { concurrency, traverseCollections }?: { | ||
concurrency?: number; | ||
fetchCollections?: boolean; | ||
traverseCollections?: boolean; | ||
}): Promise<PageMap>; |
@@ -51,3 +51,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
export function getAllPagesInSpace(rootPageId, rootSpaceId, getPage, _a) { | ||
var _b = _a === void 0 ? {} : _a, _c = _b.concurrency, concurrency = _c === void 0 ? 4 : _c, _d = _b.fetchCollections, fetchCollections = _d === void 0 ? true : _d; | ||
var _b = _a === void 0 ? {} : _a, _c = _b.concurrency, concurrency = _c === void 0 ? 4 : _c, _d = _b.traverseCollections, traverseCollections = _d === void 0 ? true : _d; | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -77,3 +77,4 @@ function processPage(pageId) { | ||
var isPage = block.type === 'page' || block.type === 'collection_view_page'; | ||
// the space id check is important because pages can link to pages in other spaces | ||
// the space id check is important to limit traversal because pages | ||
// can reference pages in other spaces | ||
return isPage && block.space_id === rootSpaceId; | ||
@@ -83,3 +84,3 @@ }) | ||
// traverse collection item pages as they may contain subpages as well | ||
if (fetchCollections) { | ||
if (traverseCollections) { | ||
for (_i = 0, _a = Object.values(page_1.collection_query); _i < _a.length; _i++) { | ||
@@ -86,0 +87,0 @@ collectionViews = _a[_i]; |
{ | ||
"name": "notion-utils", | ||
"version": "3.2.3", | ||
"version": "3.2.4", | ||
"description": "Useful utilities for working with Notion data. Isomorphic.", | ||
@@ -24,3 +24,3 @@ "repository": "NotionX/react-notion-x", | ||
}, | ||
"gitHead": "cf91be94c4fb36ea1ad7037793cf3c4758642ee2" | ||
"gitHead": "889f3a8af2a53a21adadb90b1bc15a78d9e2a910" | ||
} |
@@ -23,6 +23,6 @@ import PQueue from 'p-queue' | ||
concurrency = 4, | ||
fetchCollections = true | ||
traverseCollections = true | ||
}: { | ||
concurrency?: number | ||
fetchCollections?: boolean | ||
traverseCollections?: boolean | ||
} = {} | ||
@@ -52,3 +52,4 @@ ): Promise<PageMap> { | ||
// the space id check is important because pages can link to pages in other spaces | ||
// the space id check is important to limit traversal because pages | ||
// can reference pages in other spaces | ||
return isPage && block.space_id === rootSpaceId | ||
@@ -59,3 +60,3 @@ }) | ||
// traverse collection item pages as they may contain subpages as well | ||
if (fetchCollections) { | ||
if (traverseCollections) { | ||
for (const collectionViews of Object.values( | ||
@@ -62,0 +63,0 @@ page.collection_query |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
676599
8536