@notionhq/custom-blocks-host 0.5.2 → 0.7.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 (90) hide show
  1. package/README.md +9 -0
  2. package/dist/browser.js +1 -1
  3. package/dist/compatibility/normalizeHostToSandboxMessage.d.ts.map +1 -1
  4. package/dist/compatibility/normalizeHostToSandboxMessage.js +5 -1
  5. package/dist/compatibility/normalizeSandboxToHostMessage.d.ts +100 -15
  6. package/dist/compatibility/normalizeSandboxToHostMessage.d.ts.map +1 -1
  7. package/dist/compatibility/pages/toIconForProtocol3To8.d.ts +4 -0
  8. package/dist/compatibility/pages/toIconForProtocol3To8.d.ts.map +1 -0
  9. package/dist/compatibility/pages/toIconForProtocol3To8.js +13 -0
  10. package/dist/compatibility/pages/toPageWithNullTextFallbackProperties.d.ts.map +1 -1
  11. package/dist/compatibility/pages/toPageWithNullTextFallbackProperties.js +0 -1
  12. package/dist/compatibility/protocol3To4/addMetadataReadSchemasForProtocol3To4.d.ts +15 -34
  13. package/dist/compatibility/protocol3To4/addMetadataReadSchemasForProtocol3To4.d.ts.map +1 -1
  14. package/dist/compatibility/protocol3To5/toPageForProtocol3To5.d.ts.map +1 -1
  15. package/dist/compatibility/protocol3To5/toPageForProtocol3To5.js +2 -1
  16. package/dist/compatibility/protocol3To5/toPropertyValueForProtocol3To5.d.ts.map +1 -1
  17. package/dist/compatibility/protocol3To5/toPropertyValueForProtocol3To5.js +0 -2
  18. package/dist/compatibility/protocol3To5/toQueryPageForProtocol3To5.d.ts +8 -8
  19. package/dist/compatibility/protocol6/normalizePageResultsForProtocol6.d.ts.map +1 -1
  20. package/dist/compatibility/protocol6/normalizePageResultsForProtocol6.js +9 -2
  21. package/dist/compatibility/protocol7To8/normalizePageResultsForProtocol7To8.d.ts +4 -0
  22. package/dist/compatibility/protocol7To8/normalizePageResultsForProtocol7To8.d.ts.map +1 -0
  23. package/dist/compatibility/protocol7To8/normalizePageResultsForProtocol7To8.js +16 -0
  24. package/dist/context/initialState.d.ts +39 -38
  25. package/dist/context/initialState.d.ts.map +1 -1
  26. package/dist/createCustomBlockHost.d.ts.map +1 -1
  27. package/dist/createCustomBlockHost.js +1 -0
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/manifest/types.d.ts +13 -2
  31. package/dist/manifest/types.d.ts.map +1 -1
  32. package/dist/messages/createSandboxMessageRouter.d.ts +3 -2
  33. package/dist/messages/createSandboxMessageRouter.d.ts.map +1 -1
  34. package/dist/messages/createSandboxMessageRouter.js +7 -1
  35. package/dist/messages/invalidNativeIconColor.d.ts +5 -0
  36. package/dist/messages/invalidNativeIconColor.d.ts.map +1 -0
  37. package/dist/messages/invalidNativeIconColor.js +34 -0
  38. package/dist/pages/types.d.ts +2 -0
  39. package/dist/pages/types.d.ts.map +1 -1
  40. package/dist/protocol/compatibility/protocol3To5/bridgePage.d.ts +7 -5
  41. package/dist/protocol/dataSources/bridgeDataSourceBinding.d.ts +0 -4
  42. package/dist/protocol/dataSources/bridgeDataSourceBindings.d.ts +0 -4
  43. package/dist/protocol/dataSources/collectionSchema.d.ts +0 -4
  44. package/dist/protocol/dataSources/messages/dataSourcesChanged.d.ts +0 -4
  45. package/dist/protocol/dataSources/messages/queryDataSource.d.ts +14 -12
  46. package/dist/protocol/dataSources/notionDataSource.d.ts +0 -8
  47. package/dist/protocol/dataSources/properties/propertySchema.d.ts +3 -7
  48. package/dist/protocol/dataSources/properties/propertySchema.js +1 -3
  49. package/dist/protocol/handshake/connect.d.ts +13 -2
  50. package/dist/protocol/handshake/init.d.ts +13 -6
  51. package/dist/protocol/icons.d.ts +17 -0
  52. package/dist/protocol/icons.js +27 -0
  53. package/dist/protocol/index.d.ts +6 -5
  54. package/dist/protocol/index.js +4 -3
  55. package/dist/protocol/manifest/capabilities.d.ts +19 -8
  56. package/dist/protocol/manifest/capabilities.js +9 -3
  57. package/dist/protocol/manifest/manifest.d.ts +27 -4
  58. package/dist/protocol/manifest/manifest.js +6 -0
  59. package/dist/protocol/messages/hostToSandbox.d.ts +103 -83
  60. package/dist/protocol/messages/sandboxToHost.d.ts +100 -15
  61. package/dist/protocol/pages/bridgePage.d.ts +7 -6
  62. package/dist/protocol/pages/bridgePage.js +0 -1
  63. package/dist/protocol/pages/messages/createPage.d.ts +102 -26
  64. package/dist/protocol/pages/messages/createPage.js +3 -1
  65. package/dist/protocol/pages/messages/getPage.d.ts +21 -17
  66. package/dist/protocol/pages/messages/updatePage.d.ts +29 -23
  67. package/dist/protocol/pages/pageAppearance.d.ts +36 -1
  68. package/dist/protocol/pages/pageAppearance.js +9 -0
  69. package/dist/protocol/pages/properties/bridgePagePropertyMaps.d.ts +0 -8
  70. package/dist/protocol/pages/properties/bridgePagePropertyValue.d.ts +0 -4
  71. package/dist/protocol/pages/properties/bridgePagePropertyValue.js +0 -5
  72. package/dist/protocol/utils/protocolVersion.d.ts +2 -1
  73. package/dist/protocol/utils/protocolVersion.js +3 -1
  74. package/docs/bridge/changelog.md +21 -1
  75. package/docs/bridge/protocol.md +20 -3
  76. package/docs/bridge/versioning.md +1 -0
  77. package/docs/compatibility.md +15 -7
  78. package/package.json +1 -1
  79. package/src/compatibility/normalizeHostToSandboxMessage.ts +5 -0
  80. package/src/compatibility/pages/toIconForProtocol3To8.ts +17 -0
  81. package/src/compatibility/pages/toPageWithNullTextFallbackProperties.ts +0 -1
  82. package/src/compatibility/protocol3To5/toPageForProtocol3To5.ts +2 -1
  83. package/src/compatibility/protocol3To5/toPropertyValueForProtocol3To5.ts +0 -2
  84. package/src/compatibility/protocol6/normalizePageResultsForProtocol6.ts +11 -2
  85. package/src/compatibility/protocol7To8/normalizePageResultsForProtocol7To8.ts +22 -0
  86. package/src/createCustomBlockHost.ts +1 -0
  87. package/src/index.ts +1 -0
  88. package/src/messages/createSandboxMessageRouter.ts +18 -2
  89. package/src/messages/invalidNativeIconColor.ts +43 -0
  90. package/src/pages/types.ts +3 -0
