@notionhq/custom-blocks-host 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +0 -5
  2. package/dist/browser.js +1 -1
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/lifecycle/legacyPage.d.ts +70 -0
  6. package/dist/lifecycle/legacyPage.d.ts.map +1 -0
  7. package/dist/lifecycle/legacyPage.js +171 -0
  8. package/dist/lifecycle/normalizeHostToSandboxMessage.d.ts +2 -2
  9. package/dist/lifecycle/normalizeHostToSandboxMessage.d.ts.map +1 -1
  10. package/dist/lifecycle/normalizeHostToSandboxMessage.js +8 -30
  11. package/dist/lifecycle/normalizePage.d.ts +7 -0
  12. package/dist/lifecycle/normalizePage.d.ts.map +1 -0
  13. package/dist/lifecycle/normalizePage.js +22 -0
  14. package/dist/messages/types.d.ts +1 -2
  15. package/dist/messages/types.d.ts.map +1 -1
  16. package/dist/protocol/dataSources/dataSourcePage.d.ts +1 -162
  17. package/dist/protocol/dataSources/dataSourcePage.js +1 -9
  18. package/dist/protocol/messages/createPage.js +2 -2
  19. package/dist/protocol/messages/createPageResult.d.ts +468 -1
  20. package/dist/protocol/messages/createPageResult.js +17 -2
  21. package/dist/protocol/messages/getPage.d.ts +468 -1
  22. package/dist/protocol/messages/getPage.js +18 -3
  23. package/dist/protocol/messages/hostToSandbox.d.ts +2398 -159
  24. package/dist/protocol/messages/hostToSandbox.js +22 -12
  25. package/dist/protocol/messages/queryDataSourceResult.d.ts +312 -2
  26. package/dist/protocol/messages/queryDataSourceResult.js +18 -5
  27. package/dist/protocol/messages/sandboxToHost.d.ts +2 -0
  28. package/dist/protocol/messages/updatePage.d.ts +1 -0
  29. package/dist/protocol/messages/updatePage.js +4 -3
  30. package/dist/protocol/messages/updatePageResult.d.ts +467 -1
  31. package/dist/protocol/messages/updatePageResult.js +16 -2
  32. package/dist/protocol/pages/page.d.ts +386 -6
  33. package/dist/protocol/pages/page.js +23 -2
  34. package/dist/protocol/protocolVersion.js +1 -1
  35. package/package.json +1 -1
  36. package/src/index.ts +2 -4
  37. package/src/lifecycle/legacyPage.ts +208 -0
  38. package/src/lifecycle/normalizeHostToSandboxMessage.ts +18 -35
  39. package/src/lifecycle/normalizePage.ts +35 -0
  40. package/src/messages/types.ts +1 -1
@@ -313,7 +313,7 @@ export declare const notionPagePropertyValueSchema: v.VariantSchema<"type", [v.O
313
313
  readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
314
314
  }, undefined>], undefined>;
315
315
  export type NotionPagePropertyValue = v.InferOutput<typeof notionPagePropertyValueSchema>;
316
- export declare const notionPagePropertyReadMapSchema: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
316
+ export declare const notionPagePropertyWriteMapSchema: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
317
317
  readonly id: v.StringSchema<undefined>;
318
318
  readonly type: v.LiteralSchema<"title", undefined>;
319
319
  readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
@@ -466,14 +466,394 @@ export declare const notionPagePropertyReadMapSchema: v.RecordSchema<v.StringSch
466
466
  readonly type: v.LiteralSchema<"last_visited_time", undefined>;
467
467
  readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
468
468
  }, undefined>], undefined>, undefined>;
