@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.
@@ -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 { CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION } from "../protocol/protocolVersion.js";
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: CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION,
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: CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION,
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
- * Used to ensure that the host and client are using the same version of the bridge protocol. A
9
- * single host needs to support multiple custom blocks built with different versions of the bridge
10
- * protocol. Increment this number any time a breaking change is made to the bridge protocol.
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
- // TODO(custom-blocks): Make this required when bumping bridge protocol version 4.
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
- * Used to ensure that the host and client are using the same version of the bridge protocol. A
3
- * single host needs to support multiple custom blocks built with different versions of the bridge
4
- * protocol. Increment this number any time a breaking change is made to the bridge protocol.
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 CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION = 3;
6
+ export declare const LATEST_BRIDGE_PROTOCOL_VERSION = 3;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Used to ensure that the host and client are using the same version of the bridge protocol. A
3
- * single host needs to support multiple custom blocks built with different versions of the bridge
4
- * protocol. Increment this number any time a breaking change is made to the bridge protocol.
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 CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION = 3;
6
+ export const LATEST_BRIDGE_PROTOCOL_VERSION = 3;
package/dist/version.js CHANGED
@@ -4,4 +4,4 @@
4
4
  *
5
5
  * WARNING: Generated during SDK publish. Do not edit in the published package.
6
6
  */
7
- export const CUSTOM_BLOCKS_SDK_VERSION = "0.1.47"
7
+ export const CUSTOM_BLOCKS_SDK_VERSION = "0.1.48"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks",
3
- "version": "0.1.47",
3
+ "version": "0.1.48",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -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 { CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION } from "@notionhq/custom-blocks-protocol/protocolVersion.js"
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: CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION,
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: CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION,
207
+ bridgeProtocolVersion: LATEST_BRIDGE_PROTOCOL_VERSION,
208
208
  sdkVersion: CUSTOM_BLOCKS_SDK_VERSION,
209
209
  ...(manifest !== null ? { manifest } : {}),
210
210
  }