@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
@@ -0,0 +1,34 @@
1
+ import { notionIconColorSchema } from "../protocol/icons.js";
2
+ import * as v from "valibot";
3
+ const nativeIconMutationSchema = v.object({
4
+ type: v.picklist(["updatePage", "createPage"]),
5
+ requestId: v.string(),
6
+ icon: v.object({
7
+ type: v.literal("icon"),
8
+ icon: v.object({ color: v.unknown() }),
9
+ }),
10
+ });
11
+ /** Reject malformed colors with a correlated result before invoking a page mutation handler. */
12
+ export function getInvalidNativeIconColorResponse(data) {
13
+ const parsed = v.safeParse(nativeIconMutationSchema, data);
14
+ if (!parsed.success) {
15
+ return;
16
+ }
17
+ const color = parsed.output.icon.icon.color;
18
+ if (color === undefined ||
19
+ v.safeParse(notionIconColorSchema, color).success) {
20
+ return;
21
+ }
22
+ return {
23
+ type: parsed.output.type === "createPage"
24
+ ? "createPageResult"
25
+ : "updatePageResult",
26
+ requestId: parsed.output.requestId,
27
+ status: "error",
28
+ error: {
29
+ code: "invalid_icon_color",
30
+ message: "Use a supported Notion icon color.",
31
+ isRetryable: false,
32
+ },
33
+ };
34
+ }
@@ -3,6 +3,7 @@ import type { createPageMessageSchema } from "../protocol/pages/messages/createP
3
3
  import type { getPageMessageSchema } from "../protocol/pages/messages/getPage.js";
4
4
  import type { openPageMessageSchema } from "../protocol/pages/messages/openPage.js";
5
5
  import type { updatePageMessageSchema } from "../protocol/pages/messages/updatePage.js";
6
+ import type { notionPageIconSchema } from "../protocol/pages/pageAppearance.js";
6
7
  import type { InferInput } from "valibot";
7
8
  import type { CustomBlockHostResult } from "../messages/result.js";
8
9
  export type CreatePageMessageInput = InferInput<typeof createPageMessageSchema>;
@@ -15,4 +16,5 @@ export type CustomBlockHostPageResult = CustomBlockHostResult<{
15
16
  export type CustomBlockHostOpenPageResult = CustomBlockHostResult<{
16
17
  pageId: string;
17
18
  }>;
19
+ export type CustomBlockHostPageIcon = InferInput<typeof notionPageIconSchema>;
18
20
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pages/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sDAAsD,CAAA;AACtF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+DAA+D,CAAA;AAC5G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAA;AACtG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAA;AACxG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+DAA+D,CAAA;AAC5G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAElE,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE/E,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEzE,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAE3E,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE/E,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,CAAC;IAC7D,IAAI,EAAE,UAAU,CAAA;CAChB,CAAC,CAAA;AACF,MAAM,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;IACjE,MAAM,EAAE,MAAM,CAAA;CACd,CAAC,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pages/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sDAAsD,CAAA;AACtF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+DAA+D,CAAA;AAC5G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAA;AACtG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAA;AACxG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+DAA+D,CAAA;AAC5G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAA;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAElE,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE/E,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEzE,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAE3E,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE/E,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,CAAC;IAC7D,IAAI,EAAE,UAAU,CAAA;CAChB,CAAC,CAAA;AACF,MAAM,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;IACjE,MAAM,EAAE,MAAM,CAAA;CACd,CAAC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
@@ -206,10 +206,6 @@ export declare const bridgePageForProtocol3To5Schema: v.ObjectSchema<{
206
206
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
207
207
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
208
208
  }, undefined>, undefined>;
209
- }, undefined>, v.ObjectSchema<{
210
- readonly id: v.StringSchema<undefined>;
211
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
212
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
213
209
  }, undefined>, v.ObjectSchema<{
214
210
  readonly id: v.StringSchema<undefined>;
215
211
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -237,7 +233,13 @@ export declare const bridgePageForProtocol3To5Schema: v.ObjectSchema<{
237
233
  }, undefined>], undefined>, undefined>;
238
234
  readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
239
235
  readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
