@notionhq/custom-blocks 0.3.5 → 0.4.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 (124) hide show
  1. package/README.md +2 -2
  2. package/dist/bridge/SandboxBridge.d.ts +4 -23
  3. package/dist/bridge/SandboxBridge.d.ts.map +1 -1
  4. package/dist/bridge/SandboxBridge.js +36 -104
  5. package/dist/bridge/requests.d.ts +35 -0
  6. package/dist/bridge/requests.d.ts.map +1 -0
  7. package/dist/bridge/requests.js +97 -0
  8. package/dist/dataSources/bridge/resolveDataSourceQuery.d.ts.map +1 -1
  9. package/dist/dataSources/bridge/resolveDataSourceQuery.js +15 -1
  10. package/dist/dataSources/createDataSourcePage.d.ts.map +1 -1
  11. package/dist/dataSources/createDataSourcePage.js +5 -1
  12. package/dist/dataSources/types.d.ts +2 -0
  13. package/dist/dataSources/types.d.ts.map +1 -1
  14. package/dist/index.d.ts +2 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/manifest/types.d.ts +1 -1
  17. package/dist/manifest/types.d.ts.map +1 -1
  18. package/dist/navigation/openExternalUrl.d.ts.map +1 -1
  19. package/dist/navigation/openExternalUrl.js +2 -1
  20. package/dist/pages/bridge/getPageForDataSource.d.ts.map +1 -1
  21. package/dist/pages/bridge/getPageForDataSource.js +2 -1
  22. package/dist/pages/bridge/sendCreatePageRequest.d.ts.map +1 -1
  23. package/dist/pages/bridge/sendCreatePageRequest.js +2 -1
  24. package/dist/pages/bridge/toNotionPageFieldsFromBridgePage.d.ts +11 -2
  25. package/dist/pages/bridge/toNotionPageFieldsFromBridgePage.d.ts.map +1 -1
  26. package/dist/pages/bridge/toNotionPageFieldsFromBridgePage.js +0 -1
  27. package/dist/pages/bridge/toNotionPagePropertyFromBridgeProperty.d.ts.map +1 -1
  28. package/dist/pages/bridge/toNotionPagePropertyFromBridgeProperty.js +0 -6
  29. package/dist/pages/bridge/updatePage.d.ts.map +1 -1
  30. package/dist/pages/bridge/updatePage.js +19 -4
  31. package/dist/pages/createPage.d.ts.map +1 -1
  32. package/dist/pages/createPage.js +5 -1
  33. package/dist/pages/openPage.d.ts.map +1 -1
  34. package/dist/pages/openPage.js +2 -1
  35. package/dist/pages/types.d.ts +5 -7
  36. package/dist/pages/types.d.ts.map +1 -1
  37. package/dist/protocol/compatibility/protocol3To5/bridgePage.d.ts +7 -5
  38. package/dist/protocol/context/parent.d.ts +2 -0
  39. package/dist/protocol/dataSources/bridgeArchiveStatus.d.ts +3 -0
  40. package/dist/protocol/dataSources/bridgeArchiveStatus.js +6 -0
  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 +17 -14
  46. package/dist/protocol/dataSources/messages/queryDataSource.js +2 -0
  47. package/dist/protocol/dataSources/notionDataSource.d.ts +0 -8
  48. package/dist/protocol/dataSources/properties/propertySchema.d.ts +3 -7
  49. package/dist/protocol/dataSources/properties/propertySchema.js +1 -3
  50. package/dist/protocol/handshake/connect.d.ts +15 -4
  51. package/dist/protocol/handshake/init.d.ts +15 -8
  52. package/dist/protocol/icons.d.ts +17 -0
  53. package/dist/protocol/icons.js +27 -0
  54. package/dist/protocol/index.d.ts +13 -9
  55. package/dist/protocol/index.js +8 -5
  56. package/dist/protocol/manifest/grants.d.ts +48 -0
  57. package/dist/protocol/manifest/grants.js +19 -0
  58. package/dist/protocol/manifest/manifest.d.ts +33 -10
  59. package/dist/protocol/manifest/manifest.js +11 -5
  60. package/dist/protocol/messages/hostToSandbox.d.ts +109 -87
  61. package/dist/protocol/messages/invalidHostMessage.d.ts +2 -0
  62. package/dist/protocol/messages/invalidHostMessage.js +2 -0
  63. package/dist/protocol/messages/invalidSandboxMessage.d.ts +2 -0
  64. package/dist/protocol/messages/invalidSandboxMessage.js +2 -0
  65. package/dist/protocol/messages/sandboxToHost.d.ts +104 -17
  66. package/dist/protocol/navigation/openExternalUrl.d.ts +2 -2
  67. package/dist/protocol/pages/bridgePage.d.ts +7 -6
  68. package/dist/protocol/pages/bridgePage.js +0 -1
  69. package/dist/protocol/pages/makeBridgePage.d.ts +3 -1
  70. package/dist/protocol/pages/messages/createPage.d.ts +103 -27
  71. package/dist/protocol/pages/messages/createPage.js +3 -1
  72. package/dist/protocol/pages/messages/getPage.d.ts +23 -19
  73. package/dist/protocol/pages/messages/openPage.d.ts +2 -2
  74. package/dist/protocol/pages/messages/updatePage.d.ts +30 -24
  75. package/dist/protocol/pages/pageAppearance.d.ts +36 -1
  76. package/dist/protocol/pages/pageAppearance.js +9 -0
  77. package/dist/protocol/pages/properties/bridgePagePropertyMaps.d.ts +0 -8
  78. package/dist/protocol/pages/properties/bridgePagePropertyValue.d.ts +0 -4
  79. package/dist/protocol/pages/properties/bridgePagePropertyValue.js +0 -5
  80. package/dist/protocol/users/makeBridgeUser.d.ts +3 -1
  81. package/dist/protocol/users/messages/getUser.d.ts +2 -2
  82. package/dist/protocol/users/messages/listUsers.d.ts +2 -2
  83. package/dist/protocol/utils/errors.d.ts +6 -4
  84. package/dist/protocol/utils/errors.js +3 -3
  85. package/dist/protocol/utils/protocolVersion.d.ts +2 -1
  86. package/dist/protocol/utils/protocolVersion.js +3 -1
  87. package/dist/protocol/utils/readRequestId.d.ts +2 -0
  88. package/dist/protocol/utils/readRequestId.js +7 -0
  89. package/dist/users/getUser.d.ts.map +1 -1
  90. package/dist/users/getUser.js +2 -1
  91. package/dist/users/listUsers.d.ts.map +1 -1
  92. package/dist/users/listUsers.js +4 -2
  93. package/dist/utils/version.js +1 -1
  94. package/docs/data-sources.md +38 -34
  95. package/docs/errors.md +47 -5
  96. package/docs/grants.md +127 -0
  97. package/docs/pages.md +45 -32
  98. package/docs/users.md +2 -2
  99. package/package.json +1 -1
  100. package/src/bridge/SandboxBridge.ts +44 -188
  101. package/src/bridge/requests.ts +138 -0
  102. package/src/dataSources/bridge/resolveDataSourceQuery.ts +21 -1
  103. package/src/dataSources/createDataSourcePage.ts +5 -1
  104. package/src/dataSources/types.ts +3 -0
  105. package/src/index.ts +8 -4
  106. package/src/manifest/types.ts +1 -1
  107. package/src/navigation/openExternalUrl.ts +5 -1
  108. package/src/pages/bridge/getPageForDataSource.ts +5 -1
  109. package/src/pages/bridge/sendCreatePageRequest.ts +5 -1
  110. package/src/pages/bridge/toNotionPageFieldsFromBridgePage.ts +0 -1
  111. package/src/pages/bridge/toNotionPagePropertyFromBridgeProperty.ts +0 -6
  112. package/src/pages/bridge/updatePage.ts +28 -8
  113. package/src/pages/createPage.ts +5 -1
  114. package/src/pages/openPage.ts +5 -1
  115. package/src/pages/types.ts +7 -5
  116. package/src/users/getUser.ts +5 -1
  117. package/src/users/listUsers.ts +9 -4
  118. package/dist/bridge/pendingRequests.d.ts +0 -14
  119. package/dist/bridge/pendingRequests.d.ts.map +0 -1
  120. package/dist/bridge/pendingRequests.js +0 -28
  121. package/dist/protocol/manifest/capabilities.d.ts +0 -37
  122. package/dist/protocol/manifest/capabilities.js +0 -13
  123. package/docs/capabilities.md +0 -111
  124. package/src/bridge/pendingRequests.ts +0 -28
