@notionhq/custom-blocks 0.2.24 → 0.3.1

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 (73) hide show
  1. package/README.md +8 -5
  2. package/dist/bridge/SandboxBridge.d.ts +15 -14
  3. package/dist/bridge/SandboxBridge.d.ts.map +1 -1
  4. package/dist/bridge/SandboxBridge.js +117 -35
  5. package/dist/bridge/dataSources/resolve.d.ts +1 -3
  6. package/dist/bridge/dataSources/resolve.d.ts.map +1 -1
  7. package/dist/bridge/dataSources/resolve.js +1 -11
  8. package/dist/bridge/dataSources/subscribe.d.ts +4 -1
  9. package/dist/bridge/dataSources/subscribe.d.ts.map +1 -1
  10. package/dist/bridge/dataSources/subscribe.js +14 -1
  11. package/dist/bridge/hostState.d.ts +11 -39
  12. package/dist/bridge/hostState.d.ts.map +1 -1
  13. package/dist/bridge/hostState.js +5 -50
  14. package/dist/bridge/page.d.ts +14 -0
  15. package/dist/bridge/page.d.ts.map +1 -0
  16. package/dist/bridge/page.js +59 -0
  17. package/dist/bridge/sandboxClient.d.ts +8 -14
  18. package/dist/bridge/sandboxClient.d.ts.map +1 -1
  19. package/dist/bridge/sandboxClient.js +13 -21
  20. package/dist/dataSources.d.ts +8 -0
  21. package/dist/dataSources.d.ts.map +1 -0
  22. package/dist/dataSources.js +104 -0
  23. package/dist/index.d.ts +6 -6
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +3 -2
  26. package/dist/protocol/dataSources/dataSourcePage.d.ts +3 -5
  27. package/dist/protocol/dataSources/dataSourcePage.js +2 -3
  28. package/dist/protocol/dataSources/propertySchema.d.ts +1 -0
  29. package/dist/protocol/index.d.ts +1 -0
  30. package/dist/protocol/index.js +1 -0
  31. package/dist/protocol/messages/createPage.js +2 -2
  32. package/dist/protocol/messages/createPageResult.d.ts +468 -1
  33. package/dist/protocol/messages/createPageResult.js +17 -2
  34. package/dist/protocol/messages/getPage.d.ts +468 -1
  35. package/dist/protocol/messages/getPage.js +18 -3
  36. package/dist/protocol/messages/hostToSandbox.d.ts +2587 -178
  37. package/dist/protocol/messages/hostToSandbox.js +24 -12
  38. package/dist/protocol/messages/openExternalUrl.d.ts +32 -0
  39. package/dist/protocol/messages/openExternalUrl.js +26 -0
  40. package/dist/protocol/messages/queryDataSourceResult.d.ts +468 -1
  41. package/dist/protocol/messages/queryDataSourceResult.js +18 -2
  42. package/dist/protocol/messages/sandboxToHost.d.ts +6 -0
  43. package/dist/protocol/messages/sandboxToHost.js +2 -0
  44. package/dist/protocol/messages/updatePage.d.ts +1 -0
  45. package/dist/protocol/messages/updatePage.js +4 -3
  46. package/dist/protocol/messages/updatePageResult.d.ts +467 -1
  47. package/dist/protocol/messages/updatePageResult.js +16 -2
  48. package/dist/protocol/pages/page.d.ts +386 -6
  49. package/dist/protocol/pages/page.js +23 -2
  50. package/dist/protocol/protocolVersion.d.ts +2 -1
  51. package/dist/protocol/protocolVersion.js +4 -1
  52. package/dist/react/useDataSource.d.ts +1 -1
  53. package/dist/react/useDataSource.d.ts.map +1 -1
  54. package/dist/react/useDataSource.js +19 -4
  55. package/dist/types.d.ts +59 -97
  56. package/dist/types.d.ts.map +1 -1
  57. package/dist/version.js +1 -1
  58. package/docs/block-location.md +3 -3
  59. package/docs/data-sources.md +170 -133
  60. package/docs/errors.md +13 -9
  61. package/docs/links.md +44 -0
  62. package/docs/pages.md +113 -182
  63. package/package.json +1 -1
  64. package/src/bridge/SandboxBridge.ts +189 -62
  65. package/src/bridge/dataSources/resolve.ts +1 -20
  66. package/src/bridge/dataSources/subscribe.ts +32 -5
  67. package/src/bridge/hostState.ts +21 -100
  68. package/src/bridge/page.ts +90 -0
  69. package/src/bridge/sandboxClient.ts +15 -25
  70. package/src/dataSources.ts +138 -0
  71. package/src/index.ts +8 -19
  72. package/src/react/useDataSource.ts +20 -4
  73. package/src/types.ts +65 -110
