@notionhq/custom-blocks-dev-shell 0.4.3 → 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.
package/docs/bindings.md CHANGED
@@ -5,7 +5,7 @@ launcher flags or in **Bindings → Data access**.
5
5
 
6
6
  Each data source selects its file in this order:
7
7
 
8
- 1. The explicit `--bind` selection.
8
+ 1. The explicit `--bind-data-source` selection.
9
9
  2. `data/worker_<dataSourceKey>.json`, if it exists.
10
10
  3. `data/<dataSourceKey>.json`, if it exists.
11
11
  4. If neither file exists, the data source stays unbound.
@@ -15,20 +15,20 @@ choices.
15
15
 
16
16
  ## Choose sample data
17
17
 
18
- Use `--bind <capabilityKey>.<dataSourceKey>=<sampleDataFileName>` to choose a source:
18
+ Use `--bind-data-source <capabilityKey>.<dataSourceKey>=<sampleDataFileName>` to choose a source:
19
19
 
20
20
  ```bash
21
- ntn workers customblocks dev -- --bind task-board.tasks=sample_tasks.json
21
+ ntn workers customblocks dev -- --bind-data-source task-board.tasks=sample_tasks.json
22
22
  ```
23
23
 
24
24
  This connects the `tasks` data source on `task-board` to `data/sample_tasks.json`. Use a filename
25
25
  from `data/`, including `.json`.
26
26
 
27
- Repeat `--bind` for additional data sources. Sources without an override keep their defaults. When
28
- running `custom-blocks-dev-shell` directly, omit the forwarding `--` separator.
27
+ Repeat `--bind-data-source` for additional data sources. Sources without an override keep their
28
+ defaults. When running `custom-blocks-dev-shell` directly, omit the forwarding `--` separator.
29
29
 
30
- The launcher rejects unknown, ambiguous, or repeated targets and missing files. Malformed files
31
- appear as errors in the shell.
30
+ Unknown, ambiguous, or repeated targets stop startup, as do missing files. Malformed files appear as
31
+ errors in the shell.
32
32
 
33
33
  ## Choose property mappings
34
34
 
@@ -37,7 +37,7 @@ property must map to a specific property in your sample data:
37
37
 
38
38
  ```bash
39
39
  ntn workers customblocks dev -- \
40
- --bind task-board.tasks=sample_tasks.json \
40
+ --bind-data-source task-board.tasks=sample_tasks.json \
41
41
  --bind-property task-board.tasks.title=task_name \
42
42
  --bind-property task-board.tasks.status=workflow_status
43
43
  ```