469
+ export declare const notionPagePropertyReadMapSchema: v.RecordSchema<v.StringSchema<undefined>, v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
470
+ readonly id: v.StringSchema<undefined>;
471
+ readonly type: v.LiteralSchema<"title", undefined>;
472
+ readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
473
+ }, undefined>, v.ObjectSchema<{
474
+ readonly id: v.StringSchema<undefined>;
475
+ readonly type: v.LiteralSchema<"rich_text", undefined>;
476
+ readonly rich_text: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
477
+ }, undefined>, v.ObjectSchema<{
478
+ readonly id: v.StringSchema<undefined>;
479
+ readonly type: v.LiteralSchema<"number", undefined>;
480
+ readonly number: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
481
+ }, undefined>, v.ObjectSchema<{
482
+ readonly id: v.StringSchema<undefined>;
483
+ readonly type: v.LiteralSchema<"url", undefined>;
484
+ readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
485
+ }, undefined>, v.ObjectSchema<{
486
+ readonly id: v.StringSchema<undefined>;
487
+ readonly type: v.LiteralSchema<"email", undefined>;
488
+ readonly email: v.NullableSchema<v.StringSchema<undefined>, undefined>;
489
+ }, undefined>, v.ObjectSchema<{
490
+ readonly id: v.StringSchema<undefined>;
491
+ readonly type: v.LiteralSchema<"phone_number", undefined>;
492
+ readonly phone_number: v.NullableSchema<v.StringSchema<undefined>, undefined>;
493
+ }, undefined>, v.ObjectSchema<{
494
+ readonly id: v.StringSchema<undefined>;
495
+ readonly type: v.LiteralSchema<"checkbox", undefined>;
496
+ readonly checkbox: v.BooleanSchema<undefined>;
497
+ }, undefined>, v.ObjectSchema<{
498
+ readonly id: v.StringSchema<undefined>;
499
+ readonly type: v.LiteralSchema<"select", undefined>;
500
+ readonly select: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
501
+ readonly id: v.StringSchema<undefined>;
502
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
503
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
504
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
505
+ }, undefined>, v.ObjectSchema<{
506
+ readonly name: v.StringSchema<undefined>;
507
+ readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
508
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
509
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
510
+ }, undefined>], undefined>, undefined>;
511
+ }, undefined>, v.ObjectSchema<{
512
+ readonly id: v.StringSchema<undefined>;
513
+ readonly type: v.LiteralSchema<"status", undefined>;
514
+ readonly status: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
515
+ readonly id: v.StringSchema<undefined>;
516
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
517
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
518
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
519
+ }, undefined>, v.ObjectSchema<{
520
+ readonly name: v.StringSchema<undefined>;
521
+ readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
522
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
523
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
524
+ }, undefined>], undefined>, undefined>;
525
+ }, undefined>, v.ObjectSchema<{
526
+ readonly id: v.StringSchema<undefined>;
527
+ readonly type: v.LiteralSchema<"multi_select", undefined>;
528
+ readonly multi_select: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
529
+ readonly id: v.StringSchema<undefined>;
530
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
531
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
532
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
533
+ }, undefined>, v.ObjectSchema<{
534
+ readonly name: v.StringSchema<undefined>;
535
+ readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
536
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
537
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
538
+ }, undefined>], undefined>, undefined>;
539
+ }, undefined>, v.ObjectSchema<{
540
+ readonly id: v.StringSchema<undefined>;
541
+ readonly type: v.LiteralSchema<"date", undefined>;
542
+ readonly date: v.NullableSchema<v.ObjectSchema<{
543
+ readonly start: v.StringSchema<undefined>;
544
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
545
+ readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
546
+ }, undefined>, undefined>;
547
+ }, undefined>, v.ObjectSchema<{
548
+ readonly id: v.StringSchema<undefined>;
549
+ readonly type: v.LiteralSchema<"people", undefined>;
550
+ readonly people: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
551
+ readonly object: v.OptionalSchema<v.LiteralSchema<"user", undefined>, undefined>;
552
+ readonly id: v.StringSchema<undefined>;
553
+ }, undefined>, v.ObjectSchema<{
554
+ readonly object: v.LiteralSchema<"group", undefined>;
555
+ readonly id: v.StringSchema<undefined>;
556
+ readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
557
+ }, undefined>], undefined>, undefined>;
558
+ }, undefined>, v.ObjectSchema<{
559
+ readonly id: v.StringSchema<undefined>;
560
+ readonly type: v.LiteralSchema<"relation", undefined>;
561
+ readonly has_more: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
562
+ readonly relation: v.ArraySchema<v.ObjectSchema<{
563
+ readonly id: v.StringSchema<undefined>;
564
+ }, undefined>, undefined>;
565
+ }, undefined>, v.ObjectSchema<{
566
+ readonly id: v.StringSchema<undefined>;
567
+ readonly type: v.LiteralSchema<"files", undefined>;
568
+ readonly files: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
569
+ readonly type: v.LiteralSchema<"external", undefined>;
570
+ readonly name: v.StringSchema<undefined>;
571
+ readonly external: v.ObjectSchema<{
572
+ readonly url: v.StringSchema<undefined>;
573
+ }, undefined>;
574
+ }, undefined>, v.ObjectSchema<{
575
+ readonly type: v.LiteralSchema<"file", undefined>;
576
+ readonly name: v.StringSchema<undefined>;
577
+ readonly file: v.ObjectSchema<{
578
+ readonly url: v.StringSchema<undefined>;
579
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
580
+ }, undefined>;
581
+ }, undefined>], undefined>, undefined>;
582
+ }, undefined>, v.ObjectSchema<{
583
+ readonly id: v.StringSchema<undefined>;
584
+ readonly type: v.LiteralSchema<"place", undefined>;
585
+ readonly place: v.NullableSchema<v.ObjectSchema<{
586
+ readonly lat: v.NumberSchema<undefined>;
587
+ readonly lon: v.NumberSchema<undefined>;
588
+ readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
589
+ readonly address: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
590
+ readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
591
+ readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
592
+ }, undefined>, undefined>;
593
+ }, undefined>, v.ObjectSchema<{
594
+ readonly id: v.StringSchema<undefined>;
595
+ readonly type: v.LiteralSchema<"created_time", undefined>;
596
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
597
+ }, undefined>, v.ObjectSchema<{
598
+ readonly id: v.StringSchema<undefined>;
599
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
600
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
601
+ }, undefined>, v.ObjectSchema<{
602
+ readonly id: v.StringSchema<undefined>;
603
+ readonly type: v.LiteralSchema<"created_by", undefined>;
604
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
605
+ readonly id: v.StringSchema<undefined>;
606
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
607
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
608
+ }, undefined>, undefined>;
609
+ }, undefined>, v.ObjectSchema<{
610
+ readonly id: v.StringSchema<undefined>;
611
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
612
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
613
+ readonly id: v.StringSchema<undefined>;
614
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
615
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
616
+ }, undefined>, undefined>;
617
+ }, undefined>, v.ObjectSchema<{
618
+ readonly id: v.StringSchema<undefined>;
619
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
620
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
621
+ }, undefined>], undefined>, undefined>, undefined>;
469
622
  export type NotionPagePropertyReadMap = v.InferOutput<typeof notionPagePropertyReadMapSchema>;
