remove cid prop
update browser dist increment version
This commit is contained in:
parent
b5c38547e2
commit
07984f7637
3
GUIDE.md
3
GUIDE.md
@ -15,8 +15,11 @@ This guide is still being worked on and we would love to get [feedback and sugge
|
||||
* [Address](#address)
|
||||
+ [Manifest](#manifest)
|
||||
* [Identity](#identity)
|
||||
+ [Creating an identity](#creating-an-identity)
|
||||
* [Access Control](#access-control)
|
||||
+ [Public databases](#public-databases)
|
||||
+ [Granting access after database creation](#granting-access-after-database-creation)
|
||||
+ [Custom Access Controller](#custom-access-controller)
|
||||
- [Add an entry](#add-an-entry)
|
||||
- [Get an entry](#get-an-entry)
|
||||
- [Persistency](#persistency)
|
||||
|
14
package-lock.json
generated
14
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "orbit-db",
|
||||
"version": "0.20.0-rc9",
|
||||
"version": "0.20.0-rc10",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -2984,9 +2984,9 @@
|
||||
}
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.3.127",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.127.tgz",
|
||||
"integrity": "sha512-1o25iFRf/dbgauTWalEzmD1EmRN3a2CzP/K7UVpYLEBduk96LF0FyUdCcf4Ry2mAWJ1VxyblFjC93q6qlLwA2A==",
|
||||
"version": "1.3.128",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.128.tgz",
|
||||
"integrity": "sha512-1QK+KELj1mhC9iE7grSP9PP2f06F85UgTs0M9qjuvSuKwxbyifhyPB8dZ27IlYvzMBnLtO4oHNBKTQoN6Tg5mg==",
|
||||
"dev": true
|
||||
},
|
||||
"elliptic": {
|
||||
@ -10036,9 +10036,9 @@
|
||||
}
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.4.1.tgz",
|
||||
"integrity": "sha512-P9UbpFK87NyqBZzUuDBDz4f6Yiys8xm8j7ACDbi6usvFm6KItklQUKjeoqTrYS/S1k6I8oaOC2YLLDr/gg26Mw==",
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.5.0.tgz",
|
||||
"integrity": "sha512-YuZKluhWGJwCcUu4RlZstdAxr8bFfOVHakc1mplwHkk8J+tqM1Y5yraYvIUpeX8aY7+crCwiELJq7Vl0o0LWXw==",
|
||||
"dev": true
|
||||
},
|
||||
"node-forge": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "orbit-db",
|
||||
"version": "0.20.0-rc9",
|
||||
"version": "0.20.0-rc10",
|
||||
"description": "Distributed p2p database on IPFS",
|
||||
"author": "Haad",
|
||||
"license": "MIT",
|
||||
|
@ -62,20 +62,20 @@ Object.keys(testAPIs).forEach(API => {
|
||||
const hash = await db.add('hello1')
|
||||
const items = db.iterator({ limit: -1 }).collect()
|
||||
assert.notEqual(hash, null)
|
||||
assert.equal(hash, last(items).cid)
|
||||
assert.equal(hash, last(items).hash)
|
||||
assert.equal(items.length, 1)
|
||||
})
|
||||
|
||||
it('returns the added entry\'s hash, 2 entries', async () => {
|
||||
db = await orbitdb1.feed(address)
|
||||
await db.load()
|
||||
const prevHash = db.iterator().collect()[0].cid
|
||||
const prevHash = db.iterator().collect()[0].hash
|
||||
const hash = await db.add('hello2')
|
||||
const items = db.iterator({ limit: -1 }).collect()
|
||||
assert.equal(items.length, 2)
|
||||
assert.notEqual(hash, null)
|
||||
assert.notEqual(hash, prevHash)
|
||||
assert.equal(hash, last(items).cid)
|
||||
assert.equal(hash, last(items).hash)
|
||||
})
|
||||
|
||||
it('adds five items', async () => {
|
||||
@ -130,7 +130,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
|
||||
const firstItem = items[0]
|
||||
const secondItem = items[1]
|
||||
assert.equal(firstItem.cid.startsWith('zd'), true)
|
||||
assert.equal(firstItem.hash.startsWith('zd'), true)
|
||||
assert.equal(firstItem.payload.key, null)
|
||||
assert.equal(firstItem.payload.value, 'hello2')
|
||||
assert.equal(secondItem.payload.value, 'hello3')
|
||||
@ -159,7 +159,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
const iter = db.iterator()
|
||||
const next = iter.next().value
|
||||
assert.notEqual(next, null)
|
||||
assert.equal(next.cid.startsWith('zd'), true)
|
||||
assert.equal(next.hash.startsWith('zd'), true)
|
||||
assert.equal(next.payload.key, null)
|
||||
assert.equal(next.payload.value, 'hello4')
|
||||
})
|
||||
@ -178,7 +178,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
const iter = db.iterator()
|
||||
const first = iter.next().value
|
||||
const second = iter.next().value
|
||||
assert.equal(first.cid, hashes[hashes.length - 1])
|
||||
assert.equal(first.hash, hashes[hashes.length - 1])
|
||||
assert.equal(second, null)
|
||||
assert.equal(first.payload.value, 'hello4')
|
||||
})
|
||||
@ -218,7 +218,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
const iter = db.iterator({ limit: 0 })
|
||||
const first = iter.next().value
|
||||
const second = iter.next().value
|
||||
assert.equal(first.cid, last(hashes))
|
||||
assert.equal(first.hash, last(hashes))
|
||||
assert.equal(second, null)
|
||||
})
|
||||
|
||||
@ -226,7 +226,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
const iter = db.iterator({ limit: 1 })
|
||||
const first = iter.next().value
|
||||
const second = iter.next().value
|
||||
assert.equal(first.cid, last(hashes))
|
||||
assert.equal(first.hash, last(hashes))
|
||||
assert.equal(second, null)
|
||||
})
|
||||
|
||||
@ -236,16 +236,16 @@ Object.keys(testAPIs).forEach(API => {
|
||||
const second = iter.next().value
|
||||
const third = iter.next().value
|
||||
const fourth = iter.next().value
|
||||
assert.equal(first.cid, hashes[hashes.length - 3])
|
||||
assert.equal(second.cid, hashes[hashes.length - 2])
|
||||
assert.equal(third.cid, hashes[hashes.length - 1])
|
||||
assert.equal(first.hash, hashes[hashes.length - 3])
|
||||
assert.equal(second.hash, hashes[hashes.length - 2])
|
||||
assert.equal(third.hash, hashes[hashes.length - 1])
|
||||
assert.equal(fourth, null)
|
||||
})
|
||||
|
||||
it('returns all items', () => {
|
||||
const messages = db.iterator({ limit: -1 })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
messages.reverse()
|
||||
assert.equal(messages.length, hashes.length)
|
||||
@ -255,7 +255,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
it('returns all items when limit is bigger than -1', () => {
|
||||
const messages = db.iterator({ limit: -300 })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
assert.equal(messages.length, hashes.length)
|
||||
assert.equal(messages[0], hashes[0])
|
||||
@ -264,7 +264,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
it('returns all items when limit is bigger than number of items', () => {
|
||||
const messages = db.iterator({ limit: 300 })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
assert.equal(messages.length, hashes.length)
|
||||
assert.equal(messages[0], hashes[0])
|
||||
@ -276,7 +276,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
it('returns 1 item when gte is the head', () => {
|
||||
const messages = db.iterator({ gte: last(hashes), limit: -1 })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
assert.equal(messages.length, 1)
|
||||
assert.equal(messages[0], last(hashes))
|
||||
@ -291,7 +291,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
const gte = hashes[hashes.length - 2]
|
||||
const messages = db.iterator({ gte: gte, limit: -1 })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
assert.equal(messages.length, 2)
|
||||
assert.equal(messages[0], hashes[hashes.length - 2])
|
||||
@ -301,7 +301,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
it('returns all items when gte is the root item', () => {
|
||||
const messages = db.iterator({ gte: hashes[0], limit: -1 })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
assert.equal(messages.length, hashes.length)
|
||||
assert.equal(messages[0], hashes[0])
|
||||
@ -311,7 +311,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
it('returns items when gt is the root item', () => {
|
||||
const messages = db.iterator({ gt: hashes[0], limit: -1 })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
assert.equal(messages.length, itemCount - 1)
|
||||
assert.equal(messages[0], hashes[1])
|
||||
@ -321,13 +321,13 @@ Object.keys(testAPIs).forEach(API => {
|
||||
it('returns items when gt is defined', () => {
|
||||
const messages = db.iterator({ limit: -1})
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
const gt = messages[2]
|
||||
|
||||
const messages2 = db.iterator({ gt: gt, limit: 100 })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
assert.equal(messages2.length, 2)
|
||||
assert.equal(messages2[0], messages[messages.length - 2])
|
||||
@ -339,7 +339,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
it('returns one item after head when lt is the head', () => {
|
||||
const messages = db.iterator({ lt: last(hashes) })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
assert.equal(messages.length, 1)
|
||||
assert.equal(messages[0], hashes[hashes.length - 2])
|
||||
@ -348,7 +348,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
it('returns all items when lt is head and limit is -1', () => {
|
||||
const messages = db.iterator({ lt: last(hashes), limit: -1 })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
assert.equal(messages.length, hashes.length - 1)
|
||||
assert.equal(messages[0], hashes[0])
|
||||
@ -358,7 +358,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
it('returns 3 items when lt is head and limit is 3', () => {
|
||||
const messages = db.iterator({ lt: last(hashes), limit: 3 })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
assert.equal(messages.length, 3)
|
||||
assert.equal(messages[0], hashes[hashes.length - 4])
|
||||
@ -373,7 +373,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
it('returns one item when lte is the root item', () => {
|
||||
const messages = db.iterator({ lte: hashes[0] })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
assert.equal(messages.length, 1)
|
||||
assert.equal(messages[0], hashes[0])
|
||||
@ -382,7 +382,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
it('returns all items when lte is the head', () => {
|
||||
const messages = db.iterator({ lte: last(hashes), limit: -1 })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
assert.equal(messages.length, itemCount)
|
||||
assert.equal(messages[0], hashes[0])
|
||||
@ -392,7 +392,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
it('returns 3 items when lte is the head', () => {
|
||||
const messages = db.iterator({ lte: last(hashes), limit: 3 })
|
||||
.collect()
|
||||
.map((e) => e.cid)
|
||||
.map((e) => e.hash)
|
||||
|
||||
assert.equal(messages.length, 3)
|
||||
assert.equal(messages[0], hashes[hashes.length - 3])
|
||||
|
@ -98,7 +98,7 @@ Object.keys(testAPIs).forEach(API => {
|
||||
const hash = await db.add({ thing: 'new addition'})
|
||||
const newEntries = db.all.filter(e => e.v === 1)
|
||||
assert.equal(newEntries.length, 1)
|
||||
assert.strictEqual(newEntries[0].cid, hash)
|
||||
assert.strictEqual(newEntries[0].hash, hash)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user