@notionhq/custom-blocks 0.1.47 → 0.1.49
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/docs/data-sources.md +100 -52
- package/docs/pages.md +55 -0
- 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/docs/data-sources.md
CHANGED
|
@@ -145,16 +145,19 @@ The SDK reports invalid keys, types, operators, and values through the snapshot'
|
|
|
145
145
|
<details>
|
|
146
146
|
<summary>Filter operators and values</summary>
|
|
147
147
|
|
|
148
|
-
| Property types
|
|
149
|
-
|
|
|
150
|
-
| `title`, `rich_text`, `url`, `email`, `phone_number` | `equals`, `does_not_equal`, `contains`, `does_not_contain`, `starts_with`, `ends_with`, `is_empty`, `is_not_empty`
|
|
151
|
-
| `number`
|
|
152
|
-
| `checkbox`
|
|
153
|
-
| `select`, `status`
|
|
154
|
-
| `multi_select`
|
|
155
|
-
| `date`
|
|
156
|
-
|
|
157
|
-
Select, multi-select, and status
|
|
148
|
+
| Property types | Filter operators |
|
|
149
|
+
| ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
150
|
+
| `title`, `rich_text`, `url`, `email`, `phone_number` | `equals`, `does_not_equal`, `contains`, `does_not_contain`, `starts_with`, `ends_with`, `is_empty`, `is_not_empty` |
|
|
151
|
+
| `number` | `equals`, `does_not_equal`, `greater_than`, `less_than`, `greater_than_or_equal_to`, `less_than_or_equal_to`, `is_empty`, `is_not_empty` |
|
|
152
|
+
| `checkbox` | `equals`, `does_not_equal` |
|
|
153
|
+
| `select`, `status` | `equals`, `does_not_equal`, `is_empty`, `is_not_empty` |
|
|
154
|
+
| `multi_select` | `contains`, `contains_all`, `does_not_contain`, `is_empty`, `is_not_empty` |
|
|
155
|
+
| `date` | `equals`, `before`, `after`, `on_or_before`, `on_or_after`, `is_empty`, `is_not_empty` |
|
|
156
|
+
|
|
157
|
+
- Select, multi-select, and status filters accept one option name or an array of option names.
|
|
158
|
+
- For multi-select filters, `contains` matches **any** supplied option. `contains_all` requires **every** supplied option.
|
|
159
|
+
- Empty checks use `{ is_empty: true }` or `{ is_not_empty: true }`.
|
|
160
|
+
- Date comparisons accept ISO date strings or timestamps. Notion evaluates timestamps at minute precision.
|
|
158
161
|
|
|
159
162
|
</details>
|
|
160
163
|
|
|
@@ -168,13 +171,13 @@ This example sorts tasks by due date, with the earliest first. Tasks with the sa
|
|
|
168
171
|
const query = useDataSource("tasks", {
|
|
169
172
|
sorts: [
|
|
170
173
|
{ key: "due", direction: "ascending" },
|
|
171
|
-
{
|
|
174
|
+
{ key: "createdAt", direction: "descending" },
|
|
172
175
|
],
|
|
173
176
|
limit: 50,
|
|
174
177
|
});
|
|
175
178
|
```
|
|
176
179
|
|
|
177
|
-
Here, `due` is a declared date property key and `
|
|
180
|
+
Here, `due` is a declared date property key and `createdAt` is a declared key bound to a created-time property in the data source schema. Sorts apply in array order, with the first property taking priority. Empty values sort last in both directions.
|
|
178
181
|
|
|
179
182
|
You can sort by up to 10 unique properties. Both APIs accept the same sort shape, and you can combine `sorts` with `filter`.
|
|
180
183
|
|
|
@@ -265,9 +268,7 @@ export function ScoreList() {
|
|
|
265
268
|
|
|
266
269
|
const displayItems = items.filter(isComplete);
|
|
267
270
|
if (displayItems.length === 0) {
|
|
268
|
-
return
|
|
269
|
-
<div>No rows have both a text name and a finite score.</div>
|
|
270
|
-
);
|
|
271
|
+
return <div>No rows have both a text name and a finite score.</div>;
|
|
271
272
|
}
|
|
272
273
|
|
|
273
274
|
return (
|
|
@@ -297,46 +298,93 @@ export function ScoreList() {
|
|
|
297
298
|
## Known limitations
|
|
298
299
|
|
|
299
300
|
- **Row limits and pagination:** `limit` defaults to 20 and is capped at 999. Queries have no cursor or offset. Increasing the limit repeats the query from the start and replaces the snapshot. `hasMore` can remain true at the cap, so use filters to narrow larger data sources.
|
|
300
|
-
- **Filter and sort rules:** Use one property condition or one `and` group with up to 25 conditions. Nested groups and `or` are unsupported.
|
|
301
|
+
- **Filter and sort rules:** Use one property condition or one `and` group with up to 25 conditions. Nested groups and `or` are unsupported. You can sort by up to 10 unique properties. Empty values sort last in both directions. See the table below for property support and [Filters](#filters) for operators.
|
|
301
302
|
- **Changing a query:** TypeScript subscriptions copy their options when they start. To change them, unsubscribe and create a new subscription. React replaces the subscription when the key or options change. Previous rows are cleared while the new query loads.
|
|
302
303
|
- **Updates:** Callbacks receive complete snapshots, not individual row changes. A new result can trigger a callback even when its row values are unchanged.
|
|
303
304
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
|
318
|
-
|
|
|
319
|
-
| `
|
|
320
|
-
| `
|
|
321
|
-
| `
|
|
322
|
-
| `
|
|
323
|
-
| `
|
|
324
|
-
| `
|
|
325
|
-
| `
|
|
326
|
-
| `
|
|
327
|
-
| `
|
|
328
|
-
| `
|
|
329
|
-
| `
|
|
330
|
-
| `
|
|
331
|
-
| `
|
|
332
|
-
| `
|
|
333
|
-
| `
|
|
334
|
-
| `
|
|
335
|
-
| `
|
|
336
|
-
|
|
337
|
-
Text
|
|
338
|
-
|
|
339
|
-
|
|
305
|
+
## Property support
|
|
306
|
+
|
|
307
|
+
This table shows property support for custom blocks running in Notion.
|
|
308
|
+
|
|
309
|
+
- **Query result** shows values in `propertiesById` and `propertiesByKey` from `useDataSource` and `customBlock.subscribeToDataSource`. Missing values can be `undefined`.
|
|
310
|
+
- **Update row** covers writes through `item.update({ properties: ... })`.
|
|
311
|
+
- **Filter** and **Sort** cover query options.
|
|
312
|
+
|
|
313
|
+
- 🟢 **Supported:** The SDK supports this operation in Notion.
|
|
314
|
+
- 🟡 **Limited:** The SDK supports this operation with the restrictions shown in the cell.
|
|
315
|
+
- 🔴 **Unavailable:** The SDK does not expose this operation.
|
|
316
|
+
- ⚫ **Not supported in Notion:** Notion itself does not support this operation in the stated case.
|
|
317
|
+
|
|
318
|
+
| Property type | Query result | Update row | Filter | Sort |
|
|
319
|
+
| --- | --- | --- | --- | --- |
|
|
320
|
+
| `title` | 🟢 Plain text | 🟡 Plain text only | 🟢 Supported | 🟢 Supported |
|
|
321
|
+
| `rich_text` | 🟢 Plain text | 🟡 Plain text only | 🟢 Supported | 🟢 Supported |
|
|
322
|
+
| `number` | 🟢 Number | 🟢 Supported | 🟢 Supported | 🟢 Supported |
|
|
323
|
+
| `checkbox` | 🟢 Boolean | 🟢 Supported | 🟢 Supported | 🟢 Supported |
|
|
324
|
+
| `url` | 🟢 String | 🟢 Supported | 🟢 Supported | 🟢 Supported |
|
|
325
|
+
| `email` | 🟢 String | 🟢 Supported | 🟢 Supported | 🟢 Supported |
|
|
326
|
+
| `phone_number` | 🟢 String | 🟢 Supported | 🟢 Supported | 🟢 Supported |
|
|
327
|
+
| `select` | 🟢 Option name | 🟡 Set value only | 🟢 Supported | 🔴 Unavailable |
|
|
328
|
+
| `multi_select` | 🟢 Array of option names | 🟡 Set values only | 🟢 Supported | 🔴 Unavailable |
|
|
329
|
+
| `status` | 🟢 Option name | 🟡 Set value only | 🟡 Option names or empty checks, without groups | 🔴 Unavailable |
|
|
330
|
+
| `date` | 🟢 `NotionDateValue` | 🟡 Minute precision | 🟡 Fixed start-date comparisons or empty checks, at minute precision | 🟢 Supported |
|
|
331
|
+
| `people` | 🟢 Array of record pointers | 🟢 Supported | 🔴 Unavailable | 🔴 Unavailable |
|
|
332
|
+
| `files` | 🟡 Text fallback | 🟡 File URLs only | 🔴 Unavailable | 🔴 Unavailable |
|
|
333
|
+
| `unique_id` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
334
|
+
| `relation` | 🟢 Array of record pointers | 🟡 Replaces value. Rejects `has_more: true`. | 🔴 Unavailable | 🔴 Unavailable for standard relations. ⚫ Notion cannot sort XLDB targets. |
|
|
335
|
+
| `place` | 🟡 Text fallback | 🟢 Supported | 🔴 Unavailable | 🔴 Unavailable |
|
|
336
|
+
| `formula` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
337
|
+
| `rollup` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable for numeric targets or numeric aggregations. ⚫ Notion cannot sort other rollups. |
|
|
338
|
+
| `button` | 🟡 Text fallback | 🔴 Unavailable | ⚫ Not supported in Notion | ⚫ Not supported in Notion |
|
|
339
|
+
| `verification` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
340
|
+
| `last_visited_time` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
341
|
+
| `location` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable elsewhere. ⚫ Notion disables filters in My Meetings and Library system collections. | 🔴 Unavailable elsewhere. ⚫ Notion disables sorts in Library system collections. |
|
|
342
|
+
| `created_time` | 🟢 `NotionDateTime` in UTC | 🔴 Unavailable | 🔴 Unavailable | 🟡 Schema property only |
|
|
343
|
+
| `last_edited_time` | 🟢 `NotionDateTime` in UTC | 🔴 Unavailable | 🔴 Unavailable | 🟡 Schema property only |
|
|
344
|
+
| `created_by` | 🟢 Array of record pointers | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
345
|
+
| `last_edited_by` | 🟢 Array of record pointers | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
346
|
+
|
|
347
|
+
### Notes
|
|
348
|
+
|
|
349
|
+
- Text values omit formatting, mention tokens, and annotations. A text fallback can be empty and does not preserve the property's structured value. It does not provide structured formula or rollup results.
|
|
350
|
+
- Record pointers contain a table name and a record ID.
|
|
351
|
+
- Every row includes four built-in properties in `propertiesById`: `created_time`, `last_edited_time`, `created_by`, and `last_edited_by`. The data source does not need matching schema properties. These values are read-only. Timestamps use `NotionDateTime` in UTC. Creator and editor values use arrays of record pointers.
|
|
352
|
+
- The SDK accepts timestamp sorts, but the current Notion host requires a property ID in the data source's actual schema. Sort using a configured created-time or last-edited-time property. The synthetic IDs `created_time` and `last_edited_time` alone are not sufficient.
|
|
353
|
+
- You can sort by up to 10 unique properties.
|
|
354
|
+
- Date-time filter values may include seconds or milliseconds, but the Notion host currently evaluates them at minute precision. Date filters do not expose relative dates or end-date targeting.
|
|
355
|
+
- Status filters accept option names and empty checks, but not status groups.
|
|
356
|
+
- Filters accept one condition or an `and` group of up to 25 conditions. The SDK does not support `or` or nested groups.
|
|
357
|
+
- Select, multi-select, and status query values contain option names. Their schemas provide option IDs and colors separately. Writes set the selected values. They do not edit option definitions or colors.
|
|
358
|
+
|
|
359
|
+
### Writing values
|
|
360
|
+
|
|
361
|
+
The value you read has a different shape from the value you write. For example, a query returns a status as a string:
|
|
362
|
+
|
|
363
|
+
```ts
|
|
364
|
+
item.propertiesByKey.status // "Done"
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
To update it, wrap the string in a property object. Here, `status` is a declared property key:
|
|
368
|
+
|
|
369
|
+
```ts
|
|
370
|
+
const result = await item.update({
|
|
371
|
+
properties: {
|
|
372
|
+
status: { type: "status", status: { name: "Done" } },
|
|
373
|
+
},
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
if (result.status === "error") {
|
|
377
|
+
console.error(result.error.message);
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Other write restrictions:
|
|
382
|
+
|
|
383
|
+
- **Text:** Title and rich text writes preserve plain text, but not formatting or mentions.
|
|
384
|
+
- **Files:** Supply external or existing hosted file URLs. The host stores them as links and does not support upload references.
|
|
385
|
+
- **Relations:** Supply the complete replacement list of related pages. The host rejects `has_more: true`, which indicates an incomplete list.
|
|
386
|
+
|
|
387
|
+
See [Pages property support](./pages.md#property-support) for the page-property read shapes.
|
|
340
388
|
|
|
341
389
|
## Types
|
|
342
390
|
|
package/docs/pages.md
CHANGED
|
@@ -149,6 +149,61 @@ File-upload references aren't enabled for custom blocks yet. When updating icons
|
|
|
149
149
|
|
|
150
150
|
Do **not** send `{ type: "file_upload", file_upload: { id } }`; the host will reject it.
|
|
151
151
|
|
|
152
|
+
## Property support
|
|
153
|
+
|
|
154
|
+
This table shows property support for custom blocks running in Notion.
|
|
155
|
+
|
|
156
|
+
- **Read value** shows `page.properties` in responses from `pages.get`, `pages.create`, and `pages.update`. The table identifies top-level fields separately. Unavailable values are absent from `page.properties`.
|
|
157
|
+
- **Create** covers property writes through `pages.create`.
|
|
158
|
+
- **Update** covers property writes through `pages.update`.
|
|
159
|
+
|
|
160
|
+
Pages outside a data source support only `title`. Other property writes require a data source row and a property in its schema.
|
|
161
|
+
|
|
162
|
+
- 🟢 **Supported:** The SDK supports this operation in Notion.
|
|
163
|
+
- 🟡 **Limited:** The SDK supports this operation with the restrictions shown in the cell.
|
|
164
|
+
- 🔴 **Unavailable:** The SDK does not expose this operation.
|
|
165
|
+
- ⚫ **Not supported in Notion:** Notion itself does not support this operation in the stated case.
|
|
166
|
+
|
|
167
|
+
| Property type | Read value (`pages.get`) | Create (`pages.create`) | Update (`pages.update`) |
|
|
168
|
+
| --- | --- | --- | --- |
|
|
169
|
+
| `title` | 🟡 Text array with plain text only | 🟡 Plain text only | 🟡 Plain text only |
|
|
170
|
+
| `rich_text` | 🟡 Text array with plain text only | 🟡 Plain text only | 🟡 Plain text only |
|
|
171
|
+
| `number` | 🟢 Number or `null` | 🟢 Supported | 🟢 Supported |
|
|
172
|
+
| `checkbox` | 🟢 Boolean | 🟢 Supported | 🟢 Supported |
|
|
173
|
+
| `url` | 🟢 String or `null` | 🟢 Supported | 🟢 Supported |
|
|
174
|
+
| `email` | 🟢 String or `null` | 🟢 Supported | 🟢 Supported |
|
|
175
|
+
| `phone_number` | 🟢 String or `null` | 🟢 Supported | 🟢 Supported |
|
|
176
|
+
| `select` | 🟡 Option ID/name object or `null` | 🟡 Set value only | 🟡 Set value only |
|
|
177
|
+
| `multi_select` | 🟡 Array of option ID/name objects | 🟡 Set value only | 🟡 Set value only |
|
|
178
|
+
| `status` | 🟡 Option ID/name object or `null` | 🟡 Set value only | 🟡 Set value only |
|
|
179
|
+
| `date` | 🟢 `start` and optional `end` strings, or `null` | 🟡 Minute precision | 🟡 Minute precision |
|
|
180
|
+
| `people` | 🟢 Array of user/group ID objects | 🟢 Supported | 🟢 Supported |
|
|
181
|
+
| `files` | 🟡 External file links only | 🟡 File URLs only | 🟡 File URLs only |
|
|
182
|
+
| `unique_id` | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
183
|
+
| `relation` | 🟢 Array of page ID objects | 🟡 Replaces value. Rejects `has_more: true`. | 🟡 Replaces value. Rejects `has_more: true`. |
|
|
184
|
+
| `place` | 🟢 Coordinates and optional place details, or `null` | 🟢 Supported | 🟢 Supported |
|
|
185
|
+
| `formula` | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
186
|
+
| `rollup` | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
187
|
+
| `button` | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
188
|
+
| `verification` | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
189
|
+
| `last_visited_time` | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
190
|
+
| `location` | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
191
|
+
| `created_time` | 🟡 Top-level ISO timestamp only | 🔴 Unavailable | 🔴 Unavailable |
|
|
192
|
+
| `last_edited_time` | 🟡 Top-level ISO timestamp only | 🔴 Unavailable | 🔴 Unavailable |
|
|
193
|
+
| `created_by` | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
194
|
+
| `last_edited_by` | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
195
|
+
|
|
196
|
+
### Notes
|
|
197
|
+
|
|
198
|
+
- Select, multi-select, and status reads return option names. They also return IDs when the options match the schema, but they omit colors. Writes accept an existing option ID or a name and set the selected value. They do not edit option definitions or colors. If you supply both an ID and a name, the host uses the ID. The host rejects unknown IDs.
|
|
199
|
+
- Date-time writes preserve hours and minutes but discard seconds and milliseconds.
|
|
200
|
+
- Title and rich text use text arrays, but reads and writes preserve only plain text. Reads and writes do not preserve formatting, links, mentions, or equations as structured rich text.
|
|
201
|
+
- File reads include link items only. File writes accept `external` URLs and existing `file` URLs and store them as links. Upload references (`file_upload`) are unsupported.
|
|
202
|
+
- Relation writes replace the value and reject `has_more: true`.
|
|
203
|
+
- `created_time` and `last_edited_time` are read-only top-level fields on `page`, when available. The host omits them from `page.properties`. The host does not return `created_by` or `last_edited_by`, even as top-level fields. The host does not return structured page values for formula, rollup, unique ID, or the other omitted types.
|
|
204
|
+
|
|
205
|
+
For flattened query values, filters, and sorts, see [Data source property support](./data-sources.md#property-support).
|
|
206
|
+
|
|
152
207
|
## Types
|
|
153
208
|
|
|
154
209
|
- `NotionPage` — the page record returned by every successful call.
|
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
|
}
|