@notionhq/custom-blocks 0.2.21 → 0.2.23
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/README.md +2 -0
- package/dist/bridge/SandboxBridge.d.ts +14 -18
- package/dist/bridge/SandboxBridge.d.ts.map +1 -1
- package/dist/bridge/SandboxBridge.js +59 -201
- package/dist/bridge/SandboxInitialization.d.ts +52 -0
- package/dist/bridge/SandboxInitialization.d.ts.map +1 -0
- package/dist/bridge/SandboxInitialization.js +217 -0
- package/dist/bridge/dataSources/query.d.ts.map +1 -1
- package/dist/bridge/dataSources/query.js +39 -23
- package/dist/bridge/messageInterceptor.d.ts +4 -0
- package/dist/bridge/messageInterceptor.d.ts.map +1 -0
- package/dist/bridge/messageInterceptor.js +1 -0
- package/dist/bridge/sandboxClient.d.ts +3 -2
- package/dist/bridge/sandboxClient.d.ts.map +1 -1
- package/dist/bridge/sandboxClient.js +3 -5
- package/dist/bridge.d.ts +11 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +11 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/init.d.ts +4 -38
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +4 -91
- package/dist/initTypes.d.ts +31 -0
- package/dist/initTypes.d.ts.map +1 -0
- package/dist/initTypes.js +18 -0
- package/dist/protocol/dataSources/propertySchema.d.ts +1 -1
- package/dist/protocol/dataSources/propertySchema.js +2 -0
- package/dist/protocol/dataSources/sortDirection.d.ts +3 -0
- package/dist/protocol/dataSources/sortDirection.js +2 -0
- package/dist/protocol/index.d.ts +1 -0
- package/dist/protocol/index.js +1 -0
- package/dist/protocol/manifest.d.ts +10 -3
- package/dist/protocol/manifest.js +5 -1
- package/dist/protocol/messages/connect.d.ts +9 -2
- package/dist/protocol/messages/hostToSandbox.d.ts +9 -5
- package/dist/protocol/messages/init.d.ts +10 -3
- package/dist/protocol/messages/queryDataSource.d.ts +300 -47
- package/dist/protocol/messages/queryDataSource.js +107 -9
- package/dist/protocol/messages/sandboxToHost.d.ts +103 -18
- package/dist/styles/nds.css +1 -1
- package/dist/types.d.ts +8 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/docs/bridge-interceptors.md +27 -0
- package/docs/data-sources.md +93 -13
- package/docs/errors.md +3 -2
- package/docs/lifecycle.md +1 -1
- package/docs/pages.md +22 -10
- package/package.json +4 -4
- package/src/bridge/SandboxBridge.ts +74 -239
- package/src/bridge/SandboxInitialization.ts +295 -0
- package/src/bridge/dataSources/query.ts +51 -25
- package/src/bridge/messageInterceptor.ts +6 -0
- package/src/bridge/sandboxClient.ts +6 -5
- package/src/bridge.ts +17 -0
- package/src/index.ts +1 -0
- package/src/init.ts +8 -119
- package/src/initTypes.ts +43 -0
- package/src/styles/nds.css +1 -1
- package/src/styles/nds.css.metadata.json +3 -3
- package/src/types.ts +11 -2
- package/dist/bridge/primedResponses.d.ts +0 -8
- package/dist/bridge/primedResponses.d.ts.map +0 -1
- package/dist/bridge/primedResponses.js +0 -5
- package/dist/testing.d.ts +0 -12
- package/dist/testing.d.ts.map +0 -1
- package/dist/testing.js +0 -9
- package/src/bridge/primedResponses.ts +0 -11
- package/src/testing.ts +0 -19
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { NotionCollectionSchema } from "./protocol/dataSources/dataSource.js";
|
|
2
2
|
import type { NotionDataSourceValue } from "./protocol/dataSources/dataSourceValue.js";
|
|
3
3
|
import type { NotionPropertySchema } from "./protocol/dataSources/propertySchema.js";
|
|
4
|
+
import type { NotionSortDirection } from "./protocol/dataSources/sortDirection.js";
|
|
4
5
|
import type { NotionDataSourceId, NotionPageId } from "./protocol/ids.js";
|
|
5
6
|
import type { NotionCreatePagePosition } from "./protocol/messages/createPage.js";
|
|
6
7
|
import type { CreatePageResultMessage, CustomBlockCreatePageErrorInfo } from "./protocol/messages/createPageResult.js";
|
|
@@ -9,7 +10,7 @@ import type { CustomBlockGetUserErrorInfo, GetUserResultMessage } from "./protoc
|
|
|
9
10
|
import type { CustomBlockListUsersErrorInfo, ListUsersMessage, ListUsersResultMessage } from "./protocol/messages/listUsers.js";
|
|
10
11
|
import type { BridgeMessagePayload } from "./protocol/messages/messagePayload.js";
|
|
11
12
|
import type { CustomBlockOpenPageErrorInfo, OpenPageMode, OpenPageResultMessage } from "./protocol/messages/openPage.js";
|
|
12
|
-
import type { CustomBlockCheckboxFilterOperator, CustomBlockContainsFilterOperator, CustomBlockCreatedByFilterOperator, CustomBlockDateFilterOperator, CustomBlockNumberFilterOperator, CustomBlockOptionFilterOperator, CustomBlockPeopleFilterOperator, CustomBlockPersonFilterValue, CustomBlockTextFilterOperator } from "./protocol/messages/queryDataSource.js";
|
|
13
|
+
import type { CustomBlockCheckboxFilterOperator, CustomBlockContainsFilterOperator, CustomBlockCreatedByFilterOperator, CustomBlockDateFilterOperator, CustomBlockNumberFilterOperator, CustomBlockOptionFilterOperator, CustomBlockPeopleFilterOperator, CustomBlockPersonFilterValue, CustomBlockRelationFilterOperator, CustomBlockStatusFilterOperator, CustomBlockTextFilterOperator } from "./protocol/messages/queryDataSource.js";
|
|
13
14
|
import type { CustomBlockQueryDataSourceErrorInfo } from "./protocol/messages/queryDataSourceResult.js";
|
|
14
15
|
import type { UpdatePageMessage } from "./protocol/messages/updatePage.js";
|
|
15
16
|
import type { CustomBlockUpdatePageErrorInfo, UpdatePageResultMessage } from "./protocol/messages/updatePageResult.js";
|
|
@@ -78,11 +79,13 @@ export type NotionDataSourceTextFilterOperator = ExclusiveUnion<CustomBlockTextF
|
|
|
78
79
|
export type NotionDataSourceNumberFilterOperator = ExclusiveUnion<CustomBlockNumberFilterOperator>;
|
|
79
80
|
export type NotionDataSourceCheckboxFilterOperator = ExclusiveUnion<CustomBlockCheckboxFilterOperator>;
|
|
80
81
|
export type NotionDataSourceOptionFilterOperator = ExclusiveUnion<CustomBlockOptionFilterOperator>;
|
|
82
|
+
export type NotionDataSourceStatusFilterOperator = ExclusiveUnion<CustomBlockStatusFilterOperator>;
|
|
81
83
|
export type NotionDataSourceContainsFilterOperator = ExclusiveUnion<CustomBlockContainsFilterOperator>;
|
|
82
84
|
export type NotionDataSourceDateFilterOperator = ExclusiveUnion<CustomBlockDateFilterOperator>;
|
|
83
85
|
export type NotionDataSourceCreatedByFilterOperator = ExclusiveUnion<CustomBlockCreatedByFilterOperator>;
|
|
84
86
|
export type NotionDataSourcePersonFilterValue = CustomBlockPersonFilterValue;
|
|
85
87
|
export type NotionDataSourcePeopleFilterOperator = ExclusiveUnion<CustomBlockPeopleFilterOperator>;
|
|
88
|
+
export type NotionDataSourceRelationFilterOperator = ExclusiveUnion<CustomBlockRelationFilterOperator>;
|
|
86
89
|
export type NotionDataSourcePropertyAddress = {
|
|
87
90
|
key: string;
|
|
88
91
|
propertyId?: never;
|
|
@@ -109,16 +112,18 @@ export type NotionDataSourcePropertyFilter = NotionDataSourcePropertyAddress & E
|
|
|
109
112
|
} | {
|
|
110
113
|
multi_select: NotionDataSourceContainsFilterOperator;
|
|
111
114
|
} | {
|
|
112
|
-
status:
|
|
115
|
+
status: NotionDataSourceStatusFilterOperator;
|
|
113
116
|
} | {
|
|
114
117
|
date: NotionDataSourceDateFilterOperator;
|
|
115
118
|
} | {
|
|
116
119
|
people: NotionDataSourcePeopleFilterOperator;
|
|
120
|
+
} | {
|
|
121
|
+
relation: NotionDataSourceRelationFilterOperator;
|
|
117
122
|
} | {
|
|
118
123
|
created_by: NotionDataSourceCreatedByFilterOperator;
|
|
119
124
|
}>;
|
|
120
125
|
export type NotionDataSourceSort = NotionDataSourcePropertyAddress & {
|
|
121
|
-
direction:
|
|
126
|
+
direction: NotionSortDirection;
|
|
122
127
|
};
|
|
123
128
|
export type NotionDataSourceFilter = ExclusiveUnion<NotionDataSourcePropertyFilter | {
|
|
124
129
|
and: NotionDataSourcePropertyFilter[];
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
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AAG,oBAAoB,CAClD,uBAAuB,EACvB,8BAA8B,CAC9B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,WAAW,CAAC,CAAA;AAExE,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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Bridge message interceptors
|
|
2
|
+
|
|
3
|
+
Import `registerMessageInterceptor` from `@notionhq/custom-blocks/bridge` to inspect or replace SDK
|
|
4
|
+
messages sent to the host. The function accepts a `MessageInterceptor` and returns a function that
|
|
5
|
+
removes it.
|
|
6
|
+
|
|
7
|
+
An interceptor receives a sandbox-to-host message. Return `undefined` to let the next interceptor
|
|
8
|
+
inspect it. Return a host-to-sandbox message to replace it. The SDK validates and processes the
|
|
9
|
+
replacement through its normal response path. The first interceptor that returns a response wins.
|
|
10
|
+
Later interceptors do not receive that message. The SDK sends the request to the host if no
|
|
11
|
+
interceptor returns a response.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { registerMessageInterceptor } from "@notionhq/custom-blocks/bridge"
|
|
15
|
+
|
|
16
|
+
const remove = registerMessageInterceptor(message => {
|
|
17
|
+
console.log(message.type)
|
|
18
|
+
return undefined
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// Remove the interceptor when it is no longer needed.
|
|
22
|
+
remove()
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Register the interceptor before the SDK call that it must handle. A replacement response must use
|
|
26
|
+
the correct message type and request ID or subscription ID. The SDK does not send an intercepted
|
|
27
|
+
request to the host.
|
package/docs/data-sources.md
CHANGED
|
@@ -192,6 +192,19 @@ are unsupported. An empty `and` group applies no conditions. Both APIs accept th
|
|
|
192
192
|
|
|
193
193
|
The SDK reports invalid keys, types, operators, and values through the snapshot's `error` field.
|
|
194
194
|
|
|
195
|
+
Use stored Status group names with either subscription API:
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
const snapshot = useDataSource("records", {
|
|
199
|
+
filter: {
|
|
200
|
+
key: "status",
|
|
201
|
+
status: { group_equals: ["To-do", "In progress"] },
|
|
202
|
+
},
|
|
203
|
+
})
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Use `group_does_not_equal` to exclude every listed group. A raw `propertyId` can replace the key.
|
|
207
|
+
|
|
195
208
|
Creator filters require an actual **Created by** column in the bound database. The column can have
|
|
196
209
|
any name. In this example, `creator` is a declared property key mapped to that column:
|
|
197
210
|
|
|
@@ -217,13 +230,17 @@ address a Created by column.
|
|
|
217
230
|
| `title`, `rich_text`, `url`, `email`, `phone_number` | `equals`, `does_not_equal`, `contains`, `does_not_contain`, `starts_with`, `ends_with`, `is_empty`, `is_not_empty` |
|
|
218
231
|
| `number` | `equals`, `does_not_equal`, `greater_than`, `less_than`, `greater_than_or_equal_to`, `less_than_or_equal_to`, `is_empty`, `is_not_empty` |
|
|
219
232
|
| `checkbox` | `equals`, `does_not_equal` |
|
|
220
|
-
| `select
|
|
233
|
+
| `select` | `equals`, `does_not_equal`, `is_empty`, `is_not_empty` |
|
|
234
|
+
| `status` | `equals`, `does_not_equal`, `group_equals`, `group_does_not_equal`, `is_empty`, `is_not_empty` |
|
|
221
235
|
| `multi_select` | `contains`, `contains_all`, `does_not_contain`, `is_empty`, `is_not_empty` |
|
|
222
|
-
| `date` | `equals`, `before`, `after`, `on_or_before`, `on_or_after`, `is_empty`, `is_not_empty`
|
|
236
|
+
| `date` | `equals`, `before`, `after`, `on_or_before`, `on_or_after`, relative ranges, `is_empty`, `is_not_empty` |
|
|
223
237
|
| `people` | `contains`, `does_not_contain`, `is_empty`, `is_not_empty` |
|
|
238
|
+
| `relation` | `contains`, `does_not_contain` |
|
|
224
239
|
| `created_by` | `contains`, `does_not_contain`, `is_empty`, `is_not_empty` |
|
|
225
240
|
|
|
226
241
|
- Select, multi-select, and status filters accept one option name or an array of option names.
|
|
242
|
+
- Status group filters accept one stored group name or an array of 1–5 names. Inclusion matches any
|
|
243
|
+
listed group. Exclusion rejects every listed group and keeps empty Status values.
|
|
227
244
|
- For multi-select filters, `contains` matches **any** supplied option. `contains_all` requires
|
|
228
245
|
**every** supplied option.
|
|
229
246
|
- People filters accept one explicit reference to a human user or a group. Use
|
|
@@ -233,12 +250,67 @@ address a Created by column.
|
|
|
233
250
|
- Creator filters accept one explicit human user reference. Groups, bots, and organization bots are
|
|
234
251
|
not supported as filter references. `does_not_contain` also matches rows with non-human or missing
|
|
235
252
|
creators. Empty checks test whether creator metadata is missing.
|
|
253
|
+
- Relation filters accept one page ID in dashed or undashed UUID format.
|
|
254
|
+
- Relation `does_not_contain` includes empty relations. Empty checks and multiple targets are
|
|
255
|
+
unsupported.
|
|
256
|
+
|
|
257
|
+
```ts
|
|
258
|
+
filter: {
|
|
259
|
+
key: "relation",
|
|
260
|
+
relation: { contains: "aabbccdd-1122-4455-8899-aabbccddeeff" },
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
236
264
|
- Empty checks use `{ is_empty: true }` or `{ is_not_empty: true }`.
|
|
237
265
|
- Date comparisons accept ISO date strings or timestamps. Notion evaluates timestamps at minute
|
|
238
266
|
precision.
|
|
267
|
+
- Date comparisons accept `target: "start_date" | "end_date"` beside the operator. The default is
|
|
268
|
+
`start_date`.
|
|
269
|
+
- For ranges, `end_date` compares the range end. For individual dates, it compares the date.
|
|
270
|
+
- An `end_date` comparison does not test range overlap.
|
|
271
|
+
- Date empty checks accept either target, but they test the whole property.
|
|
272
|
+
- Date comparisons accept ISO values and `today`, `tomorrow`, `yesterday`, `one_week_ago`,
|
|
273
|
+
`one_week_from_now`, `one_month_ago`, or `one_month_from_now`.
|
|
274
|
+
- Date ranges use an empty object. They support `past` and `next` for weeks, months, and years, plus
|
|
275
|
+
`this_week`.
|
|
276
|
+
- `this_week` includes the full calendar week. The host applies its time zone and week start.
|
|
277
|
+
- Relative filters use the current date when the host evaluates the query.
|
|
278
|
+
|
|
279
|
+
| Period | Week | Month | Year |
|
|
280
|
+
| ------ | ----------- | ------------ | ----------- |
|
|
281
|
+
| Past | `past_week` | `past_month` | `past_year` |
|
|
282
|
+
| This | `this_week` | — | — |
|
|
283
|
+
| Next | `next_week` | `next_month` | `next_year` |
|
|
284
|
+
|
|
285
|
+
Use `temporal-polyfill` to calculate an ISO 8601 date when no relative value or range operator
|
|
286
|
+
matches your query.
|
|
239
287
|
|
|
240
288
|
</details>
|
|
241
289
|
|
|
290
|
+
Both subscription APIs support the same date target:
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
const unsubscribe = customBlock.subscribeToDataSource({
|
|
294
|
+
key: "tasks",
|
|
295
|
+
onSnapshot: snapshot => render(snapshot),
|
|
296
|
+
options: {
|
|
297
|
+
filter: {
|
|
298
|
+
key: "schedule",
|
|
299
|
+
date: { target: "end_date", after: "2026-10-08" },
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
})
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
const query = useDataSource("tasks", {
|
|
307
|
+
filter: {
|
|
308
|
+
key: "schedule",
|
|
309
|
+
date: { target: "end_date", after: "2026-10-08" },
|
|
310
|
+
},
|
|
311
|
+
})
|
|
312
|
+
```
|
|
313
|
+
|
|
242
314
|
### Sorts
|
|
243
315
|
|
|
244
316
|
Use `sorts` to order matching rows. Sorts do not support every property type yet, including some
|
|
@@ -264,6 +336,11 @@ taking priority. Empty values sort last in both directions.
|
|
|
264
336
|
You can sort by up to 10 unique properties. Both APIs accept the same sort shape, and you can
|
|
265
337
|
combine `sorts` with `filter`.
|
|
266
338
|
|
|
339
|
+
Every sort uses one property address and an `ascending` or `descending` direction.
|
|
340
|
+
`NotionSortDirection` defines these directions for `NotionDataSourceSort`. People and Created by
|
|
341
|
+
properties use native name ordering. No person attribute target is required. Created by sorts
|
|
342
|
+
require an actual Created by column in the database schema.
|
|
343
|
+
|
|
267
344
|
## Pages within a data source
|
|
268
345
|
|
|
269
346
|
Each row returned by either API is a `NotionDataSourcePage` —
|
|
@@ -438,12 +515,12 @@ This table shows property support for custom blocks running in Notion.
|
|
|
438
515
|
| `phone_number` | 🟢 String | 🟢 Supported | 🟢 Supported | 🟢 Supported |
|
|
439
516
|
| `select` | 🟢 Option name | 🟡 Set value only | 🟢 Supported | 🔴 Unavailable |
|
|
440
517
|
| `multi_select` | 🟢 Array of option names | 🟡 Set values only | 🟢 Supported | 🔴 Unavailable |
|
|
441
|
-
| `status` | 🟢 Option name | 🟡 Set value only |
|
|
442
|
-
| `date` | 🟢 `NotionDateValue` | 🟡 Minute precision |
|
|
443
|
-
| `people` | 🟢 Array of record pointers | 🟢 Supported | 🟢 Supported |
|
|
518
|
+
| `status` | 🟢 Option name | 🟡 Set value only | 🟢 Option names, group names, or empty checks | 🔴 Unavailable |
|
|
519
|
+
| `date` | 🟢 `NotionDateValue` | 🟡 Minute precision | 🟢 Supported | 🟢 Supported |
|
|
520
|
+
| `people` | 🟢 Array of record pointers | 🟢 Supported | 🟢 Supported | 🟢 Native name ordering |
|
|
444
521
|
| `files` | 🟡 Text fallback | 🟡 File URLs only | 🔴 Unavailable | 🔴 Unavailable |
|
|
445
522
|
| `unique_id` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
446
|
-
| `relation` | 🟢 Array of record pointers | 🟡 Replaces value. Rejects `has_more: true`. |
|
|
523
|
+
| `relation` | 🟢 Array of record pointers | 🟡 Replaces value. Rejects `has_more: true`. | 🟢 Supported | 🔴 Unavailable for standard relations. ⚫ Notion cannot sort XLDB targets. |
|
|
447
524
|
| `place` | 🟡 Text fallback | 🟢 Supported | 🔴 Unavailable | 🔴 Unavailable |
|
|
448
525
|
| `formula` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
449
526
|
| `rollup` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable for numeric targets or numeric aggregations. ⚫ Notion cannot sort other rollups. |
|
|
@@ -453,7 +530,7 @@ This table shows property support for custom blocks running in Notion.
|
|
|
453
530
|
| `location` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable elsewhere. ⚫ Notion disables filters in My Meetings and Library system databases. | 🔴 Unavailable elsewhere. ⚫ Notion disables sorts in Library system databases. |
|
|
454
531
|
| `created_time` | 🟢 `NotionDateTime` in UTC | 🔴 Unavailable | 🔴 Unavailable | 🟡 Schema property only |
|
|
455
532
|
| `last_edited_time` | 🟢 `NotionDateTime` in UTC | 🔴 Unavailable | 🔴 Unavailable | 🟡 Schema property only |
|
|
456
|
-
| `created_by` | 🟢 Array of record pointers | 🔴 Unavailable | 🟡 Schema-backed creator filters |
|
|
533
|
+
| `created_by` | 🟢 Array of record pointers | 🔴 Unavailable | 🟡 Schema-backed creator filters | 🟡 Schema property only |
|
|
457
534
|
| `last_edited_by` | 🟢 Array of record pointers | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
458
535
|
|
|
459
536
|
### Notes
|
|
@@ -471,10 +548,11 @@ This table shows property support for custom blocks running in Notion.
|
|
|
471
548
|
reference that property's ID. The synthetic `created_time` field returned with every row is
|
|
472
549
|
read-only metadata and cannot be used when querying.
|
|
473
550
|
- You can sort by up to 10 unique properties.
|
|
474
|
-
- Date-time filter values may include seconds or milliseconds
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
-
|
|
551
|
+
- Date-time filter values may include seconds or milliseconds. The Notion host evaluates them at
|
|
552
|
+
minute precision. Date filters do not expose end-date targeting.
|
|
553
|
+
- Status group filters use stored English group names. The SDK does not normalize localized names.
|
|
554
|
+
- `group_equals` matches any listed group. `group_does_not_equal` excludes all listed groups.
|
|
555
|
+
- Empty group arrays and unknown group names return a nonretryable query error.
|
|
478
556
|
- People properties return record pointers with table values of `notion_user`,
|
|
479
557
|
`space_permission_group`, `bot`, or `organization_bot`. Group IDs use the composite form
|
|
480
558
|
`groupId|workspaceId`. People filters support users and groups. Bot and organization bot filtering
|
|
@@ -537,10 +615,12 @@ See [Pages property support](./pages.md#property-support) for the page-property
|
|
|
537
615
|
- `NotionDataSourcePropertyFilter` — one property address combined with a type-specific operator.
|
|
538
616
|
- `NotionDataSourcePropertyAddress` — either a semantic property `key` or a raw `propertyId`.
|
|
539
617
|
- `NotionDataSourceSort` — a property address with an `ascending` or `descending` direction.
|
|
618
|
+
- `NotionSortDirection` — the shared `"ascending" | "descending"` direction type.
|
|
540
619
|
- `NotionDataSourceTextFilterOperator`, `NotionDataSourceNumberFilterOperator`,
|
|
541
620
|
`NotionDataSourceCheckboxFilterOperator`, `NotionDataSourceOptionFilterOperator`,
|
|
542
|
-
`
|
|
543
|
-
`
|
|
621
|
+
`NotionDataSourceStatusFilterOperator`, `NotionDataSourceContainsFilterOperator`,
|
|
622
|
+
`NotionDataSourceDateFilterOperator`, `NotionDataSourcePeopleFilterOperator`,
|
|
623
|
+
`NotionDataSourceRelationFilterOperator`, and `NotionDataSourceCreatedByFilterOperator` — the
|
|
544
624
|
operators accepted for each property type.
|
|
545
625
|
- `NotionDataSourcePersonFilterValue` — an explicit `{ object: "user" | "group", id }` reference
|
|
546
626
|
used by a people filter.
|
package/docs/errors.md
CHANGED
|
@@ -59,8 +59,7 @@ recovery does not depend on `isRetryable`.
|
|
|
59
59
|
|
|
60
60
|
Unlike request helpers, `initCustomBlock` rejects with `CustomBlockInitializationError`. Its `code`
|
|
61
61
|
type is `CustomBlockInitializationErrorCode`, which covers failures reported by either side of the
|
|
62
|
-
handshake plus SDK-local iframe errors.
|
|
63
|
-
not finish loading host dependencies in time.
|
|
62
|
+
handshake plus SDK-local iframe errors.
|
|
64
63
|
|
|
65
64
|
`CustomBlockInitializationErrorInfo` is the matching `{ code, message, isRetryable }` object type.
|
|
66
65
|
|
|
@@ -74,6 +73,8 @@ Initialization errors have direction-specific meanings:
|
|
|
74
73
|
valid `init` message. The SDK sends this code in `initResult.error`.
|
|
75
74
|
- `invalid_init_result_payload` means that the host could not parse the SDK's `initResult`. This is
|
|
76
75
|
a host-local error. The SDK does not send this code.
|
|
76
|
+
- `initial_state_timeout` means that the host could not prepare the initial state before its
|
|
77
|
+
timeout.
|
|
77
78
|
- `no_init_result` means that the host did not receive a valid `initResult` before its timeout.
|
|
78
79
|
|
|
79
80
|
See [Lifecycle and initialization](./lifecycle.md) for initialization-specific error codes.
|
package/docs/lifecycle.md
CHANGED
|
@@ -30,7 +30,7 @@ The initialization promise resolves after the SDK applies the host state. Await
|
|
|
30
30
|
code that reads initialized state. The SDK sends `initResult` after the initial render.
|
|
31
31
|
|
|
32
32
|
- The SDK waits for the host to respond with `init` or `init.error`, without an SDK-local timeout.
|
|
33
|
-
Host-owned timeout errors such as `
|
|
33
|
+
Host-owned timeout errors such as `initial_state_timeout` reject the promise with
|
|
34
34
|
`CustomBlockInitializationError`.
|
|
35
35
|
- If a matching `init` is malformed, the SDK sends `initResult.error` with code
|
|
36
36
|
`invalid_init_payload` and rejects with the same structured error.
|
package/docs/pages.md
CHANGED
|
@@ -215,12 +215,12 @@ and a property in its schema.
|
|
|
215
215
|
| `url` | 🟢 String or `null` | 🟢 Supported | 🟢 Supported |
|
|
216
216
|
| `email` | 🟢 String or `null` | 🟢 Supported | 🟢 Supported |
|
|
217
217
|
| `phone_number` | 🟢 String or `null` | 🟢 Supported | 🟢 Supported |
|
|
218
|
-
| `select` | 🟡
|
|
219
|
-
| `multi_select` | 🟡
|
|
220
|
-
| `status` | 🟡
|
|
218
|
+
| `select` | 🟡 Does not return available options | 🟡 Set value only | 🟡 Set value only |
|
|
219
|
+
| `multi_select` | 🟡 Does not return available options | 🟡 Set value only | 🟡 Set value only |
|
|
220
|
+
| `status` | 🟡 Does not return available options | 🟡 Set value only | 🟡 Set value only |
|
|
221
221
|
| `date` | 🟢 `start` and optional `end` strings, or `null` | 🟡 Minute precision | 🟡 Minute precision |
|
|
222
222
|
| `people` | 🟢 Array of user/group ID objects | 🟢 Supported | 🟢 Supported |
|
|
223
|
-
| `files` |
|
|
223
|
+
| `files` | 🟢 External links and hosted files | 🟡 File URLs only | 🟡 File URLs only |
|
|
224
224
|
| `unique_id` | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
|
|
225
225
|
| `relation` | 🟢 Array of page ID objects | 🟡 Replaces value. Rejects `has_more: true`. | 🟡 Replaces value. Rejects `has_more: true`. |
|
|
226
226
|
| `place` | 🟢 Coordinates and optional place details, or `null` | 🟢 Supported | 🟢 Supported |
|
|
@@ -237,15 +237,16 @@ and a property in its schema.
|
|
|
237
237
|
|
|
238
238
|
### Notes
|
|
239
239
|
|
|
240
|
-
- Select, multi-select, and status reads return option names
|
|
241
|
-
|
|
242
|
-
selected value. They do not edit option definitions
|
|
243
|
-
|
|
240
|
+
- Select, multi-select, and status reads return option names and colors when available. They also
|
|
241
|
+
return IDs when the options match the schema. Writes accept an existing option ID or a name and
|
|
242
|
+
set the selected value. They do not edit option definitions. If you supply both an ID and a name,
|
|
243
|
+
the host uses the ID. The host rejects unknown IDs.
|
|
244
244
|
- Date-time writes preserve hours and minutes but discard seconds and milliseconds.
|
|
245
245
|
- Title and rich text use text arrays, but reads and writes preserve only plain text. Reads and
|
|
246
246
|
writes do not preserve formatting, links, mentions, or equations as structured rich text.
|
|
247
|
-
-
|
|
248
|
-
|
|
247
|
+
- `pages.get` resolves Files links and readable file/image/pdf/audio/video references that have a
|
|
248
|
+
source. Create/update responses include link items only. File writes accept `external` URLs and
|
|
249
|
+
existing `file` URLs and store them as links. Upload references (`file_upload`) are unsupported.
|
|
249
250
|
- Relation writes replace the value and reject `has_more: true`.
|
|
250
251
|
- `created_time` and `last_edited_time` are read-only top-level fields on `page`, when available.
|
|
251
252
|
The host omits them from `page.properties`. The host does not return `created_by` or
|
|
@@ -296,3 +297,14 @@ navigation; it does not wait for route-leave confirmation or for the page to fin
|
|
|
296
297
|
surface that cannot host the requested peek may fall back to full-page navigation. The success
|
|
297
298
|
result contains `{ pageId }` only — call `pages.get(pageId)` separately when you need readable page
|
|
298
299
|
metadata.
|
|
300
|
+
|
|
301
|
+
### Files reads
|
|
302
|
+
|
|
303
|
+
Each Files entry is either an external link (`type: "external"`) or a Notion-hosted file
|
|
304
|
+
(`type: "file"`), in the order shown in Notion. A hosted file's `file.url` is a signed URL that
|
|
305
|
+
expires at `file.expiry_time`. Call `pages.get` again when you need a fresh URL. `expiry_time` can
|
|
306
|
+
be missing on older hosts.
|
|
307
|
+
|
|
308
|
+
An empty Files value returns `[]`. If the host can't resolve an entry (for example, you can't read
|
|
309
|
+
the referenced file, or it points to a folder), `pages.get` fails with an error instead of returning
|
|
310
|
+
a partial list.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notionhq/custom-blocks",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.23",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"import": "./dist/react/index.js",
|
|
19
19
|
"types": "./dist/react/index.d.ts"
|
|
20
20
|
},
|
|
21
|
-
"./
|
|
22
|
-
"import": "./dist/
|
|
23
|
-
"types": "./dist/
|
|
21
|
+
"./bridge": {
|
|
22
|
+
"import": "./dist/bridge.js",
|
|
23
|
+
"types": "./dist/bridge.d.ts"
|
|
24
24
|
},
|
|
25
25
|
"./bundle": {
|
|
26
26
|
"types": "./bin/notion-custom-blocks/bundle.d.ts",
|