@notionhq/custom-blocks-host 0.6.0 → 0.8.0

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 (57) hide show
  1. package/dist/browser.js +1 -1
  2. package/dist/compatibility/normalizeSandboxToHostMessage.d.ts +16 -16
  3. package/dist/compatibility/pages/toPageWithNullTextFallbackProperties.d.ts.map +1 -1
  4. package/dist/compatibility/pages/toPageWithNullTextFallbackProperties.js +0 -1
  5. package/dist/compatibility/protocol3To4/addMetadataReadSchemasForProtocol3To4.d.ts +17 -36
  6. package/dist/compatibility/protocol3To4/addMetadataReadSchemasForProtocol3To4.d.ts.map +1 -1
  7. package/dist/compatibility/protocol3To5/toPropertyValueForProtocol3To5.d.ts.map +1 -1
  8. package/dist/compatibility/protocol3To5/toPropertyValueForProtocol3To5.js +0 -2
  9. package/dist/context/initialState.d.ts +45 -44
  10. package/dist/context/initialState.d.ts.map +1 -1
  11. package/dist/manifest/types.d.ts +15 -4
  12. package/dist/manifest/types.d.ts.map +1 -1
  13. package/dist/protocol/compatibility/protocol3To5/bridgePage.d.ts +0 -4
  14. package/dist/protocol/dataSources/bridgeArchiveStatus.d.ts +3 -0
  15. package/dist/protocol/dataSources/bridgeArchiveStatus.js +6 -0
  16. package/dist/protocol/dataSources/bridgeDataSourceBinding.d.ts +0 -4
  17. package/dist/protocol/dataSources/bridgeDataSourceBindings.d.ts +0 -4
  18. package/dist/protocol/dataSources/collectionSchema.d.ts +0 -4
  19. package/dist/protocol/dataSources/messages/dataSourcesChanged.d.ts +0 -4
  20. package/dist/protocol/dataSources/messages/queryDataSource.d.ts +3 -12
  21. package/dist/protocol/dataSources/messages/queryDataSource.js +2 -0
  22. package/dist/protocol/dataSources/notionDataSource.d.ts +0 -8
  23. package/dist/protocol/dataSources/properties/propertySchema.d.ts +3 -7
  24. package/dist/protocol/dataSources/properties/propertySchema.js +1 -3
  25. package/dist/protocol/handshake/connect.d.ts +15 -4
  26. package/dist/protocol/handshake/init.d.ts +15 -8
  27. package/dist/protocol/index.d.ts +8 -6
  28. package/dist/protocol/index.js +4 -3
  29. package/dist/protocol/manifest/grants.d.ts +48 -0
  30. package/dist/protocol/manifest/grants.js +19 -0
  31. package/dist/protocol/manifest/manifest.d.ts +33 -10
  32. package/dist/protocol/manifest/manifest.js +11 -5
  33. package/dist/protocol/messages/hostToSandbox.d.ts +30 -76
  34. package/dist/protocol/messages/sandboxToHost.d.ts +16 -16
  35. package/dist/protocol/pages/bridgePage.d.ts +0 -5
  36. package/dist/protocol/pages/bridgePage.js +0 -1
  37. package/dist/protocol/pages/messages/createPage.d.ts +2 -24
  38. package/dist/protocol/pages/messages/getPage.d.ts +2 -16
  39. package/dist/protocol/pages/messages/openPage.d.ts +2 -2
  40. package/dist/protocol/pages/messages/updatePage.d.ts +2 -20
  41. package/dist/protocol/pages/properties/bridgePagePropertyMaps.d.ts +0 -8
  42. package/dist/protocol/pages/properties/bridgePagePropertyValue.d.ts +0 -4
  43. package/dist/protocol/pages/properties/bridgePagePropertyValue.js +0 -5
  44. package/dist/protocol/users/messages/getUser.d.ts +2 -2
  45. package/dist/protocol/users/messages/listUsers.d.ts +2 -2
  46. package/dist/protocol/utils/errors.d.ts +4 -4
  47. package/dist/protocol/utils/errors.js +3 -3
  48. package/dist/protocol/utils/protocolVersion.d.ts +1 -1
  49. package/dist/protocol/utils/protocolVersion.js +1 -1
  50. package/docs/bridge/changelog.md +11 -3
  51. package/docs/bridge/protocol.md +14 -7
  52. package/docs/compatibility.md +1 -1
  53. package/package.json +1 -1
  54. package/src/compatibility/pages/toPageWithNullTextFallbackProperties.ts +0 -1
  55. package/src/compatibility/protocol3To5/toPropertyValueForProtocol3To5.ts +0 -2
  56. package/dist/protocol/manifest/capabilities.d.ts +0 -37
  57. package/dist/protocol/manifest/capabilities.js +0 -13
