@xyo-network/previous-hash-store-storage 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.
@@ -1,75 +1,2 @@
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/index.ts
32
- var src_exports = {};
33
- __export(src_exports, {
34
- StoragePreviousHashStore: () => StoragePreviousHashStore
35
- });
36
- module.exports = __toCommonJS(src_exports);
37
-
38
- // src/StoragePreviousHashStore.ts
39
- var import_store2 = __toESM(require("store2"), 1);
40
- var StoragePreviousHashStore = class _StoragePreviousHashStore {
41
- static {
42
- __name(this, "StoragePreviousHashStore");
43
- }
44
- static DefaultNamespace = "xyo-previous-hash-store";
45
- static DefaultStorageType = "local";
46
- _namespace = _StoragePreviousHashStore.DefaultNamespace;
47
- _storage;
48
- _type = _StoragePreviousHashStore.DefaultStorageType;
49
- constructor(opts) {
50
- if (opts?.namespace) this._namespace = opts.namespace;
51
- if (opts?.type) this._type = opts.type;
52
- this._storage = import_store2.default[this.type].namespace(this.namespace);
53
- }
54
- get namespace() {
55
- return this._namespace;
56
- }
57
- get type() {
58
- return this._type;
59
- }
60
- get storage() {
61
- if (!this?._storage) this._storage = import_store2.default[this.type].namespace(this.namespace);
62
- return this._storage;
63
- }
64
- async getItem(address) {
65
- const value = await this.storage.get(address);
66
- return value ?? null;
67
- }
68
- async removeItem(address) {
69
- await this.storage.remove(address);
70
- }
71
- async setItem(address, previousHash) {
72
- await this.storage.set(address, previousHash);
73
- }
74
- };
1
+ "use strict";var o=Object.create;var r=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var m=(t,e)=>r(t,"name",{value:e,configurable:!0});var l=(t,e)=>{for(var a in e)r(t,a,{get:e[a],enumerable:!0})},n=(t,e,a,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of g(e))!u.call(t,s)&&s!==a&&r(t,s,{get:()=>e[s],enumerable:!(c=h(e,s))||c.enumerable});return t};var f=(t,e,a)=>(a=t!=null?o(y(t)):{},n(e||!t||!t.__esModule?r(a,"default",{value:t,enumerable:!0}):a,t)),_=t=>n(r({},"__esModule",{value:!0}),t);var v={};l(v,{StoragePreviousHashStore:()=>p});module.exports=_(v);var i=f(require("store2"),1);var p=class t{static{m(this,"StoragePreviousHashStore")}static DefaultNamespace="xyo-previous-hash-store";static DefaultStorageType="local";_namespace=t.DefaultNamespace;_storage;_type=t.DefaultStorageType;constructor(e){e?.namespace&&(this._namespace=e.namespace),e?.type&&(this._type=e.type),this._storage=i.default[this.type].namespace(this.namespace)}get namespace(){return this._namespace}get type(){return this._type}get storage(){return this?._storage||(this._storage=i.default[this.type].namespace(this.namespace)),this._storage}async getItem(e){return await this.storage.get(e)??null}async removeItem(e){await this.storage.remove(e)}async setItem(e,a){await this.storage.set(e,a)}};
75
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/StoragePreviousHashStore.ts"],"sourcesContent":["export * from './StoragePreviousHashStore'\n","import { Address, Hash } from '@xylabs/hex'\nimport { 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: Address): Promise<Hash | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACEA,oBAAiC;AAS1B,IAAMA,2BAAN,MAAMA,0BAAAA;EATb,OASaA;;;EACX,OAAgBC,mBAAmB;EACnC,OAAgBC,qBAA8B;EACtCC,aAAaH,0BAAyBC;EACtCG;EACAC,QAAiBL,0BAAyBE;EAElDI,YAAYC,MAAgC;AAC1C,QAAIA,MAAMC,UAAW,MAAKL,aAAaI,KAAKC;AAC5C,QAAID,MAAME,KAAM,MAAKJ,QAAQE,KAAKE;AAClC,SAAKL,WAAWM,cAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;EAC3D;EAEA,IAAIA,YAAY;AACd,WAAO,KAAKL;EACd;EAEA,IAAIM,OAAgB;AAClB,WAAO,KAAKJ;EACd;EAEA,IAAYM,UAAqB;AAC/B,QAAI,CAAC,MAAMP,SAAU,MAAKA,WAAWM,cAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;AAC9E,WAAO,KAAKJ;EACd;EAEA,MAAMQ,QAAQC,SAAwC;AACpD,UAAMC,QAAQ,MAAM,KAAKH,QAAQI,IAAIF,OAAAA;AACrC,WAAOC,SAAS;EAClB;EACA,MAAME,WAAWH,SAAiC;AAChD,UAAM,KAAKF,QAAQM,OAAOJ,OAAAA;EAC5B;EACA,MAAMK,QAAQL,SAAkBM,cAAmC;AACjE,UAAM,KAAKR,QAAQS,IAAIP,SAASM,YAAAA;EAClC;AACF;","names":["StoragePreviousHashStore","DefaultNamespace","DefaultStorageType","_namespace","_storage","_type","constructor","opts","namespace","type","store","storage","getItem","address","value","get","removeItem","remove","setItem","previousHash","set"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/StoragePreviousHashStore.ts"],"sourcesContent":["export * from './StoragePreviousHashStore'\n","import { Address, Hash } from '@xylabs/hex'\nimport { 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: Address): Promise<Hash | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":"6mBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GCEA,IAAAI,EAAiC,uBAS1B,IAAMC,EAAN,MAAMA,CAAAA,CATb,MASaA,CAAAA,EAAAA,iCACX,OAAgBC,iBAAmB,0BACnC,OAAgBC,mBAA8B,QACtCC,WAAaH,EAAyBC,iBACtCG,SACAC,MAAiBL,EAAyBE,mBAElDI,YAAYC,EAAgC,CACtCA,GAAMC,YAAW,KAAKL,WAAaI,EAAKC,WACxCD,GAAME,OAAM,KAAKJ,MAAQE,EAAKE,MAClC,KAAKL,SAAWM,EAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS,CAC3D,CAEA,IAAIA,WAAY,CACd,OAAO,KAAKL,UACd,CAEA,IAAIM,MAAgB,CAClB,OAAO,KAAKJ,KACd,CAEA,IAAYM,SAAqB,CAC/B,OAAK,MAAMP,WAAU,KAAKA,SAAWM,EAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS,GACvE,KAAKJ,QACd,CAEA,MAAMQ,QAAQC,EAAwC,CAEpD,OADc,MAAM,KAAKF,QAAQG,IAAID,CAAAA,GACrB,IAClB,CACA,MAAME,WAAWF,EAAiC,CAChD,MAAM,KAAKF,QAAQK,OAAOH,CAAAA,CAC5B,CACA,MAAMI,QAAQJ,EAAkBK,EAAmC,CACjE,MAAM,KAAKP,QAAQQ,IAAIN,EAASK,CAAAA,CAClC,CACF","names":["src_exports","__export","StoragePreviousHashStore","__toCommonJS","import_store2","StoragePreviousHashStore","DefaultNamespace","DefaultStorageType","_namespace","_storage","_type","constructor","opts","namespace","type","store","storage","getItem","address","get","removeItem","remove","setItem","previousHash","set"]}
@@ -1,44 +1,2 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/StoragePreviousHashStore.ts
5
- import store from "store2";
6
- var StoragePreviousHashStore = class _StoragePreviousHashStore {
7
- static {
8
- __name(this, "StoragePreviousHashStore");
9
- }
10
- static DefaultNamespace = "xyo-previous-hash-store";
11
- static DefaultStorageType = "local";
12
- _namespace = _StoragePreviousHashStore.DefaultNamespace;
13
- _storage;
14
- _type = _StoragePreviousHashStore.DefaultStorageType;
15
- constructor(opts) {
16
- if (opts?.namespace) this._namespace = opts.namespace;
17
- if (opts?.type) this._type = opts.type;
18
- this._storage = store[this.type].namespace(this.namespace);
19
- }
20
- get namespace() {
21
- return this._namespace;
22
- }
23
- get type() {
24
- return this._type;
25
- }
26
- get storage() {
27
- if (!this?._storage) this._storage = store[this.type].namespace(this.namespace);
28
- return this._storage;
29
- }
30
- async getItem(address) {
31
- const value = await this.storage.get(address);
32
- return value ?? null;
33
- }
34
- async removeItem(address) {
35
- await this.storage.remove(address);
36
- }
37
- async setItem(address, previousHash) {
38
- await this.storage.set(address, previousHash);
39
- }
40
- };
41
- export {
42
- StoragePreviousHashStore
43
- };
1
+ var p=Object.defineProperty;var s=(t,e)=>p(t,"name",{value:e,configurable:!0});import r from"store2";var i=class t{static{s(this,"StoragePreviousHashStore")}static DefaultNamespace="xyo-previous-hash-store";static DefaultStorageType="local";_namespace=t.DefaultNamespace;_storage;_type=t.DefaultStorageType;constructor(e){e?.namespace&&(this._namespace=e.namespace),e?.type&&(this._type=e.type),this._storage=r[this.type].namespace(this.namespace)}get namespace(){return this._namespace}get type(){return this._type}get storage(){return this?._storage||(this._storage=r[this.type].namespace(this.namespace)),this._storage}async getItem(e){return await this.storage.get(e)??null}async removeItem(e){await this.storage.remove(e)}async setItem(e,a){await this.storage.set(e,a)}};export{i as StoragePreviousHashStore};
44
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/StoragePreviousHashStore.ts"],"sourcesContent":["import { Address, Hash } from '@xylabs/hex'\nimport { 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: Address): Promise<Hash | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;AAEA,OAAOA,WAA0B;AAS1B,IAAMC,2BAAN,MAAMA,0BAAAA;EATb,OASaA;;;EACX,OAAgBC,mBAAmB;EACnC,OAAgBC,qBAA8B;EACtCC,aAAaH,0BAAyBC;EACtCG;EACAC,QAAiBL,0BAAyBE;EAElDI,YAAYC,MAAgC;AAC1C,QAAIA,MAAMC,UAAW,MAAKL,aAAaI,KAAKC;AAC5C,QAAID,MAAME,KAAM,MAAKJ,QAAQE,KAAKE;AAClC,SAAKL,WAAWM,MAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;EAC3D;EAEA,IAAIA,YAAY;AACd,WAAO,KAAKL;EACd;EAEA,IAAIM,OAAgB;AAClB,WAAO,KAAKJ;EACd;EAEA,IAAYM,UAAqB;AAC/B,QAAI,CAAC,MAAMP,SAAU,MAAKA,WAAWM,MAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;AAC9E,WAAO,KAAKJ;EACd;EAEA,MAAMQ,QAAQC,SAAwC;AACpD,UAAMC,QAAQ,MAAM,KAAKH,QAAQI,IAAIF,OAAAA;AACrC,WAAOC,SAAS;EAClB;EACA,MAAME,WAAWH,SAAiC;AAChD,UAAM,KAAKF,QAAQM,OAAOJ,OAAAA;EAC5B;EACA,MAAMK,QAAQL,SAAkBM,cAAmC;AACjE,UAAM,KAAKR,QAAQS,IAAIP,SAASM,YAAAA;EAClC;AACF;","names":["store","StoragePreviousHashStore","DefaultNamespace","DefaultStorageType","_namespace","_storage","_type","constructor","opts","namespace","type","store","storage","getItem","address","value","get","removeItem","remove","setItem","previousHash","set"]}
1
+ {"version":3,"sources":["../../src/StoragePreviousHashStore.ts"],"sourcesContent":["import { Address, Hash } from '@xylabs/hex'\nimport { 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: Address): Promise<Hash | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":"+EAEA,OAAOA,MAA0B,SAS1B,IAAMC,EAAN,MAAMA,CAAAA,CATb,MASaA,CAAAA,EAAAA,iCACX,OAAgBC,iBAAmB,0BACnC,OAAgBC,mBAA8B,QACtCC,WAAaH,EAAyBC,iBACtCG,SACAC,MAAiBL,EAAyBE,mBAElDI,YAAYC,EAAgC,CACtCA,GAAMC,YAAW,KAAKL,WAAaI,EAAKC,WACxCD,GAAME,OAAM,KAAKJ,MAAQE,EAAKE,MAClC,KAAKL,SAAWM,EAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS,CAC3D,CAEA,IAAIA,WAAY,CACd,OAAO,KAAKL,UACd,CAEA,IAAIM,MAAgB,CAClB,OAAO,KAAKJ,KACd,CAEA,IAAYM,SAAqB,CAC/B,OAAK,MAAMP,WAAU,KAAKA,SAAWM,EAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS,GACvE,KAAKJ,QACd,CAEA,MAAMQ,QAAQC,EAAwC,CAEpD,OADc,MAAM,KAAKF,QAAQG,IAAID,CAAAA,GACrB,IAClB,CACA,MAAME,WAAWF,EAAiC,CAChD,MAAM,KAAKF,QAAQK,OAAOH,CAAAA,CAC5B,CACA,MAAMI,QAAQJ,EAAkBK,EAAmC,CACjE,MAAM,KAAKP,QAAQQ,IAAIN,EAASK,CAAAA,CAClC,CACF","names":["store","StoragePreviousHashStore","DefaultNamespace","DefaultStorageType","_namespace","_storage","_type","constructor","opts","namespace","type","store","storage","getItem","address","get","removeItem","remove","setItem","previousHash","set"]}
@@ -1,75 +1,2 @@
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/index.ts
32
- var src_exports = {};
33
- __export(src_exports, {
34
- StoragePreviousHashStore: () => StoragePreviousHashStore
35
- });
36
- module.exports = __toCommonJS(src_exports);
37
-
38
- // src/StoragePreviousHashStore.ts
39
- var import_store2 = __toESM(require("store2"), 1);
40
- var StoragePreviousHashStore = class _StoragePreviousHashStore {
41
- static {
42
- __name(this, "StoragePreviousHashStore");
43
- }
44
- static DefaultNamespace = "xyo-previous-hash-store";
45
- static DefaultStorageType = "local";
46
- _namespace = _StoragePreviousHashStore.DefaultNamespace;
47
- _storage;
48
- _type = _StoragePreviousHashStore.DefaultStorageType;
49
- constructor(opts) {
50
- if (opts?.namespace) this._namespace = opts.namespace;
51
- if (opts?.type) this._type = opts.type;
52
- this._storage = import_store2.default[this.type].namespace(this.namespace);
53
- }
54
- get namespace() {
55
- return this._namespace;
56
- }
57
- get type() {
58
- return this._type;
59
- }
60
- get storage() {
61
- if (!this?._storage) this._storage = import_store2.default[this.type].namespace(this.namespace);
62
- return this._storage;
63
- }
64
- async getItem(address) {
65
- const value = await this.storage.get(address);
66
- return value ?? null;
67
- }
68
- async removeItem(address) {
69
- await this.storage.remove(address);
70
- }
71
- async setItem(address, previousHash) {
72
- await this.storage.set(address, previousHash);
73
- }
74
- };
1
+ "use strict";var o=Object.create;var r=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var m=(t,e)=>r(t,"name",{value:e,configurable:!0});var l=(t,e)=>{for(var a in e)r(t,a,{get:e[a],enumerable:!0})},n=(t,e,a,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of g(e))!u.call(t,s)&&s!==a&&r(t,s,{get:()=>e[s],enumerable:!(c=h(e,s))||c.enumerable});return t};var f=(t,e,a)=>(a=t!=null?o(y(t)):{},n(e||!t||!t.__esModule?r(a,"default",{value:t,enumerable:!0}):a,t)),_=t=>n(r({},"__esModule",{value:!0}),t);var v={};l(v,{StoragePreviousHashStore:()=>p});module.exports=_(v);var i=f(require("store2"),1);var p=class t{static{m(this,"StoragePreviousHashStore")}static DefaultNamespace="xyo-previous-hash-store";static DefaultStorageType="local";_namespace=t.DefaultNamespace;_storage;_type=t.DefaultStorageType;constructor(e){e?.namespace&&(this._namespace=e.namespace),e?.type&&(this._type=e.type),this._storage=i.default[this.type].namespace(this.namespace)}get namespace(){return this._namespace}get type(){return this._type}get storage(){return this?._storage||(this._storage=i.default[this.type].namespace(this.namespace)),this._storage}async getItem(e){return await this.storage.get(e)??null}async removeItem(e){await this.storage.remove(e)}async setItem(e,a){await this.storage.set(e,a)}};
75
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/StoragePreviousHashStore.ts"],"sourcesContent":["export * from './StoragePreviousHashStore'\n","import { Address, Hash } from '@xylabs/hex'\nimport { 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: Address): Promise<Hash | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACEA,oBAAiC;AAS1B,IAAMA,2BAAN,MAAMA,0BAAAA;EATb,OASaA;;;EACX,OAAgBC,mBAAmB;EACnC,OAAgBC,qBAA8B;EACtCC,aAAaH,0BAAyBC;EACtCG;EACAC,QAAiBL,0BAAyBE;EAElDI,YAAYC,MAAgC;AAC1C,QAAIA,MAAMC,UAAW,MAAKL,aAAaI,KAAKC;AAC5C,QAAID,MAAME,KAAM,MAAKJ,QAAQE,KAAKE;AAClC,SAAKL,WAAWM,cAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;EAC3D;EAEA,IAAIA,YAAY;AACd,WAAO,KAAKL;EACd;EAEA,IAAIM,OAAgB;AAClB,WAAO,KAAKJ;EACd;EAEA,IAAYM,UAAqB;AAC/B,QAAI,CAAC,MAAMP,SAAU,MAAKA,WAAWM,cAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;AAC9E,WAAO,KAAKJ;EACd;EAEA,MAAMQ,QAAQC,SAAwC;AACpD,UAAMC,QAAQ,MAAM,KAAKH,QAAQI,IAAIF,OAAAA;AACrC,WAAOC,SAAS;EAClB;EACA,MAAME,WAAWH,SAAiC;AAChD,UAAM,KAAKF,QAAQM,OAAOJ,OAAAA;EAC5B;EACA,MAAMK,QAAQL,SAAkBM,cAAmC;AACjE,UAAM,KAAKR,QAAQS,IAAIP,SAASM,YAAAA;EAClC;AACF;","names":["StoragePreviousHashStore","DefaultNamespace","DefaultStorageType","_namespace","_storage","_type","constructor","opts","namespace","type","store","storage","getItem","address","value","get","removeItem","remove","setItem","previousHash","set"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/StoragePreviousHashStore.ts"],"sourcesContent":["export * from './StoragePreviousHashStore'\n","import { Address, Hash } from '@xylabs/hex'\nimport { 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: Address): Promise<Hash | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":"6mBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GCEA,IAAAI,EAAiC,uBAS1B,IAAMC,EAAN,MAAMA,CAAAA,CATb,MASaA,CAAAA,EAAAA,iCACX,OAAgBC,iBAAmB,0BACnC,OAAgBC,mBAA8B,QACtCC,WAAaH,EAAyBC,iBACtCG,SACAC,MAAiBL,EAAyBE,mBAElDI,YAAYC,EAAgC,CACtCA,GAAMC,YAAW,KAAKL,WAAaI,EAAKC,WACxCD,GAAME,OAAM,KAAKJ,MAAQE,EAAKE,MAClC,KAAKL,SAAWM,EAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS,CAC3D,CAEA,IAAIA,WAAY,CACd,OAAO,KAAKL,UACd,CAEA,IAAIM,MAAgB,CAClB,OAAO,KAAKJ,KACd,CAEA,IAAYM,SAAqB,CAC/B,OAAK,MAAMP,WAAU,KAAKA,SAAWM,EAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS,GACvE,KAAKJ,QACd,CAEA,MAAMQ,QAAQC,EAAwC,CAEpD,OADc,MAAM,KAAKF,QAAQG,IAAID,CAAAA,GACrB,IAClB,CACA,MAAME,WAAWF,EAAiC,CAChD,MAAM,KAAKF,QAAQK,OAAOH,CAAAA,CAC5B,CACA,MAAMI,QAAQJ,EAAkBK,EAAmC,CACjE,MAAM,KAAKP,QAAQQ,IAAIN,EAASK,CAAAA,CAClC,CACF","names":["src_exports","__export","StoragePreviousHashStore","__toCommonJS","import_store2","StoragePreviousHashStore","DefaultNamespace","DefaultStorageType","_namespace","_storage","_type","constructor","opts","namespace","type","store","storage","getItem","address","get","removeItem","remove","setItem","previousHash","set"]}
@@ -1,44 +1,2 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // src/StoragePreviousHashStore.ts
5
- import store from "store2";
6
- var StoragePreviousHashStore = class _StoragePreviousHashStore {
7
- static {
8
- __name(this, "StoragePreviousHashStore");
9
- }
10
- static DefaultNamespace = "xyo-previous-hash-store";
11
- static DefaultStorageType = "local";
12
- _namespace = _StoragePreviousHashStore.DefaultNamespace;
13
- _storage;
14
- _type = _StoragePreviousHashStore.DefaultStorageType;
15
- constructor(opts) {
16
- if (opts?.namespace) this._namespace = opts.namespace;
17
- if (opts?.type) this._type = opts.type;
18
- this._storage = store[this.type].namespace(this.namespace);
19
- }
20
- get namespace() {
21
- return this._namespace;
22
- }
23
- get type() {
24
- return this._type;
25
- }
26
- get storage() {
27
- if (!this?._storage) this._storage = store[this.type].namespace(this.namespace);
28
- return this._storage;
29
- }
30
- async getItem(address) {
31
- const value = await this.storage.get(address);
32
- return value ?? null;
33
- }
34
- async removeItem(address) {
35
- await this.storage.remove(address);
36
- }
37
- async setItem(address, previousHash) {
38
- await this.storage.set(address, previousHash);
39
- }
40
- };
41
- export {
42
- StoragePreviousHashStore
43
- };
1
+ var p=Object.defineProperty;var s=(t,e)=>p(t,"name",{value:e,configurable:!0});import r from"store2";var i=class t{static{s(this,"StoragePreviousHashStore")}static DefaultNamespace="xyo-previous-hash-store";static DefaultStorageType="local";_namespace=t.DefaultNamespace;_storage;_type=t.DefaultStorageType;constructor(e){e?.namespace&&(this._namespace=e.namespace),e?.type&&(this._type=e.type),this._storage=r[this.type].namespace(this.namespace)}get namespace(){return this._namespace}get type(){return this._type}get storage(){return this?._storage||(this._storage=r[this.type].namespace(this.namespace)),this._storage}async getItem(e){return await this.storage.get(e)??null}async removeItem(e){await this.storage.remove(e)}async setItem(e,a){await this.storage.set(e,a)}};export{i as StoragePreviousHashStore};
44
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/StoragePreviousHashStore.ts"],"sourcesContent":["import { Address, Hash } from '@xylabs/hex'\nimport { 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: Address): Promise<Hash | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;AAEA,OAAOA,WAA0B;AAS1B,IAAMC,2BAAN,MAAMA,0BAAAA;EATb,OASaA;;;EACX,OAAgBC,mBAAmB;EACnC,OAAgBC,qBAA8B;EACtCC,aAAaH,0BAAyBC;EACtCG;EACAC,QAAiBL,0BAAyBE;EAElDI,YAAYC,MAAgC;AAC1C,QAAIA,MAAMC,UAAW,MAAKL,aAAaI,KAAKC;AAC5C,QAAID,MAAME,KAAM,MAAKJ,QAAQE,KAAKE;AAClC,SAAKL,WAAWM,MAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;EAC3D;EAEA,IAAIA,YAAY;AACd,WAAO,KAAKL;EACd;EAEA,IAAIM,OAAgB;AAClB,WAAO,KAAKJ;EACd;EAEA,IAAYM,UAAqB;AAC/B,QAAI,CAAC,MAAMP,SAAU,MAAKA,WAAWM,MAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;AAC9E,WAAO,KAAKJ;EACd;EAEA,MAAMQ,QAAQC,SAAwC;AACpD,UAAMC,QAAQ,MAAM,KAAKH,QAAQI,IAAIF,OAAAA;AACrC,WAAOC,SAAS;EAClB;EACA,MAAME,WAAWH,SAAiC;AAChD,UAAM,KAAKF,QAAQM,OAAOJ,OAAAA;EAC5B;EACA,MAAMK,QAAQL,SAAkBM,cAAmC;AACjE,UAAM,KAAKR,QAAQS,IAAIP,SAASM,YAAAA;EAClC;AACF;","names":["store","StoragePreviousHashStore","DefaultNamespace","DefaultStorageType","_namespace","_storage","_type","constructor","opts","namespace","type","store","storage","getItem","address","value","get","removeItem","remove","setItem","previousHash","set"]}
1
+ {"version":3,"sources":["../../src/StoragePreviousHashStore.ts"],"sourcesContent":["import { Address, Hash } from '@xylabs/hex'\nimport { 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: Address): Promise<Hash | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":"+EAEA,OAAOA,MAA0B,SAS1B,IAAMC,EAAN,MAAMA,CAAAA,CATb,MASaA,CAAAA,EAAAA,iCACX,OAAgBC,iBAAmB,0BACnC,OAAgBC,mBAA8B,QACtCC,WAAaH,EAAyBC,iBACtCG,SACAC,MAAiBL,EAAyBE,mBAElDI,YAAYC,EAAgC,CACtCA,GAAMC,YAAW,KAAKL,WAAaI,EAAKC,WACxCD,GAAME,OAAM,KAAKJ,MAAQE,EAAKE,MAClC,KAAKL,SAAWM,EAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS,CAC3D,CAEA,IAAIA,WAAY,CACd,OAAO,KAAKL,UACd,CAEA,IAAIM,MAAgB,CAClB,OAAO,KAAKJ,KACd,CAEA,IAAYM,SAAqB,CAC/B,OAAK,MAAMP,WAAU,KAAKA,SAAWM,EAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS,GACvE,KAAKJ,QACd,CAEA,MAAMQ,QAAQC,EAAwC,CAEpD,OADc,MAAM,KAAKF,QAAQG,IAAID,CAAAA,GACrB,IAClB,CACA,MAAME,WAAWF,EAAiC,CAChD,MAAM,KAAKF,QAAQK,OAAOH,CAAAA,CAC5B,CACA,MAAMI,QAAQJ,EAAkBK,EAAmC,CACjE,MAAM,KAAKP,QAAQQ,IAAIN,EAASK,CAAAA,CAClC,CACF","names":["store","StoragePreviousHashStore","DefaultNamespace","DefaultStorageType","_namespace","_storage","_type","constructor","opts","namespace","type","store","storage","getItem","address","get","removeItem","remove","setItem","previousHash","set"]}
@@ -1,80 +1,2 @@
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 __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
30
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
32
-
33
- // src/index.ts
34
- var src_exports = {};
35
- __export(src_exports, {
36
- StoragePreviousHashStore: () => StoragePreviousHashStore
37
- });
38
- module.exports = __toCommonJS(src_exports);
39
-
40
- // src/StoragePreviousHashStore.ts
41
- var import_store2 = __toESM(require("store2"), 1);
42
- var _StoragePreviousHashStore = class _StoragePreviousHashStore {
43
- _namespace = _StoragePreviousHashStore.DefaultNamespace;
44
- _storage;
45
- _type = _StoragePreviousHashStore.DefaultStorageType;
46
- constructor(opts) {
47
- if (opts == null ? void 0 : opts.namespace) this._namespace = opts.namespace;
48
- if (opts == null ? void 0 : opts.type) this._type = opts.type;
49
- this._storage = import_store2.default[this.type].namespace(this.namespace);
50
- }
51
- get namespace() {
52
- return this._namespace;
53
- }
54
- get type() {
55
- return this._type;
56
- }
57
- get storage() {
58
- if (!(this == null ? void 0 : this._storage)) 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
- __name(_StoragePreviousHashStore, "StoragePreviousHashStore");
73
- __publicField(_StoragePreviousHashStore, "DefaultNamespace", "xyo-previous-hash-store");
74
- __publicField(_StoragePreviousHashStore, "DefaultStorageType", "local");
75
- var StoragePreviousHashStore = _StoragePreviousHashStore;
76
- // Annotate the CommonJS export names for ESM import in node:
77
- 0 && (module.exports = {
78
- StoragePreviousHashStore
79
- });
1
+ "use strict";var g=Object.create;var c=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var u=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var D=(t,e,a)=>e in t?c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var y=(t,e)=>c(t,"name",{value:e,configurable:!0});var o=(t,e)=>{for(var a in e)c(t,a,{get:e[a],enumerable:!0})},h=(t,e,a,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of f(e))!_.call(t,i)&&i!==a&&c(t,i,{get:()=>e[i],enumerable:!(p=l(e,i))||p.enumerable});return t};var w=(t,e,a)=>(a=t!=null?g(u(t)):{},h(e||!t||!t.__esModule?c(a,"default",{value:t,enumerable:!0}):a,t)),x=t=>h(c({},"__esModule",{value:!0}),t);var m=(t,e,a)=>D(t,typeof e!="symbol"?e+"":e,a);var I={};o(I,{StoragePreviousHashStore:()=>r});module.exports=x(I);var n=w(require("store2"),1);var s=class s{_namespace=s.DefaultNamespace;_storage;_type=s.DefaultStorageType;constructor(e){e!=null&&e.namespace&&(this._namespace=e.namespace),e!=null&&e.type&&(this._type=e.type),this._storage=n.default[this.type].namespace(this.namespace)}get namespace(){return this._namespace}get type(){return this._type}get storage(){return this!=null&&this._storage||(this._storage=n.default[this.type].namespace(this.namespace)),this._storage}async getItem(e){return await this.storage.get(e)??null}async removeItem(e){await this.storage.remove(e)}async setItem(e,a){await this.storage.set(e,a)}};y(s,"StoragePreviousHashStore"),m(s,"DefaultNamespace","xyo-previous-hash-store"),m(s,"DefaultStorageType","local");var r=s;0&&(module.exports={StoragePreviousHashStore});
80
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/StoragePreviousHashStore.ts"],"sourcesContent":["export * from './StoragePreviousHashStore'\n","import { Address, Hash } from '@xylabs/hex'\nimport { 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: Address): Promise<Hash | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACEA,oBAAiC;AAS1B,IAAMA,4BAAN,MAAMA,0BAAAA;EAGHC,aAAaD,0BAAyBE;EACtCC;EACAC,QAAiBJ,0BAAyBK;EAElDC,YAAYC,MAAgC;AAC1C,QAAIA,6BAAMC,UAAW,MAAKP,aAAaM,KAAKC;AAC5C,QAAID,6BAAME,KAAM,MAAKL,QAAQG,KAAKE;AAClC,SAAKN,WAAWO,cAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;EAC3D;EAEA,IAAIA,YAAY;AACd,WAAO,KAAKP;EACd;EAEA,IAAIQ,OAAgB;AAClB,WAAO,KAAKL;EACd;EAEA,IAAYO,UAAqB;AAC/B,QAAI,EAAC,6BAAMR,UAAU,MAAKA,WAAWO,cAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;AAC9E,WAAO,KAAKL;EACd;EAEA,MAAMS,QAAQC,SAAwC;AACpD,UAAMC,QAAQ,MAAM,KAAKH,QAAQI,IAAIF,OAAAA;AACrC,WAAOC,SAAS;EAClB;EACA,MAAME,WAAWH,SAAiC;AAChD,UAAM,KAAKF,QAAQM,OAAOJ,OAAAA;EAC5B;EACA,MAAMK,QAAQL,SAAkBM,cAAmC;AACjE,UAAM,KAAKR,QAAQS,IAAIP,SAASM,YAAAA;EAClC;AACF;AApCanB;AACX,cADWA,2BACKE,oBAAmB;AACnC,cAFWF,2BAEKK,sBAA8B;AAFzC,IAAML,2BAAN;","names":["StoragePreviousHashStore","_namespace","DefaultNamespace","_storage","_type","DefaultStorageType","constructor","opts","namespace","type","store","storage","getItem","address","value","get","removeItem","remove","setItem","previousHash","set"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/StoragePreviousHashStore.ts"],"sourcesContent":["export * from './StoragePreviousHashStore'\n","import { Address, Hash } from '@xylabs/hex'\nimport { 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: Address): Promise<Hash | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":"qvBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GCEA,IAAAI,EAAiC,uBAS1B,IAAMC,EAAN,MAAMA,CAAAA,CAGHC,WAAaD,EAAyBE,iBACtCC,SACAC,MAAiBJ,EAAyBK,mBAElDC,YAAYC,EAAgC,CACtCA,GAAAA,MAAAA,EAAMC,YAAW,KAAKP,WAAaM,EAAKC,WACxCD,GAAAA,MAAAA,EAAME,OAAM,KAAKL,MAAQG,EAAKE,MAClC,KAAKN,SAAWO,EAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS,CAC3D,CAEA,IAAIA,WAAY,CACd,OAAO,KAAKP,UACd,CAEA,IAAIQ,MAAgB,CAClB,OAAO,KAAKL,KACd,CAEA,IAAYO,SAAqB,CAC/B,OAAK,iBAAMR,WAAU,KAAKA,SAAWO,EAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS,GACvE,KAAKL,QACd,CAEA,MAAMS,QAAQC,EAAwC,CAEpD,OADc,MAAM,KAAKF,QAAQG,IAAID,CAAAA,GACrB,IAClB,CACA,MAAME,WAAWF,EAAiC,CAChD,MAAM,KAAKF,QAAQK,OAAOH,CAAAA,CAC5B,CACA,MAAMI,QAAQJ,EAAkBK,EAAmC,CACjE,MAAM,KAAKP,QAAQQ,IAAIN,EAASK,CAAAA,CAClC,CACF,EApCalB,EAAAA,EAAAA,4BACXoB,EADWpB,EACKE,mBAAmB,2BACnCkB,EAFWpB,EAEKK,qBAA8B,SAFzC,IAAML,EAANqB","names":["src_exports","__export","StoragePreviousHashStore","__toCommonJS","import_store2","StoragePreviousHashStore","_namespace","DefaultNamespace","_storage","_type","DefaultStorageType","constructor","opts","namespace","type","store","storage","getItem","address","get","removeItem","remove","setItem","previousHash","set","__publicField","_StoragePreviousHashStore"]}
@@ -1,45 +1,2 @@
1
- var __defProp = Object.defineProperty;
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/StoragePreviousHashStore.ts
7
- import store from "store2";
8
- var _StoragePreviousHashStore = class _StoragePreviousHashStore {
9
- _namespace = _StoragePreviousHashStore.DefaultNamespace;
10
- _storage;
11
- _type = _StoragePreviousHashStore.DefaultStorageType;
12
- constructor(opts) {
13
- if (opts == null ? void 0 : opts.namespace) this._namespace = opts.namespace;
14
- if (opts == null ? void 0 : opts.type) this._type = opts.type;
15
- this._storage = store[this.type].namespace(this.namespace);
16
- }
17
- get namespace() {
18
- return this._namespace;
19
- }
20
- get type() {
21
- return this._type;
22
- }
23
- get storage() {
24
- if (!(this == null ? void 0 : this._storage)) 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
- __name(_StoragePreviousHashStore, "StoragePreviousHashStore");
39
- __publicField(_StoragePreviousHashStore, "DefaultNamespace", "xyo-previous-hash-store");
40
- __publicField(_StoragePreviousHashStore, "DefaultStorageType", "local");
41
- var StoragePreviousHashStore = _StoragePreviousHashStore;
42
- export {
43
- StoragePreviousHashStore
44
- };
1
+ var i=Object.defineProperty;var p=(t,e,a)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var m=(t,e)=>i(t,"name",{value:e,configurable:!0});var c=(t,e,a)=>p(t,typeof e!="symbol"?e+"":e,a);import n from"store2";var s=class s{_namespace=s.DefaultNamespace;_storage;_type=s.DefaultStorageType;constructor(e){e!=null&&e.namespace&&(this._namespace=e.namespace),e!=null&&e.type&&(this._type=e.type),this._storage=n[this.type].namespace(this.namespace)}get namespace(){return this._namespace}get type(){return this._type}get storage(){return this!=null&&this._storage||(this._storage=n[this.type].namespace(this.namespace)),this._storage}async getItem(e){return await this.storage.get(e)??null}async removeItem(e){await this.storage.remove(e)}async setItem(e,a){await this.storage.set(e,a)}};m(s,"StoragePreviousHashStore"),c(s,"DefaultNamespace","xyo-previous-hash-store"),c(s,"DefaultStorageType","local");var r=s;export{r as StoragePreviousHashStore};
45
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/StoragePreviousHashStore.ts"],"sourcesContent":["import { Address, Hash } from '@xylabs/hex'\nimport { 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: Address): Promise<Hash | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;;;AAEA,OAAOA,WAA0B;AAS1B,IAAMC,4BAAN,MAAMA,0BAAAA;EAGHC,aAAaD,0BAAyBE;EACtCC;EACAC,QAAiBJ,0BAAyBK;EAElDC,YAAYC,MAAgC;AAC1C,QAAIA,6BAAMC,UAAW,MAAKP,aAAaM,KAAKC;AAC5C,QAAID,6BAAME,KAAM,MAAKL,QAAQG,KAAKE;AAClC,SAAKN,WAAWO,MAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;EAC3D;EAEA,IAAIA,YAAY;AACd,WAAO,KAAKP;EACd;EAEA,IAAIQ,OAAgB;AAClB,WAAO,KAAKL;EACd;EAEA,IAAYO,UAAqB;AAC/B,QAAI,EAAC,6BAAMR,UAAU,MAAKA,WAAWO,MAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;AAC9E,WAAO,KAAKL;EACd;EAEA,MAAMS,QAAQC,SAAwC;AACpD,UAAMC,QAAQ,MAAM,KAAKH,QAAQI,IAAIF,OAAAA;AACrC,WAAOC,SAAS;EAClB;EACA,MAAME,WAAWH,SAAiC;AAChD,UAAM,KAAKF,QAAQM,OAAOJ,OAAAA;EAC5B;EACA,MAAMK,QAAQL,SAAkBM,cAAmC;AACjE,UAAM,KAAKR,QAAQS,IAAIP,SAASM,YAAAA;EAClC;AACF;AApCanB;AACX,cADWA,2BACKE,oBAAmB;AACnC,cAFWF,2BAEKK,sBAA8B;AAFzC,IAAML,2BAAN;","names":["store","StoragePreviousHashStore","_namespace","DefaultNamespace","_storage","_type","DefaultStorageType","constructor","opts","namespace","type","store","storage","getItem","address","value","get","removeItem","remove","setItem","previousHash","set"]}
1
+ {"version":3,"sources":["../../src/StoragePreviousHashStore.ts"],"sourcesContent":["import { Address, Hash } from '@xylabs/hex'\nimport { 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: Address): Promise<Hash | null> {\n const value = await this.storage.get(address)\n return value ?? null\n }\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":"uNAEA,OAAOA,MAA0B,SAS1B,IAAMC,EAAN,MAAMA,CAAAA,CAGHC,WAAaD,EAAyBE,iBACtCC,SACAC,MAAiBJ,EAAyBK,mBAElDC,YAAYC,EAAgC,CACtCA,GAAAA,MAAAA,EAAMC,YAAW,KAAKP,WAAaM,EAAKC,WACxCD,GAAAA,MAAAA,EAAME,OAAM,KAAKL,MAAQG,EAAKE,MAClC,KAAKN,SAAWO,EAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS,CAC3D,CAEA,IAAIA,WAAY,CACd,OAAO,KAAKP,UACd,CAEA,IAAIQ,MAAgB,CAClB,OAAO,KAAKL,KACd,CAEA,IAAYO,SAAqB,CAC/B,OAAK,iBAAMR,WAAU,KAAKA,SAAWO,EAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS,GACvE,KAAKL,QACd,CAEA,MAAMS,QAAQC,EAAwC,CAEpD,OADc,MAAM,KAAKF,QAAQG,IAAID,CAAAA,GACrB,IAClB,CACA,MAAME,WAAWF,EAAiC,CAChD,MAAM,KAAKF,QAAQK,OAAOH,CAAAA,CAC5B,CACA,MAAMI,QAAQJ,EAAkBK,EAAmC,CACjE,MAAM,KAAKP,QAAQQ,IAAIN,EAASK,CAAAA,CAClC,CACF,EApCalB,EAAAA,EAAAA,4BACXoB,EADWpB,EACKE,mBAAmB,2BACnCkB,EAFWpB,EAEKK,qBAA8B,SAFzC,IAAML,EAANqB","names":["store","StoragePreviousHashStore","_namespace","DefaultNamespace","_storage","_type","DefaultStorageType","constructor","opts","namespace","type","store","storage","getItem","address","get","removeItem","remove","setItem","previousHash","set","__publicField","_StoragePreviousHashStore"]}
package/package.json CHANGED
@@ -12,13 +12,13 @@
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.106.0-rc.5",
15
+ "@xyo-network/previous-hash-store-model": "~2.107.0",
16
16
  "store2": "^2.14.3"
17
17
  },
18
18
  "devDependencies": {
19
- "@xylabs/ts-scripts-yarn3": "^3.11.2",
20
- "@xylabs/tsconfig": "^3.11.2",
21
- "typescript": "^5.4.5",
19
+ "@xylabs/ts-scripts-yarn3": "^3.11.8",
20
+ "@xylabs/tsconfig": "^3.11.8",
21
+ "typescript": "^5.5.2",
22
22
  "uuid": "^9.0.1"
23
23
  },
24
24
  "exports": {
@@ -59,7 +59,6 @@
59
59
  },
60
60
  "sideEffects": false,
61
61
  "types": "dist/node/index.d.ts",
62
- "version": "2.106.0-rc.5",
63
- "type": "module",
64
- "stableVersion": "2.105.1"
62
+ "version": "2.107.0",
63
+ "type": "module"
65
64
  }