@notionhq/custom-blocks 0.0.62 → 0.0.64

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 (44) hide show
  1. package/HOST.md +4 -4
  2. package/README.md +2 -2
  3. package/bin/cli/create.js +3 -3
  4. package/dist/bridge/SandboxBridge.js +17 -17
  5. package/dist/bridge/loadManifest.js +6 -6
  6. package/dist/bridge/messages/hostToSandbox.d.ts +32 -0
  7. package/dist/bridge/messages/hostToSandbox.d.ts.map +1 -1
  8. package/dist/bridge/messages/init.d.ts +16 -0
  9. package/dist/bridge/messages/init.d.ts.map +1 -1
  10. package/dist/bridge/messages/pageChanged.d.ts +16 -0
  11. package/dist/bridge/messages/pageChanged.d.ts.map +1 -1
  12. package/dist/bridge/pages/page.d.ts +24 -0
  13. package/dist/bridge/pages/page.d.ts.map +1 -1
  14. package/dist/bridge/pages/page.js +9 -0
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/init.d.ts +2 -2
  18. package/dist/init.d.ts.map +1 -1
  19. package/dist/init.js +1 -1
  20. package/dist/react/NotionCustomBlock.css +47 -47
  21. package/dist/react/NotionCustomBlock.js +4 -4
  22. package/dist/react/standalonePreview.js +1 -1
  23. package/dist/react/useCustomBlockInit.d.ts +2 -2
  24. package/dist/react/useCustomBlockInit.d.ts.map +1 -1
  25. package/dist/utils.js +1 -1
  26. package/dist/version.d.ts +1 -1
  27. package/dist/version.d.ts.map +1 -1
  28. package/dist/version.js +1 -1
  29. package/docs/block-location.md +17 -3
  30. package/docs/lifecycle.md +3 -3
  31. package/docs/manifest.md +1 -1
  32. package/docs/pages.md +1 -1
  33. package/package.json +1 -1
  34. package/src/bridge/SandboxBridge.ts +17 -17
  35. package/src/bridge/loadManifest.ts +6 -6
  36. package/src/bridge/pages/page.ts +9 -0
  37. package/src/index.ts +1 -1
  38. package/src/init.ts +4 -4
  39. package/src/react/NotionCustomBlock.css +47 -47
  40. package/src/react/NotionCustomBlock.tsx +14 -10
  41. package/src/react/standalonePreview.ts +1 -1
  42. package/src/react/useCustomBlockInit.ts +2 -2
  43. package/src/utils.ts +1 -1
  44. package/src/version.ts +1 -1
package/HOST.md CHANGED
@@ -66,7 +66,7 @@ The host replies with exactly one `init`, which has two statuses. On success it
66
66
 
67
67
  ```ts
68
68
  // host → sandbox
69
- { type: "init", status: "success", theme, blockId, parent, page: { id }, currentUser, dataSources: { bindings } }
69
+ { type: "init", status: "success", theme, blockId, parent, page: { id, parent }, currentUser, dataSources: { bindings } }
70
70
  ```
71
71
 
72
72
  On failure it carries `error: { code, message, isRetryable }` (`CustomBlockInitErrorInfo` / `customBlockInitErrorInfoSchema`, with `code` drawn from `CustomBlockInitErrorCode` / `customBlockInitErrorCodeSchema`). The SDK surfaces this as a `CustomBlockInitError`:
@@ -82,7 +82,7 @@ After `init`, narrower messages update live state without re-running the handsha
82
82
  // host → sandbox, any time after init
83
83
  { type: "themeChanged", theme }
84
84
  { type: "parentChanged", parent }
85
- { type: "pageChanged", page: { id } }
85
+ { type: "pageChanged", page: { id, parent } }
86
86
  { type: "dataSourcesChanged", dataSources: { bindings } }
