rmapi-js 4.0.1 → 5.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/index.d.ts +1 -1
- package/dist/index.js +9 -4
- package/dist/index.spec.d.ts +1 -0
- package/dist/index.spec.js +800 -0
- package/dist/rmapi-js.esm.min.js +1 -0
- package/dist/test-utils.d.ts +22 -0
- package/dist/test-utils.js +71 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -3
- package/dist/utils.spec.d.ts +1 -0
- package/dist/utils.spec.js +21 -0
- package/dist/validate.spec.d.ts +1 -0
- package/dist/validate.spec.js +15 -0
- package/package.json +17 -129
- package/CHANGELOG.md +0 -93
- package/bundle/rmapi-js.cjs.min.js +0 -12
- package/bundle/rmapi-js.esm.min.js +0 -12
- package/bundle/rmapi-js.iife.min.js +0 -12
package/dist/index.d.ts
CHANGED
|
@@ -234,7 +234,7 @@ export interface CacheLike {
|
|
|
234
234
|
/** stripped down version of subtle crypto */
|
|
235
235
|
export interface SubtleCryptoLike {
|
|
236
236
|
/** a digest function */
|
|
237
|
-
digest(algorithm: "SHA-256", data:
|
|
237
|
+
digest(algorithm: "SHA-256", data: BufferSource): Promise<ArrayBuffer>;
|
|
238
238
|
}
|
|
239
239
|
/** an error that results from a failed request */
|
|
240
240
|
export declare class ResponseError extends Error {
|
package/dist/index.js
CHANGED
|
@@ -52,6 +52,7 @@ const GENERATION_HEADER = "x-goog-generation";
|
|
|
52
52
|
const GENERATION_RACE_HEADER = "x-goog-if-generation-match";
|
|
53
53
|
const CONTENT_LENGTH_RANGE_HEADER = "x-goog-content-length-range";
|
|
54
54
|
/** tool options */
|
|
55
|
+
/* eslint-disable spellcheck/spell-checker */
|
|
55
56
|
export const builtinTools = [
|
|
56
57
|
"Ballpoint",
|
|
57
58
|
"Ballpointv2",
|
|
@@ -74,7 +75,9 @@ export const builtinTools = [
|
|
|
74
75
|
"SolidPen",
|
|
75
76
|
"ZoomTool",
|
|
76
77
|
];
|
|
78
|
+
/* eslint-enable spellcheck/spell-checker */
|
|
77
79
|
/** font name options */
|
|
80
|
+
/* eslint-disable spellcheck/spell-checker */
|
|
78
81
|
export const builtinFontNames = [
|
|
79
82
|
"Maison Neue",
|
|
80
83
|
"EB Garamond",
|
|
@@ -83,6 +86,7 @@ export const builtinFontNames = [
|
|
|
83
86
|
"Noto Mono",
|
|
84
87
|
"Noto Sans UI",
|
|
85
88
|
];
|
|
89
|
+
/* eslint-enable spellcheck/spell-checker */
|
|
86
90
|
/** text scale options */
|
|
87
91
|
export const builtinTextScales = {
|
|
88
92
|
/** the smallest */
|
|
@@ -550,10 +554,10 @@ class Remarkable {
|
|
|
550
554
|
entries.sort((a, b) => a.documentId.localeCompare(b.documentId));
|
|
551
555
|
const hashes = concatBuffers(entries.map((ent) => fromHex(ent.hash)));
|
|
552
556
|
const digest = await this.#subtle.digest("SHA-256", hashes);
|
|
553
|
-
const hash = toHex(digest);
|
|
557
|
+
const hash = toHex(new Uint8Array(digest));
|
|
554
558
|
const entryContents = entries.map(formatEntry).join("");
|
|
555
559
|
const contents = `${SCHEMA_VERSION}\n${entryContents}`;
|
|
556
|
-
const buffer = enc.encode(contents);
|
|
560
|
+
const buffer = enc.encode(contents).buffer;
|
|
557
561
|
await this.#putHash(hash, buffer);
|
|
558
562
|
return {
|
|
559
563
|
hash,
|
|
@@ -566,7 +570,7 @@ class Remarkable {
|
|
|
566
570
|
/** put a raw buffer in the cloud */
|
|
567
571
|
async putBuffer(documentId, buffer) {
|
|
568
572
|
const digest = await this.#subtle.digest("SHA-256", buffer);
|
|
569
|
-
const hash = toHex(digest);
|
|
573
|
+
const hash = toHex(new Uint8Array(digest));
|
|
570
574
|
await this.#putHash(hash, buffer);
|
|
571
575
|
return {
|
|
572
576
|
hash,
|
|
@@ -579,7 +583,8 @@ class Remarkable {
|
|
|
579
583
|
/** put text in the cloud */
|
|
580
584
|
async putText(documentId, contents) {
|
|
581
585
|
const enc = new TextEncoder();
|
|
582
|
-
|
|
586
|
+
const encoded = enc.encode(contents).buffer;
|
|
587
|
+
return await this.putBuffer(documentId, encoded);
|
|
583
588
|
}
|
|
584
589
|
/** put json in the cloud */
|
|
585
590
|
async putJson(documentId, contents) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|