@@ -1,7 +1,7 @@
1
1
  import * as v from "valibot";
2
2
  import type { CustomBlockCapabilityErrorCode, CustomBlockErrorCode, CustomBlockErrorInfo, CustomBlockRequestErrorCode } from "../../utils/errors.js";
3
3
  export declare const customBlockCreatePageErrorCodeSchema: v.StringSchema<undefined>;
4
- export type CustomBlockCreatePageErrorCode = CustomBlockErrorCode<CustomBlockRequestErrorCode | "create_page_failed" | "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" | CustomBlockCapabilityErrorCode>;
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,10 +258,15 @@ 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
- readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
263
+ readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
264
+ readonly type: v.LiteralSchema<"icon", undefined>;
265
+ readonly icon: v.LooseObjectSchema<{
266
+ readonly name: v.StringSchema<undefined>;
267
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
268
+ }, undefined>;
269
+ }, undefined>, v.ObjectSchema<{
269
270
  readonly type: v.LiteralSchema<"emoji", undefined>;
270
271
  readonly emoji: v.StringSchema<undefined>;
271
272
  }, undefined>, v.ObjectSchema<{
@@ -526,10 +527,6 @@ export declare const createPageResultMessageWithProtocol3To5CompatibilitySchema:
526
527
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
527
528
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
528
529
  }, undefined>, undefined>;
