@notionhq/custom-blocks 0.1.16 → 0.1.18

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 (58) hide show
  1. package/dist/bridge/SandboxBridge.d.ts +3 -3
  2. package/dist/bridge/SandboxBridge.d.ts.map +1 -1
  3. package/dist/bridge/SandboxBridge.js +7 -5
  4. package/dist/bridge/dataSources/resolveProperty.d.ts +2 -1
  5. package/dist/bridge/dataSources/resolveProperty.d.ts.map +1 -1
  6. package/dist/bridge/hostState.d.ts +2 -1
  7. package/dist/bridge/hostState.d.ts.map +1 -1
  8. package/dist/bridge/sandboxClient.d.ts +1 -0
  9. package/dist/bridge/sandboxClient.d.ts.map +1 -1
  10. package/dist/bridge/sandboxClient.js +26 -17
  11. package/dist/index.d.ts +1 -2
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/init.d.ts.map +1 -1
  14. package/dist/init.js +1 -0
  15. package/dist/protocol/dataSources/dataSource.d.ts +12 -12
  16. package/dist/protocol/dataSources/dataSourcePage.d.ts +1 -52
  17. package/dist/protocol/dataSources/dataSourcePage.d.ts.map +1 -1
  18. package/dist/protocol/dataSources/dataSourcePage.js +1 -3
  19. package/dist/protocol/ids.d.ts +10 -26
  20. package/dist/protocol/ids.d.ts.map +1 -1
  21. package/dist/protocol/ids.js +25 -5
  22. package/dist/protocol/messages/createPage.d.ts +8 -8
  23. package/dist/protocol/messages/createPageResult.d.ts +5 -5
  24. package/dist/protocol/messages/currentUserChanged.d.ts +1 -1
  25. package/dist/protocol/messages/dataSourcesChanged.d.ts +3 -3
  26. package/dist/protocol/messages/getPage.d.ts +6 -6
  27. package/dist/protocol/messages/getUser.d.ts +2 -2
  28. package/dist/protocol/messages/getUser.js +2 -2
  29. package/dist/protocol/messages/hostToSandbox.d.ts +45 -45
  30. package/dist/protocol/messages/init.d.ts +14 -14
  31. package/dist/protocol/messages/listUsers.d.ts +1 -1
  32. package/dist/protocol/messages/pageChanged.d.ts +5 -5
  33. package/dist/protocol/messages/parentChanged.d.ts +4 -4
  34. package/dist/protocol/messages/queryDataSource.d.ts +1 -1
  35. package/dist/protocol/messages/queryDataSourceResult.d.ts +1 -1
  36. package/dist/protocol/messages/sandboxToHost.d.ts +8 -8
  37. package/dist/protocol/messages/updatePage.d.ts +1 -1
  38. package/dist/protocol/messages/updatePageResult.d.ts +5 -5
  39. package/dist/protocol/pages/page.d.ts +10 -24
  40. package/dist/protocol/pages/page.d.ts.map +1 -1
  41. package/dist/protocol/parent.d.ts +4 -4
  42. package/dist/protocol/users/user.d.ts +4 -7
  43. package/dist/protocol/users/user.d.ts.map +1 -1
  44. package/dist/protocol/users/user.js +2 -1
  45. package/dist/react/standalonePreview.d.ts.map +1 -1
  46. package/dist/react/standalonePreview.js +3 -1
  47. package/dist/types.d.ts +64 -6
  48. package/dist/types.d.ts.map +1 -1
  49. package/dist/version.js +1 -1
  50. package/package.json +1 -1
  51. package/src/bridge/SandboxBridge.ts +8 -10
  52. package/src/bridge/dataSources/resolveProperty.ts +2 -4
  53. package/src/bridge/hostState.ts +6 -6
  54. package/src/bridge/sandboxClient.ts +28 -17
  55. package/src/index.ts +0 -8
  56. package/src/init.ts +1 -0
  57. package/src/react/standalonePreview.ts +3 -1
  58. package/src/types.ts +72 -10
@@ -1,7 +1,6 @@
1
1
  import type { NotionDataSource } from "../protocol/dataSources/dataSource.js";
2
- import type { NotionDataSourcePageUpdateArgs, NotionDataSourcePageUpdateResult } from "../protocol/dataSources/dataSourcePage.js";
3
2
  import { type InitMessage } from "../protocol/messages/init.js";
4
- import type { CreatePageArgs, CreatePageResult, GetPageResult, GetUserResult, ListUsersArgs, ListUsersResult, NotionPageId, NotionUserId, UpdatePageArgs, UpdatePageResult, UseDataSourceOptions } from "../types.js";
3
+ import type { CreatePageArgs, CreatePageResult, GetPageResult, GetUserResult, ListUsersArgs, ListUsersResult, NotionDataSourcePageUpdateArgs, NotionDataSourcePageUpdateResult, NotionPageId, NotionUserId, UpdatePageArgs, UpdatePageResult, UseDataSourceOptions } from "../types.js";
5
4
  import { type CustomBlockHostState } from "./hostState.js";
6
5
  import type { ManifestLoadResult } from "./loadManifest.js";
