@xyo-network/previous-hash-store-indexeddb 5.1.22 → 5.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/previous-hash-store-indexeddb",
3
- "version": "5.1.22",
3
+ "version": "5.1.23",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -30,11 +30,14 @@
30
30
  "types": "dist/neutral/index.d.ts",
31
31
  "files": [
32
32
  "dist",
33
- "src"
33
+ "src",
34
+ "!**/*.bench.*",
35
+ "!**/*.spec.*",
36
+ "!**/*.test.*"
34
37
  ],
35
38
  "dependencies": {
36
- "@xylabs/hex": "~5.0.24",
37
- "@xyo-network/previous-hash-store-model": "~5.1.22",
39
+ "@xylabs/hex": "~5.0.33",
40
+ "@xyo-network/previous-hash-store-model": "~5.1.23",
38
41
  "idb": "~8.0.3"
39
42
  },
40
43
  "devDependencies": {
@@ -45,7 +48,7 @@
45
48
  "fake-indexeddb": "~6.2.5",
46
49
  "typescript": "~5.9.3",
47
50
  "uuid": "~13.0.0",
48
- "vitest": "~4.0.8"
51
+ "vitest": "~4.0.9"
49
52
  },
50
53
  "publishConfig": {
51
54
  "access": "public"
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=IndexedDbPreviousHashStore.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IndexedDbPreviousHashStore.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/IndexedDbPreviousHashStore.spec.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=IndexedDbPreviousHashStore.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IndexedDbPreviousHashStore.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/IndexedDbPreviousHashStore.spec.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=IndexedDbPreviousHashStore.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IndexedDbPreviousHashStore.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/IndexedDbPreviousHashStore.spec.ts"],"names":[],"mappings":""}
@@ -1,73 +0,0 @@
1
- import type { Address } from '@xylabs/hex'
2
- import {
3
- IDBCursor,
4
- IDBCursorWithValue,
5
- IDBDatabase,
6
- IDBFactory,
7
- IDBIndex,
8
- IDBKeyRange,
9
- IDBObjectStore,
10
- IDBOpenDBRequest,
11
- IDBRequest,
12
- IDBTransaction,
13
- IDBVersionChangeEvent,
14
- indexedDB,
15
- } from 'fake-indexeddb'
16
- import { v4 as uuid } from 'uuid'
17
- import {
18
- describe, expect, it,
19
- } from 'vitest'
20
-
21
- import { IndexedDbPreviousHashStore } from '../IndexedDbPreviousHashStore.ts'
22
-
23
- // Shim via fake-indexeddb
24
- globalThis.indexedDB = indexedDB
25
-
26
- // Augment window with prototypes to ensure instance of comparisons work
27
- globalThis.IDBCursor = IDBCursor
28
- globalThis.IDBCursorWithValue = IDBCursorWithValue
29
- globalThis.IDBDatabase = IDBDatabase
30
- globalThis.IDBFactory = IDBFactory
31
- globalThis.IDBIndex = IDBIndex
32
- globalThis.IDBKeyRange = IDBKeyRange
33
- globalThis.IDBObjectStore = IDBObjectStore
34
- globalThis.IDBOpenDBRequest = IDBOpenDBRequest
35
- globalThis.IDBRequest = IDBRequest
36
- globalThis.IDBTransaction = IDBTransaction
37
- globalThis.IDBVersionChangeEvent = IDBVersionChangeEvent
38
-
39
- describe('IndexedDbPreviousHashStore', () => {
40
- const previousHash = '2e8de18ece40481f132e6d2f05617e05cd896a9098d28ed65afdf0d72203b490'
41
-
42
- describe('ctor', () => {
43
- it('creates DB/Store with default values', () => {
44
- const store = new IndexedDbPreviousHashStore()
45
- expect(store).toBeInstanceOf(IndexedDbPreviousHashStore)
46
- })
47
- })
48
- describe('getItem', () => {
49
- it('with no value returns null', async () => {
50
- const store = new IndexedDbPreviousHashStore()
51
- const address = uuid().toLowerCase() as Address
52
- expect(await store.getItem(address)).toBe(null)
53
- })
54
- })
55
- describe('round trip storage', () => {
56
- it('sets/retrieves an item', async () => {
57
- const store = new IndexedDbPreviousHashStore()
58
- const address = uuid().toLowerCase() as Address
59
- await store.setItem(address, previousHash)
60
- expect(await store.getItem(address)).toBe(previousHash)
61
- })
62
- })
63
- describe('removeItem', () => {
64
- it('removes an item', async () => {
65
- const store = new IndexedDbPreviousHashStore()
66
- const address = uuid().toLowerCase() as Address
67
- await store.setItem(address, previousHash)
68
- expect(await store.getItem(address)).toBe(previousHash)
69
- await store.removeItem(address)
70
- expect(await store.getItem(address)).toBe(null)
71
- })
72
- })
73
- })