@notionhq/custom-blocks 0.0.76 → 0.0.77

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 (34) hide show
  1. package/HOST.md +9 -5
  2. package/dist/bridge/SandboxBridge.d.ts +0 -1
  3. package/dist/bridge/SandboxBridge.d.ts.map +1 -1
  4. package/dist/bridge/SandboxBridge.js +15 -34
  5. package/dist/bridge/hostState.d.ts +1 -2
  6. package/dist/bridge/hostState.d.ts.map +1 -1
  7. package/dist/bridge/messages/hostToSandbox.d.ts +3 -79
  8. package/dist/bridge/messages/hostToSandbox.d.ts.map +1 -1
  9. package/dist/bridge/messages/hostToSandbox.js +2 -3
  10. package/dist/bridge/messages/queryDataSource.d.ts +3 -7
  11. package/dist/bridge/messages/queryDataSource.d.ts.map +1 -1
  12. package/dist/bridge/messages/queryDataSource.js +3 -7
  13. package/dist/bridge/messages/queryDataSourceResult.d.ts +4 -240
  14. package/dist/bridge/messages/queryDataSourceResult.d.ts.map +1 -1
  15. package/dist/bridge/messages/queryDataSourceResult.js +4 -22
  16. package/dist/bridge/messages/sandboxToHost.d.ts +1 -2
  17. package/dist/bridge/messages/sandboxToHost.d.ts.map +1 -1
  18. package/dist/host/createCustomBlockHost.d.ts.map +1 -1
  19. package/dist/host/createCustomBlockHost.js +25 -20
  20. package/dist/host/queries/querySubscriptions.d.ts +10 -10
  21. package/dist/host/queries/querySubscriptions.d.ts.map +1 -1
  22. package/dist/host/queries/querySubscriptions.js +35 -19
  23. package/dist/host/queries/types.d.ts +5 -4
  24. package/dist/host/queries/types.d.ts.map +1 -1
  25. package/dist/version.js +1 -1
  26. package/package.json +1 -1
  27. package/src/bridge/SandboxBridge.ts +15 -35
  28. package/src/bridge/hostState.ts +1 -2
  29. package/src/bridge/messages/hostToSandbox.ts +2 -6
  30. package/src/bridge/messages/queryDataSource.ts +3 -7
  31. package/src/bridge/messages/queryDataSourceResult.ts +4 -24
  32. package/src/host/createCustomBlockHost.ts +27 -22
  33. package/src/host/queries/querySubscriptions.ts +58 -39
  34. package/src/host/queries/types.ts +10 -11
package/HOST.md CHANGED
@@ -34,7 +34,7 @@ const host = createCustomBlockHost({
34
34
  dataSources: { bindings },
35
35
  },
36
36
  handlers: {
37
- queryDataSource: async (message) => ({ items: [], hasMore: false }),
37
+ queryDataSource: async (message) => ({ status: "success", items: [], hasMore: false }),
38
38
  },
39
39
  });