240
- readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
236
+ readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
237
+ readonly type: v.LiteralSchema<"icon", undefined>;
238
+ readonly icon: v.LooseObjectSchema<{
239
+ readonly name: v.StringSchema<undefined>;
240
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
241
+ }, undefined>;
242
+ }, undefined>, v.ObjectSchema<{
241
243
  readonly type: v.LiteralSchema<"emoji", undefined>;
242
244
  readonly emoji: v.StringSchema<undefined>;
243
245
  }, undefined>, v.ObjectSchema<{
@@ -121,10 +121,6 @@ export declare const bridgeDataSourceBindingSchema: v.ObjectSchema<{
121
121
  readonly name: v.StringSchema<undefined>;
122
122
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
123
123
  readonly type: v.LiteralSchema<"verification", undefined>;
124
- }, undefined>, v.ObjectSchema<{
125
- readonly name: v.StringSchema<undefined>;
126
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
127
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
128
124
  }, undefined>, v.ObjectSchema<{
129
125
  readonly name: v.StringSchema<undefined>;
130
126
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -116,10 +116,6 @@ export declare const bridgeDataSourceBindingsSchema: v.RecordSchema<v.StringSche
116
116
  readonly name: v.StringSchema<undefined>;
117
117
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
118
118
  readonly type: v.LiteralSchema<"verification", undefined>;
119
- }, undefined>, v.ObjectSchema<{
120
- readonly name: v.StringSchema<undefined>;
121
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
122
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
123
119
  }, undefined>, v.ObjectSchema<{
124
120
  readonly name: v.StringSchema<undefined>;
125
121
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -115,10 +115,6 @@ export declare const notionCollectionSchemaValidator: v.ObjectSchema<{
115
115
  readonly name: v.StringSchema<undefined>;
116
116
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
117
117
  readonly type: v.LiteralSchema<"verification", undefined>;
118
- }, undefined>, v.ObjectSchema<{
119
- readonly name: v.StringSchema<undefined>;
120
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
121
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
122
118
  }, undefined>, v.ObjectSchema<{
123
119
  readonly name: v.StringSchema<undefined>;
124
120
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -124,10 +124,6 @@ export declare const dataSourcesChangedMessageSchema: v.ObjectSchema<{
124
124
  readonly name: v.StringSchema<undefined>;
125
125
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
126
126
  readonly type: v.LiteralSchema<"verification", undefined>;
127
- }, undefined>, v.ObjectSchema<{
128
- readonly name: v.StringSchema<undefined>;
129
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
130
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
131
127
  }, undefined>, v.ObjectSchema<{
132
128
  readonly name: v.StringSchema<undefined>;
133
129
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -745,10 +745,6 @@ export declare const queryDataSourceResultMessageSchema: v.VariantSchema<"status
745
745
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
746
746
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
747
747
  }, undefined>, undefined>;
748
- }, undefined>, v.ObjectSchema<{
749
- readonly id: v.StringSchema<undefined>;
750
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
751
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
752
748
  }, undefined>, v.ObjectSchema<{
753
749
  readonly id: v.StringSchema<undefined>;
754
750
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -784,10 +780,15 @@ export declare const queryDataSourceResultMessageSchema: v.VariantSchema<"status
784
780
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
785
781
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
786
782
  }, undefined>, undefined>, null>;
787
- readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
788
783
  readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
789
784
  readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
790
- readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
785
+ readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
786
+ readonly type: v.LiteralSchema<"icon", undefined>;
787
+ readonly icon: v.LooseObjectSchema<{
788
+ readonly name: v.StringSchema<undefined>;
789
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
790
+ }, undefined>;
791
+ }, undefined>, v.ObjectSchema<{
791
792
  readonly type: v.LiteralSchema<"emoji", undefined>;
792
793
  readonly emoji: v.StringSchema<undefined>;
793
794
  }, undefined>, v.ObjectSchema<{
@@ -1048,10 +1049,6 @@ export declare const queryDataSourceResultMessageWithProtocol3To5CompatibilitySc
1048
1049
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
1049
1050
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1050
1051
  }, undefined>, undefined>;
1051
- }, undefined>, v.ObjectSchema<{
1052
- readonly id: v.StringSchema<undefined>;
1053
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
1054
- readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1055
1052
  }, undefined>, v.ObjectSchema<{
1056
1053
  readonly id: v.StringSchema<undefined>;
1057
1054
  readonly type: v.LiteralSchema<"unique_id", undefined>;
@@ -1087,10 +1084,15 @@ export declare const queryDataSourceResultMessageWithProtocol3To5CompatibilitySc
1087
1084
  readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
1088
1085
  readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1089
1086
  }, undefined>, undefined>, null>;
1090
- readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
1091
1087
  readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
1092
1088
  readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
