New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

notion-utils

Package Overview
Dependencies
Maintainers
2
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

notion-utils - npm Package Compare versions

Comparing version 5.0.1 to 6.0.0

.snapshots/src/parse-page-id.test.ts.md

186

build/esm/get-all-pages-in-space.js

@@ -10,29 +10,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
import PQueue from 'p-queue';

@@ -55,104 +28,75 @@ import { parsePageId } from './parse-page-id';

*/
export function getAllPagesInSpace(rootPageId, rootSpaceId, getPage, _a) {
var _b = _a === void 0 ? {} : _a, _c = _b.concurrency, concurrency = _c === void 0 ? 4 : _c, _d = _b.traverseCollections, traverseCollections = _d === void 0 ? true : _d, _e = _b.targetPageId, targetPageId = _e === void 0 ? null : _e;
return __awaiter(this, void 0, void 0, function () {
export function getAllPagesInSpace(rootPageId, rootSpaceId, getPage, { concurrency = 4, traverseCollections = true, targetPageId = null } = {}) {
return __awaiter(this, void 0, void 0, function* () {
const pages = {};
const pendingPageIds = new Set();
const queue = new PQueue({ concurrency });
function processPage(pageId) {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
if (targetPageId && pendingPageIds.has(targetPageId)) {
return [2 /*return*/];
}
pageId = parsePageId(pageId);
if (pageId && !pages[pageId] && !pendingPageIds.has(pageId)) {
pendingPageIds.add(pageId);
queue.add(function () { return __awaiter(_this, void 0, void 0, function () {
var page_1, spaceId, _i, _a, collectionViews, _b, _c, collectionData, blockIds, _d, blockIds_1, collectionItemId, err_1;
var _e, _f;
return __generator(this, function (_g) {
switch (_g.label) {
case 0:
_g.trys.push([0, 2, , 3]);
if (targetPageId &&
pendingPageIds.has(targetPageId) &&
pageId !== targetPageId) {
return [2 /*return*/];
}
return [4 /*yield*/, getPage(pageId)];
case 1:
page_1 = _g.sent();
if (!page_1) {
return [2 /*return*/];
}
spaceId = (_f = (_e = page_1.block[pageId]) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.space_id;
if (!rootSpaceId) {
rootSpaceId = spaceId;
}
else if (rootSpaceId !== spaceId) {
return [2 /*return*/];
}
Object.keys(page_1.block)
.filter(function (key) {
var _a;
var block = (_a = page_1.block[key]) === null || _a === void 0 ? void 0 : _a.value;
if (!block)
return false;
var isPage = block.type === 'page' || block.type === 'collection_view_page';
// the space id check is important to limit traversal because pages
// can reference pages in other spaces
return isPage && block.space_id === rootSpaceId;
})
.forEach(function (subPageId) { return processPage(subPageId); });
// traverse collection item pages as they may contain subpages as well
if (traverseCollections) {
for (_i = 0, _a = Object.values(page_1.collection_query); _i < _a.length; _i++) {
collectionViews = _a[_i];
for (_b = 0, _c = Object.values(collectionViews); _b < _c.length; _b++) {
collectionData = _c[_b];
blockIds = collectionData.blockIds;
if (blockIds) {
for (_d = 0, blockIds_1 = blockIds; _d < blockIds_1.length; _d++) {
collectionItemId = blockIds_1[_d];
processPage(collectionItemId);
}
}
}
return __awaiter(this, void 0, void 0, function* () {
if (targetPageId && pendingPageIds.has(targetPageId)) {
return;
}
pageId = parsePageId(pageId);
if (pageId && !pages[pageId] && !pendingPageIds.has(pageId)) {
pendingPageIds.add(pageId);
queue.add(() => __awaiter(this, void 0, void 0, function* () {
var _a, _b;
try {
if (targetPageId &&
pendingPageIds.has(targetPageId) &&
pageId !== targetPageId) {
return;
}
const page = yield getPage(pageId);
if (!page) {
return;
}
const spaceId = (_b = (_a = page.block[pageId]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.space_id;
if (!rootSpaceId) {
rootSpaceId = spaceId;
}
else if (rootSpaceId !== spaceId) {
return;
}
Object.keys(page.block)
.filter((key) => {
var _a;
const block = (_a = page.block[key]) === null || _a === void 0 ? void 0 : _a.value;
if (!block)
return false;
const isPage = block.type === 'page' || block.type === 'collection_view_page';
// the space id check is important to limit traversal because pages
// can reference pages in other spaces
return isPage && block.space_id === rootSpaceId;
})
.forEach((subPageId) => processPage(subPageId));
// traverse collection item pages as they may contain subpages as well
if (traverseCollections) {
for (const collectionViews of Object.values(page.collection_query)) {
for (const collectionData of Object.values(collectionViews)) {
const { blockIds } = collectionData;
if (blockIds) {
for (const collectionItemId of blockIds) {
processPage(collectionItemId);
}
}
pages[pageId] = page_1;
return [3 /*break*/, 3];
case 2:
err_1 = _g.sent();
console.warn('page load error', { pageId: pageId, spaceId: rootSpaceId }, err_1.statusCode, err_1.message);
pages[pageId] = null;
return [3 /*break*/, 3];
case 3:
pendingPageIds["delete"](pageId);
return [2 /*return*/];
}
}
});
}); });
}
return [2 /*return*/];
});
}
pages[pageId] = page;
}
catch (err) {
console.warn('page load error', { pageId, spaceId: rootSpaceId }, err.statusCode, err.message);
pages[pageId] = null;
}
pendingPageIds.delete(pageId);
}));
}
});
}
var pages, pendingPageIds, queue;
return __generator(this, function (_f) {
switch (_f.label) {
case 0:
pages = {};
pendingPageIds = new Set();
queue = new PQueue({ concurrency: concurrency });
return [4 /*yield*/, processPage(rootPageId)];
case 1:
_f.sent();
return [4 /*yield*/, queue.onIdle()];
case 2:
_f.sent();
return [2 /*return*/, pages];
}
});
yield processPage(rootPageId);
yield queue.onIdle();
return pages;
});
}
//# sourceMappingURL=get-all-pages-in-space.js.map

@@ -8,3 +8,3 @@ export function getBlockIcon(block, recordMap) {

block.type === 'collection_view') {
var collection = (_c = recordMap.collection[block.collection_id]) === null || _c === void 0 ? void 0 : _c.value;
const collection = (_c = recordMap.collection[block.collection_id]) === null || _c === void 0 ? void 0 : _c.value;
if (collection) {

@@ -11,0 +11,0 @@ return collection.icon;

@@ -7,8 +7,8 @@ /**

*/
export var getBlockParentPage = function (block, recordMap) {
export const getBlockParentPage = (block, recordMap) => {
var _a, _b;
var currentRecord = block;
let currentRecord = block;
while (currentRecord != null) {
var parentId = currentRecord.parent_id;
var parentTable = currentRecord.parent_table;
const parentId = currentRecord.parent_id;
const parentTable = currentRecord.parent_table;
if (parentTable === 'collection') {

@@ -15,0 +15,0 @@ currentRecord = (_a = recordMap.collection[parentId]) === null || _a === void 0 ? void 0 : _a.value;

@@ -9,3 +9,3 @@ import { getTextContent } from './get-text-content';

block.type === 'collection_view') {
var collection = (_b = recordMap.collection[block.collection_id]) === null || _b === void 0 ? void 0 : _b.value;
const collection = (_b = recordMap.collection[block.collection_id]) === null || _b === void 0 ? void 0 : _b.value;
if (collection) {

@@ -12,0 +12,0 @@ return getTextContent(collection.name);

@@ -6,14 +6,13 @@ import { uuidToId } from './uuid-to-id';

*/
export var getCanonicalPageId = function (pageId, recordMap, _a) {
var _b;
var _c = _a === void 0 ? {} : _a, _d = _c.uuid, uuid = _d === void 0 ? true : _d;
export const getCanonicalPageId = (pageId, recordMap, { uuid = true } = {}) => {
var _a;
if (!pageId || !recordMap)
return null;
var id = uuidToId(pageId);
var block = (_b = recordMap.block[pageId]) === null || _b === void 0 ? void 0 : _b.value;
const id = uuidToId(pageId);
const block = (_a = recordMap.block[pageId]) === null || _a === void 0 ? void 0 : _a.value;
if (block) {
var title = normalizeTitle(getBlockTitle(block, recordMap));
const title = normalizeTitle(getBlockTitle(block, recordMap));
if (title) {
if (uuid) {
return "".concat(title, "-").concat(id);
return `${title}-${id}`;
}

@@ -27,3 +26,3 @@ else {

};
export var normalizeTitle = function (title) {
export const normalizeTitle = (title) => {
return (title || '')

@@ -30,0 +29,0 @@ .replace(/ /g, '-')

/**
* Attempts to find a valid date from a given property.
*/
export var getDateValue = function (prop) {
export const getDateValue = (prop) => {
if (prop && Array.isArray(prop)) {

@@ -10,5 +10,4 @@ if (prop[0] === 'd') {

else {
for (var _i = 0, prop_1 = prop; _i < prop_1.length; _i++) {
var v = prop_1[_i];
var value = getDateValue(v);
for (const v of prop) {
const value = getDateValue(v);
if (value) {

@@ -15,0 +14,0 @@ return value;

import { getBlockTitle } from './get-block-title';
import { getBlockIcon } from './get-block-icon';
import { getBlockParentPage } from './get-block-parent-page';
export var getPageBreadcrumbs = function (recordMap, activePageId) {
export const getPageBreadcrumbs = (recordMap, activePageId) => {
var _a;
var blockMap = recordMap.block;
var breadcrumbs = [];
var currentPageId = activePageId;
const blockMap = recordMap.block;
const breadcrumbs = [];
let currentPageId = activePageId;
do {
var block = (_a = blockMap[currentPageId]) === null || _a === void 0 ? void 0 : _a.value;
const block = (_a = blockMap[currentPageId]) === null || _a === void 0 ? void 0 : _a.value;
if (!block) {
break;
}
var title = getBlockTitle(block, recordMap);
var icon = getBlockIcon(block, recordMap);
const title = getBlockTitle(block, recordMap);
const icon = getBlockIcon(block, recordMap);
if (!(title || icon)) {

@@ -20,10 +20,10 @@ break;

breadcrumbs.push({
block: block,
block,
active: currentPageId === activePageId,
pageId: currentPageId,
title: title,
icon: icon
title,
icon
});
var parentBlock = getBlockParentPage(block, recordMap);
var parentId = parentBlock === null || parentBlock === void 0 ? void 0 : parentBlock.id;
const parentBlock = getBlockParentPage(block, recordMap);
const parentId = parentBlock === null || parentBlock === void 0 ? void 0 : parentBlock.id;
if (!parentId) {

@@ -30,0 +30,0 @@ break;

/**
* Gets the IDs of all blocks contained on a page starting from a root block ID.
*/
export var getPageContentBlockIds = function (recordMap, blockId) {
export const getPageContentBlockIds = (recordMap, blockId) => {
var _a, _b, _c;
var rootBlockId = blockId || Object.keys(recordMap.block)[0];
var contentBlockIds = new Set();
const rootBlockId = blockId || Object.keys(recordMap.block)[0];
const contentBlockIds = new Set();
function addContentBlocks(blockId) {

@@ -13,6 +13,6 @@ var _a;

contentBlockIds.add(blockId);
var block = (_a = recordMap.block[blockId]) === null || _a === void 0 ? void 0 : _a.value;
const block = (_a = recordMap.block[blockId]) === null || _a === void 0 ? void 0 : _a.value;
if (!block)
return;
var content = block.content, type = block.type;
const { content, type } = block;
if (!content)

@@ -24,23 +24,20 @@ return;

}
for (var _i = 0, content_1 = content; _i < content_1.length; _i++) {
var blockId_1 = content_1[_i];
addContentBlocks(blockId_1);
for (const blockId of content) {
addContentBlocks(blockId);
}
}
addContentBlocks(rootBlockId);
for (var _i = 0, _d = Object.keys(recordMap.block); _i < _d.length; _i++) {
var blockId_2 = _d[_i];
var block = (_a = recordMap.block[blockId_2]) === null || _a === void 0 ? void 0 : _a.value;
for (const blockId of Object.keys(recordMap.block)) {
const block = (_a = recordMap.block[blockId]) === null || _a === void 0 ? void 0 : _a.value;
if (!block)
continue;
var properties = block.properties;
const { properties } = block;
if (properties) {
// TODO: this needs some love, especially for resolving relation properties
// see this collection_view_page for an example: 8a586d253f984b85b48254da84465d23
for (var _e = 0, _f = Object.keys(properties); _e < _f.length; _e++) {
var key = _f[_e];
var p = properties[key];
p.map(function (d) {
for (const key of Object.keys(properties)) {
const p = properties[key];
p.map((d) => {
var _a, _b;
var value = (_b = (_a = d === null || d === void 0 ? void 0 : d[0]) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b[0];
const value = (_b = (_a = d === null || d === void 0 ? void 0 : d[0]) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b[0];
if ((value === null || value === void 0 ? void 0 : value[0]) === 'p' && value[1]) {

@@ -51,3 +48,3 @@ contentBlockIds.add(value[1]);

// [["‣", [["p", "841918aa-f2a3-4d4c-b5ad-64b0f57c47b8"]]]]
var value = (_c = (_b = p === null || p === void 0 ? void 0 : p[0]) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c[0];
const value = (_c = (_b = p === null || p === void 0 ? void 0 : p[0]) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c[0];
if ((value === null || value === void 0 ? void 0 : value[0]) === 'p' && value[1]) {

@@ -54,0 +51,0 @@ contentBlockIds.add(value[1]);

@@ -10,10 +10,10 @@ import { getTextContent } from './get-text-content';

}
var collection = (_a = recordMap.collection[block.parent_id]) === null || _a === void 0 ? void 0 : _a.value;
const collection = (_a = recordMap.collection[block.parent_id]) === null || _a === void 0 ? void 0 : _a.value;
if (collection) {
var propertyId = Object.keys(collection.schema).find(function (key) { var _a; return ((_a = collection.schema[key]) === null || _a === void 0 ? void 0 : _a.name) === propertyName; });
const propertyId = Object.keys(collection.schema).find((key) => { var _a; return ((_a = collection.schema[key]) === null || _a === void 0 ? void 0 : _a.name) === propertyName; });
if (!propertyId) {
return null;
}
var type = collection.schema[propertyId].type;
var content = getTextContent(block.properties[propertyId]);
const { type } = collection.schema[propertyId];
const content = getTextContent(block.properties[propertyId]);
switch (type) {

@@ -25,6 +25,6 @@ case 'created_time':

case 'date': {
var property = block.properties[propertyId];
var formatDate = property[0][1][0][1];
const property = block.properties[propertyId];
const formatDate = property[0][1][0][1];
if (formatDate.type == 'datetime') {
return new Date("".concat(formatDate.start_date, " ").concat(formatDate.start_time)).getTime();
return new Date(`${formatDate.start_date} ${formatDate.start_time}`).getTime();
}

@@ -35,10 +35,10 @@ else if (formatDate.type == 'date') {

else if (formatDate.type == 'datetimerange') {
var start_date = formatDate.start_date, start_time = formatDate.start_time, end_date = formatDate.end_date, end_time = formatDate.end_time;
var startTime = new Date("".concat(start_date, " ").concat(start_time)).getTime();
var endTime = new Date("".concat(end_date, " ").concat(end_time)).getTime();
const { start_date, start_time, end_date, end_time } = formatDate;
const startTime = new Date(`${start_date} ${start_time}`).getTime();
const endTime = new Date(`${end_date} ${end_time}`).getTime();
return [startTime, endTime];
}
else {
var startTime = new Date(formatDate.start_date).getTime();
var endTime = new Date(formatDate.end_date).getTime();
const startTime = new Date(formatDate.start_date).getTime();
const endTime = new Date(formatDate.end_date).getTime();
return [startTime, endTime];

@@ -45,0 +45,0 @@ }

import { getTextContent } from './get-text-content';
var indentLevels = {
const indentLevels = {
header: 0,

@@ -11,10 +11,10 @@ sub_header: 1,

*/
export var getPageTableOfContents = function (page, recordMap) {
export const getPageTableOfContents = (page, recordMap) => {
var _a;
var toc = ((_a = page.content) !== null && _a !== void 0 ? _a : [])
.map(function (blockId) {
const toc = ((_a = page.content) !== null && _a !== void 0 ? _a : [])
.map((blockId) => {
var _a, _b;
var block = (_a = recordMap.block[blockId]) === null || _a === void 0 ? void 0 : _a.value;
const block = (_a = recordMap.block[blockId]) === null || _a === void 0 ? void 0 : _a.value;
if (block) {
var type = block.type;
const { type } = block;
if (type === 'header' ||

@@ -25,3 +25,3 @@ type === 'sub_header' ||

id: blockId,
type: type,
type,
text: getTextContent((_b = block.properties) === null || _b === void 0 ? void 0 : _b.title),

@@ -35,3 +35,3 @@ indentLevel: indentLevels[type]

.filter(Boolean);
var indentLevelStack = [
const indentLevelStack = [
{

@@ -45,13 +45,12 @@ actual: -1,

// they should never jump more than one at a time.
for (var _i = 0, toc_1 = toc; _i < toc_1.length; _i++) {
var tocItem = toc_1[_i];
var indentLevel = tocItem.indentLevel;
var actual = indentLevel;
for (const tocItem of toc) {
const { indentLevel } = tocItem;
const actual = indentLevel;
do {
var prevIndent = indentLevelStack[indentLevelStack.length - 1];
var prevActual = prevIndent.actual, prevEffective = prevIndent.effective;
const prevIndent = indentLevelStack[indentLevelStack.length - 1];
const { actual: prevActual, effective: prevEffective } = prevIndent;
if (actual > prevActual) {
tocItem.indentLevel = prevEffective + 1;
indentLevelStack.push({
actual: actual,
actual,
effective: tocItem.indentLevel

@@ -58,0 +57,0 @@ });

import { getBlockTitle } from './get-block-title';
export function getPageTitle(recordMap) {
var _a;
var pageBlock = (_a = recordMap.block[Object.keys(recordMap.block)[0]]) === null || _a === void 0 ? void 0 : _a.value;
const pageBlock = (_a = recordMap.block[Object.keys(recordMap.block)[0]]) === null || _a === void 0 ? void 0 : _a.value;
if (pageBlock) {

@@ -6,0 +6,0 @@ return getBlockTitle(pageBlock, recordMap);

@@ -7,3 +7,3 @@ /**

*/
export var getTextContent = function (text) {
export const getTextContent = (text) => {
var _a;

@@ -14,5 +14,3 @@ if (!text) {

else if (Array.isArray(text)) {
return ((_a = text === null || text === void 0 ? void 0 : text.reduce(function (prev, current) {
return prev + (current[0] !== '⁍' && current[0] !== '‣' ? current[0] : '');
}, '')) !== null && _a !== void 0 ? _a : '');
return ((_a = text === null || text === void 0 ? void 0 : text.reduce((prev, current) => prev + (current[0] !== '⁍' && current[0] !== '‣' ? current[0] : ''), '')) !== null && _a !== void 0 ? _a : '');
}

@@ -19,0 +17,0 @@ else {

@@ -1,5 +0,2 @@

export var idToUuid = function (id) {
if (id === void 0) { id = ''; }
return "".concat(id.substr(0, 8), "-").concat(id.substr(8, 4), "-").concat(id.substr(12, 4), "-").concat(id.substr(16, 4), "-").concat(id.substr(20));
};
export const idToUuid = (id = '') => `${id.substr(0, 8)}-${id.substr(8, 4)}-${id.substr(12, 4)}-${id.substr(16, 4)}-${id.substr(20)}`;
//# sourceMappingURL=id-to-uuid.js.map
import { idToUuid } from './id-to-uuid';
var pageIdRe = /\b([a-f0-9]{32})\b/;
var pageId2Re = /\b([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})\b/;
const pageIdRe = /\b([a-f0-9]{32})\b/;
const pageId2Re = /\b([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})\b/;
/**

@@ -9,5 +9,3 @@ * Robustly extracts the notion page ID from a notion URL or pathname suffix.

*/
export var parsePageId = function (id, _a) {
if (id === void 0) { id = ''; }
var _b = _a === void 0 ? {} : _a, _c = _b.uuid, uuid = _c === void 0 ? true : _c;
export const parsePageId = (id = '', { uuid = true } = {}) => {
if (!id) {

@@ -17,7 +15,7 @@ return null;

id = id.split('?')[0];
var match = id.match(pageIdRe);
const match = id.match(pageIdRe);
if (match) {
return uuid ? idToUuid(match[1]) : match[1];
}
var match2 = id.match(pageId2Re);
const match2 = id.match(pageId2Re);
if (match2) {

@@ -24,0 +22,0 @@ return uuid ? match2[1] : match2[1].replace(/-/g, '');

import test from 'ava';
import { parsePageId } from './parse-page-id';
var pageIdFixturesSuccess = [
const pageIdFixturesSuccess = [
'267c0d1f1df8457f9b5c8f7efca16d83',

@@ -20,3 +20,3 @@ 'Twitter-Automation-Tool-267c0d1f1df8457f9b5c8f7efca16d83',

];
var pageIdFixturesFailure = [
const pageIdFixturesFailure = [
'717A3608b1874CC5bafb5b9680b53395',

@@ -33,6 +33,5 @@ '717A36',

];
test('utils.parsePageId non-uuid success', function (t) {
for (var _i = 0, pageIdFixturesSuccess_1 = pageIdFixturesSuccess; _i < pageIdFixturesSuccess_1.length; _i++) {
var id = pageIdFixturesSuccess_1[_i];
var pageId = parsePageId(id, { uuid: false });
test('utils.parsePageId non-uuid success', (t) => {
for (const id of pageIdFixturesSuccess) {
const pageId = parsePageId(id, { uuid: false });
t.truthy(pageId);

@@ -43,6 +42,5 @@ t.falsy(pageId.includes('-'));

});
test('utils.parsePageId uuid success', function (t) {
for (var _i = 0, pageIdFixturesSuccess_2 = pageIdFixturesSuccess; _i < pageIdFixturesSuccess_2.length; _i++) {
var id = pageIdFixturesSuccess_2[_i];
var pageId = parsePageId(id, { uuid: true });
test('utils.parsePageId uuid success', (t) => {
for (const id of pageIdFixturesSuccess) {
const pageId = parsePageId(id, { uuid: true });
t.truthy(pageId);

@@ -53,6 +51,5 @@ t.truthy(pageId.includes('-'));

});
test('utils.parsePageId failure', function (t) {
for (var _i = 0, pageIdFixturesFailure_1 = pageIdFixturesFailure; _i < pageIdFixturesFailure_1.length; _i++) {
var id = pageIdFixturesFailure_1[_i];
var pageId = parsePageId(id);
test('utils.parsePageId failure', (t) => {
for (const id of pageIdFixturesFailure) {
const pageId = parsePageId(id);
t.falsy(pageId);

@@ -59,0 +56,0 @@ }

@@ -1,2 +0,2 @@

export var uuidToId = function (uuid) { return uuid.replace(/-/g, ''); };
export const uuidToId = (uuid) => uuid.replace(/-/g, '');
//# sourceMappingURL=uuid-to-id.js.map
{
"name": "notion-utils",
"version": "5.0.1",
"version": "6.0.0",
"type": "module",

@@ -9,6 +9,11 @@ "description": "Useful utilities for working with Notion data. Isomorphic.",

"license": "MIT",
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"typings": "build/esm/index.d.ts",
"module": "./build/esm/index.js",
"typings": "./build/esm/index.d.ts",
"sideEffects": false,
"exports": {
".": {
"types": "./build/esm/index.d.ts",
"default": "./build/esm/index.js"
}
},
"engines": {

@@ -18,12 +23,20 @@ "node": ">=12"

"scripts": {
"test": "ava -v 'build/cjs/**/*.test.js'"
"test": "ava"
},
"dependencies": {
"notion-types": "^5.0.1",
"p-queue": "6"
"notion-types": "^6.0.0",
"p-queue": "^7.2.0"
},
"devDependencies": {
"ava": "^3.15.0"
"ava": {
"snapshotDir": ".snapshots",
"extensions": {
"ts": "module"
},
"nodeArguments": [
"--loader=ts-node/esm",
"--no-warnings",
"--experimental-specifier-resolution=node"
]
},
"gitHead": "dcc4442f367a4f17f39a1ffd4c73f87c3adb63fc"
"gitHead": "2be75d4aa3848f7d84abd88eccd3314b44f7e68a"
}

@@ -7,3 +7,2 @@ {

"outDir": "build/esm",
"tsBuildInfoFile": "build/esm/index.tsbuildinfo",
"paths": {

@@ -10,0 +9,0 @@ "notion-types": ["../notion-types"]

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

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

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc