@xyo-network/previous-hash-store-storage 7.0.13 → 7.0.15
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/neutral/index.d.ts +1 -2
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +2 -103
- package/dist/neutral/index.mjs.map +3 -3
- package/package.json +32 -11
- package/dist/neutral/NamespacedStorage.d.ts +0 -10
- package/dist/neutral/NamespacedStorage.d.ts.map +0 -1
- package/dist/neutral/StoragePreviousHashStore.d.ts +0 -24
- package/dist/neutral/StoragePreviousHashStore.d.ts.map +0 -1
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,uDAAuD,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,104 +1,3 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
|
|
3
|
-
data = /* @__PURE__ */ new Map();
|
|
4
|
-
get(key) {
|
|
5
|
-
return this.data.get(key) ?? null;
|
|
6
|
-
}
|
|
7
|
-
remove(key) {
|
|
8
|
-
this.data.delete(key);
|
|
9
|
-
}
|
|
10
|
-
set(key, value) {
|
|
11
|
-
this.data.set(key, value);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
var WebStorageBackend = class {
|
|
15
|
-
storage;
|
|
16
|
-
constructor(storage) {
|
|
17
|
-
this.storage = storage;
|
|
18
|
-
}
|
|
19
|
-
get(key) {
|
|
20
|
-
return this.storage.getItem(key);
|
|
21
|
-
}
|
|
22
|
-
remove(key) {
|
|
23
|
-
this.storage.removeItem(key);
|
|
24
|
-
}
|
|
25
|
-
set(key, value) {
|
|
26
|
-
this.storage.setItem(key, value);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var pageBackend = new InMemoryBackend();
|
|
30
|
-
var localBackend;
|
|
31
|
-
var sessionBackend;
|
|
32
|
-
function getBackend(area) {
|
|
33
|
-
if (area === "page") return pageBackend;
|
|
34
|
-
const g = globalThis;
|
|
35
|
-
if (area === "local") {
|
|
36
|
-
if (localBackend) return localBackend;
|
|
37
|
-
localBackend = g.localStorage ? new WebStorageBackend(g.localStorage) : new InMemoryBackend();
|
|
38
|
-
return localBackend;
|
|
39
|
-
}
|
|
40
|
-
if (sessionBackend) return sessionBackend;
|
|
41
|
-
sessionBackend = g.sessionStorage ? new WebStorageBackend(g.sessionStorage) : new InMemoryBackend();
|
|
42
|
-
return sessionBackend;
|
|
43
|
-
}
|
|
44
|
-
var NamespacedStorage = class {
|
|
45
|
-
backend;
|
|
46
|
-
prefix;
|
|
47
|
-
constructor(area, namespace) {
|
|
48
|
-
this.backend = getBackend(area);
|
|
49
|
-
this.prefix = `${namespace}.`;
|
|
50
|
-
}
|
|
51
|
-
get(key) {
|
|
52
|
-
const raw = this.backend.get(this.prefix + key);
|
|
53
|
-
if (raw === null) return void 0;
|
|
54
|
-
try {
|
|
55
|
-
return JSON.parse(raw);
|
|
56
|
-
} catch {
|
|
57
|
-
return void 0;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
remove(key) {
|
|
61
|
-
this.backend.remove(this.prefix + key);
|
|
62
|
-
}
|
|
63
|
-
set(key, value) {
|
|
64
|
-
this.backend.set(this.prefix + key, JSON.stringify(value));
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
// src/StoragePreviousHashStore.ts
|
|
69
|
-
var StoragePreviousHashStore = class _StoragePreviousHashStore {
|
|
70
|
-
static DefaultNamespace = "xyo-previous-hash-store";
|
|
71
|
-
static DefaultStorageType = "local";
|
|
72
|
-
_namespace = _StoragePreviousHashStore.DefaultNamespace;
|
|
73
|
-
_storage;
|
|
74
|
-
_type = _StoragePreviousHashStore.DefaultStorageType;
|
|
75
|
-
constructor(opts) {
|
|
76
|
-
if (typeof opts?.namespace === "string") this._namespace = opts.namespace;
|
|
77
|
-
if (opts?.type) this._type = opts.type;
|
|
78
|
-
this._storage = new NamespacedStorage(this.type, this.namespace);
|
|
79
|
-
}
|
|
80
|
-
get storage() {
|
|
81
|
-
this._storage ??= new NamespacedStorage(this.type, this.namespace);
|
|
82
|
-
return this._storage;
|
|
83
|
-
}
|
|
84
|
-
get namespace() {
|
|
85
|
-
return this._namespace;
|
|
86
|
-
}
|
|
87
|
-
get type() {
|
|
88
|
-
return this._type;
|
|
89
|
-
}
|
|
90
|
-
async getItem(address) {
|
|
91
|
-
return this.storage.get(address) ?? null;
|
|
92
|
-
}
|
|
93
|
-
async removeItem(address) {
|
|
94
|
-
this.storage.remove(address);
|
|
95
|
-
}
|
|
96
|
-
async setItem(address, previousHash) {
|
|
97
|
-
this.storage.set(address, previousHash);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
export {
|
|
101
|
-
NamespacedStorage,
|
|
102
|
-
StoragePreviousHashStore
|
|
103
|
-
};
|
|
1
|
+
// src/index.ts
|
|
2
|
+
export * from "@xyo-network/sdk-protocol/previous-hash-store-storage";
|
|
104
3
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["// Compatibility shim: this package re-exports from @xyo-network/sdk-protocol.\nexport * from '@xyo-network/sdk-protocol/previous-hash-store-storage'\n"],
|
|
5
|
+
"mappings": ";AACA,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/previous-hash-store-storage",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.15",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -34,31 +34,51 @@
|
|
|
34
34
|
"README.md"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@xyo-network/
|
|
38
|
-
"@xyo-network/previous-hash-store-model": "~7.0.13"
|
|
37
|
+
"@xyo-network/sdk-protocol": "~7.0.15"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
|
-
"@ariestools/sdk": "~
|
|
40
|
+
"@ariestools/sdk": "~8.0.2",
|
|
41
|
+
"@ariestools/threads": "~8.0.2",
|
|
42
|
+
"@bitauth/libauth": "~3.0.0",
|
|
43
|
+
"@metamask/providers": "~22.1.1",
|
|
44
|
+
"@noble/post-quantum": "~0.6.1",
|
|
42
45
|
"@opentelemetry/api": "~1.9.1",
|
|
43
46
|
"@opentelemetry/sdk-trace-base": "~2.9.0",
|
|
44
47
|
"@scure/base": "~2.2.0",
|
|
45
|
-
"@
|
|
46
|
-
"@xylabs/
|
|
48
|
+
"@scure/bip39": "~2.2.0",
|
|
49
|
+
"@xylabs/toolchain": "~8.6.7",
|
|
50
|
+
"@xylabs/tsconfig": "~8.6.7",
|
|
51
|
+
"ajv": "~8.20.0",
|
|
47
52
|
"async-mutex": "~0.5.0",
|
|
48
|
-
"
|
|
53
|
+
"debug": "~4.4.3",
|
|
49
54
|
"eslint": "~10.6.0",
|
|
50
55
|
"eslint-import-resolver-typescript": "~4.4.5",
|
|
56
|
+
"ethers": "~6.17.0",
|
|
57
|
+
"hash-wasm": "~4.12.0",
|
|
58
|
+
"idb": "~8.0.3",
|
|
59
|
+
"observable-fns": "~0.6.1",
|
|
51
60
|
"typescript": "~6.0.3",
|
|
52
|
-
"
|
|
53
|
-
"vitest": "~4.1.9",
|
|
61
|
+
"webextension-polyfill": "~0.12.0",
|
|
54
62
|
"zod": "~4.4.3"
|
|
55
63
|
},
|
|
56
64
|
"peerDependencies": {
|
|
57
|
-
"@ariestools/sdk": "^
|
|
65
|
+
"@ariestools/sdk": "^8.0.2",
|
|
66
|
+
"@ariestools/threads": "^8.0.2",
|
|
67
|
+
"@bitauth/libauth": "^3.0.0",
|
|
68
|
+
"@metamask/providers": "^22.1.1",
|
|
69
|
+
"@noble/post-quantum": "^0.6.1",
|
|
58
70
|
"@opentelemetry/api": "^1.9.1",
|
|
59
71
|
"@opentelemetry/sdk-trace-base": "^2.9.0",
|
|
60
72
|
"@scure/base": "^2.2.0",
|
|
73
|
+
"@scure/bip39": "^2.2.0",
|
|
74
|
+
"ajv": "^8.20.0",
|
|
61
75
|
"async-mutex": "^0.5.0",
|
|
76
|
+
"debug": "^4.4.3",
|
|
77
|
+
"ethers": "^6.17.0",
|
|
78
|
+
"hash-wasm": "^4.12.0",
|
|
79
|
+
"idb": "^8.0.3",
|
|
80
|
+
"observable-fns": "^0.6.1",
|
|
81
|
+
"webextension-polyfill": "^0.12.0",
|
|
62
82
|
"zod": "^4.4.3"
|
|
63
83
|
},
|
|
64
84
|
"engines": {
|
|
@@ -66,5 +86,6 @@
|
|
|
66
86
|
},
|
|
67
87
|
"publishConfig": {
|
|
68
88
|
"access": "public"
|
|
69
|
-
}
|
|
89
|
+
},
|
|
90
|
+
"deprecated": "Use @xyo-network/sdk-protocol/previous-hash-store-storage instead. Replace @xyo-network/previous-hash-store-storage with @xyo-network/sdk-protocol/previous-hash-store-storage. This package is a compatibility shim only and will not receive further updates."
|
|
70
91
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type StorageArea = 'local' | 'session' | 'page';
|
|
2
|
-
export declare class NamespacedStorage<T> {
|
|
3
|
-
private readonly backend;
|
|
4
|
-
private readonly prefix;
|
|
5
|
-
constructor(area: StorageArea, namespace: string);
|
|
6
|
-
get(key: string): T | undefined;
|
|
7
|
-
remove(key: string): void;
|
|
8
|
-
set(key: string, value: T): void;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=NamespacedStorage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NamespacedStorage.d.ts","sourceRoot":"","sources":["../../src/NamespacedStorage.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAiEtD,qBAAa,iBAAiB,CAAC,CAAC;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;gBAEnB,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM;IAKhD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAU/B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;CAGjC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Hash } from '@ariestools/sdk';
|
|
2
|
-
import type { XyoAddress } from '@xyo-network/address';
|
|
3
|
-
import type { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
|
|
4
|
-
import type { StorageArea } from './NamespacedStorage.ts';
|
|
5
|
-
export type Storage = StorageArea;
|
|
6
|
-
export interface StoragePreviousHashOpts {
|
|
7
|
-
namespace?: string;
|
|
8
|
-
type?: Storage;
|
|
9
|
-
}
|
|
10
|
-
export declare class StoragePreviousHashStore implements PreviousHashStore {
|
|
11
|
-
static readonly DefaultNamespace = "xyo-previous-hash-store";
|
|
12
|
-
static readonly DefaultStorageType: Storage;
|
|
13
|
-
private _namespace;
|
|
14
|
-
private _storage;
|
|
15
|
-
private _type;
|
|
16
|
-
constructor(opts?: StoragePreviousHashOpts);
|
|
17
|
-
private get storage();
|
|
18
|
-
get namespace(): string;
|
|
19
|
-
get type(): Storage;
|
|
20
|
-
getItem(address: XyoAddress): Promise<Hash | null>;
|
|
21
|
-
removeItem(address: XyoAddress): Promise<void>;
|
|
22
|
-
setItem(address: XyoAddress, previousHash: Hash): Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=StoragePreviousHashStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StoragePreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/StoragePreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAE/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAGzD,MAAM,MAAM,OAAO,GAAG,WAAW,CAAA;AAEjC,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,qBAAa,wBAAyB,YAAW,iBAAiB;IAChE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,6BAA4B;IAC5D,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAU;IAErD,OAAO,CAAC,UAAU,CAA4C;IAC9D,OAAO,CAAC,QAAQ,CAAqC;IACrD,OAAO,CAAC,KAAK,CAAuD;gBAExD,IAAI,CAAC,EAAE,uBAAuB;IAM1C,OAAO,KAAK,OAAO,GAGlB;IAED,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAEK,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAIlD,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtE"}
|