1093
- readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
1089
+ readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.LooseObjectSchema<{
1090
+ readonly type: v.LiteralSchema<"icon", undefined>;
1091
+ readonly icon: v.LooseObjectSchema<{
1092
+ readonly name: v.StringSchema<undefined>;
1093
+ readonly color: v.OptionalSchema<v.GenericSchema<import("../../icons.js").NotionIconColor>, undefined>;
1094
+ }, undefined>;
1095
+ }, undefined>, v.ObjectSchema<{
1094
1096
  readonly type: v.LiteralSchema<"emoji", undefined>;
1095
1097
  readonly emoji: v.StringSchema<undefined>;
1096
1098
  }, undefined>, v.ObjectSchema<{
@@ -122,10 +122,6 @@ export declare const notionDataSourceSchema: v.ObjectSchema<{
122
122
  readonly name: v.StringSchema<undefined>;
123
123
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
124
124
  readonly type: v.LiteralSchema<"verification", undefined>;
125
- }, undefined>, v.ObjectSchema<{
126
- readonly name: v.StringSchema<undefined>;
127
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
128
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
129
125
  }, undefined>, v.ObjectSchema<{
130
126
  readonly name: v.StringSchema<undefined>;
131
127
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -274,10 +270,6 @@ export declare const notionDataSourceSchema: v.ObjectSchema<{
274
270
  readonly name: v.StringSchema<undefined>;
275
271
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
276
272
  readonly type: v.LiteralSchema<"verification", undefined>;
277
- }, undefined>, v.ObjectSchema<{
278
- readonly name: v.StringSchema<undefined>;
279
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
280
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
281
273
  }, undefined>, v.ObjectSchema<{
282
274
  readonly name: v.StringSchema<undefined>;
283
275
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -30,12 +30,12 @@ export type NotionDualProperty = v.InferOutput<typeof notionDualPropertySchema>;
30
30
  * Mirrors the Notion public API
31
31
  * [property object](https://developers.notion.com/reference/property-object)
32
32
  * type field. Internal-only types (`button`, `verification`,
33
- * `last_visited_time`, `location`) and the four built-ins (`created_time`,
33
+ * `location`) and the four built-ins (`created_time`,
34
34
  * `last_edited_time`, `created_by`, `last_edited_by`) are included under their
35
35
  * bridge-native names.
36
36
  */
37
- export declare const NOTION_PROPERTY_TYPES: readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "last_visited_time", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"];
38
- export declare const notionPropertyTypeSchema: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "last_visited_time", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
37
+ export declare const NOTION_PROPERTY_TYPES: readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"];
38
+ export declare const notionPropertyTypeSchema: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
39
39
  /**
40
40
  * String literal union of every supported Notion property type. Same set as
41
41
  * the discriminator in `NotionPropertySchema` — split out so the manifest
@@ -163,10 +163,6 @@ export declare const notionPropertySchemaSchema: v.VariantSchema<"type", [v.Obje
163
163
  readonly name: v.StringSchema<undefined>;
164
164
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
165
165
  readonly type: v.LiteralSchema<"verification", undefined>;
166
- }, undefined>, v.ObjectSchema<{
167
- readonly name: v.StringSchema<undefined>;
168
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
169
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
170
166
  }, undefined>, v.ObjectSchema<{
171
167
  readonly name: v.StringSchema<undefined>;
172
168
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -51,7 +51,7 @@ const baseProp = v.object({
51
51
  * Mirrors the Notion public API
52
52
  * [property object](https://developers.notion.com/reference/property-object)
53
53
  * type field. Internal-only types (`button`, `verification`,
54
- * `last_visited_time`, `location`) and the four built-ins (`created_time`,
54
+ * `location`) and the four built-ins (`created_time`,
55
55
  * `last_edited_time`, `created_by`, `last_edited_by`) are included under their
56
56
  * bridge-native names.
57
57
  */
@@ -76,7 +76,6 @@ export const NOTION_PROPERTY_TYPES = [
76
76
  "rollup",
77
77
  "button",
78
78
  "verification",
79
- "last_visited_time",
80
79
  "location",
81
80
  "created_time",
82
81
  "last_edited_time",
@@ -147,7 +146,6 @@ export const notionPropertySchemaSchema = v.variant("type", [
147
146
  // Internal-only types passed through under their bridge-native names.
148
147
  v.object({ ...baseProp.entries, type: v.literal("button") }),
149
148
  v.object({ ...baseProp.entries, type: v.literal("verification") }),
150
- v.object({ ...baseProp.entries, type: v.literal("last_visited_time") }),
151
149
  v.object({ ...baseProp.entries, type: v.literal("location") }),
152
150
  // Synthetic built-ins. The host always emits one of each per data source.
153
151
  v.object({ ...baseProp.entries, type: v.literal("created_time") }),
@@ -35,12 +35,23 @@ export declare const connectMessageSchema: v.VariantSchema<"status", [v.ObjectSc
35
35
  readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
36
36
  readonly name: v.StringSchema<undefined>;
37
37
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
38
- readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "last_visited_time", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
38
+ readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
39
39
  }, undefined>, undefined>, {}>;
40
40
  }, undefined>, undefined>, {}>;
41
+ readonly pages: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
42
+ readonly name: v.StringSchema<undefined>;
43
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
44
+ readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
45
+ readonly type: v.LiteralSchema<"emoji", undefined>;
46
+ readonly emoji: v.StringSchema<undefined>;
47
+ }, undefined>, v.ObjectSchema<{
48
+ readonly type: v.LiteralSchema<"external", undefined>;
49
+ readonly url: v.StringSchema<undefined>;
50
+ }, undefined>], undefined>, undefined>;
51
+ }, undefined>, undefined>, undefined>;
41
52
  readonly capabilities: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
42
53
  readonly capability: v.StringSchema<undefined>;
43
- readonly resource: v.StringSchema<undefined>;
54
+ readonly resource: v.UnionSchema<[v.StringSchema<undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.MinLengthAction<string[], 1, undefined>]>], undefined>;
44
55
  }, undefined>, undefined>, undefined>;
45
56
  }, undefined>, undefined>;
