@audius/sdk 1.0.17 → 1.0.19
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/api/entityManager.d.ts +3 -16
- package/dist/index.cjs.js +169 -117
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +169 -117
- package/dist/index.esm.js.map +1 -1
- package/dist/legacy.js +169 -117
- package/dist/legacy.js.map +1 -1
- package/dist/native-libs.js +169 -117
- package/dist/native-libs.js.map +1 -1
- package/dist/services/dataContracts/EntityManagerClient.d.ts +7 -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/src/api/entityManager.ts +9 -18
- package/src/services/dataContracts/EntityManagerClient.ts +7 -1
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.19";
|
|
34236
34236
|
var audius = {
|
|
34237
|
-
releaseSHA: "
|
|
34237
|
+
releaseSHA: "0a307f67af9a7dc7a6128b181bce45d92d9492df"
|
|
34238
34238
|
};
|
|
34239
34239
|
var description = "";
|
|
34240
34240
|
var main = "dist/index.cjs.js";
|
|
@@ -46294,23 +46294,29 @@ var UserReplicaSetManagerClient = /*#__PURE__*/function (_ContractClient) {
|
|
|
46294
46294
|
return UserReplicaSetManagerClient;
|
|
46295
46295
|
}(ContractClient);
|
|
46296
46296
|
|
|
46297
|
-
var Action
|
|
46297
|
+
var Action;
|
|
46298
46298
|
|
|
46299
46299
|
(function (Action) {
|
|
46300
46300
|
Action["CREATE"] = "Create";
|
|
46301
46301
|
Action["UPDATE"] = "Update";
|
|
46302
46302
|
Action["DELETE"] = "Delete";
|
|
46303
46303
|
Action["VERIFY"] = "Verify";
|
|
46304
|
-
|
|
46304
|
+
Action["FOLLOW"] = "Follow";
|
|
46305
|
+
Action["UNFOLLOW"] = "Unfollow";
|
|
46306
|
+
Action["SAVE"] = "Save";
|
|
46307
|
+
Action["UNSAVE"] = "Unsave";
|
|
46308
|
+
Action["REPOST"] = "Repost";
|
|
46309
|
+
Action["UNREPOST"] = "Unrepost";
|
|
46310
|
+
})(Action || (Action = {}));
|
|
46305
46311
|
|
|
46306
|
-
var EntityType
|
|
46312
|
+
var EntityType;
|
|
46307
46313
|
|
|
46308
46314
|
(function (EntityType) {
|
|
46309
46315
|
EntityType["PLAYLIST"] = "Playlist";
|
|
46310
46316
|
EntityType["TRACK"] = "Track";
|
|
46311
46317
|
EntityType["USER"] = "User";
|
|
46312
46318
|
EntityType["USER_REPLICA_SET"] = "UserReplicaSet";
|
|
46313
|
-
})(EntityType
|
|
46319
|
+
})(EntityType || (EntityType = {}));
|
|
46314
46320
|
/**
|
|
46315
46321
|
* Generic management of Audius Data entities
|
|
46316
46322
|
**/
|
|
@@ -46472,8 +46478,8 @@ var EntityManagerClient = /*#__PURE__*/function (_ContractClient) {
|
|
|
46472
46478
|
|
|
46473
46479
|
return EntityManagerClient;
|
|
46474
46480
|
}(ContractClient);
|
|
46475
|
-
EntityManagerClient.Action = Action
|
|
46476
|
-
EntityManagerClient.EntityType = EntityType
|
|
46481
|
+
EntityManagerClient.Action = Action;
|
|
46482
|
+
EntityManagerClient.EntityType = EntityType;
|
|
46477
46483
|
|
|
46478
46484
|
var abi = [
|
|
46479
46485
|
{
|
|
@@ -58260,17 +58266,18 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58260
58266
|
|
|
58261
58267
|
var _super = _createSuper(File);
|
|
58262
58268
|
|
|
58263
|
-
function File(user) {
|
|
58269
|
+
function File(user, serviceProvider) {
|
|
58264
58270
|
var _this;
|
|
58265
58271
|
|
|
58266
58272
|
_classCallCheck(this, File);
|
|
58267
58273
|
|
|
58268
|
-
for (var _len = arguments.length, args = new Array(_len >
|
|
58269
|
-
args[_key -
|
|
58274
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
58275
|
+
args[_key - 2] = arguments[_key];
|
|
58270
58276
|
}
|
|
58271
58277
|
|
|
58272
58278
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
58273
58279
|
_this.User = user;
|
|
58280
|
+
_this.ServiceProvider = serviceProvider;
|
|
58274
58281
|
return _this;
|
|
58275
58282
|
}
|
|
58276
58283
|
/**
|
|
@@ -58286,21 +58293,86 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58286
58293
|
_createClass(File, [{
|
|
58287
58294
|
key: "fetchCID",
|
|
58288
58295
|
value: function () {
|
|
58289
|
-
var _fetchCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58296
|
+
var _fetchCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(cid, creatorNodeGateways) {
|
|
58297
|
+
var callback,
|
|
58298
|
+
responseType,
|
|
58299
|
+
trackId,
|
|
58300
|
+
premiumContentHeaders,
|
|
58301
|
+
replicaSetAttempt,
|
|
58302
|
+
allCreatorNodes,
|
|
58303
|
+
allCreatorNodeEndpoints,
|
|
58304
|
+
allNodesAttempt,
|
|
58305
|
+
_args = arguments;
|
|
58306
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
58307
|
+
while (1) {
|
|
58308
|
+
switch (_context.prev = _context.next) {
|
|
58309
|
+
case 0:
|
|
58310
|
+
callback = _args.length > 2 && _args[2] !== undefined ? _args[2] : null;
|
|
58311
|
+
responseType = _args.length > 3 && _args[3] !== undefined ? _args[3] : 'blob';
|
|
58312
|
+
trackId = _args.length > 4 && _args[4] !== undefined ? _args[4] : null;
|
|
58313
|
+
premiumContentHeaders = _args.length > 5 && _args[5] !== undefined ? _args[5] : {};
|
|
58314
|
+
_context.prev = 4;
|
|
58315
|
+
_context.next = 7;
|
|
58316
|
+
return this.fetchCIDInternal(cid, creatorNodeGateways, callback, responseType, trackId, premiumContentHeaders);
|
|
58317
|
+
|
|
58318
|
+
case 7:
|
|
58319
|
+
replicaSetAttempt = _context.sent;
|
|
58320
|
+
return _context.abrupt("return", replicaSetAttempt);
|
|
58321
|
+
|
|
58322
|
+
case 11:
|
|
58323
|
+
_context.prev = 11;
|
|
58324
|
+
_context.t0 = _context["catch"](4);
|
|
58325
|
+
// In the case we can't find the CID from anywhere in the user's replica set,
|
|
58326
|
+
// retry the whole network
|
|
58327
|
+
console.error(_context.t0);
|
|
58328
|
+
_context.next = 16;
|
|
58329
|
+
return this.ServiceProvider.listCreatorNodes();
|
|
58330
|
+
|
|
58331
|
+
case 16:
|
|
58332
|
+
allCreatorNodes = _context.sent;
|
|
58333
|
+
allCreatorNodeEndpoints = allCreatorNodes.map(function (node) {
|
|
58334
|
+
return urlJoin(node.endpoint, 'ipfs');
|
|
58335
|
+
}); // Re-throw whatever error might happen here
|
|
58336
|
+
|
|
58337
|
+
_context.next = 20;
|
|
58338
|
+
return this.fetchCIDInternal(cid, allCreatorNodeEndpoints, callback, responseType, trackId, premiumContentHeaders);
|
|
58339
|
+
|
|
58340
|
+
case 20:
|
|
58341
|
+
allNodesAttempt = _context.sent;
|
|
58342
|
+
return _context.abrupt("return", allNodesAttempt);
|
|
58343
|
+
|
|
58344
|
+
case 22:
|
|
58345
|
+
case "end":
|
|
58346
|
+
return _context.stop();
|
|
58347
|
+
}
|
|
58348
|
+
}
|
|
58349
|
+
}, _callee, this, [[4, 11]]);
|
|
58350
|
+
}));
|
|
58351
|
+
|
|
58352
|
+
function fetchCID(_x, _x2) {
|
|
58353
|
+
return _fetchCID.apply(this, arguments);
|
|
58354
|
+
}
|
|
58355
|
+
|
|
58356
|
+
return fetchCID;
|
|
58357
|
+
}()
|
|
58358
|
+
}, {
|
|
58359
|
+
key: "fetchCIDInternal",
|
|
58360
|
+
value: function () {
|
|
58361
|
+
var _fetchCIDInternal = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(cid, creatorNodeGateways) {
|
|
58290
58362
|
var callback,
|
|
58291
58363
|
responseType,
|
|
58292
58364
|
trackId,
|
|
58293
58365
|
premiumContentHeaders,
|
|
58294
58366
|
urls,
|
|
58295
|
-
|
|
58296
|
-
return regeneratorRuntime.wrap(function
|
|
58367
|
+
_args3 = arguments;
|
|
58368
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
58297
58369
|
while (1) {
|
|
58298
|
-
switch (
|
|
58370
|
+
switch (_context3.prev = _context3.next) {
|
|
58299
58371
|
case 0:
|
|
58300
|
-
callback =
|
|
58301
|
-
responseType =
|
|
58302
|
-
trackId =
|
|
58303
|
-
premiumContentHeaders =
|
|
58372
|
+
callback = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : null;
|
|
58373
|
+
responseType = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : 'blob';
|
|
58374
|
+
trackId = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : null;
|
|
58375
|
+
premiumContentHeaders = _args3.length > 5 && _args3[5] !== undefined ? _args3[5] : {};
|
|
58304
58376
|
urls = [];
|
|
58305
58377
|
creatorNodeGateways.forEach(function (gateway) {
|
|
58306
58378
|
var gatewayWithCid = urlJoin(gateway, cid);
|
|
@@ -58311,17 +58383,17 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58311
58383
|
});
|
|
58312
58384
|
urls.push(gatewayWithCid);
|
|
58313
58385
|
});
|
|
58314
|
-
|
|
58386
|
+
_context3.next = 8;
|
|
58315
58387
|
return retry( /*#__PURE__*/function () {
|
|
58316
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58388
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(bail) {
|
|
58317
58389
|
var _yield$raceRequests, response, errored, allForbidden, legacyUrls, _yield$raceRequests2, _response;
|
|
58318
58390
|
|
|
58319
|
-
return regeneratorRuntime.wrap(function
|
|
58391
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
58320
58392
|
while (1) {
|
|
58321
|
-
switch (
|
|
58393
|
+
switch (_context2.prev = _context2.next) {
|
|
58322
58394
|
case 0:
|
|
58323
|
-
|
|
58324
|
-
|
|
58395
|
+
_context2.prev = 0;
|
|
58396
|
+
_context2.next = 3;
|
|
58325
58397
|
return raceRequests(urls, callback, _objectSpread2({
|
|
58326
58398
|
method: 'get',
|
|
58327
58399
|
responseType: responseType
|
|
@@ -58330,12 +58402,12 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58330
58402
|
null);
|
|
58331
58403
|
|
|
58332
58404
|
case 3:
|
|
58333
|
-
_yield$raceRequests =
|
|
58405
|
+
_yield$raceRequests = _context2.sent;
|
|
58334
58406
|
response = _yield$raceRequests.response;
|
|
58335
58407
|
errored = _yield$raceRequests.errored;
|
|
58336
58408
|
|
|
58337
58409
|
if (response) {
|
|
58338
|
-
|
|
58410
|
+
_context2.next = 12;
|
|
58339
58411
|
break;
|
|
58340
58412
|
}
|
|
58341
58413
|
|
|
@@ -58345,26 +58417,26 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58345
58417
|
});
|
|
58346
58418
|
|
|
58347
58419
|
if (!allForbidden) {
|
|
58348
|
-
|
|
58420
|
+
_context2.next = 11;
|
|
58349
58421
|
break;
|
|
58350
58422
|
}
|
|
58351
58423
|
|
|
58352
58424
|
// In the case for a 403, do not retry fetching
|
|
58353
58425
|
bail(new Error('Forbidden'));
|
|
58354
|
-
return
|
|
58426
|
+
return _context2.abrupt("return");
|
|
58355
58427
|
|
|
58356
58428
|
case 11:
|
|
58357
58429
|
throw new Error("Could not fetch ".concat(cid));
|
|
58358
58430
|
|
|
58359
58431
|
case 12:
|
|
58360
|
-
return
|
|
58432
|
+
return _context2.abrupt("return", response);
|
|
58361
58433
|
|
|
58362
58434
|
case 15:
|
|
58363
|
-
|
|
58364
|
-
|
|
58435
|
+
_context2.prev = 15;
|
|
58436
|
+
_context2.t0 = _context2["catch"](0);
|
|
58365
58437
|
|
|
58366
58438
|
if (!cid.includes('/')) {
|
|
58367
|
-
|
|
58439
|
+
_context2.next = 33;
|
|
58368
58440
|
break;
|
|
58369
58441
|
}
|
|
58370
58442
|
|
|
@@ -58377,8 +58449,8 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58377
58449
|
legacyUrls = creatorNodeGateways.map(function (gateway) {
|
|
58378
58450
|
return urlJoin(gateway, cid.split('/')[0]);
|
|
58379
58451
|
});
|
|
58380
|
-
|
|
58381
|
-
|
|
58452
|
+
_context2.prev = 20;
|
|
58453
|
+
_context2.next = 23;
|
|
58382
58454
|
return raceRequests(legacyUrls, callback, _objectSpread2({
|
|
58383
58455
|
method: 'get',
|
|
58384
58456
|
responseType: responseType
|
|
@@ -58387,22 +58459,22 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58387
58459
|
null);
|
|
58388
58460
|
|
|
58389
58461
|
case 23:
|
|
58390
|
-
_yield$raceRequests2 =
|
|
58462
|
+
_yield$raceRequests2 = _context2.sent;
|
|
58391
58463
|
_response = _yield$raceRequests2.response;
|
|
58392
58464
|
|
|
58393
58465
|
if (_response) {
|
|
58394
|
-
|
|
58466
|
+
_context2.next = 27;
|
|
58395
58467
|
break;
|
|
58396
58468
|
}
|
|
58397
58469
|
|
|
58398
58470
|
throw new Error("Could not fetch ".concat(cid, " via legacy method"));
|
|
58399
58471
|
|
|
58400
58472
|
case 27:
|
|
58401
|
-
return
|
|
58473
|
+
return _context2.abrupt("return", _response);
|
|
58402
58474
|
|
|
58403
58475
|
case 30:
|
|
58404
|
-
|
|
58405
|
-
|
|
58476
|
+
_context2.prev = 30;
|
|
58477
|
+
_context2.t1 = _context2["catch"](20);
|
|
58406
58478
|
throw new Error("Failed to retrieve ".concat(cid, " by legacy method"));
|
|
58407
58479
|
|
|
58408
58480
|
case 33:
|
|
@@ -58410,20 +58482,20 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58410
58482
|
|
|
58411
58483
|
case 34:
|
|
58412
58484
|
case "end":
|
|
58413
|
-
return
|
|
58485
|
+
return _context2.stop();
|
|
58414
58486
|
}
|
|
58415
58487
|
}
|
|
58416
|
-
},
|
|
58488
|
+
}, _callee2, null, [[0, 15], [20, 30]]);
|
|
58417
58489
|
}));
|
|
58418
58490
|
|
|
58419
|
-
return function (
|
|
58491
|
+
return function (_x5) {
|
|
58420
58492
|
return _ref.apply(this, arguments);
|
|
58421
58493
|
};
|
|
58422
58494
|
}(), {
|
|
58423
58495
|
minTimeout: 500,
|
|
58424
58496
|
maxTimeout: 4000,
|
|
58425
58497
|
factor: 3,
|
|
58426
|
-
retries:
|
|
58498
|
+
retries: 3,
|
|
58427
58499
|
onRetry: function onRetry(err, i) {
|
|
58428
58500
|
// eslint-disable-next-line no-console
|
|
58429
58501
|
console.log("FetchCID attempt ".concat(i, " error: ").concat(err));
|
|
@@ -58431,21 +58503,21 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58431
58503
|
});
|
|
58432
58504
|
|
|
58433
58505
|
case 8:
|
|
58434
|
-
return
|
|
58506
|
+
return _context3.abrupt("return", _context3.sent);
|
|
58435
58507
|
|
|
58436
58508
|
case 9:
|
|
58437
58509
|
case "end":
|
|
58438
|
-
return
|
|
58510
|
+
return _context3.stop();
|
|
58439
58511
|
}
|
|
58440
58512
|
}
|
|
58441
|
-
},
|
|
58513
|
+
}, _callee3);
|
|
58442
58514
|
}));
|
|
58443
58515
|
|
|
58444
|
-
function
|
|
58445
|
-
return
|
|
58516
|
+
function fetchCIDInternal(_x3, _x4) {
|
|
58517
|
+
return _fetchCIDInternal.apply(this, arguments);
|
|
58446
58518
|
}
|
|
58447
58519
|
|
|
58448
|
-
return
|
|
58520
|
+
return fetchCIDInternal;
|
|
58449
58521
|
}()
|
|
58450
58522
|
/**
|
|
58451
58523
|
* Fetches a file from Content Node with a given CID. Follows the same pattern
|
|
@@ -58459,12 +58531,12 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58459
58531
|
}, {
|
|
58460
58532
|
key: "downloadCID",
|
|
58461
58533
|
value: function () {
|
|
58462
|
-
var _downloadCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58534
|
+
var _downloadCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(cid, creatorNodeGateways, filename) {
|
|
58463
58535
|
var urls, _yield$raceRequests3, response;
|
|
58464
58536
|
|
|
58465
|
-
return regeneratorRuntime.wrap(function
|
|
58537
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
58466
58538
|
while (1) {
|
|
58467
|
-
switch (
|
|
58539
|
+
switch (_context4.prev = _context4.next) {
|
|
58468
58540
|
case 0:
|
|
58469
58541
|
urls = creatorNodeGateways.map(function (gateway) {
|
|
58470
58542
|
return urlJoin(gateway, cid, {
|
|
@@ -58473,8 +58545,8 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58473
58545
|
}
|
|
58474
58546
|
});
|
|
58475
58547
|
});
|
|
58476
|
-
|
|
58477
|
-
|
|
58548
|
+
_context4.prev = 1;
|
|
58549
|
+
_context4.next = 4;
|
|
58478
58550
|
return raceRequests(urls, function (url) {
|
|
58479
58551
|
return downloadURL(url, filename);
|
|
58480
58552
|
}, {
|
|
@@ -58484,24 +58556,24 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58484
58556
|
10000);
|
|
58485
58557
|
|
|
58486
58558
|
case 4:
|
|
58487
|
-
_yield$raceRequests3 =
|
|
58559
|
+
_yield$raceRequests3 = _context4.sent;
|
|
58488
58560
|
response = _yield$raceRequests3.response;
|
|
58489
|
-
return
|
|
58561
|
+
return _context4.abrupt("return", response);
|
|
58490
58562
|
|
|
58491
58563
|
case 9:
|
|
58492
|
-
|
|
58493
|
-
|
|
58564
|
+
_context4.prev = 9;
|
|
58565
|
+
_context4.t0 = _context4["catch"](1);
|
|
58494
58566
|
throw new Error("Failed to retrieve ".concat(cid));
|
|
58495
58567
|
|
|
58496
58568
|
case 12:
|
|
58497
58569
|
case "end":
|
|
58498
|
-
return
|
|
58570
|
+
return _context4.stop();
|
|
58499
58571
|
}
|
|
58500
58572
|
}
|
|
58501
|
-
},
|
|
58573
|
+
}, _callee4, null, [[1, 9]]);
|
|
58502
58574
|
}));
|
|
58503
58575
|
|
|
58504
|
-
function downloadCID(
|
|
58576
|
+
function downloadCID(_x6, _x7, _x8) {
|
|
58505
58577
|
return _downloadCID.apply(this, arguments);
|
|
58506
58578
|
}
|
|
58507
58579
|
|
|
@@ -58517,66 +58589,66 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58517
58589
|
}, {
|
|
58518
58590
|
key: "checkIfCidAvailable",
|
|
58519
58591
|
value: function () {
|
|
58520
|
-
var _checkIfCidAvailable = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58592
|
+
var _checkIfCidAvailable = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(cid, creatorNodeGateways) {
|
|
58521
58593
|
var exists;
|
|
58522
|
-
return regeneratorRuntime.wrap(function
|
|
58594
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
58523
58595
|
while (1) {
|
|
58524
|
-
switch (
|
|
58596
|
+
switch (_context6.prev = _context6.next) {
|
|
58525
58597
|
case 0:
|
|
58526
58598
|
exists = {};
|
|
58527
|
-
|
|
58599
|
+
_context6.next = 3;
|
|
58528
58600
|
return Promise.all(creatorNodeGateways.map( /*#__PURE__*/function () {
|
|
58529
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58601
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(gateway) {
|
|
58530
58602
|
var _yield$axios, status;
|
|
58531
58603
|
|
|
58532
|
-
return regeneratorRuntime.wrap(function
|
|
58604
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
58533
58605
|
while (1) {
|
|
58534
|
-
switch (
|
|
58606
|
+
switch (_context5.prev = _context5.next) {
|
|
58535
58607
|
case 0:
|
|
58536
|
-
|
|
58537
|
-
|
|
58608
|
+
_context5.prev = 0;
|
|
58609
|
+
_context5.next = 3;
|
|
58538
58610
|
return axios({
|
|
58539
58611
|
url: urlJoin(gateway, cid),
|
|
58540
58612
|
method: 'head'
|
|
58541
58613
|
});
|
|
58542
58614
|
|
|
58543
58615
|
case 3:
|
|
58544
|
-
_yield$axios =
|
|
58616
|
+
_yield$axios = _context5.sent;
|
|
58545
58617
|
status = _yield$axios.status;
|
|
58546
58618
|
exists[gateway] = status === 200;
|
|
58547
|
-
|
|
58619
|
+
_context5.next = 11;
|
|
58548
58620
|
break;
|
|
58549
58621
|
|
|
58550
58622
|
case 8:
|
|
58551
|
-
|
|
58552
|
-
|
|
58623
|
+
_context5.prev = 8;
|
|
58624
|
+
_context5.t0 = _context5["catch"](0);
|
|
58553
58625
|
exists[gateway] = false;
|
|
58554
58626
|
|
|
58555
58627
|
case 11:
|
|
58556
58628
|
case "end":
|
|
58557
|
-
return
|
|
58629
|
+
return _context5.stop();
|
|
58558
58630
|
}
|
|
58559
58631
|
}
|
|
58560
|
-
},
|
|
58632
|
+
}, _callee5, null, [[0, 8]]);
|
|
58561
58633
|
}));
|
|
58562
58634
|
|
|
58563
|
-
return function (
|
|
58635
|
+
return function (_x11) {
|
|
58564
58636
|
return _ref2.apply(this, arguments);
|
|
58565
58637
|
};
|
|
58566
58638
|
}()));
|
|
58567
58639
|
|
|
58568
58640
|
case 3:
|
|
58569
|
-
return
|
|
58641
|
+
return _context6.abrupt("return", exists);
|
|
58570
58642
|
|
|
58571
58643
|
case 4:
|
|
58572
58644
|
case "end":
|
|
58573
|
-
return
|
|
58645
|
+
return _context6.stop();
|
|
58574
58646
|
}
|
|
58575
58647
|
}
|
|
58576
|
-
},
|
|
58648
|
+
}, _callee6);
|
|
58577
58649
|
}));
|
|
58578
58650
|
|
|
58579
|
-
function checkIfCidAvailable(
|
|
58651
|
+
function checkIfCidAvailable(_x9, _x10) {
|
|
58580
58652
|
return _checkIfCidAvailable.apply(this, arguments);
|
|
58581
58653
|
}
|
|
58582
58654
|
|
|
@@ -58590,40 +58662,40 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58590
58662
|
}, {
|
|
58591
58663
|
key: "uploadImage",
|
|
58592
58664
|
value: function () {
|
|
58593
|
-
var _uploadImage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58665
|
+
var _uploadImage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(file, square) {
|
|
58594
58666
|
var timeoutMs,
|
|
58595
58667
|
resp,
|
|
58596
|
-
|
|
58597
|
-
return regeneratorRuntime.wrap(function
|
|
58668
|
+
_args7 = arguments;
|
|
58669
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
58598
58670
|
while (1) {
|
|
58599
|
-
switch (
|
|
58671
|
+
switch (_context7.prev = _context7.next) {
|
|
58600
58672
|
case 0:
|
|
58601
|
-
timeoutMs =
|
|
58673
|
+
timeoutMs = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : null;
|
|
58602
58674
|
this.REQUIRES(Services.CREATOR_NODE);
|
|
58603
58675
|
this.FILE_IS_VALID(file); // Assign a creator_node_endpoint to the user if necessary
|
|
58604
58676
|
|
|
58605
|
-
|
|
58677
|
+
_context7.next = 5;
|
|
58606
58678
|
return this.User.assignReplicaSetIfNecessary();
|
|
58607
58679
|
|
|
58608
58680
|
case 5:
|
|
58609
|
-
|
|
58681
|
+
_context7.next = 7;
|
|
58610
58682
|
return this.creatorNode.uploadImage(file, square,
|
|
58611
58683
|
/* onProgress */
|
|
58612
58684
|
undefined, timeoutMs);
|
|
58613
58685
|
|
|
58614
58686
|
case 7:
|
|
58615
|
-
resp =
|
|
58616
|
-
return
|
|
58687
|
+
resp = _context7.sent;
|
|
58688
|
+
return _context7.abrupt("return", resp);
|
|
58617
58689
|
|
|
58618
58690
|
case 9:
|
|
58619
58691
|
case "end":
|
|
58620
|
-
return
|
|
58692
|
+
return _context7.stop();
|
|
58621
58693
|
}
|
|
58622
58694
|
}
|
|
58623
|
-
},
|
|
58695
|
+
}, _callee7, this);
|
|
58624
58696
|
}));
|
|
58625
58697
|
|
|
58626
|
-
function uploadImage(
|
|
58698
|
+
function uploadImage(_x12, _x13) {
|
|
58627
58699
|
return _uploadImage.apply(this, arguments);
|
|
58628
58700
|
}
|
|
58629
58701
|
|
|
@@ -58712,34 +58784,12 @@ var Reactions = /*#__PURE__*/function (_Base) {
|
|
|
58712
58784
|
return Reactions;
|
|
58713
58785
|
}(Base);
|
|
58714
58786
|
|
|
58715
|
-
var Action;
|
|
58716
|
-
|
|
58717
|
-
(function (Action) {
|
|
58718
|
-
Action["CREATE"] = "Create";
|
|
58719
|
-
Action["UPDATE"] = "Update";
|
|
58720
|
-
Action["DELETE"] = "Delete";
|
|
58721
|
-
Action["FOLLOW"] = "Follow";
|
|
58722
|
-
Action["UNFOLLOW"] = "Unfollow";
|
|
58723
|
-
Action["SAVE"] = "Save";
|
|
58724
|
-
Action["UNSAVE"] = "Unsave";
|
|
58725
|
-
Action["REPOST"] = "Repost";
|
|
58726
|
-
Action["UNREPOST"] = "Unrepost";
|
|
58727
|
-
})(Action || (Action = {}));
|
|
58728
|
-
|
|
58729
|
-
var EntityType;
|
|
58730
|
-
|
|
58731
|
-
(function (EntityType) {
|
|
58732
|
-
EntityType["TRACK"] = "Track";
|
|
58733
|
-
EntityType["PLAYLIST"] = "Playlist";
|
|
58734
|
-
EntityType["USER"] = "User";
|
|
58735
|
-
})(EntityType || (EntityType = {}));
|
|
58736
58787
|
/*
|
|
58737
58788
|
API surface for updated data contract interactions.
|
|
58738
58789
|
Provides simplified entity management in a generic fashion
|
|
58739
58790
|
Handles metadata + file upload etc. for entities such as Playlist/Track/User
|
|
58740
58791
|
*/
|
|
58741
58792
|
|
|
58742
|
-
|
|
58743
58793
|
var EntityManager = /*#__PURE__*/function (_Base) {
|
|
58744
58794
|
_inherits(EntityManager, _Base);
|
|
58745
58795
|
|
|
@@ -58807,6 +58857,8 @@ var EntityManager = /*#__PURE__*/function (_Base) {
|
|
|
58807
58857
|
_this.unsavePlaylist = _this.createSocialMethod(EntityType.PLAYLIST, Action.UNSAVE);
|
|
58808
58858
|
_this.repostTrack = _this.createSocialMethod(EntityType.TRACK, Action.REPOST);
|
|
58809
58859
|
_this.unrepostTrack = _this.createSocialMethod(EntityType.TRACK, Action.UNREPOST);
|
|
58860
|
+
_this.repostPlaylist = _this.createSocialMethod(EntityType.PLAYLIST, Action.REPOST);
|
|
58861
|
+
_this.unrepostPlaylist = _this.createSocialMethod(EntityType.PLAYLIST, Action.UNREPOST);
|
|
58810
58862
|
return _this;
|
|
58811
58863
|
}
|
|
58812
58864
|
|
|
@@ -59772,7 +59824,7 @@ var AudiusLibs = /*#__PURE__*/function () {
|
|
|
59772
59824
|
this.Account = _construct(Account, [this.User].concat(services));
|
|
59773
59825
|
this.Track = _construct(Track, services);
|
|
59774
59826
|
this.Playlist = _construct(Playlists, services);
|
|
59775
|
-
this.File = _construct(File, [this.User].concat(services));
|
|
59827
|
+
this.File = _construct(File, [this.User, this.ServiceProvider].concat(services));
|
|
59776
59828
|
this.Rewards = _construct(Rewards, [this.ServiceProvider].concat(services));
|
|
59777
59829
|
this.Reactions = _construct(Reactions, services);
|
|
59778
59830
|
this.EntityManager = _construct(EntityManager, services);
|