7
6
  /**
@@ -29,10 +28,11 @@ export declare class SandboxBridge {
29
28
  private initializationId;
30
29
  private latestDataSourceBindings;
31
30
  private isMockState;
31
+ private isListening;
32
32
  private resolveInit;
33
33
  private rejectInit;
34
34
  private readonly initMessage;
35
- constructor();
35
+ startListening(): void;
36
36
  private static MAX_LOG_ENTRIES;
37
37
  private logMessage;
38
38
  getMessageLog(): readonly MessageLogEntry[];
@@ -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,gBAAgB,EAEhB,MAAM,4DAA4D,CAAA;AACnE,OAAO,KAAK,EACX,8BAA8B,EAC9B,gCAAgC,EAChC,MAAM,gEAAgE,CAAA;AAWvE,OAAO,EAEN,KAAK,WAAW,EAEhB,MAAM,mDAAmD,CAAA;AAc1D,OAAO,KAAK,EACX,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,aAAa,CAAA;AAKpB,OAAO,EACN,KAAK,oBAAoB,EAGzB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAG3D;;;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,CAIhB;IACD,OAAO,CAAC,SAAS,CAAwB;IACzC,OAAO,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AAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA8B3D,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAYrD,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAYrD,SAAS,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,eAAe,CAAC;IAa7D,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA2C3D;;;;OAIG;IACH,oBAAoB,CAAC,IAAI,EAAE;QAC1B,UAAU,EAAE,gBAAgB,CAAA;QAC5B,MAAM,EAAE,YAAY,CAAA;QACpB,cAAc,EAAE,8BAA8B,CAAA;KAC9C,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,gBAAgB,EAEhB,MAAM,4DAA4D,CAAA;AAWnE,OAAO,EAEN,KAAK,WAAW,EAEhB,MAAM,mDAAmD,CAAA;AAc1D,OAAO,KAAK,EACX,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,8BAA8B,EAC9B,gCAAgC,EAChC,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,aAAa,CAAA;AAKpB,OAAO,EACN,KAAK,oBAAoB,EAGzB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAG3D;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAA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,OAAO,EAAE,WAAW;IAKjC,OAAO,CAAC,SAAS;IA8EjB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB;IAgE/D,OAAO,CAAC,uBAAuB;IAwB/B,UAAU,CAAC,MAAM,EAAE,MAAM;IAazB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA8B3D,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAYrD,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAYrD,SAAS,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,eAAe,CAAC;IAa7D,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA2C3D;;;;OAIG;IACH,oBAAoB,CAAC,IAAI,EAAE;QAC1B,UAAU,EAAE,gBAAgB,CAAA;QAC5B,MAAM,EAAE,YAAY,CAAA;QACpB,cAAc,EAAE,8BAA8B,CAAA;KAC9C,GAAG,OAAO,CAAC,gCAAgC,CAAC;IAuB7C;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;CAkE/B"}
@@ -30,6 +30,7 @@ export class SandboxBridge {
30
30
  this.hasReceivedInit = false;
31
31
  this.latestDataSourceBindings = {};
32
32
  this.isMockState = false;
33
+ this.isListening = false;
33
34
  this.initMessage = new Promise((resolve, reject) => {
34
35
  this.resolveInit = resolve;
35
36
  this.rejectInit = reject;
@@ -252,12 +253,13 @@ export class SandboxBridge {
252
253
  }
253
254
  }
254
255
  };
255
- // `connect` is sent later by `initCustomBlock` (after the manifest fetch
256
- // resolves). Top-level / no-iframe rejection is handled there too, so
257
- // the constructor just attaches the listener.
258
- if (typeof window !== "undefined") {
259
- window.addEventListener("message", this.handleMessage);
256
+ }
257
+ startListening() {
258
+ if (this.isListening || typeof window === "undefined") {
259
+ return;
260
260
  }
261
+ this.isListening = true;
262
+ window.addEventListener("message", this.handleMessage);
261
263
  }
262
264
  logMessage(direction, data) {
263
265
  if (this.messageLog.length >= SandboxBridge.MAX_LOG_ENTRIES) {
@@ -1,6 +1,7 @@
1
1
  import type { NotionDataSource } from "../../protocol/dataSources/dataSource.js";
2
2
  import type { CustomBlockPropertyErrorInfo } from "../../protocol/dataSources/errors.js";
3
- import type { NotionPagePropertyInputMap, NotionPagePropertyWriteMap } from "../../protocol/pages/page.js";
3
+ import type { NotionPagePropertyWriteMap } from "../../protocol/pages/page.js";
4
+ import type { NotionPagePropertyInputMap } from "../../types.js";
4
5
  export type { CustomBlockPropertyErrorCode, CustomBlockPropertyErrorInfo, } from "../../protocol/dataSources/errors.js";
5
6
  export type PropertyWriteMapResolutionResult = {
6
7
  status: "success";
@@ -1 +1 @@
1
- {"version":3,"file":"resolveProperty.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/dataSources/resolveProperty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAA;AAClG,OAAO,KAAK,EAEX,4BAA4B,EAC5B,MAAM,wDAAwD,CAAA;AAC/D,OAAO,KAAK,EACX,0BAA0B,EAC1B,0BAA0B,EAC1B,MAAM,gDAAgD,CAAA;AAIvD,YAAY,EACX,4BAA4B,EAC5B,4BAA4B,GAC5B,MAAM,wDAAwD,CAAA;AAE/D,MAAM,MAAM,gCAAgC,GACzC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,0BAA0B,CAAA;CAAE,GAC7D;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,4BAA4B,CAAA;CAAE,CAAA;AAS3D;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAAC,IAAI,EAAE;IAC1D,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAAA;IACxC,UAAU,EAAE,0BAA0B,CAAA;IACtC,aAAa,EAAE,MAAM,CAAA;CACrB,GAAG,gCAAgC,CAwDnC;AAED;;;GAGG;AACH,wBAAgB,sCAAsC,CAAC,IAAI,EAAE;IAC5D,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAAA;IACxC,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACrB,GACE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,4BAA4B,CAAA;CAAE,CAsB1D"}
1
+ {"version":3,"file":"resolveProperty.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/dataSources/resolveProperty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAA;AAClG,OAAO,KAAK,EAEX,4BAA4B,EAC5B,MAAM,wDAAwD,CAAA;AAC/D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAA;AAGhG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAA;AAEhE,YAAY,EACX,4BAA4B,EAC5B,4BAA4B,GAC5B,MAAM,wDAAwD,CAAA;AAE/D,MAAM,MAAM,gCAAgC,GACzC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,0BAA0B,CAAA;CAAE,GAC7D;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,4BAA4B,CAAA;CAAE,CAAA;AAS3D;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAAC,IAAI,EAAE;IAC1D,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAAA;IACxC,UAAU,EAAE,0BAA0B,CAAA;IACtC,aAAa,EAAE,MAAM,CAAA;CACrB,GAAG,gCAAgC,CAwDnC;AAED;;;GAGG;AACH,wBAAgB,sCAAsC,CAAC,IAAI,EAAE;IAC5D,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAAA;IACxC,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACrB,GACE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,4BAA4B,CAAA;CAAE,CAsB1D"}
@@ -1,6 +1,6 @@
1
1
  import type { NotionContrastMode } from "../protocol/contrast.js";
2
2
  import type { NotionDataSource } from "../protocol/dataSources/dataSource.js";
3
- import type { NotionDataSourcePage, NotionDataSourcePageBridge, NotionDataSourcePageUpdateArgs, NotionDataSourcePageUpdateResult } from "../protocol/dataSources/dataSourcePage.js";
3
+ import type { NotionDataSourcePageBridge } from "../protocol/dataSources/dataSourcePage.js";
4
4
  import type { NotionPropertySchema } from "../protocol/dataSources/propertySchema.js";
5
5
  import type { NotionBlockId } from "../protocol/ids.js";
6
6
  import type { CustomBlockManifest } from "../protocol/manifest.js";
@@ -9,6 +9,7 @@ import type { CustomBlockPage, NotionPageId } from "../protocol/pages/page.js";
9
9
  import type { NotionParent } from "../protocol/parent.js";
10
10
  import type { NotionTheme } from "../protocol/theme.js";
11
11
  import type { NotionUser } from "../protocol/users/user.js";
12
+ import type { NotionDataSourcePage, NotionDataSourcePageUpdateArgs, NotionDataSourcePageUpdateResult } from "../types.js";
12
13
  export type CustomBlockHostState = UninitializedHostState | InitializedHostState;
13
14
  export type UninitializedHostState = {
14
15
  status: "uninitialized";
@@ -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,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAA;AAClG,OAAO,KAAK,EACX,oBAAoB,EACpB,0BAA0B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OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,mCAAmC,CAAA;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,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,cAAc,EAAE,8BAA8B,CAAA;CAC9C,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,kBAAkB,EAAE,MAAM,8CA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@ -5,6 +5,7 @@ import type { ManifestLoadResult } from "./loadManifest.js";
5
5
  import { type MessageLogEntry } from "./SandboxBridge.js";
6
6
  export type { MessageLogEntry };
7
7
  export declare const customBlockHost: {
8
+ start: () => void;
8
9
  sendConnect: (manifestResult: ManifestLoadResult) => void;
9
10
  awaitInit: (signal?: AbortSignal) => Promise<void>;
10
11
  subscribe: (listener: () => void) => () => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"sandboxClient.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/sandboxClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAA;AACpF,OAAO,KAAK,EACX,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,aAAa,CAAA;AACpB,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAExB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,oBAAoB,CAAA;AAExE,YAAY,EAAE,eAAe,EAAE,CAAA;AAI/B,eAAO,MAAM,eAAe;kCACG,kBAAkB;yBAI3B,WAAW,KAAG,OAAO,CAAC,IAAI,CAAC;0BAI1B,MAAM,IAAI;oBAIlB,oBAAoB;IAIlC;;;OAGG;4BACqB,WAAW;yBAId,MAAM;CAG3B,CAAA;AAED,eAAO,MAAM,sBAAsB;iBACrB,MAAM,YAAY,oBAAoB;yBAKvC,oBAAoB,OAC1B,MAAM,KACT,mBAAmB;CAKtB,CAAA;AAED,eAAO,MAAM,UAAU;uBACL,SAAS,eAAe,EAAE;0BAIrB,MAAM,IAAI;CAGhC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,KAAK;IACjB;;OAEG;oBACa,cAAc,KAAG,OAAO,CAAC,gBAAgB,CAAC;IAI1D;;OAEG;kBACW,YAAY,KAAG,OAAO,CAAC,aAAa,CAAC;IAInD;;OAEG;oBACa,cAAc,KAAG,OAAO,CAAC,gBAAgB,CAAC;IAI1D;;OAEG;qBACc,YAAY,KAAG,OAAO,CAAC,gBAAgB,CAAC;CAGzD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,KAAK;IACjB;;OAEG;mBACY,aAAa,KAAG,OAAO,CAAC,eAAe,CAAC;IAIvD;;OAEG;kBACW,YAAY,KAAG,OAAO,CAAC,aAAa,CAAC;CAGnD,CAAA"}
1
+ {"version":3,"file":"sandboxClient.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/sandboxClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAA;AACpF,OAAO,KAAK,EACX,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,aAAa,CAAA;AACpB,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAExB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,oBAAoB,CAAA;AAExE,YAAY,EAAE,eAAe,EAAE,CAAA;AAW/B,eAAO,MAAM,eAAe;;kCAKG,kBAAkB;yBAI3B,WAAW,KAAG,OAAO,CAAC,IAAI,CAAC;0BAI1B,MAAM,IAAI;oBAIlB,oBAAoB;IAIlC;;;OAGG;4BACqB,WAAW;yBAId,MAAM;CAG3B,CAAA;AAED,eAAO,MAAM,sBAAsB;iBACrB,MAAM,YAAY,oBAAoB;yBAKvC,oBAAoB,OAC1B,MAAM,KACT,mBAAmB;CAKtB,CAAA;AAED,eAAO,MAAM,UAAU;uBACL,SAAS,eAAe,EAAE;0BAIrB,MAAM,IAAI;CAGhC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,KAAK;IACjB;;OAEG;oBACa,cAAc,KAAG,OAAO,CAAC,gBAAgB,CAAC;IAI1D;;OAEG;kBACW,YAAY,KAAG,OAAO,CAAC,aAAa,CAAC;IAInD;;OAEG;oBACa,cAAc,KAAG,OAAO,CAAC,gBAAgB,CAAC;IAI1D;;OAEG;qBACc,YAAY,KAAG,OAAO,CAAC,gBAAgB,CAAC;CAGzD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,KAAK;IACjB;;OAEG;mBACY,aAAa,KAAG,OAAO,CAAC,eAAe,CAAC;IAIvD;;OAEG;kBACW,YAAY,KAAG,OAAO,CAAC,aAAa,CAAC;CAGnD,CAAA"}
@@ -1,44 +1,53 @@
1
1
  import { getDataSourceQueryView as getDataSourceQueryViewWithBridge, } from "./hostState.js";
2
2
  import { SandboxBridge } from "./SandboxBridge.js";
3
- const bridge = new SandboxBridge();
3
+ let bridge;
4
+ function getBridge() {
5
+ if (!bridge) {
6
+ bridge = new SandboxBridge();
7
+ }
8
+ return bridge;
9
+ }
4
10
  export const customBlockHost = {
11
+ start: () => {
12
+ getBridge().startListening();
13
+ },
5
14
  sendConnect: (manifestResult) => {
6
- bridge.sendConnect(manifestResult);
15
+ getBridge().sendConnect(manifestResult);
7
16
  },
8
17
  awaitInit: (signal) => {
9
- return bridge.awaitInit(signal);
18
+ return getBridge().awaitInit(signal);
10
19
  },
11
20
  subscribe: (listener) => {
12
- return bridge.subscribe(listener);
21
+ return getBridge().subscribe(listener);
13
22
  },
14
23
  getState: () => {
15
- return bridge.getHostState();
24
+ return getBridge().getHostState();
16
25
  },
17
26
  /**
18
27
  * Apply an `init` payload directly, bypassing the postMessage handshake for
19
28
  * standalone preview state.
20
29
  */