@@ -47,8 +47,9 @@ property maps to `schema.task_name`, and its `status` property maps to `schema.w
47
47
  source property key is a key in the sample file's `schema`, not its display name.
48
48
 
49
49
  Repeat `--bind-property` for each property you want to set. Explicit mappings override automatic
50
- matches. Properties without an override keep automatic matching. You can omit `--bind` when the slot
51
- already selects a file by its default filename. Flag order does not affect source selection.
50
+ matches. Properties without an override keep automatic matching. You can omit `--bind-data-source`
51
+ when the slot already selects a file by its default filename. Flag order does not affect source
52
+ selection.
52
53
 
53
54
  An unknown or ambiguous target, duplicate property target, missing source, missing source property,
54
55
  or property type mismatch stops startup. Other properties can remain unmapped until you connect them
@@ -66,20 +67,20 @@ Cannot bind task-board.tasks.title: source property "score" has type "number", e
66
67
 
67
68
  The codes identify the cause:
68
69
 
69
- | Code | Cause |
70
- | ----------------------------------- | ----------------------------------------------------------------------------- |
71
- | `invalid_binding_syntax` | A `--bind` value does not follow the required syntax. |
72
- | `invalid_property_binding_syntax` | A `--bind-property` value does not follow the required syntax. |
73
- | `unknown_binding_target` | No block and data source slot match the `--bind` target. |
74
- | `ambiguous_binding_target` | More than one block and slot match the `--bind` target. |
75
- | `duplicate_binding_target` | A full `--bind` target appears more than once. |
76
- | `sample_file_not_found` | The file selected by `--bind` does not exist in `data/`. |
77
- | `unknown_property_binding_target` | No declared property matches the `--bind-property` target. |
78
- | `ambiguous_property_binding_target` | More than one declared property matches the target. |
79
- | `duplicate_property_binding_target` | A full `--bind-property` target appears more than once. |
80
- | `binding_source_missing` | A property override has neither an explicit source nor a default source file. |
81
- | `source_property_not_found` | The selected source's `schema` has no entry for the requested property key. |
82
- | `property_type_mismatch` | The source property type differs from the block property's declared type. |
70
+ | Code | Cause |
71
+ | -------------------------------------- | ----------------------------------------------------------------------------- |
72
+ | `invalid_data_source_binding_syntax` | A `--bind-data-source` value does not follow the required syntax. |
73
+ | `invalid_property_binding_syntax` | A `--bind-property` value does not follow the required syntax. |
74
+ | `unknown_data_source_binding_target` | No block and data source slot match the `--bind-data-source` target. |
75
+ | `ambiguous_data_source_binding_target` | More than one block and slot match the `--bind-data-source` target. |
76
+ | `duplicate_data_source_binding_target` | A full `--bind-data-source` target appears more than once. |
77
+ | `sample_file_not_found` | The file selected by `--bind-data-source` does not exist in `data/`. |
78
+ | `unknown_property_binding_target` | No declared property matches the `--bind-property` target. |
79
+ | `ambiguous_property_binding_target` | More than one declared property matches the target. |
80
+ | `duplicate_property_binding_target` | A full `--bind-property` target appears more than once. |
81
+ | `property_binding_source_missing` | A property override has neither an explicit source nor a default source file. |
82
+ | `source_property_not_found` | The selected source's `schema` has no entry for the requested property key. |
83
+ | `property_type_mismatch` | The source property type differs from the block property's declared type. |
83
84
 
84
85
  Repeating a full target fails even when both values are identical. The same property key in
85
86
  different slots or blocks is allowed. Multiple declared properties can share a source property when
@@ -34,7 +34,7 @@ For example, `data/tasks.json`:
34
34
  "id": "tasks-1",
35
35
  "title": "Ship the block",
36
36
  "status": "Not started",
37
- "dueDate": { "type": "date", "start_date": "2026-08-01" },
37
+ "dueDate": { "start": "2026-08-01" },
38
38
  "done": false
39
39
  }
40
40
  ]
@@ -56,19 +56,60 @@ For example, `data/tasks.json`:
56
56
 
57
57
  Value shapes by property type:
58
58
 
59
- | Type | Value |
60
- | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
- | `title`, `rich_text`, `select`, `status`, `url`, `email`, `phone_number` | string |
62
- | `multi_select` | array of strings |
63
- | `number` | number |
64
- | `checkbox` | boolean |
65
- | `date` | `{ "type": "date", "start_date": "YYYY-MM-DD" }`. Ranges and datetimes use `"daterange"`, `"datetime"`, or `"datetimerange"` with `end_date`, `start_time`, and `end_time`. |
66
- | `people` | array of `{ "id": "...", "table": "notion_user" }` pointers |
67
- | `relation` | array of `{ "id": "...", "table": "block" }` pointers |
68
- | `files` | string (the host serializes file properties as text today) |
59
+ | Type | Value |
60
+ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
61
+ | `title`, `rich_text`, `select`, `status`, `url`, `email`, `phone_number` | string |
62
+ | `multi_select` | array of strings |
63
+ | `number` | number |
64
+ | `checkbox` | boolean |
65
+ | `date` | `{ "start": "2026-08-01" }` for an all-day date. Add `end` for a range and use ISO timestamps with an optional `timeZone` for timed dates. |
66
+ | `people` | array of `{ "id": "...", "table": "notion_user" }` pointers |
67
+ | `relation` | array of `{ "id": "...", "table": "block" }` pointers |
68
+ | `files` | Array of named external links and unavailable placeholders. |
69
69
 
70
70
  People properties use user IDs, not page IDs from a directory data source.
71
71
 
72
+ To test how a block handles an unavailable attachment, add a placeholder to a Files cell. For a
73
+ schema property named `files`, a row can contain this value:
74
+
75
+ ```json
76
+ {
77
+ "files": [
78
+ {
79
+ "type": "external",
80
+ "name": "Analytical Engine reference",
81
+ "external": { "url": "https://en.wikipedia.org/wiki/Analytical_Engine" }
82
+ },
83
+ { "type": "unavailable", "name": "Engine diagrams.png" }
84
+ ]
85
+ }
86
+ ```
87
+
88
+ Reads preserve entry order. The sample data contains links and labels, so loading a row does not
89
+ fetch the linked content. A placeholder's name is optional. The shell skips malformed entries and
90
+ treats missing cells and older text values as empty arrays.
91
+
92
+ ## Date values
93
+
94
+ Date, Created time, and Last edited time cells accept an ISO date or timestamp string, or an object
95
+ with a required `start` and optional `end`, `timeZone`, and `reminder`. Use `YYYY-MM-DD` for all-day
96
+ dates and add a time to create a timed date.
97
+
98
+ ```json
99
+ {
100
+ "dueDate": { "start": "2026-08-01" },
101
+ "releaseWindow": { "start": "2026-08-01", "end": "2026-08-03" },
102
+ "appointment": {
103
+ "start": "2026-08-01T09:00",
104
+ "end": "2026-08-01T10:00",
105
+ "timeZone": "America/Los_Angeles"
106
+ }
107
+ }
108
+ ```
109
+
110
+ For a timed value, an explicit offset such as `-07:00` on the timestamp takes precedence over
111
+ `timeZone`. If you supply neither, the dev shell uses UTC.
112
+
72
113
  ## Validation
73
114
 
74
115
  Files are validated independently at startup and after edits. Errors name the file and problem, for
@@ -83,11 +124,7 @@ error names the ID and conflicting files. Other files remain available.
83
124
 
84
125
  The shell applies filters, then ordered sorts, then the query limit. The SDK resolves semantic
85
126
  property keys to property IDs before it sends the query. Empty values stay last in both directions.
86
- Date-only and zone-less datetime values sort using UTC. Datetime values with a `time_zone` use that
87
- named zone, and an explicit offset in `start_time` wins.
88
-
89
- Date, Created time, and Last edited time values accept ISO timestamp strings or the sample `date`
90
- shapes above.
127
+ All-day dates sort using UTC.
91
128
 
92
129
  People, Created by, and Last edited by sorts use record IDs as mock display names. People sorts
93
130
  preserve pointer order and remove duplicates. Groups use their composite group and workspace IDs.
@@ -122,11 +159,20 @@ ntn workers customblocks sample <url-or-data-source-id> \
122
159
  --out data/worker_tasks.json --row-only
123
160
  ```
