@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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { notionDataSourceIdSchema, notionPageIdSchema } from "../ids.js";
|
|
3
|
+
import { legacyNotionPageSchema, 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 customBlockGetPageErrorCodeSchema = v.string();
|
|
7
|
+
export const customBlockGetPageErrorInfoSchema = v.object({
|
|
8
|
+
code: customBlockGetPageErrorCodeSchema,
|
|
9
|
+
message: v.string(),
|
|
10
|
+
isRetryable: v.boolean(),
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Sandbox -> host: fetch a page by ID.
|
|
14
|
+
*/
|
|
15
|
+
export const getPageMessageSchema = v.object({
|
|
16
|
+
type: v.literal("getPage"),
|
|
17
|
+
requestId: v.string(),
|
|
18
|
+
pageId: notionPageIdSchema,
|
|
19
|
+
dataSourceId: v.optional(notionDataSourceIdSchema),
|
|
20
|
+
});
|
|
21
|
+
export const getPageResultMessageSchema = v.variant("status", [
|
|
22
|
+
v.object({
|
|
23
|
+
type: v.literal("getPageResult"),
|
|
24
|
+
requestId: v.string(),
|
|
25
|
+
status: v.literal("success"),
|
|
26
|
+
page: notionPageDataSchema,
|
|
27
|
+
}),
|
|
28
|
+
v.object({
|
|
29
|
+
type: v.literal("getPageResult"),
|
|
30
|
+
requestId: v.string(),
|
|
31
|
+
status: v.literal("error"),
|
|
32
|
+
error: customBlockGetPageErrorInfoSchema,
|
|
33
|
+
}),
|
|
34
|
+
]);
|
|
35
|
+
export const getPageResultMessageLegacySchema = v.variant("status", [
|
|
36
|
+
v.object({
|
|
37
|
+
type: v.literal("getPageResult"),
|
|
38
|
+
requestId: v.string(),
|
|
39
|
+
status: v.literal("success"),
|
|
40
|
+
page: v.union([notionPageDataSchema, legacyNotionPageSchema]),
|
|
41
|
+
}),
|
|
42
|
+
v.object({
|
|
43
|
+
type: v.literal("getPageResult"),
|
|
44
|
+
requestId: v.string(),
|
|
45
|
+
status: v.literal("error"),
|
|
46
|
+
error: customBlockGetPageErrorInfoSchema,
|
|
47
|
+
}),
|
|
48
|
+
]);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import type { CustomBlockErrorCode, CustomBlockErrorInfo } from "../errors.js";
|
|
3
|
+
export declare const customBlockGetUserErrorCodeSchema: v.StringSchema<undefined>;
|
|
4
|
+
export type CustomBlockGetUserErrorCode = CustomBlockErrorCode<"get_user_failed">;
|
|
5
|
+
export type CustomBlockGetUserErrorInfo = CustomBlockErrorInfo<CustomBlockGetUserErrorCode>;
|
|
6
|
+
export declare const customBlockGetUserErrorInfoSchema: v.ObjectSchema<{
|
|
7
|
+
readonly code: v.StringSchema<undefined>;
|
|
8
|
+
readonly message: v.StringSchema<undefined>;
|
|
9
|
+
readonly isRetryable: v.BooleanSchema<undefined>;
|
|
10
|
+
}, undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* Sandbox -> host: fetch a user by ID.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getUserMessageSchema: v.ObjectSchema<{
|
|
15
|
+
readonly type: v.LiteralSchema<"getUser", undefined>;
|
|
16
|
+
readonly requestId: v.StringSchema<undefined>;
|
|
17
|
+
readonly userId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionUserId">]>;
|
|
18
|
+
}, undefined>;
|
|
19
|
+
export type GetUserMessage = v.InferOutput<typeof getUserMessageSchema>;
|
|
20
|
+
export declare const getUserResultMessageSchema: v.VariantSchema<"status", [v.ObjectSchema<{
|
|
21
|
+
readonly type: v.LiteralSchema<"getUserResult", undefined>;
|
|
22
|
+
readonly requestId: v.StringSchema<undefined>;
|
|
23
|
+
readonly status: v.LiteralSchema<"success", undefined>;
|
|
24
|
+
readonly user: v.ObjectSchema<{
|
|
25
|
+
readonly object: v.LiteralSchema<"user", undefined>;
|
|
26
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionUserId">]>;
|
|
27
|
+
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
28
|
+
readonly avatar_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
29
|
+
readonly type: v.LiteralSchema<"person", undefined>;
|
|
30
|
+
readonly person: v.ObjectSchema<{
|
|
31
|
+
readonly email: v.StringSchema<undefined>;
|
|
32
|
+
}, undefined>;
|
|
33
|
+
}, undefined>;
|
|
34
|
+
}, undefined>, v.ObjectSchema<{
|
|
35
|
+
readonly type: v.LiteralSchema<"getUserResult", undefined>;
|
|
36
|
+
readonly requestId: v.StringSchema<undefined>;
|
|
37
|
+
readonly status: v.LiteralSchema<"error", undefined>;
|
|
38
|
+
readonly error: v.ObjectSchema<{
|
|
39
|
+
readonly code: v.StringSchema<undefined>;
|
|
40
|
+
readonly message: v.StringSchema<undefined>;
|
|
41
|
+
readonly isRetryable: v.BooleanSchema<undefined>;
|
|
42
|
+
}, undefined>;
|
|
43
|
+
}, undefined>], undefined>;
|
|
44
|
+
export type GetUserResultMessage = v.InferOutput<typeof getUserResultMessageSchema>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { notionUserIdSchema, notionUserSchema } from "../users/user.js";
|
|
3
|
+
// The schema accepts any string code. The type lists known codes for
|
|
4
|
+
// autocomplete, with an open string fallback for newer senders.
|
|
5
|
+
export const customBlockGetUserErrorCodeSchema = v.string();
|
|
6
|
+
export const customBlockGetUserErrorInfoSchema = v.object({
|
|
7
|
+
code: customBlockGetUserErrorCodeSchema,
|
|
8
|
+
message: v.string(),
|
|
9
|
+
isRetryable: v.boolean(),
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Sandbox -> host: fetch a user by ID.
|
|
13
|
+
*/
|
|
14
|
+
export const getUserMessageSchema = v.object({
|
|
15
|
+
type: v.literal("getUser"),
|
|
16
|
+
requestId: v.string(),
|
|
17
|
+
userId: notionUserIdSchema,
|
|
18
|
+
});
|
|
19
|
+
export const getUserResultMessageSchema = v.variant("status", [
|
|
20
|
+
v.object({
|
|
21
|
+
type: v.literal("getUserResult"),
|
|
22
|
+
requestId: v.string(),
|
|
23
|
+
status: v.literal("success"),
|
|
24
|
+
user: notionUserSchema,
|
|
25
|
+
}),
|
|
26
|
+
v.object({
|
|
27
|
+
type: v.literal("getUserResult"),
|
|
28
|
+
requestId: v.string(),
|
|
29
|
+
status: v.literal("error"),
|
|
30
|
+
error: customBlockGetUserErrorInfoSchema,
|
|
31
|
+
}),
|
|
32
|
+
]);
|