@@ -1,7 +1,7 @@
1
1
  import * as v from "valibot";
2
- import type { CustomBlockCapabilityErrorCode, CustomBlockErrorCode, CustomBlockErrorInfo, CustomBlockRequestErrorCode } from "../../utils/errors.js";
2
+ import type { CustomBlockErrorCode, CustomBlockErrorInfo, CustomBlockGrantErrorCode, CustomBlockRequestErrorCode } from "../../utils/errors.js";
3
3
  export declare const customBlockCreatePageErrorCodeSchema: v.StringSchema<undefined>;
4
- export type CustomBlockCreatePageErrorCode = CustomBlockErrorCode<CustomBlockRequestErrorCode | "create_page_failed" | "invalid_icon_name" | "invalid_icon_color" | "invalid_page_parent" | "page_unavailable" | "data_source_access_failed" | "unknown_data_source_key" | "unmapped_data_source" | "data_source_inaccessible" | "unmapped_property" | "property_id_mismatch" | "duplicate_property" | "invalid_property_value" | CustomBlockCapabilityErrorCode>;
4
+ export type CustomBlockCreatePageErrorCode = CustomBlockErrorCode<CustomBlockRequestErrorCode | "create_page_failed" | "invalid_icon_name" | "invalid_icon_color" | "invalid_page_parent" | "page_unavailable" | "data_source_access_failed" | "unknown_data_source_key" | "unmapped_data_source" | "data_source_inaccessible" | "unmapped_property" | "property_id_mismatch" | "duplicate_property" | "invalid_property_value" | CustomBlockGrantErrorCode>;
5
5
  export type CustomBlockCreatePageErrorInfo = CustomBlockErrorInfo<CustomBlockCreatePageErrorCode>;
6
6
  export declare const customBlockCreatePageErrorInfoSchema: v.ObjectSchema<{
7
7
  readonly code: v.StringSchema<undefined>;
@@ -223,10 +223,6 @@ export declare const createPageResultMessageSchema: v.VariantSchema<"status", [v
223
223
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
224
224
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
225
225
  }, undefined>, undefined>;
226
- }, undefined>, v.ObjectSchema<{
227
- readonly id: v.StringSchema<undefined>;
228
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
229
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
230
226
  }, undefined>, v.ObjectSchema<{
231
227
  readonly id: v.StringSchema<undefined>;
232
228
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -262,7 +258,6 @@ export declare const createPageResultMessageSchema: v.VariantSchema<"status", [v
262
258
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
263
259
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
264
260
  }, undefined>, undefined>, null>;
265
- readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
266
261
  readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
267
262
  readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
268
263
  readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
@@ -532,10 +527,6 @@ export declare const createPageResultMessageWithProtocol3To5CompatibilitySchema:
532
527
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
533
528
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
534
529
  }, undefined>, undefined>;
535
- }, undefined>, v.ObjectSchema<{
536
- readonly id: v.StringSchema<undefined>;
537
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
538
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
539
530
  }, undefined>, v.ObjectSchema<{
540
531
  readonly id: v.StringSchema<undefined>;
541
532
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -571,7 +562,6 @@ export declare const createPageResultMessageWithProtocol3To5CompatibilitySchema:
571
562
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
572
563
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
573
564
  }, undefined>, undefined>, null>;
574
- readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
575
565
  readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
576
566
  readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
577
567
  readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
@@ -825,10 +815,6 @@ export declare const createPageResultMessageWithProtocol3To5CompatibilitySchema:
825
815
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
826
816
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
827
817
  }, undefined>, undefined>;