529
- }, undefined>, v.ObjectSchema<{
530
- readonly id: v.StringSchema<undefined>;
531
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
532
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
533
530
  }, undefined>, v.ObjectSchema<{
534
531
  readonly id: v.StringSchema<undefined>;
535
532
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -565,10 +562,15 @@ export declare const createPageResultMessageWithProtocol3To5CompatibilitySchema:
565
562
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
566
563
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
567
564
  }, undefined>, undefined>, null>;
568
- readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
569
565
  readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
570
566
  readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
571
- readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
567
+ readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
568
+ readonly type: v.LiteralSchema<"icon", undefined>;
569
+ readonly icon: v.LooseObjectSchema<{
570
+ readonly name: v.StringSchema<undefined>;
571
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
572
+ }, undefined>;
573
+ }, undefined>, v.ObjectSchema<{
572
574
  readonly type: v.LiteralSchema<"emoji", undefined>;
573
575
  readonly emoji: v.StringSchema<undefined>;
574
576
  }, undefined>, v.ObjectSchema<{
@@ -813,10 +815,6 @@ export declare const createPageResultMessageWithProtocol3To5CompatibilitySchema:
813
815
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
814
816
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
815
817
  }, undefined>, undefined>;
816
- }, undefined>, v.ObjectSchema<{
817
- readonly id: v.StringSchema<undefined>;
818
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
819
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
820
818
  }, undefined>, v.ObjectSchema<{
821
819
  readonly id: v.StringSchema<undefined>;
822
820
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -844,7 +842,13 @@ export declare const createPageResultMessageWithProtocol3To5CompatibilitySchema:
844
842
  }, undefined>], undefined>, undefined>;
845
843
  readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
846
844
  readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
847
- readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
845
+ readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
846
+ readonly type: v.LiteralSchema<"icon", undefined>;
847
+ readonly icon: v.LooseObjectSchema<{
848
+ readonly name: v.StringSchema<undefined>;
849
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
850
+ }, undefined>;
851
+ }, undefined>, v.ObjectSchema<{
848
852
  readonly type: v.LiteralSchema<"emoji", undefined>;
849
853
  readonly emoji: v.StringSchema<undefined>;
850
854
  }, undefined>, v.ObjectSchema<{
@@ -1121,10 +1125,6 @@ export declare const createPageMessageSchema: v.VariantSchema<"type", [v.ObjectS
1121
1125
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
1122
1126
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1123
1127
  }, undefined>, undefined>;
1124
- }, undefined>, v.ObjectSchema<{
1125
- readonly id: v.StringSchema<undefined>;
1126
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
1127
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1128
1128
  }, undefined>, v.ObjectSchema<{
1129
1129
  readonly id: v.StringSchema<undefined>;
1130
1130
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -1150,6 +1150,46 @@ export declare const createPageMessageSchema: v.VariantSchema<"type", [v.ObjectS
1150
1150
  readonly type: v.LiteralSchema<"verification", undefined>;
1151
1151
  readonly verification: v.StringSchema<undefined>;
1152
1152
  }, undefined>], undefined>, undefined>;
