@notionhq/custom-blocks 0.1.44 → 0.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridge/SandboxBridge.d.ts +1 -1
- package/dist/bridge/SandboxBridge.d.ts.map +1 -1
- package/dist/bridge/SandboxBridge.js +4 -21
- package/dist/bridge/primedResponses.d.ts +8 -0
- package/dist/bridge/primedResponses.d.ts.map +1 -0
- package/dist/bridge/primedResponses.js +5 -0
- package/dist/bridge/sandboxClient.d.ts +1 -1
- package/dist/bridge/sandboxClient.d.ts.map +1 -1
- package/dist/bridge/sandboxClient.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/init.d.ts +2 -14
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +7 -30
- package/dist/protocol/index.d.ts +3 -2
- package/dist/protocol/index.js +3 -2
- package/dist/protocol/messages/init.d.ts +2 -2
- package/dist/protocol/messages/isInitHandshakeMessage.d.ts +4 -0
- package/dist/protocol/messages/isInitHandshakeMessage.js +11 -0
- package/dist/protocol/{messagePayload.d.ts → messages/messagePayload.d.ts} +1 -1
- package/dist/react/NotionCustomBlock.d.ts +3 -5
- package/dist/react/NotionCustomBlock.d.ts.map +1 -1
- package/dist/react/NotionCustomBlock.js +3 -4
- package/dist/react/useCustomBlockInit.d.ts +4 -4
- package/dist/react/useCustomBlockInit.d.ts.map +1 -1
- package/dist/react/useCustomBlockInit.js +3 -4
- package/dist/testing.d.ts +0 -5
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +1 -5
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/docs/errors.md +1 -1
- package/docs/lifecycle.md +10 -15
- package/package.json +1 -1
- package/src/bridge/SandboxBridge.ts +4 -24
- package/src/bridge/primedResponses.ts +11 -0
- package/src/bridge/sandboxClient.ts +2 -2
- package/src/index.ts +0 -1
- package/src/init.ts +7 -52
- package/src/react/NotionCustomBlock.tsx +4 -6
- package/src/react/useCustomBlockInit.ts +5 -12
- package/src/testing.ts +1 -8
- package/src/types.ts +1 -1
- /package/dist/protocol/{incomingType.d.ts → messages/incomingType.d.ts} +0 -0
- /package/dist/protocol/{incomingType.js → messages/incomingType.js} +0 -0
- /package/dist/protocol/{messagePayload.js → messages/messagePayload.js} +0 -0
|
@@ -47,7 +47,7 @@ export declare class SandboxBridge {
|
|
|
47
47
|
private logMessage;
|
|
48
48
|
getMessageLog(): readonly MessageLogEntry[];
|
|
49
49
|
subscribeToMessageLog(listener: () => void): () => boolean;
|
|
50
|
-
awaitInit(
|
|
50
|
+
awaitInit(): Promise<void>;
|
|
51
51
|
sendConnect(manifestResult: ManifestLoadResult): void;
|
|
52
52
|
private postToHost;
|
|
53
53
|
private sendToHost;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxBridge.d.ts","sourceRoot":"","sources":["../../src/bridge/SandboxBridge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,gBAAgB,EAEhB,MAAM,4DAA4D,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAA;AAc3E,OAAO,EAEN,KAAK,WAAW,EAEhB,MAAM,mDAAmD,CAAA;
|
|
1
|
+
{"version":3,"file":"SandboxBridge.d.ts","sourceRoot":"","sources":["../../src/bridge/SandboxBridge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,gBAAgB,EAEhB,MAAM,4DAA4D,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAA;AAc3E,OAAO,EAEN,KAAK,WAAW,EAEhB,MAAM,mDAAmD,CAAA;AAe1D,OAAO,KAAK,EACX,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,8BAA8B,EAC9B,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,MA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AAI,GAAE,aAAkB,GAAG,OAAO,CAAC,eAAe,CAAC,CAW5D;IAED,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA2C1D;IAED;;;;OAIG;IACH,oBAAoB,CAAC,IAAI,EAAE;QAC1B,UAAU,EAAE,gBAAgB,CAAA;QAC5B,MAAM,EAAE,YAAY,CAAA;QACpB,cAAc,EAAE,8BAA8B,CAAA;KAC9C,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAqB5B;IAED;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;CAkE/B"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { DEFAULT_CONTRAST_MODE } from "../protocol/contrast.js";
|
|
2
|
-
import { readIncomingType } from "../protocol/incomingType.js";
|
|
3
2
|
import { hostToSandboxMessageSchema, } from "../protocol/messages/hostToSandbox.js";
|
|
3
|
+
import { readIncomingType } from "../protocol/messages/incomingType.js";
|
|
4
4
|
import { CustomBlockInitializationError, initMessageSchema, } from "../protocol/messages/init.js";
|
|
5
5
|
import { CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION } from "../protocol/protocolVersion.js";
|
|
6
6
|
import * as v from "valibot";
|
|
7
|
-
import { globalPrimedResponsesCache } from "../testing.js";
|
|
8
7
|
import { unreachable } from "../utils.js";
|
|
9
8
|
import { CUSTOM_BLOCKS_SDK_VERSION } from "../version.js";
|
|
10
9
|
import { NOTION_DARK_BACKGROUND_BASE, NOTION_LIGHT_BACKGROUND_BASE, } from "./appearance.js";
|
|
@@ -14,6 +13,7 @@ import { resolvePropertyWriteMapForDataSource } from "./dataSources/resolvePrope
|
|
|
14
13
|
import { createEmptyDataSourceQueryState, } from "./hostState.js";
|
|
15
14
|
import { notifyListener } from "./notifyListener.js";
|
|
16
15
|
import { PendingRequests } from "./pendingRequests.js";
|
|
16
|
+
import { globalPrimedResponsesCache } from "./primedResponses.js";
|
|
17
17
|
const RESPONSE_TYPE_BY_REQUEST = new Map([
|
|
18
18
|
["getPage", "getPageResult"],
|
|
19
19
|
["createPage", "createPageResult"],
|
|
@@ -80,25 +80,8 @@ export class SandboxBridge {
|
|
|
80
80
|
this.messageLogListeners.add(listener);
|
|
81
81
|
return () => this.messageLogListeners.delete(listener);
|
|
82
82
|
}
|
|
83
|
-
awaitInit(
|
|
84
|
-
|
|
85
|
-
return this.initMessage;
|
|
86
|
-
}
|
|
87
|
-
return new Promise((resolve, reject) => {
|
|
88
|
-
if (signal.aborted) {
|
|
89
|
-
reject(signal.reason);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const onAbort = () => reject(signal.reason);
|
|
93
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
94
|
-
this.initMessage.then(() => {
|
|
95
|
-
signal.removeEventListener("abort", onAbort);
|
|
96
|
-
resolve();
|
|
97
|
-
}, err => {
|
|
98
|
-
signal.removeEventListener("abort", onAbort);
|
|
99
|
-
reject(err);
|
|
100
|
-
});
|
|
101
|
-
});
|
|
83
|
+
awaitInit() {
|
|
84
|
+
return this.initMessage;
|
|
102
85
|
}
|
|
103
86
|
sendConnect(manifestResult) {
|
|
104
87
|
if (typeof window === "undefined") {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BridgeMessagePayload } from "../protocol/index.js";
|
|
2
|
+
import type { PrimeableHostToSandboxMessage } from "../protocol/messages/hostToSandbox.js";
|
|
3
|
+
/**
|
|
4
|
+
* Shared across sandbox bridge instances. Each result type holds one response;
|
|
5
|
+
* consuming it removes it, and priming it again replaces the previous response.
|
|
6
|
+
*/
|
|
7
|
+
export declare const globalPrimedResponsesCache: Map<"createPageResult" | "getPageResult" | "getUserResult" | "listUsersResult" | "queryDataSourceResult" | "updatePageResult", BridgeMessagePayload<PrimeableHostToSandboxMessage>>;
|
|
8
|
+
//# sourceMappingURL=primedResponses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primedResponses.d.ts","sourceRoot":"","sources":["../../src/bridge/primedResponses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAC5E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,4DAA4D,CAAA;AAE/G;;;GAGG;AACH,eAAO,MAAM,0BAA0B,qLAGpC,CAAA"}
|
|
@@ -7,7 +7,7 @@ import { type MessageLogEntry, type QueryDataSourceArgs } from "./SandboxBridge.
|
|
|
7
7
|
export declare const customBlockHost: {
|
|
8
8
|
start: () => void;
|
|
9
9
|
sendConnect: (manifestResult: ManifestLoadResult) => void;
|
|
10
|
-
awaitInit: (
|
|
10
|
+
awaitInit: () => Promise<void>;
|
|
11
11
|
subscribe: (listener: () => void) => () => boolean;
|
|
12
12
|
getState: () => CustomBlockHostState;
|
|
13
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandboxClient.d.ts","sourceRoot":"","sources":["../../src/bridge/sandboxClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAA;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAA;AACpF,OAAO,KAAK,EACX,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAExB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAExB,MAAM,oBAAoB,CAAA;AAY3B,eAAO,MAAM,eAAe;IAC3B,KAAK;IAIL,WAAW,mBAAmB,kBAAkB;IAIhD,SAAS,
|
|
1
|
+
{"version":3,"file":"sandboxClient.d.ts","sourceRoot":"","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;OAEG;IACH,MAAM,UAAU,cAAc,KAAG,OAAO,CAAC,gBAAgB,CAAC;IAI1D;;OAEG;IACH,OAAO,WAAW,YAAY,KAAG,OAAO,CAAC,gBAAgB,CAAC;IAI1D;;OAEG;IACH,SAAS,WAAW,YAAY,KAAG,OAAO,CAAC,gBAAgB,CAAC;IAI5D;;;OAGG;IACH,MAAM,WAAW,YAAY,KAAG,OAAO,CAAC,gBAAgB,CAAC;CASzD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,KAAK;IACjB;;OAEG;IACH,IAAI,WAAW,aAAa,KAAG,OAAO,CAAC,eAAe,CAAC;IAIvD;;OAEG;IACH,GAAG,WAAW,YAAY,KAAG,OAAO,CAAC,aAAa,CAAC;CAGnD,CAAA"}
|
|
@@ -15,8 +15,8 @@ export const customBlockHost = {
|
|
|
15
15
|
sendConnect: (manifestResult) => {
|
|
16
16
|
getBridge().sendConnect(manifestResult);
|
|
17
17
|
},
|
|
18
|
-
awaitInit: (
|
|
19
|
-
return getBridge().awaitInit(
|
|
18
|
+
awaitInit: () => {
|
|
19
|
+
return getBridge().awaitInit();
|
|
20
20
|
},
|
|
21
21
|
subscribe: (listener) => {
|
|
22
22
|
return getBridge().subscribe(listener);
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,6 @@ export type { NotionParent } from "./protocol/parent.js";
|
|
|
31
31
|
export type { NotionTheme } from "./protocol/theme.js";
|
|
32
32
|
export { pages, users } from "./bridge/sandboxClient.js";
|
|
33
33
|
export { type CustomBlockState, customBlock } from "./customBlock.js";
|
|
34
|
-
export { type CustomBlockInitPayload,
|
|
34
|
+
export { type CustomBlockInitPayload, initCustomBlock, NotInIframeError, } from "./init.js";
|
|
35
35
|
export * from "./types.js";
|
|
36
36
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA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,2CAA2C,CAAA;AAC5E,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EACN,KAAK,sBAAsB,EAC3B,eAAe,EACf,gBAAgB,GAChB,MAAM,WAAW,CAAA;AAClB,cAAc,YAAY,CAAA"}
|
package/dist/init.d.ts
CHANGED
|
@@ -28,18 +28,6 @@ export declare class NotInIframeError extends CustomBlockInitializationError {
|
|
|
28
28
|
constructor(message?: string);
|
|
29
29
|
code: "not_in_iframe";
|
|
30
30
|
}
|
|
31
|
-
/**
|
|
32
|
-
* Options for {@link initCustomBlock}.
|
|
33
|
-
*/
|
|
34
|
-
export type InitCustomBlockOptions = {
|
|
35
|
-
/**
|
|
36
|
-
* How long to wait for the host's `init` response before rejecting with an error.
|
|
37
|
-
*
|
|
38
|
-
* @default 15000 - Intentionally longer than Notion's 10s host-dependency watchdog
|
|
39
|
-
* so host-owned init errors can arrive before the SDK's generic fallback appears.
|
|
40
|
-
*/
|
|
41
|
-
timeoutMs?: number;
|
|
42
|
-
};
|
|
43
31
|
/**
|
|
44
32
|
* Initializes the custom block by running the SDK <-> host handshake.
|
|
45
33
|
*
|
|
@@ -47,8 +35,8 @@ export type InitCustomBlockOptions = {
|
|
|
47
35
|
* user, data sources) once the host has initialized the block. Rejects with a
|
|
48
36
|
* `CustomBlockInitializationError` if initialization fails.
|
|
49
37
|
*
|
|
50
|
-
* Idempotent: subsequent calls return the same promise as the first
|
|
38
|
+
* Idempotent: subsequent calls return the same promise as the first.
|
|
51
39
|
* Mount your React tree (or call any SDK hook) only after the returned promise resolves.
|
|
52
40
|
*/
|
|
53
|
-
export declare function initCustomBlock(
|
|
41
|
+
export declare function initCustomBlock(): Promise<CustomBlockInitPayload>;
|
|
54
42
|
//# sourceMappingURL=init.d.ts.map
|
package/dist/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAA;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAA;AAClG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAA;AAKhF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC,KAAK,EAAE,WAAW,CAAA;IAClB,YAAY,EAAE,kBAAkB,CAAA;IAChC,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,8BAA8B;IACnE,YAAY,OAAO,GAAE,MAA8B,EAOlD;IAEO,IAAI,EAAE,eAAe,CAAA;CAC7B;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAA;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAA;AAClG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAA;AAKhF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC,KAAK,EAAE,WAAW,CAAA;IAClB,YAAY,EAAE,kBAAkB,CAAA;IAChC,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,8BAA8B;IACnE,YAAY,OAAO,GAAE,MAA8B,EAOlD;IAEO,IAAI,EAAE,eAAe,CAAA;CAC7B;AAOD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAMjE"}
|
package/dist/init.js
CHANGED
|
@@ -18,7 +18,6 @@ export class NotInIframeError extends CustomBlockInitializationError {
|
|
|
18
18
|
this.name = "NotInIframeError";
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
const DEFAULT_INIT_TIMEOUT_MS = 15_000;
|
|
22
21
|
const NOT_IN_IFRAME_MESSAGE = "<NotionCustomBlock> only works inside an iframe — use the dev shell or deploy to Notion.";
|
|
23
22
|
let initPromise;
|
|
24
23
|
/**
|
|
@@ -28,13 +27,13 @@ let initPromise;
|
|
|
28
27
|
* user, data sources) once the host has initialized the block. Rejects with a
|
|
29
28
|
* `CustomBlockInitializationError` if initialization fails.
|
|
30
29
|
*
|
|
31
|
-
* Idempotent: subsequent calls return the same promise as the first
|
|
30
|
+
* Idempotent: subsequent calls return the same promise as the first.
|
|
32
31
|
* Mount your React tree (or call any SDK hook) only after the returned promise resolves.
|
|
33
32
|
*/
|
|
34
|
-
export function initCustomBlock(
|
|
33
|
+
export function initCustomBlock() {
|
|
35
34
|
if (initPromise === undefined) {
|
|
36
35
|
customBlockHost.start();
|
|
37
|
-
initPromise = performHandshake(
|
|
36
|
+
initPromise = performHandshake();
|
|
38
37
|
}
|
|
39
38
|
return initPromise;
|
|
40
39
|
}
|
|
@@ -49,19 +48,18 @@ export function initCustomBlock(opts = {}) {
|
|
|
49
48
|
* Resolves with the `init` payload after the process above. Rejects with a
|
|
50
49
|
* `CustomBlockInitializationError` if any step fails.
|
|
51
50
|
*/
|
|
52
|
-
async function performHandshake(
|
|
51
|
+
async function performHandshake() {
|
|
53
52
|
try {
|
|
54
53
|
// Fail fast with a typed error when rendered as a standalone tab and not in a parent frame.
|
|
55
|
-
// Otherwise,
|
|
56
|
-
//
|
|
54
|
+
// Otherwise, `postMessage` to `window.parent` would just hit the same window and never
|
|
55
|
+
// arrive.
|
|
57
56
|
if (typeof window !== "undefined" && window.parent === window) {
|
|
58
57
|
throw new NotInIframeError();
|
|
59
58
|
}
|
|
60
59
|
// Load the manifest and send it to the host.
|
|
61
60
|
const manifestResult = await attemptToLoadSelfHostedManifest();
|
|
62
61
|
customBlockHost.sendConnect(manifestResult);
|
|
63
|
-
|
|
64
|
-
await awaitHostInitWithTimeout(timeoutMs);
|
|
62
|
+
await customBlockHost.awaitInit();
|
|
65
63
|
const hostState = customBlockHost.getState();
|
|
66
64
|
switch (hostState.status) {
|
|
67
65
|
case "initialized":
|
|
@@ -96,24 +94,3 @@ async function performHandshake(opts) {
|
|
|
96
94
|
});
|
|
97
95
|
}
|
|
98
96
|
}
|
|
99
|
-
async function awaitHostInitWithTimeout(timeoutMs) {
|
|
100
|
-
try {
|
|
101
|
-
await customBlockHost.awaitInit(AbortSignal.timeout(timeoutMs));
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
if (isTimeoutError(error)) {
|
|
105
|
-
throw new CustomBlockInitializationError({
|
|
106
|
-
code: "init_timeout",
|
|
107
|
-
message: "Host did not respond to the `connect` message before the timeout.",
|
|
108
|
-
isRetryable: true,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
throw error;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
function isTimeoutError(error) {
|
|
115
|
-
return (typeof error === "object" &&
|
|
116
|
-
error !== null &&
|
|
117
|
-
"name" in error &&
|
|
118
|
-
(error.name === "TimeoutError" || error.name === "AbortError"));
|
|
119
|
-
}
|
package/dist/protocol/index.d.ts
CHANGED
|
@@ -15,9 +15,7 @@ export * from "./dataSources/propertySchema.js";
|
|
|
15
15
|
export * from "./dataSources/recordPointer.js";
|
|
16
16
|
export * from "./errors.js";
|
|
17
17
|
export * from "./ids.js";
|
|
18
|
-
export * from "./incomingType.js";
|
|
19
18
|
export * from "./manifest.js";
|
|
20
|
-
export * from "./messagePayload.js";
|
|
21
19
|
export * from "./messages/connect.js";
|
|
22
20
|
export * from "./messages/contrastModeChanged.js";
|
|
23
21
|
export * from "./messages/createPage.js";
|
|
@@ -27,11 +25,14 @@ export * from "./messages/dataSourcesChanged.js";
|
|
|
27
25
|
export * from "./messages/getPage.js";
|
|
28
26
|
export * from "./messages/getUser.js";
|
|
29
27
|
export * from "./messages/hostToSandbox.js";
|
|
28
|
+
export * from "./messages/incomingType.js";
|
|
30
29
|
export * from "./messages/init.js";
|
|
31
30
|
export * from "./messages/initResult.js";
|
|
32
31
|
export * from "./messages/invalidHostMessage.js";
|
|
33
32
|
export * from "./messages/invalidSandboxMessage.js";
|
|
33
|
+
export * from "./messages/isInitHandshakeMessage.js";
|
|
34
34
|
export * from "./messages/listUsers.js";
|
|
35
|
+
export * from "./messages/messagePayload.js";
|
|
35
36
|
export * from "./messages/pageChanged.js";
|
|
36
37
|
export * from "./messages/parentChanged.js";
|
|
37
38
|
export * from "./messages/queryDataSource.js";
|
package/dist/protocol/index.js
CHANGED
|
@@ -15,9 +15,7 @@ export * from "./dataSources/propertySchema.js";
|
|
|
15
15
|
export * from "./dataSources/recordPointer.js";
|
|
16
16
|
export * from "./errors.js";
|
|
17
17
|
export * from "./ids.js";
|
|
18
|
-
export * from "./incomingType.js";
|
|
19
18
|
export * from "./manifest.js";
|
|
20
|
-
export * from "./messagePayload.js";
|
|
21
19
|
export * from "./messages/connect.js";
|
|
22
20
|
export * from "./messages/contrastModeChanged.js";
|
|
23
21
|
export * from "./messages/createPage.js";
|
|
@@ -27,11 +25,14 @@ export * from "./messages/dataSourcesChanged.js";
|
|
|
27
25
|
export * from "./messages/getPage.js";
|
|
28
26
|
export * from "./messages/getUser.js";
|
|
29
27
|
export * from "./messages/hostToSandbox.js";
|
|
28
|
+
export * from "./messages/incomingType.js";
|
|
30
29
|
export * from "./messages/init.js";
|
|
31
30
|
export * from "./messages/initResult.js";
|
|
32
31
|
export * from "./messages/invalidHostMessage.js";
|
|
33
32
|
export * from "./messages/invalidSandboxMessage.js";
|
|
33
|
+
export * from "./messages/isInitHandshakeMessage.js";
|
|
34
34
|
export * from "./messages/listUsers.js";
|
|
35
|
+
export * from "./messages/messagePayload.js";
|
|
35
36
|
export * from "./messages/pageChanged.js";
|
|
36
37
|
export * from "./messages/parentChanged.js";
|
|
37
38
|
export * from "./messages/queryDataSource.js";
|
|
@@ -2,14 +2,14 @@ import * as v from "valibot";
|
|
|
2
2
|
import type { CustomBlockErrorCode, CustomBlockErrorInfo } from "../errors.js";
|
|
3
3
|
import type { CustomBlockInitResultErrorCode } from "./initResult.js";
|
|
4
4
|
export declare const customBlockInitErrorCodeSchema: v.StringSchema<undefined>;
|
|
5
|
-
export type CustomBlockInitErrorCode = CustomBlockErrorCode<"manifest_unavailable" | "manifest_invalid" | "invalid_connect_payload" | "invalid_protocol_version" | "unsupported_protocol_version" | "context_unavailable" | "current_user_unavailable" | "missing_data_source_binding" | "data_source_unavailable" | "missing_property_binding" | "invalid_property_binding">;
|
|
5
|
+
export type CustomBlockInitErrorCode = CustomBlockErrorCode<"manifest_unavailable" | "manifest_invalid" | "invalid_connect_payload" | "invalid_protocol_version" | "unsupported_protocol_version" | "init_timeout" | "context_unavailable" | "current_user_unavailable" | "missing_data_source_binding" | "data_source_unavailable" | "missing_property_binding" | "invalid_property_binding">;
|
|
6
6
|
export type CustomBlockInitErrorInfo = CustomBlockErrorInfo<CustomBlockInitErrorCode>;
|
|
7
7
|
/**
|
|
8
8
|
* Every initialization failure visible to block code. This combines errors
|
|
9
9
|
* received in `init`, errors the sandbox reports in `initResult`, and failures
|
|
10
10
|
* detected locally while running `initCustomBlock()`.
|
|
11
11
|
*/
|
|
12
|
-
export type CustomBlockInitializationErrorCode = CustomBlockInitErrorCode | CustomBlockInitResultErrorCode | CustomBlockErrorCode<"not_in_iframe"
|
|
12
|
+
export type CustomBlockInitializationErrorCode = CustomBlockInitErrorCode | CustomBlockInitResultErrorCode | CustomBlockErrorCode<"not_in_iframe">;
|
|
13
13
|
export type CustomBlockInitializationErrorInfo = CustomBlockErrorInfo<CustomBlockInitializationErrorCode>;
|
|
14
14
|
export declare const customBlockInitErrorInfoSchema: v.ObjectSchema<{
|
|
15
15
|
readonly code: v.StringSchema<undefined>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HostToSandboxMessage } from "./hostToSandbox.js";
|
|
2
|
+
import type { SandboxToHostMessage } from "./sandboxToHost.js";
|
|
3
|
+
/** Returns whether a message belongs to the initialization handshake. */
|
|
4
|
+
export declare function isInitHandshakeMessage(message: SandboxToHostMessage | HostToSandboxMessage): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CustomBlockErrorInfo } from "
|
|
1
|
+
import type { CustomBlockErrorInfo } from "../errors.js";
|
|
2
2
|
type WithTypedErrorInfo<T, TErrorInfo extends CustomBlockErrorInfo | undefined> = TErrorInfo extends CustomBlockErrorInfo ? T extends {
|
|
3
3
|
error: CustomBlockErrorInfo;
|
|
4
4
|
} ? Omit<T, "error"> & {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type InitCustomBlockOptions } from "../init.js";
|
|
3
2
|
import "./NotionCustomBlock.css";
|
|
4
3
|
/**
|
|
5
4
|
* Props accepted by {@link NotionCustomBlock}.
|
|
6
5
|
*/
|
|
7
|
-
export type NotionCustomBlockProps =
|
|
6
|
+
export type NotionCustomBlockProps = {
|
|
8
7
|
children: ReactNode;
|
|
9
8
|
/**
|
|
10
9
|
* Rendered while the SDK ↔ host handshake is in progress. Defaults to
|
|
@@ -28,8 +27,7 @@ export type NotionCustomBlockProps = InitCustomBlockOptions & {
|
|
|
28
27
|
};
|
|
29
28
|
/**
|
|
30
29
|
* Top-level wrapper that runs the SDK ↔ host handshake and gates `children`
|
|
31
|
-
* until it resolves.
|
|
32
|
-
* {@link initCustomBlock}.
|
|
30
|
+
* until it resolves.
|
|
33
31
|
*
|
|
34
32
|
* Templates that prefer not to write a `Root` gating component (or top-level
|
|
35
33
|
* `await`) can mount their app entirely inside this provider:
|
|
@@ -45,5 +43,5 @@ export type NotionCustomBlockProps = InitCustomBlockOptions & {
|
|
|
45
43
|
* Inside `children`, every SDK hook is guaranteed to return a populated
|
|
46
44
|
* value. Outside the provider (or during the loading window), they throw.
|
|
47
45
|
*/
|
|
48
|
-
export declare function NotionCustomBlock({ children,
|
|
46
|
+
export declare function NotionCustomBlock({ children, fallback, errorFallback, autoResize, }: NotionCustomBlockProps): import("react").JSX.Element;
|
|
49
47
|
//# sourceMappingURL=NotionCustomBlock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotionCustomBlock.d.ts","sourceRoot":"","sources":["../../src/react/NotionCustomBlock.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAwC,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"NotionCustomBlock.d.ts","sourceRoot":"","sources":["../../src/react/NotionCustomBlock.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAwC,MAAM,OAAO,CAAA;AAQ5E,OAAO,yBAAyB,CAAA;AAEhC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC,QAAQ,EAAE,SAAS,CAAA;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAA;IACzD;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,EACjC,QAAQ,EACR,QAAe,EACf,aAAa,EACb,UAAiB,GACjB,EAAE,sBAAsB,+BAsExB"}
|
|
@@ -10,8 +10,7 @@ import { useCustomBlockHost } from "./useHostState.js";
|
|
|
10
10
|
import "./NotionCustomBlock.css";
|
|
11
11
|
/**
|
|
12
12
|
* Top-level wrapper that runs the SDK ↔ host handshake and gates `children`
|
|
13
|
-
* until it resolves.
|
|
14
|
-
* {@link initCustomBlock}.
|
|
13
|
+
* until it resolves.
|
|
15
14
|
*
|
|
16
15
|
* Templates that prefer not to write a `Root` gating component (or top-level
|
|
17
16
|
* `await`) can mount their app entirely inside this provider:
|
|
@@ -27,8 +26,8 @@ import "./NotionCustomBlock.css";
|
|
|
27
26
|
* Inside `children`, every SDK hook is guaranteed to return a populated
|
|
28
27
|
* value. Outside the provider (or during the loading window), they throw.
|
|
29
28
|
*/
|
|
30
|
-
export function NotionCustomBlock({ children,
|
|
31
|
-
const init = useCustomBlockInit(
|
|
29
|
+
export function NotionCustomBlock({ children, fallback = null, errorFallback, autoResize = true, }) {
|
|
30
|
+
const init = useCustomBlockInit();
|
|
32
31
|
useCustomBlockAutoResize({ enabled: init.isLoaded && autoResize });
|
|
33
32
|
// True if the block has no host (i.e. it's running in standalone preview).
|
|
34
33
|
const isStandalone = init.error instanceof NotInIframeError;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { CustomBlockInitializationError } from "../protocol/messages/init.js";
|
|
2
|
-
import { type CustomBlockInitPayload
|
|
2
|
+
import { type CustomBlockInitPayload } from "../init.js";
|
|
3
3
|
/**
|
|
4
4
|
* Discriminated state returned by {@link useCustomBlockInit}.
|
|
5
5
|
*
|
|
6
6
|
* Branch on `isLoaded`/`error`:
|
|
7
7
|
* - `{ isLoaded: false, error: undefined }` — handshake in progress.
|
|
8
|
-
* - `{ isLoaded: false, error: CustomBlockInitializationError }` — handshake failed
|
|
9
|
-
*
|
|
8
|
+
* - `{ isLoaded: false, error: CustomBlockInitializationError }` — handshake failed because
|
|
9
|
+
* the host or SDK reported a terminal initialization error.
|
|
10
10
|
* - `{ isLoaded: true, initial }` — handshake complete; safe to render
|
|
11
11
|
* children that call `useTheme`, `useBlockId`, etc.
|
|
12
12
|
*/
|
|
@@ -38,5 +38,5 @@ export type UseCustomBlockInitResult = {
|
|
|
38
38
|
* return <App />
|
|
39
39
|
* }
|
|
40
40
|
*/
|
|
41
|
-
export declare function useCustomBlockInit(
|
|
41
|
+
export declare function useCustomBlockInit(): UseCustomBlockInitResult;
|
|
42
42
|
//# sourceMappingURL=useCustomBlockInit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCustomBlockInit.d.ts","sourceRoot":"","sources":["../../src/react/useCustomBlockInit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAA;AAEvG,OAAO,
|
|
1
|
+
{"version":3,"file":"useCustomBlockInit.d.ts","sourceRoot":"","sources":["../../src/react/useCustomBlockInit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAA;AAEvG,OAAO,EAAE,KAAK,sBAAsB,EAAmB,MAAM,YAAY,CAAA;AAEzE;;;;;;;;;GASG;AACH,MAAM,MAAM,wBAAwB,GACjC;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACrC;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,8BAA8B,CAAA;CAAE,GAC1D;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,sBAAsB,CAAA;CAAE,CAAA;AAExE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,IAAI,wBAAwB,CAwB7D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
|
-
import { initCustomBlock
|
|
2
|
+
import { initCustomBlock } from "../init.js";
|
|
3
3
|
/**
|
|
4
4
|
* React wrapper around {@link initCustomBlock}. Kicks off the SDK ↔ host
|
|
5
5
|
* handshake on mount and returns a discriminated state object so the rest of
|
|
@@ -17,15 +17,14 @@ import { initCustomBlock, } from "../init.js";
|
|
|
17
17
|
* return <App />
|
|
18
18
|
* }
|
|
19
19
|
*/
|
|
20
|
-
export function useCustomBlockInit(
|
|
20
|
+
export function useCustomBlockInit() {
|
|
21
21
|
const [state, setState] = useState({
|
|
22
22
|
isLoaded: false,
|
|
23
23
|
error: undefined,
|
|
24
24
|
});
|
|
25
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies(opts): Initialization caches its first options and promise. Later options are ignored, so changes should not resubscribe to the same promise.
|
|
26
25
|
useEffect(() => {
|
|
27
26
|
let cancelled = false;
|
|
28
|
-
initCustomBlock(
|
|
27
|
+
initCustomBlock().then(initial => {
|
|
29
28
|
if (!cancelled) {
|
|
30
29
|
setState({ isLoaded: true, error: undefined, initial });
|
|
31
30
|
}
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import type { BridgeMessagePayload } from "./protocol/index.js";
|
|
2
2
|
import type { PrimeableHostToSandboxMessage } from "./protocol/messages/hostToSandbox.js";
|
|
3
|
-
/**
|
|
4
|
-
* Shared across sandbox bridge instances. Each result type holds one response;
|
|
5
|
-
* consuming it removes it, and priming it again replaces the previous response.
|
|
6
|
-
*/
|
|
7
|
-
export declare const globalPrimedResponsesCache: Map<"createPageResult" | "getPageResult" | "getUserResult" | "listUsersResult" | "queryDataSourceResult" | "updatePageResult", BridgeMessagePayload<PrimeableHostToSandboxMessage>>;
|
|
8
3
|
/**
|
|
9
4
|
* Injects a one-use response for SDK tests and verification fixtures. The next
|
|
10
5
|
* matching request receives it locally without reaching the host; later requests
|
package/dist/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAC5E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,4DAA4D,CAAA;
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAC5E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,4DAA4D,CAAA;AAI/G;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,6BAA6B,EAAE,EAC1E,YAAY,EACZ,QAAQ,GACR,EAAE;IACF,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;IACvB,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAA;CACjC,QAEA"}
|
package/dist/testing.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Shared across sandbox bridge instances. Each result type holds one response;
|
|
3
|
-
* consuming it removes it, and priming it again replaces the previous response.
|
|
4
|
-
*/
|
|
5
|
-
export const globalPrimedResponsesCache = new Map();
|
|
1
|
+
import { globalPrimedResponsesCache } from "./bridge/primedResponses.js";
|
|
6
2
|
/**
|
|
7
3
|
* Injects a one-use response for SDK tests and verification fixtures. The next
|
|
8
4
|
* matching request receives it locally without reaching the host; later requests
|
package/dist/types.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import type { NotionCollectionSchema } from "./protocol/dataSources/dataSource.j
|
|
|
2
2
|
import type { NotionDataSourceValue } from "./protocol/dataSources/dataSourceValue.js";
|
|
3
3
|
import type { NotionPropertySchema } from "./protocol/dataSources/propertySchema.js";
|
|
4
4
|
import type { NotionDataSourceId, NotionPageId } from "./protocol/ids.js";
|
|
5
|
-
import type { BridgeMessagePayload } from "./protocol/messagePayload.js";
|
|
6
5
|
import type { NotionCreatePagePosition } from "./protocol/messages/createPage.js";
|
|
7
6
|
import type { CreatePageResultMessage, CustomBlockCreatePageErrorInfo } from "./protocol/messages/createPageResult.js";
|
|
8
7
|
import type { CustomBlockGetPageErrorInfo, GetPageResultMessage } from "./protocol/messages/getPage.js";
|
|
9
8
|
import type { CustomBlockGetUserErrorInfo, GetUserResultMessage } from "./protocol/messages/getUser.js";
|
|
10
9
|
import type { CustomBlockListUsersErrorInfo, ListUsersMessage, ListUsersResultMessage } from "./protocol/messages/listUsers.js";
|
|
10
|
+
import type { BridgeMessagePayload } from "./protocol/messages/messagePayload.js";
|
|
11
11
|
import type { CustomBlockCheckboxFilterOperator, CustomBlockContainsFilterOperator, CustomBlockDateFilterOperator, CustomBlockNumberFilterOperator, CustomBlockOptionFilterOperator, CustomBlockTextFilterOperator } from "./protocol/messages/queryDataSource.js";
|
|
12
12
|
import type { CustomBlockQueryDataSourceErrorInfo } from "./protocol/messages/queryDataSourceResult.js";
|
|
13
13
|
import type { UpdatePageMessage } from "./protocol/messages/updatePage.js";
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBA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AAED;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,CAAA;AAE5C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,oBAAoB,CAC/C,oBAAoB,EACpB,2BAA2B,CAC3B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAClD,uBAAuB,EACvB,8BAA8B,CAC9B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,WAAW,CAAC,CAAA;AAExE;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,CAAA;AAE1C,MAAM,MAAM,eAAe,GAAG,oBAAoB,CACjD,sBAAsB,EACtB,6BAA6B,CAC7B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,oBAAoB,CAC/C,oBAAoB,EACpB,2BAA2B,CAC3B,CAAA"}
|
package/dist/version.js
CHANGED
package/docs/errors.md
CHANGED
|
@@ -35,7 +35,7 @@ Each API narrows `code` to its own open string union. The known literals provide
|
|
|
35
35
|
|
|
36
36
|
## Initialization errors
|
|
37
37
|
|
|
38
|
-
Unlike request helpers, `initCustomBlock` rejects with `CustomBlockInitializationError`. Its `code` type is `CustomBlockInitializationErrorCode`, which covers failures reported by either side of the handshake plus SDK-local
|
|
38
|
+
Unlike request helpers, `initCustomBlock` rejects with `CustomBlockInitializationError`. Its `code` type is `CustomBlockInitializationErrorCode`, which covers failures reported by either side of the handshake plus SDK-local iframe errors. For example, hosts can report `init_timeout` when Notion did not finish loading host dependencies in time.
|
|
39
39
|
|
|
40
40
|
`CustomBlockInitializationErrorInfo` is the matching `{ code, message, isRetryable }` object type.
|
|
41
41
|
|
package/docs/lifecycle.md
CHANGED
|
@@ -34,8 +34,9 @@ The initialization promise resolves after the SDK applies the host state.
|
|
|
34
34
|
Await it before rendering code that reads initialized state. The SDK sends
|
|
35
35
|
`initResult` after the initial render.
|
|
36
36
|
|
|
37
|
-
- The
|
|
38
|
-
|
|
37
|
+
- The SDK waits for the host to respond with `init` or `init.error`, without
|
|
38
|
+
an SDK-local timeout. Host-owned timeout errors such as `init_timeout` reject
|
|
39
|
+
the promise with `CustomBlockInitializationError`.
|
|
39
40
|
- If a matching `init` is malformed, the SDK sends `initResult.error` with code
|
|
40
41
|
`invalid_init_payload` and rejects with the same structured error.
|
|
41
42
|
- If the host sends incomplete or invalid data source bindings, the SDK sends
|
|
@@ -91,21 +92,19 @@ values.
|
|
|
91
92
|
### `<NotionCustomBlock>`
|
|
92
93
|
|
|
93
94
|
```ts
|
|
94
|
-
type NotionCustomBlockProps =
|
|
95
|
+
type NotionCustomBlockProps = {
|
|
95
96
|
children: ReactNode;
|
|
96
97
|
fallback?: ReactNode;
|
|
97
98
|
errorFallback?: ReactNode | ((error: Error) => ReactNode);
|
|
98
99
|
};
|
|
99
100
|
```
|
|
100
101
|
|
|
101
|
-
Top-level wrapper. It starts the handshake and renders `children` after init. It measures `#root` before it shows the iframe and when content height changes. `fallback` replaces the loading view. Its default is `null`. `errorFallback` replaces the error message if init fails.
|
|
102
|
+
Top-level wrapper. It starts the handshake and renders `children` after init. It measures `#root` before it shows the iframe and when content height changes. `fallback` replaces the loading view. Its default is `null`. `errorFallback` replaces the error message if init fails.
|
|
102
103
|
|
|
103
|
-
### `useCustomBlockInit(
|
|
104
|
+
### `useCustomBlockInit()`
|
|
104
105
|
|
|
105
106
|
```ts
|
|
106
|
-
function useCustomBlockInit(
|
|
107
|
-
opts?: InitCustomBlockOptions,
|
|
108
|
-
): UseCustomBlockInitResult;
|
|
107
|
+
function useCustomBlockInit(): UseCustomBlockInitResult;
|
|
109
108
|
|
|
110
109
|
type UseCustomBlockInitResult =
|
|
111
110
|
| { isLoaded: false; error: undefined }
|
|
@@ -124,14 +123,10 @@ function Root() {
|
|
|
124
123
|
}
|
|
125
124
|
```
|
|
126
125
|
|
|
127
|
-
### `initCustomBlock(
|
|
126
|
+
### `initCustomBlock()`
|
|
128
127
|
|
|
129
128
|
```ts
|
|
130
|
-
function initCustomBlock(
|
|
131
|
-
opts?: InitCustomBlockOptions,
|
|
132
|
-
): Promise<CustomBlockInitPayload>;
|
|
133
|
-
|
|
134
|
-
type InitCustomBlockOptions = { timeoutMs?: number };
|
|
129
|
+
function initCustomBlock(): Promise<CustomBlockInitPayload>;
|
|
135
130
|
```
|
|
136
131
|
|
|
137
132
|
The lower-level promise API. `<NotionCustomBlock>` and `useCustomBlockInit` both call it for you. Reach for it directly only when you want to `await` init at module scope (e.g. before `ReactDOM.createRoot`). Expected failures reject with `CustomBlockInitializationError`.
|
|
@@ -142,7 +137,7 @@ The `CustomBlockInitializationErrorCode` tells you where initialization failed:
|
|
|
142
137
|
|
|
143
138
|
- The host rejected initialization.
|
|
144
139
|
- The SDK could not apply the host's state.
|
|
145
|
-
- The SDK failed before the handshake completed, such as `not_in_iframe
|
|
140
|
+
- The SDK failed before the handshake completed, such as `not_in_iframe`.
|
|
146
141
|
|
|
147
142
|
All code types are open string unions, so keep a default branch. Use `isRetryable` to decide whether offering a retry makes sense, and treat `message` as display text rather than a stable identifier. See [Error handling](./errors.md) for the shared error contract.
|
|
148
143
|
|
package/package.json
CHANGED
|
@@ -5,7 +5,6 @@ import type {
|
|
|
5
5
|
NotionDataSourceBindings,
|
|
6
6
|
} from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
|
|
7
7
|
import type { NotionPageId } from "@notionhq/custom-blocks-protocol/ids.js"
|
|
8
|
-
import { readIncomingType } from "@notionhq/custom-blocks-protocol/incomingType.js"
|
|
9
8
|
import type { CustomBlockManifest } from "@notionhq/custom-blocks-protocol/manifest.js"
|
|
10
9
|
import type { ConnectMessage } from "@notionhq/custom-blocks-protocol/messages/connect.js"
|
|
11
10
|
import type {
|
|
@@ -18,6 +17,7 @@ import {
|
|
|
18
17
|
hostToSandboxMessageSchema,
|
|
19
18
|
type PrimeableHostToSandboxMessage,
|
|
20
19
|
} from "@notionhq/custom-blocks-protocol/messages/hostToSandbox.js"
|
|
20
|
+
import { readIncomingType } from "@notionhq/custom-blocks-protocol/messages/incomingType.js"
|
|
21
21
|
import {
|
|
22
22
|
CustomBlockInitializationError,
|
|
23
23
|
type InitMessage,
|
|
@@ -37,7 +37,6 @@ import type { UpdatePageMessage } from "@notionhq/custom-blocks-protocol/message
|
|
|
37
37
|
import { CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION } from "@notionhq/custom-blocks-protocol/protocolVersion.js"
|
|
38
38
|
import type { NotionTheme } from "@notionhq/custom-blocks-protocol/theme.js"
|
|
39
39
|
import * as v from "valibot"
|
|
40
|
-
import { globalPrimedResponsesCache } from "../testing.js"
|
|
41
40
|
import type {
|
|
42
41
|
CreatePageArgs,
|
|
43
42
|
CreatePageResult,
|
|
@@ -68,6 +67,7 @@ import {
|
|
|
68
67
|
import type { ManifestLoadResult } from "./loadManifest.js"
|
|
69
68
|
import { notifyListener } from "./notifyListener.js"
|
|
70
69
|
import { PendingRequests } from "./pendingRequests.js"
|
|
70
|
+
import { globalPrimedResponsesCache } from "./primedResponses.js"
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* A single entry in the bridge message log. Kept intentionally plain so the log
|
|
@@ -173,28 +173,8 @@ export class SandboxBridge {
|
|
|
173
173
|
return () => this.messageLogListeners.delete(listener)
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
awaitInit(
|
|
177
|
-
|
|
178
|
-
return this.initMessage
|
|
179
|
-
}
|
|
180
|
-
return new Promise((resolve, reject) => {
|
|
181
|
-
if (signal.aborted) {
|
|
182
|
-
reject(signal.reason)
|
|
183
|
-
return
|
|
184
|
-
}
|
|
185
|
-
const onAbort = () => reject(signal.reason)
|
|
186
|
-
signal.addEventListener("abort", onAbort, { once: true })
|
|
187
|
-
this.initMessage.then(
|
|
188
|
-
() => {
|
|
189
|
-
signal.removeEventListener("abort", onAbort)
|
|
190
|
-
resolve()
|
|
191
|
-
},
|
|
192
|
-
err => {
|
|
193
|
-
signal.removeEventListener("abort", onAbort)
|
|
194
|
-
reject(err)
|
|
195
|
-
},
|
|
196
|
-
)
|
|
197
|
-
})
|
|
176
|
+
awaitInit(): Promise<void> {
|
|
177
|
+
return this.initMessage
|
|
198
178
|
}
|
|
199
179
|
|
|
200
180
|
sendConnect(manifestResult: ManifestLoadResult) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BridgeMessagePayload } from "@notionhq/custom-blocks-protocol"
|
|
2
|
+
import type { PrimeableHostToSandboxMessage } from "@notionhq/custom-blocks-protocol/messages/hostToSandbox.js"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shared across sandbox bridge instances. Each result type holds one response;
|
|
6
|
+
* consuming it removes it, and priming it again replaces the previous response.
|
|
7
|
+
*/
|
|
8
|
+
export const globalPrimedResponsesCache = new Map<
|
|
9
|
+
PrimeableHostToSandboxMessage["type"],
|
|
10
|
+
BridgeMessagePayload<PrimeableHostToSandboxMessage>
|
|
11
|
+
>()
|
|
@@ -42,8 +42,8 @@ export const customBlockHost = {
|
|
|
42
42
|
getBridge().sendConnect(manifestResult)
|
|
43
43
|
},
|
|
44
44
|
|
|
45
|
-
awaitInit: (
|
|
46
|
-
return getBridge().awaitInit(
|
|
45
|
+
awaitInit: (): Promise<void> => {
|
|
46
|
+
return getBridge().awaitInit()
|
|
47
47
|
},
|
|
48
48
|
|
|
49
49
|
subscribe: (listener: () => void) => {
|
package/src/index.ts
CHANGED
|
@@ -101,7 +101,6 @@ export { pages, users } from "./bridge/sandboxClient.js"
|
|
|
101
101
|
export { type CustomBlockState, customBlock } from "./customBlock.js"
|
|
102
102
|
export {
|
|
103
103
|
type CustomBlockInitPayload,
|
|
104
|
-
type InitCustomBlockOptions,
|
|
105
104
|
initCustomBlock,
|
|
106
105
|
NotInIframeError,
|
|
107
106
|
} from "./init.js"
|
package/src/init.ts
CHANGED
|
@@ -42,21 +42,6 @@ export class NotInIframeError extends CustomBlockInitializationError {
|
|
|
42
42
|
declare code: "not_in_iframe"
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
* Options for {@link initCustomBlock}.
|
|
47
|
-
*/
|
|
48
|
-
export type InitCustomBlockOptions = {
|
|
49
|
-
/**
|
|
50
|
-
* How long to wait for the host's `init` response before rejecting with an error.
|
|
51
|
-
*
|
|
52
|
-
* @default 15000 - Intentionally longer than Notion's 10s host-dependency watchdog
|
|
53
|
-
* so host-owned init errors can arrive before the SDK's generic fallback appears.
|
|
54
|
-
*/
|
|
55
|
-
timeoutMs?: number
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const DEFAULT_INIT_TIMEOUT_MS = 15_000
|
|
59
|
-
|
|
60
45
|
const NOT_IN_IFRAME_MESSAGE =
|
|
61
46
|
"<NotionCustomBlock> only works inside an iframe — use the dev shell or deploy to Notion."
|
|
62
47
|
|
|
@@ -69,15 +54,13 @@ let initPromise: Promise<CustomBlockInitPayload> | undefined
|
|
|
69
54
|
* user, data sources) once the host has initialized the block. Rejects with a
|
|
70
55
|
* `CustomBlockInitializationError` if initialization fails.
|
|
71
56
|
*
|
|
72
|
-
* Idempotent: subsequent calls return the same promise as the first
|
|
57
|
+
* Idempotent: subsequent calls return the same promise as the first.
|
|
73
58
|
* Mount your React tree (or call any SDK hook) only after the returned promise resolves.
|
|
74
59
|
*/
|
|
75
|
-
export function initCustomBlock(
|
|
76
|
-
opts: InitCustomBlockOptions = {},
|
|
77
|
-
): Promise<CustomBlockInitPayload> {
|
|
60
|
+
export function initCustomBlock(): Promise<CustomBlockInitPayload> {
|
|
78
61
|
if (initPromise === undefined) {
|
|
79
62
|
customBlockHost.start()
|
|
80
|
-
initPromise = performHandshake(
|
|
63
|
+
initPromise = performHandshake()
|
|
81
64
|
}
|
|
82
65
|
return initPromise
|
|
83
66
|
}
|
|
@@ -93,13 +76,11 @@ export function initCustomBlock(
|
|
|
93
76
|
* Resolves with the `init` payload after the process above. Rejects with a
|
|
94
77
|
* `CustomBlockInitializationError` if any step fails.
|
|
95
78
|
*/
|
|
96
|
-
async function performHandshake(
|
|
97
|
-
opts: InitCustomBlockOptions,
|
|
98
|
-
): Promise<CustomBlockInitPayload> {
|
|
79
|
+
async function performHandshake(): Promise<CustomBlockInitPayload> {
|
|
99
80
|
try {
|
|
100
81
|
// Fail fast with a typed error when rendered as a standalone tab and not in a parent frame.
|
|
101
|
-
// Otherwise,
|
|
102
|
-
//
|
|
82
|
+
// Otherwise, `postMessage` to `window.parent` would just hit the same window and never
|
|
83
|
+
// arrive.
|
|
103
84
|
if (typeof window !== "undefined" && window.parent === window) {
|
|
104
85
|
throw new NotInIframeError()
|
|
105
86
|
}
|
|
@@ -108,8 +89,7 @@ async function performHandshake(
|
|
|
108
89
|
const manifestResult = await attemptToLoadSelfHostedManifest()
|
|
109
90
|
customBlockHost.sendConnect(manifestResult)
|
|
110
91
|
|
|
111
|
-
|
|
112
|
-
await awaitHostInitWithTimeout(timeoutMs)
|
|
92
|
+
await customBlockHost.awaitInit()
|
|
113
93
|
|
|
114
94
|
const hostState = customBlockHost.getState()
|
|
115
95
|
switch (hostState.status) {
|
|
@@ -144,28 +124,3 @@ async function performHandshake(
|
|
|
144
124
|
})
|
|
145
125
|
}
|
|
146
126
|
}
|
|
147
|
-
|
|
148
|
-
async function awaitHostInitWithTimeout(timeoutMs: number): Promise<void> {
|
|
149
|
-
try {
|
|
150
|
-
await customBlockHost.awaitInit(AbortSignal.timeout(timeoutMs))
|
|
151
|
-
} catch (error) {
|
|
152
|
-
if (isTimeoutError(error)) {
|
|
153
|
-
throw new CustomBlockInitializationError({
|
|
154
|
-
code: "init_timeout",
|
|
155
|
-
message:
|
|
156
|
-
"Host did not respond to the `connect` message before the timeout.",
|
|
157
|
-
isRetryable: true,
|
|
158
|
-
})
|
|
159
|
-
}
|
|
160
|
-
throw error
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function isTimeoutError(error: unknown): boolean {
|
|
165
|
-
return (
|
|
166
|
-
typeof error === "object" &&
|
|
167
|
-
error !== null &&
|
|
168
|
-
"name" in error &&
|
|
169
|
-
(error.name === "TimeoutError" || error.name === "AbortError")
|
|
170
|
-
)
|
|
171
|
-
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CustomBlockInitializationError } from "@notionhq/custom-blocks-protocol/messages/init.js"
|
|
2
2
|
import { type ReactNode, useEffect, useLayoutEffect, useState } from "react"
|
|
3
3
|
import { customBlockHost } from "../bridge/sandboxClient.js"
|
|
4
|
-
import {
|
|
4
|
+
import { NotInIframeError } from "../init.js"
|
|
5
5
|
import { DebugMessageLog } from "./DebugMessageLog.js"
|
|
6
6
|
import { seedStandalonePreviewState } from "./standalonePreview.js"
|
|
7
7
|
import { useCustomBlockAutoResize } from "./useCustomBlockAutoResize.js"
|
|
@@ -12,7 +12,7 @@ import "./NotionCustomBlock.css"
|
|
|
12
12
|
/**
|
|
13
13
|
* Props accepted by {@link NotionCustomBlock}.
|
|
14
14
|
*/
|
|
15
|
-
export type NotionCustomBlockProps =
|
|
15
|
+
export type NotionCustomBlockProps = {
|
|
16
16
|
children: ReactNode
|
|
17
17
|
/**
|
|
18
18
|
* Rendered while the SDK ↔ host handshake is in progress. Defaults to
|
|
@@ -37,8 +37,7 @@ export type NotionCustomBlockProps = InitCustomBlockOptions & {
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Top-level wrapper that runs the SDK ↔ host handshake and gates `children`
|
|
40
|
-
* until it resolves.
|
|
41
|
-
* {@link initCustomBlock}.
|
|
40
|
+
* until it resolves.
|
|
42
41
|
*
|
|
43
42
|
* Templates that prefer not to write a `Root` gating component (or top-level
|
|
44
43
|
* `await`) can mount their app entirely inside this provider:
|
|
@@ -56,12 +55,11 @@ export type NotionCustomBlockProps = InitCustomBlockOptions & {
|
|
|
56
55
|
*/
|
|
57
56
|
export function NotionCustomBlock({
|
|
58
57
|
children,
|
|
59
|
-
timeoutMs,
|
|
60
58
|
fallback = null,
|
|
61
59
|
errorFallback,
|
|
62
60
|
autoResize = true,
|
|
63
61
|
}: NotionCustomBlockProps) {
|
|
64
|
-
const init = useCustomBlockInit(
|
|
62
|
+
const init = useCustomBlockInit()
|
|
65
63
|
useCustomBlockAutoResize({ enabled: init.isLoaded && autoResize })
|
|
66
64
|
// True if the block has no host (i.e. it's running in standalone preview).
|
|
67
65
|
const isStandalone = init.error instanceof NotInIframeError
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import type { CustomBlockInitializationError } from "@notionhq/custom-blocks-protocol/messages/init.js"
|
|
2
2
|
import { useEffect, useState } from "react"
|
|
3
|
-
import {
|
|
4
|
-
type CustomBlockInitPayload,
|
|
5
|
-
type InitCustomBlockOptions,
|
|
6
|
-
initCustomBlock,
|
|
7
|
-
} from "../init.js"
|
|
3
|
+
import { type CustomBlockInitPayload, initCustomBlock } from "../init.js"
|
|
8
4
|
|
|
9
5
|
/**
|
|
10
6
|
* Discriminated state returned by {@link useCustomBlockInit}.
|
|
11
7
|
*
|
|
12
8
|
* Branch on `isLoaded`/`error`:
|
|
13
9
|
* - `{ isLoaded: false, error: undefined }` — handshake in progress.
|
|
14
|
-
* - `{ isLoaded: false, error: CustomBlockInitializationError }` — handshake failed
|
|
15
|
-
*
|
|
10
|
+
* - `{ isLoaded: false, error: CustomBlockInitializationError }` — handshake failed because
|
|
11
|
+
* the host or SDK reported a terminal initialization error.
|
|
16
12
|
* - `{ isLoaded: true, initial }` — handshake complete; safe to render
|
|
17
13
|
* children that call `useTheme`, `useBlockId`, etc.
|
|
18
14
|
*/
|
|
@@ -38,17 +34,14 @@ export type UseCustomBlockInitResult =
|
|
|
38
34
|
* return <App />
|
|
39
35
|
* }
|
|
40
36
|
*/
|
|
41
|
-
export function useCustomBlockInit(
|
|
42
|
-
opts?: InitCustomBlockOptions,
|
|
43
|
-
): UseCustomBlockInitResult {
|
|
37
|
+
export function useCustomBlockInit(): UseCustomBlockInitResult {
|
|
44
38
|
const [state, setState] = useState<UseCustomBlockInitResult>({
|
|
45
39
|
isLoaded: false,
|
|
46
40
|
error: undefined,
|
|
47
41
|
})
|
|
48
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies(opts): Initialization caches its first options and promise. Later options are ignored, so changes should not resubscribe to the same promise.
|
|
49
42
|
useEffect(() => {
|
|
50
43
|
let cancelled = false
|
|
51
|
-
initCustomBlock(
|
|
44
|
+
initCustomBlock().then(
|
|
52
45
|
initial => {
|
|
53
46
|
if (!cancelled) {
|
|
54
47
|
setState({ isLoaded: true, error: undefined, initial })
|
package/src/testing.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import type { BridgeMessagePayload } from "@notionhq/custom-blocks-protocol"
|
|
2
2
|
import type { PrimeableHostToSandboxMessage } from "@notionhq/custom-blocks-protocol/messages/hostToSandbox.js"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
* Shared across sandbox bridge instances. Each result type holds one response;
|
|
6
|
-
* consuming it removes it, and priming it again replaces the previous response.
|
|
7
|
-
*/
|
|
8
|
-
export const globalPrimedResponsesCache = new Map<
|
|
9
|
-
PrimeableHostToSandboxMessage["type"],
|
|
10
|
-
BridgeMessagePayload<PrimeableHostToSandboxMessage>
|
|
11
|
-
>()
|
|
4
|
+
import { globalPrimedResponsesCache } from "./bridge/primedResponses.js"
|
|
12
5
|
|
|
13
6
|
/**
|
|
14
7
|
* Injects a one-use response for SDK tests and verification fixtures. The next
|
package/src/types.ts
CHANGED
|
@@ -5,7 +5,6 @@ import type {
|
|
|
5
5
|
NotionDataSourceId,
|
|
6
6
|
NotionPageId,
|
|
7
7
|
} from "@notionhq/custom-blocks-protocol/ids.js"
|
|
8
|
-
import type { BridgeMessagePayload } from "@notionhq/custom-blocks-protocol/messagePayload.js"
|
|
9
8
|
import type { NotionCreatePagePosition } from "@notionhq/custom-blocks-protocol/messages/createPage.js"
|
|
10
9
|
import type {
|
|
11
10
|
CreatePageResultMessage,
|
|
@@ -24,6 +23,7 @@ import type {
|
|
|
24
23
|
ListUsersMessage,
|
|
25
24
|
ListUsersResultMessage,
|
|
26
25
|
} from "@notionhq/custom-blocks-protocol/messages/listUsers.js"
|
|
26
|
+
import type { BridgeMessagePayload } from "@notionhq/custom-blocks-protocol/messages/messagePayload.js"
|
|
27
27
|
import type {
|
|
28
28
|
CustomBlockCheckboxFilterOperator,
|
|
29
29
|
CustomBlockContainsFilterOperator,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|