@peerbit/any-store-interface 1.0.0 → 1.0.1-d375893
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/src/messages.d.ts.map +1 -1
- package/package.json +77 -70
- package/dist/src/interface.d.ts +0 -19
- package/dist/src/interface.d.ts.map +0 -1
- package/dist/src/interface.js +0 -2
- package/dist/src/interface.js.map +0 -1
- package/dist/src/level.d.ts +0 -17
- package/dist/src/level.d.ts.map +0 -1
- package/dist/src/level.js +0 -112
- package/dist/src/level.js.map +0 -1
- package/dist/src/memory.d.ts +0 -18
- package/dist/src/memory.d.ts.map +0 -1
- package/dist/src/memory.js +0 -63
- package/dist/src/memory.js.map +0 -1
- package/dist/src/opfs-worker-messages.d.ts +0 -123
- package/dist/src/opfs-worker-messages.d.ts.map +0 -1
- package/dist/src/opfs-worker-messages.js +0 -325
- package/dist/src/opfs-worker-messages.js.map +0 -1
- package/dist/src/opfs-worker.d.ts +0 -9
- package/dist/src/opfs-worker.d.ts.map +0 -1
- package/dist/src/opfs-worker.js +0 -277
- package/dist/src/opfs-worker.js.map +0 -1
- package/dist/src/opfs.d.ts +0 -28
- package/dist/src/opfs.d.ts.map +0 -1
- package/dist/src/opfs.js +0 -149
- package/dist/src/opfs.js.map +0 -1
- package/dist/src/store.browser.d.ts +0 -4
- package/dist/src/store.browser.d.ts.map +0 -1
- package/dist/src/store.browser.js +0 -9
- package/dist/src/store.browser.js.map +0 -1
- package/dist/src/store.d.ts +0 -4
- package/dist/src/store.d.ts.map +0 -1
- package/dist/src/store.js +0 -14
- package/dist/src/store.js.map +0 -1
package/dist/src/opfs.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import {} from "./interface.js";
|
|
2
|
-
import * as memory from "./opfs-worker-messages.js";
|
|
3
|
-
import { v4 as uuid } from "uuid";
|
|
4
|
-
import { serialize, deserialize } from "@dao-xyz/borsh";
|
|
5
|
-
import workerUrl from "./opfs-worker?worker&url";
|
|
6
|
-
function memoryIterator(client, level) {
|
|
7
|
-
return {
|
|
8
|
-
[Symbol.asyncIterator]() {
|
|
9
|
-
const iteratorId = uuid();
|
|
10
|
-
return {
|
|
11
|
-
next: async () => {
|
|
12
|
-
const resp = await client.request(new memory.REQ_Iterator_Next({ id: iteratorId, level }));
|
|
13
|
-
if (resp.keys.length > 1) {
|
|
14
|
-
throw new Error("Unsupported iteration response");
|
|
15
|
-
}
|
|
16
|
-
// Will only have 0 or 1 element for now
|
|
17
|
-
for (let i = 0; i < resp.keys.length; i++) {
|
|
18
|
-
return {
|
|
19
|
-
done: false,
|
|
20
|
-
value: [resp.keys[i], resp.values[i]]
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
return { done: true, value: undefined };
|
|
24
|
-
},
|
|
25
|
-
async return() {
|
|
26
|
-
await client.request(new memory.REQ_Iterator_Stop({ id: iteratorId, level }));
|
|
27
|
-
return { done: true, value: undefined };
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const createWorker = (directory) => {
|
|
34
|
-
const workerURL = workerUrl + "#" + directory;
|
|
35
|
-
return new Worker(workerURL, { type: "module" });
|
|
36
|
-
};
|
|
37
|
-
export class OPFSStore {
|
|
38
|
-
directory;
|
|
39
|
-
worker;
|
|
40
|
-
levelMap;
|
|
41
|
-
root;
|
|
42
|
-
_responseCallbacks = new Map();
|
|
43
|
-
_createStorage;
|
|
44
|
-
constructor(directory) {
|
|
45
|
-
this.directory = directory;
|
|
46
|
-
this.levelMap = new Map();
|
|
47
|
-
this._createStorage = (level = []) => {
|
|
48
|
-
return {
|
|
49
|
-
clear: async () => {
|
|
50
|
-
await this.request(new memory.REQ_Clear({ level }));
|
|
51
|
-
},
|
|
52
|
-
del: async (key) => {
|
|
53
|
-
await this.request(new memory.REQ_Del({ level, key }));
|
|
54
|
-
},
|
|
55
|
-
get: async (key) => {
|
|
56
|
-
return (await this.request(new memory.REQ_Get({ level, key }))).bytes;
|
|
57
|
-
},
|
|
58
|
-
put: async (key, value) => {
|
|
59
|
-
await this.request(new memory.REQ_Put({ level, key, bytes: value }));
|
|
60
|
-
},
|
|
61
|
-
status: async () => (await this.request(new memory.REQ_Status({ level }))).status,
|
|
62
|
-
sublevel: async (name) => {
|
|
63
|
-
await this.request(new memory.REQ_Sublevel({ level, name }));
|
|
64
|
-
const newLevels = [...level, name];
|
|
65
|
-
const sublevel = this._createStorage(newLevels);
|
|
66
|
-
this.levelMap.set(memory.levelKey(newLevels), sublevel);
|
|
67
|
-
return sublevel;
|
|
68
|
-
},
|
|
69
|
-
iterator: () => memoryIterator(this, level),
|
|
70
|
-
close: async () => {
|
|
71
|
-
await this.request(new memory.REQ_Close({ level }));
|
|
72
|
-
/* this.levelMap.delete(memory.levelKey(level)); */
|
|
73
|
-
},
|
|
74
|
-
open: async () => {
|
|
75
|
-
await this.request(new memory.REQ_Open({ level }));
|
|
76
|
-
},
|
|
77
|
-
size: async () => {
|
|
78
|
-
const size = await this.request(new memory.REQ_Size({ level }));
|
|
79
|
-
return size.size;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
status() {
|
|
85
|
-
return this.worker ? this.root.status() : "closed";
|
|
86
|
-
}
|
|
87
|
-
async close() {
|
|
88
|
-
this.worker.terminate();
|
|
89
|
-
this.worker = undefined;
|
|
90
|
-
this._responseCallbacks.clear();
|
|
91
|
-
this.levelMap.clear();
|
|
92
|
-
}
|
|
93
|
-
async open() {
|
|
94
|
-
if (!this.worker) {
|
|
95
|
-
if (!globalThis["__playwright_test__"] &&
|
|
96
|
-
(await navigator.storage.persist()) === false) {
|
|
97
|
-
throw new Error("OPFS not allowed to persist data");
|
|
98
|
-
}
|
|
99
|
-
this.worker = createWorker(this.directory);
|
|
100
|
-
this.root = this._createStorage([]);
|
|
101
|
-
this.worker.addEventListener("message", async (ev) => {
|
|
102
|
-
const message = deserialize(ev.data, memory.MemoryMessage);
|
|
103
|
-
this._responseCallbacks.get(message.messageId).fn(message);
|
|
104
|
-
});
|
|
105
|
-
await this.root.open();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
get(key) {
|
|
109
|
-
return this.root.get(key);
|
|
110
|
-
}
|
|
111
|
-
put(key, value) {
|
|
112
|
-
return this.root.put(key, value);
|
|
113
|
-
}
|
|
114
|
-
del(key) {
|
|
115
|
-
return this.root.del(key);
|
|
116
|
-
}
|
|
117
|
-
sublevel(name) {
|
|
118
|
-
return this.root.sublevel(name);
|
|
119
|
-
}
|
|
120
|
-
iterator() {
|
|
121
|
-
return this.root.iterator();
|
|
122
|
-
}
|
|
123
|
-
clear() {
|
|
124
|
-
return this.root.clear();
|
|
125
|
-
}
|
|
126
|
-
size() {
|
|
127
|
-
return this.root.size();
|
|
128
|
-
}
|
|
129
|
-
async request(request) {
|
|
130
|
-
return new Promise((resolve, reject) => {
|
|
131
|
-
const onResponse = (message) => {
|
|
132
|
-
this._responseCallbacks.delete(request.messageId);
|
|
133
|
-
if (message instanceof memory.RESP_Error) {
|
|
134
|
-
reject(new Error(message.error));
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
resolve(message);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
this._responseCallbacks.set(request.messageId, {
|
|
141
|
-
fn: onResponse,
|
|
142
|
-
once: true
|
|
143
|
-
});
|
|
144
|
-
const bytes = serialize(request);
|
|
145
|
-
this.worker.postMessage(bytes, [bytes.buffer]);
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
//# sourceMappingURL=opfs.js.map
|
package/dist/src/opfs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opfs.js","sourceRoot":"","sources":["../../src/opfs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD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AS,EAAE;gBAC9C,EAAE,EAAE,UAAU;gBACd,IAAI,EAAE,IAAI;aACV,CAAC,CAAC;YACH,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;YACjC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACJ,CAAC;CACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.browser.d.ts","sourceRoot":"","sources":["../../src/store.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,eAAO,MAAM,WAAW,eAAgB,MAAM,4BAE7C,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { MemoryStore } from "./memory.js";
|
|
2
|
-
import { OPFSStore } from "./opfs.js";
|
|
3
|
-
export const createStore = (directory) => {
|
|
4
|
-
return directory ? new OPFSStore(directory) : new MemoryStore();
|
|
5
|
-
};
|
|
6
|
-
/* export const estimate = (directory: string): Promise<{ quota?: number, usage?: number }> => {
|
|
7
|
-
return navigator.storage.estimate().then(x => { return { quota: x.quota, usage: x.usage } })
|
|
8
|
-
} */
|
|
9
|
-
//# sourceMappingURL=store.browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.browser.js","sourceRoot":"","sources":["../../src/store.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,SAAkB,EAAE,EAAE;IACjD,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC;AACjE,CAAC,CAAC;AAEF;;IAEI"}
|
package/dist/src/store.d.ts
DELETED
package/dist/src/store.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,eAAO,MAAM,WAAW,eAAgB,MAAM,6BAI7C,CAAC"}
|
package/dist/src/store.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { LevelStore } from "./level.js";
|
|
2
|
-
import { Level } from "level";
|
|
3
|
-
import { MemoryStore } from "./memory.js";
|
|
4
|
-
/* import os from 'os'
|
|
5
|
-
import { check } from 'diskusage' */
|
|
6
|
-
export const createStore = (directory) => {
|
|
7
|
-
return directory
|
|
8
|
-
? new LevelStore(new Level(directory, { valueEncoding: "view" }))
|
|
9
|
-
: new MemoryStore();
|
|
10
|
-
};
|
|
11
|
-
/* export const estimate = (directory: string): Promise<{ quota?: number, usage?: number }> => {
|
|
12
|
-
return check(directory).then(x => { return { quota: x.total, usage: x.total - x.free } })
|
|
13
|
-
} */
|
|
14
|
-
//# sourceMappingURL=store.js.map
|
package/dist/src/store.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C;oCACoC;AAEpC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,SAAkB,EAAE,EAAE;IACjD,OAAO,SAAS;QACf,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC;QACjE,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC;AACtB,CAAC,CAAC;AAEF;;IAEI"}
|