21
30
  setMockState: (message) => {
22
- bridge.setMockState(message);
31
+ getBridge().setMockState(message);
23
32
  },
24
33
  postResize: (height) => {
25
- bridge.postResize(height);
34
+ getBridge().postResize(height);
26
35
  },
27
36
  };
28
37
  export const customBlockDataSources = {
29
38
  query: (key, options) => {
30
- bridge.queryDataSource(key, options);
39
+ getBridge().queryDataSource(key, options);
31
40
  },
32
41
  getView: (hostState, key) => {
33
- return getDataSourceQueryViewWithBridge(hostState, key, args => bridge.updateDataSourcePage(args));
42
+ return getDataSourceQueryViewWithBridge(hostState, key, args => getBridge().updateDataSourcePage(args));
34
43
  },
35
44
  };
36
45
  export const messageLog = {
37
46
  getSnapshot: () => {
38
- return bridge.getMessageLog();
47
+ return getBridge().getMessageLog();
39
48
  },
40
49
  subscribe: (listener) => {
41
- return bridge.subscribeToMessageLog(listener);
50
+ return getBridge().subscribeToMessageLog(listener);
42
51
  },
43
52
  };
44
53
  /**
@@ -49,25 +58,25 @@ export const pages = {
49
58
  * Creates a new Notion page.
50
59
  */
