Skip to content
This repository has been archived by the owner on Sep 30, 2023. It is now read-only.

Commit

Permalink
Update build
Browse files Browse the repository at this point in the history
  • Loading branch information
shamb0t committed Dec 20, 2018
1 parent a02eb70 commit b3b219c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 26 deletions.
4 changes: 2 additions & 2 deletions dist/ipfslog.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions lib/es5/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ var Entry = function () {

data = Entry.toBuffer(e);
_context3.next = 12;
return ipfs.object.put(data);
return ipfs.dag.put(data);

case 12:
object = _context3.sent;
return _context3.abrupt('return', object.toJSON().multihash);
return _context3.abrupt('return', object.toBaseEncodedString());

case 14:
case 'end':
Expand Down Expand Up @@ -342,11 +342,11 @@ var Entry = function () {

case 4:
_context4.next = 6;
return ipfs.object.get(hash, { enc: 'base58' });
return ipfs.dag.get(hash);

case 6:
obj = _context4.sent;
data = JSON.parse(obj.toJSON().data);
data = JSON.parse(obj.value);
entry = {
hash: hash,
id: data.id,
Expand Down
3 changes: 2 additions & 1 deletion lib/es5/g-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
var GSet = function () {
function GSet(values) {
(0, _classCallCheck3.default)(this, GSet);
}
} // eslint-disable-line


(0, _createClass3.default)(GSet, [{
key: 'append',
Expand Down
8 changes: 4 additions & 4 deletions lib/es5/log-io.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ var LogIO = function () {

case 6:
_context.next = 8;
return ipfs.object.put(log.toBuffer());
return ipfs.dag.put(log.toBuffer());

case 8:
dagNode = _context.sent;
return _context.abrupt('return', dagNode.toJSON().multihash);
return _context.abrupt('return', dagNode.toBaseEncodedString());

case 10:
case 'end':
Expand Down Expand Up @@ -130,11 +130,11 @@ var LogIO = function () {

case 4:
_context2.next = 6;
return ipfs.object.get(hash, { enc: 'base58' });
return ipfs.dag.get(hash);

case 6:
dagNode = _context2.sent;
logData = JSON.parse(dagNode.toJSON().data);
logData = JSON.parse(dagNode.value);

if (!(!logData.heads || !logData.id)) {
_context2.next = 10;
Expand Down
20 changes: 7 additions & 13 deletions lib/es5/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ var _require = require('./log-sorting'),
LastWriteWins = _require.LastWriteWins;

var AccessController = require('./default-access-controller');
var IdentityProvider = require('orbit-db-identity-provider');

var _require2 = require('./utils'),
isDefined = _require2.isDefined,
Expand Down Expand Up @@ -163,7 +162,7 @@ var Log = function (_GSet) {
entries.forEach(addToNextsIndex);

// Set the length, we calculate the length manually internally
_this._length = entries ? entries.length : 0;
_this._length = entries.length;

// Set the clock
var maxTime = Math.max(clock ? clock.time : 0, _this.heads.reduce(maxClockTimeReducer, 0));
Expand Down Expand Up @@ -221,7 +220,7 @@ var Log = function (_GSet) {
// Add an entry to the stack and traversed nodes index
var addToStack = function addToStack(entry) {
// If we've already processed the entry, don't add it to the stack
if (traversed[entry.hash]) {
if (!entry || traversed[entry.hash]) {
return;
}

Expand All @@ -241,11 +240,6 @@ var Log = function (_GSet) {
// Get the next element from the stack
var entry = stack.shift();

// Is the stack empty?
if (!entry) {
return;
}

// Add to the result
count++;
result[entry.hash] = entry;
Expand Down Expand Up @@ -409,7 +403,7 @@ var Log = function (_GSet) {
break;
}

throw new Error('Append not permitted');
throw new Error('Could not append entry, key "' + entry.identity.id + '" is not allowed to write to the log');

case 5:
case 'end':
Expand Down Expand Up @@ -474,7 +468,7 @@ var Log = function (_GSet) {
// Update the internal next pointers index
addToNextsIndex = function addToNextsIndex(e) {
var entry = _this4.get(e.hash);
if (!entry) _this4._length++;
if (!entry) _this4._length++; /* istanbul ignore else */
e.next.forEach(function (a) {
return _this4._nextsIndex[a] = e.hash;
});
Expand Down Expand Up @@ -589,6 +583,7 @@ var Log = function (_GSet) {
var padding = new Array(Math.max(len - 1, 0));
padding = len > 1 ? padding.fill(' ') : padding;
padding = len > 0 ? padding.concat(['└─']) : padding;
/* istanbul ignore next */
return padding.join('') + (payloadMapper ? payloadMapper(e.payload) : e.payload);
}).join('\n');
}
Expand Down Expand Up @@ -667,7 +662,7 @@ var Log = function (_GSet) {
}, {
key: 'heads',
get: function get() {
return (0, _values2.default)(this._headsIndex).sort(LastWriteWins).reverse() || [];
return (0, _values2.default)(this._headsIndex).sort(LastWriteWins).reverse();
}

/**
Expand Down Expand Up @@ -1062,5 +1057,4 @@ var Log = function (_GSet) {
}(GSet);

module.exports = Log;
module.exports.AccessController = AccessController;
module.exports.IdentityProvider = IdentityProvider;
module.exports.AccessController = AccessController;
2 changes: 0 additions & 2 deletions lib/es5/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

var difference = require('./difference');
var findUniques = require('./find-uniques');
var intersection = require('./intersection');
var isDefined = require('./is-defined');

module.exports = {
difference: difference,
findUniques: findUniques,
intersection: intersection,
isDefined: isDefined
};

0 comments on commit b3b219c

Please sign in to comment.