@notionhq/custom-blocks 0.1.15 → 0.1.17

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.
@@ -1,7 +1,6 @@
1
1
  import type { NotionDataSource } from "../protocol/dataSources/dataSource.js";
2
- import type { NotionDataSourcePageUpdateInput, NotionDataSourcePageUpdateResult } from "../protocol/dataSources/dataSourcePage.js";
3
2
  import { type InitMessage } from "../protocol/messages/init.js";
4
- import type { CreatePageInput, CreatePageResult, GetPageResult, GetUserResult, ListUsersInput, ListUsersResult, NotionPageId, NotionUserId, UpdatePageInput, 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
  /**
@@ -55,11 +54,11 @@ export declare class SandboxBridge {
55
54
  queryDataSource(key: string, options?: UseDataSourceOptions): void;
56
55
  private setDataSourceQueryError;
57
56
  postResize(height: number): void;
58
- createPage(input: CreatePageInput): Promise<CreatePageResult>;
57
+ createPage(args: CreatePageArgs): Promise<CreatePageResult>;
59
58
  getPage(pageId: NotionPageId): Promise<GetPageResult>;
60
59
  getUser(userId: NotionUserId): Promise<GetUserResult>;
61
- listUsers(input?: ListUsersInput): Promise<ListUsersResult>;
62
- updatePage(input: UpdatePageInput): Promise<UpdatePageResult>;
60
+ listUsers(args?: ListUsersArgs): Promise<ListUsersResult>;
61
+ updatePage(args: UpdatePageArgs): Promise<UpdatePageResult>;
63
62
  /**
64
63
  * Updates a page on a known data source, resolving any property keys against the data source's
65
64
  * `propertyIdsByKey` before sending the bridge message. Used by the per-row `update` callback
@@ -68,10 +67,10 @@ export declare class SandboxBridge {
68
67
  updateDataSourcePage(args: {
69
68
  dataSource: NotionDataSource;
70
69
  pageId: NotionPageId;
71
- input: NotionDataSourcePageUpdateInput;
70
+ pageUpdateArgs: NotionDataSourcePageUpdateArgs;
72
71
  }): Promise<NotionDataSourcePageUpdateResult>;
73
72
  /**
74
- * Translates the public `CreatePageInput["parent"]` into the bridge-native
73
+ * Translates the public `CreatePageArgs["parent"]` into the bridge-native
75
74
  * `CreatePageMessageParent`. The `data_source_key` variant is resolved sandbox-side against
76
75
  * the data source mapping the host delivered in `init` / `dataSourcesChanged`.
77
76
  */
@@ -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,+BAA+B,EAC/B,gCAAgC,EAChC,MAAM,gEAAgE,CAAA;AAWvE,OAAO,EAEN,KAAK,WAAW,EAEhB,MAAM,mDAAmD,CAAA;AAc1D,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;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,CAAC,UAAU,CA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E,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"}
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,GAAG,UAAU,CAAA;I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,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"}
@@ -509,16 +509,16 @@ export class SandboxBridge {
509
509
  };
510
510
  this.postToHost(outbound);
511
511
  }
