@notionhq/custom-blocks-dev-shell 0.3.1 → 0.4.1
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 +43 -18
- package/data/customers.json +286 -0
- package/data/meetings.json +519 -0
- package/data/people.json +171 -47
- package/data/projects.json +338 -0
- package/data/tasks.json +828 -38
- package/dist/assets/index-CohEBjwO.css +2 -0
- package/dist/assets/index-G-f2Po2-.js +12 -0
- package/dist/index.html +3 -3
- package/dist-cli/cli/published-cli.js +1276 -722
- package/docs/bindings.md +17 -22
- package/docs/bridge/changelog.md +66 -19
- package/docs/bridge/protocol.md +172 -83
- package/docs/bridge/versioning.md +16 -4
- package/docs/data-sources.md +44 -31
- package/docs/host/README.md +35 -40
- package/docs/host/docs/compatibility.md +71 -31
- package/docs/host/docs/handlers.md +31 -15
- package/docs/host/docs/host-contract.md +83 -76
- package/docs/host/docs/lifecycle.md +76 -53
- package/package.json +1 -1
- package/data/radar.json +0 -87
- package/dist/assets/index-Do-x8yIt.css +0 -2
- package/dist/assets/index-Jy9OWV_k.js +0 -12
package/README.md
CHANGED
|
@@ -35,6 +35,18 @@ Install `@notionhq/custom-blocks-dev-shell` in the worker's `devDependencies` to
|
|
|
35
35
|
This also makes the reference docs available in `node_modules`. If you do not install it, the CLI
|
|
36
36
|
fetches the latest version each time.
|
|
37
37
|
|
|
38
|
+
### Preview and workspace
|
|
39
|
+
|
|
40
|
+
**Layout** previews the block on a page, in a database view, or as a full page. In **Block** layout,
|
|
41
|
+
drag a handle or use its arrow keys to reorder the surrounding placeholders and custom block.
|
|
42
|
+
Reordering requires CSS visual reading-order support.
|
|
43
|
+
|
|
44
|
+
**View** uses full-page SDK context. It does not simulate custom-view SDK context.
|
|
45
|
+
|
|
46
|
+
**Workspace** opens shared data sources, pages, and users while the block keeps running. Workspace
|
|
47
|
+
edits and SDK writes stay in memory. See [reload behavior](#reload-behavior) for when records reset,
|
|
48
|
+
and [bindings](docs/bindings.md) to connect sample data.
|
|
49
|
+
|
|
38
50
|
### Startup details for automation
|
|
39
51
|
|
|
40
52
|
Use `--json` to read startup details from stdout:
|
|
@@ -119,8 +131,9 @@ Block responses enforce a production-like content security policy (CSP) and send
|
|
|
119
131
|
|
|
120
132
|
- **Blocked features:** Native form submission, browser workers, `<object>`, `<embed>`, web app
|
|
121
133
|
manifests, and `<base>`.
|
|
122
|
-
- **Scripts and styles:** Bundled scripts and inline
|
|
123
|
-
blocked.
|
|
134
|
+
- **Scripts and styles:** Bundled scripts, inline scripts, and inline styles work. Scripts loaded
|
|
135
|
+
from a CDN at runtime are blocked. WebAssembly compilation is allowed; JavaScript string
|
|
136
|
+
evaluation remains blocked.
|
|
124
137
|
- **Media and fonts:** Notion-hosted media and Google Fonts use the same exceptions as production.
|
|
125
138
|
- **External access:** Network requests and nested frames may use any origin for now. Browser CORS
|
|
126
139
|
checks still apply.
|
|
@@ -135,9 +148,9 @@ Block responses enforce a production-like content security policy (CSP) and send
|
|
|
135
148
|
origins.
|
|
136
149
|
- **Hot reload:** CSP permits the block's exact WebSocket host and port for Vite HMR.
|
|
137
150
|
- **External access:** Production uses workspace-approved external origins. The dev shell currently
|
|
138
|
-
allows all origins.
|
|
151
|
+
allows all origins.
|
|
139
152
|
- **Embedding hosts:** Any host may embed local blocks for now, including Notion apps in every
|
|
140
|
-
environment.
|
|
153
|
+
environment.
|
|
141
154
|
- **Parent navigation policy:** The shell does not apply production's parent navigation CSP. The
|
|
142
155
|
block's CSP alone cannot prevent it from navigating its own iframe to another document.
|
|
143
156
|
- **Sample data:** SDK handlers use local sample data instead of production permissions and
|
|
@@ -147,18 +160,30 @@ Block responses enforce a production-like content security policy (CSP) and send
|
|
|
147
160
|
|
|
148
161
|
### Reload behavior
|
|
149
162
|
|
|
150
|
-
| Change
|
|
151
|
-
|
|
|
152
|
-
| Block code or styles
|
|
153
|
-
|
|
|
154
|
-
|
|
|
163
|
+
| Change | What happens |
|
|
164
|
+
| -------------------------------------------------------------------- | --------------------------------------------------------------------- |
|
|
165
|
+
| Block code or styles | Vite applies hot updates. |
|
|
166
|
+
| Retry or changes to the block, data source bindings, or display mode | The preview restarts. Page records stay in memory. |
|
|
167
|
+
| Loaded sample filenames, schemas, or rows | All page records reset to the sample files, and the preview restarts. |
|
|
168
|
+
| Browser refresh | All page records reset to the sample files. |
|
|
169
|
+
| Worker declarations, including data source definitions | Restart the dev shell to rebuild the manifest. |
|
|
170
|
+
|
|
171
|
+
See [live updates and local writes](docs/data-sources.md#live-updates-and-local-writes) for sample
|
|
172
|
+
changes and error recovery.
|
|
173
|
+
|
|
174
|
+
### Sample users
|
|
175
|
+
|
|
176
|
+
The dev shell provides a fixed set of sample users, with Ada Lovelace as the current user.
|
|
177
|
+
`getViewer()` identifies the viewer. `NotionUser` field reads and `listUsers()` use the same
|
|
178
|
+
profiles. Block reloads and changes to sample data files preserve these user identities.
|
|
179
|
+
|
|
180
|
+
The built-in People data source contains directory pages that reference sample users. Adding,
|
|
181
|
+
editing, or deleting a worker's People file does not change the sample users.
|
|
155
182
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
[live updates and local writes](docs/data-sources.md#live-updates-and-local-writes) for error
|
|
159
|
-
recovery.
|
|
183
|
+
People properties can reference other user IDs, but `users.get()` returns `get_user_failed` for
|
|
184
|
+
those IDs. The dev shell does not fetch user profiles from Notion.
|
|
160
185
|
|
|
161
|
-
###
|
|
186
|
+
### Errors
|
|
162
187
|
|
|
163
188
|
The viewport shows an error when a block cannot initialize or an uncaught runtime error prevents
|
|
164
189
|
rendering. For host and runtime errors, use **Copy** to copy the details or **Retry** to create a
|
|
@@ -168,14 +193,14 @@ A missing or invalid worker manifest shows an error before the block starts. Fix
|
|
|
168
193
|
declaration and restart the dev shell to rebuild the manifest.
|
|
169
194
|
|
|
170
195
|
An unexpected iframe reload stops the host and shows a retryable `iframe_reloaded` error. The host
|
|
171
|
-
ignores later connections. The dev shell does not replace the iframe automatically. Use Retry to
|
|
196
|
+
ignores later connections. The dev shell does not replace the iframe automatically. Use **Retry** to
|
|
172
197
|
create a new host and iframe.
|
|
173
198
|
|
|
174
199
|
### External navigation
|
|
175
200
|
|
|
176
|
-
`links.open` uses a host-owned confirmation before opening the
|
|
177
|
-
supports only HTTP and HTTPS. Other schemes return `invalid_url` without
|
|
178
|
-
Production Notion also applies its existing URL sanitizer.
|
|
201
|
+
`links.open` uses a host-owned confirmation before opening the normalized URL shown in the
|
|
202
|
+
confirmation. The dev shell supports only HTTP and HTTPS. Other schemes return `invalid_url` without
|
|
203
|
+
showing a prompt. Production Notion also applies its existing URL sanitizer.
|
|
179
204
|
|
|
180
205
|
## Documentation
|
|
181
206
|
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "built-in",
|
|
3
|
+
"name": "Customers",
|
|
4
|
+
"icon": "\ud83c\udfe1",
|
|
5
|
+
"schema": {
|
|
6
|
+
"name": {
|
|
7
|
+
"name": "Name",
|
|
8
|
+
"type": "title"
|
|
9
|
+
},
|
|
10
|
+
"stage": {
|
|
11
|
+
"name": "Stage",
|
|
12
|
+
"type": "select",
|
|
13
|
+
"options": [
|
|
14
|
+
{
|
|
15
|
+
"id": "exploring",
|
|
16
|
+
"name": "Exploring"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "pilot",
|
|
20
|
+
"name": "Pilot"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "active",
|
|
24
|
+
"name": "Active"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "paused",
|
|
28
|
+
"name": "Paused"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"owner": {
|
|
33
|
+
"name": "Owner",
|
|
34
|
+
"type": "people"
|
|
35
|
+
},
|
|
36
|
+
"value": {
|
|
37
|
+
"name": "Value",
|
|
38
|
+
"type": "number"
|
|
39
|
+
},
|
|
40
|
+
"email": {
|
|
41
|
+
"name": "Email",
|
|
42
|
+
"type": "email"
|
|
43
|
+
},
|
|
44
|
+
"website": {
|
|
45
|
+
"name": "Website",
|
|
46
|
+
"type": "url"
|
|
47
|
+
},
|
|
48
|
+
"last_contacted": {
|
|
49
|
+
"name": "Last contacted",
|
|
50
|
+
"type": "date"
|
|
51
|
+
},
|
|
52
|
+
"needs": {
|
|
53
|
+
"name": "Needs",
|
|
54
|
+
"type": "rich_text"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"rows": [
|
|
58
|
+
{
|
|
59
|
+
"id": "customer-1",
|
|
60
|
+
"name": "Northside Library",
|
|
61
|
+
"stage": "Exploring",
|
|
62
|
+
"owner": [],
|
|
63
|
+
"value": 0,
|
|
64
|
+
"needs": "Keep reading list entries linked to the book catalog.",
|
|
65
|
+
"website": "https://example.com/organizations/northside-library"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "customer-2",
|
|
69
|
+
"name": "Westfield Learning Center",
|
|
70
|
+
"stage": "Active",
|
|
71
|
+
"owner": [
|
|
72
|
+
{
|
|
73
|
+
"id": "adele-goldberg",
|
|
74
|
+
"table": "notion_user"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"value": 8500,
|
|
78
|
+
"needs": "Let students run and change short Smalltalk programs. Teachers need a way to reset the workspace between classes.",
|
|
79
|
+
"website": "https://example.com/organizations/westfield-learning-center",
|
|
80
|
+
"email": "westfield-learning-center@example.com",
|
|
81
|
+
"last_contacted": {
|
|
82
|
+
"type": "date",
|
|
83
|
+
"start_date": "2026-11-13"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": "customer-3",
|
|
88
|
+
"name": "Fieldwork Press",
|
|
89
|
+
"stage": "Pilot",
|
|
90
|
+
"owner": [
|
|
91
|
+
{
|
|
92
|
+
"id": "douglas-engelbart",
|
|
93
|
+
"table": "notion_user"
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"value": 12500,
|
|
97
|
+
"needs": "Two editors need to revise the same article without overwriting each other. Drafts must remain available after a connection drops.",
|
|
98
|
+
"website": "https://example.com/organizations/fieldwork-press",
|
|
99
|
+
"email": "fieldwork-press@example.com",
|
|
100
|
+
"last_contacted": {
|
|
101
|
+
"type": "date",
|
|
102
|
+
"start_date": "2026-11-12"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"id": "customer-4",
|
|
107
|
+
"name": "Riverside Workshop",
|
|
108
|
+
"stage": "Paused",
|
|
109
|
+
"owner": [
|
|
110
|
+
{
|
|
111
|
+
"id": "sophie-wilson",
|
|
112
|
+
"table": "notion_user"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"value": 15000,
|
|
116
|
+
"needs": "Record sensor readings during outdoor experiments. The prototype needs to run for a full afternoon on battery power.",
|
|
117
|
+
"website": "https://example.com/organizations/riverside-workshop",
|
|
118
|
+
"email": "riverside-workshop@example.com",
|
|
119
|
+
"last_contacted": {
|
|
120
|
+
"type": "date",
|
|
121
|
+
"start_date": "2026-11-10"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"id": "customer-5",
|
|
126
|
+
"name": "Cedar Research Lab",
|
|
127
|
+
"stage": "Pilot",
|
|
128
|
+
"owner": [
|
|
129
|
+
{
|
|
130
|
+
"id": "ada-lovelace",
|
|
131
|
+
"table": "notion_user"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"value": 2400,
|
|
135
|
+
"needs": "Save lab measurements, calculation steps, and results together.",
|
|
136
|
+
"website": "https://example.com/organizations/cedar-research-lab",
|
|
137
|
+
"email": "cedar-research-lab@example.com"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"id": "customer-6",
|
|
141
|
+
"name": "County Records Office",
|
|
142
|
+
"stage": "Active",
|
|
143
|
+
"owner": [
|
|
144
|
+
{
|
|
145
|
+
"id": "radia-perlman",
|
|
146
|
+
"table": "notion_user"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"value": 9200,
|
|
150
|
+
"needs": "Keep reading room terminals connected when a network link fails. Staff need a clear way to identify the failed connection.",
|
|
151
|
+
"website": "https://example.com/organizations/county-records-office",
|
|
152
|
+
"last_contacted": {
|
|
153
|
+
"type": "date",
|
|
154
|
+
"start_date": "2026-11-16"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"id": "customer-7",
|
|
159
|
+
"name": "Evening Computing School",
|
|
160
|
+
"stage": "Pilot",
|
|
161
|
+
"owner": [
|
|
162
|
+
{
|
|
163
|
+
"id": "grace-hopper",
|
|
164
|
+
"table": "notion_user"
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
"value": 6800,
|
|
168
|
+
"needs": "Explain programming errors to students taking their first course. Show the line that failed and a useful next step.",
|
|
169
|
+
"website": "https://example.com/organizations/evening-computing-school",
|
|
170
|
+
"email": "evening-computing-school@example.com",
|
|
171
|
+
"last_contacted": {
|
|
172
|
+
"type": "date",
|
|
173
|
+
"start_date": "2026-11-09"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"id": "customer-8",
|
|
178
|
+
"name": "Local History Museum",
|
|
179
|
+
"stage": "Paused",
|
|
180
|
+
"owner": [
|
|
181
|
+
{
|
|
182
|
+
"id": "alan-kay",
|
|
183
|
+
"table": "notion_user"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"value": 18000,
|
|
187
|
+
"needs": "Provide a portable learning station for visiting exhibits. The display and controls need to survive regular packing and transport.",
|
|
188
|
+
"website": "https://example.com/organizations/local-history-museum",
|
|
189
|
+
"email": "local-history-museum@example.com",
|
|
190
|
+
"last_contacted": {
|
|
191
|
+
"type": "date",
|
|
192
|
+
"start_date": "2026-11-11"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"id": "customer-9",
|
|
197
|
+
"name": "Campus Weekly",
|
|
198
|
+
"stage": "Active",
|
|
199
|
+
"owner": [
|
|
200
|
+
{
|
|
201
|
+
"id": "karen-sp\u00e4rck-jones",
|
|
202
|
+
"table": "notion_user"
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
"value": 6400,
|
|
206
|
+
"needs": "Search 15 years of newspaper articles by name, date, or topic.",
|
|
207
|
+
"website": "https://example.com/organizations/campus-weekly",
|
|
208
|
+
"email": "campus-weekly@example.com"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"id": "customer-10",
|
|
212
|
+
"name": "Workshop Cooperative",
|
|
213
|
+
"stage": "Exploring",
|
|
214
|
+
"value": 0,
|
|
215
|
+
"needs": "Publish workshop instructions that members can read on phones or download.",
|
|
216
|
+
"website": "https://example.com/organizations/workshop-cooperative",
|
|
217
|
+
"email": "workshop-cooperative@example.com",
|
|
218
|
+
"last_contacted": {
|
|
219
|
+
"type": "date",
|
|
220
|
+
"start_date": "2026-11-18"
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"id": "customer-11",
|
|
225
|
+
"name": "Community History Archive",
|
|
226
|
+
"stage": "Active",
|
|
227
|
+
"owner": [
|
|
228
|
+
{
|
|
229
|
+
"id": "mary-allen-wilkes",
|
|
230
|
+
"table": "notion_user"
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
"value": 4600,
|
|
234
|
+
"needs": "Recover locally saved interview notes after an interrupted session. Keep the original recording references with the restored draft.",
|
|
235
|
+
"website": "https://example.com/organizations/community-history-archive",
|
|
236
|
+
"last_contacted": {
|
|
237
|
+
"type": "date",
|
|
238
|
+
"start_date": "2026-11-18"
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"id": "customer-12",
|
|
243
|
+
"name": "Parkside Arts Center",
|
|
244
|
+
"stage": "Pilot",
|
|
245
|
+
"owner": [
|
|
246
|
+
{
|
|
247
|
+
"id": "ivan-sutherland",
|
|
248
|
+
"table": "notion_user"
|
|
249
|
+
}
|
|
250
|
+
],
|
|
251
|
+
"value": 7200,
|
|
252
|
+
"needs": "Let participants draw and resize shapes with a pointer or keyboard. Export the finished drawings in a format the studio can reuse.",
|
|
253
|
+
"website": "https://example.com/organizations/parkside-arts-center",
|
|
254
|
+
"email": "parkside-arts-center@example.com",
|
|
255
|
+
"last_contacted": {
|
|
256
|
+
"type": "date",
|
|
257
|
+
"start_date": "2026-11-19"
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"id": "customer-13",
|
|
262
|
+
"name": "Harbor Print Shop",
|
|
263
|
+
"stage": "Exploring",
|
|
264
|
+
"owner": [
|
|
265
|
+
{
|
|
266
|
+
"id": "adele-goldberg",
|
|
267
|
+
"table": "notion_user"
|
|
268
|
+
}
|
|
269
|
+
],
|
|
270
|
+
"email": "harbor-print-shop@example.com",
|
|
271
|
+
"needs": "Collect print specifications and artwork in one request form."
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"id": "customer-14",
|
|
275
|
+
"name": "Station Road Bookshop",
|
|
276
|
+
"stage": "Paused",
|
|
277
|
+
"owner": [],
|
|
278
|
+
"value": 0,
|
|
279
|
+
"last_contacted": {
|
|
280
|
+
"type": "date",
|
|
281
|
+
"start_date": "2026-10-14"
|
|
282
|
+
},
|
|
283
|
+
"needs": ""
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
}
|