828
- }, undefined>, v.ObjectSchema<{
829
- readonly id: v.StringSchema<undefined>;
830
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
831
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
832
818
  }, undefined>, v.ObjectSchema<{
833
819
  readonly id: v.StringSchema<undefined>;
834
820
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -1139,10 +1125,6 @@ export declare const createPageMessageSchema: v.VariantSchema<"type", [v.ObjectS
1139
1125
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
1140
1126
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1141
1127
  }, undefined>, undefined>;
1142
- }, undefined>, v.ObjectSchema<{
1143
- readonly id: v.StringSchema<undefined>;
1144
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
1145
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1146
1128
  }, undefined>, v.ObjectSchema<{
1147
1129
  readonly id: v.StringSchema<undefined>;
1148
1130
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -1412,10 +1394,6 @@ export declare const createPageMessageSchema: v.VariantSchema<"type", [v.ObjectS
1412
1394
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
1413
1395
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1414
1396
  }, undefined>, undefined>;
1415
- }, undefined>, v.ObjectSchema<{
1416
- readonly id: v.StringSchema<undefined>;
1417
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
1418
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1419
1397
  }, undefined>, v.ObjectSchema<{
1420
1398
  readonly id: v.StringSchema<undefined>;
1421
1399
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -1,7 +1,7 @@
1
1
  import * as v from "valibot";
2
- import type { CustomBlockCapabilityErrorCode, CustomBlockErrorCode, CustomBlockErrorInfo, CustomBlockRequestErrorCode } from "../../utils/errors.js";
2
+ import type { CustomBlockErrorCode, CustomBlockErrorInfo, CustomBlockGrantErrorCode, CustomBlockRequestErrorCode } from "../../utils/errors.js";
3
3
  export declare const customBlockGetPageErrorCodeSchema: v.StringSchema<undefined>;
4
- export type CustomBlockGetPageErrorCode = CustomBlockErrorCode<CustomBlockRequestErrorCode | "get_page_failed" | "page_unavailable" | CustomBlockCapabilityErrorCode>;
4
+ export type CustomBlockGetPageErrorCode = CustomBlockErrorCode<CustomBlockRequestErrorCode | "get_page_failed" | "page_unavailable" | CustomBlockGrantErrorCode>;
5
5
  export type CustomBlockGetPageErrorInfo = CustomBlockErrorInfo<CustomBlockGetPageErrorCode>;
6
6
  export declare const customBlockGetPageErrorInfoSchema: v.ObjectSchema<{
7
7
  readonly code: v.StringSchema<undefined>;
@@ -229,10 +229,6 @@ export declare const getPageResultMessageSchema: v.VariantSchema<"status", [v.Ob
229
229
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
230
230
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
231
231
  }, undefined>, undefined>;
232
- }, undefined>, v.ObjectSchema<{
233
- readonly id: v.StringSchema<undefined>;
234
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
235
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
236
232
  }, undefined>, v.ObjectSchema<{
237
233
  readonly id: v.StringSchema<undefined>;
238
234
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -268,7 +264,6 @@ export declare const getPageResultMessageSchema: v.VariantSchema<"status", [v.Ob
268
264
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
269
265
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
270
266
  }, undefined>, undefined>, null>;
271
- readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
272
267
  readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
273
268
  readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
274
269
  readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
@@ -537,10 +532,6 @@ export declare const getPageResultMessageWithProtocol3To5CompatibilitySchema: v.
537
532
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
538
533
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
539
534
  }, undefined>, undefined>;
540
- }, undefined>, v.ObjectSchema<{
541
- readonly id: v.StringSchema<undefined>;
542
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
543
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
544
535
  }, undefined>, v.ObjectSchema<{
545
536
  readonly id: v.StringSchema<undefined>;
546
537
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -576,7 +567,6 @@ export declare const getPageResultMessageWithProtocol3To5CompatibilitySchema: v.
576
567
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
577
568
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
578
569
  }, undefined>, undefined>, null>;
579
- readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
580
570
  readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
581
571
  readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
582
572
  readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
@@ -830,10 +820,6 @@ export declare const getPageResultMessageWithProtocol3To5CompatibilitySchema: v.
830
820
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
831
821
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
832
822
  }, undefined>, undefined>;