46
57
  }, undefined>, v.ObjectSchema<{
@@ -99,12 +99,23 @@ export declare const initMessageSchema: v.VariantSchema<"status", [v.ObjectSchem
99
99
  readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
100
100
  readonly name: v.StringSchema<undefined>;
101
101
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
102
- readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "last_visited_time", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
102
+ readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
103
103
  }, undefined>, undefined>, {}>;
104
104
  }, undefined>, undefined>, {}>;
105
+ readonly pages: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
106
+ readonly name: v.StringSchema<undefined>;
107
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
108
+ readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
109
+ readonly type: v.LiteralSchema<"emoji", undefined>;
110
+ readonly emoji: v.StringSchema<undefined>;
111
+ }, undefined>, v.ObjectSchema<{
112
+ readonly type: v.LiteralSchema<"external", undefined>;
113
+ readonly url: v.StringSchema<undefined>;
114
+ }, undefined>], undefined>, undefined>;
115
+ }, undefined>, undefined>, undefined>;
105
116
  readonly capabilities: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
106
117
  readonly capability: v.StringSchema<undefined>;
107
- readonly resource: v.StringSchema<undefined>;
118
+ readonly resource: v.UnionSchema<[v.StringSchema<undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.MinLengthAction<string[], 1, undefined>]>], undefined>;
108
119
  }, undefined>, undefined>, undefined>;
109
120
  }, undefined>;