@@ -1,7 +1,7 @@
1
1
  import * as v from "valibot";
2
- import type { CustomBlockCapabilityErrorCode, CustomBlockErrorCode, CustomBlockErrorInfo } 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<"update_page_failed" | "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" | 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,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"),
@@ -1,4 +1,6 @@
1
+ import * as v from "valibot";
1
2
  import type { BridgeUser } from "./bridgeUser.js";
2
- export type MakeBridgeUserArgs = Pick<BridgeUser, "id" | "person"> & Partial<Omit<BridgeUser, "object" | "type" | "id" | "person">>;
3
+ import { bridgeUserSchema } from "./bridgeUser.js";
4
+ export type MakeBridgeUserArgs = Pick<v.InferInput<typeof bridgeUserSchema>, "id" | "person"> & Partial<Omit<v.InferInput<typeof bridgeUserSchema>, "object" | "type" | "id" | "person">>;
3
5
  /** Builds the shared person-user payload; callers supply identity and profile data. */
4
6
  export declare function makeBridgeUser(args: MakeBridgeUserArgs): BridgeUser;
@@ -1,7 +1,7 @@
1
1
  import * as v from "valibot";
2
- import type { CustomBlockCapabilityErrorCode, CustomBlockErrorCode, CustomBlockErrorInfo } 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<"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 } 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<"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;
@@ -16,3 +16,5 @@ export declare const customBlockErrorInfoSchema: v.ObjectSchema<{
16
16
  readonly message: v.StringSchema<undefined>;
17
17
  readonly isRetryable: v.BooleanSchema<undefined>;
18
18
  }, undefined>;
