@notionhq/custom-blocks 0.5.0 → 0.5.2

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseHostToSandboxMessage.d.ts","sourceRoot":"","sources":["../../src/bridge/parseHostToSandboxMessage.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMtD"}
@@ -0,0 +1,47 @@
1
+ import { bridgeDataSourceBindingSchema } from "../protocol/dataSources/bridgeDataSourceBinding.js";
2
+ import { dataSourcePointerValidator } from "../protocol/dataSources/dataSourcePointer.js";
3
+ import { notionDataSourceSchemaValidator } from "../protocol/dataSources/dataSourceSchema.js";
4
+ import { initMessageSchema } from "../protocol/handshake/init.js";
5
+ import { hostToSandboxMessageSchema } from "../protocol/messages/hostToSandbox.js";
6
+ import { readIncomingType } from "../protocol/messages/incomingType.js";
7
+ import * as v from "valibot";
8
+ /**
9
+ * Older hosts such as 0.9.0 send `collectionPointer` and `collectionSchema` during
10
+ * initialization and live updates. Normalize these pre-protocol-11 names to
11
+ * `dataSourcePointer` and `dataSourceSchema` before exposing bindings to SDK consumers.
12
+ * Current fields take precedence when both names are present. Malformed fields and
13
+ * invalid property mappings still fail validation; this compatibility does not add
14
+ * host operations or repair bindings the Notion client cannot read from storage.
15
+ */
16
+ export function parseHostToSandboxMessage(data) {
17
+ const type = readIncomingType(data);
18
+ if (type === "init" || type === "dataSourcesChanged") {
19
+ return v.safeParse(bindingMessageSchema, data);
20
+ }
21
+ return v.safeParse(hostToSandboxMessageSchema, data);
22
+ }
23
+ const bindingSchema = v.pipe(v.object({
24
+ ...bridgeDataSourceBindingSchema.entries,
25
+ collectionPointer: v.optional(dataSourcePointerValidator),
26
+ collectionSchema: v.optional(notionDataSourceSchemaValidator),
27
+ }), v.transform(({ collectionPointer, collectionSchema, ...binding }) => ({
28
+ ...binding,
29
+ dataSourcePointer: binding.dataSourcePointer ?? collectionPointer,
30
+ dataSourceSchema: binding.dataSourceSchema ?? collectionSchema,
31
+ })));
32
+ const dataSourcesSchema = v.object({
33
+ bindings: v.record(v.string(), bindingSchema),
34
+ });
35
+ const bindingMessageSchema = v.variant("type", [
36
+ v.variant("status", [
37
+ v.object({
38
+ ...initMessageSchema.options[0].entries,
39
+ dataSources: dataSourcesSchema,
40
+ }),
41
+ initMessageSchema.options[1],
42
+ ]),
43
+ v.object({
44
+ type: v.literal("dataSourcesChanged"),
45
+ dataSources: dataSourcesSchema,
46
+ }),
47
+ ]);
@@ -9,7 +9,7 @@ import { resolveDataSourceBinding } from "../../protocol/dataSources/resolveData
9
9
  export function resolveDataSources(args) {
10
10
  return Object.entries(args.manifest.dataSources).map(([key, manifestDataSource]) => {
11
11
  const binding = args.dataSourceBindings[key];
12
- const collectionProperties = binding?.dataSourceSchema?.propertiesById ?? {};
12
+ const dataSourceProperties = binding?.dataSourceSchema?.propertiesById ?? {};
13
13
  const resolvedBinding = resolveDataSourceBinding({
14
14
  manifestDataSource,
15
15
  dataSourceSchema: binding?.dataSourceSchema,
@@ -25,7 +25,7 @@ export function resolveDataSources(args) {
25
25
  dataSourcePointer: binding?.dataSourcePointer,
26
26
  dataSourceSchema: binding?.dataSourceSchema,
27
27
  propertyIdsByKey,
28
- propertySchemasById: collectionProperties,
28
+ propertySchemasById: dataSourceProperties,
29
29
  ...(binding?.inaccessible === true && { inaccessible: true }),
30
30
  };
31
31
  });
@@ -1 +1 @@
1
- {"version":3,"file":"subscribeToDataSource.d.ts","sourceRoot":"","sources":["../../src/dataSources/subscribeToDataSource.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAE3D,wBAAgB,qBAAqB,CAAC,EACrC,GAAG,EACH,UAAU,EACV,OAAO,EACP,OAAO,EAAE,eAAoB,GAC7B,EAAE,yBAAyB,GAAG,MAAM,IAAI,CAkHxC"}
1
+ {"version":3,"file":"subscribeToDataSource.d.ts","sourceRoot":"","sources":["../../src/dataSources/subscribeToDataSource.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAE3D,wBAAgB,qBAAqB,CAAC,EACrC,GAAG,EACH,UAAU,EACV,OAAO,EACP,OAAO,EAAE,eAAoB,GAC7B,EAAE,yBAAyB,GAAG,MAAM,IAAI,CAqHxC"}
@@ -19,6 +19,9 @@ export function subscribeToDataSource({ key, onSnapshot, onError, options: provi
19
19
  propertyIdsByKey: source?.propertyIdsByKey ?? {},
20
20
  isLoading,
21
21
  hasMore: result?.status === "success" && result.hasMore,
22
+ ...(result?.status === "success" && result.limitClamp !== undefined
23
+ ? { limitClamp: result.limitClamp }
24
+ : {}),
22
25
  };
23
26
  notifyListener(() => onSnapshot(snapshot));
24
27
  };
@@ -1,3 +1,4 @@
1
+ import type { BridgeDataSourceQueryLimitClamp } from "../protocol/dataSources/bridgeDataSourceQueryLimitClamp.js";
1
2
  import type { CustomBlockQueryDataSourceErrorInfo } from "../protocol/dataSources/messages/queryDataSource.js";
2
3
  import type { CustomBlockCreatePageErrorInfo } from "../protocol/pages/messages/createPage.js";
3
4
  import type { CustomBlockGetPageErrorInfo } from "../protocol/pages/messages/getPage.js";
@@ -17,6 +18,8 @@ export type DataSourcesQueryResult = ({
17
18
  status: "error";
18
19
  error: CustomBlockQueryDataSourceErrorInfo;
19
20
  };
21
+ /** A host-reported reduction of the requested row limit. */
22
+ export type DataSourceQueryLimitClamp = BridgeDataSourceQueryLimitClamp;
20
23
  /** Latest live snapshot of a data source query. */
21
24
  export type DataSourceSnapshot = {
22
25
  items: NotionPage[];
@@ -25,6 +28,8 @@ export type DataSourceSnapshot = {
25
28
  };
26
29
  isLoading: boolean;
27
30
  hasMore: boolean;
31
+ /** A reported host cap. Older hosts may cap queries without reporting it. */
32
+ limitClamp?: DataSourceQueryLimitClamp;
28
33
  };
29
34
  export type NotionArchiveStatus = "active" | "archived" | "all";
30
35
  export type DataSourceQueryOptions = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/dataSources/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,0EAA0E,CAAA;AACnI,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+DAA+D,CAAA;AACnH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4DAA4D,CAAA;AAC7G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EACX,sBAAsB,EACtB,oBAAoB,EACpB,MAAM,oBAAoB,CAAA;AAE3B,MAAM,MAAM,qBAAqB,GAC9B;IACA,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SAAS,CAAA;KAAE,CAAA;IACvD,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,yBAAyB,CAAA;CACtC,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAA;AAE/D,MAAM,MAAM,sBAAsB,GAAG;IACpC,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0FAA0F;IAC1F,MAAM,CAAC,EAAE,sBAAsB,CAAA;IAC/B,qEAAqE;IACrE,KAAK,CAAC,EAAE,oBAAoB,EAAE,CAAA;IAC9B,aAAa,CAAC,EAAE,mBAAmB,CAAA;CACnC,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACvC,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAA;IAClD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,mCAAmC,KAAK,IAAI,CAAA;IAC9D,OAAO,CAAC,EAAE,sBAAsB,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG;IACtD,KAAK,EAAE,mCAAmC,GAAG,SAAS,CAAA;CACtD,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,sBAAsB,CAAA"}
@@ -38,16 +38,6 @@ export declare function toNotionPageFieldsFromBridgePage(page: BridgePage): {
38
38
  created_time: string | null;
39
39
  last_edited_time: string | null;
40
40
  icon: {
41
- type: "emoji";
42
- emoji: string;
43
- } | {
44
- type: "custom_emoji";
45
- custom_emoji: {
46
- id: string;
47
- name?: string | undefined;
48
- url?: string | undefined;
49
- };
50
- } | {
51
41
  type: "external";
52
42
  external: {
53
43
  url: string;
@@ -58,6 +48,16 @@ export declare function toNotionPageFieldsFromBridgePage(page: BridgePage): {
58
48
  url: string;
59
49
  expiry_time?: string | undefined;
60
50
  };
51
+ } | {
52
+ type: "emoji";
53
+ emoji: string;
54
+ } | {
55
+ type: "custom_emoji";
56
+ custom_emoji: {
57
+ id: string;
58
+ name?: string | undefined;
59
+ url?: string | undefined;
60
+ };
61
61
  } | ({
62
62
  type: "icon";
63
63
  icon: {
@@ -0,0 +1,10 @@
1
+ import * as v from "valibot";
2
+ /** A host cap that reduced the requested query limit, independent of row count. */
3
+ export declare const bridgeDataSourceQueryLimitClampSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
4
+ readonly requested: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
5
+ readonly applied: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
6
+ }, undefined>, v.CheckAction<{
7
+ requested: number;
8
+ applied: number;
9
+ }, undefined>]>;
10
+ export type BridgeDataSourceQueryLimitClamp = v.InferOutput<typeof bridgeDataSourceQueryLimitClampSchema>;
@@ -0,0 +1,6 @@
1
+ import * as v from "valibot";
2
+ /** A host cap that reduced the requested query limit, independent of row count. */
3
+ export const bridgeDataSourceQueryLimitClampSchema = v.pipe(v.object({
4
+ requested: v.pipe(v.number(), v.safeInteger(), v.minValue(1)),
5
+ applied: v.pipe(v.number(), v.safeInteger(), v.minValue(1)),
6
+ }), v.check(value => value.applied < value.requested));
@@ -2274,6 +2274,13 @@ export declare const queryDataSourceResultMessageSchema: v.VariantSchema<"status
2274
2274
  readonly in_trash: v.BooleanSchema<undefined>;
2275
2275
  }, undefined>, undefined>;
2276
2276
  readonly hasMore: v.BooleanSchema<undefined>;
2277
+ readonly limitClamp: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
2278
+ readonly requested: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
2279
+ readonly applied: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
2280
+ }, undefined>, v.CheckAction<{
2281
+ requested: number;
2282
+ applied: number;
2283
+ }, undefined>]>, undefined>;
2277
2284
  }, undefined>, v.ObjectSchema<{
2278
2285
  readonly type: v.LiteralSchema<"queryDataSourceResult", undefined>;
2279
2286
  readonly subscriptionId: v.StringSchema<undefined>;
@@ -2642,6 +2649,13 @@ export declare const queryDataSourceResultMessageWithProtocol3To5CompatibilitySc
2642
2649
  }, undefined>, undefined>], undefined>, undefined>, undefined>;
2643
2650
  }, undefined>], undefined>, undefined>;
2644
2651
  readonly hasMore: v.BooleanSchema<undefined>;
2652
+ readonly limitClamp: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
2653
+ readonly requested: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
2654
+ readonly applied: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
2655
+ }, undefined>, v.CheckAction<{
2656
+ requested: number;
2657
+ applied: number;
2658
+ }, undefined>]>, undefined>;
2645
2659
  }, undefined>, v.ObjectSchema<{
2646
2660
  readonly type: v.LiteralSchema<"queryDataSourceResult", undefined>;
2647
2661
  readonly subscriptionId: v.StringSchema<undefined>;
@@ -3,6 +3,7 @@ import { notionDataSourcePageForProtocol3To5Schema } from "../../compatibility/p
3
3
  import { bridgePageSchema } from "../../pages/bridgePage.js";
4
4
  import { notionDataSourceIdSchema } from "../../utils/ids.js";
5
5
  import { bridgeArchiveStatusSchema } from "../bridgeArchiveStatus.js";
6
+ import { bridgeDataSourceQueryLimitClampSchema } from "../bridgeDataSourceQueryLimitClamp.js";
6
7
  import { bridgeDataSourceFilterSchema } from "../filters/bridgeDataSourceFilter.js";
7
8
  import { bridgeDataSourceSortSchema } from "../filters/bridgeDataSourceSort.js";
8
9
  /**
@@ -41,6 +42,7 @@ export const queryDataSourceResultMessageSchema = v.variant("status", [
41
42
  status: v.literal("success"),
42
43
  items: v.array(bridgePageSchema),
43
44
  hasMore: v.boolean(),
45
+ limitClamp: v.optional(bridgeDataSourceQueryLimitClampSchema),
44
46
  }),
45
47
  v.object({
46
48
  type: v.literal("queryDataSourceResult"),
@@ -56,6 +58,7 @@ export const queryDataSourceResultMessageWithProtocol3To5CompatibilitySchema = v
56
58
  status: v.literal("success"),
57
59
  items: v.array(v.union([bridgePageSchema, notionDataSourcePageForProtocol3To5Schema])),
58
60
  hasMore: v.boolean(),
61
+ limitClamp: v.optional(bridgeDataSourceQueryLimitClampSchema),
59
62
  }),
60
63
  v.object({
61
64
  type: v.literal("queryDataSourceResult"),
@@ -31,6 +31,8 @@ export type { BridgeDataSourceBinding } from "./dataSources/bridgeDataSourceBind
31
31
  export { bridgeDataSourceBindingSchema } from "./dataSources/bridgeDataSourceBinding.js";
32
32
  export type { BridgeDataSourceBindings } from "./dataSources/bridgeDataSourceBindings.js";
33
33
  export { bridgeDataSourceBindingsSchema } from "./dataSources/bridgeDataSourceBindings.js";
34
+ export type { BridgeDataSourceQueryLimitClamp } from "./dataSources/bridgeDataSourceQueryLimitClamp.js";
35
+ export { bridgeDataSourceQueryLimitClampSchema } from "./dataSources/bridgeDataSourceQueryLimitClamp.js";
34
36
  export type { NotionDataSourcePointer } from "./dataSources/dataSourcePointer.js";
35
37
  export { dataSourcePointerValidator } from "./dataSources/dataSourcePointer.js";
36
38
  export type { NotionDataSourceSchema } from "./dataSources/dataSourceSchema.js";
@@ -15,6 +15,7 @@ export { notionThemeSchema } from "./context/theme.js";
15
15
  export { bridgeArchiveStatusSchema } from "./dataSources/bridgeArchiveStatus.js";
16
16
  export { bridgeDataSourceBindingSchema } from "./dataSources/bridgeDataSourceBinding.js";
17
17
  export { bridgeDataSourceBindingsSchema } from "./dataSources/bridgeDataSourceBindings.js";
18
+ export { bridgeDataSourceQueryLimitClampSchema } from "./dataSources/bridgeDataSourceQueryLimitClamp.js";
18
19
  export { dataSourcePointerValidator } from "./dataSources/dataSourcePointer.js";
19
20
  export { notionDataSourceSchemaValidator } from "./dataSources/dataSourceSchema.js";
20
21
  export { customBlockDataSourceResolutionErrorCodeSchema, customBlockPropertyErrorCodeSchema, } from "./dataSources/errors.js";
@@ -843,6 +843,13 @@ export declare const hostToSandboxMessageSchema: v.VariantSchema<"type", [v.Vari
843
843
  readonly in_trash: v.BooleanSchema<undefined>;
844
844
  }, undefined>, undefined>;
845
845
  readonly hasMore: v.BooleanSchema<undefined>;
846
+ readonly limitClamp: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
847
+ readonly requested: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
848
+ readonly applied: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
849
+ }, undefined>, v.CheckAction<{
850
+ requested: number;
851
+ applied: number;
852
+ }, undefined>]>, undefined>;
846
853
  }, undefined>, v.ObjectSchema<{
847
854
  readonly type: v.LiteralSchema<"queryDataSourceResult", undefined>;
848
855
  readonly subscriptionId: v.StringSchema<undefined>;
@@ -2668,6 +2675,13 @@ export declare const hostToSandboxMessageWithProtocol3To5CompatibilitySchema: v.
2668
2675
  }, undefined>, undefined>], undefined>, undefined>, undefined>;
2669
2676
  }, undefined>], undefined>, undefined>;
2670
2677
  readonly hasMore: v.BooleanSchema<undefined>;
2678
+ readonly limitClamp: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
2679
+ readonly requested: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
2680
+ readonly applied: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
2681
+ }, undefined>, v.CheckAction<{
2682
+ requested: number;
2683
+ applied: number;
2684
+ }, undefined>]>, undefined>;
2671
2685
  }, undefined>, v.ObjectSchema<{
2672
2686
  readonly type: v.LiteralSchema<"queryDataSourceResult", undefined>;
2673
2687
  readonly subscriptionId: v.StringSchema<undefined>;
@@ -4,4 +4,4 @@
4
4
  *
5
5
  * WARNING: Generated during SDK publish. Do not edit in the published package.
6
6
  */
7
- export const CUSTOM_BLOCKS_SDK_VERSION = "0.5.0"
7
+ export const CUSTOM_BLOCKS_SDK_VERSION = "0.5.2"
@@ -6,9 +6,8 @@ them current as the data changes.
6
6
  Use `customBlock.subscribeToDataSource(...)` with any TypeScript UI framework. For React,
7
7
  `useDataSource(key, options)` provides the latest snapshot and handles subscription cleanup.
8
8
 
9
- Each snapshot contains `items`, `propertyIdsByKey`, `isLoading`, and `hasMore`. Each query result
10
- replaces the previous rows in the snapshot. Subscriptions remain independent, even when they query
11
- the same data source.
9
+ Each query result replaces the previous rows in the snapshot. Subscriptions remain independent, even
10
+ when they query the same data source.
12
11
 
13
12
  Queries default to 20 rows. The host enforces the maximum row limit. See
14
13
  [Known limitations](#known-limitations) for pagination, filter, and sort restrictions.
@@ -55,6 +54,7 @@ type DataSourceSnapshot = {
55
54
  propertyIdsByKey: { [key: string]: string | undefined };
56
55
  isLoading: boolean;
57
56
  hasMore: boolean;
57
+ limitClamp?: DataSourceQueryLimitClamp;
58
58
  };
59
59
 
60
60
  type DataSourceQueryOptions = {
@@ -70,8 +70,7 @@ remain subscribed. Queries start only after SDK initialization.
70
70
 
71
71
  The listener receives the current snapshot immediately and receives later updates. Unrelated host
72
72
  changes do not trigger the listener. A new query result can trigger the listener even if its row
73
- values are unchanged. Each snapshot contains `items`, `propertyIdsByKey`, `isLoading`, and
74
- `hasMore`. Each item provides methods for updating, archiving, and unarchiving.
73
+ values are unchanged. Each item provides methods for updating, archiving, and unarchiving.
75
74
 
76
75
  The SDK calls `onSnapshot` immediately with the current snapshot, before `subscribeToDataSource`
77
76
  returns.
@@ -121,6 +120,7 @@ type UseDataSourceResult = {
121
120
  propertyIdsByKey: { [key: string]: string | undefined }
122
121
  isLoading: boolean
123
122
  hasMore: boolean
123
+ limitClamp?: DataSourceQueryLimitClamp
124
124
  error: CustomBlockQueryDataSourceErrorInfo | undefined
125
125
  }
126
126
  ```
@@ -168,13 +168,18 @@ time** column. Use the column's bound key or actual property ID.
168
168
 
169
169
  ### Row limits
170
170
 
171
- `limit` defaults to 20 and must be a positive safe integer. The SDK forwards the requested limit
172
- without capping it. The Notion host currently supports up to 1,000 rows and rejects larger requests
173
- with an error that states the maximum. Each query reads from the start of the matching rows. A
174
- larger limit replaces the previous snapshot with a larger result.
171
+ `limit` defaults to 20 and must be a positive safe integer. The SDK forwards it unchanged. Notion
172
+ and the dev shell clamp valid requests above 999 rows. Other hosts enforce their own caps.
175
173
 
176
- `hasMore` indicates that more matching rows exist beyond the result. It does not provide a cursor or
177
- guarantee that increasing the limit can retrieve every row.
174
+ `limitClamp` appears when the host lowers your requested row limit. `requested` is the limit you
175
+ asked for, and `applied` is the limit used for the result.
176
+
177
+ For example, requesting 1005 rows with 50 matches returns all 50, `hasMore: false`, and
178
+ `limitClamp: { requested: 1005, applied: 999 }`. A capped request can still return every matching
179
+ row. Check `hasMore` to find out whether more rows match.
180
+
181
+ Queries have no cursor or offset. Increasing `limit` replaces the snapshot from the start of the
182
+ matching rows. If `hasMore` is true at the host cap, use filters to query smaller subsets.
178
183
 
179
184
  ### Filters
180
185
 
@@ -485,10 +490,10 @@ export function ScoreList() {
485
490
  )
486
491
  })}
487
492
  </ul>
488
- {hasMore && limit < 1000 ? (
493
+ {hasMore && limit < 999 ? (
489
494
  <button
490
495
  type="button"
491
- onClick={() => setLimit(Math.min(limit + 20, 1000))}
496
+ onClick={() => setLimit(Math.min(limit + 20, 999))}
492
497
  disabled={isLoading}
493
498
  >
494
499
  {isLoading ? "Loading…" : "Load more"}
@@ -501,12 +506,9 @@ export function ScoreList() {
501
506
 
502
507
  ## Known limitations
503
508
 
504
- - **Row limits and pagination:** Hosts enforce their own limits. The Notion app supports up to 32
505
- active subscriptions per custom block, each with up to 1,000 rows. Requests that exceed either
506
- limit return an error. Queries have no cursor or offset. Increasing `limit` replaces the snapshot
507
- with a larger result from the start of the matching rows. If `hasMore` is true, increase `limit`
508
- up to 1,000 or use filters to query smaller subsets. Unsubscribe from queries you no longer need
509
- to free subscription slots.
509
+ - **Row limits and pagination:** Notion caps queries at 999 rows and allows 32 active subscriptions
510
+ per block. Exceeding the subscription count returns an error. Unsubscribe to free a slot. See
511
+ [row limits](#row-limits) for clamping and incomplete results.
510
512
  - **Filter and sort rules:** Use one property condition or one `and` group with up to 25 conditions.
511
513
  Nested groups and `or` are unsupported. You can sort by up to 10 unique properties. Empty values
512
514
  sort last in both directions. See the table below for property support and [Filters](#filters) for
@@ -546,20 +548,20 @@ Property values can be `null` when empty or unavailable.
546
548
  | `select` | 🟢 Selected option | 🟢 Supported | 🔴 Unavailable |
547
549
  | `multi_select` | 🟢 Selected options | 🟢 Supported | 🔴 Unavailable |
548
550
  | `status` | 🟢 Selected option | 🟢 Supported | 🔴 Unavailable |
549
- | `date` | 🟢 `start` and optional `end` strings | 🟡 Minute precision | 🟢 Supported |
551
+ | `date` | 🟢 `start` and optional `end` strings | 🟢 Supported | 🟢 Supported |
550
552
  | `people` | 🟢 Array of user or group ID objects | 🟢 Supported | 🟢 Supported |
551
- | `files` | 🟢 External links and hosted files | 🔴 Unavailable | 🔴 Unavailable |
552
- | `unique_id` | 🟡 Formatted ID | 🔴 Unavailable | 🔴 Unavailable |
553
553
  | `relation` | 🟢 Array of page ID objects | 🟢 Supported | 🔴 Unavailable |
554
+ | `created_time` | 🟢 Timestamp | 🟢 Supported | 🟢 Supported |
555
+ | `last_edited_time` | 🟢 Timestamp | 🟢 Supported | 🟢 Supported |
556
+ | `created_by` | 🟢 Actor reference | 🟢 Supported | 🟢 Supported |
557
+ | `last_edited_by` | 🟢 Actor reference | 🟢 Supported | 🟢 Supported |
558
+ | `files` | 🟢 External links and hosted files | 🔴 Unavailable | 🔴 Unavailable |
554
559
  | `place` | 🟢 Coordinates and optional place details | 🔴 Unavailable | 🔴 Unavailable |
560
+ | `unique_id` | 🟡 Formatted ID | 🔴 Unavailable | 🔴 Unavailable |
555
561
  | `formula` | 🟡 Stored text | 🔴 Unavailable | 🔴 Unavailable |
556
562
  | `rollup` | 🟡 Stored text | 🔴 Unavailable | 🔴 Unavailable |
557
563
  | `button` | 🟡 Button label | ⚫ Not supported in Notion | ⚫ Not supported in Notion |
558
564
  | `verification` | 🟡 Status text | 🔴 Unavailable | 🔴 Unavailable |
559
- | `created_time` | 🟢 Timestamp | 🟢 Supported | 🟢 Supported |
560
- | `last_edited_time` | 🟢 Timestamp | 🟢 Supported | 🟢 Supported |
561
- | `created_by` | 🟢 Actor reference | 🟢 Supported | 🟢 Supported |
562
- | `last_edited_by` | 🟢 Actor reference | 🟢 Supported | 🟢 Supported |
563
565
 
564
566
  ### Notes
565
567
 
@@ -576,8 +578,9 @@ Property values can be `null` when empty or unavailable.
576
578
  - Text values omit formatting, mention tokens, and annotations.
577
579
  - People properties return references with `object: "user"` or `object: "group"` and an `id`. Group
578
580
  IDs use the composite form `groupId|workspaceId`.
579
- - Date filters support comparisons, relative ranges, and start or end dates. They accept seconds and
580
- milliseconds but compare values at minute precision.
581
+ - Date filters support comparisons, relative ranges, and start or end dates.
582
+ - Date, Created time, and Last edited time filters use minute precision. Seconds and milliseconds
583
+ are not preserved.
581
584
  - Select, multi-select, and status query values contain option names and colors when available, and
582
585
  IDs when matched to the schema.
583
586
  - Query results use typed property objects. Narrow each object by its `type` field.
@@ -641,7 +644,10 @@ See [Pages property support](pages.md#property-support) for write support and re
641
644
  `NotionDataSourceRelationFilterOperator` — the operators accepted for each property type.
642
645
  - `NotionDataSourcePersonFilterValue` — an explicit `{ object: "user" | "group", id }` reference
643
646
  used by a people filter.
644
- - `DataSourceSnapshot` — current rows, schema, and status for one live data source query.
647
+ - `DataSourceSnapshot` — current rows, property mappings, status, and optional host cap for one live
648
+ query.
649
+ - `DataSourceQueryLimitClamp` — `{ requested: number, applied: number }` when the host reports a
650
+ cap.
645
651
  - `DataSourceQueryOptions` — the row limit, filter, sorts, and archive behavior shared by both query
646
652
  APIs.
647
653
  - `SubscribeToDataSourceArgs` — the key, `onSnapshot` listener, and optional query options for
@@ -723,8 +729,8 @@ const created = await dataSources.create("people", {
723
729
 
724
730
  These methods return `{ status: "success", ...data }` or `{ status: "error", error }`. A successful
725
731
  `query` result includes `isLoading: false`. The query releases its subscription after success or
726
- failure. Hooks and subscriptions keep their existing reactive behavior. `hasMore` reports truncation
727
- beyond the requested limit. Queries retain existing filters, sorts, and limits.
732
+ failure. Successful queries return the same snapshot fields as subscriptions, including optional
733
+ `limitClamp` metadata.
728
734
 
729
735
  `dataSources.create` accepts `Omit<CreatePageArgs, "parent" | "position">`. The selected binding
730
736
  supplies the create parent. `DataSourcesPageResult` describes get/create results.
package/docs/errors.md CHANGED
@@ -27,8 +27,7 @@ type CustomBlockErrorInfo<TCode extends string = string> = {
27
27
  request or configuration. A `false` value does not rule out success after you fix the query,
28
28
  schema, or bindings.
29
29
 
30
- Each API defines known `code` values for autocomplete and accepts other strings. This lets older
31
- SDKs receive new codes from newer hosts.
30
+ Each API defines known `code` values for autocomplete and accepts other strings.
32
31
 
33
32
  ## API-specific error types
34
33
 
@@ -92,8 +91,7 @@ results, including unknown codes.
92
91
  Disposing the SDK completes pending requests with `request_disposed`, clears their timers, and
93
92
  prevents new requests from being posted. It does not cancel work already running on the host.
94
93
 
95
- Messages with missing, unreadable, or unknown request IDs do not fail other requests. Older hosts
96
- may send NACKs without IDs; those requests retain the timeout fallback.
94
+ Messages with missing, unreadable, or unknown request IDs do not fail other requests.
97
95
 
98
96
  If a page update times out, updates already queued behind it for the same page complete with
99
97
  `previous_write_incomplete` and are not sent. A late response does not restart those updates. This
@@ -107,8 +105,8 @@ Data source subscriptions use a separate lifecycle and do not use this timeout.
107
105
  - `data_source_access_failed`: A page create or update operation cannot use its data source because
108
106
  the data source is unavailable, lacks workspace information, or does not allow the operation.
109
107
 
110
- - `data_source_query_invalid_limit`: The row limit is not a positive safe integer or exceeds the
111
- host maximum. The error message states the maximum when the host rejects an oversized request.
108
+ - `data_source_query_invalid_limit`: The row limit is not a positive safe integer. See
109
+ [row limits](data-sources.md#row-limits).
112
110
 
113
111
  - `data_source_schema_unavailable`: A query uses filters or sorts, but the host did not provide the
114
112
  database schema. Both the SDK and the generic host use this code. Queries without filters or sorts
@@ -162,6 +160,6 @@ See [Lifecycle and initialization](lifecycle.md) for initialization-specific err
162
160
 
163
161
  - Use `code` for error handling and `message` for developer-facing details. Do not branch on
164
162
  `message`.
165
- - Keep a default branch when switching on `code` to handle codes from newer hosts.
163
+ - Keep a default branch when switching on `code` to handle unknown codes.
166
164
  - Treat `isRetryable` as advice when deciding whether to offer or schedule a retry.
167
165
  - `"unknown_error"` means the host encountered an unexpected or unclassified failure.
package/docs/pages.md CHANGED
@@ -135,32 +135,32 @@ Property values can be `null` when empty or unavailable.
135
135
  - 🔒 **Read-only:** Notion sets this value. You cannot set it when creating or updating a page.
136
136
  - 🔴 **Unavailable:** The SDK does not support this operation.
137
137
 
138
- | Property type | Read page | Create page | Update page |
139
- | ------------------ | ----------------------------------------- | ------------------- | ------------------- |
140
- | `title` | 🟡 Plain text array | 🟡 Plain text only | 🟡 Plain text only |
141
- | `rich_text` | 🟡 Plain text array | 🟡 Plain text only | 🟡 Plain text only |
142
- | `number` | 🟢 Number | 🟢 Supported | 🟢 Supported |
143
- | `checkbox` | 🟢 Boolean | 🟢 Supported | 🟢 Supported |
144
- | `url` | 🟢 String | 🟢 Supported | 🟢 Supported |
145
- | `email` | 🟢 String | 🟢 Supported | 🟢 Supported |
146
- | `phone_number` | 🟢 String | 🟢 Supported | 🟢 Supported |
147
- | `select` | 🟢 Selected option | 🟢 Supported | 🟢 Supported |
148
- | `multi_select` | 🟢 Selected options | 🟢 Supported | 🟢 Supported |
149
- | `status` | 🟢 Selected option | 🟢 Supported | 🟢 Supported |
150
- | `date` | 🟢 `start` and optional `end` strings | 🟡 Minute precision | 🟡 Minute precision |
151
- | `people` | 🟢 Array of user or group ID objects | 🟢 Supported | 🟢 Supported |
152
- | `files` | 🟢 External links and hosted files | 🟡 File URLs only | 🟡 File URLs only |
153
- | `unique_id` | 🟡 Formatted ID | 🔴 Unavailable | 🔴 Unavailable |
154
- | `relation` | 🟢 Array of page ID objects | 🟡 Replaces value | 🟡 Replaces value |
155
- | `place` | 🟢 Coordinates and optional place details | 🟢 Supported | 🟢 Supported |
156
- | `formula` | 🟡 Stored text | 🔴 Unavailable | 🔴 Unavailable |
157
- | `rollup` | 🟡 Stored text | 🔴 Unavailable | 🔴 Unavailable |
158
- | `button` | 🟡 Button label | 🔴 Unavailable | 🔴 Unavailable |
159
- | `verification` | 🟡 Status text | 🔴 Unavailable | 🔴 Unavailable |
160
- | `created_time` | 🟢 Timestamp | 🔒 Read-only | 🔒 Read-only |
161
- | `last_edited_time` | 🟢 Timestamp | 🔒 Read-only | 🔒 Read-only |
162
- | `created_by` | 🟢 Actor reference | 🔒 Read-only | 🔒 Read-only |
163
- | `last_edited_by` | 🟢 Actor reference | 🔒 Read-only | 🔒 Read-only |
138
+ | Property type | Read page | Create page | Update page |
139
+ | ------------------ | ----------------------------------------- | ------------------ | ------------------ |
140
+ | `title` | 🟡 Plain text array | 🟡 Plain text only | 🟡 Plain text only |
141
+ | `rich_text` | 🟡 Plain text array | 🟡 Plain text only | 🟡 Plain text only |
142
+ | `number` | 🟢 Number | 🟢 Supported | 🟢 Supported |
143
+ | `checkbox` | 🟢 Boolean | 🟢 Supported | 🟢 Supported |
144
+ | `url` | 🟢 String | 🟢 Supported | 🟢 Supported |
145
+ | `email` | 🟢 String | 🟢 Supported | 🟢 Supported |
146
+ | `phone_number` | 🟢 String | 🟢 Supported | 🟢 Supported |
147
+ | `select` | 🟢 Selected option | 🟢 Supported | 🟢 Supported |
148
+ | `multi_select` | 🟢 Selected options | 🟢 Supported | 🟢 Supported |
149
+ | `status` | 🟢 Selected option | 🟢 Supported | 🟢 Supported |
150
+ | `date` | 🟢 `start` and optional `end` strings | 🟢 Supported | 🟢 Supported |
151
+ | `people` | 🟢 Array of user or group ID objects | 🟢 Supported | 🟢 Supported |
152
+ | `relation` | 🟢 Array of page ID objects | 🟡 Replaces value | 🟡 Replaces value |
153
+ | `place` | 🟢 Coordinates and optional place details | 🟢 Supported | 🟢 Supported |
154
+ | `files` | 🟢 External links and hosted files | 🔴 Unavailable | 🔴 Unavailable |
155
+ | `unique_id` | 🟡 Formatted ID | 🔴 Unavailable | 🔴 Unavailable |
156
+ | `formula` | 🟡 Stored text | 🔴 Unavailable | 🔴 Unavailable |
157
+ | `rollup` | 🟡 Stored text | 🔴 Unavailable | 🔴 Unavailable |
158
+ | `button` | 🟡 Button label | 🔴 Unavailable | 🔴 Unavailable |
159
+ | `verification` | 🟡 Status text | 🔴 Unavailable | 🔴 Unavailable |
160
+ | `created_time` | 🟢 Timestamp | 🔒 Read-only | 🔒 Read-only |
161
+ | `last_edited_time` | 🟢 Timestamp | 🔒 Read-only | 🔒 Read-only |
162
+ | `created_by` | 🟢 Actor reference | 🔒 Read-only | 🔒 Read-only |
163
+ | `last_edited_by` | 🟢 Actor reference | 🔒 Read-only | 🔒 Read-only |
164
164
 
165
165
  ### Notes
166
166
 
@@ -178,12 +178,10 @@ Property values can be `null` when empty or unavailable.
178
178
  - Select, multi-select, and status writes select existing options by ID or name. They do not create
179
179
  or edit schema options. If you supply both an ID and a name, the host uses the ID. The host
180
180
  rejects unknown IDs.
181
- - Date-time writes preserve hours and minutes but discard seconds and milliseconds.
181
+ - Date-time writes support minute precision. Seconds and milliseconds are not preserved.
182
182
  - Title and rich text use text arrays, but reads and writes preserve only plain text. Reads and
183
183
  writes do not preserve formatting, links, mentions, or equations as structured rich text.
184
- - Files reads return external links and signed URLs for Notion-hosted files, including create and
185
- update responses. File writes accept `external` URLs and existing `file` URLs and store them as
186
- links. Upload references (`file_upload`) are unsupported.
184
+ - Files reads return external links and signed URLs for Notion-hosted files.
187
185
  - Relation writes replace the value and reject `has_more: true`.
188
186
  - Top-level `created_time` and `last_edited_time` do not depend on the data source schema.
189
187
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -3,12 +3,11 @@ import type { BridgeDataSourceBindings } from "@notionhq/custom-blocks-protocol/
3
3
  import type { QueryDataSourceResultMessage } from "@notionhq/custom-blocks-protocol/dataSources/messages/queryDataSource.js"
4
4
  import type { InitMessage } from "@notionhq/custom-blocks-protocol/handshake/init.js"
5
5
  import type { CustomBlockInitResultErrorInfo } from "@notionhq/custom-blocks-protocol/handshake/initResult.js"
6
- import { hostToSandboxMessageSchema } from "@notionhq/custom-blocks-protocol/messages/hostToSandbox.js"
7
6
  import { readIncomingType } from "@notionhq/custom-blocks-protocol/messages/incomingType.js"
8
7
  import type { InvalidHostMessage } from "@notionhq/custom-blocks-protocol/messages/invalidHostMessage.js"
9
8
  import type { SandboxToHostMessage } from "@notionhq/custom-blocks-protocol/messages/sandboxToHost.js"
10
9
  import { readRequestId } from "@notionhq/custom-blocks-protocol/utils/readRequestId.js"
11
- import * as v from "valibot"
10
+ import type * as v from "valibot"
12
11
  import { applyContextMessage } from "../context/applyContextMessage.js"
13
12
  import type { CustomBlockHostState } from "../context/hostState.js"
14
13
  import { syncDocumentAppearance } from "../context/syncDocumentAppearance.js"
@@ -19,6 +18,7 @@ import { notifyListener } from "../utils/notifyListener.js"
19
18
  import { unreachable } from "../utils/unreachable.js"
20
19
  import { SandboxInitialization } from "./initialization/SandboxInitialization.js"
21
20
  import type { MessageInterceptor } from "./messageInterceptor.js"
21
+ import { parseHostToSandboxMessage } from "./parseHostToSandboxMessage.js"
22
22
  import {
23
23
  type RequestMessage,
24
24
  Requests,
@@ -113,7 +113,7 @@ export class SandboxBridge {
113
113
  return
114
114
  }
115
115
 
116
- const parsed = v.safeParse(hostToSandboxMessageSchema, data)
116
+ const parsed = parseHostToSandboxMessage(data)
117
117
  if (!parsed.success) {
118
118
  console.warn(
119
119
  "[custom-blocks-sdk] ignoring malformed host message",