87
87
  ```
88
88
 
@@ -112,7 +112,7 @@ Host implementers can use the API-specific aliases and schemas when shaping outb
112
112
 
113
113
  Types:
114
114
 
115
- - `CustomBlockPage` — the current page slice carried in `init.page` and `pageChanged`.
115
+ - `CustomBlockPage` — the current page slice carried in `init.page` and `pageChanged`: the containing page's `id` plus its own `parent` (a `NotionParent`), so the sandbox can tell a freestanding page from a database row. Hosts must re-send `pageChanged` when either field changes, including when the containing page moves without its ID changing.
116
116
  - `NotionDataSourceBinding` — a single binding (collection pointer + schema + property mapping).
117
117
  - `NotionDataSourceBindings` — keyed-by-semantic-key map of bindings, the shape carried in `init.dataSources` and `dataSourcesChanged`.
118
118
  - `NotionDataSourcePageBridge` — wire shape for a single page (raw property IDs in `propertiesById`). The SDK derives the consumer-facing `NotionDataSourcePage` from it.
@@ -134,7 +134,7 @@ Messages sent from the sandbox to the host. Parse `window` `message` events with
134
134
 
135
135
  | Wire type | Type / schema | Behavior |
136
136
  | -------------------- | --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
137
- | `ready` | `ReadyMessage` / `readyMessageSchema` | One-shot handshake; carries `bridgeProtocolVersion`, `sdkVersion`, and the manifest. |
137
+ | `ready` | `ReadyMessage` / `readyMessageSchema` | One-shot handshake; carries `bridgeProtocolVersion`, `sdkVersion`, and the manifest. |
138
138
  | `queryDataSource` | `QueryDataSourceMessage` / `queryDataSourceMessageSchema` | `requestId`-keyed request for the current rows in a raw `dataSourceId`. `snapshotId` names the SDK result slot to update, so later refreshes for the same `useDataSource` call replace the same snapshot instead of creating a new one. |
139
139
  | `createPage` | `CreatePageMessage` / `createPageMessageSchema` | `requestId`-keyed page creation; parent is `page_id` or `data_source_id`. |
140
140
  | `getPage` | `GetPageMessage` / `getPageMessageSchema` | `requestId`-keyed page fetch by page id. |
package/README.md CHANGED
@@ -3,9 +3,9 @@
3
3
  > [!NOTE]
4
4
  > Nothing to see here. This is **extreme** alpha and currently only works for an unreleased product.
5
5
 
6
- SDK for building Notion custom view blocks.
6
+ SDK for building Notion custom blocks.
7
7
 
8
- A custom view runs as a sandboxed `<iframe>` inside a Notion block on iOS, Android, and desktop. The only channel between your view and Notion is a `postMessage` bridge — this SDK wraps it in typed React hooks plus a small framework-neutral runtime API for non-React renderers.
8
+ A custom block runs as a sandboxed `<iframe>` inside a Notion block on iOS, Android, and desktop. The only channel between your block and Notion is a `postMessage` bridge — this SDK wraps it in typed React hooks plus a small framework-neutral runtime API for non-React renderers.
9
9
 
10
10
  > **Pre-release.** Breaking changes may land at any time before 1.0.
11
11
 
package/bin/cli/create.js CHANGED
@@ -69,7 +69,7 @@ function createCustomBlock(pageId) {
69
69
  *
70
70
  * - No `--parent` → create a private page, then a block under it.
71
71
  * - Page `--parent` → create a block under that page.
72
- * - Database/data source `--parent` → a custom *view* under a collection. The
72
+ * - Database/data source `--parent` → a custom block as a collection view. The
73
73
  * public API has no `custom` view type and the parent-nesting the backend
74
74
  * uses isn't derivable from this repo, so we error rather than guess.
75
75
  */
@@ -82,8 +82,8 @@ export function create(options) {
82
82
  const parentUuid = formatUuid(extractId(options.parent));
83
83
  const kind = classifyParent(parentUuid);
84
84
  if (kind === "database" || kind === "data_source") {
85
- console.error(`Error: --parent ${parentUuid} is a ${kind.replace("_", " ")}. Creating a custom view under a collection isn't supported yet.\n`);
86
- console.error(" The public API has no `custom` view type; the backend does the parent nesting. Create the view in Notion, then run `ncblock attach <block-id-or-url>`.");
85
+ console.error(`Error: --parent ${parentUuid} is a ${kind.replace("_", " ")}. Creating a custom block as a collection view isn't supported yet.\n`);
86
+ console.error(" The public API has no `custom` view type; the backend does the parent nesting. Create the custom block in Notion, then run `ncblock attach <block-id-or-url>`.");
87
87
  process.exit(1);
88
88
  }
89
89
  pageId = parentUuid;
@@ -1,6 +1,6 @@
1
1
  import * as v from "valibot";
2
2
  import { unreachable } from "../utils.js";
3
- import { NCBLOCK_SDK_VERSION } from "../version.js";
3
+ import { CUSTOM_BLOCKS_SDK_VERSION } from "../version.js";
4
4
  import { resolveDataSources } from "./dataSources/resolve.js";
5
5
  import { resolvePropertyWriteMapForDataSource } from "./dataSources/resolveProperty.js";
6
6
  import { createEmptyDataSourceQueryState, } from "./hostState.js";
@@ -43,7 +43,7 @@ export class SandboxBridge {
43
43
  }
44
44
  };