1153
+ readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
1154
+ readonly type: v.LiteralSchema<"icon", undefined>;
1155
+ readonly icon: v.LooseObjectSchema<{
1156
+ readonly name: v.StringSchema<undefined>;
1157
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
1158
+ }, undefined>;
1159
+ }, undefined>, v.ObjectSchema<{
1160
+ readonly type: v.LiteralSchema<"emoji", undefined>;
1161
+ readonly emoji: v.StringSchema<undefined>;
1162
+ }, undefined>, v.ObjectSchema<{
1163
+ readonly type: v.LiteralSchema<"custom_emoji", undefined>;
1164
+ readonly custom_emoji: v.ObjectSchema<{
1165
+ readonly id: v.StringSchema<undefined>;
1166
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1167
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1168
+ }, undefined>;
1169
+ }, undefined>, v.ObjectSchema<{
1170
+ readonly type: v.LiteralSchema<"external", undefined>;
1171
+ readonly external: v.ObjectSchema<{
1172
+ readonly url: v.StringSchema<undefined>;
1173
+ }, undefined>;
1174
+ }, undefined>, v.ObjectSchema<{
1175
+ readonly type: v.LiteralSchema<"file", undefined>;
1176
+ readonly file: v.ObjectSchema<{
1177
+ readonly url: v.StringSchema<undefined>;
1178
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1179
+ }, undefined>;
1180
+ }, undefined>], undefined>, undefined>;
1181
+ readonly cover: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
1182
+ readonly type: v.LiteralSchema<"external", undefined>;
1183
+ readonly external: v.ObjectSchema<{
1184
+ readonly url: v.StringSchema<undefined>;
1185
+ }, undefined>;
1186
+ }, undefined>, v.ObjectSchema<{
1187
+ readonly type: v.LiteralSchema<"file", undefined>;
1188
+ readonly file: v.ObjectSchema<{
1189
+ readonly url: v.StringSchema<undefined>;
1190
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1191
+ }, undefined>;
1192
+ }, undefined>], undefined>, undefined>;
1153
1193
  readonly parent: v.ObjectSchema<{
1154
1194
  readonly type: v.LiteralSchema<"page_id", undefined>;
1155
1195
  readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
@@ -1354,10 +1394,6 @@ export declare const createPageMessageSchema: v.VariantSchema<"type", [v.ObjectS
1354
1394
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
1355
1395
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1356
1396
  }, undefined>, undefined>;
1357
- }, undefined>, v.ObjectSchema<{
1358
- readonly id: v.StringSchema<undefined>;
1359
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
1360
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1361
1397
  }, undefined>, v.ObjectSchema<{
1362
1398
  readonly id: v.StringSchema<undefined>;
1363
1399
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -1383,6 +1419,46 @@ export declare const createPageMessageSchema: v.VariantSchema<"type", [v.ObjectS
1383
1419
  readonly type: v.LiteralSchema<"verification", undefined>;
1384
1420
  readonly verification: v.StringSchema<undefined>;
1385
1421
  }, undefined>], undefined>, undefined>;
