@notionhq/custom-blocks-host 0.3.11 → 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/LICENSE +21 -0
- package/README.md +143 -236
- package/THIRD_PARTY_LICENSES.md +9 -0
- package/dist/autoBindProperties.d.ts +5 -2
- package/dist/autoBindProperties.d.ts.map +1 -1
- package/dist/autoBindProperties.js +5 -2
- package/dist/browser.js +1 -1
- package/dist/compatibility/addMetadataReadSchemasForProtocol3To4.d.ts +1215 -0
- package/dist/compatibility/addMetadataReadSchemasForProtocol3To4.d.ts.map +1 -0
- package/dist/compatibility/addMetadataReadSchemasForProtocol3To4.js +27 -0
- package/dist/compatibility/normalizeHostToSandboxMessage.d.ts +8 -0
- package/dist/compatibility/normalizeHostToSandboxMessage.d.ts.map +1 -0
- package/dist/compatibility/normalizeHostToSandboxMessage.js +39 -0
- package/dist/compatibility/normalizePageResultsForProtocol3To5.d.ts +11 -0
- package/dist/compatibility/normalizePageResultsForProtocol3To5.d.ts.map +1 -0
- package/dist/compatibility/normalizePageResultsForProtocol3To5.js +18 -0
- package/dist/compatibility/normalizePageResultsForProtocol6.d.ts +9 -0
- package/dist/compatibility/normalizePageResultsForProtocol6.d.ts.map +1 -0
- package/dist/compatibility/normalizePageResultsForProtocol6.js +18 -0
- package/dist/compatibility/normalizeSandboxToHostMessage.d.ts +1099 -0
- package/dist/compatibility/normalizeSandboxToHostMessage.d.ts.map +1 -0
- package/dist/compatibility/normalizeSandboxToHostMessage.js +9 -0
- package/dist/compatibility/pageForProtocol3To5.d.ts +159 -0
- package/dist/compatibility/pageForProtocol3To5.d.ts.map +1 -0
- package/dist/{lifecycle/legacyPage.js → compatibility/pageForProtocol3To5.js} +50 -9
- package/dist/compatibility/pageResult.d.ts +11 -0
- package/dist/compatibility/pageResult.d.ts.map +1 -0
- package/dist/compatibility/pageWithNullTextFallbackProperties.d.ts +9 -0
- package/dist/compatibility/pageWithNullTextFallbackProperties.d.ts.map +1 -0
- package/dist/compatibility/pageWithNullTextFallbackProperties.js +46 -0
- package/dist/createCustomBlockHost.d.ts +18 -19
- package/dist/createCustomBlockHost.d.ts.map +1 -1
- package/dist/createCustomBlockHost.js +103 -38
- package/dist/index.d.ts +2 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/{localBlockUrl.d.ts → isAllowedLocalPreviewUrl.d.ts} +2 -2
- package/dist/isAllowedLocalPreviewUrl.d.ts.map +1 -0
- package/dist/{localBlockUrl.js → isAllowedLocalPreviewUrl.js} +3 -7
- package/dist/lifecycle/initErrors.d.ts +1 -0
- package/dist/lifecycle/initErrors.d.ts.map +1 -1
- package/dist/lifecycle/initErrors.js +7 -0
- package/dist/lifecycle/initializationController.d.ts +6 -4
- package/dist/lifecycle/initializationController.d.ts.map +1 -1
- package/dist/lifecycle/initializationController.js +24 -15
- package/dist/lifecycle/resolveManifest.d.ts +13 -0
- package/dist/lifecycle/resolveManifest.d.ts.map +1 -0
- package/dist/lifecycle/resolveManifest.js +21 -0
- package/dist/lifecycle/types.d.ts +1637 -17
- package/dist/lifecycle/types.d.ts.map +1 -1
- package/dist/lifecycle/types.js +18 -0
- package/dist/messages/sandboxMessageRouter.d.ts.map +1 -1
- package/dist/messages/sandboxMessageRouter.js +2 -2
- package/dist/protocol/dataSources/dataSourcePage.d.ts +3 -4
- package/dist/protocol/dataSources/dataSourcePage.js +2 -3
- package/dist/protocol/index.d.ts +1 -0
- package/dist/protocol/index.js +1 -0
- package/dist/protocol/isLocalBlockServerUrl.d.ts +2 -0
- package/dist/protocol/isLocalBlockServerUrl.js +9 -0
- package/dist/protocol/messages/connect.d.ts +2 -2
- package/dist/protocol/messages/connect.js +2 -2
- package/dist/protocol/messages/createPageResult.d.ts +2 -2
- package/dist/protocol/messages/createPageResult.js +3 -3
- package/dist/protocol/messages/getPage.d.ts +2 -2
- package/dist/protocol/messages/getPage.js +3 -3
- package/dist/protocol/messages/hostToSandbox.d.ts +3 -3
- package/dist/protocol/messages/hostToSandbox.js +10 -10
- package/dist/protocol/messages/init.d.ts +1 -1
- package/dist/protocol/messages/queryDataSource.d.ts +24 -0
- package/dist/protocol/messages/queryDataSource.js +2 -0
- package/dist/protocol/messages/queryDataSourceResult.d.ts +3 -3
- package/dist/protocol/messages/queryDataSourceResult.js +6 -3
- package/dist/protocol/messages/sandboxToHost.d.ts +8 -0
- package/dist/protocol/messages/updatePageResult.d.ts +2 -2
- package/dist/protocol/messages/updatePageResult.js +3 -3
- package/dist/protocol/pages/page.d.ts +2 -2
- package/dist/protocol/pages/page.js +1 -1
- package/dist/protocol/protocolVersion.d.ts +2 -2
- package/dist/protocol/protocolVersion.js +2 -2
- package/dist/protocol.d.ts +9 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +8 -0
- package/docs/bridge/changelog.md +67 -0
- package/docs/bridge/protocol.md +189 -0
- package/docs/bridge/versioning.md +38 -0
- package/docs/compatibility.md +68 -0
- package/docs/handlers.md +199 -0
- package/docs/lifecycle.md +117 -0
- package/package.json +10 -2
- package/src/autoBindProperties.ts +5 -2
- package/src/compatibility/addMetadataReadSchemasForProtocol3To4.ts +36 -0
- package/src/compatibility/normalizeHostToSandboxMessage.ts +54 -0
- package/src/compatibility/normalizePageResultsForProtocol3To5.ts +28 -0
- package/src/compatibility/normalizePageResultsForProtocol6.ts +23 -0
- package/src/compatibility/normalizeSandboxToHostMessage.ts +10 -0
- package/src/{lifecycle/legacyPage.ts → compatibility/pageForProtocol3To5.ts} +52 -11
- package/src/compatibility/pageResult.ts +18 -0
- package/src/compatibility/pageWithNullTextFallbackProperties.ts +53 -0
- package/src/createCustomBlockHost.ts +152 -62
- package/src/index.ts +4 -51
- package/src/{localBlockUrl.ts → isAllowedLocalPreviewUrl.ts} +4 -7
- package/src/lifecycle/initErrors.ts +9 -0
- package/src/lifecycle/initializationController.ts +34 -19
- package/src/lifecycle/resolveManifest.ts +31 -0
- package/src/lifecycle/types.ts +84 -16
- package/src/messages/sandboxMessageRouter.ts +2 -2
- package/src/protocol.ts +8 -0
- package/dist/lifecycle/legacyPage.d.ts +0 -70
- package/dist/lifecycle/legacyPage.d.ts.map +0 -1
- package/dist/lifecycle/loadCustomBlockManifest.d.ts +0 -16
- package/dist/lifecycle/loadCustomBlockManifest.d.ts.map +0 -1
- package/dist/lifecycle/loadCustomBlockManifest.js +0 -65
- package/dist/lifecycle/manifestOptions.d.ts +0 -17
- package/dist/lifecycle/manifestOptions.d.ts.map +0 -1
- package/dist/lifecycle/normalizeHostToSandboxMessage.d.ts +0 -6
- package/dist/lifecycle/normalizeHostToSandboxMessage.d.ts.map +0 -1
- package/dist/lifecycle/normalizeHostToSandboxMessage.js +0 -14
- package/dist/lifecycle/normalizePage.d.ts +0 -7
- package/dist/lifecycle/normalizePage.d.ts.map +0 -1
- package/dist/lifecycle/normalizePage.js +0 -47
- package/dist/localBlockUrl.d.ts.map +0 -1
- package/src/lifecycle/loadCustomBlockManifest.ts +0 -89
- package/src/lifecycle/manifestOptions.ts +0 -19
- package/src/lifecycle/normalizeHostToSandboxMessage.ts +0 -27
- package/src/lifecycle/normalizePage.ts +0 -71
- /package/dist/{lifecycle/manifestOptions.js → compatibility/pageResult.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lifecycle/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAA;AAE3G,OAAO,EACN,KAAK,mBAAmB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lifecycle/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAA;AAE3G,OAAO,EACN,KAAK,mBAAmB,EACxB,cAAc,EACd,MAAM,8CAA8C,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAA;AAC1F,OAAO,EACN,KAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAiCF,CAAA;AAEF,gGAAgG;AAChG,MAAM,MAAM,kCAAkC,GAC3C;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,YAAY,EAAE,IAAI,CAAC,2BAA2B,EAAE,UAAU,CAAC,CAAA;CAC1D,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,wBAAwB,CAAA;CAAE,CAAA;AAEvD,MAAM,MAAM,kCAAkC,GAAG,CAAC,IAAI,EAAE;IACvD,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,MAAM,EAAE,WAAW,CAAA;CACnB,KAAK,OAAO,CAAC,kCAAkC,CAAC,CAAA"}
|
package/dist/lifecycle/types.js
CHANGED
|
@@ -2,11 +2,19 @@ import { notionContrastModeSchema } from "../protocol/contrast.js";
|
|
|
2
2
|
import { notionDataSourceBindingsSchema } from "../protocol/dataSources/dataSource.js";
|
|
3
3
|
import { notionBlockIdSchema } from "../protocol/ids.js";
|
|
4
4
|
import { manifestSchema, } from "../protocol/manifest.js";
|
|
5
|
+
import { customBlockInitErrorInfoSchema, } from "../protocol/messages/init.js";
|
|
5
6
|
import { customBlockPageSchema } from "../protocol/pages/page.js";
|
|
6
7
|
import { notionParentSchema } from "../protocol/parent.js";
|
|
7
8
|
import { notionThemeSchema } from "../protocol/theme.js";
|
|
8
9
|
import { notionUserSchema } from "../protocol/users/user.js";
|
|
9
10
|
import * as v from "valibot";
|
|
11
|
+
export const customBlockHostManifestResultSchema = v.variant("status", [
|
|
12
|
+
v.object({ status: v.literal("success"), manifest: manifestSchema }),
|
|
13
|
+
v.object({
|
|
14
|
+
status: v.literal("error"),
|
|
15
|
+
error: customBlockInitErrorInfoSchema,
|
|
16
|
+
}),
|
|
17
|
+
]);
|
|
10
18
|
export const customBlockHostInitialStateSchema = v.object({
|
|
11
19
|
theme: notionThemeSchema,
|
|
12
20
|
/**
|
|
@@ -21,3 +29,13 @@ export const customBlockHostInitialStateSchema = v.object({
|
|
|
21
29
|
dataSources: v.object({ bindings: notionDataSourceBindingsSchema }),
|
|
22
30
|
currentUser: notionUserSchema,
|
|
23
31
|
});
|
|
32
|
+
export const customBlockHostPreparedStateResultSchema = v.variant("status", [
|
|
33
|
+
v.object({
|
|
34
|
+
status: v.literal("success"),
|
|
35
|
+
initialState: v.omit(customBlockHostInitialStateSchema, ["manifest"]),
|
|
36
|
+
}),
|
|
37
|
+
v.object({
|
|
38
|
+
status: v.literal("error"),
|
|
39
|
+
error: customBlockInitErrorInfoSchema,
|
|
40
|
+
}),
|
|
41
|
+
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandboxMessageRouter.d.ts","sourceRoot":"","sources":["../../src/messages/sandboxMessageRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAA;AAC1F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAA;AAChG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAA;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAA;AAC1F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAA;AAChG,OAAO,KAAK,EAAE,qBAAqB,EAAE,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G,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5D,WAAW,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAChE,YAAY,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAA;CAC1C,CAAA;AAED,wBAAgB,0BAA0B,CACzC,OAAO,EAAE,2BAA2B,GAClC,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CA0I/B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isInitHandshakeMessage } from "../protocol/messages/isInitHandshakeMessage.js";
|
|
2
|
-
import { sandboxToHostMessageSchema } from "../protocol/messages/sandboxToHost.js";
|
|
3
2
|
import * as v from "valibot";
|
|
3
|
+
import { normalizeSandboxToHostMessage } from "../compatibility/normalizeSandboxToHostMessage.js";
|
|
4
4
|
import { invalidConnectPayloadError, invalidInitResultPayloadError, } from "../lifecycle/initErrors.js";
|
|
5
5
|
import { unreachable } from "../utils.js";
|
|
6
6
|
import { getInvalidSandboxMessageResponse } from "./invalidSandboxMessage.js";
|
|
@@ -61,7 +61,7 @@ export function createSandboxMessageRouter(options) {
|
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
// Parse and validate the message from the sandbox.
|
|
64
|
-
const parsed =
|
|
64
|
+
const parsed = normalizeSandboxToHostMessage(event.data);
|
|
65
65
|
if (!parsed.success) {
|
|
66
66
|
onInvalidSandboxMessage(event.data, parsed.issues);
|
|
67
67
|
return;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* properties by raw property ID. Only actual schema properties are included.
|
|
3
|
+
* Query page shape for protocols 3–5, with flat values keyed by raw property ID.
|
|
5
4
|
*/
|
|
6
|
-
export declare const
|
|
5
|
+
export declare const notionDataSourcePageForProtocol3To5Schema: v.ObjectSchema<{
|
|
7
6
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
8
7
|
/** Whether the page or an ancestor is archived. */
|
|
9
8
|
readonly is_archived: v.BooleanSchema<undefined>;
|
|
@@ -71,4 +70,4 @@ export declare const legacyNotionDataSourcePageBridgeSchema: v.ObjectSchema<{
|
|
|
71
70
|
readonly table: v.StringSchema<undefined>;
|
|
72
71
|
}, undefined>, undefined>], undefined>, undefined>, undefined>;
|
|
73
72
|
}, undefined>;
|
|
74
|
-
export type
|
|
73
|
+
export type NotionDataSourcePageForProtocol3To5 = v.InferOutput<typeof notionDataSourcePageForProtocol3To5Schema>;
|
|
@@ -2,10 +2,9 @@ import * as v from "valibot";
|
|
|
2
2
|
import { notionPageIdSchema } from "../ids.js";
|
|
3
3
|
import { notionDataSourceValueSchema } from "./dataSourceValue.js";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* properties by raw property ID. Only actual schema properties are included.
|
|
5
|
+
* Query page shape for protocols 3–5, with flat values keyed by raw property ID.
|
|
7
6
|
*/
|
|
8
|
-
export const
|
|
7
|
+
export const notionDataSourcePageForProtocol3To5Schema = v.object({
|
|
9
8
|
id: notionPageIdSchema,
|
|
10
9
|
/** Whether the page or an ancestor is archived. */
|
|
11
10
|
is_archived: v.boolean(),
|
package/dist/protocol/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from "./dataSources/recordPointer.js";
|
|
|
16
16
|
export * from "./dataSources/sortDirection.js";
|
|
17
17
|
export * from "./errors.js";
|
|
18
18
|
export * from "./ids.js";
|
|
19
|
+
export { isLocalBlockServerUrl } from "./isLocalBlockServerUrl.js";
|
|
19
20
|
export * from "./manifest.js";
|
|
20
21
|
export * from "./messages/connect.js";
|
|
21
22
|
export * from "./messages/contrastModeChanged.js";
|
package/dist/protocol/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export * from "./dataSources/recordPointer.js";
|
|
|
16
16
|
export * from "./dataSources/sortDirection.js";
|
|
17
17
|
export * from "./errors.js";
|
|
18
18
|
export * from "./ids.js";
|
|
19
|
+
export { isLocalBlockServerUrl } from "./isLocalBlockServerUrl.js";
|
|
19
20
|
export * from "./manifest.js";
|
|
20
21
|
export * from "./messages/connect.js";
|
|
21
22
|
export * from "./messages/contrastModeChanged.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Accepts HTTP(S) block servers on localhost, *.localhost, or 127.0.0.1 without credentials. */
|
|
2
|
+
export function isLocalBlockServerUrl(url) {
|
|
3
|
+
return ((url.protocol === "http:" || url.protocol === "https:") &&
|
|
4
|
+
(url.hostname === "localhost" ||
|
|
5
|
+
url.hostname === "127.0.0.1" ||
|
|
6
|
+
url.hostname.endsWith(".localhost")) &&
|
|
7
|
+
url.username === "" &&
|
|
8
|
+
url.password === "");
|
|
9
|
+
}
|
|
@@ -10,8 +10,8 @@ export declare const connectMessageSchema: v.VariantSchema<"status", [v.ObjectSc
|
|
|
10
10
|
readonly sdkVersion: v.StringSchema<undefined>;
|
|
11
11
|
readonly status: v.LiteralSchema<"success", undefined>;
|
|
12
12
|
/**
|
|
13
|
-
* The
|
|
14
|
-
*
|
|
13
|
+
* The custom block manifest injected by local dev tooling. The SDK omits it on
|
|
14
|
+
* non-loopback origins. Initialization uses it only when manifestSource is "sandbox".
|
|
15
15
|
*/
|
|
16
16
|
readonly manifest: v.OptionalSchema<v.ObjectSchema<{
|
|
17
17
|
readonly version: v.LiteralSchema<1, undefined>;
|
|
@@ -25,8 +25,8 @@ export const connectMessageSchema = v.variant("status", [
|
|
|
25
25
|
v.object({
|
|
26
26
|
status: v.literal("success"),
|
|
27
27
|
/**
|
|
28
|
-
* The
|
|
29
|
-
*
|
|
28
|
+
* The custom block manifest injected by local dev tooling. The SDK omits it on
|
|
29
|
+
* non-loopback origins. Initialization uses it only when manifestSource is "sandbox".
|
|
30
30
|
*/
|
|
31
31
|
manifest: v.optional(manifestSchema),
|
|
32
32
|
...connectMessageCommonEntries,
|
|
@@ -314,7 +314,7 @@ export declare const createPageResultMessageSchema: v.VariantSchema<"status", [v
|
|
|
314
314
|
readonly isRetryable: v.BooleanSchema<undefined>;
|
|
315
315
|
}, undefined>;
|
|
316
316
|
}, undefined>], undefined>;
|
|
317
|
-
export declare const
|
|
317
|
+
export declare const createPageResultMessageWithProtocol3To5CompatibilitySchema: v.VariantSchema<"status", [v.ObjectSchema<{
|
|
318
318
|
readonly type: v.LiteralSchema<"createPageResult", undefined>;
|
|
319
319
|
readonly requestId: v.StringSchema<undefined>;
|
|
320
320
|
readonly status: v.LiteralSchema<"success", undefined>;
|
|
@@ -894,4 +894,4 @@ export declare const createPageResultMessageLegacySchema: v.VariantSchema<"statu
|
|
|
894
894
|
}, undefined>;
|
|
895
895
|
}, undefined>], undefined>;
|
|
896
896
|
export type CreatePageResultMessage = v.InferOutput<typeof createPageResultMessageSchema>;
|
|
897
|
-
export type
|
|
897
|
+
export type CreatePageResultMessageWithProtocol3To5Compatibility = v.InferOutput<typeof createPageResultMessageWithProtocol3To5CompatibilitySchema>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import {
|
|
2
|
+
import { notionPageDataSchema, notionPageForProtocol3To5Schema, } from "../pages/page.js";
|
|
3
3
|
// The schema accepts any string code. The type lists known codes for
|
|
4
4
|
// autocomplete, with an open string fallback for newer senders.
|
|
5
5
|
export const customBlockCreatePageErrorCodeSchema = v.string();
|
|
@@ -26,13 +26,13 @@ export const createPageResultMessageSchema = v.variant("status", [
|
|
|
26
26
|
error: customBlockCreatePageErrorInfoSchema,
|
|
27
27
|
}),
|
|
28
28
|
]);
|
|
29
|
-
export const
|
|
29
|
+
export const createPageResultMessageWithProtocol3To5CompatibilitySchema = v.variant("status", [
|
|
30
30
|
v.object({
|
|
31
31
|
type: v.literal("createPageResult"),
|
|
32
32
|
requestId: v.string(),
|
|
33
33
|
status: v.literal("success"),
|
|
34
34
|
/** The newly created page. */
|
|
35
|
-
page: v.union([notionPageDataSchema,
|
|
35
|
+
page: v.union([notionPageDataSchema, notionPageForProtocol3To5Schema]),
|
|
36
36
|
}),
|
|
37
37
|
v.object({
|
|
38
38
|
type: v.literal("createPageResult"),
|
|
@@ -320,7 +320,7 @@ export declare const getPageResultMessageSchema: v.VariantSchema<"status", [v.Ob
|
|
|
320
320
|
readonly isRetryable: v.BooleanSchema<undefined>;
|
|
321
321
|
}, undefined>;
|
|
322
322
|
}, undefined>], undefined>;
|
|
323
|
-
export declare const
|
|
323
|
+
export declare const getPageResultMessageWithProtocol3To5CompatibilitySchema: v.VariantSchema<"status", [v.ObjectSchema<{
|
|
324
324
|
readonly type: v.LiteralSchema<"getPageResult", undefined>;
|
|
325
325
|
readonly requestId: v.StringSchema<undefined>;
|
|
326
326
|
readonly status: v.LiteralSchema<"success", undefined>;
|
|
@@ -899,4 +899,4 @@ export declare const getPageResultMessageLegacySchema: v.VariantSchema<"status",
|
|
|
899
899
|
}, undefined>;
|
|
900
900
|
}, undefined>], undefined>;
|
|
901
901
|
export type GetPageResultMessage = v.InferOutput<typeof getPageResultMessageSchema>;
|
|
902
|
-
export type
|
|
902
|
+
export type GetPageResultMessageWithProtocol3To5Compatibility = v.InferOutput<typeof getPageResultMessageWithProtocol3To5CompatibilitySchema>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { notionDataSourceIdSchema, notionPageIdSchema } from "../ids.js";
|
|
3
|
-
import {
|
|
3
|
+
import { notionPageDataSchema, notionPageForProtocol3To5Schema, } from "../pages/page.js";
|
|
4
4
|
// The schema accepts any string code. The type lists known codes for
|
|
5
5
|
// autocomplete, with an open string fallback for newer senders.
|
|
6
6
|
export const customBlockGetPageErrorCodeSchema = v.string();
|
|
@@ -32,12 +32,12 @@ export const getPageResultMessageSchema = v.variant("status", [
|
|
|
32
32
|
error: customBlockGetPageErrorInfoSchema,
|
|
33
33
|
}),
|
|
34
34
|
]);
|
|
35
|
-
export const
|
|
35
|
+
export const getPageResultMessageWithProtocol3To5CompatibilitySchema = v.variant("status", [
|
|
36
36
|
v.object({
|
|
37
37
|
type: v.literal("getPageResult"),
|
|
38
38
|
requestId: v.string(),
|
|
39
39
|
status: v.literal("success"),
|
|
40
|
-
page: v.union([notionPageDataSchema,
|
|
40
|
+
page: v.union([notionPageDataSchema, notionPageForProtocol3To5Schema]),
|
|
41
41
|
}),
|
|
42
42
|
v.object({
|
|
43
43
|
type: v.literal("getPageResult"),
|
|
@@ -1743,9 +1743,9 @@ export declare const hostToSandboxMessageSchema: v.VariantSchema<"type", [v.Vari
|
|
|
1743
1743
|
}, undefined>;
|
|
1744
1744
|
}, undefined>], undefined>], undefined>;
|
|
1745
1745
|
/**
|
|
1746
|
-
*
|
|
1746
|
+
* Host messages accepting both current page shapes and protocol 3–5 page shapes.
|
|
1747
1747
|
*/
|
|
1748
|
-
export declare const
|
|
1748
|
+
export declare const hostToSandboxMessageWithProtocol3To5CompatibilitySchema: v.VariantSchema<"type", [v.VariantSchema<"status", [v.ObjectSchema<{
|
|
1749
1749
|
readonly type: v.LiteralSchema<"init", undefined>;
|
|
1750
1750
|
readonly initializationId: v.StringSchema<undefined>;
|
|
1751
1751
|
readonly status: v.LiteralSchema<"success", undefined>;
|
|
@@ -4382,4 +4382,4 @@ export declare const hostToSandboxMessageLegacySchema: v.VariantSchema<"type", [
|
|
|
4382
4382
|
}, undefined>;
|
|
4383
4383
|
}, undefined>], undefined>], undefined>;
|
|
4384
4384
|
export type HostToSandboxMessage = v.InferOutput<typeof hostToSandboxMessageSchema>;
|
|
4385
|
-
export type
|
|
4385
|
+
export type HostToSandboxMessageWithProtocol3To5Compatibility = v.InferOutput<typeof hostToSandboxMessageWithProtocol3To5CompatibilitySchema>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { contrastModeChangedMessageSchema } from "./contrastModeChanged.js";
|
|
3
|
-
import {
|
|
3
|
+
import { createPageResultMessageSchema, createPageResultMessageWithProtocol3To5CompatibilitySchema, } from "./createPageResult.js";
|
|
4
4
|
import { currentUserChangedMessageSchema } from "./currentUserChanged.js";
|
|
5
5
|
import { dataSourcesChangedMessageSchema } from "./dataSourcesChanged.js";
|
|
6
|
-
import {
|
|
6
|
+
import { getPageResultMessageSchema, getPageResultMessageWithProtocol3To5CompatibilitySchema, } from "./getPage.js";
|
|
7
7
|
import { getUserResultMessageSchema } from "./getUser.js";
|
|
8
8
|
import { initMessageSchema } from "./init.js";
|
|
9
9
|
import { invalidSandboxMessageSchema } from "./invalidSandboxMessage.js";
|
|
@@ -12,9 +12,9 @@ import { openExternalUrlResultMessageSchema } from "./openExternalUrl.js";
|
|
|
12
12
|
import { openPageResultMessageSchema } from "./openPage.js";
|
|
13
13
|
import { pageChangedMessageSchema } from "./pageChanged.js";
|
|
14
14
|
import { parentChangedMessageSchema } from "./parentChanged.js";
|
|
15
|
-
import {
|
|
15
|
+
import { queryDataSourceResultMessageSchema, queryDataSourceResultMessageWithProtocol3To5CompatibilitySchema, } from "./queryDataSourceResult.js";
|
|
16
16
|
import { themeChangedMessageSchema } from "./themeChanged.js";
|
|
17
|
-
import {
|
|
17
|
+
import { updatePageResultMessageSchema, updatePageResultMessageWithProtocol3To5CompatibilitySchema, } from "./updatePageResult.js";
|
|
18
18
|
const baseHostToSandboxMessageSchema = v.variant("type", [
|
|
19
19
|
initMessageSchema,
|
|
20
20
|
themeChangedMessageSchema,
|
|
@@ -37,12 +37,12 @@ export const hostToSandboxMessageSchema = v.variant("type", [
|
|
|
37
37
|
updatePageResultMessageSchema,
|
|
38
38
|
]);
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Host messages accepting both current page shapes and protocol 3–5 page shapes.
|
|
41
41
|
*/
|
|
42
|
-
export const
|
|
42
|
+
export const hostToSandboxMessageWithProtocol3To5CompatibilitySchema = v.variant("type", [
|
|
43
43
|
...baseHostToSandboxMessageSchema.options,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
queryDataSourceResultMessageWithProtocol3To5CompatibilitySchema,
|
|
45
|
+
getPageResultMessageWithProtocol3To5CompatibilitySchema,
|
|
46
|
+
createPageResultMessageWithProtocol3To5CompatibilitySchema,
|
|
47
|
+
updatePageResultMessageWithProtocol3To5CompatibilitySchema,
|
|
48
48
|
]);
|
|
@@ -2,7 +2,7 @@ import * as v from "valibot";
|
|
|
2
2
|
import type { CustomBlockErrorCode, CustomBlockErrorInfo } from "../errors.js";
|
|
3
3
|
import type { CustomBlockInitResultErrorCode } from "./initResult.js";
|
|
4
4
|
export declare const customBlockInitErrorCodeSchema: v.StringSchema<undefined>;
|
|
5
|
-
export type CustomBlockInitErrorCode = CustomBlockErrorCode<"manifest_unavailable" | "manifest_invalid" | "invalid_connect_payload" | "invalid_protocol_version" | "unsupported_protocol_version" | "init_timeout" | "context_unavailable" | "current_user_unavailable" | "initial_state_timeout" | "missing_data_source_binding" | "data_source_unavailable" | "missing_property_binding" | "invalid_property_binding">;
|
|
5
|
+
export type CustomBlockInitErrorCode = CustomBlockErrorCode<"manifest_unavailable" | "manifest_invalid" | "invalid_local_preview_url" | "invalid_connect_payload" | "invalid_protocol_version" | "unsupported_protocol_version" | "init_timeout" | "context_unavailable" | "current_user_unavailable" | "initial_state_timeout" | "missing_data_source_binding" | "data_source_unavailable" | "missing_property_binding" | "invalid_property_binding">;
|
|
6
6
|
export type CustomBlockInitErrorInfo = CustomBlockErrorInfo<CustomBlockInitErrorCode>;
|
|
7
7
|
/**
|
|
8
8
|
* Every initialization failure visible to block code. This combines errors
|
|
@@ -3,6 +3,10 @@ export declare const customBlockRelationFilterOperatorSchema: v.UnionSchema<[v.S
|
|
|
3
3
|
readonly contains: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
4
4
|
}, undefined>, v.StrictObjectSchema<{
|
|
5
5
|
readonly does_not_contain: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
6
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
7
|
+
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
8
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
9
|
+
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
6
10
|
}, undefined>], undefined>;
|
|
7
11
|
export type CustomBlockRelationFilterOperator = v.InferOutput<typeof customBlockRelationFilterOperatorSchema>;
|
|
8
12
|
declare const customBlockPersonFilterValueSchema: v.StrictObjectSchema<{
|
|
@@ -180,6 +184,10 @@ export declare const resolvedCustomBlockDataSourcePropertyFilterSchema: v.UnionS
|
|
|
180
184
|
readonly contains: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
181
185
|
}, undefined>, v.StrictObjectSchema<{
|
|
182
186
|
readonly does_not_contain: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
187
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
188
|
+
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
189
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
190
|
+
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
183
191
|
}, undefined>], undefined>;
|
|
184
192
|
}, undefined>, v.StrictObjectSchema<{
|
|
185
193
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -428,6 +436,10 @@ export declare const resolvedCustomBlockDataSourceFilterSchema: v.UnionSchema<[v
|
|
|
428
436
|
readonly contains: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
429
437
|
}, undefined>, v.StrictObjectSchema<{
|
|
430
438
|
readonly does_not_contain: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
439
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
440
|
+
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
441
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
442
|
+
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
431
443
|
}, undefined>], undefined>;
|
|
432
444
|
}, undefined>, v.StrictObjectSchema<{
|
|
433
445
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -675,6 +687,10 @@ export declare const resolvedCustomBlockDataSourceFilterSchema: v.UnionSchema<[v
|
|
|
675
687
|
readonly contains: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
676
688
|
}, undefined>, v.StrictObjectSchema<{
|
|
677
689
|
readonly does_not_contain: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
690
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
691
|
+
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
692
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
693
|
+
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
678
694
|
}, undefined>], undefined>;
|
|
679
695
|
}, undefined>, v.StrictObjectSchema<{
|
|
680
696
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -947,6 +963,10 @@ export declare const queryDataSourceMessageSchema: v.ObjectSchema<{
|
|
|
947
963
|
readonly contains: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
948
964
|
}, undefined>, v.StrictObjectSchema<{
|
|
949
965
|
readonly does_not_contain: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
966
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
967
|
+
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
968
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
969
|
+
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
950
970
|
}, undefined>], undefined>;
|
|
951
971
|
}, undefined>, v.StrictObjectSchema<{
|
|
952
972
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -1194,6 +1214,10 @@ export declare const queryDataSourceMessageSchema: v.ObjectSchema<{
|
|
|
1194
1214
|
readonly contains: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
1195
1215
|
}, undefined>, v.StrictObjectSchema<{
|
|
1196
1216
|
readonly does_not_contain: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
1217
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
1218
|
+
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
1219
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
1220
|
+
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
1197
1221
|
}, undefined>], undefined>;
|
|
1198
1222
|
}, undefined>, v.StrictObjectSchema<{
|
|
1199
1223
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -8,6 +8,8 @@ const relationPageIdSchema = v.pipe(notionPageIdSchema, v.regex(/^(?:[0-9a-f]{32
|
|
|
8
8
|
export const customBlockRelationFilterOperatorSchema = v.union([
|
|
9
9
|
v.strictObject({ contains: relationPageIdSchema }),
|
|
10
10
|
v.strictObject({ does_not_contain: relationPageIdSchema }),
|
|
11
|
+
v.strictObject({ is_empty: v.literal(true) }),
|
|
12
|
+
v.strictObject({ is_not_empty: v.literal(true) }),
|
|
11
13
|
]);
|
|
12
14
|
const emptyOperatorSchema = v.union([
|
|
13
15
|
v.strictObject({ is_empty: v.literal(true) }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import type { CustomBlockErrorCode, CustomBlockErrorInfo } from "../errors.js";
|
|
3
3
|
export declare const customBlockQueryDataSourceErrorCodeSchema: v.StringSchema<undefined>;
|
|
4
|
-
export type CustomBlockQueryDataSourceErrorCode = CustomBlockErrorCode<"query_data_source_failed" | "invalid_data_source_query" | "invalid_data_source_query_filter" | "invalid_data_source_query_sort" | "unknown_data_source_key" | "unmapped_data_source" | "data_source_schema_unavailable">;
|
|
4
|
+
export type CustomBlockQueryDataSourceErrorCode = CustomBlockErrorCode<"query_data_source_failed" | "invalid_data_source_query" | "data_source_query_invalid_limit" | "invalid_data_source_query_filter" | "invalid_data_source_query_sort" | "unknown_data_source_key" | "unmapped_data_source" | "data_source_schema_unavailable">;
|
|
5
5
|
export type CustomBlockQueryDataSourceErrorInfo = CustomBlockErrorInfo<CustomBlockQueryDataSourceErrorCode>;
|
|
6
6
|
export declare const customBlockQueryDataSourceErrorInfoSchema: v.ObjectSchema<{
|
|
7
7
|
readonly code: v.StringSchema<undefined>;
|
|
@@ -314,7 +314,7 @@ export declare const queryDataSourceResultMessageSchema: v.VariantSchema<"status
|
|
|
314
314
|
readonly isRetryable: v.BooleanSchema<undefined>;
|
|
315
315
|
}, undefined>;
|
|
316
316
|
}, undefined>], undefined>;
|
|
317
|
-
export declare const
|
|
317
|
+
export declare const queryDataSourceResultMessageWithProtocol3To5CompatibilitySchema: v.VariantSchema<"status", [v.ObjectSchema<{
|
|
318
318
|
readonly type: v.LiteralSchema<"queryDataSourceResult", undefined>;
|
|
319
319
|
readonly subscriptionId: v.StringSchema<undefined>;
|
|
320
320
|
readonly status: v.LiteralSchema<"success", undefined>;
|
|
@@ -683,4 +683,4 @@ export declare const queryDataSourceResultMessageLegacySchema: v.VariantSchema<"
|
|
|
683
683
|
}, undefined>;
|
|
684
684
|
}, undefined>], undefined>;
|
|
685
685
|
export type QueryDataSourceResultMessage = v.InferOutput<typeof queryDataSourceResultMessageSchema>;
|
|
686
|
-
export type
|
|
686
|
+
export type QueryDataSourceResultMessageWithProtocol3To5Compatibility = v.InferOutput<typeof queryDataSourceResultMessageWithProtocol3To5CompatibilitySchema>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import {
|
|
2
|
+
import { notionDataSourcePageForProtocol3To5Schema } from "../dataSources/dataSourcePage.js";
|
|
3
3
|
import { notionPageDataSchema } from "../pages/page.js";
|
|
4
4
|
// The schema accepts any string code. The type lists known codes for
|
|
5
5
|
// autocomplete, with an open string fallback for newer senders.
|
|
@@ -27,12 +27,15 @@ export const queryDataSourceResultMessageSchema = v.variant("status", [
|
|
|
27
27
|
error: customBlockQueryDataSourceErrorInfoSchema,
|
|
28
28
|
}),
|
|
29
29
|
]);
|
|
30
|
-
export const
|
|
30
|
+
export const queryDataSourceResultMessageWithProtocol3To5CompatibilitySchema = v.variant("status", [
|
|
31
31
|
v.object({
|
|
32
32
|
type: v.literal("queryDataSourceResult"),
|
|
33
33
|
subscriptionId: v.string(),
|
|
34
34
|
status: v.literal("success"),
|
|
35
|
-
items: v.array(v.union([
|
|
35
|
+
items: v.array(v.union([
|
|
36
|
+
notionPageDataSchema,
|
|
37
|
+
notionDataSourcePageForProtocol3To5Schema,
|
|
38
|
+
])),
|
|
36
39
|
hasMore: v.boolean(),
|
|
37
40
|
}),
|
|
38
41
|
v.object({
|
|
@@ -71,6 +71,10 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
|
|
|
71
71
|
readonly contains: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
72
72
|
}, undefined>, v.StrictObjectSchema<{
|
|
73
73
|
readonly does_not_contain: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
74
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
75
|
+
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
76
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
77
|
+
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
74
78
|
}, undefined>], undefined>;
|
|
75
79
|
}, undefined>, v.StrictObjectSchema<{
|
|
76
80
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -318,6 +322,10 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
|
|
|
318
322
|
readonly contains: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
319
323
|
}, undefined>, v.StrictObjectSchema<{
|
|
320
324
|
readonly does_not_contain: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>, v.RegexAction<string & v.Brand<"NotionPageId">, undefined>, v.TransformAction<string & v.Brand<"NotionPageId">, string>]>;
|
|
325
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
326
|
+
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
327
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
328
|
+
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
321
329
|
}, undefined>], undefined>;
|
|
322
330
|
}, undefined>, v.StrictObjectSchema<{
|
|
323
331
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -313,7 +313,7 @@ export declare const updatePageResultMessageSchema: v.VariantSchema<"status", [v
|
|
|
313
313
|
readonly isRetryable: v.BooleanSchema<undefined>;
|
|
314
314
|
}, undefined>;
|
|
315
315
|
}, undefined>], undefined>;
|
|
316
|
-
export declare const
|
|
316
|
+
export declare const updatePageResultMessageWithProtocol3To5CompatibilitySchema: v.VariantSchema<"status", [v.ObjectSchema<{
|
|
317
317
|
readonly type: v.LiteralSchema<"updatePageResult", undefined>;
|
|
318
318
|
readonly requestId: v.StringSchema<undefined>;
|
|
319
319
|
readonly status: v.LiteralSchema<"success", undefined>;
|
|
@@ -892,4 +892,4 @@ export declare const updatePageResultMessageLegacySchema: v.VariantSchema<"statu
|
|
|
892
892
|
}, undefined>;
|
|
893
893
|
}, undefined>], undefined>;
|
|
894
894
|
export type UpdatePageResultMessage = v.InferOutput<typeof updatePageResultMessageSchema>;
|
|
895
|
-
export type
|
|
895
|
+
export type UpdatePageResultMessageWithProtocol3To5Compatibility = v.InferOutput<typeof updatePageResultMessageWithProtocol3To5CompatibilitySchema>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import {
|
|
2
|
+
import { notionPageDataSchema, notionPageForProtocol3To5Schema, } from "../pages/page.js";
|
|
3
3
|
// The schema accepts any string code. The type lists known codes for
|
|
4
4
|
// autocomplete, with an open string fallback for newer senders.
|
|
5
5
|
export const customBlockUpdatePageErrorCodeSchema = v.string();
|
|
@@ -25,12 +25,12 @@ export const updatePageResultMessageSchema = v.variant("status", [
|
|
|
25
25
|
error: customBlockUpdatePageErrorInfoSchema,
|
|
26
26
|
}),
|
|
27
27
|
]);
|
|
28
|
-
export const
|
|
28
|
+
export const updatePageResultMessageWithProtocol3To5CompatibilitySchema = v.variant("status", [
|
|
29
29
|
v.object({
|
|
30
30
|
type: v.literal("updatePageResult"),
|
|
31
31
|
requestId: v.string(),
|
|
32
32
|
status: v.literal("success"),
|
|
33
|
-
page: v.union([notionPageDataSchema,
|
|
33
|
+
page: v.union([notionPageDataSchema, notionPageForProtocol3To5Schema]),
|
|
34
34
|
}),
|
|
35
35
|
v.object({
|
|
36
36
|
type: v.literal("updatePageResult"),
|
|
@@ -1139,7 +1139,7 @@ export declare const notionPageDataSchema: v.ObjectSchema<{
|
|
|
1139
1139
|
readonly in_trash: v.BooleanSchema<undefined>;
|
|
1140
1140
|
}, undefined>;
|
|
1141
1141
|
export type NotionPageData = v.InferInput<typeof notionPageDataSchema>;
|
|
1142
|
-
export declare const
|
|
1142
|
+
export declare const notionPageForProtocol3To5Schema: v.ObjectSchema<{
|
|
1143
1143
|
readonly object: v.LiteralSchema<"page", undefined>;
|
|
1144
1144
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
1145
1145
|
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
@@ -1418,5 +1418,5 @@ export declare const legacyNotionPageSchema: v.ObjectSchema<{
|
|
|
1418
1418
|
/** Whether the page or an ancestor is in Trash. */
|
|
1419
1419
|
readonly in_trash: v.BooleanSchema<undefined>;
|
|
1420
1420
|
}, undefined>;
|
|
1421
|
-
export type
|
|
1421
|
+
export type NotionPageForProtocol3To5 = v.InferOutput<typeof notionPageForProtocol3To5Schema>;
|
|
1422
1422
|
export {};
|
|
@@ -300,7 +300,7 @@ export const notionPageDataSchema = v.object({
|
|
|
300
300
|
/** Whether the page or an ancestor is in Trash. */
|
|
301
301
|
in_trash: v.boolean(),
|
|
302
302
|
});
|
|
303
|
-
export const
|
|
303
|
+
export const notionPageForProtocol3To5Schema = v.object({
|
|
304
304
|
object: v.literal("page"),
|
|
305
305
|
id: notionPageIdSchema,
|
|
306
306
|
parent: notionParentSchema,
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* Increase this value for breaking wire changes. Hosts can continue to accept
|
|
4
4
|
* older versions, so this value does not set the minimum or maximum they accept.
|
|
5
5
|
*/
|
|
6
|
-
export declare const LATEST_BRIDGE_PROTOCOL_VERSION =
|
|
7
|
-
export declare const
|
|
6
|
+
export declare const LATEST_BRIDGE_PROTOCOL_VERSION = 8;
|
|
7
|
+
export declare const UNIFIED_PAGE_PROTOCOL_VERSION = 6;
|
|
8
8
|
export declare const TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION = 7;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Increase this value for breaking wire changes. Hosts can continue to accept
|
|
4
4
|
* older versions, so this value does not set the minimum or maximum they accept.
|
|
5
5
|
*/
|
|
6
|
-
export const LATEST_BRIDGE_PROTOCOL_VERSION =
|
|
6
|
+
export const LATEST_BRIDGE_PROTOCOL_VERSION = 8;
|
|
7
7
|
// Protocol 6 introduces unified pages with name-keyed property objects.
|
|
8
8
|
// Keep this cutoff fixed when the latest protocol version increases.
|
|
9
|
-
export const
|
|
9
|
+
export const UNIFIED_PAGE_PROTOCOL_VERSION = 6;
|
|
10
10
|
// Protocol 7 adds typed text fallbacks for previously unsupported page properties.
|
|
11
11
|
export const TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION = 7;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The protocol package is private and is bundled into the published host package.
|
|
3
|
+
* This public /protocol entrypoint lets consumers use the schemas, types, and
|
|
4
|
+
* constants that ship with their host version without a separate protocol package.
|
|
5
|
+
*
|
|
6
|
+
* Keep wire definitions here so the package root stays focused on host APIs.
|
|
7
|
+
*/
|
|
8
|
+
export * from "./protocol/index.js";
|
|
9
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,kCAAkC,CAAA"}
|
package/dist/protocol.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The protocol package is private and is bundled into the published host package.
|
|
3
|
+
* This public /protocol entrypoint lets consumers use the schemas, types, and
|
|
4
|
+
* constants that ship with their host version without a separate protocol package.
|
|
5
|
+
*
|
|
6
|
+
* Keep wire definitions here so the package root stays focused on host APIs.
|
|
7
|
+
*/
|
|
8
|
+
export * from "./protocol/index.js";
|