Skip to content
This repository was archived by the owner on Oct 1, 2021. It is now read-only.

Commit 4ade596

Browse files
authored
chore: update all deps to latest versions (#58)
1 parent 0ed3b24 commit 4ade596

File tree

15 files changed

+43
-45
lines changed

15 files changed

+43
-45
lines changed

migrations/migration-8/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function keyToCid (key) {
3333
}
3434

3535
async function process (repoPath, repoOptions, onProgress, keyFunction) {
36-
const blockstore = await createStore(repoPath, 'blocks', repoOptions)
36+
const blockstore = createStore(repoPath, 'blocks', repoOptions)
3737
await blockstore.open()
3838

3939
let blockCount

migrations/migration-9/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ async function pinsToDAG (blockstore, datastore, pinstore, onProgress) {
115115
}
116116

117117
async function process (repoPath, repoOptions, onProgress, fn) {
118-
const blockstore = await createStore(repoPath, 'blocks', repoOptions)
119-
const datastore = await createStore(repoPath, 'datastore', repoOptions)
120-
const pinstore = await createStore(repoPath, 'pins', repoOptions)
118+
const blockstore = createStore(repoPath, 'blocks', repoOptions)
119+
const datastore = createStore(repoPath, 'datastore', repoOptions)
120+
const pinstore = createStore(repoPath, 'pins', repoOptions)
121121

122122
await blockstore.open()
123123
await datastore.open()

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,27 @@
4141
"docs": "aegir docs"
4242
},
4343
"dependencies": {
44-
"cbor": "^5.0.2",
44+
"cbor": "^6.0.1",
4545
"cids": "^1.0.0",
46-
"datastore-core": "^2.0.0",
46+
"datastore-core": "^3.0.0",
4747
"debug": "^4.1.0",
4848
"fnv1a": "^1.0.1",
49-
"interface-datastore": "^2.0.0",
49+
"interface-datastore": "^3.0.3",
5050
"ipld-dag-pb": "^0.20.0",
51-
"it-length": "0.0.2",
51+
"it-length": "^1.0.1",
5252
"multibase": "^3.0.0",
5353
"multicodec": "^2.0.0",
5454
"multihashing-async": "^2.0.0",
5555
"proper-lockfile": "^4.1.1",
5656
"protons": "^2.0.0",
57-
"uint8arrays": "^1.0.0",
58-
"varint": "^5.0.0"
57+
"uint8arrays": "^2.0.5",
58+
"varint": "^6.0.0"
5959
},
6060
"devDependencies": {
61-
"aegir": "^26.0.0",
61+
"aegir": "^30.3.0",
6262
"datastore-car": "^1.2.0",
63-
"datastore-fs": "^2.0.1",
64-
"datastore-level": "^2.0.0",
63+
"datastore-fs": "^3.0.0",
64+
"datastore-level": "^3.0.0",
6565
"it-all": "^1.0.2",
6666
"just-safe-set": "^2.1.0",
6767
"ncp": "^2.0.0",

src/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ exports.errors = errors
1414
* Returns the version of latest migration.
1515
* If no migrations are present returns 0.
1616
*
17-
* @param {array?} migrations - Array of migrations to consider. If undefined, the bundled migrations are used. Mainly for testing purpose.
17+
* @param {?Array} migrations - Array of migrations to consider. If undefined, the bundled migrations are used. Mainly for testing purpose.
1818
* @returns {int}
1919
*/
2020
function getLatestMigrationVersion (migrations) {
@@ -40,9 +40,9 @@ exports.getLatestMigrationVersion = getLatestMigrationVersion
4040
* @param {int} toVersion - Version to which the repo should be migrated.
4141
* @param {Object?} options - Options for migration
4242
* @param {boolean?} options.ignoreLock - Won't lock the repo for applying the migrations. Use with caution.
43-
* @param {function?} options.onProgress - Callback which will be called after each executed migration to report progress
43+
* @param {?Function} options.onProgress - Callback which will be called after each executed migration to report progress
4444
* @param {boolean?} options.isDryRun - Allows to simulate the execution of the migrations without any effect.
45-
* @param {array?} options.migrations - Array of migrations to migrate. If undefined, the bundled migrations are used. Mainly for testing purpose.
45+
* @param {?Array} options.migrations - Array of migrations to migrate. If undefined, the bundled migrations are used. Mainly for testing purpose.
4646
* @returns {Promise<void>}
4747
*/
4848
async function migrate (path, repoOptions, toVersion, { ignoreLock = false, onProgress, isDryRun = false, migrations }) {
@@ -141,10 +141,10 @@ exports.migrate = migrate
141141
* @param {Object} repoOptions - Options that are passed to migrations, that can use them to correctly construct datastore. Options are same like for IPFSRepo.
142142
* @param {int} toVersion - Version to which the repo will be reverted.
143143
* @param {Object?} options - Options for the reversion
144-
* @param {function?} options.onProgress - Callback which will be called after each reverted migration to report progress
144+
* @param {?Function} options.onProgress - Callback which will be called after each reverted migration to report progress
145145
* @param {boolean?} options.isDryRun - Allows to simulate the execution of the reversion without any effects. Make sense to utilize onProgress with this argument.
146146
* @param {boolean?} options.ignoreLock - Won't lock the repo for reverting the migrations. Use with caution.
147-
* @param {array?} options.migrations - Array of migrations to migrate. If undefined, the bundled migrations are used. Mainly for testing purpose.
147+
* @param {?Array} options.migrations - Array of migrations to migrate. If undefined, the bundled migrations are used. Mainly for testing purpose.
148148
* @returns {Promise<void>}
149149
*/
150150
async function revert (path, repoOptions, toVersion, { ignoreLock = false, onProgress, isDryRun = false, migrations }) {
@@ -237,7 +237,7 @@ exports.revert = revert
237237
/**
238238
* Function checks if all migrations in given range are available.
239239
*
240-
* @param {array} migrations
240+
* @param {Array} migrations
241241
* @param {int} fromVersion
242242
* @param {int} toVersion
243243
* @param {boolean} checkReversibility - Will additionally checks if all the migrations in the range are reversible

src/repo/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports.isRepoInitialized = async function isRepoInitialized (path, repoOptions)
1111

1212
let root
1313
try {
14-
root = await createStore(path, 'root', repoOptions)
14+
root = createStore(path, 'root', repoOptions)
1515
await root.open()
1616
const versionCheck = await root.has(VERSION_KEY)
1717
const configCheck = await root.has(CONFIG_KEY)

src/repo/lock-memory.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const LOCKS = {}
77

88
/**
99
* Lock the repo in the given dir and for given repo version.
10+
*
1011
* @param {int} version
1112
* @param {string} dir
1213
* @returns {Promise<Object>}

src/repo/version.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ exports.getVersion = getVersion
1313
* even in case of change of repo's versioning.
1414
*
1515
* @param {string} path
16-
* @param {Object} repoOptions Options used to create a repo, the same as pased to ipfs-repo
16+
* @param {Object} repoOptions - Options used to create a repo, the same as pased to ipfs-repo
1717
* @returns {Promise<int>}
1818
*/
1919
async function getVersion (path, repoOptions) {
@@ -25,7 +25,7 @@ async function getVersion (path, repoOptions) {
2525
throw new MissingRepoOptionsError('Please pass repo options when trying to open a repo')
2626
}
2727

28-
const store = await createStore(path, 'root', repoOptions)
28+
const store = createStore(path, 'root', repoOptions)
2929
await store.open()
3030

3131
const version = parseInt(await store.get(VERSION_KEY))
@@ -39,15 +39,15 @@ async function getVersion (path, repoOptions) {
3939
*
4040
* @param {string} path
4141
* @param {int} version
42-
* @param {Object} repoOptions Options used to create a repo, the same as pased to ipfs-repo
42+
* @param {Object} repoOptions - Options used to create a repo, the same as pased to ipfs-repo
4343
* @returns {Promise<void>}
4444
*/
4545
async function setVersion (path, version, repoOptions) {
4646
if (!repoOptions) {
4747
throw new MissingRepoOptionsError('Please pass repo options when trying to open a repo')
4848
}
4949

50-
const store = await createStore(path, 'root', repoOptions)
50+
const store = createStore(path, 'root', repoOptions)
5151
await store.open()
5252
await store.put(VERSION_KEY, uint8ArrayFromString(String(version)))
5353
await store.close()

src/utils.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function getDatastoreAndOptions (name, options) {
3030
}
3131
}
3232

33-
async function createStore (location, name, options) {
33+
function createStore (location, name, options) {
3434
const { StorageBackend, storageOptions } = getDatastoreAndOptions(name, options)
3535

3636
if (name !== 'root') {
@@ -40,12 +40,9 @@ async function createStore (location, name, options) {
4040
let store = new StorageBackend(location, storageOptions)
4141

4242
if (storageOptions.sharding) {
43-
const shard = new core.shard.NextToLast(2)
44-
store = await ShardingStore.createOrOpen(store, shard)
43+
store = new ShardingStore(store, new core.shard.NextToLast(2))
4544
}
4645

47-
await store.close()
48-
4946
return store
5047
}
5148

test/fixtures/repo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { CONFIG_KEY, VERSION_KEY, createStore } = require('../../src/utils')
66
async function createRepo (repoOptions, prefix) {
77
const date = Date.now().toString()
88
const dir = `${prefix ? `${prefix}/` : ''}test-repo-for-${date}`
9-
const store = await createStore(dir, 'root', repoOptions)
9+
const store = createStore(dir, 'root', repoOptions)
1010
await store.open()
1111
await store.close()
1212
return dir
@@ -15,7 +15,7 @@ async function createRepo (repoOptions, prefix) {
1515
async function createAndLoadRepo (repoOptions, prefix) {
1616
const date = Date.now().toString()
1717
const dir = `${prefix ? `${prefix}/` : ''}test-repo-for-${date}`
18-
const store = await createStore(dir, 'root', repoOptions)
18+
const store = createStore(dir, 'root', repoOptions)
1919
await store.open()
2020

2121
await store.put(VERSION_KEY, loadFixture('test/fixtures/test-repo/version'))

test/init-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = (setup, cleanup, repoOptions) => {
1717
)
1818

1919
it('should return true with valid initialized repo', async () => {
20-
const store = await createStore(dir, 'root', repoOptions)
20+
const store = createStore(dir, 'root', repoOptions)
2121
await store.open()
2222
await store.put(VERSION_KEY, uint8ArrayFromString('7'))
2323
await store.put(CONFIG_KEY, uint8ArrayFromString('config'))
@@ -27,7 +27,7 @@ module.exports = (setup, cleanup, repoOptions) => {
2727
})
2828

2929
it('should return false with missing version key', async () => {
30-
const store = await createStore(dir, 'root', repoOptions)
30+
const store = createStore(dir, 'root', repoOptions)
3131
await store.open()
3232
await store.put(CONFIG_KEY, '')
3333
await store.close()
@@ -36,7 +36,7 @@ module.exports = (setup, cleanup, repoOptions) => {
3636
})
3737

3838
it('should return false with missing config key', async () => {
39-
const store = await createStore(dir, 'root', repoOptions)
39+
const store = createStore(dir, 'root', repoOptions)
4040
await store.open()
4141
await store.put(VERSION_KEY, '')
4242
await store.close()

0 commit comments

Comments
 (0)