@audius/sdk 1.0.16 → 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/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/index.cjs.js +162 -93
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +162 -93
- package/dist/index.esm.js.map +1 -1
- package/dist/legacy.js +162 -93
- package/dist/legacy.js.map +1 -1
- package/dist/native-libs.js +162 -93
- package/dist/native-libs.js.map +1 -1
- package/dist/services/solana/padBNToUint8Array.d.ts +1 -1
- package/package.json +4 -4
- package/scripts/release.sh +13 -13
- package/src/AudiusLibs.ts +1 -1
- package/src/NativeAudiusLibs.ts +1 -1
- package/src/api/File.ts +48 -2
- package/src/services/schemaValidator/schemas/trackSchema.json +1 -1
- package/src/services/solana/padBNToUint8Array.ts +1 -1
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";
|
|
@@ -34410,7 +34410,7 @@ var devDependencies = {
|
|
|
34410
34410
|
};
|
|
34411
34411
|
var repository = {
|
|
34412
34412
|
type: "git",
|
|
34413
|
-
url: "git+https://github.com/AudiusProject/audius-protocol/tree/
|
|
34413
|
+
url: "git+https://github.com/AudiusProject/audius-protocol/tree/main/libs"
|
|
34414
34414
|
};
|
|
34415
34415
|
var engines = {
|
|
34416
34416
|
node: ">=14.0.0"
|
|
@@ -34420,7 +34420,7 @@ var license = "Apache-2.0";
|
|
|
34420
34420
|
var bugs = {
|
|
34421
34421
|
url: "https://github.com/AudiusProject/audius-protocol/issues"
|
|
34422
34422
|
};
|
|
34423
|
-
var homepage = "https://github.com/AudiusProject/audius-protocol/tree/
|
|
34423
|
+
var homepage = "https://github.com/AudiusProject/audius-protocol/tree/main/libs";
|
|
34424
34424
|
var require$$0 = {
|
|
34425
34425
|
name: name,
|
|
34426
34426
|
version: version,
|
|
@@ -34450,7 +34450,7 @@ var version_1 = packageJson.version;
|
|
|
34450
34450
|
/**
|
|
34451
34451
|
* Converts a BN to a Uint8Array of length 8, in little endian notation.
|
|
34452
34452
|
* Useful for when Rust wants a u64 (8 * 8) represented as a byte array.
|
|
34453
|
-
* Ex: https://github.com/AudiusProject/audius-protocol/blob/
|
|
34453
|
+
* Ex: https://github.com/AudiusProject/audius-protocol/blob/main/solana-programs/reward-manager/program/src/processor.rs#L389
|
|
34454
34454
|
*/
|
|
34455
34455
|
var padBNToUint8Array = function padBNToUint8Array(bn) {
|
|
34456
34456
|
return bn.toArray('le', 8);
|
|
@@ -47616,7 +47616,10 @@ var definitions$2 = {
|
|
|
47616
47616
|
title: "CID"
|
|
47617
47617
|
},
|
|
47618
47618
|
PremiumConditions: {
|
|
47619
|
-
type:
|
|
47619
|
+
type: [
|
|
47620
|
+
"object",
|
|
47621
|
+
"null"
|
|
47622
|
+
],
|
|
47620
47623
|
additionalProperties: false,
|
|
47621
47624
|
properties: {
|
|
47622
47625
|
nft_collection: {
|
|
@@ -58302,17 +58305,18 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58302
58305
|
|
|
58303
58306
|
var _super = _createSuper(File);
|
|
58304
58307
|
|
|
58305
|
-
function File(user) {
|
|
58308
|
+
function File(user, serviceProvider) {
|
|
58306
58309
|
var _this;
|
|
58307
58310
|
|
|
58308
58311
|
_classCallCheck(this, File);
|
|
58309
58312
|
|
|
58310
|
-
for (var _len = arguments.length, args = new Array(_len >
|
|
58311
|
-
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];
|
|
58312
58315
|
}
|
|
58313
58316
|
|
|
58314
58317
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
58315
58318
|
_this.User = user;
|
|
58319
|
+
_this.ServiceProvider = serviceProvider;
|
|
58316
58320
|
return _this;
|
|
58317
58321
|
}
|
|
58318
58322
|
/**
|
|
@@ -58328,21 +58332,86 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58328
58332
|
_createClass(File, [{
|
|
58329
58333
|
key: "fetchCID",
|
|
58330
58334
|
value: function () {
|
|
58331
|
-
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) {
|
|
58332
58401
|
var callback,
|
|
58333
58402
|
responseType,
|
|
58334
58403
|
trackId,
|
|
58335
58404
|
premiumContentHeaders,
|
|
58336
58405
|
urls,
|
|
58337
|
-
|
|
58338
|
-
return regeneratorRuntime.wrap(function
|
|
58406
|
+
_args3 = arguments;
|
|
58407
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
58339
58408
|
while (1) {
|
|
58340
|
-
switch (
|
|
58409
|
+
switch (_context3.prev = _context3.next) {
|
|
58341
58410
|
case 0:
|
|
58342
|
-
callback =
|
|
58343
|
-
responseType =
|
|
58344
|
-
trackId =
|
|
58345
|
-
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] : {};
|
|
58346
58415
|
urls = [];
|
|
58347
58416
|
creatorNodeGateways.forEach(function (gateway) {
|
|
58348
58417
|
var gatewayWithCid = urlJoin__default["default"](gateway, cid);
|
|
@@ -58353,17 +58422,17 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58353
58422
|
});
|
|
58354
58423
|
urls.push(gatewayWithCid);
|
|
58355
58424
|
});
|
|
58356
|
-
|
|
58425
|
+
_context3.next = 8;
|
|
58357
58426
|
return retry__default["default"]( /*#__PURE__*/function () {
|
|
58358
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58427
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(bail) {
|
|
58359
58428
|
var _yield$raceRequests, response, errored, allForbidden, legacyUrls, _yield$raceRequests2, _response;
|
|
58360
58429
|
|
|
58361
|
-
return regeneratorRuntime.wrap(function
|
|
58430
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
58362
58431
|
while (1) {
|
|
58363
|
-
switch (
|
|
58432
|
+
switch (_context2.prev = _context2.next) {
|
|
58364
58433
|
case 0:
|
|
58365
|
-
|
|
58366
|
-
|
|
58434
|
+
_context2.prev = 0;
|
|
58435
|
+
_context2.next = 3;
|
|
58367
58436
|
return raceRequests(urls, callback, _objectSpread2({
|
|
58368
58437
|
method: 'get',
|
|
58369
58438
|
responseType: responseType
|
|
@@ -58372,12 +58441,12 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58372
58441
|
null);
|
|
58373
58442
|
|
|
58374
58443
|
case 3:
|
|
58375
|
-
_yield$raceRequests =
|
|
58444
|
+
_yield$raceRequests = _context2.sent;
|
|
58376
58445
|
response = _yield$raceRequests.response;
|
|
58377
58446
|
errored = _yield$raceRequests.errored;
|
|
58378
58447
|
|
|
58379
58448
|
if (response) {
|
|
58380
|
-
|
|
58449
|
+
_context2.next = 12;
|
|
58381
58450
|
break;
|
|
58382
58451
|
}
|
|
58383
58452
|
|
|
@@ -58387,26 +58456,26 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58387
58456
|
});
|
|
58388
58457
|
|
|
58389
58458
|
if (!allForbidden) {
|
|
58390
|
-
|
|
58459
|
+
_context2.next = 11;
|
|
58391
58460
|
break;
|
|
58392
58461
|
}
|
|
58393
58462
|
|
|
58394
58463
|
// In the case for a 403, do not retry fetching
|
|
58395
58464
|
bail(new Error('Forbidden'));
|
|
58396
|
-
return
|
|
58465
|
+
return _context2.abrupt("return");
|
|
58397
58466
|
|
|
58398
58467
|
case 11:
|
|
58399
58468
|
throw new Error("Could not fetch ".concat(cid));
|
|
58400
58469
|
|
|
58401
58470
|
case 12:
|
|
58402
|
-
return
|
|
58471
|
+
return _context2.abrupt("return", response);
|
|
58403
58472
|
|
|
58404
58473
|
case 15:
|
|
58405
|
-
|
|
58406
|
-
|
|
58474
|
+
_context2.prev = 15;
|
|
58475
|
+
_context2.t0 = _context2["catch"](0);
|
|
58407
58476
|
|
|
58408
58477
|
if (!cid.includes('/')) {
|
|
58409
|
-
|
|
58478
|
+
_context2.next = 33;
|
|
58410
58479
|
break;
|
|
58411
58480
|
}
|
|
58412
58481
|
|
|
@@ -58419,8 +58488,8 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58419
58488
|
legacyUrls = creatorNodeGateways.map(function (gateway) {
|
|
58420
58489
|
return urlJoin__default["default"](gateway, cid.split('/')[0]);
|
|
58421
58490
|
});
|
|
58422
|
-
|
|
58423
|
-
|
|
58491
|
+
_context2.prev = 20;
|
|
58492
|
+
_context2.next = 23;
|
|
58424
58493
|
return raceRequests(legacyUrls, callback, _objectSpread2({
|
|
58425
58494
|
method: 'get',
|
|
58426
58495
|
responseType: responseType
|
|
@@ -58429,22 +58498,22 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58429
58498
|
null);
|
|
58430
58499
|
|
|
58431
58500
|
case 23:
|
|
58432
|
-
_yield$raceRequests2 =
|
|
58501
|
+
_yield$raceRequests2 = _context2.sent;
|
|
58433
58502
|
_response = _yield$raceRequests2.response;
|
|
58434
58503
|
|
|
58435
58504
|
if (_response) {
|
|
58436
|
-
|
|
58505
|
+
_context2.next = 27;
|
|
58437
58506
|
break;
|
|
58438
58507
|
}
|
|
58439
58508
|
|
|
58440
58509
|
throw new Error("Could not fetch ".concat(cid, " via legacy method"));
|
|
58441
58510
|
|
|
58442
58511
|
case 27:
|
|
58443
|
-
return
|
|
58512
|
+
return _context2.abrupt("return", _response);
|
|
58444
58513
|
|
|
58445
58514
|
case 30:
|
|
58446
|
-
|
|
58447
|
-
|
|
58515
|
+
_context2.prev = 30;
|
|
58516
|
+
_context2.t1 = _context2["catch"](20);
|
|
58448
58517
|
throw new Error("Failed to retrieve ".concat(cid, " by legacy method"));
|
|
58449
58518
|
|
|
58450
58519
|
case 33:
|
|
@@ -58452,20 +58521,20 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58452
58521
|
|
|
58453
58522
|
case 34:
|
|
58454
58523
|
case "end":
|
|
58455
|
-
return
|
|
58524
|
+
return _context2.stop();
|
|
58456
58525
|
}
|
|
58457
58526
|
}
|
|
58458
|
-
},
|
|
58527
|
+
}, _callee2, null, [[0, 15], [20, 30]]);
|
|
58459
58528
|
}));
|
|
58460
58529
|
|
|
58461
|
-
return function (
|
|
58530
|
+
return function (_x5) {
|
|
58462
58531
|
return _ref.apply(this, arguments);
|
|
58463
58532
|
};
|
|
58464
58533
|
}(), {
|
|
58465
58534
|
minTimeout: 500,
|
|
58466
58535
|
maxTimeout: 4000,
|
|
58467
58536
|
factor: 3,
|
|
58468
|
-
retries:
|
|
58537
|
+
retries: 3,
|
|
58469
58538
|
onRetry: function onRetry(err, i) {
|
|
58470
58539
|
// eslint-disable-next-line no-console
|
|
58471
58540
|
console.log("FetchCID attempt ".concat(i, " error: ").concat(err));
|
|
@@ -58473,21 +58542,21 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58473
58542
|
});
|
|
58474
58543
|
|
|
58475
58544
|
case 8:
|
|
58476
|
-
return
|
|
58545
|
+
return _context3.abrupt("return", _context3.sent);
|
|
58477
58546
|
|
|
58478
58547
|
case 9:
|
|
58479
58548
|
case "end":
|
|
58480
|
-
return
|
|
58549
|
+
return _context3.stop();
|
|
58481
58550
|
}
|
|
58482
58551
|
}
|
|
58483
|
-
},
|
|
58552
|
+
}, _callee3);
|
|
58484
58553
|
}));
|
|
58485
58554
|
|
|
58486
|
-
function
|
|
58487
|
-
return
|
|
58555
|
+
function fetchCIDInternal(_x3, _x4) {
|
|
58556
|
+
return _fetchCIDInternal.apply(this, arguments);
|
|
58488
58557
|
}
|
|
58489
58558
|
|
|
58490
|
-
return
|
|
58559
|
+
return fetchCIDInternal;
|
|
58491
58560
|
}()
|
|
58492
58561
|
/**
|
|
58493
58562
|
* Fetches a file from Content Node with a given CID. Follows the same pattern
|
|
@@ -58501,12 +58570,12 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58501
58570
|
}, {
|
|
58502
58571
|
key: "downloadCID",
|
|
58503
58572
|
value: function () {
|
|
58504
|
-
var _downloadCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58573
|
+
var _downloadCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(cid, creatorNodeGateways, filename) {
|
|
58505
58574
|
var urls, _yield$raceRequests3, response;
|
|
58506
58575
|
|
|
58507
|
-
return regeneratorRuntime.wrap(function
|
|
58576
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
58508
58577
|
while (1) {
|
|
58509
|
-
switch (
|
|
58578
|
+
switch (_context4.prev = _context4.next) {
|
|
58510
58579
|
case 0:
|
|
58511
58580
|
urls = creatorNodeGateways.map(function (gateway) {
|
|
58512
58581
|
return urlJoin__default["default"](gateway, cid, {
|
|
@@ -58515,8 +58584,8 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58515
58584
|
}
|
|
58516
58585
|
});
|
|
58517
58586
|
});
|
|
58518
|
-
|
|
58519
|
-
|
|
58587
|
+
_context4.prev = 1;
|
|
58588
|
+
_context4.next = 4;
|
|
58520
58589
|
return raceRequests(urls, function (url) {
|
|
58521
58590
|
return downloadURL(url, filename);
|
|
58522
58591
|
}, {
|
|
@@ -58526,24 +58595,24 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58526
58595
|
10000);
|
|
58527
58596
|
|
|
58528
58597
|
case 4:
|
|
58529
|
-
_yield$raceRequests3 =
|
|
58598
|
+
_yield$raceRequests3 = _context4.sent;
|
|
58530
58599
|
response = _yield$raceRequests3.response;
|
|
58531
|
-
return
|
|
58600
|
+
return _context4.abrupt("return", response);
|
|
58532
58601
|
|
|
58533
58602
|
case 9:
|
|
58534
|
-
|
|
58535
|
-
|
|
58603
|
+
_context4.prev = 9;
|
|
58604
|
+
_context4.t0 = _context4["catch"](1);
|
|
58536
58605
|
throw new Error("Failed to retrieve ".concat(cid));
|
|
58537
58606
|
|
|
58538
58607
|
case 12:
|
|
58539
58608
|
case "end":
|
|
58540
|
-
return
|
|
58609
|
+
return _context4.stop();
|
|
58541
58610
|
}
|
|
58542
58611
|
}
|
|
58543
|
-
},
|
|
58612
|
+
}, _callee4, null, [[1, 9]]);
|
|
58544
58613
|
}));
|
|
58545
58614
|
|
|
58546
|
-
function downloadCID(
|
|
58615
|
+
function downloadCID(_x6, _x7, _x8) {
|
|
58547
58616
|
return _downloadCID.apply(this, arguments);
|
|
58548
58617
|
}
|
|
58549
58618
|
|
|
@@ -58559,66 +58628,66 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58559
58628
|
}, {
|
|
58560
58629
|
key: "checkIfCidAvailable",
|
|
58561
58630
|
value: function () {
|
|
58562
|
-
var _checkIfCidAvailable = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58631
|
+
var _checkIfCidAvailable = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(cid, creatorNodeGateways) {
|
|
58563
58632
|
var exists;
|
|
58564
|
-
return regeneratorRuntime.wrap(function
|
|
58633
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
58565
58634
|
while (1) {
|
|
58566
|
-
switch (
|
|
58635
|
+
switch (_context6.prev = _context6.next) {
|
|
58567
58636
|
case 0:
|
|
58568
58637
|
exists = {};
|
|
58569
|
-
|
|
58638
|
+
_context6.next = 3;
|
|
58570
58639
|
return Promise.all(creatorNodeGateways.map( /*#__PURE__*/function () {
|
|
58571
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58640
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(gateway) {
|
|
58572
58641
|
var _yield$axios, status;
|
|
58573
58642
|
|
|
58574
|
-
return regeneratorRuntime.wrap(function
|
|
58643
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
58575
58644
|
while (1) {
|
|
58576
|
-
switch (
|
|
58645
|
+
switch (_context5.prev = _context5.next) {
|
|
58577
58646
|
case 0:
|
|
58578
|
-
|
|
58579
|
-
|
|
58647
|
+
_context5.prev = 0;
|
|
58648
|
+
_context5.next = 3;
|
|
58580
58649
|
return axios__default["default"]({
|
|
58581
58650
|
url: urlJoin__default["default"](gateway, cid),
|
|
58582
58651
|
method: 'head'
|
|
58583
58652
|
});
|
|
58584
58653
|
|
|
58585
58654
|
case 3:
|
|
58586
|
-
_yield$axios =
|
|
58655
|
+
_yield$axios = _context5.sent;
|
|
58587
58656
|
status = _yield$axios.status;
|
|
58588
58657
|
exists[gateway] = status === 200;
|
|
58589
|
-
|
|
58658
|
+
_context5.next = 11;
|
|
58590
58659
|
break;
|
|
58591
58660
|
|
|
58592
58661
|
case 8:
|
|
58593
|
-
|
|
58594
|
-
|
|
58662
|
+
_context5.prev = 8;
|
|
58663
|
+
_context5.t0 = _context5["catch"](0);
|
|
58595
58664
|
exists[gateway] = false;
|
|
58596
58665
|
|
|
58597
58666
|
case 11:
|
|
58598
58667
|
case "end":
|
|
58599
|
-
return
|
|
58668
|
+
return _context5.stop();
|
|
58600
58669
|
}
|
|
58601
58670
|
}
|
|
58602
|
-
},
|
|
58671
|
+
}, _callee5, null, [[0, 8]]);
|
|
58603
58672
|
}));
|
|
58604
58673
|
|
|
58605
|
-
return function (
|
|
58674
|
+
return function (_x11) {
|
|
58606
58675
|
return _ref2.apply(this, arguments);
|
|
58607
58676
|
};
|
|
58608
58677
|
}()));
|
|
58609
58678
|
|
|
58610
58679
|
case 3:
|
|
58611
|
-
return
|
|
58680
|
+
return _context6.abrupt("return", exists);
|
|
58612
58681
|
|
|
58613
58682
|
case 4:
|
|
58614
58683
|
case "end":
|
|
58615
|
-
return
|
|
58684
|
+
return _context6.stop();
|
|
58616
58685
|
}
|
|
58617
58686
|
}
|
|
58618
|
-
},
|
|
58687
|
+
}, _callee6);
|
|
58619
58688
|
}));
|
|
58620
58689
|
|
|
58621
|
-
function checkIfCidAvailable(
|
|
58690
|
+
function checkIfCidAvailable(_x9, _x10) {
|
|
58622
58691
|
return _checkIfCidAvailable.apply(this, arguments);
|
|
58623
58692
|
}
|
|
58624
58693
|
|
|
@@ -58632,40 +58701,40 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58632
58701
|
}, {
|
|
58633
58702
|
key: "uploadImage",
|
|
58634
58703
|
value: function () {
|
|
58635
|
-
var _uploadImage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58704
|
+
var _uploadImage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(file, square) {
|
|
58636
58705
|
var timeoutMs,
|
|
58637
58706
|
resp,
|
|
58638
|
-
|
|
58639
|
-
return regeneratorRuntime.wrap(function
|
|
58707
|
+
_args7 = arguments;
|
|
58708
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
58640
58709
|
while (1) {
|
|
58641
|
-
switch (
|
|
58710
|
+
switch (_context7.prev = _context7.next) {
|
|
58642
58711
|
case 0:
|
|
58643
|
-
timeoutMs =
|
|
58712
|
+
timeoutMs = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : null;
|
|
58644
58713
|
this.REQUIRES(Services.CREATOR_NODE);
|
|
58645
58714
|
this.FILE_IS_VALID(file); // Assign a creator_node_endpoint to the user if necessary
|
|
58646
58715
|
|
|
58647
|
-
|
|
58716
|
+
_context7.next = 5;
|
|
58648
58717
|
return this.User.assignReplicaSetIfNecessary();
|
|
58649
58718
|
|
|
58650
58719
|
case 5:
|
|
58651
|
-
|
|
58720
|
+
_context7.next = 7;
|
|
58652
58721
|
return this.creatorNode.uploadImage(file, square,
|
|
58653
58722
|
/* onProgress */
|
|
58654
58723
|
undefined, timeoutMs);
|
|
58655
58724
|
|
|
58656
58725
|
case 7:
|
|
58657
|
-
resp =
|
|
58658
|
-
return
|
|
58726
|
+
resp = _context7.sent;
|
|
58727
|
+
return _context7.abrupt("return", resp);
|
|
58659
58728
|
|
|
58660
58729
|
case 9:
|
|
58661
58730
|
case "end":
|
|
58662
|
-
return
|
|
58731
|
+
return _context7.stop();
|
|
58663
58732
|
}
|
|
58664
58733
|
}
|
|
58665
|
-
},
|
|
58734
|
+
}, _callee7, this);
|
|
58666
58735
|
}));
|
|
58667
58736
|
|
|
58668
|
-
function uploadImage(
|
|
58737
|
+
function uploadImage(_x12, _x13) {
|
|
58669
58738
|
return _uploadImage.apply(this, arguments);
|
|
58670
58739
|
}
|
|
58671
58740
|
|
|
@@ -59814,7 +59883,7 @@ var AudiusLibs = /*#__PURE__*/function () {
|
|
|
59814
59883
|
this.Account = _construct(Account, [this.User].concat(services));
|
|
59815
59884
|
this.Track = _construct(Track, services);
|
|
59816
59885
|
this.Playlist = _construct(Playlists, services);
|
|
59817
|
-
this.File = _construct(File, [this.User].concat(services));
|
|
59886
|
+
this.File = _construct(File, [this.User, this.ServiceProvider].concat(services));
|
|
59818
59887
|
this.Rewards = _construct(Rewards, [this.ServiceProvider].concat(services));
|
|
59819
59888
|
this.Reactions = _construct(Reactions, services);
|
|
59820
59889
|
this.EntityManager = _construct(EntityManager, services);
|