rmapi-js 11.1.2 → 11.2.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/index.d.ts +104 -13
- package/dist/index.js +343 -124
- package/dist/raw.d.ts +61 -10
- package/dist/raw.js +62 -13
- package/dist/rm5.d.ts +111 -0
- package/dist/rm5.js +181 -0
- package/dist/rm6.d.ts +334 -0
- package/dist/rm6.js +728 -0
- package/dist/rmapi-js.esm.min.js +8 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { type BackgroundFilter, type CollectionContent, type Content, type DocumentContent, type Metadata, type Orientation, type RawRemarkableApi, type SimpleEntry, type Tag, type TemplateContent, type TextAlignment, type ZoomMode } from "./raw.js";
|
|
1
|
+
import { type BackgroundFilter, type CollectionContent, type Content, type DocumentContent, type Metadata, type Orientation, type RawRemarkableApi, type RmPage, type SimpleEntry, type Tag, type TemplateContent, type TextAlignment, type ZoomMode } from "./raw.js";
|
|
2
2
|
export { type DeviceModel, type DeviceScreen, deviceScreens, } from "./devices.js";
|
|
3
3
|
export { HashNotFoundError, ValidationError } from "./error.js";
|
|
4
|
-
export type { BackgroundFilter, CollectionContent, Content, CPageNumberValue, CPagePage, CPageStringValue, CPages, CPageUUID, DocumentContent, DocumentMetadata, Entries, FileType, KeyboardMetadata, LegacyCollectionContent, LegacyDocumentContent, Metadata, Orientation, PageTag, RawEntry, RawRemarkableApi, SchemaVersion, SimpleEntry, Tag, TemplateContent, TextAlignment, UploadMimeType, ZoomMode, } from "./raw.js";
|
|
4
|
+
export type { BackgroundFilter, CollectionContent, Content, CPageNumberValue, CPagePage, CPageStringValue, CPages, CPageUUID, DocumentContent, DocumentMetadata, Entries, FileType, KeyboardMetadata, LegacyCollectionContent, LegacyDocumentContent, Metadata, Orientation, PageTag, RawEntry, RawRemarkableApi, RmPage, SchemaVersion, SimpleEntry, Tag, TemplateContent, TextAlignment, UploadMimeType, ZoomMode, } from "./raw.js";
|
|
5
|
+
export type { RmBrush, RmLayer, RmLine, RmPageV5, RmPoint, RmVersion, } from "./rm5.js";
|
|
6
|
+
export { decodeBrush, rmColors } from "./rm5.js";
|
|
7
|
+
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, TreeNodeBlock, UnknownBlock, } from "./rm6.js";
|
|
8
|
+
export { crdtKey, END_MARKER, parseRmScene, ROOT_ID } from "./rm6.js";
|
|
5
9
|
/** common properties shared by collections and documents */
|
|
6
10
|
export interface EntryCommon {
|
|
7
11
|
/** the document id, a uuid4 */
|
|
@@ -66,6 +70,22 @@ export interface FolderOptions {
|
|
|
66
70
|
/** the id of the folder's parent directory, "" or omitted for root */
|
|
67
71
|
parent?: string;
|
|
68
72
|
}
|
|
73
|
+
/** options for uploading a full document archive */
|
|
74
|
+
export interface PutDocumentOptions {
|
|
75
|
+
/** if true, refresh the root hash before uploading */
|
|
76
|
+
refresh?: boolean;
|
|
77
|
+
/** the parent to place the document under, overriding the archived value */
|
|
78
|
+
parent?: string;
|
|
79
|
+
/** the visible name to use, overriding the archived value */
|
|
80
|
+
visibleName?: string;
|
|
81
|
+
/**
|
|
82
|
+
* reuse this document id instead of generating a fresh one
|
|
83
|
+
*
|
|
84
|
+
* By default a new uuid is generated so re-uploading an archive to the same
|
|
85
|
+
* account doesn't collide with the original. Pass an id to restore in place.
|
|
86
|
+
*/
|
|
87
|
+
id?: string;
|
|
88
|
+
}
|
|
69
89
|
/** An error that gets thrown when the backend while trying to update
|
|
70
90
|
*
|
|
71
91
|
* IF you encounter this error, you likely just need to try th request again. If
|
|
@@ -285,21 +305,66 @@ export interface RemarkableApi {
|
|
|
285
305
|
*/
|
|
286
306
|
getEpub(id: string, hash: string): Promise<Uint8Array>;
|
|
287
307
|
/**
|
|
288
|
-
* get
|
|
308
|
+
* get a single page's parsed reMarkable lines (`.rm`) drawing
|
|
289
309
|
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
310
|
+
* @param id - the id of the document (as returned by `listIds`)
|
|
311
|
+
* @param hash - the hash of the document (e.g. from `listItems`)
|
|
312
|
+
* @param pageId - the id of the page, from the document's `.content` page
|
|
313
|
+
* list (see {@link getRmPages | `getRmPages`} for every page)
|
|
314
|
+
* @returns the parsed page, or `undefined` if the page exists but has no
|
|
315
|
+
* `.rm` drawing (a page you haven't drawn on has no `.rm` file)
|
|
316
|
+
* @throws if `pageId` is not a page of the document
|
|
317
|
+
*/
|
|
318
|
+
getRmPage(id: string, hash: string, pageId: string): Promise<RmPage | undefined>;
|
|
319
|
+
/**
|
|
320
|
+
* get every drawn page of a document, parsed, keyed by page id
|
|
321
|
+
*
|
|
322
|
+
* Returns a map from page id to its parsed {@link RmPage | `RmPage`},
|
|
323
|
+
* iterating in the page order given by the document's `.content`. Pages with
|
|
324
|
+
* no drawing (and soft-deleted pages) are omitted. Version 3, 5, and 6 pages
|
|
325
|
+
* are all supported.
|
|
326
|
+
*
|
|
327
|
+
* @param id - the id of the document (as returned by `listIds`)
|
|
328
|
+
* @param hash - the hash of the document (e.g. from `listItems`)
|
|
329
|
+
* @returns the drawn pages, keyed by page id, in document order
|
|
330
|
+
*/
|
|
331
|
+
getRmPages(id: string, hash: string): Promise<Map<string, RmPage>>;
|
|
332
|
+
/**
|
|
333
|
+
* get a document's entire contents as a zip archive
|
|
334
|
+
*
|
|
335
|
+
* This gets every file associated with a document and puts them into a zip
|
|
336
|
+
* archive.
|
|
292
337
|
*
|
|
293
338
|
* @remarks
|
|
294
|
-
* This is an experimental feature
|
|
295
|
-
*
|
|
296
|
-
* different remarkable, so that functionality is currently disabled.
|
|
339
|
+
* This is an experimental feature. The resulting archive round-trips back
|
|
340
|
+
* through {@link putDocumentArchive | `putDocumentArchive`}.
|
|
297
341
|
*
|
|
298
342
|
* @param id - the id of the document (as returned by `listIds`)
|
|
299
343
|
* @param hash - the hash of the document to get contents for (e.g. the
|
|
300
344
|
* hash received from `listItems`)
|
|
301
345
|
*/
|
|
346
|
+
getDocumentArchive(id: string, hash: string): Promise<Uint8Array>;
|
|
347
|
+
/**
|
|
348
|
+
* upload a document archive produced by {@link getDocumentArchive | `getDocumentArchive`}
|
|
349
|
+
*
|
|
350
|
+
* This explodes the zip archive back into its constituent files, uploads each
|
|
351
|
+
* as a blob, and commits a new document into the root.
|
|
352
|
+
*
|
|
353
|
+
* @remarks
|
|
354
|
+
* This is an experimental feature. By default a fresh document id is generated
|
|
355
|
+
* so re-uploading to the same account doesn't collide with the original; pass
|
|
356
|
+
* {@link PutDocumentOptions.id | `id`} to keep the original id. Like the other
|
|
357
|
+
* low-level puts, this may throw a {@link GenerationError | `GenerationError`}
|
|
358
|
+
* if the generation is stale, requiring a retry.
|
|
359
|
+
*
|
|
360
|
+
* @param buffer - the archive bytes, as returned by `getDocumentArchive`
|
|
361
|
+
* @param options - overrides for parent, visible name, and id
|
|
362
|
+
*/
|
|
363
|
+
putDocumentArchive(buffer: Uint8Array, options?: PutDocumentOptions): Promise<SimpleEntry>;
|
|
364
|
+
/** @deprecated renamed; use {@link getDocumentArchive | `getDocumentArchive`} */
|
|
302
365
|
getDocument(id: string, hash: string): Promise<Uint8Array>;
|
|
366
|
+
/** @deprecated renamed; use {@link putDocumentArchive | `putDocumentArchive`} */
|
|
367
|
+
putDocument(buffer: Uint8Array, options?: PutDocumentOptions): Promise<SimpleEntry>;
|
|
303
368
|
/**
|
|
304
369
|
* use the low-level api to add a pdf document
|
|
305
370
|
*
|
|
@@ -461,14 +526,20 @@ export interface RemarkableApi {
|
|
|
461
526
|
*/
|
|
462
527
|
rename(hash: string, visibleName: string, refresh?: boolean): Promise<HashEntry>;
|
|
463
528
|
/**
|
|
464
|
-
*
|
|
529
|
+
* star or unstar an entry
|
|
465
530
|
*
|
|
466
531
|
* @example
|
|
467
532
|
* ```ts
|
|
468
|
-
* await api.
|
|
533
|
+
* await api.star(file.hash, true);
|
|
469
534
|
* ```
|
|
470
|
-
* @param hash - the hash of the entry to
|
|
471
|
-
* @param
|
|
535
|
+
* @param hash - the hash of the entry to star
|
|
536
|
+
* @param starred - whether the entry should be starred or not
|
|
537
|
+
*/
|
|
538
|
+
star(hash: string, starred: boolean, refresh?: boolean): Promise<HashEntry>;
|
|
539
|
+
/**
|
|
540
|
+
* set if an entry is starred
|
|
541
|
+
*
|
|
542
|
+
* @deprecated misspelling; use {@link star | `star`} instead
|
|
472
543
|
*/
|
|
473
544
|
stared(hash: string, stared: boolean, refresh?: boolean): Promise<HashEntry>;
|
|
474
545
|
/**
|
|
@@ -565,6 +636,26 @@ export interface RemarkableSessionOptions {
|
|
|
565
636
|
* @defaultValue Infinity
|
|
566
637
|
*/
|
|
567
638
|
maxCacheSize?: number;
|
|
639
|
+
/**
|
|
640
|
+
* how many times to retry updating the root hash after a generation conflict
|
|
641
|
+
*
|
|
642
|
+
* High-level mutators re-fetch the latest root and re-apply their change on a
|
|
643
|
+
* {@link GenerationError | `GenerationError`} up to this many times. Because
|
|
644
|
+
* the document id and uploaded blobs are stable across attempts, retries
|
|
645
|
+
* reuse the cache and don't orphan blobs. Set to `0` to surface the error
|
|
646
|
+
* immediately, matching the previous behavior.
|
|
647
|
+
*
|
|
648
|
+
* @defaultValue 10
|
|
649
|
+
*/
|
|
650
|
+
maxGenerationRetries?: number;
|
|
651
|
+
/**
|
|
652
|
+
* how many times to retry a request after a transient network or 5xx error
|
|
653
|
+
*
|
|
654
|
+
* Applies to every request; generation conflicts are not counted here.
|
|
655
|
+
*
|
|
656
|
+
* @defaultValue 3
|
|
657
|
+
*/
|
|
658
|
+
maxTransientRetries?: number;
|
|
568
659
|
}
|
|
569
660
|
/** options for a remarkable instance */
|
|
570
661
|
export interface RemarkableOptions extends AuthOptions, RemarkableSessionOptions {
|
|
@@ -586,7 +677,7 @@ export declare function auth(deviceToken: string, { authHost }?: AuthOptions): P
|
|
|
586
677
|
* @param sessionToken - the session token used for authorization
|
|
587
678
|
* @returns an api instance
|
|
588
679
|
*/
|
|
589
|
-
export declare function session(sessionToken: string, { rawHost, uploadHost, cache, maxCacheSize, }?: RemarkableSessionOptions): RemarkableApi;
|
|
680
|
+
export declare function session(sessionToken: string, { rawHost, uploadHost, cache, maxCacheSize, maxGenerationRetries, maxTransientRetries, }?: RemarkableSessionOptions): RemarkableApi;
|
|
590
681
|
/**
|
|
591
682
|
* create an instance of the api
|
|
592
683
|
*
|