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-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
* Status: **in active development**
* Compatible with **ipfs-core versions >= 0.18.0**
This is the Javascript implementation and it works both in **Browsers** and **Node.js** with support for Linux, OS X, and Windows.
***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).
## 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
*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
@ -80,7 +52,7 @@ import { createOrbitDB } from '@orbitdb/core'
const address = db.address
console.log(address)
// "/orbitdb/hash"
// "/orbitdb/zdpuAkstgbTVGHQmMi5TC84auhJ8rL5qoaNEtXo2d5PHXs2To"
// The above address can be used on another peer to open the same database
// Listen for updates from peers
@ -110,7 +82,7 @@ Use the **[Getting Started](https://github.com/orbitdb/orbitdb/blob/main/docs/GE
### 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
@ -163,7 +135,7 @@ The development of OrbitDB has been sponsored by:
* [Maintainer Mountaineer](https://maintainer.io)
* [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

View File

@ -1,7 +1,7 @@
import { Identities, Log } from '../src/index.js'
import { MemoryStorage } 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
let log

View File

@ -1,7 +1,7 @@
import { Identities, Log } from '../src/index.js'
import { MemoryStorage } 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 () => {
console.log('Starting benchmark...')

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<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/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: {
fs: '{ existsSync: () => true }',
'fs-extra': '{ copy: () => {} }',
rimraf: '() => {}'
rimraf: '{ rimraf: () => {} }'
},
plugins: [
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:
```sh
npm i @orbitdb/core@next
npm i @orbitdb/core
```
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
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:
```bash
npm install @orbitdb/core@next
npm install @orbitdb/core
```
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",
"version": "0.31.0",
"version": "1.0.0",
"description": "Distributed p2p database on IPFS",
"author": "Haad",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/orbitdb/orbit-db"
"url": "https://github.com/orbitdb/orbitdb"
},
"engines": {
"node": ">=16.0.0"
@ -18,48 +18,42 @@
"type": "module",
"main": "src/index.js",
"dependencies": {
"@ipld/dag-cbor": "^9.0.0",
"@libp2p/crypto": "^1.0.12",
"it-pipe": "^2.0.5",
"@ipld/dag-cbor": "^9.0.5",
"@libp2p/crypto": "^2.0.4",
"it-pipe": "^3.0.1",
"level": "^8.0.0",
"lru": "^3.1.0",
"multiformats": "^11.0.1",
"p-queue": "^7.3.4",
"multiformats": "^12.1.1",
"p-queue": "^7.4.1",
"timeout-abort-controller": "^3.0.0",
"uint8arrays": "^4.0.3"
"uint8arrays": "^4.0.6"
},
"devDependencies": {
"@libp2p/webrtc-star-signalling-server": "^3.0.0",
"assert": "^2.0.0",
"babel-loader": "^9.1.2",
"c8": "^7.13.0",
"@libp2p/webrtc-star-signalling-server": "^4.0.0",
"assert": "^2.1.0",
"babel-loader": "^9.1.3",
"c8": "^8.0.1",
"cross-env": "^7.0.3",
"fs-extra": "^11.1.0",
"fs-extra": "^11.1.1",
"ipfs-core": "^0.18.0",
"it-all": "^2.0.0",
"it-all": "^3.0.3",
"jsdoc": "^4.0.2",
"mocha": "^10.2.0",
"mocha-headless-chrome": "^4.0.0",
"open-cli": "^7.1.0",
"open-cli": "^7.2.0",
"path-browserify": "^1.0.1",
"rimraf": "^4.1.3",
"standard": "^17.0.0",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
"rimraf": "^5.0.1",
"standard": "^17.1.0",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
},
"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 .",
"test:all": "npm run test:browser-multiple-tabs && npm run test",
"test": "cross-env 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-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:examples": "webpack --config conf/webpack.example.config.js",
"build:dist": "webpack --config conf/webpack.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",
@ -76,16 +70,10 @@
],
"ignore": [
"out/**",
"examples/**",
"test/fixtures/**",
"test/browser/**"
]
},
"localMaintainers": [
"haad <haad@haja.io>",
"shamb0t <shams@haja.io>",
"hajamark <mark@haja.io>"
],
"keywords": [
"crdt",
"merkle-crdt",

View File

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

View File

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

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual } from 'assert'
import rmrf from 'rimraf'
import { rimraf } from 'rimraf'
import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core'
import { Database, KeyStore, Identities } from '../src/index.js'
@ -49,13 +49,13 @@ describe('Database - Replication', function () {
await db1.drop()
await db1.close()
await rmrf('./orbitdb1')
await rimraf('./orbitdb1')
}
if (db2) {
await db2.drop()
await db2.close()
await rmrf('./orbitdb2')
await rimraf('./orbitdb2')
}
if (ipfs1) {
@ -70,9 +70,9 @@ describe('Database - Replication', function () {
await keystore.close()
}
await rmrf(keysPath)
await rmrf('./ipfs1')
await rmrf('./ipfs2')
await rimraf(keysPath)
await rimraf('./ipfs1')
await rimraf('./ipfs2')
})
describe('Replicate across peers', () => {
@ -171,7 +171,7 @@ describe('Database - Replication', function () {
await db2.drop()
await db2.close()
await rmrf('./orbitdb2')
await rimraf('./orbitdb2')
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 rmrf from 'rimraf'
import { rimraf } from 'rimraf'
import { existsSync } from 'fs'
import { copy } from 'fs-extra'
import * as IPFS from 'ipfs-core'
@ -48,12 +48,12 @@ describe('Database', function () {
await keystore.close()
}
await rmrf(keysPath)
await rmrf('./ipfs1')
await rimraf(keysPath)
await rimraf('./ipfs1')
})
afterEach(async () => {
await rmrf('./orbitdb')
await rimraf('./orbitdb')
})
it('adds an operation', async () => {
@ -85,7 +85,7 @@ describe('Database', function () {
await headsStorage.close()
await rmrf(headsPath)
await rimraf(headsPath)
})
it('uses given directory for headsStorage', async () => {
@ -105,8 +105,8 @@ describe('Database', function () {
await headsStorage.close()
await rmrf(headsPath)
await rmrf('./custom-directory')
await rimraf(headsPath)
await rimraf('./custom-directory')
})
it('uses given MemoryStorage for headsStorage', async () => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
import { strictEqual, deepStrictEqual, notStrictEqual } from 'assert'
import rmrf from 'rimraf'
import { rimraf } from 'rimraf'
import * as IPFS from 'ipfs-core'
import OrbitDB from '../src/orbitdb.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
removeAccessController(type)
await rmrf('./orbitdb')
await rmrf('./ipfs1')
await rimraf('./orbitdb')
await rimraf('./ipfs1')
})
describe('Default supported access controllers', function () {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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