1422
+ readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
1423
+ readonly type: v.LiteralSchema<"icon", undefined>;
1424
+ readonly icon: v.LooseObjectSchema<{
1425
+ readonly name: v.StringSchema<undefined>;
1426
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
1427
+ }, undefined>;
1428
+ }, undefined>, v.ObjectSchema<{
1429
+ readonly type: v.LiteralSchema<"emoji", undefined>;
1430
+ readonly emoji: v.StringSchema<undefined>;
1431
+ }, undefined>, v.ObjectSchema<{
1432
+ readonly type: v.LiteralSchema<"custom_emoji", undefined>;
1433
+ readonly custom_emoji: v.ObjectSchema<{
1434
+ readonly id: v.StringSchema<undefined>;
1435
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1436
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1437
+ }, undefined>;
1438
+ }, undefined>, v.ObjectSchema<{
1439
+ readonly type: v.LiteralSchema<"external", undefined>;
1440
+ readonly external: v.ObjectSchema<{
1441
+ readonly url: v.StringSchema<undefined>;
1442
+ }, undefined>;
1443
+ }, undefined>, v.ObjectSchema<{
1444
+ readonly type: v.LiteralSchema<"file", undefined>;
1445
+ readonly file: v.ObjectSchema<{
1446
+ readonly url: v.StringSchema<undefined>;
1447
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1448
+ }, undefined>;
1449
+ }, undefined>], undefined>, undefined>;
1450
+ readonly cover: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
1451
+ readonly type: v.LiteralSchema<"external", undefined>;
1452
+ readonly external: v.ObjectSchema<{
1453
+ readonly url: v.StringSchema<undefined>;
1454
+ }, undefined>;
1455
+ }, undefined>, v.ObjectSchema<{
1456
+ readonly type: v.LiteralSchema<"file", undefined>;
1457
+ readonly file: v.ObjectSchema<{
1458
+ readonly url: v.StringSchema<undefined>;
1459
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1460
+ }, undefined>;
1461
+ }, undefined>], undefined>, undefined>;
1386
1462
  readonly parent: v.ObjectSchema<{
1387
1463
  readonly type: v.LiteralSchema<"data_source_id", undefined>;
1388
1464
  readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
@@ -3,6 +3,7 @@ import { bridgePageForProtocol3To5Schema } from "../../compatibility/protocol3To
3
3
  import { dataSourceParentSchema, pageParentSchema, } from "../../context/parent.js";
4
4
  import { notionBlockIdSchema } from "../../utils/ids.js";
5
5
  import { bridgePageSchema } from "../bridgePage.js";
6
+ import { notionCreatePageIconSchema, notionPageCoverSchema, } from "../pageAppearance.js";
6
7
  import { bridgePagePropertyWriteMapSchema } from "../properties/bridgePagePropertyMaps.js";
7
8
  // The schema accepts any string code. The type lists known codes for
8
9
  // autocomplete, with an open string fallback for newer senders.
@@ -74,7 +75,6 @@ export const createPageParentSchema = v.variant("type", [
74
75
  ]);
75
76
  /**
76
77
  * The sandbox sends this message to ask the host to create a page.
77
- * The payload mirrors Notion's public `POST /v1/pages` API.
78
78
  */
79
79
  const createPageMessageBaseSchema = {
80
80
  type: v.literal("createPage"),
@@ -87,6 +87,8 @@ const createPageMessageBaseSchema = {
87
87
  * those keys before it sends this message.
88
88
  */
89
89
  properties: bridgePagePropertyWriteMapSchema,
90
+ icon: v.optional(notionCreatePageIconSchema),
91
+ cover: v.optional(notionPageCoverSchema),
90
92
  };
91
93
  // Use a variant so this parent-dependent union can be nested in
92
94
  // sandboxToHostMessageSchema's type discriminator.
@@ -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,10 +264,15 @@ 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
- readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
269
+ readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
270
+ readonly type: v.LiteralSchema<"icon", undefined>;
271
+ readonly icon: v.LooseObjectSchema<{
272
+ readonly name: v.StringSchema<undefined>;
273
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
274
+ }, undefined>;
275
+ }, undefined>, v.ObjectSchema<{
275
276
  readonly type: v.LiteralSchema<"emoji", undefined>;
276
277
  readonly emoji: v.StringSchema<undefined>;
277
278
  }, undefined>, v.ObjectSchema<{
@@ -531,10 +532,6 @@ export declare const getPageResultMessageWithProtocol3To5CompatibilitySchema: v.
531
532
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
532
533
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
533
534
  }, undefined>, undefined>;
534
- }, undefined>, v.ObjectSchema<{
535
- readonly id: v.StringSchema<undefined>;
536
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
537
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
538
535
  }, undefined>, v.ObjectSchema<{
539
536
  readonly id: v.StringSchema<undefined>;
540
537
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -570,10 +567,15 @@ export declare const getPageResultMessageWithProtocol3To5CompatibilitySchema: v.
570
567
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
571
568
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
572
569
  }, undefined>, undefined>, null>;
573
- readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
574
570
  readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
