@texonom/nutils 1.1.1 → 1.1.3

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.
Files changed (84) hide show
  1. package/build/.tsbuildinfo +1 -1
  2. package/build/estimate-page-read-time.d.ts +34 -34
  3. package/build/format-date.d.ts +3 -3
  4. package/build/format-notion-date-time.d.ts +7 -7
  5. package/build/get-all-pages-in-space.d.ts +21 -21
  6. package/build/get-block-collection-id.d.ts +2 -2
  7. package/build/get-block-icon.d.ts +2 -2
  8. package/build/get-block-parent-page.d.ts +10 -10
  9. package/build/get-block-title.d.ts +2 -2
  10. package/build/get-canonical-page-id.d.ts +7 -7
  11. package/build/get-date-value.d.ts +5 -5
  12. package/build/get-page-breadcrumbs.d.ts +2 -2
  13. package/build/get-page-content-block-ids.d.ts +5 -5
  14. package/build/get-page-image-urls.d.ts +7 -7
  15. package/build/get-page-property.d.ts +15 -15
  16. package/build/get-page-table-of-contents.d.ts +12 -12
  17. package/build/get-page-title.d.ts +2 -2
  18. package/build/get-text-content.d.ts +8 -8
  19. package/build/id-to-uuid.d.ts +1 -1
  20. package/build/index.d.ts +118 -118
  21. package/build/is-url.d.ts +2 -2
  22. package/build/merge-record-maps.d.ts +2 -2
  23. package/build/normalize-title.d.ts +1 -1
  24. package/build/normalize-url.d.ts +1 -1
  25. package/build/normalize-url.test.d.ts +1 -1
  26. package/build/parse-page-id.d.ts +8 -8
  27. package/build/parse-page-id.test.d.ts +1 -1
  28. package/build/uuid-to-id.d.ts +1 -1
  29. package/package.json +4 -4
  30. package/readme.md +3 -3
  31. package/build/src/estimate-page-read-time.d.ts +0 -35
  32. package/build/src/estimate-page-read-time.d.ts.map +0 -1
  33. package/build/src/format-date.d.ts +0 -4
  34. package/build/src/format-date.d.ts.map +0 -1
  35. package/build/src/format-notion-date-time.d.ts +0 -8
  36. package/build/src/format-notion-date-time.d.ts.map +0 -1
  37. package/build/src/get-all-pages-in-space.d.ts +0 -22
  38. package/build/src/get-all-pages-in-space.d.ts.map +0 -1
  39. package/build/src/get-block-collection-id.d.ts +0 -3
  40. package/build/src/get-block-collection-id.d.ts.map +0 -1
  41. package/build/src/get-block-icon.d.ts +0 -3
  42. package/build/src/get-block-icon.d.ts.map +0 -1
  43. package/build/src/get-block-parent-page.d.ts +0 -11
  44. package/build/src/get-block-parent-page.d.ts.map +0 -1
  45. package/build/src/get-block-title.d.ts +0 -3
  46. package/build/src/get-block-title.d.ts.map +0 -1
  47. package/build/src/get-canonical-page-id.d.ts +0 -8
  48. package/build/src/get-canonical-page-id.d.ts.map +0 -1
  49. package/build/src/get-date-value.d.ts +0 -6
  50. package/build/src/get-date-value.d.ts.map +0 -1
  51. package/build/src/get-page-breadcrumbs.d.ts +0 -3
  52. package/build/src/get-page-breadcrumbs.d.ts.map +0 -1
  53. package/build/src/get-page-content-block-ids.d.ts +0 -6
  54. package/build/src/get-page-content-block-ids.d.ts.map +0 -1
  55. package/build/src/get-page-image-urls.d.ts +0 -8
  56. package/build/src/get-page-image-urls.d.ts.map +0 -1
  57. package/build/src/get-page-property.d.ts +0 -16
  58. package/build/src/get-page-property.d.ts.map +0 -1
  59. package/build/src/get-page-table-of-contents.d.ts +0 -13
  60. package/build/src/get-page-table-of-contents.d.ts.map +0 -1
  61. package/build/src/get-page-title.d.ts +0 -3
  62. package/build/src/get-page-title.d.ts.map +0 -1
  63. package/build/src/get-text-content.d.ts +0 -9
  64. package/build/src/get-text-content.d.ts.map +0 -1
  65. package/build/src/id-to-uuid.d.ts +0 -2
  66. package/build/src/id-to-uuid.d.ts.map +0 -1
  67. package/build/src/index.d.ts +0 -25
  68. package/build/src/index.d.ts.map +0 -1
  69. package/build/src/is-url.d.ts +0 -3
  70. package/build/src/is-url.d.ts.map +0 -1
  71. package/build/src/merge-record-maps.d.ts +0 -3
  72. package/build/src/merge-record-maps.d.ts.map +0 -1
  73. package/build/src/normalize-title.d.ts +0 -2
  74. package/build/src/normalize-title.d.ts.map +0 -1
  75. package/build/src/normalize-url.d.ts +0 -2
  76. package/build/src/normalize-url.d.ts.map +0 -1
  77. package/build/src/parse-page-id.d.ts +0 -9
  78. package/build/src/parse-page-id.d.ts.map +0 -1
  79. package/build/src/uuid-to-id.d.ts +0 -2
  80. package/build/src/uuid-to-id.d.ts.map +0 -1
  81. package/build/test/normalize-url.test.d.ts +0 -2
  82. package/build/test/normalize-url.test.d.ts.map +0 -1
  83. package/build/test/parse-page-id.test.d.ts +0 -2
  84. package/build/test/parse-page-id.test.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- export declare const idToUuid: (id?: string) => string;
