@notionhq/custom-blocks-host 0.3.4 → 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 (40) hide show
  1. package/README.md +0 -5
  2. package/dist/browser.js +1 -1
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/lifecycle/legacyPage.d.ts +70 -0
  6. package/dist/lifecycle/legacyPage.d.ts.map +1 -0
  7. package/dist/lifecycle/legacyPage.js +171 -0
  8. package/dist/lifecycle/normalizeHostToSandboxMessage.d.ts +2 -2
  9. package/dist/lifecycle/normalizeHostToSandboxMessage.d.ts.map +1 -1
  10. package/dist/lifecycle/normalizeHostToSandboxMessage.js +8 -30
  11. package/dist/lifecycle/normalizePage.d.ts +7 -0
  12. package/dist/lifecycle/normalizePage.d.ts.map +1 -0
  13. package/dist/lifecycle/normalizePage.js +22 -0
  14. package/dist/messages/types.d.ts +1 -2
  15. package/dist/messages/types.d.ts.map +1 -1
  16. package/dist/protocol/dataSources/dataSourcePage.d.ts +1 -162
  17. package/dist/protocol/dataSources/dataSourcePage.js +1 -9
  18. package/dist/protocol/messages/createPage.js +2 -2
  19. package/dist/protocol/messages/createPageResult.d.ts +468 -1
  20. package/dist/protocol/messages/createPageResult.js +17 -2
  21. package/dist/protocol/messages/getPage.d.ts +468 -1
  22. package/dist/protocol/messages/getPage.js +18 -3
  23. package/dist/protocol/messages/hostToSandbox.d.ts +2398 -159
  24. package/dist/protocol/messages/hostToSandbox.js +22 -12
  25. package/dist/protocol/messages/queryDataSourceResult.d.ts +312 -2
  26. package/dist/protocol/messages/queryDataSourceResult.js +18 -5
  27. package/dist/protocol/messages/sandboxToHost.d.ts +2 -0
  28. package/dist/protocol/messages/updatePage.d.ts +1 -0
  29. package/dist/protocol/messages/updatePage.js +4 -3
  30. package/dist/protocol/messages/updatePageResult.d.ts +467 -1
  31. package/dist/protocol/messages/updatePageResult.js +16 -2
  32. package/dist/protocol/pages/page.d.ts +386 -6
  33. package/dist/protocol/pages/page.js +23 -2
  34. package/dist/protocol/protocolVersion.js +1 -1
  35. package/package.json +1 -1
  36. package/src/index.ts +2 -4
  37. package/src/lifecycle/legacyPage.ts +208 -0
  38. package/src/lifecycle/normalizeHostToSandboxMessage.ts +18 -35
  39. package/src/lifecycle/normalizePage.ts +35 -0
  40. package/src/messages/types.ts +1 -1
@@ -1,9 +1,9 @@
1
1
  import * as v from "valibot";
2
2
  import { contrastModeChangedMessageSchema } from "./contrastModeChanged.js";
3
- import { createPageResultMessageSchema } from "./createPageResult.js";
3
+ import { createPageResultMessageLegacySchema, createPageResultMessageSchema, } from "./createPageResult.js";
4
4
  import { currentUserChangedMessageSchema } from "./currentUserChanged.js";
5
5
  import { dataSourcesChangedMessageSchema } from "./dataSourcesChanged.js";
6
- import { getPageResultMessageSchema } from "./getPage.js";
6
+ import { getPageResultMessageLegacySchema, getPageResultMessageSchema, } from "./getPage.js";
7
7
  import { getUserResultMessageSchema } from "./getUser.js";
8
8
  import { initMessageSchema } from "./init.js";
9
9
  import { invalidSandboxMessageSchema } from "./invalidSandboxMessage.js";
@@ -12,13 +12,10 @@ import { openExternalUrlResultMessageSchema } from "./openExternalUrl.js";
12
12
  import { openPageResultMessageSchema } from "./openPage.js";
13
13
  import { pageChangedMessageSchema } from "./pageChanged.js";
14
14
  import { parentChangedMessageSchema } from "./parentChanged.js";
15
- import { queryDataSourceResultMessageSchema } from "./queryDataSourceResult.js";
15
+ import { queryDataSourceResultMessageLegacySchema, queryDataSourceResultMessageSchema, } from "./queryDataSourceResult.js";
16
16
  import { themeChangedMessageSchema } from "./themeChanged.js";
