@notionhq/custom-blocks-host 0.4.3 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/browser.js +1 -1
- package/dist/context/initialState.d.ts +5 -13
- package/dist/context/initialState.d.ts.map +1 -1
- package/dist/createCustomBlockHost.d.ts +22 -11
- package/dist/createCustomBlockHost.d.ts.map +1 -1
- package/dist/createCustomBlockHost.js +9 -4
- package/dist/dataSources/types.d.ts +7 -3
- package/dist/dataSources/types.d.ts.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/manifest/types.d.ts +3 -7
- package/dist/manifest/types.d.ts.map +1 -1
- package/dist/messages/handlers.d.ts +10 -9
- package/dist/messages/handlers.d.ts.map +1 -1
- package/dist/messages/result.d.ts +12 -0
- package/dist/messages/result.d.ts.map +1 -0
- package/dist/messages/result.js +1 -0
- package/dist/navigation/types.d.ts +1 -3
- package/dist/navigation/types.d.ts.map +1 -1
- package/dist/pages/types.d.ts +12 -14
- package/dist/pages/types.d.ts.map +1 -1
- package/dist/protocol/context/parent.d.ts +2 -0
- package/dist/protocol/index.d.ts +1 -1
- package/dist/protocol/pages/makeBridgePage.d.ts +3 -1
- package/dist/protocol/users/makeBridgeUser.d.ts +3 -1
- package/dist/users/types.d.ts +11 -5
- package/dist/users/types.d.ts.map +1 -1
- package/docs/handlers.md +15 -7
- package/docs/lifecycle.md +14 -0
- package/package.json +1 -1
- package/src/context/initialState.ts +7 -16
- package/src/createCustomBlockHost.ts +40 -21
- package/src/dataSources/types.ts +8 -11
- package/src/index.ts +5 -6
- package/src/manifest/types.ts +4 -4
- package/src/messages/handlers.ts +11 -19
- package/src/messages/result.ts +11 -0
- package/src/navigation/types.ts +1 -11
- package/src/pages/types.ts +13 -46
- package/src/users/types.ts +12 -21
package/src/pages/types.ts
CHANGED
|
@@ -1,50 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "@notionhq/custom-blocks-protocol/pages/messages/createPage.js"
|
|
7
|
-
import type {
|
|
8
|
-
CustomBlockGetPageErrorInfo,
|
|
9
|
-
getPageMessageSchema,
|
|
10
|
-
getPageResultMessageSchema,
|
|
11
|
-
} from "@notionhq/custom-blocks-protocol/pages/messages/getPage.js"
|
|
12
|
-
import type {
|
|
13
|
-
CustomBlockOpenPageErrorInfo,
|
|
14
|
-
openPageMessageSchema,
|
|
15
|
-
openPageResultMessageSchema,
|
|
16
|
-
} from "@notionhq/custom-blocks-protocol/pages/messages/openPage.js"
|
|
17
|
-
import type {
|
|
18
|
-
CustomBlockUpdatePageErrorInfo,
|
|
19
|
-
updatePageMessageSchema,
|
|
20
|
-
updatePageResultMessageSchema,
|
|
21
|
-
} from "@notionhq/custom-blocks-protocol/pages/messages/updatePage.js"
|
|
1
|
+
import type { BridgePage } from "@notionhq/custom-blocks-protocol/pages/bridgePage.js"
|
|
2
|
+
import type { createPageMessageSchema } from "@notionhq/custom-blocks-protocol/pages/messages/createPage.js"
|
|
3
|
+
import type { getPageMessageSchema } from "@notionhq/custom-blocks-protocol/pages/messages/getPage.js"
|
|
4
|
+
import type { openPageMessageSchema } from "@notionhq/custom-blocks-protocol/pages/messages/openPage.js"
|
|
5
|
+
import type { updatePageMessageSchema } from "@notionhq/custom-blocks-protocol/pages/messages/updatePage.js"
|
|
22
6
|
import type { InferInput } from "valibot"
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Host results use InferInput so adapters can return plain string IDs.
|
|
26
|
-
* The runtime validates results before sending them and assigns protocol ID brands.
|
|
27
|
-
* Handler requests use parsed protocol types, whose IDs are already branded.
|
|
28
|
-
*/
|
|
29
|
-
export type CustomBlockHostCreatePageResult = BridgeMessagePayload<
|
|
30
|
-
InferInput<typeof createPageResultMessageSchema>,
|
|
31
|
-
CustomBlockCreatePageErrorInfo
|
|
32
|
-
>
|
|
33
|
-
|
|
34
|
-
export type CustomBlockHostGetPageResult = BridgeMessagePayload<
|
|
35
|
-
InferInput<typeof getPageResultMessageSchema>,
|
|
36
|
-
CustomBlockGetPageErrorInfo
|
|
37
|
-
>
|
|
38
|
-
|
|
39
|
-
export type CustomBlockHostUpdatePageResult = BridgeMessagePayload<
|
|
40
|
-
InferInput<typeof updatePageResultMessageSchema>,
|
|
41
|
-
CustomBlockUpdatePageErrorInfo
|
|
42
|
-
>
|
|
43
|
-
|
|
44
|
-
export type CustomBlockHostOpenPageResult = BridgeMessagePayload<
|
|
45
|
-
InferInput<typeof openPageResultMessageSchema>,
|
|
46
|
-
CustomBlockOpenPageErrorInfo
|
|
47
|
-
>
|
|
7
|
+
import type { CustomBlockHostResult } from "../messages/result.js"
|
|
48
8
|
|
|
49
9
|
export type CreatePageMessageInput = InferInput<typeof createPageMessageSchema>
|
|
50
10
|
|
|
@@ -53,3 +13,10 @@ export type GetPageMessageInput = InferInput<typeof getPageMessageSchema>
|
|
|
53
13
|
export type OpenPageMessageInput = InferInput<typeof openPageMessageSchema>
|
|
54
14
|
|
|
55
15
|
export type UpdatePageMessageInput = InferInput<typeof updatePageMessageSchema>
|
|
16
|
+
|
|
17
|
+
export type CustomBlockHostPageResult = CustomBlockHostResult<{
|
|
18
|
+
page: BridgePage
|
|
19
|
+
}>
|
|
20
|
+
export type CustomBlockHostOpenPageResult = CustomBlockHostResult<{
|
|
21
|
+
pageId: string
|
|
22
|
+
}>
|
package/src/users/types.ts
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
getUserResultMessageSchema,
|
|
6
|
-
} from "@notionhq/custom-blocks-protocol/users/messages/getUser.js"
|
|
7
|
-
import type {
|
|
8
|
-
CustomBlockListUsersErrorInfo,
|
|
9
|
-
listUsersMessageSchema,
|
|
10
|
-
listUsersResultMessageSchema,
|
|
11
|
-
} from "@notionhq/custom-blocks-protocol/users/messages/listUsers.js"
|
|
1
|
+
import type { BridgeUser } from "@notionhq/custom-blocks-protocol/users/bridgeUser.js"
|
|
2
|
+
import type { BridgeUserList } from "@notionhq/custom-blocks-protocol/users/bridgeUserList.js"
|
|
3
|
+
import type { getUserMessageSchema } from "@notionhq/custom-blocks-protocol/users/messages/getUser.js"
|
|
4
|
+
import type { listUsersMessageSchema } from "@notionhq/custom-blocks-protocol/users/messages/listUsers.js"
|
|
12
5
|
import type { InferInput } from "valibot"
|
|
13
|
-
|
|
14
|
-
export type CustomBlockHostGetUserResult = BridgeMessagePayload<
|
|
15
|
-
InferInput<typeof getUserResultMessageSchema>,
|
|
16
|
-
CustomBlockGetUserErrorInfo
|
|
17
|
-
>
|
|
18
|
-
|
|
19
|
-
export type CustomBlockHostListUsersResult = BridgeMessagePayload<
|
|
20
|
-
InferInput<typeof listUsersResultMessageSchema>,
|
|
21
|
-
CustomBlockListUsersErrorInfo
|
|
22
|
-
>
|
|
6
|
+
import type { CustomBlockHostResult } from "../messages/result.js"
|
|
23
7
|
|
|
24
8
|
export type GetUserMessageInput = InferInput<typeof getUserMessageSchema>
|
|
25
9
|
|
|
26
10
|
export type ListUsersMessageInput = InferInput<typeof listUsersMessageSchema>
|
|
11
|
+
|
|
12
|
+
export type CustomBlockHostUserResult = CustomBlockHostResult<{
|
|
13
|
+
user: BridgeUser
|
|
14
|
+
}>
|
|
15
|
+
export type CustomBlockHostUserListResult = CustomBlockHostResult<{
|
|
16
|
+
list: BridgeUserList
|
|
17
|
+
}>
|