Merge pull request #1101 from orbitdb/release/v1.0

Release/v1.0
This commit is contained in:
Hayden Young 2023-09-18 21:46:38 +08:00 committed by GitHub
commit 3eee148510
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 4061 additions and 1289 deletions

View File

@ -15,46 +15,18 @@ OrbitDB provides various types of databases for different data models and use ca
- **[keyvalue](https://github.com/orbitdb/orbitdb/blob/master/API.md#orbitdbkeyvaluenameaddress)**: a key-value database just like your favourite key-value database. - **[keyvalue](https://github.com/orbitdb/orbitdb/blob/master/API.md#orbitdbkeyvaluenameaddress)**: a key-value database just like your favourite key-value database.
- **[keyvalue-indexed](https://github.com/orbitdb/orbitdb/blob/master/API.md#orbitdbkeyvaluenameaddress)**: key-value data indexed in a Level key-value database. - **[keyvalue-indexed](https://github.com/orbitdb/orbitdb/blob/master/API.md#orbitdbkeyvaluenameaddress)**: key-value data indexed in a Level key-value database.
All databases are [implemented](https://github.com/orbitdb/orbitdb/tree/main/src/storage/) on top of OrbitDB's [OpLog](https://github.com/orbitdb/orbitdb/tree/amin/src/oplog/), an immutable, cryptographically verifiable, operation-based conflict-free replicated data structure ([CRDT](https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type)) for distributed systems. OpLog is formalized in the paper [Merkle-CRDTs](https://arxiv.org/abs/2004.00107). You can also easily extend OrbitDB by [implementing and using a custom data model](https://github.com/orbitdb/orbitdb/blob/main/docs/DATABASES.md#building-a-custom-database) benefitting from the same properties as the default data models provided by the underlying Merkle-CRDTs. All databases are [implemented](https://github.com/orbitdb/orbitdb/tree/main/src/databases/) on top of OrbitDB's [OpLog](https://github.com/orbitdb/orbitdb/tree/main/src/oplog/), an immutable, cryptographically verifiable, operation-based conflict-free replicated data structure ([CRDT](https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type)) for distributed systems. OpLog is formalized in the paper [Merkle-CRDTs](https://arxiv.org/abs/2004.00107). You can also easily extend OrbitDB by [implementing and using a custom data model](https://github.com/orbitdb/orbitdb/blob/main/docs/DATABASES.md#building-a-custom-database) benefitting from the same properties as the default data models provided by the underlying Merkle-CRDTs.
#### Project status & support This is the Javascript implementation and it works both in **Browsers** and **Node.js** with support for Linux, OS X, and Windows.
* Status: **in active development**
* Compatible with **ipfs-core versions >= 0.18.0**
***NOTE!*** *[js-ipfs](https://github.com/ipfs/js-ipfs) and related packages are now superseded by IPFS's [Helia](https://github.com/ipfs/helia) project and are no longer being maintained. As part of this migration, OrbitDB will be soon [switching to Helia](https://github.com/ipfs/helia).* ***NOTE!*** *[js-ipfs](https://github.com/ipfs/js-ipfs) and related packages are now superseded by IPFS's [Helia](https://github.com/ipfs/helia) project and are no longer being maintained. As part of this migration, OrbitDB will be soon [switching to Helia](https://github.com/ipfs/helia).*
This is the Javascript implementation and it works both in **Browsers** and **Node.js** with support for Linux, OS X, and Windows. Node version 16 is supported.
A Go implementation is developed and maintained by the [Berty](https://github.com/berty) project at [berty/go-orbit-db](https://github.com/berty/go-orbit-db). A Go implementation is developed and maintained by the [Berty](https://github.com/berty) project at [berty/go-orbit-db](https://github.com/berty/go-orbit-db).
## Table of Contents
<!-- toc -->
- [Installation](#installation)
* [Browser <script> tag](#browser-script-tag)
- [Usage](#usage)
- [Documentation](#documentation)
* [API](#api)
- [Development](#development)
* [Run Tests](#run-tests)
* [Build](#build)
* [Benchmark](#benchmark)
* [API](#api)
- [Are there implementations in other languages?](#other-implementations)
- [Contributing](#contributing)
- [Sponsors](#sponsors)
- [License](#license)
<!-- tocstop -->
## Installation ## Installation
*Note! The upcoming version 1.0.0 is currently in testing and needs to be installed as version "next" as described below.*
``` ```
npm install @orbitdb/core@next npm install @orbitdb/core
``` ```
### Browser <script> tag ### Browser <script> tag
@ -80,7 +52,7 @@ import { createOrbitDB } from '@orbitdb/core'
const address = db.address const address = db.address
console.log(address) console.log(address)
// "/orbitdb/hash" // "/orbitdb/zdpuAkstgbTVGHQmMi5TC84auhJ8rL5qoaNEtXo2d5PHXs2To"
// The above address can be used on another peer to open the same database // The above address can be used on another peer to open the same database
// Listen for updates from peers // Listen for updates from peers
@ -110,7 +82,7 @@ Use the **[Getting Started](https://github.com/orbitdb/orbitdb/blob/main/docs/GE
### API ### API
See [api.orbitdb.org](https://api.orbitdb.org) for the full API documentation. See [https://api.orbitdb.org](https://api.orbitdb.org) for the full API documentation.
## Development ## Development
@ -163,7 +135,7 @@ The development of OrbitDB has been sponsored by:
* [Maintainer Mountaineer](https://maintainer.io) * [Maintainer Mountaineer](https://maintainer.io)
* [OrbitDB Open Collective](https://opencollective.com/orbitdb) * [OrbitDB Open Collective](https://opencollective.com/orbitdb)
If you want to sponsor developers to work on OrbitDB, please reach out to [@haadcode](https://github.com/haadcode). If you want to sponsor developers to work on OrbitDB, please donate to our [OrbitDB Open Collective](https://opencollective.com/orbitdb) or reach out to [@haadcode](https://github.com/haadcode).
## License ## License

View File

@ -1,7 +1,7 @@
import { Identities, Log } from '../src/index.js' import { Identities, Log } from '../src/index.js'
import { MemoryStorage } from '../src/storage/index.js' import { MemoryStorage } from '../src/storage/index.js'
// import { MemoryStorage, LevelStorage, LRUStorage } from '../src/storage/index.js' // import { MemoryStorage, LevelStorage, LRUStorage } from '../src/storage/index.js'
import rmrf from 'rimraf' import { rimraf as rmrf } from 'rimraf'
// State // State
let log let log

View File

@ -1,7 +1,7 @@
import { Identities, Log } from '../src/index.js' import { Identities, Log } from '../src/index.js'
import { MemoryStorage } from '../src/storage/index.js' import { MemoryStorage } from '../src/storage/index.js'
// import { MemoryStorage, LevelStorage, LRUStorage } from '../src/storage/index.js' // import { MemoryStorage, LevelStorage, LRUStorage } from '../src/storage/index.js'
import rmrf from 'rimraf' import { rimraf as rmrf } from 'rimraf'
;(async () => { ;(async () => {
console.log('Starting benchmark...') console.log('Starting benchmark...')

View File

@ -1,5 +1,5 @@
import { createOrbitDB } from '../src/index.js' import { createOrbitDB } from '../src/index.js'
import rmrf from 'rimraf' import { rimraf as rmrf } from 'rimraf'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { EventEmitter } from 'events' import { EventEmitter } from 'events'

View File

@ -1,5 +1,5 @@
import { createOrbitDB } from '../src/index.js' import { createOrbitDB } from '../src/index.js'
import rmrf from 'rimraf' import { rimraf as rmrf } from 'rimraf'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { EventEmitter } from 'events' import { EventEmitter } from 'events'

View File

@ -1,5 +1,5 @@
import { createOrbitDB } from '../src/index.js' import { createOrbitDB } from '../src/index.js'
import rmrf from 'rimraf' import { rimraf as rmrf } from 'rimraf'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import connectPeers from '../test/utils/connect-nodes.js' import connectPeers from '../test/utils/connect-nodes.js'
import waitFor from '../test/utils/wait-for.js' import waitFor from '../test/utils/wait-for.js'

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>OrbitDB API</title> <title>OrbitDB API - v1.0.0</title>
<script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script> <script src="scripts/prettify/lang-css.js"> </script>

View File

@ -1,38 +0,0 @@
import path from 'path'
import webpack from 'webpack'
export default (env, argv) => {
return {
entry: './examples/browser/browser-webpack-example/index.js',
output: {
filename: '../examples/browser/browser-webpack-example/bundle.js'
},
target: 'web',
devtool: 'none',
node: {
Buffer: true,
mkdirp: 'empty',
fs: 'empty'
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
})
],
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, '../node_modules')
]
},
resolveLoader: {
modules: [
'node_modules',
path.resolve(__dirname, '../node_modules')
],
moduleExtensions: ['-loader']
}
}
}

View File

@ -20,7 +20,7 @@ export default (env, argv) => {
externals: { externals: {
fs: '{ existsSync: () => true }', fs: '{ existsSync: () => true }',
'fs-extra': '{ copy: () => {} }', 'fs-extra': '{ copy: () => {} }',
rimraf: '() => {}' rimraf: '{ rimraf: () => {} }'
}, },
plugins: [ plugins: [
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({

View File

@ -7,7 +7,7 @@ This guide will help you get up and running with a simple OrbitDB database that
Install OrbitDB: Install OrbitDB:
```sh ```sh
npm i @orbitdb/core@next npm i @orbitdb/core
``` ```
You will also need IPFS for replication: You will also need IPFS for replication:

View File

@ -1,10 +1,12 @@
## OrbitDB API - v1.0.0
OrbitDB is a serverless, distributed, peer-to-peer database. OrbitDB uses IPFS OrbitDB is a serverless, distributed, peer-to-peer database. OrbitDB uses IPFS
as its data storage and Libp2p Pubsub to automatically sync databases with peers. It's an eventually consistent database that uses Merkle-CRDTs for conflict-free database writes and merges making OrbitDB an excellent choice for p2p and decentralized apps, blockchain applications and local first web applications. as its data storage and Libp2p Pubsub to automatically sync databases with peers. It's an eventually consistent database that uses Merkle-CRDTs for conflict-free database writes and merges making OrbitDB an excellent choice for p2p and decentralized apps, blockchain applications and local first web applications.
To install OrbitDB: To install OrbitDB:
```bash ```bash
npm install @orbitdb/core@next npm install @orbitdb/core
``` ```
IPFS is also required: IPFS is also required:

4884
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,12 @@
{ {
"name": "@orbitdb/core", "name": "@orbitdb/core",
"version": "0.31.0", "version": "1.0.0",
"description": "Distributed p2p database on IPFS", "description": "Distributed p2p database on IPFS",
"author": "Haad", "author": "Haad",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/orbitdb/orbit-db" "url": "https://github.com/orbitdb/orbitdb"
}, },
"engines": { "engines": {
"node": ">=16.0.0" "node": ">=16.0.0"
@ -18,48 +18,42 @@
"type": "module", "type": "module",
"main": "src/index.js", "main": "src/index.js",
"dependencies": { "dependencies": {
"@ipld/dag-cbor": "^9.0.0", "@ipld/dag-cbor": "^9.0.5",
"@libp2p/crypto": "^1.0.12", "@libp2p/crypto": "^2.0.4",
"it-pipe": "^2.0.5", "it-pipe": "^3.0.1",
"level": "^8.0.0", "level": "^8.0.0",
"lru": "^3.1.0", "lru": "^3.1.0",
"multiformats": "^11.0.1", "multiformats": "^12.1.1",
"p-queue": "^7.3.4", "p-queue": "^7.4.1",
"timeout-abort-controller": "^3.0.0", "timeout-abort-controller": "^3.0.0",
"uint8arrays": "^4.0.3" "uint8arrays": "^4.0.6"
}, },
"devDependencies": { "devDependencies": {
"@libp2p/webrtc-star-signalling-server": "^3.0.0", "@libp2p/webrtc-star-signalling-server": "^4.0.0",
"assert": "^2.0.0", "assert": "^2.1.0",
"babel-loader": "^9.1.2", "babel-loader": "^9.1.3",
"c8": "^7.13.0", "c8": "^8.0.1",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"fs-extra": "^11.1.0", "fs-extra": "^11.1.1",
"ipfs-core": "^0.18.0", "ipfs-core": "^0.18.0",
"it-all": "^2.0.0", "it-all": "^3.0.3",
"jsdoc": "^4.0.2", "jsdoc": "^4.0.2",
"mocha": "^10.2.0", "mocha": "^10.2.0",
"mocha-headless-chrome": "^4.0.0", "mocha-headless-chrome": "^4.0.0",
"open-cli": "^7.1.0", "open-cli": "^7.2.0",
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",
"rimraf": "^4.1.3", "rimraf": "^5.0.1",
"standard": "^17.0.0", "standard": "^17.1.0",
"webpack": "^5.75.0", "webpack": "^5.88.2",
"webpack-cli": "^5.0.1" "webpack-cli": "^5.1.4"
}, },
"scripts": { "scripts": {
"examples:events": "node examples/events.js",
"examples:keyvalue": "node examples/keyvalue.js",
"examples:browser": "open-cli examples/browser/browser.html",
"examples:browser-webpack": "open-cli examples/browser/browser-webpack-example/index.html",
"lint:docs": "remark -qf -u validate-links .", "lint:docs": "remark -qf -u validate-links .",
"test:all": "npm run test:browser-multiple-tabs && npm run test", "test:all": "npm run test:browser-multiple-tabs && npm run test",
"test": "cross-env mocha --config test/.mocharc.json", "test": "cross-env mocha --config test/.mocharc.json",
"test:ci": "cross-env c8 mocha --config test/.mocharc.json", "test:ci": "cross-env c8 mocha --config test/.mocharc.json",
"test:browser": "npm run build:tests && mocha-headless-chrome -t 360000 -f ./test/browser/index.html -a no-sandbox", "test:browser": "npm run build:tests && mocha-headless-chrome -t 360000 -f ./test/browser/index.html -a no-sandbox",
"test:browser-multiple-tabs": "npm run build:dist && cpy dist/orbitdb.min.js ./test/browser/ --rename=orbitdb.js --flat && cpy node_modules/ipfs/dist/index.min.js ./test/browser --rename=ipfs.js --flat && mocha ./test/browser/concurrent.spec.js",
"build": "npm run build:dist && npm run build:debug", "build": "npm run build:dist && npm run build:debug",
"build:examples": "webpack --config conf/webpack.example.config.js",
"build:dist": "webpack --config conf/webpack.config.js", "build:dist": "webpack --config conf/webpack.config.js",
"build:debug": "webpack --config conf/webpack.debug.config.js", "build:debug": "webpack --config conf/webpack.debug.config.js",
"build:docs": "jsdoc -c ./conf/jsdoc/jsdoc.json -r src/** -d ./docs/api -R ./docs/jsdoc/README.md", "build:docs": "jsdoc -c ./conf/jsdoc/jsdoc.json -r src/** -d ./docs/api -R ./docs/jsdoc/README.md",
@ -76,16 +70,10 @@
], ],
"ignore": [ "ignore": [
"out/**", "out/**",
"examples/**",
"test/fixtures/**", "test/fixtures/**",
"test/browser/**" "test/browser/**"
] ]
}, },
"localMaintainers": [
"haad <haad@haja.io>",
"shamb0t <shams@haja.io>",
"hajamark <mark@haja.io>"
],
"keywords": [ "keywords": [
"crdt", "crdt",
"merkle-crdt", "merkle-crdt",

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual, notStrictEqual } from 'assert' import { strictEqual, deepStrictEqual, notStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import Keystore from '../../src/key-store.js' import Keystore from '../../src/key-store.js'
import Identities from '../../src/identities/identities.js' import Identities from '../../src/identities/identities.js'
@ -54,9 +54,9 @@ describe('IPFSAccessController', function () {
await keystore2.close() await keystore2.close()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
}) })
let accessController let accessController

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual, notStrictEqual } from 'assert' import { strictEqual, deepStrictEqual, notStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import OrbitDB from '../../src/orbitdb.js' import OrbitDB from '../../src/orbitdb.js'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import Keystore from '../../src/key-store.js' import Keystore from '../../src/key-store.js'
@ -53,9 +53,9 @@ describe('OrbitDBAccessController', function () {
await ipfs2.stop() await ipfs2.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
}) })
describe('Default write access', function () { describe('Default write access', function () {

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual } from 'assert' import { strictEqual, deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { Database, KeyStore, Identities } from '../src/index.js' import { Database, KeyStore, Identities } from '../src/index.js'
@ -49,13 +49,13 @@ describe('Database - Replication', function () {
await db1.drop() await db1.drop()
await db1.close() await db1.close()
await rmrf('./orbitdb1') await rimraf('./orbitdb1')
} }
if (db2) { if (db2) {
await db2.drop() await db2.drop()
await db2.close() await db2.close()
await rmrf('./orbitdb2') await rimraf('./orbitdb2')
} }
if (ipfs1) { if (ipfs1) {
@ -70,9 +70,9 @@ describe('Database - Replication', function () {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
}) })
describe('Replicate across peers', () => { describe('Replicate across peers', () => {
@ -171,7 +171,7 @@ describe('Database - Replication', function () {
await db2.drop() await db2.drop()
await db2.close() await db2.close()
await rmrf('./orbitdb2') await rimraf('./orbitdb2')
await db1.addOperation({ op: 'PUT', key: 1, value: 'record 1 on db 1' }) await db1.addOperation({ op: 'PUT', key: 1, value: 'record 1 on db 1' })

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual } from 'assert' import { strictEqual, deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { existsSync } from 'fs' import { existsSync } from 'fs'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
@ -48,12 +48,12 @@ describe('Database', function () {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
await rmrf('./ipfs1') await rimraf('./ipfs1')
}) })
afterEach(async () => { afterEach(async () => {
await rmrf('./orbitdb') await rimraf('./orbitdb')
}) })
it('adds an operation', async () => { it('adds an operation', async () => {
@ -85,7 +85,7 @@ describe('Database', function () {
await headsStorage.close() await headsStorage.close()
await rmrf(headsPath) await rimraf(headsPath)
}) })
it('uses given directory for headsStorage', async () => { it('uses given directory for headsStorage', async () => {
@ -105,8 +105,8 @@ describe('Database', function () {
await headsStorage.close() await headsStorage.close()
await rmrf(headsPath) await rimraf(headsPath)
await rmrf('./custom-directory') await rimraf('./custom-directory')
}) })
it('uses given MemoryStorage for headsStorage', async () => { it('uses given MemoryStorage for headsStorage', async () => {

View File

@ -1,5 +1,5 @@
import { deepStrictEqual, strictEqual, notStrictEqual } from 'assert' import { deepStrictEqual, strictEqual, notStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { KeyStore, Identities } from '../../src/index.js' import { KeyStore, Identities } from '../../src/index.js'
@ -37,9 +37,9 @@ describe('Documents Database', function () {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
await rmrf('./orbitdb') await rimraf('./orbitdb')
await rmrf('./ipfs1') await rimraf('./ipfs1')
}) })
describe('Default index \'_id\'', () => { describe('Default index \'_id\'', () => {

View File

@ -1,5 +1,5 @@
import { deepStrictEqual, strictEqual } from 'assert' import { deepStrictEqual, strictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { KeyStore, Identities } from '../../src/index.js' import { KeyStore, Identities } from '../../src/index.js'
@ -37,9 +37,9 @@ describe('Events Database', function () {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
await rmrf('./orbitdb') await rimraf('./orbitdb')
await rmrf('./ipfs1') await rimraf('./ipfs1')
}) })
beforeEach(async () => { beforeEach(async () => {

View File

@ -1,7 +1,7 @@
import { deepStrictEqual, strictEqual, notStrictEqual } from 'assert' import { deepStrictEqual, strictEqual, notStrictEqual } from 'assert'
import path from 'path' import path from 'path'
import fs from 'fs' import fs from 'fs'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { KeyStore, Identities, MemoryStorage } from '../../src/index.js' import { KeyStore, Identities, MemoryStorage } from '../../src/index.js'
@ -43,9 +43,9 @@ describe('KeyValueIndexed Database', function () {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
await rmrf('./orbitdb') await rimraf('./orbitdb')
await rmrf('./ipfs1') await rimraf('./ipfs1')
}) })
describe('Creating a KeyValueIndexed database', () => { describe('Creating a KeyValueIndexed database', () => {

View File

@ -1,5 +1,5 @@
import { deepStrictEqual, strictEqual, notStrictEqual } from 'assert' import { deepStrictEqual, strictEqual, notStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { KeyStore, Identities } from '../../src/index.js' import { KeyStore, Identities } from '../../src/index.js'
@ -37,9 +37,9 @@ describe('KeyValue Database', function () {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
await rmrf('./orbitdb') await rimraf('./orbitdb')
await rmrf('./ipfs1') await rimraf('./ipfs1')
}) })
describe('Creating a KeyValue database', () => { describe('Creating a KeyValue database', () => {

View File

@ -1,5 +1,5 @@
import { deepStrictEqual } from 'assert' import { deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { KeyStore, Identities } from '../../../src/index.js' import { KeyStore, Identities } from '../../../src/index.js'
@ -55,11 +55,11 @@ describe('Documents Database Replication', function () {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
await rmrf('./orbitdb1') await rimraf('./orbitdb1')
await rmrf('./orbitdb2') await rimraf('./orbitdb2')
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
}) })
beforeEach(async () => { beforeEach(async () => {

View File

@ -1,5 +1,5 @@
import { deepStrictEqual } from 'assert' import { deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { KeyStore, Identities } from '../../../src/index.js' import { KeyStore, Identities } from '../../../src/index.js'
@ -65,11 +65,11 @@ describe('Events Database Replication', function () {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
await rmrf('./orbitdb1') await rimraf('./orbitdb1')
await rmrf('./orbitdb2') await rimraf('./orbitdb2')
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
}) })
afterEach(async () => { afterEach(async () => {

View File

@ -1,5 +1,5 @@
import { deepStrictEqual } from 'assert' import { deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { KeyStore, Identities } from '../../../src/index.js' import { KeyStore, Identities } from '../../../src/index.js'
@ -54,11 +54,11 @@ describe('KeyValueIndexed Database Replication', function () {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
await rmrf('./orbitdb1') await rimraf('./orbitdb1')
await rmrf('./orbitdb2') await rimraf('./orbitdb2')
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
}) })
afterEach(async () => { afterEach(async () => {

View File

@ -1,5 +1,5 @@
import { deepStrictEqual } from 'assert' import { deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { KeyStore, Identities } from '../../../src/index.js' import { KeyStore, Identities } from '../../../src/index.js'
@ -54,11 +54,11 @@ describe('KeyValue Database Replication', function () {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
await rmrf('./orbitdb1') await rimraf('./orbitdb1')
await rmrf('./orbitdb2') await rimraf('./orbitdb2')
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
}) })
afterEach(async () => { afterEach(async () => {

View File

@ -1,5 +1,5 @@
import assert from 'assert' import assert from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
import KeyStore, { signMessage, verifyMessage } from '../../src/key-store.js' import KeyStore, { signMessage, verifyMessage } from '../../src/key-store.js'
@ -19,7 +19,7 @@ describe('Identities', function () {
}) })
after(async () => { after(async () => {
await rmrf(keysPath) await rimraf(keysPath)
}) })
describe('Creating Identities', () => { describe('Creating Identities', () => {

View File

@ -2,7 +2,7 @@ import { strictEqual, deepStrictEqual, deepEqual } from 'assert'
import * as crypto from '@libp2p/crypto' import * as crypto from '@libp2p/crypto'
import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import KeyStore, { signMessage, verifyMessage } from '../src/key-store.js' import KeyStore, { signMessage, verifyMessage } from '../src/key-store.js'
import LevelStorage from '../src/storage/level.js' import LevelStorage from '../src/storage/level.js'
@ -27,7 +27,7 @@ describe('KeyStore', () => {
afterEach(async () => { afterEach(async () => {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
await rmrf(defaultPath) await rimraf(defaultPath)
} }
}) })
@ -169,7 +169,7 @@ describe('KeyStore', () => {
afterEach(async () => { afterEach(async () => {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
await rmrf(defaultPath) await rimraf(defaultPath)
} }
}) })
@ -192,7 +192,7 @@ describe('KeyStore', () => {
afterEach(async () => { afterEach(async () => {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
await rmrf(path) await rimraf(path)
} }
}) })
@ -218,7 +218,7 @@ describe('KeyStore', () => {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
}) })
it('uses default storage using given path to retrieve a key', async () => { it('uses default storage using given path to retrieve a key', async () => {
@ -244,7 +244,7 @@ describe('KeyStore', () => {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
}) })
describe('Signing', () => { describe('Signing', () => {

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual } from 'assert' import { strictEqual, deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import ManifestStore from '../src/manifest-store.js' import ManifestStore from '../src/manifest-store.js'
import config from './config.js' import config from './config.js'
@ -17,7 +17,7 @@ describe('Manifest', () => {
after(async () => { after(async () => {
await manifestStore.close() await manifestStore.close()
await ipfs.stop() await ipfs.stop()
await rmrf(repo) await rimraf(repo)
}) })
it('creates a manifest', async () => { it('creates a manifest', async () => {

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual } from 'assert' import { strictEqual, deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import { Log, Identities, KeyStore } from '../../src/index.js' import { Log, Identities, KeyStore } from '../../src/index.js'
import testKeysPath from '../fixtures/test-keys-path.js' import testKeysPath from '../fixtures/test-keys-path.js'
@ -24,7 +24,7 @@ describe('Log - Append', function () {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
}) })
describe('append', async () => { describe('append', async () => {

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual } from 'assert' import { strictEqual, deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import { Log, Identities, KeyStore } from '../../src/index.js' import { Log, Identities, KeyStore } from '../../src/index.js'
import testKeysPath from '../fixtures/test-keys-path.js' import testKeysPath from '../fixtures/test-keys-path.js'
@ -27,7 +27,7 @@ describe('Log - CRDT', function () {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
}) })
describe('is a CRDT', async () => { describe('is a CRDT', async () => {

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual } from 'assert' import { strictEqual, deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import { Entry, Identities, KeyStore } from '../../src/index.js' import { Entry, Identities, KeyStore } from '../../src/index.js'
import testKeysPath from '../fixtures/test-keys-path.js' import testKeysPath from '../fixtures/test-keys-path.js'
@ -26,7 +26,7 @@ describe('Entry', function () {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
}) })
describe('create', () => { describe('create', () => {

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual } from 'assert' import { strictEqual, deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import { Log, Identities, KeyStore } from '../../src/index.js' import { Log, Identities, KeyStore } from '../../src/index.js'
import testKeysPath from '../fixtures/test-keys-path.js' import testKeysPath from '../fixtures/test-keys-path.js'
@ -28,7 +28,7 @@ describe('Log - Heads', function () {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
}) })
it('finds one head after one entry', async () => { it('finds one head after one entry', async () => {

View File

@ -1,6 +1,6 @@
import { strictEqual, deepStrictEqual } from 'assert' import { strictEqual, deepStrictEqual } from 'assert'
import all from 'it-all' import all from 'it-all'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import { Log, Identities, KeyStore } from '../../src/index.js' import { Log, Identities, KeyStore } from '../../src/index.js'
import LogCreator from './utils/log-creator.js' import LogCreator from './utils/log-creator.js'
@ -32,7 +32,7 @@ describe('Log - Iterator', function () {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
}) })
describe('Basic iterator functionality', async () => { describe('Basic iterator functionality', async () => {

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual } from 'assert' import { strictEqual, deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import { Log, Identities, KeyStore } from '../../src/index.js' import { Log, Identities, KeyStore } from '../../src/index.js'
import testKeysPath from '../fixtures/test-keys-path.js' import testKeysPath from '../fixtures/test-keys-path.js'
@ -25,7 +25,7 @@ describe('Log - Join Concurrent Entries', function () {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
}) })
describe('join ', async () => { describe('join ', async () => {

View File

@ -1,5 +1,5 @@
import { strictEqual, notStrictEqual, deepStrictEqual } from 'assert' import { strictEqual, notStrictEqual, deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import { Log, Identities, KeyStore } from '../../src/index.js' import { Log, Identities, KeyStore } from '../../src/index.js'
import { Clock } from '../../src/oplog/log.js' import { Clock } from '../../src/oplog/log.js'
@ -36,7 +36,7 @@ describe('Log - Join', async function () {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
}) })
beforeEach(async () => { beforeEach(async () => {

View File

@ -8,7 +8,7 @@
// import testKeysPath from '../fixtures/test-keys-path.js' // import testKeysPath from '../fixtures/test-keys-path.js'
// import { config, testAPIs, startIpfs, stopIpfs } from 'orbit-db-test-utils' // import { config, testAPIs, startIpfs, stopIpfs } from 'orbit-db-test-utils'
// const { sync: rmrf } = rimraf // const { sync: rimraf } = rimraf
// const { LastWriteWins } = Sorting // const { LastWriteWins } = Sorting
// const { createIdentity } = Identities // const { createIdentity } = Identities
// const { fromJSON, fromEntryHash, fromEntry, fromMultihash: _fromMultihash } = Log // const { fromJSON, fromEntryHash, fromEntry, fromMultihash: _fromMultihash } = Log
@ -41,7 +41,7 @@
// let keystore // let keystore
// before(async () => { // before(async () => {
// rmrf(identityKeysPath) // rimraf(identityKeysPath)
// await copy(identityKeyFixtures, identityKeysPath) // await copy(identityKeyFixtures, identityKeysPath)
// await copy(signingKeyFixtures, identityKeysPath) // await copy(signingKeyFixtures, identityKeysPath)
@ -59,7 +59,7 @@
// after(async () => { // after(async () => {
// await stopIpfs(ipfsd) // await stopIpfs(ipfsd)
// await keystore.close() // await keystore.close()
// rmrf(identityKeysPath) // rimraf(identityKeysPath)
// }) // })
// describe('fromJSON', async () => { // describe('fromJSON', async () => {

View File

@ -1,5 +1,5 @@
import { notStrictEqual, deepStrictEqual, strictEqual } from 'assert' import { notStrictEqual, deepStrictEqual, strictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import { Log, Entry, Identities, KeyStore, MemoryStorage } from '../../src/index.js' import { Log, Entry, Identities, KeyStore, MemoryStorage } from '../../src/index.js'
import testKeysPath from '../fixtures/test-keys-path.js' import testKeysPath from '../fixtures/test-keys-path.js'
@ -26,7 +26,7 @@ describe('Log', function () {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
}) })
describe('create', async () => { describe('create', async () => {

View File

@ -1,5 +1,5 @@
import { strictEqual } from 'assert' import { strictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import { Log } from '../../src/oplog/index.js' import { Log } from '../../src/oplog/index.js'
import { Identities, KeyStore } from '../../src/index.js' import { Identities, KeyStore } from '../../src/index.js'
@ -25,7 +25,7 @@ describe('Log - References', function () {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
}) })
describe('References', async () => { describe('References', async () => {

View File

@ -1,5 +1,5 @@
import { strictEqual } from 'assert' import { strictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { Log, Entry, Identities, KeyStore, IPFSBlockStorage } from '../../src/index.js' import { Log, Entry, Identities, KeyStore, IPFSBlockStorage } from '../../src/index.js'
@ -57,9 +57,9 @@ describe('Log - Replication', function () {
await storage1.close() await storage1.close()
await storage2.close() await storage2.close()
await rmrf(keysPath) await rimraf(keysPath)
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
}) })
describe('replicates logs deterministically', async function () { describe('replicates logs deterministically', async function () {

View File

@ -1,5 +1,5 @@
import { notStrictEqual, strictEqual } from 'assert' import { notStrictEqual, strictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import { Log, Identities, KeyStore } from '../../src/index.js' import { Log, Identities, KeyStore } from '../../src/index.js'
import testKeysPath from '../fixtures/test-keys-path.js' import testKeysPath from '../fixtures/test-keys-path.js'
@ -26,7 +26,7 @@ describe('Signed Log', function () {
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
}) })
it('creates a signed log', async () => { it('creates a signed log', async () => {

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual, notStrictEqual } from 'assert' import { strictEqual, deepStrictEqual, notStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import OrbitDB from '../src/orbitdb.js' import OrbitDB from '../src/orbitdb.js'
import { IPFSAccessController, OrbitDBAccessController, useAccessController, getAccessController, removeAccessController } from '../src/access-controllers/index.js' import { IPFSAccessController, OrbitDBAccessController, useAccessController, getAccessController, removeAccessController } from '../src/access-controllers/index.js'
@ -41,8 +41,8 @@ describe('Add a custom access controller', function () {
// Remove the added custom database type from OrbitDB import // Remove the added custom database type from OrbitDB import
removeAccessController(type) removeAccessController(type)
await rmrf('./orbitdb') await rimraf('./orbitdb')
await rmrf('./ipfs1') await rimraf('./ipfs1')
}) })
describe('Default supported access controllers', function () { describe('Default supported access controllers', function () {

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual, notStrictEqual } from 'assert' import { strictEqual, deepStrictEqual, notStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { existsSync } from 'fs' import { existsSync } from 'fs'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { getDatabaseType } from '../src/databases/index.js' import { getDatabaseType } from '../src/databases/index.js'
@ -40,8 +40,8 @@ describe('Add a custom database type', function () {
await ipfs.stop() await ipfs.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
await rmrf('./ipfs1') await rimraf('./ipfs1')
}) })
describe('Default supported database types', function () { describe('Default supported database types', function () {

View File

@ -1,5 +1,5 @@
import { deepStrictEqual } from 'assert' import { deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { createOrbitDB, Identities, useIdentityProvider } from '../src/index.js' import { createOrbitDB, Identities, useIdentityProvider } from '../src/index.js'
import config from './config.js' import config from './config.js'
@ -54,7 +54,7 @@ describe('Add a custom identity provider', function () {
await ipfs.stop() await ipfs.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
await rmrf('./ipfs1') await rimraf('./ipfs1')
}) })
}) })

View File

@ -1,5 +1,5 @@
import { strictEqual } from 'assert' import { strictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { createOrbitDB } from '../src/index.js' import { createOrbitDB } from '../src/index.js'
import config from './config.js' import config from './config.js'
@ -19,8 +19,8 @@ describe('Drop databases', function () {
if (ipfs) { if (ipfs) {
await ipfs.stop() await ipfs.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
await rmrf('./ipfs') await rimraf('./ipfs')
}) })
describe('dropping a database', () => { describe('dropping a database', () => {
@ -38,7 +38,7 @@ describe('Drop databases', function () {
if (orbitdb1) { if (orbitdb1) {
await orbitdb1.stop() await orbitdb1.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
}) })
it('returns no entries in the database after dropping it', async () => { it('returns no entries in the database after dropping it', async () => {
@ -101,7 +101,7 @@ describe('Drop databases', function () {
if (orbitdb1) { if (orbitdb1) {
await orbitdb1.stop() await orbitdb1.stop()
} }
await rmrf('./orbitdb1') await rimraf('./orbitdb1')
}) })
it('doesn\'t error when dropping an empty database', async () => { it('doesn\'t error when dropping an empty database', async () => {

View File

@ -1,7 +1,7 @@
import { strictEqual } from 'assert' import { strictEqual } from 'assert'
// import mapSeries from 'p-each-series' // import mapSeries from 'p-each-series'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import OrbitDB from '../src/orbitdb.js' import OrbitDB from '../src/orbitdb.js'
import config from './config.js' import config from './config.js'
import connectPeers from './utils/connect-nodes.js' import connectPeers from './utils/connect-nodes.js'
@ -66,7 +66,7 @@ describe('orbitdb - Multiple Databases', function () {
await orbitdb2.stop() await orbitdb2.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
if (ipfs1) { if (ipfs1) {
await ipfs1.stop() await ipfs1.stop()
@ -75,8 +75,8 @@ describe('orbitdb - Multiple Databases', function () {
await ipfs2.stop() await ipfs2.stop()
} }
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
}) })
beforeEach(async () => { beforeEach(async () => {

View File

@ -1,5 +1,5 @@
import { deepStrictEqual, strictEqual, notStrictEqual } from 'assert' import { deepStrictEqual, strictEqual, notStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import fs from 'fs' import fs from 'fs'
import path from 'path' import path from 'path'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
@ -28,10 +28,10 @@ describe('Open databases', function () {
if (ipfs2) { if (ipfs2) {
await ipfs2.stop() await ipfs2.stop()
} }
await rmrf('./orbitdb1') await rimraf('./orbitdb1')
await rmrf('./orbitdb2') await rimraf('./orbitdb2')
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
}) })
describe('creating a database instance', () => { describe('creating a database instance', () => {
@ -50,7 +50,7 @@ describe('Open databases', function () {
if (orbitdb1) { if (orbitdb1) {
await orbitdb1.stop() await orbitdb1.stop()
} }
await rmrf('./orbitdb1') await rimraf('./orbitdb1')
}) })
it('creates a database instance', async () => { it('creates a database instance', async () => {
@ -157,7 +157,7 @@ describe('Open databases', function () {
if (orbitdb1) { if (orbitdb1) {
await orbitdb1.stop() await orbitdb1.stop()
} }
await rmrf('./orbitdb1') await rimraf('./orbitdb1')
}) })
it('contains the given meta info', async () => { it('contains the given meta info', async () => {
@ -188,7 +188,7 @@ describe('Open databases', function () {
if (orbitdb1) { if (orbitdb1) {
await orbitdb1.stop() await orbitdb1.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
}) })
it('returns all entries in the database', async () => { it('returns all entries in the database', async () => {
@ -247,7 +247,7 @@ describe('Open databases', function () {
if (orbitdb2) { if (orbitdb2) {
await orbitdb2.stop() await orbitdb2.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
}) })
it('returns all entries in the database', async () => { it('returns all entries in the database', async () => {
@ -299,8 +299,8 @@ describe('Open databases', function () {
if (orbitdb2) { if (orbitdb2) {
await orbitdb2.stop() await orbitdb2.stop()
} }
await rmrf('./orbitdb1') await rimraf('./orbitdb1')
await rmrf('./orbitdb2') await rimraf('./orbitdb2')
}) })
it('replicates the database', async () => { it('replicates the database', async () => {
@ -397,7 +397,7 @@ describe('Open databases', function () {
if (orbitdb1) { if (orbitdb1) {
await orbitdb1.stop() await orbitdb1.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
}) })
it('returns all entries in the database', async () => { it('returns all entries in the database', async () => {
@ -448,8 +448,8 @@ describe('Open databases', function () {
if (orbitdb1) { if (orbitdb1) {
await orbitdb1.stop() await orbitdb1.stop()
} }
await rmrf('./index') await rimraf('./index')
await rmrf('./orbitdb') await rimraf('./orbitdb')
}) })
it('returns all entries in the database and in the index', async () => { it('returns all entries in the database and in the index', async () => {
@ -505,7 +505,7 @@ describe('Open databases', function () {
if (orbitdb1) { if (orbitdb1) {
await orbitdb1.stop() await orbitdb1.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
}) })
it('returns all entries in the database', async () => { it('returns all entries in the database', async () => {
@ -545,7 +545,7 @@ describe('Open databases', function () {
if (orbitdb1) { if (orbitdb1) {
await orbitdb1.stop() await orbitdb1.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
}) })
it('returns the database instance when opened with a name multiple times', async () => { it('returns the database instance when opened with a name multiple times', async () => {
@ -576,7 +576,7 @@ describe('Open databases', function () {
if (orbitdb) { if (orbitdb) {
await orbitdb.stop() await orbitdb.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
}) })
it('returns the database instance', async () => { it('returns the database instance', async () => {

View File

@ -1,5 +1,5 @@
import { deepStrictEqual } from 'assert' import { deepStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { createOrbitDB } from '../src/index.js' import { createOrbitDB } from '../src/index.js'
import config from './config.js' import config from './config.js'
@ -23,12 +23,12 @@ describe('Replicating databases', function () {
after(async () => { after(async () => {
await ipfs1.stop() await ipfs1.stop()
await ipfs2.stop() await ipfs2.stop()
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
await orbitdb1.stop() await orbitdb1.stop()
await orbitdb2.stop() await orbitdb2.stop()
await rmrf('./orbitdb1') await rimraf('./orbitdb1')
await rmrf('./orbitdb2') await rimraf('./orbitdb2')
}) })
describe('replicating a database', () => { describe('replicating a database', () => {

View File

@ -1,5 +1,5 @@
import { strictEqual, notStrictEqual } from 'assert' import { strictEqual, notStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import path from 'path' import path from 'path'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import OrbitDB from '../src/orbitdb.js' import OrbitDB from '../src/orbitdb.js'
@ -43,9 +43,9 @@ describe('Write Permissions', function () {
await ipfs2.stop() await ipfs2.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
}) })
it('throws an error if another peer writes to a log with default write access', async () => { it('throws an error if another peer writes to a log with default write access', async () => {

View File

@ -1,5 +1,5 @@
import { strictEqual, notStrictEqual } from 'assert' import { strictEqual, notStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import fs from 'fs' import fs from 'fs'
import path from 'path' import path from 'path'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
@ -28,13 +28,13 @@ describe('OrbitDB', function () {
if (ipfs2) { if (ipfs2) {
await ipfs2.stop() await ipfs2.stop()
} }
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
}) })
describe('OrbitDB instance creation - defaults', () => { describe('OrbitDB instance creation - defaults', () => {
before(async () => { before(async () => {
await rmrf('./orbitdb') await rimraf('./orbitdb')
orbitdb1 = await createOrbitDB({ ipfs: ipfs1 }) orbitdb1 = await createOrbitDB({ ipfs: ipfs1 })
}) })
@ -42,7 +42,7 @@ describe('OrbitDB', function () {
if (orbitdb1) { if (orbitdb1) {
await orbitdb1.stop() await orbitdb1.stop()
} }
await rmrf('./orbitdb') await rimraf('./orbitdb')
}) })
it('has an IPFS instance', async () => { it('has an IPFS instance', async () => {
@ -126,7 +126,7 @@ describe('OrbitDB', function () {
describe('OrbitDB instance creation - user given parameters', () => { describe('OrbitDB instance creation - user given parameters', () => {
before(async () => { before(async () => {
await rmrf('./orbitdb1') await rimraf('./orbitdb1')
orbitdb1 = await createOrbitDB({ ipfs: ipfs1, id: 'user1', directory: './orbitdb1' }) orbitdb1 = await createOrbitDB({ ipfs: ipfs1, id: 'user1', directory: './orbitdb1' })
}) })
@ -134,7 +134,7 @@ describe('OrbitDB', function () {
if (orbitdb1) { if (orbitdb1) {
await orbitdb1.stop() await orbitdb1.stop()
} }
await rmrf('./orbitdb1') await rimraf('./orbitdb1')
}) })
it('has an IPFS instance', async () => { it('has an IPFS instance', async () => {

View File

@ -1,5 +1,5 @@
import { strictEqual, notStrictEqual } from 'assert' import { strictEqual, notStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import { Log, Identities, KeyStore } from '../src/index.js' import { Log, Identities, KeyStore } from '../src/index.js'
@ -35,8 +35,8 @@ describe('Storages', function () {
await keystore.close() await keystore.close()
} }
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf(keysPath) await rimraf(keysPath)
}) })
const runTestWithStorage = async (storage) => { const runTestWithStorage = async (storage) => {

View File

@ -1,5 +1,5 @@
import { deepStrictEqual, strictEqual, notStrictEqual } from 'assert' import { deepStrictEqual, strictEqual, notStrictEqual } from 'assert'
import rmrf from 'rimraf' import { rimraf } from 'rimraf'
import { copy } from 'fs-extra' import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core' import * as IPFS from 'ipfs-core'
import Sync from '../src/sync.js' import Sync from '../src/sync.js'
@ -24,8 +24,8 @@ describe('Sync protocol', function () {
let peerId1, peerId2 let peerId1, peerId2
before(async () => { before(async () => {
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
ipfs1 = await IPFS.create({ ...config.daemon1, repo: './ipfs1' }) ipfs1 = await IPFS.create({ ...config.daemon1, repo: './ipfs1' })
ipfs2 = await IPFS.create({ ...config.daemon2, repo: './ipfs2' }) ipfs2 = await IPFS.create({ ...config.daemon2, repo: './ipfs2' })
@ -45,12 +45,12 @@ describe('Sync protocol', function () {
after(async () => { after(async () => {
await ipfs1.stop() await ipfs1.stop()
await ipfs2.stop() await ipfs2.stop()
await rmrf('./ipfs1') await rimraf('./ipfs1')
await rmrf('./ipfs2') await rimraf('./ipfs2')
if (keystore) { if (keystore) {
await keystore.close() await keystore.close()
} }
await rmrf(keysPath) await rimraf(keysPath)
}) })
describe('Creating an instance', () => { describe('Creating an instance', () => {