@xyo-network/previous-hash-store-indexeddb 6.0.9 → 6.1.0
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/README.md +3 -1
- package/package.json +6 -12
- package/dist/browser/IndexedDbPreviousHashStore.d.ts +0 -27
- package/dist/browser/IndexedDbPreviousHashStore.d.ts.map +0 -1
- package/dist/browser/index.d.ts +0 -2
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.mjs +0 -39
- package/dist/browser/index.mjs.map +0 -7
- package/dist/node/IndexedDbPreviousHashStore.d.ts +0 -27
- package/dist/node/IndexedDbPreviousHashStore.d.ts.map +0 -1
- package/dist/node/index.d.ts +0 -2
- package/dist/node/index.d.ts.map +0 -1
- package/dist/node/index.mjs +0 -39
- package/dist/node/index.mjs.map +0 -7
package/README.md
CHANGED
|
@@ -38,10 +38,12 @@ bun add {{name}}
|
|
|
38
38
|
|
|
39
39
|
See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
|
|
40
40
|
|
|
41
|
+
## Credits
|
|
41
42
|
|
|
43
|
+
[Made with 🔥 and ❄️ by XYO Foundation](https://xyo.network)
|
|
42
44
|
|
|
43
|
-
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
|
|
44
45
|
[npm-badge]: https://img.shields.io/npm/v/@xyo-network/previous-hash-store-indexeddb.svg
|
|
45
46
|
[npm-link]: https://www.npmjs.com/package/@xyo-network/previous-hash-store-indexeddb
|
|
46
47
|
[license-badge]: https://img.shields.io/npm/l/@xyo-network/previous-hash-store-indexeddb.svg
|
|
47
48
|
[license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE
|
|
49
|
+
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/previous-hash-store-indexeddb",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -34,21 +34,18 @@
|
|
|
34
34
|
"README.md"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@xyo-network/address": "~6.0
|
|
38
|
-
"@xyo-network/previous-hash-store-model": "~6.0
|
|
37
|
+
"@xyo-network/address": "~6.1.0",
|
|
38
|
+
"@xyo-network/previous-hash-store-model": "~6.1.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@opentelemetry/api": "^1.9.1",
|
|
42
42
|
"@opentelemetry/sdk-trace-base": "^2.7.1",
|
|
43
43
|
"@scure/base": "~2.2.0",
|
|
44
|
-
"@xylabs/sdk-js": "^6.0
|
|
45
|
-
"@xylabs/toolchain": "~8.1.
|
|
46
|
-
"@xylabs/tsconfig": "~8.1.
|
|
44
|
+
"@xylabs/sdk-js": "^6.1.0",
|
|
45
|
+
"@xylabs/toolchain": "~8.1.20",
|
|
46
|
+
"@xylabs/tsconfig": "~8.1.20",
|
|
47
47
|
"async-mutex": "^0.5.0",
|
|
48
|
-
"bn.js": "^5.2.3",
|
|
49
|
-
"buffer": "^6.0.3",
|
|
50
48
|
"eslint": "^10.4.1",
|
|
51
|
-
"ethers": "^6.16.0",
|
|
52
49
|
"fake-indexeddb": "~6.2.5",
|
|
53
50
|
"idb": "^8.0.3",
|
|
54
51
|
"typescript": "~6.0.3",
|
|
@@ -62,9 +59,6 @@
|
|
|
62
59
|
"@scure/base": "~2.2",
|
|
63
60
|
"@xylabs/sdk-js": "^6.0",
|
|
64
61
|
"async-mutex": "^0.5",
|
|
65
|
-
"bn.js": "^5.2",
|
|
66
|
-
"buffer": "^6.0",
|
|
67
|
-
"ethers": "^6.16",
|
|
68
62
|
"idb": "^8.0",
|
|
69
63
|
"zod": "^4.4"
|
|
70
64
|
},
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Hash } from '@xylabs/sdk-js';
|
|
2
|
-
import type { XyoAddress } from '@xyo-network/address';
|
|
3
|
-
import type { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
|
|
4
|
-
import type { DBSchema } from 'idb';
|
|
5
|
-
export interface PreviousHashStoreSchemaV1 extends DBSchema {
|
|
6
|
-
'previous-hash': {
|
|
7
|
-
key: string;
|
|
8
|
-
value: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
|
|
12
|
-
static readonly CurrentSchemaVersion = 1;
|
|
13
|
-
private readonly db;
|
|
14
|
-
constructor();
|
|
15
|
-
/**
|
|
16
|
-
* The database name.
|
|
17
|
-
*/
|
|
18
|
-
get dbName(): "xyo";
|
|
19
|
-
/**
|
|
20
|
-
* The name of the object store.
|
|
21
|
-
*/
|
|
22
|
-
get storeName(): "previous-hash";
|
|
23
|
-
getItem(address: XyoAddress): Promise<Hash | null>;
|
|
24
|
-
removeItem(address: XyoAddress): Promise<void>;
|
|
25
|
-
setItem(address: XyoAddress, previousHash: string): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=IndexedDbPreviousHashStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedDbPreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/IndexedDbPreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,KAAK,CAAA;AAGjD,MAAM,WAAW,yBAA0B,SAAQ,QAAQ;IACzD,eAAe,EAAE;QACf,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF;AAED,qBAAa,0BAA2B,YAAW,iBAAiB;IAClE,MAAM,CAAC,QAAQ,CAAC,oBAAoB,KAAI;IACxC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAkD;;IAUrE;;OAEG;IACH,IAAI,MAAM,IACD,KAAK,CACb;IAED;;OAEG;IACH,IAAI,SAAS,IACJ,eAAe,CACvB;IAEK,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAKlD,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGxE"}
|
package/dist/browser/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA"}
|
package/dist/browser/index.mjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// src/IndexedDbPreviousHashStore.ts
|
|
2
|
-
import { openDB } from "idb";
|
|
3
|
-
var IndexedDbPreviousHashStore = class _IndexedDbPreviousHashStore {
|
|
4
|
-
static CurrentSchemaVersion = 1;
|
|
5
|
-
db;
|
|
6
|
-
constructor() {
|
|
7
|
-
this.db = openDB(
|
|
8
|
-
this.dbName,
|
|
9
|
-
_IndexedDbPreviousHashStore.CurrentSchemaVersion,
|
|
10
|
-
{ upgrade: (db) => db.createObjectStore(this.storeName) }
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* The database name.
|
|
15
|
-
*/
|
|
16
|
-
get dbName() {
|
|
17
|
-
return "xyo";
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* The name of the object store.
|
|
21
|
-
*/
|
|
22
|
-
get storeName() {
|
|
23
|
-
return "previous-hash";
|
|
24
|
-
}
|
|
25
|
-
async getItem(address) {
|
|
26
|
-
const value = await (await this.db).get(this.storeName, address);
|
|
27
|
-
return value ?? null;
|
|
28
|
-
}
|
|
29
|
-
async removeItem(address) {
|
|
30
|
-
await (await this.db).delete(this.storeName, address);
|
|
31
|
-
}
|
|
32
|
-
async setItem(address, previousHash) {
|
|
33
|
-
await (await this.db).put(this.storeName, previousHash, address);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export {
|
|
37
|
-
IndexedDbPreviousHashStore
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/IndexedDbPreviousHashStore.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Hash } from '@xylabs/sdk-js'\nimport type { XyoAddress } from '@xyo-network/address'\nimport type { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\nimport type { DBSchema, IDBPDatabase } from 'idb'\nimport { openDB } from 'idb'\n\nexport interface PreviousHashStoreSchemaV1 extends DBSchema {\n 'previous-hash': {\n key: string\n value: string\n }\n}\n\nexport class IndexedDbPreviousHashStore implements PreviousHashStore {\n static readonly CurrentSchemaVersion = 1\n private readonly db: Promise<IDBPDatabase<PreviousHashStoreSchemaV1>>\n\n constructor() {\n this.db = openDB<PreviousHashStoreSchemaV1>(\n this.dbName,\n IndexedDbPreviousHashStore.CurrentSchemaVersion,\n { upgrade: db => db.createObjectStore(this.storeName) },\n )\n }\n\n /**\n * The database name.\n */\n get dbName() {\n return 'xyo' as const\n }\n\n /**\n * The name of the object store.\n */\n get storeName() {\n return 'previous-hash' as const\n }\n\n async getItem(address: XyoAddress): Promise<Hash | null> {\n const value = (await (await this.db).get(this.storeName, address)) as Hash\n return value ?? null\n }\n\n async removeItem(address: XyoAddress): Promise<void> {\n await (await this.db).delete(this.storeName, address)\n }\n\n async setItem(address: XyoAddress, previousHash: string): Promise<void> {\n await (await this.db).put(this.storeName, previousHash, address)\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAIA,SAAS,cAAc;AAShB,IAAM,6BAAN,MAAM,4BAAwD;AAAA,EACnE,OAAgB,uBAAuB;AAAA,EACtB;AAAA,EAEjB,cAAc;AACZ,SAAK,KAAK;AAAA,MACR,KAAK;AAAA,MACL,4BAA2B;AAAA,MAC3B,EAAE,SAAS,QAAM,GAAG,kBAAkB,KAAK,SAAS,EAAE;AAAA,IACxD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,SAAS;AACX,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,YAAY;AACd,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,QAAQ,SAA2C;AACvD,UAAM,QAAS,OAAO,MAAM,KAAK,IAAI,IAAI,KAAK,WAAW,OAAO;AAChE,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,MAAM,WAAW,SAAoC;AACnD,WAAO,MAAM,KAAK,IAAI,OAAO,KAAK,WAAW,OAAO;AAAA,EACtD;AAAA,EAEA,MAAM,QAAQ,SAAqB,cAAqC;AACtE,WAAO,MAAM,KAAK,IAAI,IAAI,KAAK,WAAW,cAAc,OAAO;AAAA,EACjE;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Hash } from '@xylabs/sdk-js';
|
|
2
|
-
import type { XyoAddress } from '@xyo-network/address';
|
|
3
|
-
import type { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
|
|
4
|
-
import type { DBSchema } from 'idb';
|
|
5
|
-
export interface PreviousHashStoreSchemaV1 extends DBSchema {
|
|
6
|
-
'previous-hash': {
|
|
7
|
-
key: string;
|
|
8
|
-
value: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
|
|
12
|
-
static readonly CurrentSchemaVersion = 1;
|
|
13
|
-
private readonly db;
|
|
14
|
-
constructor();
|
|
15
|
-
/**
|
|
16
|
-
* The database name.
|
|
17
|
-
*/
|
|
18
|
-
get dbName(): "xyo";
|
|
19
|
-
/**
|
|
20
|
-
* The name of the object store.
|
|
21
|
-
*/
|
|
22
|
-
get storeName(): "previous-hash";
|
|
23
|
-
getItem(address: XyoAddress): Promise<Hash | null>;
|
|
24
|
-
removeItem(address: XyoAddress): Promise<void>;
|
|
25
|
-
setItem(address: XyoAddress, previousHash: string): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=IndexedDbPreviousHashStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedDbPreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/IndexedDbPreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,KAAK,CAAA;AAGjD,MAAM,WAAW,yBAA0B,SAAQ,QAAQ;IACzD,eAAe,EAAE;QACf,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF;AAED,qBAAa,0BAA2B,YAAW,iBAAiB;IAClE,MAAM,CAAC,QAAQ,CAAC,oBAAoB,KAAI;IACxC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAkD;;IAUrE;;OAEG;IACH,IAAI,MAAM,IACD,KAAK,CACb;IAED;;OAEG;IACH,IAAI,SAAS,IACJ,eAAe,CACvB;IAEK,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAKlD,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGxE"}
|
package/dist/node/index.d.ts
DELETED
package/dist/node/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA"}
|
package/dist/node/index.mjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// src/IndexedDbPreviousHashStore.ts
|
|
2
|
-
import { openDB } from "idb";
|
|
3
|
-
var IndexedDbPreviousHashStore = class _IndexedDbPreviousHashStore {
|
|
4
|
-
static CurrentSchemaVersion = 1;
|
|
5
|
-
db;
|
|
6
|
-
constructor() {
|
|
7
|
-
this.db = openDB(
|
|
8
|
-
this.dbName,
|
|
9
|
-
_IndexedDbPreviousHashStore.CurrentSchemaVersion,
|
|
10
|
-
{ upgrade: (db) => db.createObjectStore(this.storeName) }
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* The database name.
|
|
15
|
-
*/
|
|
16
|
-
get dbName() {
|
|
17
|
-
return "xyo";
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* The name of the object store.
|
|
21
|
-
*/
|
|
22
|
-
get storeName() {
|
|
23
|
-
return "previous-hash";
|
|
24
|
-
}
|
|
25
|
-
async getItem(address) {
|
|
26
|
-
const value = await (await this.db).get(this.storeName, address);
|
|
27
|
-
return value ?? null;
|
|
28
|
-
}
|
|
29
|
-
async removeItem(address) {
|
|
30
|
-
await (await this.db).delete(this.storeName, address);
|
|
31
|
-
}
|
|
32
|
-
async setItem(address, previousHash) {
|
|
33
|
-
await (await this.db).put(this.storeName, previousHash, address);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export {
|
|
37
|
-
IndexedDbPreviousHashStore
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/node/index.mjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/IndexedDbPreviousHashStore.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Hash } from '@xylabs/sdk-js'\nimport type { XyoAddress } from '@xyo-network/address'\nimport type { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\nimport type { DBSchema, IDBPDatabase } from 'idb'\nimport { openDB } from 'idb'\n\nexport interface PreviousHashStoreSchemaV1 extends DBSchema {\n 'previous-hash': {\n key: string\n value: string\n }\n}\n\nexport class IndexedDbPreviousHashStore implements PreviousHashStore {\n static readonly CurrentSchemaVersion = 1\n private readonly db: Promise<IDBPDatabase<PreviousHashStoreSchemaV1>>\n\n constructor() {\n this.db = openDB<PreviousHashStoreSchemaV1>(\n this.dbName,\n IndexedDbPreviousHashStore.CurrentSchemaVersion,\n { upgrade: db => db.createObjectStore(this.storeName) },\n )\n }\n\n /**\n * The database name.\n */\n get dbName() {\n return 'xyo' as const\n }\n\n /**\n * The name of the object store.\n */\n get storeName() {\n return 'previous-hash' as const\n }\n\n async getItem(address: XyoAddress): Promise<Hash | null> {\n const value = (await (await this.db).get(this.storeName, address)) as Hash\n return value ?? null\n }\n\n async removeItem(address: XyoAddress): Promise<void> {\n await (await this.db).delete(this.storeName, address)\n }\n\n async setItem(address: XyoAddress, previousHash: string): Promise<void> {\n await (await this.db).put(this.storeName, previousHash, address)\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAIA,SAAS,cAAc;AAShB,IAAM,6BAAN,MAAM,4BAAwD;AAAA,EACnE,OAAgB,uBAAuB;AAAA,EACtB;AAAA,EAEjB,cAAc;AACZ,SAAK,KAAK;AAAA,MACR,KAAK;AAAA,MACL,4BAA2B;AAAA,MAC3B,EAAE,SAAS,QAAM,GAAG,kBAAkB,KAAK,SAAS,EAAE;AAAA,IACxD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,SAAS;AACX,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,YAAY;AACd,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,QAAQ,SAA2C;AACvD,UAAM,QAAS,OAAO,MAAM,KAAK,IAAI,IAAI,KAAK,WAAW,OAAO;AAChE,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,MAAM,WAAW,SAAoC;AACnD,WAAO,MAAM,KAAK,IAAI,OAAO,KAAK,WAAW,OAAO;AAAA,EACtD;AAAA,EAEA,MAAM,QAAQ,SAAqB,cAAqC;AACtE,WAAO,MAAM,KAAK,IAAI,IAAI,KAAK,WAAW,cAAc,OAAO;AAAA,EACjE;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|