mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
Merge pull request #712 from dreamnettech/feature/windows-support
Add Windows support.
This commit is contained in:
commit
186a46a1c4
3
.gitignore
vendored
3
.gitignore
vendored
@ -21,3 +21,6 @@ examples/browser/lib
|
||||
# Don't track builds in git
|
||||
# Distribution builds are available via npm
|
||||
dist/
|
||||
|
||||
# Don't track Visual Studio Code settings
|
||||
.vscode
|
559
package-lock.json
generated
559
package-lock.json
generated
@ -447,6 +447,22 @@
|
||||
"@hapi/hoek": "8.x.x"
|
||||
}
|
||||
},
|
||||
"@mrmlnc/readdir-enhanced": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz",
|
||||
"integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"call-me-maybe": "^1.0.1",
|
||||
"glob-to-regexp": "^0.3.0"
|
||||
}
|
||||
},
|
||||
"@nodelib/fs.stat": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz",
|
||||
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==",
|
||||
"dev": true
|
||||
},
|
||||
"@octokit/endpoint": {
|
||||
"version": "5.3.6",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.3.6.tgz",
|
||||
@ -556,6 +572,29 @@
|
||||
"defer-to-connect": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"@types/events": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz",
|
||||
"integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/glob": {
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz",
|
||||
"integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/events": "*",
|
||||
"@types/minimatch": "*",
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/minimatch": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
|
||||
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "10.14.20",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.20.tgz",
|
||||
@ -1111,6 +1150,21 @@
|
||||
"es-abstract": "^1.7.0"
|
||||
}
|
||||
},
|
||||
"array-union": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
|
||||
"integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"array-uniq": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"array-uniq": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
|
||||
"integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=",
|
||||
"dev": true
|
||||
},
|
||||
"array-unique": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz",
|
||||
@ -2746,6 +2800,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"call-me-maybe": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz",
|
||||
"integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=",
|
||||
"dev": true
|
||||
},
|
||||
"callbackify": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/callbackify/-/callbackify-1.1.0.tgz",
|
||||
@ -3399,6 +3459,53 @@
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
||||
},
|
||||
"cp-file": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/cp-file/-/cp-file-6.2.0.tgz",
|
||||
"integrity": "sha512-fmvV4caBnofhPe8kOcitBwSn2f39QLjnAnGq3gO9dfd75mUytzKNZB1hde6QHunW2Rt+OwuBOMc3i1tNElbszA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"make-dir": "^2.0.0",
|
||||
"nested-error-stacks": "^2.0.0",
|
||||
"pify": "^4.0.1",
|
||||
"safe-buffer": "^5.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"make-dir": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz",
|
||||
"integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"pify": "^4.0.1",
|
||||
"semver": "^5.6.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cpy": {
|
||||
"version": "7.3.0",
|
||||
"resolved": "https://registry.npmjs.org/cpy/-/cpy-7.3.0.tgz",
|
||||
"integrity": "sha512-auvDu6h/J+cO1uqV40ymL/VoPM0+qPpNGaNttTzkYVXO/+GeynuyAK/MwFcWgU/P82ezcZw7RaN34CIIWajKLA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"arrify": "^1.0.1",
|
||||
"cp-file": "^6.1.0",
|
||||
"globby": "^9.2.0",
|
||||
"nested-error-stacks": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"cpy-cli": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cpy-cli/-/cpy-cli-2.0.0.tgz",
|
||||
"integrity": "sha512-LzrtY3lBWvFZcw4lXgkEbbDUd7y78juC3C5l7gj3UyezMEZF0Be9fjCVLN1HoZAzdMDeC3KHehWpHBJvgVAPkw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cpy": "^7.0.0",
|
||||
"meow": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"crdts": {
|
||||
"version": "0.1.5",
|
||||
"resolved": "https://registry.npmjs.org/crdts/-/crdts-0.1.5.tgz",
|
||||
@ -3439,6 +3546,58 @@
|
||||
"sha.js": "^2.4.8"
|
||||
}
|
||||
},
|
||||
"cross-env": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-6.0.3.tgz",
|
||||
"integrity": "sha512-+KqxF6LCvfhWvADcDPqo64yVIB31gv/jQulX2NGzKS/g3GEVz6/pt4wjHFtFWsHMddebWD/sDthJemzM4MaAag==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cross-spawn": "^7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"cross-spawn": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.1.tgz",
|
||||
"integrity": "sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-key": "^3.1.0",
|
||||
"shebang-command": "^2.0.0",
|
||||
"which": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"path-key": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.0.tgz",
|
||||
"integrity": "sha512-8cChqz0RP6SHJkMt48FW0A7+qUOn+OsnOsVtzI59tZ8m+5bCSk7hzwET0pulwOM2YMn9J1efb07KB9l9f30SGg==",
|
||||
"dev": true
|
||||
},
|
||||
"shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"shebang-regex": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"shebang-regex": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||
"dev": true
|
||||
},
|
||||
"which": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.1.tgz",
|
||||
"integrity": "sha512-N7GBZOTswtB9lkQBZA4+zAXrjEIWAUOB93AvzUiudRzRxhUdLURQ7D/gAIMY1gatT/LTbmbcv8SiYazy3eYB7w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"isexe": "^2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cross-spawn": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
|
||||
@ -4052,6 +4211,32 @@
|
||||
"randombytes": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"dir-glob": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz",
|
||||
"integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-type": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"path-type": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz",
|
||||
"integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"pify": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"pify": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
|
||||
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"dlv": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
|
||||
@ -5123,6 +5308,332 @@
|
||||
"integrity": "sha1-hDWpqqAteSSNF9cE52JZMB2ZKAo=",
|
||||
"dev": true
|
||||
},
|
||||
"fast-glob": {
|
||||
"version": "2.2.7",
|
||||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz",
|
||||
"integrity": "sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@mrmlnc/readdir-enhanced": "^2.2.1",
|
||||
"@nodelib/fs.stat": "^1.1.2",
|
||||
"glob-parent": "^3.1.0",
|
||||
"is-glob": "^4.0.0",
|
||||
"merge2": "^1.2.3",
|
||||
"micromatch": "^3.1.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"arr-diff": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
|
||||
"integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=",
|
||||
"dev": true
|
||||
},
|
||||
"array-unique": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
|
||||
"integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=",
|
||||
"dev": true
|
||||
},
|
||||
"braces": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
|
||||
"integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"arr-flatten": "^1.1.0",
|
||||
"array-unique": "^0.3.2",
|
||||
"extend-shallow": "^2.0.1",
|
||||
"fill-range": "^4.0.0",
|
||||
"isobject": "^3.0.1",
|
||||
"repeat-element": "^1.1.2",
|
||||
"snapdragon": "^0.8.1",
|
||||
"snapdragon-node": "^2.0.1",
|
||||
"split-string": "^3.0.2",
|
||||
"to-regex": "^3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"extend-shallow": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
||||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extendable": "^0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"expand-brackets": {
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
|
||||
"integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"debug": "^2.3.3",
|
||||
"define-property": "^0.2.5",
|
||||
"extend-shallow": "^2.0.1",
|
||||
"posix-character-classes": "^0.1.0",
|
||||
"regex-not": "^1.0.0",
|
||||
"snapdragon": "^0.8.1",
|
||||
"to-regex": "^3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"define-property": {
|
||||
"version": "0.2.5",
|
||||
"resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
|
||||
"integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-descriptor": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"extend-shallow": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
||||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extendable": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"is-accessor-descriptor": {
|
||||
"version": "0.1.6",
|
||||
"resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz",
|
||||
"integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"kind-of": "^3.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"kind-of": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
|
||||
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-buffer": "^1.1.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"is-data-descriptor": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz",
|
||||
"integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"kind-of": "^3.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"kind-of": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
|
||||
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-buffer": "^1.1.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"is-descriptor": {
|
||||
"version": "0.1.6",
|
||||
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
|
||||
"integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-accessor-descriptor": "^0.1.6",
|
||||
"is-data-descriptor": "^0.1.4",
|
||||
"kind-of": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"kind-of": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
|
||||
"integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"extglob": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz",
|
||||
"integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"array-unique": "^0.3.2",
|
||||
"define-property": "^1.0.0",
|
||||
"expand-brackets": "^2.1.4",
|
||||
"extend-shallow": "^2.0.1",
|
||||
"fragment-cache": "^0.2.1",
|
||||
"regex-not": "^1.0.0",
|
||||
"snapdragon": "^0.8.1",
|
||||
"to-regex": "^3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"define-property": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
|
||||
"integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-descriptor": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"extend-shallow": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
||||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extendable": "^0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"fill-range": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
|
||||
"integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"extend-shallow": "^2.0.1",
|
||||
"is-number": "^3.0.0",
|
||||
"repeat-string": "^1.6.1",
|
||||
"to-regex-range": "^2.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"extend-shallow": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
||||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extendable": "^0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"glob-parent": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
|
||||
"integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-glob": "^3.1.0",
|
||||
"path-dirname": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-glob": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz",
|
||||
"integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extglob": "^2.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"is-accessor-descriptor": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
|
||||
"integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"kind-of": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"is-data-descriptor": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
|
||||
"integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"kind-of": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"is-descriptor": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
|
||||
"integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-accessor-descriptor": "^1.0.0",
|
||||
"is-data-descriptor": "^1.0.0",
|
||||
"kind-of": "^6.0.2"
|
||||
}
|
||||
},
|
||||
"is-extglob": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||
"integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
|
||||
"dev": true
|
||||
},
|
||||
"is-glob": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
|
||||
"integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extglob": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"is-number": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
|
||||
"integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"kind-of": "^3.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"kind-of": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
|
||||
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-buffer": "^1.1.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"isobject": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
|
||||
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
|
||||
"dev": true
|
||||
},
|
||||
"kind-of": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
|
||||
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
|
||||
"dev": true
|
||||
},
|
||||
"micromatch": {
|
||||
"version": "3.1.10",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
|
||||
"integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"arr-diff": "^4.0.0",
|
||||
"array-unique": "^0.3.2",
|
||||
"braces": "^2.3.1",
|
||||
"define-property": "^2.0.2",
|
||||
"extend-shallow": "^3.0.2",
|
||||
"extglob": "^2.0.4",
|
||||
"fragment-cache": "^0.2.1",
|
||||
"kind-of": "^6.0.2",
|
||||
"nanomatch": "^1.2.9",
|
||||
"object.pick": "^1.3.0",
|
||||
"regex-not": "^1.0.0",
|
||||
"snapdragon": "^0.8.1",
|
||||
"to-regex": "^3.0.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"fast-json-stable-stringify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
||||
@ -6982,6 +7493,12 @@
|
||||
"is-glob": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"glob-to-regexp": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz",
|
||||
"integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=",
|
||||
"dev": true
|
||||
},
|
||||
"global-dirs": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz",
|
||||
@ -7038,6 +7555,36 @@
|
||||
"integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==",
|
||||
"dev": true
|
||||
},
|
||||
"globby": {
|
||||
"version": "9.2.0",
|
||||
"resolved": "https://registry.npmjs.org/globby/-/globby-9.2.0.tgz",
|
||||
"integrity": "sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/glob": "^7.1.1",
|
||||
"array-union": "^1.0.2",
|
||||
"dir-glob": "^2.2.2",
|
||||
"fast-glob": "^2.2.6",
|
||||
"glob": "^7.1.3",
|
||||
"ignore": "^4.0.3",
|
||||
"pify": "^4.0.1",
|
||||
"slash": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ignore": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
|
||||
"integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
|
||||
"dev": true
|
||||
},
|
||||
"slash": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz",
|
||||
"integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"go-ipfs-dep": {
|
||||
"version": "0.4.22",
|
||||
"resolved": "https://registry.npmjs.org/go-ipfs-dep/-/go-ipfs-dep-0.4.22.tgz",
|
||||
@ -11479,6 +12026,12 @@
|
||||
"is-plain-obj": "^1.1"
|
||||
}
|
||||
},
|
||||
"merge2": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.3.0.tgz",
|
||||
"integrity": "sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw==",
|
||||
"dev": true
|
||||
},
|
||||
"merkle-lib": {
|
||||
"version": "2.0.10",
|
||||
"resolved": "https://registry.npmjs.org/merkle-lib/-/merkle-lib-2.0.10.tgz",
|
||||
@ -12119,6 +12672,12 @@
|
||||
"integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==",
|
||||
"dev": true
|
||||
},
|
||||
"nested-error-stacks": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.1.0.tgz",
|
||||
"integrity": "sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug==",
|
||||
"dev": true
|
||||
},
|
||||
"nice-try": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
|
||||
|
14
package.json
14
package.json
@ -40,6 +40,8 @@
|
||||
"babel-plugin-transform-runtime": "^6.23.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"cpy-cli": "^2.0.0",
|
||||
"cross-env": "^6.0.3",
|
||||
"datastore-level": "0.10.0",
|
||||
"fs-extra": "^7.0.1",
|
||||
"go-ipfs-dep": "~0.4.20",
|
||||
@ -48,6 +50,7 @@
|
||||
"ipfsd-ctl": "~0.42.3",
|
||||
"localstorage-level-migration": "~0.1.0",
|
||||
"markdown-toc": "^1.2.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mocha": "^5.2.0",
|
||||
"p-each-series": "^1.0.0",
|
||||
"p-map": "^1.2.0",
|
||||
@ -68,14 +71,15 @@
|
||||
"examples:node": "node examples/eventlog.js",
|
||||
"examples:browser-macos": "open examples/browser/browser.html",
|
||||
"examples:browser-linux": "xdg-open examples/browser/browser.html",
|
||||
"examples:browser-windows": "start examples/browser/browser.html",
|
||||
"lint:docs": "remark -qf -u validate-links .",
|
||||
"test:all": "npm run test:browser-multiple-tabs && npm run test",
|
||||
"test": "TEST=all mocha",
|
||||
"test:browser-multiple-tabs": "npm run build:dist && cp dist/orbitdb.min.js ./test/browser/orbitdb.js && cp node_modules/ipfs/dist/index.js ./test/browser/ipfs.js && cp node_modules/orbit-db-identity-provider/dist/index-browser.min.js ./test/browser/identities.js && cp node_modules/ipfs-log/dist/ipfslog.min.js ./test/browser/ipfslog.min.js && mocha ./test/browser/concurrent.spec.js",
|
||||
"test": "cross-env TEST=all mocha",
|
||||
"test:browser-multiple-tabs": "npm run build:dist && cpy dist/orbitdb.min.js ./test/browser/orbitdb.js && cpy node_modules/ipfs/dist/index.js ./test/browser/ipfs.js && cpy node_modules/orbit-db-identity-provider/dist/index-browser.min.js ./test/browser/identities.js && cpy node_modules/ipfs-log/dist/ipfslog.min.js ./test/browser/ipfslog.min.js && mocha ./test/browser/concurrent.spec.js",
|
||||
"build": "npm run build:es5 && npm run build:debug && npm run build:dist && npm run build:examples && npm run build:docs/toc",
|
||||
"build:examples": "webpack --config conf/webpack.example.config.js --sort-modules-by size && mkdir -p examples/browser/lib && cp node_modules/ipfs/dist/index.js examples/browser/lib/ipfs.js",
|
||||
"build:dist": "webpack --config conf/webpack.config.js --sort-modules-by size && mkdir -p examples/browser/lib && cp dist/orbitdb.min.js examples/browser/lib/orbitdb.min.js",
|
||||
"build:debug": "webpack --config conf/webpack.debug.config.js --sort-modules-by size && mkdir -p examples/browser/lib && cp dist/orbitdb.js examples/browser/lib/orbitdb.js && cp dist/orbitdb.js.map examples/browser/lib/orbitdb.js.map",
|
||||
"build:examples": "webpack --config conf/webpack.example.config.js --sort-modules-by size && mkdirp examples/browser/lib && cpy node_modules/ipfs/dist/index.js examples/browser/lib/ipfs.js",
|
||||
"build:dist": "webpack --config conf/webpack.config.js --sort-modules-by size && mkdirp examples/browser/lib && cpy dist/orbitdb.min.js examples/browser/lib/orbitdb.min.js",
|
||||
"build:debug": "webpack --config conf/webpack.debug.config.js --sort-modules-by size && mkdirp examples/browser/lib && cpy dist/orbitdb.js examples/browser/lib/orbitdb.js && cpy dist/orbitdb.js.map examples/browser/lib/orbitdb.js.map",
|
||||
"build:docs/toc": "markdown-toc --no-first1 -i README.md && markdown-toc --no-first1 -i API.md && markdown-toc --no-first1 -i GUIDE.md && markdown-toc --no-first1 -i CHANGELOG.md && markdown-toc --no-first1 -i FAQ.md ",
|
||||
"build:es5": "babel src --out-dir ./dist/es5/ --presets babel-preset-env --plugins babel-plugin-transform-runtime"
|
||||
},
|
||||
|
@ -23,12 +23,12 @@ const logger = Logger.create('orbit-db')
|
||||
Logger.setLogLevel('ERROR')
|
||||
|
||||
// Mapping for 'database type' -> Class
|
||||
let databaseTypes = {
|
||||
'counter': CounterStore,
|
||||
'eventlog': EventStore,
|
||||
'feed': FeedStore,
|
||||
'docstore': DocumentStore,
|
||||
'keyvalue': KeyValueStore
|
||||
const databaseTypes = {
|
||||
counter: CounterStore,
|
||||
eventlog: EventStore,
|
||||
feed: FeedStore,
|
||||
docstore: DocumentStore,
|
||||
keyvalue: KeyValueStore
|
||||
}
|
||||
|
||||
class OrbitDB {
|
||||
@ -67,7 +67,7 @@ class OrbitDB {
|
||||
if (!options.directory) { options.directory = './orbitdb' }
|
||||
|
||||
if (!options.storage) {
|
||||
let storageOptions = {}
|
||||
const storageOptions = {}
|
||||
|
||||
// Create default `level` store
|
||||
options.storage = Storage(null, storageOptions)
|
||||
@ -79,7 +79,7 @@ class OrbitDB {
|
||||
|
||||
if (!options.keystore) {
|
||||
const keystorePath = path.join(options.directory, id, '/keystore')
|
||||
let keyStorage = await options.storage.createStore(keystorePath)
|
||||
const keyStorage = await options.storage.createStore(keystorePath)
|
||||
options.keystore = new Keystore(keyStorage)
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ class OrbitDB {
|
||||
|
||||
if (!options.cache) {
|
||||
const cachePath = path.join(options.directory, id, '/cache')
|
||||
let cacheStorage = await options.storage.createStore(cachePath)
|
||||
const cacheStorage = await options.storage.createStore(cachePath)
|
||||
options.cache = new Cache(cacheStorage)
|
||||
}
|
||||
|
||||
@ -144,13 +144,13 @@ class OrbitDB {
|
||||
|
||||
// Close all open databases
|
||||
const databases = Object.values(this.stores)
|
||||
for (let db of databases) {
|
||||
for (const db of databases) {
|
||||
await db.close()
|
||||
delete this.stores[db.address.toString()]
|
||||
}
|
||||
|
||||
const caches = Object.keys(this.caches)
|
||||
for (let directory of caches) {
|
||||
for (const directory of caches) {
|
||||
await this.caches[directory].cache.close()
|
||||
delete this.caches[directory]
|
||||
}
|
||||
@ -179,7 +179,7 @@ class OrbitDB {
|
||||
}
|
||||
|
||||
async _createCache (path) {
|
||||
let cacheStorage = await this.storage.createStore(path)
|
||||
const cacheStorage = await this.storage.createStore(path)
|
||||
return new Cache(cacheStorage)
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ class OrbitDB {
|
||||
async _determineAddress (name, type, options = {}) {
|
||||
if (!OrbitDB.isValidType(type)) { throw new Error(`Invalid database type '${type}'`) }
|
||||
|
||||
if (OrbitDBAddress.isValid(name)) { throw new Error(`Given database name is an address. Please give only the name of the database!`) }
|
||||
if (OrbitDBAddress.isValid(name)) { throw new Error('Given database name is an address. Please give only the name of the database!') }
|
||||
|
||||
// Create an AccessController, use IPFS AC as the default
|
||||
options.accessController = Object.assign({}, { name: name, type: 'ipfs' }, options.accessController)
|
||||
@ -310,7 +310,7 @@ class OrbitDB {
|
||||
const manifestHash = await createDBManifest(this._ipfs, name, type, accessControllerAddress, options)
|
||||
|
||||
// Create the database address
|
||||
return OrbitDBAddress.parse(path.join('/orbitdb', manifestHash, name))
|
||||
return OrbitDBAddress.parse(OrbitDBAddress.join(manifestHash, name))
|
||||
}
|
||||
|
||||
/* Create and Open databases */
|
||||
@ -322,7 +322,7 @@ class OrbitDB {
|
||||
}
|
||||
*/
|
||||
async create (name, type, options = {}) {
|
||||
logger.debug(`create()`)
|
||||
logger.debug('create()')
|
||||
|
||||
logger.debug(`Creating database '${name}' as ${type}`)
|
||||
|
||||
@ -377,7 +377,7 @@ class OrbitDB {
|
||||
}
|
||||
*/
|
||||
async open (address, options = {}) {
|
||||
logger.debug(`open()`)
|
||||
logger.debug('open()')
|
||||
|
||||
options = Object.assign({ localOnly: false, create: false }, options)
|
||||
logger.debug(`Open database '${address}'`)
|
||||
@ -385,7 +385,7 @@ class OrbitDB {
|
||||
// If address is just the name of database, check the options to crate the database
|
||||
if (!OrbitDBAddress.isValid(address)) {
|
||||
if (!options.create) {
|
||||
throw new Error(`'options.create' set to 'false'. If you want to create a database, set 'options.create' to 'true'.`)
|
||||
throw new Error('\'options.create\' set to \'false\'. If you want to create a database, set \'options.create\' to \'true\'.')
|
||||
} else if (options.create && !options.type) {
|
||||
throw new Error(`Database type not provided! Provide a type with 'options.type' (${OrbitDB.databaseTypes.join('|')})`)
|
||||
} else {
|
||||
|
@ -6,7 +6,7 @@ const createDBManifest = async (ipfs, name, type, accessControllerAddress, optio
|
||||
const manifest = Object.assign({
|
||||
name: name,
|
||||
type: type,
|
||||
accessController: path.join('/ipfs', accessControllerAddress)
|
||||
accessController: (path.posix || path).join('/ipfs', accessControllerAddress)
|
||||
},
|
||||
// meta field is only added to manifest if options.meta is defined
|
||||
options.meta !== undefined ? { meta: options.meta } : {}
|
||||
|
@ -12,7 +12,7 @@ async function migrate (OrbitDB, options, dbAddress) {
|
||||
let oldStore
|
||||
|
||||
if (!oldCache) {
|
||||
const addr = path.join(OrbitDB.directory, dbAddress.root, dbAddress.path)
|
||||
const addr = (path.posix || path).join(OrbitDB.directory, dbAddress.root, dbAddress.path)
|
||||
if (fs && fs.existsSync && !fs.existsSync(addr)) return
|
||||
oldStore = await OrbitDB.storage.createStore(addr)
|
||||
oldCache = new Cache(oldStore)
|
||||
@ -29,7 +29,7 @@ async function migrate (OrbitDB, options, dbAddress) {
|
||||
'queue'
|
||||
]
|
||||
|
||||
for (let i in migrationKeys) {
|
||||
for (const i in migrationKeys) {
|
||||
try {
|
||||
const key = path.join(keyRoot, migrationKeys[i])
|
||||
const val = await oldCache.get(migrationKeys[i])
|
||||
|
@ -11,10 +11,12 @@ class OrbitDBAddress {
|
||||
}
|
||||
|
||||
toString () {
|
||||
return path.join('/orbitdb', this.root, this.path)
|
||||
return OrbitDBAddress.join(this.root, this.path)
|
||||
}
|
||||
|
||||
static isValid (address) {
|
||||
address = address.toString().replace(/\\/g, '/')
|
||||
|
||||
const containsProtocolPrefix = (e, i) => !((i === 0 || i === 1) && address.toString().indexOf('/orbit') === 0 && e === 'orbitdb')
|
||||
|
||||
const parts = address.toString()
|
||||
@ -40,6 +42,8 @@ class OrbitDBAddress {
|
||||
|
||||
if (!OrbitDBAddress.isValid(address)) { throw new Error(`Not a valid OrbitDB address: ${address}`) }
|
||||
|
||||
address = address.toString().replace(/\\/g, '/')
|
||||
|
||||
const parts = address.toString()
|
||||
.split('/')
|
||||
.filter((e, i) => !((i === 0 || i === 1) && address.toString().indexOf('/orbit') === 0 && e === 'orbitdb'))
|
||||
@ -47,6 +51,10 @@ class OrbitDBAddress {
|
||||
|
||||
return new OrbitDBAddress(parts[0], parts.slice(1, parts.length).join('/'))
|
||||
}
|
||||
|
||||
static join (...paths) {
|
||||
return (path.posix || path).join('/orbitdb', ...paths)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = OrbitDBAddress
|
||||
|
@ -3,10 +3,10 @@
|
||||
<title>Break OrbitDB</title>
|
||||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
|
||||
<meta content="utf-8" http-equiv="encoding">
|
||||
<script type="text/javascript" src="orbitdb.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="ipfs.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="identities.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="ipfslog.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="orbitdb.js/orbitdb.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="ipfs.js/index.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="identities.js/index-browser.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="ipfslog.min.js/ipfslog.min.js" charset="utf-8"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div style="padding: 0px 0px 25px 0px;">
|
||||
|
@ -26,7 +26,8 @@ const migrationFixturePath = './test/fixtures/migration/cache-schema-test'
|
||||
const ipfsFixturesDir = './test/fixtures/ipfs'
|
||||
|
||||
Object.keys(testAPIs).forEach(API => {
|
||||
describe(`orbit-db - Create & Open (${API})`, function() {
|
||||
describe(`orbit-db - Create & Open (${API})`, function () {
|
||||
this.retries(1) // windows...
|
||||
this.timeout(config.timeout)
|
||||
|
||||
let ipfsd, ipfs, orbitdb, db, address
|
||||
@ -38,21 +39,27 @@ Object.keys(testAPIs).forEach(API => {
|
||||
rmrf.sync(dbPath)
|
||||
ipfsd = await startIpfs(API, config.daemon1)
|
||||
ipfs = ipfsd.api
|
||||
|
||||
const filterFunc = (src, dest) => {
|
||||
// windows has problems copying these files...
|
||||
return !(src.includes('LOG') || src.includes('LOCK'))
|
||||
}
|
||||
|
||||
await fs.copy(path.join(ipfsFixturesDir, 'blocks'), path.join(ipfsd.path, 'blocks'))
|
||||
await fs.copy(path.join(ipfsFixturesDir, 'datastore'), path.join(ipfsd.path, 'datastore'))
|
||||
await fs.copy(path.join(ipfsFixturesDir, 'datastore'), path.join(ipfsd.path, 'datastore'), { filter: filterFunc })
|
||||
orbitdb = await OrbitDB.createInstance(ipfs, { directory: dbPath })
|
||||
})
|
||||
|
||||
after(async () => {
|
||||
if(orbitdb)
|
||||
if (orbitdb)
|
||||
await orbitdb.stop()
|
||||
|
||||
if (ipfsd)
|
||||
await stopIpfs(ipfsd)
|
||||
})
|
||||
|
||||
describe('Create', function() {
|
||||
describe('Errors', function() {
|
||||
describe('Create', function () {
|
||||
describe('Errors', function () {
|
||||
it('throws an error if given an invalid database type', async () => {
|
||||
let err
|
||||
try {
|
||||
@ -97,7 +104,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('Success', function() {
|
||||
describe('Success', function () {
|
||||
before(async () => {
|
||||
db = await orbitdb.create('second', 'feed', { replicate: false })
|
||||
localDataPath = path.join(dbPath, orbitdb.id, 'cache')
|
||||
@ -122,14 +129,14 @@ Object.keys(testAPIs).forEach(API => {
|
||||
const address = db.id
|
||||
const manifestHash = address.split('/')[2]
|
||||
await db._cache._store.open()
|
||||
const value = await db._cache.get(address + '/_manifest')
|
||||
const value = await db._cache.get(path.join(address, '/_manifest'))
|
||||
assert.equal(value, manifestHash)
|
||||
})
|
||||
|
||||
it('saves database manifest file locally', async () => {
|
||||
const manifestHash = db.id.split('/')[2]
|
||||
const manifest = await io.read(ipfs, manifestHash)
|
||||
assert.notEqual(manifest, )
|
||||
assert.notEqual(manifest)
|
||||
assert.equal(manifest.name, 'second')
|
||||
assert.equal(manifest.type, 'feed')
|
||||
assert.notEqual(manifest.accessController, null)
|
||||
@ -142,7 +149,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
assert.equal(fs.existsSync(dir), true)
|
||||
})
|
||||
|
||||
it('loads cache from previous version of orbit-db', async() => {
|
||||
it('loads cache from previous version of orbit-db', async () => {
|
||||
const dbName = 'cache-schema-test'
|
||||
|
||||
db = await orbitdb.create(dbName, 'keyvalue')
|
||||
@ -161,7 +168,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
assert.equal((await db.get('key')), 'value')
|
||||
})
|
||||
|
||||
it('loads cache from previous version of orbit-db with the directory option', async() => {
|
||||
it('loads cache from previous version of orbit-db with the directory option', async () => {
|
||||
const dbName = 'cache-schema-test2'
|
||||
const directory = path.join(dbPath, "some-other-place")
|
||||
|
||||
@ -172,7 +179,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
assert.equal((await db.get('key')), 'value')
|
||||
})
|
||||
|
||||
describe('Access Controller', function() {
|
||||
describe('Access Controller', function () {
|
||||
before(async () => {
|
||||
if (db) {
|
||||
await db.drop()
|
||||
@ -204,7 +211,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
assert.deepEqual(db.access.write, [orbitdb.identity.id])
|
||||
})
|
||||
})
|
||||
describe('Meta', function() {
|
||||
describe('Meta', function () {
|
||||
before(async () => {
|
||||
if (db) {
|
||||
await db.close()
|
||||
@ -237,8 +244,8 @@ Object.keys(testAPIs).forEach(API => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('determineAddress', function() {
|
||||
describe('Errors', function() {
|
||||
describe('determineAddress', function () {
|
||||
describe('Errors', function () {
|
||||
it('throws an error if given an invalid database type', async () => {
|
||||
let err
|
||||
try {
|
||||
@ -260,7 +267,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('Success', function() {
|
||||
describe('Success', function () {
|
||||
before(async () => {
|
||||
address = await orbitdb.determineAddress('third', 'feed', { replicate: false })
|
||||
localDataPath = path.join(dbPath, address.root, address.path)
|
||||
@ -279,7 +286,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('Open', function() {
|
||||
describe('Open', function () {
|
||||
beforeEach(async () => {
|
||||
db = await orbitdb.open('abc', { create: true, type: 'feed' })
|
||||
})
|
||||
@ -368,7 +375,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("Close", function() {
|
||||
describe("Close", function () {
|
||||
before(async () => {
|
||||
if (orbitdb) await orbitdb.stop()
|
||||
orbitdb = await OrbitDB.createInstance(ipfs, { directory: dbPath })
|
||||
@ -389,15 +396,15 @@ Object.keys(testAPIs).forEach(API => {
|
||||
assert.strictEqual(db._cache._store._db.status, 'closed')
|
||||
})
|
||||
|
||||
it('successfully manages multiple caches', async() => {
|
||||
it('successfully manages multiple caches', async () => {
|
||||
// Cleaning up cruft from other tests
|
||||
const directory = path.join(dbPath, "custom-store")
|
||||
const directory2 = path.join(dbPath, "custom-store2")
|
||||
|
||||
const db1 = await orbitdb.open('xyz1', { create: true, type: 'feed', })
|
||||
const db2 = await orbitdb.open('xyz2', { create: true, type: 'feed', directory })
|
||||
const db3 = await orbitdb.open('xyz3', { create: true, type: 'feed', directory })
|
||||
const db4 = await orbitdb.open('xyz4', { create: true, type: 'feed', directory: directory2 })
|
||||
const db3 = await orbitdb.open('xyz3', { create: true, type: 'feed', directory })
|
||||
const db4 = await orbitdb.open('xyz4', { create: true, type: 'feed', directory: directory2 })
|
||||
const db5 = await orbitdb.open('xyz5', { create: true, type: 'feed', })
|
||||
|
||||
await db1.close()
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
<EFBFBD>
<12>
|
||||
<EFBFBD>
<12>
|
||||
IPFS -- Inter-Planetary File system
|
||||
|
||||
IPFS is a global, versioned, peer-to-peer filesystem. It combines good ideas
|
||||
|
@ -62,6 +62,20 @@ Object.keys(testAPIs).forEach(API => {
|
||||
assert.equal(result.toString().indexOf('/orbitdb'), 0)
|
||||
assert.equal(result.toString().indexOf('zd'), 9)
|
||||
})
|
||||
|
||||
it('parse address with backslashes (win32) successfully', () => {
|
||||
const address = '\\orbitdb\\Qmdgwt7w4uBsw8LXduzCd18zfGXeTmBsiR8edQ1hSfzcJC\\first-database'
|
||||
const result = OrbitDB.parseAddress(address)
|
||||
|
||||
const isInstanceOf = result instanceof OrbitDBAddress
|
||||
assert.equal(isInstanceOf, true)
|
||||
|
||||
assert.equal(result.root, 'Qmdgwt7w4uBsw8LXduzCd18zfGXeTmBsiR8edQ1hSfzcJC')
|
||||
assert.equal(result.path, 'first-database')
|
||||
|
||||
assert.equal(result.toString().indexOf('/orbitdb'), 0)
|
||||
assert.equal(result.toString().indexOf('Qm'), 9)
|
||||
})
|
||||
})
|
||||
|
||||
describe('isValid Address', () => {
|
||||
@ -97,6 +111,13 @@ Object.keys(testAPIs).forEach(API => {
|
||||
|
||||
assert.equal(result, false)
|
||||
})
|
||||
|
||||
it('validate address with backslashes (win32) successfully', () => {
|
||||
const address = '\\orbitdb\\Qmdgwt7w4uBsw8LXduzCd18zfGXeTmBsiR8edQ1hSfzcJC\\first-database'
|
||||
const result = OrbitDB.isValidAddress(address)
|
||||
|
||||
assert.equal(result, true)
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
@ -35,6 +35,7 @@ const ipfsFixturesDir = './test/fixtures/ipfs'
|
||||
|
||||
Object.keys(testAPIs).forEach(API => {
|
||||
describe(`orbit-db - Backward-Compatibility - Open & Load (${API})`, function () {
|
||||
this.retries(1) // windows...
|
||||
this.timeout(config.timeout)
|
||||
|
||||
let ipfsd, ipfs, orbitdb, db, address, store
|
||||
@ -44,9 +45,15 @@ Object.keys(testAPIs).forEach(API => {
|
||||
ipfsd = await startIpfs(API, config.daemon1)
|
||||
ipfs = ipfsd.api
|
||||
rmrf.sync(dbPath)
|
||||
|
||||
const filterFunc = (src, dest) => {
|
||||
// windows has problems copying these files...
|
||||
return !(src.includes('LOG') || src.includes('LOCK'))
|
||||
}
|
||||
|
||||
// copy data files to ipfs and orbitdb repos
|
||||
await fs.copy(path.join(ipfsFixturesDir, 'blocks'), path.join(ipfsd.path, 'blocks'))
|
||||
await fs.copy(path.join(ipfsFixturesDir, 'datastore'), path.join(ipfsd.path, 'datastore'))
|
||||
await fs.copy(path.join(ipfsFixturesDir, 'datastore'), path.join(ipfsd.path, 'datastore'), { filter: filterFunc })
|
||||
await fs.copy(dbFixturesDir, path.join(dbPath, ipfs._peerInfo.id._idB58String, 'cache'))
|
||||
|
||||
store = await storage.createStore(path.join(dbPath, ipfs._peerInfo.id._idB58String, 'keys'))
|
||||
@ -60,14 +67,14 @@ Object.keys(testAPIs).forEach(API => {
|
||||
after(async () => {
|
||||
await store.close()
|
||||
rmrf.sync(dbPath)
|
||||
if(orbitdb)
|
||||
if (orbitdb)
|
||||
await orbitdb.stop()
|
||||
|
||||
if (ipfsd)
|
||||
await stopIpfs(ipfsd)
|
||||
})
|
||||
|
||||
describe('Open & Load', function() {
|
||||
describe('Open & Load', function () {
|
||||
before(async () => {
|
||||
db = await orbitdb.open('/orbitdb/QmWDUfC4zcWJGgc9UHn1X3qQ5KZqBv4KCiCtjnpMmBT8JC/v0-db', { accessController: { type: 'legacy-ipfs', skipManifest: true } })
|
||||
const localFixtures = await db._cache.get('_localHeads')
|
||||
@ -77,6 +84,14 @@ Object.keys(testAPIs).forEach(API => {
|
||||
await db.load()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
if (process.platform === 'win32') {
|
||||
// for some reason Windows does not load the database correctly at the first time.
|
||||
// this is not a good solution but... it works.
|
||||
await db.load()
|
||||
}
|
||||
})
|
||||
|
||||
after(async () => {
|
||||
if (db)
|
||||
await db.close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user