@notionhq/custom-blocks 0.2.23 → 0.3.0
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.
- package/README.md +8 -5
- package/dist/bridge/SandboxBridge.d.ts +15 -14
- package/dist/bridge/SandboxBridge.d.ts.map +1 -1
- package/dist/bridge/SandboxBridge.js +117 -35
- package/dist/bridge/dataSources/resolve.d.ts +1 -3
- package/dist/bridge/dataSources/resolve.d.ts.map +1 -1
- package/dist/bridge/dataSources/resolve.js +1 -11
- package/dist/bridge/dataSources/resolveProperty.d.ts +3 -3
- package/dist/bridge/dataSources/resolveProperty.d.ts.map +1 -1
- package/dist/bridge/dataSources/resolveProperty.js +1 -1
- package/dist/bridge/dataSources/subscribe.d.ts +2 -1
- package/dist/bridge/dataSources/subscribe.d.ts.map +1 -1
- package/dist/bridge/dataSources/subscribe.js +6 -1
- package/dist/bridge/hostState.d.ts +11 -39
- package/dist/bridge/hostState.d.ts.map +1 -1
- package/dist/bridge/hostState.js +5 -50
- package/dist/bridge/page.d.ts +14 -0
- package/dist/bridge/page.d.ts.map +1 -0
- package/dist/bridge/page.js +59 -0
- package/dist/bridge/sandboxClient.d.ts +8 -14
- package/dist/bridge/sandboxClient.d.ts.map +1 -1
- package/dist/bridge/sandboxClient.js +13 -21
- package/dist/dataSources.d.ts +8 -0
- package/dist/dataSources.d.ts.map +1 -0
- package/dist/dataSources.js +103 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/protocol/dataSources/dataSourcePage.d.ts +3 -5
- package/dist/protocol/dataSources/dataSourcePage.js +2 -3
- package/dist/protocol/dataSources/propertySchema.d.ts +1 -0
- package/dist/protocol/index.d.ts +1 -0
- package/dist/protocol/index.js +1 -0
- package/dist/protocol/messages/createPage.d.ts +28 -0
- package/dist/protocol/messages/createPageResult.d.ts +496 -1
- package/dist/protocol/messages/createPageResult.js +17 -2
- package/dist/protocol/messages/getPage.d.ts +496 -1
- package/dist/protocol/messages/getPage.js +18 -3
- package/dist/protocol/messages/hostToSandbox.d.ts +2647 -154
- package/dist/protocol/messages/hostToSandbox.js +24 -12
- package/dist/protocol/messages/openExternalUrl.d.ts +32 -0
- package/dist/protocol/messages/openExternalUrl.js +26 -0
- package/dist/protocol/messages/queryDataSourceResult.d.ts +468 -1
- package/dist/protocol/messages/queryDataSourceResult.js +18 -2
- package/dist/protocol/messages/sandboxToHost.d.ts +62 -0
- package/dist/protocol/messages/sandboxToHost.js +2 -0
- package/dist/protocol/messages/updatePage.d.ts +29 -0
- package/dist/protocol/messages/updatePage.js +2 -1
- package/dist/protocol/messages/updatePageResult.d.ts +495 -1
- package/dist/protocol/messages/updatePageResult.js +16 -2
- package/dist/protocol/pages/page.d.ts +470 -3
- package/dist/protocol/pages/page.js +53 -1
- package/dist/protocol/protocolVersion.d.ts +2 -1
- package/dist/protocol/protocolVersion.js +4 -1
- package/dist/react/useDataSource.d.ts +1 -1
- package/dist/react/useDataSource.d.ts.map +1 -1
- package/dist/react/useDataSource.js +1 -3
- package/dist/types.d.ts +55 -96
- package/dist/types.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/docs/block-location.md +3 -3
- package/docs/data-sources.md +159 -122
- package/docs/errors.md +9 -9
- package/docs/links.md +44 -0
- package/docs/pages.md +121 -191
- package/package.json +1 -1
- package/src/bridge/SandboxBridge.ts +189 -62
- package/src/bridge/dataSources/resolve.ts +1 -20
- package/src/bridge/dataSources/resolveProperty.ts +4 -4
- package/src/bridge/dataSources/subscribe.ts +10 -5
- package/src/bridge/hostState.ts +21 -100
- package/src/bridge/page.ts +90 -0
- package/src/bridge/sandboxClient.ts +15 -25
- package/src/dataSources.ts +140 -0
- package/src/index.ts +9 -19
- package/src/react/useDataSource.ts +1 -3
- package/src/types.ts +61 -109
package/README.md
CHANGED
|
@@ -119,11 +119,13 @@ Import React hooks and components from `@notionhq/custom-blocks/react`.
|
|
|
119
119
|
- [`docs/block-location.md`](./docs/block-location.md) — `useBlockId`, `useParent`, `usePage`,
|
|
120
120
|
`useTheme`, `useContrastMode`, `NotionTokenScope`, and `NotionTokenScopeProps`. Where the block
|
|
121
121
|
sits and how to read the host's appearance.
|
|
122
|
-
- [`docs/data-sources.md`](./docs/data-sources.md) — `
|
|
123
|
-
`useDataSource`, `useManifest`, `customBlock.getManifest`,
|
|
124
|
-
types, plus a worked example.
|
|
125
|
-
- [`docs/pages.md`](./docs/pages.md) — `pages.create / get / open
|
|
122
|
+
- [`docs/data-sources.md`](./docs/data-sources.md) — `dataSources.query / getPage / create`,
|
|
123
|
+
`customBlock.subscribeToDataSource`, `useDataSource`, `useManifest`, `customBlock.getManifest`,
|
|
124
|
+
the row, property, and date-value types, plus a worked example.
|
|
125
|
+
- [`docs/pages.md`](./docs/pages.md) — `pages.create / get / open` and page instance mutations,
|
|
126
126
|
parent variants (including the recommended `data_source_key`), property input shapes.
|
|
127
|
+
- [`docs/links.md`](./docs/links.md) — `links.open`, URL validation, host-owned confirmation, and
|
|
128
|
+
external-navigation errors.
|
|
127
129
|
- [`docs/users.md`](./docs/users.md) — `users.list / get`, the `NotionUser` shape, paging.
|
|
128
130
|
- [`docs/errors.md`](./docs/errors.md) — request results, error format, error codes, retries, and
|
|
129
131
|
initialization failures.
|
|
@@ -137,7 +139,8 @@ Import React hooks and components from `@notionhq/custom-blocks/react`.
|
|
|
137
139
|
Custom blocks do not render on pages published with Notion Sites.
|
|
138
140
|
|
|
139
141
|
Custom blocks run in sandboxed iframes. A block cannot navigate the top-level page, call
|
|
140
|
-
`window.open`, or start an authentication redirect.
|
|
142
|
+
`window.open`, or start an authentication redirect. Use `pages.open` to navigate to Notion pages and
|
|
143
|
+
`links.open` for host-approved HTTP and HTTPS URLs.
|
|
141
144
|
|
|
142
145
|
By default, a block cannot request external origins. A workspace owner can allow specific HTTPS
|
|
143
146
|
origins under **Settings → Notion AI → Workers → Manage → Custom block external network access**. To
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { NotionPageId } from "../protocol/ids.js";
|
|
1
|
+
import type { NotionDataSourceId, NotionPageId } from "../protocol/ids.js";
|
|
3
2
|
import { type InitMessage } from "../protocol/messages/init.js";
|
|
4
|
-
import type {
|
|
3
|
+
import type { notionPageDataSchema } from "../protocol/pages/page.js";
|
|
4
|
+
import type { InferOutput } from "valibot";
|
|
5
|
+
import type { CreatePageArgs, CreatePageResult, DataSourceQueryOptions, GetPageResult, GetUserResult, ListUsersArgs, ListUsersResult, NotionPage, NotionUserId, OpenExternalUrlResult, OpenPageOptions, OpenPageResult } from "../types.js";
|
|
5
6
|
import { type CustomBlockHostState } from "./hostState.js";
|
|
6
7
|
import type { ManifestLoadResult } from "./loadManifest.js";
|
|
7
8
|
import type { MessageInterceptor } from "./messageInterceptor.js";
|
|
@@ -32,6 +33,7 @@ export declare class SandboxBridge {
|
|
|
32
33
|
private readonly pendingGetUser;
|
|
33
34
|
private readonly pendingListUsers;
|
|
34
35
|
private readonly pendingOpenPage;
|
|
36
|
+
private readonly pendingOpenExternalUrl;
|
|
35
37
|
private readonly pendingUpdatePage;
|
|
36
38
|
private latestDataSourceBindings;
|
|
37
39
|
private isMockState;
|
|
@@ -74,22 +76,21 @@ export declare class SandboxBridge {
|
|
|
74
76
|
private setDataSourceQueryError;
|
|
75
77
|
releaseDataSourceSubscription(subscriptionId: string): void;
|
|
76
78
|
postResize(height: number): void;
|
|
77
|
-
createPage(
|
|
78
|
-
getPage(pageId: NotionPageId): Promise<GetPageResult>;
|
|
79
|
+
createPage(createPageArgs: CreatePageArgs, dataSourceId: NotionDataSourceId | undefined): Promise<CreatePageResult>;
|
|
80
|
+
getPage(pageId: NotionPageId, dataSourceId: NotionDataSourceId | undefined): Promise<GetPageResult>;
|
|
79
81
|
openPage(pageId: NotionPageId, options: OpenPageOptions): Promise<OpenPageResult>;
|
|
82
|
+
openExternalUrl(url: string): Promise<OpenExternalUrlResult>;
|
|
80
83
|
getUser(userId: NotionUserId): Promise<GetUserResult>;
|
|
81
84
|
listUsers(args?: ListUsersArgs): Promise<ListUsersResult>;
|
|
82
|
-
updatePage
|
|
85
|
+
private updatePage;
|
|
83
86
|
/**
|
|
84
|
-
*
|
|
85
|
-
* `
|
|
86
|
-
* returned from {@link getDataSourceQueryView}.
|
|
87
|
+
* Builds an SDK page object from loaded page data and wires its methods to the bridge.
|
|
88
|
+
* Unlike `pages.create`, this does not send a create request or create a page in Notion.
|
|
87
89
|
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}): Promise<UpdatePageResult>;
|
|
90
|
+
buildNotionPage(args: {
|
|
91
|
+
page: InferOutput<typeof notionPageDataSchema>;
|
|
92
|
+
dataSourceId: NotionDataSourceId | undefined;
|
|
93
|
+
}): NotionPage;
|
|
93
94
|
/**
|
|
94
95
|
* Translates the public `CreatePageArgs["parent"]` into the bridge-native
|
|
95
96
|
* `CreatePageMessageParent`. The `data_source_key` variant is resolved sandbox-side against the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxBridge.d.ts","sourceRoot":"","sources":["../../src/bridge/SandboxBridge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SandboxBridge.d.ts","sourceRoot":"","sources":["../../src/bridge/SandboxBridge.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACX,kBAAkB,EAClB,YAAY,EACZ,MAAM,yCAAyC,CAAA;AAiBhD,OAAO,EACN,KAAK,WAAW,EAEhB,MAAM,mDAAmD,CAAA;AAc1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAA;AAE1F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,OAAO,KAAK,EACX,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf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eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAU3D;IAED,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAUpD;IAED,SAAS,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,eAAe,CAAC,CAW5D;IAED,OAAO,CAAC,UAAU;IAgFlB;;;OAGG;IACH,eAAe,CAAC,IAAI,EAAE;QACrB,IAAI,EAAE,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;QAC9C,YAAY,EAAE,kBAAkB,GAAG,SAAS,CAAA;KAC5C,GAAG,UAAU,CA2Bb;IAED;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;CAkE/B"}
|
|
@@ -6,10 +6,11 @@ import * as v from "valibot";
|
|
|
6
6
|
import { unreachable } from "../utils.js";
|
|
7
7
|
import { NOTION_DARK_BACKGROUND_BASE, NOTION_LIGHT_BACKGROUND_BASE, } from "./appearance.js";
|
|
8
8
|
import { resolveDataSourceQuery } from "./dataSources/query.js";
|
|
9
|
-
import {
|
|
9
|
+
import { resolveDataSources } from "./dataSources/resolve.js";
|
|
10
10
|
import { resolvePropertyWriteMapForDataSource } from "./dataSources/resolveProperty.js";
|
|
11
11
|
import { createEmptyDataSourceQueryState, } from "./hostState.js";
|
|
12
12
|
import { notifyListener } from "./notifyListener.js";
|
|
13
|
+
import { toNotionPageFromNotionPageData } from "./page.js";
|
|
13
14
|
import { PendingRequests } from "./pendingRequests.js";
|
|
14
15
|
import { SandboxInitialization } from "./SandboxInitialization.js";
|
|
15
16
|
export class SandboxBridge {
|
|
@@ -27,6 +28,7 @@ export class SandboxBridge {
|
|
|
27
28
|
pendingGetUser = new PendingRequests("custom-block-get-user");
|
|
28
29
|
pendingListUsers = new PendingRequests("custom-block-list-users");
|
|
29
30
|
pendingOpenPage = new PendingRequests("custom-block-open-page");
|
|
31
|
+
pendingOpenExternalUrl = new PendingRequests("custom-block-open-url");
|
|
30
32
|
pendingUpdatePage = new PendingRequests("custom-block-update-page");
|
|
31
33
|
latestDataSourceBindings = {};
|
|
32
34
|
isMockState = false;
|
|
@@ -74,7 +76,7 @@ export class SandboxBridge {
|
|
|
74
76
|
this.messageLog.push({
|
|
75
77
|
timestamp: new Date().toISOString(),
|
|
76
78
|
direction,
|
|
77
|
-
data,
|
|
79
|
+
data: redactExternalUrl(data),
|
|
78
80
|
});
|
|
79
81
|
for (const listener of this.messageLogListeners) {
|
|
80
82
|
listener();
|
|
@@ -300,6 +302,15 @@ export class SandboxBridge {
|
|
|
300
302
|
}
|
|
301
303
|
return;
|
|
302
304
|
}
|
|
305
|
+
case "openExternalUrlResult": {
|
|
306
|
+
const result = message.status === "success"
|
|
307
|
+
? { status: "success" }
|
|
308
|
+
: { status: "error", error: message.error };
|
|
309
|
+
if (!this.pendingOpenExternalUrl.resolve(message.requestId, result)) {
|
|
310
|
+
console.warn(`[custom-blocks-sdk] openExternalUrlResult for unknown requestId ${message.requestId}`);
|
|
311
|
+
}
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
303
314
|
case "updatePageResult": {
|
|
304
315
|
const result = message.status === "success"
|
|
305
316
|
? { status: "success", page: message.page }
|
|
@@ -314,6 +325,7 @@ export class SandboxBridge {
|
|
|
314
325
|
if (currentState === undefined) {
|
|
315
326
|
return;
|
|
316
327
|
}
|
|
328
|
+
const items = message.status === "success" ? message.items : [];
|
|
317
329
|
const queryResult = message.status === "error"
|
|
318
330
|
? {
|
|
319
331
|
items: [],
|
|
@@ -321,7 +333,7 @@ export class SandboxBridge {
|
|
|
321
333
|
error: message.error,
|
|
322
334
|
}
|
|
323
335
|
: {
|
|
324
|
-
items
|
|
336
|
+
items,
|
|
325
337
|
hasMore: message.hasMore,
|
|
326
338
|
error: undefined,
|
|
327
339
|
};
|
|
@@ -533,41 +545,60 @@ export class SandboxBridge {
|
|
|
533
545
|
};
|
|
534
546
|
this.postToHost(outbound);
|
|
535
547
|
}
|
|
536
|
-
createPage(
|
|
548
|
+
createPage(createPageArgs, dataSourceId) {
|
|
537
549
|
return new Promise(resolve => {
|
|
538
|
-
const resolvedParent = this.resolveCreatePageParent(
|
|
550
|
+
const resolvedParent = this.resolveCreatePageParent(createPageArgs.parent);
|
|
539
551
|
if (resolvedParent.status === "error") {
|
|
540
552
|
resolve(resolvedParent);
|
|
541
553
|
return;
|
|
542
554
|
}
|
|
543
555
|
const resolvedProperties = resolvePropertyWriteMapForDataSource({
|
|
544
556
|
dataSource: resolvedParent.dataSource,
|
|
545
|
-
properties:
|
|
557
|
+
properties: createPageArgs.properties,
|
|
546
558
|
operationName: "createPage",
|
|
547
559
|
});
|
|
548
560
|
if (resolvedProperties.status === "error") {
|
|
549
561
|
resolve(resolvedProperties);
|
|
550
562
|
return;
|
|
551
563
|
}
|
|
552
|
-
const requestId = this.pendingCreatePage.allocate(
|
|
564
|
+
const requestId = this.pendingCreatePage.allocate(result => {
|
|
565
|
+
if (result.status === "error") {
|
|
566
|
+
resolve(result);
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
resolve({
|
|
570
|
+
status: "success",
|
|
571
|
+
page: this.buildNotionPage({ page: result.page, dataSourceId }),
|
|
572
|
+
});
|
|
573
|
+
});
|
|
553
574
|
const outbound = {
|
|
554
575
|
type: "createPage",
|
|
555
576
|
requestId,
|
|
556
577
|
parent: resolvedParent.parent,
|
|
557
578
|
properties: resolvedProperties.properties,
|
|
558
579
|
};
|
|
559
|
-
if (
|
|
560
|
-
outbound.position =
|
|
580
|
+
if (createPageArgs.position !== undefined) {
|
|
581
|
+
outbound.position = createPageArgs.position;
|
|
561
582
|
}
|
|
562
583
|
this.postToHost(outbound);
|
|
563
584
|
});
|
|
564
585
|
}
|
|
565
|
-
getPage(pageId) {
|
|
586
|
+
getPage(pageId, dataSourceId) {
|
|
566
587
|
return new Promise(resolve => {
|
|
567
|
-
const requestId = this.pendingGetPage.allocate(
|
|
588
|
+
const requestId = this.pendingGetPage.allocate(result => {
|
|
589
|
+
if (result.status === "error") {
|
|
590
|
+
resolve(result);
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
resolve({
|
|
594
|
+
status: "success",
|
|
595
|
+
page: this.buildNotionPage({ page: result.page, dataSourceId }),
|
|
596
|
+
});
|
|
597
|
+
});
|
|
568
598
|
const outbound = {
|
|
569
599
|
type: "getPage",
|
|
570
600
|
requestId,
|
|
601
|
+
dataSourceId,
|
|
571
602
|
pageId,
|
|
572
603
|
};
|
|
573
604
|
this.postToHost(outbound);
|
|
@@ -585,6 +616,17 @@ export class SandboxBridge {
|
|
|
585
616
|
this.postToHost(outbound);
|
|
586
617
|
});
|
|
587
618
|
}
|
|
619
|
+
openExternalUrl(url) {
|
|
620
|
+
return new Promise(resolve => {
|
|
621
|
+
const requestId = this.pendingOpenExternalUrl.allocate(resolve);
|
|
622
|
+
const outbound = {
|
|
623
|
+
type: "openExternalUrl",
|
|
624
|
+
requestId,
|
|
625
|
+
url,
|
|
626
|
+
};
|
|
627
|
+
this.postToHost(outbound);
|
|
628
|
+
});
|
|
629
|
+
}
|
|
588
630
|
getUser(userId) {
|
|
589
631
|
return new Promise(resolve => {
|
|
590
632
|
const requestId = this.pendingGetUser.allocate(resolve);
|
|
@@ -608,7 +650,36 @@ export class SandboxBridge {
|
|
|
608
650
|
this.postToHost(outbound);
|
|
609
651
|
});
|
|
610
652
|
}
|
|
611
|
-
updatePage(args) {
|
|
653
|
+
updatePage(args, dataSourceId) {
|
|
654
|
+
const dataSource = this.hostState.status === "initialized" && dataSourceId !== undefined
|
|
655
|
+
? this.hostState.dataSources.find(source => source.collectionPointer?.id === dataSourceId)
|
|
656
|
+
: 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];
|
|
663
|
+
});
|
|
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
|
+
});
|
|
673
|
+
}
|
|
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
|
+
}
|
|
612
683
|
const isArchived = args.is_archived;
|
|
613
684
|
return new Promise(resolve => {
|
|
614
685
|
if ((args.properties === undefined ||
|
|
@@ -630,10 +701,11 @@ export class SandboxBridge {
|
|
|
630
701
|
const outbound = {
|
|
631
702
|
type: "updatePage",
|
|
632
703
|
requestId,
|
|
704
|
+
dataSourceId,
|
|
633
705
|
pageId: args.pageId,
|
|
634
706
|
};
|
|
635
707
|
if (args.properties !== undefined) {
|
|
636
|
-
outbound.properties =
|
|
708
|
+
outbound.properties = resolved.properties;
|
|
637
709
|
}
|
|
638
710
|
if (args.icon !== undefined) {
|
|
639
711
|
outbound.icon = args.icon;
|
|
@@ -648,28 +720,26 @@ export class SandboxBridge {
|
|
|
648
720
|
});
|
|
649
721
|
}
|
|
650
722
|
/**
|
|
651
|
-
*
|
|
652
|
-
* `
|
|
653
|
-
* returned from {@link getDataSourceQueryView}.
|
|
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.
|
|
654
725
|
*/
|
|
655
|
-
|
|
656
|
-
const {
|
|
657
|
-
const
|
|
658
|
-
?
|
|
659
|
-
:
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
is_archived: pageUpdateArgs.is_archived,
|
|
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),
|
|
673
743
|
});
|
|
674
744
|
}
|
|
675
745
|
/**
|
|
@@ -799,6 +869,18 @@ function readInitializationId(data) {
|
|
|
799
869
|
}
|
|
800
870
|
return undefined;
|
|
801
871
|
}
|
|
872
|
+
function redactExternalUrl(data) {
|
|
873
|
+
if (typeof data === "object" &&
|
|
874
|
+
data !== null &&
|
|
875
|
+
"type" in data &&
|
|
876
|
+
data.type === "openExternalUrl") {
|
|
877
|
+
return {
|
|
878
|
+
type: "openExternalUrl",
|
|
879
|
+
...("requestId" in data ? { requestId: data.requestId } : {}),
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
return data;
|
|
883
|
+
}
|
|
802
884
|
function getInitBindingError(manifest, dataSources) {
|
|
803
885
|
for (const [dataSourceKey, manifestDataSource] of Object.entries(manifest.dataSources)) {
|
|
804
886
|
const dataSource = dataSources.find(entry => entry.key === dataSourceKey);
|
|
@@ -828,7 +910,7 @@ function resolveMockDataSources(bindings) {
|
|
|
828
910
|
collectionPointer: binding.collectionPointer,
|
|
829
911
|
collectionSchema: binding.collectionSchema,
|
|
830
912
|
propertyIdsByKey: { ...(binding.propertyIdsByKey ?? {}) },
|
|
831
|
-
propertySchemasById:
|
|
913
|
+
propertySchemasById: binding.collectionSchema?.propertiesById ?? {},
|
|
832
914
|
}));
|
|
833
915
|
}
|
|
834
916
|
function formatInvalidHostReason(incomingType, issues) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type NotionPropertySchema } from "../../protocol/dataSources/propertySchema.js";
|
|
1
|
+
import type { NotionDataSource, NotionDataSourceBindings } from "../../protocol/dataSources/dataSource.js";
|
|
3
2
|
import type { CustomBlockManifest } from "../../protocol/manifest.js";
|
|
4
3
|
/**
|
|
5
4
|
* Builds the public {@link NotionDataSource} list the SDK exposes to consumers.
|
|
@@ -12,5 +11,4 @@ export declare function resolveDataSources(args: {
|
|
|
12
11
|
manifest: CustomBlockManifest;
|
|
13
12
|
dataSourceBindings: NotionDataSourceBindings;
|
|
14
13
|
}): NotionDataSource[];
|
|
15
|
-
export declare function getDataSourceReadSchemas(collectionSchema: NotionCollectionSchema | undefined): Record<string, NotionPropertySchema>;
|
|
16
14
|
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/bridge/dataSources/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/bridge/dataSources/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,gBAAgB,EAChB,wBAAwB,EACxB,MAAM,4DAA4D,CAAA;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAA;AAEvF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACxC,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,kBAAkB,EAAE,wBAAwB,CAAA;CAC5C,GAAG,gBAAgB,EAAE,CAiCrB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NOTION_BUILTIN_PROPERTY_SCHEMAS, } from "../../protocol/dataSources/propertySchema.js";
|
|
2
1
|
/**
|
|
3
2
|
* Builds the public {@link NotionDataSource} list the SDK exposes to consumers.
|
|
4
3
|
*
|
|
@@ -10,7 +9,6 @@ export function resolveDataSources(args) {
|
|
|
10
9
|
return Object.entries(args.manifest.dataSources).map(([key, manifestDataSource]) => {
|
|
11
10
|
const binding = args.dataSourceBindings[key];
|
|
12
11
|
const collectionProperties = binding?.collectionSchema?.propertiesById ?? {};
|
|
13
|
-
const propertySchemasById = getDataSourceReadSchemas(binding?.collectionSchema);
|
|
14
12
|
const bindingPropertyIdsByKey = binding?.propertyIdsByKey ?? {};
|
|
15
13
|
const propertyIdsByKey = {};
|
|
16
14
|
const manifestProperties = Object.entries(manifestDataSource.properties ?? {});
|
|
@@ -29,15 +27,7 @@ export function resolveDataSources(args) {
|
|
|
29
27
|
collectionPointer: binding?.collectionPointer,
|
|
30
28
|
collectionSchema: binding?.collectionSchema,
|
|
31
29
|
propertyIdsByKey,
|
|
32
|
-
propertySchemasById,
|
|
30
|
+
propertySchemasById: collectionProperties,
|
|
33
31
|
};
|
|
34
32
|
});
|
|
35
33
|
}
|
|
36
|
-
export function getDataSourceReadSchemas(collectionSchema) {
|
|
37
|
-
// Queries without filters or sorts can return metadata without a database schema. Keep
|
|
38
|
-
// metadata schemas available for reading those values.
|
|
39
|
-
return {
|
|
40
|
-
...collectionSchema?.propertiesById,
|
|
41
|
-
...NOTION_BUILTIN_PROPERTY_SCHEMAS,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { NotionDataSource } from "../../protocol/dataSources/dataSource.js";
|
|
2
2
|
import type { CustomBlockPropertyErrorInfo } from "../../protocol/dataSources/errors.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { CreatePageMessage } from "../../protocol/messages/createPage.js";
|
|
4
4
|
import type { NotionPagePropertyInputMap } from "../../types.js";
|
|
5
5
|
export type PropertyWriteMapResolutionResult = {
|
|
6
6
|
status: "success";
|
|
7
|
-
properties:
|
|
7
|
+
properties: CreatePageMessage["properties"];
|
|
8
8
|
} | {
|
|
9
9
|
status: "error";
|
|
10
10
|
error: CustomBlockPropertyErrorInfo;
|
|
@@ -14,7 +14,7 @@ export type PropertyWriteMapResolutionResult = {
|
|
|
14
14
|
*
|
|
15
15
|
* Identifiers in `properties` may be raw property IDs or data source property keys; the latter
|
|
16
16
|
* are looked up in the `dataSource`'s `propertyIdsByKey`. Each value is re-parsed through
|
|
17
|
-
*
|
|
17
|
+
* the page property value schema with its `id` rewritten to the resolved property ID.
|
|
18
18
|
*/
|
|
19
19
|
export declare function resolvePropertyWriteMapForDataSource(args: {
|
|
20
20
|
dataSource: NotionDataSource | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveProperty.d.ts","sourceRoot":"","sources":["../../../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,
|
|
1
|
+
{"version":3,"file":"resolveProperty.d.ts","sourceRoot":"","sources":["../../../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,iBAAiB,EAAE,MAAM,yDAAyD,CAAA;AAGhG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAA;AAEhE,MAAM,MAAM,gCAAgC,GACzC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAA;CAAE,GAClE;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"}
|
|
@@ -8,7 +8,7 @@ function makePropertyError(code, message) {
|
|
|
8
8
|
*
|
|
9
9
|
* Identifiers in `properties` may be raw property IDs or data source property keys; the latter
|
|
10
10
|
* are looked up in the `dataSource`'s `propertyIdsByKey`. Each value is re-parsed through
|
|
11
|
-
*
|
|
11
|
+
* the page property value schema with its `id` rewritten to the resolved property ID.
|
|
12
12
|
*/
|
|
13
13
|
export function resolvePropertyWriteMapForDataSource(args) {
|
|
14
14
|
const { dataSource, properties, operationName } = args;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CustomBlockQueryDataSourceErrorInfo } from "../../protocol/messages/queryDataSourceResult.js";
|
|
1
2
|
import type { SubscribeToDataSourceArgs } from "../../types.js";
|
|
2
|
-
export declare function subscribeToDataSource({ key, onSnapshot, options: providedOptions
|
|
3
|
+
export declare function subscribeToDataSource({ key, onSnapshot, options: providedOptions }: SubscribeToDataSourceArgs, onError?: (error: CustomBlockQueryDataSourceErrorInfo) => void): () => void;
|
|
3
4
|
//# sourceMappingURL=subscribe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["../../../src/bridge/dataSources/subscribe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAA;AAQ/D,wBAAgB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["../../../src/bridge/dataSources/subscribe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oEAAoE,CAAA;AAC7H,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAA;AAQ/D,wBAAgB,qBAAqB,CACpC,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,eAAoB,EAAE,EAAE,yBAAyB,EAC7E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,mCAAmC,KAAK,IAAI,GAC5D,MAAM,IAAI,CAyFZ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { notifyListener } from "../notifyListener.js";
|
|
2
2
|
import { customBlockDataSources, customBlockHost } from "../sandboxClient.js";
|
|
3
|
-
export function subscribeToDataSource({ key, onSnapshot, options: providedOptions = {},
|
|
3
|
+
export function subscribeToDataSource({ key, onSnapshot, options: providedOptions = {} }, onError) {
|
|
4
4
|
const options = structuredClone(providedOptions);
|
|
5
5
|
const subscriptionId = customBlockDataSources.createSubscriptionId();
|
|
6
6
|
let active = true;
|
|
@@ -16,6 +16,11 @@ export function subscribeToDataSource({ key, onSnapshot, options: providedOption
|
|
|
16
16
|
const snapshot = customBlockDataSources.getView(hostState, key, subscriptionId);
|
|
17
17
|
// Record inputs before calling consumer code, which can trigger another notification.
|
|
18
18
|
lastSnapshotInputs = { status: hostState.status, dataSource, queryState };
|
|
19
|
+
const error = queryState?.error;
|
|
20
|
+
if (error && onError) {
|
|
21
|
+
notifyListener(() => onError(error));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
19
24
|
notifyListener(() => onSnapshot(snapshot));
|
|
20
25
|
};
|
|
21
26
|
const handleHostChange = () => {
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { NotionContrastMode } from "../protocol/contrast.js";
|
|
2
2
|
import type { NotionDataSource } from "../protocol/dataSources/dataSource.js";
|
|
3
|
-
import type {
|
|
4
|
-
import type { NotionPropertySchema } from "../protocol/dataSources/propertySchema.js";
|
|
5
|
-
import type { NotionBlockId, NotionPageId } from "../protocol/ids.js";
|
|
3
|
+
import type { NotionBlockId } from "../protocol/ids.js";
|
|
6
4
|
import type { CustomBlockManifest } from "../protocol/manifest.js";
|
|
7
5
|
import type { CustomBlockQueryDataSourceErrorInfo } from "../protocol/messages/queryDataSourceResult.js";
|
|
8
|
-
import type { CustomBlockPage } from "../protocol/pages/page.js";
|
|
6
|
+
import type { CustomBlockPage, notionPageDataSchema } from "../protocol/pages/page.js";
|
|
9
7
|
import type { NotionParent } from "../protocol/parent.js";
|
|
10
8
|
import type { NotionTheme } from "../protocol/theme.js";
|
|
11
9
|
import type { NotionUser } from "../protocol/users/user.js";
|
|
12
|
-
import type {
|
|
10
|
+
import type { InferOutput } from "valibot";
|
|
11
|
+
import type { DataSourceSnapshot, NotionPage } from "../types.js";
|
|
13
12
|
export type CustomBlockHostState = UninitializedHostState | InitializedHostState;
|
|
14
13
|
export type UninitializedHostState = {
|
|
15
14
|
status: "uninitialized";
|
|
@@ -30,8 +29,8 @@ export type InitializedHostState = {
|
|
|
30
29
|
};
|
|
31
30
|
export type DataSourceQueryState = {
|
|
32
31
|
dataSourceKey: string;
|
|
33
|
-
/** Latest pages from the host as parsed from the bridge.
|
|
34
|
-
items:
|
|
32
|
+
/** Latest pages from the host as parsed from the bridge. */
|
|
33
|
+
items: InferOutput<typeof notionPageDataSchema>[];
|
|
35
34
|
isLoading: boolean;
|
|
36
35
|
hasMore: boolean;
|
|
37
36
|
error?: CustomBlockQueryDataSourceErrorInfo;
|
|
@@ -39,36 +38,9 @@ export type DataSourceQueryState = {
|
|
|
39
38
|
latestQueryIdentity?: string;
|
|
40
39
|
};
|
|
41
40
|
export declare function createEmptyDataSourceQueryState(dataSourceKey: string): DataSourceQueryState;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export type DataSourceQueryView = {
|
|
48
|
-
items: NotionDataSourcePage[];
|
|
49
|
-
collectionSchema?: NotionDataSource["collectionSchema"];
|
|
50
|
-
propertySchemasById: {
|
|
51
|
-
[propertyId: string]: NotionPropertySchema;
|
|
52
|
-
};
|
|
53
|
-
propertyIdsByKey: {
|
|
54
|
-
[key: string]: string | undefined;
|
|
55
|
-
};
|
|
56
|
-
propertySchemasByKey: {
|
|
57
|
-
[key: string]: NotionPropertySchema | undefined;
|
|
58
|
-
};
|
|
59
|
-
isLoading: boolean;
|
|
60
|
-
hasMore: boolean;
|
|
61
|
-
error?: CustomBlockQueryDataSourceErrorInfo;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Per-row callback that resolves property keys against the data source and forwards the
|
|
65
|
-
* resulting write to the bridge. Injected by callers (typically the SDK singleton in `init.ts`)
|
|
66
|
-
* so this module stays free of bridge-instance dependencies.
|
|
67
|
-
*/
|
|
68
|
-
export type UpdateDataSourcePageFn = (args: {
|
|
69
|
-
dataSource: NotionDataSource;
|
|
70
|
-
pageId: NotionPageId;
|
|
71
|
-
pageUpdateArgs: NotionDataSourcePageUpdateArgs;
|
|
72
|
-
}) => Promise<UpdatePageResult>;
|
|
73
|
-
export declare function getDataSourceQueryView(hostState: CustomBlockHostState, key: string, subscriptionId: string, updateDataSourcePage: UpdateDataSourcePageFn): DataSourceQueryView;
|
|
41
|
+
export type DataSourceQueryView = DataSourceSnapshot;
|
|
42
|
+
export declare function getDataSourceQueryView(hostState: CustomBlockHostState, key: string, subscriptionId: string, createNotionPage: (args: {
|
|
43
|
+
page: InferOutput<typeof notionPageDataSchema>;
|
|
44
|
+
dataSource: NotionDataSource | undefined;
|
|
45
|
+
}) => NotionPage): DataSourceQueryView;
|
|
74
46
|
//# sourceMappingURL=hostState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostState.d.ts","sourceRoot":"","sources":["../../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,
|
|
1
|
+
{"version":3,"file":"hostState.d.ts","sourceRoot":"","sources":["../../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,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oEAAoE,CAAA;AAC7H,OAAO,KAAK,EACX,eAAe,EACf,oBAAoB,EACpB,MAAM,gDAAgD,CAAA;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAA;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,EAAE,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