@audius/sdk 1.0.36 → 1.0.37
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/Account.d.ts +4 -4
- package/dist/api/Track.d.ts +4 -4
- package/dist/api/Users.d.ts +4 -5
- package/dist/index.cjs.js +148 -363
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +148 -363
- package/dist/index.esm.js.map +1 -1
- package/dist/legacy.js +148 -363
- package/dist/legacy.js.map +1 -1
- package/dist/native-libs.js +148 -363
- package/dist/native-libs.js.map +1 -1
- package/package.json +2 -2
- package/src/api/Account.ts +10 -31
- package/src/api/Track.ts +39 -88
- package/src/api/Users.ts +78 -196
- package/src/sanityChecks/rolloverNodes.ts +1 -5
package/dist/index.cjs.js
CHANGED
|
@@ -37174,9 +37174,9 @@ exports.ChatPermission = void 0;
|
|
|
37174
37174
|
})(exports.ChatPermission || (exports.ChatPermission = {}));
|
|
37175
37175
|
|
|
37176
37176
|
var name = "@audius/sdk";
|
|
37177
|
-
var version = "1.0.
|
|
37177
|
+
var version = "1.0.37";
|
|
37178
37178
|
var audius = {
|
|
37179
|
-
releaseSHA: "
|
|
37179
|
+
releaseSHA: "dd0ddae94286c577c8a34ada50f2f79f613b55d2"
|
|
37180
37180
|
};
|
|
37181
37181
|
var description = "";
|
|
37182
37182
|
var main = "dist/index.cjs.js";
|
|
@@ -55194,14 +55194,12 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
55194
55194
|
userBankOutcomes,
|
|
55195
55195
|
feePayerOverride,
|
|
55196
55196
|
generateRecoveryLink,
|
|
55197
|
-
useEntityManager,
|
|
55198
55197
|
phases,
|
|
55199
55198
|
phase,
|
|
55200
55199
|
userId,
|
|
55201
55200
|
blockHash,
|
|
55202
55201
|
blockNumber,
|
|
55203
55202
|
ownerWallet,
|
|
55204
|
-
response,
|
|
55205
55203
|
newMetadata,
|
|
55206
55204
|
_args4 = arguments;
|
|
55207
55205
|
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
@@ -55216,7 +55214,6 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
55216
55214
|
userBankOutcomes = _args4.length > 8 && _args4[8] !== undefined ? _args4[8] : {};
|
|
55217
55215
|
feePayerOverride = _args4.length > 9 && _args4[9] !== undefined ? _args4[9] : null;
|
|
55218
55216
|
generateRecoveryLink = _args4.length > 10 && _args4[10] !== undefined ? _args4[10] : true;
|
|
55219
|
-
useEntityManager = _args4.length > 11 && _args4[11] !== undefined ? _args4[11] : false;
|
|
55220
55217
|
phases = {
|
|
55221
55218
|
ADD_REPLICA_SET: 'ADD_REPLICA_SET',
|
|
55222
55219
|
CREATE_USER_RECORD: 'CREATE_USER_RECORD',
|
|
@@ -55226,50 +55223,50 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
55226
55223
|
ADD_USER: 'ADD_USER'
|
|
55227
55224
|
};
|
|
55228
55225
|
phase = '';
|
|
55229
|
-
_context4.prev =
|
|
55226
|
+
_context4.prev = 10;
|
|
55230
55227
|
this.REQUIRES(Services.CREATOR_NODE, Services.IDENTITY_SERVICE);
|
|
55231
55228
|
|
|
55232
55229
|
if (!this.web3Manager.web3IsExternal()) {
|
|
55233
|
-
_context4.next =
|
|
55230
|
+
_context4.next = 18;
|
|
55234
55231
|
break;
|
|
55235
55232
|
}
|
|
55236
55233
|
|
|
55237
55234
|
phase = phases.CREATE_USER_RECORD;
|
|
55238
|
-
_context4.next =
|
|
55235
|
+
_context4.next = 16;
|
|
55239
55236
|
return this.identityService.createUserRecord(email, this.web3Manager.getWalletAddress());
|
|
55240
55237
|
|
|
55241
|
-
case
|
|
55242
|
-
_context4.next =
|
|
55238
|
+
case 16:
|
|
55239
|
+
_context4.next = 28;
|
|
55243
55240
|
break;
|
|
55244
55241
|
|
|
55245
|
-
case
|
|
55242
|
+
case 18:
|
|
55246
55243
|
this.REQUIRES(Services.HEDGEHOG); // If an owner wallet already exists, don't try to recreate it
|
|
55247
55244
|
|
|
55248
55245
|
if (hasWallet) {
|
|
55249
|
-
_context4.next =
|
|
55246
|
+
_context4.next = 28;
|
|
55250
55247
|
break;
|
|
55251
55248
|
}
|
|
55252
55249
|
|
|
55253
55250
|
phase = phases.HEDGEHOG_SIGNUP;
|
|
55254
|
-
_context4.next =
|
|
55251
|
+
_context4.next = 23;
|
|
55255
55252
|
return this.hedgehog.signUp(email, password);
|
|
55256
55253
|
|
|
55257
|
-
case
|
|
55254
|
+
case 23:
|
|
55258
55255
|
ownerWallet = _context4.sent;
|
|
55259
55256
|
this.web3Manager.setOwnerWallet(ownerWallet);
|
|
55260
55257
|
|
|
55261
55258
|
if (!generateRecoveryLink) {
|
|
55262
|
-
_context4.next =
|
|
55259
|
+
_context4.next = 28;
|
|
55263
55260
|
break;
|
|
55264
55261
|
}
|
|
55265
55262
|
|
|
55266
|
-
_context4.next =
|
|
55263
|
+
_context4.next = 28;
|
|
55267
55264
|
return this.generateRecoveryLink({
|
|
55268
55265
|
handle: metadata.handle,
|
|
55269
55266
|
host: host
|
|
55270
55267
|
});
|
|
55271
55268
|
|
|
55272
|
-
case
|
|
55269
|
+
case 28:
|
|
55273
55270
|
// Create a wAudio user bank address.
|
|
55274
55271
|
// If userbank creation fails, we still proceed
|
|
55275
55272
|
// through signup
|
|
@@ -55325,75 +55322,42 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
55325
55322
|
} // Add user to chain
|
|
55326
55323
|
|
|
55327
55324
|
|
|
55328
|
-
|
|
55329
|
-
_context4.next = 47;
|
|
55330
|
-
break;
|
|
55331
|
-
}
|
|
55332
|
-
|
|
55333
|
-
phase = phases.ADD_USER;
|
|
55334
|
-
_context4.next = 34;
|
|
55335
|
-
return this.User.addUser(metadata);
|
|
55336
|
-
|
|
55337
|
-
case 34:
|
|
55338
|
-
response = _context4.sent;
|
|
55339
|
-
userId = response.userId;
|
|
55340
|
-
blockHash = response.blockHash;
|
|
55341
|
-
blockNumber = response.blockNumber; // Assign replica set to user, updates creator_node_endpoint on chain, and then update metadata object on content node + chain (in this order)
|
|
55342
|
-
|
|
55343
|
-
phase = phases.ADD_REPLICA_SET;
|
|
55344
|
-
_context4.next = 41;
|
|
55345
|
-
return this.User.assignReplicaSet({
|
|
55346
|
-
userId: userId
|
|
55347
|
-
});
|
|
55348
|
-
|
|
55349
|
-
case 41:
|
|
55350
|
-
metadata = _context4.sent;
|
|
55351
|
-
// Upload profile pic and cover photo to primary Content Node and sync across secondaries
|
|
55352
|
-
phase = phases.UPLOAD_PROFILE_IMAGES;
|
|
55353
|
-
_context4.next = 45;
|
|
55354
|
-
return this.User.uploadProfileImages(profilePictureFile, coverPhotoFile, metadata, useEntityManager);
|
|
55355
|
-
|
|
55356
|
-
case 45:
|
|
55357
|
-
_context4.next = 52;
|
|
55358
|
-
break;
|
|
55359
|
-
|
|
55360
|
-
case 47:
|
|
55361
|
-
_context4.next = 49;
|
|
55325
|
+
_context4.next = 31;
|
|
55362
55326
|
return this.User.createEntityManagerUser({
|
|
55363
55327
|
metadata: metadata
|
|
55364
55328
|
});
|
|
55365
55329
|
|
|
55366
|
-
case
|
|
55330
|
+
case 31:
|
|
55367
55331
|
newMetadata = _context4.sent;
|
|
55368
|
-
_context4.next =
|
|
55369
|
-
return this.User.uploadProfileImages(profilePictureFile, coverPhotoFile, newMetadata
|
|
55332
|
+
_context4.next = 34;
|
|
55333
|
+
return this.User.uploadProfileImages(profilePictureFile, coverPhotoFile, newMetadata);
|
|
55370
55334
|
|
|
55371
|
-
case
|
|
55372
|
-
_context4.next =
|
|
55335
|
+
case 34:
|
|
55336
|
+
_context4.next = 39;
|
|
55373
55337
|
break;
|
|
55374
55338
|
|
|
55375
|
-
case
|
|
55376
|
-
_context4.prev =
|
|
55377
|
-
_context4.t0 = _context4["catch"](
|
|
55339
|
+
case 36:
|
|
55340
|
+
_context4.prev = 36;
|
|
55341
|
+
_context4.t0 = _context4["catch"](10);
|
|
55378
55342
|
return _context4.abrupt("return", {
|
|
55379
55343
|
error: _context4.t0.message,
|
|
55380
55344
|
phase: phase,
|
|
55381
55345
|
errorStatus: _context4.t0.response ? _context4.t0.response.status : null
|
|
55382
55346
|
});
|
|
55383
55347
|
|
|
55384
|
-
case
|
|
55348
|
+
case 39:
|
|
55385
55349
|
return _context4.abrupt("return", {
|
|
55386
55350
|
blockHash: blockHash,
|
|
55387
55351
|
blockNumber: blockNumber,
|
|
55388
55352
|
userId: userId
|
|
55389
55353
|
});
|
|
55390
55354
|
|
|
55391
|
-
case
|
|
55355
|
+
case 40:
|
|
55392
55356
|
case "end":
|
|
55393
55357
|
return _context4.stop();
|
|
55394
55358
|
}
|
|
55395
55359
|
}
|
|
55396
|
-
}, _callee4, this, [[
|
|
55360
|
+
}, _callee4, this, [[10, 36]]);
|
|
55397
55361
|
}));
|
|
55398
55362
|
|
|
55399
55363
|
function signUp(_x3, _x4, _x5) {
|
|
@@ -57479,7 +57443,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57479
57443
|
}, {
|
|
57480
57444
|
key: "uploadProfileImages",
|
|
57481
57445
|
value: function () {
|
|
57482
|
-
var _uploadProfileImages = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(profilePictureFile, coverPhotoFile, metadata
|
|
57446
|
+
var _uploadProfileImages = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(profilePictureFile, coverPhotoFile, metadata) {
|
|
57483
57447
|
var didMetadataUpdate, resp, _resp;
|
|
57484
57448
|
|
|
57485
57449
|
return regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
@@ -57524,8 +57488,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57524
57488
|
_context13.next = 16;
|
|
57525
57489
|
return this.updateAndUploadMetadata({
|
|
57526
57490
|
newMetadata: metadata,
|
|
57527
|
-
userId: metadata.user_id
|
|
57528
|
-
useEntityManager: useEntityManager
|
|
57491
|
+
userId: metadata.user_id
|
|
57529
57492
|
});
|
|
57530
57493
|
|
|
57531
57494
|
case 16:
|
|
@@ -57539,7 +57502,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57539
57502
|
}, _callee13, this);
|
|
57540
57503
|
}));
|
|
57541
57504
|
|
|
57542
|
-
function uploadProfileImages(_x10, _x11, _x12
|
|
57505
|
+
function uploadProfileImages(_x10, _x11, _x12) {
|
|
57543
57506
|
return _uploadProfileImages.apply(this, arguments);
|
|
57544
57507
|
}
|
|
57545
57508
|
|
|
@@ -57620,7 +57583,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57620
57583
|
}, _callee14);
|
|
57621
57584
|
}));
|
|
57622
57585
|
|
|
57623
|
-
return function (
|
|
57586
|
+
return function (_x14) {
|
|
57624
57587
|
return _ref3.apply(this, arguments);
|
|
57625
57588
|
};
|
|
57626
57589
|
}()));
|
|
@@ -57669,8 +57632,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57669
57632
|
_context15.next = 42;
|
|
57670
57633
|
return this.updateAndUploadMetadata({
|
|
57671
57634
|
newMetadata: newMetadata,
|
|
57672
|
-
userId: userId
|
|
57673
|
-
useEntityManager: true
|
|
57635
|
+
userId: userId
|
|
57674
57636
|
});
|
|
57675
57637
|
|
|
57676
57638
|
case 42:
|
|
@@ -57702,7 +57664,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57702
57664
|
}, _callee15, this, [[7, 47]]);
|
|
57703
57665
|
}));
|
|
57704
57666
|
|
|
57705
|
-
function createEntityManagerUser(
|
|
57667
|
+
function createEntityManagerUser(_x13) {
|
|
57706
57668
|
return _createEntityManagerUser.apply(this, arguments);
|
|
57707
57669
|
}
|
|
57708
57670
|
|
|
@@ -57778,7 +57740,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57778
57740
|
}, _callee16, this);
|
|
57779
57741
|
}));
|
|
57780
57742
|
|
|
57781
|
-
function addUser(
|
|
57743
|
+
function addUser(_x15) {
|
|
57782
57744
|
return _addUser.apply(this, arguments);
|
|
57783
57745
|
}
|
|
57784
57746
|
|
|
@@ -57813,7 +57775,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57813
57775
|
}, _callee17, this);
|
|
57814
57776
|
}));
|
|
57815
57777
|
|
|
57816
|
-
function updateEntityManagerReplicaSet(
|
|
57778
|
+
function updateEntityManagerReplicaSet(_x16) {
|
|
57817
57779
|
return _updateEntityManagerReplicaSet.apply(this, arguments);
|
|
57818
57780
|
}
|
|
57819
57781
|
|
|
@@ -57876,7 +57838,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57876
57838
|
}, _callee18, this);
|
|
57877
57839
|
}));
|
|
57878
57840
|
|
|
57879
|
-
function updateUser(
|
|
57841
|
+
function updateUser(_x17, _x18) {
|
|
57880
57842
|
return _updateUser.apply(this, arguments);
|
|
57881
57843
|
}
|
|
57882
57844
|
|
|
@@ -57889,8 +57851,8 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57889
57851
|
}, {
|
|
57890
57852
|
key: "updateCreator",
|
|
57891
57853
|
value: function () {
|
|
57892
|
-
var _updateCreator = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(userId, metadata
|
|
57893
|
-
var newMetadata, logPrefix, fnStartMs, startMs, user, oldMetadata, updateEndpointTxBlockNumber, _yield$this$creatorNo, metadataMultihash, metadataFileUUID,
|
|
57854
|
+
var _updateCreator = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(userId, metadata) {
|
|
57855
|
+
var newMetadata, logPrefix, fnStartMs, startMs, user, oldMetadata, updateEndpointTxBlockNumber, _yield$this$creatorNo, metadataMultihash, metadataFileUUID, response, txReceipt, latestBlockNumber, latestBlockHash;
|
|
57894
57856
|
|
|
57895
57857
|
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
57896
57858
|
while (1) {
|
|
@@ -57902,7 +57864,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57902
57864
|
|
|
57903
57865
|
this._validateUserMetadata(newMetadata);
|
|
57904
57866
|
|
|
57905
|
-
logPrefix = "[User:updateCreator()] [userId: ".concat(userId, "]
|
|
57867
|
+
logPrefix = "[User:updateCreator()] [userId: ".concat(userId, "]");
|
|
57906
57868
|
fnStartMs = Date.now();
|
|
57907
57869
|
startMs = fnStartMs; // Error if libs instance does not already have existing user state
|
|
57908
57870
|
|
|
@@ -57951,60 +57913,28 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57951
57913
|
_yield$this$creatorNo = _context19.sent;
|
|
57952
57914
|
metadataMultihash = _yield$this$creatorNo.metadataMultihash;
|
|
57953
57915
|
metadataFileUUID = _yield$this$creatorNo.metadataFileUUID;
|
|
57954
|
-
|
|
57955
|
-
if (useEntityManager) {
|
|
57956
|
-
_context19.next = 37;
|
|
57957
|
-
break;
|
|
57958
|
-
}
|
|
57959
|
-
|
|
57960
|
-
// Write metadata multihash to chain
|
|
57961
|
-
updatedMultihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
57962
|
-
_context19.next = 28;
|
|
57963
|
-
return this.contracts.UserFactoryClient.updateMultihash(userId, updatedMultihashDecoded.digest);
|
|
57964
|
-
|
|
57965
|
-
case 28:
|
|
57966
|
-
updateMultiHashResp = _context19.sent;
|
|
57967
|
-
txReceipt = updateMultiHashResp.txReceipt; // Write remaining metadata fields to chain
|
|
57968
|
-
|
|
57969
|
-
_context19.next = 32;
|
|
57970
|
-
return this._updateUserOperations(newMetadata, oldMetadata, userId);
|
|
57971
|
-
|
|
57972
|
-
case 32:
|
|
57973
|
-
updateUserResp = _context19.sent;
|
|
57974
|
-
latestBlockHash = updateUserResp.latestBlockHash;
|
|
57975
|
-
latestBlockNumber = Math.max(txReceipt.blockNumber, updateUserResp.latestBlockNumber);
|
|
57976
|
-
_context19.next = 42;
|
|
57977
|
-
break;
|
|
57978
|
-
|
|
57979
|
-
case 37:
|
|
57980
|
-
_context19.next = 39;
|
|
57916
|
+
_context19.next = 26;
|
|
57981
57917
|
return this.contracts.EntityManagerClient.manageEntity(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.UPDATE, metadataMultihash);
|
|
57982
57918
|
|
|
57983
|
-
case
|
|
57919
|
+
case 26:
|
|
57984
57920
|
response = _context19.sent;
|
|
57985
57921
|
txReceipt = response.txReceipt;
|
|
57986
57922
|
latestBlockNumber = txReceipt.blockNumber;
|
|
57923
|
+
latestBlockHash = txReceipt.blockHash; // Write to CN to associate blockchain user id with updated metadata and block number
|
|
57987
57924
|
|
|
57988
|
-
|
|
57989
|
-
_context19.next = 44;
|
|
57925
|
+
_context19.next = 32;
|
|
57990
57926
|
return this.creatorNode.associateCreator(userId, metadataFileUUID, latestBlockNumber);
|
|
57991
57927
|
|
|
57992
|
-
case
|
|
57928
|
+
case 32:
|
|
57993
57929
|
// Update libs instance with new user metadata object
|
|
57994
57930
|
this.userStateManager.setCurrentUser(_objectSpread2(_objectSpread2({}, oldMetadata), newMetadata));
|
|
57995
|
-
|
|
57996
|
-
if (!latestBlockHash || !latestBlockNumber) {
|
|
57997
|
-
latestBlockHash = txReceipt.blockHash;
|
|
57998
|
-
latestBlockNumber = txReceipt.blockNumber;
|
|
57999
|
-
}
|
|
58000
|
-
|
|
58001
57931
|
return _context19.abrupt("return", {
|
|
58002
57932
|
blockHash: latestBlockHash,
|
|
58003
57933
|
blockNumber: latestBlockNumber,
|
|
58004
57934
|
userId: userId
|
|
58005
57935
|
});
|
|
58006
57936
|
|
|
58007
|
-
case
|
|
57937
|
+
case 34:
|
|
58008
57938
|
case "end":
|
|
58009
57939
|
return _context19.stop();
|
|
58010
57940
|
}
|
|
@@ -58012,7 +57942,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58012
57942
|
}, _callee19, this);
|
|
58013
57943
|
}));
|
|
58014
57944
|
|
|
58015
|
-
function updateCreator(
|
|
57945
|
+
function updateCreator(_x19, _x20) {
|
|
58016
57946
|
return _updateCreator.apply(this, arguments);
|
|
58017
57947
|
}
|
|
58018
57948
|
|
|
@@ -58025,30 +57955,18 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58025
57955
|
}, {
|
|
58026
57956
|
key: "updateIsVerified",
|
|
58027
57957
|
value: function () {
|
|
58028
|
-
var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId,
|
|
57958
|
+
var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId, privateKey) {
|
|
58029
57959
|
return regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
58030
57960
|
while (1) {
|
|
58031
57961
|
switch (_context20.prev = _context20.next) {
|
|
58032
57962
|
case 0:
|
|
58033
|
-
|
|
58034
|
-
_context20.next = 6;
|
|
58035
|
-
break;
|
|
58036
|
-
}
|
|
58037
|
-
|
|
58038
|
-
_context20.next = 3;
|
|
57963
|
+
_context20.next = 2;
|
|
58039
57964
|
return this.contracts.EntityManagerClient.getManageEntityParams(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.VERIFY, '', privateKey);
|
|
58040
57965
|
|
|
58041
|
-
case
|
|
58042
|
-
return _context20.abrupt("return", _context20.sent);
|
|
58043
|
-
|
|
58044
|
-
case 6:
|
|
58045
|
-
_context20.next = 8;
|
|
58046
|
-
return this.contracts.UserFactoryClient.updateIsVerified(userId, isVerified, privateKey);
|
|
58047
|
-
|
|
58048
|
-
case 8:
|
|
57966
|
+
case 2:
|
|
58049
57967
|
return _context20.abrupt("return", _context20.sent);
|
|
58050
57968
|
|
|
58051
|
-
case
|
|
57969
|
+
case 3:
|
|
58052
57970
|
case "end":
|
|
58053
57971
|
return _context20.stop();
|
|
58054
57972
|
}
|
|
@@ -58056,7 +57974,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58056
57974
|
}, _callee20, this);
|
|
58057
57975
|
}));
|
|
58058
57976
|
|
|
58059
|
-
function updateIsVerified(
|
|
57977
|
+
function updateIsVerified(_x21, _x22) {
|
|
58060
57978
|
return _updateIsVerified.apply(this, arguments);
|
|
58061
57979
|
}
|
|
58062
57980
|
|
|
@@ -58090,7 +58008,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58090
58008
|
}, _callee21, this);
|
|
58091
58009
|
}));
|
|
58092
58010
|
|
|
58093
|
-
function addUserFollow(
|
|
58011
|
+
function addUserFollow(_x23) {
|
|
58094
58012
|
return _addUserFollow.apply(this, arguments);
|
|
58095
58013
|
}
|
|
58096
58014
|
|
|
@@ -58124,7 +58042,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58124
58042
|
}, _callee22, this);
|
|
58125
58043
|
}));
|
|
58126
58044
|
|
|
58127
|
-
function deleteUserFollow(
|
|
58045
|
+
function deleteUserFollow(_x24) {
|
|
58128
58046
|
return _deleteUserFollow.apply(this, arguments);
|
|
58129
58047
|
}
|
|
58130
58048
|
|
|
@@ -58170,7 +58088,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58170
58088
|
}, _callee23, this, [[0, 8]]);
|
|
58171
58089
|
}));
|
|
58172
58090
|
|
|
58173
|
-
function addUserSubscribe(
|
|
58091
|
+
function addUserSubscribe(_x25) {
|
|
58174
58092
|
return _addUserSubscribe.apply(this, arguments);
|
|
58175
58093
|
}
|
|
58176
58094
|
|
|
@@ -58216,7 +58134,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58216
58134
|
}, _callee24, this, [[0, 8]]);
|
|
58217
58135
|
}));
|
|
58218
58136
|
|
|
58219
|
-
function deleteUserSubscribe(
|
|
58137
|
+
function deleteUserSubscribe(_x26) {
|
|
58220
58138
|
return _deleteUserSubscribe.apply(this, arguments);
|
|
58221
58139
|
}
|
|
58222
58140
|
|
|
@@ -58233,13 +58151,13 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58233
58151
|
key: "updateAndUploadMetadata",
|
|
58234
58152
|
value: function () {
|
|
58235
58153
|
var _updateAndUploadMetadata = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(_ref5) {
|
|
58236
|
-
var newMetadata, userId,
|
|
58154
|
+
var newMetadata, userId, phases, phase, oldMetadata, logPrefix, fnStartMs, startMs, _yield$this$_updateRe, _txReceipt, replicaSetSPIDs, _yield$this$creatorNo2, metadataMultihash, metadataFileUUID, response, txReceipt, blockNumber, errorMsg;
|
|
58237
58155
|
|
|
58238
58156
|
return regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
58239
58157
|
while (1) {
|
|
58240
58158
|
switch (_context25.prev = _context25.next) {
|
|
58241
58159
|
case 0:
|
|
58242
|
-
newMetadata = _ref5.newMetadata, userId = _ref5.userId
|
|
58160
|
+
newMetadata = _ref5.newMetadata, userId = _ref5.userId;
|
|
58243
58161
|
this.REQUIRES(Services.CREATOR_NODE, Services.DISCOVERY_PROVIDER);
|
|
58244
58162
|
this.IS_OBJECT(newMetadata);
|
|
58245
58163
|
phases = {
|
|
@@ -58270,7 +58188,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58270
58188
|
_context25.prev = 13;
|
|
58271
58189
|
|
|
58272
58190
|
if (!(newMetadata.creator_node_endpoint !== oldMetadata.creator_node_endpoint)) {
|
|
58273
|
-
_context25.next =
|
|
58191
|
+
_context25.next = 28;
|
|
58274
58192
|
break;
|
|
58275
58193
|
}
|
|
58276
58194
|
|
|
@@ -58283,39 +58201,23 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58283
58201
|
_txReceipt = _yield$this$_updateRe.txReceipt;
|
|
58284
58202
|
replicaSetSPIDs = _yield$this$_updateRe.replicaSetSPIDs;
|
|
58285
58203
|
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] _updateReplicaSetOnChain() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58286
|
-
|
|
58287
|
-
if (!useEntityManager) {
|
|
58288
|
-
_context25.next = 31;
|
|
58289
|
-
break;
|
|
58290
|
-
}
|
|
58291
|
-
|
|
58292
58204
|
startMs = Date.now();
|
|
58293
|
-
_context25.next =
|
|
58205
|
+
_context25.next = 25;
|
|
58294
58206
|
return this.waitForReplicaSetDiscoveryIndexing(userId, replicaSetSPIDs, _txReceipt.blockNumber);
|
|
58295
58207
|
|
|
58296
|
-
case
|
|
58208
|
+
case 25:
|
|
58297
58209
|
// @ts-expect-error
|
|
58298
58210
|
newMetadata.primary_id = replicaSetSPIDs[0];
|
|
58299
58211
|
newMetadata.secondary_ids = replicaSetSPIDs.slice(1);
|
|
58300
58212
|
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] waitForReplicaSetDiscoveryIndexing() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58301
|
-
_context25.next = 35;
|
|
58302
|
-
break;
|
|
58303
|
-
|
|
58304
|
-
case 31:
|
|
58305
|
-
startMs = Date.now();
|
|
58306
|
-
_context25.next = 34;
|
|
58307
|
-
return this._waitForURSMCreatorNodeEndpointIndexing(userId, replicaSetSPIDs);
|
|
58308
|
-
|
|
58309
|
-
case 34:
|
|
58310
|
-
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] _waitForURSMCreatorNodeEndpointIndexing() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58311
58213
|
|
|
58312
|
-
case
|
|
58214
|
+
case 28:
|
|
58313
58215
|
// Upload new metadata object to CN
|
|
58314
58216
|
phase = phases.UPLOAD_METADATA;
|
|
58315
|
-
_context25.next =
|
|
58217
|
+
_context25.next = 31;
|
|
58316
58218
|
return this.creatorNode.uploadCreatorContent(newMetadata);
|
|
58317
58219
|
|
|
58318
|
-
case
|
|
58220
|
+
case 31:
|
|
58319
58221
|
_yield$this$creatorNo2 = _context25.sent;
|
|
58320
58222
|
metadataMultihash = _yield$this$creatorNo2.metadataMultihash;
|
|
58321
58223
|
metadataFileUUID = _yield$this$creatorNo2.metadataFileUUID;
|
|
@@ -58323,85 +58225,54 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58323
58225
|
startMs = Date.now(); // Write metadata multihash to chain
|
|
58324
58226
|
|
|
58325
58227
|
phase = phases.UPDATE_METADATA_ON_CHAIN;
|
|
58326
|
-
|
|
58327
|
-
if (!useEntityManager) {
|
|
58328
|
-
_context25.next = 52;
|
|
58329
|
-
break;
|
|
58330
|
-
}
|
|
58331
|
-
|
|
58332
|
-
_context25.next = 47;
|
|
58228
|
+
_context25.next = 39;
|
|
58333
58229
|
return this.contracts.EntityManagerClient.manageEntity(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.UPDATE, metadataMultihash);
|
|
58334
58230
|
|
|
58335
|
-
case
|
|
58231
|
+
case 39:
|
|
58336
58232
|
response = _context25.sent;
|
|
58337
58233
|
txReceipt = response.txReceipt;
|
|
58338
58234
|
blockNumber = txReceipt.blockNumber;
|
|
58339
|
-
_context25.next = 66;
|
|
58340
|
-
break;
|
|
58341
|
-
|
|
58342
|
-
case 52:
|
|
58343
|
-
updatedMultihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
58344
|
-
_context25.next = 55;
|
|
58345
|
-
return this.contracts.UserFactoryClient.updateMultihash(userId, updatedMultihashDecoded.digest);
|
|
58346
|
-
|
|
58347
|
-
case 55:
|
|
58348
|
-
res = _context25.sent;
|
|
58349
|
-
txReceipt = res.txReceipt;
|
|
58350
|
-
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] UserFactoryClient.updateMultihash() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58351
|
-
startMs = Date.now(); // Write remaining metadata fields to chain
|
|
58352
|
-
|
|
58353
|
-
phase = phases.UPDATE_USER_ON_CHAIN_OPS;
|
|
58354
|
-
_context25.next = 62;
|
|
58355
|
-
return this._updateUserOperations(newMetadata, oldMetadata, userId, ['creator_node_endpoint']);
|
|
58356
|
-
|
|
58357
|
-
case 62:
|
|
58358
|
-
_yield$this$_updateUs2 = _context25.sent;
|
|
58359
|
-
latestBlockNumber = _yield$this$_updateUs2.latestBlockNumber;
|
|
58360
|
-
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] _updateUserOperations() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58361
|
-
blockNumber = Math.max(txReceipt.blockNumber, latestBlockNumber);
|
|
58362
|
-
|
|
58363
|
-
case 66:
|
|
58364
58235
|
startMs = Date.now(); // Write to CN to associate blockchain user id with updated metadata and block number
|
|
58365
58236
|
|
|
58366
58237
|
phase = phases.ASSOCIATE_USER;
|
|
58367
|
-
_context25.next =
|
|
58238
|
+
_context25.next = 46;
|
|
58368
58239
|
return this.creatorNode.associateCreator(userId, metadataFileUUID, blockNumber);
|
|
58369
58240
|
|
|
58370
|
-
case
|
|
58241
|
+
case 46:
|
|
58371
58242
|
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] creatorNode.associateCreator() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58372
58243
|
startMs = Date.now(); // Update libs instance with new user metadata object
|
|
58373
58244
|
|
|
58374
58245
|
this.userStateManager.setCurrentUser(_objectSpread2(_objectSpread2({}, oldMetadata), newMetadata));
|
|
58375
58246
|
console.log("".concat(logPrefix, " completed in ").concat(Date.now() - fnStartMs, "ms"));
|
|
58376
|
-
_context25.next =
|
|
58247
|
+
_context25.next = 59;
|
|
58377
58248
|
break;
|
|
58378
58249
|
|
|
58379
|
-
case
|
|
58380
|
-
_context25.prev =
|
|
58250
|
+
case 52:
|
|
58251
|
+
_context25.prev = 52;
|
|
58381
58252
|
_context25.t0 = _context25["catch"](13);
|
|
58382
58253
|
// TODO: think about handling the update metadata on chain and associating..
|
|
58383
58254
|
errorMsg = "updateAndUploadMetadata() Error -- Phase ".concat(phase, " in ").concat(Date.now() - fnStartMs, "ms: ").concat(_context25.t0);
|
|
58384
58255
|
|
|
58385
58256
|
if (!(_context25.t0 instanceof Error)) {
|
|
58386
|
-
_context25.next =
|
|
58257
|
+
_context25.next = 58;
|
|
58387
58258
|
break;
|
|
58388
58259
|
}
|
|
58389
58260
|
|
|
58390
58261
|
_context25.t0.message = errorMsg;
|
|
58391
58262
|
throw _context25.t0;
|
|
58392
58263
|
|
|
58393
|
-
case
|
|
58264
|
+
case 58:
|
|
58394
58265
|
throw new Error(errorMsg);
|
|
58395
58266
|
|
|
58396
|
-
case
|
|
58267
|
+
case 59:
|
|
58397
58268
|
case "end":
|
|
58398
58269
|
return _context25.stop();
|
|
58399
58270
|
}
|
|
58400
58271
|
}
|
|
58401
|
-
}, _callee25, this, [[13,
|
|
58272
|
+
}, _callee25, this, [[13, 52]]);
|
|
58402
58273
|
}));
|
|
58403
58274
|
|
|
58404
|
-
function updateAndUploadMetadata(
|
|
58275
|
+
function updateAndUploadMetadata(_x27) {
|
|
58405
58276
|
return _updateAndUploadMetadata.apply(this, arguments);
|
|
58406
58277
|
}
|
|
58407
58278
|
|
|
@@ -58520,7 +58391,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58520
58391
|
}, _callee27, this);
|
|
58521
58392
|
}));
|
|
58522
58393
|
|
|
58523
|
-
function _waitForCreatorNodeEndpointIndexing(
|
|
58394
|
+
function _waitForCreatorNodeEndpointIndexing(_x28, _x29) {
|
|
58524
58395
|
return _waitForCreatorNodeEndpointIndexing2.apply(this, arguments);
|
|
58525
58396
|
}
|
|
58526
58397
|
|
|
@@ -58623,7 +58494,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58623
58494
|
}, _callee29);
|
|
58624
58495
|
}));
|
|
58625
58496
|
|
|
58626
|
-
function waitForReplicaSetDiscoveryIndexing(
|
|
58497
|
+
function waitForReplicaSetDiscoveryIndexing(_x30, _x31, _x32) {
|
|
58627
58498
|
return _waitForReplicaSetDiscoveryIndexing.apply(this, arguments);
|
|
58628
58499
|
}
|
|
58629
58500
|
|
|
@@ -58698,7 +58569,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58698
58569
|
}, _callee31);
|
|
58699
58570
|
}));
|
|
58700
58571
|
|
|
58701
|
-
function _waitForURSMCreatorNodeEndpointIndexing(
|
|
58572
|
+
function _waitForURSMCreatorNodeEndpointIndexing(_x33, _x34) {
|
|
58702
58573
|
return _waitForURSMCreatorNodeEndpointIndexing2.apply(this, arguments);
|
|
58703
58574
|
}
|
|
58704
58575
|
|
|
@@ -58784,7 +58655,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58784
58655
|
}, _callee32, this);
|
|
58785
58656
|
}));
|
|
58786
58657
|
|
|
58787
|
-
function _addUserOperations(
|
|
58658
|
+
function _addUserOperations(_x35, _x36) {
|
|
58788
58659
|
return _addUserOperations2.apply(this, arguments);
|
|
58789
58660
|
}
|
|
58790
58661
|
|
|
@@ -58879,7 +58750,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58879
58750
|
}, _callee33, this);
|
|
58880
58751
|
}));
|
|
58881
58752
|
|
|
58882
|
-
function _updateUserOperations(
|
|
58753
|
+
function _updateUserOperations(_x37, _x38, _x39) {
|
|
58883
58754
|
return _updateUserOperations2.apply(this, arguments);
|
|
58884
58755
|
}
|
|
58885
58756
|
|
|
@@ -58914,7 +58785,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58914
58785
|
key: "_updateReplicaSetOnChain",
|
|
58915
58786
|
value: function () {
|
|
58916
58787
|
var _updateReplicaSetOnChain2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34(userId, creatorNodeEndpoint) {
|
|
58917
|
-
var primaryEndpoint, secondaries, _yield$Promise$all, _yield$Promise$all2, primarySpID, secondary1SpID, secondary2SpID,
|
|
58788
|
+
var primaryEndpoint, secondaries, _yield$Promise$all, _yield$Promise$all2, primarySpID, secondary1SpID, secondary2SpID, currentUser, currentPrimaryEndpoint, currentSecondaries, _yield$Promise$all3, _yield$Promise$all4, oldPrimary, oldSecondary1SpID, oldSecondary2SpID, txReceipt, replicaSetSPIDs, updateEndpointTxBlockNumber;
|
|
58918
58789
|
|
|
58919
58790
|
return regeneratorRuntime.wrap(function _callee34$(_context34) {
|
|
58920
58791
|
while (1) {
|
|
@@ -58959,45 +58830,29 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58959
58830
|
throw new Error('Current user missing');
|
|
58960
58831
|
|
|
58961
58832
|
case 17:
|
|
58962
|
-
|
|
58963
|
-
|
|
58964
|
-
return (_this$contracts$UserR = this.contracts.UserReplicaSetManagerClient) === null || _this$contracts$UserR === void 0 ? void 0 : _this$contracts$UserR.updateReplicaSet(userId, primarySpID, [secondary1SpID, secondary2SpID]);
|
|
58965
|
-
|
|
58966
|
-
case 20:
|
|
58967
|
-
txReceipt = _context34.sent;
|
|
58968
|
-
replicaSetSPIDs = [primarySpID, secondary1SpID, secondary2SpID];
|
|
58969
|
-
updateEndpointTxBlockNumber = (_txReceipt2 = txReceipt) === null || _txReceipt2 === void 0 ? void 0 : _txReceipt2.blockNumber;
|
|
58970
|
-
_context34.next = 25;
|
|
58971
|
-
return this._waitForURSMCreatorNodeEndpointIndexing(userId, replicaSetSPIDs);
|
|
58972
|
-
|
|
58973
|
-
case 25:
|
|
58974
|
-
_context34.next = 47;
|
|
58975
|
-
break;
|
|
58976
|
-
|
|
58977
|
-
case 27:
|
|
58978
|
-
_context34.prev = 27;
|
|
58979
|
-
_context34.t0 = _context34["catch"](17);
|
|
58833
|
+
// First try to update with URSM
|
|
58834
|
+
// Fallback to EntityManager when relay errors
|
|
58980
58835
|
currentPrimaryEndpoint = CreatorNode.getPrimary(currentUser.creator_node_endpoint);
|
|
58981
58836
|
currentSecondaries = CreatorNode.getSecondaries(currentUser.creator_node_endpoint);
|
|
58982
58837
|
|
|
58983
58838
|
if (!(currentSecondaries.length < 2)) {
|
|
58984
|
-
_context34.next =
|
|
58839
|
+
_context34.next = 21;
|
|
58985
58840
|
break;
|
|
58986
58841
|
}
|
|
58987
58842
|
|
|
58988
58843
|
throw new Error("Invalid number of secondaries found - received ".concat(currentSecondaries));
|
|
58989
58844
|
|
|
58990
|
-
case
|
|
58991
|
-
_context34.next =
|
|
58845
|
+
case 21:
|
|
58846
|
+
_context34.next = 23;
|
|
58992
58847
|
return Promise.all([this._retrieveSpIDFromEndpoint(currentPrimaryEndpoint), this._retrieveSpIDFromEndpoint(currentSecondaries[0]), this._retrieveSpIDFromEndpoint(currentSecondaries[1])]);
|
|
58993
58848
|
|
|
58994
|
-
case
|
|
58849
|
+
case 23:
|
|
58995
58850
|
_yield$Promise$all3 = _context34.sent;
|
|
58996
58851
|
_yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 3);
|
|
58997
58852
|
oldPrimary = _yield$Promise$all4[0];
|
|
58998
58853
|
oldSecondary1SpID = _yield$Promise$all4[1];
|
|
58999
58854
|
oldSecondary2SpID = _yield$Promise$all4[2];
|
|
59000
|
-
_context34.next =
|
|
58855
|
+
_context34.next = 30;
|
|
59001
58856
|
return this.updateEntityManagerReplicaSet({
|
|
59002
58857
|
userId: userId,
|
|
59003
58858
|
primary: primarySpID,
|
|
@@ -59006,36 +58861,36 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
59006
58861
|
oldSecondaries: [oldSecondary1SpID, oldSecondary2SpID]
|
|
59007
58862
|
});
|
|
59008
58863
|
|
|
59009
|
-
case
|
|
58864
|
+
case 30:
|
|
59010
58865
|
txReceipt = _context34.sent;
|
|
59011
58866
|
replicaSetSPIDs = [primarySpID, secondary1SpID, secondary2SpID];
|
|
59012
|
-
updateEndpointTxBlockNumber =
|
|
59013
|
-
_context34.next =
|
|
58867
|
+
updateEndpointTxBlockNumber = txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.blockNumber;
|
|
58868
|
+
_context34.next = 35;
|
|
59014
58869
|
return this.waitForReplicaSetDiscoveryIndexing(userId, replicaSetSPIDs, updateEndpointTxBlockNumber);
|
|
59015
58870
|
|
|
59016
|
-
case
|
|
58871
|
+
case 35:
|
|
59017
58872
|
if (txReceipt) {
|
|
59018
|
-
_context34.next =
|
|
58873
|
+
_context34.next = 37;
|
|
59019
58874
|
break;
|
|
59020
58875
|
}
|
|
59021
58876
|
|
|
59022
58877
|
throw new Error('Unable to update replica set on chain');
|
|
59023
58878
|
|
|
59024
|
-
case
|
|
58879
|
+
case 37:
|
|
59025
58880
|
return _context34.abrupt("return", {
|
|
59026
58881
|
txReceipt: txReceipt,
|
|
59027
58882
|
replicaSetSPIDs: replicaSetSPIDs
|
|
59028
58883
|
});
|
|
59029
58884
|
|
|
59030
|
-
case
|
|
58885
|
+
case 38:
|
|
59031
58886
|
case "end":
|
|
59032
58887
|
return _context34.stop();
|
|
59033
58888
|
}
|
|
59034
58889
|
}
|
|
59035
|
-
}, _callee34, this
|
|
58890
|
+
}, _callee34, this);
|
|
59036
58891
|
}));
|
|
59037
58892
|
|
|
59038
|
-
function _updateReplicaSetOnChain(
|
|
58893
|
+
function _updateReplicaSetOnChain(_x40, _x41) {
|
|
59039
58894
|
return _updateReplicaSetOnChain2.apply(this, arguments);
|
|
59040
58895
|
}
|
|
59041
58896
|
|
|
@@ -59090,7 +58945,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
59090
58945
|
}, _callee35, this);
|
|
59091
58946
|
}));
|
|
59092
58947
|
|
|
59093
|
-
function _retrieveSpIDFromEndpoint(
|
|
58948
|
+
function _retrieveSpIDFromEndpoint(_x42) {
|
|
59094
58949
|
return _retrieveSpIDFromEndpoint2.apply(this, arguments);
|
|
59095
58950
|
}
|
|
59096
58951
|
|
|
@@ -59937,10 +59792,10 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
59937
59792
|
}, {
|
|
59938
59793
|
key: "uploadTrack",
|
|
59939
59794
|
value: function () {
|
|
59940
|
-
var _uploadTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(trackFile, coverArtFile, metadata, onProgress
|
|
59795
|
+
var _uploadTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(trackFile, coverArtFile, metadata, onProgress) {
|
|
59941
59796
|
var _this2 = this;
|
|
59942
59797
|
|
|
59943
|
-
var phases, phase, ownerId, _yield$retry, metadataMultihash, metadataFileUUID, transcodedTrackUUID, transcodedTrackCID,
|
|
59798
|
+
var phases, phase, ownerId, _yield$retry, metadataMultihash, metadataFileUUID, transcodedTrackUUID, transcodedTrackCID, trackId, response, txReceipt;
|
|
59944
59799
|
|
|
59945
59800
|
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
59946
59801
|
while (1) {
|
|
@@ -60017,42 +59872,23 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60017
59872
|
transcodedTrackCID = _yield$retry.transcodedTrackCID;
|
|
60018
59873
|
phase = phases.ADDING_TRACK; // Write metadata to chain
|
|
60019
59874
|
|
|
60020
|
-
|
|
60021
|
-
_context19.next = 31;
|
|
60022
|
-
break;
|
|
60023
|
-
}
|
|
60024
|
-
|
|
60025
|
-
_context19.next = 24;
|
|
59875
|
+
_context19.next = 23;
|
|
60026
59876
|
return this._generateTrackId();
|
|
60027
59877
|
|
|
60028
|
-
case
|
|
59878
|
+
case 23:
|
|
60029
59879
|
trackId = _context19.sent;
|
|
60030
|
-
_context19.next =
|
|
59880
|
+
_context19.next = 26;
|
|
60031
59881
|
return this.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.CREATE, metadataMultihash);
|
|
60032
59882
|
|
|
60033
|
-
case
|
|
59883
|
+
case 26:
|
|
60034
59884
|
response = _context19.sent;
|
|
60035
59885
|
txReceipt = response.txReceipt;
|
|
60036
|
-
_context19.next = 37;
|
|
60037
|
-
break;
|
|
60038
|
-
|
|
60039
|
-
case 31:
|
|
60040
|
-
multihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
60041
|
-
_context19.next = 34;
|
|
60042
|
-
return this.contracts.TrackFactoryClient.addTrack(ownerId, multihashDecoded.digest, multihashDecoded.hashFn, multihashDecoded.size);
|
|
60043
|
-
|
|
60044
|
-
case 34:
|
|
60045
|
-
_response = _context19.sent;
|
|
60046
|
-
txReceipt = _response.txReceipt;
|
|
60047
|
-
trackId = _response.trackId;
|
|
60048
|
-
|
|
60049
|
-
case 37:
|
|
60050
59886
|
phase = phases.ASSOCIATING_TRACK; // Associate the track id with the file metadata and block number
|
|
60051
59887
|
|
|
60052
|
-
_context19.next =
|
|
59888
|
+
_context19.next = 31;
|
|
60053
59889
|
return this.creatorNode.associateTrack(trackId, metadataFileUUID, txReceipt.blockNumber, transcodedTrackUUID);
|
|
60054
59890
|
|
|
60055
|
-
case
|
|
59891
|
+
case 31:
|
|
60056
59892
|
return _context19.abrupt("return", {
|
|
60057
59893
|
blockHash: txReceipt.blockHash,
|
|
60058
59894
|
blockNumber: txReceipt.blockNumber,
|
|
@@ -60061,23 +59897,23 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60061
59897
|
error: false
|
|
60062
59898
|
});
|
|
60063
59899
|
|
|
60064
|
-
case
|
|
60065
|
-
_context19.prev =
|
|
59900
|
+
case 34:
|
|
59901
|
+
_context19.prev = 34;
|
|
60066
59902
|
_context19.t0 = _context19["catch"](4);
|
|
60067
59903
|
return _context19.abrupt("return", {
|
|
60068
59904
|
error: _context19.t0.message,
|
|
60069
59905
|
phase: phase
|
|
60070
59906
|
});
|
|
60071
59907
|
|
|
60072
|
-
case
|
|
59908
|
+
case 37:
|
|
60073
59909
|
case "end":
|
|
60074
59910
|
return _context19.stop();
|
|
60075
59911
|
}
|
|
60076
59912
|
}
|
|
60077
|
-
}, _callee19, this, [[4,
|
|
59913
|
+
}, _callee19, this, [[4, 34]]);
|
|
60078
59914
|
}));
|
|
60079
59915
|
|
|
60080
|
-
function uploadTrack(_x13, _x14, _x15, _x16
|
|
59916
|
+
function uploadTrack(_x13, _x14, _x15, _x16) {
|
|
60081
59917
|
return _uploadTrack.apply(this, arguments);
|
|
60082
59918
|
}
|
|
60083
59919
|
|
|
@@ -60174,7 +60010,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60174
60010
|
}, _callee21, this);
|
|
60175
60011
|
}));
|
|
60176
60012
|
|
|
60177
|
-
function uploadTrackContentToCreatorNode(_x18, _x19, _x20
|
|
60013
|
+
function uploadTrackContentToCreatorNode(_x17, _x18, _x19, _x20) {
|
|
60178
60014
|
return _uploadTrackContentToCreatorNode.apply(this, arguments);
|
|
60179
60015
|
}
|
|
60180
60016
|
|
|
@@ -60189,7 +60025,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60189
60025
|
}, {
|
|
60190
60026
|
key: "addTracksToChainAndCnode",
|
|
60191
60027
|
value: function () {
|
|
60192
|
-
var _addTracksToChainAndCnode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(trackMultihashAndUUIDList
|
|
60028
|
+
var _addTracksToChainAndCnode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(trackMultihashAndUUIDList) {
|
|
60193
60029
|
var _this4 = this;
|
|
60194
60030
|
|
|
60195
60031
|
var ownerId, addedToChain, requestFailed, associatedWithCreatorNode;
|
|
@@ -60213,8 +60049,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60213
60049
|
_context24.next = 8;
|
|
60214
60050
|
return Promise.all(trackMultihashAndUUIDList.map( /*#__PURE__*/function () {
|
|
60215
60051
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(trackInfo, i) {
|
|
60216
|
-
var metadataMultihash, metadataFileUUID, transcodedTrackUUID,
|
|
60217
|
-
|
|
60052
|
+
var metadataMultihash, metadataFileUUID, transcodedTrackUUID, trackId, response, txReceipt;
|
|
60218
60053
|
return regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
60219
60054
|
while (1) {
|
|
60220
60055
|
switch (_context22.prev = _context22.next) {
|
|
@@ -60222,60 +60057,41 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60222
60057
|
_context22.prev = 0;
|
|
60223
60058
|
metadataMultihash = trackInfo.metadataMultihash, metadataFileUUID = trackInfo.metadataFileUUID, transcodedTrackUUID = trackInfo.transcodedTrackUUID; // Write metadata to chain
|
|
60224
60059
|
|
|
60225
|
-
|
|
60226
|
-
_context22.next = 12;
|
|
60227
|
-
break;
|
|
60228
|
-
}
|
|
60229
|
-
|
|
60230
|
-
_context22.next = 5;
|
|
60060
|
+
_context22.next = 4;
|
|
60231
60061
|
return _this4._generateTrackId();
|
|
60232
60062
|
|
|
60233
|
-
case
|
|
60063
|
+
case 4:
|
|
60234
60064
|
trackId = _context22.sent;
|
|
60235
|
-
_context22.next =
|
|
60065
|
+
_context22.next = 7;
|
|
60236
60066
|
return _this4.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.CREATE, metadataMultihash);
|
|
60237
60067
|
|
|
60238
|
-
case
|
|
60068
|
+
case 7:
|
|
60239
60069
|
response = _context22.sent;
|
|
60240
60070
|
txReceipt = response.txReceipt;
|
|
60241
|
-
_context22.next = 18;
|
|
60242
|
-
break;
|
|
60243
|
-
|
|
60244
|
-
case 12:
|
|
60245
|
-
multihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
60246
|
-
_context22.next = 15;
|
|
60247
|
-
return _this4.contracts.TrackFactoryClient.addTrack(ownerId, multihashDecoded.digest, multihashDecoded.hashFn, multihashDecoded.size);
|
|
60248
|
-
|
|
60249
|
-
case 15:
|
|
60250
|
-
_response2 = _context22.sent;
|
|
60251
|
-
txReceipt = _response2.txReceipt;
|
|
60252
|
-
trackId = _response2.trackId;
|
|
60253
|
-
|
|
60254
|
-
case 18:
|
|
60255
60071
|
addedToChain[i] = {
|
|
60256
60072
|
trackId: trackId,
|
|
60257
60073
|
metadataFileUUID: metadataFileUUID,
|
|
60258
60074
|
transcodedTrackUUID: transcodedTrackUUID,
|
|
60259
60075
|
txReceipt: txReceipt
|
|
60260
60076
|
};
|
|
60261
|
-
_context22.next =
|
|
60077
|
+
_context22.next = 16;
|
|
60262
60078
|
break;
|
|
60263
60079
|
|
|
60264
|
-
case
|
|
60265
|
-
_context22.prev =
|
|
60080
|
+
case 12:
|
|
60081
|
+
_context22.prev = 12;
|
|
60266
60082
|
_context22.t0 = _context22["catch"](0);
|
|
60267
60083
|
requestFailed = true;
|
|
60268
60084
|
console.error(_context22.t0);
|
|
60269
60085
|
|
|
60270
|
-
case
|
|
60086
|
+
case 16:
|
|
60271
60087
|
case "end":
|
|
60272
60088
|
return _context22.stop();
|
|
60273
60089
|
}
|
|
60274
60090
|
}
|
|
60275
|
-
}, _callee22, null, [[0,
|
|
60091
|
+
}, _callee22, null, [[0, 12]]);
|
|
60276
60092
|
}));
|
|
60277
60093
|
|
|
60278
|
-
return function (
|
|
60094
|
+
return function (_x22, _x23) {
|
|
60279
60095
|
return _ref3.apply(this, arguments);
|
|
60280
60096
|
};
|
|
60281
60097
|
}()));
|
|
@@ -60321,7 +60137,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60321
60137
|
}, _callee23);
|
|
60322
60138
|
}));
|
|
60323
60139
|
|
|
60324
|
-
return function (
|
|
60140
|
+
return function (_x24) {
|
|
60325
60141
|
return _ref4.apply(this, arguments);
|
|
60326
60142
|
};
|
|
60327
60143
|
}()));
|
|
@@ -60356,7 +60172,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60356
60172
|
}, _callee24, this, [[11, 16]]);
|
|
60357
60173
|
}));
|
|
60358
60174
|
|
|
60359
|
-
function addTracksToChainAndCnode(
|
|
60175
|
+
function addTracksToChainAndCnode(_x21) {
|
|
60360
60176
|
return _addTracksToChainAndCnode.apply(this, arguments);
|
|
60361
60177
|
}
|
|
60362
60178
|
|
|
@@ -60371,8 +60187,8 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60371
60187
|
}, {
|
|
60372
60188
|
key: "updateTrack",
|
|
60373
60189
|
value: function () {
|
|
60374
|
-
var _updateTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(metadata
|
|
60375
|
-
var ownerId, _yield$this$creatorNo, metadataMultihash, metadataFileUUID,
|
|
60190
|
+
var _updateTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(metadata) {
|
|
60191
|
+
var ownerId, _yield$this$creatorNo, metadataMultihash, metadataFileUUID, trackId, response, txReceipt;
|
|
60376
60192
|
|
|
60377
60193
|
return regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
60378
60194
|
while (1) {
|
|
@@ -60402,43 +60218,26 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60402
60218
|
_yield$this$creatorNo = _context25.sent;
|
|
60403
60219
|
metadataMultihash = _yield$this$creatorNo.metadataMultihash;
|
|
60404
60220
|
metadataFileUUID = _yield$this$creatorNo.metadataFileUUID;
|
|
60221
|
+
// Write the new metadata to chain
|
|
60405
60222
|
trackId = metadata.track_id;
|
|
60406
|
-
|
|
60407
|
-
if (!useEntityManager) {
|
|
60408
|
-
_context25.next = 20;
|
|
60409
|
-
break;
|
|
60410
|
-
}
|
|
60411
|
-
|
|
60412
|
-
_context25.next = 16;
|
|
60223
|
+
_context25.next = 15;
|
|
60413
60224
|
return this.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.UPDATE, metadataMultihash);
|
|
60414
60225
|
|
|
60415
|
-
case
|
|
60226
|
+
case 15:
|
|
60416
60227
|
response = _context25.sent;
|
|
60417
|
-
txReceipt = response.txReceipt;
|
|
60418
|
-
_context25.next = 25;
|
|
60419
|
-
break;
|
|
60420
|
-
|
|
60421
|
-
case 20:
|
|
60422
|
-
multihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
60423
|
-
_context25.next = 23;
|
|
60424
|
-
return this.contracts.TrackFactoryClient.updateTrack(trackId, ownerId, multihashDecoded.digest, multihashDecoded.hashFn, multihashDecoded.size);
|
|
60228
|
+
txReceipt = response.txReceipt; // Re-associate the track id with the new metadata
|
|
60425
60229
|
|
|
60426
|
-
|
|
60427
|
-
_response3 = _context25.sent;
|
|
60428
|
-
txReceipt = _response3.txReceipt;
|
|
60429
|
-
|
|
60430
|
-
case 25:
|
|
60431
|
-
_context25.next = 27;
|
|
60230
|
+
_context25.next = 19;
|
|
60432
60231
|
return this.creatorNode.associateTrack(trackId, metadataFileUUID, txReceipt.blockNumber);
|
|
60433
60232
|
|
|
60434
|
-
case
|
|
60233
|
+
case 19:
|
|
60435
60234
|
return _context25.abrupt("return", {
|
|
60436
60235
|
blockHash: txReceipt.blockHash,
|
|
60437
60236
|
blockNumber: txReceipt.blockNumber,
|
|
60438
60237
|
trackId: trackId
|
|
60439
60238
|
});
|
|
60440
60239
|
|
|
60441
|
-
case
|
|
60240
|
+
case 20:
|
|
60442
60241
|
case "end":
|
|
60443
60242
|
return _context25.stop();
|
|
60444
60243
|
}
|
|
@@ -60446,7 +60245,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60446
60245
|
}, _callee25, this);
|
|
60447
60246
|
}));
|
|
60448
60247
|
|
|
60449
|
-
function updateTrack(
|
|
60248
|
+
function updateTrack(_x25) {
|
|
60450
60249
|
return _updateTrack.apply(this, arguments);
|
|
60451
60250
|
}
|
|
60452
60251
|
|
|
@@ -60488,7 +60287,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60488
60287
|
}, _callee26, this);
|
|
60489
60288
|
}));
|
|
60490
60289
|
|
|
60491
|
-
function logTrackListen(
|
|
60290
|
+
function logTrackListen(_x26, _x27) {
|
|
60492
60291
|
return _logTrackListen.apply(this, arguments);
|
|
60493
60292
|
}
|
|
60494
60293
|
|
|
@@ -60522,7 +60321,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60522
60321
|
}, _callee27, this);
|
|
60523
60322
|
}));
|
|
60524
60323
|
|
|
60525
|
-
function addTrackRepost(
|
|
60324
|
+
function addTrackRepost(_x28) {
|
|
60526
60325
|
return _addTrackRepost.apply(this, arguments);
|
|
60527
60326
|
}
|
|
60528
60327
|
|
|
@@ -60557,7 +60356,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60557
60356
|
}, _callee28, this);
|
|
60558
60357
|
}));
|
|
60559
60358
|
|
|
60560
|
-
function deleteTrackRepost(
|
|
60359
|
+
function deleteTrackRepost(_x29) {
|
|
60561
60360
|
return _deleteTrackRepost.apply(this, arguments);
|
|
60562
60361
|
}
|
|
60563
60362
|
|
|
@@ -60592,7 +60391,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60592
60391
|
}, _callee29, this);
|
|
60593
60392
|
}));
|
|
60594
60393
|
|
|
60595
|
-
function addTrackSave(
|
|
60394
|
+
function addTrackSave(_x30) {
|
|
60596
60395
|
return _addTrackSave.apply(this, arguments);
|
|
60597
60396
|
}
|
|
60598
60397
|
|
|
@@ -60627,7 +60426,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60627
60426
|
}, _callee30, this);
|
|
60628
60427
|
}));
|
|
60629
60428
|
|
|
60630
|
-
function deleteTrackSave(
|
|
60429
|
+
function deleteTrackSave(_x31) {
|
|
60631
60430
|
return _deleteTrackSave.apply(this, arguments);
|
|
60632
60431
|
}
|
|
60633
60432
|
|
|
@@ -60641,41 +60440,29 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60641
60440
|
}, {
|
|
60642
60441
|
key: "deleteTrack",
|
|
60643
60442
|
value: function () {
|
|
60644
|
-
var _deleteTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(trackId
|
|
60443
|
+
var _deleteTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(trackId) {
|
|
60645
60444
|
var ownerId;
|
|
60646
60445
|
return regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
60647
60446
|
while (1) {
|
|
60648
60447
|
switch (_context31.prev = _context31.next) {
|
|
60649
60448
|
case 0:
|
|
60650
|
-
if (!useEntityManager) {
|
|
60651
|
-
_context31.next = 9;
|
|
60652
|
-
break;
|
|
60653
|
-
}
|
|
60654
|
-
|
|
60655
60449
|
ownerId = this.userStateManager.getCurrentUserId();
|
|
60656
60450
|
|
|
60657
60451
|
if (ownerId) {
|
|
60658
|
-
_context31.next =
|
|
60452
|
+
_context31.next = 3;
|
|
60659
60453
|
break;
|
|
60660
60454
|
}
|
|
60661
60455
|
|
|
60662
60456
|
throw new Error('No users loaded for this wallet');
|
|
60663
60457
|
|
|
60664
|
-
case
|
|
60665
|
-
_context31.next =
|
|
60458
|
+
case 3:
|
|
60459
|
+
_context31.next = 5;
|
|
60666
60460
|
return this.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.DELETE, '');
|
|
60667
60461
|
|
|
60668
|
-
case
|
|
60669
|
-
return _context31.abrupt("return", _context31.sent);
|
|
60670
|
-
|
|
60671
|
-
case 9:
|
|
60672
|
-
_context31.next = 11;
|
|
60673
|
-
return this.contracts.TrackFactoryClient.deleteTrack(trackId);
|
|
60674
|
-
|
|
60675
|
-
case 11:
|
|
60462
|
+
case 5:
|
|
60676
60463
|
return _context31.abrupt("return", _context31.sent);
|
|
60677
60464
|
|
|
60678
|
-
case
|
|
60465
|
+
case 6:
|
|
60679
60466
|
case "end":
|
|
60680
60467
|
return _context31.stop();
|
|
60681
60468
|
}
|
|
@@ -60683,7 +60470,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60683
60470
|
}, _callee31, this);
|
|
60684
60471
|
}));
|
|
60685
60472
|
|
|
60686
|
-
function deleteTrack(
|
|
60473
|
+
function deleteTrack(_x32) {
|
|
60687
60474
|
return _deleteTrack.apply(this, arguments);
|
|
60688
60475
|
}
|
|
60689
60476
|
|
|
@@ -66314,9 +66101,7 @@ var rolloverNodes = /*#__PURE__*/function () {
|
|
|
66314
66101
|
newMetadata.creator_node_endpoint = newEndpoints.join(',');
|
|
66315
66102
|
console.debug("Sanity Check - rolloverNodes - new nodes ".concat(newMetadata.creator_node_endpoint));
|
|
66316
66103
|
_context4.next = 32;
|
|
66317
|
-
return (_libs$User3 = libs.User) === null || _libs$User3 === void 0 ? void 0 : _libs$User3.updateCreator(user.user_id, newMetadata
|
|
66318
|
-
/* useEntityManager */
|
|
66319
|
-
);
|
|
66104
|
+
return (_libs$User3 = libs.User) === null || _libs$User3 === void 0 ? void 0 : _libs$User3.updateCreator(user.user_id, newMetadata);
|
|
66320
66105
|
|
|
66321
66106
|
case 32:
|
|
66322
66107
|
_context4.next = 37;
|