ncblock 0.0.2 → 0.0.3
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 +12 -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/README.md
CHANGED
|
@@ -34,251 +34,21 @@ export function App() {
|
|
|
34
34
|
|
|
35
35
|
`<NotionCustomBlock>` runs the SDK ↔ host handshake (sends `ready` with the manifest, awaits `init`) and only mounts `children` once it resolves. Inside the wrapper, every hook returns non-nullable values — there's no separate gating component to write. It also runs `useCustomBlockAutoResize` for you by default; pass `autoResize={false}` to opt out.
|
|
36
36
|
|
|
37
|
-
##
|
|
37
|
+
## Reference
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
API surface, one page per category. Hover docs in your editor cover the per-field detail; these pages cover usage shape and the gotchas.
|
|
40
40
|
|
|
41
|
-
`
|
|
41
|
+
- [`docs/lifecycle.md`](./docs/lifecycle.md) — `<NotionCustomBlock>`, `useCustomBlockInit`, `initCustomBlock`, `NotInIframeError`, `useCustomBlockAutoResize`. The handshake, the React wrapper, sizing.
|
|
42
|
+
- [`docs/context.md`](./docs/context.md) — `useCustomBlockContext`, `useTheme`. Where the block sits in the document tree and the host's color scheme.
|
|
43
|
+
- [`docs/data-sources.md`](./docs/data-sources.md) — `useDataSource`, `useDataSourceDefinitions`, the row, property, and date-value types, plus a worked example.
|
|
44
|
+
- [`docs/pages.md`](./docs/pages.md) — `pages.create / get / update / delete`, parent variants (including the recommended `data_source_key`), property input shapes.
|
|
45
|
+
- [`docs/users.md`](./docs/users.md) — `users.list / get`, the `NotionUser` shape, paging.
|
|
46
|
+
- [`docs/manifest.md`](./docs/manifest.md) — `custom_blocks.json`, the Vite plugin, manifest types.
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
- In a top-level browser tab (no parent frame), rejects with `NotInIframeError`. `<NotionCustomBlock>` catches this, seeds placeholders, and renders `children` behind a warning banner so dev-time previews still work.
|
|
45
|
-
- After init, `themeChanged`, `contextChanged`, and `dataSourcesChanged` push updates and the relevant hooks re-render.
|
|
46
|
-
- `initCustomBlock` is idempotent; subsequent calls return the same promise.
|
|
48
|
+
## Forbidden APIs
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
No top-level navigation, `window.open`, or auth redirects. No direct network requests — cross-origin work goes through the host (and is exposed via SDK hooks).
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
## Bridge protocol
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
- Prefer container queries (`@container`) over viewport queries.
|
|
54
|
-
|
|
55
|
-
### Data sources
|
|
56
|
-
|
|
57
|
-
A custom block is wired to one or more "data sources" — semantic keys (e.g. `people`, `default`) that map to Notion collections. Read through `useDataSource(key)` and key off the semantic name; never reach into `collectionPointer` / `propertyIdsByKey` directly.
|
|
58
|
-
|
|
59
|
-
Each row is a `NotionDataSourcePage` of the form `{ id, propertiesById, propertiesByKey, update }`. Read via `propertiesByKey[key]` (semantic) or `propertiesById[propertyId]` (raw). Call `update(input)` to write back through the same data-source mapping; `NotionDataSourcePageUpdateInput` and `NotionDataSourcePageUpdateResult` describe that helper. The four built-ins (`created_time`, `last_edited_time`, `created_by`, `last_edited_by`) are always present in `propertiesById` and `collectionSchema.propertiesById`.
|
|
60
|
-
|
|
61
|
-
### Manifest
|
|
62
|
-
|
|
63
|
-
A custom view declares its required data sources in `custom_blocks.json` at the project root:
|
|
64
|
-
|
|
65
|
-
```json
|
|
66
|
-
{
|
|
67
|
-
"version": 1,
|
|
68
|
-
"dataSources": {
|
|
69
|
-
"tasks": {
|
|
70
|
-
"name": "Tasks",
|
|
71
|
-
"description": "The collection of tasks to render",
|
|
72
|
-
"properties": {
|
|
73
|
-
"title": { "name": "Title", "type": "title" },
|
|
74
|
-
"dueDate": { "name": "Due date", "type": "date" }
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
`initCustomBlock()` fetches `custom_blocks.json` and forwards it with `ready`. The `notionCustomBlock()` Vite plugin from `ncblock/vite` serves it in dev and emits it into `dist/` on build. If the file is missing or invalid, the SDK sends `manifest: null`.
|
|
82
|
-
|
|
83
|
-
### Forbidden APIs
|
|
84
|
-
|
|
85
|
-
No top-level navigation, `window.open`, or auth redirects. Cross-origin work goes through the host (and is exposed via SDK hooks).
|
|
86
|
-
|
|
87
|
-
## Hook reference
|
|
88
|
-
|
|
89
|
-
All hooks assume `initCustomBlock()` has resolved — they throw if called before that. Inside `<NotionCustomBlock>` (or past the `isLoaded` gate of `useCustomBlockInit`), single-value hooks return non-nullable values.
|
|
90
|
-
|
|
91
|
-
### `<NotionCustomBlock>`
|
|
92
|
-
|
|
93
|
-
```ts
|
|
94
|
-
type NotionCustomBlockProps = InitCustomBlockOptions & {
|
|
95
|
-
children: ReactNode;
|
|
96
|
-
fallback?: ReactNode;
|
|
97
|
-
errorFallback?: ReactNode | ((error: Error) => ReactNode);
|
|
98
|
-
autoResize?: boolean; // defaults to true
|
|
99
|
-
};
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Top-level wrapper. Runs the handshake, gates `children`, and (by default) drives auto-resize. `fallback` replaces the loading view (default `null`); `errorFallback` replaces the inline `<p role="alert">` shown if init rejects. `timeoutMs` flows through to `initCustomBlock`. Pass `autoResize={false}` for full-bleed views or to call `useCustomBlockAutoResize` yourself.
|
|
103
|
-
|
|
104
|
-
### `useCustomBlockInit(opts?)`
|
|
105
|
-
|
|
106
|
-
```ts
|
|
107
|
-
function useCustomBlockInit(opts?: InitCustomBlockOptions): UseCustomBlockInitResult;
|
|
108
|
-
|
|
109
|
-
type UseCustomBlockInitResult =
|
|
110
|
-
| { isLoaded: false; error: undefined }
|
|
111
|
-
| { isLoaded: false; error: Error }
|
|
112
|
-
| { isLoaded: true; error: undefined; initial: CustomBlockInitial };
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
React wrapper around `initCustomBlock` for templates that prefer not to use top-level `await`. Multiple components calling it share the same handshake.
|
|
116
|
-
|
|
117
|
-
```tsx
|
|
118
|
-
function Root() {
|
|
119
|
-
const init = useCustomBlockInit();
|
|
120
|
-
if (init.error) return <p role="alert">Init failed: {init.error.message}</p>;
|
|
121
|
-
if (!init.isLoaded) return null;
|
|
122
|
-
return <App />;
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### `useCustomBlockContext()`
|
|
127
|
-
|
|
128
|
-
```ts
|
|
129
|
-
function useCustomBlockContext(): NotionCustomBlockContext;
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Returns `{ customBlockId, parent: { id, type }, page: { id, type } }`. Re-renders on `contextChanged` (e.g. the block moves containers).
|
|
133
|
-
|
|
134
|
-
### `useTheme()`
|
|
135
|
-
|
|
136
|
-
```ts
|
|
137
|
-
function useTheme(): NotionTheme; // "light" | "dark"
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Re-renders on every `themeChanged` message.
|
|
141
|
-
|
|
142
|
-
### `useDataSourceDefinitions()`
|
|
143
|
-
|
|
144
|
-
```ts
|
|
145
|
-
function useDataSourceDefinitions(): NotionDataSource[];
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Resolved data-source definitions (semantic key plus `collectionPointer`, `collectionSchema`, `propertyIdsByKey`, derived `propertySchemasById`). Most templates use `useDataSource` instead — reach for this hook only when rendering the configuration itself (debug panels, schema-driven UIs).
|
|
149
|
-
|
|
150
|
-
### `useDataSource(key, initialLimit?)`
|
|
151
|
-
|
|
152
|
-
```ts
|
|
153
|
-
function useDataSource(key: string, initialLimit?: number): UseDataSourceResult;
|
|
154
|
-
|
|
155
|
-
type UseDataSourceResult = {
|
|
156
|
-
items: NotionDataSourcePage[];
|
|
157
|
-
collectionSchema?: NotionCollectionSchema;
|
|
158
|
-
propertySchemasById: { [propertyId: string]: NotionPropertySchema };
|
|
159
|
-
propertySchemasByKey: { [key: string]: NotionPropertySchema | undefined };
|
|
160
|
-
isLoading: boolean;
|
|
161
|
-
hasMore: boolean;
|
|
162
|
-
fetchMore: () => void;
|
|
163
|
-
error?: string;
|
|
164
|
-
};
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
Reads the data source mapped to `key`. `initialLimit` defaults to 20. `fetchMore()` re-requests a larger prefix (no cursors yet); page growth tracks `initialLimit`, so pass a larger value to opt into bigger batches. `propertySchemasByKey` is `undefined` for declared-but-unbound slots. The hook resets to `initialLimit` when the underlying definition changes.
|
|
168
|
-
|
|
169
|
-
### `useCustomBlockAutoResize({ enabled? })`
|
|
170
|
-
|
|
171
|
-
```ts
|
|
172
|
-
function useCustomBlockAutoResize(args?: { enabled?: boolean }): void;
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
Measures `#root` with `Math.ceil(scrollHeight)` and posts `resize` messages, deduping unchanged values. `<NotionCustomBlock>` runs this for you — only call it directly when you want to drive `enabled` yourself (e.g. a debug toggle), and pair with `autoResize={false}` so it doesn't run twice.
|
|
176
|
-
|
|
177
|
-
```tsx
|
|
178
|
-
<NotionCustomBlock autoResize={false}>
|
|
179
|
-
<App />
|
|
180
|
-
</NotionCustomBlock>;
|
|
181
|
-
|
|
182
|
-
function App() {
|
|
183
|
-
const [enabled, setEnabled] = useState(true);
|
|
184
|
-
useCustomBlockAutoResize({ enabled });
|
|
185
|
-
return <div>…</div>;
|
|
186
|
-
}
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Example: querying a data source
|
|
190
|
-
|
|
191
|
-
A typical data-driven view picks a key, calls `useDataSource`, schema-checks the rows, and surfaces a setup hint when the mapped collection is missing the expected fields. Trimmed from `templates/radar-chart`:
|
|
192
|
-
|
|
193
|
-
```tsx
|
|
194
|
-
import {
|
|
195
|
-
type NotionDataSourcePage,
|
|
196
|
-
useDataSource,
|
|
197
|
-
} from "ncblock";
|
|
198
|
-
|
|
199
|
-
const KEY = "people";
|
|
200
|
-
|
|
201
|
-
function isComplete(item: NotionDataSourcePage): boolean {
|
|
202
|
-
return (
|
|
203
|
-
typeof item.propertiesByKey.name === "string" &&
|
|
204
|
-
typeof item.propertiesByKey.score === "number" &&
|
|
205
|
-
Number.isFinite(item.propertiesByKey.score)
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export function ScoreList() {
|
|
210
|
-
const { items, isLoading, hasMore, fetchMore, error } = useDataSource(KEY);
|
|
211
|
-
|
|
212
|
-
if (error) return <div role="alert">Couldn't load: {error}</div>;
|
|
213
|
-
if (isLoading && items.length === 0) return <div>Loading…</div>;
|
|
214
|
-
|
|
215
|
-
const ready = items.filter(isComplete);
|
|
216
|
-
if (ready.length === 0) {
|
|
217
|
-
return (
|
|
218
|
-
<div>
|
|
219
|
-
Map a data source with key <code>{KEY}</code> exposing{" "}
|
|
220
|
-
<code>name</code> (text) and <code>score</code> (number).
|
|
221
|
-
</div>
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return (
|
|
226
|
-
<div>
|
|
227
|
-
<ul>
|
|
228
|
-
{ready.map((item) => (
|
|
229
|
-
<li key={item.id}>
|
|
230
|
-
{String(item.propertiesByKey.name)} —{" "}
|
|
231
|
-
{Number(item.propertiesByKey.score)}
|
|
232
|
-
</li>
|
|
233
|
-
))}
|
|
234
|
-
</ul>
|
|
235
|
-
{hasMore ? (
|
|
236
|
-
<button type="button" onClick={fetchMore} disabled={isLoading}>
|
|
237
|
-
{isLoading ? "Loading…" : "Load more"}
|
|
238
|
-
</button>
|
|
239
|
-
) : null}
|
|
240
|
-
</div>
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
## `pages` API
|
|
246
|
-
|
|
247
|
-
```ts
|
|
248
|
-
import { pages } from "ncblock";
|
|
249
|
-
|
|
250
|
-
await pages.create({ parent, properties, icon?, cover?, position? });
|
|
251
|
-
await pages.get(pageId);
|
|
252
|
-
await pages.update({ pageId, properties?, icon?, cover?, archived? });
|
|
253
|
-
await pages.delete(pageId); // soft-delete (archive); thin wrapper around update
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
Mirrors the public Notion API. Each call resolves to either `{ status: "success", page }` or `{ status: "error", error }`.
|
|
257
|
-
|
|
258
|
-
For `pages.create`, `parent` accepts:
|
|
259
|
-
|
|
260
|
-
```ts
|
|
261
|
-
type CreatePageParent =
|
|
262
|
-
| { type: "page_id"; page_id: NotionPageId }
|
|
263
|
-
| { type: "data_source_id"; data_source_id: NotionDataSourceId }
|
|
264
|
-
| { type: "data_source_key"; key: string };
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
`type: "data_source_key"` is the recommended form inside a custom view — pass the semantic key (e.g. `"default"`) and the SDK resolves it before sending the request. Page write inputs use `NotionPagePropertyInputMap`: keys may be raw property IDs or data-source property keys, and each `NotionPagePropertyInputValue` may omit `id` because the SDK fills the final raw ID before sending a bridge message.
|
|
268
|
-
|
|
269
|
-
File upload references aren't enabled for custom blocks yet. For page icons, covers, and file properties, use `external.url` or an existing `file.url`; do not send `{ type: "file_upload", file_upload: { id } }`.
|
|
270
|
-
|
|
271
|
-
## Types reference
|
|
272
|
-
|
|
273
|
-
Re-exported from `ncblock`. Hover docs in your editor cover the per-field detail.
|
|
274
|
-
|
|
275
|
-
- **Init / lifecycle:** `CustomBlockInitial`, `InitCustomBlockOptions`, `UseCustomBlockInitResult`, `NotionCustomBlockProps`.
|
|
276
|
-
- **Context & theme:** `NotionTheme`, `NotionCustomBlockContext`.
|
|
277
|
-
- **Data sources:** `NotionDataSource`, `NotionDataSourcePage`, `NotionDataSourcePageUpdateInput`, `NotionDataSourcePageUpdateResult`, `NotionDataSourceValue`, `NotionCollectionSchema`, `NotionPropertySchema`, `NotionPropertyOption`, `NotionPropertyColor`, `NotionStatusGroup`, `NotionDualProperty`, `UseDataSourceResult`.
|
|
278
|
-
- **Property types:** `NotionPropertyType` / `NOTION_PROPERTY_TYPES` (string-literal union + runtime list), `NotionBuiltinPropertyId` / `NOTION_BUILTIN_PROPERTY_IDS` (the four synthetic IDs).
|
|
279
|
-
- **Manifest:** `CustomBlockManifest`, `ManifestDataSource`, `ManifestProperty`, `ManifestIcon`.
|
|
280
|
-
- **Pages API:** `NotionPage`, `NotionPageCover`, `NotionPageIcon`, `NotionPageParent`, `NotionPagePropertyValue`, `NotionPagePropertyInputValue`, `NotionPagePropertyInputMap`, `NotionPagePropertyWriteMap`, `NotionCreatePagePosition`, `CreatePageInput`, `CreatePageParent`, `CreatePageResult`, `GetPageResult`, `UpdatePageInput`, `UpdatePageResult`.
|
|
281
|
-
- **IDs & pointers:** `NotionRecordPointer`, `NotionPageId`, `NotionDataSourceId`, `NotionSpaceId` (branded strings).
|
|
282
|
-
- **Date/reminder values:** `NotionDate`, `NotionDateRange`, `NotionDateTime`, `NotionDateTimeRange`, `NotionDateValue`, `NotionDateReminder`, `NotionDateTimeReminder`, `NotionTimeReminder`, `NotionNoReminder`.
|
|
283
|
-
|
|
284
|
-
The bridge speaks a versioned `postMessage` protocol (`CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION`, currently `1`). You shouldn't need to read protocol-level details to build a view — see `CLAUDE.md` if you're extending the SDK itself.
|
|
54
|
+
The bridge speaks a versioned `postMessage` protocol (`CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION`, currently `1`). You shouldn't need to read protocol-level details to build a view. If you're extending the SDK itself or implementing a host, see `HOST.md` and the repo-root `CLAUDE.md`.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { CreatePageInput, CreatePageResult, GetPageResult, GetUserResult, ListUsersInput, ListUsersResult, NotionPageId, NotionUserId, UpdatePageInput, UpdatePageResult } from "../types";
|
|
2
|
+
import type { NotionDataSource } from "./dataSources/dataSource";
|
|
3
|
+
import type { NotionDataSourcePageUpdateInput, NotionDataSourcePageUpdateResult } from "./dataSources/dataSourcePage";
|
|
4
|
+
import { type CustomBlockHostState } from "./hostState";
|
|
5
|
+
import type { CustomBlockManifest } from "./manifest";
|
|
6
|
+
import type { InitMessage } from "./messages/init";
|
|
7
|
+
/**
|
|
8
|
+
* Used to ensure that the host and client are using the same version of the bridge protocol. A
|
|
9
|
+
* single host needs to support multiple custom blocks built with different versions of the bridge
|
|
10
|
+
* protocol. Increment this number any time a breaking change is made to the bridge protocol.
|
|
11
|
+
*/
|
|
12
|
+
export declare const CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION = 1;
|
|
13
|
+
export declare class SandboxBridge {
|
|
14
|
+
private hostState;
|
|
15
|
+
private listeners;
|
|
16
|
+
private nextRequestId;
|
|
17
|
+
private readonly pendingCreatePage;
|
|
18
|
+
private readonly pendingGetPage;
|
|
19
|
+
private readonly pendingGetUser;
|
|
20
|
+
private readonly pendingListUsers;
|
|
21
|
+
private readonly pendingUpdatePage;
|
|
22
|
+
private resolveInit;
|
|
23
|
+
private readonly initMessage;
|
|
24
|
+
private manifest;
|
|
25
|
+
constructor();
|
|
26
|
+
awaitInit(signal?: AbortSignal): Promise<InitMessage>;
|
|
27
|
+
sendReady(manifest: CustomBlockManifest | null): void;
|
|
28
|
+
private notify;
|
|
29
|
+
private handleMessage;
|
|
30
|
+
subscribe(listener: () => void): () => boolean;
|
|
31
|
+
getHostState(): CustomBlockHostState;
|
|
32
|
+
/**
|
|
33
|
+
* Apply an `init` payload as if it had arrived from the host. Lets callers
|
|
34
|
+
* seed the bridge directly (e.g. the React provider's standalone preview
|
|
35
|
+
* fallback) without going through `postMessage`. The bridge stays unaware
|
|
36
|
+
* of why it's being seeded.
|
|
37
|
+
*/
|
|
38
|
+
setMockState(message: InitMessage): void;
|
|
39
|
+
private applyInit;
|
|
40
|
+
queryDataSource(key: string, limit: number): void;
|
|
41
|
+
postResize(height: number): void;
|
|
42
|
+
createPage(input: CreatePageInput): Promise<CreatePageResult>;
|
|
43
|
+
getPage(pageId: NotionPageId): Promise<GetPageResult>;
|
|
44
|
+
getUser(userId: NotionUserId): Promise<GetUserResult>;
|
|
45
|
+
listUsers(input?: ListUsersInput): Promise<ListUsersResult>;
|
|
46
|
+
updatePage(input: UpdatePageInput): Promise<UpdatePageResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Updates a page on a known data source, resolving any property keys against the data source's
|
|
49
|
+
* `propertyIdsByKey` before sending the bridge message. Used by the per-row `update` callback
|
|
50
|
+
* returned from {@link getDataSourceQueryView}.
|
|
51
|
+
*/
|
|
52
|
+
updateDataSourcePage(args: {
|
|
53
|
+
dataSource: NotionDataSource;
|
|
54
|
+
pageId: NotionPageId;
|
|
55
|
+
input: NotionDataSourcePageUpdateInput;
|
|
56
|
+
}): Promise<NotionDataSourcePageUpdateResult>;
|
|
57
|
+
/**
|
|
58
|
+
* Translates the public `CreatePageInput["parent"]` into the bridge-native
|
|
59
|
+
* `CreatePageMessageParent`. The `data_source_key` variant is resolved sandbox-side against
|
|
60
|
+
* the data source mapping the host delivered in `init` / `dataSourcesChanged`.
|
|
61
|
+
*/
|
|
62
|
+
private resolveCreatePageParent;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=SandboxBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SandboxBridge.d.ts","sourceRoot":"","sources":["../../bridge/SandboxBridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,MAAM,UAAU,CAAA;AAGjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAA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