@notionhq/custom-blocks 0.1.7 → 0.1.9

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 (298) hide show
  1. package/README.md +14 -1
  2. package/bin/notion-custom-blocks/cli.js +6 -0
  3. package/dist/bridge/SandboxBridge.d.ts +3 -9
  4. package/dist/bridge/SandboxBridge.d.ts.map +1 -1
  5. package/dist/bridge/SandboxBridge.js +5 -10
  6. package/dist/bridge/dataSources/resolve.d.ts +3 -3
  7. package/dist/bridge/dataSources/resolve.d.ts.map +1 -1
  8. package/dist/bridge/dataSources/resolve.js +1 -1
  9. package/dist/bridge/dataSources/resolveProperty.d.ts +6 -9
  10. package/dist/bridge/dataSources/resolveProperty.d.ts.map +1 -1
  11. package/dist/bridge/dataSources/resolveProperty.js +3 -6
  12. package/dist/bridge/hostState.d.ts +11 -11
  13. package/dist/bridge/hostState.d.ts.map +1 -1
  14. package/dist/bridge/loadManifest.d.ts +2 -2
  15. package/dist/bridge/loadManifest.d.ts.map +1 -1
  16. package/dist/bridge/loadManifest.js +1 -1
  17. package/dist/bridge/sandboxClient.d.ts +1 -1
  18. package/dist/bridge/sandboxClient.d.ts.map +1 -1
  19. package/dist/customBlock.d.ts +8 -8
  20. package/dist/customBlock.d.ts.map +1 -1
  21. package/dist/index.d.ts +24 -25
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +2 -2
  24. package/dist/init.d.ts +8 -8
  25. package/dist/init.d.ts.map +1 -1
  26. package/dist/init.js +1 -1
  27. package/dist/protocol/contrast.d.ts.map +1 -0
  28. package/dist/protocol/dataSources/dataSource.d.ts.map +1 -0
  29. package/dist/protocol/dataSources/dataSourcePage.d.ts.map +1 -0
  30. package/dist/protocol/dataSources/dataSourceValue.d.ts.map +1 -0
  31. package/dist/protocol/dataSources/dateValue.d.ts.map +1 -0
  32. package/dist/{bridge → protocol}/dataSources/errors.d.ts +3 -0
  33. package/dist/protocol/dataSources/errors.d.ts.map +1 -0
  34. package/dist/{bridge → protocol}/dataSources/errors.js +3 -0
  35. package/dist/protocol/dataSources/propertySchema.d.ts.map +1 -0
  36. package/dist/protocol/dataSources/recordPointer.d.ts.map +1 -0
  37. package/dist/protocol/errors.d.ts.map +1 -0
  38. package/dist/protocol/ids.d.ts.map +1 -0
  39. package/dist/protocol/incomingType.d.ts.map +1 -0
  40. package/dist/protocol/index.d.ts +48 -0
  41. package/dist/protocol/index.d.ts.map +1 -0
  42. package/dist/protocol/index.js +47 -0
  43. package/dist/protocol/manifest.d.ts.map +1 -0
  44. package/dist/protocol/messages/connect.d.ts.map +1 -0
  45. package/dist/protocol/messages/contrastModeChanged.d.ts.map +1 -0
  46. package/dist/protocol/messages/createPage.d.ts.map +1 -0
  47. package/dist/protocol/messages/createPageResult.d.ts.map +1 -0
  48. package/dist/protocol/messages/currentUserChanged.d.ts.map +1 -0
  49. package/dist/{bridge → protocol}/messages/dataSourcesChanged.d.ts +1 -1
  50. package/dist/protocol/messages/dataSourcesChanged.d.ts.map +1 -0
  51. package/dist/{bridge → protocol}/messages/dataSourcesChanged.js +1 -1
  52. package/dist/protocol/messages/getPage.d.ts.map +1 -0
  53. package/dist/protocol/messages/getUser.d.ts.map +1 -0
  54. package/dist/{bridge → protocol}/messages/hostToSandbox.d.ts.map +1 -1
  55. package/dist/protocol/messages/init.d.ts.map +1 -0
  56. package/dist/protocol/messages/initResult.d.ts.map +1 -0
  57. package/dist/protocol/messages/invalidHostMessage.d.ts.map +1 -0
  58. package/dist/protocol/messages/invalidSandboxMessage.d.ts.map +1 -0
  59. package/dist/protocol/messages/listUsers.d.ts.map +1 -0
  60. package/dist/protocol/messages/pageChanged.d.ts.map +1 -0
  61. package/dist/protocol/messages/parentChanged.d.ts.map +1 -0
  62. package/dist/protocol/messages/queryDataSource.d.ts.map +1 -0
  63. package/dist/protocol/messages/queryDataSourceResult.d.ts.map +1 -0
  64. package/dist/protocol/messages/resize.d.ts.map +1 -0
  65. package/dist/{bridge → protocol}/messages/sandboxToHost.d.ts.map +1 -1
  66. package/dist/protocol/messages/themeChanged.d.ts.map +1 -0
  67. package/dist/protocol/messages/updatePage.d.ts.map +1 -0
  68. package/dist/protocol/messages/updatePageResult.d.ts.map +1 -0
  69. package/dist/{bridge → protocol}/pages/page.d.ts +1 -1
  70. package/dist/protocol/pages/page.d.ts.map +1 -0
  71. package/dist/protocol/parent.d.ts.map +1 -0
  72. package/dist/protocol/protocolVersion.d.ts +7 -0
  73. package/dist/protocol/protocolVersion.d.ts.map +1 -0
  74. package/dist/protocol/protocolVersion.js +6 -0
  75. package/dist/protocol/theme.d.ts.map +1 -0
  76. package/dist/protocol/users/user.d.ts.map +1 -0
  77. package/dist/react/index.d.ts +1 -1
  78. package/dist/react/index.js +1 -1
  79. package/dist/react/standalonePreview.d.ts.map +1 -1
  80. package/dist/react/standalonePreview.js +2 -2
  81. package/dist/react/useCustomBlockInit.d.ts +1 -1
  82. package/dist/react/useCustomBlockInit.d.ts.map +1 -1
  83. package/dist/react/useDataSource.d.ts +1 -1
  84. package/dist/react/useDataSource.js +1 -1
  85. package/dist/react/useRuntimeState.d.ts +9 -9
  86. package/dist/react/useRuntimeState.d.ts.map +1 -1
  87. package/dist/react/useRuntimeState.js +2 -2
  88. package/dist/types.d.ts +19 -18
  89. package/dist/types.d.ts.map +1 -1
  90. package/dist/version.js +1 -1
  91. package/docs/block-location.md +1 -1
  92. package/docs/data-sources.md +1 -1
  93. package/docs/deployment.md +1 -1
  94. package/docs/errors.md +0 -2
  95. package/docs/lifecycle.md +5 -5
  96. package/docs/pages.md +4 -4
  97. package/package.json +3 -7
  98. package/src/bridge/SandboxBridge.ts +36 -42
  99. package/src/bridge/dataSources/resolve.ts +3 -3
  100. package/src/bridge/dataSources/resolveProperty.ts +14 -20
  101. package/src/bridge/hostState.ts +15 -12
  102. package/src/bridge/loadManifest.ts +5 -2
  103. package/src/bridge/sandboxClient.ts +1 -1
  104. package/src/customBlock.ts +8 -8
  105. package/src/index.ts +26 -30
  106. package/src/init.ts +8 -8
  107. package/src/react/index.ts +1 -1
  108. package/src/react/standalonePreview.ts +5 -2
  109. package/src/react/useCustomBlockInit.ts +1 -1
  110. package/src/react/useDataSource.ts +1 -1
  111. package/src/react/useRuntimeState.ts +9 -9
  112. package/src/types.ts +27 -24
  113. package/HOST.md +0 -224
  114. package/dist/bridge/contrast.d.ts.map +0 -1
  115. package/dist/bridge/dataSources/dataSource.d.ts.map +0 -1
  116. package/dist/bridge/dataSources/dataSourcePage.d.ts.map +0 -1
  117. package/dist/bridge/dataSources/dataSourceValue.d.ts.map +0 -1
  118. package/dist/bridge/dataSources/dateValue.d.ts.map +0 -1
  119. package/dist/bridge/dataSources/errors.d.ts.map +0 -1
  120. package/dist/bridge/dataSources/propertySchema.d.ts.map +0 -1
  121. package/dist/bridge/dataSources/recordPointer.d.ts.map +0 -1
  122. package/dist/bridge/errors.d.ts.map +0 -1
  123. package/dist/bridge/ids.d.ts.map +0 -1
  124. package/dist/bridge/incomingType.d.ts.map +0 -1
  125. package/dist/bridge/manifest.d.ts.map +0 -1
  126. package/dist/bridge/messages/connect.d.ts.map +0 -1
  127. package/dist/bridge/messages/contrastModeChanged.d.ts.map +0 -1
  128. package/dist/bridge/messages/createPage.d.ts.map +0 -1
  129. package/dist/bridge/messages/createPageResult.d.ts.map +0 -1
  130. package/dist/bridge/messages/currentUserChanged.d.ts.map +0 -1
  131. package/dist/bridge/messages/dataSourcesChanged.d.ts.map +0 -1
  132. package/dist/bridge/messages/getPage.d.ts.map +0 -1
  133. package/dist/bridge/messages/getUser.d.ts.map +0 -1
  134. package/dist/bridge/messages/init.d.ts.map +0 -1
  135. package/dist/bridge/messages/initResult.d.ts.map +0 -1
  136. package/dist/bridge/messages/invalidHostMessage.d.ts.map +0 -1
  137. package/dist/bridge/messages/invalidSandboxMessage.d.ts.map +0 -1
  138. package/dist/bridge/messages/listUsers.d.ts.map +0 -1
  139. package/dist/bridge/messages/pageChanged.d.ts.map +0 -1
  140. package/dist/bridge/messages/parentChanged.d.ts.map +0 -1
  141. package/dist/bridge/messages/queryDataSource.d.ts.map +0 -1
  142. package/dist/bridge/messages/queryDataSourceResult.d.ts.map +0 -1
  143. package/dist/bridge/messages/resize.d.ts.map +0 -1
  144. package/dist/bridge/messages/themeChanged.d.ts.map +0 -1
  145. package/dist/bridge/messages/updatePage.d.ts.map +0 -1
  146. package/dist/bridge/messages/updatePageResult.d.ts.map +0 -1
  147. package/dist/bridge/pages/page.d.ts.map +0 -1
  148. package/dist/bridge/parent.d.ts.map +0 -1
  149. package/dist/bridge/theme.d.ts.map +0 -1
  150. package/dist/bridge/users/user.d.ts.map +0 -1
  151. package/dist/host/createCustomBlockHost.d.ts +0 -39
  152. package/dist/host/createCustomBlockHost.d.ts.map +0 -1
  153. package/dist/host/createCustomBlockHost.js +0 -495
  154. package/dist/host/lifecycle/initErrors.d.ts +0 -13
  155. package/dist/host/lifecycle/initErrors.d.ts.map +0 -1
  156. package/dist/host/lifecycle/initErrors.js +0 -152
  157. package/dist/host/lifecycle/protocolVersion.d.ts +0 -2
  158. package/dist/host/lifecycle/protocolVersion.d.ts.map +0 -1
  159. package/dist/host/lifecycle/protocolVersion.js +0 -3
  160. package/dist/host/lifecycle/types.d.ts +0 -28
  161. package/dist/host/lifecycle/types.d.ts.map +0 -1
  162. package/dist/host/lifecycle/types.js +0 -1
  163. package/dist/host/messages/invalidSandboxMessage.d.ts +0 -7
  164. package/dist/host/messages/invalidSandboxMessage.d.ts.map +0 -1
  165. package/dist/host/messages/invalidSandboxMessage.js +0 -21
  166. package/dist/host/messages/types.d.ts +0 -60
  167. package/dist/host/messages/types.d.ts.map +0 -1
  168. package/dist/host/messages/types.js +0 -1
  169. package/dist/host/queries/querySubscriptions.d.ts +0 -20
  170. package/dist/host/queries/querySubscriptions.d.ts.map +0 -1
  171. package/dist/host/queries/querySubscriptions.js +0 -45
  172. package/dist/host/queries/types.d.ts +0 -11
  173. package/dist/host/queries/types.d.ts.map +0 -1
  174. package/dist/host/queries/types.js +0 -1
  175. package/dist/host.d.ts +0 -79
  176. package/dist/host.d.ts.map +0 -1
  177. package/dist/host.js +0 -45
  178. package/src/bridge/contrast.ts +0 -6
  179. package/src/bridge/dataSources/dataSource.ts +0 -63
  180. package/src/bridge/dataSources/dataSourcePage.ts +0 -71
  181. package/src/bridge/dataSources/dataSourceValue.ts +0 -19
  182. package/src/bridge/dataSources/dateValue.ts +0 -96
  183. package/src/bridge/dataSources/errors.ts +0 -14
  184. package/src/bridge/dataSources/propertySchema.ts +0 -186
  185. package/src/bridge/dataSources/recordPointer.ts +0 -13
  186. package/src/bridge/errors.ts +0 -21
  187. package/src/bridge/ids.ts +0 -72
  188. package/src/bridge/incomingType.ts +0 -19
  189. package/src/bridge/manifest.ts +0 -47
  190. package/src/bridge/messages/connect.ts +0 -42
  191. package/src/bridge/messages/contrastModeChanged.ts +0 -12
  192. package/src/bridge/messages/createPage.ts +0 -62
  193. package/src/bridge/messages/createPageResult.ts +0 -52
  194. package/src/bridge/messages/currentUserChanged.ts +0 -14
  195. package/src/bridge/messages/dataSourcesChanged.ts +0 -18
  196. package/src/bridge/messages/getPage.ts +0 -51
  197. package/src/bridge/messages/getUser.ts +0 -49
  198. package/src/bridge/messages/hostToSandbox.ts +0 -39
  199. package/src/bridge/messages/init.ts +0 -99
  200. package/src/bridge/messages/initResult.ts +0 -37
  201. package/src/bridge/messages/invalidHostMessage.ts +0 -16
  202. package/src/bridge/messages/invalidSandboxMessage.ts +0 -18
  203. package/src/bridge/messages/listUsers.ts +0 -50
  204. package/src/bridge/messages/pageChanged.ts +0 -12
  205. package/src/bridge/messages/parentChanged.ts +0 -14
  206. package/src/bridge/messages/queryDataSource.ts +0 -20
  207. package/src/bridge/messages/queryDataSourceResult.ts +0 -45
  208. package/src/bridge/messages/resize.ts +0 -13
  209. package/src/bridge/messages/sandboxToHost.ts +0 -32
  210. package/src/bridge/messages/themeChanged.ts +0 -15
  211. package/src/bridge/messages/updatePage.ts +0 -22
  212. package/src/bridge/messages/updatePageResult.ts +0 -49
  213. package/src/bridge/pages/page.ts +0 -290
  214. package/src/bridge/parent.ts +0 -30
  215. package/src/bridge/theme.ts +0 -5
  216. package/src/bridge/users/user.ts +0 -31
  217. package/src/host/createCustomBlockHost.ts +0 -662
  218. package/src/host/lifecycle/initErrors.ts +0 -165
  219. package/src/host/lifecycle/protocolVersion.ts +0 -3
  220. package/src/host/lifecycle/types.ts +0 -40
  221. package/src/host/messages/invalidSandboxMessage.ts +0 -35
  222. package/src/host/messages/types.ts +0 -67
  223. package/src/host/queries/querySubscriptions.ts +0 -71
  224. package/src/host/queries/types.ts +0 -13
  225. package/src/host.ts +0 -182
  226. /package/dist/{bridge → protocol}/contrast.d.ts +0 -0
  227. /package/dist/{bridge → protocol}/contrast.js +0 -0
  228. /package/dist/{bridge → protocol}/dataSources/dataSource.d.ts +0 -0
  229. /package/dist/{bridge → protocol}/dataSources/dataSource.js +0 -0
  230. /package/dist/{bridge → protocol}/dataSources/dataSourcePage.d.ts +0 -0
  231. /package/dist/{bridge → protocol}/dataSources/dataSourcePage.js +0 -0
  232. /package/dist/{bridge → protocol}/dataSources/dataSourceValue.d.ts +0 -0
  233. /package/dist/{bridge → protocol}/dataSources/dataSourceValue.js +0 -0
  234. /package/dist/{bridge → protocol}/dataSources/dateValue.d.ts +0 -0
  235. /package/dist/{bridge → protocol}/dataSources/dateValue.js +0 -0
  236. /package/dist/{bridge → protocol}/dataSources/propertySchema.d.ts +0 -0
  237. /package/dist/{bridge → protocol}/dataSources/propertySchema.js +0 -0
  238. /package/dist/{bridge → protocol}/dataSources/recordPointer.d.ts +0 -0
  239. /package/dist/{bridge → protocol}/dataSources/recordPointer.js +0 -0
  240. /package/dist/{bridge → protocol}/errors.d.ts +0 -0
  241. /package/dist/{bridge → protocol}/errors.js +0 -0
  242. /package/dist/{bridge → protocol}/ids.d.ts +0 -0
  243. /package/dist/{bridge → protocol}/ids.js +0 -0
  244. /package/dist/{bridge → protocol}/incomingType.d.ts +0 -0
  245. /package/dist/{bridge → protocol}/incomingType.js +0 -0
  246. /package/dist/{bridge → protocol}/manifest.d.ts +0 -0
  247. /package/dist/{bridge → protocol}/manifest.js +0 -0
  248. /package/dist/{bridge → protocol}/messages/connect.d.ts +0 -0
  249. /package/dist/{bridge → protocol}/messages/connect.js +0 -0
  250. /package/dist/{bridge → protocol}/messages/contrastModeChanged.d.ts +0 -0
  251. /package/dist/{bridge → protocol}/messages/contrastModeChanged.js +0 -0
  252. /package/dist/{bridge → protocol}/messages/createPage.d.ts +0 -0
  253. /package/dist/{bridge → protocol}/messages/createPage.js +0 -0
  254. /package/dist/{bridge → protocol}/messages/createPageResult.d.ts +0 -0
  255. /package/dist/{bridge → protocol}/messages/createPageResult.js +0 -0
  256. /package/dist/{bridge → protocol}/messages/currentUserChanged.d.ts +0 -0
  257. /package/dist/{bridge → protocol}/messages/currentUserChanged.js +0 -0
  258. /package/dist/{bridge → protocol}/messages/getPage.d.ts +0 -0
  259. /package/dist/{bridge → protocol}/messages/getPage.js +0 -0
  260. /package/dist/{bridge → protocol}/messages/getUser.d.ts +0 -0
  261. /package/dist/{bridge → protocol}/messages/getUser.js +0 -0
  262. /package/dist/{bridge → protocol}/messages/hostToSandbox.d.ts +0 -0
  263. /package/dist/{bridge → protocol}/messages/hostToSandbox.js +0 -0
  264. /package/dist/{bridge → protocol}/messages/init.d.ts +0 -0
  265. /package/dist/{bridge → protocol}/messages/init.js +0 -0
  266. /package/dist/{bridge → protocol}/messages/initResult.d.ts +0 -0
  267. /package/dist/{bridge → protocol}/messages/initResult.js +0 -0
  268. /package/dist/{bridge → protocol}/messages/invalidHostMessage.d.ts +0 -0
  269. /package/dist/{bridge → protocol}/messages/invalidHostMessage.js +0 -0
  270. /package/dist/{bridge → protocol}/messages/invalidSandboxMessage.d.ts +0 -0
  271. /package/dist/{bridge → protocol}/messages/invalidSandboxMessage.js +0 -0
  272. /package/dist/{bridge → protocol}/messages/listUsers.d.ts +0 -0
  273. /package/dist/{bridge → protocol}/messages/listUsers.js +0 -0
  274. /package/dist/{bridge → protocol}/messages/pageChanged.d.ts +0 -0
  275. /package/dist/{bridge → protocol}/messages/pageChanged.js +0 -0
  276. /package/dist/{bridge → protocol}/messages/parentChanged.d.ts +0 -0
  277. /package/dist/{bridge → protocol}/messages/parentChanged.js +0 -0
  278. /package/dist/{bridge → protocol}/messages/queryDataSource.d.ts +0 -0
  279. /package/dist/{bridge → protocol}/messages/queryDataSource.js +0 -0
  280. /package/dist/{bridge → protocol}/messages/queryDataSourceResult.d.ts +0 -0
  281. /package/dist/{bridge → protocol}/messages/queryDataSourceResult.js +0 -0
  282. /package/dist/{bridge → protocol}/messages/resize.d.ts +0 -0
  283. /package/dist/{bridge → protocol}/messages/resize.js +0 -0
  284. /package/dist/{bridge → protocol}/messages/sandboxToHost.d.ts +0 -0
  285. /package/dist/{bridge → protocol}/messages/sandboxToHost.js +0 -0
  286. /package/dist/{bridge → protocol}/messages/themeChanged.d.ts +0 -0
  287. /package/dist/{bridge → protocol}/messages/themeChanged.js +0 -0
  288. /package/dist/{bridge → protocol}/messages/updatePage.d.ts +0 -0
  289. /package/dist/{bridge → protocol}/messages/updatePage.js +0 -0
  290. /package/dist/{bridge → protocol}/messages/updatePageResult.d.ts +0 -0
  291. /package/dist/{bridge → protocol}/messages/updatePageResult.js +0 -0
  292. /package/dist/{bridge → protocol}/pages/page.js +0 -0
  293. /package/dist/{bridge → protocol}/parent.d.ts +0 -0
  294. /package/dist/{bridge → protocol}/parent.js +0 -0
  295. /package/dist/{bridge → protocol}/theme.d.ts +0 -0
  296. /package/dist/{bridge → protocol}/theme.js +0 -0
  297. /package/dist/{bridge → protocol}/users/user.d.ts +0 -0
  298. /package/dist/{bridge → protocol}/users/user.js +0 -0