575
571
  readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
576
- readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
572
+ readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
573
+ readonly type: v.LiteralSchema<"icon", undefined>;
574
+ readonly icon: v.LooseObjectSchema<{
575
+ readonly name: v.StringSchema<undefined>;
576
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
577
+ }, undefined>;
578
+ }, undefined>, v.ObjectSchema<{
577
579
  readonly type: v.LiteralSchema<"emoji", undefined>;
578
580
  readonly emoji: v.StringSchema<undefined>;
579
581
  }, undefined>, v.ObjectSchema<{
@@ -818,10 +820,6 @@ export declare const getPageResultMessageWithProtocol3To5CompatibilitySchema: v.
818
820
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
819
821
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
820
822
  }, undefined>, undefined>;
821
- }, undefined>, v.ObjectSchema<{
822
- readonly id: v.StringSchema<undefined>;
823
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
824
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
825
823
  }, undefined>, v.ObjectSchema<{
826
824
  readonly id: v.StringSchema<undefined>;
827
825
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -849,7 +847,13 @@ export declare const getPageResultMessageWithProtocol3To5CompatibilitySchema: v.
849
847
  }, undefined>], undefined>, undefined>;
850
848
  readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
851
849
  readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
852
- readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
850
+ readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
851
+ readonly type: v.LiteralSchema<"icon", undefined>;
852
+ readonly icon: v.LooseObjectSchema<{
853
+ readonly name: v.StringSchema<undefined>;
854
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
855
+ }, undefined>;
856
+ }, undefined>, v.ObjectSchema<{
853
857
  readonly type: v.LiteralSchema<"emoji", undefined>;
854
858
  readonly emoji: v.StringSchema<undefined>;
855
859
  }, undefined>, v.ObjectSchema<{
@@ -1,7 +1,7 @@
1
1
  import * as v from "valibot";
2
2
  import type { CustomBlockCapabilityErrorCode, CustomBlockErrorCode, CustomBlockErrorInfo, 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" | "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" | CustomBlockCapabilityErrorCode>;
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,10 +257,15 @@ 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
- readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
262
+ readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
263
+ readonly type: v.LiteralSchema<"icon", undefined>;
264
+ readonly icon: v.LooseObjectSchema<{
265
+ readonly name: v.StringSchema<undefined>;
266
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
267
+ }, undefined>;
268
+ }, undefined>, v.ObjectSchema<{
268
269
  readonly type: v.LiteralSchema<"emoji", undefined>;
269
270
  readonly emoji: v.StringSchema<undefined>;
270
271
  }, undefined>, v.ObjectSchema<{
@@ -524,10 +525,6 @@ export declare const updatePageResultMessageWithProtocol3To5CompatibilitySchema:
524
525
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
525
526
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
526
527
  }, undefined>, undefined>;
527
- }, undefined>, v.ObjectSchema<{
528
- readonly id: v.StringSchema<undefined>;
529
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
530
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
531
528
  }, undefined>, v.ObjectSchema<{
532
529
  readonly id: v.StringSchema<undefined>;
533
530
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -563,10 +560,15 @@ export declare const updatePageResultMessageWithProtocol3To5CompatibilitySchema:
563
560
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
564
561
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
565
562
  }, undefined>, undefined>, null>;
566
- readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
567
563
  readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
568
564
  readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
569
- readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
565
+ readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
566
+ readonly type: v.LiteralSchema<"icon", undefined>;
567
+ readonly icon: v.LooseObjectSchema<{
568
+ readonly name: v.StringSchema<undefined>;
569
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
570
+ }, undefined>;
571
+ }, undefined>, v.ObjectSchema<{
570
572
  readonly type: v.LiteralSchema<"emoji", undefined>;
571
573
  readonly emoji: v.StringSchema<undefined>;
572
574
  }, undefined>, v.ObjectSchema<{
@@ -811,10 +813,6 @@ export declare const updatePageResultMessageWithProtocol3To5CompatibilitySchema:
811
813
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
812
814
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
813
815
  }, undefined>, undefined>;
