@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/legacy.js
CHANGED
|
@@ -34277,9 +34277,9 @@ var formatProviders = function formatProviders(providers) {
|
|
|
34277
34277
|
};
|
|
34278
34278
|
|
|
34279
34279
|
var name = "@audius/sdk";
|
|
34280
|
-
var version = "1.0.
|
|
34280
|
+
var version = "1.0.18";
|
|
34281
34281
|
var audius = {
|
|
34282
|
-
releaseSHA: "
|
|
34282
|
+
releaseSHA: "cc52bcb636e5a70a3e50f6fe3b7eccc8f1f0c479"
|
|
34283
34283
|
};
|
|
34284
34284
|
var description = "";
|
|
34285
34285
|
var main = "dist/index.cjs.js";
|
|
@@ -58305,17 +58305,18 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58305
58305
|
|
|
58306
58306
|
var _super = _createSuper(File);
|
|
58307
58307
|
|
|
58308
|
-
function File(user) {
|
|
58308
|
+
function File(user, serviceProvider) {
|
|
58309
58309
|
var _this;
|
|
58310
58310
|
|
|
58311
58311
|
_classCallCheck(this, File);
|
|
58312
58312
|
|
|
58313
|
-
for (var _len = arguments.length, args = new Array(_len >
|
|
58314
|
-
args[_key -
|
|
58313
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
58314
|
+
args[_key - 2] = arguments[_key];
|
|
58315
58315
|
}
|
|
58316
58316
|
|
|
58317
58317
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
58318
58318
|
_this.User = user;
|
|
58319
|
+
_this.ServiceProvider = serviceProvider;
|
|
58319
58320
|
return _this;
|
|
58320
58321
|
}
|
|
58321
58322
|
/**
|
|
@@ -58331,21 +58332,86 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58331
58332
|
_createClass(File, [{
|
|
58332
58333
|
key: "fetchCID",
|
|
58333
58334
|
value: function () {
|
|
58334
|
-
var _fetchCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58335
|
+
var _fetchCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(cid, creatorNodeGateways) {
|
|
58336
|
+
var callback,
|
|
58337
|
+
responseType,
|
|
58338
|
+
trackId,
|
|
58339
|
+
premiumContentHeaders,
|
|
58340
|
+
replicaSetAttempt,
|
|
58341
|
+
allCreatorNodes,
|
|
58342
|
+
allCreatorNodeEndpoints,
|
|
58343
|
+
allNodesAttempt,
|
|
58344
|
+
_args = arguments;
|
|
58345
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
58346
|
+
while (1) {
|
|
58347
|
+
switch (_context.prev = _context.next) {
|
|
58348
|
+
case 0:
|
|
58349
|
+
callback = _args.length > 2 && _args[2] !== undefined ? _args[2] : null;
|
|
58350
|
+
responseType = _args.length > 3 && _args[3] !== undefined ? _args[3] : 'blob';
|
|
58351
|
+
trackId = _args.length > 4 && _args[4] !== undefined ? _args[4] : null;
|
|
58352
|
+
premiumContentHeaders = _args.length > 5 && _args[5] !== undefined ? _args[5] : {};
|
|
58353
|
+
_context.prev = 4;
|
|
58354
|
+
_context.next = 7;
|
|
58355
|
+
return this.fetchCIDInternal(cid, creatorNodeGateways, callback, responseType, trackId, premiumContentHeaders);
|
|
58356
|
+
|
|
58357
|
+
case 7:
|
|
58358
|
+
replicaSetAttempt = _context.sent;
|
|
58359
|
+
return _context.abrupt("return", replicaSetAttempt);
|
|
58360
|
+
|
|
58361
|
+
case 11:
|
|
58362
|
+
_context.prev = 11;
|
|
58363
|
+
_context.t0 = _context["catch"](4);
|
|
58364
|
+
// In the case we can't find the CID from anywhere in the user's replica set,
|
|
58365
|
+
// retry the whole network
|
|
58366
|
+
console.error(_context.t0);
|
|
58367
|
+
_context.next = 16;
|
|
58368
|
+
return this.ServiceProvider.listCreatorNodes();
|
|
58369
|
+
|
|
58370
|
+
case 16:
|
|
58371
|
+
allCreatorNodes = _context.sent;
|
|
58372
|
+
allCreatorNodeEndpoints = allCreatorNodes.map(function (node) {
|
|
58373
|
+
return urlJoin__default["default"](node.endpoint, 'ipfs');
|
|
58374
|
+
}); // Re-throw whatever error might happen here
|
|
58375
|
+
|
|
58376
|
+
_context.next = 20;
|
|
58377
|
+
return this.fetchCIDInternal(cid, allCreatorNodeEndpoints, callback, responseType, trackId, premiumContentHeaders);
|
|
58378
|
+
|
|
58379
|
+
case 20:
|
|
58380
|
+
allNodesAttempt = _context.sent;
|
|
58381
|
+
return _context.abrupt("return", allNodesAttempt);
|
|
58382
|
+
|
|
58383
|
+
case 22:
|
|
58384
|
+
case "end":
|
|
58385
|
+
return _context.stop();
|
|
58386
|
+
}
|
|
58387
|
+
}
|
|
58388
|
+
}, _callee, this, [[4, 11]]);
|
|
58389
|
+
}));
|
|
58390
|
+
|
|
58391
|
+
function fetchCID(_x, _x2) {
|
|
58392
|
+
return _fetchCID.apply(this, arguments);
|
|
58393
|
+
}
|
|
58394
|
+
|
|
58395
|
+
return fetchCID;
|
|
58396
|
+
}()
|
|
58397
|
+
}, {
|
|
58398
|
+
key: "fetchCIDInternal",
|
|
58399
|
+
value: function () {
|
|
58400
|
+
var _fetchCIDInternal = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(cid, creatorNodeGateways) {
|
|
58335
58401
|
var callback,
|
|
58336
58402
|
responseType,
|
|
58337
58403
|
trackId,
|
|
58338
58404
|
premiumContentHeaders,
|
|
58339
58405
|
urls,
|
|
58340
|
-
|
|
58341
|
-
return regeneratorRuntime.wrap(function
|
|
58406
|
+
_args3 = arguments;
|
|
58407
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
58342
58408
|
while (1) {
|
|
58343
|
-
switch (
|
|
58409
|
+
switch (_context3.prev = _context3.next) {
|
|
58344
58410
|
case 0:
|
|
58345
|
-
callback =
|
|
58346
|
-
responseType =
|
|
58347
|
-
trackId =
|
|
58348
|
-
premiumContentHeaders =
|
|
58411
|
+
callback = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : null;
|
|
58412
|
+
responseType = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : 'blob';
|
|
58413
|
+
trackId = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : null;
|
|
58414
|
+
premiumContentHeaders = _args3.length > 5 && _args3[5] !== undefined ? _args3[5] : {};
|
|
58349
58415
|
urls = [];
|
|
58350
58416
|
creatorNodeGateways.forEach(function (gateway) {
|
|
58351
58417
|
var gatewayWithCid = urlJoin__default["default"](gateway, cid);
|
|
@@ -58356,17 +58422,17 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58356
58422
|
});
|
|
58357
58423
|
urls.push(gatewayWithCid);
|
|
58358
58424
|
});
|
|
58359
|
-
|
|
58425
|
+
_context3.next = 8;
|
|
58360
58426
|
return retry__default["default"]( /*#__PURE__*/function () {
|
|
58361
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58427
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(bail) {
|
|
58362
58428
|
var _yield$raceRequests, response, errored, allForbidden, legacyUrls, _yield$raceRequests2, _response;
|
|
58363
58429
|
|
|
58364
|
-
return regeneratorRuntime.wrap(function
|
|
58430
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
58365
58431
|
while (1) {
|
|
58366
|
-
switch (
|
|
58432
|
+
switch (_context2.prev = _context2.next) {
|
|
58367
58433
|
case 0:
|
|
58368
|
-
|
|
58369
|
-
|
|
58434
|
+
_context2.prev = 0;
|
|
58435
|
+
_context2.next = 3;
|
|
58370
58436
|
return raceRequests(urls, callback, _objectSpread2({
|
|
58371
58437
|
method: 'get',
|
|
58372
58438
|
responseType: responseType
|
|
@@ -58375,12 +58441,12 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58375
58441
|
null);
|
|
58376
58442
|
|
|
58377
58443
|
case 3:
|
|
58378
|
-
_yield$raceRequests =
|
|
58444
|
+
_yield$raceRequests = _context2.sent;
|
|
58379
58445
|
response = _yield$raceRequests.response;
|
|
58380
58446
|
errored = _yield$raceRequests.errored;
|
|
58381
58447
|
|
|
58382
58448
|
if (response) {
|
|
58383
|
-
|
|
58449
|
+
_context2.next = 12;
|
|
58384
58450
|
break;
|
|
58385
58451
|
}
|
|
58386
58452
|
|
|
@@ -58390,26 +58456,26 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58390
58456
|
});
|
|
58391
58457
|
|
|
58392
58458
|
if (!allForbidden) {
|
|
58393
|
-
|
|
58459
|
+
_context2.next = 11;
|
|
58394
58460
|
break;
|
|
58395
58461
|
}
|
|
58396
58462
|
|
|
58397
58463
|
// In the case for a 403, do not retry fetching
|
|
58398
58464
|
bail(new Error('Forbidden'));
|
|
58399
|
-
return
|
|
58465
|
+
return _context2.abrupt("return");
|
|
58400
58466
|
|
|
58401
58467
|
case 11:
|
|
58402
58468
|
throw new Error("Could not fetch ".concat(cid));
|
|
58403
58469
|
|
|
58404
58470
|
case 12:
|
|
58405
|
-
return
|
|
58471
|
+
return _context2.abrupt("return", response);
|
|
58406
58472
|
|
|
58407
58473
|
case 15:
|
|
58408
|
-
|
|
58409
|
-
|
|
58474
|
+
_context2.prev = 15;
|
|
58475
|
+
_context2.t0 = _context2["catch"](0);
|
|
58410
58476
|
|
|
58411
58477
|
if (!cid.includes('/')) {
|
|
58412
|
-
|
|
58478
|
+
_context2.next = 33;
|
|
58413
58479
|
break;
|
|
58414
58480
|
}
|
|
58415
58481
|
|
|
@@ -58422,8 +58488,8 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58422
58488
|
legacyUrls = creatorNodeGateways.map(function (gateway) {
|
|
58423
58489
|
return urlJoin__default["default"](gateway, cid.split('/')[0]);
|
|
58424
58490
|
});
|
|
58425
|
-
|
|
58426
|
-
|
|
58491
|
+
_context2.prev = 20;
|
|
58492
|
+
_context2.next = 23;
|
|
58427
58493
|
return raceRequests(legacyUrls, callback, _objectSpread2({
|
|
58428
58494
|
method: 'get',
|
|
58429
58495
|
responseType: responseType
|
|
@@ -58432,22 +58498,22 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58432
58498
|
null);
|
|
58433
58499
|
|
|
58434
58500
|
case 23:
|
|
58435
|
-
_yield$raceRequests2 =
|
|
58501
|
+
_yield$raceRequests2 = _context2.sent;
|
|
58436
58502
|
_response = _yield$raceRequests2.response;
|
|
58437
58503
|
|
|
58438
58504
|
if (_response) {
|
|
58439
|
-
|
|
58505
|
+
_context2.next = 27;
|
|
58440
58506
|
break;
|
|
58441
58507
|
}
|
|
58442
58508
|
|
|
58443
58509
|
throw new Error("Could not fetch ".concat(cid, " via legacy method"));
|
|
58444
58510
|
|
|
58445
58511
|
case 27:
|
|
58446
|
-
return
|
|
58512
|
+
return _context2.abrupt("return", _response);
|
|
58447
58513
|
|
|
58448
58514
|
case 30:
|
|
58449
|
-
|
|
58450
|
-
|
|
58515
|
+
_context2.prev = 30;
|
|
58516
|
+
_context2.t1 = _context2["catch"](20);
|
|
58451
58517
|
throw new Error("Failed to retrieve ".concat(cid, " by legacy method"));
|
|
58452
58518
|
|
|
58453
58519
|
case 33:
|
|
@@ -58455,20 +58521,20 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58455
58521
|
|
|
58456
58522
|
case 34:
|
|
58457
58523
|
case "end":
|
|
58458
|
-
return
|
|
58524
|
+
return _context2.stop();
|
|
58459
58525
|
}
|
|
58460
58526
|
}
|
|
58461
|
-
},
|
|
58527
|
+
}, _callee2, null, [[0, 15], [20, 30]]);
|
|
58462
58528
|
}));
|
|
58463
58529
|
|
|
58464
|
-
return function (
|
|
58530
|
+
return function (_x5) {
|
|
58465
58531
|
return _ref.apply(this, arguments);
|
|
58466
58532
|
};
|
|
58467
58533
|
}(), {
|
|
58468
58534
|
minTimeout: 500,
|
|
58469
58535
|
maxTimeout: 4000,
|
|
58470
58536
|
factor: 3,
|
|
58471
|
-
retries:
|
|
58537
|
+
retries: 3,
|
|
58472
58538
|
onRetry: function onRetry(err, i) {
|
|
58473
58539
|
// eslint-disable-next-line no-console
|
|
58474
58540
|
console.log("FetchCID attempt ".concat(i, " error: ").concat(err));
|
|
@@ -58476,21 +58542,21 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58476
58542
|
});
|
|
58477
58543
|
|
|
58478
58544
|
case 8:
|
|
58479
|
-
return
|
|
58545
|
+
return _context3.abrupt("return", _context3.sent);
|
|
58480
58546
|
|
|
58481
58547
|
case 9:
|
|
58482
58548
|
case "end":
|
|
58483
|
-
return
|
|
58549
|
+
return _context3.stop();
|
|
58484
58550
|
}
|
|
58485
58551
|
}
|
|
58486
|
-
},
|
|
58552
|
+
}, _callee3);
|
|
58487
58553
|
}));
|
|
58488
58554
|
|
|
58489
|
-
function
|
|
58490
|
-
return
|
|
58555
|
+
function fetchCIDInternal(_x3, _x4) {
|
|
58556
|
+
return _fetchCIDInternal.apply(this, arguments);
|
|
58491
58557
|
}
|
|
58492
58558
|
|
|
58493
|
-
return
|
|
58559
|
+
return fetchCIDInternal;
|
|
58494
58560
|
}()
|
|
58495
58561
|
/**
|
|
58496
58562
|
* Fetches a file from Content Node with a given CID. Follows the same pattern
|
|
@@ -58504,12 +58570,12 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58504
58570
|
}, {
|
|
58505
58571
|
key: "downloadCID",
|
|
58506
58572
|
value: function () {
|
|
58507
|
-
var _downloadCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58573
|
+
var _downloadCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(cid, creatorNodeGateways, filename) {
|
|
58508
58574
|
var urls, _yield$raceRequests3, response;
|
|
58509
58575
|
|
|
58510
|
-
return regeneratorRuntime.wrap(function
|
|
58576
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
58511
58577
|
while (1) {
|
|
58512
|
-
switch (
|
|
58578
|
+
switch (_context4.prev = _context4.next) {
|
|
58513
58579
|
case 0:
|
|
58514
58580
|
urls = creatorNodeGateways.map(function (gateway) {
|
|
58515
58581
|
return urlJoin__default["default"](gateway, cid, {
|
|
@@ -58518,8 +58584,8 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58518
58584
|
}
|
|
58519
58585
|
});
|
|
58520
58586
|
});
|
|
58521
|
-
|
|
58522
|
-
|
|
58587
|
+
_context4.prev = 1;
|
|
58588
|
+
_context4.next = 4;
|
|
58523
58589
|
return raceRequests(urls, function (url) {
|
|
58524
58590
|
return downloadURL(url, filename);
|
|
58525
58591
|
}, {
|
|
@@ -58529,24 +58595,24 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58529
58595
|
10000);
|
|
58530
58596
|
|
|
58531
58597
|
case 4:
|
|
58532
|
-
_yield$raceRequests3 =
|
|
58598
|
+
_yield$raceRequests3 = _context4.sent;
|
|
58533
58599
|
response = _yield$raceRequests3.response;
|
|
58534
|
-
return
|
|
58600
|
+
return _context4.abrupt("return", response);
|
|
58535
58601
|
|
|
58536
58602
|
case 9:
|
|
58537
|
-
|
|
58538
|
-
|
|
58603
|
+
_context4.prev = 9;
|
|
58604
|
+
_context4.t0 = _context4["catch"](1);
|
|
58539
58605
|
throw new Error("Failed to retrieve ".concat(cid));
|
|
58540
58606
|
|
|
58541
58607
|
case 12:
|
|
58542
58608
|
case "end":
|
|
58543
|
-
return
|
|
58609
|
+
return _context4.stop();
|
|
58544
58610
|
}
|
|
58545
58611
|
}
|
|
58546
|
-
},
|
|
58612
|
+
}, _callee4, null, [[1, 9]]);
|
|
58547
58613
|
}));
|
|
58548
58614
|
|
|
58549
|
-
function downloadCID(
|
|
58615
|
+
function downloadCID(_x6, _x7, _x8) {
|
|
58550
58616
|
return _downloadCID.apply(this, arguments);
|
|
58551
58617
|
}
|
|
58552
58618
|
|
|
@@ -58562,66 +58628,66 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58562
58628
|
}, {
|
|
58563
58629
|
key: "checkIfCidAvailable",
|
|
58564
58630
|
value: function () {
|
|
58565
|
-
var _checkIfCidAvailable = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58631
|
+
var _checkIfCidAvailable = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(cid, creatorNodeGateways) {
|
|
58566
58632
|
var exists;
|
|
58567
|
-
return regeneratorRuntime.wrap(function
|
|
58633
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
58568
58634
|
while (1) {
|
|
58569
|
-
switch (
|
|
58635
|
+
switch (_context6.prev = _context6.next) {
|
|
58570
58636
|
case 0:
|
|
58571
58637
|
exists = {};
|
|
58572
|
-
|
|
58638
|
+
_context6.next = 3;
|
|
58573
58639
|
return Promise.all(creatorNodeGateways.map( /*#__PURE__*/function () {
|
|
58574
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58640
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(gateway) {
|
|
58575
58641
|
var _yield$axios, status;
|
|
58576
58642
|
|
|
58577
|
-
return regeneratorRuntime.wrap(function
|
|
58643
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
58578
58644
|
while (1) {
|
|
58579
|
-
switch (
|
|
58645
|
+
switch (_context5.prev = _context5.next) {
|
|
58580
58646
|
case 0:
|
|
58581
|
-
|
|
58582
|
-
|
|
58647
|
+
_context5.prev = 0;
|
|
58648
|
+
_context5.next = 3;
|
|
58583
58649
|
return axios__default["default"]({
|
|
58584
58650
|
url: urlJoin__default["default"](gateway, cid),
|
|
58585
58651
|
method: 'head'
|
|
58586
58652
|
});
|
|
58587
58653
|
|
|
58588
58654
|
case 3:
|
|
58589
|
-
_yield$axios =
|
|
58655
|
+
_yield$axios = _context5.sent;
|
|
58590
58656
|
status = _yield$axios.status;
|
|
58591
58657
|
exists[gateway] = status === 200;
|
|
58592
|
-
|
|
58658
|
+
_context5.next = 11;
|
|
58593
58659
|
break;
|
|
58594
58660
|
|
|
58595
58661
|
case 8:
|
|
58596
|
-
|
|
58597
|
-
|
|
58662
|
+
_context5.prev = 8;
|
|
58663
|
+
_context5.t0 = _context5["catch"](0);
|
|
58598
58664
|
exists[gateway] = false;
|
|
58599
58665
|
|
|
58600
58666
|
case 11:
|
|
58601
58667
|
case "end":
|
|
58602
|
-
return
|
|
58668
|
+
return _context5.stop();
|
|
58603
58669
|
}
|
|
58604
58670
|
}
|
|
58605
|
-
},
|
|
58671
|
+
}, _callee5, null, [[0, 8]]);
|
|
58606
58672
|
}));
|
|
58607
58673
|
|
|
58608
|
-
return function (
|
|
58674
|
+
return function (_x11) {
|
|
58609
58675
|
return _ref2.apply(this, arguments);
|
|
58610
58676
|
};
|
|
58611
58677
|
}()));
|
|
58612
58678
|
|
|
58613
58679
|
case 3:
|
|
58614
|
-
return
|
|
58680
|
+
return _context6.abrupt("return", exists);
|
|
58615
58681
|
|
|
58616
58682
|
case 4:
|
|
58617
58683
|
case "end":
|
|
58618
|
-
return
|
|
58684
|
+
return _context6.stop();
|
|
58619
58685
|
}
|
|
58620
58686
|
}
|
|
58621
|
-
},
|
|
58687
|
+
}, _callee6);
|
|
58622
58688
|
}));
|
|
58623
58689
|
|
|
58624
|
-
function checkIfCidAvailable(
|
|
58690
|
+
function checkIfCidAvailable(_x9, _x10) {
|
|
58625
58691
|
return _checkIfCidAvailable.apply(this, arguments);
|
|
58626
58692
|
}
|
|
58627
58693
|
|
|
@@ -58635,40 +58701,40 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58635
58701
|
}, {
|
|
58636
58702
|
key: "uploadImage",
|
|
58637
58703
|
value: function () {
|
|
58638
|
-
var _uploadImage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58704
|
+
var _uploadImage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(file, square) {
|
|
58639
58705
|
var timeoutMs,
|
|
58640
58706
|
resp,
|
|
58641
|
-
|
|
58642
|
-
return regeneratorRuntime.wrap(function
|
|
58707
|
+
_args7 = arguments;
|
|
58708
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
58643
58709
|
while (1) {
|
|
58644
|
-
switch (
|
|
58710
|
+
switch (_context7.prev = _context7.next) {
|
|
58645
58711
|
case 0:
|
|
58646
|
-
timeoutMs =
|
|
58712
|
+
timeoutMs = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : null;
|
|
58647
58713
|
this.REQUIRES(Services.CREATOR_NODE);
|
|
58648
58714
|
this.FILE_IS_VALID(file); // Assign a creator_node_endpoint to the user if necessary
|
|
58649
58715
|
|
|
58650
|
-
|
|
58716
|
+
_context7.next = 5;
|
|
58651
58717
|
return this.User.assignReplicaSetIfNecessary();
|
|
58652
58718
|
|
|
58653
58719
|
case 5:
|
|
58654
|
-
|
|
58720
|
+
_context7.next = 7;
|
|
58655
58721
|
return this.creatorNode.uploadImage(file, square,
|
|
58656
58722
|
/* onProgress */
|
|
58657
58723
|
undefined, timeoutMs);
|
|
58658
58724
|
|
|
58659
58725
|
case 7:
|
|
58660
|
-
resp =
|
|
58661
|
-
return
|
|
58726
|
+
resp = _context7.sent;
|
|
58727
|
+
return _context7.abrupt("return", resp);
|
|
58662
58728
|
|
|
58663
58729
|
case 9:
|
|
58664
58730
|
case "end":
|
|
58665
|
-
return
|
|
58731
|
+
return _context7.stop();
|
|
58666
58732
|
}
|
|
58667
58733
|
}
|
|
58668
|
-
},
|
|
58734
|
+
}, _callee7, this);
|
|
58669
58735
|
}));
|
|
58670
58736
|
|
|
58671
|
-
function uploadImage(
|
|
58737
|
+
function uploadImage(_x12, _x13) {
|
|
58672
58738
|
return _uploadImage.apply(this, arguments);
|
|
58673
58739
|
}
|
|
58674
58740
|
|
|
@@ -59817,7 +59883,7 @@ var AudiusLibs = /*#__PURE__*/function () {
|
|
|
59817
59883
|
this.Account = _construct(Account, [this.User].concat(services));
|
|
59818
59884
|
this.Track = _construct(Track, services);
|
|
59819
59885
|
this.Playlist = _construct(Playlists, services);
|
|
59820
|
-
this.File = _construct(File, [this.User].concat(services));
|
|
59886
|
+
this.File = _construct(File, [this.User, this.ServiceProvider].concat(services));
|
|
59821
59887
|
this.Rewards = _construct(Rewards, [this.ServiceProvider].concat(services));
|
|
59822
59888
|
this.Reactions = _construct(Reactions, services);
|
|
59823
59889
|
this.EntityManager = _construct(EntityManager, services);
|