@notionhq/custom-blocks 0.4.0 → 0.5.0

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.
Files changed (129) hide show
  1. package/dist/bridge/SandboxBridge.d.ts +0 -16
  2. package/dist/bridge/SandboxBridge.d.ts.map +1 -1
  3. package/dist/bridge/SandboxBridge.js +0 -38
  4. package/dist/dataSources/bridge/resolveDataSourceQuery.js +3 -3
  5. package/dist/dataSources/bridge/resolveDataSources.js +4 -4
  6. package/dist/dataSources/filters/resolveFilter.d.ts.map +1 -1
  7. package/dist/dataSources/filters/resolveFilter.js +13 -3
  8. package/dist/dataSources/filters/types.d.ts +9 -3
  9. package/dist/dataSources/filters/types.d.ts.map +1 -1
  10. package/dist/dataSources/properties/resolvePropertyAddress.js +1 -1
  11. package/dist/dataSources/properties/resolvePropertyWriteMapForDataSource.js +1 -1
  12. package/dist/dataSources/resolvePageDataSource.js +2 -2
  13. package/dist/dataSources/subscribeToDataSource.d.ts +1 -4
  14. package/dist/dataSources/subscribeToDataSource.d.ts.map +1 -1
  15. package/dist/dataSources/subscribeToDataSource.js +2 -3
  16. package/dist/files/files.d.ts +2 -0
  17. package/dist/files/files.d.ts.map +1 -0
  18. package/dist/files/files.js +1 -0
  19. package/dist/files/icons.d.ts +2 -0
  20. package/dist/files/icons.d.ts.map +1 -0
  21. package/dist/files/icons.js +1 -0
  22. package/dist/index.d.ts +4 -4
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/initialization/getInitBindingError.js +2 -2
  25. package/dist/manifest/types.d.ts +4 -3
  26. package/dist/manifest/types.d.ts.map +1 -1
  27. package/dist/pages/bridge/getPageForDataSource.js +1 -1
  28. package/dist/pages/bridge/toNotionPageFieldsFromBridgePage.d.ts +4 -1
  29. package/dist/pages/bridge/toNotionPageFieldsFromBridgePage.d.ts.map +1 -1
  30. package/dist/pages/bridge/toNotionPagePropertyFromBridgeProperty.d.ts.map +1 -1
  31. package/dist/pages/bridge/toNotionPagePropertyFromBridgeProperty.js +0 -2
  32. package/dist/pages/bridge/updatePage.js +1 -1
  33. package/dist/pages/properties/getPropertyByKey.js +2 -2
  34. package/dist/pages/types.d.ts +8 -10
  35. package/dist/pages/types.d.ts.map +1 -1
  36. package/dist/protocol/compatibility/protocol3To10/dataSourceBindings.d.ts +530 -0
  37. package/dist/protocol/compatibility/protocol3To10/dataSourceBindings.js +25 -0
  38. package/dist/protocol/compatibility/protocol3To5/bridgePage.d.ts +6 -7
  39. package/dist/protocol/compatibility/protocol3To5/bridgePage.js +3 -3
  40. package/dist/protocol/context/containingPage.d.ts +3 -0
  41. package/dist/protocol/context/messages/pageChanged.d.ts +3 -0
  42. package/dist/protocol/context/messages/parentChanged.d.ts +3 -0
  43. package/dist/protocol/context/parent.d.ts +3 -0
  44. package/dist/protocol/context/parent.js +6 -1
  45. package/dist/protocol/dataSources/bridgeDataSourceBinding.d.ts +3 -7
  46. package/dist/protocol/dataSources/bridgeDataSourceBinding.js +5 -5
  47. package/dist/protocol/dataSources/bridgeDataSourceBindings.d.ts +2 -6
  48. package/dist/protocol/dataSources/{collectionPointer.d.ts → dataSourcePointer.d.ts} +2 -2
  49. package/dist/protocol/dataSources/{collectionPointer.js → dataSourcePointer.js} +1 -1
  50. package/dist/protocol/dataSources/{collectionSchema.d.ts → dataSourceSchema.d.ts} +2 -6
  51. package/dist/protocol/dataSources/{collectionSchema.js → dataSourceSchema.js} +1 -1
  52. package/dist/protocol/dataSources/filters/bridgeDataSourceFilter.d.ts +1458 -12
  53. package/dist/protocol/dataSources/filters/bridgeDataSourceFilterCondition.d.ts +729 -6
  54. package/dist/protocol/dataSources/filters/bridgeDataSourceFilterCondition.js +14 -2
  55. package/dist/protocol/dataSources/filters/peopleFilterOperator.d.ts +3 -3
  56. package/dist/protocol/dataSources/filters/peopleFilterOperator.js +1 -1
  57. package/dist/protocol/dataSources/filters/timestampFilterOperator.d.ts +354 -0
  58. package/dist/protocol/dataSources/filters/timestampFilterOperator.js +4 -0
  59. package/dist/protocol/dataSources/messages/dataSourcesChanged.d.ts +2 -6
  60. package/dist/protocol/dataSources/messages/queryDataSource.d.ts +1470 -26
  61. package/dist/protocol/dataSources/notionDataSource.d.ts +3 -11
  62. package/dist/protocol/dataSources/notionDataSource.js +5 -5
  63. package/dist/protocol/dataSources/properties/propertySchema.d.ts +4 -9
  64. package/dist/protocol/dataSources/properties/propertySchema.js +2 -4
  65. package/dist/protocol/dataSources/resolveDataSourceBinding.d.ts +4 -4
  66. package/dist/protocol/dataSources/resolveDataSourceBinding.js +2 -2
  67. package/dist/protocol/files.d.ts +32 -0
  68. package/dist/protocol/files.js +17 -0
  69. package/dist/protocol/handshake/connect.d.ts +1 -1
  70. package/dist/protocol/handshake/init.d.ts +9 -7
  71. package/dist/protocol/icons.d.ts +22 -7
  72. package/dist/protocol/icons.js +19 -7
  73. package/dist/protocol/index.d.ts +16 -14
  74. package/dist/protocol/index.js +10 -7
  75. package/dist/protocol/manifest/manifest.d.ts +9 -9
  76. package/dist/protocol/manifest/manifest.js +7 -7
  77. package/dist/protocol/messages/hostToSandbox.d.ts +100 -103
  78. package/dist/protocol/messages/sandboxToHost.d.ts +1471 -37
  79. package/dist/protocol/pages/bridgePage.d.ts +6 -7
  80. package/dist/protocol/pages/bridgePage.js +3 -3
  81. package/dist/protocol/pages/messages/createPage.d.ts +547 -40
  82. package/dist/protocol/pages/messages/createPage.js +27 -15
  83. package/dist/protocol/pages/messages/getPage.d.ts +18 -21
  84. package/dist/protocol/pages/messages/updatePage.d.ts +21 -28
  85. package/dist/protocol/pages/messages/updatePage.js +3 -3
  86. package/dist/protocol/pages/pageAppearance.d.ts +5 -59
  87. package/dist/protocol/pages/pageAppearance.js +11 -40
  88. package/dist/protocol/pages/properties/bridgePagePropertyMaps.d.ts +4 -12
  89. package/dist/protocol/pages/properties/bridgePagePropertyValue.d.ts +2 -6
  90. package/dist/protocol/pages/properties/bridgePagePropertyValue.js +2 -7
  91. package/dist/protocol/utils/ids.d.ts +2 -0
  92. package/dist/protocol/utils/ids.js +1 -0
  93. package/dist/protocol/utils/protocolVersion.d.ts +2 -1
  94. package/dist/protocol/utils/protocolVersion.js +3 -1
  95. package/dist/react/NotionCustomBlock.d.ts.map +1 -1
  96. package/dist/react/NotionCustomBlock.js +1 -15
  97. package/dist/utils/version.js +1 -1
  98. package/docs/data-sources.md +74 -76
  99. package/docs/deployment.md +4 -5
  100. package/docs/pages.md +91 -55
  101. package/package.json +1 -1
  102. package/src/bridge/SandboxBridge.ts +0 -55
  103. package/src/dataSources/bridge/resolveDataSourceQuery.ts +3 -3
  104. package/src/dataSources/bridge/resolveDataSources.ts +4 -4
  105. package/src/dataSources/filters/resolveFilter.ts +12 -3
  106. package/src/dataSources/filters/types.ts +7 -4
  107. package/src/dataSources/properties/resolvePropertyAddress.ts +1 -1
  108. package/src/dataSources/properties/resolvePropertyWriteMapForDataSource.ts +1 -1
  109. package/src/dataSources/resolvePageDataSource.ts +2 -2
  110. package/src/dataSources/subscribeToDataSource.ts +7 -19
  111. package/src/files/files.ts +5 -0
  112. package/src/files/icons.ts +9 -0
  113. package/src/index.ts +6 -11
  114. package/src/initialization/getInitBindingError.ts +2 -2
  115. package/src/manifest/types.ts +9 -3
  116. package/src/pages/bridge/getPageForDataSource.ts +1 -1
  117. package/src/pages/bridge/toNotionPagePropertyFromBridgeProperty.ts +0 -2
  118. package/src/pages/bridge/updatePage.ts +1 -1
  119. package/src/pages/properties/getPropertyByKey.ts +2 -2
  120. package/src/pages/types.ts +9 -13
  121. package/src/react/NotionCustomBlock.tsx +1 -16
  122. package/dist/protocol/dataSources/filters/createdByFilterOperator.d.ts +0 -17
  123. package/dist/protocol/dataSources/filters/createdByFilterOperator.js +0 -11
  124. package/dist/protocol/pages/properties/fileInput.d.ts +0 -16
  125. package/dist/protocol/pages/properties/fileInput.js +0 -16
  126. package/dist/react/DebugMessageLog.d.ts +0 -2
  127. package/dist/react/DebugMessageLog.d.ts.map +0 -1
  128. package/dist/react/DebugMessageLog.js +0 -23
  129. package/src/react/DebugMessageLog.tsx +0 -34
