@notionhq/custom-blocks-dev-shell 0.1.113 → 0.1.115
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 +27 -14
- package/bin/cli.js +3 -1
- package/dist/assets/index-DXzPwq_J.js +11 -0
- package/dist/index.html +1 -1
- package/dist-cli/cli/binding-cli-flags.js +33 -0
- package/dist-cli/cli/binding-errors.js +15 -0
- package/dist-cli/{build-block-registry.js → cli/build-block-registry.js} +2 -0
- package/dist-cli/{convert-values.js → cli/convert-values.js} +5 -5
- package/dist-cli/{convert.js → cli/convert.js} +3 -3
- package/dist-cli/cli/data-source-files.js +6 -0
- package/dist-cli/{data-sources.js → cli/data-sources.js} +12 -65
- package/dist-cli/{dev-shell-launcher.js → cli/dev-shell-launcher.js} +23 -10
- package/dist-cli/{errors.js → cli/errors.js} +5 -1
- package/dist-cli/cli/launcher-bindings.js +144 -0
- package/dist-cli/{published-cli.js → cli/published-cli.js} +2 -2
- package/dist-cli/{worker-manifest.js → cli/worker-manifest.js} +18 -1
- package/dist-cli/protocol/contrast.d.ts +4 -0
- package/dist-cli/protocol/contrast.js +3 -0
- package/dist-cli/protocol/dataSources/dataSource.d.ts +786 -0
- package/dist-cli/protocol/dataSources/dataSource.js +66 -0
- package/dist-cli/protocol/dataSources/dataSourcePage.d.ts +74 -0
- package/dist-cli/protocol/dataSources/dataSourcePage.js +15 -0
- package/dist-cli/protocol/dataSources/dataSourceValue.d.ts +66 -0
- package/dist-cli/protocol/dataSources/dataSourceValue.js +14 -0
- package/dist-cli/protocol/dataSources/dateValue.d.ts +157 -0
- package/dist-cli/protocol/dataSources/dateValue.js +61 -0
- package/dist-cli/protocol/dataSources/errors.d.ts +8 -0
- package/dist-cli/protocol/dataSources/errors.js +7 -0
- package/dist-cli/protocol/dataSources/propertySchema.d.ts +200 -0
- package/dist-cli/protocol/dataSources/propertySchema.js +174 -0
- package/dist-cli/protocol/dataSources/recordPointer.d.ts +9 -0
- package/dist-cli/protocol/dataSources/recordPointer.js +8 -0
- package/dist-cli/protocol/dataSources/sortDirection.d.ts +3 -0
- package/dist-cli/protocol/dataSources/sortDirection.js +2 -0
- package/dist-cli/protocol/errors.d.ts +12 -0
- package/dist-cli/protocol/errors.js +6 -0
- package/dist-cli/protocol/ids.d.ts +31 -0
- package/dist-cli/protocol/ids.js +26 -0
- package/dist-cli/protocol/index.d.ts +53 -0
- package/dist-cli/protocol/index.js +53 -0
- package/dist-cli/protocol/manifest.d.ts +67 -0
- package/dist-cli/protocol/manifest.js +36 -0
- package/dist-cli/protocol/messages/connect.d.ts +54 -0
- package/dist-cli/protocol/messages/connect.js +39 -0
- package/dist-cli/protocol/messages/contrastModeChanged.d.ts +7 -0
- package/dist-cli/protocol/messages/contrastModeChanged.js +7 -0
- package/dist-cli/protocol/messages/createPage.d.ts +290 -0
- package/dist-cli/protocol/messages/createPage.js +51 -0
- package/dist-cli/protocol/messages/createPageResult.d.ts +897 -0
- package/dist-cli/protocol/messages/createPageResult.js +43 -0
- package/dist-cli/protocol/messages/currentUserChanged.d.ts +18 -0
- package/dist-cli/protocol/messages/currentUserChanged.js +9 -0
- package/dist-cli/protocol/messages/dataSourcesChanged.d.ts +157 -0
- package/dist-cli/protocol/messages/dataSourcesChanged.js +13 -0
- package/dist-cli/protocol/messages/getPage.d.ts +902 -0
- package/dist-cli/protocol/messages/getPage.js +48 -0
- package/dist-cli/protocol/messages/getUser.d.ts +44 -0
- package/dist-cli/protocol/messages/getUser.js +32 -0
- package/dist-cli/protocol/messages/hostToSandbox.d.ts +4385 -0
- package/dist-cli/protocol/messages/hostToSandbox.js +48 -0
- package/dist-cli/protocol/messages/incomingType.d.ts +9 -0
- package/dist-cli/protocol/messages/incomingType.js +17 -0
- package/dist-cli/protocol/messages/init.d.ts +273 -0
- package/dist-cli/protocol/messages/init.js +57 -0
- package/dist-cli/protocol/messages/initResult.d.ts +37 -0
- package/dist-cli/protocol/messages/initResult.js +29 -0
- package/dist-cli/protocol/messages/invalidHostMessage.d.ts +14 -0
- package/dist-cli/protocol/messages/invalidHostMessage.js +13 -0
- package/dist-cli/protocol/messages/invalidSandboxMessage.d.ts +14 -0
- package/dist-cli/protocol/messages/invalidSandboxMessage.js +13 -0
- package/dist-cli/protocol/messages/isInitHandshakeMessage.d.ts +4 -0
- package/dist-cli/protocol/messages/isInitHandshakeMessage.js +11 -0
- package/dist-cli/protocol/messages/listUsers.d.ts +52 -0
- package/dist-cli/protocol/messages/listUsers.js +33 -0
- package/dist-cli/protocol/messages/messagePayload.d.ts +19 -0
- package/dist-cli/protocol/messages/messagePayload.js +1 -0
- package/dist-cli/protocol/messages/openExternalUrl.d.ts +32 -0
- package/dist-cli/protocol/messages/openExternalUrl.js +26 -0
- package/dist-cli/protocol/messages/openPage.d.ts +38 -0
- package/dist-cli/protocol/messages/openPage.js +34 -0
- package/dist-cli/protocol/messages/pageChanged.d.ts +32 -0
- package/dist-cli/protocol/messages/pageChanged.js +9 -0
- package/dist-cli/protocol/messages/parentChanged.d.ts +26 -0
- package/dist-cli/protocol/messages/parentChanged.js +9 -0
- package/dist-cli/protocol/messages/queryDataSource.d.ts +1446 -0
- package/dist-cli/protocol/messages/queryDataSource.js +252 -0
- package/dist-cli/protocol/messages/queryDataSourceResult.d.ts +686 -0
- package/dist-cli/protocol/messages/queryDataSourceResult.js +44 -0
- package/dist-cli/protocol/messages/resize.d.ts +11 -0
- package/dist-cli/protocol/messages/resize.js +10 -0
- package/dist-cli/protocol/messages/sandboxToHost.d.ts +1091 -0
- package/dist-cli/protocol/messages/sandboxToHost.js +33 -0
- package/dist-cli/protocol/messages/themeChanged.d.ts +10 -0
- package/dist-cli/protocol/messages/themeChanged.js +10 -0
- package/dist-cli/protocol/messages/unsubscribeDataSourceQuery.d.ts +10 -0
- package/dist-cli/protocol/messages/unsubscribeDataSourceQuery.js +9 -0
- package/dist-cli/protocol/messages/updatePage.d.ts +271 -0
- package/dist-cli/protocol/messages/updatePage.js +23 -0
- package/dist-cli/protocol/messages/updatePageResult.d.ts +895 -0
- package/dist-cli/protocol/messages/updatePageResult.js +41 -0
- package/dist-cli/protocol/pages/page.d.ts +1422 -0
- package/dist-cli/protocol/pages/page.js +318 -0
- package/dist-cli/protocol/parent.d.ts +32 -0
- package/dist-cli/protocol/parent.js +13 -0
- package/dist-cli/protocol/protocolVersion.d.ts +8 -0
- package/dist-cli/protocol/protocolVersion.js +11 -0
- package/dist-cli/protocol/theme.d.ts +3 -0
- package/dist-cli/protocol/theme.js +2 -0
- package/dist-cli/protocol/users/user.d.ts +32 -0
- package/dist-cli/protocol/users/user.js +20 -0
- package/dist-cli/shared/block-registry.js +28 -0
- package/dist-cli/shared/data-source.js +22 -0
- package/dist-cli/shared/runtime-config.js +10 -0
- package/dist-cli/shared/sample-data-source.js +12 -0
- package/docs/bindings.md +79 -27
- package/package.json +5 -26
- package/dist/assets/index-DgQZ0zg6.js +0 -11
- package/dist-cli/date-value.js +0 -46
- package/dist-cli/resolve-bindings.js +0 -39
- package/dist-cli/source-bindings.js +0 -17
- /package/dist-cli/{block-csp.js → cli/block-csp.js} +0 -0
- /package/dist-cli/{dev-shell-run.js → cli/dev-shell-run.js} +0 -0
- /package/dist-cli/{materialize.js → cli/materialize.js} +0 -0
- /package/dist-cli/{ports.js → cli/ports.js} +0 -0
- /package/dist-cli/{prebuilt.js → cli/prebuilt.js} +0 -0
- /package/dist-cli/{runtime-error-client.js → cli/runtime-error-client.js} +0 -0
- /package/dist-cli/{serve-ui.js → cli/serve-ui.js} +0 -0
- /package/dist-cli/{shared-server.js → cli/shared-server.js} +0 -0
- /package/dist-cli/{utils.js → cli/utils.js} +0 -0
- /package/dist-cli/{vite-block-server.js → cli/vite-block-server.js} +0 -0
- /package/dist-cli/{vite-middleware.js → cli/vite-middleware.js} +0 -0
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Custom blocks dev shell
|
|
2
2
|
|
|
3
|
-
The dev shell runs custom blocks in a local mock Notion host. It
|
|
4
|
-
|
|
3
|
+
The dev shell runs custom blocks in a local mock Notion host. It builds your worker and previews its
|
|
4
|
+
blocks with local sample data. Use it before `ntn workers deploy`.
|
|
5
5
|
|
|
6
6
|
## Usage
|
|
7
7
|
|
|
@@ -35,11 +35,33 @@ 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
|
+
### Options
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
ntn workers customblocks dev -- \
|
|
42
|
+
--bind task-board.tasks=sample_tasks.json \
|
|
43
|
+
--bind-property task-board.tasks.title=task_name
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The `--` separator is required to forward options through `ntn`. Omit it when running
|
|
47
|
+
`custom-blocks-dev-shell` directly.
|
|
48
|
+
|
|
49
|
+
- `[path]`: Select a worker directory instead of using the current directory.
|
|
50
|
+
- `--port <port>`: Require this port for the whole run. If occupied, the command fails with an
|
|
51
|
+
explanation. Omit this option to enable automatic fallback.
|
|
52
|
+
- `--bind <capabilityKey>.<dataSourceKey>=<sampleDataFileName>`: Choose sample data. Repeat for
|
|
53
|
+
multiple slots.
|
|
54
|
+
- `--bind-property <capabilityKey>.<dataSourceKey>.<propertyKey>=<sourcePropertyKey>`: Map a block
|
|
55
|
+
property to a sample schema property. Repeat for multiple properties. Explicit mappings override
|
|
56
|
+
automatic matches.
|
|
57
|
+
|
|
58
|
+
See [bindings](./docs/bindings.md) for source selection and property mapping rules.
|
|
59
|
+
|
|
38
60
|
### Browser restrictions
|
|
39
61
|
|
|
40
|
-
The preview iframe uses the
|
|
41
|
-
`allow="clipboard-write"`. Forms, popups, top-level
|
|
42
|
-
blocked.
|
|
62
|
+
The preview iframe uses the same sandbox attributes as production:
|
|
63
|
+
`allow-scripts allow-same-origin`, with `allow="clipboard-write"`. Forms, popups, top-level
|
|
64
|
+
navigation, downloads, and modal dialogs are blocked.
|
|
43
65
|
|
|
44
66
|
The shell and each block use separate origins, so a block cannot access the shell's DOM or storage.
|
|
45
67
|
Instances of the same block share `localStorage`; `sessionStorage` is also scoped to the browser
|
|
@@ -87,15 +109,6 @@ create a new host and iframe.
|
|
|
87
109
|
supports only HTTP and HTTPS; other schemes return `invalid_url` without showing a prompt.
|
|
88
110
|
Production Notion also applies its existing URL sanitizer.
|
|
89
111
|
|
|
90
|
-
### Options
|
|
91
|
-
|
|
92
|
-
- `[path]`: Select a worker directory instead of using the current directory.
|
|
93
|
-
- `--port <port>`: Require this port for the whole run. If occupied, the command fails with an
|
|
94
|
-
explanation. Omit this option to enable automatic fallback.
|
|
95
|
-
- `-- --bind <capabilityKey>.<dataSourceKey>=<sampleDataFileName>`: Choose sample data. Repeat for
|
|
96
|
-
multiple slots. The `--` is required for forwarding through `ntn`. See
|
|
97
|
-
[bindings](./docs/bindings.md) for an example.
|
|
98
|
-
|
|
99
112
|
## Documentation
|
|
100
113
|
|
|
101
114
|
These docs ship with the package and are available from `node_modules`:
|
package/bin/cli.js
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* The package exposes this file as its CLI entry point. Keep the wrapper dependency-free.
|
|
6
6
|
*/
|
|
7
7
|
try {
|
|
8
|
-
await import(
|
|
8
|
+
await import(
|
|
9
|
+
new URL("../dist-cli/cli/published-cli.js", import.meta.url).href
|
|
10
|
+
)
|
|
9
11
|
} catch (error) {
|
|
10
12
|
if (
|
|
11
13
|
error instanceof Error &&
|