@xyo-network/previous-hash-store-indexeddb 7.0.12 → 7.0.13
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 +47 -1
- package/dist/neutral/IndexedDbPreviousHashStore.d.ts +27 -0
- package/dist/neutral/IndexedDbPreviousHashStore.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +1 -5
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +41 -2
- package/dist/neutral/index.mjs.map +3 -3
- package/package.json +27 -27
package/README.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
+
[![logo][]](https://xyo.network)
|
|
2
|
+
|
|
1
3
|
# @xyo-network/previous-hash-store-indexeddb
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
[![npm][npm-badge]][npm-link]
|
|
6
|
+
[![license][license-badge]][license-link]
|
|
7
|
+
|
|
8
|
+
> Primary SDK for using XYO Protocol 2.0
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
Using npm:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install {{name}}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Using yarn:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
yarn add {{name}}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Using pnpm:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
pnpm add {{name}}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Using bun:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
bun add {{name}}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
|
|
40
|
+
|
|
41
|
+
## Credits
|
|
42
|
+
|
|
43
|
+
[Made with 🔥 and ❄️ by XYO Foundation](https://xyo.network)
|
|
44
|
+
|
|
45
|
+
[npm-badge]: https://img.shields.io/npm/v/@xyo-network/previous-hash-store-indexeddb.svg
|
|
46
|
+
[npm-link]: https://www.npmjs.com/package/@xyo-network/previous-hash-store-indexeddb
|
|
47
|
+
[license-badge]: https://img.shields.io/npm/l/@xyo-network/previous-hash-store-indexeddb.svg
|
|
48
|
+
[license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE
|
|
49
|
+
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
|
|
@@ -0,0 +1,27 @@
|
|
|
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 { 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IndexedDbPreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/IndexedDbPreviousHashStore.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;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;IAMlD,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9C,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIxE"}
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* @deprecated Use `@xyo-network/sdk-protocol/previous-hash-store-indexeddb` instead.
|
|
3
|
-
* `@xyo-network/previous-hash-store-indexeddb` is a backward-compatibility re-export stub.
|
|
4
|
-
*/
|
|
5
|
-
export * from '@xyo-network/sdk-protocol/previous-hash-store-indexeddb';
|
|
1
|
+
export * from './IndexedDbPreviousHashStore.ts';
|
|
6
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
|
|
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 db = await this.db;
|
|
27
|
+
const value = await db.get(this.storeName, address);
|
|
28
|
+
return value ?? null;
|
|
29
|
+
}
|
|
30
|
+
async removeItem(address) {
|
|
31
|
+
const db = await this.db;
|
|
32
|
+
await db.delete(this.storeName, address);
|
|
33
|
+
}
|
|
34
|
+
async setItem(address, previousHash) {
|
|
35
|
+
const db = await this.db;
|
|
36
|
+
await db.put(this.storeName, previousHash, address);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
IndexedDbPreviousHashStore
|
|
41
|
+
};
|
|
3
42
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";AAIA,cAAc;",
|
|
3
|
+
"sources": ["../../src/IndexedDbPreviousHashStore.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Hash } from '@ariestools/sdk'\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 db = await this.db\n const value = (await db.get(this.storeName, address)) as Hash\n return value ?? null\n }\n\n async removeItem(address: XyoAddress): Promise<void> {\n const db = await this.db\n await db.delete(this.storeName, address)\n }\n\n async setItem(address: XyoAddress, previousHash: string): Promise<void> {\n const db = await this.db\n await 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,KAAK,MAAM,KAAK;AACtB,UAAM,QAAS,MAAM,GAAG,IAAI,KAAK,WAAW,OAAO;AACnD,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,MAAM,WAAW,SAAoC;AACnD,UAAM,KAAK,MAAM,KAAK;AACtB,UAAM,GAAG,OAAO,KAAK,WAAW,OAAO;AAAA,EACzC;AAAA,EAEA,MAAM,QAAQ,SAAqB,cAAqC;AACtE,UAAM,KAAK,MAAM,KAAK;AACtB,UAAM,GAAG,IAAI,KAAK,WAAW,cAAc,OAAO;AAAA,EACpD;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/previous-hash-store-indexeddb",
|
|
3
|
-
"version": "7.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"deprecated": "Use @xyo-network/sdk-protocol/previous-hash-store-indexeddb instead. @xyo-network/previous-hash-store-indexeddb is a backward-compatibility re-export stub and will not receive further updates.",
|
|
3
|
+
"version": "7.0.13",
|
|
4
|
+
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
6
5
|
"homepage": "https://xyo.network",
|
|
7
6
|
"bugs": {
|
|
8
7
|
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues",
|
|
@@ -35,34 +34,35 @@
|
|
|
35
34
|
"README.md"
|
|
36
35
|
],
|
|
37
36
|
"dependencies": {
|
|
38
|
-
"@xyo-network/
|
|
37
|
+
"@xyo-network/address": "~7.0.13",
|
|
38
|
+
"@xyo-network/previous-hash-store-model": "~7.0.13"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
41
|
+
"@ariestools/sdk": "~7.0.8",
|
|
42
|
+
"@opentelemetry/api": "~1.9.1",
|
|
43
|
+
"@opentelemetry/sdk-trace-base": "~2.9.0",
|
|
44
|
+
"@scure/base": "~2.2.0",
|
|
45
|
+
"@xylabs/toolchain": "~8.6.2",
|
|
46
|
+
"@xylabs/tsconfig": "~8.6.2",
|
|
47
|
+
"async-mutex": "~0.5.0",
|
|
48
|
+
"browserslist": "~4.28.4",
|
|
49
|
+
"eslint": "~10.6.0",
|
|
50
|
+
"eslint-import-resolver-typescript": "~4.4.5",
|
|
51
|
+
"fake-indexeddb": "~6.2.5",
|
|
52
|
+
"idb": "~8.0.3",
|
|
53
|
+
"typescript": "~6.0.3",
|
|
54
|
+
"vite": "~8.1.3",
|
|
55
|
+
"vitest": "~4.1.9",
|
|
56
|
+
"zod": "~4.4.3"
|
|
47
57
|
},
|
|
48
58
|
"peerDependencies": {
|
|
49
|
-
"@ariestools/sdk": "^7.0.
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"@xylabs/geo": "^7.0",
|
|
57
|
-
"@xylabs/threads": "^7.0",
|
|
58
|
-
"ajv": "^8.20",
|
|
59
|
-
"async-mutex": "^0.5",
|
|
60
|
-
"debug": "^4.4",
|
|
61
|
-
"ethers": "^6.16",
|
|
62
|
-
"hash-wasm": "~4.12",
|
|
63
|
-
"idb": "^8.0",
|
|
64
|
-
"observable-fns": "^0.6",
|
|
65
|
-
"zod": "^4.4"
|
|
59
|
+
"@ariestools/sdk": "^7.0.8",
|
|
60
|
+
"@opentelemetry/api": "^1.9.1",
|
|
61
|
+
"@opentelemetry/sdk-trace-base": "^2.9.0",
|
|
62
|
+
"@scure/base": "^2.2.0",
|
|
63
|
+
"async-mutex": "^0.5.0",
|
|
64
|
+
"idb": "^8.0.3",
|
|
65
|
+
"zod": "^4.4.3"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": "^24"
|