@@ -138,17 +138,17 @@ export declare const bridgePagePropertyValueSchema: v.VariantSchema<"type", [v.O
138
138
  readonly type: v.LiteralSchema<"files", undefined>;
139
139
  readonly files: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
140
140
  readonly type: v.LiteralSchema<"external", undefined>;
141
- readonly name: v.StringSchema<undefined>;
142
141
  readonly external: v.ObjectSchema<{
143
142
  readonly url: v.StringSchema<undefined>;
144
143
  }, undefined>;
144
+ readonly name: v.StringSchema<undefined>;
145
145
  }, undefined>, v.ObjectSchema<{
146
146
  readonly type: v.LiteralSchema<"file", undefined>;
147
- readonly name: v.StringSchema<undefined>;
148
147
  readonly file: v.ObjectSchema<{
149
148
  readonly url: v.StringSchema<undefined>;
150
149
  readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
151
150
  }, undefined>;
151
+ readonly name: v.StringSchema<undefined>;
152
152
  }, undefined>], undefined>, undefined>;
153
153
  }, undefined>, v.ObjectSchema<{
154
154
  readonly id: v.StringSchema<undefined>;
@@ -197,10 +197,6 @@ export declare const bridgePagePropertyValueSchema: v.VariantSchema<"type", [v.O
197
197
  readonly id: v.StringSchema<undefined>;
198
198
  readonly type: v.LiteralSchema<"formula", undefined>;
199
199
  readonly formula: v.StringSchema<undefined>;
200
- }, undefined>, v.ObjectSchema<{
201
- readonly id: v.StringSchema<undefined>;
202
- readonly type: v.LiteralSchema<"location", undefined>;
203
- readonly location: v.StringSchema<undefined>;
204
200
  }, undefined>, v.ObjectSchema<{
205
201
  readonly id: v.StringSchema<undefined>;
206
202
  readonly type: v.LiteralSchema<"rollup", undefined>;
@@ -1,7 +1,7 @@
1
1
  import * as v from "valibot";
2
+ import { bridgeFilePropertyItemSchema } from "../../files.js";
2
3
  import { nullableStringSchema } from "../../utils/nullableStringSchema.js";
3
4
  import { notionDateInputSchema } from "./dateInput.js";
4
- import { notionFileInputSchema } from "./fileInput.js";
5
5
  import { metadataActorSchema } from "./metadataActor.js";
6
6
  import { notionPlaceInputSchema } from "./placeInput.js";
7
7
  import { notionRelationInputSchema } from "./relationInput.js";
@@ -79,7 +79,7 @@ export const bridgePagePropertyValueSchema = v.variant("type", [
79
79
  v.object({
80
80
  ...pagePropertyBaseSchema,
81
81
  type: v.literal("files"),
82
- files: v.array(notionFileInputSchema),
82
+ files: v.array(bridgeFilePropertyItemSchema),
83
83
  }),
84
84
  v.object({
85
85
  ...pagePropertyBaseSchema,
@@ -121,11 +121,6 @@ export const bridgePagePropertyValueSchema = v.variant("type", [
121
121
  type: v.literal("formula"),
122
122
  formula: v.string(),
123
123
  }),
124
- v.object({
125
- ...pagePropertyBaseSchema,
126
- type: v.literal("location"),
127
- location: v.string(),
128
- }),
129
124
  v.object({
130
125
  ...pagePropertyBaseSchema,
131
126
  type: v.literal("rollup"),
@@ -29,3 +29,5 @@ export type NotionAgentId = v.InferOutput<typeof notionAgentIdSchema>;
29
29
  */
30
30
  export declare const notionSpaceIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>;
31
31
  export type NotionSpaceId = v.InferOutput<typeof notionSpaceIdSchema>;
32
+ export declare const notionAppInstallationIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAppInstallationId">]>;
33
+ export type NotionAppInstallationId = v.InferOutput<typeof notionAppInstallationIdSchema>;
@@ -24,3 +24,4 @@ export const notionAgentIdSchema = v.pipe(v.string(), v.brand("NotionAgentId"));
24
24
  * but the brand keeps space IDs from being accidentally mixed with other IDs in TypeScript.
25
25
  */
26
26
  export const notionSpaceIdSchema = v.pipe(v.string(), v.brand("NotionSpaceId"));
27
+ export const notionAppInstallationIdSchema = v.pipe(v.string(), v.brand("NotionAppInstallationId"));
@@ -3,7 +3,8 @@
3
3
  * Increase this value for breaking wire changes. Hosts can continue to accept
4
4
  * older versions, so this value does not set the minimum or maximum they accept.
5
5
  */
6
- export declare const LATEST_BRIDGE_PROTOCOL_VERSION = 10;
6
+ export declare const LATEST_BRIDGE_PROTOCOL_VERSION = 11;
7
7
  export declare const UNIFIED_PAGE_PROTOCOL_VERSION = 6;
8
8
  export declare const TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION = 7;
9
9
  export declare const NATIVE_ICON_PROTOCOL_VERSION = 9;
10
+ export declare const DATA_SOURCE_NAMING_PROTOCOL_VERSION = 11;
@@ -3,7 +3,7 @@
3
3
  * Increase this value for breaking wire changes. Hosts can continue to accept
4
4
  * older versions, so this value does not set the minimum or maximum they accept.
5
5
  */
6
- export const LATEST_BRIDGE_PROTOCOL_VERSION = 10;
6
+ export const LATEST_BRIDGE_PROTOCOL_VERSION = 11;
7
7
  // Protocol 6 introduces unified pages with name-keyed property objects.
8
8
  // Keep this cutoff fixed when the latest protocol version increases.
9
9
  export const UNIFIED_PAGE_PROTOCOL_VERSION = 6;
@@ -11,3 +11,5 @@ export const UNIFIED_PAGE_PROTOCOL_VERSION = 6;
11
11
  export const TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION = 7;
12
12
  // Protocol 9 adds native icon responses and writes throughout the page API.
13
13
  export const NATIVE_ICON_PROTOCOL_VERSION = 9;
14
+ // Protocol 11 renames binding fields to data-source terminology.
15
+ export const DATA_SOURCE_NAMING_PROTOCOL_VERSION = 11;
@@ -1 +1 @@
1
- {"version":3,"file":"NotionCustomBlock.d.ts","sourceRoot":"","sources":["../../src/react/NotionCustomBlock.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQtC,OAAO,iCAAiC,CAAA;AAExC;;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;CACzD,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,EACjC,QAAQ,EACR,QAAe,EACf,aAAa,GACb,EAAE,sBAAsB,+BAkDxB"}
1
+ {"version":3,"file":"NotionCustomBlock.d.ts","sourceRoot":"","sources":["../../src/react/NotionCustomBlock.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtC,OAAO,iCAAiC,CAAA;AAExC;;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;CACzD,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,EACjC,QAAQ,EACR,QAAe,EACf,aAAa,GACb,EAAE,sBAAsB,+BAoCxB"}
@@ -1,9 +1,8 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useLayoutEffect, useState } from "react";
2
+ import { useEffect, useLayoutEffect } from "react";
3
3
  import { getBridge } from "../bridge/getBridge.js";
4
4
  import { useCustomBlockInit } from "../initialization/react/useCustomBlockInit.js";
5
5
  import { autoResize } from "../layout/autoResize.js";
6
- import { DebugMessageLog } from "./DebugMessageLog.js";
7
6
  import { InitializationErrorDetails } from "./InitializationErrorDetails.js";
8
7
  import { MissingHostScreen } from "./MissingHostScreen.js";
9
8
  import "./InitializationErrorScreen.css";
@@ -27,7 +26,6 @@ import "./InitializationErrorScreen.css";
27
26
  */
28
27
  export function NotionCustomBlock({ children, fallback = null, errorFallback, }) {
29
28
  const init = useCustomBlockInit();
30
- const [debugOpen, setDebugOpen] = useState(false);
31
29
  // Keep the host iframe height in sync with the block's content after initialization.
32
30
  useEffect(() => {
33
31
  if (!init.isLoaded || typeof window === "undefined") {
@@ -35,15 +33,6 @@ export function NotionCustomBlock({ children, fallback = null, errorFallback, })
35
33
  }
36
34
  return autoResize({ target: document.getElementById("root") });
37
35
  }, [init.isLoaded]);
38
- useEffect(() => {
39
- const onKeyDown = (e) => {
40
- if (e.key === "\\") {
41
- setDebugOpen(prev => !prev);
42
- }
43
- };
44
- window.addEventListener("keydown", onKeyDown);
45
- return () => window.removeEventListener("keydown", onKeyDown);
46
- }, []);
47
36
  useLayoutEffect(() => {
48
37
  if (!init.isLoaded) {
49
38
  return;
@@ -52,9 +41,6 @@ export function NotionCustomBlock({ children, fallback = null, errorFallback, })
52
41
  // height to the host as part of the `initResult` message.
53
42
  getBridge().completeInitialization();
54
43
  }, [init.isLoaded]);
55
- if (debugOpen) {
56
- return _jsx(DebugMessageLog, {});
57
- }
58
44
  if (init.error) {
59
45
  if (errorFallback === undefined) {
60
46
  return _jsx(DefaultInitErrorFallback, { error: init.error });
@@ -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.4.0"
7
+ export const CUSTOM_BLOCKS_SDK_VERSION = "0.5.0"
@@ -26,12 +26,12 @@ Use the shared `propertyIdsByKey` map to resolve declared keys to raw property I
26
26
  to read values by ID or key. Read each property object from `properties[name]`. `properties` maps
27
27
  database property names to property objects.
28
28
 
29
- Use `ManifestDataSource`, `ManifestProperty`, and `ManifestIcon` for declaration metadata. To list
30
- declared keys, use `useManifest()` in React or `customBlock.getManifest()` in TypeScript. These APIs
31
- are useful for a data source switcher.
29
+ Use `NotionManifestDataSource`, `NotionManifestProperty`, and `NotionManifestIcon` for declaration
30
+ metadata. To list declared keys, use `useManifest()` in React or `customBlock.getManifest()` in
31
+ TypeScript. These APIs are useful for a data source switcher.
32
32
 
33
33
  A viewer who can't read a bound data source still sees the block. That data source has
34
- `inaccessible: true` and no `collectionPointer`. Queries and page creation that use it fail with
34
+ `inaccessible: true` and no `dataSourcePointer`. Queries and page creation that use it fail with
35
35
  `data_source_inaccessible`, so show a fallback for that error.
36
36
 
37
37
  ## Subscribe to rows
@@ -249,9 +249,8 @@ the filter type, not the column.
249
249
  | `status` | `equals`, `does_not_equal`, `group_equals`, `group_does_not_equal`, `is_empty`, `is_not_empty` |
250
250
  | `multi_select` | `contains`, `contains_all`, `does_not_contain`, `is_empty`, `is_not_empty` |
251
251
  | `date` | `equals`, `before`, `after`, `on_or_before`, `on_or_after`, relative ranges, `is_empty`, `is_not_empty` |
252
- | `people` | `contains`, `does_not_contain`, `is_empty`, `is_not_empty` |
252
+ | `people`, `created_by`, `last_edited_by` | `contains`, `does_not_contain`, `is_empty`, `is_not_empty` |
253
253
  | `relation` | `contains`, `does_not_contain`, `is_empty`, `is_not_empty` |
254
- | `created_by` | `contains`, `does_not_contain`, `is_empty`, `is_not_empty` |
255
254
 
256
255
  - Select, multi-select, and status filters accept one option name or an array of option names.
257
256
  - Status group filters accept one stored group name or an array of 1–5 names. Inclusion matches any
@@ -262,9 +261,8 @@ the filter type, not the column.
262
261
  `{ object: "user", id: "..." }` or `{ object: "group", id: "..." }`. Group filters match exact
263
262
  group mentions. They do not expand group membership. Using bot or organization bot pointers as
264
263
  filter references is not supported.
265
- - Creator filters accept one explicit human user reference. Groups, bots, and organization bots are
266
- not supported as filter references. `does_not_contain` also matches rows with non-human or missing
267
- creators. Empty checks test whether creator metadata is missing.
264
+ - Created by and Last edited by use the People operators. Group operands do not match their
265
+ individual actors. Bot actors count as present for empty checks.
268
266
  - Relation membership filters accept one page ID in dashed or undashed UUID format.
269
267
  - Relation `does_not_contain` returns rows that do not reference the specified page. Rows with no
270
268
  related pages also match. Multiple targets are unsupported.
@@ -326,6 +324,11 @@ const query = useDataSource("tasks", {
326
324
  })
327
325
  ```
328
326
 
327
+ ### Timestamp filters
328
+
329
+ `created_time` and `last_edited_time` use `NotionDataSourceTimestampFilterOperator`: Date operators
330
+ without `target`, because timestamps have no end date.
331
+
329
332
  ### Sorts
330
333
 
331
334
  Use `sorts` to order matching rows. Sorts do not support every property type yet, including some
@@ -516,72 +519,76 @@ export function ScoreList() {
516
519
 
517
520
  ## Property support
518
521
 
519
- This table shows property support for custom blocks running in Notion. The query-result descriptions
520
- refer to the core values inside each property object. For example, “Number” refers to
521
- `property.number` in `{ id, type: "number", number: 8 }`.
522
+ This table shows property support for custom blocks running in Notion. Each queried page is a
523
+ `NotionPage`. For create and update support, see the [Pages table](pages.md#property-support).
522
524
 
523
- - **Query result** shows values in `properties` from `useDataSource` and
524
- `customBlock.subscribeToDataSource`. Missing values can be `undefined`.
525
- - **Update row** covers writes through `item.updateByKey({ properties: ... })`.
525
+ - **Queried page** shows values in each page’s `properties`. Property getters return `null` for
526
+ missing properties.
526
527
  - **Filter** and **Sort** cover query options.
527
528
 
529
+ Property values can be `null` when empty or unavailable.
530
+
528
531
  - 🟢 **Supported:** The SDK supports this operation in Notion.
529
- - 🟡 **Limited:** The SDK supports this operation with the restrictions shown in the cell.
530
- - 🔴 **Unavailable:** The SDK does not expose this operation.
532
+ - 🟡 **Limited:** The SDK supports this operation with the restrictions shown in the table and
533
+ notes.
534
+ - 🔴 **Unavailable:** The SDK does not support this operation.
531
535
  - ⚫ **Not supported in Notion:** Notion itself does not support this operation in the stated case.
532
536
 
533
- | Property type | Query result | Update row | Filter | Sort |
534
- | ------------------ | --------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
535
- | `title` | 🟢 Plain text | 🟡 Plain text only | 🟢 Supported | 🟢 Supported |
536
- | `rich_text` | 🟢 Plain text | 🟡 Plain text only | 🟢 Supported | 🟢 Supported |
537
- | `number` | 🟢 Number | 🟢 Supported | 🟢 Supported | 🟢 Supported |
538
- | `checkbox` | 🟢 Boolean | 🟢 Supported | 🟢 Supported | 🟢 Supported |
539
- | `url` | 🟢 String | 🟢 Supported | 🟢 Supported | 🟢 Supported |
540
- | `email` | 🟢 String | 🟢 Supported | 🟢 Supported | 🟢 Supported |
541
- | `phone_number` | 🟢 String | 🟢 Supported | 🟢 Supported | 🟢 Supported |
542
- | `select` | 🟢 Option object | 🟡 Set value only | 🟢 Supported | 🔴 Unavailable |
543
- | `multi_select` | 🟢 Array of option objects | 🟡 Set values only | 🟢 Supported | 🔴 Unavailable |
544
- | `status` | 🟢 Option object | 🟡 Set value only | 🟢 Option names, group names, or empty checks | 🔴 Unavailable |
545
- | `date` | 🟢 Date object | 🟡 Minute precision | 🟢 Supported | 🟢 Supported |
546
- | `people` | 🟢 User or group references | 🟢 Supported | 🟢 Supported | 🟢 Native name ordering |
547
- | `files` | 🟡 External files only | 🟡 File URLs only | 🔴 Unavailable | 🔴 Unavailable |
548
- | `unique_id` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
549
- | `relation` | 🟢 Page reference array | 🟡 Replaces value. Rejects `has_more: true`. | 🟢 Supported | 🔴 Unavailable |
550
- | `place` | 🟢 Place object | 🟢 Supported | 🔴 Unavailable | 🔴 Unavailable |
551
- | `formula` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
552
- | `rollup` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable for numeric targets or numeric aggregations. ⚫ Notion cannot sort other rollups. |
553
- | `button` | 🟡 Text fallback | 🔴 Unavailable | ⚫ Not supported in Notion | ⚫ Not supported in Notion |
554
- | `verification` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
555
- | `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. |
556
- | `created_time` | 🟢 Timestamp or null | 🔴 Unavailable | 🔴 Unavailable | 🟡 Schema property only |
557
- | `last_edited_time` | 🟢 Timestamp or null | 🔴 Unavailable | 🔴 Unavailable | 🟡 Schema property only |
558
- | `created_by` | 🟢 Actor reference or null | 🔴 Unavailable | 🟡 Schema-backed creator filters | 🟡 Schema property only |
559
- | `last_edited_by` | 🟢 Actor reference or null | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
537
+ | Property type | Queried page | Filter | Sort |
538
+ | ------------------ | ----------------------------------------- | -------------------------- | -------------------------- |
539
+ | `title` | 🟡 Plain text array | 🟢 Supported | 🟢 Supported |
540
+ | `rich_text` | 🟡 Plain text array | 🟢 Supported | 🟢 Supported |
541
+ | `number` | 🟢 Number | 🟢 Supported | 🟢 Supported |
542
+ | `checkbox` | 🟢 Boolean | 🟢 Supported | 🟢 Supported |
543
+ | `url` | 🟢 String | 🟢 Supported | 🟢 Supported |
544
+ | `email` | 🟢 String | 🟢 Supported | 🟢 Supported |
545
+ | `phone_number` | 🟢 String | 🟢 Supported | 🟢 Supported |
546
+ | `select` | 🟢 Selected option | 🟢 Supported | 🔴 Unavailable |
547
+ | `multi_select` | 🟢 Selected options | 🟢 Supported | 🔴 Unavailable |
548
+ | `status` | 🟢 Selected option | 🟢 Supported | 🔴 Unavailable |
549
+ | `date` | 🟢 `start` and optional `end` strings | 🟡 Minute precision | 🟢 Supported |
550
+ | `people` | 🟢 Array of user or group ID objects | 🟢 Supported | 🟢 Supported |
551
+ | `files` | 🟢 External links and hosted files | 🔴 Unavailable | 🔴 Unavailable |
552
+ | `unique_id` | 🟡 Formatted ID | 🔴 Unavailable | 🔴 Unavailable |
553
+ | `relation` | 🟢 Array of page ID objects | 🟢 Supported | 🔴 Unavailable |
554
+ | `place` | 🟢 Coordinates and optional place details | 🔴 Unavailable | 🔴 Unavailable |
555
+ | `formula` | 🟡 Stored text | 🔴 Unavailable | 🔴 Unavailable |
556
+ | `rollup` | 🟡 Stored text | 🔴 Unavailable | 🔴 Unavailable |
557
+ | `button` | 🟡 Button label | ⚫ Not supported in Notion | ⚫ Not supported in Notion |
558
+ | `verification` | 🟡 Status text | 🔴 Unavailable | 🔴 Unavailable |
559
+ | `created_time` | 🟢 Timestamp | 🟢 Supported | 🟢 Supported |
560
+ | `last_edited_time` | 🟢 Timestamp | 🟢 Supported | 🟢 Supported |
561
+ | `created_by` | 🟢 Actor reference | 🟢 Supported | 🟢 Supported |
562
+ | `last_edited_by` | 🟢 Actor reference | 🟢 Supported | 🟢 Supported |
560
563
 
561
564
  ### Notes
562
565
 
563
- - Query data source results use the Pages API property objects. Narrow each object by its `type`
564
- field.
565
- - Date values use `start` and optional `end`.
566
- - Missing or unsupported properties return `undefined`. Empty supported properties keep their typed
567
- objects.
568
- - Filters and sorts can only reference properties defined in the database schema. For example, to
569
- sort by creation time, you must first add a **Created time** property to the database and
570
- reference that property's ID.
571
- - You can sort by up to 10 unique properties.
572
- - Date-time filter values may include seconds or milliseconds. The Notion host evaluates them at
573
- minute precision. Date filters do not expose end-date targeting.
566
+ - Timestamps are ISO 8601 strings in UTC.
567
+ - Actor references identify who created or last edited the page.
568
+ - Unique IDs return a formatted string, including the data source prefix when available. Missing
569
+ values return `""`.
570
+ - Formula and rollup reads return stored plain text. They do not evaluate formulas or aggregations.
571
+ Missing values return `""`.
572
+ - Button reads return the automation name when readable, or the property name as a fallback.
573
+ - Verification reads return a localized status label, such as "Verified" or "Expired". Missing or
574
+ invalid values return `""`.
575
+ - Files query results include external links and signed URLs for Notion-hosted files.
576
+ - Text values omit formatting, mention tokens, and annotations.
577
+ - People properties return references with `object: "user"` or `object: "group"` and an `id`. Group
578
+ IDs use the composite form `groupId|workspaceId`.
579
+ - Date filters support comparisons, relative ranges, and start or end dates. They accept seconds and
580
+ milliseconds but compare values at minute precision.
581
+ - Select, multi-select, and status query values contain option names and colors when available, and
582
+ IDs when matched to the schema.
583
+ - Query results use typed property objects. Narrow each object by its `type` field.
584
+ - Filters and sorts reference properties in the data source schema. Top-level metadata IDs do not
585
+ identify schema properties.
586
+ - You can sort by up to 10 unique properties. People sorts use native name ordering.
574
587
  - Status group filters use stored English group names. The SDK does not normalize localized names.
575
588
  - `group_equals` matches any listed group. `group_does_not_equal` excludes all listed groups.
576
589
  - Empty group arrays and unknown group names return a nonretryable query error.
577
- - People properties contain arrays of user or group references in `people`. Group IDs use
578
- `groupId|workspaceId`.
579
- - Creator filters require an actual **Created by** column. Use its bound key or property ID, not the
580
- synthetic `created_by` metadata ID.
581
590
  - Filters accept one condition or an `and` group of up to 25 conditions. The SDK does not support
582
591
  `or` or nested groups.
583
- - Select, multi-select, and status values contain option objects. Writes do not edit option
584
- definitions or colors.
585
592
 
586
593
  ### Writing values
587
594
 
@@ -592,7 +599,7 @@ const property = item.getPropertyByKey("status")
592
599
  const name = property?.type === "status" ? property.status?.name : undefined
593
600
  ```
594
601
 
595
- Write inputs remain unchanged. Here, `status` is a declared property key:
602
+ Use a declared property key to update a value:
596
603
 
597
604
  ```ts
598
605
  const result = await item.updateByKey({
@@ -606,15 +613,7 @@ if (result.status === "error") {
606
613
  }
607
614
  ```
608
615
 
609
- Other write restrictions:
610
-
611
- - **Text:** Title and rich text writes preserve plain text, but not formatting or mentions.
612
- - **Files:** Supply external or existing hosted file URLs. The host stores them as links and does
613
- not support upload references.
614
- - **Relations:** Supply the complete replacement list of related pages. The host rejects
615
- `has_more: true`, which indicates an incomplete list.
616
-
617
- See [Pages property support](pages.md#property-support) for the page-property read shapes.
616
+ See [Pages property support](pages.md#property-support) for write support and restrictions.
618
617
 
619
618
  ## Types
620
619
 
@@ -638,12 +637,11 @@ See [Pages property support](pages.md#property-support) for the page-property re
638
637
  - `NotionDataSourceTextFilterOperator`, `NotionDataSourceNumberFilterOperator`,
639
638
  `NotionDataSourceCheckboxFilterOperator`, `NotionDataSourceOptionFilterOperator`,
640
639
  `NotionDataSourceStatusFilterOperator`, `NotionDataSourceContainsFilterOperator`,
641
- `NotionDataSourceDateFilterOperator`, `NotionDataSourcePeopleFilterOperator`,
642
- `NotionDataSourceRelationFilterOperator`, and `NotionDataSourceCreatedByFilterOperator` — the
643
- operators accepted for each property type.
640
+ `NotionDataSourceDateFilterOperator`, `NotionDataSourcePeopleFilterOperator`, and
641
+ `NotionDataSourceRelationFilterOperator` — the operators accepted for each property type.
644
642
  - `NotionDataSourcePersonFilterValue` — an explicit `{ object: "user" | "group", id }` reference
645
643
  used by a people filter.
646
- - `DataSourceSnapshot` — current rows, schema, and status for one live data-source query.
644
+ - `DataSourceSnapshot` — current rows, schema, and status for one live data source query.
647
645
  - `DataSourceQueryOptions` — the row limit, filter, sorts, and archive behavior shared by both query
648
646
  APIs.
649
647
  - `SubscribeToDataSourceArgs` — the key, `onSnapshot` listener, and optional query options for
@@ -665,7 +663,7 @@ See [Pages property support](pages.md#property-support) for the page-property re
665
663
 
666
664
  ### Database schema & pointers
667
665
 
668
- - `NotionCollectionSchema` — host-supplied schema for the bound database, including raw property
666
+ - `NotionDataSourceSchema` — host-supplied schema for the bound database, including raw property
669
667
  schemas.
670
668
  - `NotionRecordPointer` — `{ id, table }`. Generic reference to any Notion record (page, block,
671
669
  database row). Exported for convenience; `useDataSource` and the `pages` API don't take one as
@@ -38,10 +38,9 @@ regenerate the injected metadata, then reload the block. Block source files hot
38
38
 
39
39
  ## Types
40
40
 
41
- - `NotionCustomBlockManifest` — the parsed shape of a block manifest. `CustomBlockManifest` is a
42
- deprecated alias.
43
- - `ManifestDataSource` — a single entry in `dataSources`.
44
- - `ManifestProperty` — a single property declaration inside a `ManifestDataSource`.
45
- - `ManifestIcon` — the icon variant accepted on a `ManifestDataSource`.
41
+ - `NotionCustomBlockManifest` — the parsed shape of a block manifest.
42
+ - `NotionManifestDataSource` — a single entry in `dataSources`.
43
+ - `NotionManifestProperty` — a single property declaration inside a `NotionManifestDataSource`.
44
+ - `NotionManifestIcon` — the icon variant accepted on a `NotionManifestDataSource`.
46
45
 
47
46
  For the Node.js build and upload API, see the [build-tool reference](build-tools.md).