@xyo-network/previous-hash-store-storage 2.111.3 → 3.0.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.
Files changed (45) hide show
  1. package/dist/browser/index.d.ts +24 -2
  2. package/dist/neutral/index.d.ts +24 -2
  3. package/dist/node/index.d.ts +24 -2
  4. package/dist/node/index.mjs +3 -3
  5. package/dist/node/index.mjs.map +1 -1
  6. package/package.json +10 -29
  7. package/dist/browser/StoragePreviousHashStore.d.cts +0 -22
  8. package/dist/browser/StoragePreviousHashStore.d.cts.map +0 -1
  9. package/dist/browser/StoragePreviousHashStore.d.mts +0 -22
  10. package/dist/browser/StoragePreviousHashStore.d.mts.map +0 -1
  11. package/dist/browser/StoragePreviousHashStore.d.ts +0 -22
  12. package/dist/browser/StoragePreviousHashStore.d.ts.map +0 -1
  13. package/dist/browser/index.cjs +0 -71
  14. package/dist/browser/index.cjs.map +0 -1
  15. package/dist/browser/index.d.cts +0 -2
  16. package/dist/browser/index.d.cts.map +0 -1
  17. package/dist/browser/index.d.mts +0 -2
  18. package/dist/browser/index.d.mts.map +0 -1
  19. package/dist/browser/index.d.ts.map +0 -1
  20. package/dist/neutral/StoragePreviousHashStore.d.cts +0 -22
  21. package/dist/neutral/StoragePreviousHashStore.d.cts.map +0 -1
  22. package/dist/neutral/StoragePreviousHashStore.d.mts +0 -22
  23. package/dist/neutral/StoragePreviousHashStore.d.mts.map +0 -1
  24. package/dist/neutral/StoragePreviousHashStore.d.ts +0 -22
  25. package/dist/neutral/StoragePreviousHashStore.d.ts.map +0 -1
  26. package/dist/neutral/index.cjs +0 -71
  27. package/dist/neutral/index.cjs.map +0 -1
  28. package/dist/neutral/index.d.cts +0 -2
  29. package/dist/neutral/index.d.cts.map +0 -1
  30. package/dist/neutral/index.d.mts +0 -2
  31. package/dist/neutral/index.d.mts.map +0 -1
  32. package/dist/neutral/index.d.ts.map +0 -1
  33. package/dist/node/StoragePreviousHashStore.d.cts +0 -22
  34. package/dist/node/StoragePreviousHashStore.d.cts.map +0 -1
  35. package/dist/node/StoragePreviousHashStore.d.mts +0 -22
  36. package/dist/node/StoragePreviousHashStore.d.mts.map +0 -1
  37. package/dist/node/StoragePreviousHashStore.d.ts +0 -22
  38. package/dist/node/StoragePreviousHashStore.d.ts.map +0 -1
  39. package/dist/node/index.cjs +0 -75
  40. package/dist/node/index.cjs.map +0 -1
  41. package/dist/node/index.d.cts +0 -2
  42. package/dist/node/index.d.cts.map +0 -1
  43. package/dist/node/index.d.mts +0 -2
  44. package/dist/node/index.d.mts.map +0 -1
  45. package/dist/node/index.d.ts.map +0 -1
