@notionhq/custom-blocks 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/bridge/SandboxBridge.d.ts +469 -15
  2. package/dist/bridge/SandboxBridge.d.ts.map +1 -1
  3. package/dist/bridge/SandboxBridge.js +131 -80
  4. package/dist/bridge/page.d.ts +6 -8
  5. package/dist/bridge/page.d.ts.map +1 -1
  6. package/dist/bridge/page.js +9 -56
  7. package/dist/bridge/sandboxClient.d.ts.map +1 -1
  8. package/dist/bridge/sandboxClient.js +29 -6
  9. package/dist/dataSources.d.ts.map +1 -1
  10. package/dist/dataSources.js +4 -3
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/protocol/dataSources/dateValue.d.ts +2 -2
  14. package/dist/protocol/dataSources/dateValue.js +9 -7
  15. package/dist/protocol/messages/createPage.d.ts +64 -2
  16. package/dist/protocol/messages/createPageResult.d.ts +192 -6
  17. package/dist/protocol/messages/getPage.d.ts +192 -6
  18. package/dist/protocol/messages/hostToSandbox.d.ts +704 -22
  19. package/dist/protocol/messages/queryDataSourceResult.d.ts +128 -4
  20. package/dist/protocol/messages/sandboxToHost.d.ts +128 -4
  21. package/dist/protocol/messages/updatePage.d.ts +64 -2
  22. package/dist/protocol/messages/updatePageResult.d.ts +192 -6
  23. package/dist/protocol/pages/page.d.ts +360 -12
  24. package/dist/protocol/pages/page.js +48 -2
  25. package/dist/types.d.ts +1 -1
  26. package/dist/types.d.ts.map +1 -1
  27. package/dist/version.js +1 -1
  28. package/docs/data-sources.md +9 -8
  29. package/docs/pages.md +10 -7
  30. package/package.json +1 -1
  31. package/src/bridge/SandboxBridge.ts +181 -117
  32. package/src/bridge/page.ts +15 -82
  33. package/src/bridge/sandboxClient.ts +37 -7
  34. package/src/dataSources.ts +7 -9
  35. package/src/index.ts +6 -0
  36. package/src/types.ts +6 -0
@@ -19,6 +19,7 @@ export class SandboxBridge {
19
19
  theme: "light",
20
20
  contrastMode: DEFAULT_CONTRAST_MODE,
21
21
  };
22
+ pendingPageUpdates = new Map();
22
23
  listeners = new Set();
23
24
  messageInterceptors = new Set();
24
25
  messageLog = [];
@@ -545,16 +546,30 @@ export class SandboxBridge {
545
546
  };
546
547
  this.postToHost(outbound);
547
548
  }
