@audius/sdk 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/File.d.ts +4 -1
- package/dist/index.cjs.js +155 -89
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +155 -89
- package/dist/index.esm.js.map +1 -1
- package/dist/legacy.js +155 -89
- package/dist/legacy.js.map +1 -1
- package/dist/native-libs.js +155 -89
- package/dist/native-libs.js.map +1 -1
- package/package.json +2 -2
- package/src/AudiusLibs.ts +1 -1
- package/src/NativeAudiusLibs.ts +1 -1
- package/src/api/File.ts +48 -2
package/dist/index.esm.js
CHANGED
|
@@ -34232,9 +34232,9 @@ var formatProviders = function formatProviders(providers) {
|
|
|
34232
34232
|
};
|
|
34233
34233
|
|
|
34234
34234
|
var name = "@audius/sdk";
|
|
34235
|
-
var version = "1.0.
|
|
34235
|
+
var version = "1.0.18";
|
|
34236
34236
|
var audius = {
|
|
34237
|
-
releaseSHA: "
|
|
34237
|
+
releaseSHA: "cc52bcb636e5a70a3e50f6fe3b7eccc8f1f0c479"
|
|
34238
34238
|
};
|
|
34239
34239
|
var description = "";
|
|
34240
34240
|
var main = "dist/index.cjs.js";
|
|
@@ -58260,17 +58260,18 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58260
58260
|
|
|
58261
58261
|
var _super = _createSuper(File);
|
|
58262
58262
|
|
|
58263
|
-
function File(user) {
|
|
58263
|
+
function File(user, serviceProvider) {
|
|
58264
58264
|
var _this;
|
|
58265
58265
|
|
|
58266
58266
|
_classCallCheck(this, File);
|
|
58267
58267
|
|
|
58268
|
-
for (var _len = arguments.length, args = new Array(_len >
|
|
58269
|
-
args[_key -
|
|
58268
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
58269
|
+
args[_key - 2] = arguments[_key];
|
|
58270
58270
|
}
|
|
58271
58271
|
|
|
58272
58272
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
58273
58273
|
_this.User = user;
|
|
58274
|
+
_this.ServiceProvider = serviceProvider;
|
|
58274
58275
|
return _this;
|
|
58275
58276
|
}
|
|
58276
58277
|
/**
|
|
@@ -58286,21 +58287,86 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58286
58287
|
_createClass(File, [{
|
|
58287
58288
|
key: "fetchCID",
|
|
58288
58289
|
value: function () {
|
|
58289
|
-
var _fetchCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58290
|
+
var _fetchCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(cid, creatorNodeGateways) {
|
|
58291
|
+
var callback,
|
|
58292
|
+
responseType,
|
|
58293
|
+
trackId,
|
|
58294
|
+
premiumContentHeaders,
|
|
58295
|
+
replicaSetAttempt,
|
|
58296
|
+
allCreatorNodes,
|
|
58297
|
+
allCreatorNodeEndpoints,
|
|
58298
|
+
allNodesAttempt,
|
|
58299
|
+
_args = arguments;
|
|
58300
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
58301
|
+
while (1) {
|
|
58302
|
+
switch (_context.prev = _context.next) {
|
|
58303
|
+
case 0:
|
|
58304
|
+
callback = _args.length > 2 && _args[2] !== undefined ? _args[2] : null;
|
|
58305
|
+
responseType = _args.length > 3 && _args[3] !== undefined ? _args[3] : 'blob';
|
|
58306
|
+
trackId = _args.length > 4 && _args[4] !== undefined ? _args[4] : null;
|
|
58307
|
+
premiumContentHeaders = _args.length > 5 && _args[5] !== undefined ? _args[5] : {};
|
|
58308
|
+
_context.prev = 4;
|
|
58309
|
+
_context.next = 7;
|
|
58310
|
+
return this.fetchCIDInternal(cid, creatorNodeGateways, callback, responseType, trackId, premiumContentHeaders);
|
|
58311
|
+
|
|
58312
|
+
case 7:
|
|
58313
|
+
replicaSetAttempt = _context.sent;
|
|
58314
|
+
return _context.abrupt("return", replicaSetAttempt);
|
|
58315
|
+
|
|
58316
|
+
case 11:
|
|
58317
|
+
_context.prev = 11;
|
|
58318
|
+
_context.t0 = _context["catch"](4);
|
|
58319
|
+
// In the case we can't find the CID from anywhere in the user's replica set,
|
|
58320
|
+
// retry the whole network
|
|
58321
|
+
console.error(_context.t0);
|
|
58322
|
+
_context.next = 16;
|
|
58323
|
+
return this.ServiceProvider.listCreatorNodes();
|
|
58324
|
+
|
|
58325
|
+
case 16:
|
|
58326
|
+
allCreatorNodes = _context.sent;
|
|
58327
|
+
allCreatorNodeEndpoints = allCreatorNodes.map(function (node) {
|
|
58328
|
+
return urlJoin(node.endpoint, 'ipfs');
|
|
58329
|
+
}); // Re-throw whatever error might happen here
|
|
58330
|
+
|
|
58331
|
+
_context.next = 20;
|
|
58332
|
+
return this.fetchCIDInternal(cid, allCreatorNodeEndpoints, callback, responseType, trackId, premiumContentHeaders);
|
|
58333
|
+
|
|
58334
|
+
case 20:
|
|
58335
|
+
allNodesAttempt = _context.sent;
|
|
58336
|
+
return _context.abrupt("return", allNodesAttempt);
|
|
58337
|
+
|
|
58338
|
+
case 22:
|
|
58339
|
+
case "end":
|
|
58340
|
+
return _context.stop();
|
|
58341
|
+
}
|
|
58342
|
+
}
|
|
58343
|
+
}, _callee, this, [[4, 11]]);
|
|
58344
|
+
}));
|
|
58345
|
+
|
|
58346
|
+
function fetchCID(_x, _x2) {
|
|
58347
|
+
return _fetchCID.apply(this, arguments);
|
|
58348
|
+
}
|
|
58349
|
+
|
|
58350
|
+
return fetchCID;
|
|
58351
|
+
}()
|
|
58352
|
+
}, {
|
|
58353
|
+
key: "fetchCIDInternal",
|
|
58354
|
+
value: function () {
|
|
58355
|
+
var _fetchCIDInternal = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(cid, creatorNodeGateways) {
|
|
58290
58356
|
var callback,
|
|
58291
58357
|
responseType,
|
|
58292
58358
|
trackId,
|
|
58293
58359
|
premiumContentHeaders,
|
|
58294
58360
|
urls,
|
|
58295
|
-
|
|
58296
|
-
return regeneratorRuntime.wrap(function
|
|
58361
|
+
_args3 = arguments;
|
|
58362
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
58297
58363
|
while (1) {
|
|
58298
|
-
switch (
|
|
58364
|
+
switch (_context3.prev = _context3.next) {
|
|
58299
58365
|
case 0:
|
|
58300
|
-
callback =
|
|
58301
|
-
responseType =
|
|
58302
|
-
trackId =
|
|
58303
|
-
premiumContentHeaders =
|
|
58366
|
+
callback = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : null;
|
|
58367
|
+
responseType = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : 'blob';
|
|
58368
|
+
trackId = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : null;
|
|
58369
|
+
premiumContentHeaders = _args3.length > 5 && _args3[5] !== undefined ? _args3[5] : {};
|
|
58304
58370
|
urls = [];
|
|
58305
58371
|
creatorNodeGateways.forEach(function (gateway) {
|
|
58306
58372
|
var gatewayWithCid = urlJoin(gateway, cid);
|
|
@@ -58311,17 +58377,17 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58311
58377
|
});
|
|
58312
58378
|
urls.push(gatewayWithCid);
|
|
58313
58379
|
});
|
|
58314
|
-
|
|
58380
|
+
_context3.next = 8;
|
|
58315
58381
|
return retry( /*#__PURE__*/function () {
|
|
58316
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58382
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(bail) {
|
|
58317
58383
|
var _yield$raceRequests, response, errored, allForbidden, legacyUrls, _yield$raceRequests2, _response;
|
|
58318
58384
|
|
|
58319
|
-
return regeneratorRuntime.wrap(function
|
|
58385
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
58320
58386
|
while (1) {
|
|
58321
|
-
switch (
|
|
58387
|
+
switch (_context2.prev = _context2.next) {
|
|
58322
58388
|
case 0:
|
|
58323
|
-
|
|
58324
|
-
|
|
58389
|
+
_context2.prev = 0;
|
|
58390
|
+
_context2.next = 3;
|
|
58325
58391
|
return raceRequests(urls, callback, _objectSpread2({
|
|
58326
58392
|
method: 'get',
|
|
58327
58393
|
responseType: responseType
|
|
@@ -58330,12 +58396,12 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58330
58396
|
null);
|
|
58331
58397
|
|
|
58332
58398
|
case 3:
|
|
58333
|
-
_yield$raceRequests =
|
|
58399
|
+
_yield$raceRequests = _context2.sent;
|
|
58334
58400
|
response = _yield$raceRequests.response;
|
|
58335
58401
|
errored = _yield$raceRequests.errored;
|
|
58336
58402
|
|
|
58337
58403
|
if (response) {
|
|
58338
|
-
|
|
58404
|
+
_context2.next = 12;
|
|
58339
58405
|
break;
|
|
58340
58406
|
}
|
|
58341
58407
|
|
|
@@ -58345,26 +58411,26 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58345
58411
|
});
|
|
58346
58412
|
|
|
58347
58413
|
if (!allForbidden) {
|
|
58348
|
-
|
|
58414
|
+
_context2.next = 11;
|
|
58349
58415
|
break;
|
|
58350
58416
|
}
|
|
58351
58417
|
|
|
58352
58418
|
// In the case for a 403, do not retry fetching
|
|
58353
58419
|
bail(new Error('Forbidden'));
|
|
58354
|
-
return
|
|
58420
|
+
return _context2.abrupt("return");
|
|
58355
58421
|
|
|
58356
58422
|
case 11:
|
|
58357
58423
|
throw new Error("Could not fetch ".concat(cid));
|
|
58358
58424
|
|
|
58359
58425
|
case 12:
|
|
58360
|
-
return
|
|
58426
|
+
return _context2.abrupt("return", response);
|
|
58361
58427
|
|
|
58362
58428
|
case 15:
|
|
58363
|
-
|
|
58364
|
-
|
|
58429
|
+
_context2.prev = 15;
|
|
58430
|
+
_context2.t0 = _context2["catch"](0);
|
|
58365
58431
|
|
|
58366
58432
|
if (!cid.includes('/')) {
|
|
58367
|
-
|
|
58433
|
+
_context2.next = 33;
|
|
58368
58434
|
break;
|
|
58369
58435
|
}
|
|
58370
58436
|
|
|
@@ -58377,8 +58443,8 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58377
58443
|
legacyUrls = creatorNodeGateways.map(function (gateway) {
|
|
58378
58444
|
return urlJoin(gateway, cid.split('/')[0]);
|
|
58379
58445
|
});
|
|
58380
|
-
|
|
58381
|
-
|
|
58446
|
+
_context2.prev = 20;
|
|
58447
|
+
_context2.next = 23;
|
|
58382
58448
|
return raceRequests(legacyUrls, callback, _objectSpread2({
|
|
58383
58449
|
method: 'get',
|
|
58384
58450
|
responseType: responseType
|
|
@@ -58387,22 +58453,22 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58387
58453
|
null);
|
|
58388
58454
|
|
|
58389
58455
|
case 23:
|
|
58390
|
-
_yield$raceRequests2 =
|
|
58456
|
+
_yield$raceRequests2 = _context2.sent;
|
|
58391
58457
|
_response = _yield$raceRequests2.response;
|
|
58392
58458
|
|
|
58393
58459
|
if (_response) {
|
|
58394
|
-
|
|
58460
|
+
_context2.next = 27;
|
|
58395
58461
|
break;
|
|
58396
58462
|
}
|
|
58397
58463
|
|
|
58398
58464
|
throw new Error("Could not fetch ".concat(cid, " via legacy method"));
|
|
58399
58465
|
|
|
58400
58466
|
case 27:
|
|
58401
|
-
return
|
|
58467
|
+
return _context2.abrupt("return", _response);
|
|
58402
58468
|
|
|
58403
58469
|
case 30:
|
|
58404
|
-
|
|
58405
|
-
|
|
58470
|
+
_context2.prev = 30;
|
|
58471
|
+
_context2.t1 = _context2["catch"](20);
|
|
58406
58472
|
throw new Error("Failed to retrieve ".concat(cid, " by legacy method"));
|
|
58407
58473
|
|
|
58408
58474
|
case 33:
|
|
@@ -58410,20 +58476,20 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58410
58476
|
|
|
58411
58477
|
case 34:
|
|
58412
58478
|
case "end":
|
|
58413
|
-
return
|
|
58479
|
+
return _context2.stop();
|
|
58414
58480
|
}
|
|
58415
58481
|
}
|
|
58416
|
-
},
|
|
58482
|
+
}, _callee2, null, [[0, 15], [20, 30]]);
|
|
58417
58483
|
}));
|
|
58418
58484
|
|
|
58419
|
-
return function (
|
|
58485
|
+
return function (_x5) {
|
|
58420
58486
|
return _ref.apply(this, arguments);
|
|
58421
58487
|
};
|
|
58422
58488
|
}(), {
|
|
58423
58489
|
minTimeout: 500,
|
|
58424
58490
|
maxTimeout: 4000,
|
|
58425
58491
|
factor: 3,
|
|
58426
|
-
retries:
|
|
58492
|
+
retries: 3,
|
|
58427
58493
|
onRetry: function onRetry(err, i) {
|
|
58428
58494
|
// eslint-disable-next-line no-console
|
|
58429
58495
|
console.log("FetchCID attempt ".concat(i, " error: ").concat(err));
|
|
@@ -58431,21 +58497,21 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58431
58497
|
});
|
|
58432
58498
|
|
|
58433
58499
|
case 8:
|
|
58434
|
-
return
|
|
58500
|
+
return _context3.abrupt("return", _context3.sent);
|
|
58435
58501
|
|
|
58436
58502
|
case 9:
|
|
58437
58503
|
case "end":
|
|
58438
|
-
return
|
|
58504
|
+
return _context3.stop();
|
|
58439
58505
|
}
|
|
58440
58506
|
}
|
|
58441
|
-
},
|
|
58507
|
+
}, _callee3);
|
|
58442
58508
|
}));
|
|
58443
58509
|
|
|
58444
|
-
function
|
|
58445
|
-
return
|
|
58510
|
+
function fetchCIDInternal(_x3, _x4) {
|
|
58511
|
+
return _fetchCIDInternal.apply(this, arguments);
|
|
58446
58512
|
}
|
|
58447
58513
|
|
|
58448
|
-
return
|
|
58514
|
+
return fetchCIDInternal;
|
|
58449
58515
|
}()
|
|
58450
58516
|
/**
|
|
58451
58517
|
* Fetches a file from Content Node with a given CID. Follows the same pattern
|
|
@@ -58459,12 +58525,12 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58459
58525
|
}, {
|
|
58460
58526
|
key: "downloadCID",
|
|
58461
58527
|
value: function () {
|
|
58462
|
-
var _downloadCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58528
|
+
var _downloadCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(cid, creatorNodeGateways, filename) {
|
|
58463
58529
|
var urls, _yield$raceRequests3, response;
|
|
58464
58530
|
|
|
58465
|
-
return regeneratorRuntime.wrap(function
|
|
58531
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
58466
58532
|
while (1) {
|
|
58467
|
-
switch (
|
|
58533
|
+
switch (_context4.prev = _context4.next) {
|
|
58468
58534
|
case 0:
|
|
58469
58535
|
urls = creatorNodeGateways.map(function (gateway) {
|
|
58470
58536
|
return urlJoin(gateway, cid, {
|
|
@@ -58473,8 +58539,8 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58473
58539
|
}
|
|
58474
58540
|
});
|
|
58475
58541
|
});
|
|
58476
|
-
|
|
58477
|
-
|
|
58542
|
+
_context4.prev = 1;
|
|
58543
|
+
_context4.next = 4;
|
|
58478
58544
|
return raceRequests(urls, function (url) {
|
|
58479
58545
|
return downloadURL(url, filename);
|
|
58480
58546
|
}, {
|
|
@@ -58484,24 +58550,24 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58484
58550
|
10000);
|
|
58485
58551
|
|
|
58486
58552
|
case 4:
|
|
58487
|
-
_yield$raceRequests3 =
|
|
58553
|
+
_yield$raceRequests3 = _context4.sent;
|
|
58488
58554
|
response = _yield$raceRequests3.response;
|
|
58489
|
-
return
|
|
58555
|
+
return _context4.abrupt("return", response);
|
|
58490
58556
|
|
|
58491
58557
|
case 9:
|
|
58492
|
-
|
|
58493
|
-
|
|
58558
|
+
_context4.prev = 9;
|
|
58559
|
+
_context4.t0 = _context4["catch"](1);
|
|
58494
58560
|
throw new Error("Failed to retrieve ".concat(cid));
|
|
58495
58561
|
|
|
58496
58562
|
case 12:
|
|
58497
58563
|
case "end":
|
|
58498
|
-
return
|
|
58564
|
+
return _context4.stop();
|
|
58499
58565
|
}
|
|
58500
58566
|
}
|
|
58501
|
-
},
|
|
58567
|
+
}, _callee4, null, [[1, 9]]);
|
|
58502
58568
|
}));
|
|
58503
58569
|
|
|
58504
|
-
function downloadCID(
|
|
58570
|
+
function downloadCID(_x6, _x7, _x8) {
|
|
58505
58571
|
return _downloadCID.apply(this, arguments);
|
|
58506
58572
|
}
|
|
58507
58573
|
|
|
@@ -58517,66 +58583,66 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58517
58583
|
}, {
|
|
58518
58584
|
key: "checkIfCidAvailable",
|
|
58519
58585
|
value: function () {
|
|
58520
|
-
var _checkIfCidAvailable = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58586
|
+
var _checkIfCidAvailable = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(cid, creatorNodeGateways) {
|
|
58521
58587
|
var exists;
|
|
58522
|
-
return regeneratorRuntime.wrap(function
|
|
58588
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
58523
58589
|
while (1) {
|
|
58524
|
-
switch (
|
|
58590
|
+
switch (_context6.prev = _context6.next) {
|
|
58525
58591
|
case 0:
|
|
58526
58592
|
exists = {};
|
|
58527
|
-
|
|
58593
|
+
_context6.next = 3;
|
|
58528
58594
|
return Promise.all(creatorNodeGateways.map( /*#__PURE__*/function () {
|
|
58529
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58595
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(gateway) {
|
|
58530
58596
|
var _yield$axios, status;
|
|
58531
58597
|
|
|
58532
|
-
return regeneratorRuntime.wrap(function
|
|
58598
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
58533
58599
|
while (1) {
|
|
58534
|
-
switch (
|
|
58600
|
+
switch (_context5.prev = _context5.next) {
|
|
58535
58601
|
case 0:
|
|
58536
|
-
|
|
58537
|
-
|
|
58602
|
+
_context5.prev = 0;
|
|
58603
|
+
_context5.next = 3;
|
|
58538
58604
|
return axios({
|
|
58539
58605
|
url: urlJoin(gateway, cid),
|
|
58540
58606
|
method: 'head'
|
|
58541
58607
|
});
|
|
58542
58608
|
|
|
58543
58609
|
case 3:
|
|
58544
|
-
_yield$axios =
|
|
58610
|
+
_yield$axios = _context5.sent;
|
|
58545
58611
|
status = _yield$axios.status;
|
|
58546
58612
|
exists[gateway] = status === 200;
|
|
58547
|
-
|
|
58613
|
+
_context5.next = 11;
|
|
58548
58614
|
break;
|
|
58549
58615
|
|
|
58550
58616
|
case 8:
|
|
58551
|
-
|
|
58552
|
-
|
|
58617
|
+
_context5.prev = 8;
|
|
58618
|
+
_context5.t0 = _context5["catch"](0);
|
|
58553
58619
|
exists[gateway] = false;
|
|
58554
58620
|
|
|
58555
58621
|
case 11:
|
|
58556
58622
|
case "end":
|
|
58557
|
-
return
|
|
58623
|
+
return _context5.stop();
|
|
58558
58624
|
}
|
|
58559
58625
|
}
|
|
58560
|
-
},
|
|
58626
|
+
}, _callee5, null, [[0, 8]]);
|
|
58561
58627
|
}));
|
|
58562
58628
|
|
|
58563
|
-
return function (
|
|
58629
|
+
return function (_x11) {
|
|
58564
58630
|
return _ref2.apply(this, arguments);
|
|
58565
58631
|
};
|
|
58566
58632
|
}()));
|
|
58567
58633
|
|
|
58568
58634
|
case 3:
|
|
58569
|
-
return
|
|
58635
|
+
return _context6.abrupt("return", exists);
|
|
58570
58636
|
|
|
58571
58637
|
case 4:
|
|
58572
58638
|
case "end":
|
|
58573
|
-
return
|
|
58639
|
+
return _context6.stop();
|
|
58574
58640
|
}
|
|
58575
58641
|
}
|
|
58576
|
-
},
|
|
58642
|
+
}, _callee6);
|
|
58577
58643
|
}));
|
|
58578
58644
|
|
|
58579
|
-
function checkIfCidAvailable(
|
|
58645
|
+
function checkIfCidAvailable(_x9, _x10) {
|
|
58580
58646
|
return _checkIfCidAvailable.apply(this, arguments);
|
|
58581
58647
|
}
|
|
58582
58648
|
|
|
@@ -58590,40 +58656,40 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58590
58656
|
}, {
|
|
58591
58657
|
key: "uploadImage",
|
|
58592
58658
|
value: function () {
|
|
58593
|
-
var _uploadImage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58659
|
+
var _uploadImage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(file, square) {
|
|
58594
58660
|
var timeoutMs,
|
|
58595
58661
|
resp,
|
|
58596
|
-
|
|
58597
|
-
return regeneratorRuntime.wrap(function
|
|
58662
|
+
_args7 = arguments;
|
|
58663
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
58598
58664
|
while (1) {
|
|
58599
|
-
switch (
|
|
58665
|
+
switch (_context7.prev = _context7.next) {
|
|
58600
58666
|
case 0:
|
|
58601
|
-
timeoutMs =
|
|
58667
|
+
timeoutMs = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : null;
|
|
58602
58668
|
this.REQUIRES(Services.CREATOR_NODE);
|
|
58603
58669
|
this.FILE_IS_VALID(file); // Assign a creator_node_endpoint to the user if necessary
|
|
58604
58670
|
|
|
58605
|
-
|
|
58671
|
+
_context7.next = 5;
|
|
58606
58672
|
return this.User.assignReplicaSetIfNecessary();
|
|
58607
58673
|
|
|
58608
58674
|
case 5:
|
|
58609
|
-
|
|
58675
|
+
_context7.next = 7;
|
|
58610
58676
|
return this.creatorNode.uploadImage(file, square,
|
|
58611
58677
|
/* onProgress */
|
|
58612
58678
|
undefined, timeoutMs);
|
|
58613
58679
|
|
|
58614
58680
|
case 7:
|
|
58615
|
-
resp =
|
|
58616
|
-
return
|
|
58681
|
+
resp = _context7.sent;
|
|
58682
|
+
return _context7.abrupt("return", resp);
|
|
58617
58683
|
|
|
58618
58684
|
case 9:
|
|
58619
58685
|
case "end":
|
|
58620
|
-
return
|
|
58686
|
+
return _context7.stop();
|
|
58621
58687
|
}
|
|
58622
58688
|
}
|
|
58623
|
-
},
|
|
58689
|
+
}, _callee7, this);
|
|
58624
58690
|
}));
|
|
58625
58691
|
|
|
58626
|
-
function uploadImage(
|
|
58692
|
+
function uploadImage(_x12, _x13) {
|
|
58627
58693
|
return _uploadImage.apply(this, arguments);
|
|
58628
58694
|
}
|
|
58629
58695
|
|
|
@@ -59772,7 +59838,7 @@ var AudiusLibs = /*#__PURE__*/function () {
|
|
|
59772
59838
|
this.Account = _construct(Account, [this.User].concat(services));
|
|
59773
59839
|
this.Track = _construct(Track, services);
|
|
59774
59840
|
this.Playlist = _construct(Playlists, services);
|
|
59775
|
-
this.File = _construct(File, [this.User].concat(services));
|
|
59841
|
+
this.File = _construct(File, [this.User, this.ServiceProvider].concat(services));
|
|
59776
59842
|
this.Rewards = _construct(Rewards, [this.ServiceProvider].concat(services));
|
|
59777
59843
|
this.Reactions = _construct(Reactions, services);
|
|
59778
59844
|
this.EntityManager = _construct(EntityManager, services);
|