124
161
 
125
- Run the dev shell once to create the generated file, then sample your data. `--row-only` preserves
126
- the schema and appends rows with new IDs. Add `--overwrite` to replace existing rows.
162
+ Run the dev shell once to create the generated file, then sample your data. The sample command reads
163
+ the schema and rows through the Notion API and writes a local JSON file. The dev shell converter
164
+ preserves date and timestamp strings, including seconds and offsets, and writes a supplied time zone
165
+ as `timeZone`.
166
+
167
+ `--row-only` preserves the schema and appends rows with new IDs. Add `--overwrite` to replace all
168
+ rows in the target file while keeping its schema.
169
+
170
+ Imported Files cells keep external links in order. Notion-hosted files and pending uploads become
171
+ unavailable placeholders, with a name when supplied. The sample JSON does not store temporary file
172
+ URLs.
127
173
 
128
174
  Sampled property keys must match the generated schema. If they differ, sample into a separate file
129
- and select it with [`--bind`](bindings.md#choose-sample-data).
175
+ and select it with [`--bind-data-source`](bindings.md#choose-sample-data).
130
176
 
131
177
  The shell loads sampled data automatically.
132
178
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks-dev-shell",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "description": "Local development shell for Notion custom block workers.",
5
5
  "license": "MIT",
6
6
  "type": "module",