@notionhq/custom-blocks-host 0.0.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.
Files changed (142) hide show
  1. package/README.md +204 -0
  2. package/dist/autoBindProperties.d.ts +21 -0
  3. package/dist/autoBindProperties.d.ts.map +1 -0
  4. package/dist/autoBindProperties.js +38 -0
  5. package/dist/createCustomBlockHost.d.ts +46 -0
  6. package/dist/createCustomBlockHost.d.ts.map +1 -0
  7. package/dist/createCustomBlockHost.js +433 -0
  8. package/dist/index.d.ts +6 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +2 -0
  11. package/dist/lifecycle/initErrors.d.ts +13 -0
  12. package/dist/lifecycle/initErrors.d.ts.map +1 -0
  13. package/dist/lifecycle/initErrors.js +152 -0
  14. package/dist/lifecycle/initializationController.d.ts +54 -0
  15. package/dist/lifecycle/initializationController.d.ts.map +1 -0
  16. package/dist/lifecycle/initializationController.js +182 -0
  17. package/dist/lifecycle/protocolVersion.d.ts +2 -0
  18. package/dist/lifecycle/protocolVersion.d.ts.map +1 -0
  19. package/dist/lifecycle/protocolVersion.js +3 -0
  20. package/dist/lifecycle/types.d.ts +28 -0
  21. package/dist/lifecycle/types.d.ts.map +1 -0
  22. package/dist/lifecycle/types.js +1 -0
  23. package/dist/messages/invalidSandboxMessage.d.ts +7 -0
  24. package/dist/messages/invalidSandboxMessage.d.ts.map +1 -0
  25. package/dist/messages/invalidSandboxMessage.js +21 -0
  26. package/dist/messages/types.d.ts +29 -0
  27. package/dist/messages/types.d.ts.map +1 -0
  28. package/dist/messages/types.js +1 -0
  29. package/dist/protocol/contrast.d.ts +4 -0
  30. package/dist/protocol/contrast.js +3 -0
  31. package/dist/protocol/dataSources/dataSource.d.ts +731 -0
  32. package/dist/protocol/dataSources/dataSource.js +37 -0
  33. package/dist/protocol/dataSources/dataSourcePage.d.ts +72 -0
  34. package/dist/protocol/dataSources/dataSourcePage.js +12 -0
  35. package/dist/protocol/dataSources/dataSourceValue.d.ts +66 -0
  36. package/dist/protocol/dataSources/dataSourceValue.js +14 -0
  37. package/dist/protocol/dataSources/dateValue.d.ts +157 -0
  38. package/dist/protocol/dataSources/dateValue.js +59 -0
  39. package/dist/protocol/dataSources/errors.d.ts +8 -0
  40. package/dist/protocol/dataSources/errors.js +7 -0
  41. package/dist/protocol/dataSources/propertySchema.d.ts +197 -0
  42. package/dist/protocol/dataSources/propertySchema.js +165 -0
  43. package/dist/protocol/dataSources/recordPointer.d.ts +9 -0
  44. package/dist/protocol/dataSources/recordPointer.js +8 -0
  45. package/dist/protocol/errors.d.ts +12 -0
  46. package/dist/protocol/errors.js +6 -0
  47. package/dist/protocol/ids.d.ts +31 -0
  48. package/dist/protocol/ids.js +26 -0
  49. package/dist/protocol/incomingType.d.ts +9 -0
  50. package/dist/protocol/incomingType.js +17 -0
  51. package/dist/protocol/index.d.ts +48 -0
  52. package/dist/protocol/index.js +48 -0
  53. package/dist/protocol/manifest.d.ts +60 -0
  54. package/dist/protocol/manifest.js +32 -0
  55. package/dist/protocol/messagePayload.d.ts +19 -0
  56. package/dist/protocol/messagePayload.js +1 -0
  57. package/dist/protocol/messages/connect.d.ts +47 -0
  58. package/dist/protocol/messages/connect.js +38 -0
  59. package/dist/protocol/messages/contrastModeChanged.d.ts +7 -0
  60. package/dist/protocol/messages/contrastModeChanged.js +7 -0
  61. package/dist/protocol/messages/createPage.d.ts +200 -0
  62. package/dist/protocol/messages/createPage.js +52 -0
  63. package/dist/protocol/messages/createPageResult.d.ts +213 -0
  64. package/dist/protocol/messages/createPageResult.js +28 -0
  65. package/dist/protocol/messages/currentUserChanged.d.ts +18 -0
  66. package/dist/protocol/messages/currentUserChanged.js +9 -0
  67. package/dist/protocol/messages/dataSourcesChanged.d.ts +157 -0
  68. package/dist/protocol/messages/dataSourcesChanged.js +13 -0
  69. package/dist/protocol/messages/getPage.d.ts +218 -0
  70. package/dist/protocol/messages/getPage.js +33 -0
  71. package/dist/protocol/messages/getUser.d.ts +44 -0
  72. package/dist/protocol/messages/getUser.js +32 -0
  73. package/dist/protocol/messages/hostToSandbox.d.ts +1167 -0
  74. package/dist/protocol/messages/hostToSandbox.js +34 -0
  75. package/dist/protocol/messages/init.d.ts +259 -0
  76. package/dist/protocol/messages/init.js +56 -0
  77. package/dist/protocol/messages/initResult.d.ts +37 -0
  78. package/dist/protocol/messages/initResult.js +28 -0
  79. package/dist/protocol/messages/invalidHostMessage.d.ts +14 -0
  80. package/dist/protocol/messages/invalidHostMessage.js +13 -0
  81. package/dist/protocol/messages/invalidSandboxMessage.d.ts +14 -0
  82. package/dist/protocol/messages/invalidSandboxMessage.js +13 -0
  83. package/dist/protocol/messages/listUsers.d.ts +52 -0
  84. package/dist/protocol/messages/listUsers.js +33 -0
  85. package/dist/protocol/messages/pageChanged.d.ts +27 -0
  86. package/dist/protocol/messages/pageChanged.js +9 -0
  87. package/dist/protocol/messages/parentChanged.d.ts +24 -0
  88. package/dist/protocol/messages/parentChanged.js +9 -0
  89. package/dist/protocol/messages/queryDataSource.d.ts +985 -0
  90. package/dist/protocol/messages/queryDataSource.js +123 -0
  91. package/dist/protocol/messages/queryDataSourceResult.d.ts +93 -0
  92. package/dist/protocol/messages/queryDataSourceResult.js +28 -0
  93. package/dist/protocol/messages/resize.d.ts +11 -0
  94. package/dist/protocol/messages/resize.js +10 -0
  95. package/dist/protocol/messages/sandboxToHost.d.ts +744 -0
  96. package/dist/protocol/messages/sandboxToHost.js +27 -0
  97. package/dist/protocol/messages/themeChanged.d.ts +10 -0
  98. package/dist/protocol/messages/themeChanged.js +10 -0
  99. package/dist/protocol/messages/updatePage.d.ts +180 -0
  100. package/dist/protocol/messages/updatePage.js +22 -0
  101. package/dist/protocol/messages/updatePageResult.d.ts +212 -0
  102. package/dist/protocol/messages/updatePageResult.js +27 -0
  103. package/dist/protocol/pages/page.d.ts +597 -0
  104. package/dist/protocol/pages/page.js +212 -0
  105. package/dist/protocol/parent.d.ts +28 -0
  106. package/dist/protocol/parent.js +12 -0
  107. package/dist/protocol/protocolVersion.d.ts +6 -0
  108. package/dist/protocol/protocolVersion.js +6 -0
  109. package/dist/protocol/theme.d.ts +3 -0
  110. package/dist/protocol/theme.js +2 -0
  111. package/dist/protocol/users/user.d.ts +32 -0
  112. package/dist/protocol/users/user.js +20 -0
  113. package/dist/queries/querySubscriptions.d.ts +17 -0
  114. package/dist/queries/querySubscriptions.d.ts.map +1 -0
  115. package/dist/queries/querySubscriptions.js +38 -0
  116. package/dist/queries/types.d.ts +4 -0
  117. package/dist/queries/types.d.ts.map +1 -0
  118. package/dist/queries/types.js +1 -0
  119. package/dist/queries/validateQueryDataSourceFilter.d.ts +5 -0
  120. package/dist/queries/validateQueryDataSourceFilter.d.ts.map +1 -0
  121. package/dist/queries/validateQueryDataSourceFilter.js +72 -0
  122. package/dist/queries/validateQueryDataSourceSorts.d.ts +8 -0
  123. package/dist/queries/validateQueryDataSourceSorts.d.ts.map +1 -0
  124. package/dist/queries/validateQueryDataSourceSorts.js +47 -0
  125. package/dist/utils.d.ts +5 -0
  126. package/dist/utils.d.ts.map +1 -0
  127. package/dist/utils.js +6 -0
  128. package/package.json +26 -0
  129. package/src/autoBindProperties.ts +63 -0
  130. package/src/createCustomBlockHost.ts +605 -0
  131. package/src/index.ts +25 -0
  132. package/src/lifecycle/initErrors.ts +165 -0
  133. package/src/lifecycle/initializationController.ts +290 -0
  134. package/src/lifecycle/protocolVersion.ts +3 -0
  135. package/src/lifecycle/types.ts +40 -0
  136. package/src/messages/invalidSandboxMessage.ts +35 -0
  137. package/src/messages/types.ts +80 -0
  138. package/src/queries/querySubscriptions.ts +57 -0
  139. package/src/queries/types.ts +10 -0
  140. package/src/queries/validateQueryDataSourceFilter.ts +101 -0
  141. package/src/queries/validateQueryDataSourceSorts.ts +69 -0
  142. package/src/utils.ts +8 -0
