orbit-db-eventstore
Advanced tools
Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "orbit-db-eventstore", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Eventlog for orbit-db", | ||
@@ -12,4 +12,4 @@ "main": "src/EventStore.js", | ||
"dependencies": { | ||
"orbit-db-store": "0.0.3" | ||
"orbit-db-store": "0.0.4" | ||
} | ||
} |
@@ -9,3 +9,3 @@ 'use strict'; | ||
constructor(ipfs, id, dbname, options) { | ||
if(!options) Object.assign({}, { Index: EventIndex }); | ||
if(!options) options = {}; | ||
if(!options.Index) Object.assign(options, { Index: EventIndex }); | ||
@@ -16,3 +16,3 @@ super(ipfs, id, dbname, options) | ||
add(data) { | ||
const operation = { | ||
const event = { | ||
op: 'ADD', | ||
@@ -25,3 +25,3 @@ key: null, | ||
}; | ||
return this._addOperation(operation); | ||
return this._addOperation(event); | ||
} | ||
@@ -54,3 +54,3 @@ | ||
const amount = opts.limit ? (opts.limit > -1 ? opts.limit : this._index.get().length) : 1; // Return 1 if no limit is provided | ||
const operations = this._index.get(); | ||
const events = this._index.get(); | ||
let result = []; | ||
@@ -60,6 +60,6 @@ | ||
// Greater than case | ||
result = this._read(operations, opts.gt ? opts.gt : opts.gte, amount, opts.gte ? true : false) | ||
result = this._read(events, opts.gt ? opts.gt : opts.gte, amount, opts.gte ? true : false) | ||
} else { | ||
// Lower than and lastN case, search latest first by reversing the sequence | ||
result = this._read(operations.reverse(), opts.lt ? opts.lt : opts.lte, amount, opts.lte || !opts.lt).reverse() | ||
result = this._read(events.reverse(), opts.lt ? opts.lt : opts.lte, amount, opts.lte || !opts.lt).reverse() | ||
} | ||
@@ -66,0 +66,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3794
+ Addedorbit-db-store@0.0.4(transitive)
- Removedorbit-db-store@0.0.3(transitive)
Updatedorbit-db-store@0.0.4