51
60
  create: (input) => {
52
- return bridge.createPage(input);
61
+ return getBridge().createPage(input);
53
62
  },
54
63
  /**
55
64
  * Fetches a page by id.
56
65
  */
57
66
  get: (pageId) => {
58
- return bridge.getPage(pageId);
67
+ return getBridge().getPage(pageId);
59
68
  },
60
69
  /**
61
70
  * Updates an existing page.
62
71
  */
63
72
  update: (input) => {
64
- return bridge.updatePage(input);
73
+ return getBridge().updatePage(input);
65
74
  },
66
75
  /**
67
76
  * Soft-delete a page by archiving it.
68
77
  */
69
78
  delete: (pageId) => {
70
- return bridge.updatePage({ pageId, archived: true });
79
+ return getBridge().updatePage({ pageId, archived: true });
71
80
  },
72
81
  };
73
82
  /**
@@ -78,12 +87,12 @@ export const users = {
78
87
  * Lists users visible in the current custom block workspace.
79
88
  */
80
89
  list: (input) => {
81
- return bridge.listUsers(input);
90
+ return getBridge().listUsers(input);
82
91
  },
83
92
  /**
84
93
  * Fetches a user by id.
85
94
  */
86
95
  get: (userId) => {
87
- return bridge.getUser(userId);
96
+ return getBridge().getUser(userId);
88
97
  },
89
98
  };
package/dist/index.d.ts CHANGED
@@ -8,7 +8,6 @@
8
8
  */
9
9
  export type { NotionContrastMode } from "./protocol/contrast.js";
10
10
  export type { NotionCollectionSchema, NotionDataSource, } from "./protocol/dataSources/dataSource.js";
11
- export type { NotionDataSourcePage, NotionDataSourcePageUpdateArgs, NotionDataSourcePageUpdateInput, NotionDataSourcePageUpdateResult, } from "./protocol/dataSources/dataSourcePage.js";
12
11
  export type { NotionDataSourceValue } from "./protocol/dataSources/dataSourceValue.js";
13
12
  export type { NotionDate, NotionDateRange, NotionDateReminder, NotionDateTime, NotionDateTimeRange, NotionDateTimeReminder, NotionDateValue, NotionNoReminder, NotionTimeReminder, } from "./protocol/dataSources/dateValue.js";
14
13
  export type { CustomBlockDataSourceResolutionErrorCode, CustomBlockDataSourceResolutionErrorInfo, CustomBlockPropertyErrorCode, CustomBlockPropertyErrorInfo, } from "./protocol/dataSources/errors.js";
@@ -27,7 +26,7 @@ export { CustomBlockInitializationError } from "./protocol/messages/init.js";
27
26
  export type { CustomBlockListUsersErrorCode, CustomBlockListUsersErrorInfo, } from "./protocol/messages/listUsers.js";
28
27
  export type { CustomBlockQueryDataSourceErrorCode, CustomBlockQueryDataSourceErrorInfo, } from "./protocol/messages/queryDataSourceResult.js";
