ncblock 0.0.2 → 0.0.4
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 +15 -242
- package/dist/bridge/SandboxBridge.d.ts +64 -0
- package/dist/bridge/SandboxBridge.d.ts.map +1 -0
- package/dist/{notion.js → bridge/SandboxBridge.js} +80 -337
- package/dist/bridge/dataSources/resolve.d.ts +22 -0
- package/dist/bridge/dataSources/resolve.d.ts.map +1 -0
- package/dist/bridge/dataSources/resolve.js +65 -0
- package/dist/bridge/dataSources/resolveProperty.d.ts +36 -0
- package/dist/bridge/dataSources/resolveProperty.d.ts.map +1 -0
- package/dist/bridge/dataSources/resolveProperty.js +67 -0
- package/dist/bridge/hostState.d.ts +57 -0
- package/dist/bridge/hostState.d.ts.map +1 -0
- package/dist/bridge/hostState.js +65 -0
- package/dist/bridge/loadManifest.d.ts +9 -0
- package/dist/bridge/loadManifest.d.ts.map +1 -0
- package/dist/bridge/loadManifest.js +41 -0
- package/dist/bridge/messages/getUser.d.ts +32 -0
- package/dist/bridge/messages/getUser.d.ts.map +1 -0
- package/dist/bridge/messages/getUser.js +24 -0
- package/dist/bridge/messages/hostToSandbox.d.ts +45 -0
- package/dist/bridge/messages/hostToSandbox.d.ts.map +1 -1
- package/dist/bridge/messages/hostToSandbox.js +4 -0
- package/dist/bridge/messages/listUsers.d.ts +40 -0
- package/dist/bridge/messages/listUsers.d.ts.map +1 -0
- package/dist/bridge/messages/listUsers.js +25 -0
- package/dist/bridge/messages/sandboxToHost.d.ts +9 -0
- package/dist/bridge/messages/sandboxToHost.d.ts.map +1 -1
- package/dist/bridge/messages/sandboxToHost.js +4 -0
- package/dist/bridge/sandboxClient.d.ts +46 -0
- package/dist/bridge/sandboxClient.d.ts.map +1 -0
- package/dist/bridge/sandboxClient.js +72 -0
- package/dist/bridge/users/user.d.ts +36 -0
- package/dist/bridge/users/user.d.ts.map +1 -0
- package/dist/bridge/users/user.js +19 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/init.d.ts +44 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +49 -0
- package/dist/react.d.ts +1 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +2 -1
- package/dist/types.d.ts +20 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/users.d.ts +15 -0
- package/dist/users.d.ts.map +1 -0
- package/dist/users.js +18 -0
- package/package.json +1 -1
- package/dist/notion.d.ts +0 -113
- package/dist/notion.d.ts.map +0 -1
- package/dist/pages.d.ts +0 -23
- package/dist/pages.d.ts.map +0 -1
- package/dist/pages.js +0 -30
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAChE,YAAY,EACX,sBAAsB,EACtB,gBAAgB,GAChB,MAAM,iCAAiC,CAAA;AACxC,YAAY,EACX,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,GAChC,MAAM,qCAAqC,CAAA;AAC5C,YAAY,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA;AACjF,YAAY,EACX,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,gCAAgC,CAAA;AACvC,YAAY,EACX,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GACjB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACN,2BAA2B,EAC3B,qBAAqB,GACrB,MAAM,qCAAqC,CAAA;AAC5C,YAAY,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAA;AAC7E,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AAmB,EAAE,MAAM,oCAAoC,CAAA;AAC7E,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACrE,YAAY,EACX,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,GAChB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AAC5E,YAAY,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,EAC1B,4BAA4B,EAC5B,uBAAuB,EACvB,0BAA0B,GAC1B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,eAAe,EACf,gBAAgB,GAChB,MAAM,QAAQ,CAAA;AACf,OAAO,EACN,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,wBAAwB,EACxB,QAAQ,GACR,MAAM,SAAS,CAAA;AAChB,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* downstream code.
|
|
9
9
|
*/
|
|
10
10
|
export { NOTION_BUILTIN_PROPERTY_IDS, NOTION_PROPERTY_TYPES, } from "./bridge/dataSources/propertySchema";
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
11
|
+
export { pages } from "./bridge/sandboxClient";
|
|
12
|
+
export { initCustomBlock, NotInIframeError, } from "./init";
|
|
13
13
|
export { NotionCustomBlock, useCustomBlockAutoResize, useCustomBlockContext, useCustomBlockInit, useDataSource, useDataSourceDefinitions, useTheme, } from "./react";
|
|
14
14
|
export * from "./types";
|
|
15
|
+
export { users } from "./users";
|
package/dist/init.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { NotionCustomBlockContext } from "./bridge/context";
|
|
2
|
+
import type { NotionDataSource } from "./bridge/dataSources/dataSource";
|
|
3
|
+
import type { NotionTheme } from "./bridge/theme";
|
|
4
|
+
/**
|
|
5
|
+
* The payload sent by the host in the `init` message in response to the sandbox's `ready` message.
|
|
6
|
+
*/
|
|
7
|
+
export type CustomBlockInitial = {
|
|
8
|
+
theme: NotionTheme;
|
|
9
|
+
context: NotionCustomBlockContext;
|
|
10
|
+
dataSources: NotionDataSource[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Error thrown when the SDK is loaded in a top-level standalone window with no parent frame.
|
|
14
|
+
* `postMessage` would just hit the same window and the handshake can never complete.
|
|
15
|
+
* `<NotionCustomBlock>` catches this specifically and falls back to a standalone preview with a
|
|
16
|
+
* warning banner. Direct callers can `instanceof` it to apply their own policy.
|
|
17
|
+
*/
|
|
18
|
+
export declare class NotInIframeError extends Error {
|
|
19
|
+
constructor(message?: string);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Options for {@link initCustomBlock}.
|
|
23
|
+
*/
|
|
24
|
+
export type InitCustomBlockOptions = {
|
|
25
|
+
/**
|
|
26
|
+
* How long to wait for the host's `init` response before rejecting with an error.
|
|
27
|
+
*
|
|
28
|
+
* @default 2000 - Short enough that a misconfigured embed surfaces quickly, long enough to
|
|
29
|
+
* absorb a real host's worst-case init latency.
|
|
30
|
+
*/
|
|
31
|
+
timeoutMs?: number;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Performs the SDK <-> host handshake: loads `custom_blocks.json`, posts
|
|
35
|
+
* `ready`, then awaits the host's `init` message. Resolves with that payload.
|
|
36
|
+
*
|
|
37
|
+
* Rejects with a `TimeoutError` if the host doesn't respond inside `timeoutMs`.
|
|
38
|
+
*
|
|
39
|
+
* Idempotent: subsequent calls return the same promise as the first and ignore any new options.
|
|
40
|
+
* Mount your React tree (or call any SDK hook / `subscribeToCustomBlockHost`) only after the
|
|
41
|
+
* returned promise resolves.
|
|
42
|
+
*/
|
|
43
|
+
export declare function initCustomBlock(opts?: InitCustomBlockOptions): Promise<CustomBlockInitial>;
|
|
44
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAOvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE,WAAW,CAAA;IAClB,OAAO,EAAE,wBAAwB,CAAA;IACjC,WAAW,EAAE,gBAAgB,EAAE,CAAA;CAC/B,CAAA;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;gBAC9B,OAAO,GAAE,MAA8B;CAInD;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,kBAAkB,CAAC,CA2B7B"}
|
package/dist/init.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { loadManifest } from "./bridge/loadManifest";
|
|
2
|
+
import { awaitCustomBlockInit, getCustomBlockHostState, sendCustomBlockReady, } from "./bridge/sandboxClient";
|
|
3
|
+
/**
|
|
4
|
+
* Error thrown when the SDK is loaded in a top-level standalone window with no parent frame.
|
|
5
|
+
* `postMessage` would just hit the same window and the handshake can never complete.
|
|
6
|
+
* `<NotionCustomBlock>` catches this specifically and falls back to a standalone preview with a
|
|
7
|
+
* warning banner. Direct callers can `instanceof` it to apply their own policy.
|
|
8
|
+
*/
|
|
9
|
+
export class NotInIframeError extends Error {
|
|
10
|
+
constructor(message = NOT_IN_IFRAME_MESSAGE) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "NotInIframeError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const DEFAULT_INIT_TIMEOUT_MS = 2000;
|
|
16
|
+
const NOT_IN_IFRAME_MESSAGE = "<NotionCustomBlock> only works inside an iframe — use the dev shell or deploy to Notion.";
|
|
17
|
+
let initPromise;
|
|
18
|
+
/**
|
|
19
|
+
* Performs the SDK <-> host handshake: loads `custom_blocks.json`, posts
|
|
20
|
+
* `ready`, then awaits the host's `init` message. Resolves with that payload.
|
|
21
|
+
*
|
|
22
|
+
* Rejects with a `TimeoutError` if the host doesn't respond inside `timeoutMs`.
|
|
23
|
+
*
|
|
24
|
+
* Idempotent: subsequent calls return the same promise as the first and ignore any new options.
|
|
25
|
+
* Mount your React tree (or call any SDK hook / `subscribeToCustomBlockHost`) only after the
|
|
26
|
+
* returned promise resolves.
|
|
27
|
+
*/
|
|
28
|
+
export function initCustomBlock(opts = {}) {
|
|
29
|
+
initPromise ?? (initPromise = (async () => {
|
|
30
|
+
// Fail fast with a typed error when rendered as a standalone tab and not in a parent frame.
|
|
31
|
+
// Otherwise, it would eventually hit the timeout, since `postMessage` to `window.parent`
|
|
32
|
+
// would just hit the same window and never arrive.
|
|
33
|
+
if (typeof window !== "undefined" && window.parent === window) {
|
|
34
|
+
throw new NotInIframeError();
|
|
35
|
+
}
|
|
36
|
+
// Load the manifest and send it to the host.
|
|
37
|
+
const manifest = await loadManifest();
|
|
38
|
+
sendCustomBlockReady(manifest);
|
|
39
|
+
const timeoutMs = opts.timeoutMs ?? DEFAULT_INIT_TIMEOUT_MS;
|
|
40
|
+
const message = await awaitCustomBlockInit(AbortSignal.timeout(timeoutMs));
|
|
41
|
+
const hostState = getCustomBlockHostState();
|
|
42
|
+
return {
|
|
43
|
+
theme: message.theme,
|
|
44
|
+
context: message.context,
|
|
45
|
+
dataSources: hostState.status === "initialized" ? hostState.dataSources : [],
|
|
46
|
+
};
|
|
47
|
+
})());
|
|
48
|
+
return initPromise;
|
|
49
|
+
}
|
package/dist/react.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import type { NotionCustomBlockContext } from "./bridge/context";
|
|
3
3
|
import type { NotionDataSource } from "./bridge/dataSources/dataSource";
|
|
4
4
|
import type { NotionTheme } from "./bridge/theme";
|
|
5
|
-
import { type CustomBlockInitial, type InitCustomBlockOptions } from "./
|
|
5
|
+
import { type CustomBlockInitial, type InitCustomBlockOptions } from "./init";
|
|
6
6
|
import type { UseDataSourceResult } from "./types";
|
|
7
7
|
/**
|
|
8
8
|
* Discriminated state returned by {@link useCustomBlockInit}.
|
package/dist/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../react.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EAKd,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../react.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EAKd,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAUvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EACN,KAAK,kBAAkB,EACvB,KA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EACX,YAAY,GAAE,MAAwC,GACpD,mBAAmB,CAiDrB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,wBAAwB,CACvC,IAAI,GAAE;IACL;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CACZ,GACJ,IAAI,CAmCN"}
|
package/dist/react.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs as _jsxs, Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useState, useSyncExternalStore, } from "react";
|
|
3
|
-
import { getCustomBlockHostState, getDataSourceQueryView,
|
|
3
|
+
import { getCustomBlockHostState, getDataSourceQueryView, postCustomBlockResize, queryCustomBlockDataSource, setMockCustomBlockState, subscribeToCustomBlockHost, } from "./bridge/sandboxClient";
|
|
4
|
+
import { initCustomBlock, NotInIframeError, } from "./init";
|
|
4
5
|
const DEFAULT_DATA_SOURCE_QUERY_LIMIT = 20;
|
|
5
6
|
function useCustomBlockHost() {
|
|
6
7
|
return useSyncExternalStore(subscribeToCustomBlockHost, getCustomBlockHostState);
|
package/dist/types.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ import type { NotionPropertySchema } from "./bridge/dataSources/propertySchema";
|
|
|
4
4
|
import type { NotionDataSourceId } from "./bridge/ids";
|
|
5
5
|
import type { NotionCreatePagePosition } from "./bridge/messages/createPage";
|
|
6
6
|
import type { NotionPage, NotionPageCover, NotionPageIcon, NotionPageId, NotionPagePropertyInputMap, NotionPagePropertyWriteMap } from "./bridge/pages/page";
|
|
7
|
+
import type { NotionUser, NotionUserList } from "./bridge/users/user";
|
|
7
8
|
export type { NotionDataSourceId, NotionSpaceId } from "./bridge/ids";
|
|
8
9
|
export type { NotionPageId } from "./bridge/pages/page";
|
|
10
|
+
export type { NotionUser, NotionUserId, NotionUserList, } from "./bridge/users/user";
|
|
9
11
|
export type { NotionDataSourcePageUpdateInput, NotionDataSourcePageUpdateResult, };
|
|
10
12
|
/**
|
|
11
13
|
* Return shape of `useDataSource`.
|
|
@@ -121,4 +123,22 @@ export type UpdatePageResult = {
|
|
|
121
123
|
status: "error";
|
|
122
124
|
error: string;
|
|
123
125
|
};
|
|
126
|
+
export type ListUsersInput = {
|
|
127
|
+
startCursor?: string;
|
|
128
|
+
pageSize?: number;
|
|
129
|
+
};
|
|
130
|
+
export type ListUsersResult = {
|
|
131
|
+
status: "success";
|
|
132
|
+
list: NotionUserList;
|
|
133
|
+
} | {
|
|
134
|
+
status: "error";
|
|
135
|
+
error: string;
|
|
136
|
+
};
|
|
137
|
+
export type GetUserResult = {
|
|
138
|
+
status: "success";
|
|
139
|
+
user: NotionUser;
|
|
140
|
+
} | {
|
|
141
|
+
status: "error";
|
|
142
|
+
error: string;
|
|
143
|
+
};
|
|
124
144
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AAC7E,OAAO,KAAK,EACX,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,EAChC,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAC/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AAC5E,OAAO,KAAK,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,0BAA0B,EAC1B,0BAA0B,EAC1B,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AAC7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,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAErC,MAAM,MAAM,cAAc,GAAG;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,eAAe,GACxB;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,cAAc,CAAA;CACnB,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAErC,MAAM,MAAM,aAAa,GACtB;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,UAAU,CAAA;CACf,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
package/dist/users.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GetUserResult, ListUsersInput, ListUsersResult, NotionUserId } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* User-related SDK APIs exposed under `sdk.users.*`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const users: {
|
|
6
|
+
/**
|
|
7
|
+
* Lists users visible in the current custom block workspace.
|
|
8
|
+
*/
|
|
9
|
+
list(input?: ListUsersInput): Promise<ListUsersResult>;
|
|
10
|
+
/**
|
|
11
|
+
* Fetches a user by id.
|
|
12
|
+
*/
|
|
13
|
+
get(userId: NotionUserId): Promise<GetUserResult>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=users.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../users.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,EACZ,MAAM,SAAS,CAAA;AAEhB;;GAEG;AACH,eAAO,MAAM,KAAK;IACjB;;OAEG;iBACU,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAItD;;OAEG;gBACS,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;CAGjD,CAAA"}
|
package/dist/users.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getUser, listUsers } from "./bridge/sandboxClient";
|
|
2
|
+
/**
|
|
3
|
+
* User-related SDK APIs exposed under `sdk.users.*`.
|
|
4
|
+
*/
|
|
5
|
+
export const users = {
|
|
6
|
+
/**
|
|
7
|
+
* Lists users visible in the current custom block workspace.
|
|
8
|
+
*/
|
|
9
|
+
list(input) {
|
|
10
|
+
return listUsers(input);
|
|
11
|
+
},
|
|
12
|
+
/**
|
|
13
|
+
* Fetches a user by id.
|
|
14
|
+
*/
|
|
15
|
+
get(userId) {
|
|
16
|
+
return getUser(userId);
|
|
17
|
+
},
|
|
18
|
+
};
|
package/package.json
CHANGED
package/dist/notion.d.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import type { NotionCustomBlockContext } from "./bridge/context";
|
|
2
|
-
import type { NotionDataSource } from "./bridge/dataSources/dataSource";
|
|
3
|
-
import type { NotionDataSourcePage, NotionDataSourcePageBridge } from "./bridge/dataSources/dataSourcePage";
|
|
4
|
-
import type { NotionPropertySchema } from "./bridge/dataSources/propertySchema";
|
|
5
|
-
import type { InitMessage } from "./bridge/messages/init";
|
|
6
|
-
import type { NotionTheme } from "./bridge/theme";
|
|
7
|
-
import type { CreatePageInput, CreatePageResult, GetPageResult, NotionPageId, UpdatePageInput, UpdatePageResult } from "./types";
|
|
8
|
-
type DataSourceQueryState = {
|
|
9
|
-
/** Latest pages from the host as parsed from the bridge. `propertiesByKey` is derived lazily. */
|
|
10
|
-
items: NotionDataSourcePageBridge[];
|
|
11
|
-
isLoading: boolean;
|
|
12
|
-
hasMore: boolean;
|
|
13
|
-
error?: string;
|
|
14
|
-
latestRequestId?: string;
|
|
15
|
-
};
|
|
16
|
-
export type CustomBlockHostState = UninitializedHostState | InitializedHostState;
|
|
17
|
-
type UninitializedHostState = {
|
|
18
|
-
status: "uninitialized";
|
|
19
|
-
theme: NotionTheme;
|
|
20
|
-
};
|
|
21
|
-
type InitializedHostState = {
|
|
22
|
-
status: "initialized";
|
|
23
|
-
theme: NotionTheme;
|
|
24
|
-
context: NotionCustomBlockContext;
|
|
25
|
-
dataSources: NotionDataSource[];
|
|
26
|
-
dataSourceState: Record<string, DataSourceQueryState>;
|
|
27
|
-
};
|
|
28
|
-
export declare function subscribeToCustomBlockHost(listener: () => void): () => boolean;
|
|
29
|
-
export declare function getCustomBlockHostState(): CustomBlockHostState;
|
|
30
|
-
export declare function queryCustomBlockDataSource(key: string, limit: number): void;
|
|
31
|
-
/**
|
|
32
|
-
* Apply an `init` payload to the bridge directly, bypassing the postMessage
|
|
33
|
-
* handshake. Used by the React provider when it needs to seed placeholder
|
|
34
|
-
* state (e.g. the standalone preview fallback when not embedded in Notion).
|
|
35
|
-
* The bridge applies the payload through the same code path as a real host.
|
|
36
|
-
*/
|
|
37
|
-
export declare function setMockCustomBlockState(message: InitMessage): void;
|
|
38
|
-
/**
|
|
39
|
-
* Resolved value of {@link initCustomBlock} — the host's first `init` payload.
|
|
40
|
-
* `theme`, `context`, and `dataSources` are live values at the moment of init;
|
|
41
|
-
* subscribe via the React hooks (or `subscribeToCustomBlockHost`) to stay
|
|
42
|
-
* updated as the host pushes `themeChanged` / `contextChanged` /
|
|
43
|
-
* `dataSourcesChanged` messages.
|
|
44
|
-
*/
|
|
45
|
-
export type CustomBlockInitial = {
|
|
46
|
-
theme: NotionTheme;
|
|
47
|
-
context: NotionCustomBlockContext;
|
|
48
|
-
dataSources: NotionDataSource[];
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Thrown by {@link initCustomBlock} when the SDK is loaded in a top-level
|
|
52
|
-
* window (no parent frame) — `postMessage` would just hit the same window and
|
|
53
|
-
* the handshake can never complete. `<NotionCustomBlock>` catches this
|
|
54
|
-
* specifically and falls back to a standalone preview with a warning banner;
|
|
55
|
-
* direct callers can `instanceof` it to apply their own policy.
|
|
56
|
-
*/
|
|
57
|
-
export declare class NotInIframeError extends Error {
|
|
58
|
-
constructor(message?: string);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Options for {@link initCustomBlock}.
|
|
62
|
-
*/
|
|
63
|
-
export type InitCustomBlockOptions = {
|
|
64
|
-
/**
|
|
65
|
-
* How long to wait for the host's `init` response before rejecting with a
|
|
66
|
-
* `TimeoutError` DOMException. Defaults to 2000 ms — short enough that a
|
|
67
|
-
* misconfigured embed surfaces quickly, long enough to absorb a real host's
|
|
68
|
-
* worst-case init latency.
|
|
69
|
-
*/
|
|
70
|
-
timeoutMs?: number;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Performs the SDK ↔ host handshake: loads `custom_blocks.json`, posts
|
|
74
|
-
* `ready`, then awaits the host's first `init` message. Resolves with that
|
|
75
|
-
* payload; rejects with a
|
|
76
|
-
* `TimeoutError` if the host doesn't respond inside `timeoutMs`.
|
|
77
|
-
*
|
|
78
|
-
* Idempotent: subsequent calls return the same promise as the first and
|
|
79
|
-
* ignore any new options. Mount your React tree (or call any SDK hook /
|
|
80
|
-
* `subscribeToCustomBlockHost`) only after the returned promise resolves.
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* // src/index.tsx
|
|
84
|
-
* const initial = await initCustomBlock()
|
|
85
|
-
* console.log(initial.theme, initial.context.customBlockId)
|
|
86
|
-
* ReactDOM.createRoot(root).render(<App />)
|
|
87
|
-
*/
|
|
88
|
-
export declare function initCustomBlock(opts?: InitCustomBlockOptions): Promise<CustomBlockInitial>;
|
|
89
|
-
/**
|
|
90
|
-
* Resolved page + schema views for a single data source, keyed by raw property
|
|
91
|
-
* ID and by user-defined key. Re-derived from `propertyIdsByKey` on every read so
|
|
92
|
-
* renames don't require a re-query.
|
|
93
|
-
*/
|
|
94
|
-
export type DataSourceQueryView = {
|
|
95
|
-
items: NotionDataSourcePage[];
|
|
96
|
-
collectionSchema?: NotionDataSource["collectionSchema"];
|
|
97
|
-
propertySchemasById: {
|
|
98
|
-
[propertyId: string]: NotionPropertySchema;
|
|
99
|
-
};
|
|
100
|
-
propertySchemasByKey: {
|
|
101
|
-
[key: string]: NotionPropertySchema | undefined;
|
|
102
|
-
};
|
|
103
|
-
isLoading: boolean;
|
|
104
|
-
hasMore: boolean;
|
|
105
|
-
error?: string;
|
|
106
|
-
};
|
|
107
|
-
export declare function getDataSourceQueryView(hostState: CustomBlockHostState, key: string): DataSourceQueryView;
|
|
108
|
-
export declare function createPage(input: CreatePageInput): Promise<CreatePageResult>;
|
|
109
|
-
export declare function getPage(pageId: NotionPageId): Promise<GetPageResult>;
|
|
110
|
-
export declare function updatePage(input: UpdatePageInput): Promise<UpdatePageResult>;
|
|
111
|
-
export declare function postCustomBlockResize(height: number): void;
|
|
112
|
-
export {};
|
|
113
|
-
//# sourceMappingURL=notion.d.ts.map
|
package/dist/notion.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notion.d.ts","sourceRoot":"","sources":["../notion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,KAAK,EACX,gBAAgB,EAEhB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EACX,oBAAoB,EACpB,0BAA0B,EAG1B,MAAM,qCAAqC,CAAA;AAE5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAQ/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAYzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EACX,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,MAAM,SAAS,CAAA;AAYhB,KAAK,oBAAoB,GAAG;IAC3B,iGAAiG;IACjG,KAAK,EAAE,0BAA0B,E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GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAuB7B;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,oBAAoB,EAAE,CAAA;IAC7B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;IACvD,mBAAmB,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAE,CAAA;IACnE,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,MAAM,CAAA;CACd,CAAA;AAUD,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,oBAAoB,EAC/B,GAAG,EAAE,MAAM,GACT,mBAAmB,CA8DrB;AA6BD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAE5E;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAEpE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAE5E;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,QAEnD"}
|
package/dist/pages.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { CreatePageInput, CreatePageResult, GetPageResult, NotionPageId, UpdatePageInput, UpdatePageResult } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Page-related SDK APIs exposed under `sdk.pages.*`.
|
|
4
|
-
*/
|
|
5
|
-
export declare const pages: {
|
|
6
|
-
/**
|
|
7
|
-
* Creates a new Notion page.
|
|
8
|
-
*/
|
|
9
|
-
create(input: CreatePageInput): Promise<CreatePageResult>;
|
|
10
|
-
/**
|
|
11
|
-
* Fetches a page by id.
|
|
12
|
-
*/
|
|
13
|
-
get(pageId: NotionPageId): Promise<GetPageResult>;
|
|
14
|
-
/**
|
|
15
|
-
* Updates an existing page.
|
|
16
|
-
*/
|
|
17
|
-
update(input: UpdatePageInput): Promise<UpdatePageResult>;
|
|
18
|
-
/**
|
|
19
|
-
* Soft-delete a page by archiving it.
|
|
20
|
-
*/
|
|
21
|
-
delete(pageId: NotionPageId): Promise<UpdatePageResult>;
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=pages.d.ts.map
|
package/dist/pages.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../pages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,MAAM,SAAS,CAAA;AAEhB;;GAEG;AACH,eAAO,MAAM,KAAK;IACjB;;OAEG;kBACW,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIzD;;OAEG;gBACS,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAIjD;;OAEG;kBACW,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIzD;;OAEG;mBACY,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAGvD,CAAA"}
|
package/dist/pages.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { createPage, getPage, updatePage } from "./notion";
|
|
2
|
-
/**
|
|
3
|
-
* Page-related SDK APIs exposed under `sdk.pages.*`.
|
|
4
|
-
*/
|
|
5
|
-
export const pages = {
|
|
6
|
-
/**
|
|
7
|
-
* Creates a new Notion page.
|
|
8
|
-
*/
|
|
9
|
-
create(input) {
|
|
10
|
-
return createPage(input);
|
|
11
|
-
},
|
|
12
|
-
/**
|
|
13
|
-
* Fetches a page by id.
|
|
14
|
-
*/
|
|
15
|
-
get(pageId) {
|
|
16
|
-
return getPage(pageId);
|
|
17
|
-
},
|
|
18
|
-
/**
|
|
19
|
-
* Updates an existing page.
|
|
20
|
-
*/
|
|
21
|
-
update(input) {
|
|
22
|
-
return updatePage(input);
|
|
23
|
-
},
|
|
24
|
-
/**
|
|
25
|
-
* Soft-delete a page by archiving it.
|
|
26
|
-
*/
|
|
27
|
-
delete(pageId) {
|
|
28
|
-
return updatePage({ pageId, archived: true });
|
|
29
|
-
},
|
|
30
|
-
};
|