@@ -745,6 +745,7 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
745
745
  readonly type: v.LiteralSchema<"getPage", undefined>;
746
746
  readonly requestId: v.StringSchema<undefined>;
747
747
  readonly pageId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
748
+ readonly dataSourceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
748
749
  }, undefined>, v.ObjectSchema<{
749
750
  readonly type: v.LiteralSchema<"getUser", undefined>;
750
751
  readonly requestId: v.StringSchema<undefined>;
@@ -759,10 +760,15 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
759
760
  readonly requestId: v.StringSchema<undefined>;
760
761
  readonly pageId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
761
762
  readonly mode: v.PicklistSchema<["side_peek", "center_peek"], undefined>;
763
+ }, undefined>, v.ObjectSchema<{
764
+ readonly type: v.LiteralSchema<"openExternalUrl", undefined>;
765
+ readonly requestId: v.StringSchema<undefined>;
766
+ readonly url: v.StringSchema<undefined>;
762
767
  }, undefined>, v.ObjectSchema<{
763
768
  readonly type: v.LiteralSchema<"updatePage", undefined>;
764
769
  readonly requestId: v.StringSchema<undefined>;
765
770
  readonly pageId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
771
+ readonly dataSourceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
766
772
  readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
767
773
  readonly id: v.StringSchema<undefined>;
768
774
  readonly type: v.LiteralSchema<"title", undefined>;
@@ -6,6 +6,7 @@ import { getUserMessageSchema } from "./getUser.js";
6
6
  import { initResultMessageSchema } from "./initResult.js";
7
7
  import { invalidHostMessageSchema } from "./invalidHostMessage.js";
8
8
  import { listUsersMessageSchema } from "./listUsers.js";
9
+ import { openExternalUrlMessageSchema } from "./openExternalUrl.js";
9
10
  import { openPageMessageSchema } from "./openPage.js";
10
11
  import { queryDataSourceMessageSchema } from "./queryDataSource.js";
11
12
  import { resizeMessageSchema } from "./resize.js";
@@ -25,6 +26,7 @@ export const sandboxToHostMessageSchema = v.variant("type", [
25
26
  getUserMessageSchema,
26
27
  listUsersMessageSchema,
27
28
  openPageMessageSchema,
29
+ openExternalUrlMessageSchema,
28
30
  updatePageMessageSchema,
29
31
  resizeMessageSchema,
30
32
  invalidHostMessageSchema,
@@ -6,6 +6,7 @@ export declare const updatePageMessageSchema: v.ObjectSchema<{
6
6
  readonly type: v.LiteralSchema<"updatePage", undefined>;
7
7
  readonly requestId: v.StringSchema<undefined>;
8
8
  readonly pageId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
9
+ readonly dataSourceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
9
10
  /**
10
11
  * Property values, keyed by raw property IDs from Notion.
11
12
  *
@@ -1,6 +1,6 @@
1
1
  import * as v from "valibot";
2
- import { notionPageIdSchema } from "../ids.js";
3
- import { notionPageCoverSchema, notionPageIconSchema, notionPagePropertyReadMapSchema, } from "../pages/page.js";
2
+ import { notionDataSourceIdSchema, notionPageIdSchema } from "../ids.js";
3
+ import { notionPageCoverSchema, notionPageIconSchema, notionPagePropertyWriteMapSchema, } from "../pages/page.js";
4
4
  /**
5
5
  * The sandbox sends this message to patch a page.
6
6
  */
@@ -8,6 +8,7 @@ export const updatePageMessageSchema = v.object({
8
8
  type: v.literal("updatePage"),
9
9
  requestId: v.string(),
10
10
  pageId: notionPageIdSchema,
11
+ dataSourceId: v.optional(notionDataSourceIdSchema),
11
12
  /**
12
13
  * Property values, keyed by raw property IDs from Notion.
13
14
  *
@@ -15,7 +16,7 @@ export const updatePageMessageSchema = v.object({
15
16
  * To update a page with manifest-defined property keys, call `row.update()` on a row returned
16
17
  * by `useDataSource()`. The SDK resolves those keys before it sends this message.
17
18
  */
18
- properties: v.optional(notionPagePropertyReadMapSchema),
19
+ properties: v.optional(notionPagePropertyWriteMapSchema),
19
20
  icon: v.optional(notionPageIconSchema),
20
21
  cover: v.optional(notionPageCoverSchema),
21
22
  archived: v.optional(v.boolean()),
@@ -16,6 +16,471 @@ export declare const updatePageResultMessageSchema: v.VariantSchema<"status", [v
16
16
  readonly requestId: v.StringSchema<undefined>;
17
17
  readonly status: v.LiteralSchema<"success", undefined>;
18
18
  readonly page: v.ObjectSchema<{
19
+ readonly object: v.LiteralSchema<"page", undefined>;
20
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
21
+ readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
22
+ readonly type: v.LiteralSchema<"page_id", undefined>;
23
+ readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
24
+ }, undefined>, v.ObjectSchema<{
25
+ readonly type: v.LiteralSchema<"data_source_id", undefined>;
26
+ readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
27
+ }, undefined>, v.ObjectSchema<{
28
+ readonly type: v.LiteralSchema<"workspace", undefined>;
29
+ readonly workspace: v.LiteralSchema<true, undefined>;
30
+ }, undefined>, v.ObjectSchema<{
31
+ readonly type: v.LiteralSchema<"block_id", undefined>;
32
+ readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
33
+ }, undefined>, v.ObjectSchema<{
34
+ readonly type: v.LiteralSchema<"agent_id", undefined>;
35
+ readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
36
+ }, undefined>, v.ObjectSchema<{
37
+ readonly type: v.LiteralSchema<"unavailable", undefined>;
38
+ }, undefined>], undefined>;
39
+ readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
40
+ readonly id: v.StringSchema<undefined>;
41
+ readonly type: v.LiteralSchema<"title", undefined>;
42
+ readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
43
+ }, undefined>, v.ObjectSchema<{
44
+ readonly id: v.StringSchema<undefined>;
45
+ readonly type: v.LiteralSchema<"rich_text", undefined>;
46
+ readonly rich_text: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
47
+ }, undefined>, v.ObjectSchema<{
48
+ readonly id: v.StringSchema<undefined>;
49
+ readonly type: v.LiteralSchema<"number", undefined>;
50
+ readonly number: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
51
+ }, undefined>, v.ObjectSchema<{
52
+ readonly id: v.StringSchema<undefined>;
53
+ readonly type: v.LiteralSchema<"url", undefined>;
54
+ readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
55
+ }, undefined>, v.ObjectSchema<{
56
+ readonly id: v.StringSchema<undefined>;
57
+ readonly type: v.LiteralSchema<"email", undefined>;
58
+ readonly email: v.NullableSchema<v.StringSchema<undefined>, undefined>;
59
+ }, undefined>, v.ObjectSchema<{
60
+ readonly id: v.StringSchema<undefined>;
61
+ readonly type: v.LiteralSchema<"phone_number", undefined>;
62
+ readonly phone_number: v.NullableSchema<v.StringSchema<undefined>, undefined>;
63
+ }, undefined>, v.ObjectSchema<{
64
+ readonly id: v.StringSchema<undefined>;
65
+ readonly type: v.LiteralSchema<"checkbox", undefined>;
66
+ readonly checkbox: v.BooleanSchema<undefined>;
67
+ }, undefined>, v.ObjectSchema<{
68
+ readonly id: v.StringSchema<undefined>;
69
+ readonly type: v.LiteralSchema<"select", undefined>;
70
+ readonly select: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
71
+ readonly id: v.StringSchema<undefined>;
72
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
73
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
74
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
75
+ }, undefined>, v.ObjectSchema<{
76
+ readonly name: v.StringSchema<undefined>;
77
+ readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
78
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
79
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
80
+ }, undefined>], undefined>, undefined>;
81
+ }, undefined>, v.ObjectSchema<{
82
+ readonly id: v.StringSchema<undefined>;
83
+ readonly type: v.LiteralSchema<"status", undefined>;
84
+ readonly status: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
85
+ readonly id: v.StringSchema<undefined>;
86
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
87
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
88
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
89
+ }, undefined>, v.ObjectSchema<{
90
+ readonly name: v.StringSchema<undefined>;
91
+ readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
92
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
93
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
94
+ }, undefined>], undefined>, undefined>;
95
+ }, undefined>, v.ObjectSchema<{
96
+ readonly id: v.StringSchema<undefined>;
97
+ readonly type: v.LiteralSchema<"multi_select", undefined>;
98
+ readonly multi_select: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
99
+ readonly id: v.StringSchema<undefined>;
100
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
101
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
102
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
103
+ }, undefined>, v.ObjectSchema<{
104
+ readonly name: v.StringSchema<undefined>;
105
+ readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
106
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
107
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
108
+ }, undefined>], undefined>, undefined>;
109
+ }, undefined>, v.ObjectSchema<{
110
+ readonly id: v.StringSchema<undefined>;
111
+ readonly type: v.LiteralSchema<"date", undefined>;
112
+ readonly date: v.NullableSchema<v.ObjectSchema<{
113
+ readonly start: v.StringSchema<undefined>;
114
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
115
+ readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
116
+ }, undefined>, undefined>;
117
+ }, undefined>, v.ObjectSchema<{
118
+ readonly id: v.StringSchema<undefined>;
119
+ readonly type: v.LiteralSchema<"people", undefined>;
120
+ readonly people: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
121
+ readonly object: v.OptionalSchema<v.LiteralSchema<"user", undefined>, undefined>;
122
+ readonly id: v.StringSchema<undefined>;
123
+ }, undefined>, v.ObjectSchema<{
124
+ readonly object: v.LiteralSchema<"group", undefined>;
125
+ readonly id: v.StringSchema<undefined>;
126
+ readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
127
+ }, undefined>], undefined>, undefined>;
128
+ }, undefined>, v.ObjectSchema<{
129
+ readonly id: v.StringSchema<undefined>;
130
+ readonly type: v.LiteralSchema<"relation", undefined>;
131
+ readonly has_more: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
132
+ readonly relation: v.ArraySchema<v.ObjectSchema<{
133
+ readonly id: v.StringSchema<undefined>;
134
+ }, undefined>, undefined>;
135
+ }, undefined>, v.ObjectSchema<{
136
+ readonly id: v.StringSchema<undefined>;
137
+ readonly type: v.LiteralSchema<"files", undefined>;
138
+ readonly files: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
139
+ readonly type: v.LiteralSchema<"external", undefined>;
140
+ readonly name: v.StringSchema<undefined>;
141
+ readonly external: v.ObjectSchema<{
142
+ readonly url: v.StringSchema<undefined>;
143
+ }, undefined>;
144
+ }, undefined>, v.ObjectSchema<{
145
+ readonly type: v.LiteralSchema<"file", undefined>;
146
+ readonly name: v.StringSchema<undefined>;
147
+ readonly file: v.ObjectSchema<{
148
+ readonly url: v.StringSchema<undefined>;
149
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
150
+ }, undefined>;
151
+ }, undefined>], undefined>, undefined>;
152
+ }, undefined>, v.ObjectSchema<{
153
+ readonly id: v.StringSchema<undefined>;
154
+ readonly type: v.LiteralSchema<"place", undefined>;
155
+ readonly place: v.NullableSchema<v.ObjectSchema<{
156
+ readonly lat: v.NumberSchema<undefined>;
157
+ readonly lon: v.NumberSchema<undefined>;
158
+ readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
159
+ readonly address: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
160
+ readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
161
+ readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
162
+ }, undefined>, undefined>;
163
+ }, undefined>, v.ObjectSchema<{
164
+ readonly id: v.StringSchema<undefined>;
165
+ readonly type: v.LiteralSchema<"created_time", undefined>;
166
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
167
+ }, undefined>, v.ObjectSchema<{
168
+ readonly id: v.StringSchema<undefined>;
169
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
170
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
171
+ }, undefined>, v.ObjectSchema<{
172
+ readonly id: v.StringSchema<undefined>;
173
+ readonly type: v.LiteralSchema<"created_by", undefined>;
174
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
175
+ readonly id: v.StringSchema<undefined>;
176
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
177
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
178
+ }, undefined>, undefined>;
179
+ }, undefined>, v.ObjectSchema<{
180
+ readonly id: v.StringSchema<undefined>;
181
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
182
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
183
+ readonly id: v.StringSchema<undefined>;
184
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
185
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
186
+ }, undefined>, undefined>;
187
+ }, undefined>, v.ObjectSchema<{
188
+ readonly id: v.StringSchema<undefined>;
189
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
190
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
191
+ }, undefined>], undefined>, undefined>, undefined>;
192
+ readonly created_by: v.OptionalSchema<v.NullableSchema<v.ObjectSchema<{
193
+ readonly id: v.StringSchema<undefined>;
194
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
195
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
196
+ }, undefined>, undefined>, null>;
197
+ readonly last_edited_by: v.OptionalSchema<v.NullableSchema<v.ObjectSchema<{
198
+ readonly id: v.StringSchema<undefined>;
199
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
200
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
201
+ }, undefined>, undefined>, null>;
202
+ readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
203
+ readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
204
+ readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
205
+ readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
206
+ readonly type: v.LiteralSchema<"emoji", undefined>;
207
+ readonly emoji: v.StringSchema<undefined>;
208
+ }, undefined>, v.ObjectSchema<{
209
+ readonly type: v.LiteralSchema<"custom_emoji", undefined>;
210
+ readonly custom_emoji: v.ObjectSchema<{
211
+ readonly id: v.StringSchema<undefined>;
212
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
213
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
214
+ }, undefined>;
215
+ }, undefined>, v.ObjectSchema<{
216
+ readonly type: v.LiteralSchema<"external", undefined>;
217
+ readonly external: v.ObjectSchema<{
218
+ readonly url: v.StringSchema<undefined>;
219
+ }, undefined>;
220
+ }, undefined>, v.ObjectSchema<{
221
+ readonly type: v.LiteralSchema<"file", undefined>;
222
+ readonly file: v.ObjectSchema<{
223
+ readonly url: v.StringSchema<undefined>;
224
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
225
+ }, undefined>;
226
+ }, undefined>], undefined>, undefined>, null>;
227
+ readonly cover: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
228
+ readonly type: v.LiteralSchema<"external", undefined>;
229
+ readonly external: v.ObjectSchema<{
230
+ readonly url: v.StringSchema<undefined>;
231
+ }, undefined>;
232
+ }, undefined>, v.ObjectSchema<{
233
+ readonly type: v.LiteralSchema<"file", undefined>;
234
+ readonly file: v.ObjectSchema<{
235
+ readonly url: v.StringSchema<undefined>;
236
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
237
+ }, undefined>;
238
+ }, undefined>], undefined>, undefined>, null>;
239
+ readonly url: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
240
+ readonly public_url: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
241
+ readonly is_archived: v.BooleanSchema<undefined>;
242
+ readonly in_trash: v.BooleanSchema<undefined>;
243
+ }, undefined>;
244
+ }, undefined>, v.ObjectSchema<{
245
+ readonly type: v.LiteralSchema<"updatePageResult", undefined>;
246
+ readonly requestId: v.StringSchema<undefined>;
247
+ readonly status: v.LiteralSchema<"error", undefined>;
248
+ readonly error: v.ObjectSchema<{
249
+ readonly code: v.StringSchema<undefined>;
250
+ readonly message: v.StringSchema<undefined>;
251
+ readonly isRetryable: v.BooleanSchema<undefined>;
252
+ }, undefined>;
253
+ }, undefined>], undefined>;
254
+ export declare const updatePageResultMessageLegacySchema: v.VariantSchema<"status", [v.ObjectSchema<{
255
+ readonly type: v.LiteralSchema<"updatePageResult", undefined>;
256
+ readonly requestId: v.StringSchema<undefined>;
257
+ readonly status: v.LiteralSchema<"success", undefined>;
258
+ readonly page: v.UnionSchema<[v.ObjectSchema<{
259
+ readonly object: v.LiteralSchema<"page", undefined>;
260
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
261
+ readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
262
+ readonly type: v.LiteralSchema<"page_id", undefined>;
263
+ readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
264
+ }, undefined>, v.ObjectSchema<{
265
+ readonly type: v.LiteralSchema<"data_source_id", undefined>;
266
+ readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
267
+ }, undefined>, v.ObjectSchema<{
268
+ readonly type: v.LiteralSchema<"workspace", undefined>;
269
+ readonly workspace: v.LiteralSchema<true, undefined>;
270
+ }, undefined>, v.ObjectSchema<{
271
+ readonly type: v.LiteralSchema<"block_id", undefined>;
272
+ readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
273
+ }, undefined>, v.ObjectSchema<{
274
+ readonly type: v.LiteralSchema<"agent_id", undefined>;
275
+ readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
276
+ }, undefined>, v.ObjectSchema<{
277
+ readonly type: v.LiteralSchema<"unavailable", undefined>;
278
+ }, undefined>], undefined>;
279
+ readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
280
+ readonly id: v.StringSchema<undefined>;
281
+ readonly type: v.LiteralSchema<"title", undefined>;
282
+ readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
283
+ }, undefined>, v.ObjectSchema<{
284
+ readonly id: v.StringSchema<undefined>;
285
+ readonly type: v.LiteralSchema<"rich_text", undefined>;
286
+ readonly rich_text: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
287
+ }, undefined>, v.ObjectSchema<{
288
+ readonly id: v.StringSchema<undefined>;
289
+ readonly type: v.LiteralSchema<"number", undefined>;
290
+ readonly number: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
291
+ }, undefined>, v.ObjectSchema<{
292
+ readonly id: v.StringSchema<undefined>;
293
+ readonly type: v.LiteralSchema<"url", undefined>;
294
+ readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
295
+ }, undefined>, v.ObjectSchema<{
296
+ readonly id: v.StringSchema<undefined>;
297
+ readonly type: v.LiteralSchema<"email", undefined>;
298
+ readonly email: v.NullableSchema<v.StringSchema<undefined>, undefined>;
299
+ }, undefined>, v.ObjectSchema<{
300
+ readonly id: v.StringSchema<undefined>;
301
+ readonly type: v.LiteralSchema<"phone_number", undefined>;
302
+ readonly phone_number: v.NullableSchema<v.StringSchema<undefined>, undefined>;
303
+ }, undefined>, v.ObjectSchema<{
304
+ readonly id: v.StringSchema<undefined>;
305
+ readonly type: v.LiteralSchema<"checkbox", undefined>;
306
+ readonly checkbox: v.BooleanSchema<undefined>;
307
+ }, undefined>, v.ObjectSchema<{
308
+ readonly id: v.StringSchema<undefined>;
309
+ readonly type: v.LiteralSchema<"select", undefined>;
310
+ readonly select: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
311
+ readonly id: v.StringSchema<undefined>;
312
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
313
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
314
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
315
+ }, undefined>, v.ObjectSchema<{
316
+ readonly name: v.StringSchema<undefined>;
317
+ readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
318
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
319
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
320
+ }, undefined>], undefined>, undefined>;
321
+ }, undefined>, v.ObjectSchema<{
322
+ readonly id: v.StringSchema<undefined>;
323
+ readonly type: v.LiteralSchema<"status", undefined>;
324
+ readonly status: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
325
+ readonly id: v.StringSchema<undefined>;
326
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
327
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
328
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
329
+ }, undefined>, v.ObjectSchema<{
330
+ readonly name: v.StringSchema<undefined>;
331
+ readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
332
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
333
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
334
+ }, undefined>], undefined>, undefined>;
335
+ }, undefined>, v.ObjectSchema<{
336
+ readonly id: v.StringSchema<undefined>;
337
+ readonly type: v.LiteralSchema<"multi_select", undefined>;
338
+ readonly multi_select: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
339
+ readonly id: v.StringSchema<undefined>;
340
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
341
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
342
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
343
+ }, undefined>, v.ObjectSchema<{
344
+ readonly name: v.StringSchema<undefined>;
345
+ readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
346
+ readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
347
+ readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
348
+ }, undefined>], undefined>, undefined>;
349
+ }, undefined>, v.ObjectSchema<{
350
+ readonly id: v.StringSchema<undefined>;
351
+ readonly type: v.LiteralSchema<"date", undefined>;
352
+ readonly date: v.NullableSchema<v.ObjectSchema<{
353
+ readonly start: v.StringSchema<undefined>;
354
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
355
+ readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
356
+ }, undefined>, undefined>;
357
+ }, undefined>, v.ObjectSchema<{
358
+ readonly id: v.StringSchema<undefined>;
359
+ readonly type: v.LiteralSchema<"people", undefined>;
360
+ readonly people: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
361
+ readonly object: v.OptionalSchema<v.LiteralSchema<"user", undefined>, undefined>;
362
+ readonly id: v.StringSchema<undefined>;
363
+ }, undefined>, v.ObjectSchema<{
364
+ readonly object: v.LiteralSchema<"group", undefined>;
365
+ readonly id: v.StringSchema<undefined>;
366
+ readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
367
+ }, undefined>], undefined>, undefined>;
368
+ }, undefined>, v.ObjectSchema<{
369
+ readonly id: v.StringSchema<undefined>;
370
+ readonly type: v.LiteralSchema<"relation", undefined>;
371
+ readonly has_more: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
372
+ readonly relation: v.ArraySchema<v.ObjectSchema<{
373
+ readonly id: v.StringSchema<undefined>;
374
+ }, undefined>, undefined>;
375
+ }, undefined>, v.ObjectSchema<{
376
+ readonly id: v.StringSchema<undefined>;
377
+ readonly type: v.LiteralSchema<"files", undefined>;
378
+ readonly files: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
379
+ readonly type: v.LiteralSchema<"external", undefined>;
380
+ readonly name: v.StringSchema<undefined>;
381
+ readonly external: v.ObjectSchema<{
382
+ readonly url: v.StringSchema<undefined>;
383
+ }, undefined>;
384
+ }, undefined>, v.ObjectSchema<{
385
+ readonly type: v.LiteralSchema<"file", undefined>;
386
+ readonly name: v.StringSchema<undefined>;
387
+ readonly file: v.ObjectSchema<{
388
+ readonly url: v.StringSchema<undefined>;
389
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
390
+ }, undefined>;
391
+ }, undefined>], undefined>, undefined>;
392
+ }, undefined>, v.ObjectSchema<{
393
+ readonly id: v.StringSchema<undefined>;
394
+ readonly type: v.LiteralSchema<"place", undefined>;
395
+ readonly place: v.NullableSchema<v.ObjectSchema<{
396
+ readonly lat: v.NumberSchema<undefined>;
397
+ readonly lon: v.NumberSchema<undefined>;
398
+ readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
399
+ readonly address: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
400
+ readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
401
+ readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
402
+ }, undefined>, undefined>;
403
+ }, undefined>, v.ObjectSchema<{
404
+ readonly id: v.StringSchema<undefined>;
405
+ readonly type: v.LiteralSchema<"created_time", undefined>;
406
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
407
+ }, undefined>, v.ObjectSchema<{
408
+ readonly id: v.StringSchema<undefined>;
409
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
410
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
411
+ }, undefined>, v.ObjectSchema<{
412
+ readonly id: v.StringSchema<undefined>;
413
+ readonly type: v.LiteralSchema<"created_by", undefined>;
414
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
415
+ readonly id: v.StringSchema<undefined>;
416
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
417
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
418
+ }, undefined>, undefined>;
419
+ }, undefined>, v.ObjectSchema<{
420
+ readonly id: v.StringSchema<undefined>;
421
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
422
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
423
+ readonly id: v.StringSchema<undefined>;
424
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
425
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
426
+ }, undefined>, undefined>;
427
+ }, undefined>, v.ObjectSchema<{
428
+ readonly id: v.StringSchema<undefined>;
429
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
430
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
431
+ }, undefined>], undefined>, undefined>, undefined>;
432
+ readonly created_by: v.OptionalSchema<v.NullableSchema<v.ObjectSchema<{
433
+ readonly id: v.StringSchema<undefined>;
434
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
435
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
436
+ }, undefined>, undefined>, null>;
437
+ readonly last_edited_by: v.OptionalSchema<v.NullableSchema<v.ObjectSchema<{
438
+ readonly id: v.StringSchema<undefined>;
439
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
440
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
441
+ }, undefined>, undefined>, null>;
442
+ readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
443
+ readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
444
+ readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
445
+ readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
446
+ readonly type: v.LiteralSchema<"emoji", undefined>;
447
+ readonly emoji: v.StringSchema<undefined>;
448
+ }, undefined>, v.ObjectSchema<{
449
+ readonly type: v.LiteralSchema<"custom_emoji", undefined>;
450
+ readonly custom_emoji: v.ObjectSchema<{
451
+ readonly id: v.StringSchema<undefined>;
452
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
453
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
454
+ }, undefined>;
455
+ }, undefined>, v.ObjectSchema<{
456
+ readonly type: v.LiteralSchema<"external", undefined>;
457
+ readonly external: v.ObjectSchema<{
458
+ readonly url: v.StringSchema<undefined>;
459
+ }, undefined>;
460
+ }, undefined>, v.ObjectSchema<{
461
+ readonly type: v.LiteralSchema<"file", undefined>;
462
+ readonly file: v.ObjectSchema<{
463
+ readonly url: v.StringSchema<undefined>;
464
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
465
+ }, undefined>;
466
+ }, undefined>], undefined>, undefined>, null>;
467
+ readonly cover: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
468
+ readonly type: v.LiteralSchema<"external", undefined>;
469
+ readonly external: v.ObjectSchema<{
470
+ readonly url: v.StringSchema<undefined>;
471
+ }, undefined>;
472
+ }, undefined>, v.ObjectSchema<{
473
+ readonly type: v.LiteralSchema<"file", undefined>;
474
+ readonly file: v.ObjectSchema<{
475
+ readonly url: v.StringSchema<undefined>;
476
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
477
+ }, undefined>;
478
+ }, undefined>], undefined>, undefined>, null>;
479
+ readonly url: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
480
+ readonly public_url: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
481
+ readonly is_archived: v.BooleanSchema<undefined>;
482
+ readonly in_trash: v.BooleanSchema<undefined>;
483
+ }, undefined>, v.ObjectSchema<{
19
484
  readonly object: v.LiteralSchema<"page", undefined>;
20
485
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
21
486
  readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
@@ -229,7 +694,7 @@ export declare const updatePageResultMessageSchema: v.VariantSchema<"status", [v
229
694
  readonly public_url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
230
695
  readonly is_archived: v.BooleanSchema<undefined>;
231
696
  readonly in_trash: v.BooleanSchema<undefined>;
232
- }, undefined>;
697
+ }, undefined>], undefined>;
233
698
  }, undefined>, v.ObjectSchema<{
234
699
  readonly type: v.LiteralSchema<"updatePageResult", undefined>;
235
700
  readonly requestId: v.StringSchema<undefined>;
@@ -241,3 +706,4 @@ export declare const updatePageResultMessageSchema: v.VariantSchema<"status", [v
241
706
  }, undefined>;
242
707
  }, undefined>], undefined>;
