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
1
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 3.0.1 to 3.1.0

11

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

@@ -42,3 +42,2 @@ "use strict";

exports.__esModule = true;
exports.getAllPagesInSpace = void 0;
var p_queue_1 = __importDefault(require("p-queue"));

@@ -58,3 +57,3 @@ var parse_page_id_1 = require("./parse-page-id");

function getAllPagesInSpace(rootPageId, rootSpaceId, getPage, _a) {
var _b = _a === void 0 ? {} : _a, _c = _b.concurrency, concurrency = _c === void 0 ? 4 : _c;
var _b = (_a === void 0 ? {} : _a).concurrency, concurrency = _b === void 0 ? 4 : _b;
return __awaiter(this, void 0, void 0, function () {

@@ -107,4 +106,4 @@ function processPage(pageId) {

var pages, pendingPageIds, queue;
return __generator(this, function (_d) {
switch (_d.label) {
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -116,6 +115,6 @@ pages = {};

case 1:
_d.sent();
_c.sent();
return [4 /*yield*/, queue.onIdle()];
case 2:
_d.sent();
_c.sent();
return [2 /*return*/, pages];

@@ -122,0 +121,0 @@ }

"use strict";
exports.__esModule = true;
exports.getBlockIcon = void 0;
function getBlockIcon(block, recordMap) {

@@ -5,0 +4,0 @@ var _a, _b, _c;

"use strict";
exports.__esModule = true;
exports.getBlockParentPage = void 0;
/**

@@ -10,3 +9,3 @@ * Returns the parent page block containing a given page.

*/
var getBlockParentPage = function (block, recordMap) {
exports.getBlockParentPage = function (block, recordMap) {
var _a, _b, _c;

@@ -29,3 +28,2 @@ var currentRecord = block;

};
exports.getBlockParentPage = getBlockParentPage;
//# sourceMappingURL=get-block-parent-page.js.map
"use strict";
exports.__esModule = true;
exports.getBlockTitle = void 0;
var get_text_content_1 = require("./get-text-content");

@@ -5,0 +4,0 @@ function getBlockTitle(block, recordMap) {

"use strict";
exports.__esModule = true;
exports.normalizeTitle = exports.getCanonicalPageId = void 0;
var uuid_to_id_1 = require("./uuid-to-id");

@@ -9,3 +8,3 @@ var get_block_title_1 = require("./get-block-title");

*/
var getCanonicalPageId = function (pageId, recordMap) {
exports.getCanonicalPageId = function (pageId, recordMap) {
var _a;

@@ -24,4 +23,3 @@ if (!pageId || !recordMap)

};
exports.getCanonicalPageId = getCanonicalPageId;
var normalizeTitle = function (title) {
exports.normalizeTitle = function (title) {
return (title || '')

@@ -36,3 +34,2 @@ .replace(/ /g, '-')

};
exports.normalizeTitle = normalizeTitle;
//# sourceMappingURL=get-canonical-page-id.js.map
"use strict";
exports.__esModule = true;
exports.getDateValue = void 0;
/**
* Attempts to find a valid date from a given property.
*/
var getDateValue = function (prop) {
exports.getDateValue = function (prop) {
if (prop && Array.isArray(prop)) {

@@ -24,3 +23,2 @@ if (prop[0] === 'd') {

};
exports.getDateValue = getDateValue;
//# sourceMappingURL=get-date-value.js.map
"use strict";
exports.__esModule = true;
exports.getPageContentBlockIds = void 0;
/**
* Gets the IDs of all blocks contained on a page starting from a root block ID.
*/
var getPageContentBlockIds = function (recordMap, blockId) {
var _a, _b, _c;
exports.getPageContentBlockIds = function (recordMap, blockId) {
var _a, _b, _c, _d, _e;
var rootBlockId = blockId || Object.keys(recordMap.block)[0];

@@ -32,4 +31,4 @@ var contentBlockIds = new Set();

addContentBlocks(rootBlockId);
for (var _i = 0, _d = Object.keys(recordMap.block); _i < _d.length; _i++) {
var blockId_2 = _d[_i];
for (var _i = 0, _f = Object.keys(recordMap.block); _i < _f.length; _i++) {
var blockId_2 = _f[_i];
var block = (_a = recordMap.block[blockId_2]) === null || _a === void 0 ? void 0 : _a.value;

@@ -42,9 +41,9 @@ if (!block)

// 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];
for (var _g = 0, _h = Object.keys(properties); _g < _h.length; _g++) {
var key = _h[_g];
var p = properties[key];
p.map(function (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];
if ((value === null || value === void 0 ? void 0 : value[0]) === 'p') {
var _a, _b, _c, _d;
var value = (_c = (_b = (_a = d) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c[0];
if (((_d = value) === null || _d === void 0 ? void 0 : _d[0]) === 'p') {
contentBlockIds.add(value[1]);

@@ -54,4 +53,4 @@ }

// [["‣", [["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];
if ((value === null || value === void 0 ? void 0 : value[0]) === 'p') {
var value = (_d = (_c = (_b = p) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c[1]) === null || _d === void 0 ? void 0 : _d[0];
if (((_e = value) === null || _e === void 0 ? void 0 : _e[0]) === 'p') {
contentBlockIds.add(value[1]);

@@ -64,3 +63,2 @@ }

};
exports.getPageContentBlockIds = getPageContentBlockIds;
//# sourceMappingURL=get-page-content-block-ids.js.map

@@ -12,2 +12,2 @@ import * as types from 'notion-types';

*/
export declare const getPageTableOfContents: (page: types.PageBlock, recordMap: types.ExtendedRecordMap) => Array<TableOfContentsEntry>;
export declare const getPageTableOfContents: (page: types.PageBlock, recordMap: types.ExtendedRecordMap) => TableOfContentsEntry[];
"use strict";
exports.__esModule = true;
exports.getPageTableOfContents = void 0;
var get_text_content_1 = require("./get-text-content");

@@ -14,3 +13,3 @@ var indentLevels = {

*/
var getPageTableOfContents = function (page, recordMap) {
exports.getPageTableOfContents = function (page, recordMap) {
var _a;

@@ -69,3 +68,2 @@ var toc = (_a = page.content) === null || _a === void 0 ? void 0 : _a.map(function (blockId) {

};
exports.getPageTableOfContents = getPageTableOfContents;
//# sourceMappingURL=get-page-table-of-contents.js.map
"use strict";
exports.__esModule = true;
exports.getPageTitle = void 0;
var get_block_title_1 = require("./get-block-title");

@@ -5,0 +4,0 @@ function getPageTitle(recordMap) {

"use strict";
exports.__esModule = true;
exports.getTextContent = void 0;
/**

@@ -10,7 +9,6 @@ * Gets the raw, unformatted text content of a block's content value.

*/
var getTextContent = function (text) {
var _a;
return (_a = text === null || text === void 0 ? void 0 : text.reduce(function (prev, current) { return prev + current[0]; }, '')) !== null && _a !== void 0 ? _a : '';
exports.getTextContent = function (text) {
var _a, _b;
return _b = (_a = text) === null || _a === void 0 ? void 0 : _a.reduce(function (prev, current) { return prev + current[0]; }, ''), (_b !== null && _b !== void 0 ? _b : '');
};
exports.getTextContent = getTextContent;
//# sourceMappingURL=get-text-content.js.map
"use strict";
exports.__esModule = true;
exports.idToUuid = void 0;
var idToUuid = function (id) {
exports.idToUuid = function (id) {
if (id === void 0) { id = ''; }
return id.substr(0, 8) + "-" + id.substr(8, 4) + "-" + id.substr(12, 4) + "-" + id.substr(16, 4) + "-" + id.substr(20);
};
exports.idToUuid = idToUuid;
//# sourceMappingURL=id-to-uuid.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
exports.__esModule = true;
__exportStar(require("./get-text-content"), exports);
__exportStar(require("./get-block-title"), exports);
__exportStar(require("./get-block-icon"), exports);
__exportStar(require("./get-page-title"), exports);
__exportStar(require("./get-date-value"), exports);
__exportStar(require("./get-block-parent-page"), exports);
__exportStar(require("./get-page-table-of-contents"), exports);
__exportStar(require("./get-page-content-block-ids"), exports);
__exportStar(require("./parse-page-id"), exports);
__exportStar(require("./id-to-uuid"), exports);
__exportStar(require("./uuid-to-id"), exports);
__exportStar(require("./get-all-pages-in-space"), exports);
__exportStar(require("./get-canonical-page-id"), exports);
__export(require("./get-text-content"));
__export(require("./get-block-title"));
__export(require("./get-block-icon"));
__export(require("./get-page-title"));
__export(require("./get-date-value"));
__export(require("./get-block-parent-page"));
__export(require("./get-page-table-of-contents"));
__export(require("./get-page-content-block-ids"));
__export(require("./parse-page-id"));
__export(require("./id-to-uuid"));
__export(require("./uuid-to-id"));
__export(require("./get-all-pages-in-space"));
__export(require("./get-canonical-page-id"));
//# sourceMappingURL=index.js.map
"use strict";
exports.__esModule = true;
exports.parsePageId = void 0;
var id_to_uuid_1 = require("./id-to-uuid");

@@ -12,5 +11,5 @@ var pageIdRe = /\b([a-f0-9]{32})\b/;

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

@@ -30,3 +29,2 @@ return null;

};
exports.parsePageId = parsePageId;
//# sourceMappingURL=parse-page-id.js.map
"use strict";
exports.__esModule = true;
exports.uuidToId = void 0;
var uuidToId = function (uuid) { return uuid.replace(/-/g, ''); };
exports.uuidToId = uuidToId;
exports.uuidToId = function (uuid) { return uuid.replace(/-/g, ''); };
//# sourceMappingURL=uuid-to-id.js.map

@@ -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;
var _b = (_a === void 0 ? {} : _a).concurrency, concurrency = _b === void 0 ? 4 : _b;
return __awaiter(this, void 0, void 0, function () {

@@ -100,4 +100,4 @@ function processPage(pageId) {

var pages, pendingPageIds, queue;
return __generator(this, function (_d) {
switch (_d.label) {
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -109,6 +109,6 @@ pages = {};

case 1:
_d.sent();
_c.sent();
return [4 /*yield*/, queue.onIdle()];
case 2:
_d.sent();
_c.sent();
return [2 /*return*/, pages];

@@ -115,0 +115,0 @@ }

@@ -5,3 +5,3 @@ /**

export var getPageContentBlockIds = function (recordMap, blockId) {
var _a, _b, _c;
var _a, _b, _c, _d, _e;
var rootBlockId = blockId || Object.keys(recordMap.block)[0];

@@ -30,4 +30,4 @@ var contentBlockIds = new Set();

addContentBlocks(rootBlockId);
for (var _i = 0, _d = Object.keys(recordMap.block); _i < _d.length; _i++) {
var blockId_2 = _d[_i];
for (var _i = 0, _f = Object.keys(recordMap.block); _i < _f.length; _i++) {
var blockId_2 = _f[_i];
var block = (_a = recordMap.block[blockId_2]) === null || _a === void 0 ? void 0 : _a.value;

@@ -40,9 +40,9 @@ if (!block)

// 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];
for (var _g = 0, _h = Object.keys(properties); _g < _h.length; _g++) {
var key = _h[_g];
var p = properties[key];
p.map(function (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];
if ((value === null || value === void 0 ? void 0 : value[0]) === 'p') {
var _a, _b, _c, _d;
var value = (_c = (_b = (_a = d) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c[0];
if (((_d = value) === null || _d === void 0 ? void 0 : _d[0]) === 'p') {
contentBlockIds.add(value[1]);

@@ -52,4 +52,4 @@ }

// [["‣", [["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];
if ((value === null || value === void 0 ? void 0 : value[0]) === 'p') {
var value = (_d = (_c = (_b = p) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c[1]) === null || _d === void 0 ? void 0 : _d[0];
if (((_e = value) === null || _e === void 0 ? void 0 : _e[0]) === 'p') {
contentBlockIds.add(value[1]);

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

@@ -12,2 +12,2 @@ import * as types from 'notion-types';

*/
export declare const getPageTableOfContents: (page: types.PageBlock, recordMap: types.ExtendedRecordMap) => Array<TableOfContentsEntry>;
export declare const getPageTableOfContents: (page: types.PageBlock, recordMap: types.ExtendedRecordMap) => TableOfContentsEntry[];

@@ -8,5 +8,5 @@ /**

export var getTextContent = function (text) {
var _a;
return (_a = text === null || text === void 0 ? void 0 : text.reduce(function (prev, current) { return prev + current[0]; }, '')) !== null && _a !== void 0 ? _a : '';
var _a, _b;
return _b = (_a = text) === null || _a === void 0 ? void 0 : _a.reduce(function (prev, current) { return prev + current[0]; }, ''), (_b !== null && _b !== void 0 ? _b : '');
};
//# sourceMappingURL=get-text-content.js.map

@@ -11,3 +11,3 @@ import { idToUuid } from './id-to-uuid';

if (id === void 0) { id = ''; }
var _b = _a === void 0 ? {} : _a, _c = _b.uuid, uuid = _c === void 0 ? true : _c;
var _b = (_a === void 0 ? {} : _a).uuid, uuid = _b === void 0 ? true : _b;
if (!id) {

@@ -14,0 +14,0 @@ return null;

{
"name": "notion-utils",
"version": "3.0.1",
"version": "3.1.0",
"description": "Useful utilities for working with Notion data. Isomorphic.",

@@ -18,3 +18,3 @@ "repository": "NotionX/react-notion-x",

"dependencies": {
"notion-types": "^3.0.0",
"notion-types": "^3.1.0",
"p-queue": "^6.6.1"

@@ -25,3 +25,3 @@ },

},
"gitHead": "f9d03e2025df65fcb95ccd2e74da47cb7dcf8293"
"gitHead": "edf7acc009e8683b0a64a9d9dd0885c9c1e489d2"
}

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

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