814
- }, undefined>, v.ObjectSchema<{
815
- readonly id: v.StringSchema<undefined>;
816
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
817
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
818
816
  }, undefined>, v.ObjectSchema<{
819
817
  readonly id: v.StringSchema<undefined>;
820
818
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -842,7 +840,13 @@ export declare const updatePageResultMessageWithProtocol3To5CompatibilitySchema:
842
840
  }, undefined>], undefined>, undefined>;
843
841
  readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
844
842
  readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
845
- readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
843
+ readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
844
+ readonly type: v.LiteralSchema<"icon", undefined>;
845
+ readonly icon: v.LooseObjectSchema<{
846
+ readonly name: v.StringSchema<undefined>;
847
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
848
+ }, undefined>;
849
+ }, undefined>, v.ObjectSchema<{
846
850
  readonly type: v.LiteralSchema<"emoji", undefined>;
847
851
  readonly emoji: v.StringSchema<undefined>;
848
852
  }, undefined>, v.ObjectSchema<{
@@ -1094,10 +1098,6 @@ export declare const updatePageMessageSchema: v.ObjectSchema<{
1094
1098
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
1095
1099
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1096
1100
  }, undefined>, undefined>;
1097
- }, undefined>, v.ObjectSchema<{
1098
- readonly id: v.StringSchema<undefined>;
1099
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
1100
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1101
1101
  }, undefined>, v.ObjectSchema<{
1102
1102
  readonly id: v.StringSchema<undefined>;
1103
1103
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -1123,7 +1123,13 @@ export declare const updatePageMessageSchema: v.ObjectSchema<{
1123
1123
  readonly type: v.LiteralSchema<"verification", undefined>;
1124
1124
  readonly verification: v.StringSchema<undefined>;
1125
1125
  }, undefined>], undefined>, undefined>, undefined>;
1126
- readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
1126
+ readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
1127
+ readonly type: v.LiteralSchema<"icon", undefined>;
1128
+ readonly icon: v.LooseObjectSchema<{
1129
+ readonly name: v.StringSchema<undefined>;
1130
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
1131
+ }, undefined>;
1132
+ }, undefined>, v.ObjectSchema<{
1127
1133
  readonly type: v.LiteralSchema<"emoji", undefined>;
1128
1134
  readonly emoji: v.StringSchema<undefined>;
1129
1135
  }, undefined>, v.ObjectSchema<{
@@ -24,7 +24,13 @@ export declare const notionHostedFileSchema: v.ObjectSchema<{
24
24
  readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
25
25
  }, undefined>;
26
26
  }, undefined>;
