@xyo-network/previous-hash-store-indexeddb 2.106.0-rc.5 → 2.107.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/dist/browser/IndexedDbPreviousHashStore.d.cts +0 -6
- package/dist/browser/IndexedDbPreviousHashStore.d.cts.map +1 -1
- package/dist/browser/IndexedDbPreviousHashStore.d.mts +0 -6
- package/dist/browser/IndexedDbPreviousHashStore.d.mts.map +1 -1
- package/dist/browser/IndexedDbPreviousHashStore.d.ts +0 -6
- package/dist/browser/IndexedDbPreviousHashStore.d.ts.map +1 -1
- package/dist/browser/index.cjs +1 -63
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +1 -42
- package/dist/browser/index.js.map +1 -1
- package/dist/neutral/IndexedDbPreviousHashStore.d.cts +0 -6
- package/dist/neutral/IndexedDbPreviousHashStore.d.cts.map +1 -1
- package/dist/neutral/IndexedDbPreviousHashStore.d.mts +0 -6
- package/dist/neutral/IndexedDbPreviousHashStore.d.mts.map +1 -1
- package/dist/neutral/IndexedDbPreviousHashStore.d.ts +0 -6
- package/dist/neutral/IndexedDbPreviousHashStore.d.ts.map +1 -1
- package/dist/neutral/index.cjs +1 -63
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.js +1 -42
- package/dist/neutral/index.js.map +1 -1
- package/dist/node/IndexedDbPreviousHashStore.d.cts +0 -6
- package/dist/node/IndexedDbPreviousHashStore.d.cts.map +1 -1
- package/dist/node/IndexedDbPreviousHashStore.d.mts +0 -6
- package/dist/node/IndexedDbPreviousHashStore.d.mts.map +1 -1
- package/dist/node/IndexedDbPreviousHashStore.d.ts +0 -6
- package/dist/node/IndexedDbPreviousHashStore.d.ts.map +1 -1
- package/dist/node/index.cjs +1 -68
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +1 -43
- package/dist/node/index.js.map +1 -1
- package/package.json +6 -7
|
@@ -11,13 +11,7 @@ export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
|
|
|
11
11
|
static readonly CurrentSchemaVersion = 1;
|
|
12
12
|
private readonly db;
|
|
13
13
|
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* The database name.
|
|
16
|
-
*/
|
|
17
14
|
get dbName(): "xyo";
|
|
18
|
-
/**
|
|
19
|
-
* The name of the object store.
|
|
20
|
-
*/
|
|
21
15
|
get storeName(): "previous-hash";
|
|
22
16
|
getItem(address: Address): Promise<Hash | null>;
|
|
23
17
|
removeItem(address: Address): Promise<void>;
|
|
@@ -1 +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;;
|
|
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;;IAWrE,IAAI,MAAM,UAET;IAKD,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"}
|
|
@@ -11,13 +11,7 @@ export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
|
|
|
11
11
|
static readonly CurrentSchemaVersion = 1;
|
|
12
12
|
private readonly db;
|
|
13
13
|
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* The database name.
|
|
16
|
-
*/
|
|
17
14
|
get dbName(): "xyo";
|
|
18
|
-
/**
|
|
19
|
-
* The name of the object store.
|
|
20
|
-
*/
|
|
21
15
|
get storeName(): "previous-hash";
|
|
22
16
|
getItem(address: Address): Promise<Hash | null>;
|
|
23
17
|
removeItem(address: Address): Promise<void>;
|
|
@@ -1 +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;;
|
|
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;;IAWrE,IAAI,MAAM,UAET;IAKD,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"}
|
|
@@ -11,13 +11,7 @@ export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
|
|
|
11
11
|
static readonly CurrentSchemaVersion = 1;
|
|
12
12
|
private readonly db;
|
|
13
13
|
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* The database name.
|
|
16
|
-
*/
|
|
17
14
|
get dbName(): "xyo";
|
|
18
|
-
/**
|
|
19
|
-
* The name of the object store.
|
|
20
|
-
*/
|
|
21
15
|
get storeName(): "previous-hash";
|
|
22
16
|
getItem(address: Address): Promise<Hash | null>;
|
|
23
17
|
removeItem(address: Address): Promise<void>;
|
|
@@ -1 +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;;
|
|
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;;IAWrE,IAAI,MAAM,UAET;IAKD,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"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -1,64 +1,2 @@
|
|
|
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: /* @__PURE__ */ __name((db) => db.createObjectStore(this.storeName), "upgrade")
|
|
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
|
-
};
|
|
1
|
+
"use strict";var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var i=(e,t)=>s(e,"name",{value:t,configurable:!0});var b=(e,t)=>{for(var a in t)s(e,a,{get:t[a],enumerable:!0})},d=(e,t,a,m)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of h(t))!u.call(e,r)&&r!==a&&s(e,r,{get:()=>t[r],enumerable:!(m=c(t,r))||m.enumerable});return e};var p=e=>d(s({},"__esModule",{value:!0}),e);var N={};b(N,{IndexedDbPreviousHashStore:()=>o});module.exports=p(N);var n=require("idb");var o=class e{static{i(this,"IndexedDbPreviousHashStore")}static CurrentSchemaVersion=1;db;constructor(){this.db=(0,n.openDB)(this.dbName,e.CurrentSchemaVersion,{upgrade:i(t=>t.createObjectStore(this.storeName),"upgrade")})}get dbName(){return"xyo"}get storeName(){return"previous-hash"}async getItem(t){return await(await this.db).get(this.storeName,t)??null}async removeItem(t){await(await this.db).delete(this.storeName,t)}async setItem(t,a){await(await this.db).put(this.storeName,a,t)}};
|
|
64
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +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":"
|
|
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":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,IAAA,eAAAC,EAAAH,GCEA,IAAAI,EAA+C,eASxC,IAAMC,EAAN,MAAMA,CAAAA,CATb,MASaA,CAAAA,EAAAA,mCACX,OAAgBC,qBAAuB,EACtBC,GAEjBC,aAAc,CACZ,KAAKD,MAAKE,UAAkC,KAAKC,OAAQL,EAA2BC,qBAAsB,CACxGK,QAASC,EAACL,GAAOA,EAAGM,kBAAkB,KAAKC,SAAS,EAA3C,UACX,CAAA,CACF,CAKA,IAAIJ,QAAS,CACX,MAAO,KACT,CAKA,IAAII,WAAY,CACd,MAAO,eACT,CAEA,MAAMC,QAAQC,EAAwC,CAEpD,OADe,MAAO,MAAM,KAAKT,IAAIU,IAAI,KAAKH,UAAWE,CAAAA,GACzC,IAClB,CACA,MAAME,WAAWF,EAAiC,CAChD,MAAO,MAAM,KAAKT,IAAIY,OAAO,KAAKL,UAAWE,CAAAA,CAC/C,CACA,MAAMI,QAAQJ,EAAkBK,EAAqC,CACnE,MAAO,MAAM,KAAKd,IAAIe,IAAI,KAAKR,UAAWO,EAAcL,CAAAA,CAC1D,CACF","names":["src_exports","__export","IndexedDbPreviousHashStore","__toCommonJS","import_idb","IndexedDbPreviousHashStore","CurrentSchemaVersion","db","constructor","openDB","dbName","upgrade","__name","createObjectStore","storeName","getItem","address","get","removeItem","delete","setItem","previousHash","put"]}
|
package/dist/browser/index.js
CHANGED
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
var
|
|
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: /* @__PURE__ */ __name((db) => db.createObjectStore(this.storeName), "upgrade")
|
|
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
|
-
};
|
|
1
|
+
var i=Object.defineProperty;var a=(e,t)=>i(e,"name",{value:t,configurable:!0});import{openDB as o}from"idb";var s=class e{static{a(this,"IndexedDbPreviousHashStore")}static CurrentSchemaVersion=1;db;constructor(){this.db=o(this.dbName,e.CurrentSchemaVersion,{upgrade:a(t=>t.createObjectStore(this.storeName),"upgrade")})}get dbName(){return"xyo"}get storeName(){return"previous-hash"}async getItem(t){return await(await this.db).get(this.storeName,t)??null}async removeItem(t){await(await this.db).delete(this.storeName,t)}async setItem(t,r){await(await this.db).put(this.storeName,r,t)}};export{s as IndexedDbPreviousHashStore};
|
|
43
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +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":"
|
|
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":"+EAEA,OAAiCA,UAAAA,MAAc,MASxC,IAAMC,EAAN,MAAMA,CAAAA,CATb,MASaA,CAAAA,EAAAA,mCACX,OAAgBC,qBAAuB,EACtBC,GAEjBC,aAAc,CACZ,KAAKD,GAAKE,EAAkC,KAAKC,OAAQL,EAA2BC,qBAAsB,CACxGK,QAASC,EAACL,GAAOA,EAAGM,kBAAkB,KAAKC,SAAS,EAA3C,UACX,CAAA,CACF,CAKA,IAAIJ,QAAS,CACX,MAAO,KACT,CAKA,IAAII,WAAY,CACd,MAAO,eACT,CAEA,MAAMC,QAAQC,EAAwC,CAEpD,OADe,MAAO,MAAM,KAAKT,IAAIU,IAAI,KAAKH,UAAWE,CAAAA,GACzC,IAClB,CACA,MAAME,WAAWF,EAAiC,CAChD,MAAO,MAAM,KAAKT,IAAIY,OAAO,KAAKL,UAAWE,CAAAA,CAC/C,CACA,MAAMI,QAAQJ,EAAkBK,EAAqC,CACnE,MAAO,MAAM,KAAKd,IAAIe,IAAI,KAAKR,UAAWO,EAAcL,CAAAA,CAC1D,CACF","names":["openDB","IndexedDbPreviousHashStore","CurrentSchemaVersion","db","constructor","openDB","dbName","upgrade","__name","createObjectStore","storeName","getItem","address","get","removeItem","delete","setItem","previousHash","put"]}
|
|
@@ -11,13 +11,7 @@ export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
|
|
|
11
11
|
static readonly CurrentSchemaVersion = 1;
|
|
12
12
|
private readonly db;
|
|
13
13
|
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* The database name.
|
|
16
|
-
*/
|
|
17
14
|
get dbName(): "xyo";
|
|
18
|
-
/**
|
|
19
|
-
* The name of the object store.
|
|
20
|
-
*/
|
|
21
15
|
get storeName(): "previous-hash";
|
|
22
16
|
getItem(address: Address): Promise<Hash | null>;
|
|
23
17
|
removeItem(address: Address): Promise<void>;
|
|
@@ -1 +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;;
|
|
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;;IAWrE,IAAI,MAAM,UAET;IAKD,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"}
|
|
@@ -11,13 +11,7 @@ export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
|
|
|
11
11
|
static readonly CurrentSchemaVersion = 1;
|
|
12
12
|
private readonly db;
|
|
13
13
|
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* The database name.
|
|
16
|
-
*/
|
|
17
14
|
get dbName(): "xyo";
|
|
18
|
-
/**
|
|
19
|
-
* The name of the object store.
|
|
20
|
-
*/
|
|
21
15
|
get storeName(): "previous-hash";
|
|
22
16
|
getItem(address: Address): Promise<Hash | null>;
|
|
23
17
|
removeItem(address: Address): Promise<void>;
|
|
@@ -1 +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;;
|
|
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;;IAWrE,IAAI,MAAM,UAET;IAKD,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"}
|
|
@@ -11,13 +11,7 @@ export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
|
|
|
11
11
|
static readonly CurrentSchemaVersion = 1;
|
|
12
12
|
private readonly db;
|
|
13
13
|
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* The database name.
|
|
16
|
-
*/
|
|
17
14
|
get dbName(): "xyo";
|
|
18
|
-
/**
|
|
19
|
-
* The name of the object store.
|
|
20
|
-
*/
|
|
21
15
|
get storeName(): "previous-hash";
|
|
22
16
|
getItem(address: Address): Promise<Hash | null>;
|
|
23
17
|
removeItem(address: Address): Promise<void>;
|
|
@@ -1 +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;;
|
|
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;;IAWrE,IAAI,MAAM,UAET;IAKD,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"}
|
package/dist/neutral/index.cjs
CHANGED
|
@@ -1,64 +1,2 @@
|
|
|
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: /* @__PURE__ */ __name((db) => db.createObjectStore(this.storeName), "upgrade")
|
|
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
|
-
};
|
|
1
|
+
"use strict";var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var i=(e,t)=>s(e,"name",{value:t,configurable:!0});var b=(e,t)=>{for(var a in t)s(e,a,{get:t[a],enumerable:!0})},d=(e,t,a,m)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of h(t))!u.call(e,r)&&r!==a&&s(e,r,{get:()=>t[r],enumerable:!(m=c(t,r))||m.enumerable});return e};var p=e=>d(s({},"__esModule",{value:!0}),e);var N={};b(N,{IndexedDbPreviousHashStore:()=>o});module.exports=p(N);var n=require("idb");var o=class e{static{i(this,"IndexedDbPreviousHashStore")}static CurrentSchemaVersion=1;db;constructor(){this.db=(0,n.openDB)(this.dbName,e.CurrentSchemaVersion,{upgrade:i(t=>t.createObjectStore(this.storeName),"upgrade")})}get dbName(){return"xyo"}get storeName(){return"previous-hash"}async getItem(t){return await(await this.db).get(this.storeName,t)??null}async removeItem(t){await(await this.db).delete(this.storeName,t)}async setItem(t,a){await(await this.db).put(this.storeName,a,t)}};
|
|
64
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +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":"
|
|
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":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,IAAA,eAAAC,EAAAH,GCEA,IAAAI,EAA+C,eASxC,IAAMC,EAAN,MAAMA,CAAAA,CATb,MASaA,CAAAA,EAAAA,mCACX,OAAgBC,qBAAuB,EACtBC,GAEjBC,aAAc,CACZ,KAAKD,MAAKE,UAAkC,KAAKC,OAAQL,EAA2BC,qBAAsB,CACxGK,QAASC,EAACL,GAAOA,EAAGM,kBAAkB,KAAKC,SAAS,EAA3C,UACX,CAAA,CACF,CAKA,IAAIJ,QAAS,CACX,MAAO,KACT,CAKA,IAAII,WAAY,CACd,MAAO,eACT,CAEA,MAAMC,QAAQC,EAAwC,CAEpD,OADe,MAAO,MAAM,KAAKT,IAAIU,IAAI,KAAKH,UAAWE,CAAAA,GACzC,IAClB,CACA,MAAME,WAAWF,EAAiC,CAChD,MAAO,MAAM,KAAKT,IAAIY,OAAO,KAAKL,UAAWE,CAAAA,CAC/C,CACA,MAAMI,QAAQJ,EAAkBK,EAAqC,CACnE,MAAO,MAAM,KAAKd,IAAIe,IAAI,KAAKR,UAAWO,EAAcL,CAAAA,CAC1D,CACF","names":["src_exports","__export","IndexedDbPreviousHashStore","__toCommonJS","import_idb","IndexedDbPreviousHashStore","CurrentSchemaVersion","db","constructor","openDB","dbName","upgrade","__name","createObjectStore","storeName","getItem","address","get","removeItem","delete","setItem","previousHash","put"]}
|
package/dist/neutral/index.js
CHANGED
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
var
|
|
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: /* @__PURE__ */ __name((db) => db.createObjectStore(this.storeName), "upgrade")
|
|
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
|
-
};
|
|
1
|
+
var i=Object.defineProperty;var a=(e,t)=>i(e,"name",{value:t,configurable:!0});import{openDB as o}from"idb";var s=class e{static{a(this,"IndexedDbPreviousHashStore")}static CurrentSchemaVersion=1;db;constructor(){this.db=o(this.dbName,e.CurrentSchemaVersion,{upgrade:a(t=>t.createObjectStore(this.storeName),"upgrade")})}get dbName(){return"xyo"}get storeName(){return"previous-hash"}async getItem(t){return await(await this.db).get(this.storeName,t)??null}async removeItem(t){await(await this.db).delete(this.storeName,t)}async setItem(t,r){await(await this.db).put(this.storeName,r,t)}};export{s as IndexedDbPreviousHashStore};
|
|
43
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +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":"
|
|
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":"+EAEA,OAAiCA,UAAAA,MAAc,MASxC,IAAMC,EAAN,MAAMA,CAAAA,CATb,MASaA,CAAAA,EAAAA,mCACX,OAAgBC,qBAAuB,EACtBC,GAEjBC,aAAc,CACZ,KAAKD,GAAKE,EAAkC,KAAKC,OAAQL,EAA2BC,qBAAsB,CACxGK,QAASC,EAACL,GAAOA,EAAGM,kBAAkB,KAAKC,SAAS,EAA3C,UACX,CAAA,CACF,CAKA,IAAIJ,QAAS,CACX,MAAO,KACT,CAKA,IAAII,WAAY,CACd,MAAO,eACT,CAEA,MAAMC,QAAQC,EAAwC,CAEpD,OADe,MAAO,MAAM,KAAKT,IAAIU,IAAI,KAAKH,UAAWE,CAAAA,GACzC,IAClB,CACA,MAAME,WAAWF,EAAiC,CAChD,MAAO,MAAM,KAAKT,IAAIY,OAAO,KAAKL,UAAWE,CAAAA,CAC/C,CACA,MAAMI,QAAQJ,EAAkBK,EAAqC,CACnE,MAAO,MAAM,KAAKd,IAAIe,IAAI,KAAKR,UAAWO,EAAcL,CAAAA,CAC1D,CACF","names":["openDB","IndexedDbPreviousHashStore","CurrentSchemaVersion","db","constructor","openDB","dbName","upgrade","__name","createObjectStore","storeName","getItem","address","get","removeItem","delete","setItem","previousHash","put"]}
|
|
@@ -11,13 +11,7 @@ export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
|
|
|
11
11
|
static readonly CurrentSchemaVersion = 1;
|
|
12
12
|
private readonly db;
|
|
13
13
|
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* The database name.
|
|
16
|
-
*/
|
|
17
14
|
get dbName(): "xyo";
|
|
18
|
-
/**
|
|
19
|
-
* The name of the object store.
|
|
20
|
-
*/
|
|
21
15
|
get storeName(): "previous-hash";
|
|
22
16
|
getItem(address: Address): Promise<Hash | null>;
|
|
23
17
|
removeItem(address: Address): Promise<void>;
|
|
@@ -1 +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;;
|
|
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;;IAWrE,IAAI,MAAM,UAET;IAKD,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"}
|
|
@@ -11,13 +11,7 @@ export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
|
|
|
11
11
|
static readonly CurrentSchemaVersion = 1;
|
|
12
12
|
private readonly db;
|
|
13
13
|
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* The database name.
|
|
16
|
-
*/
|
|
17
14
|
get dbName(): "xyo";
|
|
18
|
-
/**
|
|
19
|
-
* The name of the object store.
|
|
20
|
-
*/
|
|
21
15
|
get storeName(): "previous-hash";
|
|
22
16
|
getItem(address: Address): Promise<Hash | null>;
|
|
23
17
|
removeItem(address: Address): Promise<void>;
|
|
@@ -1 +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;;
|
|
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;;IAWrE,IAAI,MAAM,UAET;IAKD,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"}
|
|
@@ -11,13 +11,7 @@ export declare class IndexedDbPreviousHashStore implements PreviousHashStore {
|
|
|
11
11
|
static readonly CurrentSchemaVersion = 1;
|
|
12
12
|
private readonly db;
|
|
13
13
|
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* The database name.
|
|
16
|
-
*/
|
|
17
14
|
get dbName(): "xyo";
|
|
18
|
-
/**
|
|
19
|
-
* The name of the object store.
|
|
20
|
-
*/
|
|
21
15
|
get storeName(): "previous-hash";
|
|
22
16
|
getItem(address: Address): Promise<Hash | null>;
|
|
23
17
|
removeItem(address: Address): Promise<void>;
|
|
@@ -1 +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;;
|
|
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;;IAWrE,IAAI,MAAM,UAET;IAKD,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"}
|
package/dist/node/index.cjs
CHANGED
|
@@ -1,69 +1,2 @@
|
|
|
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 __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
22
|
-
|
|
23
|
-
// src/index.ts
|
|
24
|
-
var src_exports = {};
|
|
25
|
-
__export(src_exports, {
|
|
26
|
-
IndexedDbPreviousHashStore: () => IndexedDbPreviousHashStore
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(src_exports);
|
|
29
|
-
|
|
30
|
-
// src/IndexedDbPreviousHashStore.ts
|
|
31
|
-
var import_idb = require("idb");
|
|
32
|
-
var _IndexedDbPreviousHashStore = class _IndexedDbPreviousHashStore {
|
|
33
|
-
db;
|
|
34
|
-
constructor() {
|
|
35
|
-
this.db = (0, import_idb.openDB)(this.dbName, _IndexedDbPreviousHashStore.CurrentSchemaVersion, {
|
|
36
|
-
upgrade: /* @__PURE__ */ __name((db) => db.createObjectStore(this.storeName), "upgrade")
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* The database name.
|
|
41
|
-
*/
|
|
42
|
-
get dbName() {
|
|
43
|
-
return "xyo";
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* The name of the object store.
|
|
47
|
-
*/
|
|
48
|
-
get storeName() {
|
|
49
|
-
return "previous-hash";
|
|
50
|
-
}
|
|
51
|
-
async getItem(address) {
|
|
52
|
-
const value = await (await this.db).get(this.storeName, address);
|
|
53
|
-
return value ?? null;
|
|
54
|
-
}
|
|
55
|
-
async removeItem(address) {
|
|
56
|
-
await (await this.db).delete(this.storeName, address);
|
|
57
|
-
}
|
|
58
|
-
async setItem(address, previousHash) {
|
|
59
|
-
await (await this.db).put(this.storeName, previousHash, address);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
__name(_IndexedDbPreviousHashStore, "IndexedDbPreviousHashStore");
|
|
63
|
-
__publicField(_IndexedDbPreviousHashStore, "CurrentSchemaVersion", 1);
|
|
64
|
-
var IndexedDbPreviousHashStore = _IndexedDbPreviousHashStore;
|
|
65
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
-
0 && (module.exports = {
|
|
67
|
-
IndexedDbPreviousHashStore
|
|
68
|
-
});
|
|
1
|
+
"use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var l=(e,t,a)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var m=(e,t)=>s(e,"name",{value:t,configurable:!0});var w=(e,t)=>{for(var a in t)s(e,a,{get:t[a],enumerable:!0})},b=(e,t,a,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of p(t))!N.call(e,r)&&r!==a&&s(e,r,{get:()=>t[r],enumerable:!(c=u(t,r))||c.enumerable});return e};var g=e=>b(s({},"__esModule",{value:!0}),e);var n=(e,t,a)=>l(e,typeof t!="symbol"?t+"":t,a);var y={};w(y,{IndexedDbPreviousHashStore:()=>o});module.exports=g(y);var h=require("idb");var i=class i{db;constructor(){this.db=(0,h.openDB)(this.dbName,i.CurrentSchemaVersion,{upgrade:m(t=>t.createObjectStore(this.storeName),"upgrade")})}get dbName(){return"xyo"}get storeName(){return"previous-hash"}async getItem(t){return await(await this.db).get(this.storeName,t)??null}async removeItem(t){await(await this.db).delete(this.storeName,t)}async setItem(t,a){await(await this.db).put(this.storeName,a,t)}};m(i,"IndexedDbPreviousHashStore"),n(i,"CurrentSchemaVersion",1);var o=i;0&&(module.exports={IndexedDbPreviousHashStore});
|
|
69
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -1 +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":"
|
|
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":"omBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,IAAA,eAAAC,EAAAH,GCEA,IAAAI,EAA+C,eASxC,IAAMC,EAAN,MAAMA,CAAAA,CAEMC,GAEjBC,aAAc,CACZ,KAAKD,MAAKE,UAAkC,KAAKC,OAAQJ,EAA2BK,qBAAsB,CACxGC,QAASC,EAACN,GAAOA,EAAGO,kBAAkB,KAAKC,SAAS,EAA3C,UACX,CAAA,CACF,CAKA,IAAIL,QAAS,CACX,MAAO,KACT,CAKA,IAAIK,WAAY,CACd,MAAO,eACT,CAEA,MAAMC,QAAQC,EAAwC,CAEpD,OADe,MAAO,MAAM,KAAKV,IAAIW,IAAI,KAAKH,UAAWE,CAAAA,GACzC,IAClB,CACA,MAAME,WAAWF,EAAiC,CAChD,MAAO,MAAM,KAAKV,IAAIa,OAAO,KAAKL,UAAWE,CAAAA,CAC/C,CACA,MAAMI,QAAQJ,EAAkBK,EAAqC,CACnE,MAAO,MAAM,KAAKf,IAAIgB,IAAI,KAAKR,UAAWO,EAAcL,CAAAA,CAC1D,CACF,EAlCaX,EAAAA,EAAAA,8BACXkB,EADWlB,EACKK,uBAAuB,GADlC,IAAML,EAANmB","names":["src_exports","__export","IndexedDbPreviousHashStore","__toCommonJS","import_idb","IndexedDbPreviousHashStore","db","constructor","openDB","dbName","CurrentSchemaVersion","upgrade","__name","createObjectStore","storeName","getItem","address","get","removeItem","delete","setItem","previousHash","put","__publicField","_IndexedDbPreviousHashStore"]}
|
package/dist/node/index.js
CHANGED
|
@@ -1,44 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
|
|
6
|
-
// src/IndexedDbPreviousHashStore.ts
|
|
7
|
-
import { openDB } from "idb";
|
|
8
|
-
var _IndexedDbPreviousHashStore = class _IndexedDbPreviousHashStore {
|
|
9
|
-
db;
|
|
10
|
-
constructor() {
|
|
11
|
-
this.db = openDB(this.dbName, _IndexedDbPreviousHashStore.CurrentSchemaVersion, {
|
|
12
|
-
upgrade: /* @__PURE__ */ __name((db) => db.createObjectStore(this.storeName), "upgrade")
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* The database name.
|
|
17
|
-
*/
|
|
18
|
-
get dbName() {
|
|
19
|
-
return "xyo";
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* The name of the object store.
|
|
23
|
-
*/
|
|
24
|
-
get storeName() {
|
|
25
|
-
return "previous-hash";
|
|
26
|
-
}
|
|
27
|
-
async getItem(address) {
|
|
28
|
-
const value = await (await this.db).get(this.storeName, address);
|
|
29
|
-
return value ?? null;
|
|
30
|
-
}
|
|
31
|
-
async removeItem(address) {
|
|
32
|
-
await (await this.db).delete(this.storeName, address);
|
|
33
|
-
}
|
|
34
|
-
async setItem(address, previousHash) {
|
|
35
|
-
await (await this.db).put(this.storeName, previousHash, address);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
__name(_IndexedDbPreviousHashStore, "IndexedDbPreviousHashStore");
|
|
39
|
-
__publicField(_IndexedDbPreviousHashStore, "CurrentSchemaVersion", 1);
|
|
40
|
-
var IndexedDbPreviousHashStore = _IndexedDbPreviousHashStore;
|
|
41
|
-
export {
|
|
42
|
-
IndexedDbPreviousHashStore
|
|
43
|
-
};
|
|
1
|
+
var i=Object.defineProperty;var c=(e,t,a)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var s=(e,t)=>i(e,"name",{value:t,configurable:!0});var m=(e,t,a)=>c(e,typeof t!="symbol"?t+"":t,a);import{openDB as n}from"idb";var r=class r{db;constructor(){this.db=n(this.dbName,r.CurrentSchemaVersion,{upgrade:s(t=>t.createObjectStore(this.storeName),"upgrade")})}get dbName(){return"xyo"}get storeName(){return"previous-hash"}async getItem(t){return await(await this.db).get(this.storeName,t)??null}async removeItem(t){await(await this.db).delete(this.storeName,t)}async setItem(t,a){await(await this.db).put(this.storeName,a,t)}};s(r,"IndexedDbPreviousHashStore"),m(r,"CurrentSchemaVersion",1);var o=r;export{o as IndexedDbPreviousHashStore};
|
|
44
2
|
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +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":"
|
|
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":"uNAEA,OAAiCA,UAAAA,MAAc,MASxC,IAAMC,EAAN,MAAMA,CAAAA,CAEMC,GAEjBC,aAAc,CACZ,KAAKD,GAAKE,EAAkC,KAAKC,OAAQJ,EAA2BK,qBAAsB,CACxGC,QAASC,EAACN,GAAOA,EAAGO,kBAAkB,KAAKC,SAAS,EAA3C,UACX,CAAA,CACF,CAKA,IAAIL,QAAS,CACX,MAAO,KACT,CAKA,IAAIK,WAAY,CACd,MAAO,eACT,CAEA,MAAMC,QAAQC,EAAwC,CAEpD,OADe,MAAO,MAAM,KAAKV,IAAIW,IAAI,KAAKH,UAAWE,CAAAA,GACzC,IAClB,CACA,MAAME,WAAWF,EAAiC,CAChD,MAAO,MAAM,KAAKV,IAAIa,OAAO,KAAKL,UAAWE,CAAAA,CAC/C,CACA,MAAMI,QAAQJ,EAAkBK,EAAqC,CACnE,MAAO,MAAM,KAAKf,IAAIgB,IAAI,KAAKR,UAAWO,EAAcL,CAAAA,CAC1D,CACF,EAlCaX,EAAAA,EAAAA,8BACXkB,EADWlB,EACKK,uBAAuB,GADlC,IAAML,EAANmB","names":["openDB","IndexedDbPreviousHashStore","db","constructor","openDB","dbName","CurrentSchemaVersion","upgrade","__name","createObjectStore","storeName","getItem","address","get","removeItem","delete","setItem","previousHash","put","__publicField","_IndexedDbPreviousHashStore"]}
|
package/package.json
CHANGED
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@xylabs/hex": "^3.5.1",
|
|
15
|
-
"@xyo-network/previous-hash-store-model": "~2.
|
|
15
|
+
"@xyo-network/previous-hash-store-model": "~2.107.0",
|
|
16
16
|
"idb": "^8.0.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/uuid": "9.0.8",
|
|
20
|
-
"@xylabs/ts-scripts-yarn3": "^3.11.
|
|
21
|
-
"@xylabs/tsconfig": "^3.11.
|
|
20
|
+
"@xylabs/ts-scripts-yarn3": "^3.11.8",
|
|
21
|
+
"@xylabs/tsconfig": "^3.11.8",
|
|
22
22
|
"fake-indexeddb": "^5.0.2",
|
|
23
|
-
"typescript": "^5.
|
|
23
|
+
"typescript": "^5.5.2",
|
|
24
24
|
"uuid": "^9.0.1"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
62
62
|
},
|
|
63
63
|
"sideEffects": false,
|
|
64
|
-
"version": "2.
|
|
65
|
-
"type": "module"
|
|
66
|
-
"stableVersion": "2.105.1"
|
|
64
|
+
"version": "2.107.0",
|
|
65
|
+
"type": "module"
|
|
67
66
|
}
|