@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/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";
|
|
@@ -34365,7 +34365,7 @@ var devDependencies = {
|
|
|
34365
34365
|
};
|
|
34366
34366
|
var repository = {
|
|
34367
34367
|
type: "git",
|
|
34368
|
-
url: "git+https://github.com/AudiusProject/audius-protocol/tree/
|
|
34368
|
+
url: "git+https://github.com/AudiusProject/audius-protocol/tree/main/libs"
|
|
34369
34369
|
};
|
|
34370
34370
|
var engines = {
|
|
34371
34371
|
node: ">=14.0.0"
|
|
@@ -34375,7 +34375,7 @@ var license = "Apache-2.0";
|
|
|
34375
34375
|
var bugs = {
|
|
34376
34376
|
url: "https://github.com/AudiusProject/audius-protocol/issues"
|
|
34377
34377
|
};
|
|
34378
|
-
var homepage = "https://github.com/AudiusProject/audius-protocol/tree/
|
|
34378
|
+
var homepage = "https://github.com/AudiusProject/audius-protocol/tree/main/libs";
|
|
34379
34379
|
var require$$0 = {
|
|
34380
34380
|
name: name,
|
|
34381
34381
|
version: version,
|
|
@@ -34405,7 +34405,7 @@ var version_1 = packageJson.version;
|
|
|
34405
34405
|
/**
|
|
34406
34406
|
* Converts a BN to a Uint8Array of length 8, in little endian notation.
|
|
34407
34407
|
* Useful for when Rust wants a u64 (8 * 8) represented as a byte array.
|
|
34408
|
-
* Ex: https://github.com/AudiusProject/audius-protocol/blob/
|
|
34408
|
+
* Ex: https://github.com/AudiusProject/audius-protocol/blob/main/solana-programs/reward-manager/program/src/processor.rs#L389
|
|
34409
34409
|
*/
|
|
34410
34410
|
var padBNToUint8Array = function padBNToUint8Array(bn) {
|
|
34411
34411
|
return bn.toArray('le', 8);
|
|
@@ -47571,7 +47571,10 @@ var definitions$2 = {
|
|
|
47571
47571
|
title: "CID"
|
|
47572
47572
|
},
|
|
47573
47573
|
PremiumConditions: {
|
|
47574
|
-
type:
|
|
47574
|
+
type: [
|
|
47575
|
+
"object",
|
|
47576
|
+
"null"
|
|
47577
|
+
],
|
|
47575
47578
|
additionalProperties: false,
|
|
47576
47579
|
properties: {
|
|
47577
47580
|
nft_collection: {
|
|
@@ -58257,17 +58260,18 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58257
58260
|
|
|
58258
58261
|
var _super = _createSuper(File);
|
|
58259
58262
|
|
|
58260
|
-
function File(user) {
|
|
58263
|
+
function File(user, serviceProvider) {
|
|
58261
58264
|
var _this;
|
|
58262
58265
|
|
|
58263
58266
|
_classCallCheck(this, File);
|
|
58264
58267
|
|
|
58265
|
-
for (var _len = arguments.length, args = new Array(_len >
|
|
58266
|
-
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];
|
|
58267
58270
|
}
|
|
58268
58271
|
|
|
58269
58272
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
58270
58273
|
_this.User = user;
|
|
58274
|
+
_this.ServiceProvider = serviceProvider;
|
|
58271
58275
|
return _this;
|
|
58272
58276
|
}
|
|
58273
58277
|
/**
|
|
@@ -58283,21 +58287,86 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58283
58287
|
_createClass(File, [{
|
|
58284
58288
|
key: "fetchCID",
|
|
58285
58289
|
value: function () {
|
|
58286
|
-
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) {
|
|
58287
58356
|
var callback,
|
|
58288
58357
|
responseType,
|
|
58289
58358
|
trackId,
|
|
58290
58359
|
premiumContentHeaders,
|
|
58291
58360
|
urls,
|
|
58292
|
-
|
|
58293
|
-
return regeneratorRuntime.wrap(function
|
|
58361
|
+
_args3 = arguments;
|
|
58362
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
58294
58363
|
while (1) {
|
|
58295
|
-
switch (
|
|
58364
|
+
switch (_context3.prev = _context3.next) {
|
|
58296
58365
|
case 0:
|
|
58297
|
-
callback =
|
|
58298
|
-
responseType =
|
|
58299
|
-
trackId =
|
|
58300
|
-
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] : {};
|
|
58301
58370
|
urls = [];
|
|
58302
58371
|
creatorNodeGateways.forEach(function (gateway) {
|
|
58303
58372
|
var gatewayWithCid = urlJoin(gateway, cid);
|
|
@@ -58308,17 +58377,17 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58308
58377
|
});
|
|
58309
58378
|
urls.push(gatewayWithCid);
|
|
58310
58379
|
});
|
|
58311
|
-
|
|
58380
|
+
_context3.next = 8;
|
|
58312
58381
|
return retry( /*#__PURE__*/function () {
|
|
58313
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58382
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(bail) {
|
|
58314
58383
|
var _yield$raceRequests, response, errored, allForbidden, legacyUrls, _yield$raceRequests2, _response;
|
|
58315
58384
|
|
|
58316
|
-
return regeneratorRuntime.wrap(function
|
|
58385
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
58317
58386
|
while (1) {
|
|
58318
|
-
switch (
|
|
58387
|
+
switch (_context2.prev = _context2.next) {
|
|
58319
58388
|
case 0:
|
|
58320
|
-
|
|
58321
|
-
|
|
58389
|
+
_context2.prev = 0;
|
|
58390
|
+
_context2.next = 3;
|
|
58322
58391
|
return raceRequests(urls, callback, _objectSpread2({
|
|
58323
58392
|
method: 'get',
|
|
58324
58393
|
responseType: responseType
|
|
@@ -58327,12 +58396,12 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58327
58396
|
null);
|
|
58328
58397
|
|
|
58329
58398
|
case 3:
|
|
58330
|
-
_yield$raceRequests =
|
|
58399
|
+
_yield$raceRequests = _context2.sent;
|
|
58331
58400
|
response = _yield$raceRequests.response;
|
|
58332
58401
|
errored = _yield$raceRequests.errored;
|
|
58333
58402
|
|
|
58334
58403
|
if (response) {
|
|
58335
|
-
|
|
58404
|
+
_context2.next = 12;
|
|
58336
58405
|
break;
|
|
58337
58406
|
}
|
|
58338
58407
|
|
|
@@ -58342,26 +58411,26 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58342
58411
|
});
|
|
58343
58412
|
|
|
58344
58413
|
if (!allForbidden) {
|
|
58345
|
-
|
|
58414
|
+
_context2.next = 11;
|
|
58346
58415
|
break;
|
|
58347
58416
|
}
|
|
58348
58417
|
|
|
58349
58418
|
// In the case for a 403, do not retry fetching
|
|
58350
58419
|
bail(new Error('Forbidden'));
|
|
58351
|
-
return
|
|
58420
|
+
return _context2.abrupt("return");
|
|
58352
58421
|
|
|
58353
58422
|
case 11:
|
|
58354
58423
|
throw new Error("Could not fetch ".concat(cid));
|
|
58355
58424
|
|
|
58356
58425
|
case 12:
|
|
58357
|
-
return
|
|
58426
|
+
return _context2.abrupt("return", response);
|
|
58358
58427
|
|
|
58359
58428
|
case 15:
|
|
58360
|
-
|
|
58361
|
-
|
|
58429
|
+
_context2.prev = 15;
|
|
58430
|
+
_context2.t0 = _context2["catch"](0);
|
|
58362
58431
|
|
|
58363
58432
|
if (!cid.includes('/')) {
|
|
58364
|
-
|
|
58433
|
+
_context2.next = 33;
|
|
58365
58434
|
break;
|
|
58366
58435
|
}
|
|
58367
58436
|
|
|
@@ -58374,8 +58443,8 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58374
58443
|
legacyUrls = creatorNodeGateways.map(function (gateway) {
|
|
58375
58444
|
return urlJoin(gateway, cid.split('/')[0]);
|
|
58376
58445
|
});
|
|
58377
|
-
|
|
58378
|
-
|
|
58446
|
+
_context2.prev = 20;
|
|
58447
|
+
_context2.next = 23;
|
|
58379
58448
|
return raceRequests(legacyUrls, callback, _objectSpread2({
|
|
58380
58449
|
method: 'get',
|
|
58381
58450
|
responseType: responseType
|
|
@@ -58384,22 +58453,22 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58384
58453
|
null);
|
|
58385
58454
|
|
|
58386
58455
|
case 23:
|
|
58387
|
-
_yield$raceRequests2 =
|
|
58456
|
+
_yield$raceRequests2 = _context2.sent;
|
|
58388
58457
|
_response = _yield$raceRequests2.response;
|
|
58389
58458
|
|
|
58390
58459
|
if (_response) {
|
|
58391
|
-
|
|
58460
|
+
_context2.next = 27;
|
|
58392
58461
|
break;
|
|
58393
58462
|
}
|
|
58394
58463
|
|
|
58395
58464
|
throw new Error("Could not fetch ".concat(cid, " via legacy method"));
|
|
58396
58465
|
|
|
58397
58466
|
case 27:
|
|
58398
|
-
return
|
|
58467
|
+
return _context2.abrupt("return", _response);
|
|
58399
58468
|
|
|
58400
58469
|
case 30:
|
|
58401
|
-
|
|
58402
|
-
|
|
58470
|
+
_context2.prev = 30;
|
|
58471
|
+
_context2.t1 = _context2["catch"](20);
|
|
58403
58472
|
throw new Error("Failed to retrieve ".concat(cid, " by legacy method"));
|
|
58404
58473
|
|
|
58405
58474
|
case 33:
|
|
@@ -58407,20 +58476,20 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58407
58476
|
|
|
58408
58477
|
case 34:
|
|
58409
58478
|
case "end":
|
|
58410
|
-
return
|
|
58479
|
+
return _context2.stop();
|
|
58411
58480
|
}
|
|
58412
58481
|
}
|
|
58413
|
-
},
|
|
58482
|
+
}, _callee2, null, [[0, 15], [20, 30]]);
|
|
58414
58483
|
}));
|
|
58415
58484
|
|
|
58416
|
-
return function (
|
|
58485
|
+
return function (_x5) {
|
|
58417
58486
|
return _ref.apply(this, arguments);
|
|
58418
58487
|
};
|
|
58419
58488
|
}(), {
|
|
58420
58489
|
minTimeout: 500,
|
|
58421
58490
|
maxTimeout: 4000,
|
|
58422
58491
|
factor: 3,
|
|
58423
|
-
retries:
|
|
58492
|
+
retries: 3,
|
|
58424
58493
|
onRetry: function onRetry(err, i) {
|
|
58425
58494
|
// eslint-disable-next-line no-console
|
|
58426
58495
|
console.log("FetchCID attempt ".concat(i, " error: ").concat(err));
|
|
@@ -58428,21 +58497,21 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58428
58497
|
});
|
|
58429
58498
|
|
|
58430
58499
|
case 8:
|
|
58431
|
-
return
|
|
58500
|
+
return _context3.abrupt("return", _context3.sent);
|
|
58432
58501
|
|
|
58433
58502
|
case 9:
|
|
58434
58503
|
case "end":
|
|
58435
|
-
return
|
|
58504
|
+
return _context3.stop();
|
|
58436
58505
|
}
|
|
58437
58506
|
}
|
|
58438
|
-
},
|
|
58507
|
+
}, _callee3);
|
|
58439
58508
|
}));
|
|
58440
58509
|
|
|
58441
|
-
function
|
|
58442
|
-
return
|
|
58510
|
+
function fetchCIDInternal(_x3, _x4) {
|
|
58511
|
+
return _fetchCIDInternal.apply(this, arguments);
|
|
58443
58512
|
}
|
|
58444
58513
|
|
|
58445
|
-
return
|
|
58514
|
+
return fetchCIDInternal;
|
|
58446
58515
|
}()
|
|
58447
58516
|
/**
|
|
58448
58517
|
* Fetches a file from Content Node with a given CID. Follows the same pattern
|
|
@@ -58456,12 +58525,12 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58456
58525
|
}, {
|
|
58457
58526
|
key: "downloadCID",
|
|
58458
58527
|
value: function () {
|
|
58459
|
-
var _downloadCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58528
|
+
var _downloadCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(cid, creatorNodeGateways, filename) {
|
|
58460
58529
|
var urls, _yield$raceRequests3, response;
|
|
58461
58530
|
|
|
58462
|
-
return regeneratorRuntime.wrap(function
|
|
58531
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
58463
58532
|
while (1) {
|
|
58464
|
-
switch (
|
|
58533
|
+
switch (_context4.prev = _context4.next) {
|
|
58465
58534
|
case 0:
|
|
58466
58535
|
urls = creatorNodeGateways.map(function (gateway) {
|
|
58467
58536
|
return urlJoin(gateway, cid, {
|
|
@@ -58470,8 +58539,8 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58470
58539
|
}
|
|
58471
58540
|
});
|
|
58472
58541
|
});
|
|
58473
|
-
|
|
58474
|
-
|
|
58542
|
+
_context4.prev = 1;
|
|
58543
|
+
_context4.next = 4;
|
|
58475
58544
|
return raceRequests(urls, function (url) {
|
|
58476
58545
|
return downloadURL(url, filename);
|
|
58477
58546
|
}, {
|
|
@@ -58481,24 +58550,24 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58481
58550
|
10000);
|
|
58482
58551
|
|
|
58483
58552
|
case 4:
|
|
58484
|
-
_yield$raceRequests3 =
|
|
58553
|
+
_yield$raceRequests3 = _context4.sent;
|
|
58485
58554
|
response = _yield$raceRequests3.response;
|
|
58486
|
-
return
|
|
58555
|
+
return _context4.abrupt("return", response);
|
|
58487
58556
|
|
|
58488
58557
|
case 9:
|
|
58489
|
-
|
|
58490
|
-
|
|
58558
|
+
_context4.prev = 9;
|
|
58559
|
+
_context4.t0 = _context4["catch"](1);
|
|
58491
58560
|
throw new Error("Failed to retrieve ".concat(cid));
|
|
58492
58561
|
|
|
58493
58562
|
case 12:
|
|
58494
58563
|
case "end":
|
|
58495
|
-
return
|
|
58564
|
+
return _context4.stop();
|
|
58496
58565
|
}
|
|
58497
58566
|
}
|
|
58498
|
-
},
|
|
58567
|
+
}, _callee4, null, [[1, 9]]);
|
|
58499
58568
|
}));
|
|
58500
58569
|
|
|
58501
|
-
function downloadCID(
|
|
58570
|
+
function downloadCID(_x6, _x7, _x8) {
|
|
58502
58571
|
return _downloadCID.apply(this, arguments);
|
|
58503
58572
|
}
|
|
58504
58573
|
|
|
@@ -58514,66 +58583,66 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58514
58583
|
}, {
|
|
58515
58584
|
key: "checkIfCidAvailable",
|
|
58516
58585
|
value: function () {
|
|
58517
|
-
var _checkIfCidAvailable = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58586
|
+
var _checkIfCidAvailable = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(cid, creatorNodeGateways) {
|
|
58518
58587
|
var exists;
|
|
58519
|
-
return regeneratorRuntime.wrap(function
|
|
58588
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
58520
58589
|
while (1) {
|
|
58521
|
-
switch (
|
|
58590
|
+
switch (_context6.prev = _context6.next) {
|
|
58522
58591
|
case 0:
|
|
58523
58592
|
exists = {};
|
|
58524
|
-
|
|
58593
|
+
_context6.next = 3;
|
|
58525
58594
|
return Promise.all(creatorNodeGateways.map( /*#__PURE__*/function () {
|
|
58526
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58595
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(gateway) {
|
|
58527
58596
|
var _yield$axios, status;
|
|
58528
58597
|
|
|
58529
|
-
return regeneratorRuntime.wrap(function
|
|
58598
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
58530
58599
|
while (1) {
|
|
58531
|
-
switch (
|
|
58600
|
+
switch (_context5.prev = _context5.next) {
|
|
58532
58601
|
case 0:
|
|
58533
|
-
|
|
58534
|
-
|
|
58602
|
+
_context5.prev = 0;
|
|
58603
|
+
_context5.next = 3;
|
|
58535
58604
|
return axios({
|
|
58536
58605
|
url: urlJoin(gateway, cid),
|
|
58537
58606
|
method: 'head'
|
|
58538
58607
|
});
|
|
58539
58608
|
|
|
58540
58609
|
case 3:
|
|
58541
|
-
_yield$axios =
|
|
58610
|
+
_yield$axios = _context5.sent;
|
|
58542
58611
|
status = _yield$axios.status;
|
|
58543
58612
|
exists[gateway] = status === 200;
|
|
58544
|
-
|
|
58613
|
+
_context5.next = 11;
|
|
58545
58614
|
break;
|
|
58546
58615
|
|
|
58547
58616
|
case 8:
|
|
58548
|
-
|
|
58549
|
-
|
|
58617
|
+
_context5.prev = 8;
|
|
58618
|
+
_context5.t0 = _context5["catch"](0);
|
|
58550
58619
|
exists[gateway] = false;
|
|
58551
58620
|
|
|
58552
58621
|
case 11:
|
|
58553
58622
|
case "end":
|
|
58554
|
-
return
|
|
58623
|
+
return _context5.stop();
|
|
58555
58624
|
}
|
|
58556
58625
|
}
|
|
58557
|
-
},
|
|
58626
|
+
}, _callee5, null, [[0, 8]]);
|
|
58558
58627
|
}));
|
|
58559
58628
|
|
|
58560
|
-
return function (
|
|
58629
|
+
return function (_x11) {
|
|
58561
58630
|
return _ref2.apply(this, arguments);
|
|
58562
58631
|
};
|
|
58563
58632
|
}()));
|
|
58564
58633
|
|
|
58565
58634
|
case 3:
|
|
58566
|
-
return
|
|
58635
|
+
return _context6.abrupt("return", exists);
|
|
58567
58636
|
|
|
58568
58637
|
case 4:
|
|
58569
58638
|
case "end":
|
|
58570
|
-
return
|
|
58639
|
+
return _context6.stop();
|
|
58571
58640
|
}
|
|
58572
58641
|
}
|
|
58573
|
-
},
|
|
58642
|
+
}, _callee6);
|
|
58574
58643
|
}));
|
|
58575
58644
|
|
|
58576
|
-
function checkIfCidAvailable(
|
|
58645
|
+
function checkIfCidAvailable(_x9, _x10) {
|
|
58577
58646
|
return _checkIfCidAvailable.apply(this, arguments);
|
|
58578
58647
|
}
|
|
58579
58648
|
|
|
@@ -58587,40 +58656,40 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
58587
58656
|
}, {
|
|
58588
58657
|
key: "uploadImage",
|
|
58589
58658
|
value: function () {
|
|
58590
|
-
var _uploadImage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
58659
|
+
var _uploadImage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(file, square) {
|
|
58591
58660
|
var timeoutMs,
|
|
58592
58661
|
resp,
|
|
58593
|
-
|
|
58594
|
-
return regeneratorRuntime.wrap(function
|
|
58662
|
+
_args7 = arguments;
|
|
58663
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
58595
58664
|
while (1) {
|
|
58596
|
-
switch (
|
|
58665
|
+
switch (_context7.prev = _context7.next) {
|
|
58597
58666
|
case 0:
|
|
58598
|
-
timeoutMs =
|
|
58667
|
+
timeoutMs = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : null;
|
|
58599
58668
|
this.REQUIRES(Services.CREATOR_NODE);
|
|
58600
58669
|
this.FILE_IS_VALID(file); // Assign a creator_node_endpoint to the user if necessary
|
|
58601
58670
|
|
|
58602
|
-
|
|
58671
|
+
_context7.next = 5;
|
|
58603
58672
|
return this.User.assignReplicaSetIfNecessary();
|
|
58604
58673
|
|
|
58605
58674
|
case 5:
|
|
58606
|
-
|
|
58675
|
+
_context7.next = 7;
|
|
58607
58676
|
return this.creatorNode.uploadImage(file, square,
|
|
58608
58677
|
/* onProgress */
|
|
58609
58678
|
undefined, timeoutMs);
|
|
58610
58679
|
|
|
58611
58680
|
case 7:
|
|
58612
|
-
resp =
|
|
58613
|
-
return
|
|
58681
|
+
resp = _context7.sent;
|
|
58682
|
+
return _context7.abrupt("return", resp);
|
|
58614
58683
|
|
|
58615
58684
|
case 9:
|
|
58616
58685
|
case "end":
|
|
58617
|
-
return
|
|
58686
|
+
return _context7.stop();
|
|
58618
58687
|
}
|
|
58619
58688
|
}
|
|
58620
|
-
},
|
|
58689
|
+
}, _callee7, this);
|
|
58621
58690
|
}));
|
|
58622
58691
|
|
|
58623
|
-
function uploadImage(
|
|
58692
|
+
function uploadImage(_x12, _x13) {
|
|
58624
58693
|
return _uploadImage.apply(this, arguments);
|
|
58625
58694
|
}
|
|
58626
58695
|
|
|
@@ -59769,7 +59838,7 @@ var AudiusLibs = /*#__PURE__*/function () {
|
|
|
59769
59838
|
this.Account = _construct(Account, [this.User].concat(services));
|
|
59770
59839
|
this.Track = _construct(Track, services);
|
|
59771
59840
|
this.Playlist = _construct(Playlists, services);
|
|
59772
|
-
this.File = _construct(File, [this.User].concat(services));
|
|
59841
|
+
this.File = _construct(File, [this.User, this.ServiceProvider].concat(services));
|
|
59773
59842
|
this.Rewards = _construct(Rewards, [this.ServiceProvider].concat(services));
|
|
59774
59843
|
this.Reactions = _construct(Reactions, services);
|
|
59775
59844
|
this.EntityManager = _construct(EntityManager, services);
|