29
28
  export type { CustomBlockUpdatePageErrorCode, CustomBlockUpdatePageErrorInfo, } from "./protocol/messages/updatePageResult.js";
30
- export type { NotionPage, NotionPageCover, NotionPageIcon, NotionPageId, NotionPagePropertyInputMap, NotionPagePropertyInputValue, NotionPagePropertyValue, NotionPagePropertyWriteMap, } from "./protocol/pages/page.js";
29
+ export type { NotionPage, NotionPageCover, NotionPageIcon, NotionPageId, NotionPagePropertyValue, NotionPagePropertyWriteMap, } from "./protocol/pages/page.js";
31
30
  export type { NotionParent } from "./protocol/parent.js";
32
31
  export type { NotionTheme } from "./protocol/theme.js";
33
32
  export { pages, users } from "./bridge/sandboxClient.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AACtF,YAAY,EACX,sBAAsB,EACtB,gBAAgB,GAChB,MAAM,4DAA4D,CAAA;AACnE,YAAY,EACX,oBAAoB,EACpB,8BAA8B,EAC9B,+BAA+B,EAC/B,gCAAgC,GAChC,MAAM,gEAAgE,CAAA;AACvE,YAAY,EAAE,qBAAqB,EAAE,MAAM,iEAAiE,CAAA;AAC5G,YAAY,EACX,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,2DAA2D,CAAA;AAClE,YAAY,EACX,wCAAwC,EACxC,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,GAC5B,MAAM,wDAAwD,CAAA;AAC/D,YAAY,EACX,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GACjB,MAAM,gEAAgE,CAAA;AACvE,OAAO,EACN,2BAA2B,EAC3B,qBAAqB,GACrB,MAAM,gEAAgE,CAAA;AACvE,YAAY,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAA;AACxG,YAAY,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AACtF,YAAY,EACX,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,aAAa,GACb,MAAM,yCAAyC,CAAA;AAChD,YAAY,EACX,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,GAChB,MAAM,8CAA8C,CAAA;AACrD,YAAY,EAAE,wBAAwB,EAAE,MAAM,yDAAyD,CAAA;AACvG,YAAY,EACX,8BAA8B,EAC9B,8BAA8B,GAC9B,MAAM,+DAA+D,CAAA;AACtE,YAAY,EACX,2BAA2B,EAC3B,2BAA2B,GAC3B,MAAM,sDAAsD,CAAA;AAC7D,YAAY,EACX,2BAA2B,EAC3B,2BAA2B,GAC3B,MAAM,sDAAsD,CAAA;AAC7D,YAAY,EACX,kCAAkC,EAClC,kCAAkC,GAClC,MAAM,mDAAmD,CAAA;AAC1D,OAAO,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAA;AAClG,YAAY,EACX,6BAA6B,EAC7B,6BAA6B,GAC7B,MAAM,wDAAwD,CAAA;AAC/D,YAAY,EACX,mCAAmC,EACnC,mCAAmC,GACnC,MAAM,oEAAoE,CAAA;AAC3E,YAAY,EACX,8BAA8B,EAC9B,8BAA8B,GAC9B,MAAM,+DAA+D,CAAA;AACtE,YAAY,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,0BAA0B,EAC1B,4BAA4B,EAC5B,uBAAuB,EACvB,0BAA0B,GAC1B,MAAM,gDAAgD,CAAA;AACvD,YAAY,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAC9E,YAAY,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EACN,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,eAAe,EACf,gBAAgB,GAChB,MAAM,WAAW,CAAA;AAClB,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AACtF,YAAY,EACX,sBAAsB,EACtB,gBAAgB,GAChB,MAAM,4DAA4D,CAAA;A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,CAAA;IAChC,OAAO,EAAE,aAAa,CAAA;IACtB,MAAM,EAAE,YAAY,CAAA;IACpB,IAAI,EAAE,eAAe,CAAA;IACrB,WAAW,EAAE,UAAU,CAAA;IACvB,WAAW,EAAE,gBAAgB,EAAE,CAAA;CAC/B,CAAA;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,8BAA8B;gBACvD,OAAO,GAAE,MAA8B;IAS3C,IAAI,EAAE,eAAe,CAAA;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AASD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC9B,IAAI,GAAE,sBAA2B,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAMjC"}
package/dist/init.js CHANGED
@@ -33,6 +33,7 @@ let initPromise;
33
33
  */