512
- createPage(input) {
512
+ createPage(args) {
513
513
  return new Promise(resolve => {
514
- const resolvedParent = this.resolveCreatePageParent(input.parent);
514
+ const resolvedParent = this.resolveCreatePageParent(args.parent);
515
515
  if (resolvedParent.status === "error") {
516
516
  resolve(resolvedParent);
517
517
  return;
518
518
  }
519
519
  const resolvedProperties = resolvePropertyWriteMapForDataSource({
520
520
  dataSource: resolvedParent.dataSource,
521
- properties: input.properties,
521
+ properties: args.properties,
522
522
  operationName: "createPage",
523
523
  });
524
524
  if (resolvedProperties.status === "error") {
@@ -532,8 +532,8 @@ export class SandboxBridge {
532
532
  parent: resolvedParent.parent,
533
533
  properties: resolvedProperties.properties,
534
534
  };
535
- if (input.position !== undefined) {
536
- outbound.position = input.position;
535
+ if (args.position !== undefined) {
536
+ outbound.position = args.position;
537
537
  }
538
538
  this.postToHost(outbound);
539
539
  });
@@ -560,25 +560,25 @@ export class SandboxBridge {
560
560
  this.postToHost(outbound);
561
561
  });
562
562
  }
563
- listUsers(input = {}) {
563
+ listUsers(args = {}) {
564
564
  return new Promise(resolve => {
565
565
  const requestId = this.pendingListUsers.allocate(resolve);
566
566
  const outbound = {
567
567
  type: "listUsers",
568
568
  requestId,
569
- startCursor: input.startCursor,
570
- pageSize: input.pageSize,
569
+ startCursor: args.startCursor,
570
+ pageSize: args.pageSize,
571
571
  };
572
572
  this.postToHost(outbound);
573
573
  });
574
574
  }
575
- updatePage(input) {
575
+ updatePage(args) {
576
576
  return new Promise(resolve => {
577
- if ((input.properties === undefined ||
578
- Object.keys(input.properties).length === 0) &&
579
- input.icon === undefined &&
580
- input.cover === undefined &&
581
- input.archived === undefined) {
577
+ if ((args.properties === undefined ||
578
+ Object.keys(args.properties).length === 0) &&
579
+ args.icon === undefined &&
580
+ args.cover === undefined &&
581
+ args.archived === undefined) {
582
582
  resolve({
583
583
  status: "error",
584
584
  error: {
@@ -593,19 +593,19 @@ export class SandboxBridge {
593
593
  const outbound = {
594
594
  type: "updatePage",
595
595
  requestId,
596
- pageId: input.pageId,
596
+ pageId: args.pageId,
597
597
  };
598
- if (input.properties !== undefined) {
599
- outbound.properties = input.properties;
598
+ if (args.properties !== undefined) {
599
+ outbound.properties = args.properties;
600
600
  }
601
- if (input.icon !== undefined) {
602
- outbound.icon = input.icon;
601
+ if (args.icon !== undefined) {
602
+ outbound.icon = args.icon;
603
603
  }
604
- if (input.cover !== undefined) {
605
- outbound.cover = input.cover;
604
+ if (args.cover !== undefined) {
605
+ outbound.cover = args.cover;
606
606
  }
607
- if (input.archived !== undefined) {
608
- outbound.archived = input.archived;
607
+ if (args.archived !== undefined) {
608
+ outbound.archived = args.archived;
609
609
  }
610
610
  this.postToHost(outbound);
611
611
  });
@@ -616,12 +616,12 @@ export class SandboxBridge {
616
616
  * returned from {@link getDataSourceQueryView}.
617
617
  */
618
618
  updateDataSourcePage(args) {
619
- const { dataSource, pageId, input } = args;
620
- const resolvedProperties = input.properties === undefined
619
+ const { dataSource, pageId, pageUpdateArgs } = args;
620
+ const resolvedProperties = pageUpdateArgs.properties === undefined
621
621
  ? undefined
622
622
  : resolvePropertyWriteMapForDataSource({
623
623
  dataSource,
624
- properties: input.properties,
624
+ properties: pageUpdateArgs.properties,
625
625
  operationName: "dataSourcePage.update",
626
626
  });
627
627
  if (resolvedProperties?.status === "error") {
@@ -630,13 +630,13 @@ export class SandboxBridge {
630
630
  return this.updatePage({
631
631
  pageId,
632
632
  properties: resolvedProperties?.properties,
633
- icon: input.icon,
634
- cover: input.cover,
635
- archived: input.archived,
633
+ icon: pageUpdateArgs.icon,
634
+ cover: pageUpdateArgs.cover,
635
+ archived: pageUpdateArgs.archived,
636
636
  });
637
637
  }
638
638
  /**
639
- * Translates the public `CreatePageInput["parent"]` into the bridge-native
639
+ * Translates the public `CreatePageArgs["parent"]` into the bridge-native
640
640
  * `CreatePageMessageParent`. The `data_source_key` variant is resolved sandbox-side against
641
641
  * the data source mapping the host delivered in `init` / `dataSourcesChanged`.
642
642
  */
@@ -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, NotionDataSourcePageUpdateInput, 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";
@@ -66,7 +67,7 @@ export type DataSourceQueryView = {
66
67
  export type UpdateDataSourcePageFn = (args: {
67
68
  dataSource: NotionDataSource;
68
69
  pageId: NotionPageId;
69
- input: NotionDataSourcePageUpdateInput;
70
+ pageUpdateArgs: NotionDataSourcePageUpdateArgs;
70
71
  }) => Promise<NotionDataSourcePageUpdateResult>;
71
72
  export declare function getDataSourceQueryView(hostState: CustomBlockHostState, key: string, updateDataSourcePage: UpdateDataSourcePageFn): DataSourceQueryView;
72
73
  //# sourceMappingURL=hostState.d.ts.map
@@ -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,EAC1B,+BAA+B,EAC/B,gCAAgC,EAChC,MAAM,gEAAgE,CAAA;AAEvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gEAAgE,CAAA;AAC1G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,K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AAG;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,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAA;AAClG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gEAAgE,CAAA;AAEhH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gEAAgE,CAAA;AAC1G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAC5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AC,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"}
@@ -43,10 +43,10 @@ export function getDataSourceQueryView(hostState, key, updateDataSourcePage) {
43
43
  id: entry.id,
44
44
  propertiesById: entry.propertiesById,
45
45
  propertiesByKey,
46
- update: input => updateDataSourcePage({
46
+ update: args => updateDataSourcePage({
47
47
  dataSource,
48
48
  pageId: entry.id,
49
- input,
49
+ pageUpdateArgs: args,
50
50
  }),
51
51
  };
52
52
  });
@@ -1,5 +1,5 @@
1
1
  import type { InitMessage } from "../protocol/messages/init.js";
2
- import type { CreatePageInput, CreatePageResult, GetPageResult, GetUserResult, ListUsersInput, ListUsersResult, NotionPageId, NotionUserId, UpdatePageInput, UpdatePageResult, UseDataSourceOptions } from "../types.js";
2
+ import type { CreatePageArgs, CreatePageResult, GetPageResult, GetUserResult, ListUsersArgs, ListUsersResult, NotionPageId, NotionUserId, UpdatePageArgs, UpdatePageResult, UseDataSourceOptions } from "../types.js";
3
3
  import { type CustomBlockHostState, type DataSourceQueryView } from "./hostState.js";
4
4
  import type { ManifestLoadResult } from "./loadManifest.js";
5
5
  import { type MessageLogEntry } from "./SandboxBridge.js";
@@ -31,7 +31,7 @@ export declare const pages: {
31
31
  /**
32
32
  * Creates a new Notion page.
33
33
  */
34
- create: (input: CreatePageInput) => Promise<CreatePageResult>;
34
+ create: (input: CreatePageArgs) => Promise<CreatePageResult>;
35
35
  /**
36
36
  * Fetches a page by id.
37
37
  */
@@ -39,7 +39,7 @@ export declare const pages: {
39
39
  /**
40
40
  * Updates an existing page.
41
41
  */
42
- update: (input: UpdatePageInput) => Promise<UpdatePageResult>;
42
+ update: (input: UpdatePageArgs) => Promise<UpdatePageResult>;
43
43
  /**
44
44
  * Soft-delete a page by archiving it.
45
45
  */
@@ -52,7 +52,7 @@ export declare const users: {
52
52
  /**
53
53
  * Lists users visible in the current custom block workspace.
54
54
  */
55
- list: (input?: ListUsersInput) => Promise<ListUsersResult>;
55
+ list: (input?: ListUsersArgs) => Promise<ListUsersResult>;
56
56
  /**
57
57
  * Fetches a user by id.
58
58
  */
@@ -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,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,aAA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AIvD;;OAEG;kBACW,YAAY,KAAG,OAAO,CAAC,aAAa,CAAC;CAGnD,CAAA"}
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, 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,+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;AACnE,Y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AAA;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,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,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.CustomSchema<import("../ids.js").NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
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,44 +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 NotionDataSourcePageUpdateInput = {
79
- properties?: NotionPagePropertyInputMap;
80
- icon?: NotionPageIcon;
81
- cover?: NotionPageCover;
82
- archived?: boolean;
83
- };
84
- export type NotionDataSourcePageUpdateResult = {
85
- status: "success";
86
- page: NotionPage;
87
- } | {
88
- status: "error";
89
- error: CustomBlockUpdatePageErrorInfo;
90
- };
91
- /**
92
- * Consumer-facing page shape returned from {@link useDataSource}. Derived from the bridge payload
93
- * plus the data source's `propertyIdsByKey`.
94
- */
95
- export type NotionDataSourcePage = {
96
- id: NotionPageId;
97
- /**
98
- * Keyed mapping of raw property IDs to their value. Includes all properties on the data source,
99
- * including the four built-ins (`created_time`, `last_edited_time`, `created_by`,
100
- * `last_edited_by`).
101
- */
102
- propertiesById: {
103
- [propertyId: string]: NotionDataSourceValue | undefined;
104
- };
105
- /**
106
- * Keyed mapping of user-defined keys to their value. Only includes properties that are mapped
107
- * to a raw property ID in the data source's `propertyIdsByKey`.
108
- */
109
- propertiesByKey: {
110
- [key: string]: NotionDataSourceValue | undefined;
111
- };
112
- /**
113
- * Updates this page using the data source's property-key bindings. The SDK resolves property
114
- * keys to raw property IDs before sending the bridge message to the host.
115
- */
116
- update: (input: NotionDataSourcePageUpdateInput) => Promise<NotionDataSourcePageUpdateResult>;
117
- };
118
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,+BAA+B,GAAG;IAC7C,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,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,KAAK,EAAE,+BAA+B,KAClC,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,
@@ -281,20 +281,6 @@ export declare const notionPagePropertyValueSchema: v.VariantSchema<"type", [v.O
281
281
  readonly id: v.StringSchema<undefined>;
282
282
  }, undefined>], undefined>;
283
283
  export type NotionPagePropertyValue = v.InferOutput<typeof notionPagePropertyValueSchema>;
284
- type WithOptionalPropertyId<T> = T extends {
285
- id: string;
286
- } ? Omit<T, "id"> & {
287
- id?: string;
288
- } : never;
289
- /**
290
- * Public SDK page property write input. Keys may be raw property IDs or data source
291
- * property keys. `id` is optional because the SDK resolves the final raw property ID
292
- * from the map key before sending the bridge message.
293
- */
294
- export type NotionPagePropertyInputValue = WithOptionalPropertyId<NotionPagePropertyValue>;
295
- export type NotionPagePropertyInputMap = {
296
- [propertyIdOrKey: string]: NotionPagePropertyInputValue;
297
- };
298
284
  export declare const notionPagePropertyWriteMapSchema: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
299
285
  readonly type: v.LiteralSchema<"title", undefined>;
300
286
  readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/protocol/src/pages/page.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C;;GAEG;AACH,eAAO,MAAM,qBAAqB;;IAEjC;;;;OAIG;;;;;;;;;;;;;;;;;aAEF,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE,eAAO,MAAM,qBAAqB;;;aAGhC,CAAA;AACF,eAAO,MAAM,2BAA2B;;;;;;;aAOtC,CAAA;AACF,eAAO,MAAM,wBAAwB;;;;;aAGnC,CAAA;AACF,eAAO,MAAM,sBAAsB;;;;;;aAMjC,CAAA;AAGF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;0BAK/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEvE,eAAO,MAAM,qBAAqB;;;;;;;;;;;0BAGhC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAIzE,QAAA,MA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AE,MAAM,CAAA;CAAE,GACtD,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/B,KAAK,CAAA;AAER;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GACvC,sBAAsB,CAAC,uBAAuB,CAAC,CAAA;AAEhD,MAAM,MAAM,0BAA0B,GAAG;IACxC,CAAC,eAAe,EAAE,MAAM,GAAG,4BAA4B,CAAA;CACvD,CAAA;AAED,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAG5C,CAAA;AACD,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,WAAW,CACrD,OAAO,gCAAgC,CACvC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAY3B,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/protocol/src/pages/page.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C;;GAEG;AACH,eAAO,MAAM,qBAAqB;;IAEjC;;;;OAIG;;;;;;;;;;;;;;;;;aAEF,CAAA;AA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,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE,QAAA,MAAM,sBAAsB;;;;;;;aAO1B,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAM3E;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA6ExC,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAClD,OAAO,6BAA6B,CACpC,CAAA;AAED,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAG5C,CAAA;AACD,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,WAAW,CACrD,OAAO,gCAAgC,CACvC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAY3B,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
package/dist/types.d.ts CHANGED
@@ -1,22 +1,81 @@
1
1
  import type { NotionCollectionSchema } from "./protocol/dataSources/dataSource.js";
2
- import type { NotionDataSourcePage } from "./protocol/dataSources/dataSourcePage.js";
2
+ import type { NotionDataSourceValue } from "./protocol/dataSources/dataSourceValue.js";
3
3
  import type { NotionPropertySchema } from "./protocol/dataSources/propertySchema.js";
4
- import type { NotionDataSourceId } from "./protocol/ids.js";
4
+ import type { NotionDataSourceId, NotionPageId } from "./protocol/ids.js";
5
5
  import type { NotionCreatePagePosition } from "./protocol/messages/createPage.js";
6
6
  import type { CustomBlockCreatePageErrorInfo } from "./protocol/messages/createPageResult.js";
7
7
  import type { CustomBlockGetPageErrorInfo } from "./protocol/messages/getPage.js";
8
8
  import type { CustomBlockGetUserErrorInfo } from "./protocol/messages/getUser.js";
9
- import type { CustomBlockListUsersErrorInfo } from "./protocol/messages/listUsers.js";
9
+ import type { CustomBlockListUsersErrorInfo, ListUsersMessage } from "./protocol/messages/listUsers.js";
10
10
  import type { CustomBlockQueryDataSourceErrorInfo } from "./protocol/messages/queryDataSourceResult.js";
11
+ import type { UpdatePageMessage } from "./protocol/messages/updatePage.js";
11
12
  import type { CustomBlockUpdatePageErrorInfo } from "./protocol/messages/updatePageResult.js";
12
- import type { NotionPage, NotionPageCover, NotionPageIcon, NotionPageId, NotionPagePropertyInputMap, NotionPagePropertyWriteMap } from "./protocol/pages/page.js";
13
+ import type { NotionPage, NotionPageCover, NotionPageIcon, NotionPagePropertyValue } from "./protocol/pages/page.js";
13
14
  import type { NotionUser, NotionUserList } from "./protocol/users/user.js";
14
- export type { NotionDataSourcePageUpdateInput, NotionDataSourcePageUpdateResult, } from "./protocol/dataSources/dataSourcePage.js";
15
15
  export type { CustomBlockErrorInfo } from "./protocol/errors.js";
16
- export type { NotionDataSourceId, NotionSpaceId, } from "./protocol/ids.js";
17
- export type { NotionPageId } from "./protocol/pages/page.js";
16
+ export type { NotionDataSourceId, NotionPageId, NotionSpaceId, } from "./protocol/ids.js";
18
17
  export type { NotionUser, NotionUserId, NotionUserList, } from "./protocol/users/user.js";
19
18
  export type { CustomBlockCreatePageErrorInfo, CustomBlockGetPageErrorInfo, CustomBlockGetUserErrorInfo, CustomBlockListUsersErrorInfo, CustomBlockQueryDataSourceErrorInfo, CustomBlockUpdatePageErrorInfo, };
19
+ type WithOptionalPropertyId<T> = T extends {
20
+ id: string;
21
+ } ? Omit<T, "id"> & {
22
+ id?: string;
23
+ } : never;
24
+ /**
25
+ * Public SDK page property write input. Keys may be raw property IDs or data source
26
+ * property keys. `id` is optional because the SDK resolves the final raw property ID
27
+ * from the map key before sending the bridge message.
28
+ */
29
+ export type NotionPagePropertyInputValue = WithOptionalPropertyId<NotionPagePropertyValue>;
30
+ export type NotionPagePropertyInputMap = {
31
+ [propertyIdOrKey: string]: NotionPagePropertyInputValue;
32
+ };
33
+ /**
34
+ * Consumer-facing page shape returned from `useDataSource`. Derived from the bridge payload
35
+ * plus the data source's `propertyIdsByKey`.
36
+ */
37
+ export type NotionDataSourcePage = {
38
+ id: NotionPageId;
39
+ /**
40
+ * Keyed mapping of raw property IDs to their value. Includes all properties on the data source,
41
+ * including the four built-ins (`created_time`, `last_edited_time`, `created_by`,
42
+ * `last_edited_by`).
43
+ */
44
+ propertiesById: {
45
+ [propertyId: string]: NotionDataSourceValue | undefined;
46
+ };
47
+ /**
48
+ * Keyed mapping of user-defined keys to their value. Only includes properties that are mapped
49
+ * to a raw property ID in the data source's `propertyIdsByKey`.
50
+ */
51
+ propertiesByKey: {
52
+ [key: string]: NotionDataSourceValue | undefined;
53
+ };
54
+ /**
55
+ * Updates this page using the data source's property-key bindings. The SDK resolves property
56
+ * keys to raw property IDs before sending the bridge message to the host.
57
+ */
58
+ update: (args: NotionDataSourcePageUpdateArgs) => Promise<NotionDataSourcePageUpdateResult>;
59
+ };
60
+ export type NotionDataSourcePageUpdateArgs = {
61
+ properties?: NotionPagePropertyInputMap;
62
+ icon?: NotionPageIcon;
63
+ cover?: NotionPageCover;
64
+ archived?: boolean;
65
+ };
66
+ /**
67
+ * @deprecated Use `NotionDataSourcePageUpdateArgs` instead.
68
+ *
69
+ * TODO(custom-blocks): Remove this alias when bumping the SDK version to 0.2.0.
70
+ */
71
+ export type NotionDataSourcePageUpdateInput = NotionDataSourcePageUpdateArgs;
72
+ export type NotionDataSourcePageUpdateResult = {
73
+ status: "success";
74
+ page: NotionPage;
75
+ } | {
76
+ status: "error";
77
+ error: CustomBlockUpdatePageErrorInfo;
78
+ };
20
79
  /**
21
80
  * Return shape of `useDataSource`.
22
81
  *
@@ -87,13 +146,19 @@ export type CreatePageParent = {
87
146
  key: string;
88
147
  };
89
148
  /**
90
- * Input accepted by `sdk.pages.create`. Mirrors the Notion public API `POST /v1/pages` API.
149
+ * Arguments accepted by `sdk.pages.create`. Mirrors the Notion public API `POST /v1/pages` API.
91
150
  */
92
- export type CreatePageInput = {
151
+ export type CreatePageArgs = {
93
152
  parent: CreatePageParent;
94
153
  properties: NotionPagePropertyInputMap;
95
154
  position?: NotionCreatePagePosition;
96
155
  };
156
+ /**
157
+ * @deprecated Use `CreatePageArgs` instead.
158
+ *
159
+ * TODO(custom-blocks): Remove this alias when bumping the SDK version to 0.2.0.
160
+ */
161
+ export type CreatePageInput = CreatePageArgs;
97
162
  /**
98
163
  * The result of a `sdk.pages.create` API call.
99
164
  */
@@ -105,20 +170,13 @@ export type CreatePageResult = {
105
170
  status: "error";
106
171
  error: CustomBlockCreatePageErrorInfo;
107
172
  };
173
+ export type UpdatePageArgs = Omit<UpdatePageMessage, "type" | "requestId">;
108
174
  /**
109
- * Input accepted by `sdk.pages.update`.
175
+ * @deprecated Use `UpdatePageArgs` instead.
110
176
  *
111
- * `properties` is keyed by raw Notion property ID. To update a row with configured
112
- * custom-block property keys, use the `update` helper on pages returned from
113
- * `useDataSource`.
177
+ * TODO(custom-blocks): Remove this alias when bumping the SDK version to 0.2.0.
114
178
  */
115
- export type UpdatePageInput = {
116
- pageId: NotionPageId;
117
- properties?: NotionPagePropertyWriteMap;
118
- icon?: NotionPageIcon;
119
- cover?: NotionPageCover;
120
- archived?: boolean;
121
- };
179
+ export type UpdatePageInput = UpdatePageArgs;
122
180
  /**
123
181
  * Result of `sdk.pages.get`.
124
182
  */
@@ -139,10 +197,13 @@ export type UpdatePageResult = {
139
197
  status: "error";
140
198
  error: CustomBlockUpdatePageErrorInfo;
141
199
  };
142
- export type ListUsersInput = {
143
- startCursor?: string;
144
- pageSize?: number;
145
- };
200
+ export type ListUsersArgs = Omit<ListUsersMessage, "type" | "requestId">;
201
+ /**
202
+ * @deprecated Use `ListUsersArgs` instead.
203
+ *
204
+ * TODO(custom-blocks): Remove this alias when bumping the SDK version to 0.2.0.
205
+ */
206
+ export type ListUsersInput = ListUsersArgs;
146
207
  export type ListUsersResult = {
147
208
  status: "success";
148
209
  list: NotionUserList;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4DAA4D,CAAA;AACxG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gEAAgE,CAAA;AAC1G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gEAAgE,CAAA;AAC1G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AACjF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yDAAyD,CAAA;AACvG,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+DAA+D,CAAA;AACnH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAA;AACvG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAA;AACvG,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wDAAwD,CAAA;AAC3G,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oEAAoE,CAAA;AAC7H,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+DAA+D,CAAA;AACnH,OAAO,KAAK,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,YAAY,E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,CAAA;AAExE;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,CAAA;AAE1C,MAAM,MAAM,eAAe,GACxB;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,cAAc,CAAA;CACnB,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,6BAA6B,CAAA;CAAE,CAAA;AAE5D,MAAM,MAAM,aAAa,GACtB;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,UAAU,CAAA;CACf,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,2BAA2B,CAAA;CAAE,CAAA"}
package/dist/version.js CHANGED
@@ -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.1.15"
7
+ export const CUSTOM_BLOCKS_SDK_VERSION = "0.1.17"
@@ -30,7 +30,7 @@ await row.update({
30
30
  });
31
31
  ```
32
32
 
33
- Because the helper is bound to its data source, you can write property values keyed by **either** semantic keys or raw IDs the SDK resolves them before sending the request. The input and result shapes are `NotionDataSourcePageUpdateInput` and `NotionDataSourcePageUpdateResult`.
33
+ Property values can be keyed by **either** semantic keys or raw IDs. The SDK resolves semantic keys to IDs before sending the request.
34
34
 
35
35
  Use `row.update(...)` whenever you already have a row in hand. For pages you don't have a row for (e.g. you only have a `pageId`), drop down to the top-level [`pages` API](./pages.md) — it covers create / get / update / delete and accepts raw property IDs only.
36
36
 
@@ -158,7 +158,8 @@ export function ScoreList() {
158
158
  - `NotionDataSource` — a resolved data source: semantic key, `collectionSchema`, `propertyIdsByKey`, `propertySchemasById`.
159
159
  - `NotionDataSourcePage` — a single row exposed to app code: `{ id, propertiesById, propertiesByKey, update }`.
160
160
  - `NotionDataSourceValue` — the discriminated union of values that can appear inside `propertiesById[propertyId]`. Date values branch into the `NotionDateValue` union below.
161
- - `NotionDataSourcePageUpdateInput` / `NotionDataSourcePageUpdateResult` — input and result for the per-page `update` helper.
161
+ - `NotionDataSourcePageUpdateArgs` / `NotionDataSourcePageUpdateResult` — arguments and result for the per-page `update` helper.
162
+ - `NotionDataSourcePageUpdateInput` — deprecated alias for `NotionDataSourcePageUpdateArgs`.
162
163
  - `UseDataSourceOptions` — options accepted by `useDataSource`, currently `{ limit?: number }`.
163
164
 
164
165
  ### Property schemas
package/docs/pages.md CHANGED
@@ -138,6 +138,8 @@ Do **not** send `{ type: "file_upload", file_upload: { id } }`; the host will re
138
138
  - `NotionPagePropertyInputMap` — input map for `pages.create` (keys can be raw property IDs, or semantic keys when creating into a mapped data source).
139
139
  - `NotionPagePropertyWriteMap` — input map for `pages.update` (raw property IDs only).
140
140
  - `NotionCreatePagePosition` — `start` / `end` / `before` / `after` insertion variants.
141
- - `CreatePageInput` / `CreatePageParent` / `CreatePageResult`.
141
+ - `CreatePageArgs` / `CreatePageParent` / `CreatePageResult`.
142
+ - `CreatePageInput` — deprecated alias for `CreatePageArgs`.
142
143
  - `GetPageResult`.
143
- - `UpdatePageInput` / `UpdatePageResult`.
144
+ - `UpdatePageArgs` / `UpdatePageResult`.
145
+ - `UpdatePageInput` — deprecated alias for `UpdatePageArgs`.
package/docs/users.md CHANGED
@@ -55,7 +55,7 @@ if (result.list.has_more && result.list.next_cursor) {
55
55
  }
56
56
  ```
57
57
 
58
- `ListUsersInput` accepts `pageSize` and `startCursor`; both are optional. `ListUsersResult` resolves to either `{ status: "success", list }` or `{ status: "error", error }`, where `list` is a `NotionUserList` (with `results`, `next_cursor`, `has_more`).
58
+ `ListUsersArgs` accepts `pageSize` and `startCursor`; both are optional. `ListUsersResult` resolves to either `{ status: "success", list }` or `{ status: "error", error }`, where `list` is a `NotionUserList` (with `results`, `next_cursor`, `has_more`).
59
59
 
60
60
  ## Reading a single user
61
61
 
@@ -77,5 +77,6 @@ if (result.status === "success") {
77
77
  - `NotionUserList` — paginated list shape returned by `users.list`.
78
78
  - `useCurrentUser()` — hook that returns the viewer's `NotionUser`.
79
79
  - `customBlock.getCurrentUser()` — framework-neutral getter for the viewer's `NotionUser`.
80
- - `ListUsersInput` / `ListUsersResult`.
80
+ - `ListUsersArgs` / `ListUsersResult`.
81
+ - `ListUsersInput` — deprecated alias for `ListUsersArgs`.
81
82
  - `GetUserResult`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -3,10 +3,6 @@ import type {
3
3
  NotionDataSource,
4
4
  NotionDataSourceBindings,
5
5
  } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
6
- import type {
7
- NotionDataSourcePageUpdateInput,
8
- NotionDataSourcePageUpdateResult,
9
- } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
10
6
  import { readIncomingType } from "@notionhq/custom-blocks-protocol/incomingType.js"
11
7
  import type { CustomBlockManifest } from "@notionhq/custom-blocks-protocol/manifest.js"
12
8
  import type { ConnectMessage } from "@notionhq/custom-blocks-protocol/messages/connect.js"
@@ -36,15 +32,17 @@ import { CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION } from "@notionhq/custom-blocks-pr
36
32
  import type { NotionUser } from "@notionhq/custom-blocks-protocol/users/user.js"
37
33
  import * as v from "valibot"
38
34
  import type {
39
- CreatePageInput,
35
+ CreatePageArgs,
40
36
  CreatePageResult,
41
37
  GetPageResult,
42
38
  GetUserResult,
43
- ListUsersInput,
39
+ ListUsersArgs,
44
40
  ListUsersResult,
41
+ NotionDataSourcePageUpdateArgs,
42
+ NotionDataSourcePageUpdateResult,
45
43
  NotionPageId,
46
44
  NotionUserId,
47
- UpdatePageInput,
45
+ UpdatePageArgs,
48
46
  UpdatePageResult,
49
47
  UseDataSourceOptions,
50
48
  } from "../types.js"
@@ -672,16 +670,16 @@ export class SandboxBridge {
672
670
  this.postToHost(outbound)
673
671
  }
674
672
 
675
- createPage(input: CreatePageInput): Promise<CreatePageResult> {
673
+ createPage(args: CreatePageArgs): Promise<CreatePageResult> {
676
674
  return new Promise(resolve => {
677
- const resolvedParent = this.resolveCreatePageParent(input.parent)
675
+ const resolvedParent = this.resolveCreatePageParent(args.parent)
678
676
  if (resolvedParent.status === "error") {
679
677
  resolve(resolvedParent)
680
678
  return
681
679
  }
682
680
  const resolvedProperties = resolvePropertyWriteMapForDataSource({
683
681
  dataSource: resolvedParent.dataSource,
684
- properties: input.properties,
682
+ properties: args.properties,
685
683
  operationName: "createPage",
686
684
  })
687
685
  if (resolvedProperties.status === "error") {
@@ -695,8 +693,8 @@ export class SandboxBridge {
695
693
  parent: resolvedParent.parent,
696
694
  properties: resolvedProperties.properties,
697
695
  }
698
- if (input.position !== undefined) {
699
- outbound.position = input.position
696
+ if (args.position !== undefined) {
697
+ outbound.position = args.position
700
698
  }
701
699
  this.postToHost(outbound)
702
700
  })
@@ -726,27 +724,27 @@ export class SandboxBridge {
726
724
  })
727
725
  }
728
726
 
729
- listUsers(input: ListUsersInput = {}): Promise<ListUsersResult> {
727
+ listUsers(args: ListUsersArgs = {}): Promise<ListUsersResult> {
730
728
  return new Promise(resolve => {
731
729
  const requestId = this.pendingListUsers.allocate(resolve)
732
730
  const outbound: ListUsersMessage = {
733
731
  type: "listUsers",
734
732
  requestId,
735
- startCursor: input.startCursor,
736
- pageSize: input.pageSize,
733
+ startCursor: args.startCursor,
734
+ pageSize: args.pageSize,
737
735
  }
738
736
  this.postToHost(outbound)
739
737
  })
740
738
  }
741
739
 
742
- updatePage(input: UpdatePageInput): Promise<UpdatePageResult> {
740
+ updatePage(args: UpdatePageArgs): Promise<UpdatePageResult> {
743
741
  return new Promise(resolve => {
744
742
  if (
745
- (input.properties === undefined ||
746
- Object.keys(input.properties).length === 0) &&
747
- input.icon === undefined &&
748
- input.cover === undefined &&
749
- input.archived === undefined
743
+ (args.properties === undefined ||
744
+ Object.keys(args.properties).length === 0) &&
745
+ args.icon === undefined &&
746
+ args.cover === undefined &&
747
+ args.archived === undefined
750
748
  ) {
751
749
  resolve({
752
750
  status: "error",
@@ -764,19 +762,19 @@ export class SandboxBridge {
764
762
  const outbound: UpdatePageMessage = {
765
763
  type: "updatePage",
766
764
  requestId,
767
- pageId: input.pageId,
765
+ pageId: args.pageId,
768
766
  }
769
- if (input.properties !== undefined) {
770
- outbound.properties = input.properties
767
+ if (args.properties !== undefined) {
768
+ outbound.properties = args.properties
771
769
  }
772
- if (input.icon !== undefined) {
773
- outbound.icon = input.icon
770
+ if (args.icon !== undefined) {
771
+ outbound.icon = args.icon
774
772
  }
775
- if (input.cover !== undefined) {
776
- outbound.cover = input.cover
773
+ if (args.cover !== undefined) {
774
+ outbound.cover = args.cover
777
775
  }
778
- if (input.archived !== undefined) {
779
- outbound.archived = input.archived
776
+ if (args.archived !== undefined) {
777
+ outbound.archived = args.archived
780
778
  }
781
779
  this.postToHost(outbound)
782
780
  })
@@ -790,15 +788,15 @@ export class SandboxBridge {
790
788
  updateDataSourcePage(args: {
791
789
  dataSource: NotionDataSource
792
790
  pageId: NotionPageId
793
- input: NotionDataSourcePageUpdateInput
791
+ pageUpdateArgs: NotionDataSourcePageUpdateArgs
794
792
  }): Promise<NotionDataSourcePageUpdateResult> {
795
- const { dataSource, pageId, input } = args
793
+ const { dataSource, pageId, pageUpdateArgs } = args
796
794
  const resolvedProperties =
797
- input.properties === undefined
795
+ pageUpdateArgs.properties === undefined
798
796
  ? undefined
799
797
  : resolvePropertyWriteMapForDataSource({
800
798
  dataSource,
801
- properties: input.properties,
799
+ properties: pageUpdateArgs.properties,
802
800
  operationName: "dataSourcePage.update",
803
801
  })
804
802
  if (resolvedProperties?.status === "error") {
@@ -808,18 +806,18 @@ export class SandboxBridge {
808
806
  return this.updatePage({
809
807
  pageId,
810
808
  properties: resolvedProperties?.properties,
811
- icon: input.icon,
812
- cover: input.cover,
813
- archived: input.archived,
809
+ icon: pageUpdateArgs.icon,
810
+ cover: pageUpdateArgs.cover,
811
+ archived: pageUpdateArgs.archived,
814
812
  })
815
813
  }
816
814
 
817
815
  /**
818
- * Translates the public `CreatePageInput["parent"]` into the bridge-native
816
+ * Translates the public `CreatePageArgs["parent"]` into the bridge-native
819
817
  * `CreatePageMessageParent`. The `data_source_key` variant is resolved sandbox-side against
820
818
  * the data source mapping the host delivered in `init` / `dataSourcesChanged`.
821
819
  */
822
- private resolveCreatePageParent(parent: CreatePageInput["parent"]):
820
+ private resolveCreatePageParent(parent: CreatePageArgs["parent"]):
823
821
  | {
824
822
  status: "ok"
825
823
  parent: CreatePageMessageParent
@@ -3,12 +3,10 @@ import type {
3
3
  CustomBlockPropertyErrorCode,
4
4
  CustomBlockPropertyErrorInfo,
5
5
  } from "@notionhq/custom-blocks-protocol/dataSources/errors.js"
6
- import type {
7
- NotionPagePropertyInputMap,
8
- NotionPagePropertyWriteMap,
9
- } from "@notionhq/custom-blocks-protocol/pages/page.js"
6
+ import type { NotionPagePropertyWriteMap } from "@notionhq/custom-blocks-protocol/pages/page.js"
10
7
  import { notionPagePropertyValueSchema } from "@notionhq/custom-blocks-protocol/pages/page.js"
11
8
  import * as v from "valibot"
9
+ import type { NotionPagePropertyInputMap } from "../../types.js"
12
10
 
13
11
  export type {
14
12
  CustomBlockPropertyErrorCode,
@@ -1,11 +1,6 @@
1
1
  import type { NotionContrastMode } from "@notionhq/custom-blocks-protocol/contrast.js"
2
2
  import type { NotionDataSource } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
3
- import type {
4
- NotionDataSourcePage,
5
- NotionDataSourcePageBridge,
6
- NotionDataSourcePageUpdateInput,
7
- NotionDataSourcePageUpdateResult,
8
- } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
3
+ import type { NotionDataSourcePageBridge } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
9
4
  import type { NotionDataSourceValue } from "@notionhq/custom-blocks-protocol/dataSources/dataSourceValue.js"
10
5
  import type { NotionPropertySchema } from "@notionhq/custom-blocks-protocol/dataSources/propertySchema.js"
11
6
  import type { NotionBlockId } from "@notionhq/custom-blocks-protocol/ids.js"
@@ -18,6 +13,11 @@ import type {
18
13
  import type { NotionParent } from "@notionhq/custom-blocks-protocol/parent.js"
19
14
  import type { NotionTheme } from "@notionhq/custom-blocks-protocol/theme.js"
20
15
  import type { NotionUser } from "@notionhq/custom-blocks-protocol/users/user.js"
16
+ import type {
17
+ NotionDataSourcePage,
18
+ NotionDataSourcePageUpdateArgs,
19
+ NotionDataSourcePageUpdateResult,
20
+ } from "../types.js"
21
21
 
22
22
  export type CustomBlockHostState = UninitializedHostState | InitializedHostState
23
23
 
@@ -91,7 +91,7 @@ const EMPTY_QUERY_VIEW: DataSourceQueryView = {
91
91
  export type UpdateDataSourcePageFn = (args: {
92
92
  dataSource: NotionDataSource
93
93
  pageId: NotionPageId
94
- input: NotionDataSourcePageUpdateInput
94
+ pageUpdateArgs: NotionDataSourcePageUpdateArgs
95
95
  }) => Promise<NotionDataSourcePageUpdateResult>
96
96
 
97
97
  export function getDataSourceQueryView(
@@ -135,11 +135,11 @@ export function getDataSourceQueryView(
135
135
  id: entry.id,
136
136
  propertiesById: entry.propertiesById,
137
137
  propertiesByKey,
138
- update: input =>
138
+ update: args =>
139
139
  updateDataSourcePage({
140
140
  dataSource,
141
141
  pageId: entry.id,
142
- input,
142
+ pageUpdateArgs: args,
143
143
  }),
144
144
  }
145
145
  })
@@ -1,14 +1,14 @@
1
1
  import type { InitMessage } from "@notionhq/custom-blocks-protocol/messages/init.js"
2
2
  import type {
3
- CreatePageInput,
3
+ CreatePageArgs,
4
4
  CreatePageResult,
5
5
  GetPageResult,
6
6
  GetUserResult,
7
- ListUsersInput,
7
+ ListUsersArgs,
8
8
  ListUsersResult,
9
9
  NotionPageId,
10
10
  NotionUserId,
11
- UpdatePageInput,
11
+ UpdatePageArgs,
12
12
  UpdatePageResult,
13
13
  UseDataSourceOptions,
14
14
  } from "../types.js"
@@ -86,7 +86,7 @@ export const pages = {
86
86
  /**
87
87
  * Creates a new Notion page.
88
88
  */
89
- create: (input: CreatePageInput): Promise<CreatePageResult> => {
89
+ create: (input: CreatePageArgs): Promise<CreatePageResult> => {
90
90
  return bridge.createPage(input)
91
91
  },
92
92
 
@@ -100,7 +100,7 @@ export const pages = {
100
100
  /**
101
101
  * Updates an existing page.
102
102
  */
103
- update: (input: UpdatePageInput): Promise<UpdatePageResult> => {
103
+ update: (input: UpdatePageArgs): Promise<UpdatePageResult> => {
104
104
  return bridge.updatePage(input)
105
105
  },
106
106
 
@@ -119,7 +119,7 @@ export const users = {
119
119
  /**
120
120
  * Lists users visible in the current custom block workspace.
121
121
  */
122
- list: (input?: ListUsersInput): Promise<ListUsersResult> => {
122
+ list: (input?: ListUsersArgs): Promise<ListUsersResult> => {
123
123
  return bridge.listUsers(input)
124
124
  },
125
125
 
package/src/index.ts CHANGED
@@ -12,11 +12,6 @@ export type {
12
12
  NotionCollectionSchema,
13
13
  NotionDataSource,
14
14
  } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
15
- export type {
16
- NotionDataSourcePage,
17
- NotionDataSourcePageUpdateInput,
18
- NotionDataSourcePageUpdateResult,
19
- } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
20
15
  export type { NotionDataSourceValue } from "@notionhq/custom-blocks-protocol/dataSources/dataSourceValue.js"
21
16
  export type {
22
17
  NotionDate,
@@ -97,8 +92,6 @@ export type {
97
92
  NotionPageCover,
98
93
  NotionPageIcon,
99
94
  NotionPageId,
100
- NotionPagePropertyInputMap,
101
- NotionPagePropertyInputValue,
102
95
  NotionPagePropertyValue,
103
96
  NotionPagePropertyWriteMap,
104
97
  } from "@notionhq/custom-blocks-protocol/pages/page.js"
package/src/types.ts CHANGED
@@ -1,37 +1,38 @@
1
1
  import type { NotionCollectionSchema } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
2
- import type { NotionDataSourcePage } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
2
+ import type { NotionDataSourceValue } from "@notionhq/custom-blocks-protocol/dataSources/dataSourceValue.js"
3
3
  import type { NotionPropertySchema } from "@notionhq/custom-blocks-protocol/dataSources/propertySchema.js"
4
- import type { NotionDataSourceId } from "@notionhq/custom-blocks-protocol/ids.js"
4
+ import type {
5
+ NotionDataSourceId,
6
+ NotionPageId,
7
+ } from "@notionhq/custom-blocks-protocol/ids.js"
5
8
  import type { NotionCreatePagePosition } from "@notionhq/custom-blocks-protocol/messages/createPage.js"
6
9
  import type { CustomBlockCreatePageErrorInfo } from "@notionhq/custom-blocks-protocol/messages/createPageResult.js"
7
10
  import type { CustomBlockGetPageErrorInfo } from "@notionhq/custom-blocks-protocol/messages/getPage.js"
8
11
  import type { CustomBlockGetUserErrorInfo } from "@notionhq/custom-blocks-protocol/messages/getUser.js"
9
- import type { CustomBlockListUsersErrorInfo } from "@notionhq/custom-blocks-protocol/messages/listUsers.js"
12
+ import type {
13
+ CustomBlockListUsersErrorInfo,
14
+ ListUsersMessage,
15
+ } from "@notionhq/custom-blocks-protocol/messages/listUsers.js"
10
16
  import type { CustomBlockQueryDataSourceErrorInfo } from "@notionhq/custom-blocks-protocol/messages/queryDataSourceResult.js"
17
+ import type { UpdatePageMessage } from "@notionhq/custom-blocks-protocol/messages/updatePage.js"
11
18
  import type { CustomBlockUpdatePageErrorInfo } from "@notionhq/custom-blocks-protocol/messages/updatePageResult.js"
12
19
  import type {
13
20
  NotionPage,
14
21
  NotionPageCover,
15
22
  NotionPageIcon,
16
- NotionPageId,
17
- NotionPagePropertyInputMap,
18
- NotionPagePropertyWriteMap,
23
+ NotionPagePropertyValue,
19
24
  } from "@notionhq/custom-blocks-protocol/pages/page.js"
20
25
  import type {
21
26
  NotionUser,
22
27
  NotionUserList,
23
28
  } from "@notionhq/custom-blocks-protocol/users/user.js"
24
29
 
25
- export type {
26
- NotionDataSourcePageUpdateInput,
27
- NotionDataSourcePageUpdateResult,
28
- } from "@notionhq/custom-blocks-protocol/dataSources/dataSourcePage.js"
29
30
  export type { CustomBlockErrorInfo } from "@notionhq/custom-blocks-protocol/errors.js"
30
31
  export type {
31
32
  NotionDataSourceId,
33
+ NotionPageId,
32
34
  NotionSpaceId,
33
35
  } from "@notionhq/custom-blocks-protocol/ids.js"
34
- export type { NotionPageId } from "@notionhq/custom-blocks-protocol/pages/page.js"
35
36
  export type {
36
37
  NotionUser,
37
38
  NotionUserId,
@@ -46,6 +47,69 @@ export type {
46
47
  CustomBlockUpdatePageErrorInfo,
47
48
  }
48
49
 
50
+ type WithOptionalPropertyId<T> = T extends { id: string }
51
+ ? Omit<T, "id"> & { id?: string }
52
+ : never
53
+
54
+ /**
55
+ * Public SDK page property write input. Keys may be raw property IDs or data source
56
+ * property keys. `id` is optional because the SDK resolves the final raw property ID
57
+ * from the map key before sending the bridge message.
58
+ */
59
+ export type NotionPagePropertyInputValue =
60
+ WithOptionalPropertyId<NotionPagePropertyValue>
61
+
62
+ export type NotionPagePropertyInputMap = {
63
+ [propertyIdOrKey: string]: NotionPagePropertyInputValue
64
+ }
65
+
66
+ /**
67
+ * Consumer-facing page shape returned from `useDataSource`. Derived from the bridge payload
68
+ * plus the data source's `propertyIdsByKey`.
69
+ */
70
+ export type NotionDataSourcePage = {
71
+ id: NotionPageId
72
+ /**
73
+ * Keyed mapping of raw property IDs to their value. Includes all properties on the data source,
74
+ * including the four built-ins (`created_time`, `last_edited_time`, `created_by`,
75
+ * `last_edited_by`).
76
+ */
77
+ propertiesById: { [propertyId: string]: NotionDataSourceValue | undefined }
78
+ /**
79
+ * Keyed mapping of user-defined keys to their value. Only includes properties that are mapped
80
+ * to a raw property ID in the data source's `propertyIdsByKey`.
81
+ */
82
+ propertiesByKey: { [key: string]: NotionDataSourceValue | undefined }
83
+ /**
84
+ * Updates this page using the data source's property-key bindings. The SDK resolves property
85
+ * keys to raw property IDs before sending the bridge message to the host.
86
+ */
87
+ update: (
88
+ args: NotionDataSourcePageUpdateArgs,
89
+ ) => Promise<NotionDataSourcePageUpdateResult>
90
+ }
91
+
92
+ export type NotionDataSourcePageUpdateArgs = {
93
+ properties?: NotionPagePropertyInputMap
94
+ icon?: NotionPageIcon
95
+ cover?: NotionPageCover
96
+ archived?: boolean
97
+ }
98
+
99
+ /**
100
+ * @deprecated Use `NotionDataSourcePageUpdateArgs` instead.
101
+ *
102
+ * TODO(custom-blocks): Remove this alias when bumping the SDK version to 0.2.0.
103
+ */
104
+ export type NotionDataSourcePageUpdateInput = NotionDataSourcePageUpdateArgs
105
+
106
+ export type NotionDataSourcePageUpdateResult =
107
+ | {
108
+ status: "success"
109
+ page: NotionPage
110
+ }
111
+ | { status: "error"; error: CustomBlockUpdatePageErrorInfo }
112
+
49
113
  /**
50
114
  * Return shape of `useDataSource`.
51
115
  *
@@ -107,15 +171,22 @@ export type CreatePageParent =
107
171
  | { type: "data_source_key"; key: string }
108
172
 
109
173
  /**
110
- * Input accepted by `sdk.pages.create`. Mirrors the Notion public API `POST /v1/pages` API.
174
+ * Arguments accepted by `sdk.pages.create`. Mirrors the Notion public API `POST /v1/pages` API.
111
175
  */
112
- export type CreatePageInput = {
176
+ export type CreatePageArgs = {
113
177
  parent: CreatePageParent
114
178
  properties: NotionPagePropertyInputMap
115
179
  // TODO(custom-blocks): Add icon and cover once the Notion host supports them for page creation.
116
180
  position?: NotionCreatePagePosition
117
181
  }
118
182
 
183
+ /**
184
+ * @deprecated Use `CreatePageArgs` instead.
185
+ *
186
+ * TODO(custom-blocks): Remove this alias when bumping the SDK version to 0.2.0.
187
+ */
188
+ export type CreatePageInput = CreatePageArgs
189
+
119
190
  /**
120
191
  * The result of a `sdk.pages.create` API call.
121
192
  */
@@ -127,20 +198,14 @@ export type CreatePageResult =
127
198
  }
128
199
  | { status: "error"; error: CustomBlockCreatePageErrorInfo }
129
200
 
201
+ export type UpdatePageArgs = Omit<UpdatePageMessage, "type" | "requestId">
202
+
130
203
  /**
131
- * Input accepted by `sdk.pages.update`.
204
+ * @deprecated Use `UpdatePageArgs` instead.
132
205
  *
133
- * `properties` is keyed by raw Notion property ID. To update a row with configured
134
- * custom-block property keys, use the `update` helper on pages returned from
135
- * `useDataSource`.
206
+ * TODO(custom-blocks): Remove this alias when bumping the SDK version to 0.2.0.
136
207
  */
137
- export type UpdatePageInput = {
138
- pageId: NotionPageId
139
- properties?: NotionPagePropertyWriteMap
140
- icon?: NotionPageIcon
141
- cover?: NotionPageCover
142
- archived?: boolean
143
- }
208
+ export type UpdatePageInput = UpdatePageArgs
144
209
 
145
210
  /**
146
211
  * Result of `sdk.pages.get`.
@@ -162,10 +227,14 @@ export type UpdatePageResult =
162
227
  }
163
228
  | { status: "error"; error: CustomBlockUpdatePageErrorInfo }
164
229
 
165
- export type ListUsersInput = {
166
- startCursor?: string
167
- pageSize?: number
168
- }
230
+ export type ListUsersArgs = Omit<ListUsersMessage, "type" | "requestId">
231
+
232
+ /**
233
+ * @deprecated Use `ListUsersArgs` instead.
234
+ *
235
+ * TODO(custom-blocks): Remove this alias when bumping the SDK version to 0.2.0.
236
+ */
237
+ export type ListUsersInput = ListUsersArgs
169
238
 
170
239
  export type ListUsersResult =
171
240
  | {