package/README.md ADDED
@@ -0,0 +1,204 @@
1
+ # @notionhq/custom-blocks-host
2
+
3
+ Host runtime for the custom block bridge. This package owns the generic
4
+ `postMessage` protocol loop used by hosts such as the local dev shell. It does
5
+ not own iframe policy, permissions, persistence, analytics, or host UI state.
6
+ Host implementations such as the dev shell and `notion-next` depend on this package.
7
+
8
+ ## `getAutoBoundPropertyIdsByKey()`
9
+
10
+ `getAutoBoundPropertyIdsByKey()` matches manifest properties to schema
11
+ properties for initial property binding. For each manifest property:
12
+
13
+ 1. Consider only schema properties of the same type.
14
+ 2. A schema property is a candidate if its ID equals the manifest key
15
+ (exact string: no trim, no case folding) or its display name equals the
16
+ manifest display name after `trim()` and lowercasing.
17
+ 3. Bind when there is exactly one candidate. Otherwise leave it unmapped.
18
+
19
+ Wrong-type properties never enter the candidate set.
20
+
21
+ ```ts
22
+ import { getAutoBoundPropertyIdsByKey } from "@notionhq/custom-blocks-host";
23
+
24
+ const propertyIdsByKey = getAutoBoundPropertyIdsByKey({
25
+ manifestProperties: {
26
+ title: { name: "Task", type: "title" },
27
+ estimate: { name: "Estimate", type: "number" },
28
+ },
29
+ propertySchemasById: {
30
+ title: { name: "Different label", type: "title" },
31
+ "property-1": { name: " estimate ", type: "number" },
32
+ },
33
+ });
34
+
35
+ // { title: "title", estimate: "property-1" }
36
+ ```
37
+
38
+ ## `createCustomBlockHost()`
39
+
40
+ `createCustomBlockHost()` attaches a message listener, performs the
41
+ `connect` / `init` / `initResult` handshake, validates sandbox messages, routes
42
+ requests to handlers, manages query subscriptions, and emits live state
43
+ updates.
44
+
45
+ ```ts
46
+ import { createCustomBlockHost } from "@notionhq/custom-blocks-host";
47
+
48
+ const host = createCustomBlockHost({
49
+ iframe,
50
+ sandboxOrigin: "https://example.com",
51
+ minBridgeProtocolVersion: 3,
52
+ initialState: {
53
+ theme,
54
+ contrastMode,
55
+ blockId,
56
+ parent,
57
+ page,
58
+ currentUser,
59
+ manifest,
60
+ dataSources: { bindings },
61
+ },
62
+ handlers: {
63
+ queryDataSource: async (message) => ({
64
+ status: "success",
65
+ items: await queryRows(message),
66
+ hasMore: false,
67
+ }),
68
+ createPage: async (message) => createPage(message),
69
+ getPage: async (message) => getPage(message),
70
+ updatePage: async (message) => updatePage(message),
71
+ getUser: async (message) => getUser(message),
72
+ listUsers: async (message) => listUsers(message),
73
+ resize: (message) => resizeIframe(message.height),
74
+ },
75
+ onConnect: (message) => {
76
+ console.log("Connected SDK", message.sdkVersion);
77
+ },
78
+ onIgnoredConnect: () => {
79
+ remountHostAndIframe();
80
+ },
81
+ onLog: (direction, payload) => {
82
+ console.log(direction, payload);
83
+ },
84
+ });
85
+ ```
86
+
87
+ The host runs one initialization per instance. `onIgnoredConnect` fires when a
88
+ `connect` arrives that the settled host cannot serve: the iframe document was
89
+ replaced, or the document's first `connect` came after the no-connect timeout.
90
+ Recreate the host and the iframe together so the document runs a fresh
91
+ handshake against current host state.
92
+
93
+ `queryDataSource` is required. Other request handlers are optional. Every
94
+ request handler may return its result synchronously or as a promise. Results
95
+ use a `status` discriminator: successful results carry their response payload,
96
+ while errors carry `{ code, message, isRetryable }`.
97
+
98
+ The `queryDataSource` handler receives raw data source and property IDs. Its
99
+ optional `filter` and `sorts` fields have already been resolved by the SDK.
100
+ The host validates that sorts contain at most 10 unique property IDs, checks
101
+ property IDs and currently supported property types against the bound
102
+ collection schema when available, and applies valid sorts in the order provided
103
+ by the array.
104
+
105
+ When a data source binding includes `collectionSchema`, the runtime validates
106
+ select, multi-select, and status option names before invoking `queryDataSource`.
107
+ Bindings without a collection schema cannot perform this check, so their query
108
+ handlers remain responsible for validating option names.
109
+
110
+ `initialState.dataSources` may also be a function of the successful `connect`
111
+ message. This lets a host derive bindings from the sandbox-provided manifest.
112
+
113
+ Set `sandboxOrigin` to the iframe's exact origin. The runtime targets outbound
114
+ messages to that origin and rejects inbound messages from any other origin.
115
+ The runtime also accepts `noConnectTimeoutMs` and `noInitResultTimeoutMs`; both
116
+ default to five seconds.
117
+
118
+ ### Initialization and malformed messages
119
+
120
+ `createCustomBlockHost()` performs one handshake for each host and iframe pair:
121
+
122
+ ```text
123
+ sandbox connect → host init → sandbox initResult
124
+ ```
125
+
126
+ The sandbox creates the `initializationId`. The host copies that ID into `init`.
127
+ The sandbox copies it into `initResult`. The host sends live state changes only
128
+ after it receives a matching `initResult.success`.
129
+
130
+ The host must check that the `initializationId` in `initResult` exactly matches
131
+ the ID in the `init` message. The host ignores a result with a different ID.
132
+ If no result arrives, or only a stale valid result arrives, before the timeout,
133
+ initialization ends with `no_init_result`.
134
+
135
+ Hosts validate each inbound sandbox message with `sandboxToHostMessageSchema`
136
+ before acting on it. If validation fails, the host uses `readIncomingType()` to
137
+ identify the message and applies these rules:
138
+
139
+ - A malformed `connect` with a readable `initializationId` gets `init.error`
140
+ with code `invalid_connect_payload`.
141
+ - A malformed `initResult` gets one `invalidSandboxMessage` NACK. The host then
142
+ cancels the handshake and fails with the host-only `invalid_init_result_payload`
143
+ error. The host does not wait for the `no_init_result` timeout.
144
+ - Any other malformed sandbox message gets one `invalidSandboxMessage` NACK.
145
+ The sandbox logs this NACK and does not reply.
146
+ - Never reply to a sandbox-sent NACK with a host-sent NACK. The host should
147
+ not respond to `invalidHostMessage` or `invalidSandboxMessage` messages.
148
+
149
+ The host accepts a valid `initResult.error` as a terminal initialization
150
+ failure. It logs and ignores a valid `initResult` with a stale
151
+ `initializationId` or an unexpected state.
152
+
153
+ Hosts do not retry malformed messages. A host that receives a `connect` after
154
+ initialization has settled must use `onIgnoredConnect` to recreate the host
155
+ and iframe together.
156
+
157
+ ## Updating live state
158
+
159
+ The returned handle exposes:
160
+
161
+ - `setTheme()`
162
+ - `setContrastMode()`
163
+ - `setParent()`
164
+ - `setPage()`
165
+ - `setDataSources()`
166
+ - `setCurrentUser()`
167
+ - `refreshQuery()`
168
+ - `post()`
169
+ - `stop()`
170
+
171
+ State updates are sent after `initResult.success`. Updates made earlier are
172
+ held until initialization completes. `refreshQuery()` re-runs
173
+ `queryDataSource` for every active subscription with the supplied data source
174
+ ID, preserving each subscription's filter, sorts, and limit.
175
+
176
+ Call `stop()` when the iframe is removed. It detaches listeners, clears
177
+ timeouts, and discards active query subscriptions.
178
+
179
+ ## Wire protocol
180
+
181
+ `createCustomBlockHost()` implements the protocol: it validates inbound
182
+ messages, runs the initialization handshake, correlates requests, manages query
183
+ subscriptions, and emits bridge NACKs. Use its state-update methods and
184
+ handlers instead of posting bridge messages directly.
185
+
186
+ The bridge protocol is maintained in this repository's `protocol/` package.
187
+ The published host package includes a compiled copy of that protocol and does
188
+ not expose it as a public subpath. Consumers should use the host APIs above
189
+ instead of importing protocol implementation files.
190
+
191
+ Host source in this repository imports protocol schemas and types from the
192
+ workspace package. The publish build rewrites those imports to the bundled
193
+ copy.
194
+
195
+ Handler implementations must preserve message identity: one-shot operations
196
+ return one result with the request's `requestId`, while `queryDataSource` is a
197
+ long-lived subscription keyed by `subscriptionId`. The runtime handles the
198
+ `connect` → `init` → `initResult` lifecycle, including waiting for
199
+ `initResult.success` before live updates.
200
+
201
+ Error payloads use `{ code, message, isRetryable }`. The runtime accepts any
202
+ string for `code`, including codes that this package does not know yet. Host
203
+ code should preserve unknown codes and use `isRetryable` to decide whether a
204
+ retry is appropriate.
@@ -0,0 +1,21 @@
1
+ import type { NotionPropertyType } from "./protocol/dataSources/propertySchema.js";
2
+ export type AutoBindableProperty = {
3
+ name: string;
4
+ type: NotionPropertyType;
5
+ };
6
+ /**
7
+ * Finds property IDs for a manifest's properties without changing the
8
+ * manifest's semantic keys.
9
+ *
10
+ * For each manifest property:
11
+ * 1. Consider only schema properties of the same type.
12
+ * 2. A schema property is a candidate if its ID equals the manifest key
13
+ * (exact string: no trim, no case folding) or its display name equals
14
+ * the manifest display name after `trim()` and lowercasing.
15
+ * 3. Bind when there is exactly one candidate. Otherwise leave it unmapped.
16
+ */
17
+ export declare function getAutoBoundPropertyIdsByKey(args: {
18
+ manifestProperties: Readonly<Record<string, AutoBindableProperty>>;
19
+ propertySchemasById: Readonly<Record<string, AutoBindableProperty>>;
20
+ }): Record<string, string>;
21
+ //# sourceMappingURL=autoBindProperties.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoBindProperties.d.ts","sourceRoot":"","sources":["../src/autoBindProperties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gEAAgE,CAAA;AAExG,MAAM,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,kBAAkB,CAAA;CACxB,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE;IAClD,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAA;IAClE,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAA;CACnE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAkBzB"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Finds property IDs for a manifest's properties without changing the
3
+ * manifest's semantic keys.
4
+ *
5
+ * For each manifest property:
6
+ * 1. Consider only schema properties of the same type.
7
+ * 2. A schema property is a candidate if its ID equals the manifest key
8
+ * (exact string: no trim, no case folding) or its display name equals
9
+ * the manifest display name after `trim()` and lowercasing.
10
+ * 3. Bind when there is exactly one candidate. Otherwise leave it unmapped.
11
+ */
12
+ export function getAutoBoundPropertyIdsByKey(args) {
13
+ const { manifestProperties, propertySchemasById } = args;
14
+ const mappings = [];
15
+ for (const [propertyKey, manifestProperty] of Object.entries(manifestProperties)) {
16
+ const propertyId = getAutoBoundPropertyId({
17
+ propertyKey,
18
+ manifestProperty,
19
+ propertySchemasById,
20
+ });
21
+ if (propertyId !== undefined) {
22
+ mappings.push([propertyKey, propertyId]);
23
+ }
24
+ }
25
+ return Object.fromEntries(mappings);
26
+ }
27
+ function getAutoBoundPropertyId(args) {
28
+ const { propertyKey, manifestProperty, propertySchemasById } = args;
29
+ const normalizedManifestName = normalizePropertyDisplayName(manifestProperty.name);
30
+ const candidates = Object.entries(propertySchemasById).filter(([schemaId, propertySchema]) => propertySchema.type === manifestProperty.type &&
31
+ (schemaId === propertyKey ||
32
+ normalizePropertyDisplayName(propertySchema.name) ===
33
+ normalizedManifestName));
34
+ return candidates.length === 1 ? candidates[0][0] : undefined;
35
+ }
36
+ function normalizePropertyDisplayName(value) {
37
+ return value.trim().toLowerCase();
38
+ }
@@ -0,0 +1,46 @@
1
+ import { type NotionContrastMode } from "./protocol/contrast.js";
2
+ import type { NotionDataSourceId } from "./protocol/ids.js";
3
+ import type { ConnectMessage } from "./protocol/messages/connect.js";
4
+ import type { HostToSandboxMessage } from "./protocol/messages/hostToSandbox.js";
5
+ import type { InitResultMessage } from "./protocol/messages/initResult.js";
6
+ import type { CustomBlockPage } from "./protocol/pages/page.js";
7
+ import type { NotionParent } from "./protocol/parent.js";
8
+ import type { NotionTheme } from "./protocol/theme.js";
9
+ import type { NotionUser } from "./protocol/users/user.js";
10
+ import type { ConnectSuccessMessage, CustomBlockHostDataSourcesPayload, CustomBlockHostInitialState } from "./lifecycle/types.js";
11
+ import type { CustomBlockHostHandlers, CustomBlockHostLogDirection } from "./messages/types.js";
12
+ export type CustomBlockHostOptions = {
13
+ iframe: HTMLIFrameElement;
14
+ sandboxOrigin: string;
15
+ minBridgeProtocolVersion: number;
16
+ noConnectTimeoutMs?: number;
17
+ noInitResultTimeoutMs?: number;
18
+ initialState: CustomBlockHostInitialState;
19
+ handlers: CustomBlockHostHandlers;
20
+ onConnect?: (message: ConnectSuccessMessage) => void;
21
+ onInitResult?: (message: InitResultMessage) => void;
22
+ /**
23
+ * A `connect` arrived after this host's initialization settled — the
24
+ * document was replaced, or its first `connect` came after the host
25
+ * stopped waiting. Either way the host cannot serve it: the embedder
26
+ * should recreate host and iframe together so the document can run a
27
+ * fresh handshake.
28
+ */
29
+ onIgnoredConnect?: (message: ConnectMessage) => void;
30
+ onLog?: (direction: CustomBlockHostLogDirection, payload: unknown) => void;
31
+ };
32
+ export type CustomBlockHostHandle = {
33
+ stop: () => void;
34
+ post: (message: HostToSandboxMessage) => void;
35
+ setTheme: (theme: NotionTheme) => void;
36
+ setContrastMode: (contrastMode: NotionContrastMode) => void;
37
+ setParent: (parent: NotionParent) => void;
38
+ setPage: (page: CustomBlockPage) => void;
39
+ setDataSources: (dataSources: CustomBlockHostDataSourcesPayload) => void;
40
+ setCurrentUser: (currentUser: NotionUser) => void;
41
+ refreshQuery: (args: {
42
+ dataSourceId: NotionDataSourceId;
43
+ }) => void;
44
+ };
45
+ export declare function createCustomBlockHost(options: CustomBlockHostOptions): CustomBlockHostHandle;
46
+ //# sourceMappingURL=createCustomBlockHost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createCustomBlockHost.d.ts","sourceRoot":"","sources":["../src/createCustomBlockHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,kBAAkB,EACvB,MAAM,8CAA8C,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAEjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAA;AAa1F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAA;AAEtG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAA;AAahG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAA;AAIhF,OAAO,KAAK,EACX,qBAAqB,EACrB,iCAAiC,EACjC,2BAA2B,EAC3B,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EACX,uBAAuB,EACvB,2BAA2B,EAC3B,MAAM,qBAAqB,CAAA;AAU5B,MAAM,MAAM,sBAAsB,GAAG;IACpC,MAAM,EAAE,iBAAiB,CAAA;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,wBAAwB,EAAE,MAAM,CAAA;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,YAAY,EAAE,2BAA2B,CAAA;IACzC,QAAQ,EAAE,uBAAuB,CAAA;IACjC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAA;IACpD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAA;IACnD;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAA;IACpD,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,2BAA2B,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CAC1E,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,IAAI,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAA;IAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IACtC,eAAe,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,IAAI,CAAA;IAC3D,SAAS,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAA;IACzC,OAAO,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAA;IACxC,cAAc,EAAE,CAAC,WAAW,EAAE,iCAAiC,KAAK,IAAI,CAAA;IACxE,cAAc,EAAE,CAAC,WAAW,EAAE,UAAU,KAAK,IAAI,CAAA;IACjD,YAAY,EAAE,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,kBAAkB,CAAA;KAAE,KAAK,IAAI,CAAA;CAClE,CAAA;AAMD,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,sBAAsB,GAC7B,qBAAqB,CA+cvB"}