@xyo-network/previous-hash-store-indexeddb 2.84.6 → 2.84.8
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/node/index.cjs +64 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.js +4 -31
- package/dist/node/index.js.map +1 -1
- package/package.json +12 -12
- package/dist/node/index.mjs +0 -37
- package/dist/node/index.mjs.map +0 -1
|
@@ -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 __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
IndexedDbPreviousHashStore: () => IndexedDbPreviousHashStore
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(src_exports);
|
|
26
|
+
|
|
27
|
+
// src/IndexedDbPreviousHashStore.ts
|
|
28
|
+
var import_idb = require("idb");
|
|
29
|
+
var IndexedDbPreviousHashStore = class _IndexedDbPreviousHashStore {
|
|
30
|
+
static CurrentSchemaVersion = 1;
|
|
31
|
+
db;
|
|
32
|
+
constructor() {
|
|
33
|
+
this.db = (0, import_idb.openDB)(this.dbName, _IndexedDbPreviousHashStore.CurrentSchemaVersion, {
|
|
34
|
+
upgrade: (db) => db.createObjectStore(this.storeName)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The database name.
|
|
39
|
+
*/
|
|
40
|
+
get dbName() {
|
|
41
|
+
return "xyo";
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The name of the object store.
|
|
45
|
+
*/
|
|
46
|
+
get storeName() {
|
|
47
|
+
return "previous-hash";
|
|
48
|
+
}
|
|
49
|
+
async getItem(address) {
|
|
50
|
+
const value = await (await this.db).get(this.storeName, address);
|
|
51
|
+
return value ?? null;
|
|
52
|
+
}
|
|
53
|
+
async removeItem(address) {
|
|
54
|
+
await (await this.db).delete(this.storeName, address);
|
|
55
|
+
}
|
|
56
|
+
async setItem(address, previousHash) {
|
|
57
|
+
await (await this.db).put(this.storeName, previousHash, address);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
IndexedDbPreviousHashStore
|
|
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 { 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: string): Promise<string | null> {\n const value = await (await this.db).get(this.storeName, address)\n return value ?? null\n }\n async removeItem(address: string): Promise<void> {\n await (await this.db).delete(this.storeName, address)\n }\n async setItem(address: string, previousHash: string): Promise<void> {\n await (await this.db).put(this.storeName, previousHash, address)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,iBAA+C;AASxC,IAAM,6BAAN,MAAM,4BAAwD;AAAA,EACnE,OAAgB,uBAAuB;AAAA,EACtB;AAAA,EAEjB,cAAc;AACZ,SAAK,SAAK,mBAAkC,KAAK,QAAQ,4BAA2B,sBAAsB;AAAA,MACxG,SAAS,CAAC,OAAO,GAAG,kBAAkB,KAAK,SAAS;AAAA,IACtD,CAAC;AAAA,EACH;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,SAAyC;AACrD,UAAM,QAAQ,OAAO,MAAM,KAAK,IAAI,IAAI,KAAK,WAAW,OAAO;AAC/D,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,MAAM,WAAW,SAAgC;AAC/C,WAAO,MAAM,KAAK,IAAI,OAAO,KAAK,WAAW,OAAO;AAAA,EACtD;AAAA,EACA,MAAM,QAAQ,SAAiB,cAAqC;AAClE,WAAO,MAAM,KAAK,IAAI,IAAI,KAAK,WAAW,cAAc,OAAO;AAAA,EACjE;AACF;","names":[]}
|
package/dist/node/index.js
CHANGED
|
@@ -1,36 +1,10 @@
|
|
|
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 __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
IndexedDbPreviousHashStore: () => IndexedDbPreviousHashStore
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
|
|
27
1
|
// src/IndexedDbPreviousHashStore.ts
|
|
28
|
-
|
|
2
|
+
import { openDB } from "idb";
|
|
29
3
|
var IndexedDbPreviousHashStore = class _IndexedDbPreviousHashStore {
|
|
30
4
|
static CurrentSchemaVersion = 1;
|
|
31
5
|
db;
|
|
32
6
|
constructor() {
|
|
33
|
-
this.db =
|
|
7
|
+
this.db = openDB(this.dbName, _IndexedDbPreviousHashStore.CurrentSchemaVersion, {
|
|
34
8
|
upgrade: (db) => db.createObjectStore(this.storeName)
|
|
35
9
|
});
|
|
36
10
|
}
|
|
@@ -57,8 +31,7 @@ var IndexedDbPreviousHashStore = class _IndexedDbPreviousHashStore {
|
|
|
57
31
|
await (await this.db).put(this.storeName, previousHash, address);
|
|
58
32
|
}
|
|
59
33
|
};
|
|
60
|
-
|
|
61
|
-
0 && (module.exports = {
|
|
34
|
+
export {
|
|
62
35
|
IndexedDbPreviousHashStore
|
|
63
|
-
}
|
|
36
|
+
};
|
|
64
37
|
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/IndexedDbPreviousHashStore.ts"],"sourcesContent":["import { 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: string): Promise<string | null> {\n const value = await (await this.db).get(this.storeName, address)\n return value ?? null\n }\n async removeItem(address: string): Promise<void> {\n await (await this.db).delete(this.storeName, address)\n }\n async setItem(address: string, previousHash: string): Promise<void> {\n await (await this.db).put(this.storeName, previousHash, address)\n }\n}\n"],"mappings":";AACA,SAAiC,cAAc;AASxC,IAAM,6BAAN,MAAM,4BAAwD;AAAA,EACnE,OAAgB,uBAAuB;AAAA,EACtB;AAAA,EAEjB,cAAc;AACZ,SAAK,KAAK,OAAkC,KAAK,QAAQ,4BAA2B,sBAAsB;AAAA,MACxG,SAAS,CAAC,OAAO,GAAG,kBAAkB,KAAK,SAAS;AAAA,IACtD,CAAC;AAAA,EACH;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,SAAyC;AACrD,UAAM,QAAQ,OAAO,MAAM,KAAK,IAAI,IAAI,KAAK,WAAW,OAAO;AAC/D,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,MAAM,WAAW,SAAgC;AAC/C,WAAO,MAAM,KAAK,IAAI,OAAO,KAAK,WAAW,OAAO;AAAA,EACtD;AAAA,EACA,MAAM,QAAQ,SAAiB,cAAqC;AAClE,WAAO,MAAM,KAAK,IAAI,IAAI,KAAK,WAAW,cAAc,OAAO;AAAA,EACjE;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -11,18 +11,17 @@
|
|
|
11
11
|
},
|
|
12
12
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@xyo-network/previous-hash-store-model": "~2.84.
|
|
15
|
-
"idb": "^
|
|
14
|
+
"@xyo-network/previous-hash-store-model": "~2.84.8",
|
|
15
|
+
"idb": "^8.0.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/uuid": "9.0.7",
|
|
19
|
-
"@xylabs/ts-scripts-yarn3": "^3.2.
|
|
20
|
-
"@xylabs/tsconfig": "^3.2.
|
|
19
|
+
"@xylabs/ts-scripts-yarn3": "^3.2.24",
|
|
20
|
+
"@xylabs/tsconfig": "^3.2.24",
|
|
21
21
|
"fake-indexeddb": "^5.0.1",
|
|
22
22
|
"typescript": "^5.3.3",
|
|
23
23
|
"uuid": "^9.0.1"
|
|
24
24
|
},
|
|
25
|
-
"docs": "dist/docs.json",
|
|
26
25
|
"exports": {
|
|
27
26
|
".": {
|
|
28
27
|
"browser": {
|
|
@@ -37,19 +36,20 @@
|
|
|
37
36
|
},
|
|
38
37
|
"node": {
|
|
39
38
|
"require": {
|
|
40
|
-
"types": "./dist/node/index.d.
|
|
41
|
-
"default": "./dist/node/index.
|
|
39
|
+
"types": "./dist/node/index.d.cts",
|
|
40
|
+
"default": "./dist/node/index.cjs"
|
|
42
41
|
},
|
|
43
42
|
"import": {
|
|
44
43
|
"types": "./dist/node/index.d.mts",
|
|
45
|
-
"default": "./dist/node/index.
|
|
44
|
+
"default": "./dist/node/index.js"
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
},
|
|
49
48
|
"./package.json": "./package.json"
|
|
50
49
|
},
|
|
51
|
-
"
|
|
52
|
-
"
|
|
50
|
+
"types": "dist/node/index.d.ts",
|
|
51
|
+
"main": "dist/node/index.cjs",
|
|
52
|
+
"module": "dist/node/index.js",
|
|
53
53
|
"homepage": "https://xyo.network",
|
|
54
54
|
"license": "LGPL-3.0-only",
|
|
55
55
|
"publishConfig": {
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
61
61
|
},
|
|
62
62
|
"sideEffects": false,
|
|
63
|
-
"
|
|
64
|
-
"
|
|
63
|
+
"version": "2.84.8",
|
|
64
|
+
"type": "module"
|
|
65
65
|
}
|
package/dist/node/index.mjs
DELETED
|
@@ -1,37 +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(this.dbName, _IndexedDbPreviousHashStore.CurrentSchemaVersion, {
|
|
8
|
-
upgrade: (db) => db.createObjectStore(this.storeName)
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* The database name.
|
|
13
|
-
*/
|
|
14
|
-
get dbName() {
|
|
15
|
-
return "xyo";
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The name of the object store.
|
|
19
|
-
*/
|
|
20
|
-
get storeName() {
|
|
21
|
-
return "previous-hash";
|
|
22
|
-
}
|
|
23
|
-
async getItem(address) {
|
|
24
|
-
const value = await (await this.db).get(this.storeName, address);
|
|
25
|
-
return value ?? null;
|
|
26
|
-
}
|
|
27
|
-
async removeItem(address) {
|
|
28
|
-
await (await this.db).delete(this.storeName, address);
|
|
29
|
-
}
|
|
30
|
-
async setItem(address, previousHash) {
|
|
31
|
-
await (await this.db).put(this.storeName, previousHash, address);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
export {
|
|
35
|
-
IndexedDbPreviousHashStore
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/node/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/IndexedDbPreviousHashStore.ts"],"sourcesContent":["import { 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: string): Promise<string | null> {\n const value = await (await this.db).get(this.storeName, address)\n return value ?? null\n }\n async removeItem(address: string): Promise<void> {\n await (await this.db).delete(this.storeName, address)\n }\n async setItem(address: string, previousHash: string): Promise<void> {\n await (await this.db).put(this.storeName, previousHash, address)\n }\n}\n"],"mappings":";AACA,SAAiC,cAAc;AASxC,IAAM,6BAAN,MAAM,4BAAwD;AAAA,EACnE,OAAgB,uBAAuB;AAAA,EACtB;AAAA,EAEjB,cAAc;AACZ,SAAK,KAAK,OAAkC,KAAK,QAAQ,4BAA2B,sBAAsB;AAAA,MACxG,SAAS,CAAC,OAAO,GAAG,kBAAkB,KAAK,SAAS;AAAA,IACtD,CAAC;AAAA,EACH;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,SAAyC;AACrD,UAAM,QAAQ,OAAO,MAAM,KAAK,IAAI,IAAI,KAAK,WAAW,OAAO;AAC/D,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,MAAM,WAAW,SAAgC;AAC/C,WAAO,MAAM,KAAK,IAAI,OAAO,KAAK,WAAW,OAAO;AAAA,EACtD;AAAA,EACA,MAAM,QAAQ,SAAiB,cAAqC;AAClE,WAAO,MAAM,KAAK,IAAI,IAAI,KAAK,WAAW,cAAc,OAAO;AAAA,EACjE;AACF;","names":[]}
|