833
- }, undefined>, v.ObjectSchema<{
834
- readonly id: v.StringSchema<undefined>;
835
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
836
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
837
823
  }, undefined>, v.ObjectSchema<{
838
824
  readonly id: v.StringSchema<undefined>;
839
825
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -1,9 +1,9 @@
1
1
  import * as v from "valibot";
2
- import type { CustomBlockCapabilityErrorCode, CustomBlockErrorCode, CustomBlockErrorInfo, CustomBlockRequestErrorCode } from "../../utils/errors.js";
2
+ import type { CustomBlockErrorCode, CustomBlockErrorInfo, CustomBlockGrantErrorCode, CustomBlockRequestErrorCode } from "../../utils/errors.js";
3
3
  export declare const openPageModeSchema: v.PicklistSchema<["side_peek", "center_peek"], undefined>;
4
4
  export type OpenPageMode = v.InferOutput<typeof openPageModeSchema>;
5
5
  export declare const customBlockOpenPageErrorCodeSchema: v.StringSchema<undefined>;
6
- export type CustomBlockOpenPageErrorCode = CustomBlockErrorCode<CustomBlockRequestErrorCode | "open_page_failed" | "page_unavailable" | "navigation_unavailable" | CustomBlockCapabilityErrorCode>;
6
+ export type CustomBlockOpenPageErrorCode = CustomBlockErrorCode<CustomBlockRequestErrorCode | "open_page_failed" | "page_unavailable" | "navigation_unavailable" | CustomBlockGrantErrorCode>;
7
7
  export type CustomBlockOpenPageErrorInfo = CustomBlockErrorInfo<CustomBlockOpenPageErrorCode>;
8
8
  export declare const customBlockOpenPageErrorInfoSchema: v.ObjectSchema<{
9
9
  readonly code: v.StringSchema<undefined>;
@@ -1,7 +1,7 @@
1
1
  import * as v from "valibot";
2
- import type { CustomBlockCapabilityErrorCode, CustomBlockErrorCode, CustomBlockErrorInfo, CustomBlockRequestErrorCode } from "../../utils/errors.js";
2
+ import type { CustomBlockErrorCode, CustomBlockErrorInfo, CustomBlockGrantErrorCode, CustomBlockRequestErrorCode } from "../../utils/errors.js";
3
3
  export declare const customBlockUpdatePageErrorCodeSchema: v.StringSchema<undefined>;
4
- export type CustomBlockUpdatePageErrorCode = CustomBlockErrorCode<CustomBlockRequestErrorCode | "update_page_failed" | "previous_write_incomplete" | "invalid_page_update" | "invalid_icon_name" | "invalid_icon_color" | "page_unavailable" | "data_source_access_failed" | "unmapped_property" | "property_id_mismatch" | "duplicate_property" | "invalid_property_value" | CustomBlockCapabilityErrorCode>;
4
+ export type CustomBlockUpdatePageErrorCode = CustomBlockErrorCode<CustomBlockRequestErrorCode | "update_page_failed" | "previous_write_incomplete" | "invalid_page_update" | "invalid_icon_name" | "invalid_icon_color" | "page_unavailable" | "data_source_access_failed" | "unmapped_property" | "property_id_mismatch" | "duplicate_property" | "invalid_property_value" | CustomBlockGrantErrorCode>;
5
5
  export type CustomBlockUpdatePageErrorInfo = CustomBlockErrorInfo<CustomBlockUpdatePageErrorCode>;
6
6
  export declare const customBlockUpdatePageErrorInfoSchema: v.ObjectSchema<{
7
7
  readonly code: v.StringSchema<undefined>;
@@ -222,10 +222,6 @@ export declare const updatePageResultMessageSchema: v.VariantSchema<"status", [v
222
222
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
223
223
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
224
224
  }, undefined>, undefined>;
225
- }, undefined>, v.ObjectSchema<{
226
- readonly id: v.StringSchema<undefined>;
227
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
228
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
229
225
  }, undefined>, v.ObjectSchema<{
230
226
  readonly id: v.StringSchema<undefined>;
231
227
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -261,7 +257,6 @@ export declare const updatePageResultMessageSchema: v.VariantSchema<"status", [v
261
257
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
262
258
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
263
259
  }, undefined>, undefined>, null>;
264
- readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
265
260
  readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
266
261
  readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
267
262
  readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
@@ -530,10 +525,6 @@ export declare const updatePageResultMessageWithProtocol3To5CompatibilitySchema:
530
525
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
531
526
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
532
527
  }, undefined>, undefined>;
533
- }, undefined>, v.ObjectSchema<{
534
- readonly id: v.StringSchema<undefined>;
535
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
536
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
537
528
  }, undefined>, v.ObjectSchema<{
538
529
  readonly id: v.StringSchema<undefined>;
539
530
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -569,7 +560,6 @@ export declare const updatePageResultMessageWithProtocol3To5CompatibilitySchema:
569
560
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
570
561
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
571
562
  }, undefined>, undefined>, null>;
572
- readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
573
563
  readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
574
564
  readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
575
565
  readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
@@ -823,10 +813,6 @@ export declare const updatePageResultMessageWithProtocol3To5CompatibilitySchema:
823
813
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
824
814
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
825
815
  }, undefined>, undefined>;
