@leofcoin/chain 1.6.8 → 1.6.10
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/exports/browser/browser-store.js +14 -11
- package/exports/browser/chain.js +688 -686
- package/exports/chain.d.ts +3 -2
- package/exports/chain.js +29 -11
- package/exports/contract.d.ts +3 -3
- package/exports/machine.d.ts +1 -0
- package/exports/transaction.d.ts +1 -1
- package/package.json +1 -1
|
@@ -118,6 +118,8 @@ class BrowerStore {
|
|
|
118
118
|
create: true
|
|
119
119
|
});
|
|
120
120
|
if (inWorker) {
|
|
121
|
+
// it's in a worker so that's why typings invalid?
|
|
122
|
+
// @ts-ignore
|
|
121
123
|
directoryHandle = await directoryHandle.createSyncAccessHandle();
|
|
122
124
|
}
|
|
123
125
|
}
|
|
@@ -152,11 +154,16 @@ class BrowerStore {
|
|
|
152
154
|
let handle = await this.db.getFileHandle(this.toKeyPath(key));
|
|
153
155
|
let readBuffer;
|
|
154
156
|
if (this.inWorker) {
|
|
157
|
+
// it's in a worker so that's why typings invalid?
|
|
158
|
+
// @ts-ignore
|
|
155
159
|
handle = await handle.createSyncAccessHandle();
|
|
160
|
+
// @ts-ignore
|
|
156
161
|
const fileSize = handle.getSize();
|
|
157
162
|
// Read file content to a buffer.
|
|
158
163
|
const buffer = new DataView(new ArrayBuffer(fileSize));
|
|
164
|
+
// @ts-ignore
|
|
159
165
|
readBuffer = handle.read(buffer, { at: 0 });
|
|
166
|
+
// @ts-ignore
|
|
160
167
|
handle.close();
|
|
161
168
|
}
|
|
162
169
|
else {
|
|
@@ -171,6 +178,8 @@ class BrowerStore {
|
|
|
171
178
|
let handle = await this.db.getFileHandle(this.toKeyPath(key), { create: true });
|
|
172
179
|
let writeable;
|
|
173
180
|
if (this.inWorker) {
|
|
181
|
+
// it's in a worker so that's why typings invalid?
|
|
182
|
+
// @ts-ignore
|
|
174
183
|
writeable = await handle.createSyncAccessHandle();
|
|
175
184
|
}
|
|
176
185
|
else {
|
|
@@ -203,31 +212,25 @@ class BrowerStore {
|
|
|
203
212
|
return this.db.removeEntry(this.toKeyPath(key));
|
|
204
213
|
}
|
|
205
214
|
async clear() {
|
|
206
|
-
debug(`clear ${this.toKeyPath(key)}`);
|
|
207
215
|
for await (const key of this.db.keys()) {
|
|
216
|
+
debug(`clear ${this.toKeyPath(key)}`);
|
|
208
217
|
await this.db.removeEntry(key);
|
|
209
218
|
}
|
|
210
219
|
}
|
|
211
|
-
async values(
|
|
212
|
-
debug(`values ${limit}`);
|
|
220
|
+
async values() {
|
|
213
221
|
let values = [];
|
|
214
222
|
for await (const cursor of this.db.values()) {
|
|
223
|
+
// huh? Outdated typings?
|
|
224
|
+
// @ts-ignore
|
|
215
225
|
values.push(cursor.getFile());
|
|
216
|
-
if (limit && values.length === limit) {
|
|
217
|
-
values = await Promise.all(values);
|
|
218
|
-
return Promise.all(values.map(async (file) => new Uint8Array(await file.arrayBuffer())));
|
|
219
|
-
}
|
|
220
226
|
}
|
|
221
227
|
values = await Promise.all(values);
|
|
222
228
|
return Promise.all(values.map(async (file) => new Uint8Array(await file.arrayBuffer())));
|
|
223
229
|
}
|
|
224
|
-
async keys(
|
|
225
|
-
debug(`keys ${limit}`);
|
|
230
|
+
async keys() {
|
|
226
231
|
const keys = [];
|
|
227
232
|
for await (const cursor of this.db.keys()) {
|
|
228
233
|
keys.push(cursor);
|
|
229
|
-
if (limit && keys.length === limit)
|
|
230
|
-
return keys;
|
|
231
234
|
}
|
|
232
235
|
return keys;
|
|
233
236
|
}
|