@xyo-network/previous-hash-store-indexeddb 2.99.1 → 2.99.3

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.
@@ -0,0 +1,26 @@
1
+ import { Address, Hash } from '@xylabs/hex';
2
+ import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
+ import { DBSchema } from 'idb';
4
+ export interface PreviousHashStoreSchemaV1 extends DBSchema {
5
+ 'previous-hash': {
6
+ key: string;
7
+ value: string;
8
+ };
9
+ }
10
+ export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
11
+ static readonly CurrentSchemaVersion = 1;
12
+ private readonly db;
13
+ constructor();
14
+ /**
15
+ * The database name.
16
+ */
17
+ get dbName(): "xyo";
18
+ /**
19
+ * The name of the object store.
20
+ */
21
+ get storeName(): "previous-hash";
22
+ getItem(address: Address): Promise<Hash | null>;
23
+ removeItem(address: Address): Promise<void>;
24
+ setItem(address: Address, previousHash: string): Promise<void>;
25
+ }
26
+ //# sourceMappingURL=IndexedDbPreviousHashStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndexedDbPreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/IndexedDbPreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAwB,MAAM,KAAK,CAAA;AAEpD,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;;IAQrE;;OAEG;IACH,IAAI,MAAM,UAET;IAED;;OAEG;IACH,IAAI,SAAS,oBAEZ;IAEK,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAI/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAG3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE"}
@@ -0,0 +1,26 @@
1
+ import { Address, Hash } from '@xylabs/hex';
2
+ import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
+ import { DBSchema } from 'idb';
4
+ export interface PreviousHashStoreSchemaV1 extends DBSchema {
5
+ 'previous-hash': {
6
+ key: string;
7
+ value: string;
8
+ };
9
+ }
10
+ export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
11
+ static readonly CurrentSchemaVersion = 1;
12
+ private readonly db;
13
+ constructor();
14
+ /**
15
+ * The database name.
16
+ */
17
+ get dbName(): "xyo";
18
+ /**
19
+ * The name of the object store.
20
+ */
21
+ get storeName(): "previous-hash";
22
+ getItem(address: Address): Promise<Hash | null>;
23
+ removeItem(address: Address): Promise<void>;
24
+ setItem(address: Address, previousHash: string): Promise<void>;
25
+ }
26
+ //# sourceMappingURL=IndexedDbPreviousHashStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndexedDbPreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/IndexedDbPreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAwB,MAAM,KAAK,CAAA;AAEpD,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;;IAQrE;;OAEG;IACH,IAAI,MAAM,UAET;IAED;;OAEG;IACH,IAAI,SAAS,oBAEZ;IAEK,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAI/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAG3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE"}
@@ -0,0 +1,26 @@
1
+ import { Address, Hash } from '@xylabs/hex';
2
+ import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
+ import { DBSchema } from 'idb';
4
+ export interface PreviousHashStoreSchemaV1 extends DBSchema {
5
+ 'previous-hash': {
6
+ key: string;
7
+ value: string;
8
+ };
9
+ }
10
+ export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
11
+ static readonly CurrentSchemaVersion = 1;
12
+ private readonly db;
13
+ constructor();
14
+ /**
15
+ * The database name.
16
+ */
17
+ get dbName(): "xyo";
18
+ /**
19
+ * The name of the object store.
20
+ */
21
+ get storeName(): "previous-hash";
22
+ getItem(address: Address): Promise<Hash | null>;
23
+ removeItem(address: Address): Promise<void>;
24
+ setItem(address: Address, previousHash: string): Promise<void>;
25
+ }
26
+ //# sourceMappingURL=IndexedDbPreviousHashStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndexedDbPreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/IndexedDbPreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAwB,MAAM,KAAK,CAAA;AAEpD,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;;IAQrE;;OAEG;IACH,IAAI,MAAM,UAET;IAED;;OAEG;IACH,IAAI,SAAS,oBAEZ;IAEK,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAI/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAG3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/index.ts
22
+ var src_exports = {};
23
+ __export(src_exports, {
24
+ IndexedDbPreviousHashStore: () => IndexedDbPreviousHashStore
25
+ });
26
+ module.exports = __toCommonJS(src_exports);
27
+
28
+ // src/IndexedDbPreviousHashStore.ts
29
+ var import_idb = require("idb");
30
+ var IndexedDbPreviousHashStore = class _IndexedDbPreviousHashStore {
31
+ static {
32
+ __name(this, "IndexedDbPreviousHashStore");
33
+ }
34
+ static CurrentSchemaVersion = 1;
35
+ db;
36
+ constructor() {
37
+ this.db = (0, import_idb.openDB)(this.dbName, _IndexedDbPreviousHashStore.CurrentSchemaVersion, {
38
+ upgrade: (db) => db.createObjectStore(this.storeName)
39
+ });
40
+ }
41
+ /**
42
+ * The database name.
43
+ */
44
+ get dbName() {
45
+ return "xyo";
46
+ }
47
+ /**
48
+ * The name of the object store.
49
+ */
50
+ get storeName() {
51
+ return "previous-hash";
52
+ }
53
+ async getItem(address) {
54
+ const value = await (await this.db).get(this.storeName, address);
55
+ return value ?? null;
56
+ }
57
+ async removeItem(address) {
58
+ await (await this.db).delete(this.storeName, address);
59
+ }
60
+ async setItem(address, previousHash) {
61
+ await (await this.db).put(this.storeName, previousHash, address);
62
+ }
63
+ };
64
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts","../../src/IndexedDbPreviousHashStore.ts"],"sourcesContent":["export * from './IndexedDbPreviousHashStore'\n","import { Address, Hash } from '@xylabs/hex'\nimport { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\nimport { DBSchema, IDBPDatabase, 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>(this.dbName, 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: Address): Promise<Hash | null> {\n const value = (await (await this.db).get(this.storeName, address)) as Hash\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await (await this.db).delete(this.storeName, address)\n }\n async setItem(address: Address, previousHash: string): Promise<void> {\n await (await this.db).put(this.storeName, previousHash, address)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACEA,iBAA+C;AASxC,IAAMA,6BAAN,MAAMA,4BAAAA;EATb,OASaA;;;EACX,OAAgBC,uBAAuB;EACtBC;EAEjBC,cAAc;AACZ,SAAKD,SAAKE,mBAAkC,KAAKC,QAAQL,4BAA2BC,sBAAsB;MACxGK,SAAS,CAACJ,OAAOA,GAAGK,kBAAkB,KAAKC,SAAS;IACtD,CAAA;EACF;;;;EAKA,IAAIH,SAAS;AACX,WAAO;EACT;;;;EAKA,IAAIG,YAAY;AACd,WAAO;EACT;EAEA,MAAMC,QAAQC,SAAwC;AACpD,UAAMC,QAAS,OAAO,MAAM,KAAKT,IAAIU,IAAI,KAAKJ,WAAWE,OAAAA;AACzD,WAAOC,SAAS;EAClB;EACA,MAAME,WAAWH,SAAiC;AAChD,WAAO,MAAM,KAAKR,IAAIY,OAAO,KAAKN,WAAWE,OAAAA;EAC/C;EACA,MAAMK,QAAQL,SAAkBM,cAAqC;AACnE,WAAO,MAAM,KAAKd,IAAIe,IAAI,KAAKT,WAAWQ,cAAcN,OAAAA;EAC1D;AACF;","names":["IndexedDbPreviousHashStore","CurrentSchemaVersion","db","constructor","openDB","dbName","upgrade","createObjectStore","storeName","getItem","address","value","get","removeItem","delete","setItem","previousHash","put"]}
@@ -0,0 +1,2 @@
1
+ export * from './IndexedDbPreviousHashStore';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './IndexedDbPreviousHashStore';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './IndexedDbPreviousHashStore';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA"}
@@ -0,0 +1,43 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/IndexedDbPreviousHashStore.ts
5
+ import { openDB } from "idb";
6
+ var IndexedDbPreviousHashStore = class _IndexedDbPreviousHashStore {
7
+ static {
8
+ __name(this, "IndexedDbPreviousHashStore");
9
+ }
10
+ static CurrentSchemaVersion = 1;
11
+ db;
12
+ constructor() {
13
+ this.db = openDB(this.dbName, _IndexedDbPreviousHashStore.CurrentSchemaVersion, {
14
+ upgrade: (db) => db.createObjectStore(this.storeName)
15
+ });
16
+ }
17
+ /**
18
+ * The database name.
19
+ */
20
+ get dbName() {
21
+ return "xyo";
22
+ }
23
+ /**
24
+ * The name of the object store.
25
+ */
26
+ get storeName() {
27
+ return "previous-hash";
28
+ }
29
+ async getItem(address) {
30
+ const value = await (await this.db).get(this.storeName, address);
31
+ return value ?? null;
32
+ }
33
+ async removeItem(address) {
34
+ await (await this.db).delete(this.storeName, address);
35
+ }
36
+ async setItem(address, previousHash) {
37
+ await (await this.db).put(this.storeName, previousHash, address);
38
+ }
39
+ };
40
+ export {
41
+ IndexedDbPreviousHashStore
42
+ };
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/IndexedDbPreviousHashStore.ts"],"sourcesContent":["import { Address, Hash } from '@xylabs/hex'\nimport { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\nimport { DBSchema, IDBPDatabase, 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>(this.dbName, 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: Address): Promise<Hash | null> {\n const value = (await (await this.db).get(this.storeName, address)) as Hash\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await (await this.db).delete(this.storeName, address)\n }\n async setItem(address: Address, previousHash: string): Promise<void> {\n await (await this.db).put(this.storeName, previousHash, address)\n }\n}\n"],"mappings":";;;;AAEA,SAAiCA,cAAc;AASxC,IAAMC,6BAAN,MAAMA,4BAAAA;EATb,OASaA;;;EACX,OAAgBC,uBAAuB;EACtBC;EAEjBC,cAAc;AACZ,SAAKD,KAAKE,OAAkC,KAAKC,QAAQL,4BAA2BC,sBAAsB;MACxGK,SAAS,CAACJ,OAAOA,GAAGK,kBAAkB,KAAKC,SAAS;IACtD,CAAA;EACF;;;;EAKA,IAAIH,SAAS;AACX,WAAO;EACT;;;;EAKA,IAAIG,YAAY;AACd,WAAO;EACT;EAEA,MAAMC,QAAQC,SAAwC;AACpD,UAAMC,QAAS,OAAO,MAAM,KAAKT,IAAIU,IAAI,KAAKJ,WAAWE,OAAAA;AACzD,WAAOC,SAAS;EAClB;EACA,MAAME,WAAWH,SAAiC;AAChD,WAAO,MAAM,KAAKR,IAAIY,OAAO,KAAKN,WAAWE,OAAAA;EAC/C;EACA,MAAMK,QAAQL,SAAkBM,cAAqC;AACnE,WAAO,MAAM,KAAKd,IAAIe,IAAI,KAAKT,WAAWQ,cAAcN,OAAAA;EAC1D;AACF;","names":["openDB","IndexedDbPreviousHashStore","CurrentSchemaVersion","db","constructor","openDB","dbName","upgrade","createObjectStore","storeName","getItem","address","value","get","removeItem","delete","setItem","previousHash","put"]}
package/package.json CHANGED
@@ -11,14 +11,14 @@
11
11
  },
12
12
  "description": "Primary SDK for using XYO Protocol 2.0",
13
13
  "dependencies": {
14
- "@xylabs/hex": "^3.1.11",
15
- "@xyo-network/previous-hash-store-model": "~2.99.1",
14
+ "@xylabs/hex": "^3.3.2",
15
+ "@xyo-network/previous-hash-store-model": "~2.99.3",
16
16
  "idb": "^8.0.0"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/uuid": "9.0.8",
20
- "@xylabs/ts-scripts-yarn3": "^3.9.1",
21
- "@xylabs/tsconfig": "^3.9.1",
20
+ "@xylabs/ts-scripts-yarn3": "^3.10.0",
21
+ "@xylabs/tsconfig": "^3.10.0",
22
22
  "fake-indexeddb": "^5.0.2",
23
23
  "typescript": "^5.4.5",
24
24
  "uuid": "^9.0.1"
@@ -61,6 +61,6 @@
61
61
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
62
62
  },
63
63
  "sideEffects": false,
64
- "version": "2.99.1",
64
+ "version": "2.99.3",
65
65
  "type": "module"
66
66
  }