@notionhq/custom-blocks-host 0.3.5 → 0.3.6

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