@notionhq/custom-blocks-host 0.2.19 → 0.2.21
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.
- package/dist/browser.js +1 -1
- package/dist/ids.d.ts +3 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +5 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/protocol/dataSources/dataSourcePage.d.ts +160 -1
- package/dist/protocol/dataSources/dataSourcePage.js +8 -1
- package/dist/protocol/dataSources/propertySchema.d.ts +1 -0
- package/dist/protocol/messages/createPage.d.ts +28 -0
- package/dist/protocol/messages/createPage.js +2 -2
- package/dist/protocol/messages/createPageResult.d.ts +28 -0
- package/dist/protocol/messages/getPage.d.ts +28 -0
- package/dist/protocol/messages/hostToSandbox.d.ts +243 -2
- package/dist/protocol/messages/queryDataSourceResult.d.ts +159 -2
- package/dist/protocol/messages/queryDataSourceResult.js +5 -2
- package/dist/protocol/messages/sandboxToHost.d.ts +56 -0
- package/dist/protocol/messages/updatePage.d.ts +28 -0
- package/dist/protocol/messages/updatePage.js +2 -2
- package/dist/protocol/messages/updatePageResult.d.ts +28 -0
- package/dist/protocol/pages/page.d.ts +89 -2
- package/dist/protocol/pages/page.js +33 -2
- package/dist/protocol/protocolVersion.d.ts +2 -1
- package/dist/protocol/protocolVersion.js +4 -1
- package/package.json +1 -1
- package/src/ids.ts +9 -0
- package/src/index.ts +9 -0
|
@@ -160,6 +160,34 @@ export declare const updatePageResultMessageSchema: v.VariantSchema<"status", [v
|
|
|
160
160
|
readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
161
161
|
readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
162
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>;
|
|
163
191
|
}, undefined>], undefined>, undefined>;
|
|
164
192
|
readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
165
193
|
readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -283,9 +283,37 @@ export declare const notionPagePropertyValueSchema: v.VariantSchema<"type", [v.O
|
|
|
283
283
|
readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
284
284
|
readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
285
285
|
}, undefined>, undefined>;
|
|
286
|
+
}, undefined>, v.ObjectSchema<{
|
|
287
|
+
readonly id: v.StringSchema<undefined>;
|
|
288
|
+
readonly type: v.LiteralSchema<"created_time", undefined>;
|
|
289
|
+
readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
290
|
+
}, undefined>, v.ObjectSchema<{
|
|
291
|
+
readonly id: v.StringSchema<undefined>;
|
|
292
|
+
readonly type: v.LiteralSchema<"last_edited_time", undefined>;
|
|
293
|
+
readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
294
|
+
}, undefined>, v.ObjectSchema<{
|
|
295
|
+
readonly id: v.StringSchema<undefined>;
|
|
296
|
+
readonly type: v.LiteralSchema<"created_by", undefined>;
|
|
297
|
+
readonly created_by: v.NullableSchema<v.ObjectSchema<{
|
|
298
|
+
readonly id: v.StringSchema<undefined>;
|
|
299
|
+
readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
|
|
300
|
+
readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
301
|
+
}, undefined>, undefined>;
|
|
302
|
+
}, undefined>, v.ObjectSchema<{
|
|
303
|
+
readonly id: v.StringSchema<undefined>;
|
|
304
|
+
readonly type: v.LiteralSchema<"last_edited_by", undefined>;
|
|
305
|
+
readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
|
|
306
|
+
readonly id: v.StringSchema<undefined>;
|
|
307
|
+
readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
|
|
308
|
+
readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
309
|
+
}, undefined>, undefined>;
|
|
310
|
+
}, undefined>, v.ObjectSchema<{
|
|
311
|
+
readonly id: v.StringSchema<undefined>;
|
|
312
|
+
readonly type: v.LiteralSchema<"last_visited_time", undefined>;
|
|
313
|
+
readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
286
314
|
}, undefined>], undefined>;
|
|
287
315
|
export type NotionPagePropertyValue = v.InferOutput<typeof notionPagePropertyValueSchema>;
|
|
288
|
-
export declare const
|
|
316
|
+
export declare const notionPagePropertyReadMapSchema: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
289
317
|
readonly id: v.StringSchema<undefined>;
|
|
290
318
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
291
319
|
readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
|
|
@@ -409,8 +437,39 @@ export declare const notionPagePropertyWriteMapSchema: v.RecordSchema<v.StringSc
|
|
|
409
437
|
readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
410
438
|
readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
411
439
|
}, undefined>, undefined>;
|
|
440
|
+
}, undefined>, v.ObjectSchema<{
|
|
441
|
+
readonly id: v.StringSchema<undefined>;
|
|
442
|
+
readonly type: v.LiteralSchema<"created_time", undefined>;
|
|
443
|
+
readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
444
|
+
}, undefined>, v.ObjectSchema<{
|
|
445
|
+
readonly id: v.StringSchema<undefined>;
|
|
446
|
+
readonly type: v.LiteralSchema<"last_edited_time", undefined>;
|
|
447
|
+
readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
448
|
+
}, undefined>, v.ObjectSchema<{
|
|
449
|
+
readonly id: v.StringSchema<undefined>;
|
|
450
|
+
readonly type: v.LiteralSchema<"created_by", undefined>;
|
|
451
|
+
readonly created_by: v.NullableSchema<v.ObjectSchema<{
|
|
452
|
+
readonly id: v.StringSchema<undefined>;
|
|
453
|
+
readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
|
|
454
|
+
readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
455
|
+
}, undefined>, undefined>;
|
|
456
|
+
}, undefined>, v.ObjectSchema<{
|
|
457
|
+
readonly id: v.StringSchema<undefined>;
|
|
458
|
+
readonly type: v.LiteralSchema<"last_edited_by", undefined>;
|
|
459
|
+
readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
|
|
460
|
+
readonly id: v.StringSchema<undefined>;
|
|
461
|
+
readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
|
|
462
|
+
readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
463
|
+
}, undefined>, undefined>;
|
|
464
|
+
}, undefined>, v.ObjectSchema<{
|
|
465
|
+
readonly id: v.StringSchema<undefined>;
|
|
466
|
+
readonly type: v.LiteralSchema<"last_visited_time", undefined>;
|
|
467
|
+
readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
412
468
|
}, undefined>], undefined>, undefined>;
|
|
413
|
-
export type
|
|
469
|
+
export type NotionPagePropertyReadMap = v.InferOutput<typeof notionPagePropertyReadMapSchema>;
|
|
470
|
+
export type NotionPagePropertyWriteMap = Record<string, Exclude<NotionPagePropertyValue, {
|
|
471
|
+
type: "created_time" | "last_edited_time" | "created_by" | "last_edited_by" | "last_visited_time";
|
|
472
|
+
}>>;
|
|
414
473
|
/**
|
|
415
474
|
* The `Page` object returned in `createPageResult` messages.
|
|
416
475
|
*/
|
|
@@ -559,6 +618,34 @@ export declare const notionPageSchema: v.ObjectSchema<{
|
|
|
559
618
|
readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
560
619
|
readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
561
620
|
}, undefined>, undefined>;
|
|
621
|
+
}, undefined>, v.ObjectSchema<{
|
|
622
|
+
readonly id: v.StringSchema<undefined>;
|
|
623
|
+
readonly type: v.LiteralSchema<"created_time", undefined>;
|
|
624
|
+
readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
625
|
+
}, undefined>, v.ObjectSchema<{
|
|
626
|
+
readonly id: v.StringSchema<undefined>;
|
|
627
|
+
readonly type: v.LiteralSchema<"last_edited_time", undefined>;
|
|
628
|
+
readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
629
|
+
}, undefined>, v.ObjectSchema<{
|
|
630
|
+
readonly id: v.StringSchema<undefined>;
|
|
631
|
+
readonly type: v.LiteralSchema<"created_by", undefined>;
|
|
632
|
+
readonly created_by: v.NullableSchema<v.ObjectSchema<{
|
|
633
|
+
readonly id: v.StringSchema<undefined>;
|
|
634
|
+
readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
|
|
635
|
+
readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
636
|
+
}, undefined>, undefined>;
|
|
637
|
+
}, undefined>, v.ObjectSchema<{
|
|
638
|
+
readonly id: v.StringSchema<undefined>;
|
|
639
|
+
readonly type: v.LiteralSchema<"last_edited_by", undefined>;
|
|
640
|
+
readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
|
|
641
|
+
readonly id: v.StringSchema<undefined>;
|
|
642
|
+
readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
|
|
643
|
+
readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
644
|
+
}, undefined>, undefined>;
|
|
645
|
+
}, undefined>, v.ObjectSchema<{
|
|
646
|
+
readonly id: v.StringSchema<undefined>;
|
|
647
|
+
readonly type: v.LiteralSchema<"last_visited_time", undefined>;
|
|
648
|
+
readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
562
649
|
}, undefined>], undefined>, undefined>;
|
|
563
650
|
readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
564
651
|
readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* shape the host delivers for messages like `createPageResult`.
|
|
6
6
|
*/
|
|
7
7
|
import * as v from "valibot";
|
|
8
|
+
import { notionRecordPointerSchema } from "../dataSources/recordPointer.js";
|
|
8
9
|
import { notionPageIdSchema } from "../ids.js";
|
|
9
10
|
import { notionParentSchema } from "../parent.js";
|
|
10
11
|
/**
|
|
@@ -117,6 +118,11 @@ const notionPlaceInputSchema = v.object({
|
|
|
117
118
|
const pagePropertyBaseSchema = {
|
|
118
119
|
id: v.string(),
|
|
119
120
|
};
|
|
121
|
+
const metadataActorSchema = v.nullable(v.object({
|
|
122
|
+
...notionRecordPointerSchema.entries,
|
|
123
|
+
table: v.picklist(["notion_user", "bot", "organization_bot"]),
|
|
124
|
+
spaceId: v.optional(v.string()),
|
|
125
|
+
}));
|
|
120
126
|
/**
|
|
121
127
|
* A page property value.
|
|
122
128
|
*/
|
|
@@ -197,8 +203,33 @@ export const notionPagePropertyValueSchema = v.variant("type", [
|
|
|
197
203
|
type: v.literal("place"),
|
|
198
204
|
place: v.nullable(notionPlaceInputSchema),
|
|
199
205
|
}),
|
|
206
|
+
v.object({
|
|
207
|
+
...pagePropertyBaseSchema,
|
|
208
|
+
type: v.literal("created_time"),
|
|
209
|
+
created_time: nullableStringSchema,
|
|
210
|
+
}),
|
|
211
|
+
v.object({
|
|
212
|
+
...pagePropertyBaseSchema,
|
|
213
|
+
type: v.literal("last_edited_time"),
|
|
214
|
+
last_edited_time: nullableStringSchema,
|
|
215
|
+
}),
|
|
216
|
+
v.object({
|
|
217
|
+
...pagePropertyBaseSchema,
|
|
218
|
+
type: v.literal("created_by"),
|
|
219
|
+
created_by: metadataActorSchema,
|
|
220
|
+
}),
|
|
221
|
+
v.object({
|
|
222
|
+
...pagePropertyBaseSchema,
|
|
223
|
+
type: v.literal("last_edited_by"),
|
|
224
|
+
last_edited_by: metadataActorSchema,
|
|
225
|
+
}),
|
|
226
|
+
v.object({
|
|
227
|
+
...pagePropertyBaseSchema,
|
|
228
|
+
type: v.literal("last_visited_time"),
|
|
229
|
+
last_visited_time: nullableStringSchema,
|
|
230
|
+
}),
|
|
200
231
|
]);
|
|
201
|
-
export const
|
|
232
|
+
export const notionPagePropertyReadMapSchema = v.record(v.string(), notionPagePropertyValueSchema);
|
|
202
233
|
/**
|
|
203
234
|
* The `Page` object returned in `createPageResult` messages.
|
|
204
235
|
*/
|
|
@@ -206,7 +237,7 @@ export const notionPageSchema = v.object({
|
|
|
206
237
|
object: v.literal("page"),
|
|
207
238
|
id: notionPageIdSchema,
|
|
208
239
|
parent: notionParentSchema,
|
|
209
|
-
properties:
|
|
240
|
+
properties: notionPagePropertyReadMapSchema,
|
|
210
241
|
created_time: v.optional(v.string()),
|
|
211
242
|
last_edited_time: v.optional(v.string()),
|
|
212
243
|
icon: v.optional(notionPageIconSchema),
|
|
@@ -3,4 +3,5 @@
|
|
|
3
3
|
* Increase this value for breaking wire changes. Hosts can continue to accept
|
|
4
4
|
* older versions, so this value does not set the minimum or maximum they accept.
|
|
5
5
|
*/
|
|
6
|
-
export declare const LATEST_BRIDGE_PROTOCOL_VERSION =
|
|
6
|
+
export declare const LATEST_BRIDGE_PROTOCOL_VERSION = 6;
|
|
7
|
+
export declare const LEGACY_PROPERTY_SHAPE_PROTOCOL_VERSION = 6;
|
|
@@ -3,4 +3,7 @@
|
|
|
3
3
|
* Increase this value for breaking wire changes. Hosts can continue to accept
|
|
4
4
|
* older versions, so this value does not set the minimum or maximum they accept.
|
|
5
5
|
*/
|
|
6
|
-
export const LATEST_BRIDGE_PROTOCOL_VERSION =
|
|
6
|
+
export const LATEST_BRIDGE_PROTOCOL_VERSION = 6;
|
|
7
|
+
// Protocol 6 introduces name-keyed property objects for data source queries.
|
|
8
|
+
// Keep this cutoff fixed when the latest protocol version increases.
|
|
9
|
+
export const LEGACY_PROPERTY_SHAPE_PROTOCOL_VERSION = 6;
|
package/package.json
CHANGED
package/src/ids.ts
ADDED
package/src/index.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
LegacyNotionDataSourcePageBridge,
|
|
3
|
+
NotionDataSourcePageBridge,
|
|
4
|
+
} from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
|
|
5
|
+
export type { NotionPropertySchemasById } from "@notionhq/custom-blocks-protocol/dataSources/propertySchema.js"
|
|
1
6
|
export type { CustomBlockErrorInfo } from "@notionhq/custom-blocks-protocol/errors.js"
|
|
7
|
+
export type { NotionPageId } from "@notionhq/custom-blocks-protocol/ids.js"
|
|
2
8
|
export type { CreatePageMessage } from "@notionhq/custom-blocks-protocol/messages/createPage.js"
|
|
3
9
|
export type { GetPageMessage } from "@notionhq/custom-blocks-protocol/messages/getPage.js"
|
|
4
10
|
export type { GetUserMessage } from "@notionhq/custom-blocks-protocol/messages/getUser.js"
|
|
@@ -30,11 +36,13 @@ export type {
|
|
|
30
36
|
NotionFileInput,
|
|
31
37
|
NotionPageCover,
|
|
32
38
|
NotionPageIcon,
|
|
39
|
+
NotionPagePropertyReadMap,
|
|
33
40
|
NotionPagePropertyValue,
|
|
34
41
|
NotionPagePropertyWriteMap,
|
|
35
42
|
NotionRichTextItem,
|
|
36
43
|
NotionSelectOptionInput,
|
|
37
44
|
} from "@notionhq/custom-blocks-protocol/pages/page.js"
|
|
45
|
+
export { LEGACY_PROPERTY_SHAPE_PROTOCOL_VERSION } from "@notionhq/custom-blocks-protocol/protocolVersion.js"
|
|
38
46
|
export {
|
|
39
47
|
type AutoBindableProperty,
|
|
40
48
|
getAutoBoundPropertyIdsByKey,
|
|
@@ -44,6 +52,7 @@ export {
|
|
|
44
52
|
type CustomBlockHostOptions,
|
|
45
53
|
createCustomBlockHost,
|
|
46
54
|
} from "./createCustomBlockHost.js"
|
|
55
|
+
export { toNotionPageId } from "./ids.js"
|
|
47
56
|
export type {
|
|
48
57
|
ConnectSuccessMessage,
|
|
49
58
|
CustomBlockHostDataSourcesPayload,
|