@@ -1,3 +1,39 @@
1
+ import { DEFAULT_CONTRAST_MODE } from "@notionhq/custom-blocks-protocol/contrast.js"
2
+ import type {
3
+ NotionDataSource,
4
+ NotionDataSourceBindings,
5
+ } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
6
+ import type {
7
+ NotionDataSourcePageUpdateInput,
8
+ NotionDataSourcePageUpdateResult,
9
+ } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
10
+ import { readIncomingType } from "@notionhq/custom-blocks-protocol/incomingType.js"
11
+ import type { CustomBlockManifest } from "@notionhq/custom-blocks-protocol/manifest.js"
12
+ import type { ConnectMessage } from "@notionhq/custom-blocks-protocol/messages/connect.js"
13
+ import type {
14
+ CreatePageMessage,
15
+ CreatePageMessageParent,
16
+ } from "@notionhq/custom-blocks-protocol/messages/createPage.js"
17
+ import type { CustomBlockCreatePageErrorInfo } from "@notionhq/custom-blocks-protocol/messages/createPageResult.js"
18
+ import type { GetUserMessage } from "@notionhq/custom-blocks-protocol/messages/getUser.js"
19
+ import { hostToSandboxMessageSchema } from "@notionhq/custom-blocks-protocol/messages/hostToSandbox.js"
20
+ import {
21
+ CustomBlockInitializationError,
22
+ type InitMessage,
23
+ initMessageSchema,
24
+ } from "@notionhq/custom-blocks-protocol/messages/init.js"
25
+ import type {
26
+ CustomBlockInitResultErrorInfo,
27
+ InitResultMessage,
28
+ } from "@notionhq/custom-blocks-protocol/messages/initResult.js"
29
+ import type { InvalidHostMessage } from "@notionhq/custom-blocks-protocol/messages/invalidHostMessage.js"
30
+ import type { ListUsersMessage } from "@notionhq/custom-blocks-protocol/messages/listUsers.js"
31
+ import type { QueryDataSourceMessage } from "@notionhq/custom-blocks-protocol/messages/queryDataSource.js"
32
+ import type { CustomBlockQueryDataSourceErrorInfo } from "@notionhq/custom-blocks-protocol/messages/queryDataSourceResult.js"
33
+ import type { ResizeMessage } from "@notionhq/custom-blocks-protocol/messages/resize.js"
34
+ import type { UpdatePageMessage } from "@notionhq/custom-blocks-protocol/messages/updatePage.js"
35
+ import { CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION } from "@notionhq/custom-blocks-protocol/protocolVersion.js"
36
+ import type { NotionUser } from "@notionhq/custom-blocks-protocol/users/user.js"
1
37
  import * as v from "valibot"