19
+ /** Failures shared by one-shot requests. */
20
+ export type CustomBlockRequestErrorCode = CustomBlockErrorCode<"request_timeout" | "request_send_failed" | "request_disposed" | "invalid_host_message" | "invalid_sandbox_message" | "unsupported_operation">;
@@ -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,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;
@@ -0,0 +1,2 @@
1
+ /** Reads correlation without accepting the rest of an invalid message. */
2
+ export declare function readRequestId(data: unknown): string | undefined;
@@ -0,0 +1,7 @@
1
+ import * as v from "valibot";
2
+ const requestIdentitySchema = v.object({ requestId: v.string() });
3
+ /** Reads correlation without accepting the rest of an invalid message. */
4
+ export function readRequestId(data) {
5
+ const result = v.safeParse(requestIdentitySchema, data);
6
+ return result.success ? result.output.requestId : undefined;
7
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"getUser.d.ts","sourceRoot":"","sources":["../../src/users/getUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kDAAkD,CAAA;AAGpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C;;GAEG;AACH,wBAAsB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAK1E"}
1
+ {"version":3,"file":"getUser.d.ts","sourceRoot":"","sources":["../../src/users/getUser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kDAAkD,CAAA;AAGpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C;;GAEG;AACH,wBAAsB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAQ1E"}
@@ -1,10 +1,11 @@
1
+ import { getUserResultMessageSchema } from "../protocol/users/messages/getUser.js";
1
2
  import { getBridge } from "../bridge/getBridge.js";
2
3
  import { toNotionUserFromBridgeUser } from "./bridge/toNotionUserFromBridgeUser.js";
3
4
  /**
4
5
  * Fetches a user by id.
5
6
  */
6
7
  export async function getUser(userId) {
7
- const result = await getBridge().requestGetUser({ userId });
8
+ const result = await getBridge().request({ type: "getUser", userId }, getUserResultMessageSchema);
8
9
  return result.status === "error"
9
10
  ? result
10
11
  : { status: "success", user: toNotionUserFromBridgeUser(result.user) };
@@ -1 +1 @@
1
- {"version":3,"file":"listUsers.d.ts","sourceRoot":"","sources":["../../src/users/listUsers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEhE;;GAEG;AACH,wBAAsB,SAAS,CAC9B,KAAK,GAAE,aAAkB,GACvB,OAAO,CAAC,eAAe,CAAC,CAa1B"}
1
+ {"version":3,"file":"listUsers.d.ts","sourceRoot":"","sources":["../../src/users/listUsers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEhE;;GAEG;AACH,wBAAsB,SAAS,CAC9B,KAAK,GAAE,aAAkB,GACvB,OAAO,CAAC,eAAe,CAAC,CAiB1B"}
@@ -1,13 +1,15 @@
1
+ import { listUsersResultMessageSchema } from "../protocol/users/messages/listUsers.js";
1
2
  import { getBridge } from "../bridge/getBridge.js";
2
3
  import { toNotionUserFromBridgeUser } from "./bridge/toNotionUserFromBridgeUser.js";
3
4
  /**
4
5
  * Lists users visible in the current custom block workspace.
5
6
  */
6
7
  export async function listUsers(input = {}) {
7
- const result = await getBridge().requestListUsers({
8
+ const result = await getBridge().request({
9
+ type: "listUsers",
8
10
  startCursor: input.startCursor,
9
11
  pageSize: input.pageSize,
10
- });
12
+ }, listUsersResultMessageSchema);
11
13
  return result.status === "error"
12
14
  ? result
13
15
  : {
@@ -4,4 +4,4 @@
4
4
  *
5
5
  * WARNING: Generated during SDK publish. Do not edit in the published package.
6
6
  */
7
- export const CUSTOM_BLOCKS_SDK_VERSION = "0.3.5"
7
+ export const CUSTOM_BLOCKS_SDK_VERSION = "0.4.0"
@@ -61,6 +61,7 @@ type DataSourceQueryOptions = {
61
61
  limit?: number;
62
62
  filter?: NotionDataSourceFilter;
63
63
  sorts?: NotionDataSourceSort[];
64
+ archiveStatus?: NotionArchiveStatus;
64
65
  };
65
66
  ```
66
67
 
@@ -111,6 +112,7 @@ function useDataSource(
111
112
  limit?: number
112
113
  filter?: NotionDataSourceFilter
113
114
  sorts?: NotionDataSourceSort[]
115
+ archiveStatus?: NotionArchiveStatus
114
116
  },
115
117
  ): UseDataSourceResult
116
118
 
@@ -130,7 +132,7 @@ pass it to `useDataSource` again.
130
132
  `undefined`. The snapshot does not expose schemas.
131
133
 
132
134
  `useDataSource` uses `customBlock.subscribeToDataSource` and returns its latest snapshot. A change
133
- to the key, limit, filter, or sorts replaces the subscription.
135
+ to the key, limit, filter, sorts, or archive behavior replaces the subscription.
134
136
 
135
137
  Each consumer has its own host subscription. On unmount, the SDK removes its local query state and
136
138
  sends an unsubscribe message. The host stops future refreshes and ignores pending results. Other
@@ -143,7 +145,8 @@ error.
143
145
 
144
146
  ## Query options
145
147
 
146
- Both subscription APIs accept `limit`, `filter`, and `sorts`.
148
+ Both subscription APIs accept `limit`, `filter`, `sorts`, and `archiveStatus`. Queries default to
149
+ `archiveStatus: "active"`. Set `"archived"` for archived rows only, or `"all"` for both states.
147
150
 
148
151
  The SDK types prohibit:
149
152
 
@@ -368,8 +371,7 @@ Rows include metadata properties only when the database schema defines matching
368
371
  properties use the column's configured name and raw property ID.
369
372
 
370
373
  Matching metadata columns also appear under their schema display names. Page getters resolve IDs and
371
- bound manifest keys. `last_visited_time` requires an internal schema property and resolves the
372
- current viewer’s visit.
374
+ bound manifest keys.
373
375
 
374
376
  The bridge keeps database schemas internally to validate filter and sort references. Query results
375
377
  do not expose those schemas.
@@ -528,34 +530,33 @@ refer to the core values inside each property object. For example, “Number”
528
530
  - 🔴 **Unavailable:** The SDK does not expose this operation.
529
531
  - ⚫ **Not supported in Notion:** Notion itself does not support this operation in the stated case.
530
532
 
531
- | Property type | Query result | Update row | Filter | Sort |
532
- | ------------------- | --------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
533
- | `title` | 🟢 Plain text | 🟡 Plain text only | 🟢 Supported | 🟢 Supported |
534
- | `rich_text` | 🟢 Plain text | 🟡 Plain text only | 🟢 Supported | 🟢 Supported |
535
- | `number` | 🟢 Number | 🟢 Supported | 🟢 Supported | 🟢 Supported |
536
- | `checkbox` | 🟢 Boolean | 🟢 Supported | 🟢 Supported | 🟢 Supported |
537
- | `url` | 🟢 String | 🟢 Supported | 🟢 Supported | 🟢 Supported |
538
- | `email` | 🟢 String | 🟢 Supported | 🟢 Supported | 🟢 Supported |
539
- | `phone_number` | 🟢 String | 🟢 Supported | 🟢 Supported | 🟢 Supported |
540
- | `select` | 🟢 Option object | 🟡 Set value only | 🟢 Supported | 🔴 Unavailable |
541
- | `multi_select` | 🟢 Array of option objects | 🟡 Set values only | 🟢 Supported | 🔴 Unavailable |
542
- | `status` | 🟢 Option object | 🟡 Set value only | 🟢 Option names, group names, or empty checks | 🔴 Unavailable |
543
- | `date` | 🟢 Date object | 🟡 Minute precision | 🟢 Supported | 🟢 Supported |
544
- | `people` | 🟢 User or group references | 🟢 Supported | 🟢 Supported | 🟢 Native name ordering |
545
- | `files` | 🟡 External files only | 🟡 File URLs only | 🔴 Unavailable | 🔴 Unavailable |
546
- | `unique_id` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
547
- | `relation` | 🟢 Page reference array | 🟡 Replaces value. Rejects `has_more: true`. | 🟢 Supported | 🔴 Unavailable |
548
- | `place` | 🟢 Place object | 🟢 Supported | 🔴 Unavailable | 🔴 Unavailable |
549
- | `formula` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
550
- | `rollup` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable for numeric targets or numeric aggregations. ⚫ Notion cannot sort other rollups. |
551
- | `button` | 🟡 Text fallback | 🔴 Unavailable | ⚫ Not supported in Notion | ⚫ Not supported in Notion |
552
- | `verification` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
553
- | `last_visited_time` | 🟡 Viewer timestamp or null | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
554
- | `location` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable elsewhere. ⚫ Notion disables filters in My Meetings and Library system databases. | 🔴 Unavailable elsewhere. ⚫ Notion disables sorts in Library system databases. |
555
- | `created_time` | 🟢 Timestamp or null | 🔴 Unavailable | 🔴 Unavailable | 🟡 Schema property only |
556
- | `last_edited_time` | 🟢 Timestamp or null | 🔴 Unavailable | 🔴 Unavailable | 🟡 Schema property only |
557
- | `created_by` | 🟢 Actor reference or null | 🔴 Unavailable | 🟡 Schema-backed creator filters | 🟡 Schema property only |
558
- | `last_edited_by` | 🟢 Actor reference or null | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
533
+ | Property type | Query result | Update row | Filter | Sort |
534
+ | ------------------ | --------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
535
+ | `title` | 🟢 Plain text | 🟡 Plain text only | 🟢 Supported | 🟢 Supported |
536
+ | `rich_text` | 🟢 Plain text | 🟡 Plain text only | 🟢 Supported | 🟢 Supported |
537
+ | `number` | 🟢 Number | 🟢 Supported | 🟢 Supported | 🟢 Supported |
538
+ | `checkbox` | 🟢 Boolean | 🟢 Supported | 🟢 Supported | 🟢 Supported |
539
+ | `url` | 🟢 String | 🟢 Supported | 🟢 Supported | 🟢 Supported |
540
+ | `email` | 🟢 String | 🟢 Supported | 🟢 Supported | 🟢 Supported |
541
+ | `phone_number` | 🟢 String | 🟢 Supported | 🟢 Supported | 🟢 Supported |
542
+ | `select` | 🟢 Option object | 🟡 Set value only | 🟢 Supported | 🔴 Unavailable |
543
+ | `multi_select` | 🟢 Array of option objects | 🟡 Set values only | 🟢 Supported | 🔴 Unavailable |
544
+ | `status` | 🟢 Option object | 🟡 Set value only | 🟢 Option names, group names, or empty checks | 🔴 Unavailable |
545
+ | `date` | 🟢 Date object | 🟡 Minute precision | 🟢 Supported | 🟢 Supported |
546
+ | `people` | 🟢 User or group references | 🟢 Supported | 🟢 Supported | 🟢 Native name ordering |
547
+ | `files` | 🟡 External files only | 🟡 File URLs only | 🔴 Unavailable | 🔴 Unavailable |
548
+ | `unique_id` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
549
+ | `relation` | 🟢 Page reference array | 🟡 Replaces value. Rejects `has_more: true`. | 🟢 Supported | 🔴 Unavailable |
550
+ | `place` | 🟢 Place object | 🟢 Supported | 🔴 Unavailable | 🔴 Unavailable |
551
+ | `formula` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
552
+ | `rollup` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable for numeric targets or numeric aggregations. ⚫ Notion cannot sort other rollups. |
553
+ | `button` | 🟡 Text fallback | 🔴 Unavailable | ⚫ Not supported in Notion | ⚫ Not supported in Notion |
554
+ | `verification` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
555
+ | `location` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable elsewhere. ⚫ Notion disables filters in My Meetings and Library system databases. | 🔴 Unavailable elsewhere. ⚫ Notion disables sorts in Library system databases. |
556
+ | `created_time` | 🟢 Timestamp or null | 🔴 Unavailable | 🔴 Unavailable | 🟡 Schema property only |
557
+ | `last_edited_time` | 🟢 Timestamp or null | 🔴 Unavailable | 🔴 Unavailable | 🟡 Schema property only |
558
+ | `created_by` | 🟢 Actor reference or null | 🔴 Unavailable | 🟡 Schema-backed creator filters | 🟡 Schema property only |
559
+ | `last_edited_by` | 🟢 Actor reference or null | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
559
560
 
560
561
  ### Notes
561
562
 
@@ -626,7 +627,9 @@ See [Pages property support](pages.md#property-support) for the page-property re
626
627
  - `NotionPagePropertyValue` — the typed property values exposed by unified pages.
627
628
  - `PageUpdatePayload` / `UpdatePageResult` — arguments and result for the page mutation methods.
628
629
  - `UseDataSourceOptions` — options accepted by `useDataSource`: `limit?: number`,
629
- `filter?: NotionDataSourceFilter`, and `sorts?: NotionDataSourceSort[]`.
630
+ `filter?: NotionDataSourceFilter`, `sorts?: NotionDataSourceSort[]`, and
631
+ `archiveStatus?: NotionArchiveStatus`.
632
+ - `NotionArchiveStatus` — `"active"`, `"archived"`, or `"all"` for selecting query rows.
630
633
  - `NotionDataSourceFilter` — one property condition or one shallow `and` group.
631
634
  - `NotionDataSourcePropertyFilter` — one property address combined with a type-specific operator.
632
635
  - `NotionDataSourcePropertyAddress` — either a semantic property `key` or a raw `propertyId`.
@@ -641,7 +644,8 @@ See [Pages property support](pages.md#property-support) for the page-property re
641
644
  - `NotionDataSourcePersonFilterValue` — an explicit `{ object: "user" | "group", id }` reference
642
645
  used by a people filter.
643
646
  - `DataSourceSnapshot` — current rows, schema, and status for one live data-source query.
644
- - `DataSourceQueryOptions` — the row limit, filter, and sorts shared by both query APIs.
647
+ - `DataSourceQueryOptions` — the row limit, filter, sorts, and archive behavior shared by both query
648
+ APIs.
645
649
  - `SubscribeToDataSourceArgs` — the key, `onSnapshot` listener, and optional query options for
646
650
  `customBlock.subscribeToDataSource`.
647
651
 
package/docs/errors.md CHANGED
@@ -60,6 +60,48 @@ The SDK validates all properties before sending an update. These local errors ha
60
60
  | `property_id_mismatch` | A supplied value ID differs from the resolved raw property ID. |
61
61
  | `duplicate_property` | Multiple keys resolve to the same raw property ID. |
62
62
 
63
+ ## Page icon errors
64
+
65
+ Page creation and updates can also return these host errors with `isRetryable: false`:
66
+
67
+ - `invalid_icon_name`: The host cannot resolve the requested native icon name.
68
+ - `invalid_icon_color`: A native color is not a string, or the host does not support the color.
69
+
70
+ The wire schema accepts any string color for forward compatibility. An embedding host can still
71
+ reject names or colors it does not support.
72
+
73
+ ## Request completion
74
+
75
+ One-shot requests, including external navigation, share these failure codes:
76
+
77
+ - `request_timeout`: no result arrived within 60 seconds of the SDK call.
78
+ - `request_disposed`: the SDK bridge was disposed before the request completed.
79
+ - `request_send_failed`: the SDK could not post the request.
80
+ - `invalid_host_message`: the SDK received a malformed response with the request's ID.
81
+ - `invalid_sandbox_message`: the host rejected the request and returned a NACK with its ID.
82
+ - `unsupported_operation`: the shared host has no handler for the operation.
83
+
84
+ These failures resolve with `status: "error"` and `isRetryable: false`. The SDK removes the pending
85
+ request and ignores late results. It does not retry requests or cancel work already running on the
86
+ host. A timed-out write may still complete. Check the resulting state before repeating a write.
87
+
88
+ The shared host converts thrown handler failures to `unknown_error`. It keeps exception details in
89
+ the host log and returns a generic message to the SDK. Handlers can still return specific error
90
+ results, including unknown codes.
91
+
92
+ Disposing the SDK completes pending requests with `request_disposed`, clears their timers, and
93
+ prevents new requests from being posted. It does not cancel work already running on the host.
94
+
95
+ Messages with missing, unreadable, or unknown request IDs do not fail other requests. Older hosts
96
+ may send NACKs without IDs; those requests retain the timeout fallback.
97
+
98
+ If a page update times out, updates already queued behind it for the same page complete with
99
+ `previous_write_incomplete` and are not sent. A late response does not restart those updates. This
100
+ applies across page objects sharing the same SDK bridge. Once the queue drains, new explicit updates
101
+ can be sent; they are not protected from a previous write that is still running on the host.
102
+
103
+ Data source subscriptions use a separate lifecycle and do not use this timeout.
104
+
63
105
  ## Data source errors
64
106
 
65
107
  - `data_source_access_failed`: A page create or update operation cannot use its data source because
@@ -86,12 +128,12 @@ failures through their optional error callback.
86
128
  When the host supplies a changed schema or binding, data source subscriptions repeat the query
87
129
  regardless of `isRetryable`.
88
130
 
89
- ## Capability errors
131
+ ## Grant errors
90
132
 
91
- - `capability_not_granted`: Reserved for a request that needs a capability that the block manifest's
92
- `capabilities` does not declare, or that the viewer did not approve. No host sends it yet. When a
93
- host does, `isRetryable` will be `false`, and a data source query that fails with it will end its
94
- subscription. See [capabilities](capabilities.md).
133
+ - `not_granted`: Reserved for a request that needs a grant that the block manifest does not declare,
134
+ or that the viewer did not approve. No host sends it yet. When a host does, `isRetryable` will be
135
+ `false`, and a data source query that fails with it will end its subscription. See
136
+ [grants](grants.md).
95
137
 
96
138
  ## Initialization errors
97
139