diff --git a/src/db/event-store.js b/src/db/event-store.js index 921f69d..f6080c8 100644 --- a/src/db/event-store.js +++ b/src/db/event-store.js @@ -16,10 +16,10 @@ const Events = async ({ OpLog, Database, ipfs, identity, databaseId, accessContr return entry.payload.value } - const iterator = async function * ({ gt, gte, lt, lte, amount } = {}, options = { fullOp: false }) { + const iterator = async function * ({ gt, gte, lt, lte, amount } = {}) { const it = log.iterator({ gt, gte, lt, lte, amount }) for await (const event of it) { - yield options.fullOp ? event : event.payload.value + yield { hash: event.hash, value: event.payload.value } } } diff --git a/test/db/event-store.test.js b/test/db/event-store.test.js index aa0e97b..cb0e6e8 100644 --- a/test/db/event-store.test.js +++ b/test/db/event-store.test.js @@ -105,7 +105,7 @@ Object.keys(testAPIs).forEach((IPFS) => { const all = await db.all() - deepStrictEqual(all, events) + deepStrictEqual(all.map(e => e.value), events) }) it('returns all events with full operation', async () => { @@ -125,7 +125,7 @@ Object.keys(testAPIs).forEach((IPFS) => { } const hashes = [] - for await (const entry of db.iterator({}, { fullOp: true })) { + for await (const entry of db.iterator()) { hashes.unshift(entry.hash) } @@ -148,7 +148,7 @@ Object.keys(testAPIs).forEach((IPFS) => { } strictEqual(all.length, 4) - deepStrictEqual(all, ['hello0', 'hello1', 'hello2', 'hello3']) + deepStrictEqual(all.map(e => e.value), ['hello0', 'hello1', 'hello2', 'hello3']) }) }) })