@gardenfi/utils 2.0.5 → 2.0.6
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/index100.cjs +1 -1
- package/dist/index100.js +127 -6
- package/dist/index101.cjs +1 -2
- package/dist/index101.js +113 -3
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +75 -109
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +2 -79
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +18 -2
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +15 -14
- package/dist/index106.cjs +1 -1
- package/dist/index106.js +16 -18
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +220 -13
- package/dist/index108.cjs +2 -1
- package/dist/index108.js +3 -224
- package/dist/index115.cjs +1 -1
- package/dist/index115.js +1 -1
- package/dist/index117.cjs +1 -1
- package/dist/index117.js +1 -1
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +8 -8
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +1 -1
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +1 -1
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +1 -1
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +1 -1
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +1 -1
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +1 -1
- package/dist/index50.cjs +2 -1
- package/dist/index50.js +34 -3
- package/dist/index51.cjs +1 -2
- package/dist/index51.js +5 -34
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +3 -5
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +1 -1
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +2 -2
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +1 -1
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +3 -3
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +3 -5
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +13 -8
- package/dist/index71.cjs +1 -1
- package/dist/index71.js +41 -3
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +5 -13
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +8 -41
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +1 -1
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +11 -24
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +25 -6
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +6 -13
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +13 -15
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +15 -5
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +5 -13
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +12 -9
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +10 -16
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +15 -170
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +171 -8
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +37 -11
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +8 -104
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +5 -39
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +11 -2
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +2 -5
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +104 -10
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +1 -1
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +7 -5
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +5 -38
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +36 -126
- package/package.json +1 -1
package/dist/index99.js
CHANGED
|
@@ -1,130 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (t < 0)
|
|
34
|
-
throw new o({ offset: t });
|
|
35
|
-
const i = this.position + t;
|
|
36
|
-
this.assertPosition(i), this.position = i;
|
|
37
|
-
},
|
|
38
|
-
inspectByte(t) {
|
|
39
|
-
const i = t ?? this.position;
|
|
40
|
-
return this.assertPosition(i), this.bytes[i];
|
|
41
|
-
},
|
|
42
|
-
inspectBytes(t, i) {
|
|
43
|
-
const s = i ?? this.position;
|
|
44
|
-
return this.assertPosition(s + t - 1), this.bytes.subarray(s, s + t);
|
|
45
|
-
},
|
|
46
|
-
inspectUint8(t) {
|
|
47
|
-
const i = t ?? this.position;
|
|
48
|
-
return this.assertPosition(i), this.bytes[i];
|
|
49
|
-
},
|
|
50
|
-
inspectUint16(t) {
|
|
51
|
-
const i = t ?? this.position;
|
|
52
|
-
return this.assertPosition(i + 1), this.dataView.getUint16(i);
|
|
53
|
-
},
|
|
54
|
-
inspectUint24(t) {
|
|
55
|
-
const i = t ?? this.position;
|
|
56
|
-
return this.assertPosition(i + 2), (this.dataView.getUint16(i) << 8) + this.dataView.getUint8(i + 2);
|
|
57
|
-
},
|
|
58
|
-
inspectUint32(t) {
|
|
59
|
-
const i = t ?? this.position;
|
|
60
|
-
return this.assertPosition(i + 3), this.dataView.getUint32(i);
|
|
61
|
-
},
|
|
62
|
-
pushByte(t) {
|
|
63
|
-
this.assertPosition(this.position), this.bytes[this.position] = t, this.position++;
|
|
64
|
-
},
|
|
65
|
-
pushBytes(t) {
|
|
66
|
-
this.assertPosition(this.position + t.length - 1), this.bytes.set(t, this.position), this.position += t.length;
|
|
67
|
-
},
|
|
68
|
-
pushUint8(t) {
|
|
69
|
-
this.assertPosition(this.position), this.bytes[this.position] = t, this.position++;
|
|
70
|
-
},
|
|
71
|
-
pushUint16(t) {
|
|
72
|
-
this.assertPosition(this.position + 1), this.dataView.setUint16(this.position, t), this.position += 2;
|
|
73
|
-
},
|
|
74
|
-
pushUint24(t) {
|
|
75
|
-
this.assertPosition(this.position + 2), this.dataView.setUint16(this.position, t >> 8), this.dataView.setUint8(this.position + 2, t & 255), this.position += 3;
|
|
76
|
-
},
|
|
77
|
-
pushUint32(t) {
|
|
78
|
-
this.assertPosition(this.position + 3), this.dataView.setUint32(this.position, t), this.position += 4;
|
|
79
|
-
},
|
|
80
|
-
readByte() {
|
|
81
|
-
this.assertReadLimit(), this._touch();
|
|
82
|
-
const t = this.inspectByte();
|
|
83
|
-
return this.position++, t;
|
|
84
|
-
},
|
|
85
|
-
readBytes(t, i) {
|
|
86
|
-
this.assertReadLimit(), this._touch();
|
|
87
|
-
const s = this.inspectBytes(t);
|
|
88
|
-
return this.position += i ?? t, s;
|
|
89
|
-
},
|
|
90
|
-
readUint8() {
|
|
91
|
-
this.assertReadLimit(), this._touch();
|
|
92
|
-
const t = this.inspectUint8();
|
|
93
|
-
return this.position += 1, t;
|
|
94
|
-
},
|
|
95
|
-
readUint16() {
|
|
96
|
-
this.assertReadLimit(), this._touch();
|
|
97
|
-
const t = this.inspectUint16();
|
|
98
|
-
return this.position += 2, t;
|
|
99
|
-
},
|
|
100
|
-
readUint24() {
|
|
101
|
-
this.assertReadLimit(), this._touch();
|
|
102
|
-
const t = this.inspectUint24();
|
|
103
|
-
return this.position += 3, t;
|
|
104
|
-
},
|
|
105
|
-
readUint32() {
|
|
106
|
-
this.assertReadLimit(), this._touch();
|
|
107
|
-
const t = this.inspectUint32();
|
|
108
|
-
return this.position += 4, t;
|
|
109
|
-
},
|
|
110
|
-
get remaining() {
|
|
111
|
-
return this.bytes.length - this.position;
|
|
112
|
-
},
|
|
113
|
-
setPosition(t) {
|
|
114
|
-
const i = this.position;
|
|
115
|
-
return this.assertPosition(t), this.position = t, () => this.position = i;
|
|
116
|
-
},
|
|
117
|
-
_touch() {
|
|
118
|
-
if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)
|
|
119
|
-
return;
|
|
120
|
-
const t = this.getReadCount();
|
|
121
|
-
this.positionReadCount.set(this.position, t + 1), t > 0 && this.recursiveReadCount++;
|
|
1
|
+
import { versionedHashVersionKzg as a } from "./index103.js";
|
|
2
|
+
import { BaseError as s } from "./index43.js";
|
|
3
|
+
class t extends s {
|
|
4
|
+
constructor({ maxSize: e, size: r }) {
|
|
5
|
+
super("Blob size is too large.", {
|
|
6
|
+
metaMessages: [`Max: ${e} bytes`, `Given: ${r} bytes`],
|
|
7
|
+
name: "BlobSizeTooLargeError"
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
class d extends s {
|
|
12
|
+
constructor() {
|
|
13
|
+
super("Blob data must not be empty.", { name: "EmptyBlobError" });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class l extends s {
|
|
17
|
+
constructor({ hash: e, size: r }) {
|
|
18
|
+
super(`Versioned hash "${e}" size is invalid.`, {
|
|
19
|
+
metaMessages: ["Expected: 32", `Received: ${r}`],
|
|
20
|
+
name: "InvalidVersionedHashSizeError"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class c extends s {
|
|
25
|
+
constructor({ hash: e, version: r }) {
|
|
26
|
+
super(`Versioned hash "${e}" version is invalid.`, {
|
|
27
|
+
metaMessages: [
|
|
28
|
+
`Expected: ${a}`,
|
|
29
|
+
`Received: ${r}`
|
|
30
|
+
],
|
|
31
|
+
name: "InvalidVersionedHashVersionError"
|
|
32
|
+
});
|
|
122
33
|
}
|
|
123
|
-
};
|
|
124
|
-
function a(t, { recursiveReadLimit: i = 8192 } = {}) {
|
|
125
|
-
const s = Object.create(h);
|
|
126
|
-
return s.bytes = t, s.dataView = new DataView(t.buffer, t.byteOffset, t.byteLength), s.positionReadCount = /* @__PURE__ */ new Map(), s.recursiveReadLimit = i, s;
|
|
127
34
|
}
|
|
128
35
|
export {
|
|
129
|
-
|
|
36
|
+
t as BlobSizeTooLargeError,
|
|
37
|
+
d as EmptyBlobError,
|
|
38
|
+
l as InvalidVersionedHashSizeError,
|
|
39
|
+
c as InvalidVersionedHashVersionError
|
|
130
40
|
};
|