2
38
  import type {
3
39
  CreatePageInput,
@@ -14,15 +50,6 @@ import type {
14
50
  } from "../types.js"
15
51
  import { unreachable } from "../utils.js"
16
52
  import { CUSTOM_BLOCKS_SDK_VERSION } from "../version.js"
17
- import { DEFAULT_CONTRAST_MODE } from "./contrast.js"
18
- import type {
19
- NotionDataSource,
20
- NotionDataSourceBindings,
21
- } from "./dataSources/dataSource.js"
22
- import type {
23
- NotionDataSourcePageUpdateInput,
24
- NotionDataSourcePageUpdateResult,
25
- } from "./dataSources/dataSourcePage.js"
26
53
  import { resolveDataSources } from "./dataSources/resolve.js"
27
54
  import { resolvePropertyWriteMapForDataSource } from "./dataSources/resolveProperty.js"
28
55
  import {
@@ -30,41 +57,8 @@ import {
30
57
  createEmptyDataSourceQueryState,
31
58
  type DataSourceQueryState,
32
59
  } from "./hostState.js"
33
- import { readIncomingType } from "./incomingType.js"
34
60
  import type { ManifestLoadResult } from "./loadManifest.js"
35
- import type { CustomBlockManifest } from "./manifest.js"
36
- import type { ConnectMessage } from "./messages/connect.js"
37
- import type {
38
- CreatePageMessage,
39
- CreatePageMessageParent,
40
- } from "./messages/createPage.js"
41
- import type { CustomBlockCreatePageErrorInfo } from "./messages/createPageResult.js"
42
- import type { GetUserMessage } from "./messages/getUser.js"
43
- import { hostToSandboxMessageSchema } from "./messages/hostToSandbox.js"
44
- import {
45
- CustomBlockInitializationError,
46
- type InitMessage,
47
- initMessageSchema,
48
- } from "./messages/init.js"
49
- import type {
50
- CustomBlockInitResultErrorInfo,
51
- InitResultMessage,
52
- } from "./messages/initResult.js"
53
- import type { InvalidHostMessage } from "./messages/invalidHostMessage.js"
54
- import type { ListUsersMessage } from "./messages/listUsers.js"
55
- import type { QueryDataSourceMessage } from "./messages/queryDataSource.js"
56
- import type { CustomBlockQueryDataSourceErrorInfo } from "./messages/queryDataSourceResult.js"
57
- import type { ResizeMessage } from "./messages/resize.js"
58
- import type { UpdatePageMessage } from "./messages/updatePage.js"
59
61
  import { PendingRequests } from "./pendingRequests.js"
60
- import type { NotionUser } from "./users/user.js"
61
-
62
- /**
63
- * Used to ensure that the host and client are using the same version of the bridge protocol. A
64
- * single host needs to support multiple custom blocks built with different versions of the bridge
65
- * protocol. Increment this number any time a breaking change is made to the bridge protocol.
66
- */
67
- export const CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION = 3
68
62
 
69
63
  /**
70
64
  * A single entry in the bridge message log. Kept intentionally plain so the log
@@ -1,8 +1,8 @@
1
- import type { CustomBlockManifest } from "../manifest.js"
2
1
  import type {
3
2
  NotionDataSource,
4
3
  NotionDataSourceBindings,
5
- } from "./dataSource.js"
4
+ } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
5
+ import type { CustomBlockManifest } from "@notionhq/custom-blocks-protocol/manifest.js"
6
6
 
7
7
  type ResolveDataSourcesArgs = {
8
8
  manifest: CustomBlockManifest
@@ -13,7 +13,7 @@ type ResolveDataSourcesArgs = {
13
13
  * Builds the public {@link NotionDataSource} list the SDK exposes to consumers.
14
14
  *
15
15
  * Combines the host-supplied bindings (collection pointers + schemas) with the
16
- * manifest's declared data-source keys. The host owns every mapping; the SDK
16
+ * manifest's declared data source keys. The host owns every mapping; the SDK
17
17
  * validates supplied IDs but never infers omitted bindings.
18
18
  */
19
19
  export function resolveDataSources(
@@ -1,25 +1,19 @@
1
- import * as v from "valibot"
2
- import type { CustomBlockErrorInfo } from "../errors.js"
1
+ import type { NotionDataSource } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
2
+ import type {
3
+ CustomBlockPropertyErrorCode,
4
+ CustomBlockPropertyErrorInfo,
5
+ } from "@notionhq/custom-blocks-protocol/dataSources/errors.js"
3
6
  import type {
4
7
  NotionPagePropertyInputMap,
5
8
  NotionPagePropertyWriteMap,
6
- } from "../pages/page.js"
7
- import { notionPagePropertyValueSchema } from "../pages/page.js"
8
- import type { NotionDataSource } from "./dataSource.js"
9
-
10
- // The schema accepts any string code. The type lists known codes for
11
- // autocomplete, with an open string fallback for newer senders.
12
- export const customBlockPropertyErrorCodeSchema = v.string()
13
-
14
- export type CustomBlockPropertyErrorCode =
15
- | "unmapped_property"
16
- | "property_id_mismatch"
17
- | "duplicate_property"
18
- | "invalid_property_value"
19
- | (string & {})
9
+ } from "@notionhq/custom-blocks-protocol/pages/page.js"
10
+ import { notionPagePropertyValueSchema } from "@notionhq/custom-blocks-protocol/pages/page.js"
11
+ import * as v from "valibot"
20
12
 
21
- export type CustomBlockPropertyErrorInfo =
22
- CustomBlockErrorInfo<CustomBlockPropertyErrorCode>
13
+ export type {
14
+ CustomBlockPropertyErrorCode,
15
+ CustomBlockPropertyErrorInfo,
16
+ } from "@notionhq/custom-blocks-protocol/dataSources/errors.js"
23
17
 
24
18
  export type PropertyWriteMapResolutionResult =
25
19
  | { status: "success"; properties: NotionPagePropertyWriteMap }
@@ -35,7 +29,7 @@ function makePropertyError(
35
29
  /**
36
30
  * Resolves a public SDK property write map into the ID-keyed bridge shape.
37
31
  *
38
- * Identifiers in `properties` may be raw property IDs or data-source property keys; the latter
32
+ * Identifiers in `properties` may be raw property IDs or data source property keys; the latter
39
33
  * are looked up in the `dataSource`'s `propertyIdsByKey`. Each value is re-parsed through
40
34
  * `notionPagePropertyValueSchema` with its `id` rewritten to the resolved property ID.
41
35
  */
@@ -102,7 +96,7 @@ export function resolvePropertyWriteMapForDataSource(args: {
102
96
  }
103
97
 
104
98
  /**
105
- * Treats bound data-source keys as aliases for property IDs. An unbound key may still be used as
99
+ * Treats bound data source keys as aliases for property IDs. An unbound key may still be used as
106
100
  * a raw ID when it exactly matches a property in the data source schema.
107
101
  */
108
102
  export function resolvePropertyIdentifierForDataSource(args: {
@@ -1,20 +1,23 @@
1
- import type { NotionContrastMode } from "./contrast.js"
2
- import type { NotionDataSource } from "./dataSources/dataSource.js"
1
+ import type { NotionContrastMode } from "@notionhq/custom-blocks-protocol/contrast.js"
2
+ import type { NotionDataSource } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
3
3
  import type {
4
4
  NotionDataSourcePage,
5
5
  NotionDataSourcePageBridge,
6
6
  NotionDataSourcePageUpdateInput,
7
7
  NotionDataSourcePageUpdateResult,
8
- } from "./dataSources/dataSourcePage.js"
9
- import type { NotionDataSourceValue } from "./dataSources/dataSourceValue.js"
10
- import type { NotionPropertySchema } from "./dataSources/propertySchema.js"
11
- import type { NotionBlockId } from "./ids.js"
12
- import type { CustomBlockManifest } from "./manifest.js"
13
- import type { CustomBlockQueryDataSourceErrorInfo } from "./messages/queryDataSourceResult.js"
14
- import type { CustomBlockPage, NotionPageId } from "./pages/page.js"
15
- import type { NotionParent } from "./parent.js"
16
- import type { NotionTheme } from "./theme.js"
17
- import type { NotionUser } from "./users/user.js"
8
+ } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
9
+ import type { NotionDataSourceValue } from "@notionhq/custom-blocks-protocol/dataSources/dataSourceValue.js"
10
+ import type { NotionPropertySchema } from "@notionhq/custom-blocks-protocol/dataSources/propertySchema.js"
11
+ import type { NotionBlockId } from "@notionhq/custom-blocks-protocol/ids.js"
12
+ import type { CustomBlockManifest } from "@notionhq/custom-blocks-protocol/manifest.js"
13
+ import type { CustomBlockQueryDataSourceErrorInfo } from "@notionhq/custom-blocks-protocol/messages/queryDataSourceResult.js"
14
+ import type {
15
+ CustomBlockPage,
16
+ NotionPageId,
17
+ } from "@notionhq/custom-blocks-protocol/pages/page.js"
18
+ import type { NotionParent } from "@notionhq/custom-blocks-protocol/parent.js"
19
+ import type { NotionTheme } from "@notionhq/custom-blocks-protocol/theme.js"
20
+ import type { NotionUser } from "@notionhq/custom-blocks-protocol/users/user.js"
18
21
 
19
22
  export type CustomBlockHostState = UninitializedHostState | InitializedHostState
20
23
 
@@ -1,6 +1,9 @@
1
+ import type { CustomBlockErrorInfo } from "@notionhq/custom-blocks-protocol/errors.js"
2
+ import {
3
+ type CustomBlockManifest,
4
+ manifestSchema,
5
+ } from "@notionhq/custom-blocks-protocol/manifest.js"
1
6
  import * as v from "valibot"
2
- import type { CustomBlockErrorInfo } from "./errors.js"
3
- import { type CustomBlockManifest, manifestSchema } from "./manifest.js"
4
7
 
5
8
  const MANIFEST_URL = "custom_blocks.json"
6
9
 
@@ -1,3 +1,4 @@
1
+ import type { InitMessage } from "@notionhq/custom-blocks-protocol/messages/init.js"
1
2
  import type {
2
3
  CreatePageInput,
3
4
  CreatePageResult,
@@ -17,7 +18,6 @@ import {
17
18
  getDataSourceQueryView as getDataSourceQueryViewWithBridge,
18
19
  } from "./hostState.js"
19
20
  import type { ManifestLoadResult } from "./loadManifest.js"
20
- import type { InitMessage } from "./messages/init.js"
21
21
  import { type MessageLogEntry, SandboxBridge } from "./SandboxBridge.js"
22
22
 
23
23
  export type { MessageLogEntry }
@@ -1,17 +1,17 @@
1
+ import type { NotionContrastMode } from "@notionhq/custom-blocks-protocol/contrast.js"
2
+ import type { NotionDataSource } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
3
+ import type { NotionBlockId } from "@notionhq/custom-blocks-protocol/ids.js"
4
+ import type { CustomBlockManifest } from "@notionhq/custom-blocks-protocol/manifest.js"
5
+ import type { CustomBlockPage } from "@notionhq/custom-blocks-protocol/pages/page.js"
6
+ import type { NotionParent } from "@notionhq/custom-blocks-protocol/parent.js"
7
+ import type { NotionTheme } from "@notionhq/custom-blocks-protocol/theme.js"
8
+ import type { NotionUser } from "@notionhq/custom-blocks-protocol/users/user.js"
1
9
  import { autoResize } from "./autoResize.js"
2
- import type { NotionContrastMode } from "./bridge/contrast.js"
3
- import type { NotionDataSource } from "./bridge/dataSources/dataSource.js"
4
10
  import type {
5
11
  CustomBlockHostState,
6
12
  InitializedHostState,
7
13
  } from "./bridge/hostState.js"
8
- import type { NotionBlockId } from "./bridge/ids.js"
9
- import type { CustomBlockManifest } from "./bridge/manifest.js"
10
- import type { CustomBlockPage } from "./bridge/pages/page.js"
11
- import type { NotionParent } from "./bridge/parent.js"
12
14
  import { customBlockHost } from "./bridge/sandboxClient.js"
13
- import type { NotionTheme } from "./bridge/theme.js"
14
- import type { NotionUser } from "./bridge/users/user.js"
15
15
 
16
16
  export type CustomBlockState =
17
17
  | {
package/src/index.ts CHANGED
@@ -7,17 +7,17 @@
7
7
  * should import hooks and components from `@notionhq/custom-blocks/react`.
8
8
  */
9
9
 
10
- export type { NotionContrastMode } from "./bridge/contrast.js"
10
+ export type { NotionContrastMode } from "@notionhq/custom-blocks-protocol/contrast.js"
11
11
  export type {
12
12
  NotionCollectionSchema,
13
13
  NotionDataSource,
14
- } from "./bridge/dataSources/dataSource.js"
14
+ } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
15
15
  export type {
16
16
  NotionDataSourcePage,
17
17
  NotionDataSourcePageUpdateInput,
18
18
  NotionDataSourcePageUpdateResult,
19
- } from "./bridge/dataSources/dataSourcePage.js"
20
- export type { NotionDataSourceValue } from "./bridge/dataSources/dataSourceValue.js"
19
+ } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
20
+ export type { NotionDataSourceValue } from "@notionhq/custom-blocks-protocol/dataSources/dataSourceValue.js"
21
21
  export type {
22
22
  NotionDate,
23
23
  NotionDateRange,
@@ -28,11 +28,13 @@ export type {
28
28
  NotionDateValue,
29
29
  NotionNoReminder,
30
30
  NotionTimeReminder,
31
- } from "./bridge/dataSources/dateValue.js"
31
+ } from "@notionhq/custom-blocks-protocol/dataSources/dateValue.js"
32
32
  export type {
33
33
  CustomBlockDataSourceResolutionErrorCode,
34
34
  CustomBlockDataSourceResolutionErrorInfo,
35
- } from "./bridge/dataSources/errors.js"
35
+ CustomBlockPropertyErrorCode,
36
+ CustomBlockPropertyErrorInfo,
37
+ } from "@notionhq/custom-blocks-protocol/dataSources/errors.js"
36
38
  export type {
37
39
  NotionBuiltinPropertyId,
38
40
  NotionDualProperty,
@@ -41,61 +43,55 @@ export type {
41
43
  NotionPropertySchema,
42
44
  NotionPropertyType,
43
45
  NotionStatusGroup,
44
- } from "./bridge/dataSources/propertySchema.js"
46
+ } from "@notionhq/custom-blocks-protocol/dataSources/propertySchema.js"
45
47
  export {
46
48
  NOTION_BUILTIN_PROPERTY_IDS,
47
49
  NOTION_PROPERTY_TYPES,
48
- } from "./bridge/dataSources/propertySchema.js"
49
- export type { NotionRecordPointer } from "./bridge/dataSources/recordPointer.js"
50
- export type {
51
- CustomBlockPropertyErrorCode,
52
- CustomBlockPropertyErrorInfo,
53
- } from "./bridge/dataSources/resolveProperty.js"
54
- export type { CustomBlockErrorInfo } from "./bridge/errors.js"
50
+ } from "@notionhq/custom-blocks-protocol/dataSources/propertySchema.js"
51
+ export type { NotionRecordPointer } from "@notionhq/custom-blocks-protocol/dataSources/recordPointer.js"
52
+ export type { CustomBlockErrorInfo } from "@notionhq/custom-blocks-protocol/errors.js"
55
53
  export type {
56
54
  NotionAgentId,
57
55
  NotionBlockId,
58
56
  NotionDataSourceId,
59
57
  NotionSpaceId,
60
- } from "./bridge/ids.js"
58
+ } from "@notionhq/custom-blocks-protocol/ids.js"
61
59
  export type {
62
60
  CustomBlockManifest,
63
61
  ManifestDataSource,
64
62
  ManifestIcon,
65
63
  ManifestProperty,
66
- } from "./bridge/manifest.js"
67
- export type { NotionCreatePagePosition } from "./bridge/messages/createPage.js"
64
+ } from "@notionhq/custom-blocks-protocol/manifest.js"
65
+ export type { NotionCreatePagePosition } from "@notionhq/custom-blocks-protocol/messages/createPage.js"
68
66
  export type {
69
67
  CustomBlockCreatePageErrorCode,
70
68
  CustomBlockCreatePageErrorInfo,
71
- } from "./bridge/messages/createPageResult.js"
69
+ } from "@notionhq/custom-blocks-protocol/messages/createPageResult.js"
72
70
  export type {
73
71
  CustomBlockGetPageErrorCode,
74
72
  CustomBlockGetPageErrorInfo,
75
- } from "./bridge/messages/getPage.js"
73
+ } from "@notionhq/custom-blocks-protocol/messages/getPage.js"
76
74
  export type {
77
75
  CustomBlockGetUserErrorCode,
78
76
  CustomBlockGetUserErrorInfo,
79
- } from "./bridge/messages/getUser.js"
77
+ } from "@notionhq/custom-blocks-protocol/messages/getUser.js"
80
78
  export type {
81
- CustomBlockInitErrorCode,
82
- CustomBlockInitErrorInfo,
83
79
  CustomBlockInitializationErrorCode,
84
80
  CustomBlockInitializationErrorInfo,
85
- } from "./bridge/messages/init.js"
86
- export { CustomBlockInitializationError } from "./bridge/messages/init.js"
81
+ } from "@notionhq/custom-blocks-protocol/messages/init.js"
82
+ export { CustomBlockInitializationError } from "@notionhq/custom-blocks-protocol/messages/init.js"
87
83
  export type {
88
84
  CustomBlockListUsersErrorCode,
89
85
  CustomBlockListUsersErrorInfo,
90
- } from "./bridge/messages/listUsers.js"
86
+ } from "@notionhq/custom-blocks-protocol/messages/listUsers.js"
91
87
  export type {
92
88
  CustomBlockQueryDataSourceErrorCode,
93
89
  CustomBlockQueryDataSourceErrorInfo,
94
- } from "./bridge/messages/queryDataSourceResult.js"
90
+ } from "@notionhq/custom-blocks-protocol/messages/queryDataSourceResult.js"
95
91
  export type {
96
92
  CustomBlockUpdatePageErrorCode,
97
93
  CustomBlockUpdatePageErrorInfo,
98
- } from "./bridge/messages/updatePageResult.js"
94
+ } from "@notionhq/custom-blocks-protocol/messages/updatePageResult.js"
99
95
  export type {
100
96
  NotionPage,
101
97
  NotionPageCover,
@@ -105,10 +101,10 @@ export type {
105
101
  NotionPagePropertyInputValue,
106
102
  NotionPagePropertyValue,
107
103
  NotionPagePropertyWriteMap,
108
- } from "./bridge/pages/page.js"
109
- export type { NotionParent } from "./bridge/parent.js"
104
+ } from "@notionhq/custom-blocks-protocol/pages/page.js"
105
+ export type { NotionParent } from "@notionhq/custom-blocks-protocol/parent.js"
106
+ export type { NotionTheme } from "@notionhq/custom-blocks-protocol/theme.js"
110
107
  export { pages, users } from "./bridge/sandboxClient.js"
