@xyo-network/previous-hash-store-storage 2.74.5 → 2.75.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.
Files changed (38) hide show
  1. package/dist/browser/StoragePreviousHashStore.cjs +72 -0
  2. package/dist/browser/StoragePreviousHashStore.cjs.map +1 -0
  3. package/dist/browser/StoragePreviousHashStore.d.mts.map +1 -0
  4. package/dist/browser/StoragePreviousHashStore.d.ts.map +1 -0
  5. package/dist/browser/StoragePreviousHashStore.js +41 -0
  6. package/dist/browser/StoragePreviousHashStore.js.map +1 -0
  7. package/dist/{index.js → browser/index.cjs} +1 -5
  8. package/dist/browser/index.cjs.map +1 -0
  9. package/dist/{index.d.mts.map → browser/index.d.mts.map} +1 -1
  10. package/dist/{index.d.ts.map → browser/index.d.ts.map} +1 -1
  11. package/dist/{index.mjs → browser/index.js} +1 -1
  12. package/dist/browser/index.js.map +1 -0
  13. package/dist/node/StoragePreviousHashStore.d.mts +21 -0
  14. package/dist/node/StoragePreviousHashStore.d.mts.map +1 -0
  15. package/dist/node/StoragePreviousHashStore.d.ts +21 -0
  16. package/dist/node/StoragePreviousHashStore.d.ts.map +1 -0
  17. package/dist/node/StoragePreviousHashStore.js +74 -0
  18. package/dist/node/StoragePreviousHashStore.js.map +1 -0
  19. package/dist/node/StoragePreviousHashStore.mjs +40 -0
  20. package/dist/node/StoragePreviousHashStore.mjs.map +1 -0
  21. package/dist/node/index.d.mts +2 -0
  22. package/dist/node/index.d.mts.map +1 -0
  23. package/dist/node/index.d.ts +2 -0
  24. package/dist/node/index.d.ts.map +1 -0
  25. package/dist/node/index.js +23 -0
  26. package/dist/node/index.js.map +1 -0
  27. package/dist/node/index.mjs +2 -0
  28. package/dist/node/index.mjs.map +1 -0
  29. package/package.json +25 -22
  30. package/dist/StoragePreviousHashStore.d.mts.map +0 -1
  31. package/dist/StoragePreviousHashStore.d.ts.map +0 -1
  32. package/dist/docs.json +0 -864
  33. package/dist/index.js.map +0 -1
  34. package/dist/index.mjs.map +0 -1
  35. /package/dist/{StoragePreviousHashStore.d.mts → browser/StoragePreviousHashStore.d.mts} +0 -0
  36. /package/dist/{StoragePreviousHashStore.d.ts → browser/StoragePreviousHashStore.d.ts} +0 -0
  37. /package/dist/{index.d.mts → browser/index.d.mts} +0 -0
  38. /package/dist/{index.d.ts → browser/index.d.ts} +0 -0
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"]}
@@ -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