17
- import { updatePageResultMessageSchema } from "./updatePageResult.js";
18
- /**
19
- * Discriminated union of every message the host is allowed to send the sandbox.
20
- */
21
- export const hostToSandboxMessageSchema = v.variant("type", [
17
+ import { updatePageResultMessageLegacySchema, updatePageResultMessageSchema, } from "./updatePageResult.js";
18
+ const baseHostToSandboxMessageSchema = v.variant("type", [
22
19
  initMessageSchema,
23
20
  themeChangedMessageSchema,
24
21
  contrastModeChangedMessageSchema,
@@ -26,13 +23,26 @@ export const hostToSandboxMessageSchema = v.variant("type", [
26
23
  pageChangedMessageSchema,
27
24
  currentUserChangedMessageSchema,
28
25
  dataSourcesChangedMessageSchema,
29
- queryDataSourceResultMessageSchema,
30
- createPageResultMessageSchema,
31
- getPageResultMessageSchema,
32
26
  getUserResultMessageSchema,
33
27
  listUsersResultMessageSchema,
34
28
  openPageResultMessageSchema,
35
29
  openExternalUrlResultMessageSchema,
36
- updatePageResultMessageSchema,
37
30
  invalidSandboxMessageSchema,
38
31
  ]);
32
+ export const hostToSandboxMessageSchema = v.variant("type", [
33
+ ...baseHostToSandboxMessageSchema.options,
34
+ queryDataSourceResultMessageSchema,
35
+ getPageResultMessageSchema,
36
+ createPageResultMessageSchema,
37
+ updatePageResultMessageSchema,
38
+ ]);
39
+ /**
40
+ * Discriminated union of every message the host is allowed to send the sandbox.
41
+ */
42
+ export const hostToSandboxMessageLegacySchema = v.variant("type", [
43
+ ...baseHostToSandboxMessageSchema.options,
44
+ queryDataSourceResultMessageLegacySchema,
45
+ getPageResultMessageLegacySchema,
46
+ createPageResultMessageLegacySchema,
47
+ updatePageResultMessageLegacySchema,
48
+ ]);
@@ -15,11 +15,269 @@ export declare const queryDataSourceResultMessageSchema: v.VariantSchema<"status
15
15
  readonly type: v.LiteralSchema<"queryDataSourceResult", undefined>;
16
16
  readonly subscriptionId: v.StringSchema<undefined>;
17
17
  readonly status: v.LiteralSchema<"success", undefined>;
18
- readonly items: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
18
+ readonly items: v.ArraySchema<v.ObjectSchema<{
19
+ readonly object: v.LiteralSchema<"page", undefined>;
19
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>;
20
241
  readonly is_archived: v.BooleanSchema<undefined>;
21
242
  readonly in_trash: v.BooleanSchema<undefined>;
22
- readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
243
+ }, undefined>, undefined>;
244
+ readonly hasMore: v.BooleanSchema<undefined>;
245
+ }, undefined>, v.ObjectSchema<{
246
+ readonly type: v.LiteralSchema<"queryDataSourceResult", undefined>;
247
+ readonly subscriptionId: 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 queryDataSourceResultMessageLegacySchema: v.VariantSchema<"status", [v.ObjectSchema<{
256
+ readonly type: v.LiteralSchema<"queryDataSourceResult", undefined>;
257
+ readonly subscriptionId: v.StringSchema<undefined>;
258
+ readonly status: v.LiteralSchema<"success", undefined>;
259
+ readonly items: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
260
+ readonly object: v.LiteralSchema<"page", undefined>;
261
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
262
+ readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
263
+ readonly type: v.LiteralSchema<"page_id", undefined>;
264
+ readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
265
+ }, undefined>, v.ObjectSchema<{
266
+ readonly type: v.LiteralSchema<"data_source_id", undefined>;
267
+ readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
268
+ }, undefined>, v.ObjectSchema<{
269
+ readonly type: v.LiteralSchema<"workspace", undefined>;
270
+ readonly workspace: v.LiteralSchema<true, undefined>;
271
+ }, undefined>, v.ObjectSchema<{
272
+ readonly type: v.LiteralSchema<"block_id", undefined>;
273
+ readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
274
+ }, undefined>, v.ObjectSchema<{
275
+ readonly type: v.LiteralSchema<"agent_id", undefined>;
276
+ readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
277
+ }, undefined>, v.ObjectSchema<{
278
+ readonly type: v.LiteralSchema<"unavailable", undefined>;
279
+ }, undefined>], undefined>;
280
+ readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
23
281
  readonly id: v.StringSchema<undefined>;
24
282
  readonly type: v.LiteralSchema<"title", undefined>;
25
283
  readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
@@ -172,6 +430,57 @@ export declare const queryDataSourceResultMessageSchema: v.VariantSchema<"status
172
430
  readonly type: v.LiteralSchema<"last_visited_time", undefined>;
173
431
  readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
174
432
  }, undefined>], undefined>, undefined>, undefined>;
433
+ readonly created_by: v.OptionalSchema<v.NullableSchema<v.ObjectSchema<{
434
+ readonly id: v.StringSchema<undefined>;
435
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
436
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
437
+ }, undefined>, undefined>, null>;
438
+ readonly last_edited_by: v.OptionalSchema<v.NullableSchema<v.ObjectSchema<{
439
+ readonly id: v.StringSchema<undefined>;
440
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
441
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
442
+ }, undefined>, undefined>, null>;
443
+ readonly last_visited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
444
+ readonly created_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
445
+ readonly last_edited_time: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
446
+ readonly icon: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
447
+ readonly type: v.LiteralSchema<"emoji", undefined>;
448
+ readonly emoji: v.StringSchema<undefined>;
449
+ }, undefined>, v.ObjectSchema<{
450
+ readonly type: v.LiteralSchema<"custom_emoji", undefined>;
451
+ readonly custom_emoji: v.ObjectSchema<{
452
+ readonly id: v.StringSchema<undefined>;
453
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
454
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
455
+ }, undefined>;
456
+ }, undefined>, v.ObjectSchema<{
457
+ readonly type: v.LiteralSchema<"external", undefined>;
458
+ readonly external: v.ObjectSchema<{
459
+ readonly url: v.StringSchema<undefined>;
460
+ }, undefined>;
461
+ }, undefined>, v.ObjectSchema<{
462
+ readonly type: v.LiteralSchema<"file", undefined>;
463
+ readonly file: v.ObjectSchema<{
464
+ readonly url: v.StringSchema<undefined>;
465
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
466
+ }, undefined>;
467
+ }, undefined>], undefined>, undefined>, null>;
468
+ readonly cover: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.ObjectSchema<{
469
+ readonly type: v.LiteralSchema<"external", undefined>;
470
+ readonly external: v.ObjectSchema<{
471
+ readonly url: v.StringSchema<undefined>;
472
+ }, undefined>;
473
+ }, undefined>, v.ObjectSchema<{
474
+ readonly type: v.LiteralSchema<"file", undefined>;
475
+ readonly file: v.ObjectSchema<{
476
+ readonly url: v.StringSchema<undefined>;
477
+ readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
478
+ }, undefined>;
479
+ }, undefined>], undefined>, undefined>, null>;
480
+ readonly url: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
481
+ readonly public_url: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
482
+ readonly is_archived: v.BooleanSchema<undefined>;
483
+ readonly in_trash: v.BooleanSchema<undefined>;
175
484
  }, undefined>, v.ObjectSchema<{
176
485
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
177
486
  readonly is_archived: v.BooleanSchema<undefined>;
@@ -250,3 +559,4 @@ export declare const queryDataSourceResultMessageSchema: v.VariantSchema<"status
250
559
  }, undefined>;