110
121
  readonly dataSources: v.ObjectSchema<{
@@ -225,10 +236,6 @@ export declare const initMessageSchema: v.VariantSchema<"status", [v.ObjectSchem
225
236
  readonly name: v.StringSchema<undefined>;
226
237
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
227
238
  readonly type: v.LiteralSchema<"verification", undefined>;
228
- }, undefined>, v.ObjectSchema<{
229
- readonly name: v.StringSchema<undefined>;
230
- readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
231
- readonly type: v.LiteralSchema<"last_visited_time", undefined>;
232
239
  }, undefined>, v.ObjectSchema<{
233
240
  readonly name: v.StringSchema<undefined>;
234
241
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -0,0 +1,17 @@
1
+ import * as v from "valibot";
2
+ /** Icon names stay open as hosts add to their catalogs. */
3
+ export declare const notionIconNameSchema: v.StringSchema<undefined>;
4
+ export type NotionIconName = v.InferOutput<typeof notionIconNameSchema>;
5
+ declare const knownNotionIconColorSchema: v.PicklistSchema<["gray", "lightgray", "brown", "yellow", "orange", "green", "blue", "purple", "pink", "red"], undefined>;
6
+ /** Known colors remain discoverable while reads and writes accept future colors. */
7
+ export type NotionIconColor = v.InferOutput<typeof knownNotionIconColorSchema> | (string & {});
8
+ export declare const notionIconColorSchema: v.GenericSchema<NotionIconColor>;
9
+ /** Reads and writes share an open shape; hosts resolve names and default omitted colors. */
10
+ export declare const notionNativeIconSchema: v.LooseObjectSchema<{
11
+ readonly type: v.LiteralSchema<"icon", undefined>;
12
+ readonly icon: v.LooseObjectSchema<{
13
+ readonly name: v.StringSchema<undefined>;
14
+ readonly color: v.OptionalSchema<v.GenericSchema<NotionIconColor>, undefined>;
15
+ }, undefined>;
16
+ }, undefined>;
17
+ export {};
@@ -0,0 +1,27 @@
1
+ import * as v from "valibot";
2
+ /** Icon names stay open as hosts add to their catalogs. */
3
+ export const notionIconNameSchema = v.string();
4
+ const knownNotionIconColorSchema = v.picklist([
5
+ "gray",
6
+ "lightgray",
7
+ "brown",
8
+ "yellow",
9
+ "orange",
10
+ "green",
11
+ "blue",
12
+ "purple",
13
+ "pink",
14
+ "red",
15
+ ]);
16
+ export const notionIconColorSchema = v.union([
17
+ knownNotionIconColorSchema,
18
+ v.string(),
19
+ ]);
20
+ /** Reads and writes share an open shape; hosts resolve names and default omitted colors. */
21
+ export const notionNativeIconSchema = v.looseObject({
22
+ type: v.literal("icon"),
23
+ icon: v.looseObject({
24
+ name: notionIconNameSchema,
25
+ color: v.optional(notionIconColorSchema),
26
+ }),
27
+ });
@@ -85,10 +85,11 @@ export { CustomBlockInitializationError, customBlockInitErrorCodeSchema, customB
85
85
  export type { CustomBlockInitResultErrorCode, CustomBlockInitResultErrorInfo, InitResultMessage, } from "./handshake/initResult.js";
86
86
  export { customBlockInitResultErrorCodeSchema, customBlockInitResultErrorInfoSchema, initResultMessageSchema, } from "./handshake/initResult.js";
87
87
  export { isInitHandshakeMessage } from "./handshake/isInitHandshakeMessage.js";
88
- export type { CustomBlockCapabilityDeclaration, CustomBlockCapabilityName, CustomBlockCapabilityResourceName, CustomBlockOriginResourceName, } from "./manifest/capabilities.js";
88
+ export * from "./icons.js";
89
+ export type { CustomBlockCapabilityDeclaration, CustomBlockCapabilityName, CustomBlockCapabilityResourceName, CustomBlockDataSourceResourceName, CustomBlockOriginResourceName, } from "./manifest/capabilities.js";
89
90
  export { customBlockCapabilityDeclarationSchema } from "./manifest/capabilities.js";
90
- export type { BridgeCustomBlockManifest, ManifestDataSource, ManifestIcon, ManifestProperty, } from "./manifest/manifest.js";
91
- export { manifestDataSourceSchema, manifestIconSchema, manifestPropertySchema, manifestSchema, } from "./manifest/manifest.js";
91
+ export type { BridgeCustomBlockManifest, ManifestDataSource, ManifestIcon, ManifestPage, ManifestProperty, } from "./manifest/manifest.js";
92
+ export { manifestDataSourceSchema, manifestIconSchema, manifestPageSchema, manifestPropertySchema, manifestSchema, } from "./manifest/manifest.js";
92
93
  export type { HostToSandboxMessage, HostToSandboxMessageWithProtocol3To5Compatibility, } from "./messages/hostToSandbox.js";
93
94
  export { hostToSandboxMessageSchema, hostToSandboxMessageWithProtocol3To5CompatibilitySchema, } from "./messages/hostToSandbox.js";
94
95
  export { readIncomingType } from "./messages/incomingType.js";
@@ -114,7 +115,7 @@ export { customBlockOpenPageErrorCodeSchema, customBlockOpenPageErrorInfoSchema,
114
115
  export type { CustomBlockUpdatePageErrorCode, CustomBlockUpdatePageErrorInfo, UpdatePageMessage, UpdatePageResultMessage, UpdatePageResultMessageWithProtocol3To5Compatibility, } from "./pages/messages/updatePage.js";
115
116
  export { customBlockUpdatePageErrorCodeSchema, customBlockUpdatePageErrorInfoSchema, updatePageMessageSchema, updatePageResultMessageSchema, updatePageResultMessageWithProtocol3To5CompatibilitySchema, } from "./pages/messages/updatePage.js";
116
117
  export type { NotionPageCover, NotionPageIcon } from "./pages/pageAppearance.js";
117
- export { notionCustomEmojiIconSchema, notionEmojiIconSchema, notionExternalFileSchema, notionHostedFileSchema, notionPageCoverSchema, notionPageIconSchema, } from "./pages/pageAppearance.js";
118
+ export { type NotionCreatePageIcon, notionCreatePageIconSchema, notionCustomEmojiIconSchema, notionEmojiIconSchema, notionExternalFileSchema, notionHostedFileSchema, notionPageCoverSchema, notionPageIconSchema, } from "./pages/pageAppearance.js";
118
119
  export type { BridgePagePropertyReadMap, BridgePagePropertyWriteMap, } from "./pages/properties/bridgePagePropertyMaps.js";
119
120
  export { bridgePagePropertyReadMapSchema, bridgePagePropertyWriteMapSchema, } from "./pages/properties/bridgePagePropertyMaps.js";
120
121
  export type { BridgePagePropertyValue } from "./pages/properties/bridgePagePropertyValue.js";
@@ -145,7 +146,7 @@ export { CAPABILITY_NOT_GRANTED_ERROR_CODE, customBlockErrorInfoSchema, } from "
145
146
  export type { NotionAgentId, NotionBlockId, NotionDataSourceId, NotionPageId, NotionSpaceId, } from "./utils/ids.js";
146
147
  export { notionAgentIdSchema, notionBlockIdSchema, notionDataSourceIdSchema, notionPageIdSchema, notionSpaceIdSchema, } from "./utils/ids.js";
147
148
  export { isLocalBlockServerUrl } from "./utils/isLocalBlockServerUrl.js";
148
- export { LATEST_BRIDGE_PROTOCOL_VERSION, TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION, UNIFIED_PAGE_PROTOCOL_VERSION, } from "./utils/protocolVersion.js";
149
+ export { LATEST_BRIDGE_PROTOCOL_VERSION, NATIVE_ICON_PROTOCOL_VERSION, TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION, UNIFIED_PAGE_PROTOCOL_VERSION, } from "./utils/protocolVersion.js";
149
150
  export { readRequestId } from "./utils/readRequestId.js";
150
151
  export type { NotionRecordPointer } from "./utils/recordPointer.js";
151
152
  export { notionRecordPointerSchema } from "./utils/recordPointer.js";
@@ -42,8 +42,9 @@ export { connectMessageSchema } from "./handshake/connect.js";
42
42
  export { CustomBlockInitializationError, customBlockInitErrorCodeSchema, customBlockInitErrorInfoSchema, initMessageSchema, } from "./handshake/init.js";
43
43
  export { customBlockInitResultErrorCodeSchema, customBlockInitResultErrorInfoSchema, initResultMessageSchema, } from "./handshake/initResult.js";
44
44
  export { isInitHandshakeMessage } from "./handshake/isInitHandshakeMessage.js";
45
+ export * from "./icons.js";
45
46
  export { customBlockCapabilityDeclarationSchema } from "./manifest/capabilities.js";
46
- export { manifestDataSourceSchema, manifestIconSchema, manifestPropertySchema, manifestSchema, } from "./manifest/manifest.js";
47
+ export { manifestDataSourceSchema, manifestIconSchema, manifestPageSchema, manifestPropertySchema, manifestSchema, } from "./manifest/manifest.js";
47
48
  export { hostToSandboxMessageSchema, hostToSandboxMessageWithProtocol3To5CompatibilitySchema, } from "./messages/hostToSandbox.js";
48
49
  export { readIncomingType } from "./messages/incomingType.js";
49
50
  export { invalidHostMessageSchema } from "./messages/invalidHostMessage.js";
@@ -56,7 +57,7 @@ export { createPageMessageSchema, createPageParentSchema, createPageResultMessag
56
57
  export { customBlockGetPageErrorCodeSchema, customBlockGetPageErrorInfoSchema, getPageMessageSchema, getPageResultMessageSchema, getPageResultMessageWithProtocol3To5CompatibilitySchema, } from "./pages/messages/getPage.js";
57
58
  export { customBlockOpenPageErrorCodeSchema, customBlockOpenPageErrorInfoSchema, openPageMessageSchema, openPageModeSchema, openPageResultMessageSchema, } from "./pages/messages/openPage.js";
58
59
  export { customBlockUpdatePageErrorCodeSchema, customBlockUpdatePageErrorInfoSchema, updatePageMessageSchema, updatePageResultMessageSchema, updatePageResultMessageWithProtocol3To5CompatibilitySchema, } from "./pages/messages/updatePage.js";
59
- export { notionCustomEmojiIconSchema, notionEmojiIconSchema, notionExternalFileSchema, notionHostedFileSchema, notionPageCoverSchema, notionPageIconSchema, } from "./pages/pageAppearance.js";
60
+ export { notionCreatePageIconSchema, notionCustomEmojiIconSchema, notionEmojiIconSchema, notionExternalFileSchema, notionHostedFileSchema, notionPageCoverSchema, notionPageIconSchema, } from "./pages/pageAppearance.js";
60
61
  export { bridgePagePropertyReadMapSchema, bridgePagePropertyWriteMapSchema, } from "./pages/properties/bridgePagePropertyMaps.js";
61
62
  export { bridgePagePropertyValueSchema } from "./pages/properties/bridgePagePropertyValue.js";
62
63
  export { bridgeUserSchema } from "./users/bridgeUser.js";
@@ -69,6 +70,6 @@ export { notionUserIdSchema } from "./users/userId.js";
69
70
  export { CAPABILITY_NOT_GRANTED_ERROR_CODE, customBlockErrorInfoSchema, } from "./utils/errors.js";
70
71
  export { notionAgentIdSchema, notionBlockIdSchema, notionDataSourceIdSchema, notionPageIdSchema, notionSpaceIdSchema, } from "./utils/ids.js";
71
72
  export { isLocalBlockServerUrl } from "./utils/isLocalBlockServerUrl.js";
72
- export { LATEST_BRIDGE_PROTOCOL_VERSION, TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION, UNIFIED_PAGE_PROTOCOL_VERSION, } from "./utils/protocolVersion.js";
73
+ export { LATEST_BRIDGE_PROTOCOL_VERSION, NATIVE_ICON_PROTOCOL_VERSION, TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION, UNIFIED_PAGE_PROTOCOL_VERSION, } from "./utils/protocolVersion.js";
73
74
  export { readRequestId } from "./utils/readRequestId.js";
74
75
  export { notionRecordPointerSchema } from "./utils/recordPointer.js";
@@ -4,12 +4,18 @@ import * as v from "valibot";
4
4
  * (`capability`) and what it acts on (`resource`). Viewers approve declared
5
5
  * entries before the block loads.
6
6
  *
7
- * Both fields accept any string so a newer vocabulary never makes an older host
8
- * or SDK reject a manifest.
7
+ * `resource` is one resource or a non-empty array of them. An array declares
8
+ * the capability on each element. A resource string is never split, so
9
+ * `"data_source:tasks,projects"` names one key.
10
+ *
11
+ * Names are open strings so a newer vocabulary never makes an older host or SDK
12
+ * reject a manifest. Notion stores each array element as its own entry at
13
+ * deploy, so the manifest a deployed block receives in `init` has string
14
+ * resources only.
9
15
  */
10
16
  export declare const customBlockCapabilityDeclarationSchema: v.ObjectSchema<{
11
17
  readonly capability: v.StringSchema<undefined>;
12
- readonly resource: v.StringSchema<undefined>;
18
+ readonly resource: v.UnionSchema<[v.StringSchema<undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.MinLengthAction<string[], 1, undefined>]>], undefined>;
13
19
  }, undefined>;
14
20
  export type CustomBlockCapabilityDeclaration = v.InferOutput<typeof customBlockCapabilityDeclarationSchema>;
15
21
  /**
@@ -23,12 +29,17 @@ export type CustomBlockCapabilityName = "user" | "user.read" | "user.read_email"
23
29
  /**
24
30
  * Resource names that hosts recognize. User capabilities take `current_user`
25
31
  * or `workspace` (every member of the workspace). Page capabilities take
26
- * `workspace` (every page the viewer can access), `containing_page`, or
27
- * `data_source`. `private` is reserved for a future
28
- * `page.insert` into the viewer's Private section and is not accepted yet.
29
- * `network.fetch` takes a bare HTTPS origin.
32
+ * `workspace` (every page the viewer can access), `containing_page`,
33
+ * `data_source:<key>`, or `data_source` (every declared data source).
34
+ * `private` is reserved for a future `page.insert` into the viewer's Private
35
+ * section and is not accepted yet. `network.fetch` takes a bare HTTPS origin.
36
+ */
37
+ export type CustomBlockCapabilityResourceName = "current_user" | "workspace" | "containing_page" | "data_source" | CustomBlockDataSourceResourceName | CustomBlockOriginResourceName;
38
+ /**
39
+ * The data source bound to one key of the manifest's `dataSources`, such as
40
+ * `data_source:tasks`. The key must match a declared data source exactly.
30
41
  */
31
- export type CustomBlockCapabilityResourceName = "current_user" | "workspace" | "containing_page" | "data_source" | CustomBlockOriginResourceName;
42
+ export type CustomBlockDataSourceResourceName = `data_source:${string}`;
32
43
  /**
33
44
  * An HTTPS origin the block loads content from and connects to, such as
34
45
  * `https://api.example.com`. `https://*.example.com` covers subdomains. Hosts
@@ -4,10 +4,16 @@ import * as v from "valibot";
4
4
  * (`capability`) and what it acts on (`resource`). Viewers approve declared
5
5
  * entries before the block loads.
6
6
  *
7
- * Both fields accept any string so a newer vocabulary never makes an older host
8
- * or SDK reject a manifest.
7
+ * `resource` is one resource or a non-empty array of them. An array declares
8
+ * the capability on each element. A resource string is never split, so
9
+ * `"data_source:tasks,projects"` names one key.
10
+ *
11
+ * Names are open strings so a newer vocabulary never makes an older host or SDK
12
+ * reject a manifest. Notion stores each array element as its own entry at
13
+ * deploy, so the manifest a deployed block receives in `init` has string
14
+ * resources only.
9
15
  */
10
16
  export const customBlockCapabilityDeclarationSchema = v.object({
11
17
  capability: v.string(),
12
- resource: v.string(),
18
+ resource: v.union([v.string(), v.pipe(v.array(v.string()), v.minLength(1))]),
13
19
  });
@@ -15,9 +15,21 @@ export type ManifestIcon = v.InferOutput<typeof manifestIconSchema>;
15
15
  export declare const manifestPropertySchema: v.ObjectSchema<{
16
16
  readonly name: v.StringSchema<undefined>;
17
17
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
18
- readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "last_visited_time", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
18
+ readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
19
19
  }, undefined>;
20
20
  export type ManifestProperty = v.InferOutput<typeof manifestPropertySchema>;
21
+ export declare const manifestPageSchema: v.ObjectSchema<{
22
+ readonly name: v.StringSchema<undefined>;
23
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
24
+ readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
25
+ readonly type: v.LiteralSchema<"emoji", undefined>;
26
+ readonly emoji: v.StringSchema<undefined>;
27
+ }, undefined>, v.ObjectSchema<{
28
+ readonly type: v.LiteralSchema<"external", undefined>;
29
+ readonly url: v.StringSchema<undefined>;
30
+ }, undefined>], undefined>, undefined>;
31
+ }, undefined>;
32
+ export type ManifestPage = v.InferOutput<typeof manifestPageSchema>;
21
33
  export declare const manifestDataSourceSchema: v.ObjectSchema<{
22
34
  readonly name: v.StringSchema<undefined>;
23
35
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -31,7 +43,7 @@ export declare const manifestDataSourceSchema: v.ObjectSchema<{
31
43
  readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
32
44
  readonly name: v.StringSchema<undefined>;
33
45
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
34
- readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "last_visited_time", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
46
+ readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
35
47
  }, undefined>, undefined>, {}>;
36
48
  }, undefined>;
37
49
  export type ManifestDataSource = v.InferOutput<typeof manifestDataSourceSchema>;
@@ -57,9 +69,20 @@ export declare const manifestSchema: v.ObjectSchema<{
57
69
  readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
58
70
  readonly name: v.StringSchema<undefined>;
59
71
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
60
- readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "last_visited_time", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
72
+ readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
61
73
  }, undefined>, undefined>, {}>;
62
74
  }, undefined>, undefined>, {}>;
75
+ readonly pages: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
76
+ readonly name: v.StringSchema<undefined>;
77
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
78
+ readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
79
+ readonly type: v.LiteralSchema<"emoji", undefined>;
80
+ readonly emoji: v.StringSchema<undefined>;
81
+ }, undefined>, v.ObjectSchema<{
82
+ readonly type: v.LiteralSchema<"external", undefined>;
83
+ readonly url: v.StringSchema<undefined>;
84
+ }, undefined>], undefined>, undefined>;
85
+ }, undefined>, undefined>, undefined>;
63
86
  /**
64
87
  * Capabilities the block needs. Omitted means the block predates capability
65
88
  * approval, so hosts do not ask the viewer. An empty array declares no
@@ -67,7 +90,7 @@ export declare const manifestSchema: v.ObjectSchema<{
67
90
  */
