@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/native-libs.js
CHANGED
|
@@ -514,9 +514,9 @@ if (typeof window !== 'undefined' && window && window.Web3) {
|
|
|
514
514
|
var LibsWeb3 = Web3;
|
|
515
515
|
|
|
516
516
|
var name = "@audius/sdk";
|
|
517
|
-
var version = "1.0.
|
|
517
|
+
var version = "1.0.19";
|
|
518
518
|
var audius = {
|
|
519
|
-
releaseSHA: "
|
|
519
|
+
releaseSHA: "0a307f67af9a7dc7a6128b181bce45d92d9492df"
|
|
520
520
|
};
|
|
521
521
|
var description = "";
|
|
522
522
|
var main = "dist/index.cjs.js";
|
|
@@ -41051,23 +41051,29 @@ var UserReplicaSetManagerClient = /*#__PURE__*/function (_ContractClient) {
|
|
|
41051
41051
|
return UserReplicaSetManagerClient;
|
|
41052
41052
|
}(ContractClient);
|
|
41053
41053
|
|
|
41054
|
-
var Action
|
|
41054
|
+
var Action;
|
|
41055
41055
|
|
|
41056
41056
|
(function (Action) {
|
|
41057
41057
|
Action["CREATE"] = "Create";
|
|
41058
41058
|
Action["UPDATE"] = "Update";
|
|
41059
41059
|
Action["DELETE"] = "Delete";
|
|
41060
41060
|
Action["VERIFY"] = "Verify";
|
|
41061
|
-
|
|
41061
|
+
Action["FOLLOW"] = "Follow";
|
|
41062
|
+
Action["UNFOLLOW"] = "Unfollow";
|
|
41063
|
+
Action["SAVE"] = "Save";
|
|
41064
|
+
Action["UNSAVE"] = "Unsave";
|
|
41065
|
+
Action["REPOST"] = "Repost";
|
|
41066
|
+
Action["UNREPOST"] = "Unrepost";
|
|
41067
|
+
})(Action || (Action = {}));
|
|
41062
41068
|
|
|
41063
|
-
var EntityType
|
|
41069
|
+
var EntityType;
|
|
41064
41070
|
|
|
41065
41071
|
(function (EntityType) {
|
|
41066
41072
|
EntityType["PLAYLIST"] = "Playlist";
|
|
41067
41073
|
EntityType["TRACK"] = "Track";
|
|
41068
41074
|
EntityType["USER"] = "User";
|
|
41069
41075
|
EntityType["USER_REPLICA_SET"] = "UserReplicaSet";
|
|
41070
|
-
})(EntityType
|
|
41076
|
+
})(EntityType || (EntityType = {}));
|
|
41071
41077
|
/**
|
|
41072
41078
|
* Generic management of Audius Data entities
|
|
41073
41079
|
**/
|
|
@@ -41229,8 +41235,8 @@ var EntityManagerClient = /*#__PURE__*/function (_ContractClient) {
|
|
|
41229
41235
|
|
|
41230
41236
|
return EntityManagerClient;
|
|
41231
41237
|
}(ContractClient);
|
|
41232
|
-
EntityManagerClient.Action = Action
|
|
41233
|
-
EntityManagerClient.EntityType = EntityType
|
|
41238
|
+
EntityManagerClient.Action = Action;
|
|
41239
|
+
EntityManagerClient.EntityType = EntityType;
|
|
41234
41240
|
|
|
41235
41241
|
var abi = [
|
|
41236
41242
|
{
|
|
@@ -48139,17 +48145,18 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48139
48145
|
|
|
48140
48146
|
var _super = _createSuper(File);
|
|
48141
48147
|
|
|
48142
|
-
function File(user) {
|
|
48148
|
+
function File(user, serviceProvider) {
|
|
48143
48149
|
var _this;
|
|
48144
48150
|
|
|
48145
48151
|
_classCallCheck(this, File);
|
|
48146
48152
|
|
|
48147
|
-
for (var _len = arguments.length, args = new Array(_len >
|
|
48148
|
-
args[_key -
|
|
48153
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
48154
|
+
args[_key - 2] = arguments[_key];
|
|
48149
48155
|
}
|
|
48150
48156
|
|
|
48151
48157
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
48152
48158
|
_this.User = user;
|
|
48159
|
+
_this.ServiceProvider = serviceProvider;
|
|
48153
48160
|
return _this;
|
|
48154
48161
|
}
|
|
48155
48162
|
/**
|
|
@@ -48165,21 +48172,86 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48165
48172
|
_createClass(File, [{
|
|
48166
48173
|
key: "fetchCID",
|
|
48167
48174
|
value: function () {
|
|
48168
|
-
var _fetchCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
48175
|
+
var _fetchCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(cid, creatorNodeGateways) {
|
|
48176
|
+
var callback,
|
|
48177
|
+
responseType,
|
|
48178
|
+
trackId,
|
|
48179
|
+
premiumContentHeaders,
|
|
48180
|
+
replicaSetAttempt,
|
|
48181
|
+
allCreatorNodes,
|
|
48182
|
+
allCreatorNodeEndpoints,
|
|
48183
|
+
allNodesAttempt,
|
|
48184
|
+
_args = arguments;
|
|
48185
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
48186
|
+
while (1) {
|
|
48187
|
+
switch (_context.prev = _context.next) {
|
|
48188
|
+
case 0:
|
|
48189
|
+
callback = _args.length > 2 && _args[2] !== undefined ? _args[2] : null;
|
|
48190
|
+
responseType = _args.length > 3 && _args[3] !== undefined ? _args[3] : 'blob';
|
|
48191
|
+
trackId = _args.length > 4 && _args[4] !== undefined ? _args[4] : null;
|
|
48192
|
+
premiumContentHeaders = _args.length > 5 && _args[5] !== undefined ? _args[5] : {};
|
|
48193
|
+
_context.prev = 4;
|
|
48194
|
+
_context.next = 7;
|
|
48195
|
+
return this.fetchCIDInternal(cid, creatorNodeGateways, callback, responseType, trackId, premiumContentHeaders);
|
|
48196
|
+
|
|
48197
|
+
case 7:
|
|
48198
|
+
replicaSetAttempt = _context.sent;
|
|
48199
|
+
return _context.abrupt("return", replicaSetAttempt);
|
|
48200
|
+
|
|
48201
|
+
case 11:
|
|
48202
|
+
_context.prev = 11;
|
|
48203
|
+
_context.t0 = _context["catch"](4);
|
|
48204
|
+
// In the case we can't find the CID from anywhere in the user's replica set,
|
|
48205
|
+
// retry the whole network
|
|
48206
|
+
console.error(_context.t0);
|
|
48207
|
+
_context.next = 16;
|
|
48208
|
+
return this.ServiceProvider.listCreatorNodes();
|
|
48209
|
+
|
|
48210
|
+
case 16:
|
|
48211
|
+
allCreatorNodes = _context.sent;
|
|
48212
|
+
allCreatorNodeEndpoints = allCreatorNodes.map(function (node) {
|
|
48213
|
+
return urlJoin(node.endpoint, 'ipfs');
|
|
48214
|
+
}); // Re-throw whatever error might happen here
|
|
48215
|
+
|
|
48216
|
+
_context.next = 20;
|
|
48217
|
+
return this.fetchCIDInternal(cid, allCreatorNodeEndpoints, callback, responseType, trackId, premiumContentHeaders);
|
|
48218
|
+
|
|
48219
|
+
case 20:
|
|
48220
|
+
allNodesAttempt = _context.sent;
|
|
48221
|
+
return _context.abrupt("return", allNodesAttempt);
|
|
48222
|
+
|
|
48223
|
+
case 22:
|
|
48224
|
+
case "end":
|
|
48225
|
+
return _context.stop();
|
|
48226
|
+
}
|
|
48227
|
+
}
|
|
48228
|
+
}, _callee, this, [[4, 11]]);
|
|
48229
|
+
}));
|
|
48230
|
+
|
|
48231
|
+
function fetchCID(_x, _x2) {
|
|
48232
|
+
return _fetchCID.apply(this, arguments);
|
|
48233
|
+
}
|
|
48234
|
+
|
|
48235
|
+
return fetchCID;
|
|
48236
|
+
}()
|
|
48237
|
+
}, {
|
|
48238
|
+
key: "fetchCIDInternal",
|
|
48239
|
+
value: function () {
|
|
48240
|
+
var _fetchCIDInternal = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(cid, creatorNodeGateways) {
|
|
48169
48241
|
var callback,
|
|
48170
48242
|
responseType,
|
|
48171
48243
|
trackId,
|
|
48172
48244
|
premiumContentHeaders,
|
|
48173
48245
|
urls,
|
|
48174
|
-
|
|
48175
|
-
return regeneratorRuntime.wrap(function
|
|
48246
|
+
_args3 = arguments;
|
|
48247
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
48176
48248
|
while (1) {
|
|
48177
|
-
switch (
|
|
48249
|
+
switch (_context3.prev = _context3.next) {
|
|
48178
48250
|
case 0:
|
|
48179
|
-
callback =
|
|
48180
|
-
responseType =
|
|
48181
|
-
trackId =
|
|
48182
|
-
premiumContentHeaders =
|
|
48251
|
+
callback = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : null;
|
|
48252
|
+
responseType = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : 'blob';
|
|
48253
|
+
trackId = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : null;
|
|
48254
|
+
premiumContentHeaders = _args3.length > 5 && _args3[5] !== undefined ? _args3[5] : {};
|
|
48183
48255
|
urls = [];
|
|
48184
48256
|
creatorNodeGateways.forEach(function (gateway) {
|
|
48185
48257
|
var gatewayWithCid = urlJoin(gateway, cid);
|
|
@@ -48190,17 +48262,17 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48190
48262
|
});
|
|
48191
48263
|
urls.push(gatewayWithCid);
|
|
48192
48264
|
});
|
|
48193
|
-
|
|
48265
|
+
_context3.next = 8;
|
|
48194
48266
|
return retry( /*#__PURE__*/function () {
|
|
48195
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
48267
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(bail) {
|
|
48196
48268
|
var _yield$raceRequests, response, errored, allForbidden, legacyUrls, _yield$raceRequests2, _response;
|
|
48197
48269
|
|
|
48198
|
-
return regeneratorRuntime.wrap(function
|
|
48270
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
48199
48271
|
while (1) {
|
|
48200
|
-
switch (
|
|
48272
|
+
switch (_context2.prev = _context2.next) {
|
|
48201
48273
|
case 0:
|
|
48202
|
-
|
|
48203
|
-
|
|
48274
|
+
_context2.prev = 0;
|
|
48275
|
+
_context2.next = 3;
|
|
48204
48276
|
return raceRequests(urls, callback, _objectSpread2({
|
|
48205
48277
|
method: 'get',
|
|
48206
48278
|
responseType: responseType
|
|
@@ -48209,12 +48281,12 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48209
48281
|
null);
|
|
48210
48282
|
|
|
48211
48283
|
case 3:
|
|
48212
|
-
_yield$raceRequests =
|
|
48284
|
+
_yield$raceRequests = _context2.sent;
|
|
48213
48285
|
response = _yield$raceRequests.response;
|
|
48214
48286
|
errored = _yield$raceRequests.errored;
|
|
48215
48287
|
|
|
48216
48288
|
if (response) {
|
|
48217
|
-
|
|
48289
|
+
_context2.next = 12;
|
|
48218
48290
|
break;
|
|
48219
48291
|
}
|
|
48220
48292
|
|
|
@@ -48224,26 +48296,26 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48224
48296
|
});
|
|
48225
48297
|
|
|
48226
48298
|
if (!allForbidden) {
|
|
48227
|
-
|
|
48299
|
+
_context2.next = 11;
|
|
48228
48300
|
break;
|
|
48229
48301
|
}
|
|
48230
48302
|
|
|
48231
48303
|
// In the case for a 403, do not retry fetching
|
|
48232
48304
|
bail(new Error('Forbidden'));
|
|
48233
|
-
return
|
|
48305
|
+
return _context2.abrupt("return");
|
|
48234
48306
|
|
|
48235
48307
|
case 11:
|
|
48236
48308
|
throw new Error("Could not fetch ".concat(cid));
|
|
48237
48309
|
|
|
48238
48310
|
case 12:
|
|
48239
|
-
return
|
|
48311
|
+
return _context2.abrupt("return", response);
|
|
48240
48312
|
|
|
48241
48313
|
case 15:
|
|
48242
|
-
|
|
48243
|
-
|
|
48314
|
+
_context2.prev = 15;
|
|
48315
|
+
_context2.t0 = _context2["catch"](0);
|
|
48244
48316
|
|
|
48245
48317
|
if (!cid.includes('/')) {
|
|
48246
|
-
|
|
48318
|
+
_context2.next = 33;
|
|
48247
48319
|
break;
|
|
48248
48320
|
}
|
|
48249
48321
|
|
|
@@ -48256,8 +48328,8 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48256
48328
|
legacyUrls = creatorNodeGateways.map(function (gateway) {
|
|
48257
48329
|
return urlJoin(gateway, cid.split('/')[0]);
|
|
48258
48330
|
});
|
|
48259
|
-
|
|
48260
|
-
|
|
48331
|
+
_context2.prev = 20;
|
|
48332
|
+
_context2.next = 23;
|
|
48261
48333
|
return raceRequests(legacyUrls, callback, _objectSpread2({
|
|
48262
48334
|
method: 'get',
|
|
48263
48335
|
responseType: responseType
|
|
@@ -48266,22 +48338,22 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48266
48338
|
null);
|
|
48267
48339
|
|
|
48268
48340
|
case 23:
|
|
48269
|
-
_yield$raceRequests2 =
|
|
48341
|
+
_yield$raceRequests2 = _context2.sent;
|
|
48270
48342
|
_response = _yield$raceRequests2.response;
|
|
48271
48343
|
|
|
48272
48344
|
if (_response) {
|
|
48273
|
-
|
|
48345
|
+
_context2.next = 27;
|
|
48274
48346
|
break;
|
|
48275
48347
|
}
|
|
48276
48348
|
|
|
48277
48349
|
throw new Error("Could not fetch ".concat(cid, " via legacy method"));
|
|
48278
48350
|
|
|
48279
48351
|
case 27:
|
|
48280
|
-
return
|
|
48352
|
+
return _context2.abrupt("return", _response);
|
|
48281
48353
|
|
|
48282
48354
|
case 30:
|
|
48283
|
-
|
|
48284
|
-
|
|
48355
|
+
_context2.prev = 30;
|
|
48356
|
+
_context2.t1 = _context2["catch"](20);
|
|
48285
48357
|
throw new Error("Failed to retrieve ".concat(cid, " by legacy method"));
|
|
48286
48358
|
|
|
48287
48359
|
case 33:
|
|
@@ -48289,20 +48361,20 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48289
48361
|
|
|
48290
48362
|
case 34:
|
|
48291
48363
|
case "end":
|
|
48292
|
-
return
|
|
48364
|
+
return _context2.stop();
|
|
48293
48365
|
}
|
|
48294
48366
|
}
|
|
48295
|
-
},
|
|
48367
|
+
}, _callee2, null, [[0, 15], [20, 30]]);
|
|
48296
48368
|
}));
|
|
48297
48369
|
|
|
48298
|
-
return function (
|
|
48370
|
+
return function (_x5) {
|
|
48299
48371
|
return _ref.apply(this, arguments);
|
|
48300
48372
|
};
|
|
48301
48373
|
}(), {
|
|
48302
48374
|
minTimeout: 500,
|
|
48303
48375
|
maxTimeout: 4000,
|
|
48304
48376
|
factor: 3,
|
|
48305
|
-
retries:
|
|
48377
|
+
retries: 3,
|
|
48306
48378
|
onRetry: function onRetry(err, i) {
|
|
48307
48379
|
// eslint-disable-next-line no-console
|
|
48308
48380
|
console.log("FetchCID attempt ".concat(i, " error: ").concat(err));
|
|
@@ -48310,21 +48382,21 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48310
48382
|
});
|
|
48311
48383
|
|
|
48312
48384
|
case 8:
|
|
48313
|
-
return
|
|
48385
|
+
return _context3.abrupt("return", _context3.sent);
|
|
48314
48386
|
|
|
48315
48387
|
case 9:
|
|
48316
48388
|
case "end":
|
|
48317
|
-
return
|
|
48389
|
+
return _context3.stop();
|
|
48318
48390
|
}
|
|
48319
48391
|
}
|
|
48320
|
-
},
|
|
48392
|
+
}, _callee3);
|
|
48321
48393
|
}));
|
|
48322
48394
|
|
|
48323
|
-
function
|
|
48324
|
-
return
|
|
48395
|
+
function fetchCIDInternal(_x3, _x4) {
|
|
48396
|
+
return _fetchCIDInternal.apply(this, arguments);
|
|
48325
48397
|
}
|
|
48326
48398
|
|
|
48327
|
-
return
|
|
48399
|
+
return fetchCIDInternal;
|
|
48328
48400
|
}()
|
|
48329
48401
|
/**
|
|
48330
48402
|
* Fetches a file from Content Node with a given CID. Follows the same pattern
|
|
@@ -48338,12 +48410,12 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48338
48410
|
}, {
|
|
48339
48411
|
key: "downloadCID",
|
|
48340
48412
|
value: function () {
|
|
48341
|
-
var _downloadCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
48413
|
+
var _downloadCID = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(cid, creatorNodeGateways, filename) {
|
|
48342
48414
|
var urls, _yield$raceRequests3, response;
|
|
48343
48415
|
|
|
48344
|
-
return regeneratorRuntime.wrap(function
|
|
48416
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
48345
48417
|
while (1) {
|
|
48346
|
-
switch (
|
|
48418
|
+
switch (_context4.prev = _context4.next) {
|
|
48347
48419
|
case 0:
|
|
48348
48420
|
urls = creatorNodeGateways.map(function (gateway) {
|
|
48349
48421
|
return urlJoin(gateway, cid, {
|
|
@@ -48352,8 +48424,8 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48352
48424
|
}
|
|
48353
48425
|
});
|
|
48354
48426
|
});
|
|
48355
|
-
|
|
48356
|
-
|
|
48427
|
+
_context4.prev = 1;
|
|
48428
|
+
_context4.next = 4;
|
|
48357
48429
|
return raceRequests(urls, function (url) {
|
|
48358
48430
|
return downloadURL(url, filename);
|
|
48359
48431
|
}, {
|
|
@@ -48363,24 +48435,24 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48363
48435
|
10000);
|
|
48364
48436
|
|
|
48365
48437
|
case 4:
|
|
48366
|
-
_yield$raceRequests3 =
|
|
48438
|
+
_yield$raceRequests3 = _context4.sent;
|
|
48367
48439
|
response = _yield$raceRequests3.response;
|
|
48368
|
-
return
|
|
48440
|
+
return _context4.abrupt("return", response);
|
|
48369
48441
|
|
|
48370
48442
|
case 9:
|
|
48371
|
-
|
|
48372
|
-
|
|
48443
|
+
_context4.prev = 9;
|
|
48444
|
+
_context4.t0 = _context4["catch"](1);
|
|
48373
48445
|
throw new Error("Failed to retrieve ".concat(cid));
|
|
48374
48446
|
|
|
48375
48447
|
case 12:
|
|
48376
48448
|
case "end":
|
|
48377
|
-
return
|
|
48449
|
+
return _context4.stop();
|
|
48378
48450
|
}
|
|
48379
48451
|
}
|
|
48380
|
-
},
|
|
48452
|
+
}, _callee4, null, [[1, 9]]);
|
|
48381
48453
|
}));
|
|
48382
48454
|
|
|
48383
|
-
function downloadCID(
|
|
48455
|
+
function downloadCID(_x6, _x7, _x8) {
|
|
48384
48456
|
return _downloadCID.apply(this, arguments);
|
|
48385
48457
|
}
|
|
48386
48458
|
|
|
@@ -48396,66 +48468,66 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48396
48468
|
}, {
|
|
48397
48469
|
key: "checkIfCidAvailable",
|
|
48398
48470
|
value: function () {
|
|
48399
|
-
var _checkIfCidAvailable = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
48471
|
+
var _checkIfCidAvailable = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(cid, creatorNodeGateways) {
|
|
48400
48472
|
var exists;
|
|
48401
|
-
return regeneratorRuntime.wrap(function
|
|
48473
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
48402
48474
|
while (1) {
|
|
48403
|
-
switch (
|
|
48475
|
+
switch (_context6.prev = _context6.next) {
|
|
48404
48476
|
case 0:
|
|
48405
48477
|
exists = {};
|
|
48406
|
-
|
|
48478
|
+
_context6.next = 3;
|
|
48407
48479
|
return Promise.all(creatorNodeGateways.map( /*#__PURE__*/function () {
|
|
48408
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
48480
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(gateway) {
|
|
48409
48481
|
var _yield$axios, status;
|
|
48410
48482
|
|
|
48411
|
-
return regeneratorRuntime.wrap(function
|
|
48483
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
48412
48484
|
while (1) {
|
|
48413
|
-
switch (
|
|
48485
|
+
switch (_context5.prev = _context5.next) {
|
|
48414
48486
|
case 0:
|
|
48415
|
-
|
|
48416
|
-
|
|
48487
|
+
_context5.prev = 0;
|
|
48488
|
+
_context5.next = 3;
|
|
48417
48489
|
return axios({
|
|
48418
48490
|
url: urlJoin(gateway, cid),
|
|
48419
48491
|
method: 'head'
|
|
48420
48492
|
});
|
|
48421
48493
|
|
|
48422
48494
|
case 3:
|
|
48423
|
-
_yield$axios =
|
|
48495
|
+
_yield$axios = _context5.sent;
|
|
48424
48496
|
status = _yield$axios.status;
|
|
48425
48497
|
exists[gateway] = status === 200;
|
|
48426
|
-
|
|
48498
|
+
_context5.next = 11;
|
|
48427
48499
|
break;
|
|
48428
48500
|
|
|
48429
48501
|
case 8:
|
|
48430
|
-
|
|
48431
|
-
|
|
48502
|
+
_context5.prev = 8;
|
|
48503
|
+
_context5.t0 = _context5["catch"](0);
|
|
48432
48504
|
exists[gateway] = false;
|
|
48433
48505
|
|
|
48434
48506
|
case 11:
|
|
48435
48507
|
case "end":
|
|
48436
|
-
return
|
|
48508
|
+
return _context5.stop();
|
|
48437
48509
|
}
|
|
48438
48510
|
}
|
|
48439
|
-
},
|
|
48511
|
+
}, _callee5, null, [[0, 8]]);
|
|
48440
48512
|
}));
|
|
48441
48513
|
|
|
48442
|
-
return function (
|
|
48514
|
+
return function (_x11) {
|
|
48443
48515
|
return _ref2.apply(this, arguments);
|
|
48444
48516
|
};
|
|
48445
48517
|
}()));
|
|
48446
48518
|
|
|
48447
48519
|
case 3:
|
|
48448
|
-
return
|
|
48520
|
+
return _context6.abrupt("return", exists);
|
|
48449
48521
|
|
|
48450
48522
|
case 4:
|
|
48451
48523
|
case "end":
|
|
48452
|
-
return
|
|
48524
|
+
return _context6.stop();
|
|
48453
48525
|
}
|
|
48454
48526
|
}
|
|
48455
|
-
},
|
|
48527
|
+
}, _callee6);
|
|
48456
48528
|
}));
|
|
48457
48529
|
|
|
48458
|
-
function checkIfCidAvailable(
|
|
48530
|
+
function checkIfCidAvailable(_x9, _x10) {
|
|
48459
48531
|
return _checkIfCidAvailable.apply(this, arguments);
|
|
48460
48532
|
}
|
|
48461
48533
|
|
|
@@ -48469,40 +48541,40 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
48469
48541
|
}, {
|
|
48470
48542
|
key: "uploadImage",
|
|
48471
48543
|
value: function () {
|
|
48472
|
-
var _uploadImage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
48544
|
+
var _uploadImage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(file, square) {
|
|
48473
48545
|
var timeoutMs,
|
|
48474
48546
|
resp,
|
|
48475
|
-
|
|
48476
|
-
return regeneratorRuntime.wrap(function
|
|
48547
|
+
_args7 = arguments;
|
|
48548
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
48477
48549
|
while (1) {
|
|
48478
|
-
switch (
|
|
48550
|
+
switch (_context7.prev = _context7.next) {
|
|
48479
48551
|
case 0:
|
|
48480
|
-
timeoutMs =
|
|
48552
|
+
timeoutMs = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : null;
|
|
48481
48553
|
this.REQUIRES(Services.CREATOR_NODE);
|
|
48482
48554
|
this.FILE_IS_VALID(file); // Assign a creator_node_endpoint to the user if necessary
|
|
48483
48555
|
|
|
48484
|
-
|
|
48556
|
+
_context7.next = 5;
|
|
48485
48557
|
return this.User.assignReplicaSetIfNecessary();
|
|
48486
48558
|
|
|
48487
48559
|
case 5:
|
|
48488
|
-
|
|
48560
|
+
_context7.next = 7;
|
|
48489
48561
|
return this.creatorNode.uploadImage(file, square,
|
|
48490
48562
|
/* onProgress */
|
|
48491
48563
|
undefined, timeoutMs);
|
|
48492
48564
|
|
|
48493
48565
|
case 7:
|
|
48494
|
-
resp =
|
|
48495
|
-
return
|
|
48566
|
+
resp = _context7.sent;
|
|
48567
|
+
return _context7.abrupt("return", resp);
|
|
48496
48568
|
|
|
48497
48569
|
case 9:
|
|
48498
48570
|
case "end":
|
|
48499
|
-
return
|
|
48571
|
+
return _context7.stop();
|
|
48500
48572
|
}
|
|
48501
48573
|
}
|
|
48502
|
-
},
|
|
48574
|
+
}, _callee7, this);
|
|
48503
48575
|
}));
|
|
48504
48576
|
|
|
48505
|
-
function uploadImage(
|
|
48577
|
+
function uploadImage(_x12, _x13) {
|
|
48506
48578
|
return _uploadImage.apply(this, arguments);
|
|
48507
48579
|
}
|
|
48508
48580
|
|
|
@@ -48836,34 +48908,12 @@ var ServiceProvider = /*#__PURE__*/function (_Base) {
|
|
|
48836
48908
|
return ServiceProvider;
|
|
48837
48909
|
}(Base);
|
|
48838
48910
|
|
|
48839
|
-
var Action;
|
|
48840
|
-
|
|
48841
|
-
(function (Action) {
|
|
48842
|
-
Action["CREATE"] = "Create";
|
|
48843
|
-
Action["UPDATE"] = "Update";
|
|
48844
|
-
Action["DELETE"] = "Delete";
|
|
48845
|
-
Action["FOLLOW"] = "Follow";
|
|
48846
|
-
Action["UNFOLLOW"] = "Unfollow";
|
|
48847
|
-
Action["SAVE"] = "Save";
|
|
48848
|
-
Action["UNSAVE"] = "Unsave";
|
|
48849
|
-
Action["REPOST"] = "Repost";
|
|
48850
|
-
Action["UNREPOST"] = "Unrepost";
|
|
48851
|
-
})(Action || (Action = {}));
|
|
48852
|
-
|
|
48853
|
-
var EntityType;
|
|
48854
|
-
|
|
48855
|
-
(function (EntityType) {
|
|
48856
|
-
EntityType["TRACK"] = "Track";
|
|
48857
|
-
EntityType["PLAYLIST"] = "Playlist";
|
|
48858
|
-
EntityType["USER"] = "User";
|
|
48859
|
-
})(EntityType || (EntityType = {}));
|
|
48860
48911
|
/*
|
|
48861
48912
|
API surface for updated data contract interactions.
|
|
48862
48913
|
Provides simplified entity management in a generic fashion
|
|
48863
48914
|
Handles metadata + file upload etc. for entities such as Playlist/Track/User
|
|
48864
48915
|
*/
|
|
48865
48916
|
|
|
48866
|
-
|
|
48867
48917
|
var EntityManager = /*#__PURE__*/function (_Base) {
|
|
48868
48918
|
_inherits(EntityManager, _Base);
|
|
48869
48919
|
|
|
@@ -48931,6 +48981,8 @@ var EntityManager = /*#__PURE__*/function (_Base) {
|
|
|
48931
48981
|
_this.unsavePlaylist = _this.createSocialMethod(EntityType.PLAYLIST, Action.UNSAVE);
|
|
48932
48982
|
_this.repostTrack = _this.createSocialMethod(EntityType.TRACK, Action.REPOST);
|
|
48933
48983
|
_this.unrepostTrack = _this.createSocialMethod(EntityType.TRACK, Action.UNREPOST);
|
|
48984
|
+
_this.repostPlaylist = _this.createSocialMethod(EntityType.PLAYLIST, Action.REPOST);
|
|
48985
|
+
_this.unrepostPlaylist = _this.createSocialMethod(EntityType.PLAYLIST, Action.UNREPOST);
|
|
48934
48986
|
return _this;
|
|
48935
48987
|
}
|
|
48936
48988
|
|
|
@@ -50023,7 +50075,7 @@ var AudiusLibs = /*#__PURE__*/function () {
|
|
|
50023
50075
|
this.Account = _construct(Account, [this.User].concat(services));
|
|
50024
50076
|
this.Track = _construct(Track, services);
|
|
50025
50077
|
this.Playlist = _construct(Playlists, services);
|
|
50026
|
-
this.File = _construct(File, [this.User].concat(services));
|
|
50078
|
+
this.File = _construct(File, [this.User, this.ServiceProvider].concat(services));
|
|
50027
50079
|
this.Rewards = _construct(Rewards, [this.ServiceProvider].concat(services));
|
|
50028
50080
|
this.Reactions = _construct(Reactions, services);
|
|
50029
50081
|
this.EntityManager = _construct(EntityManager, services);
|