@@ -1,2 +1,24 @@
1
- export * from './StoragePreviousHashStore.ts';
2
- //# sourceMappingURL=index.d.ts.map
1
+ import { Address, Hash } from '@xylabs/hex';
2
+ import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
+
4
+ type Storage = 'local' | 'session' | 'page';
5
+ type StoragePreviousHashOpts = {
6
+ namespace?: string;
7
+ type?: Storage;
8
+ };
9
+ declare class StoragePreviousHashStore implements PreviousHashStore {
10
+ static readonly DefaultNamespace = "xyo-previous-hash-store";
11
+ static readonly DefaultStorageType: Storage;
12
+ private _namespace;
13
+ private _storage;
14
+ private _type;
15
+ constructor(opts?: StoragePreviousHashOpts);
16
+ get namespace(): string;
17
+ get type(): Storage;
18
+ private get storage();
19
+ getItem(address: Address): Promise<Hash | null>;
20
+ removeItem(address: Address): Promise<void>;
21
+ setItem(address: Address, previousHash: Hash): Promise<void>;
22
+ }
23
+
24
+ export { type Storage, type StoragePreviousHashOpts, StoragePreviousHashStore };
@@ -1,2 +1,24 @@
1
- export * from './StoragePreviousHashStore.ts';
2
- //# sourceMappingURL=index.d.ts.map
1
+ import { Address, Hash } from '@xylabs/hex';
2
+ import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
+
4
+ type Storage = 'local' | 'session' | 'page';
5
+ type StoragePreviousHashOpts = {
6
+ namespace?: string;
7
+ type?: Storage;
8
+ };
9
+ declare class StoragePreviousHashStore implements PreviousHashStore {
10
+ static readonly DefaultNamespace = "xyo-previous-hash-store";
11
+ static readonly DefaultStorageType: Storage;
12
+ private _namespace;
13
+ private _storage;
14
+ private _type;
15
+ constructor(opts?: StoragePreviousHashOpts);
16
+ get namespace(): string;
17
+ get type(): Storage;
18
+ private get storage();
19
+ getItem(address: Address): Promise<Hash | null>;
20
+ removeItem(address: Address): Promise<void>;
21
+ setItem(address: Address, previousHash: Hash): Promise<void>;
22
+ }
23
+
24
+ export { type Storage, type StoragePreviousHashOpts, StoragePreviousHashStore };
@@ -1,2 +1,24 @@
1
- export * from './StoragePreviousHashStore.ts';
2
- //# sourceMappingURL=index.d.ts.map
1
+ import { Address, Hash } from '@xylabs/hex';
2
+ import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
+
4
+ type Storage = 'local' | 'session' | 'page';
5
+ type StoragePreviousHashOpts = {
6
+ namespace?: string;
7
+ type?: Storage;
8
+ };
9
+ declare class StoragePreviousHashStore implements PreviousHashStore {
10
+ static readonly DefaultNamespace = "xyo-previous-hash-store";
11
+ static readonly DefaultStorageType: Storage;
12
+ private _namespace;
13
+ private _storage;
14
+ private _type;
15
+ constructor(opts?: StoragePreviousHashOpts);
16
+ get namespace(): string;
17
+ get type(): Storage;
18
+ private get storage();
19
+ getItem(address: Address): Promise<Hash | null>;
20
+ removeItem(address: Address): Promise<void>;
21
+ setItem(address: Address, previousHash: Hash): Promise<void>;
22
+ }
23
+
24
+ export { type Storage, type StoragePreviousHashOpts, StoragePreviousHashStore };
@@ -7,8 +7,8 @@ var StoragePreviousHashStore = class _StoragePreviousHashStore {
7
7
  _storage;
8
8
  _type = _StoragePreviousHashStore.DefaultStorageType;
9
9
  constructor(opts) {
10
- if (opts == null ? void 0 : opts.namespace) this._namespace = opts.namespace;
11
- if (opts == null ? void 0 : opts.type) this._type = opts.type;
10
+ if (opts?.namespace) this._namespace = opts.namespace;
11
+ if (opts?.type) this._type = opts.type;
12
12
  this._storage = store[this.type].namespace(this.namespace);
13
13
  }
14
14
  get namespace() {
@@ -18,7 +18,7 @@ var StoragePreviousHashStore = class _StoragePreviousHashStore {
18
18
  return this._type;
19
19
  }
20
20
  get storage() {
21
- if (!(this == null ? void 0 : this._storage)) this._storage = store[this.type].namespace(this.namespace);
21
+ if (!this?._storage) this._storage = store[this.type].namespace(this.namespace);
22
22
  return this._storage;
23
23
  }
24
24
  async getItem(address) {
@@ -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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this._storage = (store as any)[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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (!this?._storage) this._storage = (store as any)[this.type].namespace(this.namespace) as StoreBase\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\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";AAEA,OAAO,WAA0B;AAS1B,IAAM,2BAAN,MAAM,0BAAsD;AAAA,EACjE,OAAgB,mBAAmB;AAAA,EACnC,OAAgB,qBAA8B;AAAA,EACtC,aAAa,0BAAyB;AAAA,EACtC;AAAA,EACA,QAAiB,0BAAyB;AAAA,EAElD,YAAY,MAAgC;AAC1C,QAAI,6BAAM,UAAW,MAAK,aAAa,KAAK;AAC5C,QAAI,6BAAM,KAAM,MAAK,QAAQ,KAAK;AAElC,SAAK,WAAY,MAAc,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EACpE;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAE/B,QAAI,EAAC,6BAAM,UAAU,MAAK,WAAY,MAAc,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AACvF,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAwC;AACpD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,MAAM,WAAW,SAAiC;AAChD,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EAEA,MAAM,QAAQ,SAAkB,cAAmC;AACjE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":[]}
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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this._storage = (store as any)[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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (!this?._storage) this._storage = (store as any)[this.type].namespace(this.namespace) as StoreBase\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\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";AAEA,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,UAAW,MAAK,aAAa,KAAK;AAC5C,QAAI,MAAM,KAAM,MAAK,QAAQ,KAAK;AAElC,SAAK,WAAY,MAAc,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EACpE;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAE/B,QAAI,CAAC,MAAM,SAAU,MAAK,WAAY,MAAc,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AACvF,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAwC;AACpD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,MAAM,WAAW,SAAiC;AAChD,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EAEA,MAAM,QAAQ,SAAkB,cAAmC;AACjE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":[]}
package/package.json CHANGED
@@ -11,45 +11,26 @@
11
11
  },
12
12
  "description": "Primary SDK for using XYO Protocol 2.0",
13
13
  "dependencies": {
14
- "@xylabs/hex": "^3.6.12",
15
- "@xyo-network/previous-hash-store-model": "^2.111.3",
14
+ "@xylabs/hex": "^4.0.0",
15
+ "@xyo-network/previous-hash-store-model": "^3.0.1",
16
16
  "store2": "^2.14.3"
17
17
  },
18
18
  "devDependencies": {
19
- "@types/node": "^22.1.0",
19
+ "@types/node": "^22.2.0",
20
20
  "@types/uuid": "^10.0.0",
21
- "@xylabs/ts-scripts-yarn3": "^3.15.14",
22
- "@xylabs/tsconfig": "^3.15.14",
21
+ "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
22
+ "@xylabs/tsconfig": "^4.0.0-rc.15",
23
23
  "typescript": "^5.5.4",
24
24
  "uuid": "^10.0.0"
25
25
  },
26
26
  "exports": {
27
27
  ".": {
28
- "browser": {
29
- "require": {
30
- "types": "./dist/browser/index.d.cts",
31
- "default": "./dist/browser/index.cjs"
32
- },
33
- "import": {
34
- "types": "./dist/browser/index.d.mts",
35
- "default": "./dist/browser/index.mjs"
36
- }
37
- },
38
- "node": {
39
- "require": {
40
- "types": "./dist/node/index.d.cts",
41
- "default": "./dist/node/index.cjs"
42
- },
43
- "import": {
44
- "types": "./dist/node/index.d.mts",
45
- "default": "./dist/node/index.mjs"
46
- }
47
- }
28
+ "types": "./dist/neutral/index.d.ts",
29
+ "default": "./dist/neutral/index.mjs"
48
30
  },
49
31
  "./package.json": "./package.json"
50
32
  },
51
- "main": "dist/node/index.cjs",
52
- "module": "dist/node/index.mjs",
33
+ "module": "dist/neutral/index.mjs",
53
34
  "homepage": "https://xyo.network",
54
35
  "license": "LGPL-3.0-only",
55
36
  "publishConfig": {
@@ -60,7 +41,7 @@
60
41
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
61
42
  },
62
43
  "sideEffects": false,
63
- "types": "dist/node/index.d.ts",
64
- "version": "2.111.3",
44
+ "types": "dist/neutral/index.d.ts",
45
+ "version": "3.0.1",
65
46
  "type": "module"
66
47
  }
@@ -1,22 +0,0 @@
1
- import { Address, Hash } from '@xylabs/hex';
2
- import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
- export type Storage = 'local' | 'session' | 'page';
4
- export type StoragePreviousHashOpts = {
5
- namespace?: string;
6
- type?: Storage;
7
- };
8
- export declare class StoragePreviousHashStore implements PreviousHashStore {
9
- static readonly DefaultNamespace = "xyo-previous-hash-store";
10
- static readonly DefaultStorageType: Storage;
11
- private _namespace;
12
- private _storage;
13
- private _type;
14
- constructor(opts?: StoragePreviousHashOpts);
15
- get namespace(): string;
16
- get type(): Storage;
17
- private get storage();
18
- getItem(address: Address): Promise<Hash | null>;
19
- removeItem(address: Address): Promise<void>;
20
- setItem(address: Address, previousHash: Hash): Promise<void>;
21
- }
22
- //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +0,0 @@
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;IAO1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAIlB;IAEK,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAK/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1,22 +0,0 @@
1
- import { Address, Hash } from '@xylabs/hex';
2
- import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
- export type Storage = 'local' | 'session' | 'page';
4
- export type StoragePreviousHashOpts = {
5
- namespace?: string;
6
- type?: Storage;
7
- };
8
- export declare class StoragePreviousHashStore implements PreviousHashStore {
9
- static readonly DefaultNamespace = "xyo-previous-hash-store";
10
- static readonly DefaultStorageType: Storage;
11
- private _namespace;
12
- private _storage;
13
- private _type;
14
- constructor(opts?: StoragePreviousHashOpts);
15
- get namespace(): string;
16
- get type(): Storage;
17
- private get storage();
18
- getItem(address: Address): Promise<Hash | null>;
19
- removeItem(address: Address): Promise<void>;
20
- setItem(address: Address, previousHash: Hash): Promise<void>;
21
- }
22
- //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +0,0 @@
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;IAO1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAIlB;IAEK,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAK/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1,22 +0,0 @@
1
- import { Address, Hash } from '@xylabs/hex';
2
- import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
- export type Storage = 'local' | 'session' | 'page';
4
- export type StoragePreviousHashOpts = {
5
- namespace?: string;
6
- type?: Storage;
7
- };
8
- export declare class StoragePreviousHashStore implements PreviousHashStore {
9
- static readonly DefaultNamespace = "xyo-previous-hash-store";
10
- static readonly DefaultStorageType: Storage;
11
- private _namespace;
12
- private _storage;
13
- private _type;
14
- constructor(opts?: StoragePreviousHashOpts);
15
- get namespace(): string;
16
- get type(): Storage;
17
- private get storage();
18
- getItem(address: Address): Promise<Hash | null>;
19
- removeItem(address: Address): Promise<void>;
20
- setItem(address: Address, previousHash: Hash): Promise<void>;
21
- }
22
- //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +0,0 @@
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;IAO1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAIlB;IAEK,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAK/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- StoragePreviousHashStore: () => StoragePreviousHashStore
34
- });
35
- module.exports = __toCommonJS(src_exports);
36
-
37
- // src/StoragePreviousHashStore.ts
38
- var import_store2 = __toESM(require("store2"), 1);
39
- var StoragePreviousHashStore = class _StoragePreviousHashStore {
40
- static DefaultNamespace = "xyo-previous-hash-store";
41
- static DefaultStorageType = "local";
42
- _namespace = _StoragePreviousHashStore.DefaultNamespace;
43
- _storage;
44
- _type = _StoragePreviousHashStore.DefaultStorageType;
45
- constructor(opts) {
46
- if (opts?.namespace) this._namespace = opts.namespace;
47
- if (opts?.type) this._type = opts.type;
48
- this._storage = import_store2.default[this.type].namespace(this.namespace);
49
- }
50
- get namespace() {
51
- return this._namespace;
52
- }
53
- get type() {
54
- return this._type;
55
- }
56
- get storage() {
57
- if (!this?._storage) this._storage = import_store2.default[this.type].namespace(this.namespace);
58
- return this._storage;
59
- }
60
- async getItem(address) {
61
- const value = await this.storage.get(address);
62
- return value ?? null;
63
- }
64
- async removeItem(address) {
65
- await this.storage.remove(address);
66
- }
67
- async setItem(address, previousHash) {
68
- await this.storage.set(address, previousHash);
69
- }
70
- };
71
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/StoragePreviousHashStore.ts"],"sourcesContent":["export * from './StoragePreviousHashStore.ts'\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this._storage = (store as any)[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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (!this?._storage) this._storage = (store as any)[this.type].namespace(this.namespace) as StoreBase\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\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,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,UAAW,MAAK,aAAa,KAAK;AAC5C,QAAI,MAAM,KAAM,MAAK,QAAQ,KAAK;AAElC,SAAK,WAAY,cAAAA,QAAc,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EACpE;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAE/B,QAAI,CAAC,MAAM,SAAU,MAAK,WAAY,cAAAA,QAAc,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AACvF,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAwC;AACpD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,MAAM,WAAW,SAAiC;AAChD,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EAEA,MAAM,QAAQ,SAAkB,cAAmC;AACjE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":["store"]}
@@ -1,2 +0,0 @@
1
- export * from './StoragePreviousHashStore.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './StoragePreviousHashStore.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA"}
@@ -1,22 +0,0 @@
1
- import { Address, Hash } from '@xylabs/hex';
2
- import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
- export type Storage = 'local' | 'session' | 'page';
4
- export type StoragePreviousHashOpts = {
5
- namespace?: string;
6
- type?: Storage;
7
- };
8
- export declare class StoragePreviousHashStore implements PreviousHashStore {
9
- static readonly DefaultNamespace = "xyo-previous-hash-store";
10
- static readonly DefaultStorageType: Storage;
11
- private _namespace;
12
- private _storage;
13
- private _type;
14
- constructor(opts?: StoragePreviousHashOpts);
15
- get namespace(): string;
16
- get type(): Storage;
17
- private get storage();
18
- getItem(address: Address): Promise<Hash | null>;
19
- removeItem(address: Address): Promise<void>;
20
- setItem(address: Address, previousHash: Hash): Promise<void>;
21
- }
22
- //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +0,0 @@
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;IAO1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAIlB;IAEK,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAK/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1,22 +0,0 @@
1
- import { Address, Hash } from '@xylabs/hex';
2
- import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
- export type Storage = 'local' | 'session' | 'page';
4
- export type StoragePreviousHashOpts = {
5
- namespace?: string;
6
- type?: Storage;
7
- };
8
- export declare class StoragePreviousHashStore implements PreviousHashStore {
9
- static readonly DefaultNamespace = "xyo-previous-hash-store";
10
- static readonly DefaultStorageType: Storage;
11
- private _namespace;
12
- private _storage;
13
- private _type;
14
- constructor(opts?: StoragePreviousHashOpts);
15
- get namespace(): string;
16
- get type(): Storage;
17
- private get storage();
18
- getItem(address: Address): Promise<Hash | null>;
19
- removeItem(address: Address): Promise<void>;
20
- setItem(address: Address, previousHash: Hash): Promise<void>;
21
- }
22
- //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +0,0 @@
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;IAO1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAIlB;IAEK,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAK/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1,22 +0,0 @@
1
- import { Address, Hash } from '@xylabs/hex';
2
- import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
- export type Storage = 'local' | 'session' | 'page';
4
- export type StoragePreviousHashOpts = {
5
- namespace?: string;
6
- type?: Storage;
7
- };
8
- export declare class StoragePreviousHashStore implements PreviousHashStore {
9
- static readonly DefaultNamespace = "xyo-previous-hash-store";
10
- static readonly DefaultStorageType: Storage;
11
- private _namespace;
12
- private _storage;
13
- private _type;
14
- constructor(opts?: StoragePreviousHashOpts);
15
- get namespace(): string;
16
- get type(): Storage;
17
- private get storage();
18
- getItem(address: Address): Promise<Hash | null>;
19
- removeItem(address: Address): Promise<void>;
20
- setItem(address: Address, previousHash: Hash): Promise<void>;
21
- }
22
- //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +0,0 @@
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;IAO1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAIlB;IAEK,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAK/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- StoragePreviousHashStore: () => StoragePreviousHashStore
34
- });
35
- module.exports = __toCommonJS(src_exports);
36
-
37
- // src/StoragePreviousHashStore.ts
38
- var import_store2 = __toESM(require("store2"), 1);
39
- var StoragePreviousHashStore = class _StoragePreviousHashStore {
40
- static DefaultNamespace = "xyo-previous-hash-store";
41
- static DefaultStorageType = "local";
42
- _namespace = _StoragePreviousHashStore.DefaultNamespace;
43
- _storage;
44
- _type = _StoragePreviousHashStore.DefaultStorageType;
45
- constructor(opts) {
46
- if (opts?.namespace) this._namespace = opts.namespace;
47
- if (opts?.type) this._type = opts.type;
48
- this._storage = import_store2.default[this.type].namespace(this.namespace);
49
- }
50
- get namespace() {
51
- return this._namespace;
52
- }
53
- get type() {
54
- return this._type;
55
- }
56
- get storage() {
57
- if (!this?._storage) this._storage = import_store2.default[this.type].namespace(this.namespace);
58
- return this._storage;
59
- }
60
- async getItem(address) {
61
- const value = await this.storage.get(address);
62
- return value ?? null;
63
- }
64
- async removeItem(address) {
65
- await this.storage.remove(address);
66
- }
67
- async setItem(address, previousHash) {
68
- await this.storage.set(address, previousHash);
69
- }
70
- };
71
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/StoragePreviousHashStore.ts"],"sourcesContent":["export * from './StoragePreviousHashStore.ts'\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this._storage = (store as any)[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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (!this?._storage) this._storage = (store as any)[this.type].namespace(this.namespace) as StoreBase\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\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,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,UAAW,MAAK,aAAa,KAAK;AAC5C,QAAI,MAAM,KAAM,MAAK,QAAQ,KAAK;AAElC,SAAK,WAAY,cAAAA,QAAc,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EACpE;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAE/B,QAAI,CAAC,MAAM,SAAU,MAAK,WAAY,cAAAA,QAAc,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AACvF,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAwC;AACpD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,MAAM,WAAW,SAAiC;AAChD,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EAEA,MAAM,QAAQ,SAAkB,cAAmC;AACjE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":["store"]}
@@ -1,2 +0,0 @@
1
- export * from './StoragePreviousHashStore.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './StoragePreviousHashStore.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA"}
@@ -1,22 +0,0 @@
1
- import { Address, Hash } from '@xylabs/hex';
2
- import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
- export type Storage = 'local' | 'session' | 'page';
4
- export type StoragePreviousHashOpts = {
5
- namespace?: string;
6
- type?: Storage;
7
- };
8
- export declare class StoragePreviousHashStore implements PreviousHashStore {
9
- static readonly DefaultNamespace = "xyo-previous-hash-store";
10
- static readonly DefaultStorageType: Storage;
11
- private _namespace;
12
- private _storage;
13
- private _type;
14
- constructor(opts?: StoragePreviousHashOpts);
15
- get namespace(): string;
16
- get type(): Storage;
17
- private get storage();
18
- getItem(address: Address): Promise<Hash | null>;
19
- removeItem(address: Address): Promise<void>;
20
- setItem(address: Address, previousHash: Hash): Promise<void>;
21
- }
22
- //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +0,0 @@
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;IAO1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAIlB;IAEK,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAK/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1,22 +0,0 @@
1
- import { Address, Hash } from '@xylabs/hex';
2
- import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
- export type Storage = 'local' | 'session' | 'page';
4
- export type StoragePreviousHashOpts = {
5
- namespace?: string;
6
- type?: Storage;
7
- };
8
- export declare class StoragePreviousHashStore implements PreviousHashStore {
9
- static readonly DefaultNamespace = "xyo-previous-hash-store";
10
- static readonly DefaultStorageType: Storage;
11
- private _namespace;
12
- private _storage;
13
- private _type;
14
- constructor(opts?: StoragePreviousHashOpts);
15
- get namespace(): string;
16
- get type(): Storage;
17
- private get storage();
18
- getItem(address: Address): Promise<Hash | null>;
19
- removeItem(address: Address): Promise<void>;
20
- setItem(address: Address, previousHash: Hash): Promise<void>;
21
- }
22
- //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +0,0 @@
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;IAO1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAIlB;IAEK,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAK/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1,22 +0,0 @@
1
- import { Address, Hash } from '@xylabs/hex';
2
- import { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
3
- export type Storage = 'local' | 'session' | 'page';
4
- export type StoragePreviousHashOpts = {
5
- namespace?: string;
6
- type?: Storage;
7
- };
8
- export declare class StoragePreviousHashStore implements PreviousHashStore {
9
- static readonly DefaultNamespace = "xyo-previous-hash-store";
10
- static readonly DefaultStorageType: Storage;
11
- private _namespace;
12
- private _storage;
13
- private _type;
14
- constructor(opts?: StoragePreviousHashOpts);
15
- get namespace(): string;
16
- get type(): Storage;
17
- private get storage();
18
- getItem(address: Address): Promise<Hash | null>;
19
- removeItem(address: Address): Promise<void>;
20
- setItem(address: Address, previousHash: Hash): Promise<void>;
21
- }
22
- //# sourceMappingURL=StoragePreviousHashStore.d.ts.map
@@ -1 +0,0 @@
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;IAO1C,IAAI,SAAS,WAEZ;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,KAAK,OAAO,GAIlB;IAEK,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAK/C,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- StoragePreviousHashStore: () => StoragePreviousHashStore
34
- });
35
- module.exports = __toCommonJS(src_exports);
36
-
37
- // src/StoragePreviousHashStore.ts
38
- var import_store2 = __toESM(require("store2"), 1);
39
- var StoragePreviousHashStore = class _StoragePreviousHashStore {
40
- static DefaultNamespace = "xyo-previous-hash-store";
41
- static DefaultStorageType = "local";
42
- _namespace = _StoragePreviousHashStore.DefaultNamespace;
43
- _storage;
44
- _type = _StoragePreviousHashStore.DefaultStorageType;
45
- constructor(opts) {
46
- if (opts == null ? void 0 : opts.namespace) this._namespace = opts.namespace;
47
- if (opts == null ? void 0 : opts.type) this._type = opts.type;
48
- this._storage = import_store2.default[this.type].namespace(this.namespace);
49
- }
50
- get namespace() {
51
- return this._namespace;
52
- }
53
- get type() {
54
- return this._type;
55
- }
56
- get storage() {
57
- if (!(this == null ? void 0 : this._storage)) this._storage = import_store2.default[this.type].namespace(this.namespace);
58
- return this._storage;
59
- }
60
- async getItem(address) {
61
- const value = await this.storage.get(address);
62
- return value ?? null;
63
- }
64
- async removeItem(address) {
65
- await this.storage.remove(address);
66
- }
67
- async setItem(address, previousHash) {
68
- await this.storage.set(address, previousHash);
69
- }
70
- };
71
- // Annotate the CommonJS export names for ESM import in node:
72
- 0 && (module.exports = {
73
- StoragePreviousHashStore
74
- });
75
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/StoragePreviousHashStore.ts"],"sourcesContent":["export * from './StoragePreviousHashStore.ts'\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this._storage = (store as any)[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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (!this?._storage) this._storage = (store as any)[this.type].namespace(this.namespace) as StoreBase\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\n async removeItem(address: Address): Promise<void> {\n await this.storage.remove(address)\n }\n\n async setItem(address: Address, previousHash: Hash): Promise<void> {\n await this.storage.set(address, previousHash)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,oBAAiC;AAS1B,IAAM,2BAAN,MAAM,0BAAsD;AAAA,EACjE,OAAgB,mBAAmB;AAAA,EACnC,OAAgB,qBAA8B;AAAA,EACtC,aAAa,0BAAyB;AAAA,EACtC;AAAA,EACA,QAAiB,0BAAyB;AAAA,EAElD,YAAY,MAAgC;AAC1C,QAAI,6BAAM,UAAW,MAAK,aAAa,KAAK;AAC5C,QAAI,6BAAM,KAAM,MAAK,QAAQ,KAAK;AAElC,SAAK,WAAY,cAAAA,QAAc,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AAAA,EACpE;AAAA,EAEA,IAAI,YAAY;AACd,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,OAAgB;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAY,UAAqB;AAE/B,QAAI,EAAC,6BAAM,UAAU,MAAK,WAAY,cAAAA,QAAc,KAAK,IAAI,EAAE,UAAU,KAAK,SAAS;AACvF,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,SAAwC;AACpD,UAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,OAAO;AAC5C,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,MAAM,WAAW,SAAiC;AAChD,UAAM,KAAK,QAAQ,OAAO,OAAO;AAAA,EACnC;AAAA,EAEA,MAAM,QAAQ,SAAkB,cAAmC;AACjE,UAAM,KAAK,QAAQ,IAAI,SAAS,YAAY;AAAA,EAC9C;AACF;","names":["store"]}
@@ -1,2 +0,0 @@
1
- export * from './StoragePreviousHashStore.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './StoragePreviousHashStore.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA"}