@notionhq/custom-blocks 0.3.2 → 0.3.4

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.
Files changed (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -19
  3. package/dist/bridge/SandboxBridge.d.ts +0 -2
  4. package/dist/bridge/SandboxBridge.d.ts.map +1 -1
  5. package/dist/bridge/SandboxBridge.js +16 -39
  6. package/dist/bridge/SandboxInitialization.d.ts +1 -3
  7. package/dist/bridge/SandboxInitialization.d.ts.map +1 -1
  8. package/dist/bridge/SandboxInitialization.js +13 -15
  9. package/dist/bridge/appearance.d.ts +2 -10
  10. package/dist/bridge/appearance.d.ts.map +1 -1
  11. package/dist/bridge/appearance.js +2 -10
  12. package/dist/bridge/dataSources/query.d.ts +1 -2
  13. package/dist/bridge/dataSources/query.d.ts.map +1 -1
  14. package/dist/bridge/dataSources/query.js +15 -398
  15. package/dist/bridge/dataSources/queryFilter.d.ts +10 -0
  16. package/dist/bridge/dataSources/queryFilter.d.ts.map +1 -0
  17. package/dist/bridge/dataSources/queryFilter.js +123 -0
  18. package/dist/bridge/dataSources/resolveProperty.d.ts +1 -20
  19. package/dist/bridge/dataSources/resolveProperty.d.ts.map +1 -1
  20. package/dist/bridge/dataSources/resolveProperty.js +37 -32
  21. package/dist/bridge/dataSources/resolvePropertyAddress.d.ts +10 -0
  22. package/dist/bridge/dataSources/resolvePropertyAddress.d.ts.map +1 -0
  23. package/dist/bridge/dataSources/resolvePropertyAddress.js +55 -0
  24. package/dist/bridge/dataSources/resolveSorts.d.ts +10 -0
  25. package/dist/bridge/dataSources/resolveSorts.d.ts.map +1 -0
  26. package/dist/bridge/dataSources/resolveSorts.js +80 -0
  27. package/dist/bridge/hostState.d.ts +3 -7
  28. package/dist/bridge/hostState.d.ts.map +1 -1
  29. package/dist/bridge/hostState.js +0 -24
  30. package/dist/bridge/page.d.ts +9 -3
  31. package/dist/bridge/page.d.ts.map +1 -1
  32. package/dist/bridge/page.js +19 -2
  33. package/dist/bridge/readLocalManifest.d.ts +23 -0
  34. package/dist/bridge/readLocalManifest.d.ts.map +1 -0
  35. package/dist/bridge/readLocalManifest.js +46 -0
  36. package/dist/bridge/sandboxClient.d.ts +0 -2
  37. package/dist/bridge/sandboxClient.d.ts.map +1 -1
  38. package/dist/bridge/sandboxClient.js +50 -24
  39. package/dist/protocol/dataSources/dataSourcePage.d.ts +3 -4
  40. package/dist/protocol/dataSources/dataSourcePage.js +2 -3
  41. package/dist/protocol/index.d.ts +1 -0
  42. package/dist/protocol/index.js +1 -0
  43. package/dist/protocol/isLocalBlockServerUrl.d.ts +2 -0
  44. package/dist/protocol/isLocalBlockServerUrl.js +9 -0
  45. package/dist/protocol/messages/connect.d.ts +2 -2
  46. package/dist/protocol/messages/connect.js +2 -2
  47. package/dist/protocol/messages/createPage.d.ts +1 -1
  48. package/dist/protocol/messages/createPage.js +1 -1
  49. package/dist/protocol/messages/createPageResult.d.ts +3 -3
  50. package/dist/protocol/messages/createPageResult.js +4 -4
  51. package/dist/protocol/messages/getPage.d.ts +2 -2
  52. package/dist/protocol/messages/getPage.js +4 -4
  53. package/dist/protocol/messages/hostToSandbox.d.ts +3 -3
  54. package/dist/protocol/messages/hostToSandbox.js +10 -10
  55. package/dist/protocol/messages/init.d.ts +1 -1
  56. package/dist/protocol/messages/queryDataSource.d.ts +24 -0
  57. package/dist/protocol/messages/queryDataSource.js +2 -0
  58. package/dist/protocol/messages/queryDataSourceResult.d.ts +3 -3
  59. package/dist/protocol/messages/queryDataSourceResult.js +5 -5
  60. package/dist/protocol/messages/sandboxToHost.d.ts +8 -0
  61. package/dist/protocol/messages/updatePageResult.d.ts +3 -3
  62. package/dist/protocol/messages/updatePageResult.js +4 -4
  63. package/dist/protocol/pages/page.d.ts +4 -4
  64. package/dist/protocol/pages/page.js +2 -2
  65. package/dist/protocol/parent.d.ts +1 -1
  66. package/dist/protocol/protocolVersion.d.ts +3 -2
  67. package/dist/protocol/protocolVersion.js +4 -2
  68. package/dist/react/useDataSource.d.ts +2 -2
  69. package/dist/react/useDataSource.js +2 -2
  70. package/dist/types.d.ts +5 -5
  71. package/dist/types.d.ts.map +1 -1
  72. package/dist/version.js +1 -1
  73. package/docs/block-location.md +6 -4
  74. package/docs/bridge-interceptors.md +4 -0
  75. package/docs/build-tools.md +58 -0
  76. package/docs/data-sources.md +24 -18
  77. package/docs/deployment.md +23 -36
  78. package/docs/errors.md +75 -52
  79. package/docs/lifecycle.md +10 -3
  80. package/docs/pages.md +84 -76
  81. package/docs/users.md +4 -4
  82. package/package.json +4 -19
  83. package/src/bridge/SandboxBridge.ts +18 -48
  84. package/src/bridge/SandboxInitialization.ts +14 -20
  85. package/src/bridge/appearance.ts +2 -10
  86. package/src/bridge/dataSources/query.ts +17 -530
  87. package/src/bridge/dataSources/queryFilter.ts +181 -0
  88. package/src/bridge/dataSources/resolveProperty.ts +48 -39
  89. package/src/bridge/dataSources/resolvePropertyAddress.ts +62 -0
  90. package/src/bridge/dataSources/resolveSorts.ts +107 -0
  91. package/src/bridge/hostState.ts +3 -43
  92. package/src/bridge/page.ts +28 -4
  93. package/src/bridge/readLocalManifest.ts +60 -0
  94. package/src/bridge/sandboxClient.ts +63 -38
  95. package/src/react/useDataSource.ts +2 -2
  96. package/src/types.ts +5 -5
  97. package/dist/bridge/loadManifest.d.ts +0 -21
  98. package/dist/bridge/loadManifest.d.ts.map +0 -1
  99. package/dist/bridge/loadManifest.js +0 -85
  100. package/src/bridge/loadManifest.ts +0 -114
@@ -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,2 @@
1
+ /** Accepts HTTP(S) block servers on localhost, *.localhost, or 127.0.0.1 without credentials. */
2
+ export declare function isLocalBlockServerUrl(url: URL): boolean;
@@ -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 data sources and settings the custom block expects. Hosts may omit
14
- * this when they already have an authoritative manifest.
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 data sources and settings the custom block expects. Hosts may omit
29
- * this when they already have an authoritative manifest.
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,
@@ -23,7 +23,7 @@ export type NotionCreatePagePosition = v.InferOutput<typeof notionCreatePagePosi
23
23
  * Parent accepted by the outbound `createPage` bridge message.
24
24
  *
25
25
  * Mirrors Notion's public API `POST /v1/pages` parent shape: `page_id` for a page-parented child,
26
- * `data_source_id` for a database row. `data_source_id` is the internal collection ID.
26
+ * `data_source_id` for a database row. `data_source_id` identifies the data source.
27
27
  *
28
28
  * The SDK additionally accepts a higher-level `data_source_key` variant that resolves to
29
29
  * `data_source_id` locally, using the `dataSources` mapping.
@@ -19,7 +19,7 @@ export const notionCreatePagePositionSchema = v.variant("type", [
19
19
  * Parent accepted by the outbound `createPage` bridge message.
20
20
  *
21
21
  * Mirrors Notion's public API `POST /v1/pages` parent shape: `page_id` for a page-parented child,
22
- * `data_source_id` for a database row. `data_source_id` is the internal collection ID.
22
+ * `data_source_id` for a database row. `data_source_id` identifies the data source.
23
23
  *
24
24
  * The SDK additionally accepts a higher-level `data_source_key` variant that resolves to
25
25
  * `data_source_id` locally, using the `dataSources` mapping.
@@ -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 customBlockCreatePageErrorCodeSchema: v.StringSchema<undefined>;
4
- export type CustomBlockCreatePageErrorCode = CustomBlockErrorCode<"create_page_failed" | "invalid_page_parent" | "page_unavailable" | "collection_access_failed" | "unknown_data_source_key" | "unmapped_data_source" | "unmapped_property" | "property_id_mismatch" | "duplicate_property" | "invalid_property_value">;
4
+ export type CustomBlockCreatePageErrorCode = CustomBlockErrorCode<"create_page_failed" | "invalid_page_parent" | "page_unavailable" | "data_source_access_failed" | "unknown_data_source_key" | "unmapped_data_source" | "unmapped_property" | "property_id_mismatch" | "duplicate_property" | "invalid_property_value">;
5
5
  export type CustomBlockCreatePageErrorInfo = CustomBlockErrorInfo<CustomBlockCreatePageErrorCode>;
6
6
  export declare const customBlockCreatePageErrorInfoSchema: v.ObjectSchema<{
7
7
  readonly code: v.StringSchema<undefined>;
@@ -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 createPageResultMessageLegacySchema: v.VariantSchema<"status", [v.ObjectSchema<{
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 CreatePageResultMessageLegacy = v.InferOutput<typeof createPageResultMessageLegacySchema>;
897
+ export type CreatePageResultMessageWithProtocol3To5Compatibility = v.InferOutput<typeof createPageResultMessageWithProtocol3To5CompatibilitySchema>;
@@ -1,5 +1,5 @@
1
1
  import * as v from "valibot";
2
- import { legacyNotionPageSchema, notionPageDataSchema } from "../pages/page.js";
2
+ import { bridgePageSchema, 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();
@@ -17,7 +17,7 @@ export const createPageResultMessageSchema = v.variant("status", [
17
17
  requestId: v.string(),
18
18
  status: v.literal("success"),
19
19
  /** The newly created page. */
20
- page: notionPageDataSchema,
20
+ page: bridgePageSchema,
21
21
  }),
22
22
  v.object({
23
23
  type: v.literal("createPageResult"),
@@ -26,13 +26,13 @@ export const createPageResultMessageSchema = v.variant("status", [
26
26
  error: customBlockCreatePageErrorInfoSchema,
27
27
  }),
28
28
  ]);
29
- export const createPageResultMessageLegacySchema = v.variant("status", [
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, legacyNotionPageSchema]),
35
+ page: v.union([bridgePageSchema, 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 getPageResultMessageLegacySchema: v.VariantSchema<"status", [v.ObjectSchema<{
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 GetPageResultMessageLegacy = v.InferOutput<typeof getPageResultMessageLegacySchema>;
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 { legacyNotionPageSchema, notionPageDataSchema } from "../pages/page.js";
3
+ import { bridgePageSchema, 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();
@@ -23,7 +23,7 @@ export const getPageResultMessageSchema = v.variant("status", [
23
23
  type: v.literal("getPageResult"),
24
24
  requestId: v.string(),
25
25
  status: v.literal("success"),
26
- page: notionPageDataSchema,
26
+ page: bridgePageSchema,
27
27
  }),
28
28
  v.object({
29
29
  type: v.literal("getPageResult"),
@@ -32,12 +32,12 @@ export const getPageResultMessageSchema = v.variant("status", [
32
32
  error: customBlockGetPageErrorInfoSchema,
33
33
  }),
34
34
  ]);
35
- export const getPageResultMessageLegacySchema = v.variant("status", [
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, legacyNotionPageSchema]),
40
+ page: v.union([bridgePageSchema, 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
- * Discriminated union of every message the host is allowed to send the sandbox.
1746
+ * Host messages accepting both current page shapes and protocol 3–5 page shapes.
1747
1747
  */
1748
- export declare const hostToSandboxMessageLegacySchema: v.VariantSchema<"type", [v.VariantSchema<"status", [v.ObjectSchema<{
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 HostToSandboxMessageLegacy = v.InferOutput<typeof hostToSandboxMessageLegacySchema>;
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 { createPageResultMessageLegacySchema, createPageResultMessageSchema, } from "./createPageResult.js";
3
+ import { createPageResultMessageSchema, createPageResultMessageWithProtocol3To5CompatibilitySchema, } from "./createPageResult.js";
4
4
  import { currentUserChangedMessageSchema } from "./currentUserChanged.js";
5
5
  import { dataSourcesChangedMessageSchema } from "./dataSourcesChanged.js";
6
- import { getPageResultMessageLegacySchema, getPageResultMessageSchema, } from "./getPage.js";
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 { queryDataSourceResultMessageLegacySchema, queryDataSourceResultMessageSchema, } from "./queryDataSourceResult.js";
15
+ import { queryDataSourceResultMessageSchema, queryDataSourceResultMessageWithProtocol3To5CompatibilitySchema, } from "./queryDataSourceResult.js";
16
16
  import { themeChangedMessageSchema } from "./themeChanged.js";
17
- import { updatePageResultMessageLegacySchema, updatePageResultMessageSchema, } from "./updatePageResult.js";
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
- * Discriminated union of every message the host is allowed to send the sandbox.
40
+ * Host messages accepting both current page shapes and protocol 3–5 page shapes.
41
41
  */
42
- export const hostToSandboxMessageLegacySchema = v.variant("type", [
42
+ export const hostToSandboxMessageWithProtocol3To5CompatibilitySchema = v.variant("type", [
43
43
  ...baseHostToSandboxMessageSchema.options,
44
- queryDataSourceResultMessageLegacySchema,
45
- getPageResultMessageLegacySchema,
46
- createPageResultMessageLegacySchema,
47
- updatePageResultMessageLegacySchema,
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 queryDataSourceResultMessageLegacySchema: v.VariantSchema<"status", [v.ObjectSchema<{
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 QueryDataSourceResultMessageLegacy = v.InferOutput<typeof queryDataSourceResultMessageLegacySchema>;
686
+ export type QueryDataSourceResultMessageWithProtocol3To5Compatibility = v.InferOutput<typeof queryDataSourceResultMessageWithProtocol3To5CompatibilitySchema>;
@@ -1,6 +1,6 @@
1
1
  import * as v from "valibot";
2
- import { legacyNotionDataSourcePageBridgeSchema } from "../dataSources/dataSourcePage.js";
3
- import { notionPageDataSchema } from "../pages/page.js";
2
+ import { notionDataSourcePageForProtocol3To5Schema } from "../dataSources/dataSourcePage.js";
3
+ import { bridgePageSchema } 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 customBlockQueryDataSourceErrorCodeSchema = v.string();
@@ -17,7 +17,7 @@ export const queryDataSourceResultMessageSchema = v.variant("status", [
17
17
  type: v.literal("queryDataSourceResult"),
18
18
  subscriptionId: v.string(),
19
19
  status: v.literal("success"),
20
- items: v.array(notionPageDataSchema),
20
+ items: v.array(bridgePageSchema),
21
21
  hasMore: v.boolean(),
22
22
  }),
23
23
  v.object({
@@ -27,12 +27,12 @@ export const queryDataSourceResultMessageSchema = v.variant("status", [
27
27
  error: customBlockQueryDataSourceErrorInfoSchema,
28
28
  }),
29
29
  ]);
30
- export const queryDataSourceResultMessageLegacySchema = v.variant("status", [
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([notionPageDataSchema, legacyNotionDataSourcePageBridgeSchema])),
35
+ items: v.array(v.union([bridgePageSchema, notionDataSourcePageForProtocol3To5Schema])),
36
36
  hasMore: v.boolean(),
37
37
  }),
38
38
  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>;
@@ -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 customBlockUpdatePageErrorCodeSchema: v.StringSchema<undefined>;
4
- export type CustomBlockUpdatePageErrorCode = CustomBlockErrorCode<"update_page_failed" | "invalid_page_update" | "page_unavailable" | "collection_access_failed" | "unmapped_property" | "property_id_mismatch" | "duplicate_property" | "invalid_property_value">;
4
+ export type CustomBlockUpdatePageErrorCode = CustomBlockErrorCode<"update_page_failed" | "invalid_page_update" | "page_unavailable" | "data_source_access_failed" | "unmapped_property" | "property_id_mismatch" | "duplicate_property" | "invalid_property_value">;
5
5
  export type CustomBlockUpdatePageErrorInfo = CustomBlockErrorInfo<CustomBlockUpdatePageErrorCode>;
6
6
  export declare const customBlockUpdatePageErrorInfoSchema: v.ObjectSchema<{
7
7
  readonly code: 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 updatePageResultMessageLegacySchema: v.VariantSchema<"status", [v.ObjectSchema<{
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 UpdatePageResultMessageLegacy = v.InferOutput<typeof updatePageResultMessageLegacySchema>;
895
+ export type UpdatePageResultMessageWithProtocol3To5Compatibility = v.InferOutput<typeof updatePageResultMessageWithProtocol3To5CompatibilitySchema>;
@@ -1,5 +1,5 @@
1
1
  import * as v from "valibot";
2
- import { legacyNotionPageSchema, notionPageDataSchema } from "../pages/page.js";
2
+ import { bridgePageSchema, 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();
@@ -16,7 +16,7 @@ export const updatePageResultMessageSchema = v.variant("status", [
16
16
  type: v.literal("updatePageResult"),
17
17
  requestId: v.string(),
18
18
  status: v.literal("success"),
19
- page: notionPageDataSchema,
19
+ page: bridgePageSchema,
20
20
  }),
21
21
  v.object({
22
22
  type: v.literal("updatePageResult"),
@@ -25,12 +25,12 @@ export const updatePageResultMessageSchema = v.variant("status", [
25
25
  error: customBlockUpdatePageErrorInfoSchema,
26
26
  }),
27
27
  ]);
28
- export const updatePageResultMessageLegacySchema = v.variant("status", [
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, legacyNotionPageSchema]),
33
+ page: v.union([bridgePageSchema, notionPageForProtocol3To5Schema]),
34
34
  }),
35
35
  v.object({
36
36
  type: v.literal("updatePageResult"),
@@ -848,7 +848,7 @@ export type NotionPagePropertyWriteMap = v.InferInput<typeof notionPagePropertyW
848
848
  /**
849
849
  * The `Page` object returned in `createPageResult` messages.
850
850
  */
851
- export declare const notionPageDataSchema: v.ObjectSchema<{
851
+ export declare const bridgePageSchema: v.ObjectSchema<{
852
852
  readonly object: v.LiteralSchema<"page", undefined>;
853
853
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
854
854
  readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
@@ -1138,8 +1138,8 @@ export declare const notionPageDataSchema: v.ObjectSchema<{
1138
1138
  /** Whether the page or an ancestor is in Trash. */
1139
1139
  readonly in_trash: v.BooleanSchema<undefined>;
1140
1140
  }, undefined>;
1141
- export type NotionPageData = v.InferInput<typeof notionPageDataSchema>;
1142
- export declare const legacyNotionPageSchema: v.ObjectSchema<{
1141
+ export type BridgePage = v.InferInput<typeof bridgePageSchema>;
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 LegacyNotionPage = v.InferOutput<typeof legacyNotionPageSchema>;
1421
+ export type NotionPageForProtocol3To5 = v.InferOutput<typeof notionPageForProtocol3To5Schema>;
1422
1422
  export {};
@@ -281,7 +281,7 @@ export const notionPagePropertyReadMapSchema = v.record(v.string(), v.nullable(n
281
281
  /**
282
282
  * The `Page` object returned in `createPageResult` messages.
283
283
  */
284
- export const notionPageDataSchema = v.object({
284
+ export const bridgePageSchema = v.object({
285
285
  object: v.literal("page"),
286
286
  id: notionPageIdSchema,
287
287
  parent: notionParentSchema,
@@ -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 legacyNotionPageSchema = v.object({
303
+ export const notionPageForProtocol3To5Schema = v.object({
304
304
  object: v.literal("page"),
305
305
  id: notionPageIdSchema,
306
306
  parent: notionParentSchema,
@@ -23,7 +23,7 @@ export declare const notionParentSchema: v.VariantSchema<"type", [v.ObjectSchema
23
23
  * Uses Notion public API parent names, plus an unavailable state:
24
24
  * - `page_id` — parented directly under a page.
25
25
  * - `block_id` — parented under a non-page container block (toggle, column, callout, ...).
26
- * - `data_source_id` — parented under a collection (data source).
26
+ * - `data_source_id` — parented under a data source.
27
27
  * - `workspace` — top-level / team-rooted.
28
28
  * - `agent_id` — owned by an agent, such as an agent instruction page or its blocks.
29
29
  * - `unavailable` — the viewer cannot access the parent resource. Neither its ID nor its kind
@@ -3,5 +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 = 6;
7
- export declare const LEGACY_PROPERTY_SHAPE_PROTOCOL_VERSION = 6;
6
+ export declare const LATEST_BRIDGE_PROTOCOL_VERSION = 8;
7
+ export declare const UNIFIED_PAGE_PROTOCOL_VERSION = 6;
8
+ export declare const TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION = 7;
@@ -3,7 +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;
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 LEGACY_PROPERTY_SHAPE_PROTOCOL_VERSION = 6;
9
+ export const UNIFIED_PAGE_PROTOCOL_VERSION = 6;
10
+ // Protocol 7 adds typed text fallbacks for previously unsupported page properties.
11
+ export const TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION = 7;
@@ -3,8 +3,8 @@ import type { UseDataSourceOptions, UseDataSourceResult } from "../types.js";
3
3
  * Reads from the data source mapped to the given semantic `key`.
4
4
  *
5
5
  * @param key - The semantic data source key the block is wired to (e.g. `"people"`).
6
- * @param options - Optional live snapshot options. `limit` defaults to 20 and
7
- * is capped at 999. `sorts` are applied in array order.
6
+ * @param options - Optional live snapshot options. The host enforces the maximum row
7
+ * limit. `sorts` are applied in array order.
8
8
  *
9
9
  * @example
10
10
  * const { items, propertyIdsByKey, isLoading, hasMore, error } = useDataSource("default", { limit: 25 })
@@ -12,8 +12,8 @@ const EMPTY_DATA_SOURCE_RESULT = {
12
12
  * Reads from the data source mapped to the given semantic `key`.
13
13
  *
14
14
  * @param key - The semantic data source key the block is wired to (e.g. `"people"`).
15
- * @param options - Optional live snapshot options. `limit` defaults to 20 and
16
- * is capped at 999. `sorts` are applied in array order.
15
+ * @param options - Optional live snapshot options. The host enforces the maximum row
16
+ * limit. `sorts` are applied in array order.
17
17
  *
18
18
  * @example
19
19
  * const { items, propertyIdsByKey, isLoading, hasMore, error } = useDataSource("default", { limit: 25 })
package/dist/types.d.ts CHANGED
@@ -11,7 +11,7 @@ import type { CustomBlockOpenPageErrorInfo, OpenPageMode, OpenPageResultMessage
11
11
  import type { CustomBlockCheckboxFilterOperator, CustomBlockContainsFilterOperator, CustomBlockCreatedByFilterOperator, CustomBlockDateFilterOperator, CustomBlockNumberFilterOperator, CustomBlockOptionFilterOperator, CustomBlockPeopleFilterOperator, CustomBlockPersonFilterValue, CustomBlockRelationFilterOperator, CustomBlockStatusFilterOperator, CustomBlockTextFilterOperator } from "./protocol/messages/queryDataSource.js";
12
12
  import type { CustomBlockQueryDataSourceErrorInfo } from "./protocol/messages/queryDataSourceResult.js";
13
13
  import type { CustomBlockUpdatePageErrorInfo } from "./protocol/messages/updatePageResult.js";
14
- import type { NotionPageCover, NotionPageIcon, NotionPagePropertyValue, NotionPagePropertyWriteMap, notionPageDataSchema } from "./protocol/pages/page.js";
14
+ import type { bridgePageSchema, NotionPageCover, NotionPageIcon, NotionPagePropertyValue, NotionPagePropertyWriteMap } from "./protocol/pages/page.js";
15
15
  import type { InferOutput } from "valibot";
16
16
  import type { ExclusiveUnion } from "./typeUtils.js";
17
17
  export type { CustomBlockErrorInfo } from "./protocol/errors.js";
@@ -33,7 +33,7 @@ export type NotionPagePropertyInputValue = Exclude<NotionPagePropertyWriteMap[st
33
33
  export type NotionPagePropertyInputMap = {
34
34
  [propertyIdOrKey: string]: NotionPagePropertyInputValue;
35
35
  };
36
- export type NotionPage = InferOutput<typeof notionPageDataSchema> & {
36
+ export type NotionPage = InferOutput<typeof bridgePageSchema> & {
37
37
  dataSourceKey: string | null;
38
38
  getPropertyById: (propertyId: string) => NotionPagePropertyValue | null;
39
39
  getPropertyByKey: (propertyKey: string) => NotionPagePropertyValue | null;
@@ -161,9 +161,9 @@ export type UseDataSourceOptions = DataSourceQueryOptions;
161
161
  * parent shape; see https://developers.notion.com/reference/data-source.
162
162
  *
163
163
  * - `page_id`: Create a child page under the given Notion page.
164
- * - `data_source_id`: Create a row inside the given Notion data source (aka the internal
165
- * collection). The public API's `data_source_id` is the same UUID as the `collectionPointer.id`
166
- * exposed in `dataSources`, so either value works here.
164
+ * - `data_source_id`: Create a row inside the given Notion data source. The public API's
165
+ * `data_source_id` is the same UUID as the `collectionPointer.id` exposed in `dataSources`,
166
+ * so either value works here.
167
167
  * - `data_source_key`: Create a row inside the data source that the custom block was configured with
168
168
  * under this semantic key. The SDK resolves the key to a `data_source_id` locally before
169
169
  * sending the request to the host.