maint: support 0.31 SDK (#113)

* maint: support 0.31 SDK

resolve param changed from uri/uris, to urls.

* feat: stop daemon sdk call

* fix: ffffffffff webpack bug

https://github.com/nulogy/design-system/pull/132
This commit is contained in:
Thomas Zarebczan 2019-02-18 09:11:32 -05:00 committed by Sean Yesmunt
parent e94de32487
commit ec1d5bd41a
4 changed files with 184 additions and 186 deletions

37
dist/bundle.js vendored
View file

@ -7,7 +7,7 @@
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(window, function() {
})((typeof self !== 'undefined' ? self : this), function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
@ -1956,9 +1956,11 @@ module.exports = v4;
// and inconsistent support for the `crypto` API. We do the best we can via
// feature-detection
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues.bind(crypto)) ||
(typeof(msCrypto) != 'undefined' && msCrypto.getRandomValues.bind(msCrypto));
// getRandomValues needs to be invoked in a context where "this" is a Crypto
// implementation. Also, find the complete implementation of crypto on IE11.
var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
(typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
if (getRandomValues) {
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
@ -2001,14 +2003,15 @@ for (var i = 0; i < 256; ++i) {
function bytesToUuid(buf, offset) {
var i = offset || 0;
var bth = byteToHex;
return bth[buf[i++]] + bth[buf[i++]] +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] +
bth[buf[i++]] + bth[buf[i++]] +
bth[buf[i++]] + bth[buf[i++]];
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
return ([bth[buf[i++]], bth[buf[i++]],
bth[buf[i++]], bth[buf[i++]], '-',
bth[buf[i++]], bth[buf[i++]], '-',
bth[buf[i++]], bth[buf[i++]], '-',
bth[buf[i++]], bth[buf[i++]], '-',
bth[buf[i++]], bth[buf[i++]],
bth[buf[i++]], bth[buf[i++]],
bth[buf[i++]], bth[buf[i++]]]).join('');
}
module.exports = bytesToUuid;
@ -2091,7 +2094,7 @@ function doResolveUris(uris) {
});
var resolveInfo = {};
_lbry2.default.resolve({ uris: urisToResolve }).then(function (result) {
_lbry2.default.resolve({ urls: urisToResolve }).then(function (result) {
Object.entries(result).forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
uri = _ref2[0],
@ -2412,6 +2415,9 @@ Lbry.file_set_status = function () {
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return daemonCallWithResult('file_set_status', params);
};
Lbry.stop = function () {
return daemonCallWithResult('stop', {});
};
// claims
Lbry.claim_list_by_channel = function () {
@ -2547,12 +2553,7 @@ Lbry.resolve = function () {
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return new Promise(function (resolve, reject) {
apiCall('resolve', params, function (data) {
if ('uri' in params) {
// If only a single URI was requested, don't nest the results in an object
resolve(data && data[params.uri] ? data[params.uri] : {});
} else {
resolve(data || {});
}
}, reject);
});
};

View file

@ -70,6 +70,7 @@ Lbry.status = (params = {}) => daemonCallWithResult('status', params);
Lbry.version = () => daemonCallWithResult('version', {});
Lbry.file_delete = (params = {}) => daemonCallWithResult('file_delete', params);
Lbry.file_set_status = (params = {}) => daemonCallWithResult('file_set_status', params);
Lbry.stop = () => daemonCallWithResult('stop', {});
// claims
Lbry.claim_list_by_channel = (params = {}) => daemonCallWithResult('claim_list_by_channel', params);
@ -189,12 +190,7 @@ Lbry.resolve = (params = {}) =>
'resolve',
params,
data => {
if ('uri' in params) {
// If only a single URI was requested, don't nest the results in an object
resolve(data && data[params.uri] ? data[params.uri] : {});
} else {
resolve(data || {});
}
},
reject
);

View file

@ -32,7 +32,7 @@ export function doResolveUris(uris, returnCachedClaims = false) {
});
const resolveInfo = {};
Lbry.resolve({ uris: urisToResolve }).then(result => {
Lbry.resolve({ urls: urisToResolve }).then(result => {
Object.entries(result).forEach(([uri, uriResolveInfo]) => {
const fallbackResolveInfo = {
claim: null,

View file

@ -8,7 +8,8 @@ module.exports = {
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'umd'
libraryTarget: 'umd',
globalObject: `(typeof self !== 'undefined' ? self : this)`
},
module: {
rules: [