45
45
  this.handleMessage = (event) => {
46
- console.debug("[notion-custom-sdk] incoming postMessage", {
46
+ console.debug("[custom-blocks-sdk] incoming postMessage", {
47
47
  data: event.data,
48
48
  fromParent: event.source === window.parent,
49
49
  });
@@ -53,7 +53,7 @@ export class SandboxBridge {
53
53
  this.logMessage("received", event.data);
54
54
  const parsed = v.safeParse(hostToSandboxMessageSchema, event.data);
55
55
  if (!parsed.success) {
56
- console.warn("[notion-custom-sdk] ignoring malformed host message", parsed.issues);
56
+ console.warn("[custom-blocks-sdk] ignoring malformed host message", parsed.issues);
57
57
  const incomingType = readIncomingType(event.data);
58
58
  // Loop guard: never NACK a NACK. Excludes both directions —
59
59
  // `invalidSandboxMessage` is what the host normally sends, but
@@ -75,7 +75,7 @@ export class SandboxBridge {
75
75
  // visibility and stop. We don't retry as the sandbox can't recover from a host-side parse
76
76
  // failure on its own.
77
77
  if (message.type === "invalidSandboxMessage") {
78
- console.warn("[notion-custom-sdk] host reported invalid sandbox message:", message.reason);
78
+ console.warn("[custom-blocks-sdk] host reported invalid sandbox message:", message.reason);
79
79
  return;
80
80
  }
81
81
  // `init` is the only message valid before initialization. Handle it up
@@ -88,7 +88,7 @@ export class SandboxBridge {
88
88
  // below. Reading `this.hostState` repeatedly would re-widen it.
89
89
  const hostState = this.hostState;
90
90
  if (hostState.status !== "initialized") {
91
- console.warn(`[notion-custom-sdk] ignoring ${message.type} before init`);
91
+ console.warn(`[custom-blocks-sdk] ignoring ${message.type} before init`);
92
92
  return;
93
93
  }
94
94
  switch (message.type) {
@@ -157,7 +157,7 @@ export class SandboxBridge {
157
157
  ? { status: "success", page: message.page }
158
158
  : { status: "error", error: message.error };
159
159
  if (!this.pendingCreatePage.resolve(message.requestId, result)) {
160
- console.warn(`[notion-custom-sdk] createPageResult for unknown requestId ${message.requestId}`);
160
+ console.warn(`[custom-blocks-sdk] createPageResult for unknown requestId ${message.requestId}`);
161
161
  }
162
162
  return;
163
163
  }
@@ -166,7 +166,7 @@ export class SandboxBridge {
166
166
  ? { status: "success", page: message.page }
167
167
  : { status: "error", error: message.error };
168
168
  if (!this.pendingGetPage.resolve(message.requestId, result)) {
169
- console.warn(`[notion-custom-sdk] getPageResult for unknown requestId ${message.requestId}`);
169
+ console.warn(`[custom-blocks-sdk] getPageResult for unknown requestId ${message.requestId}`);
170
170
  }
171
171
  return;
172
172
  }
@@ -175,7 +175,7 @@ export class SandboxBridge {
175
175
  ? { status: "success", user: message.user }
176
176
  : { status: "error", error: message.error };
177
177
  if (!this.pendingGetUser.resolve(message.requestId, result)) {
178
- console.warn(`[notion-custom-sdk] getUserResult for unknown requestId ${message.requestId}`);
178
+ console.warn(`[custom-blocks-sdk] getUserResult for unknown requestId ${message.requestId}`);
179
179
  }
180
180
  return;
181
181
  }
@@ -184,7 +184,7 @@ export class SandboxBridge {
184
184
  ? { status: "success", list: message.list }
185
185
  : { status: "error", error: message.error };
186
186
  if (!this.pendingListUsers.resolve(message.requestId, result)) {
187
- console.warn(`[notion-custom-sdk] listUsersResult for unknown requestId ${message.requestId}`);
187
+ console.warn(`[custom-blocks-sdk] listUsersResult for unknown requestId ${message.requestId}`);
188
188
  }
189
189
  return;
190
190
  }
@@ -193,7 +193,7 @@ export class SandboxBridge {
193
193
  ? { status: "success", page: message.page }
194
194
  : { status: "error", error: message.error };
195
195
  if (!this.pendingUpdatePage.resolve(message.requestId, result)) {
196
- console.warn(`[notion-custom-sdk] updatePageResult for unknown requestId ${message.requestId}`);
196
+ console.warn(`[custom-blocks-sdk] updatePageResult for unknown requestId ${message.requestId}`);
197
197
  }
198
198
  return;
199
199
  }
@@ -300,7 +300,7 @@ export class SandboxBridge {
300
300
  return;
301
301
  }
302
302
  if (this.hasSentReady) {
303
- console.warn("[notion-custom-sdk] ignoring duplicate ready message");
303
+ console.warn("[custom-blocks-sdk] ignoring duplicate ready message");
304
304
  return;
305
305
  }
306
306
  const { manifest, error } = manifestResult;
@@ -311,20 +311,20 @@ export class SandboxBridge {
311
311
  type: "ready",
312
312
  status: "error",
313
313
  bridgeProtocolVersion: CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION,
314
- sdkVersion: NCBLOCK_SDK_VERSION,
314
+ sdkVersion: CUSTOM_BLOCKS_SDK_VERSION,
315
315
  error,
316
316
  }
317
317
  : {
318
318
  type: "ready",
319
319
  status: "success",
320
320
  bridgeProtocolVersion: CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION,
321
- sdkVersion: NCBLOCK_SDK_VERSION,
321
+ sdkVersion: CUSTOM_BLOCKS_SDK_VERSION,
322
322
  manifest,
323
323
  };
324
324
  this.postToHost(readyMessage);
325
325
  }
326
326
  postToHost(message) {
327
- console.debug("[notion-custom-sdk] outbound postMessage", message);
327
+ console.debug("[custom-blocks-sdk] outbound postMessage", message);
328
328
  this.logMessage("sent", message);
329
329
  window.parent.postMessage(message, "*");
330
330
  }
@@ -361,7 +361,7 @@ export class SandboxBridge {
361
361
  // because not every consumer renders the error UI, and we want the failure visible in
362
362
  // the browser console either way. We deliberately don't NACK the host or post anything
363
363
  // back over the bridge since the host has already given up.
364
- console.error(`[notion-custom-sdk] host reported init error (${message.error.code}): ${message.error.message}`);
364
+ console.error(`[custom-blocks-sdk] host reported init error (${message.error.code}): ${message.error.message}`);
365
365
  if (this.rejectInit) {
366
366
  this.rejectInit(new CustomBlockInitError(message.error));
367
367
  this.resolveInit = undefined;
@@ -705,11 +705,11 @@ function resolveDataSourceQueryLimit(limit) {
705
705
  return DEFAULT_DATA_SOURCE_QUERY_LIMIT;
706
706
  }
707
707
  if (!Number.isFinite(limit) || !Number.isInteger(limit) || limit < 1) {
708
- console.warn(`[notion-custom-sdk] useDataSource limit must be a positive integer; using ${DEFAULT_DATA_SOURCE_QUERY_LIMIT}.`);
708
+ console.warn(`[custom-blocks-sdk] useDataSource limit must be a positive integer; using ${DEFAULT_DATA_SOURCE_QUERY_LIMIT}.`);
709
709
  return DEFAULT_DATA_SOURCE_QUERY_LIMIT;
710
710
  }
711
711
  if (limit > MAX_DATA_SOURCE_QUERY_LIMIT) {
712
- console.warn(`[notion-custom-sdk] useDataSource limit is capped at ${MAX_DATA_SOURCE_QUERY_LIMIT}.`);
712
+ console.warn(`[custom-blocks-sdk] useDataSource limit is capped at ${MAX_DATA_SOURCE_QUERY_LIMIT}.`);
713
713
  return MAX_DATA_SOURCE_QUERY_LIMIT;
714
714
  }
715
715
  return limit;
@@ -18,7 +18,7 @@ export const customBlockReadyErrorSchema = v.object({
18
18
  export async function loadManifest() {
19
19
  if (typeof fetch !== "function") {
20
20
  const message = `No fetch API available; cannot load ${MANIFEST_URL}.`;
21
- console.warn(`[notion-custom-sdk] ${message}`);
21
+ console.warn(`[custom-blocks-sdk] ${message}`);
22
22
  return {
23
23
  manifest: null,
24
24
  error: { code: "manifest_unavailable", message },
@@ -30,7 +30,7 @@ export async function loadManifest() {
30
30
  }
31
31
  catch (error) {
32
32
  const message = `Could not fetch ${MANIFEST_URL}.`;
33
- console.warn(`[notion-custom-sdk] ${message}`, error);
33
+ console.warn(`[custom-blocks-sdk] ${message}`, error);
34
34
  return {
35
35
  manifest: null,
36
36
  error: { code: "manifest_unavailable", message },
@@ -38,12 +38,12 @@ export async function loadManifest() {
38
38
  }
39
39
  if (response.status === 404) {
40
40
  const message = `No manifest found at ${MANIFEST_URL} (status ${response.status}).`;
41
- console.warn(`[notion-custom-sdk] ${message}`);
41
+ console.warn(`[custom-blocks-sdk] ${message}`);
42
42
  return { manifest: null };
43
43
  }
44
44
  if (!response.ok) {
45
45
  const message = `Could not fetch ${MANIFEST_URL} (status ${response.status}).`;
46
- console.warn(`[notion-custom-sdk] ${message}`);
46
+ console.warn(`[custom-blocks-sdk] ${message}`);
47
47
  return {
48
48
  manifest: null,
49
49
  error: { code: "manifest_unavailable", message },
@@ -55,13 +55,13 @@ export async function loadManifest() {
55
55
  }
56
56
  catch (error) {
57
57
  const message = `Manifest at ${MANIFEST_URL} was not valid JSON.`;
58
- console.warn(`[notion-custom-sdk] ${message}`, error);
58
+ console.warn(`[custom-blocks-sdk] ${message}`, error);
59
59
  return { manifest: null, error: { code: "manifest_invalid", message } };
60
60
  }
61
61
  const parsed = v.safeParse(manifestSchema, json);
62
62
  if (!parsed.success) {
63
63
  const message = `Manifest at ${MANIFEST_URL} did not match schema.`;
64
- console.warn(`[notion-custom-sdk] ${message}`, parsed.issues);
64
+ console.warn(`[custom-blocks-sdk] ${message}`, parsed.issues);
65
65
  return { manifest: null, error: { code: "manifest_invalid", message } };
66
66
  }
67
67
  return { manifest: parsed.output };
@@ -25,6 +25,22 @@ export declare const hostToSandboxMessageSchema: v.VariantSchema<"type", [v.Vari
25
25
  }, undefined>], undefined>;
26
26
  readonly page: v.ObjectSchema<{
27
27
  readonly id: v.CustomSchema<import("../ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
28
+ readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
29
+ readonly type: v.LiteralSchema<"page_id", undefined>;
30
+ readonly page_id: v.CustomSchema<import("../ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
31
+ }, undefined>, v.ObjectSchema<{
32
+ readonly type: v.LiteralSchema<"data_source_id", undefined>;
33
+ readonly data_source_id: v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
34
+ }, undefined>, v.ObjectSchema<{
35
+ readonly type: v.LiteralSchema<"workspace", undefined>;
36
+ readonly workspace: v.LiteralSchema<true, undefined>;
37
+ }, undefined>, v.ObjectSchema<{
38
+ readonly type: v.LiteralSchema<"block_id", undefined>;
39
+ readonly block_id: v.CustomSchema<import("../ids.js").NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
40
+ }, undefined>, v.ObjectSchema<{
41
+ readonly type: v.LiteralSchema<"agent_id", undefined>;
42
+ readonly agent_id: v.CustomSchema<import("../ids.js").NotionAgentId, v.ErrorMessage<v.CustomIssue> | undefined>;
43
+ }, undefined>], undefined>;
28
44
  }, undefined>;
29
45
  readonly dataSources: v.ObjectSchema<{
30
46
  readonly bindings: v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
@@ -216,6 +232,22 @@ export declare const hostToSandboxMessageSchema: v.VariantSchema<"type", [v.Vari
216
232
  readonly type: v.LiteralSchema<"pageChanged", undefined>;
217
233
  readonly page: v.ObjectSchema<{
218
234
  readonly id: v.CustomSchema<import("../ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
235
+ readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
236
+ readonly type: v.LiteralSchema<"page_id", undefined>;
237
+ readonly page_id: v.CustomSchema<import("../ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
238
+ }, undefined>, v.ObjectSchema<{
239
+ readonly type: v.LiteralSchema<"data_source_id", undefined>;
240
+ readonly data_source_id: v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
241
+ }, undefined>, v.ObjectSchema<{
242
+ readonly type: v.LiteralSchema<"workspace", undefined>;
243
+ readonly workspace: v.LiteralSchema<true, undefined>;
244
+ }, undefined>, v.ObjectSchema<{
245
+ readonly type: v.LiteralSchema<"block_id", undefined>;
246
+ readonly block_id: v.CustomSchema<import("../ids.js").NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
247
+ }, undefined>, v.ObjectSchema<{
248
+ readonly type: v.LiteralSchema<"agent_id", undefined>;
249
+ readonly agent_id: v.CustomSchema<import("../ids.js").NotionAgentId, v.ErrorMessage<v.CustomIssue> | undefined>;
250
+ }, undefined>], undefined>;
219
251
  }, undefined>;
220
252
  }, undefined>, v.ObjectSchema<{
221
253
  readonly type: v.LiteralSchema<"currentUserChanged", undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"hostToSandbox.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/messages/hostToSandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAkB5B;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAerC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAC/C,OAAO,0BAA0B,CACjC,CAAA"}
@@ -41,6 +41,22 @@ export declare const initMessageSchema: v.VariantSchema<"status", [v.ObjectSchem
41
41
  }, undefined>], undefined>;
42
42
  readonly page: v.ObjectSchema<{
43
43
  readonly id: v.CustomSchema<import("../ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
44
+ readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
45
+ readonly type: v.LiteralSchema<"page_id", undefined>;
46
+ readonly page_id: v.CustomSchema<import("../ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
47
+ }, undefined>, v.ObjectSchema<{
48
+ readonly type: v.LiteralSchema<"data_source_id", undefined>;
49
+ readonly data_source_id: v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
50
+ }, undefined>, v.ObjectSchema<{
51
+ readonly type: v.LiteralSchema<"workspace", undefined>;
52
+ readonly workspace: v.LiteralSchema<true, undefined>;
53
+ }, undefined>, v.ObjectSchema<{
54
+ readonly type: v.LiteralSchema<"block_id", undefined>;
55
+ readonly block_id: v.CustomSchema<import("../ids.js").NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
56
+ }, undefined>, v.ObjectSchema<{
57
+ readonly type: v.LiteralSchema<"agent_id", undefined>;
58
+ readonly agent_id: v.CustomSchema<import("../ids.js").NotionAgentId, v.ErrorMessage<v.CustomIssue> | undefined>;
59
+ }, undefined>], undefined>;
44
60
  }, undefined>;
45
61
  readonly dataSources: v.ObjectSchema<{
46
62
  readonly bindings: v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/messages/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AASxD,eAAO,MAAM,8BAA8B,2BAAa,CAAA;AAExD,MAAM,MAAM,wBAAwB,GACjC,UAAU,GACV,eAAe,GACf,sBAAsB,GACtB,kBAAkB,GAClB,0BAA0B,GAC1B,8BAA8B,GAC9B,qBAAqB,GACrB,0BAA0B,GAC1B,6BAA6B,GAC7B,yBAAyB,GACzB,0BAA0B,GAC1B,0BAA0B,GAC1B,eAAe,GACf,cAAc,GACd,eAAe,GACf,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEhB,MAAM,MAAM,wBAAwB,GACnC,oBAAoB,CAAC,wBAAwB,CAAC,CAAA;AAE/C,eAAO,MAAM,8BAA8B;;;;aAIzC,CAAA;AAEF,qBAAa,oBACZ,SAAQ,KACR,YAAW,oBAAoB;gBAEnB,KAAK,EAAE,wBAAwB;IAO3C,IAAI,EAAE,wBAAwB,CAAA;IAC9B,WAAW,EAAE,OAAO,CAAA;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAkB5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/messages/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AASxD,eAAO,MAAM,8BAA8B,2BAAa,CAAA;AAExD,MAAM,MAAM,wBAAwB,GACjC,UAAU,GACV,eAAe,GACf,sBAAsB,GACtB,kBAAkB,GAClB,0BAA0B,GAC1B,8BAA8B,GAC9B,qBAAqB,GACrB,0BAA0B,GAC1B,6BAA6B,GAC7B,yBAAyB,GACzB,0BAA0B,GAC1B,0BAA0B,GAC1B,eAAe,GACf,cAAc,GACd,eAAe,GACf,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEhB,MAAM,MAAM,wBAAwB,GACnC,oBAAoB,CAAC,wBAAwB,CAAC,CAAA;AAE/C,eAAO,MAAM,8BAA8B;;;;aAIzC,CAAA;AAEF,qBAAa,oBACZ,SAAQ,KACR,YAAW,oBAAoB;gBAEnB,KAAK,EAAE,wBAAwB;IAO3C,IAAI,EAAE,wBAAwB,CAAA;IAC9B,WAAW,EAAE,OAAO,CAAA;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAkB5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
@@ -6,6 +6,22 @@ export declare const pageChangedMessageSchema: v.ObjectSchema<{
6
6
  readonly type: v.LiteralSchema<"pageChanged", undefined>;
7
7
  readonly page: v.ObjectSchema<{
8
8
  readonly id: v.CustomSchema<import("../ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
9
+ readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
10
+ readonly type: v.LiteralSchema<"page_id", undefined>;
11
+ readonly page_id: v.CustomSchema<import("../ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
12
+ }, undefined>, v.ObjectSchema<{
13
+ readonly type: v.LiteralSchema<"data_source_id", undefined>;
14
+ readonly data_source_id: v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
15
+ }, undefined>, v.ObjectSchema<{
16
+ readonly type: v.LiteralSchema<"workspace", undefined>;
17
+ readonly workspace: v.LiteralSchema<true, undefined>;
18
+ }, undefined>, v.ObjectSchema<{
19
+ readonly type: v.LiteralSchema<"block_id", undefined>;
20
+ readonly block_id: v.CustomSchema<import("../ids.js").NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
21
+ }, undefined>, v.ObjectSchema<{
22
+ readonly type: v.LiteralSchema<"agent_id", undefined>;
23
+ readonly agent_id: v.CustomSchema<import("../ids.js").NotionAgentId, v.ErrorMessage<v.CustomIssue> | undefined>;
24
+ }, undefined>], undefined>;
9
25
  }, undefined>;
10
26
  }, undefined>;
11
27
  export type PageChangedMessage = v.InferOutput<typeof pageChangedMessageSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"pageChanged.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/messages/pageChanged.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;aAGnC,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
1
+ {"version":3,"file":"pageChanged.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/messages/pageChanged.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;aAGnC,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
@@ -6,8 +6,32 @@
6
6
  */
7
7
  import * as v from "valibot";
8
8
  export type { NotionPageId } from "../ids.js";
9
+ /**
10
+ * The custom block's nearest enclosing page ancestor, carried in `init.page` and `pageChanged`.
11
+ */
9
12
  export declare const customBlockPageSchema: v.ObjectSchema<{
10
13
  readonly id: v.CustomSchema<import("./page.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
14
+ /**
15
+ * The containing page's own parent. It lets a block distinguish a freestanding page from a
16
+ * database row without a round trip. Not to be confused with the top-level `parent` runtime
17
+ * value, which is the custom block's own parent.
18
+ */
19
+ readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
20
+ readonly type: v.LiteralSchema<"page_id", undefined>;
21
+ readonly page_id: v.CustomSchema<import("./page.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
22
+ }, undefined>, v.ObjectSchema<{
23
+ readonly type: v.LiteralSchema<"data_source_id", undefined>;
24
+ readonly data_source_id: v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
25
+ }, undefined>, v.ObjectSchema<{
26
+ readonly type: v.LiteralSchema<"workspace", undefined>;
27
+ readonly workspace: v.LiteralSchema<true, undefined>;
28
+ }, undefined>, v.ObjectSchema<{
29
+ readonly type: v.LiteralSchema<"block_id", undefined>;
30
+ readonly block_id: v.CustomSchema<import("../ids.js").NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
31
+ }, undefined>, v.ObjectSchema<{
32
+ readonly type: v.LiteralSchema<"agent_id", undefined>;
33
+ readonly agent_id: v.CustomSchema<import("../ids.js").NotionAgentId, v.ErrorMessage<v.CustomIssue> | undefined>;
34
+ }, undefined>], undefined>;
11
35
  }, undefined>;
12
36
  export type CustomBlockPage = v.InferOutput<typeof customBlockPageSchema>;
13
37
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/pages/page.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C,eAAO,MAAM,qBAAqB;;aAEhC,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B;;;;;;0BAMtC,CAAA;AACF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,WAAW,CAChD,OAAO,2BAA2B,CAClC,CAAA;AAED,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,CA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,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAClD,OAAO,6BAA6B,CACpC,CAAA;AAED,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GACtD,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/B,KAAK,CAAA;AAER;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GACvC,sBAAsB,CAAC,uBAAuB,CAAC,CAAA;AAEhD,MAAM,MAAM,0BAA0B,GAAG;IACxC,CAAC,eAAe,EAAE,MAAM,GAAG,4BAA4B,CAAA;CACvD,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
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/pages/page.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,CAAC,M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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
@@ -7,8 +7,17 @@
7
7
  import * as v from "valibot";
8
8
  import { notionDataSourceIdSchema, notionPageIdSchema } from "../ids.js";
9
9
  import { notionParentSchema } from "../parent.js";
10
+ /**
11
+ * The custom block's nearest enclosing page ancestor, carried in `init.page` and `pageChanged`.
12
+ */
10
13
  export const customBlockPageSchema = v.object({
11
14
  id: notionPageIdSchema,
15
+ /**
16
+ * The containing page's own parent. It lets a block distinguish a freestanding page from a
17
+ * database row without a round trip. Not to be confused with the top-level `parent` runtime
18
+ * value, which is the custom block's own parent.
19
+ */
20
+ parent: notionParentSchema,
12
21
  });
13
22
  /**
14
23
  * Parent reference accepted by `pages.create` / `pages.update` inputs.
package/dist/index.d.ts CHANGED
@@ -32,6 +32,6 @@ export type { NotionParent } from "./bridge/parent.js";
32
32
  export { pages, users } from "./bridge/sandboxClient.js";
33
33
  export type { NotionTheme } from "./bridge/theme.js";
34
34
  export { type CustomBlockState, customBlock } from "./customBlock.js";
35
- export { type CustomBlockInitial, type InitCustomBlockOptions, initCustomBlock, NotInIframeError, } from "./init.js";
35
+ export { type CustomBlockInitPayload, type InitCustomBlockOptions, initCustomBlock, NotInIframeError, } from "./init.js";
36
36
  export * from "./types.js";
37
37
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EACX,sBAAsB,EACtB,gBAAgB,GAChB,MAAM,oCAAoC,CAAA;AAC3C,YAAY,EACX,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,GAChC,MAAM,wCAAwC,CAAA;AAC/C,YAAY,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AACpF,YAAY,EACX,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,mCAAmC,CAAA;AAC1C,YAAY,EACX,wCAAwC,EACxC,wCAAwC,GACxC,MAAM,gCAAgC,CAAA;AACvC,YAAY,EACX,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GACjB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EACN,2BAA2B,EAC3B,qBAAqB,GACrB,MAAM,wCAAwC,CAAA;AAC/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAChF,YAAY,EACX,4BAA4B,EAC5B,4BAA4B,GAC5B,MAAM,yCAAyC,CAAA;AAChD,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC9D,YAAY,EACX,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,aAAa,GACb,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACX,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,GAChB,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAC/E,YAAY,EACX,8BAA8B,EAC9B,8BAA8B,GAC9B,MAAM,uCAAuC,CAAA;AAC9C,YAAY,EACX,2BAA2B,EAC3B,2BAA2B,GAC3B,MAAM,8BAA8B,CAAA;AACrC,YAAY,EACX,2BAA2B,EAC3B,2BAA2B,GAC3B,MAAM,8BAA8B,CAAA;AACrC,YAAY,EACX,wBAAwB,EACxB,wBAAwB,GACxB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,YAAY,EACX,6BAA6B,EAC7B,6BAA6B,GAC7B,MAAM,gCAAgC,CAAA;AACvC,YAAY,EACX,mCAAmC,EACnC,mCAAmC,GACnC,MAAM,4CAA4C,CAAA;AACnD,YAAY,EACX,8BAA8B,EAC9B,8BAA8B,GAC9B,MAAM,uCAAuC,CAAA;AAC9C,YAAY,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,0BAA0B,EAC1B,4BAA4B,EAC5B,uBAAuB,EACvB,0BAA0B,GAC1B,MAAM,wBAAwB,CAAA;AAC/B,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACxD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,eAAe,EACf,gBAAgB,GAChB,MAAM,WAAW,CAAA;AAClB,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EACX,sBAAsB,EACtB,gBAAgB,GAChB,MAA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AwB,GACxB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,YAAY,EACX,6BAA6B,EAC7B,6BAA6B,GAC7B,MAAM,gCAAgC,CAAA;AACvC,YAAY,EACX,mCAAmC,EACnC,mCAAmC,GACnC,MAAM,4CAA4C,CAAA;AACnD,YAAY,EACX,8BAA8B,EAC9B,8BAA8B,GAC9B,MAAM,uCAAuC,CAAA;AAC9C,YAAY,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,0BAA0B,EAC1B,4BAA4B,EAC5B,uBAAuB,EACvB,0BAA0B,GAC1B,MAAM,wBAAwB,CAAA;AAC/B,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACxD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EACN,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,eAAe,EACf,gBAAgB,GAChB,MAAM,WAAW,CAAA;AAClB,cAAc,YAAY,CAAA"}
package/dist/init.d.ts CHANGED
@@ -8,7 +8,7 @@ import type { NotionUser } from "./bridge/users/user.js";
8
8
  /**
9
9
  * The payload sent by the host in the `init` message in response to the sandbox's `ready` message.
10
10
  */
11
- export type CustomBlockInitial = {
11
+ export type CustomBlockInitPayload = {
12
12
  theme: NotionTheme;
13
13
  blockId: NotionBlockId;
14
14
  parent: NotionParent;
@@ -49,5 +49,5 @@ export type InitCustomBlockOptions = {
49
49
  * Mount your React tree (or call any SDK hook / `customBlock.subscribe`) only after the
50
50
  * returned promise resolves.
51
51
  */
52
- export declare function initCustomBlock(opts?: InitCustomBlockOptions): Promise<CustomBlockInitial>;
52
+ export declare function initCustomBlock(opts?: InitCustomBlockOptions): Promise<CustomBlockInitPayload>;
53
53
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,OAAO,EAEN,KAAK,wBAAwB,EAE7B,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAExD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE,WAAW,CAAA;IAClB,OAAO,EAAE,aAAa,CAAA;IACtB,MAAM,EAAE,YAAY,CAAA;IACpB,IAAI,EAAE,eAAe,CAAA;IACrB,WAAW,EAAE,UAAU,CAAA;IACvB,WAAW,EAAE,gBAAgB,EAAE,CAAA;CAC/B,CAAA;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;gBAC9B,OAAO,GAAE,MAA8B;IAOnD,IAAI,EAAE,wBAAwB,CAAA;IAC9B,WAAW,EAAE,OAAO,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AASD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC9B,IAAI,GAAE,sBAA2B,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAyD7B"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,OAAO,EAEN,KAAK,wBAAwB,EAE7B,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAExD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC,KAAK,EAAE,WAAW,CAAA;IAClB,OAAO,EAAE,aAAa,CAAA;IACtB,MAAM,EAAE,YAAY,CAAA;IACpB,IAAI,EAAE,eAAe,CAAA;IACrB,WAAW,EAAE,UAAU,CAAA;IACvB,WAAW,EAAE,gBAAgB,EAAE,CAAA;CAC/B,CAAA;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;gBAC9B,OAAO,GAAE,MAA8B;IAOnD,IAAI,EAAE,wBAAwB,CAAA;IAC9B,WAAW,EAAE,OAAO,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AASD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC9B,IAAI,GAAE,sBAA2B,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAyDjC"}
package/dist/init.js CHANGED
@@ -56,7 +56,7 @@ export function initCustomBlock(opts = {}) {
56
56
  throw error;
57
57
  }
58
58
  if (message.status === "error") {
59
- console.error(`[notion-custom-sdk] host reported init error (${message.error.code}): ${message.error.message}`);
59
+ console.error(`[custom-blocks-sdk] host reported init error (${message.error.code}): ${message.error.message}`);
60
60
  throw new CustomBlockInitError(message.error);
61
61
  }
62
62
  const hostState = customBlockHost.getState();