111
- export type { NotionTheme } from "./bridge/theme.js"
112
108
  export { type CustomBlockState, customBlock } from "./customBlock.js"
113
109
  export {
114
110
  type CustomBlockInitPayload,
package/src/init.ts CHANGED
@@ -1,13 +1,13 @@
1
- import type { NotionContrastMode } from "./bridge/contrast.js"
2
- import type { NotionDataSource } from "./bridge/dataSources/dataSource.js"
3
- import type { NotionBlockId } from "./bridge/ids.js"
1
+ import type { NotionContrastMode } from "@notionhq/custom-blocks-protocol/contrast.js"
2
+ import type { NotionDataSource } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
3
+ import type { NotionBlockId } from "@notionhq/custom-blocks-protocol/ids.js"
4
+ import { CustomBlockInitializationError } from "@notionhq/custom-blocks-protocol/messages/init.js"
5
+ import type { CustomBlockPage } from "@notionhq/custom-blocks-protocol/pages/page.js"
6
+ import type { NotionParent } from "@notionhq/custom-blocks-protocol/parent.js"
7
+ import type { NotionTheme } from "@notionhq/custom-blocks-protocol/theme.js"
8
+ import type { NotionUser } from "@notionhq/custom-blocks-protocol/users/user.js"
4
9
  import { attemptToLoadSelfHostedManifest } from "./bridge/loadManifest.js"
5
- import { CustomBlockInitializationError } from "./bridge/messages/init.js"
6
- import type { CustomBlockPage } from "./bridge/pages/page.js"
7
- import type { NotionParent } from "./bridge/parent.js"
8
10
  import { customBlockHost } from "./bridge/sandboxClient.js"
9
- import type { NotionTheme } from "./bridge/theme.js"
10
- import type { NotionUser } from "./bridge/users/user.js"
11
11
  import { unreachable } from "./utils.js"
12
12
 
13
13
  /**
@@ -2,7 +2,7 @@
2
2
  * React entrypoint for `@notionhq/custom-blocks/react`.
3
3
  *
4
4
  * Exposes only the React surface — components and hooks. Framework-neutral
5
- * values and types (clients, manifest/data-source types, etc.) live on the
5
+ * values and types (clients, manifest/data source types, etc.) live on the
6
6
  * `@notionhq/custom-blocks` entrypoint and are intentionally NOT re-exported
7
7
  * here, so the two public surfaces stay disjoint.
8
8
  */
@@ -1,6 +1,9 @@
1
+ import { DEFAULT_CONTRAST_MODE } from "@notionhq/custom-blocks-protocol/contrast.js"
2
+ import {
3
+ notionBlockIdSchema,
4
+ notionPageIdSchema,
5
+ } from "@notionhq/custom-blocks-protocol/ids.js"
1
6
  import * as v from "valibot"
2
- import { DEFAULT_CONTRAST_MODE } from "../bridge/contrast.js"
3
- import { notionBlockIdSchema, notionPageIdSchema } from "../bridge/ids.js"
4
7
  import { customBlockHost } from "../bridge/sandboxClient.js"
5
8
 
6
9
  const previewBlockId = v.parse(notionBlockIdSchema, "")
@@ -1,5 +1,5 @@
1
+ import type { CustomBlockInitializationError } from "@notionhq/custom-blocks-protocol/messages/init.js"
1
2
  import { useEffect, useState } from "react"
2
- import type { CustomBlockInitializationError } from "../bridge/messages/init.js"
3
3
  import {
4
4
  type CustomBlockInitPayload,
5
5
  type InitCustomBlockOptions,
@@ -6,7 +6,7 @@ import { useCustomBlockHost } from "./useHostState.js"
6
6
  /**
7
7
  * Reads from the data source mapped to the given semantic `key`.
8
8
  *
9
- * @param key - The semantic data-source key the block is wired to (e.g. `"people"`).
9
+ * @param key - The semantic data source key the block is wired to (e.g. `"people"`).
10
10
  * @param options - Optional live snapshot options. `limit` defaults to 20 and
11
11
  * is capped at 999.
12
12
  *
@@ -1,11 +1,11 @@
1
+ import type { NotionContrastMode } from "@notionhq/custom-blocks-protocol/contrast.js"
2
+ import type { NotionBlockId } from "@notionhq/custom-blocks-protocol/ids.js"
3
+ import type { CustomBlockManifest } from "@notionhq/custom-blocks-protocol/manifest.js"
4
+ import type { CustomBlockPage } from "@notionhq/custom-blocks-protocol/pages/page.js"
5
+ import type { NotionParent } from "@notionhq/custom-blocks-protocol/parent.js"
6
+ import type { NotionTheme } from "@notionhq/custom-blocks-protocol/theme.js"
7
+ import type { NotionUser } from "@notionhq/custom-blocks-protocol/users/user.js"
1
8
  import { useSyncExternalStore } from "react"
2
- import type { NotionContrastMode } from "../bridge/contrast.js"
3
- import type { NotionBlockId } from "../bridge/ids.js"
4
- import type { CustomBlockManifest } from "../bridge/manifest.js"
5
- import type { CustomBlockPage } from "../bridge/pages/page.js"
6
- import type { NotionParent } from "../bridge/parent.js"
7
- import type { NotionTheme } from "../bridge/theme.js"
8
- import type { NotionUser } from "../bridge/users/user.js"
9
9
  import { customBlock } from "../customBlock.js"
10
10
 
11
11
  /**
@@ -90,13 +90,13 @@ export function useCurrentUser(): NotionUser {
90
90
 
91
91
  /**
92
92
  * Returns the authoritative manifest received from the host — the semantic
93
- * data-source keys plus their declared `name`, `description`, and property declarations.
93
+ * data source keys plus their declared `name`, `description`, and property declarations.
94
94
  *
95
95
  * Throws if called before `initCustomBlock` has resolved.
96
96
  *
97
97
  * This is the configuration the block declared, not host-resolved bindings: use
98
98
  * `useDataSource(key)` for rows and resolved schema. Handy for enumerating the declared
99
- * data-source keys (e.g. picking a default key, or rendering a key switcher).
99
+ * data source keys (e.g. picking a default key, or rendering a key switcher).
100
100
  */
101
101
  export function useManifest(): CustomBlockManifest {
102
102
  return useSyncExternalStore(customBlock.subscribe, customBlock.getManifest)
package/src/types.ts CHANGED
@@ -1,19 +1,14 @@
1
- import type { NotionCollectionSchema } from "./bridge/dataSources/dataSource.js"
2
- import type {
3
- NotionDataSourcePage,
4
- NotionDataSourcePageUpdateInput,
5
- NotionDataSourcePageUpdateResult,
6
- } from "./bridge/dataSources/dataSourcePage.js"
7
- import type { NotionPropertySchema } from "./bridge/dataSources/propertySchema.js"
8
- import type { CustomBlockErrorInfo } from "./bridge/errors.js"
9
- import type { NotionDataSourceId } from "./bridge/ids.js"
10
- import type { NotionCreatePagePosition } from "./bridge/messages/createPage.js"
11
- import type { CustomBlockCreatePageErrorInfo } from "./bridge/messages/createPageResult.js"
12
- import type { CustomBlockGetPageErrorInfo } from "./bridge/messages/getPage.js"
13
- import type { CustomBlockGetUserErrorInfo } from "./bridge/messages/getUser.js"
14
- import type { CustomBlockListUsersErrorInfo } from "./bridge/messages/listUsers.js"
15
- import type { CustomBlockQueryDataSourceErrorInfo } from "./bridge/messages/queryDataSourceResult.js"
16
- import type { CustomBlockUpdatePageErrorInfo } from "./bridge/messages/updatePageResult.js"
1
+ import type { NotionCollectionSchema } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
2
+ import type { NotionDataSourcePage } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
3
+ import type { NotionPropertySchema } from "@notionhq/custom-blocks-protocol/dataSources/propertySchema.js"
4
+ import type { NotionDataSourceId } from "@notionhq/custom-blocks-protocol/ids.js"
5
+ import type { NotionCreatePagePosition } from "@notionhq/custom-blocks-protocol/messages/createPage.js"
6
+ import type { CustomBlockCreatePageErrorInfo } from "@notionhq/custom-blocks-protocol/messages/createPageResult.js"
7
+ import type { CustomBlockGetPageErrorInfo } from "@notionhq/custom-blocks-protocol/messages/getPage.js"
8
+ import type { CustomBlockGetUserErrorInfo } from "@notionhq/custom-blocks-protocol/messages/getUser.js"
9
+ import type { CustomBlockListUsersErrorInfo } from "@notionhq/custom-blocks-protocol/messages/listUsers.js"
10
+ import type { CustomBlockQueryDataSourceErrorInfo } from "@notionhq/custom-blocks-protocol/messages/queryDataSourceResult.js"
11
+ import type { CustomBlockUpdatePageErrorInfo } from "@notionhq/custom-blocks-protocol/messages/updatePageResult.js"
17
12
  import type {
18
13
  NotionPage,
19
14
  NotionPageCover,
@@ -21,26 +16,34 @@ import type {
21
16
  NotionPageId,
22
17
  NotionPagePropertyInputMap,
23
18
  NotionPagePropertyWriteMap,
24
- } from "./bridge/pages/page.js"
25
- import type { NotionUser, NotionUserList } from "./bridge/users/user.js"
19
+ } from "@notionhq/custom-blocks-protocol/pages/page.js"
20
+ import type {
21
+ NotionUser,
22
+ NotionUserList,
23
+ } from "@notionhq/custom-blocks-protocol/users/user.js"
26
24
 
27
- export type { NotionDataSourceId, NotionSpaceId } from "./bridge/ids.js"
28
- export type { NotionPageId } from "./bridge/pages/page.js"
25
+ export type {
26
+ NotionDataSourcePageUpdateInput,
27
+ NotionDataSourcePageUpdateResult,
28
+ } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
29
+ export type { CustomBlockErrorInfo } from "@notionhq/custom-blocks-protocol/errors.js"
30
+ export type {
31
+ NotionDataSourceId,
32
+ NotionSpaceId,
33
+ } from "@notionhq/custom-blocks-protocol/ids.js"
34
+ export type { NotionPageId } from "@notionhq/custom-blocks-protocol/pages/page.js"
29
35
  export type {
30
36
  NotionUser,
31
37
  NotionUserId,
32
38
  NotionUserList,
33
- } from "./bridge/users/user.js"
39
+ } from "@notionhq/custom-blocks-protocol/users/user.js"
34
40
  export type {
35
41
  CustomBlockCreatePageErrorInfo,
36
- CustomBlockErrorInfo,
37
42
  CustomBlockGetPageErrorInfo,
38
43
  CustomBlockGetUserErrorInfo,
39
44
  CustomBlockListUsersErrorInfo,
40
45
  CustomBlockQueryDataSourceErrorInfo,
41
46
  CustomBlockUpdatePageErrorInfo,
42
- NotionDataSourcePageUpdateInput,
43
- NotionDataSourcePageUpdateResult,
44
47
  }
45
48
 
46
49
  /**