@notionhq/custom-blocks-dev-shell 0.4.4 → 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/README.md +80 -23
- package/data/customers.json +10 -20
- package/data/meetings.json +51 -102
- package/data/projects.json +28 -42
- package/data/tasks.json +33 -66
- package/dist/assets/index-Dhs3H2Yo.js +12 -0
- package/dist/index.html +1 -1
- package/dist-cli/cli/published-cli.js +1717 -471
- package/docs/bindings.md +25 -24
- package/docs/data-sources.md +41 -19
- package/package.json +1 -1
- package/dist/assets/index-B1RObNc_.js +0 -12
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
|
|
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
|
-
|
|
31
|
-
|
|
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`
|
|
51
|
-
already selects a file by its default filename. Flag order does not affect source
|
|
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
|
|
70
|
-
|
|
|
71
|
-
| `
|
|
72
|
-
| `invalid_property_binding_syntax`
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `sample_file_not_found`
|
|
77
|
-
| `unknown_property_binding_target`
|
|
78
|
-
| `ambiguous_property_binding_target`
|
|
79
|
-
| `duplicate_property_binding_target`
|
|
80
|
-
| `
|
|
81
|
-
| `source_property_not_found`
|
|
82
|
-
| `property_type_mismatch`
|
|
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
|
package/docs/data-sources.md
CHANGED
|
@@ -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": { "
|
|
37
|
+
"dueDate": { "start": "2026-08-01" },
|
|
38
38
|
"done": false
|
|
39
39
|
}
|
|
40
40
|
]
|
|
@@ -56,16 +56,16 @@ 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` | `{ "
|
|
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.
|
|
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
|
|
|
@@ -89,6 +89,27 @@ 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
|
+
## 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
|
+
|
|
92
113
|
## Validation
|
|
93
114
|
|
|
94
115
|
Files are validated independently at startup and after edits. Errors name the file and problem, for
|
|
@@ -103,11 +124,7 @@ error names the ID and conflicting files. Other files remain available.
|
|
|
103
124
|
|
|
104
125
|
The shell applies filters, then ordered sorts, then the query limit. The SDK resolves semantic
|
|
105
126
|
property keys to property IDs before it sends the query. Empty values stay last in both directions.
|
|
106
|
-
|
|
107
|
-
named zone, and an explicit offset in `start_time` wins.
|
|
108
|
-
|
|
109
|
-
Date, Created time, and Last edited time values accept ISO timestamp strings or the sample `date`
|
|
110
|
-
shapes above.
|
|
127
|
+
All-day dates sort using UTC.
|
|
111
128
|
|
|
112
129
|
People, Created by, and Last edited by sorts use record IDs as mock display names. People sorts
|
|
113
130
|
preserve pointer order and remove duplicates. Groups use their composite group and workspace IDs.
|
|
@@ -142,15 +159,20 @@ ntn workers customblocks sample <url-or-data-source-id> \
|
|
|
142
159
|
--out data/worker_tasks.json --row-only
|
|
143
160
|
```
|
|
144
161
|
|
|
145
|
-
Run the dev shell once to create the generated file, then sample your data.
|
|
146
|
-
the schema and
|
|
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.
|
|
147
169
|
|
|
148
170
|
Imported Files cells keep external links in order. Notion-hosted files and pending uploads become
|
|
149
171
|
unavailable placeholders, with a name when supplied. The sample JSON does not store temporary file
|
|
150
172
|
URLs.
|
|
151
173
|
|
|
152
174
|
Sampled property keys must match the generated schema. If they differ, sample into a separate file
|
|
153
|
-
and select it with [`--bind`](bindings.md#choose-sample-data).
|
|
175
|
+
and select it with [`--bind-data-source`](bindings.md#choose-sample-data).
|
|
154
176
|
|
|
155
177
|
The shell loads sampled data automatically.
|
|
156
178
|
|