40
40
  ```
@@ -94,7 +94,11 @@ If the sandbox reports a version below the host's supported minimum, reply with
94
94
 
95
95
  ### Conventions
96
96
 
97
- Every request/response pair uses a string `requestId`. The sender tracks pending requests by id; the receiver echoes the id on the matching result. The sandbox drops stale results that no longer match the latest outstanding request for that operation.
97
+ One-shot RPC request/result pairs use a string `requestId`. The sender tracks pending requests by id, and the receiver echoes the id on the matching result. Lifecycle and one-way messages use neither request nor subscription identity.
98
+
99
+ `queryDataSource` is a long-lived subscription rather than a one-shot RPC. It and every `queryDataSourceResult` update use only a stable string `subscriptionId`. The host may push additional results for that subscription whenever its data changes; the sandbox ignores results for subscriptions it no longer recognizes.
100
+
101
+ Hosts key query state by `subscriptionId`, not `dataSourceId`: multiple subscriptions may target the same data source, and a data-source refresh must update all of them. A new request with an existing `subscriptionId` replaces that subscription, so hosts must suppress an older handler result that resolves after the replacement. Subscription lifetime ends when the host/bridge is torn down; protocol v3 has no unsubscribe message.
98
102
 
99
103
  Both sides validate inbound messages with valibot schemas. Failed parses are logged and NACKed with `invalidHostMessage` or `invalidSandboxMessage`. Never answer a NACK with another NACK.
100
104
 
@@ -108,7 +112,7 @@ Hosts should emit the most specific stable code available. Unexpected or unclass
108
112
 
109
113
  Host implementers can use the API-specific aliases and schemas when shaping outbound failures: `CustomBlockCreatePageErrorCode` / `CustomBlockCreatePageErrorInfo` / `customBlockCreatePageErrorCodeSchema` / `customBlockCreatePageErrorInfoSchema`, `CustomBlockGetPageErrorCode` / `CustomBlockGetPageErrorInfo` / `customBlockGetPageErrorCodeSchema` / `customBlockGetPageErrorInfoSchema`, `CustomBlockGetUserErrorCode` / `CustomBlockGetUserErrorInfo` / `customBlockGetUserErrorCodeSchema` / `customBlockGetUserErrorInfoSchema`, `CustomBlockListUsersErrorCode` / `CustomBlockListUsersErrorInfo` / `customBlockListUsersErrorCodeSchema` / `customBlockListUsersErrorInfoSchema`, `CustomBlockQueryDataSourceErrorCode` / `CustomBlockQueryDataSourceErrorInfo` / `customBlockQueryDataSourceErrorCodeSchema` / `customBlockQueryDataSourceErrorInfoSchema`, and `CustomBlockUpdatePageErrorCode` / `CustomBlockUpdatePageErrorInfo` / `customBlockUpdatePageErrorCodeSchema` / `customBlockUpdatePageErrorInfoSchema`. Shared categories are exported as `CustomBlockPropertyErrorCode` / `CustomBlockPropertyErrorInfo` / `customBlockPropertyErrorCodeSchema` and `CustomBlockDataSourceResolutionErrorCode` / `CustomBlockDataSourceResolutionErrorInfo` / `customBlockDataSourceResolutionErrorCodeSchema`. The broad fallback schema remains `customBlockErrorInfoSchema`.
110
114
 
111
- `queryDataSource` carries the resolved raw `dataSourceId` and a sandbox-generated `snapshotId`; semantic data-source keys never cross the bridge for queries. `createPage` arrives with `parent` already resolved to `page_id` or `data_source_id`.
115
+ `queryDataSource` carries the resolved raw `dataSourceId` and a sandbox-generated `subscriptionId`; semantic data-source keys never cross the bridge for queries. `createPage` arrives with `parent` already resolved to `page_id` or `data_source_id`.
112
116
 
113
117
  ## Data sources
114
118
 
@@ -139,7 +143,7 @@ Messages sent from the sandbox to the host. Parse `window` `message` events with
139
143
  | Wire type | Type / schema | Behavior |
140
144
  | -------------------- | --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
141
145
  | `ready` | `ReadyMessage` / `readyMessageSchema` | One-shot handshake; carries `bridgeProtocolVersion`, `sdkVersion`, and the manifest. |
142
- | `queryDataSource` | `QueryDataSourceMessage` / `queryDataSourceMessageSchema` | `requestId`-keyed request for the current rows in a raw `dataSourceId`. `snapshotId` names the SDK result slot to update, so later refreshes for the same `useDataSource` call replace the same snapshot instead of creating a new one. |
146
+ | `queryDataSource` | `QueryDataSourceMessage` / `queryDataSourceMessageSchema` | Starts or updates a `subscriptionId`-keyed subscription for rows in a raw `dataSourceId`. Later results for the same subscription replace its current value. |
143
147
  | `createPage` | `CreatePageMessage` / `createPageMessageSchema` | `requestId`-keyed page creation with properties and optional position; parent is `page_id` or `data_source_id`. Create-time icon and cover are not supported. |
144
148
  | `getPage` | `GetPageMessage` / `getPageMessageSchema` | `requestId`-keyed page fetch by page id. |
145
149
  | `updatePage` | `UpdatePageMessage` / `updatePageMessageSchema` | `requestId`-keyed patch (properties, icon, cover, or `archived`). |
@@ -162,7 +166,7 @@ Messages sent from the host to the sandbox. Same `{ wire type, type / schema, be
162
166
  | `pageChanged` | `PageChangedMessage` / `pageChangedMessageSchema` | Replaces the nearest page ancestor without disturbing theme, block ID, parent, user, or query state. |
163
167
  | `currentUserChanged` | `CurrentUserChangedMessage` / `currentUserChangedMessageSchema` | Replaces the current viewer record. Send when any viewer field changes (name, avatar, email). |
164
168
  | `dataSourcesChanged` | `DataSourcesChangedMessage` / `dataSourcesChangedMessageSchema` | Replaces data-source bindings; the sandbox preserves cached query state for keys that still exist and drops removed keys. |
165
- | `queryDataSourceResult` | `QueryDataSourceResultMessage` / `queryDataSourceResultMessageSchema` | `requestId` / `snapshotId`-keyed response with `status: "success"`, `items`, and `hasMore`, or `status: "error"` and `error`. |
169
+ | `queryDataSourceResult` | `QueryDataSourceResultMessage` / `queryDataSourceResultMessageSchema` | `subscriptionId`-keyed update with `status: "success"`, `items`, and `hasMore`, or `status: "error"` and `error`. |
166
170
  | `createPageResult` | `CreatePageResultMessage` / `createPageResultMessageSchema` | `requestId`-keyed page response with `status: "success"` or `status: "error"`. |
167
171
  | `getPageResult` | `GetPageResultMessage` / `getPageResultMessageSchema` | Same success/error shape as `createPageResult`. |
168
172
  | `updatePageResult` | `UpdatePageResultMessage` / `updatePageResultMessageSchema` | Same success/error shape as `createPageResult`. |
@@ -25,7 +25,6 @@ export declare class SandboxBridge {
25
25
  private listeners;
26
26
  private messageLog;
27
27
  private messageLogListeners;
28
- private nextRequestId;
29
28
  private readonly pendingCreatePage;
30
29
  private readonly pendingGetPage;
31
30
  private readonly pendingGetUser;
@@ -1 +1 @@
1
- {"version":3,"file":"SandboxBridge.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/SandboxBridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,aAAa,CAAA;AAGpB,OAAO,KAAK,EACX,gBAAgB,EAEhB,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EACX,+BAA+B,EAC/B,gCAAgC,EAChC,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EACN,KAAK,oBAAoB,EAGzB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAQxD,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAW3E;;;;GAIG;AAEH,eAAO,MAAM,oCAAoC,IAAI,CAAA;AAErD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,UAAU,CAAA;IAC9B,IAAI,EAAE,OAAO,CAAA;CACb,CAAA;AAED,qBAAa,aAAa;IACzB,OAAO,CAAC,SAAS,CAGhB;IACD,OAAO,CAAC,SAAS,CAAwB;IACzC,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,mBAAmB,CAAwB;IACnD,OAAO,CAAC,aAAa,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Y,GAAG,OAAO,CAAC,aAAa,CAAC;IAYrD,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAYrD,SAAS,CAAC,KAAK,GAAE,cAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;IAa/D,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA2C7D;;;;OAIG;IACH,oBAAoB,CAAC,IAAI,EAAE;QAC1B,UAAU,EAAE,gBAAgB,CAAA;QAC5B,MAAM,EAAE,YAAY,CAAA;QACpB,KAAK,EAAE,+BAA+B,CAAA;KACtC,GAAG,OAAO,CAAC,gCAAgC,CAAC;IAuB7C;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;CAkE/B"}
1
+ {"version":3,"file":"SandboxBridge.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/SandboxBridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,aAAa,CAAA;AAGpB,OAAO,KAAK,EACX,gBAAgB,EAEhB,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EACX,+BAA+B,EAC/B,gCAAgC,EAChC,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EACN,KAAK,oBAAoB,EAGzB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAQxD,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAW3E;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,IAAI,CAAA;AAErD;;;GAGG;AACH,MAAM,MAAM,eAAe,GA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jC,OAAO,CAAC,SAAS;IA+CjB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB;IAgE/D,OAAO,CAAC,uBAAuB;IAwB/B,UAAU,CAAC,MAAM,EAAE,MAAM;IAazB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA8B7D,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAYrD,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAYrD,SAAS,CAAC,KAAK,GAAE,cAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;IAa/D,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA2C7D;;;;OAIG;IACH,oBAAoB,CAAC,IAAI,EAAE;QAC1B,UAAU,EAAE,gBAAgB,CAAA;QAC5B,MAAM,EAAE,YAAY,CAAA;QACpB,KAAK,EAAE,+BAA+B,CAAA;KACtC,GAAG,OAAO,CAAC,gCAAgC,CAAC;IAuB7C;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;CAkE/B"}
@@ -13,7 +13,6 @@ import { PendingRequests } from "./pendingRequests.js";
13
13
  * single host needs to support multiple custom blocks built with different versions of the bridge
14
14
  * protocol. Increment this number any time a breaking change is made to the bridge protocol.
15
15
  */
16
- // TODO(custom-blocks): Update when bumping bridge protocol version to 3.
17
16
  export const CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION = 2;
18
17
  export class SandboxBridge {
19
18
  constructor() {
@@ -24,7 +23,6 @@ export class SandboxBridge {
24
23
  this.listeners = new Set();
25
24
  this.messageLog = [];
26
25
  this.messageLogListeners = new Set();
27
- this.nextRequestId = 1;
28
26
  this.pendingCreatePage = new PendingRequests("custom-block-create-page");
29
27
  this.pendingGetPage = new PendingRequests("custom-block-get-page");
30
28
  this.pendingGetUser = new PendingRequests("custom-block-get-user");
@@ -198,30 +196,21 @@ export class SandboxBridge {
198
196
  return;
199
197
  }
200
198
  case "queryDataSourceResult": {
201
- const queryEntry = Object.entries(hostState.dataSourceState).find(([, state]) => state.latestSnapshotId === message.snapshotId);
199
+ const queryEntry = Object.entries(hostState.dataSourceState).find(([, state]) => state.subscriptionId === message.subscriptionId);
202
200
  if (queryEntry === undefined) {
203
201
  return;
204
202
  }
205
203
  const [key, currentState] = queryEntry;
206
- if (currentState.latestRequestId !== message.requestId) {
207
- return;
208
- }
209
- const queryResult = "status" in message
210
- ? message.status === "error"
211
- ? {
212
- items: [],
213
- hasMore: false,
214
- error: message.error,
215
- }
216
- : {
217
- items: message.items,
218
- hasMore: message.hasMore,
219
- error: undefined,
220
- }
204
+ const queryResult = message.status === "error"
205
+ ? {
206
+ items: [],
207
+ hasMore: false,
208
+ error: message.error,
209
+ }
221
210
  : {
222
211
  items: message.items,
223
212
  hasMore: message.hasMore,
224
- error: message.error,
213
+ error: undefined,
225
214
  };
226
215
  this.hostState = {
227
216
  ...hostState,
@@ -232,10 +221,7 @@ export class SandboxBridge {
232
221
  isLoading: false,
233
222
  hasMore: queryResult.hasMore,
234
223
  error: queryResult.error,
235
- // Keep the request ID so later host-pushed refreshes for the
236
- // same subscription still match.
237
- latestRequestId: message.requestId,
238
- latestSnapshotId: message.snapshotId,
224
+ subscriptionId: message.subscriptionId,
239
225
  latestLimit: currentState.latestLimit,
240
226
  },
241
227
  },
@@ -418,16 +404,14 @@ export class SandboxBridge {
418
404
  return;
419
405
  }
420
406
  const limit = resolveDataSourceQueryLimit(options.limit);
421
- const snapshotId = makeDataSourceSnapshotId({
407
+ const subscriptionId = makeDataSourceSubscriptionId({
422
408
  key,
423
409
  });
424
410
  if (currentState.isLoading &&
425
- currentState.latestSnapshotId === snapshotId &&
411
+ currentState.subscriptionId === subscriptionId &&
426
412
  currentState.latestLimit === limit) {
427
413
  return;
428
414
  }
429
- const requestId = `custom-block-query-${this.nextRequestId}`;
430
- this.nextRequestId += 1;
431
415
  this.hostState = {
432
416
  ...this.hostState,
433
417
  dataSourceState: {
@@ -436,8 +420,7 @@ export class SandboxBridge {
436
420
  ...currentState,
437
421
  isLoading: true,
438
422
  error: undefined,
439
- latestRequestId: requestId,
440
- latestSnapshotId: snapshotId,
423
+ subscriptionId,
441
424
  latestLimit: limit,
442
425
  },
443
426
  },
@@ -445,8 +428,7 @@ export class SandboxBridge {
445
428
  this.notify();
446
429
  const outbound = {
447
430
  type: "queryDataSource",
448
- requestId,
449
- snapshotId,
431
+ subscriptionId,
450
432
  dataSourceId: dataSource.collectionPointer.id,
451
433
  limit,
452
434
  };
@@ -464,8 +446,7 @@ export class SandboxBridge {
464
446
  ...currentState,
465
447
  isLoading: false,
466
448
  error,
467
- latestRequestId: undefined,
468
- latestSnapshotId: undefined,
449
+ subscriptionId: undefined,
469
450
  latestLimit: undefined,
470
451
  },
471
452
  },
@@ -708,7 +689,7 @@ function resolveDataSourceQueryLimit(limit) {
708
689
  }
709
690
  return limit;
710
691
  }
711
- function makeDataSourceSnapshotId(args) {
692
+ function makeDataSourceSubscriptionId(args) {
712
693
  const { key } = args;
713
694
  return `data-source:${encodeURIComponent(key)}`;
714
695
  }
@@ -28,8 +28,7 @@ export type DataSourceQueryState = {
28
28
  isLoading: boolean;
29
29
  hasMore: boolean;
30
30
  error?: CustomBlockQueryDataSourceErrorInfo;
31
- latestRequestId?: string;
32
- latestSnapshotId?: string;
31
+ subscriptionId?: string;
33
32
  latestLimit?: number;
34
33
  };
35
34
  export declare function createEmptyDataSourceQueryState(): DataSourceQueryState;
@@ -1 +1 @@
1
- {"version":3,"file":"hostState.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/hostState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,KAAK,EACX,oBAAoB,EACpB,0BAA0B,EAC1B,+BAA+B,EAC/B,gCAAgC,EAChC,MA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AED,wBAAgB,+BAA+B,IAAI,oBAAoB,CAMtE;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,oBAAoB,EAAE,CAAA;IAC7B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;IACvD,mBAAmB,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAE,CAAA;IACnE,gBAAgB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;KAAE,CAAA;IACvD,oBAAoB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAAA;KAAE,CAAA;IACzE,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,mCAAmC,CAAA;CAC3C,CAAA;AAWD;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE;IAC3C,UAAU,EAAE,gBAAgB,CAAA;IAC5B,MAAM,EAAE,YAAY,CAAA;IACpB,KAAK,EAAE,+BAA+B,CAAA;CACtC,KAAK,OAAO,CAAC,gCAAgC,CAAC,CAAA;AAE/C,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,oBAAoB,EAC/B,GAAG,EAAE,MAAM,EACX,oBAAoB,EAAE,sBAAsB,GAC1C,mBAAmB,CAgErB"}
1
+ {"version":3,"file":"hostState.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/hostState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,KAAK,EACX,oBAAoB,EACpB,0BAA0B,EAC1B,+BAA+B,EAC/B,gCAAgC,EAChC,MAAM,iCAAiC,CAAA;AAExC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,C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oB,EAAE,CAAA;IAC7B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;IACvD,mBAAmB,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAE,CAAA;IACnE,gBAAgB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;KAAE,CAAA;IACvD,oBAAoB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAAA;KAAE,CAAA;IACzE,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,mCAAmC,CAAA;CAC3C,CAAA;AAWD;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE;IAC3C,UAAU,EAAE,gBAAgB,CAAA;IAC5B,MAAM,EAAE,YAAY,CAAA;IACpB,KAAK,EAAE,+BAA+B,CAAA;CACtC,KAAK,OAAO,CAAC,gCAAgC,CAAC,CAAA;AAE/C,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,oBAAoB,EAC/B,GAAG,EAAE,MAAM,EACX,oBAAoB,EAAE,sBAAsB,GAC1C,mBAAmB,CAgErB"}
@@ -412,8 +412,7 @@ export declare const hostToSandboxMessageSchema: v.VariantSchema<"type", [v.Vari
412
412
  }, undefined>;
413
413
  }, undefined>, v.VariantSchema<"status", [v.ObjectSchema<{
414
414
  readonly type: v.LiteralSchema<"queryDataSourceResult", undefined>;
415
- readonly requestId: v.StringSchema<undefined>;
416
- readonly snapshotId: v.StringSchema<undefined>;
415
+ readonly subscriptionId: v.StringSchema<undefined>;
417
416
  readonly status: v.LiteralSchema<"success", undefined>;
418
417
  readonly items: v.ArraySchema<v.ObjectSchema<{
419
418
  readonly id: v.CustomSchema<import("../ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
@@ -482,89 +481,14 @@ export declare const hostToSandboxMessageSchema: v.VariantSchema<"type", [v.Vari
482
481
  readonly hasMore: v.BooleanSchema<undefined>;
483
482
  }, undefined>, v.ObjectSchema<{
484
483
  readonly type: v.LiteralSchema<"queryDataSourceResult", undefined>;
485
- readonly requestId: v.StringSchema<undefined>;
486
- readonly snapshotId: v.StringSchema<undefined>;
484
+ readonly subscriptionId: v.StringSchema<undefined>;
487
485
  readonly status: v.LiteralSchema<"error", undefined>;
488
486
  readonly error: v.ObjectSchema<{
489
487
  readonly code: v.StringSchema<undefined>;
490
488
  readonly message: v.StringSchema<undefined>;
491
489
  readonly isRetryable: v.BooleanSchema<undefined>;
492
490
  }, undefined>;
493
- }, undefined>], undefined>, v.ObjectSchema<{
494
- readonly type: v.LiteralSchema<"queryDataSourceResult", undefined>;
495
- readonly requestId: v.StringSchema<undefined>;
496
- readonly snapshotId: v.StringSchema<undefined>;
497
- readonly items: v.ArraySchema<v.ObjectSchema<{
498
- readonly id: v.CustomSchema<import("../ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
499
- readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.BooleanSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
500
- readonly type: v.LiteralSchema<"date", undefined>;
501
- readonly start_date: v.StringSchema<undefined>;
502
- readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
503
- readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
504
- readonly value: v.NumberSchema<undefined>;
505
- readonly time: v.StringSchema<undefined>;
506
- readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
507
- }, undefined>, v.ObjectSchema<{
508
- readonly unit: v.LiteralSchema<"none", undefined>;
509
- }, undefined>], undefined>, undefined>;
510
- }, undefined>, v.ObjectSchema<{
511
- readonly type: v.LiteralSchema<"daterange", undefined>;
512
- readonly start_date: v.StringSchema<undefined>;
513
- readonly end_date: v.StringSchema<undefined>;
514
- readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
515
- readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
516
- readonly value: v.NumberSchema<undefined>;
517
- readonly time: v.StringSchema<undefined>;
518
- readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
519
- }, undefined>, v.ObjectSchema<{
520
- readonly unit: v.LiteralSchema<"none", undefined>;
521
- }, undefined>], undefined>, undefined>;
522
- }, undefined>, v.ObjectSchema<{
523
- readonly type: v.LiteralSchema<"datetime", undefined>;
524
- readonly start_date: v.StringSchema<undefined>;
525
- readonly start_time: v.StringSchema<undefined>;
526
- readonly time_zone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
527
- readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
528
- readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
529
- readonly value: v.NumberSchema<undefined>;
530
- readonly time: v.StringSchema<undefined>;
531
- readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
532
- }, undefined>, v.ObjectSchema<{
533
- readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
534
- readonly value: v.NumberSchema<undefined>;
535
- }, undefined>], undefined>, v.ObjectSchema<{
536
- readonly unit: v.LiteralSchema<"none", undefined>;
537
- }, undefined>], undefined>, undefined>;
538
- }, undefined>, v.ObjectSchema<{
539
- readonly type: v.LiteralSchema<"datetimerange", undefined>;
540
- readonly start_date: v.StringSchema<undefined>;
541
- readonly start_time: v.StringSchema<undefined>;
542
- readonly end_date: v.StringSchema<undefined>;
543
- readonly end_time: v.StringSchema<undefined>;
544
- readonly time_zone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
545
- readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
546
- readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
547
- readonly value: v.NumberSchema<undefined>;
548
- readonly time: v.StringSchema<undefined>;
549
- readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
550
- }, undefined>, v.ObjectSchema<{
551
- readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
552
- readonly value: v.NumberSchema<undefined>;
553
- }, undefined>], undefined>, v.ObjectSchema<{
554
- readonly unit: v.LiteralSchema<"none", undefined>;
555
- }, undefined>], undefined>, undefined>;
556
- }, undefined>], undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ArraySchema<v.ObjectSchema<{
557
- readonly id: v.StringSchema<undefined>;
558
- readonly table: v.StringSchema<undefined>;
559
- }, undefined>, undefined>], undefined>, undefined>, undefined>;
560
- }, undefined>, undefined>;
561
- readonly hasMore: v.BooleanSchema<undefined>;
562
- readonly error: v.OptionalSchema<v.ObjectSchema<{
563
- readonly code: v.StringSchema<undefined>;
564
- readonly message: v.StringSchema<undefined>;
565
- readonly isRetryable: v.BooleanSchema<undefined>;
566
- }, undefined>, undefined>;
567
- }, undefined>, v.VariantSchema<"status", [v.ObjectSchema<{
491
+ }, undefined>], undefined>, v.VariantSchema<"status", [v.ObjectSchema<{
568
492
  readonly type: v.LiteralSchema<"createPageResult", undefined>;
569
493
  readonly requestId: v.StringSchema<undefined>;
570
494
  readonly status: v.LiteralSchema<"success", undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"hostToSandbox.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/messages/hostToSandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAkB5B;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAcrC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAC/C,OAAO,0BAA0B,CACjC,CAAA"}
@@ -9,7 +9,7 @@ import { invalidSandboxMessageSchema } from "./invalidSandboxMessage.js";
9
9
  import { listUsersResultMessageSchema } from "./listUsers.js";
10
10
  import { pageChangedMessageSchema } from "./pageChanged.js";
11
11
  import { parentChangedMessageSchema } from "./parentChanged.js";
12
- import { legacyQueryDataSourceResultMessageSchema, statusQueryDataSourceResultMessageSchema, } from "./queryDataSourceResult.js";
12
+ import { queryDataSourceResultMessageSchema } from "./queryDataSourceResult.js";
13
13
  import { themeChangedMessageSchema } from "./themeChanged.js";
14
14
  import { updatePageResultMessageSchema } from "./updatePageResult.js";
15
15
  /**
@@ -22,8 +22,7 @@ export const hostToSandboxMessageSchema = v.variant("type", [
22
22
  pageChangedMessageSchema,
23
23
  currentUserChangedMessageSchema,
24
24
  dataSourcesChangedMessageSchema,
25
- statusQueryDataSourceResultMessageSchema,
26
- legacyQueryDataSourceResultMessageSchema,
25
+ queryDataSourceResultMessageSchema,
27
26
  createPageResultMessageSchema,
28
27
  getPageResultMessageSchema,
29
28
  getUserResultMessageSchema,
@@ -5,15 +5,11 @@ import * as v from "valibot";
5
5
  */
6
6
  export declare const queryDataSourceMessageSchema: v.ObjectSchema<{
7
7
  readonly type: v.LiteralSchema<"queryDataSource", undefined>;
8
- readonly requestId: v.StringSchema<undefined>;
9
- /**
10
- * The stable snapshot ID that identifies the SDK result slot to update. This is stable for the
11
- * lifetime of the subscription.
12
- */
13
- readonly snapshotId: v.StringSchema<undefined>;
8
+ /** Stable for the lifetime of this query subscription. */
9
+ readonly subscriptionId: v.StringSchema<undefined>;
14
10
  /** The raw Notion data source ID to read from. */
15
11
  readonly dataSourceId: v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
16
- /** The number of items to return in the snapshot. */
12
+ /** The number of items to return in each subscription update. */
17
13
  readonly limit: v.NumberSchema<undefined>;
18
14
  }, undefined>;
19
15
  export type QueryDataSourceMessage = v.InferOutput<typeof queryDataSourceMessageSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"queryDataSource.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/messages/queryDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;IAGxC;;;OAGG;;IAEH,kDAAkD;;IAElD,qDAAqD;;aAEpD,CAAA;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,WAAW,CACjD,OAAO,4BAA4B,CACnC,CAAA"}
1
+ {"version":3,"file":"queryDataSource.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/messages/queryDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;IAExC,0DAA0D;;IAE1D,kDAAkD;;IAElD,iEAAiE;;aAEhE,CAAA;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,WAAW,CACjD,OAAO,4BAA4B,CACnC,CAAA"}
@@ -6,14 +6,10 @@ import { notionDataSourceIdSchema } from "../ids.js";
6
6
  */
7
7
  export const queryDataSourceMessageSchema = v.object({
8
8
  type: v.literal("queryDataSource"),
9
- requestId: v.string(),
10
- /**
11
- * The stable snapshot ID that identifies the SDK result slot to update. This is stable for the
12
- * lifetime of the subscription.
13
- */
14
- snapshotId: v.string(),
9
+ /** Stable for the lifetime of this query subscription. */
10
+ subscriptionId: v.string(),
15
11
  /** The raw Notion data source ID to read from. */
16
12
  dataSourceId: notionDataSourceIdSchema,
17
- /** The number of items to return in the snapshot. */
13
+ /** The number of items to return in each subscription update. */
18
14
  limit: v.number(),
19
15
  });