@notionhq/custom-blocks-host 0.6.0 → 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 (48) hide show
  1. package/dist/browser.js +1 -1
  2. package/dist/compatibility/normalizeSandboxToHostMessage.d.ts +13 -14
  3. package/dist/compatibility/normalizeSandboxToHostMessage.d.ts.map +1 -1
  4. package/dist/compatibility/pages/toPageWithNullTextFallbackProperties.d.ts.map +1 -1
  5. package/dist/compatibility/pages/toPageWithNullTextFallbackProperties.js +0 -1
  6. package/dist/compatibility/protocol3To4/addMetadataReadSchemasForProtocol3To4.d.ts +15 -34
  7. package/dist/compatibility/protocol3To4/addMetadataReadSchemasForProtocol3To4.d.ts.map +1 -1
  8. package/dist/compatibility/protocol3To5/toPropertyValueForProtocol3To5.d.ts.map +1 -1
  9. package/dist/compatibility/protocol3To5/toPropertyValueForProtocol3To5.js +0 -2
  10. package/dist/context/initialState.d.ts +39 -38
  11. package/dist/context/initialState.d.ts.map +1 -1
  12. package/dist/manifest/types.d.ts +13 -2
  13. package/dist/manifest/types.d.ts.map +1 -1
  14. package/dist/protocol/compatibility/protocol3To5/bridgePage.d.ts +0 -4
  15. package/dist/protocol/dataSources/bridgeDataSourceBinding.d.ts +0 -4
  16. package/dist/protocol/dataSources/bridgeDataSourceBindings.d.ts +0 -4
  17. package/dist/protocol/dataSources/collectionSchema.d.ts +0 -4
  18. package/dist/protocol/dataSources/messages/dataSourcesChanged.d.ts +0 -4
  19. package/dist/protocol/dataSources/messages/queryDataSource.d.ts +0 -10
  20. package/dist/protocol/dataSources/notionDataSource.d.ts +0 -8
  21. package/dist/protocol/dataSources/properties/propertySchema.d.ts +3 -7
  22. package/dist/protocol/dataSources/properties/propertySchema.js +1 -3
  23. package/dist/protocol/handshake/connect.d.ts +13 -2
  24. package/dist/protocol/handshake/init.d.ts +13 -6
  25. package/dist/protocol/index.d.ts +3 -3
  26. package/dist/protocol/index.js +1 -1
  27. package/dist/protocol/manifest/capabilities.d.ts +19 -8
  28. package/dist/protocol/manifest/capabilities.js +9 -3
  29. package/dist/protocol/manifest/manifest.d.ts +27 -4
  30. package/dist/protocol/manifest/manifest.js +6 -0
  31. package/dist/protocol/messages/hostToSandbox.d.ts +26 -72
  32. package/dist/protocol/messages/sandboxToHost.d.ts +13 -14
  33. package/dist/protocol/pages/bridgePage.d.ts +0 -5
  34. package/dist/protocol/pages/bridgePage.js +0 -1
  35. package/dist/protocol/pages/messages/createPage.d.ts +0 -22
  36. package/dist/protocol/pages/messages/getPage.d.ts +0 -14
  37. package/dist/protocol/pages/messages/updatePage.d.ts +0 -18
  38. package/dist/protocol/pages/properties/bridgePagePropertyMaps.d.ts +0 -8
  39. package/dist/protocol/pages/properties/bridgePagePropertyValue.d.ts +0 -4
  40. package/dist/protocol/pages/properties/bridgePagePropertyValue.js +0 -5
  41. package/dist/protocol/utils/protocolVersion.d.ts +1 -1
  42. package/dist/protocol/utils/protocolVersion.js +1 -1
  43. package/docs/bridge/changelog.md +11 -3
  44. package/docs/bridge/protocol.md +9 -3
  45. package/docs/compatibility.md +1 -1
  46. package/package.json +1 -1
  47. package/src/compatibility/pages/toPageWithNullTextFallbackProperties.ts +0 -1
  48. package/src/compatibility/protocol3To5/toPropertyValueForProtocol3To5.ts +0 -2
@@ -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"),
@@ -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
 
@@ -185,9 +185,15 @@ filter: {
185
185
 
186
186
  ## Capabilities
187
187
 
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.
188
+ `manifest.capabilities` lists `{ capability, resource }` declarations. `capability` is an open
189
+ string and `resource` is an open string or a non-empty array of them, so a newer vocabulary never
190
+ makes an older receiver reject a manifest. An array declares the capability on each element.
191
+ Receivers never split a resource string on commas. An omitted `capabilities` marks a block that
192
+ predates approval.
193
+
194
+ Page capability resources can name one manifest data source as `data_source:<key>`. The key is the
195
+ semantic key from `manifest.dataSources`; hosts resolve it to the bound data source when they record
196
+ and check grants. Bare `data_source` covers every declared key.
191
197
 
192
198
  The `capability_not_granted` error code is reserved for a request that the viewer's grants do not
193
199
  cover, with `isRetryable: false`. No adapter sends it yet, and no receiver restricts requests by
@@ -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.7.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":