470
- export type NotionPagePropertyWriteMap = Record<string, Exclude<NotionPagePropertyValue, {
471
- type: "created_time" | "last_edited_time" | "created_by" | "last_edited_by" | "last_visited_time";
472
- }>>;
623
+ export type NotionPagePropertyWriteMap = v.InferInput<typeof notionPagePropertyWriteMapSchema>;
473
624
  /**
474
625
  * The `Page` object returned in `createPageResult` messages.
475
626
  */
476
- export declare const notionPageSchema: v.ObjectSchema<{
627
+ export declare const notionPageDataSchema: v.ObjectSchema<{
628
+ readonly object: v.LiteralSchema<"page", undefined>;
629
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
630
+ readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
631
+ readonly type: v.LiteralSchema<"page_id", undefined>;
632
+ readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
633
+ }, undefined>, v.ObjectSchema<{
634
+ readonly type: v.LiteralSchema<"data_source_id", undefined>;
635
+ readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
636
+ }, undefined>, v.ObjectSchema<{
637
+ readonly type: v.LiteralSchema<"workspace", undefined>;
638
+ readonly workspace: v.LiteralSchema<true, undefined>;
639
+ }, undefined>, v.ObjectSchema<{
640
+ readonly type: v.LiteralSchema<"block_id", undefined>;
641
+ readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
642
+ }, undefined>, v.ObjectSchema<{
643
+ readonly type: v.LiteralSchema<"agent_id", undefined>;
644
+ readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
645
+ }, undefined>, v.ObjectSchema<{
646
+ readonly type: v.LiteralSchema<"unavailable", undefined>;
647
+ }, undefined>], undefined>;
648
+ readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
649
+ readonly id: v.StringSchema<undefined>;
650
+ readonly type: v.LiteralSchema<"title", undefined>;
651
+ readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
652
+ }, undefined>, v.ObjectSchema<{
653
+ readonly id: v.StringSchema<undefined>;
654
+ readonly type: v.LiteralSchema<"rich_text", undefined>;
655
+ readonly rich_text: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
656
+ }, undefined>, v.ObjectSchema<{
657
+ readonly id: v.StringSchema<undefined>;
658
+ readonly type: v.LiteralSchema<"number", undefined>;
659
+ readonly number: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
660
+ }, undefined>, v.ObjectSchema<{
661
+ readonly id: v.StringSchema<undefined>;
662
+ readonly type: v.LiteralSchema<"url", undefined>;
663
+ readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
664
+ }, undefined>, v.ObjectSchema<{
665
+ readonly id: v.StringSchema<undefined>;
666
+ readonly type: v.LiteralSchema<"email", undefined>;
667
+ readonly email: v.NullableSchema<v.StringSchema<undefined>, undefined>;
668
+ }, undefined>, v.ObjectSchema<{
669
+ readonly id: v.StringSchema<undefined>;
670
+ readonly type: v.LiteralSchema<"phone_number", undefined>;
671
+ readonly phone_number: v.NullableSchema<v.StringSchema<undefined>, undefined>;
672
+ }, undefined>, v.ObjectSchema<{
673
+ readonly id: v.StringSchema<undefined>;
674
+ readonly type: v.LiteralSchema<"checkbox", undefined>;
675
+ readonly checkbox: v.BooleanSchema<undefined>;
676
+ }, undefined>, v.ObjectSchema<{
677
+ readonly id: v.StringSchema<undefined>;
678
+ readonly type: v.LiteralSchema<"select", undefined>;
679
+ readonly select: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
680
+ readonly id: v.StringSchema<undefined>;
681
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
682
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
683
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
684
+ }, undefined>, v.ObjectSchema<{
685
+ readonly name: v.StringSchema<undefined>;
686
+ readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
687
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
688
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
689
+ }, undefined>], undefined>, undefined>;
690
+ }, undefined>, v.ObjectSchema<{
691
+ readonly id: v.StringSchema<undefined>;
692
+ readonly type: v.LiteralSchema<"status", undefined>;
693
+ readonly status: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
694
+ readonly id: v.StringSchema<undefined>;
695
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
696
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
697
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
698
+ }, undefined>, v.ObjectSchema<{
699
+ readonly name: v.StringSchema<undefined>;
700
+ readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
701
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
702
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
703
+ }, undefined>], undefined>, undefined>;
704
+ }, undefined>, v.ObjectSchema<{
705
+ readonly id: v.StringSchema<undefined>;
706
+ readonly type: v.LiteralSchema<"multi_select", undefined>;
707
+ readonly multi_select: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
708
+ readonly id: v.StringSchema<undefined>;
709
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
710
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
711
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
712
+ }, undefined>, v.ObjectSchema<{
713
+ readonly name: v.StringSchema<undefined>;
714
+ readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
715
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
716
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
717
+ }, undefined>], undefined>, undefined>;
718
+ }, undefined>, v.ObjectSchema<{
719
+ readonly id: v.StringSchema<undefined>;
720
+ readonly type: v.LiteralSchema<"date", undefined>;
721
+ readonly date: v.NullableSchema<v.ObjectSchema<{
722
+ readonly start: v.StringSchema<undefined>;
723
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
724
+ readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
725
+ }, undefined>, undefined>;
726
+ }, undefined>, v.ObjectSchema<{
727
+ readonly id: v.StringSchema<undefined>;
728
+ readonly type: v.LiteralSchema<"people", undefined>;
729
+ readonly people: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
730
+ readonly object: v.OptionalSchema<v.LiteralSchema<"user", undefined>, undefined>;
731
+ readonly id: v.StringSchema<undefined>;
732
+ }, undefined>, v.ObjectSchema<{
733
+ readonly object: v.LiteralSchema<"group", undefined>;
734
+ readonly id: v.StringSchema<undefined>;
735
+ readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
736
+ }, undefined>], undefined>, undefined>;
737
+ }, undefined>, v.ObjectSchema<{
738
+ readonly id: v.StringSchema<undefined>;
739
+ readonly type: v.LiteralSchema<"relation", undefined>;
740
+ readonly has_more: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
741
+ readonly relation: v.ArraySchema<v.ObjectSchema<{
742
+ readonly id: v.StringSchema<undefined>;
743
+ }, undefined>, undefined>;
744
+ }, undefined>, v.ObjectSchema<{
745
+ readonly id: v.StringSchema<undefined>;
746
+ readonly type: v.LiteralSchema<"files", undefined>;
747
+ readonly files: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
748
+ readonly type: v.LiteralSchema<"external", undefined>;
749
+ readonly name: v.StringSchema<undefined>;
750
+ readonly external: v.ObjectSchema<{
751
+ readonly url: v.StringSchema<undefined>;
752
+ }, undefined>;
753
+ }, undefined>, v.ObjectSchema<{
754
+ readonly type: v.LiteralSchema<"file", undefined>;
755
+ readonly name: v.StringSchema<undefined>;
756
+ readonly file: v.ObjectSchema<{
757
+ readonly url: v.StringSchema<undefined>;
758
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
759
+ }, undefined>;
760
+ }, undefined>], undefined>, undefined>;
761
+ }, undefined>, v.ObjectSchema<{
762
+ readonly id: v.StringSchema<undefined>;
763
+ readonly type: v.LiteralSchema<"place", undefined>;
764
+ readonly place: v.NullableSchema<v.ObjectSchema<{
765
+ readonly lat: v.NumberSchema<undefined>;
766
+ readonly lon: v.NumberSchema<undefined>;
767
+ readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
768
+ readonly address: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
769
+ readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
770
+ readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
771
+ }, undefined>, undefined>;
772
+ }, undefined>, v.ObjectSchema<{
773
+ readonly id: v.StringSchema<undefined>;
774
+ readonly type: v.LiteralSchema<"created_time", undefined>;
775
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
776
+ }, undefined>, v.ObjectSchema<{
777
+ readonly id: v.StringSchema<undefined>;
778
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
779
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
780
+ }, undefined>, v.ObjectSchema<{
781
+ readonly id: v.StringSchema<undefined>;
782
+ readonly type: v.LiteralSchema<"created_by", undefined>;
783
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
784
+ readonly id: v.StringSchema<undefined>;
785
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
786
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
787
+ }, undefined>, undefined>;
788
+ }, undefined>, v.ObjectSchema<{
789
+ readonly id: v.StringSchema<undefined>;
790
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
791
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
792
+ readonly id: v.StringSchema<undefined>;
793
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
794
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
795
+ }, undefined>, undefined>;
796
+ }, undefined>, v.ObjectSchema<{
797
+ readonly id: v.StringSchema<undefined>;
798
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
799
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
800
+ }, undefined>], undefined>, undefined>, undefined>;
801
+ readonly created_by: v.OptionalSchema<v.NullableSchema<v.ObjectSchema<{
802
+ readonly id: v.StringSchema<undefined>;
803
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
804
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
805
+ }, undefined>, undefined>, null>;
806
+ readonly last_edited_by: v.OptionalSchema<v.NullableSchema<v.ObjectSchema<{
807
+ readonly id: v.StringSchema<undefined>;
808
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
809
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
810
+ }, undefined>, undefined>, null>;
811
+ readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
812
+ readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
813
+ readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
814
+ readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
815
+ readonly type: v.LiteralSchema<"emoji", undefined>;
816
+ readonly emoji: v.StringSchema<undefined>;
817
+ }, undefined>, v.ObjectSchema<{
818
+ readonly type: v.LiteralSchema<"custom_emoji", undefined>;
819
+ readonly custom_emoji: v.ObjectSchema<{
820
+ readonly id: v.StringSchema<undefined>;
821
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
822
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
823
+ }, undefined>;
824
+ }, undefined>, v.ObjectSchema<{
825
+ readonly type: v.LiteralSchema<"external", undefined>;
826
+ readonly external: v.ObjectSchema<{
827
+ readonly url: v.StringSchema<undefined>;
828
+ }, undefined>;
829
+ }, undefined>, v.ObjectSchema<{
830
+ readonly type: v.LiteralSchema<"file", undefined>;
831
+ readonly file: v.ObjectSchema<{
832
+ readonly url: v.StringSchema<undefined>;
833
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
834
+ }, undefined>;
835
+ }, undefined>], undefined>, undefined>, null>;
836
+ readonly cover: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
837
+ readonly type: v.LiteralSchema<"external", undefined>;
838
+ readonly external: v.ObjectSchema<{
839
+ readonly url: v.StringSchema<undefined>;
840
+ }, undefined>;
841
+ }, undefined>, v.ObjectSchema<{
842
+ readonly type: v.LiteralSchema<"file", undefined>;
843
+ readonly file: v.ObjectSchema<{
844
+ readonly url: v.StringSchema<undefined>;
845
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
846
+ }, undefined>;
847
+ }, undefined>], undefined>, undefined>, null>;
848
+ readonly url: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
849
+ readonly public_url: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
850
+ /** Whether the page or an ancestor is archived. */
851
+ readonly is_archived: v.BooleanSchema<undefined>;
852
+ /** Whether the page or an ancestor is in Trash. */
853
+ readonly in_trash: v.BooleanSchema<undefined>;
854
+ }, undefined>;
855
+ export type NotionPageData = v.InferInput<typeof notionPageDataSchema>;
856
+ export declare const legacyNotionPageSchema: v.ObjectSchema<{
477
857
  readonly object: v.LiteralSchema<"page", undefined>;
478
858
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
479
859
  readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
@@ -690,5 +1070,5 @@ export declare const notionPageSchema: v.ObjectSchema<{
690
1070
  /** Whether the page or an ancestor is in Trash. */
691
1071
  readonly in_trash: v.BooleanSchema<undefined>;
692
1072
  }, undefined>;
693
- export type NotionPage = v.InferOutput<typeof notionPageSchema>;
1073
+ export type LegacyNotionPage = v.InferOutput<typeof legacyNotionPageSchema>;
694
1074
  export {};
@@ -118,6 +118,7 @@ const notionPlaceInputSchema = v.object({
118
118
  const pagePropertyBaseSchema = {
119
119
  id: v.string(),
120
120
  };
121
+ // TODO(custom-blocks): Make spaceId required for metadataActor
121
122
  const metadataActorSchema = v.nullable(v.object({
122
123
  ...notionRecordPointerSchema.entries,
123
124
  table: v.picklist(["notion_user", "bot", "organization_bot"]),
@@ -229,15 +230,35 @@ export const notionPagePropertyValueSchema = v.variant("type", [
229
230
  last_visited_time: nullableStringSchema,
230
231
  }),
231
232
  ]);
232
- export const notionPagePropertyReadMapSchema = v.record(v.string(), notionPagePropertyValueSchema);
233
+ export const notionPagePropertyWriteMapSchema = v.record(v.string(), notionPagePropertyValueSchema);
234
+ export const notionPagePropertyReadMapSchema = v.record(v.string(), v.nullable(notionPagePropertyValueSchema));
233
235
  /**
234
236
  * The `Page` object returned in `createPageResult` messages.
235
237
  */
236
- export const notionPageSchema = v.object({
238
+ export const notionPageDataSchema = v.object({
237
239
  object: v.literal("page"),
238
240
  id: notionPageIdSchema,
239
241
  parent: notionParentSchema,
240
242
  properties: notionPagePropertyReadMapSchema,
243
+ created_by: v.optional(metadataActorSchema, null),
244
+ last_edited_by: v.optional(metadataActorSchema, null),
245
+ last_visited_time: v.optional(v.nullable(v.string()), null),
246
+ created_time: v.optional(v.nullable(v.string()), null),
247
+ last_edited_time: v.optional(v.nullable(v.string()), null),
248
+ icon: v.optional(v.nullable(notionPageIconSchema), null),
249
+ cover: v.optional(v.nullable(notionPageCoverSchema), null),
250
+ url: v.optional(v.nullable(v.string()), null),
251
+ public_url: v.optional(v.nullable(v.string()), null),
252
+ /** Whether the page or an ancestor is archived. */
253
+ is_archived: v.boolean(),
254
+ /** Whether the page or an ancestor is in Trash. */
255
+ in_trash: v.boolean(),
256
+ });
257
+ export const legacyNotionPageSchema = v.object({
258
+ object: v.literal("page"),
259
+ id: notionPageIdSchema,
260
+ parent: notionParentSchema,
261
+ properties: notionPagePropertyWriteMapSchema,
241
262
  created_time: v.optional(v.string()),
242
263
  last_edited_time: v.optional(v.string()),
243
264
  icon: v.optional(notionPageIconSchema),
@@ -4,6 +4,6 @@
4
4
  * older versions, so this value does not set the minimum or maximum they accept.
5
5
  */
6
6
  export const LATEST_BRIDGE_PROTOCOL_VERSION = 6;
7
- // Protocol 6 introduces name-keyed property objects for data source queries.
7
+ // Protocol 6 introduces unified pages with name-keyed property objects.
8
8
  // Keep this cutoff fixed when the latest protocol version increases.
9
9
  export const LEGACY_PROPERTY_SHAPE_PROTOCOL_VERSION = 6;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks-host",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Reusable host runtime for Notion custom blocks.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -1,7 +1,4 @@
1
- export type {
2
- LegacyNotionDataSourcePageBridge,
3
- NotionDataSourcePageBridge,
4
- } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
1
+ export type { LegacyNotionDataSourcePageBridge } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
5
2
  export type { NotionPropertySchemasById } from "@notionhq/custom-blocks-protocol/dataSources/propertySchema.js"
6
3
  export type { CustomBlockErrorInfo } from "@notionhq/custom-blocks-protocol/errors.js"
7
4
  export type { NotionPageId } from "@notionhq/custom-blocks-protocol/ids.js"
@@ -37,6 +34,7 @@ export type {
37
34
  NotionDateInput,
38
35
  NotionFileInput,
39
36
  NotionPageCover,
37
+ NotionPageData,
40
38
  NotionPageIcon,
41
39
  NotionPagePropertyReadMap,
42
40
  NotionPagePropertyValue,