@book.dev/sdk 1.65.1 → 1.67.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/dist/authors.d.ts +31 -0
- package/dist/authors.js +49 -19
- package/dist/authors.js.map +1 -1
- package/dist/backup.d.ts +5 -3
- package/dist/backup.js +11 -3
- package/dist/backup.js.map +1 -1
- package/dist/client.d.ts +149 -0
- package/dist/client.js +351 -21
- package/dist/client.js.map +1 -1
- package/dist/forwarding/tunnelClient.js +9 -0
- package/dist/forwarding/tunnelClient.js.map +1 -1
- package/dist/identity.d.ts +27 -0
- package/dist/identity.js +36 -0
- package/dist/identity.js.map +1 -1
- package/dist/import.d.ts +265 -0
- package/dist/import.js +313 -0
- package/dist/import.js.map +1 -0
- package/dist/importAssets.d.ts +167 -0
- package/dist/importAssets.js +332 -0
- package/dist/importAssets.js.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/markdownImport.d.ts +79 -0
- package/dist/markdownImport.js +348 -0
- package/dist/markdownImport.js.map +1 -0
- package/dist/notionImport.d.ts +58 -0
- package/dist/notionImport.js +539 -0
- package/dist/notionImport.js.map +1 -0
- package/dist/routes.d.ts +47 -0
- package/dist/routes.js +48 -0
- package/dist/routes.js.map +1 -1
- package/package.json +11 -5
package/dist/identity.d.ts
CHANGED
|
@@ -60,6 +60,33 @@ export declare function guestPrincipal(name?: string): Principal;
|
|
|
60
60
|
export declare function localPrincipal(name?: string): Principal;
|
|
61
61
|
/** Stable short id for a principal — the value embedded in CRDT edit origins. */
|
|
62
62
|
export declare function principalId(p: Principal): string;
|
|
63
|
+
/**
|
|
64
|
+
* The principal's subject ONLY when it is a cryptographically-verified (`jws`)
|
|
65
|
+
* identity, else `''`. This is the subject that may be stamped as a block's
|
|
66
|
+
* *verified* author (OB-170): guest/local/unverified writers carry no verified
|
|
67
|
+
* attribution, so their edits honestly leave a block un-attributed rather than
|
|
68
|
+
* recording a spoofable or process-local identity. Used on every server write path
|
|
69
|
+
* that stamps per-block authorship (the durable snapshot save + Collab T9's
|
|
70
|
+
* server-authoritative persist).
|
|
71
|
+
*/
|
|
72
|
+
export declare function verifiedSubject(p: Principal | null | undefined): string;
|
|
73
|
+
/**
|
|
74
|
+
* The fixed palette presence/awareness cursors are tinted from (Collab T4). A
|
|
75
|
+
* small, high-contrast set so a handful of simultaneous collaborators stay
|
|
76
|
+
* distinguishable; both the server (when it stamps the verified identity onto an
|
|
77
|
+
* awareness state) and the client (its local self-view) index into the SAME
|
|
78
|
+
* palette so a peer's colour is stable and agreed wherever it's rendered.
|
|
79
|
+
*/
|
|
80
|
+
export declare const IDENTITY_COLORS: string[];
|
|
81
|
+
/**
|
|
82
|
+
* A stable presence colour for an identity seed (Collab T4). Derived from the
|
|
83
|
+
* principal's subject (or any stable seed) by a tiny FNV-1a hash into
|
|
84
|
+
* {@link IDENTITY_COLORS}, so the SAME user always tints the SAME colour — across
|
|
85
|
+
* sessions, devices, and both sides of the awareness re-stamp. Deterministic and
|
|
86
|
+
* isomorphic (no crypto), so the server and every client agree without
|
|
87
|
+
* coordinating. An empty seed falls back to the first colour.
|
|
88
|
+
*/
|
|
89
|
+
export declare function colorForIdentity(seed: string): string;
|
|
63
90
|
/** JOSE header of an identity assertion. */
|
|
64
91
|
export interface IdentityHeader {
|
|
65
92
|
alg: 'EdDSA';
|
package/dist/identity.js
CHANGED
|
@@ -34,6 +34,42 @@ export function localPrincipal(name = 'Local') {
|
|
|
34
34
|
export function principalId(p) {
|
|
35
35
|
return p.subject;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The principal's subject ONLY when it is a cryptographically-verified (`jws`)
|
|
39
|
+
* identity, else `''`. This is the subject that may be stamped as a block's
|
|
40
|
+
* *verified* author (OB-170): guest/local/unverified writers carry no verified
|
|
41
|
+
* attribution, so their edits honestly leave a block un-attributed rather than
|
|
42
|
+
* recording a spoofable or process-local identity. Used on every server write path
|
|
43
|
+
* that stamps per-block authorship (the durable snapshot save + Collab T9's
|
|
44
|
+
* server-authoritative persist).
|
|
45
|
+
*/
|
|
46
|
+
export function verifiedSubject(p) {
|
|
47
|
+
return p?.verifiedVia === 'jws' ? p.subject : '';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The fixed palette presence/awareness cursors are tinted from (Collab T4). A
|
|
51
|
+
* small, high-contrast set so a handful of simultaneous collaborators stay
|
|
52
|
+
* distinguishable; both the server (when it stamps the verified identity onto an
|
|
53
|
+
* awareness state) and the client (its local self-view) index into the SAME
|
|
54
|
+
* palette so a peer's colour is stable and agreed wherever it's rendered.
|
|
55
|
+
*/
|
|
56
|
+
export const IDENTITY_COLORS = ['#e4a33c', '#5b8def', '#4fae6e', '#c96bd6', '#e0635c', '#3aa6a6', '#9b6dff', '#d98c40'];
|
|
57
|
+
/**
|
|
58
|
+
* A stable presence colour for an identity seed (Collab T4). Derived from the
|
|
59
|
+
* principal's subject (or any stable seed) by a tiny FNV-1a hash into
|
|
60
|
+
* {@link IDENTITY_COLORS}, so the SAME user always tints the SAME colour — across
|
|
61
|
+
* sessions, devices, and both sides of the awareness re-stamp. Deterministic and
|
|
62
|
+
* isomorphic (no crypto), so the server and every client agree without
|
|
63
|
+
* coordinating. An empty seed falls back to the first colour.
|
|
64
|
+
*/
|
|
65
|
+
export function colorForIdentity(seed) {
|
|
66
|
+
let hash = 0x811c9dc5;
|
|
67
|
+
for (let i = 0; i < seed.length; i += 1) {
|
|
68
|
+
hash ^= seed.charCodeAt(i);
|
|
69
|
+
hash = Math.imul(hash, 0x01000193);
|
|
70
|
+
}
|
|
71
|
+
return IDENTITY_COLORS[(hash >>> 0) % IDENTITY_COLORS.length];
|
|
72
|
+
}
|
|
37
73
|
/**
|
|
38
74
|
* Mint a fresh issuer keypair (Ed25519). Used by the dev issuer and tests; the
|
|
39
75
|
* real issuer (account.book.pub) holds the equivalent and rotates `kid`s.
|
package/dist/identity.js.map
CHANGED
|
@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,CAAC,CAAC;IACnC,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE;QACtC,MAAM,EAAE,MAAM,CAAC,GAAG;QAClB,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;QACvB,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACzB,WAAW,EAAE,KAAK;QAClB,SAAS,EAAE,EAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAC;KAC/C,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAAC,MAAsB;IAClE,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACnC,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE;QACtC,MAAM,EAAE,MAAM,CAAC,GAAG;QAClB,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;QACvB,4EAA4E;QAC5E,+EAA+E;QAC/E,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACzB,WAAW,EAAE,YAAY;QACzB,SAAS,EAAE,EAAC,GAAG,EAAE,MAAM,CAAC,GAAG,EAAC;KAC7B,CAAC;AACJ,CAAC"}
|
package/dist/import.d.ts
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **format-agnostic import core** — the spine every importer (Markdown,
|
|
3
|
+
* HTML, Notion, …) targets. A parser's only job is to turn its source format
|
|
4
|
+
* into an {@link ImportedDoc}; this module then writes that IR into the
|
|
5
|
+
* workspace through the *existing* data paths, so importers never touch the
|
|
6
|
+
* store, the CRDT, or the wire protocol directly.
|
|
7
|
+
*
|
|
8
|
+
* Two writers, picked by the document's size/shape (see {@link chooseStrategy}):
|
|
9
|
+
*
|
|
10
|
+
* - **Strategy A — {@link writeViaCreateApis}** drives `savePage` /
|
|
11
|
+
* `createDatabase` / `createRow` directly, exactly like the template gallery
|
|
12
|
+
* (see `templates.ts`). Best for a single page / small tree: it streams
|
|
13
|
+
* creates and resolves parent links as it goes, with no whole-bundle staging.
|
|
14
|
+
*
|
|
15
|
+
* - **Strategy B — {@link writeViaBundle}** maps the whole IR into a backup
|
|
16
|
+
* bundle (`{pages, databases}` native records) and hands it to
|
|
17
|
+
* `importSpace(…, mode:'copy')`. That inherits — for free — the server's
|
|
18
|
+
* id-remap, `@`-mention link-rewrite, name de-dup, and idempotent-replay
|
|
19
|
+
* machinery (`remapBundle` / `importBundle`), plus the Restore dialog on the
|
|
20
|
+
* UI side. Best for a multi-page / database tree.
|
|
21
|
+
*
|
|
22
|
+
* **Assets (v1 decision).** A real asset store is a separate epic; until then an
|
|
23
|
+
* image becomes a *placeholder* that preserves the original `ref` + `alt` rather
|
|
24
|
+
* than being silently dropped — {@link imagePlaceholderBlock} for body content,
|
|
25
|
+
* {@link imagePlaceholderCell} for a database cell. The "never silently drop
|
|
26
|
+
* content" guarantee that the inbound HTML/EditorJS converters follow (see
|
|
27
|
+
* `ui/blockeditor/model.ts`) holds end-to-end through import.
|
|
28
|
+
*
|
|
29
|
+
* **Why the SDK.** The writers speak `DataClient` and the backup bundle, both
|
|
30
|
+
* SDK-owned; the block payload is the editor's plain JSON projection, which the
|
|
31
|
+
* SDK already handles structurally (`content.ts`, `mtime.ts`). {@link
|
|
32
|
+
* ImportedBlock} is the structural mirror of `@book.dev/ui`'s `BlockJSON`: a
|
|
33
|
+
* parser's real `BlockJSON` (built with the UI's `htmlToBlocks` / `htmlToRuns`
|
|
34
|
+
* helpers) is assignable straight into this IR — without the SDK taking a UI
|
|
35
|
+
* dependency. The assignment is one-way *by design*: `ImportedBlock.id` is
|
|
36
|
+
* OPTIONAL (import omits ids; the editor mints them on load via its
|
|
37
|
+
* `jsonToNewBlock`), so the reverse — treating an `ImportedBlock` as a
|
|
38
|
+
* `BlockJSON` — intentionally does not hold.
|
|
39
|
+
*/
|
|
40
|
+
import type { DataClient } from './client';
|
|
41
|
+
import type { ImportResult } from './backup';
|
|
42
|
+
import type { DatabaseSchema, StoredDatabase } from './database';
|
|
43
|
+
import { type PageSnapshot, type StoredPage } from './types';
|
|
44
|
+
/** Inline formatting on a run — the structural mirror of `@book.dev/ui`'s
|
|
45
|
+
* `InlineAttrs` (bold/italic/underline/strike/code, link href, mention, colours). */
|
|
46
|
+
export interface ImportInlineAttrs {
|
|
47
|
+
b?: boolean;
|
|
48
|
+
i?: boolean;
|
|
49
|
+
u?: boolean;
|
|
50
|
+
s?: boolean;
|
|
51
|
+
c?: boolean;
|
|
52
|
+
/** Link href. */
|
|
53
|
+
a?: string;
|
|
54
|
+
/** Mention: a page id. */
|
|
55
|
+
m?: string;
|
|
56
|
+
/** Text colour — a palette token. */
|
|
57
|
+
tc?: string;
|
|
58
|
+
/** Highlight colour — a palette token. */
|
|
59
|
+
hl?: string;
|
|
60
|
+
}
|
|
61
|
+
/** One run of a block's rich text — mirror of `@book.dev/ui`'s `TextRun`. */
|
|
62
|
+
export interface ImportTextRun {
|
|
63
|
+
t: string;
|
|
64
|
+
a?: ImportInlineAttrs;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A block in the IR — the structural mirror of `@book.dev/ui`'s `BlockJSON`.
|
|
68
|
+
* `type` is any block type the editor ships (`paragraph` / `heading` / `list` /
|
|
69
|
+
* `todo` / `quote` / `callout` / `code` / `table` / `columns` / `group` /
|
|
70
|
+
* `tabs` / `accordion` / …); `text` carries rich runs, `children` nests
|
|
71
|
+
* container blocks. `id` is optional — the editor mints one on load when absent.
|
|
72
|
+
*/
|
|
73
|
+
export interface ImportedBlock {
|
|
74
|
+
id?: string;
|
|
75
|
+
type: string;
|
|
76
|
+
text?: ImportTextRun[];
|
|
77
|
+
props?: Record<string, unknown>;
|
|
78
|
+
children?: ImportedBlock[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A placeholder for an asset that import v1 cannot yet store (images today).
|
|
82
|
+
* Carries enough to losslessly rehydrate once a real asset store lands: the
|
|
83
|
+
* original `ref` (URL / path / data-uri / attachment id) and the `alt`/`title`.
|
|
84
|
+
*/
|
|
85
|
+
export interface ImportedAsset {
|
|
86
|
+
/** Asset kind — only `image` is produced in v1. */
|
|
87
|
+
kind: 'image';
|
|
88
|
+
/** The original source reference, preserved verbatim. */
|
|
89
|
+
ref: string;
|
|
90
|
+
/** Alt text, preserved alongside the ref. */
|
|
91
|
+
alt?: string;
|
|
92
|
+
/** Original title attribute, if any. */
|
|
93
|
+
title?: string;
|
|
94
|
+
}
|
|
95
|
+
/** A row of an {@link ImportedDatabase} — becomes a page inside the database. */
|
|
96
|
+
export interface ImportedRow {
|
|
97
|
+
/**
|
|
98
|
+
* A stable synthetic id for this row's page, honored by the **bundle** writer
|
|
99
|
+
* ({@link buildImportBundle}) so a cross-page `@`-mention (an `m` run) can point
|
|
100
|
+
* at the row before the server re-keys it. Optional — when omitted the bundle
|
|
101
|
+
* mints one. The create writer ignores it (the store assigns the id there).
|
|
102
|
+
*/
|
|
103
|
+
id?: string;
|
|
104
|
+
/** The row's page title. */
|
|
105
|
+
title: string;
|
|
106
|
+
/** Manual property values, keyed by schema property id. */
|
|
107
|
+
properties?: Record<string, unknown>;
|
|
108
|
+
/** The row page's own document body, if any. */
|
|
109
|
+
blocks?: ImportedBlock[];
|
|
110
|
+
/** Sub-item rows nested under this one (same database). */
|
|
111
|
+
children?: ImportedRow[];
|
|
112
|
+
}
|
|
113
|
+
/** A database hosted by an {@link ImportedPage}: its schema plus its rows. */
|
|
114
|
+
export interface ImportedDatabase {
|
|
115
|
+
/** Display name (defaults to the host page's title when omitted). */
|
|
116
|
+
name?: string;
|
|
117
|
+
schema: DatabaseSchema;
|
|
118
|
+
rows: ImportedRow[];
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* A page in the imported tree: a title, an optional emoji icon, a block body,
|
|
122
|
+
* an optional hosted database, and nested child pages. The recursive
|
|
123
|
+
* `children` + per-page `database` is the whole shape an importer builds.
|
|
124
|
+
*/
|
|
125
|
+
export interface ImportedPage {
|
|
126
|
+
/**
|
|
127
|
+
* A stable synthetic id, honored by the **bundle** writer
|
|
128
|
+
* ({@link buildImportBundle}) so cross-page `@`-mentions resolve to this page
|
|
129
|
+
* before the server re-keys the whole graph. Optional — the bundle mints one
|
|
130
|
+
* when omitted; the create writer ignores it (the store assigns the id there).
|
|
131
|
+
*/
|
|
132
|
+
id?: string;
|
|
133
|
+
title: string;
|
|
134
|
+
icon?: string;
|
|
135
|
+
blocks: ImportedBlock[];
|
|
136
|
+
children?: ImportedPage[];
|
|
137
|
+
/** A database this page hosts (its rows become row pages of the database). */
|
|
138
|
+
database?: ImportedDatabase;
|
|
139
|
+
}
|
|
140
|
+
/** The format-agnostic target every parser emits: a forest of pages. */
|
|
141
|
+
export interface ImportedDoc {
|
|
142
|
+
pages: ImportedPage[];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The `props.kind` marker on a placeholder block, and the `props` key the
|
|
146
|
+
* structured {@link ImportedAsset} is stashed under. A future real-asset epic
|
|
147
|
+
* can query for `props[IMAGE_PLACEHOLDER_PROP]` to find and rehydrate every
|
|
148
|
+
* placeholder a past import left behind.
|
|
149
|
+
*/
|
|
150
|
+
export declare const IMAGE_PLACEHOLDER_KIND = "import-image-placeholder";
|
|
151
|
+
export declare const IMAGE_PLACEHOLDER_PROP = "importedAsset";
|
|
152
|
+
/**
|
|
153
|
+
* Turn an image asset into a real, visible **callout** block that preserves the
|
|
154
|
+
* original ref (as a clickable link run) and the alt/title text — never a
|
|
155
|
+
* silent drop. The structured {@link ImportedAsset} is stashed in `props` so the
|
|
156
|
+
* asset can be rehydrated later. Mirrors the "honest visible marker" pattern the
|
|
157
|
+
* EditorJS migration uses for not-yet-supported blocks (`model.ts`). Pure: the
|
|
158
|
+
* id is derived from the asset, so the same image always yields the same block
|
|
159
|
+
* id (deterministic re-imports, no module-global counter).
|
|
160
|
+
*/
|
|
161
|
+
export declare function imagePlaceholderBlock(asset: ImportedAsset): ImportedBlock;
|
|
162
|
+
/**
|
|
163
|
+
* The placeholder *cell* value for a `files` / `url` database property: the
|
|
164
|
+
* original ref, so the cell still renders and resolves the image (`firstImageUrl`
|
|
165
|
+
* / `coverImageUrl` read it). Alt, when present, is preserved at block
|
|
166
|
+
* granularity via {@link imagePlaceholderBlock} on the row's body.
|
|
167
|
+
*/
|
|
168
|
+
export declare function imagePlaceholderCell(asset: ImportedAsset): string;
|
|
169
|
+
/**
|
|
170
|
+
* Wrap a block list in a page snapshot the block editor reads — the same shape
|
|
171
|
+
* `templates.ts` ships (`editor:'blocks'`, blocks in `blockdoc.blocks`, NO CRDT
|
|
172
|
+
* `update`). The editor rebuilds the Y.Doc from the JSON projection on load
|
|
173
|
+
* (`decodeSnapshot` falls back to it), so importers never touch yjs.
|
|
174
|
+
*/
|
|
175
|
+
export declare function importedBlocksToSnapshot(blocks: ImportedBlock[]): PageSnapshot;
|
|
176
|
+
export type ImportStrategy = 'create' | 'bundle';
|
|
177
|
+
/**
|
|
178
|
+
* Pick a writer by the document's shape: a lone, childless, database-less page
|
|
179
|
+
* → **Strategy A** (stream creates); anything bigger — multiple pages, nested
|
|
180
|
+
* children, or a hosted database — → **Strategy B** (stage a bundle and let the
|
|
181
|
+
* server remap/rewrite/dedup the whole tree at once).
|
|
182
|
+
*/
|
|
183
|
+
export declare function chooseStrategy(doc: ImportedDoc): ImportStrategy;
|
|
184
|
+
/** The slice of {@link DataClient} the import writers use (a real client satisfies it). */
|
|
185
|
+
export type ImportWriteClient = Pick<DataClient, 'savePage' | 'setPageProperties' | 'createDatabase' | 'createRow' | 'importSpace'>;
|
|
186
|
+
/** Options shared by both writers. */
|
|
187
|
+
export interface ImportOptions {
|
|
188
|
+
/**
|
|
189
|
+
* Attach the imported roots under this existing page. Honored by
|
|
190
|
+
* {@link writeViaCreateApis} only — the bundle writer always lands at the top
|
|
191
|
+
* level, since copy-mode remap nulls any parent that isn't itself in the
|
|
192
|
+
* bundle (a deliberate server-side rule).
|
|
193
|
+
*/
|
|
194
|
+
parentId?: string | null;
|
|
195
|
+
}
|
|
196
|
+
/** Options for {@link buildImportBundle} / {@link writeViaBundle}. */
|
|
197
|
+
export interface BundleOptions extends ImportOptions {
|
|
198
|
+
/** Mint an id for a synthetic bundle record. Defaults to a deterministic
|
|
199
|
+
* counter (`imp_p1`, `imp_d2`, …) — the server re-keys everything in copy mode. */
|
|
200
|
+
newId?: () => string;
|
|
201
|
+
/** ISO timestamp stamped on every synthetic record (defaults to now). */
|
|
202
|
+
now?: string;
|
|
203
|
+
}
|
|
204
|
+
/** What an import write produced. */
|
|
205
|
+
export interface ImportWriteResult {
|
|
206
|
+
strategy: ImportStrategy;
|
|
207
|
+
/** Ordinary page ids created (Strategy A) / new page ids from the id-map (Strategy B). */
|
|
208
|
+
pageIds: string[];
|
|
209
|
+
/** Database ids created (Strategy A only — bundles re-key server-side). */
|
|
210
|
+
databaseIds: string[];
|
|
211
|
+
/** Row page ids created (Strategy A only). */
|
|
212
|
+
rowIds: string[];
|
|
213
|
+
/** The server's `ImportResult` (Strategy B only). */
|
|
214
|
+
importResult?: ImportResult;
|
|
215
|
+
/**
|
|
216
|
+
* Landed page ids whose block body still holds an **image placeholder** after
|
|
217
|
+
* the write (URL / `data:` images are rewritten to real `image` blocks *before*
|
|
218
|
+
* landing, so these are refs that still need their bytes uploaded — e.g. Notion
|
|
219
|
+
* zip images). The post-import rehydration pass ({@link rehydrateStoredImages})
|
|
220
|
+
* targets exactly these, so a large import re-reads/re-saves only image-bearing
|
|
221
|
+
* pages rather than the whole tree.
|
|
222
|
+
*/
|
|
223
|
+
placeholderPageIds: string[];
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Does this block tree hold an image placeholder (a callout carrying
|
|
227
|
+
* {@link IMAGE_PLACEHOLDER_PROP})? Used by the writers to record which landed
|
|
228
|
+
* pages the post-import rehydration pass must revisit (see
|
|
229
|
+
* {@link ImportWriteResult.placeholderPageIds}). Recurses container children.
|
|
230
|
+
*/
|
|
231
|
+
export declare function blocksHaveImagePlaceholder(blocks: ImportedBlock[] | undefined): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* **Strategy A.** Write the tree by driving the create APIs directly, the way
|
|
234
|
+
* the template gallery does: each page is `savePage`d (parent resolved from the
|
|
235
|
+
* already-created ancestor), a hosted database is `createDatabase`d on it, and
|
|
236
|
+
* every row — including nested sub-items — is `createRow`d. Page/row names are
|
|
237
|
+
* deduped on the fly ({@link createDeduped}) since names are globally unique, so
|
|
238
|
+
* a title clash suffixes-and-lands instead of aborting the import. Returns the
|
|
239
|
+
* ids it minted, in creation order.
|
|
240
|
+
*/
|
|
241
|
+
export declare function writeViaCreateApis(client: ImportWriteClient, doc: ImportedDoc, opts?: ImportOptions): Promise<ImportWriteResult>;
|
|
242
|
+
/**
|
|
243
|
+
* Map an {@link ImportedDoc} to a copy-mode backup bundle: native `StoredPage` /
|
|
244
|
+
* `StoredDatabase` records with internally-consistent **synthetic** ids (the
|
|
245
|
+
* server re-keys every id on import). The host page's `hostedDatabaseId`, the
|
|
246
|
+
* database's `pageId`, each row's `databaseId`, and sub-item / child `parentId`
|
|
247
|
+
* links are all wired up so `remapBundle` can rewrite them as one graph. Pure —
|
|
248
|
+
* no client, no I/O — so it is directly unit-testable.
|
|
249
|
+
*/
|
|
250
|
+
export declare function buildImportBundle(doc: ImportedDoc, opts?: BundleOptions): {
|
|
251
|
+
pages: StoredPage[];
|
|
252
|
+
databases: StoredDatabase[];
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* **Strategy B.** Build the copy-mode bundle ({@link buildImportBundle}) and
|
|
256
|
+
* hand it to `importSpace`, inheriting the server's id-remap, link-rewrite,
|
|
257
|
+
* name-dedup, and idempotent-replay handling. Surfaces the server's
|
|
258
|
+
* {@link ImportResult} (and its `idMap` as the new page ids).
|
|
259
|
+
*/
|
|
260
|
+
export declare function writeViaBundle(client: ImportWriteClient, doc: ImportedDoc, opts?: BundleOptions): Promise<ImportWriteResult>;
|
|
261
|
+
/**
|
|
262
|
+
* Import a document, picking the writer by {@link chooseStrategy}. The single
|
|
263
|
+
* entry point a parser calls once it has built its {@link ImportedDoc}.
|
|
264
|
+
*/
|
|
265
|
+
export declare function importDoc(client: ImportWriteClient, doc: ImportedDoc, opts?: BundleOptions): Promise<ImportWriteResult>;
|