@notionhq/custom-blocks-dev-shell 0.1.114 → 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-F02ZboyS.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
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { legacyNotionDataSourcePageBridgeSchema } from "../dataSources/dataSourcePage.js";
|
|
3
|
+
import { notionPageDataSchema } from "../pages/page.js";
|
|
4
|
+
// The schema accepts any string code. The type lists known codes for
|
|
5
|
+
// autocomplete, with an open string fallback for newer senders.
|
|
6
|
+
export const customBlockQueryDataSourceErrorCodeSchema = v.string();
|
|
7
|
+
export const customBlockQueryDataSourceErrorInfoSchema = v.object({
|
|
8
|
+
code: customBlockQueryDataSourceErrorCodeSchema,
|
|
9
|
+
message: v.string(),
|
|
10
|
+
isRetryable: v.boolean(),
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Message sent by the host to update a `queryDataSource` subscription.
|
|
14
|
+
*/
|
|
15
|
+
export const queryDataSourceResultMessageSchema = v.variant("status", [
|
|
16
|
+
v.object({
|
|
17
|
+
type: v.literal("queryDataSourceResult"),
|
|
18
|
+
subscriptionId: v.string(),
|
|
19
|
+
status: v.literal("success"),
|
|
20
|
+
items: v.array(notionPageDataSchema),
|
|
21
|
+
hasMore: v.boolean(),
|
|
22
|
+
}),
|
|
23
|
+
v.object({
|
|
24
|
+
type: v.literal("queryDataSourceResult"),
|
|
25
|
+
subscriptionId: v.string(),
|
|
26
|
+
status: v.literal("error"),
|
|
27
|
+
error: customBlockQueryDataSourceErrorInfoSchema,
|
|
28
|
+
}),
|
|
29
|
+
]);
|
|
30
|
+
export const queryDataSourceResultMessageLegacySchema = v.variant("status", [
|
|
31
|
+
v.object({
|
|
32
|
+
type: v.literal("queryDataSourceResult"),
|
|
33
|
+
subscriptionId: v.string(),
|
|
34
|
+
status: v.literal("success"),
|
|
35
|
+
items: v.array(v.union([notionPageDataSchema, legacyNotionDataSourcePageBridgeSchema])),
|
|
36
|
+
hasMore: v.boolean(),
|
|
37
|
+
}),
|
|
38
|
+
v.object({
|
|
39
|
+
type: v.literal("queryDataSourceResult"),
|
|
40
|
+
subscriptionId: v.string(),
|
|
41
|
+
status: v.literal("error"),
|
|
42
|
+
error: customBlockQueryDataSourceErrorInfoSchema,
|
|
43
|
+
}),
|
|
44
|
+
]);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/**
|
|
3
|
+
* Message sent by the sandbox whenever its measured content height changes, so the host can resize
|
|
4
|
+
* the surrounding iframe to match. The host is free to clamp the value or ignore it. The sandbox
|
|
5
|
+
* always reports the most recent measurement.
|
|
6
|
+
*/
|
|
7
|
+
export declare const resizeMessageSchema: v.ObjectSchema<{
|
|
8
|
+
readonly type: v.LiteralSchema<"resize", undefined>;
|
|
9
|
+
readonly height: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
10
|
+
}, undefined>;
|
|
11
|
+
export type ResizeMessage = v.InferOutput<typeof resizeMessageSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/**
|
|
3
|
+
* Message sent by the sandbox whenever its measured content height changes, so the host can resize
|
|
4
|
+
* the surrounding iframe to match. The host is free to clamp the value or ignore it. The sandbox
|
|
5
|
+
* always reports the most recent measurement.
|
|
6
|
+
*/
|
|
7
|
+
export const resizeMessageSchema = v.object({
|
|
8
|
+
type: v.literal("resize"),
|
|
9
|
+
height: v.pipe(v.number(), v.finite(), v.minValue(0)),
|
|
10
|
+
});
|