251
560
  }, undefined>], undefined>;
252
561
  export type QueryDataSourceResultMessage = v.InferOutput<typeof queryDataSourceResultMessageSchema>;
562
+ export type QueryDataSourceResultMessageLegacy = v.InferOutput<typeof queryDataSourceResultMessageLegacySchema>;
@@ -1,5 +1,6 @@
1
1
  import * as v from "valibot";
2
- import { legacyNotionDataSourcePageBridgeSchema, notionDataSourcePageBridgeSchema, } from "../dataSources/dataSourcePage.js";
2
+ import { legacyNotionDataSourcePageBridgeSchema } from "../dataSources/dataSourcePage.js";
3
+ import { notionPageDataSchema } from "../pages/page.js";
3
4
  // The schema accepts any string code. The type lists known codes for
4
5
  // autocomplete, with an open string fallback for newer senders.
5
6
  export const customBlockQueryDataSourceErrorCodeSchema = v.string();
@@ -16,10 +17,22 @@ export const queryDataSourceResultMessageSchema = v.variant("status", [
16
17
  type: v.literal("queryDataSourceResult"),
17
18
  subscriptionId: v.string(),
18
19
  status: v.literal("success"),
19
- items: v.array(v.union([
20
- notionDataSourcePageBridgeSchema,
21
- legacyNotionDataSourcePageBridgeSchema,
22
- ])),
20
+ items: v.array(notionPageDataSchema),
21
+ hasMore: v.boolean(),
22
+ }),
23
+ v.object({
24
+ type: v.literal("queryDataSourceResult"),
25
+ subscriptionId: v.string(),
26
+ status: v.literal("error"),
27
+ error: customBlockQueryDataSourceErrorInfoSchema,
28
+ }),
29
+ ]);
30
+ export const queryDataSourceResultMessageLegacySchema = v.variant("status", [
31
+ v.object({
32
+ type: v.literal("queryDataSourceResult"),
33
+ subscriptionId: v.string(),
34
+ status: v.literal("success"),
35
+ items: v.array(v.union([notionPageDataSchema, legacyNotionDataSourcePageBridgeSchema])),
23
36
  hasMore: v.boolean(),
24
37
  }),
25
38
  v.object({
@@ -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>;
@@ -767,6 +768,7 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
767
768
  readonly type: v.LiteralSchema<"updatePage", undefined>;
768
769
  readonly requestId: v.StringSchema<undefined>;
769
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>;
770
772
  readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
771
773
  readonly id: v.StringSchema<undefined>;
772
774
  readonly type: v.LiteralSchema<"title", undefined>;
@@ -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()),