@xyo-network/previous-hash-store-storage 2.90.23 → 2.91.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.
@@ -1,3 +1,4 @@
1
+ import { Address, Hash } from '@xylabs/hex';
1
2
  import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
2
3
  export type Storage = 'local' | 'session' | 'page';
3
4
  export type StoragePreviousHashOpts = {
@@ -14,8 +15,8 @@ export declare class StoragePreviousHashStore implements PreviousHashStore {
14
15
  get namespace(): string;
15
16
  get type(): Storage;
16
17
  private get storage();
17
- getItem(address: string): Promise<string | null>;
18
- removeItem(address: string): Promise<void>;
19
- setItem(address: string, previousHash: string): Promise<void>;
18
+ getItem(address: Address): Promise<Hash | null>;
19
+ removeItem(address: Address): Promise<void>;
20
+ setItem(address: Address, previousHash: Hash): Promise<void>;
20
21
  }
21
22
  //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +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;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,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1,3 +1,4 @@
1
+ import { Address, Hash } from '@xylabs/hex';
1
2
  import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
2
3
  export type Storage = 'local' | 'session' | 'page';
3
4
  export type StoragePreviousHashOpts = {
@@ -14,8 +15,8 @@ export declare class StoragePreviousHashStore implements PreviousHashStore {
14
15
  get namespace(): string;
15
16
  get type(): Storage;
16
17
  private get storage();
17
- getItem(address: string): Promise<string | null>;
18
- removeItem(address: string): Promise<void>;
19
- setItem(address: string, previousHash: string): Promise<void>;
18
+ getItem(address: Address): Promise<Hash | null>;
19
+ removeItem(address: Address): Promise<void>;
20
+ setItem(address: Address, previousHash: Hash): Promise<void>;
20
21
  }
21
22
  //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +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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AAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1,3 +1,4 @@
1
+ import { Address, Hash } from '@xylabs/hex';
1
2
  import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
2
3
  export type Storage = 'local' | 'session' | 'page';
3
4
  export type StoragePreviousHashOpts = {
@@ -14,8 +15,8 @@ export declare class StoragePreviousHashStore implements PreviousHashStore {
14
15
  get namespace(): string;
15
16
  get type(): Storage;
16
17
  private get storage();
17
- getItem(address: string): Promise<string | null>;
18
- removeItem(address: string): Promise<void>;
19
- setItem(address: string, previousHash: string): Promise<void>;
18
+ getItem(address: Address): Promise<Hash | null>;
19
+ removeItem(address: Address): Promise<void>;
20
+ setItem(address: Address, previousHash: Hash): Promise<void>;
20
21
  }
21
22
  //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +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,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@
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;;;;;;;ACCA,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;AAAW,WAAKL,aAAaI,KAAKC;AAC5C,QAAID,MAAME;AAAM,WAAKJ,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;AAAU,WAAKA,WAAWM,cAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;AAC9E,WAAO,KAAKJ;EACd;EAEA,MAAMQ,QAAQC,SAAyC;AACrD,UAAMC,QAAQ,MAAM,KAAKH,QAAQI,IAAIF,OAAAA;AACrC,WAAOC,SAAS;EAClB;EACA,MAAME,WAAWH,SAAgC;AAC/C,UAAM,KAAKF,QAAQM,OAAOJ,OAAAA;EAC5B;EACA,MAAMK,QAAQL,SAAiBM,cAAqC;AAClE,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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAAW,WAAKL,aAAaI,KAAKC;AAC5C,QAAID,MAAME;AAAM,WAAKJ,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;AAAU,WAAKA,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 +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,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;AAAW,WAAKL,aAAaI,KAAKC;AAC5C,QAAID,MAAME;AAAM,WAAKJ,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;AAAU,WAAKA,WAAWM,MAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;AAC9E,WAAO,KAAKJ;EACd;EAEA,MAAMQ,QAAQC,SAAyC;AACrD,UAAMC,QAAQ,MAAM,KAAKH,QAAQI,IAAIF,OAAAA;AACrC,WAAOC,SAAS;EAClB;EACA,MAAME,WAAWH,SAAgC;AAC/C,UAAM,KAAKF,QAAQM,OAAOJ,OAAAA;EAC5B;EACA,MAAMK,QAAQL,SAAiBM,cAAqC;AAClE,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":";;;;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;AAAW,WAAKL,aAAaI,KAAKC;AAC5C,QAAID,MAAME;AAAM,WAAKJ,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;AAAU,WAAKA,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,3 +1,4 @@
1
+ import { Address, Hash } from '@xylabs/hex';
1
2
  import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
2
3
  export type Storage = 'local' | 'session' | 'page';
3
4
  export type StoragePreviousHashOpts = {
@@ -14,8 +15,8 @@ export declare class StoragePreviousHashStore implements PreviousHashStore {
14
15
  get namespace(): string;
15
16
  get type(): Storage;
16
17
  private get storage();
17
- getItem(address: string): Promise<string | null>;
18
- removeItem(address: string): Promise<void>;
19
- setItem(address: string, previousHash: string): Promise<void>;
18
+ getItem(address: Address): Promise<Hash | null>;
19
+ removeItem(address: Address): Promise<void>;
20
+ setItem(address: Address, previousHash: Hash): Promise<void>;
20
21
  }
21
22
  //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"StoragePreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/StoragePreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAC3C,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,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAI/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAG3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1,3 +1,4 @@
1
+ import { Address, Hash } from '@xylabs/hex';
1
2
  import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
2
3
  export type Storage = 'local' | 'session' | 'page';
3
4
  export type StoragePreviousHashOpts = {
@@ -14,8 +15,8 @@ export declare class StoragePreviousHashStore implements PreviousHashStore {
14
15
  get namespace(): string;
15
16
  get type(): Storage;
16
17
  private get storage();
17
- getItem(address: string): Promise<string | null>;
18
- removeItem(address: string): Promise<void>;
19
- setItem(address: string, previousHash: string): Promise<void>;
18
+ getItem(address: Address): Promise<Hash | null>;
19
+ removeItem(address: Address): Promise<void>;
20
+ setItem(address: Address, previousHash: Hash): Promise<void>;
20
21
  }
21
22
  //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"StoragePreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/StoragePreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAC3C,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,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAI/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAG3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1,3 +1,4 @@
1
+ import { Address, Hash } from '@xylabs/hex';
1
2
  import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
2
3
  export type Storage = 'local' | 'session' | 'page';
3
4
  export type StoragePreviousHashOpts = {
@@ -14,8 +15,8 @@ export declare class StoragePreviousHashStore implements PreviousHashStore {
14
15
  get namespace(): string;
15
16
  get type(): Storage;
16
17
  private get storage();
17
- getItem(address: string): Promise<string | null>;
18
- removeItem(address: string): Promise<void>;
19
- setItem(address: string, previousHash: string): Promise<void>;
18
+ getItem(address: Address): Promise<Hash | null>;
19
+ removeItem(address: Address): Promise<void>;
20
+ setItem(address: Address, previousHash: Hash): Promise<void>;
20
21
  }
21
22
  //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"StoragePreviousHashStore.d.ts","sourceRoot":"","sources":["../../src/StoragePreviousHashStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAC3C,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,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAI/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAG3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1 +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;;;;;;;ACCA,oBAAiC;AAS1B,IAAMA,4BAAN,MAAMA,0BAAAA;EAGHC,aAAaD,0BAAyBE;EACtCC;EACAC,QAAiBJ,0BAAyBK;EAElDC,YAAYC,MAAgC;AAC1C,QAAIA,6BAAMC;AAAW,WAAKP,aAAaM,KAAKC;AAC5C,QAAID,6BAAME;AAAM,WAAKL,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;AAAU,WAAKA,WAAWO,cAAAA,QAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;AAC9E,WAAO,KAAKL;EACd;EAEA,MAAMS,QAAQC,SAAyC;AACrD,UAAMC,QAAQ,MAAM,KAAKH,QAAQI,IAAIF,OAAAA;AACrC,WAAOC,SAAS;EAClB;EACA,MAAME,WAAWH,SAAgC;AAC/C,UAAM,KAAKF,QAAQM,OAAOJ,OAAAA;EAC5B;EACA,MAAMK,QAAQL,SAAiBM,cAAqC;AAClE,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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACEA,oBAAiC;AAS1B,IAAMA,4BAAN,MAAMA,0BAAAA;EAGHC,aAAaD,0BAAyBE;EACtCC;EACAC,QAAiBJ,0BAAyBK;EAElDC,YAAYC,MAAgC;AAC1C,QAAIA,6BAAMC;AAAW,WAAKP,aAAaM,KAAKC;AAC5C,QAAID,6BAAME;AAAM,WAAKL,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;AAAU,WAAKA,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 +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,OAAOA,WAA0B;AAS1B,IAAMC,4BAAN,MAAMA,0BAAAA;EAGHC,aAAaD,0BAAyBE;EACtCC;EACAC,QAAiBJ,0BAAyBK;EAElDC,YAAYC,MAAgC;AAC1C,QAAIA,6BAAMC;AAAW,WAAKP,aAAaM,KAAKC;AAC5C,QAAID,6BAAME;AAAM,WAAKL,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;AAAU,WAAKA,WAAWO,MAAM,KAAKD,IAAI,EAAED,UAAU,KAAKA,SAAS;AAC9E,WAAO,KAAKL;EACd;EAEA,MAAMS,QAAQC,SAAyC;AACrD,UAAMC,QAAQ,MAAM,KAAKH,QAAQI,IAAIF,OAAAA;AACrC,WAAOC,SAAS;EAClB;EACA,MAAME,WAAWH,SAAgC;AAC/C,UAAM,KAAKF,QAAQM,OAAOJ,OAAAA;EAC5B;EACA,MAAMK,QAAQL,SAAiBM,cAAqC;AAClE,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":";;;;;;;;;AAEA,OAAOA,WAA0B;AAS1B,IAAMC,4BAAN,MAAMA,0BAAAA;EAGHC,aAAaD,0BAAyBE;EACtCC;EACAC,QAAiBJ,0BAAyBK;EAElDC,YAAYC,MAAgC;AAC1C,QAAIA,6BAAMC;AAAW,WAAKP,aAAaM,KAAKC;AAC5C,QAAID,6BAAME;AAAM,WAAKL,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;AAAU,WAAKA,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"]}
package/package.json CHANGED
@@ -11,12 +11,13 @@
11
11
  },
12
12
  "description": "Primary SDK for using XYO Protocol 2.0",
13
13
  "dependencies": {
14
- "@xyo-network/previous-hash-store-model": "~2.90.23",
15
- "store2": "^2.14.2"
14
+ "@xylabs/hex": "^3.0.2",
15
+ "@xyo-network/previous-hash-store-model": "~2.91.1",
16
+ "store2": "^2.14.3"
16
17
  },
17
18
  "devDependencies": {
18
- "@xylabs/ts-scripts-yarn3": "^3.2.42",
19
- "@xylabs/tsconfig": "^3.2.42",
19
+ "@xylabs/ts-scripts-yarn3": "^3.4.1",
20
+ "@xylabs/tsconfig": "^3.4.1",
20
21
  "typescript": "^5.3.3",
21
22
  "uuid": "^9.0.1"
22
23
  },
@@ -58,6 +59,6 @@
58
59
  },
59
60
  "sideEffects": false,
60
61
  "types": "dist/node/index.d.ts",
61
- "version": "2.90.23",
62
+ "version": "2.91.1",
62
63
  "type": "module"
63
64
  }
@@ -1,3 +1,4 @@
1
+ import { Address, Hash } from '@xylabs/hex'
1
2
  import { PreviousHashStore } from '@xyo-network/previous-hash-store-model'
2
3
  import store, { StoreBase } from 'store2'
3
4
 
@@ -34,14 +35,14 @@ export class StoragePreviousHashStore implements PreviousHashStore {
34
35
  return this._storage
35
36
  }
36
37
 
37
- async getItem(address: string): Promise<string | null> {
38
+ async getItem(address: Address): Promise<Hash | null> {
38
39
  const value = await this.storage.get(address)
39
40
  return value ?? null
40
41
  }
41
- async removeItem(address: string): Promise<void> {
42
+ async removeItem(address: Address): Promise<void> {
42
43
  await this.storage.remove(address)
43
44
  }
44
- async setItem(address: string, previousHash: string): Promise<void> {
45
+ async setItem(address: Address, previousHash: Hash): Promise<void> {
45
46
  await this.storage.set(address, previousHash)
46
47
  }
47
48
  }