27
- export declare const notionPageIconSchema: v.VariantSchema<"type", [v.ObjectSchema<{
27
+ export declare const notionPageIconSchema: v.VariantSchema<"type", [v.LooseObjectSchema<{
28
+ readonly type: v.LiteralSchema<"icon", undefined>;
29
+ readonly icon: v.LooseObjectSchema<{
30
+ readonly name: v.StringSchema<undefined>;
31
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../icons.js").NotionIconColor>, undefined>;
32
+ }, undefined>;
33
+ }, undefined>, v.ObjectSchema<{
28
34
  readonly type: v.LiteralSchema<"emoji", undefined>;
29
35
  readonly emoji: v.StringSchema<undefined>;
30
36
  }, undefined>, v.ObjectSchema<{
@@ -60,3 +66,32 @@ export declare const notionPageCoverSchema: v.VariantSchema<"type", [v.ObjectSch
60
66
  }, undefined>;
61
67
  }, undefined>], undefined>;
62
68
  export type NotionPageCover = v.InferOutput<typeof notionPageCoverSchema>;
69
+ export declare const notionCreatePageIconSchema: v.VariantSchema<"type", [v.LooseObjectSchema<{
70
+ readonly type: v.LiteralSchema<"icon", undefined>;
71
+ readonly icon: v.LooseObjectSchema<{
72
+ readonly name: v.StringSchema<undefined>;
73
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../icons.js").NotionIconColor>, undefined>;
74
+ }, undefined>;
75
+ }, undefined>, v.ObjectSchema<{
76
+ readonly type: v.LiteralSchema<"emoji", undefined>;
77
+ readonly emoji: v.StringSchema<undefined>;
78
+ }, undefined>, v.ObjectSchema<{
79
+ readonly type: v.LiteralSchema<"custom_emoji", undefined>;
80
+ readonly custom_emoji: v.ObjectSchema<{
81
+ readonly id: v.StringSchema<undefined>;
82
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
83
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
84
+ }, undefined>;
85
+ }, undefined>, v.ObjectSchema<{
86
+ readonly type: v.LiteralSchema<"external", undefined>;
87
+ readonly external: v.ObjectSchema<{
88
+ readonly url: v.StringSchema<undefined>;
89
+ }, undefined>;
90
+ }, undefined>, v.ObjectSchema<{
91
+ readonly type: v.LiteralSchema<"file", undefined>;
92
+ readonly file: v.ObjectSchema<{
93
+ readonly url: v.StringSchema<undefined>;
94
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
95
+ }, undefined>;
96
+ }, undefined>], undefined>;
97
+ export type NotionCreatePageIcon = v.InferOutput<typeof notionCreatePageIconSchema>;
@@ -1,4 +1,5 @@
1
1
  import * as v from "valibot";
2
+ import { notionNativeIconSchema } from "../icons.js";
2
3
  export const notionEmojiIconSchema = v.object({
3
4
  type: v.literal("emoji"),
4
5
  emoji: v.string(),
@@ -23,6 +24,7 @@ export const notionHostedFileSchema = v.object({
23
24
  }),
24
25
  });
25
26
  export const notionPageIconSchema = v.variant("type", [
27
+ notionNativeIconSchema,
26
28
  notionEmojiIconSchema,
27
29
  notionCustomEmojiIconSchema,
28
30
  notionExternalFileSchema,
@@ -32,3 +34,10 @@ export const notionPageCoverSchema = v.variant("type", [
32
34
  notionExternalFileSchema,
33
35
  notionHostedFileSchema,
34
36
  ]);
37
+ export const notionCreatePageIconSchema = v.variant("type", [
38
+ notionNativeIconSchema,
39
+ notionEmojiIconSchema,
40
+ notionCustomEmojiIconSchema,
41
+ notionExternalFileSchema,
42
+ notionHostedFileSchema,
43
+ ]);
@@ -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"),
@@ -3,6 +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 = 8;
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
+ export declare const NATIVE_ICON_PROTOCOL_VERSION = 9;
@@ -3,9 +3,11 @@
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 = 8;
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;
10
10
  // Protocol 7 adds typed text fallbacks for previously unsupported page properties.
11
11
  export const TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION = 7;
12
+ // Protocol 9 adds native icon responses and writes throughout the page API.
13
+ export const NATIVE_ICON_PROTOCOL_VERSION = 9;
@@ -19,11 +19,31 @@ 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
+ | 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 |
23
25
 
24
26
  The table lists SDK release boundaries, not complete supported version ranges. Host compatibility
25
27
  depends on `connect.bridgeProtocolVersion`, not the SDK package version.
26
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
+
37
+ ## Protocol 9: native page icons
38
+
39
+ Page operations and query results can return `{ type: "icon", icon: { name, color } }`. Reads and
40
+ writes share a loose shape: names and colors accept strings, color is optional, and additional
41
+ native icon fields are retained. Hosts resolve names and default omitted colors to gray.
42
+
43
+ Protocols 3–8 receive external SVG URLs in page operation results. Protocols 6–8 receive the same
44
+ fallback in query results; protocols 3–5 keep their flat query format without appearance fields. The
45
+ released-SDK compatibility corpus exercises these conversions.
46
+
27
47
  ## Protocol 8: local manifest declarations
28
48
 
29
49
  The dev shell removes the `/manifest` route and embeds the local manifest in block HTML. The SDK