rmapi-js 9.0.1 → 9.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/dist/raw.d.ts +1 -1
- package/dist/raw.js +3 -3
- package/dist/rmapi-js.esm.min.js +11 -11
- package/package.json +12 -9
- package/dist/error.d.ts +0 -14
- package/dist/error.js +0 -21
- package/dist/lru.d.ts +0 -8
- package/dist/lru.js +0 -64
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +0 -10
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rmapi-js",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.3",
|
|
4
4
|
"description": "JavaScript implementation of the reMarkable 1.5 api",
|
|
5
|
-
"repository":
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+ssh://git@github.com/erikbrinkman/rmapi-js.git"
|
|
8
|
+
},
|
|
6
9
|
"author": "Erik Brinkman <erik.brinkman@gmail.com>",
|
|
7
10
|
"license": "MIT",
|
|
8
11
|
"keywords": [
|
|
@@ -25,20 +28,20 @@
|
|
|
25
28
|
"prepack": "bun lint && bun test --coverage && bun export"
|
|
26
29
|
},
|
|
27
30
|
"dependencies": {
|
|
28
|
-
"core-js": "^3.
|
|
31
|
+
"core-js": "^3.49.0",
|
|
29
32
|
"crc-32": "^1.2.2",
|
|
30
33
|
"json-stable-stringify": "^1.3.0",
|
|
31
34
|
"jszip": "^3.10.1",
|
|
32
35
|
"jtd-ts": "^0.2.1",
|
|
33
|
-
"uuid": "^
|
|
36
|
+
"uuid": "^14.0.0"
|
|
34
37
|
},
|
|
35
38
|
"devDependencies": {
|
|
36
|
-
"@biomejs/biome": "^2.
|
|
37
|
-
"@types/bun": "^1.3.
|
|
39
|
+
"@biomejs/biome": "^2.4.12",
|
|
40
|
+
"@types/bun": "^1.3.12",
|
|
38
41
|
"@types/json-stable-stringify": "^1.2.0",
|
|
39
42
|
"@types/uuid": "^11.0.0",
|
|
40
|
-
"typedoc-plugin-markdown": "^4.
|
|
41
|
-
"typedoc": "^0.28.
|
|
42
|
-
"typescript": "~
|
|
43
|
+
"typedoc-plugin-markdown": "^4.11.0",
|
|
44
|
+
"typedoc": "^0.28.19",
|
|
45
|
+
"typescript": "~6.0.3"
|
|
43
46
|
}
|
|
44
47
|
}
|
package/dist/error.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/** an error that results from a failed request */
|
|
2
|
-
export declare class ValidationError extends Error {
|
|
3
|
-
/** the response status number */
|
|
4
|
-
readonly field: string;
|
|
5
|
-
/** the response status text */
|
|
6
|
-
readonly regex: RegExp;
|
|
7
|
-
constructor(field: string, regex: RegExp, message: string);
|
|
8
|
-
}
|
|
9
|
-
/** an error that results while supplying a hash not found in the entries of the root hash */
|
|
10
|
-
export declare class HashNotFoundError extends Error {
|
|
11
|
-
/** the hash that couldn't be found */
|
|
12
|
-
readonly hash: string;
|
|
13
|
-
constructor(hash: string);
|
|
14
|
-
}
|
package/dist/error.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/** an error that results from a failed request */
|
|
2
|
-
export class ValidationError extends Error {
|
|
3
|
-
/** the response status number */
|
|
4
|
-
field;
|
|
5
|
-
/** the response status text */
|
|
6
|
-
regex;
|
|
7
|
-
constructor(field, regex, message) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.field = field;
|
|
10
|
-
this.regex = regex;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
/** an error that results while supplying a hash not found in the entries of the root hash */
|
|
14
|
-
export class HashNotFoundError extends Error {
|
|
15
|
-
/** the hash that couldn't be found */
|
|
16
|
-
hash;
|
|
17
|
-
constructor(hash) {
|
|
18
|
-
super(`'${hash}' not found in the root hash`);
|
|
19
|
-
this.hash = hash;
|
|
20
|
-
}
|
|
21
|
-
}
|
package/dist/lru.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare class LruCache extends Map<string, string | null> {
|
|
2
|
-
#private;
|
|
3
|
-
constructor(maxSize: number, entries?: Iterable<[string, string | null]>);
|
|
4
|
-
get(key: string): string | null | undefined;
|
|
5
|
-
set(key: string, value: string | null): this;
|
|
6
|
-
delete(key: string): boolean;
|
|
7
|
-
clear(): void;
|
|
8
|
-
}
|
package/dist/lru.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
export class LruCache extends Map {
|
|
2
|
-
#maxSize;
|
|
3
|
-
#currentSize = 0;
|
|
4
|
-
constructor(maxSize, entries = []) {
|
|
5
|
-
super();
|
|
6
|
-
this.#maxSize = maxSize;
|
|
7
|
-
for (const [key, value] of entries) {
|
|
8
|
-
this.set(key, value);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
get(key) {
|
|
12
|
-
const res = super.get(key);
|
|
13
|
-
if (res !== undefined) {
|
|
14
|
-
// update order so key is most recent
|
|
15
|
-
super.delete(key);
|
|
16
|
-
super.set(key, res);
|
|
17
|
-
}
|
|
18
|
-
return res;
|
|
19
|
-
}
|
|
20
|
-
set(key, value) {
|
|
21
|
-
const existing = super.get(key);
|
|
22
|
-
if (existing === undefined) {
|
|
23
|
-
this.#currentSize += key.length; // adding a new key
|
|
24
|
-
}
|
|
25
|
-
else if (existing !== null) {
|
|
26
|
-
this.#currentSize -= existing.length; // removing old value
|
|
27
|
-
}
|
|
28
|
-
if (value !== null) {
|
|
29
|
-
this.#currentSize += value.length;
|
|
30
|
-
}
|
|
31
|
-
// delete existing value
|
|
32
|
-
super.delete(key);
|
|
33
|
-
// evict down to desired size
|
|
34
|
-
let entry;
|
|
35
|
-
while (this.#currentSize > this.#maxSize &&
|
|
36
|
-
(entry = this.entries().next().value)) {
|
|
37
|
-
const [oldestKey, oldestValue] = entry;
|
|
38
|
-
super.delete(oldestKey);
|
|
39
|
-
this.#currentSize -= oldestKey.length;
|
|
40
|
-
if (oldestValue !== null) {
|
|
41
|
-
this.#currentSize -= oldestValue.length;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
// finally insert new key and return
|
|
45
|
-
super.set(key, value);
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
delete(key) {
|
|
49
|
-
const value = super.get(key);
|
|
50
|
-
if (value === undefined) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
super.delete(key);
|
|
54
|
-
if (value !== null) {
|
|
55
|
-
this.#currentSize -= value.length;
|
|
56
|
-
}
|
|
57
|
-
this.#currentSize -= key.length;
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
clear() {
|
|
61
|
-
super.clear();
|
|
62
|
-
this.#currentSize = 0;
|
|
63
|
-
}
|
|
64
|
-
}
|
package/dist/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function concatArrays(arrays: Uint8Array[]): Uint8Array;
|
package/dist/utils.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function concatArrays(arrays) {
|
|
2
|
-
const totalLength = arrays.reduce((acc, arr) => acc + arr.length, 0);
|
|
3
|
-
const result = new Uint8Array(totalLength);
|
|
4
|
-
let offset = 0;
|
|
5
|
-
for (const arr of arrays) {
|
|
6
|
-
result.set(arr, offset);
|
|
7
|
-
offset += arr.length;
|
|
8
|
-
}
|
|
9
|
-
return result;
|
|
10
|
-
}
|