rmapi-js 12.0.3 → 14.0.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/codes.d.ts +35 -0
- package/dist/codes.js +61 -0
- package/dist/index.d.ts +185 -38
- package/dist/index.js +731 -237
- package/dist/lru.d.ts +4 -4
- package/dist/lru.js +4 -4
- package/dist/raw.d.ts +169 -36
- package/dist/raw.js +214 -74
- package/dist/rm5.d.ts +7 -31
- package/dist/rm5.js +3 -43
- package/dist/rm6.d.ts +45 -19
- package/dist/rm6.js +422 -42
- package/dist/rmapi-js.esm.min.js +77 -9
- package/package.json +7 -7
package/dist/codes.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pen and color codes a stroke carries, shared by every `.rm` version.
|
|
3
|
+
*
|
|
4
|
+
* A stroke stores its pen and its color as small integers. Both sets grew with
|
|
5
|
+
* the firmware, so a code from a newer device can name the same pen or color
|
|
6
|
+
* as an older one. Reading a page checks the codes against these lists.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
/** a pen/tool name for a stroke */
|
|
12
|
+
export type RmBrush = "brush" | "pencil" | "ballpoint" | "marker" | "fineliner" | "highlighter" | "eraser" | "mechanicalPencil" | "eraseArea" | "calligraphy" | "shader";
|
|
13
|
+
/** a pen code that appears in a file */
|
|
14
|
+
export type RmBrushCode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 23;
|
|
15
|
+
export declare const rmBrushCode: z.ZodType<RmBrushCode>;
|
|
16
|
+
/**
|
|
17
|
+
* the reMarkable pens, by code
|
|
18
|
+
*
|
|
19
|
+
* The codes come in two firmware families, so two codes can name the same pen.
|
|
20
|
+
*/
|
|
21
|
+
export declare const rmBrushes: Readonly<Record<RmBrushCode, RmBrush>>;
|
|
22
|
+
/** a color name for a stroke */
|
|
23
|
+
export type RmColor = "black" | "gray" | "white" | "yellow" | "green" | "pink" | "blue" | "red" | "grayOverlap" | "highlight" | "cyan" | "magenta";
|
|
24
|
+
/** a color code that appears in a file */
|
|
25
|
+
export type RmColorCode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13;
|
|
26
|
+
export declare const rmColorCode: z.ZodType<RmColorCode>;
|
|
27
|
+
/**
|
|
28
|
+
* the reMarkable palette, by code
|
|
29
|
+
*
|
|
30
|
+
* The palette grew when colored annotations arrived and again for the Paper
|
|
31
|
+
* Pro, so two codes can name the same color. `"highlight"` is a marker rather
|
|
32
|
+
* than a color — the stroke's real color is its `colorRgba`. The shade a name
|
|
33
|
+
* renders as depends on the device.
|
|
34
|
+
*/
|
|
35
|
+
export declare const rmColors: Readonly<Record<RmColorCode, RmColor>>;
|
package/dist/codes.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pen and color codes a stroke carries, shared by every `.rm` version.
|
|
3
|
+
*
|
|
4
|
+
* A stroke stores its pen and its color as small integers. Both sets grew with
|
|
5
|
+
* the firmware, so a code from a newer device can name the same pen or color
|
|
6
|
+
* as an older one. Reading a page checks the codes against these lists.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
export const rmBrushCode = z.literal([0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16, 17, 18, 21, 23], { error: "unknown pen code" });
|
|
12
|
+
/**
|
|
13
|
+
* the reMarkable pens, by code
|
|
14
|
+
*
|
|
15
|
+
* The codes come in two firmware families, so two codes can name the same pen.
|
|
16
|
+
*/
|
|
17
|
+
export const rmBrushes = {
|
|
18
|
+
0: "brush",
|
|
19
|
+
12: "brush",
|
|
20
|
+
1: "pencil",
|
|
21
|
+
14: "pencil",
|
|
22
|
+
2: "ballpoint",
|
|
23
|
+
15: "ballpoint",
|
|
24
|
+
3: "marker",
|
|
25
|
+
16: "marker",
|
|
26
|
+
4: "fineliner",
|
|
27
|
+
17: "fineliner",
|
|
28
|
+
5: "highlighter",
|
|
29
|
+
18: "highlighter",
|
|
30
|
+
6: "eraser",
|
|
31
|
+
7: "mechanicalPencil",
|
|
32
|
+
13: "mechanicalPencil",
|
|
33
|
+
8: "eraseArea",
|
|
34
|
+
21: "calligraphy",
|
|
35
|
+
23: "shader",
|
|
36
|
+
};
|
|
37
|
+
export const rmColorCode = z.literal([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], { error: "unknown color code" });
|
|
38
|
+
/**
|
|
39
|
+
* the reMarkable palette, by code
|
|
40
|
+
*
|
|
41
|
+
* The palette grew when colored annotations arrived and again for the Paper
|
|
42
|
+
* Pro, so two codes can name the same color. `"highlight"` is a marker rather
|
|
43
|
+
* than a color — the stroke's real color is its `colorRgba`. The shade a name
|
|
44
|
+
* renders as depends on the device.
|
|
45
|
+
*/
|
|
46
|
+
export const rmColors = {
|
|
47
|
+
0: "black",
|
|
48
|
+
1: "gray",
|
|
49
|
+
2: "white",
|
|
50
|
+
3: "yellow",
|
|
51
|
+
4: "green",
|
|
52
|
+
5: "pink",
|
|
53
|
+
6: "blue",
|
|
54
|
+
7: "red",
|
|
55
|
+
8: "grayOverlap",
|
|
56
|
+
9: "highlight",
|
|
57
|
+
10: "green",
|
|
58
|
+
11: "cyan",
|
|
59
|
+
12: "magenta",
|
|
60
|
+
13: "yellow",
|
|
61
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { type BackgroundFilter, type CollectionContent, type Content, type DocumentContent, type ItemRef, type Metadata, type Orientation, RawRemarkable, type RmPage, type Tag, type TemplateContent, type TextAlignment, type ZoomMode } from "./raw.js";
|
|
1
|
+
import { type BackgroundFilter, type CollectionContent, type Content, type DocumentContent, type Highlight, type ItemRef, type Metadata, type Orientation, type PageMetadata, RawRemarkable, type RmPage, type Tag, type TemplateContent, type TextAlignment, type ZoomMode } from "./raw.js";
|
|
2
|
+
export type { RmBrush, RmBrushCode, RmColor, RmColorCode, } from "./codes.js";
|
|
3
|
+
export { rmBrushes, rmColors } from "./codes.js";
|
|
2
4
|
export { type DeviceModel, type DeviceScreen, deviceScreens, } from "./devices.js";
|
|
3
5
|
export { HashNotFoundError, ValidationError } from "./error.js";
|
|
4
|
-
export type { BackgroundFilter, CollectionContent, Content, CPageNumberValue, CPagePage, CPageStringValue, CPages, CPageUUID, DocumentContent, DocumentMetadata, Entries, FileType, ItemRef, KeyboardMetadata, LegacyCollectionContent, LegacyDocumentContent, Metadata, Orientation, PageTag, RawEntry, RawRemarkableApi, RmPage, SchemaVersion, Tag, TemplateContent, TextAlignment, UploadMimeType, ZoomMode, } from "./raw.js";
|
|
5
|
-
export type {
|
|
6
|
-
export {
|
|
7
|
-
export
|
|
8
|
-
export { crdtKey, END_MARKER, parseRmScene, ROOT_ID } from "./rm6.js";
|
|
6
|
+
export type { BackgroundFilter, CollectionContent, Content, CPageNumberValue, CPagePage, CPageStringValue, CPages, CPageUUID, DocumentContent, DocumentMetadata, Entries, EntryType, FileType, Highlight, HighlightRect, ItemRef, KeyboardMetadata, LegacyCollectionContent, LegacyDocumentContent, Metadata, Orientation, PageLayer, PageMetadata, PageTag, PendingEntry, RawEntry, RawRemarkableApi, RmPage, SchemaVersion, Tag, TemplateContent, TextAlignment, UploadMimeType, ZoomMode, } from "./raw.js";
|
|
7
|
+
export type { RmLayer, RmLine, RmPageV5, RmPoint, RmVersion, } from "./rm5.js";
|
|
8
|
+
export type { AuthorIdsBlock, CrdtId, GlyphRange, LwwValue, MigrationInfoBlock, PageInfoBlock, Rectangle, RmBlock, RmScene, RmSceneItem, RmSceneLayer, RmV6Line, RmV6Point, RmV6Text, RmV6TextValue, RootTextBlock, SceneGlyphItemBlock, SceneGroupItemBlock, SceneInfoBlock, SceneItem, SceneLineItemBlock, SceneTextItemBlock, SceneTombstoneItemBlock, SceneTreeBlock, TreeNodeAnchor, TreeNodeBlock, UnknownBlock, } from "./rm6.js";
|
|
9
|
+
export { crdtKey } from "./rm6.js";
|
|
9
10
|
/** common properties shared by collections and documents */
|
|
10
11
|
export interface EntryCommon extends ItemRef {
|
|
11
12
|
/** the visible display name of this entry */
|
|
@@ -30,7 +31,7 @@ export interface CollectionEntry extends EntryCommon {
|
|
|
30
31
|
type: "CollectionType";
|
|
31
32
|
}
|
|
32
33
|
/** a file, referred to in the api as a document */
|
|
33
|
-
export interface
|
|
34
|
+
export interface DocumentEntry extends EntryCommon {
|
|
34
35
|
/** the key to identify this as a document */
|
|
35
36
|
type: "DocumentType";
|
|
36
37
|
/** the type of the file */
|
|
@@ -39,7 +40,7 @@ export interface DocumentType extends EntryCommon {
|
|
|
39
40
|
lastOpened: string;
|
|
40
41
|
}
|
|
41
42
|
/** a template, such as from methods.remarkable.com */
|
|
42
|
-
export interface
|
|
43
|
+
export interface TemplateEntry extends EntryCommon {
|
|
43
44
|
/** the key to identify this as a template */
|
|
44
45
|
type: "TemplateType";
|
|
45
46
|
/** the timestamp of when the template was added/created */
|
|
@@ -50,7 +51,7 @@ export interface TemplateType extends EntryCommon {
|
|
|
50
51
|
new?: boolean;
|
|
51
52
|
}
|
|
52
53
|
/** a remarkable entry for cloud items */
|
|
53
|
-
export type Entry = CollectionEntry |
|
|
54
|
+
export type Entry = CollectionEntry | DocumentEntry | TemplateEntry;
|
|
54
55
|
/** options for creating a folder */
|
|
55
56
|
export interface FolderOptions {
|
|
56
57
|
/** the id of the folder's parent directory, "" or omitted for root */
|
|
@@ -64,13 +65,6 @@ export interface PutDocumentOptions {
|
|
|
64
65
|
parent?: string;
|
|
65
66
|
/** the visible name to use, overriding the archived value */
|
|
66
67
|
visibleName?: string;
|
|
67
|
-
/**
|
|
68
|
-
* reuse this document id instead of generating a fresh one
|
|
69
|
-
*
|
|
70
|
-
* By default a new uuid is generated so re-uploading an archive to the same
|
|
71
|
-
* account doesn't collide with the original. Pass an id to restore in place.
|
|
72
|
-
*/
|
|
73
|
-
id?: string;
|
|
74
68
|
}
|
|
75
69
|
/** An error that gets thrown when the backend while trying to update
|
|
76
70
|
*
|
|
@@ -211,7 +205,7 @@ declare class Remarkable {
|
|
|
211
205
|
#private;
|
|
212
206
|
/** scoped access to the raw low-level api */
|
|
213
207
|
readonly raw: RawRemarkable;
|
|
214
|
-
constructor(sessionToken: string, rawHost: string, uploadHost: string, cache: Map<string,
|
|
208
|
+
constructor(sessionToken: string, rawHost: string, uploadHost: string, cache: Map<string, Uint8Array | null>, maxGenerationRetries: number, maxTransientRetries: number, maxCachedBytes: number);
|
|
215
209
|
/**
|
|
216
210
|
* list all items
|
|
217
211
|
*
|
|
@@ -233,11 +227,14 @@ declare class Remarkable {
|
|
|
233
227
|
*/
|
|
234
228
|
listItems(refresh?: boolean): Promise<Entry[]>;
|
|
235
229
|
/**
|
|
236
|
-
*
|
|
230
|
+
* list a reference to every item, backed by the low level api
|
|
231
|
+
*
|
|
232
|
+
* Unlike {@link listItems | `listItems`} this doesn't read each item's
|
|
233
|
+
* metadata, so it's cheaper but only gives you ids and hashes.
|
|
237
234
|
*
|
|
238
235
|
* @param refresh - if true, refresh the root hash before listing
|
|
239
236
|
*/
|
|
240
|
-
|
|
237
|
+
listRefs(refresh?: boolean): Promise<ItemRef[]>;
|
|
241
238
|
/**
|
|
242
239
|
* get the content metadata for an item
|
|
243
240
|
*
|
|
@@ -246,10 +243,10 @@ declare class Remarkable {
|
|
|
246
243
|
* the low-level api to get the raw text of the `.content` file in the
|
|
247
244
|
* `RawEntry` for this hash.
|
|
248
245
|
*
|
|
249
|
-
* @param ref - a reference to the item (e.g. from `listItems` or `
|
|
246
|
+
* @param ref - a reference to the item (e.g. from `listItems` or `listRefs`)
|
|
250
247
|
* @returns the content
|
|
251
248
|
*/
|
|
252
|
-
getContent(
|
|
249
|
+
getContent(ref: ItemRef): Promise<Content>;
|
|
253
250
|
/**
|
|
254
251
|
* get the metadata for an item
|
|
255
252
|
*
|
|
@@ -258,10 +255,10 @@ declare class Remarkable {
|
|
|
258
255
|
* the low-level api to get the raw text of the `.metadata` file in the
|
|
259
256
|
* `RawEntry` for this hash.
|
|
260
257
|
*
|
|
261
|
-
* @param ref - a reference to the item (e.g. from `listItems` or `
|
|
258
|
+
* @param ref - a reference to the item (e.g. from `listItems` or `listRefs`)
|
|
262
259
|
* @returns the metadata
|
|
263
260
|
*/
|
|
264
|
-
getMetadata(
|
|
261
|
+
getMetadata(ref: ItemRef): Promise<Metadata>;
|
|
265
262
|
/**
|
|
266
263
|
* get the pdf associated with a document
|
|
267
264
|
*
|
|
@@ -270,7 +267,7 @@ declare class Remarkable {
|
|
|
270
267
|
* @param ref - a reference to the document (e.g. from `listItems`)
|
|
271
268
|
* @returns the pdf bytes
|
|
272
269
|
*/
|
|
273
|
-
getPdf(
|
|
270
|
+
getPdf(ref: ItemRef): Promise<Uint8Array>;
|
|
274
271
|
/**
|
|
275
272
|
* get the epub associated with a document
|
|
276
273
|
*
|
|
@@ -279,7 +276,7 @@ declare class Remarkable {
|
|
|
279
276
|
* @param ref - a reference to the document (e.g. from `listItems`)
|
|
280
277
|
* @returns the epub bytes
|
|
281
278
|
*/
|
|
282
|
-
getEpub(
|
|
279
|
+
getEpub(ref: ItemRef): Promise<Uint8Array>;
|
|
283
280
|
/**
|
|
284
281
|
* get a single page's parsed reMarkable lines (`.rm`) drawing
|
|
285
282
|
*
|
|
@@ -303,6 +300,147 @@ declare class Remarkable {
|
|
|
303
300
|
* @returns the drawn pages, keyed by page id, in document order
|
|
304
301
|
*/
|
|
305
302
|
getRmPages(ref: ItemRef): Promise<Map<string, RmPage>>;
|
|
303
|
+
/**
|
|
304
|
+
* write a single page's reMarkable lines (`.rm`) drawing
|
|
305
|
+
*
|
|
306
|
+
* @param ref - a reference to the document
|
|
307
|
+
* @param pageId - the id of the page, from the document's `.content` page list
|
|
308
|
+
* @param page - the drawing to write, replacing any already there
|
|
309
|
+
* @throws GenerationError if the generation doesn't match the current server generation
|
|
310
|
+
* @throws if `pageId` is not a page of the document
|
|
311
|
+
* @returns a reference to the updated document, with its new hash
|
|
312
|
+
*/
|
|
313
|
+
putRmPage(ref: ItemRef, pageId: string, page: RmPage, refresh?: boolean): Promise<ItemRef>;
|
|
314
|
+
/**
|
|
315
|
+
* write several pages' reMarkable lines (`.rm`) drawings in one commit
|
|
316
|
+
*
|
|
317
|
+
* @param ref - a reference to the document
|
|
318
|
+
* @param pages - the drawings to write, keyed by page id, replacing any
|
|
319
|
+
* already on those pages and leaving every other page alone
|
|
320
|
+
* @throws GenerationError if the generation doesn't match the current server generation
|
|
321
|
+
* @throws if any key is not a page of the document
|
|
322
|
+
* @returns a reference to the updated document, with its new hash
|
|
323
|
+
*/
|
|
324
|
+
putRmPages(ref: ItemRef, pages: ReadonlyMap<string, RmPage>, refresh?: boolean): Promise<ItemRef>;
|
|
325
|
+
/**
|
|
326
|
+
* get a single page's text highlights
|
|
327
|
+
*
|
|
328
|
+
* These are separate from the highlighter strokes drawn in a `.rm` scene.
|
|
329
|
+
*
|
|
330
|
+
* @param ref - a reference to the document
|
|
331
|
+
* @param pageId - the id of the page, from the document's `.content` page list
|
|
332
|
+
* @returns the page's highlights, or `undefined` if the page has none
|
|
333
|
+
* @throws if `pageId` is not a page of the document
|
|
334
|
+
*/
|
|
335
|
+
getHighlights(ref: ItemRef, pageId: string): Promise<Highlight[][] | undefined>;
|
|
336
|
+
/**
|
|
337
|
+
* get every highlighted page of a document, keyed by page id
|
|
338
|
+
*
|
|
339
|
+
* @param ref - a reference to the document
|
|
340
|
+
* @returns the highlights in page order, omitting pages with none
|
|
341
|
+
*/
|
|
342
|
+
getHighlightPages(ref: ItemRef): Promise<Map<string, Highlight[][]>>;
|
|
343
|
+
/**
|
|
344
|
+
* write a single page's text highlights, replacing any already there
|
|
345
|
+
*
|
|
346
|
+
* @param ref - a reference to the document
|
|
347
|
+
* @param pageId - the id of the page, from the document's `.content` page list
|
|
348
|
+
* @param highlights - the highlights to write
|
|
349
|
+
* @throws GenerationError if the generation doesn't match the current server generation
|
|
350
|
+
* @throws if `pageId` is not a page of the document
|
|
351
|
+
* @returns a reference to the updated document, with its new hash
|
|
352
|
+
*/
|
|
353
|
+
putHighlights(ref: ItemRef, pageId: string, highlights: readonly Highlight[][], refresh?: boolean): Promise<ItemRef>;
|
|
354
|
+
/**
|
|
355
|
+
* write several pages' text highlights in one commit
|
|
356
|
+
*
|
|
357
|
+
* @param ref - a reference to the document
|
|
358
|
+
* @param pages - the highlights to write, keyed by page id, replacing any
|
|
359
|
+
* already on those pages and leaving every other page alone
|
|
360
|
+
* @throws GenerationError if the generation doesn't match the current server generation
|
|
361
|
+
* @throws if any key is not a page of the document
|
|
362
|
+
* @returns a reference to the updated document, with its new hash
|
|
363
|
+
*/
|
|
364
|
+
putHighlightPages(ref: ItemRef, pages: ReadonlyMap<string, readonly Highlight[][]>, refresh?: boolean): Promise<ItemRef>;
|
|
365
|
+
/**
|
|
366
|
+
* get a template attached to an item as a `.template` sidecar
|
|
367
|
+
*
|
|
368
|
+
* This is distinct from a {@link TemplateEntry | `TemplateEntry`} (whose
|
|
369
|
+
* template is its `.content`); collections and documents can carry a template
|
|
370
|
+
* this way.
|
|
371
|
+
*
|
|
372
|
+
* @param ref - a reference to the item
|
|
373
|
+
* @returns the template content, or `undefined` if the item has no `.template`
|
|
374
|
+
*/
|
|
375
|
+
getTemplate(ref: ItemRef): Promise<TemplateContent | undefined>;
|
|
376
|
+
/**
|
|
377
|
+
* attach a template to an item as a `.template` sidecar
|
|
378
|
+
*
|
|
379
|
+
* @param ref - a reference to the item
|
|
380
|
+
* @param template - the template to attach, replacing any already there
|
|
381
|
+
* @throws GenerationError if the generation doesn't match the current server generation
|
|
382
|
+
* @returns a reference to the updated item, with its new hash
|
|
383
|
+
*/
|
|
384
|
+
putTemplate(ref: ItemRef, template: TemplateContent, refresh?: boolean): Promise<ItemRef>;
|
|
385
|
+
/**
|
|
386
|
+
* get a document's per-page template names
|
|
387
|
+
*
|
|
388
|
+
* The `.pagedata` file lists one template name per page, in page order (an
|
|
389
|
+
* empty string for a page with no template).
|
|
390
|
+
*
|
|
391
|
+
* @param ref - a reference to the document
|
|
392
|
+
* @returns the per-page template names, or `undefined` if the document has
|
|
393
|
+
* no `.pagedata`
|
|
394
|
+
*/
|
|
395
|
+
getPagedata(ref: ItemRef): Promise<string[] | undefined>;
|
|
396
|
+
/**
|
|
397
|
+
* set a document's per-page template names
|
|
398
|
+
*
|
|
399
|
+
* @param ref - a reference to the document
|
|
400
|
+
* @param templates - one template name per page, in page order, an empty
|
|
401
|
+
* string for a page with no template
|
|
402
|
+
* @throws GenerationError if the generation doesn't match the current server generation
|
|
403
|
+
* @returns a reference to the updated document, with its new hash
|
|
404
|
+
*/
|
|
405
|
+
putPagedata(ref: ItemRef, templates: readonly string[], refresh?: boolean): Promise<ItemRef>;
|
|
406
|
+
/**
|
|
407
|
+
* get a single page's layer metadata
|
|
408
|
+
*
|
|
409
|
+
* @param ref - a reference to the document
|
|
410
|
+
* @param pageId - the id of the page, from the document's `.content` page list
|
|
411
|
+
* @returns the page's layer metadata, or `undefined` if the page has none
|
|
412
|
+
* @throws if `pageId` is not a page of the document
|
|
413
|
+
*/
|
|
414
|
+
getPageMetadata(ref: ItemRef, pageId: string): Promise<PageMetadata | undefined>;
|
|
415
|
+
/**
|
|
416
|
+
* get every page's layer metadata, keyed by page id
|
|
417
|
+
*
|
|
418
|
+
* @param ref - a reference to the document
|
|
419
|
+
* @returns the layer metadata in page order, omitting pages with none
|
|
420
|
+
*/
|
|
421
|
+
getPageMetadataPages(ref: ItemRef): Promise<Map<string, PageMetadata>>;
|
|
422
|
+
/**
|
|
423
|
+
* write a single page's layer metadata, replacing any already there
|
|
424
|
+
*
|
|
425
|
+
* @param ref - a reference to the document
|
|
426
|
+
* @param pageId - the id of the page, from the document's `.content` page list
|
|
427
|
+
* @param meta - the layer metadata to write
|
|
428
|
+
* @throws GenerationError if the generation doesn't match the current server generation
|
|
429
|
+
* @throws if `pageId` is not a page of the document
|
|
430
|
+
* @returns a reference to the updated document, with its new hash
|
|
431
|
+
*/
|
|
432
|
+
putPageMetadata(ref: ItemRef, pageId: string, meta: PageMetadata, refresh?: boolean): Promise<ItemRef>;
|
|
433
|
+
/**
|
|
434
|
+
* write several pages' layer metadata in one commit
|
|
435
|
+
*
|
|
436
|
+
* @param ref - a reference to the document
|
|
437
|
+
* @param pages - the layer metadata to write, keyed by page id, replacing any
|
|
438
|
+
* already on those pages and leaving every other page alone
|
|
439
|
+
* @throws GenerationError if the generation doesn't match the current server generation
|
|
440
|
+
* @throws if any key is not a page of the document
|
|
441
|
+
* @returns a reference to the updated document, with its new hash
|
|
442
|
+
*/
|
|
443
|
+
putPageMetadataPages(ref: ItemRef, pages: ReadonlyMap<string, PageMetadata>, refresh?: boolean): Promise<ItemRef>;
|
|
306
444
|
/**
|
|
307
445
|
* get a document's entire contents as a zip archive
|
|
308
446
|
*
|
|
@@ -315,7 +453,7 @@ declare class Remarkable {
|
|
|
315
453
|
*
|
|
316
454
|
* @param ref - a reference to the document (e.g. from `listItems`)
|
|
317
455
|
*/
|
|
318
|
-
getDocumentArchive(
|
|
456
|
+
getDocumentArchive(ref: ItemRef): Promise<Uint8Array>;
|
|
319
457
|
/**
|
|
320
458
|
* upload a document archive produced by {@link getDocumentArchive | `getDocumentArchive`}
|
|
321
459
|
*
|
|
@@ -323,16 +461,16 @@ declare class Remarkable {
|
|
|
323
461
|
* as a blob, and commits a new document into the root.
|
|
324
462
|
*
|
|
325
463
|
* @remarks
|
|
326
|
-
* This is an experimental feature.
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
464
|
+
* This is an experimental feature. A fresh document id is generated, so
|
|
465
|
+
* re-uploading to the same account doesn't collide with the original. Like
|
|
466
|
+
* the other low-level puts, this may throw a
|
|
467
|
+
* {@link GenerationError | `GenerationError`} if the generation is stale,
|
|
468
|
+
* requiring a retry.
|
|
331
469
|
*
|
|
332
470
|
* @param buffer - the archive bytes, as returned by `getDocumentArchive`
|
|
333
|
-
* @param options - overrides for parent
|
|
471
|
+
* @param options - overrides for parent and visible name
|
|
334
472
|
*/
|
|
335
|
-
putDocumentArchive(buffer: Uint8Array, { refresh, parent, visibleName
|
|
473
|
+
putDocumentArchive(buffer: Uint8Array, { refresh, parent, visibleName }?: PutDocumentOptions): Promise<ItemRef>;
|
|
336
474
|
/**
|
|
337
475
|
* use the low-level api to add a pdf document
|
|
338
476
|
*
|
|
@@ -599,15 +737,24 @@ export interface RemarkableSessionOptions {
|
|
|
599
737
|
*/
|
|
600
738
|
cache?: string;
|
|
601
739
|
/**
|
|
602
|
-
* the maximum size of the cache in
|
|
740
|
+
* the maximum size of the cache, in bytes of cached content plus key length
|
|
603
741
|
*
|
|
604
|
-
*
|
|
605
|
-
*
|
|
606
|
-
* the data stored.
|
|
742
|
+
* The total memory usage of the cache will be somewhat larger than this,
|
|
743
|
+
* since it counts only the stored data.
|
|
607
744
|
*
|
|
608
745
|
* @defaultValue Infinity
|
|
609
746
|
*/
|
|
610
747
|
maxCacheSize?: number;
|
|
748
|
+
/**
|
|
749
|
+
* the largest stored file to keep the contents of, in bytes
|
|
750
|
+
*
|
|
751
|
+
* Anything larger is fetched normally but only its existence is recorded, so
|
|
752
|
+
* one big pdf can't evict everything else. Set to `0` to cache nothing but
|
|
753
|
+
* existence, or `Infinity` to keep whatever is read.
|
|
754
|
+
*
|
|
755
|
+
* @defaultValue 1048576
|
|
756
|
+
*/
|
|
757
|
+
maxCachedBytes?: number;
|
|
611
758
|
/**
|
|
612
759
|
* how many times to retry updating the root hash after a generation conflict
|
|
613
760
|
*
|
|
@@ -649,7 +796,7 @@ export declare function auth(deviceToken: string, { authHost }?: AuthOptions): P
|
|
|
649
796
|
* @param sessionToken - the session token used for authorization
|
|
650
797
|
* @returns an api instance
|
|
651
798
|
*/
|
|
652
|
-
export declare function session(sessionToken: string, { rawHost, uploadHost, cache, maxCacheSize, maxGenerationRetries, maxTransientRetries, }?: RemarkableSessionOptions): Remarkable;
|
|
799
|
+
export declare function session(sessionToken: string, { rawHost, uploadHost, cache, maxCacheSize, maxCachedBytes, maxGenerationRetries, maxTransientRetries, }?: RemarkableSessionOptions): Remarkable;
|
|
653
800
|
/**
|
|
654
801
|
* create an instance of the api
|
|
655
802
|
*
|