Comparing version 4.0.0 to 4.0.1
{ | ||
"name": "hyper-sdk", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "A Software Development Kit for the Hypercore-Protocol", | ||
@@ -37,6 +37,6 @@ "type": "module", | ||
"dns-query": "^0.11.2", | ||
"hypercore": "^10.3.2", | ||
"hyperswarm": "^4.3.3", | ||
"random-access-application": "^1.0.0", | ||
"random-access-memory": "^6.0.0", | ||
"hypercore": "^10.5.3", | ||
"hyperswarm": "^4.3.5", | ||
"random-access-application": "^2.0.0", | ||
"random-access-memory": "^6.1.0", | ||
"z32": "^1.0.0" | ||
@@ -46,4 +46,5 @@ }, | ||
"standard": "^17.0.0", | ||
"tape": "^5.6.1" | ||
"tape": "^5.6.1", | ||
"tmp-promise": "^3.0.3" | ||
} | ||
} |
42
test.js
@@ -5,2 +5,3 @@ import test from 'tape' | ||
import b4a from 'b4a' | ||
import { withDir } from 'tmp-promise' | ||
@@ -12,2 +13,43 @@ const NULL_KEY = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy' | ||
test('Specify storage for sdk', async (t) => { | ||
await withDir(async (dir) => { | ||
const storage = dir.path | ||
const name = 'example' | ||
const data = 'Hello World!' | ||
let sdk = await create({ storage }) | ||
let sdk2 = null | ||
try { | ||
try { | ||
sdk2 = await create({ storage }) | ||
t.fail(new Error('Should not be able to load SDK over existing dir')) | ||
} catch { | ||
t.pass('Threw error when opening same storage path twice') | ||
} finally { | ||
if (sdk2) await sdk2.close() | ||
} | ||
const core1 = await sdk.get(name) | ||
const url1 = core1.url | ||
await core1.append(data) | ||
await sdk.close() | ||
sdk = await create({ storage }) | ||
const core2 = await sdk.get(name) | ||
const url2 = core2.url | ||
t.equal(url1, url2, 'Loaded core has same key') | ||
const contents = await core2.get(0) | ||
t.deepEqual(contents.toString('utf8'), data, 'Got data back from disk') | ||
} finally { | ||
await sdk.close() | ||
} | ||
}, {unsafeCleanup: true}) | ||
}) | ||
test('Load hypercores by names and urls', async (t) => { | ||
@@ -14,0 +56,0 @@ const sdk = await create({ storage: false }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
22512
338
1
3
+ Addedrandom-access-application@2.0.1(transitive)
- Removedmkdirp-classic@0.5.3(transitive)
- Removedrandom-access-application@1.0.0(transitive)
- Removedrandom-access-file@2.2.1(transitive)
Updatedhypercore@^10.5.3
Updatedhyperswarm@^4.3.5
Updatedrandom-access-memory@^6.1.0