@notionhq/custom-blocks 0.1.16 → 0.1.18
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/bridge/SandboxBridge.d.ts +3 -3
- package/dist/bridge/SandboxBridge.d.ts.map +1 -1
- package/dist/bridge/SandboxBridge.js +7 -5
- package/dist/bridge/dataSources/resolveProperty.d.ts +2 -1
- package/dist/bridge/dataSources/resolveProperty.d.ts.map +1 -1
- package/dist/bridge/hostState.d.ts +2 -1
- package/dist/bridge/hostState.d.ts.map +1 -1
- package/dist/bridge/sandboxClient.d.ts +1 -0
- package/dist/bridge/sandboxClient.d.ts.map +1 -1
- package/dist/bridge/sandboxClient.js +26 -17
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +1 -0
- package/dist/protocol/dataSources/dataSource.d.ts +12 -12
- package/dist/protocol/dataSources/dataSourcePage.d.ts +1 -52
- package/dist/protocol/dataSources/dataSourcePage.d.ts.map +1 -1
- package/dist/protocol/dataSources/dataSourcePage.js +1 -3
- package/dist/protocol/ids.d.ts +10 -26
- package/dist/protocol/ids.d.ts.map +1 -1
- package/dist/protocol/ids.js +25 -5
- package/dist/protocol/messages/createPage.d.ts +8 -8
- package/dist/protocol/messages/createPageResult.d.ts +5 -5
- package/dist/protocol/messages/currentUserChanged.d.ts +1 -1
- package/dist/protocol/messages/dataSourcesChanged.d.ts +3 -3
- package/dist/protocol/messages/getPage.d.ts +6 -6
- package/dist/protocol/messages/getUser.d.ts +2 -2
- package/dist/protocol/messages/getUser.js +2 -2
- package/dist/protocol/messages/hostToSandbox.d.ts +45 -45
- package/dist/protocol/messages/init.d.ts +14 -14
- package/dist/protocol/messages/listUsers.d.ts +1 -1
- package/dist/protocol/messages/pageChanged.d.ts +5 -5
- package/dist/protocol/messages/parentChanged.d.ts +4 -4
- package/dist/protocol/messages/queryDataSource.d.ts +1 -1
- package/dist/protocol/messages/queryDataSourceResult.d.ts +1 -1
- package/dist/protocol/messages/sandboxToHost.d.ts +8 -8
- package/dist/protocol/messages/updatePage.d.ts +1 -1
- package/dist/protocol/messages/updatePageResult.d.ts +5 -5
- package/dist/protocol/pages/page.d.ts +10 -24
- package/dist/protocol/pages/page.d.ts.map +1 -1
- package/dist/protocol/parent.d.ts +4 -4
- package/dist/protocol/users/user.d.ts +4 -7
- package/dist/protocol/users/user.d.ts.map +1 -1
- package/dist/protocol/users/user.js +2 -1
- package/dist/react/standalonePreview.d.ts.map +1 -1
- package/dist/react/standalonePreview.js +3 -1
- package/dist/types.d.ts +64 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/bridge/SandboxBridge.ts +8 -10
- package/src/bridge/dataSources/resolveProperty.ts +2 -4
- package/src/bridge/hostState.ts +6 -6
- package/src/bridge/sandboxClient.ts +28 -17
- package/src/index.ts +0 -8
- package/src/init.ts +1 -0
- package/src/react/standalonePreview.ts +3 -1
- package/src/types.ts +72 -10
|
@@ -55,17 +55,17 @@ export declare const sandboxToHostMessageSchema: v.UnionSchema<[v.VariantSchema<
|
|
|
55
55
|
}, undefined>], undefined>, v.ObjectSchema<{
|
|
56
56
|
readonly type: v.LiteralSchema<"queryDataSource", undefined>;
|
|
57
57
|
readonly subscriptionId: v.StringSchema<undefined>;
|
|
58
|
-
readonly dataSourceId: v.
|
|
58
|
+
readonly dataSourceId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
59
59
|
readonly limit: v.NumberSchema<undefined>;
|
|
60
60
|
}, undefined>, v.ObjectSchema<{
|
|
61
61
|
readonly type: v.LiteralSchema<"createPage", undefined>;
|
|
62
62
|
readonly requestId: v.StringSchema<undefined>;
|
|
63
63
|
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
64
64
|
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
65
|
-
readonly page_id: v.
|
|
65
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
66
66
|
}, undefined>, v.ObjectSchema<{
|
|
67
67
|
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
68
|
-
readonly data_source_id: v.
|
|
68
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
69
69
|
}, undefined>], undefined>;
|
|
70
70
|
readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
71
71
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
@@ -198,19 +198,19 @@ export declare const sandboxToHostMessageSchema: v.UnionSchema<[v.VariantSchema<
|
|
|
198
198
|
readonly type: v.LiteralSchema<"end", undefined>;
|
|
199
199
|
}, undefined>, v.ObjectSchema<{
|
|
200
200
|
readonly type: v.LiteralSchema<"before", undefined>;
|
|
201
|
-
readonly blockId: v.
|
|
201
|
+
readonly blockId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
202
202
|
}, undefined>, v.ObjectSchema<{
|
|
203
203
|
readonly type: v.LiteralSchema<"after", undefined>;
|
|
204
|
-
readonly blockId: v.
|
|
204
|
+
readonly blockId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
205
205
|
}, undefined>], undefined>, undefined>;
|
|
206
206
|
}, undefined>, v.ObjectSchema<{
|
|
207
207
|
readonly type: v.LiteralSchema<"getPage", undefined>;
|
|
208
208
|
readonly requestId: v.StringSchema<undefined>;
|
|
209
|
-
readonly pageId: v.
|
|
209
|
+
readonly pageId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
210
210
|
}, undefined>, v.ObjectSchema<{
|
|
211
211
|
readonly type: v.LiteralSchema<"getUser", undefined>;
|
|
212
212
|
readonly requestId: v.StringSchema<undefined>;
|
|
213
|
-
readonly userId: v.StringSchema<undefined>;
|
|
213
|
+
readonly userId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionUserId">]>;
|
|
214
214
|
}, undefined>, v.ObjectSchema<{
|
|
215
215
|
readonly type: v.LiteralSchema<"listUsers", undefined>;
|
|
216
216
|
readonly requestId: v.StringSchema<undefined>;
|
|
@@ -219,7 +219,7 @@ export declare const sandboxToHostMessageSchema: v.UnionSchema<[v.VariantSchema<
|
|
|
219
219
|
}, undefined>, v.ObjectSchema<{
|
|
220
220
|
readonly type: v.LiteralSchema<"updatePage", undefined>;
|
|
221
221
|
readonly requestId: v.StringSchema<undefined>;
|
|
222
|
-
readonly pageId: v.
|
|
222
|
+
readonly pageId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
223
223
|
readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
224
224
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
225
225
|
readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
|
|
@@ -5,7 +5,7 @@ import * as v from "valibot";
|
|
|
5
5
|
export declare const updatePageMessageSchema: v.ObjectSchema<{
|
|
6
6
|
readonly type: v.LiteralSchema<"updatePage", undefined>;
|
|
7
7
|
readonly requestId: v.StringSchema<undefined>;
|
|
8
|
-
readonly pageId: v.
|
|
8
|
+
readonly pageId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
9
9
|
readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
10
10
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
11
11
|
readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
|
|
@@ -17,22 +17,22 @@ export declare const updatePageResultMessageSchema: v.VariantSchema<"status", [v
|
|
|
17
17
|
readonly status: v.LiteralSchema<"success", undefined>;
|
|
18
18
|
readonly page: v.ObjectSchema<{
|
|
19
19
|
readonly object: v.LiteralSchema<"page", undefined>;
|
|
20
|
-
readonly id: v.
|
|
20
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
21
21
|
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
22
22
|
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
23
|
-
readonly page_id: v.
|
|
23
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
24
24
|
}, undefined>, v.ObjectSchema<{
|
|
25
25
|
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
26
|
-
readonly data_source_id: v.
|
|
26
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
27
27
|
}, undefined>, v.ObjectSchema<{
|
|
28
28
|
readonly type: v.LiteralSchema<"workspace", undefined>;
|
|
29
29
|
readonly workspace: v.LiteralSchema<true, undefined>;
|
|
30
30
|
}, undefined>, v.ObjectSchema<{
|
|
31
31
|
readonly type: v.LiteralSchema<"block_id", undefined>;
|
|
32
|
-
readonly block_id: v.
|
|
32
|
+
readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
33
33
|
}, undefined>, v.ObjectSchema<{
|
|
34
34
|
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
35
|
-
readonly agent_id: v.
|
|
35
|
+
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
36
36
|
}, undefined>], undefined>;
|
|
37
37
|
readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
38
38
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
@@ -10,7 +10,7 @@ export type { NotionPageId } from "../ids.js";
|
|
|
10
10
|
* The custom block's nearest enclosing page ancestor, carried in `init.page` and `pageChanged`.
|
|
11
11
|
*/
|
|
12
12
|
export declare const customBlockPageSchema: v.ObjectSchema<{
|
|
13
|
-
readonly id: v.
|
|
13
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
14
14
|
/**
|
|
15
15
|
* The containing page's own parent. It lets a block distinguish a freestanding page from a
|
|
16
16
|
* database row without a round trip. Not to be confused with the top-level `parent` runtime
|
|
@@ -18,19 +18,19 @@ export declare const customBlockPageSchema: v.ObjectSchema<{
|
|
|
18
18
|
*/
|
|
19
19
|
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
20
20
|
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
21
|
-
readonly page_id: v.
|
|
21
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
22
22
|
}, undefined>, v.ObjectSchema<{
|
|
23
23
|
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
24
|
-
readonly data_source_id: v.
|
|
24
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
25
25
|
}, undefined>, v.ObjectSchema<{
|
|
26
26
|
readonly type: v.LiteralSchema<"workspace", undefined>;
|
|
27
27
|
readonly workspace: v.LiteralSchema<true, undefined>;
|
|
28
28
|
}, undefined>, v.ObjectSchema<{
|
|
29
29
|
readonly type: v.LiteralSchema<"block_id", undefined>;
|
|
30
|
-
readonly block_id: v.
|
|
30
|
+
readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
31
31
|
}, undefined>, v.ObjectSchema<{
|
|
32
32
|
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
33
|
-
readonly agent_id: v.
|
|
33
|
+
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
34
34
|
}, undefined>], undefined>;
|
|
35
35
|
}, undefined>;
|
|
36
36
|
export type CustomBlockPage = v.InferOutput<typeof customBlockPageSchema>;
|
|
@@ -281,20 +281,6 @@ export declare const notionPagePropertyValueSchema: v.VariantSchema<"type", [v.O
|
|
|
281
281
|
readonly id: v.StringSchema<undefined>;
|
|
282
282
|
}, undefined>], undefined>;
|
|
283
283
|
export type NotionPagePropertyValue = v.InferOutput<typeof notionPagePropertyValueSchema>;
|
|
284
|
-
type WithOptionalPropertyId<T> = T extends {
|
|
285
|
-
id: string;
|
|
286
|
-
} ? Omit<T, "id"> & {
|
|
287
|
-
id?: string;
|
|
288
|
-
} : never;
|
|
289
|
-
/**
|
|
290
|
-
* Public SDK page property write input. Keys may be raw property IDs or data source
|
|
291
|
-
* property keys. `id` is optional because the SDK resolves the final raw property ID
|
|
292
|
-
* from the map key before sending the bridge message.
|
|
293
|
-
*/
|
|
294
|
-
export type NotionPagePropertyInputValue = WithOptionalPropertyId<NotionPagePropertyValue>;
|
|
295
|
-
export type NotionPagePropertyInputMap = {
|
|
296
|
-
[propertyIdOrKey: string]: NotionPagePropertyInputValue;
|
|
297
|
-
};
|
|
298
284
|
export declare const notionPagePropertyWriteMapSchema: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
299
285
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
300
286
|
readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
|
|
@@ -426,22 +412,22 @@ export type NotionPagePropertyWriteMap = v.InferOutput<typeof notionPageProperty
|
|
|
426
412
|
*/
|
|
427
413
|
export declare const notionPageSchema: v.ObjectSchema<{
|
|
428
414
|
readonly object: v.LiteralSchema<"page", undefined>;
|
|
429
|
-
readonly id: v.
|
|
415
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
430
416
|
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
431
417
|
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
432
|
-
readonly page_id: v.
|
|
418
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
433
419
|
}, undefined>, v.ObjectSchema<{
|
|
434
420
|
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
435
|
-
readonly data_source_id: v.
|
|
421
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
436
422
|
}, undefined>, v.ObjectSchema<{
|
|
437
423
|
readonly type: v.LiteralSchema<"workspace", undefined>;
|
|
438
424
|
readonly workspace: v.LiteralSchema<true, undefined>;
|
|
439
425
|
}, undefined>, v.ObjectSchema<{
|
|
440
426
|
readonly type: v.LiteralSchema<"block_id", undefined>;
|
|
441
|
-
readonly block_id: v.
|
|
427
|
+
readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
442
428
|
}, undefined>, v.ObjectSchema<{
|
|
443
429
|
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
444
|
-
readonly agent_id: v.
|
|
430
|
+
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
445
431
|
}, undefined>], undefined>;
|
|
446
432
|
readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
447
433
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/protocol/src/pages/page.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C;;GAEG;AACH,eAAO,MAAM,qBAAqB;;IAEjC;;;;OAIG;;;;;;;;;;;;;;;;;aAEF,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE,eAAO,MAAM,qBAAqB;;;aAGhC,CAAA;AACF,eAAO,MAAM,2BAA2B;;;;;;;aAOtC,CAAA;AACF,eAAO,MAAM,wBAAwB;;;;;aAGnC,CAAA;AACF,eAAO,MAAM,sBAAsB;;;;;;aAMjC,CAAA;AAGF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;0BAK/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEvE,eAAO,MAAM,qBAAqB;;;;;;;;;;;0BAGhC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAIzE,QAAA,MAAM,wBAAwB,uEAAoC,CAAA;AAClE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAE/E,QAAA,MAAM,6BAA6B;;;;;;;;;;0BAajC,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAClD,OAAO,6BAA6B,CACpC,CAAA;AAED,QAAA,MAAM,qBAAqB;;;;aAIzB,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;A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AAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAM3E;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA6ExC,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAClD,OAAO,6BAA6B,CACpC,CAAA;AAED,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAG5C,CAAA;AACD,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,WAAW,CACrD,OAAO,gCAAgC,CACvC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAY3B,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
export declare const notionParentSchema: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
3
3
|
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
4
|
-
readonly page_id: v.
|
|
4
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
5
5
|
}, undefined>, v.ObjectSchema<{
|
|
6
6
|
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
7
|
-
readonly data_source_id: v.
|
|
7
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
8
8
|
}, undefined>, v.ObjectSchema<{
|
|
9
9
|
readonly type: v.LiteralSchema<"workspace", undefined>;
|
|
10
10
|
readonly workspace: v.LiteralSchema<true, undefined>;
|
|
11
11
|
}, undefined>, v.ObjectSchema<{
|
|
12
12
|
readonly type: v.LiteralSchema<"block_id", undefined>;
|
|
13
|
-
readonly block_id: v.
|
|
13
|
+
readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
14
14
|
}, undefined>, v.ObjectSchema<{
|
|
15
15
|
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
16
|
-
readonly agent_id: v.
|
|
16
|
+
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
17
17
|
}, undefined>], undefined>;
|
|
18
18
|
/**
|
|
19
19
|
* A record's parent reference.
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
declare const
|
|
3
|
-
export type NotionUserId =
|
|
4
|
-
readonly [notionUserIdBrand]: "NotionUserId";
|
|
5
|
-
};
|
|
2
|
+
export declare const notionUserIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionUserId">]>;
|
|
3
|
+
export type NotionUserId = v.InferOutput<typeof notionUserIdSchema>;
|
|
6
4
|
export declare const notionUserSchema: v.ObjectSchema<{
|
|
7
5
|
readonly object: v.LiteralSchema<"user", undefined>;
|
|
8
|
-
readonly id: v.StringSchema<undefined>;
|
|
6
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionUserId">]>;
|
|
9
7
|
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
10
8
|
readonly avatar_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
11
9
|
readonly type: v.LiteralSchema<"person", undefined>;
|
|
@@ -18,7 +16,7 @@ export declare const notionUserListSchema: v.ObjectSchema<{
|
|
|
18
16
|
readonly object: v.LiteralSchema<"list", undefined>;
|
|
19
17
|
readonly results: v.ArraySchema<v.ObjectSchema<{
|
|
20
18
|
readonly object: v.LiteralSchema<"user", undefined>;
|
|
21
|
-
readonly id: v.StringSchema<undefined>;
|
|
19
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionUserId">]>;
|
|
22
20
|
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
23
21
|
readonly avatar_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
24
22
|
readonly type: v.LiteralSchema<"person", undefined>;
|
|
@@ -32,5 +30,4 @@ export declare const notionUserListSchema: v.ObjectSchema<{
|
|
|
32
30
|
readonly user: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
|
|
33
31
|
}, undefined>;
|
|
34
32
|
export type NotionUserList = v.InferOutput<typeof notionUserListSchema>;
|
|
35
|
-
export {};
|
|
36
33
|
//# sourceMappingURL=user.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/protocol/src/users/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/protocol/src/users/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,kBAAkB,+FAA8C,CAAA;AAC7E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEnE,eAAO,MAAM,gBAAgB;;;;;;;;;aAS3B,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE/D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;aAO/B,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
+
export const notionUserIdSchema = v.pipe(v.string(), v.brand("NotionUserId"));
|
|
2
3
|
export const notionUserSchema = v.object({
|
|
3
4
|
object: v.literal("user"),
|
|
4
|
-
id:
|
|
5
|
+
id: notionUserIdSchema,
|
|
5
6
|
name: v.optional(v.string()),
|
|
6
7
|
avatar_url: v.nullable(v.string()),
|
|
7
8
|
type: v.literal("person"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalonePreview.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/react/standalonePreview.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"standalonePreview.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/react/standalonePreview.ts"],"names":[],"mappings":"AAaA,wBAAgB,0BAA0B,SAuBzC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { DEFAULT_CONTRAST_MODE } from "../protocol/contrast.js";
|
|
2
2
|
import { notionBlockIdSchema, notionPageIdSchema, } from "../protocol/ids.js";
|
|
3
|
+
import { notionUserIdSchema } from "../protocol/users/user.js";
|
|
3
4
|
import * as v from "valibot";
|
|
4
5
|
import { customBlockHost } from "../bridge/sandboxClient.js";
|
|
5
6
|
const previewBlockId = v.parse(notionBlockIdSchema, "");
|
|
6
7
|
const previewPageId = v.parse(notionPageIdSchema, "");
|
|
8
|
+
const previewUserId = v.parse(notionUserIdSchema, "");
|
|
7
9
|
export function seedStandalonePreviewState() {
|
|
8
10
|
customBlockHost.setMockState({
|
|
9
11
|
type: "init",
|
|
@@ -18,7 +20,7 @@ export function seedStandalonePreviewState() {
|
|
|
18
20
|
dataSources: { bindings: {} },
|
|
19
21
|
currentUser: {
|
|
20
22
|
object: "user",
|
|
21
|
-
id:
|
|
23
|
+
id: previewUserId,
|
|
22
24
|
name: "Preview User",
|
|
23
25
|
avatar_url: null,
|
|
24
26
|
type: "person",
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NotionCollectionSchema } from "./protocol/dataSources/dataSource.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { NotionDataSourceValue } from "./protocol/dataSources/dataSourceValue.js";
|
|
3
3
|
import type { NotionPropertySchema } from "./protocol/dataSources/propertySchema.js";
|
|
4
|
-
import type { NotionDataSourceId } from "./protocol/ids.js";
|
|
4
|
+
import type { NotionDataSourceId, NotionPageId } from "./protocol/ids.js";
|
|
5
5
|
import type { NotionCreatePagePosition } from "./protocol/messages/createPage.js";
|
|
6
6
|
import type { CustomBlockCreatePageErrorInfo } from "./protocol/messages/createPageResult.js";
|
|
7
7
|
import type { CustomBlockGetPageErrorInfo } from "./protocol/messages/getPage.js";
|
|
@@ -10,14 +10,72 @@ import type { CustomBlockListUsersErrorInfo, ListUsersMessage } from "./protocol
|
|
|
10
10
|
import type { CustomBlockQueryDataSourceErrorInfo } from "./protocol/messages/queryDataSourceResult.js";
|
|
11
11
|
import type { UpdatePageMessage } from "./protocol/messages/updatePage.js";
|
|
12
12
|
import type { CustomBlockUpdatePageErrorInfo } from "./protocol/messages/updatePageResult.js";
|
|
13
|
-
import type { NotionPage,
|
|
13
|
+
import type { NotionPage, NotionPageCover, NotionPageIcon, NotionPagePropertyValue } from "./protocol/pages/page.js";
|
|
14
14
|
import type { NotionUser, NotionUserList } from "./protocol/users/user.js";
|
|
15
|
-
export type { NotionDataSourcePageUpdateArgs, NotionDataSourcePageUpdateInput, NotionDataSourcePageUpdateResult, } from "./protocol/dataSources/dataSourcePage.js";
|
|
16
15
|
export type { CustomBlockErrorInfo } from "./protocol/errors.js";
|
|
17
|
-
export type { NotionDataSourceId, NotionSpaceId, } from "./protocol/ids.js";
|
|
18
|
-
export type { NotionPageId } from "./protocol/pages/page.js";
|
|
16
|
+
export type { NotionDataSourceId, NotionPageId, NotionSpaceId, } from "./protocol/ids.js";
|
|
19
17
|
export type { NotionUser, NotionUserId, NotionUserList, } from "./protocol/users/user.js";
|
|
20
18
|
export type { CustomBlockCreatePageErrorInfo, CustomBlockGetPageErrorInfo, CustomBlockGetUserErrorInfo, CustomBlockListUsersErrorInfo, CustomBlockQueryDataSourceErrorInfo, CustomBlockUpdatePageErrorInfo, };
|
|
19
|
+
type WithOptionalPropertyId<T> = T extends {
|
|
20
|
+
id: string;
|
|
21
|
+
} ? Omit<T, "id"> & {
|
|
22
|
+
id?: string;
|
|
23
|
+
} : never;
|
|
24
|
+
/**
|
|
25
|
+
* Public SDK page property write input. Keys may be raw property IDs or data source
|
|
26
|
+
* property keys. `id` is optional because the SDK resolves the final raw property ID
|
|
27
|
+
* from the map key before sending the bridge message.
|
|
28
|
+
*/
|
|
29
|
+
export type NotionPagePropertyInputValue = WithOptionalPropertyId<NotionPagePropertyValue>;
|
|
30
|
+
export type NotionPagePropertyInputMap = {
|
|
31
|
+
[propertyIdOrKey: string]: NotionPagePropertyInputValue;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Consumer-facing page shape returned from `useDataSource`. Derived from the bridge payload
|
|
35
|
+
* plus the data source's `propertyIdsByKey`.
|
|
36
|
+
*/
|
|
37
|
+
export type NotionDataSourcePage = {
|
|
38
|
+
id: NotionPageId;
|
|
39
|
+
/**
|
|
40
|
+
* Keyed mapping of raw property IDs to their value. Includes all properties on the data source,
|
|
41
|
+
* including the four built-ins (`created_time`, `last_edited_time`, `created_by`,
|
|
42
|
+
* `last_edited_by`).
|
|
43
|
+
*/
|
|
44
|
+
propertiesById: {
|
|
45
|
+
[propertyId: string]: NotionDataSourceValue | undefined;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Keyed mapping of user-defined keys to their value. Only includes properties that are mapped
|
|
49
|
+
* to a raw property ID in the data source's `propertyIdsByKey`.
|
|
50
|
+
*/
|
|
51
|
+
propertiesByKey: {
|
|
52
|
+
[key: string]: NotionDataSourceValue | undefined;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Updates this page using the data source's property-key bindings. The SDK resolves property
|
|
56
|
+
* keys to raw property IDs before sending the bridge message to the host.
|
|
57
|
+
*/
|
|
58
|
+
update: (args: NotionDataSourcePageUpdateArgs) => Promise<NotionDataSourcePageUpdateResult>;
|
|
59
|
+
};
|
|
60
|
+
export type NotionDataSourcePageUpdateArgs = {
|
|
61
|
+
properties?: NotionPagePropertyInputMap;
|
|
62
|
+
icon?: NotionPageIcon;
|
|
63
|
+
cover?: NotionPageCover;
|
|
64
|
+
archived?: boolean;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated Use `NotionDataSourcePageUpdateArgs` instead.
|
|
68
|
+
*
|
|
69
|
+
* TODO(custom-blocks): Remove this alias when bumping the SDK version to 0.2.0.
|
|
70
|
+
*/
|
|
71
|
+
export type NotionDataSourcePageUpdateInput = NotionDataSourcePageUpdateArgs;
|
|
72
|
+
export type NotionDataSourcePageUpdateResult = {
|
|
73
|
+
status: "success";
|
|
74
|
+
page: NotionPage;
|
|
75
|
+
} | {
|
|
76
|
+
status: "error";
|
|
77
|
+
error: CustomBlockUpdatePageErrorInfo;
|
|
78
|
+
};
|
|
21
79
|
/**
|
|
22
80
|
* Return shape of `useDataSource`.
|
|
23
81
|
*
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4DAA4D,CAAA;AACxG,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4DAA4D,CAAA;AACxG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iEAAiE,CAAA;AAC5G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gEAAgE,CAAA;AAC1G,OAAO,KAAK,EACX,kBAAkB,EAClB,YAAY,EACZ,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yDAAyD,CAAA;AACvG,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+DAA+D,CAAA;AACnH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAA;AACvG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAA;AACvG,OAAO,KAAK,EACX,6BAA6B,EAC7B,gBAAgB,EAChB,MAAM,wDAAwD,CAAA;AAC/D,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oEAAoE,CAAA;AAC7H,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAA;AAChG,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+DAA+D,CAAA;AACnH,OAAO,KAAK,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,MAAM,gDAAgD,CAAA;AACvD,OAAO,KAAK,EACX,UAAU,EACV,cAAc,EACd,MAAM,gDAAgD,CAAA;AAEvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,4CAA4C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ACtB;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,UAAU,CAAA;CACf,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,2BAA2B,CAAA;CAAE,CAAA"}
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -3,10 +3,6 @@ import type {
|
|
|
3
3
|
NotionDataSource,
|
|
4
4
|
NotionDataSourceBindings,
|
|
5
5
|
} from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
|
|
6
|
-
import type {
|
|
7
|
-
NotionDataSourcePageUpdateArgs,
|
|
8
|
-
NotionDataSourcePageUpdateResult,
|
|
9
|
-
} from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
|
|
10
6
|
import { readIncomingType } from "@notionhq/custom-blocks-protocol/incomingType.js"
|
|
11
7
|
import type { CustomBlockManifest } from "@notionhq/custom-blocks-protocol/manifest.js"
|
|
12
8
|
import type { ConnectMessage } from "@notionhq/custom-blocks-protocol/messages/connect.js"
|
|
@@ -42,6 +38,8 @@ import type {
|
|
|
42
38
|
GetUserResult,
|
|
43
39
|
ListUsersArgs,
|
|
44
40
|
ListUsersResult,
|
|
41
|
+
NotionDataSourcePageUpdateArgs,
|
|
42
|
+
NotionDataSourcePageUpdateResult,
|
|
45
43
|
NotionPageId,
|
|
46
44
|
NotionUserId,
|
|
47
45
|
UpdatePageArgs,
|
|
@@ -100,6 +98,7 @@ export class SandboxBridge {
|
|
|
100
98
|
private initializationId: string | undefined
|
|
101
99
|
private latestDataSourceBindings: NotionDataSourceBindings = {}
|
|
102
100
|
private isMockState = false
|
|
101
|
+
private isListening = false
|
|
103
102
|
private resolveInit: (() => void) | undefined
|
|
104
103
|
private rejectInit: ((reason: Error) => void) | undefined
|
|
105
104
|
private readonly initMessage: Promise<void> = new Promise(
|
|
@@ -109,13 +108,12 @@ export class SandboxBridge {
|
|
|
109
108
|
},
|
|
110
109
|
)
|
|
111
110
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
// the constructor just attaches the listener.
|
|
116
|
-
if (typeof window !== "undefined") {
|
|
117
|
-
window.addEventListener("message", this.handleMessage)
|
|
111
|
+
startListening() {
|
|
112
|
+
if (this.isListening || typeof window === "undefined") {
|
|
113
|
+
return
|
|
118
114
|
}
|
|
115
|
+
this.isListening = true
|
|
116
|
+
window.addEventListener("message", this.handleMessage)
|
|
119
117
|
}
|
|
120
118
|
|
|
121
119
|
private static MAX_LOG_ENTRIES = 100
|
|
@@ -3,12 +3,10 @@ import type {
|
|
|
3
3
|
CustomBlockPropertyErrorCode,
|
|
4
4
|
CustomBlockPropertyErrorInfo,
|
|
5
5
|
} from "@notionhq/custom-blocks-protocol/dataSources/errors.js"
|
|
6
|
-
import type {
|
|
7
|
-
NotionPagePropertyInputMap,
|
|
8
|
-
NotionPagePropertyWriteMap,
|
|
9
|
-
} from "@notionhq/custom-blocks-protocol/pages/page.js"
|
|
6
|
+
import type { NotionPagePropertyWriteMap } from "@notionhq/custom-blocks-protocol/pages/page.js"
|
|
10
7
|
import { notionPagePropertyValueSchema } from "@notionhq/custom-blocks-protocol/pages/page.js"
|
|
11
8
|
import * as v from "valibot"
|
|
9
|
+
import type { NotionPagePropertyInputMap } from "../../types.js"
|
|
12
10
|
|
|
13
11
|
export type {
|
|
14
12
|
CustomBlockPropertyErrorCode,
|
package/src/bridge/hostState.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { NotionContrastMode } from "@notionhq/custom-blocks-protocol/contrast.js"
|
|
2
2
|
import type { NotionDataSource } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
|
|
3
|
-
import type {
|
|
4
|
-
NotionDataSourcePage,
|
|
5
|
-
NotionDataSourcePageBridge,
|
|
6
|
-
NotionDataSourcePageUpdateArgs,
|
|
7
|
-
NotionDataSourcePageUpdateResult,
|
|
8
|
-
} from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
|
|
3
|
+
import type { NotionDataSourcePageBridge } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
|
|
9
4
|
import type { NotionDataSourceValue } from "@notionhq/custom-blocks-protocol/dataSources/dataSourceValue.js"
|
|
10
5
|
import type { NotionPropertySchema } from "@notionhq/custom-blocks-protocol/dataSources/propertySchema.js"
|
|
11
6
|
import type { NotionBlockId } from "@notionhq/custom-blocks-protocol/ids.js"
|
|
@@ -18,6 +13,11 @@ import type {
|
|
|
18
13
|
import type { NotionParent } from "@notionhq/custom-blocks-protocol/parent.js"
|
|
19
14
|
import type { NotionTheme } from "@notionhq/custom-blocks-protocol/theme.js"
|
|
20
15
|
import type { NotionUser } from "@notionhq/custom-blocks-protocol/users/user.js"
|
|
16
|
+
import type {
|
|
17
|
+
NotionDataSourcePage,
|
|
18
|
+
NotionDataSourcePageUpdateArgs,
|
|
19
|
+
NotionDataSourcePageUpdateResult,
|
|
20
|
+
} from "../types.js"
|
|
21
21
|
|
|
22
22
|
export type CustomBlockHostState = UninitializedHostState | InitializedHostState
|
|
23
23
|
|