826
- }, undefined>, v.ObjectSchema<{
827
- readonly id: v.StringSchema<undefined>;
828
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
829
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
830
816
  }, undefined>, v.ObjectSchema<{
831
817
  readonly id: v.StringSchema<undefined>;
832
818
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -1112,10 +1098,6 @@ export declare const updatePageMessageSchema: v.ObjectSchema<{
1112
1098
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
1113
1099
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1114
1100
  }, undefined>, undefined>;
1115
- }, undefined>, v.ObjectSchema<{
1116
- readonly id: v.StringSchema<undefined>;
1117
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
1118
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1119
1101
  }, undefined>, v.ObjectSchema<{
1120
1102
  readonly id: v.StringSchema<undefined>;
1121
1103
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -185,10 +185,6 @@ export declare const bridgePagePropertyWriteMapSchema: v.RecordSchema<v.StringSc
185
185
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
186
186
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
187
187
  }, undefined>, undefined>;
188
- }, undefined>, v.ObjectSchema<{
189
- readonly id: v.StringSchema<undefined>;
190
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
191
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
192
188
  }, undefined>, v.ObjectSchema<{
193
189
  readonly id: v.StringSchema<undefined>;
194
190
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -400,10 +396,6 @@ export declare const bridgePagePropertyReadMapSchema: v.RecordSchema<v.StringSch
400
396
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
401
397
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
402
398
  }, undefined>, undefined>;