1
+ export declare const idToUuid: (id?: string) => string;
2
2
  //# sourceMappingURL=id-to-uuid.d.ts.map
package/build/index.d.ts CHANGED
@@ -2,12 +2,12 @@ import * as types from '@texonom/ntypes';
2
2
  import { Block, ExtendedRecordMap, PageMap } from '@texonom/ntypes';
3
3
  export { default as isUrl } from 'is-url-superb';
4
4
 
5
- /**
6
- * Gets the raw, unformatted text content of a block's content value.
7
- *
8
- * This is useful, for instance, for extracting a block's `title` without any
9
- * rich text formatting.
10
- */
5
+ /**
6
+ * Gets the raw, unformatted text content of a block's content value.
7
+ *
8
+ * This is useful, for instance, for extracting a block's `title` without any
9
+ * rich text formatting.
10
+ */
11
11
  declare const getTextContent: (text?: types.Decoration[]) => string;
12
12
 
13
13
  declare function getBlockTitle(block: Block, recordMap: ExtendedRecordMap): string;
@@ -18,101 +18,101 @@ declare function getBlockCollectionId(block: Block, recordMap: ExtendedRecordMap
18
18
 
19
19
  declare function getPageTitle(recordMap: ExtendedRecordMap): string;
20
20
 
21
- /**
22
- * Gets the value of a collection property for a given page (collection item).
23
- *
24
- * @param propertyName property name
25
- * @param block Page block, often be first block in blockMap
26
- * @param recordMap
27
- * @returns - The return value types will follow the following principles:
28
- * 1. if property is date type, it will return `number` or `number[]`(depends on `End Date` switch)
29
- * 2. property is text-like will return `string`
30
- * 3. multi select property will return `string[]`
31
- * 4. checkbox property return `boolean`
32
- * @todo complete all no-text property type
33
- */
21
+ /**
22
+ * Gets the value of a collection property for a given page (collection item).
23
+ *
24
+ * @param propertyName property name
25
+ * @param block Page block, often be first block in blockMap
26
+ * @param recordMap
27
+ * @returns - The return value types will follow the following principles:
28
+ * 1. if property is date type, it will return `number` or `number[]`(depends on `End Date` switch)
29
+ * 2. property is text-like will return `string`
30
+ * 3. multi select property will return `string[]`
31
+ * 4. checkbox property return `boolean`
32
+ * @todo complete all no-text property type
33
+ */
34
34
  declare function getPageProperty<T = string | number | boolean | string[] | number[]>(propertyName: string, block: Block, recordMap: ExtendedRecordMap): T;
35
35
 
36
- /**
37
- * Attempts to find a valid date from a given property.
38
- */
36
+ /**
37
+ * Attempts to find a valid date from a given property.
38
+ */
39
39
  declare const getDateValue: (prop: any[]) => types.FormattedDate | null;
40
40
 
41
- /**
42
- * Returns the parent page block containing a given page.
43
- *
44
- * Note that many times this will not be the direct parent block since
45
- * some non-page content blocks can contain sub-blocks.
46
- */
47
- declare const getBlockParentPage: (block: types.Block, recordMap: types.ExtendedRecordMap, { inclusive }?: {
48
- inclusive?: boolean;
41
+ /**
42
+ * Returns the parent page block containing a given page.
43
+ *
44
+ * Note that many times this will not be the direct parent block since
45
+ * some non-page content blocks can contain sub-blocks.
46
+ */
47
+ declare const getBlockParentPage: (block: types.Block, recordMap: types.ExtendedRecordMap, { inclusive }?: {
48
+ inclusive?: boolean;
49
49
  }) => types.PageBlock | null;
50
50
 
51
- interface TableOfContentsEntry {
52
- id: types.ID;
53
- type: types.BlockType;
54
- text: string;
55
- indentLevel: number;
56
- }
57
- /**
58
- * Gets the metadata for a table of contents block by parsing the page's
59
- * H1, H2, and H3 elements.
60
- */
51
+ interface TableOfContentsEntry {
52
+ id: types.ID;
53
+ type: types.BlockType;
54
+ text: string;
55
+ indentLevel: number;
56
+ }
57
+ /**
58
+ * Gets the metadata for a table of contents block by parsing the page's
59
+ * H1, H2, and H3 elements.
60
+ */
61
61
  declare const getPageTableOfContents: (page: types.PageBlock, recordMap: types.ExtendedRecordMap) => Array<TableOfContentsEntry>;
62
62
 
63
- /**
64
- * Gets the IDs of all blocks contained on a page starting from a root block ID.
65
- */
63
+ /**
64
+ * Gets the IDs of all blocks contained on a page starting from a root block ID.
65
+ */
66
66
  declare const getPageContentBlockIds: (recordMap: types.ExtendedRecordMap, blockId?: string) => string[];
67
67
 
68
- /**
69
- * Robustly extracts the notion page ID from a notion URL or pathname suffix.
70
- *
71
- * Defaults to returning a UUID (with dashes).
72
- */
73
- declare const parsePageId: (id?: string | null, { uuid }?: {
74
- uuid?: boolean;
68
+ /**
69
+ * Robustly extracts the notion page ID from a notion URL or pathname suffix.
70
+ *
71
+ * Defaults to returning a UUID (with dashes).
72
+ */
73
+ declare const parsePageId: (id?: string | null, { uuid }?: {
74
+ uuid?: boolean;
75
75
  }) => string;
76
76
 
77
77
  declare const idToUuid: (id?: string) => string;
78
78
 
79
79
  declare const uuidToId: (uuid: string) => string;
80
80
 
81
- /**
82
- * Performs a traversal over a given Notion workspace starting from a seed page.
83
- *
84
- * Returns a map containing all of the pages that are reachable from the seed
85
- * page in the space.
86
- *
87
- * If `rootSpaceId` is not defined, the space ID of the root page will be used
88
- * to scope traversal.
89
- *
90
- *
91
- * @param rootPageId - Page ID to start from.
92
- * @param rootSpaceId - Space ID to scope traversal.
93
- * @param getPage - Function used to fetch a single page.
94
- * @param opts - Optional config
95
- */
96
- declare function getAllPagesInSpace(rootPageId: string, rootSpaceId: string | undefined, getPage: (pageId: string) => Promise<ExtendedRecordMap>, { concurrency, traverseCollections, targetPageId }?: {
97
- concurrency?: number;
98
- traverseCollections?: boolean;
99
- targetPageId?: string;
81
+ /**
82
+ * Performs a traversal over a given Notion workspace starting from a seed page.
83
+ *
84
+ * Returns a map containing all of the pages that are reachable from the seed
85
+ * page in the space.
86
+ *
87
+ * If `rootSpaceId` is not defined, the space ID of the root page will be used
88
+ * to scope traversal.
89
+ *
90
+ *
91
+ * @param rootPageId - Page ID to start from.
92
+ * @param rootSpaceId - Space ID to scope traversal.
93
+ * @param getPage - Function used to fetch a single page.
94
+ * @param opts - Optional config
95
+ */
96
+ declare function getAllPagesInSpace(rootPageId: string, rootSpaceId: string | undefined, getPage: (pageId: string) => Promise<ExtendedRecordMap>, { concurrency, traverseCollections, targetPageId }?: {
97
+ concurrency?: number;
98
+ traverseCollections?: boolean;
99
+ targetPageId?: string;
100
100
  }): Promise<PageMap>;
101
101
 
102
- /**
103
- * Gets the canonical, display-friendly version of a page's ID for use in URLs.
104
- */
105
- declare const getCanonicalPageId: (pageId: string, recordMap: ExtendedRecordMap, { uuid }?: {
106
- uuid?: boolean;
102
+ /**
103
+ * Gets the canonical, display-friendly version of a page's ID for use in URLs.
104
+ */
105
+ declare const getCanonicalPageId: (pageId: string, recordMap: ExtendedRecordMap, { uuid }?: {
106
+ uuid?: boolean;
107
107
  }) => string | null;
108
108
 
109
109
  declare const getPageBreadcrumbs: (recordMap: types.ExtendedRecordMap, activePageId: string) => Array<any> | null;
110
110
 
111
- /**
112
- * Gets URLs of all images contained on the given page.
113
- */
114
- declare const getPageImageUrls: (recordMap: types.ExtendedRecordMap, { mapImageUrl }: {
115
- mapImageUrl: (url: string, block: types.Block) => string | null;
111
+ /**
112
+ * Gets URLs of all images contained on the given page.
113
+ */
114
+ declare const getPageImageUrls: (recordMap: types.ExtendedRecordMap, { mapImageUrl }: {
115
+ mapImageUrl: (url: string, block: types.Block) => string | null;
116
116
  }) => string[];
117
117
 
118
118
  declare const normalizeUrl: (url?: string) => string;
@@ -121,49 +121,49 @@ declare const normalizeTitle: (title?: string | null) => string;
121
121
 
122
122
  declare function mergeRecordMaps(recordMapA: ExtendedRecordMap, recordMapB: ExtendedRecordMap): ExtendedRecordMap;
123
123
 
124
- declare const formatDate: (input: string | number, { month }?: {
125
- month?: 'long' | 'short';
124
+ declare const formatDate: (input: string | number, { month }?: {
125
+ month?: 'long' | 'short';
126
126
  }) => string;
127
127
 
128
- interface NotionDateTime {
129
- type: 'datetime';
130
- start_date: string;
131
- start_time?: string;
132
- time_zone?: string;
133
- }
128
+ interface NotionDateTime {
129
+ type: 'datetime';
130
+ start_date: string;
131
+ start_time?: string;
132
+ time_zone?: string;
133
+ }
134
134
  declare const formatNotionDateTime: (datetime: NotionDateTime) => string;
135
135
 
136
- type EstimatePageReadTimeOptions = {
137
- wordsPerMinute?: number;
138
- imageReadTimeInSeconds?: number;
139
- };
140
- type ContentStats = {
141
- numWords: number;
142
- numImages: number;
143
- };
144
- type PageReadTimeEstimate = ContentStats & {
145
- totalWordsReadTimeInMinutes: number;
146
- totalImageReadTimeInMinutes: number;
147
- totalReadTimeInMinutes: number;
148
- };
149
- /**
150
- * Returns an estimate for the time it would take for a person to read the content
151
- * in the given Notion page.
152
- *
153
- * Uses Medium for inspiration.
154
- *
155
- * @see https://blog.medium.com/read-time-and-you-bc2048ab620c
156
- * @see https://github.com/ngryman/reading-time
157
- *
158
- * TODO: handle non-english content.
159
- */
160
- declare function estimatePageReadTime(block: Block, recordMap: ExtendedRecordMap, { wordsPerMinute, imageReadTimeInSeconds }?: EstimatePageReadTimeOptions): PageReadTimeEstimate;
161
- /**
162
- * Same as `estimatePageReadTime`, except it returns the total time estimate as
163
- * a human-readable string.
164
- *
165
- * For example, "9 minutes" or "less than a minute".
166
- */
136
+ type EstimatePageReadTimeOptions = {
137
+ wordsPerMinute?: number;
138
+ imageReadTimeInSeconds?: number;
139
+ };
140
+ type ContentStats = {
141
+ numWords: number;
142
+ numImages: number;
143
+ };
144
+ type PageReadTimeEstimate = ContentStats & {
145
+ totalWordsReadTimeInMinutes: number;
146
+ totalImageReadTimeInMinutes: number;
147
+ totalReadTimeInMinutes: number;
148
+ };
149
+ /**
150
+ * Returns an estimate for the time it would take for a person to read the content
151
+ * in the given Notion page.
152
+ *
153
+ * Uses Medium for inspiration.
154
+ *
155
+ * @see https://blog.medium.com/read-time-and-you-bc2048ab620c
156
+ * @see https://github.com/ngryman/reading-time
157
+ *
158
+ * TODO: handle non-english content.
159
+ */
160
+ declare function estimatePageReadTime(block: Block, recordMap: ExtendedRecordMap, { wordsPerMinute, imageReadTimeInSeconds }?: EstimatePageReadTimeOptions): PageReadTimeEstimate;
161
+ /**
162
+ * Same as `estimatePageReadTime`, except it returns the total time estimate as
163
+ * a human-readable string.
164
+ *
165
+ * For example, "9 minutes" or "less than a minute".
166
+ */
167
167
  declare function estimatePageReadTimeAsHumanizedString(block: Block, recordMap: ExtendedRecordMap, opts: EstimatePageReadTimeOptions): string;
168
168
 
169
169
  export { NotionDateTime, TableOfContentsEntry, estimatePageReadTime, estimatePageReadTimeAsHumanizedString, formatDate, formatNotionDateTime, getAllPagesInSpace, getBlockCollectionId, getBlockIcon, getBlockParentPage, getBlockTitle, getCanonicalPageId, getDateValue, getPageBreadcrumbs, getPageContentBlockIds, getPageImageUrls, getPageProperty, getPageTableOfContents, getPageTitle, getTextContent, idToUuid, mergeRecordMaps, normalizeTitle, normalizeUrl, parsePageId, uuidToId };
package/build/is-url.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import isUrl from 'is-url-superb';
2
- export { isUrl };
1
+ import isUrl from 'is-url-superb';
2
+ export { isUrl };
3
3
  //# sourceMappingURL=is-url.d.ts.map
@@ -1,3 +1,3 @@
1
- import { ExtendedRecordMap } from '@texonom/ntypes';
2
- export declare function mergeRecordMaps(recordMapA: ExtendedRecordMap, recordMapB: ExtendedRecordMap): ExtendedRecordMap;
1
+ import { ExtendedRecordMap } from '@texonom/ntypes';
2
+ export declare function mergeRecordMaps(recordMapA: ExtendedRecordMap, recordMapB: ExtendedRecordMap): ExtendedRecordMap;
3
3
  //# sourceMappingURL=merge-record-maps.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare const normalizeTitle: (title?: string | null) => string;
1
+ export declare const normalizeTitle: (title?: string | null) => string;
2
2
  //# sourceMappingURL=normalize-title.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare const normalizeUrl: (url?: string) => string;
1
+ export declare const normalizeUrl: (url?: string) => string;
2
2
  //# sourceMappingURL=normalize-url.d.ts.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=normalize-url.test.d.ts.map
@@ -1,9 +1,9 @@
1
- /**
2
- * Robustly extracts the notion page ID from a notion URL or pathname suffix.
3
- *
4
- * Defaults to returning a UUID (with dashes).
5
- */
6
- export declare const parsePageId: (id?: string | null, { uuid }?: {
7
- uuid?: boolean;
8
- }) => string;
1
+ /**
2
+ * Robustly extracts the notion page ID from a notion URL or pathname suffix.
3
+ *
4
+ * Defaults to returning a UUID (with dashes).
5
+ */
6
+ export declare const parsePageId: (id?: string | null, { uuid }?: {
7
+ uuid?: boolean;
8
+ }) => string;
9
9
  //# sourceMappingURL=parse-page-id.d.ts.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=parse-page-id.test.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare const uuidToId: (uuid: string) => string;
1
+ export declare const uuidToId: (uuid: string) => string;
2
2
  //# sourceMappingURL=uuid-to-id.d.ts.map
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@texonom/nutils",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "type": "module",
5
5
  "description": "Useful utilities for working with Notion data. Isomorphic.",
6
- "repository": "texonom/notion",
6
+ "repository": "texonom/notion-node",
7
7
  "author": "Alan Jo <sungle3737@gmail.com>",
8
8
  "license": "MIT",
9
9
  "main": "./build/index.js",
@@ -25,9 +25,9 @@
25
25
  "dependencies": {
26
26
  "is-url-superb": "^6.1.0",
27
27
  "mem": "^9.0.2",
28
- "normalize-url": "^7.2.0",
28
+ "normalize-url": "^8.0.0",
29
29
  "p-queue": "^7.3.4",
30
- "@texonom/ntypes": "^1.1.1"
30
+ "@texonom/ntypes": "^1.1.3"
31
31
  },
32
32
  "standard-version": {
33
33
  "skip": {
package/readme.md CHANGED
@@ -1,12 +1,12 @@
1
1
  <p align="center">
2
- <img alt="React Notion X" src="https://raw.githubusercontent.com/texonom/notion/master/media/notion-ts.png" width="689">
2
+ <img alt="React Notion X" src="https://raw.githubusercontent.com/texonom/notion-node/master/media/notion-ts.png" width="689">
3
3
  </p>
4
4
 
5
5
  # nutils
6
6
 
7
7
  > Useful utilities for working with Notion data. Isomorphic.
8
8
 
9
- [![NPM](https://img.shields.io/npm/v/nutils.svg)](https://www.npmjs.com/package/nutils) [![Build Status](https://github.com/texonom/notion/actions/workflows/test.yml/badge.svg)](https://github.com/texonom/notion/actions/workflows/test.yml) [![Prettier Code Formatting](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io)
9
+ [![NPM](https://img.shields.io/npm/v/nutils.svg)](https://www.npmjs.com/package/nutils) [![Build Status](https://github.com/texonom/notion-node/actions/workflows/test.yml/badge.svg)](https://github.com/texonom/notion-node/actions/workflows/test.yml) [![Prettier Code Formatting](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io)
10
10
 
11
11
  ## Install
12
12
 
@@ -33,7 +33,7 @@ parsePageId('About-d9ae0c6e7cad49a78e21d240cf2e3d04', { uuid: false })
33
33
 
34
34
  ## Docs
35
35
 
36
- See the [full docs](https://github.com/texonom/notion).
36
+ See the [full docs](https://github.com/texonom/notion-node).
37
37
 
38
38
  ## License
39
39
 
@@ -1,35 +0,0 @@
1
- import { Block, ExtendedRecordMap } from '@texonom/ntypes';
2
- type EstimatePageReadTimeOptions = {
3
- wordsPerMinute?: number;
4
- imageReadTimeInSeconds?: number;
5
- };
6
- type ContentStats = {
7
- numWords: number;
8
- numImages: number;
9
- };
10
- type PageReadTimeEstimate = ContentStats & {
11
- totalWordsReadTimeInMinutes: number;
12
- totalImageReadTimeInMinutes: number;
13
- totalReadTimeInMinutes: number;
14
- };
15
- /**
16
- * Returns an estimate for the time it would take for a person to read the content
17
- * in the given Notion page.
18
- *
19
- * Uses Medium for inspiration.
20
- *
21
- * @see https://blog.medium.com/read-time-and-you-bc2048ab620c
22
- * @see https://github.com/ngryman/reading-time
23
- *
24
- * TODO: handle non-english content.
25
- */
26
- export declare function estimatePageReadTime(block: Block, recordMap: ExtendedRecordMap, { wordsPerMinute, imageReadTimeInSeconds }?: EstimatePageReadTimeOptions): PageReadTimeEstimate;
27
- /**
28
- * Same as `estimatePageReadTime`, except it returns the total time estimate as
29
- * a human-readable string.
30
- *
31
- * For example, "9 minutes" or "less than a minute".
32
- */
33
- export declare function estimatePageReadTimeAsHumanizedString(block: Block, recordMap: ExtendedRecordMap, opts: EstimatePageReadTimeOptions): string;
34
- export {};
35
- //# sourceMappingURL=estimate-page-read-time.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"estimate-page-read-time.d.ts","sourceRoot":"","sources":["../../src/estimate-page-read-time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAa,MAAM,iBAAiB,CAAA;AAKrE,KAAK,2BAA2B,GAAG;IACjC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC,CAAA;AAED,KAAK,YAAY,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,KAAK,oBAAoB,GAAG,YAAY,GAAG;IACzC,2BAA2B,EAAE,MAAM,CAAA;IACnC,2BAA2B,EAAE,MAAM,CAAA;IACnC,sBAAsB,EAAE,MAAM,CAAA;CAC/B,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,iBAAiB,EAC5B,EAAE,cAAoB,EAAE,sBAA2B,EAAE,GAAE,2BAAgC,GACtF,oBAAoB,CAiBtB;AAED;;;;;GAKG;AACH,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,iBAAiB,EAC5B,IAAI,EAAE,2BAA2B,UAIlC"}
@@ -1,4 +0,0 @@
1
- export declare const formatDate: (input: string | number, { month }?: {
2
- month?: 'long' | 'short';
3
- }) => string;
4
- //# sourceMappingURL=format-date.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format-date.d.ts","sourceRoot":"","sources":["../../src/format-date.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,UAAW,MAAM,GAAG,MAAM;YAAiC,MAAM,GAAG,OAAO;YAIjG,CAAA"}
@@ -1,8 +0,0 @@
1
- export interface NotionDateTime {
2
- type: 'datetime';
3
- start_date: string;
4
- start_time?: string;
5
- time_zone?: string;
6
- }
7
- export declare const formatNotionDateTime: (datetime: NotionDateTime) => string;
8
- //# sourceMappingURL=format-notion-date-time.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format-notion-date-time.d.ts","sourceRoot":"","sources":["../../src/format-notion-date-time.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,oBAAoB,aAAc,cAAc,WAG5D,CAAA"}
@@ -1,22 +0,0 @@
1
- import { ExtendedRecordMap, PageMap } from '@texonom/ntypes';
2
- /**
3
- * Performs a traversal over a given Notion workspace starting from a seed page.
4
- *
5
- * Returns a map containing all of the pages that are reachable from the seed
6
- * page in the space.
7
- *
8
- * If `rootSpaceId` is not defined, the space ID of the root page will be used
9
- * to scope traversal.
10
- *
11
- *
12
- * @param rootPageId - Page ID to start from.
13
- * @param rootSpaceId - Space ID to scope traversal.
14
- * @param getPage - Function used to fetch a single page.
15
- * @param opts - Optional config
16
- */
17
- export declare function getAllPagesInSpace(rootPageId: string, rootSpaceId: string | undefined, getPage: (pageId: string) => Promise<ExtendedRecordMap>, { concurrency, traverseCollections, targetPageId }?: {
18
- concurrency?: number;
19
- traverseCollections?: boolean;
20
- targetPageId?: string;
21
- }): Promise<PageMap>;
22
- //# sourceMappingURL=get-all-pages-in-space.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-all-pages-in-space.d.ts","sourceRoot":"","sources":["../../src/get-all-pages-in-space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAK5D;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,CAAC,EACvD,EACE,WAAe,EACf,mBAA0B,EAC1B,YAAmB,EACpB,GAAE;IACD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAA;CACjB,GACL,OAAO,CAAC,OAAO,CAAC,CAiElB"}
@@ -1,3 +0,0 @@
1
- import { Block, ExtendedRecordMap } from '@texonom/ntypes';
2
- export declare function getBlockCollectionId(block: Block, recordMap: ExtendedRecordMap): string | null;
3
- //# sourceMappingURL=get-block-collection-id.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-block-collection-id.d.ts","sourceRoot":"","sources":["../../src/get-block-collection-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAE1D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAe9F"}
@@ -1,3 +0,0 @@
1
- import { Block, ExtendedRecordMap } from '@texonom/ntypes';
2
- export declare function getBlockIcon(block: Block, recordMap: ExtendedRecordMap): string;
3
- //# sourceMappingURL=get-block-icon.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-block-icon.d.ts","sourceRoot":"","sources":["../../src/get-block-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAa,MAAM,iBAAiB,CAAA;AAIrE,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,UAatE"}
@@ -1,11 +0,0 @@
1
- import * as types from '@texonom/ntypes';
2
- /**
3
- * Returns the parent page block containing a given page.
4
- *
5
- * Note that many times this will not be the direct parent block since
6
- * some non-page content blocks can contain sub-blocks.
7
- */
8
- export declare const getBlockParentPage: (block: types.Block, recordMap: types.ExtendedRecordMap, { inclusive }?: {
9
- inclusive?: boolean;
10
- }) => types.PageBlock | null;
11
- //# sourceMappingURL=get-block-parent-page.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-block-parent-page.d.ts","sourceRoot":"","sources":["../../src/get-block-parent-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAA;AAExC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,UACtB,MAAM,KAAK,aACP,MAAM,iBAAiB;gBAIpB,OAAO;MAEpB,MAAM,SAAS,GAAG,IAqBpB,CAAA"}
@@ -1,3 +0,0 @@
1
- import { Block, ExtendedRecordMap } from '@texonom/ntypes';
2
- export declare function getBlockTitle(block: Block, recordMap: ExtendedRecordMap): string;
3
- //# sourceMappingURL=get-block-title.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-block-title.d.ts","sourceRoot":"","sources":["../../src/get-block-title.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAK1D,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,UAcvE"}
@@ -1,8 +0,0 @@
1
- import { ExtendedRecordMap } from '@texonom/ntypes';
2
- /**
3
- * Gets the canonical, display-friendly version of a page's ID for use in URLs.
4
- */
5
- export declare const getCanonicalPageId: (pageId: string, recordMap: ExtendedRecordMap, { uuid }?: {
6
- uuid?: boolean;
7
- }) => string | null;
8
- //# sourceMappingURL=get-canonical-page-id.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-canonical-page-id.d.ts","sourceRoot":"","sources":["../../src/get-canonical-page-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAOnD;;GAEG;AACH,eAAO,MAAM,kBAAkB,WACrB,MAAM,aACH,iBAAiB;WACF,OAAO;MAChC,MAAM,GAAG,IAkBX,CAAA"}
@@ -1,6 +0,0 @@
1
- import * as types from '@texonom/ntypes';
2
- /**
3
- * Attempts to find a valid date from a given property.
4
- */
5
- export declare const getDateValue: (prop: any[]) => types.FormattedDate | null;
6
- //# sourceMappingURL=get-date-value.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-date-value.d.ts","sourceRoot":"","sources":["../../src/get-date-value.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAA;AAExC;;GAEG;AACH,eAAO,MAAM,YAAY,SAAU,GAAG,EAAE,KAAG,MAAM,aAAa,GAAG,IAUhE,CAAA"}
@@ -1,3 +0,0 @@
1
- import * as types from '@texonom/ntypes';
2
- export declare const getPageBreadcrumbs: (recordMap: types.ExtendedRecordMap, activePageId: string) => Array<any> | null;
3
- //# sourceMappingURL=get-page-breadcrumbs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-page-breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/get-page-breadcrumbs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAA;AAMxC,eAAO,MAAM,kBAAkB,cAAe,MAAM,iBAAiB,gBAAgB,MAAM,KAAG,MAAM,GAAG,CAAC,GAAG,IAoC1G,CAAA"}
@@ -1,6 +0,0 @@
1
- import * as types from '@texonom/ntypes';
2
- /**
3
- * Gets the IDs of all blocks contained on a page starting from a root block ID.
4
- */
5
- export declare const getPageContentBlockIds: (recordMap: types.ExtendedRecordMap, blockId?: string) => string[];
6
- //# sourceMappingURL=get-page-content-block-ids.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-page-content-block-ids.d.ts","sourceRoot":"","sources":["../../src/get-page-content-block-ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAA;AAExC;;GAEG;AACH,eAAO,MAAM,sBAAsB,cAAe,MAAM,iBAAiB,YAAY,MAAM,KAAG,MAAM,EA+CnG,CAAA"}
@@ -1,8 +0,0 @@
1
- import * as types from '@texonom/ntypes';
2
- /**
3
- * Gets URLs of all images contained on the given page.
4
- */
5
- export declare const getPageImageUrls: (recordMap: types.ExtendedRecordMap, { mapImageUrl }: {
6
- mapImageUrl: (url: string, block: types.Block) => string | null;
7
- }) => string[];
8
- //# sourceMappingURL=get-page-image-urls.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-page-image-urls.d.ts","sourceRoot":"","sources":["../../src/get-page-image-urls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAA;AAKxC;;GAEG;AACH,eAAO,MAAM,gBAAgB,cAChB,MAAM,iBAAiB;uBAIb,MAAM,SAAS,MAAM,KAAK,KAAK,MAAM,GAAG,IAAI;MAEhE,MAAM,EA8DR,CAAA"}
@@ -1,16 +0,0 @@
1
- import { Block, ExtendedRecordMap } from '@texonom/ntypes';
2
- /**
3
- * Gets the value of a collection property for a given page (collection item).
4
- *
5
- * @param propertyName property name
6
- * @param block Page block, often be first block in blockMap
7
- * @param recordMap
8
- * @returns - The return value types will follow the following principles:
9
- * 1. if property is date type, it will return `number` or `number[]`(depends on `End Date` switch)
10
- * 2. property is text-like will return `string`
11
- * 3. multi select property will return `string[]`
12
- * 4. checkbox property return `boolean`
13
- * @todo complete all no-text property type
14
- */
15
- export declare function getPageProperty<T = string | number | boolean | string[] | number[]>(propertyName: string, block: Block, recordMap: ExtendedRecordMap): T;
16
- //# sourceMappingURL=get-page-property.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-page-property.d.ts","sourceRoot":"","sources":["../../src/get-page-property.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAItE;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,EACjF,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,iBAAiB,GAC3B,CAAC,CAAA"}
@@ -1,13 +0,0 @@
1
- import * as types from '@texonom/ntypes';
2
- export interface TableOfContentsEntry {
3
- id: types.ID;
4
- type: types.BlockType;
5
- text: string;
6
- indentLevel: number;
7
- }
8
- /**
9
- * Gets the metadata for a table of contents block by parsing the page's
10
- * H1, H2, and H3 elements.
11
- */
12
- export declare const getPageTableOfContents: (page: types.PageBlock, recordMap: types.ExtendedRecordMap) => Array<TableOfContentsEntry>;
13
- //# sourceMappingURL=get-page-table-of-contents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-page-table-of-contents.d.ts","sourceRoot":"","sources":["../../src/get-page-table-of-contents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAA;AAIxC,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,KAAK,CAAC,EAAE,CAAA;IACZ,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAQD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,SAC3B,MAAM,SAAS,aACV,MAAM,iBAAiB,KACjC,MAAM,oBAAoB,CAyD5B,CAAA"}