34
34
  export function initCustomBlock(opts = {}) {
35
35
  if (initPromise === undefined) {
36
+ customBlockHost.start();
36
37
  initPromise = performHandshake(opts);
37
38
  }
38
39
  return initPromise;
@@ -1,12 +1,12 @@
1
1
  import * as v from "valibot";
2
2
  declare const collectionPointerValidator: v.ObjectSchema<{
3
- readonly id: v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
3
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
4
4
  readonly table: v.StringSchema<undefined>;
5
- readonly spaceId: v.OptionalSchema<v.CustomSchema<import("../ids.js").NotionSpaceId, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
5
+ readonly spaceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>, undefined>;
6
6
  }, undefined>;
7
7
  export type NotionCollectionPointer = v.InferOutput<typeof collectionPointerValidator>;
8
8
  export declare const notionCollectionSchemaValidator: v.ObjectSchema<{
9
- readonly id: v.OptionalSchema<v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
9
+ readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
10
10
  readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
11
11
  readonly type: v.LiteralSchema<"title", undefined>;
12
12
  readonly name: v.StringSchema<undefined>;
@@ -150,12 +150,12 @@ export type NotionCollectionSchema = v.InferOutput<typeof notionCollectionSchema
150
150
  export declare const notionDataSourceSchema: v.ObjectSchema<{
151
151
  readonly key: v.StringSchema<undefined>;
152
152
  readonly collectionPointer: v.OptionalSchema<v.ObjectSchema<{
153
- readonly id: v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
153
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
154
154
  readonly table: v.StringSchema<undefined>;
155
- readonly spaceId: v.OptionalSchema<v.CustomSchema<import("../ids.js").NotionSpaceId, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
155
+ readonly spaceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>, undefined>;
156
156
  }, undefined>, undefined>;
157
157
  readonly collectionSchema: v.OptionalSchema<v.ObjectSchema<{
158
- readonly id: v.OptionalSchema<v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
158
+ readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
159
159
  readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
160
160
  readonly type: v.LiteralSchema<"title", undefined>;
161
161
  readonly name: v.StringSchema<undefined>;
@@ -438,12 +438,12 @@ export declare const notionDataSourceSchema: v.ObjectSchema<{
438
438
  export type NotionDataSource = v.InferOutput<typeof notionDataSourceSchema>;
439
439
  export declare const notionDataSourceBindingSchema: v.ObjectSchema<{
440
440
  readonly collectionPointer: v.OptionalSchema<v.ObjectSchema<{
441
- readonly id: v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
441
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
442
442
  readonly table: v.StringSchema<undefined>;
443
- readonly spaceId: v.OptionalSchema<v.CustomSchema<import("../ids.js").NotionSpaceId, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
443
+ readonly spaceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>, undefined>;
444
444
  }, undefined>, undefined>;
445
445
  readonly collectionSchema: v.OptionalSchema<v.ObjectSchema<{
446
- readonly id: v.OptionalSchema<v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
446
+ readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
447
447
  readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
448
448
  readonly type: v.LiteralSchema<"title", undefined>;
449
449
  readonly name: v.StringSchema<undefined>;
@@ -584,12 +584,12 @@ export declare const notionDataSourceBindingSchema: v.ObjectSchema<{
584
584
  export type NotionDataSourceBinding = v.InferOutput<typeof notionDataSourceBindingSchema>;
585
585
  export declare const notionDataSourceBindingsSchema: v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
586
586
  readonly collectionPointer: v.OptionalSchema<v.ObjectSchema<{
587
- readonly id: v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
587
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
588
588
  readonly table: v.StringSchema<undefined>;
589
- readonly spaceId: v.OptionalSchema<v.CustomSchema<import("../ids.js").NotionSpaceId, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
589
+ readonly spaceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>, undefined>;
590
590
  }, undefined>, undefined>;
591
591
  readonly collectionSchema: v.OptionalSchema<v.ObjectSchema<{
592
- readonly id: v.OptionalSchema<v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
592
+ readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
593
593
  readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
594
594
  readonly type: v.LiteralSchema<"title", undefined>;
595
595
  readonly name: v.StringSchema<undefined>;
@@ -1,16 +1,11 @@
1
1
  import * as v from "valibot";
2
- import type { CustomBlockUpdatePageErrorInfo } from "../messages/updatePageResult.js";
3
- import type { NotionPage, NotionPageCover, NotionPageIcon, NotionPageId, NotionPagePropertyInputMap } from "../pages/page.js";
4
- import { type NotionDataSourceValue } from "./dataSourceValue.js";
5
2
  /**
6
3
  * Bridge shape for a data source page, as parsed from inbound host messages. The host keys
7
4
  * properties by raw property ID. The four built-ins (`created_time`, `last_edited_time`,
8
5
  * `created_by`, `last_edited_by`) are normally present, possibly with `undefined` values.
9
- *
10
- * Internal to the SDK. The consumer-facing shape is {@link NotionDataSourcePage}.
11
6
  */
12
7
  export declare const notionDataSourcePageBridgeSchema: v.ObjectSchema<{
13
- readonly id: v.CustomSchema<NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
8
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
14
9
  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<{
15
10
  readonly type: v.LiteralSchema<"date", undefined>;
16
11
  readonly start_date: v.StringSchema<undefined>;
@@ -75,50 +70,4 @@ export declare const notionDataSourcePageBridgeSchema: v.ObjectSchema<{
75
70
  }, undefined>;
76
71
  /** Internal SDK type for a parsed bridge page. */
77
72
  export type NotionDataSourcePageBridge = v.InferOutput<typeof notionDataSourcePageBridgeSchema>;
78
- export type NotionDataSourcePageUpdateArgs = {
79
- properties?: NotionPagePropertyInputMap;
80
- icon?: NotionPageIcon;
81
- cover?: NotionPageCover;
82
- archived?: boolean;
83
- };
84
- /**
85
- * @deprecated Use `NotionDataSourcePageUpdateArgs` instead.
86
- *
87
- * TODO(custom-blocks): Remove this alias when bumping the SDK version to 0.2.0.
88
- */
89
- export type NotionDataSourcePageUpdateInput = NotionDataSourcePageUpdateArgs;
90
- export type NotionDataSourcePageUpdateResult = {
91
- status: "success";
92
- page: NotionPage;
93
- } | {
94
- status: "error";
95
- error: CustomBlockUpdatePageErrorInfo;
96
- };
97
- /**
98
- * Consumer-facing page shape returned from {@link useDataSource}. Derived from the bridge payload
99
- * plus the data source's `propertyIdsByKey`.
100
- */
101
- export type NotionDataSourcePage = {
102
- id: NotionPageId;
103
- /**
104
- * Keyed mapping of raw property IDs to their value. Includes all properties on the data source,
105
- * including the four built-ins (`created_time`, `last_edited_time`, `created_by`,
106
- * `last_edited_by`).
107
- */
108
- propertiesById: {
109
- [propertyId: string]: NotionDataSourceValue | undefined;
110
- };
111
- /**
112
- * Keyed mapping of user-defined keys to their value. Only includes properties that are mapped
113
- * to a raw property ID in the data source's `propertyIdsByKey`.
114
- */
115
- propertiesByKey: {
116
- [key: string]: NotionDataSourceValue | undefined;
117
- };
118
- /**
119
- * Updates this page using the data source's property-key bindings. The SDK resolves property
120
- * keys to raw property IDs before sending the bridge message to the host.
121
- */
122
- update: (args: NotionDataSourcePageUpdateArgs) => Promise<NotionDataSourcePageUpdateResult>;
123
- };
124
73
  //# sourceMappingURL=dataSourcePage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataSourcePage.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/protocol/src/dataSources/dataSourcePage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAA;AACrF,OAAO,KAAK,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,0BAA0B,EAC1B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACN,KAAK,qBAAqB,EAE1B,MAAM,sBAAsB,CAAA;AAE7B;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAG3C,CAAA;AAEF,kDAAkD;AAClD,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,WAAW,CACrD,OAAO,gCAAgC,CACvC,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC5C,UAAU,CAAC,EAAE,0BAA0B,CAAA;IACvC,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,+BAA+B,GAAG,8BAA8B,CAAA;AAE5E,MAAM,MAAM,gCAAgC,GACzC;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,UAAU,CAAA;CACf,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,8BAA8B,CAAA;CAAE,CAAA;AAE7D;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,EAAE,EAAE,YAAY,CAAA;IAChB;;;;OAIG;IACH,cAAc,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAAA;KAAE,CAAA;IAC3E;;;OAGG;IACH,eAAe,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAAA;KAAE,CAAA;IACrE;;;OAGG;IACH,MAAM,EAAE,CACP,IAAI,EAAE,8BAA8B,KAChC,OAAO,CAAC,gCAAgC,CAAC,CAAA;CAC9C,CAAA"}
1
+ {"version":3,"file":"dataSourcePage.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/protocol/src/dataSources/dataSourcePage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B;;;;GAIG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAG3C,CAAA;AAEF,kDAAkD;AAClD,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,WAAW,CACrD,OAAO,gCAAgC,CACvC,CAAA"}
@@ -1,12 +1,10 @@
1
1
  import * as v from "valibot";
2
2
  import { notionPageIdSchema } from "../ids.js";
3
- import { notionDataSourceValueSchema, } from "./dataSourceValue.js";
3
+ import { notionDataSourceValueSchema } from "./dataSourceValue.js";
4
4
  /**
5
5
  * Bridge shape for a data source page, as parsed from inbound host messages. The host keys
6
6
  * properties by raw property ID. The four built-ins (`created_time`, `last_edited_time`,
7
7
  * `created_by`, `last_edited_by`) are normally present, possibly with `undefined` values.
8
- *
9
- * Internal to the SDK. The consumer-facing shape is {@link NotionDataSourcePage}.
10
8
  */
11
9
  export const notionDataSourcePageBridgeSchema = v.object({
12
10
  id: notionPageIdSchema,
@@ -1,48 +1,32 @@
1
1
  import * as v from "valibot";
2
- declare const notionDataSourceIdBrand: unique symbol;
3
- declare const notionBlockIdBrand: unique symbol;
4
- declare const notionPageIdBrand: unique symbol;
5
- declare const notionAgentIdBrand: unique symbol;
6
- declare const notionSpaceIdBrand: unique symbol;
7
2
  /**
8
3
  * Branded Notion block ID. Host payloads and SDK APIs use plain strings at runtime,
9
4
  * but the brand keeps block IDs from being accidentally mixed with other IDs in TypeScript.
10
5
  */
11
- export type NotionBlockId = string & {
12
- readonly [notionBlockIdBrand]: "NotionBlockId";
13
- };
14
- export declare const notionBlockIdSchema: v.CustomSchema<NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
6
+ export declare const notionBlockIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
7
+ export type NotionBlockId = v.InferOutput<typeof notionBlockIdSchema>;
15
8
  /**
16
9
  * Branded Notion data source ID. Host payloads and SDK APIs use plain strings at runtime,
17
10
  * but the brand keeps data source IDs from being accidentally mixed with other IDs in TypeScript.
18
11
  */
19
- export type NotionDataSourceId = string & {
20
- readonly [notionDataSourceIdBrand]: "NotionDataSourceId";
21
- };
22
- export declare const notionDataSourceIdSchema: v.CustomSchema<NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
12
+ export declare const notionDataSourceIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
13
+ export type NotionDataSourceId = v.InferOutput<typeof notionDataSourceIdSchema>;
23
14
  /**
24
15
  * Branded Notion page ID. Host payloads and SDK APIs use plain strings at runtime,
25
16
  * but the brand keeps page IDs from being accidentally mixed with other IDs in TypeScript.
26
17
  */
27
- export type NotionPageId = string & {
28
- readonly [notionPageIdBrand]: "NotionPageId";
29
- };
30
- export declare const notionPageIdSchema: v.CustomSchema<NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
18
+ export declare const notionPageIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
19
+ export type NotionPageId = v.InferOutput<typeof notionPageIdSchema>;
31
20
  /**
32
21
  * Branded Notion agent ID. Agent parents identify the workflow that owns an
33
22
  * instruction page or one of its blocks.
34
23
  */
35
- export type NotionAgentId = string & {
36
- readonly [notionAgentIdBrand]: "NotionAgentId";
37
- };
38
- export declare const notionAgentIdSchema: v.CustomSchema<NotionAgentId, v.ErrorMessage<v.CustomIssue> | undefined>;
24
+ export declare const notionAgentIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
25
+ export type NotionAgentId = v.InferOutput<typeof notionAgentIdSchema>;
39
26
  /**
40
27
  * Branded Notion workspace/space ID. Host payloads and SDK APIs use plain strings at runtime,
41
28
  * but the brand keeps space IDs from being accidentally mixed with other IDs in TypeScript.
42
29
  */
43
- export type NotionSpaceId = string & {
44
- readonly [notionSpaceIdBrand]: "NotionSpaceId";
45
- };
46
- export declare const notionSpaceIdSchema: v.CustomSchema<NotionSpaceId, v.ErrorMessage<v.CustomIssue> | undefined>;
47
- export {};
30
+ export declare const notionSpaceIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>;
31
+ export type NotionSpaceId = v.InferOutput<typeof notionSpaceIdSchema>;
48
32
  //# sourceMappingURL=ids.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/protocol/src/ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,MAAM,CAAA;AACpD,OAAO,CAAC,MAAM,kBAAkB,EAAE,OAAO,MAAM,CAAA;AAC/C,OAAO,CAAC,MAAM,iBAAiB,EAAE,OAAO,MAAM,CAAA;AAC9C,OAAO,CAAC,MAAM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AM,wBAAwB,qGAGpC,CAAA;AACD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAE/E;;;GAGG;AACH,eAAO,MAAM,kBAAkB,+FAA8C,CAAA;AAC7E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEnE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,gGAA+C,CAAA;AAC/E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAErE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,gGAA+C,CAAA;AAC/E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
@@ -1,6 +1,26 @@
1
1
  import * as v from "valibot";
2
- export const notionBlockIdSchema = v.custom(value => typeof value === "string", "Expected a Notion block ID");
3
- export const notionDataSourceIdSchema = v.custom(value => typeof value === "string", "Expected a Notion data source ID");
4
- export const notionPageIdSchema = v.custom(value => typeof value === "string", "Expected a Notion page ID");
5
- export const notionAgentIdSchema = v.custom(value => typeof value === "string", "Expected a Notion agent ID");
6
- export const notionSpaceIdSchema = v.custom(value => typeof value === "string", "Expected a Notion space ID");
2
+ /**
3
+ * Branded Notion block ID. Host payloads and SDK APIs use plain strings at runtime,
4
+ * but the brand keeps block IDs from being accidentally mixed with other IDs in TypeScript.
5
+ */
6
+ export const notionBlockIdSchema = v.pipe(v.string(), v.brand("NotionBlockId"));
7
+ /**
8
+ * Branded Notion data source ID. Host payloads and SDK APIs use plain strings at runtime,
9
+ * but the brand keeps data source IDs from being accidentally mixed with other IDs in TypeScript.
10
+ */
11
+ export const notionDataSourceIdSchema = v.pipe(v.string(), v.brand("NotionDataSourceId"));
12
+ /**
13
+ * Branded Notion page ID. Host payloads and SDK APIs use plain strings at runtime,
14
+ * but the brand keeps page IDs from being accidentally mixed with other IDs in TypeScript.
15
+ */
16
+ export const notionPageIdSchema = v.pipe(v.string(), v.brand("NotionPageId"));
17
+ /**
18
+ * Branded Notion agent ID. Agent parents identify the workflow that owns an
19
+ * instruction page or one of its blocks.
20
+ */
21
+ export const notionAgentIdSchema = v.pipe(v.string(), v.brand("NotionAgentId"));
22
+ /**
23
+ * Branded Notion workspace/space ID. Host payloads and SDK APIs use plain strings at runtime,
24
+ * but the brand keeps space IDs from being accidentally mixed with other IDs in TypeScript.
25
+ */
26
+ export const notionSpaceIdSchema = v.pipe(v.string(), v.brand("NotionSpaceId"));
@@ -13,10 +13,10 @@ export declare const notionCreatePagePositionSchema: v.VariantSchema<"type", [v.
13
13
  readonly type: v.LiteralSchema<"end", undefined>;
14
14
  }, undefined>, v.ObjectSchema<{
15
15
  readonly type: v.LiteralSchema<"before", undefined>;
16
- readonly blockId: v.CustomSchema<import("../ids.js").NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
16
+ readonly blockId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
17
17
  }, undefined>, v.ObjectSchema<{
18
18
  readonly type: v.LiteralSchema<"after", undefined>;
19
- readonly blockId: v.CustomSchema<import("../ids.js").NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
19
+ readonly blockId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
20
20
  }, undefined>], undefined>;
21
21
  export type NotionCreatePagePosition = v.InferOutput<typeof notionCreatePagePositionSchema>;
22
22
  /**
@@ -30,10 +30,10 @@ export type NotionCreatePagePosition = v.InferOutput<typeof notionCreatePagePosi
30
30
  */
31
31
  export declare const createPageParentSchema: v.VariantSchema<"type", [v.ObjectSchema<{
32
32
  readonly type: v.LiteralSchema<"page_id", undefined>;
33
- readonly page_id: v.CustomSchema<import("../ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
33
+ readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
34
34
  }, undefined>, v.ObjectSchema<{
35
35
  readonly type: v.LiteralSchema<"data_source_id", undefined>;
36
- readonly data_source_id: v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
36
+ readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
37
37
  }, undefined>], undefined>;
38
38
  export type CreatePageMessageParent = v.InferOutput<typeof createPageParentSchema>;
39
39
  /**
@@ -45,10 +45,10 @@ export declare const createPageMessageSchema: v.ObjectSchema<{
45
45
  readonly requestId: v.StringSchema<undefined>;
46
46
  readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
47
47
  readonly type: v.LiteralSchema<"page_id", undefined>;
48
- readonly page_id: v.CustomSchema<import("../ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
48
+ readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
49
49
  }, undefined>, v.ObjectSchema<{
50
50
  readonly type: v.LiteralSchema<"data_source_id", undefined>;
51
- readonly data_source_id: v.CustomSchema<import("../ids.js").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
51
+ readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
52
52
  }, undefined>], undefined>;
53
53
  readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
54
54
  readonly type: v.LiteralSchema<"title", undefined>;
@@ -181,10 +181,10 @@ export declare const createPageMessageSchema: v.ObjectSchema<{
181
181
  readonly type: v.LiteralSchema<"end", undefined>;
182
182
  }, undefined>, v.ObjectSchema<{
183
183
  readonly type: v.LiteralSchema<"before", undefined>;
184
- readonly blockId: v.CustomSchema<import("../ids.js").NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
184
+ readonly blockId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
185
185
  }, undefined>, v.ObjectSchema<{
186
186
  readonly type: v.LiteralSchema<"after", undefined>;
187
- readonly blockId: v.CustomSchema<import("../ids.js").NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
187
+ readonly blockId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
188
188
  }, undefined>], undefined>, undefined>;
189
189
  }, undefined>;
190
190
  export type CreatePageMessage = v.InferOutput<typeof createPageMessageSchema>;