@texonom/nutils 1.6.5 → 1.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +110 -74
- package/build/index.js.map +1 -1
- package/build/is-editable-block.d.ts +28 -0
- package/build/is-editable-block.d.ts.map +1 -1
- package/package.json +2 -2
package/build/index.js
CHANGED
|
@@ -266,7 +266,7 @@ function te(e) {
|
|
|
266
266
|
}
|
|
267
267
|
//#endregion
|
|
268
268
|
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
269
|
-
function
|
|
269
|
+
function ne(e, t, n) {
|
|
270
270
|
return (t = te(t)) in e ? Object.defineProperty(e, t, {
|
|
271
271
|
value: n,
|
|
272
272
|
enumerable: !0,
|
|
@@ -276,7 +276,7 @@ function S(e, t, n) {
|
|
|
276
276
|
}
|
|
277
277
|
//#endregion
|
|
278
278
|
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/objectSpread2.js
|
|
279
|
-
function
|
|
279
|
+
function S(e, t) {
|
|
280
280
|
var n = Object.keys(e);
|
|
281
281
|
if (Object.getOwnPropertySymbols) {
|
|
282
282
|
var r = Object.getOwnPropertySymbols(e);
|
|
@@ -286,12 +286,12 @@ function C(e, t) {
|
|
|
286
286
|
}
|
|
287
287
|
return n;
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function C(e) {
|
|
290
290
|
for (var t = 1; t < arguments.length; t++) {
|
|
291
291
|
var n = arguments[t] == null ? {} : arguments[t];
|
|
292
|
-
t % 2 ?
|
|
293
|
-
|
|
294
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) :
|
|
292
|
+
t % 2 ? S(Object(n), !0).forEach(function(t) {
|
|
293
|
+
ne(e, t, n[t]);
|
|
294
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : S(Object(n)).forEach(function(t) {
|
|
295
295
|
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
296
296
|
});
|
|
297
297
|
}
|
|
@@ -299,7 +299,7 @@ function w(e) {
|
|
|
299
299
|
}
|
|
300
300
|
//#endregion
|
|
301
301
|
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/asyncToGenerator.js
|
|
302
|
-
function
|
|
302
|
+
function w(e, t, n, r, i, a, o) {
|
|
303
303
|
try {
|
|
304
304
|
var s = e[a](o), c = s.value;
|
|
305
305
|
} catch (e) {
|
|
@@ -308,16 +308,16 @@ function T(e, t, n, r, i, a, o) {
|
|
|
308
308
|
}
|
|
309
309
|
s.done ? t(c) : Promise.resolve(c).then(r, i);
|
|
310
310
|
}
|
|
311
|
-
function
|
|
311
|
+
function T(e) {
|
|
312
312
|
return function() {
|
|
313
313
|
var t = this, n = arguments;
|
|
314
314
|
return new Promise(function(r, i) {
|
|
315
315
|
var a = e.apply(t, n);
|
|
316
316
|
function o(e) {
|
|
317
|
-
|
|
317
|
+
w(a, r, i, o, s, "next", e);
|
|
318
318
|
}
|
|
319
319
|
function s(e) {
|
|
320
|
-
|
|
320
|
+
w(a, r, i, o, s, "throw", e);
|
|
321
321
|
}
|
|
322
322
|
o(void 0);
|
|
323
323
|
});
|
|
@@ -325,11 +325,11 @@ function E(e) {
|
|
|
325
325
|
}
|
|
326
326
|
//#endregion
|
|
327
327
|
//#region src/get-all-in-space.ts
|
|
328
|
-
function
|
|
329
|
-
return
|
|
328
|
+
function re(e, t, n, r) {
|
|
329
|
+
return E.apply(this, arguments);
|
|
330
330
|
}
|
|
331
|
-
function
|
|
332
|
-
return
|
|
331
|
+
function E() {
|
|
332
|
+
return E = T(function* (e, t, n, r, { startRecordMap: a, fetchOption: o = { timeout: 1e5 }, maxPage: s, debug: c, concurrency: l = 100, collectionConcurrency: u = 100 } = {}) {
|
|
333
333
|
var d;
|
|
334
334
|
let f = {}, m = a || (yield t(e, { fetchOption: o })), h = JSON.parse(JSON.stringify(m));
|
|
335
335
|
c && console.time("Total fetch time");
|
|
@@ -348,7 +348,7 @@ function O() {
|
|
|
348
348
|
var t;
|
|
349
349
|
return (t = e.value) == null ? void 0 : t.id;
|
|
350
350
|
}).filter(Boolean);
|
|
351
|
-
m.block =
|
|
351
|
+
m.block = C(C({}, m.block), h.block), c && console.timeEnd("mapBlocks"), c && console.time("fetchCollections"), yield r(i, m, void 0, {
|
|
352
352
|
fetchOption: o,
|
|
353
353
|
concurrency: l,
|
|
354
354
|
collectionConcurrency: u
|
|
@@ -362,7 +362,7 @@ function O() {
|
|
|
362
362
|
}
|
|
363
363
|
c && console.timeEnd("Total fetch time"), c && console.time("get page map"), c && console.debug("Total block length ", Object.keys(m.block).length);
|
|
364
364
|
let _ = Object.keys(m.block), v = [];
|
|
365
|
-
for (let e of _) ((d = m.block[e].value) == null ? void 0 : d.type) === "page" && (v.push(
|
|
365
|
+
for (let e of _) ((d = m.block[e].value) == null ? void 0 : d.type) === "page" && (v.push(O(e, m, n).then((t) => f[e] = t)), yield ie(1));
|
|
366
366
|
yield Promise.all(v), c && console.timeEnd("get page map"), c && console.debug("Total page length ", Object.keys(f).length), c && console.time("get page tree");
|
|
367
367
|
let y = {
|
|
368
368
|
id: e,
|
|
@@ -372,14 +372,14 @@ function O() {
|
|
|
372
372
|
children: [],
|
|
373
373
|
type: "page"
|
|
374
374
|
};
|
|
375
|
-
return
|
|
375
|
+
return D(m, y), c && console.timeEnd("get page tree"), {
|
|
376
376
|
pageMap: f,
|
|
377
377
|
pageTree: y,
|
|
378
378
|
recordMap: m
|
|
379
379
|
};
|
|
380
|
-
}),
|
|
380
|
+
}), E.apply(this, arguments);
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function D(e, t) {
|
|
383
383
|
var n, r;
|
|
384
384
|
let a = [t], o = t;
|
|
385
385
|
for (; o.parent;) a.push(o.parent), o = o.parent;
|
|
@@ -390,7 +390,7 @@ function k(e, t) {
|
|
|
390
390
|
for (let n of s.content) {
|
|
391
391
|
var c;
|
|
392
392
|
let r = (c = e.block[n]) == null ? void 0 : c.value;
|
|
393
|
-
if (r && (t.children.push(
|
|
393
|
+
if (r && (t.children.push(D(e, {
|
|
394
394
|
id: n,
|
|
395
395
|
title: i(r, e),
|
|
396
396
|
blocks: 1,
|
|
@@ -408,7 +408,7 @@ function k(e, t) {
|
|
|
408
408
|
let r = Object.keys(n);
|
|
409
409
|
for (let e of a) e.pages += r.length;
|
|
410
410
|
for (let e of a) e.blocks += r.length;
|
|
411
|
-
for (let n of r) t.children.push(
|
|
411
|
+
for (let n of r) t.children.push(D(e, {
|
|
412
412
|
id: n,
|
|
413
413
|
title: i(e.block[n].value, e),
|
|
414
414
|
blocks: r.length,
|
|
@@ -420,11 +420,11 @@ function k(e, t) {
|
|
|
420
420
|
}
|
|
421
421
|
return delete t.parent, t;
|
|
422
422
|
}
|
|
423
|
-
function
|
|
424
|
-
return
|
|
423
|
+
function O(e, t, n) {
|
|
424
|
+
return k.apply(this, arguments);
|
|
425
425
|
}
|
|
426
|
-
function
|
|
427
|
-
return
|
|
426
|
+
function k() {
|
|
427
|
+
return k = T(function* (e, t, n) {
|
|
428
428
|
let r = p(t, e), i = { [e]: {
|
|
429
429
|
value: t.block[e].value,
|
|
430
430
|
role: "reader"
|
|
@@ -479,7 +479,7 @@ function j() {
|
|
|
479
479
|
if (c.length) {
|
|
480
480
|
let r = (yield n(c).catch(() => ({ recordMap: { block: null } }))).recordMap;
|
|
481
481
|
if (r != null && r.block) {
|
|
482
|
-
i =
|
|
482
|
+
i = C(C({}, i), r.block);
|
|
483
483
|
for (let e in r.block) t.block[e] = r.block[e];
|
|
484
484
|
} else console.warn(`fetching ${c.length} fail for ${e}`);
|
|
485
485
|
}
|
|
@@ -515,32 +515,32 @@ function j() {
|
|
|
515
515
|
signed_urls: {},
|
|
516
516
|
notion_user: {}
|
|
517
517
|
};
|
|
518
|
-
}),
|
|
518
|
+
}), k.apply(this, arguments);
|
|
519
519
|
}
|
|
520
|
-
var
|
|
521
|
-
var e =
|
|
520
|
+
var ie = function() {
|
|
521
|
+
var e = T(function* (e) {
|
|
522
522
|
return new Promise((t) => setTimeout(t, e));
|
|
523
523
|
});
|
|
524
524
|
return function(t) {
|
|
525
525
|
return e.apply(this, arguments);
|
|
526
526
|
};
|
|
527
|
-
}(),
|
|
527
|
+
}(), A = (e) => (e || "").replace(/( |\/)/g, "-").replace(/[^a-zA-Z0-9-\u4e00-\u9FFF\uAC00-\uD7AF\u3130-\u318F\u3041-\u3096\u30A1-\u30FC\u3000-\u303F]/g, "").replace(/--+/g, "-").replace(/^-+|-+$/g, "").trim().toLowerCase(), ae = (e, t, { uuid: r = !0 } = {}) => {
|
|
528
528
|
var a;
|
|
529
529
|
if (!e || !t) return null;
|
|
530
530
|
let o = y(e), c = (a = t.block[e]) == null ? void 0 : a.value;
|
|
531
531
|
if (c) {
|
|
532
|
-
let e = s("slug", c, t) ||
|
|
532
|
+
let e = s("slug", c, t) || A(i(c, t));
|
|
533
533
|
if (e) return r ? `${e}-${o}` : e;
|
|
534
534
|
} else {
|
|
535
535
|
var l;
|
|
536
536
|
let i = (l = t.collection[e]) == null ? void 0 : l.value;
|
|
537
537
|
if (i) {
|
|
538
|
-
let e =
|
|
538
|
+
let e = A(n(i.name));
|
|
539
539
|
if (e) return r ? `${e}-${o}` : e;
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
return o;
|
|
543
|
-
},
|
|
543
|
+
}, oe = (e, t) => {
|
|
544
544
|
let n = e.block, r = [], o = t;
|
|
545
545
|
do {
|
|
546
546
|
var s;
|
|
@@ -560,7 +560,7 @@ var M = function() {
|
|
|
560
560
|
o = p;
|
|
561
561
|
} while (1);
|
|
562
562
|
return r.reverse(), r;
|
|
563
|
-
},
|
|
563
|
+
}, se = (t, { mapImageUrl: n }) => {
|
|
564
564
|
let r = Object.keys(t.block).flatMap((n) => {
|
|
565
565
|
var r;
|
|
566
566
|
let i = (r = t.block[n]) == null ? void 0 : r.value, o = [];
|
|
@@ -604,29 +604,65 @@ var M = function() {
|
|
|
604
604
|
return o;
|
|
605
605
|
}).filter(Boolean).map(({ block: e, url: t }) => n(t, e)).filter(Boolean);
|
|
606
606
|
return Array.from(new Set(r));
|
|
607
|
-
},
|
|
607
|
+
}, j = /* @__PURE__ */ new Set([
|
|
608
608
|
"text",
|
|
609
609
|
"header",
|
|
610
610
|
"sub_header",
|
|
611
611
|
"sub_sub_header",
|
|
612
612
|
"bulleted_list",
|
|
613
613
|
"numbered_list"
|
|
614
|
-
]),
|
|
614
|
+
]), M = (e) => Array.isArray(e) && e.every((e) => Array.isArray(e) && typeof e[0] == "string" && (e[1] === void 0 || Array.isArray(e[1]) && e[1].length === 0)), ce = (e) => {
|
|
615
615
|
var t;
|
|
616
|
-
return
|
|
617
|
-
},
|
|
616
|
+
return j.has(e.type) && M((t = e.properties) == null ? void 0 : t.title);
|
|
617
|
+
}, N = /* @__PURE__ */ new Set([
|
|
618
|
+
"b",
|
|
619
|
+
"i",
|
|
620
|
+
"s",
|
|
621
|
+
"c",
|
|
622
|
+
"_"
|
|
623
|
+
]), P = /* @__PURE__ */ new Set([
|
|
624
|
+
"p",
|
|
625
|
+
"u",
|
|
626
|
+
"e"
|
|
627
|
+
]);
|
|
628
|
+
function F(e) {
|
|
629
|
+
return e === void 0 ? !0 : Array.isArray(e) ? e.every((e) => {
|
|
630
|
+
if (!Array.isArray(e) || typeof e[0] != "string" || e.length > 2) return !1;
|
|
631
|
+
if (e[1] === void 0) return !0;
|
|
632
|
+
if (!Array.isArray(e[1])) return !1;
|
|
633
|
+
let t = 0;
|
|
634
|
+
for (let n of e[1]) {
|
|
635
|
+
if (!Array.isArray(n) || typeof n[0] != "string") return !1;
|
|
636
|
+
let [e, r] = n;
|
|
637
|
+
if (!N.has(e) && (e !== "h" && e !== "a" || typeof r != "string")) {
|
|
638
|
+
if (P.has(e) && typeof r == "string") t++;
|
|
639
|
+
else return !1;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return t <= 1;
|
|
643
|
+
}) : !1;
|
|
644
|
+
}
|
|
645
|
+
var I = /* @__PURE__ */ new Set([
|
|
646
|
+
...j,
|
|
647
|
+
"to_do",
|
|
648
|
+
"toggle",
|
|
649
|
+
"quote"
|
|
650
|
+
]), le = (e) => {
|
|
651
|
+
var t;
|
|
652
|
+
return I.has(e.type) && F((t = e.properties) == null ? void 0 : t.title);
|
|
653
|
+
}, L = (e, t, n, r) => {
|
|
618
654
|
if (n === "length" || n === "prototype" || n === "arguments" || n === "caller") return;
|
|
619
655
|
let i = Object.getOwnPropertyDescriptor(e, n), a = Object.getOwnPropertyDescriptor(t, n);
|
|
620
|
-
(
|
|
621
|
-
},
|
|
656
|
+
(R(i, a) || !r) && Object.defineProperty(e, n, a);
|
|
657
|
+
}, R = function(e, t) {
|
|
622
658
|
return e === void 0 || e.configurable || e.writable === t.writable && e.enumerable === t.enumerable && e.configurable === t.configurable && (e.writable || e.value === t.value);
|
|
623
|
-
},
|
|
659
|
+
}, z = (e, t) => {
|
|
624
660
|
let n = Object.getPrototypeOf(t);
|
|
625
661
|
n !== Object.getPrototypeOf(e) && Object.setPrototypeOf(e, n);
|
|
626
|
-
},
|
|
627
|
-
let r = n === "" ? "" : `with ${n.trim()}() `, i =
|
|
628
|
-
Object.defineProperty(i, "name",
|
|
629
|
-
let { writable: a, enumerable: o, configurable: s } =
|
|
662
|
+
}, B = (e, t) => `/* Wrapped ${e}*/\n${t}`, V = Object.getOwnPropertyDescriptor(Function.prototype, "toString"), H = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name"), U = (e, t, n) => {
|
|
663
|
+
let r = n === "" ? "" : `with ${n.trim()}() `, i = B.bind(null, r, t.toString());
|
|
664
|
+
Object.defineProperty(i, "name", H);
|
|
665
|
+
let { writable: a, enumerable: o, configurable: s } = V;
|
|
630
666
|
Object.defineProperty(e, "toString", {
|
|
631
667
|
value: i,
|
|
632
668
|
writable: a,
|
|
@@ -634,15 +670,15 @@ var M = function() {
|
|
|
634
670
|
configurable: s
|
|
635
671
|
});
|
|
636
672
|
};
|
|
637
|
-
function
|
|
673
|
+
function W(e, t, { ignoreNonConfigurable: n = !1 } = {}) {
|
|
638
674
|
let { name: r } = e;
|
|
639
|
-
for (let r of Reflect.ownKeys(t))
|
|
640
|
-
return
|
|
675
|
+
for (let r of Reflect.ownKeys(t)) L(e, t, r, n);
|
|
676
|
+
return z(e, t), U(e, t, r), e;
|
|
641
677
|
}
|
|
642
678
|
//#endregion
|
|
643
679
|
//#region ../../node_modules/.pnpm/memoize@11.0.0/node_modules/memoize/distribution/index.js
|
|
644
|
-
var
|
|
645
|
-
function
|
|
680
|
+
var G = 2147483647, ue = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), de = /* @__PURE__ */ new WeakMap();
|
|
681
|
+
function fe(e, t) {
|
|
646
682
|
let n = e.get(t);
|
|
647
683
|
if (n) {
|
|
648
684
|
if (n.maxAge <= Date.now()) e.delete(t);
|
|
@@ -652,13 +688,13 @@ function se(e, t) {
|
|
|
652
688
|
function q(e, t) {
|
|
653
689
|
if (e !== Infinity) {
|
|
654
690
|
if (!Number.isFinite(e)) throw TypeError(t === "`maxAge` option" ? "The `maxAge` option must be a finite number, `0`, or `Infinity`." : "The `maxAge` function must return a finite number, `0`, or `Infinity`.");
|
|
655
|
-
if (e >
|
|
691
|
+
if (e > G) throw TypeError(t === "`maxAge` option" ? `The \`maxAge\` option cannot exceed ${G}.` : `The \`maxAge\` function result cannot exceed ${G}.`);
|
|
656
692
|
}
|
|
657
693
|
}
|
|
658
|
-
function
|
|
694
|
+
function pe(e, { cacheKey: t, cache: n = /* @__PURE__ */ new Map(), maxAge: r } = {}) {
|
|
659
695
|
if (typeof r == "number" && (q(r, "`maxAge` option"), r <= 0)) return e;
|
|
660
696
|
let i = function(...a) {
|
|
661
|
-
let o = t ? t(a) : a[0], s =
|
|
697
|
+
let o = t ? t(a) : a[0], s = fe(n, o);
|
|
662
698
|
if (s) return s.data;
|
|
663
699
|
let c = e.apply(this, a), l = typeof r == "function" ? r(...a) : r;
|
|
664
700
|
if (l !== void 0 && l !== Infinity && (q(l, "`maxAge` function result"), l <= 0)) return c;
|
|
@@ -669,19 +705,19 @@ function ce(e, { cacheKey: t, cache: n = /* @__PURE__ */ new Map(), maxAge: r }
|
|
|
669
705
|
var u, d;
|
|
670
706
|
let e = setTimeout(() => {
|
|
671
707
|
var t;
|
|
672
|
-
n.delete(o), (t =
|
|
708
|
+
n.delete(o), (t = K.get(i)) == null || t.delete(e);
|
|
673
709
|
}, l);
|
|
674
710
|
(u = e.unref) == null || u.call(e);
|
|
675
|
-
let t = (d =
|
|
676
|
-
t.add(e),
|
|
711
|
+
let t = (d = K.get(i)) == null ? /* @__PURE__ */ new Set() : d;
|
|
712
|
+
t.add(e), K.set(i, t);
|
|
677
713
|
}
|
|
678
714
|
return c;
|
|
679
715
|
};
|
|
680
|
-
return
|
|
716
|
+
return W(i, e, { ignoreNonConfigurable: !0 }), ue.set(i, n), de.set(i, t == null ? ((e) => e[0]) : t), i;
|
|
681
717
|
}
|
|
682
718
|
//#endregion
|
|
683
719
|
//#region src/normalize-url.ts
|
|
684
|
-
var J =
|
|
720
|
+
var J = pe((e) => {
|
|
685
721
|
if (!e) return "";
|
|
686
722
|
try {
|
|
687
723
|
if (e.startsWith("https://www.notion.so/image/")) {
|
|
@@ -701,15 +737,15 @@ var J = ce((e) => {
|
|
|
701
737
|
});
|
|
702
738
|
//#endregion
|
|
703
739
|
//#region src/merge-record-maps.ts
|
|
704
|
-
function
|
|
740
|
+
function me(e, t) {
|
|
705
741
|
return {
|
|
706
|
-
block:
|
|
707
|
-
collection:
|
|
708
|
-
collection_view:
|
|
709
|
-
notion_user:
|
|
710
|
-
collection_query:
|
|
711
|
-
signed_urls:
|
|
712
|
-
preview_images:
|
|
742
|
+
block: C(C({}, e.block), t.block),
|
|
743
|
+
collection: C(C({}, e.collection), t.collection),
|
|
744
|
+
collection_view: C(C({}, e.collection_view), t.collection_view),
|
|
745
|
+
notion_user: C(C({}, e.notion_user), t.notion_user),
|
|
746
|
+
collection_query: C(C({}, e.collection_query), t.collection_query),
|
|
747
|
+
signed_urls: C(C({}, e.signed_urls), t.signed_urls),
|
|
748
|
+
preview_images: C(C({}, e.preview_images), t.preview_images)
|
|
713
749
|
};
|
|
714
750
|
}
|
|
715
751
|
//#endregion
|
|
@@ -717,19 +753,19 @@ function le(e, t) {
|
|
|
717
753
|
var Y = (e, { month: t = "short" } = {}) => {
|
|
718
754
|
let n = new Date(e), r = n.toLocaleString("en-US", { month: t });
|
|
719
755
|
return `${n.getUTCFullYear()} ${r} ${n.getUTCDate()} ${n.getUTCHours()}:${n.getUTCMinutes()}`;
|
|
720
|
-
},
|
|
756
|
+
}, he = (e) => Y(`${e.start_time || ""} ${e.start_date} ${e.time_zone || ""}`);
|
|
721
757
|
//#endregion
|
|
722
758
|
//#region src/estimate-page-read-time.ts
|
|
723
759
|
function X(e, t, { wordsPerMinute: n = 275, imageReadTimeInSeconds: r = 12 } = {}) {
|
|
724
760
|
let i = Z(e, t), a = i.numWords / n, o = (i.numImages > 10 ? i.numImages / 2 * (r + 3) + (i.numImages - 10) * 3 : i.numImages / 2 * (2 * r + (1 - i.numImages))) / 60, s = a + o;
|
|
725
|
-
return
|
|
761
|
+
return C(C({}, i), {}, {
|
|
726
762
|
totalWordsReadTimeInMinutes: a,
|
|
727
763
|
totalImageReadTimeInMinutes: o,
|
|
728
764
|
totalReadTimeInMinutes: s
|
|
729
765
|
});
|
|
730
766
|
}
|
|
731
|
-
function
|
|
732
|
-
return
|
|
767
|
+
function ge(e, t, n) {
|
|
768
|
+
return _e(X(e, t, n).totalReadTimeInMinutes);
|
|
733
769
|
}
|
|
734
770
|
function Z(e, t) {
|
|
735
771
|
let n = {
|
|
@@ -819,12 +855,12 @@ function Q(e, t) {
|
|
|
819
855
|
function $(e) {
|
|
820
856
|
return e ? (e.match(/\w+/g) || []).length : 0;
|
|
821
857
|
}
|
|
822
|
-
function
|
|
858
|
+
function _e(e) {
|
|
823
859
|
return e < .5 ? "less than a minute" : e < 1.5 ? "1 minute" : `${Math.ceil(e)} minutes`;
|
|
824
860
|
}
|
|
825
861
|
//#endregion
|
|
826
862
|
//#region src/map-image-url.ts
|
|
827
|
-
var
|
|
863
|
+
var ve = (e, t) => {
|
|
828
864
|
if (!e) return null;
|
|
829
865
|
if (e.startsWith("data:") || e.startsWith("https://images.unsplash.com")) return e;
|
|
830
866
|
try {
|
|
@@ -838,8 +874,8 @@ var pe = (e, t) => {
|
|
|
838
874
|
e.startsWith("/images") && (e = `https://www.notion.so${e}`), e = `https://www.notion.so${e.startsWith("/image") ? e : `/image/${encodeURIComponent(e)}`}`;
|
|
839
875
|
let n = new URL(e), r = t.parent_table === "space" ? "block" : t.parent_table;
|
|
840
876
|
return (r === "collection" || r === "team") && (r = "block"), n.searchParams.set("table", r), n.searchParams.set("id", t.id), n.searchParams.set("cache", "v2"), e = n.toString(), e;
|
|
841
|
-
},
|
|
877
|
+
}, ye = (e) => (t) => (t = (t || "").replace(/-/g, ""), e && t === e ? "/" : `/${t}`);
|
|
842
878
|
//#endregion
|
|
843
|
-
export {
|
|
879
|
+
export { j as EDITABLE_BLOCK_TYPES, I as IN_PLACE_BLOCK_TYPES, P as TITLE_INLINES, N as TITLE_STYLES, ve as defaultMapImageUrl, ye as defaultMapPageUrl, X as estimatePageReadTime, ge as estimatePageReadTimeAsHumanizedString, b as findAncestors, Y as formatDate, he as formatNotionDateTime, re as getAllInSpace, r as getBlockCollectionId, a as getBlockIcon, u as getBlockParent, l as getBlockParentPage, i as getBlockTitle, ae as getCanonicalPageId, c as getDateValue, oe as getPageBreadcrumbs, p as getPageContentBlockIds, m as getPageContentUserIds, se as getPageImageUrls, s as getPageProperty, O as getPageSync, f as getPageTableOfContents, o as getPageTitle, n as getTextContent, h as idToUuid, ce as isEditableBlock, le as isEditableInPlace, M as isPlainTitle, F as isRoundTrippableTitle, e as isUrl, me as mergeRecordMaps, A as normalizeTitle, J as normalizeUrl, v as parsePageId, D as recursivePageTree, y as uuidToId };
|
|
844
880
|
|
|
845
881
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isUrl","normalizeUrlImpl","getTextContent","_text$reduce","text","prev","current","getBlockCollectionId","_block$format","_block$view_ids","collectionId","block","collectionViewId","_recordMap$collection","collectionView","recordMap","_collectionView$forma","getBlockTitle","_block$properties","collection","getBlockIcon","_block$format2","getPageTitle","_recordMap$block$Obje","pageBlock","getPageProperty","propertyNameL","propertyName","propertyId","_collection$schema$ke","key","content","type","formatDate","start_date","start_time","end_date","end_time","_unused","getDateValue","prop","v","value","getBlockParentPage","currentRecord","inclusive","parentId","parentTable","_recordMap$block$pare","getBlockParent","_recordMap$collection2","_recordMap$space","_recordMap$block$pare2","indentLevels","getPageTableOfContents","_page$content","toc","page","_recordMap$block$bloc","blockId","indentLevelStack","tocItem","actual","indentLevel","prevActual","prevEffective","getPageContentBlockIds","rootBlockId","contentBlockIds","addContentBlocks","properties","p","_d$","d","_d$2","format","_format$transclusion_","referenceId","locust","getPageContentUserIds","_recordMap$block$root","contentUserIDs","_d$3","idToUuid","id","pageIdRe","pageId2Re","parsePageId","match","uuid","match2","uuidToId","findAncestors","_recordMap$table","table","list","_typeof","o","toPrimitive","t","e","i","r","toPropertyKey","_defineProperty","ownKeys","_objectSpread2","asyncGeneratorStep","n","c","u","_asyncToGenerator","_next","_throw","getAllInSpace","_getAllInSpace","pageMap","startRecordMap","getPage","startPageId","tempRecordMap","debug","iteration","targetBlocks","missing","root","contentBlockID","blockMap","getBlocks","fetchOption","_obj$value","obj","fetchCollections","pageLength","_obj$value2","maxPage","blockIds","promises","getPageSync","pageRecordMap","sleep","pageTree","recursivePageTree","_recordMap$block$page","_current$content","ancestors","ancestor","contentBlockId","_recordMap$block$cont","childrenMap","collectionQuery","childrenPages","_getPageSync","pageId","collectionMap","collectionViewMap","collectionQueryMap","_recordMap$block$cont2","viewId","_recordMap$block$bloc2","ancesters","ancester","_recordMap$block$ance","_recordMap$collection3","targetBlock","_targetBlock$format","_recordMap$block$alia","alias","responseMap","_recordMap$block$cont3","_recordMap$collection4","_recordMap$block$bloc3","_ref","resolve","ms","normalizeTitle","title","getCanonicalPageId","slug","getPageBreadcrumbs","breadcrumbs","currentPageId","activePageId","_blockMap$currentPage","icon","parentBlock","getPageImageUrls","imageUrls","images","_block$format3","_recordMap$signed_url","_block$properties2","source","pageIcon","mapImageUrl","url","EDITABLE_BLOCK_TYPES","isPlainTitle","segment","isEditableBlock","copyProperty","property","toDescriptor","to","fromDescriptor","from","canCopyProperty","changePrototype","fromPrototype","wrappedToString","withName","fromBody","toStringDescriptor","toStringName","changeToString","name","newToString","mimicFunction","ignoreNonConfigurable","maxTimeoutValue","cacheStore","cacheTimerStore","cacheKeyStore","getValidCacheItem","item","cache","validateMaxAge","memoize","maxAge","function_","memoized","arguments_","cacheKey","cacheItem","result","computedMaxAge","_timer$unref","_cacheTimerStore$get2","timer","_cacheTimerStore$get","timers","normalizeUrl","normalizedSubUrl","err","mergeRecordMaps","recordMapA","recordMapB","date","input","monthLocale","formatNotionDateTime","datetime","estimatePageReadTime","stats","getBlockContentStats","totalWordsReadTimeInMinutes","wordsPerMinute","totalImageReadTimeInMinutes","imageReadTimeInSeconds","totalReadTimeInMinutes","estimatePageReadTimeAsHumanizedString","humanizeReadTime","opts","childId","_recordMap$block$chil","child","recurse","countWordsInText","_child$format","_recordMap$block$refe","referencePointerId","referenceBlock","mergeContentStats","statsB","time","defaultMapImageUrl","_unused2","notionImageUrlV2","defaultMapPageUrl","rootPageId"],"sources":["../src/get-text-content.ts","../src/get-block-collection-id.ts","../src/get-block-title.ts","../src/get-block-icon.ts","../src/get-page-title.ts","../src/get-page-property.ts","../src/get-date-value.ts","../src/get-block-parent-page.ts","../src/get-page-table-of-contents.ts","../src/get-page-content-block-ids.ts","../src/id-to-uuid.ts","../src/parse-page-id.ts","../src/uuid-to-id.ts","../src/find-ancestors.ts","../src/get-all-in-space.ts","../src/normalize-title.ts","../src/get-canonical-page-id.ts","../src/get-page-breadcrumbs.ts","../src/get-page-image-urls.ts","../src/is-editable-block.ts","../../../node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js","../../../node_modules/.pnpm/memoize@11.0.0/node_modules/memoize/distribution/index.js","../src/normalize-url.ts","../src/merge-record-maps.ts","../src/format-date.ts","../src/format-notion-date-time.ts","../src/estimate-page-read-time.ts","../src/map-image-url.ts","../src/map-page-url.ts"],"sourcesContent":["import type { Decoration } from '@texonom/ntypes'\n\n/**\n * Gets the raw, unformatted text content of a block's content value.\n *\n * This is useful, for instance, for extracting a block's `title` without any\n * rich text formatting.\n */\nexport const getTextContent = (text?: Decoration[]): string => {\n if (!text) return ''\n else if (Array.isArray(text))\n return text?.reduce((prev, current) => prev + (current[0] !== '⁍' && current[0] !== '‣' ? current[0] : ''), '') ?? ''\n else return text\n}\n","import type { Block, CollectionViewBlock, ExtendedRecordMap } from '@texonom/ntypes'\n\nexport function getBlockCollectionId(block: Block, recordMap: ExtendedRecordMap): string | null {\n const collectionId =\n (block as CollectionViewBlock).collection_id || (block as CollectionViewBlock).format?.collection_pointer?.id\n\n if (collectionId) return collectionId\n\n const collectionViewId = (block as CollectionViewBlock)?.view_ids?.[0]\n if (collectionViewId) {\n const collectionView = recordMap.collection_view?.[collectionViewId]?.value\n if (collectionView) {\n const collectionId = collectionView.format?.collection_pointer?.id\n return collectionId\n }\n }\n\n return null\n}\n","import { getBlockCollectionId } from './get-block-collection-id'\nimport { getTextContent } from './get-text-content'\n\nimport type { Block, ExtendedRecordMap } from '@texonom/ntypes'\n\nexport function getBlockTitle(block: Block, recordMap: ExtendedRecordMap) {\n if (block.properties?.title) return getTextContent(block.properties.title)\n\n if (block.type === 'collection_view_page' || block.type === 'collection_view') {\n const collectionId = getBlockCollectionId(block, recordMap)\n if (collectionId) {\n const collection = recordMap.collection[collectionId]?.value\n if (collection) return getTextContent(collection.name)\n }\n }\n return ''\n}\n","import { getBlockCollectionId } from './get-block-collection-id'\n\nimport type { Block, ExtendedRecordMap, PageBlock } from '@texonom/ntypes'\n\nexport function getBlockIcon(block: Block, recordMap: ExtendedRecordMap) {\n if ((block as PageBlock).format?.page_icon) return (block as PageBlock).format?.page_icon\n\n if (block.type === 'collection_view_page' || block.type === 'collection_view') {\n const collectionId = getBlockCollectionId(block, recordMap)\n if (collectionId) {\n const collection = recordMap.collection[collectionId]?.value\n\n if (collection) return collection.icon\n }\n }\n\n return null\n}\n","import type { ExtendedRecordMap } from '@texonom/ntypes'\n\nimport { getBlockTitle } from './get-block-title'\n\nexport function getPageTitle(recordMap: ExtendedRecordMap) {\n const pageBlock = recordMap.block[Object.keys(recordMap.block)[0]]?.value\n\n if (pageBlock) return getBlockTitle(pageBlock, recordMap)\n\n return null\n}\n","import { Block, DateFormat, ExtendedRecordMap } from '@texonom/ntypes'\n\nimport { getTextContent } from './get-text-content'\n\n/**\n * Gets the value of a collection property for a given page (collection item).\n *\n * @param propertyName property name\n * @param block Page block, often be first block in blockMap\n * @param recordMap\n * @returns - The return value types will follow the following principles:\n * 1. if property is date type, it will return `number` or `number[]`(depends on `End Date` switch)\n * 2. property is text-like will return `string`\n * 3. multi select property will return `string[]`\n * 4. checkbox property return `boolean`\n * @todo complete all no-text property type\n */\nexport function getPageProperty<T = string | number | boolean | string[] | number[]>(\n propertyName: string,\n block: Block,\n recordMap: ExtendedRecordMap\n): T\nexport function getPageProperty(propertyName: string, block: Block, recordMap: ExtendedRecordMap) {\n try {\n if (!block.properties || !Object.keys(recordMap.collection))\n // console.warn(\n // `block ${block.id} has no properties or this recordMap has no collection record`\n // )\n return null\n\n const collection = recordMap.collection[block.parent_id]?.value\n\n if (collection) {\n const propertyNameL = propertyName.toLowerCase()\n const propertyId = Object.keys(collection.schema).find(\n key => collection.schema[key]?.name?.toLowerCase() === propertyNameL\n )\n\n if (!propertyId) return null\n\n const { type } = collection.schema[propertyId]\n const content = getTextContent(block.properties[propertyId])\n\n switch (type) {\n case 'created_time':\n return block.created_time\n\n case 'multi_select':\n return content.split(',')\n\n case 'date': {\n const property = block.properties[propertyId] as [['‣', [DateFormat]]]\n const formatDate = property[0][1][0][1]\n\n if (formatDate.type == 'datetime') {\n return new Date(`${formatDate.start_date} ${formatDate.start_time}`).getTime()\n } else if (formatDate.type == 'date') {\n return new Date(formatDate.start_date).getTime()\n } else if (formatDate.type == 'datetimerange') {\n const { start_date, start_time, end_date, end_time } = formatDate\n const startTime = new Date(`${start_date} ${start_time}`).getTime()\n const endTime = new Date(`${end_date} ${end_time}`).getTime()\n return [startTime, endTime]\n } else {\n const startTime = new Date(formatDate.start_date).getTime()\n const endTime = new Date(formatDate.end_date).getTime()\n return [startTime, endTime]\n }\n }\n\n case 'checkbox':\n return content == 'Yes'\n\n case 'last_edited_time':\n return block.last_edited_time\n\n default:\n return content\n }\n }\n } catch {\n // ensure that no matter what, we don't throw errors because of an unexpected\n // collection data format\n }\n\n return null\n}\n","import type { FormattedDate } from '@texonom/ntypes'\n\n/**\n * Attempts to find a valid date from a given property.\n */\nexport const getDateValue = (prop: any[]): FormattedDate | null => {\n if (prop && Array.isArray(prop))\n if (prop[0] === 'd') return prop[1]\n else\n for (const v of prop) {\n const value = getDateValue(v)\n if (value) return value\n }\n\n return null\n}\n","import type { Block, ExtendedRecordMap, PageBlock, Collection, Space } from '@texonom/ntypes'\n\n/**\n * Returns the parent page block containing a given page.\n *\n * Note that many times this will not be the direct parent block since\n * some non-page content blocks can contain sub-blocks.\n */\nexport const getBlockParentPage = (\n block: Block,\n recordMap: ExtendedRecordMap,\n {\n inclusive = false\n }: {\n inclusive?: boolean\n } = {}\n): PageBlock | null => {\n let currentRecord: Block | Collection = block\n\n while (currentRecord != null) {\n if (inclusive && (currentRecord as Block)?.type === 'page') return currentRecord as PageBlock\n\n const parentId: string = currentRecord.parent_id\n const parentTable = currentRecord.parent_table\n\n if (!parentId) break\n\n if (parentTable === 'collection') {\n currentRecord = recordMap.collection[parentId]?.value\n } else {\n currentRecord = recordMap.block[parentId]?.value\n if ((currentRecord as Block)?.type === 'page') return currentRecord as PageBlock\n }\n }\n return null\n}\n\nexport const getBlockParent = (\n block: Block,\n recordMap: ExtendedRecordMap,\n {\n inclusive = false\n }: {\n inclusive?: boolean\n } = {}\n): PageBlock | Collection | Space => {\n let currentRecord: Block | Collection | Space = block\n\n while (currentRecord != null) {\n if (inclusive && (currentRecord as Block)?.type === 'page') return currentRecord as PageBlock\n\n const parentId: string = currentRecord.parent_id\n const parentTable = currentRecord.parent_table\n\n if (!parentId) break\n\n if (parentTable === 'collection') {\n return recordMap.collection[parentId]?.value\n } else if (parentTable === 'space') {\n return recordMap.space?.[parentId]?.value\n } else {\n currentRecord = recordMap.block[parentId]?.value\n if ((currentRecord as Block)?.type === 'page') return currentRecord as PageBlock\n }\n }\n return null\n}\n","import { getTextContent } from './get-text-content'\n\nimport type { ID, BlockType, PageBlock, ExtendedRecordMap } from '@texonom/ntypes'\n\nexport interface TableOfContentsEntry {\n id: ID\n type: BlockType\n text: string\n indentLevel: number\n}\n\nconst indentLevels = {\n header: 0,\n sub_header: 1,\n sub_sub_header: 2\n}\n\n/**\n * Gets the metadata for a table of contents block by parsing the page's\n * H1, H2, and H3 elements.\n */\nexport const getPageTableOfContents = (page: PageBlock, recordMap: ExtendedRecordMap): Array<TableOfContentsEntry> => {\n const toc = (page.content ?? [])\n .map((blockId: string) => {\n const block = recordMap.block[blockId]?.value\n\n if (block) {\n const { type } = block\n\n if (type === 'header' || type === 'sub_header' || type === 'sub_sub_header')\n return {\n id: blockId,\n type,\n text: getTextContent(block.properties?.title),\n indentLevel: indentLevels[type]\n }\n }\n\n return null\n })\n .filter(Boolean) as Array<TableOfContentsEntry>\n\n const indentLevelStack = [\n {\n actual: -1,\n effective: -1\n }\n ]\n\n // Adjust indent levels to always change smoothly.\n // This is a little tricky, but the key is that when increasing indent levels,\n // they should never jump more than one at a time.\n for (const tocItem of toc) {\n const { indentLevel } = tocItem\n const actual = indentLevel\n\n do {\n const prevIndent = indentLevelStack[indentLevelStack.length - 1]\n const { actual: prevActual, effective: prevEffective } = prevIndent\n\n if (actual > prevActual) {\n tocItem.indentLevel = prevEffective + 1\n indentLevelStack.push({\n actual,\n effective: tocItem.indentLevel\n })\n } else if (actual === prevActual) {\n tocItem.indentLevel = prevEffective\n break\n } else {\n indentLevelStack.pop()\n }\n\n // eslint-disable-next-line no-constant-condition\n } while (true)\n }\n\n return toc\n}\n","import type { ExtendedRecordMap, Decoration } from '@texonom/ntypes'\n\n/**\n * Gets the IDs of all blocks contained on a page starting from a root block ID.\n */\nexport const getPageContentBlockIds = (recordMap: ExtendedRecordMap, blockId?: string, locust = false): string[] => {\n const rootBlockId = blockId || Object.keys(recordMap.block)[0]\n const contentBlockIds = new Set<string>()\n\n function addContentBlocks(blockId: string) {\n if (contentBlockIds.has(blockId)) return\n contentBlockIds.add(blockId)\n\n const block = recordMap.block[blockId]?.value\n if (!block) return\n const { content, type, properties, format } = block\n if (properties)\n for (const key of Object.keys(properties)) {\n const p = properties[key]\n p.map((d: Decoration) => {\n const value = d?.[0]?.[1]?.[0]\n if (value?.[0] === 'p' && value[1]) addContentBlocks(value[1])\n })\n p.map((d: Decoration) => {\n const value = d?.[1]?.[0]\n if ((value?.[0] === 'p' || value?.[0] === 'eoi') && value[1]) addContentBlocks(value[1])\n })\n }\n\n if (format) {\n const referenceId = format.transclusion_reference_pointer?.id\n if (referenceId) addContentBlocks(referenceId)\n }\n // no child content blocks to recurse on\n if (!content || !Array.isArray(content)) return\n // ignore the content of other pages and collections\n if (blockId !== rootBlockId && !locust) if (type === 'page' || type === 'collection_view_page') return\n for (const blockId of content) addContentBlocks(blockId)\n }\n addContentBlocks(rootBlockId)\n return Array.from(contentBlockIds)\n}\n\n/**\n * Gets the IDs of all blocks contained on a page starting from a root block ID.\n */\nexport const getPageContentUserIds = (recordMap: ExtendedRecordMap, blockId?: string): string[] => {\n const rootBlockId = blockId || Object.keys(recordMap.block)[0]\n const contentUserIDs = new Set<string>()\n const block = recordMap.block[rootBlockId]?.value\n\n if (block?.created_by_id) contentUserIDs.add(block?.created_by_id)\n if (block?.last_edited_by_id) contentUserIDs.add(block?.last_edited_by_id)\n\n // Property\n const { properties } = block\n if (properties)\n for (const key of Object.keys(properties)) {\n const p = properties[key]\n p.map((d: Decoration) => {\n const value = d?.[1]?.[0]\n if (value?.[0] === 'u' && value[1]) contentUserIDs.add(value[1])\n })\n }\n\n return Array.from(contentUserIDs)\n}\n","export const idToUuid = (id = '') =>\n `${id.substr(0, 8)}-${id.substr(8, 4)}-${id.substr(12, 4)}-${id.substr(16, 4)}-${id.substr(20)}`\n","import { idToUuid } from './id-to-uuid'\n\nconst pageIdRe = /\\b([a-f0-9]{32})\\b/\nconst pageId2Re = /\\b([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})\\b/\n\n/**\n * Robustly extracts the notion page ID from a notion URL or pathname suffix.\n *\n * Defaults to returning a UUID (with dashes).\n */\nexport const parsePageId = (id: string | null = '', { uuid = true }: { uuid?: boolean } = {}) => {\n if (!id) return null\n\n id = id.split('?')[0]\n const match = id.match(pageIdRe)\n\n if (match) return uuid ? idToUuid(match[1]) : match[1]\n\n const match2 = id.match(pageId2Re)\n if (match2) return uuid ? match2[1] : match2[1].replace(/-/g, '')\n\n return null\n}\n","export const uuidToId = (uuid: string) => uuid.replace(/-/g, '')\n","import type { ExtendedRecordMap, Block, Collection } from '@texonom/ntypes'\n\nexport function findAncestors(recordMap: ExtendedRecordMap, block: Block | Collection, list: string[] = []): string[] {\n if (block.parent_id) {\n list.push(block.parent_id)\n const table = block.parent_table as 'block' | 'collection'\n if (recordMap[table]?.[block.parent_id]?.value)\n return findAncestors(recordMap, recordMap[table][block.parent_id].value, list)\n }\n return list\n}\n","import { findAncestors } from './find-ancestors'\nimport { getPageContentBlockIds } from './get-page-content-block-ids'\nimport { getBlockTitle } from './get-block-title'\n\nimport type { ExtendedRecordMap, PageMap, PageChunk, BlockMap } from '@texonom/ntypes'\n\nexport type PageTree = {\n id: string\n type: string\n title: string\n blocks: number\n pages: number\n parent?: PageTree\n children: PageTree[]\n}\n\ntype FetchOption = RequestInit & { timeout?: number }\n\n/**\n * Performs a traversal over a given Notion workspace starting from a seed page.\n *\n * Returns a map containing all of the pages that are reachable from the seed\n * page in the space.\n *\n * If `rootSpaceId` is not defined, the space ID of the root page will be used\n * to scope traversal.\n *\n *\n * @param rootPageId - Page ID to start from.\n * @param rootSpaceId - Space ID to scope traversal.\n * @param getPage - Function used to fetch a single page.\n * @param opts - Optional config\n */\nexport async function getAllInSpace(\n startPageId: string,\n getPage: (pageId: string, { fetchOption }?: { fetchOption?: FetchOption }) => Promise<ExtendedRecordMap>,\n getBlocks: (blockIds: string[], fetchOption?: FetchOption) => Promise<PageChunk>,\n fetchCollections: (\n contentBlockIds: string[],\n recordMap: ExtendedRecordMap,\n pageId?: string,\n {\n fetchOption,\n concurrency,\n collectionConcurrency\n }?: { fetchOption?: FetchOption; concurrency: number; collectionConcurrency?: number }\n ) => Promise<ExtendedRecordMap>,\n {\n startRecordMap,\n fetchOption = { timeout: 100000 },\n maxPage,\n debug,\n concurrency = 100,\n collectionConcurrency = 100\n }: {\n startRecordMap?: ExtendedRecordMap\n fetchOption?: FetchOption\n concurrency?: number\n maxPage?: number\n debug?: boolean\n collectionConcurrency?: number\n } = {}\n): Promise<{ recordMap: ExtendedRecordMap; pageMap: PageMap; pageTree: PageTree }> {\n const pageMap: PageMap = {}\n const recordMap = startRecordMap ? startRecordMap : await getPage(startPageId, { fetchOption })\n\n let tempRecordMap: ExtendedRecordMap = JSON.parse(JSON.stringify(recordMap))\n\n if (debug) console.time('Total fetch time')\n let iteration = 1\n while (true) {\n if (debug) console.debug(`Iteration ${iteration}`)\n if (debug) console.debug('block length ', Object.keys(recordMap.block).length)\n\n if (debug) console.time('getPageContentBlockIds')\n const targetBlocks = Object.keys(tempRecordMap.block)\n const missing = Object.keys(\n targetBlocks.reduce((blockMap, root) => {\n const contentBlockIds = getPageContentBlockIds(recordMap, root, true)\n for (const contentBlockID of contentBlockIds) if (!recordMap.block[contentBlockID]) blockMap[contentBlockID] = true\n return blockMap\n }, {})\n )\n for (const { value: block } of Object.values(tempRecordMap.block))\n if (block && !recordMap.block[block.parent_id] && block.parent_table === 'block') missing.push(block.parent_id)\n if (debug) console.timeEnd('getPageContentBlockIds')\n\n if (debug) console.time('getBlocks')\n tempRecordMap = (await getBlocks(missing, fetchOption)).recordMap as ExtendedRecordMap\n if (debug) console.timeEnd('getBlocks')\n if (!tempRecordMap?.block) break\n\n if (debug) console.time('mapBlocks')\n const contentBlockIds = Object.values(recordMap.block)\n .map(obj => obj.value?.id)\n .filter(Boolean)\n recordMap.block = { ...recordMap.block, ...tempRecordMap.block }\n if (debug) console.timeEnd('mapBlocks')\n\n if (debug) console.time('fetchCollections')\n await fetchCollections(contentBlockIds, recordMap, undefined, { fetchOption, concurrency, collectionConcurrency })\n if (debug) console.timeEnd('fetchCollections')\n if (debug) console.debug('collection query length ' + Object.keys(recordMap.collection_query).length)\n\n if (debug) console.debug('new block length ', Object.keys(tempRecordMap.block).length)\n const pageLength = Object.values(recordMap.block)\n .map(obj => obj.value?.type)\n .filter(type => type === 'page').length\n if (debug) console.debug('page length ', pageLength)\n if (Number.isInteger(maxPage) && pageLength >= maxPage) break\n\n if (debug) console.debug(`memory usage ${process.memoryUsage().rss / 1024 / 1024}MB`)\n iteration += 1\n if (debug) console.debug()\n }\n if (debug) console.timeEnd('Total fetch time')\n\n if (debug) console.time('get page map')\n if (debug) console.debug('Total block length ', Object.keys(recordMap.block).length)\n const blockIds = Object.keys(recordMap.block)\n\n const promises = []\n for (const blockId of blockIds)\n if (recordMap.block[blockId].value?.type === 'page') {\n promises.push(getPageSync(blockId, recordMap, getBlocks).then(pageRecordMap => (pageMap[blockId] = pageRecordMap)))\n await sleep(1)\n }\n await Promise.all(promises)\n\n if (debug) console.timeEnd('get page map')\n if (debug) console.debug('Total page length ', Object.keys(pageMap).length)\n\n if (debug) console.time('get page tree')\n const pageTree = {\n id: startPageId,\n title: getBlockTitle(recordMap.block[startPageId].value, recordMap),\n blocks: 1,\n pages: 1,\n children: [],\n type: 'page'\n }\n recursivePageTree(recordMap, pageTree)\n if (debug) console.timeEnd('get page tree')\n\n return { pageMap, pageTree, recordMap }\n}\n\nexport function recursivePageTree(recordMap: ExtendedRecordMap, pageTree: PageTree): PageTree {\n // Save ancestors to update the count\n const ancestors = [pageTree]\n let ancestor = pageTree\n while (true)\n if (ancestor.parent) {\n ancestors.push(ancestor.parent)\n ancestor = ancestor.parent\n } else {\n break\n }\n\n const current = recordMap.block[pageTree.id]?.value\n if (!current) {\n console.warn(`No block value for ${pageTree.id}`)\n delete pageTree.parent\n return pageTree\n }\n\n if (current.content?.length) {\n for (const ancestor of ancestors) ancestor.blocks += current.content.length\n for (const contentBlockId of current.content) {\n const block = recordMap.block[contentBlockId]?.value\n if (!block) continue\n pageTree.children.push(\n recursivePageTree(recordMap, {\n id: contentBlockId,\n title: getBlockTitle(block, recordMap),\n blocks: 1,\n pages: 0,\n children: [],\n type: block.type,\n parent: pageTree\n })\n )\n if (block.type === 'page') for (const ancestor of ancestors) ancestor.pages++\n }\n } else if (current?.type === 'collection_view') {\n const collectionQuery = recordMap.collection_query[current.collection_id]?.[current.view_ids[0]]\n if (!collectionQuery) {\n console.warn(`No collection query for ${pageTree.id}`)\n delete pageTree.parent\n return pageTree\n }\n const childrenMap = {}\n for (const collectionQuery of Object.values(recordMap.collection_query[current.collection_id]))\n if (collectionQuery.collection_group_results.blockIds)\n for (const blockId of collectionQuery.collection_group_results.blockIds) childrenMap[blockId] = true\n const childrenPages = Object.keys(childrenMap)\n for (const ancestor of ancestors) ancestor.pages += childrenPages.length\n for (const ancestor of ancestors) ancestor.blocks += childrenPages.length\n for (const blockId of childrenPages)\n pageTree.children.push(\n recursivePageTree(recordMap, {\n id: blockId,\n title: getBlockTitle(recordMap.block[blockId].value, recordMap),\n blocks: childrenPages.length,\n pages: childrenPages.length,\n children: [],\n type: current.type,\n parent: pageTree\n })\n )\n }\n delete pageTree.parent\n return pageTree\n}\n\nexport async function getPageSync(\n pageId: string,\n recordMap: ExtendedRecordMap,\n getBlocks: (blockIds: string[], fetchOption?: FetchOption) => Promise<PageChunk>\n): Promise<ExtendedRecordMap> {\n let contentBlockIds = getPageContentBlockIds(recordMap, pageId)\n let blockMap: BlockMap = { [pageId]: { value: recordMap.block[pageId].value, role: 'reader' } }\n const collectionMap = {}\n const collectionViewMap = {}\n const collectionQueryMap = {}\n\n const missing = []\n for (const contentBlockId of contentBlockIds) {\n const block = recordMap.block[contentBlockId]?.value\n if (!block) {\n missing.push(contentBlockId)\n continue\n }\n blockMap[contentBlockId] = { value: block, role: 'reader' }\n if (block.type === 'collection_view' || block.type === 'collection_view_page') {\n if (recordMap.collection[block.collection_id])\n collectionMap[block.collection_id] = recordMap.collection[block.collection_id]\n if (recordMap.collection_query[block.collection_id])\n collectionQueryMap[block.collection_id] = recordMap.collection_query[block.collection_id]\n for (const viewId of block.view_ids)\n if (recordMap.collection_view[viewId]) {\n collectionViewMap[viewId] = recordMap.collection_view[viewId]\n const blockIds = recordMap.collection_query[block?.collection_id]?.[viewId]?.collection_group_results?.blockIds\n if (blockIds?.length)\n for (const blockId of blockIds) {\n const block = recordMap.block[blockId]?.value\n if (block) blockMap[blockId] = { value: block, role: 'reader' }\n else missing.push(blockId)\n }\n }\n }\n }\n\n // Ancestor\n const ancesters = findAncestors(recordMap, recordMap.block[pageId].value)\n for (const ancester of ancesters) {\n const block = recordMap.block[ancester]?.value\n if (block) blockMap[ancester] = { value: block, role: 'reader' }\n const collection = recordMap.collection[ancester]?.value\n if (collection) collectionMap[ancester] = { value: collection }\n }\n\n // Alias\n for (const blockId of Object.keys(blockMap)) {\n const block = blockMap[blockId].value\n let targetBlock = block\n if (block?.type === 'alias')\n while (true) {\n const alias = targetBlock?.format?.alias_pointer?.id\n if (!alias) break\n targetBlock = recordMap.block[alias]?.value\n if (!targetBlock) missing.push(alias)\n else blockMap[alias] = { value: targetBlock, role: 'reader' }\n }\n }\n\n // Missing\n if (missing.length) {\n const responseMap = (await getBlocks(missing).catch(() => ({ recordMap: { block: null } }))).recordMap\n if (responseMap?.block) {\n blockMap = { ...blockMap, ...responseMap.block }\n for (const blockId in responseMap.block) recordMap.block[blockId] = responseMap.block[blockId]\n } else {\n console.warn(`fetching ${missing.length} fail for ${pageId}`)\n }\n }\n\n contentBlockIds = getPageContentBlockIds(recordMap, pageId)\n for (const contentBlockId of contentBlockIds) {\n const block = recordMap.block[contentBlockId]?.value\n if (!block) continue\n blockMap[contentBlockId] = { value: block, role: 'reader' }\n if (block.type === 'collection_view' || block.type === 'collection_view_page') {\n if (recordMap.collection[block.collection_id])\n collectionMap[block.collection_id] = recordMap.collection[block.collection_id]\n if (recordMap.collection_query[block.collection_id])\n collectionQueryMap[block.collection_id] = recordMap.collection_query[block.collection_id]\n for (const viewId of block.view_ids)\n if (recordMap.collection_view[viewId]) {\n collectionViewMap[viewId] = recordMap.collection_view[viewId]\n const blockIds = recordMap.collection_query[block?.collection_id]?.[viewId]?.collection_group_results?.blockIds\n if (blockIds?.length)\n for (const blockId of blockIds) {\n const block = recordMap.block[blockId]?.value\n if (block) blockMap[blockId] = { value: block, role: 'reader' }\n }\n }\n }\n }\n\n return {\n block: blockMap,\n collection: collectionMap,\n collection_view: collectionViewMap,\n collection_query: collectionQueryMap,\n signed_urls: {},\n notion_user: {}\n }\n}\n\nconst sleep = async (ms: number) => new Promise(resolve => setTimeout(resolve, ms))\n","export const normalizeTitle = (title?: string | null): string => {\n return (title || '')\n .replace(/( |\\/)/g, '-') // Replace spaces and slashes with dashes\n .replace(/[^a-zA-Z0-9-\\u4e00-\\u9FFF\\uAC00-\\uD7AF\\u3130-\\u318F\\u3041-\\u3096\\u30A1-\\u30FC\\u3000-\\u303F]/g, '') // Retain Korean characters\n .replace(/--+/g, '-') // Replace multiple dashes with a single dash\n .replace(/^-+|-+$/g, '') // Trim leading and trailing dashes\n .trim()\n .toLowerCase()\n}\n","import { getBlockTitle } from './get-block-title'\nimport { getPageProperty } from './get-page-property'\nimport { normalizeTitle } from './normalize-title'\nimport { getTextContent } from './get-text-content'\nimport { uuidToId } from './uuid-to-id'\n\nimport type { ExtendedRecordMap } from '@texonom/ntypes'\n\n/**\n * Gets the canonical, display-friendly version of a page's ID for use in URLs.\n */\nexport const getCanonicalPageId = (\n pageId: string,\n recordMap: ExtendedRecordMap,\n { uuid = true }: { uuid?: boolean } = {}\n): string | null => {\n if (!pageId || !recordMap) return null\n\n const id = uuidToId(pageId)\n const block = recordMap.block[pageId]?.value\n\n if (block) {\n const slug =\n (getPageProperty('slug', block, recordMap) as string | null) || normalizeTitle(getBlockTitle(block, recordMap))\n\n if (slug)\n if (uuid) return `${slug}-${id}`\n else return slug\n } else {\n const collection = recordMap.collection[pageId]?.value\n if (collection) {\n const slug = normalizeTitle(getTextContent(collection.name))\n if (slug)\n if (uuid) return `${slug}-${id}`\n else return slug\n }\n }\n\n return id\n}\n","import { getBlockIcon } from './get-block-icon'\nimport { getBlockParentPage } from './get-block-parent-page'\nimport { getBlockTitle } from './get-block-title'\n\nimport type { ExtendedRecordMap } from '@texonom/ntypes'\n\nexport const getPageBreadcrumbs = (recordMap: ExtendedRecordMap, activePageId: string): Array<any> | null => {\n const blockMap = recordMap.block\n const breadcrumbs = []\n\n let currentPageId = activePageId\n\n do {\n const block = blockMap[currentPageId]?.value\n if (!block) break\n\n const title = getBlockTitle(block, recordMap)\n const icon = getBlockIcon(block, recordMap)\n\n if (!(title || icon)) break\n\n breadcrumbs.push({\n block,\n active: currentPageId === activePageId,\n pageId: currentPageId,\n title,\n icon\n })\n\n const parentBlock = getBlockParentPage(block, recordMap)\n const parentId = parentBlock?.id\n\n if (!parentId) break\n\n currentPageId = parentId\n\n // eslint-disable-next-line no-constant-condition\n } while (true)\n\n breadcrumbs.reverse()\n\n return breadcrumbs\n}\n","import { getBlockIcon } from './get-block-icon'\nimport { isUrl } from './is-url'\n\nimport type { Block, ExtendedRecordMap } from '@texonom/ntypes'\n\n/**\n * Gets URLs of all images contained on the given page.\n */\nexport const getPageImageUrls = (\n recordMap: ExtendedRecordMap,\n {\n mapImageUrl\n }: {\n mapImageUrl: (url: string, block: Block) => string | null\n }\n): string[] => {\n const blockIds = Object.keys(recordMap.block)\n const imageUrls: string[] = blockIds\n .flatMap(blockId => {\n const block = recordMap.block[blockId]?.value\n const images: Array<{ block: Block; url: string }> = []\n\n if (block) {\n if (block.type === 'image') {\n const signedUrl = recordMap.signed_urls?.[block.id]\n let source = signedUrl || block.properties?.source?.[0]?.[0]\n if (source.includes('file.notion.so')) source = block.properties?.source?.[0]?.[0]\n\n if (source)\n images.push({\n block,\n url: source\n })\n }\n\n if (block.format?.page_cover) {\n const source = block.format.page_cover\n\n images.push({\n block,\n url: source\n })\n }\n\n if (block.format?.bookmark_cover) {\n const source = block.format.bookmark_cover\n\n images.push({\n block,\n url: source\n })\n }\n\n if (block.format?.bookmark_icon) {\n const source = block.format.bookmark_icon\n\n images.push({\n block,\n url: source\n })\n }\n\n const pageIcon = getBlockIcon(block, recordMap)\n if (pageIcon && isUrl(pageIcon))\n images.push({\n block,\n url: pageIcon\n })\n }\n\n return images\n })\n .filter(Boolean)\n .map(({ block, url }) => mapImageUrl(url, block))\n .filter(Boolean)\n\n return Array.from(new Set(imageUrls))\n}\n","import type { Decoration } from '@texonom/ntypes'\n\n/**\n * Block types whose title an on-page editor replaces as plain text.\n *\n * The renderer that draws the editor and a host that stores the edits read the\n * same list, so an edit can only land on a block the page can show it on.\n */\nexport const EDITABLE_BLOCK_TYPES: ReadonlySet<string> = new Set([\n 'text',\n 'header',\n 'sub_header',\n 'sub_sub_header',\n 'bulleted_list',\n 'numbered_list'\n])\n\n/**\n * A title a plain-text edit can replace without losing anything.\n *\n * Bold, a link, a mention or an inline equation lives in a segment's second\n * element, and replacing a title that carries one would silently drop it.\n */\nexport const isPlainTitle = (title: unknown): title is Decoration[] =>\n Array.isArray(title) &&\n title.every(\n segment =>\n Array.isArray(segment) &&\n typeof segment[0] === 'string' &&\n (segment[1] === undefined || (Array.isArray(segment[1]) && segment[1].length === 0))\n )\n\n/** Whether a block's title can be edited in place as plain text. */\nexport const isEditableBlock = (block: { type: string; properties?: Record<string, unknown> }): boolean =>\n EDITABLE_BLOCK_TYPES.has(block.type) && isPlainTitle(block.properties?.title)\n","const copyProperty = (to, from, property, ignoreNonConfigurable) => {\n\t// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.\n\t// `Function#prototype` is non-writable and non-configurable so can never be modified.\n\tif (property === 'length' || property === 'prototype') {\n\t\treturn;\n\t}\n\n\t// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.\n\tif (property === 'arguments' || property === 'caller') {\n\t\treturn;\n\t}\n\n\tconst toDescriptor = Object.getOwnPropertyDescriptor(to, property);\n\tconst fromDescriptor = Object.getOwnPropertyDescriptor(from, property);\n\n\tif (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {\n\t\treturn;\n\t}\n\n\tObject.defineProperty(to, property, fromDescriptor);\n};\n\n// `Object.defineProperty()` throws if the property exists, is not configurable and either:\n// - one its descriptors is changed\n// - it is non-writable and its value is changed\nconst canCopyProperty = function (toDescriptor, fromDescriptor) {\n\treturn toDescriptor === undefined || toDescriptor.configurable || (\n\t\ttoDescriptor.writable === fromDescriptor.writable\n\t\t&& toDescriptor.enumerable === fromDescriptor.enumerable\n\t\t&& toDescriptor.configurable === fromDescriptor.configurable\n\t\t&& (toDescriptor.writable || toDescriptor.value === fromDescriptor.value)\n\t);\n};\n\nconst changePrototype = (to, from) => {\n\tconst fromPrototype = Object.getPrototypeOf(from);\n\tif (fromPrototype === Object.getPrototypeOf(to)) {\n\t\treturn;\n\t}\n\n\tObject.setPrototypeOf(to, fromPrototype);\n};\n\nconst wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\\n${fromBody}`;\n\nconst toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');\nconst toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');\n\n// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.\n// We use `bind()` instead of a closure for the same reason.\n// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.\nconst changeToString = (to, from, name) => {\n\tconst withName = name === '' ? '' : `with ${name.trim()}() `;\n\tconst newToString = wrappedToString.bind(null, withName, from.toString());\n\t// Ensure `to.toString.toString` is non-enumerable and has the same `same`\n\tObject.defineProperty(newToString, 'name', toStringName);\n\tconst {writable, enumerable, configurable} = toStringDescriptor; // We destructue to avoid a potential `get` descriptor.\n\tObject.defineProperty(to, 'toString', {value: newToString, writable, enumerable, configurable});\n};\n\nexport default function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {\n\tconst {name} = to;\n\n\tfor (const property of Reflect.ownKeys(from)) {\n\t\tcopyProperty(to, from, property, ignoreNonConfigurable);\n\t}\n\n\tchangePrototype(to, from);\n\tchangeToString(to, from, name);\n\n\treturn to;\n}\n","import mimicFunction from 'mimic-function';\nconst maxTimeoutValue = 2_147_483_647;\nconst cacheStore = new WeakMap();\nconst cacheTimerStore = new WeakMap();\nconst cacheKeyStore = new WeakMap();\nfunction getValidCacheItem(cache, key) {\n const item = cache.get(key);\n if (!item) {\n return undefined;\n }\n if (item.maxAge <= Date.now()) {\n cache.delete(key);\n return undefined;\n }\n return item;\n}\nfunction validateMaxAge(value, source) {\n if (value === Number.POSITIVE_INFINITY) {\n return;\n }\n if (!Number.isFinite(value)) {\n if (source === '`maxAge` option') {\n throw new TypeError('The `maxAge` option must be a finite number, `0`, or `Infinity`.');\n }\n throw new TypeError('The `maxAge` function must return a finite number, `0`, or `Infinity`.');\n }\n if (value > maxTimeoutValue) {\n if (source === '`maxAge` option') {\n throw new TypeError(`The \\`maxAge\\` option cannot exceed ${maxTimeoutValue}.`);\n }\n throw new TypeError(`The \\`maxAge\\` function result cannot exceed ${maxTimeoutValue}.`);\n }\n}\nfunction getPropertyDescriptor(object, property) {\n let currentObject = object;\n while (currentObject) {\n const descriptor = Object.getOwnPropertyDescriptor(currentObject, property);\n if (descriptor) {\n return descriptor;\n }\n const prototype = Object.getPrototypeOf(currentObject);\n currentObject = prototype === null ? undefined : prototype;\n }\n return undefined;\n}\n/**\n[Memoize](https://en.wikipedia.org/wiki/Memoization) functions - An optimization used to speed up consecutive function calls by caching the result of calls with identical input.\n\n@param function_ - The function to be memoized.\n\n@example\n```\nimport memoize from 'memoize';\n\nlet index = 0;\nconst counter = () => ++index;\nconst memoized = memoize(counter);\n\nmemoized('foo');\n//=> 1\n\n// Cached as it's the same argument\nmemoized('foo');\n//=> 1\n\n// Not cached anymore as the arguments changed\nmemoized('bar');\n//=> 2\n\nmemoized('bar');\n//=> 2\n```\n*/\nexport default function memoize(function_, { cacheKey, cache = new Map(), maxAge, } = {}) {\n if (typeof maxAge === 'number') {\n validateMaxAge(maxAge, '`maxAge` option');\n if (maxAge <= 0) {\n return function_;\n }\n }\n const memoized = function (...arguments_) {\n const key = cacheKey ? cacheKey(arguments_) : arguments_[0];\n const cacheItem = getValidCacheItem(cache, key);\n if (cacheItem) {\n return cacheItem.data;\n }\n const result = function_.apply(this, arguments_);\n const computedMaxAge = typeof maxAge === 'function' ? maxAge(...arguments_) : maxAge;\n if (computedMaxAge !== undefined && computedMaxAge !== Number.POSITIVE_INFINITY) {\n validateMaxAge(computedMaxAge, '`maxAge` function result');\n if (computedMaxAge <= 0) {\n return result; // Do not cache\n }\n }\n cache.set(key, {\n data: result,\n maxAge: (computedMaxAge === undefined || computedMaxAge === Number.POSITIVE_INFINITY)\n ? Number.POSITIVE_INFINITY\n : Date.now() + computedMaxAge,\n });\n if (computedMaxAge !== undefined && computedMaxAge !== Number.POSITIVE_INFINITY) {\n const timer = setTimeout(() => {\n cache.delete(key);\n cacheTimerStore.get(memoized)?.delete(timer);\n }, computedMaxAge);\n timer.unref?.();\n const timers = cacheTimerStore.get(memoized) ?? new Set();\n timers.add(timer);\n cacheTimerStore.set(memoized, timers);\n }\n return result;\n };\n mimicFunction(memoized, function_, {\n ignoreNonConfigurable: true,\n });\n cacheStore.set(memoized, cache);\n cacheKeyStore.set(memoized, (cacheKey ?? ((arguments_) => arguments_[0])));\n return memoized;\n}\n/**\n@returns A [decorator](https://github.com/tc39/proposal-decorators) to memoize class methods, static class methods, or getters.\n\n@example\n```\nimport {memoizeDecorator} from 'memoize';\n\nclass Example {\n index = 0\n\n @memoizeDecorator()\n counter() {\n return ++this.index;\n }\n}\n\nclass ExampleWithOptions {\n index = 0\n\n @memoizeDecorator({maxAge: 1000})\n counter() {\n return ++this.index;\n }\n}\n\nclass ExampleWithGetter {\n @memoizeDecorator()\n get value() {\n return expensiveComputation();\n }\n}\n```\n*/\nexport function memoizeDecorator(options = {}) {\n function decorator(target, context) {\n if (context.kind === 'method') {\n if (context.private) {\n throw new TypeError('The `memoizeDecorator` method decorator does not support private methods.');\n }\n const memoizedMethods = new WeakMap();\n const getMemoizedMethod = (receiver) => {\n let memoizedMethod = memoizedMethods.get(receiver);\n if (!memoizedMethod) {\n memoizedMethod = memoize(target.bind(receiver), options);\n memoizedMethods.set(receiver, memoizedMethod);\n }\n return memoizedMethod;\n };\n const installMethod = (receiver, method) => {\n Object.defineProperty(receiver, context.name, {\n configurable: true,\n enumerable: false,\n value: method,\n writable: true,\n });\n return method;\n };\n const installStaticMethodGetter = (receiver) => {\n Object.defineProperty(receiver, context.name, {\n configurable: true,\n enumerable: false,\n get() {\n const currentReceiver = this;\n if (currentReceiver !== receiver) {\n const currentPrototype = Object.getPrototypeOf(currentReceiver);\n if (currentPrototype === receiver\n && !Object.hasOwn(currentReceiver, context.name)) {\n installStaticMethodGetter(currentReceiver);\n }\n }\n return getMemoizedMethod(currentReceiver);\n },\n });\n };\n const decoratedMethod = function (...arguments_) {\n return getMemoizedMethod(this)(...arguments_);\n };\n mimicFunction(decoratedMethod, target, {\n ignoreNonConfigurable: true,\n });\n if (context.static) {\n context.addInitializer(function () {\n installStaticMethodGetter(this);\n });\n }\n else {\n context.addInitializer(function () {\n const receiver = this;\n // Checking the descriptor avoids invoking an overriding accessor while `super()` is still running.\n const descriptor = getPropertyDescriptor(Object.getPrototypeOf(receiver), context.name);\n if (descriptor?.value !== decoratedMethod) {\n return;\n }\n installMethod(receiver, getMemoizedMethod(receiver));\n });\n }\n return decoratedMethod;\n }\n const memoizedGetters = new WeakMap();\n return function () {\n let memoizedGetter = memoizedGetters.get(this);\n if (!memoizedGetter) {\n memoizedGetter = memoize(() => target.call(this), options);\n memoizedGetters.set(this, memoizedGetter);\n }\n return memoizedGetter();\n };\n }\n return decorator;\n}\n/**\nClear all cached data of a memoized function.\n\n@param function_ - The memoized function.\n*/\nexport function memoizeClear(function_) {\n const cache = cacheStore.get(function_);\n if (!cache) {\n throw new TypeError('Can\\'t clear a function that was not memoized!');\n }\n if (typeof cache.clear !== 'function') {\n throw new TypeError('The cache Map can\\'t be cleared!');\n }\n cache.clear();\n for (const timer of cacheTimerStore.get(function_) ?? []) {\n clearTimeout(timer);\n }\n cacheTimerStore.delete(function_);\n}\n/**\nCheck if a specific set of arguments is cached for a memoized function.\n\n@param function_ - The memoized function.\n@param arguments_ - The arguments to check.\n@returns `true` if the arguments are cached and not expired, `false` otherwise.\n\nUses the same argument processing as the memoized function, including any custom `cacheKey` function.\n\n@example\n```\nimport memoize, {memoizeIsCached} from 'memoize';\n\nconst expensive = memoize((a, b) => a + b, {cacheKey: JSON.stringify});\nexpensive(1, 2);\n\nmemoizeIsCached(expensive, 1, 2);\n//=> true\n\nmemoizeIsCached(expensive, 3, 4);\n//=> false\n```\n*/\nexport function memoizeIsCached(function_, ...arguments_) {\n const cacheKey = cacheKeyStore.get(function_);\n if (!cacheKey) {\n return false;\n }\n const cache = cacheStore.get(function_);\n const key = cacheKey(arguments_);\n const item = getValidCacheItem(cache, key);\n return item !== undefined;\n}\n","import memoize from 'memoize'\nimport normalizeUrlImpl from 'normalize-url'\n\nexport const normalizeUrl = memoize((url?: string) => {\n if (!url) return ''\n\n try {\n if (url.startsWith('https://www.notion.so/image/')) {\n const u = new URL(url)\n const subUrl = decodeURIComponent(u.pathname.substring('/image/'.length))\n const normalizedSubUrl = normalizeUrl(subUrl)\n u.pathname = `/image/${encodeURIComponent(normalizedSubUrl)}`\n url = u.toString()\n }\n\n return normalizeUrlImpl(url, {\n stripProtocol: true,\n stripWWW: true,\n stripHash: true,\n stripTextFragment: true,\n removeQueryParameters: true\n })\n } catch (err) {\n return ''\n }\n})\n","import type { ExtendedRecordMap } from '@texonom/ntypes'\n\nexport function mergeRecordMaps(recordMapA: ExtendedRecordMap, recordMapB: ExtendedRecordMap): ExtendedRecordMap {\n const mergedRecordMap: ExtendedRecordMap = {\n block: {\n ...recordMapA.block,\n ...recordMapB.block\n },\n collection: {\n ...recordMapA.collection,\n ...recordMapB.collection\n },\n collection_view: {\n ...recordMapA.collection_view,\n ...recordMapB.collection_view\n },\n notion_user: {\n ...recordMapA.notion_user,\n ...recordMapB.notion_user\n },\n collection_query: {\n ...recordMapA.collection_query,\n ...recordMapB.collection_query\n },\n signed_urls: {\n ...recordMapA.signed_urls,\n ...recordMapB.signed_urls\n },\n preview_images: {\n ...recordMapA.preview_images,\n ...recordMapB.preview_images\n }\n }\n\n return mergedRecordMap\n}\n","export const formatDate = (input: string | number, { month = 'short' }: { month?: 'long' | 'short' } = {}) => {\n const date = new Date(input)\n const monthLocale = date.toLocaleString('en-US', { month })\n return `${date.getUTCFullYear()} ${monthLocale} ${date.getUTCDate()} ${date.getUTCHours()}:${date.getUTCMinutes()}`\n}\n","import { formatDate } from './format-date'\n\nexport interface NotionDateTime {\n type: 'datetime'\n start_date: string\n start_time?: string\n time_zone?: string\n}\n\nexport const formatNotionDateTime = (datetime: NotionDateTime) => {\n const dateString = `${datetime.start_time || ''} ${datetime.start_date} ${datetime.time_zone || ''}`\n return formatDate(dateString)\n}\n","import { Block, ExtendedRecordMap, PageBlock } from '@texonom/ntypes'\n\nimport { getBlockTitle } from './get-block-title'\nimport { getPageTableOfContents } from './get-page-table-of-contents'\n\ntype EstimatePageReadTimeOptions = {\n wordsPerMinute?: number\n imageReadTimeInSeconds?: number\n}\n\ntype ContentStats = {\n numWords: number\n numImages: number\n}\n\ntype PageReadTimeEstimate = ContentStats & {\n totalWordsReadTimeInMinutes: number\n totalImageReadTimeInMinutes: number\n totalReadTimeInMinutes: number\n}\n\n/**\n * Returns an estimate for the time it would take for a person to read the content\n * in the given Notion page.\n *\n * Uses Medium for inspiration.\n *\n * @see https://blog.medium.com/read-time-and-you-bc2048ab620c\n * @see https://github.com/ngryman/reading-time\n *\n * TODO: handle non-english content.\n */\nexport function estimatePageReadTime(\n block: Block,\n recordMap: ExtendedRecordMap,\n { wordsPerMinute = 275, imageReadTimeInSeconds = 12 }: EstimatePageReadTimeOptions = {}\n): PageReadTimeEstimate {\n const stats = getBlockContentStats(block, recordMap)\n const totalWordsReadTimeInMinutes = stats.numWords / wordsPerMinute\n const totalImageReadTimeInSeconds =\n stats.numImages > 10\n ? (stats.numImages / 2) * (imageReadTimeInSeconds + 3) + (stats.numImages - 10) * 3 // n/2(a+b) + 3 sec/image\n : (stats.numImages / 2) * (2 * imageReadTimeInSeconds + (1 - stats.numImages)) // n/2[2a+(n-1)d]\n const totalImageReadTimeInMinutes = totalImageReadTimeInSeconds / 60\n\n const totalReadTimeInMinutes = totalWordsReadTimeInMinutes + totalImageReadTimeInMinutes\n\n return {\n ...stats,\n totalWordsReadTimeInMinutes,\n totalImageReadTimeInMinutes,\n totalReadTimeInMinutes\n }\n}\n\n/**\n * Same as `estimatePageReadTime`, except it returns the total time estimate as\n * a human-readable string.\n *\n * For example, \"9 minutes\" or \"less than a minute\".\n */\nexport function estimatePageReadTimeAsHumanizedString(\n block: Block,\n recordMap: ExtendedRecordMap,\n opts: EstimatePageReadTimeOptions\n) {\n const estimate = estimatePageReadTime(block, recordMap, opts)\n return humanizeReadTime(estimate.totalReadTimeInMinutes)\n}\n\nfunction getBlockContentStats(block: Block, recordMap: ExtendedRecordMap): ContentStats {\n const stats: ContentStats = {\n numWords: 0,\n numImages: 0\n }\n\n if (!block) return stats\n\n for (const childId of block.content || []) {\n const child = recordMap.block[childId]?.value\n let recurse = false\n if (!child) continue\n\n switch (child.type) {\n case 'quote':\n // fallthrough\n case 'alias':\n // fallthrough\n case 'header':\n // fallthrough\n case 'sub_header':\n // fallthrough\n case 'sub_sub_header': {\n const title = getBlockTitle(child, recordMap)\n stats.numWords += countWordsInText(title)\n break\n }\n\n case 'callout':\n // fallthrough\n case 'toggle':\n // fallthrough\n case 'to_do':\n // fallthrough\n case 'bulleted_list':\n // fallthrough\n case 'numbered_list':\n // fallthrough\n case 'text': {\n const title = getBlockTitle(child, recordMap)\n stats.numWords += countWordsInText(title)\n recurse = true\n break\n }\n\n case 'embed':\n // fallthrough\n case 'tweet':\n // fallthrough\n case 'maps':\n // fallthrough\n case 'pdf':\n // fallthrough\n case 'figma':\n // fallthrough\n case 'typeform':\n // fallthrough\n case 'codepen':\n // fallthrough\n case 'excalidraw':\n // fallthrough\n case 'gist':\n // fallthrough\n case 'video':\n // fallthrough\n case 'drive':\n // fallthrough\n case 'audio':\n // fallthrough\n case 'file':\n // fallthrough\n case 'image':\n // treat all embeds as images\n stats.numImages += 1\n break\n\n case 'bookmark':\n // treat bookmarks as quarter images since they aren't as content-ful as embedd images\n stats.numImages += 0.25\n break\n\n case 'code':\n // treat code blocks as double the complexity of images\n stats.numImages += 2\n break\n\n case 'table':\n // fallthrough\n case 'collection_view':\n // treat collection views as double the complexity of images\n stats.numImages += 2\n break\n\n case 'column':\n // fallthrough\n case 'column_list':\n // fallthrough\n case 'transclusion_container':\n recurse = true\n break\n\n case 'table_of_contents': {\n const page = block as PageBlock\n if (!page) continue\n\n const toc = getPageTableOfContents(page, recordMap)\n for (const tocItem of toc) stats.numWords += countWordsInText(tocItem.text)\n\n break\n }\n\n case 'transclusion_reference': {\n const referencePointerId = child?.format?.transclusion_reference_pointer?.id\n\n if (!referencePointerId) continue\n\n const referenceBlock = recordMap.block[referencePointerId]?.value\n if (referenceBlock) mergeContentStats(stats, getBlockContentStats(referenceBlock, recordMap))\n\n break\n }\n\n default:\n // ignore unrecognized blocks\n break\n }\n\n if (recurse) mergeContentStats(stats, getBlockContentStats(child, recordMap))\n }\n\n return stats\n}\n\nfunction mergeContentStats(statsA: ContentStats, statsB: ContentStats) {\n statsA.numWords += statsB.numWords\n statsA.numImages += statsB.numImages\n}\n\nfunction countWordsInText(text: string): number {\n if (!text) return 0\n\n return (text.match(/\\w+/g) || []).length\n}\n\nfunction humanizeReadTime(time: number): string {\n if (time < 0.5) return 'less than a minute'\n\n if (time < 1.5) return '1 minute'\n\n return `${Math.ceil(time)} minutes`\n}\n","import { Block } from '@texonom/ntypes'\n\nexport const defaultMapImageUrl = (url: string, block: Block): string | null => {\n if (!url) return null\n\n if (url.startsWith('data:')) return url\n\n // more recent versions of notion don't proxy unsplash images\n if (url.startsWith('https://images.unsplash.com')) return url\n\n // Don't proxy external URLs that aren't from Notion or AWS S3\n // The notion.so/image/ proxy frequently fails for arbitrary external URLs\n try {\n const u = new URL(url)\n if (\n (u.protocol === 'https:' || u.protocol === 'http:') &&\n !u.hostname.endsWith('.notion.so') &&\n !u.hostname.endsWith('.amazonaws.com') &&\n u.hostname !== 'www.notion.so' &&\n u.hostname !== 'notion.so'\n )\n return url\n } catch {\n // ignore invalid urls\n }\n\n try {\n const u = new URL(url)\n\n if (u.pathname.startsWith('/secure.notion-static.com') && u.hostname.endsWith('.amazonaws.com'))\n if (\n u.searchParams.has('X-Amz-Credential') &&\n u.searchParams.has('X-Amz-Signature') &&\n u.searchParams.has('X-Amz-Algorithm')\n )\n // if the URL is already signed, then use it as-is\n return url\n\n // external HTTPS URLs that aren't from notion.so or amazonaws should bypass the proxy\n if (u.protocol === 'https:' && !u.hostname.endsWith('notion.so') && !u.hostname.endsWith('amazonaws.com')) return url\n } catch {\n // ignore invalid urls\n }\n\n if (url.startsWith('/images')) url = `https://www.notion.so${url}`\n\n url = `https://www.notion.so${url.startsWith('/image') ? url : `/image/${encodeURIComponent(url)}`}`\n\n const notionImageUrlV2 = new URL(url)\n let table = block.parent_table === 'space' ? 'block' : block.parent_table\n if (table === 'collection' || table === 'team') table = 'block'\n\n notionImageUrlV2.searchParams.set('table', table)\n notionImageUrlV2.searchParams.set('id', block.id)\n notionImageUrlV2.searchParams.set('cache', 'v2')\n\n url = notionImageUrlV2.toString()\n\n return url\n}\n","export const defaultMapPageUrl = (rootPageId?: string) => (pageId: string) => {\n pageId = (pageId || '').replace(/-/g, '')\n\n if (rootPageId && pageId === rootPageId) return '/'\n else return `/${pageId}`\n}\n"],"ignoreList":[20,21],"mappings":";;;AAQA,IAAaE,KAAkB,MAAgC;;CAIxD,OAHAE,IACI,MAAM,QAAQA,CAAI,KACzB,IAAAA,KAAA,OAAA,KAAA,IAAOA,EAAM,QAAQ,GAAM,MAAYC,KAAQC,EAAQ,OAAO,OAAOA,EAAQ,OAAO,MAAMA,EAAQ,KAAK,KAAK,EAAE,MAAA,OAAK,KAALH,IACpGC,IAHM;AAIpB;;;ACXA,SAAgBG,EAAqB,GAAc,GAA6C;;CAC9F,IAAMG,IACHC,EAA8B,mBAAA,IAAkBA,EAA8B,WAAA,SAAA,IAAAH,EAAQ,uBAAA,OAAA,KAAA,IAAAA,EAAoB;CAE7G,IAAIE,GAAc,OAAOA;CAEzB,IAAME,IAAAD,KAAA,SAAA,IAAoBA,EAA+B,aAAA,OAAA,KAAA,IAAAF,EAAW;CACpE,IAAIG,GAAkB;;EACpB,IAAME,KAAA,IAAiBC,EAAU,oBAAA,SAAA,IAAAF,EAAkBD,OAAA,OAAA,KAAA,IAAAC,EAAmB;EACtE,IAAIC,GAAgB;;GAElB,QAAA,IADqBA,EAAe,WAAA,SAAA,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C,IAAI9H"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["isUrl","normalizeUrlImpl","getTextContent","_text$reduce","text","prev","current","getBlockCollectionId","_block$format","_block$view_ids","collectionId","block","collectionViewId","_recordMap$collection","collectionView","recordMap","_collectionView$forma","getBlockTitle","_block$properties","collection","getBlockIcon","_block$format2","getPageTitle","_recordMap$block$Obje","pageBlock","getPageProperty","propertyNameL","propertyName","propertyId","_collection$schema$ke","key","content","type","formatDate","start_date","start_time","end_date","end_time","_unused","getDateValue","prop","v","value","getBlockParentPage","currentRecord","inclusive","parentId","parentTable","_recordMap$block$pare","getBlockParent","_recordMap$collection2","_recordMap$space","_recordMap$block$pare2","indentLevels","getPageTableOfContents","_page$content","toc","page","_recordMap$block$bloc","blockId","indentLevelStack","tocItem","actual","indentLevel","prevActual","prevEffective","getPageContentBlockIds","rootBlockId","contentBlockIds","addContentBlocks","properties","p","_d$","d","_d$2","format","_format$transclusion_","referenceId","locust","getPageContentUserIds","_recordMap$block$root","contentUserIDs","_d$3","idToUuid","id","pageIdRe","pageId2Re","parsePageId","match","uuid","match2","uuidToId","findAncestors","_recordMap$table","table","list","_typeof","o","toPrimitive","t","e","i","r","toPropertyKey","_defineProperty","ownKeys","_objectSpread2","asyncGeneratorStep","n","c","u","_asyncToGenerator","_next","_throw","getAllInSpace","_getAllInSpace","pageMap","startRecordMap","getPage","startPageId","tempRecordMap","debug","iteration","targetBlocks","missing","root","contentBlockID","blockMap","getBlocks","fetchOption","_obj$value","obj","fetchCollections","pageLength","_obj$value2","maxPage","blockIds","promises","getPageSync","pageRecordMap","sleep","pageTree","recursivePageTree","_recordMap$block$page","_current$content","ancestors","ancestor","contentBlockId","_recordMap$block$cont","childrenMap","collectionQuery","childrenPages","_getPageSync","pageId","collectionMap","collectionViewMap","collectionQueryMap","_recordMap$block$cont2","viewId","_recordMap$block$bloc2","ancesters","ancester","_recordMap$block$ance","_recordMap$collection3","targetBlock","_targetBlock$format","_recordMap$block$alia","alias","responseMap","_recordMap$block$cont3","_recordMap$collection4","_recordMap$block$bloc3","_ref","resolve","ms","normalizeTitle","title","getCanonicalPageId","slug","getPageBreadcrumbs","breadcrumbs","currentPageId","activePageId","_blockMap$currentPage","icon","parentBlock","getPageImageUrls","imageUrls","images","_block$format3","_recordMap$signed_url","_block$properties2","source","pageIcon","mapImageUrl","url","EDITABLE_BLOCK_TYPES","isPlainTitle","segment","isEditableBlock","TITLE_STYLES","TITLE_INLINES","isRoundTrippableTitle","inlines","code","IN_PLACE_BLOCK_TYPES","isEditableInPlace","copyProperty","property","toDescriptor","to","fromDescriptor","from","canCopyProperty","changePrototype","fromPrototype","wrappedToString","withName","fromBody","toStringDescriptor","toStringName","changeToString","name","newToString","mimicFunction","ignoreNonConfigurable","maxTimeoutValue","cacheStore","cacheTimerStore","cacheKeyStore","getValidCacheItem","item","cache","validateMaxAge","memoize","maxAge","function_","memoized","arguments_","cacheKey","cacheItem","result","computedMaxAge","_timer$unref","_cacheTimerStore$get2","timer","_cacheTimerStore$get","timers","normalizeUrl","normalizedSubUrl","err","mergeRecordMaps","recordMapA","recordMapB","date","input","monthLocale","formatNotionDateTime","datetime","estimatePageReadTime","stats","getBlockContentStats","totalWordsReadTimeInMinutes","wordsPerMinute","totalImageReadTimeInMinutes","imageReadTimeInSeconds","totalReadTimeInMinutes","estimatePageReadTimeAsHumanizedString","humanizeReadTime","opts","childId","_recordMap$block$chil","child","recurse","countWordsInText","_child$format","_recordMap$block$refe","referencePointerId","referenceBlock","mergeContentStats","statsB","time","defaultMapImageUrl","_unused2","notionImageUrlV2","defaultMapPageUrl","rootPageId"],"sources":["../src/get-text-content.ts","../src/get-block-collection-id.ts","../src/get-block-title.ts","../src/get-block-icon.ts","../src/get-page-title.ts","../src/get-page-property.ts","../src/get-date-value.ts","../src/get-block-parent-page.ts","../src/get-page-table-of-contents.ts","../src/get-page-content-block-ids.ts","../src/id-to-uuid.ts","../src/parse-page-id.ts","../src/uuid-to-id.ts","../src/find-ancestors.ts","../src/get-all-in-space.ts","../src/normalize-title.ts","../src/get-canonical-page-id.ts","../src/get-page-breadcrumbs.ts","../src/get-page-image-urls.ts","../src/is-editable-block.ts","../../../node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js","../../../node_modules/.pnpm/memoize@11.0.0/node_modules/memoize/distribution/index.js","../src/normalize-url.ts","../src/merge-record-maps.ts","../src/format-date.ts","../src/format-notion-date-time.ts","../src/estimate-page-read-time.ts","../src/map-image-url.ts","../src/map-page-url.ts"],"sourcesContent":["import type { Decoration } from '@texonom/ntypes'\n\n/**\n * Gets the raw, unformatted text content of a block's content value.\n *\n * This is useful, for instance, for extracting a block's `title` without any\n * rich text formatting.\n */\nexport const getTextContent = (text?: Decoration[]): string => {\n if (!text) return ''\n else if (Array.isArray(text))\n return text?.reduce((prev, current) => prev + (current[0] !== '⁍' && current[0] !== '‣' ? current[0] : ''), '') ?? ''\n else return text\n}\n","import type { Block, CollectionViewBlock, ExtendedRecordMap } from '@texonom/ntypes'\n\nexport function getBlockCollectionId(block: Block, recordMap: ExtendedRecordMap): string | null {\n const collectionId =\n (block as CollectionViewBlock).collection_id || (block as CollectionViewBlock).format?.collection_pointer?.id\n\n if (collectionId) return collectionId\n\n const collectionViewId = (block as CollectionViewBlock)?.view_ids?.[0]\n if (collectionViewId) {\n const collectionView = recordMap.collection_view?.[collectionViewId]?.value\n if (collectionView) {\n const collectionId = collectionView.format?.collection_pointer?.id\n return collectionId\n }\n }\n\n return null\n}\n","import { getBlockCollectionId } from './get-block-collection-id'\nimport { getTextContent } from './get-text-content'\n\nimport type { Block, ExtendedRecordMap } from '@texonom/ntypes'\n\nexport function getBlockTitle(block: Block, recordMap: ExtendedRecordMap) {\n if (block.properties?.title) return getTextContent(block.properties.title)\n\n if (block.type === 'collection_view_page' || block.type === 'collection_view') {\n const collectionId = getBlockCollectionId(block, recordMap)\n if (collectionId) {\n const collection = recordMap.collection[collectionId]?.value\n if (collection) return getTextContent(collection.name)\n }\n }\n return ''\n}\n","import { getBlockCollectionId } from './get-block-collection-id'\n\nimport type { Block, ExtendedRecordMap, PageBlock } from '@texonom/ntypes'\n\nexport function getBlockIcon(block: Block, recordMap: ExtendedRecordMap) {\n if ((block as PageBlock).format?.page_icon) return (block as PageBlock).format?.page_icon\n\n if (block.type === 'collection_view_page' || block.type === 'collection_view') {\n const collectionId = getBlockCollectionId(block, recordMap)\n if (collectionId) {\n const collection = recordMap.collection[collectionId]?.value\n\n if (collection) return collection.icon\n }\n }\n\n return null\n}\n","import type { ExtendedRecordMap } from '@texonom/ntypes'\n\nimport { getBlockTitle } from './get-block-title'\n\nexport function getPageTitle(recordMap: ExtendedRecordMap) {\n const pageBlock = recordMap.block[Object.keys(recordMap.block)[0]]?.value\n\n if (pageBlock) return getBlockTitle(pageBlock, recordMap)\n\n return null\n}\n","import { Block, DateFormat, ExtendedRecordMap } from '@texonom/ntypes'\n\nimport { getTextContent } from './get-text-content'\n\n/**\n * Gets the value of a collection property for a given page (collection item).\n *\n * @param propertyName property name\n * @param block Page block, often be first block in blockMap\n * @param recordMap\n * @returns - The return value types will follow the following principles:\n * 1. if property is date type, it will return `number` or `number[]`(depends on `End Date` switch)\n * 2. property is text-like will return `string`\n * 3. multi select property will return `string[]`\n * 4. checkbox property return `boolean`\n * @todo complete all no-text property type\n */\nexport function getPageProperty<T = string | number | boolean | string[] | number[]>(\n propertyName: string,\n block: Block,\n recordMap: ExtendedRecordMap\n): T\nexport function getPageProperty(propertyName: string, block: Block, recordMap: ExtendedRecordMap) {\n try {\n if (!block.properties || !Object.keys(recordMap.collection))\n // console.warn(\n // `block ${block.id} has no properties or this recordMap has no collection record`\n // )\n return null\n\n const collection = recordMap.collection[block.parent_id]?.value\n\n if (collection) {\n const propertyNameL = propertyName.toLowerCase()\n const propertyId = Object.keys(collection.schema).find(\n key => collection.schema[key]?.name?.toLowerCase() === propertyNameL\n )\n\n if (!propertyId) return null\n\n const { type } = collection.schema[propertyId]\n const content = getTextContent(block.properties[propertyId])\n\n switch (type) {\n case 'created_time':\n return block.created_time\n\n case 'multi_select':\n return content.split(',')\n\n case 'date': {\n const property = block.properties[propertyId] as [['‣', [DateFormat]]]\n const formatDate = property[0][1][0][1]\n\n if (formatDate.type == 'datetime') {\n return new Date(`${formatDate.start_date} ${formatDate.start_time}`).getTime()\n } else if (formatDate.type == 'date') {\n return new Date(formatDate.start_date).getTime()\n } else if (formatDate.type == 'datetimerange') {\n const { start_date, start_time, end_date, end_time } = formatDate\n const startTime = new Date(`${start_date} ${start_time}`).getTime()\n const endTime = new Date(`${end_date} ${end_time}`).getTime()\n return [startTime, endTime]\n } else {\n const startTime = new Date(formatDate.start_date).getTime()\n const endTime = new Date(formatDate.end_date).getTime()\n return [startTime, endTime]\n }\n }\n\n case 'checkbox':\n return content == 'Yes'\n\n case 'last_edited_time':\n return block.last_edited_time\n\n default:\n return content\n }\n }\n } catch {\n // ensure that no matter what, we don't throw errors because of an unexpected\n // collection data format\n }\n\n return null\n}\n","import type { FormattedDate } from '@texonom/ntypes'\n\n/**\n * Attempts to find a valid date from a given property.\n */\nexport const getDateValue = (prop: any[]): FormattedDate | null => {\n if (prop && Array.isArray(prop))\n if (prop[0] === 'd') return prop[1]\n else\n for (const v of prop) {\n const value = getDateValue(v)\n if (value) return value\n }\n\n return null\n}\n","import type { Block, ExtendedRecordMap, PageBlock, Collection, Space } from '@texonom/ntypes'\n\n/**\n * Returns the parent page block containing a given page.\n *\n * Note that many times this will not be the direct parent block since\n * some non-page content blocks can contain sub-blocks.\n */\nexport const getBlockParentPage = (\n block: Block,\n recordMap: ExtendedRecordMap,\n {\n inclusive = false\n }: {\n inclusive?: boolean\n } = {}\n): PageBlock | null => {\n let currentRecord: Block | Collection = block\n\n while (currentRecord != null) {\n if (inclusive && (currentRecord as Block)?.type === 'page') return currentRecord as PageBlock\n\n const parentId: string = currentRecord.parent_id\n const parentTable = currentRecord.parent_table\n\n if (!parentId) break\n\n if (parentTable === 'collection') {\n currentRecord = recordMap.collection[parentId]?.value\n } else {\n currentRecord = recordMap.block[parentId]?.value\n if ((currentRecord as Block)?.type === 'page') return currentRecord as PageBlock\n }\n }\n return null\n}\n\nexport const getBlockParent = (\n block: Block,\n recordMap: ExtendedRecordMap,\n {\n inclusive = false\n }: {\n inclusive?: boolean\n } = {}\n): PageBlock | Collection | Space => {\n let currentRecord: Block | Collection | Space = block\n\n while (currentRecord != null) {\n if (inclusive && (currentRecord as Block)?.type === 'page') return currentRecord as PageBlock\n\n const parentId: string = currentRecord.parent_id\n const parentTable = currentRecord.parent_table\n\n if (!parentId) break\n\n if (parentTable === 'collection') {\n return recordMap.collection[parentId]?.value\n } else if (parentTable === 'space') {\n return recordMap.space?.[parentId]?.value\n } else {\n currentRecord = recordMap.block[parentId]?.value\n if ((currentRecord as Block)?.type === 'page') return currentRecord as PageBlock\n }\n }\n return null\n}\n","import { getTextContent } from './get-text-content'\n\nimport type { ID, BlockType, PageBlock, ExtendedRecordMap } from '@texonom/ntypes'\n\nexport interface TableOfContentsEntry {\n id: ID\n type: BlockType\n text: string\n indentLevel: number\n}\n\nconst indentLevels = {\n header: 0,\n sub_header: 1,\n sub_sub_header: 2\n}\n\n/**\n * Gets the metadata for a table of contents block by parsing the page's\n * H1, H2, and H3 elements.\n */\nexport const getPageTableOfContents = (page: PageBlock, recordMap: ExtendedRecordMap): Array<TableOfContentsEntry> => {\n const toc = (page.content ?? [])\n .map((blockId: string) => {\n const block = recordMap.block[blockId]?.value\n\n if (block) {\n const { type } = block\n\n if (type === 'header' || type === 'sub_header' || type === 'sub_sub_header')\n return {\n id: blockId,\n type,\n text: getTextContent(block.properties?.title),\n indentLevel: indentLevels[type]\n }\n }\n\n return null\n })\n .filter(Boolean) as Array<TableOfContentsEntry>\n\n const indentLevelStack = [\n {\n actual: -1,\n effective: -1\n }\n ]\n\n // Adjust indent levels to always change smoothly.\n // This is a little tricky, but the key is that when increasing indent levels,\n // they should never jump more than one at a time.\n for (const tocItem of toc) {\n const { indentLevel } = tocItem\n const actual = indentLevel\n\n do {\n const prevIndent = indentLevelStack[indentLevelStack.length - 1]\n const { actual: prevActual, effective: prevEffective } = prevIndent\n\n if (actual > prevActual) {\n tocItem.indentLevel = prevEffective + 1\n indentLevelStack.push({\n actual,\n effective: tocItem.indentLevel\n })\n } else if (actual === prevActual) {\n tocItem.indentLevel = prevEffective\n break\n } else {\n indentLevelStack.pop()\n }\n\n // eslint-disable-next-line no-constant-condition\n } while (true)\n }\n\n return toc\n}\n","import type { ExtendedRecordMap, Decoration } from '@texonom/ntypes'\n\n/**\n * Gets the IDs of all blocks contained on a page starting from a root block ID.\n */\nexport const getPageContentBlockIds = (recordMap: ExtendedRecordMap, blockId?: string, locust = false): string[] => {\n const rootBlockId = blockId || Object.keys(recordMap.block)[0]\n const contentBlockIds = new Set<string>()\n\n function addContentBlocks(blockId: string) {\n if (contentBlockIds.has(blockId)) return\n contentBlockIds.add(blockId)\n\n const block = recordMap.block[blockId]?.value\n if (!block) return\n const { content, type, properties, format } = block\n if (properties)\n for (const key of Object.keys(properties)) {\n const p = properties[key]\n p.map((d: Decoration) => {\n const value = d?.[0]?.[1]?.[0]\n if (value?.[0] === 'p' && value[1]) addContentBlocks(value[1])\n })\n p.map((d: Decoration) => {\n const value = d?.[1]?.[0]\n if ((value?.[0] === 'p' || value?.[0] === 'eoi') && value[1]) addContentBlocks(value[1])\n })\n }\n\n if (format) {\n const referenceId = format.transclusion_reference_pointer?.id\n if (referenceId) addContentBlocks(referenceId)\n }\n // no child content blocks to recurse on\n if (!content || !Array.isArray(content)) return\n // ignore the content of other pages and collections\n if (blockId !== rootBlockId && !locust) if (type === 'page' || type === 'collection_view_page') return\n for (const blockId of content) addContentBlocks(blockId)\n }\n addContentBlocks(rootBlockId)\n return Array.from(contentBlockIds)\n}\n\n/**\n * Gets the IDs of all blocks contained on a page starting from a root block ID.\n */\nexport const getPageContentUserIds = (recordMap: ExtendedRecordMap, blockId?: string): string[] => {\n const rootBlockId = blockId || Object.keys(recordMap.block)[0]\n const contentUserIDs = new Set<string>()\n const block = recordMap.block[rootBlockId]?.value\n\n if (block?.created_by_id) contentUserIDs.add(block?.created_by_id)\n if (block?.last_edited_by_id) contentUserIDs.add(block?.last_edited_by_id)\n\n // Property\n const { properties } = block\n if (properties)\n for (const key of Object.keys(properties)) {\n const p = properties[key]\n p.map((d: Decoration) => {\n const value = d?.[1]?.[0]\n if (value?.[0] === 'u' && value[1]) contentUserIDs.add(value[1])\n })\n }\n\n return Array.from(contentUserIDs)\n}\n","export const idToUuid = (id = '') =>\n `${id.substr(0, 8)}-${id.substr(8, 4)}-${id.substr(12, 4)}-${id.substr(16, 4)}-${id.substr(20)}`\n","import { idToUuid } from './id-to-uuid'\n\nconst pageIdRe = /\\b([a-f0-9]{32})\\b/\nconst pageId2Re = /\\b([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})\\b/\n\n/**\n * Robustly extracts the notion page ID from a notion URL or pathname suffix.\n *\n * Defaults to returning a UUID (with dashes).\n */\nexport const parsePageId = (id: string | null = '', { uuid = true }: { uuid?: boolean } = {}) => {\n if (!id) return null\n\n id = id.split('?')[0]\n const match = id.match(pageIdRe)\n\n if (match) return uuid ? idToUuid(match[1]) : match[1]\n\n const match2 = id.match(pageId2Re)\n if (match2) return uuid ? match2[1] : match2[1].replace(/-/g, '')\n\n return null\n}\n","export const uuidToId = (uuid: string) => uuid.replace(/-/g, '')\n","import type { ExtendedRecordMap, Block, Collection } from '@texonom/ntypes'\n\nexport function findAncestors(recordMap: ExtendedRecordMap, block: Block | Collection, list: string[] = []): string[] {\n if (block.parent_id) {\n list.push(block.parent_id)\n const table = block.parent_table as 'block' | 'collection'\n if (recordMap[table]?.[block.parent_id]?.value)\n return findAncestors(recordMap, recordMap[table][block.parent_id].value, list)\n }\n return list\n}\n","import { findAncestors } from './find-ancestors'\nimport { getPageContentBlockIds } from './get-page-content-block-ids'\nimport { getBlockTitle } from './get-block-title'\n\nimport type { ExtendedRecordMap, PageMap, PageChunk, BlockMap } from '@texonom/ntypes'\n\nexport type PageTree = {\n id: string\n type: string\n title: string\n blocks: number\n pages: number\n parent?: PageTree\n children: PageTree[]\n}\n\ntype FetchOption = RequestInit & { timeout?: number }\n\n/**\n * Performs a traversal over a given Notion workspace starting from a seed page.\n *\n * Returns a map containing all of the pages that are reachable from the seed\n * page in the space.\n *\n * If `rootSpaceId` is not defined, the space ID of the root page will be used\n * to scope traversal.\n *\n *\n * @param rootPageId - Page ID to start from.\n * @param rootSpaceId - Space ID to scope traversal.\n * @param getPage - Function used to fetch a single page.\n * @param opts - Optional config\n */\nexport async function getAllInSpace(\n startPageId: string,\n getPage: (pageId: string, { fetchOption }?: { fetchOption?: FetchOption }) => Promise<ExtendedRecordMap>,\n getBlocks: (blockIds: string[], fetchOption?: FetchOption) => Promise<PageChunk>,\n fetchCollections: (\n contentBlockIds: string[],\n recordMap: ExtendedRecordMap,\n pageId?: string,\n {\n fetchOption,\n concurrency,\n collectionConcurrency\n }?: { fetchOption?: FetchOption; concurrency: number; collectionConcurrency?: number }\n ) => Promise<ExtendedRecordMap>,\n {\n startRecordMap,\n fetchOption = { timeout: 100000 },\n maxPage,\n debug,\n concurrency = 100,\n collectionConcurrency = 100\n }: {\n startRecordMap?: ExtendedRecordMap\n fetchOption?: FetchOption\n concurrency?: number\n maxPage?: number\n debug?: boolean\n collectionConcurrency?: number\n } = {}\n): Promise<{ recordMap: ExtendedRecordMap; pageMap: PageMap; pageTree: PageTree }> {\n const pageMap: PageMap = {}\n const recordMap = startRecordMap ? startRecordMap : await getPage(startPageId, { fetchOption })\n\n let tempRecordMap: ExtendedRecordMap = JSON.parse(JSON.stringify(recordMap))\n\n if (debug) console.time('Total fetch time')\n let iteration = 1\n while (true) {\n if (debug) console.debug(`Iteration ${iteration}`)\n if (debug) console.debug('block length ', Object.keys(recordMap.block).length)\n\n if (debug) console.time('getPageContentBlockIds')\n const targetBlocks = Object.keys(tempRecordMap.block)\n const missing = Object.keys(\n targetBlocks.reduce((blockMap, root) => {\n const contentBlockIds = getPageContentBlockIds(recordMap, root, true)\n for (const contentBlockID of contentBlockIds) if (!recordMap.block[contentBlockID]) blockMap[contentBlockID] = true\n return blockMap\n }, {})\n )\n for (const { value: block } of Object.values(tempRecordMap.block))\n if (block && !recordMap.block[block.parent_id] && block.parent_table === 'block') missing.push(block.parent_id)\n if (debug) console.timeEnd('getPageContentBlockIds')\n\n if (debug) console.time('getBlocks')\n tempRecordMap = (await getBlocks(missing, fetchOption)).recordMap as ExtendedRecordMap\n if (debug) console.timeEnd('getBlocks')\n if (!tempRecordMap?.block) break\n\n if (debug) console.time('mapBlocks')\n const contentBlockIds = Object.values(recordMap.block)\n .map(obj => obj.value?.id)\n .filter(Boolean)\n recordMap.block = { ...recordMap.block, ...tempRecordMap.block }\n if (debug) console.timeEnd('mapBlocks')\n\n if (debug) console.time('fetchCollections')\n await fetchCollections(contentBlockIds, recordMap, undefined, { fetchOption, concurrency, collectionConcurrency })\n if (debug) console.timeEnd('fetchCollections')\n if (debug) console.debug('collection query length ' + Object.keys(recordMap.collection_query).length)\n\n if (debug) console.debug('new block length ', Object.keys(tempRecordMap.block).length)\n const pageLength = Object.values(recordMap.block)\n .map(obj => obj.value?.type)\n .filter(type => type === 'page').length\n if (debug) console.debug('page length ', pageLength)\n if (Number.isInteger(maxPage) && pageLength >= maxPage) break\n\n if (debug) console.debug(`memory usage ${process.memoryUsage().rss / 1024 / 1024}MB`)\n iteration += 1\n if (debug) console.debug()\n }\n if (debug) console.timeEnd('Total fetch time')\n\n if (debug) console.time('get page map')\n if (debug) console.debug('Total block length ', Object.keys(recordMap.block).length)\n const blockIds = Object.keys(recordMap.block)\n\n const promises = []\n for (const blockId of blockIds)\n if (recordMap.block[blockId].value?.type === 'page') {\n promises.push(getPageSync(blockId, recordMap, getBlocks).then(pageRecordMap => (pageMap[blockId] = pageRecordMap)))\n await sleep(1)\n }\n await Promise.all(promises)\n\n if (debug) console.timeEnd('get page map')\n if (debug) console.debug('Total page length ', Object.keys(pageMap).length)\n\n if (debug) console.time('get page tree')\n const pageTree = {\n id: startPageId,\n title: getBlockTitle(recordMap.block[startPageId].value, recordMap),\n blocks: 1,\n pages: 1,\n children: [],\n type: 'page'\n }\n recursivePageTree(recordMap, pageTree)\n if (debug) console.timeEnd('get page tree')\n\n return { pageMap, pageTree, recordMap }\n}\n\nexport function recursivePageTree(recordMap: ExtendedRecordMap, pageTree: PageTree): PageTree {\n // Save ancestors to update the count\n const ancestors = [pageTree]\n let ancestor = pageTree\n while (true)\n if (ancestor.parent) {\n ancestors.push(ancestor.parent)\n ancestor = ancestor.parent\n } else {\n break\n }\n\n const current = recordMap.block[pageTree.id]?.value\n if (!current) {\n console.warn(`No block value for ${pageTree.id}`)\n delete pageTree.parent\n return pageTree\n }\n\n if (current.content?.length) {\n for (const ancestor of ancestors) ancestor.blocks += current.content.length\n for (const contentBlockId of current.content) {\n const block = recordMap.block[contentBlockId]?.value\n if (!block) continue\n pageTree.children.push(\n recursivePageTree(recordMap, {\n id: contentBlockId,\n title: getBlockTitle(block, recordMap),\n blocks: 1,\n pages: 0,\n children: [],\n type: block.type,\n parent: pageTree\n })\n )\n if (block.type === 'page') for (const ancestor of ancestors) ancestor.pages++\n }\n } else if (current?.type === 'collection_view') {\n const collectionQuery = recordMap.collection_query[current.collection_id]?.[current.view_ids[0]]\n if (!collectionQuery) {\n console.warn(`No collection query for ${pageTree.id}`)\n delete pageTree.parent\n return pageTree\n }\n const childrenMap = {}\n for (const collectionQuery of Object.values(recordMap.collection_query[current.collection_id]))\n if (collectionQuery.collection_group_results.blockIds)\n for (const blockId of collectionQuery.collection_group_results.blockIds) childrenMap[blockId] = true\n const childrenPages = Object.keys(childrenMap)\n for (const ancestor of ancestors) ancestor.pages += childrenPages.length\n for (const ancestor of ancestors) ancestor.blocks += childrenPages.length\n for (const blockId of childrenPages)\n pageTree.children.push(\n recursivePageTree(recordMap, {\n id: blockId,\n title: getBlockTitle(recordMap.block[blockId].value, recordMap),\n blocks: childrenPages.length,\n pages: childrenPages.length,\n children: [],\n type: current.type,\n parent: pageTree\n })\n )\n }\n delete pageTree.parent\n return pageTree\n}\n\nexport async function getPageSync(\n pageId: string,\n recordMap: ExtendedRecordMap,\n getBlocks: (blockIds: string[], fetchOption?: FetchOption) => Promise<PageChunk>\n): Promise<ExtendedRecordMap> {\n let contentBlockIds = getPageContentBlockIds(recordMap, pageId)\n let blockMap: BlockMap = { [pageId]: { value: recordMap.block[pageId].value, role: 'reader' } }\n const collectionMap = {}\n const collectionViewMap = {}\n const collectionQueryMap = {}\n\n const missing = []\n for (const contentBlockId of contentBlockIds) {\n const block = recordMap.block[contentBlockId]?.value\n if (!block) {\n missing.push(contentBlockId)\n continue\n }\n blockMap[contentBlockId] = { value: block, role: 'reader' }\n if (block.type === 'collection_view' || block.type === 'collection_view_page') {\n if (recordMap.collection[block.collection_id])\n collectionMap[block.collection_id] = recordMap.collection[block.collection_id]\n if (recordMap.collection_query[block.collection_id])\n collectionQueryMap[block.collection_id] = recordMap.collection_query[block.collection_id]\n for (const viewId of block.view_ids)\n if (recordMap.collection_view[viewId]) {\n collectionViewMap[viewId] = recordMap.collection_view[viewId]\n const blockIds = recordMap.collection_query[block?.collection_id]?.[viewId]?.collection_group_results?.blockIds\n if (blockIds?.length)\n for (const blockId of blockIds) {\n const block = recordMap.block[blockId]?.value\n if (block) blockMap[blockId] = { value: block, role: 'reader' }\n else missing.push(blockId)\n }\n }\n }\n }\n\n // Ancestor\n const ancesters = findAncestors(recordMap, recordMap.block[pageId].value)\n for (const ancester of ancesters) {\n const block = recordMap.block[ancester]?.value\n if (block) blockMap[ancester] = { value: block, role: 'reader' }\n const collection = recordMap.collection[ancester]?.value\n if (collection) collectionMap[ancester] = { value: collection }\n }\n\n // Alias\n for (const blockId of Object.keys(blockMap)) {\n const block = blockMap[blockId].value\n let targetBlock = block\n if (block?.type === 'alias')\n while (true) {\n const alias = targetBlock?.format?.alias_pointer?.id\n if (!alias) break\n targetBlock = recordMap.block[alias]?.value\n if (!targetBlock) missing.push(alias)\n else blockMap[alias] = { value: targetBlock, role: 'reader' }\n }\n }\n\n // Missing\n if (missing.length) {\n const responseMap = (await getBlocks(missing).catch(() => ({ recordMap: { block: null } }))).recordMap\n if (responseMap?.block) {\n blockMap = { ...blockMap, ...responseMap.block }\n for (const blockId in responseMap.block) recordMap.block[blockId] = responseMap.block[blockId]\n } else {\n console.warn(`fetching ${missing.length} fail for ${pageId}`)\n }\n }\n\n contentBlockIds = getPageContentBlockIds(recordMap, pageId)\n for (const contentBlockId of contentBlockIds) {\n const block = recordMap.block[contentBlockId]?.value\n if (!block) continue\n blockMap[contentBlockId] = { value: block, role: 'reader' }\n if (block.type === 'collection_view' || block.type === 'collection_view_page') {\n if (recordMap.collection[block.collection_id])\n collectionMap[block.collection_id] = recordMap.collection[block.collection_id]\n if (recordMap.collection_query[block.collection_id])\n collectionQueryMap[block.collection_id] = recordMap.collection_query[block.collection_id]\n for (const viewId of block.view_ids)\n if (recordMap.collection_view[viewId]) {\n collectionViewMap[viewId] = recordMap.collection_view[viewId]\n const blockIds = recordMap.collection_query[block?.collection_id]?.[viewId]?.collection_group_results?.blockIds\n if (blockIds?.length)\n for (const blockId of blockIds) {\n const block = recordMap.block[blockId]?.value\n if (block) blockMap[blockId] = { value: block, role: 'reader' }\n }\n }\n }\n }\n\n return {\n block: blockMap,\n collection: collectionMap,\n collection_view: collectionViewMap,\n collection_query: collectionQueryMap,\n signed_urls: {},\n notion_user: {}\n }\n}\n\nconst sleep = async (ms: number) => new Promise(resolve => setTimeout(resolve, ms))\n","export const normalizeTitle = (title?: string | null): string => {\n return (title || '')\n .replace(/( |\\/)/g, '-') // Replace spaces and slashes with dashes\n .replace(/[^a-zA-Z0-9-\\u4e00-\\u9FFF\\uAC00-\\uD7AF\\u3130-\\u318F\\u3041-\\u3096\\u30A1-\\u30FC\\u3000-\\u303F]/g, '') // Retain Korean characters\n .replace(/--+/g, '-') // Replace multiple dashes with a single dash\n .replace(/^-+|-+$/g, '') // Trim leading and trailing dashes\n .trim()\n .toLowerCase()\n}\n","import { getBlockTitle } from './get-block-title'\nimport { getPageProperty } from './get-page-property'\nimport { normalizeTitle } from './normalize-title'\nimport { getTextContent } from './get-text-content'\nimport { uuidToId } from './uuid-to-id'\n\nimport type { ExtendedRecordMap } from '@texonom/ntypes'\n\n/**\n * Gets the canonical, display-friendly version of a page's ID for use in URLs.\n */\nexport const getCanonicalPageId = (\n pageId: string,\n recordMap: ExtendedRecordMap,\n { uuid = true }: { uuid?: boolean } = {}\n): string | null => {\n if (!pageId || !recordMap) return null\n\n const id = uuidToId(pageId)\n const block = recordMap.block[pageId]?.value\n\n if (block) {\n const slug =\n (getPageProperty('slug', block, recordMap) as string | null) || normalizeTitle(getBlockTitle(block, recordMap))\n\n if (slug)\n if (uuid) return `${slug}-${id}`\n else return slug\n } else {\n const collection = recordMap.collection[pageId]?.value\n if (collection) {\n const slug = normalizeTitle(getTextContent(collection.name))\n if (slug)\n if (uuid) return `${slug}-${id}`\n else return slug\n }\n }\n\n return id\n}\n","import { getBlockIcon } from './get-block-icon'\nimport { getBlockParentPage } from './get-block-parent-page'\nimport { getBlockTitle } from './get-block-title'\n\nimport type { ExtendedRecordMap } from '@texonom/ntypes'\n\nexport const getPageBreadcrumbs = (recordMap: ExtendedRecordMap, activePageId: string): Array<any> | null => {\n const blockMap = recordMap.block\n const breadcrumbs = []\n\n let currentPageId = activePageId\n\n do {\n const block = blockMap[currentPageId]?.value\n if (!block) break\n\n const title = getBlockTitle(block, recordMap)\n const icon = getBlockIcon(block, recordMap)\n\n if (!(title || icon)) break\n\n breadcrumbs.push({\n block,\n active: currentPageId === activePageId,\n pageId: currentPageId,\n title,\n icon\n })\n\n const parentBlock = getBlockParentPage(block, recordMap)\n const parentId = parentBlock?.id\n\n if (!parentId) break\n\n currentPageId = parentId\n\n // eslint-disable-next-line no-constant-condition\n } while (true)\n\n breadcrumbs.reverse()\n\n return breadcrumbs\n}\n","import { getBlockIcon } from './get-block-icon'\nimport { isUrl } from './is-url'\n\nimport type { Block, ExtendedRecordMap } from '@texonom/ntypes'\n\n/**\n * Gets URLs of all images contained on the given page.\n */\nexport const getPageImageUrls = (\n recordMap: ExtendedRecordMap,\n {\n mapImageUrl\n }: {\n mapImageUrl: (url: string, block: Block) => string | null\n }\n): string[] => {\n const blockIds = Object.keys(recordMap.block)\n const imageUrls: string[] = blockIds\n .flatMap(blockId => {\n const block = recordMap.block[blockId]?.value\n const images: Array<{ block: Block; url: string }> = []\n\n if (block) {\n if (block.type === 'image') {\n const signedUrl = recordMap.signed_urls?.[block.id]\n let source = signedUrl || block.properties?.source?.[0]?.[0]\n if (source.includes('file.notion.so')) source = block.properties?.source?.[0]?.[0]\n\n if (source)\n images.push({\n block,\n url: source\n })\n }\n\n if (block.format?.page_cover) {\n const source = block.format.page_cover\n\n images.push({\n block,\n url: source\n })\n }\n\n if (block.format?.bookmark_cover) {\n const source = block.format.bookmark_cover\n\n images.push({\n block,\n url: source\n })\n }\n\n if (block.format?.bookmark_icon) {\n const source = block.format.bookmark_icon\n\n images.push({\n block,\n url: source\n })\n }\n\n const pageIcon = getBlockIcon(block, recordMap)\n if (pageIcon && isUrl(pageIcon))\n images.push({\n block,\n url: pageIcon\n })\n }\n\n return images\n })\n .filter(Boolean)\n .map(({ block, url }) => mapImageUrl(url, block))\n .filter(Boolean)\n\n return Array.from(new Set(imageUrls))\n}\n","import type { Decoration } from '@texonom/ntypes'\n\n/**\n * Block types whose title an on-page editor replaces as plain text.\n *\n * The renderer that draws the editor and a host that stores the edits read the\n * same list, so an edit can only land on a block the page can show it on.\n */\nexport const EDITABLE_BLOCK_TYPES: ReadonlySet<string> = new Set([\n 'text',\n 'header',\n 'sub_header',\n 'sub_sub_header',\n 'bulleted_list',\n 'numbered_list'\n])\n\n/**\n * A title a plain-text edit can replace without losing anything.\n *\n * Bold, a link, a mention or an inline equation lives in a segment's second\n * element, and replacing a title that carries one would silently drop it.\n */\nexport const isPlainTitle = (title: unknown): title is Decoration[] =>\n Array.isArray(title) &&\n title.every(\n segment =>\n Array.isArray(segment) &&\n typeof segment[0] === 'string' &&\n (segment[1] === undefined || (Array.isArray(segment[1]) && segment[1].length === 0))\n )\n\n/** Whether a block's title can be edited in place as plain text. */\nexport const isEditableBlock = (block: { type: string; properties?: Record<string, unknown> }): boolean =>\n EDITABLE_BLOCK_TYPES.has(block.type) && isPlainTitle(block.properties?.title)\n\n/** Formats a rich-text editor reads and writes as they are: on/off styles, and a colour or a link with its value. */\nexport const TITLE_STYLES: ReadonlySet<string> = new Set(['b', 'i', 's', 'c', '_'])\n\n/** Inline objects carried through an edit untouched and written back by the API: a page mention, a user mention, an equation. */\nexport const TITLE_INLINES: ReadonlySet<string> = new Set(['p', 'u', 'e'])\n\n/**\n * Whether a title survives being edited and written back to Notion unchanged.\n *\n * Saving a block writes its whole rich text, so anything the write cannot carry\n * would be erased by the first keystroke: a comment highlight, a date mention,\n * a link preview. A block whose title has one stays read-only. An empty title\n * is trivially safe.\n */\nexport function isRoundTrippableTitle(title: unknown): boolean {\n if (title === undefined) return true\n if (!Array.isArray(title)) return false\n return title.every(segment => {\n if (!Array.isArray(segment) || typeof segment[0] !== 'string' || segment.length > 2) return false\n if (segment[1] === undefined) return true\n if (!Array.isArray(segment[1])) return false\n let inlines = 0\n for (const format of segment[1]) {\n if (!Array.isArray(format) || typeof format[0] !== 'string') return false\n const [code, value] = format\n if (TITLE_STYLES.has(code)) continue\n if ((code === 'h' || code === 'a') && typeof value === 'string') continue\n if (TITLE_INLINES.has(code) && typeof value === 'string') {\n inlines++\n continue\n }\n return false\n }\n return inlines <= 1\n })\n}\n\n/**\n * Block types the page lets the owner type into where they stand, formatting\n * and all. Wider than `EDITABLE_BLOCK_TYPES`, which is for replacing a title\n * with plain text from outside the page.\n */\nexport const IN_PLACE_BLOCK_TYPES: ReadonlySet<string> = new Set([...EDITABLE_BLOCK_TYPES, 'to_do', 'toggle', 'quote'])\n\n/**\n * Whether the page draws a block's title for typing into. The renderer and the\n * host that saves read this one rule, so nothing typed lands where it cannot\n * be written back.\n */\nexport const isEditableInPlace = (block: { type: string; properties?: Record<string, unknown> }): boolean =>\n IN_PLACE_BLOCK_TYPES.has(block.type) && isRoundTrippableTitle(block.properties?.title)\n","const copyProperty = (to, from, property, ignoreNonConfigurable) => {\n\t// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.\n\t// `Function#prototype` is non-writable and non-configurable so can never be modified.\n\tif (property === 'length' || property === 'prototype') {\n\t\treturn;\n\t}\n\n\t// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.\n\tif (property === 'arguments' || property === 'caller') {\n\t\treturn;\n\t}\n\n\tconst toDescriptor = Object.getOwnPropertyDescriptor(to, property);\n\tconst fromDescriptor = Object.getOwnPropertyDescriptor(from, property);\n\n\tif (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {\n\t\treturn;\n\t}\n\n\tObject.defineProperty(to, property, fromDescriptor);\n};\n\n// `Object.defineProperty()` throws if the property exists, is not configurable and either:\n// - one its descriptors is changed\n// - it is non-writable and its value is changed\nconst canCopyProperty = function (toDescriptor, fromDescriptor) {\n\treturn toDescriptor === undefined || toDescriptor.configurable || (\n\t\ttoDescriptor.writable === fromDescriptor.writable\n\t\t&& toDescriptor.enumerable === fromDescriptor.enumerable\n\t\t&& toDescriptor.configurable === fromDescriptor.configurable\n\t\t&& (toDescriptor.writable || toDescriptor.value === fromDescriptor.value)\n\t);\n};\n\nconst changePrototype = (to, from) => {\n\tconst fromPrototype = Object.getPrototypeOf(from);\n\tif (fromPrototype === Object.getPrototypeOf(to)) {\n\t\treturn;\n\t}\n\n\tObject.setPrototypeOf(to, fromPrototype);\n};\n\nconst wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\\n${fromBody}`;\n\nconst toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');\nconst toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');\n\n// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.\n// We use `bind()` instead of a closure for the same reason.\n// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.\nconst changeToString = (to, from, name) => {\n\tconst withName = name === '' ? '' : `with ${name.trim()}() `;\n\tconst newToString = wrappedToString.bind(null, withName, from.toString());\n\t// Ensure `to.toString.toString` is non-enumerable and has the same `same`\n\tObject.defineProperty(newToString, 'name', toStringName);\n\tconst {writable, enumerable, configurable} = toStringDescriptor; // We destructue to avoid a potential `get` descriptor.\n\tObject.defineProperty(to, 'toString', {value: newToString, writable, enumerable, configurable});\n};\n\nexport default function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {\n\tconst {name} = to;\n\n\tfor (const property of Reflect.ownKeys(from)) {\n\t\tcopyProperty(to, from, property, ignoreNonConfigurable);\n\t}\n\n\tchangePrototype(to, from);\n\tchangeToString(to, from, name);\n\n\treturn to;\n}\n","import mimicFunction from 'mimic-function';\nconst maxTimeoutValue = 2_147_483_647;\nconst cacheStore = new WeakMap();\nconst cacheTimerStore = new WeakMap();\nconst cacheKeyStore = new WeakMap();\nfunction getValidCacheItem(cache, key) {\n const item = cache.get(key);\n if (!item) {\n return undefined;\n }\n if (item.maxAge <= Date.now()) {\n cache.delete(key);\n return undefined;\n }\n return item;\n}\nfunction validateMaxAge(value, source) {\n if (value === Number.POSITIVE_INFINITY) {\n return;\n }\n if (!Number.isFinite(value)) {\n if (source === '`maxAge` option') {\n throw new TypeError('The `maxAge` option must be a finite number, `0`, or `Infinity`.');\n }\n throw new TypeError('The `maxAge` function must return a finite number, `0`, or `Infinity`.');\n }\n if (value > maxTimeoutValue) {\n if (source === '`maxAge` option') {\n throw new TypeError(`The \\`maxAge\\` option cannot exceed ${maxTimeoutValue}.`);\n }\n throw new TypeError(`The \\`maxAge\\` function result cannot exceed ${maxTimeoutValue}.`);\n }\n}\nfunction getPropertyDescriptor(object, property) {\n let currentObject = object;\n while (currentObject) {\n const descriptor = Object.getOwnPropertyDescriptor(currentObject, property);\n if (descriptor) {\n return descriptor;\n }\n const prototype = Object.getPrototypeOf(currentObject);\n currentObject = prototype === null ? undefined : prototype;\n }\n return undefined;\n}\n/**\n[Memoize](https://en.wikipedia.org/wiki/Memoization) functions - An optimization used to speed up consecutive function calls by caching the result of calls with identical input.\n\n@param function_ - The function to be memoized.\n\n@example\n```\nimport memoize from 'memoize';\n\nlet index = 0;\nconst counter = () => ++index;\nconst memoized = memoize(counter);\n\nmemoized('foo');\n//=> 1\n\n// Cached as it's the same argument\nmemoized('foo');\n//=> 1\n\n// Not cached anymore as the arguments changed\nmemoized('bar');\n//=> 2\n\nmemoized('bar');\n//=> 2\n```\n*/\nexport default function memoize(function_, { cacheKey, cache = new Map(), maxAge, } = {}) {\n if (typeof maxAge === 'number') {\n validateMaxAge(maxAge, '`maxAge` option');\n if (maxAge <= 0) {\n return function_;\n }\n }\n const memoized = function (...arguments_) {\n const key = cacheKey ? cacheKey(arguments_) : arguments_[0];\n const cacheItem = getValidCacheItem(cache, key);\n if (cacheItem) {\n return cacheItem.data;\n }\n const result = function_.apply(this, arguments_);\n const computedMaxAge = typeof maxAge === 'function' ? maxAge(...arguments_) : maxAge;\n if (computedMaxAge !== undefined && computedMaxAge !== Number.POSITIVE_INFINITY) {\n validateMaxAge(computedMaxAge, '`maxAge` function result');\n if (computedMaxAge <= 0) {\n return result; // Do not cache\n }\n }\n cache.set(key, {\n data: result,\n maxAge: (computedMaxAge === undefined || computedMaxAge === Number.POSITIVE_INFINITY)\n ? Number.POSITIVE_INFINITY\n : Date.now() + computedMaxAge,\n });\n if (computedMaxAge !== undefined && computedMaxAge !== Number.POSITIVE_INFINITY) {\n const timer = setTimeout(() => {\n cache.delete(key);\n cacheTimerStore.get(memoized)?.delete(timer);\n }, computedMaxAge);\n timer.unref?.();\n const timers = cacheTimerStore.get(memoized) ?? new Set();\n timers.add(timer);\n cacheTimerStore.set(memoized, timers);\n }\n return result;\n };\n mimicFunction(memoized, function_, {\n ignoreNonConfigurable: true,\n });\n cacheStore.set(memoized, cache);\n cacheKeyStore.set(memoized, (cacheKey ?? ((arguments_) => arguments_[0])));\n return memoized;\n}\n/**\n@returns A [decorator](https://github.com/tc39/proposal-decorators) to memoize class methods, static class methods, or getters.\n\n@example\n```\nimport {memoizeDecorator} from 'memoize';\n\nclass Example {\n index = 0\n\n @memoizeDecorator()\n counter() {\n return ++this.index;\n }\n}\n\nclass ExampleWithOptions {\n index = 0\n\n @memoizeDecorator({maxAge: 1000})\n counter() {\n return ++this.index;\n }\n}\n\nclass ExampleWithGetter {\n @memoizeDecorator()\n get value() {\n return expensiveComputation();\n }\n}\n```\n*/\nexport function memoizeDecorator(options = {}) {\n function decorator(target, context) {\n if (context.kind === 'method') {\n if (context.private) {\n throw new TypeError('The `memoizeDecorator` method decorator does not support private methods.');\n }\n const memoizedMethods = new WeakMap();\n const getMemoizedMethod = (receiver) => {\n let memoizedMethod = memoizedMethods.get(receiver);\n if (!memoizedMethod) {\n memoizedMethod = memoize(target.bind(receiver), options);\n memoizedMethods.set(receiver, memoizedMethod);\n }\n return memoizedMethod;\n };\n const installMethod = (receiver, method) => {\n Object.defineProperty(receiver, context.name, {\n configurable: true,\n enumerable: false,\n value: method,\n writable: true,\n });\n return method;\n };\n const installStaticMethodGetter = (receiver) => {\n Object.defineProperty(receiver, context.name, {\n configurable: true,\n enumerable: false,\n get() {\n const currentReceiver = this;\n if (currentReceiver !== receiver) {\n const currentPrototype = Object.getPrototypeOf(currentReceiver);\n if (currentPrototype === receiver\n && !Object.hasOwn(currentReceiver, context.name)) {\n installStaticMethodGetter(currentReceiver);\n }\n }\n return getMemoizedMethod(currentReceiver);\n },\n });\n };\n const decoratedMethod = function (...arguments_) {\n return getMemoizedMethod(this)(...arguments_);\n };\n mimicFunction(decoratedMethod, target, {\n ignoreNonConfigurable: true,\n });\n if (context.static) {\n context.addInitializer(function () {\n installStaticMethodGetter(this);\n });\n }\n else {\n context.addInitializer(function () {\n const receiver = this;\n // Checking the descriptor avoids invoking an overriding accessor while `super()` is still running.\n const descriptor = getPropertyDescriptor(Object.getPrototypeOf(receiver), context.name);\n if (descriptor?.value !== decoratedMethod) {\n return;\n }\n installMethod(receiver, getMemoizedMethod(receiver));\n });\n }\n return decoratedMethod;\n }\n const memoizedGetters = new WeakMap();\n return function () {\n let memoizedGetter = memoizedGetters.get(this);\n if (!memoizedGetter) {\n memoizedGetter = memoize(() => target.call(this), options);\n memoizedGetters.set(this, memoizedGetter);\n }\n return memoizedGetter();\n };\n }\n return decorator;\n}\n/**\nClear all cached data of a memoized function.\n\n@param function_ - The memoized function.\n*/\nexport function memoizeClear(function_) {\n const cache = cacheStore.get(function_);\n if (!cache) {\n throw new TypeError('Can\\'t clear a function that was not memoized!');\n }\n if (typeof cache.clear !== 'function') {\n throw new TypeError('The cache Map can\\'t be cleared!');\n }\n cache.clear();\n for (const timer of cacheTimerStore.get(function_) ?? []) {\n clearTimeout(timer);\n }\n cacheTimerStore.delete(function_);\n}\n/**\nCheck if a specific set of arguments is cached for a memoized function.\n\n@param function_ - The memoized function.\n@param arguments_ - The arguments to check.\n@returns `true` if the arguments are cached and not expired, `false` otherwise.\n\nUses the same argument processing as the memoized function, including any custom `cacheKey` function.\n\n@example\n```\nimport memoize, {memoizeIsCached} from 'memoize';\n\nconst expensive = memoize((a, b) => a + b, {cacheKey: JSON.stringify});\nexpensive(1, 2);\n\nmemoizeIsCached(expensive, 1, 2);\n//=> true\n\nmemoizeIsCached(expensive, 3, 4);\n//=> false\n```\n*/\nexport function memoizeIsCached(function_, ...arguments_) {\n const cacheKey = cacheKeyStore.get(function_);\n if (!cacheKey) {\n return false;\n }\n const cache = cacheStore.get(function_);\n const key = cacheKey(arguments_);\n const item = getValidCacheItem(cache, key);\n return item !== undefined;\n}\n","import memoize from 'memoize'\nimport normalizeUrlImpl from 'normalize-url'\n\nexport const normalizeUrl = memoize((url?: string) => {\n if (!url) return ''\n\n try {\n if (url.startsWith('https://www.notion.so/image/')) {\n const u = new URL(url)\n const subUrl = decodeURIComponent(u.pathname.substring('/image/'.length))\n const normalizedSubUrl = normalizeUrl(subUrl)\n u.pathname = `/image/${encodeURIComponent(normalizedSubUrl)}`\n url = u.toString()\n }\n\n return normalizeUrlImpl(url, {\n stripProtocol: true,\n stripWWW: true,\n stripHash: true,\n stripTextFragment: true,\n removeQueryParameters: true\n })\n } catch (err) {\n return ''\n }\n})\n","import type { ExtendedRecordMap } from '@texonom/ntypes'\n\nexport function mergeRecordMaps(recordMapA: ExtendedRecordMap, recordMapB: ExtendedRecordMap): ExtendedRecordMap {\n const mergedRecordMap: ExtendedRecordMap = {\n block: {\n ...recordMapA.block,\n ...recordMapB.block\n },\n collection: {\n ...recordMapA.collection,\n ...recordMapB.collection\n },\n collection_view: {\n ...recordMapA.collection_view,\n ...recordMapB.collection_view\n },\n notion_user: {\n ...recordMapA.notion_user,\n ...recordMapB.notion_user\n },\n collection_query: {\n ...recordMapA.collection_query,\n ...recordMapB.collection_query\n },\n signed_urls: {\n ...recordMapA.signed_urls,\n ...recordMapB.signed_urls\n },\n preview_images: {\n ...recordMapA.preview_images,\n ...recordMapB.preview_images\n }\n }\n\n return mergedRecordMap\n}\n","export const formatDate = (input: string | number, { month = 'short' }: { month?: 'long' | 'short' } = {}) => {\n const date = new Date(input)\n const monthLocale = date.toLocaleString('en-US', { month })\n return `${date.getUTCFullYear()} ${monthLocale} ${date.getUTCDate()} ${date.getUTCHours()}:${date.getUTCMinutes()}`\n}\n","import { formatDate } from './format-date'\n\nexport interface NotionDateTime {\n type: 'datetime'\n start_date: string\n start_time?: string\n time_zone?: string\n}\n\nexport const formatNotionDateTime = (datetime: NotionDateTime) => {\n const dateString = `${datetime.start_time || ''} ${datetime.start_date} ${datetime.time_zone || ''}`\n return formatDate(dateString)\n}\n","import { Block, ExtendedRecordMap, PageBlock } from '@texonom/ntypes'\n\nimport { getBlockTitle } from './get-block-title'\nimport { getPageTableOfContents } from './get-page-table-of-contents'\n\ntype EstimatePageReadTimeOptions = {\n wordsPerMinute?: number\n imageReadTimeInSeconds?: number\n}\n\ntype ContentStats = {\n numWords: number\n numImages: number\n}\n\ntype PageReadTimeEstimate = ContentStats & {\n totalWordsReadTimeInMinutes: number\n totalImageReadTimeInMinutes: number\n totalReadTimeInMinutes: number\n}\n\n/**\n * Returns an estimate for the time it would take for a person to read the content\n * in the given Notion page.\n *\n * Uses Medium for inspiration.\n *\n * @see https://blog.medium.com/read-time-and-you-bc2048ab620c\n * @see https://github.com/ngryman/reading-time\n *\n * TODO: handle non-english content.\n */\nexport function estimatePageReadTime(\n block: Block,\n recordMap: ExtendedRecordMap,\n { wordsPerMinute = 275, imageReadTimeInSeconds = 12 }: EstimatePageReadTimeOptions = {}\n): PageReadTimeEstimate {\n const stats = getBlockContentStats(block, recordMap)\n const totalWordsReadTimeInMinutes = stats.numWords / wordsPerMinute\n const totalImageReadTimeInSeconds =\n stats.numImages > 10\n ? (stats.numImages / 2) * (imageReadTimeInSeconds + 3) + (stats.numImages - 10) * 3 // n/2(a+b) + 3 sec/image\n : (stats.numImages / 2) * (2 * imageReadTimeInSeconds + (1 - stats.numImages)) // n/2[2a+(n-1)d]\n const totalImageReadTimeInMinutes = totalImageReadTimeInSeconds / 60\n\n const totalReadTimeInMinutes = totalWordsReadTimeInMinutes + totalImageReadTimeInMinutes\n\n return {\n ...stats,\n totalWordsReadTimeInMinutes,\n totalImageReadTimeInMinutes,\n totalReadTimeInMinutes\n }\n}\n\n/**\n * Same as `estimatePageReadTime`, except it returns the total time estimate as\n * a human-readable string.\n *\n * For example, \"9 minutes\" or \"less than a minute\".\n */\nexport function estimatePageReadTimeAsHumanizedString(\n block: Block,\n recordMap: ExtendedRecordMap,\n opts: EstimatePageReadTimeOptions\n) {\n const estimate = estimatePageReadTime(block, recordMap, opts)\n return humanizeReadTime(estimate.totalReadTimeInMinutes)\n}\n\nfunction getBlockContentStats(block: Block, recordMap: ExtendedRecordMap): ContentStats {\n const stats: ContentStats = {\n numWords: 0,\n numImages: 0\n }\n\n if (!block) return stats\n\n for (const childId of block.content || []) {\n const child = recordMap.block[childId]?.value\n let recurse = false\n if (!child) continue\n\n switch (child.type) {\n case 'quote':\n // fallthrough\n case 'alias':\n // fallthrough\n case 'header':\n // fallthrough\n case 'sub_header':\n // fallthrough\n case 'sub_sub_header': {\n const title = getBlockTitle(child, recordMap)\n stats.numWords += countWordsInText(title)\n break\n }\n\n case 'callout':\n // fallthrough\n case 'toggle':\n // fallthrough\n case 'to_do':\n // fallthrough\n case 'bulleted_list':\n // fallthrough\n case 'numbered_list':\n // fallthrough\n case 'text': {\n const title = getBlockTitle(child, recordMap)\n stats.numWords += countWordsInText(title)\n recurse = true\n break\n }\n\n case 'embed':\n // fallthrough\n case 'tweet':\n // fallthrough\n case 'maps':\n // fallthrough\n case 'pdf':\n // fallthrough\n case 'figma':\n // fallthrough\n case 'typeform':\n // fallthrough\n case 'codepen':\n // fallthrough\n case 'excalidraw':\n // fallthrough\n case 'gist':\n // fallthrough\n case 'video':\n // fallthrough\n case 'drive':\n // fallthrough\n case 'audio':\n // fallthrough\n case 'file':\n // fallthrough\n case 'image':\n // treat all embeds as images\n stats.numImages += 1\n break\n\n case 'bookmark':\n // treat bookmarks as quarter images since they aren't as content-ful as embedd images\n stats.numImages += 0.25\n break\n\n case 'code':\n // treat code blocks as double the complexity of images\n stats.numImages += 2\n break\n\n case 'table':\n // fallthrough\n case 'collection_view':\n // treat collection views as double the complexity of images\n stats.numImages += 2\n break\n\n case 'column':\n // fallthrough\n case 'column_list':\n // fallthrough\n case 'transclusion_container':\n recurse = true\n break\n\n case 'table_of_contents': {\n const page = block as PageBlock\n if (!page) continue\n\n const toc = getPageTableOfContents(page, recordMap)\n for (const tocItem of toc) stats.numWords += countWordsInText(tocItem.text)\n\n break\n }\n\n case 'transclusion_reference': {\n const referencePointerId = child?.format?.transclusion_reference_pointer?.id\n\n if (!referencePointerId) continue\n\n const referenceBlock = recordMap.block[referencePointerId]?.value\n if (referenceBlock) mergeContentStats(stats, getBlockContentStats(referenceBlock, recordMap))\n\n break\n }\n\n default:\n // ignore unrecognized blocks\n break\n }\n\n if (recurse) mergeContentStats(stats, getBlockContentStats(child, recordMap))\n }\n\n return stats\n}\n\nfunction mergeContentStats(statsA: ContentStats, statsB: ContentStats) {\n statsA.numWords += statsB.numWords\n statsA.numImages += statsB.numImages\n}\n\nfunction countWordsInText(text: string): number {\n if (!text) return 0\n\n return (text.match(/\\w+/g) || []).length\n}\n\nfunction humanizeReadTime(time: number): string {\n if (time < 0.5) return 'less than a minute'\n\n if (time < 1.5) return '1 minute'\n\n return `${Math.ceil(time)} minutes`\n}\n","import { Block } from '@texonom/ntypes'\n\nexport const defaultMapImageUrl = (url: string, block: Block): string | null => {\n if (!url) return null\n\n if (url.startsWith('data:')) return url\n\n // more recent versions of notion don't proxy unsplash images\n if (url.startsWith('https://images.unsplash.com')) return url\n\n // Don't proxy external URLs that aren't from Notion or AWS S3\n // The notion.so/image/ proxy frequently fails for arbitrary external URLs\n try {\n const u = new URL(url)\n if (\n (u.protocol === 'https:' || u.protocol === 'http:') &&\n !u.hostname.endsWith('.notion.so') &&\n !u.hostname.endsWith('.amazonaws.com') &&\n u.hostname !== 'www.notion.so' &&\n u.hostname !== 'notion.so'\n )\n return url\n } catch {\n // ignore invalid urls\n }\n\n try {\n const u = new URL(url)\n\n if (u.pathname.startsWith('/secure.notion-static.com') && u.hostname.endsWith('.amazonaws.com'))\n if (\n u.searchParams.has('X-Amz-Credential') &&\n u.searchParams.has('X-Amz-Signature') &&\n u.searchParams.has('X-Amz-Algorithm')\n )\n // if the URL is already signed, then use it as-is\n return url\n\n // external HTTPS URLs that aren't from notion.so or amazonaws should bypass the proxy\n if (u.protocol === 'https:' && !u.hostname.endsWith('notion.so') && !u.hostname.endsWith('amazonaws.com')) return url\n } catch {\n // ignore invalid urls\n }\n\n if (url.startsWith('/images')) url = `https://www.notion.so${url}`\n\n url = `https://www.notion.so${url.startsWith('/image') ? url : `/image/${encodeURIComponent(url)}`}`\n\n const notionImageUrlV2 = new URL(url)\n let table = block.parent_table === 'space' ? 'block' : block.parent_table\n if (table === 'collection' || table === 'team') table = 'block'\n\n notionImageUrlV2.searchParams.set('table', table)\n notionImageUrlV2.searchParams.set('id', block.id)\n notionImageUrlV2.searchParams.set('cache', 'v2')\n\n url = notionImageUrlV2.toString()\n\n return url\n}\n","export const defaultMapPageUrl = (rootPageId?: string) => (pageId: string) => {\n pageId = (pageId || '').replace(/-/g, '')\n\n if (rootPageId && pageId === rootPageId) return '/'\n else return `/${pageId}`\n}\n"],"ignoreList":[20,21],"mappings":";;;AAQA,IAAaE,KAAkB,MAAgC;;CAIxD,OAHAE,IACI,MAAM,QAAQA,CAAI,KACzB,IAAAA,KAAA,OAAA,KAAA,IAAOA,EAAM,QAAQ,GAAM,MAAYC,KAAQC,EAAQ,OAAO,OAAOA,EAAQ,OAAO,MAAMA,EAAQ,KAAK,KAAK,EAAE,MAAA,OAAK,KAALH,IACpGC,IAHM;AAIpB;;;ACXA,SAAgBG,EAAqB,GAAc,GAA6C;;CAC9F,IAAMG,IACHC,EAA8B,mBAAA,IAAkBA,EAA8B,WAAA,SAAA,IAAAH,EAAQ,uBAAA,OAAA,KAAA,IAAAA,EAAoB;CAE7G,IAAIE,GAAc,OAAOA;CAEzB,IAAME,IAAAD,KAAA,SAAA,IAAoBA,EAA+B,aAAA,OAAA,KAAA,IAAAF,EAAW;CACpE,IAAIG,GAAkB;;EACpB,IAAME,KAAA,IAAiBC,EAAU,oBAAA,SAAA,IAAAF,EAAkBD,OAAA,OAAA,KAAA,IAAAC,EAAmB;EACtE,IAAIC,GAAgB;;GAElB,QAAA,IADqBA,EAAe,WAAA,SAAA,IAAAE,EAAQ,uBAAA,OAAA,KAAA,IAAAA,EAAoB;EAElE;CACF;CAEA,OAAO;AACT;;;ACbA,SAAgBC,EAAc,GAAc,GAA8B;;CACxE,KAAA,IAAIN,EAAM,eAA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AAQ,CAER;CAEA,IAAI;EACF,IAAMwE,IAAI,IAAI,IAAIqF,CAAG;EAYrB,IAVIrF,EAAE,SAAS,WAAW,2BAA2B,KAAKA,EAAE,SAAS,SAAS,gBAAgB,KAE1FA,EAAE,aAAa,IAAI,kBAAkB,KACrCA,EAAE,aAAa,IAAI,iBAAiB,KACpCA,EAAE,aAAa,IAAI,iBAAiB,KAMpCA,EAAE,aAAa,YAAY,CAACA,EAAE,SAAS,SAAS,WAAW,KAAK,CAACA,EAAE,SAAS,SAAS,eAAe,GAAG,OAAOqF;CACpH,SAAAwF,GAAQ,CAER;CAIA,AAFIxF,EAAI,WAAW,SAAS,MAAG,IAAM,wBAAwBA,MAE7D,IAAM,wBAAwBA,EAAI,WAAW,QAAQ,IAAIA,IAAM,UAAU,mBAAmBA,CAAG;CAE/F,IAAMyF,IAAmB,IAAI,IAAIzF,CAAG,GAChCrG,IAAQnF,EAAM,iBAAiB,UAAU,UAAUA,EAAM;CAS7D,QARImF,MAAU,gBAAgBA,MAAU,YAAQ,IAAQ,UAExD8L,EAAiB,aAAa,IAAI,SAAS9L,CAAK,GAChD8L,EAAiB,aAAa,IAAI,MAAMjR,EAAM,EAAE,GAChDiR,EAAiB,aAAa,IAAI,SAAS,IAAI,GAE/C,IAAMA,EAAiB,SAAS,GAEzBzF;AACT,GC3Da0F,MAAqB,OAAyB,OACzD,KAAUpI,KAAU,GAAA,CAAI,QAAQ,MAAM,EAAE,GAEpCqI,KAAcrI,MAAWqI,IAAmB,MACpC,IAAIrI"}
|
|
@@ -18,4 +18,32 @@ export declare const isEditableBlock: (block: {
|
|
|
18
18
|
type: string;
|
|
19
19
|
properties?: Record<string, unknown>;
|
|
20
20
|
}) => boolean;
|
|
21
|
+
/** Formats a rich-text editor reads and writes as they are: on/off styles, and a colour or a link with its value. */
|
|
22
|
+
export declare const TITLE_STYLES: ReadonlySet<string>;
|
|
23
|
+
/** Inline objects carried through an edit untouched and written back by the API: a page mention, a user mention, an equation. */
|
|
24
|
+
export declare const TITLE_INLINES: ReadonlySet<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Whether a title survives being edited and written back to Notion unchanged.
|
|
27
|
+
*
|
|
28
|
+
* Saving a block writes its whole rich text, so anything the write cannot carry
|
|
29
|
+
* would be erased by the first keystroke: a comment highlight, a date mention,
|
|
30
|
+
* a link preview. A block whose title has one stays read-only. An empty title
|
|
31
|
+
* is trivially safe.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isRoundTrippableTitle(title: unknown): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Block types the page lets the owner type into where they stand, formatting
|
|
36
|
+
* and all. Wider than `EDITABLE_BLOCK_TYPES`, which is for replacing a title
|
|
37
|
+
* with plain text from outside the page.
|
|
38
|
+
*/
|
|
39
|
+
export declare const IN_PLACE_BLOCK_TYPES: ReadonlySet<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the page draws a block's title for typing into. The renderer and the
|
|
42
|
+
* host that saves read this one rule, so nothing typed lands where it cannot
|
|
43
|
+
* be written back.
|
|
44
|
+
*/
|
|
45
|
+
export declare const isEditableInPlace: (block: {
|
|
46
|
+
type: string;
|
|
47
|
+
properties?: Record<string, unknown>;
|
|
48
|
+
}) => boolean;
|
|
21
49
|
//# sourceMappingURL=is-editable-block.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-editable-block.d.ts","sourceRoot":"","sources":["../src/is-editable-block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAOnD,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,UAAU,EAO9D,CAAA;AAEH,oEAAoE;AACpE,eAAO,MAAM,eAAe,GAAI,OAAO;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,KAAG,OACjB,CAAA"}
|
|
1
|
+
{"version":3,"file":"is-editable-block.d.ts","sourceRoot":"","sources":["../src/is-editable-block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAOnD,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,UAAU,EAO9D,CAAA;AAEH,oEAAoE;AACpE,eAAO,MAAM,eAAe,GAAI,OAAO;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,KAAG,OACjB,CAAA;AAE/E,qHAAqH;AACrH,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,CAAsC,CAAA;AAEnF,iIAAiI;AACjI,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,CAA4B,CAAA;AAE1E;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAqB7D;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAAkE,CAAA;AAEvH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,KAAG,OACV,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@texonom/nutils",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Useful utilities for working with Notion data. Isomorphic.",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"is-url-superb": "^6.1.0",
|
|
34
34
|
"memoize": "^11.0.0",
|
|
35
35
|
"normalize-url": "^9.0.1",
|
|
36
|
-
"@texonom/ntypes": "^1.6.
|
|
36
|
+
"@texonom/ntypes": "^1.6.6",
|
|
37
37
|
"p-queue": "^9.3.3"
|
|
38
38
|
},
|
|
39
39
|
"standard-version": {
|