403
- }, undefined>, v.ObjectSchema<{
404
- readonly id: v.StringSchema<undefined>;
405
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
406
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
407
399
  }, undefined>, v.ObjectSchema<{
408
400
  readonly id: v.StringSchema<undefined>;
409
401
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -185,10 +185,6 @@ export declare const bridgePagePropertyValueSchema: v.VariantSchema<"type", [v.O
185
185
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
186
186
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
187
187
  }, undefined>, undefined>;
188
- }, undefined>, v.ObjectSchema<{
189
- readonly id: v.StringSchema<undefined>;
190
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
191
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
192
188
  }, undefined>, v.ObjectSchema<{
193
189
  readonly id: v.StringSchema<undefined>;
194
190
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -106,11 +106,6 @@ export const bridgePagePropertyValueSchema = v.variant("type", [
106
106
  type: v.literal("last_edited_by"),
107
107
  last_edited_by: metadataActorSchema,
108
108
  }),
109
- v.object({
110
- ...pagePropertyBaseSchema,
111
- type: v.literal("last_visited_time"),
112
- last_visited_time: nullableStringSchema,
113
- }),
114
109
  v.object({
115
110
  ...pagePropertyBaseSchema,
116
111
  type: v.literal("unique_id"),
@@ -1,7 +1,7 @@
1
1
  import * as v from "valibot";
2
- import type { CustomBlockCapabilityErrorCode, CustomBlockErrorCode, CustomBlockErrorInfo, CustomBlockRequestErrorCode } from "../../utils/errors.js";
2
+ import type { CustomBlockErrorCode, CustomBlockErrorInfo, CustomBlockGrantErrorCode, CustomBlockRequestErrorCode } from "../../utils/errors.js";
3
3
  export declare const customBlockGetUserErrorCodeSchema: v.StringSchema<undefined>;
4
- export type CustomBlockGetUserErrorCode = CustomBlockErrorCode<CustomBlockRequestErrorCode | "get_user_failed" | CustomBlockCapabilityErrorCode>;
4
+ export type CustomBlockGetUserErrorCode = CustomBlockErrorCode<CustomBlockRequestErrorCode | "get_user_failed" | CustomBlockGrantErrorCode>;
5
5
  export type CustomBlockGetUserErrorInfo = CustomBlockErrorInfo<CustomBlockGetUserErrorCode>;
6
6
  export declare const customBlockGetUserErrorInfoSchema: v.ObjectSchema<{
7
7
  readonly code: v.StringSchema<undefined>;
@@ -1,7 +1,7 @@
1
1
  import * as v from "valibot";
2
- import type { CustomBlockCapabilityErrorCode, CustomBlockErrorCode, CustomBlockErrorInfo, CustomBlockRequestErrorCode } from "../../utils/errors.js";
2
+ import type { CustomBlockErrorCode, CustomBlockErrorInfo, CustomBlockGrantErrorCode, CustomBlockRequestErrorCode } from "../../utils/errors.js";
3
3
  export declare const customBlockListUsersErrorCodeSchema: v.StringSchema<undefined>;
4
- export type CustomBlockListUsersErrorCode = CustomBlockErrorCode<CustomBlockRequestErrorCode | "list_users_failed" | CustomBlockCapabilityErrorCode>;
4
+ export type CustomBlockListUsersErrorCode = CustomBlockErrorCode<CustomBlockRequestErrorCode | "list_users_failed" | CustomBlockGrantErrorCode>;
5
5
  export type CustomBlockListUsersErrorInfo = CustomBlockErrorInfo<CustomBlockListUsersErrorCode>;
6
6
  export declare const customBlockListUsersErrorInfoSchema: v.ObjectSchema<{
7
7
  readonly code: v.StringSchema<undefined>;
@@ -1,11 +1,11 @@
1
1
  import * as v from "valibot";
2
2
  export type CustomBlockErrorCode<KnownCode extends string> = KnownCode | "unknown_error" | (string & {});
3
3
  /**
4
- * Reserved for a request that needs a capability the block did not declare or
5
- * the viewer did not grant. No host sends it yet.
4
+ * Reserved for a request that needs a grant the block did not declare or the
5
+ * viewer did not approve. No host sends it yet.
6
6
  */
7
- export declare const CAPABILITY_NOT_GRANTED_ERROR_CODE = "capability_not_granted";
8
- export type CustomBlockCapabilityErrorCode = typeof CAPABILITY_NOT_GRANTED_ERROR_CODE;
7
+ export declare const NOT_GRANTED_ERROR_CODE = "not_granted";
8
+ export type CustomBlockGrantErrorCode = typeof NOT_GRANTED_ERROR_CODE;
9
9
  export type CustomBlockErrorInfo<TCode extends string = string> = {
10
10
  code: TCode;
11
11
  message: string;
@@ -1,9 +1,9 @@
1
1
  import * as v from "valibot";
2
2
  /**
3
- * Reserved for a request that needs a capability the block did not declare or
4
- * the viewer did not grant. No host sends it yet.
3
+ * Reserved for a request that needs a grant the block did not declare or the
4
+ * viewer did not approve. No host sends it yet.
5
5
  */
6
- export const CAPABILITY_NOT_GRANTED_ERROR_CODE = "capability_not_granted";
6
+ export const NOT_GRANTED_ERROR_CODE = "not_granted";
7
7
  export const customBlockErrorInfoSchema = v.object({
8
8
  code: v.string(),
9
9
  message: v.string(),
@@ -3,7 +3,7 @@
3
3
  * Increase this value for breaking wire changes. Hosts can continue to accept
4
4
  * older versions, so this value does not set the minimum or maximum they accept.
5
5
  */
6
- export declare const LATEST_BRIDGE_PROTOCOL_VERSION = 9;
6
+ export declare const LATEST_BRIDGE_PROTOCOL_VERSION = 10;
7
7
  export declare const UNIFIED_PAGE_PROTOCOL_VERSION = 6;
8
8
  export declare const TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION = 7;
9
9
  export declare const NATIVE_ICON_PROTOCOL_VERSION = 9;
@@ -3,7 +3,7 @@
3
3
  * Increase this value for breaking wire changes. Hosts can continue to accept
4
4
  * older versions, so this value does not set the minimum or maximum they accept.
5
5
  */
6
- export const LATEST_BRIDGE_PROTOCOL_VERSION = 9;
6
+ export const LATEST_BRIDGE_PROTOCOL_VERSION = 10;
7
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 UNIFIED_PAGE_PROTOCOL_VERSION = 6;
@@ -19,12 +19,21 @@ versions refer to `@notionhq/custom-blocks`.
19
19
  | 5 [†](#protocol-5-unavailable-containing-page-context) | `0.2.16` | September 30, 2026 | Query filters and sorts must address actual database properties. Filter and sort payloads reject extra fields |
20
20
  | 6 [‡](#protocol-6-richer-fallback-properties) | `0.3.0` | October 26, 2026 | Typed, display-name-keyed query properties and unified page responses replace the older query representation |
21
21
  | 7 | `0.3.3` | October 30, 2026 | Typed text fallback properties for unique ID, button, formula, location, rollup, and verification |
22
- | 8 | `0.4.0` | November 2, 2026 | Local manifests move from `/manifest` to HTML metadata sent in `connect`; `manifestSource` selects the initialization manifest |
22
+ | 8 | `0.3.4` | November 3, 2026 | Local manifests move from `/manifest` to HTML metadata sent in `connect`; `manifestSource` selects the initialization manifest |
23
23
  | 9 | Unreleased | — | Native page icons; older protocols receive external SVG URLs |
24
+ | 10 | `0.4.0` | November 10, 2026 | Removes `last_visited_time` from property schemas, page properties, and page metadata |
24
25
 
25
26
  The table lists SDK release boundaries, not complete supported version ranges. Host compatibility
26
27
  depends on `connect.bridgeProtocolVersion`, not the SDK package version.
27
28
 
29
+ ## Protocol 10: remove last visited time
30
+
31
+ `last_visited_time` is viewer-specific recents data, not a database property type. Protocol 10
32
+ removes it from manifests, binding schemas, page property values, and top-level page metadata. Older
33
+ SDKs can still connect, but updated hosts no longer load or return viewer visit data. Older readers
34
+ default the absent page field to `null`. Blocks that use this field must remove that use and
35
+ rebuild.
36
+
28
37
  ## Protocol 9: native page icons
29
38
 
30
39
  Page operations and query results can return `{ type: "icon", icon: { name, color } }`. Reads and
@@ -33,8 +42,7 @@ native icon fields are retained. Hosts resolve names and default omitted colors
33
42
 
34
43
  Protocols 3–8 receive external SVG URLs in page operation results. Protocols 6–8 receive the same
35
44
  fallback in query results; protocols 3–5 keep their flat query format without appearance fields. The
36
- released-SDK compatibility corpus exercises these conversions. Add a frozen protocol-9 reader after
37
- the SDK release is published.
45
+ released-SDK compatibility corpus exercises these conversions.
38
46
 
39
47
  ## Protocol 8: local manifest declarations
40
48
 
@@ -139,6 +139,8 @@ without sending a message.
139
139
 
140
140
  ### Query requests
141
141
 
142
+ `queryDataSource.archive_status` accepts `active`, `archived`, or `all`. It defaults to `active`.
143
+
142
144
  `queryDataSource` may include a resolved `filter` and an ordered `sorts` list. Each sort contains a
143
145
  raw `propertyId` and an `ascending` or `descending` direction. Hosts apply sorts in array order. The
144
146
  SDK and host validate that the list contains at most ten unique properties. The host rejects
@@ -183,15 +185,20 @@ filter: {
183
185
  }
184
186
  ```
185
187
 
186
- ## Capabilities
188
+ ## Grants
189
+
190
+ `manifest.grants` lists `{ action, resource }` declarations. `action` is an open string and
191
+ `resource` is an open string or a non-empty array of them, so a newer vocabulary never makes an
192
+ older receiver reject a manifest. An array applies the action to each element. Receivers never split
193
+ a resource string on commas. An omitted `grants` marks a block that predates approval.
187
194
 
188
- `manifest.capabilities` lists `{ capability, resource }` declarations. Both fields are open strings,
189
- so a newer vocabulary never makes an older receiver reject a manifest. An omitted `capabilities`
190
- marks a block that predates approval.
195
+ Resources for page actions can name one manifest data source as `data_source:<key>`. The key is the
196
+ semantic key from `manifest.dataSources`; hosts resolve it to the bound data source when they record
197
+ and check grants. Bare `data_source` covers every declared key.
191
198
 
192
- The `capability_not_granted` error code is reserved for a request that the viewer's grants do not
193
- cover, with `isRetryable: false`. No adapter sends it yet, and no receiver restricts requests by
194
- capability. The SDK's capabilities guide documents the vocabulary.
199
+ The `not_granted` error code is reserved for a request that the viewer's grants do not cover, with
200
+ `isRetryable: false`. No adapter sends it yet, and no receiver restricts requests by grant. The
201
+ SDK's grants guide documents the vocabulary.
195
202
 
196
203
  ## Page context
197
204
 
@@ -16,7 +16,7 @@ does not guarantee that future features work.
16
16
 
17
17
  `sdkVersion` is analytics metadata. Compatibility behavior depends on the protocol version.
18
18
 
19
- The current SDK declares protocol 9. The shared runtime minimum is 3. The dev shell uses the Worker
19
+ The current SDK declares protocol 10. The shared runtime minimum is 3. The dev shell uses the Worker
20
20
  manifest in host mode and accepts the shared runtime's supported protocol versions. Protocols 7 and
21
21
  8 use the same page and query response formats. Protocol 8's local manifest declaration is selected
22
22
  only in sandbox mode; host mode uses the persisted manifest. See the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks-host",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Reusable host runtime for Notion custom blocks.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,7 +41,6 @@ export function toPageWithNullTextFallbackProperties(
41
41
  case "last_edited_time":
42
42
  case "created_by":
43
43
  case "last_edited_by":
44
- case "last_visited_time":
45
44
  case undefined:
46
45
  return [name, property]
47
46
  default:
@@ -68,8 +68,6 @@ export function toPropertyValueForProtocol3To5(
68
68
  return toDateTimeValueForProtocol3To5(property.created_time)
69
69
  case "last_edited_time":
70
70
  return toDateTimeValueForProtocol3To5(property.last_edited_time)
71
- case "last_visited_time":
72
- return toDateTimeValueForProtocol3To5(property.last_visited_time)
73
71
  case "created_by":
74
72
  return property.created_by ? [property.created_by] : undefined
75
73
  case "last_edited_by":
@@ -1,37 +0,0 @@
1
- import * as v from "valibot";
2
- /**
3
- * One entry in the block manifest's `capabilities`: what the block needs to do
4
- * (`capability`) and what it acts on (`resource`). Viewers approve declared
5
- * entries before the block loads.
6
- *
7
- * Both fields accept any string so a newer vocabulary never makes an older host
8
- * or SDK reject a manifest.
9
- */
10
- export declare const customBlockCapabilityDeclarationSchema: v.ObjectSchema<{
11
- readonly capability: v.StringSchema<undefined>;
12
- readonly resource: v.StringSchema<undefined>;
13
- }, undefined>;
14
- export type CustomBlockCapabilityDeclaration = v.InferOutput<typeof customBlockCapabilityDeclarationSchema>;
15
- /**
16
- * Capability names that hosts recognize. `user` is shorthand for `user.read`
17
- * and `user.read_email` on the same resource. `page` is shorthand for
18
- * `page.read`, `page.insert`, `page.update`, and `page.archive` on the same
19
- * resource. `page.trash` is reserved for a future Trash call and is not
20
- * accepted yet.
21
- */
22
- export type CustomBlockCapabilityName = "user" | "user.read" | "user.read_email" | "page" | "page.read" | "page.insert" | "page.update" | "page.archive" | "network.fetch";
23
- /**
24
- * Resource names that hosts recognize. User capabilities take `current_user`
25
- * or `workspace` (every member of the workspace). Page capabilities take
26
- * `workspace` (every page the viewer can access), `containing_page`, or
27
- * `data_source`. `private` is reserved for a future
28
- * `page.insert` into the viewer's Private section and is not accepted yet.
29
- * `network.fetch` takes a bare HTTPS origin.
30
- */
31
- export type CustomBlockCapabilityResourceName = "current_user" | "workspace" | "containing_page" | "data_source" | CustomBlockOriginResourceName;
32
- /**
33
- * An HTTPS origin the block loads content from and connects to, such as
34
- * `https://api.example.com`. `https://*.example.com` covers subdomains. Hosts
35
- * allow only origins that are also on the workspace's network allowlist.
36
- */
37
- export type CustomBlockOriginResourceName = `https://${string}`;
@@ -1,13 +0,0 @@
1
- import * as v from "valibot";
2
- /**
3
- * One entry in the block manifest's `capabilities`: what the block needs to do
4
- * (`capability`) and what it acts on (`resource`). Viewers approve declared
5
- * entries before the block loads.
6
- *
7
- * Both fields accept any string so a newer vocabulary never makes an older host
8
- * or SDK reject a manifest.
9
- */
10
- export const customBlockCapabilityDeclarationSchema = v.object({
11
- capability: v.string(),
12
- resource: v.string(),
13
- });