@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/legacy.js
CHANGED
|
@@ -36981,9 +36981,9 @@ exports.ChatPermission = void 0;
|
|
|
36981
36981
|
})(exports.ChatPermission || (exports.ChatPermission = {}));
|
|
36982
36982
|
|
|
36983
36983
|
var name = "@audius/sdk";
|
|
36984
|
-
var version = "1.0.
|
|
36984
|
+
var version = "1.0.37";
|
|
36985
36985
|
var audius = {
|
|
36986
|
-
releaseSHA: "
|
|
36986
|
+
releaseSHA: "dd0ddae94286c577c8a34ada50f2f79f613b55d2"
|
|
36987
36987
|
};
|
|
36988
36988
|
var description = "";
|
|
36989
36989
|
var main = "dist/index.cjs.js";
|
|
@@ -55001,14 +55001,12 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
55001
55001
|
userBankOutcomes,
|
|
55002
55002
|
feePayerOverride,
|
|
55003
55003
|
generateRecoveryLink,
|
|
55004
|
-
useEntityManager,
|
|
55005
55004
|
phases,
|
|
55006
55005
|
phase,
|
|
55007
55006
|
userId,
|
|
55008
55007
|
blockHash,
|
|
55009
55008
|
blockNumber,
|
|
55010
55009
|
ownerWallet,
|
|
55011
|
-
response,
|
|
55012
55010
|
newMetadata,
|
|
55013
55011
|
_args4 = arguments;
|
|
55014
55012
|
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
@@ -55023,7 +55021,6 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
55023
55021
|
userBankOutcomes = _args4.length > 8 && _args4[8] !== undefined ? _args4[8] : {};
|
|
55024
55022
|
feePayerOverride = _args4.length > 9 && _args4[9] !== undefined ? _args4[9] : null;
|
|
55025
55023
|
generateRecoveryLink = _args4.length > 10 && _args4[10] !== undefined ? _args4[10] : true;
|
|
55026
|
-
useEntityManager = _args4.length > 11 && _args4[11] !== undefined ? _args4[11] : false;
|
|
55027
55024
|
phases = {
|
|
55028
55025
|
ADD_REPLICA_SET: 'ADD_REPLICA_SET',
|
|
55029
55026
|
CREATE_USER_RECORD: 'CREATE_USER_RECORD',
|
|
@@ -55033,50 +55030,50 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
55033
55030
|
ADD_USER: 'ADD_USER'
|
|
55034
55031
|
};
|
|
55035
55032
|
phase = '';
|
|
55036
|
-
_context4.prev =
|
|
55033
|
+
_context4.prev = 10;
|
|
55037
55034
|
this.REQUIRES(Services.CREATOR_NODE, Services.IDENTITY_SERVICE);
|
|
55038
55035
|
|
|
55039
55036
|
if (!this.web3Manager.web3IsExternal()) {
|
|
55040
|
-
_context4.next =
|
|
55037
|
+
_context4.next = 18;
|
|
55041
55038
|
break;
|
|
55042
55039
|
}
|
|
55043
55040
|
|
|
55044
55041
|
phase = phases.CREATE_USER_RECORD;
|
|
55045
|
-
_context4.next =
|
|
55042
|
+
_context4.next = 16;
|
|
55046
55043
|
return this.identityService.createUserRecord(email, this.web3Manager.getWalletAddress());
|
|
55047
55044
|
|
|
55048
|
-
case
|
|
55049
|
-
_context4.next =
|
|
55045
|
+
case 16:
|
|
55046
|
+
_context4.next = 28;
|
|
55050
55047
|
break;
|
|
55051
55048
|
|
|
55052
|
-
case
|
|
55049
|
+
case 18:
|
|
55053
55050
|
this.REQUIRES(Services.HEDGEHOG); // If an owner wallet already exists, don't try to recreate it
|
|
55054
55051
|
|
|
55055
55052
|
if (hasWallet) {
|
|
55056
|
-
_context4.next =
|
|
55053
|
+
_context4.next = 28;
|
|
55057
55054
|
break;
|
|
55058
55055
|
}
|
|
55059
55056
|
|
|
55060
55057
|
phase = phases.HEDGEHOG_SIGNUP;
|
|
55061
|
-
_context4.next =
|
|
55058
|
+
_context4.next = 23;
|
|
55062
55059
|
return this.hedgehog.signUp(email, password);
|
|
55063
55060
|
|
|
55064
|
-
case
|
|
55061
|
+
case 23:
|
|
55065
55062
|
ownerWallet = _context4.sent;
|
|
55066
55063
|
this.web3Manager.setOwnerWallet(ownerWallet);
|
|
55067
55064
|
|
|
55068
55065
|
if (!generateRecoveryLink) {
|
|
55069
|
-
_context4.next =
|
|
55066
|
+
_context4.next = 28;
|
|
55070
55067
|
break;
|
|
55071
55068
|
}
|
|
55072
55069
|
|
|
55073
|
-
_context4.next =
|
|
55070
|
+
_context4.next = 28;
|
|
55074
55071
|
return this.generateRecoveryLink({
|
|
55075
55072
|
handle: metadata.handle,
|
|
55076
55073
|
host: host
|
|
55077
55074
|
});
|
|
55078
55075
|
|
|
55079
|
-
case
|
|
55076
|
+
case 28:
|
|
55080
55077
|
// Create a wAudio user bank address.
|
|
55081
55078
|
// If userbank creation fails, we still proceed
|
|
55082
55079
|
// through signup
|
|
@@ -55132,75 +55129,42 @@ var Account = /*#__PURE__*/function (_Base) {
|
|
|
55132
55129
|
} // Add user to chain
|
|
55133
55130
|
|
|
55134
55131
|
|
|
55135
|
-
|
|
55136
|
-
_context4.next = 47;
|
|
55137
|
-
break;
|
|
55138
|
-
}
|
|
55139
|
-
|
|
55140
|
-
phase = phases.ADD_USER;
|
|
55141
|
-
_context4.next = 34;
|
|
55142
|
-
return this.User.addUser(metadata);
|
|
55143
|
-
|
|
55144
|
-
case 34:
|
|
55145
|
-
response = _context4.sent;
|
|
55146
|
-
userId = response.userId;
|
|
55147
|
-
blockHash = response.blockHash;
|
|
55148
|
-
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)
|
|
55149
|
-
|
|
55150
|
-
phase = phases.ADD_REPLICA_SET;
|
|
55151
|
-
_context4.next = 41;
|
|
55152
|
-
return this.User.assignReplicaSet({
|
|
55153
|
-
userId: userId
|
|
55154
|
-
});
|
|
55155
|
-
|
|
55156
|
-
case 41:
|
|
55157
|
-
metadata = _context4.sent;
|
|
55158
|
-
// Upload profile pic and cover photo to primary Content Node and sync across secondaries
|
|
55159
|
-
phase = phases.UPLOAD_PROFILE_IMAGES;
|
|
55160
|
-
_context4.next = 45;
|
|
55161
|
-
return this.User.uploadProfileImages(profilePictureFile, coverPhotoFile, metadata, useEntityManager);
|
|
55162
|
-
|
|
55163
|
-
case 45:
|
|
55164
|
-
_context4.next = 52;
|
|
55165
|
-
break;
|
|
55166
|
-
|
|
55167
|
-
case 47:
|
|
55168
|
-
_context4.next = 49;
|
|
55132
|
+
_context4.next = 31;
|
|
55169
55133
|
return this.User.createEntityManagerUser({
|
|
55170
55134
|
metadata: metadata
|
|
55171
55135
|
});
|
|
55172
55136
|
|
|
55173
|
-
case
|
|
55137
|
+
case 31:
|
|
55174
55138
|
newMetadata = _context4.sent;
|
|
55175
|
-
_context4.next =
|
|
55176
|
-
return this.User.uploadProfileImages(profilePictureFile, coverPhotoFile, newMetadata
|
|
55139
|
+
_context4.next = 34;
|
|
55140
|
+
return this.User.uploadProfileImages(profilePictureFile, coverPhotoFile, newMetadata);
|
|
55177
55141
|
|
|
55178
|
-
case
|
|
55179
|
-
_context4.next =
|
|
55142
|
+
case 34:
|
|
55143
|
+
_context4.next = 39;
|
|
55180
55144
|
break;
|
|
55181
55145
|
|
|
55182
|
-
case
|
|
55183
|
-
_context4.prev =
|
|
55184
|
-
_context4.t0 = _context4["catch"](
|
|
55146
|
+
case 36:
|
|
55147
|
+
_context4.prev = 36;
|
|
55148
|
+
_context4.t0 = _context4["catch"](10);
|
|
55185
55149
|
return _context4.abrupt("return", {
|
|
55186
55150
|
error: _context4.t0.message,
|
|
55187
55151
|
phase: phase,
|
|
55188
55152
|
errorStatus: _context4.t0.response ? _context4.t0.response.status : null
|
|
55189
55153
|
});
|
|
55190
55154
|
|
|
55191
|
-
case
|
|
55155
|
+
case 39:
|
|
55192
55156
|
return _context4.abrupt("return", {
|
|
55193
55157
|
blockHash: blockHash,
|
|
55194
55158
|
blockNumber: blockNumber,
|
|
55195
55159
|
userId: userId
|
|
55196
55160
|
});
|
|
55197
55161
|
|
|
55198
|
-
case
|
|
55162
|
+
case 40:
|
|
55199
55163
|
case "end":
|
|
55200
55164
|
return _context4.stop();
|
|
55201
55165
|
}
|
|
55202
55166
|
}
|
|
55203
|
-
}, _callee4, this, [[
|
|
55167
|
+
}, _callee4, this, [[10, 36]]);
|
|
55204
55168
|
}));
|
|
55205
55169
|
|
|
55206
55170
|
function signUp(_x3, _x4, _x5) {
|
|
@@ -57286,7 +57250,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57286
57250
|
}, {
|
|
57287
57251
|
key: "uploadProfileImages",
|
|
57288
57252
|
value: function () {
|
|
57289
|
-
var _uploadProfileImages = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(profilePictureFile, coverPhotoFile, metadata
|
|
57253
|
+
var _uploadProfileImages = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(profilePictureFile, coverPhotoFile, metadata) {
|
|
57290
57254
|
var didMetadataUpdate, resp, _resp;
|
|
57291
57255
|
|
|
57292
57256
|
return regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
@@ -57331,8 +57295,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57331
57295
|
_context13.next = 16;
|
|
57332
57296
|
return this.updateAndUploadMetadata({
|
|
57333
57297
|
newMetadata: metadata,
|
|
57334
|
-
userId: metadata.user_id
|
|
57335
|
-
useEntityManager: useEntityManager
|
|
57298
|
+
userId: metadata.user_id
|
|
57336
57299
|
});
|
|
57337
57300
|
|
|
57338
57301
|
case 16:
|
|
@@ -57346,7 +57309,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57346
57309
|
}, _callee13, this);
|
|
57347
57310
|
}));
|
|
57348
57311
|
|
|
57349
|
-
function uploadProfileImages(_x10, _x11, _x12
|
|
57312
|
+
function uploadProfileImages(_x10, _x11, _x12) {
|
|
57350
57313
|
return _uploadProfileImages.apply(this, arguments);
|
|
57351
57314
|
}
|
|
57352
57315
|
|
|
@@ -57427,7 +57390,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57427
57390
|
}, _callee14);
|
|
57428
57391
|
}));
|
|
57429
57392
|
|
|
57430
|
-
return function (
|
|
57393
|
+
return function (_x14) {
|
|
57431
57394
|
return _ref3.apply(this, arguments);
|
|
57432
57395
|
};
|
|
57433
57396
|
}()));
|
|
@@ -57476,8 +57439,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57476
57439
|
_context15.next = 42;
|
|
57477
57440
|
return this.updateAndUploadMetadata({
|
|
57478
57441
|
newMetadata: newMetadata,
|
|
57479
|
-
userId: userId
|
|
57480
|
-
useEntityManager: true
|
|
57442
|
+
userId: userId
|
|
57481
57443
|
});
|
|
57482
57444
|
|
|
57483
57445
|
case 42:
|
|
@@ -57509,7 +57471,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57509
57471
|
}, _callee15, this, [[7, 47]]);
|
|
57510
57472
|
}));
|
|
57511
57473
|
|
|
57512
|
-
function createEntityManagerUser(
|
|
57474
|
+
function createEntityManagerUser(_x13) {
|
|
57513
57475
|
return _createEntityManagerUser.apply(this, arguments);
|
|
57514
57476
|
}
|
|
57515
57477
|
|
|
@@ -57585,7 +57547,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57585
57547
|
}, _callee16, this);
|
|
57586
57548
|
}));
|
|
57587
57549
|
|
|
57588
|
-
function addUser(
|
|
57550
|
+
function addUser(_x15) {
|
|
57589
57551
|
return _addUser.apply(this, arguments);
|
|
57590
57552
|
}
|
|
57591
57553
|
|
|
@@ -57620,7 +57582,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57620
57582
|
}, _callee17, this);
|
|
57621
57583
|
}));
|
|
57622
57584
|
|
|
57623
|
-
function updateEntityManagerReplicaSet(
|
|
57585
|
+
function updateEntityManagerReplicaSet(_x16) {
|
|
57624
57586
|
return _updateEntityManagerReplicaSet.apply(this, arguments);
|
|
57625
57587
|
}
|
|
57626
57588
|
|
|
@@ -57683,7 +57645,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57683
57645
|
}, _callee18, this);
|
|
57684
57646
|
}));
|
|
57685
57647
|
|
|
57686
|
-
function updateUser(
|
|
57648
|
+
function updateUser(_x17, _x18) {
|
|
57687
57649
|
return _updateUser.apply(this, arguments);
|
|
57688
57650
|
}
|
|
57689
57651
|
|
|
@@ -57696,8 +57658,8 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57696
57658
|
}, {
|
|
57697
57659
|
key: "updateCreator",
|
|
57698
57660
|
value: function () {
|
|
57699
|
-
var _updateCreator = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(userId, metadata
|
|
57700
|
-
var newMetadata, logPrefix, fnStartMs, startMs, user, oldMetadata, updateEndpointTxBlockNumber, _yield$this$creatorNo, metadataMultihash, metadataFileUUID,
|
|
57661
|
+
var _updateCreator = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(userId, metadata) {
|
|
57662
|
+
var newMetadata, logPrefix, fnStartMs, startMs, user, oldMetadata, updateEndpointTxBlockNumber, _yield$this$creatorNo, metadataMultihash, metadataFileUUID, response, txReceipt, latestBlockNumber, latestBlockHash;
|
|
57701
57663
|
|
|
57702
57664
|
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
57703
57665
|
while (1) {
|
|
@@ -57709,7 +57671,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57709
57671
|
|
|
57710
57672
|
this._validateUserMetadata(newMetadata);
|
|
57711
57673
|
|
|
57712
|
-
logPrefix = "[User:updateCreator()] [userId: ".concat(userId, "]
|
|
57674
|
+
logPrefix = "[User:updateCreator()] [userId: ".concat(userId, "]");
|
|
57713
57675
|
fnStartMs = Date.now();
|
|
57714
57676
|
startMs = fnStartMs; // Error if libs instance does not already have existing user state
|
|
57715
57677
|
|
|
@@ -57758,60 +57720,28 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57758
57720
|
_yield$this$creatorNo = _context19.sent;
|
|
57759
57721
|
metadataMultihash = _yield$this$creatorNo.metadataMultihash;
|
|
57760
57722
|
metadataFileUUID = _yield$this$creatorNo.metadataFileUUID;
|
|
57761
|
-
|
|
57762
|
-
if (useEntityManager) {
|
|
57763
|
-
_context19.next = 37;
|
|
57764
|
-
break;
|
|
57765
|
-
}
|
|
57766
|
-
|
|
57767
|
-
// Write metadata multihash to chain
|
|
57768
|
-
updatedMultihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
57769
|
-
_context19.next = 28;
|
|
57770
|
-
return this.contracts.UserFactoryClient.updateMultihash(userId, updatedMultihashDecoded.digest);
|
|
57771
|
-
|
|
57772
|
-
case 28:
|
|
57773
|
-
updateMultiHashResp = _context19.sent;
|
|
57774
|
-
txReceipt = updateMultiHashResp.txReceipt; // Write remaining metadata fields to chain
|
|
57775
|
-
|
|
57776
|
-
_context19.next = 32;
|
|
57777
|
-
return this._updateUserOperations(newMetadata, oldMetadata, userId);
|
|
57778
|
-
|
|
57779
|
-
case 32:
|
|
57780
|
-
updateUserResp = _context19.sent;
|
|
57781
|
-
latestBlockHash = updateUserResp.latestBlockHash;
|
|
57782
|
-
latestBlockNumber = Math.max(txReceipt.blockNumber, updateUserResp.latestBlockNumber);
|
|
57783
|
-
_context19.next = 42;
|
|
57784
|
-
break;
|
|
57785
|
-
|
|
57786
|
-
case 37:
|
|
57787
|
-
_context19.next = 39;
|
|
57723
|
+
_context19.next = 26;
|
|
57788
57724
|
return this.contracts.EntityManagerClient.manageEntity(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.UPDATE, metadataMultihash);
|
|
57789
57725
|
|
|
57790
|
-
case
|
|
57726
|
+
case 26:
|
|
57791
57727
|
response = _context19.sent;
|
|
57792
57728
|
txReceipt = response.txReceipt;
|
|
57793
57729
|
latestBlockNumber = txReceipt.blockNumber;
|
|
57730
|
+
latestBlockHash = txReceipt.blockHash; // Write to CN to associate blockchain user id with updated metadata and block number
|
|
57794
57731
|
|
|
57795
|
-
|
|
57796
|
-
_context19.next = 44;
|
|
57732
|
+
_context19.next = 32;
|
|
57797
57733
|
return this.creatorNode.associateCreator(userId, metadataFileUUID, latestBlockNumber);
|
|
57798
57734
|
|
|
57799
|
-
case
|
|
57735
|
+
case 32:
|
|
57800
57736
|
// Update libs instance with new user metadata object
|
|
57801
57737
|
this.userStateManager.setCurrentUser(_objectSpread2(_objectSpread2({}, oldMetadata), newMetadata));
|
|
57802
|
-
|
|
57803
|
-
if (!latestBlockHash || !latestBlockNumber) {
|
|
57804
|
-
latestBlockHash = txReceipt.blockHash;
|
|
57805
|
-
latestBlockNumber = txReceipt.blockNumber;
|
|
57806
|
-
}
|
|
57807
|
-
|
|
57808
57738
|
return _context19.abrupt("return", {
|
|
57809
57739
|
blockHash: latestBlockHash,
|
|
57810
57740
|
blockNumber: latestBlockNumber,
|
|
57811
57741
|
userId: userId
|
|
57812
57742
|
});
|
|
57813
57743
|
|
|
57814
|
-
case
|
|
57744
|
+
case 34:
|
|
57815
57745
|
case "end":
|
|
57816
57746
|
return _context19.stop();
|
|
57817
57747
|
}
|
|
@@ -57819,7 +57749,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57819
57749
|
}, _callee19, this);
|
|
57820
57750
|
}));
|
|
57821
57751
|
|
|
57822
|
-
function updateCreator(
|
|
57752
|
+
function updateCreator(_x19, _x20) {
|
|
57823
57753
|
return _updateCreator.apply(this, arguments);
|
|
57824
57754
|
}
|
|
57825
57755
|
|
|
@@ -57832,30 +57762,18 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57832
57762
|
}, {
|
|
57833
57763
|
key: "updateIsVerified",
|
|
57834
57764
|
value: function () {
|
|
57835
|
-
var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId,
|
|
57765
|
+
var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId, privateKey) {
|
|
57836
57766
|
return regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
57837
57767
|
while (1) {
|
|
57838
57768
|
switch (_context20.prev = _context20.next) {
|
|
57839
57769
|
case 0:
|
|
57840
|
-
|
|
57841
|
-
_context20.next = 6;
|
|
57842
|
-
break;
|
|
57843
|
-
}
|
|
57844
|
-
|
|
57845
|
-
_context20.next = 3;
|
|
57770
|
+
_context20.next = 2;
|
|
57846
57771
|
return this.contracts.EntityManagerClient.getManageEntityParams(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.VERIFY, '', privateKey);
|
|
57847
57772
|
|
|
57848
|
-
case
|
|
57849
|
-
return _context20.abrupt("return", _context20.sent);
|
|
57850
|
-
|
|
57851
|
-
case 6:
|
|
57852
|
-
_context20.next = 8;
|
|
57853
|
-
return this.contracts.UserFactoryClient.updateIsVerified(userId, isVerified, privateKey);
|
|
57854
|
-
|
|
57855
|
-
case 8:
|
|
57773
|
+
case 2:
|
|
57856
57774
|
return _context20.abrupt("return", _context20.sent);
|
|
57857
57775
|
|
|
57858
|
-
case
|
|
57776
|
+
case 3:
|
|
57859
57777
|
case "end":
|
|
57860
57778
|
return _context20.stop();
|
|
57861
57779
|
}
|
|
@@ -57863,7 +57781,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57863
57781
|
}, _callee20, this);
|
|
57864
57782
|
}));
|
|
57865
57783
|
|
|
57866
|
-
function updateIsVerified(
|
|
57784
|
+
function updateIsVerified(_x21, _x22) {
|
|
57867
57785
|
return _updateIsVerified.apply(this, arguments);
|
|
57868
57786
|
}
|
|
57869
57787
|
|
|
@@ -57897,7 +57815,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57897
57815
|
}, _callee21, this);
|
|
57898
57816
|
}));
|
|
57899
57817
|
|
|
57900
|
-
function addUserFollow(
|
|
57818
|
+
function addUserFollow(_x23) {
|
|
57901
57819
|
return _addUserFollow.apply(this, arguments);
|
|
57902
57820
|
}
|
|
57903
57821
|
|
|
@@ -57931,7 +57849,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57931
57849
|
}, _callee22, this);
|
|
57932
57850
|
}));
|
|
57933
57851
|
|
|
57934
|
-
function deleteUserFollow(
|
|
57852
|
+
function deleteUserFollow(_x24) {
|
|
57935
57853
|
return _deleteUserFollow.apply(this, arguments);
|
|
57936
57854
|
}
|
|
57937
57855
|
|
|
@@ -57977,7 +57895,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
57977
57895
|
}, _callee23, this, [[0, 8]]);
|
|
57978
57896
|
}));
|
|
57979
57897
|
|
|
57980
|
-
function addUserSubscribe(
|
|
57898
|
+
function addUserSubscribe(_x25) {
|
|
57981
57899
|
return _addUserSubscribe.apply(this, arguments);
|
|
57982
57900
|
}
|
|
57983
57901
|
|
|
@@ -58023,7 +57941,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58023
57941
|
}, _callee24, this, [[0, 8]]);
|
|
58024
57942
|
}));
|
|
58025
57943
|
|
|
58026
|
-
function deleteUserSubscribe(
|
|
57944
|
+
function deleteUserSubscribe(_x26) {
|
|
58027
57945
|
return _deleteUserSubscribe.apply(this, arguments);
|
|
58028
57946
|
}
|
|
58029
57947
|
|
|
@@ -58040,13 +57958,13 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58040
57958
|
key: "updateAndUploadMetadata",
|
|
58041
57959
|
value: function () {
|
|
58042
57960
|
var _updateAndUploadMetadata = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(_ref5) {
|
|
58043
|
-
var newMetadata, userId,
|
|
57961
|
+
var newMetadata, userId, phases, phase, oldMetadata, logPrefix, fnStartMs, startMs, _yield$this$_updateRe, _txReceipt, replicaSetSPIDs, _yield$this$creatorNo2, metadataMultihash, metadataFileUUID, response, txReceipt, blockNumber, errorMsg;
|
|
58044
57962
|
|
|
58045
57963
|
return regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
58046
57964
|
while (1) {
|
|
58047
57965
|
switch (_context25.prev = _context25.next) {
|
|
58048
57966
|
case 0:
|
|
58049
|
-
newMetadata = _ref5.newMetadata, userId = _ref5.userId
|
|
57967
|
+
newMetadata = _ref5.newMetadata, userId = _ref5.userId;
|
|
58050
57968
|
this.REQUIRES(Services.CREATOR_NODE, Services.DISCOVERY_PROVIDER);
|
|
58051
57969
|
this.IS_OBJECT(newMetadata);
|
|
58052
57970
|
phases = {
|
|
@@ -58077,7 +57995,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58077
57995
|
_context25.prev = 13;
|
|
58078
57996
|
|
|
58079
57997
|
if (!(newMetadata.creator_node_endpoint !== oldMetadata.creator_node_endpoint)) {
|
|
58080
|
-
_context25.next =
|
|
57998
|
+
_context25.next = 28;
|
|
58081
57999
|
break;
|
|
58082
58000
|
}
|
|
58083
58001
|
|
|
@@ -58090,39 +58008,23 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58090
58008
|
_txReceipt = _yield$this$_updateRe.txReceipt;
|
|
58091
58009
|
replicaSetSPIDs = _yield$this$_updateRe.replicaSetSPIDs;
|
|
58092
58010
|
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] _updateReplicaSetOnChain() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58093
|
-
|
|
58094
|
-
if (!useEntityManager) {
|
|
58095
|
-
_context25.next = 31;
|
|
58096
|
-
break;
|
|
58097
|
-
}
|
|
58098
|
-
|
|
58099
58011
|
startMs = Date.now();
|
|
58100
|
-
_context25.next =
|
|
58012
|
+
_context25.next = 25;
|
|
58101
58013
|
return this.waitForReplicaSetDiscoveryIndexing(userId, replicaSetSPIDs, _txReceipt.blockNumber);
|
|
58102
58014
|
|
|
58103
|
-
case
|
|
58015
|
+
case 25:
|
|
58104
58016
|
// @ts-expect-error
|
|
58105
58017
|
newMetadata.primary_id = replicaSetSPIDs[0];
|
|
58106
58018
|
newMetadata.secondary_ids = replicaSetSPIDs.slice(1);
|
|
58107
58019
|
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] waitForReplicaSetDiscoveryIndexing() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58108
|
-
_context25.next = 35;
|
|
58109
|
-
break;
|
|
58110
|
-
|
|
58111
|
-
case 31:
|
|
58112
|
-
startMs = Date.now();
|
|
58113
|
-
_context25.next = 34;
|
|
58114
|
-
return this._waitForURSMCreatorNodeEndpointIndexing(userId, replicaSetSPIDs);
|
|
58115
|
-
|
|
58116
|
-
case 34:
|
|
58117
|
-
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] _waitForURSMCreatorNodeEndpointIndexing() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58118
58020
|
|
|
58119
|
-
case
|
|
58021
|
+
case 28:
|
|
58120
58022
|
// Upload new metadata object to CN
|
|
58121
58023
|
phase = phases.UPLOAD_METADATA;
|
|
58122
|
-
_context25.next =
|
|
58024
|
+
_context25.next = 31;
|
|
58123
58025
|
return this.creatorNode.uploadCreatorContent(newMetadata);
|
|
58124
58026
|
|
|
58125
|
-
case
|
|
58027
|
+
case 31:
|
|
58126
58028
|
_yield$this$creatorNo2 = _context25.sent;
|
|
58127
58029
|
metadataMultihash = _yield$this$creatorNo2.metadataMultihash;
|
|
58128
58030
|
metadataFileUUID = _yield$this$creatorNo2.metadataFileUUID;
|
|
@@ -58130,85 +58032,54 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58130
58032
|
startMs = Date.now(); // Write metadata multihash to chain
|
|
58131
58033
|
|
|
58132
58034
|
phase = phases.UPDATE_METADATA_ON_CHAIN;
|
|
58133
|
-
|
|
58134
|
-
if (!useEntityManager) {
|
|
58135
|
-
_context25.next = 52;
|
|
58136
|
-
break;
|
|
58137
|
-
}
|
|
58138
|
-
|
|
58139
|
-
_context25.next = 47;
|
|
58035
|
+
_context25.next = 39;
|
|
58140
58036
|
return this.contracts.EntityManagerClient.manageEntity(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.UPDATE, metadataMultihash);
|
|
58141
58037
|
|
|
58142
|
-
case
|
|
58038
|
+
case 39:
|
|
58143
58039
|
response = _context25.sent;
|
|
58144
58040
|
txReceipt = response.txReceipt;
|
|
58145
58041
|
blockNumber = txReceipt.blockNumber;
|
|
58146
|
-
_context25.next = 66;
|
|
58147
|
-
break;
|
|
58148
|
-
|
|
58149
|
-
case 52:
|
|
58150
|
-
updatedMultihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
58151
|
-
_context25.next = 55;
|
|
58152
|
-
return this.contracts.UserFactoryClient.updateMultihash(userId, updatedMultihashDecoded.digest);
|
|
58153
|
-
|
|
58154
|
-
case 55:
|
|
58155
|
-
res = _context25.sent;
|
|
58156
|
-
txReceipt = res.txReceipt;
|
|
58157
|
-
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] UserFactoryClient.updateMultihash() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58158
|
-
startMs = Date.now(); // Write remaining metadata fields to chain
|
|
58159
|
-
|
|
58160
|
-
phase = phases.UPDATE_USER_ON_CHAIN_OPS;
|
|
58161
|
-
_context25.next = 62;
|
|
58162
|
-
return this._updateUserOperations(newMetadata, oldMetadata, userId, ['creator_node_endpoint']);
|
|
58163
|
-
|
|
58164
|
-
case 62:
|
|
58165
|
-
_yield$this$_updateUs2 = _context25.sent;
|
|
58166
|
-
latestBlockNumber = _yield$this$_updateUs2.latestBlockNumber;
|
|
58167
|
-
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] _updateUserOperations() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58168
|
-
blockNumber = Math.max(txReceipt.blockNumber, latestBlockNumber);
|
|
58169
|
-
|
|
58170
|
-
case 66:
|
|
58171
58042
|
startMs = Date.now(); // Write to CN to associate blockchain user id with updated metadata and block number
|
|
58172
58043
|
|
|
58173
58044
|
phase = phases.ASSOCIATE_USER;
|
|
58174
|
-
_context25.next =
|
|
58045
|
+
_context25.next = 46;
|
|
58175
58046
|
return this.creatorNode.associateCreator(userId, metadataFileUUID, blockNumber);
|
|
58176
58047
|
|
|
58177
|
-
case
|
|
58048
|
+
case 46:
|
|
58178
58049
|
console.log("".concat(logPrefix, " [phase: ").concat(phase, "] creatorNode.associateCreator() completed in ").concat(Date.now() - startMs, "ms"));
|
|
58179
58050
|
startMs = Date.now(); // Update libs instance with new user metadata object
|
|
58180
58051
|
|
|
58181
58052
|
this.userStateManager.setCurrentUser(_objectSpread2(_objectSpread2({}, oldMetadata), newMetadata));
|
|
58182
58053
|
console.log("".concat(logPrefix, " completed in ").concat(Date.now() - fnStartMs, "ms"));
|
|
58183
|
-
_context25.next =
|
|
58054
|
+
_context25.next = 59;
|
|
58184
58055
|
break;
|
|
58185
58056
|
|
|
58186
|
-
case
|
|
58187
|
-
_context25.prev =
|
|
58057
|
+
case 52:
|
|
58058
|
+
_context25.prev = 52;
|
|
58188
58059
|
_context25.t0 = _context25["catch"](13);
|
|
58189
58060
|
// TODO: think about handling the update metadata on chain and associating..
|
|
58190
58061
|
errorMsg = "updateAndUploadMetadata() Error -- Phase ".concat(phase, " in ").concat(Date.now() - fnStartMs, "ms: ").concat(_context25.t0);
|
|
58191
58062
|
|
|
58192
58063
|
if (!(_context25.t0 instanceof Error)) {
|
|
58193
|
-
_context25.next =
|
|
58064
|
+
_context25.next = 58;
|
|
58194
58065
|
break;
|
|
58195
58066
|
}
|
|
58196
58067
|
|
|
58197
58068
|
_context25.t0.message = errorMsg;
|
|
58198
58069
|
throw _context25.t0;
|
|
58199
58070
|
|
|
58200
|
-
case
|
|
58071
|
+
case 58:
|
|
58201
58072
|
throw new Error(errorMsg);
|
|
58202
58073
|
|
|
58203
|
-
case
|
|
58074
|
+
case 59:
|
|
58204
58075
|
case "end":
|
|
58205
58076
|
return _context25.stop();
|
|
58206
58077
|
}
|
|
58207
58078
|
}
|
|
58208
|
-
}, _callee25, this, [[13,
|
|
58079
|
+
}, _callee25, this, [[13, 52]]);
|
|
58209
58080
|
}));
|
|
58210
58081
|
|
|
58211
|
-
function updateAndUploadMetadata(
|
|
58082
|
+
function updateAndUploadMetadata(_x27) {
|
|
58212
58083
|
return _updateAndUploadMetadata.apply(this, arguments);
|
|
58213
58084
|
}
|
|
58214
58085
|
|
|
@@ -58327,7 +58198,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58327
58198
|
}, _callee27, this);
|
|
58328
58199
|
}));
|
|
58329
58200
|
|
|
58330
|
-
function _waitForCreatorNodeEndpointIndexing(
|
|
58201
|
+
function _waitForCreatorNodeEndpointIndexing(_x28, _x29) {
|
|
58331
58202
|
return _waitForCreatorNodeEndpointIndexing2.apply(this, arguments);
|
|
58332
58203
|
}
|
|
58333
58204
|
|
|
@@ -58430,7 +58301,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58430
58301
|
}, _callee29);
|
|
58431
58302
|
}));
|
|
58432
58303
|
|
|
58433
|
-
function waitForReplicaSetDiscoveryIndexing(
|
|
58304
|
+
function waitForReplicaSetDiscoveryIndexing(_x30, _x31, _x32) {
|
|
58434
58305
|
return _waitForReplicaSetDiscoveryIndexing.apply(this, arguments);
|
|
58435
58306
|
}
|
|
58436
58307
|
|
|
@@ -58505,7 +58376,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58505
58376
|
}, _callee31);
|
|
58506
58377
|
}));
|
|
58507
58378
|
|
|
58508
|
-
function _waitForURSMCreatorNodeEndpointIndexing(
|
|
58379
|
+
function _waitForURSMCreatorNodeEndpointIndexing(_x33, _x34) {
|
|
58509
58380
|
return _waitForURSMCreatorNodeEndpointIndexing2.apply(this, arguments);
|
|
58510
58381
|
}
|
|
58511
58382
|
|
|
@@ -58591,7 +58462,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58591
58462
|
}, _callee32, this);
|
|
58592
58463
|
}));
|
|
58593
58464
|
|
|
58594
|
-
function _addUserOperations(
|
|
58465
|
+
function _addUserOperations(_x35, _x36) {
|
|
58595
58466
|
return _addUserOperations2.apply(this, arguments);
|
|
58596
58467
|
}
|
|
58597
58468
|
|
|
@@ -58686,7 +58557,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58686
58557
|
}, _callee33, this);
|
|
58687
58558
|
}));
|
|
58688
58559
|
|
|
58689
|
-
function _updateUserOperations(
|
|
58560
|
+
function _updateUserOperations(_x37, _x38, _x39) {
|
|
58690
58561
|
return _updateUserOperations2.apply(this, arguments);
|
|
58691
58562
|
}
|
|
58692
58563
|
|
|
@@ -58721,7 +58592,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58721
58592
|
key: "_updateReplicaSetOnChain",
|
|
58722
58593
|
value: function () {
|
|
58723
58594
|
var _updateReplicaSetOnChain2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34(userId, creatorNodeEndpoint) {
|
|
58724
|
-
var primaryEndpoint, secondaries, _yield$Promise$all, _yield$Promise$all2, primarySpID, secondary1SpID, secondary2SpID,
|
|
58595
|
+
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;
|
|
58725
58596
|
|
|
58726
58597
|
return regeneratorRuntime.wrap(function _callee34$(_context34) {
|
|
58727
58598
|
while (1) {
|
|
@@ -58766,45 +58637,29 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58766
58637
|
throw new Error('Current user missing');
|
|
58767
58638
|
|
|
58768
58639
|
case 17:
|
|
58769
|
-
|
|
58770
|
-
|
|
58771
|
-
return (_this$contracts$UserR = this.contracts.UserReplicaSetManagerClient) === null || _this$contracts$UserR === void 0 ? void 0 : _this$contracts$UserR.updateReplicaSet(userId, primarySpID, [secondary1SpID, secondary2SpID]);
|
|
58772
|
-
|
|
58773
|
-
case 20:
|
|
58774
|
-
txReceipt = _context34.sent;
|
|
58775
|
-
replicaSetSPIDs = [primarySpID, secondary1SpID, secondary2SpID];
|
|
58776
|
-
updateEndpointTxBlockNumber = (_txReceipt2 = txReceipt) === null || _txReceipt2 === void 0 ? void 0 : _txReceipt2.blockNumber;
|
|
58777
|
-
_context34.next = 25;
|
|
58778
|
-
return this._waitForURSMCreatorNodeEndpointIndexing(userId, replicaSetSPIDs);
|
|
58779
|
-
|
|
58780
|
-
case 25:
|
|
58781
|
-
_context34.next = 47;
|
|
58782
|
-
break;
|
|
58783
|
-
|
|
58784
|
-
case 27:
|
|
58785
|
-
_context34.prev = 27;
|
|
58786
|
-
_context34.t0 = _context34["catch"](17);
|
|
58640
|
+
// First try to update with URSM
|
|
58641
|
+
// Fallback to EntityManager when relay errors
|
|
58787
58642
|
currentPrimaryEndpoint = CreatorNode.getPrimary(currentUser.creator_node_endpoint);
|
|
58788
58643
|
currentSecondaries = CreatorNode.getSecondaries(currentUser.creator_node_endpoint);
|
|
58789
58644
|
|
|
58790
58645
|
if (!(currentSecondaries.length < 2)) {
|
|
58791
|
-
_context34.next =
|
|
58646
|
+
_context34.next = 21;
|
|
58792
58647
|
break;
|
|
58793
58648
|
}
|
|
58794
58649
|
|
|
58795
58650
|
throw new Error("Invalid number of secondaries found - received ".concat(currentSecondaries));
|
|
58796
58651
|
|
|
58797
|
-
case
|
|
58798
|
-
_context34.next =
|
|
58652
|
+
case 21:
|
|
58653
|
+
_context34.next = 23;
|
|
58799
58654
|
return Promise.all([this._retrieveSpIDFromEndpoint(currentPrimaryEndpoint), this._retrieveSpIDFromEndpoint(currentSecondaries[0]), this._retrieveSpIDFromEndpoint(currentSecondaries[1])]);
|
|
58800
58655
|
|
|
58801
|
-
case
|
|
58656
|
+
case 23:
|
|
58802
58657
|
_yield$Promise$all3 = _context34.sent;
|
|
58803
58658
|
_yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 3);
|
|
58804
58659
|
oldPrimary = _yield$Promise$all4[0];
|
|
58805
58660
|
oldSecondary1SpID = _yield$Promise$all4[1];
|
|
58806
58661
|
oldSecondary2SpID = _yield$Promise$all4[2];
|
|
58807
|
-
_context34.next =
|
|
58662
|
+
_context34.next = 30;
|
|
58808
58663
|
return this.updateEntityManagerReplicaSet({
|
|
58809
58664
|
userId: userId,
|
|
58810
58665
|
primary: primarySpID,
|
|
@@ -58813,36 +58668,36 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58813
58668
|
oldSecondaries: [oldSecondary1SpID, oldSecondary2SpID]
|
|
58814
58669
|
});
|
|
58815
58670
|
|
|
58816
|
-
case
|
|
58671
|
+
case 30:
|
|
58817
58672
|
txReceipt = _context34.sent;
|
|
58818
58673
|
replicaSetSPIDs = [primarySpID, secondary1SpID, secondary2SpID];
|
|
58819
|
-
updateEndpointTxBlockNumber =
|
|
58820
|
-
_context34.next =
|
|
58674
|
+
updateEndpointTxBlockNumber = txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.blockNumber;
|
|
58675
|
+
_context34.next = 35;
|
|
58821
58676
|
return this.waitForReplicaSetDiscoveryIndexing(userId, replicaSetSPIDs, updateEndpointTxBlockNumber);
|
|
58822
58677
|
|
|
58823
|
-
case
|
|
58678
|
+
case 35:
|
|
58824
58679
|
if (txReceipt) {
|
|
58825
|
-
_context34.next =
|
|
58680
|
+
_context34.next = 37;
|
|
58826
58681
|
break;
|
|
58827
58682
|
}
|
|
58828
58683
|
|
|
58829
58684
|
throw new Error('Unable to update replica set on chain');
|
|
58830
58685
|
|
|
58831
|
-
case
|
|
58686
|
+
case 37:
|
|
58832
58687
|
return _context34.abrupt("return", {
|
|
58833
58688
|
txReceipt: txReceipt,
|
|
58834
58689
|
replicaSetSPIDs: replicaSetSPIDs
|
|
58835
58690
|
});
|
|
58836
58691
|
|
|
58837
|
-
case
|
|
58692
|
+
case 38:
|
|
58838
58693
|
case "end":
|
|
58839
58694
|
return _context34.stop();
|
|
58840
58695
|
}
|
|
58841
58696
|
}
|
|
58842
|
-
}, _callee34, this
|
|
58697
|
+
}, _callee34, this);
|
|
58843
58698
|
}));
|
|
58844
58699
|
|
|
58845
|
-
function _updateReplicaSetOnChain(
|
|
58700
|
+
function _updateReplicaSetOnChain(_x40, _x41) {
|
|
58846
58701
|
return _updateReplicaSetOnChain2.apply(this, arguments);
|
|
58847
58702
|
}
|
|
58848
58703
|
|
|
@@ -58897,7 +58752,7 @@ var Users = /*#__PURE__*/function (_Base) {
|
|
|
58897
58752
|
}, _callee35, this);
|
|
58898
58753
|
}));
|
|
58899
58754
|
|
|
58900
|
-
function _retrieveSpIDFromEndpoint(
|
|
58755
|
+
function _retrieveSpIDFromEndpoint(_x42) {
|
|
58901
58756
|
return _retrieveSpIDFromEndpoint2.apply(this, arguments);
|
|
58902
58757
|
}
|
|
58903
58758
|
|
|
@@ -59744,10 +59599,10 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
59744
59599
|
}, {
|
|
59745
59600
|
key: "uploadTrack",
|
|
59746
59601
|
value: function () {
|
|
59747
|
-
var _uploadTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(trackFile, coverArtFile, metadata, onProgress
|
|
59602
|
+
var _uploadTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(trackFile, coverArtFile, metadata, onProgress) {
|
|
59748
59603
|
var _this2 = this;
|
|
59749
59604
|
|
|
59750
|
-
var phases, phase, ownerId, _yield$retry, metadataMultihash, metadataFileUUID, transcodedTrackUUID, transcodedTrackCID,
|
|
59605
|
+
var phases, phase, ownerId, _yield$retry, metadataMultihash, metadataFileUUID, transcodedTrackUUID, transcodedTrackCID, trackId, response, txReceipt;
|
|
59751
59606
|
|
|
59752
59607
|
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
59753
59608
|
while (1) {
|
|
@@ -59824,42 +59679,23 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
59824
59679
|
transcodedTrackCID = _yield$retry.transcodedTrackCID;
|
|
59825
59680
|
phase = phases.ADDING_TRACK; // Write metadata to chain
|
|
59826
59681
|
|
|
59827
|
-
|
|
59828
|
-
_context19.next = 31;
|
|
59829
|
-
break;
|
|
59830
|
-
}
|
|
59831
|
-
|
|
59832
|
-
_context19.next = 24;
|
|
59682
|
+
_context19.next = 23;
|
|
59833
59683
|
return this._generateTrackId();
|
|
59834
59684
|
|
|
59835
|
-
case
|
|
59685
|
+
case 23:
|
|
59836
59686
|
trackId = _context19.sent;
|
|
59837
|
-
_context19.next =
|
|
59687
|
+
_context19.next = 26;
|
|
59838
59688
|
return this.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.CREATE, metadataMultihash);
|
|
59839
59689
|
|
|
59840
|
-
case
|
|
59690
|
+
case 26:
|
|
59841
59691
|
response = _context19.sent;
|
|
59842
59692
|
txReceipt = response.txReceipt;
|
|
59843
|
-
_context19.next = 37;
|
|
59844
|
-
break;
|
|
59845
|
-
|
|
59846
|
-
case 31:
|
|
59847
|
-
multihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
59848
|
-
_context19.next = 34;
|
|
59849
|
-
return this.contracts.TrackFactoryClient.addTrack(ownerId, multihashDecoded.digest, multihashDecoded.hashFn, multihashDecoded.size);
|
|
59850
|
-
|
|
59851
|
-
case 34:
|
|
59852
|
-
_response = _context19.sent;
|
|
59853
|
-
txReceipt = _response.txReceipt;
|
|
59854
|
-
trackId = _response.trackId;
|
|
59855
|
-
|
|
59856
|
-
case 37:
|
|
59857
59693
|
phase = phases.ASSOCIATING_TRACK; // Associate the track id with the file metadata and block number
|
|
59858
59694
|
|
|
59859
|
-
_context19.next =
|
|
59695
|
+
_context19.next = 31;
|
|
59860
59696
|
return this.creatorNode.associateTrack(trackId, metadataFileUUID, txReceipt.blockNumber, transcodedTrackUUID);
|
|
59861
59697
|
|
|
59862
|
-
case
|
|
59698
|
+
case 31:
|
|
59863
59699
|
return _context19.abrupt("return", {
|
|
59864
59700
|
blockHash: txReceipt.blockHash,
|
|
59865
59701
|
blockNumber: txReceipt.blockNumber,
|
|
@@ -59868,23 +59704,23 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
59868
59704
|
error: false
|
|
59869
59705
|
});
|
|
59870
59706
|
|
|
59871
|
-
case
|
|
59872
|
-
_context19.prev =
|
|
59707
|
+
case 34:
|
|
59708
|
+
_context19.prev = 34;
|
|
59873
59709
|
_context19.t0 = _context19["catch"](4);
|
|
59874
59710
|
return _context19.abrupt("return", {
|
|
59875
59711
|
error: _context19.t0.message,
|
|
59876
59712
|
phase: phase
|
|
59877
59713
|
});
|
|
59878
59714
|
|
|
59879
|
-
case
|
|
59715
|
+
case 37:
|
|
59880
59716
|
case "end":
|
|
59881
59717
|
return _context19.stop();
|
|
59882
59718
|
}
|
|
59883
59719
|
}
|
|
59884
|
-
}, _callee19, this, [[4,
|
|
59720
|
+
}, _callee19, this, [[4, 34]]);
|
|
59885
59721
|
}));
|
|
59886
59722
|
|
|
59887
|
-
function uploadTrack(_x13, _x14, _x15, _x16
|
|
59723
|
+
function uploadTrack(_x13, _x14, _x15, _x16) {
|
|
59888
59724
|
return _uploadTrack.apply(this, arguments);
|
|
59889
59725
|
}
|
|
59890
59726
|
|
|
@@ -59981,7 +59817,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
59981
59817
|
}, _callee21, this);
|
|
59982
59818
|
}));
|
|
59983
59819
|
|
|
59984
|
-
function uploadTrackContentToCreatorNode(_x18, _x19, _x20
|
|
59820
|
+
function uploadTrackContentToCreatorNode(_x17, _x18, _x19, _x20) {
|
|
59985
59821
|
return _uploadTrackContentToCreatorNode.apply(this, arguments);
|
|
59986
59822
|
}
|
|
59987
59823
|
|
|
@@ -59996,7 +59832,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
59996
59832
|
}, {
|
|
59997
59833
|
key: "addTracksToChainAndCnode",
|
|
59998
59834
|
value: function () {
|
|
59999
|
-
var _addTracksToChainAndCnode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(trackMultihashAndUUIDList
|
|
59835
|
+
var _addTracksToChainAndCnode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(trackMultihashAndUUIDList) {
|
|
60000
59836
|
var _this4 = this;
|
|
60001
59837
|
|
|
60002
59838
|
var ownerId, addedToChain, requestFailed, associatedWithCreatorNode;
|
|
@@ -60020,8 +59856,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60020
59856
|
_context24.next = 8;
|
|
60021
59857
|
return Promise.all(trackMultihashAndUUIDList.map( /*#__PURE__*/function () {
|
|
60022
59858
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(trackInfo, i) {
|
|
60023
|
-
var metadataMultihash, metadataFileUUID, transcodedTrackUUID,
|
|
60024
|
-
|
|
59859
|
+
var metadataMultihash, metadataFileUUID, transcodedTrackUUID, trackId, response, txReceipt;
|
|
60025
59860
|
return regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
60026
59861
|
while (1) {
|
|
60027
59862
|
switch (_context22.prev = _context22.next) {
|
|
@@ -60029,60 +59864,41 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60029
59864
|
_context22.prev = 0;
|
|
60030
59865
|
metadataMultihash = trackInfo.metadataMultihash, metadataFileUUID = trackInfo.metadataFileUUID, transcodedTrackUUID = trackInfo.transcodedTrackUUID; // Write metadata to chain
|
|
60031
59866
|
|
|
60032
|
-
|
|
60033
|
-
_context22.next = 12;
|
|
60034
|
-
break;
|
|
60035
|
-
}
|
|
60036
|
-
|
|
60037
|
-
_context22.next = 5;
|
|
59867
|
+
_context22.next = 4;
|
|
60038
59868
|
return _this4._generateTrackId();
|
|
60039
59869
|
|
|
60040
|
-
case
|
|
59870
|
+
case 4:
|
|
60041
59871
|
trackId = _context22.sent;
|
|
60042
|
-
_context22.next =
|
|
59872
|
+
_context22.next = 7;
|
|
60043
59873
|
return _this4.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.CREATE, metadataMultihash);
|
|
60044
59874
|
|
|
60045
|
-
case
|
|
59875
|
+
case 7:
|
|
60046
59876
|
response = _context22.sent;
|
|
60047
59877
|
txReceipt = response.txReceipt;
|
|
60048
|
-
_context22.next = 18;
|
|
60049
|
-
break;
|
|
60050
|
-
|
|
60051
|
-
case 12:
|
|
60052
|
-
multihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
60053
|
-
_context22.next = 15;
|
|
60054
|
-
return _this4.contracts.TrackFactoryClient.addTrack(ownerId, multihashDecoded.digest, multihashDecoded.hashFn, multihashDecoded.size);
|
|
60055
|
-
|
|
60056
|
-
case 15:
|
|
60057
|
-
_response2 = _context22.sent;
|
|
60058
|
-
txReceipt = _response2.txReceipt;
|
|
60059
|
-
trackId = _response2.trackId;
|
|
60060
|
-
|
|
60061
|
-
case 18:
|
|
60062
59878
|
addedToChain[i] = {
|
|
60063
59879
|
trackId: trackId,
|
|
60064
59880
|
metadataFileUUID: metadataFileUUID,
|
|
60065
59881
|
transcodedTrackUUID: transcodedTrackUUID,
|
|
60066
59882
|
txReceipt: txReceipt
|
|
60067
59883
|
};
|
|
60068
|
-
_context22.next =
|
|
59884
|
+
_context22.next = 16;
|
|
60069
59885
|
break;
|
|
60070
59886
|
|
|
60071
|
-
case
|
|
60072
|
-
_context22.prev =
|
|
59887
|
+
case 12:
|
|
59888
|
+
_context22.prev = 12;
|
|
60073
59889
|
_context22.t0 = _context22["catch"](0);
|
|
60074
59890
|
requestFailed = true;
|
|
60075
59891
|
console.error(_context22.t0);
|
|
60076
59892
|
|
|
60077
|
-
case
|
|
59893
|
+
case 16:
|
|
60078
59894
|
case "end":
|
|
60079
59895
|
return _context22.stop();
|
|
60080
59896
|
}
|
|
60081
59897
|
}
|
|
60082
|
-
}, _callee22, null, [[0,
|
|
59898
|
+
}, _callee22, null, [[0, 12]]);
|
|
60083
59899
|
}));
|
|
60084
59900
|
|
|
60085
|
-
return function (
|
|
59901
|
+
return function (_x22, _x23) {
|
|
60086
59902
|
return _ref3.apply(this, arguments);
|
|
60087
59903
|
};
|
|
60088
59904
|
}()));
|
|
@@ -60128,7 +59944,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60128
59944
|
}, _callee23);
|
|
60129
59945
|
}));
|
|
60130
59946
|
|
|
60131
|
-
return function (
|
|
59947
|
+
return function (_x24) {
|
|
60132
59948
|
return _ref4.apply(this, arguments);
|
|
60133
59949
|
};
|
|
60134
59950
|
}()));
|
|
@@ -60163,7 +59979,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60163
59979
|
}, _callee24, this, [[11, 16]]);
|
|
60164
59980
|
}));
|
|
60165
59981
|
|
|
60166
|
-
function addTracksToChainAndCnode(
|
|
59982
|
+
function addTracksToChainAndCnode(_x21) {
|
|
60167
59983
|
return _addTracksToChainAndCnode.apply(this, arguments);
|
|
60168
59984
|
}
|
|
60169
59985
|
|
|
@@ -60178,8 +59994,8 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60178
59994
|
}, {
|
|
60179
59995
|
key: "updateTrack",
|
|
60180
59996
|
value: function () {
|
|
60181
|
-
var _updateTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(metadata
|
|
60182
|
-
var ownerId, _yield$this$creatorNo, metadataMultihash, metadataFileUUID,
|
|
59997
|
+
var _updateTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(metadata) {
|
|
59998
|
+
var ownerId, _yield$this$creatorNo, metadataMultihash, metadataFileUUID, trackId, response, txReceipt;
|
|
60183
59999
|
|
|
60184
60000
|
return regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
60185
60001
|
while (1) {
|
|
@@ -60209,43 +60025,26 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60209
60025
|
_yield$this$creatorNo = _context25.sent;
|
|
60210
60026
|
metadataMultihash = _yield$this$creatorNo.metadataMultihash;
|
|
60211
60027
|
metadataFileUUID = _yield$this$creatorNo.metadataFileUUID;
|
|
60028
|
+
// Write the new metadata to chain
|
|
60212
60029
|
trackId = metadata.track_id;
|
|
60213
|
-
|
|
60214
|
-
if (!useEntityManager) {
|
|
60215
|
-
_context25.next = 20;
|
|
60216
|
-
break;
|
|
60217
|
-
}
|
|
60218
|
-
|
|
60219
|
-
_context25.next = 16;
|
|
60030
|
+
_context25.next = 15;
|
|
60220
60031
|
return this.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.UPDATE, metadataMultihash);
|
|
60221
60032
|
|
|
60222
|
-
case
|
|
60033
|
+
case 15:
|
|
60223
60034
|
response = _context25.sent;
|
|
60224
|
-
txReceipt = response.txReceipt;
|
|
60225
|
-
_context25.next = 25;
|
|
60226
|
-
break;
|
|
60227
|
-
|
|
60228
|
-
case 20:
|
|
60229
|
-
multihashDecoded = Utils.decodeMultihash(metadataMultihash);
|
|
60230
|
-
_context25.next = 23;
|
|
60231
|
-
return this.contracts.TrackFactoryClient.updateTrack(trackId, ownerId, multihashDecoded.digest, multihashDecoded.hashFn, multihashDecoded.size);
|
|
60035
|
+
txReceipt = response.txReceipt; // Re-associate the track id with the new metadata
|
|
60232
60036
|
|
|
60233
|
-
|
|
60234
|
-
_response3 = _context25.sent;
|
|
60235
|
-
txReceipt = _response3.txReceipt;
|
|
60236
|
-
|
|
60237
|
-
case 25:
|
|
60238
|
-
_context25.next = 27;
|
|
60037
|
+
_context25.next = 19;
|
|
60239
60038
|
return this.creatorNode.associateTrack(trackId, metadataFileUUID, txReceipt.blockNumber);
|
|
60240
60039
|
|
|
60241
|
-
case
|
|
60040
|
+
case 19:
|
|
60242
60041
|
return _context25.abrupt("return", {
|
|
60243
60042
|
blockHash: txReceipt.blockHash,
|
|
60244
60043
|
blockNumber: txReceipt.blockNumber,
|
|
60245
60044
|
trackId: trackId
|
|
60246
60045
|
});
|
|
60247
60046
|
|
|
60248
|
-
case
|
|
60047
|
+
case 20:
|
|
60249
60048
|
case "end":
|
|
60250
60049
|
return _context25.stop();
|
|
60251
60050
|
}
|
|
@@ -60253,7 +60052,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60253
60052
|
}, _callee25, this);
|
|
60254
60053
|
}));
|
|
60255
60054
|
|
|
60256
|
-
function updateTrack(
|
|
60055
|
+
function updateTrack(_x25) {
|
|
60257
60056
|
return _updateTrack.apply(this, arguments);
|
|
60258
60057
|
}
|
|
60259
60058
|
|
|
@@ -60295,7 +60094,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60295
60094
|
}, _callee26, this);
|
|
60296
60095
|
}));
|
|
60297
60096
|
|
|
60298
|
-
function logTrackListen(
|
|
60097
|
+
function logTrackListen(_x26, _x27) {
|
|
60299
60098
|
return _logTrackListen.apply(this, arguments);
|
|
60300
60099
|
}
|
|
60301
60100
|
|
|
@@ -60329,7 +60128,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60329
60128
|
}, _callee27, this);
|
|
60330
60129
|
}));
|
|
60331
60130
|
|
|
60332
|
-
function addTrackRepost(
|
|
60131
|
+
function addTrackRepost(_x28) {
|
|
60333
60132
|
return _addTrackRepost.apply(this, arguments);
|
|
60334
60133
|
}
|
|
60335
60134
|
|
|
@@ -60364,7 +60163,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60364
60163
|
}, _callee28, this);
|
|
60365
60164
|
}));
|
|
60366
60165
|
|
|
60367
|
-
function deleteTrackRepost(
|
|
60166
|
+
function deleteTrackRepost(_x29) {
|
|
60368
60167
|
return _deleteTrackRepost.apply(this, arguments);
|
|
60369
60168
|
}
|
|
60370
60169
|
|
|
@@ -60399,7 +60198,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60399
60198
|
}, _callee29, this);
|
|
60400
60199
|
}));
|
|
60401
60200
|
|
|
60402
|
-
function addTrackSave(
|
|
60201
|
+
function addTrackSave(_x30) {
|
|
60403
60202
|
return _addTrackSave.apply(this, arguments);
|
|
60404
60203
|
}
|
|
60405
60204
|
|
|
@@ -60434,7 +60233,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60434
60233
|
}, _callee30, this);
|
|
60435
60234
|
}));
|
|
60436
60235
|
|
|
60437
|
-
function deleteTrackSave(
|
|
60236
|
+
function deleteTrackSave(_x31) {
|
|
60438
60237
|
return _deleteTrackSave.apply(this, arguments);
|
|
60439
60238
|
}
|
|
60440
60239
|
|
|
@@ -60448,41 +60247,29 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60448
60247
|
}, {
|
|
60449
60248
|
key: "deleteTrack",
|
|
60450
60249
|
value: function () {
|
|
60451
|
-
var _deleteTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(trackId
|
|
60250
|
+
var _deleteTrack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(trackId) {
|
|
60452
60251
|
var ownerId;
|
|
60453
60252
|
return regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
60454
60253
|
while (1) {
|
|
60455
60254
|
switch (_context31.prev = _context31.next) {
|
|
60456
60255
|
case 0:
|
|
60457
|
-
if (!useEntityManager) {
|
|
60458
|
-
_context31.next = 9;
|
|
60459
|
-
break;
|
|
60460
|
-
}
|
|
60461
|
-
|
|
60462
60256
|
ownerId = this.userStateManager.getCurrentUserId();
|
|
60463
60257
|
|
|
60464
60258
|
if (ownerId) {
|
|
60465
|
-
_context31.next =
|
|
60259
|
+
_context31.next = 3;
|
|
60466
60260
|
break;
|
|
60467
60261
|
}
|
|
60468
60262
|
|
|
60469
60263
|
throw new Error('No users loaded for this wallet');
|
|
60470
60264
|
|
|
60471
|
-
case
|
|
60472
|
-
_context31.next =
|
|
60265
|
+
case 3:
|
|
60266
|
+
_context31.next = 5;
|
|
60473
60267
|
return this.contracts.EntityManagerClient.manageEntity(ownerId, EntityManagerClient.EntityType.TRACK, trackId, EntityManagerClient.Action.DELETE, '');
|
|
60474
60268
|
|
|
60475
|
-
case
|
|
60476
|
-
return _context31.abrupt("return", _context31.sent);
|
|
60477
|
-
|
|
60478
|
-
case 9:
|
|
60479
|
-
_context31.next = 11;
|
|
60480
|
-
return this.contracts.TrackFactoryClient.deleteTrack(trackId);
|
|
60481
|
-
|
|
60482
|
-
case 11:
|
|
60269
|
+
case 5:
|
|
60483
60270
|
return _context31.abrupt("return", _context31.sent);
|
|
60484
60271
|
|
|
60485
|
-
case
|
|
60272
|
+
case 6:
|
|
60486
60273
|
case "end":
|
|
60487
60274
|
return _context31.stop();
|
|
60488
60275
|
}
|
|
@@ -60490,7 +60277,7 @@ var Track = /*#__PURE__*/function (_Base) {
|
|
|
60490
60277
|
}, _callee31, this);
|
|
60491
60278
|
}));
|
|
60492
60279
|
|
|
60493
|
-
function deleteTrack(
|
|
60280
|
+
function deleteTrack(_x32) {
|
|
60494
60281
|
return _deleteTrack.apply(this, arguments);
|
|
60495
60282
|
}
|
|
60496
60283
|
|
|
@@ -66121,9 +65908,7 @@ var rolloverNodes = /*#__PURE__*/function () {
|
|
|
66121
65908
|
newMetadata.creator_node_endpoint = newEndpoints.join(',');
|
|
66122
65909
|
console.debug("Sanity Check - rolloverNodes - new nodes ".concat(newMetadata.creator_node_endpoint));
|
|
66123
65910
|
_context4.next = 32;
|
|
66124
|
-
return (_libs$User3 = libs.User) === null || _libs$User3 === void 0 ? void 0 : _libs$User3.updateCreator(user.user_id, newMetadata
|
|
66125
|
-
/* useEntityManager */
|
|
66126
|
-
);
|
|
65911
|
+
return (_libs$User3 = libs.User) === null || _libs$User3 === void 0 ? void 0 : _libs$User3.updateCreator(user.user_id, newMetadata);
|
|
66127
65912
|
|
|
66128
65913
|
case 32:
|
|
66129
65914
|
_context4.next = 37;
|