@nast/notion2typst 0.2.0 → 0.2.2

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.
@@ -0,0 +1,2375 @@
1
+ //#region ../notion2nbt/dist/index.d.mts
2
+ //#region ../types/dist/common.d.ts
3
+ //#region src/common.d.ts
4
+ /**
5
+ * Shared utility types used across NAST packages
6
+ */
7
+ /**
8
+ * Information about a file (uploaded to Notion or external)
9
+ */
10
+ interface FileInfo$1 {
11
+ type: 'file' | 'external';
12
+ url: string;
13
+ expiry_time?: string;
14
+ }
15
+ /**
16
+ * Icon information (emoji, file, or external URL)
17
+ */
18
+ interface IconInfo$1 {
19
+ type: 'emoji' | 'external' | 'file';
20
+ emoji?: string;
21
+ url?: string;
22
+ }
23
+ /**
24
+ * Downloaded image data
25
+ */
26
+
27
+ /**
28
+ * Text annotations (formatting)
29
+ */
30
+
31
+ //#endregion
32
+ //#endregion
33
+ //#region ../types/dist/nbt.d.ts
34
+ //#region src/nbt.d.ts
35
+
36
+ /**
37
+ * Base NBT block interface
38
+ */
39
+ interface NBTBlock$1 {
40
+ id: string;
41
+ type: string;
42
+ properties: Record<string, unknown>;
43
+ children?: NBTBlock$1[];
44
+ metadata?: NBTNodeMetadata$2;
45
+ processed_at?: string;
46
+ }
47
+ /**
48
+ * Block metadata from Notion API
49
+ */
50
+ interface NBTNodeMetadata$2 {
51
+ created_time?: string;
52
+ last_edited_time?: string;
53
+ created_by?: string;
54
+ last_edited_by?: string;
55
+ archived?: boolean;
56
+ in_trash?: boolean;
57
+ }
58
+ /**
59
+ * Properties specific to page blocks
60
+ */
61
+ interface NBTPageProperties$1 {
62
+ title: string;
63
+ icon?: IconInfo$1;
64
+ cover?: FileInfo$1;
65
+ notionProperties?: Record<string, unknown>;
66
+ [key: string]: unknown;
67
+ }
68
+ /**
69
+ * NBT Page Node (block with type: "page")
70
+ */
71
+ interface NBTPageNode$1 extends NBTBlock$1 {
72
+ type: 'page';
73
+ properties: NBTPageProperties$1;
74
+ children?: NBTBlock$1[];
75
+ processed_at?: string;
76
+ }
77
+ /**
78
+ * NBT Document (alias for page node)
79
+ */
80
+
81
+ /**
82
+ * Paragraph block
83
+ */
84
+
85
+ /**
86
+ * Result of processing Notion blocks
87
+ */
88
+ interface NBTProcessResult {
89
+ nodes: NBTBlock$1[];
90
+ metadata: NBTProcessMetadata;
91
+ }
92
+ /**
93
+ * Metadata about the processing operation
94
+ */
95
+ interface NBTProcessMetadata {
96
+ processed_blocks: number;
97
+ total_blocks: number;
98
+ errors: NBTProcessError[];
99
+ warnings: string[];
100
+ processing_time_ms?: number;
101
+ }
102
+ /**
103
+ * Error during processing
104
+ */
105
+ interface NBTProcessError {
106
+ block_id?: string;
107
+ block_type?: string;
108
+ message: string;
109
+ error?: unknown;
110
+ }
111
+ /**
112
+ * Options for processing operations
113
+ */
114
+ interface NBTProcessOptions {
115
+ /** Maximum depth for recursive children processing (default: unlimited) */
116
+ maxDepth?: number;
117
+ /** Whether to include metadata (default: false) */
118
+ includeMetadata?: boolean;
119
+ /** Progress callback */
120
+ onProgress?: (current: number, total: number) => void;
121
+ /** Error callback */
122
+ onError?: (error: NBTProcessError) => void;
123
+ }
124
+ /**
125
+ * Options for fetching a page
126
+ */
127
+ interface NBTGetPageOptions extends NBTProcessOptions {
128
+ /** Whether to fetch missing blocks recursively (default: true) */
129
+ fetchMissingBlocks?: boolean;
130
+ /** Whether to fetch collections/databases (default: false) */
131
+ fetchCollections?: boolean;
132
+ /** Force refresh and bypass cache (default: false) */
133
+ forceRefresh?: boolean;
134
+ /** Whether to sign file URLs (default: false) */
135
+ signFileUrls?: boolean;
136
+ /** Whether to fetch relation pages (default: false) */
137
+ fetchRelationPages?: boolean;
138
+ }
139
+ /**
140
+ * @deprecated Use NBTBlock instead
141
+ */
142
+ //#endregion
143
+ //#region src/utils/nbt-utils.d.ts
144
+
145
+ //#endregion
146
+ //#region ../../node_modules/.pnpm/@notionhq+client@5.11.0/node_modules/@notionhq/client/build/src/api-endpoints.d.ts
147
+ type AnnotationResponse = {
148
+ bold: boolean;
149
+ italic: boolean;
150
+ strikethrough: boolean;
151
+ underline: boolean;
152
+ code: boolean;
153
+ color: ApiColor;
154
+ };
155
+ /**
156
+ * One of: `default`, `gray`, `brown`, `orange`, `yellow`, `green`, `blue`, `purple`,
157
+ * `pink`, `red`, `default_background`, `gray_background`, `brown_background`,
158
+ * `orange_background`, `yellow_background`, `green_background`, `blue_background`,
159
+ * `purple_background`, `pink_background`, `red_background`
160
+ */
161
+ type ApiColor = "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "default_background" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
162
+ type ApiTranscriptionStatus = "transcription_not_started" | "transcription_paused" | "transcription_in_progress" | "summary_in_progress" | "notes_ready";
163
+ type AudioBlockObjectResponse = {
164
+ type: "audio";
165
+ audio: MediaContentWithFileAndCaptionResponse;
166
+ parent: ParentForBlockBasedObjectResponse;
167
+ object: "block";
168
+ id: string;
169
+ created_time: string;
170
+ created_by: PartialUserObjectResponse;
171
+ last_edited_time: string;
172
+ last_edited_by: PartialUserObjectResponse;
173
+ has_children: boolean;
174
+ archived: boolean;
175
+ in_trash: boolean;
176
+ };
177
+ type BlockIdParentForBlockBasedObjectResponse = {
178
+ type: "block_id";
179
+ block_id: IdResponse;
180
+ };
181
+ type BlockObjectResponse = ParagraphBlockObjectResponse | Heading1BlockObjectResponse | Heading2BlockObjectResponse | Heading3BlockObjectResponse | BulletedListItemBlockObjectResponse | NumberedListItemBlockObjectResponse | QuoteBlockObjectResponse | ToDoBlockObjectResponse | ToggleBlockObjectResponse | TemplateBlockObjectResponse | SyncedBlockBlockObjectResponse | ChildPageBlockObjectResponse | ChildDatabaseBlockObjectResponse | EquationBlockObjectResponse | CodeBlockObjectResponse | CalloutBlockObjectResponse | DividerBlockObjectResponse | BreadcrumbBlockObjectResponse | TableOfContentsBlockObjectResponse | ColumnListBlockObjectResponse | ColumnBlockObjectResponse | LinkToPageBlockObjectResponse | TableBlockObjectResponse | TableRowBlockObjectResponse | TranscriptionBlockObjectResponse | EmbedBlockObjectResponse | BookmarkBlockObjectResponse | ImageBlockObjectResponse | VideoBlockObjectResponse | PdfBlockObjectResponse | FileBlockObjectResponse | AudioBlockObjectResponse | LinkPreviewBlockObjectResponse | UnsupportedBlockObjectResponse;
182
+ type BookmarkBlockObjectResponse = {
183
+ type: "bookmark";
184
+ bookmark: MediaContentWithUrlAndCaptionResponse;
185
+ parent: ParentForBlockBasedObjectResponse;
186
+ object: "block";
187
+ id: string;
188
+ created_time: string;
189
+ created_by: PartialUserObjectResponse;
190
+ last_edited_time: string;
191
+ last_edited_by: PartialUserObjectResponse;
192
+ has_children: boolean;
193
+ archived: boolean;
194
+ in_trash: boolean;
195
+ };
196
+ type BotInfoResponse = {
197
+ owner: {
198
+ type: "user";
199
+ user: {
200
+ id: IdResponse;
201
+ object: "user";
202
+ name: string | null;
203
+ avatar_url: string | null;
204
+ type: "person";
205
+ person: {
206
+ email?: string;
207
+ };
208
+ } | PartialUserObjectResponse;
209
+ } | {
210
+ type: "workspace";
211
+ workspace: true;
212
+ };
213
+ workspace_id: string;
214
+ workspace_limits: {
215
+ max_file_upload_size_in_bytes: number;
216
+ };
217
+ workspace_name: string | null;
218
+ };
219
+ type BotUserObjectResponse = {
220
+ type: "bot";
221
+ bot: EmptyObject | BotInfoResponse;
222
+ };
223
+ type BreadcrumbBlockObjectResponse = {
224
+ type: "breadcrumb";
225
+ breadcrumb: EmptyObject;
226
+ parent: ParentForBlockBasedObjectResponse;
227
+ object: "block";
228
+ id: string;
229
+ created_time: string;
230
+ created_by: PartialUserObjectResponse;
231
+ last_edited_time: string;
232
+ last_edited_by: PartialUserObjectResponse;
233
+ has_children: boolean;
234
+ archived: boolean;
235
+ in_trash: boolean;
236
+ };
237
+ type BulletedListItemBlockObjectResponse = {
238
+ type: "bulleted_list_item";
239
+ bulleted_list_item: ContentWithRichTextAndColorResponse;
240
+ parent: ParentForBlockBasedObjectResponse;
241
+ object: "block";
242
+ id: string;
243
+ created_time: string;
244
+ created_by: PartialUserObjectResponse;
245
+ last_edited_time: string;
246
+ last_edited_by: PartialUserObjectResponse;
247
+ has_children: boolean;
248
+ archived: boolean;
249
+ in_trash: boolean;
250
+ };
251
+ type CalloutBlockObjectResponse = {
252
+ type: "callout";
253
+ callout: {
254
+ rich_text: Array<RichTextItemResponse>;
255
+ color: ApiColor;
256
+ icon: PageIconResponse | null;
257
+ };
258
+ parent: ParentForBlockBasedObjectResponse;
259
+ object: "block";
260
+ id: string;
261
+ created_time: string;
262
+ created_by: PartialUserObjectResponse;
263
+ last_edited_time: string;
264
+ last_edited_by: PartialUserObjectResponse;
265
+ has_children: boolean;
266
+ archived: boolean;
267
+ in_trash: boolean;
268
+ };
269
+ type ChildDatabaseBlockObjectResponse = {
270
+ type: "child_database";
271
+ child_database: TitleObjectResponse;
272
+ parent: ParentForBlockBasedObjectResponse;
273
+ object: "block";
274
+ id: string;
275
+ created_time: string;
276
+ created_by: PartialUserObjectResponse;
277
+ last_edited_time: string;
278
+ last_edited_by: PartialUserObjectResponse;
279
+ has_children: boolean;
280
+ archived: boolean;
281
+ in_trash: boolean;
282
+ };
283
+ type ChildPageBlockObjectResponse = {
284
+ type: "child_page";
285
+ child_page: TitleObjectResponse;
286
+ parent: ParentForBlockBasedObjectResponse;
287
+ object: "block";
288
+ id: string;
289
+ created_time: string;
290
+ created_by: PartialUserObjectResponse;
291
+ last_edited_time: string;
292
+ last_edited_by: PartialUserObjectResponse;
293
+ has_children: boolean;
294
+ archived: boolean;
295
+ in_trash: boolean;
296
+ };
297
+ type CodeBlockObjectResponse = {
298
+ type: "code";
299
+ code: {
300
+ rich_text: Array<RichTextItemResponse>;
301
+ caption: Array<RichTextItemResponse>;
302
+ language: LanguageRequest;
303
+ };
304
+ parent: ParentForBlockBasedObjectResponse;
305
+ object: "block";
306
+ id: string;
307
+ created_time: string;
308
+ created_by: PartialUserObjectResponse;
309
+ last_edited_time: string;
310
+ last_edited_by: PartialUserObjectResponse;
311
+ has_children: boolean;
312
+ archived: boolean;
313
+ in_trash: boolean;
314
+ };
315
+ type ColumnBlockObjectResponse = {
316
+ type: "column";
317
+ column: ColumnResponse;
318
+ parent: ParentForBlockBasedObjectResponse;
319
+ object: "block";
320
+ id: string;
321
+ created_time: string;
322
+ created_by: PartialUserObjectResponse;
323
+ last_edited_time: string;
324
+ last_edited_by: PartialUserObjectResponse;
325
+ has_children: boolean;
326
+ archived: boolean;
327
+ in_trash: boolean;
328
+ };
329
+ type ColumnListBlockObjectResponse = {
330
+ type: "column_list";
331
+ column_list: EmptyObject;
332
+ parent: ParentForBlockBasedObjectResponse;
333
+ object: "block";
334
+ id: string;
335
+ created_time: string;
336
+ created_by: PartialUserObjectResponse;
337
+ last_edited_time: string;
338
+ last_edited_by: PartialUserObjectResponse;
339
+ has_children: boolean;
340
+ archived: boolean;
341
+ in_trash: boolean;
342
+ };
343
+ type ColumnResponse = {
344
+ width_ratio?: number;
345
+ };
346
+ type ContentWithRichTextAndColorAndListResponse = {
347
+ rich_text: Array<RichTextItemResponse>;
348
+ color: ApiColor;
349
+ list_start_index?: number;
350
+ list_format?: NumberedListFormat;
351
+ };
352
+ type ContentWithRichTextAndColorResponse = {
353
+ rich_text: Array<RichTextItemResponse>;
354
+ color: ApiColor;
355
+ };
356
+ type ContentWithTableResponse = {
357
+ has_column_header: boolean;
358
+ has_row_header: boolean;
359
+ table_width: number;
360
+ };
361
+ type ContentWithTableRowResponse = {
362
+ cells: Array<Array<RichTextItemResponse>>;
363
+ };
364
+ type CustomEmojiPageIconResponse = {
365
+ type: "custom_emoji";
366
+ custom_emoji: CustomEmojiResponse;
367
+ };
368
+ type CustomEmojiResponse = {
369
+ id: IdResponse;
370
+ name: string;
371
+ url: string;
372
+ };
373
+ type DataSourceParentResponse = {
374
+ type: "data_source_id";
375
+ data_source_id: IdResponse;
376
+ database_id: IdResponse;
377
+ };
378
+ type DatabaseParentResponse = {
379
+ type: "database_id";
380
+ database_id: IdResponse;
381
+ };
382
+ type DateResponse = {
383
+ start: string;
384
+ end: string | null;
385
+ time_zone: TimeZoneRequest | null;
386
+ };
387
+ type DividerBlockObjectResponse = {
388
+ type: "divider";
389
+ divider: EmptyObject;
390
+ parent: ParentForBlockBasedObjectResponse;
391
+ object: "block";
392
+ id: string;
393
+ created_time: string;
394
+ created_by: PartialUserObjectResponse;
395
+ last_edited_time: string;
396
+ last_edited_by: PartialUserObjectResponse;
397
+ has_children: boolean;
398
+ archived: boolean;
399
+ in_trash: boolean;
400
+ };
401
+ type EmbedBlockObjectResponse = {
402
+ type: "embed";
403
+ embed: MediaContentWithUrlAndCaptionResponse;
404
+ parent: ParentForBlockBasedObjectResponse;
405
+ object: "block";
406
+ id: string;
407
+ created_time: string;
408
+ created_by: PartialUserObjectResponse;
409
+ last_edited_time: string;
410
+ last_edited_by: PartialUserObjectResponse;
411
+ has_children: boolean;
412
+ archived: boolean;
413
+ in_trash: boolean;
414
+ };
415
+ type EmojiPageIconResponse = {
416
+ type: "emoji";
417
+ emoji: EmojiRequest;
418
+ };
419
+ type EmojiRequest = string;
420
+ type EmptyObject = Record<string, never>;
421
+ type EquationBlockObjectResponse = {
422
+ type: "equation";
423
+ equation: ExpressionObjectResponse;
424
+ parent: ParentForBlockBasedObjectResponse;
425
+ object: "block";
426
+ id: string;
427
+ created_time: string;
428
+ created_by: PartialUserObjectResponse;
429
+ last_edited_time: string;
430
+ last_edited_by: PartialUserObjectResponse;
431
+ has_children: boolean;
432
+ archived: boolean;
433
+ in_trash: boolean;
434
+ };
435
+ type EquationRichTextItemResponse = {
436
+ type: "equation";
437
+ equation: {
438
+ expression: string;
439
+ };
440
+ };
441
+ type ExpressionObjectResponse = {
442
+ expression: string;
443
+ };
444
+ type ExternalMediaContentWithFileAndCaptionResponse = {
445
+ type: "external";
446
+ external: {
447
+ url: TextRequest;
448
+ };
449
+ caption: Array<RichTextItemResponse>;
450
+ };
451
+ type ExternalMediaContentWithFileNameAndCaptionResponse = {
452
+ type: "external";
453
+ external: {
454
+ url: TextRequest;
455
+ };
456
+ caption: Array<RichTextItemResponse>;
457
+ name: string;
458
+ };
459
+ type ExternalPageIconResponse = {
460
+ type: "external";
461
+ external: {
462
+ url: string;
463
+ };
464
+ };
465
+ type FileBlockObjectResponse = {
466
+ type: "file";
467
+ file: MediaContentWithFileNameAndCaptionResponse;
468
+ parent: ParentForBlockBasedObjectResponse;
469
+ object: "block";
470
+ id: string;
471
+ created_time: string;
472
+ created_by: PartialUserObjectResponse;
473
+ last_edited_time: string;
474
+ last_edited_by: PartialUserObjectResponse;
475
+ has_children: boolean;
476
+ archived: boolean;
477
+ in_trash: boolean;
478
+ };
479
+ type FileMediaContentWithFileAndCaptionResponse = {
480
+ type: "file";
481
+ file: InternalFileResponse;
482
+ caption: Array<RichTextItemResponse>;
483
+ };
484
+ type FileMediaContentWithFileNameAndCaptionResponse = {
485
+ type: "file";
486
+ file: InternalFileResponse;
487
+ caption: Array<RichTextItemResponse>;
488
+ name: string;
489
+ };
490
+ type FilePageIconResponse = {
491
+ type: "file";
492
+ file: InternalFileResponse;
493
+ };
494
+ type HeaderContentWithRichTextAndColorResponse = {
495
+ rich_text: Array<RichTextItemResponse>;
496
+ color: ApiColor;
497
+ is_toggleable: boolean;
498
+ };
499
+ type Heading1BlockObjectResponse = {
500
+ type: "heading_1";
501
+ heading_1: HeaderContentWithRichTextAndColorResponse;
502
+ parent: ParentForBlockBasedObjectResponse;
503
+ object: "block";
504
+ id: string;
505
+ created_time: string;
506
+ created_by: PartialUserObjectResponse;
507
+ last_edited_time: string;
508
+ last_edited_by: PartialUserObjectResponse;
509
+ has_children: boolean;
510
+ archived: boolean;
511
+ in_trash: boolean;
512
+ };
513
+ type Heading2BlockObjectResponse = {
514
+ type: "heading_2";
515
+ heading_2: HeaderContentWithRichTextAndColorResponse;
516
+ parent: ParentForBlockBasedObjectResponse;
517
+ object: "block";
518
+ id: string;
519
+ created_time: string;
520
+ created_by: PartialUserObjectResponse;
521
+ last_edited_time: string;
522
+ last_edited_by: PartialUserObjectResponse;
523
+ has_children: boolean;
524
+ archived: boolean;
525
+ in_trash: boolean;
526
+ };
527
+ type Heading3BlockObjectResponse = {
528
+ type: "heading_3";
529
+ heading_3: HeaderContentWithRichTextAndColorResponse;
530
+ parent: ParentForBlockBasedObjectResponse;
531
+ object: "block";
532
+ id: string;
533
+ created_time: string;
534
+ created_by: PartialUserObjectResponse;
535
+ last_edited_time: string;
536
+ last_edited_by: PartialUserObjectResponse;
537
+ has_children: boolean;
538
+ archived: boolean;
539
+ in_trash: boolean;
540
+ };
541
+ type IdRequest = string;
542
+ type IdResponse = string;
543
+ type ImageBlockObjectResponse = {
544
+ type: "image";
545
+ image: MediaContentWithFileAndCaptionResponse;
546
+ parent: ParentForBlockBasedObjectResponse;
547
+ object: "block";
548
+ id: string;
549
+ created_time: string;
550
+ created_by: PartialUserObjectResponse;
551
+ last_edited_time: string;
552
+ last_edited_by: PartialUserObjectResponse;
553
+ has_children: boolean;
554
+ archived: boolean;
555
+ in_trash: boolean;
556
+ };
557
+ type InternalFileResponse = {
558
+ url: string;
559
+ expiry_time: string;
560
+ };
561
+ type LanguageRequest = "abap" | "abc" | "agda" | "arduino" | "ascii art" | "assembly" | "bash" | "basic" | "bnf" | "c" | "c#" | "c++" | "clojure" | "coffeescript" | "coq" | "css" | "dart" | "dhall" | "diff" | "docker" | "ebnf" | "elixir" | "elm" | "erlang" | "f#" | "flow" | "fortran" | "gherkin" | "glsl" | "go" | "graphql" | "groovy" | "haskell" | "hcl" | "html" | "idris" | "java" | "javascript" | "json" | "julia" | "kotlin" | "latex" | "less" | "lisp" | "livescript" | "llvm ir" | "lua" | "makefile" | "markdown" | "markup" | "matlab" | "mathematica" | "mermaid" | "nix" | "notion formula" | "objective-c" | "ocaml" | "pascal" | "perl" | "php" | "plain text" | "powershell" | "prolog" | "protobuf" | "purescript" | "python" | "r" | "racket" | "reason" | "ruby" | "rust" | "sass" | "scala" | "scheme" | "scss" | "shell" | "smalltalk" | "solidity" | "sql" | "swift" | "toml" | "typescript" | "vb.net" | "verilog" | "vhdl" | "visual basic" | "webassembly" | "xml" | "yaml" | "java/c/c++/c#";
562
+ type LinkMentionResponse = {
563
+ href: string;
564
+ title?: string;
565
+ description?: string;
566
+ link_author?: string;
567
+ link_provider?: string;
568
+ thumbnail_url?: string;
569
+ icon_url?: string;
570
+ iframe_url?: string;
571
+ height?: number;
572
+ padding?: number;
573
+ padding_top?: number;
574
+ };
575
+ type LinkPreviewBlockObjectResponse = {
576
+ type: "link_preview";
577
+ link_preview: MediaContentWithUrlResponse;
578
+ parent: ParentForBlockBasedObjectResponse;
579
+ object: "block";
580
+ id: string;
581
+ created_time: string;
582
+ created_by: PartialUserObjectResponse;
583
+ last_edited_time: string;
584
+ last_edited_by: PartialUserObjectResponse;
585
+ has_children: boolean;
586
+ archived: boolean;
587
+ in_trash: boolean;
588
+ };
589
+ type LinkPreviewMentionResponse = {
590
+ url: string;
591
+ };
592
+ type LinkToPageBlockObjectResponse = {
593
+ type: "link_to_page";
594
+ link_to_page: {
595
+ type: "page_id";
596
+ page_id: IdRequest;
597
+ } | {
598
+ type: "database_id";
599
+ database_id: IdRequest;
600
+ } | {
601
+ type: "comment_id";
602
+ comment_id: IdRequest;
603
+ };
604
+ parent: ParentForBlockBasedObjectResponse;
605
+ object: "block";
606
+ id: string;
607
+ created_time: string;
608
+ created_by: PartialUserObjectResponse;
609
+ last_edited_time: string;
610
+ last_edited_by: PartialUserObjectResponse;
611
+ has_children: boolean;
612
+ archived: boolean;
613
+ in_trash: boolean;
614
+ };
615
+ type MediaContentWithFileAndCaptionResponse = ExternalMediaContentWithFileAndCaptionResponse | FileMediaContentWithFileAndCaptionResponse;
616
+ type MediaContentWithFileNameAndCaptionResponse = ExternalMediaContentWithFileNameAndCaptionResponse | FileMediaContentWithFileNameAndCaptionResponse;
617
+ type MediaContentWithUrlAndCaptionResponse = {
618
+ url: string;
619
+ caption: Array<RichTextItemResponse>;
620
+ };
621
+ type MediaContentWithUrlResponse = {
622
+ url: TextRequest;
623
+ };
624
+ type MentionRichTextItemResponse = {
625
+ type: "mention";
626
+ mention: {
627
+ type: "user";
628
+ user: UserValueResponse;
629
+ } | {
630
+ type: "date";
631
+ date: DateResponse;
632
+ } | {
633
+ type: "link_preview";
634
+ link_preview: LinkPreviewMentionResponse;
635
+ } | {
636
+ type: "link_mention";
637
+ link_mention: LinkMentionResponse;
638
+ } | {
639
+ type: "page";
640
+ page: {
641
+ id: IdResponse;
642
+ };
643
+ } | {
644
+ type: "database";
645
+ database: {
646
+ id: IdResponse;
647
+ };
648
+ } | {
649
+ type: "template_mention";
650
+ template_mention: TemplateMentionResponse;
651
+ } | {
652
+ type: "custom_emoji";
653
+ custom_emoji: CustomEmojiResponse;
654
+ };
655
+ };
656
+ type NumberedListFormat = "numbers" | "letters" | "roman";
657
+ type NumberedListItemBlockObjectResponse = {
658
+ type: "numbered_list_item";
659
+ numbered_list_item: ContentWithRichTextAndColorAndListResponse;
660
+ parent: ParentForBlockBasedObjectResponse;
661
+ object: "block";
662
+ id: string;
663
+ created_time: string;
664
+ created_by: PartialUserObjectResponse;
665
+ last_edited_time: string;
666
+ last_edited_by: PartialUserObjectResponse;
667
+ has_children: boolean;
668
+ archived: boolean;
669
+ in_trash: boolean;
670
+ };
671
+ type PageIconResponse = EmojiPageIconResponse | FilePageIconResponse | ExternalPageIconResponse | CustomEmojiPageIconResponse;
672
+ type PageIdParentForBlockBasedObjectResponse = {
673
+ type: "page_id";
674
+ page_id: IdResponse;
675
+ };
676
+ type ParagraphBlockObjectResponse = {
677
+ type: "paragraph";
678
+ paragraph: ContentWithRichTextAndColorResponse;
679
+ parent: ParentForBlockBasedObjectResponse;
680
+ object: "block";
681
+ id: string;
682
+ created_time: string;
683
+ created_by: PartialUserObjectResponse;
684
+ last_edited_time: string;
685
+ last_edited_by: PartialUserObjectResponse;
686
+ has_children: boolean;
687
+ archived: boolean;
688
+ in_trash: boolean;
689
+ };
690
+ type ParentForBlockBasedObjectResponse = DatabaseParentResponse | DataSourceParentResponse | PageIdParentForBlockBasedObjectResponse | BlockIdParentForBlockBasedObjectResponse | WorkspaceParentForBlockBasedObjectResponse;
691
+ /**
692
+ * The parent of the data source. This is typically a database (`database_id`), but for
693
+ * externally synced data sources, can be another data source (`data_source_id`).
694
+ */
695
+
696
+ type PartialUserObjectResponse = {
697
+ id: IdResponse;
698
+ object: "user";
699
+ };
700
+ type PdfBlockObjectResponse = {
701
+ type: "pdf";
702
+ pdf: MediaContentWithFileAndCaptionResponse;
703
+ parent: ParentForBlockBasedObjectResponse;
704
+ object: "block";
705
+ id: string;
706
+ created_time: string;
707
+ created_by: PartialUserObjectResponse;
708
+ last_edited_time: string;
709
+ last_edited_by: PartialUserObjectResponse;
710
+ has_children: boolean;
711
+ archived: boolean;
712
+ in_trash: boolean;
713
+ };
714
+ type PersonUserObjectResponse = {
715
+ type: "person";
716
+ person: {
717
+ email?: string;
718
+ };
719
+ };
720
+ type QuoteBlockObjectResponse = {
721
+ type: "quote";
722
+ quote: ContentWithRichTextAndColorResponse;
723
+ parent: ParentForBlockBasedObjectResponse;
724
+ object: "block";
725
+ id: string;
726
+ created_time: string;
727
+ created_by: PartialUserObjectResponse;
728
+ last_edited_time: string;
729
+ last_edited_by: PartialUserObjectResponse;
730
+ has_children: boolean;
731
+ archived: boolean;
732
+ in_trash: boolean;
733
+ };
734
+ type RichTextItemResponse = RichTextItemResponseCommon & (TextRichTextItemResponse | MentionRichTextItemResponse | EquationRichTextItemResponse);
735
+ type RichTextItemResponseCommon = {
736
+ plain_text: string;
737
+ href: string | null;
738
+ annotations: AnnotationResponse;
739
+ };
740
+ type SyncedBlockBlockObjectResponse = {
741
+ type: "synced_block";
742
+ synced_block: {
743
+ synced_from: {
744
+ type: "block_id";
745
+ block_id: IdRequest;
746
+ } | null;
747
+ };
748
+ parent: ParentForBlockBasedObjectResponse;
749
+ object: "block";
750
+ id: string;
751
+ created_time: string;
752
+ created_by: PartialUserObjectResponse;
753
+ last_edited_time: string;
754
+ last_edited_by: PartialUserObjectResponse;
755
+ has_children: boolean;
756
+ archived: boolean;
757
+ in_trash: boolean;
758
+ };
759
+ type TableBlockObjectResponse = {
760
+ type: "table";
761
+ table: ContentWithTableResponse;
762
+ parent: ParentForBlockBasedObjectResponse;
763
+ object: "block";
764
+ id: string;
765
+ created_time: string;
766
+ created_by: PartialUserObjectResponse;
767
+ last_edited_time: string;
768
+ last_edited_by: PartialUserObjectResponse;
769
+ has_children: boolean;
770
+ archived: boolean;
771
+ in_trash: boolean;
772
+ };
773
+ type TableOfContentsBlockObjectResponse = {
774
+ type: "table_of_contents";
775
+ table_of_contents: {
776
+ color: ApiColor;
777
+ };
778
+ parent: ParentForBlockBasedObjectResponse;
779
+ object: "block";
780
+ id: string;
781
+ created_time: string;
782
+ created_by: PartialUserObjectResponse;
783
+ last_edited_time: string;
784
+ last_edited_by: PartialUserObjectResponse;
785
+ has_children: boolean;
786
+ archived: boolean;
787
+ in_trash: boolean;
788
+ };
789
+ type TableRowBlockObjectResponse = {
790
+ type: "table_row";
791
+ table_row: ContentWithTableRowResponse;
792
+ parent: ParentForBlockBasedObjectResponse;
793
+ object: "block";
794
+ id: string;
795
+ created_time: string;
796
+ created_by: PartialUserObjectResponse;
797
+ last_edited_time: string;
798
+ last_edited_by: PartialUserObjectResponse;
799
+ has_children: boolean;
800
+ archived: boolean;
801
+ in_trash: boolean;
802
+ };
803
+ type TemplateBlockObjectResponse = {
804
+ type: "template";
805
+ template: {
806
+ rich_text: Array<RichTextItemResponse>;
807
+ };
808
+ parent: ParentForBlockBasedObjectResponse;
809
+ object: "block";
810
+ id: string;
811
+ created_time: string;
812
+ created_by: PartialUserObjectResponse;
813
+ last_edited_time: string;
814
+ last_edited_by: PartialUserObjectResponse;
815
+ has_children: boolean;
816
+ archived: boolean;
817
+ in_trash: boolean;
818
+ };
819
+ type TemplateMentionDateTemplateMentionResponse = {
820
+ type: "template_mention_date";
821
+ template_mention_date: "today" | "now";
822
+ };
823
+ type TemplateMentionResponse = TemplateMentionDateTemplateMentionResponse | TemplateMentionUserTemplateMentionResponse;
824
+ type TemplateMentionUserTemplateMentionResponse = {
825
+ type: "template_mention_user";
826
+ template_mention_user: "me";
827
+ };
828
+ type TextRequest = string;
829
+ type TextRichTextItemResponse = {
830
+ type: "text";
831
+ text: {
832
+ content: string;
833
+ link: {
834
+ url: string;
835
+ } | null;
836
+ };
837
+ };
838
+ type TimeZoneRequest = string;
839
+ type TitleObjectResponse = {
840
+ title: string;
841
+ };
842
+ type ToDoBlockObjectResponse = {
843
+ type: "to_do";
844
+ to_do: {
845
+ rich_text: Array<RichTextItemResponse>;
846
+ color: ApiColor;
847
+ checked: boolean;
848
+ };
849
+ parent: ParentForBlockBasedObjectResponse;
850
+ object: "block";
851
+ id: string;
852
+ created_time: string;
853
+ created_by: PartialUserObjectResponse;
854
+ last_edited_time: string;
855
+ last_edited_by: PartialUserObjectResponse;
856
+ has_children: boolean;
857
+ archived: boolean;
858
+ in_trash: boolean;
859
+ };
860
+ type ToggleBlockObjectResponse = {
861
+ type: "toggle";
862
+ toggle: ContentWithRichTextAndColorResponse;
863
+ parent: ParentForBlockBasedObjectResponse;
864
+ object: "block";
865
+ id: string;
866
+ created_time: string;
867
+ created_by: PartialUserObjectResponse;
868
+ last_edited_time: string;
869
+ last_edited_by: PartialUserObjectResponse;
870
+ has_children: boolean;
871
+ archived: boolean;
872
+ in_trash: boolean;
873
+ };
874
+ type TranscriptionBlockObjectResponse = {
875
+ type: "transcription";
876
+ transcription: TranscriptionBlockResponse;
877
+ parent: ParentForBlockBasedObjectResponse;
878
+ object: "block";
879
+ id: string;
880
+ created_time: string;
881
+ created_by: PartialUserObjectResponse;
882
+ last_edited_time: string;
883
+ last_edited_by: PartialUserObjectResponse;
884
+ has_children: boolean;
885
+ archived: boolean;
886
+ in_trash: boolean;
887
+ };
888
+ type TranscriptionBlockResponse = {
889
+ title?: Array<RichTextItemResponse>;
890
+ status?: ApiTranscriptionStatus;
891
+ children?: TranscriptionChildrenResponse;
892
+ calendar_event?: TranscriptionCalendarEventResponse;
893
+ recording?: TranscriptionRecordingResponse;
894
+ };
895
+ type TranscriptionCalendarEventResponse = {
896
+ start_time: string;
897
+ end_time: string;
898
+ attendees?: Array<IdRequest>;
899
+ };
900
+ type TranscriptionChildrenResponse = {
901
+ summary_block_id?: IdRequest;
902
+ notes_block_id?: IdRequest;
903
+ transcript_block_id?: IdRequest;
904
+ };
905
+ type TranscriptionRecordingResponse = {
906
+ start_time?: string;
907
+ end_time?: string;
908
+ };
909
+ type UnsupportedBlockObjectResponse = {
910
+ type: "unsupported";
911
+ unsupported: EmptyObject;
912
+ parent: ParentForBlockBasedObjectResponse;
913
+ object: "block";
914
+ id: string;
915
+ created_time: string;
916
+ created_by: PartialUserObjectResponse;
917
+ last_edited_time: string;
918
+ last_edited_by: PartialUserObjectResponse;
919
+ has_children: boolean;
920
+ archived: boolean;
921
+ in_trash: boolean;
922
+ };
923
+ type UserObjectResponse = UserObjectResponseCommon & (PersonUserObjectResponse | BotUserObjectResponse);
924
+ type UserObjectResponseCommon = {
925
+ id: IdResponse;
926
+ object: "user";
927
+ name: string | null;
928
+ avatar_url: string | null;
929
+ };
930
+ type UserValueResponse = PartialUserObjectResponse | UserObjectResponse;
931
+ type VideoBlockObjectResponse = {
932
+ type: "video";
933
+ video: MediaContentWithFileAndCaptionResponse;
934
+ parent: ParentForBlockBasedObjectResponse;
935
+ object: "block";
936
+ id: string;
937
+ created_time: string;
938
+ created_by: PartialUserObjectResponse;
939
+ last_edited_time: string;
940
+ last_edited_by: PartialUserObjectResponse;
941
+ has_children: boolean;
942
+ archived: boolean;
943
+ in_trash: boolean;
944
+ };
945
+ type WorkspaceParentForBlockBasedObjectResponse = {
946
+ type: "workspace";
947
+ workspace: true;
948
+ };
949
+ //#endregion
950
+ //#region src/client/utils/logger.d.ts
951
+ /**
952
+ * Logging utility for Notion2NBT client
953
+ */
954
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error';
955
+ //#endregion
956
+ //#region src/client/index.d.ts
957
+ interface Notion2NBTOptions {
958
+ auth: string;
959
+ notionVersion?: string;
960
+ baseUrl?: string;
961
+ logLevel?: LogLevel;
962
+ enableCache?: boolean;
963
+ }
964
+ /**
965
+ * Main API client for notion2nbt
966
+ */
967
+ declare class Notion2NBT {
968
+ private client;
969
+ private logger;
970
+ private cache;
971
+ constructor(options: Notion2NBTOptions);
972
+ /**
973
+ * Get a complete Notion page as a NotionBlock (PageNode)
974
+ *
975
+ * @returns PageNode with type: 'page' and children array
976
+ */
977
+ getPageV2(pageId: string, options?: NBTGetPageOptions): Promise<NBTPageNode$1>;
978
+ /**
979
+ * Get blocks from a page as a flat NBT array
980
+ * @deprecated
981
+ * Use this if you need a flat structure
982
+ */
983
+ getPageBlocks(pageId: string, options?: NBTProcessOptions): Promise<NBTProcessResult>;
984
+ /**
985
+ * Get all blocks from a page with pagination
986
+ */
987
+ getAllBlocks(pageId: string): Promise<BlockObjectResponse[]>;
988
+ /**
989
+ * Prefetch page information (for page mentions)
990
+ */
991
+ prefetchPageInfo(pageId: string): Promise<void>;
992
+ /**
993
+ * Get a single block by ID
994
+ */
995
+ getBlock(blockId: string): Promise<NBTBlock$1 | null>;
996
+ /**
997
+ * Get multiple blocks by IDs
998
+ */
999
+ getBlocks(blockIds: string[]): Promise<Record<string, NBTBlock$1>>;
1000
+ /**
1001
+ * Get database entries
1002
+ */
1003
+ getDatabase(databaseId: string): Promise<any[]>;
1004
+ /**
1005
+ * Search for pages
1006
+ */
1007
+ search(query: string, options?: {
1008
+ filter?: {
1009
+ property: string;
1010
+ value: string;
1011
+ };
1012
+ sort?: {
1013
+ direction: 'ascending' | 'descending';
1014
+ timestamp: 'last_edited_time';
1015
+ };
1016
+ }): Promise<any[]>;
1017
+ /**
1018
+ * Get raw children blocks from Notion API (for comparison purposes)
1019
+ *
1020
+ * @param blockId - The ID of the block/page to get children for
1021
+ * @returns Array of raw BlockObjectResponse from Notion API
1022
+ */
1023
+ APIgetChildrenBlocks(blockId: string): Promise<BlockObjectResponse[]>;
1024
+ /**
1025
+ * Clear the cache
1026
+ */
1027
+ clearCache(): void;
1028
+ /**
1029
+ * Get cache size
1030
+ */
1031
+ getCacheSize(): number;
1032
+ /**
1033
+ * Check if caching is enabled
1034
+ */
1035
+ isCacheEnabled(): boolean;
1036
+ }
1037
+ //#endregion
1038
+ //#endregion
1039
+ //#region ../nbt2nast/dist/index.d.ts
1040
+ //#region ../types/dist/common.d.ts
1041
+ //#region src/common.d.ts
1042
+ /**
1043
+ * Shared utility types used across NAST packages
1044
+ */
1045
+ /**
1046
+ * Information about a file (uploaded to Notion or external)
1047
+ */
1048
+ interface FileInfo {
1049
+ type: 'file' | 'external';
1050
+ url: string;
1051
+ expiry_time?: string;
1052
+ }
1053
+ /**
1054
+ * Icon information (emoji, file, or external URL)
1055
+ */
1056
+ interface IconInfo {
1057
+ type: 'emoji' | 'external' | 'file';
1058
+ emoji?: string;
1059
+ url?: string;
1060
+ }
1061
+ /**
1062
+ * Downloaded image data
1063
+ */
1064
+
1065
+ /**
1066
+ * Text annotations (formatting)
1067
+ */
1068
+
1069
+ //#endregion
1070
+ //#endregion
1071
+ //#region ../types/dist/nast.d.ts
1072
+ //#region src/nast.d.ts
1073
+ /**
1074
+ * NAST (Notion Abstract Syntax Tree) Types
1075
+ *
1076
+ * NAST is a unified-like AST format for representing Notion content.
1077
+ * It's designed to be easily converted to various output formats (Markdown, Typst, etc.)
1078
+ */
1079
+ /**
1080
+ * Root node of a NAST document
1081
+ */
1082
+ interface NASTRoot$2 {
1083
+ type: 'root';
1084
+ children: NASTNode$2[];
1085
+ data: {
1086
+ pageId: string;
1087
+ title: string;
1088
+ icon?: {
1089
+ type: 'emoji' | 'file' | 'external';
1090
+ value: string;
1091
+ };
1092
+ processedAt: string;
1093
+ };
1094
+ }
1095
+ /**
1096
+ * Union of all NAST node types
1097
+ */
1098
+ type NASTNode$2 = NASTParagraph$2 | NASTHeading$2 | NASTText$2 | NASTStrong$2 | NASTEmphasis$2 | NASTUnderline$2 | NASTDelete$2 | NASTInlineCode$2 | NASTLink$2 | NASTMention$2 | NASTMath$2 | NASTInlineMath$2 | NASTCode$2 | NASTBlockquote$2 | NASTCallout$2 | NASTToggle$2 | NASTList$2 | NASTListItem$2 | NASTColumnList$2 | NASTColumn$2 | NASTImage$2 | NASTThematicBreak$2 | NASTTable$2 | NASTTableRow$2 | NASTTableCell$2 | NASTChildPage$2 | NASTVideo$2 | NASTFile$2 | NASTPDF$2 | NASTBookmark$2 | NASTEmbed$2;
1099
+ /**
1100
+ * Paragraph block
1101
+ */
1102
+ interface NASTParagraph$2 {
1103
+ type: 'paragraph';
1104
+ children: NASTNode$2[];
1105
+ data?: {
1106
+ blockId?: string;
1107
+ };
1108
+ }
1109
+ /**
1110
+ * Heading block (h1, h2, h3)
1111
+ */
1112
+ interface NASTHeading$2 {
1113
+ type: 'heading';
1114
+ depth: 1 | 2 | 3;
1115
+ children: NASTNode$2[];
1116
+ /** Indicates if this heading is also a toggle (collapsible) */
1117
+ isToggleable?: boolean;
1118
+ data?: {
1119
+ blockId?: string;
1120
+ };
1121
+ }
1122
+ /**
1123
+ * Code block with syntax highlighting
1124
+ */
1125
+ interface NASTCode$2 {
1126
+ type: 'code';
1127
+ lang: string;
1128
+ value: string;
1129
+ data?: {
1130
+ caption?: NASTNode$2[];
1131
+ blockId?: string;
1132
+ };
1133
+ }
1134
+ /**
1135
+ * Block math equation
1136
+ */
1137
+ interface NASTMath$2 {
1138
+ type: 'math';
1139
+ value: string;
1140
+ data?: {
1141
+ blockId?: string;
1142
+ };
1143
+ }
1144
+ /**
1145
+ * Blockquote
1146
+ */
1147
+ interface NASTBlockquote$2 {
1148
+ type: 'blockquote';
1149
+ children: NASTNode$2[];
1150
+ data?: {
1151
+ blockId?: string;
1152
+ };
1153
+ }
1154
+ /**
1155
+ * Callout block (with icon and color)
1156
+ */
1157
+ interface NASTCallout$2 {
1158
+ type: 'callout';
1159
+ data: {
1160
+ icon: {
1161
+ type: 'emoji';
1162
+ value: string;
1163
+ } | null;
1164
+ color: string;
1165
+ blockId?: string;
1166
+ };
1167
+ children: NASTNode$2[];
1168
+ }
1169
+ /**
1170
+ * Toggle block (collapsible content)
1171
+ */
1172
+ interface NASTToggle$2 {
1173
+ type: 'toggle';
1174
+ children: NASTNode$2[];
1175
+ data?: {
1176
+ blockId?: string;
1177
+ };
1178
+ }
1179
+ /**
1180
+ * Thematic break / divider
1181
+ */
1182
+ interface NASTThematicBreak$2 {
1183
+ type: 'thematicBreak';
1184
+ data?: {
1185
+ blockId?: string;
1186
+ };
1187
+ }
1188
+ /**
1189
+ * List (ordered or unordered)
1190
+ */
1191
+ interface NASTList$2 {
1192
+ type: 'list';
1193
+ ordered: boolean;
1194
+ children: NASTListItem$2[];
1195
+ }
1196
+ /**
1197
+ * List item (can be a checklist item if checked is defined)
1198
+ */
1199
+ interface NASTListItem$2 {
1200
+ type: 'listItem';
1201
+ /** undefined = not a checklist, true/false = checked state */
1202
+ checked?: boolean;
1203
+ children: NASTNode$2[];
1204
+ data?: {
1205
+ blockId?: string;
1206
+ };
1207
+ }
1208
+ /**
1209
+ * Column list (container for columns)
1210
+ */
1211
+ interface NASTColumnList$2 {
1212
+ type: 'columnList';
1213
+ children: NASTColumn$2[];
1214
+ data?: {
1215
+ blockId?: string;
1216
+ };
1217
+ }
1218
+ /**
1219
+ * Column within a column list
1220
+ */
1221
+ interface NASTColumn$2 {
1222
+ type: 'column';
1223
+ /** Width ratio (0.5 = 50%, matches NBT format) */
1224
+ widthRatio: number;
1225
+ children: NASTNode$2[];
1226
+ data?: {
1227
+ blockId?: string;
1228
+ };
1229
+ }
1230
+ /**
1231
+ * Table
1232
+ */
1233
+ interface NASTTable$2 {
1234
+ type: 'table';
1235
+ hasColumnHeader: boolean;
1236
+ hasRowHeader: boolean;
1237
+ children: NASTTableRow$2[];
1238
+ data?: {
1239
+ blockId?: string;
1240
+ };
1241
+ }
1242
+ /**
1243
+ * Table row
1244
+ */
1245
+ interface NASTTableRow$2 {
1246
+ type: 'tableRow';
1247
+ children: NASTTableCell$2[];
1248
+ }
1249
+ /**
1250
+ * Table cell
1251
+ */
1252
+ interface NASTTableCell$2 {
1253
+ type: 'tableCell';
1254
+ children: NASTNode$2[];
1255
+ }
1256
+ /**
1257
+ * Plain text
1258
+ */
1259
+ interface NASTText$2 {
1260
+ type: 'text';
1261
+ value: string;
1262
+ data?: {
1263
+ color?: string;
1264
+ backgroundColor?: string;
1265
+ };
1266
+ }
1267
+ /**
1268
+ * Bold text
1269
+ */
1270
+ interface NASTStrong$2 {
1271
+ type: 'strong';
1272
+ children: NASTNode$2[];
1273
+ }
1274
+ /**
1275
+ * Italic text
1276
+ */
1277
+ interface NASTEmphasis$2 {
1278
+ type: 'emphasis';
1279
+ children: NASTNode$2[];
1280
+ }
1281
+ /**
1282
+ * Underlined text
1283
+ */
1284
+ interface NASTUnderline$2 {
1285
+ type: 'underline';
1286
+ children: NASTNode$2[];
1287
+ }
1288
+ /**
1289
+ * Strikethrough text
1290
+ */
1291
+ interface NASTDelete$2 {
1292
+ type: 'delete';
1293
+ children: NASTNode$2[];
1294
+ }
1295
+ /**
1296
+ * Inline code
1297
+ */
1298
+ interface NASTInlineCode$2 {
1299
+ type: 'inlineCode';
1300
+ value: string;
1301
+ }
1302
+ /**
1303
+ * Inline math equation
1304
+ */
1305
+ interface NASTInlineMath$2 {
1306
+ type: 'inlineMath';
1307
+ value: string;
1308
+ }
1309
+ /**
1310
+ * Link
1311
+ */
1312
+ interface NASTLink$2 {
1313
+ type: 'link';
1314
+ url: string;
1315
+ children: NASTNode$2[];
1316
+ data?: {
1317
+ title?: string;
1318
+ iconUrl?: string;
1319
+ description?: string;
1320
+ provider?: string;
1321
+ thumbnailUrl?: string;
1322
+ };
1323
+ }
1324
+ /**
1325
+ * Mention (@user, date, page, database)
1326
+ */
1327
+ interface NASTMention$2 {
1328
+ type: 'mention';
1329
+ mentionType: 'user' | 'date' | 'page' | 'database';
1330
+ value: string;
1331
+ data: unknown;
1332
+ }
1333
+ /**
1334
+ * Image
1335
+ */
1336
+ interface NASTImage$2 {
1337
+ type: 'image';
1338
+ url: string;
1339
+ title: string | null | undefined;
1340
+ alt: string | null | undefined;
1341
+ data: {
1342
+ fileType: 'file' | 'external';
1343
+ expiryTime?: string;
1344
+ caption?: NASTNode$2[];
1345
+ blockId?: string;
1346
+ };
1347
+ }
1348
+ /**
1349
+ * Video
1350
+ */
1351
+ interface NASTVideo$2 {
1352
+ type: 'video';
1353
+ url: string;
1354
+ data: {
1355
+ fileType: 'file' | 'external';
1356
+ expiryTime?: string;
1357
+ caption?: NASTNode$2[];
1358
+ blockId?: string;
1359
+ };
1360
+ }
1361
+ /**
1362
+ * File attachment
1363
+ */
1364
+ interface NASTFile$2 {
1365
+ type: 'file';
1366
+ url: string;
1367
+ name: string;
1368
+ data: {
1369
+ fileType: 'file' | 'external';
1370
+ expiryTime?: string;
1371
+ caption?: NASTNode$2[];
1372
+ blockId?: string;
1373
+ };
1374
+ }
1375
+ /**
1376
+ * PDF embed
1377
+ */
1378
+ interface NASTPDF$2 {
1379
+ type: 'pdf';
1380
+ url: string;
1381
+ data: {
1382
+ fileType: 'file' | 'external';
1383
+ expiryTime?: string;
1384
+ caption?: NASTNode$2[];
1385
+ blockId?: string;
1386
+ };
1387
+ }
1388
+ /**
1389
+ * Bookmark (link with preview)
1390
+ */
1391
+ interface NASTBookmark$2 {
1392
+ type: 'bookmark';
1393
+ url: string;
1394
+ data?: {
1395
+ caption?: NASTNode$2[];
1396
+ blockId?: string;
1397
+ };
1398
+ }
1399
+ /**
1400
+ * Generic embed
1401
+ */
1402
+ interface NASTEmbed$2 {
1403
+ type: 'embed';
1404
+ url: string;
1405
+ data?: {
1406
+ caption?: NASTNode$2[];
1407
+ blockId?: string;
1408
+ };
1409
+ }
1410
+ /**
1411
+ * Child page reference
1412
+ */
1413
+ interface NASTChildPage$2 {
1414
+ type: 'childPage';
1415
+ title: string;
1416
+ pageId: string;
1417
+ data?: {
1418
+ blockId?: string;
1419
+ };
1420
+ }
1421
+ //#endregion
1422
+ //#endregion
1423
+ //#region ../types/dist/nbt.d.ts
1424
+ //#region src/nbt.d.ts
1425
+
1426
+ /**
1427
+ * Base NBT block interface
1428
+ */
1429
+ interface NBTBlock$2 {
1430
+ id: string;
1431
+ type: string;
1432
+ properties: Record<string, unknown>;
1433
+ children?: NBTBlock$2[];
1434
+ metadata?: NBTNodeMetadata$1;
1435
+ processed_at?: string;
1436
+ }
1437
+ /**
1438
+ * Block metadata from Notion API
1439
+ */
1440
+ interface NBTNodeMetadata$1 {
1441
+ created_time?: string;
1442
+ last_edited_time?: string;
1443
+ created_by?: string;
1444
+ last_edited_by?: string;
1445
+ archived?: boolean;
1446
+ in_trash?: boolean;
1447
+ }
1448
+ /**
1449
+ * Properties specific to page blocks
1450
+ */
1451
+ interface NBTPageProperties {
1452
+ title: string;
1453
+ icon?: IconInfo;
1454
+ cover?: FileInfo;
1455
+ notionProperties?: Record<string, unknown>;
1456
+ [key: string]: unknown;
1457
+ }
1458
+ /**
1459
+ * NBT Page Node (block with type: "page")
1460
+ */
1461
+ interface NBTPageNode extends NBTBlock$2 {
1462
+ type: 'page';
1463
+ properties: NBTPageProperties;
1464
+ children?: NBTBlock$2[];
1465
+ processed_at?: string;
1466
+ }
1467
+ /**
1468
+ * NBT Document (alias for page node)
1469
+ */
1470
+ type NBTDocument = NBTPageNode;
1471
+ /**
1472
+ * Paragraph block
1473
+ */
1474
+
1475
+ /**
1476
+ * @deprecated Use RichText from common.ts instead
1477
+ */
1478
+
1479
+ //#endregion
1480
+ //#endregion
1481
+ //#region src/nbt2nast.d.ts
1482
+ /**
1483
+ * Main converter function from NBT to NAST
1484
+ */
1485
+ declare function nbt2nast(page: NBTDocument, options?: {
1486
+ preserveBlockId?: boolean;
1487
+ }): NASTRoot$2;
1488
+ /**
1489
+ * Default export
1490
+ */
1491
+ //#endregion
1492
+ //#region src/block-transform.d.ts
1493
+ /**
1494
+ * Transforms a NBT block to NAST node
1495
+ */
1496
+ //#endregion
1497
+ //#region ../nast2typst/dist/index.d.ts
1498
+ //#region ../types/dist/nast.d.ts
1499
+ //#region src/nast.d.ts
1500
+ /**
1501
+ * NAST (Notion Abstract Syntax Tree) Types
1502
+ *
1503
+ * NAST is a unified-like AST format for representing Notion content.
1504
+ * It's designed to be easily converted to various output formats (Markdown, Typst, etc.)
1505
+ */
1506
+ /**
1507
+ * Root node of a NAST document
1508
+ */
1509
+ interface NASTRoot$1 {
1510
+ type: 'root';
1511
+ children: NASTNode$1[];
1512
+ data: {
1513
+ pageId: string;
1514
+ title: string;
1515
+ icon?: {
1516
+ type: 'emoji' | 'file' | 'external';
1517
+ value: string;
1518
+ };
1519
+ processedAt: string;
1520
+ };
1521
+ }
1522
+ /**
1523
+ * Union of all NAST node types
1524
+ */
1525
+ type NASTNode$1 = NASTParagraph$1 | NASTHeading$1 | NASTText$1 | NASTStrong$1 | NASTEmphasis$1 | NASTUnderline$1 | NASTDelete$1 | NASTInlineCode$1 | NASTLink$1 | NASTMention$1 | NASTMath$1 | NASTInlineMath$1 | NASTCode$1 | NASTBlockquote$1 | NASTCallout$1 | NASTToggle$1 | NASTList$1 | NASTListItem$1 | NASTColumnList$1 | NASTColumn$1 | NASTImage$1 | NASTThematicBreak$1 | NASTTable$1 | NASTTableRow$1 | NASTTableCell$1 | NASTChildPage$1 | NASTVideo$1 | NASTFile$1 | NASTPDF$1 | NASTBookmark$1 | NASTEmbed$1;
1526
+ /**
1527
+ * Paragraph block
1528
+ */
1529
+ interface NASTParagraph$1 {
1530
+ type: 'paragraph';
1531
+ children: NASTNode$1[];
1532
+ data?: {
1533
+ blockId?: string;
1534
+ };
1535
+ }
1536
+ /**
1537
+ * Heading block (h1, h2, h3)
1538
+ */
1539
+ interface NASTHeading$1 {
1540
+ type: 'heading';
1541
+ depth: 1 | 2 | 3;
1542
+ children: NASTNode$1[];
1543
+ /** Indicates if this heading is also a toggle (collapsible) */
1544
+ isToggleable?: boolean;
1545
+ data?: {
1546
+ blockId?: string;
1547
+ };
1548
+ }
1549
+ /**
1550
+ * Code block with syntax highlighting
1551
+ */
1552
+ interface NASTCode$1 {
1553
+ type: 'code';
1554
+ lang: string;
1555
+ value: string;
1556
+ data?: {
1557
+ caption?: NASTNode$1[];
1558
+ blockId?: string;
1559
+ };
1560
+ }
1561
+ /**
1562
+ * Block math equation
1563
+ */
1564
+ interface NASTMath$1 {
1565
+ type: 'math';
1566
+ value: string;
1567
+ data?: {
1568
+ blockId?: string;
1569
+ };
1570
+ }
1571
+ /**
1572
+ * Blockquote
1573
+ */
1574
+ interface NASTBlockquote$1 {
1575
+ type: 'blockquote';
1576
+ children: NASTNode$1[];
1577
+ data?: {
1578
+ blockId?: string;
1579
+ };
1580
+ }
1581
+ /**
1582
+ * Callout block (with icon and color)
1583
+ */
1584
+ interface NASTCallout$1 {
1585
+ type: 'callout';
1586
+ data: {
1587
+ icon: {
1588
+ type: 'emoji';
1589
+ value: string;
1590
+ } | null;
1591
+ color: string;
1592
+ blockId?: string;
1593
+ };
1594
+ children: NASTNode$1[];
1595
+ }
1596
+ /**
1597
+ * Toggle block (collapsible content)
1598
+ */
1599
+ interface NASTToggle$1 {
1600
+ type: 'toggle';
1601
+ children: NASTNode$1[];
1602
+ data?: {
1603
+ blockId?: string;
1604
+ };
1605
+ }
1606
+ /**
1607
+ * Thematic break / divider
1608
+ */
1609
+ interface NASTThematicBreak$1 {
1610
+ type: 'thematicBreak';
1611
+ data?: {
1612
+ blockId?: string;
1613
+ };
1614
+ }
1615
+ /**
1616
+ * List (ordered or unordered)
1617
+ */
1618
+ interface NASTList$1 {
1619
+ type: 'list';
1620
+ ordered: boolean;
1621
+ children: NASTListItem$1[];
1622
+ }
1623
+ /**
1624
+ * List item (can be a checklist item if checked is defined)
1625
+ */
1626
+ interface NASTListItem$1 {
1627
+ type: 'listItem';
1628
+ /** undefined = not a checklist, true/false = checked state */
1629
+ checked?: boolean;
1630
+ children: NASTNode$1[];
1631
+ data?: {
1632
+ blockId?: string;
1633
+ };
1634
+ }
1635
+ /**
1636
+ * Column list (container for columns)
1637
+ */
1638
+ interface NASTColumnList$1 {
1639
+ type: 'columnList';
1640
+ children: NASTColumn$1[];
1641
+ data?: {
1642
+ blockId?: string;
1643
+ };
1644
+ }
1645
+ /**
1646
+ * Column within a column list
1647
+ */
1648
+ interface NASTColumn$1 {
1649
+ type: 'column';
1650
+ /** Width ratio (0.5 = 50%, matches NBT format) */
1651
+ widthRatio: number;
1652
+ children: NASTNode$1[];
1653
+ data?: {
1654
+ blockId?: string;
1655
+ };
1656
+ }
1657
+ /**
1658
+ * Table
1659
+ */
1660
+ interface NASTTable$1 {
1661
+ type: 'table';
1662
+ hasColumnHeader: boolean;
1663
+ hasRowHeader: boolean;
1664
+ children: NASTTableRow$1[];
1665
+ data?: {
1666
+ blockId?: string;
1667
+ };
1668
+ }
1669
+ /**
1670
+ * Table row
1671
+ */
1672
+ interface NASTTableRow$1 {
1673
+ type: 'tableRow';
1674
+ children: NASTTableCell$1[];
1675
+ }
1676
+ /**
1677
+ * Table cell
1678
+ */
1679
+ interface NASTTableCell$1 {
1680
+ type: 'tableCell';
1681
+ children: NASTNode$1[];
1682
+ }
1683
+ /**
1684
+ * Plain text
1685
+ */
1686
+ interface NASTText$1 {
1687
+ type: 'text';
1688
+ value: string;
1689
+ data?: {
1690
+ color?: string;
1691
+ backgroundColor?: string;
1692
+ };
1693
+ }
1694
+ /**
1695
+ * Bold text
1696
+ */
1697
+ interface NASTStrong$1 {
1698
+ type: 'strong';
1699
+ children: NASTNode$1[];
1700
+ }
1701
+ /**
1702
+ * Italic text
1703
+ */
1704
+ interface NASTEmphasis$1 {
1705
+ type: 'emphasis';
1706
+ children: NASTNode$1[];
1707
+ }
1708
+ /**
1709
+ * Underlined text
1710
+ */
1711
+ interface NASTUnderline$1 {
1712
+ type: 'underline';
1713
+ children: NASTNode$1[];
1714
+ }
1715
+ /**
1716
+ * Strikethrough text
1717
+ */
1718
+ interface NASTDelete$1 {
1719
+ type: 'delete';
1720
+ children: NASTNode$1[];
1721
+ }
1722
+ /**
1723
+ * Inline code
1724
+ */
1725
+ interface NASTInlineCode$1 {
1726
+ type: 'inlineCode';
1727
+ value: string;
1728
+ }
1729
+ /**
1730
+ * Inline math equation
1731
+ */
1732
+ interface NASTInlineMath$1 {
1733
+ type: 'inlineMath';
1734
+ value: string;
1735
+ }
1736
+ /**
1737
+ * Link
1738
+ */
1739
+ interface NASTLink$1 {
1740
+ type: 'link';
1741
+ url: string;
1742
+ children: NASTNode$1[];
1743
+ data?: {
1744
+ title?: string;
1745
+ iconUrl?: string;
1746
+ description?: string;
1747
+ provider?: string;
1748
+ thumbnailUrl?: string;
1749
+ };
1750
+ }
1751
+ /**
1752
+ * Mention (@user, date, page, database)
1753
+ */
1754
+ interface NASTMention$1 {
1755
+ type: 'mention';
1756
+ mentionType: 'user' | 'date' | 'page' | 'database';
1757
+ value: string;
1758
+ data: unknown;
1759
+ }
1760
+ /**
1761
+ * Image
1762
+ */
1763
+ interface NASTImage$1 {
1764
+ type: 'image';
1765
+ url: string;
1766
+ title: string | null | undefined;
1767
+ alt: string | null | undefined;
1768
+ data: {
1769
+ fileType: 'file' | 'external';
1770
+ expiryTime?: string;
1771
+ caption?: NASTNode$1[];
1772
+ blockId?: string;
1773
+ };
1774
+ }
1775
+ /**
1776
+ * Video
1777
+ */
1778
+ interface NASTVideo$1 {
1779
+ type: 'video';
1780
+ url: string;
1781
+ data: {
1782
+ fileType: 'file' | 'external';
1783
+ expiryTime?: string;
1784
+ caption?: NASTNode$1[];
1785
+ blockId?: string;
1786
+ };
1787
+ }
1788
+ /**
1789
+ * File attachment
1790
+ */
1791
+ interface NASTFile$1 {
1792
+ type: 'file';
1793
+ url: string;
1794
+ name: string;
1795
+ data: {
1796
+ fileType: 'file' | 'external';
1797
+ expiryTime?: string;
1798
+ caption?: NASTNode$1[];
1799
+ blockId?: string;
1800
+ };
1801
+ }
1802
+ /**
1803
+ * PDF embed
1804
+ */
1805
+ interface NASTPDF$1 {
1806
+ type: 'pdf';
1807
+ url: string;
1808
+ data: {
1809
+ fileType: 'file' | 'external';
1810
+ expiryTime?: string;
1811
+ caption?: NASTNode$1[];
1812
+ blockId?: string;
1813
+ };
1814
+ }
1815
+ /**
1816
+ * Bookmark (link with preview)
1817
+ */
1818
+ interface NASTBookmark$1 {
1819
+ type: 'bookmark';
1820
+ url: string;
1821
+ data?: {
1822
+ caption?: NASTNode$1[];
1823
+ blockId?: string;
1824
+ };
1825
+ }
1826
+ /**
1827
+ * Generic embed
1828
+ */
1829
+ interface NASTEmbed$1 {
1830
+ type: 'embed';
1831
+ url: string;
1832
+ data?: {
1833
+ caption?: NASTNode$1[];
1834
+ blockId?: string;
1835
+ };
1836
+ }
1837
+ /**
1838
+ * Child page reference
1839
+ */
1840
+ interface NASTChildPage$1 {
1841
+ type: 'childPage';
1842
+ title: string;
1843
+ pageId: string;
1844
+ data?: {
1845
+ blockId?: string;
1846
+ };
1847
+ }
1848
+ //#endregion
1849
+ //#endregion
1850
+ //#region src/index.d.ts
1851
+ /**
1852
+ * Converts a NAST (Unified-like Notion Abstract Syntax Tree) to Typst markup.
1853
+ *
1854
+ * @param root - The NAST root node
1855
+ * @returns Typst markup string
1856
+ */
1857
+ declare function nast2typst(root: NASTRoot$1): string;
1858
+ //#endregion
1859
+ //#endregion
1860
+ //#region ../nast-fetch-images/dist/index.d.ts
1861
+ //#region ../types/dist/common.d.ts
1862
+
1863
+ /**
1864
+ * Downloaded image data
1865
+ */
1866
+ interface DownloadedImage$1 {
1867
+ url: string;
1868
+ contentType: string;
1869
+ data: ArrayBuffer;
1870
+ }
1871
+ /**
1872
+ * Result of fetching images from blocks
1873
+ */
1874
+ interface FetchImagesResult {
1875
+ images: DownloadedImage$1[];
1876
+ imageCount: number;
1877
+ imageFileCount: number;
1878
+ imageExternalCount: number;
1879
+ expiredCount: number;
1880
+ }
1881
+ /**
1882
+ * Text annotations (formatting)
1883
+ */
1884
+ //#endregion
1885
+ //#region src/types.d.ts
1886
+ /**
1887
+ * Generic block type for traversal
1888
+ */
1889
+ interface Block {
1890
+ type: string;
1891
+ children?: Block[];
1892
+ [key: string]: any;
1893
+ }
1894
+ //#endregion
1895
+ //#region src/index.d.ts
1896
+ /**
1897
+ * Fetches all images from an array of NAST blocks
1898
+ * @param blocks - Array of NAST blocks (which may include image blocks)
1899
+ * @returns Promise resolving to object with downloaded images and count of expired images
1900
+ */
1901
+ declare function fetchImagesFromBlocks(blocks: Block[]): Promise<FetchImagesResult>;
1902
+ /**
1903
+ * Gets the file extension for a given content type
1904
+ * @param contentType - The MIME content type (e.g., 'image/png')
1905
+ * @returns The file extension including the dot (e.g., '.png'), or '.bin' if unknown
1906
+ */
1907
+ declare function getExtensionFromContentType(contentType: string): string;
1908
+ //#endregion
1909
+ //#endregion
1910
+ //#region ../types/dist/common.d.ts
1911
+ /**
1912
+ * Downloaded image data
1913
+ */
1914
+ interface DownloadedImage {
1915
+ url: string;
1916
+ contentType: string;
1917
+ data: ArrayBuffer;
1918
+ }
1919
+ /**
1920
+ * Result of fetching images from blocks
1921
+ */
1922
+ //#endregion
1923
+ //#region ../types/dist/nast.d.ts
1924
+ //#region src/nast.d.ts
1925
+ /**
1926
+ * NAST (Notion Abstract Syntax Tree) Types
1927
+ *
1928
+ * NAST is a unified-like AST format for representing Notion content.
1929
+ * It's designed to be easily converted to various output formats (Markdown, Typst, etc.)
1930
+ */
1931
+ /**
1932
+ * Root node of a NAST document
1933
+ */
1934
+ interface NASTRoot {
1935
+ type: 'root';
1936
+ children: NASTNode[];
1937
+ data: {
1938
+ pageId: string;
1939
+ title: string;
1940
+ icon?: {
1941
+ type: 'emoji' | 'file' | 'external';
1942
+ value: string;
1943
+ };
1944
+ processedAt: string;
1945
+ };
1946
+ }
1947
+ /**
1948
+ * Union of all NAST node types
1949
+ */
1950
+ type NASTNode = NASTParagraph | NASTHeading | NASTText | NASTStrong | NASTEmphasis | NASTUnderline | NASTDelete | NASTInlineCode | NASTLink | NASTMention | NASTMath | NASTInlineMath | NASTCode | NASTBlockquote | NASTCallout | NASTToggle | NASTList | NASTListItem | NASTColumnList | NASTColumn | NASTImage | NASTThematicBreak | NASTTable | NASTTableRow | NASTTableCell | NASTChildPage | NASTVideo | NASTFile | NASTPDF | NASTBookmark | NASTEmbed;
1951
+ /**
1952
+ * Paragraph block
1953
+ */
1954
+ interface NASTParagraph {
1955
+ type: 'paragraph';
1956
+ children: NASTNode[];
1957
+ data?: {
1958
+ blockId?: string;
1959
+ };
1960
+ }
1961
+ /**
1962
+ * Heading block (h1, h2, h3)
1963
+ */
1964
+ interface NASTHeading {
1965
+ type: 'heading';
1966
+ depth: 1 | 2 | 3;
1967
+ children: NASTNode[];
1968
+ /** Indicates if this heading is also a toggle (collapsible) */
1969
+ isToggleable?: boolean;
1970
+ data?: {
1971
+ blockId?: string;
1972
+ };
1973
+ }
1974
+ /**
1975
+ * Code block with syntax highlighting
1976
+ */
1977
+ interface NASTCode {
1978
+ type: 'code';
1979
+ lang: string;
1980
+ value: string;
1981
+ data?: {
1982
+ caption?: NASTNode[];
1983
+ blockId?: string;
1984
+ };
1985
+ }
1986
+ /**
1987
+ * Block math equation
1988
+ */
1989
+ interface NASTMath {
1990
+ type: 'math';
1991
+ value: string;
1992
+ data?: {
1993
+ blockId?: string;
1994
+ };
1995
+ }
1996
+ /**
1997
+ * Blockquote
1998
+ */
1999
+ interface NASTBlockquote {
2000
+ type: 'blockquote';
2001
+ children: NASTNode[];
2002
+ data?: {
2003
+ blockId?: string;
2004
+ };
2005
+ }
2006
+ /**
2007
+ * Callout block (with icon and color)
2008
+ */
2009
+ interface NASTCallout {
2010
+ type: 'callout';
2011
+ data: {
2012
+ icon: {
2013
+ type: 'emoji';
2014
+ value: string;
2015
+ } | null;
2016
+ color: string;
2017
+ blockId?: string;
2018
+ };
2019
+ children: NASTNode[];
2020
+ }
2021
+ /**
2022
+ * Toggle block (collapsible content)
2023
+ */
2024
+ interface NASTToggle {
2025
+ type: 'toggle';
2026
+ children: NASTNode[];
2027
+ data?: {
2028
+ blockId?: string;
2029
+ };
2030
+ }
2031
+ /**
2032
+ * Thematic break / divider
2033
+ */
2034
+ interface NASTThematicBreak {
2035
+ type: 'thematicBreak';
2036
+ data?: {
2037
+ blockId?: string;
2038
+ };
2039
+ }
2040
+ /**
2041
+ * List (ordered or unordered)
2042
+ */
2043
+ interface NASTList {
2044
+ type: 'list';
2045
+ ordered: boolean;
2046
+ children: NASTListItem[];
2047
+ }
2048
+ /**
2049
+ * List item (can be a checklist item if checked is defined)
2050
+ */
2051
+ interface NASTListItem {
2052
+ type: 'listItem';
2053
+ /** undefined = not a checklist, true/false = checked state */
2054
+ checked?: boolean;
2055
+ children: NASTNode[];
2056
+ data?: {
2057
+ blockId?: string;
2058
+ };
2059
+ }
2060
+ /**
2061
+ * Column list (container for columns)
2062
+ */
2063
+ interface NASTColumnList {
2064
+ type: 'columnList';
2065
+ children: NASTColumn[];
2066
+ data?: {
2067
+ blockId?: string;
2068
+ };
2069
+ }
2070
+ /**
2071
+ * Column within a column list
2072
+ */
2073
+ interface NASTColumn {
2074
+ type: 'column';
2075
+ /** Width ratio (0.5 = 50%, matches NBT format) */
2076
+ widthRatio: number;
2077
+ children: NASTNode[];
2078
+ data?: {
2079
+ blockId?: string;
2080
+ };
2081
+ }
2082
+ /**
2083
+ * Table
2084
+ */
2085
+ interface NASTTable {
2086
+ type: 'table';
2087
+ hasColumnHeader: boolean;
2088
+ hasRowHeader: boolean;
2089
+ children: NASTTableRow[];
2090
+ data?: {
2091
+ blockId?: string;
2092
+ };
2093
+ }
2094
+ /**
2095
+ * Table row
2096
+ */
2097
+ interface NASTTableRow {
2098
+ type: 'tableRow';
2099
+ children: NASTTableCell[];
2100
+ }
2101
+ /**
2102
+ * Table cell
2103
+ */
2104
+ interface NASTTableCell {
2105
+ type: 'tableCell';
2106
+ children: NASTNode[];
2107
+ }
2108
+ /**
2109
+ * Plain text
2110
+ */
2111
+ interface NASTText {
2112
+ type: 'text';
2113
+ value: string;
2114
+ data?: {
2115
+ color?: string;
2116
+ backgroundColor?: string;
2117
+ };
2118
+ }
2119
+ /**
2120
+ * Bold text
2121
+ */
2122
+ interface NASTStrong {
2123
+ type: 'strong';
2124
+ children: NASTNode[];
2125
+ }
2126
+ /**
2127
+ * Italic text
2128
+ */
2129
+ interface NASTEmphasis {
2130
+ type: 'emphasis';
2131
+ children: NASTNode[];
2132
+ }
2133
+ /**
2134
+ * Underlined text
2135
+ */
2136
+ interface NASTUnderline {
2137
+ type: 'underline';
2138
+ children: NASTNode[];
2139
+ }
2140
+ /**
2141
+ * Strikethrough text
2142
+ */
2143
+ interface NASTDelete {
2144
+ type: 'delete';
2145
+ children: NASTNode[];
2146
+ }
2147
+ /**
2148
+ * Inline code
2149
+ */
2150
+ interface NASTInlineCode {
2151
+ type: 'inlineCode';
2152
+ value: string;
2153
+ }
2154
+ /**
2155
+ * Inline math equation
2156
+ */
2157
+ interface NASTInlineMath {
2158
+ type: 'inlineMath';
2159
+ value: string;
2160
+ }
2161
+ /**
2162
+ * Link
2163
+ */
2164
+ interface NASTLink {
2165
+ type: 'link';
2166
+ url: string;
2167
+ children: NASTNode[];
2168
+ data?: {
2169
+ title?: string;
2170
+ iconUrl?: string;
2171
+ description?: string;
2172
+ provider?: string;
2173
+ thumbnailUrl?: string;
2174
+ };
2175
+ }
2176
+ /**
2177
+ * Mention (@user, date, page, database)
2178
+ */
2179
+ interface NASTMention {
2180
+ type: 'mention';
2181
+ mentionType: 'user' | 'date' | 'page' | 'database';
2182
+ value: string;
2183
+ data: unknown;
2184
+ }
2185
+ /**
2186
+ * Image
2187
+ */
2188
+ interface NASTImage {
2189
+ type: 'image';
2190
+ url: string;
2191
+ title: string | null | undefined;
2192
+ alt: string | null | undefined;
2193
+ data: {
2194
+ fileType: 'file' | 'external';
2195
+ expiryTime?: string;
2196
+ caption?: NASTNode[];
2197
+ blockId?: string;
2198
+ };
2199
+ }
2200
+ /**
2201
+ * Video
2202
+ */
2203
+ interface NASTVideo {
2204
+ type: 'video';
2205
+ url: string;
2206
+ data: {
2207
+ fileType: 'file' | 'external';
2208
+ expiryTime?: string;
2209
+ caption?: NASTNode[];
2210
+ blockId?: string;
2211
+ };
2212
+ }
2213
+ /**
2214
+ * File attachment
2215
+ */
2216
+ interface NASTFile {
2217
+ type: 'file';
2218
+ url: string;
2219
+ name: string;
2220
+ data: {
2221
+ fileType: 'file' | 'external';
2222
+ expiryTime?: string;
2223
+ caption?: NASTNode[];
2224
+ blockId?: string;
2225
+ };
2226
+ }
2227
+ /**
2228
+ * PDF embed
2229
+ */
2230
+ interface NASTPDF {
2231
+ type: 'pdf';
2232
+ url: string;
2233
+ data: {
2234
+ fileType: 'file' | 'external';
2235
+ expiryTime?: string;
2236
+ caption?: NASTNode[];
2237
+ blockId?: string;
2238
+ };
2239
+ }
2240
+ /**
2241
+ * Bookmark (link with preview)
2242
+ */
2243
+ interface NASTBookmark {
2244
+ type: 'bookmark';
2245
+ url: string;
2246
+ data?: {
2247
+ caption?: NASTNode[];
2248
+ blockId?: string;
2249
+ };
2250
+ }
2251
+ /**
2252
+ * Generic embed
2253
+ */
2254
+ interface NASTEmbed {
2255
+ type: 'embed';
2256
+ url: string;
2257
+ data?: {
2258
+ caption?: NASTNode[];
2259
+ blockId?: string;
2260
+ };
2261
+ }
2262
+ /**
2263
+ * Child page reference
2264
+ */
2265
+ interface NASTChildPage {
2266
+ type: 'childPage';
2267
+ title: string;
2268
+ pageId: string;
2269
+ data?: {
2270
+ blockId?: string;
2271
+ };
2272
+ }
2273
+ //#endregion
2274
+ //#endregion
2275
+ //#region ../types/dist/nbt.d.ts
2276
+ //#region src/nbt.d.ts
2277
+
2278
+ /**
2279
+ * Base NBT block interface
2280
+ */
2281
+ interface NBTBlock {
2282
+ id: string;
2283
+ type: string;
2284
+ properties: Record<string, unknown>;
2285
+ children?: NBTBlock[];
2286
+ metadata?: NBTNodeMetadata;
2287
+ processed_at?: string;
2288
+ }
2289
+ /**
2290
+ * Block metadata from Notion API
2291
+ */
2292
+ interface NBTNodeMetadata {
2293
+ created_time?: string;
2294
+ last_edited_time?: string;
2295
+ created_by?: string;
2296
+ last_edited_by?: string;
2297
+ archived?: boolean;
2298
+ in_trash?: boolean;
2299
+ }
2300
+ /**
2301
+ * Properties specific to page blocks
2302
+ */
2303
+ //#endregion
2304
+ //#region src/index.d.ts
2305
+ /**
2306
+ * Image data from the fetchImagesFromBlocks function
2307
+ * @deprecated Use DownloadedImage from @nast/types instead
2308
+ */
2309
+ type ImageData = DownloadedImage;
2310
+ /**
2311
+ * Options for the notion2typst function
2312
+ */
2313
+ interface Notion2TypstOptions {
2314
+ /** Notion API token */
2315
+ notionToken: string;
2316
+ /** Notion page ID to convert */
2317
+ pageId: string;
2318
+ /** Whether to fetch images from the page (default: true) */
2319
+ fetchImages?: boolean;
2320
+ /** Whether to preserve block IDs in NAST (default: false) */
2321
+ preserveBlockId?: boolean;
2322
+ /** Whether to enable caching in Notion2NBT (default: false) */
2323
+ enableCache?: boolean;
2324
+ }
2325
+ /**
2326
+ * Result of the notion2typst conversion
2327
+ */
2328
+ interface Notion2TypstResult {
2329
+ /** The generated Typst code */
2330
+ typstCode: string;
2331
+ /** Downloaded images (if fetchImages was true) */
2332
+ images: DownloadedImage[];
2333
+ /** Image fetch statistics (if fetchImages was true) */
2334
+ imageStats: {
2335
+ /** Total number of image blocks found */
2336
+ totalImages: number;
2337
+ /** Number of successfully downloaded images */
2338
+ downloaded: number;
2339
+ /** Number of expired images */
2340
+ expired: number;
2341
+ /** Number of external images */
2342
+ external: number;
2343
+ /** Number of file images */
2344
+ file: number;
2345
+ };
2346
+ /** The intermediate NAST representation */
2347
+ nast: NASTRoot;
2348
+ }
2349
+ /**
2350
+ * Main notion2typst function - converts a Notion page to Typst code
2351
+ *
2352
+ * This is a wrapper that combines:
2353
+ * 1. notion2nbt - fetch page from Notion API
2354
+ * 2. nbt2nast - convert Notion blocks to NAST
2355
+ * 3. nast2typst - convert NAST to Typst code
2356
+ * 4. fetchImagesFromBlocks - download images (optional)
2357
+ *
2358
+ * @param options - Configuration options
2359
+ * @returns Typst code and downloaded images
2360
+ *
2361
+ * @example
2362
+ * ```typescript
2363
+ * const result = await notion2typst({
2364
+ * notionToken: 'your-token',
2365
+ * pageId: 'your-page-id',
2366
+ * fetchImages: true
2367
+ * });
2368
+ *
2369
+ * console.log(result.typstCode);
2370
+ * console.log(`Downloaded ${result.images.length} images`);
2371
+ * ```
2372
+ */
2373
+ declare function notion2typst(options: Notion2TypstOptions): Promise<Notion2TypstResult>;
2374
+ //#endregion
2375
+ export { type DownloadedImage, ImageData, type NASTNode, type NASTRoot, type NBTBlock, Notion2NBT, Notion2TypstOptions, Notion2TypstResult, type NBTBlock$1 as NotionBlock, fetchImagesFromBlocks, getExtensionFromContentType, nast2typst, nbt2nast, notion2typst };