@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,33 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { notionUserListSchema } 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 customBlockListUsersErrorCodeSchema = v.string();
|
|
6
|
+
export const customBlockListUsersErrorInfoSchema = v.object({
|
|
7
|
+
code: customBlockListUsersErrorCodeSchema,
|
|
8
|
+
message: v.string(),
|
|
9
|
+
isRetryable: v.boolean(),
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Sandbox -> host: list users visible in the custom block's workspace.
|
|
13
|
+
*/
|
|
14
|
+
export const listUsersMessageSchema = v.object({
|
|
15
|
+
type: v.literal("listUsers"),
|
|
16
|
+
requestId: v.string(),
|
|
17
|
+
startCursor: v.optional(v.string()),
|
|
18
|
+
pageSize: v.optional(v.number()),
|
|
19
|
+
});
|
|
20
|
+
export const listUsersResultMessageSchema = v.variant("status", [
|
|
21
|
+
v.object({
|
|
22
|
+
type: v.literal("listUsersResult"),
|
|
23
|
+
requestId: v.string(),
|
|
24
|
+
status: v.literal("success"),
|
|
25
|
+
list: notionUserListSchema,
|
|
26
|
+
}),
|
|
27
|
+
v.object({
|
|
28
|
+
type: v.literal("listUsersResult"),
|
|
29
|
+
requestId: v.string(),
|
|
30
|
+
status: v.literal("error"),
|
|
31
|
+
error: customBlockListUsersErrorInfoSchema,
|
|
32
|
+
}),
|
|
33
|
+
]);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CustomBlockErrorInfo } from "../errors.js";
|
|
2
|
+
type WithTypedErrorInfo<T, TErrorInfo extends CustomBlockErrorInfo | undefined> = TErrorInfo extends CustomBlockErrorInfo ? T extends {
|
|
3
|
+
error: CustomBlockErrorInfo;
|
|
4
|
+
} ? Omit<T, "error"> & {
|
|
5
|
+
error: TErrorInfo;
|
|
6
|
+
} : T : T;
|
|
7
|
+
/**
|
|
8
|
+
* Removes bridge envelope fields from every member of a message union.
|
|
9
|
+
*
|
|
10
|
+
* The conditional type makes the operation distributive, preserving
|
|
11
|
+
* success/error-specific fields such as `page` and `error`.
|
|
12
|
+
*
|
|
13
|
+
* Pass an API-specific error-info type to preserve its known error-code
|
|
14
|
+
* literals while still accepting unknown string codes at runtime.
|
|
15
|
+
*/
|
|
16
|
+
export type BridgeMessagePayload<T extends {
|
|
17
|
+
type: string;
|
|
18
|
+
}, TErrorInfo extends CustomBlockErrorInfo | undefined = undefined> = T extends unknown ? WithTypedErrorInfo<Omit<T, "type" | "requestId" | "subscriptionId">, TErrorInfo> : never;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import type { CustomBlockErrorCode, CustomBlockErrorInfo } from "../errors.js";
|
|
3
|
+
export declare const customBlockOpenExternalUrlErrorCodeSchema: v.StringSchema<undefined>;
|
|
4
|
+
export type CustomBlockOpenExternalUrlErrorCode = CustomBlockErrorCode<"user_decline" | "pending_navigation" | "invalid_url">;
|
|
5
|
+
export type CustomBlockOpenExternalUrlErrorInfo = CustomBlockErrorInfo<CustomBlockOpenExternalUrlErrorCode>;
|
|
6
|
+
export declare const customBlockOpenExternalUrlErrorInfoSchema: v.ObjectSchema<{
|
|
7
|
+
readonly code: v.StringSchema<undefined>;
|
|
8
|
+
readonly message: v.StringSchema<undefined>;
|
|
9
|
+
readonly isRetryable: v.BooleanSchema<undefined>;
|
|
10
|
+
}, undefined>;
|
|
11
|
+
/** Sandbox -> host: request approval to open an external URL. */
|
|
12
|
+
export declare const openExternalUrlMessageSchema: v.ObjectSchema<{
|
|
13
|
+
readonly type: v.LiteralSchema<"openExternalUrl", undefined>;
|
|
14
|
+
readonly requestId: v.StringSchema<undefined>;
|
|
15
|
+
readonly url: v.StringSchema<undefined>;
|
|
16
|
+
}, undefined>;
|
|
17
|
+
export type OpenExternalUrlMessage = v.InferOutput<typeof openExternalUrlMessageSchema>;
|
|
18
|
+
export declare const openExternalUrlResultMessageSchema: v.VariantSchema<"status", [v.ObjectSchema<{
|
|
19
|
+
readonly type: v.LiteralSchema<"openExternalUrlResult", undefined>;
|
|
20
|
+
readonly requestId: v.StringSchema<undefined>;
|
|
21
|
+
readonly status: v.LiteralSchema<"success", undefined>;
|
|
22
|
+
}, undefined>, v.ObjectSchema<{
|
|
23
|
+
readonly type: v.LiteralSchema<"openExternalUrlResult", undefined>;
|
|
24
|
+
readonly requestId: v.StringSchema<undefined>;
|
|
25
|
+
readonly status: v.LiteralSchema<"error", undefined>;
|
|
26
|
+
readonly error: v.ObjectSchema<{
|
|
27
|
+
readonly code: v.StringSchema<undefined>;
|
|
28
|
+
readonly message: v.StringSchema<undefined>;
|
|
29
|
+
readonly isRetryable: v.BooleanSchema<undefined>;
|
|
30
|
+
}, undefined>;
|
|
31
|
+
}, undefined>], undefined>;
|
|
32
|
+
export type OpenExternalUrlResultMessage = v.InferOutput<typeof openExternalUrlResultMessageSchema>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export const customBlockOpenExternalUrlErrorCodeSchema = v.string();
|
|
3
|
+
export const customBlockOpenExternalUrlErrorInfoSchema = v.object({
|
|
4
|
+
code: customBlockOpenExternalUrlErrorCodeSchema,
|
|
5
|
+
message: v.string(),
|
|
6
|
+
isRetryable: v.boolean(),
|
|
7
|
+
});
|
|
8
|
+
/** Sandbox -> host: request approval to open an external URL. */
|
|
9
|
+
export const openExternalUrlMessageSchema = v.object({
|
|
10
|
+
type: v.literal("openExternalUrl"),
|
|
11
|
+
requestId: v.string(),
|
|
12
|
+
url: v.string(),
|
|
13
|
+
});
|
|
14
|
+
export const openExternalUrlResultMessageSchema = v.variant("status", [
|
|
15
|
+
v.object({
|
|
16
|
+
type: v.literal("openExternalUrlResult"),
|
|
17
|
+
requestId: v.string(),
|
|
18
|
+
status: v.literal("success"),
|
|
19
|
+
}),
|
|
20
|
+
v.object({
|
|
21
|
+
type: v.literal("openExternalUrlResult"),
|
|
22
|
+
requestId: v.string(),
|
|
23
|
+
status: v.literal("error"),
|
|
24
|
+
error: customBlockOpenExternalUrlErrorInfoSchema,
|
|
25
|
+
}),
|
|
26
|
+
]);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import type { CustomBlockErrorCode, CustomBlockErrorInfo } from "../errors.js";
|
|
3
|
+
export declare const openPageModeSchema: v.PicklistSchema<["side_peek", "center_peek"], undefined>;
|
|
4
|
+
export type OpenPageMode = v.InferOutput<typeof openPageModeSchema>;
|
|
5
|
+
export declare const customBlockOpenPageErrorCodeSchema: v.StringSchema<undefined>;
|
|
6
|
+
export type CustomBlockOpenPageErrorCode = CustomBlockErrorCode<"open_page_failed" | "page_unavailable" | "navigation_unavailable">;
|
|
7
|
+
export type CustomBlockOpenPageErrorInfo = CustomBlockErrorInfo<CustomBlockOpenPageErrorCode>;
|
|
8
|
+
export declare const customBlockOpenPageErrorInfoSchema: v.ObjectSchema<{
|
|
9
|
+
readonly code: v.StringSchema<undefined>;
|
|
10
|
+
readonly message: v.StringSchema<undefined>;
|
|
11
|
+
readonly isRetryable: v.BooleanSchema<undefined>;
|
|
12
|
+
}, undefined>;
|
|
13
|
+
/**
|
|
14
|
+
* Sandbox -> host: request host-owned navigation to a readable Notion page.
|
|
15
|
+
*/
|
|
16
|
+
export declare const openPageMessageSchema: v.ObjectSchema<{
|
|
17
|
+
readonly type: v.LiteralSchema<"openPage", undefined>;
|
|
18
|
+
readonly requestId: v.StringSchema<undefined>;
|
|
19
|
+
readonly pageId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
20
|
+
readonly mode: v.PicklistSchema<["side_peek", "center_peek"], undefined>;
|
|
21
|
+
}, undefined>;
|
|
22
|
+
export type OpenPageMessage = v.InferOutput<typeof openPageMessageSchema>;
|
|
23
|
+
export declare const openPageResultMessageSchema: v.VariantSchema<"status", [v.ObjectSchema<{
|
|
24
|
+
readonly type: v.LiteralSchema<"openPageResult", undefined>;
|
|
25
|
+
readonly requestId: v.StringSchema<undefined>;
|
|
26
|
+
readonly status: v.LiteralSchema<"success", undefined>;
|
|
27
|
+
readonly pageId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
28
|
+
}, undefined>, v.ObjectSchema<{
|
|
29
|
+
readonly type: v.LiteralSchema<"openPageResult", undefined>;
|
|
30
|
+
readonly requestId: v.StringSchema<undefined>;
|
|
31
|
+
readonly status: v.LiteralSchema<"error", undefined>;
|
|
32
|
+
readonly error: v.ObjectSchema<{
|
|
33
|
+
readonly code: v.StringSchema<undefined>;
|
|
34
|
+
readonly message: v.StringSchema<undefined>;
|
|
35
|
+
readonly isRetryable: v.BooleanSchema<undefined>;
|
|
36
|
+
}, undefined>;
|
|
37
|
+
}, undefined>], undefined>;
|
|
38
|
+
export type OpenPageResultMessage = v.InferOutput<typeof openPageResultMessageSchema>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { notionPageIdSchema } from "../ids.js";
|
|
3
|
+
export const openPageModeSchema = v.picklist(["side_peek", "center_peek"]);
|
|
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 customBlockOpenPageErrorCodeSchema = v.string();
|
|
7
|
+
export const customBlockOpenPageErrorInfoSchema = v.object({
|
|
8
|
+
code: customBlockOpenPageErrorCodeSchema,
|
|
9
|
+
message: v.string(),
|
|
10
|
+
isRetryable: v.boolean(),
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Sandbox -> host: request host-owned navigation to a readable Notion page.
|
|
14
|
+
*/
|
|
15
|
+
export const openPageMessageSchema = v.object({
|
|
16
|
+
type: v.literal("openPage"),
|
|
17
|
+
requestId: v.string(),
|
|
18
|
+
pageId: notionPageIdSchema,
|
|
19
|
+
mode: openPageModeSchema,
|
|
20
|
+
});
|
|
21
|
+
export const openPageResultMessageSchema = v.variant("status", [
|
|
22
|
+
v.object({
|
|
23
|
+
type: v.literal("openPageResult"),
|
|
24
|
+
requestId: v.string(),
|
|
25
|
+
status: v.literal("success"),
|
|
26
|
+
pageId: notionPageIdSchema,
|
|
27
|
+
}),
|
|
28
|
+
v.object({
|
|
29
|
+
type: v.literal("openPageResult"),
|
|
30
|
+
requestId: v.string(),
|
|
31
|
+
status: v.literal("error"),
|
|
32
|
+
error: customBlockOpenPageErrorInfoSchema,
|
|
33
|
+
}),
|
|
34
|
+
]);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/**
|
|
3
|
+
* Message sent by the host whenever the custom block's nearest page ancestor changes.
|
|
4
|
+
*/
|
|
5
|
+
export declare const pageChangedMessageSchema: v.ObjectSchema<{
|
|
6
|
+
readonly type: v.LiteralSchema<"pageChanged", undefined>;
|
|
7
|
+
readonly page: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
8
|
+
readonly type: v.LiteralSchema<"unavailable", undefined>;
|
|
9
|
+
}, undefined>, v.ObjectSchema<{
|
|
10
|
+
readonly type: v.LiteralSchema<"page", undefined>;
|
|
11
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
12
|
+
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
13
|
+
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
14
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
15
|
+
}, undefined>, v.ObjectSchema<{
|
|
16
|
+
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
17
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
18
|
+
}, undefined>, v.ObjectSchema<{
|
|
19
|
+
readonly type: v.LiteralSchema<"workspace", undefined>;
|
|
20
|
+
readonly workspace: v.LiteralSchema<true, undefined>;
|
|
21
|
+
}, undefined>, v.ObjectSchema<{
|
|
22
|
+
readonly type: v.LiteralSchema<"block_id", undefined>;
|
|
23
|
+
readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
24
|
+
}, undefined>, v.ObjectSchema<{
|
|
25
|
+
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
26
|
+
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
27
|
+
}, undefined>, v.ObjectSchema<{
|
|
28
|
+
readonly type: v.LiteralSchema<"unavailable", undefined>;
|
|
29
|
+
}, undefined>], undefined>;
|
|
30
|
+
}, undefined>], undefined>;
|
|
31
|
+
}, undefined>;
|
|
32
|
+
export type PageChangedMessage = v.InferOutput<typeof pageChangedMessageSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { customBlockPageSchema } from "../pages/page.js";
|
|
3
|
+
/**
|
|
4
|
+
* Message sent by the host whenever the custom block's nearest page ancestor changes.
|
|
5
|
+
*/
|
|
6
|
+
export const pageChangedMessageSchema = v.object({
|
|
7
|
+
type: v.literal("pageChanged"),
|
|
8
|
+
page: customBlockPageSchema,
|
|
9
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/**
|
|
3
|
+
* Message sent by the host whenever the custom block's parent changes.
|
|
4
|
+
*/
|
|
5
|
+
export declare const parentChangedMessageSchema: v.ObjectSchema<{
|
|
6
|
+
readonly type: v.LiteralSchema<"parentChanged", undefined>;
|
|
7
|
+
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
8
|
+
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
9
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
10
|
+
}, undefined>, v.ObjectSchema<{
|
|
11
|
+
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
12
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
13
|
+
}, undefined>, v.ObjectSchema<{
|
|
14
|
+
readonly type: v.LiteralSchema<"workspace", undefined>;
|
|
15
|
+
readonly workspace: v.LiteralSchema<true, undefined>;
|
|
16
|
+
}, undefined>, v.ObjectSchema<{
|
|
17
|
+
readonly type: v.LiteralSchema<"block_id", undefined>;
|
|
18
|
+
readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
19
|
+
}, undefined>, v.ObjectSchema<{
|
|
20
|
+
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
21
|
+
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
22
|
+
}, undefined>, v.ObjectSchema<{
|
|
23
|
+
readonly type: v.LiteralSchema<"unavailable", undefined>;
|
|
24
|
+
}, undefined>], undefined>;
|
|
25
|
+
}, undefined>;
|
|
26
|
+
export type ParentChangedMessage = v.InferOutput<typeof parentChangedMessageSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { notionParentSchema } from "../parent.js";
|
|
3
|
+
/**
|
|
4
|
+
* Message sent by the host whenever the custom block's parent changes.
|
|
5
|
+
*/
|
|
6
|
+
export const parentChangedMessageSchema = v.object({
|
|
7
|
+
type: v.literal("parentChanged"),
|
|
8
|
+
parent: notionParentSchema,
|
|
9
|
+
});
|