@notionhq/custom-blocks 0.3.2 → 0.3.4

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 (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -19
  3. package/dist/bridge/SandboxBridge.d.ts +0 -2
  4. package/dist/bridge/SandboxBridge.d.ts.map +1 -1
  5. package/dist/bridge/SandboxBridge.js +16 -39
  6. package/dist/bridge/SandboxInitialization.d.ts +1 -3
  7. package/dist/bridge/SandboxInitialization.d.ts.map +1 -1
  8. package/dist/bridge/SandboxInitialization.js +13 -15
  9. package/dist/bridge/appearance.d.ts +2 -10
  10. package/dist/bridge/appearance.d.ts.map +1 -1
  11. package/dist/bridge/appearance.js +2 -10
  12. package/dist/bridge/dataSources/query.d.ts +1 -2
  13. package/dist/bridge/dataSources/query.d.ts.map +1 -1
  14. package/dist/bridge/dataSources/query.js +15 -398
  15. package/dist/bridge/dataSources/queryFilter.d.ts +10 -0
  16. package/dist/bridge/dataSources/queryFilter.d.ts.map +1 -0
  17. package/dist/bridge/dataSources/queryFilter.js +123 -0
  18. package/dist/bridge/dataSources/resolveProperty.d.ts +1 -20
  19. package/dist/bridge/dataSources/resolveProperty.d.ts.map +1 -1
  20. package/dist/bridge/dataSources/resolveProperty.js +37 -32
  21. package/dist/bridge/dataSources/resolvePropertyAddress.d.ts +10 -0
  22. package/dist/bridge/dataSources/resolvePropertyAddress.d.ts.map +1 -0
  23. package/dist/bridge/dataSources/resolvePropertyAddress.js +55 -0
  24. package/dist/bridge/dataSources/resolveSorts.d.ts +10 -0
  25. package/dist/bridge/dataSources/resolveSorts.d.ts.map +1 -0
  26. package/dist/bridge/dataSources/resolveSorts.js +80 -0
  27. package/dist/bridge/hostState.d.ts +3 -7
  28. package/dist/bridge/hostState.d.ts.map +1 -1
  29. package/dist/bridge/hostState.js +0 -24
  30. package/dist/bridge/page.d.ts +9 -3
  31. package/dist/bridge/page.d.ts.map +1 -1
  32. package/dist/bridge/page.js +19 -2
  33. package/dist/bridge/readLocalManifest.d.ts +23 -0
  34. package/dist/bridge/readLocalManifest.d.ts.map +1 -0
  35. package/dist/bridge/readLocalManifest.js +46 -0
  36. package/dist/bridge/sandboxClient.d.ts +0 -2
  37. package/dist/bridge/sandboxClient.d.ts.map +1 -1
  38. package/dist/bridge/sandboxClient.js +50 -24
  39. package/dist/protocol/dataSources/dataSourcePage.d.ts +3 -4
  40. package/dist/protocol/dataSources/dataSourcePage.js +2 -3
  41. package/dist/protocol/index.d.ts +1 -0
  42. package/dist/protocol/index.js +1 -0
  43. package/dist/protocol/isLocalBlockServerUrl.d.ts +2 -0
  44. package/dist/protocol/isLocalBlockServerUrl.js +9 -0
  45. package/dist/protocol/messages/connect.d.ts +2 -2
  46. package/dist/protocol/messages/connect.js +2 -2
  47. package/dist/protocol/messages/createPage.d.ts +1 -1
  48. package/dist/protocol/messages/createPage.js +1 -1
  49. package/dist/protocol/messages/createPageResult.d.ts +3 -3
  50. package/dist/protocol/messages/createPageResult.js +4 -4
  51. package/dist/protocol/messages/getPage.d.ts +2 -2
  52. package/dist/protocol/messages/getPage.js +4 -4
  53. package/dist/protocol/messages/hostToSandbox.d.ts +3 -3
  54. package/dist/protocol/messages/hostToSandbox.js +10 -10
  55. package/dist/protocol/messages/init.d.ts +1 -1
  56. package/dist/protocol/messages/queryDataSource.d.ts +24 -0
  57. package/dist/protocol/messages/queryDataSource.js +2 -0
  58. package/dist/protocol/messages/queryDataSourceResult.d.ts +3 -3
  59. package/dist/protocol/messages/queryDataSourceResult.js +5 -5
  60. package/dist/protocol/messages/sandboxToHost.d.ts +8 -0
  61. package/dist/protocol/messages/updatePageResult.d.ts +3 -3
  62. package/dist/protocol/messages/updatePageResult.js +4 -4
  63. package/dist/protocol/pages/page.d.ts +4 -4
  64. package/dist/protocol/pages/page.js +2 -2
  65. package/dist/protocol/parent.d.ts +1 -1
  66. package/dist/protocol/protocolVersion.d.ts +3 -2
  67. package/dist/protocol/protocolVersion.js +4 -2
  68. package/dist/react/useDataSource.d.ts +2 -2
  69. package/dist/react/useDataSource.js +2 -2
  70. package/dist/types.d.ts +5 -5
  71. package/dist/types.d.ts.map +1 -1
  72. package/dist/version.js +1 -1
  73. package/docs/block-location.md +6 -4
  74. package/docs/bridge-interceptors.md +4 -0
  75. package/docs/build-tools.md +58 -0
  76. package/docs/data-sources.md +24 -18
  77. package/docs/deployment.md +23 -36
  78. package/docs/errors.md +75 -52
  79. package/docs/lifecycle.md +10 -3
  80. package/docs/pages.md +84 -76
  81. package/docs/users.md +4 -4
  82. package/package.json +4 -19
  83. package/src/bridge/SandboxBridge.ts +18 -48
  84. package/src/bridge/SandboxInitialization.ts +14 -20
  85. package/src/bridge/appearance.ts +2 -10
  86. package/src/bridge/dataSources/query.ts +17 -530
  87. package/src/bridge/dataSources/queryFilter.ts +181 -0
  88. package/src/bridge/dataSources/resolveProperty.ts +48 -39
  89. package/src/bridge/dataSources/resolvePropertyAddress.ts +62 -0
  90. package/src/bridge/dataSources/resolveSorts.ts +107 -0
  91. package/src/bridge/hostState.ts +3 -43
  92. package/src/bridge/page.ts +28 -4
  93. package/src/bridge/readLocalManifest.ts +60 -0
  94. package/src/bridge/sandboxClient.ts +63 -38
  95. package/src/react/useDataSource.ts +2 -2
  96. package/src/types.ts +5 -5
  97. package/dist/bridge/loadManifest.d.ts +0 -21
  98. package/dist/bridge/loadManifest.d.ts.map +0 -1
  99. package/dist/bridge/loadManifest.js +0 -85
  100. package/src/bridge/loadManifest.ts +0 -114
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAA;AACxG,OAAO,KAAK,EACX,kBAAkB,EAClB,YAAY,EACZ,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yDAAyD,CAAA;AACvG,OAAO,KAAK,E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BAAoB,GAAG,sBAAsB,CAAA;AAEzD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,gBAAgB,GACzB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,cAAc,EAAE,kBAAkB,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3C;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,MAAM,EAAE,gBAAgB,CAAA;IACxB,UAAU,EAAE,0BAA0B,CAAA;IACtC,QAAQ,CAAC,EAAE,wBAAwB,CAAA;CACnC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,YAAY,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAChD,qBAAqB,EACrB,4BAA4B,CAC5B,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,CACvD,4BAA4B,EAC5B,mCAAmC,CACnC,CAAA;AAED,MAAM,MAAM,gBAAgB,GACzB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GACvC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,8BAA8B,CAAA;CAAE,CAAA;AAE7D,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
@@ -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.3.2"
7
+ export const CUSTOM_BLOCKS_SDK_VERSION = "0.3.4"
@@ -1,7 +1,9 @@
1
1
  # Block location and appearance
2
2
 
3
- Block and app context describes where the block runs and the host's appearance. Use getters for
4
- current values, subscriptions for initial values and later changes, or React hooks in components.
3
+ Host context includes the block's location, current user, manifest, theme, and contrast mode. These
4
+ APIs let your block respond to its context and match Notion's appearance. This reference covers
5
+ getters for current values, subscriptions for initial values and later changes, and React hooks for
6
+ components.
5
7
 
6
8
  ## API overview
7
9
 
@@ -51,7 +53,7 @@ console.log(customBlock.getTheme()) // Read the current theme once.
51
53
  ## Current user
52
54
 
53
55
  Use `getCurrentUser()`, `subscribeToCurrentUser()`, and `useCurrentUser()` to access the viewing
54
- user's `NotionUser`. See [users](./users.md#reading-the-current-user) for profile fields and user
56
+ user's `NotionUser`. See [users](users.md#reading-the-current-user) for profile fields and user
55
57
  APIs.
56
58
 
57
59
  ## Custom block ID
@@ -171,5 +173,5 @@ Use `getManifest()`, `subscribeToManifest()`, and `useManifest()` to access the
171
173
  `CustomBlockManifest`. The manifest stays fixed for the lifetime of the running block, so each
172
174
  subscription delivers it once. You can register before initialization without an error.
173
175
 
174
- See [data sources](./data-sources.md) for manifest details and `subscribeToDataSource()` for query
176
+ See [data sources](data-sources.md) for manifest details and `subscribeToDataSource()` for query
175
177
  snapshots.
@@ -1,5 +1,9 @@
1
1
  # Bridge message interceptors
2
2
 
3
+ Bridge message interceptors inspect outgoing SDK requests or supply responses without a host round
4
+ trip. This reference describes registration, response matching, and cleanup for controlled bridge
5
+ integrations.
6
+
3
7
  Import `registerMessageInterceptor` from `@notionhq/custom-blocks/bridge` to inspect or replace SDK
4
8
  messages sent to the host. The function accepts a `MessageInterceptor` and returns a function that
5
9
  removes it.
@@ -0,0 +1,58 @@
1
+ # Build-tool reference
2
+
3
+ The `@notionhq/custom-blocks/bundle` entrypoint exposes Node.js functions for deployment tools. It
4
+ provides build and upload operations. Worker projects normally use `ntn workers deploy`.
5
+
6
+ The Apps CLI calls `build` and `upload` from `build-blocks` and `upload-blocks`, respectively.
7
+
8
+ ```ts
9
+ import { build, upload } from "@notionhq/custom-blocks/bundle"
10
+ ```
11
+
12
+ ## Build bundles
13
+
14
+ `build(args: BuildArgs)` returns a `Promise<BuildOutput>`. By default, it imports the worker bundle
15
+ at `dist/index.js` and reads its custom block capabilities. With `manifest`, it reads an Apps SDK
16
+ capability manifest from a JSON file instead. That file contains a `capabilities` array. Each custom
17
+ block capability contains its block manifest in `config.manifest`.
18
+
19
+ `BuildArgs` contains these fields:
20
+
21
+ - `out`: Required output directory. Each block's bundle is copied to `<out>/<key>`.
22
+ - `cwd`: Optional project root. Defaults to the process's current directory.
23
+ - `manifest`: Optional path to the Apps SDK capability manifest.
24
+
25
+ Relative `out`, `manifest`, and block source paths resolve from the project root. For a project
26
+ source, `build` installs dependencies, runs the configured build command, and copies its output. For
27
+ a static source, `build` copies the source directory without a build command.
28
+
29
+ `BuildOutput.blocks` is an array of `BuiltBlock` results. Each result contains the block's `key`,
30
+ `bundleDir`, `checksumCrc32`, and `bundleSizeBytes`. The size is the compressed tarball's byte
31
+ length. When the worker or capability manifest declares no custom blocks, `blocks` is empty.
32
+
33
+ The equivalent CLI command is `notion-custom-blocks build --out <dir>`. It accepts `--cwd` and
34
+ `--manifest` with the same path rules. `printBuildOutput` writes a `BuildOutput` as single-line JSON
35
+ between `<__notion_custom_block__>` and `</__notion_custom_block__>`.
36
+
37
+ For dependency placement, see
38
+ [Browser and server dependencies](deployment.md#browser-and-server-dependencies).
39
+
40
+ ## Upload bundles
41
+
42
+ `upload(targets: UploadsInput)` returns a `Promise<UploadOutput>`. `UploadsInput` maps block keys to
43
+ `UploadTarget` objects with these fields:
44
+
45
+ - `uploadUrl`: Required presigned upload URL.
46
+ - `bundleDir`: Required path to the bundle directory.
47
+ - `headers`: Optional map of headers supplied with the presigned URL, such as `Content-Length` and
48
+ object tags.
49
+
50
+ `upload` compresses each directory and sends the tarball with an HTTP PUT request. It forwards the
51
+ supplied headers and sets `Content-Type` to `application/gzip` and `x-amz-checksum-crc32` to the
52
+ archive's checksum. Relative `bundleDir` paths resolve from the process's current directory.
53
+
54
+ On success, `UploadOutput.uploaded` maps every uploaded block key to `true`. A failed upload throws
55
+ an error and stops the remaining uploads. Earlier uploads are not rolled back.
56
+
57
+ The equivalent CLI command is `notion-custom-blocks upload --uploads '<json>'`. `parseUploadsInput`
58
+ parses and validates that JSON as `UploadsInput`.
@@ -10,8 +10,8 @@ Each snapshot contains `items`, `propertyIdsByKey`, `isLoading`, and `hasMore`.
10
10
  replaces the previous rows in the snapshot. Subscriptions remain independent, even when they query
11
11
  the same data source.
12
12
 
13
- Queries default to 20 rows and support up to 999. See [Known limitations](#known-limitations) for
14
- pagination, filter, and sort restrictions.
13
+ Queries default to 20 rows. The host enforces the maximum row limit. See
14
+ [Known limitations](#known-limitations) for pagination, filter, and sort restrictions.
15
15
 
16
16
  ## Bind a data source
17
17
 
@@ -161,9 +161,10 @@ time** column. Use the column's bound key or actual property ID.
161
161
 
162
162
  ### Row limits
163
163
 
164
- `limit` defaults to 20 and must be a positive integer. The SDK caps values above 999. Each query
165
- reads from the start of the matching rows. A larger limit replaces the previous snapshot with a
166
- larger result.
164
+ `limit` defaults to 20 and must be a positive safe integer. The SDK forwards the requested limit
165
+ without capping it. The Notion host currently supports up to 1,000 rows and rejects larger requests
166
+ with an error that states the maximum. Each query reads from the start of the matching rows. A
167
+ larger limit replaces the previous snapshot with a larger result.
167
168
 
168
169
  `hasMore` indicates that more matching rows exist beyond the result. It does not provide a cursor or
169
170
  guarantee that increasing the limit can retrieve every row.
@@ -242,7 +243,7 @@ the filter type, not the column.
242
243
  | `multi_select` | `contains`, `contains_all`, `does_not_contain`, `is_empty`, `is_not_empty` |
243
244
  | `date` | `equals`, `before`, `after`, `on_or_before`, `on_or_after`, relative ranges, `is_empty`, `is_not_empty` |
244
245
  | `people` | `contains`, `does_not_contain`, `is_empty`, `is_not_empty` |
245
- | `relation` | `contains`, `does_not_contain` |
246
+ | `relation` | `contains`, `does_not_contain`, `is_empty`, `is_not_empty` |
246
247
  | `created_by` | `contains`, `does_not_contain`, `is_empty`, `is_not_empty` |
247
248
 
248
249
  - Select, multi-select, and status filters accept one option name or an array of option names.
@@ -257,9 +258,9 @@ the filter type, not the column.
257
258
  - Creator filters accept one explicit human user reference. Groups, bots, and organization bots are
258
259
  not supported as filter references. `does_not_contain` also matches rows with non-human or missing
259
260
  creators. Empty checks test whether creator metadata is missing.
260
- - Relation filters accept one page ID in dashed or undashed UUID format.
261
- - Relation `does_not_contain` includes empty relations. Empty checks and multiple targets are
262
- unsupported.
261
+ - Relation membership filters accept one page ID in dashed or undashed UUID format.
262
+ - Relation `does_not_contain` returns rows that do not reference the specified page. Rows with no
263
+ related pages also match. Multiple targets are unsupported.
263
264
 
264
265
  ```ts
265
266
  filter: {
@@ -388,7 +389,9 @@ await row.updateByKey({
388
389
  Use `updateByKey` for manifest keys and `updateById` for raw property IDs. The SDK resolves manifest
389
390
  keys before sending the request.
390
391
 
391
- Read a page through `pages.get(pageId)` before calling its instance methods.
392
+ Pages returned by `dataSources.getPage`, `dataSources.query`, and `dataSources.create` support
393
+ property writes through `updateByKey`. Pages returned by `pages.get` and `pages.create` support
394
+ property writes through `updateById`.
392
395
 
393
396
  ### Archiving and unarchiving a row
394
397
 
@@ -425,7 +428,7 @@ function customBlock.getManifest(): CustomBlockManifest;
425
428
 
426
429
  Framework-neutral getter for the same manifest returned by `useManifest()`.
427
430
  `customBlock.subscribeToManifest(callback)` follows the
428
- [context subscription contract](./block-location.md#reading-values-and-following-changes). The
431
+ [context subscription contract](block-location.md#reading-values-and-following-changes). The
429
432
  manifest stays fixed for the lifetime of the running block, so each subscription delivers it once.
430
433
  You can register before initialization without an error.
431
434
 
@@ -473,10 +476,10 @@ export function ScoreList() {
473
476
  )
474
477
  })}
475
478
  </ul>
476
- {hasMore && limit < 999 ? (
479
+ {hasMore && limit < 1000 ? (
477
480
  <button
478
481
  type="button"
479
- onClick={() => setLimit(Math.min(limit + 20, 999))}
482
+ onClick={() => setLimit(Math.min(limit + 20, 1000))}
480
483
  disabled={isLoading}
481
484
  >
482
485
  {isLoading ? "Loading…" : "Load more"}
@@ -489,9 +492,12 @@ export function ScoreList() {
489
492
 
490
493
  ## Known limitations
491
494
 
492
- - **Row limits and pagination:** `limit` defaults to 20 and is capped at 999. Queries have no cursor
493
- or offset. Increasing the limit repeats the query from the start and replaces the snapshot.
494
- `hasMore` can remain true at the cap, so use filters to narrow larger data sources.
495
+ - **Row limits and pagination:** Hosts enforce their own limits. The Notion app supports up to 32
496
+ active subscriptions per custom block, each with up to 1,000 rows. Requests that exceed either
497
+ limit return an error. Queries have no cursor or offset. Increasing `limit` replaces the snapshot
498
+ with a larger result from the start of the matching rows. If `hasMore` is true, increase `limit`
499
+ up to 1,000 or use filters to query smaller subsets. Unsubscribe from queries you no longer need
500
+ to free subscription slots.
495
501
  - **Filter and sort rules:** Use one property condition or one `and` group with up to 25 conditions.
496
502
  Nested groups and `or` are unsupported. You can sort by up to 10 unique properties. Empty values
497
503
  sort last in both directions. See the table below for property support and [Filters](#filters) for
@@ -534,7 +540,7 @@ refer to the core values inside each property object. For example, “Number”
534
540
  | `people` | 🟢 User or group references | 🟢 Supported | 🟢 Supported | 🟢 Native name ordering |
535
541
  | `files` | 🟡 External files only | 🟡 File URLs only | 🔴 Unavailable | 🔴 Unavailable |
536
542
  | `unique_id` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
537
- | `relation` | 🟢 Page reference array | 🟡 Replaces value. Rejects `has_more: true`. | 🟢 Supported | 🔴 Unavailable for standard relations. ⚫ Notion cannot sort XLDB targets. |
543
+ | `relation` | 🟢 Page reference array | 🟡 Replaces value. Rejects `has_more: true`. | 🟢 Supported | 🔴 Unavailable |
538
544
  | `place` | 🟢 Place object | 🟢 Supported | 🔴 Unavailable | 🔴 Unavailable |
539
545
  | `formula` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable |
540
546
  | `rollup` | 🟡 Text fallback | 🔴 Unavailable | 🔴 Unavailable | 🔴 Unavailable for numeric targets or numeric aggregations. ⚫ Notion cannot sort other rollups. |
@@ -603,7 +609,7 @@ Other write restrictions:
603
609
  - **Relations:** Supply the complete replacement list of related pages. The host rejects
604
610
  `has_more: true`, which indicates an incomplete list.
605
611
 
606
- See [Pages property support](./pages.md#property-support) for the page-property read shapes.
612
+ See [Pages property support](pages.md#property-support) for the page-property read shapes.
607
613
 
608
614
  ## Types
609
615
 
@@ -1,9 +1,9 @@
1
1
  # Deployment and manifests
2
2
 
3
- A custom block is a static web bundle — an `index.html` plus optional assets — that Notion loads
4
- into a sandboxed `<iframe>`. Custom blocks ship as part of a worker: declare the block source and
5
- data source schema with `worker.customBlock(...)` in the worker's `src/index.ts`, deploy with
6
- `ntn workers deploy`, and Notion serves the built bundle.
3
+ A custom block is a static web bundle containing an `index.html` file and optional assets. Notion
4
+ loads the bundle into a sandboxed `<iframe>`. Custom blocks ship as part of a worker. Declare the
5
+ block source and data source schema with `worker.customBlock(...)` in the worker's `src/index.ts`.
6
+ Deploy with `ntn workers deploy`. Notion then serves the built bundle.
7
7
 
8
8
  A custom block manifest describes the data sources a block requires, including their semantic keys,
9
9
  display metadata, and property schemas. The block's `worker.customBlock(...)` declaration is the
@@ -11,20 +11,30 @@ manifest's single source of truth:
11
11
 
12
12
  - **Deployed** — deploying persists the manifest on the block's definition record in Notion. The
13
13
  host reads it from there and sends it to the SDK during initialization.
14
- - **Local development** — the dev shell extracts the same worker declaration at runtime and serves
15
- the selected block's manifest dynamically at `/manifest`.
14
+ - **Local development** — dev tooling extracts the same worker declaration and injects it into the
15
+ block HTML as a JSON script with ID `notion-custom-block-manifest` and type `application/json`.
16
+ The SDK reads the manifest from this metadata and sends it in `connect`.
16
17
 
17
18
  Notion reconciles custom block definitions by their Worker capability keys during deployment.
18
19
 
20
+ ## Browser and server dependencies
21
+
22
+ Put packages used only by the custom block frontend, such as React and the custom blocks SDK, in
23
+ `devDependencies` in the Worker's root `package.json`. The frontend build includes their code in the
24
+ browser assets, so their package files do not need to ship with the Worker.
25
+
26
+ Keep packages that the Worker's server code imports in `dependencies`.
27
+
19
28
  ## Local development
20
29
 
21
- Run `ntn workers customblocks dev` from a worker. It builds the worker, extracts its custom block
22
- declarations, starts one localhost Vite server per block, and renders them in the mock host at
23
- http://localhost:9873.
30
+ Run `ntn workers customblocks dev` from your worker project. The dev shell builds the worker and
31
+ reads its custom block declarations. It serves the shell and blocks on one port, with a separate
32
+ localhost subdomain for each block. Open the shell URL printed by the command. The default port is
33
+ `9873`; the launcher selects another port when needed. Vite provides source transforms and hot
34
+ reload.
24
35
 
25
- At startup, the SDK fetches the page-relative `manifest` path only when the bundle's hostname is
26
- exactly `localhost`, then forwards the response in `connect`. On every other hostname, the SDK skips
27
- this fetch and relies on the host-provided manifest from `init`.
36
+ Worker declarations are read when the dev shell starts. Restart it after changing a declaration to
37
+ regenerate the injected metadata, then reload the block. Block source files hot reload.
28
38
 
29
39
  ## Types
30
40
 
@@ -33,27 +43,4 @@ this fetch and relies on the host-provided manifest from `init`.
33
43
  - `ManifestProperty` — a single property declaration inside a `ManifestDataSource`.
34
44
  - `ManifestIcon` — the icon variant accepted on a `ManifestDataSource`.
35
45
 
36
- ## Apps SDK integration
37
-
38
- `notion-custom-blocks build --manifest dist/manifest.json --out <dir>` reads static Apps SDK
39
- capabilities. Paths in the manifest stay relative to the project root (the current directory, or
40
- `--cwd`). Without `--manifest`, the command continues to import the Workers SDK bundle at
41
- `dist/index.js`.
42
-
43
- Node build tools use one entrypoint:
44
-
45
- ```ts
46
- import { build, upload } from "@notionhq/custom-blocks/bundle"
47
- ```
48
-
49
- `build` accepts `BuildArgs` and returns `BuildOutput` containing `BuiltBlock` results. `upload`
50
- accepts `UploadsInput`, a map of block keys to `UploadTarget`, and returns `UploadOutput`.
51
- `printBuildOutput` writes the sentinel-wrapped build result; `parseUploadsInput` validates JSON
52
- upload arguments. The Apps CLI calls these functions from `build-blocks` and `upload-blocks`.
53
-
54
- Relative `--out` paths also resolve from `--cwd`. Build results include `bundleSizeBytes`, the exact
55
- compressed tarball length, for size-bound uploads.
56
-
57
- Upload targets may include a `headers` map containing the headers returned by the server presign,
58
- including `Content-Length` and object tags. The uploader forwards these alongside the tarball
59
- checksum and content type.
46
+ For the Node.js build and upload API, see the [build-tool reference](build-tools.md).
package/docs/errors.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # Error handling
2
2
 
3
- Pages reads, Pages creates, and asynchronous data source methods return discriminated results.
4
- Success returns `{ status: "success", page }` or query data. Failure returns
5
- `{ status: "error", error }`.
3
+ SDK operations report failures through result objects, initialization failures, or subscription
4
+ state. This reference describes each error surface, the error payload, and known codes so your block
5
+ can display failures and decide when to retry.
6
6
 
7
- Page instance mutations, navigation, and Users methods also retain their result envelopes.
8
- Initialization still rejects on failure. Hooks and subscriptions keep their existing error behavior.
7
+ Pages, Users, navigation, and asynchronous Data sources methods return a result with a `status`
8
+ field. Success returns `{ status: "success", ... }` with the requested data. Failure returns
9
+ `{ status: "error", error }`. Initialization rejects on failure. Hooks and subscriptions report
10
+ errors separately.
9
11
 
10
12
  ## Error format
11
13
 
@@ -19,75 +21,96 @@ type CustomBlockErrorInfo<TCode extends string = string> = {
19
21
  }
20
22
  ```
21
23
 
22
- - `code` is a stable identifier intended for application logic.
23
- - `message` provides developer-facing details and is not a stable identifier.
24
- - `isRetryable` indicates whether repeating the operation could succeed without changes to the
25
- request or its configuration. A `false` value does not prevent recovery after you correct the
26
- query, schema, or bindings.
24
+ - `code` is a stable identifier for application logic.
25
+ - `message` provides details for developers. Its text can change.
26
+ - `isRetryable` indicates whether the operation could succeed if repeated without changes to the
27
+ request or configuration. A `false` value does not rule out success after you fix the query,
28
+ schema, or bindings.
27
29
 
28
- Each API narrows `code` to its own open string union. The known literals provide autocomplete, but
29
- newer hosts may send codes that an older SDK does not list.
30
+ Each API defines known `code` values for autocomplete and accepts other strings. This lets older
31
+ SDKs receive new codes from newer hosts.
30
32
 
31
33
  ## API-specific error types
32
34
 
33
- - Pages: `CustomBlockCreatePageErrorCode` / `CustomBlockCreatePageErrorInfo`,
34
- `CustomBlockGetPageErrorCode` / `CustomBlockGetPageErrorInfo`, `CustomBlockOpenPageErrorCode` /
35
- `CustomBlockOpenPageErrorInfo`, and `CustomBlockUpdatePageErrorCode` /
36
- `CustomBlockUpdatePageErrorInfo`.
37
- - Users: `CustomBlockGetUserErrorCode` / `CustomBlockGetUserErrorInfo` and
38
- `CustomBlockListUsersErrorCode` / `CustomBlockListUsersErrorInfo`.
39
- - External links: `CustomBlockOpenExternalUrlErrorCode` / `CustomBlockOpenExternalUrlErrorInfo`.
40
- - Data sources: `CustomBlockQueryDataSourceErrorCode` / `CustomBlockQueryDataSourceErrorInfo`.
41
- - Shared resolution failures: `CustomBlockPropertyErrorCode` / `CustomBlockPropertyErrorInfo` and
42
- `CustomBlockDataSourceResolutionErrorCode` / `CustomBlockDataSourceResolutionErrorInfo`.
35
+ Each operation has an error code type and an error info type:
36
+
37
+ | Operation | Code type | Info type |
38
+ | ------------------- | ------------------------------------------ | ------------------------------------------ |
39
+ | Create page | `CustomBlockCreatePageErrorCode` | `CustomBlockCreatePageErrorInfo` |
40
+ | Get page | `CustomBlockGetPageErrorCode` | `CustomBlockGetPageErrorInfo` |
41
+ | Open page | `CustomBlockOpenPageErrorCode` | `CustomBlockOpenPageErrorInfo` |
42
+ | Update page | `CustomBlockUpdatePageErrorCode` | `CustomBlockUpdatePageErrorInfo` |
43
+ | Get user | `CustomBlockGetUserErrorCode` | `CustomBlockGetUserErrorInfo` |
44
+ | List users | `CustomBlockListUsersErrorCode` | `CustomBlockListUsersErrorInfo` |
45
+ | Open external URL | `CustomBlockOpenExternalUrlErrorCode` | `CustomBlockOpenExternalUrlErrorInfo` |
46
+ | Query data source | `CustomBlockQueryDataSourceErrorCode` | `CustomBlockQueryDataSourceErrorInfo` |
47
+ | Resolve property | `CustomBlockPropertyErrorCode` | `CustomBlockPropertyErrorInfo` |
48
+ | Resolve data source | `CustomBlockDataSourceResolutionErrorCode` | `CustomBlockDataSourceResolutionErrorInfo` |
49
+
50
+ ## Local page update errors
51
+
52
+ The SDK validates all properties before sending an update. These local errors have
53
+ `isRetryable: false`:
54
+
55
+ | Code | Cause |
56
+ | ------------------------ | ------------------------------------------------------------------------------ |
57
+ | `invalid_page_update` | No properties, icon, cover, or archive change. |
58
+ | `invalid_property_value` | Malformed property map or value. |
59
+ | `unmapped_property` | Missing data source context, an invalid or unbound key, or a missing property. |
60
+ | `property_id_mismatch` | A supplied value ID differs from the resolved raw property ID. |
61
+ | `duplicate_property` | Multiple keys resolve to the same raw property ID. |
43
62
 
44
63
  ## Data source errors
45
64
 
46
- - `data_source_schema_unavailable`: The query uses filters or sorts, but the host did not provide
47
- the database schema. SDK and generic host validation use this code. Queries without filters or
48
- sorts can continue without a schema.
65
+ - `data_source_access_failed`: A page create or update operation cannot use its data source because
66
+ the data source is unavailable, lacks workspace information, or does not allow the operation.
67
+
68
+ - `data_source_query_invalid_limit`: The row limit is not a positive safe integer or exceeds the
69
+ host maximum. The error message states the maximum when the host rejects an oversized request.
70
+
71
+ - `data_source_schema_unavailable`: A query uses filters or sorts, but the host did not provide the
72
+ database schema. Both the SDK and the generic host use this code. Queries without filters or sorts
73
+ can run without a schema.
49
74
  - `unmapped_data_source`: The data source has no database binding.
50
75
  - `invalid_data_source_query_filter`: The host rejects a filter because its property ID or condition
51
76
  does not match the database schema.
52
77
  - `invalid_data_source_query_sort`: The host rejects a sort, for example, because its property ID is
53
78
  unknown, its property type is unsupported, or the query repeats a sort property.
54
79
 
55
- `useDataSource` exposes query failures as `error` and sets `isLoading` to `false`. It retains the
56
- last successful rows for the same query. A later snapshot clears the error. Framework-neutral
57
- subscriptions report failures through their optional error callback.
80
+ On query failure, `useDataSource` sets `error` and `isLoading: false`, keeping the last successful
81
+ rows for that query. A later snapshot clears the error. Framework-neutral subscriptions report
82
+ failures through their optional error callback.
58
83
 
59
- Data source subscriptions repeat the query when the host supplies a changed schema or binding. This
60
- recovery does not depend on `isRetryable`.
84
+ When the host supplies a changed schema or binding, data source subscriptions repeat the query
85
+ regardless of `isRetryable`.
61
86
 
62
87
  ## Initialization errors
63
88
 
64
- `initCustomBlock` rejects with `CustomBlockInitializationError`. Its `code` type is
65
- `CustomBlockInitializationErrorCode`, which covers failures reported by either side of the handshake
66
- plus SDK-local iframe errors.
89
+ `initCustomBlock` rejects with `CustomBlockInitializationError`. Its
90
+ `CustomBlockInitializationErrorCode` covers handshake failures from the SDK or host, plus local
91
+ iframe errors.
67
92
 
68
- `CustomBlockInitializationErrorInfo` is the matching `{ code, message, isRetryable }` object type.
93
+ `CustomBlockInitializationErrorInfo` describes the `{ code, message, isRetryable }` object.
69
94
 
70
- Initialization errors have direction-specific meanings:
95
+ The error code identifies which side failed:
71
96
 
72
- - `invalid_connect_payload` means that the host could not parse the SDK's `connect` message. The
73
- host sends this code in `init.error` when it can read the `initializationId`.
74
- - `invalid_init_payload` means that the SDK could not parse the host's `init` message. The SDK sends
75
- this code in `initResult.error` when it can read the expected `initializationId`.
76
- - `invalid_init_bindings` means that the SDK could not apply the data source bindings in the host's
77
- valid `init` message. The SDK sends this code in `initResult.error`.
78
- - `invalid_init_result_payload` means that the host could not parse the SDK's `initResult`. This is
79
- a host-local error. The SDK does not send this code.
80
- - `initial_state_timeout` means that the host could not prepare the initial state before its
81
- timeout.
82
- - `no_init_result` means that the host did not receive a valid `initResult` before its timeout.
97
+ - `invalid_connect_payload`: The host could not parse the SDK's `connect` message. The host sends
98
+ this code in `init.error` when it can read the `initializationId`.
99
+ - `invalid_init_payload`: The SDK could not parse the host's `init` message. The SDK sends this code
100
+ in `initResult.error` when it can read the expected `initializationId`.
101
+ - `invalid_init_bindings`: The SDK could not apply the data source bindings in the host's valid
102
+ `init` message. The SDK sends this code in `initResult.error`.
103
+ - `invalid_init_result_payload`: The host could not parse the SDK's `initResult`. Only the host
104
+ reports this error.
105
+ - `initial_state_timeout`: The host could not prepare the initial state before its timeout.
106
+ - `no_init_result`: The host did not receive a valid `initResult` before its timeout.
83
107
 
84
- See [Lifecycle and initialization](./lifecycle.md) for initialization-specific error codes.
108
+ See [Lifecycle and initialization](lifecycle.md) for initialization-specific error codes.
85
109
 
86
110
  ## Handling errors
87
111
 
88
- - Branch on `code` and `isRetryable`, never on `message`.
89
- - Keep a default branch when switching on `code`. The known literals provide autocomplete, but newer
90
- hosts may send codes that an older SDK does not list.
91
- - Treat `isRetryable` as advisory when deciding whether to offer or schedule a retry.
92
- - Use `message` for developer-facing details, not as a stable identifier.
112
+ - Use `code` for error handling and `message` for developer-facing details. Do not branch on
113
+ `message`.
114
+ - Keep a default branch when switching on `code` to handle codes from newer hosts.
115
+ - Treat `isRetryable` as advice when deciding whether to offer or schedule a retry.
93
116
  - `"unknown_error"` means the host encountered an unexpected or unclassified failure.
package/docs/lifecycle.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Lifecycle
2
2
 
3
- The SDK and host use a three-message `postMessage` handshake to initialize a custom block.
3
+ A custom block needs context from its host before it can render content that uses Notion data. This
4
+ guide covers initialization, loading and error states, and iframe sizing for React and
5
+ framework-neutral blocks. The SDK and host initialize the block through a three-message
6
+ `postMessage` handshake.
4
7
 
5
8
  This handshake can be completed with one of these APIs:
6
9
 
@@ -133,9 +136,13 @@ The `CustomBlockInitializationErrorCode` tells you where initialization failed:
133
136
  - The SDK could not apply the host's state.
134
137
  - The SDK failed before the handshake completed, such as `not_in_iframe`.
135
138
 
139
+ `manifest_unavailable` means the sandbox omitted its declaration or the host reported an unavailable
140
+ manifest. `manifest_invalid` reports a manifest validation failure. Hosts can also return errors
141
+ from their definition-loading code; the shared host forwards those errors unchanged.
142
+
136
143
  All code types are open string unions, so keep a default branch. Use `isRetryable` to decide whether
137
144
  offering a retry makes sense, and treat `message` as display text rather than a stable identifier.
138
- See [Error handling](./errors.md) for the shared error contract.
145
+ See [Error handling](errors.md) for the shared error contract.
139
146
 
140
147
  ### `customBlock`
141
148
 
@@ -196,7 +203,7 @@ function ThemeLabel() {
196
203
  }
197
204
  ```
198
205
 
199
- See [Block location and appearance](./block-location.md#reading-values-and-following-changes) for
206
+ See [Block location and appearance](block-location.md#reading-values-and-following-changes) for
200
207
  the available getters, subscriptions, and React hooks.
201
208
 
202
209
  ### `NotInIframeError`