68
91
  readonly capabilities: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
69
92
  readonly capability: v.StringSchema<undefined>;
70
- readonly resource: v.StringSchema<undefined>;
93
+ readonly resource: v.UnionSchema<[v.StringSchema<undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.MinLengthAction<string[], 1, undefined>]>], undefined>;
71
94
  }, undefined>, undefined>, undefined>;
72
95
  }, undefined>;
73
96
  /**
@@ -21,6 +21,11 @@ export const manifestPropertySchema = v.object({
21
21
  description: v.optional(v.string()),
22
22
  type: notionPropertyTypeSchema,
23
23
  });
24
+ export const manifestPageSchema = v.object({
25
+ name: v.string(),
26
+ description: v.optional(v.string()),
27
+ icon: v.optional(manifestIconSchema),
28
+ });
24
29
  export const manifestDataSourceSchema = v.object({
25
30
  name: v.string(),
26
31
  description: v.optional(v.string()),
@@ -34,6 +39,7 @@ export const manifestSchema = v.object({
34
39
  slashCommand: v.optional(v.string()),
35
40
  icon: v.optional(v.object({ type: v.literal("emoji"), emoji: v.string() })),
36
41
  dataSources: v.optional(v.record(v.string(), manifestDataSourceSchema), {}),
42
+ pages: v.optional(v.record(v.string(), manifestPageSchema)),
37
43
  /**
38
44
  * Capabilities the block needs. Omitted means the block predates capability
39
45
  * approval, so hosts do not ask the viewer. An empty array declares no