243
708
  export type UpdatePageResultMessage = v.InferOutput<typeof updatePageResultMessageSchema>;
709
+ export type UpdatePageResultMessageLegacy = v.InferOutput<typeof updatePageResultMessageLegacySchema>;
@@ -1,5 +1,5 @@
1
1
  import * as v from "valibot";
2
- import { notionPageSchema } from "../pages/page.js";
2
+ import { legacyNotionPageSchema, notionPageDataSchema } from "../pages/page.js";
3
3
  // The schema accepts any string code. The type lists known codes for
4
4
  // autocomplete, with an open string fallback for newer senders.
5
5
  export const customBlockUpdatePageErrorCodeSchema = v.string();
@@ -16,7 +16,21 @@ export const updatePageResultMessageSchema = v.variant("status", [
16
16
  type: v.literal("updatePageResult"),
17
17
  requestId: v.string(),
18
18
  status: v.literal("success"),
19
- page: notionPageSchema,
19
+ page: notionPageDataSchema,
20
+ }),
21
+ v.object({
22
+ type: v.literal("updatePageResult"),
23
+ requestId: v.string(),
24
+ status: v.literal("error"),
25
+ error: customBlockUpdatePageErrorInfoSchema,
26
+ }),
27
+ ]);
28
+ export const updatePageResultMessageLegacySchema = v.variant("status", [
29
+ v.object({
30
+ type: v.literal("updatePageResult"),
31
+ requestId: v.string(),
32
+ status: v.literal("success"),
33
+ page: v.union([notionPageDataSchema, legacyNotionPageSchema]),
20
34
  }),
21
35
  v.object({
22
36
  type: v.literal("updatePageResult"),