@xyo-network/previous-hash-store-storage 2.74.5 → 2.75.1
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/StoragePreviousHashStore.cjs +72 -0
- package/dist/browser/StoragePreviousHashStore.cjs.map +1 -0
- package/dist/browser/StoragePreviousHashStore.d.cts.map +1 -0
- package/dist/browser/StoragePreviousHashStore.d.mts.map +1 -0
- package/dist/browser/StoragePreviousHashStore.d.ts +21 -0
- package/dist/browser/StoragePreviousHashStore.d.ts.map +1 -0
- package/dist/browser/StoragePreviousHashStore.js +40 -0
- package/dist/browser/StoragePreviousHashStore.js.map +1 -0
- package/dist/{index.js → browser/index.cjs} +1 -5
- package/dist/browser/index.cjs.map +1 -0
- package/dist/browser/index.d.cts.map +1 -0
- package/dist/{index.d.mts.map → browser/index.d.mts.map} +1 -1
- package/dist/browser/index.d.ts +2 -0
- package/dist/{index.d.ts.map → browser/index.d.ts.map} +1 -1
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/docs.json +25 -25
- package/dist/node/StoragePreviousHashStore.d.cts +21 -0
- package/dist/node/StoragePreviousHashStore.d.cts.map +1 -0
- package/dist/node/StoragePreviousHashStore.d.mts +21 -0
- package/dist/node/StoragePreviousHashStore.d.mts.map +1 -0
- package/dist/node/StoragePreviousHashStore.d.ts +21 -0
- package/dist/node/StoragePreviousHashStore.d.ts.map +1 -0
- package/dist/node/StoragePreviousHashStore.js +76 -0
- package/dist/node/StoragePreviousHashStore.js.map +1 -0
- package/dist/node/StoragePreviousHashStore.mjs +41 -0
- package/dist/node/StoragePreviousHashStore.mjs.map +1 -0
- package/dist/node/index.d.cts +2 -0
- package/dist/node/index.d.cts.map +1 -0
- package/dist/node/index.d.mts +2 -0
- package/dist/node/index.d.mts.map +1 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +78 -0
- package/dist/node/index.js.map +1 -0
- package/dist/{index.mjs → node/index.mjs} +3 -3
- package/dist/node/index.mjs.map +1 -0
- package/package.json +25 -22
- package/dist/StoragePreviousHashStore.d.mts.map +0 -1
- package/dist/StoragePreviousHashStore.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- /package/dist/{StoragePreviousHashStore.d.mts → browser/StoragePreviousHashStore.d.cts} +0 -0
- /package/dist/{StoragePreviousHashStore.d.ts → browser/StoragePreviousHashStore.d.mts} +0 -0
- /package/dist/{index.d.mts → browser/index.d.cts} +0 -0
- /package/dist/{index.d.ts → browser/index.d.mts} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/StoragePreviousHashStore.ts
|
|
31
|
+
var StoragePreviousHashStore_exports = {};
|
|
32
|
+
__export(StoragePreviousHashStore_exports, {
|
|
33
|
+
StoragePreviousHashStore: () => StoragePreviousHashStore
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(StoragePreviousHashStore_exports);
|
|
36
|
+
var import_store2 = __toESM(require("store2"));
|
|
37
|
+
var StoragePreviousHashStore = class _StoragePreviousHashStore {
|
|
38
|
+
static DefaultNamespace = "xyo-previous-hash-store";
|
|
39
|
+
static DefaultStorageType = "local";
|
|
40
|
+
_namespace = _StoragePreviousHashStore.DefaultNamespace;
|
|
41
|
+
_storage;
|
|
42
|
+
_type = _StoragePreviousHashStore.DefaultStorageType;
|
|
43
|
+
constructor(opts) {
|
|
44
|
+
if (opts?.namespace)
|
|
45
|
+
this._namespace = opts.namespace;
|
|
46
|
+
if (opts?.type)
|
|
47
|
+
this._type = opts.type;
|
|
48
|
+
this._storage = import_store2.default[this.type].namespace(this.namespace);
|
|
49
|
+
}
|
|
50
|
+
get namespace() {
|
|
51
|
+
return this._namespace;
|
|
52
|
+
}
|
|
53
|
+
get type() {
|
|
54
|
+
return this._type;
|
|
55
|
+
}
|
|
56
|
+
get storage() {
|
|
57
|
+
if (!this?._storage)
|
|
58
|
+
this._storage = import_store2.default[this.type].namespace(this.namespace);
|
|
59
|
+
return this._storage;
|
|
60
|
+
}
|
|
61
|
+
async getItem(address) {
|
|
62
|
+
const value = await this.storage.get(address);
|
|
63
|
+
return value ?? null;
|
|
64
|
+
}
|
|
65
|
+
async removeItem(address) {
|
|
66
|
+
await this.storage.remove(address);
|
|
67
|
+
}
|
|
68
|
+
async setItem(address, previousHash) {
|
|
69
|
+
await this.storage.set(address, previousHash);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=StoragePreviousHashStore.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/StoragePreviousHashStore.ts"],"sourcesContent":["import { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\nimport store, { StoreBase } from 'store2'\n\nexport type Storage = 'local' | 'session' | 'page'\n\nexport type StoragePreviousHashOpts = {\n namespace?: string\n type?: Storage\n}\n\nexport class StoragePreviousHashStore implements PreviousHashStore {\n static readonly DefaultNamespace = 'xyo-previous-hash-store'\n static readonly DefaultStorageType: Storage = 'local'\n private _namespace = StoragePreviousHashStore.DefaultNamespace\n private _storage: StoreBase | undefined\n private _type: Storage = StoragePreviousHashStore.DefaultStorageType\n\n constructor(opts?: StoragePreviousHashOpts) {\n if (opts?.namespace) this._namespace = opts.namespace\n if (opts?.type) this._type = opts.type\n this._storage = store[this.type].namespace(this.namespace)\n }\n\n get namespace() {\n return this._namespace\n }\n\n get type(): Storage {\n return this._type\n }\n\n private get storage(): StoreBase {\n if (!this?._storage) this._storage = store[this.type].namespace(this.namespace)\n return this._storage\n }\n\n async getItem(address: string): Promise<string | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: string): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: string, previousHash: string): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAiC;AAS1B,IAAM,2BAAN,MAAM,0BAAsD;AAAA,EACjE,OAAgB,mBAAmB;AAAA,EACnC,OAAgB,qBAA8B;AAAA,EACtC,aAAa,0BAAyB;AAAA,EACtC;AAAA,EACA,QAAiB,0BAAyB;AAAA,EAElD,YAAY,MAAgC;AAC1C,QAAI,MAAM;AAAW,WAAK,aAAa,KAAK;AAC5C,QAAI,MAAM;AAAM,WAAK,QAAQ,KAAK;AAClC,SAAK,WAAW,cAAAA,QAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EAC3D;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAC/B,QAAI,CAAC,MAAM;AAAU,WAAK,WAAW,cAAAA,QAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAC9E,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAyC;AACrD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,MAAM,WAAW,SAAgC;AAC/C,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EACA,MAAM,QAAQ,SAAiB,cAAqC;AAClE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":["store"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoragePreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/StoragePreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAG1E,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,qBAAa,wBAAyB,YAAW,iBAAiB;IAChE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,6BAA4B;IAC5D,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAU;IACrD,OAAO,CAAC,UAAU,CAA4C;IAC9D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,KAAK,CAAuD;gBAExD,IAAI,CAAC,EAAE,uBAAuB;IAM1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAGlB;IAEK,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIhD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAG1C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoragePreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/StoragePreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAG1E,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,qBAAa,wBAAyB,YAAW,iBAAiB;IAChE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,6BAA4B;IAC5D,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAU;IACrD,OAAO,CAAC,UAAU,CAA4C;IAC9D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,KAAK,CAAuD;gBAExD,IAAI,CAAC,EAAE,uBAAuB;IAM1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAGlB;IAEK,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIhD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAG1C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
|
|
2
|
+
export type Storage = 'local' | 'session' | 'page';
|
|
3
|
+
export type StoragePreviousHashOpts = {
|
|
4
|
+
namespace?: string;
|
|
5
|
+
type?: Storage;
|
|
6
|
+
};
|
|
7
|
+
export declare class StoragePreviousHashStore implements PreviousHashStore {
|
|
8
|
+
static readonly DefaultNamespace = "xyo-previous-hash-store";
|
|
9
|
+
static readonly DefaultStorageType: Storage;
|
|
10
|
+
private _namespace;
|
|
11
|
+
private _storage;
|
|
12
|
+
private _type;
|
|
13
|
+
constructor(opts?: StoragePreviousHashOpts);
|
|
14
|
+
get namespace(): string;
|
|
15
|
+
get type(): Storage;
|
|
16
|
+
private get storage();
|
|
17
|
+
getItem(address: string): Promise<string | null>;
|
|
18
|
+
removeItem(address: string): Promise<void>;
|
|
19
|
+
setItem(address: string, previousHash: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=StoragePreviousHashStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoragePreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/StoragePreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAG1E,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,qBAAa,wBAAyB,YAAW,iBAAiB;IAChE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,6BAA4B;IAC5D,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAU;IACrD,OAAO,CAAC,UAAU,CAA4C;IAC9D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,KAAK,CAAuD;gBAExD,IAAI,CAAC,EAAE,uBAAuB;IAM1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAGlB;IAEK,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIhD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAG1C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import store from "store2";
|
|
2
|
+
class StoragePreviousHashStore {
|
|
3
|
+
static DefaultNamespace = "xyo-previous-hash-store";
|
|
4
|
+
static DefaultStorageType = "local";
|
|
5
|
+
_namespace = StoragePreviousHashStore.DefaultNamespace;
|
|
6
|
+
_storage;
|
|
7
|
+
_type = StoragePreviousHashStore.DefaultStorageType;
|
|
8
|
+
constructor(opts) {
|
|
9
|
+
if (opts?.namespace)
|
|
10
|
+
this._namespace = opts.namespace;
|
|
11
|
+
if (opts?.type)
|
|
12
|
+
this._type = opts.type;
|
|
13
|
+
this._storage = store[this.type].namespace(this.namespace);
|
|
14
|
+
}
|
|
15
|
+
get namespace() {
|
|
16
|
+
return this._namespace;
|
|
17
|
+
}
|
|
18
|
+
get type() {
|
|
19
|
+
return this._type;
|
|
20
|
+
}
|
|
21
|
+
get storage() {
|
|
22
|
+
if (!this?._storage)
|
|
23
|
+
this._storage = store[this.type].namespace(this.namespace);
|
|
24
|
+
return this._storage;
|
|
25
|
+
}
|
|
26
|
+
async getItem(address) {
|
|
27
|
+
const value = await this.storage.get(address);
|
|
28
|
+
return value ?? null;
|
|
29
|
+
}
|
|
30
|
+
async removeItem(address) {
|
|
31
|
+
await this.storage.remove(address);
|
|
32
|
+
}
|
|
33
|
+
async setItem(address, previousHash) {
|
|
34
|
+
await this.storage.set(address, previousHash);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
StoragePreviousHashStore
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=StoragePreviousHashStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/StoragePreviousHashStore.ts"],"sourcesContent":["import { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\nimport store, { StoreBase } from 'store2'\n\nexport type Storage = 'local' | 'session' | 'page'\n\nexport type StoragePreviousHashOpts = {\n namespace?: string\n type?: Storage\n}\n\nexport class StoragePreviousHashStore implements PreviousHashStore {\n static readonly DefaultNamespace = 'xyo-previous-hash-store'\n static readonly DefaultStorageType: Storage = 'local'\n private _namespace = StoragePreviousHashStore.DefaultNamespace\n private _storage: StoreBase | undefined\n private _type: Storage = StoragePreviousHashStore.DefaultStorageType\n\n constructor(opts?: StoragePreviousHashOpts) {\n if (opts?.namespace) this._namespace = opts.namespace\n if (opts?.type) this._type = opts.type\n this._storage = store[this.type].namespace(this.namespace)\n }\n\n get namespace() {\n return this._namespace\n }\n\n get type(): Storage {\n return this._type\n }\n\n private get storage(): StoreBase {\n if (!this?._storage) this._storage = store[this.type].namespace(this.namespace)\n return this._storage\n }\n\n async getItem(address: string): Promise<string | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: string): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: string, previousHash: string): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":"AACA,OAAO,WAA0B;AAS1B,MAAM,yBAAsD;AAAA,EACjE,OAAgB,mBAAmB;AAAA,EACnC,OAAgB,qBAA8B;AAAA,EACtC,aAAa,yBAAyB;AAAA,EACtC;AAAA,EACA,QAAiB,yBAAyB;AAAA,EAElD,YAAY,MAAgC;AAC1C,QAAI,MAAM;AAAW,WAAK,aAAa,KAAK;AAC5C,QAAI,MAAM;AAAM,WAAK,QAAQ,KAAK;AAClC,SAAK,WAAW,MAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EAC3D;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAC/B,QAAI,CAAC,MAAM;AAAU,WAAK,WAAW,MAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAC9E,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAyC;AACrD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,MAAM,WAAW,SAAgC;AAC/C,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EACA,MAAM,QAAQ,SAAiB,cAAqC;AAClE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":[]}
|
|
@@ -71,8 +71,4 @@ var StoragePreviousHashStore = class _StoragePreviousHashStore {
|
|
|
71
71
|
await this.storage.set(address, previousHash);
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
|
|
75
|
-
0 && (module.exports = {
|
|
76
|
-
StoragePreviousHashStore
|
|
77
|
-
});
|
|
78
|
-
//# sourceMappingURL=index.js.map
|
|
74
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/StoragePreviousHashStore.ts"],"sourcesContent":["export * from './StoragePreviousHashStore'\n","import { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\nimport store, { StoreBase } from 'store2'\n\nexport type Storage = 'local' | 'session' | 'page'\n\nexport type StoragePreviousHashOpts = {\n namespace?: string\n type?: Storage\n}\n\nexport class StoragePreviousHashStore implements PreviousHashStore {\n static readonly DefaultNamespace = 'xyo-previous-hash-store'\n static readonly DefaultStorageType: Storage = 'local'\n private _namespace = StoragePreviousHashStore.DefaultNamespace\n private _storage: StoreBase | undefined\n private _type: Storage = StoragePreviousHashStore.DefaultStorageType\n\n constructor(opts?: StoragePreviousHashOpts) {\n if (opts?.namespace) this._namespace = opts.namespace\n if (opts?.type) this._type = opts.type\n this._storage = store[this.type].namespace(this.namespace)\n }\n\n get namespace() {\n return this._namespace\n }\n\n get type(): Storage {\n return this._type\n }\n\n private get storage(): StoreBase {\n if (!this?._storage) this._storage = store[this.type].namespace(this.namespace)\n return this._storage\n }\n\n async getItem(address: string): Promise<string | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: string): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: string, previousHash: string): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,oBAAiC;AAS1B,IAAM,2BAAN,MAAM,0BAAsD;AAAA,EACjE,OAAgB,mBAAmB;AAAA,EACnC,OAAgB,qBAA8B;AAAA,EACtC,aAAa,0BAAyB;AAAA,EACtC;AAAA,EACA,QAAiB,0BAAyB;AAAA,EAElD,YAAY,MAAgC;AAC1C,QAAI,MAAM;AAAW,WAAK,aAAa,KAAK;AAC5C,QAAI,MAAM;AAAM,WAAK,QAAQ,KAAK;AAClC,SAAK,WAAW,cAAAA,QAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EAC3D;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAC/B,QAAI,CAAC,MAAM;AAAU,WAAK,WAAW,cAAAA,QAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAC9E,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAyC;AACrD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,MAAM,WAAW,SAAgC;AAC/C,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EACA,MAAM,QAAQ,SAAiB,cAAqC;AAClE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":["store"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './StoragePreviousHashStore'\n"],"mappings":"AAAA,cAAc;","names":[]}
|
package/dist/docs.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"fileName": "StoragePreviousHashStore.ts",
|
|
24
24
|
"line": 18,
|
|
25
25
|
"character": 2,
|
|
26
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
26
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L18"
|
|
27
27
|
}
|
|
28
28
|
],
|
|
29
29
|
"signatures": [
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"fileName": "StoragePreviousHashStore.ts",
|
|
39
39
|
"line": 18,
|
|
40
40
|
"character": 2,
|
|
41
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
41
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L18"
|
|
42
42
|
}
|
|
43
43
|
],
|
|
44
44
|
"parameters": [
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"fileName": "StoragePreviousHashStore.ts",
|
|
81
81
|
"line": 14,
|
|
82
82
|
"character": 10,
|
|
83
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
83
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L14"
|
|
84
84
|
}
|
|
85
85
|
],
|
|
86
86
|
"type": {
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"fileName": "StoragePreviousHashStore.ts",
|
|
103
103
|
"line": 15,
|
|
104
104
|
"character": 10,
|
|
105
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
105
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L15"
|
|
106
106
|
}
|
|
107
107
|
],
|
|
108
108
|
"type": {
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"fileName": "StoragePreviousHashStore.ts",
|
|
138
138
|
"line": 16,
|
|
139
139
|
"character": 10,
|
|
140
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
140
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L16"
|
|
141
141
|
}
|
|
142
142
|
],
|
|
143
143
|
"type": {
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"fileName": "StoragePreviousHashStore.ts",
|
|
163
163
|
"line": 12,
|
|
164
164
|
"character": 18,
|
|
165
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
165
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L12"
|
|
166
166
|
}
|
|
167
167
|
],
|
|
168
168
|
"type": {
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
"fileName": "StoragePreviousHashStore.ts",
|
|
186
186
|
"line": 13,
|
|
187
187
|
"character": 18,
|
|
188
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
188
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L13"
|
|
189
189
|
}
|
|
190
190
|
],
|
|
191
191
|
"type": {
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
"fileName": "StoragePreviousHashStore.ts",
|
|
208
208
|
"line": 24,
|
|
209
209
|
"character": 6,
|
|
210
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
210
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L24"
|
|
211
211
|
}
|
|
212
212
|
],
|
|
213
213
|
"getSignature": {
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
"fileName": "StoragePreviousHashStore.ts",
|
|
222
222
|
"line": 24,
|
|
223
223
|
"character": 2,
|
|
224
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
224
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L24"
|
|
225
225
|
}
|
|
226
226
|
],
|
|
227
227
|
"type": {
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
"fileName": "StoragePreviousHashStore.ts",
|
|
244
244
|
"line": 32,
|
|
245
245
|
"character": 14,
|
|
246
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
246
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L32"
|
|
247
247
|
}
|
|
248
248
|
],
|
|
249
249
|
"getSignature": {
|
|
@@ -257,7 +257,7 @@
|
|
|
257
257
|
"fileName": "StoragePreviousHashStore.ts",
|
|
258
258
|
"line": 32,
|
|
259
259
|
"character": 2,
|
|
260
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
260
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L32"
|
|
261
261
|
}
|
|
262
262
|
],
|
|
263
263
|
"type": {
|
|
@@ -282,7 +282,7 @@
|
|
|
282
282
|
"fileName": "StoragePreviousHashStore.ts",
|
|
283
283
|
"line": 28,
|
|
284
284
|
"character": 6,
|
|
285
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
285
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L28"
|
|
286
286
|
}
|
|
287
287
|
],
|
|
288
288
|
"getSignature": {
|
|
@@ -296,7 +296,7 @@
|
|
|
296
296
|
"fileName": "StoragePreviousHashStore.ts",
|
|
297
297
|
"line": 28,
|
|
298
298
|
"character": 2,
|
|
299
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
299
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L28"
|
|
300
300
|
}
|
|
301
301
|
],
|
|
302
302
|
"type": {
|
|
@@ -318,7 +318,7 @@
|
|
|
318
318
|
"fileName": "StoragePreviousHashStore.ts",
|
|
319
319
|
"line": 37,
|
|
320
320
|
"character": 8,
|
|
321
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
321
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L37"
|
|
322
322
|
}
|
|
323
323
|
],
|
|
324
324
|
"signatures": [
|
|
@@ -333,7 +333,7 @@
|
|
|
333
333
|
"fileName": "StoragePreviousHashStore.ts",
|
|
334
334
|
"line": 37,
|
|
335
335
|
"character": 2,
|
|
336
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
336
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L37"
|
|
337
337
|
}
|
|
338
338
|
],
|
|
339
339
|
"parameters": [
|
|
@@ -397,7 +397,7 @@
|
|
|
397
397
|
"fileName": "StoragePreviousHashStore.ts",
|
|
398
398
|
"line": 41,
|
|
399
399
|
"character": 8,
|
|
400
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
400
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L41"
|
|
401
401
|
}
|
|
402
402
|
],
|
|
403
403
|
"signatures": [
|
|
@@ -412,7 +412,7 @@
|
|
|
412
412
|
"fileName": "StoragePreviousHashStore.ts",
|
|
413
413
|
"line": 41,
|
|
414
414
|
"character": 2,
|
|
415
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
415
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L41"
|
|
416
416
|
}
|
|
417
417
|
],
|
|
418
418
|
"parameters": [
|
|
@@ -467,7 +467,7 @@
|
|
|
467
467
|
"fileName": "StoragePreviousHashStore.ts",
|
|
468
468
|
"line": 44,
|
|
469
469
|
"character": 8,
|
|
470
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
470
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L44"
|
|
471
471
|
}
|
|
472
472
|
],
|
|
473
473
|
"signatures": [
|
|
@@ -482,7 +482,7 @@
|
|
|
482
482
|
"fileName": "StoragePreviousHashStore.ts",
|
|
483
483
|
"line": 44,
|
|
484
484
|
"character": 2,
|
|
485
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
485
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L44"
|
|
486
486
|
}
|
|
487
487
|
],
|
|
488
488
|
"parameters": [
|
|
@@ -577,7 +577,7 @@
|
|
|
577
577
|
"fileName": "StoragePreviousHashStore.ts",
|
|
578
578
|
"line": 11,
|
|
579
579
|
"character": 13,
|
|
580
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
580
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L11"
|
|
581
581
|
}
|
|
582
582
|
],
|
|
583
583
|
"implementedTypes": [
|
|
@@ -603,7 +603,7 @@
|
|
|
603
603
|
"fileName": "StoragePreviousHashStore.ts",
|
|
604
604
|
"line": 4,
|
|
605
605
|
"character": 12,
|
|
606
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
606
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L4"
|
|
607
607
|
}
|
|
608
608
|
],
|
|
609
609
|
"type": {
|
|
@@ -635,7 +635,7 @@
|
|
|
635
635
|
"fileName": "StoragePreviousHashStore.ts",
|
|
636
636
|
"line": 6,
|
|
637
637
|
"character": 12,
|
|
638
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
638
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L6"
|
|
639
639
|
}
|
|
640
640
|
],
|
|
641
641
|
"type": {
|
|
@@ -660,7 +660,7 @@
|
|
|
660
660
|
"fileName": "StoragePreviousHashStore.ts",
|
|
661
661
|
"line": 7,
|
|
662
662
|
"character": 2,
|
|
663
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
663
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L7"
|
|
664
664
|
}
|
|
665
665
|
],
|
|
666
666
|
"type": {
|
|
@@ -681,7 +681,7 @@
|
|
|
681
681
|
"fileName": "StoragePreviousHashStore.ts",
|
|
682
682
|
"line": 8,
|
|
683
683
|
"character": 2,
|
|
684
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
684
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L8"
|
|
685
685
|
}
|
|
686
686
|
],
|
|
687
687
|
"type": {
|
|
@@ -706,7 +706,7 @@
|
|
|
706
706
|
"fileName": "StoragePreviousHashStore.ts",
|
|
707
707
|
"line": 6,
|
|
708
708
|
"character": 38,
|
|
709
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/
|
|
709
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/ca3276aa9c376/packages/protocol/packages/account/packages/previous-hash-store/packages/storage/src/StoragePreviousHashStore.ts#L6"
|
|
710
710
|
}
|
|
711
711
|
]
|
|
712
712
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
|
|
2
|
+
export type Storage = 'local' | 'session' | 'page';
|
|
3
|
+
export type StoragePreviousHashOpts = {
|
|
4
|
+
namespace?: string;
|
|
5
|
+
type?: Storage;
|
|
6
|
+
};
|
|
7
|
+
export declare class StoragePreviousHashStore implements PreviousHashStore {
|
|
8
|
+
static readonly DefaultNamespace = "xyo-previous-hash-store";
|
|
9
|
+
static readonly DefaultStorageType: Storage;
|
|
10
|
+
private _namespace;
|
|
11
|
+
private _storage;
|
|
12
|
+
private _type;
|
|
13
|
+
constructor(opts?: StoragePreviousHashOpts);
|
|
14
|
+
get namespace(): string;
|
|
15
|
+
get type(): Storage;
|
|
16
|
+
private get storage();
|
|
17
|
+
getItem(address: string): Promise<string | null>;
|
|
18
|
+
removeItem(address: string): Promise<void>;
|
|
19
|
+
setItem(address: string, previousHash: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=StoragePreviousHashStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoragePreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/StoragePreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAG1E,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,qBAAa,wBAAyB,YAAW,iBAAiB;IAChE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,6BAA4B;IAC5D,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAU;IACrD,OAAO,CAAC,UAAU,CAA4C;IAC9D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,KAAK,CAAuD;gBAExD,IAAI,CAAC,EAAE,uBAAuB;IAM1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAGlB;IAEK,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIhD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAG1C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
|
|
2
|
+
export type Storage = 'local' | 'session' | 'page';
|
|
3
|
+
export type StoragePreviousHashOpts = {
|
|
4
|
+
namespace?: string;
|
|
5
|
+
type?: Storage;
|
|
6
|
+
};
|
|
7
|
+
export declare class StoragePreviousHashStore implements PreviousHashStore {
|
|
8
|
+
static readonly DefaultNamespace = "xyo-previous-hash-store";
|
|
9
|
+
static readonly DefaultStorageType: Storage;
|
|
10
|
+
private _namespace;
|
|
11
|
+
private _storage;
|
|
12
|
+
private _type;
|
|
13
|
+
constructor(opts?: StoragePreviousHashOpts);
|
|
14
|
+
get namespace(): string;
|
|
15
|
+
get type(): Storage;
|
|
16
|
+
private get storage();
|
|
17
|
+
getItem(address: string): Promise<string | null>;
|
|
18
|
+
removeItem(address: string): Promise<void>;
|
|
19
|
+
setItem(address: string, previousHash: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=StoragePreviousHashStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoragePreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/StoragePreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAG1E,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,qBAAa,wBAAyB,YAAW,iBAAiB;IAChE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,6BAA4B;IAC5D,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAU;IACrD,OAAO,CAAC,UAAU,CAA4C;IAC9D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,KAAK,CAAuD;gBAExD,IAAI,CAAC,EAAE,uBAAuB;IAM1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAGlB;IAEK,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIhD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAG1C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
|
|
2
|
+
export type Storage = 'local' | 'session' | 'page';
|
|
3
|
+
export type StoragePreviousHashOpts = {
|
|
4
|
+
namespace?: string;
|
|
5
|
+
type?: Storage;
|
|
6
|
+
};
|
|
7
|
+
export declare class StoragePreviousHashStore implements PreviousHashStore {
|
|
8
|
+
static readonly DefaultNamespace = "xyo-previous-hash-store";
|
|
9
|
+
static readonly DefaultStorageType: Storage;
|
|
10
|
+
private _namespace;
|
|
11
|
+
private _storage;
|
|
12
|
+
private _type;
|
|
13
|
+
constructor(opts?: StoragePreviousHashOpts);
|
|
14
|
+
get namespace(): string;
|
|
15
|
+
get type(): Storage;
|
|
16
|
+
private get storage();
|
|
17
|
+
getItem(address: string): Promise<string | null>;
|
|
18
|
+
removeItem(address: string): Promise<void>;
|
|
19
|
+
setItem(address: string, previousHash: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=StoragePreviousHashStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoragePreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/StoragePreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAG1E,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,qBAAa,wBAAyB,YAAW,iBAAiB;IAChE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,6BAA4B;IAC5D,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAU;IACrD,OAAO,CAAC,UAAU,CAA4C;IAC9D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,KAAK,CAAuD;gBAExD,IAAI,CAAC,EAAE,uBAAuB;IAM1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAGlB;IAEK,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIhD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAG1C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpE"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/StoragePreviousHashStore.ts
|
|
31
|
+
var StoragePreviousHashStore_exports = {};
|
|
32
|
+
__export(StoragePreviousHashStore_exports, {
|
|
33
|
+
StoragePreviousHashStore: () => StoragePreviousHashStore
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(StoragePreviousHashStore_exports);
|
|
36
|
+
var import_store2 = __toESM(require("store2"));
|
|
37
|
+
var StoragePreviousHashStore = class _StoragePreviousHashStore {
|
|
38
|
+
static DefaultNamespace = "xyo-previous-hash-store";
|
|
39
|
+
static DefaultStorageType = "local";
|
|
40
|
+
_namespace = _StoragePreviousHashStore.DefaultNamespace;
|
|
41
|
+
_storage;
|
|
42
|
+
_type = _StoragePreviousHashStore.DefaultStorageType;
|
|
43
|
+
constructor(opts) {
|
|
44
|
+
if (opts == null ? void 0 : opts.namespace)
|
|
45
|
+
this._namespace = opts.namespace;
|
|
46
|
+
if (opts == null ? void 0 : opts.type)
|
|
47
|
+
this._type = opts.type;
|
|
48
|
+
this._storage = import_store2.default[this.type].namespace(this.namespace);
|
|
49
|
+
}
|
|
50
|
+
get namespace() {
|
|
51
|
+
return this._namespace;
|
|
52
|
+
}
|
|
53
|
+
get type() {
|
|
54
|
+
return this._type;
|
|
55
|
+
}
|
|
56
|
+
get storage() {
|
|
57
|
+
if (!(this == null ? void 0 : this._storage))
|
|
58
|
+
this._storage = import_store2.default[this.type].namespace(this.namespace);
|
|
59
|
+
return this._storage;
|
|
60
|
+
}
|
|
61
|
+
async getItem(address) {
|
|
62
|
+
const value = await this.storage.get(address);
|
|
63
|
+
return value ?? null;
|
|
64
|
+
}
|
|
65
|
+
async removeItem(address) {
|
|
66
|
+
await this.storage.remove(address);
|
|
67
|
+
}
|
|
68
|
+
async setItem(address, previousHash) {
|
|
69
|
+
await this.storage.set(address, previousHash);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
StoragePreviousHashStore
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=StoragePreviousHashStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/StoragePreviousHashStore.ts"],"sourcesContent":["import { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\nimport store, { StoreBase } from 'store2'\n\nexport type Storage = 'local' | 'session' | 'page'\n\nexport type StoragePreviousHashOpts = {\n namespace?: string\n type?: Storage\n}\n\nexport class StoragePreviousHashStore implements PreviousHashStore {\n static readonly DefaultNamespace = 'xyo-previous-hash-store'\n static readonly DefaultStorageType: Storage = 'local'\n private _namespace = StoragePreviousHashStore.DefaultNamespace\n private _storage: StoreBase | undefined\n private _type: Storage = StoragePreviousHashStore.DefaultStorageType\n\n constructor(opts?: StoragePreviousHashOpts) {\n if (opts?.namespace) this._namespace = opts.namespace\n if (opts?.type) this._type = opts.type\n this._storage = store[this.type].namespace(this.namespace)\n }\n\n get namespace() {\n return this._namespace\n }\n\n get type(): Storage {\n return this._type\n }\n\n private get storage(): StoreBase {\n if (!this?._storage) this._storage = store[this.type].namespace(this.namespace)\n return this._storage\n }\n\n async getItem(address: string): Promise<string | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: string): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: string, previousHash: string): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAiC;AAS1B,IAAM,2BAAN,MAAM,0BAAsD;AAAA,EACjE,OAAgB,mBAAmB;AAAA,EACnC,OAAgB,qBAA8B;AAAA,EACtC,aAAa,0BAAyB;AAAA,EACtC;AAAA,EACA,QAAiB,0BAAyB;AAAA,EAElD,YAAY,MAAgC;AAC1C,QAAI,6BAAM;AAAW,WAAK,aAAa,KAAK;AAC5C,QAAI,6BAAM;AAAM,WAAK,QAAQ,KAAK;AAClC,SAAK,WAAW,cAAAA,QAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EAC3D;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAC/B,QAAI,EAAC,6BAAM;AAAU,WAAK,WAAW,cAAAA,QAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAC9E,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAyC;AACrD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,MAAM,WAAW,SAAgC;AAC/C,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EACA,MAAM,QAAQ,SAAiB,cAAqC;AAClE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":["store"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/StoragePreviousHashStore.ts
|
|
2
|
+
import store from "store2";
|
|
3
|
+
var StoragePreviousHashStore = class _StoragePreviousHashStore {
|
|
4
|
+
static DefaultNamespace = "xyo-previous-hash-store";
|
|
5
|
+
static DefaultStorageType = "local";
|
|
6
|
+
_namespace = _StoragePreviousHashStore.DefaultNamespace;
|
|
7
|
+
_storage;
|
|
8
|
+
_type = _StoragePreviousHashStore.DefaultStorageType;
|
|
9
|
+
constructor(opts) {
|
|
10
|
+
if (opts == null ? void 0 : opts.namespace)
|
|
11
|
+
this._namespace = opts.namespace;
|
|
12
|
+
if (opts == null ? void 0 : opts.type)
|
|
13
|
+
this._type = opts.type;
|
|
14
|
+
this._storage = store[this.type].namespace(this.namespace);
|
|
15
|
+
}
|
|
16
|
+
get namespace() {
|
|
17
|
+
return this._namespace;
|
|
18
|
+
}
|
|
19
|
+
get type() {
|
|
20
|
+
return this._type;
|
|
21
|
+
}
|
|
22
|
+
get storage() {
|
|
23
|
+
if (!(this == null ? void 0 : this._storage))
|
|
24
|
+
this._storage = store[this.type].namespace(this.namespace);
|
|
25
|
+
return this._storage;
|
|
26
|
+
}
|
|
27
|
+
async getItem(address) {
|
|
28
|
+
const value = await this.storage.get(address);
|
|
29
|
+
return value ?? null;
|
|
30
|
+
}
|
|
31
|
+
async removeItem(address) {
|
|
32
|
+
await this.storage.remove(address);
|
|
33
|
+
}
|
|
34
|
+
async setItem(address, previousHash) {
|
|
35
|
+
await this.storage.set(address, previousHash);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
StoragePreviousHashStore
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=StoragePreviousHashStore.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/StoragePreviousHashStore.ts"],"sourcesContent":["import { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\nimport store, { StoreBase } from 'store2'\n\nexport type Storage = 'local' | 'session' | 'page'\n\nexport type StoragePreviousHashOpts = {\n namespace?: string\n type?: Storage\n}\n\nexport class StoragePreviousHashStore implements PreviousHashStore {\n static readonly DefaultNamespace = 'xyo-previous-hash-store'\n static readonly DefaultStorageType: Storage = 'local'\n private _namespace = StoragePreviousHashStore.DefaultNamespace\n private _storage: StoreBase | undefined\n private _type: Storage = StoragePreviousHashStore.DefaultStorageType\n\n constructor(opts?: StoragePreviousHashOpts) {\n if (opts?.namespace) this._namespace = opts.namespace\n if (opts?.type) this._type = opts.type\n this._storage = store[this.type].namespace(this.namespace)\n }\n\n get namespace() {\n return this._namespace\n }\n\n get type(): Storage {\n return this._type\n }\n\n private get storage(): StoreBase {\n if (!this?._storage) this._storage = store[this.type].namespace(this.namespace)\n return this._storage\n }\n\n async getItem(address: string): Promise<string | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: string): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: string, previousHash: string): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";AACA,OAAO,WAA0B;AAS1B,IAAM,2BAAN,MAAM,0BAAsD;AAAA,EACjE,OAAgB,mBAAmB;AAAA,EACnC,OAAgB,qBAA8B;AAAA,EACtC,aAAa,0BAAyB;AAAA,EACtC;AAAA,EACA,QAAiB,0BAAyB;AAAA,EAElD,YAAY,MAAgC;AAC1C,QAAI,6BAAM;AAAW,WAAK,aAAa,KAAK;AAC5C,QAAI,6BAAM;AAAM,WAAK,QAAQ,KAAK;AAClC,SAAK,WAAW,MAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EAC3D;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAC/B,QAAI,EAAC,6BAAM;AAAU,WAAK,WAAW,MAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAC9E,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAyC;AACrD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,MAAM,WAAW,SAAgC;AAC/C,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EACA,MAAM,QAAQ,SAAiB,cAAqC;AAClE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
StoragePreviousHashStore: () => StoragePreviousHashStore
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
|
|
37
|
+
// src/StoragePreviousHashStore.ts
|
|
38
|
+
var import_store2 = __toESM(require("store2"));
|
|
39
|
+
var StoragePreviousHashStore = class _StoragePreviousHashStore {
|
|
40
|
+
static DefaultNamespace = "xyo-previous-hash-store";
|
|
41
|
+
static DefaultStorageType = "local";
|
|
42
|
+
_namespace = _StoragePreviousHashStore.DefaultNamespace;
|
|
43
|
+
_storage;
|
|
44
|
+
_type = _StoragePreviousHashStore.DefaultStorageType;
|
|
45
|
+
constructor(opts) {
|
|
46
|
+
if (opts == null ? void 0 : opts.namespace)
|
|
47
|
+
this._namespace = opts.namespace;
|
|
48
|
+
if (opts == null ? void 0 : opts.type)
|
|
49
|
+
this._type = opts.type;
|
|
50
|
+
this._storage = import_store2.default[this.type].namespace(this.namespace);
|
|
51
|
+
}
|
|
52
|
+
get namespace() {
|
|
53
|
+
return this._namespace;
|
|
54
|
+
}
|
|
55
|
+
get type() {
|
|
56
|
+
return this._type;
|
|
57
|
+
}
|
|
58
|
+
get storage() {
|
|
59
|
+
if (!(this == null ? void 0 : this._storage))
|
|
60
|
+
this._storage = import_store2.default[this.type].namespace(this.namespace);
|
|
61
|
+
return this._storage;
|
|
62
|
+
}
|
|
63
|
+
async getItem(address) {
|
|
64
|
+
const value = await this.storage.get(address);
|
|
65
|
+
return value ?? null;
|
|
66
|
+
}
|
|
67
|
+
async removeItem(address) {
|
|
68
|
+
await this.storage.remove(address);
|
|
69
|
+
}
|
|
70
|
+
async setItem(address, previousHash) {
|
|
71
|
+
await this.storage.set(address, previousHash);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
StoragePreviousHashStore
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/StoragePreviousHashStore.ts"],"sourcesContent":["export * from './StoragePreviousHashStore'\n","import { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\nimport store, { StoreBase } from 'store2'\n\nexport type Storage = 'local' | 'session' | 'page'\n\nexport type StoragePreviousHashOpts = {\n namespace?: string\n type?: Storage\n}\n\nexport class StoragePreviousHashStore implements PreviousHashStore {\n static readonly DefaultNamespace = 'xyo-previous-hash-store'\n static readonly DefaultStorageType: Storage = 'local'\n private _namespace = StoragePreviousHashStore.DefaultNamespace\n private _storage: StoreBase | undefined\n private _type: Storage = StoragePreviousHashStore.DefaultStorageType\n\n constructor(opts?: StoragePreviousHashOpts) {\n if (opts?.namespace) this._namespace = opts.namespace\n if (opts?.type) this._type = opts.type\n this._storage = store[this.type].namespace(this.namespace)\n }\n\n get namespace() {\n return this._namespace\n }\n\n get type(): Storage {\n return this._type\n }\n\n private get storage(): StoreBase {\n if (!this?._storage) this._storage = store[this.type].namespace(this.namespace)\n return this._storage\n }\n\n async getItem(address: string): Promise<string | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: string): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: string, previousHash: string): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,oBAAiC;AAS1B,IAAM,2BAAN,MAAM,0BAAsD;AAAA,EACjE,OAAgB,mBAAmB;AAAA,EACnC,OAAgB,qBAA8B;AAAA,EACtC,aAAa,0BAAyB;AAAA,EACtC;AAAA,EACA,QAAiB,0BAAyB;AAAA,EAElD,YAAY,MAAgC;AAC1C,QAAI,6BAAM;AAAW,WAAK,aAAa,KAAK;AAC5C,QAAI,6BAAM;AAAM,WAAK,QAAQ,KAAK;AAClC,SAAK,WAAW,cAAAA,QAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EAC3D;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAC/B,QAAI,EAAC,6BAAM;AAAU,WAAK,WAAW,cAAAA,QAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAC9E,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAyC;AACrD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,MAAM,WAAW,SAAgC;AAC/C,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EACA,MAAM,QAAQ,SAAiB,cAAqC;AAClE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":["store"]}
|
|
@@ -7,9 +7,9 @@ var StoragePreviousHashStore = class _StoragePreviousHashStore {
|
|
|
7
7
|
_storage;
|
|
8
8
|
_type = _StoragePreviousHashStore.DefaultStorageType;
|
|
9
9
|
constructor(opts) {
|
|
10
|
-
if (opts
|
|
10
|
+
if (opts == null ? void 0 : opts.namespace)
|
|
11
11
|
this._namespace = opts.namespace;
|
|
12
|
-
if (opts
|
|
12
|
+
if (opts == null ? void 0 : opts.type)
|
|
13
13
|
this._type = opts.type;
|
|
14
14
|
this._storage = store[this.type].namespace(this.namespace);
|
|
15
15
|
}
|
|
@@ -20,7 +20,7 @@ var StoragePreviousHashStore = class _StoragePreviousHashStore {
|
|
|
20
20
|
return this._type;
|
|
21
21
|
}
|
|
22
22
|
get storage() {
|
|
23
|
-
if (!this
|
|
23
|
+
if (!(this == null ? void 0 : this._storage))
|
|
24
24
|
this._storage = store[this.type].namespace(this.namespace);
|
|
25
25
|
return this._storage;
|
|
26
26
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/StoragePreviousHashStore.ts"],"sourcesContent":["import { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\nimport store, { StoreBase } from 'store2'\n\nexport type Storage = 'local' | 'session' | 'page'\n\nexport type StoragePreviousHashOpts = {\n namespace?: string\n type?: Storage\n}\n\nexport class StoragePreviousHashStore implements PreviousHashStore {\n static readonly DefaultNamespace = 'xyo-previous-hash-store'\n static readonly DefaultStorageType: Storage = 'local'\n private _namespace = StoragePreviousHashStore.DefaultNamespace\n private _storage: StoreBase | undefined\n private _type: Storage = StoragePreviousHashStore.DefaultStorageType\n\n constructor(opts?: StoragePreviousHashOpts) {\n if (opts?.namespace) this._namespace = opts.namespace\n if (opts?.type) this._type = opts.type\n this._storage = store[this.type].namespace(this.namespace)\n }\n\n get namespace() {\n return this._namespace\n }\n\n get type(): Storage {\n return this._type\n }\n\n private get storage(): StoreBase {\n if (!this?._storage) this._storage = store[this.type].namespace(this.namespace)\n return this._storage\n }\n\n async getItem(address: string): Promise<string | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: string): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: string, previousHash: string): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";AACA,OAAO,WAA0B;AAS1B,IAAM,2BAAN,MAAM,0BAAsD;AAAA,EACjE,OAAgB,mBAAmB;AAAA,EACnC,OAAgB,qBAA8B;AAAA,EACtC,aAAa,0BAAyB;AAAA,EACtC;AAAA,EACA,QAAiB,0BAAyB;AAAA,EAElD,YAAY,MAAgC;AAC1C,QAAI,6BAAM;AAAW,WAAK,aAAa,KAAK;AAC5C,QAAI,6BAAM;AAAM,WAAK,QAAQ,KAAK;AAClC,SAAK,WAAW,MAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EAC3D;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAC/B,QAAI,EAAC,6BAAM;AAAU,WAAK,WAAW,MAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAC9E,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAyC;AACrD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,MAAM,WAAW,SAAgC;AAC/C,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EACA,MAAM,QAAQ,SAAiB,cAAqC;AAClE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -11,42 +11,45 @@
|
|
|
11
11
|
},
|
|
12
12
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@xyo-network/previous-hash-store-model": "~2.
|
|
14
|
+
"@xyo-network/previous-hash-store-model": "~2.75.1",
|
|
15
15
|
"store2": "^2.14.2"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@xylabs/ts-scripts-yarn3": "^3.0.
|
|
19
|
-
"@xylabs/tsconfig": "^3.0.
|
|
18
|
+
"@xylabs/ts-scripts-yarn3": "^3.0.77",
|
|
19
|
+
"@xylabs/tsconfig": "^3.0.77",
|
|
20
20
|
"typescript": "^5.2.2"
|
|
21
21
|
},
|
|
22
22
|
"docs": "dist/docs.json",
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
25
|
+
"browser": {
|
|
26
|
+
"require": {
|
|
27
|
+
"types": "./dist/browser/index.d.cts",
|
|
28
|
+
"default": "./dist/browser/index.cjs"
|
|
29
|
+
},
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/browser/index.d.mts",
|
|
32
|
+
"default": "./dist/browser/index.js"
|
|
33
|
+
}
|
|
28
34
|
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
35
|
+
"node": {
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./dist/node/index.d.ts",
|
|
38
|
+
"default": "./dist/node/index.js"
|
|
39
|
+
},
|
|
40
|
+
"import": {
|
|
41
|
+
"types": "./dist/node/index.d.mts",
|
|
42
|
+
"default": "./dist/node/index.mjs"
|
|
43
|
+
}
|
|
32
44
|
}
|
|
33
45
|
},
|
|
34
|
-
"./dist/docs.json": {
|
|
35
|
-
"default": "./dist/docs.json"
|
|
36
|
-
},
|
|
37
|
-
"./cjs": {
|
|
38
|
-
"default": "./dist/index.js"
|
|
39
|
-
},
|
|
40
46
|
"./docs": {
|
|
41
47
|
"default": "./dist/docs.json"
|
|
42
48
|
},
|
|
43
|
-
"./esm": {
|
|
44
|
-
"default": "./dist/index.mjs"
|
|
45
|
-
},
|
|
46
49
|
"./package.json": "./package.json"
|
|
47
50
|
},
|
|
48
|
-
"main": "dist/index.js",
|
|
49
|
-
"module": "dist/index.mjs",
|
|
51
|
+
"main": "dist/node/index.js",
|
|
52
|
+
"module": "dist/node/index.mjs",
|
|
50
53
|
"homepage": "https://xyo.network",
|
|
51
54
|
"license": "LGPL-3.0",
|
|
52
55
|
"publishConfig": {
|
|
@@ -57,6 +60,6 @@
|
|
|
57
60
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
58
61
|
},
|
|
59
62
|
"sideEffects": false,
|
|
60
|
-
"types": "dist/index.d.ts",
|
|
61
|
-
"version": "2.
|
|
63
|
+
"types": "dist/node/index.d.ts",
|
|
64
|
+
"version": "2.75.1"
|
|
62
65
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StoragePreviousHashStore.d.ts","sourceRoot":"","sources":["../src/StoragePreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAG1E,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,qBAAa,wBAAyB,YAAW,iBAAiB;IAChE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,6BAA4B;IAC5D,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAU;IACrD,OAAO,CAAC,UAAU,CAA4C;IAC9D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,KAAK,CAAuD;gBAExD,IAAI,CAAC,EAAE,uBAAuB;IAM1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAGlB;IAEK,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIhD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAG1C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StoragePreviousHashStore.d.ts","sourceRoot":"","sources":["../src/StoragePreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAG1E,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,qBAAa,wBAAyB,YAAW,iBAAiB;IAChE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,6BAA4B;IAC5D,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAU;IACrD,OAAO,CAAC,UAAU,CAA4C;IAC9D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,KAAK,CAAuD;gBAExD,IAAI,CAAC,EAAE,uBAAuB;IAM1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAGlB;IAEK,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIhD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAG1C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpE"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/StoragePreviousHashStore.ts"],"sourcesContent":["export * from './StoragePreviousHashStore'\n","import { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\nimport store, { StoreBase } from 'store2'\n\nexport type Storage = 'local' | 'session' | 'page'\n\nexport type StoragePreviousHashOpts = {\n namespace?: string\n type?: Storage\n}\n\nexport class StoragePreviousHashStore implements PreviousHashStore {\n static readonly DefaultNamespace = 'xyo-previous-hash-store'\n static readonly DefaultStorageType: Storage = 'local'\n private _namespace = StoragePreviousHashStore.DefaultNamespace\n private _storage: StoreBase | undefined\n private _type: Storage = StoragePreviousHashStore.DefaultStorageType\n\n constructor(opts?: StoragePreviousHashOpts) {\n if (opts?.namespace) this._namespace = opts.namespace\n if (opts?.type) this._type = opts.type\n this._storage = store[this.type].namespace(this.namespace)\n }\n\n get namespace() {\n return this._namespace\n }\n\n get type(): Storage {\n return this._type\n }\n\n private get storage(): StoreBase {\n if (!this?._storage) this._storage = store[this.type].namespace(this.namespace)\n return this._storage\n }\n\n async getItem(address: string): Promise<string | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: string): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: string, previousHash: string): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,oBAAiC;AAS1B,IAAM,2BAAN,MAAM,0BAAsD;AAAA,EACjE,OAAgB,mBAAmB;AAAA,EACnC,OAAgB,qBAA8B;AAAA,EACtC,aAAa,0BAAyB;AAAA,EACtC;AAAA,EACA,QAAiB,0BAAyB;AAAA,EAElD,YAAY,MAAgC;AAC1C,QAAI,MAAM;AAAW,WAAK,aAAa,KAAK;AAC5C,QAAI,MAAM;AAAM,WAAK,QAAQ,KAAK;AAClC,SAAK,WAAW,cAAAA,QAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EAC3D;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAC/B,QAAI,CAAC,MAAM;AAAU,WAAK,WAAW,cAAAA,QAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAC9E,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAyC;AACrD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,MAAM,WAAW,SAAgC;AAC/C,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EACA,MAAM,QAAQ,SAAiB,cAAqC;AAClE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":["store"]}
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/StoragePreviousHashStore.ts"],"sourcesContent":["import { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\nimport store, { StoreBase } from 'store2'\n\nexport type Storage = 'local' | 'session' | 'page'\n\nexport type StoragePreviousHashOpts = {\n namespace?: string\n type?: Storage\n}\n\nexport class StoragePreviousHashStore implements PreviousHashStore {\n static readonly DefaultNamespace = 'xyo-previous-hash-store'\n static readonly DefaultStorageType: Storage = 'local'\n private _namespace = StoragePreviousHashStore.DefaultNamespace\n private _storage: StoreBase | undefined\n private _type: Storage = StoragePreviousHashStore.DefaultStorageType\n\n constructor(opts?: StoragePreviousHashOpts) {\n if (opts?.namespace) this._namespace = opts.namespace\n if (opts?.type) this._type = opts.type\n this._storage = store[this.type].namespace(this.namespace)\n }\n\n get namespace() {\n return this._namespace\n }\n\n get type(): Storage {\n return this._type\n }\n\n private get storage(): StoreBase {\n if (!this?._storage) this._storage = store[this.type].namespace(this.namespace)\n return this._storage\n }\n\n async getItem(address: string): Promise<string | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: string): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: string, previousHash: string): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";AACA,OAAO,WAA0B;AAS1B,IAAM,2BAAN,MAAM,0BAAsD;AAAA,EACjE,OAAgB,mBAAmB;AAAA,EACnC,OAAgB,qBAA8B;AAAA,EACtC,aAAa,0BAAyB;AAAA,EACtC;AAAA,EACA,QAAiB,0BAAyB;AAAA,EAElD,YAAY,MAAgC;AAC1C,QAAI,MAAM;AAAW,WAAK,aAAa,KAAK;AAC5C,QAAI,MAAM;AAAM,WAAK,QAAQ,KAAK;AAClC,SAAK,WAAW,MAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EAC3D;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAC/B,QAAI,CAAC,MAAM;AAAU,WAAK,WAAW,MAAM,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAC9E,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAyC;AACrD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EACA,MAAM,WAAW,SAAgC;AAC/C,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EACA,MAAM,QAAQ,SAAiB,cAAqC;AAClE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|