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.2.4 to 3.2.6

1

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"));

@@ -45,0 +44,0 @@ var parse_page_id_1 = require("./parse-page-id");

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

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

4

build/cjs/get-block-parent-page.js
"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,9 +8,9 @@ var get_block_title_1 = require("./get-block-title");

*/
var getCanonicalPageId = function (pageId, recordMap, _a) {
var _b;
var _c = _a === void 0 ? {} : _a, _d = _c.uuid, uuid = _d === void 0 ? true : _d;
exports.getCanonicalPageId = function (pageId, recordMap, _a) {
var _b = (_a === void 0 ? {} : _a).uuid, uuid = _b === void 0 ? true : _b;
var _c;
if (!pageId || !recordMap)
return null;
var id = uuid_to_id_1.uuidToId(pageId);
var block = (_b = recordMap.block[pageId]) === null || _b === void 0 ? void 0 : _b.value;
var block = (_c = recordMap.block[pageId]) === null || _c === void 0 ? void 0 : _c.value;
if (block) {

@@ -30,4 +29,3 @@ var title = exports.normalizeTitle(get_block_title_1.getBlockTitle(block, recordMap));

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

@@ -42,3 +40,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,14 @@ * 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;
if (!text) {
return '';
}
else if (Array.isArray(text)) {
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 : '');
}
else {
return text;
}
};
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

@@ -7,8 +7,8 @@ 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;
var _b = (_a === void 0 ? {} : _a).uuid, uuid = _b === void 0 ? true : _b;
var _c;
if (!pageId || !recordMap)
return null;
var id = uuidToId(pageId);
var block = (_b = recordMap.block[pageId]) === null || _b === void 0 ? void 0 : _b.value;
var block = (_c = recordMap.block[pageId]) === null || _c === void 0 ? void 0 : _c.value;
if (block) {

@@ -15,0 +15,0 @@ var title = normalizeTitle(getBlockTitle(block, recordMap));

@@ -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,13 @@ /**

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;
if (!text) {
return '';
}
else if (Array.isArray(text)) {
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 : '');
}
else {
return text;
}
};
//# 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.2.4",
"version": "3.2.6",
"description": "Useful utilities for working with Notion data. Isomorphic.",

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

},
"gitHead": "889f3a8af2a53a21adadb90b1bc15a78d9e2a910"
"gitHead": "4d5a8598a9ac127fa60fd2bd117065314baee4f5"
}

@@ -10,3 +10,9 @@ import * as types from 'notion-types'

export const getTextContent = (text?: types.Decoration[]): string => {
return text?.reduce((prev, current) => prev + current[0], '') ?? ''
if (!text) {
return ''
} else if (Array.isArray(text)) {
return text?.reduce((prev, current) => prev + current[0], '') ?? ''
} else {
return text
}
}

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

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