@notionhq/custom-blocks 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridge/SandboxBridge.d.ts +3 -3
- package/dist/bridge/SandboxBridge.d.ts.map +1 -1
- package/dist/bridge/SandboxBridge.js +7 -5
- package/dist/bridge/dataSources/resolveProperty.d.ts +2 -1
- package/dist/bridge/dataSources/resolveProperty.d.ts.map +1 -1
- package/dist/bridge/hostState.d.ts +2 -1
- package/dist/bridge/hostState.d.ts.map +1 -1
- package/dist/bridge/sandboxClient.d.ts +1 -0
- package/dist/bridge/sandboxClient.d.ts.map +1 -1
- package/dist/bridge/sandboxClient.js +26 -17
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +1 -0
- package/dist/protocol/dataSources/dataSource.d.ts +12 -12
- package/dist/protocol/dataSources/dataSourcePage.d.ts +1 -52
- package/dist/protocol/dataSources/dataSourcePage.d.ts.map +1 -1
- package/dist/protocol/dataSources/dataSourcePage.js +1 -3
- package/dist/protocol/ids.d.ts +10 -26
- package/dist/protocol/ids.d.ts.map +1 -1
- package/dist/protocol/ids.js +25 -5
- package/dist/protocol/messages/createPage.d.ts +8 -8
- package/dist/protocol/messages/createPageResult.d.ts +5 -5
- package/dist/protocol/messages/currentUserChanged.d.ts +1 -1
- package/dist/protocol/messages/dataSourcesChanged.d.ts +3 -3
- package/dist/protocol/messages/getPage.d.ts +6 -6
- package/dist/protocol/messages/getUser.d.ts +2 -2
- package/dist/protocol/messages/getUser.js +2 -2
- package/dist/protocol/messages/hostToSandbox.d.ts +45 -45
- package/dist/protocol/messages/init.d.ts +14 -14
- package/dist/protocol/messages/listUsers.d.ts +1 -1
- package/dist/protocol/messages/pageChanged.d.ts +5 -5
- package/dist/protocol/messages/parentChanged.d.ts +4 -4
- package/dist/protocol/messages/queryDataSource.d.ts +1 -1
- package/dist/protocol/messages/queryDataSourceResult.d.ts +1 -1
- package/dist/protocol/messages/sandboxToHost.d.ts +8 -8
- package/dist/protocol/messages/updatePage.d.ts +1 -1
- package/dist/protocol/messages/updatePageResult.d.ts +5 -5
- package/dist/protocol/pages/page.d.ts +10 -24
- package/dist/protocol/pages/page.d.ts.map +1 -1
- package/dist/protocol/parent.d.ts +4 -4
- package/dist/protocol/users/user.d.ts +4 -7
- package/dist/protocol/users/user.d.ts.map +1 -1
- package/dist/protocol/users/user.js +2 -1
- package/dist/react/standalonePreview.d.ts.map +1 -1
- package/dist/react/standalonePreview.js +3 -1
- package/dist/types.d.ts +64 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/bridge/SandboxBridge.ts +8 -10
- package/src/bridge/dataSources/resolveProperty.ts +2 -4
- package/src/bridge/hostState.ts +6 -6
- package/src/bridge/sandboxClient.ts +28 -17
- package/src/index.ts +0 -8
- package/src/init.ts +1 -0
- package/src/react/standalonePreview.ts +3 -1
- package/src/types.ts +72 -10
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { NotionDataSource } from "../protocol/dataSources/dataSource.js";
|
|
2
|
-
import type { NotionDataSourcePageUpdateArgs, NotionDataSourcePageUpdateResult } from "../protocol/dataSources/dataSourcePage.js";
|
|
3
2
|
import { type InitMessage } from "../protocol/messages/init.js";
|
|
4
|
-
import type { CreatePageArgs, CreatePageResult, GetPageResult, GetUserResult, ListUsersArgs, ListUsersResult, NotionPageId, NotionUserId, UpdatePageArgs, UpdatePageResult, UseDataSourceOptions } from "../types.js";
|
|
3
|
+
import type { CreatePageArgs, CreatePageResult, GetPageResult, GetUserResult, ListUsersArgs, ListUsersResult, NotionDataSourcePageUpdateArgs, NotionDataSourcePageUpdateResult, NotionPageId, NotionUserId, UpdatePageArgs, UpdatePageResult, UseDataSourceOptions } from "../types.js";
|
|
5
4
|
import { type CustomBlockHostState } from "./hostState.js";
|
|
6
5
|
import type { ManifestLoadResult } from "./loadManifest.js";
|
|
7
6
|
/**
|
|
@@ -29,10 +28,11 @@ export declare class SandboxBridge {
|
|
|
29
28
|
private initializationId;
|
|
30
29
|
private latestDataSourceBindings;
|
|
31
30
|
private isMockState;
|
|
31
|
+
private isListening;
|
|
32
32
|
private resolveInit;
|
|
33
33
|
private rejectInit;
|
|
34
34
|
private readonly initMessage;
|
|
35
|
-
|
|
35
|
+
startListening(): void;
|
|
36
36
|
private static MAX_LOG_ENTRIES;
|
|
37
37
|
private logMessage;
|
|
38
38
|
getMessageLog(): readonly MessageLogEntry[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxBridge.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/SandboxBridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,gBAAgB,EAEhB,MAAM,4DAA4D,CAAA;
|
|
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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EAAE,WAAW;IAKjC,OAAO,CAAC,SAAS;IA8EjB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB;IAgE/D,OAAO,CAAC,uBAAuB;IAwB/B,UAAU,CAAC,MAAM,EAAE,MAAM;IAazB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA8B3D,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAYrD,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAYrD,SAAS,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,eAAe,CAAC;IAa7D,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA2C3D;;;;OAIG;IACH,oBAAoB,CAAC,IAAI,EAAE;QAC1B,UAAU,EAAE,gBAAgB,CAAA;QAC5B,MAAM,EAAE,YAAY,CAAA;QACpB,cAAc,EAAE,8BAA8B,CAAA;KAC9C,GAAG,OAAO,CAAC,gCAAgC,CAAC;IAuB7C;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;CAkE/B"}
|
|
@@ -30,6 +30,7 @@ export class SandboxBridge {
|
|
|
30
30
|
this.hasReceivedInit = false;
|
|
31
31
|
this.latestDataSourceBindings = {};
|
|
32
32
|
this.isMockState = false;
|
|
33
|
+
this.isListening = false;
|
|
33
34
|
this.initMessage = new Promise((resolve, reject) => {
|
|
34
35
|
this.resolveInit = resolve;
|
|
35
36
|
this.rejectInit = reject;
|
|
@@ -252,12 +253,13 @@ export class SandboxBridge {
|
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
255
|
};
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
window.addEventListener("message", this.handleMessage);
|
|
256
|
+
}
|
|
257
|
+
startListening() {
|
|
258
|
+
if (this.isListening || typeof window === "undefined") {
|
|
259
|
+
return;
|
|
260
260
|
}
|
|
261
|
+
this.isListening = true;
|
|
262
|
+
window.addEventListener("message", this.handleMessage);
|
|
261
263
|
}
|
|
262
264
|
logMessage(direction, data) {
|
|
263
265
|
if (this.messageLog.length >= SandboxBridge.MAX_LOG_ENTRIES) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { NotionDataSource } from "../../protocol/dataSources/dataSource.js";
|
|
2
2
|
import type { CustomBlockPropertyErrorInfo } from "../../protocol/dataSources/errors.js";
|
|
3
|
-
import type {
|
|
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,
|
|
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 {
|
|
3
|
+
import type { NotionDataSourcePageBridge } from "../protocol/dataSources/dataSourcePage.js";
|
|
4
4
|
import type { NotionPropertySchema } from "../protocol/dataSources/propertySchema.js";
|
|
5
5
|
import type { NotionBlockId } from "../protocol/ids.js";
|
|
6
6
|
import type { CustomBlockManifest } from "../protocol/manifest.js";
|
|
@@ -9,6 +9,7 @@ import type { CustomBlockPage, NotionPageId } from "../protocol/pages/page.js";
|
|
|
9
9
|
import type { NotionParent } from "../protocol/parent.js";
|
|
10
10
|
import type { NotionTheme } from "../protocol/theme.js";
|
|
11
11
|
import type { NotionUser } from "../protocol/users/user.js";
|
|
12
|
+
import type { NotionDataSourcePage, NotionDataSourcePageUpdateArgs, NotionDataSourcePageUpdateResult } from "../types.js";
|
|
12
13
|
export type CustomBlockHostState = UninitializedHostState | InitializedHostState;
|
|
13
14
|
export type UninitializedHostState = {
|
|
14
15
|
status: "uninitialized";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostState.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/hostState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAA;AAClG,OAAO,KAAK,
|
|
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;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oEAAoE,CAAA;AAC7H,OAAO,KAAK,EACX,eAAe,EACf,YAAY,EACZ,MAAM,gDAAgD,CAAA;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,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,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"}
|
|
@@ -5,6 +5,7 @@ import type { ManifestLoadResult } from "./loadManifest.js";
|
|
|
5
5
|
import { type MessageLogEntry } from "./SandboxBridge.js";
|
|
6
6
|
export type { MessageLogEntry };
|
|
7
7
|
export declare const customBlockHost: {
|
|
8
|
+
start: () => void;
|
|
8
9
|
sendConnect: (manifestResult: ManifestLoadResult) => void;
|
|
9
10
|
awaitInit: (signal?: AbortSignal) => Promise<void>;
|
|
10
11
|
subscribe: (listener: () => void) => () => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandboxClient.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/sandboxClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAA;AACpF,OAAO,KAAK,EACX,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,aAAa,CAAA;AACpB,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAExB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,oBAAoB,CAAA;AAExE,YAAY,EAAE,eAAe,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"sandboxClient.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/sandboxClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAA;AACpF,OAAO,KAAK,EACX,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,aAAa,CAAA;AACpB,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAExB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,oBAAoB,CAAA;AAExE,YAAY,EAAE,eAAe,EAAE,CAAA;AAW/B,eAAO,MAAM,eAAe;;kCAKG,kBAAkB;yBAI3B,WAAW,KAAG,OAAO,CAAC,IAAI,CAAC;0BAI1B,MAAM,IAAI;oBAIlB,oBAAoB;IAIlC;;;OAGG;4BACqB,WAAW;yBAId,MAAM;CAG3B,CAAA;AAED,eAAO,MAAM,sBAAsB;iBACrB,MAAM,YAAY,oBAAoB;yBAKvC,oBAAoB,OAC1B,MAAM,KACT,mBAAmB;CAKtB,CAAA;AAED,eAAO,MAAM,UAAU;uBACL,SAAS,eAAe,EAAE;0BAIrB,MAAM,IAAI;CAGhC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,KAAK;IACjB;;OAEG;oBACa,cAAc,KAAG,OAAO,CAAC,gBAAgB,CAAC;IAI1D;;OAEG;kBACW,YAAY,KAAG,OAAO,CAAC,aAAa,CAAC;IAInD;;OAEG;oBACa,cAAc,KAAG,OAAO,CAAC,gBAAgB,CAAC;IAI1D;;OAEG;qBACc,YAAY,KAAG,OAAO,CAAC,gBAAgB,CAAC;CAGzD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,KAAK;IACjB;;OAEG;mBACY,aAAa,KAAG,OAAO,CAAC,eAAe,CAAC;IAIvD;;OAEG;kBACW,YAAY,KAAG,OAAO,CAAC,aAAa,CAAC;CAGnD,CAAA"}
|
|
@@ -1,44 +1,53 @@
|
|
|
1
1
|
import { getDataSourceQueryView as getDataSourceQueryViewWithBridge, } from "./hostState.js";
|
|
2
2
|
import { SandboxBridge } from "./SandboxBridge.js";
|
|
3
|
-
|
|
3
|
+
let bridge;
|
|
4
|
+
function getBridge() {
|
|
5
|
+
if (!bridge) {
|
|
6
|
+
bridge = new SandboxBridge();
|
|
7
|
+
}
|
|
8
|
+
return bridge;
|
|
9
|
+
}
|
|
4
10
|
export const customBlockHost = {
|
|
11
|
+
start: () => {
|
|
12
|
+
getBridge().startListening();
|
|
13
|
+
},
|
|
5
14
|
sendConnect: (manifestResult) => {
|
|
6
|
-
|
|
15
|
+
getBridge().sendConnect(manifestResult);
|
|
7
16
|
},
|
|
8
17
|
awaitInit: (signal) => {
|
|
9
|
-
return
|
|
18
|
+
return getBridge().awaitInit(signal);
|
|
10
19
|
},
|
|
11
20
|
subscribe: (listener) => {
|
|
12
|
-
return
|
|
21
|
+
return getBridge().subscribe(listener);
|
|
13
22
|
},
|
|
14
23
|
getState: () => {
|
|
15
|
-
return
|
|
24
|
+
return getBridge().getHostState();
|
|
16
25
|
},
|
|
17
26
|
/**
|
|
18
27
|
* Apply an `init` payload directly, bypassing the postMessage handshake for
|
|
19
28
|
* standalone preview state.
|
|
20
29
|
*/
|
|
21
30
|
setMockState: (message) => {
|
|
22
|
-
|
|
31
|
+
getBridge().setMockState(message);
|
|
23
32
|
},
|
|
24
33
|
postResize: (height) => {
|
|
25
|
-
|
|
34
|
+
getBridge().postResize(height);
|
|
26
35
|
},
|
|
27
36
|
};
|
|
28
37
|
export const customBlockDataSources = {
|
|
29
38
|
query: (key, options) => {
|
|
30
|
-
|
|
39
|
+
getBridge().queryDataSource(key, options);
|
|
31
40
|
},
|
|
32
41
|
getView: (hostState, key) => {
|
|
33
|
-
return getDataSourceQueryViewWithBridge(hostState, key, args =>
|
|
42
|
+
return getDataSourceQueryViewWithBridge(hostState, key, args => getBridge().updateDataSourcePage(args));
|
|
34
43
|
},
|
|
35
44
|
};
|
|
36
45
|
export const messageLog = {
|
|
37
46
|
getSnapshot: () => {
|
|
38
|
-
return
|
|
47
|
+
return getBridge().getMessageLog();
|
|
39
48
|
},
|
|
40
49
|
subscribe: (listener) => {
|
|
41
|
-
return
|
|
50
|
+
return getBridge().subscribeToMessageLog(listener);
|
|
42
51
|
},
|
|
43
52
|
};
|
|
44
53
|
/**
|
|
@@ -49,25 +58,25 @@ export const pages = {
|
|
|
49
58
|
* Creates a new Notion page.
|
|
50
59
|
*/
|
|
51
60
|
create: (input) => {
|
|
52
|
-
return
|
|
61
|
+
return getBridge().createPage(input);
|
|
53
62
|
},
|
|
54
63
|
/**
|
|
55
64
|
* Fetches a page by id.
|
|
56
65
|
*/
|
|
57
66
|
get: (pageId) => {
|
|
58
|
-
return
|
|
67
|
+
return getBridge().getPage(pageId);
|
|
59
68
|
},
|
|
60
69
|
/**
|
|
61
70
|
* Updates an existing page.
|
|
62
71
|
*/
|
|
63
72
|
update: (input) => {
|
|
64
|
-
return
|
|
73
|
+
return getBridge().updatePage(input);
|
|
65
74
|
},
|
|
66
75
|
/**
|
|
67
76
|
* Soft-delete a page by archiving it.
|
|
68
77
|
*/
|
|
69
78
|
delete: (pageId) => {
|
|
70
|
-
return
|
|
79
|
+
return getBridge().updatePage({ pageId, archived: true });
|
|
71
80
|
},
|
|
72
81
|
};
|
|
73
82
|
/**
|
|
@@ -78,12 +87,12 @@ export const users = {
|
|
|
78
87
|
* Lists users visible in the current custom block workspace.
|
|
79
88
|
*/
|
|
80
89
|
list: (input) => {
|
|
81
|
-
return
|
|
90
|
+
return getBridge().listUsers(input);
|
|
82
91
|
},
|
|
83
92
|
/**
|
|
84
93
|
* Fetches a user by id.
|
|
85
94
|
*/
|
|
86
95
|
get: (userId) => {
|
|
87
|
-
return
|
|
96
|
+
return getBridge().getUser(userId);
|
|
88
97
|
},
|
|
89
98
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export type { NotionContrastMode } from "./protocol/contrast.js";
|
|
10
10
|
export type { NotionCollectionSchema, NotionDataSource, } from "./protocol/dataSources/dataSource.js";
|
|
11
|
-
export type { NotionDataSourcePage, NotionDataSourcePageUpdateArgs, NotionDataSourcePageUpdateInput, NotionDataSourcePageUpdateResult, } from "./protocol/dataSources/dataSourcePage.js";
|
|
12
11
|
export type { NotionDataSourceValue } from "./protocol/dataSources/dataSourceValue.js";
|
|
13
12
|
export type { NotionDate, NotionDateRange, NotionDateReminder, NotionDateTime, NotionDateTimeRange, NotionDateTimeReminder, NotionDateValue, NotionNoReminder, NotionTimeReminder, } from "./protocol/dataSources/dateValue.js";
|
|
14
13
|
export type { CustomBlockDataSourceResolutionErrorCode, CustomBlockDataSourceResolutionErrorInfo, CustomBlockPropertyErrorCode, CustomBlockPropertyErrorInfo, } from "./protocol/dataSources/errors.js";
|
|
@@ -27,7 +26,7 @@ export { CustomBlockInitializationError } from "./protocol/messages/init.js";
|
|
|
27
26
|
export type { CustomBlockListUsersErrorCode, CustomBlockListUsersErrorInfo, } from "./protocol/messages/listUsers.js";
|
|
28
27
|
export type { CustomBlockQueryDataSourceErrorCode, CustomBlockQueryDataSourceErrorInfo, } from "./protocol/messages/queryDataSourceResult.js";
|
|
29
28
|
export type { CustomBlockUpdatePageErrorCode, CustomBlockUpdatePageErrorInfo, } from "./protocol/messages/updatePageResult.js";
|
|
30
|
-
export type { NotionPage, NotionPageCover, NotionPageIcon, NotionPageId,
|
|
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";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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,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,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D,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"}
|
package/dist/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/init.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,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAA;AAClG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AACrF,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;AAKhF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC,KAAK,EAAE,WAAW,CAAA;IAClB,YAAY,EAAE,kBAAkB,CAAA;IAChC,OAAO,EAAE,aAAa,CAAA;IACtB,MAAM,EAAE,YAAY,CAAA;IACpB,IAAI,EAAE,eAAe,CAAA;IACrB,WAAW,EAAE,UAAU,CAAA;IACvB,WAAW,EAAE,gB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B,SAAQ,8BAA8B;gBACvD,OAAO,GAAE,MAA8B;IAS3C,IAAI,EAAE,eAAe,CAAA;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AASD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC9B,IAAI,GAAE,sBAA2B,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAMjC"}
|
package/dist/init.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
declare const collectionPointerValidator: v.ObjectSchema<{
|
|
3
|
-
readonly id: v.
|
|
3
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
4
4
|
readonly table: v.StringSchema<undefined>;
|
|
5
|
-
readonly spaceId: v.OptionalSchema<v.
|
|
5
|
+
readonly spaceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>, undefined>;
|
|
6
6
|
}, undefined>;
|
|
7
7
|
export type NotionCollectionPointer = v.InferOutput<typeof collectionPointerValidator>;
|
|
8
8
|
export declare const notionCollectionSchemaValidator: v.ObjectSchema<{
|
|
9
|
-
readonly id: v.OptionalSchema<v.
|
|
9
|
+
readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
|
|
10
10
|
readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
11
11
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
12
12
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -150,12 +150,12 @@ export type NotionCollectionSchema = v.InferOutput<typeof notionCollectionSchema
|
|
|
150
150
|
export declare const notionDataSourceSchema: v.ObjectSchema<{
|
|
151
151
|
readonly key: v.StringSchema<undefined>;
|
|
152
152
|
readonly collectionPointer: v.OptionalSchema<v.ObjectSchema<{
|
|
153
|
-
readonly id: v.
|
|
153
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
154
154
|
readonly table: v.StringSchema<undefined>;
|
|
155
|
-
readonly spaceId: v.OptionalSchema<v.
|
|
155
|
+
readonly spaceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>, undefined>;
|
|
156
156
|
}, undefined>, undefined>;
|
|
157
157
|
readonly collectionSchema: v.OptionalSchema<v.ObjectSchema<{
|
|
158
|
-
readonly id: v.OptionalSchema<v.
|
|
158
|
+
readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
|
|
159
159
|
readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
160
160
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
161
161
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -438,12 +438,12 @@ export declare const notionDataSourceSchema: v.ObjectSchema<{
|
|
|
438
438
|
export type NotionDataSource = v.InferOutput<typeof notionDataSourceSchema>;
|
|
439
439
|
export declare const notionDataSourceBindingSchema: v.ObjectSchema<{
|
|
440
440
|
readonly collectionPointer: v.OptionalSchema<v.ObjectSchema<{
|
|
441
|
-
readonly id: v.
|
|
441
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
442
442
|
readonly table: v.StringSchema<undefined>;
|
|
443
|
-
readonly spaceId: v.OptionalSchema<v.
|
|
443
|
+
readonly spaceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>, undefined>;
|
|
444
444
|
}, undefined>, undefined>;
|
|
445
445
|
readonly collectionSchema: v.OptionalSchema<v.ObjectSchema<{
|
|
446
|
-
readonly id: v.OptionalSchema<v.
|
|
446
|
+
readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
|
|
447
447
|
readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
448
448
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
449
449
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -584,12 +584,12 @@ export declare const notionDataSourceBindingSchema: v.ObjectSchema<{
|
|
|
584
584
|
export type NotionDataSourceBinding = v.InferOutput<typeof notionDataSourceBindingSchema>;
|
|
585
585
|
export declare const notionDataSourceBindingsSchema: v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
586
586
|
readonly collectionPointer: v.OptionalSchema<v.ObjectSchema<{
|
|
587
|
-
readonly id: v.
|
|
587
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
588
588
|
readonly table: v.StringSchema<undefined>;
|
|
589
|
-
readonly spaceId: v.OptionalSchema<v.
|
|
589
|
+
readonly spaceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>, undefined>;
|
|
590
590
|
}, undefined>, undefined>;
|
|
591
591
|
readonly collectionSchema: v.OptionalSchema<v.ObjectSchema<{
|
|
592
|
-
readonly id: v.OptionalSchema<v.
|
|
592
|
+
readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
|
|
593
593
|
readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
594
594
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
595
595
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import type { CustomBlockUpdatePageErrorInfo } from "../messages/updatePageResult.js";
|
|
3
|
-
import type { NotionPage, NotionPageCover, NotionPageIcon, NotionPageId, NotionPagePropertyInputMap } from "../pages/page.js";
|
|
4
|
-
import { type NotionDataSourceValue } from "./dataSourceValue.js";
|
|
5
2
|
/**
|
|
6
3
|
* Bridge shape for a data source page, as parsed from inbound host messages. The host keys
|
|
7
4
|
* properties by raw property ID. The four built-ins (`created_time`, `last_edited_time`,
|
|
8
5
|
* `created_by`, `last_edited_by`) are normally present, possibly with `undefined` values.
|
|
9
|
-
*
|
|
10
|
-
* Internal to the SDK. The consumer-facing shape is {@link NotionDataSourcePage}.
|
|
11
6
|
*/
|
|
12
7
|
export declare const notionDataSourcePageBridgeSchema: v.ObjectSchema<{
|
|
13
|
-
readonly id: v.
|
|
8
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
14
9
|
readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.BooleanSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
15
10
|
readonly type: v.LiteralSchema<"date", undefined>;
|
|
16
11
|
readonly start_date: v.StringSchema<undefined>;
|
|
@@ -75,50 +70,4 @@ export declare const notionDataSourcePageBridgeSchema: v.ObjectSchema<{
|
|
|
75
70
|
}, undefined>;
|
|
76
71
|
/** Internal SDK type for a parsed bridge page. */
|
|
77
72
|
export type NotionDataSourcePageBridge = v.InferOutput<typeof notionDataSourcePageBridgeSchema>;
|
|
78
|
-
export type NotionDataSourcePageUpdateArgs = {
|
|
79
|
-
properties?: NotionPagePropertyInputMap;
|
|
80
|
-
icon?: NotionPageIcon;
|
|
81
|
-
cover?: NotionPageCover;
|
|
82
|
-
archived?: boolean;
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* @deprecated Use `NotionDataSourcePageUpdateArgs` instead.
|
|
86
|
-
*
|
|
87
|
-
* TODO(custom-blocks): Remove this alias when bumping the SDK version to 0.2.0.
|
|
88
|
-
*/
|
|
89
|
-
export type NotionDataSourcePageUpdateInput = NotionDataSourcePageUpdateArgs;
|
|
90
|
-
export type NotionDataSourcePageUpdateResult = {
|
|
91
|
-
status: "success";
|
|
92
|
-
page: NotionPage;
|
|
93
|
-
} | {
|
|
94
|
-
status: "error";
|
|
95
|
-
error: CustomBlockUpdatePageErrorInfo;
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Consumer-facing page shape returned from {@link useDataSource}. Derived from the bridge payload
|
|
99
|
-
* plus the data source's `propertyIdsByKey`.
|
|
100
|
-
*/
|
|
101
|
-
export type NotionDataSourcePage = {
|
|
102
|
-
id: NotionPageId;
|
|
103
|
-
/**
|
|
104
|
-
* Keyed mapping of raw property IDs to their value. Includes all properties on the data source,
|
|
105
|
-
* including the four built-ins (`created_time`, `last_edited_time`, `created_by`,
|
|
106
|
-
* `last_edited_by`).
|
|
107
|
-
*/
|
|
108
|
-
propertiesById: {
|
|
109
|
-
[propertyId: string]: NotionDataSourceValue | undefined;
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* Keyed mapping of user-defined keys to their value. Only includes properties that are mapped
|
|
113
|
-
* to a raw property ID in the data source's `propertyIdsByKey`.
|
|
114
|
-
*/
|
|
115
|
-
propertiesByKey: {
|
|
116
|
-
[key: string]: NotionDataSourceValue | undefined;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Updates this page using the data source's property-key bindings. The SDK resolves property
|
|
120
|
-
* keys to raw property IDs before sending the bridge message to the host.
|
|
121
|
-
*/
|
|
122
|
-
update: (args: NotionDataSourcePageUpdateArgs) => Promise<NotionDataSourcePageUpdateResult>;
|
|
123
|
-
};
|
|
124
73
|
//# sourceMappingURL=dataSourcePage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataSourcePage.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/protocol/src/dataSources/dataSourcePage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;
|
|
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
|
|
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,
|
package/dist/protocol/ids.d.ts
CHANGED
|
@@ -1,48 +1,32 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
declare const notionDataSourceIdBrand: unique symbol;
|
|
3
|
-
declare const notionBlockIdBrand: unique symbol;
|
|
4
|
-
declare const notionPageIdBrand: unique symbol;
|
|
5
|
-
declare const notionAgentIdBrand: unique symbol;
|
|
6
|
-
declare const notionSpaceIdBrand: unique symbol;
|
|
7
2
|
/**
|
|
8
3
|
* Branded Notion block ID. Host payloads and SDK APIs use plain strings at runtime,
|
|
9
4
|
* but the brand keeps block IDs from being accidentally mixed with other IDs in TypeScript.
|
|
10
5
|
*/
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
export declare const notionBlockIdSchema: v.CustomSchema<NotionBlockId, v.ErrorMessage<v.CustomIssue> | undefined>;
|
|
6
|
+
export declare const notionBlockIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
7
|
+
export type NotionBlockId = v.InferOutput<typeof notionBlockIdSchema>;
|
|
15
8
|
/**
|
|
16
9
|
* Branded Notion data source ID. Host payloads and SDK APIs use plain strings at runtime,
|
|
17
10
|
* but the brand keeps data source IDs from being accidentally mixed with other IDs in TypeScript.
|
|
18
11
|
*/
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
export declare const notionDataSourceIdSchema: v.CustomSchema<NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
|
|
12
|
+
export declare const notionDataSourceIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
13
|
+
export type NotionDataSourceId = v.InferOutput<typeof notionDataSourceIdSchema>;
|
|
23
14
|
/**
|
|
24
15
|
* Branded Notion page ID. Host payloads and SDK APIs use plain strings at runtime,
|
|
25
16
|
* but the brand keeps page IDs from being accidentally mixed with other IDs in TypeScript.
|
|
26
17
|
*/
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
export declare const notionPageIdSchema: v.CustomSchema<NotionPageId, v.ErrorMessage<v.CustomIssue> | undefined>;
|
|
18
|
+
export declare const notionPageIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
19
|
+
export type NotionPageId = v.InferOutput<typeof notionPageIdSchema>;
|
|
31
20
|
/**
|
|
32
21
|
* Branded Notion agent ID. Agent parents identify the workflow that owns an
|
|
33
22
|
* instruction page or one of its blocks.
|
|
34
23
|
*/
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
export declare const notionAgentIdSchema: v.CustomSchema<NotionAgentId, v.ErrorMessage<v.CustomIssue> | undefined>;
|
|
24
|
+
export declare const notionAgentIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
25
|
+
export type NotionAgentId = v.InferOutput<typeof notionAgentIdSchema>;
|
|
39
26
|
/**
|
|
40
27
|
* Branded Notion workspace/space ID. Host payloads and SDK APIs use plain strings at runtime,
|
|
41
28
|
* but the brand keeps space IDs from being accidentally mixed with other IDs in TypeScript.
|
|
42
29
|
*/
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
};
|
|
46
|
-
export declare const notionSpaceIdSchema: v.CustomSchema<NotionSpaceId, v.ErrorMessage<v.CustomIssue> | undefined>;
|
|
47
|
-
export {};
|
|
30
|
+
export declare const notionSpaceIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>;
|
|
31
|
+
export type NotionSpaceId = v.InferOutput<typeof notionSpaceIdSchema>;
|
|
48
32
|
//# sourceMappingURL=ids.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/protocol/src/ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B
|
|
1
|
+
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/protocol/src/ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;GAGG;AACH,eAAO,MAAM,mBAAmB,gGAA+C,CAAA;AAC/E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAErE;;;GAGG;AACH,eAAO,MAAM,wBAAwB,qGAGpC,CAAA;AACD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAE/E;;;GAGG;AACH,eAAO,MAAM,kBAAkB,+FAA8C,CAAA;AAC7E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEnE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,gGAA+C,CAAA;AAC/E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAErE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,gGAA+C,CAAA;AAC/E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
|
package/dist/protocol/ids.js
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const
|
|
2
|
+
/**
|
|
3
|
+
* Branded Notion block ID. Host payloads and SDK APIs use plain strings at runtime,
|
|
4
|
+
* but the brand keeps block IDs from being accidentally mixed with other IDs in TypeScript.
|
|
5
|
+
*/
|
|
6
|
+
export const notionBlockIdSchema = v.pipe(v.string(), v.brand("NotionBlockId"));
|
|
7
|
+
/**
|
|
8
|
+
* Branded Notion data source ID. Host payloads and SDK APIs use plain strings at runtime,
|
|
9
|
+
* but the brand keeps data source IDs from being accidentally mixed with other IDs in TypeScript.
|
|
10
|
+
*/
|
|
11
|
+
export const notionDataSourceIdSchema = v.pipe(v.string(), v.brand("NotionDataSourceId"));
|
|
12
|
+
/**
|
|
13
|
+
* Branded Notion page ID. Host payloads and SDK APIs use plain strings at runtime,
|
|
14
|
+
* but the brand keeps page IDs from being accidentally mixed with other IDs in TypeScript.
|
|
15
|
+
*/
|
|
16
|
+
export const notionPageIdSchema = v.pipe(v.string(), v.brand("NotionPageId"));
|
|
17
|
+
/**
|
|
18
|
+
* Branded Notion agent ID. Agent parents identify the workflow that owns an
|
|
19
|
+
* instruction page or one of its blocks.
|
|
20
|
+
*/
|
|
21
|
+
export const notionAgentIdSchema = v.pipe(v.string(), v.brand("NotionAgentId"));
|
|
22
|
+
/**
|
|
23
|
+
* Branded Notion workspace/space ID. Host payloads and SDK APIs use plain strings at runtime,
|
|
24
|
+
* but the brand keeps space IDs from being accidentally mixed with other IDs in TypeScript.
|
|
25
|
+
*/
|
|
26
|
+
export const notionSpaceIdSchema = v.pipe(v.string(), v.brand("NotionSpaceId"));
|
|
@@ -13,10 +13,10 @@ export declare const notionCreatePagePositionSchema: v.VariantSchema<"type", [v.
|
|
|
13
13
|
readonly type: v.LiteralSchema<"end", undefined>;
|
|
14
14
|
}, undefined>, v.ObjectSchema<{
|
|
15
15
|
readonly type: v.LiteralSchema<"before", undefined>;
|
|
16
|
-
readonly blockId: v.
|
|
16
|
+
readonly blockId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
17
17
|
}, undefined>, v.ObjectSchema<{
|
|
18
18
|
readonly type: v.LiteralSchema<"after", undefined>;
|
|
19
|
-
readonly blockId: v.
|
|
19
|
+
readonly blockId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
20
20
|
}, undefined>], undefined>;
|
|
21
21
|
export type NotionCreatePagePosition = v.InferOutput<typeof notionCreatePagePositionSchema>;
|
|
22
22
|
/**
|
|
@@ -30,10 +30,10 @@ export type NotionCreatePagePosition = v.InferOutput<typeof notionCreatePagePosi
|
|
|
30
30
|
*/
|
|
31
31
|
export declare const createPageParentSchema: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
32
32
|
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
33
|
-
readonly page_id: v.
|
|
33
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
34
34
|
}, undefined>, v.ObjectSchema<{
|
|
35
35
|
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
36
|
-
readonly data_source_id: v.
|
|
36
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
37
37
|
}, undefined>], undefined>;
|
|
38
38
|
export type CreatePageMessageParent = v.InferOutput<typeof createPageParentSchema>;
|
|
39
39
|
/**
|
|
@@ -45,10 +45,10 @@ export declare const createPageMessageSchema: v.ObjectSchema<{
|
|
|
45
45
|
readonly requestId: v.StringSchema<undefined>;
|
|
46
46
|
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
47
47
|
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
48
|
-
readonly page_id: v.
|
|
48
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
49
49
|
}, undefined>, v.ObjectSchema<{
|
|
50
50
|
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
51
|
-
readonly data_source_id: v.
|
|
51
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
52
52
|
}, undefined>], undefined>;
|
|
53
53
|
readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
54
54
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
@@ -181,10 +181,10 @@ export declare const createPageMessageSchema: v.ObjectSchema<{
|
|
|
181
181
|
readonly type: v.LiteralSchema<"end", undefined>;
|
|
182
182
|
}, undefined>, v.ObjectSchema<{
|
|
183
183
|
readonly type: v.LiteralSchema<"before", undefined>;
|
|
184
|
-
readonly blockId: v.
|
|
184
|
+
readonly blockId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
185
185
|
}, undefined>, v.ObjectSchema<{
|
|
186
186
|
readonly type: v.LiteralSchema<"after", undefined>;
|
|
187
|
-
readonly blockId: v.
|
|
187
|
+
readonly blockId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
188
188
|
}, undefined>], undefined>, undefined>;
|
|
189
189
|
}, undefined>;
|
|
190
190
|
export type CreatePageMessage = v.InferOutput<typeof createPageMessageSchema>;
|