@notionhq/custom-blocks 0.1.47 → 0.1.48
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.js +3 -3
- package/dist/protocol/messages/connect.js +4 -3
- package/dist/protocol/messages/initResult.js +2 -1
- package/dist/protocol/protocolVersion.d.ts +4 -4
- package/dist/protocol/protocolVersion.js +4 -4
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/bridge/SandboxBridge.ts +3 -3
|
@@ -2,7 +2,7 @@ import { DEFAULT_CONTRAST_MODE } from "../protocol/contrast.js";
|
|
|
2
2
|
import { hostToSandboxMessageSchema, } from "../protocol/messages/hostToSandbox.js";
|
|
3
3
|
import { readIncomingType } from "../protocol/messages/incomingType.js";
|
|
4
4
|
import { CustomBlockInitializationError, initMessageSchema, } from "../protocol/messages/init.js";
|
|
5
|
-
import {
|
|
5
|
+
import { LATEST_BRIDGE_PROTOCOL_VERSION } from "../protocol/protocolVersion.js";
|
|
6
6
|
import * as v from "valibot";
|
|
7
7
|
import { unreachable } from "../utils.js";
|
|
8
8
|
import { CUSTOM_BLOCKS_SDK_VERSION } from "../version.js";
|
|
@@ -101,7 +101,7 @@ export class SandboxBridge {
|
|
|
101
101
|
type: "connect",
|
|
102
102
|
initializationId,
|
|
103
103
|
status: "error",
|
|
104
|
-
bridgeProtocolVersion:
|
|
104
|
+
bridgeProtocolVersion: LATEST_BRIDGE_PROTOCOL_VERSION,
|
|
105
105
|
sdkVersion: CUSTOM_BLOCKS_SDK_VERSION,
|
|
106
106
|
error,
|
|
107
107
|
}
|
|
@@ -109,7 +109,7 @@ export class SandboxBridge {
|
|
|
109
109
|
type: "connect",
|
|
110
110
|
initializationId,
|
|
111
111
|
status: "success",
|
|
112
|
-
bridgeProtocolVersion:
|
|
112
|
+
bridgeProtocolVersion: LATEST_BRIDGE_PROTOCOL_VERSION,
|
|
113
113
|
sdkVersion: CUSTOM_BLOCKS_SDK_VERSION,
|
|
114
114
|
...(manifest !== null ? { manifest } : {}),
|
|
115
115
|
};
|
|
@@ -5,9 +5,10 @@ const connectMessageCommonEntries = {
|
|
|
5
5
|
type: v.literal("connect"),
|
|
6
6
|
initializationId: v.string(),
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* The bridge protocol version this sandbox uses to communicate with its host.
|
|
9
|
+
* Hosts control which versions they support and can support multiple versions
|
|
10
|
+
* at the same time. Support for older versions is eventually removed, so blocks
|
|
11
|
+
* may need to update their SDK to continue working.
|
|
11
12
|
*/
|
|
12
13
|
bridgeProtocolVersion: v.number(),
|
|
13
14
|
/**
|
|
@@ -16,7 +16,8 @@ export const initResultMessageSchema = v.variant("status", [
|
|
|
16
16
|
initializationId: v.string(),
|
|
17
17
|
status: v.literal("success"),
|
|
18
18
|
/** Height of the initial rendered custom-block content, in CSS pixels. */
|
|
19
|
-
//
|
|
19
|
+
// Older SDKs can omit the height. Current SDKs always send it.
|
|
20
|
+
// TODO(custom-blocks): Make this required when MIN_HOST_SUPPORTED_BRIDGE_PROTOCOL_VERSION increases to 4.
|
|
20
21
|
initialHeight: v.optional(v.pipe(v.number(), v.finite(), v.minValue(0))),
|
|
21
22
|
}),
|
|
22
23
|
v.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* The protocol version that the current SDK sends in `connect`.
|
|
3
|
+
* Increase this value for breaking wire changes. Hosts can continue to accept
|
|
4
|
+
* older versions, so this value does not set the minimum or maximum they accept.
|
|
5
5
|
*/
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const LATEST_BRIDGE_PROTOCOL_VERSION = 3;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* The protocol version that the current SDK sends in `connect`.
|
|
3
|
+
* Increase this value for breaking wire changes. Hosts can continue to accept
|
|
4
|
+
* older versions, so this value does not set the minimum or maximum they accept.
|
|
5
5
|
*/
|
|
6
|
-
export const
|
|
6
|
+
export const LATEST_BRIDGE_PROTOCOL_VERSION = 3;
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@ import type { CustomBlockQueryDataSourceErrorInfo } from "@notionhq/custom-block
|
|
|
34
34
|
import type { ResizeMessage } from "@notionhq/custom-blocks-protocol/messages/resize.js"
|
|
35
35
|
import type { UnsubscribeDataSourceQueryMessage } from "@notionhq/custom-blocks-protocol/messages/unsubscribeDataSourceQuery.js"
|
|
36
36
|
import type { UpdatePageMessage } from "@notionhq/custom-blocks-protocol/messages/updatePage.js"
|
|
37
|
-
import {
|
|
37
|
+
import { LATEST_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
40
|
import type {
|
|
@@ -196,7 +196,7 @@ export class SandboxBridge {
|
|
|
196
196
|
type: "connect",
|
|
197
197
|
initializationId,
|
|
198
198
|
status: "error",
|
|
199
|
-
bridgeProtocolVersion:
|
|
199
|
+
bridgeProtocolVersion: LATEST_BRIDGE_PROTOCOL_VERSION,
|
|
200
200
|
sdkVersion: CUSTOM_BLOCKS_SDK_VERSION,
|
|
201
201
|
error,
|
|
202
202
|
}
|
|
@@ -204,7 +204,7 @@ export class SandboxBridge {
|
|
|
204
204
|
type: "connect",
|
|
205
205
|
initializationId,
|
|
206
206
|
status: "success",
|
|
207
|
-
bridgeProtocolVersion:
|
|
207
|
+
bridgeProtocolVersion: LATEST_BRIDGE_PROTOCOL_VERSION,
|
|
208
208
|
sdkVersion: CUSTOM_BLOCKS_SDK_VERSION,
|
|
209
209
|
...(manifest !== null ? { manifest } : {}),
|
|
210
210
|
}
|