548
- createPage(createPageArgs, dataSourceId) {
549
+ createPage(args) {
550
+ const { dataSource } = args;
551
+ const dataSourceKey = dataSource?.key;
549
552
  return new Promise(resolve => {
550
- const resolvedParent = this.resolveCreatePageParent(createPageArgs.parent);
551
- if (resolvedParent.status === "error") {
552
- resolve(resolvedParent);
553
- return;
553
+ let parent;
554
+ let propertyDataSource = dataSource;
555
+ if (dataSource?.collectionPointer) {
556
+ parent = {
557
+ type: "data_source_id",
558
+ data_source_id: dataSource.collectionPointer.id,
559
+ };
560
+ }
561
+ else {
562
+ const resolvedParent = this.resolveCreatePageParent(args.parent);
563
+ if (resolvedParent.status === "error") {
564
+ resolve(resolvedParent);
565
+ return;
566
+ }
567
+ parent = resolvedParent.parent;
568
+ propertyDataSource = resolvedParent.dataSource;
554
569
  }
555
570
  const resolvedProperties = resolvePropertyWriteMapForDataSource({
556
- dataSource: resolvedParent.dataSource,
557
- properties: createPageArgs.properties,
571
+ dataSource: propertyDataSource,
572
+ properties: args.properties,
558
573
  operationName: "createPage",
559
574
  });
560
575
  if (resolvedProperties.status === "error") {
@@ -566,34 +581,63 @@ export class SandboxBridge {
566
581
  resolve(result);
567
582
  return;
568
583
  }
569
- resolve({
570
- status: "success",
571
- page: this.buildNotionPage({ page: result.page, dataSourceId }),
584
+ const update = async (args) => {
585
+ const result = await this.updatePage(args);
586
+ if (result.status === "error") {
587
+ return result;
588
+ }
589
+ Object.assign(page, result.page);
590
+ return { status: "success", page };
591
+ };
592
+ const page = toNotionPageFromNotionPageData({
593
+ page: result.page,
594
+ dataSourceKey,
595
+ getPropertyById: propertyId => this.getPropertyById({ page, propertyId }),
596
+ getPropertyByKey: propertyKey => this.getPropertyByKey({ page, dataSource, propertyKey }),
597
+ updateById: payload => update({ ...payload, pageId: page.id, dataSource: undefined }),
598
+ updateByKey: payload => update({ ...payload, pageId: page.id, dataSource }),
572
599
  });
600
+ resolve({ status: "success", page });
573
601
  });
574
602
  const outbound = {
575
603
  type: "createPage",
576
604
  requestId,
577
- parent: resolvedParent.parent,
605
+ parent,
578
606
  properties: resolvedProperties.properties,
579
607
  };
580
- if (createPageArgs.position !== undefined) {
581
- outbound.position = createPageArgs.position;
608
+ if (args.position !== undefined) {
609
+ outbound.position = args.position;
582
610
  }
583
611
  this.postToHost(outbound);
584
612
  });
585
613
  }
586
- getPage(pageId, dataSourceId) {
614
+ getPage(args) {
615
+ const { pageId, dataSource } = args;
616
+ const dataSourceId = dataSource?.collectionPointer?.id;
617
+ const dataSourceKey = dataSource?.key;
587
618
  return new Promise(resolve => {
588
619
  const requestId = this.pendingGetPage.allocate(result => {
589
620
  if (result.status === "error") {
590
621
  resolve(result);
591
622
  return;
592
623
  }
593
- resolve({
594
- status: "success",
595
- page: this.buildNotionPage({ page: result.page, dataSourceId }),
624
+ const update = async (args) => {
625
+ const result = await this.updatePage(args);
626
+ if (result.status === "error") {
627
+ return result;
628
+ }
629
+ Object.assign(page, result.page);
630
+ return { status: "success", page };
631
+ };
632
+ const page = toNotionPageFromNotionPageData({
633
+ page: result.page,
634
+ dataSourceKey,
635
+ getPropertyById: propertyId => this.getPropertyById({ page, propertyId }),
636
+ getPropertyByKey: propertyKey => this.getPropertyByKey({ page, dataSource, propertyKey }),
637
+ updateById: payload => update({ ...payload, pageId: page.id, dataSource: undefined }),
638
+ updateByKey: payload => update({ ...payload, pageId: page.id, dataSource }),
596
639
  });
640
+ resolve({ status: "success", page });
597
641
  });
598
642
  const outbound = {
599
643
  type: "getPage",
@@ -650,57 +694,74 @@ export class SandboxBridge {
650
694
  this.postToHost(outbound);
651
695
  });
652
696
  }
653
- updatePage(args, dataSourceId) {
654
- const dataSource = this.hostState.status === "initialized" && dataSourceId !== undefined
655
- ? this.hostState.dataSources.find(source => source.collectionPointer?.id === dataSourceId)
697
+ getPropertyById(args) {
698
+ return (Object.values(args.page.properties).find(value => value?.id === args.propertyId) ?? null);
699
+ }
700
+ getPropertyByKey(args) {
701
+ const { page, dataSource, propertyKey } = args;
702
+ const currentDataSource = this.hostState.status === "initialized"
703
+ ? this.hostState.dataSources.find(source => source.key === dataSource?.key)
656
704
  : undefined;
657
- if (dataSourceId !== undefined) {
658
- const unmappedKey = Object.keys(args.properties ?? {}).find(key => {
659
- const id = dataSource && Object.hasOwn(dataSource.propertyIdsByKey, key)
660
- ? dataSource.propertyIdsByKey[key]
661
- : undefined;
662
- return !id || !dataSource?.collectionSchema?.propertiesById[id];
705
+ // Keep the captured mapping valid only while its key remains bound to the original database.
706
+ if (!dataSource?.collectionPointer ||
707
+ currentDataSource?.collectionPointer?.id !==
708
+ dataSource.collectionPointer.id) {
709
+ return null;
710
+ }
711
+ const propertyId = Object.hasOwn(dataSource.propertyIdsByKey, propertyKey)
712
+ ? dataSource.propertyIdsByKey[propertyKey]
713
+ : undefined;
714
+ return propertyId === undefined
715
+ ? null
716
+ : this.getPropertyById({ page, propertyId });
717
+ }
718
+ updatePage(args) {
719
+ const operation = async () => {
720
+ const { dataSource } = args;
721
+ const dataSourceId = dataSource?.collectionPointer?.id;
722
+ const propertyIdsByKey = dataSource?.propertyIdsByKey ?? {};
723
+ if (dataSource !== undefined) {
724
+ for (const propertyKey of Object.keys(args.properties ?? {})) {
725
+ const propertyId = Object.hasOwn(propertyIdsByKey, propertyKey)
726
+ ? propertyIdsByKey[propertyKey]
727
+ : undefined;
728
+ if (propertyId &&
729
+ dataSource?.collectionSchema?.propertiesById[propertyId]) {
730
+ continue;
731
+ }
732
+ return {
733
+ status: "error",
734
+ error: {
735
+ code: "unmapped_property",
736
+ message: `Cannot resolve property key "${propertyKey}" on this page.`,
737
+ isRetryable: false,
738
+ },
739
+ };
740
+ }
741
+ }
742
+ const resolved = resolvePropertyWriteMapForDataSource({
743
+ dataSource,
744
+ properties: args.properties ?? {},
745
+ operationName: "page.update",
663
746
  });
664
- if (unmappedKey !== undefined) {
665
- return Promise.resolve({
666
- status: "error",
667
- error: {
668
- code: "unmapped_property",
669
- message: `Cannot resolve property key "${unmappedKey}" on this page.`,
670
- isRetryable: false,
671
- },
672
- });
747
+ if (resolved.status === "error") {
748
+ return resolved;
673
749
  }
674
- }
675
- const resolved = resolvePropertyWriteMapForDataSource({
676
- dataSource,
677
- properties: args.properties ?? {},
678
- operationName: "page.update",
679
- });
680
- if (resolved.status === "error") {
681
- return Promise.resolve(resolved);
682
- }
683
- const isArchived = args.is_archived;
684
- return new Promise(resolve => {
685
- if ((args.properties === undefined ||
686
- Object.keys(args.properties).length === 0) &&
750
+ if (Object.keys(args.properties ?? {}).length === 0 &&
687
751
  args.icon === undefined &&
688
752
  args.cover === undefined &&
689
- isArchived === undefined) {
690
- resolve({
753
+ args.is_archived === undefined) {
754
+ return {
691
755
  status: "error",
692
756
  error: {
693
757
  code: "invalid_page_update",
694
758
  message: "updatePage requires at least one property.",
695
759
  isRetryable: false,
696
760
  },
697
- });
698
- return;
761
+ };
699
762
  }
700
- const requestId = this.pendingUpdatePage.allocate(resolve);
701
763
  const outbound = {
702
764
  type: "updatePage",
703
- requestId,
704
765
  dataSourceId,
705
766
  pageId: args.pageId,
706
767
  };
@@ -713,34 +774,24 @@ export class SandboxBridge {
713
774
  if (args.cover !== undefined) {
714
775
  outbound.cover = args.cover;
715
776
  }
716
- if (isArchived !== undefined) {
717
- outbound.archived = isArchived;
777
+ if (args.is_archived !== undefined) {
778
+ outbound.archived = args.is_archived;
779
+ }
780
+ return new Promise(resolve => {
781
+ const requestId = this.pendingUpdatePage.allocate(resolve);
782
+ this.postToHost({ ...outbound, requestId });
783
+ });
784
+ };
785
+ const pending = this.pendingPageUpdates.get(args.pageId);
786
+ const result = pending ? pending.then(operation) : operation();
787
+ const finished = result.then(() => undefined, () => undefined);
788
+ this.pendingPageUpdates.set(args.pageId, finished);
789
+ void finished.then(() => {
790
+ if (this.pendingPageUpdates.get(args.pageId) === finished) {
791
+ this.pendingPageUpdates.delete(args.pageId);
718
792
  }
719
- this.postToHost(outbound);
720
- });
721
- }
722
- /**
723
- * Builds an SDK page object from loaded page data and wires its methods to the bridge.
724
- * Unlike `pages.create`, this does not send a create request or create a page in Notion.
725
- */
726
- buildNotionPage(args) {
727
- const { page, dataSourceId } = args;
728
- const dataSource = this.hostState.status === "initialized" && dataSourceId !== undefined
729
- ? this.hostState.dataSources.find(source => source.collectionPointer?.id === dataSourceId)
730
- : undefined;
731
- return toNotionPageFromNotionPageData({
732
- page,
733
- dataSource,
734
- getDataSource: () => {
735
- if (this.hostState.status !== "initialized" ||
736
- dataSourceId === undefined) {
737
- return undefined;
738
- }
739
- return this.hostState.dataSources.find(source => source.key === dataSource?.key &&
740
- source.collectionPointer?.id === dataSourceId);
741
- },
742
- update: (payload, updateDataSourceId) => this.updatePage({ ...payload, pageId: page.id }, updateDataSourceId),
743
793
  });
794
+ return result;
744
795
  }
745
796
  /**
746
797
  * Translates the public `CreatePageArgs["parent"]` into the bridge-native
@@ -1,14 +1,12 @@
1
- import type { NotionDataSource } from "../protocol/dataSources/dataSource.js";
2
- import type { NotionDataSourceId } from "../protocol/ids.js";
3
- import type { BridgeMessagePayload } from "../protocol/messages/messagePayload.js";
4
- import type { UpdatePageResultMessage } from "../protocol/messages/updatePageResult.js";
5
1
  import type { notionPageDataSchema } from "../protocol/pages/page.js";
6
2
  import type { InferOutput } from "valibot";
7
- import type { NotionPage, PageUpdatePayload } from "../types.js";
3
+ import type { NotionPage } from "../types.js";
8
4
  export declare function toNotionPageFromNotionPageData(args: {
9
5
  page: InferOutput<typeof notionPageDataSchema>;
10
- dataSource: NotionDataSource | undefined;
11
- getDataSource: () => NotionDataSource | undefined;
12
- update: (payload: PageUpdatePayload, dataSourceId: NotionDataSourceId | undefined) => Promise<BridgeMessagePayload<UpdatePageResultMessage>>;
6
+ dataSourceKey: string | undefined;
7
+ getPropertyById: NotionPage["getPropertyById"];
8
+ getPropertyByKey: NotionPage["getPropertyByKey"];
9
+ updateById: NotionPage["updateById"];
10
+ updateByKey: NotionPage["updateByKey"];
13
11
  }): NotionPage;
14
12
  //# sourceMappingURL=page.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/bridge/page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAA;AAClG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAA;AACvG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+DAA+D,CAAA;AAC5G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAA;AAC1F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,EACX,UAAU,EACV,iBAAiB,EAEjB,MAAM,aAAa,CAAA;AAEpB,wBAAgB,8BAA8B,CAAC,IAAI,EAAE;IACpD,IAAI,EAAE,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;IAC9C,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAAA;IACxC,aAAa,EAAE,MAAM,gBAAgB,GAAG,SAAS,CAAA;IACjD,MAAM,EAAE,CACP,OAAO,EAAE,iBAAiB,EAC1B,YAAY,EAAE,kBAAkB,GAAG,SAAS,KACxC,OAAO,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC,CAAA;CAC3D,GAAG,UAAU,CAqEb"}
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/bridge/page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAA;AAC1F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,wBAAgB,8BAA8B,CAAC,IAAI,EAAE;IACpD,IAAI,EAAE,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;IAC9C,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,eAAe,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAC9C,gBAAgB,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAA;IAChD,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAA;IACpC,WAAW,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;CACtC,GAAG,UAAU,CAWb"}
@@ -1,59 +1,12 @@
1
1
  export function toNotionPageFromNotionPageData(args) {
2
- const { page: bridgePage, dataSource } = args;
3
- const getPropertyById = (id) => Object.values(sdkPage.properties).find(value => value?.id === id) ?? null;
4
- let pending;
5
- const updatePage = (payload, dataSourceId) => {
6
- const operation = async () => {
7
- const result = await args.update(payload, dataSourceId);
8
- if (result.status === "error") {
9
- return result;
10
- }
11
- Object.assign(sdkPage, result.page);
12
- return { status: "success", page: sdkPage };
13
- };
14
- const result = pending ? pending.then(operation) : operation();
15
- const finished = result.then(() => undefined, () => undefined);
16
- pending = finished;
17
- void finished.then(() => {
18
- if (pending === finished) {
19
- pending = undefined;
20
- }
21
- });
22
- return result;
2
+ return {
3
+ ...args.page,
4
+ dataSourceKey: args.dataSourceKey ?? null,
5
+ getPropertyById: args.getPropertyById,
6
+ getPropertyByKey: args.getPropertyByKey,
7
+ updateById: args.updateById,
8
+ updateByKey: args.updateByKey,
9
+ archive: () => args.updateById({ is_archived: true }),
10
+ unarchive: () => args.updateById({ is_archived: false }),
23
11
  };
24
- const updateById = (payload) => updatePage(payload, undefined);
25
- const updateByKey = (payload) => {
26
- const dataSourceId = dataSource?.collectionPointer?.id;
27
- if (dataSourceId === undefined) {
28
- return Promise.resolve({
29
- status: "error",
30
- error: {
31
- code: "unmapped_data_source",
32
- message: "This page has no bound data source context.",
33
- isRetryable: false,
34
- },
35
- });
36
- }
37
- return updatePage(payload, dataSourceId);
38
- };
39
- const methods = {
40
- getPropertyById,
41
- getPropertyByKey: (key) => {
42
- const source = args.getDataSource();
43
- const id = source && Object.hasOwn(source.propertyIdsByKey, key)
44
- ? source.propertyIdsByKey[key]
45
- : undefined;
46
- return id === undefined ? null : getPropertyById(id);
47
- },
48
- updateById,
49
- updateByKey,
50
- archive: () => updateById({ is_archived: true }),
51
- unarchive: () => updateById({ is_archived: false }),
52
- };
53
- const sdkPage = {
54
- ...bridgePage,
55
- dataSourceKey: dataSource?.key ?? null,
56
- ...methods,
57
- };
58
- return sdkPage;
59
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sandboxClient.d.ts","sourceRoot":"","sources":["../../src/bridge/sandboxClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAA;AAC3E,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,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,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,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,aAAa,EACb,MAAM,oBAAoB,CAAA;AAI3B,wBAAgB,SAAS,IAAI,aAAa,CAKzC;AAED,eAAO,MAAM,eAAe;IAC3B,0BAA0B,gBACZ,kBAAkB,KAC7B,CAAC,MA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OnD;;OAEG;IACH,IAAI,WACK,YAAY,WACX,eAAe,KACtB,OAAO,CAAC,cAAc,CAAC;CAG1B,CAAA;AAED,sDAAsD;AACtD,eAAO,MAAM,KAAK;IACjB,gEAAgE;IAChE,IAAI,QAAQ,MAAM,KAAG,OAAO,CAAC,qBAAqB,CAAC;CAGnD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,KAAK;IACjB;;OAEG;IACH,IAAI,WAAW,aAAa,KAAG,OAAO,CAAC,eAAe,CAAC;IAIvD;;OAEG;IACH,GAAG,WAAW,YAAY,KAAG,OAAO,CAAC,aAAa,CAAC;CAGnD,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { getDataSourceQueryView as getDataSourceQueryViewWithBridge, } from "./hostState.js";
2
+ import { toNotionPageFromNotionPageData } from "./page.js";
2
3
  import { SandboxBridge, } from "./SandboxBridge.js";
3
4
  let bridge;
4
5
  export function getBridge() {
@@ -46,10 +47,26 @@ export const customBlockDataSources = {
46
47
  getBridge().releaseDataSourceSubscription(subscriptionId);
47
48
  },
48
49
  getView: (hostState, key, subscriptionId) => {
49
- return getDataSourceQueryViewWithBridge(hostState, key, subscriptionId, ({ page, dataSource }) => getBridge().buildNotionPage({
50
- page,
51
- dataSourceId: dataSource?.collectionPointer?.id,
52
- }));
50
+ return getDataSourceQueryViewWithBridge(hostState, key, subscriptionId, ({ page: pageData, dataSource }) => {
51
+ const bridge = getBridge();
52
+ const update = async (args) => {
53
+ const result = await bridge.updatePage(args);
54
+ if (result.status === "error") {
55
+ return result;
56
+ }
57
+ Object.assign(page, result.page);
58
+ return { status: "success", page };
59
+ };
60
+ const page = toNotionPageFromNotionPageData({
61
+ page: pageData,
62
+ dataSourceKey: key,
63
+ getPropertyById: propertyId => bridge.getPropertyById({ page, propertyId }),
64
+ getPropertyByKey: propertyKey => bridge.getPropertyByKey({ page, dataSource, propertyKey }),
65
+ updateById: payload => update({ ...payload, pageId: page.id, dataSource: undefined }),
66
+ updateByKey: payload => update({ ...payload, pageId: page.id, dataSource }),
67
+ });
68
+ return page;
69
+ });
53
70
  },
54
71
  };
55
72
  export const messageLog = {
@@ -68,13 +85,19 @@ export const pages = {
68
85
  * Creates a new Notion page.
69
86
  */
70
87
  create: (input) => {
71
- return getBridge().createPage(input, undefined);
88
+ return getBridge().createPage({
89
+ ...input,
90
+ dataSource: undefined,
91
+ });
72
92
  },
73
93
  /**
74
94
  * Fetches a page by id.
75
95
  */
76
96
  get: (pageId) => {
77
- return getBridge().getPage(pageId, undefined);
97
+ return getBridge().getPage({
98
+ pageId,
99
+ dataSource: undefined,
100
+ });
78
101
  },
79
102
  /**
80
103
  * Requests that the Notion host open a page.
@@ -1 +1 @@
1
- {"version":3,"file":"dataSources.d.ts","sourceRoot":"","sources":["../src/dataSources.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEX,YAAY,EACZ,MAAM,yCAAyC,CAAA;AAIhD,OAAO,KAAK,EACX,cAAc,EAEd,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,MAAM,YAAY,CAAA;AAEnB,eAAO,MAAM,WAAW;IACjB,OAAO,MACP,MAAM,UACH,YAAY,GAClB,OAAO,CAAC,qBAAqB,CAAC;IAW3B,MAAM,MACN,MAAM,WACF,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,UAAU,CAAC,GAClD,OAAO,CAAC,qBAAqB,CAAC;IAiB3B,KAAK,MACL,MAAM,YACD,sBAAsB,GAC9B,OAAO,CAAC,sBAAsB,CAAC;CAsDlC,CAAA"}
1
+ {"version":3,"file":"dataSources.d.ts","sourceRoot":"","sources":["../src/dataSources.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEX,YAAY,EACZ,MAAM,yCAAyC,CAAA;AAIhD,OAAO,KAAK,EACX,cAAc,EAEd,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,MAAM,YAAY,CAAA;AAEnB,eAAO,MAAM,WAAW;IACjB,OAAO,MACP,MAAM,UACH,YAAY,GAClB,OAAO,CAAC,qBAAqB,CAAC;IAW3B,MAAM,MACN,MAAM,WACF,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,UAAU,CAAC,GAClD,OAAO,CAAC,qBAAqB,CAAC;IAe3B,KAAK,MACL,MAAM,YACD,sBAAsB,GAC9B,OAAO,CAAC,sBAAsB,CAAC;CAsDlC,CAAA"}
@@ -7,8 +7,8 @@ export const dataSources = {
7
7
  if (resolved.status === "error") {
8
8
  return resolved;
9
9
  }
10
- const { dataSource, dataSourceId } = resolved;
11
- const result = await getBridge().getPage(pageId, dataSourceId);
10
+ const { dataSource } = resolved;
11
+ const result = await getBridge().getPage({ pageId, dataSource });
12
12
  return result.status === "error"
13
13
  ? result
14
14
  : { ...result, propertyIdsByKey: dataSource.propertyIdsByKey };
@@ -22,7 +22,8 @@ export const dataSources = {
22
22
  const result = await getBridge().createPage({
23
23
  ...payload,
24
24
  parent: { type: "data_source_id", data_source_id: dataSourceId },
25
- }, dataSourceId);
25
+ dataSource,
26
+ });
26
27
  return result.status === "error"
27
28
  ? result
28
29
  : { ...result, propertyIdsByKey: dataSource.propertyIdsByKey };
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@
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 { NotionDateReminder, NotionDateTimeReminder, NotionDisabledReminder, NotionTimeReminder, } from "./protocol/dataSources/dateValue.js";
11
12
  export type { CustomBlockDataSourceResolutionErrorCode, CustomBlockDataSourceResolutionErrorInfo, CustomBlockPropertyErrorCode, CustomBlockPropertyErrorInfo, } from "./protocol/dataSources/errors.js";
12
13
  export type { NotionDualProperty, NotionPropertyColor, NotionPropertyOption, NotionPropertySchema, NotionPropertyType, NotionStatusGroup, } from "./protocol/dataSources/propertySchema.js";
13
14
  export { NOTION_PROPERTY_TYPES } from "./protocol/dataSources/propertySchema.js";
@@ -1 +1 @@
1
- {"version":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,GAC9B,MAAM,+DAA+D,CAAA;AACtE,YAAY,EACX,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,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,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EACN,KAAK,sBAAsB,EAC3B,eAAe,EACf,gBAAgB,GAChB,MAAM,WAAW,CAAA;AAClB,cAAc,YAAY,CAAA"}
@@ -11,10 +11,10 @@ export declare const notionTimeReminderSchema: v.ObjectSchema<{
11
11
  readonly value: v.NumberSchema<undefined>;
12
12
  }, undefined>;
13
13
  export type NotionTimeReminder = v.InferOutput<typeof notionTimeReminderSchema>;
14
- export declare const notionNoReminderSchema: v.ObjectSchema<{
14
+ export declare const notionDisabledReminderSchema: v.ObjectSchema<{
15
15
  readonly unit: v.LiteralSchema<"none", undefined>;
16
16
  }, undefined>;
17
- export type NotionNoReminder = v.InferOutput<typeof notionNoReminderSchema>;
17
+ export type NotionDisabledReminder = v.InferOutput<typeof notionDisabledReminderSchema>;
18
18
  /**
19
19
  * Possible types for a Notion `datetime` reminder.
20
20
  */
@@ -9,7 +9,9 @@ export const notionTimeReminderSchema = v.object({
9
9
  unit: v.picklist(["hour", "minute"]),
10
10
  value: v.number(),
11
11
  });
12
- export const notionNoReminderSchema = v.object({
12
+ // An omitted reminder can inherit the date property's default reminder.
13
+ // "none" explicitly disables reminders instead.
14
+ export const notionDisabledReminderSchema = v.object({
13
15
  unit: v.literal("none"),
14
16
  });
15
17
  /**
@@ -19,25 +21,25 @@ export const notionDateTimeReminderSchema = v.union([
19
21
  notionDateReminderSchema,
20
22
  notionTimeReminderSchema,
21
23
  ]);
22
- const dateOrNoReminder = v.optional(v.union([notionDateReminderSchema, notionNoReminderSchema]));
23
- const dateTimeOrNoReminder = v.optional(v.union([notionDateTimeReminderSchema, notionNoReminderSchema]));
24
+ const dateOrDisabledReminder = v.optional(v.union([notionDateReminderSchema, notionDisabledReminderSchema]));
25
+ const dateTimeOrDisabledReminder = v.optional(v.union([notionDateTimeReminderSchema, notionDisabledReminderSchema]));
24
26
  export const notionDateSchema = v.object({
25
27
  type: v.literal("date"),
26
28
  start_date: v.string(),
27
- reminder: dateOrNoReminder,
29
+ reminder: dateOrDisabledReminder,
28
30
  });
29
31
  export const notionDateRangeSchema = v.object({
30
32
  type: v.literal("daterange"),
31
33
  start_date: v.string(),
32
34
  end_date: v.string(),
33
- reminder: dateOrNoReminder,
35
+ reminder: dateOrDisabledReminder,
34
36
  });
35
37
  export const notionDateTimeSchema = v.object({
36
38
  type: v.literal("datetime"),
37
39
  start_date: v.string(),
38
40
  start_time: v.string(),
39
41
  time_zone: v.optional(v.string()),
40
- reminder: dateTimeOrNoReminder,
42
+ reminder: dateTimeOrDisabledReminder,
41
43
  });
42
44
  export const notionDateTimeRangeSchema = v.object({
43
45
  type: v.literal("datetimerange"),
@@ -46,7 +48,7 @@ export const notionDateTimeRangeSchema = v.object({
46
48
  end_date: v.string(),
47
49
  end_time: v.string(),
48
50
  time_zone: v.optional(v.string()),
49
- reminder: dateTimeOrNoReminder,
51
+ reminder: dateTimeOrDisabledReminder,
50
52
  });
51
53
  /**
52
54
  * Possible types for a Notion `date` value.
@@ -130,11 +130,49 @@ export declare const createPageMessageSchema: v.ObjectSchema<{
130
130
  }, undefined>, v.ObjectSchema<{
131
131
  readonly id: v.StringSchema<undefined>;
132
132
  readonly type: v.LiteralSchema<"date", undefined>;
133
- readonly date: v.NullableSchema<v.ObjectSchema<{
133
+ readonly date: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
134
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
135
+ readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
136
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
137
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
138
+ readonly value: v.NumberSchema<undefined>;
139
+ readonly time: v.StringSchema<undefined>;
140
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
141
+ }, undefined>, v.ObjectSchema<{
142
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
143
+ readonly value: v.NumberSchema<undefined>;
144
+ }, undefined>], undefined>, v.ObjectSchema<{
145
+ readonly unit: v.LiteralSchema<"none", undefined>;
146
+ }, undefined>], undefined>, undefined>;
147
+ readonly start: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "T", undefined>]>;
148
+ }, undefined>, v.ObjectSchema<{
149
+ readonly start: v.StringSchema<undefined>;
150
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
151
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
152
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
153
+ readonly value: v.NumberSchema<undefined>;
154
+ readonly time: v.StringSchema<undefined>;
155
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
156
+ }, undefined>, v.ObjectSchema<{
157
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
158
+ readonly value: v.NumberSchema<undefined>;
159
+ }, undefined>], undefined>, v.ObjectSchema<{
160
+ readonly unit: v.LiteralSchema<"none", undefined>;
161
+ }, undefined>], undefined>, undefined>;
162
+ readonly time_zone: v.StringSchema<undefined>;
163
+ }, undefined>, v.ObjectSchema<{
134
164
  readonly start: v.StringSchema<undefined>;
135
165
  readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
136
166
  readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
137
- }, undefined>, undefined>;
167
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
168
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
169
+ readonly value: v.NumberSchema<undefined>;
170
+ readonly time: v.StringSchema<undefined>;
171
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
172
+ }, undefined>, v.ObjectSchema<{
173
+ readonly unit: v.LiteralSchema<"none", undefined>;
174
+ }, undefined>], undefined>, undefined>;
175
+ }, undefined>], undefined>, undefined>;
138
176
  }, undefined>, v.ObjectSchema<{
139
177
  readonly id: v.StringSchema<undefined>;
140
178
  readonly type: v.LiteralSchema<"people", undefined>;
@@ -209,6 +247,30 @@ export declare const createPageMessageSchema: v.ObjectSchema<{
209
247
  readonly id: v.StringSchema<undefined>;
210
248
  readonly type: v.LiteralSchema<"last_visited_time", undefined>;
211
249
  readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
250
+ }, undefined>, v.ObjectSchema<{
251
+ readonly id: v.StringSchema<undefined>;
252
+ readonly type: v.LiteralSchema<"unique_id", undefined>;
253
+ readonly unique_id: v.StringSchema<undefined>;
254
+ }, undefined>, v.ObjectSchema<{
255
+ readonly id: v.StringSchema<undefined>;
256
+ readonly type: v.LiteralSchema<"button", undefined>;
257
+ readonly button: v.StringSchema<undefined>;
258
+ }, undefined>, v.ObjectSchema<{
259
+ readonly id: v.StringSchema<undefined>;
260
+ readonly type: v.LiteralSchema<"formula", undefined>;
261
+ readonly formula: v.StringSchema<undefined>;
262
+ }, undefined>, v.ObjectSchema<{
263
+ readonly id: v.StringSchema<undefined>;
264
+ readonly type: v.LiteralSchema<"location", undefined>;
265
+ readonly location: v.StringSchema<undefined>;
266
+ }, undefined>, v.ObjectSchema<{
267
+ readonly id: v.StringSchema<undefined>;
268
+ readonly type: v.LiteralSchema<"rollup", undefined>;
269
+ readonly rollup: v.StringSchema<undefined>;
270
+ }, undefined>, v.ObjectSchema<{
271
+ readonly id: v.StringSchema<undefined>;
272
+ readonly type: v.LiteralSchema<"verification", undefined>;
273
+ readonly verification: v.StringSchema<undefined>;
212
274
  }, undefined>], undefined>, undefined>;
213
275
  readonly position: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
214
276
  readonly type: v.LiteralSchema<"start", undefined>;