mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-27 16:32:30 +00:00
Update browser build (reverted from commit 55ad2141fdc33965d98b8c45af6715f20c56b58e)
This commit is contained in:
parent
55ad2141fd
commit
85cd10090c
135
dist/orbitdb.min.js
vendored
135
dist/orbitdb.min.js
vendored
@ -85,66 +85,88 @@ var OrbitDB =
|
|||||||
this.stores = {};
|
this.stores = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Databases */
|
|
||||||
|
|
||||||
|
|
||||||
(0, _createClass3.default)(OrbitDB, [{
|
(0, _createClass3.default)(OrbitDB, [{
|
||||||
key: 'feed',
|
key: 'feed',
|
||||||
value: function feed(dbname, options) {
|
value: function feed(dbname, options) {
|
||||||
return this._createStore(FeedStore, dbname, options);
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
key: 'eventlog',
|
|
||||||
value: function eventlog(dbname, options) {
|
|
||||||
return this._createStore(EventStore, dbname, options);
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
key: 'kvstore',
|
|
||||||
value: function kvstore(dbname, options) {
|
|
||||||
return this._createStore(KeyValueStore, dbname, options);
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
key: 'counter',
|
|
||||||
value: function counter(dbname, options) {
|
|
||||||
return this._createStore(CounterStore, dbname, options);
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
key: 'disconnect',
|
|
||||||
value: function disconnect() {
|
|
||||||
this._pubsub.disconnect();
|
|
||||||
this.stores = {};
|
|
||||||
this.user = null;
|
|
||||||
this.network = null;
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
key: '_createStore',
|
|
||||||
value: function _createStore(Store, dbname, options) {
|
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
if (!options) options = {};
|
if (!options) options = {};
|
||||||
if (options.subscribe === undefined) (0, _assign2.default)(options, { subscribe: true });
|
if (options.subscribe === undefined) (0, _assign2.default)(options, { subscribe: true });
|
||||||
|
|
||||||
var store = new Store(this._ipfs, this.user.username, dbname, options);
|
var store = new FeedStore(this._ipfs, this.user.username, dbname, options);
|
||||||
return this._subscribe(store, dbname, options.subscribe).then(function () {
|
return this._subscribe(store, dbname, options.subscribe).then(function () {
|
||||||
return _this.stores[dbname] = store;
|
return _this.stores[dbname] = store;
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
return store;
|
return store;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'eventlog',
|
||||||
|
value: function eventlog(dbname, options) {
|
||||||
|
var _this2 = this;
|
||||||
|
|
||||||
|
if (!options) options = {};
|
||||||
|
if (options.subscribe === undefined) (0, _assign2.default)(options, { subscribe: true });
|
||||||
|
|
||||||
|
var store = new EventStore(this._ipfs, this.user.username, dbname, options);
|
||||||
|
return this._subscribe(store, dbname, options.subscribe).then(function () {
|
||||||
|
return _this2.stores[dbname] = store;
|
||||||
|
}).then(function () {
|
||||||
|
return store;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'kvstore',
|
||||||
|
value: function kvstore(dbname, options) {
|
||||||
|
var _this3 = this;
|
||||||
|
|
||||||
|
if (!options) options = {};
|
||||||
|
if (options.subscribe === undefined) (0, _assign2.default)(options, { subscribe: true });
|
||||||
|
|
||||||
|
var store = new KeyValueStore(this._ipfs, this.user.username, dbname, options);
|
||||||
|
return this._subscribe(store, dbname, options.subscribe).then(function () {
|
||||||
|
return _this3.stores[dbname] = store;
|
||||||
|
}).then(function () {
|
||||||
|
return store;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'counter',
|
||||||
|
value: function counter(dbname, options) {
|
||||||
|
var _this4 = this;
|
||||||
|
|
||||||
|
if (!options) options = {};
|
||||||
|
if (options.subscribe === undefined) (0, _assign2.default)(options, { subscribe: true });
|
||||||
|
|
||||||
|
var store = new CounterStore(this._ipfs, this.user.username, dbname, options);
|
||||||
|
return this._subscribe(store, dbname, options.subscribe).then(function () {
|
||||||
|
return _this4.stores[dbname] = store;
|
||||||
|
}).then(function () {
|
||||||
|
return store;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'disconnect',
|
||||||
|
value: function disconnect() {
|
||||||
|
this._pubsub.disconnect();
|
||||||
|
this._store = {};
|
||||||
|
this.user = null;
|
||||||
|
this.network = null;
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: '_subscribe',
|
key: '_subscribe',
|
||||||
value: function _subscribe(store, dbname, subscribe, callback) {
|
value: function _subscribe(store, dbname, subscribe, callback) {
|
||||||
var _this2 = this;
|
var _this5 = this;
|
||||||
|
|
||||||
if (subscribe === undefined) subscribe = true;
|
if (subscribe === undefined) subscribe = true;
|
||||||
|
|
||||||
return store.use(this.user.username).then(function (events) {
|
return store.use(this.user.username).then(function (events) {
|
||||||
events.on('readable', _this2._onSync.bind(_this2));
|
events.on('readable', _this5._onSync.bind(_this5));
|
||||||
events.on('data', _this2._onWrite.bind(_this2));
|
events.on('data', _this5._onWrite.bind(_this5));
|
||||||
events.on('load', _this2._onLoad.bind(_this2));
|
events.on('load', _this5._onLoad.bind(_this5));
|
||||||
events.on('close', _this2._onClose.bind(_this2));
|
events.on('close', _this5._onClose.bind(_this5));
|
||||||
|
|
||||||
if (subscribe) _this2._pubsub.subscribe(dbname, '', _this2._onMessage.bind(_this2));
|
if (subscribe) _this5._pubsub.subscribe(dbname, '', _this5._onMessage.bind(_this5));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
@ -184,13 +206,13 @@ var OrbitDB =
|
|||||||
}, {
|
}, {
|
||||||
key: '_connect',
|
key: '_connect',
|
||||||
value: function _connect(hash, username, password, allowOffline) {
|
value: function _connect(hash, username, password, allowOffline) {
|
||||||
var _this3 = this;
|
var _this6 = this;
|
||||||
|
|
||||||
if (allowOffline === undefined) allowOffline = false;
|
if (allowOffline === undefined) allowOffline = false;
|
||||||
|
|
||||||
var readNetworkInfo = function readNetworkInfo(hash) {
|
var readNetworkInfo = function readNetworkInfo(hash) {
|
||||||
return new _promise2.default(function (resolve, reject) {
|
return new _promise2.default(function (resolve, reject) {
|
||||||
_this3._ipfs.cat(hash).then(function (res) {
|
_this6._ipfs.cat(hash).then(function (res) {
|
||||||
var buf = '';
|
var buf = '';
|
||||||
res.on('error', function (err) {
|
res.on('error', function (err) {
|
||||||
return reject(err);
|
return reject(err);
|
||||||
@ -209,25 +231,25 @@ var OrbitDB =
|
|||||||
return readNetworkInfo(hash).then(function (network) {
|
return readNetworkInfo(hash).then(function (network) {
|
||||||
return JSON.parse(network);
|
return JSON.parse(network);
|
||||||
}).then(function (network) {
|
}).then(function (network) {
|
||||||
_this3.network = network;
|
_this6.network = network;
|
||||||
name = network.name;
|
name = network.name;
|
||||||
host = network.publishers[0].split(":")[0];
|
host = network.publishers[0].split(":")[0];
|
||||||
port = network.publishers[0].split(":")[1];
|
port = network.publishers[0].split(":")[1];
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
_this3._pubsub = new PubSub();
|
_this6._pubsub = new PubSub();
|
||||||
return _this3._pubsub.connect(host, port, username, password);
|
return _this6._pubsub.connect(host, port, username, password);
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
logger.debug('Connected to Pubsub at \'' + host + ':' + port + '\'');
|
logger.debug('Connected to Pubsub at \'' + host + ':' + port + '\'');
|
||||||
_this3.user = { username: username, id: username }; // TODO: user id from ipfs hash
|
_this6.user = { username: username, id: username }; // TODO: user id from ipfs hash
|
||||||
return;
|
return;
|
||||||
}).catch(function (e) {
|
}).catch(function (e) {
|
||||||
logger.warn("Couldn't connect to Pubsub: " + e.message);
|
logger.warn("Couldn't connect to Pubsub: " + e.message);
|
||||||
if (!allowOffline) {
|
if (!allowOffline) {
|
||||||
logger.debug("'allowOffline' set to false, terminating");
|
logger.debug("'allowOffline' set to false, terminating");
|
||||||
_this3._pubsub.disconnect();
|
_this6._pubsub.disconnect();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
_this3.user = { username: username, id: username }; // TODO: user id from ipfs hash
|
_this6.user = { username: username, id: username }; // TODO: user id from ipfs hash
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -508,7 +530,7 @@ var OrbitDB =
|
|||||||
/* 12 */
|
/* 12 */
|
||||||
/***/ function(module, exports) {
|
/***/ function(module, exports) {
|
||||||
|
|
||||||
var core = module.exports = {version: '2.4.0'};
|
var core = module.exports = {version: '2.3.0'};
|
||||||
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
|
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
@ -1410,26 +1432,20 @@ var OrbitDB =
|
|||||||
, isArrayIter = __webpack_require__(57)
|
, isArrayIter = __webpack_require__(57)
|
||||||
, anObject = __webpack_require__(17)
|
, anObject = __webpack_require__(17)
|
||||||
, toLength = __webpack_require__(37)
|
, toLength = __webpack_require__(37)
|
||||||
, getIterFn = __webpack_require__(58)
|
, getIterFn = __webpack_require__(58);
|
||||||
, BREAK = {}
|
module.exports = function(iterable, entries, fn, that, ITERATOR){
|
||||||
, RETURN = {};
|
|
||||||
var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){
|
|
||||||
var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable)
|
var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable)
|
||||||
, f = ctx(fn, that, entries ? 2 : 1)
|
, f = ctx(fn, that, entries ? 2 : 1)
|
||||||
, index = 0
|
, index = 0
|
||||||
, length, step, iterator, result;
|
, length, step, iterator;
|
||||||
if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
|
if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
|
||||||
// fast case for arrays with default iterator
|
// fast case for arrays with default iterator
|
||||||
if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
|
if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
|
||||||
result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
|
entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
|
||||||
if(result === BREAK || result === RETURN)return result;
|
|
||||||
} else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
|
} else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
|
||||||
result = call(iterator, f, step.value, entries);
|
call(iterator, f, step.value, entries);
|
||||||
if(result === BREAK || result === RETURN)return result;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
exports.BREAK = BREAK;
|
|
||||||
exports.RETURN = RETURN;
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 56 */
|
/* 56 */
|
||||||
@ -9966,9 +9982,6 @@ var OrbitDB =
|
|||||||
var queueIndex = -1;
|
var queueIndex = -1;
|
||||||
|
|
||||||
function cleanUpNextTick() {
|
function cleanUpNextTick() {
|
||||||
if (!draining || !currentQueue) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
draining = false;
|
draining = false;
|
||||||
if (currentQueue.length) {
|
if (currentQueue.length) {
|
||||||
queue = currentQueue.concat(queue);
|
queue = currentQueue.concat(queue);
|
||||||
|
4779
examples/bundle.js
4779
examples/bundle.js
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user