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 2.2.2 to 2.2.3

1

build/cjs/get-block-icon.js
"use strict";
exports.__esModule = true;
exports.getBlockIcon = void 0;
function getBlockIcon(block, recordMap) {

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

5

build/cjs/get-block-parent-page.js
"use strict";
exports.__esModule = true;
exports.getBlockParentPage = void 0;
/**

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

exports.getBlockParentPage = function (block, recordMap) {
var _a;
var _a, _b;
do {

@@ -17,5 +16,5 @@ if (!block)

block = (_a = recordMap.block[block.parent_id]) === null || _a === void 0 ? void 0 : _a.value;
} while ((block === null || block === void 0 ? void 0 : block.type) !== 'page');
} while (((_b = block) === null || _b === void 0 ? void 0 : _b.type) !== 'page');
return block;
};
//# sourceMappingURL=get-block-parent-page.js.map
import { Block, ExtendedRecordMap } from 'notion-types';
export declare function getBlockTitle(block: Block, recordMap: ExtendedRecordMap): string | null;
export declare function getBlockTitle(block: Block, recordMap: ExtendedRecordMap): string;
"use strict";
exports.__esModule = true;
exports.getBlockTitle = void 0;
var get_text_content_1 = require("./get-text-content");

@@ -17,5 +16,5 @@ function getBlockTitle(block, recordMap) {

}
return null;
return '';
}
exports.getBlockTitle = getBlockTitle;
//# sourceMappingURL=get-block-title.js.map
"use strict";
exports.__esModule = true;
exports.getDateValue = void 0;
/**

@@ -5,0 +4,0 @@ * Attempts to find a valid date from a given property.

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

@@ -8,3 +7,3 @@ * Gets the IDs of all blocks contained on a page starting from a root block ID.

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

@@ -33,4 +32,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;

@@ -43,9 +42,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]);

@@ -55,4 +54,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]);

@@ -59,0 +58,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[];
"use strict";
exports.__esModule = true;
exports.getPageTableOfContents = void 0;
var get_text_content_1 = require("./get-text-content");

@@ -5,0 +4,0 @@ var indentLevels = {

"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;
/**

@@ -11,5 +10,5 @@ * Gets the raw, unformatted text content of a block's content value.

exports.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
"use strict";
exports.__esModule = true;
exports.idToUuid = void 0;
exports.idToUuid = function (id) {

@@ -5,0 +4,0 @@ return id.substr(0, 8) + "-" + id.substr(8, 4) + "-" + id.substr(12, 4) + "-" + id.substr(16, 4) + "-" + id.substr(20);

"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);
__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"));
//# sourceMappingURL=index.js.map
"use strict";
exports.__esModule = true;
exports.parsePageId = void 0;
var id_to_uuid_1 = require("./id-to-uuid");

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

var _b = (_a === void 0 ? {} : _a).uuid, uuid = _b === void 0 ? true : _b;
if (!id) {
return null;
}
id = id.split('?')[0];

@@ -17,0 +19,0 @@ var match = id.match(pageIdRe);

@@ -34,3 +34,4 @@ "use strict";

'Twitter-Automation-Tool',
'fde5ac74-eea3-4527-8f00-4482710e1af'
'fde5ac74-eea3-4527-8f00-4482710e1af',
null
];

@@ -37,0 +38,0 @@ ava_1["default"]('utils.parsePageId non-uuid success', function (t) {

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

@@ -8,3 +8,3 @@ /**

export var getBlockParentPage = function (block, recordMap) {
var _a;
var _a, _b;
do {

@@ -14,5 +14,5 @@ if (!block)

block = (_a = recordMap.block[block.parent_id]) === null || _a === void 0 ? void 0 : _a.value;
} while ((block === null || block === void 0 ? void 0 : block.type) !== 'page');
} while (((_b = block) === null || _b === void 0 ? void 0 : _b.type) !== 'page');
return block;
};
//# sourceMappingURL=get-block-parent-page.js.map
import { Block, ExtendedRecordMap } from 'notion-types';
export declare function getBlockTitle(block: Block, recordMap: ExtendedRecordMap): string | null;
export declare function getBlockTitle(block: Block, recordMap: ExtendedRecordMap): string;

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

}
return null;
return '';
}
//# sourceMappingURL=get-block-title.js.map

@@ -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

@@ -12,2 +12,5 @@ import { idToUuid } from './id-to-uuid';

var _b = (_a === void 0 ? {} : _a).uuid, uuid = _b === void 0 ? true : _b;
if (!id) {
return null;
}
id = id.split('?')[0];

@@ -14,0 +17,0 @@ var match = id.match(pageIdRe);

@@ -29,3 +29,4 @@ import test from 'ava';

'Twitter-Automation-Tool',
'fde5ac74-eea3-4527-8f00-4482710e1af'
'fde5ac74-eea3-4527-8f00-4482710e1af',
null
];

@@ -32,0 +33,0 @@ test('utils.parsePageId non-uuid success', function (t) {

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

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

},
"gitHead": "4099715bc8cfebeba960bd77158c66f27e7d533a"
"gitHead": "5f022591c762a285e015b31444a6488b6a3a81c7"
}

@@ -20,3 +20,3 @@ import { Block, ExtendedRecordMap } from 'notion-types'

return null
return ''
}

@@ -31,3 +31,4 @@ import test from 'ava'

'Twitter-Automation-Tool',
'fde5ac74-eea3-4527-8f00-4482710e1af'
'fde5ac74-eea3-4527-8f00-4482710e1af',
null
]

@@ -55,5 +56,5 @@

for (const id of pageIdFixturesFailure) {
const pageId = parsePageId(id)
const pageId = parsePageId(id as string)
t.falsy(pageId)
}
})

@@ -15,2 +15,6 @@ import { idToUuid } from './id-to-uuid'

) => {
if (!id) {
return null
}
id = id.split('?')[0]

@@ -17,0 +21,0 @@ const match = id.match(pageIdRe)

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