@notionhq/custom-blocks-dev-shell 0.5.0 → 0.6.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.
package/docs/bindings.md CHANGED
@@ -56,6 +56,28 @@ or property type mismatch stops startup. Other properties can remain unmapped un
56
56
  in **Bindings → Data access**. If the data source file cannot load, its property mappings remain
57
57
  unvalidated until you fix and save the file.
58
58
 
59
+ ## Preselect a page
60
+
61
+ Use `--bind-page <capabilityKey>.<pageKey>=<pageId>` to preselect a sample page for a declared slot:
62
+
63
+ ```bash
64
+ ntn workers customblocks dev --json -- --bind-page task-board.brief=launch-plan
65
+ ```
66
+
67
+ `brief` is the key under `pages` in the block manifest. `launch-plan` is a row `id` from a loaded
68
+ sample file. The launcher checks that the slot and row exist. Repeat the flag for different slots.
69
+
70
+ If a block key or page key contains an equals sign, write it as `\=` and quote the argument so the
71
+ shell preserves the backslash. Use `\\` for a literal backslash in either key.
72
+
73
+ ```bash
74
+ ntn workers customblocks dev --json -- --bind-page 'task-board.brief\=primary=launch-plan'
75
+ ```
76
+
77
+ **Bindings → Page access** starts with the selected row. With Protocol 14,
78
+ `NotionPage.fromKey("brief").get()` reads that row. Reload the shell to restore the CLI selection.
79
+ See [startup JSON](../README.md#startup-details-for-automation) for binding statuses.
80
+
59
81
  ## Binding errors
60
82
 
61
83
  The launcher stops on the first binding failure. Binding syntax and mapping errors end with
@@ -75,6 +97,11 @@ The codes identify the cause:
75
97
  | `ambiguous_data_source_binding_target` | More than one block and slot match the `--bind-data-source` target. |
76
98
  | `duplicate_data_source_binding_target` | A full `--bind-data-source` target appears more than once. |
77
99
  | `sample_file_not_found` | The file selected by `--bind-data-source` does not exist in `data/`. |
100
+ | `invalid_page_binding_syntax` | A `--bind-page` value does not follow the required syntax. |
101
+ | `unknown_page_binding_target` | No declared block and page slot match the target. |
102
+ | `ambiguous_page_binding_target` | More than one declared block and page slot match the target. |
103
+ | `duplicate_page_binding_target` | A full `--bind-page` target appears more than once. |
104
+ | `sample_page_not_found` | No loaded sample row has the selected ID. |
78
105
  | `unknown_property_binding_target` | No declared property matches the `--bind-property` target. |
79
106
  | `ambiguous_property_binding_target` | More than one declared property matches the target. |
80
107
  | `duplicate_property_binding_target` | A full `--bind-property` target appears more than once. |
@@ -93,8 +120,8 @@ properties. Changes apply as you make them. See the [sample data format](data-so
93
120
  define a source.
94
121
 
95
122
  **Page access** appears when the manifest declares at least one page slot. Select a page from your
96
- loaded sample data to apply the selection immediately. Named page selections are available in the
97
- shell UI. Blocks can use the SDK to read sample pages by ID.
123
+ loaded sample data to apply the selection immediately. Clear the selection to unbind the key. On
124
+ Protocol 14, a read by an unbound or undeclared key returns `page_unavailable`.
98
125
 
99
126
  A property maps automatically only when exactly one source property matches its key or name and has
100
127
  the same type. If no property matches, or several properties match, the property stays unmapped.
@@ -89,6 +89,25 @@ Reads preserve entry order. The sample data contains links and labels, so loadin
89
89
  fetch the linked content. A placeholder's name is optional. The shell skips malformed entries and
90
90
  treats missing cells and older text values as empty arrays.
91
91
 
92
+ ## Relations between sample files
93
+
94
+ Use `targetFile` to link a relation property to another sample file. Use the filename in `data/`,
95
+ including `.json`. To link tasks to projects, add this property to the Tasks schema.
96
+
97
+ ```json
98
+ {
99
+ "project_link": { "name": "Linked project", "type": "relation", "targetFile": "projects.json" }
100
+ }
101
+ ```
102
+
103
+ Set `project_link` on a task row to `[{ "id": "project-1", "table": "block" }]` to link to the row
104
+ with ID `project-1` in `projects.json`. Bind each file to its own data source key. The relation
105
+ definition gives the key for `projects.json`. If the target file is missing or has no binding, the
106
+ relation target is `unresolved` and the row still contains the linked page ID.
107
+
108
+ The built-in Tasks and Meetings samples link to Projects. Projects links to Customers. Use **Add all
109
+ missing** to copy these samples into your project, then select the files in **Bindings**.
110
+
92
111
  ## Date values
93
112
 
94
113
  Date, Created time, and Last edited time cells accept an ISO date or timestamp string, or an object
@@ -118,7 +137,9 @@ filename without `.json` is the source identity used by bindings and source pick
118
137
  changes its identity.
119
138
 
120
139
  Duplicate page IDs make every file containing that ID unavailable until the collision is fixed. The
121
- error names the ID and conflicting files. Other files remain available.
140
+ error names the ID and conflicting files. Other files remain available. The launcher also reserves
141
+ Current page’s ID. A sample file with a row that uses that ID is unavailable until you change the
142
+ row ID.
122
143
 
123
144
  ## Querying
124
145
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks-dev-shell",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Local development shell for Notion custom block workers.",
5
5
  "license": "MIT",
6
6
  "type": "module",