@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.esm.js
CHANGED
|
@@ -36932,9 +36932,9 @@ var ChatPermission;
|
|
|
36932
36932
|
})(ChatPermission || (ChatPermission = {}));
|
|
36933
36933
|
|
|
36934
36934
|
var name = "@audius/sdk";
|
|
36935
|
-
var version = "1.0.
|
|
36935
|
+
var version = "1.0.37";
|
|
36936
36936
|
var audius = {
|
|
36937
|
-
releaseSHA: "
|
|
36937
|
+
releaseSHA: "dd0ddae94286c577c8a34ada50f2f79f613b55d2"
|
|
36938
36938
|
};
|
|
36939
36939
|
var description = "";
|
|
36940
36940
|
var main = "dist/index.cjs.js";
|
|
@@ -54952,14 +54952,12 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
54952
54952
|
userBankOutcomes,
|
|
54953
54953
|
feePayerOverride,
|
|
54954
54954
|
generateRecoveryLink,
|
|
54955
|
-
useEntityManager,
|
|
54956
54955
|
phases,
|
|
54957
54956
|
phase,
|
|
54958
54957
|
userId,
|
|
54959
54958
|
blockHash,
|
|
54960
54959
|
blockNumber,
|
|
54961
54960
|
ownerWallet,
|
|
54962
|
-
response,
|
|
54963
54961
|
newMetadata,
|
|
54964
54962
|
_args4 = arguments;
|
|
54965
54963
|
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
@@ -54974,7 +54972,6 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
54974
54972
|
userBankOutcomes = _args4.length > 8 && _args4[8] !== undefined ? _args4[8] : {};
|
|
54975
54973
|
feePayerOverride = _args4.length > 9 && _args4[9] !== undefined ? _args4[9] : null;
|
|
54976
54974
|
generateRecoveryLink = _args4.length > 10 && _args4[10] !== undefined ? _args4[10] : true;
|
|
54977
|
-
useEntityManager = _args4.length > 11 && _args4[11] !== undefined ? _args4[11] : false;
|
|
54978
54975
|
phases = {
|
|
54979
54976
|
ADD_REPLICA_SET: 'ADD_REPLICA_SET',
|
|
54980
54977
|
CREATE_USER_RECORD: 'CREATE_USER_RECORD',
|
|
@@ -54984,50 +54981,50 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
54984
54981
|
ADD_USER: 'ADD_USER'
|
|
54985
54982
|
};
|
|
54986
54983
|
phase = '';
|
|
54987
|
-
_context4.prev =
|
|
54984
|
+
_context4.prev = 10;
|
|
54988
54985
|
this.REQUIRES(Services.CREATOR_NODE, Services.IDENTITY_SERVICE);
|
|
54989
54986
|
|
|
54990
54987
|
if (!this.web3Manager.web3IsExternal()) {
|
|
54991
|
-
_context4.next =
|
|
54988
|
+
_context4.next = 18;
|
|
54992
54989
|
break;
|
|
54993
54990
|
}
|
|
54994
54991
|
|
|
54995
54992
|
phase = phases.CREATE_USER_RECORD;
|
|
54996
|
-
_context4.next =
|
|
54993
|
+
_context4.next = 16;
|
|
54997
54994
|
return this.identityService.createUserRecord(email, this.web3Manager.getWalletAddress());
|
|
54998
54995
|
|
|
54999
|
-
case
|
|
55000
|
-
_context4.next =
|
|
54996
|
+
case 16:
|
|
54997
|
+
_context4.next = 28;
|
|
55001
54998
|
break;
|
|
55002
54999
|
|
|
55003
|
-
case
|
|
55000
|
+
case 18:
|
|
55004
55001
|
this.REQUIRES(Services.HEDGEHOG); // If an owner wallet already exists, don't try to recreate it
|
|
55005
55002
|
|
|
55006
55003
|
if (hasWallet) {
|
|
55007
|
-
_context4.next =
|
|
55004
|
+
_context4.next = 28;
|
|
55008
55005
|
break;
|
|
55009
55006
|
}
|
|
55010
55007
|
|
|
55011
55008
|
phase = phases.HEDGEHOG_SIGNUP;
|
|
55012
|
-
_context4.next =
|
|
55009
|
+
_context4.next = 23;
|
|
55013
55010
|
return this.hedgehog.signUp(email, password);
|
|
55014
55011
|
|
|
55015
|
-
case
|
|
55012
|
+
case 23:
|
|
55016
55013
|
ownerWallet = _context4.sent;
|
|
55017
55014
|
this.web3Manager.setOwnerWallet(ownerWallet);
|
|
55018
55015
|
|
|
55019
55016
|
if (!generateRecoveryLink) {
|
|
55020
|
-
_context4.next =
|
|
55017
|
+
_context4.next = 28;
|
|
55021
55018
|
break;
|
|
55022
55019
|
}
|
|
55023
55020
|
|
|
55024
|
-
_context4.next =
|
|
55021
|
+
_context4.next = 28;
|
|
55025
55022
|
return this.generateRecoveryLink({
|
|
55026
55023
|
handle: metadata.handle,
|
|
55027
55024
|
host: host
|
|
55028
55025
|
});
|
|
55029
55026
|
|
|
55030
|
-
case
|
|
55027
|
+
case 28:
|
|
55031
55028
|
// Create a wAudio user bank address.
|
|
55032
55029
|
// If userbank creation fails, we still proceed
|
|
55033
55030
|
// through signup
|
|
@@ -55083,75 +55080,42 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
55083
55080
|
} // Add user to chain
|
|
55084
55081
|
|
|
55085
55082
|
|
|
55086
|
-
|
|
55087
|
-
_context4.next = 47;
|
|
55088
|
-
break;
|
|
55089
|
-
}
|
|
55090
|
-
|
|
55091
|
-
phase = phases.ADD_USER;
|
|
55092
|
-
_context4.next = 34;
|
|
55093
|
-
return this.User.addUser(metadata);
|
|
55094
|
-
|
|
55095
|
-
case 34:
|
|
55096
|
-
response = _context4.sent;
|
|
55097
|
-
userId = response.userId;
|
|
55098
|
-
blockHash = response.blockHash;
|
|
55099
|
-
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)
|
|
55100
|
-
|
|
55101
|
-
phase = phases.ADD_REPLICA_SET;
|
|
55102
|
-
_context4.next = 41;
|
|
55103
|
-
return this.User.assignReplicaSet({
|
|
55104
|
-
userId: userId
|
|
55105
|
-
});
|
|
55106
|
-
|
|
55107
|
-
case 41:
|
|
55108
|
-
metadata = _context4.sent;
|
|
55109
|
-
// Upload profile pic and cover photo to primary Content Node and sync across secondaries
|
|
55110
|
-
phase = phases.UPLOAD_PROFILE_IMAGES;
|
|
55111
|
-
_context4.next = 45;
|
|
55112
|
-
return this.User.uploadProfileImages(profilePictureFile, coverPhotoFile, metadata, useEntityManager);
|
|
55113
|
-
|
|
55114
|
-
case 45:
|
|
55115
|
-
_context4.next = 52;
|
|
55116
|
-
break;
|
|
55117
|
-
|
|
55118
|
-
case 47:
|
|
55119
|
-
_context4.next = 49;
|
|
55083
|
+
_context4.next = 31;
|
|
55120
55084
|
return this.User.createEntityManagerUser({
|
|
55121
55085
|
metadata: metadata
|
|
55122
55086
|
});
|
|
55123
55087
|
|
|
55124
|
-
case
|
|
55088
|
+
case 31:
|
|
55125
55089
|
newMetadata = _context4.sent;
|
|
55126
|
-
_context4.next =
|
|
55127
|
-
return this.User.uploadProfileImages(profilePictureFile, coverPhotoFile, newMetadata
|
|
55090
|
+
_context4.next = 34;
|
|
55091
|
+
return this.User.uploadProfileImages(profilePictureFile, coverPhotoFile, newMetadata);
|
|
55128
55092
|
|
|
55129
|
-
case
|
|
55130
|
-
_context4.next =
|
|
55093
|
+
case 34:
|
|
55094
|
+
_context4.next = 39;
|
|
55131
55095
|
break;
|
|
55132
55096
|
|
|
55133
|
-
case
|
|
55134
|
-
_context4.prev =
|
|
55135
|
-
_context4.t0 = _context4["catch"](
|
|
55097
|
+
case 36:
|
|
55098
|
+
_context4.prev = 36;
|
|
55099
|
+
_context4.t0 = _context4["catch"](10);
|
|
55136
55100
|
return _context4.abrupt("return", {
|
|
55137
55101
|
error: _context4.t0.message,
|
|
55138
55102
|
phase: phase,
|
|
55139
55103
|
errorStatus: _context4.t0.response ? _context4.t0.response.status : null
|
|
55140
55104
|
});
|
|
55141
55105
|
|
|
55142
|
-
case
|
|
55106
|
+
case 39:
|
|
55143
55107
|
return _context4.abrupt("return", {
|
|
55144
55108
|
blockHash: blockHash,
|
|
55145
55109
|
blockNumber: blockNumber,
|
|
55146
55110
|
userId: userId
|
|
55147
55111
|
});
|
|
55148
55112
|
|
|
55149
|
-
case
|
|
55113
|
+
case 40:
|
|
55150
55114
|
case "end":
|
|
55151
55115
|
return _context4.stop();
|
|
55152
55116
|
}
|
|
55153
55117
|
}
|
|
55154
|
-
}, _callee4, this, [[
|
|
55118
|
+
}, _callee4, this, [[10, 36]]);
|
|
55155
55119
|
}));
|
|
55156
55120
|
|
|
55157
55121
|
function signUp(_x3, _x4, _x5) {
|
|
@@ -57237,7 +57201,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57237
57201
|
}, {
|
|
57238
57202
|
key: "uploadProfileImages",
|
|
57239
57203
|
value: function () {
|
|
57240
|
-
var _uploadProfileImages = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(profilePictureFile, coverPhotoFile, metadata
|
|
57204
|
+
var _uploadProfileImages = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(profilePictureFile, coverPhotoFile, metadata) {
|
|
57241
57205
|
var didMetadataUpdate, resp, _resp;
|
|
57242
57206
|
|
|
57243
57207
|
return regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
@@ -57282,8 +57246,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57282
57246
|
_context13.next = 16;
|
|
57283
57247
|
return this.updateAndUploadMetadata({
|
|
57284
57248
|
newMetadata: metadata,
|
|
57285
|
-
userId: metadata.user_id
|
|
57286
|
-
useEntityManager: useEntityManager
|
|
57249
|
+
userId: metadata.user_id
|
|
57287
57250
|
});
|
|
57288
57251
|
|
|
57289
57252
|
case 16:
|
|
@@ -57297,7 +57260,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57297
57260
|
}, _callee13, this);
|
|
57298
57261
|
}));
|
|
57299
57262
|
|
|
57300
|
-
function uploadProfileImages(_x10, _x11, _x12
|
|
57263
|
+
function uploadProfileImages(_x10, _x11, _x12) {
|
|
57301
57264
|
return _uploadProfileImages.apply(this, arguments);
|
|
57302
57265
|
}
|
|
57303
57266
|
|
|
@@ -57378,7 +57341,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57378
57341
|
}, _callee14);
|
|
57379
57342
|
}));
|
|
57380
57343
|
|
|
57381
|
-
return function (
|
|
57344
|
+
return function (_x14) {
|
|
57382
57345
|
return _ref3.apply(this, arguments);
|
|
57383
57346
|
};
|
|
57384
57347
|
}()));
|
|
@@ -57427,8 +57390,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57427
57390
|
_context15.next = 42;
|
|
57428
57391
|
return this.updateAndUploadMetadata({
|
|
57429
57392
|
newMetadata: newMetadata,
|
|
57430
|
-
userId: userId
|
|
57431
|
-
useEntityManager: true
|
|
57393
|
+
userId: userId
|
|
57432
57394
|
});
|
|
57433
57395
|
|
|
57434
57396
|
case 42:
|
|
@@ -57460,7 +57422,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57460
57422
|
}, _callee15, this, [[7, 47]]);
|
|
57461
57423
|
}));
|
|
57462
57424
|
|
|
57463
|
-
function createEntityManagerUser(
|
|
57425
|
+
function createEntityManagerUser(_x13) {
|
|
57464
57426
|
return _createEntityManagerUser.apply(this, arguments);
|
|
57465
57427
|
}
|
|
57466
57428
|
|
|
@@ -57536,7 +57498,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57536
57498
|
}, _callee16, this);
|
|
57537
57499
|
}));
|
|
57538
57500
|
|
|
57539
|
-
function addUser(
|
|
57501
|
+
function addUser(_x15) {
|
|
57540
57502
|
return _addUser.apply(this, arguments);
|
|
57541
57503
|
}
|
|
57542
57504
|
|
|
@@ -57571,7 +57533,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57571
57533
|
}, _callee17, this);
|
|
57572
57534
|
}));
|
|
57573
57535
|
|
|
57574
|
-
function updateEntityManagerReplicaSet(
|
|
57536
|
+
function updateEntityManagerReplicaSet(_x16) {
|
|
57575
57537
|
return _updateEntityManagerReplicaSet.apply(this, arguments);
|
|
57576
57538
|
}
|
|
57577
57539
|
|
|
@@ -57634,7 +57596,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57634
57596
|
}, _callee18, this);
|
|
57635
57597
|
}));
|
|
57636
57598
|
|
|
57637
|
-
function updateUser(
|
|
57599
|
+
function updateUser(_x17, _x18) {
|
|
57638
57600
|
return _updateUser.apply(this, arguments);
|
|
57639
57601
|
}
|
|
57640
57602
|
|
|
@@ -57647,8 +57609,8 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57647
57609
|
}, {
|
|
57648
57610
|
key: "updateCreator",
|
|
57649
57611
|
value: function () {
|
|
57650
|
-
var _updateCreator = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(userId, metadata
|
|
57651
|
-
var newMetadata, logPrefix, fnStartMs, startMs, user, oldMetadata, updateEndpointTxBlockNumber, _yield$this$creatorNo, metadataMultihash, metadataFileUUID,
|
|
57612
|
+
var _updateCreator = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(userId, metadata) {
|
|
57613
|
+
var newMetadata, logPrefix, fnStartMs, startMs, user, oldMetadata, updateEndpointTxBlockNumber, _yield$this$creatorNo, metadataMultihash, metadataFileUUID, response, txReceipt, latestBlockNumber, latestBlockHash;
|
|
57652
57614
|
|
|
57653
57615
|
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
57654
57616
|
while (1) {
|
|
@@ -57660,7 +57622,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57660
57622
|
|
|
57661
57623
|
this._validateUserMetadata(newMetadata);
|
|
57662
57624
|
|
|
57663
|
-
logPrefix = "[User:updateCreator()] [userId: ".concat(userId, "]
|
|
57625
|
+
logPrefix = "[User:updateCreator()] [userId: ".concat(userId, "]");
|
|
57664
57626
|
fnStartMs = Date.now();
|
|
57665
57627
|
startMs = fnStartMs; // Error if libs instance does not already have existing user state
|
|
57666
57628
|
|
|
@@ -57709,60 +57671,28 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57709
57671
|
_yield$this$creatorNo = _context19.sent;
|
|
57710
57672
|
metadataMultihash = _yield$this$creatorNo.metadataMultihash;
|
|
57711
57673
|
metadataFileUUID = _yield$this$creatorNo.metadataFileUUID;
|
|
57712
|
-
|
|
57713
|
-
if (useEntityManager) {
|
|
57714
|
-
_context19.next = 37;
|
|
57715
|
-
break;
|
|
57716
|
-
}
|
|
57717
|
-
|
|
57718
|
-
// Write metadata multihash to chain
|
|
57719
|
-
updatedMultihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
57720
|
-
_context19.next = 28;
|
|
57721
|
-
return this.contracts.UserFactoryClient.updateMultihash(userId, updatedMultihashDecoded.digest);
|
|
57722
|
-
|
|
57723
|
-
case 28:
|
|
57724
|
-
updateMultiHashResp = _context19.sent;
|
|
57725
|
-
txReceipt = updateMultiHashResp.txReceipt; // Write remaining metadata fields to chain
|
|
57726
|
-
|
|
57727
|
-
_context19.next = 32;
|
|
57728
|
-
return this._updateUserOperations(newMetadata, oldMetadata, userId);
|
|
57729
|
-
|
|
57730
|
-
case 32:
|
|
57731
|
-
updateUserResp = _context19.sent;
|
|
57732
|
-
latestBlockHash = updateUserResp.latestBlockHash;
|
|
57733
|
-
latestBlockNumber = Math.max(txReceipt.blockNumber, updateUserResp.latestBlockNumber);
|
|
57734
|
-
_context19.next = 42;
|
|
57735
|
-
break;
|
|
57736
|
-
|
|
57737
|
-
case 37:
|
|
57738
|
-
_context19.next = 39;
|
|
57674
|
+
_context19.next = 26;
|
|
57739
57675
|
return this.contracts.EntityManagerClient.manageEntity(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.UPDATE, metadataMultihash);
|
|
57740
57676
|
|
|
57741
|
-
case
|
|
57677
|
+
case 26:
|
|
57742
57678
|
response = _context19.sent;
|
|
57743
57679
|
txReceipt = response.txReceipt;
|
|
57744
57680
|
latestBlockNumber = txReceipt.blockNumber;
|
|
57681
|
+
latestBlockHash = txReceipt.blockHash; // Write to CN to associate blockchain user id with updated metadata and block number
|
|
57745
57682
|
|
|
57746
|
-
|
|
57747
|
-
_context19.next = 44;
|
|
57683
|
+
_context19.next = 32;
|
|
57748
57684
|
return this.creatorNode.associateCreator(userId, metadataFileUUID, latestBlockNumber);
|
|
57749
57685
|
|
|
57750
|
-
case
|
|
57686
|
+
case 32:
|
|
57751
57687
|
// Update libs instance with new user metadata object
|
|
57752
57688
|
this.userStateManager.setCurrentUser(_objectSpread2(_objectSpread2({}, oldMetadata), newMetadata));
|
|
57753
|
-
|
|
57754
|
-
if (!latestBlockHash || !latestBlockNumber) {
|
|
57755
|
-
latestBlockHash = txReceipt.blockHash;
|
|
57756
|
-
latestBlockNumber = txReceipt.blockNumber;
|
|
57757
|
-
}
|
|
57758
|
-
|
|
57759
57689
|
return _context19.abrupt("return", {
|
|
57760
57690
|
blockHash: latestBlockHash,
|
|
57761
57691
|
blockNumber: latestBlockNumber,
|
|
57762
57692
|
userId: userId
|
|
57763
57693
|
});
|
|
57764
57694
|
|
|
57765
|
-
case
|
|
57695
|
+
case 34:
|
|
57766
57696
|
case "end":
|
|
57767
57697
|
return _context19.stop();
|
|
57768
57698
|
}
|
|
@@ -57770,7 +57700,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57770
57700
|
}, _callee19, this);
|
|
57771
57701
|
}));
|
|
57772
57702
|
|
|
57773
|
-
function updateCreator(
|
|
57703
|
+
function updateCreator(_x19, _x20) {
|
|
57774
57704
|
return _updateCreator.apply(this, arguments);
|
|
57775
57705
|
}
|
|
57776
57706
|
|
|
@@ -57783,30 +57713,18 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57783
57713
|
}, {
|
|
57784
57714
|
key: "updateIsVerified",
|
|
57785
57715
|
value: function () {
|
|
57786
|
-
var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId,
|
|
57716
|
+
var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId, privateKey) {
|
|
57787
57717
|
return regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
57788
57718
|
while (1) {
|
|
57789
57719
|
switch (_context20.prev = _context20.next) {
|
|
57790
57720
|
case 0:
|
|
57791
|
-
|
|
57792
|
-
_context20.next = 6;
|
|
57793
|
-
break;
|
|
57794
|
-
}
|
|
57795
|
-
|
|
57796
|
-
_context20.next = 3;
|
|
57721
|
+
_context20.next = 2;
|
|
57797
57722
|
return this.contracts.EntityManagerClient.getManageEntityParams(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.VERIFY, '', privateKey);
|
|
57798
57723
|
|
|
57799
|
-
case
|
|
57800
|
-
return _context20.abrupt("return", _context20.sent);
|
|
57801
|
-
|
|
57802
|
-
case 6:
|
|
57803
|
-
_context20.next = 8;
|
|
57804
|
-
return this.contracts.UserFactoryClient.updateIsVerified(userId, isVerified, privateKey);
|
|
57805
|
-
|
|
57806
|
-
case 8:
|
|
57724
|
+
case 2:
|
|
57807
57725
|
return _context20.abrupt("return", _context20.sent);
|
|
57808
57726
|
|
|
57809
|
-
case
|
|
57727
|
+
case 3:
|
|
57810
57728
|
case "end":
|
|
57811
57729
|
return _context20.stop();
|
|
57812
57730
|
}
|
|
@@ -57814,7 +57732,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57814
57732
|
}, _callee20, this);
|
|
57815
57733
|
}));
|
|
57816
57734
|
|
|
57817
|
-
function updateIsVerified(
|
|
57735
|
+
function updateIsVerified(_x21, _x22) {
|
|
57818
57736
|
return _updateIsVerified.apply(this, arguments);
|
|
57819
57737
|
}
|
|
57820
57738
|
|
|
@@ -57848,7 +57766,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57848
57766
|
}, _callee21, this);
|
|
57849
57767
|
}));
|
|
57850
57768
|
|
|
57851
|
-
function addUserFollow(
|
|
57769
|
+
function addUserFollow(_x23) {
|
|
57852
57770
|
return _addUserFollow.apply(this, arguments);
|
|
57853
57771
|
}
|
|
57854
57772
|
|
|
@@ -57882,7 +57800,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57882
57800
|
}, _callee22, this);
|
|
57883
57801
|
}));
|
|
57884
57802
|
|
|
57885
|
-
function deleteUserFollow(
|
|
57803
|
+
function deleteUserFollow(_x24) {
|
|
57886
57804
|
return _deleteUserFollow.apply(this, arguments);
|
|
57887
57805
|
}
|
|
57888
57806
|
|
|
@@ -57928,7 +57846,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57928
57846
|
}, _callee23, this, [[0, 8]]);
|
|
57929
57847
|
}));
|
|
57930
57848
|
|
|
57931
|
-
function addUserSubscribe(
|
|
57849
|
+
function addUserSubscribe(_x25) {
|
|
57932
57850
|
return _addUserSubscribe.apply(this, arguments);
|
|
57933
57851
|
}
|
|
57934
57852
|
|
|
@@ -57974,7 +57892,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57974
57892
|
}, _callee24, this, [[0, 8]]);
|
|
57975
57893
|
}));
|
|
57976
57894
|
|
|
57977
|
-
function deleteUserSubscribe(
|
|
57895
|
+
function deleteUserSubscribe(_x26) {
|
|
57978
57896
|
return _deleteUserSubscribe.apply(this, arguments);
|
|
57979
57897
|
}
|
|
57980
57898
|
|
|
@@ -57991,13 +57909,13 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57991
57909
|
key: "updateAndUploadMetadata",
|
|
57992
57910
|
value: function () {
|
|
57993
57911
|
var _updateAndUploadMetadata = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(_ref5) {
|
|
57994
|
-
var newMetadata, userId,
|
|
57912
|
+
var newMetadata, userId, phases, phase, oldMetadata, logPrefix, fnStartMs, startMs, _yield$this$_updateRe, _txReceipt, replicaSetSPIDs, _yield$this$creatorNo2, metadataMultihash, metadataFileUUID, response, txReceipt, blockNumber, errorMsg;
|
|
57995
57913
|
|
|
57996
57914
|
return regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
57997
57915
|
while (1) {
|
|
57998
57916
|
switch (_context25.prev = _context25.next) {
|
|
57999
57917
|
case 0:
|
|
58000
|
-
newMetadata = _ref5.newMetadata, userId = _ref5.userId
|
|
57918
|
+
newMetadata = _ref5.newMetadata, userId = _ref5.userId;
|
|
58001
57919
|
this.REQUIRES(Services.CREATOR_NODE, Services.DISCOVERY_PROVIDER);
|
|
58002
57920
|
this.IS_OBJECT(newMetadata);
|
|
58003
57921
|
phases = {
|
|
@@ -58028,7 +57946,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58028
57946
|
_context25.prev = 13;
|
|
58029
57947
|
|
|
58030
57948
|
if (!(newMetadata.creator_node_endpoint !== oldMetadata.creator_node_endpoint)) {
|
|
58031
|
-
_context25.next =
|
|
57949
|
+
_context25.next = 28;
|
|
58032
57950
|
break;
|
|
58033
57951
|
}
|
|
58034
57952
|
|
|
@@ -58041,39 +57959,23 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58041
57959
|
_txReceipt = _yield$this$_updateRe.txReceipt;
|
|
58042
57960
|
replicaSetSPIDs = _yield$this$_updateRe.replicaSetSPIDs;
|
|
58043
57961
|
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] _updateReplicaSetOnChain() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58044
|
-
|
|
58045
|
-
if (!useEntityManager) {
|
|
58046
|
-
_context25.next = 31;
|
|
58047
|
-
break;
|
|
58048
|
-
}
|
|
58049
|
-
|
|
58050
57962
|
startMs = Date.now();
|
|
58051
|
-
_context25.next =
|
|
57963
|
+
_context25.next = 25;
|
|
58052
57964
|
return this.waitForReplicaSetDiscoveryIndexing(userId, replicaSetSPIDs, _txReceipt.blockNumber);
|
|
58053
57965
|
|
|
58054
|
-
case
|
|
57966
|
+
case 25:
|
|
58055
57967
|
// @ts-expect-error
|
|
58056
57968
|
newMetadata.primary_id = replicaSetSPIDs[0];
|
|
58057
57969
|
newMetadata.secondary_ids = replicaSetSPIDs.slice(1);
|
|
58058
57970
|
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] waitForReplicaSetDiscoveryIndexing() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58059
|
-
_context25.next = 35;
|
|
58060
|
-
break;
|
|
58061
|
-
|
|
58062
|
-
case 31:
|
|
58063
|
-
startMs = Date.now();
|
|
58064
|
-
_context25.next = 34;
|
|
58065
|
-
return this._waitForURSMCreatorNodeEndpointIndexing(userId, replicaSetSPIDs);
|
|
58066
|
-
|
|
58067
|
-
case 34:
|
|
58068
|
-
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] _waitForURSMCreatorNodeEndpointIndexing() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58069
57971
|
|
|
58070
|
-
case
|
|
57972
|
+
case 28:
|
|
58071
57973
|
// Upload new metadata object to CN
|
|
58072
57974
|
phase = phases.UPLOAD_METADATA;
|
|
58073
|
-
_context25.next =
|
|
57975
|
+
_context25.next = 31;
|
|
58074
57976
|
return this.creatorNode.uploadCreatorContent(newMetadata);
|
|
58075
57977
|
|
|
58076
|
-
case
|
|
57978
|
+
case 31:
|
|
58077
57979
|
_yield$this$creatorNo2 = _context25.sent;
|
|
58078
57980
|
metadataMultihash = _yield$this$creatorNo2.metadataMultihash;
|
|
58079
57981
|
metadataFileUUID = _yield$this$creatorNo2.metadataFileUUID;
|
|
@@ -58081,85 +57983,54 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58081
57983
|
startMs = Date.now(); // Write metadata multihash to chain
|
|
58082
57984
|
|
|
58083
57985
|
phase = phases.UPDATE_METADATA_ON_CHAIN;
|
|
58084
|
-
|
|
58085
|
-
if (!useEntityManager) {
|
|
58086
|
-
_context25.next = 52;
|
|
58087
|
-
break;
|
|
58088
|
-
}
|
|
58089
|
-
|
|
58090
|
-
_context25.next = 47;
|
|
57986
|
+
_context25.next = 39;
|
|
58091
57987
|
return this.contracts.EntityManagerClient.manageEntity(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.UPDATE, metadataMultihash);
|
|
58092
57988
|
|
|
58093
|
-
case
|
|
57989
|
+
case 39:
|
|
58094
57990
|
response = _context25.sent;
|
|
58095
57991
|
txReceipt = response.txReceipt;
|
|
58096
57992
|
blockNumber = txReceipt.blockNumber;
|
|
58097
|
-
_context25.next = 66;
|
|
58098
|
-
break;
|
|
58099
|
-
|
|
58100
|
-
case 52:
|
|
58101
|
-
updatedMultihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
58102
|
-
_context25.next = 55;
|
|
58103
|
-
return this.contracts.UserFactoryClient.updateMultihash(userId, updatedMultihashDecoded.digest);
|
|
58104
|
-
|
|
58105
|
-
case 55:
|
|
58106
|
-
res = _context25.sent;
|
|
58107
|
-
txReceipt = res.txReceipt;
|
|
58108
|
-
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] UserFactoryClient.updateMultihash() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58109
|
-
startMs = Date.now(); // Write remaining metadata fields to chain
|
|
58110
|
-
|
|
58111
|
-
phase = phases.UPDATE_USER_ON_CHAIN_OPS;
|
|
58112
|
-
_context25.next = 62;
|
|
58113
|
-
return this._updateUserOperations(newMetadata, oldMetadata, userId, ['creator_node_endpoint']);
|
|
58114
|
-
|
|
58115
|
-
case 62:
|
|
58116
|
-
_yield$this$_updateUs2 = _context25.sent;
|
|
58117
|
-
latestBlockNumber = _yield$this$_updateUs2.latestBlockNumber;
|
|
58118
|
-
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] _updateUserOperations() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58119
|
-
blockNumber = Math.max(txReceipt.blockNumber, latestBlockNumber);
|
|
58120
|
-
|
|
58121
|
-
case 66:
|
|
58122
57993
|
startMs = Date.now(); // Write to CN to associate blockchain user id with updated metadata and block number
|
|
58123
57994
|
|
|
58124
57995
|
phase = phases.ASSOCIATE_USER;
|
|
58125
|
-
_context25.next =
|
|
57996
|
+
_context25.next = 46;
|
|
58126
57997
|
return this.creatorNode.associateCreator(userId, metadataFileUUID, blockNumber);
|
|
58127
57998
|
|
|
58128
|
-
case
|
|
57999
|
+
case 46:
|
|
58129
58000
|
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] creatorNode.associateCreator() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58130
58001
|
startMs = Date.now(); // Update libs instance with new user metadata object
|
|
58131
58002
|
|
|
58132
58003
|
this.userStateManager.setCurrentUser(_objectSpread2(_objectSpread2({}, oldMetadata), newMetadata));
|
|
58133
58004
|
console.log("".concat(logPrefix, " completed in ").concat(Date.now() - fnStartMs, "ms"));
|
|
58134
|
-
_context25.next =
|
|
58005
|
+
_context25.next = 59;
|
|
58135
58006
|
break;
|
|
58136
58007
|
|
|
58137
|
-
case
|
|
58138
|
-
_context25.prev =
|
|
58008
|
+
case 52:
|
|
58009
|
+
_context25.prev = 52;
|
|
58139
58010
|
_context25.t0 = _context25["catch"](13);
|
|
58140
58011
|
// TODO: think about handling the update metadata on chain and associating..
|
|
58141
58012
|
errorMsg = "updateAndUploadMetadata() Error -- Phase ".concat(phase, " in ").concat(Date.now() - fnStartMs, "ms: ").concat(_context25.t0);
|
|
58142
58013
|
|
|
58143
58014
|
if (!(_context25.t0 instanceof Error)) {
|
|
58144
|
-
_context25.next =
|
|
58015
|
+
_context25.next = 58;
|
|
58145
58016
|
break;
|
|
58146
58017
|
}
|
|
58147
58018
|
|
|
58148
58019
|
_context25.t0.message = errorMsg;
|
|
58149
58020
|
throw _context25.t0;
|
|
58150
58021
|
|
|
58151
|
-
case
|
|
58022
|
+
case 58:
|
|
58152
58023
|
throw new Error(errorMsg);
|
|
58153
58024
|
|
|
58154
|
-
case
|
|
58025
|
+
case 59:
|
|
58155
58026
|
case "end":
|
|
58156
58027
|
return _context25.stop();
|
|
58157
58028
|
}
|
|
58158
58029
|
}
|
|
58159
|
-
}, _callee25, this, [[13,
|
|
58030
|
+
}, _callee25, this, [[13, 52]]);
|
|
58160
58031
|
}));
|
|
58161
58032
|
|
|
58162
|
-
function updateAndUploadMetadata(
|
|
58033
|
+
function updateAndUploadMetadata(_x27) {
|
|
58163
58034
|
return _updateAndUploadMetadata.apply(this, arguments);
|
|
58164
58035
|
}
|
|
58165
58036
|
|
|
@@ -58278,7 +58149,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58278
58149
|
}, _callee27, this);
|
|
58279
58150
|
}));
|
|
58280
58151
|
|
|
58281
|
-
function _waitForCreatorNodeEndpointIndexing(
|
|
58152
|
+
function _waitForCreatorNodeEndpointIndexing(_x28, _x29) {
|
|
58282
58153
|
return _waitForCreatorNodeEndpointIndexing2.apply(this, arguments);
|
|
58283
58154
|
}
|
|
58284
58155
|
|
|
@@ -58381,7 +58252,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58381
58252
|
}, _callee29);
|
|
58382
58253
|
}));
|
|
58383
58254
|
|
|
58384
|
-
function waitForReplicaSetDiscoveryIndexing(
|
|
58255
|
+
function waitForReplicaSetDiscoveryIndexing(_x30, _x31, _x32) {
|
|
58385
58256
|
return _waitForReplicaSetDiscoveryIndexing.apply(this, arguments);
|
|
58386
58257
|
}
|
|
58387
58258
|
|
|
@@ -58456,7 +58327,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58456
58327
|
}, _callee31);
|
|
58457
58328
|
}));
|
|
58458
58329
|
|
|
58459
|
-
function _waitForURSMCreatorNodeEndpointIndexing(
|
|
58330
|
+
function _waitForURSMCreatorNodeEndpointIndexing(_x33, _x34) {
|
|
58460
58331
|
return _waitForURSMCreatorNodeEndpointIndexing2.apply(this, arguments);
|
|
58461
58332
|
}
|
|
58462
58333
|
|
|
@@ -58542,7 +58413,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58542
58413
|
}, _callee32, this);
|
|
58543
58414
|
}));
|
|
58544
58415
|
|
|
58545
|
-
function _addUserOperations(
|
|
58416
|
+
function _addUserOperations(_x35, _x36) {
|
|
58546
58417
|
return _addUserOperations2.apply(this, arguments);
|
|
58547
58418
|
}
|
|
58548
58419
|
|
|
@@ -58637,7 +58508,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58637
58508
|
}, _callee33, this);
|
|
58638
58509
|
}));
|
|
58639
58510
|
|
|
58640
|
-
function _updateUserOperations(
|
|
58511
|
+
function _updateUserOperations(_x37, _x38, _x39) {
|
|
58641
58512
|
return _updateUserOperations2.apply(this, arguments);
|
|
58642
58513
|
}
|
|
58643
58514
|
|
|
@@ -58672,7 +58543,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58672
58543
|
key: "_updateReplicaSetOnChain",
|
|
58673
58544
|
value: function () {
|
|
58674
58545
|
var _updateReplicaSetOnChain2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34(userId, creatorNodeEndpoint) {
|
|
58675
|
-
var primaryEndpoint, secondaries, _yield$Promise$all, _yield$Promise$all2, primarySpID, secondary1SpID, secondary2SpID,
|
|
58546
|
+
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;
|
|
58676
58547
|
|
|
58677
58548
|
return regeneratorRuntime.wrap(function _callee34$(_context34) {
|
|
58678
58549
|
while (1) {
|
|
@@ -58717,45 +58588,29 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58717
58588
|
throw new Error('Current user missing');
|
|
58718
58589
|
|
|
58719
58590
|
case 17:
|
|
58720
|
-
|
|
58721
|
-
|
|
58722
|
-
return (_this$contracts$UserR = this.contracts.UserReplicaSetManagerClient) === null || _this$contracts$UserR === void 0 ? void 0 : _this$contracts$UserR.updateReplicaSet(userId, primarySpID, [secondary1SpID, secondary2SpID]);
|
|
58723
|
-
|
|
58724
|
-
case 20:
|
|
58725
|
-
txReceipt = _context34.sent;
|
|
58726
|
-
replicaSetSPIDs = [primarySpID, secondary1SpID, secondary2SpID];
|
|
58727
|
-
updateEndpointTxBlockNumber = (_txReceipt2 = txReceipt) === null || _txReceipt2 === void 0 ? void 0 : _txReceipt2.blockNumber;
|
|
58728
|
-
_context34.next = 25;
|
|
58729
|
-
return this._waitForURSMCreatorNodeEndpointIndexing(userId, replicaSetSPIDs);
|
|
58730
|
-
|
|
58731
|
-
case 25:
|
|
58732
|
-
_context34.next = 47;
|
|
58733
|
-
break;
|
|
58734
|
-
|
|
58735
|
-
case 27:
|
|
58736
|
-
_context34.prev = 27;
|
|
58737
|
-
_context34.t0 = _context34["catch"](17);
|
|
58591
|
+
// First try to update with URSM
|
|
58592
|
+
// Fallback to EntityManager when relay errors
|
|
58738
58593
|
currentPrimaryEndpoint = CreatorNode.getPrimary(currentUser.creator_node_endpoint);
|
|
58739
58594
|
currentSecondaries = CreatorNode.getSecondaries(currentUser.creator_node_endpoint);
|
|
58740
58595
|
|
|
58741
58596
|
if (!(currentSecondaries.length < 2)) {
|
|
58742
|
-
_context34.next =
|
|
58597
|
+
_context34.next = 21;
|
|
58743
58598
|
break;
|
|
58744
58599
|
}
|
|
58745
58600
|
|
|
58746
58601
|
throw new Error("Invalid number of secondaries found - received ".concat(currentSecondaries));
|
|
58747
58602
|
|
|
58748
|
-
case
|
|
58749
|
-
_context34.next =
|
|
58603
|
+
case 21:
|
|
58604
|
+
_context34.next = 23;
|
|
58750
58605
|
return Promise.all([this._retrieveSpIDFromEndpoint(currentPrimaryEndpoint), this._retrieveSpIDFromEndpoint(currentSecondaries[0]), this._retrieveSpIDFromEndpoint(currentSecondaries[1])]);
|
|
58751
58606
|
|
|
58752
|
-
case
|
|
58607
|
+
case 23:
|
|
58753
58608
|
_yield$Promise$all3 = _context34.sent;
|
|
58754
58609
|
_yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 3);
|
|
58755
58610
|
oldPrimary = _yield$Promise$all4[0];
|
|
58756
58611
|
oldSecondary1SpID = _yield$Promise$all4[1];
|
|
58757
58612
|
oldSecondary2SpID = _yield$Promise$all4[2];
|
|
58758
|
-
_context34.next =
|
|
58613
|
+
_context34.next = 30;
|
|
58759
58614
|
return this.updateEntityManagerReplicaSet({
|
|
58760
58615
|
userId: userId,
|
|
58761
58616
|
primary: primarySpID,
|
|
@@ -58764,36 +58619,36 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58764
58619
|
oldSecondaries: [oldSecondary1SpID, oldSecondary2SpID]
|
|
58765
58620
|
});
|
|
58766
58621
|
|
|
58767
|
-
case
|
|
58622
|
+
case 30:
|
|
58768
58623
|
txReceipt = _context34.sent;
|
|
58769
58624
|
replicaSetSPIDs = [primarySpID, secondary1SpID, secondary2SpID];
|
|
58770
|
-
updateEndpointTxBlockNumber =
|
|
58771
|
-
_context34.next =
|
|
58625
|
+
updateEndpointTxBlockNumber = txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.blockNumber;
|
|
58626
|
+
_context34.next = 35;
|
|
58772
58627
|
return this.waitForReplicaSetDiscoveryIndexing(userId, replicaSetSPIDs, updateEndpointTxBlockNumber);
|
|
58773
58628
|
|
|
58774
|
-
case
|
|
58629
|
+
case 35:
|
|
58775
58630
|
if (txReceipt) {
|
|
58776
|
-
_context34.next =
|
|
58631
|
+
_context34.next = 37;
|
|
58777
58632
|
break;
|
|
58778
58633
|
}
|
|
58779
58634
|
|
|
58780
58635
|
throw new Error('Unable to update replica set on chain');
|
|
58781
58636
|
|
|
58782
|
-
case
|
|
58637
|
+
case 37:
|
|
58783
58638
|
return _context34.abrupt("return", {
|
|
58784
58639
|
txReceipt: txReceipt,
|
|
58785
58640
|
replicaSetSPIDs: replicaSetSPIDs
|
|
58786
58641
|
});
|
|
58787
58642
|
|
|
58788
|
-
case
|
|
58643
|
+
case 38:
|
|
58789
58644
|
case "end":
|
|
58790
58645
|
return _context34.stop();
|
|
58791
58646
|
}
|
|
58792
58647
|
}
|
|
58793
|
-
}, _callee34, this
|
|
58648
|
+
}, _callee34, this);
|
|
58794
58649
|
}));
|
|
58795
58650
|
|
|
58796
|
-
function _updateReplicaSetOnChain(
|
|
58651
|
+
function _updateReplicaSetOnChain(_x40, _x41) {
|
|
58797
58652
|
return _updateReplicaSetOnChain2.apply(this, arguments);
|
|
58798
58653
|
}
|
|
58799
58654
|
|
|
@@ -58848,7 +58703,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58848
58703
|
}, _callee35, this);
|
|
58849
58704
|
}));
|
|
58850
58705
|
|
|
58851
|
-
function _retrieveSpIDFromEndpoint(
|
|
58706
|
+
function _retrieveSpIDFromEndpoint(_x42) {
|
|
58852
58707
|
return _retrieveSpIDFromEndpoint2.apply(this, arguments);
|
|
58853
58708
|
}
|
|
58854
58709
|
|
|
@@ -59695,10 +59550,10 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
59695
59550
|
}, {
|
|
59696
59551
|
key: "uploadTrack",
|
|
59697
59552
|
value: function () {
|
|
59698
|
-
var _uploadTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(trackFile, coverArtFile, metadata, onProgress
|
|
59553
|
+
var _uploadTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(trackFile, coverArtFile, metadata, onProgress) {
|
|
59699
59554
|
var _this2 = this;
|
|
59700
59555
|
|
|
59701
|
-
var phases, phase, ownerId, _yield$retry, metadataMultihash, metadataFileUUID, transcodedTrackUUID, transcodedTrackCID,
|
|
59556
|
+
var phases, phase, ownerId, _yield$retry, metadataMultihash, metadataFileUUID, transcodedTrackUUID, transcodedTrackCID, trackId, response, txReceipt;
|
|
59702
59557
|
|
|
59703
59558
|
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
59704
59559
|
while (1) {
|
|
@@ -59775,42 +59630,23 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
59775
59630
|
transcodedTrackCID = _yield$retry.transcodedTrackCID;
|
|
59776
59631
|
phase = phases.ADDING_TRACK; // Write metadata to chain
|
|
59777
59632
|
|
|
59778
|
-
|
|
59779
|
-
_context19.next = 31;
|
|
59780
|
-
break;
|
|
59781
|
-
}
|
|
59782
|
-
|
|
59783
|
-
_context19.next = 24;
|
|
59633
|
+
_context19.next = 23;
|
|
59784
59634
|
return this._generateTrackId();
|
|
59785
59635
|
|
|
59786
|
-
case
|
|
59636
|
+
case 23:
|
|
59787
59637
|
trackId = _context19.sent;
|
|
59788
|
-
_context19.next =
|
|
59638
|
+
_context19.next = 26;
|
|
59789
59639
|
return this.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.CREATE, metadataMultihash);
|
|
59790
59640
|
|
|
59791
|
-
case
|
|
59641
|
+
case 26:
|
|
59792
59642
|
response = _context19.sent;
|
|
59793
59643
|
txReceipt = response.txReceipt;
|
|
59794
|
-
_context19.next = 37;
|
|
59795
|
-
break;
|
|
59796
|
-
|
|
59797
|
-
case 31:
|
|
59798
|
-
multihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
59799
|
-
_context19.next = 34;
|
|
59800
|
-
return this.contracts.TrackFactoryClient.addTrack(ownerId, multihashDecoded.digest, multihashDecoded.hashFn, multihashDecoded.size);
|
|
59801
|
-
|
|
59802
|
-
case 34:
|
|
59803
|
-
_response = _context19.sent;
|
|
59804
|
-
txReceipt = _response.txReceipt;
|
|
59805
|
-
trackId = _response.trackId;
|
|
59806
|
-
|
|
59807
|
-
case 37:
|
|
59808
59644
|
phase = phases.ASSOCIATING_TRACK; // Associate the track id with the file metadata and block number
|
|
59809
59645
|
|
|
59810
|
-
_context19.next =
|
|
59646
|
+
_context19.next = 31;
|
|
59811
59647
|
return this.creatorNode.associateTrack(trackId, metadataFileUUID, txReceipt.blockNumber, transcodedTrackUUID);
|
|
59812
59648
|
|
|
59813
|
-
case
|
|
59649
|
+
case 31:
|
|
59814
59650
|
return _context19.abrupt("return", {
|
|
59815
59651
|
blockHash: txReceipt.blockHash,
|
|
59816
59652
|
blockNumber: txReceipt.blockNumber,
|
|
@@ -59819,23 +59655,23 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
59819
59655
|
error: false
|
|
59820
59656
|
});
|
|
59821
59657
|
|
|
59822
|
-
case
|
|
59823
|
-
_context19.prev =
|
|
59658
|
+
case 34:
|
|
59659
|
+
_context19.prev = 34;
|
|
59824
59660
|
_context19.t0 = _context19["catch"](4);
|
|
59825
59661
|
return _context19.abrupt("return", {
|
|
59826
59662
|
error: _context19.t0.message,
|
|
59827
59663
|
phase: phase
|
|
59828
59664
|
});
|
|
59829
59665
|
|
|
59830
|
-
case
|
|
59666
|
+
case 37:
|
|
59831
59667
|
case "end":
|
|
59832
59668
|
return _context19.stop();
|
|
59833
59669
|
}
|
|
59834
59670
|
}
|
|
59835
|
-
}, _callee19, this, [[4,
|
|
59671
|
+
}, _callee19, this, [[4, 34]]);
|
|
59836
59672
|
}));
|
|
59837
59673
|
|
|
59838
|
-
function uploadTrack(_x13, _x14, _x15, _x16
|
|
59674
|
+
function uploadTrack(_x13, _x14, _x15, _x16) {
|
|
59839
59675
|
return _uploadTrack.apply(this, arguments);
|
|
59840
59676
|
}
|
|
59841
59677
|
|
|
@@ -59932,7 +59768,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
59932
59768
|
}, _callee21, this);
|
|
59933
59769
|
}));
|
|
59934
59770
|
|
|
59935
|
-
function uploadTrackContentToCreatorNode(_x18, _x19, _x20
|
|
59771
|
+
function uploadTrackContentToCreatorNode(_x17, _x18, _x19, _x20) {
|
|
59936
59772
|
return _uploadTrackContentToCreatorNode.apply(this, arguments);
|
|
59937
59773
|
}
|
|
59938
59774
|
|
|
@@ -59947,7 +59783,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
59947
59783
|
}, {
|
|
59948
59784
|
key: "addTracksToChainAndCnode",
|
|
59949
59785
|
value: function () {
|
|
59950
|
-
var _addTracksToChainAndCnode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(trackMultihashAndUUIDList
|
|
59786
|
+
var _addTracksToChainAndCnode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(trackMultihashAndUUIDList) {
|
|
59951
59787
|
var _this4 = this;
|
|
59952
59788
|
|
|
59953
59789
|
var ownerId, addedToChain, requestFailed, associatedWithCreatorNode;
|
|
@@ -59971,8 +59807,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
59971
59807
|
_context24.next = 8;
|
|
59972
59808
|
return Promise.all(trackMultihashAndUUIDList.map( /*#__PURE__*/function () {
|
|
59973
59809
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(trackInfo, i) {
|
|
59974
|
-
var metadataMultihash, metadataFileUUID, transcodedTrackUUID,
|
|
59975
|
-
|
|
59810
|
+
var metadataMultihash, metadataFileUUID, transcodedTrackUUID, trackId, response, txReceipt;
|
|
59976
59811
|
return regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
59977
59812
|
while (1) {
|
|
59978
59813
|
switch (_context22.prev = _context22.next) {
|
|
@@ -59980,60 +59815,41 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
59980
59815
|
_context22.prev = 0;
|
|
59981
59816
|
metadataMultihash = trackInfo.metadataMultihash, metadataFileUUID = trackInfo.metadataFileUUID, transcodedTrackUUID = trackInfo.transcodedTrackUUID; // Write metadata to chain
|
|
59982
59817
|
|
|
59983
|
-
|
|
59984
|
-
_context22.next = 12;
|
|
59985
|
-
break;
|
|
59986
|
-
}
|
|
59987
|
-
|
|
59988
|
-
_context22.next = 5;
|
|
59818
|
+
_context22.next = 4;
|
|
59989
59819
|
return _this4._generateTrackId();
|
|
59990
59820
|
|
|
59991
|
-
case
|
|
59821
|
+
case 4:
|
|
59992
59822
|
trackId = _context22.sent;
|
|
59993
|
-
_context22.next =
|
|
59823
|
+
_context22.next = 7;
|
|
59994
59824
|
return _this4.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.CREATE, metadataMultihash);
|
|
59995
59825
|
|
|
59996
|
-
case
|
|
59826
|
+
case 7:
|
|
59997
59827
|
response = _context22.sent;
|
|
59998
59828
|
txReceipt = response.txReceipt;
|
|
59999
|
-
_context22.next = 18;
|
|
60000
|
-
break;
|
|
60001
|
-
|
|
60002
|
-
case 12:
|
|
60003
|
-
multihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
60004
|
-
_context22.next = 15;
|
|
60005
|
-
return _this4.contracts.TrackFactoryClient.addTrack(ownerId, multihashDecoded.digest, multihashDecoded.hashFn, multihashDecoded.size);
|
|
60006
|
-
|
|
60007
|
-
case 15:
|
|
60008
|
-
_response2 = _context22.sent;
|
|
60009
|
-
txReceipt = _response2.txReceipt;
|
|
60010
|
-
trackId = _response2.trackId;
|
|
60011
|
-
|
|
60012
|
-
case 18:
|
|
60013
59829
|
addedToChain[i] = {
|
|
60014
59830
|
trackId: trackId,
|
|
60015
59831
|
metadataFileUUID: metadataFileUUID,
|
|
60016
59832
|
transcodedTrackUUID: transcodedTrackUUID,
|
|
60017
59833
|
txReceipt: txReceipt
|
|
60018
59834
|
};
|
|
60019
|
-
_context22.next =
|
|
59835
|
+
_context22.next = 16;
|
|
60020
59836
|
break;
|
|
60021
59837
|
|
|
60022
|
-
case
|
|
60023
|
-
_context22.prev =
|
|
59838
|
+
case 12:
|
|
59839
|
+
_context22.prev = 12;
|
|
60024
59840
|
_context22.t0 = _context22["catch"](0);
|
|
60025
59841
|
requestFailed = true;
|
|
60026
59842
|
console.error(_context22.t0);
|
|
60027
59843
|
|
|
60028
|
-
case
|
|
59844
|
+
case 16:
|
|
60029
59845
|
case "end":
|
|
60030
59846
|
return _context22.stop();
|
|
60031
59847
|
}
|
|
60032
59848
|
}
|
|
60033
|
-
}, _callee22, null, [[0,
|
|
59849
|
+
}, _callee22, null, [[0, 12]]);
|
|
60034
59850
|
}));
|
|
60035
59851
|
|
|
60036
|
-
return function (
|
|
59852
|
+
return function (_x22, _x23) {
|
|
60037
59853
|
return _ref3.apply(this, arguments);
|
|
60038
59854
|
};
|
|
60039
59855
|
}()));
|
|
@@ -60079,7 +59895,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60079
59895
|
}, _callee23);
|
|
60080
59896
|
}));
|
|
60081
59897
|
|
|
60082
|
-
return function (
|
|
59898
|
+
return function (_x24) {
|
|
60083
59899
|
return _ref4.apply(this, arguments);
|
|
60084
59900
|
};
|
|
60085
59901
|
}()));
|
|
@@ -60114,7 +59930,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60114
59930
|
}, _callee24, this, [[11, 16]]);
|
|
60115
59931
|
}));
|
|
60116
59932
|
|
|
60117
|
-
function addTracksToChainAndCnode(
|
|
59933
|
+
function addTracksToChainAndCnode(_x21) {
|
|
60118
59934
|
return _addTracksToChainAndCnode.apply(this, arguments);
|
|
60119
59935
|
}
|
|
60120
59936
|
|
|
@@ -60129,8 +59945,8 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60129
59945
|
}, {
|
|
60130
59946
|
key: "updateTrack",
|
|
60131
59947
|
value: function () {
|
|
60132
|
-
var _updateTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(metadata
|
|
60133
|
-
var ownerId, _yield$this$creatorNo, metadataMultihash, metadataFileUUID,
|
|
59948
|
+
var _updateTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(metadata) {
|
|
59949
|
+
var ownerId, _yield$this$creatorNo, metadataMultihash, metadataFileUUID, trackId, response, txReceipt;
|
|
60134
59950
|
|
|
60135
59951
|
return regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
60136
59952
|
while (1) {
|
|
@@ -60160,43 +59976,26 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60160
59976
|
_yield$this$creatorNo = _context25.sent;
|
|
60161
59977
|
metadataMultihash = _yield$this$creatorNo.metadataMultihash;
|
|
60162
59978
|
metadataFileUUID = _yield$this$creatorNo.metadataFileUUID;
|
|
59979
|
+
// Write the new metadata to chain
|
|
60163
59980
|
trackId = metadata.track_id;
|
|
60164
|
-
|
|
60165
|
-
if (!useEntityManager) {
|
|
60166
|
-
_context25.next = 20;
|
|
60167
|
-
break;
|
|
60168
|
-
}
|
|
60169
|
-
|
|
60170
|
-
_context25.next = 16;
|
|
59981
|
+
_context25.next = 15;
|
|
60171
59982
|
return this.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.UPDATE, metadataMultihash);
|
|
60172
59983
|
|
|
60173
|
-
case
|
|
59984
|
+
case 15:
|
|
60174
59985
|
response = _context25.sent;
|
|
60175
|
-
txReceipt = response.txReceipt;
|
|
60176
|
-
_context25.next = 25;
|
|
60177
|
-
break;
|
|
60178
|
-
|
|
60179
|
-
case 20:
|
|
60180
|
-
multihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
60181
|
-
_context25.next = 23;
|
|
60182
|
-
return this.contracts.TrackFactoryClient.updateTrack(trackId, ownerId, multihashDecoded.digest, multihashDecoded.hashFn, multihashDecoded.size);
|
|
59986
|
+
txReceipt = response.txReceipt; // Re-associate the track id with the new metadata
|
|
60183
59987
|
|
|
60184
|
-
|
|
60185
|
-
_response3 = _context25.sent;
|
|
60186
|
-
txReceipt = _response3.txReceipt;
|
|
60187
|
-
|
|
60188
|
-
case 25:
|
|
60189
|
-
_context25.next = 27;
|
|
59988
|
+
_context25.next = 19;
|
|
60190
59989
|
return this.creatorNode.associateTrack(trackId, metadataFileUUID, txReceipt.blockNumber);
|
|
60191
59990
|
|
|
60192
|
-
case
|
|
59991
|
+
case 19:
|
|
60193
59992
|
return _context25.abrupt("return", {
|
|
60194
59993
|
blockHash: txReceipt.blockHash,
|
|
60195
59994
|
blockNumber: txReceipt.blockNumber,
|
|
60196
59995
|
trackId: trackId
|
|
60197
59996
|
});
|
|
60198
59997
|
|
|
60199
|
-
case
|
|
59998
|
+
case 20:
|
|
60200
59999
|
case "end":
|
|
60201
60000
|
return _context25.stop();
|
|
60202
60001
|
}
|
|
@@ -60204,7 +60003,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60204
60003
|
}, _callee25, this);
|
|
60205
60004
|
}));
|
|
60206
60005
|
|
|
60207
|
-
function updateTrack(
|
|
60006
|
+
function updateTrack(_x25) {
|
|
60208
60007
|
return _updateTrack.apply(this, arguments);
|
|
60209
60008
|
}
|
|
60210
60009
|
|
|
@@ -60246,7 +60045,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60246
60045
|
}, _callee26, this);
|
|
60247
60046
|
}));
|
|
60248
60047
|
|
|
60249
|
-
function logTrackListen(
|
|
60048
|
+
function logTrackListen(_x26, _x27) {
|
|
60250
60049
|
return _logTrackListen.apply(this, arguments);
|
|
60251
60050
|
}
|
|
60252
60051
|
|
|
@@ -60280,7 +60079,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60280
60079
|
}, _callee27, this);
|
|
60281
60080
|
}));
|
|
60282
60081
|
|
|
60283
|
-
function addTrackRepost(
|
|
60082
|
+
function addTrackRepost(_x28) {
|
|
60284
60083
|
return _addTrackRepost.apply(this, arguments);
|
|
60285
60084
|
}
|
|
60286
60085
|
|
|
@@ -60315,7 +60114,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60315
60114
|
}, _callee28, this);
|
|
60316
60115
|
}));
|
|
60317
60116
|
|
|
60318
|
-
function deleteTrackRepost(
|
|
60117
|
+
function deleteTrackRepost(_x29) {
|
|
60319
60118
|
return _deleteTrackRepost.apply(this, arguments);
|
|
60320
60119
|
}
|
|
60321
60120
|
|
|
@@ -60350,7 +60149,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60350
60149
|
}, _callee29, this);
|
|
60351
60150
|
}));
|
|
60352
60151
|
|
|
60353
|
-
function addTrackSave(
|
|
60152
|
+
function addTrackSave(_x30) {
|
|
60354
60153
|
return _addTrackSave.apply(this, arguments);
|
|
60355
60154
|
}
|
|
60356
60155
|
|
|
@@ -60385,7 +60184,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60385
60184
|
}, _callee30, this);
|
|
60386
60185
|
}));
|
|
60387
60186
|
|
|
60388
|
-
function deleteTrackSave(
|
|
60187
|
+
function deleteTrackSave(_x31) {
|
|
60389
60188
|
return _deleteTrackSave.apply(this, arguments);
|
|
60390
60189
|
}
|
|
60391
60190
|
|
|
@@ -60399,41 +60198,29 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60399
60198
|
}, {
|
|
60400
60199
|
key: "deleteTrack",
|
|
60401
60200
|
value: function () {
|
|
60402
|
-
var _deleteTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(trackId
|
|
60201
|
+
var _deleteTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(trackId) {
|
|
60403
60202
|
var ownerId;
|
|
60404
60203
|
return regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
60405
60204
|
while (1) {
|
|
60406
60205
|
switch (_context31.prev = _context31.next) {
|
|
60407
60206
|
case 0:
|
|
60408
|
-
if (!useEntityManager) {
|
|
60409
|
-
_context31.next = 9;
|
|
60410
|
-
break;
|
|
60411
|
-
}
|
|
60412
|
-
|
|
60413
60207
|
ownerId = this.userStateManager.getCurrentUserId();
|
|
60414
60208
|
|
|
60415
60209
|
if (ownerId) {
|
|
60416
|
-
_context31.next =
|
|
60210
|
+
_context31.next = 3;
|
|
60417
60211
|
break;
|
|
60418
60212
|
}
|
|
60419
60213
|
|
|
60420
60214
|
throw new Error('No users loaded for this wallet');
|
|
60421
60215
|
|
|
60422
|
-
case
|
|
60423
|
-
_context31.next =
|
|
60216
|
+
case 3:
|
|
60217
|
+
_context31.next = 5;
|
|
60424
60218
|
return this.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.DELETE, '');
|
|
60425
60219
|
|
|
60426
|
-
case
|
|
60427
|
-
return _context31.abrupt("return", _context31.sent);
|
|
60428
|
-
|
|
60429
|
-
case 9:
|
|
60430
|
-
_context31.next = 11;
|
|
60431
|
-
return this.contracts.TrackFactoryClient.deleteTrack(trackId);
|
|
60432
|
-
|
|
60433
|
-
case 11:
|
|
60220
|
+
case 5:
|
|
60434
60221
|
return _context31.abrupt("return", _context31.sent);
|
|
60435
60222
|
|
|
60436
|
-
case
|
|
60223
|
+
case 6:
|
|
60437
60224
|
case "end":
|
|
60438
60225
|
return _context31.stop();
|
|
60439
60226
|
}
|
|
@@ -60441,7 +60228,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60441
60228
|
}, _callee31, this);
|
|
60442
60229
|
}));
|
|
60443
60230
|
|
|
60444
|
-
function deleteTrack(
|
|
60231
|
+
function deleteTrack(_x32) {
|
|
60445
60232
|
return _deleteTrack.apply(this, arguments);
|
|
60446
60233
|
}
|
|
60447
60234
|
|
|
@@ -66072,9 +65859,7 @@ var rolloverNodes = /*#__PURE__*/function () {
|
|
|
66072
65859
|
newMetadata.creator_node_endpoint = newEndpoints.join(',');
|
|
66073
65860
|
console.debug("Sanity Check - rolloverNodes - new nodes ".concat(newMetadata.creator_node_endpoint));
|
|
66074
65861
|
_context4.next = 32;
|
|
66075
|
-
return (_libs$User3 = libs.User) === null || _libs$User3 === void 0 ? void 0 : _libs$User3.updateCreator(user.user_id, newMetadata
|
|
66076
|
-
/* useEntityManager */
|
|
66077
|
-
);
|
|
65862
|
+
return (_libs$User3 = libs.User) === null || _libs$User3 === void 0 ? void 0 : _libs$User3.updateCreator(user.user_id, newMetadata);
|
|
66078
65863
|
|
|
66079
65864
|
case 32:
|
|
66080
65865
|
_context4.next = 37;
|